text:
<include file="Public/mobile_head"/>

<link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
   <link type="text/css" href="__STATIC__/jquery-ui-bootstrap/css/custom-theme/jquery-ui-1.10.0.custom.css" rel="stylesheet" />
    <link rel="stylesheet" href="__STATIC__/font-awesome/css/font-awesome.min.css">

<link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">

            <link href="__STATIC__/jquery-ui-bootstrap/assets/css/google-code-prettify/prettify.css" rel="stylesheet">

<link href="{:CUSTOM_TEMPLATE_PATH}Index/ColorV1/main.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">
   <link href="__PUBLIC__/Home/css/style.css" rel="stylesheet">

	<if condition="$Think.cookie.mosqueName eq '' ">
					<else/>

		退出

	</if>

{$detail.name}主页

							基本信息

名称{$detail.name}

主持{$detail.linkman}

地址{$detail.s_province}{$detail.s_county}{$detail.s_city}{$detail.address}

						{$detail.name}主页二维码

							 		<if condition="$Think.cookie.mosqueName eq '{$detail.name}' ">

							 			<else/>

1))}">刷新重新生成二维码

										</if>

关注伊媒微时代--伊媒生活--清真寺,以后相关的资讯和通知通过该平台发布

							 			截图保存二维码并在微信扫描

扫描方法:扫一扫界面->点相册->选择二维码图片

						相关通知

			      		<volist name="notice" id="vo" mod="2">

{$vo.title}

										<if condition="$Think.cookie.mosqueName neq '{$detail.name}' ">
											<else/>

										 		 $vo['id']))}">
										 			 修改

										 		 删除

											</if>

{$vo.content}

						  </volist>

		<if condition="$Think.cookie.mosqueName neq '{$detail.name}' ">
					<else/>

								我要通知

						   <form class="form-horizontal" id="notice" action="{:addons_url('WeiSite://MosqueNotice/indexAdd')}" method="post">

我要发布信息

									      <input type="text" name="title"class="form-control" id="" placeholder="请输入名称">

		                                <textarea   name="content" class="form-control validate[required,maxSize[50]]" rows="3" placeholder="填写您让我们大家知道的消息" name="content"></textarea>

				             <input type="hidden" name="submit"  value="1" />

						      <button type="submit" class="btn  btn-success btn-sm">提交</button>

						</form>

					  </if>

					相关资讯

您要是也想丰富自己站点的信息,请将您的资讯信息发送至邮箱292334666@qq.com

			      		<volist name="article" id="vo">
			      			<empty name="vo.url">
			      			  $vo['id'],'type'=>1))}">

									 			 {$vo.title|msubstr=0,12,'utf-8',true}

							   	<else />

							 				{$vo.title|msubstr=0,12,'utf-8',true}

								</empty>
						  </volist>

{$footer_html}

<notempty name="config.code">

{$config.code}

<else />

{$tongji_code}

</notempty>

 <link href="__STATIC__/datetimepicker/css/datetimepicker.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">
  <php>if(C('COLOR_STYLE')=='blue_color') echo '
    <link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">
    ';</php>
  <link href="__STATIC__/datetimepicker/css/dropdown.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">


text:
namespace caffe {

template <typename Dtype>
void MultiSoftmaxLossLayer<Dtype>::LayerSetUp(
    const vector<Blob<Dtype>*>& bottom, vector<Blob<Dtype>*>* top) {
  LossLayer<Dtype>::LayerSetUp(bottom, top);
  num_class_ = this->layer_param_.multi_softmax_loss_param().class_per_group();
}

template <typename Dtype>
void MultiSoftmaxLossLayer<Dtype>::Reshape(
    const vector<Blob<Dtype>*>& bottom, vector<Blob<Dtype>*>* top) {
  LossLayer<Dtype>::Reshape(bottom, top);
  CHECK_EQ(bottom[0]->count()/bottom[0]->num()%num_class_, 0)
  	<< "Input dimension must be multiple of num_class_!";
  CHECK_EQ(bottom[0]->count()/num_class_, bottom[1]->count())
    << "Inconsistent input and label dimensions!";
  acc_.Reshape(bottom[0]->num(), bottom[0]->count()/bottom[0]->num()/num_class_, 1, 1);
  loss_.Reshape(bottom[0]->num(), bottom[0]->count()/bottom[0]->num()/num_class_, 1, 1);

  if (this->layer_param_.loss_weight_size() == 1)
    this->layer_param_.add_loss_weight(Dtype(0));
  (*top)[1]->Reshape(1, 1, 1, 1);
  if (this->layer_param_.loss_weight_size() == 2)
    this->layer_param_.add_loss_weight(Dtype(0));
  (*top)[2]->Reshape(bottom[0]->num(), num_class_, 1, bottom[0]->count()/bottom[0]->num()/num_class_);
}

template <typename Dtype>
void MultiSoftmaxLossLayer<Dtype>::Forward_cpu(
    const vector<Blob<Dtype>*>& bottom, vector<Blob<Dtype>*>* top) {
  // The forward pass computes the softmax prob values.
  LOG(ERROR) << "Forward_cpu not implemented for MultiSoftmaxLossLayer";
}

template <typename Dtype>
void MultiSoftmaxLossLayer<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& top,
    const vector<bool>& propagate_down,
    vector<Blob<Dtype>*>* bottom) {
  LOG(ERROR) << "Backward_cpu not implemented for MultiSoftmaxLossLayer";
}

#ifdef CPU_ONLY
STUB_GPU(MultiSoftmaxLossLayer);
#endif

INSTANTIATE_CLASS(MultiSoftmaxLossLayer);

}  // namespace caffe

redpajama_set_name: RedPajamaGithub


text:
package com.coroptis.jblinktree.junit;

import static org.easymock.EasyMock.anyObject;
import static org.easymock.EasyMock.eq;
import static org.easymock.EasyMock.expect;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import org.easymock.EasyMock;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.coroptis.jblinktree.JbTreeImpl;
import com.coroptis.jblinktree.Node;
import com.coroptis.jblinktree.type.Wrapper;
import com.coroptis.jblinktree.util.JbStack;

/**
 * Junit test form {@link JbTreeImpl}.
 *
 * @author jajir
 *
 */
public class JbTreeTest extends AbstractMockingTest {

    private JbTreeImpl<Integer, Integer> jbTree;

    @Test
    public void test_insert_null_key() throws Exception {
        EasyMock.replay(mocks);

        try {
            jbTree.insert(null, 3);
            fail();
        } catch (NullPointerException e) {
            assertTrue(true);
        }

        EasyMock.verify(mocks);
    }

    @Test
    public void test_insert_null_value() throws Exception {
        EasyMock.replay(mocks);

        try {
            jbTree.insert(Wrapper.make(3,tdi), null);
            fail();
        } catch (NullPointerException e) {
            assertTrue(true);
        }

        EasyMock.verify(mocks);
    }

    @Test
    public void test_insert_new_key() throws Exception {
        record_find_node();
        expect(nodeService.getValueByKey(n2, w1)).andReturn(null);
        expect(treeHelper.insertToLeafNode(eq(n2), eq(w1), eq(-99),
                (JbStack) anyObject())).andReturn(null);

        replay();
        Integer ret = jbTree.insert(w1, -99);
        verify();
        assertNull(ret);
    }

    @Test
    public void test_insert_alreadyExisting_key() throws Exception {
        record_find_node();
        expect(nodeService.getValueByKey(n2, w1)).andReturn(-88);
        jbTreeService.storeValueIntoNode(n2, w1, -99);

        replay();
        Integer ret = jbTree.insert(w1, -99);
        verify();
        assertEquals(Integer.valueOf(-88), ret);
    }

    private void record_find_node() {
        EasyMock.expect(treeData.getRootNodeId()).andReturn(64);
        EasyMock.expect(
                treeTool.findLeafNodeId(eq(w1), (JbStack) anyObject(), eq(64)))
                .andReturn(11);
        expect(nodeStore.getAndLock(11)).andReturn((Node) n1);
        expect(treeTraversingService.moveRightLeafNode(n1, w1))
                .andReturn((Node) n2);
    }

    @Override
    @Before
    public void setUp() throws Exception {
        super.setUp();
        jbTree = new JbTreeImpl<Integer, Integer>(nodeStore, treeTool,
                treeHelper, treeData, treeTraversingService, jbTreeService,
                nodeService);
    }

    @Override
    @After
    public void tearDown() throws Exception {
        jbTree = null;
        super.tearDown();
    }

}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.pamarin.game24;

/**
 *
 * @author jittagornp
 */
public class ParentThesisGenerator {

    private static boolean isSingle(String str) {
        return str.matches("^(\\([\\d]{2}\\)).*|.*(\\([\\d]{2}\\))$");
    }

    private static boolean invalid(String str) {
        return str.matches(".*\\([\\d]\\).*");
    }

    private static void generate(int n, int opened, int closed, String print, int index) {
        if (opened < n) {
            generate(n, opened + 1, closed, print + "(" + index, (index + 1));
        }

        if (closed < opened) {
            generate(n, opened, closed + 1, print + "" + index + ")", (index + 1));
        }

        if (opened == closed && opened == n) {
            if (!isSingle(print)) {
                for (int i = 0; i <= 5; i++) {
                    String replace = print.replace(i + "", "");
                    if (!invalid(replace)) {
                        System.out.println(replace.substring(1, replace.length() - 1));
                    }
                }
            }
        }
    }

    public static void main(String[] args) {
        generate(2, 0, 0, "", 0);
    }
}


text: ActiveRecord::Base.send(:include, Webmapps::ActsAsSpatial)


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;
using NetExtensions;

namespace NetExtensions.Test
{
    public class IntExtensionsTest
    {
        [Fact]
        public void CanDeriveDaysFromInt()
        {
            var result = 5.Days();

            Assert.Equal(new TimeSpan(5, 0, 0, 0), result);
            Assert.Equal(new TimeSpan(5, 0, 0, 0).Days, result.Days);
        }

        [Fact]
        public void CanDeriveHoursFromInt()
        {
            var result = 5.Hours();

            Assert.Equal(new TimeSpan(5, 0, 0), result);
            Assert.Equal(new TimeSpan(5, 0, 0).Hours, result.Hours);
        }

        [Fact]
        public void CanDeriveMinutesFromInt()
        {
            var result = 5.Minutes();

            Assert.Equal(new TimeSpan(0, 5, 0), result);
            Assert.Equal(new TimeSpan(0, 5, 0).Minutes, result.Minutes);
        }

        [Fact]
        public void CanDeriveSecondsFromInt()
        {
            var result = 5.Seconds();

            Assert.Equal(new TimeSpan(0, 0, 5), result);
            Assert.Equal(new TimeSpan(0, 0, 5).Seconds, result.Seconds);
        }

        [Fact]
        public void CanDeriveMillisecondsFromInt()
        {
            var result = 5.Milliseconds();

            Assert.Equal(new TimeSpan(0, 0, 0, 0, 5), result);
            Assert.Equal(new TimeSpan(0, 0, 0, 0, 5).Milliseconds, result.Milliseconds);
        }

    }
}


text:
"""
Clase C{OrOperatorNode} del árbol de sintáxis abstracta.
"""

from pytiger2c.ast.binarylogicaloperatornode import BinaryLogicalOperatorNode
from pytiger2c.types.integertype import IntegerType

class OrOperatorNode(BinaryLogicalOperatorNode):
    """
    Clase C{OrOperatorNode} del árbol de sintáxis abstracta.

    Representa la operación lógica C{OR}, representada con el operador C{|}
    en Tiger, entre dos números enteros. Este operador retornará 1 en caso
    de que el resultado de evaluar la expresión sea verdadero, 0 en otro caso.
    """

    def __init__(self, left, right):
        """
        Inicializa la clase C{OrOperatorNode}.

        Para obtener información acerca de los parámetros recibidos por
        este método consulte la documentación del método C{__init__}
        en la clase C{BinaryOperatorNode}.
        """
        super(OrOperatorNode, self).__init__(left, right)

    def generate_code(self, generator):
        """
        Genera el código C correspondiente a la estructura del lenguaje Tiger
        representada por el nodo.

        @type generator: C{CodeGenerator}
        @param generator: Clase auxiliar utilizada en la generación del
            código C correspondiente a un programa Tiger.

        @raise CodeGenerationError: Esta excepción se lanzará cuando se produzca
            algún error durante la generación del código correspondiente al nodo.
            La excepción contendrá información acerca del error.
        """
        self.scope.generate_code(generator)
        result_var = generator.define_local(IntegerType().code_type)
        self.left.generate_code(generator)
        generator.add_statement('if ({left}) {{'.format(left=self.left.code_name))
        generator.add_statement('{result} = 1; }}'.format(result=result_var))
        generator.add_statement('else {')
        self.right.generate_code(generator)
        generator.add_statement('if ({right}) {{'.format(right=self.right.code_name))
        generator.add_statement('{result} = 1; }}'.format(result=result_var))
        generator.add_statement('else {')
        generator.add_statement('{result} = 0; }}'.format(result=result_var))
        generator.add_statement('}')
        self._code_name = result_var


text:
<?php
define('DEBUG', 'on');
define('ROOT_PATH', realpath(__DIR__ . '/../'));
define("TASK_PATH", ROOT_PATH . '/tasks/');

require ROOT_PATH . '/vendor/autoload.php';
$config = require __DIR__.'/config.php';

$server = new \Sts\Server($config);
$app = new \Sts\App();
$server->setApp($app);
$server->run();


text:
<?php

/**
 * @file
 * Contains \Drupal\user\Plugin\Validation\Constraint\UserNameUnique.
 */

namespace Drupal\user\Plugin\Validation\Constraint;

use Symfony\Component\Validator\Constraint;
use Drupal\Component\Annotation\Plugin;
use Drupal\Core\Annotation\Translation;

/**
 * Checks if a user name is unique on the site.
 *
 * @Plugin(
 *   id = "UserNameUnique",
 *   label = @Translation("User name unique", context = "Validation")
 * )
 */
class UserNameUnique extends Constraint {

  public $message = 'The name %value is already taken.';

  /**
   * {@inheritdoc}
   */
  public function validatedBy() {
    return '\Drupal\user\Plugin\Validation\Constraint\UserUniqueValidator';
  }
}


text:
package com.entertailion.android.overlaynews.rss;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import android.graphics.Bitmap;

import com.entertailion.android.overlaynews.R;

/**
 * Data structure for RSS feed
 *
 * @author leon_nicholls
 *
 */
public class RssFeed implements Comparable<RssFeed> {
	private int id;
	private String title;
	private String link;
	private String description;
	private Date date;
	private Date viewDate;
	private ArrayList<RssItem> items;
	private String logo;
	private String image;
	private Bitmap bitmap;
	private int ttl;

	public RssFeed(int id, String title, String link, String description, Date date, Date viewDate, String logo, String image, Bitmap bitmap, int ttl) {
		this();
		this.id = id;
		this.title = title;
		this.link = link;
		this.description = description;
		this.date = date;
		this.viewDate = viewDate;
		this.logo = logo;
		this.image = image;
		this.bitmap = bitmap;
		this.ttl = ttl;
	}

	public RssFeed() {
		this.items = new ArrayList<RssItem>();
		this.date = new Date(0);
		this.viewDate = new Date(0);
		this.ttl = -1;
	}

	public int getId() {
		return id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getLink() {
		return link;
	}

	public void setLink(String link) {
		this.link = link;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public ArrayList<RssItem> getItems() {
		return items;
	}

	public void addItem(RssItem item) {
		items.add(item);
	}

	public Date getViewDate() {
		return viewDate;
	}

	public void setViewDate(Date viewDate) {
		this.viewDate = viewDate;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getLogo() {
		return logo;
	}

	public void setLogo(String logo) {
		this.logo = logo;
	}

	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public Bitmap getBitmap() {
		return bitmap;
	}

	public void setBitmap(Bitmap bitmap) {
		this.bitmap = bitmap;
	}

	public int getTtl() {
		return ttl;
	}

	public void setTtl(int ttl) {
		this.ttl = ttl;
	}

	@Override
	public int compareTo(RssFeed other) {
		if (getDate() != null && other.getDate() != null) {
			return getDate().compareTo(other.getDate());
		} else {
			return 0;
		}
	}

	@Override
	public String toString() {
		return title;
	}

	public static Integer getSiteIcon(String url) {
		Set<String> keySet = websiteIconMap.keySet();
		for (String key : keySet) {
			if (url.contains(key)) {
				return websiteIconMap.get(key);
			}
		}
		return null;
	}

	/**
	 * Cache of local copies of the icons for popular news web sites.
	 */
	private static Map<String, Integer> websiteIconMap = new HashMap<String, Integer>();
	static {
		websiteIconMap.put("google", R.drawable.site_google);
		websiteIconMap.put("techmeme", R.drawable.site_techmeme);
		websiteIconMap.put("yahoo", R.drawable.site_yahoo);
		websiteIconMap.put("espn", R.drawable.site_espn);
		websiteIconMap.put("engadget", R.drawable.site_engadget);
		websiteIconMap.put("boingboing", R.drawable.site_boingboing);
		websiteIconMap.put("techcrunch", R.drawable.site_techcrunch);
		websiteIconMap.put("simplyrecipes", R.drawable.site_simplyrecipes);
		websiteIconMap.put("xataka", R.drawable.site_xataka);
		websiteIconMap.put("mashable", R.drawable.site_mashable);
		websiteIconMap.put("cnn", R.drawable.site_cnn);
		websiteIconMap.put("nbc", R.drawable.site_nbc);
		websiteIconMap.put("nytimes", R.drawable.site_nytimes);
		websiteIconMap.put("huffingtonpost", R.drawable.site_huffingtonpost);
		websiteIconMap.put("foxnews", R.drawable.site_foxnews);
		websiteIconMap.put("washingtonpost", R.drawable.site_washingtonpost);
		websiteIconMap.put("latimes", R.drawable.site_latimes);
		websiteIconMap.put("dailymail", R.drawable.site_dailymail);
		websiteIconMap.put("reuters", R.drawable.site_reuters);
		websiteIconMap.put("abcnews", R.drawable.site_abcnews);
		websiteIconMap.put("usatoday", R.drawable.site_usatoday);
		websiteIconMap.put("bbc", R.drawable.site_bbc);
		websiteIconMap.put("drudgereport", R.drawable.site_drudgereport);
	}

}


text:
<?php
namespace Concrete\Core\Search\Pagination;

use Concrete\Core\Search\ItemList\Pager\PagerProviderInterface;
use Concrete\Core\Search\Pagination\Adapter\PagerAdapter;
use Concrete\Core\Search\Pagination\View\ViewRenderer;
use Concrete\Core\Support\Facade\Facade;
use Pagerfanta\Pagerfanta;

class PagerPagination extends Pagination
{
    protected $list;
    protected $app;
    protected $request;
    protected $cursor;
    protected $hasNextPage;
    protected $currentPageResults;

    public function __construct(PagerProviderInterface $itemList)
    {
        $adapter = new PagerAdapter($itemList);
        $this->list = $itemList;
        $this->app = Facade::getFacadeApplication();

        $manager = $itemList->getPagerManager();

        $factory = $itemList->getPagerVariableFactory();
        $start = $factory->getCurrentCursor();
        if ($start) {
            $this->cursor = $start;
            $manager->displaySegmentAtCursor($start, $itemList);
        }

        Pagerfanta::__construct($adapter);
    }

    public function getLastResult()
    {
        $currentPageResults = $this->getCurrentPageResults();

        return end($currentPageResults);
    }

    public function advanceToNextPage()
    {
        $results = $this->getCurrentPageResults();
        $lastResult = end($results);

        unset($this->currentPageResults);
        unset($this->hasNextPage);

        $manager = $this->list->getPagerManager();
        $adapter = $this->getAdapter();
        $this->cursor = $lastResult;
        $manager->displaySegmentAtCursor($lastResult, $this->list);
    }

    public function renderView($driver = 'application', $arguments = [])
    {
        $manager = $this->app->make('manager/view/pagination/pager');
        $driver = $manager->driver($driver);
        $renderer = new ViewRenderer($this, $driver);

        return $renderer->render($arguments);
    }

    public function getTotalPages()
    {
        return -1;
    }

    public function getRouteCollectionFunction()
    {
        $urlHelper = $this->app->make('helper/url');
        $list = $this->getItemListObject();
        /* @var PagerProviderInterface $list */
        $routeCollectionFunction = function ($page) use ($list, $urlHelper) {
            $args = [];
            if ($list->getActiveSortColumn()) {
                $args[$list->getQuerySortColumnParameter()] = $list->getActiveSortColumn();
            }

            if ($list->getActiveSortDirection()) {
                $args[$list->getQuerySortDirectionParameter()] = $list->getActiveSortDirection();
            }

            $factory = $list->getPagerVariableFactory();
            if ($page == 2) {
                // next page
                $args[$factory->getCursorVariableName()] = $factory->getNextCursorValue($this);
            } elseif ($page == 0) {
                $args[$factory->getCursorVariableName()] = $factory->getPreviousCursorValue($this);
            }

            if ($this->baseURL) {
                $url = $urlHelper->setVariable($args, false, $this->baseURL);
            } else {
                $url = $urlHelper->setVariable($args);
            }

            return h($url);
        };

        return $routeCollectionFunction;
    }

    public function haveToPaginate()
    {
        return $this->hasNextPage() || $this->hasPreviousPage();
    }

    public function hasNextPage()
    {
        if (isset($this->hasNextPage)) {
            return $this->hasNextPage;
        }

        if (!isset($this->currentPageResults)) {
            $this->currentPageResults = $this->getCurrentPageResults();
        }
        $manager = $this->list->getPagerManager();
        $lastResult = end($this->currentPageResults);

        if ($lastResult) {
            $manager->displaySegmentAtCursor($lastResult, $this->list);
            $next = $this->getAdapter()->getSlice(0, 1);

            // reset the cursor
            if ($this->cursor) {
                $manager->displaySegmentAtCursor($this->cursor, $this->list);
            }
            if ($next) {
                $this->hasNextPage = true;

                return $this->hasNextPage;
            }
        }
        $this->hasNextPage = false;

        return $this->hasNextPage;
    }

    public function hasPreviousPage()
    {
        return $this->cursor != null;
    }

    public function getCurrentPageResults()
    {
        if (!isset($this->currentPageResults)) {
            $length = $this->getMaxPerPage();
            $this->currentPageResults = $this->getAdapter()->getSlice(0, $length);
        }

        return $this->currentPageResults;
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

 <LINK REL="STYLESHEET" TYPE="text/css" HREF="plsqldoc.css">
 <TITLE>Package body bahn_fahrplan_api</TITLE>
 <META name="object" content="PACKAGE BODY">
 <META name="name" content="bahn_fahrplan_api">
 <META name="description" content="API Package Body for Deutsche Bahn Fahrplan REST API Source: http://data.deutschebahn.com/apis/fahrplan/">

index

Package body bahn_fahrplan_api

API Package Body for Deutsche Bahn Fahrplan REST API Source: http://data.deutschebahn.com/apis/fahrplan/

Program units

check_error_http_status

Purpose: Check Server response HTTP error (2XX Status codes) Author:  Daniel Hochleitner Created: 26.02.2016 Changed:

check_error_fahrplan_api

Purpose: Check DB Fahrplan API Server response for error Author:  Daniel Hochleitner Created: 26.02.2016 Changed:

set_http_headers

Purpose: Set HTTP headers for REST calls Author:  Daniel Hochleitner Created: 26.02.2016 Changed:

get_location_name_json

Purpose: Fahrplan Location.name Service REST Call - Search for location and stations Author:  Daniel Hochleitner Created: 26.02.2016 Changed:

get_departure_board_json

Purpose: Fahrplan departureBoard Service REST Call - departure board for a

get_arrival_board_json

Purpose: Fahrplan arrivalBoard Service REST Call - arrival board for a

get_journey_detail_json

Purpose: Fahrplan journeyDetail Service REST Call - information about the complete route of a vehicle

get_location_stations_apex

Purpose: Fahrplan Location.name stations (StopLocation) inserted in APEX Collection Author:  Daniel Hochleitner Created: 26.02.2016 Changed:

get_location_otherloc_apex

Purpose: Fahrplan Location.name other locations (CoordLocation) inserted in APEX Collection Author:  Daniel Hochleitner Created: 26.02.2016 Changed:

get_departure_board_apex

Purpose: Fahrplan departureBoard inserted in APEX Collection Author:  Daniel Hochleitner Created: 26.02.2016 Changed:

get_arrival_board_apex

Purpose: Fahrplan ArrivalBoard inserted in APEX Collection Author:  Daniel Hochleitner Created: 26.02.2016 Changed:

get_journey_detail_apex

Purpose: Fahrplan journeyDetail Service inserted in APEX Collection Author:  Daniel Hochleitner Created: 27.02.2016 Changed:

get_location_stations_pipe

Purpose: Fahrplan Location.name stations (StopLocation) as pipelined function Author:  Daniel Hochleitner Created: 27.02.2016 Changed:

get_location_otherloc_pipe

Purpose: Fahrplan Location.name other locations (CoordLocation) as pipelined function Author:  Daniel Hochleitner Created: 27.02.2016 Changed:

get_departure_board_pipe

Purpose: Fahrplan departureBoard as pipelined function Author:  Daniel Hochleitner Created: 27.02.2016 Changed:

get_arrival_board_pipe

Purpose: Fahrplan ArrivalBoard as pipelined function Author:  Daniel Hochleitner Created: 27.02.2016 Changed:

get_journey_detail_pipe

Purpose: Fahrplan journeyDetail Service as pipelined function Author:  Daniel Hochleitner Created: 27.02.2016 Changed:

check_error_http_status

PROCEDURE check_error_http_status

Purpose: Check Server response HTTP error (2XX Status codes) Author:  Daniel Hochleitner Created: 26.02.2016 Changed:

check_error_fahrplan_api

PROCEDURE check_error_fahrplan_api(i_response_clob IN CLOB)

Purpose: Check DB Fahrplan API Server response for error Author:  Daniel Hochleitner Created: 26.02.2016 Changed:

set_http_headers

PROCEDURE set_http_headers

Purpose: Set HTTP headers for REST calls Author:  Daniel Hochleitner Created: 26.02.2016 Changed:

get_location_name_json

FUNCTION get_location_name_json(i_api_auth_key  IN VARCHAR2,
                                i_language      IN VARCHAR2 := 'en',
                                i_search_string IN VARCHAR2) RETURN CLOB

Purpose: Fahrplan Location.name Service REST Call - Search for location and stations Author:  Daniel Hochleitner Created: 26.02.2016 Changed:

get_departure_board_json

FUNCTION get_departure_board_json(i_api_auth_key IN VARCHAR2,
                                  i_language     IN VARCHAR2 := 'en',
                                  i_station_id   IN NUMBER,
                                  i_date_time    IN DATE := NULL)
  RETURN CLOB

Purpose: Fahrplan departureBoard Service REST Call - departure board for a

         given station (id) and date/time

Author:  Daniel Hochleitner Created: 26.02.2016 Changed:

get_arrival_board_json

FUNCTION get_arrival_board_json(i_api_auth_key IN VARCHAR2,
                                i_language     IN VARCHAR2 := 'en',
                                i_station_id   IN NUMBER,
                                i_date_time    IN DATE := NULL) RETURN CLOB

Purpose: Fahrplan arrivalBoard Service REST Call - arrival board for a

         given station (id) and date/time

Author:  Daniel Hochleitner Created: 26.02.2016 Changed:

get_journey_detail_json

FUNCTION get_journey_detail_json(i_journeydetailref_url IN VARCHAR2)
  RETURN CLOB

Purpose: Fahrplan journeyDetail Service REST Call - information about the complete route of a vehicle

         Gets journeydetailref URL from departure or arrival board

Author:  Daniel Hochleitner Created: 27.02.2016 Changed:

get_location_stations_apex

PROCEDURE get_location_stations_apex(i_api_auth_key   IN VARCHAR2,
                                     i_language       IN VARCHAR2 := 'en',
                                     i_search_string  IN VARCHAR2,
                                     i_apex_coll_name IN VARCHAR2 := 'STATIONS')

Purpose: Fahrplan Location.name stations (StopLocation) inserted in APEX Collection Author:  Daniel Hochleitner Created: 26.02.2016 Changed:

get_location_otherloc_apex

PROCEDURE get_location_otherloc_apex(i_api_auth_key   IN VARCHAR2,
                                     i_language       IN VARCHAR2 := 'en',
                                     i_search_string  IN VARCHAR2,
                                     i_apex_coll_name IN VARCHAR2 := 'LOCATIONS')

Purpose: Fahrplan Location.name other locations (CoordLocation) inserted in APEX Collection Author:  Daniel Hochleitner Created: 26.02.2016 Changed:

get_departure_board_apex

PROCEDURE get_departure_board_apex(i_api_auth_key   IN VARCHAR2,
                                   i_language       IN VARCHAR2 := 'en',
                                   i_station_id     IN NUMBER,
                                   i_date_time      IN DATE := NULL,
                                   i_apex_coll_name IN VARCHAR2 := 'DEPARTURE_BOARD')

Purpose: Fahrplan departureBoard inserted in APEX Collection Author:  Daniel Hochleitner Created: 26.02.2016 Changed:

get_arrival_board_apex

PROCEDURE get_arrival_board_apex(i_api_auth_key   IN VARCHAR2,
                                 i_language       IN VARCHAR2 := 'en',
                                 i_station_id     IN NUMBER,
                                 i_date_time      IN DATE := NULL,
                                 i_apex_coll_name IN VARCHAR2 := 'ARRIVAL_BOARD')

Purpose: Fahrplan ArrivalBoard inserted in APEX Collection Author:  Daniel Hochleitner Created: 26.02.2016 Changed:

get_journey_detail_apex

PROCEDURE get_journey_detail_apex(i_journeydetailref_url IN VARCHAR2,
                                  i_apex_coll_name       IN VARCHAR2 := 'JOURNEY_DETAIL')

Purpose: Fahrplan journeyDetail Service inserted in APEX Collection Author:  Daniel Hochleitner Created: 27.02.2016 Changed:

get_location_stations_pipe

FUNCTION get_location_stations_pipe(i_api_auth_key  IN VARCHAR2,
                                    i_language      IN VARCHAR2 := 'en',
                                    i_search_string IN VARCHAR2)
  RETURN bahn_fahrplan_api.t_location_stations_tab

Purpose: Fahrplan Location.name stations (StopLocation) as pipelined function Author:  Daniel Hochleitner Created: 27.02.2016 Changed:

get_location_otherloc_pipe

FUNCTION get_location_otherloc_pipe(i_api_auth_key  IN VARCHAR2,
                                    i_language      IN VARCHAR2 := 'en',
                                    i_search_string IN VARCHAR2)
  RETURN bahn_fahrplan_api.t_location_otherloc_tab

Purpose: Fahrplan Location.name other locations (CoordLocation) as pipelined function Author:  Daniel Hochleitner Created: 27.02.2016 Changed:

get_departure_board_pipe

FUNCTION get_departure_board_pipe(i_api_auth_key IN VARCHAR2,
                                  i_language     IN VARCHAR2 := 'en',
                                  i_station_id   IN NUMBER,
                                  i_date_time    IN DATE := NULL)
  RETURN bahn_fahrplan_api.t_departure_tab

Purpose: Fahrplan departureBoard as pipelined function Author:  Daniel Hochleitner Created: 27.02.2016 Changed:

get_arrival_board_pipe

FUNCTION get_arrival_board_pipe(i_api_auth_key IN VARCHAR2,
                                i_language     IN VARCHAR2 := 'en',
                                i_station_id   IN NUMBER,
                                i_date_time    IN DATE := NULL)
  RETURN bahn_fahrplan_api.t_arrival_tab

Purpose: Fahrplan ArrivalBoard as pipelined function Author:  Daniel Hochleitner Created: 27.02.2016 Changed:

get_journey_detail_pipe

FUNCTION get_journey_detail_pipe(i_journeydetailref_url IN VARCHAR2)
  RETURN bahn_fahrplan_api.t_journey_tab

Purpose: Fahrplan journeyDetail Service as pipelined function Author:  Daniel Hochleitner Created: 27.02.2016 Changed:


text:
// This code is auto-generated, do not modify
using Ds3.Models;
using System;
using System.Net;

namespace Ds3.Calls
{
    public class GetAzureTargetsSpectraS3Request : Ds3Request
    {

        private string _accountName;
        public string AccountName
        {
            get { return _accountName; }
            set { WithAccountName(value); }
        }

        private TargetReadPreferenceType? _defaultReadPreference;
        public TargetReadPreferenceType? DefaultReadPreference
        {
            get { return _defaultReadPreference; }
            set { WithDefaultReadPreference(value); }
        }

        private bool? _https;
        public bool? Https
        {
            get { return _https; }
            set { WithHttps(value); }
        }

        private bool? _lastPage;
        public bool? LastPage
        {
            get { return _lastPage; }
            set { WithLastPage(value); }
        }

        private string _name;
        public string Name
        {
            get { return _name; }
            set { WithName(value); }
        }

        private int? _pageLength;
        public int? PageLength
        {
            get { return _pageLength; }
            set { WithPageLength(value); }
        }

        private int? _pageOffset;
        public int? PageOffset
        {
            get { return _pageOffset; }
            set { WithPageOffset(value); }
        }

        private string _pageStartMarker;
        public string PageStartMarker
        {
            get { return _pageStartMarker; }
            set { WithPageStartMarker(value); }
        }

        private bool? _permitGoingOutOfSync;
        public bool? PermitGoingOutOfSync
        {
            get { return _permitGoingOutOfSync; }
            set { WithPermitGoingOutOfSync(value); }
        }

        private Quiesced? _quiesced;
        public Quiesced? Quiesced
        {
            get { return _quiesced; }
            set { WithQuiesced(value); }
        }

        private TargetState? _state;
        public TargetState? State
        {
            get { return _state; }
            set { WithState(value); }
        }

        public GetAzureTargetsSpectraS3Request WithAccountName(string accountName)
        {
            this._accountName = accountName;
            if (accountName != null)
            {
                this.QueryParams.Add("account_name", accountName);
            }
            else
            {
                this.QueryParams.Remove("account_name");
            }
            return this;
        }

        public GetAzureTargetsSpectraS3Request WithDefaultReadPreference(TargetReadPreferenceType? defaultReadPreference)
        {
            this._defaultReadPreference = defaultReadPreference;
            if (defaultReadPreference != null)
            {
                this.QueryParams.Add("default_read_preference", defaultReadPreference.ToString());
            }
            else
            {
                this.QueryParams.Remove("default_read_preference");
            }
            return this;
        }

        public GetAzureTargetsSpectraS3Request WithHttps(bool? https)
        {
            this._https = https;
            if (https != null)
            {
                this.QueryParams.Add("https", https.ToString());
            }
            else
            {
                this.QueryParams.Remove("https");
            }
            return this;
        }

        public GetAzureTargetsSpectraS3Request WithLastPage(bool? lastPage)
        {
            this._lastPage = lastPage;
            if (lastPage != null)
            {
                this.QueryParams.Add("last_page", lastPage.ToString());
            }
            else
            {
                this.QueryParams.Remove("last_page");
            }
            return this;
        }

        public GetAzureTargetsSpectraS3Request WithName(string name)
        {
            this._name = name;
            if (name != null)
            {
                this.QueryParams.Add("name", name);
            }
            else
            {
                this.QueryParams.Remove("name");
            }
            return this;
        }

        public GetAzureTargetsSpectraS3Request WithPageLength(int? pageLength)
        {
            this._pageLength = pageLength;
            if (pageLength != null)
            {
                this.QueryParams.Add("page_length", pageLength.ToString());
            }
            else
            {
                this.QueryParams.Remove("page_length");
            }
            return this;
        }

        public GetAzureTargetsSpectraS3Request WithPageOffset(int? pageOffset)
        {
            this._pageOffset = pageOffset;
            if (pageOffset != null)
            {
                this.QueryParams.Add("page_offset", pageOffset.ToString());
            }
            else
            {
                this.QueryParams.Remove("page_offset");
            }
            return this;
        }

        public GetAzureTargetsSpectraS3Request WithPageStartMarker(Guid? pageStartMarker)
        {
            this._pageStartMarker = pageStartMarker.ToString();
            if (pageStartMarker != null)
            {
                this.QueryParams.Add("page_start_marker", pageStartMarker.ToString());
            }
            else
            {
                this.QueryParams.Remove("page_start_marker");
            }
            return this;
        }

        public GetAzureTargetsSpectraS3Request WithPageStartMarker(string pageStartMarker)
        {
            this._pageStartMarker = pageStartMarker;
            if (pageStartMarker != null)
            {
                this.QueryParams.Add("page_start_marker", pageStartMarker);
            }
            else
            {
                this.QueryParams.Remove("page_start_marker");
            }
            return this;
        }

        public GetAzureTargetsSpectraS3Request WithPermitGoingOutOfSync(bool? permitGoingOutOfSync)
        {
            this._permitGoingOutOfSync = permitGoingOutOfSync;
            if (permitGoingOutOfSync != null)
            {
                this.QueryParams.Add("permit_going_out_of_sync", permitGoingOutOfSync.ToString());
            }
            else
            {
                this.QueryParams.Remove("permit_going_out_of_sync");
            }
            return this;
        }

        public GetAzureTargetsSpectraS3Request WithQuiesced(Quiesced? quiesced)
        {
            this._quiesced = quiesced;
            if (quiesced != null)
            {
                this.QueryParams.Add("quiesced", quiesced.ToString());
            }
            else
            {
                this.QueryParams.Remove("quiesced");
            }
            return this;
        }

        public GetAzureTargetsSpectraS3Request WithState(TargetState? state)
        {
            this._state = state;
            if (state != null)
            {
                this.QueryParams.Add("state", state.ToString());
            }
            else
            {
                this.QueryParams.Remove("state");
            }
            return this;
        }

        public GetAzureTargetsSpectraS3Request()
        {

        }

        internal override HttpVerb Verb
        {
            get
            {
                return HttpVerb.GET;
            }
        }

        internal override string Path
        {
            get
            {
                return "/_rest_/azure_target";
            }
        }
    }
}


text:
package com.izforge.izpack.compiler.listener;

import com.izforge.izpack.api.adaptator.IXMLElement;
import com.izforge.izpack.api.exception.CompilerException;
import com.izforge.izpack.compiler.packager.IPackager;
import com.izforge.izpack.api.data.PackInfo;

import java.util.Map;

/**
 * <p>
 * This class implements all methods of interface CompilerListener, but do not do anything else. It
 * can be used as base class to save implementation of unneeded methods.
 * </p>
 *
 * @author Klaus Bartz
 */
public class SimpleCompilerListener implements CompilerListener
{

    /**
     * Creates a newly object.
     */
    public SimpleCompilerListener()
    {
        super();
    }

    /*
     * (non-Javadoc)
     *
     * @see com.izforge.izpack.compiler.listener.CompilerListener#reviseAttributSetFile(java.util.Map,
     * com.izforge.izpack.api.adaptator.IXMLElement)
     */

    public Map<String, ?> reviseAdditionalDataMap(Map<String, ?> existentDataMap, IXMLElement element)
            throws CompilerException
    {
        return null;
    }

    /*
     * (non-Javadoc)
     *
     * @see com.izforge.izpack.compiler.listener.CompilerListener#AfterPack(com.izforge.izpack.compiler.Compiler.Pack,
     * int, com.izforge.izpack.compiler.packager.impl.Packager)
     */

    public void afterPack(PackInfo pack, int packNumber, IPackager packager)
    {
    }

    /*
     * (non-Javadoc)
     *
     * @see com.izforge.izpack.compiler.listener.CompilerListener#BeforePack(com.izforge.izpack.compiler.Compiler.Pack,
     * int, com.izforge.izpack.compiler.packager.impl.Packager)
     */

    public void beforePack(PackInfo pack, int packNumber, IPackager packager)
    {
    }

    /*
     * (non-Javadoc)
     *
     * @see com.izforge.izpack.compiler.listener.CompilerListener#notify(java.lang.String, int,
     * com.izforge.izpack.api.adaptator.IXMLElement, com.izforge.izpack.compiler.packager.impl.Packager)
     */

    public void notify(String position, int state, IXMLElement data, IPackager packager)
    {
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2014 Commonwealth Computer Research, Inc.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<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">
    <parent>
        <artifactId>geomesa-accumulo1.5</artifactId>
        <groupId>org.locationtech.geomesa</groupId>
        <version>1.0.0-rc.7-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>geomesa-filter-accumulo1.5</artifactId>
    <name>GeoMesa Filters and Functions - [Accumulo 1.5.x]</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-main</artifactId>
        </dependency>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
        </dependency>
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
        </dependency>
        <dependency>
            <groupId>org.joda</groupId>
            <artifactId>joda-convert</artifactId>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-transform</artifactId>
        </dependency>
        <dependency>
            <groupId>org.locationtech.geomesa</groupId>
            <artifactId>geomesa-utils-accumulo1.5</artifactId>
        </dependency>
        <!-- test deps -->
        <dependency>
            <groupId>org.specs2</groupId>
            <artifactId>specs2_2.10</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>


text:
package org.ta4j.core.indicators.statistics;

import org.ta4j.core.Decimal;
import org.ta4j.core.Indicator;
import org.ta4j.core.indicators.CachedIndicator;

/**
 * Standard error indicator.
 * <p>
 */
public class StandardErrorIndicator extends CachedIndicator<Decimal> {

    private int timeFrame;

    private StandardDeviationIndicator sdev;

    /**
     * Constructor.
     * @param indicator the indicator
     * @param timeFrame the time frame
     */
    public StandardErrorIndicator(Indicator<Decimal> indicator, int timeFrame) {
        super(indicator);
        this.timeFrame = timeFrame;
        sdev = new StandardDeviationIndicator(indicator, timeFrame);
    }

    @Override
    protected Decimal calculate(int index) {
        final int startIndex = Math.max(0, index - timeFrame + 1);
        final int numberOfObservations = index - startIndex + 1;
        return sdev.getValue(index).dividedBy(Decimal.valueOf(Math.sqrt(numberOfObservations)));
    }
}


text:
/* ###
 * IP: GHIDRA
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package docking.menu;

import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;

import javax.swing.JButton;
import javax.swing.KeyStroke;

import org.apache.commons.lang3.StringUtils;

import docking.action.DockingActionIf;
import ghidra.docking.util.LookAndFeelUtils;
import ghidra.util.StringUtilities;

class DockingToolBarUtils {

	private static final String START_KEYBINDING_TEXT = "

(";
	private static final String END_KEYBINDNIG_TEXT = ")";

	/**
	 * Sets the given button's tooltip text to match that of the given action
	 * @param button the button
	 * @param action the action
	 */
	static void setToolTipText(JButton button, DockingActionIf action) {

		String toolTipText = getToolTipText(action);
		String keyBindingText = getKeyBindingAcceleratorText(button, action.getKeyBinding());
		if (keyBindingText != null) {
			button.setToolTipText(combingToolTipTextWithKeyBinding(toolTipText, keyBindingText));
		}
		else {
			button.setToolTipText(toolTipText);
		}
	}

	private static String combingToolTipTextWithKeyBinding(String toolTipText,
			String keyBindingText) {
		StringBuilder buffy = new StringBuilder(toolTipText);
		if (StringUtilities.startsWithIgnoreCase(toolTipText, "")) {
			String endHTMLTag = "";
			int closeTagIndex = StringUtils.indexOfIgnoreCase(toolTipText, endHTMLTag);
			if (closeTagIndex < 0) {
				// no closing tag, which is acceptable
				buffy.append(START_KEYBINDING_TEXT)
						.append(keyBindingText)
						.append(END_KEYBINDNIG_TEXT);
			}
			else {
				// remove the closing tag, put on our text, and then put the tag back on
				buffy.delete(closeTagIndex, closeTagIndex + endHTMLTag.length() + 1);
				buffy.append(START_KEYBINDING_TEXT)
						.append(keyBindingText)
						.append(END_KEYBINDNIG_TEXT)
						.append(endHTMLTag);
			}
			return buffy.toString();
		}

		// plain text (not HTML)
		return toolTipText + " (" + keyBindingText + ")";
	}

	private static String getToolTipText(DockingActionIf action) {
		String description = action.getDescription();
		if (!StringUtils.isEmpty(description)) {
			return description;
		}
		return action.getName();
	}

	private static String getKeyBindingAcceleratorText(JButton button, KeyStroke keyStroke) {
		if (keyStroke == null) {
			return null;
		}

		// This code is based on that of BasicMenuItemUI
		StringBuilder builder = new StringBuilder();
		int modifiers = keyStroke.getModifiers();
		if (modifiers > 0) {
			builder.append(InputEvent.getModifiersExText(modifiers));

			// The Aqua LaF does not use the '+' symbol between modifiers
			if (!LookAndFeelUtils.isUsingAquaUI(button.getUI())) {
				builder.append('+');
			}
		}
		int keyCode = keyStroke.getKeyCode();
		if (keyCode != 0) {
			builder.append(KeyEvent.getKeyText(keyCode));
		}
		else {
			builder.append(keyStroke.getKeyChar());
		}
		return builder.toString();
	}
}


text:
Big Numbers
===========

This sub-module is part of the [ethers project](https://github.com/ethers-io/ethers.js).

It is responsible for handling arbitrarily large numbers and mathematic operations.

For more information, see the documentation for [Big Numbers](https://docs.ethers.io/v5/api/utils/bignumber/)
and [Fixed-Point Numbers](https://docs.ethers.io/v5/api/utils/fixednumber/).

Importing
---------

Most users will prefer to use the [umbrella package](https://www.npmjs.com/package/ethers),
but for those with more specific needs, individual components can be imported.

```javascript
const {

    BigNumber,

    FixedFormat,
    FixedNumber,

    formatFixed,

    parseFixed

    // Types

    BigNumberish

} = require("@ethersproject/bignumber");
```

License
-------

MIT License


text:
<?php

namespace App;

class CollapsibleBarTemplate extends AbstractTemplate
{
    protected $fillable = [
        'main_text',
        'header_text',
        'collapse_text',
        'expand_text',
        'button_text',
        'background_color',
        'text_color',
        'button_background_color',
        'button_text_color',
        'initial_state',
    ];

    /**
     * Text should return textual representation of the banner's main text in the cleanest possible form.
     * @return mixed
     */
    public function text()
    {
        return strip_tags("{$this->main_text} -- {$this->button_text}");
    }
}


text:
/**
 * @fileoverview Experiments system allows a developer to opt-in to test
 * features that are not yet fully tested.
 *
 * Experiments page: https://cdn.ampproject.org/experiments.html *
 */

import {dev, user} from '../log';
import {getMode} from '../mode';
import {getTopWindow} from '../service-helpers';
import {hasOwn, map} from '#core/types/object';
import {isArray} from '#core/types';
import {parseJson} from '#core/types/object/json';
import {parseQueryString} from '#core/types/string/url';

import {ExperimentInfoDef} from './experiments.type';

/** @const {string} */
const TAG = 'EXPERIMENTS';

/** @const {string} */
const LOCAL_STORAGE_KEY = 'amp-experiment-toggles';

/** @const {string} */
const TOGGLES_WINDOW_PROPERTY = '__AMP__EXPERIMENT_TOGGLES';

/**
 * Whether we are in canary.
 * @param {!Window} win
 * @return {boolean}
 */
export function isCanary(win) {
  return !!win.AMP_CONFIG?.canary;
}

/**
 * Returns binary type, e.g., canary, production, control, or rc.
 * @param {!Window} win
 * @return {string}
 */
export function getBinaryType(win) {
  return win.AMP_CONFIG?.type || 'unknown';
}

/**
 * Whether the specified experiment is on or off.
 * @param {!Window} win
 * @param {string} experimentId
 * @return {boolean}
 */
export function isExperimentOn(win, experimentId) {
  const toggles = experimentToggles(win);
  return !!toggles[experimentId];
}

/**
 * Toggles the experiment on or off. Returns the actual value of the experiment
 * after toggling is done.
 * @param {!Window} win
 * @param {string} experimentId
 * @param {boolean=} opt_on
 * @param {boolean=} opt_transientExperiment  Whether to toggle the
 *     experiment state "transiently" (i.e., for this page load only) or
 *     durably (by saving the experiment IDs after toggling).
 *     Default: false (save durably).
 * @return {boolean} New state for experimentId.
 */
export function toggleExperiment(
  win,
  experimentId,
  opt_on,
  opt_transientExperiment
) {
  const currentlyOn = isExperimentOn(win, /*OK*/ experimentId);
  const on = opt_on ?? !currentlyOn;
  if (on != currentlyOn) {
    const toggles = experimentToggles(win);
    toggles[experimentId] = on;

    if (!opt_transientExperiment) {
      const storedToggles = getExperimentToggles(win);
      storedToggles[experimentId] = on;
      saveExperimentToggles(win, storedToggles);
      // Avoid affecting tests that spy/stub warn().
      if (!getMode().test) {
        user().warn(
          TAG,
          '"%s" experiment %s for the domain "%s". See: https://amp.dev/documentation/guides-and-tutorials/learn/experimental',
          experimentId,
          on ? 'enabled' : 'disabled',
          win.location.hostname
        );
      }
    }
  }
  return on;
}

/**
 * Calculate whether the experiment is on or off based off of its default value,
 * stored overriden value, or the global config frequency given.
 * @param {!Window} win
 * @return {!Object<string, boolean>}
 */
export function experimentToggles(win) {
  if (win[TOGGLES_WINDOW_PROPERTY]) {
    return win[TOGGLES_WINDOW_PROPERTY];
  }
  win[TOGGLES_WINDOW_PROPERTY] = map();
  const toggles = win[TOGGLES_WINDOW_PROPERTY];

  // Read default and injected configs of this build.
  const buildExperimentConfigs = {
    ...(win.AMP_CONFIG ?? {}),
    ...(win.AMP_EXP ?? parseJson(win.__AMP_EXP?.textContent || '{}')),
  };
  for (const experimentId in buildExperimentConfigs) {
    const frequency = buildExperimentConfigs[experimentId];
    if (typeof frequency === 'number' && frequency >= 0 && frequency <= 1) {
      toggles[experimentId] = Math.random() < frequency;
    }
  }
  // Read document level override from meta tag.
  const allowedDocOptIn = win.AMP_CONFIG?.['allow-doc-opt-in'];
  if (isArray(allowedDocOptIn) && allowedDocOptIn.length) {
    const meta = win.document.head.querySelector(
      'meta[name="amp-experiments-opt-in"]'
    );
    if (meta) {
      const optedInExperiments = meta.getAttribute('content').split(',');
      for (const experiment of optedInExperiments) {
        if (dev().assertArray(allowedDocOptIn).includes(experiment)) {
          toggles[experiment] = true;
        }
      }
    }
  }

  Object.assign(toggles, getExperimentToggles(win));

  const allowedUrlOptIn = win.AMP_CONFIG?.['allow-url-opt-in'];
  if (isArray(allowedUrlOptIn) && allowedUrlOptIn.length) {
    const hash = win.location['originalHash'] || win.location.hash;
    const params = parseQueryString(hash);
    for (const experiment of allowedUrlOptIn) {
      const param = params[`e-${experiment}`];
      if (param == '1') {
        toggles[experiment] = true;
      }
      if (param == '0') {
        toggles[experiment] = false;
      }
    }
  }
  return toggles;
}

/**
 * Returns the cached experiments toggles, or null if they have not been
 * computed yet.
 * @param {!Window} win
 * @return {?Object<string, boolean>}
 */
export function experimentTogglesOrNull(win) {
  return win[TOGGLES_WINDOW_PROPERTY] || null;
}

/**
 * Returns a set of experiment IDs currently on.
 * @param {!Window} win
 * @return {!Object<string, boolean>}
 */
function getExperimentToggles(win) {
  let experimentsString = '';
  try {
    if ('localStorage' in win) {
      experimentsString = win.localStorage.getItem(LOCAL_STORAGE_KEY);
    }
  } catch {
    dev().warn(TAG, 'Failed to retrieve experiments from localStorage.');
  }
  const tokens = experimentsString?.split(/\s*,\s*/g) || [];

  const toggles = map();
  for (const token of tokens) {
    if (!token) {
      continue;
    }
    if (token[0] == '-') {
      toggles[token.substr(1)] = false;
    } else {
      toggles[token] = true;
    }
  }
  return toggles;
}

/**
 * Saves a set of experiment IDs currently on.
 * @param {!Window} win
 * @param {!Object<string, boolean>} toggles
 */
function saveExperimentToggles(win, toggles) {
  const experimentIds = [];
  for (const experiment in toggles) {
    experimentIds.push((toggles[experiment] === false ? '-' : '') + experiment);
  }
  try {
    win.localStorage?.setItem(LOCAL_STORAGE_KEY, experimentIds.join(','));
  } catch (e) {
    user().error(TAG, 'Failed to save experiments to localStorage.');
  }
}

/**
 * See getExperimentToggles().
 * @param {!Window} win
 * @return {!Object<string, boolean>}
 * @visibleForTesting
 */
export function getExperimentTogglesForTesting(win) {
  return getExperimentToggles(win);
}

/**
 * Resets the experimentsToggle cache for testing purposes.
 * @param {!Window} win
 * @visibleForTesting
 */
export function resetExperimentTogglesForTesting(win) {
  saveExperimentToggles(win, {});
  win[TOGGLES_WINDOW_PROPERTY] = null;
}

/**
 * In some browser implementations of Math.random(), sequential calls of
 * Math.random() are correlated and can cause a bias.  In particular,
 * if the previous random() call was < 0.001 (as it will be if we select
 * into an experiment), the next value could be less than 0.5 more than
 * 50.7% of the time.  This provides an implementation that roots down into
 * the crypto API, when available, to produce less biased samples.
 *
 * @return {number} Pseudo-random floating-point value on the range [0, 1).
 */
function slowButAccuratePrng() {
  // TODO(tdrl): Implement.
  return Math.random();
}

/**
 * Container for alternate random number generator implementations.  This
 * allows us to set an "accurate" PRNG for branch selection, but to mock it
 * out easily in tests.
 *
 * @visibleForTesting
 * @const {!{accuratePrng: function():number}}
 */
export const RANDOM_NUMBER_GENERATORS = {
  accuratePrng: slowButAccuratePrng,
};

/**
 * Selects, uniformly at random, a single item from the array.
 * @param {!Array<string>} arr Object to select from.
 * @return {?string} Single item from arr or null if arr was empty.
 */
function selectRandomItem(arr) {
  const rn = RANDOM_NUMBER_GENERATORS.accuratePrng();
  return dev().assertString(arr[Math.floor(rn * arr.length)]) || null;
}

/**
 * Selects which page-level experiment branches are enabled. If a given
 * experiment name is already set (including to the null / no branches selected
 * state), this won't alter its state.
 *
 * Check whether a given experiment is set using isExperimentOn(win,
 * experimentName) and, if it is on, look for which branch is selected in
 * win.__AMP_EXPERIMENT_BRANCHES[experimentName].
 *
 * @param {!Window} win Window context on which to save experiment
 *     selection state.
 * @param {!Array<!ExperimentInfoDef>} experiments  Set of experiments to
 *     configure for this page load.
 * @return {!Object<string, string>} Map of experiment names to selected
 *     branches.
 */
export function randomlySelectUnsetExperiments(win, experiments) {
  win.__AMP_EXPERIMENT_BRANCHES = win.__AMP_EXPERIMENT_BRANCHES || {};
  const selectedExperiments = {};
  for (const experiment of experiments) {
    const experimentName = experiment.experimentId;
    if (hasOwn(win.__AMP_EXPERIMENT_BRANCHES, experimentName)) {
      selectedExperiments[experimentName] =
        win.__AMP_EXPERIMENT_BRANCHES[experimentName];
      continue;
    }

    if (!experiment.isTrafficEligible?.(win)) {
      win.__AMP_EXPERIMENT_BRANCHES[experimentName] = null;
      continue;
    }

    // If we're in the experiment, but we haven't already forced a specific
    // experiment branch (e.g., via a test setup), then randomize the branch
    // choice.
    if (
      !win.__AMP_EXPERIMENT_BRANCHES[experimentName] &&
      isExperimentOn(win, /*OK*/ experimentName)
    ) {
      win.__AMP_EXPERIMENT_BRANCHES[experimentName] = selectRandomItem(
        experiment.branches
      );
      selectedExperiments[experimentName] =
        win.__AMP_EXPERIMENT_BRANCHES[experimentName];
    }
  }
  return selectedExperiments;
}

/**
 * Returns the experiment branch enabled for the given experiment ID.
 * For example, 'control' or 'experiment'.
 *
 * @param {!Window} win Window context to check for experiment state.
 * @param {string} experimentName Name of the experiment to check.
 * @return {?string} Active experiment branch ID for experimentName (possibly
 *     null if experimentName has been tested but no branch was enabled).
 */
export function getExperimentBranch(win, experimentName) {
  return win.__AMP_EXPERIMENT_BRANCHES
    ? win.__AMP_EXPERIMENT_BRANCHES[experimentName]
    : null;
}

/**
 * Returns an object containing all active experiment branches on the
 * top Window.
 *
 * @param {!Window} win Window context to check for experiment state.
 * @return {!Object} contains all experiment branches and their ids.
 */
export function getActiveExperimentBranches(win) {
  const topWin = getTopWindow(win);
  if (!topWin.__AMP_EXPERIMENT_BRANCHES) {
    topWin.__AMP_EXPERIMENT_BRANCHES = {};
  }
  return {...topWin.__AMP_EXPERIMENT_BRANCHES};
}

/**
 * Force enable (or disable) a specific branch of a given experiment name.
 * Disables the experiment name altogether if branchId is falseish.
 *
 * @param {!Window} win Window context to check for experiment state.
 * @param {string} experimentName Name of the experiment to check.
 * @param {?string} branchId ID of branch to force or null to disable
 *     altogether.
 * @visibleForTesting
 */
export function forceExperimentBranch(win, experimentName, branchId) {
  win.__AMP_EXPERIMENT_BRANCHES = win.__AMP_EXPERIMENT_BRANCHES || {};
  toggleExperiment(win, experimentName, !!branchId, true);
  win.__AMP_EXPERIMENT_BRANCHES[experimentName] = branchId;
}


text:
/**
   *  Carto CSS editor module
   *
   *  new cdb.admin.mod.CartoCSSEditor({
   *    model: dataLayer
   *    table: table
   *  })
   *
   */

cdb.admin.mod = cdb.admin.mod || {};
cdb.admin.mod.CartoCSSEditor = cdb.admin.Module.extend({

  _TEXTS: {
    tip: 'Ctrl + SPACE to autocomplete. <%- key %> + S to apply your styles.'
  },

  _ACTION: {
    type: 'show',
    width: 600
  },

  buttonClass: 'cartocss_mod',
  type: 'tool',

  events: {
    'click .actions button':  'applyStyle',
    'click .actions a.next':  '_do',
    'click .actions a.back':  '_undo',
    'click .doc_info':        '_showDoc'
  },

  initialize: function() {
    _.bindAll(this, '_onKeyUpEditor');

    this.template = this.getTemplate('table/menu_modules/views/carto_editor');

    this.model.bind('change',      this._updateStyle, this);
    this.add_related_model(this.model);
    this.add_related_model(this.model.table);

    // Set query position from history array and last sql applied
    var history   = this.model.get('tile_style_history')
      , position  = this.model.tile_style_history_position
      , style     = this.model.get('tile_style');

    // Model doesn't persist last change, let's add in the history
    if (style && style != "" && history && _.indexOf(history, style) === -1) {
      history.push(style);
      this.model.set({ "tile_style_history": history }, { silent:true });
    }

    // Get history position
    this.model.tile_style_history_position =
      _.indexOf(history, style) !== -1
      ? _.indexOf(history, style)
      : 0;

    this.model.bind('parseError', this._showErrorFromServer, this);
    /*
    this.model.bind('tileError', this._renderError, this);
    */
    this.model.bind('tileOk', this._checkLocalErrors, this);
    this.model.table.bind('change:schema', this._checkLocalErrors, this);

    //this.buildAutocomplete();
    this._initBinds();

    cdb.god.bind('end_show', this.activated, this)
    this.add_related_model(cdb.god);
  },

  /** builds autocomplete from cartcss reference */
  buildAutocomplete: function() {
    this.autocomplete = [];
    if (typeof(window._mapnik_reference_latest) !== 'undefined') {
      var symbolizers = _mapnik_reference_latest.symbolizers;
      for (var s in symbolizers) {
        var sym = symbolizers[s];
        for (var p in sym) {
          var css = sym[p].css;
          if (css && css.length) {
            this.autocomplete.push(css);
          }
        }
      }
    }
  },

  activated: function() {
    if(this.codeEditor) {
      this.codeEditor.refresh();
      this.codeEditor.focus();
      this._adjustCodeEditorSize();
    }
  },

  render: function() {
    var self = this;
    this.clearSubViews();

    this.$el.append(this.template({}));

    this._initHelp();
    this._initEditor();

    this._updateStyle();
    this._adjustCodeEditorSize();

    return this;
  },

  _initBinds: function() {
    // Codemirror extrakey
    // Add save keymap
    // PC & LINUX -> Ctrl + s
    // MAC        -> Cmd + s
    var ua      = navigator.userAgent.toLowerCase()
      , so      = "rest"
      , keymap  = "ctrl+s"
      , self    = this;

    if (/mac os/.test(ua)) {
      keymap = "meta+s";
      so = "mac";
    }

    this.$el.bind('keydown', keymap, function(ev) {
      if (((so=="mac" && ev.metaKey) || (so=="rest" && ev.ctrlKey)) && ev.keyCode == 83 ) {
        ev.preventDefault();
        self.applyStyle();
      }
    });
  },

  _initEditor: function() {
    var self = this;
    this.codeEditor = CodeMirror.fromTextArea(this.$('textarea')[0], {
      mode: "text/x-carto",
      tabMode: "indent",
      matchBrackets: true,
      lineNumbers: true,
      lineWrapping: true,
      onKeyEvent: this._onKeyUpEditor,
      extraKeys: {
        "Ctrl-Space": function(cm) { self._showAutocomplete(cm) }
      }
    });

    var color_picker = new cdb.admin.CodemirrorColorPicker({
      editor: this.codeEditor,
      model:  this.model
    });
    color_picker.bind('colorChosen', this.applyStyle, this);
    this.addView(color_picker);

    // Add tooltip for undo/redo buttons
    this.$("a.next, a.back").tipsy({
      gravity: "s",
      fade: true
    });
  },

  _initHelp: function() {
    var so = "rest";
    var ua = navigator.userAgent.toLowerCase();

    if (/mac os/.test(ua)) {
      so = "mac";
    }

    var help = new cdb.admin.mod.HTMLEditorHelp({
      localStorageKey: this._STORAGE_NAMESPACE + this.model.table.get('id'),
      text: _.template(this._TEXTS.tip)({ key: (so == "mac") ? "CMD" : "Ctrl" })
    }).bind("hide show", this._adjustCodeEditorSize, this);
    this.$el.append(help.render().$el);
    this.addView(help);
  },

  _showAutocomplete: function(cm) {
    CodeMirror.showHint(cm, CodeMirror.hint['custom-list-with-type'], {
      completeSingle: false,
      list: _.union( this._getTableName(), this._getSQLColumns())
    });
  },

  _getTableName: function() {
    return [ [ this.model.table.get('name'), "T" ] ]
  },

  _getSQLColumns: function() {
    return _.map(
      this.model.table.get('schema'),
      function(pair) {
        // Column name and type
        return [pair[0], "C"]
      });
  },

  _onKeyUpEditor: function(cm, e) {
    var code = (e.keyCode ? e.keyCode : e.which);

    if (e.type == "keyup" && code != 27 ) {
      var self = this;

      if (this.autocomplete_timeout) clearTimeout(this.autocomplete_timeout);

      this.autocomplete_timeout = setTimeout(function() {
        var cur = cm.getCursor();
        var str = cm.getTokenAt(cur).string;
        var schema = self.model.table.get('schema');

        if (schema && str.length > 2) {
          var arr = _.union(self.model.table.get('schema'), self._getTableName());
          var list = _.compact(_.map(arr, function(pair) {
            if (pair[0].search(str) != -1)
              return pair[0];
            return null;
          }));

          if (!cm.state.completionActive && str.length > 2 && list.length > 0) {
            self._showAutocomplete(cm)
          }
        }

      }, 150);
    }
  },

  /** hack used to format the old styles transformed to cartodb 2.0*/
  formatStyle: function(s) {
    try {
      if (s && s.length) {
        s = s.replace(/{/g,'{\n')
            .replace(/}/g,'}\n')
            .replace(/;/g,';\n')
        var t = s.split('\n');
        var lines = [];
        var c = 0;
        for(var i = 0; i < t.length; ++i) {
          lines.push(c);
          if (t[i].indexOf('{')  != -1) {
            ++c;
          }
          if (t[i].indexOf('}')  != -1) {
            --c;
          }
        }
        var r = [];
        for(var i = 0; i < t.length; ++i) {
          var spaces = '';
          if(t[i].indexOf('}') >= 0) lines[i]-=1;
          for(var j = 0; j < lines[i]; ++j) {
            spaces = spaces + '  ';
          }
          r.push(spaces + t[i]);
        }
        return '/** this cartoCSS has been processed in order to be compatible with the new cartodb 2.0 */\n\n' + r.join('\n');
      }
    } catch(e) {
    }
    return s;
  },

  _updateStyle: function(){
    var st        = this.model.get('tile_style')
      , editor_st = this.codeEditor.getValue();

      if(this.codeEditor && st && st != editor_st) {
        if(st.indexOf('\n') === -1) {
          st = this.formatStyle(st);
        }
        this.codeEditor.setValue(st);
        this.codeEditor.refresh();
      }

    // If model is using history, check buttons
    if (this.model.get('tile_style_history'))
      this._checkDoButtons();
  },

  /**
   * gets an array of parse errors from windshaft
   * and returns an array of {line:1, error: 'string'] with user friendly
   * strings. Parses errors in format:
   *
   *  'style.mss:7:2 Invalid code: asdasdasda'
   */
  _parseError: function(errors) {
    var parsedErrors = [];
    for(var i in errors) {
      var err = errors[i];
      if(err) {
        if (err.length > 0) {
          var g = err.match(/.*:(\d+):(\d+)\s*(.*)/);
          if(g) {
            parsedErrors.push({
              line: parseInt(g[1], 10),
              message: g[3]
            });
          } else {
            parsedErrors.push({
              line: null,
              message: err
            })
          }
        } else if(err.line) {
          parsedErrors.push(err);
        }
      }
    }
    // sort by line
    parsedErrors.sort(function(a, b) { return a.line - b.line; });
    parsedErrors = _.uniq(parsedErrors, true, function(a) { return a.line + a.message; });
    return parsedErrors;
  },

  _showErrorFromServer: function(err) {
    this._showError(this._parseError(err));
  },

  _showError: function(err) {
    var parsedErrors = err;
    if(parsedErrors.length > 0) {
      var errors = _(parsedErrors).map(function(e) {
        if(e.line) {
          return "line " + e.line + ": " + e.message;
        }
        return e.error || e.message;
      })
      this._renderError(errors.join('
'));
    }
  },

  _renderError: function(errors) {
    this.trigger('hasErrors');

    // Get actions block height
    var actions_h = this.$('.actions').outerHeight();

    // Add error text
    this.$('.info')
      .addClass('error')
      .html("
" + errors + "
")
      // If layer is not visible, we need to move error message
      .css({
        bottom: actions_h + (!this.model.get('visible') ? 57 : 0)
      })
      .show();

    this._adjustCodeEditorSize();
  },

  _adjustCodeEditorSize: function() {
    // Fit editor with the error
    var info_h = this.$('.info').is(':visible') ? this.$('.info').outerHeight() : 0;
    var help_h = this.$('.help-tip').is(':visible') ? 36 : 0 ;
    // If layer is not visible, we need to take into account
    var vis_msg_h = !this.model.get('visible') ? 57 : 0 ;

    this.$('.CodeMirror-wrap').css({
      bottom: info_h + vis_msg_h + 80, /* the space we need to show the action buttons */
      top: help_h
    });
  },

  _checkLocalErrors: function() {
    var style = this.model.get('tile_style');
    var cartoParser = new cdb.admin.CartoParser(style);
    if(cartoParser.errors().length) {
      this._showError(this._parseError(cartoParser.errors()));
    } else {
      // check variables used
      var err = this.checkVariables(cartoParser.variablesUsed());
      if(err.length) {
        this._showError(err);
        return;
      }
    }
    this._clearErrors();
  },

  _clearErrors: function() {
    this.trigger('clearError');

    // Hide info
    this.$('.info')
      .html('')
      .removeClass('error')
      .hide();

    this._adjustCodeEditorSize();
  },

  _do: function(e) {
    e.preventDefault();
    var newCarto = this.model.redoHistory('tile_style');
    if(this.codeEditor) this.codeEditor.setValue(newCarto);
    this._checkDoButtons();
    return false;
  },

  _undo: function(e) {
    e.preventDefault();
    var newCarto = this.model.undoHistory('tile_style');
    if(this.codeEditor) this.codeEditor.setValue(newCarto);
    this._checkDoButtons();
    return false;
  },

  /**
   * checks variabels used in cartocss are in the schem
   */
  checkVariables: function(vars) {
    var columns = this.model.table.columnNames();
    var err = [];
    for(var i in vars) {
      if(!_.contains(columns, vars[i])) {
        err.push({
          error: "sql/table must contain " + vars[i] + " variable"
        });
      }
    }
    return err;
  },

  applyStyle: function() {
    this._clearErrors();
    var style = this.codeEditor.getValue();
    var cartoParser = new cdb.admin.CartoParser(style);
    if(cartoParser.errors().length) {
      this._showError(this._parseError(cartoParser.errors()));
    } else {
      // check variables used
      var err = this.checkVariables(cartoParser.variablesUsed());
      if(err.length) {
        this._showError(err)
        return;
      }
      this.model.addToHistory('tile_style', style);
      //TODO: check if the style has been changed
      this.model.save({
        tile_style: style,
        tile_style_custom: true
      });

      // we save the new applied query on the history array
      this.trigger('applyStyle', style);
    }

    // TODO: remove mixpanel
    cdb.god.trigger('mixpanel', "Applying a CartoCSS style manually", { style: style });

    // Event tracking "Applied CartoCSS style manually"
    cdb.god.trigger('metrics', 'cartocss_manually', {
      email: window.user_data.email,
      data: { style: style }
    });
  },

  /**
   * Check if the editor is different from the saved value
   * @return {Boolean}
   */
  hasChanges: function() {
    return this.model.get('tile_style') != this.codeEditor.getValue();
  },

  _checkDoButtons: function() {
      // Redo
      if (!this.model.isHistoryAtLastPosition('tile_style')) {
        this.$el.find('a.next').removeClass("disabled")
      } else {
        this.$el.find('a.next').addClass("disabled")
      }
      // Undo
      if (!this.model.isHistoryAtFirstPosition('tile_style')) {
        this.$el.find('a.back').removeClass("disabled")
      } else {
        this.$el.find('a.back').addClass("disabled")
      }
  },

  _showDoc: function(ev) {
    ev.preventDefault();
    var dialog = new cdb.admin.CartoCSSInfo();
    $("body").append(dialog.render().el);
    dialog.open();
  }
});


text:
<!DOCTYPE html>

    <title>Classes  Reference</title>
    <link rel="stylesheet" type="text/css" href="css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="css/highlight.css" />
    <meta charset="utf-8">

          SCAStateMachine Docs

         (100% documented)

            View on GitHub

      SCAStateMachine Reference

      Classes  Reference

            Classes

                StateMachine

            Enums

                StateMachineError

Classes

The following classes are available globally.

                    StateMachine

State machine object that tracks a single state at a time. Allows moving between states via transitions and manually.

                        See more

Declaration

Swift

open class StateMachine <T> where T: Hashable

© 2016 SeanCAtkinson. All rights reserved. (Last updated: 2016-11-19)

Generated by jazzy ♪♫ v0.7.2, a Realm project.


text:
class CreateChouetteRoute < ActiveRecord::Migration
  def up
    create_table "routes", :force => true do |t|
      t.integer  "line_id", :limit => 8
      t.string   "objectid", :null => false
      t.integer  "object_version"
      t.datetime "creation_time"
      t.string   "creator_id"
      t.string   "name"
      t.string   "comment"
      t.integer   "opposite_route_id", :limit => 8
      t.string   "published_name"
      t.string   "number"
      t.string   "direction"
      t.string   "wayback"
    end
    add_index "routes", ["objectid"], :name => "routes_objectid_key", :unique => true
  end

  def down
  end
end


text:
using HoloToolkit.Unity.InputModule;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;

/// <summary>
/// represents one key on a keyboard
/// </summary>
[ExecuteInEditMode]
public class Key : MonoBehaviour, IInputHandler, IInputClickHandler
{
    [Tooltip("The type of the key. This determines its functionality if it is pressed")]
    public KeyType keyType = KeyType.LETTER;
    [Tooltip("If keyType is LETTER: the letter which is shown by the key")]
    [SerializeField]
    private string letter;
    private Keyboard keyboard;
    private TextMesh caption;
    private Transform capslockIndication;

    /// <summary>
    /// get the necessary components:
    /// finds the associated keyboard and the text-object if one is attached
    /// if keyType is CAPSLOCK it also finds the capslock-indication
    /// </summary>
    public void Awake()
    {
        keyboard = transform.parent.GetComponent<Keyboard>();
        Transform capObj = transform.Find("Caption");
        if (capObj != null)
        {
            caption = capObj.GetComponent<TextMesh>();
        }

        if (keyType == KeyType.CAPSLOCK)
        {
            capslockIndication = transform.Find("Capslock");
        }
    }

    /// <summary>
    /// Provides convenience in the editor:
    /// if the letter of the key is changed in this script,
    /// it automatically changes the caption on the text object
    /// </summary>
    public void Update()
    {
        // this is called in the editor because of the [ExecuteInEditMode]
        // automatically update the caption with the specified letter
        if (!Application.isPlaying && keyType == KeyType.LETTER)
        {
            caption.text = letter;
            gameObject.name = "Key " + letter;
        }
    }

    public string Letter
    {
        get { return letter; }
        set
        {
            letter = value;
            if (caption != null)
            {
                caption.text = value;
            }
        }
    }

    /// <summary>
    /// called if the key is pressed
    /// executes the logical functionality depending on the keyType
    /// for LETTER: add the letter to the keyboard-text
    /// for BACK: remove the last char from the keyboard-text
    /// for ENTER: insert a new line if the maximum of lines is not exceeded
    /// for SHIFT: activate shift
    /// for CAPSLOCK: activate capslock
    /// for ACCEPT: tell the keyboard to finish the input
    /// for CANCEL: tell teh keyboard to cancle the input
    /// </summary>
    public void KeyPressed()
    {
        if (keyboard != null)
        {
            if (keyType == KeyType.LETTER)
            {
                // add the letter to the text
                keyboard.Text += letter;
            }
            else if (keyType == KeyType.BACK)
            {
                // remove the last letter from the text
                if (keyboard.Text.Length > 0)
                {
                    keyboard.Text = keyboard.Text.Substring(0, keyboard.Text.Length - 1);
                }
            }
            else if (keyType == KeyType.ENTER)
            {
                keyboard.Text += Environment.NewLine;
            }
            else if (keyType == KeyType.SHIFT)
            {
                if (!keyboard.Capslock)
                {
                    keyboard.Shift = !keyboard.Shift;
                }
            }
            else if (keyType == KeyType.CAPSLOCK)
            {
                keyboard.Capslock = !keyboard.Capslock;
                keyboard.Shift = keyboard.Capslock;
                capslockIndication.gameObject.SetActive(keyboard.Capslock);
            }
            else if (keyType == KeyType.ACCEPT)
            {
                keyboard.Accept();
            }
            else
            {
                keyboard.Cancel();
            }
        }
    }

    public void OnInputUp(InputEventData eventData)
    {

    }

    /// <summary>
    /// Called if the key is pressed
    /// </summary>
    /// <param name="eventData"></param>
    public void OnInputDown(InputEventData eventData)
    {
        if (keyType != KeyType.ACCEPT && keyType != KeyType.CANCEL)
        {
            KeyPressed();
            Debug.Log("Key Pressed");
        }
    }

    /// <summary>
    /// method which applies the shift-setting of the keyboard to the letter and to the caption text-mesh
    /// </summary>
    /// <param name="shiftOn"></param>
    public void Shift(bool shiftOn)
    {
        if (keyType == KeyType.LETTER)
        {
            if (shiftOn)
            {
                letter = letter.ToUpper();
            }
            else
            {
                letter = letter.ToLower();
            }
            caption.text = letter;
        }
    }

    public void OnInputClicked(InputClickedEventData eventData)
    {
        if (keyType== KeyType.ACCEPT || keyType == KeyType.CANCEL)
        {
            KeyPressed();
        }
    }
}


text:
<?php

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

class AddRevisaoResolucaoToDiligencias extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //
        Schema::table('diligencias', function (Blueprint $table) {

            $table->text('revisao_resolucao')->nullable(); // correspondente responde a revisao
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}


text:
using System;
using System.Collections.Generic;

namespace Ricoh.Models
{
  /// <summary>
  /// Represents the type of address book entry.
  /// </summary>
  public enum RicohEntryType
  {
    None = 0,
    User = 1,
    Group = 2
  }

  public static class RicohEntryTypeExtensions
  {
    /// <summary>
    /// GetValue's the internal session type used by the external service.
    /// </summary>
    /// <param name="type">The type to be converted.</param>
    /// <returns>The string representation required by the external service.</returns>
    internal static RicohEntryType FromExternalServiceValue(this string type)
    {
      IDictionary<string, RicohEntryType> map = new Dictionary<string, RicohEntryType>() {
        { "user", RicohEntryType.User },
        { "group", RicohEntryType.Group },
      };
      return (map[type]);
    }

    /// <summary>
    /// GetValue's the internal session type used by the external service.
    /// </summary>
    /// <param name="type">The type to be converted.</param>
    /// <returns>The string representation required by the external service.</returns>
    internal static string ToExternalServiceValue(this RicohEntryType type)
    {
      IDictionary<RicohEntryType, string> map = new Dictionary<RicohEntryType, string>() {
        { RicohEntryType.None, "user" },
        { RicohEntryType.User, "user" },
        { RicohEntryType.Group, "group" },
      };
      return (map[type]);
    }
  }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Bot. Zh. SSSR 45: 1695 (1960)

#### Original name
Poria buxi Bondartsev

### Remarks
null


text:
using Playnite;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;

namespace Playnite.Behaviors
{
    public class ExpanderBehaviors
    {
        private static readonly DependencyProperty SaveStateProperty =
            DependencyProperty.RegisterAttached("SaveState", typeof(bool), typeof(ExpanderBehaviors));

        public static bool GetSaveState(DependencyObject obj)
        {
            return (bool)obj.GetValue(SaveStateProperty);
        }

        public static void SetSaveState(DependencyObject obj, bool value)
        {
            obj.SetValue(SaveStateProperty, value);
        }

        private static readonly DependencyProperty SaveStateIdProperty =
            DependencyProperty.RegisterAttached("SaveStateId", typeof(string), typeof(ExpanderBehaviors));

        public static string GetSaveStateId(DependencyObject obj)
        {
            return (string)obj.GetValue(SaveStateIdProperty);
        }

        public static void SetSaveStateId(DependencyObject obj, string value)
        {
            obj.SetValue(SaveStateIdProperty, value);
        }
    }
}


text:
//======================================================================================
// Copyright 5AM Solutions Inc, Yale University
//
// Distributed under the OSI-approved BSD 3-Clause License.
// See http://ncip.github.com/caarray/LICENSE.txt for details.
//======================================================================================
package gov.nih.nci.caarray.application.registration;

import gov.nih.nci.caarray.dao.SearchDao;
import gov.nih.nci.caarray.domain.register.RegistrationRequest;
import gov.nih.nci.caarray.injection.InjectionInterceptor;
import gov.nih.nci.caarray.util.io.logging.LogUtil;

import javax.ejb.Local;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.interceptor.Interceptors;

import org.apache.log4j.Logger;

import com.google.inject.Inject;

/**
 * Implementation entry point for the Registration subsystem.
 */
@Local(RegistrationService.class)
@Stateless
@Interceptors(InjectionInterceptor.class)
public class RegistrationServiceBean implements RegistrationService {
    private static final Logger LOG = Logger.getLogger(RegistrationServiceBean.class);
    private SearchDao searchDao;

    /**
     *
     * @param searchDao the SearchDao dependency
     */
    @Inject
    public void setSearchDao(SearchDao searchDao) {
        this.searchDao = searchDao;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    @TransactionAttribute(TransactionAttributeType.REQUIRED)
    public void register(RegistrationRequest registrationRequest) {
        LogUtil.logSubsystemEntry(LOG, registrationRequest);
        this.searchDao.save(registrationRequest);
        LogUtil.logSubsystemExit(LOG);
    }
}


text:
@interface QBUArrayOfUserSerialiser : QBJSONResponseSerialiser

@end


text:
import bottle

def setup(main_app, sub_apps = [], plugins = [], error_handlers = [], error_handler_generators = []):
    real_sub_apps = sub_apps[:]
    real_sub_apps.append(main_app)
    for app_data in real_sub_apps:
        if isinstance(app_data, list):
            app, mountpoint = app_data
        else:
            app = app_data
            mountpoint = None

        if app is not main_app and mountpoint is not None:
            main_app.mount(mountpoint, app)

        for plugin in plugins:
            app.install(plugin)

        for handler_data in error_handlers:
            if isinstance(handler_data, list):
                range_, handler = handler_data
            else:
                range_ = range(300, 599)
                handler = handler_data

            for code in bottle.HTTP_CODES:
                if code in range_:
                    app.error(code)(handler)

        for handler_data in error_handler_generators:
            if isinstance(handler_data, list):
                range_, handler = handler_data
            else:
                range_ = range(300, 599)
                handler = handler_data

            for code in bottle.HTTP_CODES:
                if code in range_:
                    app.error(code)(handler(code))


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package org.usfirst.frc5107.commands;

/**
 *
 * @author Developer
 */
public class xTrack extends CommandBase{
    private boolean centered;
    public xTrack(){
        requires(camera);
    }
    protected void initialize() {

    }

    protected void execute() {
        if(camera.cogx() > 310){
            driveTrain.valDrive(-.25, -.1);
            centered = true;
        }else if(camera.cogx() < 270){
            driveTrain.valDrive(-.25, .1);
            centered = true;
        }else{
            driveTrain.valDrive(0, 0);
            centered = false;
        }
    }

    protected boolean isFinished() {
        return centered;
    }

    protected void end() {

    }

    protected void interrupted() {

    }

}


text:
package org.apache.camel.component.file;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.InputStream;
import java.io.Serializable;

import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.junit.Before;
import org.junit.Test;

public class GenericFileConverterTest extends ContextTestSupport {

    @Override
    @Before
    public void setUp() throws Exception {
        deleteDirectory("target/data/gf");
        super.setUp();
    }

    @Override
    public boolean isUseRouteBuilder() {
        return false;
    }

    @Test
    public void testToFile() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("file://target/data/gf?initialDelay=0&delay=10")
                    .convertBodyTo(File.class)
                    .to("mock:result");
            }
        });
        context.start();

        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMessageCount(1);
        mock.message(0).body().isInstanceOf(File.class);

        template.sendBodyAndHeader("file://target/data/gf", "Hello World", Exchange.FILE_NAME, "hello.txt");

        assertMockEndpointsSatisfied();
    }

    @Test
    public void testToString() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("file://target/data/gf?initialDelay=0&delay=10")
                    .convertBodyTo(String.class)
                    .to("mock:result");
            }
        });
        context.start();

        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMessageCount(1);
        mock.message(0).body().isInstanceOf(String.class);
        mock.message(0).body().isEqualTo("Hello World");

        template.sendBodyAndHeader("file://target/data/gf", "Hello World", Exchange.FILE_NAME, "hello.txt");

        assertMockEndpointsSatisfied();
    }

    @Test
    public void testToBytes() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("file://target/data/gf?initialDelay=0&delay=10")
                    .convertBodyTo(byte[].class)
                    .to("mock:result");
            }
        });
        context.start();

        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMessageCount(1);
        mock.message(0).body().isInstanceOf(byte[].class);
        mock.message(0).body(String.class).isEqualTo("Hello World");

        template.sendBodyAndHeader("file://target/data/gf", "Hello World", Exchange.FILE_NAME, "hello.txt");

        assertMockEndpointsSatisfied();
    }

    @Test
    public void testToSerializable() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("file://target/data/gf?initialDelay=0&delay=10")
                    .convertBodyTo(Serializable.class)
                    .to("mock:result");
            }
        });
        context.start();

        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMessageCount(1);
        mock.message(0).body().isInstanceOf(Serializable.class);
        mock.message(0).body(String.class).isEqualTo("Hello World");

        template.sendBodyAndHeader("file://target/data/gf", "Hello World", Exchange.FILE_NAME, "hello.txt");

        assertMockEndpointsSatisfied();
    }

    @Test
    public void testToInputStream() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("file://target/data/gf?initialDelay=0&delay=10")
                    .convertBodyTo(InputStream.class)
                    .to("mock:result");
            }
        });
        context.start();

        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMessageCount(1);
        mock.message(0).body().isInstanceOf(InputStream.class);
        mock.message(0).body(String.class).isEqualTo("Hello World");

        template.sendBodyAndHeader("file://target/data/gf", "Hello World", Exchange.FILE_NAME, "hello.txt");

        assertMockEndpointsSatisfied();
    }

    @Test
    public void testToFileInputStream() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("file://target/data/gf?initialDelay=0&delay=10")
                    .convertBodyTo(InputStream.class)
                    .process(new Processor() {
                        @Override
                        public void process(Exchange exchange) throws Exception {
                            Object body = exchange.getIn().getBody();
                            assertIsInstanceOf(BufferedInputStream.class, body);
                        }
                    })
                    .to("mock:result");
            }
        });
        context.start();

        // a file input stream is wrapped in a buffered so its faster

        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMessageCount(1);
        mock.message(0).body().isInstanceOf(BufferedInputStream.class);
        mock.message(0).body(String.class).isEqualTo("Hello World");

        template.sendBodyAndHeader("file://target/data/gf", "Hello World", Exchange.FILE_NAME, "hello.txt");

        assertMockEndpointsSatisfied();
    }

}


text:
package eu.seaclouds.modaclouds.dda;

import brooklyn.entity.basic.SoftwareProcessImpl;

public class MODACloudsDeterministicDataAnalyzerImpl extends SoftwareProcessImpl implements MODACloudsDeterministicDataAnalyzer {

   @Override
   public Class getDriverInterface() {
      return MODACloudsDeterministicDataAnalizerDriver.class;
   }

   @Override
   public String getShortName() {
      return "MODAClouds DDA";
   }

   @Override
   protected void connectSensors() {
      super.connectSensors();
      connectServiceUpIsRunning();
   }

   @Override
   protected void disconnectSensors() {
      disconnectServiceUpIsRunning();
      super.disconnectSensors();
   }

}


text:
import { Completion, CompletionFunc } from '@pnpm/command'
import { split as splitCmd } from 'split-cmd'
import tabtab from '@pnpm/tabtab'
import {
  currentTypedWordType,
  getLastOption,
} from '../getOptionType'
import { parseCliArgs } from '../parseCliArgs'
import { complete } from './complete'

export function createCompletion (
  opts: {
    cliOptionsTypesByCommandName: Record<string, () => Object>
    completionByCommandName: Record<string, CompletionFunc>
    initialCompletion: () => Completion[]
    shorthandsByCommandName: Record<string, Record<string, string | string[]>>
    universalOptionsTypes: Record<string, Object>
  }
) {
  return async () => {
    const env = tabtab.parseEnv(process.env)
    if (!env.complete) return

    // Parse only words that are before the pointer and finished.
    // Finished means that there's at least one space between the word and pointer
    const finishedArgv = env.partial.slice(0, -env.lastPartial.length)
    const inputArgv = splitCmd(finishedArgv).slice(1)
    // We cannot autocomplete what a user types after "pnpm test --"
    if (inputArgv.includes('--')) return
    const { params, options, cmd } = await parseCliArgs(inputArgv)
    return tabtab.log(
      await complete(
        opts,
        {
          cmd,
          currentTypedWordType: currentTypedWordType(env),
          lastOption: getLastOption(env),
          options,
          params,
        }
      )
    )
  }
}


text:
<?php

namespace App\Http\Controllers\Frontend\Auth;

use App\Http\Controllers\Controller;
use App\Repositories\Frontend\Auth\UserRepository;
use App\Http\Requests\Frontend\User\UpdatePasswordRequest;

/**
 * Class UpdatePasswordController.
 */
class UpdatePasswordController extends Controller
{
    /**
     * @var UserRepository
     */
    protected $userRepository;

    /**
     * ChangePasswordController constructor.
     *
     * @param UserRepository $userRepository
     */
    public function __construct(UserRepository $userRepository)
    {
        $this->userRepository = $userRepository;
    }

    /**
     * @param UpdatePasswordRequest $request
     *
     * @return mixed
     * @throws \App\Exceptions\GeneralException
     */
    public function update(UpdatePasswordRequest $request)
    {
        $this->userRepository->updatePassword($request->only('old_password', 'password'));

        return redirect()->route('frontend.user.account')->withFlashSuccess(__('strings.frontend.user.password_updated'));
    }
}


text:
using System.Dynamic.Utils;

namespace System.Linq.Expressions
{
    public class DynamicExpressionVisitor : ExpressionVisitor
    {
        /// <summary>
        /// Visits the children of the <see cref="DynamicExpression" />.
        /// </summary>
        /// <param name="node">The expression to visit.</param>
        /// <returns>The modified expression, if it or any subexpression was modified;
        /// otherwise, returns the original expression.</returns>
        protected internal override Expression VisitDynamic(DynamicExpression node)
        {
            Expression[] a = ExpressionVisitorUtils.VisitArguments(this, node);
            if (a == null)
            {
                return node;
            }

            return node.Rewrite(a);
        }
    }
}