text:
let sampleRate = 44100.0;

let renderLengthSeconds = 8;
let pulseLengthSeconds = 1;
let pulseLengthFrames = pulseLengthSeconds * sampleRate;

function createSquarePulseBuffer(context, sampleFrameLength) {
  let audioBuffer =
      context.createBuffer(1, sampleFrameLength, context.sampleRate);

  let n = audioBuffer.length;
  let data = audioBuffer.getChannelData(0);

  for (let i = 0; i < n; ++i)
    data[i] = 1;

  return audioBuffer;
}

// The triangle buffer holds the expected result of the convolution.
// It linearly ramps up from 0 to its maximum value (at the center)
// then linearly ramps down to 0.  The center value corresponds to the
// point where the two square pulses overlap the most.
function createTrianglePulseBuffer(context, sampleFrameLength) {
  let audioBuffer =
      context.createBuffer(1, sampleFrameLength, context.sampleRate);

  let n = audioBuffer.length;
  let halfLength = n / 2;
  let data = audioBuffer.getChannelData(0);

  for (let i = 0; i < halfLength; ++i)
    data[i] = i + 1;

  for (let i = halfLength; i < n; ++i)
    data[i] = n - i - 1;

  return audioBuffer;
}

function log10(x) {
  return Math.log(x) / Math.LN10;
}

function linearToDecibel(x) {
  return 20 * log10(x);
}

// Verify that the rendered result is very close to the reference
// triangular pulse.
function checkTriangularPulse(rendered, reference, should) {
  let match = true;
  let maxDelta = 0;
  let valueAtMaxDelta = 0;
  let maxDeltaIndex = 0;

  for (let i = 0; i < reference.length; ++i) {
    let diff = rendered[i] - reference[i];
    let x = Math.abs(diff);
    if (x > maxDelta) {
      maxDelta = x;
      valueAtMaxDelta = reference[i];
      maxDeltaIndex = i;
    }
  }

  // allowedDeviationFraction was determined experimentally.  It
  // is the threshold of the relative error at the maximum
  // difference between the true triangular pulse and the
  // rendered pulse.
  let allowedDeviationDecibels = -124.41;
  let maxDeviationDecibels = linearToDecibel(maxDelta / valueAtMaxDelta);

  should(
      maxDeviationDecibels,
      'Deviation (in dB) of triangular portion of convolution')
      .beLessThanOrEqualTo(allowedDeviationDecibels);

  return match;
}

// Verify that the rendered data is close to zero for the first part
// of the tail.
function checkTail1(data, reference, breakpoint, should) {
  let isZero = true;
  let tail1Max = 0;

  for (let i = reference.length; i < reference.length + breakpoint; ++i) {
    let mag = Math.abs(data[i]);
    if (mag > tail1Max) {
      tail1Max = mag;
    }
  }

  // Let's find the peak of the reference (even though we know a
  // priori what it is).
  let refMax = 0;
  for (let i = 0; i < reference.length; ++i) {
    refMax = Math.max(refMax, Math.abs(reference[i]));
  }

  // This threshold is experimentally determined by examining the
  // value of tail1MaxDecibels.
  let threshold1 = -129.7;

  let tail1MaxDecibels = linearToDecibel(tail1Max / refMax);
  should(tail1MaxDecibels, 'Deviation in first part of tail of convolutions')
      .beLessThanOrEqualTo(threshold1);

  return isZero;
}

// Verify that the second part of the tail of the convolution is
// exactly zero.
function checkTail2(data, reference, breakpoint, should) {
  let isZero = true;
  let tail2Max = 0;
  // For the second part of the tail, the maximum value should be
  // exactly zero.
  let threshold2 = 0;
  for (let i = reference.length + breakpoint; i < data.length; ++i) {
    if (Math.abs(data[i]) > 0) {
      isZero = false;
      break;
    }
  }

  should(isZero, 'Rendered signal after tail of convolution is silent')
      .beTrue();

  return isZero;
}

function checkConvolvedResult(renderedBuffer, trianglePulse, should) {
  let referenceData = trianglePulse.getChannelData(0);
  let renderedData = renderedBuffer.getChannelData(0);

  let success = true;

  // Verify the triangular pulse is actually triangular.

  success =
      success && checkTriangularPulse(renderedData, referenceData, should);

  // Make sure that portion after convolved portion is totally
  // silent.  But round-off prevents this from being completely
  // true.  At the end of the triangle, it should be close to
  // zero.  If we go farther out, it should be even closer and
  // eventually zero.

  // For the tail of the convolution (where the result would be
  // theoretically zero), we partition the tail into two
  // parts.  The first is the at the beginning of the tail,
  // where we tolerate a small but non-zero value.  The second part is
  // farther along the tail where the result should be zero.

  // breakpoint is the point dividing the first two tail parts
  // we're looking at.  Experimentally determined.
  let breakpoint = 12800;

  success =
      success && checkTail1(renderedData, referenceData, breakpoint, should);

  success =
      success && checkTail2(renderedData, referenceData, breakpoint, should);

  should(success, 'Test signal convolved').message('correctly', 'incorrectly');
}

redpajama_set_name: RedPajamaGithub


text:
import scala.xml.{ NodeSeq, XML }, XML.{ loadFile => loadXML }

import sbt._
import sbt.Keys._

import com.github.sbt.findbugs.FindbugsPlugin, FindbugsPlugin.autoImport._

object Findbugs {
  //@inline def task = FindBugs.findbugs

  lazy val settings = Seq(
    findbugsReportType := Some(FindbugsReport.PlainHtml),
    findbugsReportPath := Some(target.value / "findbugs.html"),
    findbugsExcludeFilters := {
      val commonFilters = loadXML(baseDirectory.value / ".." / "project" / (
        "findbugs-exclude-filters.xml"))

      val filters = {
        val f = baseDirectory.value / "findbugs-exclude-filters.xml"
        if (!f.exists) NodeSeq.Empty else loadXML(f).child
      }

      Some(
        <FindBugsFilter>${commonFilters.child}${filters}</FindBugsFilter>
      )
    }
  )
}


text:
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <Verizon_CheckPortValidationResults xmlns="urn:telispire:MdnServices">
      <username>admin</username>
      <password>pass1234</password>
      <refNumber>145314997</refNumber>
    </Verizon_CheckPortValidationResults>
  </soap12:Body>
</soap12:Envelope>


text:
package org.trie4j.setAndMap;

import java.util.Set;
import java.util.TreeSet;

public class TreeSetWikipediaSerializeTest
extends AbstractSetWikipediaSerializeTest{
	protected Set<String> set(){
		return new TreeSet<String>();
	}
}


text:
"""

This package contains a set of modules mainly for the mapping of nodal data to
an :program:`ADCIRC` mesh using landuse data and the :program:`Fortran90`
program :program:`Griddata_v1.32.F90`. :program:`GridData` is a
:program:`FORTRAN` program originally developed by Seizo Tanaka (ST3) and
C.H.Lab., University of Notre Dame.

This package contains the modules

    * :mod:`~polyadcirc.pyGriddata.file_management`
    * :mod:`~polyadcirc.pyGriddata.table_management`
    * :mod:`~polyadcirc.pyGriddata.table_to_mesh_map`
    * :mod:`~polyadcirc.pyGriddata.grid_management`
    * :mod:`~polyadcirc.pyGriddata.manufacture_gap`

:mod:`~polyadcirc.pyGriddata.grid_management` prepares ``*.table and
*.13`` files needed for :mod:`~polyadcirc.pyGriddata.table_to_mesh_map` and
creates the n x m matrix of multiplier factors where n = # nodes, and m = #
land classification values, assuming there are no surprises with the spatial
averaging.

additional needed files:
    * compiled version of :program:`Gridata_v1.32.F90` named
      :program:`Griddata_parallel.out`
    * ``.asc`` files
    * ``*.14 files``
    * ``fort.13`` file to use as a template for
      :meth:`~polyadcirc.pyGriddata.prep_mesh.convert`

:mod:`~polyadcirc.pyGriddata.table_to_mesh_map` given a ``**_manning.table``
(and data file(s) from above) produces a ``fort.13`` ready for use by
:program:`ADCIRC`

.. note :: This module requires a modified version of
    :program:`Griddatat_v1.32.F90` that takes ``*.in`` files

"""
__all__ = ['file_management', 'table_management', 'table_to_mesh_map',
           'grid_management', 'manufacture_gap']


text:
<?php

namespace Bundle\AdminBundle\Form\Menu;

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

class MenuType extends AbstractType
{
        /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('name')
            ->add('url')
            ->add('position')
        ;
    }

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

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


text:
This is a scoring engine for cyber defense competitions. This currently includes:
- Database (MongoDB)
- Front-End
- CTF API
- Service Checker
- Team Score Web Socket

### Background
I am doing this project as my capstone, senior project, at SUNY Polytechnic and to use
for the [CNY Hackathon](https://www.cnyhackathon.org "CNY Hackathon Home"). The goal
is to make a modular Scoring Engine. The approach for the service checking is currently
to accept any script and base the it on the exit status code. There are different
things currently implemented as listed above but the goal is to make is modular, for
example you could only use the service checking portion which provides an API to use
and use our own web appication.

This is a work in progress and all suggestions are welcome.
Here are links to contacting me E-Mail: [t@ynotperez.net](mailto:t@ynotperez.net), Twitter: [@tonyxpr5](https://twitter.com/tonyxpr5)

### Configuration
You can use a configuration file to set the setting for the program. The file
name is config.toml. There are 2 different location you can have the config
file, in order (last location found will be used):
- $HOME/.cyboard/config.toml
- . (current directory)

There are multiple ways to configure the MongoDB URI(Last location found will be used):
- In the config file like so:
```
[database]
uri = "mongodb://127.0.0.1"
```
- As a command line parameter
    - `--mongodb_uri "mongodb://127.0.0.1"`
- As a environment variable
    - `MONGODB_URI`

Flags will overwrite setting in the configuration file

### Installation

To get **cyboard** up and running with some testing data:

1. Ensure **mongodb** is installed and active
2. Configure **_config.toml_** with the correct settings for your installation of mongodb
3. There are example data modals in the **setup/mongo** directory
4. Import test data:
    - `cd setup`
    - `sh ./dbcommands.sh`
5. Build cyboard:
    - `go build`
6. Start the server:
    - `./cyboard server`
7. Take it for a spin:
    - ex: `http://127.0.0.1:8080`

_Note on SSL:_ To quickly enable ssl using self-signed certs, you may run:
    `go run ./setup/generate_cert.go --host https://127.0.0.1:5433 --rsa-bits 4048`

[LICENSE](LICENSE.txt)


text:
.class public final Lcom/fasterxml/jackson/databind/type/CollectionType;
.super Lcom/fasterxml/jackson/databind/type/CollectionLikeType;
.source ""

# static fields
.field private static final serialVersionUID:J = -0x6cbb315ebf8435f0L

# direct methods
.method private constructor <init>(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;Ljava/lang/Object;Ljava/lang/Object;Z)V
    .locals 0
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(Ljava/lang/Class<*>;Lcom/fasterxml/jackson/databind/JavaType;Ljava/lang/Object;Ljava/lang/Object;Z)V"
        }
    .end annotation

    .line 22
    invoke-direct/range {p0 .. p5}, Lcom/fasterxml/jackson/databind/type/CollectionLikeType;-><init>(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;Ljava/lang/Object;Ljava/lang/Object;Z)V

    .line 23
    return-void
.end method

.method public static construct(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/CollectionType;
    .locals 6
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(Ljava/lang/Class<*>;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/CollectionType;"
        }
    .end annotation

    .line 55
    new-instance v0, Lcom/fasterxml/jackson/databind/type/CollectionType;

    move-object v1, p0

    move-object v2, p1

    const/4 v3, 0x0

    const/4 v4, 0x0

    const/4 v5, 0x0

    invoke-direct/range {v0 .. v5}, Lcom/fasterxml/jackson/databind/type/CollectionType;-><init>(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;Ljava/lang/Object;Ljava/lang/Object;Z)V

    return-object v0
.end method

# virtual methods
.method protected final _narrow(Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/JavaType;
    .locals 6
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(Ljava/lang/Class<*>;)Lcom/fasterxml/jackson/databind/JavaType;"
        }
    .end annotation

    .line 27
    new-instance v0, Lcom/fasterxml/jackson/databind/type/CollectionType;

    iget-object v2, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_elementType:Lcom/fasterxml/jackson/databind/JavaType;

    iget-boolean v5, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_asStatic:Z

    move-object v1, p1

    const/4 v3, 0x0

    const/4 v4, 0x0

    invoke-direct/range {v0 .. v5}, Lcom/fasterxml/jackson/databind/type/CollectionType;-><init>(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;Ljava/lang/Object;Ljava/lang/Object;Z)V

    return-object v0
.end method

.method public final narrowContentsBy(Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/JavaType;
    .locals 6
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(Ljava/lang/Class<*>;)Lcom/fasterxml/jackson/databind/JavaType;"
        }
    .end annotation

    .line 34
    iget-object v0, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_elementType:Lcom/fasterxml/jackson/databind/JavaType;

    invoke-virtual {v0}, Lcom/fasterxml/jackson/databind/JavaType;->getRawClass()Ljava/lang/Class;

    move-result-object v0

    if-ne p1, v0, :cond_0

    .line 35
    return-object p0

    .line 37
    :cond_0
    new-instance v0, Lcom/fasterxml/jackson/databind/type/CollectionType;

    iget-object v1, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_class:Ljava/lang/Class;

    iget-object v2, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_elementType:Lcom/fasterxml/jackson/databind/JavaType;

    invoke-virtual {v2, p1}, Lcom/fasterxml/jackson/databind/JavaType;->narrowBy(Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/JavaType;

    move-result-object v2

    iget-object v3, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_valueHandler:Ljava/lang/Object;

    iget-object v4, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_typeHandler:Ljava/lang/Object;

    iget-boolean v5, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_asStatic:Z

    invoke-direct/range {v0 .. v5}, Lcom/fasterxml/jackson/databind/type/CollectionType;-><init>(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;Ljava/lang/Object;Ljava/lang/Object;Z)V

    return-object v0
.end method

.method public final toString()Ljava/lang/String;
    .locals 2

    .line 101
    new-instance v0, Ljava/lang/StringBuilder;

    const-string v1, "[collection type; class "

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v1, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_class:Ljava/lang/Class;

    invoke-virtual {v1}, Ljava/lang/Class;->getName()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, ", contains "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    iget-object v1, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_elementType:Lcom/fasterxml/jackson/databind/JavaType;

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, "]"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public final widenContentsBy(Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/JavaType;
    .locals 6
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(Ljava/lang/Class<*>;)Lcom/fasterxml/jackson/databind/JavaType;"
        }
    .end annotation

    .line 45
    iget-object v0, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_elementType:Lcom/fasterxml/jackson/databind/JavaType;

    invoke-virtual {v0}, Lcom/fasterxml/jackson/databind/JavaType;->getRawClass()Ljava/lang/Class;

    move-result-object v0

    if-ne p1, v0, :cond_0

    .line 46
    return-object p0

    .line 48
    :cond_0
    new-instance v0, Lcom/fasterxml/jackson/databind/type/CollectionType;

    iget-object v1, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_class:Ljava/lang/Class;

    iget-object v2, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_elementType:Lcom/fasterxml/jackson/databind/JavaType;

    invoke-virtual {v2, p1}, Lcom/fasterxml/jackson/databind/JavaType;->widenBy(Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/JavaType;

    move-result-object v2

    iget-object v3, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_valueHandler:Ljava/lang/Object;

    iget-object v4, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_typeHandler:Ljava/lang/Object;

    iget-boolean v5, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_asStatic:Z

    invoke-direct/range {v0 .. v5}, Lcom/fasterxml/jackson/databind/type/CollectionType;-><init>(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;Ljava/lang/Object;Ljava/lang/Object;Z)V

    return-object v0
.end method

.method public final bridge synthetic withContentTypeHandler(Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/JavaType;
    .locals 1

    .line 8
    invoke-virtual {p0, p1}, Lcom/fasterxml/jackson/databind/type/CollectionType;->withContentTypeHandler(Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/type/CollectionType;

    move-result-object v0

    return-object v0
.end method

.method public final bridge synthetic withContentTypeHandler(Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/type/CollectionLikeType;
    .locals 1

    .line 8
    invoke-virtual {p0, p1}, Lcom/fasterxml/jackson/databind/type/CollectionType;->withContentTypeHandler(Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/type/CollectionType;

    move-result-object v0

    return-object v0
.end method

.method public final withContentTypeHandler(Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/type/CollectionType;
    .locals 6

    .line 68
    new-instance v0, Lcom/fasterxml/jackson/databind/type/CollectionType;

    iget-object v1, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_class:Ljava/lang/Class;

    iget-object v2, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_elementType:Lcom/fasterxml/jackson/databind/JavaType;

    invoke-virtual {v2, p1}, Lcom/fasterxml/jackson/databind/JavaType;->withTypeHandler(Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/JavaType;

    move-result-object v2

    iget-object v3, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_valueHandler:Ljava/lang/Object;

    iget-object v4, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_typeHandler:Ljava/lang/Object;

    iget-boolean v5, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_asStatic:Z

    invoke-direct/range {v0 .. v5}, Lcom/fasterxml/jackson/databind/type/CollectionType;-><init>(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;Ljava/lang/Object;Ljava/lang/Object;Z)V

    return-object v0
.end method

.method public final bridge synthetic withContentValueHandler(Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/JavaType;
    .locals 1

    .line 8
    invoke-virtual {p0, p1}, Lcom/fasterxml/jackson/databind/type/CollectionType;->withContentValueHandler(Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/type/CollectionType;

    move-result-object v0

    return-object v0
.end method

.method public final bridge synthetic withContentValueHandler(Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/type/CollectionLikeType;
    .locals 1

    .line 8
    invoke-virtual {p0, p1}, Lcom/fasterxml/jackson/databind/type/CollectionType;->withContentValueHandler(Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/type/CollectionType;

    move-result-object v0

    return-object v0
.end method

.method public final withContentValueHandler(Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/type/CollectionType;
    .locals 6

    .line 79
    new-instance v0, Lcom/fasterxml/jackson/databind/type/CollectionType;

    iget-object v1, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_class:Ljava/lang/Class;

    iget-object v2, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_elementType:Lcom/fasterxml/jackson/databind/JavaType;

    invoke-virtual {v2, p1}, Lcom/fasterxml/jackson/databind/JavaType;->withValueHandler(Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/JavaType;

    move-result-object v2

    iget-object v3, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_valueHandler:Ljava/lang/Object;

    iget-object v4, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_typeHandler:Ljava/lang/Object;

    iget-boolean v5, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_asStatic:Z

    invoke-direct/range {v0 .. v5}, Lcom/fasterxml/jackson/databind/type/CollectionType;-><init>(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;Ljava/lang/Object;Ljava/lang/Object;Z)V

    return-object v0
.end method

.method public final bridge synthetic withStaticTyping()Lcom/fasterxml/jackson/databind/JavaType;
    .locals 1

    .line 8
    invoke-virtual {p0}, Lcom/fasterxml/jackson/databind/type/CollectionType;->withStaticTyping()Lcom/fasterxml/jackson/databind/type/CollectionType;

    move-result-object v0

    return-object v0
.end method

.method public final bridge synthetic withStaticTyping()Lcom/fasterxml/jackson/databind/type/CollectionLikeType;
    .locals 1

    .line 8
    invoke-virtual {p0}, Lcom/fasterxml/jackson/databind/type/CollectionType;->withStaticTyping()Lcom/fasterxml/jackson/databind/type/CollectionType;

    move-result-object v0

    return-object v0
.end method

.method public final withStaticTyping()Lcom/fasterxml/jackson/databind/type/CollectionType;
    .locals 6

    .line 85
    iget-boolean v0, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_asStatic:Z

    if-eqz v0, :cond_0

    .line 86
    return-object p0

    .line 88
    :cond_0
    new-instance v0, Lcom/fasterxml/jackson/databind/type/CollectionType;

    iget-object v1, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_class:Ljava/lang/Class;

    iget-object v2, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_elementType:Lcom/fasterxml/jackson/databind/JavaType;

    invoke-virtual {v2}, Lcom/fasterxml/jackson/databind/JavaType;->withStaticTyping()Lcom/fasterxml/jackson/databind/JavaType;

    move-result-object v2

    iget-object v3, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_valueHandler:Ljava/lang/Object;

    iget-object v4, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_typeHandler:Ljava/lang/Object;

    const/4 v5, 0x1

    invoke-direct/range {v0 .. v5}, Lcom/fasterxml/jackson/databind/type/CollectionType;-><init>(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;Ljava/lang/Object;Ljava/lang/Object;Z)V

    return-object v0
.end method

.method public final bridge synthetic withTypeHandler(Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/JavaType;
    .locals 1

    .line 8
    invoke-virtual {p0, p1}, Lcom/fasterxml/jackson/databind/type/CollectionType;->withTypeHandler(Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/type/CollectionType;

    move-result-object v0

    return-object v0
.end method

.method public final bridge synthetic withTypeHandler(Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/type/CollectionLikeType;
    .locals 1

    .line 8
    invoke-virtual {p0, p1}, Lcom/fasterxml/jackson/databind/type/CollectionType;->withTypeHandler(Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/type/CollectionType;

    move-result-object v0

    return-object v0
.end method

.method public final withTypeHandler(Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/type/CollectionType;
    .locals 6

    .line 61
    new-instance v0, Lcom/fasterxml/jackson/databind/type/CollectionType;

    iget-object v1, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_class:Ljava/lang/Class;

    iget-object v2, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_elementType:Lcom/fasterxml/jackson/databind/JavaType;

    iget-object v3, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_valueHandler:Ljava/lang/Object;

    iget-boolean v5, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_asStatic:Z

    move-object v4, p1

    invoke-direct/range {v0 .. v5}, Lcom/fasterxml/jackson/databind/type/CollectionType;-><init>(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;Ljava/lang/Object;Ljava/lang/Object;Z)V

    return-object v0
.end method

.method public final bridge synthetic withValueHandler(Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/JavaType;
    .locals 1

    .line 8
    invoke-virtual {p0, p1}, Lcom/fasterxml/jackson/databind/type/CollectionType;->withValueHandler(Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/type/CollectionType;

    move-result-object v0

    return-object v0
.end method

.method public final bridge synthetic withValueHandler(Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/type/CollectionLikeType;
    .locals 1

    .line 8
    invoke-virtual {p0, p1}, Lcom/fasterxml/jackson/databind/type/CollectionType;->withValueHandler(Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/type/CollectionType;

    move-result-object v0

    return-object v0
.end method

.method public final withValueHandler(Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/type/CollectionType;
    .locals 6

    .line 74
    new-instance v0, Lcom/fasterxml/jackson/databind/type/CollectionType;

    iget-object v1, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_class:Ljava/lang/Class;

    iget-object v2, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_elementType:Lcom/fasterxml/jackson/databind/JavaType;

    iget-object v4, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_typeHandler:Ljava/lang/Object;

    iget-boolean v5, p0, Lcom/fasterxml/jackson/databind/type/CollectionType;->_asStatic:Z

    move-object v3, p1

    invoke-direct/range {v0 .. v5}, Lcom/fasterxml/jackson/databind/type/CollectionType;-><init>(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;Ljava/lang/Object;Ljava/lang/Object;Z)V

    return-object v0
.end method


text:
<?php
/**
 * Created by PhpStorm.
 * User: silence4r4
 * Date: 24.10.14
 * Time: 20:21
 */

namespace ITDoors\HelperBundle\Classes;

/**
 * Class HiddenFields
 */
class HiddenFields
{

    private $hiddenFields;

    /**
     * @param string  $function
     * @param mixed[] $args
     *
     * @return $this|null
     */
    public function __call($function, $args)
    {
        $check = substr($function, 0, 3);
        $key = substr($function, 3);
        if ($check == 'get') {
            $value = $this->getHiddenField($key);

            return $value;
        } elseif ($check == 'set') {
            $this->setHiddenField($key, $args);

            return $this;
        }

    }

    /**
     * @param string $key
     *
     * @return mixed
     */
    public function getHiddenField($key)
    {
        if (isset($this->hiddenFields[$key])) {

            return $this->hiddenFields[$key];
        }

        return null;
    }

    /**
     * @param string $key
     * @param mixed  $value
     *
     * @return $this
     */
    public function setHiddenField($key, $value)
    {
        $this->hiddenFields[$key] = $value;

        return $this;
    }
}


text:
from bibliopixel import LEDStrip
import bibliopixel.colors as colors
from bibliopixel.animation import BaseStripAnim

import math
import time
import random

class Rainbow(BaseStripAnim):
    """Generate rainbow distributed over 256 pixels.
       If you want the full rainbow to fit in the number of pixels you
       are using, use RainbowCycle instead
    """

    def __init__(self, led, start=0, end=-1):
        super(Rainbow, self).__init__(led, start, end)

    def step(self, amt = 1):
        for i in range(self._size):
            h = (i + self._step) % 255
            self._led.set(self._start + i, colors.hue2rgb_rainbow(h))

        self._step += amt
        overflow = self._step - 256
        if overflow >= 0:
            self._step = overflow

class RainbowCycle(BaseStripAnim):
    """Generate rainbow wheel equally distributed over strip."""

    def __init__(self, led, start=0, end=-1):
        super(RainbowCycle, self).__init__(led, start, end)

    def step(self, amt = 1):
        for i in range(self._size):
            c = colors.hue_helper(i, self._size, self._step)
            self._led.set(self._start + i, c)

        self._step += amt
        overflow = self._step - 256
        if overflow >= 0:
            self._step = overflow

class ColorPattern(BaseStripAnim):
    """Fill the dots progressively along the strip with alternating colors."""

    def __init__(self, led, colors, width, dir = True, start=0, end=-1):
        super(ColorPattern, self).__init__(led, start, end)
        self._colors = colors
        self._colorCount = len(colors)
        self._width = width
        self._total_width = self._width * self._colorCount;
        self._dir = dir

    def step(self, amt = 1):
        for i in range(self._size):
            cIndex = ((i+self._step) % self._total_width) / self._width;
            self._led.set(self._start + i, self._colors[cIndex])
        if self._dir:
            self._step += amt
            overflow = (self._start + self._step) - self._end
            if overflow >= 0:
                self._step = overflow
        else:
            self._step -= amt
            if self._step < 0:
                self._step = self._end + self._step

class ColorWipe(BaseStripAnim):
    """Fill the dots progressively along the strip."""

    def __init__(self, led, color, start=0, end=-1):
        super(ColorWipe, self).__init__(led, start, end)
        self._color = color

    def step(self, amt = 1):
        if self._step == 0:
            self._led.all_off()
        for i in range(amt):
            self._led.set(self._start + self._step - i, self._color)

        self._step += amt
        overflow = (self._start + self._step) - self._end
        if overflow >= 0:
            self._step = overflow

class ColorFade(BaseStripAnim):
    """Fill the dots progressively along the strip."""

    def wave_range(self, start, peak, step):
        main = [i for i in range(start, peak+1, step)]
        return main + [i for i in reversed(main[0:len(main)-1])]

    def __init__(self, led, colors, step = 5, start=0, end=-1):
        super(ColorFade, self).__init__(led, start, end)
        self._colors = colors
        self._levels = self.wave_range(30, 255, step)
        self._level_count = len(self._levels)
        self._color_count = len(colors)

    def step(self, amt = 1):
        if self._step > self._level_count * self._color_count:
            self._step = 0

        c_index = (self._step / self._level_count) % self._color_count
        l_index = (self._step % self._level_count)
        color = self._colors[c_index];
        self._led.fill(colors.color_scale(color, self._levels[l_index]), self._start, self._end)

        self._step += amt

class ColorChase(BaseStripAnim):
    """Chase one pixel down the strip."""

    def __init__(self, led, color, width=1, start=0, end=-1):
        super(ColorChase, self).__init__(led, start, end)
        self._color = color
        self._width = width

    def step(self, amt = 1):
        self._led.all_off() #because I am lazy

        for i in range(self._width):
            self._led.set(self._start + self._step + i, self._color)

        self._step += amt
        overflow = (self._start + self._step) - self._end
        if overflow >= 0:
            self._step = overflow

class PartyMode(BaseStripAnim):
    """Stobe Light Effect."""

    def __init__(self, led, colors, start=0, end=-1):
        super(PartyMode, self).__init__(led, start, end)
        self._colors = colors
        self._color_count = len(colors)

    def step(self, amt = 1):
        amt = 1 #anything other than 1 would be just plain silly
        if self._step > (self._color_count * 2) - 1:
            self._step = 0

        if self._step % 2 == 0:
            self._led.fill(self._colors[self._step / 2], self._start, self._end)
        else:
            self._led.all_off()

        self._step += amt

class FireFlies(BaseStripAnim):
    """Stobe Light Effect."""
    def __init__(self, led, colors, width = 1, count = 1, start=0, end=-1):
        super(FireFlies, self).__init__(led, start, end)
        self._colors = colors
        self._color_count = len(colors)
        self._width = width
        self._count = count

    def step(self, amt = 1):
        amt = 1 #anything other than 1 would be just plain silly
        if self._step > self._led.numLEDs:
            self._step = 0

        self._led.all_off();

        for i in range(self._count):
            pixel = random.randint(0, self._led.numLEDs - 1)
            color = self._colors[random.randint(0, self._color_count - 1)]

            for i in range(self._width):
                if pixel + i < self._led.numLEDs:
                    self._led.set(pixel + i, color)

        self._step += amt

class LarsonScanner(BaseStripAnim):
    """Larson scanner (i.e. Cylon Eye or K.I.T.T.)."""

    def __init__(self, led, color, tail=2, start=0, end=-1):
        super(LarsonScanner, self).__init__(led, start, end)
        self._color = color

        self._tail = tail + 1  # makes tail math later easier
        if self._tail >= self._size / 2:
            self._tail = (self._size / 2) - 1

        self._direction = -1
        self._last = 0
        self._fadeAmt = 256 / self._tail

    def step(self, amt = 1):
        self._led.all_off()

        self._last = self._start + self._step
        self._led.set(self._last, self._color)

        for i in range(self._tail):
            self._led.set(self._last - i, colors.color_scale(self._color, 255 - (self._fadeAmt * i)))
            self._led.set(self._last + i, colors.color_scale(self._color, 255 - (self._fadeAmt * i)))

        if self._start + self._step >= self._end:
            self._direction = -self._direction
        elif self._step <= 0:
            self._direction = -self._direction

        self._step += self._direction * amt

class LarsonRainbow(LarsonScanner):
    """Larson scanner (i.e. Cylon Eye or K.I.T.T.) but Rainbow."""

    def __init__(self, led, tail=2, start=0, end=-1):
        super(LarsonRainbow, self).__init__(
            led, colors.Off, tail, start, end)

    def step(self, amt = 1):
        self._color = colors.hue_helper(0, self._size, self._step)
        #self._color = colors.hue2rgb_rainbow((self._step * (256 / self._size)) % 256)

        super(LarsonRainbow, self).step(amt)

class Wave(BaseStripAnim):
    """Sine wave animation."""

    def __init__(self, led, color, cycles, start=0, end=-1):
        super(Wave, self).__init__(led, start, end)
        self._color = color
        self._cycles = cycles

    def step(self, amt = 1):
        for i in range(self._size):
            y = math.sin(
                math.pi *
                float(self._cycles) *
                float(self._step * i) /
                float(self._size))

            if y >= 0.0:
                # Peaks of sine wave are white
                y = 1.0 - y  # Translate Y to 0.0 (top) to 1.0 (center)
                r, g, b = self._color
                c2 = (int(255 - float(255 - r) * y), int(255 - float(255 - g) * y), int(255 - float(255 - b) * y))
            else:
                # Troughs of sine wave are black
                y += 1.0  # Translate Y to 0.0 (bottom) to 1.0 (center)
                r, g, b = self._color
                c2 = (int(float(r) * y),
                           int(float(g) * y),
                           int(float(b) * y))
            self._led.set(self._start + i, c2)

        self._step += amt

class WaveMove(BaseStripAnim):
    """Sine wave animation."""

    def __init__(self, led, color, cycles, start=0, end=-1):
        super(WaveMove, self).__init__(led, start, end)
        self._color = color
        self._cycles = cycles
        self._moveStep = 0

    def step(self, amt = 1):
        for i in range(self._size):
            y = math.sin(
                (math.pi *
                float(self._cycles) *
                float(i) /
                float(self._size))
                + self._moveStep)

            if y >= 0.0:
                # Peaks of sine wave are white
                y = 1.0 - y  # Translate Y to 0.0 (top) to 1.0 (center)
                r, g, b = self._color
                c2 = (int(255 - float(255 - r) * y), int(255 - float(255 - g) * y), int(255 - float(255 - b) * y))
            else:
                # Troughs of sine wave are black
                y += 1.0  # Translate Y to 0.0 (bottom) to 1.0 (center)
                r, g, b = self._color
                c2 = (int(float(r) * y),
                           int(float(g) * y),
                           int(float(b) * y))
            self._led.set(self._start + i, c2)

        self._step += amt
        self._moveStep += 1
        if(self._moveStep >= self._size):
            self._moveStep = 0

import time
class RGBClock(BaseStripAnim):
    """RGB Clock done with RGB LED strip(s)"""

    def __init__(self, led, hStart, hEnd, mStart, mEnd, sStart, sEnd):
        super(RGBClock, self).__init__(led, 0, -1)
        if hEnd < hStart:
            hEnd = hStart + 1
        if mEnd < mStart:
            mEnd = mStart + 1
        if sEnd < sStart:
            sEnd = sStart + 1
        self._hStart = hStart
        self._hEnd = hEnd
        self._mStart = mStart
        self._mEnd = mEnd
        self._sStart = sStart
        self._sEnd = sEnd

    def step(self, amt = 1):
        t = time.localtime()

        r, g, b = colors.hue2rgb_rainbow(t.tm_hour * (256/24))
        self._led.fillRGB(r,g,b,self._hStart,self._hEnd)

        r, g, b = colors.hue2rgb_rainbow(t.tm_min * (256/60))
        self._led.fillRGB(r,g,b,self._mStart,self._mEnd)

        r, g, b = colors.hue2rgb_rainbow(t.tm_sec * (256/60))
        self._led.fillRGB(r,g,b,self._sStart,self._sEnd)

        self._step = 0


text:
module Bigmouth
  class Config
    include ActiveSupport::Configurable

    config_accessor :user_class
    config_accessor :layout
    config_accessor :username_key
    config_accessor :summary_length
    config_accessor :datetime_format
    config_accessor :sign_in_uri
    config_accessor :sign_out_uri

    configure do |config|
      config.user_class = "User"
      config.layout = "bigmouth/default"
      config.username_key = "email"
      config.summary_length = 20
      config.datetime_format = "%B %d, %Y at %l:%M %p"
      config.sign_in_uri = { uri: "/sign_in", method: :get }
      config.sign_out_uri = { uri: "/sign_out", method: :post }
    end
  end
end


text:
const phannot_token_names phannot_tokens[] =
{
	{ "INTEGER",        PHANNOT_T_INTEGER },
	{ "DOUBLE",         PHANNOT_T_DOUBLE },
	{ "STRING",         PHANNOT_T_STRING },
	{ "IDENTIFIER",     PHANNOT_T_IDENTIFIER },
	{ "@",              PHANNOT_T_AT },
	{ ",",              PHANNOT_T_COMMA },
	{ "=",              PHANNOT_T_EQUALS },
	{ ":",              PHANNOT_T_COLON },
	{ "(",              PHANNOT_T_PARENTHESES_OPEN },
	{ ")",              PHANNOT_T_PARENTHESES_CLOSE },
	{ "{",              PHANNOT_T_BRACKET_OPEN },
	{ "}",              PHANNOT_T_BRACKET_CLOSE },
 	{ "[",              PHANNOT_T_SBRACKET_OPEN },
	{ "]",              PHANNOT_T_SBRACKET_CLOSE },
	{ "ARBITRARY TEXT", PHANNOT_T_ARBITRARY_TEXT },
	{ NULL, 0 }
};

/**
 * Wrapper to alloc memory within the parser
 */
static void *phannot_wrapper_alloc(size_t bytes){
	return emalloc(bytes);
}

/**
 * Wrapper to free memory within the parser
 */
static void phannot_wrapper_free(void *pointer){
	efree(pointer);
}

/**
 * Creates a parser_token to be passed to the parser
 */
static void phannot_parse_with_token(void* phannot_parser, int opcode, int parsercode, phannot_scanner_token *token, phannot_parser_status *parser_status){

	phannot_parser_token *pToken;

	pToken = emalloc(sizeof(phannot_parser_token));
	pToken->opcode = opcode;
	pToken->token = token->value;
	pToken->token_len = token->len;
	pToken->free_flag = 1;

	phannot_(phannot_parser, parsercode, pToken, parser_status);

	token->value = NULL;
	token->len = 0;
}

/**
 * Creates an error message when it's triggered by the scanner
 */
static void phannot_scanner_error_msg(phannot_parser_status *parser_status, char **error_msg TSRMLS_DC){

	phannot_scanner_state *state = parser_status->scanner_state;

	if (state->start) {
		if (state->start_length > 16) {
			spprintf(error_msg, 0, "Scanning error before '%.16s...' in %s on line %d", state->start, state->active_file, state->active_line);
		} else {
			spprintf(error_msg, 0, "Scanning error before '%s' in %s on line %d", state->start, state->active_file, state->active_line);
		}
	} else {
		spprintf(error_msg, 0, "Scanning error near to EOF in %s", state->active_file);
	}
}

/**
 * Receives the comment tokenizes and parses it
 */
int phannot_parse_annotations(zval *result, zval *comment, zval *file_path, zval *line TSRMLS_DC) {

	char *comment_str;
	int comment_len;
	char *file_path_str;
	int line_num;

	char *error_msg = NULL;

	ZVAL_NULL(result);

	if (Z_TYPE_P(comment) == IS_STRING) {
		comment_str = Z_STRVAL_P(comment);
		comment_len = Z_STRLEN_P(comment);
	} else {
		comment_str = "";
		comment_len = 0;
	}

	if (Z_TYPE_P(file_path) == IS_STRING) {
		file_path_str = Z_STRVAL_P(file_path);
	} else {
		file_path_str = "eval";
	}

	if (Z_TYPE_P(line) == IS_LONG) {
		line_num = Z_LVAL_P(line);
	} else {
		line_num = 0;
	}

	if (phannot_internal_parse_annotations(&result, comment_str, comment_len, file_path_str, line_num, &error_msg TSRMLS_CC) == FAILURE) {
		if (likely(error_msg != NULL)) {
			zephir_throw_exception_string(phalcon_annotations_exception_ce, error_msg, strlen(error_msg) TSRMLS_CC);
			efree(error_msg);
		} else {
			zephir_throw_exception_string(phalcon_annotations_exception_ce, SL("There was an error parsing annotation") TSRMLS_CC);
		}

		return FAILURE;
	}

	return SUCCESS;
}

/**
 * Remove comment separators from a docblock
 */
static void phannot_remove_comment_separators(char **ret, int *ret_len, const char *comment, int length, int *start_lines)
{
	char ch;
	int start_mode = 1, j, i, open_parentheses;
	smart_str processed_str = {0};

	(*start_lines) = 0;

	for (i = 0; i < length; i++) {

		ch = comment[i];

		if (start_mode) {
			if (ch == ' ' || ch == '*' || ch == '/' || ch == '\t' || ch == 11) {
				continue;
			}
			start_mode = 0;
		}

		if (ch == '@') {

			smart_str_appendc(&processed_str, ch);
			i++;

			open_parentheses = 0;
			for (j = i; j < length; j++) {

				ch = comment[j];

				if (start_mode) {
					if (ch == ' ' || ch == '*' || ch == '/' || ch == '\t' || ch == 11) {
						continue;
					}
					start_mode = 0;
				}

				if (open_parentheses == 0) {

					if (isalnum(ch) || '_' == ch || '\\' == ch) {
						smart_str_appendc(&processed_str, ch);
						continue;
					}

					if (ch == '(') {
						smart_str_appendc(&processed_str, ch);
						open_parentheses++;
						continue;
					}

				} else {

					smart_str_appendc(&processed_str, ch);

					if (ch == '(') {
						open_parentheses++;
					} else {
						if (ch == ')') {
							open_parentheses--;
						} else {
							if (ch == '\n') {
								(*start_lines)++;
								start_mode = 1;
							}
						}
					}

					if (open_parentheses > 0) {
						continue;
					}
				}

				i = j;
				smart_str_appendc(&processed_str, ' ');
				break;
			}
		}

		if (ch == '\n') {
			(*start_lines)++;
			start_mode = 1;
		}
	}

	smart_str_0(&processed_str);

#if PHP_VERSION_ID < 70000
	if (processed_str.len) {
		*ret     = processed_str.c;
		*ret_len = processed_str.len;
	} else {
		*ret     = NULL;
		*ret_len = 0;
	}
#else
	if (processed_str.s) {
		*ret     = estrndup(ZSTR_VAL(processed_str.s), ZSTR_LEN(processed_str.s));
		*ret_len = ZSTR_LEN(processed_str.s);
		smart_str_free(&processed_str);
	} else {
		*ret     = NULL;
		*ret_len = 0;
	}
#endif
}

/**
 * Parses a comment returning an intermediate array representation
 */
int phannot_internal_parse_annotations(zval **result, const char *comment, int comment_len, const char *file_path, int line, char **error_msg TSRMLS_DC)
{
	phannot_scanner_state *state;
	phannot_scanner_token token;
	int start_lines;
	int scanner_status, status = SUCCESS;
	phannot_parser_status *parser_status = NULL;
	void* phannot_parser;
	char *processed_comment;
	int processed_comment_len;

	*error_msg = NULL;

	/**
	 * Check if the comment has content
	 */
	if (UNEXPECTED(!comment)) {
		ZVAL_BOOL(*result, 0);
		spprintf(error_msg, 0, "Empty annotation");
		return FAILURE;
	}

	if (comment_len < 2) {
		ZVAL_BOOL(*result, 0);
		return SUCCESS;
	}

	/**
	 * Remove comment separators
	 */
	phannot_remove_comment_separators(&processed_comment, &processed_comment_len, comment, comment_len, &start_lines);

	if (processed_comment_len < 2) {
		ZVAL_BOOL(*result, 0);
		if (processed_comment) {
			efree(processed_comment);
		}

		return SUCCESS;
	}

	/**
	 * Start the reentrant parser
	 */
	phannot_parser = phannot_Alloc(phannot_wrapper_alloc);
	if (unlikely(!phannot_parser)) {
		ZVAL_BOOL(*result, 0);
		return FAILURE;
	}

	parser_status = emalloc(sizeof(phannot_parser_status) + sizeof(phannot_scanner_state));
	state         = (phannot_scanner_state*)((char*)parser_status + sizeof(phannot_parser_status));

	parser_status->status = PHANNOT_PARSING_OK;
	parser_status->scanner_state = state;
#if PHP_VERSION_ID < 70000
	parser_status->ret = NULL;
#endif
	parser_status->token = &token;
	parser_status->syntax_error = NULL;

	/**
	 * Initialize the scanner state
	 */
	state->active_token = 0;
	state->start = processed_comment;
	state->start_length = 0;
	state->mode = PHANNOT_MODE_RAW;
	state->active_file = file_path;

	token.value = NULL;
	token.len = 0;

	/**
	 * Possible start line
	 */
	if (line) {
		state->active_line = line - start_lines;
	} else {
		state->active_line = 1;
	}

	state->end = state->start;

	while(0 <= (scanner_status = phannot_get_token(state, &token))) {

		state->active_token = token.opcode;

		state->start_length = processed_comment + processed_comment_len - state->start;

		switch (token.opcode) {

			case PHANNOT_T_IGNORE:
				break;

			case PHANNOT_T_AT:
				phannot_(phannot_parser, PHANNOT_AT, NULL, parser_status);
				break;
			case PHANNOT_T_COMMA:
				phannot_(phannot_parser, PHANNOT_COMMA, NULL, parser_status);
				break;
			case PHANNOT_T_EQUALS:
				phannot_(phannot_parser, PHANNOT_EQUALS, NULL, parser_status);
				break;
			case PHANNOT_T_COLON:
				phannot_(phannot_parser, PHANNOT_COLON, NULL, parser_status);
				break;

			case PHANNOT_T_PARENTHESES_OPEN:
				phannot_(phannot_parser, PHANNOT_PARENTHESES_OPEN, NULL, parser_status);
				break;
			case PHANNOT_T_PARENTHESES_CLOSE:
				phannot_(phannot_parser, PHANNOT_PARENTHESES_CLOSE, NULL, parser_status);
				break;

			case PHANNOT_T_BRACKET_OPEN:
				phannot_(phannot_parser, PHANNOT_BRACKET_OPEN, NULL, parser_status);
				break;
			case PHANNOT_T_BRACKET_CLOSE:
				phannot_(phannot_parser, PHANNOT_BRACKET_CLOSE, NULL, parser_status);
				break;

			case PHANNOT_T_SBRACKET_OPEN:
				phannot_(phannot_parser, PHANNOT_SBRACKET_OPEN, NULL, parser_status);
				break;
			case PHANNOT_T_SBRACKET_CLOSE:
				phannot_(phannot_parser, PHANNOT_SBRACKET_CLOSE, NULL, parser_status);
				break;

			case PHANNOT_T_NULL:
				phannot_(phannot_parser, PHANNOT_NULL, NULL, parser_status);
				break;
			case PHANNOT_T_TRUE:
				phannot_(phannot_parser, PHANNOT_TRUE, NULL, parser_status);
				break;
			case PHANNOT_T_FALSE:
				phannot_(phannot_parser, PHANNOT_FALSE, NULL, parser_status);
				break;

			case PHANNOT_T_INTEGER:
				phannot_parse_with_token(phannot_parser, PHANNOT_T_INTEGER, PHANNOT_INTEGER, &token, parser_status);
				break;
			case PHANNOT_T_DOUBLE:
				phannot_parse_with_token(phannot_parser, PHANNOT_T_DOUBLE, PHANNOT_DOUBLE, &token, parser_status);
				break;
			case PHANNOT_T_STRING:
				phannot_parse_with_token(phannot_parser, PHANNOT_T_STRING, PHANNOT_STRING, &token, parser_status);
				break;
			case PHANNOT_T_IDENTIFIER:
				phannot_parse_with_token(phannot_parser, PHANNOT_T_IDENTIFIER, PHANNOT_IDENTIFIER, &token, parser_status);
				break;
			/*case PHANNOT_T_ARBITRARY_TEXT:
				phannot_parse_with_token(phannot_parser, PHANNOT_T_ARBITRARY_TEXT, PHANNOT_ARBITRARY_TEXT, &token, parser_status);
				break;*/

			default:
				parser_status->status = PHANNOT_PARSING_FAILED;
				if (!*error_msg) {
					spprintf(error_msg, 0, "Scanner: unknown opcode %d on in %s line %d", token.opcode, state->active_file, state->active_line);
				}
				break;
		}

		if (parser_status->status != PHANNOT_PARSING_OK) {
			status = FAILURE;
			break;
		}

		state->end = state->start;
	}

	if (status != FAILURE) {
		switch (scanner_status) {

			case PHANNOT_SCANNER_RETCODE_ERR:
			case PHANNOT_SCANNER_RETCODE_IMPOSSIBLE:
				if (!*error_msg) {
					phannot_scanner_error_msg(parser_status, error_msg TSRMLS_CC);
				}
				status = FAILURE;
				break;

			default:
				phannot_(phannot_parser, 0, NULL, parser_status);
		}
	}

	state->active_token = 0;
	state->start = NULL;

	if (parser_status->status != PHANNOT_PARSING_OK) {
		status = FAILURE;
		if (parser_status->syntax_error) {
			if (!*error_msg) {
				*error_msg = parser_status->syntax_error;
			} else {
				efree(parser_status->syntax_error);
			}
		}
	}

	phannot_Free(phannot_parser, phannot_wrapper_free);

	if (status != FAILURE) {
		if (parser_status->status == PHANNOT_PARSING_OK) {
#if PHP_VERSION_ID < 70000
			if (parser_status->ret) {
				ZVAL_ZVAL(*result, parser_status->ret, 0, 0);
				ZVAL_NULL(parser_status->ret);
				zval_ptr_dtor(&parser_status->ret);
			} else {
				array_init(*result);
			}
#else
			ZVAL_ZVAL(*result, &parser_status->ret, 1, 1);
#endif
		}
	}

	efree(processed_comment);
	efree(parser_status);

	return status;
}


text:
package bleve

import (
	"fmt"
	"strconv"
	"time"

	"github.com/blevesearch/bleve"
	"github.com/pedronasser/caddy-search/indexer"
	"github.com/pedronasser/go-piper"
)

type bleveIndexer struct {
	pipeline piper.Handler
	bleve    bleve.Index
}

// Bleve's record data struct
type indexRecord struct {
	Path     string
	Title    string
	Body     string
	Modified string
	Indexed  string
}

// Record method get existent or creates a new Record to be saved/updated in the indexer
func (i *bleveIndexer) Record(path string) indexer.Record {
	record := recordPool.Get().(*Record)
	record.path = path
	record.fullPath = ""
	record.title = ""
	record.document = make(map[string]interface{})
	record.ignored = false
	record.loaded = false
	record.body = bufPool.Get().([]byte)
	record.indexed = time.Time{}
	record.modified = time.Time{}
	record.indexer = i
	return record
}

func (i *bleveIndexer) Kill(r indexer.Record) {
	bufPool.Put(r.Body())
	recordPool.Put(r)
}

// Search method lookup for records using a query
func (i *bleveIndexer) Search(q string) (records []indexer.Record) {
	query := bleve.NewQueryStringQuery(q)
	request := bleve.NewSearchRequest(query)
	request.Highlight = bleve.NewHighlight()
	result, err := i.bleve.Search(request)
	if err != nil { // an empty query would cause this
		return
	}

	for _, match := range result.Hits {
		rec := i.Record(match.ID)
		loaded := rec.Load()

		if !loaded {
			continue
		}

		if len(match.Fragments["Body"]) > 0 {
			rec.SetBody([]byte(match.Fragments["Body"][0]))
		}

		records = append(records, rec)
	}

	return
}

// Pipe sends the new record to the pipeline
func (i *bleveIndexer) Pipe(r indexer.Record) {
	i.pipeline.Input() <- r
}

// index is the pipeline step that indexes the document
func (i *bleveIndexer) index(in interface{}) interface{} {
	if rec, ok := in.(*Record); ok {

		if rec != nil && len(rec.body) > 0 && !rec.Ignored() {
			rec.SetIndexed(time.Now())
			fmt.Println(rec.FullPath())

			r := indexRecord{
				Path:     rec.Path(),
				Title:    rec.Title(),
				Body:     string(rec.body),
				Modified: strconv.Itoa(int(rec.Modified().Unix())),
				Indexed:  strconv.Itoa(int(rec.Indexed().Unix())),
			}

			i.bleve.Index(rec.Path(), r)
		}

		i.Kill(rec)
	}

	return in
}


text:
/** @class
*/
XT.dispatch = XT.Functor.create(
  /** @lends XT.dispatch.prototype */ {

  /** @private */
  handle: function(xtr) {
    var payload = xtr.get('payloadSafe'),
        session = xtr.get('session'),
        query = "select xt.dispatch('%@')".f(payload);

    // important to note that querying needs to be handled through
    // the session generated and stored in the response object
    session.query(query, function(res) {

      // session queried callbacks are only used on
      // success and automatically handle returned errors
      xtr.write(res).close();
    });
  },

  /** @private */
  handles: 'dispatch',

  /** @private */
  className: 'XT.dispatch'

});


text:
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/**
* @name: S15.5.2.1_A1_T19;
* @section: 15.5.2.1;
* @assertion: When "String" is called as part of a new expression, it is a constructor: it initialises the newly created object and
* The [[Value]] property of the newly constructed object is set to ToString(value), or to the empty string if value is not supplied;
* @description: Creating string object with "new String()" initialized with Array of numbers;
*/

var __str = new String(new Array(1,2,3));
//////////////////////////////////////////////////////////////////////////////
//CHECK#1
if (typeof __str !== "object") {
  $ERROR('#1: __str = new String(new Array(1,2,3)); typeof __str === "object". Actual: typeof __str ==='+typeof __str );
}
//
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
//CHECK#1.5
if (__str.constructor !== String) {
  $ERROR('#1.5: __str = new String(new Array(1,2,3)); __str.constructor === String. Actual: __str.constructor ==='+__str.constructor );
}
//
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
//CHECK#2
if (__str !="1,2,3") {
  $ERROR('#2: __str = new String(new Array(1,2,3)); __str =="1,2,3". Actual: __str =='+__str );
}
//
//////////////////////////////////////////////////////////////////////////////


text:
package org.fit.vutbr.relaxdms.rest.api;

import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

/**
 *
 * @author Martin Kanis
 */
@Path("workflow")
public interface WorkflowRest {

    @POST
    @Path("/fireUnfreeze")
    public Response fireUnfreezeWorkflow();

    @POST
    @Path("/fireRelease")
    public Response fireReleaseWorkflow();

    @GET
    @Path("/getCustomRules")
    @Produces(MediaType.APPLICATION_JSON)
    public Response getCustomRules();

    @POST
    @Path("/fireCustom/{rule}")
    public Response fireCustomWorkflow(@PathParam("rule") String rule);
}


text:
module DarrylJenks
  class Permutable
    attr_accessor :key_string

    ##
    # Constructor can be initialized with the key_string to initialize off of
    #
    def initialize( key_string = nil )
      self.key_string = key_string
    end

    ##
    # Computes the Permutations of a string
    #
    # Ex: key_string = "HELLO WORLD FIRST"
    #
    # each_permutation(" ", "-")
    # dash_permutations = [ "HELLO-WORLD FIRST", "HELLO-WORLD-FIRST", "HELLO WORLD-FIRST" ]
    #
    # The 'permutable_key' is the character/regex that should be used as the split mechanism
    # to determine how many objects are in the collection to be "permed"
    #
    # The 'substitution_value' is the character that should be used in the permutations of
    # the string as the separator value
    #
    def each_permutation(permutable_key, substitution_value, options = {})
      return unless self.key_string.index(permutable_key)

      permutations = []
      split_tokens = self.key_string.split(permutable_key,-1)
      # At least a single permutation needs to be present
      number_of_permutations = [(split_tokens.size - 1), 1].max

      permutations_for(number_of_permutations).each do |permutation_pattern|
        permutation_string = ""
        copied_tokens = split_tokens.map(&:dup)

        permutation_pattern.each do |replace_split_token|
          permutation_string << copied_tokens.shift

          if replace_split_token
            permutation_string << substitution_value
          else
            permutation_string << (options[:non_replace_substitution] || permutable_key)
          end
        end

        permutation_string << copied_tokens.shift unless copied_tokens.empty?
        permutations << permutation_string
      end

      if block_given?
        permutations.each do |permutation|
          yield permutation
        end
      else
        permutations.to_enum
      end
    end

    private

    def permutations_for(size_of_tokens)
      [ true, false ].repeated_permutation(size_of_tokens).to_a
    end

  end
end


text:
// Copyright 2015 XLGAMES Inc.
//
// Distributed under the MIT License (See
// accompanying file "LICENSE" or the website
// http://www.opensource.org/licenses/mit-license.php)

#pragma once

#include "ThreadLibrary.h"
#include "../../Core/Prefix.h"
#include "../../Core/Types.h"

/// \namespace Utility::Interlocked
///
/// This namespace provides low-level utility functions for atomic operations.
/// Mostly this namespace wraps some low-level api providing the functionality
/// required (this gives us flexibility to choose different low level api, and
/// perhaps provide different solutions for different platforms).
///
/// # Return values
///
/// Important note:
///     Functions in the Interlocked namespace always return the previous
///     value of the target! This differs from the Win32 API InterlockedAdd, etc!
///
///         Win32 InterlockedAdd(&target, addition) -> returns old "target" + addition
///         Interlocked::InterlockedAdd(&target, addition) -> returns old "target"
///
///     This simple rule seems is more intuitive and consistant. Interlocked::Exchange
///     and other functions also work in this same way -- return the "old" value.
///
///     But it means that code previously used Win32 InterlockedAdd() must be change
///     to suit this behaviour.
///
///     As an example, here is reference count Release() behaviour:
///     <example>
///         <code>\code
///             auto oldRefCount = Interlocked::Decrement(&refCount);
///             if (oldRefCount == 1) {
///                     // (ref count was previously 1, and so is now 0)
///                 delete *this;
///             }
///         \endcode</code>
///     </example>
///
/// # Release / Acquire semantics
///
/// When using atomic functions, there are issues related to the ordering of instruction
/// completion relative to other instructions. In certain cases, a thread can see an atomic
/// value change in way that appears out-of-order relative to other memory changes.
///
/// This is particularly important for mutexes and threading control primitives. When a mutex
/// is unlocked, it's normal to assume that memory writes to the object that mutex protects
/// will be committed to memory. However, this isn't guaranteed unless there is a memory barrier
/// to properly synchronize memory. Normally mutex implementations will take care of this. However
/// it's worth noting when writing custom thread control (eg, a spin lock) that use these Interlocked
/// methods.
///
/// For more information on this topic, see documentation on std::memory_order (part of the new C++ standard)
///
/// When using the Win32 intrinsic implementations of InterlockedExchange, etc, these automatically
/// place a read/write barrier that effects the behaviour of the compiler, and possibly a memory barrier
/// as well. See the MSVC documentation for _ReadWriteBarrier. The documentation is a little unclear
/// about whether there is a runtime memory barrier (and on what platforms it takes effect).

#if (THREAD_LIBRARY == THREAD_LIBRARY_TINYTHREAD) || (THREAD_LIBRARY == THREAD_LIBRARY_STDCPP)

    #include <intrin.h>

    #if defined(_M_IA64) || defined(_M_AMD64)
        #define EXCHANGE64_INTRINSIC
    #endif

    namespace Utility { namespace Interlocked
    {
        typedef long Value;
        typedef int64 Value64;

        force_inline Value Exchange(Value volatile* target, Value newValue)           { return _InterlockedExchange(target, newValue); }

        inline Value CompareExchange(Value volatile* target, Value newValue, Value comparisonValue)                     { return _InterlockedCompareExchange(target, newValue, comparisonValue); }
        force_inline Value64 CompareExchange64(Value64 volatile* target, Value64 newValue, Value64 comparisonValue)     { return _InterlockedCompareExchange64(target, newValue, comparisonValue); }

        #if defined(EXCHANGE64_INTRINSIC)
            force_inline Value64 Exchange64(Value64 volatile* target, Value64 newValue)   { return _InterlockedExchange64(target, newValue); }
            force_inline void* ExchangePointer(void* volatile* target, void* newValue)    { return _InterlockedExchangePointer(target, newValue); }
            force_inline void* CompareExchangePointer(void* volatile* target, void* newValue, void* comparisonValue)      { return _InterlockedCompareExchangePointer(target, newValue, comparisonValue); }
        #else
            force_inline Value64 Exchange64(Value64 volatile* target, Value64 newValue)
            {
                    //  Intrinsic for Exchange64 is not provided in <intrin.h> for 32 bit targets
                    //  however, the behaviour should be as follows --
                Value64 old;
                do {
                    old = *target;
                } while (CompareExchange64(target, newValue, old) != old);
                return old;
            }

            force_inline void* ExchangePointer(void* volatile* target, void* newValue)
            {
                if (constant_expression<sizeof(void*) == 4>::result()) {
                    return (void*)Exchange((Value volatile*)target, (Value)newValue);
                } else {
                    return (void*)Exchange64((Value64 volatile*)target, (Value64)newValue);
                }
            }

            force_inline void* CompareExchangePointer(void* volatile* target, void* newValue, void* comparisonValue)
            {
                if (constant_expression<sizeof(void*) == 4>::result()) {
                    return (void*)CompareExchange((Value volatile*)target, (Value)newValue, (Value)comparisonValue);
                } else {
                    return (void*)CompareExchange64((Value64 volatile*)target, (Value64)newValue, (Value)comparisonValue);
                }
            }
        #endif

            /* note -- "_InterlockedIncrement" will not return the correct result on Win95 and earlier! Expect crashes and leaks on that platform! */
        force_inline Value Increment(Value volatile* target)              { return _InterlockedIncrement(target)-1; }
        force_inline Value Decrement(Value volatile* target)              { return _InterlockedDecrement(target)+1; }
        force_inline Value Add(Value volatile* target, Value addition)    { return _InterlockedExchangeAdd(target, addition); }

        force_inline Value Load(Value volatile* target)                   { return *target; }
        force_inline Value64 Load64(Value64 volatile const* target)       { return *target; }
        force_inline void* LoadPointer(void* volatile const* target)      { return *target; }
    }}

#endif

#if THREAD_LIBRARY == THREAD_LIBRARY_TBB

    #if PLATFORMOS_TARGET == PLATFORMOS_WINDOWS
        #include "../../Core/WinAPI/IncludeWindows.h"
    #endif
    #include <tbb/tbb_machine.h>        // (maybe includes <windows.h>?)

    namespace Utility { namespace Interlocked
    {
        typedef int32 Value;
        typedef int64 Value64;

        inline Value Exchange(Value volatile* target, Value newValue)               { return __sync_lock_test_and_set((volatile int*)target, (int)newValue); }
        inline Value64 Exchange64(Value64 volatile* target, Value64 newValue)       { return __sync_lock_test_and_set((volatile long long*)target, (long long)newValue); }
        inline void* ExchangePointer(void* volatile* target, void* newValue)        { return (void*)__sync_lock_test_and_set((volatile void*)target, (ptrdiff_t)newValue); }

        inline Value CompareExchange(Value volatile* target, Value newValue, Value comparisonValue)             { return __sync_val_compare_and_swap((int*)target, (int)newValue, (int)comparisonValue); }
        inline Value64 CompareExchange64(Value64 volatile* target, Value64 newValue, Value64 comparisonValue)   { return __sync_val_compare_and_swap((long long*)target, (long long)newValue, (long long)comparisonValue); }
        inline void* CompareExchangePointer(void* volatile* target, void* newValue, void* comparisonValue)      { return (void*)__sync_val_compare_and_swap((volatile void*)target, (ptrdiff_t)newValue, (ptrdiff_t)comparisonValue); }

        inline Value Increment(Value volatile* target)              { return __sync_fetch_and_add((int*)target, 1); }
        inline Value Decrement(Value volatile* target)              { return __sync_fetch_and_add((int*)target, (int)-1); }
        inline Value Add(Value volatile* target, Value addition)    { return __sync_fetch_and_add((int*)target, addition); }

        inline Value Load(Value volatile* target)
        {
            return *target;
            // return *tbb::internal::__TBB_load_full_fence(target);
        }

        inline Value64 Load64(Value64 volatile const* target)
        {
            return *target;
            // return *tbb::internal::__TBB_load_full_fence(target);
        }

        inline void* LoadPointer(void* volatile const* target)
        {
            return *target;
            // return *tbb::internal::__TBB_load_full_fence(target);
        }
    }}

#endif

namespace Utility
{
                /////////////////////////////////////////////////////////////////////////////

    class RefCountedObject
    {
    public:
            //
            //      The constructor for RefCountedObject initialises the reference count to 1.
            //      so:
            //          RefCountedObject* p = new Object();
            //          p->AddRef();
            //          p->Release();
            //          p->Release();
            //
            //      will not destroy the object until the second Release();
            //
            //      Also, when initialising a intrusive_ptr, remember to set the second parameter to false.
            //      Otherwise the intrusive_ptr constructor will add another reference.
            //      Eg:
            //          intrusive_ptr<Object> p(new Object, false);
            //
        signed AddRef() const;
        signed Release() const;
        signed GetRefCount() const;
        RefCountedObject();
        virtual ~RefCountedObject();
    private:
        mutable Interlocked::Value _refCount;
    };

                /////////////////////////////////////////////////////////////////////////////

    inline signed RefCountedObject::AddRef() const   { return Interlocked::Increment(&_refCount) + 1; }
    inline signed RefCountedObject::Release() const
    {
        auto oldRefCount = Interlocked::Decrement(&_refCount);
        if (oldRefCount==1) {
            delete this;        // destroy when we hit 0 ref counts
        }
        return oldRefCount-1;
    }
    inline signed RefCountedObject::GetRefCount() const   { return _refCount; }

    inline RefCountedObject::RefCountedObject() : _refCount(1) {}
    inline RefCountedObject::~RefCountedObject()    {}

}

using namespace Utility;

    /////////////////////////////////////////////////////////////////////////////
                //// Win32/64 API ////
#if PLATFORMOS_ACTIVE == PLATFORMOS_WINDOWS

    #if !defined(WINAPI)
        #define WINAPI      __stdcall
    #endif
    #if !defined(WINBASEAPI)
        #define DECLSPEC_IMPORT __declspec(dllimport)
        #define WINBASEAPI DECLSPEC_IMPORT
    #endif
    extern "C" WINBASEAPI int WINAPI   SwitchToThread();
    extern "C" WINBASEAPI void WINAPI  Sleep(unsigned long milliseconds);
    extern "C" WINBASEAPI unsigned long WINAPI GetCurrentThreadId();
    extern "C" void         _mm_pause(void);
    #pragma intrinsic(_mm_pause)

    namespace Utility { namespace Threading {
        inline void YieldTimeSlice()            { SwitchToThread(); }
        inline void Pause()                     { _mm_pause(); }
        inline void Sleep(uint32 milliseconds)  { ::Sleep(milliseconds); }
        inline unsigned CurrentThreadId()       { return ::GetCurrentThreadId(); }
    }}

#else

            //// Other / unsupported ////
    namespace Utility { namespace Threading {
        inline void YieldTimeSlice()            {}
        inline void Pause()                     {}
        inline void Sleep(uint32 milliseconds)  {}
        inline unsigned CurrentThreadId()       { return 0; }
    }}

#endif


text:
package org.gradle.caching.http.internal;

import org.gradle.caching.configuration.internal.BuildCacheServiceRegistration;
import org.gradle.caching.configuration.internal.DefaultBuildCacheServiceRegistration;
import org.gradle.caching.http.HttpBuildCache;
import org.gradle.internal.service.ServiceRegistration;
import org.gradle.internal.service.scopes.AbstractPluginServiceRegistry;

public class HttpBuildCacheServiceServices extends AbstractPluginServiceRegistry {

    public void registerBuildServices(ServiceRegistration registration) {
        registration.add(BuildCacheServiceRegistration.class, new DefaultBuildCacheServiceRegistration(HttpBuildCache.class, DefaultHttpBuildCacheServiceFactory.class));
    }
}


text:
// ---------------------------------------------------------------------------------------------------
// <copyright file="ApiClient.cs" company="Elephant Insurance Services, LLC">
//     Copyright (c) 2016 All Right Reserved
// </copyright>
// <author>Gurpreet Singh</author>
// <date>2016-01-21</date>
// <summary>
//     The ApiClient class
// </summary>
// ---------------------------------------------------------------------------------------------------

namespace Elephant.Hank.Framework.Services
{
    using System;
    using System.Collections.Generic;
    using System.Net;
    using System.Net.Http;
    using System.Net.Http.Headers;
    using System.Threading.Tasks;

    using Elephant.Hank.Common.LogService;
    using Elephant.Hank.Common.Services;
    using Elephant.Hank.Resources.Extensions;
    using Elephant.Hank.Resources.Messages;
    using Elephant.Hank.Resources.Models;

    using Newtonsoft.Json;
    using Newtonsoft.Json.Serialization;

    /// <summary>
    /// The ApiClient class
    /// </summary>
    public class ApiClient : IApiClient
    {
        /// <summary>
        /// The default content type.
        /// </summary>
        public const string DefaultContentType = "application/json";

        /// <summary>
        /// The logger logger service
        /// </summary>
        private readonly ILoggerService loggerService;

        /// <summary>
        /// Initializes a new instance of the <see cref="ApiClient" /> class.
        /// </summary>
        /// <param name="loggerService">The logger service.</param>
        public ApiClient(ILoggerService loggerService)
        {
            this.loggerService = loggerService;

            this.CustomHeaders = new List<NameValuePair>();
        }

        /// <summary>
        /// Gets or sets the base URL.
        /// </summary>
        public string BaseUrl { get; set; }

        /// <summary>
        /// Gets or sets the custom headers.
        /// </summary>
        public List<NameValuePair> CustomHeaders { get; set; }

        /// <summary>
        /// Gets the specified location.
        /// </summary>
        /// <typeparam name="T">Type of object</typeparam>
        /// <param name="location">The location.</param>
        /// <returns>
        /// Object of type T
        /// </returns>
        public async Task<ResultMessage<T>> Get<T>(string location)
        {
            var result = new ResultMessage<T>();

            using (HttpClient client = new HttpClient())
            {
                client.BaseAddress = new Uri(this.BaseUrl);
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(DefaultContentType));
                this.LoadAuthHeaders(client.DefaultRequestHeaders);

                try
                {
                    var response = await client.GetAsync(location);

                    if (response.StatusCode == HttpStatusCode.OK)
                    {
                        string errorMessage = null;
                        try
                        {
                            result.Item = await response.Content.ReadAsAsync<T>();
                        }
                        catch (Exception ex)
                        {
                            errorMessage = "Error: " + ex.Message;
                        }

                        if (errorMessage.IsNotBlank())
                        {
                            var testData = await response.Content.ReadAsStringAsync();
                            throw new Exception(errorMessage + " ErrorData: " + testData);
                        }
                    }
                    else
                    {
                        var testData = await response.Content.ReadAsStringAsync();
                        throw new Exception(response.StatusCode + " ErrorData: " + testData);
                    }
                }
                catch (Exception ex)
                {
                    this.loggerService.LogException(string.Format("{0}.{1}: Requested Uri: {2} - Failed with Exception. {3} ", this.GetType(), "Get", client.BaseAddress + location, ex.Message));
                    result.Messages.Add(new Message { Name = "Error", Value = "Please try again!" });
                }
            }

            return result;
        }

        /// <summary>
        /// Posts the specified location.
        /// </summary>
        /// <typeparam name="T">Type of object</typeparam>
        /// <typeparam name="Tin">The type of the in object.</typeparam>
        /// <param name="relativePath">The relative path.</param>
        /// <param name="data">The data.</param>
        /// <param name="contentType">content type</param>
        /// <param name="changeToPutReq">if set to <c>true</c> [change to put request].</param>
        /// <returns>
        /// Object of type T
        /// </returns>
        /// <exception cref="Exception">returns argument exception</exception>
        public async Task<ResultMessage<T>> Post<T, Tin>(string relativePath, Tin data, string contentType = null, bool changeToPutReq = false)
        {
            using (HttpClient client = new HttpClient())
            {
                string json = (data is string) ? data.ToString() : JsonConvert.SerializeObject(data, Formatting.Indented, new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() });

                HttpContent content = new StringContent(json);

                if (string.IsNullOrEmpty(contentType))
                {
                    contentType = DefaultContentType;
                }

                client.BaseAddress = new Uri(this.BaseUrl);
                content.Headers.ContentType = new MediaTypeHeaderValue(contentType);
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(contentType));

                this.LoadAuthHeaders(client.DefaultRequestHeaders);

                try
                {
                    var response = changeToPutReq ? await client.PutAsync(relativePath, content) : await client.PostAsync(relativePath, content);

                    var result = new ResultMessage<T>();

                    if (response.StatusCode == HttpStatusCode.Unauthorized)
                    {
                        result.Messages.Add(new Message("Unauthorized", "Unauthorized access!"));
                    }

                    string errorMessage = null;

                    try
                    {
                        if ((response.Headers.TransferEncoding + string.Empty).EqualsIgnoreCase("chunked"))
                        {
                            var pcResultAsStr = await response.Content.ReadAsStringAsync();

                            result.Item = JsonConvert.DeserializeObject<T>(pcResultAsStr);
                        }
                        else
                        {
                            result.Item = await response.Content.ReadAsAsync<T>();
                        }
                    }
                    catch (Exception ex)
                    {
                        errorMessage = "Error: " + ex.Message;
                    }

                    if (errorMessage.IsNotBlank())
                    {
                        var testData = await response.Content.ReadAsStringAsync();
                        throw new Exception(response.StatusCode + " " + errorMessage + " ErrorData: " + testData);
                    }

                    return result;
                }
                catch (Exception ex)
                {
                    this.loggerService.LogException(string.Format("{0}.{1}: Requested Uri: {2} - Failed with Exception. {3} ", this.GetType(), "Get", client.BaseAddress + relativePath, ex.Message));
                    return new ResultMessage<T>(new Message { Name = "Error", Value = "Please try again!" });
                }
            }
        }

        /// <summary>
        /// Loads the authentication headers.
        /// </summary>
        /// <param name="defaultHeaders">The default headers.</param>
        private void LoadAuthHeaders(HttpRequestHeaders defaultHeaders)
        {
            if (this.CustomHeaders != null)
            {
                foreach (var header in this.CustomHeaders)
                {
                    if (header.Name.IsNotBlank())
                    {
                        defaultHeaders.Add(header.Name, header.Value);
                    }
                }
            }
        }
    }
}


text:
layout: default
title: Learn Ruby on Rails as You Modify a Craigslist Clone
link: http://www.thinkful.com/learn/ruby-on-rails-tutorial/
categories: [ruby]
level: [beginner]
instruction: [online]
price: [free]
image: ruby-on-rails-craiglist-clone.png
---

In this interactive tutorial you're going to learn Ruby and Ruby on Rails fundamentals by modifying a Craigslist clone. You can view the source code on GitHub where you'll find a sample app to follow along. This guide was written by Aidan Feldman.


text:
package org.springframework.ldap.samples.useradmin.web;

import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ldap.samples.useradmin.domain.User;
import org.springframework.ldap.samples.useradmin.repo.DepartmentRepo;
import org.springframework.ldap.samples.useradmin.service.UserService;
import org.springframework.ldap.samples.useradmin.util.ExtJSReturn;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Lists;

/**
 * @author Mattias Hellborg Arthursson
 */
@Controller
public class UserController {
	private static final Logger	logger				= LoggerFactory.getLogger(UserController.class);
	private final AtomicInteger	nextEmployeeNumber	= new AtomicInteger(10);

	@Autowired
	private UserService			userService;

	@Autowired
	private DepartmentRepo		departmentRepo;

	@RequestMapping(value = { "/", "/users" }, method = GET)
	public String index(ModelMap map, @RequestParam(required = false) String name) {
		if (StringUtils.hasText(name)) {
			map.put("users", userService.searchByNameName(name));
		} else {
			map.put("users", userService.findAll());
		}
		return "listUsers";
	}

	@RequestMapping(value = "/api/user/users.json", params = { "apikey" }, method = RequestMethod.GET, produces = "application/json;charset=utf-8")
	public @ResponseBody Map<String, ? extends Object> userList(@RequestParam("apikey") String apikey) {
		long startTime = System.currentTimeMillis();
		logger.info("로깅합니다: userList1");
		try {
			List<User> user_list = Lists.newArrayList(userService.findAll());
			logger.info("name: {}", user_list.get(3).getFullName());
			return ExtJSReturn.mapOK(user_list, startTime);
		} catch (Exception e) {
			logger.info("로깅합니다: userList5");
			e.printStackTrace();
			return ExtJSReturn.mapError(e.getLocalizedMessage());
		}
	}

	@RequestMapping(value = "/users/{userid}", method = GET)
	public String getUser(@PathVariable String userid, ModelMap map) throws JsonProcessingException {
		map.put("user", userService.findUser(userid));
		populateDepartments(map);
		return "editUser";
	}

	@RequestMapping(value = "/newuser", method = GET)
	public String initNewUser(ModelMap map) throws JsonProcessingException {
		User user = new User();
		user.setEmployeeNumber(nextEmployeeNumber.getAndIncrement());

		map.put("new", true);
		map.put("user", user);
		populateDepartments(map);

		return "editUser";
	}

	private void populateDepartments(ModelMap map) throws JsonProcessingException {
		Map<String, List<String>> departmentMap = departmentRepo.getDepartmentMap();
		ObjectMapper objectMapper = new ObjectMapper();
		String departmentsAsJson = objectMapper.writeValueAsString(departmentMap);
		map.put("departments", departmentsAsJson);
	}

	@RequestMapping(value = "/newuser", method = POST)
	public String createUser(User user) throws UnsupportedEncodingException {
		User savedUser = userService.createUser(user);
		logger.info("저장된 사용자: {}", savedUser.getFullName());
		return "redirect:/users/" + URLEncoder.encode(savedUser.getId().toString(), "UTF-8");
	}

	@RequestMapping(value = "/users/{userid}", method = POST)
	public String updateUser(@PathVariable String userid, User user) throws UnsupportedEncodingException {
		User savedUser = userService.updateUser(userid, user);

		return "redirect:/users/" + URLEncoder.encode(savedUser.getId().toString(), "UTF-8");
	}
}


text:
static CGFloat kVKImageBubbleMaxSize = 230;

@implementation VKImageBubbleViewProperties

- (instancetype) initWithEdgeInsets:(UIEdgeInsets)edgeInsets maxSize:(CGFloat) maxSize {
    self = [super initWithEdgeInsets:edgeInsets];
    if (self) {
        _maxSize = maxSize;
    }
    return self;
}

- (instancetype) init {
    self = [super init];
    if (self) {
        _maxSize = kVKImageBubbleMaxSize;
    }
    return self;
}

@end


text:
// TODO VM_EXEC flag work-around, cache aliasing

#include <linux/mm.h>
#include <linux/module.h>
#include <asm/mmu_context.h>
#include <asm/cacheflush.h>
#include <asm/hardirq.h>
#include <asm/uaccess.h>
#include <asm/system.h>
#include <asm/pgalloc.h>

unsigned long asid_cache = ASID_FIRST_VERSION;
void bad_page_fault(struct pt_regs*, unsigned long, int);

/*
 * This routine handles page faults.  It determines the address,
 * and the problem, and then passes it off to one of the appropriate
 * routines.
 *
 * Note: does not handle Miss and MultiHit.
 */

void do_page_fault(struct pt_regs *regs)
{
	struct vm_area_struct * vma;
	struct mm_struct *mm = current->mm;
	unsigned int exccause = regs->exccause;
	unsigned int address = regs->excvaddr;
	siginfo_t info;

	int is_write, is_exec;

	info.si_code = SEGV_MAPERR;

	/* We fault-in kernel-space virtual memory on-demand. The
	 * 'reference' page table is init_mm.pgd.
	 */
	if (address >= TASK_SIZE && !user_mode(regs))
		goto vmalloc_fault;

	/* If we're in an interrupt or have no user
	 * context, we must not take the fault..
	 */
	if (in_atomic() || !mm) {
		bad_page_fault(regs, address, SIGSEGV);
		return;
	}

	is_write = (exccause == XCHAL_EXCCAUSE_STORE_CACHE_ATTRIBUTE) ? 1 : 0;
	is_exec =  (exccause == XCHAL_EXCCAUSE_ITLB_PRIVILEGE ||
		    exccause == XCHAL_EXCCAUSE_ITLB_MISS ||
		    exccause == XCHAL_EXCCAUSE_FETCH_CACHE_ATTRIBUTE) ? 1 : 0;

#if 0
	printk("[%s:%d:%08x:%d:%08x:%s%s]\n", current->comm, current->pid,
	       address, exccause, regs->pc, is_write? "w":"", is_exec? "x":"");
#endif

	down_read(&mm->mmap_sem);
	vma = find_vma(mm, address);

	if (!vma)
		goto bad_area;
	if (vma->vm_start <= address)
		goto good_area;
	if (!(vma->vm_flags & VM_GROWSDOWN))
		goto bad_area;
	if (expand_stack(vma, address))
		goto bad_area;

	/* Ok, we have a good vm_area for this memory access, so
	 * we can handle it..
	 */

good_area:
	info.si_code = SEGV_ACCERR;

	if (is_write) {
		if (!(vma->vm_flags & VM_WRITE))
			goto bad_area;
	} else if (is_exec) {
		if (!(vma->vm_flags & VM_EXEC))
			goto bad_area;
	} else	/* Allow read even from write-only pages. */
		if (!(vma->vm_flags & (VM_READ | VM_WRITE)))
			goto bad_area;

	/* If for any reason at all we couldn't handle the fault,
	 * make sure we exit gracefully rather than endlessly redo
	 * the fault.
	 */
survive:
	switch (handle_mm_fault(mm, vma, address, is_write)) {
	case VM_FAULT_MINOR:
		current->min_flt++;
		break;
	case VM_FAULT_MAJOR:
		current->maj_flt++;
		break;
	case VM_FAULT_SIGBUS:
		goto do_sigbus;
	case VM_FAULT_OOM:
		goto out_of_memory;
	default:
		BUG();
	}

	up_read(&mm->mmap_sem);
	return;

	/* Something tried to access memory that isn't in our memory map..
	 * Fix it, but check if it's kernel or user first..
	 */
bad_area:
	up_read(&mm->mmap_sem);
	if (user_mode(regs)) {
		current->thread.bad_vaddr = address;
		current->thread.error_code = is_write;
		info.si_signo = SIGSEGV;
		info.si_errno = 0;
		/* info.si_code has been set above */
		info.si_addr = (void *) address;
		force_sig_info(SIGSEGV, &info, current);
		return;
	}
	bad_page_fault(regs, address, SIGSEGV);
	return;

	/* We ran out of memory, or some other thing happened to us that made
	 * us unable to handle the page fault gracefully.
	 */
out_of_memory:
	up_read(&mm->mmap_sem);
	if (current->pid == 1) {
		yield();
		down_read(&mm->mmap_sem);
		goto survive;
	}
	printk("VM: killing process %s\n", current->comm);
	if (user_mode(regs))
		do_exit(SIGKILL);
	bad_page_fault(regs, address, SIGKILL);
	return;

do_sigbus:
	up_read(&mm->mmap_sem);

	/* Send a sigbus, regardless of whether we were in kernel
	 * or user mode.
	 */
	current->thread.bad_vaddr = address;
	info.si_code = SIGBUS;
	info.si_errno = 0;
	info.si_code = BUS_ADRERR;
	info.si_addr = (void *) address;
	force_sig_info(SIGBUS, &info, current);

	/* Kernel mode? Handle exceptions or die */
	if (!user_mode(regs))
		bad_page_fault(regs, address, SIGBUS);

vmalloc_fault:
	{
		/* Synchronize this task's top level page-table
		 * with the 'reference' page table.
		 */
		struct mm_struct *act_mm = current->active_mm;
		int index = pgd_index(address);
		pgd_t *pgd, *pgd_k;
		pmd_t *pmd, *pmd_k;
		pte_t *pte_k;

		if (act_mm == NULL)
			goto bad_page_fault;

		pgd = act_mm->pgd + index;
		pgd_k = init_mm.pgd + index;

		if (!pgd_present(*pgd_k))
			goto bad_page_fault;

		pgd_val(*pgd) = pgd_val(*pgd_k);

		pmd = pmd_offset(pgd, address);
		pmd_k = pmd_offset(pgd_k, address);
		if (!pmd_present(*pmd) || !pmd_present(*pmd_k))
			goto bad_page_fault;

		pmd_val(*pmd) = pmd_val(*pmd_k);
		pte_k = pte_offset_kernel(pmd_k, address);

		if (!pte_present(*pte_k))
			goto bad_page_fault;
		return;
	}
bad_page_fault:
	bad_page_fault(regs, address, SIGKILL);
	return;
}

void
bad_page_fault(struct pt_regs *regs, unsigned long address, int sig)
{
	extern void die(const char*, struct pt_regs*, long);
	const struct exception_table_entry *entry;

	/* Are we prepared to handle this kernel fault?  */
	if ((entry = search_exception_tables(regs->pc)) != NULL) {
#if 1
		printk(KERN_DEBUG "%s: Exception at pc=%#010lx (%lx)\n",
				current->comm, regs->pc, entry->fixup);
#endif
		current->thread.bad_uaddr = address;
		regs->pc = entry->fixup;
		return;
	}

	/* Oops. The kernel tried to access some bad page. We'll have to
	 * terminate things with extreme prejudice.
	 */
	printk(KERN_ALERT "Unable to handle kernel paging request at virtual "
	       "address %08lx\n pc = %08lx, ra = %08lx\n",
	       address, regs->pc, regs->areg[0]);
	die("Oops", regs, sig);
	do_exit(sig);
}


text:
<title>OGRE: Ogre::LogListener Class Reference - OGRE Documentation</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link type="text/css" rel="stylesheet" href="doxygen.css">
<link type="text/css" rel="stylesheet" href="tabs.css">

Main Page

Related Pages

Modules

Namespaces

Classes

Files

Directories

Class List

Class Index

Class Hierarchy

Class Members

Ogre::LogListener

Ogre::LogListener Class Reference

[General]

#include <OgreLog.h>

List of all members.

Public Member Functions

virtual 	~LogListener ()

virtual void 	messageLogged (const String &message, LogMessageLevel lml, bool maskDebug, const String &logName, bool &skipThisMessage)=0

Detailed Description

Remarks:

Pure Abstract class, derive this class and register to the Log to listen to log messages

Definition at line 72 of file OgreLog.h.

Constructor & Destructor Documentation

          virtual Ogre::LogListener::~LogListener
          (

           )
           [virtual]

Definition at line 75 of file OgreLog.h.

Member Function Documentation

          virtual void Ogre::LogListener::messageLogged
          (
          const String &
           message,

          LogMessageLevel
           lml,

          bool
           maskDebug,

          const String &
           logName,

          bool &
           skipThisMessage

          )
          		 [pure virtual]

Remarks:

This is called whenever the log receives a message and is about to write it out

Parameters:

	message 	The message to be logged

	lml 	The message level the log is using

	maskDebug 	If we are printing to the console or not

	logName 	The name of this log (so you can have several listeners for different logs, and identify them)

	skipThisMessage 	If set to true by the messageLogged() implementation message will not be logged

The documentation for this class was generated from the following file:

OgreLog.h

Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

Last modified Sun Sep 2 08:18:00 2012


text:
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);

var pg = require('pg');
var conString = "postgres://postgres:1234@localhost/smsdb";

var bodyParser = require('body-parser')
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
    extended: true
}));

app.get('/', function(req, res) {
    res.sendFile(__dirname + '/index.html');
});

//app.get('/new', function(req, res) {
//    var client = new pg.Client(conString);
//    client.connect(function(err) {
//        if(err) {
//            return console.error('could not connect to postgres', err);
//        }
//        client.query('SELECT * from raw_conversation order by timestamp_local desc limit 1', function(err, result) {
//            if(err) {
//                return console.error('error running query 2', err);
//            }
//            return result.rows[0].sms_content;
//
//            client.end();
//        });
//    });
//    res.send('finished');
//});

app.get('/new', function (res, res) {
  var client = new pg.Client(conString);
  client.connect(function(err){
      if (err){
          return console.error('could not connect to postgres',err);
      }
      client.query('select request_id, phone_number, sms_content from raw_conversation where is_sent = false order by timestamp_local desc',function(err,result){
          if (err){
              return console.error('error running query',err);
          }
          res.writeHead(200,{"Content-Type":'application/json'});

          if (result.rows[0] !== undefined) {
              var output = JSON.stringify({"payload":{"task": "send","secret": "secret_key","messages":[{"to": result.rows[0].phone_number.toString(),"message": result.rows[0].sms_content, "uuid": "aada21b0-0615-4957-bcb3"}]}});
              console.log(output);
              res.end(output);

              client.query('update raw_conversation set is_sent = true where request_id = ' + result.rows[0].request_id, function(err,result) {
              });
          }
          else {
              res.end('');
          }
      });
  });
});

var query_insert;
var message;

app.post('/new', function(req, res) {
    message = req.body.message;
    query_insert = '\'' + req.body.from + '\',' + 'to_timestamp(' + req.body.sent_timestamp/1000 + '),\'' + req.body.message + '\'';
    //console.log(query_insert);

    console.log(message);
    var client = new pg.Client(conString);
    client.connect(function(err, req) {
        if(err) {
            return console.error('could not connect to postgres', err);
        }

        var query_check = 'SELECT COUNT(*) FROM raw_conversation WHERE is_sent = true and sms_content = \'' + message + '\'';

        client.query(query_check, function(err, result) {
            if(err) {
                return console.error('error running query check', err);
            }

            console.log(result.rows[0].count);
            if (result.rows[0].count < 1) {
                console.log('in the if!');

                io.emit('chat message', message);
        //query_complete = 'INSERT INTO raw_conversation(\"from\", \"to\", phone_number, timestamp_local, sms_content, is_sent) SELECT \'Victim1\',\'Volunteer1\',' + query_insert + ', true WHERE \'' + message + '\' NOT IN (SELECT sms_content from raw_conversation)';

                query_complete = 'INSERT INTO raw_conversation(\"from\", \"to\", phone_number, timestamp_local, sms_content, is_sent) SELECT \'Victim1\',\'Volunteer1\',' + query_insert + ', true';

                console.log(query_complete);
                client.query(query_complete, function(err, result) {
                    if(err) {
                        return console.error('error 1 running insert query', err);
                    }
                    res.writeHead(200,{"Content-Type":'application/json'});
                    res.end("success");
                    client.end();
                });
            }
        });
    });
});

io.on('connection', function(socket) {
    socket.on('chat message', function(msg) {
        io.emit('chat message', msg);
        var client = new pg.Client(conString);
        client.connect(function(err, req) {
            if(err) {
                return console.error('could not connect to postgres', err);
            }
            query_insert = 'INSERT INTO raw_conversation VALUES (\'Volunteer1\',\'Victim1\', \'+6596837238\', NOW(),\'' + msg + '\', false)';
            console.log(query_insert);

            client.query(query_insert, function(err, result) {
                if(err) {
                    return console.error('error running insert query', err);
                }
                client.end();
            });
        });
    });
});

io.emit('some event', {for: 'everyone'});

http.listen(3000, function() {
    console.log('listening on http://52.74.179.57:3000');
});