text:
package kg.apc.jmeter.config;

import java.awt.BorderLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import kg.apc.jmeter.JMeterPluginsUtils;
import org.apache.jmeter.config.gui.AbstractConfigGui;
import org.apache.jmeter.testelement.TestElement;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.log.Logger;

public class LockFileGui extends AbstractConfigGui {

    public static final String WIKIPAGE = "LockFile";
    public static Logger log = LoggingManager.getLoggerForClass();
    private JTextField tfFileName;
    private JTextField tfFileMask;

    public LockFileGui() {
        super();
        init();
        initFields();
    }

    @Override
    public String getStaticLabel() {
        return JMeterPluginsUtils.prefixLabel("Lock File Config");
    }

    @Override
    public String getLabelResource() {
        return getClass().getCanonicalName();
    }

    @Override
    public void configure(TestElement te) {
        log.debug("[Lockfile plugin] configure");
        super.configure(te);
        LockFile lf = (LockFile) te;
        tfFileName.setText(lf.getFilename());
        tfFileMask.setText(lf.getFilemask());
    }

    @Override
    public TestElement createTestElement() {
        log.debug("[Lockfile plugin] createTestElement");
        LockFile lockFile = new LockFile();
        modifyTestElement(lockFile);
        lockFile.setComment(JMeterPluginsUtils.getWikiLinkText(WIKIPAGE));
        return lockFile;
    }

    @Override
    public void modifyTestElement(TestElement te) {
        log.debug("[Lockfile plugin] modifyTestElement");
        configureTestElement(te);
        LockFile lf = (LockFile) te;
        lf.setFilename(tfFileName.getText());
        lf.setFilemask(tfFileMask.getText());
    }

    @Override
    public void clearGui() {
        super.clearGui();
        initFields();
    }

    private void init() {
        log.debug("[Lockfile plugin] init");
        setLayout(new BorderLayout(0, 5));
        setBorder(makeBorder());

        add(JMeterPluginsUtils.addHelpLinkToPanel(makeTitlePanel(), WIKIPAGE), BorderLayout.NORTH);

        JPanel mainPanel = new JPanel(new GridBagLayout());

        GridBagConstraints labelConstraints = new GridBagConstraints();
        labelConstraints.anchor = GridBagConstraints.FIRST_LINE_END;

        GridBagConstraints editConstraints = new GridBagConstraints();
        editConstraints.anchor = GridBagConstraints.FIRST_LINE_START;
        editConstraints.weightx = 1.0;
        editConstraints.fill = GridBagConstraints.HORIZONTAL;

        editConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
        labelConstraints.insets = new java.awt.Insets(2, 0, 0, 0);

        addToPanel(mainPanel, labelConstraints, 0, 0, new JLabel("Lock file name: ", JLabel.RIGHT));
        addToPanel(mainPanel, editConstraints, 1, 0, tfFileName = new JTextField(20));
        addToPanel(mainPanel, labelConstraints, 0, 1, new JLabel("Also check filemask: ", JLabel.RIGHT));
        addToPanel(mainPanel, editConstraints, 1, 1, tfFileMask = new JTextField(20));

        JPanel container = new JPanel(new BorderLayout());
        container.add(mainPanel, BorderLayout.NORTH);
        add(container, BorderLayout.CENTER);
    }

    private void addToPanel(JPanel panel, GridBagConstraints constraints, int col, int row, JComponent component) {
        constraints.gridx = col;
        constraints.gridy = row;
        panel.add(component, constraints);
    }

    private void initFields() {
        log.debug("[Lockfile plugin] initFields");
        tfFileName.setText("");
        tfFileMask.setText("");
    }
}


text:
namespace EFSqlTranslator.Translation.DbObjects
{
    public class DbOutputOption
    {
        public string QuotationMark { get; set; } = "'";
        public bool ForceQuotationMark { get; set; }
    }
}

redpajama_set_name: RedPajamaGithub


text:
TBowAL::TBowAL(const PBowDocBs& _BowDocBs, const int& _CId, const double& _SvmC,
        const double& _SvmJ, const TIntV& _DIdV): BowDocBs(_BowDocBs),
        SvmC(_SvmC), SvmJ(_SvmJ), CId(_CId) {

    ALType = baltCat;
    // check existence of the target category
    IAssert(BowDocBs->IsCId(CId));
    // get all document-ids
    TIntV DIdV = _DIdV;
    if (DIdV.Len() == 0) { BowDocBs->GetAllDIdV(DIdV); }
    // collect labeled and unlabeled documents
    for (int DIdN = 0; DIdN < DIdV.Len(); DIdN++){
        int DId = DIdV[DIdN];
        if (BowDocBs->GetDocCIds(DId) > 0){
            LabeledDIdV.Add(DIdN);
        } else {
            UnlabeledDIdV.Add(DIdN);
        }
    }
    // collect document weights
    BowDocWgtBs = TBowDocWgtBs::New(BowDocBs, bwwtLogDFNrmTFIDF, 0.0, 0, DIdV);
    DocSet = TBowDocBs2TrainSet::NewBowAllCat(BowDocBs, BowDocWgtBs, CId, DIdV);
}

TBowAL::TBowAL(const PBowDocBs& _BowDocBs, const TStr& _QueryStr,
        const int& _MnPosDocs, const int& _MnNegDocs, const double& _SvmC,
        const double& _SvmJ, const TIntV& _DIdV): BowDocBs(_BowDocBs),
        SvmC(_SvmC), SvmJ(_SvmJ),
        QueryStr(_QueryStr), MnPosDocs(_MnPosDocs), MnNegDocs(_MnNegDocs) {

    Assert((MnPosDocs > 0) && (MnNegDocs > 0));
    ALType = baltQuery;
    // we start in IR mode -- user must first find some pos and neg docs
    InfoRetModeP = true;
    // get all document-ids
    TIntV DIdV = _DIdV;
    if (DIdV.Len() == 0) { BowDocBs->GetAllDIdV(DIdV); }
    // collect document weights
    BowDocWgtBs = TBowDocWgtBs::New(BowDocBs, bwwtLogDFNrmTFIDF, 0.0, 0, DIdV);
    QuerySpV = BowDocBs->GetSpVFromHtmlStr(QueryStr, BowDocWgtBs);
    DocSet = TBowDocBs2TrainSet::NewBowNoCat(BowDocWgtBs, DIdV, 0.0);
    // first everything is unlabeled
    LabeledDIdV.Clr();
    UnlabeledDIdV.Gen(DIdV.Len(), 0);
    for (int DIdN = 0; DIdN < DIdV.Len(); DIdN++) {
        UnlabeledDIdV.Add(DIdN);
        IAssert(DIdV[DIdN] == DocSet->GetAttrBowV(DIdN)->GetDId());
    }
}

bool TBowAL::GenQueryDIdV(const bool& GenStatP){
    DistDIdPrV.Clr();
    // stop if everything labeled
    if (UnlabeledDIdV.Empty()){return false;}
    // if in query mode than we do nearest-neighbour search
    if ((ALType == baltQuery) && InfoRetModeP) {
        Assert((ALType == baltQuery) && InfoRetModeP);
        const bool HasPosDocs = DocSet->HasPosVecs(MnPosDocs);
        const bool HasNegDocs = DocSet->HasNegVecs(MnNegDocs);
        if (HasPosDocs && HasNegDocs) {
            InfoRetModeP = false;
        } else {
            PBowSim BowSim = TBowSim::New(bstCos);
            for (int UnLblDIdN = 0; UnLblDIdN < UnlabeledDIdV.Len(); UnLblDIdN++){
                PBowSpV DocSpV = DocSet->GetAttrBowV(UnlabeledDIdV[UnLblDIdN]);
                double Dist = 1 - BowSim->GetSim(QuerySpV, DocSpV);
                DistDIdPrV.Add(TFltIntPr(Dist, DocSpV->GetDId()));
            }
            DistDIdPrV.Sort();
            if (HasPosDocs) { DistDIdPrV.Reverse(); }
        }

    }
    // otherwise we see who is the closest to the hyperplane
    if ((ALType == baltCat) || ((ALType == baltQuery)&&(!InfoRetModeP))) {
        // build the model from labeled documents
        PSVMModel Md = TSVMModel::NewClsLinear(DocSet, SvmC, SvmJ, LabeledDIdV);
        // create set of query-document-ids sorted by closeness
        for (int UnLblDIdN = 0; UnLblDIdN < UnlabeledDIdV.Len(); UnLblDIdN++){
            PBowSpV DocSpV = DocSet->GetAttrBowV(UnlabeledDIdV[UnLblDIdN]);
            double Cfy = Md->GetRes(DocSpV);
            double Dist = fabs(Cfy);
            DistDIdPrV.Add(TFltIntPr(Dist, DocSpV->GetDId()));
        }
        // sort query documents-ids (closest to hyperplane have lower index)
        DistDIdPrV.Sort();
        // prepare statistics
        if (GenStatP) {
            // keywords
            TFltV NormalV; Md->GetWgtV(NormalV); TIntFltKdV WIdWgtV;
            DocSet->GetKeywords(NormalV, WIdWgtV, LabeledDIdV);
            if (!WIdWgtV.Empty()) {
                KeyWdStr = BowDocBs->GetWordStr(WIdWgtV[0].Key);
                for (int WIdN = 1; WIdN < WIdWgtV.Len(); WIdN++) {
                    KeyWdStr += ", " + BowDocBs->GetWordStr(WIdWgtV[WIdN].Key); }
                KeyWdStr.ToLc(); KeyWdStr.ChangeChAll('_', ' ');
            } else {
                KeyWdStr = "";
            }
            // labeled document count
            PosDocN = NegDocN = 0;
            for (int DocN = 0; DocN < DocSet->Len(); DocN++) {
                if (DocSet->GetVecParam(DocN) > 0.1) { PosDocN++; }
                else if (DocSet->GetVecParam(DocN) < -0.1) { NegDocN++; }
            }
            // unlabeled document count
            for (int UnLblDIdN = 0; UnLblDIdN < UnlabeledDIdV.Len(); UnLblDIdN++){
                PBowSpV DocSpV = DocSet->GetAttrBowV(UnlabeledDIdV[UnLblDIdN]);
                double Dist = Md->GetRes(DocSpV);
                if (Dist > 0.0) { PosDocN++; }
                else { NegDocN++; }
            }
        }
    }
    // return
    return true;
}

void TBowAL::MarkQueryDoc(const int& QueryDId, const bool& AssignToCatP){
    // first we find the position of QueryDId in the DocSet
    int QueryDIdN = -1;
    for (int DocN = 0; DocN < DocSet->Len(); DocN++) {
        if (DocSet->GetAttrBowV(DocN)->GetDId() == QueryDId) {
            QueryDIdN = DocN; break; }
    }
    // if we have such a document in DocSet, than move it to labeled part
    if (QueryDIdN >= 0) {
        // remove the document from the unlabeled-list and add to the labeled-list
        UnlabeledDIdV.DelIfIn(QueryDIdN);
        LabeledDIdV.AddUnique(QueryDIdN);
        // add the category information to Bow and to TrainSet
        if (AssignToCatP){
            // adding query-document to category
            if (ALType == baltCat) { BowDocBs->AddDocCId(QueryDId, CId); }
            DocSet->SetVecParam(QueryDIdN, 1.0);
        } else {
            // marking the document is not in the category
            DocSet->SetVecParam(QueryDIdN, -1.0);
        }
    } else {
        InfoNotify(TStr::Fmt("Wrong QueryDId (%d)!", QueryDId)); //HACK!
    }
}

void TBowAL::MarkUnlabeledPosDocs(){
    // mark the rest of the positive documents with the target category
    PSVMModel Md = TSVMModel::NewClsLinear(DocSet, SvmC, SvmJ, LabeledDIdV);
    for (int UnLblDIdN = 0; UnLblDIdN < UnlabeledDIdV.Len(); UnLblDIdN++){
        PBowSpV DocSpV = DocSet->GetAttrBowV(UnlabeledDIdV[UnLblDIdN]);
        double Dist = Md->GetRes(DocSpV);
        if (Dist>0){
            BowDocBs->AddDocCId(DocSpV->GetDId(), CId);
        }
    }
}

void TBowAL::GetAllPosDocs(TIntV& PosDIdV){
    // first we collect all the positive documents from the labeled part
    for (int LblDIdN = 0; LblDIdN < LabeledDIdV.Len(); LblDIdN++) {
        if (DocSet->GetVecDId(LabeledDIdV[LblDIdN]) > 0.0) {
            PosDIdV.Add(DocSet->GetAttrBowV(LabeledDIdV[LblDIdN])->GetDId());
        }
    }
    // than we  classify positivne docs from the unlabeled part
    PSVMModel Md = TSVMModel::NewClsLinear(DocSet, SvmC, SvmJ, LabeledDIdV);
    for (int UnLblDIdN = 0; UnLblDIdN < UnlabeledDIdV.Len(); UnLblDIdN++){
        PBowSpV DocSpV = DocSet->GetAttrBowV(UnlabeledDIdV[UnLblDIdN]);
        double Dist = Md->GetRes(DocSpV);
        if (Dist>0){
            PosDIdV.Add(DocSpV->GetDId());
        }
    }
    // finalise
    PosDIdV.Pack(); PosDIdV.Sort();
}


text:
module.exports = {
  before: function(client) {
    client
      .url(client.globals.base_url+"#create")
      .waitForElementVisible("body", 1000)
      .assert.title("Tipbox")
      .setValue("#recipient","xdamman@gmail.com")
      .click("#subject")
      .waitForElementVisible("#selectPGP a.selected", 5000)
      .assert.containsText("#selectPGP a.selected", "0xFD430CDC");
  },
  "Subject cannot be empty" : function (client) {
    client
      .click('#agreeToS')
      .click("#createBtn")
      .waitForElementVisible("#errorlog", 5000)
      .assert.containsText("#errorlog", "Subject cannot be empty");
  },
  "Terms of Service should be accepted": function(client) {
    client
      .setValue("#subject", "nightwatch")
      .click('#agreeToS') // Uncheck the checkbox
      .click('#createBtn')
      .waitForElementVisible("#errorlog", 5000)
      .assert.containsText("#errorlog", "You must agree our Terms of Service and Privacy Policy.");
  },
  "Create a new tipbox with PGP" : function (client) {
    client
      .click('#agreeToS') // Check the checkbox
      .click("#createBtn")
      .waitForElementVisible("#tipboxCreated", 5000)
      .assert.containsText("#tipboxCreated", "Your tipbox has been created")
      .end();
  }
};


text:
package pl.edu.mimuw.cloudatlas.agent.modules.network;

import java.net.InetAddress;

import pl.edu.mimuw.cloudatlas.agent.modules.framework.SimpleMessage;

public final class SendDatagramMessage extends SimpleMessage<byte[]> {
	private InetAddress target;
	private int port;

	public SendDatagramMessage(byte[] content, InetAddress target, int port) {
		super(content);
		this.target = target;
		this.port = port;
	}

	public InetAddress getTarget() {
		return target;
	}

	public int getPort() {
		return port;
	}
}


text:
<templateSet group="AppDev - JavaScript">
  <template name="cl" value="console.log( $VALUE$ );
$END$" description="console.log(..)" toReformat="true" toShortenFQNames="true">
    <variable name="VALUE" expression="" defaultValue="" alwaysStopAt="true" />
    <context>
      <option name="JAVA_SCRIPT" value="true" />
      <option name="JS_STATEMENT" value="true" />
    </context>
  </template>
  <template name="af" value="($PARAM$) => {
  $END$
}" description="ES6 - Arrow Function" toReformat="true" toShortenFQNames="true">
    <variable name="PARAM" expression="" defaultValue="" alwaysStopAt="true" />
    <context>
      <option name="JAVA_SCRIPT" value="true" />
      <option name="JS_EXPRESSION" value="true" />
      <option name="JSX_HTML" value="false" />
      <option name="JS_STATEMENT" value="false" />
    </context>
  </template>
  <template name="de" value="describe('$VALUE$', () => {
  $END$
});
" description="ES6 - describe()" toReformat="true" toShortenFQNames="true">
    <variable name="VALUE" expression="" defaultValue="" alwaysStopAt="true" />
    <context>
      <option name="JS_STATEMENT" value="true" />
    </context>
  </template>
  <template name="it" value="it('given X, should be Y', () => {
  $END$
});
" description="ES6 - it()" toReformat="true" toShortenFQNames="true">
    <context>
      <option name="JS_STATEMENT" value="true" />
    </context>
  </template>
</templateSet>


text:
import React, { PropTypes } from 'react';
import { Modal, Button } from 'react-bootstrap';
import { routeActions } from 'react-router-redux';

class SignIn extends React.Component {

  constructor(){
    super();
    this.handleClick = this.handleClick.bind(this);
    this.switch = this.switch.bind(this);
    this.displayError = this.displayError.bind(this);
  }

  handleClick(e){
    e.preventDefault();
    const { signinUser } = this.props.authActions;
    const username = this.refs.username;
    const password = this.refs.password;
    const userInfo = {
      username: username.value,
      password: password.value
    };

    signinUser(userInfo)

    username.value = '';
    password.value = '';
  }

  switch(){
    this.props.closeSignIn();
    this.props.openRegister();
  }

  displayError(){
    if(this.props.authErrorMsg){
      return(

          Either the username or password you entered is incorrect.

      )
    } else {
      return null;
    }
  }

  render(){
    return(
      <Modal
        show={this.props.showSignInModal}
        onHide={this.props.closeSignIn}
        className='loginmodal signin'>
        <Modal.Header closeButton className='close-btn'>
        </Modal.Header>
        <Modal.Body className='modalbody'>
          <form>

              <input
                type='text'
                className='form-control'
                placeholder='Username'
                ref='username' />

              <input
                type='password'
                className='form-control'
                placeholder="Password"
                ref='password' />

            {this.displayError()}

              <button
                type='submit'
                className='btn btn-block submit'
                onClick={this.handleClick}>
                Sign in
              </button>

              {"Don't"} have an account? Click here to register.

          </form>
        </Modal.Body>
      </Modal>
    )
  }
}

export default SignIn;


text:
cask v1: 'prismatik' do
  version '5.11.2'
  sha256 '47e7e5335c432cb9aec169b129b24fae7bb367665843c5cbaa0e49c6f0db13f5'

  # github.com is the official download host per the vendor homepage
  url "https://github.com/woodenshark/Lightpack/releases/download/#{version}/Prismatik.#{version}.dmg"
  appcast 'https://github.com/woodenshark/Lightpack/releases.atom'
  name 'Prismatik'
  homepage 'http://lightpack.tv/'
  license :gpl

  app 'Prismatik.app'
end


text:
"""
Daily cleanup job.

Can be run as a cronjob to clean out old data from the database (only expired
sessions at the moment).
"""

from django.core import management

if __name__ == "__main__":
    management.call_command('cleanup')


text:
console.log('Confirm that this sends no outside network requests in the Network Panel.')

var receiveProgress = document.getElementById('receiveProgress')
var sendProgress = document.getElementById('sendProgress')
var bitrateDiv = document.getElementById('bitrate')
var statusMessage = document.getElementById('status')
var downloadsAnchor = document.getElementById('downloads')
var theirVideo = document.getElementById('theirVideo')
var myVideo = document.getElementById('myVideo')

function WebRTCChat(cfg, con, sendTyping) {
    var self = this;

/* WebRTC setup for broser-to-browser connection */
    self.cfg = {'iceServers':[
        //{'url': 'stun:stun.l.google.com:19302'}
    ]}; //{"url": "stun:23.21.150.121"}
    self.con = {'optional':  [{'DtlsSrtpKeyAgreement': true}] };
    self.activeChannel;
    self.activeConnection;
    self.roomName;

    self.readystate = false;
    self.sendTyping = true;

/* WebRTC + CHAT CONNECTION CODE */

    /* THE HOST (initiates the chat) */

    self.hostChat = function(offer_callback, ready_callback) {
        var hostConnection = new RTCPeerConnection(self.cfg, self.con);                                 // init connection
        self.initConnection(hostConnection, offer_callback);

        var hostChannel = hostConnection.createDataChannel('chat', {
            // reliable: true,
            // ordered: true
        });
        self.initChannel(hostChannel, ready_callback);

        // self.initVideo();

        console.log("Creating RTC Chat Host Offer...");
        hostConnection.createOffer(
            self.handleDescription,
            self.handleDescriptionFailure
            // {offerToReceiveAudio: true, offerToReceiveVideo: true}
        );
        // copy paste this offer to all clients who want to join
        // they paste their answer back, which goes into handleAnswerFromClient
    }

    self.handleAnswerFromClient = function(answer) {
        var answerDesc = new RTCSessionDescription(answer.rtc);
        console.log("Received Chat RTC Join Answer: ", answerDesc);
        self.activeConnection.setRemoteDescription(answerDesc);
        self.activeChannel.onopen()
        writeToChatLog("Started hosting a chat.", "text-success alert-success");

        // hostChannel.onopen will trigger once the connection is complete (enabling the chat window)
    }

    /* THE JOINEE (joins an existing chat) */

    self.joinChat = function(offer, answer_callback, ready_callback) {
        var clientConnection = new RTCPeerConnection(cfg, con);
        self.initConnection(clientConnection, answer_callback);

        self.activeConnection.ondatachannel = function (e) {                                     // once client receives a good data channel from the host
            // Chrome sends event, FF sends raw channel
            var clientChannel = e.channel || e;
            self.initChannel(clientChannel, ready_callback);
            self.activeChannel.onopen()
            writeToChatLog("Joined a chat.", "text-success alert-success");
            // clientChannel.onopen will then trigger once the connection is complete (enabling the chat window)
        };

        self.roomName = offer.roomName;

        var offerDesc = new RTCSessionDescription(offer.rtc);
        console.log("Received Chat RTC Host Offer: ", offerDesc);
        self.activeConnection.setRemoteDescription(offerDesc);

        // self.initVideo();

        console.log("Answering Chat Host Offer...");
        self.activeConnection.createAnswer(
            self.handleDescription,
            self.handleDescriptionFailure
            // {offerToReceiveAudio: true, offerToReceiveVideo: true}
        );

        // ondatachannel triggers once the client has accepted our answer ^
    }

    self.initConnection = function(conn, callback) {
        self.activeConnection = conn;
        // these aren't really necessary
        conn.onconnection                   = function (state) {console.info('Chat connection complete: ', event);}
        conn.onsignalingstatechange         = function (state) {console.info('Signaling state change: ', state); if (self.activeConnection.iceConnectionState == "disconnected") self.writeToChatLog("Chat partner disconnected.", "text-warning alert-error");}
        conn.oniceconnectionstatechange     = function (state) {console.info('Signaling ICE connection state change: ', state); if (self.activeConnection.iceConnectionState == "disconnected") self.writeToChatLog("Chat partner disconnected.", "text-warning alert-error");}
        conn.onicegatheringstatechange      = function (state) {console.info('Signaling ICE setup state change: ', state);}
        conn.onaddstream = function (event) {
            var video = theirVideo;
            if (window.URL)
                video.src = window.URL.createObjectURL(event.stream);
            else
                video.src = event.stream;
            console.log("You got their video!");
        }
        //this is the important one
        conn.onicecandidate = function (event) {
            // when browser has determined how to form a connection, generate offer or answer with ICE connection details and PGP public key
            if (event.candidate == null) {
                console.log("Valid ICE connection candidate determined.");
                var offer_or_answer = JSON.stringify({
                    rtc: self.activeConnection.localDescription,
                    roomName: self.roomName
                });
                // pass the offer or answer to the callback for display to the user or to send over some other communication channel
                if (callback) callback(offer_or_answer);
            }
        };
        conn.onfailure = function(details) {callback(details)};
        console.log("Initialized Connection: ", conn);
    }

    self.initChannel = function(chan, callback) {
        self.activeChannel = chan;
        self.activeChannel.binaryType = 'arraybuffer';
        // once the channel is open, trigger the callback to enable the chat window or carry out other logic
        self.activeChannel.onopen = function (e) {
            console.log('Data Channel Connected.');
            self.readystate = true;
            if (callback) callback(e);
        }
        chan.onmessage = self.receiveMessage;
        console.log("Initialized Data Channel: ", chan);
    }

    self.handleDescription = function(desc) {
        self.activeConnection.setLocalDescription(desc);
    }

    self.handleDescriptionFailure = function() {
        console.warn("Failed to create or answer chat offer.");
        self.activeConnection.onfailure("Invalid or expired chat offer. Please try again.")
    }

    // messaging functions

    self.sendTypingMessage = function() {
        self.activeChannel.send(JSON.stringify({message:null,typing:true}));
    }

    self.sendMessage = function(message) {
        self.activeChannel.send(JSON.stringify({message: message}));
        self.writeToChatLog(message, "text-success sent insecure", false);
    }

    self.receiveMessage = function(event) {
        try {
            var data = JSON.parse(event.data);
        } catch(e) {
            return self.receiveFile(event);
        }

        if (data.file) {
            return self.prepareToReceiveFile(data);
        }

        if (data.typing && !data.message) {
            console.log("Partner is typing...");
            self.displayPartnerTyping();
        }
        else {
            console.log("Received a message: ", data.message);
            self.writeToChatLog(data.message, "text-info recv", false);
        }
    }

    // Audio and Video

    self.initVideo = function() {
        navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
        var video = myVideo;

        navigator.getUserMedia({
            audio: false,
            video: true
        }, function (stream) {
          if (window.URL)
            video.src = window.URL.createObjectURL(stream);
          else
            video.src = stream;
          window.myStream = stream;
          self.activeConnection.addStream(window.myStream);
            // self.activeChannel.send(JSON.stringify({
            //     message: "Started sharing video."
            // }));
            self.writeToChatLog(
                "Started sharing video.",
                "text-success sent insecure", false);
        }, function (error){
          console.log('navigator.getUserMedia error: ', error);
        });
    }

    // Files

    self.prepareToReceiveFile = function(data) {
        self.startTime = null;
        self.receiveBuffer = null;
        self.receivedSize = null;
        self.bitrateMax = null;
        self.numReceivedFiles = self.numReceivedFiles || 0;
        self.receivedFiles = self.receivedFiles || {};
        self.writeToChatLog(
            "Receiving " + data.name + " (" + data.size + " bytes)",
            "text-success sent insecure",
            false
        );
        self.numReceivedFiles += 1;
        // XSS out the wazoo
        var downloadLink = downloadsAnchor.innerHTML += (
            '
'
            + 'Download: ' + data.name + ''
            + " (" + (data.size/1024).toLocaleString() + " kilobytes)"
            + '
'
        )
        self.receivedFiles[data.name] = data;
        self.receivedFiles[data.name].id = self.numReceivedFiles;
        self.receivedFiles[data.name].anchor = document.getElementById('recvd-' + self.numReceivedFiles);
        self.incomingFile = self.receivedFiles[data.name]
    }

    self.receiveFile = function(event) {
        self.startTime = self.startTime || (new Date).getTime();
        self.receiveBuffer = self.receiveBuffer || [];
        self.receivedSize = self.receivedSize || 0;
        self.bitrateMax = self.bitrateMax || 0;

        self.receiveBuffer.push(event.data);
        self.receivedSize += event.data.byteLength;

        receiveProgress.value = self.receivedSize;

        // we are assuming that our signaling protocol told
        // about the expected file size (and name, hash, etc).
        var received = new Blob(self.receiveBuffer, {type: 'application/octet-binary'});  // self.incomingFile.type
        var url = URL.createObjectURL(received);
        self.incomingFile.anchor.href = url;

        var bitrate = Math.round(self.receivedSize * 8 /
            ((new Date()).getTime() - self.startTime));

        if (bitrate > self.bitrateMax) {
            self.bitrateMax = bitrate;
        }

        bitrateDiv.innerHTML = (
            self.receivedSize + '/' + self.incomingFile.size
            + '  Bitrate: '
            + bitrate + ' kbits/sec'
            + ' (max: ' + self.bitrateMax + ' kbits/sec)'
        );

        if (self.receivedSize >= self.incomingFile.size) {
            self.writeToChatLog(
                "Receiving " + self.incomingFile.name + " finished! Download it below.",
                "text-success sent insecure",
                false
            );
            self.activeChannel.send(JSON.stringify({
                message: 'Received ' + self.incomingFile.name + " succesfully.",
            }));
        } else {
            self.incomingFile.anchor.disabled = true;
        }
    }

    self.sendFile = function(files) {
        var file = [].concat.apply([], files).slice(-1)[0];
        console.log('File is ' + [file.name, file.size, file.type,
            file.lastModifiedDate
        ].join(' '));
        self.activeChannel.send(JSON.stringify({
            file: true,
            name: file.name,
            size: file.size,
            type: file.type,
        }));
        self.writeToChatLog("Sending " + file.name, "text-success sent insecure", false);

        // Handle 0 size files.
        statusMessage.textContent = '';
        if (file.size === 0) {
          bitrateDiv.innerHTML = '';
          statusMessage.textContent = 'File is empty, please select a non-empty file';
          return;
        }
        sendProgress.max = file.size;
        receiveProgress.max = file.size;
        var chunkSize = 16384;
        var sliceFile = function(offset) {
          var reader = new window.FileReader();
          reader.onload = (function() {
            return function(e) {
              self.activeChannel.send(e.target.result);
              if (file.size > offset + e.target.result.byteLength) {
                window.setTimeout(sliceFile, 0, offset + chunkSize);
              }
              sendProgress.value = offset + e.target.result.byteLength;
            };
          })(file);
          var slice = file.slice(offset, offset + chunkSize);
          reader.readAsArrayBuffer(slice);
        };
        sliceFile(0);
    }

/* Utilities */

    // set these to your own functions using WebRTCChat.writeToChatLog = function(...) {...}

    self.writeToChatLog = function(message, message_type, secure) {console.log("-> ", message, message_type, secure);}

    self.displayPartnerTyping = function() {console.log("-> Typing...");}
}


text:
'''
Profile Formula Validation is an example of a plug-in to GUI menu that will profile formula execution.

(c) Copyright 2012 Mark V Systems Limited, All rights reserved.
'''
import os
from tkinter import simpledialog, messagebox

def profileFormulaMenuEntender(cntlr, menu, *args, **kwargs):
    # Extend menu with an item for the profile formula plugin
    menu.add_command(label="Profile formula validation",
                     underline=0,
                     command=lambda: profileFormulaMenuCommand(cntlr) )

def profileFormulaMenuCommand(cntlr):
    # save DTS menu item has been invoked
    if cntlr.modelManager is None or cntlr.modelManager.modelXbrl is None:
        cntlr.addToLog("No taxonomy loaded.")
        return

    # get file name into which to save log file while in foreground thread
    profileReportFile = cntlr.uiFileDialog("save",
            title=_("arelle - Save Formula Profile Report"),
            initialdir=cntlr.config.setdefault("formulaProfileReportDir","."),
            filetypes=[(_("Profile report file .log"), "*.log")],
            defaultextension=".log")
    if not profileReportFile:
        return False
    errMsg = ""
    maxRunTime = 0
    while (1):
        timeout = simpledialog.askstring(_("arelle - Set formula run time limit"),
                _("{0}You may enter the maximum number of minutes to run formulas.\n"
                  "(Leave empty for no run time limitation.)".format(errMsg)),
                parent=cntlr.parent)
        if timeout:
            try:
                maxRunTime = float(timeout)
                break
            except ValueError as err:
                errMsg = str(err) + "\n\n"

    excludeCompileTime = messagebox.askyesno(_("arelle - Exclude formula compile statistics"),
                _("Should formula compiling be excluded from the statistics?\n"
                  "(Yes will make a separate compiling \"pass\" so that statistics include execution only.)".format(errMsg)),
                parent=cntlr.parent)

    cntlr.config["formulaProfileReportDir"] = os.path.dirname(profileReportFile)
    cntlr.saveConfig()

    # perform validation and profiling on background thread
    import threading
    thread = threading.Thread(target=lambda c=cntlr, f=profileReportFile, t=maxRunTime, e=excludeCompileTime: backgroundProfileFormula(c,f,t,e))
    thread.daemon = True
    thread.start()

def backgroundProfileFormula(cntlr, profileReportFile, maxRunTime, excludeCompileTime):
    from arelle import Locale, XPathParser, ValidateXbrlDimensions, ValidateFormula

    # build grammar before profiling (if this is the first pass, so it doesn't count in profile statistics)
    XPathParser.initializeParser(cntlr.modelManager)

    # load dimension defaults
    ValidateXbrlDimensions.loadDimensionDefaults(cntlr.modelManager)

    import cProfile, pstats, sys, time

    # a minimal validation class for formula validator parameters that are needed
    class Validate:
        def __init__(self, modelXbrl, maxRunTime):
            self.modelXbrl = modelXbrl
            self.parameters = None
            self.validateSBRNL = False
            self.maxFormulaRunTime = maxRunTime
        def close(self):
            self.__dict__.clear()

    val = Validate(cntlr.modelManager.modelXbrl, maxRunTime)
    formulaOptions = val.modelXbrl.modelManager.formulaOptions
    if excludeCompileTime:
        startedAt = time.time()
        cntlr.addToLog(_("pre-compiling formulas before profiling"))
        val.validateFormulaCompileOnly = True
        ValidateFormula.validate(val)
        del val.validateFormulaCompileOnly
        cntlr.addToLog(Locale.format_string(cntlr.modelManager.locale,
                                            _("formula pre-compiling completed in %.2f secs"),
                                            time.time() - startedAt))
        cntlr.addToLog(_("executing formulas for profiling"))
    else:
        cntlr.addToLog(_("compiling and executing formulas for profiling"))
    startedAt = time.time()

    statsFile = profileReportFile + ".bin"
    cProfile.runctx("ValidateFormula.validate(val)", globals(), locals(), statsFile)
    cntlr.addToLog(Locale.format_string(cntlr.modelManager.locale,
                                        _("formula profiling completed in %.2f secs"),
                                        time.time() - startedAt))
    # dereference val
    val.close()

    # specify a file for log
    priorStdOut = sys.stdout
    sys.stdout = open(profileReportFile, "w")

    statObj = pstats.Stats(statsFile)
    statObj.strip_dirs()
    statObj.sort_stats("time")
    statObj.print_stats()
    statObj.print_callees()
    statObj.print_callers()
    sys.stdout.flush()
    sys.stdout.close()
    del statObj
    sys.stdout = priorStdOut
    os.remove(statsFile)

__pluginInfo__ = {
    'name': 'Profile Formula Validation',
    'version': '1.0',
    'description': "This plug-in adds a profiled formula validation. "
                    "Includes XPath compilation in the profile if it is the first validation of instance; "
                    "to exclude XPath compile statistics, validate first the normal way (e.g., toolbar button) "
                    "and then validate again using this profile formula validation plug-in.  ",
    'license': 'Apache-2',
    'author': 'Mark V Systems Limited',
    'copyright': '(c) Copyright 2012 Mark V Systems Limited, All rights reserved.',
    # classes of mount points (required)
    'CntlrWinMain.Menu.Validation': profileFormulaMenuEntender,
}


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

<title>Network</title>
<meta name="date" content="2015-02-27">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

io.openhc.ohc.skynet

Class Network

java.lang.Object

io.openhc.ohc.skynet.Network

public class Network
extends java.lang.Object

Networking class
 Handles most low level network stuff

Author:

Tobias Schramm

Nested Class Summary

Nested Classes

Modifier and Type
Class and Description

static class
Network.Protocol

Supported network protocols

Field Summary

Fields

Modifier and Type
Field and Description

private int
port_b_cast

private Receiver
receiver

protected java.net.DatagramSocket
socket

private Basestation
station

Constructor Summary

Constructors

Constructor and Description

Network(Basestation bs)

Default constructor.

Method Summary

All Methods Static Methods Instance Methods Concrete Methods

Modifier and Type
Method and Description

static boolean
find_basestation_lan(OHC ohc,
                    int port,
                    Broadcaster.Broadcast_receiver receiver)

Sends a broadcast packet to discover a basestation on the LAN

Receiver
setup_receiver()

Initialize a new RPC Receiver

void
setup_rx_socket()

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

socket

protected java.net.DatagramSocket socket

station

private Basestation station

receiver

private Receiver receiver

port_b_cast

private int port_b_cast

Constructor Detail

Network

public Network(Basestation bs)

Default constructor. Constructs a new Network interface class from basestation

Parameters:

bs - Basestation

Throws:

java.io.IOException

Method Detail

find_basestation_lan

public static boolean find_basestation_lan(OHC ohc,
                                           int port,
                                           Broadcaster.Broadcast_receiver receiver)

Sends a broadcast packet to discover a basestation on the LAN

Parameters:

ohc - OHC instance

port - Broadcast port

receiver - Callback

Returns:

Could the broadcast be sent

setup_rx_socket

public void setup_rx_socket()
                     throws java.io.IOException

Throws:

java.io.IOException

setup_receiver

public Receiver setup_receiver()
                        throws java.io.IOException

Initialize a new RPC Receiver

Returns:

A new RPC receiver

Throws:

java.io.IOException

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
namespace Imgur.API.Models
{
	/// <summary>
	/// Description of IImage.
	/// </summary>
	public interface IImage : IAlbumImageBase
	{
        /// <summary>
        /// Is the image animated.
        /// </summary>
		bool Animated {get;set;}

        /// <summary>
        /// The width of the image in pixels.
        /// </summary>
        int Width {get;set;}

        /// <summary>
        /// The height of the image in pixels.
        /// </summary>
        int Height {get;set;}

        /// <summary>
        /// The size of the image in bytes.
        /// </summary>
        int Size {get;set;}

        /// <summary>
        /// Image MIME type.
        /// </summary>
        string Type {get;set;}

        /// <summary>
        /// Bandwidth consumed by the image in bytes.
        /// </summary>
        long Bandwidth {get;set;}

        /// <summary>
        /// OPTIONAL, the original filename, if you're logged in as the image owner.
        /// </summary>
        string Name {get;set;}

        /// <summary>
        /// OPTIONAL, The .gifv link. Only available if the image is animated and type is 'image/gif'.
        /// </summary>
        string Gifv {get;set;}

        /// <summary>
        /// OPTIONAL, The direct link to the .mp4. Only available if the image is animated and type is 'image/gif'.
        /// </summary>
        string Mp4 {get;set;}

        /// <summary>
        /// OPTIONAL, The direct link to the .webm. Only available if the image is animated and type is 'image/gif'.
        /// </summary>
        string Webm {get;set;}

        /// <summary>
        /// OPTIONAL, Whether the image has a looping animation. Only available if the image is animated and type is 'image/gif'.
        /// </summary>
        bool? Looping {get;set;}

        /// <summary>
        /// The current user's vote on the album. null if not signed in, if the user hasn't voted on it, or if not submitted to the gallery.
        /// </summary>
        string Vote {get;set;}
	}
}


text:
#include "map/hdr_map.h"
#include <cds/container/lazy_kvlist_hp.h>
#include <cds/container/michael_map.h>

namespace map {
    namespace {
        struct map_traits: public cc::michael_map::traits
        {
            typedef HashMapHdrTest::hash_int            hash;
            typedef HashMapHdrTest::simple_item_counter item_counter;
        };
        struct HP_cmp_traits: public cc::lazy_list::traits
        {
            typedef HashMapHdrTest::cmp   compare;
        };

        struct HP_less_traits: public cc::lazy_list::traits
        {
            typedef HashMapHdrTest::less  less;
        };

        struct HP_cmpmix_traits: public cc::lazy_list::traits
        {
            typedef HashMapHdrTest::cmp   compare;
            typedef HashMapHdrTest::less  less;
        };
    }

    void HashMapHdrTest::Lazy_HP_cmp()
    {
        typedef cc::LazyKVList< cds::gc::HP, int, HashMapHdrTest::value_type, HP_cmp_traits > list;

        // traits-based version
        typedef cc::MichaelHashMap< cds::gc::HP, list, map_traits > map;
        test_int< map >();

        // option-based version
        typedef cc::MichaelHashMap< cds::gc::HP, list,
            cc::michael_map::make_traits<
                cc::opt::hash< hash_int >
                ,cc::opt::item_counter< simple_item_counter >
            >::type
        > opt_map;
        test_int< opt_map >();
    }

    void HashMapHdrTest::Lazy_HP_less()
    {
        typedef cc::LazyKVList< cds::gc::HP, int, HashMapHdrTest::value_type, HP_less_traits > list;

        // traits-based version
        typedef cc::MichaelHashMap< cds::gc::HP, list, map_traits > map;
        test_int< map >();

        // option-based version
        typedef cc::MichaelHashMap< cds::gc::HP, list,
            cc::michael_map::make_traits<
                cc::opt::hash< hash_int >
                ,cc::opt::item_counter< simple_item_counter >
            >::type
        > opt_map;
        test_int< opt_map >();
    }

    void HashMapHdrTest::Lazy_HP_cmpmix()
    {
        typedef cc::LazyKVList< cds::gc::HP, int, HashMapHdrTest::value_type, HP_cmpmix_traits > list;

        // traits-based version
        typedef cc::MichaelHashMap< cds::gc::HP, list, map_traits > map;
        test_int< map >();

        // option-based version
        typedef cc::MichaelHashMap< cds::gc::HP, list,
            cc::michael_map::make_traits<
                cc::opt::hash< hash_int >
                ,cc::opt::item_counter< simple_item_counter >
            >::type
        > opt_map;
        test_int< opt_map >();
    }

} // namespace map


text:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    tools:context=".MainActivity"

    android:orientation="vertical" >

    <EditText
        android:id="@+id/textField"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:hint="Enter a value"
        android:inputType="numberSigned|numberDecimal"/>

    <RadioGroup
        android:id="@+id/radioGroup"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:layout_alignParentLeft="true">

        <RadioButton
            android:id="@+id/radio0"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:checked="true"
            android:text="to celsius" />

        <RadioButton
                android:id="@+id/radio1"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:checked="false"
                android:text="to kelvin" />

    </RadioGroup>

    <Button
        android:id="@+id/button"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:onClick="calculate"
        android:text="Calculate" />

    <LinearLayout
        android:layout_height="fill_parent"
        android:layout_width="fill_parent">

        <Button
                android:id="@+id/button2"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:onClick="gotToSensorScreen"
                android:text="Sensor"
                android:layout_gravity="bottom"/>
    </LinearLayout>

</LinearLayout>


text:
using System;
using System.Linq;
using System.Security.Claims;
using System.Security.Principal;

namespace Common
{
    public static class ExtensionMethods
    {
        #region GetUniqueIdentifier

        /// <summary>
        /// Gets a unique identifier for the specified principal.
        /// </summary>
        /// <param name="principal">The principal.</param>
        /// <returns>A unique identifier for the specified principal.</returns>
        public static string GetUniqueIdentifier(this IPrincipal principal)
        {
            return (principal.Identity as ClaimsIdentity).GetUniqueIdentifier();
        }

        /// <summary>
        /// Gets a unique identifier for the specified identity.
        /// </summary>
        /// <param name="identity">The identity.</param>
        /// <returns>A unique identifier for the specified identity.</returns>
        public static string GetUniqueIdentifier(this ClaimsIdentity identity)
        {
            if (identity == null)
            {
                throw new ArgumentNullException("identity");
            }

            // [NOTE] The "Object Identifier" claim is ensured to be unique, non-changeable and non-reusable across multiple identities in Azure AD.
            var objectIdentifierClaim = identity.FindFirst("http://schemas.microsoft.com/identity/claims/objectidentifier");
            if (objectIdentifierClaim != null && !string.IsNullOrWhiteSpace(objectIdentifierClaim.Value))
            {
                return objectIdentifierClaim.Value;
            }
            // If the "Object Identifier" is not present, fall back to the "Name Identifier" if possible.
            var nameIdentifierClaim = identity.FindFirst("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier");
            if (nameIdentifierClaim != null && !string.IsNullOrWhiteSpace(nameIdentifierClaim.Value))
            {
                return nameIdentifierClaim.Value;
            }
            // If the "Name Identifier" is not present, fall back to the "UPN" if possible.
            var upnClaim = identity.FindFirst("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn");
            if (upnClaim != null && !string.IsNullOrWhiteSpace(upnClaim.Value))
            {
                return upnClaim.Value;
            }
            throw new ArgumentException("The specified identity does not contain a unique identifier claim.");
        }

        #endregion

        #region IdentityInfo.WriteToConsole

        public static void WriteToConsole(this IdentityInfo identity)
        {
            identity.WriteToConsole(0);
        }

        private static void WriteToConsole(this IdentityInfo identity, int indentationLevel)
        {
            // Identity.
            WritePropertyToConsole("Source\t\t", identity.Source, indentationLevel);
            WritePropertyToConsole("Application\t", identity.Application, indentationLevel);
            WritePropertyToConsole("Is Authenticated", identity.IsAuthenticated.ToString(), indentationLevel);
            WritePropertyToConsole("Name\t\t", identity.Name, indentationLevel);
            WritePropertyToConsole("Authentication Type", identity.AuthenticationType, indentationLevel);
            if (identity.RoleNames != null && identity.RoleNames.Any())
            {
                WritePropertyToConsole("Application Roles", string.Join(", ", identity.RoleNames), indentationLevel);
            }
            if (identity.GroupNames != null && identity.GroupNames.Any())
            {
                WritePropertyToConsole("Groups\t\t", string.Join(", ", identity.GroupNames), indentationLevel);
            }

            // Claims.
            Console.WriteLine();
            Console.WriteLine(GetIndentationPrefix(indentationLevel) + "Claims:");
            foreach (var claim in identity.Claims)
            {
                WritePropertyToConsole("   Type", claim.Type, indentationLevel, ConsoleColor.Magenta);
                WritePropertyToConsole("  Value", claim.Value, indentationLevel);
                if (!string.IsNullOrWhiteSpace(claim.Remark))
                {
                    WritePropertyToConsole(" Remark", claim.Remark, indentationLevel, ConsoleColor.Gray);
                }
                Console.WriteLine();
            }

            // Related Application Identities.
            if (identity.RelatedApplicationIdentities != null && identity.RelatedApplicationIdentities.Any())
            {
                Console.WriteLine();
                Console.WriteLine(GetIndentationPrefix(indentationLevel) + "Related Application Identities:");
                foreach (var relatedApplicationIdentity in identity.RelatedApplicationIdentities)
                {
                    Console.WriteLine();
                    WriteToConsole(relatedApplicationIdentity, indentationLevel + 1);
                }
            }
        }

        private static void WritePropertyToConsole(string name, string value, int indentationLevel, ConsoleColor valueColor = ConsoleColor.Yellow)
        {
            var originalForegroundColor = Console.ForegroundColor;
            try
            {
                Console.ForegroundColor = ConsoleColor.DarkGray;
                Console.Write(GetIndentationPrefix(indentationLevel) + name + "\t: ");
                Console.ForegroundColor = valueColor;
                Console.WriteLine(value);
            }
            finally
            {
                Console.ForegroundColor = originalForegroundColor;
            }
        }

        private static string GetIndentationPrefix(int indentationLevel)
        {
            return new string('\t', indentationLevel);
        }

        #endregion
    }
}


text:
package net.ssehub.kernel_haven.code_model.simple_ast;

import net.ssehub.kernel_haven.util.null_checks.NonNull;

/**
 * An element in the syntax tree that indicates an error.
 *
 * @author Adam
 */
public class ErrorSyntaxElement implements ISyntaxElementType {

    private @NonNull String message;

    /**
     * Creates a new error syntax element.
     *
     * @param message The message to be displayed.
     */
    public ErrorSyntaxElement(@NonNull String message) {
        this.message = message;
    }

    /**
     * Retrieves the message for this error.
     *
     * @return This error message.
     */
    public @NonNull String getMessage() {
        return message;
    }

    @Override
    public @NonNull String toString() {
        return "Error: " + message;
    }

    @Override
    public int hashCode() {
        return message.hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        boolean equal = false;

        if (obj instanceof ErrorSyntaxElement) {
            equal = this.message.equals(((ErrorSyntaxElement) obj).message);
        }

        return equal;
    }

}


text:
function html_unescape(text) {
    // Unescape a string that was escaped using django.utils.html.escape.
    text = text.replace(/</g, '<');
    text = text.replace(/>/g, '>');
    text = text.replace(/"/g, '"');
    text = text.replace(/'/g, "'");
    text = text.replace(/&/g, '&');
    return text;
}

// IE doesn't accept periods or dashes in the window name, but the element IDs
// we use to generate popup window names may contain them, therefore we map them
// to allowed characters in a reversible way so that we can locate the correct
// element when the popup window is dismissed.
function id_to_windowname(text) {
    text = text.replace(/\./g, '__dot__');
    text = text.replace(/\-/g, '__dash__');
    return text;
}

function windowname_to_id(text) {
    text = text.replace(/__dot__/g, '.');
    text = text.replace(/__dash__/g, '-');
    return text;
}

function showRelatedObjectLookupPopup(triggeringLink) {
    var name = triggeringLink.id.replace(/^lookup_/, '');
    name = id_to_windowname(name);
    var href;
    if (triggeringLink.href.search(/\?/) >= 0) {
        href = triggeringLink.href + '&pop=1';
    } else {
        href = triggeringLink.href + '?pop=1';
    }
    // GRAPPELLI CUSTOM: changed width
    var win = window.open(href, name, 'height=500,width=1000,resizable=yes,scrollbars=yes');
    win.focus();
    return false;
}

function dismissRelatedLookupPopup(win, chosenId) {
    var name = windowname_to_id(win.name);
    var elem = document.getElementById(name);
    if (elem.className.indexOf('vManyToManyRawIdAdminField') != -1 && elem.value) {
        elem.value += ',' + chosenId;
    } else {
        document.getElementById(name).value = chosenId;
    }
    // GRAPPELLI CUSTOM: element focus
    elem.focus();
    win.close();
}

// GRAPPELLI CUSTOM
function removeRelatedObject(triggeringLink) {
    var id = triggeringLink.id.replace(/^remove_/, '');
    var elem = document.getElementById(id);
    elem.value = "";
    elem.focus();
}

function showAddAnotherPopup(triggeringLink) {
    var name = triggeringLink.id.replace(/^add_/, '');
    name = id_to_windowname(name);
    href = triggeringLink.href;
    if (href.indexOf('?') == -1) {
        href += '?_popup=1';
    } else {
        href  += '&_popup=1';
    }
    // GRAPPELLI CUSTOM: changed width
    var win = window.open(href, name, 'height=500,width=1000,resizable=yes,scrollbars=yes');
    win.focus();
    return false;
}

function dismissAddAnotherPopup(win, newId, newRepr) {
    // newId and newRepr are expected to have previously been escaped by
    // django.utils.html.escape.
    newId = html_unescape(newId);
    newRepr = html_unescape(newRepr);
    var name = windowname_to_id(win.name);
    var elem = document.getElementById(name);
    if (elem) {
        if (elem.nodeName == 'SELECT') {
            var o = new Option(newRepr, newId);
            elem.options[elem.options.length] = o;
            o.selected = true;
        } else if (elem.nodeName == 'INPUT') {
            if (elem.className.indexOf('vManyToManyRawIdAdminField') != -1 && elem.value) {
                elem.value += ',' + newId;
                elem.focus();
            } else {
                elem.value = newId;
                elem.focus();
            }
        // GRAPPELLI CUSTOM
        // NOTE: via http://code.djangoproject.com/ticket/10191
        // check if the className contains radiolist - if it's HORIZONTAL, then it won't match if we compare explicitly
        } else if (elem.className.indexOf('radiolist') > -1) {
            var cnt = elem.getElementsByTagName('li').length;
            var idName = elem.id+'_'+cnt;
            var newLi = document.createElement('li');
            var newLabel = document.createElement('label');
            var newText = document.createTextNode(' '+newRepr);
            try {
                // IE doesn't support settings name, type, or class by setAttribute
                var newInput = document.createElement('<input type=\'radio\' name=\''+name.slice(3)+'\' checked=\'checked\' class=\''+elem.className+'\' />');
            } catch(err) {
                var newInput = document.createElement('input');
                newInput.setAttribute('class', elem.className);
                newInput.setAttribute('type', 'radio');
                newInput.setAttribute('name', name.slice(3));
            }
            newLabel.setAttribute('for', idName);
            newInput.setAttribute('id', idName);
            newInput.setAttribute('value', newId);
            newInput.setAttribute('checked', 'checked');
            newLabel.appendChild(newInput);
            // check if the content being added is a tag - useful for image lists
            if (newRepr.charAt(0) == '<' && newRepr.charAt(newRepr.length-1) == '>') {
                newLabel.innerHTML += newRepr;
            } else {
                newLabel.appendChild(newText);
            }
            newLi.appendChild(newLabel);
            elem.appendChild(newLi);
        }
    } else {
        // might be a SelectBox
        var toId = name + "_to";
        elem = document.getElementById(toId);

        // GRAPPELLI CUSTOM
        // SelectBox code isn't customized, but CheckboxSelectMultiple doesn't exist in the original
        if (elem) {
            // It is a select box
            var o = new Option(newRepr, newId);
            SelectBox.add_to_cache(toId, o);
            SelectBox.redisplay(toId);
        } else {
            // last chance. might be a CheckboxSelectMultiple
            // get the list of checkboxes
            var list = document.getElementById(name + "_0").parentNode.parentNode.parentNode;
            var inputId = name + '_' + list.childNodes.length;
            var newText = document.createTextNode(' '+newRepr);

            // create a new list item with a checkbox and label in it
            var newInput = document.createElement('input');
            newInput.setAttribute('type', 'checkbox');
            newInput.setAttribute('name', name);
            newInput.setAttribute('value', newId);
            newInput.setAttribute('id', inputId);
            newInput.setAttribute('checked', 'checked');

            var newLabel = document.createElement('label');
            newLabel.setAttribute('for', inputId);

            newLabel.appendChild(newInput);

            if (newRepr.charAt(0) == '<' && newRepr.charAt(newRepr.length-1) == '>') {
                newLabel.innerHTML += newRepr;
            } else {
                newLabel.appendChild(newText);
            }

            var newLi = document.createElement('li');
            newLi.appendChild(newLabel);

            // append the new list item to the list
            list.appendChild(newLi);
        }
    }
    win.close();
}


text:
/* generated */

#include "class.h"

static const struct range ranges[] = {
	{ 0x10350UL, 0x1037AUL }
};

const struct class utf8_Old_Permic = {
	ranges,
	sizeof ranges / sizeof *ranges
};