text:
package net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.badge;

import android.content.Context;
import android.view.View;
import android.widget.FrameLayout;

import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IMeasurablePagerTitleView;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerTitleView;

/**
 * 支持显示角标的title,角标布局可自定义
 * 博客: http://hackware.lucode.net
 * Created by hackware on 2016/7/18.
 */
public class BadgePagerTitleView extends FrameLayout implements IMeasurablePagerTitleView {
    private IPagerTitleView mInnerPagerTitleView;
    private View mBadgeView;
    private boolean mAutoCancelBadge = true;

    private BadgeRule mXBadgeRule;
    private BadgeRule mYBadgeRule;

    public BadgePagerTitleView(Context context) {
        super(context);
    }

    @Override
    public void onSelected(int index, int totalCount) {
        if (mInnerPagerTitleView != null) {
            mInnerPagerTitleView.onSelected(index, totalCount);
        }
        if (mAutoCancelBadge) {
            setBadgeView(null);
        }
    }

    @Override
    public void onDeselected(int index, int totalCount) {
        if (mInnerPagerTitleView != null) {
            mInnerPagerTitleView.onDeselected(index, totalCount);
        }
    }

    @Override
    public void onLeave(int index, int totalCount, float leavePercent, boolean leftToRight) {
        if (mInnerPagerTitleView != null) {
            mInnerPagerTitleView.onLeave(index, totalCount, leavePercent, leftToRight);
        }
    }

    @Override
    public void onEnter(int index, int totalCount, float enterPercent, boolean leftToRight) {
        if (mInnerPagerTitleView != null) {
            mInnerPagerTitleView.onEnter(index, totalCount, enterPercent, leftToRight);
        }
    }

    public IPagerTitleView getInnerPagerTitleView() {
        return mInnerPagerTitleView;
    }

    public void setInnerPagerTitleView(IPagerTitleView innerPagerTitleView) {
        if (mInnerPagerTitleView == innerPagerTitleView) {
            return;
        }
        mInnerPagerTitleView = innerPagerTitleView;
        removeAllViews();
        if (mInnerPagerTitleView instanceof View) {
            FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
            addView((View) mInnerPagerTitleView, lp);
        }
        if (mBadgeView != null) {
            FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            addView(mBadgeView, lp);
        }
    }

    public View getBadgeView() {
        return mBadgeView;
    }

    public void setBadgeView(View badgeView) {
        if (mBadgeView == badgeView) {
            return;
        }
        mBadgeView = badgeView;
        removeAllViews();
        if (mInnerPagerTitleView instanceof View) {
            FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
            addView((View) mInnerPagerTitleView, lp);
        }
        if (mBadgeView != null) {
            FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            addView(mBadgeView, lp);
        }
    }

    @Override
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
        super.onLayout(changed, left, top, right, bottom);
        if (mInnerPagerTitleView instanceof View && mBadgeView != null) {
            int[] position = new int[14];   // 14种角标定位方式
            View v = (View) mInnerPagerTitleView;
            position[0] = v.getLeft();
            position[1] = v.getTop();
            position[2] = v.getRight();
            position[3] = v.getBottom();
            if (mInnerPagerTitleView instanceof IMeasurablePagerTitleView) {
                IMeasurablePagerTitleView view = (IMeasurablePagerTitleView) mInnerPagerTitleView;
                position[4] = view.getContentLeft();
                position[5] = view.getContentTop();
                position[6] = view.getContentRight();
                position[7] = view.getContentBottom();
            } else {
                for (int i = 4; i < 8; i++) {
                    position[i] = position[i - 4];
                }
            }
            position[8] = v.getWidth() / 2;
            position[9] = v.getHeight() / 2;
            position[10] = position[4] / 2;
            position[11] = position[5] / 2;
            position[12] = position[6] + (position[2] - position[6]) / 2;
            position[13] = position[7] + (position[3] - position[7]) / 2;

            // 根据设置的BadgeRule调整角标的位置
            if (mXBadgeRule != null) {
                int x = position[mXBadgeRule.getAnchor().ordinal()];
                int offset = mXBadgeRule.getOffset();
                int newLeft = x + offset;
                mBadgeView.offsetLeftAndRight(newLeft - mBadgeView.getLeft());
            }
            if (mYBadgeRule != null) {
                int y = position[mYBadgeRule.getAnchor().ordinal()];
                int offset = mYBadgeRule.getOffset();
                int newTop = y + offset;
                mBadgeView.offsetTopAndBottom(newTop - mBadgeView.getTop());
            }
        }
    }

    @Override
    public int getContentLeft() {
        if (mInnerPagerTitleView instanceof IMeasurablePagerTitleView) {
            return getLeft() + ((IMeasurablePagerTitleView) mInnerPagerTitleView).getContentLeft();
        }
        return getLeft();
    }

    @Override
    public int getContentTop() {
        if (mInnerPagerTitleView instanceof IMeasurablePagerTitleView) {
            return ((IMeasurablePagerTitleView) mInnerPagerTitleView).getContentTop();
        }
        return getTop();
    }

    @Override
    public int getContentRight() {
        if (mInnerPagerTitleView instanceof IMeasurablePagerTitleView) {
            return getLeft() + ((IMeasurablePagerTitleView) mInnerPagerTitleView).getContentRight();
        }
        return getRight();
    }

    @Override
    public int getContentBottom() {
        if (mInnerPagerTitleView instanceof IMeasurablePagerTitleView) {
            return ((IMeasurablePagerTitleView) mInnerPagerTitleView).getContentBottom();
        }
        return getBottom();
    }

    public BadgeRule getXBadgeRule() {
        return mXBadgeRule;
    }

    public void setXBadgeRule(BadgeRule badgeRule) {
        if (badgeRule != null) {
            BadgeAnchor anchor = badgeRule.getAnchor();
            if (anchor != BadgeAnchor.LEFT
                    && anchor != BadgeAnchor.RIGHT
                    && anchor != BadgeAnchor.CONTENT_LEFT
                    && anchor != BadgeAnchor.CONTENT_RIGHT
                    && anchor != BadgeAnchor.CENTER_X
                    && anchor != BadgeAnchor.LEFT_EDGE_CENTER_X
                    && anchor != BadgeAnchor.RIGHT_EDGE_CENTER_X) {
                throw new IllegalArgumentException("x badge rule is wrong.");
            }
        }
        mXBadgeRule = badgeRule;
    }

    public BadgeRule getYBadgeRule() {
        return mYBadgeRule;
    }

    public void setYBadgeRule(BadgeRule badgeRule) {
        if (badgeRule != null) {
            BadgeAnchor anchor = badgeRule.getAnchor();
            if (anchor != BadgeAnchor.TOP
                    && anchor != BadgeAnchor.BOTTOM
                    && anchor != BadgeAnchor.CONTENT_TOP
                    && anchor != BadgeAnchor.CONTENT_BOTTOM
                    && anchor != BadgeAnchor.CENTER_Y
                    && anchor != BadgeAnchor.TOP_EDGE_CENTER_Y
                    && anchor != BadgeAnchor.BOTTOM_EDGE_CENTER_Y) {
                throw new IllegalArgumentException("y badge rule is wrong.");
            }
        }
        mYBadgeRule = badgeRule;
    }

    public boolean isAutoCancelBadge() {
        return mAutoCancelBadge;
    }

    public void setAutoCancelBadge(boolean autoCancelBadge) {
        mAutoCancelBadge = autoCancelBadge;
    }
}


text:
from pyramid.security import Allow, Everyone, ALL_PERMISSIONS
from sqlalchemy import (
    Column,
    DateTime,
    Float,
    ForeignKey,
    Index,
    Integer,
    Text,
    Unicode,
    UnicodeText
    )

from sqlalchemy.ext.declarative import declarative_base

from sqlalchemy.orm import (
    relationship,
    scoped_session,
    sessionmaker,
    )

from sqlalchemy.orm.exc import MultipleResultsFound, NoResultFound

from zope.sqlalchemy import ZopeTransactionExtension

DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension()))
Base = declarative_base()

class Product(Base):
    """Product model."""

    __tablename__ = 'products'
    id = Column(Integer, primary_key=True)
    product = Column(Unicode(255))
    one_point_five_oz = Column(Unicode(255))
    one_oz = Column(Unicode(255))
    point_seven_five_oz = Column(Unicode(255))
    point_five_oz = Column(Unicode(255))
    point_two_five_oz = Column(Unicode(255))

    def __init__(self, product, one_point_five_oz, one_oz, point_seven_five_oz,
                 point_five_oz, point_two_five_oz):
        """Init Product."""
        self.product = product
        self.one_point_five_oz = one_point_five_oz
        self.one_oz = one_oz
        self.point_seven_five_oz = point_seven_five_oz
        self.point_five_oz = point_five_oz
        self.point_two_five_oz = point_two_five_oz

    def add_product(self):
        """Commit product to DB."""
        DBSession.add(self)
        DBSession.flush()

    def delete_product(self):
        """Remove product from DB."""
        DBSession.delete(self)

    # @property
    # def __acl__(self):
    #     """Family object security."""
    #     acl = []
    #     for member in self.users:
    #         # everyone in family may view
    #         acl.append((Allow, member.user_id, 'view'))
    #         # only adults in family may edit
    #         if member.role == 'adult':
    #             acl.append((Allow, member.user_id, 'edit'))
    #     return acl

# Above not sure if I will need. Below should be a query by name

    @classmethod
    def get_product_by_id(cls, id):
        """Given primary key for Product table, return product obj."""
        try:
            queried_product = DBSession.query(Product).get(id)
            return queried_product
        except NoResultFound:
            return 'Product not found.'

class Cocktail(Base):
    """Product model."""

    __tablename__ = 'cocktail'
    id = Column(Integer, primary_key=True)
    name = Column(Text)
    cost = Column(Integer)

    def add_cocktail(self):
        """Commit cocktail to DB."""
        DBSession.add(self)
        DBSession.flush()

    def delete_cocktail(self):
        """Remove cocktail from DB."""
        DBSession.delete(self)

    # functions with math for

redpajama_set_name: RedPajamaGithub


text:
package endpoint

import (
	"crypto/tls"
	"crypto/x509"
	"encoding/json"
	"io"
	"io/ioutil"
	"os/user"
	"strings"

	"github.com/samalba/dockerclient"
)

type EndpointOptions struct {
	Host      string
	TLS       bool
	TLSVerify bool
	TLSCaCert string
	TLSCert   string
	TLSKey    string
}

func (eo EndpointOptions) tlsCaCert() string {
	return resolveHomeDirectory(eo.TLSCaCert)
}

func (eo EndpointOptions) tlsCert() string {
	return resolveHomeDirectory(eo.TLSCert)
}

func (eo EndpointOptions) tlsKey() string {
	return resolveHomeDirectory(eo.TLSKey)
}

func resolveHomeDirectory(path string) string {
	if strings.Contains(path, "~") {
		usr, _ := user.Current()
		dir := usr.HomeDir
		return strings.Replace(path, "~", dir, 1)
	}

	return path
}

func getTlsConfig(endpointOpts EndpointOptions) (*tls.Config, error) {
	var tlsConfig *tls.Config

	if endpointOpts.TLS {

		tlsConfig = &tls.Config{
			InsecureSkipVerify: !endpointOpts.TLSVerify,
		}

		if endpointOpts.tlsCert() != "" && endpointOpts.tlsKey() != "" {

			cert, err := tls.LoadX509KeyPair(endpointOpts.tlsCert(), endpointOpts.tlsKey())
			if err != nil {
				return nil, err
			}
			tlsConfig.Certificates = []tls.Certificate{cert}
		}

		// Load CA cert
		if endpointOpts.tlsCaCert() != "" {

			caCert, err := ioutil.ReadFile(endpointOpts.tlsCaCert())
			if err != nil {
				return nil, err
			}
			caCertPool := x509.NewCertPool()
			caCertPool.AppendCertsFromPEM(caCert)

			tlsConfig.RootCAs = caCertPool
		}
	}
	return tlsConfig, nil
}

type EndpointFactory func(EndpointOptions) (Endpoint, error)

type Endpoint interface {
	Version() (string, error)
	Name() string
	Host() string
	BuildImage(io.Reader, string) error
	ResolveImage(string) (string, error)
	StartContainer(name string, cc ContainerConfig) error
	InspectContainer(name string) (*dockerclient.ContainerInfo, error)
	RemoveContainer(name string) error
}

func translateContainerConfig(cc ContainerConfig) (dockerclient.ContainerConfig, error) {
	var dcc dockerclient.ContainerConfig

	j, err := json.Marshal(cc)
	if err != nil {
		return dcc, err
	}

	err = json.Unmarshal(j, &dcc)
	return dcc, err
}

type ContainerConfig struct {
	dockerclient.ContainerConfig
	Tty        FromStringOrBool
	OpenStdin  FromStringOrBool
	Entrypoint FromStringOrStringSlice
	// This is used only by the create command
	HostConfig HostConfig
}

type HostConfig struct {
	dockerclient.HostConfig
	Privileged     FromStringOrBool
	ReadonlyRootfs FromStringOrBool
}

type FromStringOrBool struct {
	Value bool
}

func (s *FromStringOrBool) UnmarshalJSON(value []byte) error {
	if value[0] == '"' {
		var str string
		if err := json.Unmarshal(value, &str); err != nil {
			return err
		}
		s.Value = (strings.ToLower(str) == "true")
		return nil
	}

	return json.Unmarshal(value, &s.Value)
}

func (s FromStringOrBool) MarshalJSON() ([]byte, error) {
	return json.Marshal(s.Value)
}

type FromStringOrStringSlice struct {
	Value []string
}

func (s *FromStringOrStringSlice) UnmarshalJSON(value []byte) error {
	if value[0] == '"' {
		var str string
		if err := json.Unmarshal(value, &str); err != nil {
			return err
		}
		s.Value = strings.Split(str, " ")
		return nil
	}

	return json.Unmarshal(value, &s.Value)
}

func (s FromStringOrStringSlice) MarshalJSON() ([]byte, error) {
	return json.Marshal(s.Value)
}


text:
package org.simplericity.jettyconsole.jettyxml;

import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.xml.sax.SAXException;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.xml.XmlConfiguration;

import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.ArrayList;

/**
 */
public class JettyXmlPlugin extends JettyConsolePluginBase {

    private List<File> jettyXmlFiles = new ArrayList<File>();

    private List<File> jettyWebXmlFiles = new ArrayList<File>();

    private StartOption jettyXmlOption = new JettyXmlFileOption("jettyXml", jettyXmlFiles);

    private StartOption jettyWebXmlOption = new JettyXmlFileOption("jettyWebXml", jettyWebXmlFiles);

    public JettyXmlPlugin() {
        super(JettyXmlPlugin.class);
        addStartOptions(jettyXmlOption, jettyWebXmlOption);
    }

    class JettyXmlFileOption extends DefaultStartOption {
        private final List<File> fileList;

        JettyXmlFileOption(String name, List<File> fileList) {
            super(name);
            this.fileList = fileList;
        }

        @Override
        public String validate(String value) {
            File file = new File(value);
            if(!file.exists()) {
                return "Jetty XML file " + file.toString() + " does not exist";
            } else {
                fileList.add(file);
                return null;
            }
        }
    }

    @Override
    public void customizeServer(Server server) {
        for(File file : jettyXmlFiles) {
            configure(server, file);
        }
    }

    @Override
    public void beforeStart(WebAppContext context) {
        for(File file : jettyWebXmlFiles) {
            configure(context, file);
        }
    }

    private void configure(Object object, File file) {
        try {
            XmlConfiguration configuration = new XmlConfiguration(file.toURI().toURL());
            configuration.configure(object);
        } catch (SAXException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}


text:
namespace base {

bool debug() noexcept;
void set_debug(bool value) noexcept;

}  // namespace base

#endif  // BASE_DEBUG_H


text:
Chrome plays an important role on Android - not only is it the default
browser, but Chrome powers WebView, which is used by many built-in and
third-party apps to display all sorts of content.

This document covers some of the technical details of how Chrome
implements its accessibility support on Android.

As background reading, you should be familiar with
[Android Accessibility](https://developer.android.com/guide/topics/ui/accessibility)
and in particular
[AccessibilityNodeInfo](https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo)
and
[AccessibilityNodeProvider](https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeProvider).

## WebContentsAccessibility

The main Java class that implements the accessibility protocol in Chrome is
[WebContentsAccessibilityImpl.java](https://cs.chromium.org/chromium/src/content/public/android/java/src/org/chromium/content/browser/accessibility/WebContentsAccessibilityImpl.java). It implements the AccessibilityNodeProvider
interface, so a single Android View can be represented by an entire tree
of virtual views. Note that WebContentsAccessibilityImpl represents an
entire web page, including all frames. The ids in the java code are unique IDs,
not frame-local IDs.

On most platforms, we create a native object for every AXNode in a web page,
and we implement a bunch of methods on that object that assistive technology
can query.

Android is different - it's more lightweight in one way, in that we only
create a native AccessibilityNodeInfo when specifically requested, when
an Android accessibility service is exploring the virtual tree. In another
sense it's more heavyweight, though, because every time a virtual view is
requested we have to populate it with every possible accessibility attribute,
and there are quite a few.

## Populating AccessibilityNodeInfo

Populating AccessibilityNodeInfo is a bit complicated for reasons of
Android version compatibility and also code efficiency.

WebContentsAccessibilityImpl.createAccessibilityNodeInfo is the starting
point. That's called by the Android framework when we need to provide the
info about one virtual view (a web node).

We call into C++ code -
[web_contents_accessibility_android.cc](https://cs.chromium.org/chromium/src/content/browser/accessibility/web_contents_accessibility_android.cc) from
there, because all of the information about the accessibility tree is
using the shared C++ BrowserAccessibilityManager code.

However, the C++ code then calls back into Java in order to set all of the
properties of AccessibilityNodeInfo, because those have to be set in Java.
Each of those methods, like setAccessibilityNodeInfoBooleanAttributes, is
often overridden by an Android-version-specific subclass to take advantage
of newer APIs where available.

Having the Java code query C++ for every individual attribute one at a time
would be too expensive, we'd be going across the JNI boundary too many times.
That's why it's structured the way it is now.

## Touch Exploration

The way touch exploration works on Android is complicated:

* When the user taps or drags their finger, our View gets a hover event.
* Accessibility code sends a hit test action to the renderer process
* The renderer process fires a HOVER accessibility event on the accessibility
  node at that coordinate
* WebContentsAccessibilityImpl.handleHover is called with that node. We fire
  an Android TYPE_VIEW_HOVER_ENTER event on that node and a
  TYPE_VIEW_HOVER_EXIT event on the previous node.
* Finally, TalkBack sets accessibility focus to that node.


text:
using SharpKit.JavaScript;
using SharpKit.DotNet.JavaScript;
using SharpKit.DotNet.Html;
using SharpKit.DotNet.IntelXdk;

namespace XdkDemo.Podcast
{
    [JsType(GlobalObject = true, Filename = "../js/demo-podcast.js", OrderInFile = 1, PreCode = "//---------Global----------//")]
    public class Global : HtmlContext
    {
        #region Global variables
        //Frank DeFord's NPR Sports podcast
        public static JsString podcastRSSURL = "http://www.npr.org/rss/podcast.php?id=4499275";

        //Chinese History - English
        //public static JsString podcastRSSURL = "http://feeds.feedburner.com/chinahistorypodcast?format=xml";

        //World Football
        //public static JsString podcastRSSURL = "http://downloads.bbc.co.uk/podcasts/worldservice/wswf/rss.xml";

        //BBC - Chinese Podcast of the Day
        //public static JsString podcastRSSURL = "http://downloads.bbc.co.uk/podcasts/worldservice/podcastoftheday/rss.xml";

        public static int feedTimeout;

        public static int iPortraitWidth = 768;
        public static int iLandscapeWidth = 1024;

        public static Document previousXMLData;
        public static XMLHttpRequest xmlhttp = null;
        public static bool boolDebounce = false;
        #endregion

        #region Functions delegate
        //*** Prevent Default Scroll ******
        ///
        /// Prevent Default Scroll
        ///
        /// <param name="evt"></param>
        public static EventListener<TouchEvent> PreventDefaultScroll = delegate(TouchEvent evt)
        {
            evt.PreventDefault();
            window.Scroll(0, 0);
            @return(false);
        };
        #endregion

        ///
        /// Global code
        ///
        static Global()
        {
            //initial event handler to detect when appMobi is ready to roll
            Xdk.OnDeviceReady += DeviceReady;
            Xdk.multitouch.Add(window.document, TouchEventType.TouchMove, PreventDefaultScroll);
        }

        public static void DataFailed(JsString xmlData)
        {
            console.Log("DataFailed");
            Xdk.notification.Alert(xmlData, "Podcast Failure", "OK");
        }

        public static void DataLoaded(JsString strRequestResponse)
        {
            var parser = new DOMParser();
            Document xmlData = parser.ParseFromString(strRequestResponse, "text/xml");
            JsCode("xmlData.alltext = strRequestResponse");
            if (xmlData != null) { previousXMLData = xmlData; } else { xmlData = previousXMLData; }

            if (xmlData != null)
            {
                JsString outHTML = "";
                HtmlElement.GetById("podcastTitle").innerHTML = xmlData.GetElementsByTagName("title")[0].childNodes[0].nodeValue;

                outHTML += "
";

                NodeList nodeList;
                nodeList = xmlData.GetElementsByTagName("channel");

                if (nodeList.length > 0)
                {
                    for (int i = 0; i < nodeList.length; i++)
                    {
                        if ((nodeList[i] as Element).GetElementsByTagName("item").length >= 1)
                        {
                            for (int ii = 0; ii < (nodeList[i] as Element).GetElementsByTagName("item").length; ii++)
                            {
                                Node selNode = ((nodeList[i] as Element).GetElementsByTagName("item"))[ii];
                                JsString strTitle = "";
                                JsString strPodcastLink = "";
                                JsString strPodcastMP3 = "";
                                //JsString strNodeIcon = "";

                                for (int x = 0; x < selNode.childNodes.length; x++)
                                {
                                    if (selNode.childNodes[x].nodeName == "title")
                                    {
                                        strTitle = selNode.childNodes[x].childNodes[0].nodeValue;
                                    }

                                    if (selNode.childNodes[x].nodeName == "enclosure")
                                    {
                                        strPodcastMP3 = (selNode.childNodes[x] as Element).GetAttribute("url");
                                    }

                                    if (selNode.childNodes[x].nodeName == "link")
                                    {
                                        strPodcastLink = selNode.childNodes[x].childNodes[0].nodeValue;
                                    }
                                }
                                outHTML += "
";

                                outHTML += "
";

                                outHTML += "";
                                outHTML += strTitle;
                                outHTML += "	";
                                outHTML += "

";
                            }
                        }
                    }
                    outHTML += "
";
                    HtmlElement.GetById("podcastEpisodes").innerHTML = outHTML;
                }
            }
        }

        public static void PlayPodcast(JsString podcastURL)
        {
            try
            {
                if (boolDebounce == false)
                {
                    boolDebounce = true;

                    //load the podcast
                    Xdk.player.PlayPodcast(podcastURL);
                    SetTimeout("boolDebounce = false", 5000);
                }
            }
            catch (JsError e) { Alert("error in playpodcast: " + e.message); }
        }

        //*** Device Ready Code *******************
        //This event handler is fired once the AppMobi libraries are ready
        public static void DeviceReady(XdkDeviceEvent evt)
        {
            //use AppMobi viewport
            Xdk.display.UseViewport(iPortraitWidth, iLandscapeWidth);

            //lock orientation
            Xdk.device.SetRotateOrientation(XdkDeviceOrientation.Portrait);
            Xdk.device.SetAutoRotate(false);

            //manage power
            Xdk.device.ManagePower(true, false);

            try
            {
                //for playing podcasts
                Xdk.OnPlayerAudioStop += OnPodcastComplete;
                Xdk.OnPlayerAudioError += OnPodcastError;
            }
            catch (JsError e) { }

            //hide splash screen
            Xdk.device.HideSplashScreen();

            if (Xdk.device.appmobiVersion != "3.2.4")
            {
                Xdk.device.GetRemoteData(podcastRSSURL, GetPost.GET, "", "DataLoaded", "DataFailed");
            }
            else
            {
                //********* Use XMLHTTP on an error ***************
                try
                {
                    XMLHttpRequest xmlhttp = new XMLHttpRequest(); // instantiate it
                    xmlhttp.OnReadyStateChange += delegate(XMLHttpRequestEvent evt_delegate)
                    {
                        if (xmlhttp.readyState == XMLHttpRequestState.DONE)
                        {

                            if (xmlhttp.status == 200 || xmlhttp.responseText != "")
                            {
                                //XML file read, now parse it
                                DataLoaded(xmlhttp.responseText);
                            }
                        }
                    };
                    try
                    {
                        xmlhttp.Open(GetPost.GET, podcastRSSURL); // open server interface
                    }
                    catch (JsError err)
                    {
                        Alert("XMLHttpRequest.open() failed.\n" + err.message + " \n URL : " + podcastRSSURL); //Permission Denied
                        return;
                    }
                    xmlhttp.Send(@null as JsString);
                }
                catch (JsError err)
                {
                    Alert("Error initializing XMLHttpRequest.\n" + err); // show error
                }

                //***************************************
            }
        }

        //*** Audio Code ******************

        public static void OnPodcastComplete(XdkPlayerEvent evt)
        { }

        public static void OnPodcastError(XdkPlayerEvent evt)
        { }

    }
}


text:
package org.curioswitch.common.testing.assertj.proto;

import static com.google.common.base.Preconditions.checkArgument;
import static org.assertj.core.api.Assertions.assertThat;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMultimap;
import com.google.protobuf.Descriptors.FieldDescriptor;
import com.google.protobuf.InvalidProtocolBufferException;
import com.google.protobuf.Message;
import com.google.protobuf.TextFormat;
import com.google.protobuf.TextFormat.ParseException;
import com.google.protobuf.UnknownFieldSet;
import java.util.Collection;
import java.util.function.Consumer;
import java.util.regex.Pattern;

/** Base class for testing {@link ProtoAssert} methods. */
public class ProtoAssertTestBase {
  // Type information for subclasses.
  static enum TestType {
    IMMUTABLE_PROTO2(TestMessage2.getDefaultInstance()),
    PROTO3(TestMessage3.getDefaultInstance());

    private final Message defaultInstance;

    TestType(Message defaultInstance) {
      this.defaultInstance = defaultInstance;
    }

    public Message defaultInstance() {
      return defaultInstance;
    }

    public boolean isProto3() {
      return this == PROTO3;
    }
  }

  private static final TextFormat.Parser PARSER =
      TextFormat.Parser.newBuilder()
          .setSingularOverwritePolicy(
              TextFormat.Parser.SingularOverwritePolicy.FORBID_SINGULAR_OVERWRITES)
          .build();

  // For Parameterized testing.
  protected static Collection<Object[]> parameters() {
    ImmutableList.Builder<Object[]> builder = ImmutableList.builder();
    for (TestType testType : TestType.values()) {
      builder.add(new Object[] {testType});
    }
    return builder.build();
  }

  private final Message defaultInstance;
  private final boolean isProto3;

  protected ProtoAssertTestBase(TestType testType) {
    this.defaultInstance = testType.defaultInstance();
    this.isProto3 = testType.isProto3();
  }

  protected final Message fromUnknownFields(UnknownFieldSet unknownFieldSet)
      throws InvalidProtocolBufferException {
    return defaultInstance.getParserForType().parseFrom(unknownFieldSet.toByteArray());
  }

  protected final String fullMessageName() {
    return defaultInstance.getDescriptorForType().getFullName();
  }

  protected final FieldDescriptor getFieldDescriptor(String fieldName) {
    FieldDescriptor fieldDescriptor =
        defaultInstance.getDescriptorForType().findFieldByName(fieldName);
    checkArgument(fieldDescriptor != null, "No field named %s.", fieldName);
    return fieldDescriptor;
  }

  protected final int getFieldNumber(String fieldName) {
    return getFieldDescriptor(fieldName).getNumber();
  }

  protected Message parse(String textProto) {
    try {
      Message.Builder builder = defaultInstance.toBuilder();
      PARSER.merge(textProto, builder);
      return builder.build();
    } catch (ParseException e) {
      throw new RuntimeException(e);
    }
  }

  protected final Message parsePartial(String textProto) {
    try {
      Message.Builder builder = defaultInstance.toBuilder();
      PARSER.merge(textProto, builder);
      return builder.buildPartial();
    } catch (ParseException e) {
      throw new RuntimeException(e);
    }
  }

  protected final boolean isProto3() {
    return isProto3;
  }

  /**
   * Some tests don't vary across the different proto types, and should only be run once.
   *
   * <p>This method returns true for exactly one {@link TestType}, and false for all the others, and
   * so can be used to ensure tests are only run once.
   */
  protected final boolean testIsRunOnce() {
    return isProto3;
  }

  protected final <T extends Throwable> Consumer<T> isEqualToFailureMessage() {
    return expectFailureMatches(
        "Not true that messages compare equal\\.\\s*"
            + "(Differences were found:\\n.*|No differences were reported\\..*)");
  }

  protected final <T extends Throwable> Consumer<T> isNotEqualToFailureMessage() {
    return expectFailureMatches(
        "Not true that messages compare not equal\\.\\s*"
            + "(Only ignorable differences were found:\\n.*|"
            + "No differences were found\\..*)");
  }

  /**
   * Expects the current failure message to match the provided regex, using {@code Pattern.DOTALL}
   * to match newlines.
   */
  protected final <T extends Throwable> Consumer<T> expectFailureMatches(String regex) {
    return t -> assertThat(t.getMessage()).matches(Pattern.compile(regex, Pattern.DOTALL));
  }

  protected static final <T> ImmutableList<T> listOf(T... elements) {
    return ImmutableList.copyOf(elements);
  }

  protected static final <T> T[] arrayOf(T... elements) {
    return elements;
  }

  @SuppressWarnings("unchecked")
  protected static final <K, V> ImmutableMap<K, V> mapOf(K k0, V v0, Object... rest) {
    checkArgument(rest.length % 2 == 0, "Uneven args: %s", rest.length);

    ImmutableMap.Builder<K, V> builder = new ImmutableMap.Builder<>();
    builder.put(k0, v0);
    for (int i = 0; i < rest.length; i += 2) {
      builder.put((K) rest[i], (V) rest[i + 1]);
    }
    return builder.build();
  }

  @SuppressWarnings("unchecked")
  protected static final <K, V> ImmutableMultimap<K, V> multimapOf(K k0, V v0, Object... rest) {
    checkArgument(rest.length % 2 == 0, "Uneven args: %s", rest.length);

    ImmutableMultimap.Builder<K, V> builder = new ImmutableMultimap.Builder<>();
    builder.put(k0, v0);
    for (int i = 0; i < rest.length; i += 2) {
      builder.put((K) rest[i], (V) rest[i + 1]);
    }
    return builder.build();
  }
}


text:
package universalcoinseconomy;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;

import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;

public class InventoryCoins {

	private final Player player;
	private final Inventory inventory;
	private String[] itemNames = { "UNIVERSALCOINS_ITEMITEMCOIN", "UNIVERSALCOINS_ITEMITEMSMALLCOINSTACK",
			"UNIVERSALCOINS_ITEMITEMLARGECOINSTACK", "UNIVERSALCOINS_ITEMITEMSMALLCOINBAG",
			"UNIVERSALCOINS_ITEMITEMLARGECOINBAG" };

	public InventoryCoins(Player player) {
		this.player = player;
		this.inventory = player.getInventory();
	}

	public int balance() {
		int value = 0;
		for (ItemStack stack : inventory) {
			value += stackValue(stack);
		}
		return value;
	}

	public double collectCoinPayment(double amount) {
		double coinsCollected = 0;
		for (int i = 0; i < inventory.getSize(); i++) {
			int value = stackValue(inventory.getItem(i));
			if (value > 0) {
				coinsCollected += value;
				inventory.clear(i);
			}
			if (coinsCollected >= amount) {
				// return change
				returnChange(coinsCollected - amount);
				return 0;
			}
		}
		return amount - coinsCollected;
	}

	public void returnChange(double change) {
		while (change > 0) {
			// use logarithm to find largest cointype for coins being sent
			int logVal = Math.min((int) (Math.log(change) / Math.log(9)), 4);
			int stackSize = Math.min((int) (change / Math.pow(9, logVal)), 64);
			// add a stack to the recipients inventory
			HashMap<Integer, ItemStack> test = inventory.addItem(new ItemStack(Material.getMaterial(itemNames[logVal])));
			change -= stackSize * Math.pow(9, logVal);
			// TODO throw excess coins to world when player inventory is full
			if (test.size() > 0) {
				Iterator<Entry<Integer, ItemStack>> it = test.entrySet().iterator();
				while (it.hasNext()) {
					Map.Entry<Integer, ItemStack> pair = (Map.Entry<Integer, ItemStack>) it.next();
					player.getWorld().dropItemNaturally(player.getLocation(), pair.getValue());
					it.remove(); // avoids a ConcurrentModificationException

				}
			}
		}
	}

	private int stackValue(ItemStack stack) {
		int[] coins = { 1, 9, 81, 729, 6561 };
		int inventoryValue = 0;
		for (int i = 0; i < coins.length; i++) {
			if (stack != null && stack.getType().name().matches(itemNames[i])) {
				inventoryValue += coins[i] * stack.getAmount();
			}
		}

		return inventoryValue;
	}

}


text:
__declspec(dllexport)
#endif

// An external function, defined in Rust.
extern void panic_if_greater_than_10(unsigned x);

unsigned add_small_numbers(unsigned a, unsigned b) {
    unsigned c = a + b;
    panic_if_greater_than_10(c);
    return c;
}


text:
#include <QmitkDnDFrameWidget.h>

#include <berryPlatformUI.h>

#include "mitkWorkbenchUtil.h"

#include <QDragEnterEvent>

QmitkDnDFrameWidget::QmitkDnDFrameWidget(QWidget *parent)
: QWidget(parent)
{
  setAcceptDrops(true);
}

void QmitkDnDFrameWidget::dragEnterEvent( QDragEnterEvent *event )
{   // accept drags
  event->acceptProposedAction();
}

void QmitkDnDFrameWidget::dropEvent( QDropEvent * event )
{ //open dragged files

  QList<QUrl> fileNames = event->mimeData()->urls();
  if (fileNames.empty())
    return;

  QStringList fileNames2;
  //TODO Qt 4.7 API
  //fileNames2.reserve(fileNames.size());
  foreach(QUrl url, fileNames)
  {
    fileNames2.push_back(url.toLocalFile());
  }

  mitk::WorkbenchUtil::LoadFiles(fileNames2,
                                 berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow());

  event->accept();
}


text:
//
//  Copyright (C) 2016 Tobias Lensing, Marcus Tillmanns
//  http://icedcoffee-framework.org
//
//  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.
//

#pragma once

#import <Foundation/Foundation.h>
#import "ICFont.h"
#import "icFontDefs.h"

#ifdef __cplusplus
extern "C" {
#endif

    /**
     @brief Creates an icedcoffee text attributes dictionary from a CoreText attributes dictionary
     */
    NSDictionary *icCreateTextAttributesWithCTAttributes(NSDictionary *ctAttrs);

    /**
     @brief Creates a CoreText attributes dictionary from an icedcoffee text attributes dictionary
     */
    NSDictionary *icCreateCTAttributesWithTextAttributes(NSDictionary *icAttrs);

    /**
     @brief Creates an icedcoffee attributed string from a CoreText attributed string
     */
    NSAttributedString *icCreateAttributedStringWithCTAttributedString(NSAttributedString *ctAttString);

    /**
     @brief Creates a CoreText attributed string from an icedcoffee attributed string
     */
    NSAttributedString *icCreateCTAttributedStringWithAttributedString(NSAttributedString *icAttString);

#ifdef __cplusplus
}
#endif


text:
#include <aws/gamelift/model/ScalingPolicy.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::Utils::Json;
using namespace Aws::Utils;

namespace Aws
{
namespace GameLift
{
namespace Model
{

ScalingPolicy::ScalingPolicy() :
    m_fleetIdHasBeenSet(false),
    m_fleetArnHasBeenSet(false),
    m_nameHasBeenSet(false),
    m_status(ScalingStatusType::NOT_SET),
    m_statusHasBeenSet(false),
    m_scalingAdjustment(0),
    m_scalingAdjustmentHasBeenSet(false),
    m_scalingAdjustmentType(ScalingAdjustmentType::NOT_SET),
    m_scalingAdjustmentTypeHasBeenSet(false),
    m_comparisonOperator(ComparisonOperatorType::NOT_SET),
    m_comparisonOperatorHasBeenSet(false),
    m_threshold(0.0),
    m_thresholdHasBeenSet(false),
    m_evaluationPeriods(0),
    m_evaluationPeriodsHasBeenSet(false),
    m_metricName(MetricName::NOT_SET),
    m_metricNameHasBeenSet(false),
    m_policyType(PolicyType::NOT_SET),
    m_policyTypeHasBeenSet(false),
    m_targetConfigurationHasBeenSet(false),
    m_updateStatus(LocationUpdateStatus::NOT_SET),
    m_updateStatusHasBeenSet(false),
    m_locationHasBeenSet(false)
{
}

ScalingPolicy::ScalingPolicy(JsonView jsonValue) :
    m_fleetIdHasBeenSet(false),
    m_fleetArnHasBeenSet(false),
    m_nameHasBeenSet(false),
    m_status(ScalingStatusType::NOT_SET),
    m_statusHasBeenSet(false),
    m_scalingAdjustment(0),
    m_scalingAdjustmentHasBeenSet(false),
    m_scalingAdjustmentType(ScalingAdjustmentType::NOT_SET),
    m_scalingAdjustmentTypeHasBeenSet(false),
    m_comparisonOperator(ComparisonOperatorType::NOT_SET),
    m_comparisonOperatorHasBeenSet(false),
    m_threshold(0.0),
    m_thresholdHasBeenSet(false),
    m_evaluationPeriods(0),
    m_evaluationPeriodsHasBeenSet(false),
    m_metricName(MetricName::NOT_SET),
    m_metricNameHasBeenSet(false),
    m_policyType(PolicyType::NOT_SET),
    m_policyTypeHasBeenSet(false),
    m_targetConfigurationHasBeenSet(false),
    m_updateStatus(LocationUpdateStatus::NOT_SET),
    m_updateStatusHasBeenSet(false),
    m_locationHasBeenSet(false)
{
  *this = jsonValue;
}

ScalingPolicy& ScalingPolicy::operator =(JsonView jsonValue)
{
  if(jsonValue.ValueExists("FleetId"))
  {
    m_fleetId = jsonValue.GetString("FleetId");

    m_fleetIdHasBeenSet = true;
  }

  if(jsonValue.ValueExists("FleetArn"))
  {
    m_fleetArn = jsonValue.GetString("FleetArn");

    m_fleetArnHasBeenSet = true;
  }

  if(jsonValue.ValueExists("Name"))
  {
    m_name = jsonValue.GetString("Name");

    m_nameHasBeenSet = true;
  }

  if(jsonValue.ValueExists("Status"))
  {
    m_status = ScalingStatusTypeMapper::GetScalingStatusTypeForName(jsonValue.GetString("Status"));

    m_statusHasBeenSet = true;
  }

  if(jsonValue.ValueExists("ScalingAdjustment"))
  {
    m_scalingAdjustment = jsonValue.GetInteger("ScalingAdjustment");

    m_scalingAdjustmentHasBeenSet = true;
  }

  if(jsonValue.ValueExists("ScalingAdjustmentType"))
  {
    m_scalingAdjustmentType = ScalingAdjustmentTypeMapper::GetScalingAdjustmentTypeForName(jsonValue.GetString("ScalingAdjustmentType"));

    m_scalingAdjustmentTypeHasBeenSet = true;
  }

  if(jsonValue.ValueExists("ComparisonOperator"))
  {
    m_comparisonOperator = ComparisonOperatorTypeMapper::GetComparisonOperatorTypeForName(jsonValue.GetString("ComparisonOperator"));

    m_comparisonOperatorHasBeenSet = true;
  }

  if(jsonValue.ValueExists("Threshold"))
  {
    m_threshold = jsonValue.GetDouble("Threshold");

    m_thresholdHasBeenSet = true;
  }

  if(jsonValue.ValueExists("EvaluationPeriods"))
  {
    m_evaluationPeriods = jsonValue.GetInteger("EvaluationPeriods");

    m_evaluationPeriodsHasBeenSet = true;
  }

  if(jsonValue.ValueExists("MetricName"))
  {
    m_metricName = MetricNameMapper::GetMetricNameForName(jsonValue.GetString("MetricName"));

    m_metricNameHasBeenSet = true;
  }

  if(jsonValue.ValueExists("PolicyType"))
  {
    m_policyType = PolicyTypeMapper::GetPolicyTypeForName(jsonValue.GetString("PolicyType"));

    m_policyTypeHasBeenSet = true;
  }

  if(jsonValue.ValueExists("TargetConfiguration"))
  {
    m_targetConfiguration = jsonValue.GetObject("TargetConfiguration");

    m_targetConfigurationHasBeenSet = true;
  }

  if(jsonValue.ValueExists("UpdateStatus"))
  {
    m_updateStatus = LocationUpdateStatusMapper::GetLocationUpdateStatusForName(jsonValue.GetString("UpdateStatus"));

    m_updateStatusHasBeenSet = true;
  }

  if(jsonValue.ValueExists("Location"))
  {
    m_location = jsonValue.GetString("Location");

    m_locationHasBeenSet = true;
  }

  return *this;
}

JsonValue ScalingPolicy::Jsonize() const
{
  JsonValue payload;

  if(m_fleetIdHasBeenSet)
  {
   payload.WithString("FleetId", m_fleetId);

  }

  if(m_fleetArnHasBeenSet)
  {
   payload.WithString("FleetArn", m_fleetArn);

  }

  if(m_nameHasBeenSet)
  {
   payload.WithString("Name", m_name);

  }

  if(m_statusHasBeenSet)
  {
   payload.WithString("Status", ScalingStatusTypeMapper::GetNameForScalingStatusType(m_status));
  }

  if(m_scalingAdjustmentHasBeenSet)
  {
   payload.WithInteger("ScalingAdjustment", m_scalingAdjustment);

  }

  if(m_scalingAdjustmentTypeHasBeenSet)
  {
   payload.WithString("ScalingAdjustmentType", ScalingAdjustmentTypeMapper::GetNameForScalingAdjustmentType(m_scalingAdjustmentType));
  }

  if(m_comparisonOperatorHasBeenSet)
  {
   payload.WithString("ComparisonOperator", ComparisonOperatorTypeMapper::GetNameForComparisonOperatorType(m_comparisonOperator));
  }

  if(m_thresholdHasBeenSet)
  {
   payload.WithDouble("Threshold", m_threshold);

  }

  if(m_evaluationPeriodsHasBeenSet)
  {
   payload.WithInteger("EvaluationPeriods", m_evaluationPeriods);

  }

  if(m_metricNameHasBeenSet)
  {
   payload.WithString("MetricName", MetricNameMapper::GetNameForMetricName(m_metricName));
  }

  if(m_policyTypeHasBeenSet)
  {
   payload.WithString("PolicyType", PolicyTypeMapper::GetNameForPolicyType(m_policyType));
  }

  if(m_targetConfigurationHasBeenSet)
  {
   payload.WithObject("TargetConfiguration", m_targetConfiguration.Jsonize());

  }

  if(m_updateStatusHasBeenSet)
  {
   payload.WithString("UpdateStatus", LocationUpdateStatusMapper::GetNameForLocationUpdateStatus(m_updateStatus));
  }

  if(m_locationHasBeenSet)
  {
   payload.WithString("Location", m_location);

  }

  return payload;
}

} // namespace Model
} // namespace GameLift
} // namespace Aws


text:
<?php

namespace Crm\PersonalBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class PersonalBundle extends Bundle
{
}


text:
[![Slack Status](http://slack.counterparty.io/badge.svg)](http://slack.counterparty.io)

**All-in-one Counterparty Federated Node Build System (`federatednode`)**

Allows one to easily build a counterparty-server, `counterblock` and/or Counterwallet system, with all required components. Uses Docker and Docker compose.

See documentation at <http://counterparty.io/docs/federated_node/>.

Please issue any/all pull requests against **develop**, not **master**.


text:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <include layout="@layout/app_bar" />

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="272dp">

                <include
                    layout="@layout/no_image"
                    android:layout_width="match_parent"
                    android:layout_height="240dp" />

                <lt.vilnius.tvarkau.views.adapters.HackyViewPager
                    android:id="@+id/problem_images_view_pager"
                    android:layout_width="match_parent"
                    android:layout_height="240dp" />

                <com.viewpagerindicator.CirclePageIndicator
                    android:id="@+id/problem_images_view_pager_indicator"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:paddingTop="220dp"
                    app:radius="5dp" />

                <android.support.design.widget.FloatingActionButton
                    android:id="@+id/report_problem_take_photo"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="end|bottom"
                    android:layout_marginBottom="8dp"
                    android:layout_marginEnd="@dimen/activity_horizontal_margin"
                    android:layout_marginRight="@dimen/activity_horizontal_margin"
                    android:contentDescription="@string/add_photos"
                    android:src="@drawable/ic_photo_camera_white"
                    app:layout_anchor="@id/problem_images_view_pager"
                    app:layout_anchorGravity="bottom|right|end" />
            </FrameLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="24dp"
                android:layout_marginLeft="24dp"
                android:layout_marginRight="24dp"
                android:orientation="vertical">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">

                    <ImageView
                        style="@style/NewProblemIcon"
                        android:src="@drawable/ic_location_add_problem" />

                    <android.support.design.widget.TextInputLayout
                        android:id="@+id/report_problem_location_wrapper"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:labelFor="@+id/report_problem_location"
                        android:contentDescription="@string/hint_location"
                        android:paddingEnd="24dp"
                        android:paddingRight="24dp">

                        <android.support.design.widget.TextInputEditText
                            android:id="@+id/report_problem_location"
                            style="@style/NewProblemField"
                            android:cursorVisible="false"
                            android:ellipsize="end"
                            android:focusableInTouchMode="false"
                            android:hint="@string/hint_location" />
                    </android.support.design.widget.TextInputLayout>
                </LinearLayout>

                <LinearLayout
                    android:id="@+id/new_report_licence_plate_container"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    android:visibility="gone"
                    tools:visibility="visible">

                    <ImageView
                        style="@style/NewProblemIcon"
                        app:srcCompat="@drawable/ic_drive" />

                    <android.support.design.widget.TextInputLayout
                        android:id="@+id/report_problem_licence_plate_number_wrapper"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:labelFor="@+id/report_problem_licence_plate_number"
                        android:contentDescription="@string/hint_new_report_licence_plate"
                        android:paddingEnd="24dp"
                        android:paddingRight="24dp">

                        <android.support.design.widget.TextInputEditText
                            android:id="@+id/report_problem_licence_plate_number"
                            style="@style/NewProblemField"
                            android:hint="@string/hint_new_report_licence_plate"
                            android:inputType="textCapCharacters"
                            android:maxLines="1" />
                    </android.support.design.widget.TextInputLayout>
                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">

                    <ImageView
                        style="@style/NewProblemIcon"
                        android:src="@drawable/ic_description" />

                    <android.support.design.widget.TextInputLayout
                        android:id="@+id/report_problem_description_wrapper"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:labelFor="@+id/report_problem_description"
                        android:contentDescription="@string/hint_description"
                        android:paddingEnd="24dp"
                        android:paddingRight="24dp">

                        <android.support.design.widget.TextInputEditText
                            android:id="@+id/report_problem_description"
                            style="@style/NewProblemField"
                            android:hint="@string/hint_description"
                            android:inputType="textCapSentences|textMultiLine" />
                    </android.support.design.widget.TextInputLayout>
                </LinearLayout>

                <LinearLayout
                    android:id="@+id/new_report_date_time_container"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    android:visibility="gone"
                    tools:visibility="visible">

                    <ImageView
                        style="@style/NewProblemIcon"
                        app:srcCompat="@drawable/ic_watch" />

                    <android.support.design.widget.TextInputLayout
                        android:id="@+id/report_problem_date_time_wrapper"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:labelFor="@+id/report_problem_date_time"
                        android:contentDescription="@string/hint_report_date_time"
                        android:paddingEnd="24dp"
                        android:paddingRight="24dp">

                        <android.support.design.widget.TextInputEditText
                            android:id="@+id/report_problem_date_time"
                            style="@style/NewProblemField"
                            android:cursorVisible="false"
                            android:focusable="false"
                            android:focusableInTouchMode="false"
                            android:hint="@string/hint_report_date_time"
                            android:inputType="datetime" />
                    </android.support.design.widget.TextInputLayout>
                </LinearLayout>

                <LinearLayout
                    android:id="@+id/new_report_name_container"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    android:visibility="gone"
                    tools:visibility="visible">

                    <ImageView
                        style="@style/NewProblemIcon"
                        android:src="@drawable/ic_person" />

                    <android.support.design.widget.TextInputLayout
                        android:id="@+id/report_problem_submitter_name_wrapper"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:labelFor="@+id/report_problem_submitter_name"
                        android:contentDescription="@string/profile_hint_name"
                        android:paddingEnd="24dp"
                        android:paddingRight="24dp">

                        <android.support.design.widget.TextInputEditText
                            android:id="@+id/report_problem_submitter_name"
                            style="@style/NewProblemField"
                            android:hint="@string/profile_hint_name"
                            android:inputType="textPersonName|textCapWords" />
                    </android.support.design.widget.TextInputLayout>
                </LinearLayout>

                <LinearLayout
                    android:id="@+id/new_report_personal_code_container"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    android:visibility="gone"
                    tools:visibility="visible">

                    <ImageView
                        style="@style/NewProblemIcon"
                        app:srcCompat="@drawable/ic_personal_code" />

                    <android.support.design.widget.TextInputLayout
                        android:id="@+id/report_problem_submitter_personal_code_wrapper"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:labelFor="@+id/report_problem_submitter_personal_code"
                        android:contentDescription="@string/report_submit_hint_personal_code"
                        android:paddingEnd="24dp"
                        android:paddingRight="24dp">

                        <android.support.design.widget.TextInputEditText
                            android:id="@+id/report_problem_submitter_personal_code"
                            style="@style/NewProblemField"
                            android:hint="@string/report_submit_hint_personal_code"
                            android:inputType="number" />
                    </android.support.design.widget.TextInputLayout>
                </LinearLayout>

                <LinearLayout
                    android:id="@+id/new_report_email_container"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    android:visibility="gone"
                    tools:visibility="visible">

                    <ImageView
                        style="@style/NewProblemIcon"
                        android:src="@drawable/ic_email" />

                    <android.support.design.widget.TextInputLayout
                        android:id="@+id/report_problem_submitter_email_wrapper"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:labelFor="@+id/report_problem_submitter_email"
                        android:contentDescription="@string/profile_hint_email"
                        android:paddingEnd="24dp"
                        android:paddingRight="24dp">

                        <android.support.design.widget.TextInputEditText
                            android:id="@+id/report_problem_submitter_email"
                            style="@style/NewProblemField"
                            android:hint="@string/profile_hint_email"
                            android:inputType="textEmailAddress" />
                    </android.support.design.widget.TextInputLayout>
                </LinearLayout>

                <TextView
                    android:id="@+id/report_problem_personal_data_agreement"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:padding="16dp"
                    android:text="@string/new_report_personal_data_agreement"
                    android:visibility="gone"
                    tools:visibility="visible" />
            </LinearLayout>
        </LinearLayout>
    </ScrollView>
</android.support.design.widget.CoordinatorLayout>


text:
import doconv
from doconv.doconv import PluginManager
from doconv import log
from networkx import nx
import logging

log.level = logging.DEBUG

# Actually, this is not a test. It is just a convenient way to generate a graph with
# the conversions provided by doconv.
def test_generate_conversions():
    logger = log.setup_custom_logger('root')
    doconv.__dict__['logger'] = logger

    plugin_manager = PluginManager()
    nx.nx_pydot.write_dot(plugin_manager.graph, 'conversions.dot')

    # Generate a dot file instead of svg to minimize the growth of the git
    # repository. Let this code for future reference.
    #from pygraphviz import AGraph
    #A = nx.to_agraph(G)
    # A.layout()
    #A.draw('conversions.svg', prog="circo")

def main():
    test_generate_conversions()

if __name__ == "__main__":
    main()


text:
/* Deletes a right */

'use strict';

var r     = require('rethinkdb');
var form  = require('express-form');
var field = form.field;

var can      = require('../../lib/can');
var APIError = require('../../lib/APIError');
var uidReg   = require('../../lib/uidReg');

module.exports = {
    method: 'delete',
    route: '/rights/:uid(' + uidReg + ')',
    /**
     * This controller deletes one right
     * 404 error if the right is not found
     * 500 error if the rethinkdb request fails
     * 200 otherwise
     * @param  {object}   req  The request
     * @param  {object}   res  The response
     * @param  {Function} next The next middleware
     */
    controller: function (req, res, next) {
        var app  = req.app;
        var conn = app.locals.conn;
        var log  = app.locals.log;

        if (!req.session.connected) return next(new APIError(401, 'Unauthorized', 'Not connected'));

        can(app)
            .editRight(req.session.userData.id, req.params.uid)
            .then(function (canEdit) {
                if (!canEdit) return next(new APIError(401, 'Unauthorized', 'No right to edit'));

                var deleter = { deletedAt: new Date() };

                log.debug('r.db(wiki).table(rights).get(' + req.params.uid + ').update(' + JSON.stringify(deleter) + ')');
                return r.db('wiki').table('rights')
                    .get(req.params.uid)
                    .update(deleter)
                    .run(conn)
            })
            .then(function (result) {
                if (result.skipped === 1) return next(new APIError(404, 'Not Found', result));

                return res
                    .status(200)
                    .json(result)
                    .end();
            })
            .catch(function (err) {
                return next(new APIError(500, 'SQL Server Error', err));
            });
    }
};


text:
package monix.reactive
package internal
package builders

import cats.effect.ExitCase
import monix.execution.Callback
import monix.eval.Task
import monix.execution.Ack.{ Continue, Stop }
import monix.execution.Cancelable
import monix.execution.cancelables.AssignableCancelable
import monix.reactive.observables.ChainedObservable
import monix.reactive.observers.Subscriber
import scala.util.Success

private[reactive] final class ResourceCaseObservable[A](
  acquire: Task[A],
  release: (A, ExitCase[Throwable]) => Task[Unit]
) extends ChainedObservable[A] {

  def unsafeSubscribeFn(conn: AssignableCancelable.Multi, subscriber: Subscriber[A]): Unit = {
    implicit val s = subscriber.scheduler

    acquire.runAsyncUncancelable(new Callback[Throwable, A] {
      def onSuccess(value: A): Unit = {
        conn := new StreamOne(value)
          .guaranteeCase(e => release(value, e))
          .unsafeSubscribeFn(subscriber)
        ()
      }

      def onError(ex: Throwable): Unit =
        subscriber.onError(ex)
    })
  }

  private final class StreamOne(value: A) extends Observable[A] {
    def unsafeSubscribeFn(out: Subscriber[A]): Cancelable = {
      import monix.execution.schedulers.TrampolineExecutionContext.immediate

      out.onNext(value) match {
        case Continue =>
          out.onComplete()
        case Stop =>
          ()
        case async =>
          async.onComplete {
            case Success(Continue) => out.onComplete()
            case _ => ()
          }(immediate)
      }
      Cancelable.empty
    }
  }
}


text:
<form orientation="horizontal">
    <sizer orientation="vertical" proportion="1">
        <combobox value="References" label="References" proportion="0" expand_sizer="yes">
            <update_reference table="platform_sensor" field="SensorClass"/>
            <update_reference table="missile" field="SensorClass"/>
            <update_reference table="ballistic" field="SensorClass"/>
        </combobox>
        <text value="NATO_ASCC" label="NATO/ASCC Name" proportion="0" expand_sizer="yes"></text>
        <text value="Description" label="Description" proportion="2" multiline="yes" expand_sizer="yes" expand_control="yes"></text>
        <text value="Notes" label="Notes" proportion="2" multiline="yes" expand_control="yes" expand_sizer="yes"></text>
        <text value="MaxRange_km" label="MaxRange_km" proportion="0"></text>
        <text value="RefRange_km" label="RefRange_km" proportion="0" tooltip="Range at which a 1 m2 target can be detected"></text>
        <text value="FieldOfView_deg" label="FieldOfView_deg" proportion="0"></text>
        <text value="MinElevation_deg" label="MinElevation_deg" proportion="0"></text>
        <text value="MaxElevation_deg " label="MaxElevation_deg" proportion="0"></text>
        <text value="ScanPeriod_s" label="ScanPeriod_s" proportion="0"></text>
        <combobox value="DamageEffect" label="DamageEffect" proportion="0" update_table="damage_effect"></combobox>
        <text value="RangeError" label="RangeError" proportion="0"></text>
        <text value="AngleError_deg" label="AngleError_deg" proportion="0"></text>
        <text value="ElevationError_deg" label="ElevationError_deg" proportion="0"></text>
        <text value="CounterMeasureFactor" label="CM Susceptibility" proportion="0"></text>
    </sizer>
    <sizer orientation="vertical" proportion="1">
        <number value="MinFrequency_Hz" label="Min Freq (MHz)" unit_factor="1e-6" decimal_places="0" proportion="0"></number>
        <number value="MaxFrequency_Hz" label="Max Freq (MHz)" unit_factor="1e-6" decimal_places="0" proportion="0"></number>
        <number value="Bandwidth_Hz" label="Bandwidth (MHz)" unit_factor="1e-6" decimal_places="2" proportion="0"></number>
        <text value="EffectiveSidelobes_dB" label="EffectiveSidelobes_dB" proportion="0" tooltip="Average sidelobe level including effects of any adaptive beamforming"></text>
        <checkbox value="IsSurveillance" label="IsSurveillance" proportion="0"></checkbox>
        <text value="ERPpeak_dBW" label="ERP Peak (dBW)" proportion="0" tooltip="10log10(peak transmit power W) + antenna gain"></text>
        <text value="ERPaverage_dBW" label="ERP Average (dBW)" proportion="0" tooltip="10log10(average transmit power W) + antenna gain"></text>
        <text value="MaxFireControlTracks" label="MaxFireControlTracks" proportion="0"></text>
        <checkbox value="IsSemiactive" label="IsSemiactive" proportion="0"></checkbox>
        <text value="BlindSpeed_mps" label="BlindSpeed_mps" proportion="0"></text>
        <text value="LookdownWater_dB" label="LookdownWater_dB" proportion="0"></text>
        <text value="LookdownLand_dB" label="LookdownLand_dB" proportion="0"></text>
        <text value="AzimuthBeamwidth_deg" label="AzimuthBeamwidth_deg" proportion="0"></text>
        <text value="ElevationBeamwidth_deg" label="ElevationBeamwidth_deg" proportion="0"></text>
        <text value="IdThreshold_dB" label="IdThreshold_dB" proportion="0" tooltip="SNR margin above detection threshold to identify target, use 99 for no ID capability"></text>
        <checkbox value="DetectsSurface" label="DetectsSurface" proportion="0"></checkbox>
        <checkbox value="DetectsAir" label="DetectsAir" proportion="0"></checkbox>
        <checkbox value="DetectsMissile" label="DetectsMissile" proportion="0"></checkbox>
        <checkbox value="DetectsGround" label="DetectsGround" proportion="0"></checkbox>
        <calc type="radar" subtype="gain" label="radar calc" proportion="0"></calc>
        <calc type="radar" subtype="losses" label="radar calc" proportion="0"></calc>
    </sizer>
</form>


text:
#coding=utf-8

# Convert a file to utf8-sig encoding.

import sys
import chardet

def CheckEncodeType(file):
    f = open(file, "rb")
    buf = f.read()
    result = chardet.detect(buf)
    return result['encoding']

def ChangeEncode(file, fromEncode, toEncode):
    try:
        # Read file contents
        f = open(file)
        s = f.read()
        f.close()

        # encoding
        u = s.decode(fromEncode)
        s = u.encode(toEncode)

        # Write new contents to file
        outfile = file + ".out"
        f = open(outfile, "w")
        f.write('\xEF\xBB\xBF')
        f.write(s)

        return 0
    except:
        return -1

if __name__ == "__main__":
    file = sys.argv[1]
    toEncode = sys.argv[2]

    encoding = CheckEncodeType(file)
    if  encoding == 'UTF-8' or encoding == 'UTF-8-SIG':
        print ('The file encoding is ' + encoding)
    else:
        ChangeEncode(file, encoding, toEncode)


text:
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4521)
// Multiple constructors required to implement STL compatibility
#endif

template < class T, bool strong = true >
class ComPtr : public Loki::SmartPtr<T, Loki::AdvCOMRefCounted >
{
private:
	typedef Loki::SmartPtr<T, Loki::AdvCOMRefCounted> ComPtrParent;

public:
	ComPtr()
		: ComPtrParent()
	{
		ComPtrParent::SetupNew(strong);
	}

	ComPtr(T* p)
		: ComPtrParent(p)
	{
		ComPtrParent::SetupNew(strong);
	}

	ComPtr(ComPtr& common)
		: ComPtrParent(common)
	{
		ComPtrParent::SetStrong(strong);
		ComPtrParent::Clone(GetImpl(common));
	}

	ComPtr(const ComPtr& common)
		: ComPtrParent(common)
	{
		ComPtrParent::SetStrong(strong);
		ComPtrParent::Clone(GetImpl(common));
	}

	template < class U, bool S >
	ComPtr(ComPtr<U, S>& common)
		: ComPtrParent(common)
	{
		ComPtrParent::SetStrong(strong);
		ComPtrParent::Clone(GetImpl(common));
	}

	template < class U, bool S >
	ComPtr(const ComPtr<U, S>& common)
		: ComPtrParent(common)
	{
		ComPtrParent::SetStrong(strong);
		ComPtrParent::Clone(GetImpl(common));
	}

	template < class U >
	ComPtr(U* ptr, REFIID iid)
		: ComPtrParent()
	{
		ComPtrParent::SetupNew(strong);

		if (ptr)
			if (FAILED(ptr->QueryInterface(iid, (void**)&GetImplRef(*this))))
				GetImplRef(*this) = NULL;
	}

	template < class U, bool S >
	ComPtr(const ComPtr<U, S>& common, REFIID iid)
		: ComPtrParent()
	{
		ComPtrParent::SetStrong(strong);

		if (common)
		{
			HRESULT hr = common->QueryInterface(iid, (void**)&GetImplRef(*this));
			if ( FAILED(hr) )
			{
				GetImplRef(*this) = NULL;
			}
			else
			{
				ComPtrParent::UpdateExistentCounters(common);
				ComPtrParent::IncrementCounters();
			}
		}
	}

	ComPtr& operator=(const ComPtr& rhs)
	{
		ComPtr temp(rhs);

		temp.SetStrong(strong);
		temp.Swap(*this);

		return *this;
	}

	friend inline ComPtr<T, true> GetStrong(const ComPtr& base)
	{
		if (base.CanReturnStrong())
		{
			ComPtr<T, true> resultObject(base);

			return resultObject;
		}

		return ComPtr<T, true>(NULL);
	}

	friend inline ComPtr<T, false> GetWeak(const ComPtr& base)
	{
		return ComPtr<T, false>(base);
	}

};

#ifdef _MSC_VER
#pragma warning( pop )
#endif

////////////////////////////////////////////////////////////////////////////////
// Change log:
// January 8,  2007: Created (based on functionality of Loki)
////////////////////////////////////////////////////////////////////////////////

#endif // !SMARTPOINTERS_H__MINCOM__COMMONKIT__INCLUDED_

// $Log: SmartPointers.h,v $
// Revision 1.3  2007/01/23 21:00:00  scisoftdev
// A lot of bugfixes were applied. STL support
//
// Revision 1.2  2007/01/13 21:00:00  scisoftdev
// Ugly weak pointers support.
//
// Revision 1.1  2007/01/08 21:00:00  scisoftdev
// Core functionality implemented.
//


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.IO;
using System.Linq;
using System.Threading.Tasks;

namespace CIMEL.Installer
{
    [RunInstaller(true)]
    public partial class Installer : System.Configuration.Install.Installer
    {
        public Installer()
        {
            InitializeComponent();
        }

        [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
        public override void Install(IDictionary stateSaver)
        {
            base.Install(stateSaver);
        }

        [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
        public override void Commit(IDictionary savedState)
        {
            base.Commit(savedState);

            // initial the required params dirs
            string[] dirs = new string[] {
                "c:\\AYFY\\大气气溶胶光学参数处理软件\\ParamsData\\data",
                "c:\\AYFY\\大气气溶胶光学参数处理软件\\ParamsData\\modis_brdf",
                "c:\\AYFY\\大气气溶胶光学参数处理软件\\ParamsData\\input",
                "c:\\AYFY\\大气气溶胶光学参数处理软件\\ParamsData\\output",
                "c:\\AYFY\\大气气溶胶光学参数处理软件\\ParamsData\\chartset",
            };
            Parallel.ForEach(dirs, d =>
            {
                if (!Directory.Exists(d))
                    Directory.CreateDirectory(d);
            });
        }

        [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
        public override void Rollback(IDictionary savedState)
        {
            base.Rollback(savedState);
        }

        [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
        public override void Uninstall(IDictionary savedState)
        {
            base.Uninstall(savedState);
        }

    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">
<TITLE>Menü Hilfe</TITLE>
<link rel="stylesheet" type="text/css" href="CrypTool_Help.css">

<OBJECT TYPE="application/x-oleobject" CLASSID="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e" VIEWASTEXT>
	<PARAM NAME="Keyword" VALUE="Menü (Übersicht aller Menüs)">
	<PARAM NAME="Keyword" VALUE="Hilfe">
</OBJECT>

<OBJECT type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e" VIEWASTEXT ID="Object1">
	<PARAM NAME="ALink Name" VALUE="Hilfe">
</OBJECT>

Befehle des Top-Level-Menüs Hilfe

Das Menü Hilfe enthält folgende Befehle, die Ihnen Unterstützung für diese Anwendung bereitstellen:

Startseite
Zeigt Ihnen die Startseite von CrypTool an.

Index
Zeigt Ihnen den CrypTool-Hilfeindex an.

Szenarien (Tutorials)
Zeigt an, wie Sie Szenarien und Demonstrationen durchspielen.

Readme
Zeigt die Readme-Datei zum CrypTool-Projekt an.

CT-Buch
Öffnet das CT-Buch als PDF-Dokument.

Präsentation
Öffnet die CrypTool-Präsentation als PDF-Dokument.

Über CrypTool
Zeigt die Versionsnummer und das Copyright von CrypTool an.


text:
package com.google.common.collect;

import com.google.common.annotations.GwtCompatible;
import com.google.common.base.Preconditions;

import java.util.List;
import java.util.ListIterator;
import java.util.NoSuchElementException;

import javax.annotation.Nullable;

/**
 * Implementation of {@link ImmutableList} with one or more elements.
 *
 * @author Kevin Bourrillion
 */
@GwtCompatible(serializable = true)
@SuppressWarnings("serial") // uses writeReplace(), not default serialization
class RegularImmutableList<E> extends ImmutableList<E> {
  private final transient int offset;
  private final transient int size;
  private final transient Object[] array;

  RegularImmutableList(Object[] array, int offset, int size) {
    this.offset = offset;
    this.size = size;
    this.array = array;
  }

  RegularImmutableList(Object[] array) {
    this(array, 0, array.length);
  }

  public int size() {
    return size;
  }

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

  @Override public boolean contains(Object target) {
    return indexOf(target) != -1;
  }

  // The fake cast to E is safe because the creation methods only allow E's
  @SuppressWarnings("unchecked")
  @Override public UnmodifiableIterator<E> iterator() {
    return (UnmodifiableIterator<E>) Iterators.forArray(array, offset, size);
  }

  @Override public Object[] toArray() {
    Object[] newArray = new Object[size()];
    Platform.unsafeArrayCopy(array, offset, newArray, 0, size);
    return newArray;
  }

  @Override public <T> T[] toArray(T[] other) {
    if (other.length < size) {
      other = ObjectArrays.newArray(other, size);
    } else if (other.length > size) {
      other[size] = null;
    }
    Platform.unsafeArrayCopy(array, offset, other, 0, size);
    return other;
  }

  // The fake cast to E is safe because the creation methods only allow E's
  @SuppressWarnings("unchecked")
  public E get(int index) {
    Preconditions.checkElementIndex(index, size);
    return (E) array[index + offset];
  }

  @Override public int indexOf(Object target) {
    if (target != null) {
      for (int i = offset; i < offset + size; i++) {
        if (array[i].equals(target)) {
          return i - offset;
        }
      }
    }
    return -1;
  }

  @Override public int lastIndexOf(Object target) {
    if (target != null) {
      for (int i = offset + size - 1; i >= offset; i--) {
        if (array[i].equals(target)) {
          return i - offset;
        }
      }
    }
    return -1;
  }

  @Override public ImmutableList<E> subList(int fromIndex, int toIndex) {
    Preconditions.checkPositionIndexes(fromIndex, toIndex, size);
    return (fromIndex == toIndex)
        ? ImmutableList.<E>of()
        : new RegularImmutableList<E>(
            array, offset + fromIndex, toIndex - fromIndex);
  }

  public ListIterator<E> listIterator() {
    return listIterator(0);
  }

  public ListIterator<E> listIterator(final int start) {
    Preconditions.checkPositionIndex(start, size);

    return new ListIterator<E>() {
      int index = start;

      public boolean hasNext() {
        return index < size;
      }
      public boolean hasPrevious() {
        return index > 0;
      }

      public int nextIndex() {
        return index;
      }
      public int previousIndex() {
        return index - 1;
      }

      public E next() {
        E result;
        try {
          result = get(index);
        } catch (IndexOutOfBoundsException rethrown) {
          throw new NoSuchElementException();
        }
        index++;
        return result;
      }
      public E previous() {
        E result;
        try {
          result = get(index - 1);
        } catch (IndexOutOfBoundsException rethrown) {
          throw new NoSuchElementException();
        }
        index--;
        return result;
      }

      public void set(E o) {
        throw new UnsupportedOperationException();
      }
      public void add(E o) {
        throw new UnsupportedOperationException();
      }
      public void remove() {
        throw new UnsupportedOperationException();
      }
    };
  }

  @Override public boolean equals(@Nullable Object object) {
    if (object == this) {
      return true;
    }
    if (!(object instanceof List)) {
      return false;
    }

    List<?> that = (List<?>) object;
    if (this.size() != that.size()) {
      return false;
    }

    int index = offset;
    if (object instanceof RegularImmutableList) {
      RegularImmutableList<?> other = (RegularImmutableList<?>) object;
      for (int i = other.offset; i < other.offset + other.size; i++) {
        if (!array[index++].equals(other.array[i])) {
          return false;
        }
      }
    } else {
      for (Object element : that) {
        if (!array[index++].equals(element)) {
          return false;
        }
      }
    }
    return true;
  }

  @Override public int hashCode() {
    // not caching hash code since it could change if the elements are mutable
    // in a way that modifies their hash codes
    int hashCode = 1;
    for (int i = offset; i < offset + size; i++) {
      hashCode = 31 * hashCode + array[i].hashCode();
    }
    return hashCode;
  }

  @Override public String toString() {
    StringBuilder sb = new StringBuilder(size() * 16);
    sb.append('[').append(array[offset]);
    for (int i = offset + 1; i < offset + size; i++) {
      sb.append(", ").append(array[i]);
    }
    return sb.append(']').toString();
  }

  int offset() {
    return offset;
  }

  Object[] array() {
    return array;
  }
}


text:
 width: 65%;
 float: left;
}

#content_column_right {
 width: 35%;
 float: right;
}

#content_column h2 {
 margin: 10% 10% 5% 10%;
 font-size: 18px;
}

#content_column p {
 margin: 0% 10% 2% 10%;
}

#content_column .data_list {
}

.data_list {
 width: 90%;
 border: 1px solid #cccccc;
 font-size: 12px;
 margin: 5%;
 position: relative;
}

.data_list h3 {
 background-color:#3366cc;
 background-image: url('images/transparent_80.png');
 padding: 8px;
 font-size: 14px;
}

.data_list .message_title {
 color: #3366cc;
}

.data_list .message_title a {
 color: #3366cc;
 text-decoration:none;
}

.data_list ul {
 padding: 5px;
}

.data_list li {
 padding: 7px 5px 7px 40px;
 border-bottom: 1px dotted #cccccc;
}

.news_icon {
 background: url(images/icon_news.gif) no-repeat left 50%;
}
.date_icon {
 background: url(images/icon_calendar.gif) no-repeat left 50%;
}
.message_icon {
 background: url(images/icon_message.gif) no-repeat left 50%;
}

.view_all_link {
 position: absolute;
 top: 10px;
 right: 10px;
 font-size: 11px;
 text-decoration: none;
 color: #3366cc;
}

.view_all_link:hover {
 text-decoration: underline;
}

.info_column_search {
 width: 100%;
 height: 25px;
 margin-bottom: 40px;
}

#info_column h3 {
 margin-bottom: 3px;
}

#info_column h4{
 background-color:#cccccc;
 padding: 8px;
 font-size: 14px;
 margin-top: 40px;
}

.action_links {
 margin-bottom: 7px;
}


text:
namespace edb
{

ChangeComplexOrigin::ChangeComplexOrigin()
{
// 	m_items.push_back(Item("bamboo_02_complex.json", -68.1f, -186.7f));
// 	m_items.push_back(Item("bamboo_03_complex.json", -73, -196.1f));
// 	m_items.push_back(Item("bamboo_04_complex.json", -102, -212.7f));
// 	m_items.push_back(Item("bamboo_05_complex.json", -122.8f, -121.9f));
// 	m_items.push_back(Item("bamboo_06_complex.json", -153.9f, -119.3f));
// 	m_items.push_back(Item("bamboo_07_complex.json", -77.8f, -142.7f));
// 	m_items.push_back(Item("bamboo_08_complex.json", -67.4f, -147.8f));

	m_items.push_back(Item("zu_zi_001_complex.json", -5.6f, -95.1f));
	m_items.push_back(Item("zu_zi_002_complex.json", -0.2f, -43.2f));
	m_items.push_back(Item("zu_zi_003_complex.json", -4.2f, -393.2f));
}

std::string ChangeComplexOrigin::Command() const
{
	return "change-origin";
}

std::string ChangeComplexOrigin::Description() const
{
	return "change complex origin";
}

std::string ChangeComplexOrigin::Usage() const
{
	return Command() + " [dir]";
}

int ChangeComplexOrigin::Run(int argc, char *argv[])
{
	// change-origin D:\projects\ejoy\coco-tools\sg_particle\data\json_and_pngs

	if (!check_number(this, argc, 3)) return -1;
	if (!check_folder(argv[2])) return -1;

	Trigger(argv[2]);

	return 0;
}

void ChangeComplexOrigin::Trigger(const std::string& dir) const
{
	wxArrayString files;
	ee::FileHelper::FetchAllFiles(dir, files);
	for (int i = 0, n = files.size(); i < n; ++i)
	{
		std::string filepath = ee::FileHelper::GetAbsolutePath(files[i].ToStdString());
		int type = ee::SymbolFile::Instance()->Type(filepath);
		switch (type)
		{
		case s2::SYM_COMPLEX:
			FixComplex(filepath);
			break;
		case s2::SYM_UNKNOWN:
			if (filepath.find("_lr.json") != std::string::npos) {
				FixLR(filepath);
			}
			break;
		}
	}
}

void ChangeComplexOrigin::FixComplex(const std::string& filepath) const
{
	const Item* item = QueryItem(filepath);
	if (!item) {
		return;
	}

	Json::Value value;
	Json::Reader reader;
	std::locale::global(std::locale(""));
	std::ifstream fin(filepath.c_str());
	std::locale::global(std::locale("C"));
	reader.parse(fin, value);
	fin.close();

	for (int i = 0, n = value["sprite"].size(); i < n; ++i)
	{
		Json::Value& spr_val = value["sprite"][i];
		sm::vec2 pos;
		if (spr_val.isMember("position")) {
			pos.x = spr_val["position"]["x"].asDouble();
			pos.y = spr_val["position"]["y"].asDouble();
		}
		pos -= item->trans;
		spr_val["position"]["x"] = pos.x;
		spr_val["position"]["y"] = pos.y;
	}

	Json::StyledStreamWriter writer;
	std::locale::global(std::locale(""));
	std::ofstream fout(filepath.c_str());
	std::locale::global(std::locale("C"));
	writer.write(fout, value);
	fout.close();
}

void ChangeComplexOrigin::FixLR(const std::string& path) const
{
	std::string filepath = ee::FileHelper::GetAbsolutePath(path);

	Json::Value value;
	Json::Reader reader;
	std::locale::global(std::locale(""));
	std::ifstream fin(filepath.c_str());
	std::locale::global(std::locale("C"));
	reader.parse(fin, value);
	fin.close();

	bool dirty = false;

	Json::Value& layer_val = value["layer"];
	for (int i = 0, n = layer_val.size(); i < n; ++i) {
		Json::Value& spr_val = layer_val[i]["sprite"];
		for (int j = 0, m = spr_val.size(); j < m; ++j) {
			std::string filepath = spr_val[j]["filepath"].asString();
			if (filepath == ee::SYM_GROUP_TAG) {
				Json::Value& group_val = spr_val[j][ee::SYM_GROUP_TAG];
				for (int i = 0, n = group_val.size(); i < n; ++i) {
					if (FixLRSpr(group_val[i])) {
						dirty = true;
					}
				}
			} else {
				if (FixLRSpr(spr_val[j])) {
					dirty = true;
				}
			}
		}
	}

	if (dirty) {
		Json::StyledStreamWriter writer;
		std::locale::global(std::locale(""));
		std::ofstream fout(filepath.c_str());
		std::locale::global(std::locale("C"));
		writer.write(fout, value);
		fout.close();
	}
}

bool ChangeComplexOrigin::FixLRSpr(Json::Value& val) const
{
	std::string filepath = val["filepath"].asString();
	const Item* item = QueryItem(filepath);
	if (!item) {
		return false;
	}

	sm::vec2 pos;
	if (val.isMember("position")) {
		pos.x = val["position"]["x"].asDouble();
		pos.y = val["position"]["y"].asDouble();
	}
	pos += item->trans;
	val["position"]["x"] = pos.x;
	val["position"]["y"] = pos.y;

	return true;
}

const ChangeComplexOrigin::Item* ChangeComplexOrigin::QueryItem(const std::string& filepath) const
{
	std::string fmt_path = filepath;
	ee::StringHelper::ToLower(fmt_path);
	for (int i = 0, n = m_items.size(); i < n; ++i) {
		if (fmt_path.find(m_items[i].filename) != std::string::npos) {
			return &m_items[i];
		}
	}
	return NULL;
}

}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Sphaeria chamaeropis Durieu & Mont.

### Remarks
null


text:
namespace Bmz.Framework.Runtime.Validation
{
    /// <summary>
    /// This interface is implemented by classes those are needed to validate before use.
    /// </summary>
    public interface IValidate
    {

    }
}


text:
#!/usr/bin/php
<?php

require_once("dompdf_config.inc.php");

/**
 * @access private
 */
define("_TTF2AFM", TTF2AFM . " -a -GAef -OW ");

if ( !file_exists(TTF2AFM) ) {
  die("Unable to locate the ttf2afm / ttf2pt1 executable (checked " . TTF2AFM . ").\n");
}

/**
 * Display command line usage
 *
 */
function usage() {

  echo <<<EOD

Usage: {$_SERVER["argv"][0]} font_family n_file [b_file] [i_file] [bi_file]

font_family:      the name of the font, e.g. Verdana, 'Times New Roman',
                  monospace, sans-serif.

n_file:           the .pfb or .ttf file for the normal, non-bold, non-italic
                  face of the font.

{b|i|bi}_file:    the files for each of the respective (bold, italic,
                  bold-italic) faces.

If the optional b|i|bi files are not specified, load_font.php will search
the directory containing normal font file (n_file) for additional files that
it thinks might be the correct ones (e.g. that end in _Bold or b or B).  If
it finds the files they will also be processed.  All files will be
automatically copied to the DOMPDF font directory, and afm files will be
generated using ttf2afm.

Examples:

./load_font.php silkscreen /usr/share/fonts/truetype/slkscr.ttf
./load_font.php 'Times New Roman' /mnt/c_drive/WINDOWS/Fonts/times.ttf

EOD;

}

if ( $_SERVER["argc"] < 3 ) {
  usage();
  die();
}

/**
 * Installs a new font family
 *
 * This function maps a font-family name to a font.  It tries to locate the
 * bold, italic, and bold italic versions of the font as well.  Once the
 * files are located, ttf versions of the font are copied to the fonts
 * directory.  Changes to the font lookup table are saved to the cache.
 *
 * @param string $fontname the font-family name
 * @param string $normal the filename of the normal face font subtype
 * @param string $bold   the filename of the bold face font subtype
 * @param string $italic the filename of the italic face font subtype
 * @param string $bold_italic the filename of the bold italic face font subtype
 */
function install_font_family($fontname, $normal, $bold = null, $italic = null, $bold_italic = null) {

  // Check if the base filename is readable
  if ( !is_readable($normal) )
    throw new DOMPDF_Exception("Unable to read '$normal'.");

  $dir = dirname($normal);
  list($file, $ext) = explode(".", basename($normal), 2);  // subtract extension

  // Try $file_Bold.$ext etc.
  $ext = ".$ext";

  if ( !isset($bold) || !is_readable($bold) ) {
    $bold   = $dir . "/" . $file . "_Bold" . $ext;
    if ( !is_readable($bold) ) {

      // Try $file . "b"
      $bold = $dir . "/" . $file . "b" . $ext;
      if ( !is_readable($bold) ) {

        // Try $file . "B"
        $bold = $dir . "/" . $file . "B" . $ext;
        if ( !is_readable($bold) )
          $bold = null;
      }
    }
  }

  if ( is_null($bold) )
    echo ("Unable to find bold face file.\n");

  if ( !isset($italic) || !is_readable($italic) ) {
    $italic = $dir . "/" . $file . "_Italic" . $ext;
    if ( !is_readable($italic) ) {

      // Try $file . "i"
      $italic = $dir . "/" . $file . "i" . $ext;
      if ( !is_readable($italic) ) {

        // Try $file . "I"
        $italic = $dir . "/" . $file . "I" . $ext;
        if ( !is_readable($italic) )
          $italic = null;
      }
    }
  }

  if ( is_null($italic) )
    echo ("Unable to find italic face file.\n");

  if ( !isset($bold_italic) || !is_readable($bold_italic) ) {
    $bold_italic = $dir . "/" . $file . "_Bold_Italic" . $ext;

    if ( !is_readable($bold_italic) ) {

      // Try $file . "bi"
      $bold_italic = $dir . "/" . $file . "bi" . $ext;
      if ( !is_readable($bold_italic) ) {

        // Try $file . "BI"
        $bold_italic = $dir . "/" . $file . "BI" . $ext;
        if ( !is_readable($bold_italic) ) {

          // Try $file . "ib"
          $bold_italic = $dir . "/" . $file . "ib" . $ext;
          if ( !is_readable($bold_italic) ) {

            // Try $file . "IB"
            $bold_italic = $dir . "/" . $file . "IB" . $ext;
            if ( !is_readable($bold_italic) )
              $bold_italic = null;
          }
        }
      }
    }
  }

  if ( is_null($bold_italic) )
    echo ("Unable to find bold italic face file.\n");

  $fonts = compact("normal", "bold", "italic", "bold_italic");
  $entry = array();

  if ( mb_strtolower($ext) === ".pfb" || mb_strtolower($ext) === ".ttf" ) {

    // Copy the files to the font directory.
    foreach ($fonts as $var => $src) {

      if ( is_null($src) ) {
        $entry[$var] = DOMPDF_FONT_DIR . basename($normal);
        continue;
      }

      // Verify that the fonts exist and are readable
      if ( !is_readable($src) )
        throw new User_DOMPDF_Exception("Requested font '$pathname' is not readable");

      $dest = DOMPDF_FONT_DIR . basename($src);
      if ( !is_writeable(dirname($dest)) )
        throw new User_DOMPDF_Exception("Unable to write to destination '$dest'.");

      echo "Copying $src to $dest...\n";

      if ( !copy($src, $dest) )
        throw new DOMPDF_Exception("Unable to copy '$src' to '" . DOMPDF_FONT_DIR . "$dest'.");

      $entry[$var] = $dest;
    }

  } else
    throw new DOMPDF_Exception("Unable to process fonts of type '$ext'.");

  // If the extension is a ttf, try and convert the fonts to afm too
  if ( mb_strtolower($ext) === ".ttf") {
    foreach ($fonts as $var => $font) {
      if ( is_null($font) ) {
        $entry[$var] = DOMPDF_FONT_DIR . mb_substr(basename($normal), 0, -4);
        continue;
      }
      $dest = DOMPDF_FONT_DIR . mb_substr(basename($font),0, -4);
      echo "Generating .afm for $font...\n";
      exec( _TTF2AFM . " " . escapeshellarg($font) . " " . $dest . " &> /dev/null", $output, $ret );

      $entry[$var] = $dest;
    }

  }

  // FIXME: how to generate afms from pfb?

  // Store the fonts in the lookup table
  Font_Metrics::set_font_family(mb_strtolower($fontname), $entry);

  // Save the changes
  Font_Metrics::save_font_families();
}

$normal = $_SERVER["argv"][2];
$bold   = isset($_SERVER["argv"][3]) ? $_SERVER["argv"][3] : null;
$italic = isset($_SERVER["argv"][4]) ? $_SERVER["argv"][4] : null;
$bold_italic = isset($_SERVER["argv"][5]) ? $_SERVER["argv"][5] : null;

install_font_family($_SERVER["argv"][1], $normal, $bold, $italic, $bold_italic);

?>


text:
module Viiite
  class Command
    class Plot

      options do |opt|
        opt.on("--highcharts=[TERM]",
               "Render output for highcharts.js") do |value|
          @render = :highcharts
          @highcharts_term = (value || "json").to_sym
          @graph_style = load_style(Path.dir/'to_highcharts_graph.rb') unless @graph_style
        end
      end

      def to_highcharts_query(lispy, op)
        lispy = Alf.lispy
        op = lispy.summarize(op, [@graph, @series, @abscissa].compact,
                                 {:y => "avg{ #{@ordinate} }"})
        op = lispy.rename(op, @graph  => :graph, @abscissa => :x, @series => :serie)
        op = lispy.summarize(op,
                             [:x, :y],
                             {:data => lispy.collect{ [x, y] }},
                             {:allbut => true})
        op = lispy.rename(op, :serie => :name)
        op = lispy.group(op, [:name, :data], :series)
        op = lispy.join(op, @graph_style) if @graph_style
        op = lispy.extend(op, :title => lambda{ title.merge(:text => graph) })
        op = lispy.project(op, [:graph], {:allbut => true})
        op
      end

      def to_highcharts(lispy, op)
        require 'json'
        puts op.to_a.to_json
      end

    end # class Plot
  end # class Command
end # module Viiite


text:
goog.setTestOnly();
goog.require('goog.testing.AsyncTestCase');
goog.require('goog.testing.jsunit');
goog.require('hr.db');
goog.require('lf.Order');
goog.require('lf.schema.DataStoreType');

/** @type {!goog.testing.AsyncTestCase} */
var asyncTestCase =
    goog.testing.AsyncTestCase.createAndInstall('DateIndexTest');

/** @type {!lf.Database} */
var db;

/** @type {!lf.schema.Table} */
var holiday;

function setUp() {
  asyncTestCase.waitForAsync('setUp');
  hr.db.connect({storeType: lf.schema.DataStoreType.MEMORY}).then(
      function(database) {
        db = database;
        holiday = db.getSchema().getHoliday();
        asyncTestCase.continueTesting();
      });
}

/**
 * Generates sample records to be used for testing.
 * @return {!Array<!hr.db.row.Holiday>}
 */
function generateSampleRows() {
  return [
    holiday.createRow({
      name: '2014 New Year\'s Day',
      begin: new Date(2013, 11, 31),
      end: new Date(2014, 0, 1, 23, 59, 59)
    }),
    holiday.createRow({
      name: '2014 MLK Day',
      begin: new Date(2014, 0, 20),
      end: new Date(2014, 0, 20, 23, 59, 59)
    }),
    holiday.createRow({
      name: '2014 President\'s Day',
      begin: new Date(2014, 1, 17),
      end: new Date(2014, 1, 17, 23, 59, 59)
    }),
    holiday.createRow({
      name: '2014 Memorial Day',
      begin: new Date(2014, 4, 26),
      end: new Date(2014, 4, 26, 23, 59, 59)
    }),
    holiday.createRow({
      name: '2014 Independence Day',
      begin: new Date(2014, 6, 3),
      end: new Date(2014, 6, 4, 23, 59, 59)
    }),
    holiday.createRow({
      name: '2014 Labor Day',
      begin: new Date(2014, 8, 1),
      end: new Date(2014, 8, 1, 23, 59, 59)
    }),
    holiday.createRow({
      name: '2014 Thanksgiving',
      begin: new Date(2014, 10, 27),
      end: new Date(2014, 10, 28, 23, 59, 59)
    }),
    holiday.createRow({
      name: '2014 Christmas',
      begin: new Date(2014, 11, 24),
      end: new Date(2014, 11, 26, 23, 59, 59)
    })
  ];
}

function testDateIndex() {
  asyncTestCase.waitForAsync('testDateIndex');

  var rows = generateSampleRows();
  var expected = rows.map(function(row) {
    return row.getName();
  }).slice(1).reverse();

  db.insert().into(holiday).values(rows).exec().then(function() {
    var query = db.select().
        from(holiday).
        where(holiday.begin.gt(new Date(2014, 0, 1))).
        orderBy(holiday.begin, lf.Order.DESC);
    assertTrue(query.explain().indexOf('index_range_scan') != -1);
    return query.exec();
  }).then(function(results) {
    assertArrayEquals(expected, results.map(function(row) {
      return row['name'];
    }));
    asyncTestCase.continueTesting();
  });
}


text:
date : 2013-06-20
title : Little Boxes: CSS Protips
description : What is CSS to you? Maybe an annoyin
location : Lone Star College - Montgomery
speaker : Wayne Denier
bio : Wayne Denier is a Senior Consultant for Headspring. He develops across the application stack in .NET MVC and other C# stuff, with a focus on UI, usability and presentation technologies.
speakerurl :
email :
twitter :
sponsor : HeadSpring
logo : HeadSpring_Logo.JPG
---
What is CSS to you? Maybe an annoying roommate, complete stranger or your best friend forever. In this talk we'll explore CSS, how to implement it, deal with it in the wild and handle compatibility. Whatever your skill level, hopefully you'll walk away feeling a little better about dealing with little boxes.