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

namespace SnmpSharpNet
{
	/// <summary>
	/// Community based SNMP target. Used for SNMP version 1 and version 2c.
	/// </summary>
	public class CTarget: ITarget
	{
		#region Private variables
		/// <summary>
		/// Target IP address
		/// </summary>
		protected IpAddress _address;
		/// <summary>
		/// Target port number
		/// </summary>
		protected int _port;
		/// <summary>
		/// Target SNMP version number
		/// </summary>
		protected SnmpVersion _version;
		/// <summary>
		/// Target request timeout period in milliseconds
		/// </summary>
		protected int _timeout;
		/// <summary>
		/// Target maximum retry count
		/// </summary>
		protected int _retry;
		/// <summary>
		/// SNMP community name
		/// </summary>
		protected String _community;

		#endregion

		#region Constructors

		/// <summary>
		/// Constructor
		/// </summary>
		public CTarget()
		{
			_address = new IpAddress(System.Net.IPAddress.Loopback);
			_port = 161;
			_version = SnmpVersion.Ver2;
			_timeout = 2000;
			_retry = 1;
			_community = "public";
		}
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="addr">Target address</param>
		public CTarget(IPAddress addr)
			: this()
		{
			_address.Set(addr);
		}
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="addr">Target address</param>
		/// <param name="community">SNMP community name to use with the target</param>
		public CTarget(IPAddress addr, String community)
			: this(addr)
		{
			_community = community;
		}
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="addr">Target address</param>
		/// <param name="port">Taret UDP port number</param>
		/// <param name="community">SNMP community name to use with the target</param>
		public CTarget(IPAddress addr, int port, String community)
			: this(addr,community)
		{
			_port = port;
		}

		#endregion Constructors

		#region Properties

		/// <summary>
		/// SNMP community name for the target
		/// </summary>
		public String Community
		{
			get
			{
				return _community;
			}
			set
			{
				_community = value;
			}
		}

		#endregion Properties

		#region ITarget Members

		/// <summary>
		/// Prepare packet for transmission by filling target specific information in the packet.
		/// </summary>
		/// <param name="packet">SNMP packet class for the required version</param>
		/// <returns>True if packet values are correctly set, otherwise false.</returns>
		public bool PreparePacketForTransmission(SnmpPacket packet)
		{
			if (packet.Version != _version)
				return false;
			if (_version == SnmpVersion.Ver1)
			{
				SnmpV1Packet pkt = (SnmpV1Packet)packet;
				pkt.Community.Set(_community);
				return true;
			}
			else if (_version == SnmpVersion.Ver2)
			{
				SnmpV2Packet pkt = (SnmpV2Packet)packet;
				pkt.Community.Set(_community);
				return true;
			}
			return false;
		}
		/// <summary>
		/// Validate received reply
		/// </summary>
		/// <param name="packet">Received SNMP packet</param>
		/// <returns>True if packet is validated, otherwise false</returns>
		public bool ValidateReceivedPacket(SnmpPacket packet)
		{
			if (packet.Version != _version)
				return false;
			if( _version == SnmpVersion.Ver1 ) {
				SnmpV1Packet pkt = (SnmpV1Packet)packet;
				if (pkt.Community.Equals(_community))
					return true;
			}
			else if( _version == SnmpVersion.Ver2 )
			{
				SnmpV2Packet pkt = (SnmpV2Packet)packet;
				if (pkt.Community.Equals(_community))
					return true;
			}
			return false;
		}
		/// <summary>
		/// Get version of SNMP protocol this target supports
		/// </summary>
		/// <exception cref="SnmpInvalidVersionException">Thrown when SNMP version other then 1 or 2c is set</exception>
		public SnmpVersion Version
		{
			get { return _version; }
			set
			{
				if (value != SnmpVersion.Ver1 && value != SnmpVersion.Ver2)
					throw new SnmpInvalidVersionException("CTarget is only suitable for use with SNMP v1 and v2c protocol versions.");
				_version = value;
			}
		}
		/// <summary>
		/// Timeout in milliseconds for the target. Valid timeout values are between 100 and 10000 milliseconds.
		/// </summary>
		public int Timeout
		{
			get
			{
				return _timeout;
			}
			set
			{
				if (value < 100 || value > 10000)
					throw new OverflowException("Valid timeout value is between 100 milliseconds and 10000 milliseconds");
				_timeout = value;
			}
		}
		/// <summary>
		/// Number of retries for the target. Valid values are 0-5.
		/// </summary>
		public int Retry
		{
			get
			{
				return _retry;
			}
			set
			{
				if (value < 0 || value > 5)
					throw new OverflowException("Valid retry value is between 0 and 5");
				_retry = value;
			}
		}
		/// <summary>
		/// Target IP address
		/// </summary>
		public IpAddress Address
		{
			get
			{
				return _address;
			}
		}
		/// <summary>
		/// Target port number
		/// </summary>
		public int Port
		{
			get
			{
				return _port;
			}
			set
			{
				_port = value;
			}
		}
		/// <summary>
		/// Check validity of the target information.
		/// </summary>
		/// <returns>True if valid, otherwise false.</returns>
		public bool Valid()
		{
			if (_community == null || _community.Length == 0)
				return false;
			if (_address == null || !_address.Valid)
				return false;
			if (_port == 0)
				return false;
			return true;
		}
		#endregion
	}
}


text:
package ilargia.entitas.fixtures.components.game;

import ilargia.entitas.codeGenerator.annotations.Contexts;

@Contexts(names = {"Game", "Core"})
public class Score {
    public int value;

    public Score(int value) {
        this.value = value;
    }
}

redpajama_set_name: RedPajamaGithub


text:
package top.littlerich.virtuallocation.view;

import android.content.Context;
import android.widget.TextView;

import top.littlerich.virtuallocation.R;
import top.littlerich.virtuallocation.base.BaseDialog;

/**
 * Created by xuqingfu on 2017/4/15.
 */
public class CustomProgressDialog extends BaseDialog {

    private TextView tvMsg;

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

    @Override
    protected int getContentViewId() {
        return R.layout.dialog_customprogress;
    }

    @Override
    protected void InitView() {
        tvMsg = (TextView) mView.findViewById(R.id.id_tv_loadingmsg);
    }

    @Override
    protected void IniListener() {
        // TODO Auto-generated method stub

    }

    @Override
    protected void InitData() {

    }

    public void setMessage(String strMessage) {
        if (tvMsg != null) {
            tvMsg.setText(strMessage);
        }
    }
}


text:
package io.druid.query.expression;

import com.google.common.collect.ImmutableMap;
import io.druid.java.util.common.DateTimes;
import io.druid.math.expr.Expr;
import io.druid.math.expr.Parser;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

public class ExprMacroTest
{
  private static final Expr.ObjectBinding BINDINGS = Parser.withMap(
      ImmutableMap.<String, Object>builder()
          .put("t", DateTimes.of("2000-02-03T04:05:06").getMillis())
          .put("tstr", "2000-02-03T04:05:06")
          .put("tstr_sql", "2000-02-03 04:05:06")
          .put("x", "foo")
          .put("y", 2)
          .put("z", 3.1)
          .put("CityOfAngels", "America/Los_Angeles")
          .put("spacey", "  hey there  ")
          .build()
  );

  @Rule
  public ExpectedException expectedException = ExpectedException.none();

  @Test
  public void testLike()
  {
    assertExpr("like(x, 'f%')", 1L);
    assertExpr("like(x, 'f__')", 1L);
    assertExpr("like(x, '%o%')", 1L);
    assertExpr("like(x, 'b%')", 0L);
    assertExpr("like(x, 'b__')", 0L);
    assertExpr("like(x, '%x%')", 0L);
    assertExpr("like(x, '')", 0L);
  }

  @Test
  public void testLookup()
  {
    assertExpr("lookup(x, 'lookyloo')", "xfoo");
  }

  @Test
  public void testLookupNotFound()
  {
    expectedException.expect(NullPointerException.class);
    expectedException.expectMessage("Lookup [lookylook] not found");
    assertExpr("lookup(x, 'lookylook')", null);
  }

  @Test
  public void testRegexpExtract()
  {
    assertExpr("regexp_extract(x, 'f(.)')", "fo");
    assertExpr("regexp_extract(x, 'f(.)', 0)", "fo");
    assertExpr("regexp_extract(x, 'f(.)', 1)", "o");
  }

  @Test
  public void testTimestampCeil()
  {
    assertExpr("timestamp_ceil(t, 'P1M')", DateTimes.of("2000-03-01").getMillis());
    assertExpr("timestamp_ceil(t, 'P1D','','America/Los_Angeles')", DateTimes.of("2000-02-03T08").getMillis());
    assertExpr("timestamp_ceil(t, 'P1D','',CityOfAngels)", DateTimes.of("2000-02-03T08").getMillis());
    assertExpr("timestamp_ceil(t, 'P1D','1970-01-01T01','Etc/UTC')", DateTimes.of("2000-02-04T01").getMillis());
  }

  @Test
  public void testTimestampFloor()
  {
    assertExpr("timestamp_floor(t, 'P1M')", DateTimes.of("2000-02-01").getMillis());
    assertExpr("timestamp_floor(t, 'P1D','','America/Los_Angeles')", DateTimes.of("2000-02-02T08").getMillis());
    assertExpr("timestamp_floor(t, 'P1D','',CityOfAngels)", DateTimes.of("2000-02-02T08").getMillis());
    assertExpr("timestamp_floor(t, 'P1D','1970-01-01T01','Etc/UTC')", DateTimes.of("2000-02-03T01").getMillis());
  }

  @Test
  public void testTimestampShift()
  {
    assertExpr("timestamp_shift(t, 'P1D', 2)", DateTimes.of("2000-02-05T04:05:06").getMillis());
    assertExpr("timestamp_shift(t, 'P1D', 2, 'America/Los_Angeles')", DateTimes.of("2000-02-05T04:05:06").getMillis());
    assertExpr("timestamp_shift(t, 'P1D', 2, CityOfAngels)", DateTimes.of("2000-02-05T04:05:06").getMillis());
    assertExpr("timestamp_shift(t, 'P1D', 2, '-08:00')", DateTimes.of("2000-02-05T04:05:06").getMillis());
  }

  @Test
  public void testTimestampExtract()
  {
    assertExpr("timestamp_extract(t, 'DAY')", 3L);
    assertExpr("timestamp_extract(t, 'HOUR')", 4L);
    assertExpr("timestamp_extract(t, 'DAY', 'America/Los_Angeles')", 2L);
    assertExpr("timestamp_extract(t, 'HOUR', 'America/Los_Angeles')", 20L);
  }

  @Test
  public void testTimestampParse()
  {
    assertExpr("timestamp_parse(tstr)", DateTimes.of("2000-02-03T04:05:06").getMillis());
    assertExpr("timestamp_parse(tstr_sql)", DateTimes.of("2000-02-03T04:05:06").getMillis());
    assertExpr(
        "timestamp_parse(tstr_sql,'','America/Los_Angeles')",
        DateTimes.of("2000-02-03T04:05:06-08:00").getMillis()
    );
    assertExpr("timestamp_parse('2000-02-03')", DateTimes.of("2000-02-03").getMillis());
    assertExpr("timestamp_parse('2000-02')", DateTimes.of("2000-02-01").getMillis());
    assertExpr("timestamp_parse('')", null);
    assertExpr("timestamp_parse('z2000')", null);
    assertExpr("timestamp_parse(tstr_sql,'yyyy-MM-dd HH:mm:ss')", DateTimes.of("2000-02-03T04:05:06").getMillis());
    assertExpr("timestamp_parse('02/03/2000','MM/dd/yyyy')", DateTimes.of("2000-02-03").getMillis());
    assertExpr(
        "timestamp_parse(tstr_sql,'yyyy-MM-dd HH:mm:ss','America/Los_Angeles')",
        DateTimes.of("2000-02-03T04:05:06-08:00").getMillis()
    );
  }

  @Test
  public void testTimestampFormat()
  {
    assertExpr("timestamp_format(t)", "2000-02-03T04:05:06.000Z");
    assertExpr("timestamp_format(t,'yyyy-MM-dd HH:mm:ss')", "2000-02-03 04:05:06");
    assertExpr("timestamp_format(t,'yyyy-MM-dd HH:mm:ss','America/Los_Angeles')", "2000-02-02 20:05:06");
  }

  @Test
  public void testTrim()
  {
    assertExpr("trim('')", null);
    assertExpr("trim(concat(' ',x,' '))", "foo");
    assertExpr("trim(spacey)", "hey there");
    assertExpr("trim(spacey, '')", "  hey there  ");
    assertExpr("trim(spacey, 'he ')", "y ther");
    assertExpr("trim(spacey, spacey)", null);
    assertExpr("trim(spacey, substring(spacey, 0, 4))", "y ther");
  }

  @Test
  public void testLTrim()
  {
    assertExpr("ltrim('')", null);
    assertExpr("ltrim(concat(' ',x,' '))", "foo ");
    assertExpr("ltrim(spacey)", "hey there  ");
    assertExpr("ltrim(spacey, '')", "  hey there  ");
    assertExpr("ltrim(spacey, 'he ')", "y there  ");
    assertExpr("ltrim(spacey, spacey)", null);
    assertExpr("ltrim(spacey, substring(spacey, 0, 4))", "y there  ");
  }

  @Test
  public void testRTrim()
  {
    assertExpr("rtrim('')", null);
    assertExpr("rtrim(concat(' ',x,' '))", " foo");
    assertExpr("rtrim(spacey)", "  hey there");
    assertExpr("rtrim(spacey, '')", "  hey there  ");
    assertExpr("rtrim(spacey, 'he ')", "  hey ther");
    assertExpr("rtrim(spacey, spacey)", null);
    assertExpr("rtrim(spacey, substring(spacey, 0, 4))", "  hey ther");
  }

  private void assertExpr(final String expression, final Object expectedResult)
  {
    final Expr expr = Parser.parse(expression, LookupEnabledTestExprMacroTable.INSTANCE);
    Assert.assertEquals(expression, expectedResult, expr.eval(BINDINGS).value());
  }
}


text:
using Waf.BookLibrary.Reporting.Applications.Reports;
using System.ComponentModel.Composition;

namespace Waf.BookLibrary.Reporting.Presentation.Reports;

[Export(typeof(IBookListReport)), PartCreationPolicy(CreationPolicy.NonShared)]
public partial class BookListReport : IBookListReport
{
    private object? reportData;

    public BookListReport()
    {
        InitializeComponent();
        // Disconnect the flowDocument from the UserControl. The UserControl is only used for DesignTime support.
        Content = null;
    }

    public object Report => flowDocument;

    public object? ReportData
    {
        get => reportData;
        set
        {
            reportData = value;
            flowDocument.DataContext = value;
        }
    }
}


text:
import { Construct } from '@aws-cdk/cdk';
import { TopicRef } from './topic-ref';
/**
 * Properties for creating a new subscription
 */
export interface SubscriptionProps {
    /**
     * What type of subscription to add.
     */
    protocol: SubscriptionProtocol;
    /**
     * The subscription endpoint.
     *
     * The meaning of this value depends on the value for 'protocol'.
     */
    endpoint: any;
    /**
     * The topic to subscribe to.
     */
    topic: TopicRef;
}
/**
 * A new subscription.
 *
 * Prefer to use the `TopicRef.subscribeXxx()` methods to creating instances of
 * this class.
 */
export declare class Subscription extends Construct {
    constructor(parent: Construct, name: string, props: SubscriptionProps);
}
/**
 * The type of subscription, controlling the type of the endpoint parameter.
 */
export declare enum SubscriptionProtocol {
    /**
     * JSON-encoded message is POSTED to an HTTP url.
     */
    Http = "http",
    /**
     * JSON-encoded message is POSTed to an HTTPS url.
     */
    Https = "https",
    /**
     * Notifications are sent via email.
     */
    Email = "email",
    /**
     * Notifications are JSON-encoded and sent via mail.
     */
    EmailJson = "email-json",
    /**
     * Notification is delivered by SMS
     */
    Sms = "sms",
    /**
     * Notifications are enqueued into an SQS queue.
     */
    Sqs = "sqs",
    /**
     * JSON-encoded notifications are sent to a mobile app endpoint.
     */
    Application = "application",
    /**
     * Notifications trigger a Lambda function.
     */
    Lambda = "lambda"
}


text:
<?php

namespace DoctrineCr\Subscriber;

use Doctrine\Common\EventSubscriber;
use Doctrine\ORM\Events;
use Doctrine\ORM\Event\LifecycleEventArgs;
use DoctrineCr\Path\StorageInterface;
use DoctrineCr\Events as DcrEvents;
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
use Metadata\MetadataFactory;
use Doctrine\Common\Util\ClassUtils;
use Doctrine\ORM\EntityManager;
use DoctrineCr\Helper\PathHelper;
use DoctrineCr\Path\Exception\PathNotFoundException;
use DoctrineCr\Collection\ChildrenCollection;
use DoctrineCr\Mapping\Mapper;
use DoctrineCr\Mapping\MetadataLoader;
use DoctrineCr\Mapping\Loader;
use DoctrineCr\Path\PathManager;
use Doctrine\ORM\Event\PreFlushEventArgs;
use DoctrineCr\Mapping\Persister;
use DoctrineCr\Event\MoveEvent;
use Doctrine\Common\Persistence\ObjectManager;

abstract class AbstractDcrSubscriber implements EventSubscriber
{
    private $loader;
    private $metadataLoader;
    private $persister;
    private $metadataFactory;

    public function __construct(
        MetadataFactory $metadataFactory
    )
    {
        $this->metadataFactory = $metadataFactory;
    }

    protected function getLoader()
    {
        if ($this->loader) {
            return $this->loader;
        }

        $this->loader = new Loader(
            $this->getPathManager(),
            $this->metadataFactory
        );

        return $this->loader;
    }

    protected function getPersister()
    {
        if ($this->persister) {
            return $this->persister;
        }

        $this->persister = new Persister(
            $this->getPathManager(),
            $this->metadataFactory
        );

        return $this->persister;
    }

    protected function getMetadataLoader()
    {
        if ($this->metadataLoader) {
            return $this->metadataLoader;
        }

        $this->metadataLoader = new MetadataLoader(
            $this->metadataFactory
        );

        return $this->metadataLoader;
    }

    abstract protected function getPathManager();

    public function getSubscribedEvents()
    {
        return [
            DcrEvents::prePersist,
            DcrEvents::postPersist,
            DcrEvents::postMove,
            Events::preRemove,
            Events::postLoad,
            // pre flush is always raised
            Events::preFlush,
            Events::loadClassMetadata,
        ];
    }

    public function loadClassMetadata(LoadClassMetadataEventArgs $args)
    {
        $this->getMetadataLoader()->loadMetadata($args->getClassMetadata());
    }

    public function postLoad(LifecycleEventArgs $args)
    {
        $this->getLoader()->mapToObject($args->getObjectManager(), $args->getObject());
    }

    public function dcrPrePersist(LifecycleEventArgs $args)
    {
        $this->getPersister()->persist($args->getObject());
    }

    public function dcrPostPersist(LifecycleEventArgs $args)
    {
        $this->updateEntities($args->getObjectManager());
    }

    public function dcrPostMove(MoveEvent $args)
    {
        $this->updateEntities($args->getObjectManager());
    }

    public function preFlush(PreFlushEventArgs $args)
    {
        $this->getPathManager()->flush();
    }

    public function preRemove(LifecycleEventArgs $args)
    {
        $object = $args->getObject();
        $metadata = $this->metadataFactory->getMetadataForClass(ClassUtils::getRealClass(get_class($object)));

        if (!$metadata->isManaged()) {
            return;
        }

        $this->getPathManager()->remove($metadata->getUuidValue($object));
    }

    /**
     * Update any entities that have been affected by a path change.
     */
    private function updateEntities(ObjectManager $objectManager)
    {
        $updateQueue = $this->getPathManager()->getUpdateQueue();

        while (false === $updateQueue->isEmpty()) {
            $entry = $updateQueue->dequeue();
            $object = $objectManager->find($entry->getClassFqn(), $entry->getUuid());
            $this->getLoader()->mapToObject($objectManager, $object);
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:orientation="horizontal"
    android:layout_height="match_parent">

    <TextView
        android:id="@+id/tv_wifiName"
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:gravity="center"
        android:text="liu"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="40dp"
        android:padding="10dp"
        />

    <TextView
        android:id="@+id/tv_wifiLeve"
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:gravity="center"
        android:text="liu"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="40dp"
        />
</LinearLayout>


text:
import os
import os.path
import imp
import subprocess
import sys
from functools import wraps
from threading import Thread
from time import sleep
import neovim

try:
    unicode()
except NameError:
    unicode = str

try:
    import urllib
    urllib = imp.reload(urllib)
    from urllib import request
    request = imp.reload(request)
    Request = request.Request
    urlopen = request.urlopen
    HTTPError = urllib.error.HTTPError
    URLError = urllib.error.URLError
    assert Request and urlopen and HTTPError and URLError
except ImportError:
    import urllib2
    urllib2 = imp.reload(urllib2)
    Request = urllib2.Request
    urlopen = urllib2.urlopen
    HTTPError = urllib2.HTTPError
    URLError = urllib2.URLError

from common import api, msg, reactor, utils, shared as G
import editor
import vui
import view
import vim_handler

VUI = vui.VUI()

reactor = reactor.reactor

# Protocol version
G.__VERSION__ = '0.11'
G.__PLUGIN_VERSION__ = '3.4.3'

G.LOG_TO_CONSOLE = False
G.CHAT_VIEW = True

msg.editor_log = msg.floobits_log

utils.reload_settings()

class EventLoop(Thread):
    def __init__(self, vim, ticker):
        super(EventLoop, self).__init__()
        self.vim = vim
        self.ticker = ticker
        self.intervals = []

    def run(self):
        msg.log("Starting event loop.")
        while True:
            sleep(0.1)
            self.vim.session.threadsafe_call(self.tick)

    def tick(self):
        try:
            self.ticker()
        except Exception as e:
            msg.log("Event loop tick error: %s" % e)

def leave_follow_mode():
    G.FOLLOW_USERS.clear()
    G.FOLLOW_MODE = None

def is_connected(warn=False):
    def outer(func):
        @wraps(func)
        def wrapped(*args, **kwargs):
            if not reactor.is_ready():
                return
            return func(*args, **kwargs)
        return wrapped
    return outer

@utils.inlined_callbacks
def check_credentials():
    msg.debug('Print checking credentials.')
    if utils.can_auth():
        return
    if not utils.has_browser():
        msg.log('You need a Floobits account to use the Floobits plugin. Go to https://floobits.com to sign up.')
        return
    yield VUI.create_or_link_account, None, G.DEFAULT_HOST, False

@neovim.plugin
class Floobits(object):
    def __init__(self, vim):
        self.vim = vim
        vui.vim = vim
        editor.vim = vim
        view.vim = vim
        vim_handler.vim = vim
        self.eventLoop = EventLoop(vim, self.tick)
        reactor.on_stop = self.on_stop

    def on_stop(self):
        self.vim.command('let g:floo_connected = 0')

    def tick(self):
        reactor.tick()

    def start_ticker(self):
        if not self.eventLoop.is_alive():
            self.eventLoop.start()
        if not utils.can_auth():
            check_credentials()
            return False
        return True

    def set_globals(self):
        G.DELETE_LOCAL_FILES = bool(int(self.vim.eval('g:floo_delete_local_files')))
        G.SHOW_HIGHLIGHTS = bool(int(self.vim.eval('g:floo_show_highlights')))
        G.SPARSE_MODE = bool(int(self.vim.eval('g:floo_sparse_mode')))
        self.vim.command('let g:floo_connected = 1')

    @neovim.command('FlooJoinWorkspace', sync=True, nargs=1)
    def check_and_join_workspace(self, args):
        if not self.start_ticker():
            return
        workspace_url = args[0]
        self.set_globals()
        try:
            r = api.get_workspace_by_url(workspace_url)
        except Exception as e:
            return editor.error_message('Error joining %s: %s' % (workspace_url, str(e)))
        if r.code >= 400:
            return editor.error_message('Error joining %s: %s' % (workspace_url, r.body))
        msg.debug('Workspace %s exists' % workspace_url)
        return self.join_workspace(workspace_url)

    @neovim.command('FlooRefreshWorkspace')
    @is_connected()
    def refresh_workspace(self):
        G.AGENT.refresh_workspace()

    @neovim.command('FlooSaySomething', sync=True)
    def say_something(self):
        if not G.AGENT:
            return msg.warn('Not connected to a workspace.')
        something = self.vim_input('Say something in %s: ' % (G.AGENT.workspace,), '')
        if something:
            G.AGENT.send_msg(something)

    @neovim.command('FlooShareDirPrivate', sync=True, nargs=1, complete='dir')
    def share_dir_private(self, args):
        if not self.start_ticker():
            return
        dir_to_share = args[0]
        self.set_globals()
        return VUI.share_dir(None, dir_to_share, {'perms': {'AnonymousUser': []}})

    @neovim.command('FlooShareDirPublic', sync=True, nargs=1, complete='dir')
    def share_dir_public(self, args):
        if not self.start_ticker():
            return
        dir_to_share = args[0]
        self.set_globals()
        return VUI.share_dir(None, dir_to_share, {'perms': {'AnonymousUser': ['view_room']}})

    # TODO: figure out optional args. if no arg, should add current buf
    @neovim.command('FlooAddBuf', nargs=1, complete='file')
    @is_connected(True)
    def add_buf(self, args):
        path = args[0] or self.vim.current.buffer.name
        G.AGENT._upload(path)

    @neovim.command('FlooLeaveWorkspace')
    def part_workspace(self):
        VUI.part_workspace()
        self.clear()
        leave_follow_mode()

    # TODO: figure out optional args. if arg, delete that buf
    @neovim.command('FlooDeleteBuf')
    @is_connected(True)
    def delete_buf(self):
        name = self.vim.current.buffer.name
        G.AGENT.delete_buf(name)

    @neovim.command('FlooToggleFollowMode')
    @is_connected()
    def follow(self, follow_mode=None):
        G.FOLLOW_USERS.clear()
        if follow_mode is None:
            follow_mode = not G.FOLLOW_MODE
        G.FOLLOW_MODE = follow_mode
        if follow_mode:
            G.AGENT.highlight()

    @neovim.command('FlooFollowUser')
    @is_connected()
    def follow_user(self):
        G.FOLLOW_MODE = True
        VUI.follow_user(G.AGENT)

    @neovim.command('FlooSummon')
    @is_connected()
    def summon(self):
        self.maybe_selection_changed(ping=True)

    @neovim.command('FlooOpenInBrowser')
    @is_connected(True)
    def open_in_browser(self):
        url = G.AGENT.workspace_url
        # webbrowser can print to stdout, which is hooked up to neovim's msgpack
        # neovim will close the channel on bad msgpack, so squelch all output
        args = [sys.executable, '-m', 'webbrowser', url]
        proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        (stdout, stderr) = proc.communicate()
        if stderr:
            msg.error('Error opening browser: %s' % stderr)

    @neovim.command('FlooClearHighlights')
    @is_connected()
    def clear(self):
        buf = G.AGENT.get_buf_by_path(self.vim.current.buffer.name)
        if not buf:
            return
        view = G.AGENT.get_view(buf['id'])
        if view:
            view.clear_all_highlights()

    @neovim.command('FlooToggleHighlights')
    @is_connected()
    def toggle_highlights(self):
        G.SHOW_HIGHLIGHTS = not G.SHOW_HIGHLIGHTS
        if G.SHOW_HIGHLIGHTS:
            self.buf_enter()
            msg.log('Highlights enabled')
            return
        self.clear()
        msg.log('Highlights disabled')

    @neovim.command('FlooCompleteSignup')
    def complete_signup(self):
        if not self.start_ticker():
            return
        msg.debug('Completing signup.')
        if not utils.has_browser():
            msg.log('You need a modern browser to complete the sign up. Go to https://floobits.com to sign up.')
            return
        VUI.pinocchio()

    @neovim.command('FlooUsersInWorkspace', sync=True)
    def users_in_workspace(self):
        if not G.AGENT:
            return msg.warn('Not connected to a workspace.')
        self.vim.command('echom "Users connected to %s"' % (G.AGENT.workspace,))
        for user in G.AGENT.workspace_info['users'].values():
            self.vim.command('echom "  %s connected with %s on %s"' % (user['username'], user['client'], user['platform']))

    @neovim.command('FlooListMessages', sync=True)
    def list_messages(self):
        if not G.AGENT:
            return msg.warn('Not connected to a workspace.')
        self.vim.command('echom "Recent messages for %s"' % (G.AGENT.workspace,))
        for message in G.AGENT.get_messages():
            self.vim.command('echom "  %s"' % (message,))

    @neovim.command('FlooInfo')
    def info(self):
        VUI.info()

    @neovim.autocmd('BufEnter', pattern='*')
    @is_connected()
    def buf_enter(self):
        buf = G.AGENT.get_buf_by_path(self.vim.current.buffer.name)
        if not buf:
            return
        buf_id = buf['id']
        d = G.AGENT.on_load.get(buf_id)
        if d:
            del G.AGENT.on_load[buf_id]
            try:
                d['patch']()
            except Exception as e:
                msg.debug('Error running on_load patch handler for buf %s: %s' % (buf_id, str(e)))
        # NOTE: we call highlight twice in follow mode... thats stupid
        for user_id, highlight in G.AGENT.user_highlights.items():
            if highlight['id'] == buf_id:
                G.AGENT._on_highlight(highlight)

    @neovim.autocmd('CursorMoved', pattern='*')
    @is_connected()
    def cursor_moved(self):
        self.maybe_selection_changed()

    @neovim.autocmd('CursorMovedI', pattern='*')
    @is_connected()
    def cursor_movedi(self):
        self.maybe_selection_changed()

    @neovim.autocmd('TextChanged', pattern='*')
    @is_connected()
    def text_changed(self):
        self.maybe_buffer_changed()

    @neovim.autocmd('TextChangedI', pattern='*')
    @is_connected()
    def text_changedi(self):
        self.maybe_buffer_changed()

    @neovim.autocmd('BufWritePost', pattern='*')
    @is_connected()
    def on_save(self):
        buf = G.AGENT.get_buf_by_path(self.vim.current.buffer.name)
        if buf:
            utils.rate_limit(
                'send_save_%s' % buf['id'],
                250,
                lambda: G.AGENT.send({
                    'name': 'saved',
                    'id': buf['id'],
                })
            )
        else:
            self.maybe_new_file()

    @neovim.autocmd('InsertEnter', pattern='*')
    @is_connected()
    def insert_enter(self):
        if G.FOLLOW_MODE:
            self.vim.command('echom "Leaving follow mode."')
            leave_follow_mode()

    @neovim.autocmd('QuickFixCmdPost', pattern='*')
    @is_connected()
    def quick_fix_cmd_post(self):
        self.maybe_buffer_changed()

    @neovim.autocmd('FileChangedShellPost', pattern='*')
    @is_connected()
    def file_changed_shell_post(self):
        self.maybe_buffer_changed()

    @neovim.autocmd('BufReadPost', sync=True, pattern='*')
    @is_connected()
    def buf_read_post(self):
        self.maybe_new_file()

    @neovim.autocmd('BufWinEnter', sync=True, pattern='*')
    @is_connected()
    def buf_win_enter(self):
        self.maybe_new_file()

    def maybe_new_file(self):
        path = self.vim.current.buffer.name
        if path is None or path == '':
            msg.debug('get:buf buffer has no filename')
            return
        if not os.path.exists(path):
            return
        if not utils.is_shared(path):
            msg.debug('get_buf: %s is not shared' % path)
            return

        buf = G.AGENT.get_buf_by_path(path)
        if not buf:
            if not G.IGNORE:
                msg.warn('G.IGNORE is not set. Uploading anyway.')
                G.AGENT.upload(path)
            if G.IGNORE and not G.IGNORE.is_ignored(path, None, True):
                G.AGENT.upload(path)

    def maybe_buffer_changed(self):
        G.AGENT.maybe_buffer_changed(self.vim.current.buffer)

    def maybe_selection_changed(self, ping=False):
        G.AGENT.maybe_selection_changed(self.vim.current.buffer, ping)

    def join_workspace(self, workspace_url, d='', upload_path=None):
        editor.line_endings = self._get_line_endings()
        cwd = self.vim.eval('getcwd()')
        if cwd:
            cwd = [cwd]
        else:
            cwd = []
        VUI.join_workspace_by_url(None, workspace_url, cwd)
        self.vim.command(":cd %s" % G.PROJECT_PATH)

    def vim_input(self, prompt, default, completion=None):
        self.vim.command('call inputsave()')
        if completion:
            cmd = "let user_input = input('%s', '%s', '%s')" % (prompt, default, completion)
        else:
            cmd = "let user_input = input('%s', '%s')" % (prompt, default)
        self.vim.command(cmd)
        self.vim.command('call inputrestore()')
        return self.vim.eval('user_input')

    def _get_line_endings(self):
        formats = self.vim.eval('&fileformats')
        if not formats:
            return '\n'
        name = formats.split(',')[0]
        if name == 'dos':
            return '\r\n'
        return '\n'

    def vim_choice(self, prompt, default, choices):
        default = choices.index(default) + 1
        choices_str = '\n'.join(['&%s' % choice for choice in choices])
        try:
            choice = int(self.vim.eval('confirm("%s", "%s", %s)' % (prompt, choices_str, default)))
        except KeyboardInterrupt:
            return None
        if choice == 0:
            return None
        return choices[choice - 1]


text:
/*
 * This file contains public declarations for the HDF5 module.
 */
#ifndef _H5public_H
#define _H5public_H

/* Include files for public use... */
/*
 * Since H5pubconf.h is a generated header file, it is messy to try
 * to put a #ifndef _H5pubconf_H ... #endif guard in it.
 * HDF5 has set an internal rule that it is being included here.
 * Source files should NOT include H5pubconf.h directly but include
 * it via H5public.h.  The #ifndef _H5public_H guard above would
 * prevent repeated include.
 */
#include "H5pubconf.h"		/*from configure                             */

/* API Version macro wrapper definitions */
#include "H5version.h"

#ifdef H5_HAVE_FEATURES_H
#include <features.h>           /*for setting POSIX, BSD, etc. compatibility */
#endif
#ifdef H5_HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef H5_STDC_HEADERS
#   include <limits.h>		/*for H5T_NATIVE_CHAR defn in H5Tpublic.h    */
#endif
#ifndef __cplusplus
# ifdef H5_HAVE_STDINT_H
#   include <stdint.h>		/*for C9x types				     */
# endif
#else
# ifdef H5_HAVE_STDINT_H_CXX
#   include <stdint.h>		/*for C9x types	when include from C++	     */
# endif
#endif
#ifdef H5_HAVE_INTTYPES_H
#   include <inttypes.h>        /* For uint64_t on some platforms            */
#endif
#ifdef H5_HAVE_STDDEF_H
#   include <stddef.h>
#endif
#ifdef H5_HAVE_PARALLEL
#   include <mpi.h>
#ifndef MPI_FILE_NULL		/*MPIO may be defined in mpi.h already       */
#   include <mpio.h>
#endif
#endif

/* Include the Windows API adapter header early */
#include "H5api_adpt.h"

#ifdef __cplusplus
extern "C" {
#endif

/* Macros for enabling/disabling particular GCC warnings */
/* (see the following web-sites for more info:
 *      http://www.dbp-consulting.com/tutorials/SuppressingGCCWarnings.html
 *      http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas
 */
/* These pragmas are only implemented usefully in gcc 4.6+ */
#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406
    #define H5_GCC_DIAG_STR(s) #s
    #define H5_GCC_DIAG_JOINSTR(x,y) H5_GCC_DIAG_STR(x ## y)
    #define H5_GCC_DIAG_DO_PRAGMA(x) _Pragma (#x)
    #define H5_GCC_DIAG_PRAGMA(x) H5_GCC_DIAG_DO_PRAGMA(GCC diagnostic x)

    #define H5_GCC_DIAG_OFF(x) H5_GCC_DIAG_PRAGMA(push) H5_GCC_DIAG_PRAGMA(ignored H5_GCC_DIAG_JOINSTR(-W,x))
    #define H5_GCC_DIAG_ON(x) H5_GCC_DIAG_PRAGMA(pop)
#else
    #define H5_GCC_DIAG_OFF(x)
    #define H5_GCC_DIAG_ON(x)
#endif

/* Version numbers */
#define H5_VERS_MAJOR	1	/* For major interface/format changes  	     */
#define H5_VERS_MINOR	8	/* For minor interface/format changes  	     */
#define H5_VERS_RELEASE	19	/* For tweaks, bug-fixes, or development     */
#define H5_VERS_SUBRELEASE ""	/* For pre-releases like snap0       */
				/* Empty string for real releases.           */
#define H5_VERS_INFO    "HDF5 library version: 1.8.19"      /* Full version string */

#define H5check()	H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR,	      \
				        H5_VERS_RELEASE)

/* macros for comparing the version */
#define H5_VERSION_GE(Maj,Min,Rel) \
       (((H5_VERS_MAJOR==Maj) && (H5_VERS_MINOR==Min) && (H5_VERS_RELEASE>=Rel)) || \
        ((H5_VERS_MAJOR==Maj) && (H5_VERS_MINOR>Min)) || \
        (H5_VERS_MAJOR>Maj))

#define H5_VERSION_LE(Maj,Min,Rel) \
       (((H5_VERS_MAJOR==Maj) && (H5_VERS_MINOR==Min) && (H5_VERS_RELEASE<=Rel)) || \
        ((H5_VERS_MAJOR==Maj) && (H5_VERS_MINOR<Min)) || \
        (H5_VERS_MAJOR<Maj))

/*
 * Status return values.  Failed integer functions in HDF5 result almost
 * always in a negative value (unsigned failing functions sometimes return
 * zero for failure) while successfull return is non-negative (often zero).
 * The negative failure value is most commonly -1, but don't bet on it.  The
 * proper way to detect failure is something like:
 *
 * 	if((dset = H5Dopen2(file, name)) < 0)
 *	    fprintf(stderr, "unable to open the requested dataset\n");
 */
typedef int herr_t;

/*
 * Boolean type.  Successful return values are zero (false) or positive
 * (true). The typical true value is 1 but don't bet on it.  Boolean
 * functions cannot fail.  Functions that return `htri_t' however return zero
 * (false), positive (true), or negative (failure). The proper way to test
 * for truth from a htri_t function is:
 *
 * 	if ((retval = H5Tcommitted(type))>0) {
 *	    printf("data type is committed\n");
 *	} else if (!retval) {
 * 	    printf("data type is not committed\n");
 *	} else {
 * 	    printf("error determining whether data type is committed\n");
 *	}
 */
typedef unsigned int hbool_t;
typedef int htri_t;

/* Define the ssize_t type if it not is defined */
#if H5_SIZEOF_SSIZE_T==0
/* Undefine this size, we will re-define it in one of the sections below */
#undef H5_SIZEOF_SSIZE_T
#if H5_SIZEOF_SIZE_T==H5_SIZEOF_INT
typedef int ssize_t;
#       define H5_SIZEOF_SSIZE_T H5_SIZEOF_INT
#elif H5_SIZEOF_SIZE_T==H5_SIZEOF_LONG
typedef long ssize_t;
#       define H5_SIZEOF_SSIZE_T H5_SIZEOF_LONG
#elif H5_SIZEOF_SIZE_T==H5_SIZEOF_LONG_LONG
typedef long long ssize_t;
#       define H5_SIZEOF_SSIZE_T H5_SIZEOF_LONG_LONG
#else /* Can't find matching type for ssize_t */
#   error "nothing appropriate for ssize_t"
#endif
#endif

/*
 * The sizes of file objects have their own types defined here, use a 64-bit
 * type.
 */
#if H5_SIZEOF_LONG_LONG >= 8
H5_GCC_DIAG_OFF(long-long)
typedef unsigned long long 	hsize_t;
typedef signed long long	hssize_t;
H5_GCC_DIAG_ON(long-long)
#       define H5_SIZEOF_HSIZE_T H5_SIZEOF_LONG_LONG
#       define H5_SIZEOF_HSSIZE_T H5_SIZEOF_LONG_LONG
#else
#   error "nothing appropriate for hsize_t"
#endif

/*
 * File addresses have their own types.
 */
#if H5_SIZEOF_INT64_T>=8
    typedef uint64_t                haddr_t;
#   define HADDR_UNDEF              ((haddr_t)(int64_t)(-1))
#   define H5_SIZEOF_HADDR_T        H5_SIZEOF_INT64_T
#   ifdef H5_HAVE_PARALLEL
#       define HADDR_AS_MPI_TYPE    MPI_LONG_LONG_INT
#   endif  /* H5_HAVE_PARALLEL */
#elif H5_SIZEOF_INT>=8
    typedef unsigned                haddr_t;
#   define HADDR_UNDEF              ((haddr_t)(-1))
#   define H5_SIZEOF_HADDR_T        H5_SIZEOF_INT
#   ifdef H5_HAVE_PARALLEL
#       define HADDR_AS_MPI_TYPE    MPI_UNSIGNED
#   endif  /* H5_HAVE_PARALLEL */
#elif H5_SIZEOF_LONG>=8
    typedef unsigned long           haddr_t;
#   define HADDR_UNDEF              ((haddr_t)(long)(-1))
#   define H5_SIZEOF_HADDR_T        H5_SIZEOF_LONG
#   ifdef H5_HAVE_PARALLEL
#       define HADDR_AS_MPI_TYPE    MPI_UNSIGNED_LONG
#   endif  /* H5_HAVE_PARALLEL */
#elif H5_SIZEOF_LONG_LONG>=8
    typedef unsigned long long      haddr_t;
#   define HADDR_UNDEF              ((haddr_t)(long long)(-1))
#   define H5_SIZEOF_HADDR_T        H5_SIZEOF_LONG_LONG
#   ifdef H5_HAVE_PARALLEL
#       define HADDR_AS_MPI_TYPE    MPI_LONG_LONG_INT
#   endif  /* H5_HAVE_PARALLEL */
#else
#   error "nothing appropriate for haddr_t"
#endif
#if H5_SIZEOF_HADDR_T ==H5_SIZEOF_INT
#   define H5_PRINTF_HADDR_FMT  "%u"
#elif H5_SIZEOF_HADDR_T ==H5_SIZEOF_LONG
#   define H5_PRINTF_HADDR_FMT  "%lu"
#elif H5_SIZEOF_HADDR_T ==H5_SIZEOF_LONG_LONG
#   define H5_PRINTF_HADDR_FMT  "%" H5_PRINTF_LL_WIDTH "u"
#else
#   error "nothing appropriate for H5_PRINTF_HADDR_FMT"
#endif
#define HADDR_MAX		(HADDR_UNDEF-1)

/* uint32_t type is used for creation order field for messages.  It may be
 * defined in Posix.1g, otherwise it is defined here.
 */
#if H5_SIZEOF_UINT32_T>=4
#elif H5_SIZEOF_SHORT>=4
    typedef short uint32_t;
#   undef H5_SIZEOF_UINT32_T
#   define H5_SIZEOF_UINT32_T H5_SIZEOF_SHORT
#elif H5_SIZEOF_INT>=4
    typedef unsigned int uint32_t;
#   undef H5_SIZEOF_UINT32_T
#   define H5_SIZEOF_UINT32_T H5_SIZEOF_INT
#elif H5_SIZEOF_LONG>=4
    typedef unsigned long uint32_t;
#   undef H5_SIZEOF_UINT32_T
#   define H5_SIZEOF_UINT32_T H5_SIZEOF_LONG
#else
#   error "nothing appropriate for uint32_t"
#endif

/* int64_t type is used for creation order field for links.  It may be
 * defined in Posix.1g, otherwise it is defined here.
 */
#if H5_SIZEOF_INT64_T>=8
#elif H5_SIZEOF_INT>=8
    typedef int int64_t;
#   undef H5_SIZEOF_INT64_T
#   define H5_SIZEOF_INT64_T H5_SIZEOF_INT
#elif H5_SIZEOF_LONG>=8
    typedef long int64_t;
#   undef H5_SIZEOF_INT64_T
#   define H5_SIZEOF_INT64_T H5_SIZEOF_LONG
#elif H5_SIZEOF_LONG_LONG>=8
    typedef long long int64_t;
#   undef H5_SIZEOF_INT64_T
#   define H5_SIZEOF_INT64_T H5_SIZEOF_LONG_LONG
#else
#   error "nothing appropriate for int64_t"
#endif

/* uint64_t type is used for fields for H5O_info_t.  It may be
 * defined in Posix.1g, otherwise it is defined here.
 */
#if H5_SIZEOF_UINT64_T>=8
#elif H5_SIZEOF_INT>=8
    typedef unsigned uint64_t;
#   undef H5_SIZEOF_UINT64_T
#   define H5_SIZEOF_UINT64_T H5_SIZEOF_INT
#elif H5_SIZEOF_LONG>=8
    typedef unsigned long uint64_t;
#   undef H5_SIZEOF_UINT64_T
#   define H5_SIZEOF_UINT64_T H5_SIZEOF_LONG
#elif H5_SIZEOF_LONG_LONG>=8
    typedef unsigned long long uint64_t;
#   undef H5_SIZEOF_UINT64_T
#   define H5_SIZEOF_UINT64_T H5_SIZEOF_LONG_LONG
#else
#   error "nothing appropriate for uint64_t"
#endif

/* Common iteration orders */
typedef enum {
    H5_ITER_UNKNOWN = -1,       /* Unknown order */
    H5_ITER_INC,                /* Increasing order */
    H5_ITER_DEC,                /* Decreasing order */
    H5_ITER_NATIVE,             /* No particular order, whatever is fastest */
    H5_ITER_N		        /* Number of iteration orders */
} H5_iter_order_t;

/* Iteration callback values */
/* (Actually, any postive value will cause the iterator to stop and pass back
 *      that positive value to the function that called the iterator)
 */
#define H5_ITER_ERROR   (-1)
#define H5_ITER_CONT    (0)
#define H5_ITER_STOP    (1)

/*
 * The types of indices on links in groups/attributes on objects.
 * Primarily used for "<do> <foo> by index" routines and for iterating over
 * links in groups/attributes on objects.
 */
typedef enum H5_index_t {
    H5_INDEX_UNKNOWN = -1,	/* Unknown index type			*/
    H5_INDEX_NAME,		/* Index on names 			*/
    H5_INDEX_CRT_ORDER,		/* Index on creation order 		*/
    H5_INDEX_N			/* Number of indices defined 		*/
} H5_index_t;

/*
 * Storage info struct used by H5O_info_t and H5F_info_t
 */
typedef struct H5_ih_info_t {
    hsize_t     index_size;     /* btree and/or list */
    hsize_t     heap_size;
} H5_ih_info_t;

/* Functions in H5.c */
H5_DLL herr_t H5open(void);
H5_DLL herr_t H5close(void);
H5_DLL herr_t H5dont_atexit(void);
H5_DLL herr_t H5garbage_collect(void);
H5_DLL herr_t H5set_free_list_limits (int reg_global_lim, int reg_list_lim,
                int arr_global_lim, int arr_list_lim, int blk_global_lim,
                int blk_list_lim);
H5_DLL herr_t H5get_libversion(unsigned *majnum, unsigned *minnum,
				unsigned *relnum);
H5_DLL herr_t H5check_version(unsigned majnum, unsigned minnum,
			       unsigned relnum);
H5_DLL herr_t H5is_library_threadsafe(hbool_t *is_ts);
H5_DLL herr_t H5free_memory(void *mem);
H5_DLL void *H5allocate_memory(size_t size, hbool_t clear);
H5_DLL void *H5resize_memory(void *mem, size_t size);

#ifdef __cplusplus
}
#endif
#endif /* _H5public_H */


text:
<!doctype html>

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

  <title>Topics</title>
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <link rel="stylesheet" href="../vendors/font-awesome.min.css">
  <link rel="stylesheet" href="../styles.css">

    Spirit

          Topic 1

           2 May

    Spirit


text:
package org.apache.camel.idea.completion;

import java.util.List;

import com.intellij.codeInsight.completion.CompletionType;
import org.apache.camel.idea.CamelLightCodeInsightFixtureTestCaseIT;
import org.hamcrest.Matchers;

import static org.junit.Assert.assertThat;

/**
 * Testing smart completion with Camel Java DSL
 */
public class JavaEndpointSmartCompletionTestIT extends CamelLightCodeInsightFixtureTestCaseIT {

    public void testConsumerCompletion() {
        myFixture.configureByFiles("CompleteJavaEndpointConsumerTestData.java");
        myFixture.complete(CompletionType.BASIC, 1);
        List<String> strings = myFixture.getLookupElementStrings();
        assertThat(strings, Matchers.not(Matchers.contains("file:inbox?fileExist", "file:inbox?forceWrites")));
        assertThat(strings, Matchers.hasItems("file:inbox?autoCreate", "file:inbox?include", "file:inbox?delay", "file:inbox?delete"));
        assertTrue("There is many options", strings.size() > 60);
    }

    public void testProducerCompletion() {
        myFixture.configureByFiles("CompleteJavaEndpointProducerTestData.java");
        myFixture.complete(CompletionType.BASIC, 1);
        List<String> strings = myFixture.getLookupElementStrings();
        assertThat(strings, Matchers.not(Matchers.contains("file:outbox?autoCreate", "file:outbox?include", "file:outbox?delay", "file:outbox?delete")));
        assertThat(strings, Matchers.hasItems("file:outbox?fileExist", "file:outbox?forceWrites"));
        assertTrue("There is less options", strings.size() < 30);
    }

    private String getJavaInTheMiddleUnresolvedOptionsTestData() {
        return "import org.apache.camel.builder.RouteBuilder;\n"
            + "public class MyRouteBuilder extends RouteBuilder {\n"
            + "        public void configure() throws Exception {\n"
            + "            from(\"timer:trigger?repeatCount=10&ex<caret>\")\n"
            + "                .to(\"file:outbox?delete=true&fileExist=Append\");\n"
            + "        }\n"
            + "    }";
    }
    public void testJavaInTheMiddleUnresolvedOptionsCompletion() {
        myFixture.configureByText("JavaCaretInMiddleOptionsTestData.java", getJavaInTheMiddleUnresolvedOptionsTestData());
        myFixture.complete(CompletionType.BASIC, 1);
        List<String> strings = myFixture.getLookupElementStrings();
        assertThat(strings, Matchers.not(Matchers.contains("timer:trigger?repeatCount=10")));
        assertThat(strings, Matchers.contains("timer:trigger?repeatCount=10&exceptionHandler",
            "timer:trigger?repeatCount=10&exchangePattern"));
        assertTrue("There is less options", strings.size() == 2);
    }

    private String getJavaInTheMiddleOfResolvedOptionsData() {
        return "import org.apache.camel.builder.RouteBuilder;\n"
            + "public class MyRouteBuilder extends RouteBuilder {\n"
            + "        public void configure() throws Exception {\n"
            + "            from(\"timer:trigger?repeatCount=10&fixed<caret>Rate=false\")\n"
            + "                .to(\"file:outbox?delete=true&fileExist=Append\");\n"
            + "        }\n"
            + "    }";
    }

    public void testJavaInTheMiddleOfResolvedOptionsCompletion() {
        myFixture.configureByText("JavaCaretInMiddleOptionsTestData.java", getJavaInTheMiddleOfResolvedOptionsData());
        myFixture.complete(CompletionType.BASIC, 1);
        List<String> strings = myFixture.getLookupElementStrings();
        assertTrue("Expect 0 options", strings.size() == 0);
    }

    private String getJavaAfterAmpOptionsTestData() {
        return "import org.apache.camel.builder.RouteBuilder;\n"
            + "public class MyRouteBuilder extends RouteBuilder {\n"
            + "        public void configure() throws Exception {\n"
            + "            from(\"timer:trigger?repeatCount=10&<caret>\")\n"
            + "                .to(\"file:outbox?delete=true&fileExist=Append\");\n"
            + "        }\n"
            + "    }";
    }
    public void testJavaAfterAmbeCompletion() {
        myFixture.configureByText("JavaCaretInMiddleOptionsTestData.java", getJavaAfterAmpOptionsTestData());
        myFixture.complete(CompletionType.BASIC, 1);
        List<String> strings = myFixture.getLookupElementStrings();
        assertThat(strings, Matchers.not(Matchers.contains("timer:trigger?repeatCount=10")));
        assertThat(strings, Matchers.contains("timer:trigger?repeatCount=10&bridgeErrorHandler",
            "timer:trigger?repeatCount=10&daemon",
            "timer:trigger?repeatCount=10&delay",
            "timer:trigger?repeatCount=10&exceptionHandler",
            "timer:trigger?repeatCount=10&exchangePattern",
            "timer:trigger?repeatCount=10&fixedRate",
            "timer:trigger?repeatCount=10&pattern",
            "timer:trigger?repeatCount=10&period",
            "timer:trigger?repeatCount=10&synchronous",
            "timer:trigger?repeatCount=10&time",
            "timer:trigger?repeatCount=10&timer"));
        assertTrue("There is less options", strings.size() < 13);
    }

    private String getJavaCaretAfterQuestionMarkWithPreDataOptionsTestData() {
        return "import org.apache.camel.builder.RouteBuilder;\n"
            + "public class MyRouteBuilder extends RouteBuilder {\n"
            + "        public void configure() throws Exception {\n"
            + "            from(\"timer:trigger?re<caret>\")\n"
            + "                .to(\"file:outbox?delete=true&fileExist=Append\");\n"
            + "        }\n"
            + "    }";
    }
    public void testJavaAfterQuestionMarkWithPreDataOptionsCompletion() {
        myFixture.configureByText("JavaCaretInMiddleOptionsTestData.java", getJavaCaretAfterQuestionMarkWithPreDataOptionsTestData());
        myFixture.complete(CompletionType.BASIC, 1);
        List<String> strings = myFixture.getLookupElementStrings();
        assertNull("Don't except any elements, because it the 're' is unique and return the repeatCount", strings);
    }

    private String getJavaEndOfLineTestData() {
        return "import org.apache.camel.builder.RouteBuilder;\n"
            + "public class MyRouteBuilder extends RouteBuilder {\n"
            + "        public void configure() throws Exception {\n"
            + "            from(\"timer:trigger?repeatCount=0&exchangePattern=RobustInOnly&<caret>\")\n"
            + "                .to(\"file:outbox?delete=true&fileExist=Append\");\n"
            + "        }\n"
            + "    }";
    }
    public void testJavaEndOfLineOptionsCompletion() {
        myFixture.configureByText("JavaCaretInMiddleOptionsTestData.java", getJavaEndOfLineTestData());
        myFixture.complete(CompletionType.BASIC, 1);
        List<String> strings = myFixture.getLookupElementStrings();
        assertTrue("There is many options", strings.size() > 9);
    }

    private String getJavaInsertAfterQuestionMarkTestData() {
        return "import org.apache.camel.builder.RouteBuilder;\n"
            + "public class MyRouteBuilder extends RouteBuilder {\n"
            + "        public void configure() throws Exception {\n"
            + "            from(\"timer:trigger?per<caret>repeatCount=0&exchangePattern=RobustInOnly\")\n"
            + "                .to(\"file:outbox?delete=true&fileExist=Append\");\n"
            + "        }\n"
            + "    }";
    }
    public void testJavaInsertAfterQuestionMarkTestData() {
        String javaInsertAfterQuestionMarkTestData = getJavaInsertAfterQuestionMarkTestData();
        myFixture.configureByText("JavaCaretInMiddleOptionsTestData.java", javaInsertAfterQuestionMarkTestData);
        myFixture.complete(CompletionType.BASIC, 1);
        List<String> strings = myFixture.getLookupElementStrings();
        assertTrue("There is many options", strings.size() == 1);
        assertThat(strings, Matchers.contains("timer:trigger?period"));
        myFixture.type('\n');
        javaInsertAfterQuestionMarkTestData = javaInsertAfterQuestionMarkTestData.replace("<caret>", "iod=");
        myFixture.checkResult(javaInsertAfterQuestionMarkTestData);
    }

    private String getJavaMultilineTestData() {
        return "import org.apache.camel.builder.RouteBuilder;\n"
            + "public class MyRouteBuilder extends RouteBuilder {\n"
            + "        public void configure() throws Exception {\n"
            + "            from(\"timer:trigger?repeatCount=10&\" +\n"
            + "                \"fixedRate=false\"+ \n"
            + "                \"&daemon=false\" + \n"
            + "                \"&period=10<caret>\");\n"
            + "        }\n"
            + "    }";
    }
    public void testJavaMultilineTestData() {
        myFixture.configureByText("CamelRoute.java", getJavaMultilineTestData());
        myFixture.complete(CompletionType.BASIC, 1);
        List<String> strings = myFixture.getLookupElementStrings();
        assertEquals("There is many options", 8, strings.size());
        assertThat(strings, Matchers.not(Matchers.containsInAnyOrder(
            "timer:trigger?repeatCount=10&",
            "&fixedRate=false",
            "&daemon=false",
            "&period=10")));
        myFixture.type('\n');
        String javaInsertAfterQuestionMarkTestData = getJavaMultilineTestData().replace("<caret>", "&bridgeErrorHandler=");
        myFixture.checkResult(javaInsertAfterQuestionMarkTestData);
    }

    private String getJavaMultilineTest2Data() {
        return "import org.apache.camel.builder.RouteBuilder;\n"
            + "public class MyRouteBuilder extends RouteBuilder {\n"
            + "        public void configure() throws Exception {\n"
            + "            from(\"timer:trigger?repeatCount=10\"\n"
            + "                + \"&fixedRate=false<caret>\"\n"
            + "                + \"&daemon=false\" \n"
            + "                + \"&period=10\");\n"
            + "        }\n"
            + "    }";
    }
    public void testJavaMultilineTest2Data() {
        myFixture.configureByText("CamelRoute.java", getJavaMultilineTest2Data());
        myFixture.complete(CompletionType.BASIC, 1);
        List<String> strings = myFixture.getLookupElementStrings();
        assertEquals("There is many options", 8, strings.size());
        assertThat(strings, Matchers.not(Matchers.containsInAnyOrder(
            "timer:trigger?repeatCount=10",
            "&fixedRate=false",
            "&daemon=false",
            "&period=10")));
        myFixture.type('\n');
        String javaInsertAfterQuestionMarkTestData = getJavaMultilineTest2Data().replace("<caret>", "&bridgeErrorHandler=");
        myFixture.checkResult(javaInsertAfterQuestionMarkTestData);
    }

    private String getJavaMultilineTest3Data() {
        return "import org.apache.camel.builder.RouteBuilder;\n"
            + "public class MyRouteBuilder extends RouteBuilder {\n"
            + "        public void configure() throws Exception {\n"
            + "            from(\"timer:trigger?repeatCount=10\"+\n"
            + "                 \"&fixedRate=false\"+\n"
            + "                 \"&daemon=false\" \n"
            + "                + \"&period=10&<caret>\");\n"
            + "        }\n"
            + "    }";
    }
    public void testJavaMultilineTest3Data() {
        myFixture.configureByText("CamelRoute.java", getJavaMultilineTest3Data());
        myFixture.complete(CompletionType.BASIC, 1);
        List<String> strings = myFixture.getLookupElementStrings();
        assertEquals("There is many options", 8, strings.size());
        assertThat(strings, Matchers.not(Matchers.containsInAnyOrder(
            "timer:trigger?repeatCount=10",
            "&fixedRate=false",
            "&daemon=false",
            "&period=10")));
        myFixture.type('\n');
        String javaInsertAfterQuestionMarkTestData = getJavaMultilineTest3Data().replace("<caret>", "bridgeErrorHandler=");
        myFixture.checkResult(javaInsertAfterQuestionMarkTestData);
    }

    private String getJavaMultilineInFixSearchData() {
        return "import org.apache.camel.builder.RouteBuilder;\n"
            + "public class MyRouteBuilder extends RouteBuilder {\n"
            + "        public void configure() throws Exception {\n"
            + "            from(\"timer:trigger?repeatCount=10\"+\n"
            + "                 \"&ex<caret>fixedRate=false\"+\n"
            + "                 \"&daemon=false\" \n"
            + "                + \"&period=10\");\n"
            + "        }\n"
            + "    }";
    }
    public void testJavaMultilineInFixSearchData() {
        myFixture.configureByText("CamelRoute.java", getJavaMultilineInFixSearchData());
        myFixture.complete(CompletionType.BASIC, 1);
        List<String> strings = myFixture.getLookupElementStrings();
        assertEquals("There is many options", 2, strings.size());
        assertThat(strings, Matchers.containsInAnyOrder("&exceptionHandler", "&exchangePattern"));
        assertThat(strings, Matchers.not(Matchers.containsInAnyOrder(
            "timer:trigger?repeatCount=10",
            "&fixedRate=false",
            "&daemon=false",
            "&period=10")));
        myFixture.type('\n');
        String javaInsertAfterQuestionMarkTestData = getJavaMultilineInFixSearchData().replace("<caret>", "ceptionHandler=");
        myFixture.checkResult(javaInsertAfterQuestionMarkTestData);
    }

    private String getJavaMultilineTest4SearchData() {
        return "import org.apache.camel.builder.RouteBuilder;\n"
            + "public class MyRouteBuilder extends RouteBuilder {\n"
            + "        public void configure() throws Exception {\n"
            + "            from(\"timer:trigger?repeatCount=10\"+\n"
            + "                 \"&fixedRate=false\"+\n"
            + "                 \"&daemon=false&\" \n"
            + "                + \"period=10<caret>\");\n"
            + "        }\n"
            + "    }";
    }
    public void testJavaMultilineTest4Data() {
        myFixture.configureByText("CamelRoute.java", getJavaMultilineTest4SearchData());
        myFixture.complete(CompletionType.BASIC, 1);
        List<String> strings = myFixture.getLookupElementStrings();
        assertEquals("There is many options", 8, strings.size());
        assertThat(strings, Matchers.not(Matchers.containsInAnyOrder(
            "timer:trigger?repeatCount=10",
            "fixedRate=false",
            "daemon=false",
            "period=10")));
        myFixture.type('\n');
        String javaMarkTestData = getJavaMultilineTest4SearchData().replace("<caret>", "&bridgeErrorHandler=");
        myFixture.checkResult(javaMarkTestData);
    }

}


text:
<?php

namespace yii\mongodb\debug;

use yii\debug\panels\DbPanel;
use yii\log\Logger;

/**
 * MongoDbPanel panel that collects and displays MongoDB queries performed.
 *
 * @author Klimov Paul <klimov@zfort.com>
 * @since 2.0.1
 */
class MongoDbPanel extends DbPanel
{
    /**
     * @inheritdoc
     */
    public $db = 'mongodb';

    /**
     * @inheritdoc
     */
    public function init()
    {
        $this->actions['db-explain'] = [
            'class' => 'yii\\mongodb\\debug\\ExplainAction',
            'panel' => $this,
        ];
    }

    /**
     * @inheritdoc
     */
    public function getName()
    {
        return 'MongoDB';
    }

    /**
     * @inheritdoc
     */
    public function getSummaryName()
    {
        return 'MongoDB';
    }

    /**
     * Returns all profile logs of the current request for this panel.
     * @return array
     */
    public function getProfileLogs()
    {
        $target = $this->module->logTarget;

        return $target->filterMessages($target->messages, Logger::LEVEL_PROFILE, [
            'yii\mongodb\Collection::*',
            'yii\mongodb\Query::*',
            'yii\mongodb\Database::*',
        ]);
    }

    /**
     * @inheritdoc
     */
    protected function hasExplain()
    {
        return true;
    }

    /**
     * @inheritdoc
     */
    protected function getQueryType($timing)
    {
        $timing = ltrim($timing);
        $timing = mb_substr($timing, 0, mb_strpos($timing, '('), 'utf8');
        $matches = explode('.', $timing);

        return count($matches) ? array_pop($matches) : '';
    }

    /**
     * @inheritdoc
     */
    public static function canBeExplained($type)
    {
        return $type === 'find';
    }
}


text:
var http = require('http');
var proxy = require("./public/httpProxy");
var logger = require("./utils/log");
var handler = require("./public/handler");
var route = require("./public/route");
var router = require("./public/router");

var proxy_port = process.env.APP_PROXY_PORT ? process.env.APP_PROXY_PORT : 11223;
var socket_port = process.env.APP_SOCKET_PORT ? process.env.APP_SOCKET_PORT : 11224;
var io = require("socket.io")();

var server = require('http').createServer(function(req, res) {
    var local = '127.0.0.1:'+proxy_port;
    var host = req.headers.host, ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
    switch(host){
        case local:
            router.runAction(req, res);
        break;
        default:
            proxy.web(req, res, {
                target: 'http://' + host
            });
  }
});

proxy.on('proxyRes', handler.filterHandler);

io.on('connection', function(socket){
    socket.on("init-thread", handler.initThread);
    socket.on("close-record", handler.closeRecord);
    socket.on("cut-record", handler.cutRecord);
    //socket.on("upload-video", handler.uploadVideo);
    socket.on("remove-thread", handler.removeThread);
    socket.on("delete-thread", handler.deleteThread);
    socket.on("init-stream", handler.initStream);
    socket.on("update-file-save-path", handler.setSavePath);

    socket.on("add-listener", handler.addListener);
    socket.on('disconnect', handler.removeListener);
});

module.exports.run = function(){
    logger.debug(proxy_port)
    server.listen(proxy_port);
    logger.debug("http server listening on port " + proxy_port);
    io.listen(socket_port);
    logger.debug("socket server listening on port " + socket_port);
};

module.exports.stop = function(callback){
    handler.stop();
    if(Object.keys(handler.threads).length == 0){
        if(callback) callback(true);
    }else{
        for(index in handler.threads){
            var thread = handler.threads[index];
            thread.emit("close", function(currThread){
                logger.debug("delete " + currThread.getId())
                delete handler.threads[currThread.getId()];
                if(Object.keys(handler.threads).length == 0){
                    logger.debug("http server close listen on port " + proxy_port);
                    logger.debug("socket server close listen on port " + socket_port);
                    if(callback) callback(true)
                }
            })
        }
    }

};


text:
package com.cloudbees.api;

import org.codehaus.jackson.node.ObjectNode;

/**
 * @author Kohsuke Kawaguchi
 */
public class CBSubscription extends CBObject {
    public String service;
    public String plan;

    /**
     * This is used from client->server to tweak the details of the subscrpition.
     */
    public ObjectNode settings;
    /**
     * This is used from server->client to represent the current details of the subscription.
     */
    public ObjectNode config;
}


text:
OmniAuth.config.logger = Rails.logger

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :facebook, Settings.facebook.key, Settings.facebook.secret,
    scope: "", display: "touch", secure_image_url: true, image_size: "normal",
    info_fields: "name,locale,username,timezone,updated_time,picture"
  provider :twitter, Settings.twitter.key, Settings.twitter.secret,
    secure_image_url: true, image_size: "bigger"
  provider :vkontakte, Settings.vkontakte.key, Settings.vkontakte.secret,
    scope: "", display: "mobile", image_size: "bigger"
end


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="msvalidate.01" content="C3BF2C67B92C75F2DEAA096973652038" />
  <link rel="shortcut icon" href="http://www.apiman.io/latest/resources/images/favicon.ico">
  <title>The More You Know: apiman micro-services? | apiman Open Source API Management</title>
  <meta name="description" content="Let's spend a little bit of time learning more about one of the newer ways youcan run apiman:  as a set of micro-services.Running apiman in this way has seve...">

  <link href="http://www.apiman.io/latest/resources/bootstrap-3.3.0/css/bootstrap.min.css" rel="stylesheet">
  <link href="http://www.apiman.io/latest/resources/patternfly-1.0.5/css/patternfly.min.css" rel="stylesheet">
  <link href="http://static.jboss.org/css/rhbar.css" media="screen" rel="stylesheet">
  <link href="http://www.apiman.io/latest/resources/css/apiman-web.css?v=1.2.3.Final" rel="stylesheet">
  <link href="http://www.apiman.io/latest/resources/css/apiman-web.responsive.css?v=1.2.3.Final" rel="stylesheet">
  <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet">
  <link href="/blog/css/highlight.css" rel="stylesheet">
  <link href="/blog/css/main.css" rel="stylesheet">
  <link href="/blog/css/coderay-asciidoctor.css" rel="stylesheet">

    <link rel="canonical" href="http://apiman.io/blog/micro-services/development/2015/11/12/micro-services.html">

  <link rel="alternate" type="application/rss+xml" title="apiman Blog | Open Source API Management" href="http://apiman.io/blog/feed.xml" />

      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
        Toggle navigation

      </button>
      apiman

Overview

Download

Roadmap

Blog

            Get Involved

                    Report a Bug

                    Chat on IRC

                    Twitter Feed

                    Mailing List

                    Contributors List

            Learn More

                    Tutorials & Walkthroughs

                    Installation Guide

                    User Guide

                    Developer Guide

                    Production Guide

                    API Manager REST Endpoints

The More You Know: apiman micro-services?

     Nov 12, 2015
     Eric Wittmann
     micro-services and development

Let's spend a little bit of time learning more about one of the newer ways you
can run apiman:  as a set of micro-services.

Running apiman in this way has several advantages, including (but not limited to):

Fast startup time

Fully decoupled

Easily debuggable from an IDE

Quick to test different configurations

Independently scale (esp. via fabric8/openshift/kubernetes)

On the other hand, breaking everything apart has some disadvantages as well.
Some of these include:

Need to fire up multiple, separate Java processes

No authentication integration with Keycloak out of the box

What are they?

What do we mean by "apiman micro-services"?  Well, by default if you download
apiman from the project site, you'll get everything delivered
to you in one convenient package.  This package extracts into an existing WildFly
installation, and thus everything runs as a web application within the application
server.  This is very convenient to evaluate the software, but it's not ideal for
development or for dockerizing.

In addition to our support for WildFly and EAP, we also now support simply running
the various components of apiman as standalone Java applications.  You can find
the specific source modules that provide this functionality here:

API Manager Micro-Service (source)

API Gateway Micro-Service (source)

These two modules provide Java classes which use an embedded version of Jetty to
start up the API Manager and API Gateway as simple standalone Java processes.  Each
micro-service includes a Starter class with a Java main method.  Both micro-services
are designed to be easily extensible/customizable to fit whatever purpose or
configuration is desired.

How do I use them?

As I mentioned, the micro-services are intended to be extended and customized.  So
you could create a new maven project and add the specific apiman micro service
module as a dependency and then….

OK I probably lost you already.  It's actually not very hard, so here's a whole
github repository full of examples:

https://github.com/apiman/apiman-servers

Each of the modules in there is a very simple pre-baked and configured micro-service
based on what apiman provides.  So for example, if you want to run an Elasticsearch
version of the API Gateway along with a Postgres version of the API Manager, you
could follow these two sets of directions:

API Gateway micro-service with Elastic

API Manager micro-service with Postgres

If you run both of these at the same time, you will end up with two entirely separate
Java processes running embedded Jetty and listening on different ports.

What about the API Manager UI?

There are two ways you can access the API Manager User Interface.  The first is that
it's built into the API Manager micro-service!  Once you have the Manager micro-service
running, you should be able to go here:

http://localhost:8080/apimanui/

Using gulp (development only)

If you're looking to use the micro-services to make it easier to do development
work on apiman, then you might find yourself needing to modify the User Interface.
You can do this by running "gulp" in the UI module of the apiman source tree:

$ cd ~/git/apiman/manager/ui/hawtio/
ewittman@falcon ~/git/apiman/apiman/manager/ui/hawtio
$ gulp
[14:56:29] Using gulpfile ~/git/apiman/apiman/manager/ui/hawtio/gulpfile.js
[14:56:29] Starting 'default'...
[14:56:29] Starting 'build'...
[14:56:29] Starting 'browserify'...
[14:56:29] Starting 'css'...
[14:56:29] Starting 'fonts'...
[14:56:29] Starting 'images'...
[14:56:29] Finished 'build' after 58 ms
[14:56:29] Starting 'watch'...
[14:56:29] Finished 'watch' after 10 ms
[14:56:29] Starting 'connect'...
[14:56:29] Finished 'connect' after 49 ms
[14:56:29] Finished 'default' after 126 ms
[14:56:29] Server started http://localhost:2772
[14:56:30] Finished 'css' after 589 ms
[14:56:37] Finished 'images' after 7.49 s
[14:56:41] Finished 'fonts' after 12 s
[14:56:41] Finished 'browserify' after 12 s
[14:56:41] Starting 'path-adjust'...
[14:56:41] Finished 'path-adjust' after 38 ms
[14:56:41] Starting 'clean-defs'...
[14:56:41] Finished 'clean-defs' after 7.87 ms
[14:56:41] Starting 'tsc'...
[14:56:45] Finished 'tsc' after 4.19 s
[14:56:45] Starting 'template'...
[14:56:45] Finished 'template' after 132 ms
[14:56:45] Starting 'concat'...
[14:56:45] Finished 'concat' after 72 ms
[14:56:45] Starting 'clean'...
[14:56:45] Finished 'clean' after 8.82 ms

Once you have the API Manager micro-service and gulp running, you should be
able to access the UI by going here:

http://localhost:2772/api-manager

Warning: Authentication

At the moment, the biggest problem with the micro-services is the issue of user
authentication.  Currently, only very simple BASIC authentication is supported.

It's always tricky talking about authentication with apiman - but in this context
I'm referring to authenticating into the apiman UI and REST services.  All of the
authentication related Policies will work.

The micro-services allow you to specify your own users.list file, which should
include the static set of users you wish to allow access.  In the future, we will
be improving the micro-services to support other authentication mechanisms.  Note
that you can do this yourself by overriding this:

Gateway Micro-Service Authentication Handler+Filter

Manager Micro-Service Authentication Handler+Filter

Good luck and come find us on the mailing list or IRC if you have any trouble!

/post

                        Copyright © 2016 Red Hat, Inc. All rights reserved.

                        apiman code is open source and released under Apache License, v2.0.

                        Open Source Disclosure


text:
@class NSString;

@interface EmoticonTabRecommendItem : NSObject <PBCoding>
{
    unsigned int m_buttonType;
    NSString *m_name;
    NSString *m_productId;
    NSString *m_iconUrl;
    NSString *m_bigIconUrl;
    NSString *m_recType;
    NSString *m_recWord;
}

+ (void)initialize;
@property(nonatomic) unsigned int m_buttonType; // @synthesize m_buttonType;
@property(retain, nonatomic) NSString *m_recWord; // @synthesize m_recWord;
@property(retain, nonatomic) NSString *m_recType; // @synthesize m_recType;
@property(retain, nonatomic) NSString *m_bigIconUrl; // @synthesize m_bigIconUrl;
@property(retain, nonatomic) NSString *m_iconUrl; // @synthesize m_iconUrl;
@property(retain, nonatomic) NSString *m_productId; // @synthesize m_productId;
@property(retain, nonatomic) NSString *m_name; // @synthesize m_name;
- (void).cxx_destruct;
@property(readonly, copy) NSString *description;
- (void)updateFromItem:(id)arg1;
- (id)init;
- (const map_0e718273 *)getValueTagIndexMap;
- (id)getValueTypeTable;

// Remaining properties
@property(readonly, copy) NSString *debugDescription;
@property(readonly) unsigned long long hash;
@property(readonly) Class superclass;

@end


text:
package sarama

type ConfigResourceType int8

// Taken from :
// https://cwiki.apache.org/confluence/display/KAFKA/KIP-133%3A+Describe+and+Alter+Configs+Admin+APIs#KIP-133:DescribeandAlterConfigsAdminAPIs-WireFormattypes

const (
	UnknownResource ConfigResourceType = 0
	AnyResource     ConfigResourceType = 1
	TopicResource   ConfigResourceType = 2
	GroupResource   ConfigResourceType = 3
	ClusterResource ConfigResourceType = 4
	BrokerResource  ConfigResourceType = 5
)


text:
package fifo

import (
	"encoding/json"
	"net/http"
	"sync"

	"github.com/google/martian/v3"
	"github.com/google/martian/v3/log"
	"github.com/google/martian/v3/parse"
	"github.com/google/martian/v3/verify"
)

// Group is a martian.RequestResponseModifier that maintains lists of
// request and response modifiers executed on a first-in, first-out basis.
type Group struct {
	reqmu   sync.RWMutex
	reqmods []martian.RequestModifier

	resmu   sync.RWMutex
	resmods []martian.ResponseModifier

	aggregateErrors bool
}

type groupJSON struct {
	Modifiers       []json.RawMessage    `json:"modifiers"`
	Scope           []parse.ModifierType `json:"scope"`
	AggregateErrors bool                 `json:"aggregateErrors"`
}

func init() {
	parse.Register("fifo.Group", groupFromJSON)
}

// NewGroup returns a modifier group.
func NewGroup() *Group {
	return &Group{}
}

// SetAggregateErrors sets the error behavior for the Group. When true, the Group will
// continue to execute consecutive modifiers when a modifier in the group encounters an
// error. The Group will then return all errors returned by each modifier after all
// modifiers have been executed.  When false, if an error is returned by a modifier, the
// error is returned by ModifyRequest/Response and no further modifiers are run.
// By default, error aggregation is disabled.
func (g *Group) SetAggregateErrors(aggerr bool) {
	g.aggregateErrors = aggerr
}

// AddRequestModifier adds a RequestModifier to the group's list of request modifiers.
func (g *Group) AddRequestModifier(reqmod martian.RequestModifier) {
	g.reqmu.Lock()
	defer g.reqmu.Unlock()

	g.reqmods = append(g.reqmods, reqmod)
}

// AddResponseModifier adds a ResponseModifier to the group's list of response modifiers.
func (g *Group) AddResponseModifier(resmod martian.ResponseModifier) {
	g.resmu.Lock()
	defer g.resmu.Unlock()

	g.resmods = append(g.resmods, resmod)
}

// ModifyRequest modifies the request. By default, aggregateErrors is false; if an error is
// returned by a RequestModifier the error is returned and no further modifiers are run. When
// aggregateErrors is set to true, the errors returned by each modifier in the group are
// aggregated.
func (g *Group) ModifyRequest(req *http.Request) error {
	log.Debugf("fifo.ModifyRequest: %s", req.URL)
	g.reqmu.RLock()
	defer g.reqmu.RUnlock()

	merr := martian.NewMultiError()

	for _, reqmod := range g.reqmods {
		if err := reqmod.ModifyRequest(req); err != nil {
			if g.aggregateErrors {
				merr.Add(err)
				continue
			}

			return err
		}
	}

	if merr.Empty() {
		return nil
	}

	return merr
}

// ModifyResponse modifies the request. By default, aggregateErrors is false; if an error is
// returned by a RequestModifier the error is returned and no further modifiers are run. When
// aggregateErrors is set to true, the errors returned by each modifier in the group are
// aggregated.
func (g *Group) ModifyResponse(res *http.Response) error {
	requ := ""
	if res.Request != nil {
		requ = res.Request.URL.String()
		log.Debugf("fifo.ModifyResponse: %s", requ)
	}
	g.resmu.RLock()
	defer g.resmu.RUnlock()

	merr := martian.NewMultiError()

	for _, resmod := range g.resmods {
		if err := resmod.ModifyResponse(res); err != nil {
			if g.aggregateErrors {
				merr.Add(err)
				continue
			}

			return err
		}
	}

	if merr.Empty() {
		return nil
	}

	return merr
}

// VerifyRequests returns a MultiError containing all the
// verification errors returned by request verifiers.
func (g *Group) VerifyRequests() error {
	log.Debugf("fifo.VerifyRequests()")
	g.reqmu.Lock()
	defer g.reqmu.Unlock()

	merr := martian.NewMultiError()
	for _, reqmod := range g.reqmods {
		reqv, ok := reqmod.(verify.RequestVerifier)
		if !ok {
			continue
		}

		if err := reqv.VerifyRequests(); err != nil {
			merr.Add(err)
		}
	}

	if merr.Empty() {
		return nil
	}

	return merr
}

// VerifyResponses returns a MultiError containing all the
// verification errors returned by response verifiers.
func (g *Group) VerifyResponses() error {
	log.Debugf("fifo.VerifyResponses()")
	g.resmu.Lock()
	defer g.resmu.Unlock()

	merr := martian.NewMultiError()
	for _, resmod := range g.resmods {
		resv, ok := resmod.(verify.ResponseVerifier)
		if !ok {
			continue
		}

		if err := resv.VerifyResponses(); err != nil {
			merr.Add(err)
		}
	}

	if merr.Empty() {
		return nil
	}

	return merr
}

// ResetRequestVerifications resets the state of the contained request verifiers.
func (g *Group) ResetRequestVerifications() {
	log.Debugf("fifo.ResetRequestVerifications()")
	g.reqmu.Lock()
	defer g.reqmu.Unlock()

	for _, reqmod := range g.reqmods {
		if reqv, ok := reqmod.(verify.RequestVerifier); ok {
			reqv.ResetRequestVerifications()
		}
	}
}

// ResetResponseVerifications resets the state of the contained request verifiers.
func (g *Group) ResetResponseVerifications() {
	log.Debugf("fifo.ResetResponseVerifications()")
	g.resmu.Lock()
	defer g.resmu.Unlock()

	for _, resmod := range g.resmods {
		if resv, ok := resmod.(verify.ResponseVerifier); ok {
			resv.ResetResponseVerifications()
		}
	}
}

// groupFromJSON builds a fifo.Group from JSON.
//
// Example JSON:
// {
//   "fifo.Group" : {
//     "scope": ["request", "result"],
//     "modifiers": [
//       { ... },
//       { ... },
//     ]
//   }
// }
func groupFromJSON(b []byte) (*parse.Result, error) {
	msg := &groupJSON{}
	if err := json.Unmarshal(b, msg); err != nil {
		return nil, err
	}

	g := NewGroup()
	if msg.AggregateErrors {
		g.SetAggregateErrors(true)
	}

	for _, m := range msg.Modifiers {
		r, err := parse.FromJSON(m)
		if err != nil {
			return nil, err
		}

		reqmod := r.RequestModifier()
		if reqmod != nil {
			g.AddRequestModifier(reqmod)
		}

		resmod := r.ResponseModifier()
		if resmod != nil {
			g.AddResponseModifier(resmod)
		}
	}

	return parse.NewResult(g, msg.Scope)
}