text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FluentAssertions;
using Xunit;
using Xunit.Extensions;
using ContentDomain.Shared;

namespace ContentDomain.Test
{
    public class LanguageTest
    {
        [Theory]
        [ClassData(typeof(LanguageIsoCodeFactory))]
        public void should_be_equal_when_the_same_code(string langCode)
        {
            var language1 = Language.Create(langCode);
            var language2 = Language.Create(langCode);

            language1.Should().Be(language2);
        }

        [Theory]
        [ClassData(typeof(LanguageIsoCodeFactory))]
        public void should_create_language_for_give_iso_code(string langCode)
        {
            var language1 = Language.Create(langCode);
            language1.Should().NotBeNull();
        }

        [Theory]
        [ClassData(typeof(LanguageIsoCodeFactory))]
        public void should_create_language_with_iso_code_filled(string langCode)
        {
            var language1 = Language.Create(langCode);
            language1.LanguageId.Should().Be(langCode);
        }

        [Fact]
        public void should_throw_when_unknown_language_passed()
        {
            Assert.Throws<ArgumentException>(() => Language.Create("abc"));
        }

        [Theory]
        [ClassData(typeof(LanguageIsoCodeFactory))]
        public void should_always_return_the_same_instance_for_the_same_iso_code(string langCode)
        {
            var language1 = Language.Create(langCode);
            var language2 = Language.Create(langCode);
            language1.Should().Be(language2);
        }

        [Theory]
        [ClassData(typeof(LanguageIsoCodeFactory))]
        public void should_fill_name(string langCode)
        {
            var language = Language.Create(langCode);
            language.Name.Should().NotBeNull();
        }

        [Fact]
        public void should_fill_language_name_in_english()
        {
            var language = Language.Create("en");
            language.Name.Should().Be("English");
        }

        [Fact]
        public void should_return_false_when_comparing_language_with_other_type()
        {
            Language.Invariant.Equals(1).Should().BeFalse();
        }

        [Fact]
        public void should_return_false_when_comparing_to_different_language()
        {
            Language.Invariant.Equals(Language.Create("en")).Should().BeFalse();
        }

        [Fact]
        public void should_return_invariant_language_by_static_property()
        {
            Language.Invariant.LanguageId.Should().Be(Language.InvariantCode);
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Text;

namespace OhmSharp.Mapper
{
    public static class ObjectMapper
    {

    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.intellij.openapi.externalSystem.service.project.manage;

import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.externalSystem.model.DataNode;
import com.intellij.openapi.externalSystem.model.Key;
import com.intellij.openapi.externalSystem.model.ProjectKeys;
import com.intellij.openapi.externalSystem.model.project.*;
import com.intellij.openapi.externalSystem.service.project.PlatformFacade;
import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
import com.intellij.openapi.externalSystem.util.ExternalSystemConstants;
import com.intellij.openapi.externalSystem.util.Order;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.LibraryOrderEntry;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.OrderEntry;
import com.intellij.openapi.roots.OrderRootType;
import com.intellij.openapi.roots.impl.ModuleLibraryOrderEntryImpl;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.roots.libraries.LibraryTable;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.ExceptionUtil;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.ContainerUtilRt;
import com.intellij.util.containers.MultiMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.io.File;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

import static com.intellij.openapi.externalSystem.model.ProjectKeys.MODULE;

/**
 * @author Denis Zhdanov
 * @since 4/12/13 6:19 PM
 */
@Order(ExternalSystemConstants.BUILTIN_SERVICE_ORDER)
public class LibraryDependencyDataService extends AbstractDependencyDataService<LibraryDependencyData, LibraryOrderEntry> {

  private static final Logger LOG = Logger.getInstance("#" + LibraryDependencyDataService.class.getName());

  @NotNull private final LibraryDataService myLibraryManager;

  public LibraryDependencyDataService(@NotNull LibraryDataService libraryManager) {
    myLibraryManager = libraryManager;
  }

  @NotNull
  @Override
  public Key<LibraryDependencyData> getTargetDataKey() {
    return ProjectKeys.LIBRARY_DEPENDENCY;
  }

  @Override
  public void importData(@NotNull Collection<DataNode<LibraryDependencyData>> toImport,
                         @Nullable ProjectData projectData,
                         @NotNull Project project,
                         @NotNull PlatformFacade platformFacade,
                         boolean synchronous) {
    if (toImport.isEmpty()) {
      return;
    }

    MyImporter importer = new MyImporter(platformFacade);
    try {
      MultiMap<DataNode<ModuleData>, DataNode<LibraryDependencyData>> byModule = ExternalSystemApiUtil.groupBy(toImport, MODULE);
      for (Map.Entry<DataNode<ModuleData>, Collection<DataNode<LibraryDependencyData>>> entry : byModule.entrySet()) {
        Module module = platformFacade.findIdeModule(entry.getKey().getData(), project);
        Collection<DataNode<LibraryDependencyData>> libraryDependency = entry.getValue();
        if (module == null) {
          LOG.warn(String.format(
            "Can't import library dependencies %s. Reason: target module (%s) is not found at the ide and can't be imported",
            libraryDependency, entry.getKey()
          ));
          continue;
        }
        importer.importData(module, libraryDependency);
      }
      // change libraries first
      ExternalSystemApiUtil.commitChangedModels(synchronous, project, importer.getLibraryModels());
      ExternalSystemApiUtil.commitModels(synchronous, project, importer.getModels());
    }
    catch (Throwable t) {
      ExternalSystemApiUtil.disposeModels(importer.getModels());
      ExceptionUtil.rethrowAllAsUnchecked(t);
    }
  }

  @NotNull
  @Override
  public Class<LibraryOrderEntry> getOrderEntryType() {
    return LibraryOrderEntry.class;
  }

  @Override
  protected String getOrderEntryName(@NotNull LibraryOrderEntry orderEntry) {
    return orderEntry.getLibraryName();
  }

  private class MyImporter {
    private final PlatformFacade myPlatformFacade;
    private final List<ModifiableRootModel> myModels = ContainerUtilRt.newArrayList();
    private final List<Library.ModifiableModel> myLibraryModels = ContainerUtilRt.newArrayList();

    private MyImporter(PlatformFacade platformFacade) {
      myPlatformFacade = platformFacade;
    }

    public List<ModifiableRootModel> getModels() {
      return ContainerUtil.newUnmodifiableList(myModels);
    }

    public List<Library.ModifiableModel> getLibraryModels() {
      return ContainerUtil.newUnmodifiableList(myLibraryModels);
    }

    public void importData(@NotNull Module module, @NotNull Collection<DataNode<LibraryDependencyData>> nodesToImport) {
      // The general idea is to import all external project library dependencies and module libraries which don't present at the
      // ide side yet and remove all project library dependencies and module libraries which present at the ide but not at
      // the given collection.
      // The trick is that we should perform module settings modification inside try/finally block against target root model.
      // That means that we need to prepare all necessary data, obtain a model and modify it as necessary.
      Map<Set<String>/* library paths */, LibraryDependencyData> moduleLibrariesToImport = ContainerUtilRt.newHashMap();
      Map<String/* library name + scope */, LibraryDependencyData> projectLibrariesToImport = ContainerUtilRt.newHashMap();
      Set<LibraryDependencyData> toImport = ContainerUtilRt.newLinkedHashSet();

      boolean hasUnresolved = false;
      for (DataNode<LibraryDependencyData> dependencyNode : nodesToImport) {
        LibraryDependencyData dependencyData = dependencyNode.getData();
        LibraryData libraryData = dependencyData.getTarget();
        hasUnresolved |= libraryData.isUnresolved();
        switch (dependencyData.getLevel()) {
          case MODULE:
            if (!libraryData.isUnresolved()) {
              Set<String> paths = ContainerUtilRt.newHashSet();
              for (String path : libraryData.getPaths(LibraryPathType.BINARY)) {
                paths.add(ExternalSystemApiUtil.toCanonicalPath(path) + dependencyData.getScope().name());
              }
              moduleLibrariesToImport.put(paths, dependencyData);
              toImport.add(dependencyData);
            }
            break;
          case PROJECT:
            projectLibrariesToImport.put(libraryData.getInternalName() + dependencyData.getScope().name(), dependencyData);
            toImport.add(dependencyData);
        }
      }

      ModifiableRootModel moduleRootModel = myPlatformFacade.getModuleModifiableModel(module);
      LibraryTable moduleLibraryTable = moduleRootModel.getModuleLibraryTable();
      LibraryTable libraryTable = myPlatformFacade.getProjectLibraryTable(module.getProject());
      syncExistingAndRemoveObsolete(moduleLibrariesToImport, projectLibrariesToImport, toImport, moduleRootModel, hasUnresolved);

      // Import missing library dependencies.
      if (!toImport.isEmpty()) {
        importMissing(toImport, moduleRootModel, moduleLibraryTable, libraryTable, module);
      }
      myModels.add(moduleRootModel);
    }

    private void importMissing(@NotNull Set<LibraryDependencyData> toImport,
                               @NotNull ModifiableRootModel moduleRootModel,
                               @NotNull LibraryTable moduleLibraryTable,
                               @NotNull LibraryTable libraryTable,
                               @NotNull Module module) {
      for (LibraryDependencyData dependencyData : toImport) {
        LibraryData libraryData = dependencyData.getTarget();
        String libraryName = libraryData.getInternalName();
        switch (dependencyData.getLevel()) {
          case MODULE:
            Library moduleLib = moduleLibraryTable.createLibrary(libraryName);
            syncExistingLibraryDependency(dependencyData, moduleLib, moduleRootModel, module);
            break;
          case PROJECT:
            Library projectLib = libraryTable.getLibraryByName(libraryName);
            if (projectLib == null) {
              syncExistingLibraryDependency(dependencyData, moduleLibraryTable.createLibrary(libraryName), moduleRootModel, module);
              break;
            }
            LibraryOrderEntry orderEntry = moduleRootModel.addLibraryEntry(projectLib);
            setLibraryScope(orderEntry, projectLib, module, dependencyData);
        }
      }
    }

    private void setLibraryScope(@NotNull LibraryOrderEntry orderEntry,
                                        @NotNull Library lib,
                                        @NotNull Module module,
                                        @NotNull LibraryDependencyData dependencyData) {
      LOG.debug(String.format("Adding library dependency '%s' to module '%s'", lib.getName(), module.getName()));
      orderEntry.setExported(dependencyData.isExported());
      orderEntry.setScope(dependencyData.getScope());
      LOG.debug(String.format("Configuring library dependency '%s' of module '%s' to be%s exported and have scope %s", lib.getName(), module.getName(), dependencyData.isExported() ? " not" : "", dependencyData.getScope()));
    }

    private void syncExistingAndRemoveObsolete(@NotNull Map<Set<String>, LibraryDependencyData> moduleLibrariesToImport,
                                               @NotNull Map<String, LibraryDependencyData> projectLibrariesToImport,
                                               @NotNull Set<LibraryDependencyData> toImport,
                                               @NotNull ModifiableRootModel moduleRootModel,
                                               boolean hasUnresolvedLibraries) {
      Set<String> moduleLibraryKey = ContainerUtilRt.newHashSet();
      for (OrderEntry entry : moduleRootModel.getOrderEntries()) {
        if (entry instanceof ModuleLibraryOrderEntryImpl) {
          ModuleLibraryOrderEntryImpl moduleLibraryOrderEntry = (ModuleLibraryOrderEntryImpl)entry;
          Library library = moduleLibraryOrderEntry.getLibrary();
          if (library == null) {
            LOG.warn("Skipping module-level library entry because it doesn't have backing Library object. Entry: " + entry);
            continue;
          }
          moduleLibraryKey.clear();
          for (VirtualFile file : library.getFiles(OrderRootType.CLASSES)) {
            moduleLibraryKey.add(ExternalSystemApiUtil.getLocalFileSystemPath(file) + moduleLibraryOrderEntry.getScope().name());
          }
          LibraryDependencyData existing = moduleLibrariesToImport.remove(moduleLibraryKey);
          if (existing == null) {
            moduleRootModel.removeOrderEntry(entry);
          }
          else {
            syncExistingLibraryDependency(existing, library, moduleRootModel, moduleLibraryOrderEntry.getOwnerModule());
            toImport.remove(existing);
          }
        }
        else if (entry instanceof LibraryOrderEntry) {
          LibraryOrderEntry libraryOrderEntry = (LibraryOrderEntry)entry;
          String libraryName = libraryOrderEntry.getLibraryName();
          LibraryDependencyData existing = projectLibrariesToImport.remove(libraryName + libraryOrderEntry.getScope().name());
          if (existing != null) {
            toImport.remove(existing);
          }
          else if (!hasUnresolvedLibraries) {
            // There is a possible case that a project has been successfully imported from external model and after
            // that network/repo goes down. We don't want to drop existing binary mappings then.
            moduleRootModel.removeOrderEntry(entry);
          }
        }
      }
    }

    private void syncExistingLibraryDependency(@NotNull LibraryDependencyData libraryDependencyData,
                                               @NotNull Library library,
                                               @NotNull ModifiableRootModel moduleRootModel,
                                               @NotNull Module module) {
      Library.ModifiableModel libModel = library.getModifiableModel();
      String libraryName = libraryDependencyData.getInternalName();
      Map<OrderRootType, Collection<File>> files = myLibraryManager.prepareLibraryFiles(libraryDependencyData.getTarget());
      myLibraryManager.registerPaths(files, libModel, libraryName);
      LibraryOrderEntry orderEntry = moduleRootModel.findLibraryOrderEntry(library);
      assert orderEntry != null;
      setLibraryScope(orderEntry, library, module, libraryDependencyData);
      myLibraryModels.add(libModel);
    }
  }
}


text:
<!DOCTYPE html>
<script src="../../../resources/gc.js"></script>
<script src='../../../resources/testharness.js'></script>
<script src='../../../resources/testharnessreport.js'></script>
<script>

// All the following tests make sure that the observer callback is called even
// if there are no references to the nodes and a garbage collection kicks in
// before returning to the event loop.

async_test(function(t) {

    (function simple() {
        var d = document.createElement('div');
        var c = document.createElement('div');
        var obs = new MutationObserver(t.step_func_done(function() {}));
        obs.observe(d, {childList: true});
        d.appendChild(c);
    })();
    gc();
}, "Tests that pending callbacks retain the nodes even in the presence of garbage collection");

async_test(function(t) {
    (function addedChildNodes() {
        var d = document.createElement('div');
        var c = document.createElement('div');
        c.expando = "c";
        var obs = new MutationObserver(t.step_func_done(function(records) {
            assert_equals(1, records[0].addedNodes.length, "one node added");
            assert_equals("c", records[0].addedNodes[0].expando, "expando preserved");
        }));
        obs.observe(d, {childList: true});
        d.appendChild(c);
    })();
    gc();
}, "Tests that pending callbacks retain the nodes even in the presence of garbage collection");

async_test(function(t) {
    (function siblings() {
        var d = document.createElement('div');
        var b = document.createElement('b');
        var i = document.createElement('i');
        var p = document.createElement('p');
        d.appendChild(b);
        d.appendChild(i);
        d.appendChild(p);
        b.expando = "hello";
        p.expando = "goodbye";

        var obs = new MutationObserver(t.step_func_done(function(records) {
            assert_equals(3, records.length, "number of records");
            assert_equals("hello", records[0].previousSibling.expando, "expando preserved");
            assert_equals("goodbye", records[0].nextSibling.expando, "expando preserved");
        }));
        obs.observe(d, {childList: true});
        d = null;
        i.remove();
        i = null;
        b.remove();
        b = null;
        p.remove();
        p = null;
    })();
    gc();
}, "Tests that pending callbacks retain the nodes even in the presence of garbage collection");

</script>


text:
use std::collections::{HashMap, HashSet};
use std::io::Read;
use std::fs::File;
use std::path::Path;
use std::borrow::Cow;

use glium::Version;

use math::graph::{Graph, DirectedAdjacencyList};
use asset::mesh::AttributeType;
use asset::AssetLabel;
use client::render::shader::{GLSLType, GLSLConversionError, VertexShaderType, LightingType, GLSLUniform};
use client::render::shader;
use util::json::{FromJson, JsonError, Json};

/// A Material is a graph MaterialNodes that is used to generate a GLSL snippet for coloring Meshes.
#[derive(Debug, Clone)]
pub struct Material {
    graph: DirectedAdjacencyList<GraphLabel, GraphNode>,
    pub name: String
}

/// A label for a Material graph's nodes
#[derive(Debug, Clone, Hash, Eq, PartialEq)]
pub enum GraphLabel {
    MaterialNode(Cow<'static, str>),
    MaterialPropertyInput(Box<GraphLabel>, Cow<'static, str>),
    MaterialPropertyOutput(Box<GraphLabel>, Cow<'static, str>),
}

/// A node in a Material graph.  This is not a MaterialNode, but rather the underlying graph node
/// used to represent the connections between MaterialNodes.
#[derive(Debug, Clone)]
pub enum GraphNode {
    MaterialPropertyInput(GLSLType),
    MaterialPropertyOutput(GLSLType),
    MaterialNode(MaterialNode)
}

/// A node that corresponds to a snippet of GLSL code.  Its inputs and outputs can be connected to
/// other nodes.
#[derive(Debug, Clone)]
pub enum MaterialNode {
    ColorRGBA{r: f32, g: f32, b: f32, a:f32},
    Output,
    Texture(AssetLabel),
    Blend(f32),
    // Add(Material, Material),
    // Subtract(Material, Material),
    // MultiplyConst(Material, f32)
}

/// An error that occurs while building a Material
#[derive(Debug)]
pub enum MaterialError {
    PropertiesDoNotMatch,
    PropertyHasNoInput(GraphLabel),
    InvalidLabel(GraphLabel),
    LabelDoesNotMatchNode(GraphLabel),
    InvalidNodeGraph,
    WrongNodeType,
    JsonError(JsonError),
    NodeExistsWithLabel(GraphLabel)
}

impl Material {
    /// Create a new Material with only an Output node
    pub fn new(name: String) -> Material {
        let mut material = Material {
            graph: DirectedAdjacencyList::new(),
            name: name
        };
        material.add_node(GraphLabel::new_node("output"), MaterialNode::Output).unwrap();
        return material;
    }

    /// load a Material from a JSON file
    pub fn from_json_file<P: AsRef<Path>>(path: P) -> Result<Material, MaterialError> {
        let mut f = match File::open(&path) {
            Ok(file) => file,
            Err(err) => return Err(MaterialError::from(JsonError::IoError(err)))
        };
        let mut s = String::new();
        match f.read_to_string(&mut s) {
            Ok(_) => {},
            Err(err) => return Err(MaterialError::from(JsonError::IoError(err)))
        }
        // parse json
        match Json::from_str(&s) {
            Ok(json) => {
                let material = try!(Material::from_json(&json));
                return Ok(material);
            },
            Err(err) => {
                return Err(MaterialError::from(JsonError::ParseError(err)));
            }
        }
    }
    /// load a Material from a JSON object
    fn from_json(json: &Json) -> Result<Material, MaterialError> {
        if json.is_object() {
            let obj = json.as_object().unwrap();
            let name = match obj.get("name") {
                Some(name_json) => try!(String::from_json(name_json)),
                None => return Err(MaterialError::from(JsonError::NoKey("name".to_string())))
            };
            let mut nodes = match obj.get("nodes") {
                Some(nodes_json) => try!(HashMap::<String,MaterialNode>::from_json(nodes_json)),
                None => return Err(MaterialError::from(JsonError::NoKey("nodes".to_string())))
            };
            let mut material = Material::new(name);
            for (node_name, node_data) in nodes.drain() {
                try!(material.add_node(node_name, node_data));
            }

            let mut links = match obj.get("links") {
                Some(links_json) => try!(Vec::<Vec<Vec<String>>>::from_json(links_json)),
                None => return Err(MaterialError::from(JsonError::NoKey("links".to_string())))
            };
            for mut link in links.drain(..) {
                if link.len() != 2 {
                    return Err(MaterialError::from(
                        JsonError::WrongType("Material links should be represented as MaterialProperty label arrays of len 2".to_string())))
                }
                if link[0].len() != 2 {
                    return Err(MaterialError::from(
                        JsonError::WrongType("MaterialProperty labels should be represented as string arrays of len 2".to_string())))
                }
                if link[1].len() != 2 {
                    return Err(MaterialError::from(
                        JsonError::WrongType("MaterialProperty labels should be represented as string arrays of len 2".to_string())))
                }

                let mut in_strings = link.pop().unwrap();
                let in_node = Box::new(GraphLabel::MaterialNode(Cow::Owned(in_strings.pop().unwrap())));
                let in_property = Cow::Owned(in_strings.pop().unwrap());
                let in_label = GraphLabel::MaterialPropertyInput(in_node, in_property);
                let mut out_strings = link.pop().unwrap();
                let out_property = Cow::Owned(out_strings.pop().unwrap());
                let out_node = Box::new(GraphLabel::MaterialNode(Cow::Owned(out_strings.pop().unwrap())));
                let out_label = GraphLabel::MaterialPropertyOutput(out_node, out_property);

                try!(material.link_properties(out_label, in_label));
            }
            Ok(material)

        } else {
            return Err(MaterialError::from(JsonError::WrongType("value is not Object".to_string())));
        }
    }

    /// Add a MaterialNode with a given label to the Material graph
    pub fn add_node<L: Into<GraphLabel>>(&mut self, label: L, data: MaterialNode) -> Result<(), MaterialError> {
        let label = label.into();
        if self.graph.contains_vertex(&label) {
            return Err(MaterialError::NodeExistsWithLabel(label));
        } else {
            self.graph.add_vertex(label.clone(), GraphNode::MaterialNode(data));
            match *try!(self.get_material_node(&label)) {
                MaterialNode::ColorRGBA{..} => {
                    try!(self.add_property_output(label.clone(),"r", GLSLType::Float));
                    try!(self.add_property_output(label.clone(),"g", GLSLType::Float));
                    try!(self.add_property_output(label.clone(),"b", GLSLType::Float));
                    try!(self.add_property_output(label.clone(),"a", GLSLType::Float));
                },
                MaterialNode::Output => {
                    try!(self.add_property_input(label.clone(),"r", GLSLType::Float));
                    try!(self.add_property_input(label.clone(),"g", GLSLType::Float));
                    try!(self.add_property_input(label.clone(),"b", GLSLType::Float));
                    try!(self.add_property_input(label.clone(),"a", GLSLType::Float));
                },
                MaterialNode::Texture(_) => {
                    try!(self.add_property_output(label.clone(),"r", GLSLType::Float));
                    try!(self.add_property_output(label.clone(),"g", GLSLType::Float));
                    try!(self.add_property_output(label.clone(),"b", GLSLType::Float));
                    try!(self.add_property_output(label.clone(),"a", GLSLType::Float));
                },
                MaterialNode::Blend(_) => {
                    try!(self.add_property_input(label.clone(),"in_1", GLSLType::Float));
                    try!(self.add_property_input(label.clone(),"in_2", GLSLType::Float));
                    try!(self.add_property_output(label.clone(),"out", GLSLType::Float));
                }
            }
            Ok(())
        }
    }

    fn add_property_output(&mut self, label: GraphLabel, name: &str, property_type: GLSLType) -> Result<(), MaterialError> {
        match label {
            GraphLabel::MaterialNode(_) => {},
            _ => return Err(MaterialError::InvalidLabel(label))
        };
        let property_label = GraphLabel::out_property(label.clone(), name);
        self.graph.add_vertex(property_label.clone(), GraphNode::MaterialPropertyOutput(property_type));
        self.graph.add_edge(label, property_label);
        Ok(())
    }

    fn add_property_input(&mut self, label: GraphLabel, name: &str, property_type: GLSLType) -> Result<(), MaterialError> {
        match label {
            GraphLabel::MaterialNode(_) => {},
            _ => return Err(MaterialError::InvalidLabel(label))
        };
        let property_label = GraphLabel::in_property(label.clone(), name);
        self.graph.add_vertex(property_label.clone(), GraphNode::MaterialPropertyInput(property_type));
        self.graph.add_edge(property_label, label);
        Ok(())
    }

    /// Link an input MaterialNode property and an output MaterialNode property using their graph labels
    pub fn link_properties<O: Into<GraphLabel>, I: Into<GraphLabel>>(&mut self, output: O, input: I) -> Result<(), MaterialError> {
        let output = output.into();
        let input = input.into();
        match output {
            GraphLabel::MaterialPropertyOutput(_,_) => {},
            _ => return Err(MaterialError::InvalidLabel(output))
        }
        match input {
            GraphLabel::MaterialPropertyInput(_,_) => {},
            _ => return Err(MaterialError::InvalidLabel(input))
        }
        if !self.graph.contains_vertex(&output) {
            return Err(MaterialError::InvalidLabel(output));
        }
        if !self.graph.contains_vertex(&input) {
            return Err(MaterialError::InvalidLabel(input));
        }

        self.graph.add_edge(output, input);
        Ok(())
    }

    /// Generate a Material's GLSL snippet, targeting a given version of GLSL
    pub fn get_glsl(&self, version: &Version) -> Result<(String,
                                                         HashSet<GLSLUniform>,
                                                         HashSet<AttributeType>,
                                                         HashMap<Cow<'static, str>, AssetLabel>), GLSLConversionError> {
        let mut visited_nodes = HashSet::new();
        let mut attributes = HashSet::new();
        let mut uniforms = HashSet::new();
        let mut uniform_assignments = HashMap::new();
        let mut expression = String::new();
        try!(self.get_glsl_helper(version, &GraphLabel::new_node("output"), &mut visited_nodes,
                             &mut expression, &mut uniforms, &mut uniform_assignments, &mut attributes));

        Ok((expression, uniforms, attributes, uniform_assignments))
    }

    fn get_glsl_helper(&self,
                       version: &Version,
                       current_node_label: &GraphLabel,
                       visited_nodes: &mut HashSet<GraphLabel>,
                       expression: &mut String,
                       uniforms: &mut HashSet<GLSLUniform>,
                       uniform_assignments: &mut HashMap<Cow<'static, str>, AssetLabel>,
                       attributes: &mut HashSet<AttributeType>) -> Result<(), GLSLConversionError> {

        if visited_nodes.contains(current_node_label) {
            return Ok(());
        }
        let graph_node = match self.graph.get_vertex(current_node_label) {
            Some(vertex) => vertex,
            None => return Err(GLSLConversionError::MaterialError(MaterialError::InvalidLabel(current_node_label.clone())))
        };
        match *current_node_label {
            GraphLabel::MaterialNode(_) => {
                match *graph_node {
                    GraphNode::MaterialNode(ref node) => {
                        let input_vertices = self.graph.get_incident_vertices(current_node_label).unwrap();
                        for input_label in input_vertices.iter() {
                            match *input_label {
                                GraphLabel::MaterialPropertyInput(_, _) => {
                                    try!(self.get_glsl_helper(version, input_label, visited_nodes, expression, uniforms, uniform_assignments, attributes));
                                }
                                _ => return Err(GLSLConversionError::MaterialError(MaterialError::InvalidNodeGraph)),
                            }
                        }
                        match *node {
                            MaterialNode::ColorRGBA{r,g,b,a} => {
                                let output_vertices = self.graph.get_adjacent_vertices(current_node_label).unwrap();
                                for output_label in output_vertices.iter() {
                                    match *output_label {
                                        GraphLabel::MaterialPropertyOutput(_, ref property_name) => {
                                            let output_variable_name = try!(output_label.get_glsl_variable_name());
                                            match &**property_name {
                                                "r" => {expression.push_str(try!(shader::glsl_variable(version, &output_variable_name, r)).as_str());},
                                                "g" => {expression.push_str(try!(shader::glsl_variable(version, &output_variable_name, g)).as_str());},
                                                "b" => {expression.push_str(try!(shader::glsl_variable(version, &output_variable_name, b)).as_str());},
                                                "a" => {expression.push_str(try!(shader::glsl_variable(version, &output_variable_name, a)).as_str());},
                                                _ => {return Err(GLSLConversionError::MaterialError(MaterialError::InvalidNodeGraph))}
                                            }
                                        },
                                        _ => return Err(GLSLConversionError::MaterialError(MaterialError::InvalidNodeGraph))
                                    }
                                }
                            },
                            MaterialNode::Texture(ref texture_path) => {
                                let texture_variable_name = try!(current_node_label.get_glsl_variable_name());
                                let texture_vec_var = format!("{}_tex", texture_variable_name);
                                let texture_function_str = format!("texture({}, v_uv)", texture_variable_name);
                                let texture_vec_exp = (GLSLType::Vec4, texture_function_str.as_str());
                                expression.push_str(try!(shader::glsl_variable(&version, &texture_vec_var, texture_vec_exp)).as_str());
                                let output_vertices = self.graph.get_adjacent_vertices(current_node_label).unwrap();
                                for output_label in output_vertices.iter() {
                                    match *output_label {
                                        GraphLabel::MaterialPropertyOutput(_, ref property_name) => {
                                            let output_variable_name = try!(output_label.get_glsl_variable_name());
                                            match &**property_name {
                                                "r" => {expression.push_str(try!(shader::glsl_variable(version, &output_variable_name, (GLSLType::Float, format!("{}_tex[0]", texture_variable_name)))).as_str());},
                                                "g" => {expression.push_str(try!(shader::glsl_variable(version, &output_variable_name, (GLSLType::Float, format!("{}_tex[1]", texture_variable_name)))).as_str());},
                                                "b" => {expression.push_str(try!(shader::glsl_variable(version, &output_variable_name, (GLSLType::Float, format!("{}_tex[2]", texture_variable_name)))).as_str());},
                                                "a" => {expression.push_str(try!(shader::glsl_variable(version, &output_variable_name, (GLSLType::Float, format!("{}_tex[3]", texture_variable_name)))).as_str());},
                                                _ => {return Err(GLSLConversionError::MaterialError(MaterialError::InvalidNodeGraph))}
                                            }
                                        },
                                        _ => return Err(GLSLConversionError::MaterialError(MaterialError::InvalidNodeGraph))
                                    }
                                }
                                uniform_assignments.insert(Cow::Owned(texture_variable_name.clone()), texture_path.clone());
                                uniforms.insert(GLSLUniform(texture_variable_name, GLSLType::Sampler2D));
                                attributes.insert(AttributeType::UV);

                            },
                            MaterialNode::Blend(factor) => {
                                let in1_var = try!(self.get_glsl_variable_name(&GraphLabel::in_property(current_node_label.clone(), "in_1")));
                                let in2_var = try!(self.get_glsl_variable_name(&GraphLabel::in_property(current_node_label.clone(), "in_2")));
                                let out_var = try!(self.get_glsl_variable_name(&GraphLabel::out_property(current_node_label.clone(), "out")));
                                let exp = (GLSLType::Float, format!("{} * {} + {} * {}",factor, in1_var, 1.0-factor, in2_var));
                                expression.push_str(try!(shader::glsl_variable(version, &out_var, exp)).as_str());

                            },
                            MaterialNode::Output => {
                                let r_var = try!(self.get_glsl_variable_name(&GraphLabel::in_property(current_node_label.clone(), "r")));
                                let g_var = try!(self.get_glsl_variable_name(&GraphLabel::in_property(current_node_label.clone(), "g")));
                                let b_var = try!(self.get_glsl_variable_name(&GraphLabel::in_property(current_node_label.clone(), "b")));
                                let a_var = try!(self.get_glsl_variable_name(&GraphLabel::in_property(current_node_label.clone(), "a")));
                                let exp =  (GLSLType::Vec4, format!("vec4({},{},{},{})",r_var, g_var, b_var, a_var));
                                expression.push_str(try!(shader::glsl_variable(version, "material_output",exp)).as_str());
                            }
                        }
                    },
                    _ => return Err(GLSLConversionError::MaterialError(MaterialError::LabelDoesNotMatchNode(current_node_label.clone())))
                }
            },
            GraphLabel::MaterialPropertyInput(_,_) => {
                match *graph_node {
                    GraphNode::MaterialPropertyInput(_) => {
                        let connected_output = match self.get_connected_output(current_node_label) {
                            Ok(connected_output) => connected_output,
                            Err(err) => return Err(GLSLConversionError::MaterialError(err))
                        };
                        try!(self.get_glsl_helper(version, connected_output, visited_nodes, expression, uniforms, uniform_assignments, attributes));
                    },
                    _ => return Err(GLSLConversionError::MaterialError(MaterialError::LabelDoesNotMatchNode(current_node_label.clone())))
                }
            },
            GraphLabel::MaterialPropertyOutput(_,_) => {
                match *graph_node {
                    GraphNode::MaterialPropertyOutput(_) => {
                        let connected_node = match self.get_connected_node(current_node_label) {
                            Ok(connected_node) => connected_node,
                            Err(err) => return Err(GLSLConversionError::MaterialError(err))
                        };
                        try!(self.get_glsl_helper(version, connected_node, visited_nodes, expression, uniforms, uniform_assignments, attributes));

                    },
                    _ => return Err(GLSLConversionError::MaterialError(MaterialError::LabelDoesNotMatchNode(current_node_label.clone())))
                }
            },
        }
        visited_nodes.insert(current_node_label.clone());
        Ok(())
    }

    /// Get the output GraphNode connected to an input GraphNode, if it has a connected input
    pub fn get_connected_output(&self, node_label: &GraphLabel) -> Result<&GraphLabel, MaterialError> {
        match *node_label {
            GraphLabel::MaterialPropertyInput(_, _) => {
                if self.graph.contains_vertex(node_label) {
                    let incident_vertices = self.graph.get_incident_vertices(node_label).unwrap();
                    match incident_vertices.len() {
                        0 => return Err(MaterialError::PropertyHasNoInput(node_label.clone())),
                        1 => {
                            let incident_vertex_label = incident_vertices.iter().next().unwrap();
                            match *incident_vertex_label {
                                GraphLabel::MaterialPropertyOutput(_,_) => {},
                                _ => return Err(MaterialError::InvalidNodeGraph)
                            }
                            return Ok(incident_vertex_label);
                        },
                        _ => return Err(MaterialError::InvalidNodeGraph),
                    }
                } else {
                    return Err(MaterialError::InvalidLabel(node_label.clone()))
                }
            },
            _ => {return Err(MaterialError::WrongNodeType);},
        }
    }

    /// Get the output MaterialNode connected to an output GraphNode
    pub fn get_connected_node(&self, node_label: &GraphLabel) -> Result<&GraphLabel, MaterialError> {
        match *node_label {
            GraphLabel::MaterialPropertyOutput(_, _) => {
                if self.graph.contains_vertex(node_label) {
                    let incident_vertices = self.graph.get_incident_vertices(node_label).unwrap();
                    match incident_vertices.len() {
                        0 => return Err(MaterialError::PropertyHasNoInput(node_label.clone())),
                        1 => {
                            let incident_vertex_label = incident_vertices.iter().next().unwrap();
                            match *incident_vertex_label {
                                GraphLabel::MaterialNode(_) => {},
                                _ => return Err(MaterialError::InvalidNodeGraph)
                            }
                            return Ok(incident_vertex_label);
                        },
                        _ => return Err(MaterialError::InvalidNodeGraph),
                    }
                } else {
                    return Err(MaterialError::InvalidLabel(node_label.clone()))
                }
            },
            _ => {return Err(MaterialError::WrongNodeType);},
        }
    }

    /// Get a MaterialNode, given its label
    pub fn get_material_node(&self, node_label: &GraphLabel) -> Result<&MaterialNode, MaterialError> {
        match self.graph.get_vertex(node_label) {
            Some(node) => {
                match *node {
                    GraphNode::MaterialNode(ref material_node) => Ok(material_node),
                    _ => Err(MaterialError::WrongNodeType)
                }
            },
            None => Err(MaterialError::InvalidLabel(node_label.clone()))
        }
    }

    fn get_glsl_variable_name(&self, node_label: &GraphLabel) -> Result<String, GLSLConversionError> {
        match *node_label {
            GraphLabel::MaterialPropertyInput(_,_) => {
                match self.get_connected_output(node_label) {
                    Ok(connected_output_label) => Ok(try!(connected_output_label.get_glsl_variable_name())),
                    Err(err) => Err(GLSLConversionError::MaterialError(err))
                }
            },
            GraphLabel::MaterialPropertyOutput(_,_) => Ok(try!(node_label.get_glsl_variable_name())),
            GraphLabel::MaterialNode(_) => Ok(try!(node_label.get_glsl_variable_name()))
        }
    }

    /// Create a Materials vertex and fragment GLSL shaders, targeting a given GLSL version and
    /// using a given VertexShader and Lighting configuration
    pub fn get_shaders(&self, hardware_glsl_version: &Version, vertex_shader_type: &VertexShaderType,
                       lighting_type: &LightingType) -> Result<(String, String, HashMap<Cow<'static, str>, AssetLabel>), GLSLConversionError> {
        let version = shader::get_highest_supported_version(hardware_glsl_version);

        let (material_glsl, fragment_uniforms, fragment_attributes, fragment_uniform_assignments) = try!(self.get_glsl(&version));
        let version_string = shader::get_version_string(&version);

        let mut v_source = String::new();

        // Vertex Version
        v_source.push_str(&version_string);

        // Vertex Attributes
        let mut attribute_assignments = Vec::new();
        let (pos_dec, pos_assign) = try!(shader::glsl_attribute_vertex(&version, "position", GLSLType::Vec3,
            fragment_attributes.contains(&AttributeType::Position)));
        v_source.push_str(&pos_dec);
        match pos_assign {
            Some(pos_assign) => attribute_assignments.push(pos_assign),
            None => {}
        }

        if fragment_attributes.contains(&AttributeType::UV) {
            let (uv_dec, uv_assign) = try!(shader::glsl_attribute_vertex(&version, "uv", GLSLType::Vec2, true));
            v_source.push_str(&uv_dec);
            attribute_assignments.push(uv_assign.unwrap());
        }
        match *lighting_type {
            LightingType::Phong => {
                let (norm_dec, norm_assign) = try!(shader::glsl_attribute_vertex(&version, "normal", GLSLType::Vec3, true));
                v_source.push_str(&norm_dec);
                attribute_assignments.push(norm_assign.unwrap());
            },
            LightingType::None => {
                if fragment_attributes.contains(&AttributeType::Normal) {
                    if fragment_attributes.contains(&AttributeType::Normal) {
                        let (norm_dec, norm_assign) = try!(shader::glsl_attribute_vertex(&version, "normal", GLSLType::Vec3, true));
                        v_source.push_str(&norm_dec);
                        attribute_assignments.push(norm_assign.unwrap());
                    }
                }
            }
        }

        // Vertex Uniforms
        v_source.push_str(try!(shader::glsl_uniform(&version, &GLSLUniform("perspective".to_string(), GLSLType::Mat4))).as_str());
        v_source.push_str(try!(shader::glsl_uniform(&version, &GLSLUniform("view".to_string(), GLSLType::Mat4))).as_str());

        v_source.push_str(try!(shader::glsl_uniform(&version, &GLSLUniform("model".to_string(), GLSLType::Mat4))).as_str());

        // Vertex Body
        v_source.push_str("void main() {\n");
        for attribute in attribute_assignments.iter() {
            v_source.push_str(&attribute);
        }
        let vertex_transformation = match *vertex_shader_type {
            VertexShaderType::Static => {
                "vec4 vertex_output = perspective * view * model * vec4(position, 1.0);\n"
            },
            VertexShaderType::Animated => return Err(GLSLConversionError::TempError)
        };
        v_source.push_str(&vertex_transformation);
        v_source.push_str(try!(shader::glsl_vertex_output(&version, "vertex_output")).as_str());
        v_source.push_str("}");

        let mut f_source = String::new();
        let (frag_out_attribute, frag_output) = try!(shader::glsl_fragment_output(&version, "material_output"));
        // Fragment Version
        f_source.push_str(&version_string);

        // Fragment Attributes
        for attribute in fragment_attributes.iter() {
            match *attribute {
                AttributeType::Position => {
                    f_source.push_str(try!(shader::glsl_attribute_fragment(&version, "position", GLSLType::Vec3)).as_str())
                },
                AttributeType::UV => {
                    f_source.push_str(try!(shader::glsl_attribute_fragment(&version, "uv", GLSLType::Vec2)).as_str())
                },
                AttributeType::Normal => {
                    f_source.push_str(try!(shader::glsl_attribute_fragment(&version, "normal", GLSLType::Vec3)).as_str())
                }
            }
        }
        match frag_out_attribute {
            Some(attr) => {f_source.push_str(&attr);},
            None => {}
        }

        // Fragment Uniforms
        for fragment_uniform in fragment_uniforms.iter() {
            f_source.push_str(try!(shader::glsl_uniform(&version, fragment_uniform)).as_str());
        }

        // Fragment Body
        f_source.push_str("void main() {\n");
        f_source.push_str(&material_glsl);
        f_source.push_str(&frag_output);
        f_source.push_str("}\n");
        Ok((v_source, f_source, fragment_uniform_assignments))
    }

}

impl GraphLabel {
    /// Create a new MaterialNode GraphLabel
    pub fn new_node(name: &str) -> GraphLabel {
        GraphLabel::MaterialNode(Cow::Owned(name.to_string()))
    }

    /// Create a new MaterialPropertyInput GraphLabel
    pub fn in_property(label: GraphLabel, name: &str) -> GraphLabel {
        GraphLabel::MaterialPropertyInput(Box::new(label), Cow::Owned(name.to_string()))
    }

    /// Create a new MaterialPropertyOutput GraphLabel
    pub fn out_property(label: GraphLabel, name: &str) -> GraphLabel {
        GraphLabel::MaterialPropertyOutput(Box::new(label), Cow::Owned(name.to_string()))
    }

    /// Get a GraphNode's unique GLSL variable name
    pub fn get_glsl_variable_name(&self) -> Result<String, GLSLConversionError> {
        Ok(match *self {
            GraphLabel::MaterialNode(ref node_name) => {
                format!("{}", node_name)
            },
            GraphLabel::MaterialPropertyInput(ref node, ref property_name) => {
                format!("{}_{}", try!(node.get_glsl_variable_name()), property_name)
            },
            GraphLabel::MaterialPropertyOutput(ref node, ref property_name) => {
                format!("{}_{}", try!(node.get_glsl_variable_name()), property_name)
            }
        })
    }
}

impl FromJson for MaterialNode {
    fn from_json(json: &Json) -> Result<MaterialNode, JsonError> {
        if json.is_object() {
            let obj = json.as_object().unwrap();
            let node_type = match obj.get("type") {
                Some(name_json) => try!(String::from_json(name_json)),
                None => return Err(JsonError::NoKey("type".to_string()))
            };
            let value_json = match obj.get("value") {
                Some(value_json) => value_json,
                None => return Err(JsonError::NoKey("value".to_string()))
            };
            match node_type.as_str() {
                "texture" => Ok(MaterialNode::Texture(try!(AssetLabel::from_json(value_json)))),
                "color_rgba" => {
                    let colors = try!(Vec::<f32>::from_json(value_json));
                    if colors.len() != 4 {
                        return Err(JsonError::WrongType("MaterialData::ColorRGBA should be represented as an array of four f32s".to_string()))
                    }
                    Ok(MaterialNode::ColorRGBA{r: colors[0], g: colors[1], b: colors[2], a: colors[3]})
                },
                "blend" => Ok(MaterialNode::Blend(try!(f32::from_json(value_json)))),
                _ => return Err(JsonError::Other(format!("Unsupported MaterialData Type: {}", node_type)))
            }
        } else {
            return Err(JsonError::WrongType("value is not Object".to_string()));
        }
    }
}

impl From<JsonError> for MaterialError {
    fn from(error: JsonError) -> MaterialError {
        MaterialError::JsonError(error)
    }
}

impl<'a> Into<GraphLabel> for &'a str {
    fn into(self) -> GraphLabel {
        GraphLabel::new_node(self)
    }
}

impl Into<GraphLabel> for String {
    fn into(self) -> GraphLabel {
        GraphLabel::MaterialNode(Cow::Owned(self))
    }
}

impl<'a, 'b> Into<GraphLabel> for (&'b GraphLabel, &'a str) {
    fn into(self) -> GraphLabel {
        let (graph_label, name) = self;
        GraphLabel::out_property(graph_label.clone(), name)
    }
}

impl<'a, 'b> Into<GraphLabel> for (&'a str, &'b GraphLabel) {
    fn into(self) -> GraphLabel {
        let (name, graph_label) = self;
        GraphLabel::in_property(graph_label.clone(), name)
    }
}


text:
<?php

namespace Application\Service;

use DMS\Service\Meetup\AbstractMeetupClient;
use Guzzle\Common\Collection;

class MeetupClient extends AbstractMeetupClient
{
    /**
     * Returns the default values for incoming configuration parameters
     *
     * @return array
     */
    public static function getDefaultParameters()
    {
        return array(
            'base_url' => '{scheme}://api.meetup.com/',
            'scheme'   => 'https',
        );
    }

    /**
     * Defines the configuration parameters that are required for client
     *
     * @return array
     */
    public static function getRequiredParameters()
    {
        return array(
            'access_token',
        );
    }

    /**
     * Factory Method to build new Client
     *
     * @param  array             $config
     * @return MeetupOAuthClient
     */
    public static function factory($config = array())
    {
        $configuration = static::buildConfig($config);

        $client = new self($configuration->get('base_url'), $configuration);

        static::loadDefinitions($client);

        return $client;
    }

    /**
     * Builds array of configurations into final config
     *
     * @param  array      $config
     * @return Collection
     */
    public static function buildConfig($config = array())
    {
        $default  = static::getDefaultParameters();
        $required = static::getRequiredParameters();
        $config = Collection::fromConfig($config, $default, $required);

        $standardHeaders = array(
            'Accept-Charset' => 'utf-8',
            'Authorization' => 'Bearer '.$config['access_token'],
        );

        $requestOptions = array(
            'headers' => $standardHeaders,
        );

        $config->add('request.options', $requestOptions);

        return $config;
    }
}


text:
    <form name="parameterForm" novalidate val-form-manager>

        <umb-editor-view>

            <umb-editor-header
                name="model.title"
                name-locked="true"
                hide-alias="true"
                hide-icon="true"
                hide-description="true">
            </umb-editor-header>

            <umb-editor-container>

                <umb-box>

                    <umb-box-content class="block-form content-type-editor-dialog edit-property-settings">

                                <textarea class="editor-label"
                                          data-element="property-name"
                                          name="propertyLabel"
                                          ng-model="model.parameter.label"
                                          localize="placeholder"
                                          placeholder="@placeholders_entername"
                                          umb-auto-focus
                                          focus-on-filled="true"
                                          umb-auto-resize
                                          required
                                          ng-keypress="vm.submitOnEnter($event)">
                                </textarea>

                                    Required label

                                <umb-generate-alias enable-lock="true" alias-from="model.parameter.label" alias="model.parameter.key"></umb-generate-alias>

                        <button type="button" class="btn-reset editor-placeholder" data-element="editor-add" ng-if="!model.parameter.editor" hotkey="alt+shift+e" ng-click="vm.openMacroParameterPicker(model.parameter)">
                            <localize key="shortcuts_addEditor"></localize>
                        </button>

                            <button type="button" class="btn-reset editor-info" ng-click="vm.openMacroParameterPicker(model.parameter)">

                                    <umb-icon icon="{{model.parameter.dataTypeIcon || 'icon-autofill'}}" class="icon"></umb-icon>

                                    {{ model.parameter.dataTypeName }}
                                    {{ model.parameter.editor }}

                            </button>

                    </umb-box-content>
                </umb-box>

            </umb-editor-container>

            <umb-editor-footer>
                <umb-editor-footer-content-right>
                    <umb-button type="button"
                                button-style="link"
                                label-key="general_close"
                                shortcut="esc"
                                action="vm.close()">
                    </umb-button>
                    <umb-button type="button"
                                button-style="success"
                                label-key="general_submit"
                                state="vm.saveButtonState"
                                action="vm.submit(model)">
                    </umb-button>
                </umb-editor-footer-content-right>
            </umb-editor-footer>
            '
        </umb-editor-view>

    </form>


text:
package com.cloud.api.command.admin.vm;

import com.cloud.api.APICommand;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseCmd;
import com.cloud.api.Parameter;
import com.cloud.api.response.UserVmResponse;
import com.cloud.api.response.VMUserDataResponse;
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@APICommand(name = "getVirtualMachineUserData", description = "Returns user data associated with the VM", responseObject = VMUserDataResponse.class, since = "4.4",
        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class GetVMUserDataCmd extends BaseCmd {
    public static final Logger s_logger = LoggerFactory.getLogger(GetVMUserDataCmd.class);
    private static final String s_name = "getvirtualmachineuserdataresponse";

    /////////////////////////////////////////////////////
    //////////////// API parameters /////////////////////
    /////////////////////////////////////////////////////

    @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the virtual machine")
    private Long vmId;

    /////////////////////////////////////////////////////
    /////////////////// Accessors ///////////////////////
    /////////////////////////////////////////////////////

    @Override
    public void execute() {
        final String userData = _userVmService.getVmUserData(getId());
        final VMUserDataResponse resp = new VMUserDataResponse();
        resp.setVmId(_entityMgr.findById(UserVm.class, getId()).getUuid());
        resp.setUserData(userData);
        resp.setObjectName("virtualmachineuserdata");
        resp.setResponseName(getCommandName());
        this.setResponseObject(resp);
    }

    /////////////////////////////////////////////////////
    /////////////// API Implementation///////////////////
    /////////////////////////////////////////////////////

    public long getId() {
        return vmId;
    }

    @Override
    public String getCommandName() {
        return s_name;
    }

    @Override
    public long getEntityOwnerId() {
        final UserVm userVm = _entityMgr.findById(UserVm.class, getId());
        if (userVm != null) {
            return userVm.getAccountId();
        }

        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
    }
}


text:
module Rubberry
  class Context < ChewyQuery::Builder
    include Enumerable

    delegate :each, :size, to: :collection

    alias :to_ary :to_a
    alias :model :index

    def initialize(model, options = {})
      super(model, options.merge(
        query_mode: model.config.query_mode,
        filter_mode: model.config.filter_mode,
        post_filter_mode: model.config.filter_mode || model.config.post_filter_mode
      ))
    end

    def first(size = nil)
      collection = loaded? ? self.collection : limit(size || 1).collection
      size ? collection.first(size) : collection.first
    end

    def count
      loaded? ? collection.size : count_query_response
    end

    def facets(params = nil)
      params ? super(params) : response['facets'] || {}
    end

    def aggregations(params = nil)
      params ? super(params) : response['aggregations'] || {}
    end

    alias :aggs :aggregations

    def suggest(params = nil)
      params ? super(params) : response['suggest'] || {}
    end

    def took
      response['took']
    end

    def timed_out?
      response['timed_out']
    end

    def delete_all(options = {})
      Commands.build('DeleteAll', self, options).perform
    end

    def loaded?
      !!@response
    end

    def collection
      @collection ||= (criteria.none? || response == {} ? [] : response['hits']['hits']).map do |doc|
        model.instantiate(doc)
      end
    end

    def count_query_request
      { index: model.index_name, type: types }.tap do |h|
        request_query = request[:body][:query]
        h[:body] = { query: request_query } if request_query
      end
    end

    private

    def reset
      super
      @response, @collection, @count_query_response = nil
    end

    def count_query_response
      @count_query_response ||= Commands.build('CountQuery', self).perform
    end

    def response
      @response ||= Commands.build('Query', self).perform
    end
  end
end


text:
package com.hibegin.http.server.util;

import com.hibegin.common.util.LoggerUtil;

import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;

public class ServerInfo {

    private static final Logger LOGGER = LoggerUtil.getLogger(FreeMarkerUtil.class);
    private static final String name = "SimpleWebServer";
    private static String version;
    private static Date time;

    static {
        Properties properties = new Properties();
        InputStream inputStream = ServerInfo.class.getClassLoader().getResourceAsStream(name + "-git.properties");
        if (inputStream != null) {
            try {
                properties.load(inputStream);
                String key = "git.build.version";
                if (properties.get(key) != null && !"".equals(properties.get(key))) {
                    version = properties.get(key).toString();
                }
            } catch (IOException e) {
                LOGGER.log(Level.SEVERE, "", e);
            }
        } else {
            version = "0.2.53";
        }
        if (time == null) {
            time = new Date();
        }

    }

    public static String getName() {
        return name;
    }

    public static String getVersion() {
        return version;
    }

    public static Date getTime() {
        return time;
    }

    public static void main(String[] args) {
        System.out.println("name = " + name);
        System.out.println("version = " + version);
        System.out.println("time = " + time);
    }
}


text:
Introduction
-------
Another xml parser for nodejs/browser/rhino for java.
Fully compatible with `W3C DOM level2`; and some compatible with `level3`.
support `DOMParser` and `XMLSerializer` interface such as in browser.

Install:
-------
	npm install xmldom
Example:
-------
	var DOMParser = require('xmldom').DOMParser;
	var doc = new DOMParser().parseFromString(
	    '<xml xmlns="a" xmlns:c="./lite">\n'+
	        '\t<child>test</child>\n'+
	        '\t<child></child>\n'+
	        '\t<child/>\n'+
	    '</xml>'
	    ,'text/xml');
	doc.documentElement.setAttribute('x','y');
	doc.documentElement.setAttributeNS('./lite','c:x','y2');
	var nsAttr = doc.documentElement.getAttributeNS('./lite','x')
	console.info(nsAttr)
	console.info(doc)


text:
package com.altoukhov.svsync;

import java.util.Map;

/**
 * @author Alex Altoukhov
 */
public class TargetInfo extends Info {

    private TargetInfo(Map<String, String> params) {
        super(params);
    }

    public static TargetInfo createTarget(Map<String, String> params) {
        return new TargetInfo(params);
    }
}


text:
set -e

working_dir=`pwd`

base_dir=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)

download_dir="$base_dir/https0x3A0x2F0x2Fpackages.cloud.google.com/yum"

mkdir -p $download_dir/{doc,pool,repos}

### EL6

targets="kubernetes-el6-x86_64/repodata/filelists.xml \
    kubernetes-el6-x86_64/repodata/filelists.xml.gz \
    kubernetes-el6-x86_64/repodata/other.xml \
    kubernetes-el6-x86_64/repodata/other.xml.gz \
    kubernetes-el6-x86_64/repodata/primary.xml \
    kubernetes-el6-x86_64/repodata/primary.xml.gz \
    kubernetes-el6-x86_64/repodata/repomd.xml \
    kubernetes-el6-x86_64/repodata/repomd.xml.asc \
    kubernetes-el6-x86_64-unstable/repodata/filelists.xml \
    kubernetes-el6-x86_64-unstable/repodata/filelists.xml.gz \
    kubernetes-el6-x86_64-unstable/repodata/other.xml \
    kubernetes-el6-x86_64-unstable/repodata/other.xml.gz \
    kubernetes-el6-x86_64-unstable/repodata/primary.xml \
    kubernetes-el6-x86_64-unstable/repodata/primary.xml.gz \
    kubernetes-el6-x86_64-unstable/repodata/repomd.xml \
    kubernetes-el6-x86_64-unstable/repodata/repomd.xml.asc \
"

### EL7

targets="kubernetes-el7-x86_64/repodata/filelists.xml \
    kubernetes-el7-x86_64/repodata/filelists.xml.gz \
    kubernetes-el7-x86_64/repodata/other.xml \
    kubernetes-el7-x86_64/repodata/other.xml.gz \
    kubernetes-el7-x86_64/repodata/primary.xml \
    kubernetes-el7-x86_64/repodata/primary.xml.gz \
    kubernetes-el7-x86_64/repodata/repomd.xml \
    kubernetes-el7-x86_64/repodata/repomd.xml.asc \
    kubernetes-el7-x86_64-unstable/repodata/filelists.xml \
    kubernetes-el7-x86_64-unstable/repodata/filelists.xml.gz \
    kubernetes-el7-x86_64-unstable/repodata/other.xml \
    kubernetes-el7-x86_64-unstable/repodata/other.xml.gz \
    kubernetes-el7-x86_64-unstable/repodata/primary.xml \
    kubernetes-el7-x86_64-unstable/repodata/primary.xml.gz \
    kubernetes-el7-x86_64-unstable/repodata/repomd.xml \
    kubernetes-el7-x86_64-unstable/repodata/repomd.xml.asc \
"

targets="kubernetes-el7-x86_64/repodata/filelists.xml \
    kubernetes-el7-x86_64/repodata/filelists.xml.gz \
    kubernetes-el7-x86_64/repodata/other.xml \
    kubernetes-el7-x86_64/repodata/other.xml.gz \
    kubernetes-el7-x86_64/repodata/primary.xml \
    kubernetes-el7-x86_64/repodata/primary.xml.gz \
    kubernetes-el7-x86_64/repodata/repomd.xml \
    kubernetes-el7-x86_64/repodata/repomd.xml.asc \
"

for i in $targets; do
    mkdir -p $download_dir/repos/$(dirname $i)
    curl -kjSL https://packages.cloud.google.com/yum/repos/$i -o $download_dir/repos/$i
done


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
Bull. Soc. Imp. Naturalistes Moscou 34(2):35, t. 2, fig. 12. 1861

#### Original name
null

### Remarks
null


text:
import React, { useRef, useEffect } from 'react'
import BScroll from '@better-scroll/core'

const createArray = (length) => Array.from({ length }, (_v, i) => i + 1)
const nums = createArray(30)

const SpecifiedContent = () => {
  const wrapperRef = useRef(null)
  const scrollRef = useRef(null)

  useEffect(() => {
    if (!scrollRef.current) {
      const BS = (scrollRef.current = new BScroll(wrapperRef.current, {
        specifiedIndexAsContent: 1,
        probeType: 3,
      }))

      BS.on('scroll', () => {
        console.log('scrolling-')
      })
      BS.on('scrollEnd', () => {
        console.log('scrollingEnd')
      })
    }
  }, [])

  return (

          The Blue area is not taken as BetterScroll's content

          {nums.map((item) => (

              {item}

          ))}

  )
}

export default SpecifiedContent


text:
/**
 * DocuSign REST API
 * The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign.
 *
 * OpenAPI spec version: v2.1
 * Contact: devcenter@docusign.com
 *
 * NOTE: This class is auto generated. Do not edit the class manually and submit a new issue instead.
 *
 */

(function(root, factory) {
  if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module.
    define(['ApiClient'], factory);
  } else if (typeof module === 'object' && module.exports) {
    // CommonJS-like environments that support module.exports, like Node.
    module.exports = factory(require('../ApiClient'));
  } else {
    // Browser globals (root is window)
    if (!root.Docusign) {
      root.Docusign = {};
    }
    root.Docusign.ReservedDomainExistence = factory(root.Docusign.ApiClient);
  }
}(this, function(ApiClient) {
  'use strict';

  /**
   * The ReservedDomainExistence model module.
   * @module model/ReservedDomainExistence
   */

  /**
   * Constructs a new ReservedDomainExistence.
   * @alias module:model/ReservedDomainExistence
   * @class
   */
  var exports = function() {
    var _this = this;

  };

  /**
   * Constructs a ReservedDomainExistence from a plain JavaScript object, optionally creating a new instance.
   * Copies all relevant properties from data to obj if supplied or a new instance if not.
   * @param {Object} data The plain JavaScript object bearing properties of interest.
   * @param {module:model/ReservedDomainExistence} obj Optional instance to populate.
   * @return {module:model/ReservedDomainExistence} The populated ReservedDomainExistence instance.
   */
  exports.constructFromObject = function(data, obj) {
    if (data) {
      obj = obj || new exports();

      if (data.hasOwnProperty('emailDomain')) {
        obj['emailDomain'] = ApiClient.convertToType(data['emailDomain'], 'String');
      }
      if (data.hasOwnProperty('isReserved')) {
        obj['isReserved'] = ApiClient.convertToType(data['isReserved'], 'String');
      }
    }
    return obj;
  }

  /**
   *
   * @member {String} emailDomain
   */
  exports.prototype['emailDomain'] = undefined;
  /**
   *
   * @member {String} isReserved
   */
  exports.prototype['isReserved'] = undefined;

  return exports;
}));


text:
package io.pravega.controller.store.stream.records;

import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import io.pravega.common.ObjectBuilder;
import io.pravega.common.io.serialization.RevisionDataInput;
import io.pravega.common.io.serialization.RevisionDataOutput;
import io.pravega.common.io.serialization.VersionedSerializer;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Data;
import lombok.Getter;
import lombok.NonNull;
import lombok.SneakyThrows;

import java.io.IOException;
import java.util.Optional;
import java.util.UUID;

/**
 * This class is the metadata to capture the currently processing transaction commit work. This captures the list of
 * transactions that current round of processing will attempt to commit. If the processing fails and retries, it will
 * find the list of transcations and reattempt to process them in exact same order.
 * This also includes optional "active epoch" field which is set if the commits have to be rolled over because they are
 * over an older epoch.
 */
@Data
public class CommittingTransactionsRecord {
    public static final CommitTransactionsRecordSerializer SERIALIZER = new CommitTransactionsRecordSerializer();
    public static final CommittingTransactionsRecord EMPTY = CommittingTransactionsRecord.builder().epoch(Integer.MIN_VALUE).transactionsToCommit(ImmutableList.of()).activeEpoch(Optional.empty()).build();
    /**
     * Epoch from which transactions are committed.
     */
    private final int epoch;
    /**
     * Transactions to be be committed.
     */
    private final ImmutableList<UUID> transactionsToCommit;

    /**
     * Set only for rolling transactions and identify the active epoch that is being rolled over.
     */
    @Getter(AccessLevel.PRIVATE)
    private Optional<Integer> activeEpoch;

    public CommittingTransactionsRecord(int epoch, @NonNull ImmutableList<UUID> transactionsToCommit) {
        this(epoch, transactionsToCommit, Optional.empty());
    }

    public CommittingTransactionsRecord(int epoch, @NonNull ImmutableList<UUID> transactionsToCommit, int activeEpoch) {
        this(epoch, transactionsToCommit, Optional.of(activeEpoch));
    }

    @Builder
    private CommittingTransactionsRecord(int epoch, @NonNull ImmutableList<UUID> transactionsToCommit, Optional<Integer> activeEpoch) {
        this.epoch = epoch;
        this.transactionsToCommit = transactionsToCommit;
        this.activeEpoch = activeEpoch;
    }

    private static class CommittingTransactionsRecordBuilder implements ObjectBuilder<CommittingTransactionsRecord> {
        private Optional<Integer> activeEpoch = Optional.empty();
    }

    @SneakyThrows(IOException.class)
    public static CommittingTransactionsRecord fromBytes(final byte[] data) {
        return SERIALIZER.deserialize(data);
    }

    @SneakyThrows(IOException.class)
    public byte[] toBytes() {
        return SERIALIZER.serialize(this).getCopy();
    }

    @Override
    public String toString() {
        String record = String.format("%s = %s", "epoch", epoch) + "\n" +
                String.format("%s = %s", "transactionsToCommit", transactionsToCommit) + "\n";
        if (activeEpoch.isPresent()) {
            record = record + String.format("%s = %s", "activeEpoch", activeEpoch.get());
        }
        return record;
    }

    public CommittingTransactionsRecord createRollingTxnRecord(int activeEpoch) {
        Preconditions.checkState(!this.activeEpoch.isPresent());
        return new CommittingTransactionsRecord(this.epoch, this.transactionsToCommit, activeEpoch);
    }

    public boolean isRollingTxnRecord() {
        return activeEpoch.isPresent();
    }

    public int getCurrentEpoch() {
        Preconditions.checkState(activeEpoch.isPresent());
        return activeEpoch.get();
    }

    public int getNewTxnEpoch() {
        Preconditions.checkState(activeEpoch.isPresent());
        return activeEpoch.get() + 1;
    }

    public int getNewActiveEpoch() {
        Preconditions.checkState(activeEpoch.isPresent());
        return activeEpoch.get() + 2;
    }

    private static class CommitTransactionsRecordSerializer
            extends VersionedSerializer.WithBuilder<CommittingTransactionsRecord, CommittingTransactionsRecordBuilder> {
        @Override
        protected byte getWriteVersion() {
            return 0;
        }

        @Override
        protected void declareVersions() {
            version(0).revision(0, this::write00, this::read00);
        }

        private void read00(RevisionDataInput revisionDataInput, CommittingTransactionsRecordBuilder builder)
                throws IOException {
            ImmutableList.Builder<UUID> listBuilder = ImmutableList.builder();
            builder.epoch(revisionDataInput.readInt());

            revisionDataInput.readCollection(RevisionDataInput::readUUID, listBuilder);
            builder.transactionsToCommit(listBuilder.build());

            int read = revisionDataInput.readInt();
            if (read == Integer.MIN_VALUE) {
                builder.activeEpoch(Optional.empty());
            } else {
                builder.activeEpoch(Optional.of(read));
            }
        }

        private void write00(CommittingTransactionsRecord record, RevisionDataOutput revisionDataOutput) throws IOException {
            revisionDataOutput.writeInt(record.getEpoch());
            revisionDataOutput.writeCollection(record.getTransactionsToCommit(), RevisionDataOutput::writeUUID);
            revisionDataOutput.writeInt(record.getActiveEpoch().orElse(Integer.MIN_VALUE));
        }

        @Override
        protected CommittingTransactionsRecordBuilder newBuilder() {
            return CommittingTransactionsRecord.builder();
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.martinwong.dormcleaner">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".taskViewActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".Task_Detail_Activity"
            android:label="@string/title_activity_task__detail_"
            android:parentActivityName=".taskViewActivity">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.martinwong.dormcleaner.taskViewActivity" />
        </activity>
        <activity android:name=".newTask">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.martinwong.dormcleaner.taskViewActivity" />
        </activity>
        <provider
            android:authorities="com.martinwong.dromcleaner.provider"
            android:name=".taskDatabase" />
    </application>

</manifest>


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

using Azure.Core;
using Azure.Core.TestFramework;
using Azure.ResourceManager.Network.Models;
using Azure.ResourceManager.Network;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.TestFramework;
using NUnit.Framework;
using System.Threading.Tasks;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Compute;
using System.Linq;
using Azure.ResourceManager.Logic.Models;
using Azure.ResourceManager.Logic;
using System;
using System.IO;
using Azure.ResourceManager.IotHub.Models;
using Azure.ResourceManager.IotHub;
using Azure.ResourceManager.SecurityCenter.Models;

namespace Azure.ResourceManager.SecurityCenter.Tests
{
    public class SecurityCenterManagementTestBase : ManagementRecordedTestBase<SecurityCenterManagementTestEnvironment>
    {
        protected ArmClient Client { get; private set; }
        protected SubscriptionResource DefaultSubscription { get; private set; }
        protected const string rgNamePrefix = "SecurityCenterRG";
        protected AzureLocation DefaultLocation = AzureLocation.EastUS;
        private const string dummySSHKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+wWK73dCr+jgQOAxNsHAnNNNMEMWOHYEccp6wJm2gotpr9katuF/ZAdou5AaW1C61slRkHRkpRRX9FA9CYBiitZgvCCz+3nWNN7l/Up54Zps/pHWGZLHNJZRYyAB6j5yVLMVHIHriY49d/GZTZVNB8GoJv9Gakwc/fuEZYYl4YDFiGMBP///TzlI4jhiJzjKnEvqPFki5p2ZRJqcbCiF4pJrxUQR/RXqVFQdbRLZgYfJ8xGB878RENq3yQ39d8dVOkq4edbkzwcUmwwwkYVPIoDGsYLaRHnG+To7FvMeyO7xDVQkMKzopTQV8AuKpyvpqu0a9pWOMaiCyDytO7GGN you@me.com";

        protected SecurityCenterManagementTestBase(bool isAsync, RecordedTestMode mode)
        : base(isAsync, mode)
        {
        }

        protected SecurityCenterManagementTestBase(bool isAsync)
            : base(isAsync)
        {
        }

        [SetUp]
        public async Task CreateCommonClient()
        {
            Client = GetArmClient();
            DefaultSubscription = await Client.GetDefaultSubscriptionAsync();
        }

        protected async Task<ResourceGroupResource> CreateResourceGroup()
        {
            string rgName = Recording.GenerateAssetName(rgNamePrefix);
            ResourceGroupData input = new ResourceGroupData(DefaultLocation);
            var lro = await DefaultSubscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, input);
            return lro.Value;
        }

        protected async Task<NetworkSecurityGroupResource> CreateNetworkSecurityGroup(ResourceGroupResource resourceGroup, string nsgName)
        {
            var nsgData = new NetworkSecurityGroupData() { Location = resourceGroup.Data.Location, };
            var nsg = await resourceGroup.GetNetworkSecurityGroups().CreateOrUpdateAsync(WaitUntil.Completed, nsgName, nsgData);
            return nsg.Value;
        }

        protected async Task<VirtualNetworkResource> CreateNetwork(ResourceGroupResource resourceGroup, NetworkSecurityGroupResource nsg, string vnetName)
        {
            VirtualNetworkData data = new VirtualNetworkData()
            {
                Location = resourceGroup.Data.Location,
            };
            data.AddressPrefixes.Add("10.10.0.0/16");
            data.Subnets.Add(new SubnetData() { Name = "subnet1", AddressPrefix = "10.10.1.0/24", PrivateLinkServiceNetworkPolicy = VirtualNetworkPrivateLinkServiceNetworkPolicy.Disabled, NetworkSecurityGroup = nsg.Data });
            data.Subnets.Add(new SubnetData() { Name = "subnet2", AddressPrefix = "10.10.2.0/24" });
            var vnet = await resourceGroup.GetVirtualNetworks().CreateOrUpdateAsync(WaitUntil.Completed, vnetName, data);
            return vnet.Value;
        }

        protected async Task<NetworkInterfaceResource> CreateNetworkInterface(ResourceGroupResource resourceGroup, VirtualNetworkResource network, string nicName)
        {
            // Create Public IP
            string publicIPName = Recording.GenerateAssetName("publicIP");
            var publicIPData = new PublicIPAddressData()
            {
                Location = resourceGroup.Data.Location,
                PublicIPAllocationMethod = NetworkIPAllocationMethod.Dynamic,
            };
            var publicIP = await resourceGroup.GetPublicIPAddresses().CreateOrUpdateAsync(WaitUntil.Completed, publicIPName, publicIPData);

            // Get subnet id AsyncPageable<SubnetResource>
            var list = await network.GetSubnets().GetAllAsync().ToEnumerableAsync();
            var subnetId = list.FirstOrDefault().Id;

            var data = new NetworkInterfaceData()
            {
                Location = resourceGroup.Data.Location,
                IPConfigurations =
                {
                    new NetworkInterfaceIPConfigurationData()
                    {
                        Name = Recording.GenerateAssetName("ipconfig"),
                        PrivateIPAllocationMethod = NetworkIPAllocationMethod.Dynamic,
                        PublicIPAddress = new PublicIPAddressData()
                        {
                            Id = publicIP.Value.Id
                        },
                        Subnet = new SubnetData()
                        {
                            Id = subnetId
                        }
                    }
                }
            };
            var networkInterface = await resourceGroup.GetNetworkInterfaces().CreateOrUpdateAsync(WaitUntil.Completed, nicName, data);
            return networkInterface.Value;
        }

        protected async Task<VirtualMachineResource> CreateVirtualMachine(ResourceGroupResource resourceGroup, ResourceIdentifier networkInterfaceIP, string vmName)
        {
            string adminUsername = "adminUser";
            VirtualMachineCollection vmCollection = resourceGroup.GetVirtualMachines();
            VirtualMachineData input = new VirtualMachineData(resourceGroup.Data.Location)
            {
                HardwareProfile = new VirtualMachineHardwareProfile()
                {
                    VmSize = VirtualMachineSizeType.StandardF2
                },
                OSProfile = new VirtualMachineOSProfile()
                {
                    AdminUsername = adminUsername,
                    ComputerName = vmName,
                    LinuxConfiguration = new LinuxConfiguration()
                    {
                        DisablePasswordAuthentication = true,
                        SshPublicKeys = {
                            new SshPublicKeyConfiguration()
                            {
                                Path = $"/home/{adminUsername}/.ssh/authorized_keys",
                                KeyData = dummySSHKey,
                            }
                        }
                    }
                },
                NetworkProfile = new VirtualMachineNetworkProfile()
                {
                    NetworkInterfaces =
                    {
                        new VirtualMachineNetworkInterfaceReference()
                        {
                            Id = networkInterfaceIP,
                            Primary = true,
                        }
                    }
                },
                StorageProfile = new VirtualMachineStorageProfile()
                {
                    OSDisk = new VirtualMachineOSDisk(DiskCreateOptionType.FromImage)
                    {
                        OSType = SupportedOperatingSystemType.Linux,
                        Caching = CachingType.ReadWrite,
                        ManagedDisk = new VirtualMachineManagedDisk()
                        {
                            StorageAccountType = StorageAccountType.StandardLrs
                        }
                    },
                    ImageReference = new ImageReference()
                    {
                        Publisher = "Canonical",
                        Offer = "UbuntuServer",
                        Sku = "16.04-LTS",
                        Version = "latest",
                    }
                }
            };
            ArmOperation<VirtualMachineResource> lro = await vmCollection.CreateOrUpdateAsync(WaitUntil.Completed, vmName, input);
            return lro.Value;
        }

        protected async Task<LogicWorkflowResource> CreateLogicWorkFlow(ResourceGroupResource resourceGroup)
        {
            // create integration Account
            string integrationAccountName = Recording.GenerateAssetName("integrationAccount");
            IntegrationAccountData integrationAccountData = new IntegrationAccountData(resourceGroup.Data.Location)
            {
                SkuName = IntegrationAccountSkuName.Standard,
            };
            var integrationAccount = await resourceGroup.GetIntegrationAccounts().CreateOrUpdateAsync(WaitUntil.Completed, integrationAccountName, integrationAccountData);

            // create logic work flow
            string logicWorkflowName = Recording.GenerateAssetName("logicWorkFlow");
            byte[] definition = File.ReadAllBytes(@"TestData/WorkflowDefinition.json");
            LogicWorkflowData logicWorkflowData = new LogicWorkflowData(resourceGroup.Data.Location)
            {
                Definition = new BinaryData(definition),
                IntegrationAccount = new LogicResourceReference() { Id = integrationAccount.Value.Data.Id },
            };
            var workflow = await resourceGroup.GetLogicWorkflows().CreateOrUpdateAsync(WaitUntil.Completed, logicWorkflowName, logicWorkflowData);
            return workflow.Value;
        }

        protected async Task<IotHubDescriptionResource> CreateIotHub(ResourceGroupResource resourceGroup, string iotHubName)
        {
            var sku = new IotHubSkuInfo("S1")
            {
                Name = "S1",
                Capacity = 1
            };
            IotHubDescriptionData data = new IotHubDescriptionData(resourceGroup.Data.Location, sku) { };
            var iotHub = await resourceGroup.GetIotHubDescriptions().CreateOrUpdateAsync(WaitUntil.Completed, iotHubName, data);
            return iotHub.Value;
        }

        protected async Task<IotSecuritySolutionResource> CreateIotSecuritySolution(ResourceGroupResource resourceGroup, string iotHubId, string solutionModelName)
        {
            IotSecuritySolutionData data = new IotSecuritySolutionData(resourceGroup.Data.Location)
            {
                Status = SecuritySolutionStatus.Enabled,
                UnmaskedIPLoggingStatus = UnmaskedIPLoggingStatus.Enabled,
                DisplayName = solutionModelName,
                IotHubs =
                {
                    iotHubId
                },
                RecommendationsConfiguration =
                {
                    new RecommendationConfigurationProperties(IotSecurityRecommendationType.IotOpenPorts,RecommendationConfigStatus.Disabled),
                    new RecommendationConfigurationProperties(IotSecurityRecommendationType.IotSharedCredentials,RecommendationConfigStatus.Disabled),
                }
            };
            var iotSecuritySolutionModel = await resourceGroup.GetIotSecuritySolutions().CreateOrUpdateAsync(WaitUntil.Completed, solutionModelName, data);
            return iotSecuritySolutionModel.Value;
        }
    }
}


text:
from GirderClient import *
import pymongo

c = GirderClient('localhost', 9000)

# Create an admin user if there isn't one
try:
    c.authenticate('girder', 'girder')
except:
    c.sendRestRequest('POST', 'user', {
        "login": "girder",
        "password": "girder",
        "email": "girder@localhost.com",
        "firstName": "Girder",
        "lastName": "Admin"
        })
    c.authenticate('girder', 'girder')

# Create a tangelo hub collection if there isn't one
coll_search = c.sendRestRequest('GET', 'resource/search', {
    'q': 'Default',
    'types': '["collection"]'
})
if len(coll_search["collection"]) == 0:
    collection = c.createCollection(
        'Default', 'Default workspace', public='true')
    c.createFolder(
        collection, 'collection', 'Data', 'Data folder', public='true')
    c.createFolder(
        collection, 'collection', 'Analyses', 'Analysis folder', public='true')

# Turn on the romanesco plugin
c.sendRestRequest('PUT', 'system/plugins', {"plugins": '["romanesco"]'})

# Create an assetstore if there isn't one
if len(c.sendRestRequest('GET', 'assetstore')) == 0:
    c.sendRestRequest('POST', 'assetstore', {
        'type': '1',
        'name': 'GridFS',
        'db': 'girder-gridfs'
    })


text:
import React from 'react';
import PropTypes from 'prop-types';
import _ from 'lodash';
import { FormattedMessage } from 'react-intl';
import { connect } from 'react-redux';
import LeftSidebar from '../app/Sidebar/LeftSidebar';
import Affix from '../components/Utils/Affix';
import * as notificationConstants from '../../common/constants/notifications';
import { getUpdatedSCUserMetadata } from '../auth/authActions';
import { getNotifications } from '../user/userActions';
import {
  getAuthenticatedUserSCMetaData,
  getNotifications as getNotificationsState,
  getIsLoadingNotifications,
  getAuthenticatedUserName,
} from '../reducers';
import requiresLogin from '../auth/requiresLogin';
import NotificationReply from '../components/Navigation/Notifications/NotificationReply';
import NotificationMention from '../components/Navigation/Notifications/NotificationMention';
import NotificationFollowing from '../components/Navigation/Notifications/NotificationFollowing';
import NotificationVote from '../components/Navigation/Notifications/NotificationVote';
import NotificationReblog from '../components/Navigation/Notifications/NotificationReblog';
import NotificationTransfer from '../components/Navigation/Notifications/NotificationTransfer';
import NotificationVoteWitness from '../components/Navigation/Notifications/NotificationVoteWitness';
import Loading from '../components/Icon/Loading';
import './Notifications.less';

class Notifications extends React.Component {
  static propTypes = {
    loadingNotifications: PropTypes.bool.isRequired,
    getUpdatedSCUserMetadata: PropTypes.func.isRequired,
    getNotifications: PropTypes.func.isRequired,
    notifications: PropTypes.arrayOf(PropTypes.shape()),
    currentAuthUsername: PropTypes.string,
    userSCMetaData: PropTypes.shape(),
  };

  static defaultProps = {
    notifications: [],
    currentAuthUsername: '',
    userSCMetaData: {},
  };

  componentDidMount() {
    const { userSCMetaData, notifications } = this.props;

    if (_.isEmpty(userSCMetaData)) {
      this.props.getUpdatedSCUserMetadata();
    }

    if (_.isEmpty(notifications)) {
      this.props.getNotifications();
    }
  }

  render() {
    const { notifications, currentAuthUsername, userSCMetaData, loadingNotifications } = this.props;
    const lastSeenTimestamp = _.get(userSCMetaData, 'notifications_last_timestamp');

    return (

          <Affix className="leftContainer" stickPosition={77}>

              <LeftSidebar />

          </Affix>

                <FormattedMessage id="notifications" defaultMessage="Notifications" />

              {loadingNotifications && (

                  <Loading />

              )}
              {_.map(notifications, (notification, index) => {
                const key = `${index}${notification.timestamp}`;
                const read = lastSeenTimestamp >= notification.timestamp;
                switch (notification.type) {
                  case notificationConstants.REPLY:
                    return (
                      <NotificationReply
                        key={key}
                        notification={notification}
                        currentAuthUsername={currentAuthUsername}
                        read={read}
                      />
                    );
                  case notificationConstants.FOLLOW:
                    return (
                      <NotificationFollowing key={key} notification={notification} read={read} />
                    );
                  case notificationConstants.MENTION:
                    return (
                      <NotificationMention key={key} notification={notification} read={read} />
                    );
                  case notificationConstants.VOTE:
                    return (
                      <NotificationVote
                        key={key}
                        notification={notification}
                        read={read}
                        currentAuthUsername={currentAuthUsername}
                      />
                    );
                  case notificationConstants.REBLOG:
                    return (
                      <NotificationReblog
                        key={key}
                        notification={notification}
                        read={read}
                        currentAuthUsername={currentAuthUsername}
                      />
                    );
                  case notificationConstants.TRANSFER:
                    return (
                      <NotificationTransfer key={key} notification={notification} read={read} />
                    );
                  case notificationConstants.WITNESS_VOTE:
                    return (
                      <NotificationVoteWitness key={key} notification={notification} read={read} />
                    );
                  default:
                    return null;
                }
              })}
              {_.isEmpty(notifications) &&
                !loadingNotifications && (

                    <FormattedMessage
                      id="notifications_empty_message"
                      defaultMessage="You currently have no notifications."
                    />

                )}

    );
  }
}

export default connect(
  state => ({
    notifications: getNotificationsState(state),
    userSCMetaData: getAuthenticatedUserSCMetaData(state),
    currentAuthUsername: getAuthenticatedUserName(state),
    loadingNotifications: getIsLoadingNotifications(state),
  }),
  {
    getUpdatedSCUserMetadata,
    getNotifications,
  },
)(requiresLogin(Notifications));


text:
# DigiComp.SettingValidator

This package allows configuring validators with a new configuration type.

## Introduction

This package provides the `SettingsValidator` which uses the configuration type `Validation` to resolve the validators
that should be applied to the value. It distinguishes between validators that are applied to the value itself and its
properties.

## Resolving the validation configuration

The `SettingsValidator` has an option `name`. If it is set, the name is used to resolve the validation configuration,
otherwise the type of the value is used, which is mainly useful for objects where the FQCN is used.

### Resolving by option `name`

To resolve the validation configuration by name just use the option `name`.

```php
/**
 * @Flow\Validate(type="DigiComp.SettingValidator:Settings", options={"name"="MyNamedValidator"})
 * @var MyObject
 */
protected MyObject $myObject;
```

The `SettingsValidator` will search for an entry inside the `Validation.yaml` with that name.

```yaml
MyNamedValidator:
  ...
```

### Resolving by type

To resolve the validation configuration by type just do not set the option `name`.

```php
/**
 * @Flow\Validate(type="DigiComp.SettingValidator:Settings")
 * @var MyObject
 */
protected MyObject $myObject;
```

The `SettingsValidator` will search for an entry inside the `Validation.yaml` with the FQCN of `MyObject`.

```yaml
My\Package\Domain\Model\MyObject:
  ...
```

## The validation configuration

### Difference between `self` and `properties`

`self` contains a map of validators that are applied to the value itself. `properties` contains a map with property
names of the value you would like to validate and each entry contains a map of validators that are applied to that
property.

```yaml
MyNamedValidator:
  self:
    ...
  properties:
    myProperty1:
      ...
    myProperty2:
      ...
```

### Configuring a validator

To configure a validator you use the type of the validator as key and the options as entries of that key. If the
validator has no options or all the default values are used, set an empty map as options.

```yaml
MyNamedValidator:
  self:
    'My.Package:SomeValidator':
        myOption: "myOptionValue"
  properties:
    myProperty1:
      'My.Package:SomeOtherValidator': {}
    myProperty2:
      'My.Package:SomeOtherValidator': {}
```

### Disable a validator

To disable a validator you need to set the options to `null`.

```yaml
MyNamedValidator:
  self:
    'My.Package:SomeValidator': ~
```

## Using the `SettingsValidator`

The `SettingsValidator` can be used to reduce the number of `@Flow\Validate` annotations and gives you the possibility
of overwriting existing validation configurations in other packages.

### Using on properties

Old PHP code:

```php
/**
 * @Flow\Validate(type="My.Package:SomeValidator", options={"myOption"="myOptionValue"})
 * @Flow\Validate(type="My.Package:SomeOtherValidator")
 * @var MyObject
 */
protected MyObject $myObject;
```

New PHP code:

```php
/**
 * @Flow\Validate(type="DigiComp.SettingValidator:Settings", options={"name"="MyNamedValidator"})
 * @var MyObject
 */
protected MyObject $myObject;
```

New validation configuration:

```yaml
MyNamedValidator:
  self:
    'My.Package:SomeValidator':
      myOption: "myOptionValue"
    'My.Package:SomeOtherValidator': {}
```

### Using on actions

Old PHP code:

```php
/**
 * @Flow\Validate(argumentName="myObject", type="My.Package:SomeValidator", options={"myOption"="myOptionValue"})
 * @Flow\Validate(argumentName="myObject", type="My.Package:SomeOtherValidator")
 * @param MyObject $myObject
 */
public function myAction(MyObject $myObject)
{
    ...
}
```

New PHP code:

```php
/**
 * @Flow\Validate(argumentName="myObject", type="DigiComp.SettingValidator:Settings", options={"name"="MyNamedValidator"})
 * @param MyObject $myObject
 */
public function myAction(MyObject $myObject)
{
    ...
}
```

New validation configuration:

```yaml
MyNamedValidator:
  self:
    'My.Package:SomeValidator':
        myOption: "myOptionValue"
    'My.Package:SomeOtherValidator': {}
```

### Using inside validator configurations

You can use the `SettingsValidator` inside the validator configuration to easily construct flexible structures.

```yaml
MyNamedValidator:
  properties:
    myProperty1:
      'DigiComp.SettingValidator:Settings':
        name: "MyOtherNamedValidator"

MyOtherNamedValidator:
  self:
    'My.Package:SomeOtherValidator': {}
```

## Providing an empty validator

It can be useful to provide an empty validator in code that is used by many projects. By doing so you can make sure that
a different validation is possible in any project.

```php
/**
 * @Flow\Validate(argumentName="myObject", type="DigiComp.SettingValidator:Settings", options={"name"="MyNamedValidator"})
 * @param MyObject $myObject
 */
public function myAction(MyObject $myObject)
{
    ...
}
```

```yaml
MyNamedValidator: {}
```


text:
using System.Collections.Generic;
using System.Threading.Tasks;
using Mandrill.Model;

namespace Mandrill
{
    public partial interface IMandrillUsersApi
    {
        Task<string> PingAsync();
        Task<IList<MandrillSenderDemographics>> SendersAsync();
        Task<MandrillUserInfo> InfoAsync();
    }
}