text:
/*
 * DO NOT EDIT.  THIS FILE IS GENERATED FROM ../../../dist/idl\nsIClassOfService.idl
 */

#ifndef __gen_nsIClassOfService_h__
#define __gen_nsIClassOfService_h__

#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif

/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif

/* starting interface:    nsIClassOfService */
#define NS_ICLASSOFSERVICE_IID_STR "1ccb58ec-5e07-4cf9-a30d-ac5490d23b41"

#define NS_ICLASSOFSERVICE_IID \
  {0x1ccb58ec, 0x5e07, 0x4cf9, \
    { 0xa3, 0x0d, 0xac, 0x54, 0x90, 0xd2, 0x3b, 0x41 }}

class NS_NO_VTABLE nsIClassOfService : public nsISupports {
 public:

  NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICLASSOFSERVICE_IID)

  /* attribute unsigned long classFlags; */
  NS_IMETHOD GetClassFlags(uint32_t *aClassFlags) = 0;
  NS_IMETHOD SetClassFlags(uint32_t aClassFlags) = 0;

  /* void clearClassFlags (in unsigned long flags); */
  NS_IMETHOD ClearClassFlags(uint32_t flags) = 0;

  /* void addClassFlags (in unsigned long flags); */
  NS_IMETHOD AddClassFlags(uint32_t flags) = 0;

  enum {
    Leader = 1U,
    Follower = 2U,
    Speculative = 4U,
    Background = 8U,
    Unblocked = 16U
  };

};

  NS_DEFINE_STATIC_IID_ACCESSOR(nsIClassOfService, NS_ICLASSOFSERVICE_IID)

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSICLASSOFSERVICE \
  NS_IMETHOD GetClassFlags(uint32_t *aClassFlags) override; \
  NS_IMETHOD SetClassFlags(uint32_t aClassFlags) override; \
  NS_IMETHOD ClearClassFlags(uint32_t flags) override; \
  NS_IMETHOD AddClassFlags(uint32_t flags) override; \

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSICLASSOFSERVICE(_to) \
  NS_IMETHOD GetClassFlags(uint32_t *aClassFlags) override { return _to GetClassFlags(aClassFlags); } \
  NS_IMETHOD SetClassFlags(uint32_t aClassFlags) override { return _to SetClassFlags(aClassFlags); } \
  NS_IMETHOD ClearClassFlags(uint32_t flags) override { return _to ClearClassFlags(flags); } \
  NS_IMETHOD AddClassFlags(uint32_t flags) override { return _to AddClassFlags(flags); } \

/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSICLASSOFSERVICE(_to) \
  NS_IMETHOD GetClassFlags(uint32_t *aClassFlags) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetClassFlags(aClassFlags); } \
  NS_IMETHOD SetClassFlags(uint32_t aClassFlags) override { return !_to ? NS_ERROR_NULL_POINTER : _to->SetClassFlags(aClassFlags); } \
  NS_IMETHOD ClearClassFlags(uint32_t flags) override { return !_to ? NS_ERROR_NULL_POINTER : _to->ClearClassFlags(flags); } \
  NS_IMETHOD AddClassFlags(uint32_t flags) override { return !_to ? NS_ERROR_NULL_POINTER : _to->AddClassFlags(flags); } \

#if 0
/* Use the code below as a template for the implementation class for this interface. */

/* Header file */
class nsClassOfService : public nsIClassOfService
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSICLASSOFSERVICE

  nsClassOfService();

private:
  ~nsClassOfService();

protected:
  /* additional members */
};

/* Implementation file */
NS_IMPL_ISUPPORTS(nsClassOfService, nsIClassOfService)

nsClassOfService::nsClassOfService()
{
  /* member initializers and constructor code */
}

nsClassOfService::~nsClassOfService()
{
  /* destructor code */
}

/* attribute unsigned long classFlags; */
NS_IMETHODIMP nsClassOfService::GetClassFlags(uint32_t *aClassFlags)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsClassOfService::SetClassFlags(uint32_t aClassFlags)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void clearClassFlags (in unsigned long flags); */
NS_IMETHODIMP nsClassOfService::ClearClassFlags(uint32_t flags)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void addClassFlags (in unsigned long flags); */
NS_IMETHODIMP nsClassOfService::AddClassFlags(uint32_t flags)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* End of implementation class template. */
#endif

#endif /* __gen_nsIClassOfService_h__ */


text:
"""Unit tests for contextlib.py, and other context managers."""

import sys
import os
import decimal
import tempfile
import unittest
import threading
from contextlib import *  # Tests __all__
from test import test_support

class ContextManagerTestCase(unittest.TestCase):

    def test_contextmanager_plain(self):
        state = []
        @contextmanager
        def woohoo():
            state.append(1)
            yield 42
            state.append(999)
        with woohoo() as x:
            self.assertEqual(state, [1])
            self.assertEqual(x, 42)
            state.append(x)
        self.assertEqual(state, [1, 42, 999])

    def test_contextmanager_finally(self):
        state = []
        @contextmanager
        def woohoo():
            state.append(1)
            try:
                yield 42
            finally:
                state.append(999)
        try:
            with woohoo() as x:
                self.assertEqual(state, [1])
                self.assertEqual(x, 42)
                state.append(x)
                raise ZeroDivisionError()
        except ZeroDivisionError:
            pass
        else:
            self.fail("Expected ZeroDivisionError")
        self.assertEqual(state, [1, 42, 999])

    def test_contextmanager_no_reraise(self):
        @contextmanager
        def whee():
            yield
        ctx = whee()
        ctx.__enter__()
        # Calling __exit__ should not result in an exception
        self.failIf(ctx.__exit__(TypeError, TypeError("foo"), None))

    def test_contextmanager_trap_yield_after_throw(self):
        @contextmanager
        def whoo():
            try:
                yield
            except:
                yield
        ctx = whoo()
        ctx.__enter__()
        self.assertRaises(
            RuntimeError, ctx.__exit__, TypeError, TypeError("foo"), None
        )

    def test_contextmanager_except(self):
        state = []
        @contextmanager
        def woohoo():
            state.append(1)
            try:
                yield 42
            except ZeroDivisionError, e:
                state.append(e.args[0])
                self.assertEqual(state, [1, 42, 999])
        with woohoo() as x:
            self.assertEqual(state, [1])
            self.assertEqual(x, 42)
            state.append(x)
            raise ZeroDivisionError(999)
        self.assertEqual(state, [1, 42, 999])

    def test_contextmanager_attribs(self):
        def attribs(**kw):
            def decorate(func):
                for k,v in kw.items():
                    setattr(func,k,v)
                return func
            return decorate
        @contextmanager
        @attribs(foo='bar')
        def baz(spam):
            """Whee!"""
        self.assertEqual(baz.__name__,'baz')
        self.assertEqual(baz.foo, 'bar')
        self.assertEqual(baz.__doc__, "Whee!")

class NestedTestCase(unittest.TestCase):

    # XXX This needs more work

    def test_nested(self):
        @contextmanager
        def a():
            yield 1
        @contextmanager
        def b():
            yield 2
        @contextmanager
        def c():
            yield 3
        with nested(a(), b(), c()) as (x, y, z):
            self.assertEqual(x, 1)
            self.assertEqual(y, 2)
            self.assertEqual(z, 3)

    def test_nested_cleanup(self):
        state = []
        @contextmanager
        def a():
            state.append(1)
            try:
                yield 2
            finally:
                state.append(3)
        @contextmanager
        def b():
            state.append(4)
            try:
                yield 5
            finally:
                state.append(6)
        try:
            with nested(a(), b()) as (x, y):
                state.append(x)
                state.append(y)
                1 // 0
        except ZeroDivisionError:
            self.assertEqual(state, [1, 4, 2, 5, 6, 3])
        else:
            self.fail("Didn't raise ZeroDivisionError")

    def test_nested_right_exception(self):
        state = []
        @contextmanager
        def a():
            yield 1
        class b(object):
            def __enter__(self):
                return 2
            def __exit__(self, *exc_info):
                try:
                    raise Exception()
                except:
                    pass
        try:
            with nested(a(), b()) as (x, y):
                1 // 0
        except ZeroDivisionError:
            self.assertEqual((x, y), (1, 2))
        except Exception:
            self.fail("Reraised wrong exception")
        else:
            self.fail("Didn't raise ZeroDivisionError")

    def test_nested_b_swallows(self):
        @contextmanager
        def a():
            yield
        @contextmanager
        def b():
            try:
                yield
            except:
                # Swallow the exception
                pass
        try:
            with nested(a(), b()):
                1 // 0
        except ZeroDivisionError:
            self.fail("Didn't swallow ZeroDivisionError")

    def test_nested_break(self):
        @contextmanager
        def a():
            yield
        state = 0
        while True:
            state += 1
            with nested(a(), a()):
                break
            state += 10
        self.assertEqual(state, 1)

    def test_nested_continue(self):
        @contextmanager
        def a():
            yield
        state = 0
        while state < 3:
            state += 1
            with nested(a(), a()):
                continue
            state += 10
        self.assertEqual(state, 3)

    def test_nested_return(self):
        @contextmanager
        def a():
            try:
                yield
            except:
                pass
        def foo():
            with nested(a(), a()):
                return 1
            return 10
        self.assertEqual(foo(), 1)

class ClosingTestCase(unittest.TestCase):

    # XXX This needs more work

    def test_closing(self):
        state = []
        class C:
            def close(self):
                state.append(1)
        x = C()
        self.assertEqual(state, [])
        with closing(x) as y:
            self.assertEqual(x, y)
        self.assertEqual(state, [1])

    def test_closing_error(self):
        state = []
        class C:
            def close(self):
                state.append(1)
        x = C()
        self.assertEqual(state, [])
        try:
            with closing(x) as y:
                self.assertEqual(x, y)
                1 // 0
        except ZeroDivisionError:
            self.assertEqual(state, [1])
        else:
            self.fail("Didn't raise ZeroDivisionError")

class FileContextTestCase(unittest.TestCase):

    def testWithOpen(self):
        tfn = tempfile.mktemp()
        try:
            f = None
            with open(tfn, "w") as f:
                self.failIf(f.closed)
                f.write("Booh\n")
            self.failUnless(f.closed)
            f = None
            try:
                with open(tfn, "r") as f:
                    self.failIf(f.closed)
                    self.assertEqual(f.read(), "Booh\n")
                    1 // 0
            except ZeroDivisionError:
                self.failUnless(f.closed)
            else:
                self.fail("Didn't raise ZeroDivisionError")
        finally:
            try:
                os.remove(tfn)
            except os.error:
                pass

class LockContextTestCase(unittest.TestCase):

    def boilerPlate(self, lock, locked):
        self.failIf(locked())
        with lock:
            self.failUnless(locked())
        self.failIf(locked())
        try:
            with lock:
                self.failUnless(locked())
                1 // 0
        except ZeroDivisionError:
            self.failIf(locked())
        else:
            self.fail("Didn't raise ZeroDivisionError")

    def testWithLock(self):
        lock = threading.Lock()
        self.boilerPlate(lock, lock.locked)

    def testWithRLock(self):
        lock = threading.RLock()
        self.boilerPlate(lock, lock._is_owned)

    def testWithCondition(self):
        lock = threading.Condition()
        def locked():
            return lock._is_owned()
        self.boilerPlate(lock, locked)

    def testWithSemaphore(self):
        lock = threading.Semaphore()
        def locked():
            if lock.acquire(False):
                lock.release()
                return False
            else:
                return True
        self.boilerPlate(lock, locked)

    def testWithBoundedSemaphore(self):
        lock = threading.BoundedSemaphore()
        def locked():
            if lock.acquire(False):
                lock.release()
                return False
            else:
                return True
        self.boilerPlate(lock, locked)

# This is needed to make the test actually run under regrtest.py!
def test_main():
    test_support.run_unittest(__name__)

if __name__ == "__main__":
    test_main()

redpajama_set_name: RedPajamaGithub


text:
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
 *
 * LibTomCrypt is a library that provides various cryptographic
 * algorithms in a highly modular and flexible manner.
 *
 * The library is free for all purposes without any express
 * guarantee it works.
 */
#include "tomcrypt_private.h"

/**
   @file lrw_decrypt.c
   LRW_MODE implementation, Decrypt blocks, Tom St Denis
*/

#ifdef LTC_LRW_MODE

/**
  LRW decrypt blocks
  @param ct     The ciphertext
  @param pt     [out] The plaintext
  @param len    The length in octets, must be a multiple of 16
  @param lrw    The LRW state
*/
int lrw_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_LRW *lrw)
{
   int err;

   LTC_ARGCHK(pt  != NULL);
   LTC_ARGCHK(ct  != NULL);
   LTC_ARGCHK(lrw != NULL);

   if ((err = cipher_is_valid(lrw->cipher)) != CRYPT_OK) {
      return err;
   }

   if (cipher_descriptor[lrw->cipher].accel_lrw_decrypt != NULL) {
      return cipher_descriptor[lrw->cipher].accel_lrw_decrypt(ct, pt, len, lrw->IV, lrw->tweak, &lrw->key);
   }

   return lrw_process(ct, pt, len, LRW_DECRYPT, lrw);
}

#endif

/* ref:         HEAD -> develop */
/* git commit:  9c0d7085234bd6baba2ab8fd9eee62254599341c */
/* commit time: 2018-10-15 10:51:17 +0200 */


text:
permalink: /404.html
---
<!DOCTYPE html>

    <meta charset="utf-8" />

    <title>Oh great... you've only gone and broken me</title>

     <meta name="description" content="Daniel Crisp is a freelance front end web developer and designer based in London, England." />

    <meta name="robots" content="noindex, follow" />

    <link href="css/master.css" rel="stylesheet" media="all" />

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

Oh great...

You've only gone and broken me

Take me home

            <canvas width="990" height="600" id="error"></canvas>


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Coniothyrium acantholimonis Kalymb.

### Remarks
null


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity"
    >
    <EditText
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:hint="@string/login"
        android:textAlignment="center"
        android:id="@+id/insert_user"
        />
    <EditText
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:hint="@string/password"
        android:inputType="textPassword"
        android:textAlignment="center"
        android:id="@+id/insert_pw"
        />
    <Button
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/login"
        android:onClick="bt_login"
        />
    <Button
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/register"
        android:onClick="bt_register"
        />
</LinearLayout>


text:
require 'getoptlong'

module Af::OptionParser
  # Subclasses Getoptlong from the Ruby standard library.
  # Docs: http://www.ruby-doc.org/stdlib-1.9.3/libdoc/getoptlong/rdoc/GetoptLong.html.
  # Source: https://github.com/ruby/ruby/blob/trunk/lib/getoptlong.rb.
  class GetOptions < GetoptLong

    # Local constants which map to superclass argument types.
    ARGUMENT_FLAGS = [
      NO_ARGUMENT = GetoptLong::NO_ARGUMENT,
      REQUIRED_ARGUMENT = GetoptLong::REQUIRED_ARGUMENT,
      OPTIONAL_ARGUMENT = GetoptLong::OPTIONAL_ARGUMENT
    ]

    # Instantiate a new long command line option parser with a hash of switches.
    #
    # *Arguments*
    #   * switches - optional hash of command line switches, with long switch as
    #       key to a set of options:
    #         :short => <optional short switch>
    #         :argument => <constant arg type>
    #         :environment_variable => <how do these work???>
    #         :note => <arg description>
    def initialize(declared_options = [])
      getopt_options = []
      argv_additions = []

      # Iterate through all of the options.
      declared_options.each do |option|
        # Set aside
        if option.environment_variable.present?
          # Add enviroment variables to the front of ARGV.
          if ENV[option.environment_variable]
            argv_additions << option.long_name
            unless ENV[option.environment_variable].empty?
              # if the envvar is empty we assume this is a switch (no parameter)
              argv_additions << ENV[option.environment_variable]
            end
          end
        end

        # Convert hash into array, in format expected by Getoptlong#new.
        # Example: ['--foo', '-f', GetoptLong::NO_ARGUMENT]
        options = []
        options << option.long_name
        if (option.short_name)
          options << option.short_name
        end
        options << option.requirements
        getopt_options << options
      end

      # add any ARGVs to our list
      for arg in ARGV do
        argv_additions << arg
      end

      # Rewrite ARGV with environment variable with the new list.
      argv_additions.each_with_index { |v,i| ARGV[i] = v }

      super(*getopt_options)
    end
  end
end


text:
layout: default
---

Canova Construction

Home

Projects

Why Us?

Contact

Joseph Canova started Canova Construction in 1982 and the business primarily
        dealt with the renovation of investment properties and building spec houses.
        After completing construction of a new home for the CFO of F.W. Webb, Canova
        Construction moved into the development of industrial facilities for the Webb
        companies. It was in this corporate world of budget and time restraints that Joe
        learned how to successfully manage large construction projects. Later the
        direction of the company changed its focus to building and remodeling residential
        homes in the North shore area.

Today we are a small company with the ability to give a high degree of
        individual attention to every project. We specialize in small home construction
        as well as complete home renovation-to include condominium renovations as well as
        additions.

I know I can always depend on Canova Construction. Not only are they
          extremely knowledgeable about both the architectural and contractual aspects of
          the business, they have a great natural sense for what the client is looking to
          do.

          Berner Architects

Our office has built many successful projects with Canova. We continue to
          recommend him for our clients' consideration.

          Robert Zarelli Architects

      canovaconstruction.net © 2013
      Canova Construction


text:
package satori.problem.ui;

import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

import satori.common.SListener0;
import satori.common.SListener1;
import satori.common.SView;
import satori.common.ui.STabPane;
import satori.common.ui.STabbedPane;
import satori.common.ui.STabs;
import satori.main.SFrame;
import satori.problem.STestSuiteSnap;
import satori.problem.impl.SProblemImpl;
import satori.problem.impl.STestSuiteImpl;
import satori.task.STaskException;
import satori.task.STaskHandler;
import satori.task.STaskManager;
import satori.test.STestSnap;
import satori.test.impl.STestImpl;
import satori.test.impl.STestSuiteBase;

public class SProblemPane implements STabPane, SView {
	private final SProblemImpl problem;
	private final STabs parent;

	private STabbedPane tabs;
	private SProblemInfoPane info_pane;
	private STestListPane test_list_pane;
	private STestSuiteListPane suite_list_pane;
	private SView tab_view;

	private JScrollPane scroll_pane;
	private JComponent main_pane;
	private JLabel status_label;
	private JComponent button_pane;
	private JButton save_button, reload_button, delete_button, close_button;

	private SProblemPane(SProblemImpl problem, STabs parent) {
		this.problem = problem;
		this.parent = parent;
		initialize();
	}

	@Override public JComponent getPane() { return scroll_pane; }

	private static class TabModel implements STabs.TabModel {
		private final SProblemImpl problem;
		public TabModel(SProblemImpl problem) { this.problem = problem; }
		@Override public String getTitle() {
			return problem.getName().isEmpty() ? "(Problem)" : problem.getName();
		}
	}
	public static SProblemPane open(SProblemImpl problem, STabs parent) {
		SProblemPane self = new SProblemPane(problem, parent);
		problem.setTestListListener(self.test_list_pane);
		problem.setTestSuiteListListener(self.suite_list_pane);
		problem.addView(self);
		self.tab_view = parent.openPane(new TabModel(problem), self);
		problem.addView(self.tab_view);
		self.tabs.addParentView(self.tab_view);
		return self;
	}
	@Override public boolean hasUnsavedData() {
		return problem.isModified() || tabs.hasUnsavedData();
	}
	@Override public void close() {
		problem.close();
	}

	private final SListener0 new_test_listener = new SListener0() {
		@Override public void call() {
			List<STestImpl> tests = Collections.singletonList(STestImpl.createNew(problem));
			STestSuitePane.openTests(tabs, problem, STestSuiteBase.createNew(tests));
		}
	};
	private final SListener1<List<STestSnap>> open_tests_listener = new SListener1<List<STestSnap>>() {
		@Override public void call(List<STestSnap> snaps) {
			List<STestImpl> tests = new ArrayList<STestImpl>();
			STaskHandler handler = STaskManager.getHandler();
			try { for (STestSnap snap : snaps) {
				try { tests.add(STestImpl.createRemote(handler, problem, snap)); }
				catch(STaskException ex) { return; }
			} } finally { handler.close(); }
			STestSuitePane.openTests(tabs, problem, STestSuiteBase.createNew(tests));
		}
	};
	private final SListener0 new_suite_listener = new SListener0() {
		@Override public void call() {
			STestSuiteImpl suite = STestSuiteImpl.createNew(problem, STestSuiteBase.createNew());
			STestSuitePane.openTestSuite(tabs, problem, suite);
		}
	};
	private final SListener1<STestSuiteSnap> open_suite_listener = new SListener1<STestSuiteSnap>() {
		@Override public void call(STestSuiteSnap snap) {
			STestSuiteImpl suite;
			STaskHandler handler = STaskManager.getHandler();
			try { suite = STestSuiteImpl.create(handler, snap, problem); }
			catch(STaskException ex) { return; }
			finally { handler.close(); }
			STestSuitePane.openTestSuite(tabs, problem, suite);
		}
	};

	private void saveRequest() {
		STaskHandler handler = STaskManager.getHandler();
		try { if (problem.isRemote()) problem.save(handler); else problem.create(handler); }
		catch(STaskException ex) {}
		finally { handler.close(); }
	}
	private void reloadRequest() {
		if (!problem.isRemote()) return;
		STaskHandler handler = STaskManager.getHandler();
		try { problem.reload(handler); }
		catch(STaskException ex) {}
		finally { handler.close(); }
	}
	private void deleteRequest() {
		if (!problem.isRemote() || !SFrame.showWarningDialog("The problem will be deleted.")) return;
		STaskHandler handler = STaskManager.getHandler();
		try { problem.delete(handler); }
		catch(STaskException ex) {}
		finally { handler.close(); }
	}
	private void closeRequest() {
		if (hasUnsavedData() && !SFrame.showWarningDialog("This tab contains unsaved data.")) return;
		close();
		parent.closePane(this);
	}

	private void initialize() {
		tabs = new STabbedPane();
		info_pane = new SProblemInfoPane(problem);
		test_list_pane = new STestListPane(new_test_listener, open_tests_listener);
		suite_list_pane = new STestSuiteListPane(new_suite_listener, open_suite_listener);

		main_pane = new JPanel(new GridBagLayout());
		GridBagConstraints c = new GridBagConstraints();
		c.gridx = 0; c.gridy = 0; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; c.weighty = 0.0; c.gridwidth = 2;
		status_label = new JLabel();
		main_pane.add(status_label, c);
		c.gridx = 0; c.gridy = 1; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; c.weighty = 0.0; c.gridwidth = 2;
		button_pane = new Box(BoxLayout.X_AXIS);
		save_button = new JButton("Save");
		save_button.addActionListener(new ActionListener() {
			@Override public void actionPerformed(ActionEvent e) { saveRequest(); }
		});
		button_pane.add(save_button);
		reload_button = new JButton("Reload");
		reload_button.addActionListener(new ActionListener() {
			@Override public void actionPerformed(ActionEvent e) { reloadRequest(); }
		});
		button_pane.add(reload_button);
		delete_button = new JButton("Delete");
		delete_button.addActionListener(new ActionListener() {
			@Override public void actionPerformed(ActionEvent e) { deleteRequest(); }
		});
		button_pane.add(delete_button);
		button_pane.add(Box.createHorizontalStrut(5));
		close_button = new JButton("Close");
		close_button.addActionListener(new ActionListener() {
			@Override public void actionPerformed(ActionEvent e) { closeRequest(); }
		});
		button_pane.add(close_button);
		button_pane.add(Box.createHorizontalGlue());
		main_pane.add(button_pane, c);
		info_pane.getPane().setBorder(BorderFactory.createTitledBorder("Problem properties"));
		c.gridx = 0; c.gridy = 2; c.fill = GridBagConstraints.BOTH; c.weightx = 1.0; c.weighty = 0.0; c.gridwidth = 2;
		main_pane.add(info_pane.getPane(), c);
		test_list_pane.getPane().setBorder(BorderFactory.createTitledBorder("Tests"));
		test_list_pane.getPane().setPreferredSize(new Dimension(320, 110));
		c.gridx = 0; c.gridy = 3; c.fill = GridBagConstraints.BOTH; c.weightx = 0.5; c.weighty = 0.4; c.gridwidth = 1;
		main_pane.add(test_list_pane.getPane(), c);
		suite_list_pane.getPane().setBorder(BorderFactory.createTitledBorder("Test suites"));
		suite_list_pane.getPane().setPreferredSize(new Dimension(320, 110));
		c.gridx = 1; c.gridy = 3; c.fill = GridBagConstraints.BOTH; c.weightx = 0.5; c.weighty = 0.4; c.gridwidth = 1;
		main_pane.add(suite_list_pane.getPane(), c);
		tabs.getPane().setPreferredSize(new Dimension(640, 370));
		c.gridx = 0; c.gridy = 4; c.fill = GridBagConstraints.BOTH; c.weightx = 1.0; c.weighty = 0.6; c.gridwidth = 2;
		main_pane.add(tabs.getPane(), c);
		scroll_pane = new JScrollPane(main_pane);
		update();
	}

	@Override public void update() {
		reload_button.setEnabled(problem.isRemote());
		delete_button.setEnabled(problem.isRemote());
		String status_text = "";
		if (problem.isRemote()) {
			if (problem.isOutdated()) status_text = "outdated";
		} else {
			if (problem.isOutdated()) status_text = "deleted";
			else status_text = "new";
		}
		if (problem.isModified()) {
			if (!status_text.isEmpty()) status_text += ", ";
			status_text += "modified";
		}
		if (status_text.isEmpty()) status_text = "saved";
		status_label.setText("Status: " + status_text);
		info_pane.update();
	}
}


text:
<!DOCTYPE html>

  <meta charset='utf-8'>

  <title>Story Line</title>

  <link rel='stylesheet' href='js/libs/jquery-timeline/jquery.timeline.css'>
  <link rel='stylesheet' href='css/storyLine.css'>

      <button id="addButton">Add Point</button>
      <button id="changeButton">Change Layout</button>
      <button id="autoButton">Auto-Adjust Timeline</button>


text:
package br.com.objectos.jabuticava.boleto;

import com.google.inject.ImplementedBy;

/**
 * @author marcio.endo@objectos.com.br (Marcio Endo)
 */
@ImplementedBy(ContextsGuice.class)
interface Contexts {

  Object of(Boleto boleto);

  Object inlineCssOf(Boleto boleto);

  Object pageOf(Boleto boleto);

}


text:
package io.gatling.liferay.service.base;

import io.gatling.liferay.service.SimulationLocalServiceUtil;

import java.util.Arrays;

/**
 * @author Brian Wing Shun Chan
 * @generated
 */
public class SimulationLocalServiceClpInvoker {
    private String _methodName0;
    private String[] _methodParameterTypes0;
    private String _methodName1;
    private String[] _methodParameterTypes1;
    private String _methodName2;
    private String[] _methodParameterTypes2;
    private String _methodName3;
    private String[] _methodParameterTypes3;
    private String _methodName4;
    private String[] _methodParameterTypes4;
    private String _methodName5;
    private String[] _methodParameterTypes5;
    private String _methodName6;
    private String[] _methodParameterTypes6;
    private String _methodName7;
    private String[] _methodParameterTypes7;
    private String _methodName8;
    private String[] _methodParameterTypes8;
    private String _methodName9;
    private String[] _methodParameterTypes9;
    private String _methodName10;
    private String[] _methodParameterTypes10;
    private String _methodName11;
    private String[] _methodParameterTypes11;
    private String _methodName12;
    private String[] _methodParameterTypes12;
    private String _methodName13;
    private String[] _methodParameterTypes13;
    private String _methodName14;
    private String[] _methodParameterTypes14;
    private String _methodName15;
    private String[] _methodParameterTypes15;
    private String _methodName68;
    private String[] _methodParameterTypes68;
    private String _methodName69;
    private String[] _methodParameterTypes69;
    private String _methodName74;
    private String[] _methodParameterTypes74;
    private String _methodName75;
    private String[] _methodParameterTypes75;
    private String _methodName76;
    private String[] _methodParameterTypes76;

    public SimulationLocalServiceClpInvoker() {
        _methodName0 = "addSimulation";

        _methodParameterTypes0 = new String[] {
                "io.gatling.liferay.model.Simulation"
            };

        _methodName1 = "createSimulation";

        _methodParameterTypes1 = new String[] { "long" };

        _methodName2 = "deleteSimulation";

        _methodParameterTypes2 = new String[] { "long" };

        _methodName3 = "deleteSimulation";

        _methodParameterTypes3 = new String[] {
                "io.gatling.liferay.model.Simulation"
            };

        _methodName4 = "dynamicQuery";

        _methodParameterTypes4 = new String[] {  };

        _methodName5 = "dynamicQuery";

        _methodParameterTypes5 = new String[] {
                "com.liferay.portal.kernel.dao.orm.DynamicQuery"
            };

        _methodName6 = "dynamicQuery";

        _methodParameterTypes6 = new String[] {
                "com.liferay.portal.kernel.dao.orm.DynamicQuery", "int", "int"
            };

        _methodName7 = "dynamicQuery";

        _methodParameterTypes7 = new String[] {
                "com.liferay.portal.kernel.dao.orm.DynamicQuery", "int", "int",
                "com.liferay.portal.kernel.util.OrderByComparator"
            };

        _methodName8 = "dynamicQueryCount";

        _methodParameterTypes8 = new String[] {
                "com.liferay.portal.kernel.dao.orm.DynamicQuery"
            };

        _methodName9 = "dynamicQueryCount";

        _methodParameterTypes9 = new String[] {
                "com.liferay.portal.kernel.dao.orm.DynamicQuery",
                "com.liferay.portal.kernel.dao.orm.Projection"
            };

        _methodName10 = "fetchSimulation";

        _methodParameterTypes10 = new String[] { "long" };

        _methodName11 = "getSimulation";

        _methodParameterTypes11 = new String[] { "long" };

        _methodName12 = "getPersistedModel";

        _methodParameterTypes12 = new String[] { "java.io.Serializable" };

        _methodName13 = "getSimulations";

        _methodParameterTypes13 = new String[] { "int", "int" };

        _methodName14 = "getSimulationsCount";

        _methodParameterTypes14 = new String[] {  };

        _methodName15 = "updateSimulation";

        _methodParameterTypes15 = new String[] {
                "io.gatling.liferay.model.Simulation"
            };

        _methodName68 = "getBeanIdentifier";

        _methodParameterTypes68 = new String[] {  };

        _methodName69 = "setBeanIdentifier";

        _methodParameterTypes69 = new String[] { "java.lang.String" };

        _methodName74 = "createDefaultSimulation";

        _methodParameterTypes74 = new String[] {  };

        _methodName75 = "getByName";

        _methodParameterTypes75 = new String[] { "java.lang.String" };

        _methodName76 = "isNameUnique";

        _methodParameterTypes76 = new String[] { "java.lang.String" };
    }

    public Object invokeMethod(String name, String[] parameterTypes,
        Object[] arguments) throws Throwable {
        if (_methodName0.equals(name) &&
                Arrays.deepEquals(_methodParameterTypes0, parameterTypes)) {
            return SimulationLocalServiceUtil.addSimulation((io.gatling.liferay.model.Simulation) arguments[0]);
        }

        if (_methodName1.equals(name) &&
                Arrays.deepEquals(_methodParameterTypes1, parameterTypes)) {
            return SimulationLocalServiceUtil.createSimulation(((Long) arguments[0]).longValue());
        }

        if (_methodName2.equals(name) &&
                Arrays.deepEquals(_methodParameterTypes2, parameterTypes)) {
            return SimulationLocalServiceUtil.deleteSimulation(((Long) arguments[0]).longValue());
        }

        if (_methodName3.equals(name) &&
                Arrays.deepEquals(_methodParameterTypes3, parameterTypes)) {
            return SimulationLocalServiceUtil.deleteSimulation((io.gatling.liferay.model.Simulation) arguments[0]);
        }

        if (_methodName4.equals(name) &&
                Arrays.deepEquals(_methodParameterTypes4, parameterTypes)) {
            return SimulationLocalServiceUtil.dynamicQuery();
        }

        if (_methodName5.equals(name) &&
                Arrays.deepEquals(_methodParameterTypes5, parameterTypes)) {
            return SimulationLocalServiceUtil.dynamicQuery((com.liferay.portal.kernel.dao.orm.DynamicQuery) arguments[0]);
        }

        if (_methodName6.equals(name) &&
                Arrays.deepEquals(_methodParameterTypes6, parameterTypes)) {
            return SimulationLocalServiceUtil.dynamicQuery((com.liferay.portal.kernel.dao.orm.DynamicQuery) arguments[0],
                ((Integer) arguments[1]).intValue(),
                ((Integer) arguments[2]).intValue());
        }

        if (_methodName7.equals(name) &&
                Arrays.deepEquals(_methodParameterTypes7, parameterTypes)) {
            return SimulationLocalServiceUtil.dynamicQuery((com.liferay.portal.kernel.dao.orm.DynamicQuery) arguments[0],
                ((Integer) arguments[1]).intValue(),
                ((Integer) arguments[2]).intValue(),
                (com.liferay.portal.kernel.util.OrderByComparator) arguments[3]);
        }

        if (_methodName8.equals(name) &&
                Arrays.deepEquals(_methodParameterTypes8, parameterTypes)) {
            return SimulationLocalServiceUtil.dynamicQueryCount((com.liferay.portal.kernel.dao.orm.DynamicQuery) arguments[0]);
        }

        if (_methodName9.equals(name) &&
                Arrays.deepEquals(_methodParameterTypes9, parameterTypes)) {
            return SimulationLocalServiceUtil.dynamicQueryCount((com.liferay.portal.kernel.dao.orm.DynamicQuery) arguments[0],
                (com.liferay.portal.kernel.dao.orm.Projection) arguments[1]);
        }

        if (_methodName10.equals(name) &&
                Arrays.deepEquals(_methodParameterTypes10, parameterTypes)) {
            return SimulationLocalServiceUtil.fetchSimulation(((Long) arguments[0]).longValue());
        }

        if (_methodName11.equals(name) &&
                Arrays.deepEquals(_methodParameterTypes11, parameterTypes)) {
            return SimulationLocalServiceUtil.getSimulation(((Long) arguments[0]).longValue());
        }

        if (_methodName12.equals(name) &&
                Arrays.deepEquals(_methodParameterTypes12, parameterTypes)) {
            return SimulationLocalServiceUtil.getPersistedModel((java.io.Serializable) arguments[0]);
        }

        if (_methodName13.equals(name) &&
                Arrays.deepEquals(_methodParameterTypes13, parameterTypes)) {
            return SimulationLocalServiceUtil.getSimulations(((Integer) arguments[0]).intValue(),
                ((Integer) arguments[1]).intValue());
        }

        if (_methodName14.equals(name) &&
                Arrays.deepEquals(_methodParameterTypes14, parameterTypes)) {
            return SimulationLocalServiceUtil.getSimulationsCount();
        }

        if (_methodName15.equals(name) &&
                Arrays.deepEquals(_methodParameterTypes15, parameterTypes)) {
            return SimulationLocalServiceUtil.updateSimulation((io.gatling.liferay.model.Simulation) arguments[0]);
        }

        if (_methodName68.equals(name) &&
                Arrays.deepEquals(_methodParameterTypes68, parameterTypes)) {
            return SimulationLocalServiceUtil.getBeanIdentifier();
        }

        if (_methodName69.equals(name) &&
                Arrays.deepEquals(_methodParameterTypes69, parameterTypes)) {
            SimulationLocalServiceUtil.setBeanIdentifier((java.lang.String) arguments[0]);

            return null;
        }

        if (_methodName74.equals(name) &&
                Arrays.deepEquals(_methodParameterTypes74, parameterTypes)) {
            return SimulationLocalServiceUtil.createDefaultSimulation();
        }

        if (_methodName75.equals(name) &&
                Arrays.deepEquals(_methodParameterTypes75, parameterTypes)) {
            return SimulationLocalServiceUtil.getByName((java.lang.String) arguments[0]);
        }

        if (_methodName76.equals(name) &&
                Arrays.deepEquals(_methodParameterTypes76, parameterTypes)) {
            return SimulationLocalServiceUtil.isNameUnique((java.lang.String) arguments[0]);
        }

        throw new UnsupportedOperationException();
    }
}


text:
package org.commonjava.maven.ext.common.util;

import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.read.ListAppender;
import org.commonjava.maven.atlas.ident.ref.ProjectRef;
import org.commonjava.maven.atlas.ident.ref.SimpleProjectRef;
import org.hamcrest.Matchers;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.contrib.java.lang.system.SystemOutRule;
import org.slf4j.LoggerFactory;

public class WildcardMapTest
{
    private WildcardMap<String> map;
    private ListAppender<ILoggingEvent> m_listAppender;

    @Rule
    public final SystemOutRule systemOutRule = new SystemOutRule().enableLog().muteForSuccessfulTests();

    @Before
    public void setUp()
    {
        m_listAppender = new ListAppender<>();
        m_listAppender.start();

        Logger root = (Logger) LoggerFactory.getLogger(WildcardMap.class);
        root.addAppender(m_listAppender);

        map = new WildcardMap<>();
    }

    @After
    public void tearDown()
    {
        Logger root = (Logger) LoggerFactory.getLogger(WildcardMap.class);
        root.detachAppender(m_listAppender);
    }

    @Test
    public void testContainsKey()
    {
        map.put( SimpleProjectRef.parse( "org.group:new-artifact" ), "1.2");

        Assert.assertFalse( map.containsKey( SimpleProjectRef.parse( "org.group:*" )));
        Assert.assertFalse( map.containsKey( SimpleProjectRef.parse( "org.group:old-artifact" )));
    }

    @Test
    public void testGet()
    {
        final String value = "1.2";
        ProjectRef key1 = SimpleProjectRef.parse( "org.group:new-artifact" );
        ProjectRef key2 = SimpleProjectRef.parse( "org.group:new-new-artifact" );

        map.put(key1, value);
        map.put(key2, value);

        Assert.assertEquals( value, map.get( key1 ) );
        Assert.assertEquals( value, map.get( key2 ) );
    }

    @Test
    public void testGetSingle()
    {
        final String value = "1.2";

        map.put( SimpleProjectRef.parse( "org.group:new-artifact" ), value);

        Assert.assertNotEquals( value, map.get( SimpleProjectRef.parse( "org.group:i-dont-exist-artifact" ) ) );
    }

    @Test
    public void testPut()
    {
        ProjectRef key = SimpleProjectRef.parse( "foo:bar" );

        map.put(key, "value");
        Assert.assertTrue( "Should have retrieved value", map.containsKey( key));
    }

    @Test
    public void testPutWildcard()
    {
        ProjectRef key1 = SimpleProjectRef.parse( "org.group:*" );
        ProjectRef key2 = SimpleProjectRef.parse( "org.group:artifact" );
        ProjectRef key3 = SimpleProjectRef.parse( "org.group:new-artifact" );

        map.put(key1, "1.1");

        Assert.assertTrue( "Should have retrieved wildcard value", map.containsKey( key2));
        Assert.assertTrue( "Should have retrieved wildcard value", map.containsKey( key1));

        map.put(key3, "1.2");

        Assert.assertTrue( "Should have retrieved wildcard value", map.containsKey( key2));
        Assert.assertTrue( "Should have retrieved wildcard value", map.containsKey( key1));

        Assert.assertThat( m_listAppender.list.toString(),
                           Matchers.containsString( "Unable to add org.group:new-artifact with value 1.2 as wildcard mapping for org.group already exists"));

    }

    @Test
    public void testPutWildcardSecond()
    {
        ProjectRef key1 = SimpleProjectRef.parse( "org.group:artifact" );
        ProjectRef key2 = SimpleProjectRef.parse( "org.group:*" );

        map.put(key1, "1.1");
        map.put(key2, "1.2");

        Assert.assertTrue( "Should have retrieved explicit value via wildcard", map.containsKey( key1));
        Assert.assertTrue( "Should have retrieved wildcard value", map.containsKey( key2));
        Assert.assertNotEquals( "Should not have retrieved value 1.1", "1.1", map.get( key1 ) );

        Assert.assertThat( m_listAppender.list.toString(),
                           Matchers.containsString( "Emptying map with keys [artifact] as replacing with wildcard mapping org.group:*"));

    }
}


text:
<?php

namespace Doctrine\ODM\MongoDB;

use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
use Doctrine\ODM\MongoDB\Mapping\ClassMetadataFactory;
use Doctrine\ODM\MongoDB\Mapping\ClassMetadataInfo;

class SchemaManager
{
    /**
     * @var DocumentManager
     */
    protected $dm;

    /**
     *
     * @var ClassMetadataFactory
     */
    protected $metadataFactory;

    /**
     * @param DocumentManager $dm
     * @param ClassMetadataFactory $cmf
     */
    public function __construct(DocumentManager $dm, ClassMetadataFactory $cmf)
    {
        $this->dm = $dm;
        $this->metadataFactory = $cmf;
    }

    /**
     * Ensure indexes are created for all documents that can be loaded with the
     * metadata factory.
     *
     * @param integer $timeout Timeout (ms) for acknowledged index creation
     */
    public function ensureIndexes($timeout = null)
    {
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
                continue;
            }
            $this->ensureDocumentIndexes($class->name, $timeout);
        }
    }

    /**
     * Ensure indexes exist for all mapped document classes.
     *
     * Indexes that exist in MongoDB but not the document metadata will be
     * deleted.
     *
     * @param integer $timeout Timeout (ms) for acknowledged index creation
     */
    public function updateIndexes($timeout = null)
    {
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
                continue;
            }
            $this->updateDocumentIndexes($class->name, $timeout);
        }
    }

    /**
     * Ensure indexes exist for the mapped document class.
     *
     * Indexes that exist in MongoDB but not the document metadata will be
     * deleted.
     *
     * @param string $documentName
     * @param integer $timeout Timeout (ms) for acknowledged index creation
     * @throws \InvalidArgumentException
     */
    public function updateDocumentIndexes($documentName, $timeout = null)
    {
        $class = $this->dm->getClassMetadata($documentName);

        if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
            throw new \InvalidArgumentException('Cannot update document indexes for mapped super classes or embedded documents.');
        }

        $documentIndexes = $this->getDocumentIndexes($documentName);
        $collection = $this->dm->getDocumentCollection($documentName);
        $mongoIndexes = $collection->getIndexInfo();

        /* Determine which Mongo indexes should be deleted. Exclude the ID index
         * and those that are equivalent to any in the class metadata.
         */
        $self = $this;
        $mongoIndexes = array_filter($mongoIndexes, function ($mongoIndex) use ($documentIndexes, $self) {
            if ('_id_' === $mongoIndex['name']) {
                return false;
            }

            foreach ($documentIndexes as $documentIndex) {
                if ($self->isMongoIndexEquivalentToDocumentIndex($mongoIndex, $documentIndex)) {
                    return false;
                }
            }

            return true;
        });

        // Delete indexes that do not exist in class metadata
        foreach ($mongoIndexes as $mongoIndex) {
            if (isset($mongoIndex['name'])) {
                /* Note: MongoCollection::deleteIndex() cannot delete
                 * custom-named indexes, so use the deleteIndexes command.
                 */
                $collection->getDatabase()->command(array(
                    'deleteIndexes' => $collection->getName(),
                    'index' => $mongoIndex['name'],
                ));
            }
        }

        $this->ensureDocumentIndexes($documentName, $timeout);
    }

    /**
     * @param string $documentName
     * @return array
     */
    public function getDocumentIndexes($documentName)
    {
        $visited = array();
        return $this->doGetDocumentIndexes($documentName, $visited);
    }

    /**
     * @param string $documentName
     * @param array $visited
     * @return array
     */
    private function doGetDocumentIndexes($documentName, array &$visited)
    {
        if (isset($visited[$documentName])) {
            return array();
        }

        $visited[$documentName] = true;

        $class = $this->dm->getClassMetadata($documentName);
        $indexes = $this->prepareIndexes($class);
        $embeddedDocumentIndexes = array();

        // Add indexes from embedded & referenced documents
        foreach ($class->fieldMappings as $fieldMapping) {
            if (isset($fieldMapping['embedded'])) {
                if (isset($fieldMapping['targetDocument'])) {
                    $possibleEmbeds = array($fieldMapping['targetDocument']);
                } elseif (isset($fieldMapping['discriminatorMap'])) {
                    $possibleEmbeds = array_unique($fieldMapping['discriminatorMap']);
                } else {
                    continue;
                }
                foreach ($possibleEmbeds as $embed) {
                    if (isset($embeddedDocumentIndexes[$embed])) {
                        $embeddedIndexes = $embeddedDocumentIndexes[$embed];
                    } else {
                        $embeddedIndexes = $this->doGetDocumentIndexes($embed, $visited);
                        $embeddedDocumentIndexes[$embed] = $embeddedIndexes;
                    }
                    foreach ($embeddedIndexes as $embeddedIndex) {
                        foreach ($embeddedIndex['keys'] as $key => $value) {
                            $embeddedIndex['keys'][$fieldMapping['name'] . '.' . $key] = $value;
                            unset($embeddedIndex['keys'][$key]);
                        }
                        $indexes[] = $embeddedIndex;
                    }
                }
            } elseif (isset($fieldMapping['reference']) && isset($fieldMapping['targetDocument'])) {
                foreach ($indexes as $idx => $index) {
                    $newKeys = array();
                    foreach ($index['keys'] as $key => $v) {
                        if ($key == $fieldMapping['name']) {
                            $key = $fieldMapping['storeAs'] === ClassMetadataInfo::REFERENCE_STORE_AS_ID
                                ? $key
                                : $key . '.$id';
                        }
                        $newKeys[$key] = $v;
                    }
                    $indexes[$idx]['keys'] = $newKeys;
                }
            }
        }
        return $indexes;
    }

    /**
     * @param ClassMetadata $class
     * @return array
     */
    private function prepareIndexes(ClassMetadata $class)
    {
        $persister = $this->dm->getUnitOfWork()->getDocumentPersister($class->name);
        $indexes = $class->getIndexes();
        $newIndexes = array();

        foreach ($indexes as $index) {
            $newIndex = array(
                'keys' => array(),
                'options' => $index['options']
            );
            foreach ($index['keys'] as $key => $value) {
                $key = $persister->prepareFieldName($key);
                if ($class->hasField($key)) {
                    $mapping = $class->getFieldMapping($key);
                    $newIndex['keys'][$mapping['name']] = $value;
                } else {
                    $newIndex['keys'][$key] = $value;
                }
            }

            $newIndexes[] = $newIndex;
        }

        return $newIndexes;
    }

    /**
     * Ensure the given document's indexes are created.
     *
     * @param string $documentName
     * @param integer $timeout Timeout (ms) for acknowledged index creation
     * @throws \InvalidArgumentException
     */
    public function ensureDocumentIndexes($documentName, $timeout = null)
    {
        $class = $this->dm->getClassMetadata($documentName);
        if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
            throw new \InvalidArgumentException('Cannot create document indexes for mapped super classes or embedded documents.');
        }
        if ($indexes = $this->getDocumentIndexes($documentName)) {
            $collection = $this->dm->getDocumentCollection($class->name);
            foreach ($indexes as $index) {
                $keys = $index['keys'];
                $options = $index['options'];

                if ( ! isset($options['safe']) && ! isset($options['w'])) {
                    $options['w'] = 1;
                }

                if (isset($options['safe']) && ! isset($options['w'])) {
                    $options['w'] = is_bool($options['safe']) ? (integer) $options['safe'] : $options['safe'];
                    unset($options['safe']);
                }

                if ( ! isset($options['timeout']) && isset($timeout)) {
                    $options['timeout'] = $timeout;
                }

                $collection->ensureIndex($keys, $options);
            }
        }
    }

    /**
     * Delete indexes for all documents that can be loaded with the
     * metadata factory.
     */
    public function deleteIndexes()
    {
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
                continue;
            }
            $this->deleteDocumentIndexes($class->name);
        }
    }

    /**
     * Delete the given document's indexes.
     *
     * @param string $documentName
     * @throws \InvalidArgumentException
     */
    public function deleteDocumentIndexes($documentName)
    {
        $class = $this->dm->getClassMetadata($documentName);
        if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
            throw new \InvalidArgumentException('Cannot delete document indexes for mapped super classes or embedded documents.');
        }
        $this->dm->getDocumentCollection($documentName)->deleteIndexes();
    }

    /**
     * Create all the mapped document collections in the metadata factory.
     */
    public function createCollections()
    {
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
                continue;
            }
            $this->createDocumentCollection($class->name);
        }
    }

    /**
     * Create the document collection for a mapped class.
     *
     * @param string $documentName
     * @throws \InvalidArgumentException
     */
    public function createDocumentCollection($documentName)
    {
        $class = $this->dm->getClassMetadata($documentName);

        if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
            throw new \InvalidArgumentException('Cannot create document collection for mapped super classes or embedded documents.');
        }

        if ($class->isFile()) {
            $this->dm->getDocumentDatabase($documentName)->createCollection($class->getCollection() . '.files');
            $this->dm->getDocumentDatabase($documentName)->createCollection($class->getCollection() . '.chunks');

            return;
        }

        $this->dm->getDocumentDatabase($documentName)->createCollection(
            $class->getCollection(),
            $class->getCollectionCapped(),
            $class->getCollectionSize(),
            $class->getCollectionMax()
        );
    }

    /**
     * Drop all the mapped document collections in the metadata factory.
     */
    public function dropCollections()
    {
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
                continue;
            }
            $this->dropDocumentCollection($class->name);
        }
    }

    /**
     * Drop the document collection for a mapped class.
     *
     * @param string $documentName
     * @throws \InvalidArgumentException
     */
    public function dropDocumentCollection($documentName)
    {
        $class = $this->dm->getClassMetadata($documentName);
        if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
            throw new \InvalidArgumentException('Cannot delete document indexes for mapped super classes or embedded documents.');
        }
        $this->dm->getDocumentDatabase($documentName)->dropCollection(
            $class->getCollection()
        );
    }

    /**
     * Drop all the mapped document databases in the metadata factory.
     */
    public function dropDatabases()
    {
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
                continue;
            }
            $this->dropDocumentDatabase($class->name);
        }
    }

    /**
     * Drop the document database for a mapped class.
     *
     * @param string $documentName
     * @throws \InvalidArgumentException
     */
    public function dropDocumentDatabase($documentName)
    {
        $class = $this->dm->getClassMetadata($documentName);
        if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
            throw new \InvalidArgumentException('Cannot drop document database for mapped super classes or embedded documents.');
        }
        $this->dm->getDocumentDatabase($documentName)->drop();
    }

    /**
     * Create all the mapped document databases in the metadata factory.
     */
    public function createDatabases()
    {
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
                continue;
            }
            $this->createDocumentDatabase($class->name);
        }
    }

    /**
     * Create the document database for a mapped class.
     *
     * @param string $documentName
     * @throws \InvalidArgumentException
     */
    public function createDocumentDatabase($documentName)
    {
        $class = $this->dm->getClassMetadata($documentName);
        if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
            throw new \InvalidArgumentException('Cannot delete document indexes for mapped super classes or embedded documents.');
        }
        $this->dm->getDocumentDatabase($documentName)->execute('function() { return true; }');
    }

    /**
     * Determine if an index returned by MongoCollection::getIndexInfo() can be
     * considered equivalent to an index in class metadata.
     *
     * Indexes are considered different if:
     *
     *   (a) Key/direction pairs differ or are not in the same order
     *   (b) Sparse or unique options differ
     *   (c) Mongo index is unique without dropDups and mapped index is unique
     *       with dropDups
     *   (d) Geospatial options differ (bits, max, min)
     *   (e) The partialFilterExpression differs
     *
     * Regarding (c), the inverse case is not a reason to delete and
     * recreate the index, since dropDups only affects creation of
     * the unique index. Additionally, the background option is only
     * relevant to index creation and is not considered.
     *
     * @param array $mongoIndex Mongo index data.
     * @param array $documentIndex Document index data.
     * @return bool True if the indexes are equivalent, otherwise false.
     */
    public function isMongoIndexEquivalentToDocumentIndex($mongoIndex, $documentIndex)
    {
        $documentIndexOptions = $documentIndex['options'];

        if ($mongoIndex['key'] != $documentIndex['keys']) {
            return false;
        }

        if (empty($mongoIndex['sparse']) xor empty($documentIndexOptions['sparse'])) {
            return false;
        }

        if (empty($mongoIndex['unique']) xor empty($documentIndexOptions['unique'])) {
            return false;
        }

        if ( ! empty($mongoIndex['unique']) && empty($mongoIndex['dropDups']) &&
            ! empty($documentIndexOptions['unique']) && ! empty($documentIndexOptions['dropDups'])) {

            return false;
        }

        foreach (array('bits', 'max', 'min') as $option) {
            if (isset($mongoIndex[$option]) xor isset($documentIndexOptions[$option])) {
                return false;
            }

            if (isset($mongoIndex[$option]) && isset($documentIndexOptions[$option]) &&
                $mongoIndex[$option] !== $documentIndexOptions[$option]) {

                return false;
            }
        }

        if (empty($mongoIndex['partialFilterExpression']) xor empty($documentIndexOptions['partialFilterExpression'])) {
            return false;
        }

        if (isset($mongoIndex['partialFilterExpression']) && isset($documentIndexOptions['partialFilterExpression']) &&
            $mongoIndex['partialFilterExpression'] !== $documentIndexOptions['partialFilterExpression']) {

            return false;
        }

        return true;
    }

    /**
     * Ensure collections are sharded for all documents that can be loaded with the
     * metadata factory.
     *
     * @param array $indexOptions Options for `ensureIndex` command. It's performed on an existing collections
     *
     * @throws MongoDBException
     */
    public function ensureSharding(array $indexOptions = array())
    {
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
            if ($class->isMappedSuperclass || !$class->isSharded()) {
                continue;
            }

            $this->ensureDocumentSharding($class->name, $indexOptions);
        }
    }

    /**
     * Ensure sharding for collection by document name.
     *
     * @param string $documentName
     * @param array  $indexOptions Options for `ensureIndex` command. It's performed on an existing collections.
     *
     * @throws MongoDBException
     */
    public function ensureDocumentSharding($documentName, array $indexOptions = array())
    {
        $class = $this->dm->getClassMetadata($documentName);
        if ( ! $class->isSharded()) {
            return;
        }

        $this->enableShardingForDbByDocumentName($documentName);

        $try = 0;
        do {
            $result = $this->runShardCollectionCommand($documentName);
            $done = true;

            // Need to check error message because MongoDB 3.0 does not return a code for this error
            if ($result['ok'] != 1 && strpos($result['errmsg'], 'please create an index that starts') !== false) {
                // The proposed key is not returned when using mongo-php-adapter with ext-mongodb.
                // See https://github.com/mongodb/mongo-php-driver/issues/296 for details
                if (isset($result['proposedKey'])) {
                    $key = $result['proposedKey'];
                } else {
                    $key = $this->dm->getClassMetadata($documentName)->getShardKey()['keys'];
                }

                $this->dm->getDocumentCollection($documentName)->ensureIndex($key, $indexOptions);
                $done = false;
                $try++;
            }
        } while (! $done && $try < 2);

        // Starting with MongoDB 3.2, this command returns code 20 when a collection is already sharded.
        // For older MongoDB versions, check the error message
        if ($result['ok'] == 1 || (isset($result['code']) && $result['code'] == 20) || $result['errmsg'] == 'already sharded') {
            return;
        }

        throw MongoDBException::failedToEnsureDocumentSharding($documentName, $result['errmsg']);
    }

    /**
     * Enable sharding for database which contains documents with given name.
     *
     * @param string $documentName
     *
     * @throws MongoDBException
     */
    public function enableShardingForDbByDocumentName($documentName)
    {
        $dbName = $this->dm->getDocumentDatabase($documentName)->getName();
        $adminDb = $this->dm->getConnection()->selectDatabase('admin');
        $result = $adminDb->command(array('enableSharding' => $dbName));

        // Error code is only available with MongoDB 3.2. MongoDB 3.0 only returns a message
        // Thus, check code if it exists and fall back on error message
        if ($result['ok'] == 1 || (isset($result['code']) && $result['code'] == 23) || $result['errmsg'] == 'already enabled') {
            return;
        }

        throw MongoDBException::failedToEnableSharding($dbName, $result['errmsg']);
    }

    /**
     * @param $documentName
     *
     * @return array
     */
    private function runShardCollectionCommand($documentName)
    {
        $class = $this->dm->getClassMetadata($documentName);
        $dbName = $this->dm->getDocumentDatabase($documentName)->getName();
        $shardKey = $class->getShardKey();
        $adminDb = $this->dm->getConnection()->selectDatabase('admin');

        $result = $adminDb->command(
            array(
                'shardCollection' => $dbName . '.' . $class->getCollection(),
                'key'             => $shardKey['keys']
            )
        );

        return $result;
    }
}


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Resources;
using System.Web.UI.WebControls;
using newtelligence.DasBlog.Web.Core;

namespace newtelligence.DasBlog.Web
{
    public class StatisticsItem
    {
        internal string identifier;
        internal int count;
        internal StatisticsItem(string identifier, int count)
        {
            this.identifier = identifier;
            this.count = count;
        }

        internal sealed class Comparer : IComparer<StatisticsItem>
        {
            public int Compare(StatisticsItem left, StatisticsItem right)
            {
				int leftValue = left.count;
            	int rightValue = right.count;
                if (leftValue > rightValue)
                {
                    return -1;
                }
                else if (leftValue < rightValue)
                {
                    return 1;
                }

                return String.Compare(left.identifier, right.identifier, StringComparison.InvariantCultureIgnoreCase);
            }
        }

        internal sealed class SearchStringComparer : IComparer<StatisticsItem>
    	{
            public int Compare(StatisticsItem left, StatisticsItem right)
    		{
    			int leftValue = left.count;
    			int rightValue = right.count;
    			if (leftValue > rightValue)
    			{
    				return -1;
    			}
    			else if (leftValue < rightValue)
    			{
    				return 1;
    			}

    			return
    				String.Compare(SiteUtilities.ParseSearchString(left.identifier).Text,
    				               SiteUtilities.ParseSearchString(right.identifier).Text,
    				               StringComparison.InvariantCultureIgnoreCase);
    		}
		}
    }

    public delegate void StatisticsBuilderCallback( TableRow currentRow, StatisticsItem item, object args );

    public class StatisticsListBase : System.Web.UI.UserControl
	{
        protected ResourceManager resmgr;

		public StatisticsListBase()
		{
            resmgr = ApplicationResourceTable.Get();
		}

		protected Table BuildStatisticsTable(
			IEnumerable items,
			string itemColumnName,
			string numberColumnName,
			StatisticsBuilderCallback buildFn,
			object args )
		{
			string total = string.Empty;
			return BuildStatisticsTable(items,itemColumnName,numberColumnName,buildFn,out total,args);
		}

        protected Table BuildStatisticsTable(
            IEnumerable items,
            string itemColumnName,
            string numberColumnName,
            StatisticsBuilderCallback buildFn,
			out string totalString,
            object args )
        {
            int total = 0;
            Table table = new Table();
            table.CssClass = "statsTableStyle";
            TableRow row = new TableRow();
            row.CssClass = "statsTableHeaderRowStyle";
            row.Cells.Add(new TableCell());
            row.Cells.Add(new TableCell());
            row.Cells[0].CssClass = "statsTableHeaderColumnStyle";
            row.Cells[1].CssClass = "statsTableHeaderNumColumnStyle";
            row.Cells[0].Text = itemColumnName;
            row.Cells[1].Text = numberColumnName;
            table.Rows.Add(row);

            foreach (StatisticsItem item in items)
            {
                row = new TableRow();
                row.CssClass = "statsTableRowStyle";
                row.Cells.Add(new TableCell());
                row.Cells.Add(new TableCell());
                row.Cells[0].CssClass = "statsTableColumnStyle";
                row.Cells[1].CssClass = "statsTableNumColumnStyle";

                buildFn( row, item, args );

				if (row.Cells[1].Text.Length > 0)
				{
					total += item.count;
					table.Rows.Add(row);
				}
            }

            TableRow totalRow = new TableRow();
            totalRow.CssClass="statsTableFooterRowStyle";
            totalRow.Cells.Add(new TableCell());
            totalRow.Cells.Add(new TableCell());
            totalRow.Cells[0].CssClass = "statsTableFooterColumnStyle";
            totalRow.Cells[1].CssClass = "statsTableFooterNumColumnStyle";
            totalRow.Cells[0].Text = resmgr.GetString("text_activity_total");
			totalString = total.ToString();
            totalRow.Cells[1].Text = totalString;
            table.Rows.Add(totalRow);
            return table;
        }

        protected void BuildAgentsRow( TableRow row, StatisticsItem item, object unused )
        {
            Label agentLabel = new Label();
            string text = SiteUtilities.ClipString(item.identifier,80);
            agentLabel.Text = text;
            row.Cells[0].Controls.Add(agentLabel);
            row.Cells[1].Text = item.count.ToString();
        }

        protected void BuildReferrerRow( TableRow row, StatisticsItem item, object unused )
        {
            HyperLink link = new HyperLink();
            string text = SiteUtilities.ClipString(item.identifier,80);
            link.Text = System.Web.HttpUtility.HtmlEncode(text);
            link.NavigateUrl = item.identifier.ToString();
            row.Cells[0].Controls.Add(link);
            row.Cells[1].Text = item.count.ToString();
        }

		protected void BuildSearchesRow(TableRow row, StatisticsItem item, object unused)
		{
			HyperLink link = SiteUtilities.ParseSearchString(item.identifier);

			if (link != null)
			{
				row.Cells[0].Controls.Add(link);
				row.Cells[1].Text = item.count.ToString();
			}
		}

		protected void BuildUserDomainRow(TableRow row, StatisticsItem item, object unused)
		{
			Label userDomainLabel = new Label();
			string text = SiteUtilities.ClipString(item.identifier, 80);
			userDomainLabel.Text = text;
			row.Cells[0].Controls.Add(userDomainLabel);
			row.Cells[1].Text = item.count.ToString();
		}

        protected List<StatisticsItem> GenerateSortedItemList( IDictionary<string, int> dict )
        {
            List<StatisticsItem> listItems = new List<StatisticsItem>(dict.Count);
            foreach (KeyValuePair<string, int> de in dict)
            {
                listItems.Add(new StatisticsItem(de.Key, de.Value));
            }
            listItems.Sort(new StatisticsItem.Comparer());
            return listItems;
        }

        protected List<StatisticsItem> GenerateSortedSearchStringItemList(IDictionary<string, int> dict)
		{
            List<StatisticsItem> listItems = new List<StatisticsItem>(dict.Count);
            foreach (KeyValuePair<string, int> de in dict)
			{
				listItems.Add(new StatisticsItem(de.Key.ToString(), (int)de.Value));
			}
			listItems.Sort(new StatisticsItem.SearchStringComparer());
			return listItems;
		}
	}
}


text:
<?php

namespace Emayk\Ics\Repo\Ordertype;

class OrdertypeArray implements  OrdertypeInterface{

    protected $ordertype;
    /*function __construct() { }*/

    /**
     * @return mixed
     */
    public function all()
    {
        // TODO: Implement all() method.
    }

    /**
     * Simpan Ordertype
     *
     * @return mixed
     */
    public function store()
    {
        // TODO: Implement store() method.
    }

    /**
     * Menghapus Ordertype
     *
     * @param $id
     * @return mixed
     *
     */
    public function delete($id)
    {
        // TODO: Implement delete() method.
    }

    /**
     * Update Informasi Ordertype
     *
     * @param $id
     * @param array $ordertype
     * @return mixed
     */
    public function update($id)
    {
        // TODO: Implement update() method.
    }

    /**
     *
     * Mendapatkan Ordertype berdasarkan id yang diberikan
     *
     * @param $id
     * @return mixed
     */
    public function find($id)
    {
        // TODO: Implement find() method.
    }

    /**
    *
    * Menampilkan Page Untuk Buat Data
    *
    **/

    public function create()
    {
        // TODO: Implement create() method.
    }
        /**
     * Menampilkan Resource
     *
     * @param  int  $id
     * @return Response
     */
    public function show($id)
    {
        // TODO: Implement show() method.
    }
    /**
     * Menampilkan Data Untuk di edit
     *
     * @param  int  $id
     * @return Response
     */
    public function edit($id)
    {
        // TODO: Implement edit() method.
    }

    /**
     * Remove from Storage
     *
     */
    public function destroy($id)
    {
        // TODO: Implement destroy() method.
    }

}


text:
ACTION_DESCRIBE_NOTIFICATION_CENTER_USER_POSTS = "DescribeNotificationCenterUserPosts"

# zones
ACTION_DESCRIBE_ZONES = "DescribeZones"

# jobs
ACTION_DESCRIBE_JOBS = "DescribeJobs"

# images
ACTION_DESCRIBE_IMAGES = "DescribeImages"
ACTION_CAPTURE_INSTANCE = "CaptureInstance"
ACTION_DELETE_IMAGES = "DeleteImages"
ACTION_MODIFY_IMAGE_ATTRIBUTES = "ModifyImageAttributes"

# instances
ACTION_DESCRIBE_INSTANCES = "DescribeInstances"
ACTION_RUN_INSTANCES = "RunInstances"
ACTION_RUN_INSTANCES_BY_CONFIGURATION = "RunInstancesByConfiguration"
ACTION_TERMINATE_INSTANCES = "TerminateInstances"
ACTION_START_INSTANCES = "StartInstances"
ACTION_RESTART_INSTANCES = "RestartInstances"
ACTION_STOP_INSTANCES = "StopInstances"
ACTION_RESIZE_INSTANCES = "ResizeInstances"
ACTION_RESET_INSTANCES = "ResetInstances"
ACTION_MODIFY_INSTANCE_ATTRIBUTES = "ModifyInstanceAttributes"

# user data
ACTION_UPLOAD_USERDATA_ATTACHMENT = "UploadUserDataAttachment"

# volumes
ACTION_DESCRIBE_VOLUMES = "DescribeVolumes"
ACTION_CREATE_VOLUMES = "CreateVolumes"
ACTION_DELETE_VOLUMES = "DeleteVolumes"
ACTION_ATTACH_VOLUMES = "AttachVolumes"
ACTION_DETACH_VOLUMES = "DetachVolumes"
ACTION_RESIZE_VOLUMES = "ResizeVolumes"
ACTION_MODIFY_VOLUME_ATTRIBUTES = "ModifyVolumeAttributes"

# key pair
ACTION_DESCRIBE_KEY_PAIRS = "DescribeKeyPairs"
ACTION_CREATE_KEY_PAIR = "CreateKeyPair"
ACTION_DELETE_KEY_PAIRS = "DeleteKeyPairs"
ACTION_ATTACH_KEY_PAIRS = "AttachKeyPairs"
ACTION_DETACH_KEY_PAIRS = "DetachKeyPairs"
ACTION_MODIFY_KEYPAIR_ATTRIBUTES = "ModifyKeyPairAttributes"

# security group
ACTION_DESCRIBE_SECURITY_GROUPS = "DescribeSecurityGroups"
ACTION_CREATE_SECURITY_GROUP = "CreateSecurityGroup"
ACTION_MODIFY_SECURITY_GROUP_ATTRIBUTES = "ModifySecurityGroupAttributes"
ACTION_APPLY_SECURITY_GROUP = "ApplySecurityGroup"
ACTION_REMOVE_SECURITY_GROUP = "RemoveSecurityGroup"
ACTION_DELETE_SECURITY_GROUPS = "DeleteSecurityGroups"
ACTION_DESCRIBE_SECURITY_GROUP_RULES = "DescribeSecurityGroupRules"
ACTION_ADD_SECURITY_GROUP_RULES = "AddSecurityGroupRules"
ACTION_DELETE_SECURITY_GROUP_RULES = "DeleteSecurityGroupRules"
ACTION_MODIFY_SECURITY_GROUP_RULE_ATTRIBUTES = "ModifySecurityGroupRuleAttributes"
ACTION_DESCRIBE_SECURITY_GROUP_IPSETS = "DescribeSecurityGroupIPSets"
ACTION_CREATE_SECURITY_GROUP_IPSET = "CreateSecurityGroupIPSet"
ACTION_DELETE_SECURITY_GROUP_IPSETS = "DeleteSecurityGroupIPSets"
ACTION_MODIFY_SECURITY_GROUP_IPSET_ATTRIBUTES = "ModifySecurityGroupIPSetAttributes"

# vxnets
ACTION_DESCRIBE_VXNETS = "DescribeVxnets"
ACTION_CREATE_VXNETS = "CreateVxnets"
ACTION_DELETE_VXNETS = "DeleteVxnets"
ACTION_JOIN_VXNET = "JoinVxnet"
ACTION_LEAVE_VXNET = "LeaveVxnet"
ACTION_MODIFY_VXNET_ATTRIBUTES = "ModifyVxnetAttributes"
ACTION_DESCRIBE_VXNET_INSTANCES = "DescribeVxnetInstances"

# router
ACTION_CREATE_ROUTERS = "CreateRouters"
ACTION_UPDATE_ROUTERS = "UpdateRouters"
ACTION_DELETE_ROUTERS = "DeleteRouters"
ACTION_JOIN_ROUTER = "JoinRouter"
ACTION_LEAVE_ROUTER = "LeaveRouter"
ACTION_POWEROFF_ROUTERS = "PowerOffRouters"
ACTION_POWERON_ROUTERS = "PowerOnRouters"
ACTION_DESCRIBE_ROUTERS = "DescribeRouters"
ACTION_DESCRIBE_ROUTER_VXNETS = "DescribeRouterVxnets"
ACTION_MODIFY_ROUTER_ATTRIBUTES = "ModifyRouterAttributes"
ACTION_MODIFY_ROUTER_STATIC_ATTRIBUTES = "ModifyRouterStaticAttributes"
ACTION_DESCRIBE_ROUTER_STATICS = "DescribeRouterStatics"
ACTION_ADD_ROUTER_STATICS = "AddRouterStatics"
ACTION_DELETE_ROUTER_STATICS = "DeleteRouterStatics"
ACTION_MODIFY_ROUTER_STATIC_ENTRY_ATTRIBUTES = "ModifyRouterStaticEntryAttributes"
ACTION_DESCRIBE_ROUTER_STATIC_ENTRIES = "DescribeRouterStaticEntries"
ACTION_ADD_ROUTER_STATIC_ENTRIES = "AddRouterStaticEntries"
ACTION_DELETE_ROUTER_STATIC_ENTRIES = "DeleteRouterStaticEntries"

# eip
ACTION_ASSOCIATE_EIP = "AssociateEip"
ACTION_DISSOCIATE_EIPS = "DissociateEips"
ACTION_ALLOCATE_EIPS = "AllocateEips"
ACTION_RELEASE_EIPS = "ReleaseEips"
ACTION_DESCRIBE_EIPS = "DescribeEips"
ACTION_MODIFY_EIP_ATTRIBUTES = "ModifyEipAttributes"
ACTION_CHANGE_EIPS_BANDWIDTH = "ChangeEipsBandwidth"
ACTION_CHANGE_EIPS_BILLING_MODE = "ChangeEipsBillingMode"

# dns alias
ACTION_DESCRIBE_DNS_ALIASES = "DescribeDNSAliases"
ACTION_ASSOCIATE_DNS_ALIAS = "AssociateDNSAlias"
ACTION_DISSOCIATE_DNS_ALIASES = "DissociateDNSAliases"
ACTION_GET_DNS_LABEL = "GetDNSLabel"

# lb
ACTION_DESCRIBE_LOADBALANCERS = "DescribeLoadBalancers"
ACTION_CREATE_LOADBALANCER = "CreateLoadBalancer"
ACTION_DELETE_LOADBALANCERS = "DeleteLoadBalancers"
ACTION_ASSOCIATE_EIPS_TO_LOADBALANCER = "AssociateEipsToLoadBalancer"
ACTION_DISSOCIATE_EIPS_FROM_LOADBALANCER = "DissociateEipsFromLoadBalancer"
ACTION_UPDATE_LOADBALANCERS = "UpdateLoadBalancers"
ACTION_STOP_LOADBALANCERS = "StopLoadBalancers"
ACTION_START_LOADBALANCERS = "StartLoadBalancers"
ACTION_MODIFY_LOADBALANCER_ATTRIBUTES = "ModifyLoadBalancerAttributes"

ACTION_DESCRIBE_LOADBALANCER_LISTENERS = "DescribeLoadBalancerListeners"
ACTION_ADD_LOADBALANCER_LISTENERS = "AddLoadBalancerListeners"
ACTION_DELETE_LOADBALANCER_LISTENERS = "DeleteLoadBalancerListeners"
ACTION_MODIFY_LOADBALANCER_LISTENER_ATTRIBUTES = "ModifyLoadBalancerListenerAttributes"
ACTION_ADD_LOADBALANCER_BACKENDS = "AddLoadBalancerBackends"
ACTION_DELETE_LOADBALANCER_BACKENDS = "DeleteLoadBalancerBackends"
ACTION_MODIFY_LOADBALANCER_BACKEND_ATTRIBUTES = "ModifyLoadBalancerBackendAttributes"
ACTION_DESCRIBE_LOADBALANCER_BACKENDS = "DescribeLoadBalancerBackends"

ACTION_CREATE_LOADBALANCER_POLICY = "CreateLoadBalancerPolicy"
ACTION_MODIFY_LOADBALANCER_POLICY_ATTRIBUTES = "ModifyLoadBalancerPolicyAttributes"
ACTION_DESCRIBE_LOADBALANCER_POLICIES = "DescribeLoadBalancerPolicies"
ACTION_DELETE_LOADBALANCER_POLICIES = "DeleteLoadBalancerPolicies"
ACTION_APPLY_LOADBALANCER_POLICY = "ApplyLoadBalancerPolicy"

ACTION_DESCRIBE_LOADBALANCER_POLICY_RULES = "DescribeLoadBalancerPolicyRules"
ACTION_ADD_LOADBALANCER_POLICY_RULES = "AddLoadBalancerPolicyRules"
ACTION_MODIFY_LOADBALANCER_POLICY_RULE_ATTRIBUTES = "ModifyLoadBalancerPolicyRuleAttributes"
ACTION_DELETE_LOADBALANCER_POLICY_RULES = "DeleteLoadBalancerPolicyRules"

ACTION_CREATE_SERVER_CERTIFICATE = "CreateServerCertificate"
ACTION_DESCRIBE_SERVER_CERTIFICATES = "DescribeServerCertificates"
ACTION_MODIFY_SERVER_CERTIFICATE_ATTRIBUTES = "ModifyServerCertificateAttributes"
ACTION_DELETE_SERVER_CERTIFICATES = "DeleteServerCertificates"

# monitor
ACTION_GET_MONITOR = "GetMonitor"
ACTION_GET_LOADBALANCER_MONITOR = "GetLoadBalancerMonitor"

# snapshot
ACTION_CREATE_SNAPSHOTS = "CreateSnapshots"
ACTION_DELETE_SNAPSHOTS = "DeleteSnapshots"
ACTION_APPLY_SNAPSHOTS = "ApplySnapshots"
ACTION_DESCRIBE_SNAPSHOTS = "DescribeSnapshots"
ACTION_MODIFY_SNAPSHOT_ATTRIBUTES = "ModifySnapshotAttributes"
ACTION_CAPTURE_INSTANCE_FROM_SNAPSHOT = "CaptureInstanceFromSnapshot"
ACTION_CREATE_VOLUME_FROM_SNAPSHOT = "CreateVolumeFromSnapshot"

# rdb
ACTION_DESCRIBE_RDBS = "DescribeRDBs"
ACTION_CREATE_RDB = "CreateRDB"
ACTION_RESIZE_RDBS = "ResizeRDBs"
ACTION_START_RDBS = "StartRDBs"
ACTION_STOP_RDBS = "StopRDBs"

# mongo
ACTION_DESCRIBE_MONGOS = "DescribeMongos"
ACTION_RESIZE_MONGOS = "ResizeMongos"
ACTION_START_MONGOS = "StartMongos"
ACTION_STOP_MONGOS = "StopMongos"

# cache
ACTION_DESCRIBE_CACHES = "DescribeCaches"
ACTION_CREATE_CACHE = "CreateCache"
ACTION_RESIZE_CACHES = "ResizeCaches"
ACTION_START_CACHES = "StartCaches"
ACTION_STOP_CACHES = "StopCaches"

# spark
ACTION_DESCRIBE_SPARKS = "DescribeSparks"
ACTION_START_SPARKS = "StartSparks"
ACTION_STOP_SPARKS = "StopSparks"
ACTION_ADD_SPARK_NODES = "AddSparkNodes"
ACTION_DELETE_SPARK_NODES = "DeleteSparkNodes"
ACTION_CREATE_SPARK = "CreateSpark"
ACTION_DELETE_SPARKS = "DeleteSparks"

# hadoop
ACTION_DESCRIBE_HADOOPS = "DescribeHadoops"
ACTION_START_HADOOPS = "StartHadoops"
ACTION_STOP_HADOOPS = "StopHadoops"
ACTION_ADD_HADOOP_NODES = "AddHadoopNodes"
ACTION_DELETE_HADOOP_NODES = "DeleteHadoopNodes"
ACTION_CREATE_HADOOP = "CreateHadoop"
ACTION_DELETE_HADOOPS = "DeleteHadoops"

# zk
ACTION_DESCRIBE_ZOOKEEPERS = "DescribeZookeepers"
ACTION_START_ZOOKEEPERS = "StartZookeepers"
ACTION_STOP_ZOOKEEPERS = "StopZookeepers"

# queue
ACTION_DESCRIBE_QUEUES = "DescribeQueues"
ACTION_START_QUEUES = "StartQueues"
ACTION_STOP_QUEUES = "StopQueues"

# tag
ACTION_DESCRIBE_TAGS = "DescribeTags"
ACTION_CREATE_TAG = "CreateTag"
ACTION_DELETE_TAGS = "DeleteTags"
ACTION_MODIFY_TAG_ATTRIBUTES = "ModifyTagAttributes"
ACTION_ATTACH_TAGS = "AttachTags"
ACTION_DETACH_TAGS = "DetachTags"

# nic
ACTION_DESCRIBE_NICS = "DescribeNics"
ACTION_CREATE_NICS = "CreateNics"
ACTION_ATTACH_NICS = "AttachNics"
ACTION_DETACH_NICS = "DetachNics"
ACTION_MODIFY_NIC_ATTRIBUTES = "ModifyNicAttributes"
ACTION_DELETE_NICS = "DeleteNics"

# S2
ACTION_CREATE_S2_SERVER = "CreateS2Server"
ACTION_DESCRIBE_S2_SERVERS = "DescribeS2Servers"
ACTION_MODIFY_S2_SERVER = "ModifyS2ServerAttributes"
ACTION_RESIZE_S2_SERVERS = "ResizeS2Servers"
ACTION_DELETE_S2_SERVERS = "DeleteS2Servers"
ACTION_POWERON_S2_SERVERS = "PowerOnS2Servers"
ACTION_POWEROFF_S2_SERVERS = "PowerOffS2Servers"
ACTION_UPDATE_S2_SERVERS = "UpdateS2Servers"
ACTION_CHANGE_S2_SERVER_VXNET = "ChangeS2ServerVxnet"
ACTION_CREATE_S2_SHARED_TARGET = "CreateS2SharedTarget"
ACTION_DESCRIBE_S2_SHARED_TARGETS = "DescribeS2SharedTargets"
ACTION_DELETE_S2_SHARED_TARGETS = "DeleteS2SharedTargets"
ACTION_ENABLE_S2_SHARED_TARGETS = "EnableS2SharedTargets"
ACTION_DISABLE_S2_SHARED_TARGETS = "DisableS2SharedTargets"
ACTION_MODIFY_S2_SHARED_TARGET = "ModifyS2SharedTargetAttributes"
ACTION_ATTACH_TO_S2_SHARED_TARGET = "AttachToS2SharedTarget"
ACTION_DETACH_FROM_S2_SHARED_TARGET = "DetachFromS2SharedTarget"
ACTION_DESCRIBE_S2_DEFAULT_PARAMETERS = "DescribeS2DefaultParameters"
ACTION_CREATE_S2_GROUP = "CreateS2Group"
ACTION_DESCRIBE_S2_GROUPS = "DescribeS2Groups"
ACTION_MODIFY_S2_GROUP = "ModifyS2Group"
ACTION_DELETE_S2_GROUPS = "DeleteS2Groups"
ACTION_CREATE_S2_ACCOUNT = "CreateS2Account"
ACTION_DESCRIBE_S2_ACCOUNTS = "DescribeS2Accounts"
ACTION_MODIFY_S2_ACCOUNT = "ModifyS2Account"
ACTION_DELETE_S2_ACCOUNTS = "DeleteS2Accounts"
ACTION_ASSOCIATE_S2_ACCOUNT_GROUP = "AssociateS2AccountGroup"
ACTION_DISSOCIATE_S2_ACCOUNT_GROUP = "DissociateS2AccountGroup"

# Alarm
ACTION_DESCRIBE_ALARM_POLICIES = "DescribeAlarmPolicies"

########## Constants for resource ##########

# sg
DIRECTION_EGRESS = 1
DIRECTION_INGRESS = 0

# vxnet
VXNET_TYPE_MANAGED = 1
VXNET_TYPE_UNMANAGED = 0

# lb
BALANCE_ROUNDROBIN = "roundrobin"
BALANCE_LEASTCONN = "leastconn"
HEADER_X_FORWARD_FOR = 1
HEADER_QC_LBID = 2
HEADER_QC_LBIP = 4
LB_TYPE_MAXCONN_5k = 0
LB_TYPE_MAXCONN_20k = 1
LB_TYPE_MAXCONN_40k = 2
LB_TYPE_MAXCONN_100k = 3
LB_TYPE_MAXCONN_200k = 4
LB_TYPE_MAXCONN_500k = 5

# eip
EIP_BILLING_MODE_BANDWIDTH = "bandwidth"
EIP_BILLING_MODE_TRAFFIC = "traffic"


text:
export interface Application {
    id?: string;
    itunes_store_id?: number;
    bundle_id?: string;
    purchase_method?: number;
    manifest_url: string;
    management_flags: number;
    change_management_state: 'Managed' | null;
    display_name: string;
    description: string;
    version: string;
}

export interface Profile {
    id?: number;
    description?: string;
    display_name?: string;
    expiration_date?: Date;
    identifier: string;
    organization?: string;
    uuid: string;
    removal_disallowed?: Boolean;
    version: number;
    scope?: string;
    removal_date?: Date;
    duration_until_removal?: number;
    consent_en?: string;
}

export type ProfileRelationship = 'tags';

export interface Command {
    id?: number;
    command_class?: string;
    uuid?: string;
    input_data?: string;
    queued_status: string;
    queued_at?: Date;
    sent_at?: Date;
    acknowledged_at?: Date;
    after?: Date;
    ttl: number;
}

export interface Device {
    udid: string;
    // topic
    last_seen: string;
    is_enrolled: boolean;
    build_version: string;
    device_name: string;
    model: string;
    model_name: string;
    os_version: string;
    product_name: string;
    serial_number: string;
    hostname: string;
    local_hostname: string;
    available_device_capacity: number;
    device_capacity: number;
    wifi_mac: string;
    bluetooth_mac: string;
    awaiting_configuration: boolean;
    // push_magic
    // tokenupdate_at
    // last_apns_id

    // last_push_at
    passcode_present: boolean;
    passcode_compliant: boolean;
    passcode_compliant_with_profiles: boolean;
    fde_enabled: boolean;
    fde_has_prk: boolean;
    fde_has_irk: boolean;
    firewall_enabled: boolean;
    block_all_incoming: boolean;
    stealth_mode_enabled: boolean;
    sip_enabled: boolean;
    battery_level: number;
    carrier_settings_version: string;
    cellular_technology: string;
    current_carrier_network: string;
    current_mcc: string;
    current_mnc: string;
    data_roaming_enabled: boolean;
    eas_device_identifier: string;
    iccid: string;
    imei: string;
    is_activation_lock_enabled: boolean;
    is_cloud_backup_enabled: boolean;
    is_device_locator_service_enabled: boolean;
    is_do_not_disturb_in_effect: boolean;
    is_mdm_lost_mode_enabled: boolean;
    is_roaming: boolean;
    is_supervised: boolean;
    itunes_store_account_hash: string;
    itunes_store_account_is_active: boolean;
    last_cloud_backup_date: string;
    maximum_resident_users: number;
    meid: string;
    modem_firmware_version: string;
    passcode_lock_grace_period_enforced: number;
    personal_hotspot_enabled: boolean;
    phone_number: string;
    sim_carrier_network: string;
    subscriber_carrier_network: string;
    subscriber_mcc: string;
    subscriber_mnc: string;
    voice_roaming_enabled: boolean;
}

// Valid JSON-API relationships
export type DeviceRelationship = 'commands' | 'tags' | 'groups' | 'profiles';

export interface DeviceGroup {
    id?: string;
    name: string;
}

export interface Tag {
    id?: string;
    name: string;
    color: string;
}

export interface Organization {
    name: string;
    payload_prefix: string;
    x509_ou: string;
    x509_o: string;
    x509_st: string;
    x509_c: string;
}

export interface Certificate {
    type: string;
    x509_cn: string;
    not_before: Date;
    not_after: Date;
    fingerprint?: string;
}

export interface InstalledCertificate {
    x509_cn: string;
    is_identity: boolean;
    fingerprint_sha256: string;
}

export interface InstalledApplication {
    id?: number;
    device_udid: string;
    device_id: number;
    bundle_identifier: string;
    version: string;
    short_version: string;
    name: string;
    bundle_size: number;
    dynamic_size: number;
    is_validated: boolean;
}

export interface InstalledProfile {
    id?: number;
    device_udid: string;
    device_id: number;
    has_removal_password: boolean;
    is_encrypted: boolean;
    payload_description: string;
    payload_display_name: string;
    payload_identifier: string;
    payload_organization: string;
    payload_removal_disallowed: boolean;
    payload_uuid: string;
}

export interface InstalledPayload {
    id?: number;
    description: string;
    display_name: string;
    identifier: string;
    organization: string;
    payload_type: string;
    uuid: string;
}

export interface AvailableOSUpdate {
    id?: string;
    allows_install_later: boolean;
    app_identifiers_to_close: Array<string>;
    human_readable_name: string;
    human_readable_name_locale: string;
    is_config_data_update: boolean;
    is_critical: boolean;
    is_firmware_update: boolean;
    metadata_url: string;
    product_key: string;
    restart_required: boolean;
    version: string;
}

export interface SCEPConfiguration {
    url: string;
    challenge_enabled: boolean;
    challenge: string;
    ca_fingerprint: string;
    subject: string;
    key_size: string; // Needs to be string to support redux-form
    key_type: 'RSA';
    key_usage: string;
    subject_alt_name: string;
    retries: number;
    retry_delay: number;
    certificate_renewal_time_interval: number;
}

export interface VPPAccount {
    org_name: string;
    exp_date: string;
}


text:
**Note:** _Redlink Platform_ has been decommissioned in early 2021, so this project has been archived. If you are interested in the underlying technologies, please drop us a line at [hello@redlink.at](mailto:hello@redlink.at)!

---

ckanext-redlink - Redlink CKAN extension
===========================================================================

This is a CKAN extension that provides *SPARQL querying* capabilities for datasets
hosted on [Redlink](http://redlink.co) using the *data preview* feature of CKAN.

The SPARQL interface is based on [Squebi](https://github.com/tkurz/squebi).

Requisites
==========

* An account and a published dataset on [Redlink](https://my.redlink.io/)
* A running CKAN 2 install (only version 2.2 has been tested so far)
* A sysadmin user
* Some datasets created

Installation
============

Install the extension as usual, in your activated virtualenv:

    pip install -e "git+https://github.com/redlink-gmbh/ckanext-redlink.git#egg=ckanext-redlink"

If you want to jump straight away to the end result, just add the plugin to
your CKAN configuration file:

    ckan.plugins = redlink

Add add your Redlink [application key](http://dev.redlink.io/faq#get-key) to your CKAN configuration
file:

    [DEFAULT]
    redlink.app.key = <your-redlink-application-key>

It is recommended though that you follow the individual steps as described in
the next section.

How it works
============

Get the id of the dataset located in [my.redlink.io](https://my.redlink.io) / datasets / dataset page.

In CKAN, configure a dataset and add a resource.

In the resource settings, set the dataset id in the *Redlink Dataset* field and the default SPARQL query in the *SPARQL*.

If you're unsure which SPARQL query to set, you can use this general all-purpose one:
```
SELECT * WHERE {
  ?subject ?property ?object
} LIMIT 10
```

License
=======

[Apache License Version 2.0](LICENSE.txt)


text:
<?php

namespace App\Entity\Translations;

use Doctrine\ORM\Mapping as ORM;
use Sonata\TranslationBundle\Model\Gedmo\AbstractPersonalTranslation;

/**
 * @ORM\Entity
 * @ORM\Table(name="galleryhasmedia_translation",
 *     uniqueConstraints={@ORM\UniqueConstraint(name="lookup_unique_galleryhasmedia_translation_idx", columns={
 *         "locale", "object_id", "field"
 *     })}
 * )
 */
class GalleryHasMediaTranslation extends AbstractPersonalTranslation
{
    /**
     * @ORM\ManyToOne(targetEntity="App\Entity\GalleryHasMedia", inversedBy="translations")
     * @ORM\JoinColumn(name="object_id", referencedColumnName="id", onDelete="CASCADE")
     */
    protected $object;
}


text:
module Sorcery
  module Model
    module Adapters
      module MongoMapper
        extend ActiveSupport::Concern

        included do
          include Sorcery::Model
        end

        def increment(attr)
          self.class.increment(id, attr => 1)
        end

        def save!(options = {})
          save(options)
        end

        def update_many_attributes(attrs)
          update_attributes(attrs)
        end

        module ClassMethods
          def credential_regex(credential)
            return { :$regex =>  /^#{credential}$/i  }  if (@sorcery_config.downcase_username_before_authenticating)
            return credential
          end

          def find_by_credentials(credentials)
            @sorcery_config.username_attribute_names.each do |attribute|
              @user = where(attribute => credential_regex(credentials[0])).first
              break if @user
            end
            @user
          end

          def find_by_id(id)
            find(id)
          end

          def find_by_activation_token(token)
            where(sorcery_config.activation_token_attribute_name => token).first
          end

          def transaction(&blk)
            tap(&blk)
          end

          def find_by_sorcery_token(token_attr_name, token)
            where(token_attr_name => token).first
          end
        end
      end
    end
  end
end


text:
<?php include('server/view/header.php'); ?>

Your Credentials

Change your user name and password.

    <form action="account/index.php" method="post">

        <input type="hidden" name="action" value="update_user">

        <?php

        include('server/view/error_messages.php');
        include('account/user_edit_fields.php');

        ?>

        <button type="submit">Update</button>

    </form>

    <form action="account/index.php" method="post">
        <input type="hidden" name="action" value="view_profile">
        <button type="submit">  Profile</button>
    </form>

<?php include('server/view/footer.php'); ?>