text:
name: Leaflet Truesize
category: markers-renderers
repo: https://wbkd.github.io/leaflet-truesize/
author: webkid
author-url: https://webkid.io/
demo: https://wbkd.github.io/leaflet-truesize/
compatible-v0:
compatible-v1: true
---

A plugin for creating projection aware draggable polygons and polylines.


text:
package com.intellij.ide;

import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
import com.intellij.ide.util.DeleteHandler;
import javax.annotation.Nonnull;

import jakarta.inject.Singleton;
import javax.swing.*;

/**
 * @author yole
 */
@Singleton
public class PsiActionSupportFactoryImpl extends PsiActionSupportFactory {
  @Override
  public CopyPasteSupport createPsiBasedCopyPasteSupport(final Project project, final JComponent keyReceiver,
                                                         final PsiElementSelector dataSelector) {
    return new CopyPasteDelegator(project, keyReceiver) {
      @Override
      @Nonnull
      protected PsiElement[] getSelectedElements() {
        PsiElement[] elements = dataSelector.getSelectedElements();
        return elements == null ? PsiElement.EMPTY_ARRAY : elements;
      }
    };
  }

  @Override
  public DeleteProvider createPsiBasedDeleteProvider() {
    return new DeleteHandler.DefaultDeleteProvider();
  }
}

redpajama_set_name: RedPajamaGithub


text:
class KonoUtils::ChangeLogController < ApplicationController

  def index
  end

end


text:
package dproject

import (
	"log"
	"github.com/edragoev1/pdfjet/src"
)

// QRCode used to create 2D QR Code barcodes. Please see Example_20.
// @author Kazuhiko Arase
type QRCode struct {
	PAD0              int
	PAD1              int
	modules           [][]*bool
	moduleCount       int
	errorCorrectLevel int
	x                 float32
	y                 float32
	qrData            []byte
	m1                float32 // Module length
	color             uint32
}

// NewQRCode is used to create 2D QR Code barcodes.
// @param str the string to encode.
// @param errorCorrectLevel the desired error correction level.
func NewQRCode(str string, errorCorrectLevel int) *QRCode {
	qrcode := new(QRCode)
	qrcode.PAD0 = 0xEC
	qrcode.PAD1 = 0x11
	qrcode.qrData = []byte(str)
	qrcode.moduleCount = 33 // Magic Number
	qrcode.m1 = 2.0
	qrcode.errorCorrectLevel = errorCorrectLevel
	qrcode.make(false, qrcode.getBestMaskPattern())
	return qrcode
}

// SetPosition sets the position where this barcode will be drawn on the page.
// @param x the x coordinate of the top left corner of the barcode.
// @param y the y coordinate of the top left corner of the barcode.
func (qrcode *QRCode) SetPosition(x, y float32) {
	qrcode.SetLocation(x, y)
}

// SetLocation sets the location where this barcode will be drawn on the page.
// @param x the x coordinate of the top left corner of the barcode.
// @param y the y coordinate of the top left corner of the barcode.
func (qrcode *QRCode) SetLocation(x, y float32) {
	qrcode.x = x
	qrcode.y = y
}

// SetModuleLength sets the module length of this barcode.
// The default value is 2.0f
// @param moduleLength the specified module length.
func (qrcode *QRCode) SetModuleLength(moduleLength float32) {
	qrcode.m1 = moduleLength
}

// SetColor sets the color of the barcode.
func (qrcode *QRCode) SetColor(color uint32) {
	qrcode.color = color
}

// DrawOn draws this barcode on the specified page.
// @param page the specified page.
// @return x and y coordinates of the bottom right corner of this component.
func (qrcode *QRCode) DrawOn(page *pdfjet.Page) []float32 {
	page.SetBrushColor(qrcode.color)
	for row := 0; row < len(qrcode.modules); row++ {
		for col := 0; col < len(qrcode.modules); col++ {
			if qrcode.isDark(row, col) {
				page.FillRect(
					qrcode.x+float32(col)*qrcode.m1,
					qrcode.y+float32(row)*qrcode.m1,
					qrcode.m1,
					qrcode.m1)
			}
		}
	}
	w := qrcode.m1 * float32(len(qrcode.modules))
	h := qrcode.m1 * float32(len(qrcode.modules))
	return []float32{qrcode.x + w, qrcode.y + h}
}

func (qrcode *QRCode) getData() [][]*bool {
	return qrcode.modules
}

func (qrcode *QRCode) isDark(row, col int) bool {
	if qrcode.modules[row][col] != nil {
		return *qrcode.modules[row][col]
	}
	return false
}

func (qrcode *QRCode) getModuleCount() int {
	return qrcode.moduleCount
}

func (qrcode *QRCode) getBestMaskPattern() int {
	minLostPoint := 0
	pattern := 0
	for i := 0; i < 8; i++ {
		qrcode.make(true, i)
		lostPoint := getLostPoint(qrcode)
		if i == 0 || minLostPoint > lostPoint {
			minLostPoint = lostPoint
			pattern = i
		}
	}
	return pattern
}

func (qrcode *QRCode) make(test bool, maskPattern int) {
	qrcode.modules = make([][]*bool, qrcode.moduleCount)
	for i := range qrcode.modules {
		qrcode.modules[i] = make([]*bool, qrcode.moduleCount)
	}

	qrcode.setupPositionProbePattern(0, 0)
	qrcode.setupPositionProbePattern(qrcode.moduleCount-7, 0)
	qrcode.setupPositionProbePattern(0, qrcode.moduleCount-7)

	qrcode.setupPositionAdjustPattern()
	qrcode.setupTimingPattern()
	qrcode.setupTypeInfo(test, maskPattern)

	qrcode.mapData(qrcode.createData(qrcode.errorCorrectLevel), maskPattern)
}

func (qrcode *QRCode) mapData(data []byte, maskPattern int) {
	inc := -1
	row := qrcode.moduleCount - 1
	bitIndex := 7
	byteIndex := 0

	for col := qrcode.moduleCount - 1; col > 0; col -= 2 {
		if col == 6 {
			col--
		}
		for {
			for c := 0; c < 2; c++ {
				if qrcode.modules[row][col-c] == nil {
					dark := false
					if byteIndex < len(data) {
						dark = (((data[byteIndex] >> bitIndex) & 1) == 1)
					}
					mask := getMask(maskPattern, row, col-c)
					if mask {
						dark = !dark
					}
					qrcode.modules[row][col-c] = &dark
					bitIndex--
					if bitIndex == -1 {
						byteIndex++
						bitIndex = 7
					}
				}
			}

			row += inc
			if row < 0 || qrcode.moduleCount <= row {
				row -= inc
				inc = -inc
				break
			}
		}
	}
}

func (qrcode *QRCode) setupPositionAdjustPattern() {
	pos := []int{6, 26} // Magic Numbers
	for i := 0; i < len(pos); i++ {
		for j := 0; j < len(pos); j++ {
			row := pos[i]
			col := pos[j]
			if qrcode.modules[row][col] != nil {
				continue
			}
			for r := -2; r <= 2; r++ {
				for c := -2; c <= 2; c++ {
					value := r == -2 || r == 2 || c == -2 || c == 2 || (r == 0 && c == 0)
					qrcode.modules[row+r][col+c] = &value
				}
			}
		}
	}
}

func (qrcode *QRCode) setupPositionProbePattern(row, col int) {
	for r := -1; r <= 7; r++ {
		for c := -1; c <= 7; c++ {
			if row+r <= -1 || qrcode.moduleCount <= row+r || col+c <= -1 || qrcode.moduleCount <= col+c {
				continue
			}
			value := (0 <= r && r <= 6 && (c == 0 || c == 6)) ||
				(0 <= c && c <= 6 && (r == 0 || r == 6)) ||
				(2 <= r && r <= 4 && 2 <= c && c <= 4)
			qrcode.modules[row+r][col+c] = &value
		}
	}
}

func (qrcode *QRCode) setupTimingPattern() {
	for r := 8; r < qrcode.moduleCount-8; r++ {
		if qrcode.modules[r][6] != nil {
			continue
		}
		value := r%2 == 0
		qrcode.modules[r][6] = &value
	}
	for c := 8; c < qrcode.moduleCount-8; c++ {
		if qrcode.modules[6][c] != nil {
			continue
		}
		value := c%2 == 0
		qrcode.modules[6][c] = &value
	}
}

func (qrcode *QRCode) setupTypeInfo(test bool, maskPattern int) {
	data := qrcode.errorCorrectLevel<<3 | maskPattern
	bits := getBCHTypeInfo(data)

	for i := 0; i < 15; i++ {
		mod := (!test && ((bits>>i)&1) == 1)
		if i < 6 {
			qrcode.modules[i][8] = &mod
		} else if i < 8 {
			qrcode.modules[i+1][8] = &mod
		} else {
			qrcode.modules[qrcode.moduleCount-15+i][8] = &mod
		}
	}

	for i := 0; i < 15; i++ {
		mod := (!test && ((bits>>i)&1) == 1)
		if i < 8 {
			qrcode.modules[8][qrcode.moduleCount-i-1] = &mod
		} else if i < 9 {
			qrcode.modules[8][15-i-1+1] = &mod
		} else {
			qrcode.modules[8][15-i-1] = &mod
		}
	}

	value := !test
	qrcode.modules[qrcode.moduleCount-8][8] = &value
}

func (qrcode *QRCode) createData(errorCorrectLevel int) []byte {
	rsblock := new(RSBlock)
	rsBlocks := rsblock.getRSBlocks(errorCorrectLevel)

	var buffer = NewBitBuffer()
	buffer.put(4, 4)
	buffer.put(len(qrcode.qrData), 8)
	for i := 0; i < len(qrcode.qrData); i++ {
		buffer.put(int(qrcode.qrData[i]), 8)
	}

	totalDataCount := 0
	for i := 0; i < len(rsBlocks); i++ {
		totalDataCount += rsBlocks[i].getDataCount()
	}

	if buffer.getLengthInBits() > totalDataCount*8 {
		log.Fatal("String length overflow. (" + string(buffer.getLengthInBits()) + ")")
		/* TODO:
			   throw new IllegalArgumentException("String length overflow. ("
		           + buffer.getLengthInBits()
		           + ">"
		           +  totalDataCount * 8
		           + ")")
		*/
	}

	if buffer.getLengthInBits()+4 <= totalDataCount*8 {
		buffer.put(0, 4)
	}

	// padding
	for (buffer.getLengthInBits() % 8) != 0 {
		buffer.putBit(false)
	}

	// padding
	for {
		if buffer.getLengthInBits() >= totalDataCount*8 {
			break
		}
		buffer.put(qrcode.PAD0, 8)
		if buffer.getLengthInBits() >= totalDataCount*8 {
			break
		}
		buffer.put(qrcode.PAD1, 8)
	}

	return qrcode.createBytes(buffer, rsBlocks)
}

func maxOfIntegers(a, b int) int {
	if a >= b {
		return a
	}
	return b
}

func (qrcode *QRCode) createBytes(buffer *BitBuffer, rsBlocks []*RSBlock) []byte {
	offset := 0
	maxDcCount := 0
	maxEcCount := 0
	dcdata := make([][]int, len(rsBlocks))
	ecdata := make([][]int, len(rsBlocks))

	for r := 0; r < len(rsBlocks); r++ {
		dcCount := rsBlocks[r].getDataCount()
		ecCount := rsBlocks[r].getTotalCount() - dcCount

		maxDcCount = maxOfIntegers(maxDcCount, dcCount)
		maxEcCount = maxOfIntegers(maxEcCount, ecCount)

		dcdata[r] = make([]int, dcCount)
		for i := 0; i < len(dcdata[r]); i++ {
			dcdata[r][i] = int(0xff) & int(buffer.getBuffer()[i+offset])
		}
		offset += dcCount

		rsPoly := getErrorCorrectPolynomial(ecCount)
		rawPoly := NewPolynomial(dcdata[r], rsPoly.getLength()-1)
		modPoly := rawPoly.mod(rsPoly)
		ecdata[r] = make([]int, rsPoly.getLength()-1)
		for i := 0; i < len(ecdata[r]); i++ {
			modIndex := i + modPoly.getLength() - len(ecdata[r])
			ecdata[r][i] = 0
			if modIndex >= 0 {
				ecdata[r][i] = modPoly.get(modIndex)
			}
		}
	}

	totalCodeCount := 0
	for i := 0; i < len(rsBlocks); i++ {
		totalCodeCount += rsBlocks[i].getTotalCount()
	}

	data := make([]byte, totalCodeCount)
	index := 0
	for i := 0; i < maxDcCount; i++ {
		for r := 0; r < len(rsBlocks); r++ {
			if i < len(dcdata[r]) {
				data[index] = byte(dcdata[r][i])
				index++
			}
		}
	}

	for i := 0; i < maxEcCount; i++ {
		for r := 0; r < len(rsBlocks); r++ {
			if i < len(ecdata[r]) {
				data[index] = byte(ecdata[r][i])
				index++
			}
		}
	}

	return data
}


text:
"""ConfDBScaling FunkLoad test

"""
import unittest
from random import random
from funkload.FunkLoadTestCase import FunkLoadTestCase
from funkload.Lipsum import Lipsum
from funkload.utils import extract_token
from funkload.utils import xmlrpc_get_credential
from webunit.utility import Upload

class ConfDBScaling(FunkLoadTestCase):
    """This test use a configuration file Conf.conf."""

    def setUp(self):
        """Setting up test."""
        self.server_url = self.conf_get('main', 'url')

        credential_host = self.conf_get('credential', 'host')
        credential_port = self.conf_getInt('credential', 'port')
        self.username, self.pwd = xmlrpc_get_credential(
            credential_host, credential_port, "group1")

        self.lipsum = Lipsum()

    def tearDown(self):
        self.logout()

    def login(self, page="/index"):
        # The description should be set in the configuration file
        server_url = self.server_url

        reply = self.get(server_url + "/index",
            description="Get index")

        csrftoken = extract_token(self.getBody(), "name='csrfmiddlewaretoken' value='", "' />")
        self.post(server_url + "/accounts/login/?next=" + page,
            params=[['csrfmiddlewaretoken', csrftoken],
            ['redirect_to', page],
            ['username', self.username],
            ['password', self.pwd]],
            description="Post /accounts/login/")

    def logout(self):
        self.get(self.server_url + "/accounts/logout/",
                    description="Get /accounts/logout/")

    def test_show_all_papers(self):
        page = "/index"
        self.login(page)
        self.assert_(page == self.getLastUrl(), "Error in login")
        reply = self.get(self.server_url + page, description="Get papers")
        self.logout()

    def test_show_all_users(self):
        page = "/users"
        self.login(page)
        self.assert_(page == self.getLastUrl(), "Error in login")
        reply = self.get(self.server_url + page, description="Get papers")
        self.logout()

    def test_view_paper(self):
        page = "/paper?id=1" #EnGM55IPia7nBrhBHuDqSbeG6nDghG8l"
        self.login(page)
        reply = self.get(self.server_url + page, description = "Get paper")
        self.assert_("paper" in self.getLastUrl(), "Error in showing paper")
        self.logout()

    # TODO: Submit a paper.
    def test_submit_paper(self):
        page = "/submit"
        self.login(page)
        self.assert_(page == self.getLastUrl(), "Error in login")

        num_papers = self.conf_getInt('test_submit_paper', 'num_papers')
        for i in range(num_papers):
            csrftoken = extract_token(self.getBody(), "name='csrfmiddlewaretoken' value='", "' />")
            self.post(self.server_url + "/submit",
                params=[['csrfmiddlewaretoken', csrftoken],
                ['coauthors[]', self.lipsum.getWord()],
                ['coauthors[]', self.lipsum.getWord()],
                ['title', self.lipsum.getSentence()],
                ['contents', Upload('files/rms_crossstitch.pdf')],
                ['abstract', self.lipsum.getMessage()]],
                description="Post /accounts/login/")
            self.assert_("paper" in self.getLastUrl(), "Error in login")

    # TODO: View profile.
    def test_view_profile(self):
        page = "/accounts/profile/"
        self.login(page)
        self.assert_(page == self.getLastUrl(), "Error in login")

if __name__ in ('main', '__main__'):
    unittest.main()


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

<ProgressBar xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:layout_gravity="center" />


text:
$(function () {

    // fix main menu to page on passing
    $('.main.menu').visibility({
        type: 'fixed'
    });
    $('.overlay').visibility({
        type: 'fixed',
        offset: 80
    });

    // lazy load images
    $('.image').visibility({
        type: 'image',
        transition: 'vertical flip in',
        duration: 500
    });

    // show dropdown on hover
    $('.main.menu  .ui.dropdown').dropdown({
        on: 'hover'
    });

    $('.tabs.menu .item').tab({history: true});

    $("#flash").delay(2000).fadeOut();
})
;


text:
@implementation KWExample (KIFTester)

NSString *const kExceptionFilenameKey = @"FilenameKey";
NSString *const kExceptionLinenumberKey = @"LineNumberKey";

#pragma mark - KIFTestActorDelegate

- (void)failWithException:(NSException *)exception stopTest:(BOOL)stop {

    if (stop) {
        [self writeScreenshotForException:exception];
    }

    KWCallSite *callsite = [KWCallSite callSiteWithFilename:[exception userInfo][kExceptionFilenameKey]
                                                 lineNumber:[[exception userInfo][kExceptionLinenumberKey] unsignedIntegerValue]];
    KWFailure *failure = [KWFailure failureWithCallSite:callsite
                                                message:[exception reason]];
    [self reportFailure:failure];
    if (stop && [[exception reason] rangeOfString:@"Failed to find accessibility element with the label"].location != NSNotFound) {
        NSLog(@"All accessibility labels currently found in view: %@", [[[UIApplication sharedApplication] keyWindow] allAccessibilityLabels]);
    }
}

- (void)failWithExceptions:(NSArray *)exceptions stopTest:(BOOL)stop {
    for (NSException *exception in exceptions) {
        [self failWithException:exception stopTest:stop];
    }
}

- (void)writeScreenshotForException:(NSException *)exception {
    NSString *outputPath = [[[NSProcessInfo processInfo] environment] objectForKey:@"KIF_SCREENSHOTS"];
    NSError *error = nil;

    if (outputPath) {
        [[NSFileManager defaultManager] createDirectoryAtPath:outputPath withIntermediateDirectories:YES attributes:nil error:&error];
        NSAssert1(!error, @"Failed to create screenshot folder at: %@", outputPath);
    }

    UIApplication *app = [UIApplication sharedApplication];
    NSString *description = [[self descriptionWithContext] stringByReplacingOccurrencesOfString:@"/" withString:@""];
    [app writeScreenshotForLine:[[exception userInfo][kExceptionLinenumberKey] unsignedIntegerValue]
                         inFile:[exception userInfo][kExceptionFilenameKey]
                    description:description
                          error:&error];
    if (error) {
        error = nil;
        [app writeScreenshotForLine:[[exception userInfo][kExceptionLinenumberKey] unsignedIntegerValue]
                             inFile:[exception userInfo][kExceptionFilenameKey]
                        description:nil
                              error:&error];
    }
}

@end


text:
package org.elasticsearch.river.couchdb;

import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.node.Node;
import org.elasticsearch.node.NodeBuilder;

import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;

/**
 *
 */
public class CouchdbRiverTest {

    public static void main(String[] args) throws Exception {
        Node node = NodeBuilder.nodeBuilder().settings(ImmutableSettings.settingsBuilder().put("gateway.type", "local")).local(true).node();
        Thread.sleep(1000);
        node.client().prepareIndex("_river", "db", "_meta").setSource(jsonBuilder().startObject().field("type", "couchdb").endObject()).execute().actionGet();

        Thread.sleep(1000000);
    }
}


text:
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.UnitTests;
using Xunit;

namespace Microsoft.ApiDesignGuidelines.Analyzers.UnitTests
{
    public class OperatorsShouldHaveSymmetricalOverloadsFixerTests : CodeFixTestBase
    {
        protected override DiagnosticAnalyzer GetBasicDiagnosticAnalyzer()
        {
            return new OperatorsShouldHaveSymmetricalOverloadsAnalyzer();
        }

        protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
        {
            return new OperatorsShouldHaveSymmetricalOverloadsAnalyzer();
        }

        protected override CodeFixProvider GetBasicCodeFixProvider()
        {
            return new OperatorsShouldHaveSymmetricalOverloadsFixer();
        }

        protected override CodeFixProvider GetCSharpCodeFixProvider()
        {
            return new OperatorsShouldHaveSymmetricalOverloadsFixer();
        }

        [Fact]
        public void CSharpTestEquality()
        {
            VerifyCSharpFix(
                @"
class A
{
    public static bool operator==(A a1, A a2) { return false; }
}", @"
class A
{
    public static bool operator==(A a1, A a2) { return false; }

    public static bool operator !=(A a1, A a2)
    {
        return !(a1 == a2);
    }
}");
        }

        [Fact]
        public void CSharpTestOverloads1()
        {
            VerifyCSharpFix(
                @"
class A
{
    public static bool operator==(A a1, A a2) { return false; }
    public static bool operator==(A a1, bool a2) { return false; }
}", @"
class A
{
    public static bool operator==(A a1, A a2) { return false; }

    public static bool operator !=(A a1, A a2)
    {
        return !(a1 == a2);
    }

    public static bool operator==(A a1, bool a2) { return false; }

    public static bool operator !=(A a1, bool a2)
    {
        return !(a1 == a2);
    }
}");
        }

        [Fact]
        public void CSharpTestInequality()
        {
            VerifyCSharpFix(
                @"
class A
{
    public static bool operator!=(A a1, A a2) { return false; }
}", @"
class A
{
    public static bool operator!=(A a1, A a2) { return false; }

    public static bool operator ==(A a1, A a2)
    {
        return !(a1 != a2);
    }
}");
        }

        [Fact]
        public void CSharpTestLessThan()
        {
            VerifyCSharpFix(
                @"
class A
{
    public static bool operator<(A a1, A a2) { return false; }
}", @"
class A
{
    public static bool operator<(A a1, A a2) { return false; }

    public static bool operator >(A a1, A a2)
    {
        throw new System.NotImplementedException();
    }
}");
        }

        [Fact]
        public void CSharpTestLessThanOrEqual()
        {
            VerifyCSharpFix(
                @"
class A
{
    public static bool operator<=(A a1, A a2) { return false; }
}", @"
class A
{
    public static bool operator<=(A a1, A a2) { return false; }

    public static bool operator >=(A a1, A a2)
    {
        throw new System.NotImplementedException();
    }
}");
        }

        [Fact]
        public void CSharpTestGreaterThan()
        {
            VerifyCSharpFix(
                @"
class A
{
    public static bool operator>(A a1, A a2) { return false; }
}", @"
class A
{
    public static bool operator>(A a1, A a2) { return false; }

    public static bool operator <(A a1, A a2)
    {
        throw new System.NotImplementedException();
    }
}");
        }

        [Fact]
        public void CSharpTestGreaterThanOrEqual()
        {
            VerifyCSharpFix(
                @"
class A
{
    public static bool operator>=(A a1, A a2) { return false; }
}", @"
class A
{
    public static bool operator>=(A a1, A a2) { return false; }

    public static bool operator <=(A a1, A a2)
    {
        throw new System.NotImplementedException();
    }
}");
        }

        [Fact]
        public void VisualBasicTestEquality()
        {
            VerifyBasicFix(
                @"
class A
    public shared operator =(a1 as A, a2 as A) as boolean
        return false
    end operator
end class", @"
class A
    public shared operator =(a1 as A, a2 as A) as boolean
        return false
    end operator

    Public Shared Operator <>(a1 As A, a2 As A) As Boolean
        Return Not a1 = a2
    End Operator
end class");
        }

        [Fact]
        public void VisualBasicTestInequality()
        {
            VerifyBasicFix(
                @"
class A
    public shared operator <>(a1 as A, a2 as A) as boolean
        return false
    end operator
end class", @"
class A
    public shared operator <>(a1 as A, a2 as A) as boolean
        return false
    end operator

    Public Shared Operator =(a1 As A, a2 As A) As Boolean
        Return Not a1 <> a2
    End Operator
end class");
        }

        [Fact]
        public void VisualBasicTestLessThan()
        {
            VerifyBasicFix(
                @"
class A
    public shared operator <(a1 as A, a2 as A) as boolean
        return false
    end operator
end class", @"
class A
    public shared operator <(a1 as A, a2 as A) as boolean
        return false
    end operator

    Public Shared Operator >(a1 As A, a2 As A) As Boolean
        Throw New System.NotImplementedException()
    End Operator
end class");
        }
    }
}


text:
class Server
{
public:
	Server();
	~Server();

	void run();
protected:

	void handleNetworkMessages();
	unsigned int systemAddressToClientID(RakNet::SystemAddress& systemAddress);

	//Connection functions
	void addNewConnection(RakNet::SystemAddress systemAddress);
	void removeConnection(RakNet::SystemAddress systemAddress);

	void sendClientIDToClient(unsigned int uiClientID);
	GameObject createNewObject(RakNet::BitStream& bsIn, RakNet::SystemAddress& ownerSysAddress);
	void updateObject(RakNet::BitStream& bsIn, RakNet::SystemAddress& ownerSysAddress);
	void sendGameObjectToAllClients(GameObject& gameObject, RakNet::SystemAddress ownerSystemAddress);
	void sendGameObjectToClient(GameObject& gameObject, RakNet::SystemAddress ownerSystemAddress);
	void sendAllGameObjectsToClient(RakNet::SystemAddress ownerSystemAddress);

private:
	struct ConnectionInfo
	{
		unsigned int uiConnectionID;
		RakNet::SystemAddress sysAddress;
	};

	const unsigned short PORT = 5456;
	RakNet::RakPeerInterface* m_pPeerInterface;

	unsigned int m_uiConnectionCounter;
	std::unordered_map<unsigned int, ConnectionInfo> m_connectedClients;
	std::vector<GameObject> m_gameObjects;
	unsigned int m_uiObjectCounter;
};


text:
/**
 * Retrieve the hexadecimal value (as a string) of the current ASN.1 element
 * @returns {string}
 * @public
 */
ASN1.prototype.getHexStringValue = function(){
    var hexString = this.toHexString();
    var offset = this.header * 2;
    var length = this.length * 2;
    return hexString.substr(offset,length);
};

/**
 * Method to parse a pem encoded string containing both a public or private key.
 * The method will translate the pem encoded string in a der encoded string and
 * will parse private key and public key parameters. This method accepts public key
 * in the rsaencryption pkcs #1 format (oid: 1.2.840.113549.1.1.1).
 * @todo Check how many rsa formats use the same format of pkcs #1. The format is defined as:
 * PublicKeyInfo ::= SEQUENCE {
 *   algorithm       AlgorithmIdentifier,
 *   PublicKey       BIT STRING
 * }
 * Where AlgorithmIdentifier is:
 * AlgorithmIdentifier ::= SEQUENCE {
 *   algorithm       OBJECT IDENTIFIER,     the OID of the enc algorithm
 *   parameters      ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1)
 * }
 * and PublicKey is a SEQUENCE encapsulated in a BIT STRING
 * RSAPublicKey ::= SEQUENCE {
 *   modulus           INTEGER,  -- n
 *   publicExponent    INTEGER   -- e
 * }
 * it's possible to examine the structure of the keys obtained from openssl using
 * an asn.1 dumper as the one used here to parse the components: http://lapo.it/asn1js/
 * @argument {string} pem the pem encoded string, can include the BEGIN/END header/footer
 * @private
 */
RSAKey.prototype.parseKey = function(pem) {
    try{
        var reHex = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/;
        var der = reHex.test(pem) ? Hex.decode(pem) : Base64.unarmor(pem);
        var asn1 = ASN1.decode(der);
        if (asn1.sub.length === 9){
            // the data is a Private key
            //in order
            //Algorithm version, n, e, d, p, q, dmp1, dmq1, coeff
            //Alg version, modulus, public exponent, private exponent, prime 1, prime 2, exponent 1, exponent 2, coefficient
            var modulus = asn1.sub[1].getHexStringValue(); //bigint
            this.n = parseBigInt(modulus, 16);

            var public_exponent = asn1.sub[2].getHexStringValue(); //int
            this.e = parseInt(public_exponent, 16);

            var private_exponent = asn1.sub[3].getHexStringValue(); //bigint
            this.d = parseBigInt(private_exponent, 16);

            var prime1 = asn1.sub[4].getHexStringValue(); //bigint
            this.p = parseBigInt(prime1, 16);

            var prime2 = asn1.sub[5].getHexStringValue(); //bigint
            this.q = parseBigInt(prime2, 16);

            var exponent1 = asn1.sub[6].getHexStringValue(); //bigint
            this.dmp1 = parseBigInt(exponent1, 16);

            var exponent2 = asn1.sub[7].getHexStringValue(); //bigint
            this.dmq1 = parseBigInt(exponent2, 16);

            var coefficient = asn1.sub[8].getHexStringValue(); //bigint
            this.coeff = parseBigInt(coefficient, 16);

        }else if (asn1.sub.length === 2){
            //Public key
            //The data PROBABLY is a public key
            var bit_string = asn1.sub[1];
            var sequence   = bit_string.sub[0];

            var modulus = sequence.sub[0].getHexStringValue();
            this.n = parseBigInt(modulus, 16);
            var public_exponent = sequence.sub[1].getHexStringValue();
            this.e = parseInt(public_exponent, 16);

        }else{
            return false;
        }
        return true;
    }catch(ex){
        return false;
    }
};

/**
 * Translate rsa parameters in a hex encoded string representing the rsa key.
 * The translation follow the ASN.1 notation :
 * RSAPrivateKey ::= SEQUENCE {
 *   version           Version,
 *   modulus           INTEGER,  -- n
 *   publicExponent    INTEGER,  -- e
 *   privateExponent   INTEGER,  -- d
 *   prime1            INTEGER,  -- p
 *   prime2            INTEGER,  -- q
 *   exponent1         INTEGER,  -- d mod (p1)
 *   exponent2         INTEGER,  -- d mod (q-1)
 *   coefficient       INTEGER,  -- (inverse of q) mod p
 * }
 * @returns {string}  DER Encoded String representing the rsa private key
 * @private
 */
RSAKey.prototype.getPrivateBaseKey = function() {
    //Algorithm version, n, e, d, p, q, dmp1, dmq1, coeff
    //Alg version, modulus, public exponent, private exponent, prime 1, prime 2, exponent 1, exponent 2, coefficient
    var options = {
        'array' : [
            new KJUR.asn1.DERInteger({'int'    : 0}),
            new KJUR.asn1.DERInteger({'bigint' : this.n}),
            new KJUR.asn1.DERInteger({'int'    : this.e}),
            new KJUR.asn1.DERInteger({'bigint' : this.d}),
            new KJUR.asn1.DERInteger({'bigint' : this.p}),
            new KJUR.asn1.DERInteger({'bigint' : this.q}),
            new KJUR.asn1.DERInteger({'bigint' : this.dmp1}),
            new KJUR.asn1.DERInteger({'bigint' : this.dmq1}),
            new KJUR.asn1.DERInteger({'bigint' : this.coeff})
        ]
    };
    var seq = new KJUR.asn1.DERSequence(options);
    return seq.getEncodedHex();
};

/**
 * base64 (pem) encoded version of the DER encoded representation
 * @returns {string} pem encoded representation without header and footer
 * @public
 */
RSAKey.prototype.getPrivateBaseKeyB64 = function (){
    return hex2b64(this.getPrivateBaseKey());
};

/**
 * Translate rsa parameters in a hex encoded string representing the rsa public key.
 * The representation follow the ASN.1 notation :
 * PublicKeyInfo ::= SEQUENCE {
 *   algorithm       AlgorithmIdentifier,
 *   PublicKey       BIT STRING
 * }
 * Where AlgorithmIdentifier is:
 * AlgorithmIdentifier ::= SEQUENCE {
 *   algorithm       OBJECT IDENTIFIER,     the OID of the enc algorithm
 *   parameters      ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1)
 * }
 * and PublicKey is a SEQUENCE encapsulated in a BIT STRING
 * RSAPublicKey ::= SEQUENCE {
 *   modulus           INTEGER,  -- n
 *   publicExponent    INTEGER   -- e
 * }
 * @returns {string} DER Encoded String representing the rsa public key
 * @private
 */
RSAKey.prototype.getPublicBaseKey = function() {
    var options = {
        'array' : [
            new KJUR.asn1.DERObjectIdentifier({'oid':'1.2.840.113549.1.1.1'}), //RSA Encryption pkcs #1 oid
            new KJUR.asn1.DERNull()
        ]
    };
    var first_sequence = new KJUR.asn1.DERSequence(options);

    options = {
        'array' : [
            new KJUR.asn1.DERInteger({'bigint' : this.n}),
            new KJUR.asn1.DERInteger({'int' : this.e})
        ]
    };
    var second_sequence = new KJUR.asn1.DERSequence(options);

    options = {
        'hex' : '00'+second_sequence.getEncodedHex()
    };
    var bit_string = new KJUR.asn1.DERBitString(options);

    options = {
        'array' : [
            first_sequence,
            bit_string
        ]
    };
    var seq = new KJUR.asn1.DERSequence(options);
    return seq.getEncodedHex();
};

/**
 * base64 (pem) encoded version of the DER encoded representation
 * @returns {string} pem encoded representation without header and footer
 * @public
 */
RSAKey.prototype.getPublicBaseKeyB64 = function (){
    return hex2b64(this.getPublicBaseKey());
};

/**
 * wrap the string in block of width chars. The default value for rsa keys is 64
 * characters.
 * @param {string} str the pem encoded string without header and footer
 * @param {Number} [width=64] - the length the string has to be wrapped at
 * @returns {string}
 * @private
 */
RSAKey.prototype.wordwrap = function(str, width) {
    width = width || 64;
    if (!str)
        return str;
    var regex = '(.{1,' + width + '})( +|$\n?)|(.{1,' + width + '})';
    return str.match(RegExp(regex, 'g')).join('\n');
};

/**
 * Retrieve the pem encoded private key
 * @returns {string} the pem encoded private key with header/footer
 * @public
 */
RSAKey.prototype.getPrivateKey = function() {
    var key = "-----BEGIN RSA PRIVATE KEY-----\n";
    key += this.wordwrap(this.getPrivateBaseKeyB64()) + "\n";
    key += "-----END RSA PRIVATE KEY-----";
    return key;
};

/**
 * Retrieve the pem encoded public key
 * @returns {string} the pem encoded public key with header/footer
 * @public
 */
RSAKey.prototype.getPublicKey = function() {
    var key = "-----BEGIN PUBLIC KEY-----\n";
    key += this.wordwrap(this.getPublicBaseKeyB64()) + "\n";
    key += "-----END PUBLIC KEY-----";
    return key;
};

/**
 * Check if the object contains the necessary parameters to populate the rsa modulus
 * and public exponent parameters.
 * @param {Object} [obj={}] - An object that may contain the two public key
 * parameters
 * @returns {boolean} true if the object contains both the modulus and the public exponent
 * properties (n and e)
 * @todo check for types of n and e. N should be a parseable bigInt object, E should
 * be a parseable integer number
 * @private
 */
RSAKey.prototype.hasPublicKeyProperty = function(obj){
    obj = obj || {};
    return obj.hasOwnProperty('n') &&
           obj.hasOwnProperty('e');
};

/**
 * Check if the object contains ALL the parameters of an RSA key.
 * @param {Object} [obj={}] - An object that may contain nine rsa key
 * parameters
 * @returns {boolean} true if the object contains all the parameters needed
 * @todo check for types of the parameters all the parameters but the public exponent
 * should be parseable bigint objects, the public exponent should be a parseable integer number
 * @private
 */
RSAKey.prototype.hasPrivateKeyProperty = function(obj){
    obj = obj || {};
    return obj.hasOwnProperty('n') &&
           obj.hasOwnProperty('e') &&
           obj.hasOwnProperty('d') &&
           obj.hasOwnProperty('p') &&
           obj.hasOwnProperty('q') &&
           obj.hasOwnProperty('dmp1') &&
           obj.hasOwnProperty('dmq1') &&
           obj.hasOwnProperty('coeff');
};

/**
 * Parse the properties of obj in the current rsa object. Obj should AT LEAST
 * include the modulus and public exponent (n, e) parameters.
 * @param {Object} obj - the object containing rsa parameters
 * @private
 */
RSAKey.prototype.parsePropertiesFrom = function(obj){
    this.n = obj.n;
    this.e = obj.e;

    if (obj.hasOwnProperty('d')){
        this.d = obj.d;
        this.p = obj.p;
        this.q = obj.q;
        this.dmp1 = obj.dmp1;
        this.dmq1 = obj.dmq1;
        this.coeff = obj.coeff;
    }
};

/**
 * Create a new JSEncryptRSAKey that extends Tom Wu's RSA key object.
 * This object is just a decorator for parsing the key parameter
 * @param {string|Object} key - The key in string format, or an object containing
 * the parameters needed to build a RSAKey object.
 * @constructor
 */
var JSEncryptRSAKey = function(key) {
    // Call the super constructor.
    RSAKey.call(this);
    // If a key key was provided.
    if (key) {
        // If this is a string...
        if (typeof key === 'string') {
            this.parseKey(key);
        }else if (this.hasPrivateKeyProperty(key)||this.hasPublicKeyProperty(key)) {
            // Set the values for the key.
            this.parsePropertiesFrom(key);
        }
    }
};

// Derive from RSAKey.
JSEncryptRSAKey.prototype = new RSAKey();

// Reset the contructor.
JSEncryptRSAKey.prototype.constructor = JSEncryptRSAKey;

/**
 *
 * @param {Object} [options = {}] - An object to customize JSEncrypt behaviour
 * possible parameters are:
 * - default_key_size        {number}  default: 1024 the key size in bit
 * - default_public_exponent {string}  default: '010001' the hexadecimal representation of the public exponent
 * - log                     {boolean} default: false whether log warn/error or not
 * @constructor
 */
var JSEncrypt = function(options) {
    options = options || {};
    this.default_key_size = parseInt(options.default_key_size) || 1024;
    this.default_public_exponent = options.default_public_exponent || '010001'; //65537 default openssl public exponent for rsa key type
    this.log = options.log || false;
    // The private and public key.
    this.key = null;
};

/**
 * Method to set the rsa key parameter (one method is enough to set both the public
 * and the private key, since the private key contains the public key paramenters)
 * Log a warning if logs are enabled
 * @param {Object|string} key the pem encoded string or an object (with or without header/footer)
 * @public
 */
JSEncrypt.prototype.setKey = function(key){
    if (this.log && this.key)
        console.warn('A key was already set, overriding existing.');
    this.key = new JSEncryptRSAKey(key);
};

/**
 * Proxy method for setKey, for api compatibility
 * @see setKey
 * @public
 */
JSEncrypt.prototype.setPrivateKey = function(privkey) {
    // Create the key.
    this.setKey(privkey);
};

/**
 * Proxy method for setKey, for api compatibility
 * @see setKey
 * @public
 */
JSEncrypt.prototype.setPublicKey = function(pubkey) {
    // Sets the public key.
    this.setKey(pubkey);
};

/**
 * Proxy method for RSAKey object's decrypt, decrypt the string using the private
 * components of the rsa key object. Note that if the object was not set will be created
 * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor
 * @param {string} string base64 encoded crypted string to decrypt
 * @return {string} the decrypted string
 * @public
 */
JSEncrypt.prototype.decrypt = function(string) {
    // Return the decrypted string.
    try{
        return this.getKey().decrypt(b64tohex(string));
    }catch(ex){
        return false;
    }
};

/**
 * Proxy method for RSAKey object's encrypt, encrypt the string using the public
 * components of the rsa key object. Note that if the object was not set will be created
 * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor
 * @param {string} string the string to encrypt
 * @return {string} the encrypted string encoded in base64
 * @public
 */
JSEncrypt.prototype.encrypt = function(string) {
    // Return the encrypted string.
    try{
        return hex2b64(this.getKey().encrypt(string));
    }catch(ex){
        return false;
    }
};

/**
 * Getter for the current JSEncryptRSAKey object. If it doesn't exists a new object
 * will be created and returned
 * @param {callback} [cb] the callback to be called if we want the key to be generated
 * in an async fashion
 * @returns {JSEncryptRSAKey} the JSEncryptRSAKey object
 * @public
 */
JSEncrypt.prototype.getKey = function(cb){
    // Only create new if it does not exist.
    if (!this.key) {
        // Get a new private key.
        this.key = new JSEncryptRSAKey();
        if (cb && {}.toString.call(cb) === '[object Function]'){
            this.key.generateAsync(this.default_key_size, this.default_public_exponent,cb);
            return;
        }
        // Generate the key.
        this.key.generate(this.default_key_size, this.default_public_exponent);
    }
    return this.key;
};

/**
 * Returns the pem encoded representation of the private key
 * If the key doesn't exists a new key will be created
 * @returns {string} pem encoded representation of the private key WITH header and footer
 * @public
 */
JSEncrypt.prototype.getPrivateKey = function() {
    // Return the private representation of this key.
    return this.getKey().getPrivateKey();
};

/**
 * Returns the pem encoded representation of the private key
 * If the key doesn't exists a new key will be created
 * @returns {string} pem encoded representation of the private key WITHOUT header and footer
 * @public
 */
JSEncrypt.prototype.getPrivateKeyB64 = function() {
    // Return the private representation of this key.
    return this.getKey().getPrivateBaseKeyB64();
};

/**
 * Returns the pem encoded representation of the public key
 * If the key doesn't exists a new key will be created
 * @returns {string} pem encoded representation of the public key WITH header and footer
 * @public
 */
JSEncrypt.prototype.getPublicKey = function() {
    // Return the private representation of this key.
    return this.getKey().getPublicKey();
};

/**
 * Returns the pem encoded representation of the public key
 * If the key doesn't exists a new key will be created
 * @returns {string} pem encoded representation of the public key WITHOUT header and footer
 * @public
 */
JSEncrypt.prototype.getPublicKeyB64 = function() {
    // Return the private representation of this key.
    return this.getKey().getPublicBaseKeyB64();
};


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Uses of Class net.floodlightcontroller.core.internal.OFSwitchHandlerTestBase</title>
<meta name="date" content="2015-06-22">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Class
net.floodlightcontroller.core.internal.OFSwitchHandlerTestBase

Packages that use OFSwitchHandlerTestBase

Package
Description

net.floodlightcontroller.core.internal

Uses of OFSwitchHandlerTestBase in net.floodlightcontroller.core.internal

Subclasses of OFSwitchHandlerTestBase in net.floodlightcontroller.core.internal

Modifier and Type
Class and Description

class
OFSwitchHandshakeHandlerVer10Test

class
OFSwitchHandshakeHandlerVer13Test

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes


text:
if Configuration.AppArgs[0] then i = tonumber(Configuration.AppArgs[0]) else i = 3 end
while (true) do
	local c = 2
	continue = true
	while (continue) do
		if c < i and i % c == 0 then
			continue = false
		elseif c >= i then
			continue = false
			Console.WriteLine(tostring(i) .. " IS PRIME")
		end
		c = c + 1
	end
	i = i + 1
end


text:
/*
 * UndoableModifyRecordFieldEdit.java
 * Creation date: Sept. 25th, 2007.
 * By: Jennifer Chen
 */
package org.openquark.gems.client;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.swing.undo.AbstractUndoableEdit;
import javax.swing.undo.UndoableEdit;

import org.openquark.cal.compiler.FieldName;
import org.openquark.gems.client.Gem.PartInput;
import org.openquark.util.Pair;

/**
 * Undoable edit for modifying record fields to a RecordCreationGem,
 * includes adding a new field, deleting and renaming an existing field
 * @author Jennifer Chen
 */
public class UndoableModifyRecordFieldEdit extends AbstractUndoableEdit {

    private static final long serialVersionUID = -4091724130085043703L;

    /** The RecordCreation gem modified. */
    private final RecordCreationGem recordCreationGem;

    /** The old field names and inputs before the action */
    private final Map<String, PartInput> oldMap;

    /** The updated field names and inputs after the action */
    private final Map<String, PartInput> newMap;

    /** The fields before the modification */
    private final List<String> oldModFields;

    /** The fields after the modification */
    private final List<String> newModFields;

    // Use single field for now since not handling multiple actions
    private final String oldModField;

    private final String newModField;

    /** Specifies if the action is adding, deleting or renaming a field */
    private final Action action;

    private enum Action {
        ADD, DELETE, RENAME
    };

    /**
     * Constructor
     * @param gem the RecordCreationGem being modified
     * @param oldMap map from field name to input prior to the modification.
     */
    UndoableModifyRecordFieldEdit(RecordCreationGem gem, Map<String, PartInput> oldMap) {
        this.recordCreationGem = gem;
        this.oldMap = oldMap;
        this.newMap = gem.getFieldNameToInputMap();

        // Determine which action was taken
        action = getAction();

        // Get the fields modified
        Pair<List<String>, List<String>> fieldsModified = getFieldModified();
        oldModFields = fieldsModified.fst();
        newModFields = fieldsModified.snd();

        // Use single field for now since not handling multiple actions
        if (!oldModFields.isEmpty()) {
            oldModField = oldModFields.get(0);
        } else {
            oldModField = null;
        }
        if (!newModFields.isEmpty()) {
            newModField = newModFields.get(0);
        } else {
            newModField = null;
        }
    }

    /**
     * Determines the action of of this edit. Note: can't handle multiple actions
     * @return ADD, DELETE or RENAME
     */
    private Action getAction() {
        int diff = newMap.size() - oldMap.size();
        if (diff > 0) {
            return Action.ADD;
        } else if (diff == 0) {
            return Action.RENAME;
        } else {
            return Action.DELETE;
        }
    }

    /**
     * Determined the fields being modified
     * @return a set of fields modified and a set of new fields
     */
    private Pair<List<String>, List<String>> getFieldModified() {

        Set<String> oldMapSet = oldMap.keySet();
        Set<String> newMapSet = newMap.keySet();

        // The set of fields only in the old map, ie either the deleted field or the renamed field
        List<String> inOldMapOnly = new ArrayList<String>(oldMapSet);
        inOldMapOnly.removeAll(newMapSet);

        // The set of fields only in the new map, ie either the added field or the renamed field
        List<String> inNewMapOnly = new ArrayList<String>(newMapSet);
        inNewMapOnly.removeAll(oldMapSet);

        return new Pair<List<String>, List<String>>(inOldMapOnly, inNewMapOnly);

    }

    /**
     * A reasonable name for this edit.
     */
    @Override
    public String getPresentationName() {
        String actionName = null;
        String fieldName = null;
        switch (action) {
        case ADD:
            actionName = "UndoText_AddRecordField";
            fieldName = newModField;
            break;
        case RENAME:
            actionName = "UndoText_RenameRecordField";
            fieldName = oldModField;
            break;
        case DELETE:
            actionName = "UndoText_DeleteRecordField";
            fieldName = oldModField;
            break;
        }
        return GemCutter.getResourceString(actionName) + " " + fieldName;
    }

    /**
     * Redo the edit.
     */
    @Override
    public void redo() {
        super.redo();
        switch (action) {
        case ADD:
            recordCreationGem.addNewFields(1);
            break;

        case RENAME:
            int fieldIndex = recordCreationGem.getFieldIndex(FieldName.make(oldModField));
            recordCreationGem.renameRecordField(fieldIndex, newModField);
            break;

        case DELETE:
            recordCreationGem.deleteField(oldModField);
            break;
        }
    }

    /**
     * Undo the edit.
     */
    @Override
    public void undo() {
        super.undo();

        switch (action) {
        case ADD:
            recordCreationGem.deleteField(newModField);
            recordCreationGem.setNextPossibleFieldName(recordCreationGem.getNextPossibleFieldName() - 1);
            break;

        case RENAME:
            int fieldIndex = recordCreationGem.getFieldIndex(FieldName.make(newModField));
            recordCreationGem.renameRecordField(fieldIndex, oldModField);
            break;

        case DELETE:
            recordCreationGem.setFieldNames(new ArrayList<String>(oldMap.keySet()));
            recordCreationGem.updateInputs(oldMap);
            break;
        }
    }

    /**
     * Replace anEdit if possible.
     * @return boolean whether the edit was absorbed.
     */
    @Override
    public boolean replaceEdit(UndoableEdit anEdit) {

        // Replace if the other edit is equivalent to this one
        if (!(anEdit instanceof UndoableModifyRecordFieldEdit)) {
            return false;
        }

        UndoableModifyRecordFieldEdit otherEdit = (UndoableModifyRecordFieldEdit)anEdit;

        return (otherEdit.recordCreationGem.equals(this.recordCreationGem) &&
                otherEdit.oldMap.equals(this.oldMap) &&
                otherEdit.newMap.equals(this.newMap) &&
                otherEdit.action == this.action);
    }

}


text:
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;

namespace Microsoft.Protocols.TestTools.StackSdk.Transport
{
    /// <summary>
    /// the interfaces for netbios server transport device<para/>
    /// such as NetbiosServer and TcpServer.
    /// </summary>
    internal interface INetbiosServer : ISpecialTarget, ITargetReceive, IStartable, IAcceptable, IDisconnectable
    {
    }
}


text:
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import i18n from 'i18n';
import classNames from 'classnames';
import { UncontrolledTooltip } from 'reactstrap';

const cssClass = 'file-status-icon';

/**
 * File status icon (e.g. restricted access) with a tooltip
 */
class FileStatusIcon extends PureComponent {
  /**
   * @param {boolean} hasRestrictedAccess
   * @returns {Object}
   */
  buildTrackedFormUpload(hasRestrictedAccess) {
    const fontIconClass = hasRestrictedAccess
      ? 'font-icon-address-card'
      : 'font-icon-address-card-warning';
    const className = classNames('icon', `${cssClass}__icon`, fontIconClass);
    const dataTitle = hasRestrictedAccess
      ? i18n._t(
        'SilverStripe\\Admin\\FileStatusIcon.TRACKED_FORM_UPLOAD_RESTRICTED',
        'Form submission'
      )
      : i18n._t(
        'SilverStripe\\Admin\\FileStatusIcon.TRACKED_FORM_UPLOAD_UNRESTRICTED',
        'Form submission, unrestricted access'
      );
    return { className, 'data-title': dataTitle };
  }

  /**
   * @returns {Object}
   */
  buildRestrictedFileAttrs() {
    const className = classNames('icon', `${cssClass}__icon`, 'font-icon-user-lock');
    const dataTitle = i18n._t(
      'SilverStripe\\Admin\\FileStatusIcon.ACCESS_RESTRICTED',
      'Restricted access'
    );
    return { className, 'data-title': dataTitle };
  }

  /**
   * @param {string} placement
   * @param {string} id
   * @param {string} title
   * @returns {*}
   */
  renderTooltip(placement, id, title) {
    return (
      <UncontrolledTooltip placement={placement} target={id} delay={{ show: 300, hide: 0 }}>
        {title}
      </UncontrolledTooltip>
    );
  }

  /**
   * @returns {*}
   */
  render() {
    const {
      fileID, hasRestrictedAccess, isTrackedFormUpload, placement, extraClassName,
      disableTooltip, includeBackground
    } = this.props;
    if (!isTrackedFormUpload && !hasRestrictedAccess) {
      return '';
    }
    const backgroundClass = includeBackground ? 'file-status-icon--background' : '';
    const className = classNames([cssClass, backgroundClass, extraClassName]);
    const attrs = isTrackedFormUpload
      ? this.buildTrackedFormUpload(hasRestrictedAccess)
      : this.buildRestrictedFileAttrs();
    const idType = isTrackedFormUpload ? 'tracked-form-upload' : 'restricted';
    const id = `FileStatusIcon-${idType}-${fileID}`;
    const tooltip = disableTooltip ? '' : this.renderTooltip(placement, id, attrs['data-title']);
    return (

        {tooltip}

    );
  }
}

FileStatusIcon.propTypes = {
  fileID: PropTypes.number,
  hasRestrictedAccess: PropTypes.bool,
  isTrackedFormUpload: PropTypes.bool,
  placement: PropTypes.string,
  disableTooltip: PropTypes.bool,
  extraClassName: PropTypes.string,
  includeBackground: PropTypes.bool
};

FileStatusIcon.defaultProps = {
  placement: 'auto',
  disableTooltip: false
};

export default FileStatusIcon;


text:
import {CriteriumId} from './Criterium';
import {toMarkdown} from '../Util/util';

export type LevelId = string;

export interface LevelJsonObject {
    id: string,
    title: string,
    description: string,
    score: number,
    use_range_score: boolean,
    minimum_score: number|null,
    is_default: boolean,
    criterium_id: string
}

export default class Level {
    public id: LevelId;
    public title: string;
    public description: string;
    public score: number;
    public useRangeScore: boolean;
    public minimumScore: number|null;
    public isDefault: boolean;
    public criteriumId: CriteriumId = '';

    constructor(title: string, description: string = '', score: number = 10, useRangeScore: boolean = false, minimumScore: number|null = null, isDefault: boolean = false, id?: LevelId) {
        this.title = title;
        this.description = description;
        this.score = score;
        this.useRangeScore = useRangeScore;
        this.minimumScore = minimumScore;
        this.isDefault = isDefault;
        if (!id) {
            this.id = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); // GUID
        } else {
            this.id = id;
        }
    }

    get use_range_score() {
        return this.useRangeScore;
    }

    set use_range_score(useRangeScore: boolean) {
        this.useRangeScore = useRangeScore;
        if (!useRangeScore) {
            this.minimumScore = null;
        } else {
            this.minimumScore = 0;
        }
    }

    get minimum_score() {
        return this.minimumScore;
    }

    set minimum_score(score: number|null) {
        if (typeof score === 'number') {
            this.minimumScore = score;
        } else {
            this.minimumScore = null;
        }
    }

    get is_default() {
        return this.isDefault;
    }

    get criterium_id() {
        return this.criteriumId;
    }

    public toString(): string {
        return `Level (id: ${this.id}, title: ${this.title})`;
    }

    toJSON(): LevelJsonObject {
        return {
            id: this.id,
            title: this.title,
            description: this.description,
            score: this.score,
            use_range_score: this.useRangeScore,
            minimum_score: this.minimumScore,
            is_default: this.isDefault,
            criterium_id: this.criteriumId
        }
    }

    toMarkdown(): string {
        return toMarkdown(this.description);
    }

    static fromJSON(level: string|LevelJsonObject): Level {
        let levelObject: LevelJsonObject;

        if (typeof level === 'string') {
            levelObject = JSON.parse(level);
        } else {
            levelObject = level;
        }

        const newLevel = new Level(
            levelObject.title,
            levelObject.description,
            levelObject.score,
            levelObject.use_range_score || false,
            typeof levelObject.minimum_score === 'number' ? levelObject.minimum_score : null,
            levelObject.is_default,
            levelObject.id
        );
        newLevel.criteriumId = levelObject.criterium_id;
        return newLevel;
    }
}


text:
class AddGradeScriptToAssignment < ActiveRecord::Migration
  def self.up
    add_column :assignments, :grading_script, :string
  end

  def self.down
    remove_column :assignments, :grading_script
  end
end


text:
package com.morcinek.android.codegenerator;

import java.io.IOException;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPathExpressionException;

import org.fest.assertions.Assertions;
import org.junit.Before;
import org.junit.Test;
import org.xml.sax.SAXException;

import com.morcinek.android.codegenerator.codegeneration.TemplateCodeGenerator;
import com.morcinek.android.codegenerator.codegeneration.providers.factories.ActivityResourceProvidersFactory;
import com.morcinek.android.codegenerator.codegeneration.templates.ResourceTemplatesProvider;
import com.morcinek.android.codegenerator.codegeneration.templates.TemplatesProvider;
import com.morcinek.android.codegenerator.extractor.XMLResourceExtractor;
import com.morcinek.android.codegenerator.extractor.string.FileNameExtractor;
import com.morcinek.android.codegenerator.util.InputStreamProvider;

public class ActivityCodeGeneratorTest {

    private CodeGenerator codeGenerator;

    private InputStreamProvider inputStreamProvider = new InputStreamProvider();

    private TemplatesProvider templatesProvider = new ResourceTemplatesProvider();

    @Before
    public void setUp() throws Exception {
        codeGenerator = new CodeGenerator(XMLResourceExtractor.createResourceExtractor(), new FileNameExtractor(), new TemplateCodeGenerator("Activity_template", new ActivityResourceProvidersFactory(), new ResourceTemplatesProvider()));
    }

    @Test
    public void viewPagerProduceCodeTest() throws Exception {
        // given
        // when
        String producedCode = produceCodeFromFilePath("codegeneration/layouts/view_pager.xml");
        System.out.println(producedCode);
        String templateForName = templatesProvider.provideTemplateForName("results/activities/ViewPagerActivity.java");
        System.out.println("-------------------");
        System.out.println(templateForName);
        // then
        Assertions.assertThat(producedCode).isNotNull().isEqualTo(
                templateForName);
    }

    @Test
    public void searchListProduceCodeTest() throws Exception {
        // given
        // when
        String producedCode = produceCodeFromFilePath("codegeneration/layouts/search_list.xml");

        // then
        Assertions.assertThat(producedCode).isNotNull().isEqualTo(templatesProvider.provideTemplateForName("results/activities/SearchListActivity.java"));
    }

    @Test
    public void createGameProduceCodeTest() throws Exception {
        // given
        // when
        String producedCode = produceCodeFromFilePath("codegeneration/layouts/create_game.xml");

        // then
        Assertions.assertThat(producedCode).isNotNull().isEqualTo(templatesProvider.provideTemplateForName("results/activities/CreateGameActivity.java"));
    }

    private String produceCodeFromFilePath(String filePath) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException {
        return codeGenerator.produceCode(inputStreamProvider.getStreamFromResource(filePath), filePath);
    }
}


text:
//
//  SkywareHttpTool.h
//  RoyalTeapot
//
//  Created by 李晓 on 15/7/16.
//  Copyright (c) 2015年 RoyalStar. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "SkywareSDK.h"
#import <HttpTool.h>
#import <SystemDeviceTool.h>
#import <SVProgressHUD.h>
#import <NSString+Hash.h>
#import <NSString+Extension.h>

typedef enum {
    request_success = 200,                      // 响应成功
    request_parameter_error = 400,             // 签名不正确或请求参数不正确
    request_token_inexistence = 401,          // token不存在
    request_prohibit = 403,                  // 403:禁止访问(黑名单)
    request_resultless = 404,               // 请求无结果
    request_method_inexistence = 405,      // 方法不存在
    request_https = 406,                  // 必须https
    request_frequently = 429,            // 访问速度过快
    request_services_error = 500,       // 服务器错误
    request_create_folder_error = 501, // 创建文件夹失败

} resultMessage;

@interface SkywareHttpTool : NSObject

/**
 *  请求成功后返回判断状态码,做出相应的判断
 *
 *  @param json    返回的Json
 *  @param success 成功 block
 *  @param failure 错误 block
 */
+(void) responseHttpToolWithJson:(id)json Success:(void(^)(SkywareResult *result)) success failure:(void (^)(SkywareResult *result)) failure;

/**
 *  请求失败后返回错误信息,做出相应的判断
 *
 *  @param Error    返回的错误信息
 */
+ (void)ErrorLogDispose:(NSError *)error;

/**
 *  发送GET请求
 *
 */
+ (void) HttpToolGetWithUrl:(NSString *) url paramesers:(NSArray *) parameser requestHeaderField:(NSDictionary *) header SuccessJson:(void(^)(id json)) success failure:(void (^)(NSError *error)) failure;

/**
 *  发送POST请求
 *
 */
+ (void) HttpToolPostWithUrl:(NSString *) url paramesers:(NSDictionary *) parameser requestHeaderField:(NSDictionary *) header SuccessJson:(void(^)(id json)) success failure:(void (^)(NSError *error)) failure;

/**
 *  发送PUT请求
 *
 */
+ (void) HttpToolPutWithUrl:(NSString *) url paramesers:(NSDictionary *) parameser requestHeaderField:(NSDictionary *) header SuccessJson:(void(^)(id json)) success failure:(void (^)(NSError *error)) failure;

/**
 *  发送Delete请求
 *
 */
+ (void) HttpToolDeleteWithUrl:(NSString *) url paramesers:(NSArray *) parameser requestHeaderField:(NSDictionary *) header SuccessJson:(void(^)(id json)) success failure:(void (^)(NSError *error)) failure;

/**
 *  发送Post请求上传数据
 *
 */
+ (void)HttpToolUploadWithUrl:(NSString *)url paramesers:(NSDictionary *)parameser requestHeaderField:(NSDictionary *) header Data:(NSData *)data Name:(NSString *)name FileName:(NSString *) fileName MainType:(NSString *)mainType SuccessJson:(void(^)(id json)) success failure:(void (^)(NSError *error)) failure;

@end


text:
<!DOCTYPE html>
<html lang="en" ng-app="ecsaApp">
<head>
  <meta charset="utf-8">
  <title>Welcome to the ECSA!</title>
  <meta name="description" content="Home page of the East Campus Students' Association.">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="keywords" content ="ECSA, ECV, UAlberta">

  <link rel="stylesheet" href="css/app.css"/>
  <link rel="stylesheet" href="css/bootstrap.min.css">
  <link href='https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300' rel='stylesheet' type='text/css'/>
  <!-- In production use:<script src="//ajax.googleapis.com/ajax/libs/angularjs/x.x.x/angular.min.js"></script> -->
  <script src="bower_components/angular/angular.js"></script>
  <script src="bower_components/angular-route/angular-route.js"></script>
  <script src="js/app.js"></script>
  <script src="js/services.js"></script>
  <script src="js/controllers.js"></script>
  <script src="js/filters.js"></script>
  <script src="js/directives.js"></script>
  <script src="js/ui-bootstrap-tpls-0.11.0.js"></script>
  <script src="js/angular-ui-router.js"></script>

</head>
<body>
  <div ui-view class="full-height" style="height: 100%;"></div>
</body>
</html>


text:
#include "router_core_private.h"
#include <qpid/dispatch/amqp.h>
#include <stdio.h>
#include <strings.h>

//
// NOTE: If the in_delivery argument is NULL, the resulting out deliveries
//       shall be pre-settled.
//
typedef int (*qdr_forward_message_t) (qdr_core_t      *core,
                                      qdr_address_t   *addr,
                                      qd_message_t    *msg,
                                      qdr_delivery_t  *in_delivery,
                                      bool             exclude_inprocess,
                                      bool             control);

typedef bool (*qdr_forward_attach_t) (qdr_core_t     *core,
                                      qdr_address_t  *addr,
                                      qdr_link_t     *link,
                                      qdr_terminus_t *source,
                                      qdr_terminus_t *target);

struct qdr_forwarder_t {
    qdr_forward_message_t forward_message;
    qdr_forward_attach_t  forward_attach;
    bool                  bypass_valid_origins;
};

//==================================================================================
// Built-in Forwarders
//==================================================================================

static int qdr_forward_message_null_CT(qdr_core_t      *core,
                                       qdr_address_t   *addr,
                                       qd_message_t    *msg,
                                       qdr_delivery_t  *in_delivery,
                                       bool             exclude_inprocess,
                                       bool             control)
{
    qd_log(core->log, QD_LOG_CRITICAL, "NULL Message Forwarder Invoked");
    return 0;
}

static bool qdr_forward_attach_null_CT(qdr_core_t     *core,
                                       qdr_address_t  *addr,
                                       qdr_link_t     *link,
                                       qdr_terminus_t *source,
                                       qdr_terminus_t *target)
{
    qd_log(core->log, QD_LOG_CRITICAL, "NULL Attach Forwarder Invoked");
    return false;
}

static void qdr_forward_find_closest_remotes_CT(qdr_core_t *core, qdr_address_t *addr)
{
    qdr_node_t *rnode       = DEQ_HEAD(core->routers);
    int         lowest_cost = 0;

    if (!addr->closest_remotes)
        addr->closest_remotes = qd_bitmask(0);
    addr->cost_epoch  = core->cost_epoch;
    addr->next_remote = -1;

    qd_bitmask_clear_all(addr->closest_remotes);
    while (rnode) {
        if (qd_bitmask_value(addr->rnodes, rnode->mask_bit)) {
            if (lowest_cost == 0) {
                lowest_cost = rnode->cost;
                addr->next_remote = rnode->mask_bit;
            }
            if (lowest_cost == rnode->cost)
                qd_bitmask_set_bit(addr->closest_remotes, rnode->mask_bit);
            else
                break;
        }
        rnode = DEQ_NEXT(rnode);
    }
}

qdr_delivery_t *qdr_forward_new_delivery_CT(qdr_core_t *core, qdr_delivery_t *in_dlv, qdr_link_t *link, qd_message_t *msg)
{
    qdr_delivery_t *out_dlv = new_qdr_delivery_t();
    uint64_t       *tag = (uint64_t*) out_dlv->tag;

    ZERO(out_dlv);
    sys_atomic_init(&out_dlv->ref_count, 0);
    out_dlv->link       = link;
    out_dlv->msg        = qd_message_copy(msg);
    out_dlv->settled    = !in_dlv || in_dlv->settled;
    out_dlv->presettled = out_dlv->settled;
    *tag                = core->next_tag++;
    out_dlv->tag_length = 8;
    out_dlv->error      = 0;

    //
    // Add one to the message fanout. This will later be used in the qd_message_send function that sends out messages.
    //
    qd_message_add_fanout(msg);

    //
    // Create peer linkage if the outgoing delivery is unsettled. This peer linkage is necessary to deal with dispositions that show up in the future.
    // Also create peer linkage if the message is not yet been completely received. This linkage will help us stream large pre-settled multicast messages.
    //
    if (!out_dlv->settled || !qd_message_receive_complete(msg))
        qdr_delivery_link_peers_CT(in_dlv, out_dlv);

    return out_dlv;
}

//
// Drop all pre-settled deliveries pending on the link's
// undelivered list.
//
static void qdr_forward_drop_presettled_CT_LH(qdr_core_t *core, qdr_link_t *link)
{
    qdr_delivery_t *dlv = DEQ_HEAD(link->undelivered);
    qdr_delivery_t *next;

    while (dlv) {
        next = DEQ_NEXT(dlv);
        //
        // Remove pre-settled deliveries unless they are in a link_work
        // record that is being processed.  If it's being processed, it is
        // too late to drop the delivery.
        //
        if (dlv->settled && dlv->link_work && !dlv->link_work->processing) {
            DEQ_REMOVE(link->undelivered, dlv);
            dlv->where = QDR_DELIVERY_NOWHERE;

            //
            // The link-work item representing this pending delivery must be
            // updated to reflect the removal of the delivery.  If the item
            // has no other deliveries associated with it, it can be removed
            // from the work list.
            //
            assert(dlv->link_work);
            if (dlv->link_work && (--dlv->link_work->value == 0)) {
                DEQ_REMOVE(link->work_list, dlv->link_work);
                free_qdr_link_work_t(dlv->link_work);
                dlv->link_work = 0;
            }
            qdr_delivery_decref_CT(core, dlv);
        }
        dlv = next;
    }
}

void qdr_forward_deliver_CT(qdr_core_t *core, qdr_link_t *out_link, qdr_delivery_t *out_dlv)
{
    sys_mutex_lock(out_link->conn->work_lock);

    //
    // If the delivery is pre-settled and the outbound link is at or above capacity,
    // discard all pre-settled deliveries on the undelivered list prior to enqueuing
    // the new delivery.
    //
    if (out_dlv->settled && out_link->capacity > 0 && DEQ_SIZE(out_link->undelivered) >= out_link->capacity)
        qdr_forward_drop_presettled_CT_LH(core, out_link);

    DEQ_INSERT_TAIL(out_link->undelivered, out_dlv);
    out_dlv->where = QDR_DELIVERY_IN_UNDELIVERED;

    // This incref is for putting the delivery in the undelivered list
    qdr_delivery_incref(out_dlv);

    //
    // We must put a work item on the link's work list to represent this pending delivery.
    // If there's already a delivery item on the tail of the work list, simply join that item
    // by incrementing the value.
    //
    qdr_link_work_t *work = DEQ_TAIL(out_link->work_list);
    if (work && work->work_type == QDR_LINK_WORK_DELIVERY) {
        work->value++;
    } else {
        work = new_qdr_link_work_t();
        ZERO(work);
        work->work_type = QDR_LINK_WORK_DELIVERY;
        work->value     = 1;
        DEQ_INSERT_TAIL(out_link->work_list, work);
    }
    qdr_add_link_ref(&out_link->conn->links_with_work, out_link, QDR_LINK_LIST_CLASS_WORK);
    out_dlv->link_work = work;
    sys_mutex_unlock(out_link->conn->work_lock);

    //
    // Activate the outgoing connection for later processing.
    //
    qdr_connection_activate_CT(core, out_link->conn);
}

void qdr_forward_on_message(qdr_core_t *core, qdr_general_work_t *work)
{
    work->on_message(work->on_message_context, work->msg, work->maskbit, work->inter_router_cost);
    qd_message_free(work->msg);
}

void qdr_forward_on_message_CT(qdr_core_t *core, qdr_subscription_t *sub, qdr_link_t *link, qd_message_t *msg)
{
    qdr_general_work_t *work = qdr_general_work(qdr_forward_on_message);
    work->on_message         = sub->on_message;
    work->on_message_context = sub->on_message_context;
    work->msg                = qd_message_copy(msg);
    work->maskbit            = link ? link->conn->mask_bit : 0;
    work->inter_router_cost  = link ? link->conn->inter_router_cost : 1;
    qdr_post_general_work_CT(core, work);
}

int qdr_forward_multicast_CT(qdr_core_t      *core,
                             qdr_address_t   *addr,
                             qd_message_t    *msg,
                             qdr_delivery_t  *in_delivery,
                             bool             exclude_inprocess,
                             bool             control)
{
    bool          bypass_valid_origins = addr->forwarder->bypass_valid_origins;
    int           fanout               = 0;
    qd_bitmask_t *link_exclusion       = !!in_delivery ? in_delivery->link_exclusion : 0;
    bool          presettled           = !!in_delivery ? in_delivery->settled : true;
    bool          receive_complete     = qd_message_receive_complete(qdr_delivery_message(in_delivery));

    //
    // If the delivery is not presettled, set the settled flag for forwarding so all
    // outgoing deliveries will be presettled.
    //
    // NOTE:  This is the only multicast mode currently supported.  Others will likely be
    //        implemented in the future.
    //
    if (!presettled) {
        in_delivery->settled = true;
        //
        // If the router is configured to reject unsettled multicasts, settle and reject this delivery.
        //
        if (!core->qd->allow_unsettled_multicast) {
            in_delivery->disposition = PN_REJECTED;
            in_delivery->error = qdr_error("qd:forbidden", "Deliveries to a multicast address must be pre-settled");
            qdr_delivery_push_CT(core, in_delivery);
            return 0;
        }
    }

    //
    // Forward to local subscribers
    //
    if (!addr->local || exclude_inprocess) {
        qdr_link_ref_t *link_ref = DEQ_HEAD(addr->rlinks);
        while (link_ref) {
            qdr_link_t     *out_link     = link_ref->link;
            qdr_delivery_t *out_delivery = qdr_forward_new_delivery_CT(core, in_delivery, out_link, msg);
            qdr_forward_deliver_CT(core, out_link, out_delivery);
            fanout++;
            if (out_link->link_type != QD_LINK_CONTROL && out_link->link_type != QD_LINK_ROUTER)
                addr->deliveries_egress++;
            link_ref = DEQ_NEXT(link_ref);
        }
    }

    //
    // Forward to remote routers with subscribers using the appropriate
    // link for the traffic class: control or data
    //
    //
    // Get the mask bit associated with the ingress router for the message.
    // This will be compared against the "valid_origin" masks for each
    // candidate destination router.
    //
    int origin = -1;
    qd_iterator_t *ingress_iter = in_delivery ? in_delivery->origin : 0;

    if (ingress_iter && !bypass_valid_origins) {
        qd_iterator_reset_view(ingress_iter, ITER_VIEW_NODE_HASH);
        qdr_address_t *origin_addr;
        qd_hash_retrieve(core->addr_hash, ingress_iter, (void*) &origin_addr);
        if (origin_addr && qd_bitmask_cardinality(origin_addr->rnodes) == 1)
            qd_bitmask_first_set(origin_addr->rnodes, &origin);
    } else
        origin = 0;

    //
    // Forward to the next-hops for remote destinations.
    //
    if (origin >= 0) {
        int           dest_bit;
        qdr_link_t   *dest_link;
        qdr_node_t   *next_node;
        qd_bitmask_t *link_set = qd_bitmask(0);

        //
        // Loop over the target nodes for this address.  Build a set of outgoing links
        // for which there are valid targets.  We do this to avoid sending more than one
        // message down a given link.  It's possible that there are multiple destinations
        // for this address that are all reachable over the same link.  In this case, we
        // will send only one copy of the message over the link and allow a downstream
        // router to fan the message out.
        //
        int c;
        for (QD_BITMASK_EACH(addr->rnodes, dest_bit, c)) {
            qdr_node_t *rnode = core->routers_by_mask_bit[dest_bit];
            if (!rnode)
                continue;

            if (rnode->next_hop)
                next_node = rnode->next_hop;
            else
                next_node = rnode;

            dest_link = control ? PEER_CONTROL_LINK(core, next_node) : PEER_DATA_LINK(core, next_node);
            if (dest_link && qd_bitmask_value(rnode->valid_origins, origin))
                qd_bitmask_set_bit(link_set, dest_link->conn->mask_bit);
        }

        //
        // Send a copy of the message outbound on each identified link.
        //
        int link_bit;
        while (qd_bitmask_first_set(link_set, &link_bit)) {
            qd_bitmask_clear_bit(link_set, link_bit);
            dest_link = control ?
                core->control_links_by_mask_bit[link_bit] :
                core->data_links_by_mask_bit[link_bit];
            if (dest_link && (!link_exclusion || qd_bitmask_value(link_exclusion, link_bit) == 0)) {
                qdr_delivery_t *out_delivery = qdr_forward_new_delivery_CT(core, in_delivery, dest_link, msg);
                qdr_forward_deliver_CT(core, dest_link, out_delivery);
                fanout++;
                addr->deliveries_transit++;
            }
        }

        qd_bitmask_free(link_set);
    }

    if (!exclude_inprocess) {
        //
        // Forward to in-process subscribers
        //

        qdr_subscription_t *sub = DEQ_HEAD(addr->subscriptions);
        while (sub) {
            //
            // Only if the message has been completely received, forward it to the subscription
            // Subscriptions, at the moment, dont have the ability to deal with partial messages
            //
            if (receive_complete)
                qdr_forward_on_message_CT(core, sub, in_delivery ? in_delivery->link : 0, msg);
            else
                //
                // Receive is not complete, we will store the sub in in_delivery->subscriptions so we can send the message to the subscription
                // after the message fully arrives
                //
                DEQ_INSERT_TAIL(in_delivery->subscriptions, sub);

            fanout++;
            addr->deliveries_to_container++;
            sub = DEQ_NEXT(sub);
        }
    }

    if (in_delivery && !presettled) {
        if (fanout == 0)
            //
            // The delivery was not presettled and it was not forwarded to any
            // destinations, return it to its original unsettled state.
            //
            in_delivery->settled = false;
        else {
            //
            // The delivery was not presettled and it was forwarded to at least
            // one destination.  Accept and settle the delivery only if the entire delivery
            // has been received.
            //
            if (receive_complete) {
                in_delivery->disposition = PN_ACCEPTED;
                qdr_delivery_push_CT(core, in_delivery);
            }
        }
    }

    return fanout;
}

int qdr_forward_closest_CT(qdr_core_t      *core,
                           qdr_address_t   *addr,
                           qd_message_t    *msg,
                           qdr_delivery_t  *in_delivery,
                           bool             exclude_inprocess,
                           bool             control)
{
    qdr_link_t     *out_link;
    qdr_delivery_t *out_delivery;

    //
    // Forward to an in-process subscriber if there is one.
    //
    if (!exclude_inprocess) {
        bool receive_complete = qd_message_receive_complete(msg);
        qdr_subscription_t *sub = DEQ_HEAD(addr->subscriptions);
        if (sub) {

            //
            // Only if the message has been completely received, forward it.
            // Subscriptions, at the moment, dont have the ability to deal with partial messages
            //
            if (receive_complete)
                qdr_forward_on_message_CT(core, sub, in_delivery ? in_delivery->link : 0, msg);
            else
                //
                // Receive is not complete, we will store the sub in in_delivery->subscriptions so we can send the message to the subscription
                // after the message fully arrives
                //
                DEQ_INSERT_TAIL(in_delivery->subscriptions, sub);

            //
            // If the incoming delivery is not settled, it should be accepted and settled here.
            //
            if (in_delivery && !in_delivery->settled) {
                in_delivery->disposition = PN_ACCEPTED;
                in_delivery->settled     = true;
                qdr_delivery_push_CT(core, in_delivery);
            }

            //
            // Rotate this subscription to the end of the list to get round-robin distribution.
            //
            if (DEQ_SIZE(addr->subscriptions) > 1) {
                DEQ_REMOVE_HEAD(addr->subscriptions);
                DEQ_INSERT_TAIL(addr->subscriptions, sub);
            }

            addr->deliveries_to_container++;
            return 1;
        }
    }

    //
    // Forward to a local subscriber.
    //
    qdr_link_ref_t *link_ref = DEQ_HEAD(addr->rlinks);
    if (link_ref) {
        out_link     = link_ref->link;
        out_delivery = qdr_forward_new_delivery_CT(core, in_delivery, out_link, msg);
        qdr_forward_deliver_CT(core, out_link, out_delivery);

        //
        // If there are multiple local subscribers, rotate the list of link references
        // so deliveries will be distributed among the subscribers in a round-robin pattern.
        //
        if (DEQ_SIZE(addr->rlinks) > 1) {
            DEQ_REMOVE_HEAD(addr->rlinks);
            DEQ_INSERT_TAIL(addr->rlinks, link_ref);
        }

        addr->deliveries_egress++;
        return 1;
    }

    //
    // If the cached list of closest remotes is stale (i.e. cost data has changed),
    // recompute the closest remote routers.
    //
    if (addr->cost_epoch != core->cost_epoch)
        qdr_forward_find_closest_remotes_CT(core, addr);

    //
    // Forward to remote routers with subscribers using the appropriate
    // link for the traffic class: control or data
    //
    qdr_node_t *next_node;

    if (addr->next_remote >= 0) {
        qdr_node_t *rnode = core->routers_by_mask_bit[addr->next_remote];
        if (rnode) {
            _qdbm_next(addr->closest_remotes, &addr->next_remote);
            if (addr->next_remote == -1)
                qd_bitmask_first_set(addr->closest_remotes, &addr->next_remote);

            if (rnode->next_hop)
                next_node = rnode->next_hop;
            else
                next_node = rnode;

            out_link = control ? PEER_CONTROL_LINK(core, next_node) : PEER_DATA_LINK(core, next_node);
            if (out_link) {
                out_delivery = qdr_forward_new_delivery_CT(core, in_delivery, out_link, msg);
                qdr_forward_deliver_CT(core, out_link, out_delivery);
                addr->deliveries_transit++;
                return 1;
            }
        }
    }

    return 0;
}

int qdr_forward_balanced_CT(qdr_core_t      *core,
                            qdr_address_t   *addr,
                            qd_message_t    *msg,
                            qdr_delivery_t  *in_delivery,
                            bool             exclude_inprocess,
                            bool             control)
{
    //
    // Control messages should never use balanced treatment.
    //
    assert(!control);

    //
    // If this is the first time through here, allocate the array for outstanding delivery counts.
    //
    if (addr->outstanding_deliveries == 0) {
        addr->outstanding_deliveries = NEW_ARRAY(int, qd_bitmask_width());
        for (int i = 0; i < qd_bitmask_width(); i++)
            addr->outstanding_deliveries[i] = 0;
    }

    qdr_link_t *best_eligible_link       = 0;
    int         best_eligible_link_bit   = -1;
    uint32_t    eligible_link_value      = UINT32_MAX;
    qdr_link_t *best_ineligible_link     = 0;
    int         best_ineligible_link_bit = -1;
    uint32_t    ineligible_link_value    = UINT32_MAX;

    //
    // Find all the possible outbound links for this delivery, searching for the one with the
    // smallest eligible value.  Value = outstanding_deliveries + minimum_downrange_cost.
    // A link is ineligible if the outstanding_deliveries is equal to or greater than the
    // link's capacity.
    //
    // If there are no eligible links, use the best ineligible link.  Zero fanout should be returned
    // only if there are no available destinations.
    //

    //
    // Start with the local links
    //
    qdr_link_ref_t *link_ref = DEQ_HEAD(addr->rlinks);
    while (link_ref) {
        qdr_link_t *link     = link_ref->link;
        uint32_t    value    = DEQ_SIZE(link->undelivered) + DEQ_SIZE(link->unsettled);
        bool        eligible = link->capacity > value;

        //
        // If this is the best eligible link so far, record the fact.
        // Otherwise, if this is the best ineligible link, make note of that.
        //
        if (eligible && eligible_link_value > value) {
            best_eligible_link  = link;
            eligible_link_value = value;
        } else if (!eligible && ineligible_link_value > value) {
            best_ineligible_link  = link;
            ineligible_link_value = value;
        }

        link_ref = DEQ_NEXT(link_ref);
    }

    //
    // If we haven't already found a link with zero (best possible) value, check the
    // inter-router links as well.
    //
    if (!best_eligible_link || eligible_link_value > 0) {
        //
        // Get the mask bit associated with the ingress router for the message.
        // This will be compared against the "valid_origin" masks for each
        // candidate destination router.
        //
        int origin = 0;
        qd_iterator_t *ingress_iter = in_delivery ? in_delivery->origin : 0;

        if (ingress_iter) {
            qd_iterator_reset_view(ingress_iter, ITER_VIEW_NODE_HASH);
            qdr_address_t *origin_addr;
            qd_hash_retrieve(core->addr_hash, ingress_iter, (void*) &origin_addr);
            if (origin_addr && qd_bitmask_cardinality(origin_addr->rnodes) == 1)
                qd_bitmask_first_set(origin_addr->rnodes, &origin);
        }

        int c;
        int node_bit;
        for (QD_BITMASK_EACH(addr->rnodes, node_bit, c)) {
            qdr_node_t *rnode     = core->routers_by_mask_bit[node_bit];
            qdr_node_t *next_node = rnode->next_hop ? rnode->next_hop : rnode;
            qdr_link_t *link      = PEER_DATA_LINK(core, next_node);
            if (!link) continue;
            int         link_bit  = link->conn->mask_bit;
            int         value     = addr->outstanding_deliveries[link_bit];
            bool        eligible  = link->capacity > value;

            if (qd_bitmask_value(rnode->valid_origins, origin)) {
                //
                // Link is a candidate, adjust the value by the bias (node cost).
                //
                value += rnode->cost;
                if (eligible && eligible_link_value > value) {
                    best_eligible_link     = link;
                    best_eligible_link_bit = link_bit;
                    eligible_link_value    = value;
                } else if (!eligible && ineligible_link_value > value) {
                    best_ineligible_link     = link;
                    best_ineligible_link_bit = link_bit;
                    ineligible_link_value    = value;
                }
            }
        }
    } else if (best_eligible_link) {
        //
        // Rotate the rlinks list to enhance the appearance of balance when there is
        // little load (see DISPATCH-367)
        //
        if (DEQ_SIZE(addr->rlinks) > 1) {
            link_ref = DEQ_HEAD(addr->rlinks);
            DEQ_REMOVE_HEAD(addr->rlinks);
            DEQ_INSERT_TAIL(addr->rlinks, link_ref);
        }
    }

    qdr_link_t *chosen_link     = 0;
    int         chosen_link_bit = -1;

    if (best_eligible_link) {
        chosen_link     = best_eligible_link;
        chosen_link_bit = best_eligible_link_bit;
    } else if (best_ineligible_link) {
        chosen_link     = best_ineligible_link;
        chosen_link_bit = best_ineligible_link_bit;
    }

    if (chosen_link) {
        qdr_delivery_t *out_delivery = qdr_forward_new_delivery_CT(core, in_delivery, chosen_link, msg);
        qdr_forward_deliver_CT(core, chosen_link, out_delivery);

        //
        // If the delivery is unsettled and the link is inter-router, account for the outstanding delivery.
        //
        if (in_delivery && !in_delivery->settled && chosen_link_bit >= 0) {
            addr->outstanding_deliveries[chosen_link_bit]++;
            out_delivery->tracking_addr     = addr;
            out_delivery->tracking_addr_bit = chosen_link_bit;
            addr->tracked_deliveries++;
        }

        //
        // Bump the appropriate counter based on where we sent the delivery.
        //
        if (chosen_link_bit >= 0)
            addr->deliveries_transit++;
        else
            addr->deliveries_egress++;
        return 1;
    }

    return 0;
}

bool qdr_forward_link_balanced_CT(qdr_core_t     *core,
                                  qdr_address_t  *addr,
                                  qdr_link_t     *in_link,
                                  qdr_terminus_t *source,
                                  qdr_terminus_t *target)
{
    qdr_connection_ref_t *conn_ref = DEQ_HEAD(addr->conns);
    qdr_connection_t     *conn     = 0;

    //
    // Check for locally connected containers that can handle this link attach.
    //
    if (conn_ref) {
        conn = conn_ref->conn;

        //
        // If there are more than one local connections available for handling this link,
        // rotate the list so the attaches are balanced across the containers.
        //
        if (DEQ_SIZE(addr->conns) > 1) {
            DEQ_REMOVE_HEAD(addr->conns);
            DEQ_INSERT_TAIL(addr->conns, conn_ref);
        }
    } else {
        //
        // Look for a next-hop we can use to forward the link-attach.
        //
        qdr_node_t *next_node;

        if (addr->cost_epoch != core->cost_epoch) {
            addr->next_remote = -1;
            addr->cost_epoch  = core->cost_epoch;
        }

        if (addr->next_remote < 0) {
            qd_bitmask_first_set(addr->rnodes, &addr->next_remote);
        }

        if (addr->next_remote >= 0) {

            qdr_node_t *rnode = core->routers_by_mask_bit[addr->next_remote];

            if (rnode) {
                //
                // Advance the addr->next_remote so there will be link balance across containers
                //
                _qdbm_next(addr->rnodes, &addr->next_remote);
                if (addr->next_remote == -1)
                    qd_bitmask_first_set(addr->rnodes, &addr->next_remote);

                if (rnode->next_hop)
                    next_node = rnode->next_hop;
                else
                    next_node = rnode;

                if (next_node && PEER_DATA_LINK(core, next_node))
                    conn = PEER_DATA_LINK(core, next_node)->conn;
            }
        }
    }

    if (conn) {
        qdr_link_t *out_link = new_qdr_link_t();
        ZERO(out_link);
        out_link->core           = core;
        out_link->identity       = qdr_identifier(core);
        out_link->conn           = conn;
        out_link->link_type      = QD_LINK_ENDPOINT;
        out_link->link_direction = qdr_link_direction(in_link) == QD_OUTGOING ? QD_INCOMING : QD_OUTGOING;
        out_link->admin_enabled  = true;
        out_link->terminus_addr  = 0;

        out_link->oper_status    = QDR_LINK_OPER_DOWN;

        out_link->name = (char*) malloc(strlen(in_link->name) + 1);
        strcpy(out_link->name, in_link->name);

        out_link->connected_link = in_link;
        in_link->connected_link  = out_link;

        DEQ_INSERT_TAIL(core->open_links, out_link);
        qdr_add_link_ref(&conn->links, out_link, QDR_LINK_LIST_CLASS_CONNECTION);

        qdr_connection_work_t *work = new_qdr_connection_work_t();
        ZERO(work);
        work->work_type = QDR_CONNECTION_WORK_FIRST_ATTACH;
        work->link      = out_link;
        work->source    = source;
        work->target    = target;

        qdr_connection_enqueue_work_CT(core, conn, work);

        return true;
    }

    return false;
}

//==================================================================================
// In-Thread API Functions
//==================================================================================

qdr_forwarder_t *qdr_new_forwarder(qdr_forward_message_t fm, qdr_forward_attach_t fa, bool bypass_valid_origins)
{
    qdr_forwarder_t *forw = NEW(qdr_forwarder_t);

    forw->forward_message      = fm ? fm : qdr_forward_message_null_CT;
    forw->forward_attach       = fa ? fa : qdr_forward_attach_null_CT;
    forw->bypass_valid_origins = bypass_valid_origins;

    return forw;
}

void qdr_forwarder_setup_CT(qdr_core_t *core)
{
    //
    // Create message forwarders
    //
    core->forwarders[QD_TREATMENT_MULTICAST_FLOOD]  = qdr_new_forwarder(qdr_forward_multicast_CT, 0, true);
    core->forwarders[QD_TREATMENT_MULTICAST_ONCE]   = qdr_new_forwarder(qdr_forward_multicast_CT, 0, false);
    core->forwarders[QD_TREATMENT_ANYCAST_CLOSEST]  = qdr_new_forwarder(qdr_forward_closest_CT,   0, false);
    core->forwarders[QD_TREATMENT_ANYCAST_BALANCED] = qdr_new_forwarder(qdr_forward_balanced_CT,  0, false);

    //
    // Create link forwarders
    //
    core->forwarders[QD_TREATMENT_LINK_BALANCED] = qdr_new_forwarder(0, qdr_forward_link_balanced_CT, false);
}

qdr_forwarder_t *qdr_forwarder_CT(qdr_core_t *core, qd_address_treatment_t treatment)
{
    if (treatment <= QD_TREATMENT_LINK_BALANCED)
        return core->forwarders[treatment];
    return 0;
}

int qdr_forward_message_CT(qdr_core_t *core, qdr_address_t *addr, qd_message_t *msg, qdr_delivery_t *in_delivery,
                           bool exclude_inprocess, bool control)
{
    if (addr->forwarder)
        return addr->forwarder->forward_message(core, addr, msg, in_delivery, exclude_inprocess, control);

    // TODO - Deal with this delivery's disposition
    return 0;
}

bool qdr_forward_attach_CT(qdr_core_t *core, qdr_address_t *addr, qdr_link_t *in_link,
                           qdr_terminus_t *source, qdr_terminus_t *target)
{
    if (addr->forwarder)
        return addr->forwarder->forward_attach(core, addr, in_link, source, target);
    return false;
}


text:
namespace Phoenix.AutoDvdBackup.DiskInfoServices
{
    public interface IDiskInfoService
    {
        bool CanHandle(string diskIdentifier);
        DiskInfoData GetData(string diskIdentifier);
    }
}


text:
#ifndef RT_CONFIG_H__
#define RT_CONFIG_H__

/* Automatically generated file; DO NOT EDIT. */
/* RT-Thread Configuration */

/* RT-Thread Kernel */

#define RT_NAME_MAX 8
#define RT_ALIGN_SIZE 4
#define RT_THREAD_PRIORITY_32
#define RT_THREAD_PRIORITY_MAX 32
#define RT_TICK_PER_SECOND 100
#define RT_USING_OVERFLOW_CHECK
#define RT_USING_HOOK
#define RT_USING_IDLE_HOOK
#define RT_IDEL_HOOK_LIST_SIZE 4
#define IDLE_THREAD_STACK_SIZE 256
#define RT_DEBUG
#define RT_DEBUG_COLOR

/* Inter-Thread communication */

#define RT_USING_SEMAPHORE
#define RT_USING_MUTEX
#define RT_USING_EVENT
#define RT_USING_MAILBOX
#define RT_USING_MESSAGEQUEUE

/* Memory Management */

#define RT_USING_MEMPOOL
#define RT_USING_SMALL_MEM
#define RT_USING_HEAP

/* Kernel Device Object */

#define RT_USING_DEVICE
#define RT_USING_CONSOLE
#define RT_CONSOLEBUF_SIZE 128
#define RT_CONSOLE_DEVICE_NAME "uart1"
#define RT_VER_NUM 0x40001

/* RT-Thread Components */

#define RT_USING_COMPONENTS_INIT
#define RT_USING_USER_MAIN
#define RT_MAIN_THREAD_STACK_SIZE 2048
#define RT_MAIN_THREAD_PRIORITY 10

/* C++ features */

/* Command shell */

#define RT_USING_FINSH
#define FINSH_THREAD_NAME "tshell"
#define FINSH_USING_HISTORY
#define FINSH_HISTORY_LINES 5
#define FINSH_USING_SYMTAB
#define FINSH_USING_DESCRIPTION
#define FINSH_THREAD_PRIORITY 20
#define FINSH_THREAD_STACK_SIZE 4096
#define FINSH_CMD_SIZE 80
#define FINSH_USING_MSH
#define FINSH_USING_MSH_DEFAULT
#define FINSH_ARG_MAX 10

/* Device virtual file system */

#define RT_USING_DFS
#define DFS_USING_WORKDIR
#define DFS_FILESYSTEMS_MAX 2
#define DFS_FILESYSTEM_TYPES_MAX 2
#define DFS_FD_MAX 16
#define RT_USING_DFS_DEVFS

/* Device Drivers */

#define RT_USING_DEVICE_IPC
#define RT_PIPE_BUFSZ 512
#define RT_USING_SYSTEM_WORKQUEUE
#define RT_SYSTEM_WORKQUEUE_STACKSIZE 2048
#define RT_SYSTEM_WORKQUEUE_PRIORITY 23
#define RT_USING_SERIAL
#define RT_SERIAL_USING_DMA
#define RT_SERIAL_RB_BUFSZ 64
#define RT_USING_PIN

/* Using WiFi */

/* Using USB */

/* POSIX layer and C standard library */

#define RT_USING_LIBC
#define RT_USING_POSIX

/* Network */

/* Socket abstraction layer */

#define RT_USING_SAL

/* protocol stack implement */

#define SAL_USING_LWIP
#define SAL_SOCKETS_NUM 16

/* Network interface device */

#define RT_USING_NETDEV
#define NETDEV_USING_IFCONFIG
#define NETDEV_USING_PING
#define NETDEV_USING_NETSTAT

/* light weight TCP/IP stack */

#define RT_USING_LWIP
#define RT_USING_LWIP202
#define RT_LWIP_IGMP
#define RT_LWIP_ICMP
#define RT_LWIP_DNS
#define RT_LWIP_DHCP
#define IP_SOF_BROADCAST 1
#define IP_SOF_BROADCAST_RECV 1

/* Static IPv4 Address */

#define RT_LWIP_IPADDR "192.168.1.30"
#define RT_LWIP_GWADDR "192.168.1.1"
#define RT_LWIP_MSKADDR "255.255.255.0"
#define RT_LWIP_UDP
#define RT_LWIP_TCP
#define RT_LWIP_RAW
#define RT_MEMP_NUM_NETCONN 8
#define RT_LWIP_PBUF_NUM 16
#define RT_LWIP_RAW_PCB_NUM 4
#define RT_LWIP_UDP_PCB_NUM 4
#define RT_LWIP_TCP_PCB_NUM 4
#define RT_LWIP_TCP_SEG_NUM 40
#define RT_LWIP_TCP_SND_BUF 8196
#define RT_LWIP_TCP_WND 8196
#define RT_LWIP_TCPTHREAD_PRIORITY 10
#define RT_LWIP_TCPTHREAD_MBOX_SIZE 8
#define RT_LWIP_TCPTHREAD_STACKSIZE 1024
#define RT_LWIP_ETHTHREAD_PRIORITY 12
#define RT_LWIP_ETHTHREAD_STACKSIZE 1024
#define RT_LWIP_ETHTHREAD_MBOX_SIZE 8
#define LWIP_NETIF_STATUS_CALLBACK 1
#define LWIP_NETIF_LINK_CALLBACK 1
#define SO_REUSE 1
#define LWIP_SO_RCVTIMEO 1
#define LWIP_SO_SNDTIMEO 1
#define LWIP_SO_RCVBUF 1
#define LWIP_NETIF_LOOPBACK 0
#define RT_LWIP_USING_PING

/* Modbus master and slave stack */

/* AT commands */

/* VBUS(Virtual Software BUS) */

/* Utilities */

/* RT-Thread online packages */

/* IoT - internet of things */

/* Wi-Fi */

/* Marvell WiFi */

/* Wiced WiFi */

/* IoT Cloud */

/* security packages */

/* language packages */

/* multimedia packages */

/* tools packages */

/* system packages */

/* peripheral libraries and drivers */

/* miscellaneous packages */

/* samples: kernel and components samples */

#define RT_USING_UART1

#endif


text:
<page-header model="navModel"></page-header>

Edit Organization

  <form name="orgDetailsForm" class="gf-form-group">

      Name
      <input type="text" required ng-model="org.name" class="gf-form-input max-width-14" />

      <button type="submit" class="btn btn-primary" ng-click="update()" ng-show="!createMode">Update</button>

  </form>

Organization Users

      Username
      Email
      Role

      {{orgUser.login}}
      {{orgUser.email}}

            <select
              type="text"
              ng-model="orgUser.role"
              class="gf-form-input max-width-8"
              ng-options="f for f in ['Viewer', 'Editor', 'Admin']"
              ng-change="updateOrgUser(orgUser)"
            >
            </select>

          <icon name="'times'" style="margin-bottom: 0;"></icon>