text:
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInspection.unneededThrows;

import com.intellij.codeInsight.ExceptionUtil;
import com.intellij.codeInsight.daemon.JavaErrorMessages;
import com.intellij.codeInsight.daemon.impl.analysis.JavaHighlightUtil;
import com.intellij.codeInsight.daemon.impl.quickfix.MethodThrowsFix;
import com.intellij.codeInspection.*;
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspectionBase;
import com.intellij.psi.*;
import com.intellij.util.ArrayUtil;
import com.siyeh.ig.JavaOverridingMethodUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;

import java.util.*;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @author anna
 * @since 15-Nov-2005
 */
public class RedundantThrowsDeclarationLocalInspection extends AbstractBaseJavaLocalInspectionTool implements CleanupLocalInspectionTool {
  private final RedundantThrowsDeclarationInspection myGlobalTool;

  @TestOnly
  public RedundantThrowsDeclarationLocalInspection() {this(new RedundantThrowsDeclarationInspection());}

  public RedundantThrowsDeclarationLocalInspection(@NotNull RedundantThrowsDeclarationInspection tool) {myGlobalTool = tool;}

  @Override
  @NotNull
  public String getGroupDisplayName() {
    return myGlobalTool.getGroupDisplayName();
  }

  @Override
  @NotNull
  public String getDisplayName() {
    return myGlobalTool.getDisplayName();
  }

  @Override
  @NotNull
  public String getShortName() {
    return myGlobalTool.getShortName();
  }

  @Nullable
  @Override
  public ProblemDescriptor[] checkMethod(@NotNull PsiMethod method, @NotNull InspectionManager manager, boolean isOnTheFly) {
    return checkExceptionsNeverThrown(method, manager);
  }

  @Nullable
  private ProblemDescriptor[] checkExceptionsNeverThrown(PsiMethod method,
                                                         InspectionManager inspectionManager) {
    if (method instanceof SyntheticElement) return null;
    PsiClass containingClass = method.getContainingClass();
    if (containingClass == null || JavaHighlightUtil.isSerializationRelatedMethod(method, containingClass)) return null;

    PsiCodeBlock body = method.getBody();
    if (body == null) return null;

    if (myGlobalTool.IGNORE_ENTRY_POINTS && UnusedDeclarationInspectionBase.isDeclaredAsEntryPoint(method)) {
      return null;
    }

    ReferenceAndType[] thrownExceptions = getThrownCheckedExceptions(method);
    if (thrownExceptions.length == 0) return null;

    PsiModifierList modifierList = method.getModifierList();
    boolean needCheckOverridingMethods = !(modifierList.hasModifierProperty(PsiModifier.PRIVATE) ||
                                            modifierList.hasModifierProperty(PsiModifier.STATIC) ||
                                            modifierList.hasModifierProperty(PsiModifier.FINAL) ||
                                            method.isConstructor() ||
                                            containingClass instanceof PsiAnonymousClass ||
                                            containingClass.hasModifierProperty(PsiModifier.FINAL));
    Collection<PsiClassType> unhandled = RedundantThrowsGraphAnnotator.getUnhandledExceptions(body, method, containingClass);
    List<ReferenceAndType> candidates = Arrays.stream(thrownExceptions)
      .filter(refAndType -> unhandled.stream().noneMatch(unhandledException -> unhandledException.isAssignableFrom(refAndType.type) || refAndType.type.isAssignableFrom(unhandledException)))
      .collect(Collectors.toList());

    if (candidates.isEmpty()) return null;
    if (needCheckOverridingMethods) {

      Set<String> thrownExceptionShortNames = candidates.stream().map(refAndType -> refAndType.type.getClassName()).collect(Collectors.toSet());
      Predicate<PsiMethod> methodContainsThrownExceptions = m -> Arrays.stream(m.getThrowsList().getReferencedTypes())
        .map(PsiClassType::getClassName)
        .anyMatch(thrownExceptionShortNames::contains);
      Stream<PsiMethod> overridingMethods = JavaOverridingMethodUtil.getOverridingMethodsIfCheapEnough(method, null, methodContainsThrownExceptions);
      if (overridingMethods == null) return null;

      Iterator<PsiMethod> overridingMethodIt = overridingMethods.iterator();
      while (overridingMethodIt.hasNext()) {
        PsiMethod m = overridingMethodIt.next();
        PsiClassType[] overridingMethodThrownException = m.getThrowsList().getReferencedTypes();

        candidates.removeIf(refAndType -> {
          PsiClassType type = refAndType.type;
          return ArrayUtil.contains(type, overridingMethodThrownException);
        });

        if (candidates.isEmpty()) return null;
      }
    }

    return candidates.stream().map(exceptionType -> {
      PsiJavaCodeReferenceElement reference = exceptionType.ref;
      String description = JavaErrorMessages.message("exception.is.never.thrown", JavaHighlightUtil.formatType(exceptionType.type));
      LocalQuickFix quickFix = new MethodThrowsFix(method, exceptionType.type, false, false);
      return inspectionManager.createProblemDescriptor(reference, description, quickFix, ProblemHighlightType.LIKE_UNUSED_SYMBOL, true);
    }).toArray(ProblemDescriptor[]::new);
  }

  private static ReferenceAndType[] getThrownCheckedExceptions(PsiMethod method) {
    return Stream
      .of(method.getThrowsList().getReferenceElements())
      .map(ref -> {
        PsiElement resolved = ref.resolve();
        return resolved instanceof PsiClass && !ExceptionUtil.isUncheckedException((PsiClass)resolved) ? new ReferenceAndType(ref) : null;
      })
      .filter(Objects::nonNull)
      .toArray(ReferenceAndType[]::new);
  }

  private static class ReferenceAndType {
    private final PsiJavaCodeReferenceElement ref;
    private final PsiClassType type;

    private ReferenceAndType(@NotNull PsiJavaCodeReferenceElement ref) {
      this.ref = ref;
      type = JavaPsiFacade.getElementFactory(ref.getProject()).createType(ref);
    }
  }
}


text:
require 'spec_helper'

describe HttpReader::HashPageParser do
  subject { described_class }

  let(:pattern) { /^((http|https):\/\/).*$/ }

  context 'self' do
    it '#pattern cover every url' do
      expect(subject.pattern).to eq pattern
    end

    context '#match' do
      it 'returns true for url string' do
        expect(subject.match('http://some_url')).to eq true
      end

      it 'returns false for non url string' do
        expect(subject.match('some_fake_url')).to eq false
      end
    end

    context '#parse' do
      let(:body)     { '
Information

not importante

Items:

A

B

C

' }
      let(:opts)     { {title: 'h1', items: '.content li;array'} }
      let(:response) { double('response', body: body) }
      let(:result)   { {:title=>"Information", :items=>%w{A B C}} }
      it 'returns body' do
        expect(subject.parse(response, opts)).to eq result
      end
    end
  end
end

redpajama_set_name: RedPajamaGithub


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

<TITLE>
DataTypeController
</TITLE>

<META NAME="date" CONTENT="2012-10-20">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

org.epri.pt2.controller

Class DataTypeController

java.lang.Object
  org.epri.pt2.listeners.ViewCallback
      org.epri.pt2.controller.DataTypeController

public class DataTypeController
extends ViewCallback

Author:

root

Method Summary

 DataTypeDO
addDataType(DataTypeDO dataType)

          Add a data type to the database.

 DataTypeDO
addDataType(FuzzTestDO fuzzTest,
            DataTypeDO dataType)

          Add a data type to the fuzzTest.

 DataTypeDO
addDataType(int currentFuzzTestId,
            DataTypeDO dataType)

          Add a data type to the fuzzTest.

 DataTypeDO
getDataType(int id)

          Get a specific test case.

 DataTypeDO
getDataType(java.lang.String type)

          Get data type by type

 java.util.List<DataTypeDO>
getDataTypes()

          Get all data types

 java.util.List<DataTypeDO>
getDataTypes(int fuzzTestid)

          List all test cases in the fuzzTest.

static DataTypeController
getInstance()

          Get an instance of the controller.

 void
removeDataType(int fuzzTestId,
               int dataTypeId)

          Remove a data type from the fuzzTest.

 DataTypeDO
updateDataType(DataTypeDO dataType)

          Update a data type.

Methods inherited from class org.epri.pt2.listeners.ViewCallback

registerListener, removeListener

Methods inherited from class java.lang.Object

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

Method Detail

getInstance

public static DataTypeController getInstance()

Get an instance of the controller.

Returns:

addDataType

public DataTypeDO addDataType(DataTypeDO dataType)

Add a data type to the database.

Parameters:
DataType -

Returns:

addDataType

public DataTypeDO addDataType(FuzzTestDO fuzzTest,
                              DataTypeDO dataType)

Add a data type to the fuzzTest.

Parameters:
fuzzTest -
dataType -

Returns:

addDataType

public DataTypeDO addDataType(int currentFuzzTestId,
                              DataTypeDO dataType)

Add a data type to the fuzzTest.

Parameters:
currentFuzzTestId -
DataType -

Returns:

removeDataType

public void removeDataType(int fuzzTestId,
                           int dataTypeId)

Remove a data type from the fuzzTest.

Parameters:
fuzzTestId -
DataTypeId -

updateDataType

public DataTypeDO updateDataType(DataTypeDO dataType)

Update a data type.

Parameters:
DataType -

getDataTypes

public java.util.List<DataTypeDO> getDataTypes(int fuzzTestid)

List all test cases in the fuzzTest.

Parameters:
fuzzTestid -

Returns:

getDataType

public DataTypeDO getDataType(int id)

Get a specific test case.

Parameters:
id -

Returns:

getDataType

public DataTypeDO getDataType(java.lang.String type)

Get data type by type

Returns:

getDataTypes

public java.util.List<DataTypeDO> getDataTypes()

Get all data types

Returns:

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD


text:
/*
 * counts the number of times each word occurs in stream supplied to standard
 * input. prints words in ascending order of frequency.
 */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

#include "ap_getline.h"
#include "uthash.h"

/* a struct to store word -> count mappings */
typedef struct {
	char* word;
	int count;
	UT_hash_handle hh;
} word_count_t;

/* function to compare two word_count_t structs by count */
int compare_count(word_count_t* a, word_count_t* b) {
	return (a->count - b->count);
}

int main() {

	word_count_t* concordance = NULL;
	word_count_t* word_count = NULL;
	word_count_t* tmp = NULL;
	char* line;
	int len;

	while (!feof(stdin)) {
		len = ap_getline(&line, stdin);

		/* iterate through each word in line */
		char* word;
		word = strtok(line, " \n");
		while (word != NULL) {
			/* find word count in hash */
			HASH_FIND_STR(concordance, word, word_count);
			/* if found, update count */
			if (word_count != NULL) {
				word_count->count++;
			}
			/* otherwise, alloc a new structure and add it to the hash */
			else {
				word_count = (word_count_t*)malloc(sizeof(word_count_t));
				/* malloc word, copy into it */
				word_count->word = (char*)malloc(strlen(word)+1);
				strcpy(word_count->word, word);
				word_count->count = 1;
				HASH_ADD_KEYPTR(hh, concordance, word_count->word,
						strlen(word_count->word), word_count);
			}
			word = strtok(NULL, " \n");
		}

		free(line);
	}

	/* sort by count */
	HASH_SORT(concordance, compare_count);

	/* iterate through the hash, deleting and freeing as we go */
	HASH_ITER(hh, concordance, word_count, tmp) {
		printf("%s: %d\n", word_count->word, word_count->count);
		HASH_DEL(concordance, word_count);
		free(word_count->word);
		free(word_count);
	}

	return 0;

}


text:
The first Repository of Duwei

This file belongs to the "HelloFirst" branch.Something changed.


text:
<!doctype html>

  <meta charset="utf-8">

  <title>Ira Ritchie Meek</title>
  <meta name="description" content="Ira's Dev Academy Website">
  <meta name="author" content="SitePoint">

  <link rel="stylesheet" href="css/blog.css">

Ira's Blog

Contact About Projects

Cyber Security

      An issue facing the tech industry currently is cybersecurity. A company may have to weigh up whether it's worth moving data onto cloud storage where it may be more vulnerable or whether to encrypt data etc.. A lot of buinesses don't give enough attention to cyber security until after an attack because it is often not a pressing issue until it happens but it can result in financial losses, intellectual property theft, reputational damage, fraud and many other negative impacts on buinesses.

Map, Map!

      In ruby the method 'Map' apply's code to each seperate thing in an array. For example if you wanted to add something onto the end of each element in your array  streams =[karearea, kakapo, hihi]  streams.map {|stream| puts stream + ' is a type of bird'}  would give you karearea is a type of bird kakapo is a type of bird  hihi is a type of bird. 'Map!' does the same except instead of returning a new array it edits the original.

Thinking Style

      My Gregorc thinking style is Abstract Sequential. A trait of this thinking style that may affect my time at EDA positively is that this thinking style enjoys applying logic in solving or finding solutions to problems. Abstract Sequential thinkers also learn best when they have access to experts so EDA should be the perfect environment for learning with this thinking style. Concrete Random was very close behind in the thinking style test. The fact that this type of thinker enjoys experimenting to find solutions could benifit me during my time at EDA.

      The biggest struggle for me so far in phase 0 has probably been the ruby exercises this week. I found it tough interpreting some of the ruby excersise tasks due to being new to ruby, which is listed as a issue Abstract Sequential thinkers may have a hard time getting past. However I got past this through a lot of trial and error which is a trait of Concrete Random thinkers.

The difference betweens arrays and hashes

      In Ruby an array is just like a list, it is data stored in an order. You can look up each data entry by using the number it comes on the list. For example if our list was 'Red, White, Blue', colour_array[0] would give you "Red" and colour_array[1] would give you "White"

      Hashes are very similar to arrays, however instead of using a number to look up each thing on the list you use a unique name called a key that you have assigned to each list item. For example if you were to make the list 'Musician - Michael Jackson, Actor - George Clooney, Artist - Pablo Picasso' famous_hash["Musician"] would give you "Michael Jackson" and famous_hash["Artist"] would give you "Pablo Picasso".

The difference between Margins, Borders, and Padding

      Firstly, a border is like an outline and in css this can be used to outline div, text or just about anything. In css there are many different attributes you can apply to a border such as thickness, style, color, and you can even define if you want a full border or just specific sides. I have included an example of a border and the code that it uses.

      The padding tag relates strongly to the border tag as it defines the space inside the border. By default the border will wrap as close to the content as possible, and with padding you can have control over this. If you don't want a border padding is still important, as it defines space around your content that should be left empty. Here is an example of padding in use and the code used to create it.

      Margin is very similar to padding except instead of defining the space inside the border it defines the space outside the border. Effectively clearing an area around your content.

The EDA Experience

    For me as a student fresh out of high school what stood out about the EDA experience is the approach of not grading submissions on how good they are and instead looking at how engaged you are in the content and how well you are progressing. I feel this is a very clever way of doing it as everyone is different and will learn and expresses differently.
      Another point that stood out to is the EQ factor of EDA, something that is never even mentioned in High School. IQ can only take you so far, improving your EQ will help your ability to control emotions, learn and progress.

      I hope to engage well in the culture of Dev Academy the only thing I am worried about is that I think of myself as more of an introvert and may have a bit of trouble engaging in some of the peer based work, although I and am excited to work harder than I ever have before and hopefully get past this.

      When I first signed up for Dev Academy I thought it would be very similar to a University course, just shorter. But now I realize it is much more. It's a fully immersive program that focuses on teaching a base of knowledge that will allow you to get paid to learn more.This base of knowledge is not only coding, but also a lot of soft skills that employers look for.


text:
import * as pd from 'polymer-ts-decorators';
import { PageBehavior, IPageElement } from '../pages/page-behavior';

export type ICodeMirrorEditorPageElement = IPageElement & CodeMirrorEditorPageElement;

@pd.is('hydragon-code-mirror-editor-page')
@pd.behaviors(PageBehavior)
export default class CodeMirrorEditorPageElement extends Polymer.BaseClass<any, IPageElement>() {
  @pd.property({ type: Object, notify: true })
  editorConfig: CodeMirror.EditorConfiguration;

  factoryImpl(title: string, config?: CodeMirror.EditorConfiguration): void {
    this.title = title;
    this.editorConfig = config || this.editorConfig;
  }
}


text:
{% extends 'layout.html' %}

{% block title %}
Courses: Submissions Filter
{% endblock %}

{% block statusbar %}
{% endblock %}

{% block extrahead %}

{% endblock %}

{% block body %}

Submission Filter

Back to Course

Filter Criteria

Student:
<select id='search-students'>
<option value=''></option>
{% for student in students %}
<option value='{{ student.id }}'
{%- if criteria == "student" and search_key == student.id %} selected
{%- endif %} >{{ student.last_name}}, {{ student.first_name }}</option>
{% endfor %}
</select>

Assignment:
<select id='search-assignments'>
<option value=''></option>
{% for assignment in assignments %}
<option value='{{ assignment.id }}'
{%- if criteria == "assignment" and search_key == assignment.id %} selected
{%- endif %} >{{ assignment.title() }}</option>
{% endfor %}
</select>

    {% if criteria=="student" %}Assignment	{%endif %}
    {% if criteria=="assignment" %}Student	{%endif %}
    Correct
    Status
    View
    Touches

{% for submission in submissions %}

    {% if criteria=="student" %}{{ submission[2].title() }}	{%endif %}
    {% if criteria=="assignment" %}{{ submission[1].name() }}	{%endif %}
    {% if submission[0].correct%}Yes{% else %}No{% endif %}
    {{ submission[0].status }}
    {% if submission[0] != None -%}
    View{% endif %}
    {{ submission[0].version or "0"}}

{% endfor %}

{% endblock %}


text:
package org.hibernate.examples.mapping.associations.unidirectional;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.examples.model.AbstractHibernateEntity;
import org.hibernate.examples.utils.HashTool;
import org.hibernate.examples.utils.ToStringHelper;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

/**
 * org.hibernate.examples.mapping.associations.unidirectional.Cloud
 *
 * @author 배성혁 sunghyouk.bae@gmail.com
 * @since 2013. 11. 29. 오후 3:59
 */
@Entity
@DynamicInsert
@DynamicUpdate
@Getter
@Setter
public class Cloud extends AbstractHibernateEntity<Long> {

    @Id
    @GeneratedValue
    private Long id;

    private String type;

    private Double length;

    @OneToMany(cascade = { CascadeType.ALL })
    @JoinTable
    private Set<SnowFlake> producedSnowFlakes = new HashSet<SnowFlake>();

    @Override
    public int hashCode() {
        return HashTool.compute(type, length);
    }

    @Override
    public ToStringHelper buildStringHelper() {
        return super.buildStringHelper()
                    .add("type", type)
                    .add("length", length);
    }

    private static final long serialVersionUID = 8894797675268174082L;
}


text:
class Rack::Magento::SetOrigUri

  def initialize app
    @app = app
  end

  def call env
    # Workaround get magento to recognise request path
    # Mage_Core_Controller_Request_Http::getHttpHost() changes parent signature, so that zend router will not remove the
    # port from the URI in Zend_Controller_Request_Http::setRequestUri()
    uri = URI.parse(env['REQUEST_URI'])
    env['HTTP_X_ORIGINAL_URL'] = uri.request_uri
    @app.call env
  end
end


text:
local helpers = require "spec.helpers"
local cjson = require "cjson"

describe("Resolver", function()
  local admin_client

  setup(function()
    assert(helpers.start_kong({
      custom_plugins = "database-cache",
      lua_package_path = "?/init.lua;./kong/?.lua;./spec/fixtures/?.lua"
    }))
    admin_client = helpers.admin_client()

    assert(helpers.dao.apis:insert {
      request_host = "mockbin.com",
      upstream_url = "http://mockbin.com"
    })

    local res = assert(admin_client:send {
      method = "POST",
      path = "/apis/mockbin.com/plugins/",
      body = {
        name = "database-cache"
      },
      headers = {
        ["Content-Type"] = "application/json"
      }
    })
    assert.res_status(201, res)
  end)
  teardown(function()
    if admin_client then admin_client:close() end
    helpers.stop_kong()
  end)

  it("avoids dog-pile effect", function()
    local function make_request(premature, sleep_time)
      local client = helpers.proxy_client()
      assert(client:send {
        method = "GET",
        path = "/status/200?sleep="..sleep_time,
        headers = {
          ["Host"] = "mockbin.com"
        }
      })
      client:close()
    end

    assert(ngx.timer.at(0, make_request, 2))
    assert(ngx.timer.at(0, make_request, 5))
    assert(ngx.timer.at(0, make_request, 1))

    helpers.wait_until(function()
      local res = assert(admin_client:send {
        method = "GET",
        path = "/cache/invocations"
      })
      local body = assert.res_status(200, res)
      return cjson.decode(body).message == 3
    end, 10)

    -- Invocation are 3, but lookups should be 1
    local res = assert(admin_client:send {
      method = "GET",
      path = "/cache/lookups"
    })
    local body = assert.res_status(200, res)
    assert.equal(1, cjson.decode(body).message)

    ngx.sleep(1) -- block to allow timers requests to finish
  end)
end)


text:
(function() {
	function namespace(names) {
		if (!names.length)
			return this;
		var space = this[names[0]] = this[names[0]] || {};
		return namespace.call(space, names.slice(1));
	};

	window.namespace = function(namesSTR) {
		return namespace(namesSTR.split('.'));
	};
})();


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Gayana, Botanica 55(2): 142 (1998)

#### Original name
Usnea durietzii Motyka

### Remarks
null


text:
This library contains support for temporal-iterative map/reduce (TIMR; Haynes 2014), along with an implementation
for the Schimmmy pattern (Lin & Dyer 2010) under iterative map/reduce.  Developers who wish to leverage TIMR
may instantiate a sequence of TIMR jobs via
[TIMRJob](http://brandonhaynes.github.io/timr/#org.brandonhaynes.timr.TIMRJob) and base a reducer on
[TIMRReducer](http://brandonhaynes.github.io/timr/#org.brandonhaynes.timr.TIMRReducer).

For jobs with large numbers of iterations, a significant performance gain may be realized by periodic checkpointing;
see
[org.brandonhaynes.timr.checkpoints](http://brandonhaynes.github.io/timr/#org.brandonhaynes.timr.checkpoints.package)
for more details.

TIMR jobs differ from their ordinary counterparts by allowing, for each key, reduction over the values that were
output during prior steps of the iterative process.  So, if a reducer output the value v at some prior step of the
iterative job, it will (i) have access to that value v during all subsequent steps, and (ii) know the precise steps
during which the value v was emitted.

In a traditional reduce function, a sequence of values is presented as an argument.  Under a TIMR reducer,
a sequence of temporal pairs is presented, where each pair contains a value and its associated validity interval.
This interval may be used to determine which steps the value was "valid" (i.e., not overwritten by some subsequent
value).

In addition to the added utility by having access to the previous values associated with a given key throughout
the iterative process, TIMR increases algorithm performance under some types of iterative jobs.  It does so under
the temporal normal form (TNF) assumption -- no value will be emitted from a reducer if it is unchanged from the
most previously-emitted value.  It is important for any developer to observe this invariant to maximize performance.

By aggregating prior values and assuming TNF, TIMR allows developers to avoid forward-propagating state that is
needed during subsequent states, and requires the shuffling only of MUTATIONS to values.  Accordingly, for
concrete implementations that have few mutations relative to the size of the data that must be forward-propagated,
TIMR may offer a substantial performance benefit.

```scala
class MyReducer extends org.brandonhaynes.timr.TIMRReducer[MyKey, MyValue] {
  override def reduce(key:MyKey, values:Iterator[TemporalPair[MyValue]], context:Context) = {
    ...
  }
}
```

... Or ...

```scala
class MyReducer extends org.brandonhaynes.timr.TIMRReducer[MyKey, MyValue] {
  override def reduce(key:MyKey,
                      previous:Iterator[TemporalPair[MyValue]],
                      intermediate:Iterator[TemporalPair[MyValue]],
                      context:Context) = {
    ...
  }
}
```

### Single-Source Breadth-First Search (SS-BFS) under TIMR

To demonstrate the utility of TIMR under algorithms that mutate a small number of pairs relative to the size of the
 input, three implementations of SS-BFS are included: an "ordinary" implementation, one that utilizes the Schimmy
 pattern, and one that utilizes TIMR.  See
 [org.brandonhaynes.bfs](http://brandonhaynes.github.io/timr/#org.brandonhaynes.bfs.package) for more details.

 To execute under TIMR from the command line, select an algorithm and execute as:

 ```
hadoop jar TIMR.jar -input hdfs:///input-graph
                    -D localOutputPath=file:///a-local-path
                    -D verbose=true
                    -D partitions=2
                    -D steps=3
                    -D checkpoints=10,15
                    -D algorithm=timr
 ```

Note that the above implementation utilizes checkpointing; for optimal performance, these values should be adjusted
depending on the branching factor of the input graph.

Performance under a naive implementation may be contrasted via the following command line:

```
hadoop jar TIMR.jar -input hdfs:///input-graph
                    -D localOutputPath=file:///a-local-path
                    -D verbose=true
                    -D steps=3
                    -D algorithm=naive
 ```

Input graphs are assumed to be in adjacency form that may be parsed as
[VertexMetadata](http://brandonhaynes.github.io/timr/#org.brandonhaynes.bfs.VertexMetadata).  For example:

```
1000  (0, [1001, 1002])
1001  []
1002  [1003]
1003  [1001]
```

Here the distance `0` associated with vertex 1000 represents the origin of the SS-BFS; all other nodes are assumed
o have unknown distance.  During each iteration of the iterative process, the search frontier will be expanded
 by one unit (e.g., after two iterations the value associated with vertex 1003 will be `(2, [1001])`).


text:
#include < system.h >

/* Defines a GDT entry. We say packed, because it prevents the
 *  compiler from doing things that it thinks is best: Prevent
 *  compiler "optimization" by packing */
struct gdt_entry
{
	unsigned short limit_low;
	unsigned short base_low;
	unsigned char base_middle;
	unsigned char access;
	unsigned char granularity;
	unsigned char base_high;
} __attribute__((packed));

/* Special pointer which includes the limit: The max bytes
 *  taken up by the GDT, minus 1. Again, this NEEDS to be packed */
struct gdt_ptr
{
	unsigned short limit;
	unsigned int base;
} __attribute__((packed));

/* Our GDT, with 3 entries, and finally our special GDT pointer */
struct gdt_entry gdt[3];
struct gdt_ptr gp;

/* This will be a function in start.asm. We use this to properly
 *  reload the new segment registers */
extern void gdt_flush();


text:
package org.apache.sling.launchpad.webapp.integrationtest.login;

import static org.junit.Assert.assertEquals;

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

import javax.servlet.http.HttpServletResponse;

import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.sling.commons.testing.integration.HttpTest;
import org.apache.sling.commons.testing.junit.categories.JackrabbitOnly;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;

/** Verify that redirect to resource after logout works */
public class RedirectOnLogoutTest {

    private final HttpTest H = new HttpTest();

    @Before
    public void setup() throws Exception {
        H.setUp();
    }

    @After
    public void cleanup() throws Exception {
        H.tearDown();
    }

    /**
     * Test SLING-1847
     * @throws Exception
     */
    @Test
    @Category(JackrabbitOnly.class) // TODO: fails on Oak
    public void testRedirectToResourceAfterLogout() throws Exception {
    	//login
        List<NameValuePair> params = new ArrayList<NameValuePair>();
        params.add(new NameValuePair("j_username", "admin"));
        params.add(new NameValuePair("j_password", "admin"));
        H.assertPostStatus(HttpTest.HTTP_BASE_URL + "/j_security_check", HttpServletResponse.SC_MOVED_TEMPORARILY, params, null);

        //...and then...logout with a resource redirect
        String locationAfterLogout = HttpTest.SERVLET_CONTEXT + "/system/sling/info.sessionInfo.json";
        final GetMethod get = new GetMethod(HttpTest.HTTP_BASE_URL + "/system/sling/logout");
        NameValuePair [] logoutParams = new NameValuePair[1];
        logoutParams[0] = new NameValuePair("resource", locationAfterLogout);
        get.setQueryString(logoutParams);

        get.setFollowRedirects(false);
        final int status = H.getHttpClient().executeMethod(get);
        assertEquals("Expected redirect", HttpServletResponse.SC_MOVED_TEMPORARILY, status);
        Header location = get.getResponseHeader("Location");
        assertEquals(HttpTest.HTTP_BASE_URL + locationAfterLogout, location.getValue());
    }
}


text:
'use strict';

var setupRoutes = function(app) {

  app.get('/', function(req, res) {
    res.send('Hello World!');
  });

  app.get('/welcome', function(req, res) {
    res.send('Welcome!');
  });

};

module.exports = {
  setupRoutes: setupRoutes
};

// app.get('/:country/:language/product/:pid', function(req, res) {
  //   res.send(req.params);
  // });

  // app.get('/user/:user', function(req, res) {
  //   var template = fs.readFileSync('./demo/2_Express/views/user.hbs').toString();

  //   var html = handlebars.compile(template)({
  //     user: req.params.user
  //   });

  //   res.send(html);
  // });

  // var controller = require('../controllers/controller');
  // var userMiddleware = require('../middleware/userMiddleware');

  // app.get('/user/:user',
  //   userMiddleware.getUser,
  //   controller.render
  // );


text:
import os, json, socket, struct, logging, time, urllib2, platform, threading

# Some day this will use "real" Zabbix auth and become more complicated.
ZABBIX_API_SERVER = 'zabbix-api.example.com'
ZABBIX_KEY = 'xyzzy-plugh-plover'

class ZabbixActiveSender(object):
    '''This will send values to Zabbix via the same mechanism zabbix_sender uses.
    '''
    def __init__(self, zabbixserver=None, prefix = None, no_send=False, clienthost=platform.node()):
        self.lock = threading.Lock()
        self.zabbixserver = zabbixserver
        self.clienthost = clienthost # This better be the FQDN
        logging.debug('ZAS.__init__: clienthost="%s"', self.clienthost)
        self.prefix = prefix
        self.no_send = no_send
        self.check_for_proxy()
        self.clear()
        logging.debug('ZAS.__init__: zabbixserver="%s"', str(self.zabbixserver))
        if os.environ.has_key('http_proxy'):
            del os.environ['http_proxy']
            logging.debug('ZAS.__init__: removed http_proxy from the environment')
        return

    def check_for_proxy(self):
        '''If the zabbixserver was specified, we trust that (e.g. for
        zabbix-stage.llnw.net).  Otherwise, we go looking for the proxy
        that owns us.
        '''
        if self.zabbixserver: return
        postdata = {
            "key": ZABBIX_KEY,
            "method": "proxymap.get",
            "params": {
                "hostnames": [ os.uname()[1] ],
                "output": "json"
                }
            }
        data = urllib2.urlopen('http://'+ZABBIX_API_SERVER+'/llnw/api_jsonrpc.php',json.dumps(postdata))
        self.zabbixserver = json.load(data)['result'][0]['proxy']
        return

    def __call__(self, key, value):
        '''Load up our dictionary with data preparatory to sending it on to Zabbix.
        If we're debugging, we'll immediately send each value, which makes it a
        *lot* easier to figure out where we've got problems.'''
        logging.debug('ZAS.__call__: %30s\t%s', key, value)
        if self.prefix: key = self.prefix+key
        self.lock.acquire()
        self.data.append({"key":key, "value":value, "host":self.clienthost, "clock":int(time.time())})
        self.lock.release()
        if logging.root.level < logging.INFO: self.send()
        return

    def send(self):
        '''Ship the data to Zabbix.  Call as often as you like, though of course
        it's more efficient to call it just once after you've accumulated
        all of the data you'd like to send.

        The magic in here with structs is required to format everything for
        Zabbix' wire protocol.  If this breaks, it's time to dive into the
        Zabbix internals again.

        '''
        self.lock.acquire()
        if not self.data:
            self.lock.release()
            return # Nothing to send!
        if not self.no_send:
            response = {"request":"agent data", "clock":int(time.time()), "data":self.data}
            string = json.dumps(response)
            logging.debug(string)
            string_to_send = 'ZBXD\x01%s%s' % (struct.pack('<q', len(string)), string)
            s = socket.create_connection((self.zabbixserver, 10051))
            s.sendall(string_to_send)
            s.shutdown(socket.SHUT_WR)
            try:
                retstring = s.recv(5)   # Header, don't care: 'ZBXD\01'
                datalen = struct.unpack('<q',s.recv(8))[0] # Length of data being returned
                retstring = s.recv(datalen)               # Actual return string
                logging.debug(retstring)
            except Exception as e:
                logging.debug('ZAS.send: Failed to get a proper response: %s (%s)', retstring, e)
        self.clear()
        self.lock.release()
        return

    def clear(self): self.data = []


text:
namespace GigHub.Migrations
{
    using System;
    using System.Data.Entity.Migrations;

    public partial class AddCityToApplicationUser : DbMigration
    {
        public override void Up()
        {
            AddColumn("dbo.AspNetUsers", "City", c => c.String(maxLength: 100));
        }

        public override void Down()
        {
            DropColumn("dbo.AspNetUsers", "City");
        }
    }
}


text:
@openperipheral.api.architecture.FeatureGroup("Thaumcraft")
package openperipheral.integration.thaumcraft;


text:
package event;

import java.util.EventListener;

/**
 * Event Listener for CopyEvent
 *
 * @author RK Sanayaima Singh
 *
 */
public interface CopyEventListener extends EventListener {
	/**
	 * method to be called when CopyEvent occurs
	 *
	 * @param ce
	 */
	public void copyEventOccured(CopyEvent ce);

}


text:
"""Stand-alone fitting utilities"""

import numpy as np
from scipy.special import gamma, psi

from ..misc import easylsq
from ..misc.errorvalue import ErrorValue

__all__ = ['fit_shullroess']

def fit_shullroess(q, Intensity, Error, R0=None, r=None):
    """Do a Shull-Roess fitting on the scattering data.

    Inputs:
        q: np.ndarray[ndim=1]
            vector of the q values (4*pi*sin(theta)/lambda)
        Intensity: np.ndarray[ndim=1]
            Intensity vector
        Error: np.ndarray[ndim=1]
            Error of the intensity (absolute uncertainty, 1sigma)
        R0: scalar
            first guess for the mean radius (None to autodetermine, default)
        r: np.ndarray[ndim=1]
            vector of the abscissa of the resulting size distribution (None to
            autodetermine, default)

    Output:
        A: ErrorValue
            the fitted value of the intensity scaling factor
        r0: the r0 parameter of the maxwellian size distribution
        n: the n parameter of the maxwellian size distribution
        r: the abscissa of the fitted size distribution
        maxw: the size distribution
        stat: the statistics dictionary, returned by nlsq_fit()

    Note: This first searches for r0, which best linearizes the
            log(Intensity) vs. log(q**2+3/r0**2) relation.
            After this is found, the parameters of the fitted line give the
            parameters of a Maxwellian-like particle size distribution function.
            After it a proper least squares fitting is carried out, using the
            obtained values as initial parameters.
    """
    q = np.array(q)
    Intensity = np.array(Intensity)
    Error = np.array(Error)
    if R0 is None:
        r0s = np.linspace(1, 2 * np.pi / q.min(), 1000)
        def naive_fit_chi2(q, Intensity, r0):
            p = np.polyfit(np.log(q ** 2 + 3 / r0 ** 2), np.log(Intensity), 1)
            return ((np.polyval(p, q) - Intensity) ** 2).sum() / (len(q) - 3)
        chi2 = np.array([naive_fit_chi2(q, Intensity, r0) for r0 in r0s.tolist()])
        R0 = r0s[chi2 == chi2.min()][0]
    def naive_fit(q, Intensity, r0):
        p = np.polyfit(np.log(q ** 2 + 3 / r0 ** 2), np.log(Intensity), 1)
        return np.exp(p[1]), -2 * p[0] - 4
    K, n = naive_fit(q, Intensity, R0)
    def SR_function(q, A, r0, n):
        return A * (q ** 2 + 3 / r0 ** 2) ** (-(n + 4.) * 0.5)
    p, dp, statdict = easylsq.nlsq_fit(q, Intensity, Error, SR_function, (K, R0, n))
    n = ErrorValue(p[2], dp[2])
    r0 = ErrorValue(p[1], dp[1])
    A = ErrorValue(p[0], dp[0])
    if r is None:
        r = np.linspace(np.pi / q.max(), np.pi / q.min(), 1000)
    return A, r0, n, r, maxwellian(r, r0, n), statdict

def maxwellian(r, r0, n):
    """Maxwellian-like distribution of spherical particles

    Inputs:
    -------
        r: np.ndarray or scalar
            radii
        r0: positive scalar or ErrorValue
            mean radius
        n: positive scalar or ErrorValue
            "n" parameter

    Output:
    -------
        the distribution function and its uncertainty as an ErrorValue containing arrays.
        The uncertainty of 'r0' and 'n' is taken into account.

    Notes:
    ------
        M(r)=2*r^n/r0^(n+1)*exp(-r^2/r0^2) / gamma((n+1)/2)
    """
    r0 = ErrorValue(r0)
    n = ErrorValue(n)

    expterm = np.exp(-r ** 2 / r0.val ** 2)
    dmaxdr0 = -2 * r ** n.val * r0.val ** (-n.val - 4) * ((n.val + 1) * r0.val ** 2 - 2 * r ** 2) * expterm / gamma((n.val + 1) * 0.5)
    dmaxdn = -r ** n.val * r0.val ** (-n.val - 1) * expterm * (2 * np.log(r0.val) - 2 * np.log(r) + psi((n.val + 1) * 0.5)) / gamma((n.val + 1) * 0.5)

    maxwellian = 2 * r ** n.val * r0.val ** (-n.val - 1) * expterm / gamma((n.val + 1) * 0.5)
    dmaxwellian = (dmaxdn ** 2 * n.err ** 2 + dmaxdr0 ** 2 * r0.err ** 2) ** 0.5
    return ErrorValue(maxwellian, dmaxwellian)


text:
<!DOCTYPE html>

  <title>Get A Function From A WSDL File</title>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <link rel="stylesheet" media="all" href="public/stylesheets/normalize.css" />
  <link rel="stylesheet" media="all" href="docco.css" />

Get A Function From A WSDL File

Table of Contents

                    Cakefile

                    DB.coffee

                    adapter.coffee

                    timer.coffee

                    delete_all.coffee

                    delete_one_dataset.coffee

                    get_all.coffee

                    get_one_dataset.coffee

                    post_one_dataset.coffee

                    put_one_dataset.coffee

                    delete_all.coffee

                    delete_one_ws.coffee

                    delete_one_ws_action.coffee

                    get_all_WSDL_files.coffee

                    get_one_WSDL_file.coffee

                    get_one_ws_action.coffee

                    post_one_ws.coffee

                    post_one_ws_action.coffee

                    put_one_ws.coffee

                    put_one_ws_action.coffee

                    server.coffee

This route is designed to return a named function of a named wsdlFile.

Requiring Dependencies

Require the modules we need for this class.
In addition, this also instantiates the database

require 'sugar'
Promise = require 'bluebird'
{resolve} = require 'path'
db = new require resolve process.cwd(), 'DB', 'DB.coffee'

Promised Record

This function returns a promise that will either resolve to the WSDL record, or reject into an error message.

Input: a RESTify request object

Output:

On success, the WSDL record with action taken from the request object. It must find the record in the database for it to succeed.

On failure, the error message "Either #{ws} or #{act} does not exist". It will reject if the record does not exist in the database.

promisedRecord = (rq) ->
	new Promise (resolve, reject) ->
		{ws, act} = rq.params
		wsdlFiles = db.getCollection 'wsdlFiles'
		query = [{wsdl: ws}, {action: act}]
		record = (wsdlFiles.find '$and': query)[0]
		reject "Either #{ws} or #{act} does not exist" if not record?
		resolve record

Send Action

This function logs the received record and sends back the retrieved WSDL to the requestor.

Input: a RESTify response object, a loki object

Output:

On success, returns nothing. It will log and send the record to the requestor.

On failure, it will only fail on an unexpected error.

sendAction = (rs, record) ->
	console.log record
	rs.write JSON.stringify record.io
	rs.end()

Error Catcher

This function logs an error and sends back the error message.

Input: a RESTify response object, an error message

Output: returns nothing. It will log and send the error to the requestor.

errorCatcher = (rs, error) ->
	console.log error
	rs.write "{\"error\": #{error}}"

Final Function

This function ends the response and moves on to the next middleware if defined

finalFunction = (rs, nx) ->
	rs.end()
	nx()

Route Definition

This will return the headers with HTTP 200 Status Code, and a JSON content type. Afterwards, it will take collection, take the stored data, and remove the meta and $loki tags.

module.exports = (rq, rs, nx) ->
	rs.writeHead 200, {"Content-Type": "application/json"}

	promisedRecord rq
	.then (record) ->
		sendAction rs, record
	.catch (error) ->
		errorCatcher rs, error
	.finalFunction ->
		finalFunction rs, nx

h


text:
class AddTableReadyToWaittimes < ActiveRecord::Migration[5.0]
  def change
    add_column :waittimes, :table_ready, :boolean, default: false
  end
end


text:
require 'spec_helper'

describe Libgss::ActionRequest do

  let(:network){ new_network }

  let(:request) do
    network.login
    network.new_action_request
  end

  shared_examples_for "Libgss::ActionRequest#get_by_int_range" do |input, output, conditions|
    [:get_int_range, :get_by_int_range].each do |action|
      describe "##{action}" do
        it action do
          callback_called = false
          request.send(action, "RequiredExperience", input, conditions)
          request.send_request do |outputs|
            callback_called = true
            outputs.length.should == 1
            outputs.first["result"].should == output
          end
          callback_called.should == true
        end
      end
    end

  end

  it_should_behave_like "Libgss::ActionRequest#get_by_int_range",   0,  1, nil
  it_should_behave_like "Libgss::ActionRequest#get_by_int_range",   9,  1, nil
  it_should_behave_like "Libgss::ActionRequest#get_by_int_range",  10,  2, nil
  it_should_behave_like "Libgss::ActionRequest#get_by_int_range",  24,  2, nil
  it_should_behave_like "Libgss::ActionRequest#get_by_int_range",  25,  3, nil

  cond = {"value$gte" => 10 }
  it_should_behave_like "Libgss::ActionRequest#get_by_int_range",   0, nil, cond
  it_should_behave_like "Libgss::ActionRequest#get_by_int_range",   9, nil, cond
  it_should_behave_like "Libgss::ActionRequest#get_by_int_range",  10, nil, cond
  it_should_behave_like "Libgss::ActionRequest#get_by_int_range",  24, nil, cond
  it_should_behave_like "Libgss::ActionRequest#get_by_int_range",  25, nil, cond

end


text:
using System;
using System.Data.Entity;
using CommuneCalculator.DB.Entities;
using CryptSharp;

namespace CommuneCalculator.DB.DbUtils
{
    public class DbInitializer : CreateDatabaseIfNotExists<ComCalcContext>
    {
        protected override void Seed(ComCalcContext context)
        {
            context.Roommates.Add(new Roommate
            {
                MoveInDate = DateTime.Today,
                IsTreasurer = true,
                Login = "admin",
                FirstName = "admin",
                LastName = "admin",
                PasswordHash = Crypter.Blowfish.Crypt("1n1t-R00t!")
            });

            context.SaveChanges();
        }
    }
}


text:
require 'action_mailer'

module Incline::Extensions

  ##
  # Adds the default_hostname, default_sender, and default_recipient methods to the ApplicationMailer::Base class.
  module ActionMailerBase

    ##
    # Adds the extra class methods to the ApplicationMailer::Base class.
    module ClassMethods
      ##
      # Gets the default hostname for messages.
      def default_hostname
        @default_hostname ||= Incline::email_config[:default_hostname]
      end

      ##
      # Gets the default sender for messages.
      def default_sender
        @default_sender ||= Incline::email_config[:sender]
      end

      ##
      # Gets the default recipient for messages.
      def default_recipient
        @default_recipient ||= Incline::email_config[:default_recipient]
      end
    end

    ##
    # Sets the default from and to address according to the configuration.
    def self.included(base)
      base.extend ClassMethods

      class << self

        private

        if method_defined?(:inherited)
          alias_method :incline_original_inherited, :inherited
        else
          def incline_original_inherited(subclass)
            # Do nothing.
          end
        end

        def inherited(subclass)
          incline_original_inherited subclass

          default(
              {
                  from: default_sender,
                  to: default_recipient
              }
          )
        end
      end

    end

  end

end

ActionMailer::Base.include Incline::Extensions::ActionMailerBase


text:
import { Component, NgModule } from '@angular/core';
import { IonicApp, IonicModule } from '../../../..';

@Component({
  templateUrl: 'main.html'
})
export class E2EPage {
  testClick(ev: any) {
    console.log('CLICK!', ev.target.tagName, ev.target.textContent.trim());
  }

  testClickOutsize(ev: any) {
    console.log('CLICK OUTSIDE!', ev.target.tagName, ev.target.textContent.trim());
  }
}

@Component({
  template: '<ion-nav [root]="rootPage"></ion-nav>'
})
export class E2EApp {
  rootPage = E2EPage;
}

@NgModule({
  declarations: [
    E2EApp,
    E2EPage
  ],
  imports: [
    IonicModule.forRoot(E2EApp)
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    E2EApp,
    E2EPage
  ]
})
export class AppModule {}


text:
@class HouseListInfo;
@interface HourseInfoDAL ()

-(void)saveCacheData:(HouseListInfo *)hourseInfo;

@property (nonatomic, assign) int oldArrayCount;
@property (nonatomic, assign) int newArrayCount;

@end

@implementation HourseInfoDAL

#pragma mark 加载数据
-(void)loadHourseInfo:(HouseListInfo *)hourseInfo{

//    1> 检查本地是否缓存数据
//    2>  如果有返回数据
//    3> 如果没有,加载网络数据
    [self saveCacheData:hourseInfo];
//    4> 将网络返回的数据,保存在本地,一边后续使用
//    5> 返回网络数据

}

#pragma mark  保存房子数据
-(void)saveCacheData:(HouseListInfo *)hourseInfo{
    // 房子信息
    NSString* houseid = hourseInfo.houseid; // 房子ID
    NSString* listingCategory = hourseInfo.listingCategory;
    NSString* commission = hourseInfo.commission;
    NSString* bathrooms = hourseInfo.bathrooms;
    NSString* bedrooms = hourseInfo.bedrooms;
    NSString* listingStatus = hourseInfo.listingCategory;
    NSString* price = hourseInfo.price;
    NSString* propertySubType = hourseInfo.propertySubType;
    NSString* vadate = hourseInfo.vadate;
    NSString* imageURL = hourseInfo.imageURL;
    NSString* address = hourseInfo.address;
    NSString* moneytype = hourseInfo.moneytype;
    NSString* islike = hourseInfo.islike;
    NSString* imageSource = hourseInfo.imageSource;

    NSMutableDictionary * dict = [[NSMutableDictionary alloc] init];
    // 房子信息添加到字典中
    [dict setObject:houseid forKey:@"houseid"];
    [dict setObject:listingCategory forKey:@"listingCategory"];
    [dict setObject:commission forKey:@"commission"];
    [dict setObject:bathrooms forKey:@"bathrooms"];
    [dict setObject:bedrooms forKey:@"bedrooms"];
    [dict setObject:listingStatus forKey:@"listingStatus"];
    [dict setObject:price forKey:@"price"];
    [dict setObject:propertySubType forKey:@"propertySubType"];
    [dict setObject:vadate forKey:@"vadate"];
    [dict setObject:imageURL forKey:@"imageURL"];
    [dict setObject:address forKey:@"address"];
    [dict setObject:moneytype forKey:@"moneytype"];
    [dict setObject:islike forKey:@"islike"];
    [dict setObject:imageSource forKey:@"imageSource"];

    //是否登陆
    if (!g_has_login){
        UIAlertView* alert = [[UIAlertView alloc] initWithTitle:nil message:@"\r\n请先登录" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"立即登录", nil];
        alert.tag = 101;
        [alert show];
        return;
    }

    NSLog(@"房子信息:%@",dict);

    //序列化 --- 房子数据
    NSData *json = [NSJSONSerialization dataWithJSONObject:dict options:nil error:nil];
//    NSLog(@"json: %@",json);
    //SQL
        NSString  *sql = @"INSERT OR REPLACE INTO T_Showroom (houseId, hourseInfo, userId) VALUES (?, ?, ?);";

    SQLiteManger *manger = [SQLiteManger shareSQLiteManger];
    [manger.queue inTransaction:^(FMDatabase *db, BOOL *rollback) {

        if ([db executeUpdate:sql, houseid, json, @"123"]) {
            NSLog(@"插入成功");

            rollback:false;
            return;
        }
    }];

    // 获取房子ID 已获得

    // 注册通知
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tongzhi:) name:@"userId" object:nil];
    NSLog(@"哈哈哈woad ");
}

- (void)tongzhi:(NSNotification *)text{
//    NSLog(@"%@",text.userInfo[@"textOne"]);
    NSLog(@"-----接收到通知------");

}

//
#pragma mark  保存房子详情的相关数据
-(void)savaDetailCacheData:(NSDictionary *)dict{

    // 判断是否登录
    if (!g_has_login){
        UIAlertView* alert = [[UIAlertView alloc] initWithTitle:nil message:@"\r\n请先登录" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"立即登录", nil];
        alert.tag = 101;
        [alert show];
        return;
    }

    //    NSLog(@"房子详情的相关数据:%@", dict);

    // sql
     NSString  *sql = @"INSERT OR REPLACE INTO T_HourseDetails (houseId, hourseDetailInfo, userId) VALUES (?, ?, ?);";

    // 房子ID
    NSDictionary *houseManage = dict[@"houseManage"];
    NSString *hourseid = houseManage[@"id"];

    //序列化 --- 房子详情数据
    NSData *json = [NSJSONSerialization dataWithJSONObject:dict options:nil error:nil];

//    NSLog(@"房子详情序列化前:%@", dict);
//    NSLog(@"房子详情序列化后:%@",json);

    NSDictionary * images = dict[@"imageURLs"];

    // 可变数组, 存放iamgeUrls
    NSMutableArray * imageUrlsArray = [[NSMutableArray alloc] init];

    for (NSDictionary * dict in images) {

        NSString * imageUrl = dict[@"imageUrl"];
        NSLog(@"%@",imageUrl);

        [imageUrlsArray addObject:imageUrl];
    }

#pragma mark --- 下载详情界面图片

    for (int i = 0; i < imageUrlsArray.count; i++) {

        NSURL* url = nil;
        NSString* urlstr = [imageUrlsArray objectAtIndex:i];
        DLOG(@"urlstr  >>>>>:  %@",urlstr);
        if ([urlstr length] > 4 && [[[urlstr substringToIndex:4] lowercaseString] isEqualToString:@"http"])
        {
            url = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@",@"",urlstr]];
            DLOG(@"url  -->> :%@",url);
        }
        else
        {
            url = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@",BASEIMAGEURL,urlstr]];
            DLOG(@"url  ==>> :%@",url);
        }

//        NSString * image = [NSString stringWithFormat:@"image%d",i];

                    UIImageView *image = [[UIImageView alloc] init];

//                    [image sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"fangyuan_cell_yongjin_bg"]];

        [image sd_setImageWithURL:url];

    }

   // 用户ID
    SQLiteManger *manger = [SQLiteManger shareSQLiteManger];
    [manger.queue inTransaction:^(FMDatabase *db, BOOL *rollback) {

        if ([db executeUpdate:sql, hourseid, json, @"123"]) {
            NSLog(@"插入成功");

        rollback:false;
            return;
        }
    }];

}

#pragma mark 检查房子本地数据  --->返回已经收藏的数据
-(NSArray *)checkChacheData {
    //SQL
    NSString * sql = @"SELECT houseId, hourseInfo, userId FROM T_Showroom \n";

    sql = [sql stringByAppendingFormat:@"WHERE userId = 123 \n"];

    // 执行sql语句
    NSArray * array = [[SQLiteManger shareSQLiteManger] execRecordSet:sql];
    NSLog(@"%d",self.arrayCountChange);
    // 定义一个bool值比较, 收藏的房子是否变化, (数据的增删)
    self.newArrayCount = (int)array.count;

    NSLog(@"新值:%d",self.newArrayCount);
    NSLog(@"旧值:%d", self.oldArrayCount);

    if (self.newArrayCount != self.oldArrayCount) {
        self.arrayCountChange = 1;
        NSLog(@"不相等");
    }else{

        self.arrayCountChange = 0;
    }

    self.oldArrayCount = self.newArrayCount;

    NSLog(@"旧值:%d", self.oldArrayCount);

    //可变的数据, 存储数据
    NSMutableArray *arrayM = [[NSMutableArray alloc] init];

    // 便利
    for (NSDictionary *dict in array) {

        NSData *jsonData = dict[@"hourseInfo"];

        NSLog(@"反序列化前:%@", jsonData);

        // 反序列化 --> 一条完整数据字典
        NSDictionary * result = [NSJSONSerialization JSONObjectWithData:jsonData options:nil error:nil];
        NSLog(@"反序列化后:%@", result);

        [arrayM addObject:result];
    }

    // 返回结果 - 如果没有查询到数据,会返回一个空的数组
    return arrayM;
}

#pragma 检查房子详情本地数据 --->返回已经在本地存在的数据
-(NSArray *) checkHourseDetailChacheData{

    //SQL
    NSString * sql = @"SELECT houseId, hourseDetailInfo, userId FROM T_HourseDetails \n";

    sql = [sql stringByAppendingFormat:@"WHERE userId = 123 \n"];

    // 执行sql语句
    NSArray * array = [[SQLiteManger shareSQLiteManger] execRecordSet:sql];

    //可变的数据, 存储数据
    NSMutableArray *arrayM = [[NSMutableArray alloc] init];

    // 便利
    for (NSDictionary *dict in array) {

        NSData *jsonData = dict[@"hourseDetailInfo"];

        NSLog(@"反序列化前:%@", jsonData);

        // 反序列化 --> 一条完整微博数据字典
        NSDictionary *result = [NSJSONSerialization JSONObjectWithData:jsonData options:nil error:nil];
        NSLog(@"反序列化后:%@", result);

        [arrayM addObject:result];

    }

    // 返回结果 - 如果没有查询到数据,会返回一个空的数组
    return arrayM;
}

#pragma mark 满足一定条件时清楚缓存 ---> 程序进入后台时调用
-(void)clearDataCache{

    // SQL
    NSString *sql = @"DELETE FROM T_Status WHERE   ;";

    // 执行SQL
    SQLiteManger *manger = [SQLiteManger shareSQLiteManger];
    [manger.queue inDatabase:^(FMDatabase *db) {
        [db executeUpdate:sql];
    }];

}

#pragma mark 取消收藏时删除,对应的数据
-(void)deleteDataCache:(NSString *)hourseId{

    NSLog(@"hourseId:%@",hourseId );

    // SQL
    NSString *sql = @"DELETE FROM T_Showroom \n";

    sql = [sql stringByAppendingFormat:@"WHERE houseId = %@ \n", hourseId];

//    NSLog(@"%@",sql);

    // 执行SQL
    SQLiteManger *manger = [SQLiteManger shareSQLiteManger];
    [manger.queue inDatabase:^(FMDatabase *db) {
        [db executeUpdate:sql];
    }];
}

@end


text:
using System;
using d60.Cirqus.Commands;

namespace Beetroot.Commands
{
    public class SqueezeCommand : Command<AggregateRoots.Beetroot>
    {
        public SqueezeCommand(Guid aggregateRootId) : base(aggregateRootId.ToString())
        {
        }

        public decimal HowMuch { get; set; }

        public override void Execute(AggregateRoots.Beetroot aggregateRoot)
        {
            aggregateRoot.Squeeze(HowMuch);
        }
    }
}


text:
package org.apache.harmony.tests.java.text;

import java.text.DateFormat;
import java.text.FieldPosition;

public class FieldPositionTest extends junit.framework.TestCase {

	/**
	 * @tests java.text.FieldPosition#FieldPosition(int)
	 */
	public void test_ConstructorI() {
		// Test for constructor java.text.FieldPosition(int)
		FieldPosition fpos = new FieldPosition(DateFormat.MONTH_FIELD);
		assertEquals("Test1: Constructor failed to set field identifier!",
				DateFormat.MONTH_FIELD, fpos.getField());
		assertNull("Constructor failed to set field attribute!", fpos
				.getFieldAttribute());
	}

	/**
	 * @tests java.text.FieldPosition#FieldPosition(java.text.Format$Field)
	 */
	public void test_ConstructorLjava_text_Format$Field() {
		// Test for constructor java.text.FieldPosition(Format.Field)
		FieldPosition fpos = new FieldPosition(DateFormat.Field.MONTH);
		assertSame("Constructor failed to set field attribute!",
				DateFormat.Field.MONTH, fpos.getFieldAttribute());
		assertEquals("Test1: Constructor failed to set field identifier!", -1,
				fpos.getField());
	}

	/**
	 * @tests java.text.FieldPosition#FieldPosition(java.text.Format$Field, int)
	 */
	public void test_ConstructorLjava_text_Format$FieldI() {
		// Test for constructor java.text.FieldPosition(Format.Field, int)
		FieldPosition fpos = new FieldPosition(DateFormat.Field.MONTH,
				DateFormat.MONTH_FIELD);
		assertSame("Constructor failed to set field attribute!",
				DateFormat.Field.MONTH, fpos.getFieldAttribute());
		assertEquals("Test1: Constructor failed to set field identifier!",
				DateFormat.MONTH_FIELD, fpos.getField());

		// test special cases
		FieldPosition fpos2 = new FieldPosition(DateFormat.Field.HOUR1,
				DateFormat.HOUR1_FIELD);
		assertSame("Constructor failed to set field attribute!",
				DateFormat.Field.HOUR1, fpos2.getFieldAttribute());
		assertEquals("Test2: Constructor failed to set field identifier!",
				DateFormat.HOUR1_FIELD, fpos2.getField());

		FieldPosition fpos3 = new FieldPosition(DateFormat.Field.TIME_ZONE,
				DateFormat.MONTH_FIELD);
		assertSame("Constructor failed to set field attribute!",
				DateFormat.Field.TIME_ZONE, fpos3.getFieldAttribute());
		assertEquals("Test3: Constructor failed to set field identifier!",
				DateFormat.MONTH_FIELD, fpos3.getField());
	}

	/**
	 * @tests java.text.FieldPosition#equals(java.lang.Object)
	 */
	public void test_equalsLjava_lang_Object() {
		// Test for method boolean
		// java.text.FieldPosition.equals(java.lang.Object)
		FieldPosition fpos = new FieldPosition(1);
		FieldPosition fpos1 = new FieldPosition(1);
		assertTrue("Identical objects were not equal!", fpos.equals(fpos1));

		FieldPosition fpos2 = new FieldPosition(2);
		assertTrue("Objects with a different ID should not be equal!", !fpos
				.equals(fpos2));

		fpos.setBeginIndex(1);
		fpos1.setBeginIndex(2);
		assertTrue("Objects with a different beginIndex were still equal!",
				!fpos.equals(fpos1));
		fpos1.setBeginIndex(1);
		fpos1.setEndIndex(2);
		assertTrue("Objects with a different endIndex were still equal!", !fpos
				.equals(fpos1));

		FieldPosition fpos3 = new FieldPosition(DateFormat.Field.ERA, 1);
		assertTrue("Objects with a different attribute should not be equal!",
				!fpos.equals(fpos3));
		FieldPosition fpos4 = new FieldPosition(DateFormat.Field.AM_PM, 1);
		assertTrue("Objects with a different attribute should not be equal!",
				!fpos3.equals(fpos4));
	}

	/**
	 * @tests java.text.FieldPosition#getBeginIndex()
	 */
	public void test_getBeginIndex() {
		// Test for method int java.text.FieldPosition.getBeginIndex()
		FieldPosition fpos = new FieldPosition(1);
		fpos.setEndIndex(3);
		fpos.setBeginIndex(2);
		assertEquals("getBeginIndex should have returned 2",
				2, fpos.getBeginIndex());
	}

	/**
	 * @tests java.text.FieldPosition#getEndIndex()
	 */
	public void test_getEndIndex() {
		// Test for method int java.text.FieldPosition.getEndIndex()
		FieldPosition fpos = new FieldPosition(1);
		fpos.setBeginIndex(2);
		fpos.setEndIndex(3);
		assertEquals("getEndIndex should have returned 3",
				3, fpos.getEndIndex());
	}

	/**
	 * @tests java.text.FieldPosition#getField()
	 */
	public void test_getField() {
		// Test for method int java.text.FieldPosition.getField()
		FieldPosition fpos = new FieldPosition(65);
		assertEquals("FieldPosition(65) should have caused getField to return 65",
				65, fpos.getField());
		FieldPosition fpos2 = new FieldPosition(DateFormat.Field.MINUTE);
		assertEquals("FieldPosition(DateFormat.Field.MINUTE) should have caused getField to return -1",
				-1, fpos2.getField());
	}

	/**
	 * @tests java.text.FieldPosition#getFieldAttribute()
	 */
	public void test_getFieldAttribute() {
		// Test for method int java.text.FieldPosition.getFieldAttribute()
		FieldPosition fpos = new FieldPosition(DateFormat.Field.TIME_ZONE);
		assertTrue(
				"FieldPosition(DateFormat.Field.TIME_ZONE) should have caused getFieldAttribute to return DateFormat.Field.TIME_ZONE",
				fpos.getFieldAttribute() == DateFormat.Field.TIME_ZONE);

		FieldPosition fpos2 = new FieldPosition(DateFormat.TIMEZONE_FIELD);
		assertNull(
				"FieldPosition(DateFormat.TIMEZONE_FIELD) should have caused getFieldAttribute to return null",
				fpos2.getFieldAttribute());
	}

	public void test_hashCode() {
	  // Test for method int java.text.FieldPosition.hashCode()
	  FieldPosition fpos1 = new FieldPosition(1);
	  FieldPosition fpos2 = new FieldPosition(1);
	  assertTrue("test 1: hash codes are not equal for equal objects.",
	             fpos1.hashCode() == fpos2.hashCode());
	  fpos1.setBeginIndex(5);
	  fpos1.setEndIndex(110);
	  assertTrue("test 2: hash codes are equal for non equal objects.",
	             fpos1.hashCode() != fpos2.hashCode());
	  fpos2.setBeginIndex(5);
	  fpos2.setEndIndex(110);
	  assertTrue("test 3: hash codes are not equal for equal objects.",
	             fpos1.hashCode() == fpos2.hashCode());

	  FieldPosition fpos3 = new FieldPosition(
	      DateFormat.Field.DAY_OF_WEEK_IN_MONTH);

	  assertTrue("test 4: hash codes are equal for non equal objects.",
	             fpos2.hashCode() != fpos3.hashCode());
	}

	public void test_setBeginIndexI() {
	  FieldPosition fpos = new FieldPosition(1);
	  fpos.setBeginIndex(2);
	  fpos.setEndIndex(3);
	  assertEquals("beginIndex should have been set to 2", 2, fpos
	                   .getBeginIndex());

	  fpos.setBeginIndex(Integer.MAX_VALUE);
	  assertEquals("beginIndex should have been set to Integer.MAX_VALUE",
	               Integer.MAX_VALUE, fpos.getBeginIndex());

	  fpos.setBeginIndex(-1);
	  assertEquals("beginIndex should have been set to -1",
	               -1, fpos.getBeginIndex());
	}

	public void test_setEndIndexI() {
	  FieldPosition fpos = new FieldPosition(1);
	  fpos.setEndIndex(3);
	  fpos.setBeginIndex(2);
	  assertEquals("EndIndex should have been set to 3", 3, fpos
	                   .getEndIndex());

	  fpos.setEndIndex(Integer.MAX_VALUE);
	  assertEquals("endIndex should have been set to Integer.MAX_VALUE",
	               Integer.MAX_VALUE, fpos.getEndIndex());

	  fpos.setEndIndex(-1);
	  assertEquals("endIndex should have been set to -1",
	               -1, fpos.getEndIndex());
	}

	/**
	 * @tests java.text.FieldPosition#toString()
	 */
	public void test_toString() {
		// Test for method java.lang.String java.text.FieldPosition.toString()
		FieldPosition fpos = new FieldPosition(1);
		fpos.setBeginIndex(2);
		fpos.setEndIndex(3);
		assertEquals(
				"ToString returned the wrong value:",
				"java.text.FieldPosition[attribute=null,field=1,beginIndex=2,endIndex=3]",
				fpos.toString());

		FieldPosition fpos2 = new FieldPosition(DateFormat.Field.ERA);
		fpos2.setBeginIndex(4);
		fpos2.setEndIndex(5);
		assertEquals("ToString returned the wrong value:",
				"java.text.FieldPosition[attribute=" + DateFormat.Field.ERA
						+ ",field=-1,beginIndex=4,endIndex=5]", fpos2
						.toString());
	}

	/**
	 * Sets up the fixture, for example, open a network connection. This method
	 * is called before a test is executed.
	 */
	protected void setUp() {
	}

	/**
	 * Tears down the fixture, for example, close a network connection. This
	 * method is called after a test is executed.
	 */
	protected void tearDown() {
	}
}


text:
namespace content {

class AppCacheStorage;

// Refcounted container to avoid copying the collection in callbacks.
struct CONTENT_EXPORT AppCacheInfoCollection
    : public base::RefCountedThreadSafe<AppCacheInfoCollection> {
  AppCacheInfoCollection();

  std::map<GURL, AppCacheInfoVector> infos_by_origin;

 private:
  friend class base::RefCountedThreadSafe<AppCacheInfoCollection>;
  virtual ~AppCacheInfoCollection();
};

// Exposes a limited interface to the AppCacheService.
// Call these methods only on the IO thread.
class CONTENT_EXPORT AppCacheService {
 public:
  // Determines if a request for 'url' can be satisfied while offline.
  // This method always completes asynchronously.
  virtual void CanHandleMainResourceOffline(const GURL& url,
                                            const GURL& first_party,
                                            const net::CompletionCallback&
                                            callback) = 0;

  // Populates 'collection' with info about all of the appcaches stored
  // within the service, 'callback' is invoked upon completion. The service
  // acquires a reference to the 'collection' until until completion.
  // This method always completes asynchronously.
  virtual void GetAllAppCacheInfo(AppCacheInfoCollection* collection,
                                  const net::CompletionCallback& callback) = 0;

  // Deletes the group identified by 'manifest_url', 'callback' is
  // invoked upon completion. Upon completion, the cache group and
  // any resources within the group are no longer loadable and all
  // subresource loads for pages associated with a deleted group
  // will fail. This method always completes asynchronously.
  virtual void DeleteAppCacheGroup(const GURL& manifest_url,
                                   const net::CompletionCallback& callback) = 0;

 protected:
  virtual ~AppCacheService() {}
};

}  // namespace content

#endif  // CONTENT_PUBLIC_BROWSER_APPCACHE_SERVICE_H_


text:
<?php
/**
 * User: York <lianyupeng1988@126.com>
 * Date: 2017-07-09 22:38
 */

namespace York8\Router;

use UnexpectedValueException;
use York8\Router\Handler\CallbackHandler;

trait RouterTrait
{
    /** @var array */
    private $rulerHandlerMap = [];

    /**
     * 添加规则:将规则 rule 与 处理器 handler 绑定起来
     * @param RulerInterface $ruler 规则对象
     * @param callable $handler 处理器对象
     * @return RouterInterface
     */
    public function addRuler(RulerInterface $ruler, callable $handler): RouterInterface
    {
        if (is_null($ruler) || is_null($handler)) {
            throw new UnexpectedValueException('the ruler and handler could not be null');
        }
        foreach ($this->rulerHandlerMap as $item) {
            $r = $item[0];
            if ($r === $ruler) {
                $item[1] = $handler;
                return $this;
            }
        }
        $this->rulerHandlerMap[] = [$ruler, $handler];
        return $this;
    }

    /**
     * 路由 GET 请求 $path 到 $handler
     * @param string $path
     * @param callable $handler
     * @return RouterInterface
     */
    public function get($path, callable $handler): RouterInterface
    {
        $ruler = $this->createRuler('GET', $path);
        return $this->addRuler($ruler, $handler);
    }

    /**
     * 路由 POST 请求 $path 到 $handler
     * @param string $path
     * @param callable $handler
     * @return RouterInterface
     */
    public function post($path, callable $handler): RouterInterface
    {
        $ruler = $this->createRuler('POST', $path);
        return $this->addRuler($ruler, $handler);
    }

    /**
     * 路由 PUT 请求 $path 到 $handler
     * @param string $path
     * @param callable $handler
     * @return RouterInterface
     */
    public function put($path, callable $handler): RouterInterface
    {
        $ruler = $this->createRuler('PUT', $path);
        return $this->addRuler($ruler, $handler);
    }

    /**
     * 路由 HEAD 请求 $path 到 $handler
     * @param string $path
     * @param callable $handler
     * @return RouterInterface
     */
    public function head($path, callable $handler): RouterInterface
    {
        $ruler = $this->createRuler('HEAD', $path);
        return $this->addRuler($ruler, $handler);
    }

    /**
     * 路由 OPTION 请求 $path 到 $handler
     * @param string $path
     * @param callable $handler
     * @return RouterInterface
     */
    public function option($path, callable $handler): RouterInterface
    {
        $ruler = $this->createRuler('OPTION', $path);
        return $this->addRuler($ruler, $handler);
    }

    /**
     * 路由 DELETE 请求 $path 到 $handler
     * @param string $path
     * @param callable $handler
     * @return RouterInterface
     */
    public function delete($path, callable $handler): RouterInterface
    {
        $ruler = $this->createRuler('DELETE', $path);
        return $this->addRuler($ruler, $handler);
    }

    /**
     * 简单根据 method 和 path 创建规则对象
     * @param string|string[] $methods
     * @param string|string[] $paths
     * @return RulerInterface
     */
    private function createRuler($methods, $paths): RulerInterface
    {
        if (!is_array($methods)) {
            $methods = [$methods];
        }
        if (!is_array($paths)) {
            $paths = [$paths];
        }
        return new Ruler($paths, null, $methods);
    }
}


text:
![](https://cloud.githubusercontent.com/assets/3609616/21100043/238d67cc-c072-11e6-9f4e-252e9cb1ae19.jpg)

A small [drafter](https://github.com/apiaryio/drafter) binding. As [redsnow](https://github.com/apiaryio/redsnow)
is outdated and deprecated, we implemented a binding for the parsing method of drafter.

The drafter version used by the current Lounge Lizard version is 3.2.2

### Drafter

This is just ruby wrapper to use Drafter. Check [drafter's repository](https://github.com/apiaryio/drafter) for more info

## Install

```sh
$  gem install lounge_lizard
```

## Usage
`LoungeLizard.parse(mson_string_content)` will return a hash representing the AST of the mson file.

You can also call the c++ function directly. For an example, just check `lib/lounge_lizard.rb`:

`LoungeLizard.drafter_parse_blueprint_to(mson_string_content, ffi_pointer, options_struct)`

## Build

1. Clone the repo + fetch the submodules(this is, drafter and its dependencies):

    ```sh
    $ git clone git://github.com/moviepilot/lounge_lizard.git
    $ cd lounge_lizard
    $ git submodule update --init --recursive
    ```

2. Lounge Lizard has drafter as a native extension. This meaning, drafter is
a c++ library you need to compile it before using it. `rake` will take care of
compiling it:

    ```sh
    $ rake
    ```

## Credit

The way this gem is build is very similar to [redsnow](https://github.com/apiaryio/redsnow). So cheers to them!

## License
MIT License. See the [LICENSE](https://github.com/moviepilot/lounge_lizard/blob/master/LICENSE) file.


text:
var istanbul = require('browserify-istanbul');

module.exports = function(grunt) {

  grunt.initConfig({

    pkg: grunt.file.readJSON('package.json'),

    eslint: {
      src: ['src/**/*.js']
    },

    browserify: {
      coverage: {
        files: {
          'test/instrumented-app/models/BaseModel.js': 'src/app/models/BaseModel.js',
          'test/instrumented-app/models/TripModel.js': 'src/app/models/TripModel.js',
          'test/instrumented-app/views/TripView.js'  : 'src/app/views/TripView.js'
        },
        options: {
          transform: [istanbul]
        }
      }
    },

    mocha: {
      options: {
        log: true,
        reporter: 'Spec',
        coverage: {
          lcovReport: 'coverage'
        }
      },
      test: {
          src: ['test/index.html']
      }
    },

    json_server: {
      options: {
        port: 8080,
        hostname: 'localhost',
        db: 'api.json'
      },
      dev : {}
    },

    copy: {
      app: {
        files: [
          /* Index */
          {src: 'src/index.html', dest: 'www/index.html'},
          /* CSS */
          {src: 'node_modules/bootstrap/dist/css/bootstrap.css', dest: 'www/css/bootstrap.css'},
          {src: 'node_modules/normalize-css/normalize.css',      dest: 'www/css/normalize.css'},
          {src: 'node_modules/leaflet/dist/leaflet.css', dest: 'www/css/leaflet.css'},
          {expand: true, cwd: 'node_modules/leaflet/dist/images', src: ['layers*.png'], dest: 'www/css/images/', filter: 'isFile'},
          /* JS libs */
          {src: 'node_modules/requirejs/require.js', dest: 'www/js/libs/require.js'},
          {src: 'node_modules/bootstrap/dist/js/bootstrap.js', dest: 'www/js/libs/bootstrap.js'},
          {src: 'node_modules/jquery/dist/jquery.js', dest: 'www/js/libs/jquery.js'},
          {src: 'node_modules/underscore/underscore.js', dest: 'www/js/libs/underscore.js'},
          {src: 'node_modules/backbone/backbone.js', dest: 'www/js/libs/backbone.js'},
          {src: 'node_modules/backbone-poller/backbone.poller.js', dest: 'www/js/libs/backbone-poller.js'},
          {src: 'node_modules/handlebars/dist/handlebars.js', dest: 'www/js/libs/handlebars.js'},
          {src: 'node_modules/leaflet/dist/leaflet-src.js', dest: 'www/js/libs/leaflet.js'},
          {expand: true, cwd: 'node_modules/leaflet/dist/images', src: ['marker*.png'], dest: 'www/js/libs/images/', filter: 'isFile'},
          /* Project files */
          {expand: true, cwd: 'src', src: ['*.css'],   dest: 'www/css/', filter: 'isFile'},
          {expand: true, cwd: 'src', src: ['**/*.js'], dest: 'www/js/',  filter: 'isFile'}
        ]
      }
    },

    clean: {
      build: ['www'],
      tests: ['coverage', 'test/instrumented-app']
    },

    watch: {
      files: ['src/**/*'],
      tasks: ['copy']
    },

    concurrent: {
      dev: {
        tasks: ['watch', 'json_server'],
        options: { logConcurrentOutput: true }
      }
    }

  });

  grunt.loadNpmTasks('gruntify-eslint');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-concurrent');
  grunt.loadNpmTasks('grunt-json-server');
  grunt.loadNpmTasks('grunt-browserify');
  grunt.loadNpmTasks('grunt-mocha-phantom-istanbul');

  grunt.registerTask('lint', ['eslint']);
  grunt.registerTask('build', ['copy:app']);
  grunt.registerTask('test', ['browserify:coverage', 'mocha']);
  grunt.registerTask('run', ['build', 'concurrent:dev']);
  grunt.registerTask('default', ['clean', 'lint', 'build', 'test']);

};


text:
package com.zlikun.spring.configure;

import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

@Configuration
@EnableAspectJAutoProxy     // 等同于 <aop:aspectj-autoproxy/>
public class AppConfigure {

}


text:
'use strict';

$(function () {
  console.log('Hello World!');
});


text:
package com.salisburyclan.lpviewport.animation;

import com.salisburyclan.lpviewport.api.Color;
import com.salisburyclan.lpviewport.api.FramedAnimation;
import com.salisburyclan.lpviewport.api.WriteLayer;
import com.salisburyclan.lpviewport.apps.Circle;
import com.salisburyclan.lpviewport.geom.Point;
import com.salisburyclan.lpviewport.geom.Range2;
import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.Timeline;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.util.Duration;

// Grows a circle from a center point to the edge of the extent.
public class CircleExplode extends FramedAnimation {

  private final WriteLayer layer;
  private final Point center;
  private final Color color;

  private static final int FADE_LENGTH = 5;

  public CircleExplode(Range2 extent, Point center, Color color) {
    super(extent);
    this.layer = getWriteLayer();
    this.center = center;
    this.color = color;
    init();
  }

  private void init() {
    final int maxDistance = getMaxDistanceToCorner() + FADE_LENGTH + 1;
    IntegerProperty explodeDistance = new SimpleIntegerProperty();
    Timeline timeline = new Timeline();
    timeline
        .getKeyFrames()
        .addAll(
            new KeyFrame(Duration.ZERO, new KeyValue(explodeDistance, 0)),
            new KeyFrame(Duration.seconds(1), new KeyValue(explodeDistance, maxDistance)));
    timeline.setOnFinished(
        event -> {
          layer.close();
        });
    addTimeline(timeline);

    explodeDistance.addListener(
        new ChangeListener() {
          @Override
          public void changed(ObservableValue o, Object oldVal, Object newVal) {
            renderExplodeFrame((Integer) oldVal, (Integer) newVal);
          }
        });
  }

  private int getMaxDistanceToCorner() {
    Range2 extent = layer.getExtent();
    int bigX = Math.max(center.x() - extent.xRange().low(), extent.xRange().high() - center.x());
    int bigY = Math.max(center.y() - extent.yRange().low(), extent.yRange().high() - center.y());
    return bigX + bigY;
  }

  private void renderExplodeFrame(int innerDistance, int outerDistance) {
    layer.nextFrame();
    drawCircle(center, innerDistance, outerDistance);
  }

  private void drawCircle(Point center, int innerRadius, int outerRadius) {
    Circle.drawRangeCircle(layer, center, innerRadius, outerRadius, color);
  }
}


text:
#include <pebble.h>
#define NUM_OF_COINS 3

// For AppMessage
enum
{
	COIN=0,
	US=1,
	UK=2,
	CAN=3
};

static Window *window;
static TextLayer *text_layer;
static GBitmap *heads_bitmap, *tails_bitmap;
static BitmapLayer *bitmap_layer;
static AppTimer *timer;
static int times_called = 0;
static bool persist_storage_working;
static int last_flip = -1;

/*
 * Make sure the persistant storage is working.
 * If not, have to prevent any persist calls from happening.
 */
static void test_persist_storage()
{
	int test = persist_write_bool(100, true);
	if (test < 0)
		persist_storage_working = false;
	else
	{
		persist_storage_working = true;
		persist_delete(100);
	}
}

/*
 * Recursive callback just to make a nice little animation so the user knows the coin has changed.
 */
static void timer_callback()
{
	if (times_called == 0)
	{
		text_layer_set_text(text_layer, "Flipping.  ");
		times_called++;
		timer = app_timer_register(150, timer_callback, NULL);
	}
	else if (times_called == 1)
	{
		text_layer_set_text(text_layer, "Flipping.. ");
		times_called++;
		timer = app_timer_register(150, timer_callback, NULL);
	}
	else if (times_called == 2)
	{
		text_layer_set_text(text_layer, "Flipping...");
		times_called++;
		timer = app_timer_register(150, timer_callback, NULL);
	}
	else
	{
		layer_set_hidden(text_layer_get_layer(text_layer), true);
		layer_set_hidden(bitmap_layer_get_layer(bitmap_layer), false);
		times_called = 0;
	}
}

/*
 * Method for flipping the coin.
 * Initiate the animation for the timer callback, then get a random number from 0 to 1.
 * 0 = tails, 1 = heads
 */
static void flip()
{
	if (!persist_storage_working && last_flip == -1)
			layer_set_frame(text_layer_get_layer(text_layer), (GRect) { .origin = { 0, 60 }, .size = { 144, 40 } });
	if (times_called != 0)
		app_timer_cancel(timer);
	layer_set_hidden(text_layer_get_layer(text_layer), false);
	layer_set_hidden(bitmap_layer_get_layer(bitmap_layer), true);
	text_layer_set_text(text_layer, "Flipping   ");
	last_flip = rand() % 2;
	if (last_flip == 0)
		bitmap_layer_set_bitmap(bitmap_layer, tails_bitmap);
	else
		bitmap_layer_set_bitmap(bitmap_layer, heads_bitmap);
	times_called = 0;
	timer = app_timer_register(150, timer_callback, NULL);
}

/*
 * Handler for select button.
 */
static void select_click_handler(ClickRecognizerRef recognizer, void *context)
{
	flip();
}
/*
 * Handler for up button.
 */
static void up_click_handler(ClickRecognizerRef recognizer, void *context)
{
	flip();
}
/*
 * Handler for select button.
 */
static void down_click_handler(ClickRecognizerRef recognizer, void *context)
{
	flip();
}
/*
 * Handler for accelerator.
 */
static void accel_tap_handler(AccelAxisType axis, int32_t direction)
{
	flip();
}
/*
 * Method to set up all the click handlers.
 */
static void click_config_provider(void *context)
{
	window_single_click_subscribe(BUTTON_ID_SELECT, select_click_handler);
	window_single_click_subscribe(BUTTON_ID_UP, up_click_handler);
	window_single_click_subscribe(BUTTON_ID_DOWN, down_click_handler);
}
/*
 * Method to process the AppMessage.
 * Gets whatever coin was passed in from AppMessage,
 * writes that value into persist storage so it remembers it across sessions,
 * and sets the current bitmaps to the selected coin face.
 */
static void process_tuple(Tuple *t)
{
	int key = t->key;
	char string_value[64];
	strcpy(string_value, t->value->cstring);
	if (key == COIN)
	{
		if (strcmp(string_value, "us") == 0)
		{
			if (persist_storage_working)
				persist_write_int(COIN, US);
			gbitmap_destroy(heads_bitmap);
			gbitmap_destroy(tails_bitmap);
			heads_bitmap = gbitmap_create_with_resource(RESOURCE_ID_US_HEADS);
			tails_bitmap = gbitmap_create_with_resource(RESOURCE_ID_US_TAILS);
		}
		else if (strcmp(string_value, "uk") == 0)
		{
			if (persist_storage_working)
				persist_write_int(COIN, UK);
			gbitmap_destroy(heads_bitmap);
			gbitmap_destroy(tails_bitmap);
			heads_bitmap = gbitmap_create_with_resource(RESOURCE_ID_UK_HEADS);
			tails_bitmap = gbitmap_create_with_resource(RESOURCE_ID_UK_TAILS);
		}
		else if (strcmp(string_value, "can") == 0)
		{
			if (persist_storage_working)
				persist_write_int(COIN, CAN);
			gbitmap_destroy(heads_bitmap);
			gbitmap_destroy(tails_bitmap);
			heads_bitmap = gbitmap_create_with_resource(RESOURCE_ID_CAN_HEADS);
			tails_bitmap = gbitmap_create_with_resource(RESOURCE_ID_CAN_TAILS);
		}
	}
}
/*
 * Handler for recieved AppMessage.
 */
static void in_received_handler(DictionaryIterator *iter, void *context)
{
	Tuple *t = dict_read_first(iter);
	if (t)
		process_tuple(t);
}
/*
 * Helper function for translating AppMessage errors.
 */
static char *translate_error(AppMessageResult result)
{
	switch (result)
	{
		case APP_MSG_OK: return "APP_MSG_OK";
		case APP_MSG_SEND_TIMEOUT: return "APP_MSG_SEND_TIMEOUT";
		case APP_MSG_SEND_REJECTED: return "APP_MSG_SEND_REJECTED";
		case APP_MSG_NOT_CONNECTED: return "APP_MSG_NOT_CONNECTED";
		case APP_MSG_APP_NOT_RUNNING: return "APP_MSG_APP_NOT_RUNNING";
		case APP_MSG_INVALID_ARGS: return "APP_MSG_INVALID_ARGS";
		case APP_MSG_BUSY: return "APP_MSG_BUSY";
		case APP_MSG_BUFFER_OVERFLOW: return "APP_MSG_BUFFER_OVERFLOW";
		case APP_MSG_ALREADY_RELEASED: return "APP_MSG_ALREADY_RELEASED";
		case APP_MSG_CALLBACK_ALREADY_REGISTERED: return "APP_MSG_CALLBACK_ALREADY_REGISTERED";
		case APP_MSG_CALLBACK_NOT_REGISTERED: return "APP_MSG_CALLBACK_NOT_REGISTERED";
		case APP_MSG_OUT_OF_MEMORY: return "APP_MSG_OUT_OF_MEMORY";
		case APP_MSG_CLOSED: return "APP_MSG_CLOSED";
		case APP_MSG_INTERNAL_ERROR: return "APP_MSG_INTERNAL_ERROR";
		default: return "UNKNOWN ERROR";
	}
}
/*
 * Handler for dropped messages
 */
static void in_dropped_handler(AppMessageResult reason, void *context)
{
	APP_LOG(APP_LOG_LEVEL_DEBUG, "App Message Dropped! Reason = %s", translate_error(reason));
}
/*
 * Handler for failed messages.
 */
static void out_failed_handler(DictionaryIterator *failed, AppMessageResult reason, void *context)
{
	APP_LOG(APP_LOG_LEVEL_DEBUG, "App Message Failed to Send! %d : %s", reason, translate_error(reason));
}

/*
 * Initalizer for app message. Sets handlers.
 */
static void app_message_init()
{
	app_message_register_inbox_received(in_received_handler);
	app_message_register_inbox_dropped(in_dropped_handler);
	app_message_register_outbox_failed(out_failed_handler);

	app_message_open(app_message_inbox_size_maximum(),app_message_outbox_size_maximum());
}
/*
 * Function to create the window.
 */
static void window_load(Window *window)
{
	Layer *window_layer = window_get_root_layer(window);
	GRect bounds = layer_get_bounds(window_layer);
	if (persist_storage_working && persist_exists(COIN))
	{
		int coin = persist_read_int(COIN);
		switch (coin)
		{
			case US:
				heads_bitmap = gbitmap_create_with_resource(RESOURCE_ID_US_HEADS);
				tails_bitmap = gbitmap_create_with_resource(RESOURCE_ID_US_TAILS);
				break;
			case UK:
				heads_bitmap = gbitmap_create_with_resource(RESOURCE_ID_UK_HEADS);
				tails_bitmap = gbitmap_create_with_resource(RESOURCE_ID_UK_TAILS);
				break;
			case CAN:
				heads_bitmap = gbitmap_create_with_resource(RESOURCE_ID_CAN_HEADS);
				tails_bitmap = gbitmap_create_with_resource(RESOURCE_ID_CAN_TAILS);
		}
	}
	else
	{
		heads_bitmap = gbitmap_create_with_resource(RESOURCE_ID_US_HEADS);
		tails_bitmap = gbitmap_create_with_resource(RESOURCE_ID_US_TAILS);
	}
	bitmap_layer = bitmap_layer_create(GRect(0,0,144,144));
	layer_add_child(window_get_root_layer(window), bitmap_layer_get_layer(bitmap_layer));
	if (persist_storage_working)
	{
		text_layer = text_layer_create((GRect) { .origin = { 0, 60 }, .size = { bounds.size.w, 40 } });
		text_layer_set_text(text_layer, "Shake/Press to Flip");
	}
	else
	/*
	 * If persistant storage is broken, we want to inform the user that this is so.
	 * However, since this app can still function without it, we still allow them to carry on
	 * after displaying the error.
	 */
	{

		text_layer = text_layer_create((GRect){.origin = {0,0}, .size = {bounds.size.w, 144}});
		text_layer_set_text(text_layer, "Persistent Storage is Broken. Please Factory Reset Watch. Visit bit.ly/ urbpebstorage for more information.");
	}
	text_layer_set_text_alignment(text_layer, GTextAlignmentCenter);
	text_layer_set_font(text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));
	layer_add_child(window_layer, text_layer_get_layer(text_layer));
}
/*
 * Function for cleaning up when the window (and app) close.
 */
static void window_unload(Window *window)
{
	text_layer_destroy(text_layer);
	gbitmap_destroy(heads_bitmap);
	gbitmap_destroy(tails_bitmap);
	bitmap_layer_destroy(bitmap_layer);
}

/*
 * Init. Start everything here.
 */
static void init(void)
{
	// Very first thing we want to do is test that persist storage works.
	test_persist_storage();
	window = window_create();
	window_set_window_handlers(window, (WindowHandlers)
	{
		.load = window_load,
		.unload = window_unload,
	});
	window_set_click_config_provider(window, click_config_provider);
	// We want a different random order every time, so we seed the random function with the current time.
	srand(time(NULL));
	accel_tap_service_subscribe(accel_tap_handler);
	app_message_init();
	window_stack_push(window, true);
}

/*
 * Deinit. After window_unload is called, we want to also destroy the window. No memory leaks!
 */
static void deinit(void)
{
	window_destroy(window);
}

/*
 * Main!
 */
// int main(void)
// {
// 	init();
// 	app_event_loop();
// 	deinit();
// }


text:
class AddReferenceToTrack < ActiveRecord::Migration
  def change
    add_reference :tracks, :classroom, index: true
  end
end


text:
// Boost.Geometry - gis-projections (based on PROJ4)

// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.

// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.

// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

// This file is converted from PROJ4, http://trac.osgeo.org/proj
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels

// Last updated version of proj: 5.0.0

// Original copyright notice:

// 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.

#ifndef BOOST_GEOMETRY_PROJECTIONS_WAG3_HPP
#define BOOST_GEOMETRY_PROJECTIONS_WAG3_HPP

#include <boost/geometry/srs/projections/impl/base_static.hpp>
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
#include <boost/geometry/srs/projections/impl/projects.hpp>

namespace boost { namespace geometry
{

namespace projections
{
    #ifndef DOXYGEN_NO_DETAIL
    namespace detail { namespace wag3
    {
            template <typename T>
            struct par_wag3
            {
                T    C_x;
            };

            // template class, using CRTP to implement forward/inverse
            template <typename T, typename Parameters>
            struct base_wag3_spheroid
                : public base_t_fi<base_wag3_spheroid<T, Parameters>, T, Parameters>
            {
                par_wag3<T> m_proj_parm;

                inline base_wag3_spheroid(const Parameters& par)
                    : base_t_fi<base_wag3_spheroid<T, Parameters>, T, Parameters>(*this, par)
                {}

                // FORWARD(s_forward)  spheroid
                // Project coordinates from geographic (lon, lat) to cartesian (x, y)
                inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
                {
                    static const T two_thirds = detail::two_thirds<T>();

                    xy_x = this->m_proj_parm.C_x * lp_lon * cos(two_thirds * lp_lat);
                    xy_y = lp_lat;
                }

                // INVERSE(s_inverse)  spheroid
                // Project coordinates from cartesian (x, y) to geographic (lon, lat)
                inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
                {
                    static const T two_thirds = detail::two_thirds<T>();

                    lp_lat = xy_y;
                    lp_lon = xy_x / (this->m_proj_parm.C_x * cos(two_thirds * lp_lat));
                }

                static inline std::string get_name()
                {
                    return "wag3_spheroid";
                }

            };

            // Wagner III
            template <typename Params, typename Parameters, typename T>
            inline void setup_wag3(Params const& params, Parameters& par, par_wag3<T>& proj_parm)
            {
                T const ts = pj_get_param_r<T, srs::spar::lat_ts>(params, "lat_ts", srs::dpar::lat_ts);
                proj_parm.C_x = cos(ts) / cos(2.*ts/3.);
                par.es = 0.;
            }

    }} // namespace detail::wag3
    #endif // doxygen

    /*!
        \brief Wagner III projection
        \ingroup projections
        \tparam Geographic latlong point type
        \tparam Cartesian xy point type
        \tparam Parameters parameter type
        \par Projection characteristics
         - Pseudocylindrical
         - Spheroid
        \par Projection parameters
         - lat_ts: Latitude of true scale (degrees)
        \par Example
        \image html ex_wag3.gif
    */
    template <typename T, typename Parameters>
    struct wag3_spheroid : public detail::wag3::base_wag3_spheroid<T, Parameters>
    {
        template <typename Params>
        inline wag3_spheroid(Params const& params, Parameters const& par)
            : detail::wag3::base_wag3_spheroid<T, Parameters>(par)
        {
            detail::wag3::setup_wag3(params, this->m_par, this->m_proj_parm);
        }
    };

    #ifndef DOXYGEN_NO_DETAIL
    namespace detail
    {

        // Static projection
        BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_wag3, wag3_spheroid, wag3_spheroid)

        // Factory entry(s)
        BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(wag3_entry, wag3_spheroid)

        BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(wag3_init)
        {
            BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wag3, wag3_entry)
        }

    } // namespace detail
    #endif // doxygen

} // namespace projections

}} // namespace boost::geometry

#endif // BOOST_GEOMETRY_PROJECTIONS_WAG3_HPP


text:
`index.html` contains an example that will require faker with **all** locales.

If you need to use a single locale, you can require it directly as a stand-alone pack from the `/locales` folder here.