text:
import {get} from 'lodash';
import {Interceptor} from '@ciscospark/http-core';

/**
 * @class
 */
export default class RequestEventInterceptor extends Interceptor {
  /**
   * @returns {RequestEventInterceptor}
   */
  static create() {
    return new RequestEventInterceptor({spark: this});
  }

  /**
   * @see Interceptor#onRequest
   * @param {Object} options
   * @returns {Object}
   */
  onRequest(options) {
    const logger = get(this, 'spark.logger', console);
    try {
      this.spark.trigger('request:start', options);
    }
    catch (error) {
      logger.warn('event handler for request:start failed ', error);
    }
    return Promise.resolve(options);
  }

  /**
   * @see Interceptor#onRequest
   * @param {Object} options
   * @param {Error} reason
   * @returns {Object}
   */
  onRequestError(options, reason) {
    // We need to do the normal onRequest logging, but then log how the request
    // failed since the response logger won't be called.
    const logger = get(this, 'spark.logger', console);
    try {
      this.spark.trigger('request:end', options, reason);
      this.spark.trigger('request:failure', options, reason);
    }
    catch (error) {
      logger.warn('event handler for request:end failed ', error);
    }
    return Promise.reject(reason);
  }

  /**
   * @see Interceptor#onResponse
   * @param {Object} options
   * @param {HttpResponse} response
   * @returns {Object}
   */
  onResponse(options, response) {
    const logger = get(this, 'spark.logger', console);
    try {
      this.spark.trigger('request:success', response.options, response);
    }
    catch (error) {
      logger.warn('event handler for request:success failed ', error);
    }
    return Promise.resolve(response);
  }

  /**
   * @see Interceptor#onResponseError
   * @param {Object} options
   * @param {Error} reason
   * @returns {Object}
   */
  onResponseError(options, reason) {
    const logger = get(this, 'spark.logger', console);
    try {
      this.spark.trigger('request:end', options, reason);
      this.spark.trigger('request:failure', options, reason);
    }
    catch (error) {
      logger.warn('event handler for request:failure failed ', error);
    }
    return Promise.reject(reason);
  }
}


text:
'use strict';

const db = require('./db');

const HAProxyModule = require('./module').HAProxyModule;
const logger = require('../core').logger;

module.exports = (serverDB, serverInstance, server, options) => {
    let module = new HAProxyModule(serverDB, db, serverInstance, server, options);

    logger.info(`Init "${module.name.toUpperCase()}" module. Version - ${module.version}`);

    return {
        module: module,
        middlewares: require('./middlewares')(db)
    };
};

redpajama_set_name: RedPajamaGithub


text:
using DarkSoulsII.DebugView.Core;
using DarkSoulsII.DebugView.Model.Map.Location;
using DarkSoulsII.DebugView.Model.Map.Location.Phantom;

namespace DarkSoulsII.DebugView.Model.Rtti
{
    public class MapGeneralLocationResolver : AbstractRttiResolver<MapGeneralLocation>
    {
        protected override IPointer<MapGeneralLocation> ResolvePointerTransitive(IPointerFactory pointerFactory, int address, bool relative, int vtable)
        {
            IPointer<MapGeneralLocation> pointer;
            switch (vtable)
            {
                case 0x012C03A0:
                    pointer = pointerFactory.Create<MapGeneralWindLocation>(address, relative, true);
                    break;
                case 0x012C02DC:
                    pointer = pointerFactory.Create<MapGeneralStatueLocation>(address, relative, true);
                    break;
                case 0x012C0244:
                    pointer = pointerFactory.Create<MapGeneralSlideLocation>(address, relative, true);
                    break;
                case 0x012C0194:
                    pointer = pointerFactory.Create<MapGeneralPhantomLocation>(address, relative, true);
                    break;
                case 0x012C0110:
                    pointer = pointerFactory.Create<MapGeneralNavimeshLocation>(address, relative, true);
                    break;
                case 0x012C0040:
                    pointer = pointerFactory.Create<MapGeneralLogicNoEntryLocation>(address, relative, true);
                    break;
                case 0x012BFF78:
                    pointer = pointerFactory.Create<MapGeneralLogicLocation>(address, relative, true);
                    break;
                case 0x012BFEC8:
                    pointer = pointerFactory.Create<MapGeneralLockOffLocation>(address, relative, true);
                    break;
                case 0x012BFE10:
                    pointer = pointerFactory.Create<MapGeneralIntrudeLocation>(address, relative, true);
                    break;
                case 0x012BFD78:
                    pointer = pointerFactory.Create<MapGeneralGeneratorLocation>(address, relative, true);
                    break;
                case 0x012BFCBC:
                    pointer = pointerFactory.Create<MapGeneralEventTriggerLocation>(address, relative, true);
                    break;
                case 0x012BFBF4:
                    pointer = pointerFactory.Create<MapGeneralEventJudgmentLocation>(address, relative, true);
                    break;
                case 0x012BFB2C:
                    pointer = pointerFactory.Create<MapGeneralDamageLocation>(address, relative, true);
                    break;
                case 0x012BFAA8:
                    pointer = pointerFactory.Create<MapGeneralBulletLocation>(address, relative, true);
                    break;
                case 0x012BF9DC:
                    pointer = pointerFactory.Create<MapGeneralBrightLocation>(address, relative, true);
                    break;
                case 0x012BF924:
                    pointer = pointerFactory.Create<MapGeneralBloodMsgLocation>(address, relative, true);
                    break;
                case 0x012BF8BC:
                    pointer = pointerFactory.Create<MapGeneralBloodMsgDisableLocation>(address, relative, true);
                    break;
                case 0x012BF7D8:
                    pointer = pointerFactory.Create<MapGeneralBackreadSafetyLocation>(address, relative, true);
                    break;
                case 0x012D947C:
                    pointer = pointerFactory.Create<MapGeneralAdviceBloodMsgLocation>(address, relative, true);
                    break;
                case 0x012D4A94:
                    pointer = pointerFactory.Create<MapGeneralLocation>(address, relative, true);
                    break;
                default:
                    pointer = null;
                    break;
            }
            return pointer;
        }
    }
}


text:
#pragma once
#include <aws/mediaconvert/MediaConvert_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>

namespace Aws
{
namespace MediaConvert
{
namespace Model
{
  enum class Mpeg2AdaptiveQuantization
  {
    NOT_SET,
    OFF,
    LOW,
    MEDIUM,
    HIGH
  };

namespace Mpeg2AdaptiveQuantizationMapper
{
AWS_MEDIACONVERT_API Mpeg2AdaptiveQuantization GetMpeg2AdaptiveQuantizationForName(const Aws::String& name);

AWS_MEDIACONVERT_API Aws::String GetNameForMpeg2AdaptiveQuantization(Mpeg2AdaptiveQuantization value);
} // namespace Mpeg2AdaptiveQuantizationMapper
} // namespace Model
} // namespace MediaConvert
} // namespace Aws


text:
<?xml version="1.0" encoding="UTF-8"?>
<java version="1.5.0_06" class="java.beans.XMLDecoder">
 <object class="org.jgraph.graph.GraphLayoutCache">
  <object class="com.rm.app.graph.RMModel"/>
  <object class="org.jgraph.graph.DefaultCellViewFactory"/>
  <boolean>true</boolean>
  <void property="localAttributes">
   <void method="add">
    <string>bounds</string>
   </void>
  </void>
  <void id="HashSet0" property="visibleSet">
   <void method="add">
    <object class="com.rm.app.graph.RMGraphCell">
     <string>SR</string>
     <void method="add">
      <object id="DefaultPort0" class="org.jgraph.graph.DefaultPort"/>
     </void>
     <void property="attributes">
      <void method="put">
       <string>opaque</string>
       <boolean>true</boolean>
      </void>
      <void method="put">
       <string>icon</string>
       <object id="ImageIcon0" class="javax.swing.ImageIcon">
        <string>file:/F:/ws/rm/rm/bin/com/rm/images/equation.jpg</string>
       </object>
      </void>
      <void method="put">
       <string>gradientColor</string>
       <object id="Color0" class="java.awt.Color">
        <int>255</int>
        <int>255</int>
        <int>255</int>
        <int>255</int>
       </object>
      </void>
      <void method="put">
       <string>backgroundColor</string>
       <object idref="Color0"/>
      </void>
      <void method="put">
       <string>bordercolor</string>
       <object idref="Color0"/>
      </void>
     </void>
     <void property="classifierKey">
      <string>equation</string>
     </void>
     <void property="dataMap">
      <void method="put">
       <string>R Commands</string>
       <object class="com.rm.app.graph.Attribute">
        <void property="name">
         <string>R Commands</string>
        </void>
        <void property="type">
         <string>textarea</string>
        </void>
        <void property="value">
         <string>ccccccccccccccc</string>
        </void>
       </object>
      </void>
     </void>
     <void property="id">
      <string>SR_1227539506926</string>
     </void>
     <void property="key">
      <string>equation.sr</string>
     </void>
     <void property="name">
      <string>SR</string>
     </void>
     <void property="posX">
      <double>221.0</double>
     </void>
     <void property="posY">
      <double>190.0</double>
     </void>
     <void property="viewLabel">
      <string>SR</string>
     </void>
    </object>
   </void>
   <void method="add">
    <object class="com.rm.app.graph.RMGraphCell">
     <string>SR</string>
     <void method="add">
      <object id="DefaultPort1" class="org.jgraph.graph.DefaultPort"/>
     </void>
     <void property="attributes">
      <void method="put">
       <string>opaque</string>
       <boolean>true</boolean>
      </void>
      <void method="put">
       <string>icon</string>
       <object idref="ImageIcon0"/>
      </void>
      <void method="put">
       <string>gradientColor</string>
       <object idref="Color0"/>
      </void>
      <void method="put">
       <string>backgroundColor</string>
       <object idref="Color0"/>
      </void>
      <void method="put">
       <string>bordercolor</string>
       <object idref="Color0"/>
      </void>
     </void>
     <void property="classifierKey">
      <string>equation</string>
     </void>
     <void property="dataMap">
      <void method="put">
       <string>R Commands</string>
       <object class="com.rm.app.graph.Attribute">
        <void property="name">
         <string>R Commands</string>
        </void>
        <void property="type">
         <string>textarea</string>
        </void>
       </object>
      </void>
     </void>
     <void property="id">
      <string>SR_1227539501161</string>
     </void>
     <void property="key">
      <string>equation.sr</string>
     </void>
     <void property="name">
      <string>SR</string>
     </void>
     <void property="posX">
      <double>107.0</double>
     </void>
     <void property="posY">
      <double>71.0</double>
     </void>
     <void property="viewLabel">
      <string>SR</string>
     </void>
    </object>
   </void>
   <void method="add">
    <object id="DefaultPort2" class="org.jgraph.graph.DefaultPort"/>
   </void>
   <void method="add">
    <object idref="DefaultPort1"/>
   </void>
   <void method="add">
    <object class="com.rm.app.graph.RMGraphCell">
     <string>SR</string>
     <void method="add">
      <object idref="DefaultPort2"/>
     </void>
     <void property="attributes">
      <void method="put">
       <string>opaque</string>
       <boolean>true</boolean>
      </void>
      <void method="put">
       <string>icon</string>
       <object idref="ImageIcon0"/>
      </void>
      <void method="put">
       <string>gradientColor</string>
       <object idref="Color0"/>
      </void>
      <void method="put">
       <string>backgroundColor</string>
       <object idref="Color0"/>
      </void>
      <void method="put">
       <string>bordercolor</string>
       <object idref="Color0"/>
      </void>
     </void>
     <void property="classifierKey">
      <string>equation</string>
     </void>
     <void property="dataMap">
      <void method="put">
       <string>R Commands</string>
       <object class="com.rm.app.graph.Attribute">
        <void property="name">
         <string>R Commands</string>
        </void>
        <void property="type">
         <string>textarea</string>
        </void>
        <void property="value">
         <string>aaaaaaaaaaaa</string>
        </void>
       </object>
      </void>
     </void>
     <void property="id">
      <string>SR_1227539502176</string>
     </void>
     <void property="key">
      <string>equation.sr</string>
     </void>
     <void property="name">
      <string>SR</string>
     </void>
     <void property="posX">
      <double>303.0</double>
     </void>
     <void property="posY">
      <double>77.0</double>
     </void>
     <void property="viewLabel">
      <string>SR</string>
     </void>
    </object>
   </void>
   <void method="add">
    <object idref="DefaultPort0"/>
   </void>
  </void>
  <void property="visibleSet">
   <object idref="HashSet0"/>
  </void>
 </object>
</java>


text:
tinySVGRenderer
===============

libsvgtiny (http://www.netsurf-browser.org/projects/libsvgtiny/) based SVG renderer for iOS, extends UIImage and has a scalable SVGImageView, can render into CGContext.

Building
========

You will need the following to build the SVG renderer library:
* gperf (http://www.gnu.org/software/gperf/), install with homebrew
* perl

The project is organized into a library "tinySVGRenderer" and a demo project "Demo"

Usage (ultra-short Version)
===========================

More documentation will follow soon...

## Create a UIImage from a SVG file

~~~objc
#import "UIImage+SVG.h"

...

UIImage *image = [UIImage imageNamed:@"tiger"];
~~~
(Assuming you have an image named "tiger.svg" in your project, all other `UIImage` creation methods are internally swizzled to support SVG files, so just replace your PNGs with an appropriate SVG and do not touch any code)

## Create a auto-scaling image view

~~~objc
#import "SVGImageView.h"

...

SVGImageView *svgView = [[SVGImageView alloc] initWithFrame:self.view.frame svgFile:@"tiger"];
~~~
(Assuming you have an image named "tiger.svg" in your project.)

## Rendering a SVG object into a CGContext

~~~objc
#import "SVGObject.h"

...

SVGObject *svg = [[SVGObject alloc] initWithSVGNamed:@"tiger"];

// optionally set size to render (if different from values encoded in SVG-File)
// [svg setSize:CGSizeMake(100, 100)];

[svg renderInContext:context];
~~~
(Assuming you have an image named "tiger.svg" in your project and `context` is a valid `CGContext`)


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/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.drools</groupId>
    <artifactId>drools</artifactId>
    <version>7.0.0-SNAPSHOT</version>
  </parent>

  <artifactId>drools-core</artifactId>
  <packaging>bundle</packaging><!-- bundle = jar + OSGi metadata -->

  <name>Drools :: Core</name>

  <properties>
    <surefire.forkCount>2</surefire.forkCount>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.core</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.compendium</artifactId>
      <scope>provided</scope>
    </dependency>
    <!--
      following are required for parser (lang). May be refactored out of
      core module.
    -->
    <dependency>
      <groupId>com.google.protobuf</groupId>
      <artifactId>protobuf-java</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>com.thoughtworks.xstream</groupId>
      <artifactId>xstream</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.mvel</groupId>
      <artifactId>mvel2</artifactId>
    </dependency>
    <dependency>
      <groupId>org.kie</groupId>
      <artifactId>kie-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.kie</groupId>
      <artifactId>kie-internal</artifactId>
    </dependency>
    <dependency>
      <groupId>org.antlr</groupId>
      <artifactId>antlr-runtime</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.antlr</groupId>
      <artifactId>antlr</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>com.sun.xml.bind</groupId>
      <artifactId>jaxb-xjc</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.sun.xml.bind</groupId>
      <artifactId>jaxb-core</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.sun.xml.bind</groupId>
      <artifactId>jaxb-impl</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.spec.javax.xml.bind</groupId>
      <artifactId>jboss-jaxb-api_2.2_spec</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.xml.stream</groupId>
      <artifactId>stax-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.activation</groupId>
      <artifactId>activation</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>javax.enterprise</groupId>
      <artifactId>cdi-api</artifactId>
      <scope>provided</scope><!-- HACK for OSGi: should be <optional>true</optional> instead -->
    </dependency>

    <!-- Logging -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency><!-- For unit test logging: configure in src/test/resources/logback-test.xml -->
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <scope>test</scope>
    </dependency>

    <!-- Base64 encoding -->
    <dependency>
      <groupId>commons-codec</groupId>
      <artifactId>commons-codec</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <profiles>
    <profile>
      <id>grammarsProfile</id>
      <activation>
        <property>
          <name>grammars</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin><!-- TODO JBRULES-2740 use mojo's antlr-maven-plugin or antlr3-maven-plugin so the jar versions are always up to date -->
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <phase>generate-sources</phase>
                <configuration>
                  <tasks if="generategrammars">
                    <path id="base.classpath">
                      <pathelement
                          path="${user.home}/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar"/>
                      <pathelement
                          path="${user.home}/.m2/repository/org/antlr/stringtemplate/3.2/stringtemplate-3.2.jar"/>
                      <pathelement
                          path="${user.home}/.m2/repository/org/antlr/antlr/3.1.1/antlr-3.1.1.jar"/>
                    </path>
                    <property name="antlr_classpath" refid="maven.compile.classpath"/>
                    <echo message="Generating Antlr Grammars"/>
                    <java classname="org.antlr.Tool" fork="true">
                      <arg
                          line="-lib src/test/resources/org/drools/reteoo/test/parser src/test/resources/org/drools/reteoo/test/parser/NodeTestDSL.g src/test/resources/org/drools/reteoo/test/parser/NodeTestDSLTree.g"/>
                      <classpath refid="base.classpath"/>
                    </java>
                    <move todir="src/test/java/org/drools/reteoo/test/parser">
                      <fileset dir="src/test/resources/org/drools/reteoo/test/parser">
                        <include name="**/*.java"/>
                        <exclude name="**/__*"/>
                      </fileset>
                    </move>
                    <delete>
                      <fileset dir="src/test/resources/org/drools/reteoo/test/parser">
                        <include name="**/*.tokens"/>
                        <include name="**/classes"/>
                        <include name="**/__*"/>
                        <include name="NodeTestDSL__.g"/>
                      </fileset>
                    </delete>
                  </tasks>
                </configuration>
                <goals>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>protobufProfile</id>
      <activation>
        <property>
          <name>proto</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.3.2</version>
            <executions>
              <execution>
                <goals>
                  <goal>exec</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <executable>protoc</executable>
              <arguments>
                <argument>-I=src/main/resources</argument>
                <argument>--java_out=src/main/java</argument>
                <argument>src/main/resources/org/drools/core/marshalling/droolsmessages.proto</argument>
              </arguments>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
      <resource>
        <filtering>true</filtering>
        <directory>src/main/filtered-resources</directory>
      </resource>
    </resources>

    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <configuration>
          <instructions>
            <Bundle-SymbolicName>org.drools.core</Bundle-SymbolicName>
            <Export-Package>
              org.drools.core.*
            </Export-Package>
            <Import-Package>
               org.drools.persistence.jpa;resolution:=optional,
               org.drools.persistence.jpa.processinstance;resolution:=optional,
               org.jbpm.marshalling.impl;resolution:=optional,
               org.jbpm.process.instance.impl;resolution:=optional,
               org.jbpm.process.instance.event;resolution:=optional,
               *
            </Import-Package>
            <Bundle-Activator>org.drools.core.osgi.Activator</Bundle-Activator>
            <_removeheaders>Private-Package</_removeheaders>
          </instructions>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <!-- Hack/workaround for https://bugs.openjdk.java.net/browse/JDK-8061305. The Javadoc generation fails for
               this class, so needs to be excluded. It seems the issue is fixed only in JDK 9+. -->
          <sourceFileExcludes>
            <sourceFileExclude>**/MetaProperty.java</sourceFileExclude>
          </sourceFileExcludes>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
        <configuration>
          <excludeFilterFile>${project.basedir}/src/main/findbugs/findbugs-exclude.xml</excludeFilterFile>
        </configuration>
      </plugin>

      <plugin>
        <artifactId>maven-eclipse-plugin</artifactId>
        <configuration>
          <additionalBuildcommands>
            <buildCommand>
              <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
              <triggers>auto,full,incremental,</triggers>
              <arguments>
                <LaunchConfigHandle><project>/.externalToolBuilders/mvn-resources.launch</LaunchConfigHandle>
              </arguments>
            </buildCommand>
          </additionalBuildcommands>
          <additionalConfig>
            <file>
              <name>.externalToolBuilders/mvn-resources.launch</name>
              <content>
                <![CDATA[<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType">
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="true"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="true"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE" value="${working_set:<?xml version="1.0" encoding="UTF-8"?>
<launchConfigurationWorkingSet editPageId="org.eclipse.ui.resourceWorkingSetPage" factoryID="org.eclipse.ui.internal.WorkingSetFactory" label="workingSet" name="workingSet">
<item factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/${project.artifactId}/src/main/resources" type="2"/>
</launchConfigurationWorkingSet>}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${env.M2_HOME}/bin/mvn"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="resources:resources"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/${project.artifactId}}"/>
</launchConfiguration>]]>
              </content>
            </file>
          </additionalConfig>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>


text:
<?php

namespace Fi\FormazioneBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class giornataType extends AbstractType
{
        /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('numero_giornata')
            ->add('descrizione')
            ->add('ordine')
            ->add('ore')
            ->add('note')
            ->add('corsi_id')
            ->add('calendario_corsi')
            ->add('corsi')
        ;
    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Fi\FormazioneBundle\Entity\giornata'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'fi_formazionebundle_giornata';
    }
}


text:
{% extends "templates/partials/base.html" %}

{% block title %}{% parent %} - Challenges{% endblock %}

{% block content %}

Challenges

            Challenges during the week

            Week challenge heats

            12 & 24 hour weekend challenges

{% endblock %}


text:
import React from 'react';
import { connect } from 'react-redux';
import * as actions from '../actions';

class Nav extends React.Component {
    run(e) {
        e.preventDefault();
        this.props.runCode();
    }

    fmt(e) {
        e.preventDefault();
        this.props.fmtCode();
    }

    changeLive(e) {
        this.props.switchLive(! this.props.live);
    }

    render() {
        let shareURL = '';
        if (this.props.sharing) {
            shareURL = <form className="navbar-form">
                <input type="text" id="share-url" className="form-control" value="https://bit.ly/asdsfafsd"/>
            </form>;
        }
        return

                    <button type="button" className="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false"      aria-controls="navbar">
                        Toggle navigation

                    </button>
                    The Go Playground (Redux)

                        Run

                        Format

                        <input type="checkbox" id="go-imports" />
                        {" Imports"}

Share

{ shareURL }

                        <input type="checkbox" id="go-live" checked={this.props.live} onChange={this.changeLive.bind(this)} />
                        {" WebSockets"}

About

        ;
    }
}

// Maps state from store to props
const mapStateToProps = (state, ownProps) => {
    return {
        sharing: state.sharing, // this.props.sharing
        live: state.live
    };
};

// Maps actions to props
const mapDispatchToProps = (dispatch) => {
    return {
        runCode: () => dispatch(actions.runCode()),
        fmtCode: () => dispatch(actions.fmtCode()),
        switchLive: (live) => dispatch(actions.switchLive(live))
    };
};

// Use connect to put them together
export default connect(mapStateToProps, mapDispatchToProps)(Nav);


text:
FArticyRefClassFilter::FArticyRefClassFilter(UClass* InGivenClass, bool bInRequiresExactClass) : GivenClass(InGivenClass), bRequiresExactClass(bInRequiresExactClass)
{
}

TSharedRef<IPropertyTypeCustomization> FArticyIdCustomization::MakeInstance()
{
	return MakeShareable(new FArticyIdCustomization());
}

void FArticyIdCustomization::CustomizeHeader(TSharedRef<IPropertyHandle> PropertyHandle, FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& CustomizationUtils)
{
	ArticyIdPropertyHandle = PropertyHandle;

	if(ArticyIdPropertyHandle->HasMetaData("ArticyNoWidget"))
	{
		bShouldCustomize = !ArticyIdPropertyHandle->GetBoolMetaData("ArticyNoWidget");
	}

	if(!bShouldCustomize)
	{
		HeaderRow.NameContent()
		[
			ArticyIdPropertyHandle->CreatePropertyNameWidget()
		]
		.ValueContent()
		[
			ArticyIdPropertyHandle->CreatePropertyValueWidget()
		];
		return;
	}

	ArticyIdPropertyWidget = SNew(SArticyIdProperty)
	.ArticyIdToDisplay(this, &FArticyIdCustomization::GetArticyId)
	.OnArticyIdChanged(this, &FArticyIdCustomization::OnArticyIdChanged)
	.TopLevelClassRestriction(this, &FArticyIdCustomization::GetClassRestriction)
	.bExactClass(IsExactClass())
	.bExactClassEditable(!HasExactClassMetaData())
	.bIsReadOnly(this, &FArticyIdCustomization::IsReadOnly);

	HeaderRow.NameContent()
	[
		ArticyIdPropertyHandle->CreatePropertyNameWidget()
	]
	.ValueContent()
	.MinDesiredWidth(150)
	[
		ArticyIdPropertyWidget.ToSharedRef()
	];
}

void FArticyIdCustomization::CustomizeChildren(TSharedRef<IPropertyHandle> PropertyHandle, IDetailChildrenBuilder& ChildBuilder, IPropertyTypeCustomizationUtils& CustomizationUtils)
{
	// dont do children
}

FArticyId* FArticyIdCustomization::RetrieveArticyId(IPropertyHandle* ArticyIdHandle)
{
	FArticyId* ArticyId = nullptr;
	void* ArticyRefAddress;
	ArticyIdHandle->GetValueData(ArticyRefAddress);
	ArticyId = static_cast<FArticyId*>(ArticyRefAddress);
	return ArticyId;
}

FArticyId FArticyIdCustomization::GetArticyId() const
{
	FArticyId* ArticyId = RetrieveArticyId(ArticyIdPropertyHandle.Get());
	return ArticyId ? *ArticyId : FArticyId();
}

void FArticyIdCustomization::OnArticyIdChanged(const FArticyId &NewArticyId) const
{
	// update the articy ref with the new ID:
	// done via Set functions instead of accessing the ref object directly because using "Set" handles various Unreal logic, such as:
	// - CDO default change forwarding to instances
	// - marking dirty
	// - transaction buffer (Undo, Redo)
	ArticyIdPropertyHandle->SetValueFromFormattedString(NewArticyId.ToString());
}

UClass* FArticyIdCustomization::GetClassRestriction() const
{
	UClass* Restriction = nullptr;

	if(HasClassRestrictionMetaData())
	{
		const FString ArticyClassRestriction = ArticyIdPropertyHandle->GetMetaData("ArticyClassRestriction");

		auto FullClassName = FString::Printf(TEXT("Class'/Script/%s.%s'"), TEXT("ArticyRuntime"), *ArticyClassRestriction);
		Restriction = ConstructorHelpersInternal::FindOrLoadClass(FullClassName, UArticyObject::StaticClass());

		// the class name can be in the ArticyRuntime module or in the project module. If it wasn't found in ArticyRuntime, check the project module
		if(Restriction == nullptr)
		{
			FullClassName = FString::Printf(TEXT("Class'/Script/%s.%s'"), FApp::GetProjectName(), *ArticyClassRestriction);
			Restriction = ConstructorHelpersInternal::FindOrLoadClass(FullClassName, UArticyObject::StaticClass());
		}
	}

	if(Restriction == nullptr)
	{
		Restriction = UArticyObject::StaticClass();
	}

	return Restriction;
}

bool FArticyIdCustomization::HasClassRestrictionMetaData() const
{
	return ArticyIdPropertyHandle->HasMetaData("ArticyClassRestriction");
}

bool FArticyIdCustomization::IsExactClass() const
{
	if(HasExactClassMetaData())
	{
		return ArticyIdPropertyHandle->GetBoolMetaData("ArticyExactClass");
	}

	return false;
}

bool FArticyIdCustomization::IsReadOnly() const
{
	return ArticyIdPropertyHandle->GetNumPerObjectValues() != 1 || ArticyIdPropertyHandle->IsEditConst();
}

bool FArticyIdCustomization::HasExactClassMetaData() const
{
	return ArticyIdPropertyHandle->HasMetaData("ArticyExactClass");
}

FArticyId FArticyIdCustomization::GetIdFromValueString(FString SourceString)
{
	int32 Low, High = 0;
	const bool bSuccess = FParse::Value(*SourceString, TEXT("Low="), Low) && FParse::Value(*SourceString, TEXT("High="), High);

	FArticyId Id;
	Id.High = High;
	Id.Low = Low;
	return Id;
}


text:
/*
 * A library that enables the hooking of the standard 'require' function, such
 * that a (possibly partial) mock implementation can be provided instead. This
 * is most useful for running unit tests, since any dependency obtained through
 * 'require' can be mocked out.
 */

"use strict";

var m = require('module'),
    registeredMocks = blank(),
    registeredSubstitutes = blank(),
    registeredAllowables = blank(),
    originalLoader = null,
    originalCache = null,
    defaultOptions = {
        useCleanCache: false,
        warnOnReplace: true,
        warnOnUnregistered: true
    },
    options = blank(),
    // Regexp matches IDs of native modules
    matchNativeModuleId = /\.node$/;

// Safe hasOwnProperty
function has(obj, prop) {
    return Object.prototype.hasOwnProperty.call(obj, prop);
}

// Create an empty object with null prototype.  Useful as a dictionary.
function blank() {
    return Object.create(null);
}

function createModuleNotFoundError(request) {
    var err = new Error("Cannot find module '" + request + "'");
    err.code = 'MODULE_NOT_FOUND';
    return err;
}

function createInstance(parentModule) {

    /*
     * Merge the supplied options in with a new copy of the default options to get
     * the effective options, and return those.
     */
    function getEffectiveOptions(opts) {
        var options = blank();

        Object.keys(defaultOptions).forEach(function (key) {
            options[key] = defaultOptions[key];
        });
        if (opts) {
            Object.keys(opts).forEach(function (key) {
                options[key] = opts[key];
            });
        }
        return options;
    }

    /*
     * The (private) loader replacement that is used when hooking is enabled. It
     * does the work of returning a mock or substitute when configured, reporting
     * non-allowed modules, and invoking the original loader when appropriate.
     * The signature of this function *must* match that of Node's Module._load,
     * since it will replace that when mockery is enabled.
     */
    function hookedLoader(request, parent, isMain) {
        var subst, allow;

        if (!originalLoader) {
            throw new Error("Loader has not been hooked");
        }

        var path = m._resolveFilename(request, parent);

        if (has(registeredMocks, path)) {
            return registeredMocks[path];
        }

        if (has(registeredSubstitutes, path)) {
            subst = registeredSubstitutes[path];
            if(subst.name === null) {
                throw createModuleNotFoundError(request);
            }
            subst.module = originalLoader(subst.name, subst.parent, isMain);
            return subst.module;
        }

        if (has(registeredAllowables, path)) {
            allow = registeredAllowables[path];
            if (allow.unhook) {
                if (path.indexOf('/') !== -1 && allow.paths.indexOf(path) === -1) {
                    allow.paths.push(path);
                }
            }
        } else {
            if (options.warnOnUnregistered) {
                console.warn("WARNING: loading non-allowed module: " + request);
            }
        }

        return originalLoader(request, parent, isMain);
    }

    /*
     * Enables mockery by hooking subsequent 'require' invocations. Note that *all*
     * 'require' invocations will be hooked until 'disable' is called. Calling this
     * function more than once will have no ill effects.
     */
    function enable(opts) {
        if (originalLoader) {
            // Already hooked
            return;
        }

        options = getEffectiveOptions(opts);

        if (options.useCleanCache) {
            originalCache = m._cache;
            m._cache = copyNativeModules({}, originalCache);
        }

        originalLoader = m._load;
        m._load = hookedLoader;
    }

    /*
     * Disables mockery by unhooking from the Node loader. No subsequent 'require'
     * invocations will be seen by mockery. Calling this function more than once
     * will have no ill effects.
     */
    function disable() {
        if (!originalLoader) {
            // Not hooked
            return;
        }

        if (options.useCleanCache) {
            copyNativeModules(originalCache, m._cache);
            m._cache = originalCache;
            originalCache = null;
        }

        m._load = originalLoader;
        originalLoader = null;
    }

    /*
     * Copy all native modules from one cache to another.
     * @param destination
     * @param source
     */
    function copyNativeModules(destination, source) {
        for (var id in source) {
            if(has(source, id) && matchNativeModuleId.test(id)) {
                destination[id] = source[id];
            }
        }
        return destination;
    }

    /*
     * If the clean cache option is in effect, reset the module cache to an empty
     * state. Calling this function when the clean cache option is not in effect
     * will have no ill effects, but will do nothing.
     */
    function resetCache() {
        if (options.useCleanCache && originalCache) {
            m._cache = {};
        }
    }

    /*
     * Enable or disable warnings to the console when previously registered mocks
     * and subsitutes are replaced.
     */
    function warnOnReplace(enable) {
        options.warnOnReplace = enable;
    }

    /*
     * Enable or disable warnings to the console when modules are loaded that have
     * not been registered as a mock, a substitute, or allowed.
     */
    function warnOnUnregistered(enable) {
        options.warnOnUnregistered = enable;
    }

    /*
     * Register a mock object for the specified module. While mockery is enabled,
     * any subsequent 'require' for this module will return the mock object. The
     * mock need not mock out all original exports, but no fallback is provided
     * for anything not mocked and subsequently invoked.
     */
    function registerMock(mod, mock) {
        var path = m._resolveFilename(mod, parentModule);
        if (options.warnOnReplace && has(registeredMocks, path)) {
            console.warn("WARNING: Replacing existing mock for module: " + mod);
        }
        registeredMocks[path] = mock;
    }

    /*
     * Deregister a mock object for the specified module. A subsequent 'require' for
     * that module will revert to the previous behaviour (which, by default, means
     * falling back to the original 'require' behaviour).
     */
    function deregisterMock(mod) {
        var path = m._resolveFilename(mod, parentModule);
        if (has(registeredMocks, path)) {
            delete registeredMocks[path];
        }
    }

    /*
     * Register a substitute module for the specified module. While mockery is
     * enabled, any subsequent 'require' for this module will be effectively
     * replaced by a 'require' for the substitute module. This is useful when
     * a mock implementation is itself implemented as a module.
     */
    function registerSubstitute(mod, subst) {
        if(typeof subst !== "string" && subst !== null) {
            throw new Error("Substitute must be a string or null");
        }
        var path = m._resolveFilename(mod, parentModule);
        if (options.warnOnReplace && has(registeredSubstitutes, path)) {
            console.warn("WARNING: Replacing existing substitute for module: " + mod);
        }
        registeredSubstitutes[path] = {
            name: subst,
            parent: parentModule
        };
    }

    /*
     * Deregister a substitute module for the specified module. A subsequent
     * 'require' for that module will revert to the previous behaviour (which, by
     * default, means falling back to the original 'require' behaviour).
     */
    function deregisterSubstitute(mod) {
        var path = m._resolveFilename(mod, parentModule);
        if (has(registeredSubstitutes, path)) {
            delete registeredSubstitutes[path];
        }
    }

    /*
     * Register a module as 'allowed', meaning that, even if a mock or substitute
     * for it has not been registered, mockery will not complain when it is loaded
     * via 'require'. This encourages the user to consciously declare the modules
     * that will be loaded and used in the original form, thus avoiding warnings.
     *
     * If 'unhook' is true, the module will be removed from the module cache when
     * it is deregistered.
     */
    function registerAllowable(mod, unhook) {
        var path = m._resolveFilename(mod, parentModule);
        if(matchNativeModuleId.test(path) && unhook) {
            throw new Error("Cannot unhook native modules");
        }
        registeredAllowables[path] = {
            unhook: !!unhook,
            paths: []
        };
    }

    /*
     * Register an array of modules as 'allowed'. This is a convenience function
     * that performs the same function as 'registerAllowable' but for an array of
     * modules rather than a single module.
     */
    function registerAllowables(mods, unhook) {
        mods.forEach(function (mod) {
            registerAllowable(mod, unhook);
        });
    }

    /*
     * Deregister a module as 'allowed'. A subsequent 'require' for that module
     * will generate a warning that the module is not allowed, unless or until a
     * mock or substitute is registered for that module.
     */
    function deregisterAllowable(mod) {
        var path = m._resolveFilename(mod, parentModule);
        if (has(registeredAllowables, path)) {
            var allow = registeredAllowables[path];
            if (allow.unhook) {
                allow.paths.forEach(function (p) {
                    delete m._cache[p];
                });
            }
            delete registeredAllowables[path];
        }
    }

    /*
     * Deregister an array of modules as 'allowed'. This is a convenience function
     * that performs the same function as 'deregisterAllowable' but for an array of
     * modules rather than a single module.
     */
    function deregisterAllowables(mods) {
        mods.forEach(function (mod) {
            deregisterAllowable(mod);
        });
    }

    /*
     * Deregister all mocks, substitutes, and allowed modules, resetting the state
     * to a clean slate. This does not affect the enabled / disabled state of
     * mockery, though.
     */
    function deregisterAll() {
        Object.keys(registeredAllowables).forEach(function (mod) {
            var allow = registeredAllowables[mod];
            if (allow.unhook) {
                allow.paths.forEach(function (p) {
                    delete m._cache[p];
                });
            }
        });

        registeredMocks = blank();
        registeredSubstitutes = blank();
        registeredAllowables = blank();
    }

    // Exported functions
    var mockery = {};
    mockery.enable = enable;
    mockery.disable = disable;
    mockery.resetCache = resetCache;
    mockery.warnOnReplace = warnOnReplace;
    mockery.warnOnUnregistered = warnOnUnregistered;
    mockery.registerMock = registerMock;
    mockery.registerSubstitute = registerSubstitute;
    mockery.registerAllowable = registerAllowable;
    mockery.registerAllowables = registerAllowables;
    mockery.deregisterMock = deregisterMock;
    mockery.deregisterSubstitute = deregisterSubstitute;
    mockery.deregisterAllowable = deregisterAllowable;
    mockery.deregisterAllowables = deregisterAllowables;
    mockery.deregisterAll = deregisterAll;
    return mockery;
}

/*
 * A cache of mockery instances.
 *
 * This way, if the same module `require('mockery')` multiple times, it will get the same instance of mockery.
 */
var mockeryCache = blank();

/*
 * Return a mockery instance for the given parent module, creating it if it doesn't exist.
 */
exports.init = function(parentModule) {
    var mockery = mockeryCache[parentModule.id];
    if(mockery) return mockery;
    mockery = mockeryCache[parentModule.id] = createInstance(parentModule);
    return mockery;
}


text:
package ru.stqa.addressbook.tests;

import org.hamcrest.MatcherAssert;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import ru.stqa.addressbook.model.GroupData;
import ru.stqa.addressbook.model.Groups;
import static org.hamcrest.CoreMatchers.equalTo;

/**
 * Created by Lina on 26.03.2017.
 */
public class GroupModificationTests extends TestBase {

  @BeforeMethod

  public void ensurePreconditions(){
    app.goTo().groupPage();
    if (app.group().all().size() == 0) {
      app.group().create(new GroupData().withName("Test2"));
    }
 }

  @Test

  public void testGroupModification(){
    Groups before = app.group().all();
    GroupData modifiedGroup = before.iterator().next();
    GroupData group = new GroupData()
            .withId(modifiedGroup.getId()).withName("Update1").withHeader(null).withFooter("3");
    app.group().modify(group);
    Assert.assertEquals(app.group().count(), before.size());
    Groups after = app.group().all();
    MatcherAssert.assertThat(after, equalTo(before.without(modifiedGroup).withAdded(group)));
  }

}


text:
wget --no-check-certificate -O ./dependencies.zip "https://www.dropbox.com/s/tmv73gcbrxkuwdt/dependencies.zip?dl=1"

cygwin=false
case "`uname`" in
  CYGWIN* )
    cygwin=true
    ;;
esac

zippath=./dependencies.zip
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
    zippath=dependencies.zip
fi

jar xvf $zippath


text:
© 2014 PULSE / All rights reserved

Web Design by: Juraj Molnár

<link rel="stylesheet" href="<?php echo base_url('assets/frontend/css/options.css'); ?>">

Please select main color:


text:
package org.missionassetfund.apps.android.models.dao;

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

import org.missionassetfund.apps.android.models.Category;

import android.util.Log;

import com.parse.FindCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public class CategoryDao {

    private static final String TAG = "CategoryDao";
    private ParseQuery<Category> query;

    public CategoryDao() {
        query = ParseQuery.getQuery(Category.class);
        query.orderByAscending(Category.NAME_KEY);
    }

    public void pin() {
        query.findInBackground(new FindCallback<Category>() {
            @Override
            public void done(List<Category> categories, ParseException exception) {
                if (exception != null) {
                    Log.d(TAG, "Error trying to pin all categories", exception);
                    return;
                }

                ParseObject.pinAllInBackground(categories);
            }
        });
    }

    public List<Category> getAll() {
        query.fromLocalDatastore();
        try {
            return query.find();
        } catch (ParseException e) {
            Log.d(TAG, "Error querying local datastorage for Categories", e);
            return new ArrayList<Category>();
        }
    }

    public ParseQuery<Category> getLocalQuery() {
        query.fromLocalDatastore();
        return query;
    }
}


text:
package garde.security

import akka.actor._
import akka.persistence.{RecoveryCompleted, Recover, PersistentActor, SnapshotOffer}
import akka.util.Timeout
import scalaz._
import Scalaz._

/**
 * Persistent actor representing an active module.
 */
class ActiveModule(id: String)(implicit val timeout: Timeout) extends PersistentActor {

  import CommonValidations._
  import ActiveModule._

  override def persistenceId = id
  var state: ModuleState = _

  val receiveCommand: Receive = {
    case cmd @ CreateModule(id, name)                      =>
      validateCreate(cmd) match {
        case Success(v)     =>
          persist(ModuleCreated(v.id, 0L, v.name)) { event =>
            state = ModuleState(event.id, event.version, event.name)
            sender ! event
          }
        case f @ Failure(v) =>
          sender ! CreationException(id, f)
          context stop self
      }

    case cmd @ ChangeModuleName(id, expectedVersion, name) =>
      validateChangeName(cmd) match {
        case Success(v)     =>
          persist(ModuleNameChanged(v.id, state.version + 1, v.name)) { event =>
            state = state copy (version = event.version, name = event.name)
            sender ! event.successNel
          }
        case f @ Failure(v) => sender ! f
      }

    case SaveModuleSnapshot                                => saveSnapshot(state)

    case GetModuleState                                    => sender ! state

    case RecoveryCompleted                                 => sender ! ModuleRecoveryComplete(recoveryFinished)
  }

  val receiveRecover: Receive = {
    case evt: ModuleCreated                      => state = ModuleState(evt.id, evt.version, evt.name)
    case evt: ModuleNameChanged                  => state = state.copy(name = evt.name, version = evt.version)
    case SnapshotOffer(_, snapshot: ModuleState) => state = snapshot
  }

  def validateCreate(cmd: CreateModule): DomainValidation[CreateModule] =
    (checkString(cmd.id, IdRequired).toValidationNel |@|
      0L.successNel |@|
      checkString(cmd.name, NameRequired).toValidationNel) { (i, v, n) =>
      CreateModule(i, n)
    }

  def validateChangeName(cmd: ChangeModuleName): DomainValidation[ChangeModuleName] =
    (checkId(cmd.id, state.id, IdMismatch).toValidationNel |@|
      checkVersion(cmd.expectedVersion, state.version, IncorrectVersion).toValidationNel |@|
      checkString(cmd.name, NameRequired).toValidationNel) { (i, v, n) =>
      ChangeModuleName(state.id, v, n)
    }
}

/**
 * Companion object for ActiveModule.
 */
object ActiveModule {

  sealed case class ModuleState(id: String, version: Long, name: String)

  case object IncorrectVersion extends ValidationKey
  case object IdRequired extends ValidationKey
  case object IdMismatch extends ValidationKey
  case object NameRequired extends ValidationKey

  sealed trait ModuleCommand {
    def id: String
    def expectedVersion: Long
  }

  final case class CreateModule(id: String, name: String)
  final case class ChangeModuleName(id: String, expectedVersion: Long, name: String) extends ModuleCommand

  final case class ModuleCreated(id: String, version: Long, name: String)
  final case class ModuleNameChanged(id: String, version: Long, name: String)

  sealed case class CreationException(moduleId: String, validation: Failure[NonEmptyList[String], CreateModule])
  case object SaveModuleSnapshot
  case object GetModuleState
  case class ModuleRecoveryComplete(completed: Boolean)
}

/**
 * An actor as a factory for modules and for supervision.
 */
class ModuleSupervisor(implicit val timeout: Timeout) extends Actor {

  import ActiveModule._
  import ModuleSupervisor._
  import CommonValidations._

  def receive = {
    case cmd @ CreateModule(id, name)  =>
      val v = checkString(id, IdRequired)
      if (v.isSuccess) {
        val client = sender
        context actorOf(Props(new ModuleCreationSaga(client, cmd, context.actorOf(Props(new ActiveModule(cmd.id)), cmd.id))),
          s"module-creation-saga-$id")
      }
      else sender ! v.toValidationNel

    case msg @ RecoverModule(moduleId) =>
      val m = context.actorOf(Props(new ActiveModule(moduleId)), moduleId)
      m ! Recover
      sender ! m
  }
}

/**
 * Companion object for ModuleSupervisor.
 */
object ModuleSupervisor {
  final val ModuleSupervisorName = "module-supervisor"
  sealed case class RecoverModule(moduleId: String)
}

/**
 * A saga type actor to orchestration the creation of a new module and the syncing up between the
 * module supervisor and successful module creation.
 * @param client ActorRef original command sender
 * @param cmd CreateModule the module creation command
 * @param actorRef ActorRef the persistence module actor ref
 */
class ModuleCreationSaga(client: ActorRef, cmd: ActiveModule.CreateModule, actorRef: ActorRef)(implicit val timeout: Timeout) extends Actor {

  import ActiveModule._

  private case object Start

  context.setReceiveTimeout(timeout.duration)

  override def preStart() = {
    self ! Start
  }

  def receive = {
    case Start =>
      context become awaitCreation
      actorRef ! cmd
  }

  def awaitCreation: Receive = {
    case evt @ ModuleCreated(id, version, name) =>
      context.system.eventStream.publish(evt)
      client ! evt.success
      context stop self

    case msg @ CreationException(id, ex) =>
      context.system.eventStream.publish(msg)
      client ! ex
      context stop self

    case ReceiveTimeout                         =>
      client ! s"CreateModule timed out after ${timeout.duration.toSeconds} seconds for module:${cmd.id}".failureNel
      context stop self
  }
}

/**
 * This is a saga actor that manages the conditional locating, instantiating, and recovery of the module
 * persistent actor.
 * @param moduleId String the module id, matches the persistenceId
 * @param timeout Timeout the timeout for any wait state
 */
class ModuleLocator(moduleId: String)(implicit val timeout: Timeout) extends Actor {

  import ModuleLocator._
  import ActiveModule._
  import ModuleSupervisor._

  context.setReceiveTimeout(timeout.duration)

  var client: ActorRef = _

  def receive = {
    case LocateModule =>
      context become awaitLookup
      client = sender
      context.actorSelection(s"/user/$ModuleSupervisorName/module-1") ! Identify(moduleId)
  }

  def awaitLookup: Receive = {
    case ActorIdentity(identityId, Some(ref)) =>
      client ! ref
      context stop self

    case ActorIdentity(identityId, None)      =>
      context become awaitInstantiation
      context.actorSelection(s"/user/$ModuleSupervisorName") ! RecoverModule(moduleId)

    case ReceiveTimeout                       =>
      client ! s"Unable to establish identity for module $moduleId."
      context stop self
  }

  def awaitInstantiation: Receive = {
    case m: ActorRef    =>
      context become awaitRecovery
      m ! RecoveryCompleted

    case ReceiveTimeout =>
      client ! s"Unable to instantiate module $moduleId."
      context stop self
  }

  def awaitRecovery: Receive = {
    case msg @ ModuleRecoveryComplete(completed) =>
      if (completed) {
        val module = sender
        client ! module.path
        context stop self
      }
      else
        sender ! RecoveryCompleted

    case ReceiveTimeout =>
      client ! s"Unable to instantiate module $moduleId."
      context stop self
  }
}

/**
 * Companion object for ModuleLocator.
 */
object ModuleLocator {
  case object LocateModule
}


text:
export timestamp="1"

while (true)
do
	output=`curl -s "$1/canaries/events?since=$timestamp" | python ~/bin/pp.py 2>&1`
	timestamp=`echo "$output" | grep '\s*"timestamp":' | sed 's/^.*"timestamp": //'`
	echo "$output"
	echo $timestamp
	sleep 5
done


text:
#include <common/FileSystem.h>
#include "framework/ApplicationInternals.h"
#include "framework/CommandSystem.h"
#include "qcommon/qcommon.h"

namespace Application {

class ServerApplication : public Application {
    public:
        ServerApplication() {
            #ifdef _WIN32
                // The windows dedicated server and tty client must enable the
                // curses interface because they have no other usable interface.
                traits.useCurses = true;
            #endif
            traits.isServer = true;
            traits.uniqueHomepathSuffix = "-server";
        }

        void LoadInitialConfig(bool /*resetConfig*/) override {
            //TODO(kangz) move this functions and its friends to FileSystem.cpp
	        FS_LoadBasePak();
        }

        void Initialize() override {
            Com_Init();
        }

        void Frame() override {
            Com_Frame();
        }

        void OnDrop(bool error, Str::StringRef reason) override {
            FS::PakPath::ClearPaks();
            FS_LoadBasePak();
            SV_Shutdown(Str::Format("Server %s: %s", error ? "crashed" : "shutdown", reason).c_str());
        }

        void Shutdown(bool error, Str::StringRef message) override {
            std::string serverMessage = error ? "Server fatal error: " + message : std::string(message);
            if (Sys::PedanticShutdown()) {
                TRY_SHUTDOWN(SV_Shutdown(message.c_str()));
                TRY_SHUTDOWN(NET_Shutdown());
            } else {
                TRY_SHUTDOWN(SV_QuickShutdown(message.c_str()));
            }
        }
};

INSTANTIATE_APPLICATION(ServerApplication)

}


text:
package com.anor.behaviortree;

public abstract class SingleChild<Context extends Object> extends Node<Context> {

	protected Node<Context>	child;

	public SingleChild(Node<Context> child) {
		this.child = child;
	}

	public final Node<Context> getChild() {
		return child;
	}

}


text:
emacs
=====

Emacs configuration


text:
package maritech.extensions.blocks.icons;

import mariculture.core.Core;
import mariculture.core.lib.MachineRenderedMeta;
import mariculture.core.lib.MetalMeta;
import maritech.util.IIconExtension;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class ExtensionIconRenderedMachine implements IIconExtension {
    @SideOnly(Side.CLIENT)
    @Override
    public IIcon getInventoryIcon(int meta, int side, IIcon icon) {
        if (meta == MachineRenderedMeta.ROTOR_COPPER) return Core.metals.getIcon(0, MetalMeta.COPPER_BLOCK);
        else if (meta == MachineRenderedMeta.ROTOR_ALUMINUM) return Core.metals.getIcon(0, MetalMeta.ALUMINUM_BLOCK);
        else if (meta == MachineRenderedMeta.ROTOR_TITANIUM) return Core.metals.getIcon(0, MetalMeta.TITANIUM_BLOCK);
        return icon;
    }

    @SideOnly(Side.CLIENT)
    @Override
    public IIcon getWorldIcon(IBlockAccess block, int x, int y, int z, int side, IIcon icon) {
        return icon;
    }
}


text:
from __future__ import absolute_import, division, print_function

import datetime
import ipaddress
from email.utils import parseaddr

import idna

import six

from six.moves import urllib_parse

from cryptography import utils, x509
from cryptography.exceptions import UnsupportedAlgorithm
from cryptography.hazmat.primitives import hashes, serialization

def _obj2txt(backend, obj):
    # Set to 80 on the recommendation of
    # https://www.openssl.org/docs/crypto/OBJ_nid2ln.html#return_values
    buf_len = 80
    buf = backend._ffi.new("char[]", buf_len)
    res = backend._lib.OBJ_obj2txt(buf, buf_len, obj, 1)
    assert res > 0
    return backend._ffi.buffer(buf, res)[:].decode()

def _asn1_integer_to_int(backend, asn1_int):
    bn = backend._lib.ASN1_INTEGER_to_BN(asn1_int, backend._ffi.NULL)
    assert bn != backend._ffi.NULL
    bn = backend._ffi.gc(bn, backend._lib.BN_free)
    return backend._bn_to_int(bn)

def _asn1_string_to_utf8(backend, asn1_string):
    buf = backend._ffi.new("unsigned char **")
    res = backend._lib.ASN1_STRING_to_UTF8(buf, asn1_string)
    assert res >= 0
    assert buf[0] != backend._ffi.NULL
    buf = backend._ffi.gc(
        buf, lambda buffer: backend._lib.OPENSSL_free(buffer[0])
    )
    return backend._ffi.buffer(buf[0], res)[:].decode('utf8')

def _decode_x509_name_entry(backend, x509_name_entry):
    obj = backend._lib.X509_NAME_ENTRY_get_object(x509_name_entry)
    assert obj != backend._ffi.NULL
    data = backend._lib.X509_NAME_ENTRY_get_data(x509_name_entry)
    assert data != backend._ffi.NULL
    value = _asn1_string_to_utf8(backend, data)
    oid = _obj2txt(backend, obj)

    return x509.NameAttribute(x509.ObjectIdentifier(oid), value)

def _decode_x509_name(backend, x509_name):
    count = backend._lib.X509_NAME_entry_count(x509_name)
    attributes = []
    for x in range(count):
        entry = backend._lib.X509_NAME_get_entry(x509_name, x)
        attributes.append(_decode_x509_name_entry(backend, entry))

    return x509.Name(attributes)

def _decode_general_names(backend, gns):
    num = backend._lib.sk_GENERAL_NAME_num(gns)
    names = []
    for i in range(num):
        gn = backend._lib.sk_GENERAL_NAME_value(gns, i)
        assert gn != backend._ffi.NULL
        names.append(_decode_general_name(backend, gn))

    return names

def _decode_general_name(backend, gn):
    if gn.type == backend._lib.GEN_DNS:
        data = backend._ffi.buffer(gn.d.dNSName.data, gn.d.dNSName.length)[:]
        return x509.DNSName(idna.decode(data))
    elif gn.type == backend._lib.GEN_URI:
        data = backend._ffi.buffer(
            gn.d.uniformResourceIdentifier.data,
            gn.d.uniformResourceIdentifier.length
        )[:].decode("ascii")
        parsed = urllib_parse.urlparse(data)
        hostname = idna.decode(parsed.hostname)
        if parsed.port:
            netloc = hostname + u":" + six.text_type(parsed.port)
        else:
            netloc = hostname

        # Note that building a URL in this fashion means it should be
        # semantically indistinguishable from the original but is not
        # guaranteed to be exactly the same.
        uri = urllib_parse.urlunparse((
            parsed.scheme,
            netloc,
            parsed.path,
            parsed.params,
            parsed.query,
            parsed.fragment
        ))
        return x509.UniformResourceIdentifier(uri)
    elif gn.type == backend._lib.GEN_RID:
        oid = _obj2txt(backend, gn.d.registeredID)
        return x509.RegisteredID(x509.ObjectIdentifier(oid))
    elif gn.type == backend._lib.GEN_IPADD:
        return x509.IPAddress(
            ipaddress.ip_address(
                backend._ffi.buffer(
                    gn.d.iPAddress.data, gn.d.iPAddress.length
                )[:]
            )
        )
    elif gn.type == backend._lib.GEN_DIRNAME:
        return x509.DirectoryName(
            _decode_x509_name(backend, gn.d.directoryName)
        )
    elif gn.type == backend._lib.GEN_EMAIL:
        data = backend._ffi.buffer(
            gn.d.rfc822Name.data, gn.d.rfc822Name.length
        )[:].decode("ascii")
        name, address = parseaddr(data)
        parts = address.split(u"@")
        if name or len(parts) > 2 or not address:
            # parseaddr has found a name (e.g. Name <email>) or the split
            # has found more than 2 parts (which means more than one @ sign)
            # or the entire value is an empty string.
            raise ValueError("Invalid rfc822name value")
        elif len(parts) == 1:
            # Single label email name. This is valid for local delivery. No
            # IDNA decoding can be done since there is no domain component.
            return x509.RFC822Name(address)
        else:
            # A normal email of the form user@domain.com. Let's attempt to
            # decode the domain component and return the entire address.
            return x509.RFC822Name(
                parts[0] + u"@" + idna.decode(parts[1])
            )
    else:
        # otherName, x400Address or ediPartyName
        raise x509.UnsupportedGeneralNameType(
            "{0} is not a supported type".format(
                x509._GENERAL_NAMES.get(gn.type, gn.type)
            ),
            gn.type
        )

@utils.register_interface(x509.Certificate)
class _Certificate(object):
    def __init__(self, backend, x509):
        self._backend = backend
        self._x509 = x509

    def __repr__(self):
        return "<Certificate(subject={0}, ...)>".format(self.subject)

    def __eq__(self, other):
        if not isinstance(other, x509.Certificate):
            return NotImplemented

        res = self._backend._lib.X509_cmp(self._x509, other._x509)
        return res == 0

    def __ne__(self, other):
        return not self == other

    def fingerprint(self, algorithm):
        h = hashes.Hash(algorithm, self._backend)
        bio = self._backend._create_mem_bio()
        res = self._backend._lib.i2d_X509_bio(
            bio, self._x509
        )
        assert res == 1
        der = self._backend._read_mem_bio(bio)
        h.update(der)
        return h.finalize()

    @property
    def version(self):
        version = self._backend._lib.X509_get_version(self._x509)
        if version == 0:
            return x509.Version.v1
        elif version == 2:
            return x509.Version.v3
        else:
            raise x509.InvalidVersion(
                "{0} is not a valid X509 version".format(version), version
            )

    @property
    def serial(self):
        asn1_int = self._backend._lib.X509_get_serialNumber(self._x509)
        assert asn1_int != self._backend._ffi.NULL
        return _asn1_integer_to_int(self._backend, asn1_int)

    def public_key(self):
        pkey = self._backend._lib.X509_get_pubkey(self._x509)
        assert pkey != self._backend._ffi.NULL
        pkey = self._backend._ffi.gc(pkey, self._backend._lib.EVP_PKEY_free)

        return self._backend._evp_pkey_to_public_key(pkey)

    @property
    def not_valid_before(self):
        asn1_time = self._backend._lib.X509_get_notBefore(self._x509)
        return self._parse_asn1_time(asn1_time)

    @property
    def not_valid_after(self):
        asn1_time = self._backend._lib.X509_get_notAfter(self._x509)
        return self._parse_asn1_time(asn1_time)

    def _parse_asn1_time(self, asn1_time):
        assert asn1_time != self._backend._ffi.NULL
        generalized_time = self._backend._lib.ASN1_TIME_to_generalizedtime(
            asn1_time, self._backend._ffi.NULL
        )
        assert generalized_time != self._backend._ffi.NULL
        generalized_time = self._backend._ffi.gc(
            generalized_time, self._backend._lib.ASN1_GENERALIZEDTIME_free
        )
        time = self._backend._ffi.string(
            self._backend._lib.ASN1_STRING_data(
                self._backend._ffi.cast("ASN1_STRING *", generalized_time)
            )
        ).decode("ascii")
        return datetime.datetime.strptime(time, "%Y%m%d%H%M%SZ")

    @property
    def issuer(self):
        issuer = self._backend._lib.X509_get_issuer_name(self._x509)
        assert issuer != self._backend._ffi.NULL
        return _decode_x509_name(self._backend, issuer)

    @property
    def subject(self):
        subject = self._backend._lib.X509_get_subject_name(self._x509)
        assert subject != self._backend._ffi.NULL
        return _decode_x509_name(self._backend, subject)

    @property
    def signature_hash_algorithm(self):
        oid = _obj2txt(self._backend, self._x509.sig_alg.algorithm)
        try:
            return x509._SIG_OIDS_TO_HASH[oid]
        except KeyError:
            raise UnsupportedAlgorithm(
                "Signature algorithm OID:{0} not recognized".format(oid)
            )

    @property
    def extensions(self):
        extensions = []
        seen_oids = set()
        extcount = self._backend._lib.X509_get_ext_count(self._x509)
        for i in range(0, extcount):
            ext = self._backend._lib.X509_get_ext(self._x509, i)
            assert ext != self._backend._ffi.NULL
            crit = self._backend._lib.X509_EXTENSION_get_critical(ext)
            critical = crit == 1
            oid = x509.ObjectIdentifier(_obj2txt(self._backend, ext.object))
            if oid in seen_oids:
                raise x509.DuplicateExtension(
                    "Duplicate {0} extension found".format(oid), oid
                )
            elif oid == x509.OID_BASIC_CONSTRAINTS:
                value = _decode_basic_constraints(self._backend, ext)
            elif oid == x509.OID_SUBJECT_KEY_IDENTIFIER:
                value = _decode_subject_key_identifier(self._backend, ext)
            elif oid == x509.OID_KEY_USAGE:
                value = _decode_key_usage(self._backend, ext)
            elif oid == x509.OID_SUBJECT_ALTERNATIVE_NAME:
                value = _decode_subject_alt_name(self._backend, ext)
            elif oid == x509.OID_EXTENDED_KEY_USAGE:
                value = _decode_extended_key_usage(self._backend, ext)
            elif oid == x509.OID_AUTHORITY_KEY_IDENTIFIER:
                value = _decode_authority_key_identifier(self._backend, ext)
            elif oid == x509.OID_AUTHORITY_INFORMATION_ACCESS:
                value = _decode_authority_information_access(
                    self._backend, ext
                )
            elif oid == x509.OID_CERTIFICATE_POLICIES:
                value = _decode_certificate_policies(self._backend, ext)
            elif oid == x509.OID_CRL_DISTRIBUTION_POINTS:
                value = _decode_crl_distribution_points(self._backend, ext)
            elif oid == x509.OID_OCSP_NO_CHECK:
                value = x509.OCSPNoCheck()
            elif oid == x509.OID_INHIBIT_ANY_POLICY:
                value = _decode_inhibit_any_policy(self._backend, ext)
            elif oid == x509.OID_ISSUER_ALTERNATIVE_NAME:
                value = _decode_issuer_alt_name(self._backend, ext)
            elif critical:
                raise x509.UnsupportedExtension(
                    "{0} is not currently supported".format(oid), oid
                )
            else:
                # Unsupported non-critical extension, silently skipping for now
                seen_oids.add(oid)
                continue

            seen_oids.add(oid)
            extensions.append(x509.Extension(oid, critical, value))

        return x509.Extensions(extensions)

    def public_bytes(self, encoding):
        if not isinstance(encoding, serialization.Encoding):
            raise TypeError("encoding must be an item from the Encoding enum")

        bio = self._backend._create_mem_bio()
        if encoding is serialization.Encoding.PEM:
            res = self._backend._lib.PEM_write_bio_X509(bio, self._x509)
        elif encoding is serialization.Encoding.DER:
            res = self._backend._lib.i2d_X509_bio(bio, self._x509)
        assert res == 1
        return self._backend._read_mem_bio(bio)

def _decode_certificate_policies(backend, ext):
    cp = backend._ffi.cast(
        "Cryptography_STACK_OF_POLICYINFO *",
        backend._lib.X509V3_EXT_d2i(ext)
    )
    assert cp != backend._ffi.NULL
    cp = backend._ffi.gc(cp, backend._lib.sk_POLICYINFO_free)
    num = backend._lib.sk_POLICYINFO_num(cp)
    certificate_policies = []
    for i in range(num):
        qualifiers = None
        pi = backend._lib.sk_POLICYINFO_value(cp, i)
        oid = x509.ObjectIdentifier(_obj2txt(backend, pi.policyid))
        if pi.qualifiers != backend._ffi.NULL:
            qnum = backend._lib.sk_POLICYQUALINFO_num(pi.qualifiers)
            qualifiers = []
            for j in range(qnum):
                pqi = backend._lib.sk_POLICYQUALINFO_value(
                    pi.qualifiers, j
                )
                pqualid = x509.ObjectIdentifier(
                    _obj2txt(backend, pqi.pqualid)
                )
                if pqualid == x509.OID_CPS_QUALIFIER:
                    cpsuri = backend._ffi.buffer(
                        pqi.d.cpsuri.data, pqi.d.cpsuri.length
                    )[:].decode('ascii')
                    qualifiers.append(cpsuri)
                elif pqualid == x509.OID_CPS_USER_NOTICE:
                    user_notice = _decode_user_notice(
                        backend, pqi.d.usernotice
                    )
                    qualifiers.append(user_notice)

        certificate_policies.append(
            x509.PolicyInformation(oid, qualifiers)
        )

    return x509.CertificatePolicies(certificate_policies)

def _decode_user_notice(backend, un):
    explicit_text = None
    notice_reference = None

    if un.exptext != backend._ffi.NULL:
        explicit_text = _asn1_string_to_utf8(backend, un.exptext)

    if un.noticeref != backend._ffi.NULL:
        organization = _asn1_string_to_utf8(
            backend, un.noticeref.organization
        )

        num = backend._lib.sk_ASN1_INTEGER_num(
            un.noticeref.noticenos
        )
        notice_numbers = []
        for i in range(num):
            asn1_int = backend._lib.sk_ASN1_INTEGER_value(
                un.noticeref.noticenos, i
            )
            notice_num = _asn1_integer_to_int(
                backend, asn1_int
            )
            notice_numbers.append(notice_num)

        notice_reference = x509.NoticeReference(
            organization, notice_numbers
        )

    return x509.UserNotice(notice_reference, explicit_text)

def _decode_basic_constraints(backend, ext):
    bc_st = backend._lib.X509V3_EXT_d2i(ext)
    assert bc_st != backend._ffi.NULL
    basic_constraints = backend._ffi.cast(
        "BASIC_CONSTRAINTS *", bc_st
    )
    basic_constraints = backend._ffi.gc(
        basic_constraints, backend._lib.BASIC_CONSTRAINTS_free
    )
    # The byte representation of an ASN.1 boolean true is \xff. OpenSSL
    # chooses to just map this to its ordinal value, so true is 255 and
    # false is 0.
    ca = basic_constraints.ca == 255
    if basic_constraints.pathlen == backend._ffi.NULL:
        path_length = None
    else:
        path_length = _asn1_integer_to_int(
            backend, basic_constraints.pathlen
        )

    return x509.BasicConstraints(ca, path_length)

def _decode_subject_key_identifier(backend, ext):
    asn1_string = backend._lib.X509V3_EXT_d2i(ext)
    assert asn1_string != backend._ffi.NULL
    asn1_string = backend._ffi.cast(
        "ASN1_OCTET_STRING *", asn1_string
    )
    asn1_string = backend._ffi.gc(
        asn1_string, backend._lib.ASN1_OCTET_STRING_free
    )
    return x509.SubjectKeyIdentifier(
        backend._ffi.buffer(asn1_string.data, asn1_string.length)[:]
    )

def _decode_authority_key_identifier(backend, ext):
    akid = backend._lib.X509V3_EXT_d2i(ext)
    assert akid != backend._ffi.NULL
    akid = backend._ffi.cast("AUTHORITY_KEYID *", akid)
    akid = backend._ffi.gc(
        akid, backend._lib.AUTHORITY_KEYID_free
    )
    key_identifier = None
    authority_cert_issuer = None
    authority_cert_serial_number = None

    if akid.keyid != backend._ffi.NULL:
        key_identifier = backend._ffi.buffer(
            akid.keyid.data, akid.keyid.length
        )[:]

    if akid.issuer != backend._ffi.NULL:
        authority_cert_issuer = _decode_general_names(
            backend, akid.issuer
        )

    if akid.serial != backend._ffi.NULL:
        authority_cert_serial_number = _asn1_integer_to_int(
            backend, akid.serial
        )

    return x509.AuthorityKeyIdentifier(
        key_identifier, authority_cert_issuer, authority_cert_serial_number
    )

def _decode_authority_information_access(backend, ext):
    aia = backend._lib.X509V3_EXT_d2i(ext)
    assert aia != backend._ffi.NULL
    aia = backend._ffi.cast(
        "Cryptography_STACK_OF_ACCESS_DESCRIPTION *", aia
    )
    aia = backend._ffi.gc(
        aia, backend._lib.sk_ACCESS_DESCRIPTION_free
    )
    num = backend._lib.sk_ACCESS_DESCRIPTION_num(aia)
    access_descriptions = []
    for i in range(num):
        ad = backend._lib.sk_ACCESS_DESCRIPTION_value(aia, i)
        assert ad.method != backend._ffi.NULL
        oid = x509.ObjectIdentifier(_obj2txt(backend, ad.method))
        assert ad.location != backend._ffi.NULL
        gn = _decode_general_name(backend, ad.location)
        access_descriptions.append(x509.AccessDescription(oid, gn))

    return x509.AuthorityInformationAccess(access_descriptions)

def _decode_key_usage(backend, ext):
    bit_string = backend._lib.X509V3_EXT_d2i(ext)
    assert bit_string != backend._ffi.NULL
    bit_string = backend._ffi.cast("ASN1_BIT_STRING *", bit_string)
    bit_string = backend._ffi.gc(
        bit_string, backend._lib.ASN1_BIT_STRING_free
    )
    get_bit = backend._lib.ASN1_BIT_STRING_get_bit
    digital_signature = get_bit(bit_string, 0) == 1
    content_commitment = get_bit(bit_string, 1) == 1
    key_encipherment = get_bit(bit_string, 2) == 1
    data_encipherment = get_bit(bit_string, 3) == 1
    key_agreement = get_bit(bit_string, 4) == 1
    key_cert_sign = get_bit(bit_string, 5) == 1
    crl_sign = get_bit(bit_string, 6) == 1
    encipher_only = get_bit(bit_string, 7) == 1
    decipher_only = get_bit(bit_string, 8) == 1
    return x509.KeyUsage(
        digital_signature,
        content_commitment,
        key_encipherment,
        data_encipherment,
        key_agreement,
        key_cert_sign,
        crl_sign,
        encipher_only,
        decipher_only
    )

def _decode_general_names_extension(backend, ext):
    gns = backend._ffi.cast(
        "GENERAL_NAMES *", backend._lib.X509V3_EXT_d2i(ext)
    )
    assert gns != backend._ffi.NULL
    gns = backend._ffi.gc(gns, backend._lib.GENERAL_NAMES_free)
    general_names = _decode_general_names(backend, gns)
    return general_names

def _decode_subject_alt_name(backend, ext):
    return x509.SubjectAlternativeName(
        _decode_general_names_extension(backend, ext)
    )

def _decode_issuer_alt_name(backend, ext):
    return x509.IssuerAlternativeName(
        _decode_general_names_extension(backend, ext)
    )

def _decode_extended_key_usage(backend, ext):
    sk = backend._ffi.cast(
        "Cryptography_STACK_OF_ASN1_OBJECT *",
        backend._lib.X509V3_EXT_d2i(ext)
    )
    assert sk != backend._ffi.NULL
    sk = backend._ffi.gc(sk, backend._lib.sk_ASN1_OBJECT_free)
    num = backend._lib.sk_ASN1_OBJECT_num(sk)
    ekus = []

    for i in range(num):
        obj = backend._lib.sk_ASN1_OBJECT_value(sk, i)
        assert obj != backend._ffi.NULL
        oid = x509.ObjectIdentifier(_obj2txt(backend, obj))
        ekus.append(oid)

    return x509.ExtendedKeyUsage(ekus)

def _decode_crl_distribution_points(backend, ext):
    cdps = backend._ffi.cast(
        "Cryptography_STACK_OF_DIST_POINT *",
        backend._lib.X509V3_EXT_d2i(ext)
    )
    assert cdps != backend._ffi.NULL
    cdps = backend._ffi.gc(
        cdps, backend._lib.sk_DIST_POINT_free)
    num = backend._lib.sk_DIST_POINT_num(cdps)

    dist_points = []
    for i in range(num):
        full_name = None
        relative_name = None
        crl_issuer = None
        reasons = None
        cdp = backend._lib.sk_DIST_POINT_value(cdps, i)
        if cdp.reasons != backend._ffi.NULL:
            # We will check each bit from RFC 5280
            # ReasonFlags ::= BIT STRING {
            #      unused                  (0),
            #      keyCompromise           (1),
            #      cACompromise            (2),
            #      affiliationChanged      (3),
            #      superseded              (4),
            #      cessationOfOperation    (5),
            #      certificateHold         (6),
            #      privilegeWithdrawn      (7),
            #      aACompromise            (8) }
            reasons = []
            get_bit = backend._lib.ASN1_BIT_STRING_get_bit
            if get_bit(cdp.reasons, 1):
                reasons.append(x509.ReasonFlags.key_compromise)

            if get_bit(cdp.reasons, 2):
                reasons.append(x509.ReasonFlags.ca_compromise)

            if get_bit(cdp.reasons, 3):
                reasons.append(x509.ReasonFlags.affiliation_changed)

            if get_bit(cdp.reasons, 4):
                reasons.append(x509.ReasonFlags.superseded)

            if get_bit(cdp.reasons, 5):
                reasons.append(x509.ReasonFlags.cessation_of_operation)

            if get_bit(cdp.reasons, 6):
                reasons.append(x509.ReasonFlags.certificate_hold)

            if get_bit(cdp.reasons, 7):
                reasons.append(x509.ReasonFlags.privilege_withdrawn)

            if get_bit(cdp.reasons, 8):
                reasons.append(x509.ReasonFlags.aa_compromise)

            reasons = frozenset(reasons)

        if cdp.CRLissuer != backend._ffi.NULL:
            crl_issuer = _decode_general_names(backend, cdp.CRLissuer)

        # Certificates may have a crl_issuer/reasons and no distribution
        # point so make sure it's not null.
        if cdp.distpoint != backend._ffi.NULL:
            # Type 0 is fullName, there is no #define for it in the code.
            if cdp.distpoint.type == 0:
                full_name = _decode_general_names(
                    backend, cdp.distpoint.name.fullname
                )
            # OpenSSL code doesn't test for a specific type for
            # relativename, everything that isn't fullname is considered
            # relativename.
            else:
                rns = cdp.distpoint.name.relativename
                rnum = backend._lib.sk_X509_NAME_ENTRY_num(rns)
                attributes = []
                for i in range(rnum):
                    rn = backend._lib.sk_X509_NAME_ENTRY_value(
                        rns, i
                    )
                    assert rn != backend._ffi.NULL
                    attributes.append(
                        _decode_x509_name_entry(backend, rn)
                    )

                relative_name = x509.Name(attributes)

        dist_points.append(
            x509.DistributionPoint(
                full_name, relative_name, reasons, crl_issuer
            )
        )

    return x509.CRLDistributionPoints(dist_points)

def _decode_inhibit_any_policy(backend, ext):
    asn1_int = backend._ffi.cast(
        "ASN1_INTEGER *",
        backend._lib.X509V3_EXT_d2i(ext)
    )
    assert asn1_int != backend._ffi.NULL
    asn1_int = backend._ffi.gc(asn1_int, backend._lib.ASN1_INTEGER_free)
    skip_certs = _asn1_integer_to_int(backend, asn1_int)
    return x509.InhibitAnyPolicy(skip_certs)

@utils.register_interface(x509.CertificateSigningRequest)
class _CertificateSigningRequest(object):
    def __init__(self, backend, x509_req):
        self._backend = backend
        self._x509_req = x509_req

    def public_key(self):
        pkey = self._backend._lib.X509_REQ_get_pubkey(self._x509_req)
        assert pkey != self._backend._ffi.NULL
        pkey = self._backend._ffi.gc(pkey, self._backend._lib.EVP_PKEY_free)
        return self._backend._evp_pkey_to_public_key(pkey)

    @property
    def subject(self):
        subject = self._backend._lib.X509_REQ_get_subject_name(self._x509_req)
        assert subject != self._backend._ffi.NULL
        return _decode_x509_name(self._backend, subject)

    @property
    def signature_hash_algorithm(self):
        oid = _obj2txt(self._backend, self._x509_req.sig_alg.algorithm)
        try:
            return x509._SIG_OIDS_TO_HASH[oid]
        except KeyError:
            raise UnsupportedAlgorithm(
                "Signature algorithm OID:{0} not recognized".format(oid)
            )

    @property
    def extensions(self):
        extensions = []
        seen_oids = set()
        x509_exts = self._backend._lib.X509_REQ_get_extensions(self._x509_req)
        extcount = self._backend._lib.sk_X509_EXTENSION_num(x509_exts)
        for i in range(0, extcount):
            ext = self._backend._lib.sk_X509_EXTENSION_value(x509_exts, i)
            assert ext != self._backend._ffi.NULL
            crit = self._backend._lib.X509_EXTENSION_get_critical(ext)
            critical = crit == 1
            oid = x509.ObjectIdentifier(_obj2txt(self._backend, ext.object))
            if oid in seen_oids:
                raise x509.DuplicateExtension(
                    "Duplicate {0} extension found".format(oid), oid
                )
            elif oid == x509.OID_BASIC_CONSTRAINTS:
                value = _decode_basic_constraints(self._backend, ext)
            elif critical:
                raise x509.UnsupportedExtension(
                    "{0} is not currently supported".format(oid), oid
                )
            else:
                # Unsupported non-critical extension, silently skipping for now
                seen_oids.add(oid)
                continue

            seen_oids.add(oid)
            extensions.append(x509.Extension(oid, critical, value))

        return x509.Extensions(extensions)

    def public_bytes(self, encoding):
        if not isinstance(encoding, serialization.Encoding):
            raise TypeError("encoding must be an item from the Encoding enum")

        bio = self._backend._create_mem_bio()
        if encoding is serialization.Encoding.PEM:
            res = self._backend._lib.PEM_write_bio_X509_REQ(
                bio, self._x509_req
            )
        elif encoding is serialization.Encoding.DER:
            res = self._backend._lib.i2d_X509_REQ_bio(bio, self._x509_req)
        assert res == 1
        return self._backend._read_mem_bio(bio)


text:
<!DOCTYPE html>

	<meta charset="UTF-8">
	<title>Clone DateBox - jQuery EasyUI Demo</title>
	<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
	<link rel="stylesheet" type="text/css" href="../demo.css">

Clone DateBox

Click the 'Clone' button to clone datebox components from the exiting datebox.

		Clone

			<input id="dt" class="easyui-datebox" label="Select Date:" labelPosition="top" style="width:100%;">


text:
using System;
using System.Collections.Generic;

namespace SocialGoal.Model.Models
{
    public class GroupUser
    {
        public GroupUser()
        {
            AddedDate = DateTime.Now;
        }
        public int GroupUserId { get; set; }

        public int GroupId { get; set; }

        public string UserId { get; set; }

        public bool Admin { get; set; }

        public DateTime AddedDate { get; set; }

        public virtual ICollection<GroupGoal> GroupGoals { get; set; }
    }
}


text:
@interface GJGCChatInputRecordAudioTipView : UIView

@property (nonatomic,strong)UIImage *voiceMicImage;

@property (nonatomic,strong)UIImage *voiceSoundMeterImage;

@property (nonatomic,strong)UIImage *voiceCancelImage;

@property (nonatomic,assign)BOOL isTooShortRecordDuration;

@property (nonatomic,assign)BOOL isTooLongRecordDuration;

@property (nonatomic,assign)CGFloat soundMeter;

@property (nonatomic,assign)CGFloat leftMargin;

@property (nonatomic,assign)CGFloat innerMargin;

@property (nonatomic,assign)BOOL willCancel;

@property (nonatomic,strong)NSString *minRecordTimeErrorTitle;

@property (nonatomic,strong)NSString *maxRecordTimeErrorTitle;

@property (nonatomic,strong)NSString *upToCancelRecordTitle;

@property (nonatomic,strong)NSString *releaseToCancelRecordTitle;

@end


text:
package gonatsd_test

import (
	. "gonatsd/gonatsd"
	. "launchpad.net/gocheck"
	"math/rand"
	"strings"
)

type TrieSuite struct{}

var _ = Suite(&TrieSuite{})

func (s *TrieSuite) TestTrieInsert(c *C) {
	trie := NewTrie(".")
	matches := trie.Match("foo.bar", BasicMatcher)
	c.Check(matches, HasLen, 0)
	c.Check(trie.Nodes(), Equals, 0)
	c.Check(trie.Values(), Equals, 0)

	trie.Insert("foo.bar", 42)
	matches = trie.Match("foo.bar", BasicMatcher)
	c.Check(matches, HasLen, 1)
	c.Check(trie.Nodes(), Equals, 2)
	c.Check(trie.Values(), Equals, 1)
}

func (s *TrieSuite) TestTrieDelete(c *C) {
	trie := NewTrie(".")
	trie.Insert("foo.bar", "42")
	result := trie.Delete("foo.bar", "42")
	c.Check(result, Equals, true)
	result = trie.Delete("foo.bar", "42")
	c.Check(result, Equals, false)
	c.Check(trie.Nodes(), Equals, 0)
}

func (s *TrieSuite) TestTrieMatch(c *C) {
	trie := NewTrie(".")
	trie.Insert("foo", "2")
	trie.Insert("foo.bar", "3")
	trie.Insert("hello.world", "1")

	matches := trie.Match("foo", BasicMatcher)
	c.Check(matches, HasLen, 1)

	matches = trie.Match("foo.bar", BasicMatcher)
	c.Check(matches, HasLen, 1)

	matches = trie.Match("hello.world", BasicMatcher)
	c.Check(matches, HasLen, 1)

	matches = trie.Match("baz", BasicMatcher)
	c.Check(matches, HasLen, 0)
}

func (s *TrieSuite) TestWildcardTrieMatch(c *C) {
	trie := NewTrie(".")
	trie.Insert("foo", "1")
	trie.Insert("foo.bar", "2")
	trie.Insert("hello.*", "3")
	trie.Insert("*.*", "4")
	trie.Insert("foo.>", "5")
	trie.Insert("*.>", "6")
	trie.Insert(">", "7")

	matches := trie.Match("foo", WildcardMatcher)
	c.Check(matches, HasLen, 2)

	matches = trie.Match("foo.bar", WildcardMatcher)
	c.Check(matches, HasLen, 5)

	matches = trie.Match("hello.world", WildcardMatcher)
	c.Check(matches, HasLen, 4)

	matches = trie.Match("baz", WildcardMatcher)
	c.Check(matches, HasLen, 1)
}

const VALID_CHARS = "abcdefghijklmnopqrstuvwxyz"

func (s *TrieSuite) BenchmarkTrieInsert(c *C) {
	words := make([]string, 100)
	for i := 0; i < 100; i++ {
		word := make([]byte, 0, rand.Intn(32))
		for j := range word {
			word[j] = VALID_CHARS[rand.Intn(len(VALID_CHARS))]
		}

		words[i] = string(word)
	}

	c.ResetTimer()
	c.StartTimer()
	trie := NewTrie(".")
	for i := 0; i < c.N; i++ {
		numTokens := rand.Intn(10)
		tokens := make([]string, numTokens)
		for j := range tokens {
			tokens[j] = words[rand.Intn(len(words))]
		}
		trie.Insert(strings.Join(tokens, "."), rand.Intn(10))
	}
}

var tokens = [...]string{"a", "bb", "ccc", "dddd", "eeeee", "ffffff", "ggggggg", "hhhhhhhh",
	"iiiiiiiii", "jjjjjjjjjj"}

func createMatchTrie() *Trie {
	trie := NewTrie(".")
	createMatchTrieHelper(trie, "", 0)
	return trie
}

func createMatchTrieHelper(trie *Trie, prefix string, depth int) {
	if depth > 4 {
		return
	}

	for _, token := range tokens {
		if prefix == "" {
			prefix = token
		} else {
			prefix = prefix + "." + token
		}
		trie.Insert(prefix, prefix)
		createMatchTrieHelper(trie, prefix, depth+1)
	}
}

func (s *TrieSuite) BenchmarkTrieWildcardMatch(c *C) {
	trie := createMatchTrie()
	c.ResetTimer()
	c.StartTimer()
	for i := 0; i < c.N; i++ {
		trie.Match("dddd.a.eeeee.bb", WildcardMatcher)
		trie.Match("a.bb.cccc.dddd", WildcardMatcher)
		trie.Match("jjjjjjjjjj.iiiiiiiii.hhhhhhhh", WildcardMatcher)
	}
}

func (s *TrieSuite) BenchmarkTrieBasicMatch(c *C) {
	trie := createMatchTrie()
	c.ResetTimer()
	c.StartTimer()
	for i := 0; i < c.N; i++ {
		trie.Match("dddd.a.eeeee.bb", BasicMatcher)
		trie.Match("a.bb.cccc.dddd", BasicMatcher)
		trie.Match("jjjjjjjjjj.iiiiiiiii.hhhhhhhh", BasicMatcher)
	}
}


text:
namespace ouzel
{
    namespace network
    {
        class Client;

        constexpr uint32_t ANY_ADDRESS = 0;
        constexpr uint16_t ANY_PORT = 0;

        class Network final
        {
        public:
            Network();
            ~Network();

            Network(const Network&) = delete;
            Network& operator=(const Network&) = delete;

            Network(Network&&) = delete;
            Network& operator=(Network&&) = delete;

            static uint32_t getAddress(const std::string& address);

        private:
#ifdef _WIN32
            bool wsaStarted = false;
            SOCKET endpoint = INVALID_SOCKET;
#else
            int endpoint = -1;
#endif

            std::vector<std::unique_ptr<Client>> clients;
        };
    } // namespace network
} // namespace ouzel

#endif // OUZEL_NETWORK_NETWORK_HPP


text:
package org.waag.ah.service;

import javax.ejb.Local;

import org.openrdf.repository.RepositoryConnection;
import org.openrdf.repository.RepositoryException;

@Local
public interface RepositoryConnectionFactory {
	RepositoryConnection getConnection() throws RepositoryException;
	RepositoryConnection getConnection(boolean autoCommit) throws RepositoryException;
	RepositoryConnection getReadWriteConnection() throws RepositoryException;
}


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

<title>CardTools</title>
<meta name="date" content="2013-07-16">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

de.intarsys.security.smartcard.card

Class CardTools

java.lang.Object

de.intarsys.security.smartcard.card.CardTools

public final class CardTools
extends java.lang.Object

Tool methods for handling the ICard subsystem

Method Summary

Methods

Modifier and Type
Method and Description

static void
beginTransaction(ICardConnection connection,
                int millisecTimeout)

Open a transaction on an ICardConnection.

static java.util.concurrent.Future<ICardConnection>
connectShared(ICard card,
             IConnectionCallback callback)

Create an ICardConnection.

static ICardConnection
connectShared(ICard card,
             int millisecTimeout)

Create an ICardConnection .

static java.util.concurrent.Future<ICardConnection>
connectTransacted(ICard card,
                 IConnectionCallback callback)

Create an ICardConnection and open a transaction in a single
 callback.

static ICardConnection
connectTransacted(ICard card,
                 int millisecTimeout)

Create an ICardConnection and open a transaction in a single
 step.

Methods inherited from class java.lang.Object

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

Method Detail

beginTransaction

public static void beginTransaction(ICardConnection connection,
                    int millisecTimeout)
                             throws CardException,
                                    java.util.concurrent.TimeoutException,
                                    java.lang.InterruptedException

Open a transaction on an ICardConnection.

Parameters:

connection -

millisecTimeout -

Throws:

CardException

java.util.concurrent.TimeoutException

java.lang.InterruptedException

connectShared

public static java.util.concurrent.Future<ICardConnection> connectShared(ICard card,
                                                         IConnectionCallback callback)

Create an ICardConnection.

Parameters:

card -

callback -

Returns:

connectShared

public static ICardConnection connectShared(ICard card,
                            int millisecTimeout)
                                     throws CardException,
                                            java.util.concurrent.TimeoutException,
                                            java.lang.InterruptedException

Create an ICardConnection .

Parameters:

card -

millisecTimeout -

Returns:

Throws:

CardException

java.util.concurrent.TimeoutException

java.lang.InterruptedException

connectTransacted

public static java.util.concurrent.Future<ICardConnection> connectTransacted(ICard card,
                                                             IConnectionCallback callback)

Create an ICardConnection and open a transaction in a single
 callback.

Parameters:

card -

callback -

Returns:

connectTransacted

public static ICardConnection connectTransacted(ICard card,
                                int millisecTimeout)
                                         throws CardException,
                                                java.util.concurrent.TimeoutException,
                                                java.lang.InterruptedException

Create an ICardConnection and open a transaction in a single
 step.

Parameters:

card -

millisecTimeout -

Returns:

Throws:

CardException

java.util.concurrent.TimeoutException

java.lang.InterruptedException

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method