text:
package org.pentaho.di.ui.trans.steps.yamlinput;

import java.util.ArrayList;

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.ShellAdapter;
import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
import org.pentaho.di.core.Const;
import org.pentaho.di.core.Props;
import org.pentaho.di.core.exception.KettleException;
import org.pentaho.di.core.fileinput.FileInputList;
import org.pentaho.di.core.row.RowMeta;
import org.pentaho.di.core.row.RowMetaInterface;
import org.pentaho.di.core.row.ValueMeta;
import org.pentaho.di.core.row.ValueMetaInterface;
import org.pentaho.di.i18n.BaseMessages;
import org.pentaho.di.trans.Trans;
import org.pentaho.di.trans.TransMeta;
import org.pentaho.di.trans.TransPreviewFactory;
import org.pentaho.di.trans.step.BaseStepMeta;
import org.pentaho.di.trans.step.StepDialogInterface;
import org.pentaho.di.trans.steps.yamlinput.YamlInputField;
import org.pentaho.di.trans.steps.yamlinput.YamlInputMeta;
import org.pentaho.di.trans.steps.yamlinput.YamlReader;
import org.pentaho.di.ui.core.dialog.EnterNumberDialog;
import org.pentaho.di.ui.core.dialog.EnterSelectionDialog;
import org.pentaho.di.ui.core.dialog.EnterTextDialog;
import org.pentaho.di.ui.core.dialog.ErrorDialog;
import org.pentaho.di.ui.core.dialog.PreviewRowsDialog;
import org.pentaho.di.ui.core.widget.ColumnInfo;
import org.pentaho.di.ui.core.widget.TableView;
import org.pentaho.di.ui.core.widget.TextVar;
import org.pentaho.di.ui.trans.dialog.TransPreviewProgressDialog;
import org.pentaho.di.ui.trans.step.BaseStepDialog;

public class YamlInputDialog extends BaseStepDialog implements StepDialogInterface
{
	private static Class<?> PKG = YamlInputMeta.class; // for i18n purposes, needed by Translator2!!   $NON-NLS-1$

	private CTabFolder   wTabFolder;
	private FormData     fdTabFolder;

	private CTabItem     wFileTab, wContentTab, wFieldsTab;

	private Composite    wFileComp, wContentComp, wFieldsComp;
	private FormData     fdFileComp, fdContentComp, fdFieldsComp;

	private Label        wlFilename,wlYamlIsAFile;
	private Button       wbbFilename; // Browse: add file or directory
	private Button       wbdFilename; // Delete
	private Button       wbeFilename; // Edit
	private Button       wbaFilename; // Add or change
	private TextVar      wFilename;
	private FormData     fdlFilename, fdbFilename, fdbdFilename, fdbeFilename, fdbaFilename, fdFilename;

	private Label        wlFilenameList;
	private TableView    wFilenameList;
	private FormData     fdlFilenameList, fdFilenameList;

	private Label        wlFilemask;
	private TextVar      wFilemask;
	private FormData     fdlFilemask, fdFilemask;

	private Button       wbShowFiles;
	private FormData     fdbShowFiles;

	private FormData fdlXMLField, fdlXMLStreamField,fdlXMLIsAFile;
	private FormData    fdXMLField, fdYAMLStreamField;
	private FormData fdOutputField,fdYAMLIsAFile,fdAdditionalFields,fdAddFileResult,fdXmlConf;
	private Label wlYamlField, wlXmlStreamField;
	private CCombo wYAMLLField;
	private Button wYAMLStreamField,wYAMLIsAFile;

	private Label        wlInclFilename;
	private Button       wInclFilename,wAddResult;
	private FormData     fdlInclFilename, fdInclFilename,fdAddResult,fdlAddResult;

	private Label        wlInclFilenameField;
	private TextVar      wInclFilenameField;
	private FormData     fdlInclFilenameField, fdInclFilenameField;

	private Label        wlInclRownum,wlAddResult;
	private Button       wInclRownum;
	private FormData     fdlInclRownum, fdRownum;

	private Label        wlInclRownumField;
	private TextVar      wInclRownumField;
	private FormData     fdlInclRownumField, fdInclRownumField;

	private Label        wlLimit;
	private Text         wLimit;
	private FormData     fdlLimit, fdLimit;

	private TableView    wFields;
	private FormData     fdFields;

	private Group wOutputField;
	private Group wAdditionalFields;
	private Group wAddFileResult;
	private Group wXmlConf;

	// ignore empty files flag
	private Label        wlIgnoreEmptyFile;
	private Button       wIgnoreEmptyFile;
	private FormData     fdlIgnoreEmptyFile, fdIgnoreEmptyFile;

	 // do not fail if no files?
	private Label        wldoNotFailIfNoFile;
	private Button       wdoNotFailIfNoFile;
	private FormData     fdldoNotFailIfNoFile, fddoNotFailIfNoFile;

	private YamlInputMeta input;

	public static final int dateLengths[] = new int[]
		{
			23, 19, 14, 10, 10, 10, 10, 8, 8, 8, 8, 6, 6
		};

	ArrayList<String> listpath = new ArrayList<String>();
	String precNodeName=null;

	public YamlInputDialog(Shell parent, Object in, TransMeta transMeta, String sname)
	{
		super(parent, (BaseStepMeta)in, transMeta, sname);
		input=(YamlInputMeta)in;
	}

	public String open()
	{
		Shell parent = getParent();
		Display display = parent.getDisplay();

		shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
 		props.setLook(shell);
        setShellImage(shell, input);

		ModifyListener lsMod = new ModifyListener()
		{
			public void modifyText(ModifyEvent e)
			{
				input.setChanged();
			}
		};
		changed         = input.hasChanged();

		FormLayout formLayout = new FormLayout ();
		formLayout.marginWidth  = Const.FORM_MARGIN;
		formLayout.marginHeight = Const.FORM_MARGIN;

		shell.setLayout(formLayout);
		shell.setText(BaseMessages.getString(PKG, "YamlInputDialog.DialogTitle"));

		int middle = props.getMiddlePct();
		int margin = Const.MARGIN;

		// Stepname line
		wlStepname=new Label(shell, SWT.RIGHT);
		wlStepname.setText(BaseMessages.getString(PKG, "System.Label.StepName"));
 		props.setLook(wlStepname);
		fdlStepname=new FormData();
		fdlStepname.left = new FormAttachment(0, 0);
		fdlStepname.top  = new FormAttachment(0, margin);
		fdlStepname.right= new FormAttachment(middle, -margin);
		wlStepname.setLayoutData(fdlStepname);
		wStepname=new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
		wStepname.setText(stepname);
 		props.setLook(wStepname);
		wStepname.addModifyListener(lsMod);
		fdStepname=new FormData();
		fdStepname.left = new FormAttachment(middle, 0);
		fdStepname.top  = new FormAttachment(0, margin);
		fdStepname.right= new FormAttachment(100, 0);
		wStepname.setLayoutData(fdStepname);

		wTabFolder = new CTabFolder(shell, SWT.BORDER);
 		props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);

		//////////////////////////
		// START OF FILE TAB   ///
		//////////////////////////
		wFileTab=new CTabItem(wTabFolder, SWT.NONE);
		wFileTab.setText(BaseMessages.getString(PKG, "YamlInputDialog.File.Tab"));

		wFileComp = new Composite(wTabFolder, SWT.NONE);
 		props.setLook(wFileComp);

		FormLayout fileLayout = new FormLayout();
		fileLayout.marginWidth  = 3;
		fileLayout.marginHeight = 3;
		wFileComp.setLayout(fileLayout);

		// ///////////////////////////////
		// START OF Output Field GROUP  //
		/////////////////////////////////

		wOutputField = new Group(wFileComp, SWT.SHADOW_NONE);
		props.setLook(wOutputField);
		wOutputField.setText(BaseMessages.getString(PKG, "YamlInputDialog.wOutputField.Label"));

		FormLayout outputfieldgroupLayout = new FormLayout();
		outputfieldgroupLayout.marginWidth = 10;
		outputfieldgroupLayout.marginHeight = 10;
		wOutputField.setLayout(outputfieldgroupLayout);

		//Is XML string defined in a Field
		wlXmlStreamField = new Label(wOutputField, SWT.RIGHT);
		wlXmlStreamField.setText(BaseMessages.getString(PKG, "YamlInputDialog.wlXmlStreamField.Label"));
		props.setLook(wlXmlStreamField);
		fdlXMLStreamField = new FormData();
		fdlXMLStreamField.left = new FormAttachment(0, -margin);
		fdlXMLStreamField.top = new FormAttachment(0, margin);
		fdlXMLStreamField.right = new FormAttachment(middle, -2*margin);
		wlXmlStreamField.setLayoutData(fdlXMLStreamField);

		wYAMLStreamField = new Button(wOutputField, SWT.CHECK);
		props.setLook(wYAMLStreamField);
		wYAMLStreamField.setToolTipText(BaseMessages.getString(PKG, "YamlInputDialog.wYAMLStreamField.Tooltip"));
		fdYAMLStreamField = new FormData();
		fdYAMLStreamField.left = new FormAttachment(middle, -margin);
		fdYAMLStreamField.top = new FormAttachment(0, margin);
		wYAMLStreamField.setLayoutData(fdYAMLStreamField);
		SelectionAdapter lsyamlstream = new SelectionAdapter()
        {
            public void widgetSelected(SelectionEvent arg0)
            {
            	ActiveStreamField();
            	input.setChanged();
            }
        };
        wYAMLStreamField.addSelectionListener(lsyamlstream);

        //Is XML source is a file?
		wlYamlIsAFile = new Label(wOutputField, SWT.RIGHT);
		wlYamlIsAFile.setText(BaseMessages.getString(PKG, "YamlInputDialog.XMLIsAFile.Label"));
		props.setLook(wlYamlIsAFile);
		fdlXMLIsAFile = new FormData();
		fdlXMLIsAFile.left = new FormAttachment(0, -margin);
		fdlXMLIsAFile.top = new FormAttachment(wYAMLStreamField, margin);
		fdlXMLIsAFile.right = new FormAttachment(middle, -2*margin);
		wlYamlIsAFile.setLayoutData(fdlXMLIsAFile);

		wYAMLIsAFile = new Button(wOutputField, SWT.CHECK);
		props.setLook(wYAMLIsAFile);
		wYAMLIsAFile.setToolTipText(BaseMessages.getString(PKG, "YamlInputDialog.XMLIsAFile.Tooltip"));
		fdYAMLIsAFile = new FormData();
		fdYAMLIsAFile.left = new FormAttachment(middle, -margin);
		fdYAMLIsAFile.top = new FormAttachment(wYAMLStreamField, margin);
		wYAMLIsAFile.setLayoutData(fdYAMLIsAFile);
		SelectionAdapter lsyamlisafile = new SelectionAdapter()
        {
            public void widgetSelected(SelectionEvent arg0)
            {
            	input.setChanged();
            	enableFileSettings();
            }
        };
        wYAMLIsAFile.addSelectionListener(lsyamlisafile);

		// If XML string defined in a Field
		wlYamlField=new Label(wOutputField, SWT.RIGHT);
        wlYamlField.setText(BaseMessages.getString(PKG, "YamlInputDialog.wlYamlField.Label"));
        props.setLook(wlYamlField);
        fdlXMLField=new FormData();
        fdlXMLField.left = new FormAttachment(0, -margin);
        fdlXMLField.top  = new FormAttachment(wYAMLIsAFile, margin);
        fdlXMLField.right= new FormAttachment(middle, -2*margin);
        wlYamlField.setLayoutData(fdlXMLField);

        wYAMLLField=new CCombo(wOutputField, SWT.BORDER | SWT.READ_ONLY);
        wYAMLLField.setEditable(true);
        props.setLook(wYAMLLField);
        wYAMLLField.addModifyListener(lsMod);
        fdXMLField=new FormData();
        fdXMLField.left = new FormAttachment(middle, -margin);
        fdXMLField.top  = new FormAttachment(wYAMLIsAFile, margin);
        fdXMLField.right= new FormAttachment(100, -margin);
        wYAMLLField.setLayoutData(fdXMLField);
        wYAMLLField.addFocusListener(new FocusListener()
            {
                public void focusLost(org.eclipse.swt.events.FocusEvent e)
                {
                }

                public void focusGained(org.eclipse.swt.events.FocusEvent e)
                {
                    Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
                    shell.setCursor(busy);
                    setXMLStreamField();
                    shell.setCursor(null);
                    busy.dispose();
                }
            }
        );

		fdOutputField = new FormData();
		fdOutputField.left = new FormAttachment(0, margin);
		fdOutputField.top = new FormAttachment(wFilenameList, margin);
		fdOutputField.right = new FormAttachment(100, -margin);
		wOutputField.setLayoutData(fdOutputField);

		// ///////////////////////////////////////////////////////////
		// / END OF Output Field GROUP
		// ///////////////////////////////////////////////////////////

		// Filename line
		wlFilename=new Label(wFileComp, SWT.RIGHT);
		wlFilename.setText(BaseMessages.getString(PKG, "YamlInputDialog.Filename.Label"));
 		props.setLook(wlFilename);
		fdlFilename=new FormData();
		fdlFilename.left = new FormAttachment(0, 0);
		fdlFilename.top  = new FormAttachment(wOutputField, margin);
		fdlFilename.right= new FormAttachment(middle, -margin);
		wlFilename.setLayoutData(fdlFilename);

		wbbFilename=new Button(wFileComp, SWT.PUSH| SWT.CENTER);
 		props.setLook(wbbFilename);
		wbbFilename.setText(BaseMessages.getString(PKG, "YamlInputDialog.FilenameBrowse.Button"));
		wbbFilename.setToolTipText(BaseMessages.getString(PKG, "System.Tooltip.BrowseForFileOrDirAndAdd"));
		fdbFilename=new FormData();
		fdbFilename.right= new FormAttachment(100, 0);
		fdbFilename.top  = new FormAttachment(wOutputField, margin);
		wbbFilename.setLayoutData(fdbFilename);

		wbaFilename=new Button(wFileComp, SWT.PUSH| SWT.CENTER);
 		props.setLook(wbaFilename);
		wbaFilename.setText(BaseMessages.getString(PKG, "YamlInputDialog.FilenameAdd.Button"));
		wbaFilename.setToolTipText(BaseMessages.getString(PKG, "YamlInputDialog.FilenameAdd.Tooltip"));
		fdbaFilename=new FormData();
		fdbaFilename.right= new FormAttachment(wbbFilename, -margin);
		fdbaFilename.top  = new FormAttachment(wOutputField, margin);
		wbaFilename.setLayoutData(fdbaFilename);

		wFilename=new TextVar(transMeta,wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
 		props.setLook(wFilename);
		wFilename.addModifyListener(lsMod);
		fdFilename=new FormData();
		fdFilename.left = new FormAttachment(middle, 0);
		fdFilename.right= new FormAttachment(wbaFilename, -margin);
		fdFilename.top  = new FormAttachment(wOutputField, margin);
		wFilename.setLayoutData(fdFilename);

		wlFilemask=new Label(wFileComp, SWT.RIGHT);
		wlFilemask.setText(BaseMessages.getString(PKG, "YamlInputDialog.RegExp.Label"));
 		props.setLook(wlFilemask);
		fdlFilemask=new FormData();
		fdlFilemask.left = new FormAttachment(0, 0);
		fdlFilemask.top  = new FormAttachment(wFilename, margin);
		fdlFilemask.right= new FormAttachment(middle, -margin);
		wlFilemask.setLayoutData(fdlFilemask);
		wFilemask=new TextVar(transMeta,wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
 		props.setLook(wFilemask);
		wFilemask.addModifyListener(lsMod);
		fdFilemask=new FormData();
		fdFilemask.left = new FormAttachment(middle, 0);
		fdFilemask.top  = new FormAttachment(wFilename, margin);
		fdFilemask.right= new FormAttachment(100, 0);
		wFilemask.setLayoutData(fdFilemask);

		// Filename list line
		wlFilenameList=new Label(wFileComp, SWT.RIGHT);
		wlFilenameList.setText(BaseMessages.getString(PKG, "YamlInputDialog.FilenameList.Label"));
 		props.setLook(wlFilenameList);
		fdlFilenameList=new FormData();
		fdlFilenameList.left = new FormAttachment(0, 0);
		fdlFilenameList.top  = new FormAttachment(wFilemask, margin);
		fdlFilenameList.right= new FormAttachment(middle, -margin);
		wlFilenameList.setLayoutData(fdlFilenameList);

		// Buttons to the right of the screen...
		wbdFilename=new Button(wFileComp, SWT.PUSH| SWT.CENTER);
 		props.setLook(wbdFilename);
		wbdFilename.setText(BaseMessages.getString(PKG, "YamlInputDialog.FilenameRemove.Button"));
		wbdFilename.setToolTipText(BaseMessages.getString(PKG, "YamlInputDialog.FilenameRemove.Tooltip"));
		fdbdFilename=new FormData();
		fdbdFilename.right = new FormAttachment(100, 0);
		fdbdFilename.top  = new FormAttachment (wFilemask, 40);
		wbdFilename.setLayoutData(fdbdFilename);

		wbeFilename=new Button(wFileComp, SWT.PUSH| SWT.CENTER);
 		props.setLook(wbeFilename);
		wbeFilename.setText(BaseMessages.getString(PKG, "YamlInputDialog.FilenameEdit.Button"));
		wbeFilename.setToolTipText(BaseMessages.getString(PKG, "YamlInputDialog.FilenameEdit.Tooltip"));
		fdbeFilename=new FormData();
		fdbeFilename.right = new FormAttachment(100, 0);
		fdbeFilename.left  = new FormAttachment(wbdFilename, 0, SWT.LEFT);
		fdbeFilename.top   = new FormAttachment (wbdFilename, margin);
		wbeFilename.setLayoutData(fdbeFilename);

		wbShowFiles=new Button(wFileComp, SWT.PUSH| SWT.CENTER);
 		props.setLook(wbShowFiles);
		wbShowFiles.setText(BaseMessages.getString(PKG, "YamlInputDialog.ShowFiles.Button"));
		fdbShowFiles=new FormData();
		fdbShowFiles.left   = new FormAttachment(middle, 0);
		fdbShowFiles.bottom = new FormAttachment(100, 0);
		wbShowFiles.setLayoutData(fdbShowFiles);

		ColumnInfo[] colinfo=new ColumnInfo[4];
		colinfo[ 0]=new ColumnInfo( BaseMessages.getString(PKG, "YamlInputDialog.Files.Filename.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false);
		colinfo[ 1]=new ColumnInfo( BaseMessages.getString(PKG, "YamlInputDialog.Files.Wildcard.Column"),ColumnInfo.COLUMN_TYPE_TEXT, false );

		colinfo[0].setUsingVariables(true);
		colinfo[1].setUsingVariables(true);
		colinfo[1].setToolTip(BaseMessages.getString(PKG, "YamlInputDialog.Files.Wildcard.Tooltip"));
		colinfo[2]=new ColumnInfo(BaseMessages.getString(PKG, "YamlInputDialog.Required.Column"),ColumnInfo.COLUMN_TYPE_CCOMBO,  YamlInputMeta.RequiredFilesDesc);
		colinfo[2].setToolTip(BaseMessages.getString(PKG, "YamlInputDialog.Required.Tooltip"));
		colinfo[3]=new ColumnInfo(BaseMessages.getString(PKG, "YamlInputDialog.IncludeSubDirs.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO,  YamlInputMeta.RequiredFilesDesc );
		colinfo[3].setToolTip(BaseMessages.getString(PKG, "YamlInputDialog.IncludeSubDirs.Tooltip"));

		wFilenameList = new TableView(transMeta,wFileComp,
						      SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER,
						      colinfo,
						      2,
						      lsMod,
							  props
						      );
 		props.setLook(wFilenameList);
		fdFilenameList=new FormData();
		fdFilenameList.left   = new FormAttachment(middle, 0);
		fdFilenameList.right  = new FormAttachment(wbdFilename, -margin);
		fdFilenameList.top    = new FormAttachment(wFilemask, margin);
		fdFilenameList.bottom = new FormAttachment(wbShowFiles, -margin);
		wFilenameList.setLayoutData(fdFilenameList);

		fdFileComp=new FormData();
		fdFileComp.left  = new FormAttachment(0, 0);
		fdFileComp.top   = new FormAttachment(0, 0);
		fdFileComp.right = new FormAttachment(100, 0);
		fdFileComp.bottom= new FormAttachment(100, 0);
		wFileComp.setLayoutData(fdFileComp);

		wFileComp.layout();
		wFileTab.setControl(wFileComp);

		/////////////////////////////////////////////////////////////
		/// END OF FILE TAB
		/////////////////////////////////////////////////////////////

		//////////////////////////
		// START OF CONTENT TAB///
		///
		wContentTab=new CTabItem(wTabFolder, SWT.NONE);
		wContentTab.setText(BaseMessages.getString(PKG, "YamlInputDialog.Content.Tab"));

		FormLayout contentLayout = new FormLayout ();
		contentLayout.marginWidth  = 3;
		contentLayout.marginHeight = 3;

		wContentComp = new Composite(wTabFolder, SWT.NONE);
 		props.setLook(wContentComp);
		wContentComp.setLayout(contentLayout);

		// ///////////////////////////////
		// START OF XmlConf Field GROUP  //
		/////////////////////////////////

		wXmlConf = new Group(wContentComp, SWT.SHADOW_NONE);
		props.setLook(wXmlConf);
		wXmlConf.setText(BaseMessages.getString(PKG, "YamlInputDialog.wXmlConf.Label"));

		FormLayout XmlConfgroupLayout = new FormLayout();
		XmlConfgroupLayout.marginWidth = 10;
		XmlConfgroupLayout.marginHeight = 10;
		wXmlConf.setLayout(XmlConfgroupLayout);

		 // Ignore Empty File
		wlIgnoreEmptyFile=new Label(wXmlConf, SWT.RIGHT);
		wlIgnoreEmptyFile.setText(BaseMessages.getString(PKG, "YamlInputDialog.IgnoreEmptyFile.Label"));
 		props.setLook(wlIgnoreEmptyFile);
		fdlIgnoreEmptyFile=new FormData();
		fdlIgnoreEmptyFile.left = new FormAttachment(0, 0);
		fdlIgnoreEmptyFile.top  = new FormAttachment(0, margin);
		fdlIgnoreEmptyFile.right= new FormAttachment(middle, -margin);
		wlIgnoreEmptyFile.setLayoutData(fdlIgnoreEmptyFile);
		wIgnoreEmptyFile=new Button(wXmlConf, SWT.CHECK );
 		props.setLook(wIgnoreEmptyFile);
		wIgnoreEmptyFile.setToolTipText(BaseMessages.getString(PKG, "YamlInputDialog.IgnoreEmptyFile.Tooltip"));
		fdIgnoreEmptyFile=new FormData();
		fdIgnoreEmptyFile.left = new FormAttachment(middle, 0);
		fdIgnoreEmptyFile.top  = new FormAttachment(0, margin);
		wIgnoreEmptyFile.setLayoutData(fdIgnoreEmptyFile);

		 // do not fail if no files?
		wldoNotFailIfNoFile=new Label(wXmlConf, SWT.RIGHT);
		wldoNotFailIfNoFile.setText(BaseMessages.getString(PKG, "YamlInputDialog.doNotFailIfNoFile.Label"));
 		props.setLook(wldoNotFailIfNoFile);
		fdldoNotFailIfNoFile=new FormData();
		fdldoNotFailIfNoFile.left = new FormAttachment(0, 0);
		fdldoNotFailIfNoFile.top  = new FormAttachment(wIgnoreEmptyFile, margin);
		fdldoNotFailIfNoFile.right= new FormAttachment(middle, -margin);
		wldoNotFailIfNoFile.setLayoutData(fdldoNotFailIfNoFile);
		wdoNotFailIfNoFile=new Button(wXmlConf, SWT.CHECK );
 		props.setLook(wdoNotFailIfNoFile);
		wdoNotFailIfNoFile.setToolTipText(BaseMessages.getString(PKG, "YamlInputDialog.doNotFailIfNoFile.Tooltip"));
		fddoNotFailIfNoFile=new FormData();
		fddoNotFailIfNoFile.left = new FormAttachment(middle, 0);
		fddoNotFailIfNoFile.top  = new FormAttachment(wIgnoreEmptyFile, margin);
		wdoNotFailIfNoFile.setLayoutData(fddoNotFailIfNoFile);

		wlLimit=new Label(wXmlConf, SWT.RIGHT);
		wlLimit.setText(BaseMessages.getString(PKG, "YamlInputDialog.Limit.Label"));
 		props.setLook(wlLimit);
		fdlLimit=new FormData();
		fdlLimit.left = new FormAttachment(0, 0);
		fdlLimit.top  = new FormAttachment(wdoNotFailIfNoFile, margin);
		fdlLimit.right= new FormAttachment(middle, -margin);
		wlLimit.setLayoutData(fdlLimit);
		wLimit=new Text(wXmlConf, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
 		props.setLook(wLimit);
		wLimit.addModifyListener(lsMod);
		fdLimit=new FormData();
		fdLimit.left = new FormAttachment(middle, 0);
		fdLimit.top  = new FormAttachment(wdoNotFailIfNoFile, margin);
		fdLimit.right= new FormAttachment(100, 0);
		wLimit.setLayoutData(fdLimit);

		fdXmlConf = new FormData();
		fdXmlConf.left = new FormAttachment(0, margin);
		fdXmlConf.top = new FormAttachment(0, margin);
		fdXmlConf.right = new FormAttachment(100, -margin);
		wXmlConf.setLayoutData(fdXmlConf);

		// ///////////////////////////////////////////////////////////
		// / END OF XmlConf Field GROUP
		// ///////////////////////////////////////////////////////////

    	// ///////////////////////////////
		// START OF Additional Fields GROUP  //
		/////////////////////////////////

		wAdditionalFields = new Group(wContentComp, SWT.SHADOW_NONE);
		props.setLook(wAdditionalFields);
		wAdditionalFields.setText(BaseMessages.getString(PKG, "YamlInputDialog.wAdditionalFields.Label"));

		FormLayout AdditionalFieldsgroupLayout = new FormLayout();
		AdditionalFieldsgroupLayout.marginWidth = 10;
		AdditionalFieldsgroupLayout.marginHeight = 10;
		wAdditionalFields.setLayout(AdditionalFieldsgroupLayout);

		wlInclFilename=new Label(wAdditionalFields, SWT.RIGHT);
		wlInclFilename.setText(BaseMessages.getString(PKG, "YamlInputDialog.InclFilename.Label"));
 		props.setLook(wlInclFilename);
		fdlInclFilename=new FormData();
		fdlInclFilename.left = new FormAttachment(0, 0);
		fdlInclFilename.top  = new FormAttachment(wXmlConf, 4*margin);
		fdlInclFilename.right= new FormAttachment(middle, -margin);
		wlInclFilename.setLayoutData(fdlInclFilename);
		wInclFilename=new Button(wAdditionalFields, SWT.CHECK );
 		props.setLook(wInclFilename);
		wInclFilename.setToolTipText(BaseMessages.getString(PKG, "YamlInputDialog.InclFilename.Tooltip"));
		fdInclFilename=new FormData();
		fdInclFilename.left = new FormAttachment(middle, 0);
		fdInclFilename.top  = new FormAttachment(wXmlConf, 4*margin);
		wInclFilename.setLayoutData(fdInclFilename);

		wlInclFilenameField=new Label(wAdditionalFields, SWT.LEFT);
		wlInclFilenameField.setText(BaseMessages.getString(PKG, "YamlInputDialog.InclFilenameField.Label"));
 		props.setLook(wlInclFilenameField);
		fdlInclFilenameField=new FormData();
		fdlInclFilenameField.left = new FormAttachment(wInclFilename, margin);
		fdlInclFilenameField.top  = new FormAttachment(wLimit, 4*margin);
		wlInclFilenameField.setLayoutData(fdlInclFilenameField);
		wInclFilenameField=new TextVar(transMeta,wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
 		props.setLook(wInclFilenameField);
		wInclFilenameField.addModifyListener(lsMod);
		fdInclFilenameField=new FormData();
		fdInclFilenameField.left = new FormAttachment(wlInclFilenameField, margin);
		fdInclFilenameField.top  = new FormAttachment(wLimit, 4*margin);
		fdInclFilenameField.right= new FormAttachment(100, 0);
		wInclFilenameField.setLayoutData(fdInclFilenameField);

		wlInclRownum=new Label(wAdditionalFields, SWT.RIGHT);
		wlInclRownum.setText(BaseMessages.getString(PKG, "YamlInputDialog.InclRownum.Label"));
 		props.setLook(wlInclRownum);
		fdlInclRownum=new FormData();
		fdlInclRownum.left = new FormAttachment(0, 0);
		fdlInclRownum.top  = new FormAttachment(wInclFilenameField, margin);
		fdlInclRownum.right= new FormAttachment(middle, -margin);
		wlInclRownum.setLayoutData(fdlInclRownum);
		wInclRownum=new Button(wAdditionalFields, SWT.CHECK );
 		props.setLook(wInclRownum);
		wInclRownum.setToolTipText(BaseMessages.getString(PKG, "YamlInputDialog.InclRownum.Tooltip"));
		fdRownum=new FormData();
		fdRownum.left = new FormAttachment(middle, 0);
		fdRownum.top  = new FormAttachment(wInclFilenameField, margin);
		wInclRownum.setLayoutData(fdRownum);

		wlInclRownumField=new Label(wAdditionalFields, SWT.RIGHT);
		wlInclRownumField.setText(BaseMessages.getString(PKG, "YamlInputDialog.InclRownumField.Label"));
 		props.setLook(wlInclRownumField);
		fdlInclRownumField=new FormData();
		fdlInclRownumField.left = new FormAttachment(wInclRownum, margin);
		fdlInclRownumField.top  = new FormAttachment(wInclFilenameField, margin);
		wlInclRownumField.setLayoutData(fdlInclRownumField);
		wInclRownumField=new TextVar(transMeta,wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
 		props.setLook(wInclRownumField);
		wInclRownumField.addModifyListener(lsMod);
		fdInclRownumField=new FormData();
		fdInclRownumField.left = new FormAttachment(wlInclRownumField, margin);
		fdInclRownumField.top  = new FormAttachment(wInclFilenameField, margin);
		fdInclRownumField.right= new FormAttachment(100, 0);
		wInclRownumField.setLayoutData(fdInclRownumField);

		fdAdditionalFields = new FormData();
		fdAdditionalFields.left = new FormAttachment(0, margin);
		fdAdditionalFields.top = new FormAttachment(wXmlConf, margin);
		fdAdditionalFields.right = new FormAttachment(100, -margin);
		wAdditionalFields.setLayoutData(fdAdditionalFields);

		// ///////////////////////////////////////////////////////////
		// / END OF Additional Fields GROUP
		// ///////////////////////////////////////////////////////////

		// ///////////////////////////////
		// START OF AddFileResult GROUP  //
		/////////////////////////////////

		wAddFileResult = new Group(wContentComp, SWT.SHADOW_NONE);
		props.setLook(wAddFileResult);
		wAddFileResult.setText(BaseMessages.getString(PKG, "YamlInputDialog.wAddFileResult.Label"));

		FormLayout AddFileResultgroupLayout = new FormLayout();
		AddFileResultgroupLayout.marginWidth = 10;
		AddFileResultgroupLayout.marginHeight = 10;
		wAddFileResult.setLayout(AddFileResultgroupLayout);

		wlAddResult=new Label(wAddFileResult, SWT.RIGHT);
		wlAddResult.setText(BaseMessages.getString(PKG, "YamlInputDialog.AddResult.Label"));
 		props.setLook(wlAddResult);
		fdlAddResult=new FormData();
		fdlAddResult.left = new FormAttachment(0, 0);
		fdlAddResult.top  = new FormAttachment(wAdditionalFields, margin);
		fdlAddResult.right= new FormAttachment(middle, -margin);
		wlAddResult.setLayoutData(fdlAddResult);
		wAddResult=new Button(wAddFileResult, SWT.CHECK );
 		props.setLook(wAddResult);
		wAddResult.setToolTipText(BaseMessages.getString(PKG, "YamlInputDialog.AddResult.Tooltip"));
		fdAddResult=new FormData();
		fdAddResult.left = new FormAttachment(middle, 0);
		fdAddResult.top  = new FormAttachment(wAdditionalFields, margin);
		wAddResult.setLayoutData(fdAddResult);

		fdAddFileResult = new FormData();
		fdAddFileResult.left = new FormAttachment(0, margin);
		fdAddFileResult.top = new FormAttachment(wAdditionalFields, margin);
		fdAddFileResult.right = new FormAttachment(100, -margin);
		wAddFileResult.setLayoutData(fdAddFileResult);

		// ///////////////////////////////////////////////////////////
		// / END OF AddFileResult GROUP
		// ///////////////////////////////////////////////////////////

		fdContentComp = new FormData();
		fdContentComp.left  = new FormAttachment(0, 0);
		fdContentComp.top   = new FormAttachment(0, 0);
		fdContentComp.right = new FormAttachment(100, 0);
		fdContentComp.bottom= new FormAttachment(100, 0);
		wContentComp.setLayoutData(fdContentComp);

		wContentComp.layout();
		wContentTab.setControl(wContentComp);

		// ///////////////////////////////////////////////////////////
		// / END OF CONTENT TAB
		// ///////////////////////////////////////////////////////////

		// Fields tab...
		//
		wFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
		wFieldsTab.setText(BaseMessages.getString(PKG, "YamlInputDialog.Fields.Tab"));

		FormLayout fieldsLayout = new FormLayout ();
		fieldsLayout.marginWidth  = Const.FORM_MARGIN;
		fieldsLayout.marginHeight = Const.FORM_MARGIN;

		wFieldsComp = new Composite(wTabFolder, SWT.NONE);
		wFieldsComp.setLayout(fieldsLayout);
 		props.setLook(wFieldsComp);

		wGet=new Button(wFieldsComp, SWT.PUSH);
		wGet.setText(BaseMessages.getString(PKG, "YamlInputDialog.GetFields.Button"));
		fdGet=new FormData();
		fdGet.left=new FormAttachment(50, 0);
		fdGet.bottom =new FormAttachment(100, 0);
		wGet.setLayoutData(fdGet);

		final int FieldsRows=input.getInputFields().length;

		ColumnInfo[] colinf=new ColumnInfo[]
            {
			 new ColumnInfo(
         BaseMessages.getString(PKG, "YamlInputDialog.FieldsTable.Name.Column"),
         ColumnInfo.COLUMN_TYPE_TEXT,
         false),
         new ColumnInfo(
                 BaseMessages.getString(PKG, "YamlInputDialog.FieldsTable.XPath.Column"),
                 ColumnInfo.COLUMN_TYPE_TEXT,
                 false),
			 new ColumnInfo(
         BaseMessages.getString(PKG, "YamlInputDialog.FieldsTable.Type.Column"),
         ColumnInfo.COLUMN_TYPE_CCOMBO,
         ValueMeta.getTypes(),
         true ),
			 new ColumnInfo(
         BaseMessages.getString(PKG, "YamlInputDialog.FieldsTable.Format.Column"),
         ColumnInfo.COLUMN_TYPE_FORMAT,
         4),
			 new ColumnInfo(
         BaseMessages.getString(PKG, "YamlInputDialog.FieldsTable.Length.Column"),
         ColumnInfo.COLUMN_TYPE_TEXT,
         false),
			 new ColumnInfo(
         BaseMessages.getString(PKG, "YamlInputDialog.FieldsTable.Precision.Column"),
         ColumnInfo.COLUMN_TYPE_TEXT,
         false),
			 new ColumnInfo(
         BaseMessages.getString(PKG, "YamlInputDialog.FieldsTable.Currency.Column"),
         ColumnInfo.COLUMN_TYPE_TEXT,
         false),
			 new ColumnInfo(
         BaseMessages.getString(PKG, "YamlInputDialog.FieldsTable.Decimal.Column"),
         ColumnInfo.COLUMN_TYPE_TEXT,
         false),
			 new ColumnInfo(
         BaseMessages.getString(PKG, "YamlInputDialog.FieldsTable.Group.Column"),
         ColumnInfo.COLUMN_TYPE_TEXT,
         false),
			 new ColumnInfo(
         BaseMessages.getString(PKG, "YamlInputDialog.FieldsTable.TrimType.Column"),
         ColumnInfo.COLUMN_TYPE_CCOMBO,
         YamlInputField.trimTypeDesc,
         true )
    };

		colinf[0].setUsingVariables(true);
		colinf[0].setToolTip(BaseMessages.getString(PKG, "YamlInputDialog.FieldsTable.Name.Column.Tooltip"));
		colinf[1].setUsingVariables(true);
		colinf[1].setToolTip(BaseMessages.getString(PKG, "YamlInputDialog.FieldsTable.XPath.Column.Tooltip"));

		wFields=new TableView(transMeta,wFieldsComp,
						      SWT.FULL_SELECTION | SWT.MULTI,
						      colinf,
						      FieldsRows,
						      lsMod,
							  props
						      );

		fdFields=new FormData();
		fdFields.left  = new FormAttachment(0, 0);
		fdFields.top   = new FormAttachment(0, 0);
		fdFields.right = new FormAttachment(100, 0);
		fdFields.bottom= new FormAttachment(wGet, -margin);
		wFields.setLayoutData(fdFields);

		fdFieldsComp=new FormData();
		fdFieldsComp.left  = new FormAttachment(0, 0);
		fdFieldsComp.top   = new FormAttachment(0, 0);
		fdFieldsComp.right = new FormAttachment(100, 0);
		fdFieldsComp.bottom= new FormAttachment(100, 0);
		wFieldsComp.setLayoutData(fdFieldsComp);

		wFieldsComp.layout();
		wFieldsTab.setControl(wFieldsComp);

		fdTabFolder = new FormData();
		fdTabFolder.left  = new FormAttachment(0, 0);
		fdTabFolder.top   = new FormAttachment(wStepname, margin);
		fdTabFolder.right = new FormAttachment(100, 0);
		fdTabFolder.bottom= new FormAttachment(100, -50);
		wTabFolder.setLayoutData(fdTabFolder);

		wOK=new Button(shell, SWT.PUSH);
		wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));

		wPreview=new Button(shell, SWT.PUSH);
		wPreview.setText(BaseMessages.getString(PKG, "YamlInputDialog.Button.PreviewRows"));

		wCancel=new Button(shell, SWT.PUSH);
		wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));

		setButtonPositions(new Button[] { wOK, wPreview, wCancel }, margin, wTabFolder);

		// Add listeners
		lsOK       = new Listener() { public void handleEvent(Event e) { ok();     } };
		lsGet      = new Listener() { public void handleEvent(Event e) { get();      } };
		lsPreview  = new Listener() { public void handleEvent(Event e) { preview();   } };
		lsCancel   = new Listener() { public void handleEvent(Event e) { cancel();     } };

		wOK.addListener     (SWT.Selection, lsOK     );
		wGet.addListener    (SWT.Selection, lsGet    );
		wPreview.addListener(SWT.Selection, lsPreview);
		wCancel.addListener (SWT.Selection, lsCancel );

		lsDef=new SelectionAdapter() { public void widgetDefaultSelected(SelectionEvent e) { ok(); } };

		wStepname.addSelectionListener( lsDef );
		wLimit.addSelectionListener( lsDef );
		wInclRownumField.addSelectionListener( lsDef );
		wInclFilenameField.addSelectionListener( lsDef );

		// Add the file to the list of files...
		SelectionAdapter selA = new SelectionAdapter()
		{
			public void widgetSelected(SelectionEvent arg0)
			{
				wFilenameList.add(new String[] { wFilename.getText(), wFilemask.getText() } );
				wFilename.setText("");
				wFilemask.setText("");
				wFilenameList.removeEmptyRows();
				wFilenameList.setRowNums();
                wFilenameList.optWidth(true);
			}
		};
		wbaFilename.addSelectionListener(selA);
		wFilename.addSelectionListener(selA);

		// Delete files from the list of files...
		wbdFilename.addSelectionListener(new SelectionAdapter()
		{
			public void widgetSelected(SelectionEvent arg0)
			{
				int idx[] = wFilenameList.getSelectionIndices();
				wFilenameList.remove(idx);
				wFilenameList.removeEmptyRows();
				wFilenameList.setRowNums();
			}
		});

		// Edit the selected file & remove from the list...
		wbeFilename.addSelectionListener(new SelectionAdapter()
		{
			public void widgetSelected(SelectionEvent arg0)
			{
				int idx = wFilenameList.getSelectionIndex();
				if (idx>=0)
				{
					String string[] = wFilenameList.getItem(idx);
					wFilename.setText(string[0]);
					wFilemask.setText(string[1]);
					wFilenameList.remove(idx);
				}
				wFilenameList.removeEmptyRows();
				wFilenameList.setRowNums();
			}
		});

		// Show the files that are selected at this time...
		wbShowFiles.addSelectionListener(new SelectionAdapter()
			{
				public void widgetSelected(SelectionEvent e)
				{
                    try
                    {
    					YamlInputMeta tfii = new YamlInputMeta();
    					getInfo(tfii);
                        FileInputList fileInputList = tfii.getFiles(transMeta);
    					String files[] = fileInputList.getFileStrings();
    					if (files!=null && files.length>0)
    					{
    						EnterSelectionDialog esd = new EnterSelectionDialog(shell, files, BaseMessages.getString(PKG, "YamlInputDialog.FilesReadSelection.DialogTitle"), BaseMessages.getString(PKG, "YamlInputDialog.FilesReadSelection.DialogMessage"));
    						esd.setViewOnly();
    						esd.open();
    					}
    					else
    					{
    						MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR );
    						mb.setMessage(BaseMessages.getString(PKG, "YamlInputDialog.NoFileFound.DialogMessage"));
    						mb.setText(BaseMessages.getString(PKG, "System.Dialog.Error.Title"));
    						mb.open();
    					}
                    }
                    catch(KettleException ex)
                    {
                        new ErrorDialog(shell, BaseMessages.getString(PKG, "YamlInputDialog.ErrorParsingData.DialogTitle"), BaseMessages.getString(PKG, "YamlInputDialog.ErrorParsingData.DialogMessage"), ex);
                    }
				}
			}
		);
		// Enable/disable the right fields to allow a filename to be added to each row...
		wInclFilename.addSelectionListener(new SelectionAdapter()
			{
				public void widgetSelected(SelectionEvent e)
				{
					setIncludeFilename();
				}
			}
		);

		// Enable/disable the right fields to allow a row number to be added to each row...
		wInclRownum.addSelectionListener(new SelectionAdapter()
			{
				public void widgetSelected(SelectionEvent e)
				{
					setIncludeRownum();
				}
			}
		);

		// Whenever something changes, set the tooltip to the expanded version of the filename:
		wFilename.addModifyListener(new ModifyListener()
			{
				public void modifyText(ModifyEvent e)
				{
					wFilename.setToolTipText(wFilename.getText());
				}
			}
		);

		// Listen to the Browse... button
		wbbFilename.addSelectionListener
		(
			new SelectionAdapter()
			{
				public void widgetSelected(SelectionEvent e)
				{
					if (wFilemask.getText()!=null && wFilemask.getText().length()>0) // A mask: a directory!
					{
						DirectoryDialog dialog = new DirectoryDialog(shell, SWT.OPEN);
						if (wFilename.getText()!=null)
						{
							String fpath = transMeta.environmentSubstitute(wFilename.getText());
							dialog.setFilterPath( fpath );
						}

						if (dialog.open()!=null)
						{
							String str= dialog.getFilterPath();
							wFilename.setText(str);
						}
					}
					else
					{
						FileDialog dialog = new FileDialog(shell, SWT.OPEN);
						dialog.setFilterExtensions(new String[] {"*.yaml;*.YAML", "*"});
						if (wFilename.getText()!=null)
						{
							String fname = transMeta.environmentSubstitute(wFilename.getText());
							dialog.setFileName( fname );
						}

						dialog.setFilterNames(new String[] {BaseMessages.getString(PKG, "System.FileType.YAMLFiles"), BaseMessages.getString(PKG, "System.FileType.AllFiles")});

						if (dialog.open()!=null)
						{
							String str = dialog.getFilterPath()+System.getProperty("file.separator")+dialog.getFileName();
							wFilename.setText(str);
						}
					}
				}
			}
		);

		// Detect X or ALT-F4 or something that kills this window...
		shell.addShellListener(	new ShellAdapter() { public void shellClosed(ShellEvent e) { cancel(); } } );

		wTabFolder.setSelection(0);

		// Set the shell size, based upon previous time...
		setSize();
		getData(input);
		ActiveStreamField();
		setIncludeFilename();
		setIncludeRownum();
		input.setChanged(changed);
		wFields.optWidth(true);

		shell.open();
		while (!shell.isDisposed())
		{
				if (!display.readAndDispatch()) display.sleep();
		}
		return stepname;
	}

	 private void setXMLStreamField()
	 {
		 try{

			 wYAMLLField.removeAll();

			 RowMetaInterface r = transMeta.getPrevStepFields(stepname);
				if (r!=null)
				{
		             r.getFieldNames();

		             for (int i=0;i<r.getFieldNames().length;i++)
						{
		            	 wYAMLLField.add(r.getFieldNames()[i]);

						}
				}
		 }catch(KettleException ke){
				new ErrorDialog(shell, BaseMessages.getString(PKG, "YamlInputDialog.FailedToGetFields.DialogTitle"), BaseMessages.getString(PKG, "YamlInputDialog.FailedToGetFields.DialogMessage"), ke); //$NON-NLS-1$ //$NON-NLS-2$
			}
	 }

	private void ActiveStreamField()
	{
		wlYamlField.setEnabled(wYAMLStreamField.getSelection());
		wYAMLLField.setEnabled(wYAMLStreamField.getSelection());
		wlYamlIsAFile.setEnabled(wYAMLStreamField.getSelection());
		wYAMLIsAFile.setEnabled(wYAMLStreamField.getSelection());

		wlFilename.setEnabled(!wYAMLStreamField.getSelection());
		wbbFilename.setEnabled(!wYAMLStreamField.getSelection());
		wbaFilename.setEnabled(!wYAMLStreamField.getSelection());
		wFilename.setEnabled(!wYAMLStreamField.getSelection());
		wlFilemask.setEnabled(!wYAMLStreamField.getSelection());
		wFilemask.setEnabled(!wYAMLStreamField.getSelection());
		wlFilenameList.setEnabled(!wYAMLStreamField.getSelection());
		wbdFilename.setEnabled(!wYAMLStreamField.getSelection());
		wbeFilename.setEnabled(!wYAMLStreamField.getSelection());
		wbShowFiles.setEnabled(!wYAMLStreamField.getSelection());
		wlFilenameList.setEnabled(!wYAMLStreamField.getSelection());
		wFilenameList.setEnabled(!wYAMLStreamField.getSelection());
		wInclFilename.setEnabled(!wYAMLStreamField.getSelection());
		wlInclFilename.setEnabled(!wYAMLStreamField.getSelection());

		if(wYAMLStreamField.getSelection())
		{
			wInclFilename.setSelection(false);
			wlInclFilenameField.setEnabled(false);
			wInclFilenameField.setEnabled(false);
		}else
		{
			wlInclFilenameField.setEnabled(wInclFilename.getSelection());
			wInclFilenameField.setEnabled(wInclFilename.getSelection());
		}

		wAddResult.setEnabled(!wYAMLStreamField.getSelection());
		wlAddResult.setEnabled(!wYAMLStreamField.getSelection());
		wLimit.setEnabled(!wYAMLStreamField.getSelection());
		wlLimit.setEnabled(!wYAMLStreamField.getSelection());
		wPreview.setEnabled(!wYAMLStreamField.getSelection());
		wGet.setEnabled(!wYAMLStreamField.getSelection());
		enableFileSettings();
	}
	private void enableFileSettings(){
		boolean active = !wYAMLStreamField.getSelection() || (wYAMLStreamField.getSelection() && wYAMLIsAFile.getSelection());
		wlIgnoreEmptyFile.setEnabled(active);
		wIgnoreEmptyFile.setEnabled(active);
		wldoNotFailIfNoFile.setEnabled(active);
		wdoNotFailIfNoFile.setEnabled(active);
	}
	private void get() {
		YamlReader yaml=null;
        try  {
        	YamlInputMeta meta = new YamlInputMeta();
        	getInfo(meta);

    		FileInputList inputList = meta.getFiles(transMeta);

    		if (inputList.getFiles().size()>0)  {
            	wFields.removeAll();

            	yaml = new YamlReader();
				yaml.loadFile(inputList.getFile(0));
				RowMeta row = yaml.getFields();

				for(int i=0; i<row.size(); i++) {
					ValueMetaInterface value = row.getValueMeta(i);

					TableItem item = new TableItem(wFields.table, SWT.NONE);
		            item.setText(1, value.getName());
		            item.setText(2, value.getName());
		    		item.setText(3, value.getTypeDesc());
				}
                wFields.removeEmptyRows();
                wFields.setRowNums();
                wFields.optWidth(true);
            }
        }
        catch(Exception e)
        {
            new ErrorDialog(shell, BaseMessages.getString(PKG, "YamlInputDialog.ErrorParsingData.DialogTitle"), BaseMessages.getString(PKG, "YamlInputDialog.ErrorParsingData.DialogMessage"), e);
        }finally {
        	if(yaml!=null) try { yaml.close();}catch(Exception e){};
        }
	}

	public void setIncludeFilename()
	{
		wlInclFilenameField.setEnabled(wInclFilename.getSelection());
		wInclFilenameField.setEnabled(wInclFilename.getSelection());
	}

	public void setIncludeRownum()
	{
		wlInclRownumField.setEnabled(wInclRownum.getSelection());
		wInclRownumField.setEnabled(wInclRownum.getSelection());
	}

	/**
	 * Read the data from the TextFileInputMeta object and show it in this dialog.
	 *
	 * @param in The TextFileInputMeta object to obtain the data from.
	 */
	public void getData(YamlInputMeta in)
	{
		if (in.getFileName() !=null)
		{
			wFilenameList.removeAll();

			for (int i=0;i<in.getFileName().length;i++)
			{
				wFilenameList.add(new String[] { in.getFileName()[i], in.getFileMask()[i] ,
						in.getRequiredFilesDesc(in.getFileRequired()[i]), in.getRequiredFilesDesc(in.getIncludeSubFolders()[i])} );
			}
			wFilenameList.removeEmptyRows();
			wFilenameList.setRowNums();
			wFilenameList.optWidth(true);
		}
		wInclFilename.setSelection(in.includeFilename());
		wInclRownum.setSelection(in.includeRowNumber());
		wAddResult.setSelection(in.addResultFile());
		wIgnoreEmptyFile.setSelection(in.isIgnoreEmptyFile());
		wdoNotFailIfNoFile.setSelection(in.isdoNotFailIfNoFile());
		wYAMLStreamField.setSelection(in.isInFields());
		wYAMLIsAFile.setSelection(in.getIsAFile());

		if (in.getYamlField()!=null) wYAMLLField.setText(in.getYamlField());

		if (in.getFilenameField()!=null) wInclFilenameField.setText(in.getFilenameField());
		if (in.getRowNumberField()!=null) wInclRownumField.setText(in.getRowNumberField());
		wLimit.setText(""+in.getRowLimit());

		if(isDebug()) logDebug(BaseMessages.getString(PKG, "YamlInputDialog.Log.GettingFieldsInfo"));
		for (int i=0;i<in.getInputFields().length;i++)
		{
		    YamlInputField field = in.getInputFields()[i];

            if (field!=null)
            {
    			TableItem item = wFields.table.getItem(i);
    			String name     = field.getName();
    			String path	= field.getPath();
    			String type     = field.getTypeDesc();
    			String format   = field.getFormat();
    			String length   = ""+field.getLength();
    			String prec     = ""+field.getPrecision();
    			String curr     = field.getCurrencySymbol();
    			String group    = field.getGroupSymbol();
    			String decim    = field.getDecimalSymbol();
    			String trim     = field.getTrimTypeDesc();

                if (name    !=null) item.setText( 1, name);
                if (path   !=null) item.setText( 2, path);
    			if (type    !=null) item.setText( 3, type    );
    			if (format  !=null) item.setText( 4, format  );
    			if (length  !=null && !"-1".equals(length  )) item.setText( 5, length  );
    			if (prec    !=null && !"-1".equals(prec    )) item.setText( 6, prec    );
    			if (curr    !=null) item.setText( 7, curr    );
    			if (decim   !=null) item.setText( 8, decim   );
    			if (group   !=null) item.setText( 9, group   );
    			if (trim    !=null) item.setText( 10, trim    );

            }
		}

        wFields.removeEmptyRows();
        wFields.setRowNums();
        wFields.optWidth(true);

		wStepname.selectAll();
	}

	private void cancel()
	{
		stepname=null;
		input.setChanged(changed);
		dispose();
	}

	private void ok()
	{
        try
        {
            getInfo(input);
        }
        catch(KettleException e)
        {
            new ErrorDialog(shell, BaseMessages.getString(PKG, "YamlInputDialog.ErrorParsingData.DialogTitle"), BaseMessages.getString(PKG, "YamlInputDialog.ErrorParsingData.DialogMessage"), e);
        }
		dispose();
	}

	private void getInfo(YamlInputMeta in) throws KettleException
	{
		stepname = wStepname.getText(); // return value

		// copy info to TextFileInputMeta class (input)
		in.setRowLimit( Const.toLong(wLimit.getText(), 0L) );
		in.setFilenameField( wInclFilenameField.getText() );
		in.setRowNumberField( wInclRownumField.getText() );
		in.setAddResultFile( wAddResult.getSelection() );
		in.setIncludeFilename( wInclFilename.getSelection() );
		in.setIncludeRowNumber( wInclRownum.getSelection() );
		in.setIgnoreEmptyFile(wIgnoreEmptyFile.getSelection() );
		in.setdoNotFailIfNoFile(wdoNotFailIfNoFile.getSelection());

		in.setInFields(wYAMLStreamField.getSelection());
		in.setIsAFile(wYAMLIsAFile.getSelection());
		in.setYamlField(wYAMLLField.getText());

		int nrFiles     = wFilenameList.getItemCount();
		int nrFields    = wFields.nrNonEmpty();

		in.allocate(nrFiles, nrFields);
		in.setFileName( wFilenameList.getItems(0) );
		in.setFileMask( wFilenameList.getItems(1) );
		in.setFileRequired(wFilenameList.getItems(2));
		in.setIncludeSubFolders(wFilenameList.getItems(3));

		for (int i=0;i<nrFields;i++)
		{
		    YamlInputField field = new YamlInputField();

			TableItem item  = wFields.getNonEmpty(i);

			field.setName( item.getText(1) );
			field.setPath( item.getText(2) );
			field.setType( ValueMeta.getType(item.getText(3)) );
			field.setFormat( item.getText(4) );
			field.setLength( Const.toInt(item.getText(5), -1) );
			field.setPrecision( Const.toInt(item.getText(6), -1) );
			field.setCurrencySymbol( item.getText(7) );
			field.setDecimalSymbol( item.getText(8) );
			field.setGroupSymbol( item.getText(9) );
			field.setTrimType( YamlInputField.getTrimTypeByDesc(item.getText(10)) );

			in.getInputFields()[i] = field;
		}
	}

	// Preview the data
	private void preview()
	{
        try
        {
            // Create the XML input step
            YamlInputMeta oneMeta = new YamlInputMeta();
            getInfo(oneMeta);

    		TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());

            EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "YamlInputDialog.NumberRows.DialogTitle"), BaseMessages.getString(PKG, "YamlInputDialog.NumberRows.DialogMessage"));

            int previewSize = numberDialog.open();
            if (previewSize>0)
            {
                TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { wStepname.getText() }, new int[] { previewSize } );
                progressDialog.open();

                if (!progressDialog.isCancelled())
                {
                    Trans trans = progressDialog.getTrans();
                    String loggingText = progressDialog.getLoggingText();

                    if (trans.getResult()!=null && trans.getResult().getNrErrors()>0)
                    {
                    	EnterTextDialog etd = new EnterTextDialog(shell, BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"),
                    			BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), loggingText, true );
                    	etd.setReadOnly();
                    	etd.open();
                    }
                    PreviewRowsDialog prd = new PreviewRowsDialog(shell, transMeta, SWT.NONE, wStepname.getText(),
							progressDialog.getPreviewRowsMeta(wStepname.getText()), progressDialog
									.getPreviewRows(wStepname.getText()), loggingText);
					prd.open();
                }
            }
        }
        catch(KettleException e)
        {
            new ErrorDialog(shell, BaseMessages.getString(PKG, "YamlInputDialog.ErrorPreviewingData.DialogTitle"), BaseMessages.getString(PKG, "YamlInputDialog.ErrorPreviewingData.DialogMessage"), e);
        }
	}
}


text:
module ActiveApi
  module HasDefinition
    def definition
      schema.definitions.detect do |definition|
        definition.definition_name == node.to_s.singularize.to_sym
      end
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
package com.deveyes.deveyestrial.common;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;

import com.deveyes.deveyestrial.MainActivity;
import com.deveyes.deveyestrial.R;
import com.squareup.picasso.Picasso;

import java.util.List;

/**
 * Created by jem88 - Marino Meneghel - on 5/13/15.
 * All rights reserved
 */
public class PhotosAdapter extends ArrayAdapter {

    private Context _context;

    public PhotosAdapter(Context context, int textViewResourceId, List<String> photoUrls) {
        super(context, textViewResourceId, photoUrls);
        _context = context;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        if (convertView == null) {
            LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = inflater.inflate(R.layout.custom_row_photo, null);
        }
        ImageView ivPhoto = (ImageView) convertView.findViewById(R.id.ivPhoto);
        String url = (String) getItem(position);
        Picasso.with(_context).load(url).into(ivPhoto);

        return convertView;
    }

}


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

  var app = angular.module('crossroads.core');
  app.config(AppConfig);

  AppConfig.$inject = [
    '$provide',
    '$httpProvider',
    '$locationProvider',
    'datepickerConfig',
    'datepickerPopupConfig',
    '$cookiesProvider'];

  function AppConfig($provide,
        $httpProvider,
        $locationProvider,
        datepickerConfig,
        datepickerPopupConfig,
        $cookiesProvider) {
    $provide.decorator('$state', function($delegate, $rootScope) {
      $rootScope.$on('$stateChangeStart', function(event, state, params) {
        $delegate.next = state;
        $delegate.toParams = params;
      });

      return $delegate;
    });

    $locationProvider.html5Mode({
      enabled:true,
      requireBase:false
    });

    $httpProvider.defaults.useXDomain = true;
    $httpProvider.defaults.headers.common.Authorization = crds_utilities.getCookie('sessionId');
    $httpProvider.defaults.headers.common.RefreshToken = crds_utilities.getCookie('refreshToken');

    // This is a dummy header that will always be returned
    // in any 'Allow-Header' from any CORS request
    //This needs to be here because of IE.
    $httpProvider.defaults.headers.common['X-Use-The-Force'] = true;

    configureDefaultCookieScope($cookiesProvider);
    configureDatePickersDefaults(datepickerConfig, datepickerPopupConfig);
  }

  var configureDefaultCookieScope =  function($cookiesProvider) {
    $cookiesProvider.defaults.path = '/';
  };

  var configureDatePickersDefaults = function(datepickerConfig, datepickerPopupConfig) {
    datepickerConfig.showWeeks = false;
    datepickerPopupConfig.showWeeks = false;
  };

})();


text:
namespace ar_track_alvar_msgs
{
template <class ContainerAllocator>
struct AlvarMarkers_
{
  typedef AlvarMarkers_<ContainerAllocator> Type;

  AlvarMarkers_()
    : header()
    , markers()  {
    }
  AlvarMarkers_(const ContainerAllocator& _alloc)
    : header(_alloc)
    , markers(_alloc)  {
  (void)_alloc;
    }

   typedef  ::std_msgs::Header_<ContainerAllocator>  _header_type;
  _header_type header;

   typedef std::vector< ::ar_track_alvar_msgs::AlvarMarker_<ContainerAllocator> , typename ContainerAllocator::template rebind< ::ar_track_alvar_msgs::AlvarMarker_<ContainerAllocator> >::other >  _markers_type;
  _markers_type markers;

  typedef boost::shared_ptr< ::ar_track_alvar_msgs::AlvarMarkers_<ContainerAllocator> > Ptr;
  typedef boost::shared_ptr< ::ar_track_alvar_msgs::AlvarMarkers_<ContainerAllocator> const> ConstPtr;

}; // struct AlvarMarkers_

typedef ::ar_track_alvar_msgs::AlvarMarkers_<std::allocator<void> > AlvarMarkers;

typedef boost::shared_ptr< ::ar_track_alvar_msgs::AlvarMarkers > AlvarMarkersPtr;
typedef boost::shared_ptr< ::ar_track_alvar_msgs::AlvarMarkers const> AlvarMarkersConstPtr;

// constants requiring out of line definition

template<typename ContainerAllocator>
std::ostream& operator<<(std::ostream& s, const ::ar_track_alvar_msgs::AlvarMarkers_<ContainerAllocator> & v)
{
ros::message_operations::Printer< ::ar_track_alvar_msgs::AlvarMarkers_<ContainerAllocator> >::stream(s, "", v);
return s;
}

} // namespace ar_track_alvar_msgs

namespace ros
{
namespace message_traits
{

// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': True}
// {'ar_track_alvar_msgs': ['/home/us-robot/catkin_ws/src/ar_track_alvar-kinetic-devel/ar_track_alvar_msgs/msg'], 'geometry_msgs': ['/opt/ros/kinetic/share/geometry_msgs/cmake/../msg'], 'std_msgs': ['/opt/ros/kinetic/share/std_msgs/cmake/../msg']}

// !!!!!!!!!!! ['__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_parsed_fields', 'constants', 'fields', 'full_name', 'has_header', 'header_present', 'names', 'package', 'parsed_fields', 'short_name', 'text', 'types']

template <class ContainerAllocator>
struct IsFixedSize< ::ar_track_alvar_msgs::AlvarMarkers_<ContainerAllocator> >
  : FalseType
  { };

template <class ContainerAllocator>
struct IsFixedSize< ::ar_track_alvar_msgs::AlvarMarkers_<ContainerAllocator> const>
  : FalseType
  { };

template <class ContainerAllocator>
struct IsMessage< ::ar_track_alvar_msgs::AlvarMarkers_<ContainerAllocator> >
  : TrueType
  { };

template <class ContainerAllocator>
struct IsMessage< ::ar_track_alvar_msgs::AlvarMarkers_<ContainerAllocator> const>
  : TrueType
  { };

template <class ContainerAllocator>
struct HasHeader< ::ar_track_alvar_msgs::AlvarMarkers_<ContainerAllocator> >
  : TrueType
  { };

template <class ContainerAllocator>
struct HasHeader< ::ar_track_alvar_msgs::AlvarMarkers_<ContainerAllocator> const>
  : TrueType
  { };

template<class ContainerAllocator>
struct MD5Sum< ::ar_track_alvar_msgs::AlvarMarkers_<ContainerAllocator> >
{
  static const char* value()
  {
    return "943fe17bfb0b4ea7890368d0b25ad0ad";
  }

  static const char* value(const ::ar_track_alvar_msgs::AlvarMarkers_<ContainerAllocator>&) { return value(); }
  static const uint64_t static_value1 = 0x943fe17bfb0b4ea7ULL;
  static const uint64_t static_value2 = 0x890368d0b25ad0adULL;
};

template<class ContainerAllocator>
struct DataType< ::ar_track_alvar_msgs::AlvarMarkers_<ContainerAllocator> >
{
  static const char* value()
  {
    return "ar_track_alvar_msgs/AlvarMarkers";
  }

  static const char* value(const ::ar_track_alvar_msgs::AlvarMarkers_<ContainerAllocator>&) { return value(); }
};

template<class ContainerAllocator>
struct Definition< ::ar_track_alvar_msgs::AlvarMarkers_<ContainerAllocator> >
{
  static const char* value()
  {
    return "Header header\n\
AlvarMarker[] markers\n\
\n\
================================================================================\n\
MSG: std_msgs/Header\n\
# Standard metadata for higher-level stamped data types.\n\
# This is generally used to communicate timestamped data \n\
# in a particular coordinate frame.\n\
# \n\
# sequence ID: consecutively increasing ID \n\
uint32 seq\n\
#Two-integer timestamp that is expressed as:\n\
# * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\
# * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\
# time-handling sugar is provided by the client library\n\
time stamp\n\
#Frame this data is associated with\n\
# 0: no frame\n\
# 1: global frame\n\
string frame_id\n\
\n\
================================================================================\n\
MSG: ar_track_alvar_msgs/AlvarMarker\n\
Header header\n\
uint32 id\n\
uint32 confidence\n\
geometry_msgs/PoseStamped pose\n\
\n\
\n\
================================================================================\n\
MSG: geometry_msgs/PoseStamped\n\
# A Pose with reference coordinate frame and timestamp\n\
Header header\n\
Pose pose\n\
\n\
================================================================================\n\
MSG: geometry_msgs/Pose\n\
# A representation of pose in free space, composed of position and orientation. \n\
Point position\n\
Quaternion orientation\n\
\n\
================================================================================\n\
MSG: geometry_msgs/Point\n\
# This contains the position of a point in free space\n\
float64 x\n\
float64 y\n\
float64 z\n\
\n\
================================================================================\n\
MSG: geometry_msgs/Quaternion\n\
# This represents an orientation in free space in quaternion form.\n\
\n\
float64 x\n\
float64 y\n\
float64 z\n\
float64 w\n\
";
  }

  static const char* value(const ::ar_track_alvar_msgs::AlvarMarkers_<ContainerAllocator>&) { return value(); }
};

} // namespace message_traits
} // namespace ros

namespace ros
{
namespace serialization
{

  template<class ContainerAllocator> struct Serializer< ::ar_track_alvar_msgs::AlvarMarkers_<ContainerAllocator> >
  {
    template<typename Stream, typename T> inline static void allInOne(Stream& stream, T m)
    {
      stream.next(m.header);
      stream.next(m.markers);
    }

    ROS_DECLARE_ALLINONE_SERIALIZER
  }; // struct AlvarMarkers_

} // namespace serialization
} // namespace ros

namespace ros
{
namespace message_operations
{

template<class ContainerAllocator>
struct Printer< ::ar_track_alvar_msgs::AlvarMarkers_<ContainerAllocator> >
{
  template<typename Stream> static void stream(Stream& s, const std::string& indent, const ::ar_track_alvar_msgs::AlvarMarkers_<ContainerAllocator>& v)
  {
    s << indent << "header: ";
    s << std::endl;
    Printer< ::std_msgs::Header_<ContainerAllocator> >::stream(s, indent + "  ", v.header);
    s << indent << "markers[]" << std::endl;
    for (size_t i = 0; i < v.markers.size(); ++i)
    {
      s << indent << "  markers[" << i << "]: ";
      s << std::endl;
      s << indent;
      Printer< ::ar_track_alvar_msgs::AlvarMarker_<ContainerAllocator> >::stream(s, indent + "    ", v.markers[i]);
    }
  }
};

} // namespace message_operations
} // namespace ros

#endif // AR_TRACK_ALVAR_MSGS_MESSAGE_ALVARMARKERS_H


text:
(function () {

	"use strict";

	angular.module('services.module')
		.factory('roleService', RoleService);

	/* @ngInject */
	function RoleService(httpService) {
		/**
		 User roles parameters:
		 int id - unique
		 string name
		 string description
		 array permissions
		 */
		return {
			/**
			 * Retrieve all User Roles
			 *
			 * @returns {promise}
			 */
			getAll: function () {
				// Ready for API v.2
				return httpService.createRequest("GET", 'role', {});
			},
			/**
			 * Create a User Role
			 *
			 * @param {array} role - role parameters
			 * @returns {promise}
			 */
			createRole: function (role) {
				// Ready for API v.2
				return httpService.createRequest("POST", 'role', {role: role});
			},
			/**
			 * Retrieve a User Role
			 *
			 * @param {int} roleId - role identifier
			 * @returns {promise}
			 */
			getRole: function (roleId) {
				// Ready for API v.2
				return httpService.createRequest("GET", 'role/' + roleId, {});
			},
			/**
			 * Update a User Role
			 *
			 * @param {int} roleId - role identifier
			 * @param {array} role - role parameters
			 * @returns {promise}
			 */
			updateRole: function (roleId, role) {
				// Ready for API v.2
				return httpService.createRequest("PUT", 'role/' + roleId, {role: role});
			}
		};
	}

})();


text:
package shared

import (
	"bufio"
	"bytes"
	"crypto/rand"
	"crypto/tls"
	"encoding/gob"
	"encoding/hex"
	"encoding/json"
	"fmt"
	"io"
	"io/ioutil"
	"net/http"
	"os"
	"os/exec"
	"path"
	"path/filepath"
	"strconv"
	"strings"
	"syscall"
	"unsafe"
)

const SnapshotDelimiter = "/"
const DefaultPort = "8443"

func GetFileStat(p string) (uid int, gid int, major int, minor int,
	inode uint64, nlink int, err error) {
	var stat syscall.Stat_t
	err = syscall.Lstat(p, &stat)
	if err != nil {
		return
	}
	uid = int(stat.Uid)
	gid = int(stat.Gid)
	inode = uint64(stat.Ino)
	nlink = int(stat.Nlink)
	major = -1
	minor = -1
	if stat.Mode&syscall.S_IFBLK != 0 || stat.Mode&syscall.S_IFCHR != 0 {
		major = int(stat.Rdev / 256)
		minor = int(stat.Rdev % 256)
	}

	return
}

// AddSlash adds a slash to the end of paths if they don't already have one.
// This can be useful for rsyncing things, since rsync has behavior present on
// the presence or absence of a trailing slash.
func AddSlash(path string) string {
	if path[len(path)-1] != '/' {
		return path + "/"
	}

	return path
}

func PathExists(name string) bool {
	_, err := os.Lstat(name)
	if err != nil && os.IsNotExist(err) {
		return false
	}
	return true
}

// PathIsEmpty checks if the given path is empty.
func PathIsEmpty(path string) (bool, error) {
	f, err := os.Open(path)
	if err != nil {
		return false, err
	}
	defer f.Close()

	// read in ONLY one file
	_, err = f.Readdir(1)

	// and if the file is EOF... well, the dir is empty.
	if err == io.EOF {
		return true, nil
	}
	return false, err
}

// IsDir returns true if the given path is a directory.
func IsDir(name string) bool {
	stat, err := os.Lstat(name)
	if err != nil {
		return false
	}
	return stat.IsDir()
}

func IsMountPoint(name string) bool {
	stat, err := os.Stat(name)
	if err != nil {
		return false
	}

	rootStat, err := os.Lstat(name + "/..")
	if err != nil {
		return false
	}
	// If the directory has the same device as parent, then it's not a mountpoint.
	return stat.Sys().(*syscall.Stat_t).Dev != rootStat.Sys().(*syscall.Stat_t).Dev
}

// VarPath returns the provided path elements joined by a slash and
// appended to the end of $LXD_DIR, which defaults to /var/lib/lxd.
func VarPath(path ...string) string {
	varDir := os.Getenv("LXD_DIR")
	if varDir == "" {
		varDir = "/var/lib/lxd"
	}

	items := []string{varDir}
	items = append(items, path...)
	return filepath.Join(items...)
}

// LogPath returns the directory that LXD should put logs under. If LXD_DIR is
// set, this path is $LXD_DIR/logs, otherwise it is /var/log/lxd.
func LogPath(path ...string) string {
	varDir := os.Getenv("LXD_DIR")
	logDir := "/var/log/lxd"
	if varDir != "" {
		logDir = filepath.Join(varDir, "logs")
	}
	items := []string{logDir}
	items = append(items, path...)
	return filepath.Join(items...)
}

func ParseLXDFileHeaders(headers http.Header) (uid int, gid int, mode os.FileMode) {
	uid, err := strconv.Atoi(headers.Get("X-LXD-uid"))
	if err != nil {
		uid = 0
	}

	gid, err = strconv.Atoi(headers.Get("X-LXD-gid"))
	if err != nil {
		gid = 0
	}

	/* Allow people to send stuff with a leading 0 for octal or a regular
	 * int that represents the perms when redered in octal. */
	rawMode, err := strconv.ParseInt(headers.Get("X-LXD-mode"), 0, 0)
	if err != nil {
		rawMode = 0644
	}
	mode = os.FileMode(rawMode)

	return uid, gid, mode
}

func ReadToJSON(r io.Reader, req interface{}) error {
	buf, err := ioutil.ReadAll(r)
	if err != nil {
		return err
	}

	return json.Unmarshal(buf, req)
}

func ReaderToChannel(r io.Reader) <-chan []byte {
	ch := make(chan ([]byte))

	go func() {
		for {
			/* io.Copy uses a 32KB buffer, so we might as well too. */
			buf := make([]byte, 32*1024)
			nr, err := r.Read(buf)
			if nr > 0 {
				ch <- buf[0:nr]
			}

			if err != nil {
				close(ch)
				break
			}
		}
	}()

	return ch
}

// Returns a random base64 encoded string from crypto/rand.
func RandomCryptoString() (string, error) {
	buf := make([]byte, 32)
	n, err := rand.Read(buf)
	if err != nil {
		return "", err
	}

	if n != len(buf) {
		return "", fmt.Errorf("not enough random bytes read")
	}

	return hex.EncodeToString(buf), nil
}

func SplitExt(fpath string) (string, string) {
	b := path.Base(fpath)
	ext := path.Ext(fpath)
	return b[:len(b)-len(ext)], ext
}

func AtoiEmptyDefault(s string, def int) (int, error) {
	if s == "" {
		return def, nil
	}

	return strconv.Atoi(s)
}

func ReadStdin() ([]byte, error) {
	buf := bufio.NewReader(os.Stdin)
	line, _, err := buf.ReadLine()
	if err != nil {
		return nil, err
	}
	return line, nil
}

func GetTLSConfig(certf string, keyf string) (*tls.Config, error) {
	cert, err := tls.LoadX509KeyPair(certf, keyf)
	if err != nil {
		return nil, err
	}

	tlsConfig := &tls.Config{
		InsecureSkipVerify: true,
		ClientAuth:         tls.RequireAnyClientCert,
		Certificates:       []tls.Certificate{cert},
		MinVersion:         tls.VersionTLS12,
		MaxVersion:         tls.VersionTLS12,
		CipherSuites: []uint16{
			tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
			tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256},
		PreferServerCipherSuites: true,
	}

	tlsConfig.BuildNameToCertificate()

	return tlsConfig, nil
}

func WriteAll(w io.Writer, buf []byte) error {
	return WriteAllBuf(w, bytes.NewBuffer(buf))
}

func WriteAllBuf(w io.Writer, buf *bytes.Buffer) error {
	toWrite := int64(buf.Len())
	for {
		n, err := io.Copy(w, buf)
		if err != nil {
			return err
		}

		toWrite -= n
		if toWrite <= 0 {
			return nil
		}
	}
}

// FileMove tries to move a file by using os.Rename,
// if that fails it tries to copy the file and remove the source.
func FileMove(oldPath string, newPath string) error {
	if err := os.Rename(oldPath, newPath); err == nil {
		return nil
	}

	if err := FileCopy(oldPath, newPath); err != nil {
		return err
	}

	os.Remove(oldPath)

	return nil
}

// FileCopy copies a file, overwriting the target if it exists.
func FileCopy(source string, dest string) error {
	s, err := os.Open(source)
	if err != nil {
		return err
	}
	defer s.Close()

	d, err := os.Create(dest)
	if err != nil {
		if os.IsExist(err) {
			d, err = os.OpenFile(dest, os.O_WRONLY, 0700)
			if err != nil {
				return err
			}
		} else {
			return err
		}
	}
	defer d.Close()

	_, err = io.Copy(d, s)
	return err
}

type BytesReadCloser struct {
	Buf *bytes.Buffer
}

func (r BytesReadCloser) Read(b []byte) (n int, err error) {
	return r.Buf.Read(b)
}

func (r BytesReadCloser) Close() error {
	/* no-op since we're in memory */
	return nil
}

func IsSnapshot(name string) bool {
	return strings.Contains(name, SnapshotDelimiter)
}

func ReadLastNLines(f *os.File, lines int) (string, error) {
	if lines <= 0 {
		return "", fmt.Errorf("invalid line count")
	}

	stat, err := f.Stat()
	if err != nil {
		return "", err
	}

	data, err := syscall.Mmap(int(f.Fd()), 0, int(stat.Size()), syscall.PROT_READ, syscall.MAP_SHARED)
	if err != nil {
		return "", err
	}
	defer syscall.Munmap(data)

	for i := len(data) - 1; i >= 0; i-- {
		if data[i] == '\n' {
			lines--
		}

		if lines < 0 {
			return string(data[i+1 : len(data)]), nil
		}
	}

	return string(data), nil
}

func SetSize(fd int, width int, height int) (err error) {
	var dimensions [4]uint16
	dimensions[0] = uint16(height)
	dimensions[1] = uint16(width)

	if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), uintptr(syscall.TIOCSWINSZ), uintptr(unsafe.Pointer(&dimensions)), 0, 0, 0); err != 0 {
		return err
	}
	return nil
}

func ReadDir(p string) ([]string, error) {
	ents, err := ioutil.ReadDir(p)
	if err != nil {
		return []string{}, err
	}

	var ret []string
	for _, ent := range ents {
		ret = append(ret, ent.Name())
	}
	return ret, nil
}

func MkdirAllOwner(path string, perm os.FileMode, uid int, gid int) error {
	// This function is a slightly modified version of MkdirAll from the Go standard library.
	// https://golang.org/src/os/path.go?s=488:535#L9

	// Fast path: if we can tell whether path is a directory or file, stop with success or error.
	dir, err := os.Stat(path)
	if err == nil {
		if dir.IsDir() {
			return nil
		}
		return fmt.Errorf("path exists but isn't a directory")
	}

	// Slow path: make sure parent exists and then call Mkdir for path.
	i := len(path)
	for i > 0 && os.IsPathSeparator(path[i-1]) { // Skip trailing path separator.
		i--
	}

	j := i
	for j > 0 && !os.IsPathSeparator(path[j-1]) { // Scan backward over element.
		j--
	}

	if j > 1 {
		// Create parent
		err = MkdirAllOwner(path[0:j-1], perm, uid, gid)
		if err != nil {
			return err
		}
	}

	// Parent now exists; invoke Mkdir and use its result.
	err = os.Mkdir(path, perm)

	err_chown := os.Chown(path, uid, gid)
	if err_chown != nil {
		return err_chown
	}

	if err != nil {
		// Handle arguments like "foo/." by
		// double-checking that directory doesn't exist.
		dir, err1 := os.Lstat(path)
		if err1 == nil && dir.IsDir() {
			return nil
		}
		return err
	}
	return nil
}

func IntInSlice(key int, list []int) bool {
	for _, entry := range list {
		if entry == key {
			return true
		}
	}
	return false
}

/*
 * returns 1 if path is mounted shared:
 * returns 0 if path is not listed
 * returns -1 if path is explicitly mounted as not-shared
 */
func isSharedMount(file *os.File, pathName string) int {
	_, err := file.Seek(0, 0)
	if err != nil {
		Debugf("Error rewinding mountinfo file: %s\n", err)
		return 0
	}
	scanner := bufio.NewScanner(file)
	for scanner.Scan() {
		line := scanner.Text()
		rows := strings.Fields(line)
		if rows[3] != pathName || rows[4] != pathName {
			continue
		}
		if strings.HasPrefix(rows[6], "shared:") {
			return 1
		} else {
			return -1
		}
	}
	return 0
}

func IsSharedMount(pathName string) bool {
	file, err := os.Open("/proc/self/mountinfo")
	if err != nil {
		return false
	}
	defer file.Close()

	switch isSharedMount(file, pathName) {
	case 1:
		return true
	default:
		return false
	}
}

func IsOnSharedMount(pathName string) bool {
	file, err := os.Open("/proc/self/mountinfo")
	if err != nil {
		return false
	}
	defer file.Close()

	for {
		switch isSharedMount(file, pathName) {
		case 1:
			return true
		case -1:
			return false
		}
		if pathName == "/" || pathName == "." {
			return false
		}
		pathName = filepath.Dir(pathName)
	}
}

func IsBlockdev(fm os.FileMode) bool {
	return ((fm&os.ModeDevice != 0) && (fm&os.ModeCharDevice == 0))
}

func IsBlockdevPath(pathName string) bool {
	sb, err := os.Stat(pathName)
	if err != nil {
		return false
	}

	fm := sb.Mode()
	return ((fm&os.ModeDevice != 0) && (fm&os.ModeCharDevice == 0))
}

func BlockFsDetect(dev string) (string, error) {
	out, err := exec.Command("blkid", "-s", "TYPE", "-o", "value", dev).Output()
	return strings.TrimSpace(string(out)), err
}

// DeepCopy copies src to dest by using encoding/gob so its not that fast.
func DeepCopy(src, dest interface{}) error {

	buff := new(bytes.Buffer)
	enc := gob.NewEncoder(buff)
	dec := gob.NewDecoder(buff)
	if err := enc.Encode(src); err != nil {
		return err
	}

	if err := dec.Decode(dest); err != nil {
		return err
	}

	return nil
}


text:
<?php
/**
 * User: burakhan
 * Date: 26.04.2015
 * Time: 23:58
 */

return [
    'permissions' => [
        'ACCESS_CHECKIN_PROPERTIES' => 'Allows read/write access to the "properties" table in the checkin database, to change values that get uploaded.',
        'ACCESS_COARSE_LOCATION' => 'Allows an app to access approximate location derived from network location sources such as cell towers and Wi-Fi.',
        'ACCESS_FINE_LOCATION' => 'Allows an app to access precise location from location sources such as GPS, cell towers, and Wi-Fi.',
        'ACCESS_LOCATION_EXTRA_COMMANDS' => 'Allows an application to access extra location provider commands',
        'ACCESS_MOCK_LOCATION' => 'Allows an application to create mock location providers for testing',
        'ACCESS_NETWORK_STATE' => 'Allows applications to access information about networks',
        'ACCESS_SURFACE_FLINGER' => 'Allows an application to use SurfaceFlinger\'s low level features.',
        'ACCESS_WIFI_STATE' => 'Allows applications to access information about Wi-Fi networks',
        'ACCOUNT_MANAGER' => 'Allows applications to call into AccountAuthenticators.',
        'ADD_VOICEMAIL' => 'Allows an application to add voicemails into the system.',
        'AUTHENTICATE_ACCOUNTS' => 'Allows an application to act as an AccountAuthenticator for the AccountManager',
        'BATTERY_STATS' => 'Allows an application to collect battery statistics',
        'BIND_ACCESSIBILITY_SERVICE' => 'Must be required by an AccessibilityService,to ensure that only the system can bind to it.',
        'BIND_APPWIDGET' => 'Allows an application to tell the AppWidget service which application can access AppWidget\'s data.',
        'BIND_DEVICE_ADMIN' => 'Must be required by device administration receiver, to ensure that only the system can interact with it.',
        'BIND_INPUT_METHOD' => 'Must be required by an InputMethodService, to ensure that only the system can bind to it.',
        'BIND_NFC_SERVICE' => 'Must be required by a HostApduService or OffHostApduService to ensure that only the system can bind to it.',
        'BIND_NOTIFICATION_LISTENER_SERVICE' => 'Must be required by an NotificationListenerService, to ensure that only the system can bind to it.',
        'BIND_PRINT_SERVICE' => 'Must be required by a PrintService, to ensure that only the system can bind to it.',
        'BIND_REMOTEVIEWS' => 'Must be required by a RemoteViewsService, to ensure that only the system can bind to it.',
        'BIND_TEXT_SERVICE' => 'Must be required by a TextService (e.g.',
        'BIND_VPN_SERVICE' => 'Must be required by a VpnService, to ensure that only the system can bind to it.',
        'BIND_WALLPAPER' => 'Must be required by a WallpaperService, to ensure that only the system can bind to it.',
        'BLUETOOTH' => 'Allows applications to connect to paired bluetooth devices',
        'BLUETOOTH_ADMIN' => 'Allows applications to discover and pair bluetooth devices ',
        'BLUETOOTH_PRIVILEGED' => 'Allows applications to pair bluetooth devices without user interaction.',
        'BRICK' => 'Required to be able to disable the device (very dangerous!).',
        'BROADCAST_PACKAGE_REMOVED' => 'Allows an application to broadcast a notification that an application package has been removed.',
        'BROADCAST_SMS' => 'Allows an application to broadcast an SMS receipt notification.',
        'BROADCAST_STICKY' => 'Allows an application to broadcast sticky intents.',
        'BROADCAST_WAP_PUSH' => 'Allows an application to broadcast a WAP PUSH receipt notification.',
        'CALL_PHONE' => 'Allows an application to initiate a phone call without going through the Dialer user interface for the user to confirm the call being placed.',
        'CALL_PRIVILEGED' => 'Allows an application to call any phone number, including emergency numbers, without going through the Dialer user interface for the user to confirm the call being placed.',
        'CAMERA' => 'Required to be able to access the camera device.',
        'CAPTURE_AUDIO_OUTPUT' => 'Allows an application to capture audio output.',
        'CAPTURE_SECURE_VIDEO_OUTPUT' => 'Allows an application to capture secure video output.',
        'CAPTURE_VIDEO_OUTPUT' => 'Allows an application to capture video output.',
        'CHANGE_COMPONENT_ENABLED_STATE' => 'Allows an application to change whether an application component (other than its own) is enabled or not.',
        'CHANGE_CONFIGURATION' => 'Allows an application to modify the current configuration, such as locale.',
        'CHANGE_NETWORK_STATE' => 'Allows applications to change network connectivity state',
        'CHANGE_WIFI_MULTICAST_STATE' => 'Allows applications to enter Wi-Fi Multicast mode',
        'CHANGE_WIFI_STATE' => 'Allows applications to change Wi-Fi connectivity state',
        'CLEAR_APP_CACHE' => 'Allows an application to clear the caches of all installed applications on the device.',
        'CLEAR_APP_USER_DATA' => 'Allows an application to clear user data.',
        'CONTROL_LOCATION_UPDATES' => 'Allows enabling/disabling location update notifications from the radio.',
        'DELETE_CACHE_FILES' => 'Allows an application to delete cache files.',
        'DELETE_PACKAGES' => 'Allows an application to delete packages.',
        'DEVICE_POWER' => 'Allows low-level access to power management.',
        'DIAGNOSTIC' => 'Allows applications to RW to diagnostic resources.',
        'DISABLE_KEYGUARD' => 'Allows applications to disable the keyguard',
        'DUMP' => 'Allows an application to retrieve state dump information from system services.',
        'EXPAND_STATUS_BAR' => 'Allows an application to expand or collapse the status bar.',
        'FACTORY_TEST' => 'Run as a manufacturer test application, running as the root user.',
        'FLASHLIGHT' => 'Allows access to the flashlight',
        'FORCE_BACK' => 'Allows an application to force a BACK operation on whatever is the top activity.',
        'GET_ACCOUNTS' => 'Allows access to the list of accounts in the Accounts Service',
        'GET_PACKAGE_SIZE' => 'Allows an application to find out the space used by any package.',
        'GET_TASKS' => 'Allows an application to get information about the currently or recently running tasks.',
        'GET_TOP_ACTIVITY_INFO' => 'Allows an application to retrieve private information about the current top activity, such as any assist context it can provide.',
        'GLOBAL_SEARCH' => 'This permission can be used on content providers to allow the global search system to access their data.',
        'HARDWARE_TEST' => 'Allows access to hardware peripherals.',
        'INJECT_EVENTS' => 'Allows an application to inject user events (keys, touch, trackball) into the event stream and deliver them to ANY window.',
        'INSTALL_LOCATION_PROVIDER' => 'Allows an application to install a location provider into the Location Manager.',
        'INSTALL_PACKAGES' => 'Allows an application to install packages.',
        'INSTALL_SHORTCUT' => 'Allows an application to install a shortcut in Launcher',
        'INTERNAL_SYSTEM_WINDOW' => 'Allows an application to open windows that are for use by parts of the system user interface.',
        'INTERNET' => 'Allows applications to open network sockets.',
        'KILL_BACKGROUND_PROCESSES' => 'Allows an application to call killBackgroundProcesses(String).',
        'LOCATION_HARDWARE' => 'Allows an application to use location features in hardware, such as the geofencing api.',
        'MANAGE_ACCOUNTS' => 'Allows an application to manage the list of accounts in the AccountManager',
        'MANAGE_APP_TOKENS' => 'Allows an application to manage (create, destroy, Z-order) application tokens in the window manager.',
        'MANAGE_DOCUMENTS' => 'Allows an application to manage access to documents, usually as part of a document picker.',
        'MASTER_CLEAR' => 'Not for use by third-party applications.',
        'MEDIA_CONTENT_CONTROL' => 'Allows an application to know what content is playing and control its playback.',
        'MODIFY_AUDIO_SETTINGS' => 'Allows an application to modify global audio settings',
        'MODIFY_PHONE_STATE' => 'Allows modification of the telephony state - power on, mmi, etc.',
        'MOUNT_FORMAT_FILESYSTEMS' => 'Allows formatting file systems for removable storage.',
        'MOUNT_UNMOUNT_FILESYSTEMS' => 'Allows mounting and unmounting file systems for removable storage.',
        'NFC' => 'Allows applications to perform I/O operations over NFC',
        'PERSISTENT_ACTIVITY' => 'This constant was deprecated in API level 9. This functionality will be removed in the future; please do not use. Allow an application to make its activities persistent.',
        'PROCESS_OUTGOING_CALLS' => 'Allows an application to monitor, modify, or abort outgoing calls.',
        'READ_CALENDAR' => 'Allows an application to read the user\'s calendar data.',
        'READ_CALL_LOG' => 'Allows an application to read the user\'s call log.',
        'READ_CONTACTS' => 'Allows an application to read the user\'s contacts data.',
        'READ_EXTERNAL_STORAGE' => 'Allows an application to read from external storage.',
        'READ_FRAME_BUFFER' => 'Allows an application to take screen shots and more generally get access to the frame buffer data.',
        'READ_HISTORY_BOOKMARKS' => 'Allows an application to read (but not write) the user\'s browsing history and bookmarks.',
        'READ_INPUT_STATE' => 'This constant was deprecated in API level 16. The API that used this permission has been removed.',
        'READ_LOGS' => 'Allows an application to read the low-level system log files.',
        'READ_PHONE_STATE' => 'Allows read only access to phone state.',
        'READ_PROFILE' => 'Allows an application to read the user\'s personal profile data.',
        'READ_SMS' => 'Allows an application to read SMS messages.',
        'READ_SOCIAL_STREAM' => 'Allows an application to read from the user\'s social stream.',
        'READ_SYNC_SETTINGS' => 'Allows applications to read the sync settings',
        'READ_SYNC_STATS' => 'Allows applications to read the sync stats',
        'READ_USER_DICTIONARY' => 'Allows an application to read the user dictionary.',
        'REBOOT' => 'Required to be able to reboot the device.',
        'RECEIVE_BOOT_COMPLETED' => 'Allows an application to receive the ACTION_BOOT_COMPLETED that is broadcast after the system finishes booting.',
        'RECEIVE_MMS' => 'Allows an application to monitor incoming MMS messages, to record or perform processing on them.',
        'RECEIVE_SMS' => 'Allows an application to monitor incoming SMS messages, to record or perform processing on them.',
        'RECEIVE_WAP_PUSH' => 'Allows an application to monitor incoming WAP push messages.',
        'RECORD_AUDIO' => 'Allows an application to record audio',
        'REORDER_TASKS' => 'Allows an application to change the Z-order of tasks',
        'RESTART_PACKAGES' => 'This constant was deprecated in API level 8. The restartPackage(String) API is no longer supported.',
        'SEND_RESPOND_VIA_MESSAGE' => 'Allows an application (Phone) to send a request to other applications to handle the respond-via-message action during incoming calls.',
        'SEND_SMS' => 'Allows an application to send SMS messages.',
        'SET_ACTIVITY_WATCHER' => 'Allows an application to watch and control how activities are started globally in the system.',
        'SET_ALARM' => 'Allows an application to broadcast an Intent to set an alarm for the user.',
        'SET_ALWAYS_FINISH' => 'Allows an application to control whether activities are immediately finished when put in the background.',
        'SET_ANIMATION_SCALE' => 'Modify the global animation scaling factor.',
        'SET_DEBUG_APP' => 'Configure an application for debugging.',
        'SET_ORIENTATION' => 'Allows low-level access to setting the orientation (actually rotation) of the screen.',
        'SET_POINTER_SPEED' => 'Allows low-level access to setting the pointer speed.',
        'SET_PREFERRED_APPLICATIONS' => 'This constant was deprecated in API level 7. No longer useful, see addPackageToPreferred(String) for details.',
        'SET_PROCESS_LIMIT' => 'Allows an application to set the maximum number of (not needed) application processes that can be running.',
        'SET_TIME' => 'Allows applications to set the system time.',
        'SET_TIME_ZONE' => 'Allows applications to set the system time zone ',
        'SET_WALLPAPER' => 'Allows applications to set the wallpaper',
        'SET_WALLPAPER_HINTS' => 'Allows applications to set the wallpaper hints',
        'SIGNAL_PERSISTENT_PROCESSES' => 'Allow an application to request that a signal be sent to all persistent processes.',
        'STATUS_BAR' => 'Allows an application to open, close, or disable the status bar and its icons.',
        'SUBSCRIBED_FEEDS_READ' => 'Allows an application to allow access the subscribed feeds ContentProvider.',
        'SUBSCRIBED_FEEDS_WRITE' => '',
        'SYSTEM_ALERT_WINDOW' => 'Allows an application to open windows using the type TYPE_SYSTEM_ALERT, shown on top of all other applications.',
        'TRANSMIT_IR' => 'Allows using the device\'s IR transmitter, if available',
        'UNINSTALL_SHORTCUT' => 'Allows an application to uninstall a shortcut in Launcher',
        'UPDATE_DEVICE_STATS' => 'Allows an application to update device statistics.',
        'USE_CREDENTIALS' => 'Allows an application to request authtokens from the AccountManager',
        'USE_SIP' => 'Allows an application to use SIP service',
        'VIBRATE' => 'Allows access to the vibrator',
        'WAKE_LOCK' => 'Allows using PowerManager WakeLocks to keep processor from sleeping or screen from dimming',
        'WRITE_APN_SETTINGS' => 'Allows applications to write the apn settings.',
        'WRITE_CALENDAR' => 'Allows an application to write (but not read) the user\'s calendar data.',
        'WRITE_CALL_LOG' => 'Allows an application to write (but not read) the user\'s contacts data.',
        'WRITE_CONTACTS' => 'Allows an application to write (but not read) the user\'s contacts data.',
        'WRITE_EXTERNAL_STORAGE' => 'Allows an application to write to external storage.',
        'WRITE_GSERVICES' => 'Allows an application to modify the Google service map.',
        'WRITE_HISTORY_BOOKMARKS' => 'Allows an application to write (but not read) the user\'s browsing history and bookmarks.',
        'WRITE_PROFILE' => 'Allows an application to write (but not read) the user\'s personal profile data.',
        'WRITE_SECURE_SETTINGS' => 'Allows an application to read or write the secure system settings.',
        'WRITE_SETTINGS' => 'Allows an application to read or write the system settings.',
        'WRITE_SMS' => 'Allows an application to write SMS messages.',
        'WRITE_SOCIAL_STREAM' => 'Allows an application to write (but not read) the user\'s social stream data.',
        'WRITE_SYNC_SETTINGS' => 'Allows applications to write the sync settings',
        'WRITE_USER_DICTIONARY' => 'Allows an application to write to the user dictionary.',
    ],

];


text:
package org.bdgenomics.cannoli.cli

import java.util.logging.Level._
import javax.inject.Inject
import com.google.inject.AbstractModule
import grizzled.slf4j.Logging
import net.codingwell.scalaguice.ScalaModule
import org.bdgenomics.adam.cli.CommandGroup
import org.bdgenomics.adam.util.ParquetLogger
import org.bdgenomics.utils.cli._

object Cannoli {

  val defaultCommandGroups = List(CommandGroup("CANNOLI", List(BcftoolsCall,
    BcftoolsMpileup,
    BcftoolsNorm,
    BedtoolsIntersect,
    Blastn,
    Bowtie,
    Bowtie2,
    SingleEndBowtie2,
    BwaMem,
    SingleEndBwaMem,
    BwaMem2,
    SingleEndBwaMem2,
    Freebayes,
    Gem,
    MagicBlast,
    Minimap2,
    LongMinimap2,
    SingleEndMinimap2,
    SamtoolsMpileup,
    Snap,
    SnpEff,
    Star,
    SingleEndStar,
    Unimap,
    LongUnimap,
    SingleEndUnimap,
    Vep,
    VtNormalize)),
    CommandGroup("CANNOLI TOOLS", List(InterleaveFastq,
      SampleReads)))

  def main(args: Array[String]) {
    new Cannoli(defaultCommandGroups)(args)
  }
}

private class InitArgs extends Args4jBase with ParquetArgs {}

/**
 * Cannoli main.
 *
 * @param commandGroups List of command groups, can be injected via Guice.
 */
class Cannoli @Inject() (commandGroups: List[CommandGroup]) extends Logging {

  private def printLogo() {
    print("\n")
    println("""                              _ _
      *                             | (_)
      *   ___ __ _ _ __  _ __   ___ | |_
      *  / __/ _` | '_ \| '_ \ / _ \| | |
      * | (_| (_| | | | | | | | (_) | | |
      *  \___\__,_|_| |_|_| |_|\___/|_|_|""".stripMargin('*'))
  }

  private def printVersion() {
    printLogo()
    val about = new About()
    println("\nCannoli version: %s".format(about.version))
    if (about.isSnapshot) {
      println("Commit: %s Build: %s".format(about.commit, about.buildTimestamp))
    }
    println("Built for: ADAM %s, Apache Spark %s, and Scala %s"
      .format(about.adamVersion, about.sparkVersion, about.scalaVersion))
  }

  private def printCommands() {
    printLogo()
    println("\nUsage: cannoli-submit [<spark-args> --] <cannoli-args>")
    println("\nChoose one of the following commands:")
    commandGroups.foreach { grp =>
      println("\n%s".format(grp.name))
      grp.commands.foreach(cmd =>
        println("%20s : %s".format(cmd.commandName, cmd.commandDescription)))
    }
    println("\n")
  }

  def apply(args: Array[String]) {
    info("Cannoli invoked with args: %s".format(argsToString(args)))
    if (args.length < 1) {
      printCommands()
    } else if (args.contains("--version") || args.contains("-version")) {
      printVersion()
    } else {

      val commands =
        for {
          grp <- commandGroups
          cmd <- grp.commands
        } yield cmd

      commands.find(_.commandName == args(0)) match {
        case None => printCommands()
        case Some(cmd) =>
          init(Args4j[InitArgs](args drop 1, ignoreCmdLineExceptions = true))
          cmd.apply(args drop 1).run()
      }
    }
  }

  // Attempts to format the `args` array into a string in a way
  // suitable for copying and pasting back into the shell.
  private def argsToString(args: Array[String]): String = {
    def escapeArg(s: String) = "\"" + s.replaceAll("\\\"", "\\\\\"") + "\""
    args.map(escapeArg).mkString(" ")
  }

  private def init(args: InitArgs) {
    // Set parquet logging (default: severe)
    ParquetLogger.hadoopLoggerLevel(parse(args.logLevel))
  }
}

/**
 * Cannoli module, binds the default list of command groups.
 */
class CannoliModule extends AbstractModule with ScalaModule {
  override def configure() {
    bind[List[CommandGroup]].toInstance(Cannoli.defaultCommandGroups)
  }
}


text:
using UnityEngine;
using System.Collections;

public class treeManager : MonoBehaviour {

	public GameObject currentTree;

	public GameObject currentWeapon;
	private Transform spawnArea;

	public GameObject treePrefab;
	public GameObject weaponTreePrefab;

	private bool spawnOneTree;

	public int spawnBeaverMin;
	public int spawnBeaverMax;
	public int nbBeaverUntilSpawnTree;
	public int lastDeadBeaverNumber;

	// Use this for initialization
	void Start () {
		currentTree = null;
		currentWeapon = null;
		spawnArea = GameObject.FindGameObjectWithTag ("SpawnArea").transform;
		spawnOneTree = true; // TODO false
		nbBeaverUntilSpawnTree = getRandNbBeaver();
		lastDeadBeaverNumber = 0;
	}

	bool canSpawnTree ()
	{
		return currentTree ? false : true;
	}

	void refreshCurrent ()
	{
		if (currentTree) {
			if (currentTree.transform.position.x < -spawnArea.transform.position.x) {
				Destroy (currentTree);
				currentTree = null;
			}
		}
	}

	// Update is called once per frame
	void Update () {
		if (canSpawnTree () && spawnOneTree) {
			currentTree = Instantiate(treePrefab);
			currentTree.transform.position = spawnArea.position;
			currentTree.transform.SetParent (this.transform);
			spawnOneTree = false;

			nbBeaverUntilSpawnTree = getRandNbBeaver();

			lastDeadBeaverNumber = GameObject.FindGameObjectWithTag("BeaversManager").GetComponent<BeaversManager>().getBeaverKilledTotal();
		}

		if (nbBeaverUntilSpawnTree < GameObject.FindGameObjectWithTag("BeaversManager").GetComponent<BeaversManager>().getBeaverKilledTotal()-lastDeadBeaverNumber)
			spawnOneTree = true;

		refreshCurrent ();
		playerPickUpWeapon ();
	}

	public void trowWeaponOnGround(){
		if (currentWeapon != null) {
			currentWeapon.GetComponent<weaponTree>().throwItNextTime = true;
		}
	}

	public GameObject playerPickUpWeapon(){
		if (currentTree !=null && currentTree.GetComponent<tree> ().isOnFloor()) {
			if (currentWeapon){
				currentWeapon.GetComponent<weaponTree>().removeHangBeaver();
				Destroy(currentWeapon);
			}
			currentWeapon = Instantiate(weaponTreePrefab);
			currentWeapon.transform.position = new Vector3(currentTree.GetComponent<tree>().trunk.transform.position.x,
			                                               currentTree.GetComponent<tree>().trunk.transform.position.y,
			                                               currentTree.GetComponent<tree>().trunk.transform.position.z-0.1f);
			currentWeapon.transform.eulerAngles = new Vector3(0,0,0);
		}
		return currentWeapon;

	}

	public void ChopLeft(){
		Debug.Log ("LEFT");
		if (currentTree != null) {
			Debug.Log ("doleft");
			currentTree.GetComponent<tree> ().chopLeft ();
		}
	}

	public void ChopRight(){
		if(currentTree != null)
		currentTree.GetComponent<tree> ().chopRight ();
	}

	public void pickWeapon(){
		if(currentWeapon != null)
		currentWeapon.GetComponent<weaponTree> ().pick ();
	}

	public void PrepareSmash(){
		if (currentWeapon != null) {
			if( !currentWeapon.GetComponent<weaponTree>().prepareNextTime){
				currentWeapon.GetComponent<weaponTree>().prepareSmashASAP();
			}
		}
	}

	public void Smash(){
		if (currentWeapon != null) {
			if (!currentWeapon.GetComponent<weaponTree> ().smashNextTime) {
				currentWeapon.GetComponent<weaponTree> ().smashASAP ();
			}
		}
	}

	private int getRandNbBeaver() {
		return (int) Mathf.Floor(Random.Range (spawnBeaverMin, spawnBeaverMax+1));
	}

	public void restart() {
		if (currentTree) {
			GameObject.Destroy(currentTree);
			currentTree = null;
		}
		if (currentWeapon) {
			GameObject.Destroy(currentWeapon);
			currentWeapon = null;
		}
		spawnArea = GameObject.FindGameObjectWithTag ("SpawnArea").transform;
		spawnOneTree = true; // TODO false
		nbBeaverUntilSpawnTree = getRandNbBeaver();
		lastDeadBeaverNumber = 0;
	}
}


text:
  Westhouse est
      une ville située dans le département de Bas-Rhin en Alsace. Elle totalisait 1 375 habitants en 2008.

La commune compte quelques  aménagements, elle propose entre autres un terrain de tennis et un terrain de sport.

Le parc d'habitations, à Westhouse, était réparti en 2011 en 50 appartements et 516 maisons soit
 un marché plutôt équilibré.

À coté de Westhouse sont localisées les communes de
Benfeld localisée à 2 km, 5 260 habitants,
Schaeffersheim à 4 km, 794 habitants,
Uttenheim localisée à 1 km, 572 habitants,
Osthouse localisée à 4 km, 955 habitants,
Matzenheim à 2 km, 1 377 habitants,
Huttenheim à 4 km, 2 460 habitants,
 entre autres. De plus, Westhouse est située à seulement 23 km de Strasbourg.

À Westhouse, le prix moyen à l'achat d'un appartement s'évalue à 2 392 € du m² en vente. la valorisation moyenne d'une maison à l'achat se situe à 2 120 € du m². À la location la valorisation moyenne se situe à 6,92 € du m² par mois.