text:
/**
 * @file clock.h
 * @author Joe Wingbermuehle
 * @date 2005-2006
 *
 * @brief Clock tray component.
 *
 */

#ifndef CLOCK_H
#define CLOCK_H

struct TrayComponentType;

/*@{*/
void InitializeClock(void);
void StartupClock(void);
#define ShutdownClock() (void)(0)
void DestroyClock(void);
/*@}*/

/** Create a clock component for the tray.
 * @param format The format of the clock.
 * @param zone The timezone of the clock (NULL for local time).
 * @param width The width of the clock (0 for auto).
 * @param height The height of the clock (0 for auto).
 */
struct TrayComponentType *CreateClock(const char *format,
                                      const char *zone,
                                      int width, int height);

/** Add an action to a clock.
 * @param cp The clock.
 * @param action The action to take.
 * @param mask The mouse button mask.
 */
void AddClockAction(struct TrayComponentType *cp,
                    const char *action,
                    int mask);

#endif /* CLOCK_H */

redpajama_set_name: RedPajamaGithub


text:
<?php

class DeleteUnverifiedRecipientsTask extends DailyTask{
	static $trunk_length = 50;

	public function process() {
		$start = 0;
		$total = 0;
		while($deleted = $this->delete_trunk($start)) {
			$total = $total + $deleted;
			$start = $start + self::$trunk_length;
			if($deleted < self::$trunk_length) break;
		}
		echo "totally ".$total." recipients deleted";
	}

	public function delete_trunk($offset) {
		set_time_limit(18000);
		ini_set('memory_limit','512M');

		$days =  SubscriptionPage::get_days_verification_link_alive();

		$objects = DataList::create('Recipient')
			->where("\"Recipient\".\"Verified\" = 0 AND \"Recipient\".\"Created\" < NOW() - INTERVAL $days DAY")
			->limit(self::$trunk_length, $offset);

		$count = $objects->count();
		if($count) {
			foreach($objects as $object) {
				if($object->canDelete()) {
					$object->delete();
				}
			}
		}
		return $count;
	}
}


text:
#include <iostream>
#include <sstream>
#include <SFML/OpenGL.hpp>

#include "GameState.h"
#include "PhysicalObject.h"
#include "GameController.h"
#include "Player.h"

using namespace std;

Camera::Camera():posX(0), posY(0), widthUnits(GAMESIZE), targetX(0), targetY(0), stepSize(10) {}

void Camera::update(double dt){
	float difX = targetX - posX;
	float difY = targetY - posY;
	float dist = sqrtf(difX*difX+difY*difY);
	float angle = difX;
	angle /= dist;
	angle = acosf(angle);
	if(difY < 0.0f){
		angle *= -1;
	}
	if(dist >= stepSize*dt){
		posX += cosf(angle)*stepSize*dist*0.5*dt;
		posY += sinf(angle)*stepSize*dist*0.5*dt;
	}else{
		posX = targetX;
		posY = targetY;
	}
}

GameState::GameState(sf::RenderWindow &window, gjAPI* gjApi) :
	m_world(b2Vec2(0.0f, -100.0f)),
	m_window(window),
	m_accumulator(0.0),
	m_currentTime(0.0),
	m_totalTime(0.0),
	m_lastIntTime(0),
	m_enemiesKilled(0),
	m_nextId(1),
	m_paused(true),
	m_finished(false),
	m_score(0),
	m_nextState(1),
	m_slowTime(1),
	m_muteMusic(false),
	m_gjApi(gjApi)
{
	m_world.SetGravity(b2Vec2(0.0f,0.0f)); // No gravity
	// Camera and graphics initialitzation
	float wHalf = camera.widthUnits/2.0f;
	float hHalf = camera.widthUnits*(float(m_window.getSize().y)/m_window.getSize().x)/2.0f;
	glOrtho(-wHalf, wHalf,
			-hHalf, hHalf, -100, 100);
	glEnable(GL_BLEND);
	glEnable(GL_TEXTURE_2D);
	glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glClearColor(0.1f, 0.3f, 0.3f, 1.0f);

	m_world.SetContactListener(this);

	// Load all the textures we're going to use
	m_textureManager.loadTexture("Textures/Player.png");
	m_textureManager.loadTexture("Textures/PlayerShield.png");
	m_textureManager.loadTexture("Textures/Enemy1.png");
	m_textureManager.loadTexture("Textures/Enemy2.png");
	m_textureManager.loadTexture("Textures/Boom.png");
	m_textureManager.loadTexture("Textures/Points.png");
	m_textureManager.loadTexture("Textures/Shield.png");
	m_textureManager.loadTexture("Textures/Background.png");
	m_textureManager.loadTexture("Textures/Light.png");
	m_textureManager.loadTexture("Textures/Particle.png");
	m_textureManager.loadTexture("Textures/Mine.png");
	m_textureManager.loadTexture("Textures/Fireball.png");
	m_textureManager.loadTexture("Textures/SlowTime.png");
	m_textureManager.loadTexture("Textures/Music.png");
	m_textureManager.loadTexture("Textures/NoMusic.png");
	m_textureManager.loadTexture("Textures/Sound.png");
	m_textureManager.loadTexture("Textures/NoSound.png");
	m_textureManager.loadTexture("Textures/GameJolt.png");

	// Initialize text elements
	m_scoreText.setString("0");
	m_scoreText.setCharacterSize(20);
	m_scoreText.setColor(sf::Color::Green);
	m_scoreText.setPosition(0,0);

	m_menuText.setString("Back to menu");
	m_menuText.setCharacterSize(15);
	m_menuText.setColor(sf::Color::Green);
	m_menuText.setPosition(375,500);

	m_playAgainText.setString("Click the player to play again");
	m_playAgainText.setCharacterSize(17);
	m_playAgainText.setColor(sf::Color::Green);
	m_playAgainText.setPosition(40,400);

	m_scoreEndText.setString("");
	m_scoreEndText.setCharacterSize(22);
	m_scoreEndText.setColor(sf::Color::Green);
	m_scoreEndText.setPosition(50, 100);

	m_survivedText.setString("");
	m_survivedText.setCharacterSize(18);
	m_survivedText.setColor(sf::Color::Green);
	m_survivedText.setPosition(60, 140);

	m_killedText.setString("");
	m_killedText.setCharacterSize(18);
	m_killedText.setColor(sf::Color::Green);
	m_killedText.setPosition(60, 175);

	m_scoreSentText.setCharacterSize(14);
	m_scoreSentText.setPosition(60, 220);
	m_scoreSentText.setColor(sf::Color::Green);

	// Load music and sounds
	m_music.openFromFile("Sounds/Dodge_Level_Music.ogg");
	m_music.setLoop(true);
	m_music.setVolume(100);
	m_endMusic.openFromFile("Sounds/End_Screen_Music.ogg");
	m_endMusic.setLoop(true);
	m_endMusic.setVolume(100);
	m_soundManager.loadSound("Sounds/Explosion1.ogg");
	m_soundManager.loadSound("Sounds/Explosion2.ogg");
	m_soundManager.loadSound("Sounds/Explosion3.ogg");
	m_soundManager.loadSound("Sounds/Points.ogg");
	m_soundManager.loadSound("Sounds/Shield.ogg");
	m_soundManager.loadSound("Sounds/Slow_Time.ogg");
}

GameState::~GameState()
{
}

void GameState::addObject(GameObject* object){
	if(object->hasProperty("physical")){
		PhysicalObject *temp = static_cast<PhysicalObject*>(object);
		b2Body *body = m_world.CreateBody(temp->getBodyDef());
		for(int i = 0; i < temp->getFixtureDefCount(); i++){
			b2FixtureDef *def = temp->getFixtureDef(i);
			body->CreateFixture(def);
		}
		body->SetUserData(temp);
		temp->setBody(body);
	}
	object->setId(m_nextId);
	m_nextId++;
	m_objects.push_back(object);
}

void GameState::setPlayer(Player *player){
	addObject((GameObject*)player);
	m_player = player;
}

void GameState::update(double dt){
	if ( dt > 0.25 )
		dt = 0.25;	  // note: max frame time to avoid spiral of death
	m_slowTime += dt/5;
	if(m_slowTime>1)
		m_slowTime = 1;

	list<GameObject*>::iterator it = m_objects.begin();
	if(!m_player->isAlive()){ // Player is dead, reset game
		setFinished(true);
		while(it!=m_objects.end()){ // Delete all the objects
			GameObject *object = (*it);
			if(object->hasProperty("physical")){
				PhysicalObject *physObject = static_cast<PhysicalObject*>(object);
				m_world.DestroyBody(physObject->getBody());
			}
			delete object;
			it = m_objects.erase(it);
		}
		// Set final score and game stats text
		stringstream ss;
		ss << "YOUR FINAL SCORE IS: " << m_score;
		m_scoreEndText.setString(ss.str());
		stringstream ss1;
		ss1 << "Survived for " << int(m_totalTime) << " seconds";
		m_survivedText.setString(ss1.str());
		stringstream ss2;
		ss2 << "Killed " << m_enemiesKilled << " enemies";
		m_killedText.setString(ss2.str());
		m_gameController->resetGame();
		// Send score using the GameJolt API
		stringstream scorestr;
		scorestr << m_score << " Points";
		if(m_logged){
			m_gjApi->InterScore()->GetPrimaryTable()->AddScoreCall(scorestr.str(),m_score,"","");
		}else{ // Send score as guest
			m_gjApi->InterScore()->GetPrimaryTable()->AddScoreCall(scorestr.str(),m_score,"",m_username);
		}
		return;
	}

	int oldscore = m_score;
	if(!m_paused){
		m_gameController->update(dt);
		m_totalTime += dt;
		if(m_lastIntTime == int(m_totalTime)-1){
			m_lastIntTime++;
			m_score += m_lastIntTime;
		}
	}
	while(it!=m_objects.end()){
		GameObject *object = (*it);
		if(object->isFirstUpdate()){
			object->firstUpdate();
			object->setFirstUpdate(false);
		}
		object->update(dt);

		if(!object->isAlive()){ // If a object has been killed we need to take the needed actions and then delete it
			if(object->hasProperty("enemy")){
				if(!object->hasProperty("fireball")){
					m_enemiesKilled++;
					m_score += m_gameController->getInternalLevel();
					b2Vec2 pos = object->getPosition();
					m_gameController->generateParticles(pos);
				}
				if(object->hasProperty("mine")){
					b2Vec2 pos = object->getPosition();
					m_gameController->explodeMine(pos);
				}
			}
			if(object->hasProperty("physical")){
				PhysicalObject *physObject = static_cast<PhysicalObject*>(object);
				m_world.DestroyBody(physObject->getBody());
			}
			delete object;
			it = m_objects.erase(it);
		}else{
			++it;
		}
	}
	if(m_score != oldscore){ // Only update the score text if it has changed
		stringstream ss;
		ss << m_score;
		m_scoreText.setString(ss.str());
	}

	camera.update(dt);

	m_accumulator += dt;

    while ( m_accumulator >= TIMESTEP ){
        m_world.Step(TIMESTEP, 13, 8);
        m_accumulator -= TIMESTEP;
    }
}

void GameState::draw(){
	// Draw the scene
	glPushMatrix();
	{
		glTranslatef(-camera.posX, -camera.posY, 0);
		list<GameObject*>::iterator it;
		for(it = m_objects.begin(); it!=m_objects.end(); ++it){
			GameObject *object = (*it);
			object->draw();
			glColor3f(1.0f, 1.0f, 1.0f);
		}
	}
	glPopMatrix();
	// Draw text
	m_window.pushGLStates();
	m_window.draw(m_scoreText);
	if(m_finished){
		m_window.draw(m_menuText);
		m_window.draw(m_playAgainText);
		m_window.draw(m_scoreEndText);
		m_window.draw(m_survivedText);
		m_window.draw(m_killedText);
		m_window.draw(m_scoreSentText);
	}
	m_window.popGLStates();
}

void GameState::BeginContact(b2Contact* contact){
	if(contact->IsEnabled()){
		PhysicalObject *objectA = (PhysicalObject*)contact->GetFixtureA()->GetBody()->GetUserData();
		objectA->beginContact(contact);
		PhysicalObject *objectB = (PhysicalObject*)contact->GetFixtureB()->GetBody()->GetUserData();
		objectB->beginContact(contact);
	}
}

void GameState::EndContact(b2Contact* contact){
	if(contact->IsEnabled()){
		PhysicalObject *objectA = (PhysicalObject*)contact->GetFixtureA()->GetBody()->GetUserData();
		objectA->endContact(contact);
		PhysicalObject *objectB = (PhysicalObject*)contact->GetFixtureB()->GetBody()->GetUserData();
		objectB->endContact(contact);
	}
}

void GameState::PreSolve(b2Contact* contact, const b2Manifold* oldManifold){
	contact->SetEnabled(false);
	PhysicalObject *objectA = (PhysicalObject*)contact->GetFixtureA()->GetBody()->GetUserData();
	objectA->PreSolve(contact, oldManifold);
	PhysicalObject *objectB = (PhysicalObject*)contact->GetFixtureB()->GetBody()->GetUserData();
	objectB->PreSolve(contact, oldManifold);
}

void GameState::PostSolve(b2Contact* contact, const b2ContactImpulse* impulse){
	if(contact->IsEnabled()){
		PhysicalObject *objectA = (PhysicalObject*)contact->GetFixtureA()->GetBody()->GetUserData();
		objectA->PostSolve(contact, impulse);
		PhysicalObject *objectB = (PhysicalObject*)contact->GetFixtureB()->GetBody()->GetUserData();
		objectB->PostSolve(contact, impulse);
	}
}

void GameState::togglePause(){
	if(m_paused){
		setPaused(false);
	}else{
		setPaused(true);
	}
}

void GameState::setPaused(bool paused){
	m_paused = paused;
	if(m_paused){
		m_window.setMouseCursorVisible(true);
		list<GameObject*>::iterator it = m_objects.begin();
		while(it!=m_objects.end()){
			GameObject *object = (*it);
			object->pause();
			++it;
		}
		m_music.pause();
	}else{
		m_window.setMouseCursorVisible(false); // Cursor is hidden while playing
		list<GameObject*>::iterator it = m_objects.begin();
		while(it!=m_objects.end()){
			GameObject *object = (*it);
			object->unpause();
			++it;
		}
		m_endMusic.stop();
		m_music.play();
	}
	if(m_gameController)
		m_gameController->setPaused(m_paused);
}

void GameState::setGameController(GameController *gameController){
	m_gameController = gameController;
}

sf::Vector2i GameState::getMousePosition(){
	return sf::Mouse::getPosition(m_window);
}

void GameState::setFinished(bool finished){
	if(finished == false){ // Game restarting, reset score and counters
		m_totalTime = 0.0;
		m_lastIntTime = 0;
		m_enemiesKilled = 0;
		m_score = 0;
		stringstream ss;
		ss << m_score;
		m_scoreText.setString(ss.str());
		m_nextState = 1;
	}
	if(finished == true){
		m_music.stop();
		m_endMusic.play();

	}
	m_finished = finished;
}

int GameState::checkEvents(){
	sf::Event event;
    while (m_window.pollEvent(event))
	{
        if(event.type == sf::Event::Closed)
            return -1;
		if(event.type == sf::Event::LostFocus)
			setPaused(true);
		if(event.type == sf::Event::GainedFocus){
			return 1;
		}
		if(event.type == sf::Event::MouseButtonPressed){
			sf::Vector2i mousePos = sf::Mouse::getPosition(m_window);
			if(m_finished){ // Only if the game is finished will the back to menu and play again options show
				if(mousePos.x > 375 && mousePos.x < 575 &&
					mousePos.y > 500 && mousePos.y < 515){
					m_endMusic.stop();
					m_nextState = 0; // Back to menu
				}
				if(mousePos.x > 120 && mousePos.x < 500 &&
					mousePos.y > 260 && mousePos.y < 320){ // Play again
						setFinished(false);
				}
			}
			m_player->mousePressed(mousePos);
		}
    }
	return 0;
}

// Method used by the "boom" powerup
void GameState::killAll(){
	list<GameObject*>::iterator it = m_objects.begin();
	while(it!=m_objects.end()){ // We need to delete all the enemies
		GameObject *object = (*it);
		if(object->hasProperty("enemy"))
			object->kill();
		++it;
	}
}

// Method used by the "points" powerup
void GameState::increasePoints(){
	m_score += m_gameController->getInternalLevel()*10;
	stringstream ss;
	ss << m_score;
	m_scoreText.setString(ss.str());
}

void GameState::setTextFont(sf::Font &textFont){
	m_scoreText.setFont(textFont);
	m_menuText.setFont(textFont);
	m_playAgainText.setFont(textFont);
	m_scoreEndText.setFont(textFont);
	m_killedText.setFont(textFont);
	m_survivedText.setFont(textFont);
	m_scoreSentText.setFont(textFont);
}

int GameState::getNextState(){
	return m_nextState;
}

// Method used by the "slow-time" powerup
void GameState::setSlowTime(double slowTime){
	m_slowTime = slowTime;
}

void GameState::setMuteSounds(bool muteSounds){
	m_soundManager.setMuteSounds(muteSounds);
}

void GameState::setMuteMusic(bool muteMusic){
	m_muteMusic = muteMusic;
	if(m_muteMusic){
		m_music.setVolume(0);
		m_endMusic.setVolume(0);
	}
	else{
		m_music.setVolume(100);
		m_endMusic.setVolume(100);
	}
}

void GameState::setLogged(bool logged){
	m_logged = logged;
}

void GameState::setUsername(string username){
	m_username = username;
	stringstream ss;
	ss << "Score saved as " << m_username;
	m_scoreSentText.setString(ss.str());
}


text:
threerolltwo.com
================

This is the repository for [threerolltwo.com](http://threerolltwo.com).

To run it locally, you will need nodejs v6.3+, PostgreSQL 9.1+, and
some patience.


text:
<?xml version="1.0" encoding="utf-8" ?>
<litepal>
    <dbname value="cool_weather"/>
    <version value="1"/>
    <list>
        <mapping class="com.example.coolweather.db.City"/>
        <mapping class="com.example.coolweather.db.County"/>
        <mapping class="com.example.coolweather.db.Province"/>
    </list>
</litepal>


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BuildBoss
{
    internal static class SolutionUtil
    {
        internal static List<ProjectEntry> ParseProjects(string solutionPath)
        {
            using (var reader = new StreamReader(solutionPath))
            {
                var list = new List<ProjectEntry>();
                while (true)
                {
                    var line = reader.ReadLine();
                    if (line == null)
                    {
                        break;
                    }

                    if (!line.StartsWith("Project"))
                    {
                        continue;

                    }

                    list.Add(ParseProjectLine(line));
                }
                return list;
            }
        }

        private static ProjectEntry ParseProjectLine(string line)
        {
            var index = 0;
            var typeGuid = ParseStringLiteral(line, ref index);
            var name = ParseStringLiteral(line, ref index);
            var filePath = ParseStringLiteral(line, ref index);
            var guid = ParseStringLiteral(line, ref index);
            return new ProjectEntry(
                relativeFilePath: filePath,
                name: name,
                projectGuid: Guid.Parse(guid),
                typeGuid: Guid.Parse(typeGuid));
        }

        private static string ParseStringLiteral(string line, ref int index)
        {
            var start = line.IndexOf('"', index);
            if (start < 0)
            {
                goto error;
            }

            start++;
            var end = line.IndexOf('"', start);
            if (end < 0)
            {
                goto error;
            }

            index = end + 1;
            return line.Substring(start, end - start);

        error:
            throw new Exception($"Invalid project line {line}");
        }
    }
}


text:
package org.apache.flink.fs.azurefs;

import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.azure.NativeAzureFileSystem;

/** A factory for the Azure file system over HTTPs. */
public class SecureAzureBlobStorageFSFactory extends AbstractAzureFSFactory {

    @Override
    public String getScheme() {
        return "wasbs";
    }

    @Override
    FileSystem createAzureFS() {
        return new NativeAzureFileSystem();
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
        "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

[Download]
            | [Documentation Home] | [Release Note]

Tracer

This tracer shows the SOAP messages, their respective SOAP message
            requests and responses when the services are deployed on the server, and the
            invoked operations. Make sure that the messages are monitored by turning the
            SOAP Tracer on. By default, it is switched off. You can switch it on by
            selecting ON in the list.

Warning:Turning this on will have a performance hit,
            since all SOAP messages will be always completely built (i.e., deferred
            building will not be done) and stored in the database by WSO2 Data Services Server. Hence
            this option should be used with caution.

Figure 1: Turn OFF SOAP Tracer

The tracer will only show the messages of the operations that were invoked
            after switching on the SOAP tracing.

By using this SOAP tracer, it is possible to see the SOAP messages with
            their time-stamps, service name, operation invoked and the number of requests
            to the server. The most recent SOAP messages are listed on the top. When a
            particular SOAP message is selected, its Request and the Response can be
            viewed in collapsible/expandable text boxes.

Note: This tracer does not apply to operations invoked in the admin
            services, as they are filtered out.

Figure 2: SOAP Tracer- Request/Response Messages


text:
UAnimBone::UAnimBone(const class FObjectInitializer& Init)
	: Super(Init)
{
	Scale = FVector(1, 1, 1);
}

bool UAnimBone::Enabled()
{
	return Alpha == 1.f;
}

void UAnimBone::SetEnabled(bool Enable)
{
	if (Enable)
	{
		Alpha = 1.f;
	}
	else
	{
		Alpha = 0.f;
	}
}

void UAnimBone::SetFromTransform(const FTransform& Transform)
{
	Orientation = FRotator(Transform.GetRotation());
	Position = Transform.GetTranslation();
	Scale = Transform.GetScale3D();
}

FTransform UAnimBone::GetTransform()
{
	return FTransform(FQuat(Orientation), Position, Scale);
}

void UAnimBone::TranslateBone(FVector Shift)
{
	Position += Shift;
}

void UAnimBone::TransformBone(FTransform& ByTransform)
{
	//The transform works differently we're only using it for timewarp right now, which is disabled (2.0.1)
	//FTransform Transform = GetTransform();
	//Transform.Accumulate(ByTransform);
	//SetFromTransform(Transform);

	Orientation = CombineRotators(Orientation, FRotator(ByTransform.GetRotation()));
	//Orientation = FRotator(Orientation.Quaternion() * ByTransform.GetRotation() );

	//Rotate the vector based on transform orientation
	Position = ByTransform.GetRotation().RotateVector(Position);
}

void UAnimBone::ChangeBasis(FRotator PreBase, FRotator PostBase, bool AdjustVectors)
{
	//Adjust the orientation
	FRotator PostCombine = CombineRotators(Orientation, PostBase);
	Orientation = CombineRotators(PreBase, PostCombine);

	//Rotate our vector/s
	if (AdjustVectors)
	{
		Position = PostBase.RotateVector(Position);
	}
}


text:
<dc:title>CROSBY v. NATIONAL FOREIGN TRADE COUNCIL</dc:title>
<dc:language>en-US</dc:language>
<dc:creator opf:file-as="NYPL" opf:role="aut">NYPL</dc:creator>
<dc:publisher>NYPL</dc:publisher>
<dc:date opf:event="publication">2015-01-15</dc:date>
<dc:rights>Copyright ©2015 by Cornell Law and NYPL</dc:rights>


text:
require 'spec_helper'

RSpec.describe TypeStation::Admin::PagesController do
  routes { TypeStation::Engine.routes }

  before do
    @page = TypeStation::Page.create(title: 'Index page', template_name: 'blank_index')
    @content_text = @page.contents.build(name: :existing_text_field, type: :text)
    @content_text.set('Old value')
  end

  it 'will create any missing fields' do
    patch :update, id: @page.to_param, contents: { field: 'text_field',value: 'My Text', type: 'text'}
    @page.reload
    expect(@page.get(:text_field)).to eq('My Text')
    expect(response.status).to eq(200)
  end

  it 'will create multiple missing fields' do
    patch :update, id: @page.to_param, contents: [{ field: 'text_field',value: 'My Text', type: 'text'}, { field: 'html_field',value: 'html', type: 'html'}]
    expect(response.status).to eq(200)
  end

  it 'will update any existiong fields' do
    expect(@page.contents.first.get).to eq('Old value')
    patch :update, id: @page.to_param, contents: { field: 'existing_text_field',value: 'New value', type: 'text'}
    @page.reload
    expect(@page.get(:existing_text_field)).to eq('New value')
  end

  it 'will allow you to save values that are other than strings' do
    patch :update, id: @page.to_param, contents: { field: 'image_field',value: {url: 'test'}, type: 'image'}
    @page.reload
    expect(@page.get(:image_field)).to eq({'url' => 'test'})
  end

end


text:
package com.datatorrent.bufferserver.client;

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

import com.datatorrent.bufferserver.packet.PublishRequestTuple;

/**
 *
Abstract Publisher class.

 *
 * @since 0.3.2
 */
public abstract class Publisher extends AuthClient
{
  private final String id;

  public Publisher(String id)
  {
    this(id, 1024);
  }

  public Publisher(String id, int sendBufferCapacity)
  {
    super(1024, sendBufferCapacity);
    this.id = id;
  }

  /**
   *
   * @param windowId
   */
  public void activate(String version, long windowId)
  {
    sendAuthenticate();
    write(PublishRequestTuple.getSerializedRequest(version, id, windowId));
  }

  @Override
  public String toString()
  {
    return "Publisher{" + "id=" + id + '}';
  }

  private static final Logger logger = LoggerFactory.getLogger(Publisher.class);
}


text:
<?php

namespace kartik\editable;

use Yii;
use yii\web\View;
use yii\base\InvalidConfigException;
use yii\helpers\Html;
use yii\helpers\Json;
use yii\helpers\ArrayHelper;
use kartik\base\Config;
use kartik\base\InputWidget;
use kartik\popover\PopoverX;

/**
 * An extended editable widget for Yii Framework 2.
 *
 * @see http://github.com/kartik-v/yii2-editable
 * @author Kartik Visweswaran <kartikv2@gmail.com>
 * @since 1.0
 */
class Editable extends InputWidget
{
    /**
     * Editable display formats
     */
    const FORMAT_LINK = 'link';
    const FORMAT_BUTTON = 'button';

    /**
     * Edit input types
     */
    // input types
    const INPUT_HIDDEN = 'hiddenInput';
    const INPUT_TEXT = 'textInput';
    const INPUT_PASSWORD = 'passwordInput';
    const INPUT_TEXTAREA = 'textArea';
    const INPUT_CHECKBOX = 'checkbox';
    const INPUT_RADIO = 'radio';
    const INPUT_LIST_BOX = 'listBox';
    const INPUT_DROPDOWN_LIST = 'dropDownList';
    const INPUT_CHECKBOX_LIST = 'checkboxList';
    const INPUT_RADIO_LIST = 'radioList';
    const INPUT_FILE = 'fileInput';
    const INPUT_HTML5_INPUT = 'input';
    const INPUT_WIDGET = 'widget';

    // input widget classes
    const INPUT_DEPDROP = '\kartik\depdrop\DepDrop';
    const INPUT_SELECT2 = '\kartik\select2\Select2';
    const INPUT_TYPEAHEAD = '\kartik\typeahead\Typeahead';
    const INPUT_SWITCH = '\kartik\switchinput\SwitchInput';
    const INPUT_SPIN = '\kartik\touchspin\TouchSpin';
    const INPUT_DATE = '\kartik\date\DatePicker';
    const INPUT_TIME = '\kartik\time\TimePicker';
    const INPUT_DATETIME = '\kartik\datetime\DateTimePicker';
    const INPUT_DATE_RANGE = '\kartik\daterange\DateRangePicker';
    const INPUT_SORTABLE = '\kartik\sortinput\SortableInput';
    const INPUT_RANGE = '\kartik\range\RangeInput';
    const INPUT_COLOR = '\kartik\color\ColorInput';
    const INPUT_RATING = '\kartik\rating\StarRating';
    const INPUT_FILEINPUT = '\kartik\file\FileInput';
    const INPUT_SLIDER = '\kartik\slider\Slider';
    const INPUT_MONEY = '\kartik\money\MaskMoney';
    const INPUT_CHECKBOX_X = '\kartik\checkbox\CheckboxX';

    const CSS_PARENT = "kv-editable-parent form-group";

    /**
     * @var string the identifier for the PJAX widget container if the editable
     * widget is to be rendered inside a PJAX container. This will ensure the
     * PopoverX plugin is initialized correctly after a PJAX request is completed.
     * If this is not set, no re-initialization will be done for pjax.
     */
    public $pjaxContainerId;

    /**
     * @var string the display format for the editable. Accepts one of the following values.
     * - 'link' or [[Editable::FORMAT_LINK]]: will convert the text to a clickable editable link.
     * - 'button' or [[Editable::FORMAT_BUTTON]]: will display a separate button beside the text.
     * Defaults to [[Editable::FORMAT_LINK]] if you do not set it as [[Editable::FORMAT_BUTTON]].
     */
    public $format = self::FORMAT_LINK;

    /**
     * @var array the HTML attributes for the editable button to be displayed when the format
     * has been set to 'button':
     * - label: string, the editable button label. This is not HTML encoded.
     *   Defaults to
     */
    public $editableButtonOptions = ['class' => 'btn btn-sm btn-default'];

    /**
     * @var array the HTML attributes for the editable value displayed
     */
    public $editableValueOptions = [];

    /**
     * @var array the HTML attributes for the editable container
     */
    public $containerOptions = [];

    /**
     * @var array the HTML attributes for the input container
     * applicable only when not using with ActiveForm
     */
    public $inputContainerOptions = [];

    /**
     * @var string the popover contextual type. Must be one of the [[PopoverX::TYPE]] constants
     * Defaults to `PopoverX::TYPE_DEFAULT` or `default`.
     */
    public $type = PopoverX::TYPE_DEFAULT;

    /**
     * @var string the size of the popover window. One of the [[PopoverX::SIZE]] constants
     */
    public $size;

    /**
     * @var string the popover placement. Must be one of the [[PopoverX::ALIGN]] constants
     * Defaults to `PopoverX::ALIGN_RIGHT` or `right`.
     */
    public $placement = PopoverX::ALIGN_RIGHT;

    /**
     * @var string the header content placed before the header text in the popover dialog.
     * This defaults to `<i class="glyphicon glyphicon-edit"></i> Edit`;
     */
    public $preHeader;

    /**
     * @var string the header content in the popover dialog. If not set, this
     * will be auto generated based on the attribute label or set to null.
     */
    public $header;

    /**
     * @var string the footer content in the popover dialog. The following special
     * tags/variables will be parsed and replaced in the footer:
     * {buttons} - string, will be replaced with the submit and reset button.
     * If this is set to null or an empty string, it will not be displayed.
     */
    public $footer = '{buttons}';

    /**
     * @var string the value to be displayed. If not set, this will default to the
     * attribute value. If the attribute value is null, then this will display the
     * value as set in [[valueIfNull]].
     */
    public $displayValue;

    /**
     * @var array the configuration to auto-calculate display value, based on the
     * value of the editable input. This should be a single dimensional array whose
     * keys must match the input value, and the array values must be the description
     * to be displayed. For example, to display user friendly boolean values, you could
     * configure this as `[0 => 'Inactive', 1 => 'Active']`. If this is set, it will
     * override any value set in `displayValue`.
     */
    public $displayValueConfig = [];

    /**
     * @var string the value to display if the displayValue is null.
     * Defaults to '(not set)'.
     */
    public $valueIfNull;

    /**
     * @var array the HTML attributes for the container enclosing the main content
     * in the popover dialog.
     */
    public $contentOptions = [];

    /**
     * @var array the class for the ActiveForm widget to be used. The class must
     * extend from `\yii\widgets\ActiveForm`. This defaults to `\kartik\widgets\ActiveForm`.
     */
    public $formClass = '\yii\widgets\ActiveForm';

    /**
     * @var array the options for the ActiveForm widget class selected in `formClass`.
     */
    public $formOptions = [];

    /**
     * @var array the input type to render for the editing the input in the editable form.
     * This must be one of the [[Editable::TYPE]] constants.
     */
    public $inputType = self::INPUT_TEXT;

    /**
     * @var string any custom widget class to use. Will only be used if the `inputType` is
     * set to [[Editable::INPUT_WIDGET]]
     */
    public $widgetClass;

    /**
     * @var boolean whether to display any ajax processing errors. Defaults to `true`.
     */
    public $showAjaxErrors = true;

    /**
     * @var array the options for the input. If the inputType is one of the HTML inputs, this will
     * capture the HTML attributes. If the `inputType` is set to [[Editable::INPUT_WIDGET]]
     * or set to an input widget from the `\kartik\` namespace, then this will capture the widget
     * options.
     */
    public $options = [];

    /**
     * @var array the ActiveField configuration, if you are using with `model`.
     */
    public $inputFieldConfig = [];

    /**
     * @var string|Closure the content to be placed before the rendered input. If not set as a string,
     * this can be passed as a callback function of the following signature:
     * ```
     * function ($form, $widget) {
     *    // echo $form->field($widget->model, 'attrib');
     * }
     * ```
     * where:
     * - $form mixed is the active form instance for the editable form
     * - $widget mixed is the current editable widget instance
     */
    public $beforeInput;

    /**
     * @var string|Closure the content to be placed after the rendered input. If not set as a string,
     * this can be passed as a callback function of the following signature:
     * ```
     * function ($form, $widget) {
     *    // echo $form->field($widget->model, 'attrib');
     * }
     * ```
     * where:
     * - $form mixed is the active form instance for the editable form
     * - $widget mixed is the current editable widget instance
     */
    public $afterInput;

    /**
     * @var boolean whether you wish to automatically display the form submit and reset buttons.
     * Defaults to `true`.
     */
    public $showButtons = true;

    /**
     * @var array the HTML attributes for the form submit button. The following special property
     * is recognized:
     * - label: string, the label of the button. Defaults to `<i class="glyphicon glyphicon-ok"></i> `.
     */
    public $submitButton = ['class' => 'btn btn-sm btn-primary'];

    /**
     * @var array the HTML attributes for the form reset button. The following special property
     * is recognized:
     * - label: string, the label of the button. Defaults to `<i class="glyphicon glyphicon-ban-circle"></i> `.
     */
    public $resetButton = ['class' => 'btn btn-sm btn-default'];

    /**
     * @var array the generated configuration for the `kartik\popover\PopoverX` widget.
     */
    protected $_popoverOptions = [];

    /**
     * @var array the HTML attributes or options for the input/widget
     */
    protected $_inputOptions = [];

    /**
     * @var \yii\widgets\ActiveForm instance
     */
    protected $_form;

    /**
     * Initializes the widget
     *
     * @throws InvalidConfigException
     */
    public function init()
    {
        $this->_msgCat = 'kveditable';
        parent::init();
        if (empty($this->inputType)) {
            throw new InvalidConfigException("The 'type' of editable input must be set.");
        }
        if (!Config::isValidInput($this->inputType)) {
            throw new InvalidConfigException("Invalid input type '{$this->inputType}'.");
        }
        if ($this->inputType === self::INPUT_WIDGET && empty($this->widgetClass)) {
            throw new InvalidConfigException("The 'widgetClass' must be set when the 'inputType' is set to 'widget'.");
        }
        if (Config::isDropdownInput($this->inputType) && !isset($this->data)) {
            throw new InvalidConfigException("You must set the 'data' property for '{$this->inputType}'.");
        }
        Config::validateInputWidget($this->inputType);
        $this->initI18N();
        $this->initOptions();
        $this->_popoverOptions['options']['id'] = $this->options['id'] . '-popover';
        $this->_popoverOptions['toggleButton']['id'] = $this->options['id'] . '-targ';
        $this->registerAssets();
        echo Html::beginTag('div', $this->containerOptions);
        if ($this->format == self::FORMAT_BUTTON) {
            echo Html::tag('div', $this->displayValue, $this->editableValueOptions);
        }

        PopoverX::begin($this->_popoverOptions);

        if (!empty($this->formClass) && !class_exists($this->formClass)) {
            throw new InvalidConfigException("The form class '{$this->formClass}' does not exist.");
        }
        $class = $this->formClass;
        echo Html::beginTag('div', $this->contentOptions);
        $this->_form = $class::begin($this->formOptions);
        if (!$this->_form instanceof \yii\widgets\ActiveForm) {
            throw new InvalidConfigException("The form class '{$class}' MUST extend from \yii\widgets\ActiveForm.");
        }

    }

    /**
     * Initializes the widget options.
     * This method sets the default values for various widget options.
     */
    protected function initOptions()
    {
        $css = empty($this->options['class']) ? ' form-control' : '';
        Html::addCssClass($this->options, 'kv-editable-input' . $css);
        Html::addCssClass($this->inputContainerOptions, self::CSS_PARENT);
        if ($this->hasModel()) {
            $options = ArrayHelper::getValue($this->inputFieldConfig, 'options', []);
            Html::addCssClass($options, self::CSS_PARENT);
            $this->inputFieldConfig['options'] = $options;
        }
        if (!Config::isHtmlInput($this->inputType) && empty($this->options['options']['id'])) {
            $this->options['options']['id'] = $this->options['id'];
        }
        $this->_inputOptions = $this->options;
        $this->containerOptions['id'] = $this->options['id'] . '-cont';
        $value = $this->hasModel() ? Html::getAttributeValue($this->model, $this->attribute) : $this->value;
        if (!isset($this->displayValue)) {
            $this->displayValue = $value;
        }
        if ($this->valueIfNull === null || $this->valueIfNull === '') {
            $this->valueIfNull = '' . Yii::t('kveditable', '(not set)') . '';
        }
        if ($this->displayValue === null || $this->displayValue === '') {
            $this->displayValue = $this->valueIfNull;
        }
        if (is_array($this->displayValueConfig) && !empty($this->displayValueConfig[$value])) {
            $this->displayValue = $this->displayValueConfig[$value];
        }
        Html::addCssClass($this->containerOptions, 'kv-editable');
        Html::addCssClass($this->contentOptions, 'kv-editable-content');
        Html::addCssClass($this->formOptions['options'], 'kv-editable-form');
        if ($this->format == self::FORMAT_BUTTON) {
            Html::addCssClass($this->editableButtonOptions, 'kv-editable-button');
            Html::addCssClass($this->editableValueOptions, 'kv-editable-value');
        } else {
            Html::addCssClass($this->editableValueOptions, 'kv-editable-value kv-editable-link');
        }
        $this->_popoverOptions['type'] = $this->type;
        $this->_popoverOptions['placement'] = $this->placement;
        $this->_popoverOptions['size'] = $this->size;
        if (!isset($this->preHeader)) {
            $this->preHeader = ' ' . Yii::t('kveditable', 'Edit') . ' ';
        }
        if ($this->header == null) {
            $attribute = $this->attribute;
            if (strpos($attribute, ']') > 0) {
                $tags = explode(']', $attribute);
                $attribute = array_pop($tags);
            }
            $this->_popoverOptions['header'] = $this->preHeader .
                ($this->hasModel() ? $this->model->getAttributeLabel($attribute) : '');
        } else {
            $this->_popoverOptions['header'] = $this->preHeader . $this->header;
        }
        $this->_popoverOptions['footer'] = $this->renderFooter();
        $this->_popoverOptions['options']['class'] = 'kv-editable-popover skip-export';
        if ($this->format == self::FORMAT_BUTTON) {
            if (empty($this->editableButtonOptions['label'])) {
                $this->editableButtonOptions['label'] = '';
            }
            Html::addCssClass($this->editableButtonOptions, 'kv-editable-toggle');
            $this->_popoverOptions['toggleButton'] = $this->editableButtonOptions;
        } else {
            $this->_popoverOptions['toggleButton'] = $this->editableValueOptions;
            $this->_popoverOptions['toggleButton']['label'] = $this->displayValue;
        }
        if (!empty($this->footer)) {
            Html::addCssClass($this->_popoverOptions['options'], 'has-footer');
        }
    }

    /**
     * Generates the popover footer
     *
     * @return string
     */
    protected function renderFooter()
    {
        $submitLabel = ArrayHelper::remove($this->submitButton, 'label',
            ' ' . Yii::t('kveditable', 'Apply')
        );
        $resetLabel = ArrayHelper::remove($this->resetButton, 'label',
            ' ' . Yii::t('kveditable', 'Reset')
        );
        $this->submitButton['type'] = 'button';
        $this->resetButton['type'] = 'button';
        Html::addCssClass($this->submitButton, 'kv-editable-submit');
        Html::addCssClass($this->resetButton, 'kv-editable-reset');
        $buttons = Html::button($submitLabel, $this->submitButton) .
            Html::button($resetLabel, $this->resetButton);
        return Html::tag('div', ' ', ['class' => 'kv-editable-loading', 'style' => 'display:none;']) .
        strtr($this->footer, [
            '{buttons}' => $buttons
        ]);
    }

    /**
     * Registers the needed assets
     */
    public function registerAssets()
    {
        $view = $this->getView();
        EditableAsset::register($view);
        $this->pluginOptions = [
            'defaultValue' => $this->valueIfNull,
            'placement' => $this->placement,
            'target' => $this->format == self::FORMAT_BUTTON ? '.kv-editable-button' : '.kv-editable-link',
            'displayValueConfig' => $this->displayValueConfig,
            'showAjaxErrors' => $this->showAjaxErrors
        ];
        $this->registerPlugin('editable');
        if (!empty($this->pjaxContainerId)) {
            EditablePjaxAsset::register($view);
            $toggleButton = $this->_popoverOptions['toggleButton']['id'];
            $initPjaxVar = 'kvEdPjax_' . str_replace('-', '_', $this->_popoverOptions['options']['id']);
            $view->registerJs("var {$initPjaxVar} = false;", View::POS_HEAD);
            $js = "initEditablePjax('{$this->pjaxContainerId}', '{$toggleButton}', '{$initPjaxVar}');";
            $view->registerJs($js);
        }
    }

    /**
     * @inheritdoc
     */
    public function run()
    {
        $class = $this->formClass;
        echo $this->renderFormFields();
        $class::end();
        echo "
\n"; // content options
        PopoverX::end();
        echo "
\n"; // options
    }

    /**
     * Renders the editable form fields
     *
     * @return string
     */
    protected function renderFormFields()
    {
        $out = Html::hiddenInput('hasEditable', 0) . "\n";
        if ($this->beforeInput !== null) {
            if (is_string($this->beforeInput)) {
                $out .= $this->beforeInput . "\n";
            } else {
                $out .= call_user_func($this->beforeInput, $this->_form, $this) . "\n";
            }
        }
        if ($this->inputType === self::INPUT_HTML5_INPUT) {
            $out .= $this->renderHtml5Input() . "\n";
        } elseif ($this->inputType === self::INPUT_WIDGET) {
            $out .= $this->renderWidget($this->widgetClass) . "\n";
        } elseif (Config::isHtmlInput($this->inputType)) {
            $out .= $this->renderInput() . "\n";
        } elseif (Config::isInputWidget($this->inputType)) {
            $out .= $this->renderWidget($this->inputType) . "\n";
        }
        if ($this->afterInput !== null) {
            if (is_string($this->afterInput)) {
                $out .= $this->afterInput . "\n";
            } else {
                $out .= call_user_func($this->afterInput, $this->_form, $this) . "\n";
            }
        }
        return $out;
    }

    /**
     * Renders the HTML 5 input
     *
     * @return string
     */
    protected function renderHtml5Input()
    {
        $type = ArrayHelper::remove($this->_inputOptions, 'type', 'text');
        $field = Html::input($type, $this->name, $this->value, $this->_inputOptions);
        if ($this->hasModel()) {
            if (isset($this->_form)) {
                return $this->_form
                    ->field($this->model, $this->attribute, $this->inputFieldConfig)
                    ->input($type, $this->_inputOptions)
                    ->label(false);
            }
            $field = Html::activeInput($type, $this->name, $this->value, $this->_inputOptions);
        }
        return Html::tag('div', $field, $this->inputContainerOptions);
    }

    /**
     * Renders a widget
     *
     * @return string
     */
    protected function renderWidget($class)
    {
        if ($this->hasModel()) {
            if (isset($this->_form)) {
                return $this->_form
                    ->field($this->model, $this->attribute, $this->inputFieldConfig)
                    ->widget($class, $this->_inputOptions)
                    ->label(false);
            }
            $options = ArrayHelper::merge($this->_inputOptions, [
                'model' => $this->model,
                'attribute' => $this->attribute
            ]);
        } else {
            $options = ArrayHelper::merge($this->_inputOptions, [
                'name' => $this->name,
                'value' => $this->value
            ]);
        }
        $field = $class::widget($options);
        return Html::tag('div', $field, $this->inputContainerOptions);
    }

    /**
     * Renders all other HTML inputs (except HTML5)
     *
     * @return string
     */
    protected function renderInput()
    {
        $list = Config::isDropdownInput($this->inputType);
        $input = $this->inputType;
        if ($this->hasModel()) {
            if (isset($this->_form)) {
                return $list ?
                    $this->_form
                        ->field($this->model, $this->attribute, $this->inputFieldConfig)
                        ->$input($this->data, $this->_inputOptions)
                        ->label(false) :
                    $this->_form
                        ->field($this->model, $this->attribute, $this->inputFieldConfig)
                        ->$input($this->_inputOptions)
                        ->label(false);
            }
            $input = 'active' . ucfirst($this->inputType);
        }
        $checked = false;
        if ($input == 'radio' || $input == 'checkbox') {
            $this->options['value'] = $this->value;
            $checked = ArrayHelper::remove($this->_inputOptions, 'checked', false);
        }
        if ($list) {
            $field = Html::$input($this->name, $this->value, $this->data, $this->_inputOptions);
        } else {
            $field = ($input == 'checkbox' || $input == 'radio') ?
                Html::$input($this->name, $checked, $this->_inputOptions) :
                Html::$input($this->name, $this->value, $this->_inputOptions);
        }
        return Html::tag('div', $field, $this->inputContainerOptions);
    }

    /**
     * Gets the form instance for use at runtime
     *
     * @return \yii\widgets\ActiveForm
     */
    public function getForm()
    {
        return $this->_form;
    }
}


text:
using System;
using System.Collections.Generic;
using WinDriver.Domain;

namespace WinDriver.Dto.Element
{
    public class LocateElementResponse : WebDriverResponse
    {
        public LocateElementResponse(Session session, Guid? elementId)
            : base(session)
        {
            if (elementId.HasValue)
            {
                Value = new Element { Id = elementId.Value.ToString("N") };
            }
            else
            {
                Value = new Dictionary<string, string> { { "message", "no such element" } };
            }
        }
    }
}


text:
package ru.pbaev;

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

/**
 * ConvertList class. Java Start. Framework Collection. Task 3.
 */
public class ConvertList {
    /**
     * Method for converting 2 dimensional Array to a List.
     *
     * @param array Array for converting.
     * @return converted List from Array.
     */
    public List<Integer> toList(final int[][] array) {
        List<Integer> integerList = new LinkedList<>();
        for (int[] arr : array) {
            for (int i : arr) {
                integerList.add(i);
            }
        }
        return integerList;
    }

    /**
     * Method for converting List to an 2 dimensional Array.
     *
     * @param list List for converting.
     * @param rows number of rows in returnable Array.
     * @return converted Array from List.
     */
    public int[][] toArray(final List<Integer> list, final int rows) {
        int reminder = list.size() % rows;
        int elemsInRow;
        if (reminder != 0) {
            elemsInRow = list.size() / rows + reminder / rows + 1;
        } else {
            elemsInRow = list.size() / rows;
        }
        int[][] array = new int[rows][elemsInRow];
        Iterator<Integer> it = list.iterator();
        for (int i = 0; i < rows; i++) {
            for (int j = 0; j < elemsInRow; j++) {
                if (it.hasNext()) {
                    Integer temp = it.next();
                    if (temp != null) {
                        array[i][j] = temp;
                    } else {
                        array[i][j] = 0;
                    }
                } else {
                    array[i][j] = 0;
                }
            }
        }
        return array;
    }

    /**
     * Static test.
     * @param args args.
     */
    public static void main(final String[] args) {
    }

    /**
     * Convert List<int[]> to one List<Integer>.
     * @param list list which contains int arrays.
     * @return list of integer.
     */
    public List<Integer> convert(final List<int[]> list) {
        List<Integer> resultList = new ArrayList<>();
        for (int[] arr: list) {
            for (Integer i : arr) {
                resultList.add(i);
            }
        }
        return resultList;
    }
}


text:
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListType
from pyangbind.lib.yangtypes import YANGDynClass
from pyangbind.lib.yangtypes import ReferenceType
from pyangbind.lib.base import PybindBase
from collections import OrderedDict
from decimal import Decimal
from bitarray import bitarray
import six

# PY3 support of some PY2 keywords (needs improved)
if six.PY3:
    import builtins as __builtin__

    long = int
elif six.PY2:
    import __builtin__

from . import config
from . import state

class srgb(PybindBase):
    """
  This class was auto-generated by the PythonClass plugin for PYANG
  from YANG module openconfig-network-instance - based on the path /network-instances/network-instance/segment-routing/srgbs/srgb. Each member element of
  the container is represented as a class variable - with a specific
  YANG type.

  YANG Description: A single definition of an SRGB which may comprise of multiple
sets of dataplane addresses (IPv6 addresses, or MPLS labels).
  """
    __slots__ = ("_path_helper", "_extmethods", "__local_id", "__config", "__state")

    _yang_name = "srgb"

    _pybind_generated_by = "container"

    def __init__(self, *args, **kwargs):

        self._path_helper = False

        self._extmethods = False
        self.__local_id = YANGDynClass(
            base=six.text_type,
            is_leaf=True,
            yang_name="local-id",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            is_keyval=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="leafref",
            is_config=True,
        )
        self.__config = YANGDynClass(
            base=config.config,
            is_container="container",
            yang_name="config",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            extensions=None,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="container",
            is_config=True,
        )
        self.__state = YANGDynClass(
            base=state.state,
            is_container="container",
            yang_name="state",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            extensions=None,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="container",
            is_config=True,
        )

        load = kwargs.pop("load", None)
        if args:
            if len(args) > 1:
                raise TypeError("cannot create a YANG container with >1 argument")
            all_attr = True
            for e in self._pyangbind_elements:
                if not hasattr(args[0], e):
                    all_attr = False
                    break
            if not all_attr:
                raise ValueError("Supplied object did not have the correct attributes")
            for e in self._pyangbind_elements:
                nobj = getattr(args[0], e)
                if nobj._changed() is False:
                    continue
                setmethod = getattr(self, "_set_%s" % e)
                if load is None:
                    setmethod(getattr(args[0], e))
                else:
                    setmethod(getattr(args[0], e), load=load)

    def _path(self):
        if hasattr(self, "_parent"):
            return self._parent._path() + [self._yang_name]
        else:
            return [
                "network-instances",
                "network-instance",
                "segment-routing",
                "srgbs",
                "srgb",
            ]

    def _get_local_id(self):
        """
    Getter method for local_id, mapped from YANG variable /network_instances/network_instance/segment_routing/srgbs/srgb/local_id (leafref)

    YANG Description: A reference to the identifier for the SRGB.
    """
        return self.__local_id

    def _set_local_id(self, v, load=False):
        """
    Setter method for local_id, mapped from YANG variable /network_instances/network_instance/segment_routing/srgbs/srgb/local_id (leafref)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_local_id is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_local_id() directly.

    YANG Description: A reference to the identifier for the SRGB.
    """
        parent = getattr(self, "_parent", None)
        if parent is not None and load is False:
            raise AttributeError(
                "Cannot set keys directly when" + " within an instantiated list"
            )

        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=six.text_type,
                is_leaf=True,
                yang_name="local-id",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                is_keyval=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="leafref",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """local_id must be of a type compatible with leafref""",
                    "defined-type": "leafref",
                    "generated-type": """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="local-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='leafref', is_config=True)""",
                }
            )

        self.__local_id = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_local_id(self):
        self.__local_id = YANGDynClass(
            base=six.text_type,
            is_leaf=True,
            yang_name="local-id",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            is_keyval=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="leafref",
            is_config=True,
        )

    def _get_config(self):
        """
    Getter method for config, mapped from YANG variable /network_instances/network_instance/segment_routing/srgbs/srgb/config (container)

    YANG Description: Configuration parameters relating to the SRGB.
    """
        return self.__config

    def _set_config(self, v, load=False):
        """
    Setter method for config, mapped from YANG variable /network_instances/network_instance/segment_routing/srgbs/srgb/config (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_config is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_config() directly.

    YANG Description: Configuration parameters relating to the SRGB.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=config.config,
                is_container="container",
                yang_name="config",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                extensions=None,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="container",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """config must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=config.config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='container', is_config=True)""",
                }
            )

        self.__config = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_config(self):
        self.__config = YANGDynClass(
            base=config.config,
            is_container="container",
            yang_name="config",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            extensions=None,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="container",
            is_config=True,
        )

    def _get_state(self):
        """
    Getter method for state, mapped from YANG variable /network_instances/network_instance/segment_routing/srgbs/srgb/state (container)

    YANG Description: State parameters relating to the SRGB.
    """
        return self.__state

    def _set_state(self, v, load=False):
        """
    Setter method for state, mapped from YANG variable /network_instances/network_instance/segment_routing/srgbs/srgb/state (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_state is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_state() directly.

    YANG Description: State parameters relating to the SRGB.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=state.state,
                is_container="container",
                yang_name="state",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                extensions=None,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="container",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """state must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=state.state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='container', is_config=True)""",
                }
            )

        self.__state = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_state(self):
        self.__state = YANGDynClass(
            base=state.state,
            is_container="container",
            yang_name="state",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            extensions=None,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="container",
            is_config=True,
        )

    local_id = __builtin__.property(_get_local_id, _set_local_id)
    config = __builtin__.property(_get_config, _set_config)
    state = __builtin__.property(_get_state, _set_state)

    _pyangbind_elements = OrderedDict(
        [("local_id", local_id), ("config", config), ("state", state)]
    )

from . import config
from . import state

class srgb(PybindBase):
    """
  This class was auto-generated by the PythonClass plugin for PYANG
  from YANG module openconfig-network-instance-l2 - based on the path /network-instances/network-instance/segment-routing/srgbs/srgb. Each member element of
  the container is represented as a class variable - with a specific
  YANG type.

  YANG Description: A single definition of an SRGB which may comprise of multiple
sets of dataplane addresses (IPv6 addresses, or MPLS labels).
  """
    __slots__ = ("_path_helper", "_extmethods", "__local_id", "__config", "__state")

    _yang_name = "srgb"

    _pybind_generated_by = "container"

    def __init__(self, *args, **kwargs):

        self._path_helper = False

        self._extmethods = False
        self.__local_id = YANGDynClass(
            base=six.text_type,
            is_leaf=True,
            yang_name="local-id",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            is_keyval=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="leafref",
            is_config=True,
        )
        self.__config = YANGDynClass(
            base=config.config,
            is_container="container",
            yang_name="config",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            extensions=None,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="container",
            is_config=True,
        )
        self.__state = YANGDynClass(
            base=state.state,
            is_container="container",
            yang_name="state",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            extensions=None,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="container",
            is_config=True,
        )

        load = kwargs.pop("load", None)
        if args:
            if len(args) > 1:
                raise TypeError("cannot create a YANG container with >1 argument")
            all_attr = True
            for e in self._pyangbind_elements:
                if not hasattr(args[0], e):
                    all_attr = False
                    break
            if not all_attr:
                raise ValueError("Supplied object did not have the correct attributes")
            for e in self._pyangbind_elements:
                nobj = getattr(args[0], e)
                if nobj._changed() is False:
                    continue
                setmethod = getattr(self, "_set_%s" % e)
                if load is None:
                    setmethod(getattr(args[0], e))
                else:
                    setmethod(getattr(args[0], e), load=load)

    def _path(self):
        if hasattr(self, "_parent"):
            return self._parent._path() + [self._yang_name]
        else:
            return [
                "network-instances",
                "network-instance",
                "segment-routing",
                "srgbs",
                "srgb",
            ]

    def _get_local_id(self):
        """
    Getter method for local_id, mapped from YANG variable /network_instances/network_instance/segment_routing/srgbs/srgb/local_id (leafref)

    YANG Description: A reference to the identifier for the SRGB.
    """
        return self.__local_id

    def _set_local_id(self, v, load=False):
        """
    Setter method for local_id, mapped from YANG variable /network_instances/network_instance/segment_routing/srgbs/srgb/local_id (leafref)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_local_id is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_local_id() directly.

    YANG Description: A reference to the identifier for the SRGB.
    """
        parent = getattr(self, "_parent", None)
        if parent is not None and load is False:
            raise AttributeError(
                "Cannot set keys directly when" + " within an instantiated list"
            )

        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=six.text_type,
                is_leaf=True,
                yang_name="local-id",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                is_keyval=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="leafref",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """local_id must be of a type compatible with leafref""",
                    "defined-type": "leafref",
                    "generated-type": """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="local-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='leafref', is_config=True)""",
                }
            )

        self.__local_id = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_local_id(self):
        self.__local_id = YANGDynClass(
            base=six.text_type,
            is_leaf=True,
            yang_name="local-id",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            is_keyval=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="leafref",
            is_config=True,
        )

    def _get_config(self):
        """
    Getter method for config, mapped from YANG variable /network_instances/network_instance/segment_routing/srgbs/srgb/config (container)

    YANG Description: Configuration parameters relating to the SRGB.
    """
        return self.__config

    def _set_config(self, v, load=False):
        """
    Setter method for config, mapped from YANG variable /network_instances/network_instance/segment_routing/srgbs/srgb/config (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_config is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_config() directly.

    YANG Description: Configuration parameters relating to the SRGB.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=config.config,
                is_container="container",
                yang_name="config",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                extensions=None,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="container",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """config must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=config.config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='container', is_config=True)""",
                }
            )

        self.__config = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_config(self):
        self.__config = YANGDynClass(
            base=config.config,
            is_container="container",
            yang_name="config",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            extensions=None,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="container",
            is_config=True,
        )

    def _get_state(self):
        """
    Getter method for state, mapped from YANG variable /network_instances/network_instance/segment_routing/srgbs/srgb/state (container)

    YANG Description: State parameters relating to the SRGB.
    """
        return self.__state

    def _set_state(self, v, load=False):
        """
    Setter method for state, mapped from YANG variable /network_instances/network_instance/segment_routing/srgbs/srgb/state (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_state is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_state() directly.

    YANG Description: State parameters relating to the SRGB.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=state.state,
                is_container="container",
                yang_name="state",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                extensions=None,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="container",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """state must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=state.state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='container', is_config=True)""",
                }
            )

        self.__state = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_state(self):
        self.__state = YANGDynClass(
            base=state.state,
            is_container="container",
            yang_name="state",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            extensions=None,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="container",
            is_config=True,
        )

    local_id = __builtin__.property(_get_local_id, _set_local_id)
    config = __builtin__.property(_get_config, _set_config)
    state = __builtin__.property(_get_state, _set_state)

    _pyangbind_elements = OrderedDict(
        [("local_id", local_id), ("config", config), ("state", state)]
    )


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace GlobalcachingApplication.Plugins.Cachebox
{
    public partial class SettingsPanel : UserControl
    {
        public const string STR_MAXLOGS = "Maximum logs";
        public const string STR_GRABBEDIMG = "Export grabbed images";

        public SettingsPanel()
        {
            InitializeComponent();

            this.label1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_MAXLOGS);
            numericUpDown1.Value = Properties.Settings.Default.MaxLogs;

            this.checkBox1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_GRABBEDIMG);
            this.checkBox1.Checked = Properties.Settings.Default.ExportGrabbedImages;
        }

        public void Apply()
        {
            Properties.Settings.Default.MaxLogs = (int)numericUpDown1.Value;
            Properties.Settings.Default.ExportGrabbedImages = this.checkBox1.Checked;
            Properties.Settings.Default.Save();
        }
    }
}


text:
return require 'parse.char.utf8.set.Letter.Uppercase'
	+ require 'parse.char.utf8.set.Other_Uppercase'


text:
<!DOCTYPE html>

  <title>Green Button API</title>
  <link href='//fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/>
  <link href='css/highlight.default.css' media='screen' rel='stylesheet' type='text/css'/>
  <link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/>

      Green Button API

Back to Sandbox

The Green Button API provides access to RESTful services provided by Data Custodian and Third Party Applications.
These APIs allow application developers full access, in Green Button Format, to Energy Usage Information for the
purpose of developing new Green Button Applications.

Access to Green Button APIs requires an OAuth2 Access Token.  The following table contains a list of Access Tokens and the various Data Custodian Roles that may be tested using the assigned Access Token.  Insert one the following  Access Tokens in the field labelled "Access Token:" at the top of the page prior to selecting the "Try It Out!" button:

Access Token	Token Type	Role Tested

Bearer 2a85f4bd-30db-4b7d-8f41-b046b0566cb3	datacustodian_access_token	Data Custodian Admin

Bearer 03909715-b0ca-4797-9a9a-601fff1d2848	upload_access_token	Meter Upload Admin

Bearer 53520584-d640-4812-a721-8a1afa459ff7	client_access_token	Third Party Admin

Bearer c66b0854-ea1f-4e24-afb7-afab9e0f6c5e	registration_access_token	Third Party Registration Admin

Bearer f48223ce-92f5-4a41-9028-1a370eb102c5	access_token	Role User (alan -- ID=5)

Bearer ae3e7cba-6478-444a-978c-7505d52034a0	access_token	Role User (charles -- ID=6)

      <form id='api_selector'>

				  Access Token:
				  <input type="text" style="width: 300px; size="300px" name="token" id="input_accessToken"/>

     </form>


text:
LDAP properties for all new users

This option can be used to specifiy properties that will be assigned to
LDAP users when they are created, in addition to those created by
Webmin. They must be entered in the following format :

name1: value1

name2: value2

The following substitutions can be used, which are replaced when the user
is created :

${USER}	The user's login name

${PLAINPASS} The user's un-encrypted password, if one was given

${REAL} The user's real name

${UID} The user's Unix UID number

${GID} The user's Unix group ID number

${HOME} The user's home directory

${SHELL} The user's login shell