text:
title: Integrating RadEditor in the advanced form of RadScheduler
description: Integrating RadEditor in the advanced form of RadScheduler. Check it now!
type: how-to
page_title: Integrating RadEditor in the advanced form of RadScheduler
slug: scheduler-integrating-radeditor-in-the-advanced-form-of-radscheduler
res_type: kb
---

## HOW-TO

 Integrate RadEditor in the advanced form of RadScheduler

## DESCRIPTION

 RadEditor replaces the Description field of the advanced form. It's content is saved in the Description field and the stripped down plain text of the content (no formatting) is saved in a custom attribute - DescriptionPlainText. The DescriptionPlainText custom attribute is used for description in the AppointmentTemplate.

**Advanced form:**

 ![RadEditor in the advanced form ](images/scheduler-Advanced-Form-With-Editor.png)

 **Appointment template:**
 ![appointment template with plain text description](images/scheduler-Appointment-With-Plain-Text-Description.png)

 ## SOLUTION

 Download a working sample from [here](/support/kb/aspnet-ajax/scheduler/sample-project-of-the-customizing-the-advanced-template-example.aspx?) (SchedulerCustomAdvancedFormQ3\_SP1\_2009.zip). Then edit **AdvancedForm.ascx** to comment the description RadTextBox and add a RadEditor control and a description label like this:

 ````ASP.NET
<%-- <telerik:RadTextBox runat="server" ID="DescriptionText" TextMode="MultiLine" Columns="50"
                   Rows="5" Width="100%" Label='<%# Owner.Localization.AdvancedDescription + ":" %>'
                   Text='<%# Eval("Description") %>' />--%>

<label>
  <%= Owner.Localization.AdvancedDescription%>:
</label>
<telerik:RadEditor ID="DescriptionText" runat="server">
</telerik:RadEditor>
 ````

 In code-behind of **AdvancedForm**.ascx modify the Description property and expose a new one - DescriptionPlainText as follows:

 ````C#
[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
public string Description
{
    get
    {
        return DescriptionText.Content;
    }

    set
    {
        DescriptionText.Content = value;
    }
}
[Bindable(BindableSupport.Yes, BindingDirection.OneWay)]
public string DescriptionPlainText
{
    get
    {
        return DescriptionText.Text;
    }
}
 ````
 ````VB
<Bindable(BindableSupport.Yes, BindingDirection.TwoWay)> _
Public Property Description() As String
    Get
        Return DescriptionText.Content
    End Get

    Set
        DescriptionText.Content = value
    End Set
End Property
<Bindable(BindableSupport.Yes, BindingDirection.OneWay)> _
Public ReadOnly Property DescriptionPlainText() As String
    Get
        Return DescriptionText.Text
    End Get
End Property
 ````

 In **Default.aspx** make the following changes:

````ASP.NET
<telerik:RadScheduler runat="server" ID="RadScheduler1" Width="650px"
    SelectedDate="2007-03-30" TimeZoneOffset="03:00:00"
    OnDataBound="RadScheduler1_DataBound"
    OnAppointmentDataBound="RadScheduler1_AppointmentDataBound"
    OnClientFormCreated="schedulerFormCreated"
    CustomAttributeNames="AppointmentColor, DescriptionPlainText"
    EnableDescriptionField="true">
    <AdvancedForm Modal="true" />
    <AppointmentTemplate>
        <div class="rsAptSubject">
            <%# Eval("Subject") %>
        </div>
        <%# Eval("DescriptionPlainText")%>
    </AppointmentTemplate>
    <AdvancedEditTemplate>
        <scheduler:AdvancedForm runat="server" ID="AdvancedEditForm1" Mode="Edit"
            Subject='<%# Bind("Subject") %>'
            Description='<%# Bind("Description") %>'
            DescriptionPlainText='<%# Bind("DescriptionPlainText") %>'
            Start='<%# Bind("Start") %>'
            End='<%# Bind("End") %>'
            RecurrenceRuleText='<%# Bind("RecurrenceRule") %>'
            AppointmentColor='<%# Bind("AppointmentColor") %>'
            UserID='<%# Bind("User") %>'
            RoomID='<%# Bind("Room") %>' />
    </AdvancedEditTemplate>
    <AdvancedInsertTemplate>
        <scheduler:AdvancedForm runat="server" ID="AdvancedInsertForm1" Mode="Insert"
            Subject='<%# Bind("Subject") %>'
            Start='<%# Bind("Start") %>'
            End='<%# Bind("End") %>'
            Description='<%# Bind("Description") %>'
            DescriptionPlainText='<%# Bind("DescriptionPlainText") %>'
            RecurrenceRuleText='<%# Bind("RecurrenceRule") %>'
            AppointmentColor='<%# Bind("AppointmentColor") %>'
            UserID='<%# Bind("User") %>'
            RoomID='<%# Bind("Room") %>' />
    </AdvancedInsertTemplate>
    <TimelineView UserSelectable="false" />
    <TimeSlotContextMenuSettings EnableDefault="true" />
    <AppointmentContextMenuSettings EnableDefault="true" />
</telerik:RadScheduler>
````

You can download a sample project from [here](files/scheduler-radeditor-in-advanced-form-of-radscheduler.zip).


text:
import {React} from './../../bundle.dependencies';
import {WithOutsideClick} from './../../bundle.components';

/**
 * This is a controlled component that maintains it's own state
 */

class EditableLabel extends React.Component {

  static propTypes = {
    cssClass: React.PropTypes.string,
    isEditing: React.PropTypes.bool,
    label: React.PropTypes.string,
    onChange: React.PropTypes.func,
    onClick: React.PropTypes.func,
    onOutsideClick: React.PropTypes.func,
    value: React.PropTypes.string
  };

  static defaultProps = {
    cssClass: '',
    isEditing: false,
    onChange: () => {},
    onClick: () => {},
    onOutsideClick: () => {}
  };

  constructor(props) {
    super(props);

    this.state = {
      value: this.props.value
    };

    // Pre-bind methods' context
    this.boundOnChange = this.onChange.bind(this);
  }

  componentWillReceiveProps(nextProps) {
    if (this.props.value === nextProps.value) {
      return;
    }

    this.state = {
      value: nextProps.value,
    };
  }

  onChange(event) {
    const newValue = event.target.value;
    this.setState({
      value: newValue
    });

    const {onChange} = this.props;
    onChange(newValue);
  }

  render() {
    const {cssClass, isEditing, label, onClick, onOutsideClick} = this.props;
    const {value} = this.state;
    const editableLabelCssClass = 'editable-label ' + cssClass + (isEditing ? ' editable-label--editing' : '');

    return <WithOutsideClick
      onItemClick={onClick}
      onOutsideClick={onOutsideClick}>
      <div className={editableLabelCssClass}>
        <label className="editable-label__input-label">
          {label}
        </label>
        <input
          className="editable-label__input"
          onChange={this.boundOnChange}
          onFocus={onClick}
          onBlur={onOutsideClick}
          type="text"
          value={value}/>
      </div>
    </WithOutsideClick>
  }
}

export default EditableLabel;

redpajama_set_name: RedPajamaGithub


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2013.07.25 at 09:20:21 PM CEST
//

package org.agorava.xing.jaxb;

import java.math.BigDecimal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for anonymous complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType>
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element ref="{}utc_offset"/>
 *         <element ref="{}name"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "utcOffset",
    "name"
})
@XmlRootElement(name = "time_zone")
public class TimeZone {

    @XmlElement(name = "utc_offset", required = true)
    protected BigDecimal utcOffset;
    @XmlElement(required = true)
    protected String name;

    /**
     * Gets the value of the utcOffset property.
     *
     * @return
     *     possible object is
     *     {@link BigDecimal }
     *
     */
    public BigDecimal getUtcOffset() {
        return utcOffset;
    }

    /**
     * Sets the value of the utcOffset property.
     *
     * @param value
     *     allowed object is
     *     {@link BigDecimal }
     *
     */
    public void setUtcOffset(BigDecimal value) {
        this.utcOffset = value;
    }

    /**
     * Gets the value of the name property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the value of the name property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setName(String value) {
        this.name = value;
    }

}


text:
sap.ui.define(["exports", "sap/ui/webc/common/thirdparty/base/UI5Element", "sap/ui/webc/common/thirdparty/base/renderer/LitRenderer", "sap/ui/webc/common/thirdparty/base/config/Theme", "sap/ui/webc/common/thirdparty/base/Keys", "sap/ui/webc/common/thirdparty/icons/decline", "sap/ui/webc/common/thirdparty/icons/sys-cancel", "sap/ui/webc/common/thirdparty/base/i18nBundle", "./generated/i18n/i18n-defaults", "./Icon", "./generated/templates/TokenTemplate.lit", "./generated/themes/Token.css"], function (_exports, _UI5Element, _LitRenderer, _Theme, _Keys, _decline, _sysCancel, _i18nBundle, _i18nDefaults, _Icon, _TokenTemplate, _Token) {
  "use strict";

  Object.defineProperty(_exports, "__esModule", {
    value: true
  });
  _exports.default = void 0;
  _UI5Element = _interopRequireDefault(_UI5Element);
  _LitRenderer = _interopRequireDefault(_LitRenderer);
  _Icon = _interopRequireDefault(_Icon);
  _TokenTemplate = _interopRequireDefault(_TokenTemplate);
  _Token = _interopRequireDefault(_Token);

  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

  // Styles

  /**
   * @public
   */
  const metadata = {
    tag: "ui5-token",
    languageAware: true,
    managedSlots: true,
    properties:
    /** @lends sap.ui.webcomponents.main.Token.prototype */
    {
      /**
       * Defines the text of the token.
       *
       * @type {string}
       * @defaultvalue ""
       * @public
       */
      text: {
        type: String
      },

      /**
       * Defines whether the component is read-only.
       *

       * Note: A read-only component can not be deleted or selected,
       * but still provides visual feedback upon user interaction.
       *
       * @type {boolean}
       * @public
       */
      readonly: {
        type: Boolean
      },

      /**
       * Set by the tokenizer when a token is in the "more" area (overflowing)
       * @type {boolean}
       * @private
       */
      overflows: {
        type: Boolean
      },

      /**
       * Defines whether the component is selected or not.
       *
       * @type {boolean}
       * @public
       */
      selected: {
        type: Boolean
      },

      /**
       * Defines whether the component is focused or not.
       *
       * @type {boolean}
       * @private
       */
      focused: {
        type: Boolean
      },

      /**
       * Defines the tabIndex of the component.
       * @type {string}
       * @private
       */
      _tabIndex: {
        type: String,
        defaultValue: "-1",
        noAttribute: true
      }
    },
    slots:
    /** @lends sap.ui.webcomponents.main.Token.prototype */
    {
      /**
       * Defines the close icon for the token. If nothing is provided to this slot, the default close icon will be used.
       * Accepts ui5-icon.
       *
       * @type {sap.ui.webcomponents.main.IIcon}
       * @slot
       * @public
       * @since 1.0.0-rc.9
       */
      closeIcon: {
        type: HTMLElement
      }
    },
    events:
    /** @lends sap.ui.webcomponents.main.Token.prototype */
    {
      /**
       * Fired when the backspace, delete or close icon of the token is pressed
       *
       * @event
       * @param {boolean} backSpace indicates whether token is deleted by backspace key
       * @param {boolean} delete indicates whether token is deleted by delete key
       * @private
       */
      "delete": {
        detail: {
          "backSpace": {
            type: Boolean
          },
          "delete": {
            type: Boolean
          }
        }
      },

      /**
       * Fired when the the component is selected by user interaction with mouse or by clicking space.
       *
       * @event
       * @public
       */
      select: {}
    }
  };
  /**
   * @class
   *
   *
Overview

   *
   * Tokens are small items of information (similar to tags) that mainly serve to visualize previously selected items.
   *
   *
ES6 Module Import

   *
   * import "@ui5/webcomponents/dist/Token.js";
   * @constructor
   * @author SAP SE
   * @alias sap.ui.webcomponents.main.Token
   * @extends sap.ui.webcomponents.base.UI5Element
   * @tagname ui5-token
   * @since 1.0.0-rc.9
   * @implements sap.ui.webcomponents.main.IToken
   * @public
   */

  class Token extends _UI5Element.default {
    static get metadata() {
      return metadata;
    }

    static get render() {
      return _LitRenderer.default;
    }

    static get template() {
      return _TokenTemplate.default;
    }

    static get styles() {
      return _Token.default;
    }

    _handleSelect() {
      this.selected = !this.selected;
      this.fireEvent("select");
    }

    _focusin() {
      this.focused = true;
    }

    _focusout() {
      this.focused = !this.focused;
    }

    _delete() {
      this.fireEvent("delete");
    }

    _keydown(event) {
      const isBS = (0, _Keys.isBackSpace)(event);
      const isD = (0, _Keys.isDelete)(event);

      if (!this.readonly && (isBS || isD)) {
        event.preventDefault();
        this.fireEvent("delete", {
          backSpace: isBS,
          "delete": isD
        });
      }

      if ((0, _Keys.isSpace)(event) || (0, _Keys.isSpaceCtrl)(event)) {
        event.preventDefault();

        this._handleSelect();
      }
    }

    get tokenDeletableText() {
      return Token.i18nBundle.getText(_i18nDefaults.TOKEN_ARIA_DELETABLE);
    }

    get iconURI() {
      if ((0, _Theme.getTheme)().includes("sap_belize")) {
        return "sys-cancel";
      }

      return "decline";
    }

    static get dependencies() {
      return [_Icon.default];
    }

    static async onDefine() {
      Token.i18nBundle = await (0, _i18nBundle.getI18nBundle)("@ui5/webcomponents");
    }

  }

  Token.define();
  var _default = Token;
  _exports.default = _default;
});


text:
WebviewNav
==========

Cascades Webview Navigation Sample


text:
package com.marianhello.cordova;

import org.apache.cordova.PluginResult;
import org.json.JSONException;
import org.json.JSONObject;

public class JSONErrorFactory {

    public static JSONObject getJSONError(Integer errorCode, String errorMessage) {
        JSONObject message = new JSONObject();
        try {
            message.put("code", errorCode);
            message.put("message", errorMessage);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return message;
    }
}


text:
import curses
import curses.textpad

class UI:
    def __init__(self):
        self.stdscr = curses.initscr()
        curses.start_color()
        curses.noecho()
        self.stdscr.keypad(1)
        curses.cbreak()

    def close(self):
        curses.echo()
        self.stdscr.keypad(0)
        curses.nocbreak()
        curses.endwin()

    def display_menu(self, menu):
        self.stdscr.addstr("Pizzas:")
        i = 0
        for pizza in menu.pizzas:
              self.stdscr.addstr("\t")
              self.stdscr.addstr(pizza.name.encode("utf-8"))
              self.maketextbox(1,10, self.stdscr.getyx()[0], self.stdscr.getyx()[1], "0",deco="underline", underlineChr=curses.ACS_HLINE,textColorpair=curses.color_pair(0),decoColorpair=curses.color_pair(1))
              self.stdscr.addstr("\n")

        self.stdscr.getch()

    # found this on stackoverflow
    def maketextbox(self, h,w,y,x,value="",deco=None,underlineChr = 0,textColorpair=0,decoColorpair=0):
        nw = curses.newwin(h,w,y,x)
        txtbox = curses.textpad.Textbox(nw)
        if deco=="frame":
            self.stdscr.attron(decoColorpair)
            curses.textpad.rectangle(screen,y-1,x-1,y+h,x+w)
            self.stdscr.attroff(decoColorpair)
        elif deco=="underline":
            self.stdscr.hline(y+1,x,underlineChr,w,decoColorpair)

        nw.addstr(0,0,value,textColorpair)
        nw.attron(textColorpair)
        self.stdscr.refresh()
        return txtbox


text:
My Organization

Organization Logo

                <button class="btn avatar-upload-button" [disabled]="organizationId===0">Upload
                  <input #input type="file" name="file" accept="image/gif, image/jpeg, image/png" (change)="onUploadLogo($event)">
                </button>

        <form [formGroup]="organizationForm" (ngSubmit)="onSubmit(organizationForm.value, $event)">

                <input type="text" id="name" formControlName="name" required>
                Organization Name *

                <select id="category" class="" formControlName="category" materialize="material_select">

                  <option *ngFor="let category of categories" [value]="category.value"
                          [selected]="category.value === organization?.category.value">{{category.name}}
                  </option>
                </select>
                Category *

                <input type="text" id="address1" class="" formControlName="address1">
                Address 1

                <input type="text" id="city" class="" formControlName="city">
                City

                <select id="country" class="validate" formControlName="country" materialize="material_select">
                  <option *ngFor="let country of countries" [value]="country.code"
                          [selected]="country.code === organization?.country">{{country.name + ' (' + country.code + ')'}}
                  </option>
                </select>
                Country *

                <input type="text" id="website" class="" formControlName="websiteUrl">
                Website

                <input type="text" id="ein" class="" formControlName="ein">
                EIN

                <input type="text" id="address2" class="" formControlName="address2">
                Address 2

                <input type="text" id="state" class="" formControlName="state">
                State

                <input type="text" id="ein" class="" formControlName="zip">
                Zip Code

                <textarea id="description" class="materialize-textarea" formControlName="description" required
                          (click)="onCountCharDesc()" (input)="onCountCharDesc()" (focus)="onFocusDesc()"
                          (blur)="onBlurDesc()">
                </textarea>
                Organization Description *
                   ({{ descValueLength + '/' + descMaxLength }})

                <button class="btn waves-effect waves-light" id=saveBtn type="submit" [disabled]="!organizationForm.valid" materialize [materializeParams]="['Your changes have been saved',4000]" [materializeActions]="globalActions">
                 Save
                </button>

        </form>


text:
package main

import (
	"net/http"
	"strings"

	"github.com/go-check/check"
)

func (s *DockerSuite) TestInfoApi(c *check.C) {
	endpoint := "/info"

	status, body, err := sockRequest("GET", endpoint, nil)
	c.Assert(status, check.Equals, http.StatusOK)
	c.Assert(err, check.IsNil)

	// always shown fields
	stringsToCheck := []string{
		"ID",
		"Containers",
		"Images",
		"ExecutionDriver",
		"LoggingDriver",
		"OperatingSystem",
		"NCPU",
		"OSType",
		"Architecture",
		"MemTotal",
		"KernelVersion",
		"Driver",
		"ServerVersion"}

	out := string(body)
	for _, linePrefix := range stringsToCheck {
		if !strings.Contains(out, linePrefix) {
			c.Errorf("couldn't find string %v in output", linePrefix)
		}
	}
}


text:
package jodd.proxetta.petite.fixtures;

import jodd.petite.meta.PetiteBean;

@PetiteBean ("++++Bean2++++")
public class Bean2 implements IBean2 {

    @Override
    public Object doInBean_2() {
        return this;
    }

}


text:
<template name="__viewName__">

                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                        Toggle navigation

                    </button>
                    MeteorBase

                            Profile

                                {{#if isAdmin}} |
Admin
{{/if}}

Another action

{{currentUser.profile.name}}

888 photos 150 followers

                                                     Message
                                                     Favorite
                                                     Unfollow

LOGOUT

</template>


text:
from django.contrib import admin
from models import Placeholder

class PlaceholderAdmin(admin.ModelAdmin):
	list_display = ('location', 'content')

admin.site.register(Placeholder, PlaceholderAdmin)


text:
<?php

/* TwigBundle:Exception:exception_full.html.twig */
class __TwigTemplate_5d01938be140b31ffd7256b328e15d926a3806eb821511bf09fe03b44cd9c851 extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        $this->parent = $this->env->loadTemplate("TwigBundle::layout.html.twig");

        $this->blocks = array(
            'head' => array($this, 'block_head'),
            'title' => array($this, 'block_title'),
            'body' => array($this, 'block_body'),
        );
    }

    protected function doGetParent(array $context)
    {
        return "TwigBundle::layout.html.twig";
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        $this->parent->display($context, array_merge($this->blocks, $blocks));
    }

    // line 3
    public function block_head($context, array $blocks = array())
    {
        // line 4
        echo "    <link href=\"";
        echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/framework/css/exception.css"), "html", null, true);
        echo "\" rel=\"stylesheet\" type=\"text/css\" media=\"all\" />
";
    }

    // line 7
    public function block_title($context, array $blocks = array())
    {
        // line 8
        echo "    ";
        echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "exception"), "message"), "html", null, true);
        echo " (";
        echo twig_escape_filter($this->env, $this->getContext($context, "status_code"), "html", null, true);
        echo " ";
        echo twig_escape_filter($this->env, $this->getContext($context, "status_text"), "html", null, true);
        echo ")
";
    }

    // line 11
    public function block_body($context, array $blocks = array())
    {
        // line 12
        echo "    ";
        $this->env->loadTemplate("TwigBundle:Exception:exception.html.twig")->display($context);
    }

    public function getTemplateName()
    {
        return "TwigBundle:Exception:exception_full.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  57 => 12,  54 => 11,  43 => 8,  40 => 7,  33 => 4,  30 => 3,);
    }
}


text:
package cn.momia.jobs.order;

public class Order {
    private long id;
    private long userId;
    private long subjectId;
    private int subjectType;
    private long count;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        this.userId = userId;
    }

    public long getSubjectId() {
        return subjectId;
    }

    public void setSubjectId(long subjectId) {
        this.subjectId = subjectId;
    }

    public int getSubjectType() {
        return subjectType;
    }

    public void setSubjectType(int subjectType) {
        this.subjectType = subjectType;
    }

    public long getCount() {
        return count;
    }

    public void setCount(long count) {
        this.count = count;
    }
}


text:
package fr.imie.presentation;

import java.io.IOException;

import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import fr.imie.model.Personne;
import fr.imie.model.Promotion;
import fr.imie.service.SchoolServiceLocal;

/**
 * Servlet implementation class PromotionForm
 */
@WebServlet("/PromotionForm")
public class PromotionForm extends HttpServlet {
	private static final long serialVersionUID = 1L;

	@EJB
	SchoolServiceLocal schoolService;

    /**
     * @see HttpServlet#HttpServlet()
     */
    public PromotionForm() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String idString = request.getParameter("id");
		Integer id = null;
		if (idString != null && !idString.isEmpty()) {
			id = Integer.valueOf(idString);
		}

		Promotion promotion= new Promotion();
		if (id != null) {
			promotion.setId(id);
		}

		promotion = schoolService.findPromotionById(promotion);

		request.setAttribute("promotion",promotion);

		request.getRequestDispatcher("WEB-INF/promotionForm.jsp").forward(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

}


text:
[![Join the chat at https://gitter.im/mesoscloud/haproxy-marathon](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/mesoscloud/haproxy-marathon?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

The purpose of this image is to generate HAProxy config using Marathon as a data source and storing the resulting config in ZooKeeper.  This allows a dedicated container to run haproxy, monitor ZooKeeper for config changes and reload haproxy when config has been updated.

See https://github.com/mesoscloud/haproxy

## Python

[![](https://badge.imagelayers.io/mesoscloud/haproxy-marathon:0.1.0.svg)](https://imagelayers.io/?images=mesoscloud/haproxy-marathon:0.1.0)

e.g.

```
docker run -d \
-e MARATHON=node-1:8080 \
-e ZK=node-1:2181 \
--name=haproxy --net=host --restart=always mesoscloud/haproxy-marathon:0.1.0
```


text:
One of the things that most helps me think is to think out loud.

But this isn't always possible. I may be sharing an office, in which case I don't want to bug my office-mate with every stray thought, question, and idea that crosses my mind. I may be thinking about things that I can't talk about.

I used to often "think out loud" on Twitter, but I can't do that anymore for job reasons, and besides, it's kind of rude to annoy the people who follow me there with my thinking-out-loud just as it would be to do it to an office-mate.

So what I need is something that works essentially the same as a Twitter client (specifically [Tweetbot](https://tapbots.com/tweetbot/mac/), which is what I use), but without actually being connected to Twitter, the internet, or indeed anybody.

So I wrote that.

This is also my first Core Data application and my first storyboard-based application, so I wrote it partly to learn to use these things.

## Requirements

OS X 10.10 or later.

## The user interface

There are two main windows.

The most main of them all is the Journal window, where all your previously-recorded entries are shown:

![Screenshot of a Journal window with some entries in it. Above the list, a search field, and above that, a compose button.](README-assets/journal-mainwindow.png)

Then there's the Compose window, where you write a new entry:

![Screenshot of a Compose window with some text written in it. Below the text view, a character counter and a Save button.](README-assets/journal-composewindow.png)

The Compose window includes a character counter, just like on Twitter, although it isn't actually enforced here.

The character "limit" (such as it is) defaults to 140 characters, though you can change it in the Preferences to 256 (App.net) or 512 (IRC).

## You found a bug?!

Please do feel free to file bugs in [the issue tracker](https://github.com/boredzo/journal/issues) if you encounter any. I'll also happily consider pull requests.

## Copyright

See LICENSE.txt for copyright and license information.


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.javachen</groupId>
	<artifactId>spring-selenium</artifactId>
	<packaging>war</packaging>
	<version>1.0.0</version>
	<name>spring-selenium Maven Webapp</name>
	<url>http://maven.apache.org</url>
	<build>
		<finalName>spring-selenium</finalName>
	</build>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

		<!-- Versions -->
		<spring.version>3.2.11.RELEASE</spring.version>
		<commons.version>3.1</commons.version>
		<slf4j.version>1.6.4</slf4j.version>
		<log4j.version>1.2.15</log4j.version>
		<jstl.version>1.2</jstl.version>
		<aspectj.version>1.6.12</aspectj.version>
	</properties>

	<dependencies>
		<!-- Spring framework -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<version>${spring.version}</version>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-web</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>${spring.version}</version>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context-support</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<!-- Apache Commons -->
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-lang3</artifactId>
			<version>${commons.version}</version>
		</dependency>

		<!-- Web -->
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>jstl</artifactId>
			<version>${jstl.version}</version>
			<type>jar</type>
			<scope>compile</scope>
		</dependency>

		<!-- Logging -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>jcl-over-slf4j</artifactId>
			<version>${slf4j.version}</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>${slf4j.version}</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-log4j12</artifactId>
			<version>${slf4j.version}</version>
		</dependency>

		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>${log4j.version}</version>
			<exclusions>
				<exclusion>
					<groupId>javax.mail</groupId>
					<artifactId>mail</artifactId>
				</exclusion>
				<exclusion>
					<groupId>javax.jms</groupId>
					<artifactId>jms</artifactId>
				</exclusion>
				<exclusion>
					<groupId>com.sun.jdmk</groupId>
					<artifactId>jmxtools</artifactId>
				</exclusion>
				<exclusion>
					<groupId>com.sun.jmx</groupId>
					<artifactId>jmxri</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.12</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-test</artifactId>
			<version>4.1.6.RELEASE</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-all</artifactId>
			<version>1.8.5</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.seleniumhq.selenium</groupId>
			<artifactId>selenium-java</artifactId>
			<version>2.26.0</version>
			<scope>test</scope>
		</dependency>
	</dependencies>
</project>


text:
package jsv

import (
	"encoding/json"
)

var (
	JsonCodec Codec = &jsonCodec{}
)

type Codec interface {
	Marshal(i interface{}) ([]byte, error)
	Unmarshal(b []byte, i interface{}) error
}

type jsonCodec struct{}

func (this *jsonCodec) Marshal(i interface{}) ([]byte, error) {
	return json.Marshal(i)
}
func (this *jsonCodec) Unmarshal(b []byte, i interface{}) error {
	return json.Unmarshal(b, &i)
}


text:
Splits expenses betweeb people.

## Development

Install dependencies and start development server with:

```
npm install
npm run dev
```

Server with HMR should now be running on `http://localhost:8080`

Redux DevTools are hidden by default. You can change this behavior and other settings from `src/containers/utils/DevTools.js`.

***To toggle the DevTool panel during development:***
CTRL + H

***Change the DevTool panel's position during development:***
CTRL + Q

## Production build

```
npm run build
```

## Acknowledgements

This project is a grateful recipient of the [Futurice Open Source sponsorship program](http://futurice.com/blog/sponsoring-free-time-open-source-activities).

## License

MIT


text:
using System;
using System.Collections.ObjectModel;
using System.Linq.Expressions;
using System.Runtime.Serialization;
using System.Text;
using InterLinq.Expressions.Helpers;

namespace InterLinq.Expressions
{
	/// <summary>
	/// A serializable version of <see cref="NewArrayExpression"/>.
	/// </summary>
	[Serializable]
	[DataContract]
	public class SerializableNewArrayExpression : SerializableExpression
	{
		#region Constructors

		/// <summary>
		/// Default constructor for serialization.
		/// </summary>
		public SerializableNewArrayExpression() { }

		/// <summary>
		/// Constructor with an <see cref="NewArrayExpression"/> and an <see cref="ExpressionConverter"/>.
		/// </summary>
		/// <param name="expression">The original, not serializable <see cref="Expression"/>.</param>
		/// <param name="expConverter">The <see cref="ExpressionConverter"/> to convert contained <see cref="Expression">Expressions</see>.</param>
		public SerializableNewArrayExpression(NewArrayExpression expression, ExpressionConverter expConverter)
			: base(expression, expConverter)
		{
			Expressions = expression.Expressions.MakeSerializableCollection<SerializableExpression>(expConverter);
		}

		#endregion

		#region Properties

		/// <summary>
		/// See <see cref="NewArrayExpression.Expressions"/>
		/// </summary>
		[DataMember]
		public ReadOnlyCollection<SerializableExpression> Expressions { get; set; }

		#endregion

		#region ToString() Methods

		/// <summary>
		/// Builds a <see langword="string"/> representing the <see cref="Expression"/>.
		/// </summary>
		/// <param name="builder">A <see cref="System.Text.StringBuilder"/> to add the created <see langword="string"/>.</param>
		internal override void BuildString(StringBuilder builder)
		{
			if (builder == null)
			{
				throw new ArgumentNullException("builder");
			}
			switch (NodeType)
			{
				case ExpressionType.NewArrayInit:
					builder.Append("new ");
					builder.Append("[] {");
					int num3 = 0;
					int count = Expressions.Count;
					while (num3 < count)
					{
						if (num3 > 0)
						{
							builder.Append(", ");
						}
						Expressions[num3].BuildString(builder);
						num3++;
					}
					builder.Append("}");
					return;
				case ExpressionType.NewArrayBounds:
					builder.Append("new ");
					builder.Append(Type.ToString());
					builder.Append("(");
					int num = 0;
					int num2 = Expressions.Count;
					while (num < num2)
					{
						if (num > 0)
						{
							builder.Append(", ");
						}
						Expressions[num].BuildString(builder);
						num++;
					}
					builder.Append(")");
					return;
			}
		}

		#endregion
	}
}


text:
package com.google.devtools.intellij.protoeditor.lang.psi.impl;

import com.google.devtools.intellij.protoeditor.lang.psi.PbTextElement;
import com.google.devtools.intellij.protoeditor.lang.psi.PbTextField;
import com.google.devtools.intellij.protoeditor.lang.psi.PbTextLiteral;
import com.google.devtools.intellij.protoeditor.lang.psi.PbTextMessage;
import com.google.devtools.intellij.protoeditor.lang.psi.PbTextValueList;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.jetbrains.annotations.NotNull;

abstract class PbTextFieldMixin extends PbTextElementBase implements PbTextField {

  PbTextFieldMixin(ASTNode node) {
    super(node);
  }

  @NotNull
  @Override
  public List<PbTextElement> getValues() {
    PbTextValueList valueList = getValueList();
    PsiElement parent = valueList != null ? valueList : this;
    return Stream.of(parent.getChildren())
        .filter(c -> c instanceof PbTextLiteral || c instanceof PbTextMessage)
        .map(c -> (PbTextElement) c)
        .collect(Collectors.toList());
  }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2022 The Chromium Authors
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<LinearLayout
    android:id="@+id/fast_checkout_autofill_profile_item"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:orientation="horizontal"
    android:paddingTop="@dimen/fast_checkout_detail_sheet_padding_vertical"
    android:paddingBottom="@dimen/fast_checkout_detail_sheet_padding_vertical">

    <ImageView
        android:layout_width="@dimen/fast_checkout_address_icon"
        android:layout_height="@dimen/fast_checkout_address_icon"
        android:background="@null"
        android:layout_marginStart="@dimen/fast_checkout_address_icon_margin_horizontal"
        android:layout_marginEnd="@dimen/fast_checkout_address_icon_margin_horizontal"
        android:importantForAccessibility="no"
        app:srcCompat="@drawable/gm_filled_location_on_24" />

    <LinearLayout
        android:layout_height="wrap_content"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:orientation="vertical">
        <TextView
          android:id="@+id/fast_checkout_autofill_profile_item_name"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:textAppearance="@style/TextAppearance.TextMedium.Primary" />
        <TextView
          android:id="@+id/fast_checkout_autofill_profile_item_street_address"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:textAppearance="@style/TextAppearance.TextMedium.Primary" />
        <TextView
          android:id="@+id/fast_checkout_autofill_profile_item_city_and_postal_code"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:textAppearance="@style/TextAppearance.TextMedium.Primary" />
        <TextView
          android:id="@+id/fast_checkout_autofill_profile_item_country"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:textAppearance="@style/TextAppearance.TextMedium.Primary" />
        <LinearLayout
          android:id="@+id/fast_checkout_autofill_profile_sub_section"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="vertical"
          android:layout_marginTop="@dimen/fast_checkout_address_item_email_margin_top">
            <TextView
              android:id="@+id/fast_checkout_autofill_profile_item_email"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:textAppearance="@style/TextAppearance.TextMedium.Primary" />
            <TextView
              android:id="@+id/fast_checkout_autofill_profile_item_phone_number"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:textAppearance="@style/TextAppearance.TextMedium.Primary" />
        </LinearLayout>
    </LinearLayout>
    <ImageView
        android:id="@+id/fast_checkout_autofill_profile_item_selected_icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/fast_checkout_detail_sheet_selected_icon_margin_start"
        android:layout_marginEnd="@dimen/fast_checkout_detail_sheet_selected_icon_margin_end"
        android:layout_gravity="center_vertical"
        android:contentDescription="@null"
        app:tint="?attr/colorPrimary"
        app:srcCompat="@drawable/ic_check_circle_filled_green_24dp" />
</LinearLayout>


text:
from .models import get_birthdays
from django.http import HttpResponse
from django.views.generic import View
import json

class list(View):

    def get(self, request, *args, **kwargs):
        return HttpResponse(json.dumps(get_birthdays(kwargs.get("date"))), content_type="application/json")


text:
class AddOmiseIdToUser < ActiveRecord::Migration
  def change
    add_column :users, :omise_id, :string
  end
end


text:
package com.linkedin.thirdeye.anomaly.api;

import java.util.Properties;

/**
 * Extends Properties for AnomalyDetectionFunction initialization
 */
public final class FunctionProperties extends Properties {

  /** */
  private static final long serialVersionUID = -3782239901903143788L;

}


text:
var expect = require('chai').expect
, sinon      = require('sinon')
, sinon      = require('should')
, rewire = require('rewire');

var IndexSelector = rewire('../lib/index-selector');

  describe("Runner", function() {

  it("should exists", function(done) {

    var selector = new IndexSelector();

    expect(selector).to.not.be.undefined;
    done();
  });

  it("should select latest logstash index", function(done) {

    var selector = new IndexSelector();

    // logstash-2014.01.03  == expected example

    var dateFormat = require('dateformat');
    var now = new Date();
    var expected = 'logstash-' + dateFormat(now, 'yyyy.mm.dd');

    var index = selector.latest();

    expect(index).to.be.expected;

    done();
  });

});


text:
package io.micrometer.dynatrace.v1;

import org.junit.jupiter.api.Test;

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

import static org.assertj.core.api.Assertions.assertThat;

class DynatraceTimeSeriesTest {

    @Test
    void addsDimensionsValuesWhenAvailable() {
        final Map<String, String> dimensions = new HashMap<>();
        dimensions.put("first", "one");
        dimensions.put("second", "two");
        final DynatraceTimeSeries timeSeries = new DynatraceTimeSeries("custom:test.metric", 12345, 1, dimensions);
        assertThat(timeSeries.asJson()).isEqualTo(
                "{\"timeseriesId\":\"custom:test.metric\",\"dataPoints\":[[12345,1]],\"dimensions\":{\"first\":\"one\",\"second\":\"two\"}}");
    }

    @Test
    void asJsonShouldEscapeDimensionValue() {
        Map<String, String> dimensions = new HashMap<>();
        dimensions.put("path", "C:\\MyPath");
        dimensions.put("second", "two");
        DynatraceTimeSeries timeSeries = new DynatraceTimeSeries("custom:test.metric", 12345, 1, dimensions);
        assertThat(timeSeries.asJson()).isEqualTo(
                "{\"timeseriesId\":\"custom:test.metric\",\"dataPoints\":[[12345,1]],\"dimensions\":{\"path\":\"C:\\\\MyPath\",\"second\":\"two\"}}");
    }

}


text:
/*************************************************************************/
/*  file_access_network.cpp                                              */
/*************************************************************************/
/*                       This file is part of:                           */
/*                           GODOT ENGINE                                */
/*                    http://www.godotengine.org                         */
/*************************************************************************/
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur.                 */
/*                                                                       */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the       */
/* "Software"), to deal in the Software without restriction, including   */
/* without limitation the rights to use, copy, modify, merge, publish,   */
/* distribute, sublicense, and/or sell copies of the Software, and to    */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions:                                             */
/*                                                                       */
/* The above copyright notice and this permission notice shall be        */
/* included in all copies or substantial portions of the Software.       */
/*                                                                       */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
/*************************************************************************/
#include "file_access_network.h"
#include "marshalls.h"
#include "globals.h"
#include "os/os.h"
#include "io/ip.h"

//#define DEBUG_PRINT(m_p) print_line(m_p)
//#define DEBUG_TIME(m_what) printf("MS: %s - %lli\n",m_what,OS::get_singleton()->get_ticks_usec());
#define DEBUG_PRINT(m_p)
#define DEBUG_TIME(m_what)

void FileAccessNetworkClient::lock_mutex() {

	mutex->lock();
	lockcount++;
}

void FileAccessNetworkClient::unlock_mutex() {

	lockcount--;
	mutex->unlock();

}

void FileAccessNetworkClient::put_32(int p_32) {

	uint8_t buf[4];
	encode_uint32(p_32,buf);
	client->put_data(buf,4);
	DEBUG_PRINT("put32: "+itos(p_32));
}

void FileAccessNetworkClient::put_64(int64_t p_64) {

	uint8_t buf[8];
	encode_uint64(p_64,buf);
	client->put_data(buf,8);
	DEBUG_PRINT("put64: "+itos(p_64));

}

int FileAccessNetworkClient::get_32() {

	uint8_t buf[4];
	client->get_data(buf,4);
	return decode_uint32(buf);

}

int64_t FileAccessNetworkClient::get_64() {

	uint8_t buf[8];
	client->get_data(buf,8);
	return decode_uint64(buf);

}

void FileAccessNetworkClient::_thread_func() {

	client->set_nodelay(true);
	while(!quit) {

		DEBUG_PRINT("SEM WAIT - "+itos(sem->get()));
		Error err = sem->wait();
		DEBUG_TIME("sem_unlock");
		//DEBUG_PRINT("semwait returned "+itos(werr));
		DEBUG_PRINT("MUTEX LOCK "+itos(lockcount));
		DEBUG_PRINT("POPO");
		DEBUG_PRINT("PEPE");
		lock_mutex();
		DEBUG_PRINT("MUTEX PASS");

		blockrequest_mutex->lock();
		while(block_requests.size()) {
			put_32(block_requests.front()->get().id);
			put_32(FileAccessNetwork::COMMAND_READ_BLOCK);
			put_64(block_requests.front()->get().offset);
			put_32(block_requests.front()->get().size);
			block_requests.pop_front();
		}
		blockrequest_mutex->unlock();

		DEBUG_PRINT("THREAD ITER");

		DEBUG_TIME("sem_read");
		int id = get_32();

		int response = get_32();
		DEBUG_PRINT("GET RESPONSE: "+itos(response));

		FileAccessNetwork *fa=NULL;

		if (response!=FileAccessNetwork::RESPONSE_DATA) {
			ERR_FAIL_COND(!accesses.has(id));
		}

		if (accesses.has(id))
			fa=accesses[id];

		switch(response) {

			case FileAccessNetwork::RESPONSE_OPEN: {

				DEBUG_TIME("sem_open");
				int status = get_32();
				if (status!=OK) {
					fa->_respond(0,Error(status));
				} else {
					uint64_t len = get_64();
					fa->_respond(len,Error(status));
				}

				fa->sem->post();

			} break;
			case FileAccessNetwork::RESPONSE_DATA: {

				int64_t offset = get_64();
				uint32_t len = get_32();

				Vector<uint8_t> block;
				block.resize(len);
				client->get_data(block.ptr(),len);

				if (fa) //may have been queued
					fa->_set_block(offset,block);

			} break;
			case FileAccessNetwork::RESPONSE_FILE_EXISTS: {

				int status = get_32();
				fa->exists_modtime=status!=0;
				fa->sem->post();

			} break;
			case FileAccessNetwork::RESPONSE_GET_MODTIME: {

				uint64_t status = get_64();
				fa->exists_modtime=status;
				fa->sem->post();

			} break;

		}

		unlock_mutex();
	}

}

void FileAccessNetworkClient::_thread_func(void *s) {

	FileAccessNetworkClient *self =(FileAccessNetworkClient*)s;

	self->_thread_func();

}

Error FileAccessNetworkClient::connect(const String& p_host,int p_port,const String& p_password) {

	IP_Address ip;

	if (p_host.is_valid_ip_address()) {
		ip=p_host;
	} else {
		ip=IP::get_singleton()->resolve_hostname(p_host);
	}

	DEBUG_PRINT("IP: "+String(ip)+" port "+itos(p_port));
	Error err = client->connect(ip,p_port);
	ERR_FAIL_COND_V(err,err);
	while(client->get_status()==StreamPeerTCP::STATUS_CONNECTING) {
//DEBUG_PRINT("trying to connect....");
		OS::get_singleton()->delay_usec(1000);
	}

	if (client->get_status()!=StreamPeerTCP::STATUS_CONNECTED) {
		return ERR_CANT_CONNECT;
	}

	CharString cs = p_password.utf8();
	put_32(cs.length());
	client->put_data((const uint8_t*)cs.ptr(),cs.length());

	int e = get_32();

	if (e!=OK) {
		return ERR_INVALID_PARAMETER;
	}

	thread = Thread::create(_thread_func,this);

	return OK;
}

FileAccessNetworkClient *FileAccessNetworkClient::singleton=NULL;

FileAccessNetworkClient::FileAccessNetworkClient() {

	thread=NULL;
	mutex = Mutex::create();
	blockrequest_mutex = Mutex::create();
	quit=false;
	singleton=this;
	last_id=0;
	client = Ref<StreamPeerTCP>( StreamPeerTCP::create_ref() );
	sem=Semaphore::create();
	lockcount=0;
}

FileAccessNetworkClient::~FileAccessNetworkClient() {

	if (thread) {
		quit=true;
		sem->post();
		Thread::wait_to_finish(thread);
		memdelete(thread);
	}

	memdelete(blockrequest_mutex);
	memdelete(mutex);
	memdelete(sem);

}

void FileAccessNetwork::_set_block(size_t p_offset,const Vector<uint8_t>& p_block) {

	int page = p_offset/page_size;
	ERR_FAIL_INDEX(page,pages.size());
	if (page<pages.size()-1) {
		ERR_FAIL_COND(p_block.size()!=page_size);
	} else {
		ERR_FAIL_COND( (p_block.size() != (total_size%page_size)));
	}

	buffer_mutex->lock();
	pages[page].buffer=p_block;
	pages[page].queued=false;
	buffer_mutex->unlock();

	if (waiting_on_page==page) {
		waiting_on_page=-1;
		page_sem->post();
	}
}

void FileAccessNetwork::_respond(size_t p_len,Error p_status) {

	DEBUG_PRINT("GOT RESPONSE - len: "+itos(p_len)+" status: "+itos(p_status));
	response=p_status;
	if (response!=OK)
		return;
	opened=true;
	total_size=p_len;
	int pc = ((total_size-1)/page_size)+1;
	pages.resize(pc);

}

Error FileAccessNetwork::_open(const String& p_path, int p_mode_flags) {

	ERR_FAIL_COND_V(p_mode_flags!=READ,ERR_UNAVAILABLE);
	if (opened)
		close();
	FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton;
	DEBUG_PRINT("open: "+p_path);

	DEBUG_TIME("open_begin");

	nc->lock_mutex();
	nc->put_32(id);
	nc->accesses[id]=this;
	nc->put_32(COMMAND_OPEN_FILE);
	CharString cs =p_path.utf8();
	nc->put_32(cs.length());
	nc->client->put_data((const uint8_t*)cs.ptr(),cs.length());
	pos=0;
	eof_flag=false;
	last_page=-1;
	last_page_buff=NULL;

//	buffers.clear();
	nc->unlock_mutex();
	DEBUG_PRINT("OPEN POST");
	DEBUG_TIME("open_post");
	nc->sem->post(); //awaiting answer
	DEBUG_PRINT("WAIT...");
	sem->wait();
	DEBUG_TIME("open_end");
	DEBUG_PRINT("WAIT ENDED...");

	return response;
}

void FileAccessNetwork::close(){

	if (!opened)
		return;

	FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton;

	DEBUG_PRINT("CLOSE");
	nc->lock_mutex();
	nc->put_32(id);
	nc->put_32(COMMAND_CLOSE);
	pages.clear();
	opened=false;
	nc->unlock_mutex();

}
bool FileAccessNetwork::is_open() const{

	return opened;
}

void FileAccessNetwork::seek(size_t p_position){

	ERR_FAIL_COND(!opened);
	eof_flag=p_position>total_size;

	if (p_position>=total_size) {
		p_position=total_size;
	}

	pos=p_position;
}

void FileAccessNetwork::seek_end(int64_t p_position){

	seek(total_size+p_position);

}
size_t FileAccessNetwork::get_pos() const{

	ERR_FAIL_COND_V(!opened,0);
	return pos;
}
size_t FileAccessNetwork::get_len() const{

	ERR_FAIL_COND_V(!opened,0);
	return total_size;
}

bool FileAccessNetwork::eof_reached() const{

	ERR_FAIL_COND_V(!opened,false);
	return eof_flag;
}

uint8_t FileAccessNetwork::get_8() const{

	uint8_t v;
	get_buffer(&v,1);
	return v;

}

void FileAccessNetwork::_queue_page(int p_page) const {

	if (p_page>=pages.size())
		return;
	if (pages[p_page].buffer.empty() && !pages[p_page].queued) {

		FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton;

		nc->blockrequest_mutex->lock();
		FileAccessNetworkClient::BlockRequest br;
		br.id=id;
		br.offset=size_t(p_page)*page_size;
		br.size=page_size;
		nc->block_requests.push_back(br);
		pages[p_page].queued=true;
		nc->blockrequest_mutex->unlock();
		DEBUG_PRINT("QUEUE PAGE POST");
		nc->sem->post();
		DEBUG_PRINT("queued "+itos(p_page));
	}

}

int FileAccessNetwork::get_buffer(uint8_t *p_dst, int p_length) const{

	//bool eof=false;
	if (pos+p_length>total_size) {
		eof_flag=true;
	}
	if (pos+p_length>=total_size) {
		p_length=total_size-pos;
	}

//	FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton;

	uint8_t *buff=last_page_buff;

	for(int i=0;i<p_length;i++) {

		int page=pos/page_size;

		if (page!=last_page) {
			buffer_mutex->lock();
			if (pages[page].buffer.empty()) {
				//fuck

				waiting_on_page=page;
				for(int j=0;j<read_ahead;j++) {

					_queue_page(page+j);
				}
				buffer_mutex->unlock();
				DEBUG_PRINT("wait");
				page_sem->wait();
				DEBUG_PRINT("done");
			} else {

				for(int j=0;j<read_ahead;j++) {

					_queue_page(page+j);
				}
				buff=pages[page].buffer.ptr();
				//queue pages
				buffer_mutex->unlock();
			}

			buff=pages[page].buffer.ptr();
			last_page_buff=buff;
			last_page=page;
		}

		p_dst[i]=buff[pos-uint64_t(page)*page_size];
		pos++;
	}

	return p_length;
}

Error FileAccessNetwork::get_error() const{

	return pos==total_size?ERR_FILE_EOF:OK;
}

void FileAccessNetwork::store_8(uint8_t p_dest) {

	ERR_FAIL();
}

bool FileAccessNetwork::file_exists(const String& p_path){

	FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton;
	nc->lock_mutex();
	nc->put_32(id);
	nc->put_32(COMMAND_FILE_EXISTS);
	CharString cs=p_path.utf8();
	nc->put_32(cs.length());
	nc->client->put_data((const uint8_t*)cs.ptr(),cs.length());
	nc->unlock_mutex();
	DEBUG_PRINT("FILE EXISTS POST");
	nc->sem->post();
	sem->wait();

	return exists_modtime!=0;

}

uint64_t FileAccessNetwork::_get_modified_time(const String& p_file){

	FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton;
	nc->lock_mutex();
	nc->put_32(id);
	nc->put_32(COMMAND_GET_MODTIME);
	CharString cs=p_file.utf8();
	nc->put_32(cs.length());
	nc->client->put_data((const uint8_t*)cs.ptr(),cs.length());
	nc->unlock_mutex();
	DEBUG_PRINT("MODTIME POST");
	nc->sem->post();
	sem->wait();

	return exists_modtime;

}

FileAccessNetwork::FileAccessNetwork() {

	eof_flag=false;
	opened=false;
	pos=0;
	sem=Semaphore::create();
	page_sem=Semaphore::create();
	buffer_mutex=Mutex::create();
	FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton;
	nc->lock_mutex();
	id=nc->last_id++;
	nc->accesses[id]=this;
	nc->unlock_mutex();
	page_size = GLOBAL_DEF("remote_fs/page_size",65536);
	read_ahead = GLOBAL_DEF("remote_fs/page_read_ahead",4);
	max_pages = GLOBAL_DEF("remote_fs/max_pages",20);
	last_activity_val=0;
	waiting_on_page=-1;
	last_page=-1;

}

FileAccessNetwork::~FileAccessNetwork() {

	close();
	memdelete(sem);
	memdelete(page_sem);
	memdelete(buffer_mutex);

	FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton;
	nc->lock_mutex();
	id=nc->last_id++;
	nc->accesses.erase(id);
	nc->unlock_mutex();

}


text:
package com.kovaciny.linemonitorbot;

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

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.GridView;
import android.widget.Spinner;

import com.kovaciny.database.DatabaseViewer;

public class DatabaseViewerFragment extends Fragment implements OnItemSelectedListener {
	private DatabaseViewer mDbViewer;
	private GridView mTableViewer;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {

		View rootView = inflater.inflate(R.layout.database_viewer_fragment, container, false);

		mTableViewer = (GridView) rootView.findViewById(R.id.gridview_database);

		mDbViewer = new DatabaseViewer(getActivity());

		//Set up a spinner to let you choose which table to view.
		List<String> tables = mDbViewer.getTableNames();
		tables.remove("android_metadata");
		ArrayAdapter<String> tablesAdapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, tables);
		tablesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		Spinner tableNameSpinner = (Spinner) rootView.findViewById(R.id.table_name_spinner);
		tableNameSpinner.setAdapter(tablesAdapter);
		tableNameSpinner.setOnItemSelectedListener(this);

		return rootView;
	}

	@Override
	public void onItemSelected(AdapterView<?> parent, View arg1, int pos,
			long arg3) {
		String item = String.valueOf(parent.getItemAtPosition(pos));
		displayTable(item);
	}

	@Override
	public void onNothingSelected(AdapterView<?> arg0) {

	}

	protected void displayTable(String tableName) {
		List<String> results = new ArrayList<String>();

		List<String> columnNames = mDbViewer.getColumnNames(tableName);

		ArrayList<ArrayList<String>> records =
				mDbViewer.selectRecordsFromDBList(tableName, new String[]{"*"}, null, null, null, null, null);

		for (ArrayList<String> record : records) {
			Iterator<String> columnNamesItr = columnNames.iterator();
			Iterator<String> recordItr = record.iterator();
			while (columnNamesItr.hasNext()) {
				String colName = columnNamesItr.next().replace("_"," ");
				colName = Character.toUpperCase(colName.charAt(0)) + colName.substring(1);
				results.add(colName);
				String next = recordItr.next();
				if (next == null) results.add("null");
				else {
					results.add(next);
				}
			}
			results.add("--------------------");
			results.add("--------------------");
		}

		ArrayAdapter<String> testAdapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, results);
		mTableViewer.setAdapter(testAdapter);
	}
}


text:
from typing import Any, Dict, List, Optional, Generic, TypeVar, cast
from types import TracebackType

import entrypoints
from toolz import curry

PluginType = TypeVar("PluginType")

class PluginEnabler(object):
    """Context manager for enabling plugins

    This object lets you use enable() as a context manager to
    temporarily enable a given plugin::

        with plugins.enable('name'):
            do_something()  # 'name' plugin temporarily enabled
        # plugins back to original state
    """

    def __init__(self, registry: "PluginRegistry", name: str, **options):
        self.registry = registry  # type: PluginRegistry
        self.name = name  # type: str
        self.options = options  # type: Dict[str, Any]
        self.original_state = registry._get_state()  # type: Dict[str, Any]
        self.registry._enable(name, **options)

    def __enter__(self) -> "PluginEnabler":
        return self

    def __exit__(self, typ: type, value: Exception, traceback: TracebackType) -> None:
        self.registry._set_state(self.original_state)

    def __repr__(self) -> str:
        return "{}.enable({!r})".format(self.registry.__class__.__name__, self.name)

class PluginRegistry(Generic[PluginType]):
    """A registry for plugins.

    This is a plugin registry that allows plugins to be loaded/registered
    in two ways:

    1. Through an explicit call to ``.register(name, value)``.
    2. By looking for other Python packages that are installed and provide
       a setuptools entry point group.

    When you create an instance of this class, provide the name of the
    entry point group to use::

        reg = PluginRegister('my_entrypoint_group')

    """

    # this is a mapping of name to error message to allow custom error messages
    # in case an entrypoint is not found
    entrypoint_err_messages = {}  # type: Dict[str, str]

    # global settings is a key-value mapping of settings that are stored globally
    # in the registry rather than passed to the plugins
    _global_settings = {}  # type: Dict[str, Any]

    def __init__(self, entry_point_group: str = "", plugin_type: type = object):
        """Create a PluginRegistry for a named entry point group.

        Parameters
        ==========
        entry_point_group: str
            The name of the entry point group.
        plugin_type: object
            A type that will optionally be used for runtime type checking of
            loaded plugins using isinstance.
        """
        self.entry_point_group = entry_point_group  # type: str
        self.plugin_type = plugin_type  # type: Optional[type]
        self._active = None  # type: Optional[PluginType]
        self._active_name = ""  # type: str
        self._plugins = {}  # type: Dict[str, PluginType]
        self._options = {}  # type: Dict[str, Any]
        self._global_settings = self.__class__._global_settings.copy()  # type: dict

    def register(self, name: str, value: Optional[PluginType]) -> Optional[PluginType]:
        """Register a plugin by name and value.

        This method is used for explicit registration of a plugin and shouldn't be
        used to manage entry point managed plugins, which are auto-loaded.

        Parameters
        ==========
        name: str
            The name of the plugin.
        value: PluginType or None
            The actual plugin object to register or None to unregister that plugin.

        Returns
        =======
        plugin: PluginType or None
            The plugin that was registered or unregistered.
        """
        if value is None:
            return self._plugins.pop(name, None)
        else:
            assert isinstance(value, self.plugin_type)
            self._plugins[name] = value
            return value

    def names(self) -> List[str]:
        """List the names of the registered and entry points plugins."""
        exts = list(self._plugins.keys())
        more_exts = [
            ep.name for ep in entrypoints.get_group_all(self.entry_point_group)
        ]
        exts.extend(more_exts)
        return sorted(set(exts))

    def _get_state(self) -> Dict[str, Any]:
        """Return a dictionary representing the current state of the registry"""
        return {
            "_active": self._active,
            "_active_name": self._active_name,
            "_plugins": self._plugins.copy(),
            "_options": self._options.copy(),
            "_global_settings": self._global_settings.copy(),
        }

    def _set_state(self, state: Dict[str, Any]) -> None:
        """Reset the state of the registry"""
        assert set(state.keys()) == {
            "_active",
            "_active_name",
            "_plugins",
            "_options",
            "_global_settings",
        }
        for key, val in state.items():
            setattr(self, key, val)

    def _enable(self, name: str, **options) -> None:
        if name not in self._plugins:
            try:
                ep = entrypoints.get_single(self.entry_point_group, name)
            except entrypoints.NoSuchEntryPoint:
                if name in self.entrypoint_err_messages:
                    raise ValueError(self.entrypoint_err_messages[name])
                else:
                    raise
            value = cast(PluginType, ep.load())
            self.register(name, value)
        self._active_name = name
        self._active = self._plugins[name]
        for key in set(options.keys()) & set(self._global_settings.keys()):
            self._global_settings[key] = options.pop(key)
        self._options = options

    def enable(self, name: Optional[str] = None, **options) -> PluginEnabler:
        """Enable a plugin by name.

        This can be either called directly, or used as a context manager.

        Parameters
        ----------
        name : string (optional)
            The name of the plugin to enable. If not specified, then use the
            current active name.
        **options :
            Any additional parameters will be passed to the plugin as keyword
            arguments

        Returns
        -------
        PluginEnabler:
            An object that allows enable() to be used as a context manager
        """
        if name is None:
            name = self.active
        return PluginEnabler(self, name, **options)

    @property
    def active(self) -> str:
        """Return the name of the currently active plugin"""
        return self._active_name

    @property
    def options(self) -> Dict[str, Any]:
        """Return the current options dictionary"""
        return self._options

    def get(self) -> Optional[PluginType]:
        """Return the currently active plugin."""
        if self._options:
            return curry(self._active, **self._options)
        else:
            return self._active

    def __repr__(self) -> str:
        return "{}(active={!r}, registered={!r})" "".format(
            self.__class__.__name__, self._active_name, list(self.names())
        )


text: export { method as file } from 'ack-path/js/file';


text:
<!DOCTYPE html>

<head>
	<meta charset="UTF-8">
	<title></title>
	<meta name="author" content="">
	<meta name="viewport" content="width=device-width, initial-scale=1">
</head>

<body>

</body>

</html>


text:
package org.olat.core.extensions.helpers;

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

import org.olat.core.extensions.ExtensionElement;

/**
 * Description:

 * Initial Date: 23.09.2005

 *
 * @author Felix
 */
public class ExtensionElements {
	private Map elems = new HashMap();

	public ExtensionElements() {
		//
	}

	public void putExtensionElement(String targetExtensionPoint, ExtensionElement element) {
		elems.put(targetExtensionPoint, element);
	}

	public ExtensionElement getExtensionElement(String targetExtensionPoint) {
		return (ExtensionElement) elems.get(targetExtensionPoint);
	}
}


text:
{{$index + 1}}

    <ui-select append-to-body="true" ng-model="item.assign" on-select="updateCb(item, 'assign')" >
        <ui-select-match>

            {{$select.selected.name}}
        </ui-select-match>
        <ui-select-choices ng-init="str=user.job?'job':'name'" repeat="user._id as user in people | filter: { {{str}} : $select.search } | filterByFrequentUsers: me">

            {{user.job?user.job:user.name}}
        </ui-select-choices>
    </ui-select>

    <ui-select ng-model="item.status" on-select="updateCb(item)" >
        <ui-select-match>

            {{$select.selected | i18next }}
        </ui-select-match>
        <ui-select-choices class="selectStatus" repeat="status as status in statuses | filter: $select.search">

            {{status | i18next}}
        </ui-select-choices>
    </ui-select>

    <input ng-click="open(item)" ui-date="dueOptions(item)" ng-model="item.due" placeholder="{{ 'deadline' | i18next }}" ng-class='{"oldDate":checkDate(item)}'>

        {{'This Deadline is in the past!' | i18next }}

x


text:
define(function(require) {
  var Sunstone = require('sunstone');
  var Notifier = require('utils/notifier');
  var Locale = require('utils/locale');
  var DataTable = require('./datatable');
  var OpenNebulaNetwork = require('opennebula/network');
  var OpenNebulaCluster = require('opennebula/cluster');
  var OpenNebulaAction = require('opennebula/action');

  var TAB_ID = require('./tabId');
  var CREATE_DIALOG_ID = require('./form-panels/create/formPanelId');
  var ADD_AR_DIALOG_ID = require('./dialogs/add-ar/dialogId');
  var UPDATE_AR_DIALOG_ID = require('./dialogs/update-ar/dialogId');
  var RESERVE_DIALOG_ID = require('./dialogs/reserve/dialogId');
  var IMPORT_DIALOG_ID = require('./form-panels/import/formPanelId');

  var _actions = {
    "Network.create" : {
      type: "create",
      call: OpenNebulaNetwork.create,
      callback: function(request, response) {
        Sunstone.resetFormPanel(TAB_ID, CREATE_DIALOG_ID);
        Sunstone.hideFormPanel(TAB_ID);
        Sunstone.getDataTable(TAB_ID).addElement(request, response);
      },
      error: function(request, response) {
        Sunstone.hideFormPanelLoading(TAB_ID);
        Notifier.onError(request, response);
      },
      notify: true
    },

    "Network.create_dialog" : {
      type: "custom",
      call: function() {
        Sunstone.showFormPanel(TAB_ID, CREATE_DIALOG_ID, "create");
      }
    },

    "Network.import_dialog" : {
      type: "custom",
      call: function() {
        Sunstone.showFormPanel(TAB_ID, IMPORT_DIALOG_ID, "import");
      }
    },

    "Network.list" : {
      type: "list",
      call: OpenNebulaNetwork.list,
      callback: function(request, response) {
        Sunstone.getDataTable(TAB_ID).updateView(request, response);
      },
      error: Notifier.onError
    },

    "Network.show" : {
      type: "single",
      call: OpenNebulaNetwork.show,
      callback: function(request, response) {
        Sunstone.getDataTable(TAB_ID).updateElement(request, response);
        if (Sunstone.rightInfoVisible($('#' + TAB_ID))) {
          Sunstone.insertPanels(TAB_ID, response);
        }
      },
      error: Notifier.onError
    },

    "Network.refresh" : {
      type: "custom",
      call: function() {
        var tab = $('#' + TAB_ID);
        if (Sunstone.rightInfoVisible(tab)) {
          Sunstone.runAction("Network.show", Sunstone.rightInfoResourceId(tab));
        } else {
          Sunstone.getDataTable(TAB_ID).waitingNodes();
          Sunstone.runAction("Network.list", {force: true});
        }
      },
      error: Notifier.onError
    },

    "Network.delete" : {
      type: "multiple",
      call : OpenNebulaNetwork.del,
      callback : function(request, response) {
        Sunstone.getDataTable(TAB_ID).deleteElement(request, response);
      },
      elements: function() {
        return Sunstone.getDataTable(TAB_ID).elements();
      },
      error : Notifier.onError,
      notify:true
    },

    "Network.hold" : {
      type: "single",
      call: OpenNebulaNetwork.hold,
      callback: function(req) {
        Sunstone.runAction("Network.show", req.request.data[0][0]);
      },
      error: Notifier.onError
    },

    "Network.release" : {
      type: "single",
      call: OpenNebulaNetwork.release,
      callback: function(req) {
        Sunstone.runAction("Network.show", req.request.data[0][0]);
      },
      error: Notifier.onError
    },

    "Network.add_ar" : {
      type: "single",
      call: OpenNebulaNetwork.add_ar,
      callback: function(req) {
        // Reset the wizard
        Sunstone.getDialog(ADD_AR_DIALOG_ID).hide();
        Sunstone.getDialog(ADD_AR_DIALOG_ID).reset();

        Sunstone.runAction("Network.show",req.request.data[0][0]);
      },
      error: Notifier.onError
    },

    "Network.rm_ar" : {
      type: "single",
      call: OpenNebulaNetwork.rm_ar,
      callback: function(req) {
        OpenNebulaAction.clear_cache("VNET");
        Sunstone.runAction("Network.show",req.request.data[0][0]);
      },
      error: Notifier.onError
    },

    "Network.update_ar" : {
      type: "single",
      call: OpenNebulaNetwork.update_ar,
      callback: function(req) {
        // Reset the wizard
        Sunstone.getDialog(UPDATE_AR_DIALOG_ID).hide();
        Sunstone.getDialog(UPDATE_AR_DIALOG_ID).reset();

        Sunstone.runAction("Network.show",req.request.data[0][0]);
      },
      error: Notifier.onError
    },

    "Network.reserve_dialog" : {
      type: "custom",
      call: function() {
        var selected_nodes = Sunstone.getDataTable(TAB_ID).elements();
        if (selected_nodes.length != 1) {
          Notifier.notifyMessage("Please select one (and just one) Virtual Network.");
          return false;
        }

        var resource_id = "" + selected_nodes[0];

        Sunstone.getDialog(RESERVE_DIALOG_ID).setParams({vnetId: resource_id});
        Sunstone.getDialog(RESERVE_DIALOG_ID).reset();
        Sunstone.getDialog(RESERVE_DIALOG_ID).show();
      }
    },

    "Network.reserve" : {
      type: "single",
      call: OpenNebulaNetwork.reserve,
      callback: function(req) {
        // Reset the wizard
        Sunstone.getDialog(RESERVE_DIALOG_ID).hide();
        Sunstone.getDialog(RESERVE_DIALOG_ID).reset();

        OpenNebulaAction.clear_cache("VNET");
        Sunstone.runAction("Network.show",req.request.data[0][0]);
      },
      error: Notifier.onError
    },

    "Network.chown" : {
      type: "multiple",
      call: OpenNebulaNetwork.chown,
      callback:  function (req) {
        Sunstone.runAction("Network.show", req.request.data[0]);
      },
      elements: function() {
        return Sunstone.getDataTable(TAB_ID).elements();
      },
      error: Notifier.onError,
      notify: true
    },

    "Network.chgrp" : {
      type: "multiple",
      call: OpenNebulaNetwork.chgrp,
      callback:  function (req) {
        Sunstone.runAction("Network.show", req.request.data[0]);
      },
      elements: function() {
        return Sunstone.getDataTable(TAB_ID).elements();
      },
      error: Notifier.onError,
      notify: true
    },

    "Network.chmod" : {
      type: "single",
      call: OpenNebulaNetwork.chmod,
      callback:  function (req) {
        Sunstone.runAction("Network.show", req.request.data[0]);
      },
      elements: function() {
        return Sunstone.getDataTable(TAB_ID).elements();
      },
      error: Notifier.onError,
      notify: true
    },

    "Network.rename" : {
      type: "single",
      call: OpenNebulaNetwork.rename,
      callback: function(request) {
        Sunstone.runAction('Network.show', request.request.data[0][0]);
      },
      error: Notifier.onError,
      notify: true
    },

    "Network.update_dialog" : {
      type: "custom",
      call: function() {
        var selected_nodes = Sunstone.getDataTable(TAB_ID).elements();
        if (selected_nodes.length != 1) {
          Notifier.notifyMessage("Please select one (and just one) Virtual Network to update.");
          return false;
        }

        var resource_id = "" + selected_nodes[0];
        Sunstone.runAction("Network.show_to_update", resource_id);
      }
    },

    "Network.show_to_update" : {
      type: "single",
      call: OpenNebulaNetwork.show,
      callback: function(request, response) {
        Sunstone.showFormPanel(TAB_ID, CREATE_DIALOG_ID, "update",
          function(formPanelInstance, context) {
            formPanelInstance.fill(context, response.VNET)
          });
      },
      error: Notifier.onError
    },

    "Network.update" : {
      type: "single",
      call: OpenNebulaNetwork.update,
      callback: function(request, response) {
        Sunstone.hideFormPanel(TAB_ID);
        Notifier.notifyMessage(Locale.tr("Virtual Network updated correctly"));
      },
      error: function(request, response) {
        Sunstone.hideFormPanelLoading(TAB_ID);
        Notifier.onError(request, response);
      }
    },

    "Network.update_template" : {
      type: "single",
      call: OpenNebulaNetwork.update,
      callback: function(request) {
        Sunstone.runAction('Network.show', request.request.data[0][0]);
      },
      error: Notifier.onError
    },

    "Network.addtocluster" : {
      type: "multiple",
      call: function(params){
        var cluster = params.data.extra_param;
        var vnet = params.data.id;

        if (cluster == -1){
          OpenNebulaNetwork.show({
            data : {
              id: vnet
            },
            success: function (request, vn){
              var vn_info = vn.VNET;

              var current_cluster = vn_info.CLUSTER_ID;

              if(current_cluster != -1){
                OpenNebulaCluster.delvnet({
                  data: {
                    id: current_cluster,
                    extra_param: vnet
                  },
                  success: function(){
                    OpenNebulaAction.clear_cache("VNET");
                    Sunstone.runAction('Network.show',vnet);
                  },
                  error: Notifier.onError
                });
              } else {
                OpenNebulaAction.clear_cache("VNET");
                Sunstone.runAction('Network.show',vnet);
              }
            },
            error: Notifier.onError
          });
        } else {
          OpenNebulaCluster.addvnet({
            data: {
              id: cluster,
              extra_param: vnet
            },
            success: function(){
              OpenNebulaAction.clear_cache("VNET");
              Sunstone.runAction('Network.show',vnet);
            },
            error: Notifier.onError
          });
        }
      },
      elements: function() {
        return Sunstone.getDataTable(TAB_ID).elements();
      }
    }
  };

  return _actions;
});


text:
using System;
using Firestorm.Data;
using Firestorm.Host;

namespace Firestorm.Fluent
{
    public static class FluentServicesExtensions
    {
        /// <summary>
        /// Configures Firestorm Fluent API using the given context type.
        /// </summary>
        public static IServicesBuilder AddFluent<TApiContext>(this IServicesBuilder builder)
            where TApiContext : ApiContext, new()
        {
            var context = new TApiContext();
            return builder.AddFluent(context);
        }

        /// <summary>
        /// Configures Firestorm Fluent API using a <see cref="buildAction"/> delegate.
        /// </summary>
        public static IServicesBuilder AddFluent(this IServicesBuilder builder, Action<IApiBuilder> buildAction)
        {
            var context = new DelegateApiContext(buildAction);
            return builder.AddFluent(context);
        }

        /// <summary>
        /// Configures Firestorm Fluent API using the registered service for <see cref="IApiContext"/>.
        /// </summary>
        public static IServicesBuilder AddFluent(this IServicesBuilder builder)
        {
            builder.AddStartResourceFactory(sp => new FluentStartResourceFactory
            {
                ApiContext = sp.GetService<IApiContext>(),
                DataSource = sp.GetService<IDataSource>()
            });

            return builder;
        }

        /// <summary>
        /// Configures Firestorm Fluent API by automatically finding the root item types and automatically configuring them.
        /// </summary>
        public static IServicesBuilder AddFluent(this IServicesBuilder builder, AutoConfiguration configuration)
        {
            builder.AddDataSourceTypeFinder();

            builder.AddStartResourceFactory(sp => new FluentStartResourceFactory
            {
                ApiContext = new AutomaticApiContext(sp.GetService<IItemTypeFinder>().FindItemTypes(), configuration),
                DataSource = sp.GetService<IDataSource>()
            });

            return builder;
        }

        /// <summary>
        /// Configures Firestorm Fluent API using a <see cref="apiContext"/>.
        /// </summary>
        public static IServicesBuilder AddFluent(this IServicesBuilder builder, IApiContext apiContext)
        {
            builder.AddStartResourceFactory(sp => new FluentStartResourceFactory
            {
                ApiContext = apiContext,
                DataSource = sp.GetService<IDataSource>()
            });

            return builder;
        }
    }
}


text:
<?php
session_start();
include(__DIR__."/nano.php");
nano\init("webservice");

header('Content-type: text/html; charset=utf-8');

$data="";
$schema="";

$return=(object) array();
$return->start=microtime();

// prendre les données dans les paramètres
//if(isset($_GET['data'])) $data= $_GET['data'];
//if(isset($_GET['schema'])) $schema= $_GET['schema'];
if(isset($_POST['data'])) $data= $_POST['data'];
if(isset($_POST['schema'])) $schema= $_POST['schema'];

try
{
  $data=JSON_decode($data);
}
catch(Expression $e)
{
  die(return_error("Error in json","-1"));
}

//print_r($data);

$safe_data=(object) array();

$safe_data->_id=$data[0]->_id;
$safe_data->name=$data[0]->name;
$safe_data->adresse=$data[0]->adresse;
$safe_data->zip=$data[0]->zip;
$safe_data->city=$data[0]->city;
$safe_data->phone=$data[0]->phone;
$safe_data->fax=$data[0]->fax;
$safe_data->email=$data[0]->email;
$safe_data->password=$data[0]->password;

//print_r($safe_data);

$save=new nano\data(true);
$save->connect($schemas->{$schema});
$save->create($schemas->{$schema});

$return->fin=microtime();
$return->code="1";
$return->message="";
$return->status="SUCCESS";
$return->data=$save->upsert($schemas->{$schema},[$safe_data]); //dataset

echo JSON_encode($return, JSON_NUMERIC_CHECK);

?>


text:
package com.intellij.execution.testframework.sm.runner.states;

/**
 * @author Roman Chernyatchik
 */
public class TestErrorState extends TestFailedState {
  public TestErrorState(@javax.annotation.Nullable final String localizedMessage,
                        @javax.annotation.Nullable final String stackTrace) {
    super(localizedMessage, stackTrace);
  }

  public Magnitude getMagnitude() {
    return Magnitude.ERROR_INDEX;
  }

  @Override
  public String toString() {
    //noinspection HardCodedStringLiteral
    return "TEST ERROR";
  }
}


text:
package com.adaptris.core;

import java.util.ArrayList;
import java.util.List;

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

import com.adaptris.core.util.LifecycleHelper;
import com.thoughtworks.xstream.annotations.XStreamAlias;

/**
 * Default strategy for starting channels.
 * <p>
 * This strategy is functionally equivalent to the way in which channel operations were handled in 2.4.x and blocks until all the
 * channel operations are complete.
 * </p>
 *
 * @config default-channel-lifecycle-strategy
 *
 * @author lchan
 * @author $Author: lchan $
 */
@XStreamAlias("default-channel-lifecycle-strategy")
public class DefaultChannelLifecycleStrategy implements ChannelLifecycleStrategy {
  protected transient Logger log = LoggerFactory.getLogger(this.getClass().getName());

  private static enum ChannelAction {
    INIT {
      @Override
      void invoke(Channel c) throws CoreException {
        LifecycleHelper.init(c);
      }
    },
    START {
      @Override
      void invoke(Channel c) throws CoreException {
        LifecycleHelper.start(c);
      }
    },
    STOP {
      @Override
      void invoke(Channel c) throws CoreException {
        LifecycleHelper.stop(c);
      }
    },
    CLOSE {
      @Override
      void invoke(Channel c) throws CoreException {
        LifecycleHelper.close(c);
      }
    };
    abstract void invoke(Channel c) throws CoreException;
  }

  public DefaultChannelLifecycleStrategy() {

  }

  /**
   * @see ChannelLifecycleStrategy#start(java.util.List)
   */
  public void start(List<Channel> channels) throws CoreException {
    List<Channel> eligible = new ArrayList<Channel>();
    for (Channel c : channels) {
      if (c.shouldStart()) {
        eligible.add(c);
      }
    }
    action(eligible, ChannelAction.START);
  }

  /**
   * @see ChannelLifecycleStrategy#init(java.util.List)
   */
  public void init(List<Channel> channels) throws CoreException {
    List<Channel> eligible = new ArrayList<Channel>();
    for (Channel c : channels) {
      if (c.shouldStart()) {
        eligible.add(c);
      }
    }
    action(eligible, ChannelAction.INIT);

  }

  /**
   *
   * @see ChannelLifecycleStrategy#stop(java.util.List)
   */
  public void stop(List<Channel> channels) {
    actionQuietly(channels, ChannelAction.STOP);
  }

  /**
   *
   * @see ChannelLifecycleStrategy#close(java.util.List)
   */
  public void close(List<Channel> channels) {
    actionQuietly(channels, ChannelAction.CLOSE);
  }

  private void action(List<Channel> channels, ChannelAction op) throws CoreException {
    String originalName = Thread.currentThread().getName();
    try {
      for (int i = 0; i < channels.size(); i++) {
        Channel c = channels.get(i);
        String threadName = originalName + ":" + (c.hasUniqueId() ? c.getUniqueId() : "Channel(" + i + ")") + "." + op.name();
        Thread.currentThread().setName(threadName);
        op.invoke(c);
      }
    }
    finally {
      Thread.currentThread().setName(originalName);
    }
  }

  private void actionQuietly(List<Channel> channels, ChannelAction op) {
    try {
      action(channels, op);
    }
    catch (CoreException ignored) {
    }
  }
}