text:
package cz.metacentrum.perun.wui.json.managers;

import com.google.gwt.http.client.Request;
import cz.metacentrum.perun.wui.json.JsonClient;
import cz.metacentrum.perun.wui.json.JsonEvents;

/**
 * Manager with standard callbacks to Perun's API (FacilitiesManager).
 * <p/>
 * Each callback returns unique Request used to make call. Such call can be removed
 * while processing to prevent any further actions based on it's {@link JsonEvents JsonEvents}.
 *
 * @author Pavel Zlámal <zlamal@cesnet.cz>
 */
public class FacilitiesManager {

	private static final String FACILITIES_MANAGER = "facilitiesManager/";

	/**
	 * Return list of Facilities in Perun. If getRich == TRUE, then each facility
	 * also contains list of Owners of 'technical' type.
	 *
	 * @param getRich TRUE = get RichFacilities / FALSE = get Facilities (default)
	 * @param events events done on callback
	 * @return Request unique request
	 */
	public static Request getFacilities(boolean getRich, JsonEvents events) {

		JsonClient client = new JsonClient(events);
		if (getRich) {
			return client.call(FACILITIES_MANAGER + "getRichFacilities");
		} else {
			return client.call(FACILITIES_MANAGER + "getFacilities");
		}

	}

	/**
	 * Return Facility by it's ID.
	 *
	 * @param id ID of facility to get
	 * @param events events done on callback
	 * @return Request unique request
	 */
	public static Request getFacilityById(int id, JsonEvents events) {

		if (id <= 0) return null;

		JsonClient client = new JsonClient(events);
		client.put("id", id);
		return client.call(FACILITIES_MANAGER + "getFacilityById");

	}

}

redpajama_set_name: RedPajamaGithub


text:
'use strict';

const npmGet = require('..');

const afterAll = require('after-all'),
      order = require('order-permutation'),
      pick = require('@f/pick'),
      test = require('tape');

const fs = require('fs');

test('get file', t => {
  const next = afterAll(t.end);

  npmGet('npm-get', 'LICENSE', next((err, entry, contents) => {
    const fileData = fs.readFileSync(__dirname +  '/../LICENSE',
                                     { encoding: 'utf8' });

    t.error(err);
    t.equal(entry.type, 'File', 'entry type');
    t.equal(entry.path, 'package/LICENSE', 'entry path');
    t.equal(contents, fileData, 'contents');
  }));

  npmGet('npm-get', '/', next((err, entries, listing) => {
    const expectedEntries = [
      { type: 'File', path: 'package/LICENSE' },
      { type: 'File', path: 'package/README.md' },
      { type: 'File', path: 'package/cli.js' },
      { type: 'File', path: 'package/index.js' },
      { type: 'File', path: 'package/package.json' },
    ];
    const ordering = order(listing);

    t.deepEqual(ordering.map(k => listing[k]),
                expectedEntries.map(entry => entry.path.split('/')[1]),
                'listing');

    t.deepEqual(
      ordering
        .map(k => entries[k])
        .map(pick.bind(null, ['type', 'path'])),
      expectedEntries, 'entries');
  }));
});


text:
<!DOCTYPE html>
<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Povezava zunanjega zaslona s prenosnikom</title>
<link rel="shortcut icon" href="https://www.ubuntu.si/favicon.ico">
<link rel="stylesheet" type="text/css" href="../vodnik_1404.css">

Ubuntu Slovenija | Uradna spletna stran slovenske skupnosti Linux distribucije Ubuntu

Domov

Novice

Forum

Kaj je Ubuntu?

Pogosta vprašanja

Skupnost

Povezave

Ubuntu 16.10 »  Namizni vodnik Ubuntu » Nastavitve » Zaslon »

Povezava zunanjega zaslona s prenosnikom

Nastavitev zunanjega zaslona

Za nastavitev zunanjega zaslona s prenosnikom povežite zaslon s prenosnikom. Če ga vaš sistem ne prepozna nemudoma ali bi želeli prilagoditi nastavitve:

Kliknite ikono skrajno desno v menijski vrstici in izberite Sistemske nastavitve.

Odprite Zasloni.

Kliknite na sliko zaslona, ki jo želite omogočiti ali onemogočiti in ga nato VKLOPITE/IZKLOPITE.

Privzeto je zaganjalnik prikazan le na glavnem zaslonu. Za spremembo kateri zaslon je "glavni", spremenite zaslon v spustnem polju Postavitev zaganjalnika. Namesto tega lahko v predogledu zaganjalnik povlečete na zaslon, ki ga želite nastaviti kot "glavni" zaslon.

Če želite, da je zaganjalnik prikazan na vseh zaslonih, spremenite Postavitev zaganjalnika na Vsi zasloni.

Za spremembo "položaja" zaslona kliknite nanj in ga povlecite na želeni položaj.

Če želite, da oba zaslona prikažeta isto vsebino, izberite polje Zrcali zaslona.

Ko ste z nastavitvami zadovoljni, kliknite Uveljavi in nato kliknite Obdrži te nastavitve.

Za zapiranje programa Zasloni kliknite na x zgoraj v kotu.

Lepljivi robovi

Značilen problem pri uporabi dveh zaslonov je, da kazalec miške zlahka "zdrsne" na drug zaslon, ko tega ne želimo. Unity Lepljivi robovi pomagajo pri tem problemu tako, da zahtevajo, da malo bolj potisnemo miškin kazalec iz enega na drug zaslon.

Lepljive robove lahko izključite, če ne marate te zmožnosti.

Več podrobnosti

Zaslon — Ozadje, velikost in vrtenje, svetlost …

Material v tem dokumentu je na voljo pod prosto licenco. To je prevod dokumentacije Ubuntu, ki jo je sestavila Ubuntu dokumentacijska ekipa za Ubuntu. V slovenščino jo je prevedla skupina Ubuntu prevajalcev. Za poročanje napak v prevodih v tej dokumentaciji ali Ubuntuju pošljite sporočilo na dopisni seznam.


text:
package com.comp490.studybuddy.flashcards.templates;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;

import com.comp490.studybuddy.flashcards.sorting.CardCompare;
import com.comp490.studybuddy.flashcards.sorting.CorrectCompare;

public class Decks implements Comparable<Decks>, Serializable
{

	private static final long serialVersionUID = 1L;
	private String title;
	private ArrayList<Cards> cards;

	public Decks(String name)
	{
		this.title = name;
		cards = new ArrayList<Cards>();
	}

	public String getName()
	{
		return title;
	}

	public ArrayList<Cards> getCards()
	{
		return cards;
	}

	public int size()
	{
		return cards.size();
	}

	public void setName(String name)
	{
		this.title = name;
	}

	public boolean hasCard(Cards card)
	{
		return cards.contains(card);
	}

	public void addCard(Cards card)
	{
		if (!(cards.contains(card))) cards.add(card);
	}

	public Cards getCard(String front)
	{
		return cards.get(cards.indexOf(new Cards(front, "")));
	}

	public boolean deleteCard(String front)
	{
		Cards temp = new Cards(front, null);
		return cards.remove(temp);
	}

	public Cards searchForCard(String front)
	{
		Cards temp = new Cards(front, null);
		int index = cards.indexOf(temp);
		return cards.get(index);
	}

	public void sortByCalendar()
	{
		Collections.sort(cards);
	}

	public void sortByFront()
	{
		Collections.sort(cards, new CardCompare());
	}

	public void sortByStrength()
	{
		Collections.sort(cards, new CorrectCompare());
	}

	public int compareTo(Decks deck)
	{
		return title.compareToIgnoreCase(deck.getName());
	}

	public boolean equals(Object o)
	{
		if (o == null || !(o instanceof Decks)) return false;
		Decks other = (Decks)o;
		return title.equalsIgnoreCase(other.getName());
	}

	public String toString()
	{
		return title + "\n" + size() + " card" + (size() == 1 ? "" : "s");
	}
}


text:
#ifndef REALM_GROUP_WRITER_HPP
#define REALM_GROUP_WRITER_HPP

#include <stdint.h> // unint8_t etc
#include <utility>

#include <realm/util/file.hpp>
#include <realm/alloc.hpp>
#include <realm/impl/array_writer.hpp>
#include <realm/array_integer.hpp>

namespace realm {

// Pre-declarations
class Group;
class SlabAlloc;

/// This class is not supposed to be reused for multiple write sessions. In
/// particular, do not reuse it in case any of the functions throw.
///
/// FIXME: Move this class to namespace realm::_impl and to subdir src/realm/impl.
class GroupWriter: public _impl::ArrayWriterBase {
public:
    // For groups in transactional mode (Group::m_is_shared), this constructor
    // must be called while a write transaction is in progress.
    //
    // The constructor adds free-space tracking information to the specified
    // group, if it is not already present (4th and 5th entry in
    // Group::m_top). If the specified group is in transactional mode
    // (Group::m_is_shared), the constructor also adds version tracking
    // information to the group, if it is not already present (6th and 7th entry
    // in Group::m_top).
    GroupWriter(Group&);

    void set_versions(uint64_t current, uint64_t read_lock) noexcept;

    /// Write all changed array nodes into free space.
    ///
    /// Returns the new top ref. When in full durability mode, call
    /// commit() with the returned top ref.
    ref_type write_group();

    /// Flush changes to physical medium, then write the new top ref
    /// to the file header, then flush again. Pass the top ref
    /// returned by write_group().
    void commit(ref_type new_top_ref);

    std::size_t get_file_size() const noexcept;

    /// Write the specified chunk into free space.
    void write(const char* data, std::size_t size);

    /// Write the specified array data and its checksum into free
    /// space.
    ///
    /// Returns the position in the file where the first byte was
    /// written.
    std::size_t write_array(const char* data, std::size_t size, uint_fast32_t checksum) override;

#ifdef REALM_DEBUG
    void dump();
#endif

private:
    Group&     m_group;
    SlabAlloc& m_alloc;
    ArrayInteger m_free_positions; // 4th slot in Group::m_top
    ArrayInteger m_free_lengths;   // 5th slot in Group::m_top
    ArrayInteger m_free_versions;  // 6th slot in Group::m_top
    uint64_t   m_current_version;
    uint64_t   m_readlock_version;
    util::File::Map<char> m_file_map;

    // Merge adjacent chunks
    void merge_free_space();

    /// Allocate a chunk of free space of the specified size. The
    /// specified size must be 8-byte aligned. Extend the file if
    /// required. The returned chunk is removed from the amount of
    /// remaing free space. The returned chunk is guaranteed to be
    /// within a single contiguous memory mapping.
    ///
    /// \return The position within the database file of the allocated
    /// chunk.
    std::size_t get_free_space(std::size_t size);

    /// Find a block of free space that is at least as big as the
    /// specified size and which will allow an allocation that is mapped
    /// inside a contiguous address range. The specified size does not
    /// need to be 8-byte aligned. Extend the file if required.
    /// The returned chunk is not removed from the amount of remaing
    /// free space.
    ///
    /// \return A pair (`chunk_ndx`, `chunk_size`) where `chunk_ndx`
    /// is the index of a chunk whose size is at least the requestd
    /// size, and `chunk_size` is the size of that chunk.
    std::pair<std::size_t, std::size_t> reserve_free_space(std::size_t size);

    /// Search only a range of the free list for a block as big as the
    /// specified size. Return a pair with index and size of the found chunk.
    /// \param found indicates whether a suitable block was found.
    std::pair<std::size_t, std::size_t>
    search_free_space_in_part_of_freelist(std::size_t size, std::size_t begin,
                                          std::size_t end, bool& found);

    /// Extend the file to ensure that a chunk of free space of the
    /// specified size is available. The specified size does not need
    /// to be 8-byte aligned. This function guarantees that it will
    /// add at most one entry to the free-lists.
    ///
    /// \return A pair (`chunk_ndx`, `chunk_size`) where `chunk_ndx`
    /// is the index of a chunk whose size is at least the requestd
    /// size, and `chunk_size` is the size of that chunk.
    std::pair<std::size_t, std::size_t> extend_free_space(std::size_t requested_size);

    void write_array_at(std::size_t pos, const char* data, std::size_t size);
    std::size_t split_freelist_chunk(std::size_t index, std::size_t start_pos,
                                     std::size_t alloc_pos, std::size_t chunk_size, bool is_shared);
};

// Implementation:

inline std::size_t GroupWriter::get_file_size() const noexcept
{
    return m_file_map.get_size();
}

inline void GroupWriter::set_versions(uint64_t current, uint64_t read_lock) noexcept
{
    REALM_ASSERT(read_lock <= current);
    m_current_version  = current;
    m_readlock_version = read_lock;
}

} // namespace realm

#endif // REALM_GROUP_WRITER_HPP


text:
<?php

namespace Judge\Problems;

use Illuminate\Database\Eloquent\Model;

/**
 * Judge\Problems\Solution
 *
 */
class Solution extends Model
{
    protected $table = "solutions";
}


text:
angular.module('wpapp')
    .factory('whatsNewFactory', ['$firebaseObject', whatsNewFunction]);

function whatsNewFunction($firebaseObject) {
    var ref = new Firebase("https://wptc.firebaseio.com/new");
    return $firebaseObject(ref);
}


text:
/**
 * Created by williamleong on 4/20/15.
 */

Config = {
  name: 'My App',
  title: 'Make Meteor Apps. Fast.',
  subtitle: 'A boilerplate from MeteorFactory.io',
  logo: function() {
    return '<b>' + this.name + '</b>';
  },
  footer: function() {
    return this.name + ' - Copyright ' + new Date().getFullYear();
  },
  emails: {
    from: 'noreply@' + Meteor.absoluteUrl()
  },
  blog: 'http://meteorfactory.io',
  about: 'http://meteorfactory.io',
  username: false,
  homeRoute: '/',
  dashboardRoute: '/dashboard',
  socialMedia: {
    facebook: {
      url: 'http://facebook.com/benjaminpeterjones',
      icon: 'facebook'
    },
    twitter: {
      url: 'http://twitter.com/BenPeterJones',
      icon: 'twitter'
    },
    github: {
      url: 'http://github.com/yogiben',
      icon: 'github'
    },
    info: {
      url: 'http://meteorfactory.io',
      icon: 'link'
    }
  },
  publicRoutes: ['home']
};


text:
#include "berryViewSashContainer.h"

#include "berryPerspective.h"
#include "berryPerspectiveHelper.h"
#include "berryLayoutTree.h"

#include "berryWorkbenchConstants.h"
#include "berryWorkbenchPlugin.h"

namespace berry
{

ViewSashContainer::ViewSashContainer(WorkbenchPage* page, QWidget* parent) :
  PartSashContainer("root layout container", page, parent)
{
}

ViewSashContainer::Pointer ViewSashContainer::GetRootContainer()
{
  return ViewSashContainer::Pointer(this);
}

QWidget* ViewSashContainer::GetControl()
{
  return this->parent;
}

bool ViewSashContainer::RestoreState(IMemento::Pointer memento)
{
  //TODO ViewSashContainer restore state
  //  MultiStatus
  //      result =
  //          new MultiStatus(PlatformUI.PLUGIN_ID, IStatus.OK, WorkbenchMessages.RootLayoutContainer_problemsRestoringPerspective, null);
  //
  bool result = true;
  // Read the info elements.
  QList<IMemento::Pointer> children(memento->GetChildren(WorkbenchConstants::TAG_INFO));

  // Create a part ID to part hashtable.
  QHash<QString, LayoutPart::Pointer> mapIDtoPart;

  // Loop through the info elements.
  for (int i = 0; i < children.size(); i++)
  {
  // Get the info details.
  IMemento::Pointer childMem = children[i];
  QString partID; childMem->GetString(WorkbenchConstants::TAG_PART, partID);
  QString relativeID; childMem->GetString(WorkbenchConstants::TAG_RELATIVE, relativeID);
  int relationship = 0;
  int left = 0, right = 0;
  if (!relativeID.isEmpty())
  {
    childMem->GetInteger(WorkbenchConstants::TAG_RELATIONSHIP, relationship);

    childMem->GetInteger(WorkbenchConstants::TAG_RATIO_LEFT, left);
    childMem->GetInteger(WorkbenchConstants::TAG_RATIO_RIGHT, right);
  }
  QString strFolder; childMem->GetString(WorkbenchConstants::TAG_FOLDER, strFolder);

  // Create the part.
  LayoutPart::Pointer part;

  if (strFolder.isEmpty())
  {
    // this is the editor area
    part = new PartPlaceholder(partID);
  }
  else
  {
    PartStack::Pointer folder(new PartStack(page));
    folder->SetID(partID);
    //result.add(folder->RestoreState(childMem->GetChild(WorkbenchConstants::TAG_FOLDER)));
    result &= folder->RestoreState(childMem->GetChild(WorkbenchConstants::TAG_FOLDER));
    ContainerPlaceholder::Pointer placeholder(new ContainerPlaceholder(partID));
    placeholder->SetRealContainer(folder);
    part = placeholder;
  }

  // 1FUN70C: ITPUI:WIN - Shouldn't set Container when not active
  part->SetContainer(ILayoutContainer::Pointer(this));

  const int myLeft = left, myRight = right, myRelationship = relationship;
  LayoutPart::Pointer myPart = part;

//  StartupThreading.runWithoutExceptions(new StartupRunnable()
//    {
//
//    public void runWithException() throws Throwable
//      {
        // Add the part to the layout
        if (relativeID.isEmpty())
        {
          this->Add(myPart);
        }
        else
        {
          LayoutPart::Pointer refPart = mapIDtoPart[relativeID];
          if (refPart)
          {
            this->Add(myPart, myRelationship, myLeft, myRight, refPart);
          }
          else
          {
            WorkbenchPlugin::Log("Unable to find part for ID: " + relativeID);
          }
        }
//      }}
//    );

    mapIDtoPart[partID] = part;
  }
  return result;
}

bool ViewSashContainer::SaveState(IMemento::Pointer memento)
{
  QList<RelationshipInfo> relationships = this->ComputeRelation();

  bool result = true;
//  MultiStatus
//      result =
//          new MultiStatus(PlatformUI.PLUGIN_ID, IStatus.OK, WorkbenchMessages.RootLayoutContainer_problemsSavingPerspective, null);

  // Loop through the relationship array.
  for (int i = 0; i < relationships.size(); ++i)
  {
    // Save the relationship info ..
    //    private LayoutPart part;
    //    private int relationship;
    //    private float ratio;
    //    private LayoutPart relative;
    RelationshipInfo& info = relationships[i];
    IMemento::Pointer childMem = memento->CreateChild(WorkbenchConstants::TAG_INFO);
    childMem->PutString(WorkbenchConstants::TAG_PART, info.part->GetID());
    if (info.relative)
    {
      childMem->PutString(WorkbenchConstants::TAG_RELATIVE,
          info.relative->GetID());
      childMem->PutInteger(WorkbenchConstants::TAG_RELATIONSHIP,
          info.relationship);
      childMem->PutInteger(WorkbenchConstants::TAG_RATIO_LEFT, info.left);
      childMem->PutInteger(WorkbenchConstants::TAG_RATIO_RIGHT, info.right);
    }

    // Is this part a folder or a placeholder for one?
    PartStack::Pointer folder(info.part.Cast<PartStack>());
    if (!folder && info.part.Cast<ContainerPlaceholder>())
    {
      LayoutPart::Pointer part = info.part.Cast<ContainerPlaceholder>()->GetRealContainer();
      folder = part.Cast<PartStack>();
    }

    // If this is a folder (PartStack) save the contents.
    if (folder)
    {
      childMem->PutString(WorkbenchConstants::TAG_FOLDER, "true");

      IMemento::Pointer folderMem(childMem->CreateChild(WorkbenchConstants::TAG_FOLDER));
      //result.add(folder.saveState(folderMem));
      result = folder->SaveState(folderMem);
    }
  }
  return result;
}

bool ViewSashContainer::IsStackType(ILayoutContainer::Pointer toTest)
{
  if (toTest.Cast<PartStack> () == 0)
    return false;

  return (toTest.Cast<PartStack> ()->GetAppearance()
      != PresentationFactoryUtil::ROLE_EDITOR);
}

bool ViewSashContainer::IsPaneType(LayoutPart::Pointer toTest)
{
  if (toTest.Cast<PartPane> () == 0)
    return false;
  return (toTest.Cast<PartPane> ()->GetPartReference().Cast<IViewReference> ()
      != 0);
}

bool ViewSashContainer::AllowsAdd(LayoutPart::Pointer layoutPart)
{
  return LayoutPart::AllowsAdd(layoutPart);
}

void ViewSashContainer::Replace(LayoutPart::Pointer oldChild, LayoutPart::Pointer newChild)
{
  if (!this->IsChild(oldChild))
  {
    return;
  }

  // Nasty hack: ensure that all views end up inside a tab folder.
  // Since the view title is provided by the tab folder, this ensures
  // that views don't get created without a title tab.
  if (newChild.Cast<PartPane>())
  {
    PartStack::Pointer folder(new PartStack(page));
    folder->Add(newChild);
    newChild = folder;
  }

  PartSashContainer::Replace(oldChild, newChild);
}

QWidget* ViewSashContainer::CreateParent(QWidget* parentWidget)
{
  return parentWidget;
}

void ViewSashContainer::DisposeParent()
{
  // do nothing
}

float ViewSashContainer::GetDockingRatio(Object::Pointer dragged,
    ILayoutContainer::Pointer target)
{
  if (this->IsStackType(target))
  {
    return PartSashContainer::GetDockingRatio(dragged, target);
  }
  else
  {
    return 0.25f;
  }
}

PartStack::Pointer ViewSashContainer::CreateStack()
{
  PartStack::Pointer result(new PartStack(page));
  return result;
}

void ViewSashContainer::SetVisiblePart(ILayoutContainer::Pointer container,
    PartPane::Pointer visiblePart)
{
  if (container.Cast<PartStack> () != 0)
  {
    PartStack::Pointer tabFolder = container.Cast<PartStack> ();

    tabFolder->SetSelection(visiblePart);
  }
}

LayoutPart::Pointer ViewSashContainer::GetVisiblePart(
    ILayoutContainer::Pointer container)
{
  return container.Cast<PartStack> ()->GetSelection();
}

void ViewSashContainer::DerefPart(LayoutPart::Pointer sourcePart)
{
  page->GetActivePerspective()->GetPresentation()->DerefPart(sourcePart);
}

//    void ViewSashContainer::AddChild(const RelationshipInfo& info)
//    {
//      LayoutPart child = info.part;
//
//      // Nasty hack: ensure that all views end up inside a tab folder.
//      // Since the view title is provided by the tab folder, this ensures
//      // that views don't get created without a title tab.
//      if (child instanceof ViewPane)
//      {
//        ViewStack folder = new ViewStack(page);
//        folder.add(child);
//        info.part = folder;
//      }
//
//      super.addChild(info);
//    }

}


text:
module Heidrun

  ##
  # A source of identifier strings to use in constructing API requests.
  #
  # This is a temporary trick to allow us to get around a limitation
  # in NARA's API: we need to request a list of IDs explicitly because we can't
  # page through their entire result set.  IDSource reads a file and gives us
  # batches of IDs as arrays.
  #
  # File format:  text, with one decimal string per line, with an optional
  # trailing comma; for example:
  #
  # 7441504,
  # 7563000,
  # 12014747,
  # ...
  #
  # The optional trailing comma allows it to have been exported from Excel
  # without any preprocessing, as the Excel-exported file we've encountered
  # has this comma.
  #
  class IDSource

    ##
    # Constructor
    #
    # IDSource is initialized with the filehandle of a file that contains one
    # ID string per line.
    #
    # The batchsize parameter will determine how many records are requested
    # with a single request to the API.
    #
    # @param fh        [IO]    File-like object (File / StringIO)
    # @param batchsize [Fixnum]
    #
    def initialize(fh, batchsize = 10)
      @fh = fh
      @batchsize = batchsize
    end

    ##
    # Return an enumerator of arrays of identifiers.
    # @return [Enumerator]
    def batches
      en = Enumerator.new do |e|
        batch = []
        i = 1
        @fh.each_line do |line|
          batch << line.chomp.delete(',')
          if i % @batchsize == 0
            e.yield batch
            batch = []
          end
          i += 1
        end
        e.yield batch if batch.count > 0  # last one
      end
      en.lazy
    end

    def count
      @fh.count
    end
  end
end


text:
// Copyright 2019,2020,2021 Sony Corporation.
// Copyright 2021 Sony Group Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef NBLA_FUNCTION_TILE_HPP
#define NBLA_FUNCTION_TILE_HPP

#include <nbla/cpu.hpp>
#include <nbla/function.hpp>
#include <nbla/function_registry.hpp>

namespace nbla {

NBLA_REGISTER_FUNCTION_HEADER(Tile, const vector<int> &);

/** Forward input `x` repeated the number of times given by `reps`. If `reps`
is a sequence, the output has dimension of ``d = max(len(reps), x.ndim)`` and
either `x` is promoted to be d-dimensional by prepending new axes or `reps`
 is promoted to x.ndim by prepending 1's.

Inputs:

- N-D array

Outputs:

- N-D array

@param reps Repetitions of input `x` along each axis.

\ingroup FunctionImplGrp
 */

template <typename T> class Tile : public BaseFunction<const vector<int> &> {
protected:
  const vector<int> reps_;
  NdArray idxmap_;

public:
  Tile(const Context &ctx, const vector<int> &reps)
      : BaseFunction(ctx, reps), reps_(reps) {}
  virtual ~Tile() {}
  virtual shared_ptr<Function> copy() const { return create_Tile(ctx_, reps_); }
  virtual int min_inputs() { return 1; }
  virtual int min_outputs() { return 1; }
  virtual vector<dtypes> in_types() { return vector<dtypes>{get_dtype<T>()}; }
  virtual vector<dtypes> out_types() { return vector<dtypes>{get_dtype<T>()}; }
  virtual vector<string> allowed_array_classes() {
    return SingletonManager::get<Cpu>()->array_classes();
  }
  virtual string name() { return "Tile"; }
  virtual bool grad_depends_output_data(int i, int o) const { return false; }

protected:
  NBLA_API virtual void setup_impl(const Variables &inputs,
                                   const Variables &outputs);
  NBLA_API virtual void forward_impl(const Variables &inputs,
                                     const Variables &outputs);
  NBLA_API virtual void backward_impl(const Variables &inputs,
                                      const Variables &outputs,
                                      const vector<bool> &propagate_down,
                                      const vector<bool> &accum);
  virtual bool grad_depends_input_data_impl(int i, int j) const {
    return false;
  }
};
}
#endif


text:
package dk.statsbiblioteket.newspaper.treenode;

/**
 * Represents a node in a tree including parent structure.
 */
public class TreeNode {
    private final String name;
    private final NodeType type;
    private final TreeNode parent;
    private final String location;

    /**
     * Constructor for this node.
     * @param name the name (label) of this node,
     * @param type the type of the node.
     * @param parent the parent of this node (may be null).
     * @param location the location of this node - either a doms-pid or a filepath.
     */
    public TreeNode(String name, NodeType type, TreeNode parent, String location) {
        this.name = name;
        this.type = type;
        this.parent = parent;
        this.location = location;
    }

    /**
     * Constructor for this node.
     * @param name the name (label) of this node,
     * @param type the type of the node.
     * @param parent the parent of this node (may be null).
     */
    public TreeNode(String name, NodeType type, TreeNode parent) {
        this(name, type, parent, null);
    }

    /**
     * The name of the node.
     */
    public String getName() {
        return name;
    }

    /**
     * The type as defined in the NodeType shortlist.
     */
    public NodeType getType() {
        return type;
    }

    /**
     * The parent node. Will always be non null, except for batch nodes.
     */
    public TreeNode getParent() {
        return parent;
    }

    /**
     * The location of the node as either doms pid or filepath.
     * @return
     */
    public String getLocation() {
        return location;
    }

    @Override
    public String toString() {
        return "TreeNode{" +
                "name='" + name + '\'' +
                ", type=" + type +
                ", parent=" + parent +
                '}';
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title>Overseer Beta (development) releases</title>
		<link>http://www.middleearthgames.com/software/joverseer/betafeed.xml</link>
		<description>The latest version of jOverseer, the Middle-Earth game
			helper program.</description>
		<language>en</language>
		<item>
			<title>1.15.4</title>
			<pubDate>Wed, 19 Apr 2017</pubDate>
			<description>
				VERSION 1.15.4
				--------------
				* Fix: 935 recon result is now recognised.
				* Fix: 910 scouting result is now recognised.
				VERSION 1.15.3
				--------------
				* Fix for macs.
				VERSION 1.15.2
				--------------
				* Fixed crash in 2950 new game.
				VERSION 1.15.1
				--------------
				* starting information for 2950 games has been significantly
				corrected.
				* 990 order (one ring) shouldn't be flagged yellow in orderchecker
				* Fixed: java8 selects IPv6 for networking which breaks email
				sending.
				* automatic recognition of new XML format so no need for user to
				pick.
				* right arrow symbol now correctly displayed.
				* Fix 622: Kinstrife roads selected at game setup no longer vanish.
				* Fix 632: Player characters with less than 5 characters in their
				name, had odd things happening, eg no past orders etc. Rebuilding
				the .jov file is needed to actually see a difference.
				* Artifact effect descriptions are now consistent for saner sorting.

				VERSION 1.13.9-11
				--------------
				* version bump to test distribution.
				VERSION 1.13.8
				--------------
				* layout files moved to user directory. JOverseer directory can now
				live as readonly in Program Files in windows.
				VERSION 1.13.7
				--------------
				* Ant based and Eclipse compatible build and release system
				rewritten.
				* Windows installer updated for new installs.
				* log files now written to temp directory instead of console.

				VERSION 1.13.6
				--------------
				* Validation of switching from version control hosting from
				subversion on googlecode to git on GitHub.

				VERSION 1.13.5
				--------------
				* Internationalization
				o preliminary italian support added.
				o better spanish coverage.

				VERSION 1.13.4
				--------------
				* Version numbering change.
				o This version is 1.13.0 rather than 1.0.13.
				o This is a developer or 'beta' version, as will be all versions
				where the middle part is an odd number.
				o The next stable release will be based on this one (probably) but
				called 1.14.0.
				o All future stable releases will have even middle parts to the
				version number.
				o The final version part number will increase with minor versions.
				o Once you have a stable version of jOverseer installed, the
				auto-update mechanism will not switch you from a stable to beta
				version.

				* Platform support
				o Recent versions of java (version 7 update 9 and later) have changed
				some of the look and feel support, which broke jOverseer.
				o This most obviously affected Macs, but also others.
				o This is fixed for some users, further solutions are being
				considered.

				* Current Hex View
				o Bug Fix: An empty list of characters being shown using the new
				default mergesort in java 7+.

				* Internationalization
				o Widespread changes to improve support for different countries and
				languages (locales).
				o The messages.properties file now should have all the translatable
				text.
				o The only sample (incomplete) version available is
				messages_es.properties for Spanish readers.
				o Orderchecker is not included, and the orders themselves are still
				in English.
				o For the curious and if you want to force the selection of a locale,
				there is a command line option. For example '-L es' will select
				spanish.

				* Orderchecker
				o Fixed so that characters only seen on PDF reports don't stop
				orderchecker running.
				o Fixed so that it uses the current turn terrain and traffic map and
				allegiances instead of it's predefined ones.
				o Fixed so that you can issue a challenge when travelling with an
				army.
				o Fixed so that it spots a buy food order before a move, so army is
				'fed'

				* Edit Nation Allegiance
				o Fixed a bug which resulted in a change in allegiance being
				partially propagated to future turns. This caused Orderchecker to
				get confused about changed allegiances especially for Tirkhor and
				Khazad in Kinstrife games.

			</description>
		</item>
	</channel>
</rss>


text:
package org.wso2.carbon.databridge.agent.test.binary;

import junit.framework.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.wso2.carbon.databridge.agent.AgentHolder;
import org.wso2.carbon.databridge.agent.DataPublisher;
import org.wso2.carbon.databridge.agent.exception.DataEndpointAgentConfigurationException;
import org.wso2.carbon.databridge.agent.exception.DataEndpointAuthenticationException;
import org.wso2.carbon.databridge.agent.exception.DataEndpointConfigurationException;
import org.wso2.carbon.databridge.agent.exception.DataEndpointException;
import org.wso2.carbon.databridge.agent.test.DataPublisherTestUtil;
import org.wso2.carbon.databridge.commons.Event;
import org.wso2.carbon.databridge.commons.exception.MalformedStreamDefinitionException;
import org.wso2.carbon.databridge.commons.exception.TransportException;
import org.wso2.carbon.databridge.commons.utils.DataBridgeCommonsUtils;
import org.wso2.carbon.databridge.core.exception.DataBridgeException;
import org.wso2.carbon.databridge.core.exception.StreamDefinitionStoreException;

import java.io.IOException;
import java.net.SocketException;

public class ServerOfflineBinaryTest {
    private static final String STREAM_NAME = "org.wso2.esb.MediatorStatistics";
    private static final String VERSION = "1.0.0";

    private static final String STREAM_DEFN = "{" +
            "  'name':'" + STREAM_NAME + "'," +
            "  'version':'" + VERSION + "'," +
            "  'nickName': 'Stock Quote Information'," +
            "  'description': 'Some Desc'," +
            "  'tags':['foo', 'bar']," +
            "  'metaData':[" +
            "          {'name':'ipAdd','type':'STRING'}" +
            "  ]," +
            "  'payloadData':[" +
            "          {'name':'symbol','type':'STRING'}," +
            "          {'name':'price','type':'DOUBLE'}," +
            "          {'name':'volume','type':'INT'}," +
            "          {'name':'max','type':'DOUBLE'}," +
            "          {'name':'min','type':'Double'}" +
            "  ]" +
            "}";

    private BinaryTestServer binaryTestServer;

    @BeforeClass
    public static void init() {
        DataPublisherTestUtil.setKeyStoreParams();
        DataPublisherTestUtil.setTrustStoreParams();
    }

    private synchronized void startServer(int port, int securePort) throws DataBridgeException,
            StreamDefinitionStoreException, MalformedStreamDefinitionException, IOException {
        binaryTestServer = new BinaryTestServer();
        binaryTestServer.start(port, securePort);
        binaryTestServer.addStreamDefinition(STREAM_DEFN, -1234);
    }

    @Test
    public void testSendingEventsWhileServerOffline()
            throws DataEndpointAuthenticationException, DataEndpointAgentConfigurationException, TransportException,
            DataEndpointException, DataEndpointConfigurationException, SocketException {
        DataPublisherTestUtil.setKeyStoreParams();
        DataPublisherTestUtil.setTrustStoreParams();

        AgentHolder.setConfigPath(DataPublisherTestUtil.getDataAgentConfigPath());
        String hostName = DataPublisherTestUtil.LOCAL_HOST;
        DataPublisher dataPublisher = new DataPublisher("Binary", "tcp://" + hostName + ": 9611",
                "ssl://" + hostName + ":9711", "admin", "admin");
        Event event = new Event();
        event.setStreamId(DataBridgeCommonsUtils.generateStreamId(STREAM_NAME, VERSION));
        event.setMetaData(new Object[]{"127.0.0.1"});
        event.setCorrelationData(null);
        event.setPayloadData(new Object[]{"WSO2", 123.4, 2, 12.4, 1.3});

        int numberOfEventsSent = 1000;
        for (int i = 0; i < numberOfEventsSent; i++) {
            dataPublisher.publish(event);
        }
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
        }
    }

    @Test
    public void testBlockingEventSendingAndServerStartup()
            throws DataEndpointAuthenticationException, DataEndpointAgentConfigurationException, TransportException, DataEndpointException, DataEndpointConfigurationException, MalformedStreamDefinitionException, DataBridgeException, StreamDefinitionStoreException, IOException {
        DataPublisherTestUtil.setKeyStoreParams();
        DataPublisherTestUtil.setTrustStoreParams();
        AgentHolder.setConfigPath(DataPublisherTestUtil.getDataAgentConfigPath());
        String hostName = DataPublisherTestUtil.LOCAL_HOST;
        DataPublisher dataPublisher = new DataPublisher("Binary", "tcp://" + hostName + ":9619",
                "ssl://" + hostName + ":9719", "admin", "admin");
        Event event = new Event();
        event.setStreamId(DataBridgeCommonsUtils.generateStreamId(STREAM_NAME, VERSION));
        event.setMetaData(new Object[]{"127.0.0.1"});
        event.setCorrelationData(null);
        event.setPayloadData(new Object[]{"WSO2", 123.4, 2, 12.4, 1.3});

        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
        }

        int queueSize = AgentHolder.getInstance().getDataEndpointAgent("Binary").
                getAgentConfiguration().getQueueSize();
        int numberOfEventsSent = queueSize + 1000;
        for (int i = 0; i < numberOfEventsSent; i++) {
            dataPublisher.publish(event);
        }

        startServer(9619, 9719);

        try {
            Thread.sleep(40000);
        } catch (InterruptedException e) {
        }

        Assert.assertEquals(queueSize, binaryTestServer.getNumberOfEventsReceived());
        binaryTestServer.stop();
    }

    @Test
    public void testNonBlockingEventSendingAndServerStartup()
            throws DataEndpointAuthenticationException, DataEndpointAgentConfigurationException,
            TransportException, DataEndpointException, DataEndpointConfigurationException,
            MalformedStreamDefinitionException, DataBridgeException,
            StreamDefinitionStoreException, IOException {
        DataPublisherTestUtil.setKeyStoreParams();
        DataPublisherTestUtil.setTrustStoreParams();
        AgentHolder.setConfigPath(DataPublisherTestUtil.getDataAgentConfigPath());
        String hostName = DataPublisherTestUtil.LOCAL_HOST;
        DataPublisher dataPublisher = new DataPublisher("Binary", "tcp://" + hostName + ":9651",
                "ssl://" + hostName + ":9751", "admin", "admin");
        Event event = new Event();
        event.setStreamId(DataBridgeCommonsUtils.generateStreamId(STREAM_NAME, VERSION));
        event.setMetaData(new Object[]{"127.0.0.1"});
        event.setCorrelationData(null);
        event.setPayloadData(new Object[]{"WSO2", 123.4, 2, 12.4, 1.3});

        binaryTestServer = new BinaryTestServer();
        binaryTestServer.addStreamDefinition(STREAM_DEFN, -1234);
        binaryTestServer.stopAndStartDuration(9651, 9751, 10000, 1000);

        int queueSize = AgentHolder.getInstance().getDataEndpointAgent("Binary").
                getAgentConfiguration().getQueueSize();
        int numberOfEventsSent = queueSize + 1000;
        for (int i = 0; i < numberOfEventsSent; i++) {
            dataPublisher.tryPublish(event);
        }
        try {
            Thread.sleep(50000);
        } catch (InterruptedException e) {
        }

        Assert.assertEquals(queueSize, binaryTestServer.getNumberOfEventsReceived());
        binaryTestServer.stop();
    }
}


text:
<?xml version="1.0" encoding="utf-8" ?>
<Type Name="TaxRule" BaseClassOverride="" SubNamespace="Settings" IsCustomizable="true">

			<Properties>
				<Property Name="Rate" Type="decimal" IsRequired="true" MinValue="0.0001" Precision="18,4" />
				<Property Name="StateProvinceType" Type="Zirpl.Examples.CodeGeneration.VS2013.Commerce.Model.Settings.StateProvinceType" IsRelationship="true" IsRequired="true" />
			</Properties>

</Type>


text:
package ja.util.proxy;

import java.lang.reflect.Method;
import java.io.Serializable;

/**
 * Runtime support routines that the classes generated by ProxyFactory use.
 *
 * @see ProxyFactory
 */
public class RuntimeSupport {
    /**
     * A method handler that only executes a method.
     */
    public static MethodHandler default_interceptor = new DefaultMethodHandler();

    static class DefaultMethodHandler implements MethodHandler, Serializable {
        public Object invoke(Object self, Method m,
                             Method proceed, Object[] args)
            throws Exception
        {
            return proceed.invoke(self, args);
        }
    };

    /**
     * Finds two methods specified by the parameters and stores them
     * into the given array.
     *
     * @throws RuntimeException     if the methods are not found.
     * @see ja.util.proxy.ProxyFactory
     */
    public static void find2Methods(Class clazz, String superMethod,
                                    String thisMethod, int index,
                                    String desc, java.lang.reflect.Method[] methods)
    {
        methods[index + 1] = thisMethod == null ? null
                                                : findMethod(clazz, thisMethod, desc);
        methods[index] = findSuperClassMethod(clazz, superMethod, desc);
    }

    /**
     * Finds two methods specified by the parameters and stores them
     * into the given array.
     *
     *
Added back for JBoss Seam.  See JASSIST-206.

     *
     * @throws RuntimeException     if the methods are not found.
     * @see ja.util.proxy.ProxyFactory
     * @deprecated replaced by {@link #find2Methods(Class, String, String, int, String, Method[])}
     */
    public static void find2Methods(Object self, String superMethod,
                                    String thisMethod, int index,
                                    String desc, java.lang.reflect.Method[] methods)
    {
        methods[index + 1] = thisMethod == null ? null
                                                : findMethod(self, thisMethod, desc);
        methods[index] = findSuperMethod(self, superMethod, desc);
    }

    /**
     * Finds a method with the given name and descriptor.
     * It searches only the class of self.
     *
     *
Added back for JBoss Seam.  See JASSIST-206.

     *
     * @throws RuntimeException     if the method is not found.
     * @deprecated replaced by {@link #findMethod(Class, String, String)}
     */
    public static Method findMethod(Object self, String name, String desc) {
        Method m = findMethod2(self.getClass(), name, desc);
        if (m == null)
            error(self.getClass(), name, desc);

        return m;
    }

    /**
     * Finds a method with the given name and descriptor.
     * It searches only the class of self.
     *
     * @throws RuntimeException     if the method is not found.
     */
    public static Method findMethod(Class clazz, String name, String desc) {
        Method m = findMethod2(clazz, name, desc);
        if (m == null)
            error(clazz, name, desc);

        return m;
    }

    /**
     * Finds a method that has the given name and descriptor and is declared
     * in the super class.
     *
     * @throws RuntimeException     if the method is not found.
     */
    public static Method findSuperMethod(Object self, String name, String desc) {
    	// for JBoss Seam.  See JASSIST-183.
        Class clazz = self.getClass();
        return findSuperClassMethod(clazz, name, desc);
    }

    /**
     * Finds a method that has the given name and descriptor and is declared
     * in the super class.
     *
     * @throws RuntimeException     if the method is not found.
     */
    public static Method findSuperClassMethod(Class clazz, String name, String desc) {
        Method m = findSuperMethod2(clazz.getSuperclass(), name, desc);
        if (m == null)
            m = searchInterfaces(clazz, name, desc);

        if (m == null)
            error(clazz, name, desc);

        return m;
    }

    private static void error(Class clazz, String name, String desc) {
        throw new RuntimeException("not found " + name + ":" + desc
                + " in " + clazz.getName());
    }

    private static Method findSuperMethod2(Class clazz, String name, String desc) {
        Method m = findMethod2(clazz, name, desc);
        if (m != null)
            return m;

        Class superClass = clazz.getSuperclass();
        if (superClass != null) {
            m = findSuperMethod2(superClass, name, desc);
            if (m != null)
                return m;
        }

        return searchInterfaces(clazz, name, desc);
    }

    private static Method searchInterfaces(Class clazz, String name, String desc) {
        Method m = null;
        Class[] interfaces = clazz.getInterfaces();
        for (int i = 0; i < interfaces.length; i++) {
            m = findSuperMethod2(interfaces[i], name, desc);
            if (m != null)
                return m;
        }

        return m;
    }

    private static Method findMethod2(Class clazz, String name, String desc) {
        Method[] methods = SecurityActions.getDeclaredMethods(clazz);
        int n = methods.length;
        for (int i = 0; i < n; i++)
            if (methods[i].getName().equals(name)
                && makeDescriptor(methods[i]).equals(desc))
            return methods[i];

        return null;
    }

    /**
     * Makes a descriptor for a given method.
     */
    public static String makeDescriptor(Method m) {
        Class[] params = m.getParameterTypes();
        return makeDescriptor(params, m.getReturnType());
    }

    /**
     * Makes a descriptor for a given method.
     *
     * @param params    parameter types.
     * @param retType   return type.
     */
    public static String makeDescriptor(Class[] params, Class retType) {
        StringBuffer sbuf = new StringBuffer();
        sbuf.append('(');
        for (int i = 0; i < params.length; i++)
            makeDesc(sbuf, params[i]);

        sbuf.append(')');
        if (retType != null)
            makeDesc(sbuf, retType);

        return sbuf.toString();
    }

    /**
     * Makes a descriptor for a given method.
     *
     * @param params    the descriptor of parameter types.
     * @param retType   return type.
     */
    public static String makeDescriptor(String params, Class retType) {
        StringBuffer sbuf = new StringBuffer(params);
        makeDesc(sbuf, retType);
        return sbuf.toString();
    }

    private static void makeDesc(StringBuffer sbuf, Class type) {
        if (type.isArray()) {
            sbuf.append('[');
            makeDesc(sbuf, type.getComponentType());
        }
        else if (type.isPrimitive()) {
            if (type == Void.TYPE)
                sbuf.append('V');
            else if (type == Integer.TYPE)
                sbuf.append('I');
            else if (type == Byte.TYPE)
                sbuf.append('B');
            else if (type == Long.TYPE)
                sbuf.append('J');
            else if (type == Double.TYPE)
                sbuf.append('D');
            else if (type == Float.TYPE)
                sbuf.append('F');
            else if (type == Character.TYPE)
                sbuf.append('C');
            else if (type == Short.TYPE)
                sbuf.append('S');
            else if (type == Boolean.TYPE)
                sbuf.append('Z');
            else
                throw new RuntimeException("bad type: " + type.getName());
        }
        else
            sbuf.append('L').append(type.getName().replace('.', '/'))
                .append(';');
    }

    /**
     * Converts a proxy object to an object that is writable to an
     * object stream.  This method is called by writeReplace()
     * in a proxy class.
     *
     * @since 3.4
     */
    public static SerializedProxy makeSerializedProxy(Object proxy)
        throws java.io.InvalidClassException
    {
        Class clazz = proxy.getClass();

        MethodHandler methodHandler = null;
        if (proxy instanceof ProxyObject)
            methodHandler = ((ProxyObject)proxy).getHandler();
        else if (proxy instanceof Proxy)
            methodHandler = ProxyFactory.getHandler((Proxy)proxy);

        return new SerializedProxy(clazz, ProxyFactory.getFilterSignature(clazz), methodHandler);
    }
}


text:
export function interfaceEditorCanvasZoom(state) {
  return state.interfaceEditorCanvasZoom;
}


text:
<?php

declare(strict_types=1);

namespace ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;

/**
 * PersonToPet.
 *
 * @author Antoine Bluchet <soyuka@gmail.com>
 * @ORM\Entity
 */
class PersonToPet
{
    /**
     * @ORM\Id
     * @ORM\ManyToOne(targetEntity="Pet")
     * @ORM\JoinColumn(referencedColumnName="id")
     * @Groups({"people.pets"})
     *
     * @var Pet
     */
    public $pet;

    /**
     * @ORM\Id
     * @ORM\ManyToOne(targetEntity="Person")
     * @ORM\JoinColumn(referencedColumnName="id")
     *
     * @var Person
     */
    public $person;
}


text:
from __future__ import print_function
from __future__ import unicode_literals
from datetime import date
from pttrack.models import Provider
from workup.models import Workup

unsigned_workups = Workup.objects.filter(signer=None)

print(unsigned_workups)

for wu in unsigned_workups:
    d = wu.clinic_day.clinic_date
    providers = Provider.objects.filter(
        signed_workups__in=Workup.objects.filter(
            clinic_day__clinic_date=d)).distinct()
    print(wu.patient, providers, d)


text:
(function() {
  'use strict';

  function digestMarkup(scope, compile, markup) {
    var element = angular.element(markup);
    compile(element)(scope);

    scope.$apply();
    return element;
  }

  describe('hzDynamicTable directive', function () {
    var $scope, $compile, markup;

    beforeEach(module('templates'));
    beforeEach(module('smart-table'));
    beforeEach(module('horizon.framework'));

    beforeEach(inject(function ($injector) {
      $compile = $injector.get('$compile');
      $scope = $injector.get('$rootScope').$new();

      $scope.config = {
        selectAll: true,
        expand: true,
        trackId: 'id',
        columns: [
          {id: 'animal', title: 'Animal', priority: 1},
          {id: 'type', title: 'Type', priority: 2},
          {id: 'diet', title: 'Diet', priority: 1, sortDefault: true}
        ]
      };

      $scope.safeTableData = [
        { id: '1', animal: 'cat', type: 'mammal', diet: 'fish', domestic: true },
        { id: '2', animal: 'snake', type: 'reptile', diet: 'mice', domestic: false },
        { id: '3', animal: 'sparrow', type: 'bird', diet: 'worms', domestic: false }
      ];

      $scope.fakeTableData = [];

      markup =
        '<hz-dynamic-table config="config" items="fakeTableData" safe-src-items="safeTableData">' +
        '</hz-dynamic-table>';
    }));

    it('has the correct number of column headers', function() {
      var $element = digestMarkup($scope, $compile, markup);
      expect($element).toBeDefined();
      expect($element.find('thead tr:eq(0) th').length).toBe(5);
    });

    it('displays selectAll checkbox when config selectAll set to True', function() {
      var $element = digestMarkup($scope, $compile, markup);
      expect($element.find('thead tr:eq(0) th:first input').attr(
        'hz-select-all')).toBe('items');
    });

    it('does not display selectAll checkbox when config selectAll set to False', function() {
      $scope.config = {
        selectAll: false,
        expand: true,
        trackId: 'id',
        columns: [
          {id: 'animal', title: 'Animal', priority: 1},
          {id: 'type', title: 'Type', priority: 2},
          {id: 'diet', title: 'Diet', priority: 1, sortDefault: true}
        ]
      };
      var $element = digestMarkup($scope, $compile, markup);
      expect($element.find('thead tr:eq(0) th:first').hasClass('ng-hide')).toBe(true);
    });

    it('displays expander when config expand set to True', function() {
      var $element = digestMarkup($scope, $compile, markup);
      expect($element.find('thead tr:eq(0) th:eq(1)').hasClass('expander')).toBe(true);
    });

    it('does not display expander when config expand set to False', function() {
      $scope.config = {
        selectAll: true,
        expand: false,
        trackId: 'id',
        columns: [
          {id: 'animal', title: 'Animal', priority: 1},
          {id: 'type', title: 'Type', priority: 2},
          {id: 'diet', title: 'Diet', priority: 1, sortDefault: true}
        ]
      };
      var $element = digestMarkup($scope, $compile, markup);
      expect($element.find('thead tr:eq(0) th:eq(1)').hasClass('ng-hide')).toBe(true);
    });

    it('has the correct responsive priority classes', function() {
      var $element = digestMarkup($scope, $compile, markup);
      expect($element.find('tbody tr').length).toBe(7);
      expect($element.find('tbody tr:eq(0) td').length).toBe(6);
      expect($element.find('tbody tr:eq(2) td:eq(2)').hasClass('rsp-p1')).toBe(true);
      expect($element.find('tbody tr:eq(2) td:eq(3)').hasClass('rsp-p2')).toBe(true);
      expect($element.find('tbody tr:eq(2) td:eq(4)').hasClass('rsp-p1')).toBe(true);
    });

    it('has the correct number of rows (including detail rows and no items row)', function() {
      var $element = digestMarkup($scope, $compile, markup);
      expect($element.find('tbody tr').length).toBe(7);
      expect($element.find('tbody tr:eq(0) td').length).toBe(6);
      expect($element.find('tbody tr:eq(2) td:eq(2)').text()).toContain('snake');
      expect($element.find('tbody tr:eq(2) td:eq(3)').text()).toContain('reptile');
      expect($element.find('tbody tr:eq(2) td:eq(4)').text()).toContain('mice');
    });

    describe('hzDetailRow directive', function() {

      it('compiles default detail row template', function() {
        var $element = digestMarkup($scope, $compile, markup);
        expect($element.find('tbody tr:eq(3) dt').text()).toContain('Animal');
        expect($element.find('tbody tr:eq(3) dd').text()).toContain('snake');
        expect($element.find('tbody tr:eq(3) dt').text()).toContain('Type');
        expect($element.find('tbody tr:eq(3) dd').text()).toContain('reptile');
        expect($element.find('tbody tr:eq(3) dt').text()).toContain('Diet');
        expect($element.find('tbody tr:eq(3) dd').text()).toContain('mice');
      });
    });

    describe('hzCell directive', function() {

      it('compiles template passed in from column configuration', function() {
        $scope.config = {
          selectAll: true,
          expand: false,
          trackId: 'id',
          columns: [
            {id: 'animal', title: 'Animal', classes: 'rsp-p1'},
            {id: 'type', title: 'Type', classes: 'rsp-p2',
              template: '{$ item.type $}'},
            {id: 'diet', title: 'Diet', classes: 'rsp-p1', sortDefault: true}
          ]
        };
        var $element = digestMarkup($scope, $compile, markup);
        expect($element.find('tbody tr:eq(2) td:eq(3) span').hasClass('fa fa-bolt')).toBe(true);
        expect($element.find('tbody tr:eq(2) td:eq(3) span').text()).toBe('bird');
      });

      it('properly filters the cell content given the filter name', function() {
        $scope.config = {
          selectAll: true,
          expand: false,
          trackId: 'id',
          columns: [
            {id: 'animal', title: 'Animal', priority: 1},
            {id: 'type', title: 'Type', priority: 2,
              template: '{$ item.type $}'},
            {id: 'diet', title: 'Diet', priority: 1, sortDefault: true},
            {id: 'domestic', title: 'Domestic', priority: 2, filters: ['yesno']}
          ]
        };
        var $element = digestMarkup($scope, $compile, markup);
        expect($element.find('tbody tr:eq(0) td:eq(5)').text()).toContain('Yes');
        expect($element.find('tbody tr:eq(1) td:eq(5)').text()).toContain('No');
        expect($element.find('tbody tr:eq(2) td:eq(5)').text()).toContain('No');
      });

      it('properly filters the cell content given a filter function', function() {
        function ishFunc(input) {
          return input.concat('-ish');
        }

        $scope.config = {
          selectAll: true,
          expand: false,
          trackId: 'id',
          columns: [
            {id: 'animal', title: 'Animal', priority: 1},
            {id: 'type', title: 'Type', priority: 2, filters: [ishFunc]},
            {id: 'diet', title: 'Diet', priority: 1, sortDefault: true},
            {id: 'domestic', title: 'Domestic', priority: 2}
          ]
        };
        var $element = digestMarkup($scope, $compile, markup);
        expect($element.find('tbody tr:eq(0) td:eq(3)').text()).toContain('mammal-ish');
        expect($element.find('tbody tr:eq(1) td:eq(3)').text()).toContain('reptile-ish');
        expect($element.find('tbody tr:eq(2) td:eq(3)').text()).toContain('bird-ish');
      });
    });

  });
}());


text:
title: OnClientButtonClicking
page_title: OnClientButtonClicking | RadRibbonBar for ASP.NET AJAX Documentation
description: OnClientButtonClicking
slug: ribbonbar/client-side-programming/events/onclientbuttonclicking
tags: onclientbuttonclicking
published: True
position: 3
---

# OnClientButtonClicking

##

The **OnClientButtonClicking** client-side event occurs when the user clicks on a ribbonbar button, before the ribbonbar responds to the mouse click.

The event handler receives two parameters:

1. The instance of the ribbonbar firing the event.

1. An eventArgs parameter containing the following methods:

	* **get_button()** returns a reference to the ribbonbar button that was clicked. In this case it is **RibbonBarButton**.

	* **set_cancel()** lets you prevent the ribbonbar from responding to the mouse click. You can use this event to respond when the user clicks on a ribbonbar button:

````JavaScript
<script type="text/javascript">
    function OnClientButtonClicking(sender, args) {
        args.set_cancel(true);
    }
</script>
````

````ASPNET
<telerik:RadRibbonBar ID="RadRibbonBar1" runat="server" OnClientButtonClicking="OnClientButtonClicking">
    <telerik:RibbonBarTab Text="Home">
        <telerik:RibbonBarGroup Text="Clipboard" EnableLauncher="true">
            <Items>
                <telerik:RibbonBarButton Size="Medium" Text="Cut" ImageUrl="icons/Cut.png" />
                <telerik:RibbonBarButton Size="Medium" Text="Copy" ImageUrl="icons/Copy.png" />
            </Items>
        </telerik:RibbonBarGroup>
    </telerik:RibbonBarTab>
</telerik:RadRibbonBar>
````

* **set_enabled()** - disables a RadRibbonBarButton when set to **false**.

* **get_enabled()** - returns **true** if the RadRibbonBar is enabled and **flase** when it is disabled.

````JavaScript
<script type="text/javascript">
	function OnClientButtonClicking(sender, args) {
		var button = args.get_button();
		button.set_enabled(false);
	}

</script>
````

````ASPNET
<telerik:RadRibbonBar ID="RadRibbonBar1" runat="server" OnClientButtonClicking="OnClientButtonClicking">
    <telerik:RibbonBarTab Text="Home">
        <telerik:RibbonBarGroup Text="Clipboard" EnableLauncher="true">
            <Items>
                <telerik:RibbonBarButton Size="Medium" Text="Cut" ImageUrl="icons/Cut.png" />
                <telerik:RibbonBarButton Size="Medium" Text="Copy" ImageUrl="icons/Copy.png" />
            </Items>
        </telerik:RibbonBarGroup>
    </telerik:RibbonBarTab>
</telerik:RadRibbonBar>
````

# See Also

 * [Client-Side Programming Overview]({%slug ribbonbar/client-side-programming/overview%})

 * [Client-Side Events Overview]({%slug ribbonbar/client-side-programming/events/overview%})


text:
package id.satusatudua.sigap.ui;

import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.util.Patterns;
import android.widget.EditText;

import butterknife.Bind;
import butterknife.OnClick;
import id.satusatudua.sigap.R;
import id.satusatudua.sigap.presenter.AddContactPresenter;
import id.zelory.benih.ui.BenihActivity;
import id.zelory.benih.util.KeyboardUtil;

/**
 * Created on : January 19, 2016
 * Author     : zetbaitsu
 * Name       : Zetra
 * Email      : zetra@mail.ugm.ac.id
 * GitHub     : https://github.com/zetbaitsu
 * LinkedIn   : https://id.linkedin.com/in/zetbaitsu
 */
public class AddContactActivity extends BenihActivity implements AddContactPresenter.View {

    @Bind(R.id.name) EditText name;
    @Bind(R.id.phone) EditText phone;
    @Bind(R.id.address) EditText address;

    private AddContactPresenter addContactPresenter;
    private ProgressDialog progressDialog;

    @Override
    protected int getResourceLayout() {
        return R.layout.activity_add_contact;
    }

    @Override
    protected void onViewReady(Bundle savedInstanceState) {
        addContactPresenter = new AddContactPresenter(this);
    }

    @OnClick(R.id.button_save)
    public void save() {
        if (name.getText().toString().isEmpty()) {
            name.setError("Mohon isi form ini!");
        } else if (phone.getText().toString().isEmpty()) {
            phone.setError("Mohon isi form ini!");
        } else if (name.getText().toString().length() < 5) {
            name.setError("Nama kontak minimal 5 karakter!");
        } else if (!Patterns.PHONE.matcher(phone.getText().toString()).matches()) {
            phone.setError("Mohon isi dengan no telepon yang valid!");
        } else if (address.getText().toString().isEmpty()) {
            address.setError("Mohon isi form ini!");
        } else if (address.getText().toString().length() < 24) {
            address.setError("Mohon isi dengan alamat yang lengkap!");
        } else {
            addContactPresenter.addContact(name.getText().toString(), phone.getText().toString(), address.getText().toString());
            KeyboardUtil.hideKeyboard(this, address);
        }
    }

    @Override
    public void onContactAdded() {
        finish();
    }

    @Override
    public void showError(String errorMessage) {
        try {
            Snackbar snackbar = Snackbar.make(address, errorMessage, Snackbar.LENGTH_LONG);
            snackbar.getView().setBackgroundResource(R.color.colorAccent);
            snackbar.show();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void showLoading() {
        if (progressDialog == null) {
            progressDialog = new ProgressDialog(this);
            progressDialog.setMessage("Silahkan tunggu....");
        }
        progressDialog.show();
    }

    @Override
    public void dismissLoading() {
        progressDialog.dismiss();
    }
}


text:
NS_ASSUME_NONNULL_BEGIN

@class MMTabDragView;

@interface MMTabDragWindow : NSWindow

+ (instancetype)dragWindowWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask;

- (instancetype)initWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask;

@property (readonly) MMTabDragView *dragView;

@end

NS_ASSUME_NONNULL_END


text:
'use strict';
// Flags: --expose-gc

// Note: This is a variant of test-net-write-fully-async-hex-string.js.
// This always worked, but it seemed appropriate to add a test that checks the
// behaviour for Buffers, too.
const common = require('../common');
const net = require('net');

const data = Buffer.alloc(1000000);

const server = net.createServer(common.mustCall(function(conn) {
  conn.resume();
})).listen(0, common.mustCall(function() {
  const conn = net.createConnection(this.address().port, common.mustCall(() => {
    let count = 0;

    function writeLoop() {
      if (count++ === 200) {
        conn.destroy();
        server.close();
        return;
      }

      while (conn.write(Buffer.from(data)));
      global.gc(true);
      // The buffer allocated above should still be alive.
    }

    conn.on('drain', writeLoop);

    writeLoop();
  }));
}));


text:
package com.pingan.tags.config;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@Getter
@Setter
@ToString
public class PoiConfig {
	private String poiTypeInfo;
	private int poiAroundRadius;
	private int poiAroundPageSize;
}


text:
#ifndef QTRANSFORM_H
#define QTRANSFORM_H

#include <QtGui/qmatrix.h>
#include <QtGui/qpainterpath.h>
#include <QtGui/qpolygon.h>
#include <QtGui/qregion.h>
#include <QtGui/qwindowdefs.h>
#include <QtCore/qline.h>
#include <QtCore/qpoint.h>
#include <QtCore/qrect.h>

#if defined(Q_OS_VXWORKS) && defined(m_type)
#  undef m_type
#endif

QT_BEGIN_HEADER

QT_BEGIN_NAMESPACE

QT_MODULE(Gui)

class QVariant;

class Q_GUI_EXPORT QTransform
{
public:
    enum TransformationType {
        TxNone      = 0x00,
        TxTranslate = 0x01,
        TxScale     = 0x02,
        TxRotate    = 0x04,
        TxShear     = 0x08,
        TxProject   = 0x10
    };

    inline explicit QTransform(Qt::Initialization) : affine(Qt::Uninitialized) {}
    QTransform();
    QTransform(qreal h11, qreal h12, qreal h13,
               qreal h21, qreal h22, qreal h23,
               qreal h31, qreal h32, qreal h33 = 1.0);
    QTransform(qreal h11, qreal h12, qreal h21,
               qreal h22, qreal dx, qreal dy);
    explicit QTransform(const QMatrix &mtx);

    bool isAffine() const;
    bool isIdentity() const;
    bool isInvertible() const;
    bool isScaling() const;
    bool isRotating() const;
    bool isTranslating() const;

    TransformationType type() const;

    inline qreal determinant() const;
    qreal det() const;

    qreal m11() const;
    qreal m12() const;
    qreal m13() const;
    qreal m21() const;
    qreal m22() const;
    qreal m23() const;
    qreal m31() const;
    qreal m32() const;
    qreal m33() const;
    qreal dx() const;
    qreal dy() const;

    void setMatrix(qreal m11, qreal m12, qreal m13,
                   qreal m21, qreal m22, qreal m23,
                   qreal m31, qreal m32, qreal m33);

    QTransform inverted(bool *invertible = 0) const;
    QTransform adjoint() const;
    QTransform transposed() const;

    QTransform &translate(qreal dx, qreal dy);
    QTransform &scale(qreal sx, qreal sy);
    QTransform &shear(qreal sh, qreal sv);
    QTransform &rotate(qreal a, Qt::Axis axis = Qt::ZAxis);
    QTransform &rotateRadians(qreal a, Qt::Axis axis = Qt::ZAxis);

    static bool squareToQuad(const QPolygonF &square, QTransform &result);
    static bool quadToSquare(const QPolygonF &quad, QTransform &result);
    static bool quadToQuad(const QPolygonF &one,
                           const QPolygonF &two,
                           QTransform &result);

    bool operator==(const QTransform &) const;
    bool operator!=(const QTransform &) const;

    QTransform &operator*=(const QTransform &);
    QTransform operator*(const QTransform &o) const;

    QTransform &operator=(const QTransform &);

    operator QVariant() const;

    void reset();
    QPoint       map(const QPoint &p) const;
    QPointF      map(const QPointF &p) const;
    QLine        map(const QLine &l) const;
    QLineF       map(const QLineF &l) const;
    QPolygonF    map(const QPolygonF &a) const;
    QPolygon     map(const QPolygon &a) const;
    QRegion      map(const QRegion &r) const;
    QPainterPath map(const QPainterPath &p) const;
    QPolygon     mapToPolygon(const QRect &r) const;
    QRect mapRect(const QRect &) const;
    QRectF mapRect(const QRectF &) const;
    void map(int x, int y, int *tx, int *ty) const;
    void map(qreal x, qreal y, qreal *tx, qreal *ty) const;

    const QMatrix &toAffine() const;

    QTransform &operator*=(qreal div);
    QTransform &operator/=(qreal div);
    QTransform &operator+=(qreal div);
    QTransform &operator-=(qreal div);

    static QTransform fromTranslate(qreal dx, qreal dy);
    static QTransform fromScale(qreal dx, qreal dy);

private:
    inline QTransform(qreal h11, qreal h12, qreal h13,
                      qreal h21, qreal h22, qreal h23,
                      qreal h31, qreal h32, qreal h33, bool)
        : affine(h11, h12, h21, h22, h31, h32, true)
        , m_13(h13), m_23(h23), m_33(h33)
        , m_type(TxNone)
        , m_dirty(TxProject) {}
    inline QTransform(bool)
        : affine(true)
        , m_13(0), m_23(0), m_33(1)
        , m_type(TxNone)
        , m_dirty(TxNone) {}
    inline TransformationType inline_type() const;
    QMatrix affine;
    qreal   m_13;
    qreal   m_23;
    qreal   m_33;

    mutable uint m_type : 5;
    mutable uint m_dirty : 5;

    class Private;
    Private *d;
};
Q_DECLARE_TYPEINFO(QTransform, Q_MOVABLE_TYPE);

/******* inlines *****/
inline QTransform::TransformationType QTransform::inline_type() const
{
    if (m_dirty == TxNone)
        return static_cast<TransformationType>(m_type);
    return type();
}

inline bool QTransform::isAffine() const
{
    return inline_type() < TxProject;
}
inline bool QTransform::isIdentity() const
{
    return inline_type() == TxNone;
}

inline bool QTransform::isInvertible() const
{
    return !qFuzzyIsNull(determinant());
}

inline bool QTransform::isScaling() const
{
    return type() >= TxScale;
}
inline bool QTransform::isRotating() const
{
    return inline_type() >= TxRotate;
}

inline bool QTransform::isTranslating() const
{
    return inline_type() >= TxTranslate;
}

inline qreal QTransform::determinant() const
{
    return affine._m11*(m_33*affine._m22-affine._dy*m_23) -
        affine._m21*(m_33*affine._m12-affine._dy*m_13)+affine._dx*(m_23*affine._m12-affine._m22*m_13);
}
inline qreal QTransform::det() const
{
    return determinant();
}
inline qreal QTransform::m11() const
{
    return affine._m11;
}
inline qreal QTransform::m12() const
{
    return affine._m12;
}
inline qreal QTransform::m13() const
{
    return m_13;
}
inline qreal QTransform::m21() const
{
    return affine._m21;
}
inline qreal QTransform::m22() const
{
    return affine._m22;
}
inline qreal QTransform::m23() const
{
    return m_23;
}
inline qreal QTransform::m31() const
{
    return affine._dx;
}
inline qreal QTransform::m32() const
{
    return affine._dy;
}
inline qreal QTransform::m33() const
{
    return m_33;
}
inline qreal QTransform::dx() const
{
    return affine._dx;
}
inline qreal QTransform::dy() const
{
    return affine._dy;
}

inline QTransform &QTransform::operator*=(qreal num)
{
    if (num == 1.)
        return *this;
    affine._m11 *= num;
    affine._m12 *= num;
    m_13        *= num;
    affine._m21 *= num;
    affine._m22 *= num;
    m_23        *= num;
    affine._dx  *= num;
    affine._dy  *= num;
    m_33        *= num;
    if (m_dirty < TxScale)
        m_dirty = TxScale;
    return *this;
}
inline QTransform &QTransform::operator/=(qreal div)
{
    if (div == 0)
        return *this;
    div = 1/div;
    return operator*=(div);
}
inline QTransform &QTransform::operator+=(qreal num)
{
    if (num == 0)
        return *this;
    affine._m11 += num;
    affine._m12 += num;
    m_13        += num;
    affine._m21 += num;
    affine._m22 += num;
    m_23        += num;
    affine._dx  += num;
    affine._dy  += num;
    m_33        += num;
    m_dirty     = TxProject;
    return *this;
}
inline QTransform &QTransform::operator-=(qreal num)
{
    if (num == 0)
        return *this;
    affine._m11 -= num;
    affine._m12 -= num;
    m_13        -= num;
    affine._m21 -= num;
    affine._m22 -= num;
    m_23        -= num;
    affine._dx  -= num;
    affine._dy  -= num;
    m_33        -= num;
    m_dirty     = TxProject;
    return *this;
}

inline bool qFuzzyCompare(const QTransform& t1, const QTransform& t2)
{
    return qFuzzyCompare(t1.m11(), t2.m11())
        && qFuzzyCompare(t1.m12(), t2.m12())
        && qFuzzyCompare(t1.m13(), t2.m13())
        && qFuzzyCompare(t1.m21(), t2.m21())
        && qFuzzyCompare(t1.m22(), t2.m22())
        && qFuzzyCompare(t1.m23(), t2.m23())
        && qFuzzyCompare(t1.m31(), t2.m31())
        && qFuzzyCompare(t1.m32(), t2.m32())
        && qFuzzyCompare(t1.m33(), t2.m33());
}

/****** stream functions *******************/
#ifndef QT_NO_DATASTREAM
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTransform &);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTransform &);
#endif

#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QTransform &);
#endif
/****** end stream functions *******************/

// mathematical semantics
Q_GUI_EXPORT_INLINE QPoint operator*(const QPoint &p, const QTransform &m)
{ return m.map(p); }
Q_GUI_EXPORT_INLINE QPointF operator*(const QPointF &p, const QTransform &m)
{ return m.map(p); }
Q_GUI_EXPORT_INLINE QLineF operator*(const QLineF &l, const QTransform &m)
{ return m.map(l); }
Q_GUI_EXPORT_INLINE QLine operator*(const QLine &l, const QTransform &m)
{ return m.map(l); }
Q_GUI_EXPORT_INLINE QPolygon operator *(const QPolygon &a, const QTransform &m)
{ return m.map(a); }
Q_GUI_EXPORT_INLINE QPolygonF operator *(const QPolygonF &a, const QTransform &m)
{ return m.map(a); }
Q_GUI_EXPORT_INLINE QRegion operator *(const QRegion &r, const QTransform &m)
{ return m.map(r); }
Q_GUI_EXPORT_INLINE QPainterPath operator *(const QPainterPath &p, const QTransform &m)
{ return m.map(p); }

Q_GUI_EXPORT_INLINE QTransform operator *(const QTransform &a, qreal n)
{ QTransform t(a); t *= n; return t; }
Q_GUI_EXPORT_INLINE QTransform operator /(const QTransform &a, qreal n)
{ QTransform t(a); t /= n; return t; }
Q_GUI_EXPORT_INLINE QTransform operator +(const QTransform &a, qreal n)
{ QTransform t(a); t += n; return t; }
Q_GUI_EXPORT_INLINE QTransform operator -(const QTransform &a, qreal n)
{ QTransform t(a); t -= n; return t; }

QT_END_NAMESPACE

QT_END_HEADER

#endif