text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>app.utils.checkers - Documentation de l'outil de démonstration JavaScript du Gaia-Project</title>
    <link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
    <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
    <link rel="shortcut icon" type="image/png" href="../assets/favicon.png">

            API Docs for: 1.0

APIs

Classes

Modules

                            <input type="search" id="api-filter" placeholder="Type to filter APIs">

app

app.client.socketclient

app.controllers.chatservice

app.controllers.login

app.controllers.modules.chat.people

app.controllers.modules.game.CubeCtrl

app.controllers.modules.game.ShootCtrl

app.controllers.modules.game.SpaceCtrl

app.controllers.modules.game.SpaceShipCtrl

app.controllers.modules.login.login

app.controllers.modules.login.register

app.controllers.modules.menu.menu

app.modules.servers.SocketServer

app.objects.email

app.objects.user

app.security.diffie-helman

app.servers.HTTPServer

app.services.chat

app.services.login

app.storage.mongodb

app.storage.mysql

app.storage.query

app.utils.checkers

app.utils.date

config

ConfigModel

KeyboardServices

LanguageModel

LeapMotionController

resize

                    Show:

                        <input type="checkbox" id="api-show-inherited" checked>
                        Inherited

                        <input type="checkbox" id="api-show-protected">
                        Protected

                        <input type="checkbox" id="api-show-private">
                        Private

                        <input type="checkbox" id="api-show-deprecated">
                        Deprecated

app.utils.checkers Class

                                    Defined in: www/modules/utils/checkers.js:1

Utils for data validation

Index

Methods

Item Index

Methods

                                                        test_email_address

                                                        test_numeric

                                                        test_username

Methods

test_email_address

                                                        (

                                                                    email

)

                                                        Boolean

                                                            Defined in
                                                    www/modules/utils/checkers.js:5

Check email address
                                            Here is the regular expression we used : /[a-z0-9!#$%&'+/=?^_{|}~-]+(?:.[a-z0-9!#$%&amp;&#39;</em>+/=?^_{|}~-]+)@(?:[a-z0-9](?:[a-z0-9-][a-z0-9])?.)+a-z0-9?/

Parameters:

                                                                    email
                                                                    String

Returns:

                                                                    Boolean:

test_numeric

                                                        (

                                                                    id

)

                                                        Boolean

                                                            Defined in
                                                    www/modules/utils/checkers.js:25

Check numeric values
                                            Here is the regular expression we used : /^([0-9])+$/

Parameters:

                                                                    id
                                                                    Number

Returns:

                                                                    Boolean:

test_username

                                                        (

                                                                    username

)

                                                        Boolean

                                                            Defined in
                                                    www/modules/utils/checkers.js:15

Check username
                                            Here is the regular expression we used : /^([a-zA-Z0-9_.-])+$/

Parameters:

                                                                    username
                                                                    String

Returns:

                                                                    Boolean:


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

package com.google.gerrit.client.admin;

import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.access.AccessMap;
import com.google.gerrit.client.access.ProjectAccessInfo;
import com.google.gerrit.client.actions.ActionButton;
import com.google.gerrit.client.actions.ActionInfo;
import com.google.gerrit.client.change.Resources;
import com.google.gerrit.client.download.DownloadPanel;
import com.google.gerrit.client.projects.ConfigInfo;
import com.google.gerrit.client.projects.ConfigInfo.ConfigParameterInfo;
import com.google.gerrit.client.projects.ConfigInfo.ConfigParameterValue;
import com.google.gerrit.client.projects.ConfigInfo.InheritedBooleanInfo;
import com.google.gerrit.client.projects.ProjectApi;
import com.google.gerrit.client.rpc.CallbackGroup;
import com.google.gerrit.client.rpc.GerritCallback;
import com.google.gerrit.client.rpc.NativeMap;
import com.google.gerrit.client.rpc.Natives;
import com.google.gerrit.client.rpc.ScreenLoadCallback;
import com.google.gerrit.client.ui.NpIntTextBox;
import com.google.gerrit.client.ui.OnEditEnabler;
import com.google.gerrit.client.ui.SmallHeading;
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.client.Project.InheritableBoolean;
import com.google.gerrit.reviewdb.client.Project.SubmitType;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.FocusWidget;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwtexpui.globalkey.client.NpTextArea;
import com.google.gwtexpui.globalkey.client.NpTextBox;

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;

public class ProjectInfoScreen extends ProjectScreen {
  private boolean isOwner;

  private LabeledWidgetsGrid grid;
  private Panel pluginOptionsPanel;
  private LabeledWidgetsGrid actionsGrid;

  // Section: Project Options
  private ListBox requireChangeID;
  private ListBox submitType;
  private ListBox state;
  private ListBox contentMerge;
  private NpTextBox maxObjectSizeLimit;
  private Label effectiveMaxObjectSizeLimit;
  private Map<String, Map<String, FocusWidget>> pluginConfigWidgets;

  // Section: Contributor Agreements
  private ListBox contributorAgreements;
  private ListBox signedOffBy;

  private NpTextArea descTxt;
  private Button saveProject;

  private OnEditEnabler saveEnabler;

  public ProjectInfoScreen(final Project.NameKey toShow) {
    super(toShow);
  }

  @Override
  protected void onInitUI() {
    super.onInitUI();

    Resources.I.style().ensureInjected();
    saveProject = new Button(Util.C.buttonSaveChanges());
    saveProject.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        doSave();
      }
    });

    add(new ProjectDownloadPanel(getProjectKey().get(), true));

    initDescription();
    grid = new LabeledWidgetsGrid();
    pluginOptionsPanel = new FlowPanel();
    actionsGrid = new LabeledWidgetsGrid();
    initProjectOptions();
    initAgreements();
    add(grid);
    add(pluginOptionsPanel);
    add(saveProject);
    add(actionsGrid);
  }

  @Override
  protected void onLoad() {
    super.onLoad();

    Project.NameKey project = getProjectKey();
    CallbackGroup cbg = new CallbackGroup();
    AccessMap.get(project,
        cbg.add(new GerritCallback<ProjectAccessInfo>() {
          @Override
          public void onSuccess(ProjectAccessInfo result) {
            isOwner = result.isOwner();
            enableForm();
            saveProject.setVisible(isOwner);
          }
        }));
    ProjectApi.getConfig(project,
        cbg.addFinal(new ScreenLoadCallback<ConfigInfo>(this) {
          @Override
          public void preDisplay(ConfigInfo result) {
            display(result);
          }
        }));

    savedPanel = INFO;
  }

  private void enableForm() {
    enableForm(isOwner);
  }

  private void enableForm(boolean isOwner) {
    submitType.setEnabled(isOwner);
    state.setEnabled(isOwner);
    contentMerge.setEnabled(isOwner);
    descTxt.setEnabled(isOwner);
    contributorAgreements.setEnabled(isOwner);
    signedOffBy.setEnabled(isOwner);
    requireChangeID.setEnabled(isOwner);
    maxObjectSizeLimit.setEnabled(isOwner);

    if (pluginConfigWidgets != null) {
      for (Map<String, FocusWidget> widgetMap : pluginConfigWidgets.values()) {
        for (FocusWidget widget : widgetMap.values()) {
          widget.setEnabled(isOwner);
        }
      }
    }
  }

  private void initDescription() {
    final VerticalPanel vp = new VerticalPanel();
    vp.add(new SmallHeading(Util.C.headingDescription()));

    descTxt = new NpTextArea();
    descTxt.setVisibleLines(6);
    descTxt.setCharacterWidth(60);
    vp.add(descTxt);

    add(vp);
    saveEnabler = new OnEditEnabler(saveProject);
    saveEnabler.listenTo(descTxt);
  }

  private void initProjectOptions() {
    grid.addHeader(new SmallHeading(Util.C.headingProjectOptions()));

    submitType = new ListBox();
    for (final Project.SubmitType type : Project.SubmitType.values()) {
      submitType.addItem(Util.toLongString(type), type.name());
    }
    submitType.addChangeHandler(new ChangeHandler() {
      @Override
      public void onChange(ChangeEvent event) {
        setEnabledForUseContentMerge();
      }
    });
    saveEnabler.listenTo(submitType);
    grid.add(Util.C.headingProjectSubmitType(), submitType);

    state = new ListBox();
    for (final Project.State stateValue : Project.State.values()) {
      state.addItem(Util.toLongString(stateValue), stateValue.name());
    }
    saveEnabler.listenTo(state);
    grid.add(Util.C.headingProjectState(), state);

    contentMerge = newInheritedBooleanBox();
    saveEnabler.listenTo(contentMerge);
    grid.add(Util.C.useContentMerge(), contentMerge);

    requireChangeID = newInheritedBooleanBox();
    saveEnabler.listenTo(requireChangeID);
    grid.addHtml(Util.C.requireChangeID(), requireChangeID);

    maxObjectSizeLimit = new NpTextBox();
    saveEnabler.listenTo(maxObjectSizeLimit);
    effectiveMaxObjectSizeLimit = new Label();
    effectiveMaxObjectSizeLimit.setStyleName(
        Gerrit.RESOURCES.css().maxObjectSizeLimitEffectiveLabel());
    HorizontalPanel p = new HorizontalPanel();
    p.add(maxObjectSizeLimit);
    p.add(effectiveMaxObjectSizeLimit);
    grid.addHtml(Util.C.headingMaxObjectSizeLimit(), p);
  }

  private static ListBox newInheritedBooleanBox() {
    ListBox box = new ListBox();
    for (InheritableBoolean b : InheritableBoolean.values()) {
      box.addItem(b.name(), b.name());
    }
    return box;
  }

  /**
   * Enables the {@link #contentMerge} checkbox if the selected submit type
   * allows the usage of content merge.
   * If the submit type (currently only 'Fast Forward Only') does not allow
   * content merge the useContentMerge checkbox gets disabled.
   */
  private void setEnabledForUseContentMerge() {
    if (SubmitType.FAST_FORWARD_ONLY.equals(Project.SubmitType
        .valueOf(submitType.getValue(submitType.getSelectedIndex())))) {
      contentMerge.setEnabled(false);
      InheritedBooleanInfo b = InheritedBooleanInfo.create();
      b.setConfiguredValue(InheritableBoolean.FALSE);
      setBool(contentMerge, b);
    } else {
      contentMerge.setEnabled(submitType.isEnabled());
    }
  }

  private void initAgreements() {
    grid.addHeader(new SmallHeading(Util.C.headingAgreements()));

    contributorAgreements = newInheritedBooleanBox();
    if (Gerrit.getConfig().isUseContributorAgreements()) {
      saveEnabler.listenTo(contributorAgreements);
      grid.add(Util.C.useContributorAgreements(), contributorAgreements);
    }

    signedOffBy = newInheritedBooleanBox();
    saveEnabler.listenTo(signedOffBy);
    grid.addHtml(Util.C.useSignedOffBy(), signedOffBy);
  }

  private void setSubmitType(final Project.SubmitType newSubmitType) {
    int index = -1;
    if (submitType != null) {
      for (int i = 0; i < submitType.getItemCount(); i++) {
        if (newSubmitType.name().equals(submitType.getValue(i))) {
          index = i;
          break;
        }
      }
      submitType.setSelectedIndex(index);
      setEnabledForUseContentMerge();
    }
  }

  private void setState(final Project.State newState) {
    if (state != null) {
      for (int i = 0; i < state.getItemCount(); i++) {
        if (newState.name().equals(state.getValue(i))) {
          state.setSelectedIndex(i);
          break;
        }
      }
    }
  }

  private void setBool(ListBox box, InheritedBooleanInfo inheritedBoolean) {
    int inheritedIndex = -1;
    for (int i = 0; i < box.getItemCount(); i++) {
      if (box.getValue(i).startsWith(InheritableBoolean.INHERIT.name())) {
        inheritedIndex = i;
      }
      if (box.getValue(i).startsWith(inheritedBoolean.configured_value().name())) {
        box.setSelectedIndex(i);
      }
    }
    if (inheritedIndex >= 0) {
      if (getProjectKey().equals(Gerrit.getConfig().getWildProject())) {
        if (box.getSelectedIndex() == inheritedIndex) {
          for (int i = 0; i < box.getItemCount(); i++) {
            if (box.getValue(i).equals(InheritableBoolean.FALSE.name())) {
              box.setSelectedIndex(i);
              break;
            }
          }
        }
        box.removeItem(inheritedIndex);
      } else {
        box.setItemText(inheritedIndex, InheritableBoolean.INHERIT.name() + " ("
            + inheritedBoolean.inherited_value() + ")");
      }
    }
  }

  private static InheritableBoolean getBool(ListBox box) {
    int i = box.getSelectedIndex();
    if (i >= 0) {
      final String selectedValue = box.getValue(i);
      if (selectedValue.startsWith(InheritableBoolean.INHERIT.name())) {
        return InheritableBoolean.INHERIT;
      }
      return InheritableBoolean.valueOf(selectedValue);
    }
    return InheritableBoolean.INHERIT;
  }

  void display(ConfigInfo result) {
    descTxt.setText(result.description());
    setBool(contributorAgreements, result.use_contributor_agreements());
    setBool(signedOffBy, result.use_signed_off_by());
    setBool(contentMerge, result.use_content_merge());
    setBool(requireChangeID, result.require_change_id());
    setSubmitType(result.submit_type());
    setState(result.state());
    maxObjectSizeLimit.setText(result.max_object_size_limit().configured_value());
    if (result.max_object_size_limit().inherited_value() != null) {
      effectiveMaxObjectSizeLimit.setVisible(true);
      effectiveMaxObjectSizeLimit.setText(
          Util.M.effectiveMaxObjectSizeLimit(result.max_object_size_limit().value()));
      effectiveMaxObjectSizeLimit.setTitle(
          Util.M.globalMaxObjectSizeLimit(result.max_object_size_limit().inherited_value()));
    } else {
      effectiveMaxObjectSizeLimit.setVisible(false);
    }

    saveProject.setEnabled(false);
    initPluginOptions(result);
    initProjectActions(result);
  }

  private void initPluginOptions(ConfigInfo info) {
    pluginOptionsPanel.clear();
    pluginConfigWidgets = new HashMap<>();

    for (String pluginName : info.pluginConfig().keySet()) {
      Map<String, FocusWidget> widgetMap = new HashMap<>();
      pluginConfigWidgets.put(pluginName, widgetMap);
      LabeledWidgetsGrid g = new LabeledWidgetsGrid();
      g.addHeader(new SmallHeading(Util.M.pluginProjectOptionsTitle(pluginName)));
      pluginOptionsPanel.add(g);
      NativeMap<ConfigParameterInfo> pluginConfig =
          info.pluginConfig(pluginName);
      pluginConfig.copyKeysIntoChildren("name");
      for (ConfigParameterInfo param : Natives.asList(pluginConfig.values())) {
        FocusWidget w;
        switch (param.type()) {
          case "STRING":
          case "INT":
          case "LONG":
            w = renderTextBox(g, param);
            break;
          case "BOOLEAN":
            w = renderCheckBox(g, param);
            break;
          case "LIST":
            w = renderListBox(g, param);
            break;
          case "ARRAY":
            w = renderTextArea(g, param);
            break;
          default:
            throw new UnsupportedOperationException("unsupported widget type");
        }
        if (param.editable()) {
          widgetMap.put(param.name(), w);
        } else {
          w.setEnabled(false);
        }
      }
    }

    enableForm();
  }

  private TextBox renderTextBox(LabeledWidgetsGrid g,
      ConfigParameterInfo param) {
    NpTextBox textBox = param.type().equals("STRING")
        ? new NpTextBox()
        : new NpIntTextBox();
    if (param.inheritable()) {
      textBox.setValue(param.configuredValue());
      Label inheritedLabel =
          new Label(Util.M.pluginProjectInheritedValue(param
              .inheritedValue()));
      inheritedLabel.setStyleName(Gerrit.RESOURCES.css()
          .pluginProjectConfigInheritedValue());
      HorizontalPanel p = new HorizontalPanel();
      p.add(textBox);
      p.add(inheritedLabel);
      addWidget(g, p, param);
    } else {
      textBox.setValue(param.value());
      addWidget(g, textBox, param);
    }
    saveEnabler.listenTo(textBox);
    return textBox;
  }

  private CheckBox renderCheckBox(LabeledWidgetsGrid g,
      ConfigParameterInfo param) {
    CheckBox checkBox = new CheckBox(getDisplayName(param));
    checkBox.setValue(Boolean.parseBoolean(param.value()));
    HorizontalPanel p = new HorizontalPanel();
    p.add(checkBox);
    if (param.description() != null) {
      Image infoImg = new Image(Gerrit.RESOURCES.info());
      infoImg.setTitle(param.description());
      p.add(infoImg);
    }
    if (param.warning() != null) {
      Image warningImg = new Image(Gerrit.RESOURCES.warning());
      warningImg.setTitle(param.warning());
      p.add(warningImg);
    }
    g.add((String)null, p);
    saveEnabler.listenTo(checkBox);
    return checkBox;
  }

  private ListBox renderListBox(LabeledWidgetsGrid g,
      ConfigParameterInfo param) {
    if (param.permittedValues() == null) {
      return null;
    }
    ListBox listBox = new ListBox();
    if (param.inheritable()) {
      listBox.addItem(
          Util.M.pluginProjectInheritedListValue(param.inheritedValue()));
      if (param.configuredValue() == null) {
        listBox.setSelectedIndex(0);
      }
      for (int i = 0; i < param.permittedValues().length(); i++) {
        String pv = param.permittedValues().get(i);
        listBox.addItem(pv);
        if (pv.equals(param.configuredValue())) {
          listBox.setSelectedIndex(i + 1);
        }
      }
    } else {
      for (int i = 0; i < param.permittedValues().length(); i++) {
        String pv = param.permittedValues().get(i);
        listBox.addItem(pv);
        if (pv.equals(param.value())) {
          listBox.setSelectedIndex(i);
        }
      }
    }

    if (param.editable()) {
      saveEnabler.listenTo(listBox);
      addWidget(g, listBox, param);
    } else {
      listBox.setEnabled(false);

      if (param.inheritable() && listBox.getSelectedIndex() != 0) {
        // the inherited value is not selected,
        // since the listBox is disabled the inherited value cannot be
        // seen and we have to display it explicitly
        Label inheritedLabel =
            new Label(Util.M.pluginProjectInheritedValue(param
                .inheritedValue()));
        inheritedLabel.setStyleName(Gerrit.RESOURCES.css()
            .pluginProjectConfigInheritedValue());
        HorizontalPanel p = new HorizontalPanel();
        p.add(listBox);
        p.add(inheritedLabel);
        addWidget(g, p, param);
      } else {
        addWidget(g, listBox, param);
      }
    }

    return listBox;
  }

  private NpTextArea renderTextArea(LabeledWidgetsGrid g,
      ConfigParameterInfo param) {
    NpTextArea txtArea = new NpTextArea();
    txtArea.setVisibleLines(4);
    txtArea.setCharacterWidth(40);
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < param.values().length(); i++) {
      String v = param.values().get(i);
      sb.append(v).append("\n");
    }
    txtArea.setText(sb.toString());
    if (param.editable()) {
      saveEnabler.listenTo(txtArea);
    } else {
      txtArea.setEnabled(false);
    }
    addWidget(g, txtArea, param);
    return txtArea;
  }

  private void addWidget(LabeledWidgetsGrid g, Widget w, ConfigParameterInfo param) {
    if (param.description() != null || param.warning() != null) {
      HorizontalPanel p = new HorizontalPanel();
      p.add(new Label(getDisplayName(param)));
      if (param.description() != null) {
        Image infoImg = new Image(Gerrit.RESOURCES.info());
        infoImg.setTitle(param.description());
        p.add(infoImg);
      }
      if (param.warning() != null) {
        Image warningImg = new Image(Gerrit.RESOURCES.warning());
        warningImg.setTitle(param.warning());
        p.add(warningImg);
      }
      p.add(new Label(":"));
      g.add(p, w);
    } else {
      g.add(getDisplayName(param), w);
    }
  }

  private String getDisplayName(ConfigParameterInfo param) {
    return param.displayName() != null ? param.displayName() : param.name();
  }

  private void initProjectActions(ConfigInfo info) {
    actionsGrid.clear(true);
    actionsGrid.removeAllRows();

    NativeMap<ActionInfo> actions = info.actions();
    if (actions == null || actions.isEmpty()) {
      return;
    }
    actions.copyKeysIntoChildren("id");
    actionsGrid.addHeader(new SmallHeading(Util.C.headingProjectCommands()));
    FlowPanel actionsPanel = new FlowPanel();
    actionsPanel.setStyleName(Gerrit.RESOURCES.css().projectActions());
    actionsPanel.setVisible(true);
    actionsGrid.add(Util.C.headingCommands(), actionsPanel);
    for (String id : actions.keySet()) {
      actionsPanel.add(new ActionButton(getProjectKey(),
          actions.get(id)));
    }
  }

  private void doSave() {
    enableForm(false);
    saveProject.setEnabled(false);
    ProjectApi.setConfig(getProjectKey(), descTxt.getText().trim(),
        getBool(contributorAgreements), getBool(contentMerge),
        getBool(signedOffBy), getBool(requireChangeID),
        maxObjectSizeLimit.getText().trim(),
        Project.SubmitType.valueOf(submitType.getValue(submitType.getSelectedIndex())),
        Project.State.valueOf(state.getValue(state.getSelectedIndex())),
        getPluginConfigValues(), new GerritCallback<ConfigInfo>() {
          @Override
          public void onSuccess(ConfigInfo result) {
            enableForm();
            display(result);
          }

          @Override
          public void onFailure(Throwable caught) {
            enableForm();
            super.onFailure(caught);
          }
        });
  }

  private Map<String, Map<String, ConfigParameterValue>> getPluginConfigValues() {
    Map<String, Map<String, ConfigParameterValue>> pluginConfigValues =
        new HashMap<>(pluginConfigWidgets.size());
    for (Entry<String, Map<String, FocusWidget>> e : pluginConfigWidgets.entrySet()) {
      Map<String, ConfigParameterValue> values = new HashMap<>(e.getValue().size());
      pluginConfigValues.put(e.getKey(), values);
      for (Entry<String, FocusWidget> e2 : e.getValue().entrySet()) {
        FocusWidget widget = e2.getValue();
        if (widget instanceof TextBox) {
          values.put(e2.getKey(), ConfigParameterValue.create()
              .value(((TextBox) widget).getValue().trim()));
        } else if (widget instanceof CheckBox) {
          values.put(e2.getKey(), ConfigParameterValue.create()
              .value(Boolean.toString(((CheckBox) widget).getValue())));
        } else if (widget instanceof ListBox) {
          ListBox listBox = (ListBox) widget;
          // the inherited value is at index 0,
          // if it is selected no value should be set on this project
          String value = listBox.getSelectedIndex() > 0
              ? listBox.getValue(listBox.getSelectedIndex()) : null;
          values.put(e2.getKey(), ConfigParameterValue.create()
              .value(value));
        } else if (widget instanceof NpTextArea) {
          String text = ((NpTextArea) widget).getText().trim();
          values.put(e2.getKey(), ConfigParameterValue.create()
              .values(text.split("\n")));
        } else {
          throw new UnsupportedOperationException("unsupported widget type");
        }
      }
    }
    return pluginConfigValues;
  }

  public class ProjectDownloadPanel extends DownloadPanel {
    public ProjectDownloadPanel(String project, boolean isAllowsAnonymous) {
      super(project, null, isAllowsAnonymous);
    }

    @Override
    public void populateDownloadCommandLinks() {
      if (!urls.isEmpty()) {
        if (allowedCommands.contains(DownloadCommand.CHECKOUT)
            || allowedCommands.contains(DownloadCommand.DEFAULT_DOWNLOADS)) {
          commands.add(cmdLinkfactory.new CloneCommandLink());
          if (Gerrit.getConfig().getSshdAddress() != null && hasUserName()) {
            commands.add(
                cmdLinkfactory.new CloneWithCommitMsgHookCommandLink(getProjectKey()));
          }
        }
      }
    }
  }

  private static boolean hasUserName() {
    return Gerrit.isSignedIn()
        && Gerrit.getUserAccount().getUserName() != null
        && Gerrit.getUserAccount().getUserName().length() > 0;
  }

  private class LabeledWidgetsGrid extends FlexTable {
    private String labelSuffix;

    public LabeledWidgetsGrid() {
      super();
      labelSuffix = ":";
    }

    private void addHeader(Widget widget) {
      int row = getRowCount();
      insertRow(row);
      setWidget(row, 0, widget);
      getCellFormatter().getElement(row, 0).setAttribute("colSpan", "2");
    }

    private void add(String label, boolean labelIsHtml, Widget widget) {
      int row = getRowCount();
      insertRow(row);
      if (label != null) {
        if (labelIsHtml) {
          setHTML(row, 0, label + labelSuffix);
        } else {
          setText(row, 0, label + labelSuffix);
        }
      }
      setWidget(row, 1, widget);
    }

    public void add(String label, Widget widget) {
      add(label, false, widget);
    }

    public void addHtml(String label, Widget widget) {
      add(label, true, widget);
    }

    public void add(Widget label, Widget widget) {
      int row = getRowCount();
      insertRow(row);
      setWidget(row, 0, label);
      setWidget(row, 1, widget);
    }
  }
}

redpajama_set_name: RedPajamaGithub


text:
module JquerySmoothScrollRails
  VERSION = "0.0.5"
end


text:
'use strict';

//Setting up route
angular.module('assigncourses').config(['$stateProvider',
	function($stateProvider) {
		// Assigncourses state routing
		$stateProvider.
		state('listAssigncourses', {
			url: '/assigncourses',
			templateUrl: 'modules/assigncourses/views/list-assigncourses.client.view.html'
		}).
		state('createAssigncourse', {
			url: '/assigncourses/create',
			templateUrl: 'modules/assigncourses/views/create-assigncourse.client.view.html'
		}).
		state('viewAssigncourse', {
			url: '/assigncourses/:assigncourseId',
			templateUrl: 'modules/assigncourses/views/view-assigncourse.client.view.html'
		}).
		state('editAssigncourse', {
			url: '/assigncourses/:assigncourseId/edit',
			templateUrl: 'modules/assigncourses/views/edit-assigncourse.client.view.html'
		});
	}
]);


text:
/*

    BACKGROUND POSITION

    Modifiers:
    -center = center center
    -top = top center
    -right = center right
    -bottom = bottom center
    -left = center left

    Media Query Extensions:
      -ns = not-small
      -m  = medium
      -l  = large

 */

.backgroundposition-center {
  background-repeat: no-repeat;
  background-position: center center;
}

.backgroundposition-top {
  background-repeat: no-repeat;
  background-position: top center;
}

.backgroundposition-right {
  background-repeat: no-repeat;
  background-position: center right;
}

.backgroundposition-bottom {
  background-repeat: no-repeat;
  background-position: bottom center;
}

.backgroundposition-left {
  background-repeat: no-repeat;
  background-position: center left;
}

@media (--breakpoint-not-small) {
  .backgroundposition-center-ns {
    background-repeat: no-repeat;
    background-position: center center;
  }

  .backgroundposition-top-ns {
    background-repeat: no-repeat;
    background-position: top center;
  }

  .backgroundposition-right-ns {
    background-repeat: no-repeat;
    background-position: center right;
  }

  .backgroundposition-bottom-ns {
    background-repeat: no-repeat;
    background-position: bottom center;
  }

  .backgroundposition-left-ns {
    background-repeat: no-repeat;
    background-position: center left;
  }
}

@media (--breakpoint-medium) {
  .backgroundposition-center-m {
    background-repeat: no-repeat;
    background-position: center center;
  }

  .backgroundposition-top-m {
    background-repeat: no-repeat;
    background-position: top center;
  }

  .backgroundposition-right-m {
    background-repeat: no-repeat;
    background-position: center right;
  }

  .backgroundposition-bottom-m {
    background-repeat: no-repeat;
    background-position: bottom center;
  }

  .backgroundposition-left-m {
    background-repeat: no-repeat;
    background-position: center left;
  }
}

@media (--breakpoint-large) {
  .backgroundposition-center-l {
    background-repeat: no-repeat;
    background-position: center center;
  }

  .backgroundposition-top-l {
    background-repeat: no-repeat;
    background-position: top center;
  }

  .backgroundposition-right-l {
    background-repeat: no-repeat;
    background-position: center right;
  }

  .backgroundposition-bottom-l {
    background-repeat: no-repeat;
    background-position: bottom center;
  }

  .backgroundposition-left-l {
    background-repeat: no-repeat;
    background-position: center left;
  }
}


text:
package org.apache.tools.ant.taskdefs.rmic;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.util.JavaEnvUtils;
import org.apache.tools.ant.taskdefs.Rmic;
import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.taskdefs.LogStreamHandler;
import org.apache.tools.ant.types.Commandline;

import java.io.IOException;

/**
 * This is an extension of the sun rmic compiler, which forks rather than
 * executes it inline. Why so? Because rmic is dog slow, but if you fork the
 * compiler you can have multiple copies compiling different bits of your project
 * at the same time. Which, on a multi-cpu system results in significant speedups.
 *
 * Also, Java1.6 behaves oddly with -XNew, so we switch it on here if needed.
 * @since ant1.7
 */
public class ForkingSunRmic extends DefaultRmicAdapter {

    /**
     * the name of this adapter for users to select
     */
    public static final String COMPILER_NAME = "forking";

    /**
     * exec by creating a new command
     * @return true if the command ran successfully
     * @throws BuildException on error
     */
    public boolean execute() throws BuildException {
        Rmic owner = getRmic();
        Commandline cmd = setupRmicCommand();
        Project project = owner.getProject();
        String executable = owner.getExecutable();
        if (executable == null) {
            // no explicitly specified executable
            // rely on RMIC being on the path
            executable = JavaEnvUtils.getJdkExecutable(getExecutableName());
        }
        cmd.setExecutable(executable);

        //set up the args
        String[] args = cmd.getCommandline();

        try {
            Execute exe = new Execute(new LogStreamHandler(owner,
                    Project.MSG_INFO,
                    Project.MSG_WARN));
            exe.setAntRun(project);
            exe.setWorkingDirectory(project.getBaseDir());
            exe.setCommandline(args);
            exe.execute();
            return !exe.isFailure();
        } catch (IOException exception) {
            throw new BuildException("Error running " + getExecutableName()
                    + " -maybe it is not on the path", exception);
        }
    }

    /**
     * Override point.
     * @return the executable name.
     */
    protected String getExecutableName() {
        return SunRmic.RMIC_EXECUTABLE;
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto" >

    <!-- TODO: use ic_action_search -->
    <item
        android:id="@+id/menu_gosearch"
        android:icon="@android:drawable/ic_menu_search"
        android:title="@string/search_bar_hint"
        app:actionViewClass="androidx.appcompat.widget.SearchView"
        app:iconifiedByDefault="true"
        app:showAsAction="collapseActionView|always"/>
    <item
        android:id="@+id/menu_history"
        android:icon="@drawable/ic_menu_recent_history"
        android:title="@string/menu_history"
        app:showAsAction="ifRoom">
    </item>
    <item
        android:id="@+id/menu_pocket_queries"
        android:icon="@drawable/ic_menu_pocket_query"
        android:title="@string/menu_lists_pocket_queries"
        android:visible="false"
        app:showAsAction="ifRoom">
    </item>
    <item
        android:id="@+id/menu_wizard"
        android:icon="@drawable/ic_menu_preferences"
        android:title="@string/wizard"
        app:showAsAction="never">
    </item>
    <item
        android:id="@+id/menu_settings"
        android:icon="@drawable/ic_menu_preferences"
        android:title="@string/menu_settings"
        app:showAsAction="ifRoom">
    </item>
    <item
        android:id="@+id/menu_backup"
        android:icon="@drawable/ic_menu_save"
        android:title="@string/menu_backup"
        app:showAsAction="ifRoom">
    </item>
    <item
        android:title="@string/menu_update"
        app:showAsAction="ifRoom">
        <menu>
            <item
                android:id="@+id/menu_update_routingdata"
                android:title="@string/menu_update_routingdata">
            </item>
            <item
                android:id="@+id/menu_update_mapdata"
                android:title="@string/menu_update_mapdata">
            </item>
        </menu>
    </item>
    <item
        android:id="@+id/menu_helpers"
        android:icon="@drawable/ic_menu_shopping"
        android:title="@string/menu_helpers"
        app:showAsAction="ifRoom">
    </item>
    <item
        android:id="@+id/menu_scan"
        android:icon="@drawable/ic_menu_barcode"
        android:title="@string/menu_scan_geo"
        app:showAsAction="ifRoom">
    </item>
    <item
        android:id="@+id/menu_about"
        android:icon="@drawable/ic_menu_info_details"
        android:title="@string/menu_about"
        app:showAsAction="ifRoom">
    </item>

    <item
        android:id="@+id/menu_report_problem"
        android:icon="@drawable/ic_menu_info_details"
        android:title="@string/debug_user_error_report_title"
        app:showAsAction="ifRoom">
    </item>

</menu>


text:
opera.isReady(function() {
    var tests = {}; // Asynchronous tests

    tests["block"] = async_test("Blocking by resource type: document.");
    block.add("*fail.html*", {resources: types("document")});

    opera.extension.onmessage = function(evt) {
    	opera.postError(JSON.stringify(evt.data));

    	if (evt.data.type === "contentblocked") {
    		tests["block"].step(function(){
    			assert_equals(evt.data.url, "http://t/resources/fail.html", "The correct URL should be blocked.");
    			assert_equals(evt.data.tagName, null, "No element should be associated with this block.");
    		});
    	} else if (evt.data.type === "contentunblocked") {
    		tests["block"].step(function(){
    			assert_unreached("Unexpected message recieved: " + JSON.stringify(evt.data))
    		});
    	} else {
    		return // Ignore contentallowed events
    	}
    	tests["block"].done();
    }

    createTab({url: "http://t/resources/fail.html"});
});


text:
/**
 *
 */
package org.openforis.collect.model.proxy;

import org.granite.messaging.amf.io.util.externalizer.annotation.ExternalizedProperty;
import org.openforis.collect.Proxy;
import org.openforis.idm.model.Coordinate;

/**
 * @author S. Ricci
 *
 */
public class CoordinateProxy implements Proxy {

	private transient Coordinate coordinate;

	public CoordinateProxy(Coordinate coordinate) {
		super();
		this.coordinate = coordinate;
	}

	@ExternalizedProperty
	public String getSrsId() {
		return coordinate.getSrsId();
	}

	@ExternalizedProperty
	public Double getX() {
		return coordinate.getX();
	}

	@ExternalizedProperty
	public Double getY() {
		return coordinate.getY();
	}

}


text:
import java.util.HashSet;
import java.util.Set;

public class THashSetExample {
    <caret>private static final Set<Integer> INT_CONSTANT = new HashSet<>();
}


text:
package org.gluu.oxtrust.action;

import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;

import javax.enterprise.context.ConversationScoped;
import javax.faces.application.FacesMessage;
import javax.inject.Inject;
import javax.inject.Named;

import org.gluu.config.oxtrust.AppConfiguration;
import org.gluu.jsf2.message.FacesMessages;
import org.gluu.jsf2.service.ConversationService;
import org.gluu.model.SimpleCustomProperty;
import org.gluu.model.SimpleExtendedCustomProperty;
import org.gluu.model.SimpleProperty;
import org.gluu.model.custom.script.CustomScriptType;
import org.gluu.model.custom.script.model.CustomScript;
import org.gluu.model.ldap.GluuLdapConfiguration;
import org.gluu.model.passport.PassportConfiguration;
import org.gluu.oxtrust.service.config.ConfigurationFactory;
import org.gluu.oxtrust.model.GluuConfiguration;
import org.gluu.oxtrust.model.LdapConfigurationModel;
import org.gluu.oxtrust.model.OxIDPAuthConf;
import org.gluu.oxtrust.model.SimpleCustomPropertiesListModel;
import org.gluu.oxtrust.model.SimplePropertiesListModel;
import org.gluu.oxtrust.service.ConfigurationService;
import org.gluu.oxtrust.service.EncryptionService;
import org.gluu.oxtrust.service.JsonConfigurationService;
import org.gluu.oxtrust.util.OxTrustConstants;
import org.gluu.persist.exception.BasePersistenceException;
import org.gluu.persist.ldap.operation.impl.LdapConnectionProvider;
import org.gluu.service.custom.script.AbstractCustomScriptService;
import org.gluu.service.security.Secure;
import org.gluu.util.OxConstants;
import org.gluu.util.StringHelper;
import org.gluu.util.security.PropertiesDecrypter;
import org.gluu.util.security.StringEncrypter.EncryptionException;
import org.slf4j.Logger;

/**
 * Action class for configuring person authentication
 *
 * @author Yuriy Movchan Date: 16/11/2010
 */
@Named("managePersonAuthenticationAction")
@ConversationScoped
@Secure("#{permissionService.hasPermission('configuration', 'access')}")
public class ManagePersonAuthenticationAction
		implements SimplePropertiesListModel, SimpleCustomPropertiesListModel, LdapConfigurationModel, Serializable {
	private static final String SIMPLE_PASSWORD_AUTH = "simple_password_auth";

	private static final long serialVersionUID = -4470460481895022468L;

	@Inject
	private Logger log;

	@Inject
	private FacesMessages facesMessages;

	@Inject
	private ConversationService conversationService;

	@Inject
	private ConfigurationService configurationService;

	@Inject
	private AbstractCustomScriptService customScriptService;

	@Inject
	private ConfigurationFactory configurationFactory;

	@Inject
	private EncryptionService encryptionService;

	private boolean existLdapConfigIdpAuthConf;

	private List<CustomScript> customScripts;

	private List<GluuLdapConfiguration> sourceConfigs;

	private GluuLdapConfiguration activeLdapConfig;

	private String authenticationMode = "auth_ldap_server";

	private String oxTrustAuthenticationMode;

	private String recaptchaSiteKey;
	private String recaptchaSecretKey;

	private List<String> customAuthenticationConfigNames;

	private boolean initialized;

	private Boolean passportEnable = Boolean.FALSE;
	private boolean authenticationRecaptchaEnabled = false;

	public boolean isAuthenticationRecaptchaEnabled() {
		return authenticationRecaptchaEnabled;
	}

	public void setAuthenticationRecaptchaEnabled(boolean authenticationRecaptchaEnabled) {
		this.authenticationRecaptchaEnabled = authenticationRecaptchaEnabled;
	}

	@Inject
	private JsonConfigurationService jsonConfigurationService;

	private AppConfiguration oxTrustappConfiguration;

	public String modify() {
		String outcome = modifyImpl();

		if (OxTrustConstants.RESULT_FAILURE.equals(outcome)) {
			facesMessages.add(FacesMessage.SEVERITY_ERROR, facesMessages
					.evalResourceAsString("#{msgs['configuration.manageAuthentication.failToPrepareUpdate']}"));
			conversationService.endConversation();
		}

		return outcome;
	}

	public String modifyImpl() {
		if (this.initialized) {
			return OxTrustConstants.RESULT_SUCCESS;
		}
		try {
			GluuConfiguration configuration = configurationService.getConfiguration();
			if (configuration == null) {
				return OxTrustConstants.RESULT_FAILURE;
			}
			this.passportEnable = configuration.isPassportEnabled();
			this.customScripts = customScriptService.findCustomScripts(
					Arrays.asList(CustomScriptType.PERSON_AUTHENTICATION), "displayName", "oxLevel", "oxEnabled");
			List<OxIDPAuthConf> list = getIDPAuthConfOrNull(configuration);
			this.sourceConfigs = new ArrayList<GluuLdapConfiguration>();
			if (list != null) {
				for (OxIDPAuthConf oxIDPAuthConf : list) {
					GluuLdapConfiguration oxldapConfig = oxIDPAuthConf.getConfig();
					this.sourceConfigs.add(oxldapConfig);
				}
			}
			getAuthenticationRecaptcha();
			this.authenticationMode = configuration.getAuthenticationMode();
			this.oxTrustAuthenticationMode = configuration.getOxTrustAuthenticationMode();
		} catch (Exception ex) {
			log.error("Failed to load configuration configuration", ex);
			return OxTrustConstants.RESULT_FAILURE;
		}

		this.initialized = true;

		return OxTrustConstants.RESULT_SUCCESS;
	}

	public String save() throws IOException {
		try {
			// Reload entry to include latest changes
			GluuConfiguration configuration = configurationService.getConfiguration();
			boolean updateAuthenticationMode = false;
			boolean updateOxTrustAuthenticationMode = false;

			String oldAuthName = getFirstConfigName(configuration.getOxIDPAuthentication());
			if (oldAuthName != null) {
				if (oldAuthName.equals(this.authenticationMode)) {
					updateAuthenticationMode = true;
				}
				if (oldAuthName.equals(this.oxTrustAuthenticationMode)) {
					updateOxTrustAuthenticationMode = true;
				}
			}

			updateAuthConf(configuration);
			String newAuthName = getFirstConfigName(configuration.getOxIDPAuthentication());
			String updatedAuthMode = updateAuthenticationMode ? newAuthName : this.authenticationMode;
			String updatedOxTrustAuthMode = updateOxTrustAuthenticationMode ? newAuthName
					: this.oxTrustAuthenticationMode;
			configuration.setAuthenticationMode(updatedAuthMode);
			configuration.setOxTrustAuthenticationMode(updatedOxTrustAuthMode);
			setAuthenticationRecaptcha();
			configuration.setPassportEnabled(passportEnable);
			configurationService.updateConfiguration(configuration);
		} catch (BasePersistenceException ex) {
			log.error("Failed to update configuration configuration", ex);
			facesMessages.add(FacesMessage.SEVERITY_ERROR, "Failed to update configuration");
			return OxTrustConstants.RESULT_FAILURE;
		}

		reset();
		facesMessages.add(FacesMessage.SEVERITY_INFO,
				facesMessages.evalResourceAsString("#{msgs['configuration.manageAuthentication.updateSucceed']}"));
		conversationService.endConversation();
		return OxTrustConstants.RESULT_SUCCESS;
	}

	private String getFirstConfigName(List<OxIDPAuthConf> idpConfs) {
		if ((idpConfs == null) || idpConfs.isEmpty()) {
			return null;
		}

		return idpConfs.get(0).getName();
	}

	private void reset() {
		this.customAuthenticationConfigNames = null;
	}

	public String cancel() {
		facesMessages.add(FacesMessage.SEVERITY_INFO,
				facesMessages.evalResourceAsString("#{msgs['configuration.manageAuthentication.updateFailed']}"));
		conversationService.endConversation();
		return OxTrustConstants.RESULT_SUCCESS;
	}

	public boolean updateAuthConf(GluuConfiguration configuration) {
		try {
			List<OxIDPAuthConf> idpConf = new ArrayList<OxIDPAuthConf>();
			for (GluuLdapConfiguration ldapConfig : this.sourceConfigs) {
				if (ldapConfig.isUseAnonymousBind()) {
					ldapConfig.setBindDN(null);
				}
				OxIDPAuthConf ldapConfigIdpAuthConf = new OxIDPAuthConf();
				ldapConfig.updateStringsLists();
				ldapConfigIdpAuthConf.setType("auth");
				ldapConfigIdpAuthConf.setVersion(ldapConfigIdpAuthConf.getVersion() + 1);
				ldapConfigIdpAuthConf.setName(ldapConfig.getConfigId());
				ldapConfigIdpAuthConf.setEnabled(ldapConfig.isEnabled());
				ldapConfigIdpAuthConf.setConfig(ldapConfig);
				idpConf.add(ldapConfigIdpAuthConf);
			}
			configuration.setOxIDPAuthentication(idpConf);
		} catch (Exception ex) {
			log.error("An Error occured ", ex);
			return false;
		}

		return true;
	}

	public List<String> getPersonAuthenticationConfigurationNames() {
		if (this.customAuthenticationConfigNames == null) {
			this.customAuthenticationConfigNames = new ArrayList<String>();
			for (CustomScript customScript : this.customScripts) {
				if (customScript.isEnabled()) {
					String name = customScript.getName();
					if (StringHelper.isEmpty(name)) {
						continue;
					}
					this.customAuthenticationConfigNames.add(customScript.getName());
				}
			}
			boolean internalServerName = true;
			for (GluuLdapConfiguration ldapConfig : this.sourceConfigs) {
				if ((ldapConfig != null) && StringHelper.isNotEmpty(ldapConfig.getConfigId())
						&& ldapConfig.isEnabled()) {
					this.customAuthenticationConfigNames.add(ldapConfig.getConfigId());
					internalServerName = false;
				}
			}

			if (internalServerName) {
				this.customAuthenticationConfigNames.add(OxConstants.SCRIPT_TYPE_INTERNAL_RESERVED_NAME);
			}
			if (shouldEnableSimplePasswordAuth()
					&& !this.customAuthenticationConfigNames.contains(SIMPLE_PASSWORD_AUTH)) {
				this.customAuthenticationConfigNames.add(SIMPLE_PASSWORD_AUTH);
			}
		}
		return this.customAuthenticationConfigNames;
	}

	public String testLdapConnection(GluuLdapConfiguration ldapConfig) {
		try {
			Properties properties = new Properties();
			properties.setProperty("bindDN", ldapConfig.getBindDN());
			properties.setProperty("bindPassword", ldapConfig.getBindPassword());
			properties.setProperty("servers", buildServersString(ldapConfig.getServers()));
			properties.setProperty("useSSL", Boolean.toString(ldapConfig.isUseSSL()));
			Properties ldapDecryptedProperties = PropertiesDecrypter
					.decryptProperties(properties, configurationFactory.getCryptoConfigurationSalt());
			log.trace("Attempting to create LDAP connection with properties: {}", ldapDecryptedProperties);

			LdapConnectionProvider connectionProvider = new LdapConnectionProvider(ldapDecryptedProperties);
			connectionProvider.create();
			if (connectionProvider.isConnected()) {
				connectionProvider.closeConnectionPool();

				facesMessages.add(FacesMessage.SEVERITY_INFO, facesMessages
						.evalResourceAsString("#{msgs['configuration.manageAuthentication.ldap.testSucceed']}"));

				return OxTrustConstants.RESULT_SUCCESS;

			}
			if (connectionProvider.getConnectionPool() != null) {
				connectionProvider.closeConnectionPool();
			}
		} catch (Exception ex) {
			log.error("Could not connect to LDAP", ex);
		}

		facesMessages.add(FacesMessage.SEVERITY_ERROR,
				facesMessages.evalResourceAsString("#{msgs['configuration.manageAuthentication.ldap.testFailed']}"));

		return OxTrustConstants.RESULT_FAILURE;
	}

	private String buildServersString(List<SimpleProperty> servers) {
		StringBuilder sb = new StringBuilder();

		if (servers == null) {
			return sb.toString();
		}

		boolean first = true;
		for (SimpleProperty server : servers) {
			if (first) {
				first = false;
			} else {
				sb.append(",");
			}

			sb.append(server.getValue());
		}

		return sb.toString();
	}

	public void updateLdapBindPassword(GluuLdapConfiguration ldapConfig) {
		log.info("hello setting passoword" + ldapConfig.getPrimaryKey());
	}

	public String updateLdapBindPassword(String bindPassword) {
		String encryptedLdapBindPassword = null;
		try {
			encryptedLdapBindPassword = encryptionService.encrypt(bindPassword);
			return encryptedLdapBindPassword;
		} catch (EncryptionException ex) {
			log.error("Failed to encrypt LDAP bind password", ex);
		}

		return null;
	}

	public boolean isExistLdapConfigIdpAuthConf() {
		return existLdapConfigIdpAuthConf;
	}

	@Override
	public void addItemToSimpleProperties(List<SimpleProperty> simpleProperties) {
		if (simpleProperties != null) {
			simpleProperties.add(new SimpleProperty(""));
		}
	}

	@Override
	public void removeItemFromSimpleProperties(List<SimpleProperty> simpleProperties, SimpleProperty simpleProperty) {
		if (simpleProperties != null) {
			simpleProperties.remove(simpleProperty);
		}
	}

	public String getAuthenticationMode() {
		return authenticationMode;
	}

	public void setAuthenticationMode(String authenticationMode) {
		this.authenticationMode = authenticationMode;
	}

	public String getOxTrustAuthenticationMode() {
		return oxTrustAuthenticationMode;
	}

	public void setOxTrustAuthenticationMode(String oxTrustAuthenticationMode) {
		this.oxTrustAuthenticationMode = oxTrustAuthenticationMode;
	}

	public boolean isInitialized() {
		return initialized;
	}

	public String getId(Object obj) {
		return "c" + System.identityHashCode(obj) + "Id";
	}

	public void addStrategy() {

	}

	public void addField(PassportConfiguration removePassportConfiguration) {

	}

	public Boolean getPassportEnable() {
		return passportEnable;
	}

	public void setPassportEnable(Boolean passportEnable) {
		this.passportEnable = passportEnable;
	}

	private List<OxIDPAuthConf> getIDPAuthConfOrNull(GluuConfiguration configuration) {
		List<OxIDPAuthConf> idpConfs = configuration.getOxIDPAuthentication();
		List<OxIDPAuthConf> authIdpConfs = new ArrayList<OxIDPAuthConf>();
		if (idpConfs != null) {
			for (OxIDPAuthConf idpConf : idpConfs) {
				if (idpConf.getType().equalsIgnoreCase("auth")) {
					authIdpConfs.add(idpConf);
				}
			}
		}
		return authIdpConfs;

	}

	public List<GluuLdapConfiguration> getSourceConfigs() {
		return sourceConfigs;
	}

	public void setSourceConfigs(List<GluuLdapConfiguration> sourceConfigs) {
		this.sourceConfigs = sourceConfigs;
	}

	public void addSourceConfig() {
		addLdapConfig(this.getSourceConfigs());
	}

	@Override
	public void addLdapConfig(List<GluuLdapConfiguration> ldapConfigList) {
		GluuLdapConfiguration ldapConfiguration = new GluuLdapConfiguration();
		ldapConfiguration.setBindPassword("");
		ldapConfigList.add(ldapConfiguration);
	}

	@Override
	public void removeLdapConfig(List<GluuLdapConfiguration> ldapConfigList, GluuLdapConfiguration removeLdapConfig) {
		for (Iterator<GluuLdapConfiguration> iterator = ldapConfigList.iterator(); iterator.hasNext();) {
			GluuLdapConfiguration ldapConfig = iterator.next();
			if (System.identityHashCode(removeLdapConfig) == System.identityHashCode(ldapConfig)) {
				iterator.remove();
				return;
			}
		}
	}

	public GluuLdapConfiguration getActiveLdapConfig() {
		return activeLdapConfig;
	}

	public void updateBindPassword() {
		if (this.activeLdapConfig == null) {
			return;
		}

		try {
			this.activeLdapConfig.setBindPassword(encryptionService.encrypt(this.activeLdapConfig.getBindPassword()));
		} catch (EncryptionException ex) {
			log.error("Failed to encrypt password", ex);
		}
	}

	@Override
	public void setActiveLdapConfig(GluuLdapConfiguration activeLdapConfig) {
		this.activeLdapConfig = activeLdapConfig;
	}

	@Override
	public void addItemToSimpleCustomProperties(List<SimpleCustomProperty> simpleCustomProperties) {
		simpleCustomProperties.add(new SimpleExtendedCustomProperty("", ""));
	}

	@Override
	public void removeItemFromSimpleCustomProperties(List<SimpleCustomProperty> simpleCustomProperties,
			SimpleCustomProperty simpleCustomProperty) {
		if (simpleCustomProperties != null) {
			simpleCustomProperties.remove(simpleCustomProperty);
		}
	}

	public void removeStrategy(PassportConfiguration removePassportConfiguration) {

	}

	public String getRecaptchaSiteKey() {
		return recaptchaSiteKey;
	}

	public void setRecaptchaSiteKey(String recaptchaSiteKey) {
		this.recaptchaSiteKey = recaptchaSiteKey;
	}

	public String getRecaptchaSecretKey() {
		return recaptchaSecretKey;
	}

	public void setRecaptchaSecretKey(String recaptchaSecretKey) {
		this.recaptchaSecretKey = recaptchaSecretKey;
	}

	private void setAuthenticationRecaptcha() {
		this.oxTrustappConfiguration = jsonConfigurationService.getOxTrustappConfiguration();
		this.oxTrustappConfiguration.setRecaptchaSecretKey(this.recaptchaSecretKey);
		this.oxTrustappConfiguration.setRecaptchaSiteKey(this.recaptchaSiteKey);
		this.oxTrustappConfiguration.setAuthenticationRecaptchaEnabled(!authenticationRecaptchaEnabled);
		this.jsonConfigurationService.saveOxTrustappConfiguration(this.oxTrustappConfiguration);

	}

	private void getAuthenticationRecaptcha() {
		this.oxTrustappConfiguration = jsonConfigurationService.getOxTrustappConfiguration();
		this.recaptchaSecretKey = oxTrustappConfiguration.getRecaptchaSecretKey();
		this.recaptchaSiteKey = oxTrustappConfiguration.getRecaptchaSiteKey();
		this.authenticationRecaptchaEnabled = !oxTrustappConfiguration.isAuthenticationRecaptchaEnabled();

	}

	private boolean shouldEnableSimplePasswordAuth() {
		return !this.sourceConfigs.stream().anyMatch(e -> e.isEnabled());

	}

	public AppConfiguration getOxTrustappConfiguration() {
		return oxTrustappConfiguration;
	}

	public void setOxTrustappConfiguration(AppConfiguration oxTrustappConfiguration) {
		this.oxTrustappConfiguration = oxTrustappConfiguration;
	}

}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/ag_edittext_gray"
    android:orientation="horizontal"
    android:gravity="center_vertical" >

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_weight="1.5">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/ag_10dp"
            android:layout_marginTop="@dimen/ag_10dp"
            android:orientation="vertical" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/ag_pay_tv14"
                android:textColor="@color/ag_color_black"
                android:textSize="@dimen/ag_16sp" />

            <TextView
                android:id="@+id/ag_tv_order_number"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/ag_pay_tv15"
                android:textColor="@color/ag_color_black"
                android:textSize="@dimen/ag_16sp" />
        </LinearLayout>

        <TextView
            android:id="@+id/ag_tv_order_time"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/ag_10dp"
            android:layout_marginTop="@dimen/ag_8dp"
            android:text="@string/ag_pay_tv16"
            android:textSize="@dimen/ag_14sp"
            android:textColor="@color/ag_color_black_textview"
            android:layout_marginBottom="@dimen/ag_10dp" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="@dimen/ag_10dp"
        android:gravity="right"
        android:orientation="horizontal"
        android:paddingLeft="@dimen/ag_8dp"
        android:padding="@dimen/ag_8dp" >

        <TextView
            android:id="@+id/ag_tv_order_money"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/ag_3dp"
            android:layout_marginLeft="@dimen/ag_10dp"
            android:text="@string/ag_pay_tv17"
            android:textSize="@dimen/ag_28sp"
            android:textColor="@color/ag_color_red"
            android:layout_weight="0.2"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/ag_3dp"
            android:text="@string/ag_pay_tv18"
            android:textColor="@color/ag_color_red"
            android:textSize="@dimen/ag_20sp"
            android:layout_weight="0.5" />
    </LinearLayout>

</LinearLayout>


text:
CREATE DATABASE `scalemanager_eventlog`;
USE `scalemanager_eventlog`;
CREATE TABLE `history` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `timestamp` INT UNSIGNED NOT NULL,
  `type` VARCHAR(255) NOT NULL,
  `instance` VARCHAR(255) NOT NULL,
  `value` VARCHAR(255) NOT NULL,
  PRIMARY KEY (`id`),
  INDEX `Query` (`timestamp` ASC, `type` ASC, `instance` ASC)
);


text:
package org.deeplearning4j.nn.conf.graph;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.deeplearning4j.nn.conf.InputPreProcessor;
import org.deeplearning4j.nn.conf.NeuralNetConfiguration;
import org.deeplearning4j.nn.conf.inputs.InputType;
import org.deeplearning4j.nn.conf.inputs.InvalidInputTypeException;
import org.deeplearning4j.nn.conf.memory.MemoryReport;
import org.deeplearning4j.nn.graph.ComputationGraph;
import org.nd4j.linalg.api.buffer.DataType;
import org.nd4j.linalg.api.ndarray.INDArray;

import java.util.Arrays;

/**
 * LayerVertex is a GraphVertex with a neural network Layer (and, optionally an {@link InputPreProcessor}) in it
 *
 * @author Alex Black
 */
@NoArgsConstructor
@Data
@EqualsAndHashCode(callSuper = false)
public class LayerVertex extends GraphVertex {

    private NeuralNetConfiguration layerConf;
    private InputPreProcessor preProcessor;
    //Set outputVertex to true when Layer is an OutputLayer, OR For use in specialized situations like reinforcement learning
    // For RL situations, this Layer insn't an OutputLayer, but is the last layer in a graph, that gets its error/epsilon
    // passed in externally
    private boolean outputVertex;

    public LayerVertex(NeuralNetConfiguration layerConf, InputPreProcessor preProcessor) {
        this.layerConf = layerConf;
        this.preProcessor = preProcessor;
    }

    public InputPreProcessor getPreProcessor() {
        return this.preProcessor;
    }

    @Override
    public GraphVertex clone() {
        return new LayerVertex(layerConf.clone(), (preProcessor != null ? preProcessor.clone() : null));
    }

    @Override
    public boolean equals(Object o) {
        if (!(o instanceof LayerVertex))
            return false;
        LayerVertex lv = (LayerVertex) o;
        if ((layerConf == null && lv.layerConf != null) || (layerConf != null && lv.layerConf == null)) {
            return false;
        }
        if (layerConf != null && !layerConf.equals(lv.layerConf))
            return false;
        if (preProcessor == null && lv.preProcessor != null || preProcessor != null && lv.preProcessor == null)
            return false;
        return preProcessor == null || preProcessor.equals(lv.preProcessor);
    }

    @Override
    public int hashCode() {
        return layerConf.hashCode() ^ (preProcessor != null ? preProcessor.hashCode() : 0);
    }

    @Override
    public long numParams(boolean backprop) {
        return layerConf.getLayer().initializer().numParams(layerConf);
    }

    @Override
    public int minVertexInputs() {
        return 1;
    }

    @Override
    public int maxVertexInputs() {
        return 1;
    }

    @Override
    public org.deeplearning4j.nn.graph.vertex.GraphVertex instantiate(ComputationGraph graph, String name, int idx,
                                                                      INDArray paramsView, boolean initializeParams, DataType networkDatatype) {
        //Now, we need to work out if this vertex is an output vertex or not...
        boolean isOutput = graph.getConfiguration().getNetworkOutputs().contains(name);

        org.deeplearning4j.nn.api.Layer layer =
                        layerConf.getLayer().instantiate(layerConf, null, idx, paramsView, initializeParams, networkDatatype);

        if(layer == null) {
            throw new IllegalStateException("Encountered null layer during initialization for layer:" +
                     layerConf.getLayer().getClass().getSimpleName() + " initialization returned null layer?");
        }

        return new org.deeplearning4j.nn.graph.vertex.impl.LayerVertex(graph, name, idx, layer, preProcessor, isOutput, networkDatatype);
    }

    @Override
    public InputType getOutputType(int layerIndex, InputType... vertexInputs) throws InvalidInputTypeException {
        if (vertexInputs.length != 1) {
            throw new InvalidInputTypeException(
                            "LayerVertex expects exactly one input. Got: " + Arrays.toString(vertexInputs));
        }

        //Assume any necessary preprocessors have already been added
        InputType afterPreprocessor;
        if (preProcessor == null)
            afterPreprocessor = vertexInputs[0];
        else
            afterPreprocessor = preProcessor.getOutputType(vertexInputs[0]);

        return layerConf.getLayer().getOutputType(layerIndex, afterPreprocessor);
    }

    @Override
    public MemoryReport getMemoryReport(InputType... inputTypes) {
        if(inputTypes.length != 1){
            throw new IllegalArgumentException("Only one input supported for layer vertices: got "
                    + Arrays.toString(inputTypes));
        }
        InputType it;
        if(preProcessor != null){
            it = preProcessor.getOutputType(inputTypes[0]);
        } else {
            it = inputTypes[0];
        }
        //TODO preprocessor memory
        return layerConf.getLayer().getMemoryReport(it);
    }

    @Override
    public void setDataType(DataType dataType){
        layerConf.getLayer().setDataType(dataType);
    }
}


text:
> Hey world, here I am!
>  _Bobby Darin_

## Purpose

A classic example.

## Key Points

- Creating a component with `React.createClass`
- Adding a `render` function to the component to build DOM
- Rendering to the page with `ReactDOM.render`

## References
* [React.createClass](https://facebook.github.io/react/docs/top-level-api.html#react.createclass)
* [React Component render](https://facebook.github.io/react/docs/component-specs.html#render)
* [ReactDOM.render](https://facebook.github.io/react/docs/top-level-api.html#reactdom.render)


text:
'''
module for configuration
'''

from transwarp.tool import SimpleDict

def _to_dict(d):
    D = SimpleDict()
    for k, v in d.iteritems():
        D[k] = _to_dict(v) if isinstance(v, dict) else v
    return D

def _merge(defaults, overrides):
    r = {}
    for k, v in defaults.iteritems():
        if k in overrides:
            if isinstance(v, dict):
                r[k] = _merge(v, overrides[k])
            else:
                r[k] = overrides[k]
        else:
            r[k] = v
    return r

import config_default
configs = config_default.configs

try:
    import config_override
    configs = _merge(configs, config_override.configs)
except ImportError:
    pass

configs = _to_dict(configs)


text:
require "spec_helper"

describe Asset do
  let(:attributes) do
    {
      :transaction_url       => 'https://picomoney.com/picopoints',
      :oauth_consumer_key    => 'abcdefg',
      :oauth_consumer_secret => '0123456'
    }
  end

  context 'when just created' do
    subject { Asset.create attributes }
    its(:verified?) { should be_false }
  end
end


text:
package org.apache.commons.imaging.formats.jpeg.segments;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;

import org.apache.commons.imaging.ImageReadException;
import org.apache.commons.imaging.formats.jpeg.JpegImageParser;

public class SofnSegment extends Segment
{
    public final int width, height;
    public final int numberOfComponents;
    public final int precision;
    public final Component[] components;

    public static class Component
    {
        public final int componentIdentifier;
        public final int horizontalSamplingFactor;
        public final int verticalSamplingFactor;
        public final int quantTabDestSelector;

        public Component(int componentIdentifier,
                int horizontalSamplingFactor,
                int veritcalSamplingFactor,
                int quantTabDestSelector)
        {
            this.componentIdentifier = componentIdentifier;
            this.horizontalSamplingFactor = horizontalSamplingFactor;
            this.verticalSamplingFactor = veritcalSamplingFactor;
            this.quantTabDestSelector = quantTabDestSelector;
        }
    }

    public SofnSegment(int marker, byte segmentData[])
            throws ImageReadException, IOException
    {
        this(marker, segmentData.length, new ByteArrayInputStream(segmentData));
    }

    public SofnSegment(int marker, int marker_length, InputStream is)
            throws ImageReadException, IOException
    {
        super(marker, marker_length);

        if (getDebug())
            System.out.println("SOF0Segment marker_length: " + marker_length);

        precision = readByte("Data_precision", is, "Not a Valid JPEG File");
        height = read2Bytes("Image_height", is, "Not a Valid JPEG File");
        width = read2Bytes("Image_Width", is, "Not a Valid JPEG File");
        numberOfComponents = readByte("Number_of_components", is,
                "Not a Valid JPEG File");
        components = new Component[numberOfComponents];
        for (int i = 0; i < numberOfComponents; i++)
        {
            int componentIdentifier = readByte("ComponentIdentifier", is,
                    "Not a Valid JPEG File");

            int hvSamplingFactors = readByte("SamplingFactors", is,
                    "Not a Valid JPEG File");
            int horizontalSamplingFactor = (hvSamplingFactors >> 4) & 0xf;
            int verticalSamplingFactor = hvSamplingFactors & 0xf;
            int quantTabDestSelector = readByte("QuantTabDestSel", is,
                    "Not a Valid JPEG File");
            components[i] = new Component(componentIdentifier,
                        horizontalSamplingFactor, verticalSamplingFactor,
                        quantTabDestSelector);
        }

        if (getDebug())
            System.out.println("");
    }

    @Override
    public String getDescription()
    {
        return "SOFN (SOF" + (marker - JpegImageParser.SOF0Marker) + ") ("
                + getSegmentType() + ")";
    }

}


text:
package com.xmlcalabash.runtime;

import com.xmlcalabash.io.ReadablePipe;
import com.xmlcalabash.io.DocumentSequence;
import com.xmlcalabash.core.XProcRuntime;
import com.xmlcalabash.core.XProcException;
import com.xmlcalabash.util.MessageFormatter;
import com.xmlcalabash.util.S9apiUtils;
import com.xmlcalabash.model.NamespaceBinding;
import com.xmlcalabash.model.Step;
import com.xmlcalabash.model.RuntimeValue;

import java.util.Iterator;
import java.util.Hashtable;
import org.slf4j.Logger;

import net.sf.saxon.s9api.*;
import net.sf.saxon.sxpath.IndependentContext;
import org.slf4j.LoggerFactory;

public class XSelect implements ReadablePipe {
    protected Logger logger = LoggerFactory.getLogger(XSelect.class);
    private ReadablePipe source = null;
    private String select = null;
    private XdmNode context = null;
    private DocumentSequence documents = null;
    private XPathSelector selector = null;
    private XProcRuntime runtime = null;
    private boolean initialized = false;
    private int docindex = 0;
    private Step reader = null;
    private XStep forStep = null;

    /* Creates a new instance of Select */
    public XSelect(XProcRuntime runtime, XStep forStep, ReadablePipe readFrom, String xpathExpr, XdmNode context) {
        source = readFrom;
        select = xpathExpr;
        this.runtime = runtime;
        this.context = context;
        documents = new DocumentSequence(runtime);
        this.forStep = forStep;
    }

    public void canReadSequence(boolean sequence) {
        // nop; always true
    }

    public boolean readSequence() {
        return true;
    }

    private void readSource() {
        initialized = true;

        try {
            NamespaceBinding bindings = new NamespaceBinding(runtime,context);
            XPathCompiler xcomp = runtime.getProcessor().newXPathCompiler();
            xcomp.setBaseURI(context.getBaseURI());

            IndependentContext icontext = (IndependentContext) xcomp.getUnderlyingStaticContext();

            Hashtable<QName, RuntimeValue> inScopeOptions = new Hashtable<QName, RuntimeValue> ();
            try {
                inScopeOptions = ((XCompoundStep) forStep).getInScopeOptions();
            } catch (ClassCastException cce) {
                // FIXME: Surely there's a better way to do this!!!
            }

            Hashtable<QName, RuntimeValue> boundOpts = new Hashtable<QName, RuntimeValue> ();
            for (QName name : inScopeOptions.keySet()) {
                RuntimeValue v = inScopeOptions.get(name);
                if (v.initialized()) {
                    boundOpts.put(name, v);
                }
            }

            for (QName varname : boundOpts.keySet()) {
                xcomp.declareVariable(varname);
            }

            for (String prefix : bindings.getNamespaceBindings().keySet()) {
                xcomp.declareNamespace(prefix, bindings.getNamespaceBindings().get(prefix));
            }

            XPathExecutable xexec = xcomp.compile(select);
            selector = xexec.load();

            for (QName varname : boundOpts.keySet()) {
                XdmAtomicValue avalue = boundOpts.get(varname).getUntypedAtomic(runtime);
                selector.setVariable(varname,avalue);
            }

        } catch (SaxonApiException sae) {
            if (S9apiUtils.xpathSyntaxError(sae)) {
                throw XProcException.dynamicError(23, context, "Invalid XPath expression: '" + select + "'.");
            } else {
                throw new XProcException(sae);
            }
        }

        while (source.moreDocuments()) {
            // Ok, time to go looking for things to select from.
            try {
                XdmNode doc = source.read();

                if (reader != null) {
                    logger.trace(MessageFormatter.nodeMessage(reader.getNode(), reader.getName() + " select read '" + (doc == null ? "null" : doc.getBaseURI()) + "' from " + source));
                }

                selector.setContextItem(doc);

                Iterator<XdmItem> iter = selector.iterator();
                while (iter.hasNext()) {
                    XdmItem item = iter.next();
                    XdmNode node = null;
                    try {
                        node = (XdmNode) item;
                        if ((node.getNodeKind() != XdmNodeKind.ELEMENT)
                            && (node.getNodeKind() != XdmNodeKind.DOCUMENT)) {
                            throw XProcException.dynamicError(16);
                        }
                    } catch (ClassCastException cce) {
                        throw XProcException.dynamicError(16);
                    }
                    XdmDestination dest = new XdmDestination();
                    S9apiUtils.writeXdmValue(runtime, node, dest, node.getBaseURI());

                    XdmNode sdoc = dest.getXdmNode();

                    if (reader != null) {
                        logger.trace(MessageFormatter.nodeMessage(reader.getNode(), reader.getName() + " select wrote '" + (sdoc == null ? "null" : sdoc.getBaseURI()) + "' to " + documents));
                    }

                    documents.add(sdoc);
                }
            } catch (SaxonApiException sae) {
                throw new XProcException(sae);
            }
        }
    }

    public void resetReader() {
        docindex = 0;
        source.resetReader();
        documents.reset();
        initialized = false;
    }

    public boolean moreDocuments() {
        if (!initialized) {
            readSource();
        }
        return docindex < documents.size();
    }

    public boolean closed() {
        return true;
    }

    public int documentCount() {
        if (!initialized) {
            readSource();
        }
        return documents.size();
    }

    public DocumentSequence documents() {
        return documents;
    }

    public void setReader(Step step) {
        reader = step;
    }

    public void setNames(String stepName, String portName) {
        // nop;
    }

    public XdmNode read () throws SaxonApiException {
        if (!initialized) {
            readSource();
        }

        XdmNode doc = null;
        if (moreDocuments()) {
            doc = documents.get(docindex++);
        }

        if (reader != null) {
            logger.trace(MessageFormatter.nodeMessage(reader.getNode(), reader.getName() + " read '" + (doc == null ? "null" : doc.getBaseURI()) + "' from " + this));
        }

        return doc;
    }

    public String toString() {
        return "xselect " + documents;
    }
}


text:
<md-dialog aria-label="Edit Cue">
  <md-dialog-content>

        <select ng-model="cue.cueCode" as-string>
          <option value="" disabled selected>Choose cue event</option>
          <option ng-selected="($index + 1) === cue.cueCode" ng-repeat="type in cueTypes" value="{{$index + 1}}">{{type}}</option>
        </select>

      <md-input-container ng-if="cue.cueCode === 3 || cue.cueCode === 4 || cue.cueCode === 5">
        Source of Paco Action
        <input type="text" ng-model="cue.cueSource">
      </md-input-container>

  </md-dialog-content>

    <md-button ng-click="hide()" class="md-primary">
      Done
    </md-button>

</md-dialog>


text:
export class HttpError extends Error {
  status: number;

  constructor(message: string, status: number) {
    super(message);
    this.status = status;
  }
}


text:
package org.apache.beam.runners.dataflow.worker.testing;

import com.google.api.client.json.GenericJson;
import com.google.api.client.json.jackson2.JacksonFactory;
import java.io.IOException;
import org.json.JSONException;
import org.skyscreamer.jsonassert.JSONAssert;

/** Assertions on {@link GenericJson} class. */
public class GenericJsonAssert {

  private static final JacksonFactory jacksonFactory = JacksonFactory.getDefaultInstance();

  /**
   * Asserts that {@code actual} has the same JSON representation as {@code expected}.
   *
   * @param expected expected JSON string, {@link GenericJson}, {@link java.util.Map}, or {@link
   *     Iterable} of {@link GenericJson}.
   * @param actual actual object to compare its JSON representation.
   */
  public static void assertEqualsAsJson(Object expected, Object actual) {

    try {
      String expectedJsonText =
          expected instanceof String ? (String) expected : jacksonFactory.toString(expected);
      String actualJsonText = jacksonFactory.toString(actual);
      JSONAssert.assertEquals(expectedJsonText, actualJsonText, true);
    } catch (JSONException ex) {
      throw new IllegalArgumentException("Could not parse JSON", ex);
    } catch (IOException ex) {
      throw new IllegalArgumentException("Could not generate JSON text", ex);
    }
  }
}


text:
using System;
using System.Windows.Forms;
using TutorialsBase;
using NetOffice;
using Excel = NetOffice.ExcelApi;

namespace TutorialsCS4
{
    public partial class Tutorial12 : UserControl, ITutorial
    {
        public Tutorial12()
        {
            InitializeComponent();
        }

        public void Run()
        {

        }

        public void Connect(IHost hostApplication)
        {
            HostApplication = hostApplication;
            propertyGrid1.SelectedObject = NetOffice.Settings.Default;
        }

        public void Disconnect()
        {

        }

        public string Uri
        {
            get { return Program.DocumentationBase + "Tutorial12_EN_CS.html"; }
        }

        public string Caption
        {
            get { return "Tutorial12"; }
        }

        public string Description
        {
            get { return "NetOffice Settings"; }
        }

        public UserControl Panel
        {
            get { return this; }
        }

        internal IHost HostApplication { get; private set; }
    }
}


text:
<!doctype html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="A portfolio template that uses Material Design Lite.">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
    <title>Kevin Elberger</title>
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:regular,bold,italic,thin,light,bolditalic,black,medium&lang=en">
    <link rel="stylesheet" href="../css/material.grey.min.css" />
    <link rel="stylesheet" href="../css/styles.css" />
    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">

                    Kevin Elberger

                Portfolio
                Blog
                About
                Contact

            Portfolio
            Blog
            About
            Contact

                    Includes
                    Design and Frontend Development

Introduction

                            Fit App enables users to monitor and track their weight and lifting numbers over time. I
                            enjoyed developing this application since it encourages a healthy lifestyle and incorporates
                            data visualization. This application was developed using the Laravel framework.

                            Each user can track their own weight each day, along with the date. The same goes for their
                            three main lifts: squat, deadlift, and bench press. Statistics are generated from their main
                            lifts, such as their 1 Rep Maximum and where they stand in terms of their strength relative to
                            other people their size.

Initial Ideas

                            I initially wanted to make an application that would help me track my own weightlifting data,
                            but as time went on, I knew I should extend it to help me track my weight as well.

                            This was the first time I had worked with the D3.js graphing library, but I learned a lot.
                            The graphs used in this application were quite simple, but making them animated was a good
                            learning process for me. Data values are plotted on the chart, and tooltips are displayed
                            when hovering over the points.

Final Concept

                            I ended up making an application that would chart a user's strength in regards to their own
                            lifts and weight. Also, it was my first time developing an application that uses Material Design.
                            I'd like to re-visit this project and add more complicated and stylized charts, as well as
                            re-design the UI since there was a lack of knowledge on my part with Material Design practices.

Kevin Elberger

<button class="social-btn github"></button>


text:
title: Reference
---

# Reference

We keep a copy of the reference of the latest stable version here. This
reference is automatically generated by
[Haddock](http://www.haskell.org/haddock/). You can
[find it here](reference/index.html).


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.Linq;
using Azure.Identity;
using Microsoft.Azure.SignalR;
using Microsoft.Azure.SignalR.Management;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.Memory;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
using SignalRServiceExtension.Tests;
using Xunit;
using static Microsoft.Azure.SignalR.Tests.Common.FakeEndpointUtils;
namespace Microsoft.Azure.WebJobs.Extensions.SignalRService
{
    public class SignatureValidationOptionsSetupTests
    {
        private static readonly string AccessKeyConnectionString = GetFakeConnectionString(1).Single();
        private const string AadConnectionString = "Endpoint=http://localhost; AuthType=aad ;Version=1.0;";
        public static IEnumerable<object[]> ConfigureTestData()
        {
            yield return new object[] { AccessKeyConnectionString, null, true, new string[] { FakeAccessKey } };
            yield return new object[] { null, GetFakeEndpoint(2), true, Enumerable.Repeat(FakeAccessKey, 2) };
            yield return new object[] { AccessKeyConnectionString, GetFakeEndpoint(2), true, Enumerable.Repeat(FakeAccessKey, 3) };

            yield return new object[] { AadConnectionString, null, false, null };
            yield return new object[] { AadConnectionString, new ServiceEndpoint[] { new ServiceEndpoint(new Uri("https://endpoint"), new DefaultAzureCredential()), new ServiceEndpoint(AadConnectionString) }, false, null };
        }

        [Theory]
        [MemberData(nameof(ConfigureTestData))]
        public void OptionsConfigureTest(string connectionString, IEnumerable<ServiceEndpoint> serviceEndpoints, bool expectedValidationRequirement, string[] expectedAccessKey)
        {
            var configuration = new ConfigurationBuilder().AddInMemoryCollection().Build();
            configuration[Constants.AzureSignalRConnectionStringName] = connectionString;
            var signalROptions = new SignalROptions()
            {
                ServiceTransportType = ServiceTransportType.Persistent
            };
            foreach (var endpoint in serviceEndpoints ?? Array.Empty<ServiceEndpoint>())
            {
                signalROptions.ServiceEndpoints.Add(endpoint);
            }
            var serviceManagerStore = new ServiceManagerStore(configuration, NullLoggerFactory.Instance, SingletonAzureComponentFactory.Instance, Options.Create(signalROptions));
            var hubContextStore = serviceManagerStore.GetOrAddByConnectionStringKey(Constants.AzureSignalRConnectionStringName);
            var signatureValidationOptions = hubContextStore.SignatureValidationOptions.CurrentValue;
            Assert.Equal(expectedValidationRequirement, signatureValidationOptions.RequireValidation);
            if (expectedValidationRequirement)
            {
                Assert.True(expectedAccessKey.SequenceEqual(signatureValidationOptions.AccessKeys));
            }
        }

        [Fact]
        public void OptionsHotReloadTest()
        {
            var configuration = new ConfigurationRoot(new List<IConfigurationProvider>() { new MemoryConfigurationProvider(new()) });
            configuration[Constants.AzureSignalRConnectionStringName] = AadConnectionString;
            var serviceManagerStore = new ServiceManagerStore(configuration, NullLoggerFactory.Instance, SingletonAzureComponentFactory.Instance, Options.Create(new SignalROptions()));
            var options = serviceManagerStore.GetOrAddByConnectionStringKey(Constants.AzureSignalRConnectionStringName).SignatureValidationOptions;
            Assert.False(options.CurrentValue.RequireValidation);

            configuration[Constants.AzureSignalRConnectionStringName] = AccessKeyConnectionString;
            configuration.Reload();
            Assert.True(options.CurrentValue.RequireValidation);
            Assert.Equal(FakeAccessKey, options.CurrentValue.AccessKeys.Single());
        }
    }
}


text:
package syscallx

// This file just contains wrappers for platforms that already have
// the right stuff in stdlib.

import (
	"syscall"
)

func Getxattr(path string, attr string, dest []byte) (sz int, err error) {
	return syscall.Getxattr(path, attr, dest)
}

func Listxattr(path string, dest []byte) (sz int, err error) {
	return syscall.Listxattr(path, dest)
}

func Setxattr(path string, attr string, data []byte, flags int) (err error) {
	return syscall.Setxattr(path, attr, data, flags)
}

func Removexattr(path string, attr string) (err error) {
	return syscall.Removexattr(path, attr)
}


text:
from chainer.backends import cuda
from chainer import function_node
from chainer.utils import collections_abc
from chainer.utils import conv
from chainer.utils import type_check

if cuda.cudnn_enabled:
    cudnn = cuda.cudnn

def _pair(x):
    if isinstance(x, collections_abc.Iterable):
        return x
    return x, x

class Pooling2D(function_node.FunctionNode):

    """Base class of pooling function over a set of 2d planes."""

    def __init__(self, ksize, stride=None, pad=0, cover_all=True,
                 return_indices=False):
        if stride is None:
            stride = ksize

        self.kh, self.kw = _pair(ksize)
        self.sy, self.sx = _pair(stride)
        self.ph, self.pw = _pair(pad)

        self.cover_all = cover_all
        self.return_indices = return_indices

        self._used_cudnn = False
        self._cudnn_inputs = None
        self._cudnn_outputs = None

    def check_type_forward(self, in_types):
        type_check.expect(
            in_types.size() == 1,
            in_types[0].dtype.kind == 'f',
            in_types[0].ndim == 4
        )

    def forward_gpu(self, x):
        self.retain_inputs((0,))
        self._used_cudnn = True

        # Implementation using cudnn
        x = x[0]
        n, c, h, w = x.shape
        y_h = conv.get_conv_outsize(
            h, self.kh, self.sy, self.ph, self.cover_all)
        assert y_h > 0, 'Height in the output should be positive.'
        y_w = conv.get_conv_outsize(
            w, self.kw, self.sx, self.pw, self.cover_all)
        assert y_w > 0, 'Width in the output should be positive.'
        y = cuda.cupy.empty((n, c, y_h, y_w), dtype=x.dtype)

        cudnn.pooling_forward(
            x, y,
            (self.kh, self.kw), (self.sy, self.sx), (self.ph, self.pw),
            self._get_pool_mode())
        self._cudnn_inputs = (x,)
        self._cudnn_outputs = (y,)
        self.retain_outputs((0,))
        return y,

    def backward_gpu(self, x, gy):
        # Implementation using cudnn
        x = x[0]
        y = self._cudnn_outputs[0]
        gx = cudnn.pooling_backward(
            x, y, gy[0],
            (self.kh, self.kw), (self.sy, self.sx), (self.ph, self.pw),
            self._get_pool_mode())
        return gx,

    def _get_pool_mode(self):
        raise NotImplementedError()


text:
Remove-Module -Name 'Rubrik' -ErrorAction 'SilentlyContinue'
Import-Module -Name './Rubrik/Rubrik.psd1' -Force

foreach ( $privateFunctionFilePath in ( Get-ChildItem -Path './Rubrik/Private' | Where-Object extension -eq '.ps1').FullName  ) {
    . $privateFunctionFilePath
}

Describe -Name 'Public/Set-RubrikvCenter' -Tag 'Public', 'Set-RubrikvCenter' -Fixture {
    #region init
    $global:rubrikConnection = @{
        id      = 'test-id'
        userId  = 'test-userId'
        token   = 'test-token'
        server  = 'test-server'
        header  = @{ 'Authorization' = 'Bearer test-authorization' }
        time    = (Get-Date)
        api     = 'v1'
        version = '4.0.5'
    }
    #endregion

    Context -Name 'Results Filtering' {
        Mock -CommandName Test-RubrikConnection -Verifiable -ModuleName 'Rubrik' -MockWith {}
        Mock -CommandName Submit-Request -Verifiable -ModuleName 'Rubrik' -MockWith {
            @{
                'id'                    = '11111-22222-33333'
                'name'                  = 'vcsa.domain.local'
                'hostname'              = 'vcsa.domain.local'
                'version'               = '6.5'
            }
        }
        It -Name 'Should return correct id' -Test {
            $secpasswd = ConvertTo-SecureString "PlainTextPassword" -AsPlainText -Force
            $mycreds = New-Object System.Management.Automation.PSCredential ("username", $secpasswd)
            ( Set-RubrikvCenter -ID '11111-22222-33333' -HostName 'vcsa1.domain.com' -Credential $mycreds ).id |
                Should -BeExactly '11111-22222-33333'
        }
        Assert-VerifiableMock
        Assert-MockCalled -CommandName Test-RubrikConnection -ModuleName 'Rubrik' -Exactly 1
        Assert-MockCalled -CommandName Submit-Request -ModuleName 'Rubrik' -Exactly 1
    }
    Context -Name 'Parameter Validation' {
        It -Name 'Missing Username' -Test {
            $secpasswd = ConvertTo-SecureString "PlainTextPassword" -AsPlainText -Force
            { Set-RubrikvCenter -id '11111-22222' -Hostname 'vcsa.domain.local' -username -password $secpasswd } |
                Should -Throw "Missing an argument for parameter 'Username'. Specify a parameter of type 'System.String' and try again."
        }
        It -Name 'Missing Password' -Test {
            { Set-RubrikvCenter -id '11111-22222' -Hostname 'vcsa.domain.local' -username 'username' -password } |
                Should -Throw "Missing an argument for parameter 'Password'"
        }
        It -Name 'ParameterSet Validation' -Test {
            $secpasswd = ConvertTo-SecureString "PlainTextPassword" -AsPlainText -Force
            $mycreds = New-Object System.Management.Automation.PSCredential ("username", $secpasswd)
            { Set-RubrikvCenter -Hostname 'vcsa.domain.local' -username 'username' -Credential $mycreds } |
                Should -Throw "Parameter set cannot be resolved using the specified named parameters."
        }
        It -Name 'Missing hostname' -Test {
            { Set-RubrikvCenter -Hostname -username 'username' -Credential $creds } |
                Should -Throw "Missing an argument for parameter 'Hostname'"
        }
        It -Name 'Missing id' -Test {
            { Set-RubrikvCenter -id '11111' -Hostname -username 'username' -Credential $creds } |
                Should -Throw "Missing an argument for parameter 'Hostname'"
        }
    }
}