text:
The process of converting a string template into a fully compiled
HTMLbars template function that emits DOM nodes is somewhat involved.
The purpose of this document is to shed some light on the process and
describe where in the HTMLbars codebase these steps take place.

## Overview

HTMLbars, like Handlebars, takes a string template of HTML and generates
a compiled JavaScript template function, but whereas compiled Handlebars
template functions emit strings that can be later parsed into DOM, HTMLBars
template functions directly emit DOM.

A compiled HTMLbars template function contains the following:

1. A `build` function that builds up and returns a document fragment.
2. A `hydrate` function that returns information about where dynamic
   mustache content needs to be inserted into a clone of the document
   fragment.
3. Code that is invoked every time the compiled template is rendered.
   This code calls `build` and caches the resulting fragment (so that `build`
   only needs to ever be called once), clones the fragment,
   then calls `hydrate` and and loops through each mustache,
   passing each to runtime helpers `RESOLVE` or `ATTRIBUTE`
   which can be overridden to perform data-binding, invoke
   user-defined helpers, etc.

In order to construct the above compiled template function, HTMLbars must:

1. Parse a string template into a Handlebars AST.
2. Convert vanilla Handlebars AST into HTML-aware HTMLbars AST.
3. Build up document fragment generator function from HTMLBars AST.
4. Build up hydrating function from the HTMLBars AST.
5. Generate the final template code performs the basic cloning logic,
   invokes `build` and `hydrate`, and loops through each mustache.

## Compiling an HTMLbars template

### 1. Parse template with vanilla Handlebars

Handlebars has no knowledge/concept of the DOM or DOM elements, and the AST
that it generates consists only of text nodes, mustache nodes, etc., and
doesn't distinguish between mustaches that occur within an element's
content or within the elements tag itself (or within a tag's attribute
value).

Consider the following template:

      User: {{user.name}}
      <button {{onclick "like"}}>Like</button>

The above vanilla HB AST looks something like:

    Program
      Content: '<p class="user '
      Mustache: `user.cssClass`
      Content: '"> User: '
      Mustache: `user.name`
      Content: ' <button '
      Mustache: `onclick` params=[`"like"`]
      Content: '>Like</button>
'

See [parser.js](lib/htmlbars/parser.js) and
[process-token.js](lib/htmlbars/html-parser/process-token.js).

### 2. Convert to HTMLBars AST

The whole point of HTMLbars is to add HTML awareness, so we have
to take the AST generated by Handlebars and pass it to the HTMLbars
parser, which accepts a vanilla Handlebars AST and outputs an AST
with two main features that make it distinct from the vanilla HB AST:

1. The there are AST nodes for every DOM element
2. The mustaches are distinguished between whether they occur
   a) within an element's content (e.g. `<p>Hello {{name}}!</p>`),
   b) within an element tag (e.g. `<p {{some-helper}}>...</p>`)
   or c) within an attribute's value (e.g. `<p class="user {{user.cssClass}}">...</p>`)

So the above example is restructured into an HTMLbars AST that looks
something like:

    HTMLElement tag='p' attributes=[['class', ['user ', Mustache(`user.cssClass`)]]]
      "User: "
      Mustache(`user.name`)
      " "
      HTMLElement tag='button' helpers=[Mustache(`onclick "like"`)]
        "Like"

See [parser.js](lib/htmlbars/parser.js) and
[ast.js](lib/htmlbars/ast.js).

### 3. Build document fragment generator from HTMLbars AST

#### Overview: the HTMLbars approach

When an already-compiled HTMLbars template is first rendered into the
DOM, a document fragment of all the HTML nodes in that template must be
constructed. This process only needs to happen once; once this fragment is
constructed, it is cloned (via `fragment.cloneNode(true)`) and inserted
into the DOM every time the template is rendered. Example:

Hello

The first time this template is rendered, a master document fragment for
this template will be constructed via something like:

    if (!fragment) {
      // Fragment hasn't been generated for this HTMLbars
      // template yet; this must be the first time we're
      // rendering this template. Let's create the fragment.
      // Note: all the code below is all generated by HTMLbars
      // when the
Hello
 template is compiled.
      fragment = document.createDocumentFragment();
      var p = document.createElement('p');
      var textNode = document.createTextNode('Hello');
      p.appendChild(textNode);
      fragment.appendChild(p);
    }

Once this master fragment has been constructed, all we need to do to
generate the fragment that'll actually be inserted into the DOM (for this
render and future renders), is call `fragment.cloneNode(true)`, which
returns a deep clone of our master fragment. And for our mustache-less
example above, our work here is done; we can just append that cloned
document fragment into the page (but obviously things will become more
complicated once we add mustaches to our example).

#### Why `cloneNode`?

We could just build up each fragment that needs to be rendered via the
same series of `createDocumentFragment`, `createElement`,
`createTextNode`, etc., every time we needed to render the template, but
it's not nearly as performant/efficient as building up the master
template once and calling `cloneNode(true)` on it every time you need
it.

Fwiw, the previous Handlebars-only approach to rendering templates
involved generating a string of HTML and then turning it into DOM via
`innerHTML` which made GC events unavoidable given all the string
generation/copying/appending/etc. This is one of the many reasons that
the HTMLbars approach offers so much in the way of perf improvements.

#### Build fragments from HTMLbars AST (cont.)

So, setting aside an example with mustaches for the moment, HTMLbars
needs to take the DOM-aware HTMLBars AST and generate the code that will
build up this fragment (i.e. the `createDocumentFragment`, `createElement`,
`createTextNode`, etc., code from above). HTMLbars accomplishes this in
two passes (on the compile side):

1. In [fragment_opcode.js](lib/compiler/fragment_opcode.js),
   the HTMLbars AST is recursively walked and a flattened
   array of opcodes (used in step 2) is generated.
   The intent of this phase is to flatten the recursive structure of the
   AST so that no recursion need take place in our compiled
   template (recursion leads to deep object graphs, clunky GC, etc)
2. This opcodes array is then passed to `lib/compiler/fragment.js` which
   loops through the array and builds up a string of JavaScript code for
   the fragment-generating `build` function that'll live inside the
   final HTMLBars template function.

#### Build Hydrate function

TODO: this.


text:
'use strict';

const crypto = require('crypto');
const declareOpts = require('../lib/declareOpts');
const denodeify = require('denodeify');
const fs = require('fs');
const getAssetDataFromName = require('../node-haste').getAssetDataFromName;
const path = require('path');

const createTimeoutPromise = (timeout) => new Promise((resolve, reject) => {
  setTimeout(reject, timeout, 'fs operation timeout');
});
function timeoutableDenodeify(fsFunc, timeout) {
  return function raceWrapper(...args) {
    return Promise.race([
      createTimeoutPromise(timeout),
      denodeify(fsFunc).apply(this, args)
    ]);
  };
}

const FS_OP_TIMEOUT = parseInt(process.env.REACT_NATIVE_FSOP_TIMEOUT, 10) || 15000;

const stat = timeoutableDenodeify(fs.stat, FS_OP_TIMEOUT);
const readDir = timeoutableDenodeify(fs.readdir, FS_OP_TIMEOUT);
const readFile = timeoutableDenodeify(fs.readFile, FS_OP_TIMEOUT);

const validateOpts = declareOpts({
  projectRoots: {
    type: 'array',
    required: true,
  },
  assetExts: {
    type: 'array',
    required: true,
  },
  fileWatcher: {
    type: 'object',
    required: true,
  }
});

class AssetServer {
  constructor(options) {
    const opts = validateOpts(options);
    this._roots = opts.projectRoots;
    this._assetExts = opts.assetExts;
    this._hashes = new Map();
    this._files = new Map();

    opts.fileWatcher
      .on('all', (type, root, file) => this._onFileChange(type, root, file));
  }

  get(assetPath, platform = null) {
    const assetData = getAssetDataFromName(assetPath, new Set([platform]));
    return this._getAssetRecord(assetPath, platform).then(record => {
      for (let i = 0; i < record.scales.length; i++) {
        if (record.scales[i] >= assetData.resolution) {
          return readFile(record.files[i]);
        }
      }

      return readFile(record.files[record.files.length - 1]);
    });
  }

  getAssetData(assetPath, platform = null) {
    const nameData = getAssetDataFromName(assetPath, new Set([platform]));
    const data = {
      name: nameData.name,
      type: nameData.type,
    };

    return this._getAssetRecord(assetPath, platform).then(record => {
      data.scales = record.scales;
      data.files = record.files;

      if (this._hashes.has(assetPath)) {
        data.hash = this._hashes.get(assetPath);
        return data;
      }

      return new Promise((resolve, reject) => {
        const hash = crypto.createHash('md5');
        hashFiles(data.files.slice(), hash, error => {
          if (error) {
            reject(error);
          } else {
            data.hash = hash.digest('hex');
            this._hashes.set(assetPath, data.hash);
            data.files.forEach(f => this._files.set(f, assetPath));
            resolve(data);
          }
        });
      });
    });
  }

  _onFileChange(type, root, file) {
    const asset = this._files.get(path.join(root, file));
    this._hashes.delete(asset);
  }

  /**
   * Given a request for an image by path. That could contain a resolution
   * postfix, we need to find that image (or the closest one to it's resolution)
   * in one of the project roots:
   *
   * 1. We first parse the directory of the asset
   * 2. We check to find a matching directory in one of the project roots
   * 3. We then build a map of all assets and their scales in this directory
   * 4. Then try to pick platform-specific asset records
   * 5. Then pick the closest resolution (rounding up) to the requested one
   */
  _getAssetRecord(assetPath, platform = null) {
    const filename = path.basename(assetPath);

    return (
      this._findRoot(
        this._roots,
        path.dirname(assetPath),
        assetPath,
      )
      .then(dir => Promise.all([
        dir,
        readDir(dir),
      ]))
      .then(res => {
        const dir = res[0];
        const files = res[1];
        const assetData = getAssetDataFromName(filename, new Set([platform]));

        const map = this._buildAssetMap(dir, files, platform);

        let record;
        if (platform != null){
          record = map[getAssetKey(assetData.assetName, platform)] ||
                   map[assetData.assetName];
        } else {
          record = map[assetData.assetName];
        }

        if (!record) {
          throw new Error(
            `Asset not found: ${assetPath} for platform: ${platform}`
          );
        }

        return record;
      })
    );
  }

  _findRoot(roots, dir, debugInfoFile) {
    return Promise.all(
      roots.map(root => {
        const absRoot = path.resolve(root);
        // important: we want to resolve root + dir
        // to ensure the requested path doesn't traverse beyond root
        const absPath = path.resolve(root, dir);
        return stat(absPath).then(fstat => {
          // keep asset requests from traversing files
          // up from the root (e.g. ../../../etc/hosts)
          if (!absPath.startsWith(absRoot)) {
            return {path: absPath, isValid: false};
          }
          return {path: absPath, isValid: fstat.isDirectory()};
        }, _ => {
          return {path: absPath, isValid: false};
        });
      })
    ).then(stats => {
      for (let i = 0; i < stats.length; i++) {
        if (stats[i].isValid) {
          return stats[i].path;
        }
      }

      const rootsString = roots.map(s => `'${s}'`).join(', ');
      throw new Error(`'${debugInfoFile}' could not be found, because '${dir}' is not a subdirectory of any of the roots  (${rootsString})`);
    });
  }

  _buildAssetMap(dir, files, platform) {
    const assets = files.map(this._getAssetDataFromName.bind(this, new Set([platform])));
    const map = Object.create(null);
    assets.forEach(function(asset, i) {
      const file = files[i];
      const assetKey = getAssetKey(asset.assetName, asset.platform);
      let record = map[assetKey];
      if (!record) {
        record = map[assetKey] = {
          scales: [],
          files: [],
        };
      }

      let insertIndex;
      const length = record.scales.length;

      for (insertIndex = 0; insertIndex < length; insertIndex++) {
        if (asset.resolution <  record.scales[insertIndex]) {
          break;
        }
      }
      record.scales.splice(insertIndex, 0, asset.resolution);
      record.files.splice(insertIndex, 0, path.join(dir, file));
    });

    return map;
  }

  _getAssetDataFromName(platform, file) {
    return getAssetDataFromName(file, platform);
  }
}

function getAssetKey(assetName, platform) {
  if (platform != null) {
    return `${assetName} : ${platform}`;
  } else {
    return assetName;
  }
}

function hashFiles(files, hash, callback) {
  if (!files.length) {
    callback(null);
    return;
  }

  fs.createReadStream(files.shift())
    .on('data', data => hash.update(data))
    .once('end', () => hashFiles(files, hash, callback))
    .once('error', error => callback(error));
}

module.exports = AssetServer;

redpajama_set_name: RedPajamaGithub


text:
package org.springframework.security.web.server.savedrequest;

import java.net.URI;

import reactor.core.publisher.Mono;

import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.web.server.ServerWebExchange;

/**
 * Saves a {@link ServerHttpRequest} so it can be "replayed" later. This is useful for
 * when a page was requested and authentication is necessary.
 *
 * @author Rob Winch
 * @since 5.0
 */
public interface ServerRequestCache {

	/**
	 * Save the {@link ServerHttpRequest}
	 * @param exchange the exchange to save
	 * @return Return a {@code Mono<Void>} which only replays complete and error signals
	 * from this {@link Mono}.
	 */
	Mono<Void> saveRequest(ServerWebExchange exchange);

	/**
	 * Get the URI that can be redirected to trigger the saved request to be used
	 * @param exchange the exchange to obtain the saved {@link ServerHttpRequest} from
	 * @return the URI that can be redirected to trigger the saved request to be used
	 */
	Mono<URI> getRedirectUri(ServerWebExchange exchange);

	/**
	 * If the provided {@link ServerWebExchange} matches the saved
	 * {@link ServerHttpRequest} gets the saved {@link ServerHttpRequest}
	 * @param exchange the exchange to obtain the request from
	 * @return the {@link ServerHttpRequest}
	 */
	Mono<ServerHttpRequest> removeMatchingRequest(ServerWebExchange exchange);

}


text:
#include    "pch.h"
#include    "SetHUDOverlayAction.h"

namespace Training
{
    //------------------------------------------------------------------------------
    // class methods
    //------------------------------------------------------------------------------
    /* void */  SetHUDOverlayAction::SetHUDOverlayAction (TrainingOverlay overlay) :
    m_overlay (overlay)
    {
    }

    //------------------------------------------------------------------------------
    /* void */  SetHUDOverlayAction::~SetHUDOverlayAction (void)
    {
    }

    //------------------------------------------------------------------------------
    void        SetHUDOverlayAction::Execute (void)
    {
        SetTrainingOverlay (m_overlay);
    }

    //------------------------------------------------------------------------------
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

	<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />

	<title>Module: RConfig::CoreMethods</title>

	<link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />

          Home
          Classes
          Methods

In Files

lib/rconfig/core_methods.rb

Methods

#[]

#check_for_changes

#config_changed?

#config_files

#config_for

#get_config_data

#get_config_files

#load_config_files

#method_missing

#reload_on_change

#with_file

Included Modules

Constants

Files

README.rdoc

Class Index

				<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
				<fieldset>
					<legend>Quicksearch</legend>
					<input type="text" name="quicksearch" value=""
						class="quicksearch-field" />
				</fieldset>
				</form>

RConfig

RConfig::Callbacks

RConfig::Cascade

RConfig::Config

RConfig::ConfigError

RConfig::Constants

RConfig::CoreMethods

RConfig::DisabledLogger

RConfig::Exceptions

RConfig::Generators

RConfig::Generators::InstallGenerator

RConfig::InvalidLoadPathError

RConfig::LoadPaths

RConfig::PropertiesFile

RConfig::Reload

RConfig::Settings

RConfig::Utils

Array

Hash

NilClass

String

No matching classes.

RConfig::CoreMethods

Public Instance Methods

					[](key, file=:application)
					click to toggle source

This method provides shorthand to retrieve configuration data that is
global in scope, and used on an application or environment-wide level. The
default location that it checks is the application file. The application
config file is a special config file that should be used for config data
that is broad in scope and used throughout the application. Since RConfig gives special regard to the application
config file, thought should be given to whatever config information is
placed there.

Most config data will be specific to particular part of the application
(i.e. database, web service), and should therefore be placed in its own
specific config file, such as database.yml, or services.xml

This method also acts as a wrapper for ENV. If no value is returned from
the application config, it will also check ENV for a value matching the
specified key.

Ex.1  RConfig[:test_mode] =>

       RConfig.application[:test_mode] ||
       RConfig.application.test_mode

Ex.2  RConfig[:web_app_root] => ENV[‘WEB_APP_ROOT’]

NOTE: The application config file can be in any of

      the supported formats (yml, xml, conf, etc.)

     # File lib/rconfig/core_methods.rb, line 224
224:     def [](key, file=:application)
225:       with_file(file, key) || ENV[key.to_s.upcase]
226:     end

					check_for_changes(name=nil)
					click to toggle source

If name is specified, checks that file for changes and reloads it if there
are.  Otherwise, checks all files in the cache, reloading the changed
files.

     # File lib/rconfig/core_methods.rb, line 164
164:     def check_for_changes(name=nil)
165:       changed = []
166:       if name == nil
167:         self.cache_hash.keys.dup.each do |name|
168:           if reload_on_change(name)
169:             changed << name
170:           end
171:         end
172:       else
173:         name = name.to_s
174:         if reload_on_change(name)
175:           changed << name
176:         end
177:       end
178:       logger.debug "check_for_changes(#{name.inspect}) => #{changed.inspect}"
179:       changed
180:     end

					config_changed?(name)
					click to toggle source

Returns whether or not the config for the given config name has changed
since it was last loaded.

Returns true if any files for config have changes since last load.

     # File lib/rconfig/core_methods.rb, line 131
131:     def config_changed?(name)
132:       logger.debug "config_changed?(#{name.inspect})"
133:       name = name.to_s
134:       !(self.cache_files[name] === get_config_files(name))
135:     end

					config_files(name)
					click to toggle source

Return the config file information for the given config name.

     # File lib/rconfig/core_methods.rb, line 120
120:     def config_files(name)
121:       self.cache_files[name] ||= get_config_files(name)
122:     end

					config_for(name)
					click to toggle source

Get a hash of merged config data. Will auto check every 5 minutes, for
longer running apps, unless reload is disabled.

     # File lib/rconfig/core_methods.rb, line 252
252:     def config_for(name)
253:       name = name.to_s
254:       check_for_changes(name) if auto_check?(name)
255:       data = get_config_data(name)
256:       logger.debug "config_for(#{name.inspect}) => #{data.inspect}"
257:       data
258:     end

					get_config_data(name)
					click to toggle source

Get the merged config hash for the named file. Returns a cached indifferent
access faker hash merged from all config files for a name.

     # File lib/rconfig/core_methods.rb, line 143
143:     def get_config_data(name)
144:       logger.debug "get_config_data(#{name.inspect})"
145:
146:       name = name.to_s
147:       unless result = self.cache_hash[name]
148:         result = self.cache_hash[name] =
149:             make_indifferent(
150:                 merge_hashes(
151:                     load_config_files(name)
152:                 )
153:             )
154:         logger.debug "get_config_data(#{name.inspect}): reloaded"
155:       end
156:
157:       result
158:     end

					get_config_files(name)
					click to toggle source

Returns a list of all relevant config files as specified by suffixes list.
Each element is an Array, containing:

  [
    "server",              # The base name of the
    "server_production",   # The suffixed name
    "/path/to/server.yml", # The absolute path to the file
    <Wed Apr 09 08:53:14>  # The last modified time of the file or nil, if it doesn't exist.
  ]

     # File lib/rconfig/core_methods.rb, line 95
 95:     def get_config_files(name)
 96:       files = []
 97:
 98:       self.load_paths.reverse.each do |directory|
 99:         # splatting *suffix allows us to deal with multipart suffixes
100:         name_no_overlay, suffixes = suffixes_for(name)
101:         suffixes.map { |suffix| [name_no_overlay, *suffix].compact.join('_') }.each do |name_with_suffix|
102:           self.file_types.each do |ext|
103:             filename = filename_for_name(name_with_suffix, directory, ext)
104:             if File.exists?(filename)
105:               modified_time = File.stat(filename).mtime
106:               files << [name, name_with_suffix, filename, ext, modified_time]
107:             end
108:           end
109:         end
110:       end
111:
112:       logger.debug "get_config_files(#{name}) => #{files.select { |x| x[3] }.inspect}"
113:
114:       files
115:     end

					load_config_files(name, force=false)
					click to toggle source

Get each config file’s yaml hash for the given config name, to be
merged later. Files will only be loaded if they have not been loaded before
or the files have changed within the last five minutes, or force is
explicitly set to true.

    # File lib/rconfig/core_methods.rb, line 14
14:     def load_config_files(name, force=false)
15:       name = name.to_s
16:
17:       # Return last config file hash list loaded,
18:       # if reload is disabled and files have already been loaded.
19:       return self.cache_config_files[name] if self.reload_disabled? && self.cache_config_files[name]
20:
21:       logger.info "Loading config files for: #{name}"
22:       logger.debug "load_config_files(#{name.inspect})"
23:
24:
25:       now = Time.now
26:
27:       # Get array of all the existing files file the config name.
28:       config_files = self.get_config_files(name)
29:
30:       # Get all the data from all yaml files into as configs
31:       configs = config_files.collect do |f|
32:         name, name_with_suffix, filename, ext, modified_time = * f
33:
34:         # Get the cached file info the specific file, if
35:         # it's been loaded before.
36:         config_data, last_modified, last_loaded = self.cache[filename]
37:
38:         logger.debug "f = #{f.inspect}\n" +
39:           "cache #{name_with_suffix} filename      = #{filename.inspect}\n" +
40:           "cache #{name_with_suffix} config_data   = #{config_data.inspect}\n" +
41:           "cache #{name_with_suffix} last_modified = #{last_modified.inspect}\n" +
42:           "cache #{name_with_suffix} last_loaded   = #{last_loaded.inspect}\n"
43:
44:         # Load the file if its never been loaded or its been more than
45:         # so many minutes since last load attempt. (default: 5 minutes)
46:         if config_data.blank? || (now - last_loaded > self.reload_interval)
47:           if force || config_data.blank? || modified_time != last_modified
48:
49:             logger.debug "modified_time #{name.inspect} #{filename.inspect} " +
50:               "changed #{modified_time != last_modified} : #{modified_time.inspect} #{last_modified.inspect}"
51:
52:             logger.debug "RConfig: loading #{filename.inspect}"
53:
54:             config_data = read(filename, name, ext)  # Get contents from config file
55:
56:             logger.debug "RConfig: loaded #{filename.inspect} => #{config_data.inspect}"
57:
58:             (self.config_loaded ||= {})[name] = config_files  # add files to the loaded files cache
59:
60:             self.cache[filename] = [config_data, modified_time, now]  # Save cached config file contents, and modified_time.
61:
62:             logger.debug "cache[#{filename.inspect}] = #{self.cache[filename].inspect}"
63:
64:             self.cache_hash[name] = nil # Flush merged hash cache.
65:
66:             self.cache_files[name] = config_files  # Config files changed or disappeared.
67:
68:           end # if config_data == nil || (now - last_loaded > self.reload_interval)
69:         end # if force || config_data == nil || modified_time != last_modified
70:
71:         config_data
72:       end # config_files.collect
73:       configs.compact!
74:
75:       logger.debug "load_config_files(#{name.inspect}) => #{configs.inspect}"
76:
77:       # Keep last loaded config files around in case self.reload_dsabled.
78:       self.cache_config_files[name] = configs #unless configs.empty?
79:
80:       configs
81:     end

					method_missing(method, * args)
					click to toggle source

Short-hand access to config file by its name.

Example:

  RConfig.provider(:foo) => RConfig.with_file(:provider).foo
  RConfig.provider.foo   => RConfig.with_file(:provider).foo

     # File lib/rconfig/core_methods.rb, line 268
268:     def method_missing(method, * args)
269:       value = with_file(method, * args)
270:       logger.debug "#{self}.method_missing(#{method.inspect}, #{args.inspect}) => #{value.inspect}"
271:       value
272:     end

					reload_on_change(name)
					click to toggle source

If config files have changed, caches are flushed, on_load triggers are run.

     # File lib/rconfig/core_methods.rb, line 184
184:     def reload_on_change(name)
185:       logger.debug "reload_on_change(#{name.inspect}), reload_disabled=#{self.reload_disabled?}"
186:       if changed = config_changed?(name) && reload?
187:         if self.cache_hash[name]
188:           flush_cache(name)  # flush cached config values.
189:           fire_on_load(name) # force on_load triggers.
190:         end
191:       end
192:       changed
193:     end

					with_file(name, *args)
					click to toggle source

Get the value specified by the args, in the file specified by th name

     # File lib/rconfig/core_methods.rb, line 231
231:     def with_file(name, *args)
232:       logger.debug "with_file(#{name.inspect}, #{args.inspect})"
233:       result = args.inject(config_for(name)) { |v, i|
234:         logger.debug "v = #{v.inspect}, i = #{i.inspect}"
235:         case v
236:           when Hash
237:             v[i.to_s]
238:           when Array
239:             i.is_a?(Integer) ? v[i] : nil
240:           else
241:             nil
242:         end
243:       }
244:       logger.debug "with_file(#{name.inspect}, #{args.inspect}) => #{result.inspect}"
245:       result
246:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish
			Rdoc Generator 1.1.6.


text:
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Linq;
using com.amazon.device.iap.cpt.json;

namespace com.amazon.device.iap.cpt
{
    public sealed class ResetInput : Jsonable
    {
        public bool Reset{get;set;}

        public string ToJson()
        {
            try
            {
                Dictionary<string, object> toJson = this.GetObjectDictionary();
                return Json.Serialize(toJson);
            }
            catch(System.ApplicationException ex)
            {
                throw new AmazonException("Error encountered while Jsoning", ex);
            }
        }

        public override Dictionary<string, object> GetObjectDictionary()
        {
            try
            {
                Dictionary<string, object> objectDictionary = new Dictionary<string, object>();

                objectDictionary.Add("reset", Reset);
                return objectDictionary;
            }
            catch(System.ApplicationException ex)
            {
                throw new AmazonException("Error encountered while getting object dictionary", ex);
            }
        }

        public static ResetInput CreateFromDictionary(Dictionary<string, object> jsonMap)
        {
            try
            {
                if (jsonMap == null)
                {
                    return null;
                }

                var request = new ResetInput();

                if(jsonMap.ContainsKey("reset"))
                {
                    request.Reset = (bool) jsonMap["reset"];
                }

                return request;
            }
            catch (System.ApplicationException ex)
            {
                throw new AmazonException("Error encountered while creating Object from dicionary", ex);
            }
        }

        public static ResetInput CreateFromJson(string jsonMessage)
        {
            try
            {
                Dictionary<string, object> jsonMap = Json.Deserialize(jsonMessage) as Dictionary<string, object>;
                Jsonable.CheckForErrors(jsonMap);
                return CreateFromDictionary(jsonMap);
            }
            catch(System.ApplicationException ex)
            {
                throw new AmazonException("Error encountered while UnJsoning", ex);
            }
        }

        public static Dictionary<string, ResetInput> MapFromJson(Dictionary<string, object> jsonMap)
        {
            Dictionary<string, ResetInput> result = new Dictionary<string, ResetInput>();
            foreach (var entry in jsonMap)
            {
                ResetInput value = CreateFromDictionary(entry.Value as Dictionary<string, object>);
                result.Add(entry.Key, value);
            }
            return result;
        }

        public static List<ResetInput> ListFromJson(List<object> array)
        {
            List<ResetInput> result = new List<ResetInput>();
            foreach (var e in array)
            {
                result.Add(CreateFromDictionary(e as Dictionary<string, object>));
            }
            return result;
        }
    }
}


text:
(function ($, undefined) {

    function create(target) {
        var t = $(target).addClass("codemirror-f"),
            isDiv = /^(?:div)$/i.test(target.nodeName), isText = /^(?:textarea)$/i.test(target.nodeName),
            html = isText ? (t.val() || t.text()) : t.html(),
            state = $.data(target, "codemirror"), opts = state.options,
            name = t.attr("name"), id = state.codemirrorId = "codemirror_" + $.util.guid("N"),
            panel = state.panel = isDiv ? t.addClass("codemirror-panel").empty() : $("

").insertAfter(t.hide().empty()).append(t),
            panelId = state.panelId = panel.attr("id"),
            textarea = state.textarea = $("<textarea id=\"" + id + "\"" + (name ? " name=\"" + name + "\"" : "") + "></textarea>").appendTo(panel);
        if (name) { t.attr("codemirrorName", name).removeAttr("name"); }

        opts.originalValue = html || opts.value;
        if (opts.originalValue) { textarea.val(opts.originalValue); }

        if (!panelId) { panel.attr("id", panelId = state.panelId = "codemirror_panel_" + $.util.guid("N")); }
        if (opts.fontSize || opts.lineHeight) {
            state.style = $.util.addCss("#" + panelId + " .CodeMirror { " +
                (opts.fontSize ? "font-size: " + opts.fontSize + ";" : "") +
                (opts.lineHeight ? "line-height: " + opts.lineHeight + ";" : "") +
                " }").appendTo(panel);
        }

        var param = $.extend({}, opts);
        if (opts.disabled) { param.readOnly = "nocursor"; }
        state.cm = CodeMirror.fromTextArea(textarea[0], param);
        state.doc = state.cm.getDoc();

        panel.panel($.extend({}, opts, {
            onResize: function (width, height) {
                $.fn.panel.defaults.onResize.apply(this, arguments);
                $.extend(opts, { width: width, height: height });
                var size = textarea._fit();
                state.cm.setSize(size.width, size.height);
                if ($.isFunction(opts.onResize)) { opts.onResize.apply(target, arguments); }
            },
            loader: $.fn.panel.defaults.loader,
            id: panelId
        }));

        state.wrapper = panel.panel("body").addClass("codemirror-wrapper");

        initialEvents(target);
        setDisabled(target, opts.disabled);
        setValidation(target);
    };

    function initialEvents(target) {
        var state = $.data(target, "codemirror"), opts = state.options;
        $.each($.fn.codemirror.events, function (i, n) {
            var eventName = "on" + n, e = opts[eventName];
            state.cm.on(n, function () {
                if (n == "change") {
                    var val = opts.value = $(target).codemirror("getValue");
                    //state.textarea.text(val);
                    state.textarea.val(val);
                }
                if ($.isFunction(e)) { return e.apply(target, arguments); }
            });
        });
    };

    function getOptions(target) {
        var state = $.data(target, "codemirror"), opts = state.panel.panel("options");
        return $.extend(state.options, {
            title: opts.title, iconCls: opts.iconCls, width: opts.width, height: opts.height, left: opts.left, top: opts.top,
            cls: opts.cls, headerCls: opts.headerCls, bodyCls: opts.bodyCls, style: opts.style, fit: opts.fit, border: opts.border,
            doSize: opts.doSize, noheader: opts.noheader, collapsible: opts.collapsible, minimizable: opts.minimizable, maximizable: opts.maximizable,
            closable: opts.closable, collapsed: opts.collapsed, minimized: opts.minimized, maximized: opts.maximized, closed: opts.closed
        });
    };

    function resize(target, param) {
        var state = $.data(target, "codemirror");
        return state.panel.panel("resize", param);
    };

    function destroy(target) {
        var t = $(target), state = $.data(target, "codemirror");
        state.cm.toTextArea();
        state.panel.panel("destroy");
        if (state.style) { state.style.remove(); }
        t.remove();
    };

    function show(target) {
        var state = $.data(target, "codemirror");
        state.panel.panel("open");
        return $(target).codemirror("options");
    };

    function hide(target) {
        var state = $.data(target, "codemirror");
        state.panel.panel("close");
        return $(target).codemirror("options");
    };

    function setDisabled(target, disabled) {
        var state = $.data(target, "codemirror"), opts = state.options, d = disabled ? true : false;
        state.panel[d ? "addClass" : "removeClass"]("codemirror-disabled");
        state.cm.setOption("disabled", d);
        state.cm.setOption("readOnly", d);
        opts.readOnly = d;
        opts.disabled = d;
    };

    function getValue(target, separator) {
        var state = $.data(target, "codemirror");
        return state.doc.getValue(separator);
    };

    function setValue(target, value) {
        var state = $.data(target, "codemirror");
        return state.doc.setValue(value);
    };

    function reset(target) {
        var state = $.data(target, "codemirror"), opts = state.options;
        return state.doc.setValue(opts.originalValue);
    };

    function focus(target) {
        var state = $.data(target, "codemirror");
        return state.cm.focus();
    };

    function clear(target) {
        var state = $.data(target, "codemirror");
        return state.doc.setValue("");
    };

    function getRange(target, param) {
        if (!param || !param.from || !param.to) { return; }
        var state = $.data(target, "codemirror");
        return param.separator ? state.doc.getRange(param.from, param.to, param.separator) : state.doc.getRange(param.from, param.to);
    };

    function replaceRange(target, param) {
        if (!param || !param.replacement || !param.from || !param.to) { return; }
        var state = $.data(target, "codemirror");
        return param.origin ? state.doc.replaceRange(param.replacement, param.from, param.to, param.origin) : state.doc.replaceRange(param.replacement, param.from, param.to);
    };

    function getLine(target, index) {
        return $.data(target, "codemirror").doc.getLine(index);
    };

    function lineCount(target) {
        return $.data(target, "codemirror").doc.lineCount();
    };

    function firstline(target) {
        return $.data(target, "codemirror").doc.firstline();
    };

    function lastLine(target) {
        return $.data(target, "codemirror").doc.lastLine();
    };

    function getLineHandle(target, index) {
        return $.data(target, "codemirror").doc.getLineHandle(index);
    };

    function getLineNumber(target, handle) {
        return $.data(target, "codemirror").doc.getLineNumber(handle);
    };

    function eachLine(target, param) {
        if (!param) { return; }
        var state = $.data(target, "codemirror"), isFunc = $.isFunction(param);
        return isFunc ? state.doc.eachLine(param) : state.doc.eachLine(param.start, param.end, param.f);
    };

    function markClean(target) {
        return $.data(target, "codemirror").doc.markClean();
    };

    function changeGeneration(target, closeEvent) {
        var state = $.data(target, "codemirror");
        closeEvent = closeEvent ? true : false;
        return state.doc.changeGeneration(closeEvent);
    };

    function isClean(target, generation) {
        var state = $.data(target, "codemirror"), isNumber = $.isNumeric(generation);
        return isNumber ? state.doc.isClean(generation) : state.doc.isClean();
    };

    function getSelection(target, lineSep) {
        var state = $.data(target, "codemirror");
        return lineSep ? state.doc.getSelection(lineSep) : state.doc.getSelection();
    };

    function getSelections(target, lineSep) {
        var state = $.data(target, "codemirror");
        return lineSep ? state.doc.getSelections(lineSep) : state.doc.getSelections();
    };

    function replaceSelection(replacement, select) {
        if (!param || !param.replacement) { return; }
        var state = $.data(target, "codemirror");
        return param.select ? state.doc.replaceSelection(param.replacement, param.select) : state.doc.replaceSelection(param.replacement);
    };

    function replaceSelections(replacement, select) {
        if (!param || !param.replacements) { return; }
        var state = $.data(target, "codemirror");
        return param.select ? state.doc.replaceSelections(param.replacements, param.select) : state.doc.replaceSelections(param.replacements);
    };

    function getCursor(target, start) {
        var state = $.data(target, "codemirror");
        return start ? state.doc.getCursor(start) : state.doc.getCursor();
    };

    function listSelections(target) {
        return $.data(target, "codemirror").doc.listSelections();
    };

    function somethingSelected(target) {
        return $.data(target, "codemirror").doc.somethingSelected();
    };

    function setCursor(target, param) {
        if (!param || !param.pos) { return; }
        var state = $.data(target, "codemirror");
        return state.doc.setCursor(param.pos, param.ch, param.options);
    };

    function setSelection(target, param) {
        if (!param || !param.anchor) { return; }
        var state = $.data(target, "codemirror");
        return state.doc.setSelection(param.anchor, param.head, param.options);
    };

    function setSelections(target, param) {
        if (!param || !param.ranges) { return; }
        var state = $.data(target, "codemirror");
        return state.doc.setSelections(param.ranges, param.primary, param.options);
    };

    function addSelection(target, param) {
        if (!param || !param.anchor) { return; }
        var state = $.data(target, "codemirror");
        return state.doc.addSelection(param.anchor, param.head);
    };

    function extendSelection(target, param) {
        if (!param || !param.from) { return; }
        var state = $.data(target, "codemirror");
        return state.doc.extendSelection(param.from, param.to, param.options);
    };

    function extendSelections(target, param) {
        if (!param || !param.heads) { return; }
        var state = $.data(target, "codemirror");
        return state.doc.extendSelections(param.heads, param.options);
    };

    function extendSelectionsBy(target, param) {
        if (!param || !$.isFunction(param.f)) { return; }
        var state = $.data(target, "codemirror");
        return state.doc.extendSelectionsBy(param.f, param.options);
    };

    function setExtending(target, value) {
        return $.data(target, "codemirror").doc.setExtending(value);
    };

    function getExtending(target) {
        return $.data(target, "codemirror").doc.getExtending();
    };

    function hasFocus(target) {
        return $.data(target, "codemirror").cm.hasFocus();
    };

    function findPosH(target, param) {
        if (!param || !param.start || !param.amount || !param.unit || !param.visually) { return; }
        var state = $.data(target, "codemirror");
        return state.cm.findPosH(param.start, param.amount, param.unit, param.visually);
    };

    function findPosV(target, param) {
        if (!param || !param.start || !param.amount || !param.unit) { return; }
        var state = $.data(target, "codemirror");
        return state.cm.findPosV(param.start, param.amount, param.unit);
    };

    function setOption(target, param) {
        if (!param || !param.option) { return; }
        var state = $.data(target, "codemirror");
        return state.cm.setOption(param.option, param.value);
    }

    function getOption(target, option) {
        if (!option) { return; }
        return $.data(target, "codemirror").cm.getOption(option);
    };

    function addKeyMap(target, param) {
        if (!param || !param.map) { return; }
        return $.data(target, "codemirror").cm.addKeyMap(param.map, param.bottom);
    };

    function removeKeyMap(target, map) {
        return $.data(target, "codemirror").cm.removeKeyMap(map);
    };

    function addOverlay(target, param) {
        if (!param || !param.mode) { return; }
        return $.data(target, "codemirror").cm.addOverlay(param.mode, param.options);
    };

    function removeOverlay(target, mode) {
        return $.data(target, "codemirror").cm.removeOverlay(mode);
    };

    function on(target, param) {
        if (!param || !param.type || !param.func) { return; }
        return $.data(target, "codemirror").cm.on(param.type, param.func);
    };

    function off(target, param) {
        if (!param || !param.type || !param.func) { return; }
        return $.data(target, "codemirror").cm.off(param.type, param.func);
    };

    function swapDoc(target, doc) {
        if (!doc) { return; }
        return $.data(target, "codemirror").cm.swapDoc(doc);
    };

    function copy(target, copyHistory) {
        return $.data(target, "codemirror").doc.target(copyHistory);
    };

    function linkedDoc(target, param) {
        return $.data(target, "codemirror").doc.linkedDoc(param);
    };

    function unlinkDoc(target, doc) {
        return $.data(target, "codemirror").doc.unlinkDoc(doc);
    };

    function iterLinkedDocs(target, f) {
        if (!$.isFunction(f)) { return; }
        return $.data(target, "codemirror").doc.iterLinkedDocs(f);
    };

    function undo(target) { return $.data(target, "codemirror").doc.undo(); };

    function redo(target) { return $.data(target, "codemirror").doc.redo(); };

    function undoSelection(target) { return $.data(target, "codemirror").doc.undoSelection(); };

    function redoSelection(target) { return $.data(target, "codemirror").doc.redoSelection(); };

    function historySize(target) { return $.data(target, "codemirror").doc.historySize(); };

    function clearHistory(target) { return $.data(target, "codemirror").doc.clearHistory(); };

    function getHistory(target) { return $.data(target, "codemirror").doc.getHistory(); };

    function setHistory(target, history) { return $.data(target, "codemirror").doc.setHistory(history); };

    function markText(target, param) {
        if (!param || !param.from || !param.to) { return; }
        return param.options ? $.data(target, "codemirror").doc.markText(param.from, param.to, param.options) : $.data(target, "codemirror").doc.markText(param.from, param.to);
    };

    function setBookmark(target, param) {
        if (!param || !param.pos) { return; }
        return param.options ? $.data(target, "codemirror").doc.setBookmark(param.pos, param.options) : $.data(target, "codemirror").doc.setBookmark(param.pos);
    };

    function findMarks(target, param) {
        if (!param || !param.from || !param.to) { return; }
        return $.data(target, "codemirror").doc.findMarks(param.from, param.to);
    };

    function findMarksAt(target, pos) {
        return $.data(target, "codemirror").doc.findMarksAt(pos);
    };

    function getAllMarks(target) {
        return $.data(target, "codemirror").doc.getAllMarks();
    };

    function setGutterMarker(target, param) {
        if (!param || !param.line || !param.gutterID || !param.value) { return; }
        return $.data(target, "codemirror").cm.setGutterMarker(param.line, param.gutterID, param.value);
    };

    function clearGutter(target, gutterID) {
        return $.data(target, "codemirror").cm.clearGutter(gutterID);
    };

    function addLineClass(target, param) {
        if (!param || !param.line || !param.where || !param.cls) { return; }
        return $.data(target, "codemirror").cm.addLineClass(param.line, param.where, param.cls);
    };

    function removeLineClass(target, param) {
        if (!param || !param.line || !param.where || !param.cls) { return; }
        return $.data(target, "codemirror").cm.removeLineClass(param.line, param.where, param.cls);
    };

    function lineInfo(target, line) {
        return $.data(target, "codemirror").cm.lineInfo(line);
    };

    function addWidget(target, param) {
        if (!param || !param.pos || !param.node || !param.scrollIntoView) { return; }
        return $.data(target, "codemirror").cm.addWidget(param.pos, param.node, param.scrollIntoView);
    };

    function addLineWidget(target, param) {
        if (!param || !param.line || !param.node) { return; }
        return param.options ? $.data(target, "codemirror").cm.addLineWidget(param.line, param.node, param.options) : $.data(target, "codemirror").cm.addLineWidget(param.line, param.node);
    };

    function scrollTo(target, param) {
        if (!param || !param.width || !param.height) { return; }
        return $.data(target, "codemirror").cm.scrollTo(param.width, param.height);
    };

    function getScrollInfo(target) {
        return $.data(target, "codemirror").cm.getScrollInfo();
    };

    function scrollIntoView(target, param) {
        if (!param || !param.what || !param.height) { return; }
        return $.data(target, "codemirror").cm.scrollIntoView(param.what, param.margin);
    };

    function cursorCoords(target, param) {
        if (!param || !param.where || !param.mode) { return; }
        return $.data(target, "codemirror").cm.cursorCoords(param.where, param.mode);
    };

    function charCoords(target, param) {
        if (!param || !param.pos) { return; }
        return param.mode ? $.data(target, "codemirror").cm.charCoords(param.pos, param.mode) : $.data(target, "codemirror").cm.charCoords(param.pos);
    };

    function coordsChar(target, param) {
        if (!param || !param.line) { return; }
        return param.mode ? $.data(target, "codemirror").cm.coordsChar(param.line, param.mode) : $.data(target, "codemirror").cm.coordsChar();
    };

    function lineAtHeight(target, param) {
        if (!param || !param.object) { return; }
        return param.mode ? $.data(target, "codemirror").cm.lineAtHeight(param.object, param.mode) : $.data(target, "codemirror").cm.lineAtHeight(param.object);
    };

    function heightAtLine(target, param) {
        if (!param || !param.height) { return; }
        return param.mode ? $.data(target, "codemirror").cm.heightAtLine(param.height, param.mode) : $.data(target, "codemirror").cm.heightAtLine(param.height);
    };

    function defaultTextHeight(target) {
        return $.data(target, "codemirror").cm.defaultTextHeight();
    };

    function defaultCharWidth(target) {
        return $.data(target, "codemirror").cm.defaultCharWidth();
    };

    function getViewport(target) {
        return $.data(target, "codemirror").cm.getViewport();
    };

    function getTokenAt(target, param) {
        if (!param || !param.pos) { return; }
        return $.data(target, "codemirror").doc.getTokenAt(param.pos, param.precise);
    };

    function getHelpers(target, param) {
        if (!param || !param.pos || !param.type) { return; }
        return $.data(target, "codemirror").doc.getHelpers(param.pos, param.type);
    };

    function getHelper(target, param) {
        if (!param || !param.pos || !param.type) { return; }
        return $.data(target, "codemirror").doc.getHelper(param.pos, param.type);
    };

    function getStateAfter(target, param) {
        return $.data(target, "codemirror").cm.getStateAfter(param.line, param.precise);
    };

    function indentLine(target, param) {
        if (!param || !param.line) { return; }
        return $.data(target, "codemirror").cm.indentLine(param.line, param.dir);
    };

    function toggleOverwrite(target, value) {
        return $.data(target, "codemirror").cm.toggleOverwrite(value);
    };

    function execCommand(target, name) {
        return $.data(target, "codemirror").cm.execCommand(name);
    };

    function posFromIndex(target, index) {
        return $.data(target, "codemirror").doc.posFromIndex(index);
    };

    function indexFromPos(target, param) {
        return $.data(target, "codemirror").doc.indexFromPos(param);
    };

    function getInputField(target) {
        return $.data(target, "codemirror").cm.getInputField();
    };

    function getWrapperElement(target) {
        return $.data(target, "codemirror").cm.getWrapperElement();
    };

    function getScrollerElement(target) {
        return $.data(target, "codemirror").cm.getScrollerElement();
    };

    function getGutterElement(target) {
        return $.data(target, "codemirror").cm.getGutterElement();
    };

    function hideTip(target) {
        var state = $.data(target, "codemirror");
        state.tip = false;
        state.wrapper.tooltip("hide");
    };

    function showTip(target) {
        var state = $.data(target, "codemirror"), opts = state.options;
        state.wrapper.tooltip($.extend({}, opts.tipOptions, { content: opts.missingMessage, position: opts.tipPosition, deltaX: opts.deltaX })).tooltip("show");
        state.tip = true;
    };

    function repositionTip(target) {
        var state = $.data(target, "codemirror");
        if (state && state.tip) {
            state.wrapper.tooltip("reposition");
        }
    };

    function initializeValidate(target) {
        var t = $(target), state = $.data(target, "codemirror"), opts = state.options;
        state.wrapper.unbind(".codemirror");
        if (opts.novalidate) {
            return;
        }
        state.wrapper.bind("focus.codemirror", function () {
            state.validating = true;
            state.value = undefined;
            (function () {
                if (state.validating) {
                    var value = t.codemirror("getValue");
                    if (state.value != value) {
                        state.value = value;
                        if (state.timer) {
                            clearTimeout(state.timer);
                        }
                        state.timer = setTimeout(function () { t.codemirror("validate"); }, opts.delay);
                    } else {
                        repositionTip(target);
                    }
                    setTimeout(arguments.callee, 200);
                }
            })();
        }).bind("blur.codemirror", function () {
            if (state.timer) {
                clearTimeout(state.timer);
                state.timer = undefined;
            }
            state.validating = false;
            hideTip(target);
        }).bind("mouseenter.codemirror", function () {
            if (state.wrapper.hasClass("codemirror-invalid")) {
                showTip(target);
            }
        }).bind("mouseleave.codemirror", function () {
            if (!state.validating) {
                hideTip(target);
            }
        });
    };

    function validate(target) {
        var t = $(target), state = $.data(target, "codemirror"), opts = state.options,
            value = t.codemirror("getValue");
        state.wrapper.removeClass("codemirror-invalid");
        hideTip(target);
        if (!opts.novalidate && opts.required && $.string.isNullOrWhiteSpace(value) && !t.is(":disabled") && !state.wrapper.hasClass("codemirror-disabled")) {
            state.wrapper.addClass("codemirror-invalid");
            if (state.validating) {
                showTip(target);
            }
            return false;
        }
        return true;
    };

    function setValidation(target, novalidate) {
        var state = $.data(target, "codemirror"), opts = state.options;
        if (novalidate != undefined && novalidate != null) {
            opts.novalidate = novalidate;
        }
        if (opts.novalidate) {
            state.wrapper.removeClass("codemirror-invalid");
            hideTip(target);
        }
        initializeValidate(target);
    };

    function loader(param, success, error) {
        var opts = $(this).codemirror("options");
        if (!opts.url) { return false; }
        $.ajax({
            type: opts.method, url: opts.url, data: param, dataType: "text",
            success: function (data) {
                success(data);
            }, error: function () {
                error.apply(this, arguments);
            }
        });
    };

    function ajaxRequest(target) {
        var state = $.data(target, "codemirror"), opts = state.options, param = $.extend({}, opts.queryParams);
        if (opts.url && opts.onBeforeLoad.call(target, param) != false) {
            opts.loader.call(target, param, function (data) {
                setValue(target, opts.loadFilter.call(target, data));
                opts.onLoad.apply(target, arguments);
            }, function () {
                opts.onLoadError.apply(this, arguments);
            });
        }
        state.cm.refresh();
    };

    function refresh(target, url) {
        var state = $.data(target, "codemirror"), opts = state.options;
        if (url) {
            if (typeof url == "string") {
                opts.url = url;
            } else {
                opts.queryParams = url;
            }
        }
        ajaxRequest(target);
    };

    $.fn.codemirror = function (options, param) {
        if (typeof options == "string") {
            var method = $.fn.codemirror.methods[options];
            if (method) {
                return method(this, param);
            } else {
                return this.codemirror("panel").panel(options, param);
            }
        }
        options = options || {};
        return this.each(function () {
            var state = $.data(this, "codemirror");
            if (state) {
                $.extend(state.options, options);
            } else {
                $.data(this, "codemirror", { options: $.extend({}, $.fn.codemirror.defaults, $.fn.codemirror.parseOptions(this), options) });
                create(this);
            }
            ajaxRequest(this);
        });
    };

    //  var cm = CodeMirror.fromTextArea("#t1");
    $.fn.codemirror.events = [
        "change", "changes", "beforeChange", "cursorActivity", "keyHandled", "inputRead", "beforeSelectionChange", "viewportChange", "swapDoc",
        "gutterClick", "gutterContextMenu", "focus", "blur", "scroll", "update", "renderLine",
        "mousedown", "dblclick", "contextmenu", "keydown", "keypress", "keyup", "dragstart", "dragenter", "dragover", "drop"
    ];
    /*
    $.fn.codemirror.properties = [
        //string
        "width", "height", "value", "mode", "theme", "keyMap",
        //boolean
        "fit", "disabled", "smartIndent", "indentWithTabs", "electricChars", "rtlMoveVisually", "lineWrapping", "lineNumbers", "fixedGutter", "coverGutterNextToScrollbar",
        "readOnly", "showCursorWhenSelecting", "autofocus", "dragDrop", "resetSelectionOnContextMenu", "flattenSpans", "addModeClass",
        //number
        "indentUnit", "tabSize", "firstLineNumber", "undoDepth", "historyEventDelay", "tabindex", "cursorBlinkRate", "cursorScrollMargin", "cursorHeight", "workTime",
        "workDelay", "pollInterval", "maxHighlightLength", "viewportMargin"
    ];
    //  var doc = cm.getDoc();
    $.fn.codemirror.documentEvents = [
        "change", "beforeChange", "cursorActivity", "beforeSelectionChange"
    ];
    //  var handle = doc.getLineHandle(num: integer);
    $.fn.codemirror.lineHandlerEvents = [
        "delete", "change"
    ];
    // var mark = doc.setBookmark(pos: {line, ch}, ?options: object);
    $.fn.codemirror.markedRangHandlerEvents = [
        "beforeCursorEnter", "clear", "hide", "unhide"
    ];
    // var widget = cm.addLineWidget(line: integer|LineHandle, node: Element, ?options: object);
    $.fn.codemirror.lineWidgetEvents = [
        "redraw"
    ];
    $.fn.codemirror.docMethods = [
        "getValue", "setValue", "getRange", "replaceRange", "getLine", "lineCount", "firstLine", "lastLine", "getLineHandle",
        "getLineNumber", "eachLine", "markClean", "changeGeneration", "isClean", "getSelection", "getSelections", "replaceSelection", "replaceSelections",
        "getCursor", "listSelections", "somethingSelected", "setCursor", "setSelection", "setSelections", "addSelection", "extendSelection", "extendSelections",
        "extendSelectionsBy", "setExtending", "getExtending", "getEditor", "copy", "linkedDoc",
        "unlinkDoc", "iterLinkedDocs", "undo", "redo", "undoSelection", "redoSelection", "historySize", "clearHistory", "getHistory",
        "setHistory", "markText", "setBookmark", "findMarks", "findMarksAt", "getAllMarks", "getMode", "getModeAt", "posFromIndex",
        "indexFromPos",
    ];
    $.fn.codemirror.cmMethods = [
        "hasFocus", "findPosH", "findPosV", "setOption", "getOption", "addKeyMap", "removeKeyMap", "addOverlay", "removeOverlay",
        "on", "off", "getDoc", "swapDoc", "setGutterMarker", "clearGutter", "addLineClass", "removeLineClass", "lineInfo",
        "addWidget", "addLineWidget", "setSize", "scrollTo", "getScrollInfo", "scrollIntoView", "cursorCoords", "charCoords", "coordsChar",
        "lineAtHeight", "heightAtLine", "defaultTextHeight", "defaultCharWidth", "getViewport", "refresh", "getTokenAt", "getTokenTypeAt", "getHelpers",
        "getHelper", "getStateAfter", "operation", "indentLine", "toggleOverwrite", "execCommand", "focus", "getInputField",
        "getWrapperElement", "getScrollerElement", "getGutterElement"
    ];
    */

    $.fn.codemirror.parseOptions = function (target) {
        return $.extend({}, $.fn.panel.parseOptions(target), $.parser.parseOptions(target, [
            "width", "height", "value", "mode", "theme", "keyMap", "fontSize", "lineHeight", "url",
            "missingMessage", "tipPosition",
            {
                fit: "boolean", disabled: "boolean", smartIndent: "boolean", indentWithTabs: "boolean", electricChars: "boolean",
                rtlMoveVisually: "boolean", lineWrapping: "boolean", lineNumbers: "boolean", fixedGutter: "boolean",
                coverGutterNextToScrollbar: "boolean", readOnly: "boolean", showCursorWhenSelecting: "boolean", autofocus: "boolean",
                dragDrop: "boolean", resetSelectionOnContextMenu: "boolean", flattenSpans: "boolean", addModeClass: "boolean",
                required: "boolean", novalidate: "boolean"
            },
            {
                indentUnit: "number", tabSize: "number", firstLineNumber: "number", undoDepth: "number", historyEventDelay: "number",
                tabindex: "number", cursorBlinkRate: "number", cursorScrollMargin: "number", cursorHeight: "number", workTime: "number",
                workDelay: "number", pollInterval: "number", maxHighlightLength: "number", viewportMargin: "number",
                deltaX: "number"
            }
        ]));
    };

    $.fn.codemirror.methods = {

        options: function (jq) { return getOptions(jq[0]); },

        panel: function (jq) { return $.data(jq[0], "codemirror").panel; },

        textarea: function (jq) { return $.data(jq[0], "codemirror").textarea; },

        cm: function (jq) { return $.data(jq[0], "codemirror").cm; },

        doc: function (jq) { return $.data(jq[0], "codemirror").doc; },

        //  设置 CodeMirror 代码编辑器大小,参数 size 是一个格式为 { width: number, height: number } 的 JSON-Object。
        resize: function (jq, size) { return jq.each(function () { resize(this, size); }); },

        //  销毁编辑器实例
        destroy: function (jq) { return jq.each(function () { destroy(this); }); },

        //
        show: function (jq) { return jq.each(function () { show(this); }); },

        //
        hide: function (jq) { return jq.each(function () { hide(this); }); },

        //
        enable: function (jq) { return jq.each(function () { setDisabled(this, false); }); },

        //
        disable: function (jq) { return jq.each(function () { setDisabled(this, true); }); },

        //
        getValue: function (jq, separator) { return getValue(jq[0], separator); },

        //
        setValue: function (jq, value) { return jq.each(function () { setValue(this, value); }); },

        //
        reset: function (jq) { return jq.each(function () { reset(this); }); },

        //
        focus: function (jq) { return jq.each(function () { focus(this); }); },

        //
        setFocus: function (jq) { return jq.each(function () { focus(this); }); },

        //  清空文档
        clear: function (jq) { return jq.each(function () { clear(this); }); },

        //
        refresh: function (jq, url) { return jq.each(function () { refresh(this, url); }); },

        //  param: { from: {line, ch}, to: {line, ch}, ?separator: string }
        getRange: function (jq, param) { return getRange(jq[0], param); },

        // param: { replacement: string, from: {line, ch}, to: {line, ch}, ?origin: string }
        replaceRange: function (jq, param) { return jq.each(function () { replaceRange(this, param); }); },

        getLine: function (jq, index) { return getLine(jq[0], index); },

        lineCount: function (jq) { return lineCount(jq[0]); },

        lastLine: function (jq) { return lastLine(jq[0]); },

        getLineHandle: function (jq, index) { return getLineHandle(jq[0], index); },

        getLineNumber: function (jq, handle) { return getLineNumber(jq[0], handle); },

        // param: function(line:LineHandler) | { start: integer, end: integer, f: (line: LineHandle) }
        eachLine: function (jq, param) { return jq.each(function () { eachLine(this, param); }); },

        markClean: function (jq) { return jq.each(function () { markClean(this); }); },

        changeGeneration: function (jq, closeEvent) { return changeGeneration(jq[0], closeEvent); },

        isClean: function (jq, generation) { return isClean(jq[0], generation); },

        getSelection: function (jq, lineSep) { return getSelection(jq[0], lineSep); },

        getSelections: function (jq, lineSep) { return getSelections(jq[0], lineSep); },

        // param: { replacement: string, ?select: string }
        replaceSelection: function (jq, param) { return jq.each(function () { replaceSelection(this, param); }); },

        // param: { replacements: array<string>, ?select: string }
        replaceSelections: function (jq, param) { return jq.each(function () { replaceSelections(this, param); }); },

        //  ?start: string
        //  return: {line, ch}
        getCursor: function (jq, start) { return getCursor(jq[0], start); },

        //  return: array<{ anchor, head }>
        listSelections: function (jq) { return listSelections(jq[0]); },

        somethingSelected: function (jq) { return somethingSelected(jq[0]); },

        //  param: { line, ch}|number, ?ch: number, ?options: object }
        setCursor: function (jq, param) { return jq.each(function () { setCursor(this, param); }); },

        //  param: { anchor: {line, ch}, ?head: {line, ch}, ?options: object }
        setSelection: function (jq, param) { return jq.each(function () { setSelection(this, param); }); },

        //  param: { ranges: array<{anchor, head}>, ?primary: integer, ?options: object }
        setSelections: function (jq, param) { return jq.each(function () { setSelections(this, param); }); },

        //  param: { anchor: {line, ch}, ?head: {line, ch} }
        addSelection: function (jq, param) { return jq.each(function () { addSelection(this, param); }); },

        //  param: { from: {line, ch}, ?to: {line, ch}, ?options: object }
        extendSelection: function (jq, param) { return jq.each(function () { extendSelection(this, param); }); },

        //  param: { heads: array<{line, ch}>, ?options: object }
        extendSelections: function (jq, param) { return jq.each(function () { extendSelections(this, param); }); },

        //  param: { f: function(range: {anchor, head}) → {anchor, head}), ?options: object }
        extendSelectionsBy: function (jq, param) { return jq.each(function () { extendSelectionsBy(this, param); }); },

        setExtending: function (jq, value) { return jq.each(function () { setExtending(this, value); }); },

        //  return: boolean
        getExtending: function (jq) { return getExtending(jq[0]); },

        //  return: boolean
        hasFocus: function (jq) { return hasFocus(jq[0]); },

        //  param: { start: {line, ch}, amount: integer, unit: string, visually: boolean }
        //  return: { line, ch, ?hitSide: boolean }
        findPosH: function (jq, param) { return findPosH(jq[0], param); },

        //  param: { start: {line, ch}, amount: integer, unit: string }
        //  return: { line, ch, ?hitSide: boolean }
        findPosV: function (jq, param) { return findPosV(jq[0], param); },

        //  param: { option: string, value: any }
        setOption: function (jq, param) { return jq.each(function () { setOption(this, param); }); },

        //  option: string
        //  return: any
        getOption: function (jq, option) { return getOption(jq[0], option); },

        //  param: { map: object, bottom: boolean }
        addKeyMap: function (jq, param) { return jq.each(function () { addKeyMap(this, param); }); },

        //  map: object
        removeKeyMap: function (jq, map) { return jq.each(function () { removeKeyMap(this, map); }); },

        // param: { mode: string|object, ?options: object }
        addOverlay: function (jq, param) { return jq.each(function () { addOverlay(this, param); }); },

        //  mode: string|object
        removeOverlay: function (jq, mode) { return jq.each(function () { removeOverlay(this, mode); }); },

        //  param: { type: string, func: (...args) }
        on: function (jq, param) { return jq.each(function () { on(this, param); }); },

        //  param: { type: string, func: (...args) }
        off: function (jq, param) { return jq.each(function () { off(this, param); }); },

        //  return: CodeMirror.Doc
        getDoc: function (jq) { return $.data(jq[0], "codemirror").doc; },

        //  return: CodeMirror
        getEditor: function (jq) { return $.data(jq[0], "codemirror").cm; },

        //  doc: CodeMirror.Doc
        //  return: CodeMirror.Doc
        swapDoc: function (jq, doc) { return swapDoc(jq[0], doc); },

        //  copyHistory: boolean
        //  return: CodeMirror.Doc
        copy: function (jq, copyHistory) { return copy(jq[0], copyHistory); },

        //  param: { shareHist: boolean, from: integer, to: integer, mode: string|object }
        linkedDoc: function (jq, param) { return linkedDoc(jq[0], param); },

        //  doc: CodeMirror.Doc
        unlinkDoc: function (jq, doc) { return jq.each(function () { unlinkDoc(this, doc); }); },

        //  f: function: (doc: CodeMirror.Doc, sharedHist: boolean)
        iterLinkedDocs: function (jq, f) { return jq.each(function () { iterLinkedDocs(this, f); }); },

        undo: function (jq) { return jq.each(function () { undo(this); }); },

        redo: function (jq) { return jq.each(function () { redo(this); }); },

        undoSelection: function (jq) { return jq.each(function () { undoSelection(this); }); },

        redoSelection: function (jq) { return jq.each(function () { redoSelection(this); }); },

        //  return: { undo: integer, redo: integer }
        historySize: function (jq) { return historySize(jq[0]); },

        clearHistory: function (jq) { return jq.each(function () { clearHistory(this); }); },

        //  return: object
        getHistory: function (jq) { return getHistory(jq[0]); },

        //  history: object
        setHistory: function (jq, history) { return jq.each(function () { setHistory(this, history); }); },

        //  param: { from: {line, ch}, to: {line, ch}, ?options: {
        //          className: string, inclusiveLeft: boolean, inclusiveRight: boolean, atomic: boolean, collapsed: boolean,
        //          clearOnEnter: boolean, clearWhenEmpty: boolean, replacedWidth: Element, handleMouseEvents: Boolean,
        //          readOnly: boolean, addToHistory: boolean, startStyle: string, endStyle: string, title: string, shared: boolean
        //      } }
        //  return: TextMarker
        markText: function (jq, param) { return markText(jq[0], param); },

        //  param: { pos: {line, ch}, ?options: { widget: Element, insertLeft: boolean, shared: boolean } }
        //  return: TextMarker
        setBookmark: function (jq, param) { return setBookmark(jq[0], param); },

        //  param:  { from: {line, ch}, to: {line, ch} }
        //  return: array<TextMarker>
        findMarks: function (jq, param) { return findMarks(jq[0], param); },

        //  pos:    { line, ch }
        //  return: array<TextMarker>
        findMarksAt: function (jq, pos) { return findMarksAt(jq[0], pos); },

        //  return: array<TextMarker>
        getAllMarks: function (jq) { return getAllMarks(jq[0]); },

        //  param:  { line: integer|LineHandle, gutterID: string, value: Element }
        //  return: LineHandle
        setGutterMarker: function (jq, param) { return setGutterMarker(jq[0], param); },

        //  gutterID: string
        clearGutter: function (jq, gutterID) { return jq.each(function () { clearGutter(this, gutterID); }); },

        //  param:  { line: integer|LineHandle, where: string, cls: string }
        //  return: LineHandle
        addLineClass: function (jq, param) { return addLineClass(jq[0], param); },

        //  param:  { line: integer|LineHandle, where: string, cls: string }
        //  return: LineHandle
        removeLineClass: function (jq, param) { return removeLineClass(jq[0], param); },

        //  line:   integer|LineHandle
        //  return: object
        lineInfo: function (jq, line) { return lineInfo(jq[0], line); },

        //  param:  { pos: {line, ch}, node: Element, scrollIntoView: boolean }
        addWidget: function (jq, param) { return jq.each(function () { addWidget(this, param); }); },

        //  param:  { line: integer|LineHandle, node: Element, ?options: {
        //          coverGutter: boolean, noHScroll: boolean, above: boolean, handleMouseEvents: boolean, insertAt: integer
        //      } }
        //  return: LineWidget{ methods: [clear(), changed()] }
        addLineWidget: function (jq, param) { return addLineWidget(jq[0], param); },

        //  param:  { width: number|string, height: number|string }
        setSize: function (jq, param) { return jq.each(function () { resize(this, param); }); },

        //  param:  { x: number, y: number }
        scrollTo: function (jq, param) { return jq.each(function () { scrollTo(this, param); }); },

        //  return: { left, top, width, height, clientWidth, clientHeight }
        getScrollInfo: function (jq) { return getScrollInfo(jq[0]); },

        //  param:  { what: {line, ch}|{left, top, right, bottom}|{from, to}|null, ?margin: number }
        scrollIntoView: function (jq, param) { return jq.each(function () { scrollIntoView(this, param); }); },

        //  param:  { where: boolean|{line, ch}, mode: string }
        //  return: { left, top, bottom }
        cursorCoords: function (jq, param) { return cursorCoords(jq[0], param); },

        //  param:  { pos: {line, ch}, ?mode: string }
        //  return: { left, right, top, bottom }
        charCoords: function (jq, param) { return charCoords(jq[0], param); },

        //  param:  { object: {left, top}, ?mode: string }
        //  return: { line, ch }
        coordsChar: function (jq, param) { return coordsChar(jq[0], param); },

        //  param:  { height: number, ?mode: string }
        //  return: number
        lineAtHeight: function (jq, param) { return lineAtHeight(jq[0], param); },

        //  param:  { line: number, ?mode: string }
        //  return: number
        heightAtLine: function (jq, param) { return heightAtLine(jq[0], param); },

        //  return: number
        defaultTextHeight: function (jq) { return defaultTextHeight(jq[0]); },

        //  return: number
        defaultCharWidth: function (jq) { return defaultCharWidth(jq[0]); },

        //  return: { from: number, to: number }
        getViewport: function (jq) { return getViewport(jq[0]); },

        //  return: object
        getMode: function (jq) { return $.data(jq[0], "codemirror").doc.getMode(); },

        //  pos: { line, ch }
        //  return: object
        getModeAt: function (jq, param) { return $.data(jq[0], "codemirror").doc.getModeAt(param); },

        //  param: { pos: {line, ch}, ?precise: boolean }
        //  return: { start, end, string, type, state }
        getTokenAt: function (jq, param) { return getTokenAt(jq[0], param); },

        //  param: { pos: { line, ch } }
        //  return: string
        getTokenTypeAt: function (jq, pos) { return $.data(jq[0], "codemirror").cm.getTokenTypeAt(pos); },

        //  param:  { pos: {line, ch}, type: string }
        //  return: array<helper>
        getHelpers: function (jq, param) { return getHelpers(jq[0], param); },

        //  param: { pos: {line, ch}, type: string }
        //  return: helper
        getHelper: function (jq, param) { return getHelper(jq[0], param); },

        //  param: { ?line: integer, ?precise: boolean }
        //  return: object
        getStateAfter: function (jq, param) { return getStateAfter(jq[0], param); },

        //  func: func: () → any
        //  return: any
        operation: function (jq, func) { return $.data(jq[0], "codemirror").cm.operation(func); },

        //  param:  { line: integer, ?dir: string|integer }
        indentLine: function (jq, param) { return jq.each(function () { indentLine(this, param); }); },

        //  ?value: boolean
        toggleOverwrite: function (jq, value) { return jq.each(function () { toggleOverwrite(this, value); }); },

        //  name: string
        execCommand: function (jq, name) { return jq.each(function () { execCommand(this, name); }); },

        //  index: integer
        //  return: { line, ch }
        posFromIndex: function (jq, index) { return posFromIndex(jq[0], index); },

        //  param:  { line, ch }
        //  return : integer
        indexFromPos: function (jq, param) { return indexFromPos(jq[0], param); },

        //  return: TextAreaElement
        getInputField: function (jq) { return getInputField(jq[0]); },

        //  return: Element
        getWrapperElement: function (jq) { return getWrapperElement(jq[0]); },

        //  return: Element
        getScrollerElement: function (jq) { return getScrollerElement(jq[0]); },

        //  return: Element
        getGutterElement: function (jq) { return getGutterElement(jq[0]); },

        validate: function (jq) { return jq.each(function () { validate(this); }); },

        isValid: function (jq) { return validate(jq[0]); },

        enableValidation: function (jq) { return jq.each(function () { setValidation(this, false) }); },

        disableValidation: function (jq) { return jq.each(function () { setValidation(this, true) }); }
    };

    $.fn.codemirror.defaults = $.extend({}, $.fn.panel.defaults, {

        //  CodeMirror 初始化时编辑器中的内容;string|CodeMirror.Doc
        value: "",
        //  CodeMirror 编辑器的代码类型模式;String 类型值,其值可以是 text/html、javascript、json 等;
        //  当使用指定的模式 mode 后,页面上同时需加载特定的模式 js 文件;
        //  如果不定义该参数,则默认取第一个加载的编辑器 mode
        //  string|object
        mode: null,
        //  CodeMirror 编辑器的主题 css 风格;string
        theme: "default",
        //  CodeMirror 编辑器的代码缩进空格数;integer;CodeMirror 官方默认为 2;此处修改为 4。
        indentUnit: 4,
        //  指定 CodeMirror 编辑器的进行换行时代码是否自动缩进;boolean
        smartIndent: true,
        //  指定 CodeMirror 编辑器的制表符宽度;integer
        tabSize: 4,
        //  指定 CodeMirror 编辑器中是否用制表符来替换缩进空格;boolean
        indentWithTabs: false,
        //  指定 CodeMirror 编辑器是否在当行内容改变时自动判断缩进;boolean
        electricChars: true,
        //  指定 CodeMirror 编辑器中哪些字符将会被占位符替代;RegExp
        specialChars: CodeMirror.defaults.specialChars,
        //  function 类型值
        specialCharPlaceholder: CodeMirror.defaults.specialCharPlaceholder,
        //  指定 CodeMirror 编辑器中在光标移动位置时指针是否可见;boolean
        rtlMoveVisually: CodeMirror.defaults.rtlMoveVisually,
        //  string 类型值;指定 CodeMirror 编辑器中的键盘映射配置;
        //  配置详情参见 http://codemirror.net/doc/manual.html#keymaps
        keyMap: "default",
        //  JSON-Object 类型;指定 CodeMirror 编辑器中除 keyMap 外额外的键盘快捷键配置
        //  配置详情参见 http://codemirror.net/doc/manual.html#option_keyMap
        extraKeys: null,
        //  boolean 类型值;指定 CodeMirror 编辑器中当行代码过长时是否自动换行(如果自动换行则不显示横向滚动条)
        lineWrapping: false,
        //  boolean 类型值;指定 CodeMirror 编辑器是否显示行号
        lineNumbers: false,
        //  integer 类型值;指定 CodeMirror 编辑器以代码中的那一行作为起始行;行索引号从 1 开始计数;
        firstLineNumber: 1,
        //  function 类型值;这是一个回调函数,用于格式化行号
        lineNumberFormatter: CodeMirror.defaults.lineNumberFormatter,
        //
        gutters: CodeMirror.defaults.gutters,
        //  boolean 类型值;指定 CodeMirror 编辑器中滚动条在移动时,标尺部分(行号和工具栏)是否固定不动
        fixedGutter: true,
        //  boolean 类型值;指定 CodeMirror 编辑器在 fixedGutter 参数为 true 时,控件的左右滚动条是否另起一个 scrollbar 显示;
        coverGutterNextToScrollbar: false,
        //  boolean | string 类型值;指定 CodeMirror 编辑器是否为只读不可编辑状态
        //  该参数值可以为 true、false、或者字符串值 "nocursor";如果值为 "nocursor" 则编辑器不仅不可编辑同时也不能得到输入焦点;
        readOnly: false,
        //  boolean 类型值;指定 CodeMirror 编辑器在用鼠标进行内容选择时是否始终显示输入焦点
        showCursorWhenSelecting: false,
        //  integer 类型值;指定 CodeMirror 编辑器所能支持的最大撤销次数
        undoDepth: 200,
        //  integer 类型值;该值表示当 CodeMirror 编辑器内容发生改变时的事件调用延迟时间(毫秒数);
        historyEventDelay: 1250,
        // integer 类型值;指定 CodeMirror 编辑器在页面上被分配的 HTML-tabIndex 属性值;如果不指定该属性值,将会被自动分配;
        tabindex: null,
        //  boolean 类型值;指定 CodeMirror 编辑器在初始化后是否自动获取焦点;
        autofocus: null,

        /************************************************/
        //  boolean 类型值;指定 CodeMirror 编辑器是否启用文本拖放功能;
        dragDrop: true,
        //  number 类型值;指定 CodeMirror 编辑器中输入光标的闪烁速率(毫秒数);如果该参数为 0,则输入光标不闪烁;
        cursorBlinkRate: 530,
        //  number 类型值;指定 CodeMirror 编辑器中输入光标的边界空白位置margin
        cursorScrollMargin: 0,
        //  number 类型值;指定 CodeMirror 编辑器中输入光标的高度;默认是1表示占满整行高度;
        //  例如,可以设置为 0.5 表示半行高度,设置为 2 表示占满 2 行高度;
        cursorHeight: 1,
        //  boolean 类型值;指定 CodeMirror 编辑器控件中点击鼠标右键后,是否自动清空区域文本选中效果;
        resetSelectionOnContextMenu: true,
        //  number 类型值;代码的高亮效果显示是通过一个伪后台线程执行来完成的,以下两个参数表示这个伪后台线程的工作和延迟时间(毫秒数);
        //  通过改变如下两个参数的值,可以增强高亮实时刷新的效果或者降低对浏览器性能的开销;
        workTime: 100, workDelay: 100,
        //  number 类型值;指定 CodeMirror 编辑器在获取输入焦点后自动检测编辑器内文本内容变化的时间频率(毫秒数);
        //  该值的大小将影响到 change 事件的调用延迟时间;
        pollInterval: 100,
        //  boolean 类型值;指定 CodeMirror 在处理代码高亮效果显示时,对于相邻的同类型字符块是否合并到一个 span 中来显示;
        //  如果该值设置为 true,将能一定程度提高代码高亮解析的效率,但是可能会改变某些特殊类型样式(例如圆角)的显示效果
        flattenSpans: true,
        //  boolean 类型值;指定 CodeMirror 在解析不同 mode 类型代码块高亮效果时,是否根据不同的 mode 设定在不同标记前加一个用于标记的 css 类;
        addModeClass: false,
        //  number 类型值;指定 CodeMirror 编辑器进行代码高亮解析的最大标签处理数量;该值设置的越大,同一个代码块中所能解析的文本域更大,但是也将会消耗更多的浏览器性能;
        maxHighlightLength: 10000,
        //  number 类型值;
        viewportMargin: 10,

        onchange: function () { },
        onchanges: function () { },
        onbeforeChange: function () { },
        oncursorActivity: function () { },
        onkeyHandled: function () { },
        oninputRead: function () { },
        onbeforeSelectionChange: function () { },
        onviewportChange: function () { },
        onswapDoc: function () { },
        ongutterClick: function () { },
        ongutterContextMenu: function () { },
        onfocus: function () { },
        onblur: function () { },
        onscroll: function () { },
        onupdate: function () { },
        onrenderLine: function () { },
        onmousedown: function () { },
        ondblclick: function () { },
        oncontextmenu: function () { },
        onkeydown: function () { },
        onkeypress: function () { },
        onkeyup: function () { },
        ondragstart: function () { },
        ondragenter: function () { },
        ondragover: function () { },
        ondrop: function () { }
    });

    $.extend($.fn.codemirror.defaults, {

        disabled: false,

        mode: "text/html",

        lineNumbers: true,

        fontSize: null,

        lineHeight: null,

        url: null,

        method: "get",

        queryParams: {},

        loader: loader,

        loadFilter: function (data) { return data; },

        required: false,
        missingMessage: "该编辑框不能为空.",
        //  "left", "right", "top", "bottom"
        tipPosition: "right",
        deltaX: 0,
        tipOptions: $.fn.validatebox.defaults.tipOptions,
        novalidate: false,

        onResize: function (width, height) { },

        onBeforeLoad: function (param) { },

        onLoad: function () { },

        onLoadError: function () { }
    });

    $.parser.plugins.push("codemirror");

    if ($.fn.form && $.isArray($.fn.form.otherList)) {
        $.fn.form.otherList.push("codemirror");
        //$.array.insert($.fn.form.otherList, 0, "codemirror");
    }

})(jQuery);


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Annls mycol. 20(3): 118 (1922)

#### Original name
Puccinia propinqua Syd., P. Syd. & E.J. Butler

### Remarks
null


text:
package org.skfiy.typhon.packet;

/**
 *
 * @author Kevin Zou <kevinz@skfiy.org>
 */
public class PacketRole extends Packet {

    private String name;
    private int level;

    public String getName() {
        return name;
    }

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

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

}


text:
package org.kaaproject.kaa.server.admin.services.entity;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;

@Entity
@Table(name = "admin_properties")
public class Properties {

    @Id
    @GeneratedValue
    private Long id;

    private String fqn;

    @Lob
    private byte[] rawConfiguration;

    public Properties() {
    }

    public Properties(byte[] rawConfiguration) {
        super();
        this.rawConfiguration = rawConfiguration;
    }

    public Long getId() {
        return id;
    }

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

    public String getFqn() {
        return fqn;
    }

    public void setFqn(String fqn) {
        this.fqn = fqn;
    }

    public byte[] getRawConfiguration() {
        return rawConfiguration;
    }

    public void setRawConfiguration(byte[] rawConfiguration) {
        this.rawConfiguration = rawConfiguration;
    }

}


text:
namespace b2d{

	// Font Constructor
	Font::Font (const char* FontPath, char* Text, int Size, Vector2::Point Position, RGBA Colour, bool IsStatic, int FontType){

	    // If Pixmap Font Is Selected
		if (FontType == 0){

			// Set Font Path
			Font::pixFont = new FTGLPixmapFont (FontPath);

			// Check For Errors
			if (Font::pixFont -> Error()){

				std::cout << stderr << " The font \"" << FontPath << "\" could not be loaded" << '\n';
				return;
			}

			// Set Font Size
			Font::pixFont -> FaceSize (Size);
		}

		// If Bitmap Font Is Selected
		else if (FontType == 1){

			// Set Font Path
			Font::bitFont = new FTGLBitmapFont (FontPath);

			// Check For Errors
			if (Font::bitFont -> Error()){

				std::cout << stderr << " The font \"" << FontPath << "\" could not be loaded" << '\n';
				return;
			}

			// Set Font Size
			Font::bitFont -> FaceSize (Size);
		}

		// Else Display Error
		else{

			std::cout << stderr <<  "An invalid font type was selected. The default font type will be used" << '\n';

			// Set Font Path
			Font::pixFont = new FTGLPixmapFont (FontPath);

			// Check For Errors
			if (Font::pixFont -> Error()){

				std::cout << stderr << " The font \"" << FontPath << "\" could not be loaded" << '\n';
				return;
			}

			// Set Font Size
			Font::pixFont -> FaceSize (Size);

			FontType = 0;
		}

		// Set Font Variables
		Font::text = Text;
		Font::isStatic = IsStatic;
		Font::position = Position;
		Font::fontType = FontType;
		Font::canRender = true;
		Font::size = Size;

		Font::colour.x = Colour.colour.x;
		Font::colour.y = Colour.colour.y;
		Font::colour.z = Colour.colour.z;
		Font::colour.w = Colour.colour.w;
	}

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

	// Render The Font
	void Font::Draw(){

		// Check If Rendering Is Enabled
		if (Font::canRender){

			// Set Text Colour
			glColor4f (Font::colour.x, Font::colour.y, Font::colour.z, Font::colour.w);

		    // If Pixmap Font Is Selected
		    if (Font::fontType == 0){

			    // Check If Font Is Static
			    if (Font::isStatic){

				    // Set Font Position
				    glRasterPos2d (b2d::Camera::position.x + Font::position.x, b2d::Camera::position.y + Font::position.y);
		        }

			    else{

				    // Set Font Position
				    glRasterPos2d (Font::position.x, Font::position.y);
			    }

			    // Render Text
			    Font::pixFont -> Render (Font::text);
		    }

		    // If Bitmap Font Is Selected
		    else if (Font::fontType == 1){

			    // Check If Font Is Static
			    if (Font::isStatic){

				    // Set Font Position
				    glRasterPos2d (b2d::Camera::position.x + Font::position.x, b2d::Camera::position.y + Font::position.y);
		        }

			    else{

				    // Set Font Position
				    glRasterPos2d (Font::position.x, Font::position.y);
			    }

				Font::bitFont -> Render (Font::text);
			}
		}
	}

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

	// Move Text To Absolute Position
	void Font::Move (float X, float Y){

		Font::position.SetPoint (X, Y);
	}

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

	// Move Text To Relative Position
	void Font::Translate (float X, float Y){

		Font::position.x += (X * 50 * (float) Time::deltaTime);
		Font::position.y += (Y * 50 * (float) Time::deltaTime);
	}

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

	// Set The Text Colour
	void Font::SetColour (RGBA Colour){

		Font::colour.x = Colour.colour.x;
		Font::colour.y = Colour.colour.y;
		Font::colour.z = Colour.colour.z;
		Font::colour.w = Colour.colour.w;
	}

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

	// Set The Font Size
	void Font::SetSize (int Size){

		if (Font::fontType == 0){
			Font::pixFont -> FaceSize (Size);
		}

		else{
			Font::bitFont -> FaceSize (Size);
		}
	}

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

	// Font Deconstructor
	void Font::Destroy(){

		// Check Font Type And Destroy Pointers
		if (Font::fontType == 0){
		    delete Font::pixFont;
		}

		else{
		    delete Font::bitFont;
		}
	}
}


text:
using SunLine.Community.Entities.Dict;
using SunLine.Community.Repositories.Dict;

namespace SunLine.Community.Services.Dict
{
    [BusinessLogic]
    public class MessageStateService : IMessageStateService
    {
        private readonly IMessageStateRepository _messageStateRepository;

        public MessageStateService(IMessageStateRepository messageStateRepository)
        {
            _messageStateRepository = messageStateRepository;
        }

        public MessageState FindByEnum(MessageStateEnum messageStateEnum)
        {
            return _messageStateRepository.FindByEnum(messageStateEnum);
        }
    }
}


text:
public class Car {

	private int maxSpeed;
	private String manufactorName;

	public Car(int maxSpeed, String manufactorName){
		this.maxSpeed = maxSpeed;
		this.manufactorName = manufactorName;
	}

}


text:
package io.particle.android.sdk.di;

import android.support.annotation.RestrictTo;

import com.google.gson.Gson;

import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;
import io.particle.android.sdk.cloud.ParticleCloud;
import io.particle.android.sdk.cloud.ParticleCloudSDK;

@Module
@RestrictTo({RestrictTo.Scope.LIBRARY})
public class CloudModule {

    @Singleton
    @Provides
    protected ParticleCloud providesParticleCloud() {
        return ParticleCloudSDK.getCloud();
    }

    @Singleton
    @Provides
    protected Gson providesGson() {
        return new Gson();
    }
}


text:
package command;

import controller.Controller;

public class PenDownCommand extends ZeroParamCommand {

	@Override
	public double execute() {
		return Controller.changePenVisibility(1);
	}

}


text:
import Modification from '../../../parsers/w3x/w3u/modification';
import { OEContainer } from './containers';

export abstract class OEObject {
  parent: OEContainer<OEObject>;
  oldId: string;
  newId: string;
  modifications = new Map<string, string>();

  constructor(parent: OEContainer<OEObject>, oldId: string, newId: string, modifications: Modification[]) {
    this.parent = parent;
    this.oldId = oldId;
    this.newId = newId;

    for (const modification of modifications) {
      let value = modification.value;

      if (typeof value !== 'string') {
        value = value.toString();
      }

      this.modifications.set(modification.id, value);
    }
  }

  string(id: string): string {
    let value = this.modifications.get(id);

    if (value === undefined) {
      const row = this.parent.data.getRow(this.oldId);
      const name = this.parent.metaData.getProperty(id, 'field');

      value = row.string(name);

      if (value === undefined) {
        return '_';
      }
    }

    if (value === '-' || value === ' - ') {
      return '_';
    }

    return value;
  }

  number(id: string): number {
    const number = parseFloat(this.string(id));

    if (isNaN(number)) {
      return 0;
    }

    return number;
  }

  boolean(id: string): boolean {
    const string = this.string(id);

    if (string === '1' || string === 'TRUE') {
      return true;
    }

    return false;
  }

  set(id: string, value: string | number | boolean | undefined): void {
    if (value === undefined) {
      this.modifications.delete(id);
    } else {
      if (value === true) {
        value = '1';
      } else if (value === false) {
        value = '0';
      } else if (typeof value !== 'string') {
        value = value.toString();
      }

      this.modifications.set(id, value);
    }
  }
}