text:
extern crate dns_lookup;
#[macro_use]
extern crate lazy_static;
extern crate params;
#[cfg(feature = "pg")]
extern crate postgres;
extern crate regex;
extern crate serde_json;
extern crate url;

use params::{Map, Value};
use std::collections::BTreeMap;

mod validators {
    pub mod accepted;
    pub mod active_url;
    pub mod alpha;
    pub mod alpha_dash;
    pub mod alpha_numeric;
    pub mod array;
    pub mod between;
    pub mod boolean;
    pub mod confirmed;
    pub mod different;
    pub mod digits;
    pub mod digits_between;
    pub mod distinct;
    pub mod email;
    #[cfg(feature = "pg")]
    pub mod exists;
    pub mod filled;
    pub mod in_const;
    pub mod in_array;
    pub mod integer;
    pub mod ip_address;
    pub mod json;
    pub mod max;
    pub mod min;
    pub mod not_in;
    pub mod not_in_array;
    pub mod numeric;
    pub mod present;
    pub mod regex;
    pub mod required;
    pub mod required_if;
    pub mod required_unless;
    pub mod required_with;
    pub mod required_with_all;
    pub mod required_without;
    pub mod required_without_all;
    pub mod same;
    pub mod size;
    pub mod string;
    #[cfg(feature = "pg")]
    pub mod unique;
    pub mod url;
}

#[derive(Debug,Clone)]
pub enum Rule<'a> {
    /// The field under validation must be `yes`, `on`, `1`, or `true`.
    /// This is useful for validating "Terms of Service" acceptance.
    ///
    /// On success, will transform the input to a boolean `true`.
    Accepted,
    /// The field under validation, if present, must be an active domain name.
    ActiveUrl,
    /// The field under validation must be entirely alphabetic characters.
    ///
    /// This validator accepts Latin and international (Unicode) input.
    Alpha,
    /// The field under validation may have alpha-numeric characters,
    /// as well as dashes and underscores.
    ///
    /// This validator accepts Latin and international (Unicode) input.
    AlphaDash,
    /// The field under validation must be entirely alpha-numeric characters.
    ///
    /// This validator accepts Latin and international (Unicode) input.
    AlphaNumeric,
    /// The field under validation, if present, must be an array.
    Array,
    /// The field under validation, if present, must have a size between the given min and max.
    /// Strings, numerics, and files are evaluated in the same fashion as the `Size` rule.
    Between(isize, isize),
    /// The field under validation, if present, must be able to be cast as a boolean.
    /// Accepted input are `true`, `false`, `1`, `0`, `"1"`, and `"0"`.
    ///
    /// On success, will transform the input to a boolean `true` or `false`.
    Boolean,
    /// The field under validation must have a matching field of `foo_confirmation`.
    /// For example, if the field under validation is `password`,
    /// a matching `password_confirmation` field must be present in the input.
    Confirmed,
    /// The field under validation must have a different value than `field`.
    Different(&'static str),
    /// The field under validation, if present,
    /// must be numeric and must have an exact length of value.
    ///
    /// For negative numbers, the negative sign is not counted as a digit.
    /// For floating point numbers, the number of digits preceeding the decimal place
    /// is counted.
    ///
    /// On success, will transform string input to a numeric type.
    Digits(usize),
    /// The field under validation, if present, must have a length between the given min and max.
    ///
    /// On success, will transform string input to a numeric type.
    DigitsBetween(usize, usize),
    /// When working with arrays, the field under validation must not have any duplicate values
    /// if it is present.
    Distinct,
    /// The field under validation, if present, must be formatted as an e-mail address.
    Email,
    #[cfg(feature = "pg")]
    /// The field under validation must exist in the given table.
    /// A column name may be specified; otherwise, the name of the field is used.
    Exists(&'a postgres::Connection, &'static str, Option<&'static str>),
    /// The field under validation must not be empty when it is present.
    Filled,
    /// The field under validation, if present, must be included in the given list of values.
    In(Vec<Value>),
    /// The field under validation, if present, must exist in `anotherfield`'s values.
    InArray(&'static str),
    /// The field under validation, if present, must be an integer.
    ///
    /// On success, will transform string input to a numeric type.
    Integer,
    /// The field under validation, if present, must be an IP address.
    ///
    /// Accepts both IPv4 and IPv6 addresses.
    IpAddress,
    /// The field under validation, if present, must be a valid JSON string.
    Json,
    /// The field under validation, if present, must be less than or equal to a maximum value.
    /// Strings, numerics, and files are evaluated in the same fashion as the `Size` rule.
    Max(isize),
    /// The field under validation, if present, must have a minimum value.
    /// Strings, numerics, and files are evaluated in the same fashion as the `Size` rule.
    Min(isize),
    /// The field under validation must not be included in the given list of values.
    NotIn(Vec<Value>),
    /// The field under validation must not exist in `anotherfield`'s values.
    NotInArray(&'static str),
    /// The field under validation, if present, must be numeric.
    ///
    /// On success, will transform string input to a numeric type.
    Numeric,
    /// The field under validation must be present in the input data but can be empty.
    Present,
    /// The field under validation, if present, must match the given regular expression.
    ///
    /// On success, will transform input to a string.
    Regex(&'static str),
    /// The field under validation must be present in the input data and not empty.
    /// A field is considered "empty" if one of the following conditions are true:
    ///
    /// The value is null.
    ///
    /// The value is an empty string.
    ///
    /// The value is an empty array or empty object.
    Required,
    /// The field under validation must be present if the `anotherfield` field
    /// is equal to any `value`.
    RequiredIf(&'static str, Value),
    /// The field under validation must be present unless the `anotherfield` field
    /// is equal to any `value`.
    RequiredUnless(&'static str, Value),
    /// The field under validation must be present only if
    /// any of the other specified fields are present.
    RequiredWith(Vec<&'static str>),
    /// The field under validation must be present only if
    /// all of the other specified fields are present.
    RequiredWithAll(Vec<&'static str>),
    /// The field under validation must be present only when
    /// any of the other specified fields are not present.
    RequiredWithout(Vec<&'static str>),
    /// The field under validation must be present only when
    /// all of the other specified fields are not present.
    RequiredWithoutAll(Vec<&'static str>),
    /// The given field must match the field under validation.
    Same(&'static str),
    /// The field under validation must have a size matching the given value.
    ///
    /// For string data, value corresponds to the number of characters.
    ///
    /// For numeric data, value corresponds to a given integer value.
    ///
    /// For files, size corresponds to the file size in kilobytes.
    Size(isize),
    /// The field under validation, if present, must be a string.
    String,
    #[cfg(feature = "pg")]
    /// The field under validation must not exist in the given table.
    /// A column name may be specified; otherwise, the name of the field is used.
    Unique(&'a postgres::Connection, &'static str, Option<&'static str>),
    /// The field under validation, if present, must be formatted as a valid URL,
    /// but does not need to resolve to a real website. The URL must contain the scheme
    /// or else it will fail validation. For example, `http://google.com` will
    /// pass validation, but `google.com` will fail validation.
    Url,
    #[doc(hidden)]
    #[cfg(not(feature = "pg"))]
    Phantom(&'a std::marker::PhantomData<u8>),
}

/// Validate a map of `values` against a map of `rules`.
///
/// Returns a `Result` containing a map of post-processed `values`,
/// or a map of validation error messages.
pub fn validate(rules: &BTreeMap<&'static str, Vec<Rule>>,
                values: Map)
                -> Result<Map, BTreeMap<&'static str, Vec<String>>> {
    let mut new_values = values;
    let mut errors = BTreeMap::new();

    for (field, ruleset) in rules {
        let array_field = field.split('.').collect::<Vec<&str>>();
        let mut current_errors = Vec::new();
        for rule in ruleset {
            let result = match *rule {
                Rule::Accepted => {
                    validators::accepted::validate_accepted(&new_values, &array_field)
                }
                Rule::ActiveUrl => {
                    validators::active_url::validate_active_url(&new_values, &array_field)
                }
                Rule::Alpha => validators::alpha::validate_alpha(&new_values, &array_field),
                Rule::AlphaDash => {
                    validators::alpha_dash::validate_alpha_dash(&new_values, &array_field)
                }
                Rule::AlphaNumeric => {
                    validators::alpha_numeric::validate_alpha_numeric(&new_values, &array_field)
                }
                Rule::Array => validators::array::validate_array(&new_values, &array_field),
                Rule::Between(min, max) => {
                    validators::between::validate_between(&new_values, &array_field, min, max)
                }
                Rule::Boolean => validators::boolean::validate_boolean(&new_values, &array_field),
                Rule::Confirmed => {
                    validators::confirmed::validate_confirmed(&new_values, &array_field)
                }
                Rule::Different(other) => {
                    let other = other.split('.').collect::<Vec<&str>>();
                    validators::different::validate_different(&new_values, &array_field, &other)
                }
                Rule::Digits(digits) => {
                    validators::digits::validate_digits(&new_values, &array_field, digits)
                }
                Rule::DigitsBetween(min, max) => {
                    validators::digits_between::validate_digits_between(&new_values,
                                                                        &array_field,
                                                                        min,
                                                                        max)
                }
                Rule::Distinct => {
                    validators::distinct::validate_distinct(&new_values, &array_field)
                }
                Rule::Email => validators::email::validate_email(&new_values, &array_field),
                #[cfg(feature = "pg")]
                Rule::Exists(conn, table, column) => {
                    validators::exists::validate_exists(conn,
                                                        &new_values,
                                                        &array_field,
                                                        table,
                                                        column)
                }
                Rule::Filled => validators::filled::validate_filled(&new_values, &array_field),
                Rule::In(ref options) => {
                    validators::in_const::validate_in(&new_values, &array_field, options)
                }
                Rule::InArray(other) => {
                    let other = other.split('.').collect::<Vec<&str>>();
                    validators::in_array::validate_in_array(&new_values, &array_field, &other)
                }
                Rule::Integer => validators::integer::validate_integer(&new_values, &array_field),
                Rule::IpAddress => {
                    validators::ip_address::validate_ip_address(&new_values, &array_field)
                }
                Rule::Json => validators::json::validate_json(&new_values, &array_field),
                Rule::Max(target) => {
                    validators::max::validate_max(&new_values, &array_field, target)
                }
                Rule::Min(target) => {
                    validators::min::validate_min(&new_values, &array_field, target)
                }
                Rule::NotIn(ref options) => {
                    validators::not_in::validate_not_in(&new_values, &array_field, options)
                }
                Rule::NotInArray(other) => {
                    let other = other.split('.').collect::<Vec<&str>>();
                    validators::not_in_array::validate_not_in_array(&new_values,
                                                                    &array_field,
                                                                    &other)
                }
                Rule::Numeric => validators::numeric::validate_numeric(&new_values, &array_field),
                Rule::Present => validators::present::validate_present(&new_values, &array_field),
                Rule::Regex(pattern) => {
                    validators::regex::validate_regex(&new_values, &array_field, pattern)
                }
                Rule::Required => {
                    validators::required::validate_required(&new_values, &array_field)
                }
                Rule::RequiredIf(other, ref condition) => {
                    let other = other.split('.').collect::<Vec<&str>>();
                    validators::required_if::validate_required_if(&new_values,
                                                                  &array_field,
                                                                  &other,
                                                                  condition)
                }
                Rule::RequiredUnless(other, ref condition) => {
                    let other = other.split('.').collect::<Vec<&str>>();
                    validators::required_unless::validate_required_unless(&new_values,
                                                                          &array_field,
                                                                          &other,
                                                                          condition)
                }
                Rule::RequiredWith(ref others) => {
                    let others = others.iter()
                        .map(|o| o.split('.').collect::<Vec<&str>>())
                        .collect::<Vec<Vec<&str>>>();
                    validators::required_with::validate_required_with(&new_values,
                                                                      &array_field,
                                                                      &others)
                }
                Rule::RequiredWithAll(ref others) => {
                    let others = others.iter()
                        .map(|o| o.split('.').collect::<Vec<&str>>())
                        .collect::<Vec<Vec<&str>>>();
                    validators::required_with_all::validate_required_with_all(&new_values,
                                                                              &array_field,
                                                                              &others)
                }
                Rule::RequiredWithout(ref others) => {
                    let others = others.iter()
                        .map(|o| o.split('.').collect::<Vec<&str>>())
                        .collect::<Vec<Vec<&str>>>();
                    validators::required_without::validate_required_without(&new_values,
                                                                            &array_field,
                                                                            &others)
                }
                Rule::RequiredWithoutAll(ref others) => {
                    let others = others.iter()
                        .map(|o| o.split('.').collect::<Vec<&str>>())
                        .collect::<Vec<Vec<&str>>>();
                    validators::required_without_all::validate_required_without_all(&new_values,
                                                                                &array_field,
                                                                                &others)
                }
                Rule::Same(other) => {
                    let other = other.split('.').collect::<Vec<&str>>();
                    validators::same::validate_same(&new_values, &array_field, &other)
                }
                Rule::Size(target) => {
                    validators::size::validate_size(&new_values, &array_field, target)
                }
                Rule::String => validators::string::validate_string(&new_values, &array_field),
                #[cfg(feature = "pg")]
                Rule::Unique(conn, table, column) => {
                    validators::unique::validate_unique(conn,
                                                        &new_values,
                                                        &array_field,
                                                        table,
                                                        column)
                }
                Rule::Url => validators::url::validate_url(&new_values, &array_field),
                #[cfg(not(feature = "pg"))]
                Rule::Phantom(_) => unimplemented!(),
            };
            match result {
                Ok(Some(res)) => {
                    new_values.assign(&array_field.iter()
                                           .enumerate()
                                           .map(|(i, x)| if i == 0 {
                                                    x.to_string()
                                                } else {
                                                    format!("[{}]", x)
                                                })
                                           .collect::<String>(),
                                      res)
                        .ok();
                }
                Ok(None) => (),
                Err(err) => {
                    current_errors.push(err);
                }
            };
        }
        if !current_errors.is_empty() {
            errors.insert(*field, current_errors);
        }
    }

    if errors.is_empty() {
        Ok(new_values)
    } else {
        Err(errors)
    }
}


text:
package ua.com.fielden.platform.example.swing.components.autocompleter;

/**
 * This an enumeration for autocompleter demonstration purposes.
 *
 * @author TG Team
 *
 */
public enum DemoEnum {
    A_VALUE1("value A one"),
    A_VALUE2("value A two"),
    A_VALUE3("value A tree"),
    B_VALUE1("value B one"),
    B_VALUE2("value B two"),
    B_VALUE3("value B tree"),
    C_VALUE1("value C one"),
    C_VALUE2("value C two"),
    C_VALUE3("value C three"),
    D_VALUE1("value D one"),
    D_VALUE2("value D two"),
    D_VALUE3("value D three");

    final String desc;

    DemoEnum(final String desc) {
        this.desc = desc;
    }

    @Override
    public String toString() {
        return desc;
    }
}

redpajama_set_name: RedPajamaGithub


text:
if [ ! -f ../output/Debug/jemallocfix.so ]
then
  # jemallocfix for firefox 10+
  echo -e "#include<stdlib.h>\nsize_t je_malloc_usable_size_in_advance(size_t n){ return n; }\nvoid * moz_xrealloc(void *ptr, size_t size) { return realloc(ptr, size); }" | gcc -xc -fPIC --shared - -o ../output/Debug/jemallocfix.so
  strip ../output/Debug/jemallocfix.so
fi


text:
define(function(require) {
    var a = require('a'),
        c = require('c'),
        e = require('d/e');
    return function() {};
});


text:
package generated.zcsclient.admin;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for xmppComponentSpec complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="xmppComponentSpec">
 *   <complexContent>
 *     <extension base="{urn:zimbraAdmin}adminAttrsImpl">
 *       <sequence>
 *         <element name="domain" type="{urn:zimbraAdmin}domainSelector"/>
 *         <element name="server" type="{urn:zimbraAdmin}serverSelector"/>
 *       </sequence>
 *       <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
 *     </extension>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "xmppComponentSpec", propOrder = {
    "domain",
    "server"
})
public class testXmppComponentSpec
    extends testAdminAttrsImpl
{

    @XmlElement(required = true)
    protected testDomainSelector domain;
    @XmlElement(required = true)
    protected testServerSelector server;
    @XmlAttribute(name = "name", required = true)
    protected String name;

    /**
     * Gets the value of the domain property.
     *
     * @return
     *     possible object is
     *     {@link testDomainSelector }
     *
     */
    public testDomainSelector getDomain() {
        return domain;
    }

    /**
     * Sets the value of the domain property.
     *
     * @param value
     *     allowed object is
     *     {@link testDomainSelector }
     *
     */
    public void setDomain(testDomainSelector value) {
        this.domain = value;
    }

    /**
     * Gets the value of the server property.
     *
     * @return
     *     possible object is
     *     {@link testServerSelector }
     *
     */
    public testServerSelector getServer() {
        return server;
    }

    /**
     * Sets the value of the server property.
     *
     * @param value
     *     allowed object is
     *     {@link testServerSelector }
     *
     */
    public void setServer(testServerSelector value) {
        this.server = value;
    }

    /**
     * Gets the value of the name property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the value of the name property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setName(String value) {
        this.name = value;
    }

}


text:
[T4Scaffolding.Scaffolder(Description = "Makes an EF DbContext able to persist models of a given type, creating the DbContext first if necessary")][CmdletBinding()]
param(
	[parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string]$ModelType,
	[parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string]$DbContextType,
	[string]$Area,
    [string]$Project,
	[string]$CodeLanguage,
	[string[]]$TemplateFolders
)

# Ensure we can find the model type
$foundModelType = Get-ProjectType $ModelType -Project $Project
if (!$foundModelType) { return }

# Find the DbContext class, or create it via a template if not already present
$foundDbContextType = Get-ProjectType $DbContextType -Project $Project -AllowMultiple
if (!$foundDbContextType) {
	# Determine where the DbContext class will go
	$defaultNamespace = (Get-Project $Project).Properties.Item("DefaultNamespace").Value
	if ($DbContextType.Contains(".")) {
		if ($DbContextType.StartsWith($defaultNamespace + ".", [System.StringComparison]::OrdinalIgnoreCase)) {
			$DbContextType = $DbContextType.Substring($defaultNamespace.Length + 1)
		}
		$outputPath = $DbContextType.Replace(".", [System.IO.Path]::DirectorySeparatorChar)
		$DbContextType = [System.IO.Path]::GetFileName($outputPath)
	} else {
		$outputPath = Join-Path Models $DbContextType
		if ($Area) {
			$areaFolder = Join-Path Areas $Area
			if (-not (Get-ProjectItem $areaFolder -Project $Project)) {
				Write-Error "Cannot find area '$Area'. Make sure it exists already."
				return
			}
			$outputPath = Join-Path $areaFolder $outputPath
		}
	}

	$dbContextNamespace = [T4Scaffolding.Namespaces]::Normalize($defaultNamespace + "." + [System.IO.Path]::GetDirectoryName($outputPath).Replace([System.IO.Path]::DirectorySeparatorChar, "."))
	Add-ProjectItemViaTemplate $outputPath -Template DbContext -Model @{
		DefaultNamespace = $defaultNamespace;
		DbContextNamespace = $dbContextNamespace;
		DbContextType = $DbContextType;
	} -SuccessMessage "Added database context '{0}'" -TemplateFolders $TemplateFolders -Project $Project -CodeLanguage $CodeLanguage -Force:$Force

	$foundDbContextType = Get-ProjectType ($dbContextNamespace + "." + $DbContextType) -Project $Project
	if (!$foundDbContextType) { throw "Created database context $DbContextType, but could not find it as a project item" }
} elseif (($foundDbContextType | Measure-Object).Count -gt 1) {
	throw "Cannot find the database context class, because more than one type is called $DbContextType. Try specifying the fully-qualified type name, including namespace."
}

# Add a new property on the DbContext class
if ($foundDbContextType) {
	$propertyName = Get-PluralizedWord $foundModelType.Name

	# If this is not a DbContext, we can't add a new property, so ensure there is already one
	# Unfortunately we have to use the awkward "PowerShellInvoke" calling mechanism otherwise
	# the PowerShell COM wrapper objects can't be passed into the .NET code.
	$isAssignableToParamTypes = New-Object System.Type[] 2
	$isAssignableToParamTypes[0] = [EnvDTE.CodeType]
	$isAssignableToParamTypes[1] = [System.String]
	$isDbContext = [T4Scaffolding.Core.EnvDTE.EnvDTEExtensions]::PowerShellInvoke([T4Scaffolding.Core.EnvDTE.EnvDTEExtensions].GetMethod("IsAssignableTo", $isAssignableToParamTypes), $null, @($foundDbContextType, "System.Data.Entity.DbContext"))
	if (!$isDbContext) {
		$existingMembers = [T4Scaffolding.Core.EnvDTE.EnvDTEExtensions]::PowerShellInvoke([T4Scaffolding.Core.EnvDTE.EnvDTEExtensions].GetMethod("VisibleMembers"), $null, $foundDbContextType)
		$hasExistingPropertyForModel = $existingMembers | ?{ ($_.Name -eq $propertyName) -and ($_.Kind -eq [EnvDTE.vsCMElement]::vsCMElementProperty) }
		if ($hasExistingPropertyForModel) {
			Write-Warning "$($foundDbContextType.Name) already contains a '$propertyName' property."
		} else {
			throw "$($foundDbContextType.FullName) is not a System.Data.Entity.DbContext class and does not contain a '$propertyName' property, so it cannot be used as the database context."
		}
	} else {
		# This *is* a DbContext, so we can freely add a new property if there isn't already one for this model
		Add-ClassMemberViaTemplate -Name $propertyName -CodeClass $foundDbContextType -Template DbContextEntityMember -Model @{
			EntityType = $foundModelType;
			EntityTypeNamePluralized = $propertyName;
		} -SuccessMessage "Added '$propertyName' to database context '$($foundDbContextType.FullName)'" -TemplateFolders $TemplateFolders -Project $Project -CodeLanguage $CodeLanguage
	}
}

return @{
	DbContextType = $foundDbContextType
}


text:
module.exports = function (process, manifest, actionCallback) {
    var program = require('commander');

    program
        .version(manifest.version)
        .option('-v, --verbose', 'Enable verbose output')
        .command('*')
        .action(function (args) {
            actionCallback(process, args);
        });

    program.parse(process.argv);
};


text:
package io.irontest.models.propertyextractor;

import com.fasterxml.jackson.annotation.JsonView;
import io.irontest.models.Properties;
import io.irontest.resources.ResourceJsonViews;

@JsonView({ResourceJsonViews.TestcaseExport.class})
public class JSONPathPropertyExtractorProperties extends Properties {
    private String path;

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }
}


text:
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <ldsodefs.h>

#include <assert.h>

/* Add the new link_map NEW to the end of the namespace list.  */
void
internal_function
_dl_add_to_namespace_list (struct link_map *new, Lmid_t nsid)
{
  /* We modify the list of loaded objects.  */
  __rtld_lock_lock_recursive (GL(dl_load_write_lock));

  if (GL(dl_ns)[nsid]._ns_loaded != NULL)
    {
      struct link_map *l = GL(dl_ns)[nsid]._ns_loaded;
      while (l->l_next != NULL)
	l = l->l_next;
      new->l_prev = l;
      /* new->l_next = NULL;   Would be necessary but we use calloc.  */
      l->l_next = new;
    }
  else
    GL(dl_ns)[nsid]._ns_loaded = new;
  ++GL(dl_ns)[nsid]._ns_nloaded;
  new->l_serial = GL(dl_load_adds);
  ++GL(dl_load_adds);

  __rtld_lock_unlock_recursive (GL(dl_load_write_lock));
}

/* Allocate a `struct link_map' for a new object being loaded,
   and enter it into the _dl_loaded list.  */
struct link_map *
internal_function
_dl_new_object (char *realname, const char *libname, int type,
		struct link_map *loader, int mode, Lmid_t nsid)
{
  size_t libname_len = strlen (libname) + 1;
  struct link_map *new;
  struct libname_list *newname;
#ifdef SHARED
  /* We create the map for the executable before we know whether we have
     auditing libraries and if yes, how many.  Assume the worst.  */
  unsigned int naudit = GLRO(dl_naudit) ?: ((mode & __RTLD_OPENEXEC)
					    ? DL_NNS : 0);
  size_t audit_space = naudit * sizeof (new->l_audit[0]);
#else
# define audit_space 0
#endif

  new = (struct link_map *) calloc (sizeof (*new) + audit_space
				    + sizeof (struct link_map *)
				    + sizeof (*newname) + libname_len, 1);
  if (new == NULL)
    return NULL;

  new->l_real = new;
  new->l_symbolic_searchlist.r_list = (struct link_map **) ((char *) (new + 1)
							    + audit_space);

  new->l_libname = newname
    = (struct libname_list *) (new->l_symbolic_searchlist.r_list + 1);
  newname->name = (char *) memcpy (newname + 1, libname, libname_len);
  /* newname->next = NULL;	We use calloc therefore not necessary.  */
  newname->dont_free = 1;

  new->l_name = realname;
  new->l_type = type;
  /* If we set the bit now since we know it is never used we avoid
     dirtying the cache line later.  */
  if ((GLRO(dl_debug_mask) & DL_DEBUG_UNUSED) == 0)
    new->l_used = 1;
  new->l_loader = loader;
#if NO_TLS_OFFSET != 0
  new->l_tls_offset = NO_TLS_OFFSET;
#endif
  new->l_ns = nsid;

#ifdef SHARED
  for (unsigned int cnt = 0; cnt < naudit; ++cnt)
    {
      new->l_audit[cnt].cookie = (uintptr_t) new;
      /* new->l_audit[cnt].bindflags = 0; */
    }
#endif

  /* new->l_global = 0;	We use calloc therefore not necessary.  */

  /* Use the 'l_scope_mem' array by default for the 'l_scope'
     information.  If we need more entries we will allocate a large
     array dynamically.  */
  new->l_scope = new->l_scope_mem;
  new->l_scope_max = sizeof (new->l_scope_mem) / sizeof (new->l_scope_mem[0]);

  /* Counter for the scopes we have to handle.  */
  int idx = 0;

  if (GL(dl_ns)[nsid]._ns_loaded != NULL)
    /* Add the global scope.  */
    new->l_scope[idx++] = &GL(dl_ns)[nsid]._ns_loaded->l_searchlist;

  /* If we have no loader the new object acts as it.  */
  if (loader == NULL)
    loader = new;
  else
    /* Determine the local scope.  */
    while (loader->l_loader != NULL)
      loader = loader->l_loader;

  /* Insert the scope if it isn't the global scope we already added.  */
  if (idx == 0 || &loader->l_searchlist != new->l_scope[0])
    {
      if ((mode & RTLD_DEEPBIND) != 0 && idx != 0)
	{
	  new->l_scope[1] = new->l_scope[0];
	  idx = 0;
	}

      new->l_scope[idx] = &loader->l_searchlist;
    }

  new->l_local_scope[0] = &new->l_searchlist;

  /* Don't try to find the origin for the main map which has the name "".  */
  if (realname[0] != '\0')
    {
      size_t realname_len = strlen (realname) + 1;
      char *origin;
      char *cp;

      if (realname[0] == '/')
	{
	  /* It is an absolute path.  Use it.  But we have to make a
	     copy since we strip out the trailing slash.  */
	  cp = origin = (char *) malloc (realname_len);
	  if (origin == NULL)
	    {
	      origin = (char *) -1;
	      goto out;
	    }
	}
      else
	{
	  size_t len = realname_len;
	  char *result = NULL;

	  /* Get the current directory name.  */
	  origin = NULL;
	  do
	    {
	      char *new_origin;

	      len += 128;
	      new_origin = (char *) realloc (origin, len);
	      if (new_origin == NULL)
		/* We exit the loop.  Note that result == NULL.  */
		break;
	      origin = new_origin;
	    }
	  while ((result = __getcwd (origin, len - realname_len)) == NULL
		 && errno == ERANGE);

	  if (result == NULL)
	    {
	      /* We were not able to determine the current directory.
		 Note that free(origin) is OK if origin == NULL.  */
	      free (origin);
	      origin = (char *) -1;
	      goto out;
	    }

	  /* Find the end of the path and see whether we have to add a
	     slash.  We could use rawmemchr but this need not be
	     fast.  */
	  cp = (strchr) (origin, '\0');
	  if (cp[-1] != '/')
	    *cp++ = '/';
	}

      /* Add the real file name.  */
      cp = __mempcpy (cp, realname, realname_len);

      /* Now remove the filename and the slash.  Leave the slash if
	 the name is something like "/foo".  */
      do
	--cp;
      while (*cp != '/');

      if (cp == origin)
	/* Keep the only slash which is the first character.  */
	++cp;
      *cp = '\0';

    out:
      new->l_origin = origin;
    }

  return new;
}


text:
using System;
using System.Text.RegularExpressions;

namespace HealthNet
{
  public abstract class SystemCheckerBase : ISystemChecker
  {
    public virtual string SystemName
    {
      get
      {
        return Regex.Replace(GetType().Name.Replace("SystemChecker", string.Empty),
          "([a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))", "$1 ");
      }
    }

    public SystemCheckResult CheckSystem()
    {
      try
      {
        PerformCheck();

        return this.CreateGoodResult();
      }
      catch (Exception ex)
      {
        return this.CreateCriticalResult(ex.Message);
      }
    }

    protected abstract void PerformCheck();

    public virtual bool IsIntrusive
    {
      get { return false; }
    }

    public virtual bool IsVital
    {
      get { return true; }
    }
  }
}


text:
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';

import { ButtonExamplePage } from './button/example';
import { InputExamplePage } from './input/example';
import { ListExamplePage } from './list/example';
import { SliderExamplePage } from './slider/example';
import { UploaderExamplePage } from './uploader/example';
import { GalleryExamplePage } from './gallery/example';
import { BadgeExamplePage } from './badge/example';
import { FooterExamplePage } from './footer/example';
import { LoadmoreExamplePage } from './loadmore/example';
import { ProgressExamplePage } from './progress/example';

import { ActionsheetExamplePage } from './actionsheet/example';
import { DialogExamplePage } from './dialog/example';
import { ToastExamplePage } from './toast/example';
import { PickerExamplePage } from './picker/example';
import { SearchBarExamplePage } from './searchbar/example';
import { NavBarExamplePage } from './navbar/example';
import { TabBarExamplePage } from './tabbar/example';

import { ArticleExamplePage } from './article/example';
import { FlexExamplePage } from './flex/example';
import { GridExamplePage } from './grid/example';
import { IconsExamplePage } from './icons/example';
import { PanelExamplePage } from './panel/example';
import { PreviewExamplePage } from './preview/example';
import { MsgExamplePage, MsgSuccExamplePage, MsgWarnExamplePage } from './msg/example';

@NgModule({
    imports: [
        RouterModule.forChild([
            { path: 'button', component: ButtonExamplePage },
            { path: 'input', component: InputExamplePage },
            { path: 'list', component: ListExamplePage },
            { path: 'slider', component: SliderExamplePage },
            { path: 'uploader', component: UploaderExamplePage },
            { path: 'gallery', component: GalleryExamplePage },
            { path: 'badge', component: BadgeExamplePage },
            { path: 'footer', component: FooterExamplePage },
            { path: 'loadmore', component: LoadmoreExamplePage },
            { path: 'progress', component: ProgressExamplePage },
            { path: 'actionsheet', component: ActionsheetExamplePage },
            { path: 'dialog', component: DialogExamplePage },
            { path: 'toast', component: ToastExamplePage },
            { path: 'picker', component: PickerExamplePage },
            { path: 'searchbar', component: SearchBarExamplePage },
            { path: 'navbar', component: NavBarExamplePage },
            { path: 'tabbar', component: TabBarExamplePage },

            { path: 'article', component: ArticleExamplePage },
            { path: 'flex', component: FlexExamplePage },
            { path: 'grid', component: GridExamplePage },
            { path: 'icons', component: IconsExamplePage },
            { path: 'panel', component: PanelExamplePage },
            { path: 'preview', component: PreviewExamplePage },
            { path: 'msg', component: MsgExamplePage },
            { path: 'msg/success', component: MsgSuccExamplePage },
            { path: 'msg/warn', component: MsgWarnExamplePage }
        ])
    ],
    exports: [
        RouterModule
    ]
})
export class WeUIExampleRoutingModule { }


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 2.1//EN" "http://tiles.apache.org/dtds/tiles-config_2_1.dtd">
<tiles-definitions>
    <definition extends="default" name="resources/list">
        <put-attribute name="body" value="/WEB-INF/views/resources/list.jspx"/>
    </definition>
<definition extends="default" name="resources/show">
        <put-attribute name="body" value="/WEB-INF/views/resources/show.jspx"/>
    </definition>
<definition extends="default" name="resources/create">
        <put-attribute name="body" value="/WEB-INF/views/resources/create.jspx"/>
    </definition>
<definition extends="default" name="resources/update">
        <put-attribute name="body" value="/WEB-INF/views/resources/update.jspx"/>
    </definition>
</tiles-definitions>


text:
@interface FBAppAccessToken : NSObject

+ (NSString*)getAppAccessTokenWithAppId:(NSString*)appId cosumerSecret:(NSString*)secret;
+ (NSDictionary*)getAppInfoFromToken:(NSString*)token;

@end


text:
This is the preferred style of adding dependencies that use Bazel for their
build process.

1. Define a new Bazel repository in [`bazel/repositories.bzl`](repositories.bzl),
   in the `envoy_dependencies()` function.
2. Reference your new external dependency in some `envoy_cc_library` via the
   `external_deps` attribute.
3. `bazel test //test/...`

# Adding external dependencies to Envoy (genrule repository)

This is the newer style of adding dependencies with no upstream Bazel configs.
It wraps the dependency's native build tooling in a Bazel-aware shell script,
installing to a Bazel-managed prefix.

The shell script is executed by Bash, with a few Bazel-specific extensions.
See the [Bazel docs for "genrule"](https://docs.bazel.build/versions/master/be/general.html#genrule)
for details on Bazel's shell extensions.

1. Add a BUILD file in [`bazel/external/`](external/), using a `genrule` target
   to build the dependency. Please do not add BUILD logic that replaces the
   dependency's upstream build tooling.
2. Define a new Bazel repository in [`bazel/repositories.bzl`](repositories.bzl),
   in the `envoy_dependencies()` function. The repository may use `genrule_repository`
   from [`bazel/genrule_repository.bzl`](genrule_repository.bzl) to place large
   genrule shell commands into a separate file.
3. Reference your new external dependency in some `envoy_cc_library` via Y in the
   `external_deps` attribute.
4. `bazel test //test/...`

Dependencies between external libraries can use the standard Bazel dependency
resolution logic, using the `$(location)` shell extension to resolve paths
to binaries, libraries, headers, etc.

# Adding external dependencies to Envoy (build recipe)

This is the older style of adding dependencies. It uses shell scripts to build
and install dependencies into a shared directory prefix.

1. Add a build recipe X in [`ci/build_container/build_recipes`](../ci/build_container/build_recipes)
   for developer-local and CI external dependency build flows.
2. Add a build target Y in [`ci/prebuilt/BUILD`](../ci/prebuilt/BUILD) to consume the headers and
   libraries produced by the build recipe X.
3. Add a map from target Y to build recipe X in [`target_recipes.bzl`](target_recipes.bzl).
4. Reference your new external dependency in some `envoy_cc_library` via Y in the `external_deps`
   attribute.
5. `bazel test //test/...`

# Updating an external dependency version

1. If the dependency is a build recipe, update the build recipe in
[`ci/build_container/build_recipes`](../ci/build_container/build_recipes).
2. If not, update the corresponding entry in
[the repository locations file.](https://github.com/envoyproxy/envoy/blob/master/bazel/repository_locations.bzl)
3. `bazel test //test/...`

# Overriding an external dependency temporarily

An external dependency built by genrule repository or native Bazel could be overridden by
specifying Bazel option
[`--override_repository`](https://docs.bazel.build/versions/master/command-line-reference.html)
to point to a local copy. The option can used multiple times to override multiple dependencies.
The name of the dependency can be found in
[the repository locations file.](https://github.com/envoyproxy/envoy/blob/master/bazel/repository_locations.bzl)
The path of the local copy has to be absolute path.


text:
<?php

namespace Symfony\Component\Form\Exception;

/*
 * This file is part of the Symfony framework.
 *
 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

class InvalidOptionsException extends FormException
{
    private $options;

    public function __construct($message, array $options)
    {
        parent::__construct($message);

        $this->options = $options;
    }

    public function getOptions()
    {
        return $this->options;
    }
}


text:
namespace Tundra
{

LocalAssetStorage::LocalAssetStorage(Urho3D::Context* context, bool writable_, bool liveUpdate_, bool autoDiscoverable_) :
    IAssetStorage(context),
    recursive(true),
    changeWatcher(0)
{
    // Override the parameters for the base class.
    writable = writable_;
    liveUpdate = liveUpdate_;
    autoDiscoverable = autoDiscoverable_;
}

LocalAssetStorage::~LocalAssetStorage()
{
    RemoveWatcher();
}

void LocalAssetStorage::LoadAllAssetsOfType(AssetAPI *assetAPI, const String &suffix, const String &assetType)
{
    Urho3D::FileSystem* fileSystem = GetSubsystem<Urho3D::FileSystem>();
    StringVector filenames;
    fileSystem->ScanDir(filenames, directory, "*.*", Urho3D::SCAN_FILES, recursive);
    foreach(String str, filenames)
    {
        if ((suffix == "" || str.EndsWith(suffix)) && !(str.Contains(".git") || str.Contains(".svn") || str.Contains(".hg")))
        {
            uint lastSlash = str.FindLast('/');
            if (lastSlash != String::NPOS)
                str = str.Substring(lastSlash + 1);
            assetAPI->RequestAsset("local://" + str, assetType);
        }
    }
}

void LocalAssetStorage::RefreshAssetRefs()
{
    Urho3D::FileSystem* fileSystem = GetSubsystem<Urho3D::FileSystem>();
    StringVector filenames;
    fileSystem->ScanDir(filenames, directory, "*.*", Urho3D::SCAN_FILES, recursive);

    foreach(String str, filenames)
    {
        if (!(str.Contains(".git") || str.Contains(".svn") || str.Contains(".hg")))
        {
            String diskSource = directory + str;
            uint lastSlash = str.FindLast('/');
            if (lastSlash != String::NPOS)
                str = str.Substring(lastSlash + 1);
            String localName = str;
            str = "local://" + str;
            if (!assetRefs.Contains(str))
            {
                assetRefs.Push(str);
                AssetChanged.Emit(this, localName, diskSource, IAssetStorage::AssetCreate);
            }
        }
    }
}

void LocalAssetStorage::CacheStorageContents()
{
    cachedFiles.clear();
    Urho3D::FileSystem* fileSystem = GetSubsystem<Urho3D::FileSystem>();
    StringVector filenames;
    fileSystem->ScanDir(filenames, directory, "*.*", Urho3D::SCAN_FILES, recursive);

    foreach(String str, filenames)
    {
        if (!(str.Contains(".git") || str.Contains(".svn") || str.Contains(".hg")))
        {
            String diskSource = directory + str;
            uint lastSlash = str.FindLast('/');
            if (lastSlash != String::NPOS)
                str = str.Substring(lastSlash + 1);
            String localName = str;

///\todo This is an often-received error condition if the user is not aware, but also occurs naturally in built-in Ogre Media storages.
/// Fix this check to occur somehow nicer (without additional constraints to asset load time) without a hardcoded check
/// against the storage name.
            if (cachedFiles.find(localName) != cachedFiles.end())
                LogWarning("Warning: Asset Storage \"" + Name() + "\" contains ambiguous assets \"" + cachedFiles[localName] + "\" and \"" + diskSource + "\" in two different subdirectories!");

            cachedFiles[localName] = diskSource;
        }
    }
}

String LocalAssetStorage::GetFullPathForAsset(const String &assetname, bool recursiveLookup)
{
    Urho3D::FileSystem* fileSystem = GetSubsystem<Urho3D::FileSystem>();
    if (fileSystem->FileExists(directory + assetname))
        return directory;

    std::map<String, String, StringCompareCaseInsensitive>::iterator iter = cachedFiles.find(assetname);
    if (iter == cachedFiles.end())
    {
        if (!recursive || !recursiveLookup)
            return "";
        else
            CacheStorageContents();
    }

    iter = cachedFiles.find(assetname);
    if (iter != cachedFiles.end())
    {
        if (fileSystem->FileExists(iter->second))
            return Urho3D::GetPath(iter->second);
    }

    return "";
}

/// @todo Make this function handle arbitrary asset refs.
String LocalAssetStorage::GetFullAssetURL(const String &localName)
{
    String filename;
    String subAssetName;
    AssetAPI::ParseAssetRef(localName, 0, 0, 0, 0, &filename, 0, 0, &subAssetName);
    return BaseURL() + filename + (subAssetName.Empty() ? "" : ("#" + subAssetName));
}

String LocalAssetStorage::Type() const
{
    return "LocalAssetStorage";
}

String LocalAssetStorage::SerializeToString(bool networkTransfer) const
{
    if (networkTransfer)
        return ""; // Cannot transfer a LocalAssetStorage through network to another computer, since it is local to this system!
    else
        return "type=" + Type() + ";name=" + name + ";src=" + directory + ";recursive=" + String(recursive) + ";readonly=" + String(!writable) +
            ";liveupdate=" + String(liveUpdate) + ";autodiscoverable=" + String(autoDiscoverable) + ";replicated=" + String(isReplicated)
            + ";trusted=" + TrustStateToString(GetTrustState());
}

void LocalAssetStorage::EmitAssetChanged(String absoluteFilename, IAssetStorage::ChangeType change)
{
    String localName;
    uint lastSlash = absoluteFilename.FindLast('/');
    if (lastSlash != String::NPOS)
        localName = absoluteFilename.Substring(lastSlash + 1);
    String assetRef = "local://" + localName;
    if (assetRefs.Contains(assetRef) && change == IAssetStorage::AssetCreate)
        LogDebug("LocalAssetStorage::EmitAssetChanged: Emitting AssetCreate signal for already existing asset " + assetRef +
            ", file " + absoluteFilename + ". Asset was probably removed and then added back.");
    AssetChanged.Emit(this, localName, absoluteFilename, change);
}

void LocalAssetStorage::SetupWatcher()
{
    if (changeWatcher) // Remove the old watcher if one exists.
        RemoveWatcher();

    changeWatcher = new Urho3D::FileWatcher(GetContext());
    changeWatcher->StartWatching(directory, recursive);
    LogInfo("LocalAssetStorage: started watching " + directory);
}

void LocalAssetStorage::RemoveWatcher()
{
    changeWatcher.Reset();
}

}


text:
<!DOCTYPE frameset SYSTEM "frameset.dtd">
<frameset>
    <predicate lemma="enforce">
        <note>
            Frames file for 'enforce' based on sentences in financial subcorpus.
            No Verbnet entry, no Framenet entry.  No comparison.
        </note>

        <roleset id="enforce.01" name="make sure the rules are followed" vncls="63">
            <roles>
                <role descr="enforcer" n="0">
                    <vnrole vncls="63" vntheta="Agent"/>
                </role>
                <role descr="rule(s)" n="1">
                    <vnrole vncls="63" vntheta="Theme"/>
                </role>
            </roles>

            <example name="normal usage">
                <inflection aspect="ns" form="infinitive" person="ns" tense="ns" voice="ns"/>
                <text>
                    Japan-1 agreed *trace*-1 to enforce a decision  by an international
                    wildlife conference to ban all trade in ivory, a spokesman for the
                    Ministry of International Trade and Industry said.
                </text>
                <arg n="0">*trace*</arg>
                <rel>enforce</rel>
                <arg n="1">a decision by an international wildlife conference
                    to ban all trade in ivory
                </arg>
            </example>

            <example name="um, wrong word">
                <inflection aspect="ns" form="full" person="third" tense="present" voice="active"/>
                <text>
                    The pilot union said the flight attendants' decision ``enforces
                    our belief that an all-employee owned airline is practical and
                    achievable.''
                </text>
                <arg n="0">the flight attendants' decision</arg>
                <rel>enforces</rel>
                <arg n="1">our belief that an all-employee owned airline is
                    practical and achievable
                </arg>
            </example>

            <note>
                I think they wanted 'reinforce,' which actually is related.
            </note>

        </roleset>
    </predicate>
</frameset>


text:
//
//  BleBeaconSignInModel.m
//  BleToolBox
//
//  Created by Mark on 2018/1/26.
//  Copyright © 2018年 MarkCJ. All rights reserved.
//

#import "BleBeaconSignInModel.h"

@implementation BleBeaconSignInModel

/**
 Init the beacon model by beacon information

 @param name            Device name
 @param deviceUUID      Device UUID
 @param serviceUUID     Device Service UUID
 @param rssi            RSSI value
 @param time            Sign in time
 @return
 */
-(instancetype)initWithBeaconName:(NSString *)name deviceUUID:(NSString *)deviceUUID serviceUUID:(NSString *)serviceUUID RSSI:(NSInteger)rssi signInTime:(NSDate *)time {
    self = [super init];

    self = [super initWithValue:@{
                          @"beaconName" : name,
                          @"beaconDeviceUUID" : deviceUUID,
                          @"beaconServiceUUID" : serviceUUID,
                          @"signInRSSI" : @(rssi),
                          @"signInTime" : time
                          }];

    return self;
}

@end


text:
import * as actionClasses from '../constants/ActionClasses'
import * as types from '../constants/ActionTypes'
import {getUUID} from '../utils/utils'
import Immutable from 'immutable'
import * as util from './util'

export function initTitle(rootState, myId, parentId) {
  if(!parentId) parentId = ''

  return (dispatch, getState) => {
    dispatch(initTitleCore(rootState, myId, parentId, []))
  }
}

function initTitleCore(rootState, myId, parentId, relatedIds=[]) {
  return {
    myId,
    myClass: actionClasses.TITLE,
    type: types.INIT_TITLE,
    parentId,
    relatedIds,
  }
}


text:
![Header image](/images/header.jpg)

## Welcome to WaveInApp - Audio Visualization View with wave effect.

Our library can take audio from any source (audio players, streams, voice input) and animate it with high frame rate. Cool animation, designed specially for the library, responds to sound vibrations. The animation becomes intense when music plays, and once it is paused or stopped – waves calm down.

The library is a part of implementation of music player.

![Demo image](/images/demo_.gif)

Great visualization can spruce up any app, especially audio player. We suggest you smart and good-looking Audio Visualization View for your Android app. You can read about all the advantages this library has and find out how to implement it into your app in our blog post: Case Study: Audio Visualization View For Android by Cleveroad

[![Article image](/images/article.jpg)](https://www.cleveroad.com/blog/case-study-audio-visualization-view-for-android-by-cleveroad)

[![Awesome](/images/logo-footer.png)](https://www.cleveroad.com/?utm_source=github&utm_medium=label&utm_campaign=contacts)

## Setup and usage

To include this library to your project add dependency in **build.gradle** file:

```groovy
    dependencies {
        implementation 'com.cleveroad:audiovisualization:1.0.1'
    }
```

Audio visualization view uses OpenGL ES 2.0 for drawing waves. So you need to include this line in your manifest:

```XML
    <uses-feature android:glEsVersion="0x00020000" android:required="true" />
```

##### Using VisualizerDbmHandler

All functionality of this handler built upon [Visualizer] object, so you also need to include this permissions in your manifest:

```XML
    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
```

##### Using SpeechRecognizerDbmHandler

All functionality of this handler built upon [SpeechRecognizer] object, so you also need to include this permissions in your manifest:

```XML
    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
```

You must be very careful with new [Android M permissions] flow. Make sure you have all necessary permissions before using **GLAudioVisualizationView**.

There are two ways to include **GLAudioVisualizationView** in your layout: directly in XML layout file or using builder in Java code.

Via XML:

```XML
    <com.cleveroad.audiovisualization.GLAudioVisualizationView
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/visualizer_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:av_bubblesSize="@dimen/bubble_size"
        app:av_bubblesRandomizeSizes="true"
        app:av_wavesHeight="@dimen/wave_height"
        app:av_wavesFooterHeight="@dimen/footer_height"
        app:av_wavesCount="7"
        app:av_layersCount="4"
        app:av_backgroundColor="@color/av_color_bg"
        app:av_bubblesPerLayer="16"
        />
```

Via Java code:

```JAVA
    new GLAudioVisualizationView.Builder(getContext())
        .setBubblesSize(R.dimen.bubble_size)
        .setBubblesRandomizeSize(true)
        .setWavesHeight(R.dimen.wave_height)
        .setWavesFooterHeight(R.dimen.footer_height)
        .setWavesCount(7)
        .setLayersCount(4)
        .setBackgroundColorRes(R.color.av_color_bg)
        .setLayerColors(R.array.av_colors)
        .setBubblesPerLayer(16)
        .build();
```

**GLAudioVisualizationView** implements **AudioVisualization** interface. If you don't need all [GLSurfaceView]'s public methods, you can simply cast your view to **AudioVisualization** interface and use it.

```JAVA
    private AudioVisualization audioVisualization;

    ...

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        // you can extract AudioVisualization interface for simplifying things
        audioVisualization = (AudioVisualization) glAudioVisualizationView;
    }

    ...
```

To connect audio visualization view to audio output you can use **linkTo(DbmHandler)** method. See **DbmHandler.Factory** class for the list of available handler implementations.

```JAVA
    // set speech recognizer handler
    SpeechRecognizerDbmHandler speechRecHandler = DbmHandler.Factory.newSpeechRecognizerHandler(context);
    speechRecHandler.innerRecognitionListener(...);
    audioVisualization.linkTo(speechRecHandler);

    // set audio visualization handler. This will REPLACE previously set speech recognizer handler
    VisualizerDbmHandler vizualizerHandler = DbmHandler.Factory.newVisualizerHandler(getContext(), 0);
    audioVisualization.linkTo(vizualizerHandler);
```

You must always call **onPause** method to pause visualization and stop wasting CPU resources for computations in vain. As soon as your view appears in sight of user, call **onResume**.

```JAVA
    @Override
    public void onResume() {
        super.onResume();
        audioVisualization.onResume();
    }

    @Override
    public void onPause() {
        audioVisualization.onPause();
        super.onPause();
    }
```

When user leaves screen with audio visualization view, don't forget to free resources and call **release()** method.

```JAVA
    @Override
    public void onDestroyView() {
        audioVisualization.release();
        super.onDestroyView();
    }
```

## Live wallpapers
You can use our Audio Visualization View as a live wallpaper. Just create your own [WallpaperService]. Method `onCreateEngine()` should return your own [Engine]'s implementation, in which you must override the following methods:
* `void onCreate(SurfaceHolder surfaceHolder)` – here create instances of `DbmHandler`, `GLAudioVisualizationView.Builder` (see example below) and `GLAudioVisualizationView.AudioVisualizationRenderer` in which you must set `Engine`'s surface holder and two previous instances via `constructor(GLAudioVisualizationView.Builder)` and `handler()` methods;
* `void onVisibilityChanged(final boolean visible)` – here you must call `onResume()` methods for audioVisualizationView and dbmHandler instances if `visible` parameter is `true`, otherwise – call `onPause()`;
* `void onDestroy()` – just call `release()` for dbmHandler and `onDestroy()` for audioVisualizationView instances
Check JavaDoc of this methods for more info.

```JAVA
    public class AudioVisualizationWallpaperService extends WallpaperService {
        @Override
        public Engine onCreateEngine() {
            return new WallpaperEngine();
        }

        private class WallpaperEngine extends Engine {

        private WallpaperGLSurfaceView audioVisualizationView;
        private DbmHandler dbmHandler;
        private GLAudioVisualizationView.AudioVisualizationRenderer renderer;
        ...
            @Override
            public void onCreate(SurfaceHolder surfaceHolder) {
                AudioVisualizationWallpaperService context = AudioVisualizationWallpaperService.this;
                audioVisualizationView = new WallpaperGLSurfaceView(context);
                dbmHandler = DbmHandler.Factory.newVisualizerHandler(context, 0);
                ...
                GLAudioVisualizationView.Builder builder = new GLAudioVisualizationView.Builder(context)
                        //... set your settings here (see builder example below);
                renderer = new GLAudioVisualizationView.RendererBuilder(builder)
                        .glSurfaceView(audioVisualizationView)
                        .handler(dbmHandler)
                        .build();
                audioVisualizationView.setEGLContextClientVersion(2);
                audioVisualizationView.setRenderer(renderer);
            }
            @Override
            public void onVisibilityChanged(final boolean visible) {
                //Please follow the next order of methods call!
                if (visible) {
                    audioVisualizationView.onResume();
                    dbmHandler.onResume();
                } else {
                    dbmHandler.onPause();
                    audioVisualizationView.onPause();
                }
            }
            @Override
            public void onDestroy() {
                dbmHandler.release();
                audioVisualizationView.onDestroy();
            }

```
See uploaded [AudioVisualizationWallpaperService example].

## Implementing your own DbmHandler
To implement you own data conversion handler, just extend your class from DbmHandler class and implement **onDataReceivedImpl(T object, int layersCount, float[] outDbmValues, float[] outAmpValues)** method where:
* `object` - your custom data type
* `layersCount` - count of layers you passed in **Builder**.
* `outDbmValues` - array with size equals to `layersCount`. You should fill it with **normalized** dBm values for layer in range [0..1].
* `outAmpValues` - array with size equals to `layersCount`. You should fill it with amplitude values for layer.
Check JavaDoc of this method for more info.

Then call **onDataReceived(T object)** method to visualize your data.

Your handler also will receive **onResume()**, **onPause()** and **release()** events from audio visualization view.

## Migrations
See all [migration manuals].

## Changelog
See [changelog history].

## Troubleshooting
#### Visualization
If you have some issues with visualization (especially on Samsung Galaxy S or HTC devices) make sure you read [this Github issue].
#### Live wallpapers
* If you have some issues with WaveInApp live wallpapers on Android 6.0 (and later) make sure that all next permissions are granted: `android.permission.RECORD_AUDIO`, `android.permission.MODIFY_AUDIO_SETTINGS`.
* If you run a wallpaper selection screen when the permissions was not granted, the wallpaper will not be appear. You must open settings screen and allow all permissions. If the wallpaper is not yet appeared, just restart the wallpaper selection screen.

## Support
If you have any other questions regarding the use of this library, please contact us for support at info@cleveroad.com (email subject: "Android visualization view. Support request.")

## License
* * *
    The MIT License (MIT)

    Copyright (c) 2016 Cleveroad Inc.

    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in all
    copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    SOFTWARE.

[migration manuals]: /MIGRATION.md
[changelog history]: /CHANGELOG.md
[AudioVisualizationWallpaperService example]: wallpaper/src/main/java/com/cleveroad/wallpaper/AudioVisualizationWallpaperService.java
[WallpaperService]: https://developer.android.com/reference/android/service/wallpaper/WallpaperService.html
[this Github issue]: https://github.com/felixpalmer/android-visualizer/issues/5#issuecomment-25900391
[Engine]: https://developer.android.com/reference/android/service/wallpaper/WallpaperService.Engine.html
[Visualizer]: http://developer.android.com/intl/ru/reference/android/media/audiofx/Visualizer.html
[SpeechRecognizer]: http://developer.android.com/intl/ru/reference/android/speech/SpeechRecognizer.html
[Android M permissions]: http://developer.android.com/intl/ru/training/permissions/requesting.html
[GLSurfaceView]: http://developer.android.com/intl/ru/reference/android/opengl/GLSurfaceView.html


text:
"""Decorators."""
import inspect
from functools import wraps

def with_fixtures(func):
    """A decorator that allows to call a function with the with_fixtures as parameters.

    :returns: Function that takes request parameter and optional keyword arguments to override fixtures.
    """
    @wraps(func)
    def decorate(request, **kwargs):
        call_args = {}
        for arg in inspect.getargspec(func).args:
            if arg in kwargs:
                call_args[arg] = kwargs[arg]
            else:
                call_args[arg] = request.getfuncargvalue(arg)
        return func(**call_args)
    return decorate


text:
/**
 * Author: Bob Chen
 *         Kylin Soong
 */

package com.jcommerce.core.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "shipping_area")
public class ShippingArea extends ModelObject {

	private Long id;

	@Id
	@GeneratedValue
	@Basic(optional = false)
	@Column(name = "id", nullable = false)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	private static final long serialVersionUID = -6017351801667054609L;
	private String name;
	private Shipping shipping;
	private String config;
	private Set<Region> regions = new HashSet<Region>();

	@Basic( optional = true )
	@Column( name = "shipping_area_name", length = 150  )
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @ManyToOne( cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY )
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE})
	@Basic( optional = true )
	@JoinColumn(name = "shipping_id", nullable = true )
    public Shipping getShipping() {
        return shipping;
    }

    public void setShipping(Shipping shipping) {
        this.shipping = shipping;
    }

    @Basic( optional = true )
	@Column( length = 2147483647  )
    public String getConfig() {
        return config;
    }

    public void setConfig(String config) {
        this.config = config;
    }

    @ManyToMany( fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
 	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE})
	@JoinTable(name = "shiparea_regin", joinColumns = { @JoinColumn(name = "shipping_area_id") }, inverseJoinColumns = { @JoinColumn(name = "region_id") })
	@Basic( optional = false )
    public Set<Region> getRegions() {
        return regions;
    }

    public void setRegions(Set<Region> regions) {
        if (regions == null) {
            this.regions.clear();
        } else {
            this.regions = regions;
        }
    }

    public void addRegion(Region region) {
        if (!regions.contains(region)) {
            this.regions.add(region);
        }
    }

    public void removeRegion(Region region) {
        if (regions.contains(region)) {
            this.regions.remove(region);
        }
    }
}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package project.addmoto.javasqlquerybuilder;

/**
 *
 * @author Kim Howel delos Reyes
 */
public interface Update extends Query {

    /**
     * Sets a field to the specified placeholder. May be called multiple times.
     *
     * @param field
     * @param placeholder
     * @return This query builder.
     */
    public Update set(Field field, String placeholder);

    /**
     * Adds a where clause. Very important. Call only once per QbUpdate object.
     *
     * @return A QbWhere object that is bound to this query.
     */
    public Where where();

    /**
     * Signals that you want to update all records. If neither where or all is
     * called the query builder will throw an exception.
     *
     * @return This query builder.
     */
    public Update all();

    /**
     * Which table to update. Table name should not contain backticks. Must be
     * called to make a valid update query.
     *
     * @param table
     * @return This query builder.
     */
    public Update inTable(String table);
}


text:
package thredds.catalog;

/**
 * Allows asynchronous reading of a catalog.
 * When the catalog is read, setCatalog() is called, else failed() is called.
 */
public interface CatalogSetCallback {

  /**
   * Called when the catalog is done being read.
   *
   * @param catalog the catalog that was just read in.
   */
  public void setCatalog(InvCatalogImpl catalog);

  /**
   * Called if the catalog reading fails
   */
  public void failed();
}


text:
.class public Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;
.super Ljava/lang/Object;
.source "GsmCbSmsMessage.java"

# static fields
.field public static final CB_DISPLAY_IMM:I = 0x0

.field public static final CB_DISPLAY_NORMAL:I = 0x1

.field public static final CB_ETWS_EmergencyAlert_Bit_Index:I = 0xd

.field public static final CB_ETWS_ID_BEGIN:I = 0x1100

.field public static final CB_ETWS_ID_COMBINED:I = 0x1102

.field public static final CB_ETWS_ID_EARTHQUAKE:I = 0x1100

.field public static final CB_ETWS_ID_END:I = 0x1107

.field public static final CB_ETWS_ID_OTHERS:I = 0x1104

.field public static final CB_ETWS_ID_TEST:I = 0x1103

.field public static final CB_ETWS_ID_TSUNAMI:I = 0x1101

.field public static final CB_ETWS_Popup_Bit_Index:I = 0xd

.field public static final CB_ETWS_WARNING_COMBINED:I = 0x2

.field public static final CB_ETWS_WARNING_EARTHQUAKE:I = 0x0

.field public static final CB_ETWS_WARNING_OTHERS:I = 0x4

.field public static final CB_ETWS_WARNING_TEST:I = 0x3

.field public static final CB_ETWS_WARNING_TSUNAMI:I = 0x1

.field public static final CB_GS_Bit_Index:I = 0xe

.field public static final CB_MsgCode_Bit_Index:I = 0x4

.field public static final CB_UpdateNum_Bit_Index:I = 0x0

.field public static final ENCODING_16BIT:I = 0x3

.field public static final ENCODING_7BIT:I = 0x1

.field public static final ENCODING_8BIT:I = 0x2

.field public static final ENCODING_UNKNOWN:I = 0x0

.field public static final GS_CELL_IMM:I = 0x0

.field public static final GS_CELL_NORMAL:I = 0x4

.field public static final GS_LAC_SAC:I = 0x2

.field public static final GS_PLMN:I = 0x1

.field static final LOG_TAG:Ljava/lang/String; = "GSM"

# instance fields
.field protected dcs:I

.field private etwsWarningSecurityInfo:[B

.field private etwsWarningType:I

.field protected mPdu:[B

.field private messageBody:Ljava/lang/String;

.field protected messageID:I

.field protected pageIndex:I

.field protected serialNumber:I

.field protected totalPage:I

.field protected userDataHeader:Lcom/android/internal/telephony/SmsHeader;

# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 46
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static createFromPdu([B)Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;
    .locals 14
    .parameter "pdu"

    .prologue
    const/4 v13, 0x0

    const/16 v7, 0x32

    const/4 v12, 0x5

    const/4 v11, 0x6

    const/4 v10, 0x1

    .line 133
    new-instance v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;

    invoke-direct {v5}, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;-><init>()V

    .line 135
    .local v5, msg:Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;
    iput-object p0, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->mPdu:[B

    .line 138
    aget-byte v8, p0, v13

    and-int/lit16 v8, v8, 0xff

    shl-int/lit8 v8, v8, 0x8

    aget-byte v9, p0, v10

    and-int/lit16 v9, v9, 0xff

    or-int/2addr v8, v9

    iput v8, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->serialNumber:I

    .line 141
    const/4 v8, 0x2

    aget-byte v8, p0, v8

    and-int/lit16 v8, v8, 0xff

    shl-int/lit8 v8, v8, 0x8

    const/4 v9, 0x3

    aget-byte v9, p0, v9

    and-int/lit16 v9, v9, 0xff

    or-int/2addr v8, v9

    iput v8, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->messageID:I

    .line 143
    invoke-virtual {v5}, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->isETWSMessage()Z

    move-result v8

    if-eqz v8, :cond_1

    .line 146
    const/4 v8, 0x4

    aget-byte v8, p0, v8

    and-int/lit16 v8, v8, 0xff

    shl-int/lit8 v8, v8, 0x8

    aget-byte v9, p0, v12

    and-int/lit16 v9, v9, 0xff

    or-int/2addr v8, v9

    iput v8, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->etwsWarningType:I

    .line 149
    new-array v8, v7, [B

    iput-object v8, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->etwsWarningSecurityInfo:[B

    .line 150
    array-length v8, p0

    add-int/lit8 v3, v8, -0x6

    .line 151
    .local v3, len:I
    iget-object v8, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->etwsWarningSecurityInfo:[B

    if-ge v3, v7, :cond_0

    .end local v3           #len:I
    :goto_0
    invoke-static {p0, v11, v8, v13, v3}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V

    .line 153
    const-string v7, "This is a ETWS Message"

    iput-object v7, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->messageBody:Ljava/lang/String;

    .line 236
    :goto_1
    const-string v7, "GSM"

    new-instance v8, Ljava/lang/StringBuilder;

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

    const-string v9, "CBSms newCB: "

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

    move-result-object v8

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

    move-result-object v8

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

    move-result-object v8

    invoke-static {v7, v8}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 237
    return-object v5

    .restart local v3       #len:I
    :cond_0
    move v3, v7

    .line 151
    goto :goto_0

    .line 158
    .end local v3           #len:I
    :cond_1
    const/4 v7, 0x4

    aget-byte v7, p0, v7

    iput v7, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->dcs:I

    .line 161
    aget-byte v7, p0, v12

    shr-int/lit8 v7, v7, 0x4

    and-int/lit8 v7, v7, 0xf

    iput v7, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->pageIndex:I

    .line 164
    aget-byte v7, p0, v12

    and-int/lit8 v7, v7, 0xf

    iput v7, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->totalPage:I

    .line 166
    iget v7, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->pageIndex:I

    if-eqz v7, :cond_2

    iget v7, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->totalPage:I

    if-nez v7, :cond_3

    .line 167
    :cond_2
    iput v10, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->pageIndex:I

    .line 168
    iput v10, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->totalPage:I

    .line 172
    :cond_3
    iget v7, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->dcs:I

    and-int/lit16 v7, v7, 0xec

    const/16 v8, 0x48

    if-eq v7, v8, :cond_4

    iget v7, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->dcs:I

    const/16 v8, 0x11

    if-ne v7, v8, :cond_5

    .line 177
    :cond_4
    const/4 v1, 0x3

    .line 199
    .local v1, encoding:I
    :goto_2
    array-length v7, p0

    add-int/lit8 v0, v7, -0x6

    .line 200
    .local v0, byteCount:I
    const/4 v6, 0x0

    .line 201
    .local v6, text:Ljava/lang/String;
    if-gez v0, :cond_b

    .line 202
    const-string v7, "GSM"

    new-instance v8, Ljava/lang/StringBuilder;

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

    const-string v9, "CBSms newCB: the length of the pdu is invalid: "

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

    move-result-object v8

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

    move-result-object v8

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

    move-result-object v8

    invoke-static {v7, v8}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 229
    :goto_3
    if-eqz v6, :cond_f

    .line 230
    const/16 v7, 0xd

    invoke-static {v6, v7}, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->removeTailCharacters(Ljava/lang/String;C)Ljava/lang/String;

    move-result-object v7

    iput-object v7, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->messageBody:Ljava/lang/String;

    goto :goto_1

    .line 178
    .end local v0           #byteCount:I
    .end local v1           #encoding:I
    .end local v6           #text:Ljava/lang/String;
    :cond_5
    iget v7, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->dcs:I

    and-int/lit16 v7, v7, 0xec

    const/16 v8, 0x44

    if-eq v7, v8, :cond_6

    iget v7, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->dcs:I

    and-int/lit16 v7, v7, 0xf4

    const/16 v8, 0xf4

    if-ne v7, v8, :cond_7

    .line 183
    :cond_6
    const/4 v1, 0x2

    .line 184
    .restart local v1       #encoding:I
    const-string v7, "GSM"

    new-instance v8, Ljava/lang/StringBuilder;

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

    const-string v9, "CBSms newCB: we don\'t support this dcs: "

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

    move-result-object v8

    iget v9, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->dcs:I

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v8

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

    move-result-object v8

    invoke-static {v7, v8}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_2

    .line 185
    .end local v1           #encoding:I
    :cond_7
    iget v7, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->dcs:I

    and-int/lit16 v7, v7, 0xf0

    const/16 v8, 0xe0

    if-ne v7, v8, :cond_8

    .line 187
    const/4 v1, 0x0

    .line 188
    .restart local v1       #encoding:I
    const-string v7, "GSM"

    new-instance v8, Ljava/lang/StringBuilder;

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

    const-string v9, "CBSms newCB: we don\'t support WAP dcs: "

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

    move-result-object v8

    iget v9, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->dcs:I

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v8

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

    move-result-object v8

    invoke-static {v7, v8}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_2

    .line 189
    .end local v1           #encoding:I
    :cond_8
    iget v7, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->dcs:I

    and-int/lit16 v7, v7, 0xf0

    const/16 v8, 0x90

    if-ne v7, v8, :cond_9

    .line 190
    const/4 v1, 0x0

    .line 191
    .restart local v1       #encoding:I
    const-string v7, "GSM"

    new-instance v8, Ljava/lang/StringBuilder;

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

    const-string v9, "CBSms newCB: we don\'t support UDH dcs: "

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

    move-result-object v8

    iget v9, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->dcs:I

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v8

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

    move-result-object v8

    invoke-static {v7, v8}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    goto/16 :goto_2

    .line 192
    .end local v1           #encoding:I
    :cond_9
    iget v7, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->dcs:I

    and-int/lit16 v7, v7, 0xe0

    const/16 v8, 0x60

    if-ne v7, v8, :cond_a

    .line 193
    const/4 v1, 0x0

    .line 194
    .restart local v1       #encoding:I
    const-string v7, "GSM"

    new-instance v8, Ljava/lang/StringBuilder;

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

    const-string v9, "CBSms newCB: we don\'t support compressed dcs: "

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

    move-result-object v8

    iget v9, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->dcs:I

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v8

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

    move-result-object v8

    invoke-static {v7, v8}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    goto/16 :goto_2

    .line 196
    .end local v1           #encoding:I
    :cond_a
    const/4 v1, 0x1

    .restart local v1       #encoding:I
    goto/16 :goto_2

    .line 203
    .restart local v0       #byteCount:I
    .restart local v6       #text:Ljava/lang/String;
    :cond_b
    const/4 v7, 0x3

    if-ne v1, v7, :cond_c

    .line 205
    :try_start_0
    new-instance v6, Ljava/lang/String;

    .end local v6           #text:Ljava/lang/String;
    const/4 v7, 0x6

    const-string/jumbo v8, "utf-16"

    invoke-direct {v6, p0, v7, v0, v8}, Ljava/lang/String;-><init>([BIILjava/lang/String;)V
    :try_end_0
    .catch Ljava/io/UnsupportedEncodingException; {:try_start_0 .. :try_end_0} :catch_0

    .restart local v6       #text:Ljava/lang/String;
    goto/16 :goto_3

    .line 206
    .end local v6           #text:Ljava/lang/String;
    :catch_0
    move-exception v2

    .line 207
    .local v2, ex:Ljava/io/UnsupportedEncodingException;
    const-string v7, "GSM"

    const-string v8, "CBSms NewCB, implausible UnsupportedEncodingException"

    invoke-static {v7, v8, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    .line 208
    const/4 v6, 0x0

    .line 209
    .restart local v6       #text:Ljava/lang/String;
    goto/16 :goto_3

    .line 210
    .end local v2           #ex:Ljava/io/UnsupportedEncodingException;
    :cond_c
    const/4 v7, 0x2

    if-ne v1, v7, :cond_d

    .line 212
    :try_start_1
    new-instance v6, Ljava/lang/String;

    .end local v6           #text:Ljava/lang/String;
    const/4 v7, 0x6

    const-string/jumbo v8, "utf-8"

    invoke-direct {v6, p0, v7, v0, v8}, Ljava/lang/String;-><init>([BIILjava/lang/String;)V
    :try_end_1
    .catch Ljava/io/UnsupportedEncodingException; {:try_start_1 .. :try_end_1} :catch_1

    .restart local v6       #text:Ljava/lang/String;
    goto/16 :goto_3

    .line 213
    .end local v6           #text:Ljava/lang/String;
    :catch_1
    move-exception v2

    .line 214
    .restart local v2       #ex:Ljava/io/UnsupportedEncodingException;
    const-string v7, "GSM"

    const-string v8, "CBSms NewCB, implausible UnsupportedEncodingException(utf-8)"

    invoke-static {v7, v8, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    .line 216
    const/4 v6, 0x0

    .line 217
    .restart local v6       #text:Ljava/lang/String;
    goto/16 :goto_3

    .line 218
    .end local v2           #ex:Ljava/io/UnsupportedEncodingException;
    :cond_d
    if-ne v1, v10, :cond_e

    .line 220
    mul-int/lit8 v7, v0, 0x8

    div-int/lit8 v4, v7, 0x7

    .line 223
    .local v4, lengthSeptets:I
    invoke-static {p0, v11, v4}, Lcom/android/internal/telephony/GsmAlphabet;->gsm7BitPackedToString([BII)Ljava/lang/String;

    move-result-object v6

    .line 224
    goto/16 :goto_3

    .line 225
    .end local v4           #lengthSeptets:I
    :cond_e
    const/4 v6, 0x0

    goto/16 :goto_3

    .line 232
    :cond_f
    const/4 v7, 0x0

    iput-object v7, v5, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->messageBody:Ljava/lang/String;

    goto/16 :goto_1
.end method

.method public static isDuplicateMessage(IIIIIIII)Z
    .locals 5
    .parameter "oldSn"
    .parameter "oldMsgId"
    .parameter "oldLac"
    .parameter "oldCid"
    .parameter "newSn"
    .parameter "newMsgId"
    .parameter "newLac"
    .parameter "newCid"

    .prologue
    const/4 v2, 0x1

    const/4 v3, 0x0

    .line 102
    const/4 v1, 0x0

    .line 104
    .local v1, ret:Z
    shr-int/lit8 v4, p0, 0xe

    and-int/lit8 v0, v4, 0x3

    .line 106
    .local v0, gsCode:I
    if-ne p1, p5, :cond_0

    if-ne p0, p4, :cond_0

    .line 107
    if-ne p0, p4, :cond_0

    .line 108
    packed-switch v0, :pswitch_data_0

    .line 125
    :cond_0
    :goto_0
    :pswitch_0
    return v1

    .line 111
    :pswitch_1
    if-ne p3, p7, :cond_1

    move v1, v2

    .line 112
    :goto_1
    goto :goto_0

    :cond_1
    move v1, v3

    .line 111
    goto :goto_1

    .line 114
    :pswitch_2
    const/4 v1, 0x1

    .line 115
    goto :goto_0

    .line 117
    :pswitch_3
    if-ne p2, p6, :cond_2

    move v1, v2

    .line 118
    :goto_2
    goto :goto_0

    :cond_2
    move v1, v3

    .line 117
    goto :goto_2

    .line 108
    nop

    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_1
        :pswitch_2
        :pswitch_3
        :pswitch_0
        :pswitch_1
    .end packed-switch
.end method

.method public static newFromCBM(Ljava/lang/String;)Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;
    .locals 4
    .parameter "smsPdu"

    .prologue
    .line 242
    const-string v1, "GSM"

    new-instance v2, Ljava/lang/StringBuilder;

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

    const-string v3, "CBSms newFromCBM: "

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

    move-result-object v2

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

    move-result-object v2

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

    move-result-object v2

    invoke-static {v1, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 244
    invoke-static {p0}, Lcom/android/internal/telephony/IccUtils;->hexStringToBytes(Ljava/lang/String;)[B

    move-result-object v0

    .line 245
    .local v0, pduData:[B
    if-nez v0, :cond_0

    .line 246
    const/4 v1, 0x0

    .line 249
    :goto_0
    return-object v1

    :cond_0
    invoke-static {v0}, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->createFromPdu([B)Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;

    move-result-object v1

    goto :goto_0
.end method

.method private static removeTailCharacters(Ljava/lang/String;C)Ljava/lang/String;
    .locals 4
    .parameter "src"
    .parameter "c"

    .prologue
    .line 312
    new-instance v1, Ljava/lang/StringBuilder;

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

    .line 314
    .local v1, sb:Ljava/lang/StringBuilder;
    const/4 v0, -0x1

    .line 315
    .local v0, i:I
    invoke-virtual {p0}, Ljava/lang/String;->length()I

    move-result v2

    add-int/lit8 v0, v2, -0x1

    :goto_0
    if-ltz v0, :cond_0

    .line 317
    invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->charAt(I)C

    move-result v2

    if-ne v2, p1, :cond_0

    .line 315
    add-int/lit8 v0, v0, -0x1

    goto :goto_0

    .line 323
    :cond_0
    const/4 v2, 0x0

    add-int/lit8 v3, v0, 0x1

    invoke-virtual {v1, v2, v3}, Ljava/lang/StringBuilder;->substring(II)Ljava/lang/String;

    move-result-object v2

    return-object v2
.end method

# virtual methods
.method public getDisplayMode()I
    .locals 1

    .prologue
    .line 265
    iget v0, p0, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->serialNumber:I

    shr-int/lit8 v0, v0, 0xe

    and-int/lit8 v0, v0, 0x3

    if-nez v0, :cond_0

    const/4 v0, 0x0

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x1

    goto :goto_0
.end method

.method public getMessageBody()Ljava/lang/String;
    .locals 1

    .prologue
    .line 261
    iget-object v0, p0, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->messageBody:Ljava/lang/String;

    return-object v0
.end method

.method public getMessageID()I
    .locals 1

    .prologue
    .line 257
    iget v0, p0, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->messageID:I

    return v0
.end method

.method public getPdu()[B
    .locals 1

    .prologue
    .line 270
    iget-object v0, p0, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->mPdu:[B

    return-object v0
.end method

.method public getSerialNumber()I
    .locals 1

    .prologue
    .line 253
    iget v0, p0, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->serialNumber:I

    return v0
.end method

.method public getUserDataHeader()Lcom/android/internal/telephony/SmsHeader;
    .locals 1

    .prologue
    .line 279
    iget-object v0, p0, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->userDataHeader:Lcom/android/internal/telephony/SmsHeader;

    return-object v0
.end method

.method public getWarningSecurityInfo()[B
    .locals 1

    .prologue
    .line 287
    iget-object v0, p0, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->etwsWarningSecurityInfo:[B

    return-object v0
.end method

.method public getWarningType()I
    .locals 1

    .prologue
    .line 283
    iget v0, p0, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->etwsWarningType:I

    return v0
.end method

.method public isETWSMessage()Z
    .locals 2

    .prologue
    .line 291
    iget v0, p0, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->messageID:I

    const/16 v1, 0x1100

    if-lt v0, v1, :cond_0

    iget v0, p0, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->messageID:I

    const/16 v1, 0x1107

    if-gt v0, v1, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public isETWSNeedAlert()Z
    .locals 2

    .prologue
    const/4 v0, 0x1

    .line 295
    iget v1, p0, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->serialNumber:I

    shr-int/lit8 v1, v1, 0xd

    and-int/lit8 v1, v1, 0x1

    if-ne v1, v0, :cond_0

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public isETWSNeedPopup()Z
    .locals 2

    .prologue
    const/4 v0, 0x1

    .line 299
    iget v1, p0, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->serialNumber:I

    shr-int/lit8 v1, v1, 0xd

    and-int/lit8 v1, v1, 0x1

    if-ne v1, v0, :cond_0

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

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

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

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

    const-string v1, "CB Msg: Serial number = "

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

    move-result-object v0

    iget v1, p0, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->serialNumber:I

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

    move-result-object v0

    const-string v1, ", message identifier = "

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

    move-result-object v0

    iget v1, p0, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->messageID:I

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

    move-result-object v0

    const-string v1, ", hasUDH = "

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

    move-result-object v1

    iget-object v0, p0, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->userDataHeader:Lcom/android/internal/telephony/SmsHeader;

    if-eqz v0, :cond_0

    const/4 v0, 0x1

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

    move-result-object v0

    const-string v1, ", totalPage = "

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

    move-result-object v0

    iget v1, p0, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->totalPage:I

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

    move-result-object v0

    const-string v1, ", pageIndex = "

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

    move-result-object v0

    iget v1, p0, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->pageIndex:I

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

    move-result-object v0

    const-string v1, ", message Body = "

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

    move-result-object v0

    iget-object v1, p0, Lcom/android/internal/telephony/gsm/GsmCbSmsMessage;->messageBody:Ljava/lang/String;

    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

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method


text:
require 'rails/generators'
require 'generators/user_plane/view/helpers'

module UserPlane # :nodoc:
  module Generators # :nodoc:
    module View
      class InvitesGenerator < Rails::Generators::NamedBase # :nodoc:
        include UserPlane::Generators::View::Helpers

        def copy_view_files
          create_root_folder

          view_for_resource :new, 'send_sign_up_invite', ['recipient:string']
          #TODO: add a hidden field for the invite code
          view_for_resource :edit, 'sign_up_with_invite', ['user_name:string',
                                                           'email:string',
                                                           'password:password',
                                                           'password_confirmation:password']
        end
      end
    end
  end
end


text:
define(['ResourceView'], function(ResourceView) {
	var HomeLevelResourceView = Backbone.View.extend({
		tagName: 'li',
		className: 'sp resource-type',
		template: _.template($('#home_level_resource_template').html()),

		events: {
			'click .resource-type-heading' : 'clickHeading',
			'click .more' : 'clickHeading'
		},

		initialize: function(options) {
			this.resourceFilterController = options.resourceFilterController;

			this.listenTo(this.collection, 'sync', this.renderPreviewResources);
			this.listenTo(this.collection, 'request', this.showLoading);
			this.listenTo(this.collection, 'sync', this.updateCount);
		},

		render: function() {
			this.$el.html(this.template({
				'title' : this.collection.title
			}));
			return this;
		},

		clickHeading: function(e) {
			e.stopPropagation();
			this.collection.trigger('click-level');
		},

		showLoading: function() {
			this.$('.badge').text('...');
		},

		updateCount: function() {
			var count = this.collection.state.count;
			this.$('.badge').text(count);
		},

		renderPreviewResources: function() {
			this.$('.results-preview').empty();

			if (this.resourceFilterController.getQueryString()) {
				var three = this.collection.fullCollection.first(3);

				_.each(three, function(model) {
					var view = new ResourceView({model:model});
					this.$('.results-preview').append(view.render().el);
				}, this);

				this.updateMore(true, three.length);
			} else {
				this.updateMore(false, 0);
			}
		},

		updateMore: function(show, num_previewed) {
			total = this.collection.state.count;

			if (show && (total-num_previewed) > 0) {
				this.$('.more').show().text(total - num_previewed + ' more...');
			} else {
				this.$('.more').empty().hide();
			}
		}

	});

	return HomeLevelResourceView;
});


text:
from unicornclient import spy
from unicornclient import routine
from unicornclient import message
from unicornclient import version

class Routine(routine.Routine):
    def __init__(self):
        routine.Routine.__init__(self)

    def process(self, data):
        action = data['action'] if 'action' in data else None

        if action == 'authenticate':
            self.authenticate()
        elif action == 'install':
            secret = data['secret'] if 'secret' in data else None
            spy.save_secret(secret)

    def authenticate(self):
        payload = {
            'type':'auth',
            'secret': spy.load_secret(),
            'version': version.VERSION,
        }
        self.mission.send(message.Message(payload))


text:
module BubbleWrap
  SETTINGS = {}

  def self.debug=(val)
    BubbleWrap::SETTINGS[:debug] = val
  end

  def self.debug?
    BubbleWrap::SETTINGS[:debug]
  end

end

BW = BubbleWrap unless defined?(BW)