text:
'use strict';

const assert = require('assert');

const _ = require('lodash');

describe('Parser Factory > ', () => {

  const CONSTANTS = require('../hf/constants');
  const parserUtil = require('../hf/parser-util');

  describe('DuckType > ', () => {

    it('Should known "addListener"', () => {
      assert.ok(_.isFunction(parserUtil.getParser));
    });
  });

  describe('Parse JSON Format > ', () => {

    it('Should parse JSON to LogMessage (normal)', (done) => {

      const TEXT = '{"_Timestamp":"2017-03-09T21:21:20.036+0100","_Level":"INFO","_Version":"Payara 4.1","_LoggerName":"javax.enterprise.system.core.security","_ThreadID":"17","_ThreadName":"RunLevelControllerThread-1489090879147","_TimeMillis":"1489090880036","_LevelValue":"800","_MessageID":"NCLS-SECURITY-01115","_LogMessage":"Realm [admin-realm] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created."}';

      const sinkFunc = (logMessage) => {

        assertString(logMessage.timestamp, '-');
        assertString(logMessage.logLevel, '-');
        assertString(logMessage.version, '-');
        assertString(logMessage.logName, '-');
        assertString(logMessage.threadId, '-');
        assertString(logMessage.threadName, '-');
        assertNumber(logMessage.timeMillis, 0);
        assertNumber(logMessage.logValue, 0);
        assert.ok(_.isString(logMessage.messageId));
        assertString(logMessage.logMessage, '-');
      };

      const worker = parserUtil.getParser(CONSTANTS.FORMAT_JSON);

      worker.process(TEXT, sinkFunc, done);
    });

    it('Should parse JSON to LogMessage (with empty MessageId)', (done) => {

      const TEXT = '{"_Timestamp":"2017-03-09T21:21:20.036+0100","_Level":"INFO","_Version":"Payara 4.1","_LoggerName":"javax.enterprise.system.core.security","_ThreadID":"17","_ThreadName":"RunLevelControllerThread-1489090879147","_TimeMillis":"1489090880036","_LevelValue":"800","_LogMessage":"Realm [admin-realm] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created."}';

      const sinkFunc = (logMessage) => {

        assertString(logMessage.timestamp, '-');
        assertString(logMessage.logLevel, '-');
        assertString(logMessage.version, '-');
        assertString(logMessage.logName, '-');
        assertString(logMessage.threadId, '-');
        assertString(logMessage.threadName, '-');
        assertNumber(logMessage.timeMillis, 0);
        assertNumber(logMessage.logValue, 0);
        assert.ok(_.isString(logMessage.messageId));
        assertString(logMessage.logMessage, '-');
      };

      const worker = parserUtil.getParser(CONSTANTS.FORMAT_JSON);

      worker.process(TEXT, sinkFunc, done);

    });

    it('Should not parse JSON to LogMessage (Error)', (done) => {

      const TEXT = '{"_Timestamp":"2017-03-09T21:21:20.036+0100,"_Level":"INFO","_Version":"Payara 4.1","_LoggerName":"javax.enterprise.system.core.security","_ThreadID":"17","_MessageID": "Logger", "_ThreadName":"RunLevelControllerThread-1489090879147","_TimeMillis":"1489090880036","_LevelValue":"800","_LogMessage":"Realm [admin-realm] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created."}';

      const worker = parserUtil.getParser(CONSTANTS.FORMAT_JSON);

      const sinkFunc = () => {
        // will never called
        assert.ok(false);
      };

      worker.process(TEXT, sinkFunc, done);
    });

    it('Should parse JSON to LogMessage (Multiline)', (done) => {

      const TEXT = '{"_Timestamp":"2017-03-09T21:21:20.036+0100","_Level":"INFO","_Version":"Payara 4.1","_LoggerName":"javax.enterprise.system.core.security","_ThreadID":"17","_ThreadName":"RunLevelControllerThread-1489090879147","_TimeMillis":"1489090880036","_LevelValue":"800","_MessageID":"NCLS-SECURITY-01115","_LogMessage":"Realm [admin-realm] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.\\nThis is the second line"}';

      const sinkFunc = (logMessage) => {

        assertString(logMessage.timestamp, '-');
        assertString(logMessage.logLevel, '-');
        assertString(logMessage.version, '-');
        assertString(logMessage.logName, '-');
        assertString(logMessage.threadId, '-');
        assertString(logMessage.threadName, '-');
        assertNumber(logMessage.timeMillis, 0);
        assertNumber(logMessage.logValue, 0);
        assert.ok(_.isString(logMessage.messageId));
        assertString(logMessage.logMessage, '-');
        assert.ok(/\nThis is the second line$/gm.test(logMessage.logMessage));

      };

      const worker = parserUtil.getParser(CONSTANTS.FORMAT_JSON);

      assert.ok(worker.process(TEXT, sinkFunc, done));

    });
  });

  describe('Parse ODL Format > ', () => {

    it('Should parse ODL to LogMessage (normal)', (done) => {

      const TEXT = `
[2017-03-09T21:10:39.610+0100] [Payara 4.1] [INFO] [NCLS-SECURITY-01010] [javax.enterprise.system.core.security] [tid: _ThreadID=76 _ThreadName=Thread-20] [timeMillis: 1489090239610] [levelValue: 800] [[
  Entering Security Startup Service.]]
`;

      const sinkFunc = (logMessage) => {

        assertString(logMessage.timestamp, '-');
        assertString(logMessage.logLevel, '-');
        assertString(logMessage.version, '-');
        assertString(logMessage.logName, '-');
        assertString(logMessage.threadId, '-');
        assertString(logMessage.threadName, '-');
        assertNumber(logMessage.timeMillis, 0);
        assertNumber(logMessage.logValue, 0);
        assert.ok(_.isString(logMessage.messageId));
        assertString(logMessage.logMessage, '-');
      };

      const worker = parserUtil.getParser(CONSTANTS.FORMAT_ODL);

      worker.process(TEXT, sinkFunc, done);

    });

    it('Should parse ODL to LogMessage (with empty MessageId)', (done) => {

      const TEXT = `
[2017-03-09T21:10:39.610+0100] [Payara 4.1] [INFO] [] [javax.enterprise.system.core.security] [tid: _ThreadID=76 _ThreadName=Thread-20] [timeMillis: 1489090239610] [levelValue: 800] [[
  Entering Security Startup Service.]]
`;

      const sinkFunc = (logMessage) => {

        assertString(logMessage.timestamp, '-');
        assertString(logMessage.logLevel, '-');
        assertString(logMessage.version, '-');
        assertString(logMessage.logName, '-');
        assertString(logMessage.threadId, '-');
        assertString(logMessage.threadName, '-');
        assertNumber(logMessage.timeMillis, 0);
        assertNumber(logMessage.logValue, 0);
        assert.ok(_.isString(logMessage.messageId));
        assertString(logMessage.logMessage, '-');
      };

      const worker = parserUtil.getParser(CONSTANTS.FORMAT_ODL);

      worker.process(TEXT, sinkFunc, done);

    });

    it('Should not parse ODL to LogMessage (Error)', (done) => {

      const TEXT = `
[2017-03-09T21:10:39.610+0100] [Payara 4.1] [javax.enterprise.system.core.security] [tid: _ThreadID=76 _ThreadName=Thread-20] [timeMillis: 1489090239610] [levelValue: 800] [[
  Entering Security Startup Service.]]
`;
      const sinkFunc = (logMessage) => {
        assert.ok(false);
      };

      const worker = parserUtil.getParser(CONSTANTS.FORMAT_JSON);

      worker.process(TEXT, sinkFunc, done);

    });

    it('Should parse ODL to LogMessage (Multiline)', (done) => {

      const TEXT = `
[2017-03-09T21:10:39.610+0100] [Payara 4.1] [INFO] [NCLS-SECURITY-01010] [javax.enterprise.system.core.security] [tid: _ThreadID=76 _ThreadName=Thread-20] [timeMillis: 1489090239610] [levelValue: 800] [[
  Entering Security Startup Service.
This is the second line]]
`;

      const sinkFunc = (logMessage) => {

        assertString(logMessage.timestamp, '-');
        assertString(logMessage.logLevel, '-');
        assertString(logMessage.version, '-');
        assertString(logMessage.logName, '-');
        assertString(logMessage.threadId, '-');
        assertString(logMessage.threadName, '-');
        assertNumber(logMessage.timeMillis, 0);
        assertNumber(logMessage.logValue, 0);
        assert.ok(_.isString(logMessage.messageId));
        assertString(logMessage.logMessage, '-');
        assert.ok(/\nThis is the second line$/gm.test(logMessage.logMessage));
      };

      const worker = parserUtil.getParser(CONSTANTS.FORMAT_ODL);

      worker.process(TEXT, sinkFunc, done);

    });
  });

  describe('Parse UFL Format > ', () => {

    it('Should parse UFL to LogMessage (normal)', (done) => {

      const TEXT = `
[#|2017-03-09T21:13:35.367+0100|INFO|Payara 4.1|javax.enterprise.logging|_ThreadID=18;_ThreadName=RunLevelControllerThread-1489090415224;_TimeMillis=1489090415367;_LevelValue=800;_MessageID=NCLS-LOGGING-00010;|
  Server log file is using Formatter class: com.sun.enterprise.server.logging.UniformLogFormatter|#]
`;

      const sinkFunc = (logMessage) => {

        assertString(logMessage.timestamp, '-');
        assertString(logMessage.logLevel, '-');
        assertString(logMessage.version, '-');
        assertString(logMessage.logName, '-');
        assertString(logMessage.threadId, '-');
        assertString(logMessage.threadName, '-');
        assertNumber(logMessage.timeMillis, 0);
        assertNumber(logMessage.logValue, 0);
        assert.ok(_.isString(logMessage.messageId));
        assertString(logMessage.logMessage, '-');
      };

      const worker = parserUtil.getParser(CONSTANTS.FORMAT_UFL);

      worker.process(TEXT, sinkFunc, done);

    });

    it('Should parse UFL to LogMessage (with empty MessageId)', (done) => {

      const TEXT = `
[#|2017-03-09T21:13:35.367+0100|INFO|Payara 4.1|javax.enterprise.logging|_ThreadID=18;_ThreadName=RunLevelControllerThread-1489090415224;_TimeMillis=1489090415367;_LevelValue=800;_MessageID=;|
  Server log file is using Formatter class: com.sun.enterprise.server.logging.UniformLogFormatter|#]
`;

      const sinkFunc = (logMessage) => {

        assertString(logMessage.timestamp, '-');
        assertString(logMessage.logLevel, '-');
        assertString(logMessage.version, '-');
        assertString(logMessage.logName, '-');
        assertString(logMessage.threadId, '-');
        assertString(logMessage.threadName, '-');
        assertNumber(logMessage.timeMillis, 0);
        assertNumber(logMessage.logValue, 0);
        assert.ok(_.isString(logMessage.messageId));
        assertString(logMessage.logMessage, '-');
      };

      const worker = parserUtil.getParser(CONSTANTS.FORMAT_UFL);

      worker.process(TEXT, sinkFunc, done);

    });

    it('Should not parse UFL to LogMessage (Error)', (done) => {

      const TEXT = `
[#|2017-03-09T21:13:35.367+0100|INFO|Payara 4.1|javax.enterprise.loggingRunLevelControllerThread-1489090415224;_TimeMillis=1489090415367;_LevelValue=800;_MessageID=NCLS-LOGGING-00010;|
  Server log file is using Formatter class: com.sun.enterprise.server.logging.UniformLogFormatter|#]
`;

      const sinkFunc = (logMessage) => {
        assert.ok(false);
      };

      const worker = parserUtil.getParser(CONSTANTS.FORMAT_UFL);

      worker.process(TEXT, sinkFunc, done);

    });

    it('Should parse UFL to LogMessage (Multiline)', (done) => {

      const TEXT = `
[#|2017-03-09T21:13:35.367+0100|INFO|Payara 4.1|javax.enterprise.logging|_ThreadID=18;_ThreadName=RunLevelControllerThread-1489090415224;_TimeMillis=1489090415367;_LevelValue=800;_MessageID=NCLS-LOGGING-00010;|
  Server log file is using Formatter class: com.sun.enterprise.server.logging.UniformLogFormatter
This is the second line|#]
`;

      const sinkFunc = (logMessage) => {

        assertString(logMessage.timestamp, '-');
        assertString(logMessage.logLevel, '-');
        assertString(logMessage.version, '-');
        assertString(logMessage.logName, '-');
        assertString(logMessage.threadId, '-');
        assertString(logMessage.threadName, '-');
        assertNumber(logMessage.timeMillis, 0);
        assertNumber(logMessage.logValue, 0);
        assert.ok(_.isString(logMessage.messageId));
        assertString(logMessage.logMessage, '-');
        assert.ok(/\nThis is the second line$/gm.test(logMessage.logMessage));
      };

      const worker = parserUtil.getParser(CONSTANTS.FORMAT_UFL);

      worker.process(TEXT, sinkFunc, done);

    });
  });

  function assertString(value, notValue) {
    assert.ok(_.isString(value) && value !== notValue);
  }

  function assertNumber(value, notValue) {
    const no = parseInt(value, 10);
    assert.ok(!isNaN(no) && value !== notValue);
  }

});


text:
String fileDirectory = "../Data/";

String GetFileDirectory()
{
	return fileDirectory;
}

void SetFileDirectory(String fileDir)
{
	fileDirectory = fileDir;
}

bool FileResource::Open(String filename)
{
	std::FILE* file(std::fopen((fileDirectory+filename).c_str(), "rb"));

	if (file == nullptr)
		return false;

	std::ostringstream stream;

	std::vector<char> buffer(1024);
	UInt chunk_size = 0;

	do
	{
		chunk_size = std::fread(&buffer[0], sizeof buffer[0], buffer.size(), file);
		//chunk_size = number of bytes read
		//&buffer[0] = pointer to start of buffer
		//sizeof buffer[0] = element size (1 byte)
		//buffer.size() = size of buffer (1024 * 1 byte = 1024 bytes)
		//file = pointer to open file handle

		stream << String((char*)(&buffer[0]), chunk_size);
		//push to stream, because string.
	}
	while (chunk_size == buffer.size()); //chunk size is full; not EOF

	mContent = stream.str();

	fclose(file);

	return !mContent.empty();
}

redpajama_set_name: RedPajamaGithub


text:
This module provides some compatible methods of Node.js's [Buffer API](https://nodejs.org/api/buffer.html)
which work with `Uint8Array` and `Array` as well as `Buffer` instance.
It's light-weight and just 5KB when minified without [Buffer](https://www.npmjs.com/package/buffer) shim.

[![Build Status](https://saucelabs.com/browser-matrix/bufferish.svg)](https://saucelabs.com/beta/builds/edba9addceeb41ee89df3648c076a99d)

### alloc(size)

See [Buffer.alloc()](https://nodejs.org/api/buffer.html#buffer_class_method_buffer_alloc_size_fill_encoding).

```js
Bufferish.Array.alloc(size)
```

It creates a new `Array` instance of `size` elements.

```js
Bufferish.Buffer.alloc(size)
```

It creates a new `Buffer` instance of `size` bytes.
It's available only when `Buffer` class available.

```js
Bufferish.Uint8Array.alloc(size)
```

It creates a new `Uint8Array` instance of `size` bytes.
It's available only when `Uint8Array` class available.

```js
Bufferish.alloc(size)
```

It creates a new instance of one of `Buffer`, `Uint8Array` or `Array`, depending on the environment.

```js
Bufferish.alloc.call(ref, size)
```

It creates the same type instance of `ref` which is one of `Buffer`, `Uint8Array` or `Array` instances.
It may cost less when a native copy methods is available.

### from(src)

See [Buffer.from()](https://nodejs.org/api/buffer.html#buffer_class_method_buffer_from_array).
`src` is an Array-like instance such as `Buffer`, `Uint8Array` or `Array`. `String` is also allowed.

```js
Bufferish.Array.from(src)
```

It creates a new `Array` instance copied from `src`.

```js
Bufferish.Buffer.from(src)
```

It creates a new `Buffer` instance copied from `src`.

```js
Bufferish.Uint8Array.from(src)
```

It creates a new `Uint8Array` instance copied from `src`.

```js
Bufferish.from(src)
```

It creates a copied instance of one of `Buffer`, `Uint8Array` or `Array`, depending on the environment.

### concat(list)

See [Buffer.concat()](https://nodejs.org/api/buffer.html#buffer_class_method_buffer_concat_list_totallength).
`list` is an `Array` which contains an Array-like instances such `Buffer`, `Uint8Array` or `Array`.

```js
Bufferish.Array.concat(list)
```

It creates a new `Array` instance concatenated.

```js
Bufferish.Buffer.concat(list)
```

It creates a new `Buffer` instance concatenated.

```js
Bufferish.Uint8Array.concat(list)
```

It creates a new `Uint8Array` instance concatenated.

```js
Bufferish.concat(list)
```

It creates a concatenated instance of one of `Buffer`, `Uint8Array` or `Array`, depending on the environment.

### Bufferish.isXXX()

```js
Bufferish.isArray(array)
```

It returns `true` if `array` is an `Array` instance.
See [Array.isArray()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray).

```js
Bufferish.isArrayBuffer(arraybuffer)
```

It returns `true` if `arraybuffer` is an `ArrayBuffer` instance.

```js
Bufferish.isBuffer(buffer)
```

It returns `true` if `buffer` is a `Buffer` instance.
See [Buffer.isBuffer()](https://nodejs.org/api/buffer.html#buffer_class_method_buffer_isbuffer_obj).

```js
Bufferish.isView(typedarray)
```

It returns `true` if `typedarray` is `Uint8Array` or other `TypedArray` instance.
See [ArrayBuffer.isView()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView).

### Bufferish.prototype.XXX.call()

Those methods must be called with `call()` to perform the trick.

`src` is an Array-like instance such as `Buffer`, `Uint8Array` or `Array`.

```js
Bufferish.prototype.copy.call(src, target, targetStart, start, end)
```

It copies data from a region of `src` to a region in `target`.
See [Buffer.prototype.copy()](https://nodejs.org/api/buffer.html#buffer_buf_copy_targetbuffer_targetstart_sourcestart_sourceend).

```js
Bufferish.prototype.slice.call(src, start, end)
```

It returns a new instance from a region of `src`.
See [Buffer.prototype.slice()](https://nodejs.org/api/buffer.html#buffer_buf_slice_start_end).

```js
Bufferish.prototype.toString.call(src, encoding, start, end)
```

It returns a `String` from a region of `src`.
Please note that `encoding` may not be supported and just ignored.
See [Buffer.prototype.toString()](https://nodejs.org/api/buffer.html#buffer_buf_tostring_encoding_start_end).

```js
Bufferish.prototype.write.call(buf, string, offset)
```

It writes `String` to `buf` at the offset.
See [Buffer.prototype.write()](https://nodejs.org/api/buffer.html#buffer_buf_write_string_offset_length_encoding).

### Other methods

Any other methods which are not described above are not supported with the module.
Please consult with [Buffer](https://www.npmjs.com/package/buffer) shim instead.

### Installation

```sh
npm install bufferish --save
```

### Webpacked

The standalone builds for Web browsers are also shipped.

- https://rawgit.com/kawanet/bufferish/master/dist/bufferish.min.js

It's minified WITHOUT [Buffer](https://www.npmjs.com/package/buffer) shim. Just 5KB.

- https://rawgit.com/kawanet/bufferish/master/dist/bufferish.buffer.js

It's minified WITH [Buffer](https://www.npmjs.com/package/buffer) shim. 26KB.
`Bufferish.original` refers the shim module.

### GitHub

- [https://github.com/kawanet/bufferish](https://github.com/kawanet/bufferish)

### License

The MIT License (MIT)

Copyright (c) 2016 Yusuke Kawasaki

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

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

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


text:
package org.geomajas.graphics.client.util.textbox;

import java.util.Arrays;

import org.geomajas.graphics.client.resource.GraphicsResource;

/**
 * Extention of the {@link StringTextBoxValidator} for css strings.
 *
 * @author Jan Venstermans
 */
public class ColorTextBoxValidator extends StringTextBoxValidator {

	private static final String HEX_FORM = "[#][0-9A-Fa-f]{6}";

	@Override
	public boolean isValid() {
		validate();
		evaluateErrorMessage(GraphicsResource.MESSAGES.exceptionValidationColorTextBox());
		return super.isValid();
	}

	@Override
	protected void validate() {
		setValid(validateCssColor(getLabel()));
	}

	private boolean validateCssColor(String color) {
		// hexadecimal form
		if (color.matches(HEX_FORM)) {
			return true;
		}

		// 17 standard colors; see http://www.w3schools.com/cssref/css_colornames.asp
		String[] standardColors = { "aqua", "black",
				"blue", "fuchsia", "gray", "green", "lime", "maroon", "navy", "olive",
				"orange", "purple", "red", "silver", "teal", "white", "yellow"};
		return Arrays.asList(standardColors).contains(color.toLowerCase()) ;
	}

}


text:
package com.kenai.jbosh;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

import org.apache.http.HttpHost;
import org.apache.http.HttpVersion;
import org.apache.http.client.HttpClient;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.params.ConnManagerParams;
import org.apache.http.conn.params.ConnRoutePNames;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpParams;
import org.apache.http.params.HttpProtocolParams;

/**
 * Implementation of the {@code HTTPSender} interface which uses the
 * Apache HttpClient API to send messages to the connection manager.
 */
final class ApacheHTTPSender implements HTTPSender {

    /**
     * Lock used for internal synchronization.
     */
    private final Lock lock = new ReentrantLock();

    /**
     * Session configuration.
     */
    private BOSHClientConfig cfg;

    /**
     * HttpClient instance to use to communicate.
     */
    private HttpClient httpClient;

    ///////////////////////////////////////////////////////////////////////////
    // Constructors:

    /**
     * Prevent construction apart from our package.
     */
    ApacheHTTPSender() {
        // Load Apache HTTP client class
        HttpClient.class.getName();
    }

    ///////////////////////////////////////////////////////////////////////////
    // HTTPSender interface methods:

    /**
     * {@inheritDoc}
     */
    public void init(final BOSHClientConfig session) {
        lock.lock();
        try {
            cfg = session;
            httpClient = initHttpClient(session);
        } finally {
            lock.unlock();
        }
    }

    /**
     * {@inheritDoc}
     */
    public void destroy() {
        lock.lock();
        try {
            if (httpClient != null) {
                httpClient.getConnectionManager().shutdown();
            }
        } finally {
            cfg = null;
            httpClient = null;
            lock.unlock();
        }
    }

    /**
     * {@inheritDoc}
     */
    public HTTPResponse send(
            final CMSessionParams params,
            final AbstractBody body) {
        HttpClient mClient;
        BOSHClientConfig mCfg;
        lock.lock();
        try {
            if (httpClient == null) {
                httpClient = initHttpClient(cfg);
            }
            mClient = httpClient;
            mCfg = cfg;
        } finally {
            lock.unlock();
        }
        return new ApacheHTTPResponse(mClient, mCfg, params, body);
    }

    ///////////////////////////////////////////////////////////////////////////
    // Package-private methods:

    private synchronized HttpClient initHttpClient(final BOSHClientConfig config) {
        // Create and initialize HTTP parameters
        HttpParams params = new BasicHttpParams();
        ConnManagerParams.setMaxTotalConnections(params, 100);
        HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
        HttpProtocolParams.setUseExpectContinue(params, false);
        if (config != null &&
                config.getProxyHost() != null &&
                config.getProxyPort() != 0) {
            HttpHost proxy = new HttpHost(
                    config.getProxyHost(),
                    config.getProxyPort());
            params.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
        }

        // Create and initialize scheme registry
        SchemeRegistry schemeRegistry = new SchemeRegistry();
        schemeRegistry.register(
                new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
            SSLSocketFactory sslFactory = SSLSocketFactory.getSocketFactory();
            sslFactory.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
            schemeRegistry.register(
                    new Scheme("https", sslFactory, 443));

        // Create an HttpClient with the ThreadSafeClientConnManager.
        // This connection manager must be used if more than one thread will
        // be using the HttpClient.
        ClientConnectionManager cm = new ThreadSafeClientConnManager(params, schemeRegistry);
        return new DefaultHttpClient(cm, params);
    }
}


text:
package org.apache.camel.component.google.secret.manager.integration;

import org.apache.camel.FailedToCreateRouteException;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit5.CamelTestSupport;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIfSystemProperties;
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;

import static org.junit.jupiter.api.Assertions.assertThrows;

// Must be manually tested. Provide your own accessKey and secretKey using -Dcamel.vault.gcp.serviceAccountKey and -Dcamel.vault.gcp.projectId
@EnabledIfSystemProperties({
        @EnabledIfSystemProperty(named = "camel.vault.gcp.serviceAccountKey", matches = ".*",
                                 disabledReason = "Service Account Key not provided"),
        @EnabledIfSystemProperty(named = "camel.vault.gcp.projectId", matches = ".*",
                                 disabledReason = "Project Id not provided")
})
public class GoogleSecretManagerPropertiesNoEnvSourceTestIT extends CamelTestSupport {

    @Test
    public void testFunction() throws Exception {
        context.getVaultConfiguration().gcp().setServiceAccountKey(System.getProperty("camel.vault.gcp.serviceAccountKey"));
        context.getVaultConfiguration().gcp().setProjectId(System.getProperty("camel.vault.gcp.projectId"));
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() {
                from("direct:start").setBody(simple("{{gcp:hello}}")).to("mock:bar");
            }
        });
        context.start();

        getMockEndpoint("mock:bar").expectedBodiesReceived("hello");

        template.sendBody("direct:start", "Hello World");

        assertMockEndpointsSatisfied();
    }

    @Test
    public void testComplexPropertiesFunction() throws Exception {
        context.getVaultConfiguration().gcp().setServiceAccountKey(System.getProperty("camel.vault.gcp.serviceAccountKey"));
        context.getVaultConfiguration().gcp().setProjectId(System.getProperty("camel.vault.gcp.projectId"));
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() {
                from("direct:username").setBody(simple("{{gcp:database_sample/username}}")).to("mock:bar");
                from("direct:password").setBody(simple("{{gcp:database_sample/password}}")).to("mock:bar");
            }
        });
        context.start();

        getMockEndpoint("mock:bar").expectedBodiesReceived("admin", "password123");

        template.sendBody("direct:username", "Hello World");
        template.sendBody("direct:password", "Hello World");
        assertMockEndpointsSatisfied();
    }

    @Test
    public void testComplexPropertiesWithDefaultFunction() throws Exception {
        context.getVaultConfiguration().gcp().setServiceAccountKey(System.getProperty("camel.vault.gcp.serviceAccountKey"));
        context.getVaultConfiguration().gcp().setProjectId(System.getProperty("camel.vault.gcp.projectId"));
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() {
                from("direct:username").setBody(simple("{{gcp:database_sample/username:oscerd}}")).to("mock:bar");
                from("direct:password").setBody(simple("{{gcp:database_sample/password:password}}")).to("mock:bar");
            }
        });
        context.start();

        getMockEndpoint("mock:bar").expectedBodiesReceived("admin", "password123");

        template.sendBody("direct:username", "Hello World");
        template.sendBody("direct:password", "Hello World");
        assertMockEndpointsSatisfied();
    }

    @Test
    public void testSecretNotFoundFunction() {
        context.getVaultConfiguration().gcp().setServiceAccountKey(System.getProperty("camel.vault.gcp.serviceAccountKey"));
        context.getVaultConfiguration().gcp().setProjectId(System.getProperty("camel.vault.gcp.projectId"));
        Exception exception = assertThrows(FailedToCreateRouteException.class, () -> {
            context.addRoutes(new RouteBuilder() {
                @Override
                public void configure() {
                    from("direct:start").setBody(simple("{{gcp:testExample}}")).to("mock:bar");
                }
            });
            context.start();

            getMockEndpoint("mock:bar").expectedBodiesReceived("hello");

            template.sendBody("direct:start", "Hello World");

            assertMockEndpointsSatisfied();
        });
    }

    @Test
    public void testComplexCustomPropertiesDefaultValueFunction() throws Exception {
        context.getVaultConfiguration().gcp().setServiceAccountKey(System.getProperty("camel.vault.gcp.serviceAccountKey"));
        context.getVaultConfiguration().gcp().setProjectId(System.getProperty("camel.vault.gcp.projectId"));
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() {
                from("direct:username").setBody(simple("{{gcp:postgresql/additional1:admin}}")).to("mock:bar");
                from("direct:password").setBody(simple("{{gcp:postgresql/additional2:secret}}")).to("mock:bar");
            }
        });
        context.start();

        getMockEndpoint("mock:bar").expectedBodiesReceived("admin", "secret");

        template.sendBody("direct:username", "Hello World");
        template.sendBody("direct:password", "Hello World");
        assertMockEndpointsSatisfied();
    }

    @Test
    public void testComplexCustomPropertiesDefaultValueExceptionFunction() throws Exception {
        context.getVaultConfiguration().gcp().setServiceAccountKey(System.getProperty("camel.vault.gcp.serviceAccountKey"));
        context.getVaultConfiguration().gcp().setProjectId(System.getProperty("camel.vault.gcp.projectId"));
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() {
                from("direct:username").setBody(simple("{{gcp:test-3/additional1:admin}}")).to("mock:bar");
                from("direct:password").setBody(simple("{{gcp:test-3/additional2:secret}}")).to("mock:bar");
            }
        });
        context.start();

        getMockEndpoint("mock:bar").expectedBodiesReceived("admin", "secret");

        template.sendBody("direct:username", "Hello World");
        template.sendBody("direct:password", "Hello World");
        assertMockEndpointsSatisfied();
    }

    @Test
    public void testComplexCustomPropertiesExceptionFunction() {
        context.getVaultConfiguration().gcp().setServiceAccountKey(System.getProperty("camel.vault.gcp.serviceAccountKey"));
        context.getVaultConfiguration().gcp().setProjectId(System.getProperty("camel.vault.gcp.projectId"));
        Exception exception = assertThrows(FailedToCreateRouteException.class, () -> {
            context.addRoutes(new RouteBuilder() {
                @Override
                public void configure() {
                    from("direct:username").setBody(simple("{{gcp:test-3/additional1}}")).to("mock:bar");
                    from("direct:password").setBody(simple("{{gcp:test-3/additional2}}")).to("mock:bar");
                }
            });
            context.start();

            getMockEndpoint("mock:bar").expectedBodiesReceived("admin", "secret");

            template.sendBody("direct:username", "Hello World");
            template.sendBody("direct:password", "Hello World");
            assertMockEndpointsSatisfied();
        });
    }

    @Test
    public void testComplexSimpleDefaultValueExceptionFunction() throws Exception {
        context.getVaultConfiguration().gcp().setServiceAccountKey(System.getProperty("camel.vault.gcp.serviceAccountKey"));
        context.getVaultConfiguration().gcp().setProjectId(System.getProperty("camel.vault.gcp.projectId"));
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() {
                from("direct:username").setBody(simple("{{gcp:test-3:admin}}")).to("mock:bar");
                from("direct:password").setBody(simple("{{gcp:test-1:secret}}")).to("mock:bar");
            }
        });
        context.start();

        getMockEndpoint("mock:bar").expectedBodiesReceived("admin", "secret");

        template.sendBody("direct:username", "Hello World");
        template.sendBody("direct:password", "Hello World");
        assertMockEndpointsSatisfied();
    }
}


text:
/**
 * Dumb functions
 */
// istanbul ignore next
var identity = function identity(arg) {
    return function () {
        return arg;
    };
};
// istanbul ignore next
var noop = function noop() {};

/**
 * Browser detection
 */
var isBrowser = typeof window !== 'undefined';

/**
 * Browser functions needed by router5
 */
var getBase = function getBase() {
    return window.location.pathname.replace(/\/$/, '');
};

var pushState = function pushState(state, title, path) {
    return window.history.pushState(state, title, path);
};

var replaceState = function replaceState(state, title, path) {
    return window.history.replaceState(state, title, path);
};

var addPopstateListener = function addPopstateListener(fn) {
    return window.addEventListener('popstate', fn);
};

var removePopstateListener = function removePopstateListener(fn) {
    return window.removeEventListener('popstate', fn);
};

var getLocation = function getLocation(opts) {
    var path = opts.useHash ? window.location.hash.replace(new RegExp('^#' + opts.hashPrefix), '') : window.location.pathname.replace(new RegExp('^' + opts.base), '');
    return (path || '/') + window.location.search;
};

var getState = function getState() {
    return window.history.state;
};

/**
 * Export browser object
 */
var browser = {};
if (isBrowser) {
    browser = { getBase: getBase, pushState: pushState, replaceState: replaceState, addPopstateListener: addPopstateListener, removePopstateListener: removePopstateListener, getLocation: getLocation, getState: getState };
} else {
    // istanbul ignore next
    browser = {
        getBase: identity(''),
        pushState: noop,
        replaceState: noop,
        addPopstateListener: noop,
        removePopstateListener: noop,
        getLocation: identity(''),
        getState: identity(null)
    };
}

export default browser;


text:
#ifndef JUCE_TOOLTIPWINDOW_H_INCLUDED
#define JUCE_TOOLTIPWINDOW_H_INCLUDED

//==============================================================================
/**
    A window that displays a pop-up tooltip when the mouse hovers over another component.

    To enable tooltips in your app, just create a single instance of a TooltipWindow
    object. Note that if you instantiate more than one instance of this class, you'll
    end up with multiple tooltips being shown!

    The TooltipWindow object will then stay invisible, waiting until the mouse
    hovers for the specified length of time - it will then see if it's currently
    over a component which implements the TooltipClient interface, and if so,
    it will make itself visible to show the tooltip in the appropriate place.

    @see TooltipClient, SettableTooltipClient
*/
class JUCE_API  TooltipWindow  : public Component,
                                 private Timer
{
public:
    //==============================================================================
    /** Creates a tooltip window.

        Make sure your app only creates one instance of this class, otherwise you'll
        get multiple overlaid tooltips appearing. The window will initially be invisible
        and will make itself visible when it needs to display a tip.

        To change the style of tooltips, see the LookAndFeel class for its tooltip
        methods.

        @param parentComponent  if set to 0, the TooltipWindow will appear on the desktop,
                                otherwise the tooltip will be added to the given parent
                                component.
        @param millisecondsBeforeTipAppears     the time for which the mouse has to stay still
                                                before a tooltip will be shown

        @see TooltipClient, LookAndFeel::drawTooltip, LookAndFeel::getTooltipSize
    */
    explicit TooltipWindow (Component* parentComponent = nullptr,
                            int millisecondsBeforeTipAppears = 700);

    /** Destructor. */
    ~TooltipWindow();

    //==============================================================================
    /** Changes the time before the tip appears.
        This lets you change the value that was set in the constructor.
    */
    void setMillisecondsBeforeTipAppears (int newTimeMs = 700) noexcept;

    /** Can be called to manually force a tip to be shown at a particular location. */
    void displayTip (Point<int> screenPosition, const String& text);

    /** Can be called to manually hide the tip if it's showing. */
    void hideTip();

    //==============================================================================
    /** A set of colour IDs to use to change the colour of various aspects of the tooltip.

        These constants can be used either via the Component::setColour(), or LookAndFeel::setColour()
        methods.

        @see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
    */
    enum ColourIds
    {
        backgroundColourId      = 0x1001b00,    /**< The colour to fill the background with. */
        textColourId            = 0x1001c00,    /**< The colour to use for the text. */
        outlineColourId         = 0x1001c10     /**< The colour to use to draw an outline around the tooltip. */
    };

    //==============================================================================
    /** This abstract base class is implemented by LookAndFeel classes to provide
        window drawing functionality.
    */
    struct JUCE_API  LookAndFeelMethods
    {
        virtual ~LookAndFeelMethods() {}

        virtual void getTooltipSize (const String& tipText, int& width, int& height) = 0;
        virtual void drawTooltip (Graphics&, const String& text, int width, int height) = 0;
    };

private:
    //==============================================================================
    int millisecondsBeforeTipAppears;
    Point<int> lastMousePos;
    int mouseClicks, mouseWheelMoves;
    unsigned int lastCompChangeTime, lastHideTime;
    Component* lastComponentUnderMouse;
    String tipShowing, lastTipUnderMouse;

    void paint (Graphics&) override;
    void mouseEnter (const MouseEvent&) override;
    void timerCallback() override;
    void updatePosition (const String&, Point<int>, const Rectangle<int>&);

    static String getTipFor (Component*);

    JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TooltipWindow)
};

#endif   // JUCE_TOOLTIPWINDOW_H_INCLUDED


text:
define([
  'jquery',
  'underscore',
  'backbone',

  'text!templates/tags/option_base_task.html',

], function($, _, Backbone, optionTemplate ){
  var ItemView = Backbone.View.extend({

      template: _.template( optionTemplate ),

      initialize:function(options){
          this.options = options;
      },

      render:function(){
        return this.template({ model: this.model.toJSON(), id: this.options.id });
      }
  });

  return ItemView;
});


text:
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.IO;
using IOPath = System.IO.Path;

internal class TemporaryDirectory : TemporaryFileSystemItem<DirectoryInfo>
{
    public TemporaryDirectory()
        : base(CreateTemporaryDirectoryInfo())
    {
    }

    protected override void Delete()
    {
        if (Directory.Exists(Path))
        {
            Directory.Delete(Path, true);
        }
    }

    private static DirectoryInfo CreateTemporaryDirectoryInfo()
    {
        string path = IOPath.Combine(TestInfo.CurrentDirectory, IOPath.GetRandomFileName());

        return Directory.CreateDirectory(path);
    }
}


text:
using System;
using System.IO;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using AM.Runtime;

using ManagedIrbis;
using ManagedIrbis.Infrastructure;

namespace UnitTests.ManagedIrbis
{
    [TestClass]
    public class IrbisConnectionTest
    {
        const string ConnectionString
            = "host=127.0.0.1;port=6666;user=1;password=1;";

        [TestMethod]
        public void TestIrbisConnection_Constructor()
        {
            using (IrbisConnection client = new IrbisConnection())
            {
                Assert.IsNotNull(client);
            }
        }

        private MarcRecord _GetRecord()
        {
            MarcRecord result = new MarcRecord();

            RecordField field = new RecordField("700");
            field.AddSubField('a', "Иванов");
            field.AddSubField('b', "И. И.");
            result.Fields.Add(field);

            field = new RecordField("701");
            field.AddSubField('a', "Петров");
            field.AddSubField('b', "П. П.");
            result.Fields.Add(field);

            field = new RecordField("200");
            field.AddSubField('a', "Заглавие");
            field.AddSubField('e', "подзаголовочное");
            field.AddSubField('f', "И. И. Иванов, П. П. Петров");
            result.Fields.Add(field);

            field = new RecordField("210");
            field.AddSubField('a', "Иркутск");
            field.AddSubField('d', "2016");
            result.Fields.Add(field);

            field = new RecordField("215");
            field.AddSubField('a', "123");
            result.Fields.Add(field);

            field = new RecordField("300", "Первое примечание");
            result.Fields.Add(field);
            field = new RecordField("300", "Второе примечание");
            result.Fields.Add(field);
            field = new RecordField("300", "Третье примечание");
            result.Fields.Add(field);

            field = new RecordField("920", "PAZK");
            result.Fields.Add(field);

            return result;
        }

        private void _TestSerialization
            (
                IrbisConnection first
            )
        {
            byte[] bytes = first.SaveToMemory();

            IrbisConnection second = bytes
                .RestoreObjectFromMemory<IrbisConnection>();

            Assert.IsNotNull(second);
        }

        [TestMethod]
        public void IrbisConnection_Serialization_1()
        {
            IrbisConnection client = new IrbisConnection();
            _TestSerialization(client);
        }

        [TestMethod]
        public void IrbisConnection_Clone_1()
        {
            IrbisConnection first = new IrbisConnection();
            first.ParseConnectionString(ConnectionString);

            IrbisConnection second = first.Clone(false);

            Assert.AreEqual (first.Host, second.Host);
            Assert.AreEqual(first.Port, second.Port);
            Assert.AreEqual(first.Username, second.Username);
            Assert.AreEqual(first.Password, second.Password);
            Assert.AreEqual(first.Database, second.Database);
            Assert.AreEqual(first.Workstation, second.Workstation);
        }

        [TestMethod]
        public void IrbisConnection_Clone_2()
        {
            IrbisConnection first = new IrbisConnection();
            first.ParseConnectionString(ConnectionString);

            IrbisConnection second = first.Clone();

            Assert.AreEqual(first.Host, second.Host);
            Assert.AreEqual(first.Port, second.Port);
            Assert.AreEqual(first.Username, second.Username);
            Assert.AreEqual(first.Password, second.Password);
            Assert.AreEqual(first.Database, second.Database);
            Assert.AreEqual(first.Workstation, second.Workstation);
        }

        [TestMethod]
        public void IrbisConnection_PushDatabase_1()
        {
            IrbisConnection connection = new IrbisConnection();
            connection.ParseConnectionString(ConnectionString);

            const string ibis = "IBIS";
            const string rdr = "RDR";

            Assert.AreEqual(ibis, connection.Database);
            Assert.AreEqual(ibis, connection.PushDatabase(rdr));
            Assert.AreEqual(rdr, connection.PopDatabase());
            Assert.AreEqual(ibis, connection.Database);
        }

        [TestMethod]
        [ExpectedException(typeof(FormatException))]
        public void IrbisConnection_Restore_Exception_1()
        {
            const string badState = "BAD_STATE";
            IrbisConnection.Restore(badState);
        }

        [TestMethod]
        [ExpectedException(typeof(EndOfStreamException))]
        public void IrbisConnection_Restore_Exception_2()
        {
            byte[] bytes = {0,0,0,0};
            string badState = Convert.ToBase64String(bytes);
            IrbisConnection.Restore(badState);
        }

        [TestMethod]
        public void IrbisConnection_Suspend_1()
        {
            IrbisConnection first = new IrbisConnection();
            first.ParseConnectionString(ConnectionString);

            string state = first.Suspend();
            Assert.IsNotNull(state);

            IrbisConnection second = IrbisConnection.Restore(state);

            Assert.AreEqual(first.Host, second.Host);
            Assert.AreEqual(first.Port, second.Port);
            Assert.AreEqual(first.Username, second.Username);
            Assert.AreEqual(first.Password, second.Password);
            Assert.AreEqual(first.Database, second.Database);
            Assert.AreEqual(first.Workstation, second.Workstation);
        }
    }
}


text:
namespace webui_generator {

ViewModel::ContextEditor::ContextEditor(ViewModel& view_model)
    : view_model_(view_model), context_(view_model_.context()) {
}

ViewModel::ContextEditor::~ContextEditor() {
  view_model_.CommitContextChanges();
}

const ViewModel::ContextEditor& ViewModel::ContextEditor::SetBoolean(
    const KeyType& key,
    bool value) const {
  context_.SetBoolean(key, value);
  return *this;
}

const ViewModel::ContextEditor& ViewModel::ContextEditor::SetInteger(
    const KeyType& key,
    int value) const {
  context_.SetInteger(key, value);
  return *this;
}

const ViewModel::ContextEditor& ViewModel::ContextEditor::SetDouble(
    const KeyType& key,
    double value) const {
  context_.SetDouble(key, value);
  return *this;
}

const ViewModel::ContextEditor& ViewModel::ContextEditor::SetString(
    const KeyType& key,
    const std::string& value) const {
  context_.SetString(key, value);
  return *this;
}

const ViewModel::ContextEditor& ViewModel::ContextEditor::SetString(
    const KeyType& key,
    const base::string16& value) const {
  context_.SetString(key, value);
  return *this;
}

const ViewModel::ContextEditor& ViewModel::ContextEditor::SetStringList(
    const KeyType& key,
    const StringList& value) const {
  context_.SetStringList(key, value);
  return *this;
}

const ViewModel::ContextEditor& ViewModel::ContextEditor::SetString16List(
    const KeyType& key,
    const String16List& value) const {
  context_.SetString16List(key, value);
  return *this;
}

ViewModel::ViewModel() : view_(nullptr) {
}

ViewModel::~ViewModel() {
}

void ViewModel::SetView(View* view) {
  view_ = view;
  Initialize();
}

void ViewModel::OnChildrenReady() {
  OnAfterChildrenReady();
  view_->OnViewModelReady();
}

void ViewModel::UpdateContext(const base::DictionaryValue& diff) {
  std::vector<std::string> changed_keys;
  context_.ApplyChanges(diff, &changed_keys);
  OnContextChanged(changed_keys);
}

void ViewModel::OnEvent(const std::string& event) {
}

ViewModel::ContextEditor ViewModel::GetContextEditor() {
  return ContextEditor(*this);
}

void ViewModel::CommitContextChanges() {
  if (!context().HasChanges())
    return;

  base::DictionaryValue diff;
  context().GetChangesAndReset(&diff);
  view_->OnContextChanged(diff);
}

}  // namespace webui_generator


text:
<!DOCTYPE html>

    <meta charset="UTF-8">

    <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
    <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap-theme.min.css">

    <title>Simple example</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

<button data-target="#us6-dialog" data-toggle="modal">Click hear to open dialog</button>

                <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>

Modal title

                        Location:

<input type="text" class="form-control" id="us3-address"/>

                        Radius:

<input type="text" class="form-control" id="us3-radius"/>

                        Lat.:

<input type="text" class="form-control" style="width: 110px" id="us3-lat"/>

                        Long.:

<input type="text" class="form-control" style="width: 110px" id="us3-lon"/>

                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary">Save changes</button>


text:
"use strict";

/**
 * @param { import("../lib/css-analyzer") } analyzer
 */
function rule(analyzer) {
  analyzer.setMetric("imports");

  analyzer.on("import", function (url) {
    analyzer.incrMetric("imports");
    analyzer.addOffender("imports", url);
  });
}

rule.description = "Number of @import rules";
module.exports = rule;


text:
all: report2.pdf

report2.pdf: report2.Rmd
		Rscript -e 'rmarkdown::render("report2.Rmd", output_format="all")'

clean:
		rm report2.pdf

view:
		open report2.pdf


text:
#include <androidfw/AttributeFinder.h>

#include <gtest/gtest.h>

using android::BackTrackingAttributeFinder;

class MockAttributeFinder : public BackTrackingAttributeFinder<MockAttributeFinder, int> {
public:
    MockAttributeFinder(const uint32_t* attrs, int len)
        : BackTrackingAttributeFinder(0, len) {
        mAttrs = new uint32_t[len];
        memcpy(mAttrs, attrs, sizeof(*attrs) * len);
    }

    ~MockAttributeFinder() {
        delete mAttrs;
    }

    inline uint32_t getAttribute(const int index) const {
        return mAttrs[index];
    }

private:
    uint32_t* mAttrs;
};

static const uint32_t sortedAttributes[] = {
        0x01010000, 0x01010001, 0x01010002, 0x01010004,
        0x02010001, 0x02010010, 0x7f010001
};

static const uint32_t packageUnsortedAttributes[] = {
        0x02010001, 0x02010010, 0x01010000, 0x01010001,
        0x01010002, 0x01010004, 0x7f010001
};

static const uint32_t singlePackageAttributes[] = {
        0x7f010007, 0x7f01000a, 0x7f01000d, 0x00000000
};

TEST(AttributeFinderTest, IteratesSequentially) {
    const int end = sizeof(sortedAttributes) / sizeof(*sortedAttributes);
    MockAttributeFinder finder(sortedAttributes, end);

    EXPECT_EQ(0, finder.find(0x01010000));
    EXPECT_EQ(1, finder.find(0x01010001));
    EXPECT_EQ(2, finder.find(0x01010002));
    EXPECT_EQ(3, finder.find(0x01010004));
    EXPECT_EQ(4, finder.find(0x02010001));
    EXPECT_EQ(5, finder.find(0x02010010));
    EXPECT_EQ(6, finder.find(0x7f010001));
    EXPECT_EQ(end, finder.find(0x7f010002));
}

TEST(AttributeFinderTest, PackagesAreOutOfOrder) {
    const int end = sizeof(sortedAttributes) / sizeof(*sortedAttributes);
    MockAttributeFinder finder(sortedAttributes, end);

    EXPECT_EQ(6, finder.find(0x7f010001));
    EXPECT_EQ(end, finder.find(0x7f010002));
    EXPECT_EQ(4, finder.find(0x02010001));
    EXPECT_EQ(5, finder.find(0x02010010));
    EXPECT_EQ(0, finder.find(0x01010000));
    EXPECT_EQ(1, finder.find(0x01010001));
    EXPECT_EQ(2, finder.find(0x01010002));
    EXPECT_EQ(3, finder.find(0x01010004));
}

TEST(AttributeFinderTest, SomeAttributesAreNotFound) {
    const int end = sizeof(sortedAttributes) / sizeof(*sortedAttributes);
    MockAttributeFinder finder(sortedAttributes, end);

    EXPECT_EQ(0, finder.find(0x01010000));
    EXPECT_EQ(1, finder.find(0x01010001));
    EXPECT_EQ(2, finder.find(0x01010002));
    EXPECT_EQ(end, finder.find(0x01010003));
    EXPECT_EQ(3, finder.find(0x01010004));
    EXPECT_EQ(end, finder.find(0x01010005));
    EXPECT_EQ(end, finder.find(0x01010006));
    EXPECT_EQ(4, finder.find(0x02010001));
    EXPECT_EQ(end, finder.find(0x02010002));
}

TEST(AttributeFinderTest, FindAttributesInPackageUnsortedAttributeList) {
    const int end = sizeof(packageUnsortedAttributes) / sizeof(*packageUnsortedAttributes);
    MockAttributeFinder finder(packageUnsortedAttributes, end);

    EXPECT_EQ(2, finder.find(0x01010000));
    EXPECT_EQ(3, finder.find(0x01010001));
    EXPECT_EQ(4, finder.find(0x01010002));
    EXPECT_EQ(end, finder.find(0x01010003));
    EXPECT_EQ(5, finder.find(0x01010004));
    EXPECT_EQ(end, finder.find(0x01010005));
    EXPECT_EQ(end, finder.find(0x01010006));
    EXPECT_EQ(0, finder.find(0x02010001));
    EXPECT_EQ(end, finder.find(0x02010002));
    EXPECT_EQ(1, finder.find(0x02010010));
    EXPECT_EQ(6, finder.find(0x7f010001));
}

TEST(AttributeFinderTest, FindAttributesInSinglePackageAttributeList) {
    const int end = sizeof(singlePackageAttributes) / sizeof(*singlePackageAttributes);
    MockAttributeFinder finder(singlePackageAttributes, end);

    EXPECT_EQ(end, finder.find(0x010100f4));
    EXPECT_EQ(end, finder.find(0x010100f5));
    EXPECT_EQ(end, finder.find(0x010100f6));
    EXPECT_EQ(end, finder.find(0x010100f7));
    EXPECT_EQ(end, finder.find(0x010100f8));
    EXPECT_EQ(end, finder.find(0x010100fa));
    EXPECT_EQ(0, finder.find(0x7f010007));
}


text:
using WinDriver.Domain;

namespace WinDriver.Dto
{
    public class WebDriverResponse
    {
        public WebDriverResponse()
        {
        }

        public WebDriverResponse(Session session)
        {
            SessionId = session.SessionId.ToString("N");
        }

        public string SessionId { get; set; }

        public int Status { get; set; }

        public object Value { get; set; }
    }
}


text:
package info.dourok.compiler;

import android.os.Bundle;
import android.os.Parcelable;
import java.io.Serializable;
import java.util.ArrayList;
import javax.annotation.processing.Filer;
import javax.annotation.processing.Messager;
import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.Element;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
import javax.tools.Diagnostic;

/**
 * @author tiaolins
 * @date 2017/8/30
 */
public class EasyUtils {
  private Filer filer;
  private Messager messager;
  private Types types;
  private Elements elements;
  private TypeMirror string;
  private TypeMirror charSequence;
  private TypeMirror bundle;
  private TypeMirror arrayList;
  private TypeMirror parcelable;
  private TypeMirror serializable;

  private static final EasyUtils S_INSTANCE = new EasyUtils();

  public static EasyUtils getInstance() {
    return S_INSTANCE;
  }

  public void init(ProcessingEnvironment processingEnvironment) {
    filer = processingEnvironment.getFiler();
    messager = processingEnvironment.getMessager();
    types = processingEnvironment.getTypeUtils();
    elements = processingEnvironment.getElementUtils();

    string = elements.getTypeElement(String.class.getName()).asType();
    charSequence = elements.getTypeElement(CharSequence.class.getName()).asType();
    bundle = elements.getTypeElement(Bundle.class.getName()).asType();
    arrayList = elements.getTypeElement(ArrayList.class.getName()).asType();
    parcelable = elements.getTypeElement(Parcelable.class.getName()).asType();
    serializable = elements.getTypeElement(Serializable.class.getName()).asType();
  }

  public static Types getTypes() {
    return S_INSTANCE.types;
  }

  public static Elements getElements() {
    return S_INSTANCE.elements;
  }

  public static boolean isString(TypeMirror mirror) {
    return S_INSTANCE.types.isSameType(mirror, S_INSTANCE.string);
  }

  public static boolean isCharSequence(TypeMirror mirror) {
    return S_INSTANCE.types.isSameType(mirror, S_INSTANCE.charSequence);
  }

  public static boolean isBundle(TypeMirror mirror) {
    return S_INSTANCE.types.isSameType(mirror, S_INSTANCE.bundle);
  }

  public static boolean isArrayList(TypeMirror mirror) {
    // XXX 类型擦除后的 ArrayList<T> 类不能等价于 ArrayList,所以不能用 isSame 判断
    return S_INSTANCE.types.isAssignable(getTypes().erasure(mirror), S_INSTANCE.arrayList);
  }

  /** @param same 是 Parcelable 本身,还是 Parcelable 的子类 */
  public static boolean isParcelable(TypeMirror mirror, boolean same) {
    if (same) {
      return S_INSTANCE.types.isSameType(mirror, S_INSTANCE.parcelable);
    } else {
      return S_INSTANCE.types.isAssignable(mirror, S_INSTANCE.parcelable);
    }
  }

  public static boolean isSerializable(TypeMirror mirror, boolean same) {
    if (same) {
      return S_INSTANCE.types.isSameType(mirror, S_INSTANCE.serializable);
    } else {
      return S_INSTANCE.types.isAssignable(mirror, S_INSTANCE.serializable);
    }
  }

  public static void log(String msg) {
    S_INSTANCE.messager.printMessage(Diagnostic.Kind.NOTE, msg);
  }

  public static void log(String msg, Element element) {
    S_INSTANCE.messager.printMessage(Diagnostic.Kind.NOTE, msg, element);
  }

  public static void warn(String msg) {
    S_INSTANCE.messager.printMessage(Diagnostic.Kind.WARNING, msg);
  }

  public static void warn(String msg, Element element) {
    S_INSTANCE.messager.printMessage(Diagnostic.Kind.WARNING, msg, element);
  }

  public static void error(String msg) {
    S_INSTANCE.messager.printMessage(Diagnostic.Kind.ERROR, msg);
  }

  public static void error(String msg, Element element) {
    S_INSTANCE.messager.printMessage(Diagnostic.Kind.ERROR, msg, element);
  }

  public static String capitalize(String s) {
    if (s.length() == 0) {
      return s;
    }
    return s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase();
  }

  public static Filer getFiler() {
    return S_INSTANCE.filer;
  }
}


text:
If you're new to this library, you may need a few pointers of where to look for features:

  * [`Prelude`](Prelude) is a
    `static partial class`, this type is loaded with functions for constructing the key data types, as well
    as many of the things you'd expect in a functional programming language's prelude.  Note, the `Prelude` type
    extends into many other parts of the source-tree.  It's the same type, but spread all over the code-base.
    And so, you may see `Prelude` in other areas of the documentation: it's the same type.

    Because it's so fundamental, you'll want to add this to the top of every code file:

        using static LanguageExt.Prelude;

    This makes all of the functions in the `Prelude` available as though they were local.
  * [`Monads`](Monads) contains the common monads like `Option<A>` and `Either<L, R>`, as well as state-managing monads like `Reader`, `Writer`, and `State`.
  * [`Immutable Collections`](Immutable%20Collections) contains the high-performance functional collection types this library is famous for.
  * [`Effects`](Effects) is where the pure IO functionality of language-ext resides.  It is also where you'll find
    the `Pipes` compositional streaming functionality.  To understand more about how to deal with side-effects,
    [check the wiki](https://github.com/louthy/language-ext/wiki/How-to-deal-with-side-effects).
  * [`Concurrency`](Concurrency) is where you'll find lots of help in atomically managing shared data without locks.


text:
A collection of scripts I use for hacky tasks, published here in the hope that you may find them useful as well! (maybe, maybe not)

## `update-transmission-ip`
Usage: `update-transmission-ip [interface]`

where _[interface]_ is the network interface you want Transmission
to listen on (e.g. eth0, wlan0, ens3, tun0.) Calling with no parameters
prints a small help screen.

Intended to be called by a cron job to ensure that the IP address
is updated in the Transmission config file if the interface IP
address changes (every minute, or 5 minutes, as you prefer).
This assumes that you're using the GTK Transmission client.

Currently ONLY updates the IPv4 address (it's all I need right now,
feel free to to add it and send a pull request!)


text:
#import "RCTPicker.h"

#import "RCTConvert.h"
#import "RCTEventDispatcher.h"
#import "RCTUtils.h"
#import "UIView+React.h"

const NSInteger UNINITIALIZED_INDEX = -1;

@interface RCTPicker() <UIPickerViewDataSource, UIPickerViewDelegate>

@end

@implementation RCTPicker
{
  RCTEventDispatcher *_eventDispatcher;
  NSArray *_items;
  NSInteger _selectedIndex;
}

- (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher
{
  RCTAssertParam(eventDispatcher);

  if ((self = [super initWithFrame:CGRectZero])) {
    _eventDispatcher = eventDispatcher;
    _selectedIndex = UNINITIALIZED_INDEX;
    self.delegate = self;
  }
  return self;
}

RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)

- (void)setItems:(NSArray *)items
{
  _items = [items copy];
  [self setNeedsLayout];
}

- (void)setSelectedIndex:(NSInteger)selectedIndex
{
  if (_selectedIndex != selectedIndex) {
    BOOL animated = _selectedIndex != UNINITIALIZED_INDEX; // Don't animate the initial value
    _selectedIndex = selectedIndex;
    dispatch_async(dispatch_get_main_queue(), ^{
      [self selectRow:selectedIndex inComponent:0 animated:animated];
    });
  }
}

#pragma mark - UIPickerViewDataSource protocol

- (NSInteger)numberOfComponentsInPickerView:(__unused UIPickerView *)pickerView
{
  return 1;
}

- (NSInteger)pickerView:(__unused UIPickerView *)pickerView
numberOfRowsInComponent:(__unused NSInteger)component
{
  return _items.count;
}

#pragma mark - UIPickerViewDelegate methods

- (NSDictionary *)itemForRow:(NSInteger)row
{
  return _items[row];
}

- (id)valueForRow:(NSInteger)row
{
  return [self itemForRow:row][@"value"];
}

- (NSString *)pickerView:(__unused UIPickerView *)pickerView
             titleForRow:(NSInteger)row forComponent:(__unused NSInteger)component
{
  return [self itemForRow:row][@"label"];
}

- (void)pickerView:(__unused UIPickerView *)pickerView
      didSelectRow:(NSInteger)row inComponent:(__unused NSInteger)component
{
  _selectedIndex = row;
  NSDictionary *event = @{
    @"target": self.reactTag,
    @"newIndex": @(row),
    @"newValue": [self valueForRow:row]
  };

  [_eventDispatcher sendInputEventWithName:@"change" body:event];
}

@end


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <meta name="description" content="1st choice restoration">
    <meta name="author" content="Marco Cirillo">
    <link rel="icon" href="favicon.ico">

    <title>1st Choice Restoration</title>

    <link href="//maxcdn.bootstrapcdn.com/bootswatch/3.3.4/lumen/bootstrap.min.css" rel="stylesheet">

    <link href="dist/css/screen.css" rel="stylesheet">

            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                Toggle navigation

            </button>
            1st Choice Restoration

Fire Damage

Flood Damage

Wind Damage

Insurance Claims

Contact

905-264-9111

its a restoration company, fire, flood, wind damages for insurance claims

            Contact Us »

Why Choose 1st Choice Restoration?

Fire Damage

                Lorem Ipsum is simply dummy text of the printing and typesetting industry.
                Lorem Ipsum has been the industry's standard dummy text ever since the 1500s

Flood Damage

                Lorem Ipsum is simply dummy text of the printing and typesetting industry.
                Lorem Ipsum has been the industry's standard dummy text ever since the 1500s

Wind Damage

                Lorem Ipsum is simply dummy text of the printing and typesetting industry.
                Lorem Ipsum has been the industry's standard dummy text ever since the 1500s

Insurance Claims

                This one is here because it's good for SEO. Speaking of which, I need a description and keywords

Contact Us

Enter your email and a message and we will get back to you as soon as possible.

            foxyform

1st Choice Restoration

905-264-9111

Made with ♥ by Marco Cirillo


text:
layout: post
title: "Writing is hard"
---

What? It is! It really is!


text:
> Show a set of photos with latitude & longitude on a map

## Build Setup

``` bash
# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

# build for production and view the bundle analyzer report
npm run build --report
```


text:
import numpy as np
from glumpy import app, gl, gloo, glm
from glumpy.transforms import Trackball

vertex = """
#include "math/constants.glsl"

uniform float linewidth;
uniform float antialias;

attribute vec4  fg_color;
attribute vec4  bg_color;
attribute float size;
attribute vec3  position;
attribute float id;

varying vec4  v_id;
varying float v_size;
varying vec4  v_fg_color;
varying vec4  v_bg_color;
void main (void)
{
    // id to vec3 (alpha must be one or color will be blended
    v_id = vec4 ( mod(floor(id / (256*256)), 256) / 255.0,
                  mod(floor(id /     (256)), 256) / 255.0,
                  mod(floor(id /       (1)), 256) / 255.0,
                  1.0 );
    v_size = size;
    v_fg_color = fg_color;
    v_bg_color = bg_color;
    gl_Position = <transform(vec4(position,1.0))>;
    gl_PointSize = M_SQRT2 * size + 2.0 * (linewidth + 1.5*antialias);
}
"""

fragment = """
#include "markers/disc.glsl"
#include "math/constants.glsl"
#include "antialias/antialias.glsl"

uniform float linewidth;
uniform float antialias;

varying vec4  v_id;
varying float v_size;
varying vec4  v_fg_color;
varying vec4  v_bg_color;

void main()
{
    vec2 P = gl_PointCoord.xy - vec2(0.5,0.5);
    float point_size = M_SQRT2*v_size  + 2 * (linewidth + 1.5*antialias);
    float distance = marker_disc(P*point_size, v_size);
    vec4 color = outline(distance, linewidth, antialias, v_fg_color, v_bg_color);
    gl_FragData[0] = color;
    gl_FragData[1] = v_id;
}
"""

quad_vertex = """
attribute vec2 position;
varying vec2 v_texcoord;
void main(void)
{
    gl_Position = vec4(position,0,1);
    v_texcoord = (position+1.0)/2.0;
}"""

quad_fragment = """
uniform sampler2D color;
varying vec2 v_texcoord;
void main(void)
{
    gl_FragColor = texture2D(color,v_texcoord);
}
"""

window = app.Window(width=1000, height=1000, color=(1,1,1,1))

n = 5000
program = gloo.Program(vertex, fragment, count=n)
program['position'] = 0.75 * np.random.randn(n,3)
program['size']     = np.random.uniform(20,30,n)
program['fg_color'] = 0,0,0,1
program['bg_color'] = np.random.uniform(0.75, 1.00, (n, 4))
program['bg_color'][:,3] = 1
program['linewidth'] = 1.0
program['antialias'] = 1.0
program['transform'] = Trackball()
program["id"] = np.arange(n,dtype=np.float32)

quad = gloo.Program(quad_vertex, quad_fragment, count=4)
quad['position']= [(-1,-1), (-1,1), (1,-1), (1,1)]

color = np.zeros((window.height,window.width,4),np.ubyte).view(gloo.Texture2D)
color.interpolation = gl.GL_LINEAR
pick = np.zeros((window.height,window.width,4),np.ubyte).view(gloo.Texture2D)
pick.interpolation = gl.GL_LINEAR
framebuffer = gloo.FrameBuffer(color=[color,pick],
                               depth=gloo.DepthBuffer(window.width, window.height))
quad["color"] = color

index = 0
mouse = 0,0

@window.event
def on_draw(dt):
    gl.glEnable(gl.GL_DEPTH_TEST)

    framebuffer.activate()
    window.clear()
    program.draw(gl.GL_POINTS)
    if mouse is not None:
        gl.glReadBuffer(gl.GL_COLOR_ATTACHMENT1, gl.GL_FRONT)
        r,g,b,a = gl.glReadPixels(mouse[0],mouse[1],1,1, gl.GL_RGBA, gl.GL_UNSIGNED_BYTE)
        if type(r) is not int: r = ord(r)
        if type(g) is not int: g = ord(g)
        if type(b) is not int: b = ord(b)
        index = b + 256*g + 256*256*r
        if index < len(program):
            program["bg_color"][index] = 0,0,0,1
    framebuffer.deactivate()
    gl.glDisable(gl.GL_DEPTH_TEST)
    quad.draw(gl.GL_TRIANGLE_STRIP)

@window.event
def on_resize(width, height):
    framebuffer.resize(width,height)
    quad["color"] = framebuffer.color[0]

@window.event
def on_mouse_motion(x, y, dx, dy):
    global mouse
    mouse = int(x), window.height-int(y)

@window.event
def on_mouse_drag(x, y, dx, dy, button):
    global mouse
    mouse = int(x), window.height-int(y)

window.attach(program['transform'])
app.run()


text:
static double subtractTimes(uint64_t start, uint64_t end)
{
    static double conversion = 0.0;
    uint64_t elapsed = end - start;

    if (start > end) {
        printf ("Error: start > end \n");
        return -1.0f;
    }

    if(conversion == 0.0)
    {
        mach_timebase_info_data_t info;
        kern_return_t __error = mach_timebase_info(&info); //Convert the timebaseinto seconds

        if(__error != KERN_SUCCESS)
        {
            printf ("Error: mach_timebase_info failed\n");
            return -1.0f;
        }
        conversion = 1e-6 * (double) info.numer / (double) info.denom;
    }
    return conversion * (double)elapsed; // ms
}

//???: 通过Block形式 计算,同样的操作比 model 形式 损耗 20% 左右
double bmOperateConsumeCalculate (OperateConsumeBlock operation)
{
    uint64_t start = mach_absolute_time ();
    operation();
    uint64_t end = mach_absolute_time ();
    return subtractTimes(start, end);
}

@implementation BMTimeCalculateModel

- (instancetype)initWithTitle:(NSString *)title {
    if (self = [super init]) {
        _title = title;
    }
    return self;
}
+ (instancetype)initWithTitle:(NSString *)title {
    return [[BMTimeCalculateModel alloc]initWithTitle:title];
}
@end

@implementation BMTimeCalculate

//输出单位毫秒(ms)、精确度微秒(μs)
+ (void)startCalculate:(BMTimeCalculateModel *)model {
    model.startTime = mach_absolute_time(); // ns
    NSLog(@"%@ - 开始时间 - %llu", model.title, model.startTime/1000); // μs
}

+ (void)endCalculate:(BMTimeCalculateModel *)model {
    model.endTime = mach_absolute_time(); // ns
    model.elapsedTime = subtractTimes(model.startTime, model.endTime);
    NSLog(@"%@ - 结束时间 - %llu", model.title, model.endTime/1000); // μs
    NSLog(@"%@ - 时间消耗 - %.3f ms", model.title, model.elapsedTime);
}

@end


text:
<?xml version="1.0" encoding="utf-8"?><!--
  Copyright 2017 Zhihu Inc.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

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

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->
<resources>
    <string name="album_name_all">全部</string>

    <string name="button_preview">预览</string>
    <string name="button_apply_default">使用</string>
    <string name="button_apply">使用(%1$d)</string>
    <string name="button_back">返回</string>
    <string name="photo_grid_capture">拍一张</string>
    <string name="empty_text">还没有图片或视频</string>
    <string name="button_ok">我知道了</string>
    <string name="nocamera">没有发现拍照设备</string>
    <string name="captureimgerror">创建拍照缓存文件失败</string>

    <string name="error_over_count_default">您已经达到最大选择数量</string>
    <string name="error_over_count">最多只能选择 %1$d 个文件</string>
    <string name="error_under_quality">图片质量太低</string>
    <string name="error_over_quality">图片质量太高</string>
    <string name="error_file_type">不支持的文件类型</string>
    <string name="error_type_conflict">不能同时选择图片和视频</string>
    <string name="error_no_video_activity">没有支持视频预览的应用</string>
    <string name="error_gif">长宽不小于 %1$dpx,且大小不超过 %2$sM。</string>
    <plurals name="error_over_count">
        <item quantity="one">可以选择不超过%1$d文件</item>
        <item quantity="few">可以选择不超过%1$d文件</item>
        <item quantity="many">可以选择不超过%1$d文件</item>
        <item quantity="other">可以选择不超过%1$d文件</item>
    </plurals>
</resources>


text:
require_relative "instance_var_persistence"

require "benchmark"

module StrictMachine
  module MountStateMachine
    module InstanceMethods
      include InstanceVarPersistence

      def trigger(*transitions)
        transitions.map { |t| change_state(t, state) }

        true
      end

      def state
        write_initial_state if current_state_attr_value.nil?

        current_state_attr_value
      end

      def state_attr
        self.class.strict_machine_attr.to_s
      end

      def states
        definition.states
      end

      private

      def definition
        self.class.strict_machine_class.definition
      end

      def change_state(trigger, current_state_name)
        new_state = nil

        duration = Benchmark.measure do
          is_bang, transition = current_state_obj.get_transition(trigger)

          if transition.guarded? && !is_bang
            raise GuardedTransitionError unless public_send(transition.guard)
          end

          new_state = definition.get_state_by_name(transition.to)
          new_state.run_on_entries(self, current_state_name, trigger.to_sym)
        end.real

        definition.run_transitions(
          self, current_state_name, new_state.name, trigger.to_sym, duration
        )

        write_state(new_state.name)
      end

      def current_state_obj
        definition.get_state_by_name(current_state_attr_value)
      end
    end
  end
end


text:
title: 'Chocolate & Zucchini & Google'
author: lbjay
layout: post
permalink: /2007/06/05/chocolate-zucchini-google/
categories:
  - Food 2.0
---
<abbr class="unapi-id" title=""><!--   --></abbr>

Do you work at Google? I think I’m beginning to hate you. In addition to all the [other][1] [well][2] [documented][3] [perks][4], you also get guest speakers on campus, like Clotilde Dusoulier? It’s just really starting to feel unfair, as though you’re just rubbing our noses in it.

 [1]: http://glinden.blogspot.com/2004/10/googles-perks.html
 [2]: http://www.sfgate.com/cgi-bin/article.cgi?file=/c/a/2005/12/18/GOOGLE.TMP
 [3]: http://www.kineda.com/working-for-google-is-like-not-working-at-all/
 [4]: http://www.google.com/support/jobs/bin/static.py?page=benefits.html


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="1/ninja-slider.css" rel="stylesheet" type="text/css" />

    <meta name="description" content="">
    <meta name="author" content="">

    <title>Small Business - Start Bootstrap Template</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">

    <link href="css/small-business.css" rel="stylesheet">

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    Toggle navigation

                </button>

                        Home

                        Diet

                        Reproduction

                        Gallery

                        Habitat

                Behaviour

Malayan tiger

Himalayan tiger

Indochinese tiger

Bengal tiger

Copyright © BMS 2014