text:
<?php
/**
 * Message translations.
 *
 * This file is automatically generated by 'yii message' command.
 * It contains the localizable messages extracted from source code.
 * You may modify this file by translating the extracted messages.
 *
 * Each array element represents the translation (value) of a message (key).
 * If the value is empty, the message is considered as not translated.
 * Messages that no longer need translation will have their translations
 * enclosed between a pair of '@@' marks.
 *
 * Message string can be used with plural forms format. Check i18n section
 * of the guide for details.
 *
 * NOTE: this file must be saved in UTF-8 encoding.
 */
return [
    '"{attribute}" must be a valid JSON' => '"{attribute}" должен содержать валидный JSON',
    'Down to maintenance.' => 'Закрыто на обслуживание',
    'Active' => 'Активно',
    'Administrator' => 'Администратор',
    'Article ID' => 'ID Статьи',
    'Author' => 'Автор',
    'Body' => 'Текст',
    'Caption' => 'Текст',
    'Carousel ID' => 'ID карусели',
    'Category' => 'Категория',
    'Comment' => 'Комментарий',
    'Config' => 'Настройки',
    'Created At' => 'Создано',
    'Created at' => 'Создано',
    'Deleted' => 'Удалено',
    'E-mail' => 'E-mail',
    'Firstname' => 'Имя',
    'Gender' => 'Пол',
    'ID' => 'ID',
    'Key' => 'Ключ',
    'Lastname' => 'Фамилия',
    'Locale' => 'Локаль',
    'Manager' => 'Менеджер',
    'Middlename' => 'Отчество',
    'Order' => 'Порядок',
    'Parent Category' => 'Родительская категория',
    'Path' => 'Путь',
    'Picture' => 'Аватар',
    'Published' => 'Опубликовано',
    'Published At' => 'Дата публикации',
    'Role' => 'Роль',
    'Slug' => 'ЧПУ',
    'Status' => 'Статус',
    'Title' => 'Название',
    'Updated At' => 'Обновлено',
    'Updater' => 'Обновивщий',
    'Url' => 'Url',
    'User' => 'Пользователь',
    'User ID' => 'ID пользователя',
    'Username' => 'Имя пользователя',
    'Value' => 'Значение',
];


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:osgi="http://www.eclipse.org/gemini/blueprint/schema/blueprint"
       xmlns:security="http://www.springframework.org/schema/security"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
       http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
       http://www.eclipse.org/gemini/blueprint/schema/blueprint http://www.eclipse.org/gemini/blueprint/schema/blueprint/gemini-blueprint.xsd
       http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">

    <mvc:annotation-driven/>
    <context:annotation-config/>
    <tx:annotation-driven transaction-manager="transactionManager"/>
    <security:global-method-security pre-post-annotations="enabled" proxy-target-class="true"/>

    <context:component-scan base-package="org.motechproject.email"/>

    <bean id="emailSettings" class="org.motechproject.server.config.SettingsFacade" autowire="byType">
        <property name="configFiles">
            <list>
                <value>classpath:motech-email.properties</value>
            </list>
        </property>
        <property name="rawConfigFiles">
            <list>
                <value>classpath:motech-email-additional.properties</value>
            </list>
        </property>
    </bean>

    <bean id="motechEmailProperties" factory-bean="emailSettings" factory-method="getProperties">
        <constructor-arg name="filename" value="motech-email.properties"/>
    </bean>

    <bean id="settingsDto" class="org.motechproject.email.settings.SettingsDto" autowire="byType">
        <constructor-arg name="settingsFacade" value="#{emailSettings}" />
    </bean>

    <bean id="motechEmailAdditionalProperties" factory-bean="settingsDto" factory-method="getAdditionalProps">
    </bean>

    <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
        <property name="host" value="#{motechEmailProperties['mail.host']}" />
        <property name="port" value="#{motechEmailProperties['mail.port']}" />
        <property name="username" value="#{motechEmailProperties['mail.username']}" />
        <property name="password" value="#{motechEmailProperties['mail.password']}" />
        <property name="javaMailProperties" value="#{motechEmailAdditionalProperties}" />
    </bean>

    <bean id="moduleRegistrationData" class="org.motechproject.osgi.web.ModuleRegistrationData">
        <constructor-arg name="url" value="../email/resources/index.html"/>
        <constructor-arg name="moduleName" value="email"/>
        <constructor-arg name="angularModules">
            <list>
                <value>email</value>
            </list>
        </constructor-arg>
        <constructor-arg name="i18n">
            <map>
                <entry key="messages" value="../email/resources/messages/"/>
            </map>
        </constructor-arg>
        <property name="roleForAccess">
            <list>
                <value>viewBasicEmailLogs</value>
                <value>viewDetailedEmailLogs</value>
            </list>
        </property>
        <property name="settingsURL" value="/email/settings" />
        <property name="defaultURL" value="/email/send"/>
    </bean>

    <osgi:service ref="emailSenderService"
                  interface="org.motechproject.email.service.EmailSenderService"
                  auto-export="interfaces"/>

    <osgi:service ref="emailAuditService"
                  interface="org.motechproject.email.service.EmailAuditService"
                  auto-export="interfaces"/>

    <osgi:reference id="configurationServiceOsgi"
                    interface="org.motechproject.config.service.ConfigurationService">
        <osgi:reference-listener ref="emailPurger"/>
    </osgi:reference>

    <osgi:reference id="emailRecordService" interface="org.motechproject.email.service.EmailRecordService"/>

    <osgi:reference id="transactionManager" interface="org.springframework.transaction.PlatformTransactionManager" context-class-loader="unmanaged"/>

</beans>

redpajama_set_name: RedPajamaGithub


text:
FRPDemo
=======

Demonstration of FRP


text:
<?php
/**
 * Created by PhpStorm.
 * User: steve
 * Date: 24/03/17
 * Time: 11:31
 */

namespace Eukles\Util;

use ArrayAccess;
use Iterator;
use PHPUnit\Framework\TestCase;

class DataIteratorTest extends TestCase
{

    public function testCanAddAndReadData()
    {
        $d = new DataIterator();
        $d["key"] = "value";
        $this->assertTrue($d["key"] === "value");
    }

    public function testIsArrayAccess()
    {
        $d = new DataIterator();
        $this->assertTrue($d instanceof ArrayAccess);
    }

    public function testIsIterator()
    {
        $d = new DataIterator();
        $this->assertTrue($d instanceof Iterator);
    }

    public function testIterate()
    {
        $d = new DataIterator();
        $d["key"] = "value";
        $d["key2"] = "value2";
        $dArray = [];
        foreach ($d as $key => $item) {
            $dArray[$key] = $item;
        }
        $this->assertEquals(["key" => "value", "key2" => "value2"], $dArray);
    }

    public function testOffset()
    {
        $d = new DataIterator();
        $d->offsetSet("key", "value");
        $this->assertTrue($d->offsetExists("key"));
        $this->assertEquals("value", $d->offsetGet("key"));
        $d->offsetUnset("key");
        $this->assertFalse($d->offsetExists("key"));
    }
}


text:
namespace net {

namespace x509_util {

bool IsSupportedValidityRange(base::Time not_valid_before,
                              base::Time not_valid_after) {
  if (not_valid_before > not_valid_after)
    return false;

  // The validity field of a certificate can only encode years 1-9999.

  // Compute the base::Time values corresponding to Jan 1st,0001 and
  // Jan 1st, 10000 respectively. Done by using the pre-computed numbers
  // of days between these dates and the Unix epoch, i.e. Jan 1st, 1970,
  // using the following Python script:
  //
  //     from datetime import date as D
  //     print (D(1970,1,1)-D(1,1,1))        # -> 719162 days
  //     print (D(9999,12,31)-D(1970,1,1))   # -> 2932896 days
  //
  // Note: This ignores leap seconds, but should be enough in practice.
  //
  const int64 kDaysFromYear0001ToUnixEpoch = 719162;
  const int64 kDaysFromUnixEpochToYear10000 = 2932896 + 1;
  const base::Time kEpoch = base::Time::UnixEpoch();
  const base::Time kYear0001 = kEpoch -
      base::TimeDelta::FromDays(kDaysFromYear0001ToUnixEpoch);
  const base::Time kYear10000 = kEpoch +
      base::TimeDelta::FromDays(kDaysFromUnixEpochToYear10000);

  if (not_valid_before < kYear0001 || not_valid_before >= kYear10000 ||
      not_valid_after < kYear0001 || not_valid_after >= kYear10000)
    return false;

  return true;
}

bool CreateDomainBoundCertEC(
    crypto::ECPrivateKey* key,
    const std::string& domain,
    uint32 serial_number,
    base::Time not_valid_before,
    base::Time not_valid_after,
    std::string* der_cert) {
  NOTIMPLEMENTED();
  return false;
}

bool CreateSelfSignedCert(crypto::RSAPrivateKey* key,
                          const std::string& common_name,
                          uint32 serial_number,
                          base::Time not_valid_before,
                          base::Time not_valid_after,
                          std::string* der_encoded) {
  NOTIMPLEMENTED();
  return false;
}

bool ParsePrincipalKeyAndValueByIndex(X509_NAME* name,
                                      int index,
                                      std::string* key,
                                      std::string* value) {
  X509_NAME_ENTRY* entry = X509_NAME_get_entry(name, index);
  if (!entry)
    return false;

  if (key) {
    ASN1_OBJECT* object = X509_NAME_ENTRY_get_object(entry);
    key->assign(OBJ_nid2sn(OBJ_obj2nid(object)));
  }

  ASN1_STRING* data = X509_NAME_ENTRY_get_data(entry);
  if (!data)
    return false;

  unsigned char* buf = NULL;
  int len = ASN1_STRING_to_UTF8(&buf, data);
  if (len <= 0)
    return false;

  value->assign(reinterpret_cast<const char*>(buf), len);
  OPENSSL_free(buf);
  return true;
}

bool ParsePrincipalValueByIndex(X509_NAME* name,
                                int index,
                                std::string* value) {
  return ParsePrincipalKeyAndValueByIndex(name, index, NULL, value);
}

bool ParsePrincipalValueByNID(X509_NAME* name, int nid, std::string* value) {
  int index = X509_NAME_get_index_by_NID(name, nid, -1);
  if (index < 0)
    return false;

  return ParsePrincipalValueByIndex(name, index, value);
}

bool ParseDate(ASN1_TIME* x509_time, base::Time* time) {
  if (!x509_time ||
      (x509_time->type != V_ASN1_UTCTIME &&
       x509_time->type != V_ASN1_GENERALIZEDTIME))
    return false;

  base::StringPiece str_date(reinterpret_cast<const char*>(x509_time->data),
                             x509_time->length);

  CertDateFormat format = x509_time->type == V_ASN1_UTCTIME ?
      CERT_DATE_FORMAT_UTC_TIME : CERT_DATE_FORMAT_GENERALIZED_TIME;
  return ParseCertificateDate(str_date, format, time);
}

}  // namespace x509_util

}  // namespace net


text:
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import reducers from 'src/reducers';

let store;

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

if (process.env.NODE_ENV === 'production') {
  store = createStore(reducers, applyMiddleware(thunk));
}
else {
  store = createStore(
    reducers,
    composeEnhancers(
      applyMiddleware(thunk)
    )
  );
}

export default store;


text:
import React from 'react';
import Label from '../../../src/TPA/Label';
import Input from '../../../src/TPA/Input';
import styles from './styles.scss';

const LabelExample = () => {
  return (

      Label text
      <Input id="input-id"/>

  );
};

export const CustomStyleLabelExample = () => {
  return (

      Label text
      <Input id="input-id"/>

  );
};

export default LabelExample;


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>ca.uwaterloo.iss4e</groupId>
	<artifactId>WeatherHistory</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>war</packaging>

	<properties>
		<spring.version>3.2.7.RELEASE</spring.version>
		<log4j.version>2.0-beta9</log4j.version>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	</properties>

	<build>
		<sourceDirectory>src/main/java</sourceDirectory>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
			</resource>
		</resources>
		<testSourceDirectory>src/test/java</testSourceDirectory>
		<testResources>
			<testResource>
				<directory>src/test/resources</directory>
			</testResource>
		</testResources>
		<plugins>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.1</version>
				<configuration>
					<source>1.7</source>
					<target>1.7</target>
				</configuration>
			</plugin>
			<plugin>
				<artifactId>maven-war-plugin</artifactId>
				<version>2.4</version>
				<configuration>
					<webResources>
						<resource>
							<directory>src/main/resources</directory>
							<targetPath>WEB-INF/classes</targetPath>
						</resource>
					</webResources>
					<warName>${project.artifactId}</warName>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<repositories>
		<repository>
			<id>spring-milestones</id>
			<name>Spring Milestones</name>
			<url>http://repo.spring.io/milestone</url>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</repository>
	</repositories>

	<dependencies>
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>5.1.26</version>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.11</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-api</artifactId>
			<version>${log4j.version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-core</artifactId>
			<version>${log4j.version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-1.2-api</artifactId>
			<version>${log4j.version}</version>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
			<version>3.0.1</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>jstl</artifactId>
			<version>1.2</version>
		</dependency>
		<dependency>
			<groupId>taglibs</groupId>
			<artifactId>fmt</artifactId>
			<version>1.1.2</version>
			<scope>runtime</scope>
			<type>tld</type>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jdbc</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework.data</groupId>
			<artifactId>spring-data-rest-webmvc</artifactId>
			<version>2.0.0.M1</version>
		</dependency>
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-annotations</artifactId>
			<version>2.3.0</version>
		</dependency>
		<dependency>
			<groupId>commons-dbcp</groupId>
			<artifactId>commons-dbcp</artifactId>
			<version>1.4</version>
		</dependency>
		<dependency>
			<groupId>com.google.code.gson</groupId>
			<artifactId>gson</artifactId>
			<version>2.2.4</version>
		</dependency>
		<dependency>
			<groupId>joda-time</groupId>
			<artifactId>joda-time</artifactId>
			<version>2.3</version>
		</dependency>
	</dependencies>
</project>


text:
using System;
using System.IO;
/// <summary>
/// System.IO.SeekOrigin.End
/// </summary>
public class SeekOriginEnd
{
    #region Public Methods
    public bool RunTests()
    {
        bool retVal = true;

        TestLibrary.TestFramework.LogInformation("[Positive]");
        retVal = PosTest1() && retVal;

        return retVal;
    }

    #region Positive Test Cases
    public bool PosTest1()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest1: Check the value of SeekOriginEnd");

        try
        {
            SeekOrigin seekOrigin = (SeekOrigin)2;
            if (SeekOrigin.End != seekOrigin)
            {
                TestLibrary.TestFramework.LogError("001", "The result is not the value as expected,The value is: " + (Int32)SeekOrigin.End);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002", "Unexpected exception: " + e);
            retVal = false;
        }

        return retVal;
    }

    #endregion

    #region Nagetive Test Cases
    #endregion
    #endregion

    public static int Main()
    {
        SeekOriginEnd test = new SeekOriginEnd();

        TestLibrary.TestFramework.BeginTestCase("SeekOriginEnd");

        if (test.RunTests())
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("PASS");
            return 100;
        }
        else
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("FAIL");
            return 0;
        }
    }
}


text:
@interface ANRealTimerTestCase : XCTestCase <ANRealTimerDelegate>
@property (nonatomic, strong) XCTestExpectation *loadAdSuccesfulException;
@property (nonatomic, readwrite, assign)  BOOL       oneSecTimerNotification;
@end

@implementation ANRealTimerTestCase

- (void)setUp {
    self.loadAdSuccesfulException = nil;
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(handle1SecTimerSentNotification)
                                                 name:@"kTimerNotification"
                                               object:nil];
    self.oneSecTimerNotification = NO;
    // Put setup code here. This method is called before the invocation of each test method in the class.
}

- (void)tearDown {
    // Put teardown code here. This method is called after the invocation of each test method in the class.
}

- (void)testSetTimerFor1Sec{
   //ANSDKSettings.sharedInstance.countImpressionOn1PxRendering = YES;
   [ANRealTimer addDelegate:self];

   self.loadAdSuccesfulException = [self expectationWithDescription:@"Timer Exception"];

   [self waitForExpectationsWithTimeout:10 handler:nil];
   XCTAssertTrue(self.oneSecTimerNotification);

}

- (void)handle1SecTimerSentNotification {
    self.oneSecTimerNotification = YES;
    [ANRealTimer removeDelegate:self];
    [self.loadAdSuccesfulException fulfill];
}

@end


text:
namespace content {

namespace webcrypto {

namespace {

Status ExportPKeySpki(EVP_PKEY* key, std::vector<uint8_t>* buffer) {
  crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE);
  crypto::ScopedBIO bio(BIO_new(BIO_s_mem()));

  // TODO(eroman): Use the OID specified by webcrypto spec.
  //               http://crbug.com/373545
  if (!i2d_PUBKEY_bio(bio.get(), key))
    return Status::ErrorUnexpected();

  char* data = NULL;
  long len = BIO_get_mem_data(bio.get(), &data);
  if (!data || len < 0)
    return Status::ErrorUnexpected();

  buffer->assign(data, data + len);
  return Status::Success();
}

Status ExportPKeyPkcs8(EVP_PKEY* key, std::vector<uint8_t>* buffer) {
  crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE);
  crypto::ScopedBIO bio(BIO_new(BIO_s_mem()));

  // TODO(eroman): Use the OID specified by webcrypto spec.
  //               http://crbug.com/373545
  if (!i2d_PKCS8PrivateKeyInfo_bio(bio.get(), key))
    return Status::ErrorUnexpected();

  char* data = NULL;
  long len = BIO_get_mem_data(bio.get(), &data);
  if (!data || len < 0)
    return Status::ErrorUnexpected();

  buffer->assign(data, data + len);
  return Status::Success();
}

// Creates a blink::WebCryptoAlgorithm having the modulus length and public
// exponent  of |key|.
Status CreateRsaHashedKeyAlgorithm(
    blink::WebCryptoAlgorithmId rsa_algorithm,
    blink::WebCryptoAlgorithmId hash_algorithm,
    EVP_PKEY* key,
    blink::WebCryptoKeyAlgorithm* key_algorithm) {
  DCHECK(IsAlgorithmRsa(rsa_algorithm));
  DCHECK_EQ(EVP_PKEY_RSA, EVP_PKEY_id(key));

  crypto::ScopedRSA rsa(EVP_PKEY_get1_RSA(key));
  if (!rsa.get())
    return Status::ErrorUnexpected();

  unsigned int modulus_length_bits = BN_num_bits(rsa.get()->n);

  // Convert the public exponent to big-endian representation.
  std::vector<uint8_t> e(BN_num_bytes(rsa.get()->e));
  if (e.size() == 0)
    return Status::ErrorUnexpected();
  if (e.size() != BN_bn2bin(rsa.get()->e, &e[0]))
    return Status::ErrorUnexpected();

  *key_algorithm = blink::WebCryptoKeyAlgorithm::createRsaHashed(
      rsa_algorithm, modulus_length_bits, &e[0], e.size(), hash_algorithm);

  return Status::Success();
}

Status CreateWebCryptoPrivateKey(
    crypto::ScopedEVP_PKEY private_key,
    const blink::WebCryptoAlgorithmId rsa_algorithm_id,
    const blink::WebCryptoAlgorithm& hash,
    bool extractable,
    blink::WebCryptoKeyUsageMask usage_mask,
    blink::WebCryptoKey* key) {
  blink::WebCryptoKeyAlgorithm key_algorithm;
  Status status = CreateRsaHashedKeyAlgorithm(
      rsa_algorithm_id, hash.id(), private_key.get(), &key_algorithm);
  if (status.IsError())
    return status;

  // Serialize the key at creation time so that if structured cloning is
  // requested it can be done synchronously from the Blink thread.
  std::vector<uint8_t> pkcs8_data;
  status = ExportPKeyPkcs8(private_key.get(), &pkcs8_data);
  if (status.IsError())
    return status;

  *key = blink::WebCryptoKey::create(
      new AsymKeyOpenSsl(private_key.Pass(), CryptoData(pkcs8_data)),
      blink::WebCryptoKeyTypePrivate,
      extractable,
      key_algorithm,
      usage_mask);
  return Status::Success();
}

Status CreateWebCryptoPublicKey(
    crypto::ScopedEVP_PKEY public_key,
    const blink::WebCryptoAlgorithmId rsa_algorithm_id,
    const blink::WebCryptoAlgorithm& hash,
    bool extractable,
    blink::WebCryptoKeyUsageMask usage_mask,
    blink::WebCryptoKey* key) {
  blink::WebCryptoKeyAlgorithm key_algorithm;
  Status status = CreateRsaHashedKeyAlgorithm(
      rsa_algorithm_id, hash.id(), public_key.get(), &key_algorithm);
  if (status.IsError())
    return status;

  // Serialize the key at creation time so that if structured cloning is
  // requested it can be done synchronously from the Blink thread.
  std::vector<uint8_t> spki_data;
  status = ExportPKeySpki(public_key.get(), &spki_data);
  if (status.IsError())
    return status;

  *key = blink::WebCryptoKey::create(
      new AsymKeyOpenSsl(public_key.Pass(), CryptoData(spki_data)),
      blink::WebCryptoKeyTypePublic,
      extractable,
      key_algorithm,
      usage_mask);
  return Status::Success();
}

// Converts a BIGNUM to a big endian byte array.
std::vector<uint8_t> BIGNUMToVector(BIGNUM* n) {
  std::vector<uint8_t> v(BN_num_bytes(n));
  BN_bn2bin(n, vector_as_array(&v));
  return v;
}

// Allocates a new BIGNUM given a std::string big-endian representation.
BIGNUM* CreateBIGNUM(const std::string& n) {
  return BN_bin2bn(reinterpret_cast<const uint8_t*>(n.data()), n.size(), NULL);
}

Status ImportRsaPrivateKey(const blink::WebCryptoAlgorithm& algorithm,
                           bool extractable,
                           blink::WebCryptoKeyUsageMask usage_mask,
                           const JwkRsaInfo& params,
                           blink::WebCryptoKey* key) {
  crypto::ScopedRSA rsa(RSA_new());

  rsa->n = CreateBIGNUM(params.n);
  rsa->e = CreateBIGNUM(params.e);
  rsa->d = CreateBIGNUM(params.d);
  rsa->p = CreateBIGNUM(params.p);
  rsa->q = CreateBIGNUM(params.q);
  rsa->dmp1 = CreateBIGNUM(params.dp);
  rsa->dmq1 = CreateBIGNUM(params.dq);
  rsa->iqmp = CreateBIGNUM(params.qi);

  if (!rsa->n || !rsa->e || !rsa->d || !rsa->p || !rsa->q || !rsa->dmp1 ||
      !rsa->dmq1 || !rsa->iqmp) {
    return Status::OperationError();
  }

  // TODO(eroman): This should really be a DataError, however for compatibility
  //               with NSS it is an OperationError.
  if (!RSA_check_key(rsa.get()))
    return Status::OperationError();

  // Create a corresponding EVP_PKEY.
  crypto::ScopedEVP_PKEY pkey(EVP_PKEY_new());
  if (!pkey || !EVP_PKEY_set1_RSA(pkey.get(), rsa.get()))
    return Status::OperationError();

  return CreateWebCryptoPrivateKey(pkey.Pass(),
                                   algorithm.id(),
                                   algorithm.rsaHashedImportParams()->hash(),
                                   extractable,
                                   usage_mask,
                                   key);
}

Status ImportRsaPublicKey(const blink::WebCryptoAlgorithm& algorithm,
                          bool extractable,
                          blink::WebCryptoKeyUsageMask usage_mask,
                          const CryptoData& n,
                          const CryptoData& e,
                          blink::WebCryptoKey* key) {
  crypto::ScopedRSA rsa(RSA_new());

  rsa->n = BN_bin2bn(n.bytes(), n.byte_length(), NULL);
  rsa->e = BN_bin2bn(e.bytes(), e.byte_length(), NULL);

  if (!rsa->n || !rsa->e)
    return Status::OperationError();

  // Create a corresponding EVP_PKEY.
  crypto::ScopedEVP_PKEY pkey(EVP_PKEY_new());
  if (!pkey || !EVP_PKEY_set1_RSA(pkey.get(), rsa.get()))
    return Status::OperationError();

  return CreateWebCryptoPublicKey(pkey.Pass(),
                                  algorithm.id(),
                                  algorithm.rsaHashedImportParams()->hash(),
                                  extractable,
                                  usage_mask,
                                  key);
}

}  // namespace

Status RsaHashedAlgorithm::VerifyKeyUsagesBeforeGenerateKeyPair(
    blink::WebCryptoKeyUsageMask combined_usage_mask,
    blink::WebCryptoKeyUsageMask* public_usage_mask,
    blink::WebCryptoKeyUsageMask* private_usage_mask) const {
  Status status = CheckKeyCreationUsages(
      all_public_key_usages_ | all_private_key_usages_, combined_usage_mask);
  if (status.IsError())
    return status;

  *public_usage_mask = combined_usage_mask & all_public_key_usages_;
  *private_usage_mask = combined_usage_mask & all_private_key_usages_;

  return Status::Success();
}

Status RsaHashedAlgorithm::GenerateKeyPair(
    const blink::WebCryptoAlgorithm& algorithm,
    bool extractable,
    blink::WebCryptoKeyUsageMask public_usage_mask,
    blink::WebCryptoKeyUsageMask private_usage_mask,
    blink::WebCryptoKey* public_key,
    blink::WebCryptoKey* private_key) const {
  const blink::WebCryptoRsaHashedKeyGenParams* params =
      algorithm.rsaHashedKeyGenParams();

  unsigned int public_exponent = 0;
  unsigned int modulus_length_bits = 0;
  Status status =
      GetRsaKeyGenParameters(params, &public_exponent, &modulus_length_bits);
  if (status.IsError())
    return status;

  crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE);

  // Generate an RSA key pair.
  crypto::ScopedRSA rsa_private_key(RSA_new());
  crypto::ScopedBIGNUM bn(BN_new());
  if (!rsa_private_key.get() || !bn.get() ||
      !BN_set_word(bn.get(), public_exponent)) {
    return Status::OperationError();
  }

  if (!RSA_generate_key_ex(
          rsa_private_key.get(), modulus_length_bits, bn.get(), NULL)) {
    return Status::OperationError();
  }

  // Construct an EVP_PKEY for the private key.
  crypto::ScopedEVP_PKEY private_pkey(EVP_PKEY_new());
  if (!private_pkey ||
      !EVP_PKEY_set1_RSA(private_pkey.get(), rsa_private_key.get())) {
    return Status::OperationError();
  }

  // Construct an EVP_PKEY for the public key.
  crypto::ScopedRSA rsa_public_key(RSAPublicKey_dup(rsa_private_key.get()));
  crypto::ScopedEVP_PKEY public_pkey(EVP_PKEY_new());
  if (!public_pkey ||
      !EVP_PKEY_set1_RSA(public_pkey.get(), rsa_public_key.get())) {
    return Status::OperationError();
  }

  // Note that extractable is unconditionally set to true. This is because per
  // the WebCrypto spec generated public keys are always public.
  status = CreateWebCryptoPublicKey(public_pkey.Pass(),
                                    algorithm.id(),
                                    params->hash(),
                                    true,
                                    public_usage_mask,
                                    public_key);
  if (status.IsError())
    return status;

  return CreateWebCryptoPrivateKey(private_pkey.Pass(),
                                   algorithm.id(),
                                   params->hash(),
                                   extractable,
                                   private_usage_mask,
                                   private_key);
}

Status RsaHashedAlgorithm::VerifyKeyUsagesBeforeImportKey(
    blink::WebCryptoKeyFormat format,
    blink::WebCryptoKeyUsageMask usage_mask) const {
  switch (format) {
    case blink::WebCryptoKeyFormatSpki:
      return CheckKeyCreationUsages(all_public_key_usages_, usage_mask);
    case blink::WebCryptoKeyFormatPkcs8:
      return CheckKeyCreationUsages(all_private_key_usages_, usage_mask);
    case blink::WebCryptoKeyFormatJwk:
      // TODO(eroman): http://crbug.com/395904
      return CheckKeyCreationUsages(
          all_public_key_usages_ | all_private_key_usages_, usage_mask);
    default:
      return Status::ErrorUnsupportedImportKeyFormat();
  }
}

Status RsaHashedAlgorithm::ImportKeyPkcs8(
    const CryptoData& key_data,
    const blink::WebCryptoAlgorithm& algorithm,
    bool extractable,
    blink::WebCryptoKeyUsageMask usage_mask,
    blink::WebCryptoKey* key) const {
  if (!key_data.byte_length())
    return Status::ErrorImportEmptyKeyData();

  crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE);

  crypto::ScopedBIO bio(BIO_new_mem_buf(const_cast<uint8_t*>(key_data.bytes()),
                                        key_data.byte_length()));
  if (!bio.get())
    return Status::ErrorUnexpected();

  crypto::ScopedOpenSSL<PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO_free>::Type
      p8inf(d2i_PKCS8_PRIV_KEY_INFO_bio(bio.get(), NULL));
  if (!p8inf.get())
    return Status::DataError();

  crypto::ScopedEVP_PKEY private_key(EVP_PKCS82PKEY(p8inf.get()));
  if (!private_key.get())
    return Status::DataError();

  if (EVP_PKEY_id(private_key.get()) != EVP_PKEY_RSA)
    return Status::DataError();  // Data did not define an RSA key.

  // Verify the parameters of the key (because EVP_PKCS82PKEY() happily imports
  // invalid keys).
  crypto::ScopedRSA rsa(EVP_PKEY_get1_RSA(private_key.get()));
  if (!rsa.get())
    return Status::ErrorUnexpected();
  if (!RSA_check_key(rsa.get()))
    return Status::DataError();

  // TODO(eroman): Validate the algorithm OID against the webcrypto provided
  // hash. http://crbug.com/389400

  return CreateWebCryptoPrivateKey(private_key.Pass(),
                                   algorithm.id(),
                                   algorithm.rsaHashedImportParams()->hash(),
                                   extractable,
                                   usage_mask,
                                   key);
}

Status RsaHashedAlgorithm::ImportKeySpki(
    const CryptoData& key_data,
    const blink::WebCryptoAlgorithm& algorithm,
    bool extractable,
    blink::WebCryptoKeyUsageMask usage_mask,
    blink::WebCryptoKey* key) const {
  if (!key_data.byte_length())
    return Status::ErrorImportEmptyKeyData();

  crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE);

  crypto::ScopedBIO bio(BIO_new_mem_buf(const_cast<uint8_t*>(key_data.bytes()),
                                        key_data.byte_length()));
  if (!bio.get())
    return Status::ErrorUnexpected();

  crypto::ScopedEVP_PKEY public_key(d2i_PUBKEY_bio(bio.get(), NULL));
  if (!public_key.get())
    return Status::DataError();

  if (EVP_PKEY_id(public_key.get()) != EVP_PKEY_RSA)
    return Status::DataError();  // Data did not define an RSA key.

  // TODO(eroman): Validate the algorithm OID against the webcrypto provided
  // hash. http://crbug.com/389400

  return CreateWebCryptoPublicKey(public_key.Pass(),
                                  algorithm.id(),
                                  algorithm.rsaHashedImportParams()->hash(),
                                  extractable,
                                  usage_mask,
                                  key);
}

Status RsaHashedAlgorithm::ImportKeyJwk(
    const CryptoData& key_data,
    const blink::WebCryptoAlgorithm& algorithm,
    bool extractable,
    blink::WebCryptoKeyUsageMask usage_mask,
    blink::WebCryptoKey* key) const {
  const char* jwk_algorithm =
      GetJwkAlgorithm(algorithm.rsaHashedImportParams()->hash().id());

  if (!jwk_algorithm)
    return Status::ErrorUnexpected();

  JwkRsaInfo jwk;
  Status status =
      ReadRsaKeyJwk(key_data, jwk_algorithm, extractable, usage_mask, &jwk);
  if (status.IsError())
    return status;

  // Once the key type is known, verify the usages.
  status = CheckKeyCreationUsages(
      jwk.is_private_key ? all_private_key_usages_ : all_public_key_usages_,
      usage_mask);
  if (status.IsError())
    return status;

  return jwk.is_private_key
             ? ImportRsaPrivateKey(algorithm, extractable, usage_mask, jwk, key)
             : ImportRsaPublicKey(algorithm,
                                  extractable,
                                  usage_mask,
                                  CryptoData(jwk.n),
                                  CryptoData(jwk.e),
                                  key);
}

Status RsaHashedAlgorithm::ExportKeyPkcs8(const blink::WebCryptoKey& key,
                                          std::vector<uint8_t>* buffer) const {
  if (key.type() != blink::WebCryptoKeyTypePrivate)
    return Status::ErrorUnexpectedKeyType();
  *buffer = AsymKeyOpenSsl::Cast(key)->serialized_key_data();
  return Status::Success();
}

Status RsaHashedAlgorithm::ExportKeySpki(const blink::WebCryptoKey& key,
                                         std::vector<uint8_t>* buffer) const {
  if (key.type() != blink::WebCryptoKeyTypePublic)
    return Status::ErrorUnexpectedKeyType();
  *buffer = AsymKeyOpenSsl::Cast(key)->serialized_key_data();
  return Status::Success();
}

Status RsaHashedAlgorithm::ExportKeyJwk(const blink::WebCryptoKey& key,
                                        std::vector<uint8_t>* buffer) const {
  EVP_PKEY* public_key = AsymKeyOpenSsl::Cast(key)->key();
  crypto::ScopedRSA rsa(EVP_PKEY_get1_RSA(public_key));
  if (!rsa.get())
    return Status::ErrorUnexpected();

  const char* jwk_algorithm =
      GetJwkAlgorithm(key.algorithm().rsaHashedParams()->hash().id());
  if (!jwk_algorithm)
    return Status::ErrorUnexpected();

  switch (key.type()) {
    case blink::WebCryptoKeyTypePublic:
      WriteRsaPublicKeyJwk(CryptoData(BIGNUMToVector(rsa->n)),
                           CryptoData(BIGNUMToVector(rsa->e)),
                           jwk_algorithm,
                           key.extractable(),
                           key.usages(),
                           buffer);
      return Status::Success();
    case blink::WebCryptoKeyTypePrivate:
      WriteRsaPrivateKeyJwk(CryptoData(BIGNUMToVector(rsa->n)),
                            CryptoData(BIGNUMToVector(rsa->e)),
                            CryptoData(BIGNUMToVector(rsa->d)),
                            CryptoData(BIGNUMToVector(rsa->p)),
                            CryptoData(BIGNUMToVector(rsa->q)),
                            CryptoData(BIGNUMToVector(rsa->dmp1)),
                            CryptoData(BIGNUMToVector(rsa->dmq1)),
                            CryptoData(BIGNUMToVector(rsa->iqmp)),
                            jwk_algorithm,
                            key.extractable(),
                            key.usages(),
                            buffer);
      return Status::Success();

    default:
      return Status::ErrorUnexpected();
  }
}

}  // namespace webcrypto

}  // namespace content


text:
package org.saddle.time

import org.specs2.mutable.Specification
import org.specs2.ScalaCheck
import org.scalacheck.{Gen, Arbitrary}
import org.joda.time.{Days, Months, DateTimeConstants, DateTime}
import org.scalacheck.Prop._

class RRulesCheck extends Specification with ScalaCheck {
  import RRules._

  private def genDate: Gen[DateTime] = for {
    year <- Gen.choose(1990, 2020)
    offset <- Gen.choose(-366, 366)
  } yield new DateTime(year, 1, 1, 0, 0, 0, 0).plusDays(offset)

  private def toWeekday(i: Int) = i match {
    case 1 => MO // ISO standard; joda conforms
    case 2 => TU
    case 3 => WE
    case 4 => TH
    case 5 => FR
    case 6 => SA
    case 7 => SU
    case _ => throw new IllegalArgumentException("Bad weekday %d" format i)
  }

  private def genWeekday: Gen[Weekday] = for { i <- Gen.choose(1, 7) } yield toWeekday(i)

  private def isNotWeekend(dt: DateTime) = {
    dt.dayOfWeek().get() must_!= DateTimeConstants.SUNDAY
    dt.dayOfWeek().get() must_!= DateTimeConstants.SATURDAY
  }

  "RRule Tests" in {

    implicit val arbDate = Arbitrary(genDate)
    implicit val arbWkdy = Arbitrary(genWeekday)

    "bizDays must work as expected" in {
      forAll { (dt: DateTime) =>
        val result1 = conform(bizDays, dt, forward = true)

        result1 must be_>=(dt)
        Days.daysBetween(result1, dt).getDays must be_<=(2)
        isNotWeekend(result1)

        val result2 = conform(bizDays, dt, forward = false)

        result2 must be_<=(dt)
        Days.daysBetween(dt, result2).getDays must be_<=(2)
        isNotWeekend(result2)
      }
    }

    "bizEoms must work as expected" in {
      forAll { (dt: DateTime) =>
        val result1 = conform(bizEoms, dt, forward = true)

        result1 must be_>=(dt)
        Months.monthsBetween(dt, result1).getMonths must be_<=(1)
        result1.plusDays(3) must_!= result1.getMonthOfYear
        isNotWeekend(result1)

        val result2 = conform(bizEoms, dt, forward = false)

        result2 must be_<=(dt)
        Months.monthsBetween(result2, dt).getMonths must be_<=(1)
        result2.plusDays(3) must_!= result2.getMonthOfYear
        isNotWeekend(result2)
      }
    }

    "bizEoms 10/30/2007 test must pass" in {
      bizEoms counting -1 from datetime(2007,10,30) must_== datetime(2007,9,28)
    }

    "bizBoms must work as expected" in {
      forAll { (dt: DateTime) =>
        val result1 = conform(bizBoms, dt, forward = true)

        result1 must be_>=(dt)
        Months.monthsBetween(dt, result1).getMonths must be_<=(1)
        result1.minusDays(3) must_!= result1.getMonthOfYear
        isNotWeekend(result1)

        val result2 = conform(bizBoms, dt, forward = false)
        result2 must be_<=(dt)
        Months.monthsBetween(result2, dt).getMonths must be_<=(1)
        result2.minusDays(3) must_!= result2.getMonthOfYear
        isNotWeekend(result2)
      }
    }

    "bizEoqs must work as expected" in {
      forAll { (dt: DateTime) =>
        val result1 = conform(bizEoqs, dt, forward = true)

        result1 must be_>=(dt)
        Set(3,6,9,12).contains(result1.getMonthOfYear) must beTrue
        result1.plusDays(3) must_!= result1.getMonthOfYear
        isNotWeekend(result1)

        val result2 = conform(bizEoqs, dt, forward = false)

        result2 must be_<=(dt)
        Set(3,6,9,12).contains(result1.getMonthOfYear) must beTrue
        result2.plusDays(3) must_!= result2.getMonthOfYear
        isNotWeekend(result2)
      }
    }

    "bizEoqs 9/29/2002 test must pass" in {
      bizEoqs counting -1 from datetime(2002,9,29) must_== datetime(2002,6,28)
    }

    "bizBoqs must work as expected" in {
      forAll { (dt: DateTime) =>
        val result1 = conform(bizBoqs, dt, forward = true)

        result1 must be_>=(dt)
        Set(3,6,9,12).contains(result1.getMonthOfYear) must beTrue
        result1.minusDays(3) must_!= result1.getMonthOfYear
        isNotWeekend(result1)

        val result2 = conform(bizBoqs, dt, forward = false)

        result2 must be_<=(dt)
        Set(3,6,9,12).contains(result1.getMonthOfYear) must beTrue
        result2.minusDays(3) must_!= result2.getMonthOfYear
        isNotWeekend(result2)
      }
    }

    "bizBoqs 6/2/19 test must pass" in {
      bizBoqs counting -1 from datetime(2019,6,2) must_== datetime(2019,3,1)
    }

    "eoms must work as expected" in {
      forAll { (dt: DateTime) =>
        val result1 = conform(eoms, dt, forward = true)

        result1 must be_>=(dt)
        Months.monthsBetween(dt, result1).getMonths must be_<=(1)
        result1.plusDays(1).getMonthOfYear must_!= result1.getMonthOfYear

        val result2 = conform(eoms, dt, forward = false)

        result2 must be_<=(dt)
        Months.monthsBetween(result2, dt).getMonths must be_<=(1)
        result2.plusDays(1).getMonthOfYear must_!= result2.getMonthOfYear
      }
    }

    "boms must work as expected" in {
      forAll { (dt: DateTime) =>
        val result1 = conform(boms, dt, forward = true)

        result1 must be_>=(dt)
        Months.monthsBetween(dt, result1).getMonths must be_<=(1)
        result1.minusDays(1).getMonthOfYear must_!= result1.getMonthOfYear

        val result2 = conform(boms, dt, forward = false)

        result2 must be_<=(dt)
        Months.monthsBetween(result2, dt).getMonths must be_<=(1)
        result2.minusDays(1).getMonthOfYear must_!= result2.getMonthOfYear
      }
    }

    "weekly must work as expected" in {
      forAll { (dt: DateTime, wd: Weekday) =>
        val rule = weeklyOn(wd)

        val result1 = conform(rule, dt, forward = true)
        result1 must be_>=(dt)
        toWeekday(result1.dayOfWeek().get()) must_== wd

        val result2 = conform(rule, dt, forward = false)
        result2 must be_<=(dt)
        toWeekday(result2.dayOfWeek().get()) must_== wd
      }
    }
  }
}


text:
<meta>
	<!-- Data -->
	<info author="UAG Crew" type="misc" name="UAG Statistics"/>
	<min_mta_version client="1.3.0-9.03782" />

	<!-- Codes -->
	<script src="s_stats.lua" type="server" />

	<export function="onPlayerDieStatistics" type="server"/>
</meta>


text:
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateClientStatusesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('client_statuses', function(Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->integer('sorting_num')->nullable()->unsigned();
            $table->string('color')->nullable();
            $table->text('description')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('client_statuses');
    }
}


text:
<?php

namespace TheIconic\Tracking\GoogleAnalytics\Parameters\Timing;

use TheIconic\Tracking\GoogleAnalytics\Parameters\SingleParameter;

/**
 * Class DnsTime
 *
 * @link https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#dns
 *
 * @package TheIconic\Tracking\GoogleAnalytics\Parameters\Timing
 */
class DnsTime extends SingleParameter
{
    /**
     * @inheritDoc
     *
     * @var string
     */
    protected $name = 'dns';
}


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="0dp"
    android:layout_height="52dp"
    android:orientation="vertical"
	android:layout_weight="1"
    android:background="@drawable/tab_indicator">

    <ImageView android:id="@+id/icon"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:scaleType="fitXY"
        android:layout_centerHorizontal="true"
        android:layout_centerInParent="true"
    />
    <TextView android:id="@+id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:textSize="14sp"
        android:textStyle="bold"

    />
</RelativeLayout>


text:
(function ( $ ) {
	var i18n = window.i18nLocale,
		store = vc.storage,
		Shortcodes = vc.shortcodes;
	vc.templateOptions = {
		default: {
			evaluate: /<%([\s\S]+?)%>/g,
			interpolate: /<%=([\s\S]+?)%>/g,
			escape: /<%-([\s\S]+?)%>/g
		},
		custom: {
			evaluate: /<#([\s\S]+?)#>/g,
			interpolate: /\{\{\{([\s\S]+?)\}\}\}/g,
			escape: /\{\{([^\}]+?)\}\}(?!\})/g
		}

	};
	vc.builder = {
		toString: function ( model, type ) {
			var params = model.get( 'params' ),
				content = _.isString( params.content ) ? params.content : '';
			return wp.shortcode.string( {
				tag: model.get( 'shortcode' ),
				attrs: _.omit( params, 'content' ),
				content: content,
				type: _.isString( type ) ? type : ''
			} );
		}
	};
	/**
	 * Default view for shortcode as block inside Visual composer design mode.
	 * @type {*}
	 */
	vc.clone_index = 1;
	vc.saved_custom_css = false;
	var ShortcodeView = vc.shortcode_view = Backbone.View.extend( {
		tagName: 'div',
		$content: '',
		use_default_content: false,
		params: {},
		events: {
			'click .column_delete,.vc_control-btn-delete': 'deleteShortcode',
			'click .column_add,.vc_control-btn-prepend': 'addElement',
			'click .column_edit,.vc_control-btn-edit, .column_edit_trigger': 'editElement',
			'click .column_clone,.vc_control-btn-clone': 'clone',
			'mousemove': 'checkControlsPosition'
		},
		removeView: function () {
			vc.closeActivePanel( this.model );
			this.remove();
		},
		checkControlsPosition: function () {
			if ( ! this.$controls_buttons ) {
				return;
			}
			var window_top, element_position_top, new_position,
				element_height = this.$el.height(),
				window_height = $( window ).height();
			if ( element_height > window_height ) {
				window_top = $( window ).scrollTop();
				element_position_top = this.$el.offset().top;
				new_position = (window_top - element_position_top) + $( window ).height() / 2;
				if ( 40 < new_position && new_position < element_height ) {
					this.$controls_buttons.css( 'top', new_position );
				} else if ( new_position > element_height ) {
					this.$controls_buttons.css( 'top', element_height - 40 );
				} else {
					this.$controls_buttons.css( 'top', 40 );
				}
			}
		},
		initialize: function () {
			this.model.bind( 'destroy', this.removeView, this );
			this.model.bind( 'change:params', this.changeShortcodeParams, this );
			this.model.bind( 'change_parent_id', this.changeShortcodeParent, this );
			this.createParams();
		},
		hasUserAccess: function () {
			var shortcodeTag;

			shortcodeTag = this.model.get( 'shortcode' );
			if ( - 1 < _.indexOf( [
					"vc_row",
					"vc_column",
					"vc_row_inner",
					"vc_column_inner"
				], shortcodeTag ) ) {
				return true; // we cannot block controls for these shortcodes;
			}

			if ( ! _.every( vc.roles.current_user, function ( role ) {
					return ! (! _.isUndefined( vc.roles[ role ] ) && ! _.isUndefined( vc.roles[ role ][ 'shortcodes' ] ) && _.isUndefined( vc.roles[ role ][ 'shortcodes' ][ shortcodeTag ] ));
				} ) ) {
				return false;
			}
			return true;
		},
		createParams: function () {
			var tag, settings, params;

			tag = this.model.get( 'shortcode' );
			settings = _.isObject( vc.map[ tag ] ) && _.isArray( vc.map[ tag ].params ) ? vc.map[ tag ].params : [];
			params = this.model.get( 'params' );
			this.params = {};
			_.each( settings, function ( param ) {
				this.params[ param.param_name ] = param;
			}, this );
		},
		setContent: function () {
			this.$content = this.$el.find( '> .wpb_element_wrapper > .vc_container_for_children,'
			+ ' > .vc_element-wrapper > .vc_container_for_children' );
		},
		setEmpty: function () {
		},
		unsetEmpty: function () {

		},
		checkIsEmpty: function () {
			if ( this.model.get( 'parent_id' ) ) {
				vc.app.views[ this.model.get( 'parent_id' ) ].checkIsEmpty();
			}
		},

		/**
		 * Convert html into correct element
		 * @param html
		 */
		html2element: function ( html ) {
			var attributes = {},
				$template;
			if ( _.isString( html ) ) {
				this.template = _.template( html );
				$template = $( this.template( this.model.toJSON(), vc.templateOptions.default ).trim() );
			} else {
				this.template = html;
				$template = html;
			}
			_.each( $template.get( 0 ).attributes, function ( attr ) {
				attributes[ attr.name ] = attr.value;
			} );
			this.$el.attr( attributes ).html( $template.html() );
			this.setContent();
			this.renderContent();

		},
		render: function () {
			var $shortcode_template_el = $( '#vc_shortcode-template-' + this.model.get( 'shortcode' ) );
			if ( $shortcode_template_el.is( 'script' ) ) {
				this.html2element( _.template( $shortcode_template_el.html(),
					this.model.toJSON(),
					vc.templateOptions.default ) );
			} else {
				var params = this.model.get( 'params' );
				$.ajax( {
					type: 'POST',
					url: window.ajaxurl,
					data: {
						action: 'wpb_get_element_backend_html',
						data_element: this.model.get( 'shortcode' ),
						data_width: _.isUndefined( params.width ) ? '1/1' : params.width
					},
					dataType: 'html',
					context: this
				} ).done( function ( html ) {
					this.html2element( html );
				} );
			}
			this.model.view = this;
			this.$controls_buttons = this.$el.find( '.vc_controls > :first' );
			return this;
		},
		renderContent: function () {
			this.$el.attr( 'data-model-id', this.model.get( 'id' ) );
			this.$el.data( 'model', this.model );
			return this;
		},
		changedContent: function ( view ) {
		},
		_loadDefaults: function () {
			var tag,
				hasChilds;

			tag = this.model.get( 'shortcode' );
			hasChilds = ! ! vc.shortcodes.where( { parent_id: this.model.get( 'id' ) } ).length;
			if ( ! hasChilds && true === this.use_default_content && _.isObject( vc.map[ tag ] ) && _.isString( vc.map[ tag ].default_content ) && vc.map[ tag ].default_content.length ) {
				this.use_default_content = false;
				Shortcodes.createFromString( vc.map[ tag ].default_content, this.model );
			}
		},
		_callJsCallback: function () {
			//Fire INIT callback if it is defined
			var tag = this.model.get( 'shortcode' );
			if ( _.isObject( vc.map[ tag ] ) && _.isObject( vc.map[ tag ].js_callback ) && ! _.isUndefined( vc.map[ tag ].js_callback.init ) ) {
				var fn = vc.map[ tag ].js_callback.init;
				window[ fn ]( this.$el );
			}
		},
		ready: function ( e ) {
			this._loadDefaults();
			this._callJsCallback();
			if ( this.model.get( 'parent_id' ) && _.isObject( vc.app.views[ this.model.get( 'parent_id' ) ] ) ) {
				vc.app.views[ this.model.get( 'parent_id' ) ].changedContent( this );
			}
			_.defer( _.bind( function () {
				vc.events.trigger( 'shortcodeView:ready' );
				vc.events.trigger( 'shortcodeView:ready:' + this.model.get( 'shortcode' ) );
			}, this ) );
			return this;
		},
		// View utils {{
		addShortcode: function ( view, method ) {
			var before_shortcode;
			before_shortcode = _.last( vc.shortcodes.filter( function ( shortcode ) {
				return shortcode.get( 'parent_id' ) === this.get( 'parent_id' ) && parseFloat( shortcode.get( 'order' ) ) < parseFloat( this.get( 'order' ) );
			}, view.model ) );
			if ( before_shortcode ) {
				view.render().$el.insertAfter( '[data-model-id=' + before_shortcode.id + ']' );
			} else if ( 'append' === method ) {
				this.$content.append( view.render().el );
			} else {
				this.$content.prepend( view.render().el );
			}
		},
		changeShortcodeParams: function ( model ) {
			var tag,
				params,
				settings,
				view;
			// Triggered when shortcode being updated
			tag = model.get( 'shortcode' );
			params = model.get( 'params' );
			settings = vc.map[ tag ];
			_.defer( function () {
				vc.events.trigger( 'backend.shortcodeViewChangeParams:' + tag );
			} );

			if ( _.isArray( settings.params ) ) {
				_.each( settings.params, function ( param_settings ) {
					var name,
						value,
						$wrapper,
						label_value,
						$admin_label;

					name = param_settings.param_name;
					value = params[ name ];
					$wrapper = this.$el.find( '> .wpb_element_wrapper, > .vc_element-wrapper' );
					label_value = value;
					$admin_label = $wrapper.children( '.admin_label_' + name );

					if ( _.isObject( vc.atts[ param_settings.type ] ) && _.isFunction( vc.atts[ param_settings.type ].render ) ) {
						value = vc.atts[ param_settings.type ].render.call( this, param_settings, value );
					}
					if ( $wrapper.children( '.' + param_settings.param_name ).is( 'input,textarea,select' ) ) {
						$wrapper.children( '[name=' + param_settings.param_name + ']' ).val( value );
					} else if ( $wrapper.children( '.' + param_settings.param_name ).is( 'iframe' ) ) {
						$wrapper.children( '[name=' + param_settings.param_name + ']' ).attr( 'src', value );
					} else if ( $wrapper.children( '.' + param_settings.param_name ).is( 'img' ) ) {
						var $img;

						$img = $wrapper.children( '[name=' + param_settings.param_name + ']' );
						if ( value && value.match( /^\d+$/ ) ) {
							$.ajax( {
								type: 'POST',
								url: window.ajaxurl,
								data: {
									action: 'wpb_single_image_src',
									content: value,
									size: 'thumbnail'
								},
								dataType: 'html',
								context: this
							} ).done( function ( url ) {
								$img.attr( 'src', url );
							} );
						} else if ( value ) {
							$img.attr( 'src', value );
						}
					} else {
						$wrapper.children( '[name=' + param_settings.param_name + ']' ).html( value ? value : '' );
					}
					if ( $admin_label.length ) {
						var inverted_value;

						if ( '' === value || _.isUndefined( value ) ) {
							$admin_label.hide().addClass( 'hidden-label' );
						} else {
							if ( _.isObject( param_settings.value ) && ! _.isArray( param_settings.value ) && 'checkbox' === param_settings.type ) {
								inverted_value = _.invert( param_settings.value );
								label_value = _.map( value.split( /[\s]*\,[\s]*/ ), function ( val ) {
									return _.isString( inverted_value[ val ] ) ? inverted_value[ val ] : val;
								} ).join( ', ' );
							} else if ( _.isObject( param_settings.value ) && ! _.isArray( param_settings.value ) ) {
								inverted_value = _.invert( param_settings.value );
								label_value = _.isString( inverted_value[ value ] ) ? inverted_value[ value ] : value;
							}
							$admin_label.html( '' + $admin_label.find( 'label' ).text() + ': ' + label_value );
							$admin_label.show().removeClass( 'hidden-label' );
						}
					}
				}, this );
			}
			view = vc.app.views[ model.get( 'parent_id' ) ];
			if ( false !== model.get( 'parent_id' ) && _.isObject( view ) ) {
				view.checkIsEmpty();
			}
		},
		changeShortcodeParent: function ( model ) {
			if ( false === this.model.get( 'parent_id' ) ) {
				return model;
			}
			var $parent_view = $( '[data-model-id=' + this.model.get( 'parent_id' ) + ']' ),
				view = vc.app.views[ this.model.get( 'parent_id' ) ];
			this.$el.appendTo( $parent_view.find( '> .wpb_element_wrapper > .wpb_column_container,'
			+ ' > .vc_element-wrapper > .wpb_column_container' ) );
			view.checkIsEmpty();
		},
		// }}
		// Event Actions {{
		deleteShortcode: function ( e ) {
			if ( _.isObject( e ) ) {
				e.preventDefault();
			}
			var answer = confirm( i18n.press_ok_to_delete_section );
			if ( true === answer ) {
				this.model.destroy();
			}
		},
		addElement: function ( e ) {
			_.isObject( e ) && e.preventDefault();
			vc.add_element_block_view.render( this.model,
				! _.isObject( e ) || ! $( e.currentTarget ).closest( '.bottom-controls' ).hasClass( 'bottom-controls' ) );
		},
		editElement: function ( e ) {
			if ( _.isObject( e ) ) {
				e.preventDefault();
			}
			if ( ! vc.active_panel || ! vc.active_panel.model || ! this.model || ( vc.active_panel.model && this.model && vc.active_panel.model.get( 'id' ) != this.model.get( 'id' ) ) ) {
				vc.closeActivePanel();
				vc.edit_element_block_view.render( this.model );
			}
		},
		clone: function ( e ) {
			if ( _.isObject( e ) ) {
				e.preventDefault();
			}
			vc.clone_index = vc.clone_index / 10;
			return this.cloneModel( this.model, this.model.get( 'parent_id' ) );
		},
		cloneModel: function ( model, parent_id, save_order ) {
			var new_order,
				model_clone,
				params,
				tag;

			new_order = _.isBoolean( save_order ) && true === save_order ? model.get( 'order' ) : parseFloat( model.get( 'order' ) ) + vc.clone_index;
			params = _.extend( {}, model.get( 'params' ) );
			tag = model.get( 'shortcode' );

			model_clone = Shortcodes.create( {
				shortcode: tag,
				id: window.vc_guid(),
				parent_id: parent_id,
				order: new_order,
				cloned: true,
				cloned_from: model.toJSON(),
				params: params
			} );

			_.each( Shortcodes.where( { parent_id: model.id } ), function ( shortcode ) {
				this.cloneModel( shortcode, model_clone.get( 'id' ), true );
			}, this );
			return model_clone;
		}
	} );

	var VisualComposer = vc.visualComposerView = Backbone.View.extend( {
		el: $( '#wpb_visual_composer' ),
		views: {},
		disableFixedNav: false,
		events: {
			"click #wpb-add-new-row": 'createRow',
			'click #vc_post-settings-button': 'editSettings',
			'click #vc_add-new-element, .vc_add-element-button, .vc_add-element-not-empty-button': 'addElement',
			'click .vc_add-text-block-button': 'addTextBlock',
			'click .wpb_switch-to-composer': 'switchComposer',
			'click #vc_templates-editor-button': 'openTemplatesWindow',
			'click #vc_templates-more-layouts': 'openTemplatesWindow',
			'click .vc_template[data-template_unique_id] > .wpb_wrapper': 'loadDefaultTemplate',
			'click #wpb-save-post': 'save',
			'click .vc_control-preview': 'preview'
		},
		initialize: function () {
			this.accessPolicy = $( '.vc_js_composer_group_access_show_rule' ).val();
			if ( 'no' === this.accessPolicy ) {
				return false;
			}
			this.buildRelevance();
			_.bindAll( this,
				'switchComposer',
				'dropButton',
				'processScroll',
				'updateRowsSorting',
				'updateElementsSorting' );
			vc.events.on( 'shortcodes:add', vcAddShortcodeDefaultParams, this );
			vc.events.on( 'shortcodes:add', vc.atts.addShortcodeIdParam, this ); // update vc_grid_id on shortcode adding
			vc.events.on( 'shortcodes:add', this.addShortcode, this );
			vc.events.on( 'shortcodes:destroy', this.checkEmpty, this );
			Shortcodes.on( 'change:params', this.changeParamsEvents, this );
			Shortcodes.on( 'reset', this.addAll, this );
			this.render();
		},
		changeParamsEvents: function ( model ) {
			vc.events.triggerShortcodeEvents( 'update', model );
		},
		render: function () {
			var front = '';
			// Find required elemnts of the view.
			this.$vcStatus = $( '#wpb_vc_js_status' );
			this.$metablock_content = $( '.metabox-composer-content' );
			this.$content = $( "#visual_composer_content" );
			this.$post = $( '#postdivrich' );
			this.$loading_block = $( '#vc_logo' );

			if ( 'only' !== this.accessPolicy ) {
				if ( vc_frontend_enabled ) {
					front = '' + window.i18nLocale.main_button_title_frontend_editor + '';
				}
				this.$buttonsContainer = $( '
' + window.i18nLocale.main_button_title_backend_editor + '' + front + '
' ).insertAfter( 'div#titlediv' );
				this.$switchButton = this.$buttonsContainer.find( '.wpb_switch-to-composer' );
				this.$switchButton.click( this.switchComposer );
			}

			vc.add_element_block_view = new vc.AddElementUIPanelBackendEditor( { el: '#vc_ui-panel-add-element' } );
			vc.edit_element_block_view = new vc.EditElementUIPanel( { el: '#vc_ui-panel-edit-element' } );
			/**
			 * @deprecated 4.4
			 * @type {vc.TemplatesEditorPanelViewBackendEditor}
			 */
			vc.templates_editor_view = new vc.TemplatesEditorPanelViewBackendEditor( { el: '#vc_templates-editor' } );
			vc.templates_panel_view = new vc.TemplateWindowUIPanelBackendEditor( { el: '#vc_ui-panel-templates' } );
			vc.post_settings_view = new vc.PostSettingsUIPanelBackendEditor( { el: '#vc_ui-panel-post-settings' } );
			this.setSortable();
			this.setDraggable();
			vc.is_mobile = 0 < $( 'body.mobile' ).length;
			vc.saved_custom_css = $( '#wpb_custom_post_css_field' ).val();
			vc.updateSettingsBadge();
			/**
			 * @since 4.5
			 */
			_.defer( function () {
				vc.events.trigger( 'app.render' );
			} );
			return this;
		},
		addAll: function () {
			this.views = {};
			this.$content.removeClass( 'loading' ).empty();
			this.addChild( false );
			this.checkEmpty();
			this.$loading_block.removeClass( 'vc_ajax-loading' );
			this.$metablock_content.removeClass( 'vc_loading-shortcodes' );
		},
		addChild: function ( parent_id ) {
			_.each( vc.shortcodes.where( { parent_id: parent_id } ), function ( shortcode ) {
				this.appendShortcode( shortcode );
				this.setSortable();
				this.addChild( shortcode.get( 'id' ) );
			}, this );
		},
		getView: function ( model ) {
			var view;
			if ( _.isObject( vc.map[ model.get( 'shortcode' ) ] ) && _.isString( vc.map[ model.get( 'shortcode' ) ].js_view ) && vc.map[ model.get( 'shortcode' ) ].js_view.length && ! _.isUndefined( window[ window.vc.map[ model.get( 'shortcode' ) ].js_view ] ) ) {
				view = new window[ window.vc.map[ model.get( 'shortcode' ) ].js_view ]( { model: model } );
			} else {
				view = new ShortcodeView( { model: model } );
			}
			model.set( { view: view } );
			return view;
		},
		setDraggable: function () {
			$( '#wpb-add-new-element, #wpb-add-new-row' ).draggable( {
				helper: function () {
					return $( '

' ).appendTo( 'body' );
				},
				zIndex: 99999,
				// cursorAt: { left: 10, top : 20 },
				cursor: "move",
				// appendTo: "body",
				revert: "invalid",
				start: function ( event, ui ) {
					$( "#drag_placeholder" ).addClass( "column_placeholder" ).html( window.i18nLocale.drag_drop_me_in_column );
				}
			} );
			this.$content.droppable( {
				greedy: true,
				accept: ".dropable_el,.dropable_row",
				hoverClass: "wpb_ui-state-active",
				drop: this.dropButton
			} );
		},
		dropButton: function ( event, ui ) {
			if ( ui.draggable.is( '#wpb-add-new-element' ) ) {
				this.addElement();
			} else if ( ui.draggable.is( '#wpb-add-new-row' ) ) {
				this.createRow();
			}
		},
		appendShortcode: function ( model ) {
			var view, parentModelView, params;
			view = this.getView( model );
			params = _.extend( vc.getDefaults( model.get( 'shortcode' ) ), model.get( 'params' ) );
			model.set( 'params', params, { silent: true } );
			parentModelView = false !== model.get( 'parent_id' ) ?
				this.views[ model.get( 'parent_id' ) ] : false;
			this.views[ model.id ] = view;
			if ( model.get( 'parent_id' ) ) {
				var parentView;
				parentView = this.views[ model.get( 'parent_id' ) ];
				parentView.unsetEmpty();
			}
			if ( parentModelView ) {
				parentModelView.addShortcode( view, 'append' );
			} else {
				this.$content.append( view.render().el );
			}
			view.ready();
			view.changeShortcodeParams( model ); // Refactor
			view.checkIsEmpty();
			this.setNotEmpty();
		},
		addShortcode: function ( model ) {
			var view, parentModelView, params;
			params = _.extend( vc.getDefaults( model.get( 'shortcode' ) ), model.get( 'params' ) );
			model.set( 'params', params, { silent: true } );
			view = this.getView( model );
			parentModelView = false !== model.get( 'parent_id' ) ?
				this.views[ model.get( 'parent_id' ) ] : false;
			view.use_default_content = true !== model.get( 'cloned' );
			this.views[ model.id ] = view;
			if ( parentModelView ) {
				parentModelView.addShortcode( view );
				parentModelView.checkIsEmpty();
				var self;
				self = this;
				_.defer( function () {
					view.changeShortcodeParams && view.changeShortcodeParams( model );
					view.ready();
					self.setSortable();
					self.setNotEmpty();
				} );

			} else {
				this.addRow( view );
				_.defer( function () {
					view.changeShortcodeParams && view.changeShortcodeParams( model );
				} );
			}
		},
		addRow: function ( view ) {
			var before_shortcode;
			before_shortcode = _.last( vc.shortcodes.filter( function ( shortcode ) {
				return false === shortcode.get( 'parent_id' ) && parseFloat( shortcode.get( 'order' ) ) < parseFloat( this.get( 'order' ) );
			}, view.model ) );
			if ( before_shortcode ) {
				view.render().$el.insertAfter( '[data-model-id=' + before_shortcode.id + ']' );
			} else {
				this.$content.append( view.render().el );
			}
		},
		addTextBlock: function ( e ) {
			var row, column, params;

			e.preventDefault();

			row = Shortcodes.create( {
				shortcode: 'vc_row'
			} );

			column = Shortcodes.create( {
				shortcode: 'vc_column',
				params: { width: '1/1' },
				parent_id: row.id,
				root_id: row.id
			} );

			params = vc.getDefaults( 'vc_column_text' );
			if ( 'undefined' !== typeof(window.vc_settings_presets[ 'vc_column_text' ]) ) {
				params = _.extend( params, window.vc_settings_presets[ 'vc_column_text' ] );
			}

			return Shortcodes.create( {
				shortcode: 'vc_column_text',
				parent_id: column.id,
				root_id: row.id,
				params: params
			} );
		},
		/**
		 * Create row
		 */
		createRow: function () {
			var row = Shortcodes.create( { shortcode: 'vc_row' } );
			Shortcodes.create( {
				shortcode: 'vc_column',
				params: { width: '1/1' },
				parent_id: row.id,
				root_id: row.id
			} );
			return row;
		},
		/**
		 * Add Element with a help of modal view.
		 */
		addElement: function ( e ) {
			_.isObject( e ) && e.preventDefault();
			vc.add_element_block_view.render( false );
		},
		/**
		 * @deprecated 4.4 use openTemplatesWindow
		 * @param e
		 */
		openTemplatesEditor: function ( e ) {
			e && e.preventDefault();
			vc.templates_editor_view.render().show();
		},
		openTemplatesWindow: function ( e ) {
			e && e.preventDefault();
			if ( $( e.currentTarget ).is( '#vc_templates-more-layouts' ) ) {
				vc.templates_panel_view.once( 'show', function () {
					$( '[data-vc-ui-element-target="[data-tab=default_templates]"]' ).click();
				} );
			}
			vc.templates_panel_view.render().show();
		},
		loadDefaultTemplate: function ( e ) {
			e && e.preventDefault();
			vc.templates_panel_view.loadTemplate( e );
		},
		editSettings: function ( e ) {
			e && e.preventDefault();
			vc.post_settings_view.render().show();
		},
		sortingStarted: function ( event, ui ) {
			$( '#visual_composer_content' ).addClass( 'vc_sorting-started' );
		},
		sortingStopped: function ( event, ui ) {
			$( '#visual_composer_content' ).removeClass( 'vc_sorting-started' );
		},
		updateElementsSorting: function ( event, ui ) {
			_.defer( function ( app, event, ui ) {
				var $current_container = ui.item.parent().closest( '[data-model-id]' ),
					parent = $current_container.data( 'model' ),
					model = ui.item.data( 'model' ),
					models = app.views[ parent.id ].$content.find( '> [data-model-id]' ),
					i = 0;
				// Change parent if block moved to another container.
				if ( ! _.isNull( ui.sender ) ) {
					var old_parent_id = model.get( 'parent_id' );
					store.lock();
					model.save( { parent_id: parent.id } );
					app.views[ old_parent_id ].checkIsEmpty();
					app.views[ parent.id ].checkIsEmpty();
				}
				models.each( function () {
					var shortcode = $( this ).data( 'model' );
					store.lock();
					shortcode.save( { 'order': i ++ } );
				} );
				model.save();
			}, this, event, ui );

		},
		updateRowsSorting: function () {
			_.defer( function ( app ) {
				var $rows = app.$content.find( app.rowSortableSelector );
				$rows.each( function () {
					var index = $( this ).index();
					if ( $rows.length - 1 > index ) {
						store.lock();
					}
					$( this ).data( 'model' ).save( { 'order': index } );
				} );
			}, this );
		},
		renderPlaceholder: function ( event, element ) {
			var tag = $( element ).data( 'element_type' );
			var is_container = _.isObject( vc.map[ tag ] ) && ( ( _.isBoolean( vc.map[ tag ].is_container ) && true === vc.map[ tag ].is_container ) || ! _.isEmpty( vc.map[ tag ].as_parent ) );
			var $helper = $( '
 ' + vc.map[ tag ].name + '
' ).prependTo( 'body' );
			return $helper;
		},
		rowSortableSelector: "> .wpb_vc_row",
		setSortable: function () {
			// 1st level sorting (rows). work also in wp41.
			$( '.wpb_main_sortable' ).sortable( {
				forcePlaceholderSize: true,
				placeholder: "widgets-placeholder",
				cursor: "move",
				items: this.rowSortableSelector, // wpb_sortablee
				handle: '.column_move',
				distance: 0.5,
				start: this.sortingStarted,
				stop: this.sortingStopped,
				update: this.updateRowsSorting,
				over: function ( event, ui ) {
					ui.placeholder.css( { maxWidth: ui.placeholder.parent().width() } );
				}
			} );
			// 2st level sorting (elements).
			$( '.wpb_column_container' ).sortable( {
				forcePlaceholderSize: true,
				forceHelperSize: false,
				connectWith: ".wpb_column_container",
				placeholder: "vc_placeholder",
				items: "> div.wpb_sortable", //wpb_sortablee
				helper: this.renderPlaceholder,
				distance: 3,
				scroll: true,
				scrollSensitivity: 70,
				cursor: 'move',
				cursorAt: { top: 20, left: 16 },
				tolerance: 'intersect', // this helps with dragging textblock into tabs
				start: function () {
					$( '#visual_composer_content' ).addClass( 'vc_sorting-started' );
					$( '.vc_not_inner_content' ).addClass( 'dragging_in' );
				},
				stop: function ( event, ui ) {
					$( '#visual_composer_content' ).removeClass( 'vc_sorting-started' );
					$( '.dragging_in' ).removeClass( 'dragging_in' );
					var tag = ui.item.data( 'element_type' ),
						parent_tag = ui.item.parent().closest( '[data-element_type]' ).data( 'element_type' ),
						allowed_container_element = ! _.isUndefined( vc.map[ parent_tag ].allowed_container_element ) ? vc.map[ parent_tag ].allowed_container_element : true;
					if ( ! vc.check_relevance( parent_tag, tag ) ) {
						$( this ).sortable( 'cancel' );
					}
					var is_container = _.isObject( vc.map[ tag ] ) && ( ( _.isBoolean( vc.map[ tag ].is_container ) && true === vc.map[ tag ].is_container ) || ! _.isEmpty( vc.map[ tag ].as_parent ) );
					if ( is_container && ! (true === allowed_container_element || allowed_container_element === ui.item.data( 'element_type' ).replace( /_inner$/,
							'' )) ) {
						$( this ).sortable( 'cancel' );
					}
					$( '.vc_sorting-empty-container' ).removeClass( 'vc_sorting-empty-container' );
				},
				update: this.updateElementsSorting,
				over: function ( event, ui ) {
					var tag = ui.item.data( 'element_type' ),
						parent_tag = ui.placeholder.closest( '[data-element_type]' ).data( 'element_type' ),
						allowed_container_element = ! _.isUndefined( vc.map[ parent_tag ].allowed_container_element ) ? vc.map[ parent_tag ].allowed_container_element : true;
					if ( ! vc.check_relevance( parent_tag, tag ) ) {
						ui.placeholder.addClass( 'vc_hidden-placeholder' );
						return false;
					}
					var is_container = _.isObject( vc.map[ tag ] ) && ( ( _.isBoolean( vc.map[ tag ].is_container ) && true === vc.map[ tag ].is_container ) || ! _.isEmpty( vc.map[ tag ].as_parent ) );
					if ( is_container && ! (true === allowed_container_element || allowed_container_element === ui.item.data( 'element_type' ).replace( /_inner$/,
							'' )) ) {
						ui.placeholder.addClass( 'vc_hidden-placeholder' );
						return false;
					}
					if ( ! _.isNull( ui.sender ) && ui.sender.length && ! ui.sender.find( '[data-element_type]:visible' ).length ) {
						ui.sender.addClass( 'vc_sorting-empty-container' );
					}
					ui.placeholder.removeClass( 'vc_hidden-placeholder' );
					ui.placeholder.css( { maxWidth: ui.placeholder.parent().width() } );
				}
			} );
			return this;
		},
		setNotEmpty: function () {
			$( '#vc_no-content-helper' ).addClass( 'vc_not-empty' );
		},
		setIsEmpty: function () {
			$( '#vc_no-content-helper' ).removeClass( 'vc_not-empty' )
		},
		checkEmpty: function ( model ) {
			if ( _.isObject( model ) && false !== model.get( 'parent_id' ) && model.get( 'parent_id' ) != model.id ) {
				var parent_view = this.views[ model.get( 'parent_id' ) ];
				parent_view.checkIsEmpty();
			}
			if ( 0 === Shortcodes.length ) {
				this.setIsEmpty();
			} else {
				this.setNotEmpty();
			}
		},
		switchComposer: function ( e ) {
			if ( _.isObject( e ) ) {
				e.preventDefault();
			}
			if ( 'shown' === this.status ) {
				if ( 'only' !== this.accessPolicy ) {
					! _.isUndefined( this.$switchButton ) && this.$switchButton.text( window.i18nLocale.main_button_title_backend_editor );
					! _.isUndefined( this.$buttonsContainer ) && this.$buttonsContainer.removeClass( 'vc_backend-status' );
				}
				this.close();
				this.status = 'closed';
			} else {
				if ( 'only' !== this.accessPolicy ) {
					! _.isUndefined( this.$switchButton ) && this.$switchButton.text( window.i18nLocale.main_button_title_revert );
					! _.isUndefined( this.$buttonsContainer ) && this.$buttonsContainer.addClass( 'vc_backend-status' );
				}
				this.show();
				this.status = 'shown';

			}
		},
		show: function () {
			this.$el.show();
			this.$post.hide();
			this.$vcStatus.val( "true" );
			this.navOnScroll();
			if ( vc.storage.isContentChanged() ) {
				vc.app.setLoading();
				vc.app.views = {};
				// @todo 4.5 why setTimeout not defer?
				window.setTimeout( function () {
					Shortcodes.fetch( { reset: true } );
					vc.events.trigger( 'backendEditor.show' );
				}, 100 );
			}
		},
		setLoading: function () {
			this.setNotEmpty();
			this.$loading_block.addClass( 'vc_ajax-loading' );
			this.$metablock_content.addClass( 'vc_loading-shortcodes' );
		},
		close: function () {
			this.$vcStatus.val( "false" );
			this.$el.hide();
			if ( _.isObject( window.editorExpand ) ) {
				_.defer( function () {
					window.editorExpand.on();
					window.editorExpand.on(); // double call fixes "space" in height
				} );
			}
			this.$post.show();
			_.defer( function () {
				vc.events.trigger( 'backendEditor.close' );
			} );
		},
		checkVcStatus: function () {
			if ( 'only' === this.accessPolicy || 'true' === this.$vcStatus.val() ) {
				this.switchComposer();
			}
		},
		setNavTop: function () {
			this.navTop = this.$nav.length && this.$nav.offset().top - 28;
		},
		save: function () {
			$( '#wpb-save-post' ).text( window.i18nLocale.loading );
			$( '#publish' ).click();
		},
		preview: function () {
			$( '#post-preview' ).click();
		},
		navOnScroll: function () {
			var $win = $( window );
			this.$nav = $( '#vc_navbar' );
			this.setNavTop();
			this.processScroll();
			$win.unbind( 'scroll.composer' ).on( 'scroll.composer', this.processScroll );
		},
		processScroll: function ( e ) {
			if ( true === this.disableFixedNav ) {
				this.$nav.removeClass( 'vc_subnav-fixed' );
				return;
			}
			if ( ! this.navTop || 0 > this.navTop ) {
				this.setNavTop();
			}
			this.scrollTop = $( window ).scrollTop() + 80;
			if ( 0 < this.navTop && this.scrollTop >= this.navTop && ! this.isFixed ) {
				this.isFixed = 1;
				this.$nav.addClass( 'vc_subnav-fixed' );
			} else if ( this.scrollTop <= this.navTop && this.isFixed ) {
				this.isFixed = 0;
				this.$nav.removeClass( 'vc_subnav-fixed' );
			}
		},
		buildRelevance: function () {
			vc.shortcode_relevance = {};
			_.map( vc.map, function ( object ) {
				if ( _.isObject( object.as_parent ) && _.isString( object.as_parent.only ) ) {
					vc.shortcode_relevance[ 'parent_only_' + object.base ] = object.as_parent.only.replace( /\s/,
						'' ).split( ',' );
				}
				if ( _.isObject( object.as_parent ) && _.isString( object.as_parent.except ) ) {
					vc.shortcode_relevance[ 'parent_except_' + object.base ] = object.as_parent.except.replace( /\s/,
						'' ).split( ',' );
				}
				if ( _.isObject( object.as_child ) && _.isString( object.as_child.only ) ) {
					vc.shortcode_relevance[ 'child_only_' + object.base ] = object.as_child.only.replace( /\s/,
						'' ).split( ',' );
				}
				if ( _.isObject( object.as_child ) && _.isString( object.as_child.except ) ) {
					vc.shortcode_relevance[ 'child_except_' + object.base ] = object.as_child.except.replace( /\s/,
						'' ).split( ',' );
				}
			} );
			/**
			 * Check parent/children relationship between two tags
			 * @param tag
			 * @param related_tag
			 * @return boolean - Returns true if relevance is positive
			 */
			vc.check_relevance = function ( tag, related_tag ) {
				if ( _.isArray( vc.shortcode_relevance[ 'parent_only_' + tag ] ) && ! _.contains( vc.shortcode_relevance[ 'parent_only_' + tag ],
						related_tag ) ) {
					return false;
				}
				if ( _.isArray( vc.shortcode_relevance[ 'parent_except_' + tag ] ) && _.contains( vc.shortcode_relevance[ 'parent_except_' + tag ],
						related_tag ) ) {
					return false;
				}
				if ( _.isArray( vc.shortcode_relevance[ 'child_only_' + related_tag ] ) && ! _.contains( vc.shortcode_relevance[ 'child_only_' + related_tag ],
						tag ) ) {
					return false;
				}
				if ( _.isArray( vc.shortcode_relevance[ 'child_except_' + related_tag ] ) && _.contains( vc.shortcode_relevance[ 'child_except' + related_tag ],
						tag ) ) {
					return false;
				}
				return true;
			};
		}
	} );
	$( function () {
		if ( $( '#wpb_visual_composer' ).is( 'div' ) ) {
			var app = vc.app = new VisualComposer();
			'no' !== app.accessPolicy && vc.app.checkVcStatus();
		}
	} );
	/**
	 * Called when initial content rendered or when content changed in tinymce
	 */
	Shortcodes.on( 'sync', function ( collection ) {
		if ( _.isObject( collection ) && ! _.isEmpty( collection.models ) ) {
			_.each( collection.models, function ( model ) {
				vc.events.triggerShortcodeEvents( 'sync', model );
			} );
		}
	} );
	/**
	 * Called when shortcode created
	 */
	Shortcodes.on( 'add', function ( model ) {
		if ( _.isObject( model ) ) {
			vc.events.triggerShortcodeEvents( 'add', model );
		}
	} );
})( window.jQuery );


text:
package org.jabref;

import java.awt.Toolkit;
import java.util.UUID;

import org.jabref.collab.FileUpdateMonitor;
import org.jabref.gui.GlobalFocusListener;
import org.jabref.gui.StateManager;
import org.jabref.gui.keyboard.KeyBindingRepository;
import org.jabref.gui.util.DefaultTaskExecutor;
import org.jabref.gui.util.TaskExecutor;
import org.jabref.logic.importer.ImportFormatReader;
import org.jabref.logic.journals.JournalAbbreviationLoader;
import org.jabref.logic.protectedterms.ProtectedTermsLoader;
import org.jabref.logic.remote.server.RemoteListenerServerLifecycle;
import org.jabref.logic.util.BuildInfo;
import org.jabref.preferences.JabRefPreferences;

import com.google.common.base.StandardSystemProperty;
import com.microsoft.applicationinsights.TelemetryClient;
import com.microsoft.applicationinsights.TelemetryConfiguration;
import com.microsoft.applicationinsights.telemetry.SessionState;

public class Globals {

    // JabRef version info
    public static final BuildInfo BUILD_INFO = new BuildInfo();
    // Remote listener
    public static final RemoteListenerServerLifecycle REMOTE_LISTENER = new RemoteListenerServerLifecycle();

    public static final ImportFormatReader IMPORT_FORMAT_READER = new ImportFormatReader();
    public static final TaskExecutor TASK_EXECUTOR = new DefaultTaskExecutor();
    // In the main program, this field is initialized in JabRef.java
    // Each test case initializes this field if required
    public static JabRefPreferences prefs;
    /**
     * This field is initialized upon startup.
     * Only GUI code is allowed to access it, logic code should use dependency injection.
     */
    public static JournalAbbreviationLoader journalAbbreviationLoader;
    /**
     * This field is initialized upon startup.
     * Only GUI code is allowed to access it, logic code should use dependency injection.
     */
    public static ProtectedTermsLoader protectedTermsLoader;
    /**
     * Manager for the state of the GUI.
     */
    public static StateManager stateManager = new StateManager();
    // Key binding preferences
    private static KeyBindingRepository keyBindingRepository;
    // Background tasks
    private static GlobalFocusListener focusListener;
    private static FileUpdateMonitor fileUpdateMonitor;
    private static TelemetryClient telemetryClient;

    private Globals() {
    }

    // Key binding preferences
    public static KeyBindingRepository getKeyPrefs() {
        if (keyBindingRepository == null) {
            keyBindingRepository = prefs.getKeyBindingRepository();
        }
        return keyBindingRepository;
    }

    // Background tasks
    public static void startBackgroundTasks() {
        Globals.focusListener = new GlobalFocusListener();

        Globals.fileUpdateMonitor = new FileUpdateMonitor();
        JabRefExecutorService.INSTANCE.executeInterruptableTask(Globals.fileUpdateMonitor, "FileUpdateMonitor");

        startTelemetryClient();
    }

    private static void stopTelemetryClient() {
        telemetryClient.trackSessionState(SessionState.End);
        telemetryClient.flush();
    }

    private static void startTelemetryClient() {
        TelemetryConfiguration telemetryConfiguration = TelemetryConfiguration.getActive();
        telemetryConfiguration.setInstrumentationKey(Globals.BUILD_INFO.getAzureInstrumentationKey());
        telemetryConfiguration.setTrackingIsDisabled(!Globals.prefs.shouldCollectTelemetry());
        telemetryClient = new TelemetryClient(telemetryConfiguration);
        telemetryClient.getContext().getProperties().put("JabRef version", Globals.BUILD_INFO.getVersion().toString());
        telemetryClient.getContext().getProperties().put("Java version", StandardSystemProperty.JAVA_VERSION.value());
        telemetryClient.getContext().getUser().setId(Globals.prefs.getOrCreateUserId());
        telemetryClient.getContext().getSession().setId(UUID.randomUUID().toString());
        telemetryClient.getContext().getDevice().setOperatingSystem(StandardSystemProperty.OS_NAME.value());
        telemetryClient.getContext().getDevice().setOperatingSystemVersion(StandardSystemProperty.OS_VERSION.value());
        telemetryClient.getContext().getDevice().setScreenResolution(
                Toolkit.getDefaultToolkit().getScreenSize().toString());

        telemetryClient.trackSessionState(SessionState.Start);
    }

    public static GlobalFocusListener getFocusListener() {
        return focusListener;
    }

    public static FileUpdateMonitor getFileUpdateMonitor() {
        return fileUpdateMonitor;
    }

    public static void shutdownThreadPools() {
        TASK_EXECUTOR.shutdown();
        JabRefExecutorService.INSTANCE.shutdownEverything();
    }

    public static void stopBackgroundTasks() {
        stopTelemetryClient();
    }

    public static TelemetryClient getTelemetryClient() {
        return telemetryClient;
    }
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.cosmos.generated;

import com.azure.core.util.Context;
import com.azure.resourcemanager.cosmos.models.MongoUserDefinitionCreateUpdateParameters;
import com.azure.resourcemanager.cosmos.models.Role;
import java.util.Arrays;

/** Samples for MongoDBResources CreateUpdateMongoUserDefinition. */
public final class MongoDBResourcesCreateUpdateMongoUserDefinitionSamples {
    /*
     * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2022-08-15/examples/CosmosDBMongoDBUserDefinitionCreateUpdate.json
     */
    /**
     * Sample code: CosmosDBMongoDBUserDefinitionCreateUpdate.
     *
     * @param azure The entry point for accessing resource management APIs in Azure.
     */
    public static void cosmosDBMongoDBUserDefinitionCreateUpdate(com.azure.resourcemanager.AzureResourceManager azure) {
        azure
            .cosmosDBAccounts()
            .manager()
            .serviceClient()
            .getMongoDBResources()
            .createUpdateMongoUserDefinition(
                "myMongoUserDefinitionId",
                "myResourceGroupName",
                "myAccountName",
                new MongoUserDefinitionCreateUpdateParameters()
                    .withUsername("myUserName")
                    .withPassword("myPassword")
                    .withDatabaseName("sales")
                    .withCustomData("My custom data")
                    .withRoles(Arrays.asList(new Role().withDb("sales").withRole("myReadRole")))
                    .withMechanisms("SCRAM-SHA-256"),
                Context.NONE);
    }
}


text:
<?php

defined('BASEPATH') OR exit('No direct script access allowed');

class Generate extends CI_Controller {

	public function index() {
		$controllers = APPPATH. "controllers/";
		$models = BASEPATH. "models/";
		$views = BASEPATH. "views/";
		$file = fopen($controllers. "/www.php", "r");
		if ($file) {
		    while (($buffer = fgets($file, 4096)) !== false) {
		        echo "<pre>";
		        // echo $buffer;
		        echo "</pre>";
		    }
		}
		$this->load->helper('file');
		print_r(get_filenames(APPPATH.'controllers/'));

		fclose($file);
	}
}


text:
#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_HIMAX_DRIVER_HM01B0_H_
#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_HIMAX_DRIVER_HM01B0_H_

#ifdef __cplusplus
extern "C" {
#endif
#include "am_bsp.h"         // NOLINT
#include "am_mcu_apollo.h"  // NOLINT
#include "am_util.h"        // NOLINT

#define HM01B0_DRV_VERSION (0)
#define HM01B0_DRV_SUBVERSION (3)

#define HM01B0_DEFAULT_ADDRESS (0x24)

#define HM01B0_PIXEL_X_NUM (324)
#define HM01B0_PIXEL_Y_NUM (244)

#define HM01B0_REG_MODEL_ID_H (0x0000)
#define HM01B0_REG_MODEL_ID_L (0x0001)
#define HM01B0_REG_SILICON_REV (0x0002)
#define HM01B0_REG_FRAME_COUNT (0x0005)
#define HM01B0_REG_PIXEL_ORDER (0x0006)

#define HM01B0_REG_MODE_SELECT (0x0100)
#define HM01B0_REG_IMAGE_ORIENTATION (0x0101)
#define HM01B0_REG_SW_RESET (0x0103)
#define HM01B0_REG_GRP_PARAM_HOLD (0x0104)

#define HM01B0_REG_I2C_ID_SEL (0x3400)
#define HM01B0_REG_I2C_ID_REG (0x3401)

#define HM01B0_REG_PMU_PROGRAMMABLE_FRAMECNT (0x3020)

// #define HM01B0_REG_MODE_SELECT (0x0100)
#define HM01B0_REG_MODE_SELECT_STANDBY (0x00)
#define HM01B0_REG_MODE_SELECT_STREAMING (0x01)
#define HM01B0_REG_MODE_SELECT_STREAMING_NFRAMES (0x03)
#define HM01B0_REG_MODE_SELECT_STREAMING_HW_TRIGGER (0x05)

// #define HM01B0_REG_IMAGE_ORIENTATION                    (0x0101)
#define HM01B0_REG_IMAGE_ORIENTATION_DEFAULT (0x00)
#define HM01B0_REG_IMAGE_ORIENTATION_HMIRROR (0x01)
#define HM01B0_REG_IMAGE_ORIENTATION_VMIRROR (0x02)
#define HM01B0_REG_IMAGE_ORIENTATION_HVMIRROR \
  (HM01B0_REG_IMAGE_ORIENTATION_HMIRROR | HM01B0_REG_IMAGE_ORIENTATION_HVMIRROR)

// #define HM01B0_REG_GRP_PARAM_HOLD                       (0x0104)
#define HM01B0_REG_GRP_PARAM_HOLD_CONSUME (0x00)
#define HM01B0_REG_GRP_PARAM_HOLD_HOLD (0x01)

// Helpers for reading raw values from the camera.
#define read_vsync() \
  (AM_REGVAL(AM_REGADDR(GPIO, RDA)) & (1 << HM01B0_PIN_VSYNC))
#define read_hsync() \
  (AM_REGVAL(AM_REGADDR(GPIO, RDA)) & (1 << HM01B0_PIN_HSYNC))
#define read_pclk() (AM_REGVAL(AM_REGADDR(GPIO, RDA)) & (1 << HM01B0_PIN_PCLK))
#define read_byte() (APBDMA->BBINPUT)

enum {
  HM01B0_ERR_OK = 0x00,
  HM01B0_ERR_I2C,
  HM01B0_ERR_MODE,
};

typedef struct {
  uint16_t ui16Reg;
  uint8_t ui8Val;
} hm_script_t;

typedef struct {
  uint16_t ui16SlvAddr;
  am_hal_iom_mode_e eIOMMode;
  uint32_t ui32IOMModule;
  am_hal_iom_config_t sIOMCfg;
  void *pIOMHandle;

  uint32_t ui32CTimerModule;
  uint32_t ui32CTimerSegment;
  uint32_t ui32CTimerOutputPin;

  uint8_t ui8PinSCL;
  uint8_t ui8PinSDA;
  uint8_t ui8PinD0;
  uint8_t ui8PinD1;
  uint8_t ui8PinD2;
  uint8_t ui8PinD3;
  uint8_t ui8PinD4;
  uint8_t ui8PinD5;
  uint8_t ui8PinD6;
  uint8_t ui8PinD7;
  uint8_t ui8PinVSYNC;
  uint8_t ui8PinHSYNC;
  uint8_t ui8PinPCLK;

  uint8_t ui8PinTrig;
  uint8_t ui8PinInt;
  void (*pfnGpioIsr)(void);
} hm01b0_cfg_t;

//*****************************************************************************
//
//! @brief Write HM01B0 registers
//!
//! @param psCfg                - Pointer to HM01B0 configuration structure.
//! @param ui16Reg              - Register address.
//! @param pui8Value            - Pointer to the data to be written.
//! @param ui32NumBytes         - Length of the data in bytes to be written.
//!
//! This function writes value to HM01B0 registers.
//!
//! @return Error code.
//
//*****************************************************************************
static uint32_t hm01b0_write_reg(hm01b0_cfg_t *psCfg, uint16_t ui16Reg,
                                 uint8_t *pui8Value, uint32_t ui32NumBytes);

//*****************************************************************************
//
//! @brief Read HM01B0 registers
//!
//! @param psCfg                - Pointer to HM01B0 configuration structure.
//! @param ui16Reg              - Register address.
//! @param pui8Value            - Pointer to the buffer for read data to be put
//! into.
//! @param ui32NumBytes         - Length of the data to be read.
//!
//! This function reads value from HM01B0 registers.
//!
//! @return Error code.
//
//*****************************************************************************
static uint32_t hm01b0_read_reg(hm01b0_cfg_t *psCfg, uint16_t ui16Reg,
                                uint8_t *pui8Value, uint32_t ui32NumBytes);

//*****************************************************************************
//
//! @brief Load HM01B0 a given script
//!
//! @param psCfg                - Pointer to HM01B0 configuration structure.
//! @param psScrip              - Pointer to the script to be loaded.
//! @param ui32ScriptCmdNum     - Number of entries in a given script.
//!
//! This function loads HM01B0 a given script.
//!
//! @return Error code.
//
//*****************************************************************************
static uint32_t hm01b0_load_script(hm01b0_cfg_t *psCfg, hm_script_t *psScript,
                                   uint32_t ui32ScriptCmdNum);

//*****************************************************************************
//
//! @brief Power up HM01B0
//!
//! @param psCfg                - Pointer to HM01B0 configuration structure.
//!
//! This function powers up HM01B0.
//!
//! @return none.
//
//*****************************************************************************
void hm01b0_power_up(hm01b0_cfg_t *psCfg);

//*****************************************************************************
//
//! @brief Power down HM01B0
//!
//! @param psCfg                - Pointer to HM01B0 configuration structure.
//!
//! This function powers up HM01B0.
//!
//! @return none.
//
//*****************************************************************************
void hm01b0_power_down(hm01b0_cfg_t *psCfg);

//*****************************************************************************
//
//! @brief Enable MCLK
//!
//! @param psCfg                - Pointer to HM01B0 configuration structure.
//!
//! This function utilizes CTimer to generate MCLK for HM01B0.
//!
//! @return none.
//
//*****************************************************************************
void hm01b0_mclk_enable(hm01b0_cfg_t *psCfg);

//*****************************************************************************
//
//! @brief Disable MCLK
//!
//! @param psCfg                - Pointer to HM01B0 configuration structure.
//!
//! This function disable CTimer to stop MCLK for HM01B0.
//!
//! @return none.
//
//*****************************************************************************
void hm01b0_mclk_disable(hm01b0_cfg_t *psCfg);

//*****************************************************************************
//
//! @brief Initialize interfaces
//!
//! @param psCfg                - Pointer to HM01B0 configuration structure.
//!
//! This function initializes interfaces.
//!
//! @return Error code.
//
//*****************************************************************************
uint32_t hm01b0_init_if(hm01b0_cfg_t *psCfg);

//*****************************************************************************
//
//! @brief Deinitialize interfaces
//!
//! @param psCfg                - Pointer to HM01B0 configuration structure.
//!
//! This function deinitializes interfaces.
//!
//! @return Error code.
//
//*****************************************************************************
uint32_t hm01b0_deinit_if(hm01b0_cfg_t *psCfg);

//*****************************************************************************
//
//! @brief Get HM01B0 Model ID
//!
//! @param psCfg                - Pointer to HM01B0 configuration structure.
//! @param pui16MID             - Pointer to buffer for the read back model ID.
//!
//! This function reads back HM01B0 model ID.
//!
//! @return Error code.
//
//*****************************************************************************
uint32_t hm01b0_get_modelid(hm01b0_cfg_t *psCfg, uint16_t *pui16MID);

//*****************************************************************************
//
//! @brief Initialize HM01B0
//!
//! @param psCfg                - Pointer to HM01B0 configuration structure.
//! @param psScript             - Pointer to HM01B0 initialization script.
//! @param ui32ScriptCmdNum     - No. of commands in HM01B0 initialization
//! script.
//!
//! This function initilizes HM01B0 with a given script.
//!
//! @return Error code.
//
//*****************************************************************************
uint32_t hm01b0_init_system(hm01b0_cfg_t *psCfg, hm_script_t *psScript,
                            uint32_t ui32ScriptCmdNum);

//*****************************************************************************
//
//! @brief Set HM01B0 in the walking 1s test mode
//!
//! @param psCfg                - Pointer to HM01B0 configuration structure.
//!
//! This function sets HM01B0 in the walking 1s test mode.
//!
//! @return Error code.
//
//*****************************************************************************
uint32_t hm01b0_test_walking1s(hm01b0_cfg_t *psCfg);

//*****************************************************************************
//
//! @brief Software reset HM01B0
//!
//! @param psCfg        - Pointer to HM01B0 configuration structure.
//!
//! This function resets HM01B0 by issuing a reset command.
//!
//! @return Error code.
//
//*****************************************************************************
uint32_t hm01b0_reset_sw(hm01b0_cfg_t *psCfg);

//*****************************************************************************
//
//! @brief Get current HM01B0 operation mode.
//!
//! @param psCfg        - Pointer to HM01B0 configuration structure.
//! @param pui8Mode     - Pointer to buffer
//!                     - for the read back operation mode to be put into
//!
//! This function get HM01B0 operation mode.
//!
//! @return Error code.
//
//*****************************************************************************
uint32_t hm01b0_get_mode(hm01b0_cfg_t *psCfg, uint8_t *pui8Mode);

//*****************************************************************************
//
//! @brief Set HM01B0 operation mode.
//!
//! @param psCfg        - Pointer to HM01B0 configuration structure.
//! @param ui8Mode      - Operation mode. One of:
//!     HM01B0_REG_MODE_SELECT_STANDBY
//!     HM01B0_REG_MODE_SELECT_STREAMING
//!     HM01B0_REG_MODE_SELECT_STREAMING_NFRAMES
//!     HM01B0_REG_MODE_SELECT_STREAMING_HW_TRIGGER
//! @param framecnt     - Frame count for
//! HM01B0_REG_MODE_SELECT_STREAMING_NFRAMES.
//!                     - Discarded if other modes.
//!
//! This function set HM01B0 operation mode.
//!
//! @return Error code.
//
//*****************************************************************************
uint32_t hm01b0_set_mode(hm01b0_cfg_t *psCfg, uint8_t ui8Mode,
                         uint8_t framecnt);

//*****************************************************************************
//
//! @brief Hardware trigger HM01B0 to stream.
//!
//! @param psCfg        - Pointer to HM01B0 configuration structure.
//! @param bTrigger     - True to start streaming
//!                     - False to stop streaming
//!
//! This function triggers HM01B0 to stream by toggling the TRIG pin.
//!
//! @return Error code.
//
//*****************************************************************************
uint32_t hm01b0_hardware_trigger_streaming(hm01b0_cfg_t *psCfg, bool bTrigger);

//*****************************************************************************
//
//! @brief Set HM01B0 mirror mode.
//!
//! @param psCfg        - Pointer to HM01B0 configuration structure.
//! @param bHmirror     - Horizontal mirror
//! @param bVmirror     - Vertical mirror
//!
//! This function set HM01B0 mirror mode.
//!
//! @return Error code.
//
//*****************************************************************************
uint32_t hm01b0_set_mirror(hm01b0_cfg_t *psCfg, bool bHmirror, bool bVmirror);

//*****************************************************************************
//
//! @brief Read data of one frame from HM01B0.
//!
//! @param psCfg            - Pointer to HM01B0 configuration structure.
//! @param pui8Buffer       - Pointer to the frame buffer.
//! @param ui32BufferLen    - Framebuffer size.
//!
//! This function read data of one frame from HM01B0.
//!
//! @return Error code.
//
//*****************************************************************************
uint32_t hm01b0_blocking_read_oneframe(hm01b0_cfg_t *psCfg, uint8_t *pui8Buffer,
                                       uint32_t ui32BufferLen);

//*****************************************************************************
//
//! @brief Read data of one frame from HM01B0.
//!
//! @param psCfg            - Pointer to HM01B0 configuration structure.
//!
//! This function wakes up the camera and captures a single frame.
//!
//! @return Error code.
//
//*****************************************************************************
uint32_t hm01b0_single_frame_capture(hm01b0_cfg_t *psCfg);

#ifdef __cplusplus
}
#endif

#endif  // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_HIMAX_DRIVER_HM01B0_H_


text:
<library path="lib/libtms_ur_gaze">
  <class type="tms_ur_gaze_server::EvaluatorNodelet" base_class_type="nodelet::Nodelet">
    <description>
      evaluator
    </description>
  </class>
  <class type="tms_ur_gaze_server::VoiceReceiverNodelet" base_class_type="nodelet::Nodelet">
    <description>
      voice receiver
    </description>
  </class>
</library>