text:
		Email me something

	<form action="https://formspree.io/roy.jiang.4757@gmail.com" method="POST">

				<input class="mdl-textfield__input" type="text" name="email" id="input-email-address">
				Your email

				<textarea class="mdl-textfield__input" type="text" name="content" rows="3" id="input-text"></textarea>
				What would you like to say?

			<button type="submit" value="Send Message" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored">
				Send
			</button>

	</form>

		<button class="mdl-button mdl-js-button mdl-button--icon mdl-button--colored" ui-sref="app.home">
			close
		</button>


text:
package org.apache.jetspeed.portlets.security.sso;

import java.io.IOException;
import java.security.AccessController;
import java.sql.Types;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletConfig;
import javax.portlet.PortletException;
import javax.portlet.PortletMode;
import javax.portlet.PortletRequest;
import javax.portlet.PortletResponse;
import javax.portlet.PortletSession;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.security.auth.Subject;

import org.apache.commons.lang.StringUtils;
import org.apache.jetspeed.CommonPortletServices;
import org.apache.jetspeed.security.JSSubject;
import org.apache.jetspeed.security.SecurityException;
import org.apache.jetspeed.security.User;
import org.apache.jetspeed.security.UserManager;
import org.apache.jetspeed.sso.SSOException;
import org.apache.jetspeed.sso.SSOManager;
import org.apache.jetspeed.sso.SSOSite;
import org.apache.jetspeed.sso.SSOUser;
import org.apache.portals.applications.gems.browser.BrowserIterator;
import org.apache.portals.applications.gems.browser.BrowserPortlet;
import org.apache.portals.applications.gems.browser.DatabaseBrowserIterator;
import org.apache.portals.applications.gems.browser.StatusMessage;
import org.apache.portals.messaging.PortletMessaging;
import org.apache.velocity.context.Context;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * SSOChangePasswordPortlet
 *
 * @version $Id: SSOChangePasswordPortlet.java 823599 2009-10-09 15:55:13Z woonsan $
 */
public class SSOChangePasswordPortlet extends BrowserPortlet
{

    static final Logger logger = LoggerFactory.getLogger(SSOChangePasswordPortlet.class);

    private SSOManager sso;
    private UserManager userManager;

    public void init(PortletConfig config)
    throws PortletException
    {
        super.init(config);
        sso = (SSOManager)getPortletContext().getAttribute(CommonPortletServices.CPS_SSO_COMPONENT);
        if (null == sso)
        {
            throw new PortletException("Failed to find the SSO Provider on portlet initialization");
        }
        userManager = (UserManager) getPortletContext().getAttribute(CommonPortletServices.CPS_USER_MANAGER_COMPONENT);
        if (null == userManager)
        {
            throw new PortletException("Failed to find the User Manager on portlet initialization");
        }
    }

    public void getRows(RenderRequest request, String sql, int windowSize)
    throws Exception
    {
        List resultSetTitleList = new ArrayList();
        List resultSetTypeList = new ArrayList();
        try
        {
            Collection<SSOSite> sites = sso.getSites("");

            resultSetTypeList.add(String.valueOf(Types.VARCHAR));
            resultSetTypeList.add(String.valueOf(Types.VARCHAR));
            resultSetTitleList.add(0, "URL");
            resultSetTitleList.add(1, "Site");

            //subPopulate(rundata, qResult, repo, folder, null);
            List list = new ArrayList();
            if (sites != null){
                for (SSOSite site : sites ){
                	List row = new ArrayList(2);
                    row.add(0, site.getURL());
                    row.add(1, site.getName());
                    list.add(row);
                }
            }
            BrowserIterator iterator = new DatabaseBrowserIterator(
                    list, resultSetTitleList, resultSetTypeList,
                    windowSize);
            setBrowserIterator(request, iterator);
            iterator.sort("Site");
        }
        catch (Exception e)
        {
            logger.error("Exception in getRows: ", e);
            throw e;
        }
    }

    public void doView(RenderRequest request, RenderResponse response)
    throws PortletException, IOException
    {
        String selectedSiteName = (String)PortletMessaging.receive(request, "SSOChangePassword", "selectedName");
        if (selectedSiteName != null)
        {
            Context context = this.getContext(request);
            context.put("currentName", selectedSiteName);
            context.put("currentUrl", (String)PortletMessaging.receive(request, "SSOChangePassword", "selectedUrl"));
            String ssoUsername = (String)PortletMessaging.receive(request, "SSOChangePassword", "ssoUsername");
            context.put("ssoUsername", ssoUsername);
        }
        StatusMessage msg = (StatusMessage)PortletMessaging.consume(request, "SSOChangePassword", "status");
        if (msg != null)
        {
            this.getContext(request).put("statusMsg", msg);
        }

        super.doView(request, response);
    }

    protected void clearPortletMessages(PortletRequest request, PortletResponse response){
    	PortletMessaging.cancel(request, "SSOChangePassword", "selectedName");
        PortletMessaging.cancel(request, "SSOChangePassword", "selectedUrl");
        PortletMessaging.cancel(request, "SSOChangePassword", "ssoUsername");
    }

    protected void setPortletMessage(PortletRequest request, String key, String msg) throws IOException{
    	if (StringUtils.isNotEmpty(msg)){
    		PortletMessaging.publish(request, "SSOChangePassword", key, msg);
    	} else {
    		PortletMessaging.cancel(request, "SSOChangePassword", key);
    	}
    }

    public void processAction(ActionRequest request, ActionResponse response)
    throws PortletException, IOException
    {
        if (request.getPortletMode() == PortletMode.VIEW)
        {
            String selectedSite = request.getParameter("ssoSite");
            if (selectedSite != null)
            {
            	SSOSite site = sso.getSiteByName(selectedSite);
                if (site != null)
                {
                    setPortletMessage(request, "selectedUrl", site.getURL());
                    setPortletMessage(request, "selectedName", site.getName());
                    setPortletMessage(request, "change", selectedSite);
                    setPortletMessage(request, "ssoUsername", getRemoteUserName(request, site));
                }
            }
            String refresh = request.getParameter("sso.refresh");
            String save = request.getParameter("sso.save");
            String delete = request.getParameter("sso.delete");

            if (refresh != null)
            {
                this.clearBrowserIterator(request);
            }
            else if (delete != null)
            {
                String siteName = request.getParameter("site.name");

                if (!StringUtils.isEmpty(siteName))
                {
                    SSOSite site = sso.getSiteByName(siteName);

                    if (site != null)
                    {
                        removeRemoteUser(request, site);
                        this.clearBrowserIterator(request);
                        clearPortletMessages(request,response);
                    }
                }
            }
            else if (save != null)
            {
                String siteName = request.getParameter("site.name");
                String siteUrl = request.getParameter("site.url");
                String ssoUsername = request.getParameter("ssoUsername");
                String ssoPassword = request.getParameter("ssoPassword");

                if (!StringUtils.isEmpty(siteName) && !StringUtils.isEmpty(siteUrl) && !StringUtils.isEmpty(ssoUsername) && !StringUtils.isEmpty(ssoPassword))
                {
                    SSOSite site = null;
                    String old = (String)PortletMessaging.receive(request, "site", "selectedName");
                    site = sso.getSiteByName(old != null ? old : siteName);

                    addOrUpdateRemoteUser(request, site, ssoUsername, ssoPassword);

                	this.clearBrowserIterator(request);
                    PortletMessaging.publish(request, "SSOChangePassword", "selectedName", siteName);
                    PortletMessaging.publish(request, "SSOChangePassword", "selectedUrl", siteUrl);
                    PortletMessaging.publish(request, "SSOChangePassword", "ssoUsername", ssoUsername);
                }
            }
        }

        request.getPortletSession().removeAttribute("org.apache.jetspeed.portlets.sso.ssoSiteCredsOfSubject", PortletSession.APPLICATION_SCOPE);

        super.processAction(request, response);

    }

    private String getRemoteUserName(PortletRequest request, SSOSite site)
    {
        String remoteUsername = null;

        try
        {
            Subject subject = JSSubject.getSubject(AccessController.getContext());
            Collection<SSOUser> remoteUsers = sso.getRemoteUsers(site, subject);

            if (remoteUsers != null && !remoteUsers.isEmpty())
            {
                remoteUsername = remoteUsers.iterator().next().getName();
            }
        }
        catch (SSOException e)
        {
            publishStatusMessage(request, "SSOChangePassword", "status", e, "Could not retrieve sso user name");
        }

        return remoteUsername;
    }

    private void removeRemoteUser(PortletRequest request, SSOSite site)
    {
        try
        {
            Subject subject = JSSubject.getSubject(AccessController.getContext());
            Collection<SSOUser> remoteUsers = sso.getRemoteUsers(site, subject);

            if (remoteUsers != null && !remoteUsers.isEmpty())
            {
                sso.removeUser(remoteUsers.iterator().next());
            }
        }
        catch (SSOException e)
        {
            publishStatusMessage(request, "SSOChangePassword", "status", e, "Could not remove sso user");
        }
    }

    private void addOrUpdateRemoteUser(PortletRequest request, SSOSite site, String username, String password)
    {
        try
        {
            Subject subject = JSSubject.getSubject(AccessController.getContext());
            Collection<SSOUser> remoteUsers = sso.getRemoteUsers(site, subject);

            if (remoteUsers != null && !remoteUsers.isEmpty())
            {
                SSOUser ssoUser = remoteUsers.iterator().next();

                if (!StringUtils.equals(ssoUser.getName(), username))
                {
                    ssoUser.setName(username);
                    sso.updateUser(ssoUser);
                }

                sso.setPassword(ssoUser, password);
            }
            else
            {
                User user = userManager.getUser(request.getUserPrincipal().getName());
                sso.addUser(site, user, username, password);
            }
        }
        catch (SSOException e)
        {
            publishStatusMessage(request, "SSOChangePassword", "status", e, "Could not remove sso user");
        }
        catch (SecurityException e)
        {
            publishStatusMessage(request, "SSOChangePassword", "status", e, "Could not retrieve jetspeed user");
        }
    }

}

redpajama_set_name: RedPajamaGithub


text:
// Copyright 2012 Fan Shi
//
// This file is part of the VBF project.
//
// 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.

using System;
using System.Collections.Generic;

namespace VBF.Compilers.Common
{
    public enum ExtremeType
    {
        Minimum,
        Maximum
    }

    public class PriorityQueue<T>
    {
        private List<T> m_binaryHeap;
        private IComparer<T> m_comparer;

        //return true if left is less/greater than right based on extreme type
        //less in Minimum mode, greater in maximum mode
        private Func<T, T, bool> m_inRightOrder;
        private Dictionary<T, int> m_indexDict;

        private int m_size;

        public PriorityQueue(IEnumerable<T> values, ExtremeType type, IComparer<T> comparer)
        {
            CodeContract.RequiresArgumentNotNull(comparer, "comparer");

            m_comparer = comparer;

            switch (type)
            {
                case ExtremeType.Minimum:
                    m_inRightOrder = Less;
                    break;
                case ExtremeType.Maximum:
                    m_inRightOrder = Greater;
                    break;
                default:
                    throw new ArgumentOutOfRangeException("type", "ExtremeType can only be Minmun or Maximum");
            }

            m_indexDict = new Dictionary<T, int>();

            //initialize prioirty queue heap
            if (values != null)
            {
                m_binaryHeap = new List<T>(values);

                for (int i = 0; i < m_binaryHeap.Count; i++)
                {
                    m_indexDict.Add(m_binaryHeap[i], i);
                }
            }
            else
            {
                m_binaryHeap = new List<T>();
            }

            InitializeHeap();
        }

        public PriorityQueue(IEnumerable<T> values, ExtremeType type) : this(values, type, Comparer<T>.Default) { }

        public PriorityQueue(ExtremeType type) : this(null, type, Comparer<T>.Default) { }

        public PriorityQueue() : this(null, ExtremeType.Minimum, Comparer<T>.Default) { }

        public bool IsEmpty
        {
            get
            {
                return m_size == 0;
            }
        }

        private bool Less(T v0, T v1)
        {
            return m_comparer.Compare(v0, v1) < 0;
        }

        private bool Greater(T v0, T v1)
        {
            return m_comparer.Compare(v0, v1) > 0;
        }

        private void InitializeHeap()
        {
            //step 1: swap heap[0] to heap[count], make heap[0] a placeholder
            int count = m_binaryHeap.Count;

            if (count > 0)
            {
                m_binaryHeap.Add(m_binaryHeap[0]);
                m_indexDict[m_binaryHeap[0]] = m_binaryHeap.Count - 1;
                m_binaryHeap[0] = default(T);
            }
            else
            {
                m_binaryHeap.Add(default(T));
            }

            m_size = count;

            for (int i = m_size / 2; i > 0; i--)
            {
                PercolateDown(i);
            }
        }

        private void PercolateDown(int index)
        {
            int hole = index;
            T temp = m_binaryHeap[hole];

            while (hole * 2 <= m_size)
            {
                int child = hole * 2;

                if (child != m_size &&
                    m_inRightOrder(m_binaryHeap[child + 1], m_binaryHeap[child]))
                {
                    child++;
                }

                if (m_inRightOrder(m_binaryHeap[child], temp))
                {
                    m_binaryHeap[hole] = m_binaryHeap[child];
                    m_indexDict[m_binaryHeap[hole]] = hole;
                }
                else
                {
                    break;
                }

                hole = child;
            }

            m_binaryHeap[hole] = temp;
            m_indexDict[temp] = hole;
        }

        private void PercolateUp(int index)
        {
            T temp = m_binaryHeap[index];
            int hole = index;

            while (hole > 1 && m_inRightOrder(temp, m_binaryHeap[hole / 2]))
            {
                m_binaryHeap[hole] = m_binaryHeap[hole / 2];
                m_indexDict[m_binaryHeap[hole]] = hole;
                hole /= 2;
            }

            m_binaryHeap[hole] = temp;
            m_indexDict[temp] = hole;
        }

        public T PeekExtreme()
        {
            if (IsEmpty)
            {
                throw new InvalidOperationException("Priority queue is empty");
            }

            return m_binaryHeap[1];
        }

        public T DeleteExtreme()
        {
            if (IsEmpty)
            {
                throw new InvalidOperationException("Priority queue is empty");
            }

            T extreme = m_binaryHeap[1];

            m_binaryHeap[1] = m_binaryHeap[m_size];
            m_indexDict[m_binaryHeap[1]] = 1;
            m_size--;

            PercolateDown(1);

            return extreme;
        }

        public void Insert(T value)
        {
            if (m_size == m_binaryHeap.Count - 1)
            {
                //full, add one
                m_binaryHeap.Add(value);
                m_size += 1;
            }
            else
            {
                m_size += 1;
                m_binaryHeap[m_size] = value;
            }

            m_indexDict[value] = m_size;
            PercolateUp(m_size);
        }

        public void ModifyValue(T originalValue, T newValue)
        {
            int current;
            if (!m_indexDict.TryGetValue(originalValue, out current))
            {
                throw new ArgumentOutOfRangeException("originalValue", "The originalValue is not in the priority queue");
            }

            m_binaryHeap[current] = newValue;

            if (m_inRightOrder(newValue, originalValue))
            {
                //near extreme, go up
                PercolateUp(current);
            }
            else
            {
                //far from extreme, go down
                PercolateDown(current);
            }
        }
    }
}


text:
#ifndef COLORNAME_H
#define COLORNAME_H

#include <string.h>
#include <stdio.h>
#include "ppm.h"

#ifdef __cplusplus
extern "C" {
#endif
#if 0
} /* to fake out automatic code indenters */
#endif

enum colornameFormat {PAM_COLORNAME_ENGLISH = 0,
                      PAM_COLORNAME_HEXOK   = 1};

struct colorfile_entry {
    long r, g, b;
    char * colorname;
};

void
pm_canonstr(char * const str);

FILE *
pm_openColornameFile(const char * const fileName, const int must_open);

struct colorfile_entry
pm_colorget(FILE * const f);

void
pm_parse_dictionary_name(const char       colorname[],
                         pixval     const maxval,
                         int        const closeOk,
                         pixel *    const colorP);

#ifdef __cplusplus
}
#endif
#endif


text:
package com.facebook.react.packagerconnection;

public interface Responder {
  void respond(Object result);
  void error(Object error);
}


text:
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to
 * deal in the Software without restriction, including without limitation the
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 * sell copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */

#include <time.h> // for clock_xxx functions

#include <uv.h>

/* Available from 2.6.32 onwards, some embeded platform has header file without defination of this! */
#ifndef CLOCK_MONOTONIC_COARSE
# define CLOCK_MONOTONIC_COARSE 6
#endif

uint64_t uv__hrtime(uv_clocktype_t type) {
  static clock_t fast_clock_id = -1;
  struct timespec t;
  clock_t clock_id;

  /* Prefer CLOCK_MONOTONIC_COARSE if available but only when it has
   * millisecond granularity or better.  CLOCK_MONOTONIC_COARSE is
   * serviced entirely from the vDSO, whereas CLOCK_MONOTONIC may
   * decide to make a costly system call.
   */
  /* TODO(bnoordhuis) Use CLOCK_MONOTONIC_COARSE for UV_CLOCK_PRECISE
   * when it has microsecond granularity or better (unlikely).
   */
  if (type == UV_CLOCK_FAST && fast_clock_id == -1) {
    if (clock_getres(CLOCK_MONOTONIC_COARSE, &t) == 0 &&
        t.tv_nsec <= 1 * 1000 * 1000) {
      fast_clock_id = CLOCK_MONOTONIC_COARSE;
    } else {
      fast_clock_id = CLOCK_MONOTONIC;
    }
  }

  clock_id = CLOCK_MONOTONIC;
  if (type == UV_CLOCK_FAST)
    clock_id = fast_clock_id;

  if (clock_gettime(clock_id, &t))
    return 0;  /* Not really possible. */

  return t.tv_sec * (uint64_t) 1e9 + t.tv_nsec;
}

inline uint64_t uv__time_precise() {
  return uv__hrtime(UV_CLOCK_PRECISE);
}


text:
/**
 *
 */
package org.semanticweb.elk.proofs.inferences.classes;
/*
 * #%L
 * ELK Reasoner
 * $Id:$
 * $HeadURL:$
 * %%
 * Copyright (C) 2011 - 2014 Department of Computer Science, University of Oxford
 * %%
 * 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.
 * #L%
 */

import java.util.Collection;
import java.util.Collections;

import org.semanticweb.elk.owl.interfaces.ElkClassAxiom;
import org.semanticweb.elk.owl.interfaces.ElkClassExpression;
import org.semanticweb.elk.owl.interfaces.ElkObject;
import org.semanticweb.elk.owl.interfaces.ElkObjectUnionOf;
import org.semanticweb.elk.proofs.expressions.AxiomExpression;
import org.semanticweb.elk.proofs.expressions.Expression;
import org.semanticweb.elk.proofs.expressions.ExpressionFactory;
import org.semanticweb.elk.proofs.inferences.AbstractInference;
import org.semanticweb.elk.proofs.inferences.InferenceRule;
import org.semanticweb.elk.proofs.inferences.InferenceVisitor;
import org.semanticweb.elk.proofs.utils.InferencePrinter;

/**
 * @author Pavel Klinov
 *
 * pavel.klinov@uni-ulm.de
 */
public class DisjunctionComposition extends AbstractInference<AxiomExpression<? extends ElkClassAxiom>> {

	private final Expression premise_;

	public DisjunctionComposition(ElkClassExpression sub, ElkObjectUnionOf sup, ElkClassExpression premise, ElkObject.Factory factory, ExpressionFactory exprFactory) {
		super(exprFactory.create(factory.getSubClassOfAxiom(sub, sup)));

		premise_ = exprFactory.create(factory.getSubClassOfAxiom(sub, premise));
	}

	@Override
	public Collection<Expression> getRawPremises() {
		return Collections.singletonList(premise_);
	}

	@Override
	public <I, O> O accept(InferenceVisitor<I, O> visitor, I input) {
		return visitor.visit(this, input);
	}

	@Override
	public String toString() {
		return InferencePrinter.print(this);
	}

	@Override
	public InferenceRule getRule() {
		return InferenceRule.R_OR_COMPOSITION;
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
	<string name="xlistview_header_hint_normal">下拉刷新</string>
    <string name="xlistview_header_hint_ready">松开刷新数据</string>
    <string name="xlistview_header_hint_loading">正在加载...</string>
    <string name="xlistview_header_last_time">上次更新时间:</string>
    <string name="xlistview_footer_hint_normal">查看更多</string>
    <string name="xlistview_footer_hint_ready">松开载入更多</string>
</resources>


text:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
    jcr:primaryType="cq:Page">
    <jcr:content
        cq:deviceGroups="[mobile/groups/responsive]"
        cq:template="/conf/example/settings/wcm/templates/empty-experience-fragment"
        jcr:primaryType="cq:PageContent"
        sling:resourceType="example/components/page">
        <root
            jcr:primaryType="nt:unstructured"
            sling:resourceType="example/components/container"
            editable="{Boolean}true"
            layout="responsiveGrid"/>
        <cq:responsive jcr:primaryType="nt:unstructured">
            <breakpoints jcr:primaryType="nt:unstructured">
                <phone
                    jcr:primaryType="nt:unstructured"
                    title="Smaller Screen"
                    width="{Long}768"/>
                <tablet
                    jcr:primaryType="nt:unstructured"
                    title="Tablet"
                    width="{Long}1200"/>
            </breakpoints>
        </cq:responsive>
    </jcr:content>
</jcr:root>


text:
import unittest
from unittest.mock import MagicMock, patch

import pytest
from kylinpy.exceptions import KylinCubeError

from airflow.exceptions import AirflowException
from airflow.providers.apache.kylin.hooks.kylin import KylinHook

class TestKylinHook(unittest.TestCase):
    def setUp(self) -> None:
        self.hook = KylinHook(kylin_conn_id='kylin_default', project='learn_kylin')

    @patch("kylinpy.Kylin.get_job")
    def test_get_job_status(self, mock_job):
        job = MagicMock()
        job.status = "ERROR"
        mock_job.return_value = job
        assert self.hook.get_job_status('123') == "ERROR"

    @patch("kylinpy.Kylin.get_datasource")
    def test_cube_run(self, cube_source):
        class MockCubeSource:
            def invoke_command(self, command, **kwargs):
                invoke_command_list = [
                    'fullbuild',
                    'build',
                    'merge',
                    'refresh',
                    'delete',
                    'build_streaming',
                    'merge_streaming',
                    'refresh_streaming',
                    'disable',
                    'enable',
                    'purge',
                    'clone',
                    'drop',
                ]
                if command in invoke_command_list:
                    return {"code": "000", "data": {}}
                else:
                    raise KylinCubeError(f'Unsupported invoke command for datasource: {command}')

        cube_source.return_value = MockCubeSource()
        response_data = {"code": "000", "data": {}}
        assert self.hook.cube_run('kylin_sales_cube', 'build') == response_data
        assert self.hook.cube_run('kylin_sales_cube', 'refresh') == response_data
        assert self.hook.cube_run('kylin_sales_cube', 'merge') == response_data
        assert self.hook.cube_run('kylin_sales_cube', 'build_streaming') == response_data
        with pytest.raises(AirflowException):
            self.hook.cube_run(
                'kylin_sales_cube',
                'build123',
            )


text: <script src="//about.me/embed/xue.he"></script>


text:
// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.compositor;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.text.TextUtils;
import android.util.SparseArray;

import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
import org.chromium.base.annotations.NativeMethods;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.compositor.layouts.content.TitleBitmapFactory;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabFavicon;
import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.chrome.browser.ui.favicon.FaviconHelper;
import org.chromium.chrome.browser.ui.favicon.FaviconHelper.DefaultFaviconHelper;
import org.chromium.chrome.browser.ui.favicon.FaviconHelper.FaviconImageCallback;
import org.chromium.ui.base.LocalizationUtils;
import org.chromium.ui.resources.ResourceManager;
import org.chromium.ui.resources.dynamics.BitmapDynamicResource;
import org.chromium.ui.resources.dynamics.DynamicResourceLoader;
import org.chromium.url.GURL;

/**
 * A version of the {@link LayerTitleCache} that builds native cc::Layer objects
 * that represent the cached title textures.
 */
@JNINamespace("android")
public class LayerTitleCache {
    private static int sNextResourceId = 1;

    private final Context mContext;
    private TabModelSelector mTabModelSelector;

    private final SparseArray<Title> mTitles = new SparseArray<Title>();
    private final int mFaviconSize;

    private long mNativeLayerTitleCache;
    private ResourceManager mResourceManager;

    private FaviconHelper mFaviconHelper;
    private DefaultFaviconHelper mDefaultFaviconHelper;

    /** Responsible for building titles on light themes or standard tabs. */
    protected TitleBitmapFactory mStandardTitleBitmapFactory;
    /** Responsible for building incognito or dark theme titles. */
    protected TitleBitmapFactory mDarkTitleBitmapFactory;

    /**
     * Builds an instance of the LayerTitleCache.
     */
    public LayerTitleCache(Context context, ResourceManager resourceManager) {
        mContext = context;
        mResourceManager = resourceManager;
        Resources res = context.getResources();
        final int fadeWidthPx = res.getDimensionPixelOffset(R.dimen.border_texture_title_fade);
        final int faviconStartPaddingPx =
                res.getDimensionPixelSize(R.dimen.tab_title_favicon_start_padding);
        final int faviconEndPaddingPx =
                res.getDimensionPixelSize(R.dimen.tab_title_favicon_end_padding);
        mNativeLayerTitleCache = LayerTitleCacheJni.get().init(LayerTitleCache.this, fadeWidthPx,
                faviconStartPaddingPx, faviconEndPaddingPx, R.drawable.spinner,
                R.drawable.spinner_white, mResourceManager);
        mFaviconSize = res.getDimensionPixelSize(R.dimen.compositor_tab_title_favicon_size);
        mStandardTitleBitmapFactory = new TitleBitmapFactory(context, false);
        mDarkTitleBitmapFactory = new TitleBitmapFactory(context, true);
        mDefaultFaviconHelper = new DefaultFaviconHelper();
    }

    /**
     * Destroys the native reference.
     */
    public void shutDown() {
        if (mNativeLayerTitleCache == 0) return;
        LayerTitleCacheJni.get().destroy(mNativeLayerTitleCache);
        mNativeLayerTitleCache = 0;
    }

    public void setTabModelSelector(TabModelSelector tabModelSelector) {
        mTabModelSelector = tabModelSelector;
    }

    @CalledByNative
    private long getNativePtr() {
        return mNativeLayerTitleCache;
    }

    @CalledByNative
    private void buildUpdatedTitle(int tabId) {
        if (mTabModelSelector == null) return;

        Tab tab = mTabModelSelector.getTabById(tabId);
        if (tab == null || tab.isDestroyed()) return;

        getUpdatedTitle(tab, "");
    }

    public String getUpdatedTitle(Tab tab, String defaultTitle) {
        // If content view core is null, tab does not have direct access to the favicon, and we
        // will initially show default favicon. But favicons are stored in the history database, so
        // we will fetch favicons asynchronously from database.
        boolean fetchFaviconFromHistory = tab.isNativePage() || tab.getWebContents() == null;

        String titleString = getTitleForTab(tab, defaultTitle);
        getUpdatedTitleInternal(tab, titleString, fetchFaviconFromHistory);
        if (fetchFaviconFromHistory) fetchFaviconForTab(tab);
        return titleString;
    }

    private String getUpdatedTitleInternal(Tab tab, String titleString,
            boolean fetchFaviconFromHistory) {
        final int tabId = tab.getId();
        boolean isDarkTheme = tab.isIncognito();
        Bitmap originalFavicon = TabFavicon.getBitmap(tab);
        if (originalFavicon == null) {
            originalFavicon = mDefaultFaviconHelper.getDefaultFaviconBitmap(
                    mContext.getResources(), tab.getUrl(), !isDarkTheme);
        }

        TitleBitmapFactory titleBitmapFactory =
                isDarkTheme ? mDarkTitleBitmapFactory : mStandardTitleBitmapFactory;

        Title title = mTitles.get(tabId);
        if (title == null) {
            title = new Title();
            mTitles.put(tabId, title);
            title.register();
        }

        title.set(titleBitmapFactory.getTitleBitmap(mContext, titleString),
                titleBitmapFactory.getFaviconBitmap(originalFavicon), fetchFaviconFromHistory);

        if (mNativeLayerTitleCache != 0) {
            String tabTitle = tab.getTitle();
            boolean isRtl = tabTitle != null
                    && LocalizationUtils.getFirstStrongCharacterDirection(tabTitle)
                            == LocalizationUtils.RIGHT_TO_LEFT;
            LayerTitleCacheJni.get().updateLayer(mNativeLayerTitleCache, LayerTitleCache.this,
                    tabId, title.getTitleResId(), title.getFaviconResId(), isDarkTheme, isRtl);
        }
        return titleString;
    }

    private void fetchFaviconForTab(final Tab tab) {
        if (mFaviconHelper == null) mFaviconHelper = new FaviconHelper();

        // Since tab#getProfile() is not available by this time, we will use tab#isIncognito boolean
        // to get the correct profile.
        Profile profile = !tab.isIncognito()
                ? Profile.getLastUsedRegularProfile()
                : Profile.getLastUsedRegularProfile().getPrimaryOTRProfile(/*createIfNeeded=*/true);
        mFaviconHelper.getLocalFaviconImageForURL(
                profile, tab.getUrl(), mFaviconSize, new FaviconImageCallback() {
                    @Override
                    public void onFaviconAvailable(Bitmap favicon, GURL iconUrl) {
                        updateFaviconFromHistory(tab, favicon);
                    }
                });
    }

    /**
     * Comes up with a valid title to return for a tab.
     * @param tab The {@link Tab} to build a title for.
     * @return    The title to use.
     */
    private String getTitleForTab(Tab tab, String defaultTitle) {
        String title = tab.getTitle();
        if (TextUtils.isEmpty(title)) {
            title = tab.getUrl().getSpec();
            if (TextUtils.isEmpty(title)) {
                title = defaultTitle;
                if (TextUtils.isEmpty(title)) {
                    title = "";
                }
            }
        }
        return title;
    }

    private void updateFaviconFromHistory(Tab tab, Bitmap faviconBitmap) {
        if (!tab.isInitialized()) return;

        int tabId = tab.getId();
        Title title = mTitles.get(tabId);
        if (title == null) return;
        if (!title.updateFaviconFromHistory(faviconBitmap)) return;

        if (mNativeLayerTitleCache != 0) {
            LayerTitleCacheJni.get().updateFavicon(
                    mNativeLayerTitleCache, LayerTitleCache.this, tabId, title.getFaviconResId());
        }
    }

    public void remove(int tabId) {
        Title title = mTitles.get(tabId);
        if (title == null) return;
        title.unregister();
        mTitles.remove(tabId);
        if (mNativeLayerTitleCache == 0) return;
        LayerTitleCacheJni.get().updateLayer(
                mNativeLayerTitleCache, LayerTitleCache.this, tabId, -1, -1, false, false);
    }

    public void clearExcept(int exceptId) {
        Title title = mTitles.get(exceptId);
        for (int i = 0; i < mTitles.size(); i++) {
            Title toDelete = mTitles.get(mTitles.keyAt(i));
            if (toDelete == title) continue;
            toDelete.unregister();
        }
        mTitles.clear();
        mDefaultFaviconHelper.clearCache();

        if (title != null) mTitles.put(exceptId, title);

        if (mNativeLayerTitleCache == 0) return;
        LayerTitleCacheJni.get().clearExcept(
                mNativeLayerTitleCache, LayerTitleCache.this, exceptId);
    }

    private class Title {
        private final BitmapDynamicResource mFavicon = new BitmapDynamicResource(sNextResourceId++);
        private final BitmapDynamicResource mTitle = new BitmapDynamicResource(sNextResourceId++);

        // We don't want to override updated favicon (e.g. from Tab#onFaviconAvailable) with one
        // fetched from history. You can set this to true / false to control that.
        private boolean mExpectUpdateFromHistory;

        public Title() {}

        public void set(Bitmap titleBitmap, Bitmap faviconBitmap, boolean expectUpdateFromHistory) {
            mTitle.setBitmap(titleBitmap);
            mFavicon.setBitmap(faviconBitmap);
            mExpectUpdateFromHistory = expectUpdateFromHistory;
        }

        public boolean updateFaviconFromHistory(Bitmap faviconBitmap) {
            if (!mExpectUpdateFromHistory) return false;
            mFavicon.setBitmap(faviconBitmap);
            mExpectUpdateFromHistory = false;
            return true;
        }

        public void register() {
            if (mResourceManager == null) return;
            DynamicResourceLoader loader = mResourceManager.getBitmapDynamicResourceLoader();
            loader.registerResource(mFavicon.getResId(), mFavicon);
            loader.registerResource(mTitle.getResId(), mTitle);
        }

        public void unregister() {
            if (mResourceManager == null) return;
            DynamicResourceLoader loader = mResourceManager.getBitmapDynamicResourceLoader();
            loader.unregisterResource(mFavicon.getResId());
            loader.unregisterResource(mTitle.getResId());
        }

        public int getFaviconResId() {
            return mFavicon.getResId();
        }

        public int getTitleResId() {
            return mTitle.getResId();
        }
    }

    @NativeMethods
    interface Natives {
        long init(LayerTitleCache caller, int fadeWidth, int faviconStartlPadding,
                int faviconEndPadding, int spinnerResId, int spinnerIncognitoResId,
                ResourceManager resourceManager);
        void destroy(long nativeLayerTitleCache);
        void clearExcept(long nativeLayerTitleCache, LayerTitleCache caller, int exceptId);
        void updateLayer(long nativeLayerTitleCache, LayerTitleCache caller, int tabId,
                int titleResId, int faviconResId, boolean isIncognito, boolean isRtl);
        void updateFavicon(
                long nativeLayerTitleCache, LayerTitleCache caller, int tabId, int faviconResId);
    }
}


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.cghislai.organiseurilesdepaix.view.control;

import com.cghislai.organiseurilesdepaix.service.GlobalPreferenceService;
import java.io.Serializable;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.view.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;

/**
 *
 * @author cghislai
 */
@Named
@ViewScoped
public class EditPreferencesController implements Serializable {

    @EJB
    private GlobalPreferenceService globalPreferenceService;
    @Inject
    private GlobalPreferencesController globalPreferencesController;

    private String contactName;
    private String contactMail;
    private String contactPhone1;
    private String contactPhone2;

    @PostConstruct
    public void init() {
        search();
    }

    private void search() {
        contactMail = globalPreferenceService.getPreferenceValue(GlobalPreferenceService.KEY_SITE_CONTACT_EMAIL);
        contactName = globalPreferenceService.getPreferenceValue(GlobalPreferenceService.KEY_SITE_CONTACT_NAME);
        contactPhone1 = globalPreferenceService.getPreferenceValue(GlobalPreferenceService.KEY_SITE_CONTACT_TELEPHONE1);
        contactPhone2 = globalPreferenceService.getPreferenceValue(GlobalPreferenceService.KEY_SITE_CONTACT_TELEPHONE2);
    }

    public void actionSaveContact() {
        globalPreferenceService.setPreference(GlobalPreferenceService.KEY_SITE_CONTACT_NAME, contactName);
        globalPreferenceService.setPreference(GlobalPreferenceService.KEY_SITE_CONTACT_EMAIL, contactMail);
        globalPreferenceService.setPreference(GlobalPreferenceService.KEY_SITE_CONTACT_TELEPHONE1, contactPhone1);
        globalPreferenceService.setPreference(GlobalPreferenceService.KEY_SITE_CONTACT_TELEPHONE2, contactPhone2);
        search();
    }
    public void actionSetRegistrationClosed(boolean value) {
        globalPreferencesController.setPreferenceBoolean(GlobalPreferenceService.KEY_REGISTRATION_CLOSED, value);

    }

    public GlobalPreferencesController getGlobalPreferencesController() {
        return globalPreferencesController;
    }

    public void setGlobalPreferencesController(GlobalPreferencesController globalPreferencesController) {
        this.globalPreferencesController = globalPreferencesController;
    }

    public String getContactName() {
        return contactName;
    }

    public void setContactName(String contactName) {
        this.contactName = contactName;
    }

    public String getContactMail() {
        return contactMail;
    }

    public void setContactMail(String contactMail) {
        this.contactMail = contactMail;
    }

    public String getContactPhone1() {
        return contactPhone1;
    }

    public void setContactPhone1(String contactPhone1) {
        this.contactPhone1 = contactPhone1;
    }

    public String getContactPhone2() {
        return contactPhone2;
    }

    public void setContactPhone2(String contactPhone2) {
        this.contactPhone2 = contactPhone2;
    }

}


text:
#include "archive.h"

#include "assert.h"
#include "log.h"
#include "target.h"  // ftruncate

#ifdef _MSC_VER  // MSVC
#include <io.h>
#ifndef __GNUC__
// MSYS GCC allows fileno, MSVC itself does not.
#define fileno _fileno
#endif
#else  // not MSVC
#include <unistd.h>
#endif

#if GAPID_ARCHIVE_USE_MMAP

#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>

#endif  //  GAPID_ARCHIVE_USE_MMAP

namespace {

void must_truncate(int fd, off_t length) {
  if (!ftruncate(fd, length)) {
    GAPID_ASSERT("Unable to truncate the achive file");
  }
}

}  // anonymous namespace

namespace core {

static const char* kIndexFileNameSuffix = ".index";
static const char* kDataFileNameSuffix = ".data";

// Use mmap-ed data file if it is available.
// fseek+fread might fail on some driver.
#if GAPID_ARCHIVE_USE_MMAP

Archive::RecordFile::RecordFile()
    : fd(-1), base(nullptr), end(0), capacity(0) {}

bool Archive::RecordFile::open(const std::string& filename) {
  fd = ::open(filename.c_str(), O_RDWR | O_CREAT, S_IRWXU);
  if (fd == -1) {
    return false;
  }
  struct stat st;
  ::fstat(fd, &st);
  end = st.st_size;
  capacity = end;
  return map();
}

void Archive::RecordFile::close() {
  if (fd == -1) return;
  if (!unmap()) {
    GAPID_FATAL("Unable to unmap archive file.");
  }
  // Set the proper file size when we close the file.
  if (::ftruncate(fd, end)) {
    GAPID_FATAL("Unable to truncate archive file.");
  }
  ::close(fd);
}

bool Archive::RecordFile::read(uint64_t offset, void* buf, size_t size) {
  if (offset + size > end) {
    return false;
  }
  memcpy(buf, at(offset), size);
  return true;
}

bool Archive::RecordFile::append(const void* buf, size_t size) {
  if (!reserve(end + size)) {
    return false;
  }
  memcpy(at(end), buf, size);
  end += size;
  return true;
}

uint64_t Archive::RecordFile::size() { return end; }

bool Archive::RecordFile::resize(uint64_t size) {
  if (size > capacity) {
    if (!reserve(size)) {
      return false;
    }
  }
  end = size;
  return true;
}

bool Archive::RecordFile::reserve(uint64_t requiredCapacity) {
  if (requiredCapacity <= capacity) {
    return true;
  }

  if (!unmap()) {
    GAPID_FATAL("Unable to unmap archive file.");
  }

  // Reserve at least 1.5 time the size.
  if (requiredCapacity < end * 3 / 2) {
    requiredCapacity = end * 3 / 2;
  }

  // Align to the next 4k boundary, not necessary but good to have.
  requiredCapacity = (requiredCapacity + 0xfff) & ~(uint64_t)0xfff;

  if (::ftruncate(fd, requiredCapacity)) {
    GAPID_FATAL("Unable to ftruncate(grow) archive file.");
  }

  capacity = requiredCapacity;

  if (!map()) {
    GAPID_FATAL("Unable to map archive file.");
  }

  return true;
}

bool Archive::RecordFile::unmap() {
  if (!base) return true;
  if (::munmap(base, capacity)) {
    return false;
  }
  base = nullptr;
  return true;
}

bool Archive::RecordFile::map() {
  if (base || capacity == 0) {
    return true;  // Already mapped or don't need to map.
  }
  base = ::mmap(nullptr, capacity, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
  return base != nullptr;
}

#else  // #if GAPID_ARCHIVE_USE_MMAP

Archive::RecordFile::RecordFile() : fp(nullptr) {}

bool Archive::RecordFile::open(const std::string& filename) {
  fp = fopen(filename.c_str(), "ab+");
  return fp;
}

void Archive::RecordFile::close() {
  if (fp) fclose(fp);
}

bool Archive::RecordFile::read(uint64_t offset, void* buf, size_t size) {
  fseek(fp, offset, SEEK_SET);
  return fread(buf, size, 1, fp) == 1;
}

bool Archive::RecordFile::append(const void* buf, size_t size) {
  fseek(fp, 0, SEEK_END);
  return fwrite(buf, size, 1, fp) == 1;
}

uint64_t Archive::RecordFile::size() {
  fseek(fp, 0, SEEK_END);
  return ftell(fp);
}

bool Archive::RecordFile::resize(uint64_t size) {
  must_truncate(fileno(fp), size);
  return true;
}

#endif  //  GAPID_ARCHIVE_USE_MMAP

Archive::Archive(const std::string& archiveName)
    : mDataFilePath(archiveName + kDataFileNameSuffix),
      mIndexFilePath(archiveName + kIndexFileNameSuffix) {
  // Open or create the archive data file in binary read/write mode.
  const std::string dataFilename(mDataFilePath);
  if (!mDataFile.open(dataFilename)) {
    GAPID_FATAL("Unable to open archive data file %s", dataFilename.c_str());
  }

  // Open or create the archive index file in binary read/write mode.
  const std::string indexFilename(mIndexFilePath);
  if (!(mIndexFile = fopen(indexFilename.c_str(), "ab+"))) {
    GAPID_FATAL("Unable to open archive index file %s", indexFilename.c_str());
  }

  // Linux fopen() with mode "a" leads to reads from the beginning of file, but
  // this is not true on Android, hence the explicit rewind() here
  rewind(mIndexFile);

  // Load the archive index in memory.
  for (;;) {
    uint32_t idSize;
    if (!fread(&idSize, sizeof(idSize), 1, mIndexFile)) break;

    std::string id(idSize, 0);
    uint64_t offset;
    uint32_t size;
    if (!fread(&id.front(), idSize, 1, mIndexFile) ||
        !fread(&offset, sizeof(offset), 1, mIndexFile) ||
        !fread(&size, sizeof(size), 1, mIndexFile)) {
      break;
    }

    mRecords.emplace(id, ArchiveRecord{offset, size});
  }

  // Make sure we're at the end of the index file, likely a no-op.
  fseek(mIndexFile, 0, SEEK_END);
}

Archive::~Archive() {
  mDataFile.close();
  if (mIndexFile) fclose(mIndexFile);
}

bool Archive::contains(const std::string& id) const {
  return mRecords.find(id) != mRecords.end();
}

bool Archive::read(const std::string& id, void* buffer, uint32_t size) {
  const auto r = mRecords.find(id);
  if (r == mRecords.end() || r->second.size != size) return false;

  return mDataFile.read(r->second.offset, buffer, size);
}

bool Archive::write(const std::string& id, const void* buffer, uint32_t size) {
  // Skip if we already have a record by this id.
  if (mRecords.find(id) != mRecords.end()) {
    return true;
  }

  // Update the archive data file.
  const uint64_t dataOffset = mDataFile.size();
  if (!mDataFile.append(buffer, size)) {
    GAPID_WARNING("Couldn't write '%s' to the archive data file, dropping it.",
                  id.c_str());
    return false;
  }

  // Update the archive index file.
  const uint32_t idSize = id.size();
  const uint64_t indexOffset = ftell(mIndexFile);
  if (!fwrite(&idSize, sizeof(idSize), 1, mIndexFile) ||
      !fwrite(&id.front(), id.size(), 1, mIndexFile) ||
      !fwrite(&dataOffset, sizeof(dataOffset), 1, mIndexFile) ||
      !fwrite(&size, sizeof(size), 1, mIndexFile)) {
    GAPID_WARNING("Couldn't write '%s' to the archive index file, dropping it.",
                  id.c_str());
    mDataFile.resize(dataOffset);
    must_truncate(fileno(mIndexFile), indexOffset);
    fseek(mIndexFile, 0, SEEK_END);
    return false;
  }

  // Update the memory index.
  mRecords.emplace(id, ArchiveRecord{dataOffset, size});
  return true;
}

}  // namespace core

extern "C" {

archive* archive_create(const char* archiveName) {
  return reinterpret_cast<archive*>(new core::Archive(archiveName));
}

void archive_destroy(archive* a) { delete reinterpret_cast<core::Archive*>(a); }

int archive_write(archive* a, const char* id, const void* buffer, size_t size) {
  return reinterpret_cast<core::Archive*>(a)->write(id, buffer, size) ? 1 : 0;
}

}  // extern "C"


text:
//
//  JTCCustomizableView.m
//  C_POS
//
//  Created by Tomohisa Takaoka on 6/2/12.

#import "JTCCustomizableView.h"

@implementation JTCCustomizableView
@synthesize borderColor = _borderColor;
@synthesize shadowColor = _shadowColor;
@synthesize shadowOpacity = _shadowOpacity;
@synthesize borderWidth = _borderWidth;
@synthesize shadowRadius = _shadowRadius;
@synthesize cornerRadius = _cornerRadius;
@synthesize shadowOffset = _shadowOffset;

//@property (nonatomic, strong) NSString* shadowOpacity;
//@property (nonatomic, strong) NSString* borderWidth;
//@property (nonatomic, strong) NSString* cornerRadius;
//@property (nonatomic, strong) NSString* shadowRadius;
//@property (nonatomic, assign) CGSize shadowOffcet;

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}

-(void) awakeFromNib {
    [super awakeFromNib];
    if (_borderColor) {
        self.layer.borderColor = _borderColor.CGColor;
    }
    if (_shadowColor) {
        self.layer.shadowColor = _shadowColor.CGColor;
    }
    if (_shadowOpacity) {
        self.layer.shadowOpacity = [_shadowOpacity floatValue];
    }
    if (_borderWidth) {
        self.layer.borderWidth = [_borderWidth floatValue];
    }
    if (_shadowRadius) {
        self.layer.shadowRadius = [_shadowRadius floatValue];
    }
    if (_cornerRadius) {
        self.layer.cornerRadius = [_cornerRadius floatValue];
    }
    if (_shadowOffset) {
        self.layer.shadowOffset = [_shadowOffset CGSizeValue];
    }

}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end


text:
/**
 * Module dependencies.
 */
var Appland = require('./base/appland');
util = require('util');
var path = require('path');
var fs = require('fs.extra');
var _ = require('lodash');
/**
 * Module Creator
 * Creates the module skeleton.
 * @constructor
 */
function Build() {
  /**
   * Paths to source and assets.
   * @type {Object}
   */
  this.pathsConfig = null;
  /**
   * Port to launch module
   * @type {number}
   */
  this.launchPort = 9013;
}
// Inheriting Appland base class.
util.inherits(Build, Appland);
/**
 * Build module.
 * @return {*}
 */
Build.prototype.buildModule = function() {
  if (! this.isPath(this.PATH_APPLAND_HOME)) {
    this.emit('error', 'Path to Appland root directory does not exist.');
    return false;
  }

  var self = this;

  this.prepareResources();
  this.runTests(function() {
    self.compileCss(function() {
      self.optimiseJs(function() {
        self.cleanDistDir(function () {
          self.copyAssets(function () {
            setTimeout(function() {
              self.launch(self.launchPort);
              self.emit('completed');
            }, 3000);
          });
        });
      });
    });
  });
};
/**
 * Runs the unit tests for the module.
 * @param {Function} callBack to execute after css is compiled.
 * @see http://goo.gl/vzB9SP for cli options.
 */
Build.prototype.runTests = function(callBack) {
  var exec = require('child_process').exec,
    that = this,
    options = {
      timeout: 0,
      killSignal: 'SIGKILL',
      cwd: this.PATH_APPLAND_HOME
    };

  this.emit('log', 'Running unit tests...');

  exec('node ' + this.pathsConfig.testRunner + ' ci --launch=Chrome ' +
    this.testHarness, options,
    function(err, stdout, stderr) {
      var buffer = stdout || stderr;

      if (err === null) { /* SUCCESS */
        that.emit('log', 'Unit tests ran and completed.');
        callBack();
        return;
      } else if (err !== null) {  /* ERROR */
        that.emit('warn', 'Code: ' + err.code);
        that.emit('warn', err);

        if (that.continueOnError) {
          that.emit('warn', 'Unknown error encountered. Continuing...');
          callBack();
        } else {
          that.emit('error', 'Could not complete request. ABORTING.');
        }

        return;
      }

      that.emit('log', buffer);
  });
};
/**
 * Concatenate, Minify and Optimise JavaScript Files.
 * @param {Function} callBack to execute after css is compiled.
 */
Build.prototype.optimiseJs = function(callBack) {
  var exec = require('child_process').exec,
    that = this,
    options = {
      timeout: 0,
      killSignal: 'SIGKILL',
      cwd: path.resolve(this.PATH_APPLAND_HOME, this.pathsConfig.buildDir)
    };

  this.emit('log', 'Minifying and optimising JavaScripts...');

  exec('node ../../node_modules/requirejs/bin/r.js' + ' -o app.build.js', options,
    function(err, stdout, stderr) {
      var buffer = stdout || stderr;

      if (err === null) { /* SUCCESS */
        that.emit('log', 'JavaScripts minified and optimised.');
        callBack();
        return;
      } else if (err !== null) {  /* ERROR */
        that.emit('warn', 'Code: ' + err.code);
        that.emit('warn', err);

        if (that.continueOnError) {
          that.emit('warn', 'Unknown error encountered. Continuing...');
          callBack();
        } else {
          that.emit('error', 'Could not complete request. ABORTING.');
        }

        return;
      }

      that.emit('log', buffer);
  });
};
/**
 * Prepares resources for removal.
 */
Build.prototype.prepareResources = function() {
  this.pathsConfig = {
    'srcDir': './src/module-' + this.moduleName,
    'srcTestDir': './src-test/module-' + this.moduleName,
    'testRunner': '"./node_modules/testem/testem.js"',
    'testHarness': './src-test/module-' + this.moduleName + '/TestRunner.html',
    'testConfig': './testem.json',
    'buildDir': './_build/module-' + this.moduleName,
    'distDir': './dist/module-' + this.moduleName,
    'assetsDir': './src/assets/',
    'assetsDistDir': './dist/assets/'
  };
};
/**
 * Copy assets from development to distribution.
 * These are compiled CSS and images.
 * @param {Function} callBack
 */
Build.prototype.copyAssets = function(callBack) {
  // Compiled CSS...
  this.copy(
    path.resolve(this.PATH_APPLAND_HOME,
      this.pathsConfig.assetsDir,
      './css/' + 'module-' + this.moduleName + '.css'),
    path.resolve(this.PATH_APPLAND_HOME,
      this.pathsConfig.assetsDistDir,
      './css/' + 'module-' + this.moduleName + '.css')
  );

  // Images...
  this.copy(
    path.resolve(this.PATH_APPLAND_HOME,
      this.pathsConfig.assetsDir, './css/img'),
    path.resolve(this.PATH_APPLAND_HOME,
      this.pathsConfig.assetsDistDir, './css/img'),
    true
  );

  // Fonts...
  this.copy(
    path.resolve(this.PATH_APPLAND_HOME,
      this.pathsConfig.assetsDir, './fonts'),
    path.resolve(this.PATH_APPLAND_HOME,
      this.pathsConfig.assetsDistDir, './fonts'),
    true,
    callBack
  );
};
/**
 * Copy file and/or directory
 * @param {string} from
 * @param {string} to
 * @param {boolean=} deepCopy
 * @param {function=} callBack to execute
 */
Build.prototype.copy = function(from, to, deepCopy, callBack) {
  var self = this;

  this.emit('log', 'Copying assets... ' + path.dirname(to));

  if (deepCopy) {
    fs.copyRecursive(from, to, function (err) {
      if (err) {
        self.emit('warn', 'Cannot copy to assets to distribution folder ' + to);
      }
      self.emit('log', 'Copied to distribution folder: ' + to);
      if (_.isFunction(callBack)) {
        callBack();
      }
    });
  } else {
    fs.copy(from, to, function (err) {
      if (err) {
        self.emit('warn', 'Cannot copy to assets to distribution folder ' + to);
      }
      self.emit('log', 'Copied to distribution folder: ' + to);
    });
  }
};
/**
 * Cleans up the distribution folder in preparation for
 * new and updated files.
 * @param {function=} callBack to execute
 */
Build.prototype.cleanDistDir = function(callBack) {
  var self = this;

  // Images...
  this.emit('log', 'Cleaning up images directory in dist... ');

  fs.rmrf(path.resolve(this.PATH_APPLAND_HOME,
    this.pathsConfig.assetsDistDir, './css/img'), function (err) {
    if (err) {
      self.emit('warn', 'Cannot remove images directory in dist.');
    }

    // Fonts...
    self.emit('log', 'Cleaning up fonts directory in dist... ');

    fs.rmrf(path.resolve(self.PATH_APPLAND_HOME,
      self.pathsConfig.assetsDistDir, './fonts'), function (err) {
      if (err) {
        self.emit('warn', 'Cannot remove fonts directory in dist.');
      }

      // CSS...
      self.emit('log', 'Removing CSS file in dist... ');

      fs.unlink(path.resolve(self.PATH_APPLAND_HOME,
        self.pathsConfig.assetsDistDir,
        './css/' + 'module-' + self.moduleName + '.css'), function (err) {
        if (err) {
          self.emit('warn', 'Cannot remove CSS file in dist.');
        }

        if (_.isFunction(callBack)) {
          callBack();
        }
      });
    });
  });
};

module.exports = Build;


text:
This is a relatively simple Bukkit plugin that allows server operators to place
decorative "blocks" of particle effects in the world.  All particles that are
supported by Bukkit can be used.  The density of particles is configurable for
each "group" of particles and a soft limit to the maximum number of blocks in
a group can be set in the config.

The hard limit (due to Java) is around `2^31 - 1`, but that is over two cubic
kilometers, so you probably won't hit it anyways.  The higher you set the
density, the more lag there's going to be.  But as of ~1.9, Mojang fixed a lot
of what was causing lag with particles so it's probably not going to be *that*
bad.  Particle types also have their own activation ranges that I can't
control, so even if you set an activation range in BlockParticles that's above
this range then you still won't be able to see them until you get closer.

The particles you can use is any of those supported by Bukkit.  A list of all
of the available particles is [here](https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Particle.html).

Groups don't have to be contiguous.

## Permissions

* **blockparticles.cmd.create** : Creation of partcle blocks.
* **blockparticles.type.[...]** : Gives the specific type of particle (for example, `VILLAGER_HAPPY` translates to `blockparticles.type.villagerhappy`).
* **blockparticles.cmd.settype** : Allows setting the type of particles for groups.
* **blockparticles.cmd.setdensity** : Allows setting the densities of particles.
* **blockparticles.cmd.setrange** : Allows setting the activation range of particles.

## Commands

* `/bpcreate <name> <type>` : Starts a new session, any blocks you place will turn into particleblocks.
* `/bpstop` : Stops placing particle blocks and ends your placement session.
* `/bpsettype <name> <type>` : Changes the type of particle for the group.
* `/bpsetdensity <name> <density>` : Changes the density of the group.
* `/bpsetrange <name> <range>` : Changes the visibility range of the group.


text:
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by Cake.
// </auto-generated>
//------------------------------------------------------------------------------
using System.Reflection;

[assembly: AssemblyProduct("CakeBuildSample")]
[assembly: AssemblyVersion("0.0.2.001")]
[assembly: AssemblyFileVersion("0.0.2.001")]
[assembly: AssemblyInformationalVersion("0.0.2.001")]
[assembly: AssemblyCopyright("Copyright (c) 2017 - 2017 CakeBuildSample")]


text:
/**
 * @module node-opcua-schemas
 */
// tslint:disable:object-literal-sort-keys
// tslint:disable:no-empty

import * as chalk from "chalk";

import assert from "node-opcua-assert";
import { checkDebugFlag, make_debugLog } from "node-opcua-debug";
import { EnumerationDefinitionSchema, FieldInterfaceOptions, StructuredTypeOptions } from "node-opcua-factory";
import { DataTypeFactory } from "node-opcua-factory";
import { NodeId } from "node-opcua-nodeid";
import { Xml2Json } from "node-opcua-xml2json";

import { getOrCreateStructuredTypeSchema } from "./tools";

const doDebug = checkDebugFlag(__filename);
const debugLog = make_debugLog(__filename);

function w(s: string, l: number): string {
    return s.padEnd(l).substring(0, l);
}

const predefinedType: any = {
    "opc:Bit": 1,
    "opc:Boolean": 1,
    "opc:Byte": 1,
    "opc:ByteString": 1,
    "opc:Char": 1,
    "opc:CharArray": 1,
    "opc:DateTime": 1,
    "opc:Double": 1,
    "opc:Float": 1,
    "opc:Guid": 1,
    "opc:Int16": 1,
    "opc:Int32": 1,
    "opc:Int64": 1,
    "opc:SByte": 1,
    "opc:String": 1,
    "opc:UInt16": 1,
    "opc:UInt32": 1,
    "opc:UInt64": 1,

    "ua:ByteStringNodeId": 1,
    "ua:DataValue": 1,
    "ua:DiagnosticInfo": 1,
    "ua:ExpandedNodeId": 1,
    "ua:ExtensionObject": 1,
    "ua:FourByteNodeId": 1,
    "ua:GuidNodeId": 1,
    "ua:LocalizedText": 1,
    "ua:NodeId": 1,
    "ua:NodeIdType": 1,
    "ua:NumericNodeId": 1,
    "ua:QualifiedName": 1,
    "ua:StatusCode": 1,
    "ua:StringNodeId": 1,
    "ua:TwoByteNodeId": 1,
    "ua:Variant": 1,
    "ua:XmlElement": 1
};

export interface EnumeratedType {
    name: string;
    documentation?: string;
    enumeratedValues: any;
    lengthInBits?: number;
}

export interface StructureTypeRaw {
    name: string;
    baseType: string;
    base?: StructureTypeRaw;
    fields: any[];
}

export interface ITypeDictionary {
    targetNamespace: string;
    defaultByteOrder: string;
    imports: string[];
}

export class InternalTypeDictionary implements ITypeDictionary {
    public targetNamespace = "";
    public defaultByteOrder = "";
    public imports: string[] = [];

    private structuredTypesRaw: Record<string, StructureTypeRaw> = {};
    private enumeratedTypesRaw: Record<string, EnumeratedType> = {};

    // tns: "http://opcfoundation.org/a/b"
    public _namespaces: Record<string, string> = {};

    constructor() {
        /**  */
    }
    public addEnumeration(name: string, e: EnumeratedType): void {
        this.enumeratedTypesRaw[name] = e;
    }
    public getEnumerations(): EnumeratedType[] {
        return Object.values(this.enumeratedTypesRaw);
    }
    public getStructures(): StructureTypeRaw[] {
        return Object.values(this.structuredTypesRaw);
    }
    public addStructureRaw(structuredType: StructureTypeRaw): void {
        this.structuredTypesRaw[structuredType.name] = structuredType;
    }
    public getStructuredTypesRawByName(name: string): StructureTypeRaw {
        name = name.split(":")[1] || name;
        return this.structuredTypesRaw[name]! as StructureTypeRaw;
    }
}

interface _IParser {
    attrs: any;
    text?: string;
}
interface ITypeDefinitionParser extends _IParser {
    typeDictionary: InternalTypeDictionary;
    engine: { typeDictionary: InternalTypeDictionary };
}
interface IEnumeratedTypeParser extends _IParser {
    typescriptDefinition: string;
    enumeratedType: EnumeratedType;
    parent: { typeDictionary: InternalTypeDictionary };
}
interface IEnumeratedTypeDocumentParser extends _IParser {
    parent: IEnumeratedTypeParser;
}

interface IEnumeratedTypeEnumeratedValueParser extends _IParser {
    parent: IEnumeratedTypeParser;
}
interface IStructureTypeParser extends _IParser {
    structuredType: Omit<StructuredTypeOptions, "dataTypeFactory">;
    parent: { typeDictionary: InternalTypeDictionary };
}
interface IImportParser extends _IParser {
    parent: { typeDictionary: InternalTypeDictionary };
}
interface IStructureTypeFieldParser extends _IParser {
    parent: IStructureTypeParser;
}
/* tslint:disable:object-literal-shorthand */
const state0: any = {
    init: () => {
        const a = 1;
    },
    parser: {
        TypeDictionary: {
            init: function (this: ITypeDefinitionParser, name: string, attributes: Record<string, string>) {
                this.typeDictionary = this.engine.typeDictionary;
                this.typeDictionary.defaultByteOrder = attributes.DefaultByteOrder;
                this.typeDictionary.targetNamespace = attributes.TargetNamespace;

                for (const [k, v] of Object.entries(attributes)) {
                    if (k.match(/xmlns:/)) {
                        const ns = k.split(":")[1];
                        this.typeDictionary._namespaces[ns] = v;
                        this.typeDictionary._namespaces[v] = ns;
                    }
                }
            },
            parser: {
                Import: {
                    init: function (this: IImportParser, name: string, attributes: any) {
                        this.parent.typeDictionary.imports.push(attributes.Namespace);
                    },
                    finish: function (this: IImportParser) {
                        // _register_namespace_uri(this.text);
                        // istanbul ignore next
                        if (doDebug) {
                            debugLog("Import NameSpace = ", this.attrs.Namespace, " Location", this.attrs.Location);
                        }
                    }
                },

                EnumeratedType: {
                    init: function (this: IEnumeratedTypeParser) {
                        this.typescriptDefinition = "";
                        // istanbul ignore next
                        if (doDebug) {
                            debugLog(
                                chalk.cyan("EnumeratedType Name="),
                                w(this.attrs.Name, 40),
                                "LengthInBits=",
                                this.attrs.LengthInBits
                            );
                        }

                        this.enumeratedType = {
                            enumeratedValues: {},
                            lengthInBits: parseInt(this.attrs.LengthInBits, 10),
                            name: this.attrs.Name
                        };

                        this.typescriptDefinition += `enum ${this.enumeratedType.name} {`;
                    },
                    parser: {
                        Documentation: {
                            finish: function (this: IEnumeratedTypeDocumentParser) {
                                this.parent.enumeratedType.documentation = this.text;
                            }
                        },
                        EnumeratedValue: {
                            finish: function (this: IEnumeratedTypeEnumeratedValueParser) {
                                // istanbul ignore next
                                if (doDebug) {
                                    debugLog(" EnumeratedValue Name=", w(this.attrs.Name, 40), " Value=", this.attrs.Value);
                                }
                                const key = this.attrs.Name;
                                const value = parseInt(this.attrs.Value, 10);
                                const _enum = this.parent.enumeratedType.enumeratedValues;
                                _enum[(_enum[key] = value)] = key;
                                this.parent.typescriptDefinition += `\n  ${key} = ${value},`;
                            }
                        }
                    },
                    finish: function (this: IEnumeratedTypeParser) {
                        this.typescriptDefinition += `\n}`;
                        this.parent.typeDictionary.addEnumeration(this.attrs.Name, this.enumeratedType);
                        // istanbul ignore next
                        if (doDebug) {
                            debugLog(" this.typescriptDefinition  = ", this.typescriptDefinition);
                        }
                    }
                },
                StructuredType: {
                    init: function (this: IStructureTypeParser) {
                        // istanbul ignore next
                        if (doDebug) {
                            debugLog(
                                chalk.cyan("StructureType Name="),
                                chalk.green(this.attrs.Name),
                                " BaseType=",
                                this.attrs.BaseType
                            );
                        }

                        const baseType = this.attrs.BaseType;

                        const structuredType: Omit<StructuredTypeOptions, "dataTypeFactory"> = {
                            name: this.attrs.Name,
                            baseType,
                            fields: []
                        };
                        this.structuredType = structuredType;
                    },
                    parser: {
                        Field: {
                            finish: function (this: IStructureTypeFieldParser) {
                                if (this.attrs.SourceType) {
                                    // ignore  this field, This is a repetition of the base type field with same name
                                    return;
                                }
                                // istanbul ignore next
                                if (doDebug) {
                                    debugLog(
                                        chalk.yellow(" field Name="),
                                        w(this.attrs.Name, 40),
                                        chalk.yellow(" typeName="),
                                        w(this.attrs.TypeName, 40),
                                        this.attrs.LengthField
                                            ? chalk.yellow(" lengthField= ") + w(this.attrs.LengthField, 40)
                                            : "",
                                        this.attrs.SwitchField
                                            ? chalk.yellow(" SwitchField= ") + w(this.attrs.SwitchField, 40)
                                            : "",
                                        this.attrs.SwitchValue !== undefined
                                            ? chalk.yellow(" SwitchValue= ") + w(this.attrs.SwitchValue, 40)
                                            : ""
                                        // chalk.yellow(" lengthField="), w(this.attrs.LengthField, 40)
                                    );
                                }

                                const field: FieldInterfaceOptions = {
                                    name: this.attrs.Name,
                                    fieldType: this.attrs.TypeName
                                };

                                const structuredType = this.parent.structuredType;
                                if (field.fieldType === "opc:Bit") {
                                    // do something to collect bits but ignore them as field
                                    structuredType.bitFields = structuredType.bitFields || [];
                                    const length = this.attrs.Length || 1;
                                    structuredType.bitFields.push({ name: field.name, length });
                                    return;
                                }

                                if (this.attrs.LengthField) {
                                    field.isArray = true;
                                    const n = structuredType.fields.length - 1;
                                    structuredType.fields[n] = field;
                                } else {
                                    structuredType.fields.push(field);
                                }
                                if (this.attrs.SwitchField) {
                                    // field is optional and can be omitted
                                    const switchField = this.attrs.SwitchField;

                                    if (this.attrs.SwitchValue) {
                                        // we are in a union
                                        field.switchValue = parseInt(this.attrs.SwitchValue, 10);
                                        // istanbul ignore next
                                        if (doDebug) {
                                            debugLog(
                                                "field",
                                                field.name,
                                                " is part of a union  => ",
                                                switchField,
                                                " value #",
                                                field.switchValue
                                            );
                                        }
                                        // sometimes (like in Milo, baseType attribute is not specified)
                                        if (!this.parent.attrs.baseType) {
                                            this.parent.attrs.baseType = "Union";
                                            this.parent.structuredType.baseType = "Union";
                                        }
                                    } else {
                                        field.switchBit = structuredType.bitFields
                                            ? structuredType.bitFields!.findIndex((x) => x.name === switchField)
                                            : -2;
                                        // istanbul ignore next
                                        if (doDebug) {
                                            debugLog(
                                                "field",
                                                field.name,
                                                " is optional => ",
                                                switchField,
                                                "bit #",
                                                field.switchBit
                                            );
                                        }
                                    }
                                }
                            }
                        }
                    },
                    finish: function (this: IStructureTypeParser) {
                        assert(this.attrs.Name === this.structuredType.name);
                        this.parent.typeDictionary.addStructureRaw(this.structuredType);
                    }
                }
            }
        }
    }
};

export interface DataTypeAndEncodingId {
    dataTypeNodeId: NodeId;
    binaryEncodingNodeId: NodeId;
    xmlEncodingNodeId: NodeId;
    jsonEncodingNodeId: NodeId;
}
export interface MapDataTypeAndEncodingIdProvider {
    // getDataTypeNodeId(key: string): NodeId;
    getDataTypeAndEncodingId(key: string): DataTypeAndEncodingId | null;
}
interface WithTypeDictionary extends Xml2Json {
    typeDictionary: InternalTypeDictionary;
}
export function parseBinaryXSD(
    xmlString: string,
    idProvider: MapDataTypeAndEncodingIdProvider,
    dataTypeFactory: DataTypeFactory,
    callback: (err?: Error | null) => void
): void {
    const parser = new Xml2Json(state0) as WithTypeDictionary;
    const typeDictionary = new InternalTypeDictionary();
    parser.typeDictionary = typeDictionary;
    if (!xmlString || xmlString.length === 0) {
        return callback();
    }
    parser.parseString(xmlString, (err?: Error | null) => {
        // resolve and prepare enumerations
        for (const enumeratedType of typeDictionary.getEnumerations()) {
            if (Object.keys(enumeratedType.enumeratedValues).length >= 1) {
                const e = new EnumerationDefinitionSchema(NodeId.nullNodeId, {
                    lengthInBits: enumeratedType.lengthInBits || 32,
                    enumValues: enumeratedType.enumeratedValues,
                    name: enumeratedType.name
                });
                dataTypeFactory.registerEnumeration(e);
            }
        }

        // istanbul ignore next
        if (doDebug) {
            debugLog("------------------------------- Resolving complex Type");
            typeDictionary.getStructures().map((x: any) => debugLog(x.name));
        }

        // create area in navigation order
        function createExplorationOrder(): StructureTypeRaw[] {
            const array: StructureTypeRaw[] = [];
            const _map: Record<string, string> = {};
            function alreadyVisited(name: string) {
                name = name.split(":")[1] || name;
                return !!_map[name];
            }
            function markAsVisited(name: string) {
                name = name.split(":")[1] || name;
                _map[name] = "1";
            }
            function visitStructure(structuredType: StructureTypeRaw) {
                if (!structuredType || structuredType.name === "ua:ExtensionObject") {
                    return;
                }
                if (alreadyVisited(structuredType.name)) {
                    return;
                }
                markAsVisited(structuredType.name);
                if (structuredType.baseType && structuredType.baseType !== "ua:ExtensionObject") {
                    const base = typeDictionary.getStructuredTypesRawByName(structuredType.baseType);
                    if (base && base.baseType) {
                        doDebug && debugLog("  investigating  base", chalk.cyan(base.name));
                        visitStructure(base);
                    }
                }
                for (const f of structuredType.fields) {
                    const s = typeDictionary.getStructuredTypesRawByName(f.fieldType);
                    if (s !== structuredType && s) {
                        visitStructure(s);
                    } else {
                        markAsVisited(f.fieldType);
                    }
                }
                doDebug && debugLog("processing ", chalk.cyan(structuredType.name));
                array.push(structuredType);
            }

            for (const structuredType of typeDictionary.getStructures()) {
                visitStructure(structuredType);
            }
            return array;
        }
        // resolve complex types
        const schemaInVisitingOrder = createExplorationOrder();
        for (const structuredType of schemaInVisitingOrder) {
            getOrCreateStructuredTypeSchema(structuredType.name, typeDictionary, dataTypeFactory, idProvider);
        }
        callback(err);
    });
}

export async function parseBinaryXSDAsync(
    xmlString: string,
    idProvider: MapDataTypeAndEncodingIdProvider,
    dataTypeFactory: DataTypeFactory
): Promise<void> {
    debugLog("parseBinaryXSDAsync");
    return new Promise((resolve, reject) => {
        parseBinaryXSD(xmlString, idProvider, dataTypeFactory, (err?: Error | null) => {
            if (err) {
                reject(err);
            } else {
                resolve();
            }
        });
    });
}


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Agree With Gruber</title>
  <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,300i,600">
  <link rel="stylesheet" href="/style.css">
  <link rel="stylesheet" href="/custom.css">

  <link rel="alternate" type="application/rss+xml" title="Des Paroz" href="http://desparoz.micro.blog/feed.xml" />
  <link rel="alternate" type="application/json" title="Des Paroz" href="http://desparoz.micro.blog/feed.json" />
  <link rel="EditURI" type="application/rsd+xml" href="/rsd.xml" />

  <link rel="me" href="https://micro.blog/desparoz" />

  	<link rel="me" href="https://twitter.com/desparoz" />

  	<link rel="me" href="https://github.com/desparoz" />

  <link rel="authorization_endpoint" href="https://indieauth.com/auth" />
  <link rel="token_endpoint" href="https://tokens.indieauth.com/token" />
  <link rel="micropub" href="https://micro.blog/micropub" />
  <link rel="webmention" href="https://micro.blog/webmention" />

    Des Paroz

    <time class="dt-published" datetime="2017-05-12 21:31:00 +0000">12 May 2017</time>

Agree with @gruber 5/5. 🔗 Daring Fireball: Dropping Tech Giants — daringfireball.net/2017/05/d…


text:
        ;; 47loader (c) Stephen Williams 2013-2015
        ;; See LICENSE for distribution terms

LOADER_ABSOLUTE_ADDR:equ 32768
LOADER_THEME_RAINBOW:equ 1
LOADER_DYNAMIC_TABLE_ADDR:equ 49152
LOADER_RESUME:equ 1
LOADER_CHANGE_DIRECTION:equ 1
;LOADER_TOGGLE_BORDER:   equ 1
        include "47loader_simple_basic_embed_top.asm"

        ;; nothing to do besides call loader_dynamic
        call    loader_dynamic
        ;; if it returned carry set, the load succeeded
        jr      nc,.err

        ;; black border to finish
        ;; (loader leaves zero in accumulator)
        out     (0xfe),a
        ret

.err:
        include "47loader_error_handler.asm"
        include "47loader.asm"
        include "47loader_dynamic.asm"
        include "47loader_simple_basic_embed_bottom.asm"


text:
'use strict';
/**
 * Created by Jonas Kugelmann on 26.05.2014.
 */
var Node = require('./Node')
    ,stream = require('stream')
    ,util = require('util');

util.inherits(MaxNode,Node);
function MaxNode(id){
    Node.call(this,id,{
        inputs:[{name:'value',type:'number'}],
        outputs:[{name:'max',type:'number'}],
        transform: new MaxTransform()
    });
}

util.inherits(MaxTransform,stream.Transform);
function MaxTransform(){
    stream.Transform.call(this,{objectMode:true});
    this.max =0;

}

MaxTransform.prototype._transform = function(chunk,enc,next){
    if(chunk){
        var value = chunk.value;
        //überprüft ob der neue wert größer als das alte max ist
        //schreibt nur ein neues Paket wenn die der Fall
        //hier könnte man einen Reset implementieren um einen verlauf
        //der Werte in gewissen zeitfenstern zu bekommen

        if (value.data > this.max){
            this.max = value.data;
            value.name ='max';
            this.push([value]);
        }
    }
    next();
};
module.exports =MaxNode;


text:
=== HEAD

=== 0.3.0 (July 12, 2013)

* Move the `flight:package` generator into a seperate module.

=== 0.2.1 (July 8, 2013)

* Update paths to `jasmine-flight`.
* Add MIT License to scaffolds.
* Add `bower_components` to application `.gitignore`.
* Update Yeoman prompt code.
* Update to Yeoman Generator 0.12.
* Update `flight:app` Bower dependencies.

=== 0.2.0 (May 30, 2013)

* Add `flight:package` generator
* Use PhantomJS for CI tests in scaffolded app
* Fix scripts load order with Karma in scaffold
* Add Node.js 0.10 to scaffold's `travis.yml`
* Bump minor version for yeoman-generator dependency.

=== 0.1.0 (May 21, 2013)

* Initial public release.


text:
package com.EricSun.EricWidget.Widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ListView;

public class MyListView extends ListView {
	public MyListView(Context context) {
		super(context);
	}

	public MyListView(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	@Override
	protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
		int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
				MeasureSpec.AT_MOST);
		super.onMeasure(widthMeasureSpec, expandSpec);
	}
}


text:
<?php
namespace YouTrack;

/**
 * A class describing a youtrack agile board setting.
 *
 * @property string name
 * @method string getName
 * @method string getVersion
 * @method string setName(string $value)
 *
 * @link https://www.jetbrains.com/help/youtrack/incloud/Get-List-of-Agile-Boards.html
 */
class Sprint extends BaseObject
{
    public function __construct(\SimpleXMLElement $xml = null, Connection $youtrack = null)
    {
        parent::__construct($xml, $youtrack);
        if ($xml) {
            foreach ($xml->children() as $child) {
                /** @var \SimpleXMLElement $child */
                $this->__set($child->getName(), (string)$child);
            }
        }
    }
}


text:
TOCK_USERLAND_BASE_DIR ?= ..
LIBNAME=libnrfserialization
$(LIBNAME)_DIR=.

include NRFMakefile.mk

$(LIBNAME)_SRCS += $(SYSTEM_FILE) $(notdir $(APPLICATION_SRCS))

##############################################################################################
## Rules to create libnrfserialization

# Need libtock headers
override CPPFLAGS += -I$(TOCK_USERLAND_BASE_DIR)/libtock

include $(TOCK_USERLAND_BASE_DIR)/TockLibrary.mk

##############################################################################################
## Rules to create libnrfserialization headers

# Require all to build this too
all: headers.tar.gz

$($(LIBNAME)_BUILDDIR)/headers:
	$(TRACE_DIR)
	$(Q)mkdir -p $@

HDRS += $(patsubst %.c,$($(LIBNAME)_BUILDDIR)/headers/%.headers, $($(LIBNAME)_SRCS))
HDRS += $(addprefix $($(LIBNAME)_BUILDDIR)/headers/,$(APPLICATION_LIBS))

$($(LIBNAME)_BUILDDIR)/headers/%.headers: %.c | $($(LIBNAME)_BUILDDIR)/headers
	$(TRACE_CCM)
	$(Q)$(CC) $(CFLAGS) $(CPPFLAGS) -MM $< > $@

headers.tar.gz: $(HDRS)
	mkdir -p headers
	cat build/headers/*.headers | awk '{$$1=$$1};1' | awk '{print $$1}' | sort | grep '\.h' | grep -v libtock | uniq | xargs -IFOO cp FOO headers/
	# Make tar file reproducible, as described at https://reproducible-builds.org/docs/archives/
	tar \
	  --sort=name \
	  --mtime="1970-01-01 00:01:00Z" \
	  --owner=0 --group=0 --numeric-owner \
	  --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \
	  -czf headers.tar.gz headers

.PHONY: clean
clean::
	rm -Rf headers/
	rm -Rf headers.tar.gz


text:
<?php

declare(strict_types=1);

namespace Chubbyphp\Tests\Validation\Unit\Constraint;

use Chubbyphp\Mock\MockByCallsTrait;
use Chubbyphp\Validation\Constraint\EmailConstraint;
use Chubbyphp\Validation\Error\Error;
use Chubbyphp\Validation\ValidatorContextInterface;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

/**
 * @covers \Chubbyphp\Validation\Constraint\EmailConstraint
 *
 * @internal
 */
final class EmailConstraintTest extends TestCase
{
    use MockByCallsTrait;

    public function testWithNullValue(): void
    {
        $constraint = new EmailConstraint();

        self::assertEquals([], $constraint->validate('email', null, $this->getContext()));
    }

    public function testWithBlankValue(): void
    {
        $constraint = new EmailConstraint();

        self::assertEquals([], $constraint->validate('email', '', $this->getContext()));
    }

    public function testInvalidType(): void
    {
        $constraint = new EmailConstraint();

        $error = new Error('email', 'constraint.email.invalidtype', ['type' => 'array']);

        self::assertEquals([$error], $constraint->validate('email', [], $this->getContext()));
    }

    public function testWithEmail(): void
    {
        $constraint = new EmailConstraint();

        self::assertEquals([], $constraint->validate('email', 'firstname.lastname@domain.tld', $this->getContext()));
    }

    public function testPattern(): void
    {
        $matches = [];
        preg_match(EmailConstraint::PATTERN, 'firstname.lastname@domain.tld', $matches);

        self::assertSame('firstname.lastname', $matches[1]);
        self::assertSame('domain.tld', $matches[2]);
    }

    public function testWithInvalidEmail(): void
    {
        $constraint = new EmailConstraint();

        $error = new Error('email', 'constraint.email.invalidformat', ['value' => 'name']);

        self::assertEquals([$error], $constraint->validate('email', 'name', $this->getContext()));
    }

    private function getContext(): ValidatorContextInterface
    {
        // @var ValidatorContextInterface|MockObject $context
        return $this->getMockByCalls(ValidatorContextInterface::class);
    }
}


text:
function test() {
  // Leading to EmptyStatement
  ; // Trailing to EmptyStatement
}


text:
#ifndef COMMAND_PARSER_H   /* Include guard */
#define COMMAND_PARSER_H

/*
	- This function should be responsible for importing all details of the command
	- Should specify the type of the command "comment, cd, echo, expression - X=5 -, else"
	- Should specify the arguments of the command
	- Should specify if the command is background or foreground
	- Should consider all parsing special cases, example: many spaces in  "ls     -a"

	- You're left free to decide how to return your imported details of this command

	- Best practice is to use helper function for each collection of logical instructions,
	  example: function for splitting the command by space into array of strings, ..etc
*/
void parse_command( char* command );
int getNumParams();
char** getPrams();
int getFlag();

#endif // COMMAND_PARSER_H


text:
google.load('visualization', '1.0');
google.setOnLoadCallback(
	function() {
		if (STATS_DATA.data.length == 0) {
			$('.empty-label').show();
			return;
		}

		var FormatNumber = function(number, maximum) {
			var reversed_number = maximum - number;
			var string_reversed_number = reversed_number.toString();

			var string_maximum = maximum.toString();
			while (string_maximum.length - string_reversed_number.length > 0) {
				string_reversed_number = '0' + string_reversed_number;
			}

			return string_reversed_number;
		};
		var FormatDate = function(date) {
			var date_parts = date.split('T')[0].split('-');
			return date_parts[2] + '.' + date_parts[1] + '.' + date_parts[0];
		};
		var FormatInterval = function(start, end) {
			var result = '';
			var string_start = FormatDate(start);
			var string_end = FormatDate(end);
			if (string_start != string_end) {
				result = FormatDate(start) + ' - ' + FormatDate(end)
			} else {
				result = FormatDate(start);
			}

			var days =
				Math.floor(
					(Date.parse(end) - Date.parse(start))
					/ (1000 * 60 * 60 * 24)
				)
				+ 1;
			switch (days % 10) {
				case 0:
				case 5:
				case 6:
				case 7:
				case 8:
				case 9:
					result += ', ' + days + ' дней';
					break;
				case 1:
					if (days < 11 || days > 19) {
						result += ', ' + days + ' день';
					} else {
						result += ', ' + days + ' дней';
					}

					break;
				case 2:
				case 3:
				case 4:
					if (days < 11 || days > 19) {
						result += ', ' + days + ' дня';
					} else {
						result += ', ' + days + ' дней';
					}

					break;
			}

			return result;
		};
		var ParseDate = function(date_string) {
			return new Date(Date.parse(date_string));
		};
		var MakeRow = function(start, end, group, is_separator) {
			var row = [];
			row.push(ParseDate(start));
			row.push(ParseDate(end));
			row.push(
				'<div '
					+ 'class = "' + (
						!is_separator ? 'content' : 'separator'
					) + '" '
					+ 'title = "' + FormatInterval(start, end) + '">'
				+ '</div>'
			);
			row.push(group);

			return row;
		};

		var data = [];
		var AddSeparator = function(group) {
			data.push(
				MakeRow(STATS_DATA.start, STATS_DATA.end, group, true)
			);
		};

		var groups = {};
		var first_keys = Object.keys(STATS_DATA.data);
		var first_keys_length = first_keys.length;
		for (var i = 0; i < first_keys_length; i++) {
			var first_key = first_keys[i];
			var subdata = STATS_DATA.data[first_key];

			var second_keys = Object.keys(subdata.tasks);
			var second_keys_length = second_keys.length;
			for (var j = 0; j < second_keys_length; j++) {
				var second_key = second_keys[j];
				var subsubdata = subdata.tasks[second_key];

				var group = '↳ ' + second_key;
				if (!groups.hasOwnProperty(group)) {
					groups[group] = 0;
				} else {
					groups[group] += 1;

					var number_of_group_duplicates = groups[group];
					for (var n = 0; n < number_of_group_duplicates; n++) {
						group += '\u200b';
					}
				}

				for (var k = 0; k < subsubdata.intervals.length; k++) {
					var interval = subsubdata.intervals[k];
					data.push(MakeRow(interval.start, interval.end, group));
				}

				AddSeparator(group);
			}

			data.push(MakeRow(subdata.start, subdata.end, first_key));
			AddSeparator(first_key);
		}

		var data_table = new google.visualization.DataTable();
		data_table.addColumn('date', 'start');
		data_table.addColumn('date', 'end');
		data_table.addColumn('string', 'content');
		data_table.addColumn('string', 'group');
		data_table.addRows(data);

		var container = $('.stats-view.projects').get(0);
		var end_date = ParseDate(STATS_DATA.end);
		var timeline = new links.Timeline(
			container,
			{
				min: ParseDate(STATS_DATA.start),
				max: end_date,
				// 69 days (the maximum scale at which the layout remains true)
				zoomMin: 69 * 24 * 60 * 60 * 1000,
				// 69 days (the maximum scale at which the layout remains true)
				zoomMax: 69 * 24 * 60 * 60 * 1000,
				groupsOrder: false,
				locale: 'ru'
			}
		);
		var DrawFunction = function() {
			timeline.draw(data_table);
			timeline.setVisibleChartRange(
				// 24 days from the end date
				new Date(end_date.getTime() - 24 * 24 * 60 * 60 * 1000),
				end_date
			);
		};

		$(window).resize(
			function() {
				DrawFunction();
			}
		);
		DrawFunction();
	}
);