text:
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
                   https://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd">
    <entity name="HCLabs\Bills\Model\Account"
            repository-class="HCLabs\Bills\Model\Repository\Doctrine\AccountRepository">
        <id name="id" type="guid">
            <generator strategy="UUID" />
        </id>

        <field name="accountNumber"      column="account_number"        type="string" length="255" />
        <field name="recurringCharge"    column="recurring_charge"      type="integer" />
        <field name="dateOpened"         column="date_opened"           type="datetime" />
        <field name="billingStartDate"   column="billing_start_date"    type="datetime" />
        <field name="billingInterval"    column="billing_interval"      type="string" />
        <field name="dateClosed"         column="date_closed"           type="datetime" nullable="true" />
        <many-to-one target-entity="Service" field="service" />
    </entity>
</doctrine-mapping>


text:
package org.azkfw.toolbox;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;

import org.azkfw.util.UUIDUtility;

/**
 * @since 1.0.0
 * @version 1.0.0 2014/10/14
 * @author Kawakicchi
 */
public class ToolBoxTabbedPane extends JTabbedPane {

	/** serialVersionUID */
	private static final long serialVersionUID = -4322039788436100986L;

	private List<String> ids;

	public ToolBoxTabbedPane() {
		ids = new ArrayList<String>();

		setBorder(null);
	}

	public void addTab(final String aTitle, final Component aPanel) {
		addTab(aTitle, null, aPanel);
	}

	public void addTab(final String aTitle, final Icon aIcon, final Component aPanel) {
		addTab(aTitle, aIcon, aPanel, null);
	}

	public void addTab(final String aTitle, final Icon aIcon, final Component aPanel, final String aToolTip) {
		String id = UUIDUtility.generateToShortString();

		JPanel pnlTab = new JPanel();
		pnlTab.setOpaque(false);
		pnlTab.setLayout(new BorderLayout(5, 5));

		JLabel label = null;
		if (null != aIcon) {
			label = new JLabel(aTitle, aIcon, JLabel.LEFT);
		} else {
			label = new JLabel(aTitle);
		}
		pnlTab.add(label, BorderLayout.CENTER);

		ClassLoader cl = this.getClass().getClassLoader();
		TabCloseLabel closeLabel = new TabCloseLabel(id, new ImageIcon(cl.getResource("org/azkfw/toolbox/toolbox_close.png")));
		closeLabel.addMouseListener(new MouseAdapter() {
			public void mouseClicked(final MouseEvent event) {
				TabCloseLabel close = (TabCloseLabel) event.getSource();
				for (int i = 0; i < ids.size(); i++) {
					String id = ids.get(i);
					if (id.equals(close.getId())) {
						remove(i);
						ids.remove(i);
						break;
					}
				}
			}
		});
		pnlTab.add(closeLabel, BorderLayout.EAST);
		ids.add(id);

		super.addTab(null, aPanel);
		setTabComponentAt(getTabCount() - 1, pnlTab);
		if (null != aToolTip) {
			setToolTipTextAt(getTabCount() - 1, aToolTip);
		}

		setSelectedIndex(getTabCount() - 1);
	}

	private class TabCloseLabel extends JLabel {

		/** serialVersionUID */
		private static final long serialVersionUID = 3193755639540747912L;

		private String id;

		public TabCloseLabel(final String aId, final Icon aIcon) {
			super(aIcon);
			id = aId;
		}

		public String getId() {
			return id;
		}
	}
}

redpajama_set_name: RedPajamaGithub


text:
from django import forms
from django.forms import ModelForm
from apps.seguridad.models import Ambito, Rol, Usuario

class UsuarioCreateForm(ModelForm):
    class Meta:
        model = Usuario

    password = forms.CharField(widget=forms.PasswordInput(render_value=False), label='contraseña')
    repeat_password = forms.CharField(widget=forms.PasswordInput(render_value=False), label='Repetir contraseña')
    rol = forms.ModelChoiceField(queryset=Rol.objects, label='rol')
    ambito = forms.ModelChoiceField(queryset=Ambito.objects, label='ambito')

    def clean(self):
        if self.cleaned_data.get('password') != self.cleaned_data.get('repeat_password'):
            self._errors['password'] = self.error_class([u'Las contraseñas no coinciden'])
        if self.cleaned_data.has_key('rol') and self.cleaned_data.has_key('ambito') and not self.cleaned_data['rol'].asignableAAmbito(self.cleaned_data['ambito']):
            self._errors['rol'] = self.error_class([u'El rol no puede asignarse al ámbito seleccionado'])
        return self.cleaned_data


text:
namespace arangodb {
namespace aql {
class SortCondition;
struct Variable;
}  // namespace aql

class MMFilesSkiplistIndex;
namespace transaction {
class Methods;
}

/// @brief Abstract Builder for lookup values in skiplist index
class MMFilesBaseSkiplistLookupBuilder {
 protected:
  bool _isEquality;
  bool _includeLower;
  bool _includeUpper;

  transaction::BuilderLeaser _lowerBuilder;
  arangodb::velocypack::Slice _lowerSlice;

  transaction::BuilderLeaser _upperBuilder;
  arangodb::velocypack::Slice _upperSlice;

 public:
  explicit MMFilesBaseSkiplistLookupBuilder(transaction::Methods* trx)
      : _lowerBuilder(trx), _upperBuilder(trx) {
    _isEquality = true;
    _includeUpper = true;
    _includeLower = true;

    _lowerBuilder->clear();
    _upperBuilder->clear();
  }

  virtual ~MMFilesBaseSkiplistLookupBuilder() = default;

  /// @brief Compute the next lookup values
  ///        If returns false there is no further lookup
  virtual bool next() = 0;

  /// @brief Returns if we only have equality checks (== or IN)
  bool isEquality() const;

  /// @brief Get the lookup value for the lower bound.
  arangodb::velocypack::Slice const* getLowerLookup() const;

  /// @brief Test if the lower bound should be included.
  ///        If there is no lower bound given returns true
  ///        as well.
  bool includeLower() const;

  /// @brief Get the lookup value for the upper bound.
  arangodb::velocypack::Slice const* getUpperLookup() const;

  /// @brief Test if the upper bound should be included.
  ///        If there is no upper bound given returns true
  ///        as well.
  bool includeUpper() const;
};

/// @brief Builder for lookup values in skiplist index
///        Offers lower and upper bound lookup values
///        and handles multiplication of IN search values.
///        Also makes sure that the lookup values are
///        returned in the correct ordering. And no
///        lookup is returned twice.

class MMFilesSkiplistLookupBuilder final : public MMFilesBaseSkiplistLookupBuilder {
 public:
  MMFilesSkiplistLookupBuilder(transaction::Methods* trx,
                               std::vector<std::vector<arangodb::aql::AstNode const*>>&,
                               arangodb::aql::Variable const*, bool);

  ~MMFilesSkiplistLookupBuilder() = default;

  /// @brief Compute the next lookup values
  ///        If returns false there is no further lookup
  bool next() override;
};

class MMFilesSkiplistInLookupBuilder final : public MMFilesBaseSkiplistLookupBuilder {
 private:
  struct PosStruct {
    size_t field;
    size_t current;
    size_t _max;  // thanks, windows.h!

    PosStruct(size_t f, size_t c, size_t m) : field(f), current(c), _max(m) {}
  };

  transaction::BuilderLeaser _dataBuilder;
  /// @brief keeps track of the positions in the in-lookup
  /// values. (field, inPosition, maxPosition)
  std::list<PosStruct> _inPositions;

  bool _done;

 public:
  MMFilesSkiplistInLookupBuilder(transaction::Methods* trx,
                                 std::vector<std::vector<arangodb::aql::AstNode const*>>&,
                                 arangodb::aql::Variable const*, bool);

  ~MMFilesSkiplistInLookupBuilder() = default;

  /// @brief Compute the next lookup values
  /// If returns false there is no further lookup
  bool next() override;

 private:
  bool forwardInPosition();

  void buildSearchValues();
};

/// @brief Iterator structure for skip list. We require a start and stop node
///
/// Intervals are open in the sense that both end points are not members
/// of the interval. This means that one has to use MMFilesSkiplist::nextNode
/// on the start node to get the first element and that the stop node
/// can be NULL. Note that it is ensured that all intervals in an iterator
/// are non-empty.
class MMFilesSkiplistIterator final : public IndexIterator {
 private:
  // Shorthand for the skiplist node
  using Node = containers::SkiplistNode<VPackSlice, MMFilesSkiplistIndexElement>;
  using TRI_Skiplist = containers::Skiplist<VPackSlice, MMFilesSkiplistIndexElement>;

 private:
  TRI_Skiplist const* _skiplistIndex;
  MMFilesIndexLookupContext _context;
  size_t _numPaths;
  bool _reverse;
  Node* _cursor;

  // The pair.first is the left border
  // The pair.second is the right border
  // Both borders are inclusive
  std::vector<std::pair<Node*, Node*>> _intervals;
  size_t _currentInterval;

  MMFilesBaseSkiplistLookupBuilder* _builder;
  std::vector<std::pair<LocalDocumentId, uint8_t const*>> _documentIds;

  std::function<int(void*, MMFilesSkiplistIndexElement const*, MMFilesSkiplistIndexElement const*, containers::SkiplistCmpType)> _CmpElmElm;

 public:
  MMFilesSkiplistIterator(LogicalCollection* collection, transaction::Methods* trx,
                          arangodb::MMFilesSkiplistIndex const* index,
                          TRI_Skiplist const* skiplist, size_t numPaths,
                          std::function<int(void*, MMFilesSkiplistIndexElement const*, MMFilesSkiplistIndexElement const*,
                                            containers::SkiplistCmpType)> const& CmpElmElm,
                          bool reverse, MMFilesBaseSkiplistLookupBuilder* builder);

  ~MMFilesSkiplistIterator() { delete _builder; }

  // always holds the last node returned, initially equal to
  // the _leftEndPoint (or the
  // _rightEndPoint in the reverse case),
  // can be nullptr if the iterator is exhausted.

 public:
  char const* typeName() const override { return "skiplist-index-iterator"; }

  /// @brief Get the next elements in the skiplist
  bool next(LocalDocumentIdCallback const& cb, size_t limit) override;
  bool nextDocument(DocumentCallback const& cb, size_t limit) override;

  /// @brief Reset the cursor
  void reset() override;

  size_t numPaths() const { return _numPaths; }

 private:
  /// @brief Initialize left and right endpoints with current lookup
  ///        value. Also points the _cursor to the border of this interval.
  void initNextInterval();

  /// @brief Forward the cursor to the next interval. If there was no
  ///        interval the next one is computed. If the _cursor has
  ///        nullptr after this call the iterator is exhausted.
  void forwardCursor();

  /// @brief Checks if the interval is valid. It is declared invalid if
  ///        one border is nullptr or the right is lower than left.
  bool intervalValid(void*, Node*, Node*) const;
};

class MMFilesSkiplistIndex : public MMFilesPathBasedIndex {
  struct KeyElementComparator {
    int operator()(void* userData, VPackSlice const* leftKey,
                   MMFilesSkiplistIndexElement const* rightElement) const;

    explicit KeyElementComparator(MMFilesSkiplistIndex* idx) { _idx = idx; }

   private:
    MMFilesSkiplistIndex* _idx;
  };

  struct ElementElementComparator {
    int operator()(void* userData, MMFilesSkiplistIndexElement const* leftElement,
                   MMFilesSkiplistIndexElement const* rightElement,
                   containers::SkiplistCmpType cmptype) const;

    explicit ElementElementComparator(MMFilesSkiplistIndex* idx) { _idx = idx; }

   private:
    MMFilesSkiplistIndex* _idx;
  };

  friend struct KeyElementComparator;
  friend struct ElementElementComparator;

  using TRI_Skiplist = containers::Skiplist<VPackSlice, MMFilesSkiplistIndexElement>;

 public:
  MMFilesSkiplistIndex() = delete;

  MMFilesSkiplistIndex(TRI_idx_iid_t iid, LogicalCollection& collection,
                       arangodb::velocypack::Slice const& info);

  ~MMFilesSkiplistIndex();

  IndexType type() const override { return Index::TRI_IDX_TYPE_SKIPLIST_INDEX; }

  char const* typeName() const override { return "skiplist"; }

  bool canBeDropped() const override { return true; }

  bool isSorted() const override { return true; }

  bool hasSelectivityEstimate() const override { return false; }

  size_t memory() const override;

  void toVelocyPackFigures(VPackBuilder&) const override;

  Result insert(transaction::Methods& trx, LocalDocumentId const& documentId,
                velocypack::Slice const& doc, Index::OperationMode mode) override;

  Result remove(transaction::Methods& trx, LocalDocumentId const& documentId,
                velocypack::Slice const& doc, Index::OperationMode mode) override;

  void unload() override;

  Index::FilterCosts supportsFilterCondition(std::vector<std::shared_ptr<arangodb::Index>> const& allIndexes,
                                             arangodb::aql::AstNode const* node,
                                             arangodb::aql::Variable const* reference,
                                             size_t itemsInIndex) const override;

  Index::SortCosts supportsSortCondition(arangodb::aql::SortCondition const* sortCondition,
                                         arangodb::aql::Variable const* reference,
                                         size_t itemsInindex) const override;

  std::unique_ptr<IndexIterator> iteratorForCondition(transaction::Methods* trx,
                                                      arangodb::aql::AstNode const* node,
                                                      arangodb::aql::Variable const* reference,
                                                      IndexIteratorOptions const& opts) override;

  arangodb::aql::AstNode* specializeCondition(arangodb::aql::AstNode* node,
                                              arangodb::aql::Variable const* reference) const override;

 private:
  bool accessFitsIndex(arangodb::aql::AstNode const*, arangodb::aql::AstNode const*,
                       arangodb::aql::AstNode const*, arangodb::aql::Variable const*,
                       std::vector<std::vector<arangodb::aql::AstNode const*>>&,
                       std::unordered_set<std::string>& nonNullAttributes) const;

  void matchAttributes(arangodb::aql::AstNode const*, arangodb::aql::Variable const*,
                       std::unordered_map<size_t, std::vector<arangodb::aql::AstNode const*>>&,
                       size_t& values,
                       std::unordered_set<std::string>& nonNullAttributes, bool) const;

  bool findMatchingConditions(arangodb::aql::AstNode const*, arangodb::aql::Variable const*,
                              std::vector<std::vector<arangodb::aql::AstNode const*>>&,
                              bool&) const;

  /// @brief Checks if the interval is valid. It is declared invalid if
  ///        one border is nullptr or the right is lower than left.
  // Shorthand for the skiplist node
  using Node = containers::SkiplistNode<VPackSlice, MMFilesSkiplistIndexElement>;

  bool intervalValid(void*, Node* left, Node* right) const;

 private:
  ElementElementComparator CmpElmElm;

  KeyElementComparator CmpKeyElm;

  /// @brief the actual skiplist index
  TRI_Skiplist* _skiplistIndex;
};
}  // namespace arangodb

#endif


text:
#include <aws/location/model/IntendedUse.h>
#include <aws/core/utils/HashingUtils.h>
#include <aws/core/Globals.h>
#include <aws/core/utils/EnumParseOverflowContainer.h>

using namespace Aws::Utils;

namespace Aws
{
  namespace LocationService
  {
    namespace Model
    {
      namespace IntendedUseMapper
      {

        static const int SingleUse_HASH = HashingUtils::HashString("SingleUse");
        static const int Storage_HASH = HashingUtils::HashString("Storage");

        IntendedUse GetIntendedUseForName(const Aws::String& name)
        {
          int hashCode = HashingUtils::HashString(name.c_str());
          if (hashCode == SingleUse_HASH)
          {
            return IntendedUse::SingleUse;
          }
          else if (hashCode == Storage_HASH)
          {
            return IntendedUse::Storage;
          }
          EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
          if(overflowContainer)
          {
            overflowContainer->StoreOverflow(hashCode, name);
            return static_cast<IntendedUse>(hashCode);
          }

          return IntendedUse::NOT_SET;
        }

        Aws::String GetNameForIntendedUse(IntendedUse enumValue)
        {
          switch(enumValue)
          {
          case IntendedUse::SingleUse:
            return "SingleUse";
          case IntendedUse::Storage:
            return "Storage";
          default:
            EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
            if(overflowContainer)
            {
              return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
            }

            return {};
          }
        }

      } // namespace IntendedUseMapper
    } // namespace Model
  } // namespace LocationService
} // namespace Aws


text:
package com.phloc.commons.io.misc;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Locale;

import org.junit.Test;

import com.phloc.commons.CGlobal;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
 * Test class for {@link SizeHelper}
 *
 * @author Philip Helger
 */
public final class SizeHelperTest
{
  /**
   * Test constructors
   */
  @Test
  public void testCtor ()
  {
    final SizeHelper sh = SizeHelper.getSizeHelperOfLocale (Locale.CANADA);
    assertNotNull (sh);
    assertNotNull (sh.toString ());

    try
    {
      SizeHelper.getSizeHelperOfLocale (null);
      fail ();
    }
    catch (final NullPointerException ex)
    {}
  }

  /**
   * Test method getAsKB
   */
  @SuppressFBWarnings ("TQ_NEVER_VALUE_USED_WHERE_ALWAYS_REQUIRED")
  @Test
  public void testGetAsKB ()
  {
    // Use fixed locale for constant decimal separator
    final SizeHelper aSH = SizeHelper.getSizeHelperOfLocale (Locale.ENGLISH);

    try
    {
      aSH.getAsKB (5 * CGlobal.BYTES_PER_KILOBYTE, -1);
      fail ();
    }
    catch (final IllegalArgumentException ex)
    {}

    // default
    assertEquals ("0KB", aSH.getAsKB (0));
    assertEquals ("5KB", aSH.getAsKB (5 * CGlobal.BYTES_PER_KILOBYTE));
    assertEquals ("2KB", aSH.getAsKB (2 * CGlobal.BYTES_PER_KILOBYTE));
    assertEquals ("1KB", aSH.getAsKB (2 * CGlobal.BYTES_PER_KILOBYTE - 1));
    assertEquals ("1024KB", aSH.getAsKB (1 * CGlobal.BYTES_PER_MEGABYTE));

    // with decimals
    assertEquals ("0.00KB", aSH.getAsKB (0, 2));
    assertEquals ("5KB", aSH.getAsKB (5 * CGlobal.BYTES_PER_KILOBYTE, 0));
    assertEquals ("5.0KB", aSH.getAsKB (5 * CGlobal.BYTES_PER_KILOBYTE, 1));
    assertEquals ("5.00KB", aSH.getAsKB (5 * CGlobal.BYTES_PER_KILOBYTE, 2));
    assertEquals ("5.000KB", aSH.getAsKB (5 * CGlobal.BYTES_PER_KILOBYTE, 3));
    assertEquals ("5.0000KB", aSH.getAsKB (5 * CGlobal.BYTES_PER_KILOBYTE, 4));
    assertEquals ("2.00KB", aSH.getAsKB (2 * CGlobal.BYTES_PER_KILOBYTE, 2));
    assertEquals ("1.99KB", aSH.getAsKB (2 * CGlobal.BYTES_PER_KILOBYTE - 10, 2));
    assertEquals ("1024.00KB", aSH.getAsKB (1 * CGlobal.BYTES_PER_MEGABYTE, 2));
  }

  /**
   * Test method getAsMB
   */
  @Test
  public void testGetAsMB ()
  {
    // Use fixed locale for constant decimal separator
    final SizeHelper aSH = SizeHelper.getSizeHelperOfLocale (Locale.ENGLISH);

    // default
    assertEquals ("0MB", aSH.getAsMB (0));
    assertEquals ("5MB", aSH.getAsMB (5 * CGlobal.BYTES_PER_MEGABYTE));
    assertEquals ("2MB", aSH.getAsMB (2 * CGlobal.BYTES_PER_MEGABYTE));
    assertEquals ("1MB", aSH.getAsMB (2 * CGlobal.BYTES_PER_MEGABYTE - 1));
    assertEquals ("1024MB", aSH.getAsMB (1 * CGlobal.BYTES_PER_GIGABYTE));

    // with decimals
    assertEquals ("0.00MB", aSH.getAsMB (0, 2));
    assertEquals ("5MB", aSH.getAsMB (5 * CGlobal.BYTES_PER_MEGABYTE, 0));
    assertEquals ("5.0MB", aSH.getAsMB (5 * CGlobal.BYTES_PER_MEGABYTE, 1));
    assertEquals ("5.00MB", aSH.getAsMB (5 * CGlobal.BYTES_PER_MEGABYTE, 2));
    assertEquals ("5.000MB", aSH.getAsMB (5 * CGlobal.BYTES_PER_MEGABYTE, 3));
    assertEquals ("5.0000MB", aSH.getAsMB (5 * CGlobal.BYTES_PER_MEGABYTE, 4));
    assertEquals ("2.00MB", aSH.getAsMB (2 * CGlobal.BYTES_PER_MEGABYTE, 2));
    assertEquals ("1.99MB", aSH.getAsMB (2 * CGlobal.BYTES_PER_MEGABYTE - 10 * 1024, 2));
    assertEquals ("1024.00MB", aSH.getAsMB (1 * CGlobal.BYTES_PER_GIGABYTE, 2));
  }

  /**
   * Test method getAsGB
   */
  @Test
  public void testGetAsGB ()
  {
    // Use fixed locale for constant decimal separator
    final SizeHelper aSH = SizeHelper.getSizeHelperOfLocale (Locale.ENGLISH);

    // default
    assertEquals ("0GB", aSH.getAsGB (0));
    assertEquals ("5GB", aSH.getAsGB (5 * CGlobal.BYTES_PER_GIGABYTE));

    // with decimals
    assertEquals ("0.00GB", aSH.getAsGB (0, 2));
    assertEquals ("5GB", aSH.getAsGB (5 * CGlobal.BYTES_PER_GIGABYTE, 0));
    assertEquals ("5.0GB", aSH.getAsGB (5 * CGlobal.BYTES_PER_GIGABYTE, 1));
    assertEquals ("5.00GB", aSH.getAsGB (5 * CGlobal.BYTES_PER_GIGABYTE, 2));
    assertEquals ("5.000GB", aSH.getAsGB (5 * CGlobal.BYTES_PER_GIGABYTE, 3));
    assertEquals ("5.0000GB", aSH.getAsGB (5 * CGlobal.BYTES_PER_GIGABYTE, 4));
  }

  /**
   * Test method getAsTB
   */
  @Test
  public void testGetAsTB ()
  {
    // Use fixed locale for constant decimal separator
    final SizeHelper aSH = SizeHelper.getSizeHelperOfLocale (Locale.ENGLISH);

    // default
    assertEquals ("0TB", aSH.getAsTB (0));
    assertEquals ("5TB", aSH.getAsTB (5 * CGlobal.BYTES_PER_TERABYTE));

    // with decimals
    assertEquals ("0.00TB", aSH.getAsTB (0, 2));
    assertEquals ("5TB", aSH.getAsTB (5 * CGlobal.BYTES_PER_TERABYTE, 0));
    assertEquals ("5.0TB", aSH.getAsTB (5 * CGlobal.BYTES_PER_TERABYTE, 1));
    assertEquals ("5.00TB", aSH.getAsTB (5 * CGlobal.BYTES_PER_TERABYTE, 2));
    assertEquals ("5.000TB", aSH.getAsTB (5 * CGlobal.BYTES_PER_TERABYTE, 3));
    assertEquals ("5.0000TB", aSH.getAsTB (5 * CGlobal.BYTES_PER_TERABYTE, 4));
  }

  /**
   * Test method getAsPB
   */
  @Test
  public void testGetAsPB ()
  {
    // Use fixed locale for constant decimal separator
    final SizeHelper aSH = SizeHelper.getSizeHelperOfLocale (Locale.ENGLISH);

    // default
    assertEquals ("0PB", aSH.getAsPB (0));
    assertEquals ("5PB", aSH.getAsPB (5 * CGlobal.BYTES_PER_PETABYTE));

    // with decimals
    assertEquals ("0.00PB", aSH.getAsPB (0, 2));
    assertEquals ("5PB", aSH.getAsPB (5 * CGlobal.BYTES_PER_PETABYTE, 0));
    assertEquals ("5.0PB", aSH.getAsPB (5 * CGlobal.BYTES_PER_PETABYTE, 1));
    assertEquals ("5.00PB", aSH.getAsPB (5 * CGlobal.BYTES_PER_PETABYTE, 2));
    assertEquals ("5.000PB", aSH.getAsPB (5 * CGlobal.BYTES_PER_PETABYTE, 3));
    assertEquals ("5.0000PB", aSH.getAsPB (5 * CGlobal.BYTES_PER_PETABYTE, 4));
  }

  @Test
  public void testGetAsMatching ()
  {
    // Use fixed locale for constant decimal separator
    final SizeHelper aSH = SizeHelper.getSizeHelperOfLocale (Locale.ENGLISH);

    // default
    assertEquals ("5PB", aSH.getAsMatching (5 * CGlobal.BYTES_PER_PETABYTE));
    assertEquals ("5TB", aSH.getAsMatching (5 * CGlobal.BYTES_PER_TERABYTE));
    assertEquals ("5GB", aSH.getAsMatching (5 * CGlobal.BYTES_PER_GIGABYTE));
    assertEquals ("5MB", aSH.getAsMatching (5 * CGlobal.BYTES_PER_MEGABYTE));
    assertEquals ("5KB", aSH.getAsMatching (5 * CGlobal.BYTES_PER_KILOBYTE));
    assertEquals ("5B", aSH.getAsMatching (5));

    // with decimals
    assertEquals ("5.0PB", aSH.getAsMatching (5 * CGlobal.BYTES_PER_PETABYTE, 1));
    assertEquals ("5.00TB", aSH.getAsMatching (5 * CGlobal.BYTES_PER_TERABYTE, 2));
    assertEquals ("5.000GB", aSH.getAsMatching (5 * CGlobal.BYTES_PER_GIGABYTE, 3));
    assertEquals ("5.0000MB", aSH.getAsMatching (5 * CGlobal.BYTES_PER_MEGABYTE, 4));
    assertEquals ("5.00000KB", aSH.getAsMatching (5 * CGlobal.BYTES_PER_KILOBYTE, 5));
    assertEquals ("5.000000B", aSH.getAsMatching (5, 6));

    // BigInteger
    assertEquals ("5PB", aSH.getAsMatching (new BigInteger ("14000000000000", 16)));
    assertEquals ("5TB", aSH.getAsMatching (new BigInteger ("50000000000", 16)));
    assertEquals ("5.00PB", aSH.getAsMatching (new BigInteger ("14000000000000", 16), 2));
    assertEquals ("5.000TB", aSH.getAsMatching (new BigInteger ("50000000000", 16), 3));

    // BigDecimal
    assertEquals ("5PB", aSH.getAsMatching (new BigDecimal (new BigInteger ("14000000000000", 16))));
    assertEquals ("5TB", aSH.getAsMatching (new BigDecimal (new BigInteger ("50000000000", 16))));
    assertEquals ("5.00PB", aSH.getAsMatching (new BigDecimal (new BigInteger ("14000000000000", 16)), 2));
    assertEquals ("5.000TB", aSH.getAsMatching (new BigDecimal (new BigInteger ("50000000000", 16)), 3));
  }

  @Test
  public void testOutOfBounds ()
  {
    final SizeHelper aSH = SizeHelper.getSizeHelperOfLocale (Locale.KOREAN);
    assertNotNull (aSH.getAsMatching (CGlobal.BIGINT_MAX_LONG));
    assertNotNull (aSH.getAsMatching (CGlobal.BIGINT_MIN_LONG));
    assertNotNull (aSH.getAsMatching (CGlobal.BIGDEC_MAX_LONG));
    assertNotNull (aSH.getAsMatching (CGlobal.BIGDEC_MIN_LONG));
    // Too large
    BigInteger aValueInt = CGlobal.BIGINT_MAX_LONG.multiply (CGlobal.BIGINT_MAX_LONG);
    try
    {
      aSH.getAsMatching (aValueInt);
      fail ();
    }
    catch (final IllegalArgumentException ex)
    {}
    // Too small
    aValueInt = CGlobal.BIGINT_MIN_LONG.multiply (CGlobal.BIGINT_MAX_LONG);
    try
    {
      aSH.getAsMatching (aValueInt);
      fail ();
    }
    catch (final IllegalArgumentException ex)
    {}
    // Too large
    BigDecimal aValueDbl = CGlobal.BIGDEC_MAX_LONG.multiply (CGlobal.BIGDEC_MAX_LONG);
    try
    {
      aSH.getAsMatching (aValueDbl);
      fail ();
    }
    catch (final IllegalArgumentException ex)
    {}
    // Too small
    aValueDbl = CGlobal.BIGDEC_MIN_LONG.multiply (CGlobal.BIGDEC_MAX_LONG);
    try
    {
      aSH.getAsMatching (aValueDbl);
      fail ();
    }
    catch (final IllegalArgumentException ex)
    {}
  }
}


text:
layout: zh_cn/default
permalink: zh_cn/rangeofmarkets
lang: zh_cn
title: Range of Markets
tag: main
---

				<form id="verify-email-form">

						<input class="clean-input" autocomplete="off" name="email" id="email" maxlength="50" placeholder="Enter your email">

						<button class="button-secondary" id="btn-verify-email" type="submit">Create Free Account</button>

				</form>

Range of Markets

Step into a whole new world of trading with Champion FX. You can access many markets all through one platform. We have paved the way for you. All you have to do is step in.

Trade with Champion FX and take your trading to a whole new level.

Access global Forex, CFD's, indices, stocks, futures, and commodities all through one platform. Champion FX is commited to providing you with the most complete offering in online trading - today and tomorrow. We are always looking to expand our available instruments.

Forex

Trade over 70 FX pairs, combining ultra-low or fixed spreads and Non Dealing Desk (NDD) execution in a high-speed trading environment.

Leverage up to 1,000

Fixed of Floating Spreads

Instant Execution

Over 70 FX Pairs Available

Metals

Trade a variety of flexible precious metals contracts, including gold (per gram or ounce) with highly competitive pricing.

Leverage up to 1,000

Fixed of Floating Spreads

Instant Execution

Over 70 FX Pairs Available

Futures

Trade futures contracts on a variety of underlying instruments.

Indices, Agricultural Commodities, and Energies

Perfect for Hedging Against Future Price Risk

Commission Free

CFD Trading

Trade contracts for difference (CFD) across equity indices, energies, alternative asset futures, and other instruments for more trading opportunities.

Diversify Your trading

Access Global Markets

Trade long or Short


text:
package net.ymate.platform.persistence.redis;

import net.ymate.platform.core.beans.annotation.Ignored;
import net.ymate.platform.core.persistence.IDataSourceConfigurable;

/**
 * @author 刘镇 (suninformation@163.com) on 2019-08-15 04:30
 * @since 2.1.0
 */
@Ignored
public interface IRedisDataSourceConfigurable extends IDataSourceConfigurable {
}


text:
NCM\::Component\::metaconfig\::graphite - config
################################################

Variables
---------

 - CARBON_BASEDIR


text:
import ReactTagSelect from 'ReactTagSelect';
import React, { Component } from 'react';
import ReactDOM from 'react-dom';

/* eslint-disable */
// Set up test data
var Countries = ['Afghanistan','Albania','Algeria','Andorra','Angola','Anguilla','Antigua & Barbuda','Argentina','Armenia','Aruba','Australia','Austria','Azerbaijan','Bahamas'
  ,'Bahrain','Bangladesh','Barbados','Belarus','Belgium','Belize','Benin','Bermuda','Bhutan','Bolivia','Bosnia & Herzegovina','Botswana','Brazil','British Virgin Islands'
  ,'Brunei','Bulgaria','Burkina Faso','Burundi','Cambodia','Cameroon','Cape Verde','Cayman Islands','Chad','Chile','China','Colombia','Congo','Cook Islands','Costa Rica'
  ,'Cote D Ivoire','Croatia','Cruise Ship','Cuba','Cyprus','Czech Republic','Denmark','Djibouti','Dominica','Dominican Republic','Ecuador','Egypt','El Salvador','Equatorial Guinea'
  ,'Estonia','Ethiopia','Falkland Islands','Faroe Islands','Fiji','Finland','France','French Polynesia','French West Indies','Gabon','Gambia','Georgia','Germany','Ghana'
  ,'Gibraltar','Greece','Greenland','Grenada','Guam','Guatemala','Guernsey','Guinea','Guinea Bissau','Guyana','Haiti','Honduras','Hong Kong','Hungary','Iceland','India'
  ,'Indonesia','Iran','Iraq','Ireland','Isle of Man','Israel','Italy','Jamaica','Japan','Jersey','Jordan','Kazakhstan','Kenya','Kuwait','Kyrgyz Republic','Laos','Latvia'
  ,'Lebanon','Lesotho','Liberia','Libya','Liechtenstein','Lithuania','Luxembourg','Macau','Macedonia','Madagascar','Malawi','Malaysia','Maldives','Mali','Malta','Mauritania'
  ,'Mauritius','Mexico','Moldova','Monaco','Mongolia','Montenegro','Montserrat','Morocco','Mozambique','Namibia','Nepal','Netherlands','Netherlands Antilles','New Caledonia'
  ,'New Zealand','Nicaragua','Niger','Nigeria','Norway','Oman','Pakistan','Palestine','Panama','Papua New Guinea','Paraguay','Peru','Philippines','Poland','Portugal'
  ,'Puerto Rico','Qatar','Reunion','Romania','Russia','Rwanda','Saint Pierre & Miquelon','Samoa','San Marino','Satellite','Saudi Arabia','Senegal','Serbia','Seychelles'
  ,'Sierra Leone','Singapore','Slovakia','Slovenia','South Africa','South Korea','Spain','Sri Lanka','St Kitts & Nevis','St Lucia','St Vincent','St. Lucia','Sudan'
  ,'Suriname','Swaziland','Sweden','Switzerland','Syria','Taiwan','Tajikistan','Tanzania','Thailand','Timor L\'Este','Togo','Tonga','Trinidad & Tobago','Tunisia'
  ,'Turkey','Turkmenistan','Turks & Caicos','Uganda','Ukraine','United Arab Emirates','United Kingdom','United States of America','Uruguay','Uzbekistan','Venezuela','Vietnam','Virgin Islands (US)'
  ,'Yemen','Zambia','Zimbabwe'];
/* eslint-enable */

class App extends Component {
  constructor(props) {
    super(props);
    this.state = {
      tags: [ {id: 1, text: 'Thailand'}, {id: 2, text: 'India'} ],
      suggestions: Countries
    };
  }
  handleDelete = (i) => {
    const tags = this.state.tags;
    tags.splice(i, 1);
    this.setState({tags: tags});
  }
  handleAddition = (tag) => {
    const tags = this.state.tags;
    tags.push({
      id: tags.length + 1,
      text: tag
    });
    this.setState({tags: tags});
  }
  render() {
    const tags = this.state.tags;

    return (

        <ReactTagSelect tags={tags}
          suggestions={Countries}
          handleDelete={this.handleDelete}
          handleAddition={this.handleAddition}
          minQueryLength={2} />

          {JSON.stringify(tags, null, 2)}

    );
  }
}

ReactDOM.render(<App />, document.getElementById('app'));


text:
<!doctype html>

        <meta charset="utf-8">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <title>angular-oauth2-oidc</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <link rel="icon" type="image/x-icon" href="../images/favicon.ico">
	   <link rel="stylesheet" href="../styles/style.css">
        <link rel="stylesheet" href="../styles/dark.css" media="(prefers-color-scheme: dark)">

            angular-oauth2-oidc
            <button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>

<input type="text" placeholder="Type to search">
            <compodoc-menu></compodoc-menu>

                   <compodoc-menu mode="normal"></compodoc-menu>

Modules

OAuthModule

        Info

        Source

File

            projects/lib/src/angular-oauth-oidc.module.ts

        Methods

                        Static
                        forRoot

                    forRoot(config: OAuthModuleConfig, validationHandlerClass)

Defined in projects/lib/src/angular-oauth-oidc.module.ts:14

                        Parameters :

                                    Name
                                    Type
                                    Optional
                                    Default value

                                    config

                                                OAuthModuleConfig

                                        No

                                        null

                                    validationHandlerClass

                                        No

                                        NullValidationHandler

                        Returns :     ModuleWithProviders<OAuthModule>

import { NgModule, ModuleWithProviders } from '@angular/core';
import { CommonModule } from '@angular/common';

import { OAuthModuleConfig } from './oauth-module.config';
import { NullValidationHandler } from './token-validation/null-validation-handler';
import { provideOAuthClient } from './provider';

@NgModule({
  imports: [CommonModule],
  declarations: [],
  exports: [],
})
export class OAuthModule {
  static forRoot(
    config: OAuthModuleConfig = null,
    validationHandlerClass = NullValidationHandler
  ): ModuleWithProviders<OAuthModule> {
    return {
      ngModule: OAuthModule,
      providers: [provideOAuthClient(config, validationHandlerClass)],
    };
  }
}

 result-matching ""

No results matching ""


text:
<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:amq="http://activemq.apache.org/schema/core"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd
  http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">

    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <value>file:${activemq.base}/conf/credentials.properties</value>
        </property>
    </bean>

    <!--
      For more information about what MCollective requires in this file,
      see https://docs.puppetlabs.com/mcollective/deploy/middleware/activemq.html
    -->

    <!--
      WARNING: The elements that are direct children of <broker> MUST BE IN
      ALPHABETICAL ORDER. This is fixed in ActiveMQ 5.6.0, but affects
      previous versions back to 5.4.
      https://issues.apache.org/jira/browse/AMQ-3570
    -->

    <!-- In a network of brokers, the brokerName attribute must be unique. -->
    <broker xmlns="http://activemq.apache.org/schema/core" brokerName="broker3" useJmx="true" schedulePeriodForDestinationPurge="60000">
        <!--
          MCollective generally expects producer flow control to be turned off.
          It will also generate a limitless number of single-use reply queues,
          which should be garbage-collected after about five minutes to conserve
          memory.

          For more information, see:
          http://activemq.apache.org/producer-flow-control.html
        -->
        <destinationPolicy>
          <policyMap>
            <policyEntries>
              <policyEntry topic=">" producerFlowControl="false"/>
              <policyEntry queue="*.reply.>" gcInactiveDestinations="true" inactiveTimoutBeforeGC="300000" />
            </policyEntries>
          </policyMap>
        </destinationPolicy>

        <managementContext>
            <managementContext createConnector="false"/>
        </managementContext>

        <!--
          Configure message persistence for the broker. MCollective only
          requires this in a network of brokers, where it's used to prevent
          duplicate messages.

          The default persistence mechanism is the KahaDB store (identified by
          the kahaDB tag). For more information, see:

          http://activemq.apache.org/persistence.html
        -->
        <persistenceAdapter>
            <kahaDB directory="${activemq.base}/data/kahadb"/>
        </persistenceAdapter>

        <plugins>
          <statisticsBrokerPlugin/>

          <!--
            This configures the users and groups used by this broker. Groups
            are referenced below, in the write/read/admin attributes
            of each authorizationEntry element.
          -->
          <simpleAuthenticationPlugin>
            <users>
              <authenticationUser username="amq" password="secret" groups="admins,everyone"/>
              <authenticationUser username="mcollective" password="marionette" groups="mcollective,everyone"/>
              <authenticationUser username="admin" password="secret" groups="mcollective,admins,everyone"/>
            </users>
          </simpleAuthenticationPlugin>

          <!--
            Configure which users are allowed to read and write where. Permissions
            are organized by group; groups are configured above, in the
            authentication plugin.

            With the rules below, both servers and admin users belong to group
            mcollective, which can both issue and respond to commands. For an
            example that splits permissions and doesn't allow servers to issue
            commands, see:
            https://docs.puppetlabs.com/mcollective/deploy/middleware/activemq.html#detailed-restrictions
          -->
          <authorizationPlugin>
            <map>
              <authorizationMap>
                <authorizationEntries>
                  <authorizationEntry queue=">" write="admins" read="admins" admin="admins" />
                  <authorizationEntry topic=">" write="admins" read="admins" admin="admins" />
                  <authorizationEntry topic="mcollective.>" write="mcollective" read="mcollective" admin="mcollective" />
                  <authorizationEntry queue="mcollective.>" write="mcollective" read="mcollective" admin="mcollective" />
                  <!--
                    The advisory topics are part of ActiveMQ, and all users need access to them.
                    The "everyone" group is not special; you need to ensure every user is a member.
                  -->
                  <authorizationEntry topic="ActiveMQ.Advisory.>" read="everyone" write="everyone" admin="everyone"/>
                </authorizationEntries>
              </authorizationMap>
            </map>
          </authorizationPlugin>
        </plugins>

        <!--
          The systemUsage controls the maximum amount of space the broker will
          use for messages. For more information, see:
          https://docs.puppetlabs.com/mcollective/deploy/middleware/activemq.html#memory-and-temp-usage-for-messages-systemusage
        -->
        <systemUsage>
            <systemUsage>
                <memoryUsage>
                    <memoryUsage limit="20 mb"/>
                </memoryUsage>
                <storeUsage>
                    <storeUsage limit="1 gb" name="foo"/>
                </storeUsage>
                <tempUsage>
                    <tempUsage limit="100 mb"/>
                </tempUsage>
            </systemUsage>
        </systemUsage>

        <!--
          The transport connectors allow ActiveMQ to listen for connections over
          a given protocol. MCollective uses Stomp, and other ActiveMQ brokers
          use OpenWire. You'll need different URLs depending on whether you are
          using TLS. For more information, see:

          https://docs.puppetlabs.com/mcollective/deploy/middleware/activemq.html#transport-connectors
        -->
        <transportConnectors>
            <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
            <transportConnector name="stomp+nio" uri="stomp+nio://0.0.0.0:61613"/>
            <!-- If using TLS, uncomment this and comment out the previous connector:
              <transportConnector name="stomp+ssl" uri="stomp+ssl://0.0.0.0:61614?needClientAuth=true&transport.enabledProtocols=TLSv1,TLSv1.1,TLSv1.2"/>
            -->
        </transportConnectors>
    </broker>

    <!--
      Enable web consoles, REST and Ajax APIs and demos.
      It also includes Camel (with its web console); see ${ACTIVEMQ_HOME}/conf/camel.xml for more info.

      See ${ACTIVEMQ_HOME}/conf/jetty.xml for more details.
    -->
    <import resource="jetty.xml"/>
</beans>


text:
using namespace DirectX;

struct ParticleEffectInstance {
	XMVECTOR position;
	ParticleEffect effect;
};

struct SphereVertex {
	XMFLOAT3 position;
	XMFLOAT3 normal;
	XMFLOAT2 uv;
};

struct DirectionalLight
{
    XMFLOAT4 position;
    XMFLOAT3 color;
    XMFLOAT3 ambient;
    float _padding[2];
};

struct Light
{
    XMFLOAT3 position;
    float    range;
    XMFLOAT3 color;
    float    intensity;
};

struct LightBuffer {
    uint32_t LightCount;
    uint32_t padding[3];
    Light Lights[128];
};
static int a = sizeof(LightBuffer);

class ParticleSystem {
public:
	ParticleSystem(const wchar_t *file, UINT capacity, UINT width, UINT height, ID3D11Device *device, ID3D11DeviceContext *cxt);
	~ParticleSystem();

	void ProcessAnchoredFX(AnchoredParticleEffect *fx, SimpleMath::Matrix model, float dt);
	void ProcessFX(ParticleEffect *fx, SimpleMath::Matrix model, float dt);
	void ProcessFX(ParticleEffect &fx, XMMATRIX model, XMVECTOR velocity, float dt);
	void AddFX(std::string name, XMMATRIX model);
	ParticleEffect GetFX(std::string name);

	void update(Camera *cam, float dt);
	void render(Camera *cam, CommonStates *states, ID3D11DepthStencilView *dst_dsv, ID3D11RenderTargetView *dst_rtv, bool debug);
	void frame();
    GeometryParticleInstance *UpdateParticles(XMVECTOR anchor, std::vector<GeometryParticle> &particles, float dt, GeometryParticleInstance *output, GeometryParticleInstance *max);

	void ReadSphereModel();

//private:
	UINT capacity;

	std::vector<ParticleEffect> m_ParticleEffectDefinitions;

	std::vector<ParticleEffectInstance> m_ParticleEffects;
	std::vector<AnchoredParticleEffect*> m_AnchoredEffects;

	std::vector<BillboardParticle> m_BillboardParticles;
	std::vector<GeometryParticle> m_GeometryParticles;
	std::vector<Trail> m_TrailParticles;

    LightBuffer m_ParticleLights;

    ConstantBuffer<DirectionalLight> *m_DirectionalLight;
    ConstantBuffer<LightBuffer> *m_Lights;
	int m_GeometryIndices;
	VertexBuffer<SphereVertex> *m_GeometryBuffer;
	IndexBuffer<UINT16> *m_GeometryIndexBuffer;
	VertexBuffer<GeometryParticleInstance> *m_GeometryInstanceBuffer;
	VertexBuffer<BillboardParticle> *m_BillboardBuffer;
	VertexBuffer<TrailParticle> *m_TrailBuffer;

	ID3D11BlendState *m_ParticleBlend;
	ID3D11InputLayout *m_DefaultBillboardLayout;
	ID3D11VertexShader *m_DefaultBillboardVS;

	ID3D11InputLayout *m_DefaultGeometryLayout;
	ID3D11VertexShader *m_DefaultGeometryVS;

	ID3D11GeometryShader *m_DefaultBillboardGS;

	ID3D11VertexShader   *trail_vs;
	ID3D11GeometryShader *trail_gs;
	ID3D11PixelShader    *trail_ps;
	ID3D11InputLayout *trail_layout;

	ID3D11Device *device;
	ID3D11DeviceContext *cxt;
};

extern ParticleSystem *FXSystem;


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

  <title>AniSpriteLoader</title>
  <meta name="date" content="2016-04-28">
  <link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

testing.AniPong

Class AniSpriteLoader

java.lang.Object

testing.AniPong.AniSpriteLoader

public class AniSpriteLoader
extends java.lang.Object

Created by Tom on 4/25/2016.

Constructor Summary

Constructors

                Constructor and Description

                AniSpriteLoader()

Method Summary

All Methods Static Methods Concrete Methods

                Modifier and Type
                Method and Description

                static IEntity

                createBall(java.lang.String name,
                  Position pos)

                static IEntity

                createPaddle(java.lang.String name,
                  Position pos)

                static IEntity

                createPlatform(java.lang.String name,
                  Position pos)

Methods inherited from class java.lang.Object

                clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

AniSpriteLoader

public AniSpriteLoader()

Method Detail

createBall

public static IEntity createBall(java.lang.String name,
                                 Position pos)

createPaddle

public static IEntity createPaddle(java.lang.String name,
                                   Position pos)

createPlatform

public static IEntity createPlatform(java.lang.String name,
                                     Position pos)

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
<?php $this->load->view("includes/side-menu"); ?>

  <dashboard-html :profile-details="profileDetails" :profile-rating="profileRating" :dashboard-metrics="dashboardMetrics"></dashboard-html>


text:
Version 0.1: Extremely buggy, work in progress. Good results are not guaranteed.

TFASTS is a set of command-line tools for manipulating audio in the spectrogram domain.

You can use TFASTS to remove some noise from audio recordings, if you have clean recordings to learn from.

### Example Usage

Suppose you have dozens of clean audio recordings of African Swallow mating calls, like so:

        clearly_recorded_audio_files/african_swallows/example_1.wav
        clearly_recorded_audio_files/african_swallows/example_2.wav
        ...

TFASTS can process these calls to learn what African Swallows sound like.

        learn -i clearly_recorded_audio_files/african_swallows/ -o african_swallows.rf

Now, suppose you go outside with a microphone and record a flock of swallows as they migrate.

        noisy/african_swallows/example_1.wav
        noisy/african_swallows/example_2.wav
        ...

Your recordings might contain noise from wind, rain, and passing automobiles. You want to hear less noise, and more African Swallow. TFASTS can remove noise from the recording:

        filter -m african_swallows.rf -i noisy/african_swallows/example_1.wav -o filtered_example_1.wav

If all goes well, the output file will contain less noise, and more African Swallow. The quality of results depends on how many recordings of swallows you have, how much non-Swallow noise exists in the source recordings, and many command-line parameters.

### But I Don't Have Any Clean Recordings!

TFASTS can still help you! Suppose all you have are noisy recordings, containing cars, wind, etc. among the Swallow calls.

        noisy_recordings/african_swallows/example_1.wav
        noisy_recordings/african_swallows/example_2.wav
        ...

You can teach TFASTS which sounds in your audio recordings are African Swallows, and which sounds are undesired noise.

First, use the Spectrogram tool to generate viewable BMP-format representations of the audio in each noisy file.

        spectrogram -i noisy_recordings/african_swallows/example_1.wav -o noisy_spectrograms/example_1.bmp
        spectrogram -i noisy_recordings/african_swallows/example_2.wav -o noisy_spectrograms/example_2.bmp
        ...

Spectrograms look like this:

![Spectrogram alt text](/demo_specs/PC5_20090703_110000_0040.jpg?raw=true)

Now, open and view each spectrogram. Using an image manipulation program like GIMP, color all the African Swallow calls white, and color all the noise black. Spectrogram labels look like this:

![Spectrogram Label alt text](/demo_labels/PC5_20090703_110000_0040.jpg?raw=true)

Save these "spectrogram labels" in a separate folder:

        spectrogram_labels/example_1.bmp
        spectrogram_labels/example_2.bmp
        ...

Now, run:

        learn -i noisy_recordings/african_swallows/ -l spectrogram_labels/ -o african_swallows.rf

You can now use the 'filter' tool as above to remove noise from recordings.

### What Do I Need To Build It?
Linux requirements:

        sudo apt-get install software-properties-common
        sudo add-apt-repository 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise main'
        wget -O llvm-snapshot.gpg.key http://llvm.org/apt/llvm-snapshot.gpg.key
        sudo apt-key add llvm-snapshot.gpg.key
        sudo apt-get update
        sudo apt-get install clang-3.4 clang-3.4-doc libclang-common-3.4-dev libclang-3.4-dev libclang1-3.4 libclang1-3.4-dbg libllvm-3.4-ocaml-dev libllvm3.4 libllvm3.4-dbg lldb-3.4 llvm-3.4 llvm-3.4-dev llvm-3.4-doc llvm-3.4-examples llvm-3.4-runtime clang-modernize-3.4 clang-format-3.4

OSX requirements: XCode 4.3+ with Command-Line Tools installed.

Windows requirements: MSVC++ 2010 or higher. Configuration is left as an excercise for the reader.

### How Do I Build It?
        git clone http://github.com/lwneal/tfasts
        cd tfasts
        make


text:
package io.compgen.common.progress;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketTimeoutException;
import java.util.ArrayList;
import java.util.List;

public class SocketProgress extends BaseProgress {
    protected static Thread serverThread = null;
    protected static List<SocketProgress> progresses = new ArrayList<SocketProgress>();
	protected static String header = null;

	public static void setHeader(String header) {
		SocketProgress.header = header;
    }

    protected static String getStatusMessage() {
        String str = "";
        str += SocketProgress.header+"\n";
        for (SocketProgress sp:progresses) {
            if (sp.name != null) {
                str += "Name     : " + sp.name + "\n";
            }
            str += "\n";
            str += "Started  : " + sp.startDate + "\n";
            str += "Elapsed  : " + secondsToString(sp.elapsedMilliSec() / 1000) + "\n";

            if (sp.total > 0) {
                str += "Remaining: " + secondsToString(sp.estRemainingSec()) + "\n\n";
                str += "Total    : " + sp.total + "\n";
                str += "Current  : " + sp.current + " (" + String.format("%.1f", sp.pctComplete()*100) + "%)\n";
            }

            if (sp.msg != null) {
                str += "\n";
                str += sp.msg;
            }
            str += "\n";

        }
        str += "\n";
        return str;
    }

    protected String socketPath=null;
    protected int port = 0;

    /**
     *
     * @param socketPath - the socket port will be written to this file location
     */
    public SocketProgress(String socketPath) {
        this.socketPath = socketPath;
    }

    public SocketProgress(int port) {
        this.port = port;
    }

    @Override
    synchronized
    public void done() {
        super.done();
        progresses.remove(this);
        if (progresses.size() == 0) {
            if (socketPath!=null) {
                File f = new File(socketPath);
                if (f.exists()) {
                    f.delete();
                }
            }
        }
    }

    protected void startServer() {
        Runtime.getRuntime().addShutdownHook(new Thread(new Runnable(){
            @Override
            public void run() {
                if (socketPath!=null) {
                    File f = new File(socketPath);
                    if (f.exists()) {
                        f.delete();
                    }
                }
            }}));

        serverThread = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    ServerSocket server = new ServerSocket(port);
                    if (socketPath != null) {
                        FileOutputStream fos = new FileOutputStream(socketPath);
                        fos.write((""+server.getLocalPort()+"\n").getBytes());
                        fos.close();
                    }
                    server.setSoTimeout(1000);
                    while (progresses.size() > 0) {
                        try {
                            Socket client = server.accept();
                            client.getOutputStream().write(getStatusMessage().getBytes());
                            client.close();
                        } catch (SocketTimeoutException e) {
                            // no nothing...
                        }
                    }
                    server.close();
                } catch (IOException e) {
                } finally {
                    if (socketPath!=null) {
                        File f = new File(socketPath);
                        if (f.exists()) {
                            f.delete();
                        }
                    }
                }
            }
        });

        //        serverThread.setDaemon(true);
        serverThread.start();
    }

    @Override
    synchronized
    public void start(long size) {
        super.start(size);
        progresses.add(this);
        if (serverThread == null) {
            startServer();
        }
    }
}


text:
#include <aws/route53domains/model/GetContactReachabilityStatusRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::Route53Domains::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;

GetContactReachabilityStatusRequest::GetContactReachabilityStatusRequest() :
    m_domainNameHasBeenSet(false)
{
}

Aws::String GetContactReachabilityStatusRequest::SerializePayload() const
{
  JsonValue payload;

  if(m_domainNameHasBeenSet)
  {
   payload.WithString("domainName", m_domainName);

  }

  return payload.View().WriteReadable();
}

Aws::Http::HeaderValueCollection GetContactReachabilityStatusRequest::GetRequestSpecificHeaders() const
{
  Aws::Http::HeaderValueCollection headers;
  headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "Route53Domains_v20140515.GetContactReachabilityStatus"));
  return headers;

}


text:
package de.hu_berlin.german.korpling.tiger2.impl;

import java.util.Collection;
import java.util.HashSet;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.InternalEList;

import de.hu_berlin.german.korpling.tiger2.Edge;
import de.hu_berlin.german.korpling.tiger2.Graph;
import de.hu_berlin.german.korpling.tiger2.NonTerminal;
import de.hu_berlin.german.korpling.tiger2.Segment;
import de.hu_berlin.german.korpling.tiger2.SyntacticNode;
import de.hu_berlin.german.korpling.tiger2.Terminal;
import de.hu_berlin.german.korpling.tiger2.Tiger2Package;

/**
 *  An implementation of the model object
 * 'Graph'.
 *

 * The following features are implemented:
 *

 *
{@link de.hu_berlin.german.korpling.tiger2.impl.GraphImpl#getEdges
 * Edges}

 *
{@link de.hu_berlin.german.korpling.tiger2.impl.GraphImpl#getSyntacticNodes
 * Syntactic Nodes}

 *
{@link de.hu_berlin.german.korpling.tiger2.impl.GraphImpl#getNonTerminals
 * Non Terminals}

 *
{@link de.hu_berlin.german.korpling.tiger2.impl.GraphImpl#getTerminals
 * Terminals}

 *
{@link de.hu_berlin.german.korpling.tiger2.impl.GraphImpl#getId
 * Id}

 *
{@link de.hu_berlin.german.korpling.tiger2.impl.GraphImpl#getSegment
 * Segment}

 *

 *

 *
 * @generated
 */
public class GraphImpl extends EObjectImpl implements Graph {
	/**
	 * The cached value of the '{@link #getEdges() Edges}' containment
	 * reference list.
	 *
	 * @see #getEdges()
	 * @generated
	 * @ordered
	 */
	protected EList<Edge> edges;

	/**
	 * The cached value of the '{@link #getSyntacticNodes() Syntactic
	 * Nodes}' containment reference list.
	 *
	 * @see #getSyntacticNodes()
	 * @generated
	 * @ordered
	 */
	protected EList<SyntacticNode> syntacticNodes;

	/**
	 * The default value of the '{@link #getId() Id}' attribute.
	 *
	 * @see #getId()
	 * @generated
	 * @ordered
	 */
	protected static final String ID_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getId() Id}' attribute.
	 *
	 * @see #getId()
	 * @generated
	 * @ordered
	 */
	protected String id = ID_EDEFAULT;

	/**
	 *
	 *
	 * @generated
	 */
	protected GraphImpl() {
		super();
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return Tiger2Package.Literals.GRAPH;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public EList<Edge> getEdges() {
		if (edges == null) {
			edges = new EObjectContainmentWithInverseEList<Edge>(Edge.class, this, Tiger2Package.GRAPH__EDGES,
					Tiger2Package.EDGE__GRAPH);
		}
		return edges;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public EList<SyntacticNode> getSyntacticNodes() {
		if (syntacticNodes == null) {
			syntacticNodes = new EObjectContainmentWithInverseEList<SyntacticNode>(SyntacticNode.class, this,
					Tiger2Package.GRAPH__SYNTACTIC_NODES, Tiger2Package.SYNTACTIC_NODE__GRAPH);
		}
		return syntacticNodes;
	}

	/**
	 * {@inheritDoc Graph#getNonTerminals()}
	 */
	// TODO replace, when using SGraph
	public EList<NonTerminal> getNonTerminals() {
		EList<NonTerminal> retVal = new BasicEList<NonTerminal>();
		for (SyntacticNode synNode : this.getSyntacticNodes()) {
			if (synNode instanceof NonTerminal)
				retVal.add((NonTerminal) synNode);
		}
		return (retVal);
	}

	/**
	 * {@inheritDoc Graph#getTerminals()}
	 */
	// TODO replace, when using SGraph
	public EList<Terminal> getTerminals() {
		EList<Terminal> retVal = new BasicEList<Terminal>();
		for (SyntacticNode synNode : this.getSyntacticNodes()) {
			if (synNode instanceof Terminal)
				retVal.add((Terminal) synNode);
		}
		return (retVal);
	}

	/**
	 *
	 *
	 * @generated
	 */
	public String getId() {
		return id;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public void setId(String newId) {
		String oldId = id;
		id = newId;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Tiger2Package.GRAPH__ID, oldId, id));
	}

	/**
	 *
	 *
	 * @generated
	 */
	public Segment getSegment() {
		if (eContainerFeatureID() != Tiger2Package.GRAPH__SEGMENT)
			return null;
		return (Segment) eContainer();
	}

	/**
	 *
	 *
	 * @generated
	 */
	public NotificationChain basicSetSegment(Segment newSegment, NotificationChain msgs) {
		msgs = eBasicSetContainer((InternalEObject) newSegment, Tiger2Package.GRAPH__SEGMENT, msgs);
		return msgs;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public void setSegment(Segment newSegment) {
		if (newSegment != eInternalContainer()
				|| (eContainerFeatureID() != Tiger2Package.GRAPH__SEGMENT && newSegment != null)) {
			if (EcoreUtil.isAncestor(this, newSegment))
				throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
			NotificationChain msgs = null;
			if (eInternalContainer() != null)
				msgs = eBasicRemoveFromContainer(msgs);
			if (newSegment != null)
				msgs = ((InternalEObject) newSegment).eInverseAdd(this, Tiger2Package.SEGMENT__GRAPHS, Segment.class,
						msgs);
			msgs = basicSetSegment(newSegment, msgs);
			if (msgs != null)
				msgs.dispatch();
		} else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Tiger2Package.GRAPH__SEGMENT, newSegment,
					newSegment));
	}

	/**
	 * {@inheritDoc Graph#getIncomingEdges(String)}
	 */
	public EList<Edge> getIncomingEdges(String nodeId) {
		EList<Edge> retVal = new BasicEList<Edge>();
		for (Edge edge : this.getEdges()) {
			if (edge.getTarget().getId().equals(nodeId))
				retVal.add(edge);
		}
		if (retVal.size() == 0)
			return (null);
		return (retVal);
	}

	/**
	 * {@inheritDoc Graph#getOutgoingEdges(String)}
	 */
	public EList<Edge> getOutgoingEdges(String nodeId) {
		EList<Edge> retVal = new BasicEList<Edge>();
		for (Edge edge : this.getEdges()) {
			if (edge.getSource().getId().equals(nodeId))
				retVal.add(edge);
		}
		if (retVal.size() == 0)
			return (null);
		return (retVal);
	}

	/**
	 * {@inheritDoc Graph#findNode(String)}
	 */
	// TODO replace, when using SGraph
	public SyntacticNode findNode(String nodeId) {
		SyntacticNode retVal = null;
		if ((nodeId != null) && (!nodeId.isEmpty())) {
			for (SyntacticNode synNode : this.getSyntacticNodes()) {
				if (nodeId.equals(synNode.getId())) {
					retVal = synNode;
					break;
				}
			}
		}
		return (retVal);
	}

	/**
	 * {@inheritDoc Graph#findEdge(String)}
	 */
	public Edge findEdge(String edgeId) {
		Edge retVal = null;
		if ((edgeId != null) && (!edgeId.isEmpty())) {
			for (Edge edge : this.getEdges()) {
				if (edgeId.equals(edge.getId())) {
					retVal = edge;
					break;
				}
			}
		}
		return (retVal);
	}

	/**
	 * {@inheritDoc Graph#findRoots()}
	 */
	public EList<SyntacticNode> findRoots() {
		EList<SyntacticNode> retVal = null;
		HashSet<String> nonRoots = new HashSet<String>();
		for (Edge edge : this.getEdges()) {
			nonRoots.add(edge.getSource().getId());
		}
		for (SyntacticNode synNode : this.getSyntacticNodes()) {
			if (!nonRoots.contains(synNode.getId())) {
				if (retVal == null)
					retVal = new BasicEList<SyntacticNode>();
				retVal.add(synNode);
			}
		}
		return (retVal);
	}

	/**
	 * {@inheritDoc Graph#findRoot()}
	 */
	public SyntacticNode findRoot() {
		SyntacticNode retVal = null;
		EList<SyntacticNode> roots = this.findRoots();
		if ((roots != null) && (roots.size() > 0))
			retVal = roots.get(0);
		return (retVal);

	}

	/**
	 *
	 *
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
		case Tiger2Package.GRAPH__EDGES:
			return ((InternalEList<InternalEObject>) (InternalEList<?>) getEdges()).basicAdd(otherEnd, msgs);
		case Tiger2Package.GRAPH__SYNTACTIC_NODES:
			return ((InternalEList<InternalEObject>) (InternalEList<?>) getSyntacticNodes()).basicAdd(otherEnd, msgs);
		case Tiger2Package.GRAPH__SEGMENT:
			if (eInternalContainer() != null)
				msgs = eBasicRemoveFromContainer(msgs);
			return basicSetSegment((Segment) otherEnd, msgs);
		}
		return super.eInverseAdd(otherEnd, featureID, msgs);
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
		case Tiger2Package.GRAPH__EDGES:
			return ((InternalEList<?>) getEdges()).basicRemove(otherEnd, msgs);
		case Tiger2Package.GRAPH__SYNTACTIC_NODES:
			return ((InternalEList<?>) getSyntacticNodes()).basicRemove(otherEnd, msgs);
		case Tiger2Package.GRAPH__SEGMENT:
			return basicSetSegment(null, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
		switch (eContainerFeatureID()) {
		case Tiger2Package.GRAPH__SEGMENT:
			return eInternalContainer().eInverseRemove(this, Tiger2Package.SEGMENT__GRAPHS, Segment.class, msgs);
		}
		return super.eBasicRemoveFromContainerFeature(msgs);
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
		case Tiger2Package.GRAPH__EDGES:
			return getEdges();
		case Tiger2Package.GRAPH__SYNTACTIC_NODES:
			return getSyntacticNodes();
		case Tiger2Package.GRAPH__NON_TERMINALS:
			return getNonTerminals();
		case Tiger2Package.GRAPH__TERMINALS:
			return getTerminals();
		case Tiger2Package.GRAPH__ID:
			return getId();
		case Tiger2Package.GRAPH__SEGMENT:
			return getSegment();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 *
	 *
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
		case Tiger2Package.GRAPH__EDGES:
			getEdges().clear();
			getEdges().addAll((Collection<? extends Edge>) newValue);
			return;
		case Tiger2Package.GRAPH__SYNTACTIC_NODES:
			getSyntacticNodes().clear();
			getSyntacticNodes().addAll((Collection<? extends SyntacticNode>) newValue);
			return;
		case Tiger2Package.GRAPH__ID:
			setId((String) newValue);
			return;
		case Tiger2Package.GRAPH__SEGMENT:
			setSegment((Segment) newValue);
			return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
		case Tiger2Package.GRAPH__EDGES:
			getEdges().clear();
			return;
		case Tiger2Package.GRAPH__SYNTACTIC_NODES:
			getSyntacticNodes().clear();
			return;
		case Tiger2Package.GRAPH__ID:
			setId(ID_EDEFAULT);
			return;
		case Tiger2Package.GRAPH__SEGMENT:
			setSegment((Segment) null);
			return;
		}
		super.eUnset(featureID);
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
		case Tiger2Package.GRAPH__EDGES:
			return edges != null && !edges.isEmpty();
		case Tiger2Package.GRAPH__SYNTACTIC_NODES:
			return syntacticNodes != null && !syntacticNodes.isEmpty();
		case Tiger2Package.GRAPH__NON_TERMINALS:
			return !getNonTerminals().isEmpty();
		case Tiger2Package.GRAPH__TERMINALS:
			return !getTerminals().isEmpty();
		case Tiger2Package.GRAPH__ID:
			return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
		case Tiger2Package.GRAPH__SEGMENT:
			return getSegment() != null;
		}
		return super.eIsSet(featureID);
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy())
			return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (id: ");
		result.append(id);
		result.append(')');
		return result.toString();
	}

} // GraphImpl


text:
@interface TLcontacts_Found : NSObject <TLObject>

@property (nonatomic, retain) NSArray *results;
@property (nonatomic, retain) NSArray *users;

@end

@interface TLcontacts_Found$contacts_found : TLcontacts_Found

@end


text:
'use strict';

module.exports = function($window, $timeout, Modal, scrollArea) {

	var TweenLite = require('TweenLite');
	var CSSPlugin = require('CSSPlugin');
	var Draggable = require('Draggable');
	var IScroll = require('iscroll');

	return {
		// replace: true,
		restrict: 'A',
		scope: true,
		// scope: {
		// 	board: '='
		// 	// zoom: '=zoomOptions'
		// },

		link: function(scope, element) {

			scrollArea.destroy();
			scrollArea.set(new IScroll('#content-scrollarea', {
				scrollX: true,
				scrollY: true,
				freeScroll: true,
				mouseWheel: true,
				scrollbars: true,
				interactiveScrollbars: true,
				disableMouse: false,
				keyBindings: true,

				indicators: {
					el: '.minimap',
					interactive: true,
					resize: false,
					shrink: false
				}
			}));

			$timeout(function() {
				// Set current background image
				scope.setBackground(scope.board.background);
			}, 0);

			// scrollArea.refresh(0);
			scope.isPresentationVisible = true;

			scope.promptBackgroundAdd = function() {
				var backgrounds = [
					{ name: 'Blank',            url: 'none'                                         },
					{ name: 'Kanban',           url: 'images/backgrounds/kanban.png'                },
					{ name: 'Scrum',            url: 'images/backgrounds/scrum.png'                 },
					{ name: 'Business model',   url: 'images/backgrounds/business_model_canvas.png' },
					{ name: 'SWOT',             url: 'images/backgrounds/swot.png'                  },
					{ name: 'Customer journey', url: 'images/backgrounds/customer_journey_map.png'  },
					{ name: 'Keep drop try',    url: 'images/backgrounds/keep_drop_try.png'         },
					{ name: 'Play',             url: 'images/backgrounds/play.png'                  },
				];

				var props = {
					'current':     scope.board.background,
					'backgrounds': backgrounds,
				}

				var options = {
					'size':     'lg',
					'template': require('../../partials/modals/edit-background.html'),
				}

				Modal.open(props, options).result.then(function(result) {
					return scope.updateBackground(result.current);
				});
			}

			scope.updateBackground = function(bg) {
				scope.board.background = bg;
				scope.board.update()
					.then(function() {
						scope.setBackground(bg);
					});
			}

			scope.setBackground = function(bg) {
				element.css('background-image', 'url(../' + bg + ')');
			}

			// scope.applySearch = function(searchStr) {
			// 	console.log(searchStr);
			// }

			// triggered from TopBarController
			scope.$on('action:add-background', function(event, data) {
				scope.promptBackgroundAdd();
			});

			// var zoom = scope.zoom;
			// var transformOrigin = 'center top';

			// scope.zoomOut = function() {
			// 	var html = angular.element(document.querySelector('html'))[0];
			// 	var scale = 0.9 * html.clientHeight / element[0].offsetHeight;
			// 	TweenLite.to(element, 0.6, { scale: scale, transformOrigin: transformOrigin });
			// }

			// scope.zoomNormal = function() {
			// 	TweenLite.to(element, 0.6, { scale: 1, transformOrigin: transformOrigin });
			// }

			// scope.$watch('zoom.out', function() {
			// 	if (zoom.out) {
			// 		scope.zoomOut();
			// 	}
			// 	else {
			// 		scope.zoomNormal();
			// 	}
			// });

			// scope.$watchCollection('tickets', function() {

			// });
		}
	};
}


text:
// Tally Votes in JavaScript Pairing Challenge.

// I worked on this challenge with Jon Chen.
// This challenge took us 2.5 hours.

// These are the votes cast by each student. Do not alter these objects here.
var votes = {
  "Alex": { president: "Bob", vicePresident: "Devin", secretary: "Gail", treasurer: "Kerry" },
  "Bob": { president: "Mary", vicePresident: "Hermann", secretary: "Fred", treasurer: "Ivy" },
  "Cindy": { president: "Cindy", vicePresident: "Hermann", secretary: "Bob", treasurer: "Bob" },
  "Devin": { president: "Louise", vicePresident: "John", secretary: "Bob", treasurer: "Fred" },
  "Ernest": { president: "Fred", vicePresident: "Hermann", secretary: "Fred", treasurer: "Ivy" },
  "Fred": { president: "Louise", vicePresident: "Alex", secretary: "Ivy", treasurer: "Ivy" },
  "Gail": { president: "Fred", vicePresident: "Alex", secretary: "Ivy", treasurer: "Bob" },
  "Hermann": { president: "Ivy", vicePresident: "Kerry", secretary: "Fred", treasurer: "Ivy" },
  "Ivy": { president: "Louise", vicePresident: "Hermann", secretary: "Fred", treasurer: "Gail" },
  "John": { president: "Louise", vicePresident: "Hermann", secretary: "Fred", treasurer: "Kerry" },
  "Kerry": { president: "Fred", vicePresident: "Mary", secretary: "Fred", treasurer: "Ivy" },
  "Louise": { president: "Nate", vicePresident: "Alex", secretary: "Mary", treasurer: "Ivy" },
  "Mary": { president: "Louise", vicePresident: "Oscar", secretary: "Nate", treasurer: "Ivy" },
  "Nate": { president: "Oscar", vicePresident: "Hermann", secretary: "Fred", treasurer: "Tracy" },
  "Oscar": { president: "Paulina", vicePresident: "Nate", secretary: "Fred", treasurer: "Ivy" },
  "Paulina": { president: "Louise", vicePresident: "Bob", secretary: "Devin", treasurer: "Ivy" },
  "Quintin": { president: "Fred", vicePresident: "Hermann", secretary: "Fred", treasurer: "Bob" },
  "Romanda": { president: "Louise", vicePresident: "Steve", secretary: "Fred", treasurer: "Ivy" },
  "Steve": { president: "Tracy", vicePresident: "Kerry", secretary: "Oscar", treasurer: "Xavier" },
  "Tracy": { president: "Louise", vicePresident: "Hermann", secretary: "Fred", treasurer: "Ivy" },
  "Ullyses": { president: "Louise", vicePresident: "Hermann", secretary: "Ivy", treasurer: "Bob" },
  "Valorie": { president: "Wesley", vicePresident: "Bob", secretary: "Alex", treasurer: "Ivy" },
  "Wesley": { president: "Bob", vicePresident: "Yvonne", secretary: "Valorie", treasurer: "Ivy" },
  "Xavier": { president: "Steve", vicePresident: "Hermann", secretary: "Fred", treasurer: "Ivy" },
  "Yvonne": { president: "Bob", vicePresident: "Zane", secretary: "Fred", treasurer: "Hermann" },
  "Zane": { president: "Louise", vicePresident: "Hermann", secretary: "Fred", treasurer: "Mary" }
}

// Tally the votes in voteCount.
var voteCount = {
  president: {},
  vicePresident: {},
  secretary: {},
  treasurer: {}
}

/* The name of each student receiving a vote for an office should become a property
of the respective office in voteCount.  After Alex's votes have been tallied,
voteCount would be ...
  var voteCount = {
    president: { Bob: 1 },
    vicePresident: { Devin: 1 },
    secretary: { Gail: 1 },
    treasurer: { Kerry: 1 }
  }
*/

/* Once the votes have been tallied, assign each officer position the name of the
student who received the most votes. */
var officers = {
  president: undefined,
  vicePresident: undefined,
  secretary: undefined,
  treasurer: undefined
}

// Pseudocode

/* INPUT: JavaScript object with votes
  OUTPUT: JavaScript object with assigned offices
  STEPS:
  In voteCount, within the President object, create a property called Bob and assign it a value of 3.
  In voteCount, within the Vice President object, create a property called Bob and assign it a value of 2.
  In voteCount, within the Secretary object, create a property called Bob and assign it a value of 2.
    In voteCount, within the Treasurer object, create a property called Bob and assign it a value of 4.
    In officers, for the President object, assign a value of 'Louise'.
    In officers, for the Vice President object, assign a value of 'Hermann'.
    In officers, for the Secretary object, assign a value of 'Fred'.
    In officers, for the Treasurer object, assign a value of 'Ivy'.
*/
// __________________________________________
// Initial Solution

voteCount['president']['Bob'] = 3;
voteCount['vicePresident']['Bob'] = 2;
voteCount['secretary']['Bob'] = 2;
voteCount['treasurer']['Bob'] = 4;

officers['president'] = 'Louise';
officers['vicePresident'] = 'Hermann';
officers['secretary'] = 'Fred';
officers['treasurer'] = 'Ivy';

// __________________________________________
// Refactored Solution

// STEPS:
// Function 1:
//   Define function countVote
//   Create new empty holder object called record
//   FOR each object (person) in Votes, iterate through the value (vote record)
//     FOR voter.president
//       create/modify a new property (person) in voteCount from the value
//       increment this new property by one

//   FOR each object (person) in Votes, iterate through the value (vote record)
//     FOR voter.vicePresident
//   create/modify a new property (person) in voteCount from the value
//   increment this new property by one

//   FOR each object (person) in Votes, iterate through the value (vote record)
//     FOR voter.secretary
//   create/modify a new property (person) in voteCount from the value
//   increment this new property by one

//   FOR each object (person) in Votes, iterate through the value (vote record)
//     FOR voter.treasurer
//   create/modify a new property (person) in voteCount from the value
//   increment this new property by one

function countVote () {

//   var record = {};

  for (var voter in votes) {
    if (voteCount['president'][votes[voter]['president']] === undefined) {
      voteCount['president'][votes[voter]['president']] = 1;
    } else {
      voteCount['president'][votes[voter]['president']] += 1;
    }
  }

  for (var voter in votes) {
    if (voteCount['vicePresident'][votes[voter]['vicePresident']] === undefined) {
      voteCount['vicePresident'][votes[voter]['vicePresident']] = 1;
    } else {
      voteCount['vicePresident'][votes[voter]['vicePresident']] += 1;
    }
  }

  for (var voter in votes) {
    if (voteCount['secretary'][votes[voter]['secretary']] === undefined) {
      voteCount['secretary'][votes[voter]['secretary']] = 1;
    } else {
      voteCount['secretary'][votes[voter]['secretary']] += 1;
    }
  }

  for (var voter in votes) {
    if (voteCount['treasurer'][votes[voter]['treasurer']] === undefined) {
      voteCount['treasurer'][votes[voter]['treasurer']] = 1;
    } else {
      voteCount['treasurer'][votes[voter]['treasurer']] += 1;
    }
  }

  return voteCount;
}

/*
Function 2:
Pseudocode:
Input: Take in an object of candidates and their votes
Output: object with candidates with highest votes
Steps:
Make a new counter equal to first candidate
FOR each position's candidate
  IF candidate's votes is greater than counter's candidate
    set counter equal to new candidate
Set officers equal to highest voted candidate
*/

function highestTally(object) {

  var highest = 0;
  var winner = undefined;

  // President
  for (var candidate in object['president']) {
    if (object['president'][candidate] > highest) {
      highest = object['president'][candidate];
    }
  }

  for (var candidate in object['president']) {
    if (object['president'][candidate] === highest) {
      winner = candidate;
    }
  }

  officers['president'] = winner;

  // Vice President
  highest = 0;
  winner = undefined;

  for (var candidate in object['vicePresident']) {
    if (object['vicePresident'][candidate] > highest) {
      highest = object['vicePresident'][candidate];
    }
  }

  for (var candidate in object['vicePresident']) {
    if (object['vicePresident'][candidate] === highest) {
      winner = candidate;
    }
  }

  officers['vicePresident'] = winner;

  // Secretary
  highest = 0;
  winner = undefined;

  for (var candidate in object['secretary']) {
    if (object['secretary'][candidate] > highest) {
      highest = object['secretary'][candidate];
    }
  }

  for (var candidate in object['secretary']) {
    if (object['secretary'][candidate] === highest) {
      winner = candidate;
    }
  }

  officers['secretary'] = winner;

  // Treasurer
  highest = 0;
  winner = undefined;

  for (var candidate in object['treasurer']) {
    if (object['treasurer'][candidate] > highest) {
      highest = object['treasurer'][candidate];
    }
  }

  for (var candidate in object['treasurer']) {
    if (object['treasurer'][candidate] === highest) {
      winner = candidate;
    }
  }

  officers['treasurer'] = winner;

  return officers;

}

// Refactor of refactor

function countVote () {

  for (var office in voteCount) {
    for (var voter in votes) {
      if (voteCount[office][votes[voter][office]] === undefined) {
        voteCount[office][votes[voter][office]] = 1;
      } else {
        voteCount[office][votes[voter][office]] += 1;
      }
    }
  }

  return voteCount;
}

function highestTally(object) {

  for (var office in officers) {
    var highest = 0;
    var winner = undefined;

    for (var candidate in object[office]) {
      if (object[office][candidate] > highest) {
        highest = object[office][candidate];
        winner = candidate;
      }
    }
    officers[office] = winner;
  }

  return officers;
}

// Driver code
console.log(countVote());
console.log(highestTally(voteCount));

// __________________________________________
// Reflection

// What did you learn about iterating over nested objects in JavaScript?
// Were you able to find useful methods to help you with this?
// What concepts were solidified in the process of working through this challenge?

// I learned that iterating over nested objects in JavaScript is a pain.  Database all the way.

// We didn't really find any useful methods, to be honest.  Instead, we ended up writing our own.  That - to me - is the main difference between JavaScript and Ruby.  In Ruby, there are tons of methods that are easy to use and output data pretty much in the form you would need.  Not in JavaScript - in JS there are few methods, and they are difficult to use.  For example, we tried to use keys for one section of our solution, but couldn't get it working, and ended up abandoning it.  However, in JS it is really easy to write your own functions and call on any available object, which is very free-ing in a way.

// I think I really appreciate DRY code, after this challenge.  Usually, I like to try and work straight towards the clean solution, but in this challenge it was just too many levels of iteration to think through at once, so we had to do our initial solution and then refactor to make it DRY...and look how many lines of code we saved!

// __________________________________________
// Test Code:  Do not alter code below this line.

function assert(test, message, test_number) {
  if (!test) {
    console.log(test_number + "false");
    throw "ERROR: " + message;
  }
  console.log(test_number + "true");
  return true;
}

assert(
  (voteCount.president["Bob"] === 3),
  "Bob should receive three votes for President.",
  "1. "
)

assert(
  (voteCount.vicePresident["Bob"] === 2),
  "Bob should receive two votes for Vice President.",
  "2. "
)

assert(
  (voteCount.secretary["Bob"] === 2),
  "Bob should receive two votes for Secretary.",
  "3. "
)

assert(
  (voteCount.treasurer["Bob"] === 4),
  "Bob should receive four votes for Treasurer.",
  "4. "
)

assert(
  (officers.president === "Louise"),
  "Louise should be elected President.",
  "5. "
)

assert(
  (officers.vicePresident === "Hermann"),
  "Hermann should be elected Vice President.",
  "6. "
)

assert(
  (officers.secretary === "Fred"),
  "Fred should be elected Secretary.",
  "7. "
)

assert(
  (officers.treasurer === "Ivy"),
  "Ivy should be elected Treasurer.",
  "8. "
)


text:
class RevisionAnalyticsService
  ################
  # Entry points #
  ################

  DEFAULT_DYK_WP10_LIMIT = 60
  def self.dyk_eligible(opts={})
    new(opts).dyk_eligible
  end

  DEFAULT_PLAGIARISM_LIMIT = 20
  def self.suspected_plagiarism(opts={})
    new(opts).suspected_plagiarism
  end

  DEFAULT_RECENT_EDITS_LIMIT = 30
  def self.recent_edits(opts={})
    new(opts).recent_edits
  end

  #########
  # Setup #
  #########

  def initialize(opts)
    return unless opts[:scoped] == 'true' && opts[:current_user]
    @course_ids = Course.joins(:courses_users)
                        .where('courses_users.user_id = ?', opts[:current_user].id)
                        .current.pluck(:id)
  end

  #################
  # Main routines #
  #################
  def dyk_eligible
    wp10_limit = ENV['dyk_wp10_limit'] || DEFAULT_DYK_WP10_LIMIT
    good_student_revisions = Revision
                             .where(user_id: student_ids)
                             .where('wp10 >= ?', wp10_limit)
                             .where('date > ?', 2.months.ago)
    good_article_ids = good_student_revisions.pluck(:article_id)

    good_draft_ids = userspace_draft_ids(good_article_ids) + draft_space_ids(good_article_ids)
    good_drafts = articles_sorted_by_latest_revision(good_draft_ids)
    good_drafts
  end

  def suspected_plagiarism
    if @course_ids
      suspected_revisions = Revision.where.not(ithenticate_id: nil)
                                    .where(user_id: student_ids)
                                    .order(date: :desc).first(DEFAULT_PLAGIARISM_LIMIT)
    else
      suspected_revisions = Revision.where.not(ithenticate_id: nil)
                                    .order(date: :desc).first(DEFAULT_PLAGIARISM_LIMIT)
    end
    suspected_revisions
  end

  def recent_edits
    if @course_ids
      recent_revisions = Revision.user.where(user_id: student_ids).last(DEFAULT_RECENT_EDITS_LIMIT)
    else
      recent_revisions = Revision.user.last(DEFAULT_RECENT_EDITS_LIMIT)
    end
    recent_revisions
  end

  ##################
  # Helper methods #
  ##################
  private

  def articles_sorted_by_latest_revision(article_ids)
    last_revisions = latest_revisions(article_ids)
    last_rev_dates = {}
    last_revisions.each do |revision|
      last_rev_dates[revision.article_id] = revision.date
    end

    articles = Article.where(id: article_ids).to_a
    articles.sort! { |a, b| last_rev_dates[a.id] <=> last_rev_dates[b.id] }
    articles.reverse!
  end

  # Students in current courses, excluding instructors
  def student_ids
    @course_ids ||= Course.current.pluck(:id)
    student_ids = CoursesUsers
                  .where(course_id: @course_ids, role: CoursesUsers::Roles::STUDENT_ROLE)
                  .pluck(:user_id)
    instructor_ids = CoursesUsers
                     .where(course_id: @course_ids, role: CoursesUsers::Roles::INSTRUCTOR_ROLE)
                     .pluck(:user_id)
    pure_student_ids = student_ids - instructor_ids
    pure_student_ids
  end

  def userspace_draft_ids(article_ids)
    Article.where(id: article_ids)
           .where(namespace: Article::Namespaces::USER)
           .where('title LIKE ?', '%/%') # only get subpages
           .where('title NOT LIKE ?', '%/TWA/%') # skip TWA pages
           .pluck(:id)
  end

  def draft_space_ids(article_ids)
    Article.where(id: article_ids)
           .where(namespace: Article::Namespaces::DRAFT)
           .pluck(:id)
  end

  def latest_revisions(article_ids)
    Revision.where(article_id: article_ids)
            .select('MAX(date) as date, article_id')
            .group(:article_id)
  end
end


text:
#if !defined (__EAT_FLASH_H__)
#define __EAT_FLASH_H__

#include "eat_type.h"
#include "eat_periphery.h"

/*****************************************************************************
 * Function :eat_flash_erase
 * Description:This function is used to erase the flash.
 * Parameters :
 * 	address: [IN] the start flash address of erase.
 *	size: [IN]  the size of erase
 * Returns:
 *  	TRUE or FALSE
 * NOTE
 *     Nothing
 *****************************************************************************/
extern eat_bool (* const eat_flash_erase)(const void *address, unsigned int size);

/*****************************************************************************
 * Function :eat_flash_write
 * Description:This function is used to write data to flash.
 * Parameters :
 * 	address: [IN] the start flash address for write.
 *	data: [IN]  Specifies the address of the data to be written.
 *	len: [IN]  Specifies the number of bytes to write.
 * Returns:
 *  	TRUE or FALSE
 * NOTE
 *     Nothing
 *****************************************************************************/
extern eat_bool (* const eat_flash_write)(const void *address, const void *data, unsigned int len);

/*****************************************************************************
 * Function :eat_flash_read
 * Description:This function is used to read data from flash.
 * Parameters :
 * 	buffer: [IN] Destination address.
 *	address: [IN]  Source address
 *	len: [IN]  Specifies the number of bytes to read.
 * Returns:
 *  	buffer address.
 * NOTE
 *     Nothing
 *****************************************************************************/
extern void *(* const eat_flash_read)(void *buffer, const void *address, unsigned int len);

/*****************************************************************************
 * Function :eat_get_flash_block_size
 * Description:This function is used to get flash block size.
 * Parameters :
 * Returns:
 *  	flash block size
 * NOTE
 *     Nothing
 *****************************************************************************/
extern unsigned int (* const eat_get_flash_block_size)(void);

/*****************************************************************************
 * Function :eat_update_app
 * Description:This function is used to update APP code.
 * Parameters :
 * 	app_code_addr: [IN] the executive address of App code.
 *	app_code_new_addr: [IN]  the store address of App new code.
 *	len: [IN]  the length of App new code.
 * 	pin_wd :   the pin used for given extenal WDT a singnal when update app;EAT_PIN_NUM:no use
 * 	pin_led:   the pin used for control extenal LED light when update app;EAT_PIN_NUM:no use
 * 	lcd_bl :   bool type,contrl lcd back light whether shining when update app;EAT_TRUE:yes EAT_FALSE:no
 * Returns:
 * 	Nothing
 * NOTE
 *     The cycle of pin_wd,pin_led and lcd backlight is about 400 ms.
 *****************************************************************************/
extern void (* const eat_update_app)(const void *app_code_addr, const void *app_code_new_addr, unsigned int len, EatPinName_enum pin_wd, EatPinName_enum pin_led, eat_bool lcd_bl);

/*****************************************************************************
 * Function :eat_update_app_ok
 * Description:This function is used to clear update APP flag.
 * Parameters :
 * Returns:
 * 	Nothing
 * NOTE
 *     Nothing
 *****************************************************************************/
extern void (* const eat_update_app_ok)(void);

/*****************************************************************************
 * Function :eat_get_app_base_addr
 * Description:This function is used to get app base address.
 * Parameters :
 * Returns:
 * 	Nothing
 * NOTE
 *     Nothing
 *****************************************************************************/
extern unsigned long (* const eat_get_app_base_addr)(void) ;

/*****************************************************************************
 * Function :eat_get_app_space
 * Description:This function is used to get app space value.
 * Parameters :
 * Returns:
 * 	Nothing
 * NOTE
 *     Nothing
 *****************************************************************************/
extern unsigned long (* const eat_get_app_space)(void) ;

#ifdef __SIMCOM_EAT_MULTI_APP__
/*****************************************************************************
 * Function :eat_flash_erase_ext
 * Description:This function is used to erase the flash.
 * Parameters :
 * 	address: [IN] the start flash offset address of erase.
 *	size: [IN]  the size of erase
 * Returns:
 *  	TRUE or FALSE
 * NOTE
 *    1. The address is offset address
 *    2. The (address+len) must be less than the value of eat_get_app_space_ext
 *****************************************************************************/
extern eat_bool (*const eat_flash_erase_ext)(const void *address, unsigned int size);
/*****************************************************************************
 * Function :eat_flash_write_ext
 * Description:This function is used to write data to flash.
 * Parameters :
 * 	address: [IN] the start flash offset address for writing.
 *	data: [IN]  Specifies the address of the data to be written.
 *	len: [IN]  Specifies the number of bytes to write.
 * Returns:
 *  	TRUE or FALSE
 * NOTE
 *    1. The address is offset address
 *    2. The (address+len) must be less than the value of eat_get_app_space_ext
 *****************************************************************************/
extern eat_bool (*const eat_flash_write_ext)(const void *address, const void *data, unsigned int len);
/*****************************************************************************
 * Function :eat_flash_read_ext
 * Description:This function is used to read data from flash.
 * Parameters :
 * 	address: [IN] the start flash offset address for reading.
 *	data: [IN]  Specifies the space of the data reading from flash.
 *	len: [IN]  Specifies the number of bytes to read.
 * Returns:
 *  	TRUE or FALSE
 * NOTE
 *    1. The address is offset address
 *    2. The (address+len) must be less than the value of eat_get_app_space_ext
 *****************************************************************************/
extern eat_bool (*const eat_flash_read_ext)(const void *address, void *data, unsigned int len);
/*****************************************************************************
 * Function :eat_get_app_space
 * Description:This function is used to get app space value.
 * Parameters :
 * Returns:
 *   Nothing
 * NOTE
 *     The space is only first ROM space in multi-app version.
 *****************************************************************************/
extern unsigned long (*const eat_get_app_space_ext)(void);
#endif //#ifdef __SIMCOM_EAT_MULTI_APP__

#endif


text:
package com.foc.modules.link;

public class FocLinkHandler_Check extends AbstractSpecificHandler implements IFocLinkConst {

	@Override
	public StringBuffer getResponse() {
		StringBuffer buff = new StringBuffer("<");
		buff.append(TAG_LINK_CHECK);
		buff.append("></");
		buff.append(TAG_LINK_CHECK);
		buff.append(">");
		return buff;
	}

	@Override
	public void commit() {
		// TODO Auto-generated method stub

	}

}


text:
<?php

namespace Symfony\Component\Serializer\Tests\Fixtures;

use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;

/**
 * Provides a dummy Normalizer which extends the AbstractNormalizer.
 *
 * @author Konstantin S. M. Möllers <ksm.moellers@gmail.com>
 */
class AbstractNormalizerDummy extends AbstractNormalizer
{
    /**
     * {@inheritdoc}
     */
    public function getAllowedAttributes(string|object $classOrObject, array $context, bool $attributesAsString = false): array|bool
    {
        return parent::getAllowedAttributes($classOrObject, $context, $attributesAsString);
    }

    /**
     * {@inheritdoc}
     */
    public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
    {
    }

    /**
     * {@inheritdoc}
     */
    public function supportsNormalization(mixed $data, string $format = null): bool
    {
        return true;
    }

    /**
     * {@inheritdoc}
     */
    public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed
    {
    }

    /**
     * {@inheritdoc}
     */
    public function supportsDenormalization(mixed $data, string $type, string $format = null): bool
    {
        return true;
    }
}