text:
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="#xslt"?>
<!DOCTYPE xsl:stylesheet [<!ATTLIST xsl:stylesheet id ID #IMPLIED>]>
<xsl:stylesheet id="xslt" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="xsl:template">
<result>
<xsl:choose>
<xsl:when test='//phi[contains(concat(@abort,"$"),"te value$")][@xml:lang="en"][@xml:id="id1"]/lambda[following-sibling::*[position()=1]][following-sibling::delta[not(following-sibling::*)]/iota[contains(@attr,"tent")][@xml:lang="en"][not(preceding-sibling::*)]//lambda[@desciption="_blank"][@xml:lang="no"][@xml:id="id2"][not(child::node())][following-sibling::xi[@attribute][@xml:id="id3"][preceding-sibling::*[position() = 1]]//nu[@xml:id="id4"][not(child::node())][following-sibling::*[@xml:lang="en-GB"][@xml:id="id5"][preceding-sibling::*[position() = 1]][position() = 1]]]]'>
	<xsl:value-of select="'PASS'"/>
</xsl:when>
<xsl:otherwise>FAIL</xsl:otherwise>
</xsl:choose>
</result>
<xsl:if test="false()">
<phi abort="attribute value" xml:lang="en" xml:id="id1"><lambda/><delta><iota attr="content" xml:lang="en"><lambda desciption="_blank" xml:lang="no" xml:id="id2"/><xi attribute="attribute" xml:id="id3"><nu xml:id="id4"/><any xml:lang="en-GB" xml:id="id5"><green>This text must be green</green></any></xi></iota></delta></phi></xsl:if>
</xsl:template>
</xsl:stylesheet>


text:
require 'active_record'
require 'sqlite3'

ActiveRecord::Base.establish_connection(
  :adapter => defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby' ? 'jdbcsqlite3' : 'sqlite3',
  :database => File.join(File.dirname(__FILE__), 'test.db')
)

class CreateSchema < ActiveRecord::Migration
  def self.up
    create_table :posts, :force => true do |t|
      t.string :title
      t.string :slug
      t.timestamps
    end

    create_table :users, :force => true do |t|
      t.string :first_name
      t.string :last_name
      t.string :slug
      t.timestamps
    end

    create_table :edges, :force => true do |t|
      t.string :name
      t.string :slug_name
    end
    create_table :comments, :force => true do |t|
      t.integer :post_id
      t.string  :title
      t.string  :slug
    end
  end
end

CreateSchema.suppress_messages do
  CreateSchema.migrate(:up)
end

class Post < ActiveRecord::Base
  has_many :comments
  has_slug 'title', :max_length => 20
end

class User < ActiveRecord::Base
  has_slug [:first_name, :last_name], :on_conflict => :append_id
end

class Edge < ActiveRecord::Base
  has_slug 'name', :slug_column => :slug_name,
                   :substitution_char => "_",
                   :downcase => false,
                   :on_conflict => :concat_random_chars
end

class Comment < ActiveRecord::Base
  belongs_to :post
  has_slug   :title, :scope => :post_id
end

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body style='margin: 0px'>

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
            codebase="" id="mySVGViewerObj" width=1250.0 height=750.0 style='float: left'>
        <param name=movie value="../../src/svg.swf">
        <param name="FlashVars" value="sourceType=url_svg&svgURL=../svg-files/scimitar.svg">
        <param name="wmode" value="transparent">
        <embed play=false name="mySVGViewerObj"
                src="../../src/svg.swf" quality=high wmode="transparent"
                width=1250.0 height=750.0 type="application/x-shockwave-flash"
                FlashVars="sourceType=url_svg&svgURL=../svg-files/scimitar.svg">
        </embed >
    </object>

</body>
</html>


text:
Parsley.addMessages('it', {
  dateiso: "Inserire una data valida (AAAA-MM-GG)."
});


text:
using ITree = Antlr.Runtime.Tree.ITree;

namespace Antlr.Runtime.JavaExtensions
{
    public static class TreeExtensions
    {
        public static ITree getNextSibling( this ITree tree )
        {
            return tree.Parent.GetChild( tree.ChildIndex + 1 );
            //throw new NotImplementedException();
        }

        public static void setFirstChild( this ITree tree, ITree child )
        {
            if ( tree.ChildCount == 0 )
                tree.AddChild( child );
            else
                tree.SetChild( 0, child );
        }
    }
}


text:
class UpdateMoneyStoreToHstore < ActiveRecord::Migration
  def up
    PgTools.with_schemas except: 'common' do
      # Bank
      execute <<-SQL
UPDATE accounts a SET extras = HSTORE('email', ms.email) || HSTORE('address', ms.address) || HSTORE('phone', ms.phone) || HSTORE('website', ms.website) FROM money_stores ms
WHERE ms.account_id = a.id AND a.type = 'Bank';
      SQL
      # Cash
      execute <<-SQL
UPDATE accounts a SET extras = HSTORE('email', ms.email) || HSTORE('address', ms.address) || HSTORE('phone', ms.phone) FROM money_stores ms WHERE ms.account_id = a.id AND a.type = 'Cash';
      SQL
    end
  end

  def down
    puts 'Nothing to change'
  end
end


text:
layout: 	project_page
title:  	"Burn Bunny (In Space)"
date:   	2017-10-12 07:30:00 +0100
category: 	school-project
thumb: 		/assets/atomic_lemon.png

excerpt: |
  Atomic Lemon is a **3D side scrolling beat'em up game** where you play as Lemon, a young girl who fights for the salvation of her favela with her fists and with street art.

type: "3D beat'em up game"
platforms: "Windows"
inputs: "Gamepad"

abstract: |
  Atomic Lemon is a **3D side scrolling beat'em up game** where you play as Lemon, a young girl who fights for the salvation of her favela with her fists and with street art.

banner: {"type": "video", "src": "https://www.youtube.com/watch?v=Wh_TcsSIUKU"}

team:
  - {"name": "Solène Bontemps", "role": "Artist"}
  - {"name": "Bao Lin Vo", "role": "Artist"}
  - {"name": "Lena Dobric", "role": "Game designer"}
  - {"name": "Benjamin Hoibian", "role": "Game designer"}
  - {"name": "Jean Eli", "role": "Producer"}
  - {"name": "Antoine Wert", "role": "Sound designer"}
  - {"name": "Thomas Fransisco", "role": "Developer"}
  - {"name": "Fanny Prele", "role": "Developer"}
  - {"name": "Aurélien Plantard", "role": "Developer"}
  - {"name": "Clément Rondeau", "role": "Developer"}

tasks:
  - Gameplay
  - Interactive music and sound design integration
  - 3D models and animations integration
  - UI integration

screenshots: {"http://kevinreginaldi.fr/atomic/img/Web1.jpg", "http://kevinreginaldi.fr/atomic/img/Web3.jpg", "http://kevinreginaldi.fr/atomic/img/Web8.jpg"}

video: {https://www.youtube.com/watch?v=mQK3NAliNR8}

published: false
---
Atomic Lemon is our end of year school project consisting in making the vertical slice of a game in 4 months.

It's a 3D side scrolling beat'em up game. You play as Lemon, a young girl who fights for the salvation of her favela with her fists and with street art, accompanied by her sidekick, the graffiti of a sloth moving on the walls.
The player control Lemon and the Sloth at the same time and must fight enemies that can move in 3D in the arena and in 2D on the walls.


text:
package com.intellij.openapi.ui.popup.util;

import com.intellij.ide.util.treeView.AbstractTreeStructure;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.PopupStep;
import com.intellij.openapi.ui.popup.TreePopupStep;
import org.jetbrains.annotations.NotNull;

import java.util.Collections;
import java.util.List;

public class BaseTreePopupStep<T> extends BaseStep<T> implements TreePopupStep<T> {

  private final String myTitle;
  private final AbstractTreeStructure myStructure;
  private final Project myProject;

  public BaseTreePopupStep(Project project, String aTitle, AbstractTreeStructure aStructure) {
    myTitle = aTitle;
    myStructure = aStructure;
    myProject = project;
  }

  public AbstractTreeStructure getStructure() {
    return myStructure;
  }

  public boolean isRootVisible() {
    return false;
  }

  public Project getProject() {
    return myProject;
  }

  public String getTitle() {
    return myTitle;
  }

  public boolean isSelectable(T node, T userData) {
    return true;
  }

  public boolean hasSubstep(T selectedValue) {
    return false;
  }

  public PopupStep onChosen(T selectedValue, final boolean finalChoice) {
    return FINAL_CHOICE;
  }

  public void canceled() {
  }

  public String getTextFor(T value) {
    return value.toString();
  }

  @NotNull
  public List<T> getValues() {
    return Collections.emptyList();
  }

  public boolean isSpeedSearchEnabled() {
    return true;
  }

}


text:
package com.bugull.mongo.cache;

import com.bugull.mongo.BuguConnection;
import com.bugull.mongo.BuguFramework;
import com.mongodb.MongoClientOptions;
import com.mongodb.MongoCredential;
import com.mongodb.ServerAddress;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Frank Wen(xbwen@hotmail.com)
 */
public class ReplicaSetBaseTest {

    protected void connectDB(){
        List<ServerAddress> serverList = new ArrayList<ServerAddress>();
        serverList.add(new ServerAddress("192.168.0.200", 27017));
        serverList.add(new ServerAddress("192.168.0.200", 27018));
        serverList.add(new ServerAddress("192.168.0.200", 27019));

        List<MongoCredential> credentialList = new ArrayList<MongoCredential>();
        MongoCredential credentialA = MongoCredential.createCredential("test", "test", "test".toCharArray());
        MongoCredential credentialB = MongoCredential.createCredential("test", "test", "test".toCharArray());
        MongoCredential credentialC = MongoCredential.createCredential("test", "test", "test".toCharArray());
        credentialList.add(credentialA);
        credentialList.add(credentialB);
        credentialList.add(credentialC);
        BuguConnection conn = BuguFramework.getInstance().createConnection();
        conn.setServerList(serverList).setCredentialList(credentialList).setDatabase("test").connect();
    }

    protected void connectDBWithOptions(MongoClientOptions options){
        List<ServerAddress> serverList = new ArrayList<ServerAddress>();
        serverList.add(new ServerAddress("192.168.0.200", 27017));
        serverList.add(new ServerAddress("192.168.0.200", 27018));
        serverList.add(new ServerAddress("192.168.0.200", 27019));

        List<MongoCredential> credentialList = new ArrayList<MongoCredential>();
        MongoCredential credentialA = MongoCredential.createCredential("test", "test", "test".toCharArray());
        MongoCredential credentialB = MongoCredential.createCredential("test", "test", "test".toCharArray());
        MongoCredential credentialC = MongoCredential.createCredential("test", "test", "test".toCharArray());
        credentialList.add(credentialA);
        credentialList.add(credentialB);
        credentialList.add(credentialC);
        BuguConnection conn = BuguFramework.getInstance().createConnection();
        conn.setOptions(options);
        conn.setServerList(serverList);
        conn.setCredentialList(credentialList);
        conn.setDatabase("test");
        conn.connect();
    }

    protected void disconnectDB(){
        BuguFramework.getInstance().destroy();
    }

}


text:
var bits = 0;
var bytes = 0;
var bytesMax = 8;
var bitsdrives = 1;
var bytesdrives = 1;
var bytesdriveCost = 64;
var byteunlock = false;

function bitsClick(number){
    bits = bits + number;
    update("bits",bits);
	if(!byteunlock){
		if(bits >= 32){
			fadeIn("byteContainer", 10);
			byteunlock = true;
		};
	};
};

function bytesClick(number){
    if(bytes >= bytesMax || bits < 8) return;
    bytes = bytes + number;
    bits = bits - 8;
	update("bits",bits);
    update("bytes",bytes);
    progBar("bytesbar",bytes,bytesMax);
};

function buybytesDrive(){
    if(bits >= bytesdriveCost){
        bytesdrives = bytesdrives + 1;
        bits = bits - bytesdriveCost;
        bytesMax = bytesMax + 8;
		update("bits",bits);
        update("bytesdrives",bytesdrives);
        update("bytes",bytes);
        update("bytesMax",bytesMax);
        progBar("bytesbar",bytes,bytesMax);
    }
};

function progBar(bar,amt,amtMax){
    var myProg = document.getElementById("myProgress");
    var myBar = document.getElementById(bar);
    var percent = Math.floor((amt/amtMax)*100);
    myProg.style.width = amtMax;
    myBar.style.width = percent + '%';
    if(percent <= 33) {myBar.style['background-color'] = "red"};
    if(percent >= 34 && percent <= 66) {myBar.style['background-color'] = "yellow"};
    if(percent >= 67) {myBar.style['background-color'] = "green"};
};

function update(what,number){
    document.getElementById(what).innerHTML = number;

};

function fadeIn(elem, speed) {
    elem = document.getElementById(elem);
    if (elem.style.visibility == "hidden") elem.style.visibility = "visible";
		elem.style.opacity = 1;
	var total = 100 * speed;
	var start = performance.now();
    var fadeCallback = function (timer) {
		var opacity = (timer - start) / total;
        elem.style.opacity = opacity;
        if (!(opacity >= 1)) {
            requestAnimationFrame(fadeCallback);
        }
    };
	requestAnimationFrame(fadeCallback);
};


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

<Configuration>
	<RepositoryList>
		<Repository name="SoftHSM">
			<Module>@SOFTHSM_MODULE@</Module>
			<TokenLabel>OpenDNSSEC</TokenLabel>
			<PIN>1234</PIN>
		</Repository>
	</RepositoryList>
	<Common>
		<Logging>
			<Verbosity>3</Verbosity>
			<Syslog><Facility>local0</Facility></Syslog>
		</Logging>
		<PolicyFile>@INSTALL_ROOT@/etc/opendnssec/kasp.xml</PolicyFile>
		<ZoneListFile>@INSTALL_ROOT@/etc/opendnssec/zonelist.xml</ZoneListFile>
	</Common>
	<Enforcer>
		<Datastore><SQLite>@INSTALL_ROOT@/var/opendnssec/kasp.db</SQLite></Datastore>
		<Interval>PT3600S</Interval>
		<AutomaticKeyGenerationPeriod>PT3600S</AutomaticKeyGenerationPeriod>
	</Enforcer>
	<Signer>
		<WorkingDirectory>@INSTALL_ROOT@/var/opendnssec/signer</WorkingDirectory>
		<WorkerThreads>4</WorkerThreads>
	</Signer>
</Configuration>


text:
define("dojox/mobile/Switch",["dojo/_base/array","dojo/_base/connect","dojo/_base/declare","dojo/_base/event","dojo/_base/window","dojo/dom-class","dojo/dom-construct","dojo/dom-style","dojo/touch","dijit/_Contained","dijit/_WidgetBase","./sniff"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c){
return _3("dojox.mobile.Switch",[_b,_a],{value:"on",name:"",leftLabel:"ON",rightLabel:"OFF",shape:"mblSwDefaultShape",tabIndex:"0",_setTabIndexAttr:"",baseClass:"mblSwitch",role:"",_createdMasks:[],buildRendering:function(){
this.domNode=(this.srcNodeRef&&this.srcNodeRef.tagName==="SPAN")?this.srcNodeRef:_7.create("span");
this.inherited(arguments);
var c=(this.srcNodeRef&&this.srcNodeRef.className)||this.className||this["class"];
if((c=c.match(/mblSw.*Shape\d*/))){
this.shape=c;
}
_6.add(this.domNode,this.shape);
var _d=this.name?" name=\""+this.name+"\"":"";
this.domNode.innerHTML="
"+"
"+"

"+"
"+"
"+"

"+"
"+"

"+"<input type=\"hidden\""+_d+">
"+"
";
var n=this.inner=this.domNode.firstChild;
this.left=n.childNodes[0];
this.right=n.childNodes[1];
this.knob=n.childNodes[2];
this.input=n.childNodes[3];
},postCreate:function(){
this._clickHandle=this.connect(this.domNode,"onclick","_onClick");
this._keydownHandle=this.connect(this.domNode,"onkeydown","_onClick");
this._startHandle=this.connect(this.domNode,_9.press,"onTouchStart");
this._initialValue=this.value;
},_changeState:function(_e,_f){
var on=(_e==="on");
this.left.style.display="";
this.right.style.display="";
this.inner.style.left="";
if(_f){
_6.add(this.domNode,"mblSwitchAnimation");
}
_6.remove(this.domNode,on?"mblSwitchOff":"mblSwitchOn");
_6.add(this.domNode,on?"mblSwitchOn":"mblSwitchOff");
var _10=this;
setTimeout(function(){
_10.left.style.display=on?"":"none";
_10.right.style.display=!on?"":"none";
_6.remove(_10.domNode,"mblSwitchAnimation");
},_f?300:0);
},_createMaskImage:function(){
if(this._hasMaskImage){
return;
}
this._width=this.domNode.offsetWidth-this.knob.offsetWidth;
this._hasMaskImage=true;
if(!_c("webkit")){
return;
}
var _11=_8.get(this.left,"borderTopLeftRadius");
if(_11=="0px"){
return;
}
var _12=_11.split(" ");
var rx=parseFloat(_12[0]),ry=(_12.length==1)?rx:parseFloat(_12[1]);
var w=this.domNode.offsetWidth,h=this.domNode.offsetHeight;
var id=(this.shape+"Mask"+w+h+rx+ry).replace(/\./,"_");
if(!this._createdMasks[id]){
this._createdMasks[id]=1;
var ctx=_5.doc.getCSSCanvasContext("2d",id,w,h);
ctx.fillStyle="#000000";
ctx.beginPath();
if(rx==ry){
ctx.moveTo(rx,0);
ctx.arcTo(0,0,0,rx,rx);
ctx.lineTo(0,h-rx);
ctx.arcTo(0,h,rx,h,rx);
ctx.lineTo(w-rx,h);
ctx.arcTo(w,h,w,rx,rx);
ctx.lineTo(w,rx);
ctx.arcTo(w,0,w-rx,0,rx);
}else{
var pi=Math.PI;
ctx.scale(1,ry/rx);
ctx.moveTo(rx,0);
ctx.arc(rx,rx,rx,1.5*pi,0.5*pi,true);
ctx.lineTo(w-rx,2*rx);
ctx.arc(w-rx,rx,rx,0.5*pi,1.5*pi,true);
}
ctx.closePath();
ctx.fill();
}
this.domNode.style.webkitMaskImage="-webkit-canvas("+id+")";
},_onClick:function(e){
if(e&&e.type==="keydown"&&e.keyCode!==13){
return;
}
if(this.onClick(e)===false){
return;
}
if(this._moved){
return;
}
this.value=this.input.value=(this.value=="on")?"off":"on";
this._changeState(this.value,true);
this.onStateChanged(this.value);
},onClick:function(){
},onTouchStart:function(e){
this._moved=false;
this.innerStartX=this.inner.offsetLeft;
if(!this._conn){
this._conn=[this.connect(this.inner,_9.move,"onTouchMove"),this.connect(this.inner,_9.release,"onTouchEnd")];
}
this.touchStartX=e.touches?e.touches[0].pageX:e.clientX;
this.left.style.display="";
this.right.style.display="";
_4.stop(e);
this._createMaskImage();
},onTouchMove:function(e){
e.preventDefault();
var dx;
if(e.targetTouches){
if(e.targetTouches.length!=1){
return;
}
dx=e.targetTouches[0].clientX-this.touchStartX;
}else{
dx=e.clientX-this.touchStartX;
}
var pos=this.innerStartX+dx;
var d=10;
if(pos<=-(this._width-d)){
pos=-this._width;
}
if(pos>=-d){
pos=0;
}
this.inner.style.left=pos+"px";
if(Math.abs(dx)>d){
this._moved=true;
}
},onTouchEnd:function(e){
_1.forEach(this._conn,_2.disconnect);
this._conn=null;
if(this.innerStartX==this.inner.offsetLeft){
if(_c("touch")&&!(_c("android")>=4.1)){
var ev=_5.doc.createEvent("MouseEvents");
ev.initEvent("click",true,true);
this.inner.dispatchEvent(ev);
}
return;
}
var _13=(this.inner.offsetLeft<-(this._width/2))?"off":"on";
this._changeState(_13,true);
if(_13!=this.value){
this.value=this.input.value=_13;
this.onStateChanged(_13);
}
},onStateChanged:function(_14){
},_setValueAttr:function(_15){
this._changeState(_15,false);
if(this.value!=_15){
this.onStateChanged(_15);
}
this.value=this.input.value=_15;
},_setLeftLabelAttr:function(_16){
this.leftLabel=_16;
this.left.firstChild.innerHTML=this._cv?this._cv(_16):_16;
},_setRightLabelAttr:function(_17){
this.rightLabel=_17;
this.right.firstChild.innerHTML=this._cv?this._cv(_17):_17;
},reset:function(){
this.set("value",this._initialValue);
}});
});


text:
class Person < ActiveRecord::Base
  has_many :readers
  has_many :posts, :through => :readers
  has_many :posts_with_no_comments, :through => :readers, :source => :post, :include => :comments, :conditions => 'comments.id is null'

  has_many :references
  has_many :jobs, :through => :references
  has_one :favourite_reference, :class_name => 'Reference', :conditions => ['favourite=?', true]
  has_many :posts_with_comments_sorted_by_comment_id, :through => :readers, :source => :post, :include => :comments, :order => 'comments.id'

  belongs_to :primary_contact, :class_name => 'Person'
  has_many :agents, :class_name => 'Person', :foreign_key => 'primary_contact_id'

  named_scope :males, :conditions => { :gender => 'M' }
  named_scope :females, :conditions => { :gender => 'F' }
end


text:
<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "historyElement".
 *
 * @property integer $id
 * @property integer $history_id
 * @property string $field
 * @property string $oldValue
 * @property string $newValue
 */
class HistoryElement extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%historyElement}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['history_id', 'field', 'oldValue', 'newValue'], 'required'],
            [['history_id'], 'integer'],
            [['field', 'oldValue', 'newValue'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'history_id' => 'History ID',
            'field' => 'Field',
            'oldValue' => 'Old Value',
            'newValue' => 'New Value',
        ];
    }

    public function getHistory()
    {
        return $this->hasOne(History::className(), ['id' => 'history_id']);
    }
}


text:
package org.apache.jmeter.protocol.jms.sampler;

import java.util.Date;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Map;

import javax.jms.DeliveryMode;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueSender;
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import org.apache.jmeter.config.Arguments;
import org.apache.jmeter.protocol.jms.Utils;
import org.apache.jmeter.samplers.AbstractSampler;
import org.apache.jmeter.samplers.Entry;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.testelement.ThreadListener;
import org.apache.jmeter.testelement.property.BooleanProperty;
import org.apache.jmeter.testelement.property.TestElementProperty;
import org.apache.jmeter.util.JMeterUtils;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.log.Logger;

/**
 * This class implements the JMS Point-to-Point sampler
 *
 */
public class JMSSampler extends AbstractSampler implements ThreadListener {

    private static final Logger LOGGER = LoggingManager.getLoggerForClass();

    private static final long serialVersionUID = 233L;

    private static final int DEFAULT_TIMEOUT = 2000;
    private static final String DEFAULT_TIMEOUT_STRING = Integer.toString(DEFAULT_TIMEOUT);

    //++ These are JMX names, and must not be changed
    private static final String JNDI_INITIAL_CONTEXT_FACTORY = "JMSSampler.initialContextFactory"; // $NON-NLS-1$

    private static final String JNDI_CONTEXT_PROVIDER_URL = "JMSSampler.contextProviderUrl"; // $NON-NLS-1$

    private static final String JNDI_PROPERTIES = "JMSSampler.jndiProperties"; // $NON-NLS-1$

    private static final String TIMEOUT = "JMSSampler.timeout"; // $NON-NLS-1$

    private static final String JMS_SELECTOR = "JMSSampler.jmsSelector"; // $NON-NLS-1$

    private static final String JMS_SELECTOR_DEFAULT = ""; // $NON-NLS-1$

    private static final String IS_ONE_WAY = "JMSSampler.isFireAndForget"; // $NON-NLS-1$

    private static final String JMS_PROPERTIES = "arguments"; // $NON-NLS-1$

    private static final String RECEIVE_QUEUE = "JMSSampler.ReceiveQueue"; // $NON-NLS-1$

    private static final String XML_DATA = "HTTPSamper.xml_data"; // $NON-NLS-1$

    private static final String SEND_QUEUE = "JMSSampler.SendQueue"; // $NON-NLS-1$

    private static final String QUEUE_CONNECTION_FACTORY_JNDI = "JMSSampler.queueconnectionfactory"; // $NON-NLS-1$

    private static final String IS_NON_PERSISTENT = "JMSSampler.isNonPersistent"; // $NON-NLS-1$

    private static final String USE_REQ_MSGID_AS_CORRELID = "JMSSampler.useReqMsgIdAsCorrelId"; // $NON-NLS-1$

    private static final String USE_RES_MSGID_AS_CORRELID = "JMSSampler.useResMsgIdAsCorrelId"; // $NON-NLS-1$

    private static final boolean USE_RES_MSGID_AS_CORRELID_DEFAULT = false; // Default to be applied

    //--

    // Should we use java.naming.security.[principal|credentials] to create the QueueConnection?
    private static final boolean USE_SECURITY_PROPERTIES =
        JMeterUtils.getPropDefault("JMSSampler.useSecurity.properties", true); // $NON-NLS-1$

    //
    // Member variables
    //
    /** Queue for receiving messages (if applicable). */
    private transient Queue receiveQueue;

    /** The session with the queueing system. */
    private transient QueueSession session;

    /** Connection to the queueing system. */
    private transient QueueConnection connection;

    /** The executor for (pseudo) synchronous communication. */
    private transient QueueExecutor executor;

    /** Producer of the messages. */
    private transient QueueSender producer;

    private transient Receiver receiverThread = null;

    private transient Throwable thrown = null;

    /**
     * {@inheritDoc}
     */
    @Override
    public SampleResult sample(Entry entry) {
        SampleResult res = new SampleResult();
        res.setSampleLabel(getName());
        res.setSamplerData(getContent());
        res.setSuccessful(false); // Assume failure
        res.setDataType(SampleResult.TEXT);
        res.sampleStart();

        try {
            TextMessage msg = createMessage();
            if (isOneway()) {
                producer.send(msg);
                res.setRequestHeaders(Utils.messageProperties(msg));
                res.setResponseOK();
                res.setResponseData("Oneway request has no response data", null);
            } else {
                if (!useTemporyQueue()) {
                    msg.setJMSReplyTo(receiveQueue);
                }

                Message replyMsg = executor.sendAndReceive(msg);
                res.setRequestHeaders(Utils.messageProperties(msg));
                if (replyMsg == null) {
                    res.setResponseMessage("No reply message received");
                } else {
                    if (replyMsg instanceof TextMessage) {
                        res.setResponseData(((TextMessage) replyMsg).getText(), null);
                    } else {
                        res.setResponseData(replyMsg.toString(), null);
                    }
                    res.setResponseHeaders(Utils.messageProperties(replyMsg));
                    res.setResponseOK();
                }
            }
        } catch (Exception e) {
            LOGGER.warn(e.getLocalizedMessage(), e);
            if (thrown != null){
                res.setResponseMessage(thrown.toString());
            } else {
                res.setResponseMessage(e.getLocalizedMessage());
            }
        }
        res.sampleEnd();
        return res;
    }

    private TextMessage createMessage() throws JMSException {
        if (session == null) {
            throw new IllegalStateException("Session may not be null while creating message");
        }
        TextMessage msg = session.createTextMessage();
        msg.setText(getContent());
        addJMSProperties(msg);
        return msg;
    }

    private void addJMSProperties(TextMessage msg) throws JMSException {
        Map<String, String> map = getArguments(JMSSampler.JMS_PROPERTIES).getArgumentsAsMap();
        Utils.addJMSProperties(msg, map);
    }

    public Arguments getJMSProperties() {
        return getArguments(JMSSampler.JMS_PROPERTIES);
    }

    public void setJMSProperties(Arguments args) {
        setProperty(new TestElementProperty(JMSSampler.JMS_PROPERTIES, args));
    }

    public Arguments getJNDIProperties() {
        return getArguments(JMSSampler.JNDI_PROPERTIES);
    }

    public void setJNDIProperties(Arguments args) {
        setProperty(new TestElementProperty(JMSSampler.JNDI_PROPERTIES, args));
    }

    public String getQueueConnectionFactory() {
        return getPropertyAsString(QUEUE_CONNECTION_FACTORY_JNDI);
    }

    public void setQueueConnectionFactory(String qcf) {
        setProperty(QUEUE_CONNECTION_FACTORY_JNDI, qcf);
    }

    public String getSendQueue() {
        return getPropertyAsString(SEND_QUEUE);
    }

    public void setSendQueue(String name) {
        setProperty(SEND_QUEUE, name);
    }

    public String getReceiveQueue() {
        return getPropertyAsString(RECEIVE_QUEUE);
    }

    public void setReceiveQueue(String name) {
        setProperty(RECEIVE_QUEUE, name);
    }

    public String getContent() {
        return getPropertyAsString(XML_DATA);
    }

    public void setContent(String content) {
        setProperty(XML_DATA, content);
    }

    public boolean isOneway() {
        return getPropertyAsBoolean(IS_ONE_WAY);
    }

    public boolean isNonPersistent() {
        return getPropertyAsBoolean(IS_NON_PERSISTENT);
    }

    /**
     * Which request field to use for correlation?
     *
     * @return true if correlation should use the request JMSMessageID rather than JMSCorrelationID
     */
    public boolean isUseReqMsgIdAsCorrelId() {
        return getPropertyAsBoolean(USE_REQ_MSGID_AS_CORRELID);
    }

    /**
     * Which response field to use for correlation?
     *
     * @return true if correlation should use the response JMSMessageID rather than JMSCorrelationID
     */
    public boolean isUseResMsgIdAsCorrelId() {
        return getPropertyAsBoolean(USE_RES_MSGID_AS_CORRELID, USE_RES_MSGID_AS_CORRELID_DEFAULT);
    }

    public String getInitialContextFactory() {
        return getPropertyAsString(JMSSampler.JNDI_INITIAL_CONTEXT_FACTORY);
    }

    public String getContextProvider() {
        return getPropertyAsString(JMSSampler.JNDI_CONTEXT_PROVIDER_URL);
    }

    public void setIsOneway(boolean isOneway) {
        setProperty(new BooleanProperty(IS_ONE_WAY, isOneway));
    }

    public void setNonPersistent(boolean value) {
        setProperty(new BooleanProperty(IS_NON_PERSISTENT, value));
    }

    public void setUseReqMsgIdAsCorrelId(boolean value) {
        setProperty(new BooleanProperty(USE_REQ_MSGID_AS_CORRELID, value));
    }

    public void setUseResMsgIdAsCorrelId(boolean value) {
        setProperty(USE_RES_MSGID_AS_CORRELID, value, USE_RES_MSGID_AS_CORRELID_DEFAULT);
    }

    @Override
    public String toString() {
        return getQueueConnectionFactory() + ", queue: " + getSendQueue();
    }

    @Override
    public void threadStarted() {
        logThreadStart();

        Context context = null;
        thrown = null;
        try {
            context = getInitialContext();
            Object obj = context.lookup(getQueueConnectionFactory());
            if (!(obj instanceof QueueConnectionFactory)) {
                String msg = "QueueConnectionFactory expected, but got "
                    + (obj != null ? obj.getClass().getName() : "null");
                LOGGER.fatalError(msg);
                throw new IllegalStateException(msg);
            }
            QueueConnectionFactory factory = (QueueConnectionFactory) obj;
            Queue sendQueue = (Queue) context.lookup(getSendQueue());

            if (!useTemporyQueue()) {
                receiveQueue = (Queue) context.lookup(getReceiveQueue());
                receiverThread = Receiver.createReceiver(factory, receiveQueue, getPrincipal(context), getCredentials(context)
                        , isUseResMsgIdAsCorrelId(), getJMSSelector());
            }

            String principal = null;
            String credentials = null;
            if (USE_SECURITY_PROPERTIES){
                principal = getPrincipal(context);
                credentials = getCredentials(context);
            }
            if (principal != null && credentials != null) {
                connection = factory.createQueueConnection(principal, credentials);
            } else {
                connection = factory.createQueueConnection();
            }

            session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("Session created");
            }

            if (getPropertyAsBoolean(IS_ONE_WAY)) {
                producer = session.createSender(sendQueue);
                if (isNonPersistent()) {
                    producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
                }
            } else {

                if (useTemporyQueue()) {
                    executor = new TemporaryQueueExecutor(session, sendQueue);
                } else {
                    producer = session.createSender(sendQueue);
                    if (isNonPersistent()) {
                        producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
                    }
                    executor = new FixedQueueExecutor(producer, getTimeoutAsInt(), isUseReqMsgIdAsCorrelId());
                }
            }
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("Starting connection");
            }

            connection.start();

            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("Connection started");
            }
        } catch (Exception e) {
            thrown = e;
            LOGGER.error(e.getLocalizedMessage(), e);
        } catch (NoClassDefFoundError e) {
            thrown = e;
            LOGGER.error(e.getLocalizedMessage(), e);
        } finally {
            if (context != null) {
                try {
                    context.close();
                } catch (NamingException ignored) {
                    // ignore
                }
            }
        }
    }

    private Context getInitialContext() throws NamingException {
        Hashtable<String, String> table = new Hashtable<String, String>();

        if (getInitialContextFactory() != null && getInitialContextFactory().trim().length() > 0) {
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("Using InitialContext [" + getInitialContextFactory() + "]");
            }
            table.put(Context.INITIAL_CONTEXT_FACTORY, getInitialContextFactory());
        }
        if (getContextProvider() != null && getContextProvider().trim().length() > 0) {
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("Using Provider [" + getContextProvider() + "]");
            }
            table.put(Context.PROVIDER_URL, getContextProvider());
        }
        Map<String, String> map = getArguments(JMSSampler.JNDI_PROPERTIES).getArgumentsAsMap();
        if (LOGGER.isDebugEnabled()) {
            if (map.isEmpty()) {
                LOGGER.debug("Empty JNDI properties");
            } else {
                LOGGER.debug("Number of JNDI properties: " + map.size());
            }
        }
        for (Map.Entry<String, String> me : map.entrySet()) {
            table.put(me.getKey(), me.getValue());
        }

        Context context = new InitialContext(table);
        if (LOGGER.isDebugEnabled()) {
            printEnvironment(context);
        }
        return context;
    }

    private void printEnvironment(Context context) throws NamingException {
        Hashtable<?,?> env = context.getEnvironment();
        LOGGER.debug("Initial Context Properties");
        @SuppressWarnings("unchecked")
        Enumeration<String> keys = (Enumeration<String>) env.keys();
        while (keys.hasMoreElements()) {
            String key = keys.nextElement();
            LOGGER.debug(key + "=" + env.get(key));
        }
    }

    private void logThreadStart() {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Thread started " + new Date());
            LOGGER.debug("JMSSampler: [" + Thread.currentThread().getName() + "], hashCode=[" + hashCode() + "]");
            LOGGER.debug("QCF: [" + getQueueConnectionFactory() + "], sendQueue=[" + getSendQueue() + "]");
            LOGGER.debug("Timeout             = " + getTimeout() + "]");
            LOGGER.debug("Use temporary queue =" + useTemporyQueue() + "]");
            LOGGER.debug("Reply queue         =" + getReceiveQueue() + "]");
        }
    }

    private int getTimeoutAsInt() {
        if (getPropertyAsInt(TIMEOUT) < 1) {
            return DEFAULT_TIMEOUT;
        }
        return getPropertyAsInt(TIMEOUT);
    }

    public String getTimeout() {
        return getPropertyAsString(TIMEOUT, DEFAULT_TIMEOUT_STRING);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void threadFinished() {
        LOGGER.debug("Thread ended " + new Date());

        Utils.close(session, LOGGER);
        Utils.close(connection, LOGGER);
        if (receiverThread != null) {
            receiverThread.deactivate();
        }
    }

    private boolean useTemporyQueue() {
        String recvQueue = getReceiveQueue();
        return recvQueue == null || recvQueue.trim().length() == 0;
    }

    public void setArguments(Arguments args) {
        setProperty(new TestElementProperty(JMSSampler.JMS_PROPERTIES, args));
    }

    public Arguments getArguments(String name) {
        return (Arguments) getProperty(name).getObjectValue();
    }

    public void setTimeout(String s) {
        setProperty(JMSSampler.TIMEOUT, s);
    }

    /**
     * @return String JMS Selector
     */
    public String getJMSSelector() {
        return getPropertyAsString(JMSSampler.JMS_SELECTOR, JMS_SELECTOR_DEFAULT);
    }

    /**
     * @param selector String selector
     */
    public void setJMSSelector(String selector) {
        setProperty(JMSSampler.JMS_SELECTOR, selector, JMS_SELECTOR_DEFAULT);
    }

    /**
     * @param string
     */
    public void setInitialContextFactory(String string) {
        setProperty(JNDI_INITIAL_CONTEXT_FACTORY, string);

    }

    /**
     * @param string
     */
    public void setContextProvider(String string) {
        setProperty(JNDI_CONTEXT_PROVIDER_URL, string);

    }

    /**
     * get the principal from the context property java.naming.security.principal
     *
     * @param context
     * @return the principal
     * @throws NamingException
     */
    private String getPrincipal(Context context) throws NamingException{
            Hashtable<?,?> env = context.getEnvironment();
            return (String) env.get("java.naming.security.principal"); // $NON-NLS-1$
    }

    /**
     * get the credentials from the context property java.naming.security.credentials
     *
     * @param context
     * @return the credentials
     * @throws NamingException
     */
    private String getCredentials(Context context) throws NamingException{
            Hashtable<?,?> env = context.getEnvironment();
            return (String) env.get("java.naming.security.credentials"); // $NON-NLS-1$
    }
}


text:
package com.amazonaws.services.lexmodelsv2.model.transform;

import javax.annotation.Generated;

import com.amazonaws.SdkClientException;
import com.amazonaws.services.lexmodelsv2.model.*;

import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;

/**
 * AssociatedTranscriptMarshaller
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class AssociatedTranscriptMarshaller {

    private static final MarshallingInfo<String> TRANSCRIPT_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("transcript").build();

    private static final AssociatedTranscriptMarshaller instance = new AssociatedTranscriptMarshaller();

    public static AssociatedTranscriptMarshaller getInstance() {
        return instance;
    }

    /**
     * Marshall the given parameter object.
     */
    public void marshall(AssociatedTranscript associatedTranscript, ProtocolMarshaller protocolMarshaller) {

        if (associatedTranscript == null) {
            throw new SdkClientException("Invalid argument passed to marshall(...)");
        }

        try {
            protocolMarshaller.marshall(associatedTranscript.getTranscript(), TRANSCRIPT_BINDING);
        } catch (Exception e) {
            throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
        }
    }

}


text:
using MyStaging.Core;
using MyStaging.Metadata;
using Npgsql;
using Pgsql.Model;
using System;
using System.Text.Json;

namespace Pgsql
{
    public class PgsqlDbContext : DbContext
    {
        public PgsqlDbContext(StagingOptions options) : base(options, ProviderType.PostgreSQL)
        {
        }

        static PgsqlDbContext()
        {
            Type[] jsonTypes = { typeof(JsonElement) };
            NpgsqlNameTranslator translator = new();
            //var dataSourceBuilder = new NpgsqlDataSourceBuilder("Host=localhost;Username=test;Password=test");
            //dataSourceBuilder.MapEnum<et_data_state>("public.et_data_state");
            //dataSourceBuilder.UseNodaTime();
            //await using var dataSource = dataSourceBuilder.Build();
            NpgsqlConnection.GlobalTypeMapper.UseJsonNet(jsonTypes);
            NpgsqlConnection.GlobalTypeMapper.MapEnum<et_data_state>("public.et_data_state", translator);
            NpgsqlConnection.GlobalTypeMapper.MapEnum<et_role>("public.et_role", translator);
        }

        public DbSet<User> User { get; set; }
        public DbSet<Post> Post { get; set; }
        public DbSet<Article> Article { get; set; }
        public DbSet<Topic> Topic { get; set; }
        public DbSet<Udt3> Udt3 { get; set; }
    }
    public partial class NpgsqlNameTranslator : INpgsqlNameTranslator
    {
        public string TranslateMemberName(string clrName) => clrName;
        public string TranslateTypeName(string clrTypeName) => clrTypeName;
    }
}


text:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.CodeAnalysis.CSharp;
using VsExtension.Model;
using System.Linq;
using Microsoft.CodeAnalysis;
using InliningAnalyzer;

namespace Tests.Model
{
    [TestClass]
    public class TargetScopeResolverTest
    {
        [TestMethod]
        public void TestGetSymbolByLocation_Methods()
        {
            string source =
@"namespace Test
{
    public class TestClass
    {
        public bool Method1(int arg)
        {
            return true;
        }

        private int _member;
    }
}
";
            var model = RoslynCompiler.GetSemanticModel(source);

            var methodSymbol = model.SyntaxTree.GetRoot().DescendantNodes().Select(n => model.GetDeclaredSymbol(n)).First(s => s != null && s.Kind == SymbolKind.Method);

            Assert.AreNotEqual(methodSymbol, TargetScopeResolver.GetSymbolByLocation(model, model.SyntaxTree, 4, 0));
            Assert.AreEqual(methodSymbol, TargetScopeResolver.GetSymbolByLocation(model, model.SyntaxTree, 5, 0));
            Assert.AreEqual(methodSymbol, TargetScopeResolver.GetSymbolByLocation(model, model.SyntaxTree, 5, 25));
            Assert.AreEqual(methodSymbol, TargetScopeResolver.GetSymbolByLocation(model, model.SyntaxTree, 5, 37));
            Assert.AreEqual(methodSymbol, TargetScopeResolver.GetSymbolByLocation(model, model.SyntaxTree, 7, 0));
            Assert.AreEqual(methodSymbol, TargetScopeResolver.GetSymbolByLocation(model, model.SyntaxTree, 8, 0));
            Assert.AreNotEqual(methodSymbol, TargetScopeResolver.GetSymbolByLocation(model, model.SyntaxTree, 9, 0));

            var classSymbol = model.SyntaxTree.GetRoot().DescendantNodes().Select(n => model.GetDeclaredSymbol(n)).First(s => s != null && s.Kind == SymbolKind.NamedType);
            Assert.AreEqual(classSymbol, TargetScopeResolver.GetSymbolByLocation(model, model.SyntaxTree, 9, 0));
            Assert.AreEqual(classSymbol, TargetScopeResolver.GetSymbolByLocation(model, model.SyntaxTree, 10, 10));
        }

        [TestMethod]
        public void TestGetTargetScope()
        {
            string source =
@"using System.Collections.Generic; using System;
namespace Test
{
    public class TestClass : IDisposable
    {
        public void Method1() {} // line 5
        public void Method2(int arg) {}
        public void Method2(string arg) {}
        public void Method2(int arg1, string arg2) {}
        public void Method3(TestClass arg) {}
        public void Method4(int[] arg) {}
        public void Method5(List<string> arg) {}
        public void Method6(Dictionary<System.DateTime, bool> arg) {}

        public TestClass() {}
        public TestClass(int arg) {}

        public string Name
        {
            get { return null; }
            set { }
        }

        public void Dispose() {}
        public virtual void BaseTest() {}
    }

    public class TestClass2 : TestClass
    {
        public override void BaseTest() {}
    }

    public class TestClass3 : IDisposable, IIndexer
    {
        void IDisposable.Dispose() {}
        string this[string name] => name;
        int IIndexer.this[int i] => i;
    }

    public interface IIndexer
    {
        int this[int i] { get; }
    }

    public class TestClass4
    {
    }

    public struct TestStruct
    {
    }
}
";
            var model = RoslynCompiler.GetSemanticModel(source);

            Assert.AreEqual("Test.TestClass|Method1()", TargetScopeResolver.GetTargetScope(model, model.SyntaxTree, 6, 0).Name);
            Assert.AreEqual("Test.TestClass|Method2(System.Int32)", TargetScopeResolver.GetTargetScope(model, model.SyntaxTree, 7, 0).Name);
            Assert.AreEqual("Test.TestClass|Method2(System.String)", TargetScopeResolver.GetTargetScope(model, model.SyntaxTree, 8, 0).Name);
            Assert.AreEqual("Test.TestClass|Method2(System.Int32,System.String)", TargetScopeResolver.GetTargetScope(model, model.SyntaxTree, 9, 0).Name);
            Assert.AreEqual("Test.TestClass|Method3(Test.TestClass)", TargetScopeResolver.GetTargetScope(model, model.SyntaxTree, 10, 0).Name);
            Assert.AreEqual("Test.TestClass|Method4(System.Int32[])", TargetScopeResolver.GetTargetScope(model, model.SyntaxTree, 11, 0).Name);
            Assert.AreEqual("Test.TestClass|Method5(System.Collections.Generic.List`1[System.String])", TargetScopeResolver.GetTargetScope(model, model.SyntaxTree, 12, 0).Name);
            Assert.AreEqual("Test.TestClass|Method6(System.Collections.Generic.Dictionary`2[System.DateTime;System.Boolean])", TargetScopeResolver.GetTargetScope(model, model.SyntaxTree, 13, 0).Name);

            Assert.AreEqual("Test.TestClass|ctor()", TargetScopeResolver.GetTargetScope(model, model.SyntaxTree, 15, 0).Name);
            Assert.AreEqual("Test.TestClass|ctor(System.Int32)", TargetScopeResolver.GetTargetScope(model, model.SyntaxTree, 16, 0).Name);

            Assert.AreEqual("Test.TestClass|get_Name()", TargetScopeResolver.GetTargetScope(model, model.SyntaxTree, 20, 0).Name);
            Assert.AreEqual("Test.TestClass|set_Name(System.String)", TargetScopeResolver.GetTargetScope(model, model.SyntaxTree, 21, 0).Name);

            Assert.AreEqual("Test.TestClass|Dispose()", TargetScopeResolver.GetTargetScope(model, model.SyntaxTree, 24, 0).Name);
            Assert.AreEqual("Test.TestClass|BaseTest()", TargetScopeResolver.GetTargetScope(model, model.SyntaxTree, 25, 0).Name);
            Assert.AreEqual("Test.TestClass2|BaseTest()", TargetScopeResolver.GetTargetScope(model, model.SyntaxTree, 30, 0).Name);
            Assert.AreEqual("Test.TestClass3|System.IDisposable.Dispose()", TargetScopeResolver.GetTargetScope(model, model.SyntaxTree, 35, 0).Name);

            Assert.AreEqual("Test.TestClass3|get_Item(System.String)", TargetScopeResolver.GetTargetScope(model, model.SyntaxTree, 36, 0).Name);
            Assert.AreEqual("Test.TestClass3|Test.IIndexer.get_Item(System.Int32)", TargetScopeResolver.GetTargetScope(model, model.SyntaxTree, 37, 0).Name);

            Assert.AreEqual("Test.TestClass4", TargetScopeResolver.GetTargetScope(model, model.SyntaxTree, 46, 0).Name);
            Assert.AreEqual(ScopeType.Class, TargetScopeResolver.GetTargetScope(model, model.SyntaxTree, 46, 0).ScopeType);

            Assert.AreEqual("Test.TestStruct", TargetScopeResolver.GetTargetScope(model, model.SyntaxTree, 50, 0).Name);

        }
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
The Genus Septobasidium (Chapel Hill) 240 (1938)

#### Original name
Septobasidium punctatum Couch

### Remarks
null


text:
(function () {
    addMetadataExtender('type');
    addMetadataExtender('displayText');
    addMetadataExtender('listSource');
    addMetadataExtender('displayProperty');

    function addMetadataExtender(name) {
        ko.extenders[name] = function(target, value) {
            target.metadata = target.metadata || {};
            target.metadata[name] = value;
            return target;
        };
    }
})();


text:
package com.mpush.core.handler;

import com.mpush.api.connection.Connection;
import com.mpush.api.protocol.Packet;
import com.mpush.common.ErrorCode;
import com.mpush.common.handler.BaseMessageHandler;
import com.mpush.common.message.ErrorMessage;
import com.mpush.common.message.FastConnectMessage;
import com.mpush.common.message.FastConnectOkMessage;
import com.mpush.core.MPushServer;
import com.mpush.core.session.ReusableSession;
import com.mpush.core.session.ReusableSessionManager;
import com.mpush.tools.common.Profiler;
import com.mpush.tools.config.ConfigTools;
import com.mpush.tools.log.Logs;

import static com.mpush.common.ErrorCode.INVALID_DEVICE;
import static com.mpush.common.ErrorCode.SESSION_EXPIRED;

/**
 * Created by ohun on 2015/12/25.
 *
 * @author ohun@live.cn
 */
public final class FastConnectHandler extends BaseMessageHandler<FastConnectMessage> {
    private final ReusableSessionManager reusableSessionManager;

    public FastConnectHandler(MPushServer mPushServer) {
        this.reusableSessionManager = mPushServer.getReusableSessionManager();
    }

    @Override
    public FastConnectMessage decode(Packet packet, Connection connection) {
        return new FastConnectMessage(packet, connection);
    }

    @Override
    public void handle(FastConnectMessage message) {
        //从缓存中心查询session
        Profiler.enter("time cost on [query session]");
        ReusableSession session = reusableSessionManager.querySession(message.sessionId);
        Profiler.release();
        if (session == null) {
            //1.没查到说明session已经失效了
            ErrorMessage.from(message).setErrorCode(SESSION_EXPIRED).send();
            Logs.CONN.warn("fast connect failure, session is expired, sessionId={}, deviceId={}, conn={}"
                    , message.sessionId, message.deviceId, message.getConnection().getChannel());
        } else if (!session.context.deviceId.equals(message.deviceId)) {
            //2.非法的设备, 当前设备不是上次生成session时的设备
            ErrorMessage.from(message).setErrorCode(INVALID_DEVICE).send();
            Logs.CONN.warn("fast connect failure, not the same device, deviceId={}, session={}, conn={}"
                    , message.deviceId, session.context, message.getConnection().getChannel());
        } else {
            //3.校验成功,重新计算心跳,完成快速重连
            int heartbeat = ConfigTools.getHeartbeat(message.minHeartbeat, message.maxHeartbeat);
            session.context.setHeartbeat(heartbeat);

            Profiler.enter("time cost on [send FastConnectOkMessage]");
            FastConnectOkMessage
                    .from(message)
                    .setHeartbeat(heartbeat)
                    .sendRaw(f -> {
                        if (f.isSuccess()) {
                            //4. 恢复缓存的会话信息(包含会话密钥等)
                            message.getConnection().setSessionContext(session.context);
                            Logs.CONN.info("fast connect success, session={}, conn={}", session.context, message.getConnection().getChannel());
                        } else {
                            Logs.CONN.info("fast connect failure, session={}, conn={}", session.context, message.getConnection().getChannel());
                        }
                    });

            Profiler.release();
        }
    }
}


text:
from __future__ import absolute_import
import os
import io
from io import BufferedReader
from io import BufferedWriter
from io import BytesIO
from io import DEFAULT_BUFFER_SIZE
from io import RawIOBase
from io import UnsupportedOperation

from gevent._fileobjectcommon import cancel_wait_ex
from gevent._fileobjectcommon import FileObjectBase
from gevent.hub import get_hub
from gevent.os import _read
from gevent.os import _write
from gevent.os import ignored_errors
from gevent.os import make_nonblocking

class GreenFileDescriptorIO(RawIOBase):

    # Note that RawIOBase has a __del__ method that calls
    # self.close(). (In C implementations like CPython, this is
    # the type's tp_dealloc slot; prior to Python 3, the object doesn't
    # appear to have a __del__ method, even though it functionally does)

    _read_event = None
    _write_event = None

    def __init__(self, fileno, mode='r', closefd=True):
        RawIOBase.__init__(self) # Python 2: pylint:disable=no-member,non-parent-init-called
        self._closed = False
        self._closefd = closefd
        self._fileno = fileno
        make_nonblocking(fileno)
        self._readable = 'r' in mode
        self._writable = 'w' in mode
        self.hub = get_hub()

        io_watcher = self.hub.loop.io
        if self._readable:
            self._read_event = io_watcher(fileno, 1)

        if self._writable:
            self._write_event = io_watcher(fileno, 2)

        self._seekable = None

    def readable(self):
        return self._readable

    def writable(self):
        return self._writable

    def seekable(self):
        if self._seekable is None:
            try:
                os.lseek(self._fileno, 0, os.SEEK_CUR)
            except OSError:
                self._seekable = False
            else:
                self._seekable = True
        return self._seekable

    def fileno(self):
        return self._fileno

    @property
    def closed(self):
        return self._closed

    def close(self):
        if self._closed:
            return
        self.flush()
        self._closed = True
        if self._readable:
            self.hub.cancel_wait(self._read_event, cancel_wait_ex)
        if self._writable:
            self.hub.cancel_wait(self._write_event, cancel_wait_ex)
        fileno = self._fileno
        if self._closefd:
            self._fileno = None
            os.close(fileno)

    # RawIOBase provides a 'read' method that will call readall() if
    # the `size` was missing or -1 and otherwise call readinto(). We
    # want to take advantage of this to avoid single byte reads when
    # possible. This is highlighted by a bug in BufferedIOReader that
    # calls read() in a loop when its readall() method is invoked;
    # this was fixed in Python 3.3. See
    # https://github.com/gevent/gevent/issues/675)
    def __read(self, n):
        if not self._readable:
            raise UnsupportedOperation('read')
        while True:
            try:
                return _read(self._fileno, n)
            except (IOError, OSError) as ex:
                if ex.args[0] not in ignored_errors:
                    raise
            self.hub.wait(self._read_event)

    def readall(self):
        ret = BytesIO()
        while True:
            data = self.__read(DEFAULT_BUFFER_SIZE)
            if not data:
                break
            ret.write(data)
        return ret.getvalue()

    def readinto(self, b):
        data = self.__read(len(b))
        n = len(data)
        try:
            b[:n] = data
        except TypeError as err:
            import array
            if not isinstance(b, array.array):
                raise err
            b[:n] = array.array(b'b', data)
        return n

    def write(self, b):
        if not self._writable:
            raise UnsupportedOperation('write')
        while True:
            try:
                return _write(self._fileno, b)
            except (IOError, OSError) as ex:
                if ex.args[0] not in ignored_errors:
                    raise
            self.hub.wait(self._write_event)

    def seek(self, offset, whence=0):
        return os.lseek(self._fileno, offset, whence)

class FlushingBufferedWriter(BufferedWriter):

    def write(self, b):
        ret = BufferedWriter.write(self, b)
        self.flush()
        return ret

class FileObjectPosix(FileObjectBase):
    """
    A file-like object that operates on non-blocking files but
    provides a synchronous, cooperative interface.

    .. caution::
         This object is only effective wrapping files that can be used meaningfully
         with :func:`select.select` such as sockets and pipes.

         In general, on most platforms, operations on regular files
         (e.g., ``open('a_file.txt')``) are considered non-blocking
         already, even though they can take some time to complete as
         data is copied to the kernel and flushed to disk: this time
         is relatively bounded compared to sockets or pipes, though.
         A :func:`~os.read` or :func:`~os.write` call on such a file
         will still effectively block for some small period of time.
         Therefore, wrapping this class around a regular file is
         unlikely to make IO gevent-friendly: reading or writing large
         amounts of data could still block the event loop.

         If you'll be working with regular files and doing IO in large
         chunks, you may consider using
         :class:`~gevent.fileobject.FileObjectThread` or
         :func:`~gevent.os.tp_read` and :func:`~gevent.os.tp_write` to bypass this
         concern.

    .. note::
         Random read/write (e.g., ``mode='rwb'``) is not supported.
         For that, use :class:`io.BufferedRWPair` around two instance of this
         class.

    .. tip::
         Although this object provides a :meth:`fileno` method and so
         can itself be passed to :func:`fcntl.fcntl`, setting the
         :data:`os.O_NONBLOCK` flag will have no effect (reads will
         still block the greenlet, although other greenlets can run).
         However, removing that flag *will cause this object to no
         longer be cooperative* (other greenlets will no longer run).

         You can use the internal ``fileio`` attribute of this object
         (a :class:`io.RawIOBase`) to perform non-blocking byte reads.
         Note, however, that once you begin directly using this
         attribute, the results from using methods of *this* object
         are undefined, especially in text mode. (See :issue:`222`.)

    .. versionchanged:: 1.1
       Now uses the :mod:`io` package internally. Under Python 2, previously
       used the undocumented class :class:`socket._fileobject`. This provides
       better file-like semantics (and portability to Python 3).
    .. versionchanged:: 1.2a1
       Document the ``fileio`` attribute for non-blocking reads.
    """

    #: platform specific default for the *bufsize* parameter
    default_bufsize = io.DEFAULT_BUFFER_SIZE

    def __init__(self, fobj, mode='rb', bufsize=-1, close=True):
        """
        :param fobj: Either an integer fileno, or an object supporting the
            usual :meth:`socket.fileno` method. The file *will* be
            put in non-blocking mode using :func:`gevent.os.make_nonblocking`.
        :keyword str mode: The manner of access to the file, one of "rb", "rU" or "wb"
            (where the "b" or "U" can be omitted).
            If "U" is part of the mode, IO will be done on text, otherwise bytes.
        :keyword int bufsize: If given, the size of the buffer to use. The default
            value means to use a platform-specific default
            Other values are interpreted as for the :mod:`io` package.
            Buffering is ignored in text mode.

        .. versionchanged:: 1.2a1

           A bufsize of 0 in write mode is no longer forced to be 1.
           Instead, the underlying buffer is flushed after every write
           operation to simulate a bufsize of 0. In gevent 1.0, a
           bufsize of 0 was flushed when a newline was written, while
           in gevent 1.1 it was flushed when more than one byte was
           written. Note that this may have performance impacts.
        """

        if isinstance(fobj, int):
            fileno = fobj
            fobj = None
        else:
            fileno = fobj.fileno()
        if not isinstance(fileno, int):
            raise TypeError('fileno must be int: %r' % fileno)

        orig_mode = mode
        mode = (mode or 'rb').replace('b', '')
        if 'U' in mode:
            self._translate = True
            mode = mode.replace('U', '')
        else:
            self._translate = False

        if len(mode) != 1 and mode not in 'rw': # pragma: no cover
            # Python 3 builtin `open` raises a ValueError for invalid modes;
            # Python 2 ignores it. In the past, we raised an AssertionError, if __debug__ was
            # enabled (which it usually was). Match Python 3 because it makes more sense
            # and because __debug__ may not be enabled.
            # NOTE: This is preventing a mode like 'rwb' for binary random access;
            # that code was never tested and was explicitly marked as "not used"
            raise ValueError('mode can only be [rb, rU, wb], not %r' % (orig_mode,))

        self._fobj = fobj

        # This attribute is documented as available for non-blocking reads.
        self.fileio = GreenFileDescriptorIO(fileno, mode, closefd=close)

        self._orig_bufsize = bufsize
        if bufsize < 0 or bufsize == 1:
            bufsize = self.default_bufsize
        elif bufsize == 0:
            bufsize = 1

        if mode == 'r':
            IOFamily = BufferedReader
        else:
            assert mode == 'w'
            IOFamily = BufferedWriter
            if self._orig_bufsize == 0:
                # We could also simply pass self.fileio as *io*, but this way
                # we at least consistently expose a BufferedWriter in our *io*
                # attribute.
                IOFamily = FlushingBufferedWriter

        super(FileObjectPosix, self).__init__(IOFamily(self.fileio, bufsize), close)

    def _do_close(self, fobj, closefd):
        try:
            fobj.close()
            # self.fileio already knows whether or not to close the
            # file descriptor
            self.fileio.close()
        finally:
            self._fobj = None
            self.fileio = None

    def __iter__(self):
        return self._io


text:
from sqlalchemy import ForeignKey
from sqlalchemy.schema import Column
from sqlalchemy.schema import MetaData
from sqlalchemy.schema import UniqueConstraint

from trove.db.sqlalchemy.migrate_repo.schema import Boolean
from trove.db.sqlalchemy.migrate_repo.schema import create_tables
from trove.db.sqlalchemy.migrate_repo.schema import DateTime
from trove.db.sqlalchemy.migrate_repo.schema import String
from trove.db.sqlalchemy.migrate_repo.schema import Table

meta = MetaData()

datastore_version_metadata = Table(
    'datastore_version_metadata',
    meta,
    Column('id', String(36), primary_key=True, nullable=False),
    Column(
        'datastore_version_id',
        String(36),
        ForeignKey('datastore_versions.id', ondelete='CASCADE'),
    ),
    Column('key', String(128), nullable=False),
    Column('value', String(128)),
    Column('created', DateTime(), nullable=False),
    Column('deleted', Boolean(), nullable=False, default=False),
    Column('deleted_at', DateTime()),
    Column('updated_at', DateTime()),
    UniqueConstraint(
        'datastore_version_id', 'key', 'value',
        name='UQ_datastore_version_metadata_datastore_version_id_key_value')
)

def upgrade(migrate_engine):
    meta.bind = migrate_engine
    # Load the datastore_versions table into the session.
    # creates datastore_version_metadata table
    Table('datastore_versions', meta, autoload=True)
    create_tables([datastore_version_metadata])


text:
import MSI from './MSI.js';
import {mod10, mod11} from './checksums.js';

class MSI1110 extends MSI{
	constructor(data, options){
		data += mod11(data);
		data += mod10(data);
		super(data, options);
	}
}

export default MSI1110;


text:
import "sumo/js/protocol";

(function() {
  'use strict';
  var modalLink = document.querySelectorAll('[data-sumo-modal]');
  if (modalLink) {
    modalLink.forEach(function(e) {
      var dialogLink = e.dataset.sumoModal;
      var content = document.getElementById(dialogLink);
      function openThisDialog(e){
        Mzp.Modal.createModal(e.target, content, {
          closeText: 'Close modal',
          content: document.getElementById(e.target.dataset.sumoModal),
          onCreate: function() {
            // console.log('Modal opened');
          },
          onDestroy: function() {
            // console.log('Modal closed');
          }
        });
        e.preventDefault();
      };
      e.addEventListener("click", openThisDialog);
    });
  }

  var closeButtons = document.querySelectorAll('[data-sumo-modal-close]');
  if (closeButtons) {
    closeButtons.forEach((button) => {
      button.addEventListener("click", () => Mzp.Modal.closeModal());
    });
  }
})();


text:
namespace boost { namespace gil {

#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
#pragma warning(push)
#pragma warning(disable:4512) //assignment operator could not be generated
#endif

namespace detail {

template < int N > struct get_targa_view_type {};
template <> struct get_targa_view_type< 3 > { using type = bgr8_view_t; };
template <> struct get_targa_view_type< 4 > { using type = bgra8_view_t; };

struct targa_write_is_supported
{
    template< typename View >
    struct apply
        : public is_write_supported< typename get_pixel_type< View >::type
                                   , targa_tag
                                   >
    {};
};

} // detail

///
/// TARGA Writer
///
template< typename Device >
class writer< Device
            , targa_tag
            >
    : public writer_backend< Device
                           , targa_tag
                           >
{
private:
    using backend_t = writer_backend<Device, targa_tag>;

public:

    writer( const Device&                        io_dev
          , const image_write_info< targa_tag >& info
          )
    : backend_t( io_dev
               , info
               )
    {}

    template<typename View>
    void apply( const View& view )
    {
        write( view );
    }

private:

    template< typename View >
    void write( const View& view )
    {
        uint8_t bit_depth = static_cast<uint8_t>( num_channels<View>::value * 8 );

        // write the TGA header
        this->_io_dev.write_uint8( 0 ); // offset
        this->_io_dev.write_uint8( targa_color_map_type::_rgb );
        this->_io_dev.write_uint8( targa_image_type::_rgb );
        this->_io_dev.write_uint16( 0 ); // color map start
        this->_io_dev.write_uint16( 0 ); // color map length
        this->_io_dev.write_uint8( 0 ); // color map depth
        this->_io_dev.write_uint16( 0 ); // x origin
        this->_io_dev.write_uint16( 0 ); // y origin
        this->_io_dev.write_uint16( static_cast<uint16_t>( view.width() ) ); // width in pixels
        this->_io_dev.write_uint16( static_cast<uint16_t>( view.height() ) ); // height in pixels
        this->_io_dev.write_uint8( bit_depth );

        if( 32 == bit_depth )
        {
            this->_io_dev.write_uint8( 8 ); // 8-bit alpha channel descriptor
        }
        else
        {
            this->_io_dev.write_uint8( 0 );
        }

        write_image< View
                   , typename detail::get_targa_view_type< num_channels< View >::value >::type
                   >( view );
    }

    template< typename View
            , typename TGA_View
            >
    void write_image( const View& view )
    {
        size_t row_size = view.width() * num_channels<View>::value;
        byte_vector_t buffer( row_size );
        std::fill( buffer.begin(), buffer.end(), 0 );

        TGA_View row = interleaved_view( view.width()
                                       , 1
                                       , reinterpret_cast<typename TGA_View::value_type*>( &buffer.front() )
                                       , row_size
                                       );

        for( typename View::y_coord_t y = view.height() - 1; y > -1; --y )
        {
            copy_pixels( subimage_view( view
                                      , 0
                                      , static_cast<int>( y )
                                      , static_cast<int>( view.width() )
                                      , 1
                                      )
                       , row
                       );

            this->_io_dev.write( &buffer.front(), row_size );
        }

    }
};

///
/// TARGA Dynamic Image Writer
///
template< typename Device >
class dynamic_image_writer< Device
                          , targa_tag
                          >
    : public writer< Device
                   , targa_tag
                   >
{
    using parent_t = writer<Device, targa_tag>;

public:

    dynamic_image_writer( const Device&                        io_dev
                        , const image_write_info< targa_tag >& info
                        )
    : parent_t( io_dev
              , info
              )
    {}

    template< typename ...Views >
    void apply( const any_image_view< Views... >& views )
    {
        detail::dynamic_io_fnobj< detail::targa_write_is_supported
                                , parent_t
                                > op( this );

        apply_operation( views, op );
    }
};

#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
#pragma warning(pop)
#endif

} // gil
} // boost

#endif


text:
package org.lxp.dailylog.model;

import java.util.Date;

public class UserBase {
    private Long id;

    private String username;

    private String password;

    private Date lastLoginTime;

    private Date createTime;

    public Long getId() {
        return id;
    }

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

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username == null ? null : username.trim();
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password == null ? null : password.trim();
    }

    public Date getLastLoginTime() {
        return lastLoginTime;
    }

    public void setLastLoginTime(Date lastLoginTime) {
        this.lastLoginTime = lastLoginTime;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", username=").append(username);
        sb.append(", password=").append(password);
        sb.append(", lastLoginTime=").append(lastLoginTime);
        sb.append(", createTime=").append(createTime);
        sb.append("]");
        return sb.toString();
    }
}


text:
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build darwin

package app

// Simple on-screen app debugging for OS X. Not an officially supported
// development target for apps, as screens with mice are very different
// than screens with touch panels.

/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa -framework OpenGL -framework QuartzCore
#import <Cocoa/Cocoa.h>
#import <OpenGL/gl.h>
#include <pthread.h>

void glGenVertexArrays(GLsizei n, GLuint* array);
void glBindVertexArray(GLuint array);

void runApp(void);
void lockContext(GLintptr);
void unlockContext(GLintptr);
double backingScaleFactor();
uint64 threadID();

*/
import "C"
import (
	"log"
	"runtime"
	"sync"

	"code.google.com/p/go.mobile/event"
	"code.google.com/p/go.mobile/geom"
	"code.google.com/p/go.mobile/gl"
)

var initThreadID uint64

func init() {
	// Lock the goroutine responsible for initialization to an OS thread.
	// This means the goroutine running main (and calling the run function
	// below) is locked to the OS thread that started the program. This is
	// necessary for the correct delivery of Cocoa events to the process.
	//
	// A discussion on this topic:
	// https://groups.google.com/forum/#!msg/golang-nuts/IiWZ2hUuLDA/SNKYYZBelsYJ
	runtime.LockOSThread()
	initThreadID = uint64(C.threadID())
}

func run(callbacks Callbacks) {
	if tid := uint64(C.threadID()); tid != initThreadID {
		log.Fatalf("app.Run called on thread %d, but app.init ran on %d", tid, initThreadID)
	}
	cb = callbacks
	C.runApp()
}

//export setGeom
func setGeom(pixelsPerPt float32, width, height int) {
	// Macs default to 72 DPI, so scales are equivalent.
	geom.PixelsPerPt = pixelsPerPt
	geom.Width = geom.Pt(float32(width) / pixelsPerPt)
	geom.Height = geom.Pt(float32(height) / pixelsPerPt)
}

func initGL() {
	// Using attribute arrays in OpenGL 3.3 requires the use of a VBA.
	// But VBAs don't exist in ES 2. So we bind a default one.
	var id C.GLuint
	C.glGenVertexArrays(1, &id)
	C.glBindVertexArray(id)
}

var cb Callbacks
var initGLOnce sync.Once

var events struct {
	sync.Mutex
	pending []event.Touch
}

func sendTouch(ty event.TouchType, x, y float32) {
	events.Lock()
	events.pending = append(events.pending, event.Touch{
		Type: ty,
		Loc: geom.Point{
			X: geom.Pt(x / geom.PixelsPerPt),
			Y: geom.Height - geom.Pt(y/geom.PixelsPerPt),
		},
	})
	events.Unlock()
}

//export eventMouseDown
func eventMouseDown(x, y float32) { sendTouch(event.TouchStart, x, y) }

//export eventMouseDragged
func eventMouseDragged(x, y float32) { sendTouch(event.TouchMove, x, y) }

//export eventMouseEnd
func eventMouseEnd(x, y float32) { sendTouch(event.TouchEnd, x, y) }

//export drawgl
func drawgl(ctx C.GLintptr) {
	// The call to lockContext loads the OpenGL context into
	// thread-local storage for use by the underlying GL calls
	// done in the user's Draw function. We need to stay on
	// the same thread throughout Draw, so we LockOSThread.
	runtime.LockOSThread()
	C.lockContext(ctx)

	initGLOnce.Do(initGL)

	events.Lock()
	pending := events.pending
	events.pending = nil
	events.Unlock()
	for _, e := range pending {
		if cb.Touch != nil {
			cb.Touch(e)
		}
	}

	// TODO: is the library or the app responsible for clearing the buffers?
	gl.ClearColor(0, 0, 0, 1)
	gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
	if cb.Draw != nil {
		cb.Draw()
	}

	C.unlockContext(ctx)

	// This may unlock the original main thread, but that's OK,
	// because by the time it does the thread has already entered
	// C.runApp, which won't give the thread up.
	runtime.UnlockOSThread()
}


text:
package com.xiaomi.infra.galaxy.sds.shared;

import java.io.UnsupportedEncodingException;
import java.security.GeneralSecurityException;
import java.util.List;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;

public class SignatureUtil {
  private static final String UTF_8 = "UTF-8";

  public static enum MacAlgorithm {
    HmacMD5, HmacSHA1, HmacSHA256
  }

  private static String multiply(String delim, List<String> parts) {
    assert parts != null;
    if (parts != null) {
      StringBuilder sb = new StringBuilder();
      sb.append(parts.remove(0));
      for (String part : parts) {
        sb.append(delim).append(part);
      }
      return sb.toString();
    }
    return "";
  }

  public static byte[] sign(MacAlgorithm algorithm, String secretKey, List<String> parts) {
    return sign(algorithm, secretKey, multiply("\n", parts));
  }

  public static byte[] sign(MacAlgorithm algorithm, String secretKey, String message) {
    try {
      return sign(algorithm, secretKey.getBytes(UTF_8), message.getBytes(UTF_8));
    } catch (UnsupportedEncodingException e) {
      throw new RuntimeException("Unsupported encoding: " + UTF_8, e);
    }
  }

  public static byte[] sign(MacAlgorithm algorithm, byte[] secretKey, byte[] data) {
    try {
      Mac mac = Mac.getInstance(algorithm.name());
      mac.init(new SecretKeySpec(secretKey, algorithm.name()));
      return mac.doFinal(data);
    } catch (GeneralSecurityException e) {
      throw new RuntimeException("MAC algorithm not found: " + algorithm, e);
    }
  }
}


text:
#include "testClasses.h"

#define SERIALISATION_PARENT_TEST( type )                                                                               \
    SERIALISATION_TEST( Object, Parent_Zebra, ClassWithParent< type >, type, GenerateZebraValue<type>(), GetRandom<type>() );

SERIALISATION_ALL_TYPES(SERIALISATION_PARENT_TEST);

#define SERIALISATION_PARENT_REORDERED_TEST( type )                                                                    \
    SERIALISATION_TEST2( Object, Parent_Zebra_Reordered, ClassWithParent< type >, ClassWithParentReordered< type >, type,  \
                         GenerateZebraValue<type>(), GetRandom<type>() );

SERIALISATION_ALL_TYPES(SERIALISATION_PARENT_REORDERED_TEST);

#define SERIALISATION_PARENT_REORDERED_REVERSE_TEST( type )                                                            \
    SERIALISATION_TEST2( Object, Parent_Zebra_ReorderedReverse, ClassWithParentReordered< type >, ClassWithParent< type >, \
                         type, GenerateZebraValue<type>(), GetRandom<type>() );

SERIALISATION_ALL_TYPES(SERIALISATION_PARENT_REORDERED_REVERSE_TEST);

SERIALISATION_TEST(Object, MultiParent, ClassWithMultipleParents< uint32_t >, uint32_t, GenerateZebraValue<uint32_t>(),
                   GetRandom<uint32_t>());
SERIALISATION_TEST(Object, MultiParent, ClassWithMultipleParents< uint64_t >, uint64_t, GenerateZebraValue<uint64_t>(),
                   GetRandom<uint64_t>());

#define SERIALISATION_PARENT_SKIPPING_TEST( type )                                              \
    SERIALISATION_TEST2( Skipping, Parent, SkippedParent< type >, SinglePrimitive< uint8_t >, type, \
                         MakeSeed<type>( 414141 ), 189 );

SERIALISATION_ALL_TYPES(SERIALISATION_PARENT_SKIPPING_TEST);

#define SERIALISATION_PARENT_NON_EXISTING_TEST( type )                                              \
    SERIALISATION_TEST2( NonExisting, Parent, SinglePrimitive< uint8_t >, SkippedParent< type >, type,  \
                         MakeSeed< type PP_COMMA() uint8_t >( 414141 ), 414141 );

SERIALISATION_ALL_TYPES(SERIALISATION_PARENT_NON_EXISTING_TEST);


text:
import tape from 'tape';
import {quantile} from '../src';

tape('quantile', (test) => {
  test.equal(quantile([], 0.5), 0);

  const evenPopulation = [1, 2, 3, 4, 5];
  test.equal(quantile(evenPopulation, 0.25), 2);
  test.equal(quantile(evenPopulation, 0.5), 3);
  test.equal(quantile(evenPopulation, 0.75), 4);
  test.equal(quantile(evenPopulation, 1), 5);

  const oddPopulation = [1, 2, 3, 4, 5, 6];
  test.equal(quantile(oddPopulation, 0.25), 2);
  test.equal(quantile(oddPopulation, 0.5), 7 / 2);
  test.equal(quantile(oddPopulation, 0.75), 5);
  test.equal(quantile(oddPopulation, 1), 6);
  test.end();
});


text:
from swgpy.object import *

def create(kernel):
	result = Tangible()

	result.template = "object/tangible/lair/stintaril/shared_lair_stintaril.iff"
	result.attribute_template_id = -1
	result.stfName("lair_n","stintaril")

	#### BEGIN MODIFICATIONS ####
	####  END MODIFICATIONS  ####

	return result


text:
from django.db import migrations, models

def set_defaults(apps, schema_editor):
    Puzzle = apps.get_model('huntserver', 'Puzzle')
    for puzzle in Puzzle.objects.all().iterator():
        if(puzzle.is_html_puzzle):
            puzzle.puzzle_page_type = 'LNK'
        else:
            puzzle.puzzle_page_type = 'PDF'
        puzzle.save()

def reverse_func(apps, schema_editor):
    pass  # code for reverting migration, if any

class Migration(migrations.Migration):

    dependencies = [
        ('huntserver', '0058_auto_20200507_2138'),
    ]

    operations = [
        migrations.AddField(
            model_name='puzzle',
            name='puzzle_page_type',
            field=models.CharField(choices=[('PDF', 'Puzzle page displays a PDF'), ('LNK', 'Puzzle page links a webpage'), ('WEB', 'Puzzle page displays a webpage')], null=True, help_text='The type of webpage for this puzzle.', max_length=3),
        ),
        migrations.RunPython(set_defaults, reverse_func),
        migrations.AlterField(
            model_name='puzzle',
            name='puzzle_page_type',
            field=models.CharField(choices=[('PDF', 'Puzzle page displays a PDF'), ('LNK', 'Puzzle page links a webpage'), ('WEB', 'Puzzle page displays a webpage')], default='WEB', help_text='The type of webpage for this puzzle.', max_length=3),
        ),
    ]


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- From: file:/E:/GITPROJECT/Android-PullToRefresh/PullToRefreshViewPager/build/intermediates/exploded-aar/Android-PullToRefresh/library/unspecified/res/values-iw/values-iw.xml -->
    <eat-comment/>
    <string name="pull_to_refresh_pull_label">משוך לרענון…</string>
    <string name="pull_to_refresh_refreshing_label">טוען…</string>
    <string name="pull_to_refresh_release_label">שחרר לרענון…</string>
</resources>


text:
.start {
  opacity: 0; }

.start-1 {
  -o-animation: shine 1.85s infinite ease-in-out forwards alternate;
  -moz-animation: shine 1.85s infinite ease-in-out forwards alternate;
  -webkit-animation: shine 1.85s infinite ease-in-out forwards alternate;
  animation: shine 1.85s infinite ease-in-out forwards alternate;
  -o-animation-delay: 0.4s;
  -moz-animation-delay: 0.4s;
  -webkit-animation-delay: 0.4s;
  animation-delay: 0.4s; }

@-moz-keyframes shine {
  100% {
    opacity: 1; } }
@-o-keyframes shine {
  100% {
    opacity: 1; } }
@-webkit-keyframes shine {
  100% {
    opacity: 1; } }
@keyframes shine {
  100% {
    opacity: 1; } }


text:
package volumeserver

import (
	"code.cloudfoundry.org/lager"
	"github.com/concourse/atc/db"
)

type Server struct {
	logger lager.Logger

	db            VolumesDB
	teamDBFactory db.TeamDBFactory
}

//go:generate counterfeiter . VolumesDB

type VolumesDB interface {
	GetVolumes() ([]db.SavedVolume, error)
}

func NewServer(
	logger lager.Logger,
	db VolumesDB,
	teamDBFactory db.TeamDBFactory,
) *Server {
	return &Server{
		logger:        logger,
		db:            db,
		teamDBFactory: teamDBFactory,
	}
}


text:
#include <pcl/pcl_config.h>
#include <pcl/io/image_yuv422.h>

#include <pcl/io/io_exception.h>

#include <sstream>
#include <iostream>

#define CLIP_CHAR(c) static_cast<unsigned char> ((c)>255?255:(c)<0?0:(c))

using pcl::io::FrameWrapper;
using pcl::io::IOException;

pcl::io::ImageYUV422::ImageYUV422 (FrameWrapper::Ptr image_metadata)
  : Image (image_metadata)
{}

pcl::io::ImageYUV422::ImageYUV422 (FrameWrapper::Ptr image_metadata, Timestamp timestamp)
  : Image (image_metadata, timestamp)
{}

pcl::io::ImageYUV422::~ImageYUV422 () throw ()
{}

bool
pcl::io::ImageYUV422::isResizingSupported (unsigned input_width, unsigned input_height, unsigned output_width, unsigned output_height) const
{
  return (output_width <= input_width && output_height <= input_height && input_width % output_width == 0 && input_height % output_height == 0 );
}

void
pcl::io::ImageYUV422::fillRGB (unsigned width, unsigned height, unsigned char* rgb_buffer, unsigned rgb_line_step) const
{
  // 0  1   2  3
  // u  y1  v  y2

  if (wrapper_->getWidth () != width && wrapper_->getHeight () != height)
  {
    if (width > wrapper_->getWidth () || height > wrapper_->getHeight () )
      THROW_IO_EXCEPTION ("Upsampling not supported. Request was: %d x %d -> %d x %d", wrapper_->getWidth (), wrapper_->getHeight (), width, height);

    if ( wrapper_->getWidth () % width != 0 || wrapper_->getHeight () % height != 0
      || (wrapper_->getWidth () / width) & 0x01 || (wrapper_->getHeight () / height & 0x01) )
      THROW_IO_EXCEPTION ("Downsampling only possible for power of two scale in both dimensions. Request was %d x %d -> %d x %d.", wrapper_->getWidth (), wrapper_->getHeight (), width, height);
  }

  const uint8_t* yuv_buffer = (uint8_t*) wrapper_->getData ();

  unsigned rgb_line_skip = 0;
  if (rgb_line_step != 0)
    rgb_line_skip = rgb_line_step - width * 3;

  if (wrapper_->getWidth () == width && wrapper_->getHeight () == height)
  {
    for (unsigned yIdx = 0; yIdx < height; ++yIdx, rgb_buffer += rgb_line_skip)
    {
      for (unsigned xIdx = 0; xIdx < width; xIdx += 2, rgb_buffer += 6, yuv_buffer += 4)
      {
        int v = yuv_buffer[2] - 128;
        int u = yuv_buffer[0] - 128;

        rgb_buffer[0] =  CLIP_CHAR (yuv_buffer[1] + ((v * 18678 + 8192 ) >> 14));
        rgb_buffer[1] =  CLIP_CHAR (yuv_buffer[1] + ((v * -9519 - u * 6472 + 8192 ) >> 14));
        rgb_buffer[2] =  CLIP_CHAR (yuv_buffer[1] + ((u * 33292 + 8192 ) >> 14));

        rgb_buffer[3] =  CLIP_CHAR (yuv_buffer[3] + ((v * 18678 + 8192 ) >> 14));
        rgb_buffer[4] =  CLIP_CHAR (yuv_buffer[3] + ((v * -9519 - u * 6472 + 8192 ) >> 14));
        rgb_buffer[5] =  CLIP_CHAR (yuv_buffer[3] + ((u * 33292 + 8192 ) >> 14));
      }
    }
  }
  else
  {
    unsigned yuv_step = wrapper_->getWidth () / width;
    unsigned yuv_x_step = yuv_step << 1;
    unsigned yuv_skip = (wrapper_->getHeight () / height - 1) * ( wrapper_->getWidth () << 1 );

    for (unsigned yIdx = 0; yIdx < wrapper_->getHeight (); yIdx += yuv_step, yuv_buffer += yuv_skip, rgb_buffer += rgb_line_skip)
    {
      for (unsigned xIdx = 0; xIdx < wrapper_->getWidth (); xIdx += yuv_step, rgb_buffer += 3, yuv_buffer += yuv_x_step)
      {
        int v = yuv_buffer[2] - 128;
        int u = yuv_buffer[0] - 128;

        rgb_buffer[0] =  CLIP_CHAR (yuv_buffer[1] + ((v * 18678 + 8192 ) >> 14));
        rgb_buffer[1] =  CLIP_CHAR (yuv_buffer[1] + ((v * -9519 - u * 6472 + 8192 ) >> 14));
        rgb_buffer[2] =  CLIP_CHAR (yuv_buffer[1] + ((u * 33292 + 8192 ) >> 14));
      }
    }
  }
}

void
pcl::io::ImageYUV422::fillGrayscale (unsigned width, unsigned height, unsigned char* gray_buffer, unsigned gray_line_step) const
{
  // u y1 v y2
  if (width > wrapper_->getWidth () || height > wrapper_->getHeight ())
    THROW_IO_EXCEPTION ("Upsampling not supported. Request was: %d x %d -> %d x %d", wrapper_->getWidth (), wrapper_->getHeight (), width, height);

  if (wrapper_->getWidth () % width != 0 || wrapper_->getHeight () % height != 0)
    THROW_IO_EXCEPTION ("Downsampling only possible for integer scales in both dimensions. Request was %d x %d -> %d x %d.", wrapper_->getWidth (), wrapper_->getHeight (), width, height);

  unsigned gray_line_skip = 0;
  if (gray_line_step != 0)
    gray_line_skip = gray_line_step - width;

  unsigned yuv_step = wrapper_->getWidth () / width;
  unsigned yuv_x_step = yuv_step << 1;
  unsigned yuv_skip = (wrapper_->getHeight () / height - 1) * ( wrapper_->getWidth () << 1 );
  const uint8_t* yuv_buffer = ( (uint8_t*) wrapper_->getData () + 1);

  for (unsigned yIdx = 0; yIdx < wrapper_->getHeight (); yIdx += yuv_step, yuv_buffer += yuv_skip, gray_buffer += gray_line_skip)
  {
    for (unsigned xIdx = 0; xIdx < wrapper_->getWidth (); xIdx += yuv_step, ++gray_buffer, yuv_buffer += yuv_x_step)
    {
      *gray_buffer = *yuv_buffer;
    }
  }
}


text:
using System;
using System.Threading.Tasks;
using System.Windows.Input;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Services.Dialogs;

namespace SimpSim.NET.WPF.ViewModels
{
    public class AssemblyEditorDialogViewModel : BindableBase, IDialogAware
    {
        private bool _canExecuteAssembleCommand;
        private string _assemblyEditorText;
        private string _assemblyError;

        public AssemblyEditorDialogViewModel(SimpleSimulator simulator)
        {
            CanExecuteAssembleCommand = true;
            AssembleCommand = new DelegateCommand(async () =>
            {
                if (await Assemble(simulator))
                    RequestClose?.Invoke(new DialogResult());
            }).ObservesCanExecute(() => CanExecuteAssembleCommand);
        }

        public bool CanExecuteAssembleCommand
        {
            get => _canExecuteAssembleCommand;
            set => SetProperty(ref _canExecuteAssembleCommand, value);
        }

        public string AssemblyEditorText
        {
            get => _assemblyEditorText;
            set => SetProperty(ref _assemblyEditorText, value);
        }

        public string AssemblyError
        {
            get => _assemblyError;
            set => SetProperty(ref _assemblyError, value);
        }

        public async Task<bool> Assemble(SimpleSimulator simulator)
        {
            Instruction[] instructions = null;

            CanExecuteAssembleCommand = false;
            AssemblyError = null;

            try
            {
                instructions = await Task.Run(() => simulator.Assembler.Assemble(AssemblyEditorText)).ConfigureAwait(false);
            }
            catch (AssemblyException ex)
            {
                AssemblyError = $"Line {ex.LineNumber}: {ex.Message}";
            }
            finally
            {
                CanExecuteAssembleCommand = true;
            }

            if (instructions != null)
                simulator.Memory.LoadInstructions(instructions);

            return AssemblyError == null;
        }

        public ICommand AssembleCommand { get; }

        public bool CanCloseDialog() => true;

        public void OnDialogClosed() { }

        public void OnDialogOpened(IDialogParameters parameters)
        {
            AssemblyEditorText = parameters.GetValue<string>("text");
        }

        public string Title => "Assembly Editor";

        public event Action<IDialogResult> RequestClose;
    }
}


text:
#include "CrashDump.h"
#include <Windows.h>
#include <tchar.h>
#pragma warning( push )
#pragma warning( disable : 4091)
#include <DbgHelp.h>
#pragma warning( pop )

using namespace std;

typedef BOOL(WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess, DWORD dwPid, HANDLE hFile, MINIDUMP_TYPE DumpType, CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam);
void create_minidump(struct _EXCEPTION_POINTERS* apExceptionInfo)
{
    const DWORD Flags = MiniDumpWithFullMemory |
        MiniDumpWithFullMemoryInfo |
        MiniDumpWithHandleData |
        MiniDumpWithUnloadedModules |
        MiniDumpWithThreadInfo |
        MiniDumpWithThreadInfo;
    HMODULE mhLib = ::LoadLibrary(_T("dbghelp.dll"));
    if (!mhLib)
    {
        return;
    }
    MINIDUMPWRITEDUMP pDump = (MINIDUMPWRITEDUMP)::GetProcAddress(mhLib, "MiniDumpWriteDump");

    HANDLE hFile = ::CreateFile(_T("core.dmp"), GENERIC_WRITE, FILE_SHARE_WRITE, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);

    _MINIDUMP_EXCEPTION_INFORMATION ExInfo;
    ExInfo.ThreadId = ::GetCurrentThreadId();
    ExInfo.ExceptionPointers = apExceptionInfo;
    ExInfo.ClientPointers = FALSE;

    pDump(GetCurrentProcess(), GetCurrentProcessId(), hFile, (MINIDUMP_TYPE)
    Flags, &ExInfo, nullptr, nullptr);
    ::CloseHandle(hFile);
}
LONG WINAPI unhandled_handler(struct _EXCEPTION_POINTERS* apExceptionInfo)
{
    create_minidump(apExceptionInfo);
    return EXCEPTION_CONTINUE_SEARCH;
}
void SetupCrashHandler()
{
    SetUnhandledExceptionFilter(unhandled_handler);
}