text:
title: Instruction Reference
layout: default
---
A bnd instruction is a property that starts with a minus sign ('-'). An instruction instructs bndlib to do something, in general providing parameters to the code. All instructions in bndlib are listed later in this page.

## Syntax

Almost all bndlib instructions follow the general OSGi syntax. However, the bndlib syntax is in general a bit more relaxed, for example you can use either single quotes (''') or double quotes ('"') while OSGi only allows double quotes. Dangling comma's and some other not exactly correct headers are accepted by bndlib without complaining. Values without quotes are accepted as long as they cannot confuse the general syntax. For example, a value like 1.20 does not have to be quoted since the period ('.') cannot confuse the parser on that place, however, a value like [1.3,4) must be quoted since it contains a comma.

In this mannual we adhere to the same conventions as the OSGi specification. This is mostly reflected in the names for the terminals in the syntax specifications. As a reminder we repeat the syntax rules and common terminals:

* `*` – Repetition of the previous element zero or more times, e.g. `( ',' element ) *`
* `+` – Repetition one or more times
* `?` – Previous element is optional
* `( ... )` – Grouping
* '...' – Literal
* `|` – Or
* `[...]` – Set (one of)
* `..` – Range
* `<...>` – Externally defined token, followed with a description
* `~` – Not, negation

The following terminals are pre-defined:

	ws               ::= <see Character.isWhitespace>
	digit            ::= [0..9]
	alpha            ::= [a..zA..Z]
	alphanum         ::= alpha | digit
	token            ::= ( alphanum | '_' | '-' )+
	number           ::= digit+
	jletter          ::= <see [JSL][1] for JavaLetter>
    jletterordigit   ::= <See [JLS][1] for JavaLetterOrDigit >
    qname            ::= <See [JLS][1] for fully qualified class name >
	identifier       ::= jletter jletterordigit *
    extended         ::= ( alphanum | '_' | '-' | '.' )+
	quoted-string-d  ::= '"' ( ~["\#x0D#x0A#x00] | '\"'|'\')* '"'
	quoted-string-s  ::= ''' ( ~['\#x0D#x0A#x00] | '\''|'\')* '''
	quoted-string    ::= quoted-string-s | quoted-string-d
	special-chars    ::= ~["\#x0D#x0A#x00:=;,<See [JLS][1] for whitespace>]
	path             ::= special-chars+ | quoted-string
	value            ::= quoted-string | path
	argument         ::= extended  | quoted-string
	parameter        ::= directive | attribute
	directive        ::= extended ':=' argument
	attribute        ::= extended '=' argument
	parameters       ::= parameter ( ',' parameter ) *
	unique-name      ::= identifier ( '.' identifier )*
	symbolic-name    ::= token('.'token)*
	package-name     ::= unique-name

	version          ::= major( '.' minor ( '.' micro ( '.' qualifier )? )? )?
	major            ::= number
	minor            ::= number
	micro            ::= number
	qualifier        ::= ( alphanum | '_' | '-' )+

	version-range    ::= interval | atleast
	interval         ::= ( '[' | '(' ) floor ',' ceiling ( ']' | ')' )
	atleast          ::= version
	floor            ::= version
	ceiling          ::= version

White spaces between terminals are ignored unless specifically noted. The only exception is the directive, a directive must be connected to the colon (':'). That is, bndlib stores attributes and directives in the same map and distinguishes them by the fact that directives end in a colon and attributes do not. For example, using a directive like `foo; path := http://www.xyz.com` will not work correctly because the `path :` is not a valid attribute nor directive name. Any value that contains a space, a tab, a comma, colon, semicolon, equal sign or any other character that is part of a terminal in the grammar must be quoted.

Almost all bndlib instructions follow the general OSGi syntax for a header.

	-instruction     ::= parameters
	parameters       ::= clause ( ',' clause ) *
	clause           ::= path ( ';' path ) *
	                          ( ';' parameter ) *

There are a number of short-cuts that are regularly used in bnd commands:

	list             ::= value ( ',' value ) *
	url              ::= <URL>
	file-path        ::= <file path, using / as separator>

## Merged Instructions

Most instructions that accept multiple clauses are _merged instructions_. A merged instruction is an instruction which is specified by its prefix but which will merge any property that starts with this prefix followed by a period ('.'). For example, the _base instruction_ `-plugin` instruction accepts `-plugin.git` as well. The reason for this merging is that allows to append the base instruction with instructions from other files. For example, the bnd file in the `cnf/ext` directory are automatically included in the properties of the workspace. Since there can be many files, there would be a need to coordinate the using of a singleton base instruction. As always, singletons suck and in this case we solved it with merged instructions.

Some instructions put, sometimes very subtle, semantics on their ordering. To prevent different results from run to run, we make order the merge properties by placing the base instruction in front and then followed by the values from the other keys in lexically sorted order. For example, `-a`, `-a.x`, and `-a.Z`, and `-a.1` will concatenate the clauses in the order `-a,-a.1,-a.Z,-a.x`.

Each of the constituents of the merged properties can be empty, this is properly handled by bndlib and will not create a an empty clause as would easily happen when the same thing was done with macros. Empty clauses can help when there is an optionality that depends on some condition.

As an example, lets set the `-buildpath` instruction:

	-buildpath: com.example.foo;version=1.2

	-buildpath.extra: ${if;${debug};com.example.foo.debug\;version=1.2}

This will result in a buildpath of (when debug is not false) of: `com.example.foo;version=1.2, com.example.foo.debug;version=1.2`.

## SELECTOR

If a value in an instrucion has a _scope_ then you will be able to use a _selector_. A scope is a well defined, finite, set. For example, if you use the '-exportcontents' instruction you can specify the packages that can be exported. Since you can only export the packages that are inside your bundle, the scope is the set of package names that were collected so far.

The syntax for a selector is:

	selector ::= '!' ?
	             '=' ?
	                  '*' | ( '.' | '?' | '|' | '*' | '$' | . ) *
	             ( '.*' ) ?
	             ( ':i' ) ?

A selector is an expression that is matched against all members of the scope. For example, `com.example.*` will match any package name that starts with `com.example`, for example `com.example.foo`, as well as `com.example` itself. The syntax used to describe the wildcarding is based on a globbing kind model, however, the selector is translated into a regular expression according to some simple rules.

The replacement rules to build the regular expression are as follows:

* `*` – Is replaced with `.*`, matching any number of characters, triggers wildcard match.
* `?` - Is replaced with `.?`, matching any character, triggers wildcard match.
* `|` – Is inserted as is, triggers wildcard match.
* `$` – Escaped to `\$`.
* `.` – The dot is treated as a package segment separator. It is escaped with `\.`. However, if the match ends with `.*`, the replacement will be `(\..*)?`.  This triggers a wildcard match.

If you want to go ballistic with regular expressions, then you can go ahead. As long as the wildcards are triggered by one of the defined characters, the replaced string will be used as a regular expression.

If the selector ends with `:i` then a case insensitive match is requested, this will ignore any case differences.

A selector can be prefixed with an exclamation mark, this indicates that a match must be treated as a removal operation. To understand removal, it is necessary to realize that the selectors are not declarative, the order of the selectors is relevant.

When bndlib has a scope, it will iterator over each element in the scope and then for element it will iterator over each selector. If there is a match on the scope member then it is always removed from the scope, it will not be matched against later selectors. If the selector starts with an exclamation mark then the member is removed. but it is not treated as a result. Ergo, the exclamation mark allows you to remove members before they are actually matched.

For example, you want to match all implementation packages (i.e. they have `impl` in their name) except when they start with `com.example`. This can be achieved with:

	!com.example.*impl*, *.impl.*

Last, and also least, you can prefix the selector with an equal sign ('=') (after the exclamation mark if one is present). This will signal a literal match with the string, no globbing will be done.

The way the period ('.') is treated is kind of special. The reason is that people expect that the selector `com.example.*` actually includes the package `com.example` itself. In bndlib this has always been the case although the OSGi Alliance later decided to not follow this pattern when there was a need for the globbing of packages.

In this example, the first selector will remove any match and ignore it, the second selector now only sees scope members that are fitting in the earlier pattern.

Selectors are used in virtually any place where there is a reasonable scope. It is a very powerful feature. However, it is also easy to go overboard. If you find you need to use this feature excessively then you are likely overdoing it.

## FILE

One of the most painful thing in making bndlib run anywhere is handling of files. Even though Java has a decent abstraction of the file system, problems with spaces in file names and backslashes in the wrong place have caused an uneven amount of bugs. Ok, this partially because most bndlib developers tend to use Macs, still no excuse and quite embarrassing.

Since bnd files need to be portable across environments we've chosen to use the Unix file separator, the slash (or solidus '/') for more reasons than I can reasonable be sum up here (what was Bill smoking when he picked the reverse solidus for file separator!). In bndlib, all file paths (ok, should) always go through a single method that actually parses it and turns it into a Java File object. This allows us to support a number of features in a portable way. The syntax of a file path is therefore:

	file      ::=  ( '~/' | '/' )?  (  ~['/']+ '/' ) * ~['/'] *

If a file path starts with:

*  A slash ('/') then we go to the root of the current directory's file system. Sorry, there is no way for a windows user to specify another file system since this would break portability.
* '~/', then the remainder of the file path is relative to the user's home directory as defined by Java. To keep your workspace portable, make sure you do not store any information there that might break the build for others. However, this can be useful to store passwords etc.
* Anything else, then the path is relative. It depends in the context what the used root is of the path. In general, if there is a local file that creates this path, then the parent directory of this file is the root. Otherwise, if this path is used in relation a workspace, project, build, or bndrun then the _base_ of each of these entities is used as the root. In other cases it is the actual working directory of the process.

You can use the '..' operator for a segment in the file path to indicate a parent directory. It is highly advised to always use relative addressing to keep your workspace portable. However, there are a number of macros that can be used as anchors:

* `${p}`, `${project} – The directory of the current project
* `${workspace}` – The directory of the current workspace
* `${build} – The directory of the `cnf` directory.

## PATH

A PATH is a _repository specification_. It is a specification for a number of JARs and/or bundles from a repository (well, most of the time). A PATH has the following syntax:

	PATH              ::= target ( ',' target ) *
	target            ::= ( entry | FILE ';' 'version' '=' 'file' ) ( ';' PARAMETERS ) *
	entry             ::= symbolic-name ( ';' version ) ?
	version	          ::= 'version' '=' ( RANGE | 'latest' | 'project' | 'snapshot' )

A PATH defines a number of bundles with its _entries_. Each entry is either a FILE or a symbolic-name. If only a symbolic name is specified, the default will be the import range from 0.0.0. This selects the whole repository for the given symbolic name. Outside the default, the repository entry can be specified in the following ways:

* RANGE – A version range limits the entries selected from the active repositories.
* `latest` –
* `project` –
* `snapshot` –

## Reference

{% for instruction in site.instructions %}
{{instruction.title}}

{{instruction.summary}}

{% endfor %}


text:
$(document).ready(function(){
return true;
});

//fucntion openTab(divID){

}

redpajama_set_name: RedPajamaGithub


text:
/*jslint indent: 2, nomen: true, maxlen: 100, white: true, plusplus: true, unparam: true */
/*global require, applicationContext*/
'use strict';

////////////////////////////////////////////////////////////////////////////////
/// @brief A Demo Foxx-Application written for ArangoDB
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2014-2016 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
///     http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Frank Celler
/// @author Copyright 2014-2016, ArangoDB GmbH, Cologne, Germany
/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////

/*
    todo: example using underscore templates
    todo: example on how to properly create CRUD using a repository
    todo: example on format middleware
    todo: POST form example
*/

// standard ArangoDB modules
const conole = require("console");

const arangodb = require("@arangodb");
const actions = require("@arangodb/actions");
const createRouter = require("@arangodb/foxx/router");

// standard ArangoDB variables
const db = arangodb.db;

// HELLO-FOXX collections and libraries
const texts = module.context.collection('texts');
const helloworld = require("./lib/a").text;

// HELLO-FOXX router
const router = createRouter();
module.exports = router;

// this part is here to generate the examples, DO NOT USE in your code!
const snipplets = {};
const sections = {};

const sectionRouteParameters = "Route parameters, request & response";
const sectionDatabase = "Accessing the database";
const sectionModels = "Using models";
const sectionDebugging = "Debugging";
const sectionError = "Error handling";
const sectionMisc = "Misc";

function executeSourceCode(section, name, desc, code) {
  const func = new Function('router, db, texts, require, module, actions, helloworld', code);
  func(router, db, texts, require, module, actions, helloworld);

  const parts = name.split("|");
  const key = parts[0];
  snipplets[key] = code.trim();

  if (sections[section] === undefined) {
    sections[section] = [];
  }

  if (parts[1] === "NOLINK") {
    sections[section].push([ key, desc, "NOLINK" ]);
  } else {
    sections[section].push([ key, desc, parts.join("") ]);
  }
}

// -----------------------------------------------------------------------------
// Section: Route parameters, request & response
// -----------------------------------------------------------------------------

// .............................................................................
// Example: Route without parameters & simple text output with static text
// .............................................................................

executeSourceCode(
  sectionRouteParameters,
  "hello",
  "Route without parameters, returns plain text",
  `
router.get('/hello', function (req, res) {
  res.set("Content-Type", "text/plain; charset=utf-8");
  res.body = "Hello World!\\n";
});
`);

// .............................................................................
// Example: Route without parameters & simple text output with JSON object
// .............................................................................

executeSourceCode(
  sectionRouteParameters,
  "hello_text",
  "Route without parameters, returns plain text from JSON",
  `
router.get('/hello_text', function (req, res) {
  // default content type is text/plain
  res.body = { result: "Hello World!\\n" };
});
`);

// .............................................................................
// Example: Route without parameters & simple JSON output with JSON object
// .............................................................................

executeSourceCode(
  sectionRouteParameters,
  "hello_json",
  "Route without parameters, returns JSON object",
  `
router.get('/hello_json', function (req, res) {
  res.json({ result: "Hello World!\\n" });
});
`);

// .............................................................................
// Example: Route with parameter & simple text output
// .............................................................................

executeSourceCode(
  sectionRouteParameters,
  "hello_name|/John%20Doe",
  "Route with parameter, returns plain text",
  `
router.get("/hello_name/:name", function (req, res) {
  res.body = "Hello " + req.param("name");
});
`);

// .............................................................................
// Example: Accessing the query component, return text
// .............................................................................

executeSourceCode(
  sectionRouteParameters,
  "sum|?a=40&b=2",
  "Route with query component, returns plain text",
  `
router.get("/sum", function (req, res) {
  const sum = parseInt(req.param("a"), 10) + parseInt(req.param("b"), 10);
  res.body = "Result is " + sum.toString();
}).queryParam("a").queryParam("b");
`);

// -----------------------------------------------------------------------------
// Section: Accessing the database
// -----------------------------------------------------------------------------

// .............................................................................
// Example: get an entry from the texts-collection in ArangoDB. The collection is
// set up and populated in scripts/setup.js
// .............................................................................

executeSourceCode(
  sectionDatabase,
  "get_from_db",
  "Get entry from ArangoDB collection",
  `
router.get('/get_from_db', function (req, res) {
  res.body = texts.any().text + "\\n";
});
`);

// .............................................................................
// Example: run AQL query from FOXX
// .............................................................................

executeSourceCode(
  sectionDatabase,
  "run_aql",
  "Run AQL query from Foxx",
  `
router.get('/run_aql', function (req, res) {
  res.set("Content-Type", "text/plain; charset=utf-8");

  const stmt = db._createStatement({ "query": "FOR i IN [ 1, 2 ] RETURN i * 2" });
  const c = stmt.execute();

  res.json(c.toArray());
});
`);

// -----------------------------------------------------------------------------
// Section: Using models
// -----------------------------------------------------------------------------

// .............................................................................
// Example: use method
// .............................................................................

executeSourceCode(
  sectionModels,
  "tiger|/Roy",
  "Use a method",
  `
router.get('/tiger/:name', function (req, res) {
  const Tiger = require("./models/tiger").Tiger;
  const myTiger = new Tiger(req.param("name"));

  res.set("Content-Type", "text/plain; charset=utf-8");
  res.body = myTiger.growl();
});
`);

// .............................................................................
// Example: Save FoxxModel in DB
// .............................................................................

executeSourceCode(
  sectionModels,
  "save_tiger|NOLINK",
  "Validate a model",
  `
const TigerModel = require("./models/tiger").Model;

router.post('/save_tiger/:name', function (req, res) {
  texts.save(req.body);

  res.set("Content-Type", "text/plain; charset=utf-8");
  res.body = "Validated and saved it in texts collection";
}).body(TigerModel);
`);

// -----------------------------------------------------------------------------
// Section: Debugging
// -----------------------------------------------------------------------------

// .............................................................................
// Example: write to ArangoDB log
// .............................................................................

executeSourceCode(
  sectionDebugging,
  "log",
  "Write to ArangoDB log",
  `
router.get('/log', function (req, res) {
  try {
    throw new RangeError("[hello-foxx] Division by zero!");
  }
  catch (e) {
    console.warn(e.message);
  }

  res.body = "division by zero error was triggered and an "
    + "exception message was logged in arangodb log";
});
`);

// .............................................................................
// Example: echo the response object
// .............................................................................

executeSourceCode(
  sectionDebugging,
  "echo_response",
  "Echo the request object ",
  `
router.get('/echo_response', function (req, res, options, next) {
  const result = { request: req };
  res.json(result);
});
`);

// .............................................................................
// Example: convert the response object to text
// .............................................................................

executeSourceCode(
  sectionDebugging,
  "inspect_response",
  "Inspect the request object ",
  `
router.get('/inspect_response', function (req, res, next) {
  const result = { request: req };
  res.body = require("@arangodb").inspect(result);
});
`);

// .............................................................................
// Example: getting the context
// .............................................................................

executeSourceCode(
  sectionDebugging,
  "context",
  "Show the module context",
  `
router.get('/context', function (req, res) {
  res.set("Content-Type", "text/plain");
  res.body = require("@arangodb").inspect(module.context) + " \\n";
});
`);

// -----------------------------------------------------------------------------
// Section: Error handling
// -----------------------------------------------------------------------------

// .............................................................................
// Example: Return http status 303 and an error object
// .............................................................................

executeSourceCode(
  sectionError,
  "error",
  "Return HTTP status 403 and an error object",
  `
router.get('/error',function (req, res) {
  try {
    throw new RangeError("[hello-foxx] Division by zero!");
  } catch (e) {
    if (!(e instanceof RangeError)) {
      throw e;
    }

    res.throw(403, "This went completely wrong. Sorry!");
  }
}).error(403, "throw an forbidden as example");
`);

// -----------------------------------------------------------------------------
// Section: Misc
// -----------------------------------------------------------------------------

// .............................................................................
// Example: Deliver static file
// .............................................................................

executeSourceCode(
  sectionMisc,
  "static.html",
  "Show static html file",
  `
/* no special code required, the manifest contains

  "files": {
    "/": "files"
  },

*/
`);

// .............................................................................
// Example: Accessing global variables
// .............................................................................

executeSourceCode(
  sectionMisc,
  "global_var",
  "Accessing a global variable",
  `
router.get('/global_var', function (req, res) {
  res.set("Content-Type", "text/plain; charset=utf-8");
  res.body = helloworld + " and accessed through a global variable\\n";
});
`);

// .............................................................................
// Example: local require
// .............................................................................

executeSourceCode(
  sectionMisc,
  "local_require",
  "Accessing a module locally",
  `
router.get('/local_require', function (req, res) {
  res.set("Content-Type", "text/plain; charset=utf-8");
  res.body = require("./lib/a").text + " and accessed with a local require\\n";
  res.statusCode = actions.HTTP_OK;
});
`);

// .............................................................................
// Example: around
// .............................................................................

executeSourceCode(
  sectionMisc,
  "log_request",
  "Middleware to log all requests",
  `
router.get('/log_request', function (req, res) {
  const result = { a: 1, b: 2, c: "Hallo World" };
  res.responseCode = actions.HTTP_OK;
  res.body = result;
});

router.use('/log_request', function (req, res, next) {
  let start = Date.now();
  next();
  console.log('Request handled in', Date.now() - start, 'ms');
});
`);

// .............................................................................
// Helper function to retrieve the source code of the defined routes
// .............................................................................

router.get('/source', function (req, res) {
  const normalize = function (url) {
    return url.replace(/^\/?([a-zA-Z0-9_]+).*$/, '$1');
  };

  const source = {};

  for (let key in snipplets) {
    if (snipplets.hasOwnProperty(key)) {
      source[normalize(key)] = snipplets[key];
    }
  }

  const secs = [];

  Object.keys(sections).forEach(function(key) {
    secs.push({ name: key, routes: sections[key] });
  });

  res.json({ sources: source, sections: secs });
});


text:
using Orchard.Autoroute.Models;
using Orchard.Autoroute.Settings;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Aspects;
using Orchard.ContentManagement.MetaData;
using Orchard.ContentManagement.MetaData.Models;
using Orchard.Localization;
using Orchard.Localization.Services;
using Orchard.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Orchard.Autoroute.Services
{
    public class DefaultAliasPatternProvider : IAliasPatternProvider
    {
        private readonly ICultureManager _cultureManager;
        private readonly IContentDefinitionManager _contentDefinitionManager;

        public DefaultAliasPatternProvider(
            IContentDefinitionManager contentDefinitionManager,
            ICultureManager cultureManager)
        {
            _cultureManager = cultureManager;
            _contentDefinitionManager = contentDefinitionManager;

            Logger = NullLogger.Instance;
            T = NullLocalizer.Instance;
        }

        public ILogger Logger { get; set; }
        public Localizer T { get; set; }

        public string GetPatternFor(IContent content)
        {
            // var settings = part.TypePartDefinition.Settings.GetModel<AutorouteSettings>();
            //if (settings.UseCulturePattern)
            //{
            //    // TODO: Refactor the below so that we don't need to know about Request.Form["Localization.SelectedCulture"].
            //    // If we are creating from a form post we use the form value for culture.
            //    var context = _httpContextAccessor.Current();
            //    var selectedCulture = context.Request.Form["Localization.SelectedCulture"];
            //    if (!String.IsNullOrEmpty(selectedCulture))
            //    {
            //        itemCulture = selectedCulture;
            //    }
            //}

            string itemCulture = _cultureManager.GetSiteCulture();
            // If we are editing an existing content item.
            if (content.Has<ILocalizableAspect>())
            {
                var aspect = content.As<ILocalizableAspect>();
                if (aspect != null)
                {
                    itemCulture = aspect.Culture;
                }
            }

            string pattern = GetDefaultPattern(content.ContentItem.ContentType, itemCulture).Pattern;
            if (content.Has<AutoroutePart>())
            {
                var part = content.As<AutoroutePart>();

                // String.Empty forces pattern based generation. "/" forces homepage
                if (part.UseCustomPattern
                    && (!String.IsNullOrWhiteSpace(part.CustomPattern) || String.Equals(part.CustomPattern, "/")))
                {
                    pattern = part.CustomPattern;
                }
            }

            return pattern;
        }

        public void CreatePattern(string contentType, string name, string pattern, string description, bool makeDefault)
        {
            var contentDefinition = _contentDefinitionManager.GetTypeDefinition(contentType);

            if (contentDefinition == null)
            {
                throw new OrchardException(T("Unknown content type: {0}", contentType));
            }

            var settings = contentDefinition.Settings.GetModel<AutorouteSettings>();

            var routePattern = new RoutePattern
            {
                Description = description,
                Name = name,
                Pattern = pattern,
                Culture = _cultureManager.GetSiteCulture()
            };

            var patterns = settings.Patterns;
            patterns.Add(routePattern);
            settings.Patterns = patterns;

            // Define which pattern is the default.
            if (makeDefault || settings.Patterns.Count == 1)
            {
                settings.DefaultPatterns = new List<DefaultPattern> { new DefaultPattern { PatternIndex = "0", Culture = settings.Patterns[0].Culture } };
            }

            _contentDefinitionManager.AlterTypeDefinition(contentType, builder => builder.WithPart("AutoroutePart", settings.Build));
        }

        public IEnumerable<RoutePattern> GetPatterns(string contentType)
        {
            var settings = GetTypePartSettings(contentType).GetModel<AutorouteSettings>();
            return settings.Patterns;
        }

        public RoutePattern GetDefaultPattern(string contentType, string culture)
        {
            var settings = GetTypePartSettings(contentType).GetModel<AutorouteSettings>();
            var defaultPattern = settings.DefaultPatterns.FirstOrDefault(x => x.Culture == culture);
            var defaultPatternIndex = defaultPattern != null ? defaultPattern.PatternIndex : "0";

            if (String.IsNullOrWhiteSpace(defaultPatternIndex))
                defaultPatternIndex = "0";

            if (!settings.DefaultPatterns.Any(x => String.Equals(x.Culture, culture, StringComparison.OrdinalIgnoreCase)))
            {
                var patternIndex = String.IsNullOrWhiteSpace(settings.DefaultPatternIndex) ? "0" : settings.DefaultPatternIndex;
                // Lazy updating from old setting.
                if (String.Equals(culture, _cultureManager.GetSiteCulture(), StringComparison.OrdinalIgnoreCase))
                {
                    settings.DefaultPatterns.Add(new DefaultPattern { PatternIndex = patternIndex, Culture = culture });
                    return settings.Patterns.Where(x => x.Culture == null).ElementAt(Convert.ToInt32(defaultPatternIndex));
                }
                else {
                    settings.DefaultPatterns.Add(new DefaultPattern { PatternIndex = "0", Culture = culture });
                    return new RoutePattern { Name = "Title", Description = "my-title", Pattern = "{Content.Slug}", Culture = culture };
                }
            }

            // Return a default pattern if set.
            var patternCultureSearch = settings.Patterns.Any(x => String.Equals(x.Culture, culture, StringComparison.OrdinalIgnoreCase)) ? culture : null;

            if (settings.Patterns.Any())
            {
                if (settings.Patterns.Where(x => x.Culture == patternCultureSearch).ElementAt(Convert.ToInt32(defaultPatternIndex)) != null)
                {
                    return settings.Patterns.Where(x => x.Culture == patternCultureSearch).ElementAt(Convert.ToInt32(defaultPatternIndex));
                };
            }

            // Return a default pattern if none is defined.
            return new RoutePattern { Name = "Title", Description = "my-title", Pattern = "{Content.Slug}", Culture = culture };
        }

        private SettingsDictionary GetTypePartSettings(string contentType)
        {
            var contentDefinition = _contentDefinitionManager.GetTypeDefinition(contentType);

            if (contentDefinition == null)
            {
                throw new OrchardException(T("Unknown content type: {0}", contentType));
            }

            return contentDefinition.Parts.First(x => x.PartDefinition.Name == "AutoroutePart").Settings;
        }
    }
}


text:
<!--

    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.

-->
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >
<suite name="Pulsar Test Suite" parallel="instances" thread-count="1">
    <suite-files>
        <suite-file path="./pulsar-cli.xml" />
        <suite-file path="./pulsar-schema.xml" />
        <suite-file path="./pulsar-process.xml" />
        <suite-file path="./pulsar-sql.xml" />
        <suite-file path="./pulsar-thread.xml" />
        <suite-file path="./tiered-jcloud-storage.xml" />
        <suite-file path="./tiered-filesystem-storage.xml"/>
        <suite-file path="./pulsar-function.xml" />
        <suite-file path="./pulsar-messaging.xml" />
        <suite-file path="./pulsar-backwards-compatibility.xml" />
        <suite-file path="./pulsar-io-sinks.xml" />
        <suite-file path="./pulsar-io-sources.xml" />
        <suite-file path="./pulsar-io-ora-source.xml" />
        <suite-file path="./pulsar-python.xml" />
        <suite-file path="./pulsar-semantics.xml" />
        <suite-file path="./pulsar-upgrade.xml" />
    </suite-files>
</suite>


text:
Frequently Asked Questions
!!!!!!!!!!!!!!!!!!!!!!!!!!

Alignments for my transcript are not available. What can I do?
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

The short answer is: not much.

In order to project a variant between genomic and transcript
coordinates, `hgvs` needs a sequence alignment.  Sequence alignments
are obtained from the Universal Transcript Archive (UTA), a compendium
of transcripts and their genome alignments from multiple sources.
Data are loaded from snapshots; the loading process is currently
semi-automated and run irregularly.

UTA loads only high-quality alignments exactly as provided by the data
sources.  If an alignment is not provided by a data source, or if it
fails filters recommended by NCBI, it won't be in UTA (with a small
number of exceptions). Importantly, NCBI provides alignment data only
for current transcripts against current assemblies; historical data
are not available.

So, there are two common reasons that an alignment may not exist in
UTA:

* The transcript was obsoleted before UTA started in 2014, or existed
  only *between* UTA snapshots.

* The transcript does not have any high-quality alignments.

If an alignment for a particular transcript-reference sequence pair
and for a particular alignment method are not available, an exception
like the following will be raised::

  HGVSDataNotAvailableError: No alignments for NM_000018.2 in GRCh37 using splign

Currently, there is no way for users to provide their own alignments.

For example, UTA contains ten alignments for NM_000314 family of
transcripts for PTEN:

+-------------+----------------+----------------+
| transcript  | genome         | method         |
+=============+================+================+
| NM_000314.4 | AC_000142.1    | splign         |
+-------------+----------------+----------------+
| NM_000314.4 | NC_000010.10   | blat           |
+-------------+----------------+----------------+
| NM_000314.4 | NC_000010.10   | splign         |
+-------------+----------------+----------------+
| NM_000314.4 | NC_018921.2    | splign         |
+-------------+----------------+----------------+
| NM_000314.4 | NG_007466.2    | splign         |
+-------------+----------------+----------------+
| NM_000314.5 | NC_000010.10   | splign         |
+-------------+----------------+----------------+
| NM_000314.6 | NC_000010.10   | blat           |
+-------------+----------------+----------------+
| NM_000314.6 | NC_000010.10   | splign         |
+-------------+----------------+----------------+
| NM_000314.6 | NC_000010.11   | splign         |
+-------------+----------------+----------------+
| NM_000314.6 | NW_013171807.1 | splign         |
+-------------+----------------+----------------+

A variant can be projected between any of the transcript, genome, and
method combinations, and no other combination.

Why do I get different results on the UCSC browser?
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

The UCSC Genome Browser uses alignments generated by BLAT, which gives
different results than the official alignments generated by NCBI using
splign.  Although BLAT and splign typically agree, there are many
small differences in ambiguous alignments and even some substantial
differences in a small number of transcripts.  In some cases, the
differences might cause a variant to be interpreted as coding using a
splign alignment and non-coding by a BLAT alignment, or vice
versa. Furthermore, one typically doesn't know which alignment set was
used when publishing a variant. (Yes, that's a hot mess.)

Why do I get different results with Mutalyzer?
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Some transcript-genome alignments contain indels.  `hgvs` is careful
to account for these indel discrepancies when projecting variants. In
contrast, Mutalyzer does not account for such discrepancies.
Therefore, the Mutalyzer results will be incorrect when projecting or
validating a variant that is downstream of the first indel.  For
details and other examples, see
https://www.ncbi.nlm.nih.gov/pubmed/30129167.


text:
export const SQL_DATA_TYPES: [name: string, runtime: string, description: string][];
export const SQL_FUNCTIONS: Record<string, [args: string, description: string][]>;


text:
PORTNAME=	Microsoft.AspNetCore.Mvc.Core
PORTVERSION=	1.0.0.0

BUILD_DEPENDS+=	Microsoft.Extensions.SecurityHelper.Sources>=1.0:${PORTSDIR}/dotnet/Microsoft.Extensions.SecurityHelper.Sources \
		Microsoft.Extensions.PropertyHelper.Sources>=1.0:${PORTSDIR}/dotnet/Microsoft.Extensions.PropertyHelper.Sources \
		Microsoft.Extensions.PropertyActivator.Sources>=1.0:${PORTSDIR}/dotnet/Microsoft.Extensions.PropertyActivator.Sources \
		Microsoft.Extensions.HashCodeCombiner.Sources>=1.0:${PORTSDIR}/dotnet/Microsoft.Extensions.HashCodeCombiner.Sources \
		Microsoft.Extensions.ClosedGenericMatcher.Sources>=1.0:${PORTSDIR}/dotnet/Microsoft.Extensions.ClosedGenericMatcher.Sources \
		Microsoft.Extensions.CopyOnWriteDictionary.Sources>=1.0:${PORTSDIR}/dotnet/Microsoft.Extensions.CopyOnWriteDictionary.Sources \
		Microsoft.AspNetCore.Routing.DecisionTree.Sources>=1.0:${PORTSDIR}/dotnet/Microsoft.AspNetCore.Routing.DecisionTree.Sources

NET_DEPENDS+=	System.Collections>=1.0:${PORTSDIR}/dotnet/System.Collections \
		System.Collections.Concurrent>=1.0:${PORTSDIR}/dotnet/System.Collections.Concurrent \
		System.ComponentModel.TypeConverter>=1.0:${PORTSDIR}/dotnet/System.ComponentModel.TypeConverter \
		System.IO.FileSystem>=1.0:${PORTSDIR}/dotnet/System.IO.FileSystem \
		System.Linq.Expressions>=1.0:${PORTSDIR}/dotnet/System.Linq.Expressions \
		System.Runtime>=1.0:${PORTSDIR}/dotnet/System.Runtime \
		System.Runtime.Extensions>=1.0:${PORTSDIR}/dotnet/System.Runtime.Extensions \
		System.Security.Claims>=1.0:${PORTSDIR}/dotnet/System.Security.Claims \
		Microsoft.Extensions.Primitives>=1.0:${PORTSDIR}/dotnet/Microsoft.Extensions.Primitives \
		Microsoft.Extensions.ObjectPool>=1.0:${PORTSDIR}/dotnet/Microsoft.Extensions.ObjectPool \
		Microsoft.Extensions.Options>=1.0:${PORTSDIR}/dotnet/Microsoft.Extensions.Options \
		Microsoft.Extensions.DependencyInjection.Abstractions>=1.0:${PORTSDIR}/dotnet/Microsoft.Extensions.DependencyInjection.Abstractions \
		Microsoft.Extensions.Logging.Abstractions>=1.0:${PORTSDIR}/dotnet/Microsoft.Extensions.Logging.Abstractions \
		Microsoft.Extensions.DependencyModel>=1.0:${PORTSDIR}/dotnet/Microsoft.Extensions.DependencyModel \
		Microsoft.AspNetCore.Http.Features>=1.0:${PORTSDIR}/dotnet/Microsoft.AspNetCore.Http.Features \
		Microsoft.AspNetCore.Http.Abstractions>=1.0:${PORTSDIR}/dotnet/Microsoft.AspNetCore.Http.Abstractions \
		Microsoft.AspNetCore.Http>=1.0:${PORTSDIR}/dotnet/Microsoft.AspNetCore.Http \
		Microsoft.AspNetCore.Http.Extensions>=1.0:${PORTSDIR}/dotnet/Microsoft.AspNetCore.Http.Extensions \
		Microsoft.AspNetCore.Routing.Abstractions>=1.0:${PORTSDIR}/dotnet/Microsoft.AspNetCore.Routing.Abstractions \
		Microsoft.AspNetCore.Routing>=1.0:${PORTSDIR}/dotnet/Microsoft.AspNetCore.Routing \
		Microsoft.AspNetCore.Hosting.Abstractions>=1.0:${PORTSDIR}/dotnet/Microsoft.AspNetCore.Hosting.Abstractions \
		Microsoft.AspNetCore.Authorization>=1.0:${PORTSDIR}/dotnet/Microsoft.AspNetCore.Authorization \
		Microsoft.AspNetCore.WebUtilities>=1.0:${PORTSDIR}/dotnet/Microsoft.AspNetCore.WebUtilities \
		Microsoft.AspNetCore.Mvc.Abstractions>=1.0:${PORTSDIR}/dotnet/Microsoft.AspNetCore.Mvc.Abstractions \
		Microsoft.Extensions.PlatformAbstractions>=1.0:${PORTSDIR}/dotnet/Microsoft.Extensions.PlatformAbstractions \
		Microsoft.Net.Http.Headers>=1.0:${PORTSDIR}/dotnet/Microsoft.Net.Http.Headers \
		System.Buffers>=1.0:${PORTSDIR}/dotnet/System.Buffers \
		System.Diagnostics.DiagnosticSource>=1.0:${PORTSDIR}/dotnet/System.Diagnostics.DiagnosticSource

GH_PROJECT=	Mvc

DOTNET_RESOURCE_COMMAND=cd ${WRKSRC}/src/${PORTNAME} && ${DOTNET_RESGEN} Resources.resx,${PORTNAME}.Resources.resources

DOTNET_REFERENCES+=	${DOTNET_REF}:${DOTNET_PATH}/System.Collections.dll \
			${DOTNET_REF}:${DOTNET_PATH}/System.Collections.Concurrent.dll \
			${DOTNET_REF}:${DOTNET_PATH}/System.ComponentModel.TypeConverter.dll \
			${DOTNET_REF}:${DOTNET_PATH}/System.Diagnostics.Debug.dll \
			${DOTNET_REF}:${DOTNET_PATH}/System.IO.FileSystem.dll \
			${DOTNET_REF}:${DOTNET_PATH}/System.Linq.dll \
			${DOTNET_REF}:${DOTNET_PATH}/System.Linq.Expressions.dll \
			${DOTNET_REF}:${DOTNET_PATH}/System.Private.Uri.dll \
			${DOTNET_REF}:${DOTNET_PATH}/System.Runtime.dll \
			${DOTNET_REF}:${DOTNET_PATH}/System.Runtime.Extensions.dll \
			${DOTNET_REF}:${DOTNET_PATH}/System.Security.Claims.dll \
			${DOTNET_REF}:${DOTNET_PATH}/Microsoft.Extensions.Primitives.dll \
			${DOTNET_REF}:${DOTNET_PATH}/Microsoft.Extensions.ObjectPool.dll \
			${DOTNET_REF}:${DOTNET_PATH}/Microsoft.Extensions.Options.dll \
			${DOTNET_REF}:${DOTNET_PATH}/Microsoft.Extensions.DependencyInjection.Abstractions.dll \
			${DOTNET_REF}:${DOTNET_PATH}/Microsoft.Extensions.Logging.Abstractions.dll \
			${DOTNET_REF}:${DOTNET_PATH}/Microsoft.Extensions.PlatformAbstractions.dll \
			${DOTNET_REF}:${DOTNET_PATH}/Microsoft.Extensions.FileProviders.Abstractions.dll \
			${DOTNET_REF}:${DOTNET_PATH}/Microsoft.AspNetCore.Http.dll \
			${DOTNET_REF}:${DOTNET_PATH}/Microsoft.AspNetCore.Http.Features.dll \
			${DOTNET_REF}:${DOTNET_PATH}/Microsoft.AspNetCore.Http.Extensions.dll \
			${DOTNET_REF}:${DOTNET_PATH}/Microsoft.AspNetCore.Http.Abstractions.dll \
			${DOTNET_REF}:${DOTNET_PATH}/Microsoft.AspNetCore.Routing.Abstractions.dll \
			${DOTNET_REF}:${DOTNET_PATH}/Microsoft.AspNetCore.Routing.dll \
			${DOTNET_REF}:${DOTNET_PATH}/Microsoft.AspNetCore.Hosting.Abstractions.dll \
			${DOTNET_REF}:${DOTNET_PATH}/Microsoft.AspNetCore.Authorization.dll \
			${DOTNET_REF}:${DOTNET_PATH}/Microsoft.AspNetCore.WebUtilities.dll \
			${DOTNET_REF}:${DOTNET_PATH}/Microsoft.AspNetCore.Mvc.Abstractions.dll \
			${DOTNET_REF}:${DOTNET_PATH}/Microsoft.Extensions.DependencyModel.dll \
			${DOTNET_REF}:${DOTNET_PATH}/System.Diagnostics.DiagnosticSource.dll \
			${DOTNET_REF}:${DOTNET_PATH}/Microsoft.Net.Http.Headers.dll \
			${DOTNET_REF}:${DOTNET_PATH}/System.Buffers.dll \
			${DOTNET_REF}:${DOTNET_PATH}/System.Text.Encodings.Web.dll

DOTNET_RESOURCES+=	-resource:src/${PORTNAME}/${PORTNAME}.Resources.resources

DOTNET_FILES+=		${LOCALBASE}/include/dotnet/Microsoft.Extensions.SecurityHelper.Sources/SecurityHelper.cs \
			${LOCALBASE}/include/dotnet/Microsoft.Extensions.PropertyHelper.Sources/PropertyHelper.cs \
			${LOCALBASE}/include/dotnet/Microsoft.Extensions.PropertyActivator.Sources/PropertyActivator.cs \
			${LOCALBASE}/include/dotnet/Microsoft.Extensions.HashCodeCombiner.Sources/HashCodeCombiner.cs \
			${LOCALBASE}/include/dotnet/Microsoft.Extensions.ClosedGenericMatcher.Sources/ClosedGenericMatcher.cs \
			${LOCALBASE}/include/dotnet/Microsoft.Extensions.CopyOnWriteDictionary.Sources/CopyOnWriteDictionary.cs \
			${LOCALBASE}/include/dotnet/Microsoft.Extensions.CopyOnWriteDictionary.Sources/CopyOnWriteDictionaryHolder.cs \
			${LOCALBASE}/include/dotnet/Microsoft.AspNetCore.Routing.DecisionTree.Sources/DecisionCriterion.cs \
			${LOCALBASE}/include/dotnet/Microsoft.AspNetCore.Routing.DecisionTree.Sources/DecisionCriterionValue.cs \
			${LOCALBASE}/include/dotnet/Microsoft.AspNetCore.Routing.DecisionTree.Sources/DecisionCriterionValueEqualityComparer.cs \
			${LOCALBASE}/include/dotnet/Microsoft.AspNetCore.Routing.DecisionTree.Sources/DecisionTreeBuilder.cs \
			${LOCALBASE}/include/dotnet/Microsoft.AspNetCore.Routing.DecisionTree.Sources/DecisionTreeNode.cs \
			${LOCALBASE}/include/dotnet/Microsoft.AspNetCore.Routing.DecisionTree.Sources/IClassifier.cs \
			${LOCALBASE}/include/dotnet/Microsoft.AspNetCore.Routing.DecisionTree.Sources/ItemDescriptor.cs

.include <../../dotnet/aspnet/Makefile.common>


text:
#ifndef __ARCH_ASM_MACH_OMAP2_CM_H
#define __ARCH_ASM_MACH_OMAP2_CM_H

/*
 * MAX_MODULE_READY_TIME: max duration in microseconds to wait for the
 * PRCM to request that a module exit the inactive state in the case of
 * OMAP2 & 3.
 * In the case of OMAP4 this is the max duration in microseconds for the
 * module to reach the functionnal state from an inactive state.
 */
#define MAX_MODULE_READY_TIME		2000

# ifndef __ASSEMBLER__
extern void __iomem *cm_base;
extern void __iomem *cm2_base;
extern void omap2_set_globals_cm(void __iomem *cm, void __iomem *cm2);
# endif

/*
 * MAX_MODULE_DISABLE_TIME: max duration in microseconds to wait for
 * the PRCM to request that a module enter the inactive state in the
 * case of OMAP2 & 3.  In the case of OMAP4 this is the max duration
 * in microseconds for the module to reach the inactive state from
 * a functional state.
 * XXX FSUSB on OMAP4430 takes ~4ms to idle after reset during
 * kernel init.
 */
#define MAX_MODULE_DISABLE_TIME		5000

# ifndef __ASSEMBLER__

/**
 * struct cm_ll_data - fn ptrs to per-SoC CM function implementations
 * @split_idlest_reg: ptr to the SoC CM-specific split_idlest_reg impl
 * @wait_module_ready: ptr to the SoC CM-specific wait_module_ready impl
 */
struct cm_ll_data {
	int (*split_idlest_reg)(void __iomem *idlest_reg, s16 *prcm_inst,
				u8 *idlest_reg_id);
	int (*wait_module_ready)(s16 prcm_mod, u8 idlest_id, u8 idlest_shift);
};

extern int cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst,
			       u8 *idlest_reg_id);
extern int cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift);

extern int cm_register(struct cm_ll_data *cld);
extern int cm_unregister(struct cm_ll_data *cld);

# endif

#endif


text:
package org.netbeans.lib.cvsclient.request;

import org.netbeans.lib.cvsclient.util.BugLog;

/**
 * The Argument request. The server saves the specified argument for use in
 * a future argument-using command
 * @author  Robert Greig
 */
public final class ArgumentRequest extends AbstractRequest {

	// Fields =================================================================

	private final String argument;

	// Setup ==================================================================

	/**
	 * Create a new request
	 * @param argument the argument to use
	 */
	public ArgumentRequest(String argument) {
		BugLog.getInstance().assertNotNull(argument);

		this.argument = argument;
	}

	// Implemented ============================================================

	/**
	 * Get the request String that will be passed to the server
	 * @return the request String
	 */
	@Override
        public String getRequestString() {
		return "Argument " + argument + "\n";
	}
}


text:
package com.baidu.hsb.parser.ast.expression.primary.function.arithmetic;

import java.util.List;

import com.baidu.hsb.parser.ast.expression.Expression;
import com.baidu.hsb.parser.ast.expression.primary.function.FunctionExpression;

/**
 *
 *
 * @author xiongzhao@baidu.com
 * @version $Id: Oct.java, v 0.1 2013年12月26日 下午8:07:35 HI:brucest0078 Exp $
 */
public class Oct extends FunctionExpression {
    public Oct(List<Expression> arguments) {
        super("OCT", arguments);
    }

    @Override
    public FunctionExpression constructFunction(List<Expression> arguments) {
        return new Oct(arguments);
    }

}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">

<title>Digital Land Charges</title>

	<link rel="stylesheet" href="/public/stylesheets/styles.css">
	<link rel="stylesheet" href="/public/stylesheets/elements.css">
	<link href='https://fonts.googleapis.com/css?family=Roboto:300,400,700' rel='stylesheet' type='text/css'>

{{>includes/header}}

Home

Bankruptcies

List of registration applications

Bankruptcy registration

Bankruptcy registration

	    1. Debtor details

	    2. Debtor address

	    3. Court details

	    4. Verify registration

1. Debtor details

		        Forename(s)
		        <input class="form_textfield" type="text">

		        Surname
		        <input class="form_textfield" type="text">

                Do you need to add more names?

                    <fieldset class="inline">

                                <input type="radio" value="yes" id="question1_yes" name="1" onclick="document.getElementById('name1').style.display = 'block'; toggle();">Yes

                               	<input type="radio" value="no" id="question1_no" name="1" onclick="document.getElementById('name1').style.display = 'none'; toggle();">No

                    </fieldset>

			        Forename(s)
			        <input class="form_textfield" type="text">

			        Surname
			        <input class="form_textfield" type="text">

	                Do you need to add more names?

	                    <fieldset class="inline">

	                                <input type="radio" value="yes" id="question2_yes" name="2" onclick="document.getElementById('name2').style.display = 'block'; toggle();">Yes

	                               	<input type="radio" value="no" id="question2_no" name="2" onclick="document.getElementById('name2').style.display = 'none'; toggle();">No

	                    </fieldset>

			        Forename(s)
			        <input class="form_textfield" type="text">

			        Surname
			        <input class="form_textfield" type="text">

	                Do you need to add more names?

	                    <fieldset class="inline">

	                                <input type="radio" value="yes" id="question3_yes" name="3" onclick="document.getElementById('name3').style.display = 'block'; toggle();">Yes

	                               	<input type="radio" value="no" id="question3_no" name="3" onclick="document.getElementById('name3').style.display = 'none'; toggle();">No

	                    </fieldset>

	      					<input type="submit" value="Continue" id="continue" class="form_button" disabled=true>

					      	Reject application

{{>includes/footer}}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using MagicCards.Api.JSON;

namespace MagicCards.Api
{
    /// <summary>
    /// The data needed for a card in MSE
    /// </summary>
    public class MSECardData
    {
        public string TimeCreated { get; private set; }
        public string TimeModified { get; private set; }
        public string Name { get; private set; }
        public string CastingCost { get; private set; }
        public string SuperType { get; private set; }
        public string SubType { get; private set; }
        public string Rarity { get; private set; }
        public string RuleText { get; private set; }
        public string FlavorText { get; private set; }
        public string Power { get; private set; }
        public string Toughness { get; private set; }
        public string Illustrator { get; private set; }
        public string Copyright  { get; private set; }

        public MSECardData(CardData cardData, string copyright = "")
        {
            TimeCreated = DateTime.Now.ToString(@"yyyy-MM-dd HH:mm:ss");
            TimeModified = DateTime.Now.ToString(@"yyyy-MM-dd HH:mm:ss");

            Name = cardData.name ?? string.Empty;
            CastingCost = FixText(cardData.manaCost) ?? string.Empty;
            SuperType = Concat(cardData.types) ?? string.Empty;
            SubType = Concat(cardData.subtypes) ?? string.Empty;
            Rarity = FixRarirty(cardData?.rarity) ?? string.Empty;

            RuleText = FixText(cardData.text) ?? string.Empty;
            FlavorText = cardData?.flavor ?? string.Empty;

            Power = cardData.power ?? string.Empty;
            Toughness = cardData.toughness ?? string.Empty;
            Illustrator = cardData?.artist ?? string.Empty;
            Copyright = copyright ?? string.Empty;
        }

        private static string FixText(string rulesText)
        {
            if (rulesText == null)
            {
                return string.Empty;
            }
            return rulesText.Replace("{", "").Replace("}", "");
        }

        private static string Concat(IEnumerable<string> words)
        {
            string result = string.Empty;

            if (words == null)
            {
                return result;
            }

            var wordsArr = words.ToArray();
            for (int index = 0; index < wordsArr.Length; index++)
            {
                var word = wordsArr[index];
                result += word;
                if (index < wordsArr.Length - 1)
                {
                    result += " ";
                }
            }

            return result;
        }

        private static string FixRarirty(string rarity)
        {
            if (rarity == null)
            {
                return "common";
            }

            rarity = rarity.ToLower().Trim();

            return rarity == "special" ? "mythic rare" : rarity;
        }
    }
}


text:
from __future__ import print_function

import pandas as pd
from sklearn.base import TransformerMixin

class PClassTransformer(TransformerMixin):

    def __init__(self, use=True):
        self.use = use

    def transform(self, features, **transform_params):
        if self.use:
            features = features.copy(deep=True)
            dummies = pd.get_dummies(features.Pclass, prefix='Pclass')
            features = pd.concat([features, pd.DataFrame(dummies)], axis=1)
            features.drop('Pclass_3', axis=1, inplace=True)
        features.drop('Pclass', axis=1, inplace=True)
        return features

    def fit(self, X, y=None, **fit_params):
        return self

    def get_params(self, *args, **kwargs):
        return { 'use': self.use }

    def set_params(self, **params):
        if 'use' in params:
            self.use = params.get('use')


text:
package com.caribresort.entity;
// Generated Feb 25, 2014 2:21:24 AM by Hibernate Tools 3.6.0

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

/**
 * Drinktype generated by hbm2java
 */
public class Drinktype  implements CaribResortEntity {

     /**
	 *
	 */
	private static final long serialVersionUID = 4556090044654209872L;
	private Integer drinkTypeId;
     private String drinkTypeName;
     private Set<Drink> drinks = new HashSet<Drink>(0);

    public Drinktype() {
    }

    public Drinktype(Integer drinkTypeId, String drinkTypeName) {
    	this.drinkTypeId = drinkTypeId;
    	this.drinkTypeName = drinkTypeName;
    }

    public Drinktype(String drinkTypeName, Set<Drink> drinks) {
       this.drinkTypeName = drinkTypeName;
       this.drinks = drinks;
    }

    public Integer getDrinkTypeId() {
        return this.drinkTypeId;
    }

    public void setDrinkTypeId(Integer drinkTypeId) {
        this.drinkTypeId = drinkTypeId;
    }
    public String getDrinkTypeName() {
        return this.drinkTypeName;
    }

    public void setDrinkTypeName(String drinkTypeName) {
        this.drinkTypeName = drinkTypeName;
    }
    public Set<Drink> getDrinks() {
        return this.drinks;
    }

    public void setDrinks(Set<Drink> drinks) {
        this.drinks = drinks;
    }

	@Override
	public Object PopulateFromArray(Object[] data) {
		// TODO Auto-generated method stub
		return null;
	}

}


text:
max_blocks = 1000
max_blocks_per_id = 1000

i2c_address = 0x54

# Pan Servo
s0_lower_limit = 1000 # Servo pulse width lower limit in microseconds.
s0_upper_limit = 2000 # Servo pulse width upper limit in microseconds.

# Tilt Servo
s1_lower_limit = 1000 # Servo pulse width lower limit in microseconds.
s1_upper_limit = 2000 # Servo pulse width upper limit in microseconds.

analog_out_enable = False # P6 -> Analog Out (0v - 3.3v).
analog_out_mode = 0 # 0 == x position of largest tag - 1 == y position of largest tag

##############################################################################

import image, math, pyb, sensor, struct, time

# Camera Setup

sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000)

# LED Setup

red_led = pyb.LED(1)
green_led = pyb.LED(2)
blue_led = pyb.LED(3)

red_led.off()
green_led.off()
blue_led.off()

# DAC Setup

dac = pyb.DAC("P6") if analog_out_enable else None

if dac:
    dac.write(0)

# Servo Setup

min_s0_limit = min(s0_lower_limit, s0_upper_limit)
max_s0_limit = max(s0_lower_limit, s0_upper_limit)
min_s1_limit = min(s1_lower_limit, s1_upper_limit)
max_s1_limit = max(s1_lower_limit, s1_upper_limit)

s0_pan = pyb.Servo(1) # P7
s1_tilt = pyb.Servo(2) # P8

s0_pan.pulse_width(int((max_s0_limit - min_s0_limit) // 2)) # center
s1_tilt.pulse_width(int((max_s1_limit - min_s1_limit) // 2)) # center

s0_pan_conversion_factor = (max_s0_limit - min_s0_limit) / 1000
s1_tilt_conversion_factor = (max_s1_limit - min_s1_limit) / 1000

def s0_pan_position(value):
    s0_pan.pulse_width(round(s0_lower_limit + (max(min(value, 1000), 0) * s0_pan_conversion_factor)))

def s1_tilt_position(value):
    s1_tilt.pulse_width(round(s1_lower_limit + (max(min(value, 1000), 0) * s1_tilt_conversion_factor)))

# Link Setup

bus = pyb.I2C(2, pyb.I2C.SLAVE, addr = i2c_address)

def write(data):
    # Prepare the data to transmit first so we can do it quickly.
    out_data = []
    for i in range(0, len(data), 2):
        out_data.append(data[i:i+2])
    # Disable interrupts so we can send all packets without gaps.
    state = pyb.disable_irq()
    for i in range(len(out_data)):
        max_exceptions = 10
        loop = True
        while(loop):
            try:
                bus.send(out_data[i], timeout = 1)
                loop = False
            except OSError as error:
                if(max_exceptions <= 0):
                    pyb.enable_irq(state)
                    return
                max_exceptions -= 1
    pyb.enable_irq(state)

def available():
    return 0 # Not implemented as there is no way for the us to be ready to receive the data.

def read_byte():
    return 0 # Not implemented as there is no way for the us to be ready to receive the data.

# Helper Stuff

def checksum(data):
    checksum = 0
    for i in range(0, len(data), 2):
        checksum += ((data[i+1] & 0xFF) << 8) | ((data[i+0] & 0xFF) << 0)
    return checksum & 0xFFFF

def to_object_block_format(tag):
    angle = int((tag.rotation() * 180) // math.pi)
    temp = struct.pack("<hhhhhh", tag.id() + 8, tag.cx(), tag.cy(), tag.w(), tag.h(), angle)
    return struct.pack("<hh12s", 0xAA56, checksum(temp), temp)

# FSM Code

fsm_state = 0
last_byte = 0

FSM_STATE_NONE = 0
FSM_STATE_ZERO = 1
FSM_STATE_SERVO_CONTROL_0 = 2
FSM_STATE_SERVO_CONTROL_1 = 3
FSM_STATE_SERVO_CONTROL_2 = 4
FSM_STATE_SERVO_CONTROL_3 = 5
FSM_STATE_CAMERA_CONTROL = 6
FSM_STATE_LED_CONTROL_0 = 7
FSM_STATE_LED_CONTROL_1 = 8
FSM_STATE_LED_CONTROL_2 = 9

def parse_byte(byte):
    global fsm_state
    global last_byte

    if fsm_state == FSM_STATE_NONE:
        if byte == 0x00: fsm_state = FSM_STATE_ZERO
        else: fsm_state = FSM_STATE_NONE

    elif fsm_state == FSM_STATE_ZERO:
        if byte == 0xFF: fsm_state = FSM_STATE_SERVO_CONTROL_0
        elif byte == 0xFE: fsm_state = FSM_STATE_CAMERA_CONTROL
        elif byte == 0xFD: fsm_state = FSM_STATE_LED_CONTROL_0
        else: fsm_state = FSM_STATE_NONE

    elif fsm_state == FSM_STATE_SERVO_CONTROL_0:
        fsm_state = FSM_STATE_SERVO_CONTROL_1

    elif fsm_state == FSM_STATE_SERVO_CONTROL_1:
        fsm_state = FSM_STATE_SERVO_CONTROL_2
        s0_pan_position(((byte & 0xFF) << 8) | ((last_byte & 0xFF) << 0))

    elif fsm_state == FSM_STATE_SERVO_CONTROL_2:
        fsm_state = FSM_STATE_SERVO_CONTROL_3

    elif fsm_state == FSM_STATE_SERVO_CONTROL_3:
        fsm_state = FSM_STATE_NONE
        s1_tilt_position(((byte & 0xFF) << 8) | ((last_byte & 0xFF) << 0))

    elif fsm_state == FSM_STATE_CAMERA_CONTROL:
        fsm_state = FSM_STATE_NONE
        # Ignore...

    elif fsm_state == FSM_STATE_LED_CONTROL_0:
        fsm_state = FSM_STATE_LED_CONTROL_1
        if byte & 0x80: red_led.on()
        else: red_led.off()

    elif fsm_state == FSM_STATE_LED_CONTROL_1:
        fsm_state = FSM_STATE_LED_CONTROL_2
        if byte & 0x80: green_led.on()
        else: green_led.off()

    elif fsm_state == FSM_STATE_LED_CONTROL_2:
        fsm_state = FSM_STATE_NONE
        if byte & 0x80: blue_led.on()
        else: blue_led.off()

    last_byte = byte

# Main Loop

clock = time.clock()
while(True):
    clock.tick()
    img = sensor.snapshot()
    tags = img.find_apriltags() # default TAG36H11 family

    # Transmit Tags #

    if tags and (max_blocks > 0) and (max_blocks_per_id > 0): # new frame
        dat_buf = struct.pack("<h", 0xAA55)
        id_map = {}
        first_b = False

        for tag in sorted(tags, key = lambda x: x.area(), reverse = True)[0:max_blocks]:

            if not tag.id() in id_map:
                id_map[tag.id()] = 1
            else:
                id_map[tag.id()] += 1

            if id_map[tag.id()] <= max_blocks_per_id:
                dat_buf += to_object_block_format(tag)
                img.draw_rectangle(tag.rect())
                img.draw_cross(tag.cx(), tag.cy())

            if dac and not first_b:
                x_scale = 255 / (img.width()-1)
                y_scale = 255 / (img.height()-1)
                dac.write(round((tag.y() * y_scale) if analog_out_mode else (tag.x() * x_scale)))
                first_b = True

        dat_buf += struct.pack("<h", 0x0000)
        write(dat_buf) # write all data in one packet...

    else: # nothing found
        write(struct.pack("<h", 0x0000))

        if dac:
            dac.write(0)

    # Parse Commands #

    for i in range(available()):
        parse_byte(read_byte())

    num_tags = min(len(tags), max_blocks)
    print("%d tags(s) found - FPS %f" % (num_tags, clock.fps()))


text:
package com.justdoit.pics.dao.impl;

import android.content.Context;

import com.android.volley.Response;
import com.android.volley.toolbox.JsonObjectRequest;
import com.justdoit.pics.dao.GetTopicCommentEdit;
import com.justdoit.pics.global.Constant;
import com.justdoit.pics.model.NetSingleton;
import com.justdoit.pics.model.PostDeteleRequest;
import com.justdoit.pics.model.FormJsonObjRequest;

import java.util.Map;

/**
 * Created by ljz on 2015/11/28.
 */
public class GetTopicCommentEditImpl implements GetTopicCommentEdit {
    @Override
    public void GetTopic(Context context, int pk, Response.Listener oklistener, Response.ErrorListener errorlistener) {
        JsonObjectRequest mrequest = new JsonObjectRequest(Constant.HOME_URL + Constant.TOPIC +pk, oklistener, errorlistener);
        NetSingleton.getInstance(context).addToRequestQueue(mrequest);
    }

    @Override
    public void GetComment(Context context, int pk, Response.Listener oklistener, Response.ErrorListener errorlistener) {
        JsonObjectRequest mrequest = new JsonObjectRequest(Constant.HOME_URL + Constant.COMMENT_LIST +"?id="+pk, oklistener, errorlistener);
        NetSingleton.getInstance(context).addToRequestQueue(mrequest);
    }

    @Override
    public void CreateComment(Context context, Map<String, String> params, Response.Listener oklistener, Response.ErrorListener errorListener) {
        FormJsonObjRequest mrequest = new FormJsonObjRequest(context,Constant.HOME_URL + Constant.USER_COMMENT,params, oklistener, errorListener);
        NetSingleton.getInstance(context).addToRequestQueue(mrequest);
    }

    @Override
    public void DeteleTopic(Context context, int pk, Response.Listener oklistener, Response.ErrorListener errorListener) {
        PostDeteleRequest mrequest = new PostDeteleRequest(pk,oklistener,errorListener);
        NetSingleton.getInstance(context).addToRequestQueue(mrequest);
    }
}


text:
<?php

namespace Namshi\JOSE\Signer\OpenSSL;

/**
 * Class responsible to sign inputs with the a RSA algorithm, after hashing it.
 */
abstract class RSA extends PublicKey
{

    /**
     * @inheritdoc
     */
    protected function getSupportedPrivateKeyType()
    {
        return defined('OPENSSL_KEYTYPE_RSA') ? OPENSSL_KEYTYPE_RSA : false;
    }

}


text:
#include "config.h"
#include "core/css/resolver/CSSToStyleMap.h"

#include "core/CSSValueKeywords.h"
#include "core/animation/css/CSSAnimationData.h"
#include "core/css/CSSBorderImageSliceValue.h"
#include "core/css/CSSPrimitiveValue.h"
#include "core/css/CSSPrimitiveValueMappings.h"
#include "core/css/CSSTimingFunctionValue.h"
#include "core/css/Pair.h"
#include "core/css/Rect.h"
#include "core/css/resolver/StyleBuilderConverter.h"
#include "core/css/resolver/StyleResolverState.h"
#include "core/style/BorderImageLengthBox.h"
#include "core/style/FillLayer.h"

namespace blink {

void CSSToStyleMap::mapFillAttachment(StyleResolverState&, FillLayer* layer, CSSValue* value)
{
    if (value->isInitialValue()) {
        layer->setAttachment(FillLayer::initialFillAttachment(layer->type()));
        return;
    }

    if (!value->isPrimitiveValue())
        return;

    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
    switch (primitiveValue->getValueID()) {
    case CSSValueFixed:
        layer->setAttachment(FixedBackgroundAttachment);
        break;
    case CSSValueScroll:
        layer->setAttachment(ScrollBackgroundAttachment);
        break;
    case CSSValueLocal:
        layer->setAttachment(LocalBackgroundAttachment);
        break;
    default:
        return;
    }
}

void CSSToStyleMap::mapFillClip(StyleResolverState&, FillLayer* layer, CSSValue* value)
{
    if (value->isInitialValue()) {
        layer->setClip(FillLayer::initialFillClip(layer->type()));
        return;
    }

    if (!value->isPrimitiveValue())
        return;

    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
    layer->setClip(*primitiveValue);
}

void CSSToStyleMap::mapFillComposite(StyleResolverState&, FillLayer* layer, CSSValue* value)
{
    if (value->isInitialValue()) {
        layer->setComposite(FillLayer::initialFillComposite(layer->type()));
        return;
    }

    if (!value->isPrimitiveValue())
        return;

    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
    layer->setComposite(*primitiveValue);
}

void CSSToStyleMap::mapFillBlendMode(StyleResolverState&, FillLayer* layer, CSSValue* value)
{
    if (value->isInitialValue()) {
        layer->setBlendMode(FillLayer::initialFillBlendMode(layer->type()));
        return;
    }

    if (!value->isPrimitiveValue())
        return;

    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
    layer->setBlendMode(*primitiveValue);
}

void CSSToStyleMap::mapFillOrigin(StyleResolverState&, FillLayer* layer, CSSValue* value)
{
    if (value->isInitialValue()) {
        layer->setOrigin(FillLayer::initialFillOrigin(layer->type()));
        return;
    }

    if (!value->isPrimitiveValue())
        return;

    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
    layer->setOrigin(*primitiveValue);
}

void CSSToStyleMap::mapFillImage(StyleResolverState& state, FillLayer* layer, CSSValue* value)
{
    if (value->isInitialValue()) {
        layer->setImage(FillLayer::initialFillImage(layer->type()));
        return;
    }

    CSSPropertyID property = layer->type() == BackgroundFillLayer ? CSSPropertyBackgroundImage : CSSPropertyWebkitMaskImage;
    layer->setImage(state.styleImage(property, value));
}

void CSSToStyleMap::mapFillRepeatX(StyleResolverState&, FillLayer* layer, CSSValue* value)
{
    if (value->isInitialValue()) {
        layer->setRepeatX(FillLayer::initialFillRepeatX(layer->type()));
        return;
    }

    if (!value->isPrimitiveValue())
        return;

    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
    layer->setRepeatX(*primitiveValue);
}

void CSSToStyleMap::mapFillRepeatY(StyleResolverState&, FillLayer* layer, CSSValue* value)
{
    if (value->isInitialValue()) {
        layer->setRepeatY(FillLayer::initialFillRepeatY(layer->type()));
        return;
    }

    if (!value->isPrimitiveValue())
        return;

    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
    layer->setRepeatY(*primitiveValue);
}

void CSSToStyleMap::mapFillSize(StyleResolverState& state, FillLayer* layer, CSSValue* value)
{
    if (value->isInitialValue()) {
        layer->setSizeType(FillLayer::initialFillSizeType(layer->type()));
        layer->setSizeLength(FillLayer::initialFillSizeLength(layer->type()));
        return;
    }

    if (!value->isPrimitiveValue())
        return;

    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
    if (primitiveValue->getValueID() == CSSValueContain)
        layer->setSizeType(Contain);
    else if (primitiveValue->getValueID() == CSSValueCover)
        layer->setSizeType(Cover);
    else
        layer->setSizeType(SizeLength);

    LengthSize b = FillLayer::initialFillSizeLength(layer->type());

    if (primitiveValue->getValueID() == CSSValueContain || primitiveValue->getValueID() == CSSValueCover) {
        layer->setSizeLength(b);
        return;
    }

    Length firstLength;
    Length secondLength;

    if (Pair* pair = primitiveValue->getPairValue()) {
        firstLength = StyleBuilderConverter::convertLengthOrAuto(state, pair->first());
        secondLength = StyleBuilderConverter::convertLengthOrAuto(state, pair->second());
    } else {
        firstLength = StyleBuilderConverter::convertLengthOrAuto(state, primitiveValue);
        secondLength = Length();
    }

    b.setWidth(firstLength);
    b.setHeight(secondLength);
    layer->setSizeLength(b);
}

void CSSToStyleMap::mapFillXPosition(StyleResolverState& state, FillLayer* layer, CSSValue* value)
{
    if (value->isInitialValue()) {
        layer->setXPosition(FillLayer::initialFillXPosition(layer->type()));
        return;
    }

    if (!value->isPrimitiveValue())
        return;

    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
    Pair* pair = primitiveValue->getPairValue();
    if (pair)
        primitiveValue = pair->second();

    Length length = primitiveValue->convertToLength(state.cssToLengthConversionData());

    layer->setXPosition(length);
    if (pair)
        layer->setBackgroundXOrigin(*(pair->first()));
}

void CSSToStyleMap::mapFillYPosition(StyleResolverState& state, FillLayer* layer, CSSValue* value)
{
    if (value->isInitialValue()) {
        layer->setYPosition(FillLayer::initialFillYPosition(layer->type()));
        return;
    }

    if (!value->isPrimitiveValue())
        return;

    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
    Pair* pair = primitiveValue->getPairValue();
    if (pair)
        primitiveValue = pair->second();

    Length length = primitiveValue->convertToLength(state.cssToLengthConversionData());

    layer->setYPosition(length);
    if (pair)
        layer->setBackgroundYOrigin(*(pair->first()));
}

void CSSToStyleMap::mapFillMaskSourceType(StyleResolverState&, FillLayer* layer, CSSValue* value)
{
    EMaskSourceType type = FillLayer::initialFillMaskSourceType(layer->type());
    if (value->isInitialValue()) {
        layer->setMaskSourceType(type);
        return;
    }

    if (!value->isPrimitiveValue())
        return;

    switch (toCSSPrimitiveValue(value)->getValueID()) {
    case CSSValueAlpha:
        type = MaskAlpha;
        break;
    case CSSValueLuminance:
        type = MaskLuminance;
        break;
    case CSSValueAuto:
        break;
    default:
        ASSERT_NOT_REACHED();
    }

    layer->setMaskSourceType(type);
}

double CSSToStyleMap::mapAnimationDelay(CSSValue* value)
{
    if (value->isInitialValue())
        return CSSTimingData::initialDelay();
    return toCSSPrimitiveValue(value)->computeSeconds();
}

Timing::PlaybackDirection CSSToStyleMap::mapAnimationDirection(CSSValue* value)
{
    if (value->isInitialValue())
        return CSSAnimationData::initialDirection();

    switch (toCSSPrimitiveValue(value)->getValueID()) {
    case CSSValueNormal:
        return Timing::PlaybackDirectionNormal;
    case CSSValueAlternate:
        return Timing::PlaybackDirectionAlternate;
    case CSSValueReverse:
        return Timing::PlaybackDirectionReverse;
    case CSSValueAlternateReverse:
        return Timing::PlaybackDirectionAlternateReverse;
    default:
        ASSERT_NOT_REACHED();
        return CSSAnimationData::initialDirection();
    }
}

double CSSToStyleMap::mapAnimationDuration(CSSValue* value)
{
    if (value->isInitialValue())
        return CSSTimingData::initialDuration();
    return toCSSPrimitiveValue(value)->computeSeconds();
}

Timing::FillMode CSSToStyleMap::mapAnimationFillMode(CSSValue* value)
{
    if (value->isInitialValue())
        return CSSAnimationData::initialFillMode();

    switch (toCSSPrimitiveValue(value)->getValueID()) {
    case CSSValueNone:
        return Timing::FillModeNone;
    case CSSValueForwards:
        return Timing::FillModeForwards;
    case CSSValueBackwards:
        return Timing::FillModeBackwards;
    case CSSValueBoth:
        return Timing::FillModeBoth;
    default:
        ASSERT_NOT_REACHED();
        return CSSAnimationData::initialFillMode();
    }
}

double CSSToStyleMap::mapAnimationIterationCount(CSSValue* value)
{
    if (value->isInitialValue())
        return CSSAnimationData::initialIterationCount();
    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
    if (primitiveValue->getValueID() == CSSValueInfinite)
        return std::numeric_limits<double>::infinity();
    return primitiveValue->getFloatValue();
}

AtomicString CSSToStyleMap::mapAnimationName(CSSValue* value)
{
    if (value->isInitialValue())
        return CSSAnimationData::initialName();
    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
    if (primitiveValue->getValueID() == CSSValueNone)
        return CSSAnimationData::initialName();
    return AtomicString(primitiveValue->getStringValue());
}

EAnimPlayState CSSToStyleMap::mapAnimationPlayState(CSSValue* value)
{
    if (value->isInitialValue())
        return CSSAnimationData::initialPlayState();
    if (toCSSPrimitiveValue(value)->getValueID() == CSSValuePaused)
        return AnimPlayStatePaused;
    ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueRunning);
    return AnimPlayStatePlaying;
}

CSSTransitionData::TransitionProperty CSSToStyleMap::mapAnimationProperty(CSSValue* value)
{
    if (value->isInitialValue())
        return CSSTransitionData::initialProperty();
    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
    if (primitiveValue->isString())
        return CSSTransitionData::TransitionProperty(primitiveValue->getStringValue());
    if (primitiveValue->getValueID() == CSSValueAll)
        return CSSTransitionData::TransitionProperty(CSSTransitionData::TransitionAll);
    if (primitiveValue->getValueID() == CSSValueNone)
        return CSSTransitionData::TransitionProperty(CSSTransitionData::TransitionNone);
    return CSSTransitionData::TransitionProperty(primitiveValue->getPropertyID());
}

PassRefPtr<TimingFunction> CSSToStyleMap::mapAnimationTimingFunction(CSSValue* value, bool allowStepMiddle)
{
    // FIXME: We should probably only call into this function with a valid
    // single timing function value which isn't initial or inherit. We can
    // currently get into here with initial since the parser expands unset
    // properties in shorthands to initial.

    if (value->isPrimitiveValue()) {
        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
        switch (primitiveValue->getValueID()) {
        case CSSValueLinear:
            return LinearTimingFunction::shared();
        case CSSValueEase:
            return CubicBezierTimingFunction::preset(CubicBezierTimingFunction::Ease);
        case CSSValueEaseIn:
            return CubicBezierTimingFunction::preset(CubicBezierTimingFunction::EaseIn);
        case CSSValueEaseOut:
            return CubicBezierTimingFunction::preset(CubicBezierTimingFunction::EaseOut);
        case CSSValueEaseInOut:
            return CubicBezierTimingFunction::preset(CubicBezierTimingFunction::EaseInOut);
        case CSSValueStepStart:
            return StepsTimingFunction::preset(StepsTimingFunction::Start);
        case CSSValueStepMiddle:
            if (allowStepMiddle)
                return StepsTimingFunction::preset(StepsTimingFunction::Middle);
            return CSSTimingData::initialTimingFunction();
        case CSSValueStepEnd:
            return StepsTimingFunction::preset(StepsTimingFunction::End);
        default:
            ASSERT_NOT_REACHED();
            return CSSTimingData::initialTimingFunction();
        }
    }

    if (value->isCubicBezierTimingFunctionValue()) {
        CSSCubicBezierTimingFunctionValue* cubicTimingFunction = toCSSCubicBezierTimingFunctionValue(value);
        return CubicBezierTimingFunction::create(cubicTimingFunction->x1(), cubicTimingFunction->y1(), cubicTimingFunction->x2(), cubicTimingFunction->y2());
    }

    if (value->isInitialValue())
        return CSSTimingData::initialTimingFunction();

    CSSStepsTimingFunctionValue* stepsTimingFunction = toCSSStepsTimingFunctionValue(value);
    if (stepsTimingFunction->stepAtPosition() == StepsTimingFunction::Middle && !allowStepMiddle)
        return CSSTimingData::initialTimingFunction();
    return StepsTimingFunction::create(stepsTimingFunction->numberOfSteps(), stepsTimingFunction->stepAtPosition());
}

void CSSToStyleMap::mapNinePieceImage(StyleResolverState& state, CSSPropertyID property, CSSValue* value, NinePieceImage& image)
{
    // If we're not a value list, then we are "none" and don't need to alter the empty image at all.
    if (!value || !value->isValueList())
        return;

    // Retrieve the border image value.
    CSSValueList* borderImage = toCSSValueList(value);

    // Set the image (this kicks off the load).
    CSSPropertyID imageProperty;
    if (property == CSSPropertyWebkitBorderImage)
        imageProperty = CSSPropertyBorderImageSource;
    else if (property == CSSPropertyWebkitMaskBoxImage)
        imageProperty = CSSPropertyWebkitMaskBoxImageSource;
    else
        imageProperty = property;

    for (unsigned i = 0 ; i < borderImage->length() ; ++i) {
        CSSValue* current = borderImage->item(i);

        if (current->isImageValue() || current->isImageGeneratorValue() || current->isImageSetValue())
            image.setImage(state.styleImage(imageProperty, current));
        else if (current->isBorderImageSliceValue())
            mapNinePieceImageSlice(state, current, image);
        else if (current->isValueList()) {
            CSSValueList* slashList = toCSSValueList(current);
            size_t length = slashList->length();
            // Map in the image slices.
            if (length && slashList->item(0)->isBorderImageSliceValue())
                mapNinePieceImageSlice(state, slashList->item(0), image);

            // Map in the border slices.
            if (length > 1)
                image.setBorderSlices(mapNinePieceImageQuad(state, slashList->item(1)));

            // Map in the outset.
            if (length > 2)
                image.setOutset(mapNinePieceImageQuad(state, slashList->item(2)));
        } else if (current->isPrimitiveValue()) {
            // Set the appropriate rules for stretch/round/repeat of the slices.
            mapNinePieceImageRepeat(state, current, image);
        }
    }

    if (property == CSSPropertyWebkitBorderImage) {
        // We have to preserve the legacy behavior of -webkit-border-image and make the border slices
        // also set the border widths. We don't need to worry about percentages, since we don't even support
        // those on real borders yet.
        if (image.borderSlices().top().isLength() && image.borderSlices().top().length().isFixed())
            state.style()->setBorderTopWidth(image.borderSlices().top().length().value());
        if (image.borderSlices().right().isLength() && image.borderSlices().right().length().isFixed())
            state.style()->setBorderRightWidth(image.borderSlices().right().length().value());
        if (image.borderSlices().bottom().isLength() && image.borderSlices().bottom().length().isFixed())
            state.style()->setBorderBottomWidth(image.borderSlices().bottom().length().value());
        if (image.borderSlices().left().isLength() && image.borderSlices().left().length().isFixed())
            state.style()->setBorderLeftWidth(image.borderSlices().left().length().value());
    }
}

void CSSToStyleMap::mapNinePieceImageSlice(StyleResolverState&, CSSValue* value, NinePieceImage& image)
{
    if (!value || !value->isBorderImageSliceValue())
        return;

    // Retrieve the border image value.
    CSSBorderImageSliceValue* borderImageSlice = toCSSBorderImageSliceValue(value);

    // Set up a length box to represent our image slices.
    LengthBox box;
    Quad* slices = borderImageSlice->slices();
    if (slices->top()->isPercentage())
        box.m_top = Length(slices->top()->getDoubleValue(), Percent);
    else
        box.m_top = Length(slices->top()->getIntValue(), Fixed);
    if (slices->bottom()->isPercentage())
        box.m_bottom = Length(slices->bottom()->getDoubleValue(), Percent);
    else
        box.m_bottom = Length(slices->bottom()->getIntValue(), Fixed);
    if (slices->left()->isPercentage())
        box.m_left = Length(slices->left()->getDoubleValue(), Percent);
    else
        box.m_left = Length(slices->left()->getIntValue(), Fixed);
    if (slices->right()->isPercentage())
        box.m_right = Length(slices->right()->getDoubleValue(), Percent);
    else
        box.m_right = Length(slices->right()->getIntValue(), Fixed);
    image.setImageSlices(box);

    // Set our fill mode.
    image.setFill(borderImageSlice->m_fill);
}

static BorderImageLength toBorderImageLength(CSSPrimitiveValue& value, const CSSToLengthConversionData& conversionData)
{
    if (value.isNumber())
        return value.getDoubleValue();
    if (value.isPercentage())
        return Length(value.getDoubleValue(), Percent);
    if (value.getValueID() != CSSValueAuto)
        return value.computeLength<Length>(conversionData);
    return Length(Auto);
}

BorderImageLengthBox CSSToStyleMap::mapNinePieceImageQuad(StyleResolverState& state, CSSValue* value)
{
    if (!value || !value->isPrimitiveValue())
        return BorderImageLengthBox(Length(Auto));

    Quad* slices = toCSSPrimitiveValue(value)->getQuadValue();

    // Set up a border image length box to represent our image slices.
    return BorderImageLengthBox(
        toBorderImageLength(*slices->top(), state.cssToLengthConversionData()),
        toBorderImageLength(*slices->right(), state.cssToLengthConversionData()),
        toBorderImageLength(*slices->bottom(), state.cssToLengthConversionData()),
        toBorderImageLength(*slices->left(), state.cssToLengthConversionData()));
}

void CSSToStyleMap::mapNinePieceImageRepeat(StyleResolverState&, CSSValue* value, NinePieceImage& image)
{
    if (!value || !value->isPrimitiveValue())
        return;

    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
    Pair* pair = primitiveValue->getPairValue();
    if (!pair || !pair->first() || !pair->second())
        return;

    CSSValueID firstIdentifier = pair->first()->getValueID();
    CSSValueID secondIdentifier = pair->second()->getValueID();

    ENinePieceImageRule horizontalRule;
    switch (firstIdentifier) {
    case CSSValueStretch:
        horizontalRule = StretchImageRule;
        break;
    case CSSValueRound:
        horizontalRule = RoundImageRule;
        break;
    case CSSValueSpace:
        horizontalRule = SpaceImageRule;
        break;
    default: // CSSValueRepeat
        horizontalRule = RepeatImageRule;
        break;
    }
    image.setHorizontalRule(horizontalRule);

    ENinePieceImageRule verticalRule;
    switch (secondIdentifier) {
    case CSSValueStretch:
        verticalRule = StretchImageRule;
        break;
    case CSSValueRound:
        verticalRule = RoundImageRule;
        break;
    case CSSValueSpace:
        verticalRule = SpaceImageRule;
        break;
    default: // CSSValueRepeat
        verticalRule = RepeatImageRule;
        break;
    }
    image.setVerticalRule(verticalRule);
}

};


text:
var NavigationController = require('NavigationController'); // use the NavigationController library
var navController = new NavigationController();
Alloy.Globals.navcontroller = navController;

var fruitMasterControl = Alloy.createController('FruitMaster');
var fruitMasterWindow = fruitMasterControl.getView('fruitMasterView');
Alloy.Globals.navcontroller.open(fruitMasterWindow);

/*
function doClick(e) {
    alert($.label.text);
}

$.index.open();
*/


text:
using System;
namespace HydrantWiki.Objects
{
    public class GeoPoint
    {
        public DateTimeOffset DeviceDateTime { get; set; }

        public double Latitude { get; set; }

        public double Longitude { get; set; }

        public double? Altitude { get; set; }

        public double? Accuracy { get; set; }

        public double? Speed { get; set; }

        public bool WasAveraged { get; set; }

        public int CountOfPositions { get; set; }
    }
}


text:
package tern.googleapi.handlers;

import java.io.IOException;
import java.io.Writer;
import java.util.List;

import tern.googleapi.FunctionType;
import tern.googleapi.GApi;
import tern.googleapi.GMethod;
import tern.googleapi.GParameter;
import tern.googleapi.GProperty;
import tern.googleapi.IType;
import tern.googleapi.SimpleType;
import tern.googleapi.utils.StringUtils;

import com.eclipsesource.json.JsonObject;
import com.eclipsesource.json.WriterConfig;

//http://www.openajax.org/member/wiki/IDE_API_Sample_Google_Map
public class TernDefGApiHandler extends AbstractGApiHandler {

	private final JsonObject def;
	private final JsonObject overridedDef;
	private JsonObject ternClass;
	private JsonObject define;

	public TernDefGApiHandler(Writer writer) {
		this(writer, null);
	}

	public TernDefGApiHandler(Writer writer, JsonObject overridedDef) {
		super(writer);
		this.def = new JsonObject();
		this.overridedDef = overridedDef;
	}

	@Override
	public void startApi(String name, String version) throws IOException {
		def.set("!name", name + version);
		JsonObject define = null;
		if (overridedDef != null) {
			define = (JsonObject) overridedDef.get("!define");
		}
		if (define == null) {
			define = new JsonObject();
		}
		this.define = define;
		def.set("!define", define);
	}

	@Override
	public void endApi() throws IOException {
		// write(def.toString());
		def.writeTo(getWriter(), WriterConfig.PRETTY_PRINT);
	}

	@Override
	public void startClass(String name, GMethod constructor, String superclass,
			boolean objectLiteral, String description, String url, GApi api)
			throws IOException {
		this.ternClass = getTernClass(name, objectLiteral ? define : def);
		String type = getOverridedType(name);
		if (StringUtils.isEmpty(type) && constructor != null) {
			type = getType(constructor, api);
		}
		if (!StringUtils.isEmpty(type)) {
			ternClass.add("!type", type);
		}
		addDocAndUrl(ternClass, description, url);
		if (!StringUtils.isEmpty(superclass)) {
			JsonObject prototype = getTernPrototype(ternClass);
			prototype.set("!proto", superclass + ".prototype");
		}
	}

	private String getOverridedType(String name) {
		if (overridedDef == null) {
			return null;
		}
		JsonObject parent = overridedDef;
		String[] fields = name.split("[.]");
		for (int i = 0; i < fields.length && parent != null; i++) {
			parent = (JsonObject) parent.get(fields[i]);
		}
		if (parent != null) {
			return parent.getString("!type", null);
		}
		return null;
	}

	protected void addDocAndUrl(JsonObject ternDef, String doc, String url) {
		if (!StringUtils.isEmpty(doc)) {
			ternDef.set("!doc", doc);
		}
		if (!StringUtils.isEmpty(url)) {
			ternDef.set("!url", url);
		}
	}

	@Override
	public void handleProperty(GProperty property, GApi api) throws IOException {
		JsonObject jsonProperty = getTernClassOrPrototype(ternClass, property);
		jsonProperty.set("!type", getType(property.getType(), false, api));
		String doc = property.getDescription();
		String url = property.getUrl();
		addDocAndUrl(jsonProperty, doc, url);
	}

	@Override
	public void handleMethod(GMethod method, GApi api) {
		JsonObject ternItem = getTernClassOrPrototype(ternClass, method);
		String type = getType(method, api);
		if (!StringUtils.isEmpty(type)) {
			ternItem.set("!type", type);
		}
		String doc = method.getDescription();
		String url = method.getUrl();
		addDocAndUrl(ternItem, doc, url);
	}

	private String getType(GMethod method, GApi api) {
		StringBuilder type = new StringBuilder("fn(");
		List<GParameter> parameters = method.getParameters();
		for (int i = 0; i < parameters.size(); i++) {
			GParameter parameter = parameters.get(i);
			if (i > 0) {
				type.append(", ");
			}
			type.append(parameter.getName());
			if (parameter.isOptional()) {
				type.append("?");
			}
			type.append(": ");
			type.append(getType(parameter.getType(), false, api));

		}
		type.append(")");
		if (method.hasReturnValue()) {
			String returnValue = method.getReturnValue();
			type.append(" -> ");
			type.append(getType(returnValue, true, api));
		}
		return type.toString();
	}

	private String getType(IType type, boolean returnType, GApi api) {
		if (type instanceof SimpleType) {
			return getType(((SimpleType) type).getType(), returnType, api);
		}
		return getType((FunctionType) type, api);
	}

	private String getType(String returnValue, boolean returnType, GApi api) {
		boolean array = false, simpleType = true;
		if (returnValue.startsWith("Array<")) {
			returnValue = returnValue.substring("Array<".length(),
					returnValue.length() - 1);
			array = true;
		}
		if (returnValue.startsWith("MVCArray")) {
			returnValue = "MVCArray";
		}
		if ("string".equalsIgnoreCase(returnValue)) {
			returnValue = "string";
		} else if ("number".equalsIgnoreCase(returnValue)) {
			returnValue = "number";
		} else if ("boolean".equalsIgnoreCase(returnValue)) {
			returnValue = "bool";
		} else if ("Object".equalsIgnoreCase(returnValue)) {
			returnValue = "?";
		} else if ("*".equalsIgnoreCase(returnValue)) {
			returnValue = "?";
		} else if ("Array".equalsIgnoreCase(returnValue)) {
			returnValue = "?";
			array = true;
		} else if ("Function".equalsIgnoreCase(returnValue)) {
			returnValue = "fn()";
		} else {
			simpleType = false;
		}

		StringBuilder type = new StringBuilder("");
		if (array) {
			type.append("[");
		}
		if (!simpleType) {
			type.append("+");
			type.append(api.resolveType(returnValue));
		} else {
			type.append(returnValue);
		}
		if (array) {
			type.append("]");
		}
		return type.toString();
	}

	private JsonObject getTernClassOrPrototype(JsonObject ternClass,
			GProperty property) {
		JsonObject ternClassOrPrototype = ternClass;
		JsonObject jsonProperty = new JsonObject();
		if (!property.isStatic()) {
			JsonObject prototype = getTernPrototype(ternClass);
			ternClassOrPrototype = prototype;
		}
		ternClassOrPrototype.set(property.getName(), jsonProperty);
		return jsonProperty;
	}

	private JsonObject getTernClassOrPrototype(JsonObject ternClass,
			GMethod method) {
		// constructor
		if (method.isConstructor()) {
			return ternClass;
		}
		// static Method
		if (method.isStaticMethod()) {
			JsonObject staticMethod = new JsonObject();
			ternClass.set(method.getName(), staticMethod);
			return staticMethod;
		}
		JsonObject prototype = getTernPrototype(ternClass);
		JsonObject prototypeMethod = new JsonObject();
		prototype.set(method.getName(), prototypeMethod);
		return prototypeMethod;
	}

	protected JsonObject getTernPrototype(JsonObject ternClass) {
		JsonObject prototype = (JsonObject) ternClass.get("prototype");
		if (prototype == null) {
			prototype = new JsonObject();
			ternClass.set("prototype", prototype);
		}
		return prototype;
	}

	@Override
	public void endClass() throws IOException {
		this.ternClass = null;
	}

	private JsonObject getTernClass(String name, JsonObject parent) {
		String[] classes = name.split("[.]");
		String className = null;
		for (int i = 0; i < classes.length; i++) {
			className = classes[i];
			if (parent.get(className) == null) {
				JsonObject ternClass = new JsonObject();
				parent = parent.set(className, ternClass);
				parent = ternClass;
			} else {
				parent = (JsonObject) parent.get(className);
			}
		}
		return parent;
	}
}