text:
using Orchard.Localization;
using Orchard.UI.Navigation;

namespace Orchard.MediaLibrary {
    public class AdminMenu : INavigationProvider {
        public Localizer T { get; set; }

        public AdminMenu() {
            T = NullLocalizer.Instance;
        }

        public string MenuName { get { return "admin"; } }

        public void GetNavigation(NavigationBuilder builder) {
            builder.AddImageSet("media-library")
                .Add(T("Media"), "6",
                    menu => menu.Add(T("Media"), "0", item => item.Action("Index", "Admin", new {area = "Orchard.MediaLibrary"})
                        .Permission(Permissions.ManageOwnMedia)),
                    new[] {"photo"});
        }
    }
}


text: XWeibo::Application.config.session_store :cookie_store, key: '_x_weibo_session'

redpajama_set_name: RedPajamaGithub


text:
Example of a blog engine with Python and Flask

First you create database with db_create.py, then run.py

# Uses
Python 2.7

Flask

Flask-Admin

Flask-Login

Flask-Mail

Flask-Misaka

Flask-Moment

Flask-PageDown

Flask-Sijax

Flask-SQLAlchemy

Flask-WhooshAlchemy

Flask-WTF


text:
package com.flipkart.connekt.busybees.models

import com.flipkart.connekt.commons.iomodels.{Constants, ContactPayloads}

case class WAContactTracker(contacts: Set[String],
                            appName: String,
                            contactPayloads: ContactPayloads,
                            override val messageId: String,
                            override val provider: String = Constants.WAConstants.WHATSAPP.toString
                           ) extends RequestTracker


text:
from setuptools import setup, find_packages

exec(open('kway/version.py').read())

setup(
    name='django-kway',
    packages=find_packages(exclude=['contrib', 'docs', 'tests*']),
    version=__version__,
    description='django-kway is an alternative to django gettext catalog with admin integration.',
    long_description=(
        'django-kway is an alternative to django gettext catalog and offers: '
        'i18n support (with multiple plural forms), django admin integration, '
        'kgettext function, ktrans template tag, caching, lazy modeltranslation integration and various settings.'
    ),
    author='Fabio Caccamo',
    author_email='fabio.caccamo@gmail.com',
    url='https://github.com/fabiocaccamo/django-kway',
    download_url='https://github.com/fabiocaccamo/django-kway/archive/%s.tar.gz' % __version__,
    keywords = ['django', 'admin', 'i18n', 'gettext', 'trans', 'alternative', 'key', 'modeltranslation', 'rosetta'],
    requires=['django(>=1.4)'],
    classifiers=[]
)


text:
<div :class="classNames">

  <slot>
    <panel-title
      v-if="hasTitle"
      :variants="elementVariants('title')"
      :contextual-style="elementContextualStyle('title')"
      :content="elementContent('title')"
    ></panel-title>
  </slot>

</div>


text:
require 'jieba-analysis-1.0.1-SNAPSHOT'

module Jieba
  java_import com::huaban::analysis::jieba::JiebaSegmenter

  def to_tags
    words = segmenter.sentenceProcess(self).to_s[1..-2].split(", ") rescue []
    words.map{ |word| word if word.size >=2 }.uniq.compact unless words.empty?
  end

  private

    def segmenter
      @segmenter ||= JiebaSegmenter.new
    end

end # Jieba
String.send(:include, Jieba)


text:
using System.Collections.Generic;
using System.Threading.Tasks;
using Demo.Common.ServiceDefinition;

namespace Demo.Server
{
    public interface IChatMessageRepository
    {
        Task<ICollection<ChatMessage>> GetAccountChatHistoryAsync(int accountId);
        IAsyncEnumerable<ChatMessage> ListenAccountChatAsync(int accountId);
    }
}


text:
package colossus
package service

import metrics.TagMap

trait TagDecorator[I,O] {
  def tagsFor(request: I, response: O): TagMap
}

class DefaultTagDecorator[I,O] extends TagDecorator[I,O] {
  def tagsFor(request: I, response: O): TagMap = Map()
}

object TagDecorator {

  def default[I, O] = new DefaultTagDecorator[I,O]
}


text:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">

    <item
        android:id="@+id/navigation_history"
        android:icon="@drawable/ic_dashboard_black_24dp"
        android:title="@string/title_history" />

    <item
        android:id="@+id/navigation_home"
        android:icon="@drawable/ic_home_black_24dp"
        android:title="@string/title_home" />

    <item
        android:id="@+id/navigation_away"
        android:icon="@drawable/ic_directions_bus_black_24dp"
        android:title="@string/title_away" />

</menu>


text:
package kesshou.android.daanx.models;

import io.realm.DynamicRealm;
import io.realm.DynamicRealmObject;
import io.realm.RealmMigration;
import io.realm.RealmObjectSchema;
import io.realm.RealmSchema;

/**
 * Created by yoyo930021 on 2017/1/16.
 */

public class Migration implements RealmMigration {
	@Override
	public void migrate(final DynamicRealm realm, long oldVersion, long newVersion) {
		// During a migration, a DynamicRealm is exposed. A DynamicRealm is an untyped variant of a normal Realm, but
		// with the same object creation and query capabilities.
		// A DynamicRealm uses Strings instead of Class references because the Classes might not even exist or have been
		// renamed.

		// Access the Realm schema in order to create, modify or delete classes and their fields.
		RealmSchema schema = realm.getSchema();

		if(oldVersion==1){

			RealmObjectSchema settingSchema = schema.get("Setting");

			settingSchema.addField("locale",String.class)
					.transform(new RealmObjectSchema.Function() {
						@Override
						public void apply(DynamicRealmObject obj) {
							obj.set("locale","Auto");
						}
					});

			oldVersion++;
		}

		if(oldVersion==2){

			RealmObjectSchema cacheSchema = schema.get("NetWorkCache");

			cacheSchema.removeField("record").addField("record",String.class);

			oldVersion++;
		}
	}
}


text:
    or "c_array_as_multi_point" to adapt a c array
#endif

#define BOOST_GEOMETRY_ADAPTED_C_ARRAY_AS_POINT_COLLECTION_TAG_DEFINED

#include <cstddef>

#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>

namespace boost { namespace geometry
{

#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
namespace traits
{

    template <typename T, std::size_t PointCount, std::size_t DimensionCount>
    struct tag< T[PointCount][DimensionCount] >
    {
        typedef ring_tag type;
    };

} // namespace traits
#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS

}} // namespace boost::geometry

#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_C_ARRAY_AS_RING_HPP


text:
<?php

namespace Zend\Log;

use DateTime;
use Traversable;
use Zend\Stdlib\ArrayUtils;
use Zend\Stdlib\SplPriorityQueue;

/**
 * Logging messages with a stack of backends
 *
 * @category   Zend
 * @package    Zend_Log
 */
class Logger implements LoggerInterface
{
    /**
     * @const int defined from the BSD Syslog message severities
     * @link http://tools.ietf.org/html/rfc3164
     */
    const EMERG  = 0;
    const ALERT  = 1;
    const CRIT   = 2;
    const ERR    = 3;
    const WARN   = 4;
    const NOTICE = 5;
    const INFO   = 6;
    const DEBUG  = 7;

    /**
     * List of priority code => priority (short) name
     *
     * @var array
     */
    protected $priorities = array(
        self::EMERG  => 'EMERG',
        self::ALERT  => 'ALERT',
        self::CRIT   => 'CRIT',
        self::ERR    => 'ERR',
        self::WARN   => 'WARN',
        self::NOTICE => 'NOTICE',
        self::INFO   => 'INFO',
        self::DEBUG  => 'DEBUG',
    );

    /**
     * Writers
     *
     * @var SplPriorityQueue
     */
    protected $writers;

    /**
     * Writer plugins
     *
     * @var WriterPluginManager
     */
    protected $writerPlugins;

    /**
     * Registered error handler
     *
     * @var boolean
     */
    protected static $registeredErrorHandler = false;

    /**
     * Registered exception handler
     *
     * @var boolean
     */
    protected static $registeredExceptionHandler = false;

    /**
     * Constructor
     *
     * @todo support configuration (writers, dateTimeFormat, and writer plugin manager)
     * @return Logger
     */
    public function __construct()
    {
        $this->writers = new SplPriorityQueue();
    }

    /**
     * Shutdown all writers
     *
     * @return void
     */
    public function __destruct()
    {
        foreach ($this->writers as $writer) {
            try {
                $writer->shutdown();
            } catch (\Exception $e) {}
        }
    }

    /**
     * Get writer plugin manager
     *
     * @return WriterPluginManager
     */
    public function getWriterPluginManager()
    {
        if (null === $this->writerPlugins) {
            $this->setWriterPluginManager(new WriterPluginManager());
        }
        return $this->writerPlugins;
    }

    /**
     * Set writer plugin manager
     *
     * @param  string|WriterPluginManager $plugins
     * @return Logger
     * @throws Exception\InvalidArgumentException
     */
    public function setWriterPluginManager($plugins)
    {
        if (is_string($plugins)) {
            $plugins = new $plugins;
        }
        if (!$plugins instanceof WriterPluginManager) {
            throw new Exception\InvalidArgumentException(sprintf(
                'Writer plugin manager must extend %s\WriterPluginManager; received %s',
                __NAMESPACE__,
                is_object($plugins) ? get_class($plugins) : gettype($plugins)
            ));
        }

        $this->writerPlugins = $plugins;
        return $this;
    }

    /**
     * Get writer instance
     *
     * @param string $name
     * @param array|null $options
     * @return Writer
     */
    public function writerPlugin($name, array $options = null)
    {
        return $this->getWriterPluginManager()->get($name, $options);
    }

    /**
     * Add a writer to a logger
     *
     * @param  string|Writer $writer
     * @param  int $priority
     * @return Logger
     * @throws Exception\InvalidArgumentException
     */
    public function addWriter($writer, $priority = 1, array $options = null)
    {
        if (is_string($writer)) {
            $writer = $this->writerPlugin($writer, $options);
        } elseif (!$writer instanceof Writer\WriterInterface) {
            throw new Exception\InvalidArgumentException(sprintf(
                'Writer must implement Zend\Log\Writer; received "%s"',
                is_object($writer) ? get_class($writer) : gettype($writer)
            ));
        }

        $this->writers->insert($writer, $priority);

        return $this;
    }

    /**
     * Get writers
     *
     * @return SplPriorityQueue
     */
    public function getWriters()
    {
        return $this->writers;
    }

    /**
     * Set the writers
     *
     * @param  SplPriorityQueue $writers
     * @return Logger
     * @throws Exception\InvalidArgumentException
     */
    public function setWriters(SplPriorityQueue $writers)
    {
        foreach ($writers->toArray() as $writer) {
            if (!$writer instanceof Writer\WriterInterface) {
                throw new Exception\InvalidArgumentException('Writers must be a SplPriorityQueue of Zend\Log\Writer');
            }
        }
        $this->writers = $writers;
        return $this;
    }

    /**
     * Add a message as a log entry
     *
     * @param  int $priority
     * @param  mixed $message
     * @param  array|Traversable $extra
     * @return Logger
     * @throws Exception\InvalidArgumentException if message can't be cast to string
     * @throws Exception\InvalidArgumentException if extra can't be iterated over
     */
    public function log($priority, $message, $extra = array())
    {
        if (!is_int($priority) || ($priority<0) || ($priority>=count($this->priorities))) {
            throw new Exception\InvalidArgumentException(sprintf(
                '$priority must be an integer > 0 and < %d; received %s',
                count($this->priorities),
                var_export($priority, 1)
            ));
        }
        if (is_object($message) && !method_exists($message, '__toString')) {
            throw new Exception\InvalidArgumentException(
                '$message must implement magic __toString() method'
            );
        }

        if (!is_array($extra) && !$extra instanceof Traversable) {
            throw new Exception\InvalidArgumentException(
                '$extra must be an array or implement Traversable'
            );
        } elseif ($extra instanceof Traversable) {
            $extra = ArrayUtils::iteratorToArray($extra);
        }

        if ($this->writers->count() === 0) {
            throw new Exception\RuntimeException('No log writer specified');
        }

        $timestamp = new DateTime();

        if (is_array($message)) {
            $message = var_export($message, true);
        }

        foreach ($this->writers->toArray() as $writer) {
            $writer->write(array(
                'timestamp'    => $timestamp,
                'priority'     => (int) $priority,
                'priorityName' => $this->priorities[$priority],
                'message'      => (string) $message,
                'extra'        => $extra
            ));
        }

        return $this;
    }

    /**
     * @param string $message
     * @param array|Traversable $extra
     * @return Logger
     */
    public function emerg($message, $extra = array())
    {
        return $this->log(self::EMERG, $message, $extra);
    }

    /**
     * @param string $message
     * @param array|Traversable $extra
     * @return Logger
     */
    public function alert($message, $extra = array())
    {
        return $this->log(self::ALERT, $message, $extra);
    }

    /**
     * @param string $message
     * @param array|Traversable $extra
     * @return Logger
     */
    public function crit($message, $extra = array())
    {
        return $this->log(self::CRIT, $message, $extra);
    }

    /**
     * @param string $message
     * @param array|Traversable $extra
     * @return Logger
     */
    public function err($message, $extra = array())
    {
        return $this->log(self::ERR, $message, $extra);
    }

    /**
     * @param string $message
     * @param array|Traversable $extra
     * @return Logger
     */
    public function warn($message, $extra = array())
    {
        return $this->log(self::WARN, $message, $extra);
    }

    /**
     * @param string $message
     * @param array|Traversable $extra
     * @return Logger
     */
    public function notice($message, $extra = array())
    {
        return $this->log(self::NOTICE, $message, $extra);
    }

    /**
     * @param string $message
     * @param array|Traversable $extra
     * @return Logger
     */
    public function info($message, $extra = array())
    {
        return $this->log(self::INFO, $message, $extra);
    }

    /**
     * @param string $message
     * @param array|Traversable $extra
     * @return Logger
     */
    public function debug($message, $extra = array())
    {
        return $this->log(self::DEBUG, $message, $extra);
    }

    /**
     * Register logging system as an error handler to log PHP errors
     *
     * @link http://www.php.net/manual/en/function.set-error-handler.php
     * @param  Logger $logger
     * @return bool
     * @throws Exception\InvalidArgumentException if logger is null
     */
    public static function registerErrorHandler(Logger $logger)
    {
        // Only register once per instance
        if (self::$registeredErrorHandler) {
            return false;
        }

        if ($logger === null) {
            throw new Exception\InvalidArgumentException('Invalid Logger specified');
        }

        $errorHandlerMap = array(
            E_NOTICE            => self::NOTICE,
            E_USER_NOTICE       => self::NOTICE,
            E_WARNING           => self::WARN,
            E_CORE_WARNING      => self::WARN,
            E_USER_WARNING      => self::WARN,
            E_ERROR             => self::ERR,
            E_USER_ERROR        => self::ERR,
            E_CORE_ERROR        => self::ERR,
            E_RECOVERABLE_ERROR => self::ERR,
            E_STRICT            => self::DEBUG,
            E_DEPRECATED        => self::DEBUG,
            E_USER_DEPRECATED   => self::DEBUG
        );

        set_error_handler(function($errno, $errstr, $errfile, $errline, $errcontext) use ($errorHandlerMap, $logger) {
            $errorLevel = error_reporting();

            if ($errorLevel && $errno) {
                if (isset($errorHandlerMap[$errno])) {
                    $priority = $errorHandlerMap[$errno];
                } else {
                    $priority = Logger::INFO;
                }
                $logger->log($priority, $errstr, array(
                    'errno' => $errno,
                    'file' => $errfile,
                    'line' => $errline,
                    'context' => $errcontext
                ));
            }
        });
        self::$registeredErrorHandler = true;
        return true;
    }

    /**
     * Unregister error handler
     *
     */
    public static function unregisterErrorHandler()
    {
        restore_error_handler();
        self::$registeredErrorHandler = false;
    }

    /**
     * Register logging system as an exception handler to log PHP exceptions
     *
     * @link http://www.php.net/manual/en/function.set-exception-handler.php
     * @param Logger $logger
     * @return bool
     * @throws Exception\InvalidArgumentException if logger is null
     */
    public static function registerExceptionHandler(Logger $logger)
    {
        // Only register once per instance
        if (self::$registeredExceptionHandler) {
            return false;
        }

        if ($logger === null) {
            throw new Exception\InvalidArgumentException('Invalid Logger specified');
        }

        set_exception_handler(function ($exception) use ($logger){
            $extra = array(
                'file'  => $exception->getFile(),
                'line'  => $exception->getLine(),
                'trace' => $exception->getTrace()
            );
            if (isset($exception->xdebug_message)) {
                $extra['xdebug'] = $exception->xdebug_message;
            }
            $logger->log(Logger::ERR, $exception->getMessage(), $extra);
        });
        self::$registeredExceptionHandler = true;
        return true;
    }

    /**
     * Unregister exception handler
     */
    public static function unregisterExceptionHandler()
    {
        restore_exception_handler();
        self::$registeredExceptionHandler = false;
    }
}


text:
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.8.6">
  <compounddef id="structboost_1_1geometry_1_1resolve__variant_1_1envelope_3_01boost_1_1variant_3_01_b_o_o_s_t___v_44f5bf0bcbd0141832fe73b1f8f96c7c" kind="struct" prot="public">
    <compoundname>boost::geometry::resolve_variant::envelope< boost::variant< BOOST_VARIANT_ENUM_PARAMS(T)> ></compoundname>
    <includes local="no">interface.hpp</includes>
    <innerclass refid="structboost_1_1geometry_1_1resolve__variant_1_1envelope_3_01boost_1_1variant_3_01_b_o_o_s_t___v_52f3748da33a76e15e969a1b727eff4c" prot="public">boost::geometry::resolve_variant::envelope< boost::variant< BOOST_VARIANT_ENUM_PARAMS(T)> >::visitor</innerclass>
    <templateparamlist>
      <param>
        <type>BOOST_VARIANT_ENUM_PARAMS(typename T)</type>
      </param>
    </templateparamlist>
      <sectiondef kind="public-static-func">
      <memberdef kind="function" id="structboost_1_1geometry_1_1resolve__variant_1_1envelope_3_01boost_1_1variant_3_01_b_o_o_s_t___v_44f5bf0bcbd0141832fe73b1f8f96c7c_1af2173ec38f68593db6f6b3df4b74e6da" prot="public" static="yes" const="no" explicit="no" inline="yes" virt="non-virtual">
        <templateparamlist>
          <param>
            <type>typename Box</type>
          </param>
        </templateparamlist>
        <type>void</type>
        <definition>static void boost::geometry::resolve_variant::envelope< boost::variant< BOOST_VARIANT_ENUM_PARAMS(T)> >::apply</definition>
        <argsstring>(boost::variant< BOOST_VARIANT_ENUM_PARAMS(T)> const &geometry, Box &box)</argsstring>
        <name>apply</name>
        <param>
          <type>boost::variant< BOOST_VARIANT_ENUM_PARAMS(T)> const &</type>
          <declname>geometry</declname>
        </param>
        <param>
          <type>Box &</type>
          <declname>box</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/home/ubuntu/boost/boost/geometry/algorithms/detail/envelope/interface.hpp" line="69" column="1" bodyfile="/home/ubuntu/boost/boost/geometry/algorithms/detail/envelope/interface.hpp" bodystart="69" bodyend="73"/>
      </memberdef>
      </sectiondef>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
    </detaileddescription>
    <location file="/home/ubuntu/boost/boost/geometry/algorithms/detail/envelope/interface.hpp" line="52" column="1" bodyfile="/home/ubuntu/boost/boost/geometry/algorithms/detail/envelope/interface.hpp" bodystart="51" bodyend="74"/>
    <listofallmembers>
      <member refid="structboost_1_1geometry_1_1resolve__variant_1_1envelope_3_01boost_1_1variant_3_01_b_o_o_s_t___v_44f5bf0bcbd0141832fe73b1f8f96c7c_1af2173ec38f68593db6f6b3df4b74e6da" prot="public" virt="non-virtual"><scope>boost::geometry::resolve_variant::envelope< boost::variant< BOOST_VARIANT_ENUM_PARAMS(T)> ></scope><name>apply</name></member>
    </listofallmembers>
  </compounddef>
</doxygen>


text:
export var lightMapUniforms = {
  tLight: { value: null },
  lightMapPower: { value: 1.0 },
  lightMapStrength: { value: 1.0 }
};


text:
"""
sentry.filters.helpers
~~~~~~~~~~~~~~~~~~~~~~

:copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""

# Widget api is pretty ugly
from __future__ import absolute_import

__all__ = ('get_filters',)

import logging

from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from sentry.filters.base import TagFilter
from sentry.plugins import plugins
from sentry.utils.safe import safe_execute

FILTER_CACHE = {}
TAG_FILTER_CACHE = {}

def get_filters(model=None, project=None):
    filter_list = []

    # Add builtins (specified with the FILTERS setting)
    for class_path in settings.SENTRY_FILTERS:
        if class_path not in FILTER_CACHE:
            module_name, class_name = class_path.rsplit('.', 1)
            try:
                module = __import__(module_name, {}, {}, class_name)
                cls = getattr(module, class_name)
            except Exception:
                logger = logging.getLogger('sentry.errors.filters')
                logger.exception('Unable to import %s', class_path)
                continue
            FILTER_CACHE[class_path] = cls
        filter_list.append(FILTER_CACHE[class_path])

    if project:
        for tag in project.get_tags():
            if tag not in TAG_FILTER_CACHE:
                # Generate a new filter class because we are lazy and do
                # not want to rewrite code
                class new(TagFilter):
                    label = _(tag.replace('_', ' ').title())
                    column = tag
                new.__name__ = '__%sGeneratedFilter' % tag.encode('utf8')
                TAG_FILTER_CACHE[tag] = new
            filter_list.append(TAG_FILTER_CACHE[tag])

    # Add plugin-provided filters
    for plugin in plugins.for_project(project):
        results = safe_execute(plugin.get_filters, project)
        if results:
            for filter_cls in results:
                if filter_cls not in filter_list:
                    filter_list.append(filter_cls)

    # yield all filters which support ``model``
    for filter_cls in filter_list:
        yield filter_cls


text:
<?php

namespace AjaxLiveSearch\core;

if (count(get_included_files()) === 1) {
    exit('Direct access not permitted.');
}

/**
 * Class DB
 */
class DB
{
    /**
     * @var \PDO
     */
    private static $db;

    /**
     * @param $dbInfo
     */
    private function __construct($dbInfo)
    {
        try {
            // For MySQL version 5.5.3 or greater you can use 'utf8mb4' encoding instead of 'utf8'
            self::$db = new \PDO(
                'mysql:host=' . $dbInfo['host'] . ';dbname=' . $dbInfo['database'] . ';charset=utf8',
                $dbInfo['username'],
                $dbInfo['pass']
            );

            self::$db->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);

            // To prevent PDO sql injection
            // According to http://stackoverflow.com/a/12202218/2045041
            self::$db->setAttribute(\PDO::ATTR_EMULATE_PREPARES, false);
        } catch (\PDOException $e) {
            echo $e->getMessage();
        }
    }

    /**
     * @param  $dbInfo
     * @return \PDO
     */
    public static function getConnection($dbInfo)
    {
        if (!isset(self::$db)) {
            new self($dbInfo);
        }

        return self::$db;
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    <title>Raphaël FAVERO's blog</title>
    <meta name="description" content="Raphaël FAVERO's blog - Android development and machine learning tutorials" />

    <meta name="HandheldFriendly" content="True" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <link rel="shortcut icon" href="/assets/images/favicon.ico" >

    <link rel="stylesheet" type="text/css" href="/assets/css/screen.css" />
    <link rel="stylesheet" type="text/css"
          href="//fonts.googleapis.com/css?family=Merriweather:300,700,700italic,300italic|Open+Sans:700,400" />
    <link rel="stylesheet" type="text/css" href="/assets/css/syntax.css" />

        <link rel="canonical" href="/" />
    <meta name="referrer" content="origin" />
    <link rel="next" href="/page2/" />

    <meta property="og:site_name" content="Raphaël FAVERO's blog" />
    <meta property="og:type" content="website" />
    <meta property="og:title" content="Raphaël FAVERO's blog" />
    <meta property="og:description" content="Android development and machine learning tutorials" />
    <meta property="og:url" content="/" />
    <meta property="og:image" content="/assets/images/cover1.jpg" />

    <meta name="twitter:card" content="summary_large_image" />
    <meta name="twitter:title" content="Raphaël FAVERO's blog" />
    <meta name="twitter:description" content="Android development and machine learning tutorials" />
    <meta name="twitter:url" content="/" />
    <meta name="twitter:image:src" content="/assets/images/cover1.jpg" />

    <meta name="generator" content="Jekyll 3.0.0" />
    <link rel="alternate" type="application/rss+xml" title="Raphaël FAVERO's blog" href="/rss.xml" />

Menu

        Close

Home

Android

Machine Learning

About

            Menu

Android

			    A 1-post collection

     Page 1 of 1

Creating Your Own Animated Custom View in Android

Even though Android has over 70 built-in views, in many cases you'll want to have something that's not part of the SDK.

Using open-source libraries... »

            Raphaël FAVERO

                on

                       Android

            <time class="post-date" datetime="2015-12-07">07 Dec 2015</time>

     Page 1 of 1

Raphaël FAVERO's blog © 2015

Proudly published with Jekyll using Jasper


text:
require 'em/pg'
require 'em-synchrony'

module Sync
  module EM
    class PG < ::EM::PG

      def self._sync
        f = Fiber.current
        resp = yield
        resp.callback{ |r| f.resume(r) }
        resp.errback{ |r| f.resume(r) }
        o = Fiber.yield
        Exception === o ? raise(o) : o
      end

      def initialize(*args)
        super
        PG._sync{ self }
      end

      [:send_query, :send_prepare, :send_query_prepared, :send_describe_prepared, :send_describe_portal].each do |m|
        define_method(m) do |*args|
          PG._sync{ super(*args) }
        end
      end
    end
  end
end


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Bull. Torrey bot. Club 44: 296 (1917)

#### Original name
Mucor aromaticus Povah, 1917

### Remarks
null


text:
package org.apache.hadoop.mapred;

import java.io.IOException;

import org.apache.hadoop.io.Text;

/**
 * This class is similar to SequenceFileInputFormat,
 * except it generates SequenceFileAsTextRecordReader
 * which converts the input keys and values to their
 * String forms by calling toString() method.
 *
 * @deprecated Use
 * {@link org.apache.hadoop.mapreduce.lib.input.SequenceFileAsTextInputFormat}
 * instead
 */
@Deprecated
public class SequenceFileAsTextInputFormat
  extends SequenceFileInputFormat<Text, Text> {

  public SequenceFileAsTextInputFormat() {
    super();
  }

  public RecordReader<Text, Text> getRecordReader(InputSplit split,
                                                  JobConf job,
                                                  Reporter reporter)
    throws IOException {

    reporter.setStatus(split.toString());

    return new SequenceFileAsTextRecordReader(job, (FileSplit) split);
  }
}


text:
String EventLogger::host = "UNDEFINED";
int EventLogger::port;
TCPClient EventLogger::client;

void EventLogger::discoveredTile(Tile * tile)
{

}

void EventLogger::updateLocation(int facing, int row, int col)
{
    String message = "LOC";
    message.concat("|");
    message.concat(row);
    message.concat(",");
    message.concat(col);
    message.concat("|");
    message.concat(facing);
    message.concat("|");
    Serial.print("Sending Message to ");
    Serial.println(EventLogger::host);

    if(!EventLogger::host.equals("UNDEFINED") && client.connect(const_cast<char*>(EventLogger::host.c_str()),EventLogger::port))
    {
        client.sendData(message);
    }

    client.close();
}

void EventLogger::genericLog(float angle)
{
    String message = "angle: ";
    message.concat(angle);
    if(!EventLogger::host.equals("UNDEFINED") && client.connect(const_cast<char*>(EventLogger::host.c_str()),EventLogger::port))
    {
        client.sendData(message);
    }

    client.close();
}


text:
package bio.terra.cloudres.util;

import static bio.terra.cloudres.testing.MetricsTestUtil.*;
import static bio.terra.cloudres.util.MetricsHelper.CLOUD_RESOURCE_PREFIX;
import static bio.terra.cloudres.util.MetricsHelper.GENERIC_UNKNOWN_ERROR_CODE;

import bio.terra.cloudres.testing.StubCloudOperation;
import io.opencensus.stats.View;
import io.opencensus.tags.TagValue;
import java.time.Duration;
import java.util.Arrays;
import java.util.List;
import java.util.OptionalInt;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

/** Test for {@link MetricsHelper} */
@Tag("unit")
public class MetricsHelperTest {
  private static final List<TagValue> ERROR_401_COUNT =
      Arrays.asList(
          TagValue.create(CLIENT),
          TagValue.create(StubCloudOperation.TEST_OPERATION.name()),
          TagValue.create("401"));
  private static final List<TagValue> ERROR_403_COUNT =
      Arrays.asList(
          TagValue.create(CLIENT),
          TagValue.create(StubCloudOperation.TEST_OPERATION.name()),
          TagValue.create("403"));
  private static final List<TagValue> ERROR_GENERIC_COUNT =
      Arrays.asList(
          TagValue.create(CLIENT),
          TagValue.create(StubCloudOperation.TEST_OPERATION.name()),
          TagValue.create(String.valueOf(GENERIC_UNKNOWN_ERROR_CODE)));

  private static final View.Name LATENCY_VIEW_NAME =
      View.Name.create(CLOUD_RESOURCE_PREFIX + "/cloud/latency");
  private static final View.Name API_VIEW_NAME =
      View.Name.create(CLOUD_RESOURCE_PREFIX + "/cloud/api");
  private static final View.Name ERROR_VIEW_NAME =
      View.Name.create(CLOUD_RESOURCE_PREFIX + "/cloud/error");

  @Test
  public void testRecordApiCount() throws Exception {
    long apiCount = getCurrentCount(API_VIEW_NAME, API_COUNT);
    MetricsHelper.recordApiCount(CLIENT, StubCloudOperation.TEST_OPERATION);
    MetricsHelper.recordApiCount(CLIENT, StubCloudOperation.TEST_OPERATION);
    MetricsHelper.recordApiCount(CLIENT, StubCloudOperation.TEST_OPERATION);
    MetricsHelper.recordApiCount(CLIENT, StubCloudOperation.TEST_OPERATION);

    sleepForSpansExport();

    assertCountIncremented(API_VIEW_NAME, API_COUNT, apiCount, 4);
  }

  @Test
  public void testRecordErrorCount() throws Exception {
    long errorCount403 = getCurrentCount(ERROR_VIEW_NAME, ERROR_403_COUNT);
    long errorCount401 = getCurrentCount(ERROR_VIEW_NAME, ERROR_401_COUNT);
    long errorCountGeneric = getCurrentCount(ERROR_VIEW_NAME, ERROR_GENERIC_COUNT);

    MetricsHelper.recordError(CLIENT, StubCloudOperation.TEST_OPERATION, OptionalInt.of(401));
    MetricsHelper.recordError(CLIENT, StubCloudOperation.TEST_OPERATION, OptionalInt.of(401));
    MetricsHelper.recordError(CLIENT, StubCloudOperation.TEST_OPERATION, OptionalInt.of(401));
    MetricsHelper.recordError(CLIENT, StubCloudOperation.TEST_OPERATION, OptionalInt.of(403));
    MetricsHelper.recordError(CLIENT, StubCloudOperation.TEST_OPERATION, OptionalInt.empty());

    sleepForSpansExport();

    assertCountIncremented(ERROR_VIEW_NAME, ERROR_401_COUNT, errorCount401, 3);
    assertCountIncremented(ERROR_VIEW_NAME, ERROR_403_COUNT, errorCount403, 1);
    assertCountIncremented(ERROR_VIEW_NAME, ERROR_GENERIC_COUNT, errorCountGeneric, 1);
  }

  @Test
  public void testRecordLatency() throws Exception {
    // this is mapped to the Distribution defined in MetricsHelper, i.e.
    // 0ms being within the first bucket & 1 ms in the 2nd.
    final int zeroMsBucketIndex = 0;
    final int oneMsBucketIndex = 1;

    long current0MsCount =
        getCurrentDistributionDataCount(LATENCY_VIEW_NAME, API_COUNT, zeroMsBucketIndex);
    long current1MsCount =
        getCurrentDistributionDataCount(LATENCY_VIEW_NAME, API_COUNT, oneMsBucketIndex);

    MetricsHelper.recordLatency(CLIENT, StubCloudOperation.TEST_OPERATION, Duration.ofMillis(1));
    MetricsHelper.recordLatency(CLIENT, StubCloudOperation.TEST_OPERATION, Duration.ofMillis(1));
    MetricsHelper.recordLatency(CLIENT, StubCloudOperation.TEST_OPERATION, Duration.ofMillis(0));

    sleepForSpansExport();

    // 1 ms,
    assertLatencyCountIncremented(
        LATENCY_VIEW_NAME, API_COUNT, current0MsCount, 1, zeroMsBucketIndex);
    // 2ms
    assertLatencyCountIncremented(
        LATENCY_VIEW_NAME, API_COUNT, current1MsCount, 2, oneMsBucketIndex);
  }
}


text:
<?php
$this->breadcrumbs=array(
    'Program Studis'=>array('index'),
    'Create',
);

$this->menu=array(
    array('label' => Yii::t('app','List Program Studi'), 'url' => array('index')),
    array('label' => Yii::t('app','Manage Program Studi'), 'url' => array('admin')),
);
?>

<?php echo Yii::t('app','Create New Program Studi') ?>

<?php echo $this->renderPartial('_form', array('programStudi'=>$programStudi)); ?>


text:
<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

  <title></title>
  <link rel="stylesheet" href="./css/banner_1.css">

Sometimes referred to as a "maximum benefits cap", this is a cap on the benefits your insurance plan will pay in a calendar year. Caps can be placed on particular services such as medications or hospitalizations. Once the coverage cap has been reached, you are responsible for cost of care provided thereafter, through the end of the year.

This is your share of the cost of healthcare service provided to you. Co-insurance is calculated as a percentage of the amount of a service.

This is the fixed, contracted amount you are required to pay at the time you receive eligible care. Co-pays are due to the healthcare provider at the time of your visit. Co-pay amounts vary depending on your health insurance plan.

This is a manufacturer-sponsored savings that may reduce the out-of-pocket cost for certain medications.

This is your out-of-pocket responsibility for receiving care before your plan coverage takes effect. For example, a $500 deductible is your out-of-pocket share of cost coverage. A deductible will reset beginning each new calendar year of coverage.

This is a summary of that you will receive from your insurance company when they receive a bill for medical services. It will explain the allowable charge, how much they have paid, and the portion that you have to pay.

List of prescription medications covered under the terms of your plan.

The maximum out-of-pocket amount you will pay before the plan you selected will begin to cover 100% of health care services or medication costs.

A monthly amount you pay in order to have health insurance. A premium is typically paid monthly, quarterly, or yearly.

This is approval you must receive from some insurance companies require before they decide if they will pay for certain services, procedures or medications.


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">Memory Leak Demo</string>
    <string name="login">Login</string>
    <string name="start_game">Start game</string>
    <string name="welcome_to_off_game">Welcome FakeName!</string>
    <string name="win_count">win count</string>
</resources>


text:
module ApplicationHelper
  include HtmlBuilder

  def document_title
    if @title.present?
      "#{@title} - Baukis"
    else
      'Baukis'
    end
  end
end


text:
#include <assert.h>
#include <stdlib.h>

#include <dom/html/html_image_element.h>

#include "html/html_document.h"
#include "html/html_image_element.h"

#include "core/node.h"
#include "core/attr.h"
#include "utils/utils.h"

static struct dom_element_protected_vtable _protect_vtable = {
	{
		DOM_NODE_PROTECT_VTABLE_HTML_IMAGE_ELEMENT
	},
	DOM_HTML_IMAGE_ELEMENT_PROTECT_VTABLE
};

/**
 * Create a dom_html_image_element object
 *
 * \param doc  The document object
 * \param ele  The returned element object
 * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
 */
dom_exception _dom_html_image_element_create(struct dom_html_document *doc,
		dom_string *namespace, dom_string *prefix,
		struct dom_html_image_element **ele)
{
	struct dom_node_internal *node;

	*ele = malloc(sizeof(dom_html_image_element));
	if (*ele == NULL)
		return DOM_NO_MEM_ERR;

	/* Set up vtables */
	node = (struct dom_node_internal *) *ele;
	node->base.vtable = &_dom_html_element_vtable;
	node->vtable = &_protect_vtable;

	return _dom_html_image_element_initialise(doc, namespace, prefix, *ele);
}

/**
 * Initialise a dom_html_image_element object
 *
 * \param doc  The document object
 * \param ele  The dom_html_image_element object
 * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
 */
dom_exception _dom_html_image_element_initialise(struct dom_html_document *doc,
		dom_string *namespace, dom_string *prefix,
		struct dom_html_image_element *ele)
{
	return _dom_html_element_initialise(doc, &ele->base,
					    doc->memoised[hds_IMG],
					    namespace, prefix);
}

/**
 * Finalise a dom_html_image_element object
 *
 * \param ele  The dom_html_image_element object
 */
void _dom_html_image_element_finalise(struct dom_html_image_element *ele)
{
	_dom_html_element_finalise(&ele->base);
}

/**
 * Destroy a dom_html_image_element object
 *
 * \param ele  The dom_html_image_element object
 */
void _dom_html_image_element_destroy(struct dom_html_image_element *ele)
{
	_dom_html_image_element_finalise(ele);
	free(ele);
}

/*------------------------------------------------------------------------*/
/* The protected virtual functions */

/* The virtual function used to parse attribute value, see src/core/element.c
 * for detail */
dom_exception _dom_html_image_element_parse_attribute(dom_element *ele,
		dom_string *name, dom_string *value,
		dom_string **parsed)
{
	UNUSED(ele);
	UNUSED(name);

	dom_string_ref(value);
	*parsed = value;

	return DOM_NO_ERR;
}

/* The virtual destroy function, see src/core/node.c for detail */
void _dom_virtual_html_image_element_destroy(dom_node_internal *node)
{
	_dom_html_image_element_destroy((struct dom_html_image_element *) node);
}

/* The virtual copy function, see src/core/node.c for detail */
dom_exception _dom_html_image_element_copy(dom_node_internal *old,
		dom_node_internal **copy)
{
	return _dom_html_element_copy(old, copy);
}

/*-----------------------------------------------------------------------*/
/* API functions */

#define SIMPLE_GET(attr)						\
	dom_exception dom_html_image_element_get_##attr(		\
		dom_html_image_element *element,			\
		dom_string **attr)					\
	{								\
		dom_exception ret;					\
		dom_string *_memo_##attr;				\
									\
		_memo_##attr =						\
			((struct dom_html_document *)			\
			 ((struct dom_node_internal *)element)->owner)->\
			memoised[hds_##attr];				\
									\
		ret = dom_element_get_attribute(element, _memo_##attr, attr); \
									\
		return ret;						\
	}
#define SIMPLE_SET(attr)						\
dom_exception dom_html_image_element_set_##attr(			\
		dom_html_image_element *element,			\
		dom_string *attr)					\
	{								\
		dom_exception ret;					\
		dom_string *_memo_##attr;				\
									\
		_memo_##attr =						\
			((struct dom_html_document *)			\
			 ((struct dom_node_internal *)element)->owner)->\
			memoised[hds_##attr];				\
									\
		ret = dom_element_set_attribute(element, _memo_##attr, attr); \
									\
		return ret;						\
	}

#define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr)

SIMPLE_GET_SET(name);
SIMPLE_GET_SET(align);
SIMPLE_GET_SET(alt);
SIMPLE_GET_SET(border);
SIMPLE_GET_SET(long_desc);
SIMPLE_GET_SET(src);
SIMPLE_GET_SET(use_map);

dom_exception dom_html_image_element_get_height(
	dom_html_image_element *image, int32_t *height)
{
	return dom_html_element_get_int32_t_property(&image->base, "height",
			SLEN("height"), height);
}

dom_exception dom_html_image_element_set_height(
	dom_html_image_element *image, uint32_t height)
{
	return dom_html_element_set_int32_t_property(&image->base, "height",
			SLEN("height"), height);
}

dom_exception dom_html_image_element_get_hspace(
	dom_html_image_element *image, int32_t *hspace)
{
	return dom_html_element_get_int32_t_property(&image->base, "hspace",
			SLEN("hspace"), hspace);
}

dom_exception dom_html_image_element_set_hspace(
	dom_html_image_element *image, uint32_t hspace)
{
	return dom_html_element_set_int32_t_property(&image->base, "hspace",
			SLEN("hspace"), hspace);
}

dom_exception dom_html_image_element_get_vspace(
	dom_html_image_element *image, int32_t *vspace)
{
	return dom_html_element_get_int32_t_property(&image->base, "vspace",
			SLEN("cspace"), vspace);
}

dom_exception dom_html_image_element_set_vspace(
	dom_html_image_element *image, uint32_t vspace)
{
	return dom_html_element_set_int32_t_property(&image->base, "vspace",
			SLEN("vsapce"), vspace);
}

dom_exception dom_html_image_element_get_width(
	dom_html_image_element *image, int32_t *width)
{
	return dom_html_element_get_int32_t_property(&image->base, "width",
			SLEN("width"), width);
}

dom_exception dom_html_image_element_set_width(
	dom_html_image_element *image, uint32_t width)
{
	return dom_html_element_set_int32_t_property(&image->base, "width",
			SLEN("width"), width);
}

/**
 * Get the is_map property
 *
 * \param ele		The dom_html_image_element object
 * \param is_map	The status
 * \return 		DOM_NO_ERR on success, appropriate dom_exception on failure.
 */
dom_exception dom_html_image_element_get_is_map(dom_html_image_element *ele,
				                bool *is_map)
{
	return dom_html_element_get_bool_property(&ele->base, "ismap",
			SLEN("ismap"), is_map);
}

/**
 * Set the is_map property
 *
 * \param ele		The dom_html_image_element object
 * \param is_map	The status
 * \return 		DOM_NO_ERR on success, appropriate dom_exception on failure.
 */
dom_exception dom_html_image_element_set_is_map(dom_html_image_element *ele,
				                bool is_map)
{
	return dom_html_element_set_bool_property(&ele->base, "ismap",
			SLEN("ismap"), is_map);
}


text:
/**
 * This submodule contains the classes to manage the render extension's xml and some utility functions.
 * It adds the ability to save the styles and colors used in an SBGN map, as features like background-color,
 * border thickness or font properties are not part of the SBGN standard.
 *
 * It is loosely based on the {@link http://sbml.org/Documents/Specifications/SBML_Level_3/Packages/render|render extension of the SBML format}.
 * A subset of this specification has been adapted for SBGN-ML integration.
 *
 * See {@link Extension} for more general information on extensions in the SBGN-ML format.
 *
 * You can access the following classes like this: libsbgn.render.ColorDefinition
 *
 * @module libsbgn-render
 * @namespace libsbgn.render
*/

var utils = require('./utilities');
var checkParams = utils.checkParams;
var xml2js = require('xml2js');

var ns = {};

ns.xmlns = "http://www.sbml.org/sbml/level3/version1/render/version1";

// ------- COLORDEFINITION -------
/**
 * Represents the <colorDefinition> element.
 * @class
 * @param {Object} params
 * @param {string=} params.id
 * @param {string=} params.value
 */
var ColorDefinition = function(params) {
	var params = checkParams(params, ['id', 'value']);
	this.id 	= params.id;
	this.value 	= params.value;
};

/**
 * @return {Object} - xml2js formatted object
 */
ColorDefinition.prototype.buildJsObj = function () {
	var colordefObj = {};

	// attributes
	var attributes = {};
	if(this.id != null) {
		attributes.id = this.id;
	}
	if(this.value != null) {
		attributes.value = this.value;
	}
	utils.addAttributes(colordefObj, attributes);
	return colordefObj;
};

/**
 * @return {string}
 */
ColorDefinition.prototype.toXML = function () {
	return utils.buildString({colorDefinition: this.buildJsObj()})
};

/**
 * @param {String} string
 * @return {ColorDefinition}
 */
ColorDefinition.fromXML = function (string) {
	var colorDefinition;
	function fn (err, result) {
        colorDefinition = ColorDefinition.fromObj(result);
    };
    utils.parseString(string, fn);
    return colorDefinition;
};

/**
 * @param {Object} jsObj - xml2js formatted object
 * @return {ColorDefinition}
 */
ColorDefinition.fromObj = function (jsObj) {
	if (typeof jsObj.colorDefinition == 'undefined') {
		throw new Error("Bad XML provided, expected tagName colorDefinition, got: " + Object.keys(jsObj)[0]);
	}

	var colorDefinition = new ns.ColorDefinition();
	jsObj = jsObj.colorDefinition;
	if(typeof jsObj != 'object') { // nothing inside, empty xml
		return colorDefinition;
	}

	if(jsObj.$) { // we have some attributes
		var attributes = jsObj.$;
		colorDefinition.id = attributes.id || null;
		colorDefinition.value = attributes.value || null;
	}
	return colorDefinition;
};

ns.ColorDefinition = ColorDefinition;
// ------- END COLORDEFINITION -------

// ------- LISTOFCOLORDEFINITIONS -------
/**
 * Represents the <listOfColorDefinitions> element.
 * @class
 */
var ListOfColorDefinitions = function () {
	this.colorDefinitions = [];
	this.colorIndex = {};
};

/**
 * @param {ColorDefinition} colorDefinition
 */
ListOfColorDefinitions.prototype.addColorDefinition = function (colorDefinition) {
	this.colorDefinitions.push(colorDefinition);
	this.colorIndex[colorDefinition.id] = colorDefinition.value;
};

/**
 * Convenient method to get a color value directly.
 * @param {string} id
 * @return {string}
 */
ListOfColorDefinitions.prototype.getColorById = function (id) {
	return this.colorIndex[id];
};

/**
 * Convenient method to get all the color values in the list.
 * @return {string[]}
 */
ListOfColorDefinitions.prototype.getAllColors = function () {
	return Object.values(this.colorIndex);
};

/**
 * @return {Object} - xml2js formatted object
 */
ListOfColorDefinitions.prototype.buildJsObj = function () {
	var listOfColorDefinitionsObj = {};

	for(var i=0; i < this.colorDefinitions.length; i++) {
		if (i==0) {
			listOfColorDefinitionsObj.colorDefinition = [];
		}
		listOfColorDefinitionsObj.colorDefinition.push(this.colorDefinitions[i].buildJsObj());
	}

	return listOfColorDefinitionsObj;
};

/**
 * @return {string}
 */
ListOfColorDefinitions.prototype.toXML = function () {
	return utils.buildString({listOfColorDefinitions: this.buildJsObj()})
};

/**
 * @param {String} string
 * @return {ListOfColorDefinitions}
 */
ListOfColorDefinitions.fromXML = function (string) {
	var listOfColorDefinitions;
	function fn (err, result) {
        listOfColorDefinitions = ListOfColorDefinitions.fromObj(result);
    };
    utils.parseString(string, fn);
    return listOfColorDefinitions;
};

/**
 * @param {Object} jsObj - xml2js formatted object
 * @return {ListOfColorDefinitions}
 */
ListOfColorDefinitions.fromObj = function (jsObj) {
	if (typeof jsObj.listOfColorDefinitions == 'undefined') {
		throw new Error("Bad XML provided, expected tagName listOfColorDefinitions, got: " + Object.keys(jsObj)[0]);
	}

	var listOfColorDefinitions = new ns.ListOfColorDefinitions();
	jsObj = jsObj.listOfColorDefinitions;
	if(typeof jsObj != 'object') { // nothing inside, empty xml
		return listOfColorDefinitions;
	}

	// children
	if(jsObj.colorDefinition) {
		var colorDefinitions = jsObj.colorDefinition;
		for (var i=0; i < colorDefinitions.length; i++) {
			var colorDefinition = ns.ColorDefinition.fromObj({colorDefinition: colorDefinitions[i]});
			listOfColorDefinitions.addColorDefinition(colorDefinition);
		}
	}

	return listOfColorDefinitions;
};

ns.ListOfColorDefinitions = ListOfColorDefinitions;
// ------- END LISTOFCOLORDEFINITIONS -------

// ------- RENDERGROUP -------
/**
 * Represents the <g> element.
 * @class
 * @param {Object} params
 * @param {string=} params.id
 * @param {string=} params.fontSize
 * @param {string=} params.fontFamily
 * @param {string=} params.fontWeight
 * @param {string=} params.fontStyle
 * @param {string=} params.fontColor
 * @param {string=} params.textAnchor
 * @param {string=} params.vtextAnchor
 * @param {string=} params.fill The element's background color
 * @param {string=} params.stroke Border color for glyphs, line color for arcs.
 * @param {string=} params.strokeWidth
 * @param {string=} params.backgroundImage
 * @param {string=} params.backgroundFit
 * @param {string=} params.backgroundPosX
 * @param {string=} params.backgroundPosY
 * @param {string=} params.backgroundWidth
 * @param {string=} params.backgroundHeight
 * @param {string=} params.backgroundImageOpacity
 * @param {string=} params.backgroundOpacity
 */
var RenderGroup = function (params) {
	// each of those are optional, so test if it is defined is mandatory
	var params = checkParams(params, ['fontSize', 'fontFamily', 'fontWeight',
		'fontStyle', 'fontColor', 'textAnchor', 'vtextAnchor', 'fill', 'id', 'stroke', 'strokeWidth', 'backgroundImage',
		'backgroundFit', 'backgroundPosX', 'backgroundPosY', 'backgroundWidth', 'backgroundHeight', 'backgroundImageOpacity','backgroundOpacity' ]);
	// specific to renderGroup
	this.fontSize 		= params.fontSize;
	this.fontFamily 	= params.fontFamily;
	this.fontWeight 	= params.fontWeight;
	this.fontStyle 		= params.fontStyle;
	this.fontColor		= params.fontColor;
	this.textAnchor 	= params.textAnchor; // probably useless
	this.vtextAnchor 	= params.vtextAnchor; // probably useless
	// from GraphicalPrimitive2D
	this.fill 			= params.fill; // fill color
	// from GraphicalPrimitive1D
	this.id 			= params.id;
	this.stroke 		= params.stroke; // stroke color
	this.strokeWidth 	= params.strokeWidth;
	this.backgroundImage = params.backgroundImage;
	this.backgroundFit = params.backgroundFit;
	this.backgroundPosX = params.backgroundPosX;
	this.backgroundPosY = params.backgroundPosY;
	this.backgroundWidth = params.backgroundWidth;
	this.backgroundHeight = params.backgroundHeight;
	this.backgroundImageOpacity = params.backgroundImageOpacity;
	this.backgroundOpacity = params.backgroundOpacity;
};

/**
 * @return {Object} - xml2js formatted object
 */
RenderGroup.prototype.buildJsObj = function () {
	var renderGroupObj = {};

	// attributes
	var attributes = {};
	if(this.id != null) {
		attributes.id = this.id;
	}
	if(this.fontSize != null) {
		attributes.fontSize = this.fontSize;
	}
	if(this.fontFamily != null) {
		attributes.fontFamily = this.fontFamily;
	}
	if(this.fontWeight != null) {
		attributes.fontWeight = this.fontWeight;
	}
	if(this.fontStyle != null) {
		attributes.fontStyle = this.fontStyle;
	}
	if (this.fontColor != null) {
		attributes.fontColor = this.fontColor;
	}
	if(this.textAnchor != null) {
		attributes.textAnchor = this.textAnchor;
	}
	if(this.vtextAnchor != null) {
		attributes.vtextAnchor = this.vtextAnchor;
	}
	if(this.stroke != null) {
		attributes.stroke = this.stroke;
	}
	if(this.strokeWidth != null) {
		attributes.strokeWidth = this.strokeWidth;
	}
	if(this.fill != null) {
		attributes.fill = this.fill;
	}
	if(this.backgroundImage != null) {
		attributes.backgroundImage = this.backgroundImage;
	}
	if(this.backgroundFit != null) {
		attributes.backgroundFit = this.backgroundFit;
	}
	if(this.backgroundPosX != null) {
		attributes.backgroundPosX = this.backgroundPosX;
	}
	if(this.backgroundPosY != null) {
		attributes.backgroundPosY = this.backgroundPosY;
	}
	if(this.backgroundWidth != null) {
		attributes.backgroundWidth = this.backgroundWidth;
	}
	if(this.backgroundHeight != null) {
		attributes.backgroundHeight = this.backgroundHeight;
	}
	if(this.backgroundImageOpacity != null) {
		attributes.backgroundImageOpacity = this.backgroundImageOpacity;
	}
	if(this.backgroundOpacity != null) {
		attributes.backgroundOpacity = this.backgroundOpacity;
	}
	utils.addAttributes(renderGroupObj, attributes);
	return renderGroupObj;
};

/**
 * @return {string}
 */
RenderGroup.prototype.toXML = function () {
	return utils.buildString({g: this.buildJsObj()})
};

/**
 * @param {String} string
 * @return {RenderGroup}
 */
RenderGroup.fromXML = function (string) {
	var g;
	function fn (err, result) {
        g = RenderGroup.fromObj(result);
    };
    utils.parseString(string, fn);
    return g;
};

/**
 * @param {Object} jsObj - xml2js formatted object
 * @return {RenderGroup}
 */
RenderGroup.fromObj = function (jsObj) {
	if (typeof jsObj.g == 'undefined') {
		throw new Error("Bad XML provided, expected tagName g, got: " + Object.keys(jsObj)[0]);
	}

	var g = new ns.RenderGroup();
	jsObj = jsObj.g;
	if(typeof jsObj != 'object') { // nothing inside, empty xml
		return g;
	}

	if(jsObj.$) { // we have some attributes
		var attributes = jsObj.$;
		g.id 					 = attributes.id || null;
		g.fontSize 				 = attributes.fontSize || null;
		g.fontFamily 			 = attributes.fontFamily || null;
		g.fontWeight 			 = attributes.fontWeight || null;
		g.fontStyle 			 = attributes.fontStyle || null;
		g.fontColor				 = attributes.fontColor || null;
		g.textAnchor 			 = attributes.textAnchor || null;
		g.vtextAnchor 			 = attributes.vtextAnchor || null;
		g.stroke 				 = attributes.stroke || null;
		g.strokeWidth			 = attributes.strokeWidth || null;
		g.fill 					 = attributes.fill || null;
		g.backgroundImage 		 = attributes.backgroundImage || null;
		g.backgroundFit 		 = attributes.backgroundFit || null;
		g.backgroundPosX 		 = attributes.backgroundPosX || null;
		g.backgroundPosY 		 = attributes.backgroundPosY || null;
		g.backgroundWidth 		 = attributes.backgroundWidth || null;
		g.backgroundHeight 		 = attributes.backgroundHeight || null;
		g.backgroundImageOpacity = attributes.backgroundImageOpacity || null;
		g.backgroundOpacity = attributes.backgroundOpacity || null;
	}
	return g;
};

ns.RenderGroup = RenderGroup;
// ------- END RENDERGROUP -------

// ------- STYLE -------
/**
 * Represents the <style> element.
 * @class
 * @param {Object} params
 * @param {string=} params.id
 * @param {string=} params.name
 * @param {string=} params.idList
 * @param {RenderGroup=} params.renderGroup
 */
var Style = function(params) {
	var params = checkParams(params, ['id', 'name', 'idList', 'renderGroup']);
	this.id 			= params.id;
	this.name 			= params.name;
	this.idList 		= params.idList; // TODO add utility functions to manage this (should be array)
	this.renderGroup 	= params.renderGroup;
};

/**
 * @param {RenderGroup} renderGroup
 */
Style.prototype.setRenderGroup = function (renderGroup) {
	this.renderGroup = renderGroup;
};

/**
 * @return {string[]}
 */
Style.prototype.getIdListAsArray = function () {
	return this.idList.split(' ');
}

/**
 * @param {string[]} idArray
 */
Style.prototype.setIdListFromArray = function (idArray) {
	this.idList = idArray.join(' ');
}

/**
 * Convenience function returning a map of ids to their respective RenderGroup object.
 * The style properties can then be directly accessed. Example: map[id].stroke
 * @return {Object.<string, RenderGroup>}
 */
Style.prototype.getStyleMap = function () {
	var index = {};
	var ids = this.getIdListAsArray();
	for(var i=0; i < ids.length; i++) {
		var id = ids[i];
		index[id] = this.renderGroup;
	}
	return index;
};
/**
 * @return {Object} - xml2js formatted object
 */
Style.prototype.buildJsObj = function () {
	var styleObj = {};

	// attributes
	var attributes = {};
	if(this.id != null) {
		attributes.id = this.id;
	}
	if(this.name != null) {
		attributes.name = this.name;
	}
	if(this.idList != null) {
		attributes.idList = this.idList;
	}
	utils.addAttributes(styleObj, attributes);

	// children
	if(this.renderGroup != null) {
		styleObj.g =  this.renderGroup.buildJsObj();
	}
	return styleObj;
};

/**
 * @return {string}
 */
Style.prototype.toXML = function () {
	return utils.buildString({style: this.buildJsObj()})
};

/**
 * @param {String} string
 * @return {Style}
 */
Style.fromXML = function (string) {
	var style;
	function fn (err, result) {
        style = Style.fromObj(result);
    };
    utils.parseString(string, fn);
    return style;
};

/**
 * @param {Object} jsObj - xml2js formatted object
 * @return {Style}
 */
Style.fromObj = function (jsObj) {
	if (typeof jsObj.style == 'undefined') {
		throw new Error("Bad XML provided, expected tagName style, got: " + Object.keys(jsObj)[0]);
	}

	var style = new ns.Style();
	jsObj = jsObj.style;
	if(typeof jsObj != 'object') { // nothing inside, empty xml
		return style;
	}

	if(jsObj.$) { // we have some attributes
		var attributes = jsObj.$;
		style.id = attributes.id || null;
		style.name = attributes.name || null;
		style.idList = attributes.idList || null;
	}

	// children
	if(jsObj.g) {
		var g = ns.RenderGroup.fromObj({g: jsObj.g[0]});
		style.setRenderGroup(g);
	}

	return style;
};

ns.Style = Style;
// ------- END STYLE -------

// ------- LISTOFSTYLES -------
/**
 * Represents the <listOfStyles> element.
 * @class
 */
var ListOfStyles = function() {
	this.styles = [];
};

/**
 * @param {Style} style
 */
ListOfStyles.prototype.addStyle = function (style) {
	this.styles.push(style);
};

/**
 * Convenience function returning a map of ids to their respective RenderGroup object,
 * for all the styles.
 * The style properties can then be directly accessed. Example: map[id].stroke
 * @return {Object.<string, RenderGroup>}
 */
ListOfStyles.prototype.getStyleMap = function () {
	var index = {};
	for(var i=0; i < this.styles.length; i++) {
		var style = this.styles[i];
		var subIndex = style.getStyleMap();
		for(var id in subIndex) {
			index[id] = subIndex[id];
		}
	}
	return index;
}

/**
 * @return {Object} - xml2js formatted object
 */
ListOfStyles.prototype.buildJsObj = function () {
	var listOfStylesObj = {};

	for(var i=0; i < this.styles.length; i++) {
		if (i==0) {
			listOfStylesObj.style = [];
		}
		listOfStylesObj.style.push(this.styles[i].buildJsObj());
	}

	return listOfStylesObj;
};

/**
 * @return {string}
 */
ListOfStyles.prototype.toXML = function () {
	return utils.buildString({listOfStyles: this.buildJsObj()})
};

/**
 * @param {String} string
 * @return {ListOfStyles}
 */
ListOfStyles.fromXML = function (string) {
	var listOfStyles;
	function fn (err, result) {
        listOfStyles = ListOfStyles.fromObj(result);
    };
    utils.parseString(string, fn);
    return listOfStyles;
};

/**
 * @param {Object} jsObj - xml2js formatted object
 * @return {ListOfStyles}
 */
ListOfStyles.fromObj = function (jsObj) {
	if (typeof jsObj.listOfStyles == 'undefined') {
		throw new Error("Bad XML provided, expected tagName listOfStyles, got: " + Object.keys(jsObj)[0]);
	}

	var listOfStyles = new ns.ListOfStyles();
	jsObj = jsObj.listOfStyles;
	if(typeof jsObj != 'object') { // nothing inside, empty xml
		return listOfStyles;
	}

	// children
	if(jsObj.style) {
		var styles = jsObj.style;
		for (var i=0; i < styles.length; i++) {
			var style = ns.Style.fromObj({style: styles[i]});
			listOfStyles.addStyle(style);
		}
	}

	return listOfStyles;
};

ns.ListOfStyles = ListOfStyles;
// ------- END LISTOFSTYLES -------
// ------- BACKGROUNDIMAGE -------
/**
 * Represents the <backgroundImage> element.
 * @class
 * @param {Object} params
 * @param {string=} params.id
 * @param {string=} params.value
 */
var BackgroundImage = function(params) {
	var params = checkParams(params, ['id', 'value']);
	this.id 	= params.id;
	this.value 	= params.value;
};

/**
 * @return {Object} - xml2js formatted object
 */
BackgroundImage.prototype.buildJsObj = function () {
	var bgImgObj = {};

	// attributes
	var attributes = {};
	if(this.id != null) {
		attributes.id = this.id;
	}
	if(this.value != null) {
		attributes.value = this.value;
	}
	utils.addAttributes(bgImgObj, attributes);
	return bgImgObj;
};

/**
 * @return {string}
 */
BackgroundImage.prototype.toXML = function () {
	return utils.buildString({backgroundImage: this.buildJsObj()})
};

/**
 * @param {String} string
 * @return {BackgroundImage}
 */
BackgroundImage.fromXML = function (string) {
	var backgroundImage;
	function fn (err, result) {
        backgroundImage = BackgroundImage.fromObj(result);
    };
    utils.parseString(string, fn);
    return backgroundImage;
};

/**
 * @param {Object} jsObj - xml2js formatted object
 * @return {BackgroundImage}
 */
BackgroundImage.fromObj = function (jsObj) {
	if (typeof jsObj.backgroundImage == 'undefined') {
		throw new Error("Bad XML provided, expected tagName backgroundImage, got: " + Object.keys(jsObj)[0]);
	}

	var backgroundImage = new ns.BackgroundImage();
	jsObj = jsObj.backgroundImage;
	if(typeof jsObj != 'object') { // nothing inside, empty xml
		return backgroundImage;
	}

	if(jsObj.$) { // we have some attributes
		var attributes = jsObj.$;
		backgroundImage.id = attributes.id || null;
		backgroundImage.value = attributes.value || null;
	}
	return backgroundImage;
};

ns.BackgroundImage = BackgroundImage;
// ------- END BACKGROUNDIMAGE -------

// ------- LISTOFBACKGROUNDIMAGES -------
/**
 * Represents the <listOfBackgroundImages> element.
 * @class
 */
var ListOfBackgroundImages = function () {
	this.backgroundImages = [];
	this.imageIndex = {};
};

/**
 * @param {BackgroundImage} backgroundImage
 */
ListOfBackgroundImages.prototype.addBackgroundImage = function (backgroundImage) {
	this.backgroundImages.push(backgroundImage);
	this.imageIndex[backgroundImage.id] = backgroundImage.value;
};

/**
 * Convenient method to get a background image value directly.
 * @param {string} id
 * @return {string}
 */
ListOfBackgroundImages.prototype.getBackgroundImageById = function (id) {
	return this.imageIndex[id];
};

/**
 * Convenient method to get all the background image values in the list.
 * @return {string[]}
 */
ListOfBackgroundImages.prototype.getAllImages = function () {
	return Object.values(this.imageIndex);
};

/**
 * @return {Object} - xml2js formatted object
 */
ListOfBackgroundImages.prototype.buildJsObj = function () {
	var listOfBgImagesObj = {};

	for(var i=0; i < this.backgroundImages.length; i++) {
		if (i==0) {
			listOfBgImagesObj.backgroundImage = [];
		}
		listOfBgImagesObj.backgroundImage.push(this.backgroundImages[i].buildJsObj());
	}

	return listOfBgImagesObj;
};

/**
 * @return {string}
 */
ListOfBackgroundImages.prototype.toXML = function () {
	return utils.buildString({listOfBackgroundImages: this.buildJsObj()})
};

/**
 * @param {String} string
 * @return {ListOfBackgroundImages}
 */
ListOfBackgroundImages.fromXML = function (string) {
	var listOfBackgroundImages;
	function fn (err, result) {
        listOfBackgroundImages = ListOfBackgroundImages.fromObj(result);
    };
    utils.parseString(string, fn);
    return listOfBackgroundImages;
};

/**
 * @param {Object} jsObj - xml2js formatted object
 * @return {ListOfBackgroundImages}
 */
ListOfBackgroundImages.fromObj = function (jsObj) {
	if (typeof jsObj.listOfBackgroundImages == 'undefined') {
		throw new Error("Bad XML provided, expected tagName listOfBackgroundImages, got: " + Object.keys(jsObj)[0]);
	}

	var listOfBackgroundImages = new ns.ListOfBackgroundImages();
	jsObj = jsObj.listOfBackgroundImages;
	if(typeof jsObj != 'object') { // nothing inside, empty xml
		return listOfBackgroundImages;
	}

	// children
	if(jsObj.backgroundImage) {
		var backgroundImages = jsObj.backgroundImage;
		for (var i=0; i < backgroundImages.length; i++) {
			var backgroundImage = ns.BackgroundImage.fromObj({backgroundImage: backgroundImages[i]});
			listOfBackgroundImages.addBackgroundImage(backgroundImage);
		}
	}

	return listOfBackgroundImages;
};

ns.ListOfBackgroundImages = ListOfBackgroundImages;
// ------- END LISTOFBACKGROUNDIMAGES -------
// ------- RENDERINFORMATION -------
/**
 * Represents the <renderInformation> element.
 * @class
 * @param {Object} params
 * @param {string=} params.id
 * @param {string=} params.name
 * @param {string=} params.programName
 * @param {string=} params.programVersion
 * @param {string=} params.backgroundColor
 * @param {ListOfColorDefinitions=} params.listOfColorDefinitions
 * @param {ListOfStyles=} params.listOfStyles
 * @param {ListOfBackgroundImages=} params.listOfBackgroundImages
 */
var RenderInformation = function (params) {
	var params = checkParams(params, ['id', 'name', 'programName',
		'programVersion', 'backgroundColor', 'listOfColorDefinitions', 'listOfStyles', 'listOfBackgroundImages']);
	this.id 					= params.id; // required, rest is optional
	this.name 					= params.name;
	this.programName 			= params.programName;
	this.programVersion 		= params.programVersion;
	this.backgroundColor 		= params.backgroundColor;
	this.listOfColorDefinitions = params.listOfColorDefinitions;
	this.listOfStyles 			= params.listOfStyles;
	this.listOfBackgroundImages = params.listOfBackgroundImages;
};

/**
 * @param {ListOfColorDefinitions} listOfColorDefinitions
 */
RenderInformation.prototype.setListOfColorDefinitions = function(listOfColorDefinitions) {
	this.listOfColorDefinitions = listOfColorDefinitions;
};

/**
 * @param {ListOfStyles} listOfStyles
 */
RenderInformation.prototype.setListOfStyles = function(listOfStyles) {
	this.listOfStyles = listOfStyles;
};

/**
 * @param {ListOfBackgroundImages} listOfBackgroundImages
 */
RenderInformation.prototype.setListOfBackgroundImages = function(listOfBackgroundImages) {
	this.listOfBackgroundImages = listOfBackgroundImages;
};

/**
 * @return {Object} - xml2js formatted object
 */
RenderInformation.prototype.buildJsObj = function () {
	var renderInformationObj = {};

	// attributes
	var attributes = {};
	attributes.xmlns = ns.xmlns;
	if(this.id != null) {
		attributes.id = this.id;
	}
	if(this.name != null) {
		attributes.name = this.name;
	}
	if(this.programName != null) {
		attributes.programName = this.programName;
	}
	if(this.programVersion != null) {
		attributes.programVersion = this.programVersion;
	}
	if(this.backgroundColor != null) {
		attributes.backgroundColor = this.backgroundColor;
	}
	utils.addAttributes(renderInformationObj, attributes);

	// children
	if(this.listOfColorDefinitions != null) {
		renderInformationObj.listOfColorDefinitions =  this.listOfColorDefinitions.buildJsObj();
	}
	if(this.listOfBackgroundImages != null) {
		renderInformationObj.listOfBackgroundImages =  this.listOfBackgroundImages.buildJsObj();
	}
	if(this.listOfStyles != null) {
		renderInformationObj.listOfStyles =  this.listOfStyles.buildJsObj();
	}
	return renderInformationObj;
};

/**
 * @return {string}
 */
RenderInformation.prototype.toXML = function() {
	return utils.buildString({renderInformation: this.buildJsObj()})
};

/**
 * @param {String} string
 * @return {RenderInformation}
 */
RenderInformation.fromXML = function (string) {
	var renderInformation;
	function fn (err, result) {
        renderInformation = RenderInformation.fromObj(result);
    };
    utils.parseString(string, fn);
    return renderInformation;
};

/**
 * @param {Object} jsObj - xml2js formatted object
 * @return {RenderInformation}
 */
RenderInformation.fromObj = function (jsObj) {
	if (typeof jsObj.renderInformation == 'undefined') {
		throw new Error("Bad XML provided, expected tagName renderInformation, got: " + Object.keys(jsObj)[0]);
	}

	var renderInformation = new ns.RenderInformation();
	jsObj = jsObj.renderInformation;
	if(typeof jsObj != 'object') { // nothing inside, empty xml
		return renderInformation;
	}

	if(jsObj.$) { // we have some attributes
		var attributes = jsObj.$;
		renderInformation.id 				= attributes.id || null;
		renderInformation.name 				= attributes.name || null;
		renderInformation.programName 		= attributes.programName || null;
		renderInformation.programVersion 	= attributes.programVersion || null;
		renderInformation.backgroundColor 	= attributes.backgroundColor || null;
	}

	// children
	if(jsObj.listOfColorDefinitions) {
		var listOfColorDefinitions = ns.ListOfColorDefinitions.fromObj({listOfColorDefinitions: jsObj.listOfColorDefinitions[0]});
		renderInformation.setListOfColorDefinitions(listOfColorDefinitions);
	}
	if(jsObj.listOfStyles) {
		var listOfStyles = ns.ListOfStyles.fromObj({listOfStyles: jsObj.listOfStyles[0]});
		renderInformation.setListOfStyles(listOfStyles);
	}
	if(jsObj.listOfBackgroundImages) {
		var listOfBackgroundImages = ns.ListOfBackgroundImages.fromObj({listOfBackgroundImages: jsObj.listOfBackgroundImages[0]});
		renderInformation.setListOfBackgroundImages(listOfBackgroundImages);
	}
	return renderInformation;
};

ns.RenderInformation = RenderInformation;
// ------- END RENDERINFORMATION -------

module.exports = ns;


text:
/**
 * @fileoverview Methods for dragging a flyout visually.
 * @author fenichel@google.com (Rachel Fenichel)
 */
'use strict';

goog.provide('Blockly.FlyoutDragger');

goog.require('Blockly.utils.object');
goog.require('Blockly.WorkspaceDragger');

/**
 * Class for a flyout dragger.  It moves a flyout workspace around when it is
 * being dragged by a mouse or touch.
 * Note that the workspace itself manages whether or not it has a drag surface
 * and how to do translations based on that.  This simply passes the right
 * commands based on events.
 * @param {!Blockly.Flyout} flyout The flyout to drag.
 * @extends {Blockly.WorkspaceDragger}
 * @constructor
 */
Blockly.FlyoutDragger = function(flyout) {
  Blockly.FlyoutDragger.superClass_.constructor.call(this,
      flyout.getWorkspace());

  /**
   * The scrollbar to update to move the flyout.
   * Unlike the main workspace, the flyout has only one scrollbar, in either the
   * horizontal or the vertical direction.
   * @type {!Blockly.Scrollbar}
   * @private
   */
  this.scrollbar_ = flyout.scrollbar_;

  /**
   * Whether the flyout scrolls horizontally.  If false, the flyout scrolls
   * vertically.
   * @type {boolean}
   * @private
   */
  this.horizontalLayout_ = flyout.horizontalLayout_;
};
Blockly.utils.object.inherits(Blockly.FlyoutDragger, Blockly.WorkspaceDragger);

/**
 * Move the flyout based on the most recent mouse movements.
 * @param {!Blockly.utils.Coordinate} currentDragDeltaXY How far the pointer has
 *     moved from the position at the start of the drag, in pixel coordinates.
 * @package
 */
Blockly.FlyoutDragger.prototype.drag = function(currentDragDeltaXY) {
  // startScrollXY_ is assigned by the superclass.
  var newXY = Blockly.utils.Coordinate.sum(this.startScrollXY_,
      currentDragDeltaXY);

  // We can't call workspace.scroll because the flyout's workspace doesn't own
  // it's own scrollbars. This is because (as of 2.20190722.1) the
  // workspace's scrollbar property must be a scrollbar pair, rather than a
  // single scrollbar.
  // Instead we'll just expect setting the scrollbar to update the scroll of
  // the workspace as well.
  if (this.horizontalLayout_) {
    this.scrollbar_.set(-newXY.x);
  } else {
    this.scrollbar_.set(-newXY.y);
  }
};


text:
var request = require('supertest')
  , express = require('express')
  , createServiceLocator = require('service-locator')
  , healthCheck = require('../init')
  , mockdate = require('mockdate')

function makeCheck (output) {
  return function check (cb) {
    cb(null, output)
  }
}

function errorFn (cb) {
  cb(new Error('Oops'))
}

describe('health-check', function () {

  before(function () {
    mockdate.set(Date.now())
  })

  after(function () {
    mockdate.reset()
  })

  it('should 200 with empty array without registered checks', function (done) {

    var server = express()
      , sl = createServiceLocator()
      sl.register('router', server)

    healthCheck().healthCheck(sl, function () {

      request(server)
        .get('/_health')
        .expect('Content-Type', /json/)
        .expect({ results: {}, summary: { total: { fail: 0, pass: 0, count: 0 } } })
        .expect(200, done)

    })

  })

  it('should 200 and include check output', function (done) {

    var server = express()
      , sl = createServiceLocator()
      sl.register('router', server)

    healthCheck().healthCheck(sl, function () {
      sl.healthCheck.register('critical', { name: 'My test', description: 'checks stuff', fn: makeCheck('OK') })
      request(server)
        .get('/_health')
        .expect('Content-Type', /json/)
        .expect({ results:
          { critical: [ { name: 'My test', description: 'checks stuff', status: 'OK', time: 0 } ] }
          , summary: { total: { fail: 0, pass: 1, count: 1 }, critical: { fail: 0, pass: 1, count: 1 } }
          })
        .expect(200, done)
    })

  })

  it('should 500 if any critical checks fails', function (done) {

    var server = express()
      , sl = createServiceLocator()
      sl.register('router', server)

    healthCheck().healthCheck(sl, function () {
      sl.healthCheck.register('critical'
        , { name: 'Error test', description: 'this is going to break', fn: errorFn })

      sl.healthCheck.register('critical'
        , { name: 'My test', description: 'checks stuff', fn: makeCheck('OK') })

      request(server)
        .get('/_health')
        .expect('Content-Type', /json/)
        .expect(
          { results:
            { critical:
              [ { name: 'Error test', description: 'this is going to break', status: 'Error', error: 'Oops', time: 0 }
              , { name: 'My test', description: 'checks stuff', status: 'OK', time: 0 } ]
            }
          , summary: { total: { fail: 1, pass: 1, count: 2 }, critical: { fail: 1, pass: 1, count: 2 } }
          })
        .expect(500, done)
    })

  })

  it('should 200 of critical pass but warnings fail', function (done) {

    var server = express()
      , sl = createServiceLocator()
      sl.register('router', server)

    healthCheck().healthCheck(sl, function () {
      sl.healthCheck.register('warning'
        , { name: 'Error test', description: 'this is going to break', fn: errorFn })

      sl.healthCheck.register('critical'
        , { name: 'My test', description: 'checks stuff', fn: makeCheck('OK') })

      request(server)
        .get('/_health')
        .expect('Content-Type', /json/)
        .expect(
          { results:
            { critical:
              [ { name: 'My test', description: 'checks stuff', status: 'OK', time: 0 } ]
            , warning:
              [ { name: 'Error test', description: 'this is going to break', status: 'Error', error: 'Oops', time: 0 } ]
            }
          , summary:
            { total: { fail: 1, pass: 1, count: 2 }
            , critical: { fail: 0, pass: 1, count: 1 }
            , warning: { fail: 1, pass: 0, count: 1 }
            }
          })
        .expect(200, done)
    })

  })
})


text:
EtuUTT
======

Qu'est ce que c'est ?
---------------------

EtuUTT est la refonte de 2013 du site internet étudiant de l'UTT
(http://etu.utt.fr). Elle a pour vocation d'améliorer les performances,
la qualité du code et l'aspect esthétique. Cette refonte n'utilise pas
le code de l'ancienne version.

Cette documentation a pour but d'expliquer le fonctionnement interne
de EtuUTT, comment ajouter un module et comment modifier le coeur du site.

Une bonne connaissance de Symfony 2 est requise, avant toute modification du
code. Pour apprendre, tournez-vous vers la documentation officielle en
anglais (http://symfony.com/doc/current/book/index.html) ou vers les tutoriels
nombreux sur internet.

Cette documentation est écrite en français, contrairement aux commmentaires
dans le code, par soucis de simplicité et de diffusion.

L'ordre conseillé pour débuter la lecture est :

1. Les tutoriels, qui posent les bases du fonctionnement des modules ;
2. La référence, pour connaitre et comprendre les fonctionnalités offertes
	par les bundles de base ;
3. Le fonctionnement interne, qui n'est pas obligatoire mais qui permet de
	comprendre comment fonctionne EtuUTT et qui permet donc de modifier son
	coeur si nécessaire ;

Elle a été écrite par Titouan Galopin.

> **Note :** EtuUTT utilise Symfony 2.3 (LTS)


text:
namespace Contracts.JenkinsApi
{
    public class HealthReport
    {
        public string Description { get; set; }
        public string IconClassName { get; set; }
        public string IconUrl { get; set; }
        public int Score { get; set; }
    }
}


text:
package com.todo.controller;

import com.fasterxml.jackson.annotation.JsonView;
import com.todo.entity.Todo;
import com.todo.service.todo.TodoService;
import com.todo.utils.Constants;
import com.todo.utils.jackson.View;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created by Snayki on 16.03.2016.
 */
@RestController
@RequestMapping("/api/todo")
public class TodoController {

    @Autowired
    private TodoService todoService;

    @JsonView(View.Public.class)
    @RequestMapping(method = RequestMethod.GET)
    public List<Todo> getAll() {
        return todoService.findAll();
    }

    @JsonView(View.Public.class)
    @RequestMapping(value = "/{"+ Constants.TODO_ID_PARAM +"}", method = RequestMethod.GET)
    public Todo getById(@PathVariable(value = Constants.TODO_ID_PARAM) Integer id) {
        return todoService.findById(id);
    }

    @JsonView(View.Public.class)
    @RequestMapping(method = RequestMethod.POST)
    public Todo create(@RequestBody Todo todo) {
        return todoService.create(todo);
    }

    @JsonView(View.Public.class)
    @RequestMapping(value = "/{"+ Constants.TODO_ID_PARAM +"}", method = RequestMethod.PUT)
    public Todo update(@RequestBody Todo todo) {
        return todoService.update(todo);
    }

    @RequestMapping(value = "/{"+ Constants.TODO_ID_PARAM +"}", method = RequestMethod.DELETE)
    public void delete(@PathVariable(value = Constants.TODO_ID_PARAM) Integer id) {
        todoService.delete(id);
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BattleManager.Models.Contracts
{
    public interface IArmy
    {
        ICollection<ICombatUnit> ArmyUnits { get; }
    }
}


text:
package com.tenor.android.core.validator;

import android.support.annotation.NonNull;
import android.text.TextUtils;

import java.util.regex.Pattern;

public abstract class AbstractValidator<T> implements IValidator<T> {

    private static final long serialVersionUID = 1605380452419139489L;
    private final Pattern mPattern;

    public AbstractValidator(@NonNull String regex) {
        if (TextUtils.isEmpty(regex)) {
            throw new IllegalArgumentException("regex cannot be empty");
        }
        mPattern = Pattern.compile(regex);
    }

    @NonNull
    @Override
    public Pattern get() {
        return mPattern;
    }
}


text:
package com.iluwatar.saga.choreography;

/**
 * Class representing a service to book a hotel.
 */
public class HotelBookingService extends Service {
  public HotelBookingService(ServiceDiscoveryService service) {
    super(service);
  }

  @Override
  public String getName() {
    return "booking a Hotel";
  }

}


text:
* [
      alibaba
      /
      wax
](https://github.com/alibaba/wax):
      Wax is a framework that lets you write native iPhone apps in Lua.

* [
      Boris-Em
      /
      BEMCheckBox
](https://github.com/Boris-Em/BEMCheckBox):
      Tasteful Check box for iOS. (Checkbox)

* [
      MatthewYork
      /
      DateTools
](https://github.com/MatthewYork/DateTools):
      Dates and times made easy in Objective-C

* [
      AFNetworking
      /
      AFNetworking
](https://github.com/AFNetworking/AFNetworking):
      A delightful iOS and OS X networking framework

* [
      casatwy
      /
      CTPersistance
](https://github.com/casatwy/CTPersistance):
      Objective-C Model Layer with SQLite, your next Persistence Layer!

* [
      typcn
      /
      bilibili-mac-client
](https://github.com/typcn/bilibili-mac-client):
      An unofficial bilibili client for mac

* [
      forkingdog
      /
      UITableView-FDTemplateLayoutCell
](https://github.com/forkingdog/UITableView-FDTemplateLayoutCell):
      Template auto layout cell for automatically UITableViewCell height calculating

* [
      Coding
      /
      Coding-iPad
](https://github.com/Coding/Coding-iPad):
      Coding iPad 客户端源代码

* [
      Coding
      /
      Coding-iOS
](https://github.com/Coding/Coding-iOS):
      Coding iOS 客户端源代码

* [
      ReactiveCocoa
      /
      ReactiveCocoa
](https://github.com/ReactiveCocoa/ReactiveCocoa):
      Streams of values over time

* [
      rs
      /
      SDWebImage
](https://github.com/rs/SDWebImage):
      Asynchronous image downloader with cache support as a UIImageView category

* [
      forkingdog
      /
      FDStackView
](https://github.com/forkingdog/FDStackView):
      Use UIStackView directly in iOS6+

* [
      ihappyhacking
      /
      MyOne-iOS
](https://github.com/ihappyhacking/MyOne-iOS):
      我的《一个》 iOS 客户端(OC)

* [
      robbiehanson
      /
      CocoaAsyncSocket
](https://github.com/robbiehanson/CocoaAsyncSocket):
      Asynchronous socket networking library for Mac and iOS

* [
      CoderMJLee
      /
      MJRefresh
](https://github.com/CoderMJLee/MJRefresh):
      An easy way to use pull-to-refresh.

* [
      TTTAttributedLabel
      /
      TTTAttributedLabel
](https://github.com/TTTAttributedLabel/TTTAttributedLabel):
      A drop-in replacement for UILabel that supports attributes, data detectors, links, and more

* [
      gk-brown
      /
      MarkupKit
](https://github.com/gk-brown/MarkupKit):
      Declarative UI for iOS applications

* [
      BradLarson
      /
      GPUImage
](https://github.com/BradLarson/GPUImage):
      An open source iOS framework for GPU-based image and video processing

* [
      ViccAlexander
      /
      Chameleon
](https://github.com/ViccAlexander/Chameleon):
      Flat Color Framework for iOS (Obj-C & Swift)

* [
      kevin0571
      /
      STPopup
](https://github.com/kevin0571/STPopup):
      STPopup provides STPopupController, which works just like UINavigationController in form sheet/bottom sheet style, for both iPhone and iPad.

* [
      ccgus
      /
      fmdb
](https://github.com/ccgus/fmdb):
      A Cocoa / Objective-C wrapper around SQLite

* [
      mogujie
      /
      TeamTalk
](https://github.com/mogujie/TeamTalk):
      TeamTalk is a solution for enterprise IM

* [
      facebook
      /
      AsyncDisplayKit
](https://github.com/facebook/AsyncDisplayKit):
      Smooth asynchronous user interfaces for iOS apps.

* [
      hackiftekhar
      /
      IQKeyboardManager
](https://github.com/hackiftekhar/IQKeyboardManager):
      Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView. Neither need to write any code nor any setup required and much more.

* [
      onevcat
      /
      VVDocumenter-Xcode
](https://github.com/onevcat/VVDocumenter-Xcode):
      Xcode plug-in which helps you write documentation comment easier, for both Objective-C and Swift.

#### go
* [
      montanaflynn
      /
      stats
](https://github.com/montanaflynn/stats):
      A statistics package with common functions that are missing from the Golang standard library. Fully Documented / MIT Licensed / 100% Code Coverage

* [
      bogdanovich
      /
      siberite
](https://github.com/bogdanovich/siberite):
      Siberite is a simple, lightweight, leveldb backed message queue written in Go.

* [
      getlantern
      /
      lantern
](https://github.com/getlantern/lantern):

 Open Internet for everyone. Lantern is a free desktop application that delivers fast, reliable and secure access to the open Internet for users in censored regions. It uses a variety of techniques to stay unblocked, including P2P and domain fronting. Lantern relies on users in uncensored regions acting as access points to the open Internet.

* [
      hashicorp
      /
      otto
](https://github.com/hashicorp/otto):
      Development and deployment made easy.

* [
      docker
      /
      docker
](https://github.com/docker/docker):
      Docker - the open-source application container engine

* [
      toashd
      /
      gopher
](https://github.com/toashd/gopher):
      Little `( ◔ ౪◔)´ for the command line.

* [
      gogits
      /
      gogs
](https://github.com/gogits/gogs):
      Gogs(Go Git Service) is a painless self-hosted Git Service.

* [
      golang
      /
      go
](https://github.com/golang/go):
      The Go programming language

* [
      codetainerapp
      /
      codetainer
](https://github.com/codetainerapp/codetainer):
      A Docker container in your browser.

* [
      hashicorp
      /
      go-getter
](https://github.com/hashicorp/go-getter):
      Package for downloading things from a string URL using a variety of protocols.

* [
      kubernetes
      /
      kubernetes
](https://github.com/kubernetes/kubernetes):
      Container Cluster Manager from Google

* [
      avelino
      /
      awesome-go
](https://github.com/avelino/awesome-go):
      A curated list of awesome Go frameworks, libraries and software

* [
      github
      /
      git-lfs
](https://github.com/github/git-lfs):
      Git extension for versioning large files

* [
      gernest
      /
      mention
](https://github.com/gernest/mention):
      Twitter like mentions and # hashtags parser for Go(Golang)

* [
      hashicorp
      /
      terraform
](https://github.com/hashicorp/terraform):
      Terraform is a tool for building, changing, and combining infrastructure safely and efficiently.

* [
      pingcap
      /
      tidb
](https://github.com/pingcap/tidb):
      TiDB is a distributed SQL database compatible with MySQL protocol.

* [
      codegangsta
      /
      negroni
](https://github.com/codegangsta/negroni):
      Idiomatic HTTP Middleware for Golang

* [
      influxdb
      /
      influxdb
](https://github.com/influxdb/influxdb):
      Scalable datastore for metrics, events, and real-time analytics

* [
      cockroachdb
      /
      cockroach
](https://github.com/cockroachdb/cockroach):
      A Scalable, Geo-Replicated, Transactional Datastore

* [
      syncthing
      /
      syncthing
](https://github.com/syncthing/syncthing):
      Open Source Continuous File Synchronization

* [
      mholt
      /
      caddy
](https://github.com/mholt/caddy):
      Fast general-purpose HTTP/2 web server for any platform.

* [
      go-kit
      /
      kit
](https://github.com/go-kit/kit):
      A standard library for microservices.

* [
      coreos
      /
      etcd
](https://github.com/coreos/etcd):
      A distributed consistent key-value store for shared configuration and service discovery

* [
      drone
      /
      drone
](https://github.com/drone/drone):
      Drone is a Continuous Integration platform built on Docker, written in Go

* [
      prometheus
      /
      prometheus
](https://github.com/prometheus/prometheus):
      The Prometheus monitoring system and time series database.

#### javascript
* [
      jwagner
      /
      smartcrop.js
](https://github.com/jwagner/smartcrop.js):
      Content aware image cropping

* [
      gabrielbull
      /
      react-desktop
](https://github.com/gabrielbull/react-desktop):
      OS X and Windows UI components built with React

* [
      mattermost
      /
      platform
](https://github.com/mattermost/platform):
      Open source Slack-alternative in Golang and React

* [
      rain1017
      /
      memdb
](https://github.com/rain1017/memdb):
      Distributed Transactional In-Memory Database (全球首个支持分布式事务的MongoDB)

* [
      dthree
      /
      vorpal
](https://github.com/dthree/vorpal):
      Node's framework for interactive CLI apps.

* [
      exratione
      /
      lambda-complex
](https://github.com/exratione/lambda-complex):
      Build and deploy Node.js applications constructed from AWS Lambda functions.

* [
      rollup
      /
      rollup
](https://github.com/rollup/rollup):
      Next-generation ES6 module bundler

* [
      facebook
      /
      react-native
](https://github.com/facebook/react-native):
      A framework for building native apps with React.

* [
      zenorocha
      /
      clipboard.js
](https://github.com/zenorocha/clipboard.js):

 Modern copy to clipboard. No Flash. Just 2kb

* [
      ampproject
      /
      amphtml
](https://github.com/ampproject/amphtml):
      AMP HTML source code, samples, and documentation. See below for more info.

* [
      rackt
      /
      redux
](https://github.com/rackt/redux):
      Predictable state container for JavaScript apps

* [
      ireaderlab
      /
      zkdash
](https://github.com/ireaderlab/zkdash):
      A dashboard for zookeeper and Qconf

* [
      auchenberg
      /
      volkswagen
](https://github.com/auchenberg/volkswagen):

 Volkswagen detects when your tests are being run in a CI server, and makes them pass.

* [
      facebook
      /
      react
](https://github.com/facebook/react):
      A declarative, efficient, and flexible JavaScript library for building user interfaces.

* [
      gatsbyjs
      /
      gatsby
](https://github.com/gatsbyjs/gatsby):
      Transform plain text into dynamic blogs and websites using React.js

* [
      bouchenoiremarc
      /
      Sketch-Constraints
](https://github.com/bouchenoiremarc/Sketch-Constraints):
      A plugin that integrates constraints in Sketch to lay out layers.

* [
      jaws-framework
      /
      JAWS
](https://github.com/jaws-framework/JAWS):
      JAWS: The Server-less Application Framework – Uses bleeding-edge AWS services to redefine how to build massively scalable (and cheap) apps!

* [
      angular
      /
      angular.js
](https://github.com/angular/angular.js):
      HTML enhanced for web apps

* [
      markdalgleish
      /
      redux-analytics
](https://github.com/markdalgleish/redux-analytics):
      Analytics middleware for Redux

* [
      getify
      /
      You-Dont-Know-JS
](https://github.com/getify/You-Dont-Know-JS):
      A book series on JavaScript. @YDKJS on twitter.

* [
      runemadsen
      /
      rune.js
](https://github.com/runemadsen/rune.js):
      A JavaScript library for programming graphic design systems with SVG

* [
      nodejs
      /
      node
](https://github.com/nodejs/node):
      Node.js JavaScript runtime

* [
      mtth
      /
      avsc
](https://github.com/mtth/avsc):
      A serialization API to make you smile

* [
      AurousGroup
      /
      frontend
](https://github.com/AurousGroup/frontend):
      The Official Aurous Frontend code.

* [
      mycolorway
      /
      simditor
](https://github.com/mycolorway/simditor):
      An Easy and Fast WYSIWYG Editor

#### ruby
* [
      Sology
      /
      maily_herald
](https://github.com/Sology/maily_herald):
      Advanced email processing solution for Ruby on Rails applications

* [
      Homebrew
      /
      homebrew
](https://github.com/Homebrew/homebrew):

 The missing package manager for OS X.

* [
      peter-murach
      /
      finite_machine
](https://github.com/peter-murach/finite_machine):
      A minimal finite state machine with a straightforward syntax.

* [
      Thibaut
      /
      devdocs
](https://github.com/Thibaut/devdocs):
      API Documentation Browser

* [
      rails
      /
      rails
](https://github.com/rails/rails):
      Ruby on Rails

* [
      jondot
      /
      awesome-react-native
](https://github.com/jondot/awesome-react-native):
      An "awesome" type curated list of React Native components, news, tools, and learning material

* [
      jekyll
      /
      jekyll
](https://github.com/jekyll/jekyll):
      Jekyll is a blog-aware, static site generator in Ruby

* [
      zetachang
      /
      react.rb
](https://github.com/zetachang/react.rb):
      Opal Ruby wrapper of React.js library.

* [
      jordansissel
      /
      fpm
](https://github.com/jordansissel/fpm):
      Effing package management! Build packages for multiple platforms (deb, rpm, etc) with great ease and sanity.

* [
      caskroom
      /
      homebrew-cask
](https://github.com/caskroom/homebrew-cask):
      A CLI workflow for the administration of Mac applications distributed as binaries

* [
      mperham
      /
      sidekiq
](https://github.com/mperham/sidekiq):
      Simple, efficient background processing for Ruby

* [
      sorah
      /
      nginx_omniauth_adapter
](https://github.com/sorah/nginx_omniauth_adapter):
      Use omniauth for nginx auth_request

* [
      ruby
      /
      ruby
](https://github.com/ruby/ruby):
      The Ruby Programming Language

* [
      jamis
      /
      bulk_insert
](https://github.com/jamis/bulk_insert):
      Efficient bulk inserts with ActiveRecord

* [
      rapid7
      /
      metasploit-framework
](https://github.com/rapid7/metasploit-framework):
      Metasploit Framework

* [
      sass
      /
      sass
](https://github.com/sass/sass):
      Sass makes CSS fun again.

* [
      cantino
      /
      huginn
](https://github.com/cantino/huginn):
      Build agents that monitor and act on your behalf. Your agents are standing by!

* [
      mitchellh
      /
      vagrant
](https://github.com/mitchellh/vagrant):
      Vagrant is a tool for building and distributing development environments.

* [
      kilimchoi
      /
      engineering-blogs
](https://github.com/kilimchoi/engineering-blogs):
      A curated list of engineering blogs

* [
      ruby-concurrency
      /
      concurrent-ruby
](https://github.com/ruby-concurrency/concurrent-ruby):
      Modern concurrency tools including agents, futures, promises, thread pools, supervisors, and more. Inspired by Erlang, Clojure, Scala, Go, Java, JavaScript, and classic concurrency patterns.

* [
      discourse
      /
      discourse
](https://github.com/discourse/discourse):
      A platform for community discussion. Free, open, simple.

* [
      bbatsov
      /
      rubocop
](https://github.com/bbatsov/rubocop):
      A Ruby static code analyzer, based on the community Ruby style guide.

* [
      CocoaPods
      /
      CocoaPods
](https://github.com/CocoaPods/CocoaPods):
      The Cocoa Dependency Manager.

* [
      ruby-grape
      /
      grape
](https://github.com/ruby-grape/grape):
      An opinionated micro-framework for creating REST-like APIs in Ruby.

* [
      skwp
      /
      dotfiles
](https://github.com/skwp/dotfiles):
      YADR - The best vim,git,zsh plugins and the cleanest vimrc you've ever seen