text:
<TS language="fr_CA" version="2.1">
<context>
    <name>AcceptandPayOfferListPage</name>
    </context>
<context>
    <name>AcceptedOfferListPage</name>
    <message>
        <source>Comma separated file (*.csv)</source>
        <translation>Fichier séparé par une virgule (*.csv)</translation>
    </message>
    </context>
<context>
    <name>AddressBookPage</name>
    <message>
        <source>Create a new address</source>
        <translation>Créer une nouvelle adresse</translation>
    </message>
    <message>
        <source>Copy the currently selected address to the system clipboard</source>
        <translation>Copier l'adresse surligné a votre presse-papier</translation>
    </message>
    <message>
        <source>&Delete</source>
        <translation>&Supprimer</translation>
    </message>
    <message>
        <source>Sending addresses</source>
        <translation>Envoi des adresses</translation>
    </message>
    <message>
        <source>Comma separated file (*.csv)</source>
        <translation>Fichier séparé par une virgule (*.csv)</translation>
    </message>
    <message>
        <source>Label</source>
        <translation>Libellé</translation>
    </message>
    <message>
        <source>Address</source>
        <translation>Adresse</translation>
    </message>
    </context>
<context>
    <name>AddressTableModel</name>
    <message>
        <source>Label</source>
        <translation>Libellé</translation>
    </message>
    <message>
        <source>Address</source>
        <translation>Adresse</translation>
    </message>
    <message>
        <source>(no label)</source>
        <translation>(pas de libellé)</translation>
    </message>
</context>
<context>
    <name>AliasListPage</name>
    </context>
<context>
    <name>AliasTableModel</name>
    </context>
<context>
    <name>AliasView</name>
    </context>
<context>
    <name>AskPassphraseDialog</name>
    <message>
        <source>Enter passphrase</source>
        <translation>Entrer Mot de Passe</translation>
    </message>
    <message>
        <source>New passphrase</source>
        <translation>Nouveau Mot de passe</translation>
    </message>
    <message>
        <source>Repeat new passphrase</source>
        <translation>Répéter Mot de Passe</translation>
    </message>
    <message>
        <source>Encrypt wallet</source>
        <translation>Crypter, chiffrer le portefeuille</translation>
    </message>
    <message>
        <source>This operation needs your wallet passphrase to unlock the wallet.</source>
        <translation>Cette opération nécessite le mot de passe de votre portefeuille afin de déverrouiller le portefeuille.</translation>
    </message>
    <message>
        <source>Unlock wallet</source>
        <translation>Déverrouiller le portefeuille</translation>
    </message>
    <message>
        <source>This operation needs your wallet passphrase to decrypt the wallet.</source>
        <translation>Cette opération nécessite le mot de passe de votre portefeuille afin de le déchiffrer.</translation>
    </message>
    </context>
<context>
    <name>BanTableModel</name>
    </context>
<context>
    <name>CertListPage</name>
    </context>
<context>
    <name>CertTableModel</name>
    </context>
<context>
    <name>CertView</name>
    </context>
<context>
    <name>CoinControlDialog</name>
    <message>
        <source>(un)select all</source>
        <translation>Toute sélectionner </translation>
    </message>
    <message>
        <source>Copy address</source>
        <translation>Copier l'adresse </translation>
    </message>
    <message>
        <source>(no label)</source>
        <translation>(pas de libellé)</translation>
    </message>
    </context>
<context>
    <name>EditAddressDialog</name>
    <message>
        <source>&Label</source>
        <translation>Record</translation>
    </message>
    <message>
        <source>&Address</source>
        <translation>Addresse</translation>
    </message>
    </context>
<context>
    <name>EditAliasDialog</name>
    </context>
<context>
    <name>EditCertDialog</name>
    </context>
<context>
    <name>EditOfferDialog</name>
    </context>
<context>
    <name>EditWhitelistOfferDialog</name>
    <message>
        <source>Comma separated file (*.csv)</source>
        <translation>Fichier séparé par une virgule (*.csv)</translation>
    </message>
    </context>
<context>
    <name>EscrowInfoDialog</name>
    </context>
<context>
    <name>EscrowListPage</name>
    </context>
<context>
    <name>EscrowTableModel</name>
    </context>
<context>
    <name>EscrowView</name>
    </context>
<context>
    <name>FreespaceChecker</name>
    </context>
<context>
    <name>HelpMessageDialog</name>
    </context>
<context>
    <name>InMessageListPage</name>
    <message>
        <source>Comma separated file (*.csv)</source>
        <translation>Fichier séparé par une virgule (*.csv)</translation>
    </message>
    </context>
<context>
    <name>Intro</name>
    <message>
        <source>Welcome</source>
        <translation>Bienvenue </translation>
    </message>
    </context>
<context>
    <name>ManageEscrowDialog</name>
    </context>
<context>
    <name>MessageInfoDialog</name>
    </context>
<context>
    <name>MessageListPage</name>
    </context>
<context>
    <name>MessageTableModel</name>
    </context>
<context>
    <name>MessageView</name>
    </context>
<context>
    <name>ModalOverlay</name>
    </context>
<context>
    <name>MyAcceptedOfferListPage</name>
    <message>
        <source>Comma separated file (*.csv)</source>
        <translation>Fichier séparé par une virgule (*.csv)</translation>
    </message>
    </context>
<context>
    <name>MyAliasListPage</name>
    <message>
        <source>Comma separated file (*.csv)</source>
        <translation>Fichier séparé par une virgule (*.csv)</translation>
    </message>
    </context>
<context>
    <name>MyCertListPage</name>
    <message>
        <source>Comma separated file (*.csv)</source>
        <translation>Fichier séparé par une virgule (*.csv)</translation>
    </message>
    </context>
<context>
    <name>MyEscrowListPage</name>
    <message>
        <source>Comma separated file (*.csv)</source>
        <translation>Fichier séparé par une virgule (*.csv)</translation>
    </message>
    </context>
<context>
    <name>MyOfferListPage</name>
    <message>
        <source>Comma separated file (*.csv)</source>
        <translation>Fichier séparé par une virgule (*.csv)</translation>
    </message>
    </context>
<context>
    <name>MyOfferWhitelistTableModel</name>
    </context>
<context>
    <name>MyWhitelistOfferDialog</name>
    <message>
        <source>Comma separated file (*.csv)</source>
        <translation>Fichier séparé par une virgule (*.csv)</translation>
    </message>
    </context>
<context>
    <name>NewMessageDialog</name>
    </context>
<context>
    <name>NewWhitelistDialog</name>
    </context>
<context>
    <name>OfferAcceptDialog</name>
    </context>
<context>
    <name>OfferAcceptDialogBTC</name>
    </context>
<context>
    <name>OfferAcceptDialogZEC</name>
    </context>
<context>
    <name>OfferAcceptInfoDialog</name>
    </context>
<context>
    <name>OfferAcceptTableModel</name>
    </context>
<context>
    <name>OfferEscrowDialog</name>
    </context>
<context>
    <name>OfferFeedbackDialog</name>
    </context>
<context>
    <name>OfferListPage</name>
    </context>
<context>
    <name>OfferPayDialog</name>
    </context>
<context>
    <name>OfferTableModel</name>
    </context>
<context>
    <name>OfferView</name>
    </context>
<context>
    <name>OfferWhitelistTableModel</name>
    </context>
<context>
    <name>OpenURIDialog</name>
    </context>
<context>
    <name>OptionsDialog</name>
    </context>
<context>
    <name>OptionsModel</name>
    </context>
<context>
    <name>OutMessageListPage</name>
    <message>
        <source>Comma separated file (*.csv)</source>
        <translation>Fichier séparé par une virgule (*.csv)</translation>
    </message>
    </context>
<context>
    <name>OverviewPage</name>
    </context>
<context>
    <name>PaymentServer</name>
    </context>
<context>
    <name>PeerTableModel</name>
    </context>
<context>
    <name>QObject</name>
    </context>
<context>
    <name>QRImageWidget</name>
    </context>
<context>
    <name>RPCConsole</name>
    </context>
<context>
    <name>ReceiveCoinsDialog</name>
    </context>
<context>
    <name>ReceiveRequestDialog</name>
    <message>
        <source>Address</source>
        <translation>Adresse</translation>
    </message>
    <message>
        <source>Label</source>
        <translation>Libellé</translation>
    </message>
    </context>
<context>
    <name>RecentRequestsTableModel</name>
    <message>
        <source>Label</source>
        <translation>Libellé</translation>
    </message>
    <message>
        <source>(no label)</source>
        <translation>(pas de libellé)</translation>
    </message>
    </context>
<context>
    <name>ResellOfferDialog</name>
    </context>
<context>
    <name>SendCoinsDialog</name>
    <message>
        <source>(no label)</source>
        <translation>(pas de libellé)</translation>
    </message>
</context>
<context>
    <name>SendCoinsEntry</name>
    </context>
<context>
    <name>SendConfirmationDialog</name>
    </context>
<context>
    <name>ShutdownWindow</name>
    </context>
<context>
    <name>SignRawTxDialog</name>
    </context>
<context>
    <name>SignVerifyMessageDialog</name>
    </context>
<context>
    <name>SplashScreen</name>
    </context>
<context>
    <name>PresidentielcoinGUI</name>
    </context>
<context>
    <name>TrafficGraphWidget</name>
    </context>
<context>
    <name>TransactionDesc</name>
    </context>
<context>
    <name>TransactionDescDialog</name>
    </context>
<context>
    <name>TransactionTableModel</name>
    <message>
        <source>Label</source>
        <translation>Libellé</translation>
    </message>
    <message>
        <source>(no label)</source>
        <translation>(pas de libellé)</translation>
    </message>
    </context>
<context>
    <name>TransactionView</name>
    <message>
        <source>Copy address</source>
        <translation>Copier l'adresse </translation>
    </message>
    <message>
        <source>Comma separated file (*.csv)</source>
        <translation>Fichier séparé par une virgule (*.csv)</translation>
    </message>
    <message>
        <source>Label</source>
        <translation>Libellé</translation>
    </message>
    <message>
        <source>Address</source>
        <translation>Adresse</translation>
    </message>
    </context>
<context>
    <name>UnitDisplayStatusBarControl</name>
    </context>
<context>
    <name>WalletFrame</name>
    </context>
<context>
    <name>WalletModel</name>
    </context>
<context>
    <name>WalletView</name>
    </context>
<context>
    <name>presidentielcoin-core</name>
    </context>
</TS>


text:
package org.eclipse.jdt.internal.ui.javaeditor.breadcrumb;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.MenuDetectEvent;
import org.eclipse.swt.events.MenuDetectListener;
import org.eclipse.swt.events.TraverseEvent;
import org.eclipse.swt.events.TraverseListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Widget;

import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.ListenerList;

import org.eclipse.jface.viewers.CellLabelProvider;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.OpenEvent;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.ViewerCell;

import org.eclipse.ui.forms.FormColors;

/**
 * A breadcrumb viewer shows a the parent chain of its input element in a list. Each breadcrumb item
 * of that list can be expanded and a sibling of the element presented by the breadcrumb item can be
 * selected.
 *

 * Content providers for breadcrumb viewers must implement the ITreeContentProvider
 * interface.
 *

 *

 * Label providers for breadcrumb viewers must implement the ILabelProvider interface.
 *

 *
 * @since 3.4
 */
public abstract class BreadcrumbViewer extends StructuredViewer {

	private static final boolean IS_GTK= "gtk".equals(SWT.getPlatform()); //$NON-NLS-1$

	private final Composite fContainer;
	private final ArrayList<BreadcrumbItem> fBreadcrumbItems;
	private final ListenerList fMenuListeners;

	private Image fGradientBackground;
	private BreadcrumbItem fSelectedItem;
	private ILabelProvider fToolTipLabelProvider;

	/**
	 * Create a new BreadcrumbViewer.
	 *

	 * Style is one of:
	 *

	 *
SWT.NONE

	 *
SWT.VERTICAL

	 *
SWT.HORIZONTAL

	 *

	 *
	 * @param parent the container for the viewer
	 * @param style the style flag used for this viewer
	 */
	public BreadcrumbViewer(Composite parent, int style) {
		fBreadcrumbItems= new ArrayList<BreadcrumbItem>();
		fMenuListeners= new ListenerList();

		fContainer= new Composite(parent, SWT.NONE);
		GridData layoutData= new GridData(SWT.FILL, SWT.TOP, true, false);
		fContainer.setLayoutData(layoutData);
		fContainer.addTraverseListener(new TraverseListener() {
			public void keyTraversed(TraverseEvent e) {
				e.doit= true;
			}
		});
		fContainer.setBackgroundMode(SWT.INHERIT_DEFAULT);

		fContainer.addListener(SWT.Resize, new Listener() {
			public void handleEvent(Event event) {
				int height= fContainer.getClientArea().height;

				if (fGradientBackground == null || fGradientBackground.getBounds().height != height) {
					Image image= height == 0 ? null : createGradientImage(height, event.display);
					fContainer.setBackgroundImage(image);

					if (fGradientBackground != null)
						fGradientBackground.dispose();
					fGradientBackground= image;
				}
			}
		});

		hookControl(fContainer);

		int columns= 1000;
		if ((SWT.VERTICAL & style) != 0) {
			columns= 1;
		}

		GridLayout gridLayout= new GridLayout(columns, false);
		gridLayout.marginWidth= 0;
		gridLayout.marginHeight= 0;
		gridLayout.verticalSpacing= 0;
		gridLayout.horizontalSpacing= 0;
		fContainer.setLayout(gridLayout);

		fContainer.addListener(SWT.Resize, new Listener() {
			public void handleEvent(Event event) {
				refresh();
			}
		});
	}

	/**
	 * Configure the given drop down viewer. The given input is used for the viewers input. Clients
	 * must at least set the label and the content provider for the viewer.
	 *
	 * @param viewer the viewer to configure
	 * @param input the input for the viewer
	 */
	protected abstract void configureDropDownViewer(TreeViewer viewer, Object input);

	/**
	 * The tool tip to use for the tool tip labels. null if the viewers label provider
	 * should be used.
	 *
	 * @param toolTipLabelProvider the label provider for the tool tips or null
	 */
	public void setToolTipLabelProvider(ILabelProvider toolTipLabelProvider) {
		fToolTipLabelProvider= toolTipLabelProvider;
	}

	/*
	 * @see org.eclipse.jface.viewers.Viewer#getControl()
	 */
	@Override
	public Control getControl() {
		return fContainer;
	}

	/*
	 * @see org.eclipse.jface.viewers.StructuredViewer#getRoot()
	 */
	@Override
	protected Object getRoot() {
		if (fBreadcrumbItems.isEmpty())
			return null;

		return fBreadcrumbItems.get(0).getData();
	}

	/*
	 * @see org.eclipse.jface.viewers.StructuredViewer#reveal(java.lang.Object)
	 */
	@Override
	public void reveal(Object element) {
		//all elements are always visible
	}

	/**
	 * Transfers the keyboard focus into the viewer.
	 */
	public void setFocus() {
		fContainer.setFocus();

		if (fSelectedItem != null) {
			fSelectedItem.setFocus(true);
		} else {
			if (fBreadcrumbItems.size() == 0)
				return;

			BreadcrumbItem item= fBreadcrumbItems.get(fBreadcrumbItems.size() - 1);
			if (item.getData() == null) {
				if (fBreadcrumbItems.size() < 2)
					return;

				item= fBreadcrumbItems.get(fBreadcrumbItems.size() - 2);
			}
			item.setFocus(true);
		}
	}

	/**
	 * @return true if any of the items in the viewer is expanded
	 */
	public boolean isDropDownOpen() {
		for (int i= 0, size= fBreadcrumbItems.size(); i < size; i++) {
			BreadcrumbItem item= fBreadcrumbItems.get(i);
			if (item.isMenuShown())
				return true;
		}

		return false;
	}

	/**
	 * The shell used for the shown drop down or null
	 * if no drop down is shown at the moment.
	 *
	 * @return the drop downs shell or null
	 */
	public Shell getDropDownShell() {
		for (int i= 0, size= fBreadcrumbItems.size(); i < size; i++) {
			BreadcrumbItem item= fBreadcrumbItems.get(i);
			if (item.isMenuShown())
				return item.getDropDownShell();
		}

		return null;
	}

	/**
	 * Returns the selection provider which provides the selection of the drop down currently opened
	 * or null if no drop down is open at the moment.
	 *
	 * @return the selection provider of the open drop down or null
	 */
	public ISelectionProvider getDropDownSelectionProvider() {
		for (int i= 0, size= fBreadcrumbItems.size(); i < size; i++) {
			BreadcrumbItem item= fBreadcrumbItems.get(i);
			if (item.isMenuShown()) {
				return item.getDropDownSelectionProvider();
			}
		}

		return null;
	}

	/**
	 * Add the given listener to the set of listeners which will be informed
	 * when a context menu is requested for a breadcrumb item.
	 *
	 * @param listener the listener to add
	 */
	public void addMenuDetectListener(MenuDetectListener listener) {
		fMenuListeners.add(listener);
	}

	/**
	 * Remove the given listener from the set of menu detect listeners.
	 * Does nothing if the listener is not element of the set.
	 *
	 * @param listener the listener to remove
	 */
	public void removeMenuDetectListener(MenuDetectListener listener) {
		fMenuListeners.remove(listener);
	}

	/*
	 * @see org.eclipse.jface.viewers.StructuredViewer#assertContentProviderType(org.eclipse.jface.viewers.IContentProvider)
	 */
	@Override
	protected void assertContentProviderType(IContentProvider provider) {
		super.assertContentProviderType(provider);
		Assert.isTrue(provider instanceof ITreeContentProvider);
	}

	/*
	 * @see org.eclipse.jface.viewers.Viewer#inputChanged(java.lang.Object, java.lang.Object)
	 */
	@Override
	protected void inputChanged(Object fInput, Object oldInput) {
		if (fContainer.isDisposed())
			return;

		disableRedraw();
		try {
			if (fBreadcrumbItems.size() > 0) {
				BreadcrumbItem last= fBreadcrumbItems.get(fBreadcrumbItems.size() - 1);
				last.setIsLastItem(false);
			}

			int lastIndex= buildItemChain(fInput);

			if (lastIndex > 0) {
				BreadcrumbItem last= fBreadcrumbItems.get(lastIndex - 1);
				last.setIsLastItem(true);
			}

			while (lastIndex < fBreadcrumbItems.size()) {
				BreadcrumbItem item= fBreadcrumbItems.remove(fBreadcrumbItems.size() - 1);
				if (item == fSelectedItem) {
					selectItem(null);
				}
				if (item.getData() != null)
					unmapElement(item.getData());
				item.dispose();
			}

			updateSize();
			fContainer.layout(true, true);
		} finally {
			enableRedraw();
		}
	}

	/*
	 * @see org.eclipse.jface.viewers.StructuredViewer#doFindInputItem(java.lang.Object)
	 */
	@Override
	protected Widget doFindInputItem(Object element) {
		if (element == null)
			return null;

		if (element == getInput() || element.equals(getInput()))
			return doFindItem(element);

		return null;
	}

	/*
	 * @see org.eclipse.jface.viewers.StructuredViewer#doFindItem(java.lang.Object)
	 */
	@Override
	protected Widget doFindItem(Object element) {
		if (element == null)
			return null;

		for (int i= 0, size= fBreadcrumbItems.size(); i < size; i++) {
			BreadcrumbItem item= fBreadcrumbItems.get(i);
			if (item.getData() == element || element.equals(item.getData()))
				return item;
		}

		return null;
	}

	/*
	 * @see org.eclipse.jface.viewers.StructuredViewer#doUpdateItem(org.eclipse.swt.widgets.Widget, java.lang.Object, boolean)
	 */
	@Override
	protected void doUpdateItem(Widget widget, Object element, boolean fullMap) {
		if (widget instanceof BreadcrumbItem) {
			final BreadcrumbItem item= (BreadcrumbItem) widget;

			// remember element we are showing
			if (fullMap) {
				associate(element, item);
			} else {
				Object data= item.getData();
				if (data != null) {
					unmapElement(data, item);
				}
				item.setData(element);
				mapElement(element, item);
			}

			BreadcrumbViewerRow row= new BreadcrumbViewerRow(this, item);
			ViewerCell cell= row.getCell(0);

			((CellLabelProvider) getLabelProvider()).update(cell);

			item.refreshArrow();

			if (fToolTipLabelProvider != null) {
				item.setToolTip(fToolTipLabelProvider.getText(item.getData()));
			} else {
				item.setToolTip(cell.getText());
			}
		}
	}

	/*
	 * @see org.eclipse.jface.viewers.StructuredViewer#getSelectionFromWidget()
	 */
	@Override
	protected List getSelectionFromWidget() {
		if (fSelectedItem == null)
			return Collections.EMPTY_LIST;

		if (fSelectedItem.getData() == null)
			return Collections.EMPTY_LIST;

		ArrayList<Object> result= new ArrayList<Object>();
		result.add(fSelectedItem.getData());
		return result;
	}

	/*
	 * @see org.eclipse.jface.viewers.StructuredViewer#internalRefresh(java.lang.Object)
	 */
	@Override
	protected void internalRefresh(Object element) {

		disableRedraw();
		try {
			BreadcrumbItem item= (BreadcrumbItem) doFindItem(element);
			if (item == null) {
				for (int i= 0, size= fBreadcrumbItems.size(); i < size; i++) {
					BreadcrumbItem item1= fBreadcrumbItems.get(i);
					item1.refresh();
				}
			} else {
				item.refresh();
			}
			if (updateSize())
				fContainer.layout(true, true);
		} finally {
			enableRedraw();
		}
	}

	/*
	 * @see org.eclipse.jface.viewers.StructuredViewer#setSelectionToWidget(java.util.List, boolean)
	 */
	@Override
	protected void setSelectionToWidget(List l, boolean reveal) {
		BreadcrumbItem focusItem= null;

		for (int i= 0, size= fBreadcrumbItems.size(); i < size; i++) {
			BreadcrumbItem item= fBreadcrumbItems.get(i);
			if (item.hasFocus())
				focusItem= item;

			item.setSelected(false);
		}

		if (l == null)
			return;

		for (Iterator<?> iterator= l.iterator(); iterator.hasNext();) {
			Object element= iterator.next();
			BreadcrumbItem item= (BreadcrumbItem) doFindItem(element);
			if (item != null) {
				item.setSelected(true);
				fSelectedItem= item;
				if (item == focusItem) {
					item.setFocus(true);
				}
			}
		}
	}

	/**
	 * Set a single selection to the given item. null to deselect all.
	 *
	 * @param item the item to select or null
	 */
	void selectItem(BreadcrumbItem item) {
		if (fSelectedItem != null)
			fSelectedItem.setSelected(false);

		fSelectedItem= item;
		setSelectionToWidget(getSelection(), false);

		if (item != null) {
			setFocus();
		} else {
			for (int i= 0, size= fBreadcrumbItems.size(); i < size; i++) {
				BreadcrumbItem listItem= fBreadcrumbItems.get(i);
				listItem.setFocus(false);
			}
		}

		fireSelectionChanged(new SelectionChangedEvent(this, getSelection()));
	}

	/**
	 * Returns the item count.
	 *
	 * @return number of items shown in the viewer
	 */
	int getItemCount() {
		return fBreadcrumbItems.size();
	}

	/**
	 * Returns the item for the given item index.
	 *
	 * @param index the index of the item
	 * @return the item ad the given index
	 */
	BreadcrumbItem getItem(int index) {
		return fBreadcrumbItems.get(index);
	}

	/**
	 * Returns the index of the given item.
	 *
	 * @param item the item to search
	 * @return the index of the item or -1 if not found
	 */
	int getIndexOfItem(BreadcrumbItem item) {
		for (int i= 0, size= fBreadcrumbItems.size(); i < size; i++) {
			BreadcrumbItem pItem= fBreadcrumbItems.get(i);
			if (pItem == item)
				return i;
		}

		return -1;
	}

	/**
	 * Notifies all double click listeners.
	 */
	void fireDoubleClick() {
		fireDoubleClick(new DoubleClickEvent(this, getSelection()));
	}

	/**
	 * Notifies all open listeners.
	 */
	void fireOpen() {
		fireOpen(new OpenEvent(this, getSelection()));
	}

	/**
	 * The given element was selected from a drop down menu.
	 *
	 * @param element the selected element
	 */
	void fireMenuSelection(Object element) {
		fireOpen(new OpenEvent(this, new StructuredSelection(element)));
	}

	/**
	 * A context menu has been requested for the selected breadcrumb item.
	 *
	 * @param event the event issued the menu detection
	 */
	void fireMenuDetect(MenuDetectEvent event) {
		Object[] listeners= fMenuListeners.getListeners();
		for (int i= 0; i < listeners.length; i++) {
			((MenuDetectListener)listeners[i]).menuDetected(event);
		}
	}

	/**
	 * Set selection to the next or previous element if possible.
	 *
	 * @param next true if the next element should be selected, otherwise the previous
	 *            one will be selected
	 */
	void doTraverse(boolean next) {
		if (fSelectedItem == null)
			return;

		int index= fBreadcrumbItems.indexOf(fSelectedItem);
		if (next) {
			if (index == fBreadcrumbItems.size() - 1) {
				BreadcrumbItem current= fBreadcrumbItems.get(index);

				ITreeContentProvider contentProvider= (ITreeContentProvider) getContentProvider();
				if (!contentProvider.hasChildren(current.getData()))
					return;

				current.openDropDownMenu();
				current.getDropDownShell().setFocus();
			} else {
				BreadcrumbItem nextItem= fBreadcrumbItems.get(index + 1);
				selectItem(nextItem);
			}
		} else {
			if (index == 1) {
				BreadcrumbItem root= fBreadcrumbItems.get(0);
				root.openDropDownMenu();
				root.getDropDownShell().setFocus();
			} else {
				selectItem(fBreadcrumbItems.get(index - 1));
			}
		}
	}

	/**
	 * Generates the parent chain of the given element.
	 *
	 * @param element element to build the parent chain for
	 * @return the first index of an item in fBreadcrumbItems which is not part of the chain
	 */
	private int buildItemChain(Object element) {
		if (element == null)
			return 0;

		ITreeContentProvider contentProvider= (ITreeContentProvider) getContentProvider();
		Object parent= contentProvider.getParent(element);

		int index= buildItemChain(parent);

		BreadcrumbItem item;
		if (index < fBreadcrumbItems.size()) {
			item= fBreadcrumbItems.get(index);
			if (item.getData() != null)
				unmapElement(item.getData());
		} else {
			item= createItem();
			fBreadcrumbItems.add(item);
		}

		if (equals(element, item.getData())) {
			update(element, null);
		} else {
			item.setData(element);
			item.refresh();
		}
		if (parent == null) {
			//don't show the models root
			item.setDetailsVisible(false);
		}

		mapElement(element, item);

		return index + 1;
	}

	/**
	 * Creates and returns a new instance of a breadcrumb item.
	 *
	 * @return new instance of a breadcrumb item
	 */
	private BreadcrumbItem createItem() {
		BreadcrumbItem result= new BreadcrumbItem(this, fContainer);

		result.setLabelProvider((ILabelProvider) getLabelProvider());
		if (fToolTipLabelProvider != null) {
			result.setToolTipLabelProvider(fToolTipLabelProvider);
		} else {
			result.setToolTipLabelProvider((ILabelProvider) getLabelProvider());
		}
		result.setContentProvider((ITreeContentProvider) getContentProvider());

		return result;
	}

	/**
	 * Update the size of the items such that all items are visible, if possible.
	 *
	 * @return true if any item has changed, false otherwise
	 */
	private boolean updateSize() {
		int width= fContainer.getClientArea().width;

		int currentWidth= getCurrentWidth();

		boolean requiresLayout= false;

		if (currentWidth > width) {
			int index= 0;
			while (currentWidth > width && index < fBreadcrumbItems.size() - 1) {
				BreadcrumbItem viewer= fBreadcrumbItems.get(index);
				if (viewer.isShowText()) {
					viewer.setShowText(false);
					currentWidth= getCurrentWidth();
					requiresLayout= true;
				}

				index++;
			}

		} else if (currentWidth < width) {

			int index= fBreadcrumbItems.size() - 1;
			while (currentWidth < width && index >= 0) {

				BreadcrumbItem viewer= fBreadcrumbItems.get(index);
				if (!viewer.isShowText()) {
					viewer.setShowText(true);
					currentWidth= getCurrentWidth();
					if (currentWidth > width) {
						viewer.setShowText(false);
						index= 0;
					} else {
						requiresLayout= true;
					}
				}

				index--;
			}
		}

		return requiresLayout;
	}

	/**
	 * Returns the current width of all items in the list.
	 *
	 * @return the width of all items in the list
	 */
	private int getCurrentWidth() {
		int result= 0;
		for (int i= 0, size= fBreadcrumbItems.size(); i < size; i++) {
			BreadcrumbItem viewer= fBreadcrumbItems.get(i);
			result+= viewer.getWidth();
		}

		return result;
	}

	/**
	 * Enables redrawing of the breadcrumb.
	 */
	private void enableRedraw() {
		if (IS_GTK) //flickers on GTK
			return;

		fContainer.setRedraw(true);
	}

	/**
	 * Disables redrawing of the breadcrumb.
	 *
	 *

	 * A call to this method must be followed by a call to {@link #enableRedraw()}
	 *

	 */
	private void disableRedraw() {
		if (IS_GTK) //flickers on GTK
			return;

		fContainer.setRedraw(false);
	}

	/**
	 * The image to use for the breadcrumb background as specified in
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=221477
	 *
	 * @param height the height of the image to create
	 * @param display the current display
	 * @return the image for the breadcrumb background
	 */
	private Image createGradientImage(int height, Display display) {
		int width= 50;

		Image result= new Image(display, width, height);

		GC gc= new GC(result);

		Color colorC= createColor(SWT.COLOR_WIDGET_BACKGROUND, SWT.COLOR_LIST_BACKGROUND, 35, display);
		Color colorD= createColor(SWT.COLOR_WIDGET_BACKGROUND, SWT.COLOR_LIST_BACKGROUND, 45, display);
		Color colorE= createColor(SWT.COLOR_WIDGET_BACKGROUND, SWT.COLOR_LIST_BACKGROUND, 80, display);
		Color colorF= createColor(SWT.COLOR_WIDGET_BACKGROUND, SWT.COLOR_LIST_BACKGROUND, 70, display);
		Color colorG= createColor(SWT.COLOR_WIDGET_BACKGROUND, SWT.COLOR_WHITE, 45, display);
		Color colorH= createColor(SWT.COLOR_WIDGET_NORMAL_SHADOW, SWT.COLOR_LIST_BACKGROUND, 35, display);

		try {
			drawLine(width, 0, colorC, gc);
			drawLine(width, 1, colorC, gc);

			gc.setForeground(colorD);
			gc.setBackground(colorE);
			gc.fillGradientRectangle(0, 2, width, 2 + 8, true);

			gc.setBackground(colorE);
			gc.fillRectangle(0, 2 + 9, width, height - 4);

			drawLine(width, height - 3, colorF, gc);
			drawLine(width, height - 2, colorG, gc);
			drawLine(width, height - 1, colorH, gc);

		} finally {
			gc.dispose();

			colorC.dispose();
			colorD.dispose();
			colorE.dispose();
			colorF.dispose();
			colorG.dispose();
			colorH.dispose();
		}

		return result;
	}

	private void drawLine(int width, int position, Color color, GC gc) {
		gc.setForeground(color);
		gc.drawLine(0, position, width, position);
	}

	private Color createColor(int color1, int color2, int ratio, Display display) {
		RGB rgb1= display.getSystemColor(color1).getRGB();
		RGB rgb2= display.getSystemColor(color2).getRGB();

		RGB blend= FormColors.blend(rgb2, rgb1, ratio);

		return new Color(display, blend);
	}

	/*
	 * @see org.eclipse.jface.viewers.StructuredViewer#handleDispose(org.eclipse.swt.events.DisposeEvent)
	 * @since 3.6.1
	 */
	@Override
	protected void handleDispose(DisposeEvent event) {
		if (fGradientBackground != null) {
			fGradientBackground.dispose();
			fGradientBackground= null;
		}

		if (fToolTipLabelProvider != null) {
			fToolTipLabelProvider.dispose();
			fToolTipLabelProvider= null;
		}

		if (fBreadcrumbItems != null) {
			Iterator<BreadcrumbItem> iterator= fBreadcrumbItems.iterator();
			while (iterator.hasNext()) {
				BreadcrumbItem item= iterator.next();
				item.dispose();
			}
		}

		super.handleDispose(event);
	}
}

redpajama_set_name: RedPajamaGithub


text:
import EventEmitter from 'events'
import { client } from '../client'
import { Client as RpcClient } from '../../../rpc/client'
import { actions as RobotActions } from '../../actions'
import * as ProtocolSelectors from '../../../protocol/selectors'
import * as DiscoverySelectors from '../../../discovery/selectors'
import * as LabwareSelectors from '../../../custom-labware/selectors'
import * as RobotSelectors from '../../selectors'
import { MockSession } from '../../test/__fixtures__/session'

jest.mock('../../../rpc/client')
jest.mock('../../../protocol/selectors')
jest.mock('../../../discovery/selectors')
jest.mock('../../../custom-labware/selectors')
jest.mock('../../selectors')

const mockState = { state: true }
const mockRobot = { name: 'robot-name', ip: '127.0.0.1', port: 31950 }

describe('RPC API client - session creation', () => {
  let mockRpcClient
  let mockSessionManager
  let mockDispatch
  let sendToClient

  beforeEach(() => {
    mockSessionManager = {
      session: null,
      clear: jest.fn(),
      create: jest.fn(),
      // added in API v3.15
      create_from_bundle: jest.fn(),
      // added in API v3.15
      create_with_extra_labware: jest.fn(),
    }

    mockRpcClient = Object.assign(new EventEmitter(), {
      close: jest.fn(),
      remote: { session_manager: mockSessionManager },
    })

    mockDispatch = jest.fn()

    RpcClient.mockResolvedValue(mockRpcClient)
    DiscoverySelectors.getConnectableRobots.mockReturnValue([mockRobot])
    LabwareSelectors.getCustomLabwareDefinitions.mockReturnValue([])
    RobotSelectors.getConnectRequest.mockReturnValue({ inProgress: false })

    const _receive = client(mockDispatch)
    const _flush = () => new Promise(resolve => setTimeout(resolve, 0))

    sendToClient = action => {
      _receive(mockState, action)
      return _flush()
    }

    return sendToClient(RobotActions.connect(mockRobot.name))
  })

  afterEach(() => {
    jest.resetAllMocks()
  })

  it('calls session_manager.create on protocol:UPLOAD', () => {
    const mockProtocolFile = { name: 'protocol.py' }
    const mockSession = MockSession()

    ProtocolSelectors.getProtocolFile.mockReturnValue(mockProtocolFile)
    mockSessionManager.create.mockResolvedValue(mockSession)

    return sendToClient({
      type: 'protocol:UPLOAD',
      payload: { contents: '# protocol', data: null },
      meta: { robot: true },
    }).then(() => {
      expect(ProtocolSelectors.getProtocolFile).toHaveBeenCalledWith(mockState)
      expect(mockSessionManager.create).toHaveBeenCalledWith(
        mockProtocolFile.name,
        '# protocol'
      )
    })
  })

  it('calls session_manager.create_from_bundle if zip protocol', () => {
    const mockProtocolFile = { name: 'protocol.zip', type: 'zip' }
    const mockSession = MockSession()

    ProtocolSelectors.getProtocolFile.mockReturnValue(mockProtocolFile)
    mockSessionManager.create_from_bundle.mockResolvedValue(mockSession)

    return sendToClient({
      type: 'protocol:UPLOAD',
      payload: { contents: 'binary-data', data: null },
      meta: { robot: true },
    }).then(() => {
      expect(mockSessionManager.create_from_bundle).toHaveBeenCalledWith(
        mockProtocolFile.name,
        'binary-data'
      )
    })
  })

  it('calls create with third param if zip and create_from_bundle not available', () => {
    const mockProtocolFile = { name: 'protocol.zip', type: 'zip' }
    const mockSession = MockSession()

    delete mockSessionManager.create_from_bundle

    ProtocolSelectors.getProtocolFile.mockReturnValue(mockProtocolFile)
    mockSessionManager.create.mockResolvedValue(mockSession)

    return sendToClient({
      type: 'protocol:UPLOAD',
      payload: { contents: 'binary-data', data: null },
      meta: { robot: true },
    }).then(() => {
      expect(mockSessionManager.create).toHaveBeenCalledWith(
        mockProtocolFile.name,
        'binary-data',
        true
      )
    })
  })

  it('calls create_with_extra_labware if python protocol and custom labware exist', () => {
    const mockProtocolFile = { name: 'protocol.py', type: 'python' }
    const mockSession = MockSession()

    ProtocolSelectors.getProtocolFile.mockReturnValue(mockProtocolFile)
    LabwareSelectors.getCustomLabwareDefinitions.mockReturnValue([
      { mockLabware: 1 },
      { mockLabware: 2 },
    ])
    mockSessionManager.create_with_extra_labware.mockResolvedValue(mockSession)

    return sendToClient({
      type: 'protocol:UPLOAD',
      payload: { contents: '# protocol', data: null },
      meta: { robot: true },
    }).then(() => {
      expect(mockSessionManager.create_with_extra_labware).toHaveBeenCalledWith(
        mockProtocolFile.name,
        '# protocol',
        [{ v: { mockLabware: 1 } }, { v: { mockLabware: 2 } }]
      )
    })
  })

  it('calls create if custom labware but create_with_extra_labware not available', () => {
    const mockProtocolFile = { name: 'protocol.py', type: 'python' }
    const mockSession = MockSession()

    delete mockSessionManager.create_with_extra_labware

    ProtocolSelectors.getProtocolFile.mockReturnValue(mockProtocolFile)
    LabwareSelectors.getCustomLabwareDefinitions.mockReturnValue([
      { mockLabware: 1 },
      { mockLabware: 2 },
    ])
    mockSessionManager.create.mockResolvedValue(mockSession)

    return sendToClient({
      type: 'protocol:UPLOAD',
      payload: { contents: '# protocol', data: null },
      meta: { robot: true },
    }).then(() => {
      expect(mockSessionManager.create).toHaveBeenCalledWith(
        mockProtocolFile.name,
        '# protocol'
      )
    })
  })

  it('calls create if custom labware but protocol is JSON', () => {
    const mockProtocolFile = { name: 'protocol.json', type: 'json' }
    const mockSession = MockSession()

    ProtocolSelectors.getProtocolFile.mockReturnValue(mockProtocolFile)
    LabwareSelectors.getCustomLabwareDefinitions.mockReturnValue([
      { mockLabware: 1 },
      { mockLabware: 2 },
    ])
    mockSessionManager.create.mockResolvedValue(mockSession)

    return sendToClient({
      type: 'protocol:UPLOAD',
      payload: { contents: '{}', data: {} },
      meta: { robot: true },
    }).then(() => {
      expect(mockSessionManager.create).toHaveBeenCalledWith(
        mockProtocolFile.name,
        '{}'
      )
    })
  })

  it('dispatches session response with error if create throws', () => {
    const mockProtocolFile = { name: 'protocol.py', type: 'python' }

    ProtocolSelectors.getProtocolFile.mockReturnValue(mockProtocolFile)
    mockSessionManager.create.mockRejectedValue(new Error('AH'))

    return sendToClient({
      type: 'protocol:UPLOAD',
      payload: { contents: '{}', data: {} },
      meta: { robot: true },
    }).then(() => {
      expect(mockDispatch).toHaveBeenCalledWith(
        RobotActions.sessionResponse(new Error('AH'), null, true)
      )
    })
  })

  it('dispatches helpful error response with if create throws with bundle', () => {
    const mockProtocolFile = { name: 'protocol.zip', type: 'zip' }
    const mockError = Object.assign(
      new Error(
        'TypeError: create() takes 3 positional arguments but 4 were given'
      ),
      {
        methodName: 'create',
      }
    )

    delete mockSessionManager.create_from_bundle

    ProtocolSelectors.getProtocolFile.mockReturnValue(mockProtocolFile)
    mockSessionManager.create.mockRejectedValue(mockError)

    return sendToClient({
      type: 'protocol:UPLOAD',
      payload: { contents: 'binary-data', data: null },
      meta: { robot: true },
    }).then(() => {
      expect(mockDispatch).toHaveBeenCalledWith(
        RobotActions.sessionResponse(
          expect.objectContaining({
            message: expect.stringMatching(
              /does not support ZIP protocol bundles/
            ),
          }),
          null,
          true
        )
      )
    })
  })
})


text:
package org.camunda.bpm.spring.boot.starter.rest.spi;

import java.util.Set;

import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.engine.ProcessEngines;
import org.camunda.bpm.engine.rest.spi.ProcessEngineProvider;

public class SpringBootProcessEngineProvider implements ProcessEngineProvider {

  @Override
  public ProcessEngine getDefaultProcessEngine() {
    return ProcessEngines.getDefaultProcessEngine();
  }

  @Override
  public ProcessEngine getProcessEngine(String name) {
    return ProcessEngines.getProcessEngine(name);
  }

  @Override
  public Set<String> getProcessEngineNames() {
    return ProcessEngines.getProcessEngines().keySet();
  }

}


text:
<!DOCTYPE html>
<meta charset=utf-8>
<title>invalid srcset-microsyntax-negative-x</title>
<img srcset='x -1x' src=x alt>


text:
namespace Tests.Dto
{
    public class TestDto
    {
        public int IntField;
        public int intField;
        public string String;
        public string[] StringArray;
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- From: file:/D:/GitRepository/love/love/sdk/pulltorefresh/build/intermediates/bundles/debug/res/values-ro/values.xml -->
    <eat-comment/>
    <string name="pull_to_refresh_pull_label">Trage pentru a reîmprospăta…</string>
    <string name="pull_to_refresh_refreshing_label">Încărcare…</string>
    <string name="pull_to_refresh_release_label">Eliberează pentru a reîmprospăta…</string>
</resources>


text:
using System.Collections.Generic;
using System.Threading.Tasks;
using RestSharp;

namespace EasyPost
{
    public class Order : EasyPostObject
    {
        /// <summary>
        /// The destination address
        /// </summary>
        public Address ToAddress { get; set; }

        /// <summary>
        /// The origin address
        /// </summary>
        public Address FromAddress { get; set; }

        /// <summary>
        /// The shipper's address, defaults to from_address
        /// </summary>
        public Address ReturnAddress { get; set; }

        /// <summary>
        /// The buyer's address, defaults to to_address
        /// </summary>
        public Address BuyerAddress { get; set; }

        /// <summary>
        /// All associated Shipment objects
        /// </summary>
        public List<Shipment> Shipments { get; set; }

        /// <summary>
        /// All associated Rate objects
        /// </summary>
        public List<CarrierRate> Rates { get; set; }

        /// <summary>
        /// Any carrier errors encountered during rating
        /// </summary>
        public List<EasyPostMessage> Messages { get; set; }

        /// <summary>
        /// Set true to create as a return
        /// </summary>
        public bool? IsReturn { get; set; }

        /// <summary>
        /// Customs information
        /// </summary>
        public CustomsInfo CustomsInfo { get; set; }

        /// <summary>
        /// Carrier accounts
        /// </summary>
        public List<CarrierAccount> CarrierAccounts { get; set; }

        /// <summary>
        /// Containers
        /// </summary>
        public List<Container> Containers { get; set; }

        /// <summary>
        /// Items in the order
        /// </summary>
        public List<Item> Items { get; set; }
    }

    /// <summary>
    /// Order API implementation
    /// </summary>
    public partial class EasyPostClient
    {
        /// <summary>
        /// Retrieve a Order from its id or reference.
        /// </summary>
        /// <param name="id">String representing a Order. Starts with "order_" if passing an id.</param>
        /// <returns>Order instance.</returns>
        public async Task<Order> GetOrder(
            string id)
        {
            var request = new EasyPostRequest("orders/{id}");
            request.AddUrlSegment("id", id);

            return await Execute<Order>(request);
        }

        /// <summary>
        /// Create a Order.
        /// </summary>
        /// <param name="order">Order details</param>
        /// <returns>Order instance.</returns>
        public async Task<Order> CreateOrder(
            Order order)
        {
            var request = new EasyPostRequest("orders", Method.Post);
            request.AddBody(order.AsDictionary(), "order");

            return await Execute<Order>(request);
        }

        /// <summary>
        /// Purchase the shipments within this order with a carrier and service.
        /// </summary>
        /// <param name="id">Order id to buy</param>
        /// <param name="carrier">The carrier to purchase a shipment from.</param>
        /// <param name="service">The service to purchase.</param>
        /// <returns>Order instance.</returns>
        public async Task<Order> BuyOrder(
            string id,
            string carrier,
            string service)
        {
            var request = new EasyPostRequest("orders/{id}/buy", Method.Post);
            request.AddUrlSegment("id", id);
            request.AddBody(new List<KeyValuePair<string, string>>() {
                new KeyValuePair<string, string>("carrier", carrier),
                new KeyValuePair<string, string>("service", service)
            });

            return await Execute<Order>(request);
        }

        /// <summary>
        /// Purchase a label for this shipment with the given rate.
        /// </summary>
        /// <param name="id">Order id to buy</param>
        /// <param name="rate">Rate object to purchase the shipment with.</param>
        /// <returns>Order instance.</returns>
        public async Task<Order> BuyOrder(
            string id,
            CarrierRate rate)
        {
            return await BuyOrder(id, rate.Carrier, rate.Service);
        }
    }
}


text:
class AddAncestryToPostComments < ActiveRecord::Migration
  def change
    add_column :post_comments, :ancestry, :string
    add_index :post_comments, :ancestry
  end
end


text:
package jsystem.treeui.actionItems;

import jsystem.framework.scenario.ScenariosManager;
import jsystem.guiMapping.JsystemMapping;
import jsystem.treeui.TestRunner;
import jsystem.treeui.images.ImageCenter;
import org.jfree.util.Log;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

public class OpenScenarioAction extends IgnisAction {

	private static final long serialVersionUID = 1L;

	private static OpenScenarioAction action = null;

	private OpenScenarioAction(){
		super();
		putValue(Action.NAME, "Open Scenario");
		putValue(Action.SHORT_DESCRIPTION, JsystemMapping.getInstance().getOpenScenarioButton());
		putValue(Action.SMALL_ICON, ImageCenter.getInstance().getImage(ImageCenter.ICON_SCENARIO));
		putValue(Action.LARGE_ICON_KEY, ImageCenter.getInstance().getImage(ImageCenter.ICON_SCENARIO));
		putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_O, KeyEvent.CTRL_MASK));
		putValue(Action.ACTION_COMMAND_KEY, "open-scenario");
	}

	public static OpenScenarioAction getInstance(){
		if (action == null){
			action =  new OpenScenarioAction();
		}
		return action;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		int save_Ans = 0;
		try {
			save_Ans = SaveScenarioAction.getInstance().saveCurrentScenarioWithConfirmation();
		} catch (Exception e1) {
			Log.error(e1.getMessage());
		}
		if(save_Ans != JOptionPane.CANCEL_OPTION){
			boolean isOK = TestRunner.treeView.getTableController().switchScenario();
			if(save_Ans == JOptionPane.NO_OPTION && isOK){
				ScenariosManager.resetDirty();
			}
		}
        firePropertyChange(action.getClass().getSimpleName(),null,null);
	}

}


text:
using namespace std;

void displayFastestTime(const double[], const string[]);
void displayAverageTime(const double[]);
bool displayTimeByName(const double[], const string[]);
void displayTimes(const double[], const string[]);

// Declare global constants
const unsigned int SIZE = 5;

// Function main: asks for initial data then give the user a menu
int main()
{
    // Define Variables
    string skierName[SIZE];
    double skierTime[SIZE];
    int optionNumberUserChose;

    // Define Flags
    bool userWantsToQuit = false;

    // Set decimal precision and text alignment
    cout << setprecision(2) << fixed << left;

    // Ask for inital data
    cout << "Enter initial data in the format [Skier Name] [SPACE] [Skier Time] [ENTER]" << endl;
    for (unsigned short skiersEntered = 0; skiersEntered < SIZE; skiersEntered++)
    {
        // Get Skier's name
        cin >> skierName[skiersEntered];
        // Get Skier's time
        cin >> skierTime[skiersEntered];
    }

    // Insert Space
    cout << endl;

    // Begin menu loop
    while (!userWantsToQuit)
    {
        // Display menu
        cout << "Enter a number:" << endl <<
            "0. Quit the program" << endl <<
            "1. Determine the fastest skier" << endl <<
            "2. Calculate the average time" << endl <<
            "3. Search for a skier's time by name" << endl <<
            "4. Display the chart of skier times" << endl <<
            "Your Choice: ";
        // Get user input
        cin >> optionNumberUserChose;
        // Insert Space
        cout << endl;
        switch (optionNumberUserChose)
        {
            case 0:
                userWantsToQuit = true;
                break;
            case 1:
                displayFastestTime(skierTime, skierName);
                break;
            case 2:
                displayAverageTime(skierTime);
                break;
            case 3:
                displayTimeByName(skierTime, skierName);
                break;
            case 4:
                displayTimes(skierTime, skierName);
                break;
        }
    }

    cout << endl;
    system("pause");
    return 0;
}

// Function displayFastestTime: finds and displays the fastest time of the skiers
void displayFastestTime(const double skierTime[], const string skierName[])
{
    // Define Variables
    double fastestTime = skierTime[0];
    string fastestSkier = skierName[0];

    // Begin search
    for (unsigned short skiersSearched = 0; skiersSearched < SIZE; skiersSearched++)
    {
        if (skierTime[skiersSearched] < fastestTime)
        {
            fastestTime = skierTime[skiersSearched];
            fastestSkier = skierName[skiersSearched];
        }
    }

    // Display results
    cout << "The fastest skier is " << fastestSkier << " with a time of " <<
        fastestTime << endl << endl;
}
// Function displayAverageTime: calculates and displays the average time
void displayAverageTime(const double skierTime[])
{
    // Define variables
    double sumOfTimes = 0;
    double averageTime;

    // Begin calculations
    for (int numberOfTimesRead = 0; numberOfTimesRead < SIZE; numberOfTimesRead++)
        sumOfTimes += skierTime[numberOfTimesRead];
    averageTime = sumOfTimes / SIZE;

    // Display results
    cout << "The average time is " << averageTime << endl << endl;
}
// Function displayTimeByName: searches for a time with a name and displays that time
bool displayTimeByName(const double skierTime[], const string skierName[])
{
    // Define constants
    const bool SKIER_FOUND = true;
    const bool SKIER_NOT_FOUND = false;

    // Define variables
    string nameOfSkierWanted;
    double timeOfSkierWanted = 0.00;

    // Define flags
    bool skierFound;

    // Ask for the name to search with
    cout << "What is the name of the skier? ";
    cin >> nameOfSkierWanted;

    // Begin search
    for (int namesSearched = 0; namesSearched < SIZE; namesSearched++)
    {
        if (skierName[namesSearched] == nameOfSkierWanted)
        {
            timeOfSkierWanted = skierTime[namesSearched];
            break;
        }
    }

    // Display results
    if (timeOfSkierWanted)
    {
        cout << nameOfSkierWanted << "'s time was " << timeOfSkierWanted << endl << endl;
        skierFound = true;
        return SKIER_FOUND;
    }
    else
    {
        cout << nameOfSkierWanted << "'s time was not found." << endl << endl;
        skierFound = false;
        return SKIER_NOT_FOUND;
    }
}
// Function displayTimes: displays each skier's name and time
void displayTimes(const double skierTime[], const string skierName[])
{
    cout << "Skiers:" << endl;

    // Begin loop for each skier
    for (unsigned int skiersPrinted = 0; skiersPrinted < SIZE; skiersPrinted++)
        cout << setw(10) << skierName[skiersPrinted] << setw(10) << skierTime[skiersPrinted] << endl;

    // Insert Space
    cout << endl;
}


text:
'use strict';

var extend = require('cloneextend').extend;

/**
 * Represents a strategy that extends the configuration.
 *
 * @class
 */
function ExtendConfigStrategy (extendWith) {
  this.extendWith = extendWith;
}

ExtendConfigStrategy.prototype.process = function (config, callback) {
  extend(config, this.extendWith);
  callback(null, config);
};

module.exports = ExtendConfigStrategy;


text:
package org.opensaml.saml2.core.impl;

import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller;
import org.opensaml.saml2.core.NameID;
import org.opensaml.saml2.core.NameIDType;
import org.opensaml.xml.XMLObject;
import org.opensaml.xml.io.UnmarshallingException;
import org.w3c.dom.Attr;

/**
 * A thread-safe Unmarshaller for {@link org.opensaml.saml2.core.NameIDType} objects.
 */
public abstract class AbstractNameIDTypeUnmarshaller extends AbstractSAMLObjectUnmarshaller {

    /** Constructor. */
    protected AbstractNameIDTypeUnmarshaller() {
        super();
    }

    /**
     * Constructor.
     *
     * @param namespaceURI the namespace URI of either the schema type QName or element QName of the elements this
     *            unmarshaller operates on
     * @param elementLocalName the local name of either the schema type QName or element QName of the elements this
     *            unmarshaller operates on
     *
     * @throws NullPointerException if any of the arguments are null (or empty in the case of String parameters)
     */
    protected AbstractNameIDTypeUnmarshaller(String namespaceURI, String elementLocalName) {
        super(namespaceURI, elementLocalName);
    }

    /** {@inheritDoc} */
    protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
        NameIDType nameID = (NameIDType) samlObject;
        if (attribute.getLocalName().equals(NameID.NAME_QUALIFIER_ATTRIB_NAME)) {
            nameID.setNameQualifier(attribute.getValue());
        } else if (attribute.getLocalName().equals(NameID.SP_NAME_QUALIFIER_ATTRIB_NAME)) {
            nameID.setSPNameQualifier(attribute.getValue());
        } else if (attribute.getLocalName().equals(NameID.FORMAT_ATTRIB_NAME)) {
            nameID.setFormat(attribute.getValue());
        } else if (attribute.getLocalName().equals(NameID.SPPROVIDED_ID_ATTRIB_NAME)) {
            nameID.setSPProvidedID(attribute.getValue());
        } else {
            super.processAttribute(samlObject, attribute);
        }
    }

    /** {@inheritDoc} */
    protected void processElementContent(XMLObject samlObject, String elementContent) {
        NameIDType nameID = (NameIDType) samlObject;
        nameID.setValue(elementContent);
    }
}


text:
<?php
if(!defined('IN_INDEX')) exit;

$debug_mode = true;

$website_title = isset($settings['website_title']) ? $settings['website_title'] : 'phpSQLiteCMS';
$lang = isset($localization) ? Localization::$lang['lang'] : 'en';
$charset = isset($localization) && isset(Localization::$lang['charset']) ? Localization::$lang['charset'] : 'utf-8';
$exception_title = isset($localization) && isset(Localization::$lang['exception_title']) ? Localization::$lang['exception_title'] : 'Error';
$exception_message = isset($localization) && isset(Localization::$lang['exception_message']) ? Localization::$lang['exception_message'] : 'An error occurred while processing this directive.';

header($_SERVER['SERVER_PROTOCOL'] . " 503 Service Unavailable");
header("Status: 503 Service Unavailable");
header('Content-Type: text/html; charset='.$charset);

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $lang; ?>">

<title><?php echo $website_title; ?> - <?php echo $exception_title; ?></title>
<meta http-equiv="content-type" content="text/html; charset=<?php echo $charset; ?>" />

<?php echo $website_title; ?>

<?php echo $exception_title; ?>

<?php echo $exception_message; ?>

<?php if($debug_mode && isset($exception)): ?>

Message: <?php echo $exception->getMessage(); ?>

Code: <?php echo $exception->getCode(); ?>

File: <?php echo $exception->getFile(); ?>

Line: <?php echo $exception->getLine(); ?>

<?php
/*
echo '
'.$exception->__toString().'
';
echo '
';
print_r($exception);
echo '
';

echo '
';
print_r($GLOBALS);
echo '
';
*/
?>

<?php endif; ?>


text:
/**
 * Created by alejandrobarreiro on 8/10/15.
 */
angular.module('sapoApp')
  .service('almacenService', ['$q', 'Almacen', 'Usuario', 'authService', 'Categoria', function ($q, Almacen, Usuario, authService, Categoria) {

    this.init = function () {};

    this.getAlmacen = function(id) {
      var deferred = $q.defer();
      console.log('Buscando almacén con ID ' + id);
      Almacen.getAlmacen({ id: id }, {}, function (almacen) {
        deferred.resolve(almacen);
      }, function (error) {
        deferred.reject(error);
      });
      return deferred.promise;
    };

    this.getAlmacenes = function() {
      var deferred = $q.defer();
      Almacen.getAlmacenes({}, {}, function (almacenes) {
        console.log(almacenes);
        deferred.resolve(almacenes);
      }, function (error) {
        deferred.reject(error);
      });
      return deferred.promise;
    };

    this.getMisAlmacenes = function () {
      var user = authService.getLoggedUser();

      var deferred = $q.defer();
      Usuario.getMisAlmacenes({userid: user.id}, {}, function (almacenes) {
        console.log(almacenes);
        deferred.resolve(almacenes);
      }, function (error) {
        deferred.reject(error);
      });
      return deferred.promise;
    };

    this.crearNuevaAlmacen = function (almacen) {
      //Esta logica se va a ir cuando se haga lo del token
      var user = authService.getLoggedUser();

      var deferred = $q.defer();
      Usuario.agregarAlmacen({userid: user.id}, almacen, function (almacenResult) {
        console.log(almacenResult);
        deferred.resolve(almacenResult);
      }, function (error) {
        deferred.reject(error);
      });
      return deferred.promise;
    };

    this.cargarCategoriasAlmacen = function (almacenId, categorias) {

      var deferred = $q.defer();
      Almacen.agregarCategorias({id: almacenId}, categorias, function (almacenResult) {
        console.log(almacenResult);
        deferred.resolve(almacenResult);
      }, function (error) {
        deferred.reject(error);
      });
      return deferred.promise;
    };

    //Crea la categoria especifica
    this.crearCategoriaAlmacen = function (nombreCategoria, descCategoria) {

        var deferred = $q.defer();
        Categoria.createCategoria({}, {
            nombre: nombreCategoria,
            descripcion: descCategoria,
            isgenerico: false
        }, function (categoria) {
            deferred.resolve(categoria);
        }, function (error) {
            deferred.reject(error);
        });
        return deferred.promise;
    };

    this.cargarProductosAlmacen = function (almacenId, productos) {

      var deferred = $q.defer();
      Almacen.agregarProductos({id: almacenId}, productos, function (almacenResult) {
        console.log(almacenResult);
        deferred.resolve(almacenResult);
      }, function (error) {
        deferred.reject(error);
      });
      return deferred.promise;
    };

    this.agregarColaborador = function (almacenId, userId) {

      var deferred = $q.defer();
      Almacen.agregarColaborador({id: almacenId, userid: userId}, function (result) {
        deferred.resolve(result);
      }, function (error) {
        deferred.reject(error);
      });
      return deferred.promise;
    };

    this.actualizarAlmacen = function (almacenId, data) {

      var deferred = $q.defer();
      Almacen.actualizarAlmacen({id: almacenId}, data, function (result) {
        deferred.resolve(result);
      }, function (error) {
        deferred.reject(error);
      });
      return deferred.promise;
    };

    this.validarAlmacen = function(almacen) {

      return almacen.nombre && almacen.nombre.length && almacen.id && almacen.id.length;
    };

    this.actualizarStockAlmacen = function (almacenId, productoId, stock) {
        var deferred = $q.defer();
        Almacen.actualizarStockAlmacen({id: almacenId, prodid: productoId, cant: stock},
            {},
            function (result) {
                deferred.resolve(result);
            }, function (error) {
                deferred.reject(error);
        });
        return deferred.promise;
    }

    this.obtenerComentarios = function (idAlmacen) {
        var deferred = $q.defer();
        Almacen.getComentarios({id: idAlmacen},
            {},
            function (result) {
                deferred.resolve(result);
            }, function (error) {
                deferred.reject(error);
            });
        return deferred.promise;
    }

    this.agregarComentario = function(idAlmacen, usuario, comentario) {
        var deferred = $q.defer();
        Almacen.agregarComentario({id: idAlmacen},
            {
                usuario: usuario,
                comentario: comentario.comentario
            },
            function (result) {
                deferred.resolve(result);
            }, function (error) {
                deferred.reject(error);
            });
        return deferred.promise;
    };

    this.borrarAlmacen = function (idAlmacen) {
      var deferred = $q.defer();
      Almacen.borrarAlmacen({id: idAlmacen},
        {},
        function (result) {
          deferred.resolve(result);
        }, function (error) {
          deferred.reject(error);
        });
      return deferred.promise;
    };

    this.getAlmacenesColabora = function () {
      var user = authService.getLoggedUser();
      var deferred = $q.defer();

      Usuario.getAlmacenesColabora({userid: user.id}, {}, function (almacenes) {
        console.log(almacenes);
        deferred.resolve(almacenes);
      }, function (error) {
        deferred.reject(error);
      });
      return deferred.promise;
    };

    this.getColaboradoresAlmacen = function (idAlmacen) {
      deferred = $q.defer();

      Almacen.getColaboradores({id: idAlmacen}, {}, function (result) {
          deferred.resolve(result);
        }, function (error) {
          deferred.reject(error);
        });
      return deferred.promise;
    }

    this.agregarPersonalizacion = function (idAlmacen,css) {
      deferred = $q.defer();

      Almacen.agregarPersonalizacion({id: idAlmacen}, {css: css}, function (result) {
        deferred.resolve(result);
      }, function (error) {
        deferred.reject(error);
      });
      return deferred.promise;
    }

  }]);


text:
package com.anyi.report.service;

import java.util.List;

import com.anyi.report.entity.Metadata;
import com.anyi.report.entity.MetadataOption;

public interface DocServiceForMetadata {
	public String isExitSameCode(String metadata_code);
	public String addMetadada(Metadata metadata);
	public String deletaMetadata(Metadata metadata);
	public String updateMetadata(Metadata metadata);
	public List<Metadata> queryMetadata(Metadata metadata);

	public String addMetadataOption(MetadataOption option);
	public String deleteMetadataOption(MetadataOption option);
	public String updateMetadataOption(MetadataOption option);
	public List<MetadataOption> queryMetadataOption(MetadataOption option);
}


text:
/*	$OpenBSD: ce4231var.h,v 1.2 2001/10/02 00:26:24 jason Exp $	*/

/*
 * Copyright (c) 1999 Jason L. Wright (jason@thought.net)
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed by Jason L. Wright
 * 4. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

/*
 * Driver for CS4231/EBDMA based audio found in some sun4u systems
 */

/*
 * List of device memory allocations (see ce4231_malloc/ce4231_free).
 */
struct cs_dma {
	struct cs_dma *		next;
	caddr_t			addr;
	bus_dmamap_t		dmamap;
	bus_dma_segment_t	segs[1];
	int			nsegs;
	size_t			size;
};

struct cs_volume {
	u_int8_t	left;
	u_int8_t	right;
};

struct ce4231_softc {
	struct	device sc_dev;		/* base device */
	struct	sbusdev sc_sd;		/* sbus device */
	struct	intrhand sc_ih;		/* interrupt vectoring */
	bus_dma_tag_t sc_dmatag;
	bus_space_tag_t	sc_bustag;	/* CS4231/DMA register tag */
	bus_space_handle_t sc_cshandle;	/* CS4231 handle */
	bus_space_handle_t sc_cdmahandle; /* capture DMA handle */
	bus_space_handle_t sc_pdmahandle; /* playback DMA handle */
	bus_space_handle_t sc_auxhandle;  /* AUX handle */
	struct	evcnt sc_intrcnt;	/* statistics */
	int	sc_open;		/* already open? */
	int	sc_locked;		/* locked? */

	void	(*sc_rintr)(void*);	/* input completion intr handler */
	void *	sc_rarg;		/* arg for sc_rintr() */
	void	(*sc_pintr)(void*);	/* output completion intr handler */
	void *	sc_parg;		/* arg for sc_pintr() */

	char		sc_mute[9];	/* which devs are muted */
	u_int8_t	sc_out_port;	/* output port */
	struct	cs_volume sc_volume[9];	/* software volume */

	int sc_format_bits;
	int sc_speed_bits;
	int sc_precision;
	int sc_need_commit;
	int sc_channels;
	u_int sc_last_format;
	u_int32_t	sc_blksz;
	u_int32_t	sc_playcnt;
	u_int32_t	sc_playsegsz;
	u_int32_t	sc_burst;
	u_int32_t	sc_lastaddr;
	struct cs_dma	*sc_dmas;	/* dma list */
	struct cs_dma	*sc_nowplaying;
};


text:
<!DOCTYPE html>

    <title>TradeoffAnalytics Class Reference</title>
    <link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="../css/highlight.css" />
    <meta charset='utf-8'>

 Docs

View on GitHub

         Reference

        TradeoffAnalytics Class Reference

            Classes

                TradeoffAnalytics

            Enums

                ColumnType

                Goal

                OptionValue

                Range

                SolutionStatus

                TradeoffAnalyticsError

            Structs

                Anchor

                Column

                Dilemma

                Map

                MapNode

                MapNodeCoordinates

                Option

                Problem

                Resolution

                Solution

                StatusCause

TradeoffAnalytics

public class TradeoffAnalytics

The IBM Watson Tradeoff Analytics service helps people make better choices when faces with a
decision problem that includes multiple, often conflicting, goals and alternatives. By using
mathematical filtering techniques to identify the top options based on different criteria, the
service can help users explore the trade-offs between options to make complex decisions.

                    serviceURL

The base URL to use when contacting the service.

Declaration

Swift

public var serviceURL = "https://gateway.watsonplatform.net/tradeoff-analytics/api"

                    defaultHeaders

The default HTTP headers for all requests to the service.

Declaration

Swift

public var defaultHeaders = [String: String]()

                    init(username:password:)

Create a TradeoffAnalytics object.

Declaration

Swift

public init(username: String, password: String)

Parameters

                                username

The username used to authenticate with the service.

                                password

The password used to authenticate with the service.

                    getDilemma(for:generateVisualization:failure:success:)

Get a dilemma that contains a problem and its resolution.

The problem contains a set of columns (objectives) and options. The resolution contains a set
of optimal options, their analytical characteristics, and, by default, their representation
in a two-dimensional space.

Declaration

Swift

public func getDilemma(
        for problem: Problem,
        generateVisualization: Bool? = nil,
        failure: ((Error) -> Void)? = nil,
        success: @escaping (Dilemma) -> Void)

Parameters

                                for

The decision problem.

                                generateVisualization

Indicated whether to calculate the map visualization for the results. If true, the visualization is returned; if false, no visualization is returned.

                                failure

A function invoked if an error occurs.

                                success

A function invoked with the resulting dilemma and visualization.

© 2017 . All rights reserved. (Last updated: 2017-03-02)

Generated by jazzy ♪♫ v0.7.3, a Realm project.


text:
package mx.edu.um.cargos.dao;

import java.util.List;

import mx.edu.um.dao.Dao;
import mx.edu.um.cargos.model.Cargo;

public interface CargoDao extends Dao {

    /**
     * Retrieves all of the cargos
     */
    public List getCargos(Cargo cargo);

    /**
     * Gets cargo's information based on primary key. An
     * ObjectRetrievalFailureException Runtime Exception is thrown if
     * nothing is found.
     *
     * @param id the cargo's id
     * @return cargo populated cargo object
     */
    public Cargo getCargo(final Integer id);

    /**
     * Saves a cargo's information
     * @param cargo the object to be saved
     */
    public void saveCargo(Cargo cargo);

    /**
     * Removes a cargo from the database by id
     * @param id the cargo's id
     */
    public void removeCargo(final Integer id);
}


text:
package org.olat.modules.vitero.model;

/**
 *
 * Description:

 *
 *

 * Initial Date:  6 oct. 2011

 *
 * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com
 */
public enum Repetitionpattern {
	once, //no repetition (default)
	daily, //every day
	weekly, //every week
	workdays, //only from monday to friday
	weekends //only on saturday and sunday
}


text:
TODO: Write a gem description

## Installation

Add this line to your application's Gemfile:

    gem 'jquery-tokeninput-rails'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install jquery-tokeninput-rails

## Usage

### Javascript include
```javascript
//= require jquery.tokeninput
```

### Stylesheet include

```css
 *=  require token-input
```

Or

```css
 *= require token-input-facebook
```

Or

```css
 *=  require token-input-mac
```


text:
require 'helper'

version = 1

describe "test Pry defaults" do
  before do
    @str_output = StringIO.new
  end

  after do
    Pry.reset_defaults
    Pry.color = false
  end

  describe "input" do
    after do
      Pry.reset_defaults
      Pry.color = false
    end

    it 'should set the input default, and the default should be overridable' do
      Pry.input = InputTester.new("5")

      Pry.output = @str_output
      Pry.new.rep
      @str_output.string.should =~ /5/

      Pry.new(:input => InputTester.new("6")).rep
      @str_output.string.should =~ /6/
    end

    it 'should pass in the prompt if readline arity is 1' do
      Pry.prompt = proc { "A" }

      arity_one_input = Class.new do
        attr_accessor :prompt
        def readline(prompt)
          @prompt = prompt
          "exit-all"
        end
      end.new

      Pry.start(self, :input => arity_one_input, :output => Pry::NullOutput)
      arity_one_input.prompt.should == Pry.prompt.call
    end

    it 'should not pass in the prompt if the arity is 0' do
      Pry.prompt = proc { "A" }

      arity_zero_input = Class.new do
        def readline
          "exit-all"
        end
      end.new

      lambda { Pry.start(self, :input => arity_zero_input, :output => Pry::NullOutput) }.should.not.raise Exception
    end

    it 'should not pass in the prompt if the arity is -1' do
      Pry.prompt = proc { "A" }

      arity_multi_input = Class.new do
        attr_accessor :prompt

        def readline(*args)
          @prompt = args.first
          "exit-all"
        end
      end.new

      Pry.start(self, :input => arity_multi_input, :output => Pry::NullOutput)
      arity_multi_input.prompt.should == nil
    end

  end

  it 'should set the output default, and the default should be overridable' do
    Pry.input = InputTester.new("5", "6", "7")

    Pry.output = @str_output

    Pry.new.rep
    @str_output.string.should =~ /5/

    Pry.new.rep
    @str_output.string.should =~ /5\n.*6/

    @str_output = StringIO.new
    Pry.new(:output => @str_output).rep
    @str_output.string.should.not =~ /5\n.*6/
    @str_output.string.should =~ /7/
  end

  it "should set the print default, and the default should be overridable" do
    new_print = proc { |out, value| out.puts value }
    Pry.print =  new_print

    Pry.new.print.should == Pry.print
    Pry.new(:input => InputTester.new("\"test\""), :output => @str_output).rep
    @str_output.string.should == "test\n"

    @str_output = StringIO.new
    Pry.new(:input => InputTester.new("\"test\""), :output => @str_output,
            :print => proc { |out, value| out.puts value.reverse }).rep
    @str_output.string.should == "tset\n"

    Pry.new.print.should == Pry.print
    @str_output = StringIO.new
    Pry.new(:input => InputTester.new("\"test\""), :output => @str_output).rep
    @str_output.string.should == "test\n"
  end

  describe "pry return values" do
    it 'should return nil' do
      Pry.start(self, :input => StringIO.new("exit-all"), :output => Pry::NullOutput).should == nil
    end

    it 'should return the parameter given to exit-all' do
      Pry.start(self, :input => StringIO.new("exit-all 10"), :output => Pry::NullOutput).should == 10
    end

    it 'should return the parameter (multi word string) given to exit-all' do
      Pry.start(self, :input => StringIO.new("exit-all \"john mair\""), :output => Pry::NullOutput).should == "john mair"
    end

    it 'should return the parameter (function call) given to exit-all' do
      Pry.start(self, :input => StringIO.new("exit-all 'abc'.reverse"), :output => Pry::NullOutput).should == 'cba'
    end

    it 'should return the parameter (self) given to exit-all' do
      Pry.start("carl", :input => StringIO.new("exit-all self"), :output => Pry::NullOutput).should == "carl"
    end
  end

  describe "prompts" do
    before do
      @empty_input_buffer = ""
      @non_empty_input_buffer = "def hello"
      @context = Pry.binding_for(0)
    end

    it 'should set the prompt default, and the default should be overridable (single prompt)' do
      new_prompt = proc { "test prompt> " }
      Pry.prompt =  new_prompt

      Pry.new.prompt.should == Pry.prompt
      Pry.new.select_prompt(@empty_input_buffer, @context).should == "test prompt> "
      Pry.new.select_prompt(@non_empty_input_buffer, @context).should == "test prompt> "

      new_prompt = proc { "A" }
      pry_tester = Pry.new(:prompt => new_prompt)
      pry_tester.prompt.should == new_prompt
      pry_tester.select_prompt(@empty_input_buffer, @context).should == "A"
      pry_tester.select_prompt(@non_empty_input_buffer, @context).should == "A"

      Pry.new.prompt.should == Pry.prompt
      Pry.new.select_prompt(@empty_input_buffer, @context).should == "test prompt> "
      Pry.new.select_prompt(@non_empty_input_buffer, @context).should == "test prompt> "
    end

    it 'should set the prompt default, and the default should be overridable (multi prompt)' do
      new_prompt = [proc { "test prompt> " }, proc { "test prompt* " }]
      Pry.prompt =  new_prompt

      Pry.new.prompt.should == Pry.prompt
      Pry.new.select_prompt(@empty_input_buffer, @context).should == "test prompt> "
      Pry.new.select_prompt(@non_empty_input_buffer, @context).should == "test prompt* "

      new_prompt = [proc { "A" }, proc { "B" }]
      pry_tester = Pry.new(:prompt => new_prompt)
      pry_tester.prompt.should == new_prompt
      pry_tester.select_prompt(@empty_input_buffer, @context).should == "A"
      pry_tester.select_prompt(@non_empty_input_buffer, @context).should == "B"

      Pry.new.prompt.should == Pry.prompt
      Pry.new.select_prompt(@empty_input_buffer, @context).should == "test prompt> "
      Pry.new.select_prompt(@non_empty_input_buffer, @context).should == "test prompt* "
    end

    describe 'storing and restoring the prompt' do
      before do
        make = lambda do |name,i|
          prompt = [ proc { "#{i}>" } , proc { "#{i+1}>" } ]
          (class << prompt; self; end).send(:define_method, :inspect) { "<Prompt-#{name}>" }
          prompt
        end
        @a , @b , @c = make[:a,0] , make[:b,1] , make[:c,2]
        @pry = Pry.new :prompt => @a
      end
      it 'should have a prompt stack' do
        @pry.push_prompt @b
        @pry.push_prompt @c
        @pry.prompt.should == @c
        @pry.pop_prompt
        @pry.prompt.should == @b
        @pry.pop_prompt
        @pry.prompt.should == @a
      end

      it 'should restore overridden prompts when returning from file-mode' do
        pry = Pry.new :input => InputTester.new('shell-mode', 'shell-mode'),
        :prompt => [ proc { 'P>' } ] * 2
        pry.select_prompt(@empty_input_buffer, @context).should == "P>"
        pry.re
        pry.select_prompt(@empty_input_buffer, @context).should =~ /\Apry .* \$ \z/
        pry.re
        pry.select_prompt(@empty_input_buffer, @context).should == "P>"
      end

      it '#pop_prompt should return the popped prompt' do
        @pry.push_prompt @b
        @pry.push_prompt @c
        @pry.pop_prompt.should == @c
        @pry.pop_prompt.should == @b
      end

      it 'should not pop the last prompt' do
        @pry.push_prompt @b
        @pry.pop_prompt.should == @b
        @pry.pop_prompt.should == @a
        @pry.pop_prompt.should == @a
        @pry.prompt.should == @a
      end

      describe '#prompt= should replace the current prompt with the new prompt' do
        it 'when only one prompt on the stack' do
          @pry.prompt = @b
          @pry.prompt.should == @b
          @pry.pop_prompt.should == @b
          @pry.pop_prompt.should == @b
        end
        it 'when several prompts on the stack' do
          @pry.push_prompt @b
          @pry.prompt = @c
          @pry.pop_prompt.should == @c
          @pry.pop_prompt.should == @a
        end
      end
    end
  end

  describe "view_clip used for displaying an object in a truncated format" do

    VC_MAX_LENGTH = 60

    describe "given an object with an #inspect string" do
      it "returns the #<> format of the object (never use inspect)" do
        o = Object.new
        def o.inspect; "a" * VC_MAX_LENGTH; end

        Pry.view_clip(o, VC_MAX_LENGTH).should =~ /#<Object/
      end
    end

    describe "given the 'main' object" do
      it "returns the #to_s of main (special case)" do
        o = TOPLEVEL_BINDING.eval('self')
        Pry.view_clip(o, VC_MAX_LENGTH).should == o.to_s
      end
    end

    describe "given the a Numeric, String or Symbol object" do
      [1, 2.0, -5, "hello", :test].each do |o|
        it "returns the #inspect of the special-cased immediate object: #{o}" do
          Pry.view_clip(o, VC_MAX_LENGTH).should == o.inspect
        end
      end

      # only testing with String here :)
      it "returns #<> format of the special-cased immediate object if #inspect is longer than maximum" do
        o = "o" * (VC_MAX_LENGTH + 1)
        Pry.view_clip(o, VC_MAX_LENGTH).should =~ /#<String/
      end
    end

    describe "given an object with an #inspect string as long as the maximum specified" do
      it "returns the #<> format of the object (never use inspect)" do
        o = Object.new
        def o.inspect; "a" * VC_MAX_LENGTH; end

        Pry.view_clip(o, VC_MAX_LENGTH).should =~ /#<Object/
      end
    end

    describe "given a regular object with an #inspect string longer than the maximum specified" do

      describe "when the object is a regular one" do
        it "returns a string of the #<class name:object idish> format" do
          o = Object.new
          def o.inspect; "a" * (VC_MAX_LENGTH + 1); end

          Pry.view_clip(o, VC_MAX_LENGTH).should =~ /#<Object/
        end
      end

      describe "when the object is a Class or a Module" do
        describe "without a name (usually a c = Class.new)" do
          it "returns a string of the #<class name:object idish> format" do
            c, m = Class.new, Module.new

            Pry.view_clip(c, VC_MAX_LENGTH).should =~ /#<Class/
            Pry.view_clip(m, VC_MAX_LENGTH).should =~ /#<Module/
          end
        end

        describe "with a #name longer than the maximum specified" do
          it "returns a string of the #<class name:object idish> format" do
            c, m = Class.new, Module.new

            def c.name; "a" * (VC_MAX_LENGTH + 1); end
            def m.name; "a" * (VC_MAX_LENGTH + 1); end

            Pry.view_clip(c, VC_MAX_LENGTH).should =~ /#<Class/
            Pry.view_clip(m, VC_MAX_LENGTH).should =~ /#<Module/
          end
        end

        describe "with a #name shorter than or equal to the maximum specified" do
          it "returns a string of the #<class name:object idish> format" do
            c, m = Class.new, Module.new

            def c.name; "a" * VC_MAX_LENGTH; end
            def m.name; "a" * VC_MAX_LENGTH; end

            Pry.view_clip(c, VC_MAX_LENGTH).should == c.name
            Pry.view_clip(m, VC_MAX_LENGTH).should == m.name
          end
        end

      end

    end

  end

  describe 'quiet' do
    it 'should show whereami by default' do
      Pry.start(binding, :input => InputTester.new("1", "exit-all"),
              :output => @str_output,
              :hooks => Pry::DEFAULT_HOOKS)

      @str_output.string.should =~ /[w]hereami by default/
    end

    it 'should hide whereami if quiet is set' do
      Pry.new(:input => InputTester.new("exit-all"),
              :output => @str_output,
              :quiet => true,
              :hooks => Pry::DEFAULT_HOOKS)

      @str_output.string.should == ""
    end
  end

  describe 'toplevel_binding' do
    it 'should be devoid of local variables' do
      mock_pry(Pry.toplevel_binding, "ls -l").should.not =~ /version/
    end

    it 'should have self the same as TOPLEVEL_BINDING' do
      mock_pry(Pry.toplevel_binding, "self.equal? TOPLEVEL_BINDING.eval('self')").should =~ /=> true/
    end

    # https://github.com/rubinius/rubinius/issues/1779
    unless Pry::Helpers::BaseHelpers.rbx?
      it 'should define private methods on Object' do
        mock_pry(TOPLEVEL_BINDING, "def gooey_fooey; end")
        method(:gooey_fooey).owner.should == Object
        Pry::Method(method(:gooey_fooey)).visibility.should == :private
      end
    end
  end

  it 'should set the hooks default, and the default should be overridable' do
    Pry.input = InputTester.new("exit-all")
    Pry.hooks = Pry::Hooks.new.
      add_hook(:before_session, :my_name) { |out,_,_|  out.puts "HELLO" }.
      add_hook(:after_session, :my_name) { |out,_,_| out.puts "BYE" }

    Pry.new(:output => @str_output).repl
    @str_output.string.should =~ /HELLO/
    @str_output.string.should =~ /BYE/

    Pry.input.rewind

    @str_output = StringIO.new
    Pry.new(:output => @str_output,
            :hooks => Pry::Hooks.new.
            add_hook( :before_session, :my_name) { |out,_,_| out.puts "MORNING" }.
            add_hook(:after_session, :my_name) { |out,_,_| out.puts "EVENING" }
            ).repl

    @str_output.string.should =~ /MORNING/
    @str_output.string.should =~ /EVENING/

    # try below with just defining one hook
    Pry.input.rewind
    @str_output = StringIO.new
    Pry.new(:output => @str_output,
            :hooks => Pry::Hooks.new.
            add_hook(:before_session, :my_name) { |out,_,_| out.puts "OPEN" }
            ).repl

    @str_output.string.should =~ /OPEN/

    Pry.input.rewind
    @str_output = StringIO.new
    Pry.new(:output => @str_output,
            :hooks => Pry::Hooks.new.
            add_hook(:after_session, :my_name) { |out,_,_| out.puts "CLOSE" }
            ).repl

    @str_output.string.should =~ /CLOSE/

    Pry.reset_defaults
    Pry.color = false
  end
end


text:
module Rack
  module Test
    class MockDigestRequest # :nodoc:
      def initialize(params)
        @params = params
      end

      def method_missing(sym)
        if @params.key? k = sym.to_s
          return @params[k]
        end

        super
      end

      def method
        @params['method']
      end

      def response(password)
        Rack::Auth::Digest::MD5.new(nil).send :digest, self, password
      end
    end
  end
end


text:
bootrest [![Build Status](http://ci.3kalak.com/buildStatus/icon?job=BootRest)](http://ci.3kalak.com/job/BootRest/)
========

Initial as simple RESTful built on top of spring-boot but it will eventually become my rest layer on top of redis stay tuned!

Technology Behind
* Spring Framework
* Spring data redis
* Redis


text:
using namespace ssmkit;

int main() {
  double delta = 1; // sample time

  // switching process
  arma::mat transition_matrix{
      {0.8, 0.1, 0.1}, {0.1, 0.8, 0.1}, {0.1, 0.1, 0.8}};
  auto switching_model = map::TransitionMatrix(transition_matrix);
  auto switching_cpdf = distribution::makeConditional(
      distribution::Categorical(), switching_model);
  auto switching_process = process::makeMarkov(
      switching_cpdf, distribution::Categorical({0.4, 0.3, 0.3}));

  // dynamic process
  arma::mat dynamic_matrix{{1, delta}, {0, 1}};
  arma::mat dynamic_noise{{0.1, 0}, {0, 0.1}};
  arma::mat accelerations{
      {0, delta * delta / 2, -delta * delta / 2}, {0, delta, -delta}};
  auto state_model = map::SwitchingAdditiveLinearGaussian(
      dynamic_matrix, dynamic_noise, accelerations);
  auto state_cpdf =
      distribution::makeConditional(distribution::Gaussian(2), state_model);
  auto state_process =
      process::makeMarkov(state_cpdf, distribution::Gaussian(2));

  // measurement process
  arma::mat measurement_matrix{1, 0};
  arma::mat measurement_noise{0.1};
  auto measurement_model =
      map::LinearGaussian(measurement_matrix, measurement_noise);
  auto measurement_cpdf = distribution::makeConditional(
      distribution::Gaussian(1), measurement_model);
  auto measurement_process = process::makeMemoryless(measurement_cpdf);

  // joint process
  auto joint_process = process::makeHierarchical(
      switching_process, state_process, measurement_process);

  // simulation
  joint_process.initialize();
  auto v = joint_process.random_n(100);

  std::for_each(v.begin(), v.end(), [](auto &p) {
    std::cout << std::get<0>(p) << std::endl
              << std::get<1>(p) << std::endl
              << std::get<2>(p) << "-----------" << std::endl;
  });
}


text:
Takes a function and two values in its domain and returns `true` if the
values map to the same value in the codomain; `false` otherwise.

@func
@memberOf R
@since v0.18.0
@category Relation
@sig (a -> b) -> a -> a -> Boolean
@param {Function} f
@param {*} x
@param {*} y
@return {Boolean}
@example

     R.eqBy(Math.abs, 5, -5); //=> true