text:
/*
 * Utility file that provides various conversion methods for chaging objects
 * back and forth between C and Java JNI.
 */

#include <stdio.h>
#include <stdlib.h>
#include <pcap.h>
#include <jni.h>

#ifndef WIN32
#include <errno.h>
#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <unistd.h>
#endif /*WIN32*/

#include "nio_jmemory.h"
#include "packet_jscanner.h"
#include "jnetpcap_utils.h"
#include "org_jnetpcap_packet_JPacket_State.h"
#include "export.h"

/****************************************************************
 * **************************************************************
 *
 * NON Java declared native functions. Private scan function
 *
 * **************************************************************
 ****************************************************************/
/*
 * finds a specific header instance
 */
jint findHeaderById(packet_state_t *packet, jint id, jint instance) {
//	printf("findHeaderIndex(%d, %d)\n", id, instance);
//	fflush(stdout);

//	if (packet->pkt_instance_counts[id] < instance) {
//		return -1;
//	}

	for (int i = 0; i < packet->pkt_header_count; i ++ ) {
		header_t *header = &packet->pkt_headers[i];

		if (header->hdr_id == id) {

			if (instance == 0) {
				return i;
			} else {
				instance --;
			}
		}
	}

	return -1;
}

/****************************************************************
 * **************************************************************
 *
 * Java declared native functions
 *
 * **************************************************************
 ****************************************************************/

jclass    pcapPacketClass = 0;
jmethodID pcapPacketConstructorMID = 0;

jfieldID pcapStateFID = 0;
jfieldID pcapHeaderFID = 0;

/*
 * Class:     org_jnetpcap_packet_PcapPacket
 * Method:    initIds
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_org_jnetpcap_packet_PcapPacket_initIds
  (JNIEnv *env, jclass clazz) {

	pcapPacketClass = (jclass) env->NewGlobalRef(clazz);

	if ( (pcapPacketConstructorMID = env->GetMethodID(clazz,
			"<init>", "(Lorg/jnetpcap/nio/JMemory$Type;)V")) == NULL) {

		throwException(env, NO_SUCH_METHOD_EXCEPTION,
				"Unable to initialize method PcapPacket(Type)");
		fprintf(stderr, "Unable to initialize method PcapPacket(Type)");
		return;
	}

	if ( ( pcapStateFID = env->GetFieldID(
			clazz,
			"state",
			"Lorg/jnetpcap/packet/JPacket$State;")) == NULL) {

		throwException(env, NO_SUCH_FIELD_EXCEPTION,
				"Unable to initialize field PcapPacket.State:JPacket.State");
		return;
	}

	if ( ( pcapHeaderFID = env->GetFieldID(
			clazz,
			"header",
			"Lorg/jnetpcap/PcapHeader;")) == NULL) {

		throwException(env, NO_SUCH_FIELD_EXCEPTION,
				"Unable to initialize field PcapPacket.header:PcapHeader");
		return;
	}

}

/*
 * Class:     org_jnetpcap_packet_JPacket_State
 * Method:    sizeof
 * Signature: (I)I
 */
JNIEXPORT jint JNICALL Java_org_jnetpcap_packet_JPacket_00024State_sizeof__I
(JNIEnv *env, jclass clazz, jint count) {

	return (jint) sizeof(packet_state_t) + sizeof(header_t) * count;
}

/*
 * Class:     org_jnetpcap_packet_JPacket_State
 * Method:    findHeaderIndex
 * Signature: (II)I
 */
JNIEXPORT jint JNICALL Java_org_jnetpcap_packet_JPacket_00024State_findHeaderIndex
  (JNIEnv *env, jobject obj, jint id, jint instance) {

	packet_state_t *packet = (packet_state_t *)getJMemoryPhysical(env, obj);
	if (packet == NULL) {
		return -1;
	}

	return (jint) findHeaderById(packet, id, instance);
}

/*
 * Class:     org_jnetpcap_packet_JPacket_State
 * Method:    get64BitHeaderMap
 * Signature: (I)J
 */
JNIEXPORT jlong JNICALL Java_org_jnetpcap_packet_JPacket_00024State_get64BitHeaderMap
  (JNIEnv *env, jobject obj, jint index) {

	packet_state_t *packet = (packet_state_t *)getJMemoryPhysical(env, obj);
	if (packet == NULL) {
		return -1;
	}

	return (jlong) packet->pkt_header_map;
}

/*
 * Class:     org_jnetpcap_packet_JPacket_State
 * Method:    getAnalysis
 * Signature: ()Lorg/jnetpcap/analysis/JAnalysis;
 */
JNIEXPORT jobject JNICALL Java_org_jnetpcap_packet_JPacket_00024State_getAnalysis

  (JNIEnv *env, jobject obj) {
	packet_state_t *packet = (packet_state_t *)getJMemoryPhysical(env, obj);
	if (packet == NULL) {
		return NULL;
	}

	return packet->pkt_analysis;
}

/*
 * Class:     org_jnetpcap_packet_JPacket_State
 * Method:    getHeaderCount
 * Signature: ()I
 */
JNIEXPORT jint JNICALL Java_org_jnetpcap_packet_JPacket_00024State_getHeaderCount
  (JNIEnv *env, jobject obj) {

	packet_state_t *packet = (packet_state_t *)getJMemoryPhysical(env, obj);
	if (packet == NULL) {
		return -1;
	}

	return (jint) packet->pkt_header_count;

}

/*
 * Class:     org_jnetpcap_packet_JPacket_State
 * Method:    getInstanceCount
 * Signature: (I)I
 */
JNIEXPORT jint JNICALL Java_org_jnetpcap_packet_JPacket_00024State_getInstanceCount
  (JNIEnv *env, jobject obj, jint id) {

	packet_state_t *packet = (packet_state_t *)getJMemoryPhysical(env, obj);
	if (packet == NULL) {
		return -1;
	}

	int count = 0;
	for (int i = 0; i < packet->pkt_header_count; i ++) {
		if (packet->pkt_headers[i].hdr_id == id) {
			count ++;
		}
	}

	return (jint) count;
}

/*
 * Class:     org_jnetpcap_packet_JPacket_State
 * Method:    getFlags
 * Signature: ()I
 */
JNIEXPORT jint JNICALL Java_org_jnetpcap_packet_JPacket_00024State_getFlags
  (JNIEnv *env, jobject obj) {

	packet_state_t *packet = (packet_state_t *)getJMemoryPhysical(env, obj);
	if (packet == NULL) {
		return -1;
	}

	return (jint) packet->pkt_flags;
}

/*
 * Class:     org_jnetpcap_packet_JPacket_State
 * Method:    setFlags
 * Signature: (I)V
 */
JNIEXPORT void JNICALL Java_org_jnetpcap_packet_JPacket_00024State_setFlags
  (JNIEnv *env, jobject obj, jint jflags) {

	packet_state_t *packet = (packet_state_t *)getJMemoryPhysical(env, obj);
	if (packet == NULL) {
		return;
	}

	packet->pkt_flags = (uint8_t) jflags;
}

/*
 * Class:     org_jnetpcap_packet_JPacket_State
 * Method:    getWirelen
 * Signature: ()I
 */
JNIEXPORT jint JNICALL Java_org_jnetpcap_packet_JPacket_00024State_getWirelen
  (JNIEnv *env, jobject obj) {

	packet_state_t *packet = (packet_state_t *)getJMemoryPhysical(env, obj);
	if (packet == NULL) {
		return -1;
	}

	return (jint) packet->pkt_wirelen;
}

/*
 * Class:     org_jnetpcap_packet_JPacket_State
 * Method:    setWirelen
 * Signature: (I)V
 */
JNIEXPORT void JNICALL Java_org_jnetpcap_packet_JPacket_00024State_setWirelen
  (JNIEnv *env, jobject obj, jint jwirelen) {

	packet_state_t *packet = (packet_state_t *)getJMemoryPhysical(env, obj);
	if (packet == NULL) {
		return;
	}

	packet->pkt_wirelen = (uint32_t) jwirelen;
}

/*
 * Class:     org_jnetpcap_packet_JPacket_State
 * Method:    getFrameNumber
 * Signature: ()J
 */
JNIEXPORT jlong JNICALL Java_org_jnetpcap_packet_JPacket_00024State_getFrameNumber
  (JNIEnv *env, jobject obj) {
	packet_state_t *packet = (packet_state_t *)getJMemoryPhysical(env, obj);
	if (packet == NULL) {
		return -1;
	}

	return (jint) packet->pkt_frame_num;
}

/*
 * Class:     org_jnetpcap_packet_JPacket_State
 * Method:    getHeaderIdByIndex
 * Signature: (I)I
 */
JNIEXPORT jint JNICALL Java_org_jnetpcap_packet_JPacket_00024State_getHeaderIdByIndex
  (JNIEnv *env, jobject obj, jint index) {

	packet_state_t *packet = (packet_state_t *)getJMemoryPhysical(env, obj);
	if (packet == NULL) {
		return -1;
	}

	if (index < 0 || index >= packet->pkt_header_count) {
		throwException(env, INDEX_OUT_OF_BOUNDS_EXCEPTION, "header index out of range");
		return -1;
	}

//	printf("state=%p, index=%d, value=%d, delta=%d\n",
//			packet,
//			(int) index,
//			(int) packet->pkt_headers[index].hdr_id,
//			(int) ((char *)&packet->pkt_headers[index].hdr_id - (char *)packet));
//	fflush(stdout);

	return (jint) packet->pkt_headers[index].hdr_id;

}

/*
 * Class:     org_jnetpcap_packet_JPacket_State
 * Method:    getHeaderLengthByIndex
 * Signature: (I)I
 */
JNIEXPORT jint JNICALL Java_org_jnetpcap_packet_JPacket_00024State_getHeaderLengthByIndex
  (JNIEnv *env, jobject obj, jint index) {

	packet_state_t *packet = (packet_state_t *)getJMemoryPhysical(env, obj);
	if (packet == NULL) {
		return -1;
	}

	if (index < 0 || index >= packet->pkt_header_count) {
		throwException(env, INDEX_OUT_OF_BOUNDS_EXCEPTION, "header index out of range");
		return -1;
	}

	return (jint) packet->pkt_headers[index].hdr_length;
}

/*
 * Class:     org_jnetpcap_packet_JPacket_State
 * Method:    getHeaderOffsetByIndex
 * Signature: (I)I
 */
JNIEXPORT jint JNICALL Java_org_jnetpcap_packet_JPacket_00024State_getHeaderOffsetByIndex
  (JNIEnv *env, jobject obj, jint index) {

	packet_state_t *packet = (packet_state_t *)getJMemoryPhysical(env, obj);
	if (packet == NULL) {
		return -1;
	}

	if (index < 0 || index >= packet->pkt_header_count) {
		throwException(env, INDEX_OUT_OF_BOUNDS_EXCEPTION, "header index out of range");
		return -1;
	}

	return (jint) packet->pkt_headers[index].hdr_offset;
}

/*
 * Class:     org_jnetpcap_packet_JPacket_State
 * Method:    peerHeaderById
 * Signature: (IILorg/jnetpcap/packet/JHeader$State;)I
 */
JNIEXPORT jint JNICALL Java_org_jnetpcap_packet_JPacket_00024State_peerHeaderById
  (JNIEnv *env, jobject obj, jint id, jint instance, jobject dst) {

	packet_state_t *packet = (packet_state_t *)getJMemoryPhysical(env, obj);
	if (packet == NULL) {
		return -1;
	}

	int index = findHeaderById(packet, id, instance);
	if (index == -1) {
		return -1;
	}

	setJMemoryPhysical(env, dst, toLong(&packet->pkt_headers[index]));
	jobject keeper = env->GetObjectField(obj, jmemoryKeeperFID);
	env->SetObjectField(dst, jmemoryKeeperFID, keeper);

	return sizeof(header_t);
}

/*
 * Class:     org_jnetpcap_packet_JPacket_State
 * Method:    peerHeaderByIndex
 * Signature: (ILorg/jnetpcap/packet/JHeader$State;)I
 */
JNIEXPORT jint JNICALL Java_org_jnetpcap_packet_JPacket_00024State_peerHeaderByIndex
  (JNIEnv *env, jobject obj, jint index, jobject dst) {

	packet_state_t *packet = (packet_state_t *)getJMemoryPhysical(env, obj);
	if (packet == NULL) {
		return -1;
	}

	if (index >= packet->pkt_header_count) {
		return -1;
	}

	setJMemoryPhysical(env, dst, toLong(&packet->pkt_headers[index]));

	return sizeof(header_t);
}

/*
 * Class:     org_jnetpcap_packet_JHeader
 * Method:    sizeof
 * Signature: ()I
 */
JNIEXPORT jint JNICALL Java_org_jnetpcap_packet_JHeader_sizeof
  (JNIEnv *env, jclass clazz) {

	return (jint) sizeof(header_t);
}

/*
 * Class:     org_jnetpcap_packet_JPacket_State
 * Method:    toDebugStringJPacketState
 * Signature: ()Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL Java_org_jnetpcap_packet_JPacket_00024State_toDebugStringJPacketState
  (JNIEnv *env, jobject obj) {

	char buf[15 * 1024];
	buf[0] = '\0';

	packet_state_t *packet = (packet_state_t *)getJMemoryPhysical(env, obj);
	if (packet == NULL) {
		return NULL;
	}

	int fr = packet->pkt_frame_num;

	sprintf(buf,
			"JPacket.State#%03d: sizeof(packet_state_t)=%d\n"
			"JPacket.State#%03d: sizeof(header_t)=%d and *%d=%d\n"
			"JPacket.State#%03d:   pkt_header_map=0x%X\n"
			"JPacket.State#%03d:        pkt_flags=0x%x\n"
			"JPacket.State#%03d: pkt_header_count=%d\n"
			"JPacket.State#%03d:      pkt_wirelen=%d\n",
			fr, (int) sizeof(packet_state_t),
			fr, (int) sizeof(header_t),
			(int) packet->pkt_header_count,
			(int) sizeof(header_t) * packet->pkt_header_count,
			fr, (int) packet->pkt_header_map,
			fr, (int) packet->pkt_flags,
			fr, (int) packet->pkt_header_count,
			fr, (int) packet->pkt_wirelen);

	char *p = buf;

	if (packet->pkt_header_count> 32) {
		sprintf(buf + strlen(buf),
				"JPacket.State#%03d: TOO MANY HEADERS (more than 32)",
				fr);

		return env->NewStringUTF(buf);
	}

	p = buf + strlen(buf);

	sprintf(p,
			"JPacket.State#%03d   : "
			"[%10s(%2s/%4s) | %4s |"
			"%7s |"
			"%7s |"
			"%4s | "
			"%7s | "
			"%7s ]\n",
			fr,
			"Protocol",
			"ID",
			"Flag",
			"Start",
			"Prefix",
			"Header",
			"Gap",
			"Payload",
			"Postfix"
			);

	for (int i = 0; i < packet->pkt_header_count; i ++) {
		p = buf + strlen(buf);

		sprintf(p,
				"JPacket.State#%03d[%d]: "
				"[%10s(%2d/%04X) | %5d | "
				"%6d | "
				"%6d | "
				"%3d | "
				"%7d | "
				"%7d ]\n",
				fr,	i,
				id2str(packet->pkt_headers[i].hdr_id),
				packet->pkt_headers[i].hdr_id,
				packet->pkt_headers[i].hdr_flags,
				packet->pkt_headers[i].hdr_offset,
				packet->pkt_headers[i].hdr_prefix,
				packet->pkt_headers[i].hdr_length,
				packet->pkt_headers[i].hdr_gap,
				packet->pkt_headers[i].hdr_payload,
				packet->pkt_headers[i].hdr_postfix
				);

	}

	return env->NewStringUTF(buf);
}


text:
[![wercker status](https://app.wercker.com/status/20b05c4eb17fc957ff322da01bb157fc/s/master "wercker status")](https://app.wercker.com/project/byKey/20b05c4eb17fc957ff322da01bb157fc)
[![Go Report Card](https://goreportcard.com/badge/github.com/skatsuta/monkey-interpreter)](https://goreportcard.com/report/github.com/skatsuta/monkey-interpreter)
[![GoDoc](https://godoc.org/github.com/skatsuta/monkey-interpreter?status.svg)](https://godoc.org/github.com/skatsuta/monkey-interpreter)

Monkey programming language interpreter designed in [_Writing An Interpreter In Go_](https://interpreterbook.com/).

## Usage

Install the Monkey interpreter using `go get`:

```sh
$ go get -v -u github.com/skatsuta/monkey-interpreter/...
```

Then run REPL:

```sh
$ $GOPATH/bin/monkey-interpreter
This is the Monkey programming language!
Feel free to type in commands
>>
```

Or run a Monkey script file (for example `script.monkey` file):

```sh
$ $GOPATH/bin/monkey-interpreter script.monkey
```

## Getting started with Monkey

### Variable bindings and number types

You can define variables using `let` keyword. Supported number types are integers and floating-point numbers.

```sh
>> let a = 1;
>> a
1
>> let b = 0.5;
>> b
0.5
```

### Arithmetic expressions

You can do usual arithmetic operations against numbers, such as `+`, `-`, `*` and `/`.

```sh
>> let a = 10;
>> let b = a * 2;
>> (a + b) / 2 - 3;
12
>> let c = 2.5;
>> b + c
22.5
```

### If expressions

You can use `if` and `else` keywords for conditional expressions. The last value in an executed block are returned from the expression.

```sh
>> let a = 10;
>> let b = a * 2;
>> let c = if (b > a) { 99 } else { 100 };
>> c
99
```

### Functions and closures

You can define functions using `fn` keyword. All functions are closures in Monkey and you must use `let` along with `fn` to bind a closure to a variable. Closures enclose an environment where they are defined, and are evaluated in *the* environment when called. The last value in an executed function body are returned as a return value.

```sh
>> let multiply = fn(x, y) { x * y };
>> multiply(50 / 2, 1 * 2)
50
>> fn(x) { x + 10 }(10)
20
>> let newAdder = fn(x) { fn(y) { x + y }; };
>> let addTwo = newAdder(2);
>> addTwo(3);
5
>> let sub = fn(a, b) { a - b };
>> let applyFunc = fn(a, b, func) { func(a, b) };
>> applyFunc(10, 2, sub);
8
```

### Strings

You can build strings using a pair of double quotes `""`. Strings are immutable values just like numbers. You can concatenate strings with `+` operator.

```sh
>> let makeGreeter = fn(greeting) { fn(name) { greeting + " " + name + "!" } };
>> let hello = makeGreeter("Hello");
>> hello("John");
Hello John!
```

### Arrays

You can build arrays using square brackets `[]`. Arrays can contain any type of values, such as integers, strings, even arrays and functions (closures). To get an element at an index from an array, use `array[index]` syntax.

```sh
>> let myArray = ["Thorsten", "Ball", 28, fn(x) { x * x }];
>> myArray[0]
Thorsten
>> myArray[4 - 2]
28
>> myArray[3](2);
4
```

### Hash tables

You can build hash tables using curly brackets `{}`. Hash literals are `{key1: value1, key2: value2, ...}`. You can use numbers, strings and booleans as keys, and any type of objects as values. To get a value of a key from a hash table, use `hash[key]` syntax.

```sh
>> let myHash = {"name": "Jimmy", "age": 72, true: "yes, a boolean", 99: "correct, an integer"};
>> myHash["name"]
Jimmy
>> myHash["age"]
72
>> myHash[true]
yes, a boolean
>> myHash[99]
correct, an integer
```

### Built-in functions

There are many built-in functions in Monkey, for example `len()`, `first()` and `last()`. Special function, `quote`, returns an unevaluated code block (think it as an AST). Opposite function to `quote`, `unquote`, evaluates code inside `quote`.

```sh
>> len("hello");
5
>> len("∑");
3
>> let myArray = ["one", "two", "three"];
>> len(myArray)
3
>> first(myArray)
one
>> rest(myArray)
[two, three]
>> last(myArray)
three
>> push(myArray, "four")
[one, two, three, four]
>> puts("Hello World")
Hello World
nil
>> quote(2 + 2)
Quote((2 + 2)) # Unevaluated code
>> quote(unquote(1 + 2))
Quote(3)
```

### Macros

You can define macros using `macro` keyword. Note that macro definitions must return `Quote` objects generated from `quote` function.

```sh
# Define `unless` macro which does the opposite to `if`
>> let unless = macro(condition, consequence, alternative) {
     quote(
       if (!(unquote(condition))) {
         unquote(consequence);
       } else {
         unquote(alternative);
       }
     );
   };
>> unless(10 > 5, puts("not greater"), puts("greater"));
greater
nil
```

redpajama_set_name: RedPajamaGithub


text:
<?php

/**
 * The model corresponds to equipment table. It contains equipment name.
 *
 * @Author: Yi-Ming, Huang <aming>
 * @Date:   2015-11-19T14:59:59+08:00
 * @Email:  ym.huang0808@gmail.com
 * @Project: VMS
 * @Last modified by:   aming
 * @Last modified time: 2016-07-29T15:52:17+08:00
 * @License: GPL-3
 */

namespace App;

use Illuminate\Database\Eloquent\Model;
use App\Traits\CandidateKeywordsTrait;

class Equipment extends Model
{
    /*
     * CandidateKeywordsTrait queries candidiated equipment keyword.
     */
    use CandidateKeywordsTrait;

    /**
     * Table name
     *
     * @var string
     */
    protected $table = 'equipment';

    /**
     * The attributes are allowed to be mass assignable.
     *
     * @var array
     */
    protected $fillable = ['name'];

    /**
     * The attributes that should be visible in arrays.
     *
     * @var array
     */
    protected $visible = [
        'id',
        'name'
    ];

    /**
     * The attributes that should be casted to native types.
     *
     * @var array
     */
    protected $casts = [
        'id' => 'integer'
    ];

    /**
     * Relationship with App\Volunteer model.
     * It represents the equipment belongs to volunteers.
     *
     * @return [type] [description]
     */
    public function volunteers()
    {
        return $this->belongsToMany('App\Volunteer');
    }
}


text:
title:  Crisi di autorità
date:  02/01/2021
---

### Letture
Isaia 6:1-13

>

> «Nell'anno della morte del re Uzzia, vidi il Signore seduto sopra un trono alto, molto elevato, e i lembi del suo mantello riempivano il tempio» Isaia 6:1

Quando uno dei suoi discepoli gli chiese quali fossero gli ingredienti per governare bene, Confucio rispose: «Cibo a sufficienza, armi a sufficienza e la fiducia della gente comune». «Ma» ribatté il discepolo «immagina di non avere scelta e poter offrire solo una di quelle tre cose, a quale rinunceresti?». «Le armi», disse Confucio. Il discepolo insistette. «Immagina di dover rinunciare a un'altra cosa, a quale rinunceresti?». «Al cibo» replicò Confucio. «Perché fino dall'antichità tutti gli uomini hanno conosciuto la fame, ma un popolo che non ha più fiducia in chi lo governa è davvero perduto» – Michael P. Green, 1500 Illustrations for Biblical Preaching, Grand Rapids, Mich.: Baker Books, 1989, p. 215.

La gente vuole una leadership forte e attendibile. Un soldato stava per firmare il suo secondo arruolamento, quando l'ufficiale di reclutamento gli domandò come mai volesse tornare nell'esercito. Il ragazzo rispose: «Ho provato la vita civile, ma nessuno è al comando là fuori».

Questa settimana studieremo la crisi di leadership del regno di Giuda e le tristi conseguenze che ne derivarono.


text:
/**
 * Page provider
 */
Aria.classDefinition({
    $classpath : "test.aria.pageEngine.pageEngine.site.PageProviderSix",
    $implements : ["aria.pageEngine.pageProviders.PageProviderInterface"],
    $constructor : function (animations) {
        this._animations = animations;
    },
    $prototype : {

        /**
         * @param {aria.pageEngine.CfgBeans.ExtendedCallback} callback
         */
        loadSiteConfig : function (callback) {
            var siteConfig = {
                appData : {},
                containerId : "at-main",
                animations : this._animations
            };

            if (this._navigation) {
                siteConfig.navigation = this._navigation;
            }
            this.$callback(callback.onsuccess, siteConfig);

        },

        /**
         * @param {String} pageId Id of the page
         * @param {aria.pageEngine.CfgBeans.ExtendedCallback} callback
         */
        loadPageDefinition : function (pageRequest, callback) {
            var pageId = pageRequest.pageId;
            if ((!pageId) || (pageId == "aaa")) {
                this.$callback(callback.onsuccess, {
                    pageId : "aaa",
                    url : "/pageEngine/aaa",
                    animation : {
                        animateIn : "slide left",
                        animateOut : "slide left",
                        type : 1
                    },
                    contents : {
                        menus : {
                            mymenu : []
                        },
                        placeholderContents : {}
                    },
                    pageComposition : {
                        template : "test.aria.pageEngine.pageEngine.site.templates.providerSix.MainLayout",
                        placeholders : {
                            "body" : {
                                template : "test.aria.pageEngine.pageEngine.site.templates.providerSix.Body"
                            }
                        },
                        pageData : {
                            name : "aaa"
                        }
                    }
                });
            }
            if (pageId == "bbb") {
                this.$callback(callback.onsuccess, {
                    pageId : "bbb",
                    url : "/pageEngine/bbb",
                    animation : null,
                    contents : {
                        menus : {
                            mymenu : []
                        },
                        placeholderContents : {}
                    },
                    pageComposition : {
                        template : "test.aria.pageEngine.pageEngine.site.templates.providerSix.MainLayout",
                        placeholders : {
                            "body" : {
                                template : "test.aria.pageEngine.pageEngine.site.templates.providerSix.Body"
                            }
                        },
                        pageData : {
                            name : "bbb"
                        }
                    }
                });
            }
            if (pageId == "ccc") {
                this.$callback(callback.onsuccess, {
                    pageId : "ccc",
                    url : "/pageEngine/ccc",
                    animation : {
                        animateOut : "pop",
                        animateIn : "fade",
                        type : 3
                    },
                    contents : {
                        menus : {
                            mymenu : []
                        },
                        placeholderContents : {}
                    },
                    pageComposition : {
                        template : "test.aria.pageEngine.pageEngine.site.templates.providerSix.MainLayout",
                        placeholders : {
                            "body" : {
                                template : "test.aria.pageEngine.pageEngine.site.templates.providerSix.Body"
                            }
                        },
                        pageData : {
                            name : "ccc"
                        }
                    }
                });
            }
        }
    }
});


text:
<?xml version="1.0" encoding="utf-8" ?>

<collections>
  <collection>
    <name>Cure/inflict light wounds</name>
    <entry>1</entry>
  </collection>
  <collection>
    <name>Cure/inflict moderate wounds</name>
    <entry>2</entry>
  </collection>
  <collection>
    <name>Cure/inflict serious wounds</name>
    <entry>3</entry>
  </collection>
  <collection>
    <name>Cure/inflict critical wounds</name>
    <entry>4</entry>
  </collection>
  <collection>
    <name>Mass cure/inflict light wounds</name>
    <entry>5</entry>
  </collection>
  <collection>
    <name>Heal/Harm</name>
    <entry>6</entry>
  </collection>
  <collection>
    <name>Regenerate</name>
    <entry>7</entry>
  </collection>
  <collection>
    <name>Mass cure/inflict critical wounds</name>
    <entry>8</entry>
  </collection>
  <collection>
    <name>Mass heal/harm</name>
    <entry>9</entry>
  </collection>
</collections>


text:
require 'minitest/autorun'
require_relative 'test_connect'
require_relative 'test_query'


text:
      <button ng-click="try_changing_the_tree_data()" class="btn btn-default btn-block m-b">Change The Tree Definition</button>
      <button ng-click="try_async_load()" class="btn btn-default btn-block">Load Tree Data Asynchronously</button>

Test the Tree Control API:

      <button ng-click="my_tree.select_first_branch()" class="btn btn-default btn-sm">First Branch</button>

        <button ng-click="my_tree.select_next_sibling()" class="btn btn-default btn-sm">Next Sibling</button>
        <button ng-click="my_tree.select_prev_sibling()" class="btn btn-default btn-sm">Prev Sibling</button>

        <button ng-click="my_tree.select_next_branch()" class="btn btn-default btn-sm">Next Branch</button>
        <button ng-click="my_tree.select_prev_branch()" class="btn btn-default btn-sm">Prev Branch</button>

      <button ng-click="my_tree.select_parent_branch()" class="btn btn-default btn-sm">Parent</button>

        <button ng-click="my_tree.expand_branch()" class="btn btn-default btn-sm">Expand</button>
        <button ng-click="my_tree.collapse_branch()" class="btn btn-default btn-sm">Collapse</button>

        <button ng-click="my_tree.expand_all()" class="btn btn-default btn-sm">Expand All</button>
        <button ng-click="my_tree.collapse_all()" class="btn btn-default btn-sm">Collapse All</button>

      <button ng-click="try_adding_a_branch()" class="btn btn-success btn-sm"> Add Branch</button>

        ...loading...
        <abn-tree
          tree-data         = "my_data"
          tree-control      = "my_tree"
          on-select         = "my_tree_handler(branch)"
          expand-level      = "2"
          initial-selection = "Granny Smith"
          icon-leaf         = "fa fa-file-o"
          icon-expand       = "fa fa-plus"
          icon-collapse     = "fa fa-minus"
          >
        </abn-tree>

{{output}}


text:
package simx.core.worldinterface.entity

import java.util.UUID

import simx.core.entity.Entity
import simx.core.svaractor.SVarActor
import simx.core.worldinterface.entity.filter.EntityFilter

/**
 * Created by martin
 * on 21/04/15.
 */
private[worldinterface] case class EntityAppearance(e : Entity, reference: UUID)
private[worldinterface] case class RequestEntities(filter: EntityFilter)
private[worldinterface] case class AddOnEntityAppearanceListener(actor : SVarActor.Ref, filter: EntityFilter, reference: UUID = UUID.randomUUID())
private[worldinterface] case class OnOneEntityAppearance(filter: EntityFilter)
private[worldinterface] case class OnNextEntityAppearance(filter: EntityFilter)


text:
var expect = require('expect.js');
var utils = require('../src/utils');
require('mocha');

describe('Utils module', function () {
	it('capitalize should handle null', function (done) {
		expect(utils.capitalize(null)).to.be(null);
		done();
	});
	it('capitalize should handle single chars', function (done) {
		expect(utils.capitalize('a')).to.be('A');
		done();
	});
	it('capitalize should handle longer strings', function (done) {
		expect(utils.capitalize('abc')).to.be('Abc');
		done();
	});
});


text:
package org.kordamp.json.processors;

import junit.framework.TestCase;

import java.util.HashSet;
import java.util.Set;

/**
 * @author Andres Almiray
 */
public class TestDefaultPropertyNameProcessorMatcher extends TestCase {
    public void testDefault() {
        PropertyNameProcessorMatcher matcher = PropertyNameProcessorMatcher.DEFAULT;

        assertNull(matcher.getMatch(null, null));
        assertNull(matcher.getMatch(Long.class, null));
        assertNull(matcher.getMatch(null, new HashSet()));
        assertNull(matcher.getMatch(Long.class, new HashSet()));
        Set set = new HashSet();
        set.add(Long.class);
        assertNotNull(matcher.getMatch(Long.class, set));
        assertEquals(Long.class, matcher.getMatch(Long.class, set));
    }
}


text:
class CMessageList : public CListView
{
protected:
	CMessageList();           // protected constructor used by dynamic creation
	DECLARE_DYNCREATE(CMessageList)

// Attributes
public:
	int				m_LastMessageId;

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMessageList)
	public:
	virtual void OnInitialUpdate();
	protected:
	virtual void OnDraw(CDC* pDC);      // overridden to draw this view
	//}}AFX_VIRTUAL

// Implementation
protected:
	virtual ~CMessageList();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

	// Generated message map functions
protected:
	//{{AFX_MSG(CMessageList)
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnDblclk(NMHDR* pNMHDR, LRESULT* pResult);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_MESSAGELIST_H__FA3B20B4_810B_11D5_BA96_00C0DF22DE85__INCLUDED_)


text:
package com.vaporwarecorp.mirror.feature.main;

import android.app.Activity;
import android.widget.RelativeLayout;

import com.robopupu.api.mvp.Presenter;
import com.robopupu.api.mvp.View;
import com.robopupu.api.plugin.PlugInterface;
import com.vaporwarecorp.mirror.feature.forecast.model.Forecast;

@PlugInterface
public interface MainView extends View {
// -------------------------- OTHER METHODS --------------------------

    Activity activity();

    void displaySearchPanel();

    void displaySearchPanelSearching();

    void displayView();

    void finish();

    Class<? extends Presenter> getMainPresenterClass();

    void hideSearchPanel();

    void hideView();

    boolean isKeywordSpotting();

    void moveCenterToLeftContainer();

    void moveCenterToRightContainer();

    void moveLeftToCenterContainer();

    void moveRightToCenterContainer();

    void searchPanelVolume(int volume);

    void setForecast(Forecast forecast);

    void startKeywordSpotting();

    void stopKeywordSpotting();
}


text:
'use strict';

var Probe = require('../lib/probe.js');
var aspect = require('../lib/aspect.js');
var request = require('../lib/request.js');
var am = require('../');
var util = require('util');

function loopbackDJProbe() {
  Probe.call(this, 'loopback-datasource-juggler');
}
util.inherits(loopbackDJProbe, Probe);

function aspectJugglerMethod(target, methods, probe) {
  aspect.before(target, methods, function(target, methodName, methodArgs, probeData) {
    probe.metricsProbeStart(probeData, target, methodName, methodArgs);
    probe.requestProbeStart(probeData, target, methodName, methodArgs);
    if (aspect.findCallbackArg(methodArgs) != undefined) {
      aspect.aroundCallback(methodArgs, probeData, function(target, args, probeData) {
        // Call the transaction link with a name and the callback for strong trace
        var callbackPosition = aspect.findCallbackArg(methodArgs);
        if (typeof callbackPosition != 'undefined') {
          aspect.strongTraceTransactionLink('loopback-datasource-juggler: ', methodName, methodArgs[callbackPosition]);
        }

        probe.metricsProbeEnd(probeData, methodName, methodArgs);
        probe.requestProbeEnd(probeData, methodName, methodArgs);
      });
    }
  });
}

// Attaches probe to module
loopbackDJProbe.prototype.attach = function(name, target) {
  var that = this;
  if (name != 'loopback-datasource-juggler') return target;
  if (target.__ddProbeAttached__) return target;

  // functions of DataAccessObject inherited from PersistedModel
  var commands = ['create', 'findOrCreate', 'exists', 'find', 'findById', 'remove', 'removeById', 'count'];
  var instanceCommands = ['save', 'remove', 'updateAttribute', 'updateAttributes', 'reload'];
  var dao = target.Schema.DataAccessObject;

  aspectJugglerMethod(dao, commands, that); // Instrument class methods
  aspectJugglerMethod(dao.prototype, instanceCommands, that); // Instrument instance methods

  return target;
};

/*
 * Lightweight metrics probe for Postgres queries
 *
 * These provide:
 * 		time:		time event started
 * 		query:		The command the juggler has executed
 * 		duration:	the time for the request to respond
 */
loopbackDJProbe.prototype.metricsEnd = function(probeData, method, methodArgs) {
  if (probeData && probeData.timer) {
    probeData.timer.stop();
    var eventTimer = probeData.timer;
    am.emit('loopback-datasource-juggler', {
      time: eventTimer.startTimeMillis,
      method: method,
      duration: eventTimer.timeDelta,
    });
  }
};

/*
 * Heavyweight request probes for juggler commands
 */
loopbackDJProbe.prototype.requestStart = function(probeData, target, method, methodArgs) {
  probeData.req = request.startRequest('loopback-datasource-juggler', 'query');
  probeData.req.setContext({ loopbackDJProbe: methodArgs[0] });
};

loopbackDJProbe.prototype.requestEnd = function(probeData, method, methodArgs) {
  if (probeData && probeData.req) probeData.req.stop({ loopbackDJProbe: methodArgs[0] });
};

module.exports = loopbackDJProbe;


text:
// Copyright 2008 Google Inc. All Rights Reserved.
package com.google.appengine.demos.helloorm;

import java.io.IOException;

import javax.jdo.PersistenceManager;
import javax.persistence.EntityManager;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author Max Ross <maxr@google.com>
 */
public class DeleteFlight extends HttpServlet {

  public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    String key = req.getParameter("key");
    if (key == null) {
      resp.getWriter().println("No key provided.");
    }
    if (PersistenceStandard.get() == PersistenceStandard.JPA) {
      doPostJPA(Long.valueOf(key));
    } else {
      doPostJDO(Long.valueOf(key));
    }
    resp.sendRedirect("/");
  }

  private void doPostJDO(long key) {
    PersistenceManager pm = PMF.get().getPersistenceManager();
    try {
      Flight f = pm.getObjectById(Flight.class, key);
      pm.deletePersistent(f);
    } finally {
      if (pm.currentTransaction().isActive()) {
        pm.currentTransaction().rollback();
      }
      pm.close();
    }
  }

  private void doPostJPA(long key) {
    EntityManager em = EMF.get().createEntityManager();
    try {
      Flight f = em.find(Flight.class, key);
      em.remove(f);
    } finally {
      em.close();
    }
  }

}


text:
package main

type Kind int

const (
	Settings Kind = 1
	Search   Kind = 2
	Other    Kind = 4
)

func isSettings(k Kind) bool { return k&Settings != 0 }
func isSearch(k Kind) bool   { return k&Search != 0 }

type Option struct {
	Name                          string
	Kind                          Kind
	DefaultValue                  interface{} // Leave nil to prevent generation (used for hand-written options)
	BackwardCompatibleAlternative string
}

// Full reference of all settings and search parameters can be found here:
// https://www.algolia.com/doc/api-reference/api-parameters/

var options = []Option{
	// Attributes
	{"searchableAttributes", Settings, []string{}, "attributesToIndex"},
	{"attributesForFaceting", Settings, []string{}, ""},
	{"unretrievableAttributes", Settings, []string{}, ""},
	{"attributesToRetrieve", Settings | Search, []string{"*"}, ""},
	{"restrictSearchableAttributes", Search, []string{}, ""},

	// Ranking
	{"ranking", Settings, []string{"typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"}, ""},
	{"customRanking", Settings, []string{}, ""},
	{"replicas", Settings, []string{}, "slaves"},
	{"primary", Settings, "", ""},

	// Filtering
	{"filters", Search, "attribute", ""},
	{"facetFilters", Search, nil, ""},
	{"optionalFilters", Search, nil, ""},
	{"numericFilters", Search, nil, ""},
	{"tagFilters", Search, nil, ""},
	{"sumOrFiltersScores", Search, false, ""},

	// Faceting
	{"facets", Search, []string{}, ""},
	{"maxValuesPerFacet", Settings | Search, 100, ""},
	{"facetingAfterDistinct", Search, false, ""},
	{"sortFacetValuesBy", Settings | Search, "count", ""},

	// Highlighting / Snippeting
	{"attributesToHighlight", Settings | Search, []string{}, ""},
	{"attributesToSnippet", Settings | Search, []string{}, ""},
	{"highlightPreTag", Settings | Search, "<em>", ""},
	{"highlightPostTag", Settings | Search, "</em>", ""},
	{"snippetEllipsisText", Settings | Search, "…", ""},
	{"restrictHighlightAndSnippetArrays", Settings | Search, false, ""},

	// Pagination
	{"page", Search, 0, ""},
	{"hitsPerPage", Settings | Search, 20, ""},
	{"offset", Search, 0, ""},
	{"length", Search, 0, ""},
	{"paginationLimitedTo", Settings, 1000, ""},

	// Typos
	{"minWordSizefor1Typo", Settings | Search, 4, ""},
	{"minWordSizefor2Typos", Settings | Search, 8, ""},
	{"typoTolerance", Settings | Search, nil, ""},
	{"allowTyposOnNumericTokens", Settings | Search, true, ""},
	{"disableTypoToleranceOnAttributes", Settings | Search, []string{}, ""},
	{"disableTypoToleranceOnWords", Settings, []string{}, ""},
	{"separatorsToIndex", Settings, "", ""},

	// Geo Search
	{"aroundLatLng", Search, "", ""},
	{"aroundLatLngViaIP", Search, false, ""},
	{"aroundRadius", Search, nil, ""},
	{"aroundPrecision", Search, nil, ""},
	{"minimumAroundRadius", Search, 0, ""},
	{"insideBoundingBox", Search, nil, ""},
	{"insidePolygon", Search, nil, ""},

	// Languages
	{"ignorePlurals", Settings | Search, nil, ""},
	{"removeStopWords", Settings | Search, nil, ""},
	{"camelCaseAttributes", Settings, []string{}, ""},
	{"decompoundedAttributes", Settings, map[string][]string{}, ""},
	{"keepDiacriticsOnCharacters", Settings, "", ""},
	{"queryLanguages", Settings | Search, []string{}, ""},
	{"indexLanguages", Settings, []string{}, ""},
	{"customNormalization", Settings, map[string]map[string]string{}, ""},

	// Query strategy
	{"queryType", Settings | Search, "prefixLast", ""},
	{"removeWordsIfNoResults", Settings | Search, "none", ""},
	{"advancedSyntax", Settings | Search, false, ""},
	{"optionalWords", Settings | Search, []string{}, ""},
	{"disablePrefixOnAttributes", Settings, []string{}, ""},
	{"disableExactOnAttributes", Settings | Search, []string{}, ""},
	{"exactOnSingleWordQuery", Settings | Search, "attribute", ""},
	{"alternativesAsExact", Settings | Search, []string{"ignorePlurals", "singleWordSynonym"}, ""},
	{"advancedSyntaxFeatures", Settings | Search, []string{"exactPhrase", "excludeWords"}, ""},
	{"similarQuery", Search, "", ""},
	{"enableABTest", Search, true, ""},

	// Query rules
	{"enableRules", Settings | Search, true, ""},
	{"ruleContexts", Search, []string{}, ""},
	{"enabled", Other, true, ""}, // Used to enable the rule by default

	// Personalization
	{"enablePersonalization", Search, false, ""},
	{"personalizationImpact", Search, 100, ""},
	{"userToken", Search, "", ""},

	// Performance
	{"numericAttributesForFiltering", Settings, []string{}, "numericAttributesToIndex"},
	{"allowCompressionOfIntegerArray", Settings, false, ""},

	// Advanced
	{"attributeForDistinct", Settings, "", ""},
	{"distinct", Settings | Search, nil, ""},
	{"getRankingInfo", Search, false, ""},
	{"clickAnalytics", Search, false, ""},
	{"analytics", Search, true, ""},
	{"analyticsTags", Search, []string{}, ""},
	{"synonyms", Search, true, ""},
	{"replaceSynonymsInHighlight", Settings | Search, true, ""},
	{"minProximity", Settings | Search, 1, ""},
	{"responseFields", Settings | Search, []string{"*"}, ""},
	{"maxFacetHits", Settings | Search, 10, ""},
	{"percentileComputation", Search, true, ""},
	{"explain", Search, []string{}, ""},
	{"advanced", Settings, 0, ""},
	{"attributeCriteriaComputedByMinProximity", Settings | Search, false, ""},
	{"userData", Settings, map[string]interface{}{}, ""},

	// Secured API key
	{"restrictIndices", Other, []string{}, ""},
	{"restrictSources", Other, "", ""},
	{"validUntil", Other, nil, ""},
	{"referers", Other, []string{}, ""},

	// Other
	{"query", Other, "", ""},
	{"autoGenerateObjectIDIfNotExist", Other, false, ""},
	{"clearExistingRules", Other, false, ""},
	{"replaceExistingSynonyms", Other, false, ""},
	{"type", Other, []string{}, ""},
	{"createIfNotExists", Other, true, ""},
	{"forwardToReplicas", Other, false, ""},
	{"anchoring", Other, "", ""},
	{"extraHeaders", Other, map[string]string{}, ""},
	{"extraOptions", Other, map[string]interface{}{}, ""},
	{"extraURLParams", Other, map[string]string{}, ""},
	{"scopes", Other, []string{}, ""},
	{"cluster", Other, "", ""},
	{"indexName", Other, "", ""},
	{"limit", Other, 10, ""},
	{"safe", Other, false, ""},
	{"filterPromotes", Other, false, ""},
}


text:
'use strict';

const FunctionBuilderBase = require('../function-builder-base');
const CPUFunctionNode = require('./function-node');

/**
 * @class CPUFunctionBuilder
 *
 * @extends FunctionBuilderBase
 *
 * @desc Builds functions to execute on CPU from JavaScript function Strings
 *
 */
module.exports = class CPUFunctionBuilder extends FunctionBuilderBase {
	addFunction(functionName, jsFunction, paramTypes, returnType) {
		this.addFunctionNode(
			new CPUFunctionNode(functionName, jsFunction, paramTypes, returnType)
			.setAddFunction(this.addFunction.bind(this))
		);
	}

	/**
	 * @memberOf CPUFunctionBuilder#
	 * @function
	 * @name getPrototypeString
	 *
	 * @desc Return the JS Function String optimized for cpu.
	 *
	 * @param {String} functionName - Function name to trace from. If null, it returns the WHOLE builder stack
	 *
	 * @returns {String} Function String
	 *
	 */
	getPrototypeString() {
		let ret = '';
		for (let p in this.nodeMap) {
			if (!this.nodeMap.hasOwnProperty(p)) continue;
			const node = this.nodeMap[p];
			if (node.isSubKernel) {
				ret += `var ${ node.functionName } = ` + node.jsFunctionString.replace('return', `return ${ node.functionName }Result[this.thread.z][this.thread.y][this.thread.x] =`) + '.bind(this);\n';
			} else {
				ret += `var ${ node.functionName } = ${ node.jsFunctionString }.bind(this);\n`;
			}
		}
		return ret;
	}

	/**
	 * @memberOf CPUFunctionBuilder#
	 * @function
	 * @name addSubKernel
	 *
	 * @desc Add a new sub-kernel to the current kernel instance
	 *
	 * @param {Function} jsFunction - Sub-kernel function (JavaScript)
	 * @param {Array} paramNames - Parameters of the sub-kernel
	 * @param {Array} returnType - Return type of the subKernel
	 *
	 */
	addSubKernel(jsFunction, paramTypes, returnType) {
		const node = new CPUFunctionNode(null, jsFunction, paramTypes, returnType)
			.setAddFunction(this.addFunction.bind(this));
		node.isSubKernel = true;
		this.addFunctionNode(node);
	}

	polyfillStandardFunctions() {}
};


text:
import os
from hyperstream import MultiOutputTool, StreamInstance, StreamMetaInstance

from dateutil.parser import parse

def my_float(x):
    try:
        return float(x)
    except:
        return None

class CsvMultiReader(MultiOutputTool):
    def __init__(self, filename_template, datetime_parser=parse,
                 datetime_column=0, skip_rows=0, header=True):
        super(CsvMultiReader, self).__init__(
            filename_template=filename_template,
            datetime_parser=datetime_parser,
            datetime_column=datetime_column,
            skip_rows=skip_rows,
            header=header
        )

    def _execute(self, source, splitting_stream, interval, meta_data_id,
                 output_plate_values):

        # Let's make the assumption that the first field is the timestamp

        for pv in output_plate_values:
            count = 0

            if len(pv) > 1:
                raise NotImplementedError("Nested plates not supported for this tool")

            # Unpack the plate value
            ((meta_data_id, plate_value),) = pv

            filename = self.filename_template.format(plate_value)

            if not os.path.isfile(filename):
                continue

            with open(filename, 'rU') as f:
                for line in f.readlines():
                    if count == 0:
                        if self.header:
                            colnames = [name.replace('\n', '') for name in line.split(',')]
                            del colnames[self.datetime_column]
                        count += 1
                        continue
                    count += 1
                    if count < self.skip_rows + 1:
                        continue
                    elements = line.split(',')
                    dt = self.datetime_parser(elements[self.datetime_column])
                    del elements[self.datetime_column]
                    if dt in interval:
                        if self.header:
                            values = dict(zip(colnames, map(my_float, elements)))
                        else:
                            values = map(float, elements)
                        instance = StreamInstance(dt, values)
                        yield StreamMetaInstance(instance, (meta_data_id, plate_value))


text:
class OrganizationsController < ApplicationController

  # GET /organizations/1
  # GET /organizations/1.json
  def show
    render json: @organization
  end

  # PATCH/PUT /organizations/1
  # PATCH/PUT /organizations/1.json
  def update
    if @organization.update(organization_params)
      head :no_content
    else
      render json: @organization.errors, status: :unprocessable_entity
    end
  end

  private

  def organization_params
    params.require(:organization).permit(:name)
  end
end


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ChangeListManager">
    <list default="true" id="07295370-9428-4952-aa3d-f5e54fdce06c" name="Default" comment="">
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pyqt5_lesson1.py" afterPath="$PROJECT_DIR$/pyqt5_lesson1.py" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pyqt5_lesson10.py" afterPath="$PROJECT_DIR$/pyqt5_lesson10.py" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pyqt5_lesson11.py" afterPath="$PROJECT_DIR$/pyqt5_lesson11.py" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pyqt5_lesson12.py" afterPath="$PROJECT_DIR$/pyqt5_lesson12.py" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pyqt5_lesson13.py" afterPath="$PROJECT_DIR$/pyqt5_lesson13.py" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pyqt5_lesson14.py" afterPath="$PROJECT_DIR$/pyqt5_lesson14.py" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pyqt5_lesson15.py" afterPath="$PROJECT_DIR$/pyqt5_lesson15.py" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pyqt5_lesson2.py" afterPath="$PROJECT_DIR$/pyqt5_lesson2.py" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pyqt5_lesson3.py" afterPath="$PROJECT_DIR$/pyqt5_lesson3.py" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pyqt5_lesson4.py" afterPath="$PROJECT_DIR$/pyqt5_lesson4.py" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pyqt5_lesson5.py" afterPath="$PROJECT_DIR$/pyqt5_lesson5.py" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pyqt5_lesson6.py" afterPath="$PROJECT_DIR$/pyqt5_lesson6.py" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pyqt5_lesson7.py" afterPath="$PROJECT_DIR$/pyqt5_lesson7.py" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pyqt5_lesson8.py" afterPath="$PROJECT_DIR$/pyqt5_lesson8.py" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pyqt5_lesson9.py" afterPath="$PROJECT_DIR$/pyqt5_lesson9.py" />
    </list>
    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
    <option name="TRACKING_ENABLED" value="true" />
    <option name="SHOW_DIALOG" value="false" />
    <option name="HIGHLIGHT_CONFLICTS" value="true" />
    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
    <option name="LAST_RESOLUTION" value="IGNORE" />
  </component>
  <component name="CreatePatchCommitExecutor">
    <option name="PATCH_PATH" value="" />
  </component>
  <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
  <component name="FileEditorManager">
    <leaf SIDE_TABS_SIZE_LIMIT_KEY="300" />
  </component>
  <component name="FindInProjectRecents">
    <findStrings>
      <find>gpl</find>
      <find>GPL</find>
      <find>GPL-</find>
    </findStrings>
    <replaceStrings>
      <replace>MIT</replace>
      <replace>MIT-</replace>
    </replaceStrings>
    <dirStrings>
      <dir>$PROJECT_DIR$</dir>
    </dirStrings>
  </component>
  <component name="Git.Settings">
    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
  </component>
  <component name="IdeDocumentHistory">
    <option name="CHANGED_PATHS">
      <list>
        <option value="$PROJECT_DIR$/pyqt5_lesson1.py" />
        <option value="$PROJECT_DIR$/pyqt5_lesson2.py" />
        <option value="$PROJECT_DIR$/pyqt5_lesson3.py" />
        <option value="$PROJECT_DIR$/pyqt5_lesson4.py" />
        <option value="$PROJECT_DIR$/pyqt5_lesson5.py" />
        <option value="$PROJECT_DIR$/pyqt5_lesson6.py" />
        <option value="$PROJECT_DIR$/pyqt5_lesson7.py" />
        <option value="$PROJECT_DIR$/pyqt5_lesson8.py" />
        <option value="$PROJECT_DIR$/pyqt5_lesson9.py" />
        <option value="$PROJECT_DIR$/pyqt5_lesson10.py" />
        <option value="$PROJECT_DIR$/pyqt5_lesson11.py" />
        <option value="$PROJECT_DIR$/pyqt5_lesson12.py" />
        <option value="$PROJECT_DIR$/pyqt5_lesson13.py" />
        <option value="$PROJECT_DIR$/pyqt5_lesson14.py" />
        <option value="$PROJECT_DIR$/pyqt5_lesson15.py" />
      </list>
    </option>
  </component>
  <component name="ProjectFrameBounds">
    <option name="x" value="58" />
    <option name="y" value="60" />
    <option name="width" value="1176" />
    <option name="height" value="836" />
  </component>
  <component name="ProjectView">
    <navigator currentView="ProjectPane" proportions="" version="1">
      <flattenPackages />
      <showMembers />
      <showModules />
      <showLibraryContents />
      <hideEmptyPackages />
      <abbreviatePackageNames />
      <autoscrollToSource />
      <autoscrollFromSource />
      <sortByType />
      <manualOrder />
      <foldersAlwaysOnTop value="true" />
    </navigator>
    <panes>
      <pane id="Scratches" />
      <pane id="ProjectPane">
        <subPane>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="pythonprogramming" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="pythonprogramming" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
        </subPane>
      </pane>
      <pane id="Scope" />
    </panes>
  </component>
  <component name="PropertiesComponent">
    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
  </component>
  <component name="RecentsManager">
    <key name="CopyFile.RECENT_KEYS">
      <recent name="$PROJECT_DIR$" />
    </key>
  </component>
  <component name="RunManager" selected="Python.pyqt5_lesson1">
    <configuration default="false" name="pyqt5_lesson15" type="PythonConfigurationType" factoryName="Python" temporary="true">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs>
        <env name="PYTHONUNBUFFERED" value="1" />
      </envs>
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
      <option name="IS_MODULE_SDK" value="true" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="pythonprogramming" />
      <option name="SCRIPT_NAME" value="$PROJECT_DIR$/pyqt5_lesson15.py" />
      <option name="PARAMETERS" value="" />
      <option name="SHOW_COMMAND_LINE" value="false" />
      <method />
    </configuration>
    <configuration default="false" name="pyqt5_lesson1" type="PythonConfigurationType" factoryName="Python" temporary="true">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs>
        <env name="PYTHONUNBUFFERED" value="1" />
      </envs>
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
      <option name="IS_MODULE_SDK" value="true" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="pythonprogramming" />
      <option name="SCRIPT_NAME" value="$PROJECT_DIR$/pyqt5_lesson1.py" />
      <option name="PARAMETERS" value="" />
      <option name="SHOW_COMMAND_LINE" value="false" />
      <method />
    </configuration>
    <configuration default="true" type="PythonConfigurationType" factoryName="Python">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs>
        <env name="PYTHONUNBUFFERED" value="1" />
      </envs>
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="" />
      <option name="IS_MODULE_SDK" value="false" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="pythonprogramming" />
      <option name="SCRIPT_NAME" value="" />
      <option name="PARAMETERS" value="" />
      <option name="SHOW_COMMAND_LINE" value="false" />
      <method />
    </configuration>
    <configuration default="true" type="Tox" factoryName="Tox">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs />
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="" />
      <option name="IS_MODULE_SDK" value="false" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="pythonprogramming" />
      <method />
    </configuration>
    <configuration default="true" type="tests" factoryName="Attests">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs />
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="" />
      <option name="IS_MODULE_SDK" value="false" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="pythonprogramming" />
      <option name="SCRIPT_NAME" value="" />
      <option name="CLASS_NAME" value="" />
      <option name="METHOD_NAME" value="" />
      <option name="FOLDER_NAME" value="" />
      <option name="TEST_TYPE" value="TEST_SCRIPT" />
      <option name="PATTERN" value="" />
      <option name="USE_PATTERN" value="false" />
      <method />
    </configuration>
    <configuration default="true" type="tests" factoryName="Doctests">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs />
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="" />
      <option name="IS_MODULE_SDK" value="false" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="pythonprogramming" />
      <option name="SCRIPT_NAME" value="" />
      <option name="CLASS_NAME" value="" />
      <option name="METHOD_NAME" value="" />
      <option name="FOLDER_NAME" value="" />
      <option name="TEST_TYPE" value="TEST_SCRIPT" />
      <option name="PATTERN" value="" />
      <option name="USE_PATTERN" value="false" />
      <method />
    </configuration>
    <configuration default="true" type="tests" factoryName="Nosetests">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs />
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="" />
      <option name="IS_MODULE_SDK" value="false" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="pythonprogramming" />
      <option name="SCRIPT_NAME" value="" />
      <option name="CLASS_NAME" value="" />
      <option name="METHOD_NAME" value="" />
      <option name="FOLDER_NAME" value="" />
      <option name="TEST_TYPE" value="TEST_SCRIPT" />
      <option name="PATTERN" value="" />
      <option name="USE_PATTERN" value="false" />
      <option name="PARAMS" value="" />
      <option name="USE_PARAM" value="false" />
      <method />
    </configuration>
    <configuration default="true" type="tests" factoryName="Unittests">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs />
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="" />
      <option name="IS_MODULE_SDK" value="false" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="pythonprogramming" />
      <option name="SCRIPT_NAME" value="" />
      <option name="CLASS_NAME" value="" />
      <option name="METHOD_NAME" value="" />
      <option name="FOLDER_NAME" value="" />
      <option name="TEST_TYPE" value="TEST_SCRIPT" />
      <option name="PATTERN" value="" />
      <option name="USE_PATTERN" value="false" />
      <option name="PUREUNITTEST" value="true" />
      <option name="PARAMS" value="" />
      <option name="USE_PARAM" value="false" />
      <method />
    </configuration>
    <configuration default="true" type="tests" factoryName="py.test">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs />
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="" />
      <option name="IS_MODULE_SDK" value="false" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="pythonprogramming" />
      <option name="SCRIPT_NAME" value="" />
      <option name="CLASS_NAME" value="" />
      <option name="METHOD_NAME" value="" />
      <option name="FOLDER_NAME" value="" />
      <option name="TEST_TYPE" value="TEST_SCRIPT" />
      <option name="PATTERN" value="" />
      <option name="USE_PATTERN" value="false" />
      <option name="testToRun" value="" />
      <option name="keywords" value="" />
      <option name="params" value="" />
      <option name="USE_PARAM" value="false" />
      <option name="USE_KEYWORD" value="false" />
      <method />
    </configuration>
    <list size="2">
      <item index="0" class="java.lang.String" itemvalue="Python.pyqt5_lesson15" />
      <item index="1" class="java.lang.String" itemvalue="Python.pyqt5_lesson1" />
    </list>
    <recent_temporary>
      <list size="2">
        <item index="0" class="java.lang.String" itemvalue="Python.pyqt5_lesson1" />
        <item index="1" class="java.lang.String" itemvalue="Python.pyqt5_lesson15" />
      </list>
    </recent_temporary>
  </component>
  <component name="ShelveChangesManager" show_recycled="false">
    <option name="remove_strategy" value="false" />
  </component>
  <component name="TaskManager">
    <task active="true" id="Default" summary="Default task">
      <changelist id="07295370-9428-4952-aa3d-f5e54fdce06c" name="Default" comment="" />
      <created>1484162186771</created>
      <option name="number" value="Default" />
      <option name="presentableId" value="Default" />
      <updated>1484162186771</updated>
    </task>
    <task id="LOCAL-00001" summary="update">
      <created>1484162604230</created>
      <option name="number" value="00001" />
      <option name="presentableId" value="LOCAL-00001" />
      <option name="project" value="LOCAL" />
      <updated>1484162604230</updated>
    </task>
    <task id="LOCAL-00002" summary="update">
      <created>1484257577663</created>
      <option name="number" value="00002" />
      <option name="presentableId" value="LOCAL-00002" />
      <option name="project" value="LOCAL" />
      <updated>1484257577663</updated>
    </task>
    <task id="LOCAL-00003" summary="update">
      <created>1484258698130</created>
      <option name="number" value="00003" />
      <option name="presentableId" value="LOCAL-00003" />
      <option name="project" value="LOCAL" />
      <updated>1484258698130</updated>
    </task>
    <task id="LOCAL-00004" summary="update">
      <created>1484318606650</created>
      <option name="number" value="00004" />
      <option name="presentableId" value="LOCAL-00004" />
      <option name="project" value="LOCAL" />
      <updated>1484318606650</updated>
    </task>
    <task id="LOCAL-00005" summary="update">
      <created>1484318695049</created>
      <option name="number" value="00005" />
      <option name="presentableId" value="LOCAL-00005" />
      <option name="project" value="LOCAL" />
      <updated>1484318695049</updated>
    </task>
    <option name="localTasksCounter" value="6" />
    <servers />
  </component>
  <component name="ToolWindowManager">
    <frame x="58" y="60" width="1176" height="836" extended-state="0" />
    <editor active="false" />
    <layout>
      <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.24935065" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.11290322" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
    </layout>
  </component>
  <component name="VcsContentAnnotationSettings">
    <option name="myLimit" value="2678400000" />
  </component>
  <component name="VcsManagerConfiguration">
    <MESSAGE value="update" />
    <option name="LAST_COMMIT_MESSAGE" value="update" />
  </component>
  <component name="XDebuggerManager">
    <breakpoint-manager />
    <watches-manager />
  </component>
  <component name="editorHistoryManager">
    <entry file="file://$PROJECT_DIR$/pyqt5_lesson15.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="1957">
          <caret line="108" column="43" lean-forward="true" selection-start-line="108" selection-start-column="43" selection-end-line="108" selection-end-column="43" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/pyqt5_lesson1.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="380">
          <caret line="21" column="13" lean-forward="true" selection-start-line="21" selection-start-column="13" selection-end-line="21" selection-end-column="13" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/pyqt5_lesson2.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="0">
          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/README.md">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="133">
          <caret line="7" column="0" lean-forward="true" selection-start-line="7" selection-start-column="0" selection-end-line="7" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/addedsometext">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="0">
          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/pyqt5_lesson1.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="57">
          <caret line="3" column="41" lean-forward="false" selection-start-line="3" selection-start-column="37" selection-end-line="3" selection-end-column="41" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/pyqt5_lesson2.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="57">
          <caret line="3" column="37" lean-forward="false" selection-start-line="3" selection-start-column="37" selection-end-line="3" selection-end-column="37" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/pyqt5_lesson3.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="57">
          <caret line="3" column="38" lean-forward="false" selection-start-line="3" selection-start-column="38" selection-end-line="3" selection-end-column="38" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/pyqt5_lesson4.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="57">
          <caret line="3" column="38" lean-forward="false" selection-start-line="3" selection-start-column="38" selection-end-line="3" selection-end-column="38" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/pyqt5_lesson5.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="57">
          <caret line="3" column="38" lean-forward="false" selection-start-line="3" selection-start-column="38" selection-end-line="3" selection-end-column="38" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/pyqt5_lesson15.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="57">
          <caret line="3" column="38" lean-forward="false" selection-start-line="3" selection-start-column="38" selection-end-line="3" selection-end-column="38" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/pyqt5_lesson6.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="57">
          <caret line="3" column="38" lean-forward="false" selection-start-line="3" selection-start-column="38" selection-end-line="3" selection-end-column="38" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/pyqt5_lesson7.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="57">
          <caret line="3" column="38" lean-forward="false" selection-start-line="3" selection-start-column="38" selection-end-line="3" selection-end-column="38" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/pyqt5_lesson8.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="57">
          <caret line="3" column="38" lean-forward="false" selection-start-line="3" selection-start-column="38" selection-end-line="3" selection-end-column="38" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/pyqt5_lesson9.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="57">
          <caret line="3" column="38" lean-forward="false" selection-start-line="3" selection-start-column="38" selection-end-line="3" selection-end-column="38" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/pyqt5_lesson10.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="57">
          <caret line="3" column="38" lean-forward="false" selection-start-line="3" selection-start-column="38" selection-end-line="3" selection-end-column="38" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/pyqt5_lesson11.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="57">
          <caret line="3" column="38" lean-forward="false" selection-start-line="3" selection-start-column="38" selection-end-line="3" selection-end-column="38" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/pyqt5_lesson12.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="57">
          <caret line="3" column="38" lean-forward="false" selection-start-line="3" selection-start-column="38" selection-end-line="3" selection-end-column="38" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/pyqt5_lesson13.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="57">
          <caret line="3" column="38" lean-forward="false" selection-start-line="3" selection-start-column="38" selection-end-line="3" selection-end-column="38" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/pyqt5_lesson14.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="57">
          <caret line="3" column="38" lean-forward="false" selection-start-line="3" selection-start-column="38" selection-end-line="3" selection-end-column="38" />
          <folding />
        </state>
      </provider>
    </entry>
  </component>
</project>


text:
@interface MNKPDFMainToolbar ()

//@property (nonatomic, strong) UIButton *bookmarkButton;
@property (nonatomic, strong) UIButton *rotateButton;

@end

@implementation MNKPDFMainToolbar

- (instancetype)initWithFrame:(CGRect)frame {

    self = [super initWithFrame:frame];
    if (self) {
        CGFloat viewWidth = self.bounds.size.width;

        CGFloat currentLeftOffset = DEFAULT_SPACING;

        NSString *doneButtonText = NSLocalizedString(@"Done", "done");
        UIButton *doneButton = [UIButton buttonWithType:UIButtonTypeSystem];
        CGSize doneButtonSize = [doneButtonText sizeWithAttributes:@{NSFontAttributeName : [UIFont systemFontOfSize:15.0f]}];
        CGFloat doneButtonWidth = doneButtonSize.width + TEXT_BUTTON_PADDING;
        doneButton.frame = CGRectMake(currentLeftOffset, DEFAULT_SPACING,
                                      doneButtonWidth, DEFAULT_BUTTON_SIZE.height);
        [doneButton setTitle:doneButtonText forState:UIControlStateNormal];
        [doneButton addTarget:self action:@selector(doneButtonTapped)
             forControlEvents:UIControlEventTouchUpInside];
        doneButton.exclusiveTouch = YES;
        [self addSubview:doneButton];

        currentLeftOffset += doneButton.frame.size.width + DEFAULT_SPACING;

        UIButton *thumbsButton = [UIButton buttonWithType:UIButtonTypeCustom];
        thumbsButton.frame = CGRectMake(currentLeftOffset, DEFAULT_SPACING,
                                        DEFAULT_BUTTON_SIZE.width, DEFAULT_BUTTON_SIZE.height);
        [thumbsButton setImage:[UIImage MNKPDFEditorImageNamed:@"Thumbs"] forState:UIControlStateNormal];
        [thumbsButton addTarget:self action:@selector(thumbsButtonTapped) forControlEvents:UIControlEventTouchUpInside];
        thumbsButton.exclusiveTouch = YES;
        [self addSubview:thumbsButton];

        CGFloat currentRightOffset = viewWidth;
        currentRightOffset -= (DEFAULT_BUTTON_SIZE.width + DEFAULT_SPACING);

//        _bookmarkButton = [UIButton buttonWithType:UIButtonTypeCustom];
//        _bookmarkButton.frame = CGRectMake(currentRightOffset, DEFAULT_SPACING,
//                                          DEFAULT_BUTTON_SIZE.width, DEFAULT_BUTTON_SIZE.height);
//        [_bookmarkButton addTarget:self action:@selector(bookmarkButtonTapped)
//                  forControlEvents:UIControlEventTouchUpInside];
//        [_bookmarkButton setImage:[UIImage MNKPDFEditorImageNamed:@"Bookmark"]
//                        forState:UIControlStateNormal];
//        [_bookmarkButton setImage:[UIImage MNKPDFEditorImageNamed:@"Bookmark selected"]
//                        forState:UIControlStateSelected];
//        [self addSubview:_bookmarkButton];

        currentRightOffset -= (DEFAULT_BUTTON_SIZE.width + DEFAULT_SPACING);

        _rotateButton = [UIButton buttonWithType:UIButtonTypeCustom];
        _rotateButton.frame = CGRectMake(currentRightOffset, DEFAULT_SPACING, DEFAULT_BUTTON_SIZE.width, DEFAULT_BUTTON_SIZE.height);
        [_rotateButton setImage:[UIImage MNKPDFEditorImageNamed:@"Rotate"] forState:UIControlStateNormal];
        [_rotateButton setImage:[UIImage MNKPDFEditorImageNamed:@"Rotate-highlighted"] forState:UIControlStateHighlighted];
        [_rotateButton addTarget:self action:@selector(rotateButtonTapped)
               forControlEvents:UIControlEventTouchUpInside];
        _rotateButton.exclusiveTouch = YES;
        [self addSubview:_rotateButton];
    }
    return self;
}

//- (void)setBookmarkState:(BOOL)state {
//
//    _bookmarkButton.selected = state;
//}

- (void)layoutSubviews {

    [super layoutSubviews];

    CGFloat viewWidth = self.bounds.size.width;
    CGFloat currentRightOffset = viewWidth - DEFAULT_SPACING - DEFAULT_BUTTON_SIZE.width;
//    CGRect newBookmarkButtonFrame = _bookmarkButton.frame;
//    newBookmarkButtonFrame.origin.x = currentRightOffset;
//    _bookmarkButton.frame = newBookmarkButtonFrame;

//    currentRightOffset -= (DEFAULT_SPACING + DEFAULT_BUTTON_SIZE.width);
    CGRect newRotateButtonFrame = _rotateButton.frame;
    newRotateButtonFrame.origin.x = currentRightOffset;
    _rotateButton.frame = newRotateButtonFrame;
}

- (void)doneButtonTapped {

    [self.delegate mainToolbarButtonTappedWithType:MNKPDFMainToolbarButtonTypeDone];
}

- (void)thumbsButtonTapped {

    [self.delegate mainToolbarButtonTappedWithType:MNKPDFMainToolbarButtonTypeThumbs];
}

//- (void)bookmarkButtonTapped {
//
//    _bookmarkButton.selected = !_bookmarkButton.selected;
//    [self.delegate mainToolbarButtonTappedWithType:MNKPDFMainToolbarButtonTypeBookmark];
//}

- (void)rotateButtonTapped {

    [self.delegate rotatePage];
}

@end


text: docker run -it -d --restart:always --name rails -p 8300:80 -v /var/data/rails:/app docker-rails


text:
[![Build Status](https://travis-ci.org/crowbar/crowbar-ui.svg?branch=master)](https://travis-ci.org/crowbar/crowbar-ui)

### Setting up a development environment with Docker

This is an optional way to develop on `crowbar-ui` within a contained environment. The main benefit is to have some reusable and host-independent environment to develop on.

1. make sure `docker` is installed and the `docker` daemon is running.

   for installation details see: https://docs.docker.com/engine/installation/
2. build the image from the [Dockerfile](Dockerfile):
  ```
  docker build -t crowbar-ui .
  ```
3. run the container (`pwd` should be your git clone):
  ```
  docker run -d --name "crowbar-ui_container" -v $(pwd)/assets:/crowbar-ui/assets -v $(pwd)/routes:/crowbar-ui/routes -p 3000:3000 crowbar-ui
  ```
4. work on the assets folder in your local git clone and the changes will be immediately visible in the browser.
   also if you are changing the `./routes` directory the server inside the container gets restarted by `nodemon`

#### Running the test suite inside the container
```
docker exec -ti crowbar-ui_container npm test
```

### First steps to have the app running locally for PRODUCTION ENV only:

1 - Clone the app from GitHub:

`git@github.com:crowbar/crowbar-ui.git`

2 - Locate yourself into the recently created folder:

`cd crowbar-ui`

**Make sure you have Node.js installed in your machine with NPM, if not, please proceed to install it before continuing with the following steps. (more info: https://nodejs.org/en/download/)**

3 - Let npm install all the needed packages:

`npm install`

4 - Some packages, like gulp, needs to be installed globally to be available through the console. Let's install them:

`sudo npm install -g gulp`

5 - You will need to have Bower installed globally in your machine:

`npm install -g bower`

6 - Let bower fetch all our dependencies:

`NODE_ENV=production bower install`

7 - Let Gulp build the public folder for your assets (it will keep watching for changes, so yes, after this, you are ready to start making changes in the front-end), note that this will exit with a warning if cloud.config.json is missing (it will continue to run if `NODE_ENV` is not set to production):

`NODE_ENV=production gulp`

8 - Update the `tested_step` variable in `routes/api/upgrade.js` depending on the scenario you want to test. This is used to properly fill the mocked status API response.

9 - Run the server at http://localhost:3000 with (you will need to restart it every time you make changes in the backend, but not in the layout or front-end in general):

`NODE_ENV=production npm start`

#### Need Development ENV? Perform the following replacing the steps 6, 7, and 8:

1 - Everytime you update master from new PR merged into it, make sure you have all the latest libraries from package.json by running

`npm install`

2 - and then, in a new terminal:

`bower install && gulp`

to compile all your assets again and leave it watching your changes.

#### Latest build/run info:

The most up to date source of setup information is `.travis.yml` in the base folder, as this builds/runs the test suite and must be up to date. Check there first if you encounter any issues with running the build locally

### That's it fellas! .. enjoy coding! ###

:)

!['bring it on'](http://s2.quickmeme.com/img/0b/0bf4e6e37c1539469cf8adc3e3a63b98e3943ad3ee72bd2d9c8de9ba22eefdd2.jpg)


text:
{% extends "base.html" %}
{% load i18n %}
{% block title %}{% trans "Devicetags" %}{% endblock %}

{% block header %}
    {% trans "Devicetags" %}
{% endblock %}

{% block pullright %}
    {{ filterform.filterstring }}
    {{ viewform.viewsorting }}
    {% if perms.devicetags.add_devicetag %}

        {% trans "Add Devicetag" %}{% endif %}
{% endblock %}

{% block content %}

            {% include "snippets/pagination.html" with listurl='devicetag-list' %}

                    {% trans "Name" %}

                {% for devicetag in devicetag_list %}

                            {{ devicetag.name | default:"(None)" }}

                {% endfor %}

            {% include "snippets/pagination.html" with listurl='devicetag-list' %}

{% endblock %}


text:
add_custom_target(${PROJECT_NAME}_xacro_generated_to_devel_space_ ALL)

## xacro_add_xacro_file(<input> [<output>] [REMAP <arg> <arg> ...]
##                      [OUTPUT <variable>] DEPENDS <arg> <arg>)
##
## Creates a command to run xacro on <input> like so:
## xacro -o <output> <input> [<remap args>]
##
## If <output> was not specified, it is determined from <input> removing the suffix .xacro
## The absolute output file name is returned in variable <output>, which defaults to
## XACRO_OUTPUT_FILE.
##
## In order to actually build and install, you need to provide a custom target:
## foreach(xacro_file ${MY_XACRO_FILES})
##   xacro_add_xacro_file(${xacro_file} REMAP bar:=foo foo:=bar)
##   list(APPEND xacro_outputs ${XACRO_OUTPUT_FILE})
## endforeach()
## xacro_install(xacro_target ${xacro_outputs} DESTINATION xml)
##
## Be aware, that xacro_install() is required to install into both, install and devel space.
## Normal install() only installs into install space!
##
## For conveniency, you might want to use xacro_add_files(), which does the same:
## xacro_add_files(${MY_XACRO_FILES} REMAP bar:=foo foo:=bar
##                 TARGET xacro_target INSTALL DESTINATION xml)
function(xacro_add_xacro_file input)
  # parse arguments
  set(options)
  set(oneValueArgs OUTPUT)
  set(multiValueArgs REMAP DEPENDS)
  cmake_parse_arguments(_XACRO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

  ## process arguments
  # retrieve output file name
  if(_XACRO_UNPARSED_ARGUMENTS)
    # output file explicitly specified
    list(GET _XACRO_UNPARSED_ARGUMENTS 0 output)
    list(REMOVE_AT _XACRO_UNPARSED_ARGUMENTS 0)
    # any remaining unparsed args?
    if(_XACRO_UNPARSED_ARGUMENTS)
      message(WARNING "unknown arguments: ${_XACRO_UNPARSED_ARGUMENTS}")
    endif(_XACRO_UNPARSED_ARGUMENTS)
  else()
    # implicitly determine output file from input
    if(${input} MATCHES "(.*)[.]xacro$")
      set(output ${CMAKE_MATCH_1})
    else()
      message(FATAL_ERROR "no <output> specified for: " ${input})
    endif()
  endif()
  # message(STATUS "output: ${output}")

  ## determine absolute output target location
  if(IS_ABSOLUTE ${output})
    set(abs_output ${output})
  else()
    set(abs_output ${CMAKE_CURRENT_BINARY_DIR}/${output})
  endif()
  # message(STATUS "abs_output: ${abs_output}")

  ## export abs_output to parent scope in variable ${_XACRO_OUTPUT}
  if(NOT _XACRO_OUTPUT)
    set(_XACRO_OUTPUT XACRO_OUTPUT_FILE)
  endif()
  set(${_XACRO_OUTPUT} ${abs_output} PARENT_SCOPE)

  ## Call out to xacro to determine dependencies
  message(STATUS "xacro: determining deps for: " ${input} " ...")
  execute_process(COMMAND ${CATKIN_ENV} xacro --deps ${input} ${_XACRO_REMAP}
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    RESULT_VARIABLE _xacro_result
    ERROR_VARIABLE _xacro_err
    OUTPUT_VARIABLE _xacro_deps_result
    OUTPUT_STRIP_TRAILING_WHITESPACE)
  if(_xacro_result)
    message(WARNING "failed to determine deps for: ${input}
${_xacro_err}")
  endif(_xacro_result)

  separate_arguments(_xacro_deps_result)

  ## command to actually call xacro
  add_custom_command(OUTPUT ${output}
    COMMAND ${CATKIN_ENV} xacro -o ${abs_output} ${input} ${_XACRO_REMAP}
    DEPENDS ${input} ${_xacro_deps_result} ${_XACRO_DEPENDS}
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    COMMENT "xacro: generating ${output} from ${input}"
    )
endfunction(xacro_add_xacro_file)

## xacro_install(<target> <output> [<output> ...] DESTINATION <path>)
##
## installs xacro-generated files both to devel and input space
## into ${CATKIN_PACKAGE_SHARE_DESTINATION}/<path>
function(xacro_install target)
  # parse arguments
  set(oneValueArgs DESTINATION)
  cmake_parse_arguments(_XACRO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
  set(outputs ${_XACRO_UNPARSED_ARGUMENTS})

  ## rule to create target dir
  file(TO_CMAKE_PATH ${CATKIN_PACKAGE_SHARE_DESTINATION}/${_XACRO_DESTINATION} dest)
  file(TO_CMAKE_PATH ${CATKIN_DEVEL_PREFIX}/${dest} TARGET_DIR)
  add_custom_command(OUTPUT ${TARGET_DIR}
    COMMAND ${CMAKE_COMMAND} -E make_directory ${TARGET_DIR}
    COMMENT "creating dir ${TARGET_DIR}")

  ## process list of outputs
  foreach(output ${outputs})
    get_filename_component(tgt ${output} NAME)
    file(TO_CMAKE_PATH ${TARGET_DIR}/${tgt} tgt)
    list(APPEND tgts ${tgt})

    # rule to create devel space tgt
    add_custom_command(OUTPUT ${tgt}
      COMMAND ${CMAKE_COMMAND} -E copy_if_different ${output} ${tgt}
      DEPENDS ${TARGET_DIR} ${output}
      COMMENT "Copying to devel space: ${tgt}"
      )
  endforeach()

  ## rule to create devel space tgts
  add_custom_target(${PROJECT_NAME}_${target}_to_devel_space_ DEPENDS ${tgts})
  # add to main target _xacro_generated_to_devel_space_
  add_dependencies(${PROJECT_NAME}_xacro_generated_to_devel_space_
                   ${PROJECT_NAME}_${target}_to_devel_space_)

  ## normal install
  install(FILES ${outputs} DESTINATION ${dest})
endfunction(xacro_install)

## xacro_add_files(<file> [<file> ...] [REMAP <arg> <arg> ...] [DEPENDS <arg> <arg>]
##                 [TARGET <target>] [INSTALL [DESTINATION <path>]])
##
## create make <target> to generate xacro files
## and optionally install to ${CATKIN_PACKAGE_SHARE_DESTINATION}/<path>
## in devel and install space.
function(xacro_add_files)
  # parse arguments
  set(options INSTALL)
  set(oneValueArgs OUTPUT TARGET DESTINATION)
  set(multiValueArgs REMAP DEPENDS)
  cmake_parse_arguments(_XACRO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

  ## process arguments
  # prepare REMAP args (prepending REMAP)
  if(_XACRO_REMAP)
    set(_XACRO_REMAP REMAP ${_XACRO_REMAP})
  endif()
  # prepare DEPENDS args (prepending DEPENDS)
  if(_XACRO_DEPENDS)
    set(_XACRO_DEPENDS DEPENDS ${_XACRO_DEPENDS})
  endif()

  # have INSTALL option, but no TARGET: fallback to default target
  if(_XACRO_INSTALL AND NOT _XACRO_TARGET)
    # message(STATUS "xacro: no TARGET specified, using default")
    set(_XACRO_TARGET _xacro_auto_generate)
  endif()

  foreach(input ${_XACRO_UNPARSED_ARGUMENTS})
    # call to main function
    xacro_add_xacro_file(${input} ${_XACRO_OUTPUT} ${_XACRO_REMAP} ${_XACRO_DEPENDS})
    list(APPEND outputs ${XACRO_OUTPUT_FILE})
  endforeach()

  if(outputs)
    # link to target
    add_custom_target(${PROJECT_NAME}_${_XACRO_TARGET} ALL DEPENDS ${outputs})

    # install?
    if(_XACRO_INSTALL)
      xacro_install(${_XACRO_TARGET} ${outputs} DESTINATION ${_XACRO_DESTINATION})
    endif(_XACRO_INSTALL)
  endif()
endfunction(xacro_add_files)