text:
package org.ee.logger.system;

import java.io.PrintStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;

import org.ee.logger.AbstractLogger;

public class SystemLogger extends AbstractLogger {
	@Override
	public void log(Level level, Object message) {
		PrintStream out;
		if(level.intValue() >= Level.WARNING.intValue()) {
			out = System.err;
		} else {
			out = System.out;
		}
		out.print("[" + level + "] " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").format(new Date()) + "  ");
		out.println(message);
	}
}


text:
using System;
using System.ComponentModel.DataAnnotations;

namespace GroceryCoKiosk.Groceries
{
    /// <summary>
    /// Represents a grocery that can be purchased.
    /// </summary>
    public struct Grocery
    {
        /// <summary>
        /// The name of the grocery.
        /// </summary>
        [Required]
        public string Name { get; set; }

        /// <summary>
        /// The price of the grocery.
        /// </summary>
        [Range(typeof(Decimal), "0.01", "1000000000000")]
        public decimal Price { get; set; }
    }
}

redpajama_set_name: RedPajamaGithub


text:
namespace BibliotecaDigital.Migrations
{
    using System;
    using System.Data.Entity.Migrations;

    public partial class InitialCreate : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Alunoes",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Nome = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id);

            CreateTable(
                "dbo.Emprestimoes",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        DataEmprestimo = c.DateTime(nullable: false),
                        DataDevolucao = c.DateTime(nullable: false),
                        IdLivro = c.Int(nullable: false),
                        IdAluno = c.Int(nullable: false),
                        Aluno_Id = c.Int(),
                        Livro_Id = c.Int(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Alunoes", t => t.Aluno_Id)
                .ForeignKey("dbo.Livroes", t => t.Livro_Id)
                .Index(t => t.Aluno_Id)
                .Index(t => t.Livro_Id);

            CreateTable(
                "dbo.Livroes",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Nome = c.String(),
                        emprestado = c.Boolean(nullable: false),
                        Descricao = c.String(),
                    })
                .PrimaryKey(t => t.Id);

            CreateTable(
                "dbo.AspNetRoles",
                c => new
                    {
                        Id = c.String(nullable: false, maxLength: 128),
                        Name = c.String(nullable: false, maxLength: 256),
                    })
                .PrimaryKey(t => t.Id)
                .Index(t => t.Name, unique: true, name: "RoleNameIndex");

            CreateTable(
                "dbo.AspNetUserRoles",
                c => new
                    {
                        UserId = c.String(nullable: false, maxLength: 128),
                        RoleId = c.String(nullable: false, maxLength: 128),
                    })
                .PrimaryKey(t => new { t.UserId, t.RoleId })
                .ForeignKey("dbo.AspNetRoles", t => t.RoleId, cascadeDelete: true)
                .ForeignKey("dbo.AspNetUsers", t => t.UserId, cascadeDelete: true)
                .Index(t => t.UserId)
                .Index(t => t.RoleId);

            CreateTable(
                "dbo.AspNetUsers",
                c => new
                    {
                        Id = c.String(nullable: false, maxLength: 128),
                        Email = c.String(maxLength: 256),
                        EmailConfirmed = c.Boolean(nullable: false),
                        PasswordHash = c.String(),
                        SecurityStamp = c.String(),
                        PhoneNumber = c.String(),
                        PhoneNumberConfirmed = c.Boolean(nullable: false),
                        TwoFactorEnabled = c.Boolean(nullable: false),
                        LockoutEndDateUtc = c.DateTime(),
                        LockoutEnabled = c.Boolean(nullable: false),
                        AccessFailedCount = c.Int(nullable: false),
                        UserName = c.String(nullable: false, maxLength: 256),
                    })
                .PrimaryKey(t => t.Id)
                .Index(t => t.UserName, unique: true, name: "UserNameIndex");

            CreateTable(
                "dbo.AspNetUserClaims",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        UserId = c.String(nullable: false, maxLength: 128),
                        ClaimType = c.String(),
                        ClaimValue = c.String(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.AspNetUsers", t => t.UserId, cascadeDelete: true)
                .Index(t => t.UserId);

            CreateTable(
                "dbo.AspNetUserLogins",
                c => new
                    {
                        LoginProvider = c.String(nullable: false, maxLength: 128),
                        ProviderKey = c.String(nullable: false, maxLength: 128),
                        UserId = c.String(nullable: false, maxLength: 128),
                    })
                .PrimaryKey(t => new { t.LoginProvider, t.ProviderKey, t.UserId })
                .ForeignKey("dbo.AspNetUsers", t => t.UserId, cascadeDelete: true)
                .Index(t => t.UserId);

        }

        public override void Down()
        {
            DropForeignKey("dbo.AspNetUserRoles", "UserId", "dbo.AspNetUsers");
            DropForeignKey("dbo.AspNetUserLogins", "UserId", "dbo.AspNetUsers");
            DropForeignKey("dbo.AspNetUserClaims", "UserId", "dbo.AspNetUsers");
            DropForeignKey("dbo.AspNetUserRoles", "RoleId", "dbo.AspNetRoles");
            DropForeignKey("dbo.Emprestimoes", "Livro_Id", "dbo.Livroes");
            DropForeignKey("dbo.Emprestimoes", "Aluno_Id", "dbo.Alunoes");
            DropIndex("dbo.AspNetUserLogins", new[] { "UserId" });
            DropIndex("dbo.AspNetUserClaims", new[] { "UserId" });
            DropIndex("dbo.AspNetUsers", "UserNameIndex");
            DropIndex("dbo.AspNetUserRoles", new[] { "RoleId" });
            DropIndex("dbo.AspNetUserRoles", new[] { "UserId" });
            DropIndex("dbo.AspNetRoles", "RoleNameIndex");
            DropIndex("dbo.Emprestimoes", new[] { "Livro_Id" });
            DropIndex("dbo.Emprestimoes", new[] { "Aluno_Id" });
            DropTable("dbo.AspNetUserLogins");
            DropTable("dbo.AspNetUserClaims");
            DropTable("dbo.AspNetUsers");
            DropTable("dbo.AspNetUserRoles");
            DropTable("dbo.AspNetRoles");
            DropTable("dbo.Livroes");
            DropTable("dbo.Emprestimoes");
            DropTable("dbo.Alunoes");
        }
    }
}


text:
namespace lslboost
{

    template< class T >
    inline bool empty( const T& r )
    {
        return lslboost::begin( r ) == lslboost::end( r );
    }

} // namespace 'boost'

#endif


text:
package array.interval;

import public_class.Interval;
import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;

public class Q253MeetingRoomsII {

    //Difficulty: Medium
    //TAG: Facebook
    //TAG: Google
    //TAG: Snap
    //TAG: Uber
    //TAG: Apple
    //TAG: Array
    //TAG: range

    /**
     * 253. Meeting Rooms II
     * Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), find the minimum number of conference rooms required.

     For example,
     Given [[0, 30],[5, 10],[15, 20]],
     return 2.
     */

    /*
     * Solution 1:
     * Consider about only when one end > next.start we need a new meeting room, but when next2 is overlapped with
     * next but not with first one, we don't need another meeting room, due to the first meeting is done
     *
     * So we need track not only pre end with next start, but also the current start with pre smallest end, so that we
     * know if any pre meeting is done before cur meeting start
     * Use heap to track earliest end meeting, when cur meeting need a new room (start and end overlapped),
     * we push new meeting in heap, the heap size represent how many meeting rooms needed, when not need a meeting room
     * e.g. current start >= smallest.end, then we merge this smallest with current, represent that current is using
     * the smallest meeting room, update the end for next compare
     *
     * Time: O(nlogn)
     * Space: O(n)
     */

    public int minMeetingRooms(Interval[] intervals) {
        if (intervals == null || intervals.length == 0) return 0;
        Arrays.sort(intervals, new Comparator<Interval>() {
            @Override
            public int compare(Interval o1, Interval o2) {
                return o1.start - o2.start;
            }
        });
        PriorityQueue<Interval> pq = new PriorityQueue<>(new Comparator<Interval>() {
            @Override
            public int compare(Interval o1, Interval o2) {
                return o1.end - o2.end;
            }
        });
        pq.offer(intervals[0]);
        for (int i = 1; i < intervals.length; i++) {
            Interval poll = pq.poll();
            //We don't need a meeting room and merge them (keep occupy this room)
            if (intervals[i].start >= poll.end) {
                poll.end = intervals[i].end;
                //Otherwise we need a room and push it to the pq
            } else pq.offer(intervals[i]);
            //whether we need a room or not, we push poll back to pq
            pq.offer(poll);
        }
        return pq.size();
    }

    /*
     * Solution 2:
     * Don't need to consider every interval as a single interval but two numbers, start and end, gather all starts
     * and ends
     *
     * sort starts and ends in ascending order
     * compare start and end, if start < end, need room, room++
     * otherwise move end try to find the end > start
     *
     * Time: O(n + 2nlogn + 2n) = O(nlogn)
     * Space: O(n)
     */

    public int minMeetingRooms2(Interval[] intervals) {
        int[] starts = new int[intervals.length];
        int[] ends = new int[intervals.length];
        for(int i = 0; i < intervals.length; i++) {
            starts[i] = intervals[i].start;
            ends[i] = intervals[i].end;
        }
        Arrays.sort(starts);
        Arrays.sort(ends);
        int rooms = 0;
        int endIndex = 0;
        for(int i=0; i<starts.length; i++) {
            if(starts[i]<ends[endIndex]) rooms++;
            else endIndex++;
        }
        return rooms;
    }

}


text:
'use strict';

angular.module('copayApp.controllers').controller('glideraController',
  function($scope, $timeout, $modal, profileService, configService, storageService, glideraService, isChromeApp, animationService) {

    this.getAuthenticateUrl = function() {
      return glideraService.getOauthCodeUrl();
    };

    this.submitOauthCode = function(code) {
      var self = this;
      var glideraTestnet = configService.getSync().glidera.testnet;
      var network = glideraTestnet ? 'testnet' : 'livenet';
      this.loading = true;
      this.error = null;
      $timeout(function() {
        glideraService.getToken(code, function(err, data) {
          self.loading = null;
          if (err) {
            self.error = err;
            $timeout(function() {
                $scope.$apply();
              }, 100);
          }
          else if (data && data.access_token) {
            storageService.setGlideraToken(network, data.access_token, function() {
              $scope.$emit('Local/GlideraUpdated', data.access_token);
              $timeout(function() {
                $scope.$apply();
              }, 100);
            });
          }
        });
      }, 100);
    };

    this.openTxModal = function(token, tx) {
      var self = this;
      var config = configService.getSync().wallet.settings;
      var fc = profileService.focusedClient;
      var ModalInstanceCtrl = function($scope, $modalInstance) {
        $scope.tx = tx;
        $scope.settings = config;
        $scope.color = fc.backgroundColor;
        $scope.noColor = true;

        glideraService.getTransaction(token, tx.transactionUuid, function(error, tx) {
          $scope.tx = tx;
        });

        $scope.cancel = function() {
          $modalInstance.dismiss('cancel');
        };

      };

      var modalInstance = $modal.open({
        templateUrl: 'views/modals/glidera-tx-details.html',
          windowClass: animationService.modalAnimated.slideRight,
          controller: ModalInstanceCtrl,
      });

      modalInstance.result.finally(function() {
        var m = angular.element(document.getElementsByClassName('reveal-modal'));
        m.addClass(animationService.modalAnimated.slideOutRight);
      });
    };

  });


text:
FROM golang:alpine
ENV LANG en_US.UTF-8

COPY . /go/src/github.com/dyegocosta/snake-game
WORKDIR /go/src/github.com/dyegocosta/snake-game

RUN apk add --no-cache git
RUN go get ./
RUN go build -o ./_bin/snake-game

ENTRYPOINT "./_bin/snake-game"


text:
![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png) 0

To use the University of San Diego skill, try saying...

* *Alexa, open USD*

* *What's happening on Friday?*

* *Which gyms are open?*

The University of San Diego skill for the Amazon Echo
keeps you connected to Campus Resources and Activities. Get started by telling Alexa: "Ask USD".

- Stay connect with all the latest events on campus
- Easily obtain phone numbers and emails for important locations
- Have fun and improve your USD knowledge with the Trivia skill
- Know before you go. You can find out if a campus location is open or closed
- Quickly get information about USD, such as the campus mailing address

***

### Skill Details

* **Invocation Name:** u. s. d.
* **Category:** null
* **ID:** amzn1.ask.skill.29083681-e02a-413a-b425-4940e0add941
* **ASIN:** B01MSHH1KS
* **Author:** USD Developer Account
* **Release Date:** November 17, 2016 @ 23:05:15
* **In-App Purchasing:** No


text:
// RobotBuilder Version: 1.5
//
// This file was generated by RobotBuilder. It contains sections of
// code that are automatically generated and assigned by robotbuilder.
// These sections will be updated in the future when you export to
// Java from RobotBuilder. Do not put any code or make any change in
// the blocks indicating autogenerated code or it will be lost on an
// update. Deleting the comments indicating the section will prevent
// it from being updated in the future.

package org.usfirst.frc1073.robot15.commands;

import edu.wpi.first.wpilibj.command.Command;
import org.usfirst.frc1073.robot15.Robot;

/**
 *
 */
public class  RollersCollect extends Command {

    public RollersCollect() {
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);

        // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=REQUIRES

    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=REQUIRES
    }

    // Called just before this Command runs the first time
    protected void initialize() {
    	Robot.elevator.rollersCollect();
    }

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
    }

    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        return false;
    }

    // Called once after isFinished returns true
    protected void end() {
    	Robot.elevator.rollersOff();
    }

    // Called when another command which requires one or more of the same
    // subsystems is scheduled to run
    protected void interrupted() {
    	end();
    }
}


text:
@implementation LastFMObject

// This should be implemented by subclasses
+ (id)objectFromExternalDictionary:(NSDictionary *)dict{
  return [[[self class] alloc] init];
}

#pragma mark - utility

// image array: array of dictionaries containing #text and size attributes
// imageThumbURL: will be set with proper URL for thumb
// imageURL: will be set with proper URL for image
void TCSSetImageURLsForThumbAndImage(NSArray *imageArray, NSString **imageThumbURL, NSString **imageURL){
  NSMutableDictionary *newAlbumDict = [NSMutableDictionary dictionaryWithCapacity:[imageArray count]];
  for (NSDictionary *imgDict in imageArray){
    [newAlbumDict setObject:[imgDict objectForKey:@"#text"] forKey:[imgDict objectForKey:@"size"]];
  }
  NSString *largestImageURL = nil;
  NSString *currentImageURL = nil;
  largestImageURL = [newAlbumDict objectForKey:@"small"];
  currentImageURL = [newAlbumDict objectForKey:@"medium"];
  if (currentImageURL != nil)
    largestImageURL = currentImageURL;
  currentImageURL = [newAlbumDict objectForKey:@"large"];
  if (currentImageURL != nil)
    largestImageURL = currentImageURL;
  *imageThumbURL = largestImageURL; // set imageThumbURL with large image (or medium or small)
  currentImageURL = [newAlbumDict objectForKey:@"extralarge"];
  if (currentImageURL != nil)
    largestImageURL = currentImageURL;
  currentImageURL = [newAlbumDict objectForKey:@"mega"];
  if (currentImageURL != nil)
    largestImageURL = currentImageURL;
  *imageURL = largestImageURL; // set imageURL with mega image (or extralarge or large etc.)
}

// Strips HTML tags and converts " to "
NSString *TCSStringByStrippingHTMLTagsFromString(NSString *htmlString){
  if (htmlString == nil)
    return nil;

  NSError *error = nil;
  NSString *output = nil;

  NSRegularExpression *regexTagStart = [NSRegularExpression
                                        regularExpressionWithPattern:@"<\\s*\\w.*?>"
                                        options:0
                                        error:&error];
  NSRegularExpression *regexTagEnd = [NSRegularExpression
                                      regularExpressionWithPattern:@"<\\/.*?>"
                                      options:0
                                      error:&error];
  output = [regexTagStart stringByReplacingMatchesInString:htmlString options:0 range:NSMakeRange(0, [htmlString length]) withTemplate:@""];
  output = [regexTagEnd stringByReplacingMatchesInString:output options:0 range:NSMakeRange(0, [output length]) withTemplate:@""];
  output = [output stringByReplacingOccurrencesOfString:@""" withString:@"\""];

  return output;
}

// Date is assumed to be in the format: "    20 Sep 2011, 00:00"
NSDate *TCSDateByParsingLastFMAlbumReleaseDateString(NSString *dateString){
  if (dateString == nil)
    return nil;

  static dispatch_once_t onceMark;
  static NSDateFormatter *formatter = nil;
  dispatch_once(&onceMark, ^{
    formatter = [[NSDateFormatter alloc] init];
    [formatter setDateFormat:@"dd MM yyyy"];
  });

  // Strip leading whitespace
  NSString *outputStr = [dateString copy];
  outputStr = [outputStr stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
  if ([outputStr isEqualToString:@""])
    return nil;

  // Strip everything past the comma
  NSRange commaRange = [outputStr rangeOfString:@","];
  if (commaRange.location == NSNotFound)
    return nil;

  outputStr = [outputStr substringToIndex:commaRange.location];

  // Do the conversion
  NSDate *outputDate = [formatter dateFromString:outputStr];

  return outputDate;
}

@end


text:
package org.vaadin.spring.events;

/**
 * An implementation of {@link org.vaadin.spring.events.TopicFilter}
 * which validates the topics hierarchical. This means, that the
 * listener filter will be checked as prefixed substring against
 * the event topic.
 *
 *

 *
match: eventTopic = "foo.bar" and listenerTopic = "foo"

 *
no match: eventTopic = "foo" and listenerTopic = "foo.bar"

 *
no match: eventTopic = "foo.bar" and listenerTopic = "foo.not"

 *

 *
 * @author Marco Luthardt (marco.luthardt@iandme.net)
 */
public class HierachyTopicFilter implements TopicFilter {

    @Override
    public boolean validTopic(String eventTopic, String listenerTopic) {
        return eventTopic.startsWith(listenerTopic);
    }
}


text:
package org.apache.camel.component.kafka;

import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.stream.Collectors;

import org.apache.camel.AggregationStrategy;
import org.apache.camel.AsyncCallback;
import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.ExtendedCamelContext;
import org.apache.camel.Message;
import org.apache.camel.TypeConverter;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.impl.engine.DefaultHeadersMapFactory;
import org.apache.camel.processor.aggregate.GroupedExchangeAggregationStrategy;
import org.apache.camel.processor.aggregate.GroupedMessageAggregationStrategy;
import org.apache.camel.support.DefaultExchange;
import org.apache.camel.support.DefaultMessage;
import org.apache.kafka.clients.producer.Callback;
import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.clients.producer.RecordMetadata;
import org.apache.kafka.common.errors.ApiException;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;

public class KafkaProducerTest {

    private KafkaProducer producer;
    private KafkaEndpoint endpoint;
    private KafkaEndpoint fromEndpoint;

    private TypeConverter converter = Mockito.mock(TypeConverter.class);
    private CamelContext context = Mockito.mock(CamelContext.class);
    private Exchange exchange = Mockito.mock(Exchange.class);
    private ExtendedCamelContext camelContext = Mockito.mock(ExtendedCamelContext.class);
    private Message in = new DefaultMessage(camelContext);
    private Message out = new DefaultMessage(camelContext);
    private AsyncCallback callback = Mockito.mock(AsyncCallback.class);

    @SuppressWarnings({"unchecked"})
    public KafkaProducerTest() throws Exception {
        KafkaComponent kafka = new KafkaComponent(new DefaultCamelContext());
        kafka.getConfiguration().setBrokers("broker1:1234,broker2:4567");
        kafka.init();

        endpoint = kafka.createEndpoint("kafka:sometopic", "sometopic", new HashMap());
        producer = new KafkaProducer(endpoint);

        fromEndpoint = kafka.createEndpoint("kafka:fromtopic", "fromtopic", new HashMap());

        RecordMetadata rm = new RecordMetadata(null, 0, 0, 0, 0L, 0, 0);
        Future future = Mockito.mock(Future.class);
        Mockito.when(future.get()).thenReturn(rm);
        org.apache.kafka.clients.producer.KafkaProducer kp = Mockito.mock(org.apache.kafka.clients.producer.KafkaProducer.class);
        Mockito.when(kp.send(any(ProducerRecord.class))).thenReturn(future);

        Mockito.when(exchange.getContext()).thenReturn(context);
        Mockito.when(context.getTypeConverter()).thenReturn(converter);
        Mockito.when(converter.tryConvertTo(String.class, exchange, null)).thenReturn(null);
        Mockito.when(camelContext.adapt(ExtendedCamelContext.class)).thenReturn(camelContext);
        Mockito.when(camelContext.adapt(ExtendedCamelContext.class).getHeadersMapFactory()).thenReturn(new DefaultHeadersMapFactory());
        Mockito.when(camelContext.getTypeConverter()).thenReturn(converter);

        producer.setKafkaProducer(kp);
        producer.setWorkerPool(Executors.newFixedThreadPool(1));
    }

    @Test
    public void testPropertyBuilder() throws Exception {
        Properties props = producer.getProps();
        assertEquals("broker1:1234,broker2:4567", props.getProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG));
    }

    @Test
    @SuppressWarnings({"unchecked"})
    public void processSendsMessage() throws Exception {
        endpoint.getConfiguration().setTopic("sometopic");
        Mockito.when(exchange.getIn()).thenReturn(in);
        Mockito.when(exchange.getMessage()).thenReturn(out);

        in.setHeader(KafkaConstants.PARTITION_KEY, 4);

        producer.process(exchange);
        Mockito.verify(producer.getKafkaProducer()).send(any(ProducerRecord.class));
        assertRecordMetadataExists();
    }

    @Test(expected = Exception.class)
    @SuppressWarnings({"unchecked"})
    public void processSendsMessageWithException() throws Exception {
        endpoint.getConfiguration().setTopic("sometopic");
        // setup the exception here
        org.apache.kafka.clients.producer.KafkaProducer kp = producer.getKafkaProducer();
        Mockito.when(kp.send(any(ProducerRecord.class))).thenThrow(new ApiException());
        Mockito.when(exchange.getIn()).thenReturn(in);
        in.setHeader(KafkaConstants.PARTITION_KEY, 4);

        producer.process(exchange);

        assertRecordMetadataExists();
    }

    @Test
    public void processAsyncSendsMessage() throws Exception {
        endpoint.getConfiguration().setTopic("sometopic");
        Mockito.when(exchange.getIn()).thenReturn(in);
        Mockito.when(exchange.getMessage()).thenReturn(out);

        in.setHeader(KafkaConstants.PARTITION_KEY, 4);

        producer.process(exchange, callback);

        ArgumentCaptor<Callback> callBackCaptor = ArgumentCaptor.forClass(Callback.class);
        Mockito.verify(producer.getKafkaProducer()).send(any(ProducerRecord.class), callBackCaptor.capture());
        Callback kafkaCallback = callBackCaptor.getValue();
        kafkaCallback.onCompletion(new RecordMetadata(null, 0, 0, 0, 0L, 0, 0), null);
        assertRecordMetadataExists();
    }

    @Test
    public void processAsyncSendsMessageWithException() throws Exception {
        endpoint.getConfiguration().setTopic("sometopic");
        Mockito.when(exchange.getIn()).thenReturn(in);
        Mockito.when(exchange.getMessage()).thenReturn(out);

        // setup the exception here
        org.apache.kafka.clients.producer.KafkaProducer kp = producer.getKafkaProducer();
        Mockito.when(kp.send(any(ProducerRecord.class), any(Callback.class))).thenThrow(new ApiException());

        in.setHeader(KafkaConstants.PARTITION_KEY, 4);

        producer.process(exchange, callback);

        ArgumentCaptor<Callback> callBackCaptor = ArgumentCaptor.forClass(Callback.class);
        Mockito.verify(producer.getKafkaProducer()).send(any(ProducerRecord.class), callBackCaptor.capture());
        Mockito.verify(exchange).setException(isA(ApiException.class));
        Mockito.verify(callback).done(eq(true));
        Callback kafkaCallback = callBackCaptor.getValue();
        kafkaCallback.onCompletion(new RecordMetadata(null, 0, 0, 0, 0L, 0, 0), null);
        assertRecordMetadataExists();
    }

    @Test
    public void processSendsMessageWithTopicHeaderAndNoTopicInEndPoint() throws Exception {
        endpoint.getConfiguration().setTopic(null);
        Mockito.when(exchange.getIn()).thenReturn(in);
        in.setHeader(KafkaConstants.TOPIC, "anotherTopic");
        Mockito.when(exchange.getMessage()).thenReturn(out);

        producer.process(exchange);

        verifySendMessage("sometopic");
        assertRecordMetadataExists();
    }

    @Test
    public void processSendsMessageWithTopicHeaderAndEndPoint() throws Exception {
        endpoint.getConfiguration().setTopic("sometopic");
        Mockito.when(exchange.getIn()).thenReturn(in);
        Mockito.when(exchange.getMessage()).thenReturn(out);

        in.setHeader(KafkaConstants.PARTITION_KEY, 4);
        in.setHeader(KafkaConstants.TOPIC, "anotherTopic");
        in.setHeader(KafkaConstants.KEY, "someKey");

        producer.process(exchange);

        // the header is preserved
        assertNotNull(in.getHeader(KafkaConstants.TOPIC));

        verifySendMessage(4, "sometopic", "someKey");
        assertRecordMetadataExists();
    }

    @Test
    public void processSendsMessageWithOverrideTopicHeaderAndEndPoint() throws Exception {
        endpoint.getConfiguration().setTopic("sometopic");
        Mockito.when(exchange.getIn()).thenReturn(in);
        Mockito.when(exchange.getMessage()).thenReturn(out);

        in.setHeader(KafkaConstants.PARTITION_KEY, 4);
        in.setHeader(KafkaConstants.OVERRIDE_TOPIC, "anotherTopic");
        in.setHeader(KafkaConstants.KEY, "someKey");

        producer.process(exchange);

        // the header is now removed
        assertNull(in.getHeader(KafkaConstants.OVERRIDE_TOPIC));

        verifySendMessage(4, "anotherTopic", "someKey");
        assertRecordMetadataExists();
    }

    @Test
    public void processRequiresTopicInEndpointOrInHeader() throws Exception {
        endpoint.getConfiguration().setTopic(null);
        Mockito.when(exchange.getIn()).thenReturn(in);
        in.setHeader(KafkaConstants.PARTITION_KEY, 4);
        in.setHeader(KafkaConstants.KEY, "someKey");

        producer.process(exchange);

        verifySendMessage("sometopic", "someKey");
        assertRecordMetadataExists();
    }

    @Test
    public void processRequiresTopicInConfiguration() throws Exception {
        endpoint.getConfiguration().setTopic("configTopic");
        Mockito.when(exchange.getIn()).thenReturn(in);
        in.setHeader(KafkaConstants.PARTITION_KEY, 4);
        in.setHeader(KafkaConstants.KEY, "someKey");

        producer.process(exchange);

        verifySendMessage("configTopic", "someKey");
        assertRecordMetadataExists();
    }

    @Test
    public void processDoesNotRequirePartitionHeader() throws Exception {
        endpoint.getConfiguration().setTopic("sometopic");
        Mockito.when(exchange.getIn()).thenReturn(in);
        Mockito.when(exchange.getMessage()).thenReturn(out);

        producer.process(exchange);

        assertRecordMetadataExists();
    }

    @Test
    public void processSendsMessageWithPartitionKeyHeader() throws Exception {
        endpoint.getConfiguration().setTopic("someTopic");
        Mockito.when(exchange.getIn()).thenReturn(in);
        Mockito.when(exchange.getMessage()).thenReturn(out);
        in.setHeader(KafkaConstants.PARTITION_KEY, 4);
        in.setHeader(KafkaConstants.KEY, "someKey");

        producer.process(exchange);

        verifySendMessage(4, "someTopic", "someKey");
        assertRecordMetadataExists();
    }

    @Test
    public void processSendsMessageWithMessageKeyHeader() throws Exception {
        endpoint.getConfiguration().setTopic("someTopic");
        Mockito.when(exchange.getIn()).thenReturn(in);
        Mockito.when(exchange.getMessage()).thenReturn(out);
        in.setHeader(KafkaConstants.KEY, "someKey");

        producer.process(exchange);

        verifySendMessage("someTopic", "someKey");
        assertRecordMetadataExists();
    }

    @Test
    public void processSendMessageWithTopicHeader() throws Exception {
        endpoint.getConfiguration().setTopic("someTopic");
        Mockito.when(exchange.getIn()).thenReturn(in);
        Mockito.when(exchange.getMessage()).thenReturn(out);
        in.setHeader(KafkaConstants.TOPIC, "anotherTopic");
        in.setHeader(KafkaConstants.KEY, "someKey");
        in.setHeader(KafkaConstants.PARTITION_KEY, 4);

        producer.process(exchange);

        verifySendMessage(4, "someTopic", "someKey");
        assertRecordMetadataExists();
    }

    @Test // Message and Topic Name alone
    public void processSendsMessageWithMessageTopicName() throws Exception {
        endpoint.getConfiguration().setTopic("someTopic");
        Mockito.when(exchange.getIn()).thenReturn(in);
        Mockito.when(exchange.getMessage()).thenReturn(out);

        producer.process(exchange);

        verifySendMessage("someTopic");
        assertRecordMetadataExists();
    }

    @Test
    public void processSendsMessageWithListOfExchangesWithOverrideTopicHeaderOnEveryExchange() throws Exception {
        endpoint.getConfiguration().setTopic("someTopic");
        Mockito.when(exchange.getIn()).thenReturn(in);

        // we set the initial topic
        in.setHeader(KafkaConstants.OVERRIDE_TOPIC, "anotherTopic");
        in.setHeader(KafkaConstants.KEY, "someKey");

        // we add our exchanges in order to aggregate
        final List<Exchange> nestedExchanges = createListOfExchangesWithTopics(Arrays.asList("overridenTopic1", "overridenTopic2", "overridenTopic3"));

        // aggregate
        final Exchange finalAggregatedExchange = aggregateExchanges(nestedExchanges, new GroupedExchangeAggregationStrategy());

        in.setBody(finalAggregatedExchange.getIn().getBody());
        in.setHeaders(finalAggregatedExchange.getIn().getHeaders());

        producer.process(exchange);

        // assert results
        verifySendMessages(Arrays.asList("overridenTopic1", "overridenTopic2", "overridenTopic3"));
        assertRecordMetadataExists(3);
        assertRecordMetadataExistsForEachAggregatedExchange();
    }

    @Test
    public void processSendsMessageWithListOfMessagesWithOverrideTopicHeaderOnEveryExchange() throws Exception {
        endpoint.getConfiguration().setTopic("someTopic");
        Mockito.when(exchange.getIn()).thenReturn(in);

        // we set the initial topic
        in.setHeader(KafkaConstants.OVERRIDE_TOPIC, "anotherTopic");
        in.setHeader(KafkaConstants.KEY, "someKey");

        // we add our exchanges in order to aggregate
        final List<Exchange> nestedExchanges = createListOfExchangesWithTopics(Arrays.asList("overridenTopic1", "overridenTopic2", "overridenTopic3"));

        // aggregate
        final Exchange finalAggregatedExchange = aggregateExchanges(nestedExchanges, new GroupedMessageAggregationStrategy());

        in.setBody(finalAggregatedExchange.getIn().getBody());
        in.setHeaders(finalAggregatedExchange.getIn().getHeaders());

        producer.process(exchange);

        // assert results
        verifySendMessages(Arrays.asList("overridenTopic1", "overridenTopic2", "overridenTopic3"));
        assertRecordMetadataExists(3);
        assertRecordMetadataExistsForEachAggregatedMessage();
    }

    @SuppressWarnings({"unchecked", "rawtypes"})
    protected void verifySendMessage(Integer partitionKey, String topic, String messageKey) {
        ArgumentCaptor<ProducerRecord> captor = ArgumentCaptor.forClass(ProducerRecord.class);
        Mockito.verify(producer.getKafkaProducer()).send(captor.capture());
        assertEquals(partitionKey, captor.getValue().partition());
        assertEquals(messageKey, captor.getValue().key());
        assertEquals(topic, captor.getValue().topic());
    }

    @SuppressWarnings({"unchecked", "rawtypes"})
    protected void verifySendMessage(String topic, String messageKey) {
        ArgumentCaptor<ProducerRecord> captor = ArgumentCaptor.forClass(ProducerRecord.class);
        Mockito.verify(producer.getKafkaProducer()).send(captor.capture());
        assertEquals(messageKey, captor.getValue().key());
        assertEquals(topic, captor.getValue().topic());
    }

    @SuppressWarnings({"unchecked", "rawtypes"})
    protected void verifySendMessage(String topic) {
        ArgumentCaptor<ProducerRecord> captor = ArgumentCaptor.forClass(ProducerRecord.class);
        Mockito.verify(producer.getKafkaProducer()).send(captor.capture());
        assertEquals(topic, captor.getValue().topic());
    }

    @SuppressWarnings({"unchecked", "rawtypes"})
    protected void verifySendMessages(final List<String> expectedTopics) {
        final ArgumentCaptor<ProducerRecord> captor = ArgumentCaptor.forClass(ProducerRecord.class);
        Mockito.verify(producer.getKafkaProducer(), Mockito.atLeast(expectedTopics.size())).send(captor.capture());
        final List<String> actualTopics = captor.getAllValues().stream().map(ProducerRecord::topic).collect(Collectors.toList());

        assertEquals(expectedTopics, actualTopics);
    }

    private void assertRecordMetadataExists() {
        List<RecordMetadata> recordMetaData1 = (List<RecordMetadata>)in.getHeader(KafkaConstants.KAFKA_RECORDMETA);
        assertTrue(recordMetaData1 != null);
        assertEquals("Expected one recordMetaData", recordMetaData1.size(), 1);
        assertTrue(recordMetaData1.get(0) != null);
    }

    private void assertRecordMetadataExists(final int numMetadata) {
        List<RecordMetadata> recordMetaData1 = (List<RecordMetadata>)in.getHeader(KafkaConstants.KAFKA_RECORDMETA);
        assertTrue(recordMetaData1 != null);
        assertEquals("Expected one recordMetaData", recordMetaData1.size(), numMetadata);
        assertTrue(recordMetaData1.get(0) != null);
    }

    private void assertRecordMetadataExistsForEachAggregatedExchange() {
        List<Exchange> exchanges = (List<Exchange>)in.getBody();
        for (Exchange ex : exchanges) {
            List<RecordMetadata> recordMetaData = (List<RecordMetadata>)ex.getMessage().getHeader(KafkaConstants.KAFKA_RECORDMETA);
            assertTrue(recordMetaData != null);
            assertEquals("Expected one recordMetaData", recordMetaData.size(), 1);
            assertTrue(recordMetaData.get(0) != null);
        }
    }

    private void assertRecordMetadataExistsForEachAggregatedMessage() {
        List<Message> messages = (List<Message>)in.getBody();
        for (Message msg : messages) {
            List<RecordMetadata> recordMetaData = (List<RecordMetadata>)msg.getHeader(KafkaConstants.KAFKA_RECORDMETA);
            assertTrue(recordMetaData != null);
            assertEquals("Expected one recordMetaData", recordMetaData.size(), 1);
            assertTrue(recordMetaData.get(0) != null);
        }
    }

    private Exchange aggregateExchanges(final List<Exchange> exchangesToAggregate, final AggregationStrategy strategy) {
        Exchange exchangeHolder = new DefaultExchange(camelContext);

        for (final Exchange innerExchange : exchangesToAggregate) {
            exchangeHolder = strategy.aggregate(exchangeHolder, innerExchange);
        }

        strategy.onCompletion(exchangeHolder);

        return exchangeHolder;
    }

    private List<Exchange> createListOfExchangesWithTopics(final List<String> topics) {
        final List<Exchange> resultLists = new LinkedList<>();

        topics.forEach(topic -> {
            final Exchange innerExchange = new DefaultExchange(camelContext);
            innerExchange.getIn().setHeader(KafkaConstants.OVERRIDE_TOPIC, topic);
            resultLists.add(innerExchange);
        });

        return resultLists;
    }
}


text:
layout: post
title:  "The Arrival of the Carolina Wren in Hamilton"
date:   2016-12-01
excerpt: "How the Hamilton Christmas Bird Count data illustrates the establishment of a booming population of Carolina Wrens in Hamilton."
tag:
- birding
- Christmas Bird Count
- nature
- ornithology
- Carolina Wren
- Hamilton, Ontario
- bird records
comments: false
feature: /assets/img/cbc-onha/carolina-wren-3.jpg
---

{% include_relative cbc-snippet.md %}

## Carolina Wren: A Non-Migratory Resident

I believe it was in the mid-2000s when I first heard a [Carolina Wren](https://www.allaboutbirds.org/guide/Carolina_Wren/sounds){:target="_blank"}. I had no idea what I was hearing -- it was a [very loud bird](http://www.xeno-canto.org/species/Thryothorus-ludovicianus){:target="_blank"} that was surprisingly elusive, and the only bird calls I knew well enough to identify a species were rural farm birds and common urban birds. It wasn't until the rise of [mobile birding apps](http://www.audubon.org/news/the-best-birding-apps-and-field-guides){:target="_blank"}, which had actual recordings of bird species, that I finally identified the loud little wren.

But I hadn't really heard of this wren before, so where did it come from?

Carolina Wren, Princess Point Park, Hamilton, Ontario.

Indeed the Carolina Wren has been pushing its territorial boundaries north for a few decades now. It is non-migratory -- which means like some common birds we see year-round (Black-capped Chickadee, Northern Cardinal) -- they generally do not migrate unless they need to find a new space. They breed and winter in the same territory.

All other wren species known to either breed or overwinter in Hamilton are migratory: the aptly named Winter Wren, also-aptly-named Marsh Wren, the summer-abundant House Wren, and rare and unpredicatable Sedge Wren. (The Sedge Wren is probably the best example of a migratory pattern taken to the extreme: individuals are known to breed in completely different parts of the continent year-to-year, having very low site fidelity.)

What is also of note is that while Carolina Wrens are tiny and like to hide from view, they are not shy when it comes to singing. Like some other resident species, they can be heard singing in the winter. Black-capped Chickadee males are known to also do this, to sing loudly during the coldest days as a way of attracting a mate or reaffirming to a mate that they are strongly suited to not only enduring the winter, but thriving and singing through it.

I've heard multiple Carolina Wrens singing loudly in -20°C weather in Hamilton. So there can be no doubt that when the HCBC data shows the rise in the count of Carolina Wrens, this is not due to the improved ability to find this species with the rise of digital cameras and birding apps, they do indeed call attention to themselves.

### The Data

Hamilton Christmas Bird Count Data, 1953-2015

While the Winter Wren has been following a consistent ebb-and-flow pattern over the last 60 years, Carolina Wrens have been sporatically found in small numbers up until the late 1990s, and since then the count totals for this species have been taking off.

In fact, 2015 was the best year by far for this species, with a count of 64 individuals. The Carolina Wren quickly has surpassed the Winter Wren as the most common wren to find in Hamilton in the winter.

Carolina Wren, Spencer Creek, Dundas, Ontario.

How many more Carolina Wrens could the region be host to? Many of the individuals counted are concentrated within the Cootes-to-Escarpment area, where there is better shelter and presumably more food for these tiny birds. They are also known to visit feeders as well, which also helps sustain the populations through harsh winters.

It was presumed by some that the very harsh 2014-15 winter would cause a significant die-off of the population of Carolina Wrens, but the record showing in late 2015 might very well be proof that our local stock is finally hardy enough to endure the harshest of winters.

A Carolina Wren singing. Loud for such a small bird. Dundas, Ontario #HamOnt #spring pic.twitter.com/06Y566UO4j
— Rob Porter (@rgeraldporter) March 30, 2015

For a while Hamilton was the most northerly range for this species, but it is still on the move northward. While non-migratory normally, as territories of pairs of birds are established some individuals are forced to move on to find territory elsewhere. One very ambitious individual was even found in [Moosonee](http://joshvandermeulen.blogspot.ca/2012/10/more-rarity-photos-from-moosonee.html){:target="_blank"} a couple years ago, though extreme migrants like that often do not establish breeding populations.

Is the Carolina Wren here to stay? Only time will tell, but with rising winter temperatures and plenty of bird feeders in Southern Ontario, it's safe bet this loud little wren will be around for the foreseeable future.

##### Gallery: The Wren Family

Marsh Wren, Sedge Wren, House Wren, Winter Wren


text:
<!DOCTYPE frameset SYSTEM "frameset.dtd">
<frameset>
    <note/>
    <predicate lemma="decoct">
        <note/>
        <roleset framnet="-" id="decoct.01" name="distill into liquid by boiling" vncls="22.1-1-1">
            <roles>
                <role descr="agent, entity doing the decocting" f="" n="0">
                    <vnrole vncls="mix-22.1-1-1" vntheta="agent"/>
                </role>
                <note/>
                <role descr="first or all ingredients" f="" n="1">
                    <vnrole vncls="mix-22.1-1-1" vntheta="patient1"/>
                </role>
                <role descr="additional ingredients, water" f="" n="2">
                    <vnrole vncls="mix-22.1-1-1" vntheta="patient2"/>
                </role>
                <role descr="end state" f="" n="3">
                    <vnrole vncls="" vntheta="product"/>
                </role>
            </roles>
            <note>Roleset based on internet search. Added because none existed. Member of Vncls 22.1-1-1. Comparison to 'distill'. Roleset by Julia.</note>
            <example name="Intransitive" src="Intransitive" type="Intransitive">
                <inflection aspect="ns" form="full" person="third" tense="present" voice="active"/>
                <text>Besides, your druggist-1, who*-1 herborises and decocts, is a man of prejudices.</text>
                <note/>
                <arg f="" n="0">who: [your druggist]</arg>
                <rel f="">decocts</rel>
            </example>
            <example name="Product/materials" src="Product/materials" type="Product/materials">
                <inflection aspect="progressive" form="participle" person="third" tense="past" voice="active"/>
                <text>Mistress Lettice was decocting a face wash from rose leaves, dew and honey.</text>
                <note/>
                <arg f="" n="0">Mistress Lettice</arg>
                <rel f="">was decocting</rel>
                <arg f="" n="3">a face wash</arg>
                <arg f="" n="1">from rose leaves, dew and honey.</arg>
            </example>
            <example name="Passive with 2 patients" src="Passive with 2 patients" type="Passive with 2 patients">
                <inflection aspect="ns" form="participle" person="third" tense="present" voice="passive"/>
                <text>Black tea is decocted into all natural coconut water.</text>
                <note/>
                <arg f="" n="1">black tea</arg>
                <rel f="">is decocted</rel>
                <arg f="" n="2">into all natural coconut water.</arg>
            </example>
            <example name="Patient1 as subject" src="Patient1 as subject" type="Patient1 as subject">
                <inflection aspect="ns" form="full" person="third" tense="present" voice="ns"/>
                <text>Rhizoma Polygoni Cuspidati decocts with other herbs.</text>
                <note/>
                <arg f="" n="1">Rhyzoma Polygoni Cuspidati</arg>
                <rel f="">decocts</rel>
                <arg f="" n="2">with other herbs.</arg>
            </example>
            <example name="product as core arg" src="product as core arg" type="product as core arg">
                <inflection aspect="ns" form="full" person="third" tense="past" voice="active"/>
                <text>For his wintry version, Maloney decocted a coffee flavored syrup.</text>
                <note/>
                <arg f="prp" n="m">For his wintry version,</arg>
                <arg f="" n="0">Maloney</arg>
                <rel f="">decocted</rel>
                <arg f="" n="3">a coffee flavored syrup.</arg>
            </example>
            <example name="metaphorical" src="metaphorical" type="metaphorical">
                <inflection aspect="ns" form="infinitive" person="third" tense="ns" voice="active"/>
                <text>Thou hast taught him *PRO* to decoct his pound into a penny.</text>
                <note/>
                <arg f="" n="0">*PRO*</arg>
                <rel f="">to decoct</rel>
                <arg f="" n="1">his pound</arg>
                <arg f="" n="3">into a penny.</arg>
            </example>
        </roleset>
    </predicate>
</frameset>


text:
'use strict';

var express = require('express'),
    path = require('path'),
    flash = require('connect-flash'),
    passport = require('passport'),
    config = require('./config');

/**
 * Express configuration
 */
module.exports = function(app) {
  app.configure('development', function(){
    app.use(require('connect-livereload')());

    // Disable caching of scripts for easier testing
    app.use(function noCache(req, res, next) {
      if (req.url.indexOf('/scripts/') === 0) {
        res.header('Cache-Control', 'no-cache, no-store, must-revalidate');
        res.header('Pragma', 'no-cache');
        res.header('Expires', 0);
      }
      next();
    });

    app.use(express.static(path.join(config.root, '.tmp')));
    app.use(express.static(path.join(config.root, 'app')));
    app.use(express.errorHandler());
    app.set('views', config.root + '/app/views');
  });

  app.configure('production', function(){
    app.use(express.favicon(path.join(config.root, 'public', 'favicon.ico')));
    app.use(express.static(path.join(config.root, 'public')));
    app.set('views', config.root + '/views');
  });

  app.configure(function(){
    app.engine('html', require('ejs').renderFile);
    app.set('view engine', 'html');
    app.use(express.logger('dev'));
    app.use(express.cookieParser());
    app.use(express.bodyParser());
    app.use(express.methodOverride());
    app.use(express.session({ secret: 'keyboard tower' }));
    app.use(passport.initialize());
    app.use(passport.session());
    app.use(flash());
    // Router needs to be last
    app.use(app.router);
  });
};


text:
const express = require('express');
const app = express();
const watson = require('watson-developer-cloud');

// Bootstrap application settings
require('./config/express')(app);

const stt = new watson.SpeechToTextV1({

  username: "d68b79d9-d9e8-4470-8576-c07585aec2a9",
  password: "f1CoHyfKaYYm"
});

const authService = new watson.AuthorizationV1(stt.getCredentials());

app.get('/', function(req, res) {
  res.render('index', {
    BLUEMIX_ANALYTICS: process.env.BLUEMIX_ANALYTICS,
  });
});

// Get token using your credentials
app.get('/api/token', function(req, res, next) {
  authService.getToken(function(err, token) {
    if (err) {
      next(err);
    } else {
      res.send(token);
    }
  });
});

module.exports = app;


text:
        <side-menu [items]="menuItems" activeIcon="check" (itemClicked)="onItemClicked(item)"></side-menu>

        <side-menu [items]="menuItems2" [alt]="true"></side-menu>


text:
package ezbake.data.image.frack.utilities.pojo;

import java.io.IOException;

import org.apache.thrift.TException;
import org.elasticsearch.common.Base64;

import ezbake.services.indexing.image.thrift.SimilaritySearchQueryImage;

// Union
public class SimilaritySearchQueryImagePojo {
    public String imageId;
    public String imageBinary; // base64-encoded

    public static SimilaritySearchQueryImagePojo fromThrift(SimilaritySearchQueryImage thrift) {
        if (thrift == null) {
            return null;
        }

        final SimilaritySearchQueryImagePojo pojo = new SimilaritySearchQueryImagePojo();

        switch (thrift.getSetField()) {
            case IMAGE_ID:
                pojo.imageId = thrift.getImageId();
                break;
            case IMAGE_BINARY:
                pojo.imageBinary = Base64.encodeBytes(thrift.getImageBinary());
                break;
            default:
                throw new IllegalArgumentException("Unknown field set in union");
        }

        return pojo;
    }

    public static SimilaritySearchQueryImage toThrift(SimilaritySearchQueryImagePojo pojo) throws TException {
        if (pojo == null) {
            return null;
        }

        final SimilaritySearchQueryImage thrift = new SimilaritySearchQueryImage();

        if (pojo.imageId != null) {
            thrift.setImageId(pojo.imageId);
        } else if (pojo.imageBinary != null) {
            try {
                thrift.setImageBinary(Base64.decode(pojo.imageBinary));
            } catch (final IOException e) {
                throw new IllegalArgumentException("Similarity search has invalid image binary");
            }
        } else {
            throw new IllegalArgumentException("No field set in POJO for Thrift union");
        }

        return thrift;
    }
}


text:
/**
 * @author mrdoob / http://mrdoob.com/
 */

THREE.SphereGeometry = function ( radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength ) {

	THREE.Geometry.call( this );

	this.type = 'SphereGeometry';

	this.parameters = {
		radius: radius,
		widthSegments: widthSegments,
		heightSegments: heightSegments,
		phiStart: phiStart,
		phiLength: phiLength,
		thetaStart: thetaStart,
		thetaLength: thetaLength
	};

	this.fromBufferGeometry( new THREE.SphereBufferGeometry( radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength ) );

};

THREE.SphereGeometry.prototype = Object.create( THREE.Geometry.prototype );
THREE.SphereGeometry.prototype.constructor = THREE.SphereGeometry;


text:
<?php
	defined('BASEPATH') OR exit('No direct script access allowed');

	require APPPATH . '/libraries/REST_Controller.php';
	use Restserver\Libraries\REST_Controller;

	require_once APPPATH . '/libraries/BeforeValidException.php';
	require_once APPPATH . '/libraries/ExpiredException.php';
	require_once APPPATH . '/libraries/SignatureInvalidException.php';
	require_once APPPATH . '/libraries/JWT.php';

	use \Firebase\JWT\JWT;

	class User extends REST_Controller {

		function __construct()
		{
			// Construct the parent class
			parent::__construct();

			$this->load->model('userdata');

			// Configure limits on our controller methods
			// Ensure you have created the 'limits' table and enabled 'limits' within application/config/rest.php
			$this->methods['users_get']['limit'] = 500; // 500 requests per hour per user/key
			$this->methods['users_post']['limit'] = 100; // 100 requests per hour per user/key
			$this->methods['users_delete']['limit'] = 50; // 50 requests per hour per user/key
		}

		// register user
		public function register_post(){
			$username = $this->post('username');
			$email = $this->post('email');
			$password = $this->post('password');

			// check for existense
			$user_data = $this->userdata->grab_user_details(array("username" => $username));
			if(!empty($user_data)){
				$error_msg[] = "Username already exists";
			}

			$user_data = $this->userdata->grab_user_details(array("email" => $email));
			if(!empty($user_data)){
				$error_msg[] = "Email already exists";
			}

			if(empty($error_msg)){
				$post_arr = array(
					"username" => $username,
					"email" => $email,
					"password" => $this->defaultdata->getSha256Base64Hash($password),
					"original_password" => $password,
					"is_active" => '1',
					"date_added" => time()
				);

				$last_insert_id = $this->userdata->insert_user($post_arr);
				if($last_insert_id){

					// send mail to user
					$general_settings = $this->defaultdata->grabSettingData();
					$admin_data = $this->userdata->grab_user_details(array("role" => '0'));

					$this->data['site_title'] = preg_replace("(^https?://)", "",$general_settings->siteaddress);
					$this->data['site_logo'] = UPLOAD_LOGO_PATH.$general_settings->logoname;
					$this->data['site_url'] = $general_settings->siteaddress;
					$this->data['user_name'] = $username;
					$this->data['email_address'] = $email;

					$message = $this->load->view('email_template/register', $this->data, true);
					$mail_config = array(
						"from" => $admin_data[0]->email,
						"to" => array($email),
						"subject" => $general_settings->sitename.": New user Registration",
						"message" => $message
					);

					$this->defaultdata->_send_mail($mail_config);
					// Ends

					$token['id'] = $last_insert_id;
					$token['username'] = $username;
					$date = time();
					$token['iat'] = $date;
					$token['exp'] = $date + 60*60;
					$super_secret = $this->config->item('encryption_key');

					$token = JWT::encode($token, $super_secret);

					$response = array(
						"status" => true,
						"message" => "You have been successfully registered",
						"data" => array(
							"username" => $this->post('username'),
							"email" => $this->post('email'),
							"user_discount" => 0,
							"token" => $token
						)
					);
					$this->set_response($response, REST_Controller::HTTP_OK);
				}
			}else{
				$response = array(
						"status" => false,
						"message" => $error_msg
					);
				$this->set_response($response, REST_Controller::HTTP_OK);
			}
		}

		// login functionality
		public function login_post(){
			$username = $this->post('username');
			$password = $this->post('password');

			if($this->defaultdata->checkEmailFormat($username)){
				$cond['email'] = $username;
				$cond['original_password'] = $password;
				$error_msg = 'Improper email/password';
			}else{
				$cond['username'] = $username;
				$cond['original_password'] = $password;
				$error_msg = 'Improper username/password';
			}

			// check for existense
			$user_data = $this->userdata->grab_user_details($cond);
			if(!empty($user_data)){
				$token['id'] = $user_data[0]->user_id;
				$token['username'] = $username;
				$date = time();
				$token['iat'] = $date;
				$token['exp'] = $date + 60*60;
				$super_secret = $this->config->item('encryption_key');

				$token = JWT::encode($token, $super_secret);

				$response = array(
					"status" => true,
					"message" => "You have been successfully authenticated",
					"data" => array(
						"username" => $user_data[0]->username,
						"email" => $user_data[0]->email,
						"user_discount" => $user_data[0]->user_discount,
						"token" => $token
					)
				);
				$this->set_response($response, REST_Controller::HTTP_OK);
			}else{
				$response = array(
					"status" => false,
					"message" => $error_msg
				);
				$this->set_response($response, REST_Controller::HTTP_OK);
			}
		}

		// password recovery
		public function forget_post(){
			$email = $this->post('email');

			// check for email existense
			$user_data = $this->userdata->grab_user_details(array("email" => $email));
			if(!empty($user_data)){
				$password = $this->defaultdata->getGeneratedPassword(8);
				$this->userdata->update_user_details(array("email" => $email), array("password" => $this->defaultdata->getSha256Base64Hash($password), "original_password" => $password));

				// Send mail to user for password recovery
				$general_settings = $this->defaultdata->grabSettingData();
				$admin_data = $this->userdata->grab_user_details(array("role" => '0'));

				$this->data['site_title'] = preg_replace("(^https?://)", "",$general_settings->siteaddress);
				$this->data['site_logo'] = UPLOAD_LOGO_PATH.$general_settings->logoname;
				$this->data['site_url'] = $general_settings->siteaddress;
				$this->data['user_name'] = $user_data[0]->username;
				$this->data['email_address'] = $user_data[0]->email;
				$this->data['password'] = $password;

				$message = $this->load->view('email_template/forget', $this->data, true);
				$mail_config = array(
					"from" => $email,
					"to" => array($admin_data[0]->email),
					"subject" => $general_settings->sitename.": Password Recovery",
					"message" => $message
				);

				$this->defaultdata->_send_mail($mail_config);
				// Ends

				$response = array(
					"status" => true,
					"message" => "Password has been reset. New Password has been generated. An email has been sent to the given email address to get the login details"
				);
				$this->set_response($response, REST_Controller::HTTP_OK);
			}else{
				$response = array(
					"status" => false,
					"message" => "The given email address does not exists"
				);
				$this->set_response($response, REST_Controller::HTTP_OK);
			}
		}

		// fetch all users details
		public function users_get(){
			$token = ($this->post('token')) ?  $this->post('token') : (($this->get('token')) ? $this->get('token') : $this->input->request_headers()['x-access-token']);

			if($token){
				$key = $this->config->item('encryption_key');
				try{
					$decoded = JWT::decode($token, $key, array('HS256'));

					$user_list = $this->userdata->grab_user_details(array("is_active" => '1', "role" => '1'));
					if(!empty($user_list)){
						foreach($user_list AS $key => $user){
							$user_data[$key]['username'] = $user->username;
							$user_data[$key]['email'] = $user->email;
							$user_data[$key]['user_discount'] = $user->user_discount;
						}
						$response = array(
							"status" => true,
							"message" => "Users fetched succesfully",
							"data" => $user_data
						);
					}else{
						$response = array(
							"status" => false,
							"message" => "User not found"
						);
					}
					$this->set_response($response, REST_Controller::HTTP_OK);
				}catch(\Exception $e){
					$response = array(
						"status" => false,
						"message" => $e->getMessage()
					);
					$this->set_response($response, REST_Controller::HTTP_OK);
				}
			}else{
				$this->set_response(array("status" => false, "message" => "Token not found"), REST_Controller::HTTP_OK);
			}
		}

		// fetch specific user details
		public function user_get(){
			$token = ($this->post('token')) ?  $this->post('token') : (($this->get('token')) ? $this->get('token') : $this->input->request_headers()['x-access-token']);

			if($token){
				$key = $this->config->item('encryption_key');
				try{
					$decoded = JWT::decode($token, $key, array('HS256'));

					$user_list = $this->userdata->grab_user_details(array("username" => $decoded->username));
					if(!empty($user_list)){
						foreach($user_list AS $key => $user){
							$user_data['username'] = $user->username;
							$user_data['email'] = $user->email;
							$user_data['user_discount'] = $user->user_discount;
						}
						$response = array(
							"status" => true,
							"message" => "User fetched succesfully",
							"data" => $user_data
						);
					}else{
						$response = array(
							"status" => false,
							"message" => "User not found"
						);
					}
					$this->set_response($response, REST_Controller::HTTP_OK);
				}catch(\Exception $e){
					$response = array(
						"status" => false,
						"message" => $e->getMessage()
					);
					$this->set_response($response, REST_Controller::HTTP_OK);
				}
			}else{
				$this->set_response(array("status" => false, "message" => "Token not found"), REST_Controller::HTTP_OK);
			}
		}
	}
?>


text:
package com.baidu.oped.apm.common;

import static com.baidu.oped.apm.common.HistogramSchema.*;
import static com.baidu.oped.apm.common.ServiceTypeConstants.*;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.baidu.oped.apm.common.util.RpcCodeRange;
import com.baidu.oped.apm.common.util.apache.IntHashMap;

/**
 * @author emeroad
 * @author netspider
 */
public enum ServiceType {

    // Undefined Service Code
    UNDEFINED((short) -1, "UNDEFINED", TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),

    // Callee node that agent hasn't been installed
    UNKNOWN((short) 1, "UNKNOWN", !TERMINAL, RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),

    // User
    USER((short) 2, "USER", !TERMINAL, RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),

    // Group of UNKNOWN,  used only for UI
    UNKNOWN_GROUP((short) 3, "UNKNOWN_GROUP", !TERMINAL, RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),

    // Group of TEST, used for running tests
    TEST((short) 5, "TEST", !TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),

    // Java applications, WAS
    STAND_ALONE((short) 1000, "STAND_ALONE", !TERMINAL, RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),
    TEST_STAND_ALONE((short) 1005, "TEST_STAND_ALONE", !TERMINAL, RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),
    TOMCAT((short) 1010, "TOMCAT", !TERMINAL, RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),
    BLOC((short) 1020, "BLOC", !TERMINAL, RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),
    BLOC_INTERNAL_METHOD((short) 1021, "INTERNAL_METHOD", !TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),
    COLLECTOR((short) 1100, "COLLECTOR", !TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),

    /**
     * Database
     * shown only as xxx_EXECUTE_QUERY at the statistics info section in the server map
     */
    // DB 2000
    UNKNOWN_DB((short) 2050, "UNKNOWN_DB", TERMINAL, !RECORD_STATISTICS, INCLUDE_DESTINATION, NORMAL_SCHEMA),
    UNKNOWN_DB_EXECUTE_QUERY((short) 2051, "UNKNOWN_DB", TERMINAL, RECORD_STATISTICS, INCLUDE_DESTINATION, NORMAL_SCHEMA),

    MYSQL((short) 2100, "MYSQL", TERMINAL, !RECORD_STATISTICS, INCLUDE_DESTINATION, NORMAL_SCHEMA),
    MYSQL_EXECUTE_QUERY((short) 2101, "MYSQL", TERMINAL, RECORD_STATISTICS, INCLUDE_DESTINATION, NORMAL_SCHEMA),

    MSSQL((short) 2200, "MSSQLSERVER", TERMINAL, !RECORD_STATISTICS, INCLUDE_DESTINATION, NORMAL_SCHEMA),
    MSSQL_EXECUTE_QUERY((short) 2201, "MSSQLSERVER", TERMINAL, RECORD_STATISTICS, INCLUDE_DESTINATION, NORMAL_SCHEMA),

    ORACLE((short) 2300, "ORACLE", TERMINAL, !RECORD_STATISTICS, INCLUDE_DESTINATION, NORMAL_SCHEMA),
    ORACLE_EXECUTE_QUERY((short) 2301, "ORACLE", TERMINAL, RECORD_STATISTICS, INCLUDE_DESTINATION, NORMAL_SCHEMA),

    CUBRID((short) 2400, "CUBRID", TERMINAL, !RECORD_STATISTICS, INCLUDE_DESTINATION, NORMAL_SCHEMA),
    CUBRID_EXECUTE_QUERY((short) 2401, "CUBRID", TERMINAL, RECORD_STATISTICS, true, NORMAL_SCHEMA),

    // Internal method
    // FIXME it's not clear to put internal method here. but do that for now.
    INTERNAL_METHOD((short) 5000, "INTERNAL_METHOD", !TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),

    // Spring framework
    SPRING((short) 5050, "SPRING", !TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),
    SPRING_MVC((short) 5051, "SPRING", !TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),
    // FIXME need to define how to handle spring related codes
    SPRING_ORM_IBATIS((short) 5061, "SPRING", !TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),
    SPRING_BEAN((short) 5071, "SPRING_BEAN", !TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),

    // xBatis
    IBATIS((short) 5500, "IBATIS", !TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),
    MYBATIS((short) 5510, "MYBATIS", !TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),

    // DBCP
    DBCP((short) 6050, "DBCP", !TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),

    // Memory cache
    MEMCACHED((short) 8050, "MEMCACHED", TERMINAL, RECORD_STATISTICS, !INCLUDE_DESTINATION, FAST_SCHEMA),
    MEMCACHED_FUTURE_GET((short) 8051, "MEMCACHED", TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, FAST_SCHEMA),
    ARCUS((short) 8100, "ARCUS", TERMINAL, RECORD_STATISTICS, INCLUDE_DESTINATION, FAST_SCHEMA),
    ARCUS_FUTURE_GET((short) 8101, "ARCUS", TERMINAL, !RECORD_STATISTICS, INCLUDE_DESTINATION, FAST_SCHEMA),
    ARCUS_EHCACHE_FUTURE_GET((short) 8102, "ARCUS-EHCACHE", TERMINAL, !RECORD_STATISTICS, INCLUDE_DESTINATION, FAST_SCHEMA),

    // Redis & nBase-ARC
    REDIS((short) 8200, "REDIS", TERMINAL, RECORD_STATISTICS, !INCLUDE_DESTINATION, FAST_SCHEMA),
    NBASE_ARC((short) 8250, "NBASE_ARC", TERMINAL, RECORD_STATISTICS, INCLUDE_DESTINATION, FAST_SCHEMA),

    // Connector, Client
    HTTP_CLIENT((short) 9050, "HTTP_CLIENT", !TERMINAL, RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),
    HTTP_CLIENT_INTERNAL((short) 9051, "HTTP_CLIENT", !TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),
    JDK_HTTPURLCONNECTOR((short) 9055, "JDK_HTTPCONNECTOR", !TERMINAL, RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),
    NPC_CLIENT((short) 9060, "NPC_CLIENT", !TERMINAL, RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),
    NPC_CLIENT_INTERNAL((short) 9061, "NPC_CLIENT", !TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),

    NIMM_CLIENT((short) 9070, "NIMM_CLIENT", !TERMINAL, RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA);

    public static final short WAS_START_INDEX = 1000;
    public static final short WAS_END_INDEX = 2000;

    private final short code;
    private final String desc;
    private final boolean terminal;

    // FIXME record statistics of only rpc call currently. so is it all right to chane into isRecordRpc()
    private final boolean recordStatistics;

    // whether or not print out api including destinationId
    private final boolean includeDestinationId;
    private final HistogramSchema histogramSchema;

    ServiceType(short code, String desc, boolean terminal, boolean recordStatistics, boolean includeDestinationId, HistogramSchema histogramSchema) {
        this.code = code;
        this.desc = desc;
        this.terminal = terminal;
        this.recordStatistics = recordStatistics;
        this.includeDestinationId = includeDestinationId;
        this.histogramSchema = histogramSchema;
    }

    // FIXME it may be not good to find serviceType by using this api
    public static List<ServiceType> findDesc(String desc) {
        if (desc == null) {
            throw new NullPointerException("desc must not be null");
        }
        return STATISTICS_LOOKUP_TABLE.get(desc);
    }

    public boolean isInternalMethod() {
        return this == INTERNAL_METHOD;
    }

    public boolean isRpcClient() {
        return RpcCodeRange.isRpcRange(code);
    }

    public boolean isIndexable() {
        return !terminal && !isRpcClient() && code > 1000;
    }

    // FIXME record statistics of only rpc call currently. so is it all right to chane into isRecordRpc()
    public boolean isRecordStatistics() {
        return recordStatistics;
    }

    public boolean isUnknown() {
        return this == ServiceType.UNKNOWN; // || this == ServiceType.UNKNOWN_CLOUD;
    }

    // return true when the service type is USER or can not be identified
    public boolean isUser() {
        return this == ServiceType.USER;
    }

    public short getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public boolean isTerminal() {
        return terminal;
    }

    public boolean isIncludeDestinationId() {
        return includeDestinationId;
    }

    public HistogramSchema getHistogramSchema() {
        return histogramSchema;
    }

    public boolean isWas() {
        return isWas(this.code);
    }

    public static boolean isWas(final short code) {
        return code >= WAS_START_INDEX && code < WAS_END_INDEX;
    }

    @Override
    public String toString() {
        return desc;
    }

    public static ServiceType findServiceType(short code) {
        ServiceType serviceType = CODE_LOOKUP_TABLE.get(code);
        if (serviceType == null) {
            return UNDEFINED;
            //return UNKNOWN;
        }
        return serviceType;
    }

    private static final IntHashMap<ServiceType> CODE_LOOKUP_TABLE = new IntHashMap<ServiceType>(256);
    private static final Map<String, List<ServiceType>> STATISTICS_LOOKUP_TABLE = new HashMap<String, List<ServiceType>>(64);

    static {
        initializeLookupTable();
        initializeStatisticsLookupTable();
    }

    private static void initializeStatisticsLookupTable() {
        ServiceType[] values = ServiceType.values();
        final Map<String, List<ServiceType>> temp = new HashMap<String, List<ServiceType>>();
        for (ServiceType serviceType : values) {
            if(serviceType.isRecordStatistics()) {
                List<ServiceType> serviceTypeList = STATISTICS_LOOKUP_TABLE.get(serviceType.getDesc());
                if (serviceTypeList == null) {
                    serviceTypeList = new ArrayList<ServiceType>();
                    temp.put(serviceType.getDesc(), serviceTypeList);
                }
                serviceTypeList.add(serviceType);
            }
        }

        // Don't modify
        for (Map.Entry<String, List<ServiceType>> entry : temp.entrySet()) {
            List<ServiceType> serviceTypes = Collections.unmodifiableList(entry.getValue());
            STATISTICS_LOOKUP_TABLE.put(entry.getKey(), serviceTypes);
        }

    }

    private static void initializeLookupTable() {
        ServiceType[] values = ServiceType.values();
        for (ServiceType serviceType : values) {
            ServiceType check = CODE_LOOKUP_TABLE.put(serviceType.code, serviceType);
            if (check != null) {
                throw new IllegalStateException("duplicated code found. code:" + serviceType.code);
            }
        }
    }
}


text:
using System;
using System.Linq;
using UnityEditor;
using UnityEngine;
using UnityEngine.Formats.Alembic.Sdk;
#if UNITY_2020_2_OR_NEWER
using UnityEditor.AssetImporters;
#else
using UnityEditor.Experimental.AssetImporters;
#endif

namespace UnityEditor.Formats.Alembic.Importer
{
    [CustomEditor(typeof(AlembicImporter)), CanEditMultipleObjects]
    internal class AlembicImporterEditor : ScriptedImporterEditor
    {
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            var importer = serializedObject.targetObject as AlembicImporter;
            var pathSettings = "streamSettings.";

            if (importer.IsHDF5)
            {
                EditorGUILayout.HelpBox("Unsupported HDF5 file format detected. Please convert to Ogawa.", MessageType.Error);
                return;
            }

            EditorGUILayout.LabelField("Scene", EditorStyles.boldLabel);
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(serializedObject.FindProperty(pathSettings + "scaleFactor"),
                    new GUIContent("Scale Factor", "How much to scale the models compared to what is in the source file."));
                EditorGUILayout.PropertyField(serializedObject.FindProperty(pathSettings + "swapHandedness"),
                    new GUIContent("Swap Handedness", "Swap X coordinate"));
                EditorGUILayout.PropertyField(serializedObject.FindProperty(pathSettings + "interpolateSamples"),
                    new GUIContent("Interpolate Samples", "Interpolate transforms and vertices (if topology is constant)."));
                EditorGUILayout.Separator();

                EditorGUILayout.PropertyField(serializedObject.FindProperty(pathSettings + "importVisibility"),
                    new GUIContent("Import Visibility", "Import visibility animation."));
                //EditorGUILayout.PropertyField(serializedObject.FindProperty(pathSettings + "importXform"));
                EditorGUILayout.PropertyField(serializedObject.FindProperty(pathSettings + "importCameras"),
                    new GUIContent("Import Cameras", ""));
                EditorGUILayout.PropertyField(serializedObject.FindProperty(pathSettings + "importMeshes"),
                    new GUIContent("Import Meshes", ""));
                EditorGUILayout.PropertyField(serializedObject.FindProperty(pathSettings + "importPoints"),
                    new GUIContent("Import Points", ""));
                var importCurvesProp = serializedObject.FindProperty(pathSettings + "importCurves");
                EditorGUILayout.PropertyField(importCurvesProp, new GUIContent("Import Curves", ""));
                if (importCurvesProp.boolValue == true)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty(pathSettings + "createCurveRenderers"),
                        new GUIContent("Add Curve Renderers", "Automatically add 'AlembicCurvesRenderer' components on curve objects.\nThis allows you to get a basic preview of the Alembic curves in the Scene."));
                }
                EditorGUILayout.Separator();

                // time range
                var startTimeProp = serializedObject.FindProperty("startTime");
                var endTimeProp = serializedObject.FindProperty("endTime");

                EditorGUI.BeginDisabledGroup(startTimeProp.hasMultipleDifferentValues || endTimeProp.hasMultipleDifferentValues);
                var startTime = (float)startTimeProp.doubleValue;
                var endTime = (float)endTimeProp.doubleValue;
                var abcStart = (float)importer.AbcStartTime;
                var abcEnd = (float)importer.AbcEndTime;
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.MinMaxSlider("Time Range", ref startTime, ref endTime, abcStart, abcEnd);

                if (EditorGUI.EndChangeCheck())
                {
                    startTimeProp.doubleValue = startTime;
                    endTime = (float)Math.Round(endTime, 5);
                    endTimeProp.doubleValue = endTime;
                }

                EditorGUILayout.BeginHorizontal();
                EditorGUI.BeginChangeCheck();
                EditorGUI.showMixedValue = startTimeProp.hasMultipleDifferentValues;
                var newStartTime = EditorGUILayout.FloatField(new GUIContent(" ", "Start time"), startTime, GUILayout.MinWidth(90.0f));
                EditorGUI.showMixedValue = endTimeProp.hasMultipleDifferentValues;
                var newEndTime = EditorGUILayout.FloatField(new GUIContent(" ", "End time"), endTime, GUILayout.MinWidth(90.0f));
                EditorGUI.showMixedValue = false;

                if (EditorGUI.EndChangeCheck())
                {
                    startTimeProp.doubleValue = newStartTime;
                    endTimeProp.doubleValue = newEndTime;
                }

                EditorGUILayout.EndHorizontal();

                EditorGUI.EndDisabledGroup();

                GUIStyle style = new GUIStyle();
                style.alignment = TextAnchor.LowerRight;
                style.normal.textColor = Color.gray;
                if (!startTimeProp.hasMultipleDifferentValues && !endTimeProp.hasMultipleDifferentValues)
                {
                    EditorGUILayout.LabelField(new GUIContent((endTime - startTime).ToString("0.000") + "s"), style);
                }
                EditorGUI.indentLevel--;
            }

            EditorGUILayout.LabelField("Geometry", EditorStyles.boldLabel);
            {
                EditorGUI.indentLevel++;
                DisplayEnumProperty(serializedObject.FindProperty(pathSettings + "normals"), Enum.GetNames(typeof(NormalsMode)));
                DisplayEnumProperty(serializedObject.FindProperty(pathSettings + "tangents"), Enum.GetNames(typeof(TangentsMode)));
                EditorGUILayout.PropertyField(serializedObject.FindProperty(pathSettings + "flipFaces"));
                EditorGUI.indentLevel--;
            }
            EditorGUILayout.Separator();

            EditorGUILayout.LabelField("Cameras", EditorStyles.boldLabel);
            {
                EditorGUI.indentLevel++;
                DisplayEnumProperty(serializedObject.FindProperty(pathSettings + "cameraAspectRatio"), Enum.GetNames(typeof(AspectRatioMode)),
                    new GUIContent("Aspect Ratio", ""));
                EditorGUI.indentLevel--;
            }
            EditorGUILayout.Separator();

            serializedObject.ApplyModifiedProperties();
            base.ApplyRevertGUI();
        }

        internal static void DisplayEnumProperty(SerializedProperty prop, string[] displayNames, GUIContent guicontent = null)
        {
            if (guicontent == null)
                guicontent = new GUIContent(prop.displayName);

            var rect = EditorGUILayout.GetControlRect();
            EditorGUI.BeginProperty(rect, guicontent, prop);
            EditorGUI.showMixedValue = prop.hasMultipleDifferentValues;
            EditorGUI.BeginChangeCheck();

            var options = new GUIContent[displayNames.Length];
            for (int i = 0; i < options.Length; ++i)
                options[i] = new GUIContent(ObjectNames.NicifyVariableName(displayNames[i]), "");

            var normalsModeNew = EditorGUI.Popup(rect, guicontent, prop.intValue, options);
            if (EditorGUI.EndChangeCheck())
                prop.intValue = normalsModeNew;

            EditorGUI.showMixedValue = false;
            EditorGUI.EndProperty();
        }
    }
}

#endif


text:
#include <QtCore/qglobal.h>

#ifndef QTYPEINFO_H
#define QTYPEINFO_H

QT_BEGIN_NAMESPACE

/*
   QTypeInfo     - type trait functionality
*/

/*
  The catch-all template.
*/

template <typename T>
class QTypeInfo
{
public:
    enum {
        isPointer = false,
        isIntegral = std::is_integral<T>::value,
        isComplex = true,
        isStatic = true,
        isRelocatable = std::is_enum<T>::value,
        isLarge = (sizeof(T)>sizeof(void*)),
        isDummy = false, //### Qt6: remove
        sizeOf = sizeof(T)
    };
};

template<>
class QTypeInfo<void>
{
public:
    enum {
        isPointer = false,
        isIntegral = false,
        isComplex = false,
        isStatic = false,
        isRelocatable = false,
        isLarge = false,
        isDummy = false,
        sizeOf = 0
    };
};

template <typename T>
class QTypeInfo<T*>
{
public:
    enum {
        isPointer = true,
        isIntegral = false,
        isComplex = false,
        isStatic = false,
        isRelocatable = true,
        isLarge = false,
        isDummy = false,
        sizeOf = sizeof(T*)
    };
};

/*!
    \class QTypeInfoQuery
    \inmodule QtCore
    \internal
    \brief QTypeInfoQuery is used to query the values of a given QTypeInfo<T>

    We use it because there may be some QTypeInfo<T> specializations in user
    code that don't provide certain flags that we added after Qt 5.0. They are:
    \list
      \li isRelocatable: defaults to !isStatic
    \endlist

    DO NOT specialize this class elsewhere.
*/
// apply defaults for a generic QTypeInfo<T> that didn't provide the new values
template <typename T, typename = void>
struct QTypeInfoQuery : public QTypeInfo<T>
{
    enum { isRelocatable = !QTypeInfo<T>::isStatic };
};

// if QTypeInfo<T>::isRelocatable exists, use it
template <typename T>
struct QTypeInfoQuery<T, typename QtPrivate::QEnableIf<QTypeInfo<T>::isRelocatable || true>::Type> : public QTypeInfo<T>
{};

/*!
    \class QTypeInfoMerger
    \inmodule QtCore
    \internal

    \brief QTypeInfoMerger merges the QTypeInfo flags of T1, T2... and presents them
    as a QTypeInfo<T> would do.

    Let's assume that we have a simple set of structs:

    \snippet code/src_corelib_global_qglobal.cpp 50

    To create a proper QTypeInfo specialization for A struct, we have to check
    all sub-components; B, C and D, then take the lowest common denominator and call
    Q_DECLARE_TYPEINFO with the resulting flags. An easier and less fragile approach is to
    use QTypeInfoMerger, which does that automatically. So struct A would have
    the following QTypeInfo definition:

    \snippet code/src_corelib_global_qglobal.cpp 51
*/
template <class T, class T1, class T2 = T1, class T3 = T1, class T4 = T1>
class QTypeInfoMerger
{
public:
    enum {
        isComplex = QTypeInfoQuery<T1>::isComplex || QTypeInfoQuery<T2>::isComplex
                    || QTypeInfoQuery<T3>::isComplex || QTypeInfoQuery<T4>::isComplex,
        isStatic = QTypeInfoQuery<T1>::isStatic || QTypeInfoQuery<T2>::isStatic
                    || QTypeInfoQuery<T3>::isStatic || QTypeInfoQuery<T4>::isStatic,
        isRelocatable = QTypeInfoQuery<T1>::isRelocatable && QTypeInfoQuery<T2>::isRelocatable
                    && QTypeInfoQuery<T3>::isRelocatable && QTypeInfoQuery<T4>::isRelocatable,
        isLarge = sizeof(T) > sizeof(void*),
        isPointer = false,
        isIntegral = false,
        isDummy = false,
        sizeOf = sizeof(T)
    };
};

#define Q_DECLARE_MOVABLE_CONTAINER(CONTAINER) \
template <typename T> class CONTAINER; \
template <typename T> \
class QTypeInfo< CONTAINER<T> > \
{ \
public: \
    enum { \
        isPointer = false, \
        isIntegral = false, \
        isComplex = true, \
        isRelocatable = true, \
        isStatic = false, \
        isLarge = (sizeof(CONTAINER<T>) > sizeof(void*)), \
        isDummy = false, \
        sizeOf = sizeof(CONTAINER<T>) \
    }; \
}

Q_DECLARE_MOVABLE_CONTAINER(QList);
Q_DECLARE_MOVABLE_CONTAINER(QVector);
Q_DECLARE_MOVABLE_CONTAINER(QQueue);
Q_DECLARE_MOVABLE_CONTAINER(QStack);
Q_DECLARE_MOVABLE_CONTAINER(QLinkedList);
Q_DECLARE_MOVABLE_CONTAINER(QSet);

#undef Q_DECLARE_MOVABLE_CONTAINER

/* These cannot be movable before ### Qt 6, for BC reasons */
#define Q_DECLARE_MOVABLE_CONTAINER(CONTAINER) \
template <typename K, typename V> class CONTAINER; \
template <typename K, typename V> \
class QTypeInfo< CONTAINER<K, V> > \
{ \
public: \
    enum { \
        isPointer = false, \
        isIntegral = false, \
        isComplex = true, \
        isStatic = (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)), \
        isRelocatable = true, \
        isLarge = (sizeof(CONTAINER<K, V>) > sizeof(void*)), \
        isDummy = false, \
        sizeOf = sizeof(CONTAINER<K, V>) \
    }; \
}

Q_DECLARE_MOVABLE_CONTAINER(QMap);
Q_DECLARE_MOVABLE_CONTAINER(QMultiMap);
Q_DECLARE_MOVABLE_CONTAINER(QHash);
Q_DECLARE_MOVABLE_CONTAINER(QMultiHash);

#undef Q_DECLARE_MOVABLE_CONTAINER

/*
   Specialize a specific type with:

     Q_DECLARE_TYPEINFO(type, flags);

   where 'type' is the name of the type to specialize and 'flags' is
   logically-OR'ed combination of the flags below.
*/
enum { /* TYPEINFO flags */
    Q_COMPLEX_TYPE = 0,
    Q_PRIMITIVE_TYPE = 0x1,
    Q_STATIC_TYPE = 0,
    Q_MOVABLE_TYPE = 0x2,               // ### Qt6: merge movable and relocatable once QList no longer depends on it
    Q_DUMMY_TYPE = 0x4,
    Q_RELOCATABLE_TYPE = 0x8
};

#define Q_DECLARE_TYPEINFO_BODY(TYPE, FLAGS) \
class QTypeInfo<TYPE > \
{ \
public: \
    enum { \
        isComplex = (((FLAGS) & Q_PRIMITIVE_TYPE) == 0), \
        isStatic = (((FLAGS) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), \
        isRelocatable = !isStatic || ((FLAGS) & Q_RELOCATABLE_TYPE), \
        isLarge = (sizeof(TYPE)>sizeof(void*)), \
        isPointer = false, \
        isIntegral = std::is_integral< TYPE >::value, \
        isDummy = (((FLAGS) & Q_DUMMY_TYPE) != 0), \
        sizeOf = sizeof(TYPE) \
    }; \
    static inline const char *name() { return #TYPE; } \
}

#define Q_DECLARE_TYPEINFO(TYPE, FLAGS) \
template<> \
Q_DECLARE_TYPEINFO_BODY(TYPE, FLAGS)

/* Specialize QTypeInfo for QFlags<T> */
template<typename T> class QFlags;
template<typename T>
Q_DECLARE_TYPEINFO_BODY(QFlags<T>, Q_PRIMITIVE_TYPE);

/*
   Specialize a shared type with:

     Q_DECLARE_SHARED(type)

   where 'type' is the name of the type to specialize.  NOTE: shared
   types must define a member-swap, and be defined in the same
   namespace as Qt for this to work.

   If the type was already released without Q_DECLARE_SHARED applied,
   _and_ without an explicit Q_DECLARE_TYPEINFO(type, Q_MOVABLE_TYPE),
   then use Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(type) to mark the
   type shared (incl. swap()), without marking it movable (which
   would change the memory layout of QList, a BiC change.
*/

#define Q_DECLARE_SHARED_IMPL(TYPE, FLAGS) \
Q_DECLARE_TYPEINFO(TYPE, FLAGS); \
inline void swap(TYPE &value1, TYPE &value2) \
    Q_DECL_NOEXCEPT_EXPR(noexcept(value1.swap(value2))) \
{ value1.swap(value2); }
#define Q_DECLARE_SHARED(TYPE) Q_DECLARE_SHARED_IMPL(TYPE, Q_MOVABLE_TYPE)
#define Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(TYPE) \
                               Q_DECLARE_SHARED_IMPL(TYPE, QT_VERSION >= QT_VERSION_CHECK(6,0,0) ? Q_MOVABLE_TYPE : Q_RELOCATABLE_TYPE)

/*
   QTypeInfo primitive specializations
*/
Q_DECLARE_TYPEINFO(bool, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(char, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(signed char, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(uchar, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(short, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(ushort, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(int, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(uint, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(long, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(ulong, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(qint64, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(quint64, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(float, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(double, Q_PRIMITIVE_TYPE);
#ifndef Q_OS_DARWIN
Q_DECLARE_TYPEINFO(long double, Q_PRIMITIVE_TYPE);
#endif

#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
// ### Qt 6: remove the other branch
// This was required so that QList<T> for these types allocates out of the array storage
#  ifdef Q_COMPILER_UNICODE_STRINGS
Q_DECLARE_TYPEINFO(char16_t, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(char32_t, Q_PRIMITIVE_TYPE);
#  endif
#  if !defined(Q_CC_MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
Q_DECLARE_TYPEINFO(wchar_t, Q_PRIMITIVE_TYPE);
#  endif
#else
#  ifdef Q_COMPILER_UNICODE_STRINGS
Q_DECLARE_TYPEINFO(char16_t, Q_RELOCATABLE_TYPE);
Q_DECLARE_TYPEINFO(char32_t, Q_RELOCATABLE_TYPE);
#  endif
#  if !defined(Q_CC_MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
Q_DECLARE_TYPEINFO(wchar_t, Q_RELOCATABLE_TYPE);
#  endif
#endif // Qt 6

QT_END_NAMESPACE
#endif // QTYPEINFO_H


text:
class Profile;

namespace extensions {

class ExtensionManagedModeEventRouter {
 public:
  explicit ExtensionManagedModeEventRouter(Profile* profile);
  virtual ~ExtensionManagedModeEventRouter();

 private:
  void OnInManagedModeChanged();

  PrefChangeRegistrar registrar_;
  Profile* profile_;

  DISALLOW_COPY_AND_ASSIGN(ExtensionManagedModeEventRouter);
};

class GetManagedModeFunction : public SyncExtensionFunction {
 public:
  DECLARE_EXTENSION_FUNCTION_NAME("managedModePrivate.get")

 protected:
  virtual ~GetManagedModeFunction();

  // ExtensionFunction:
  virtual bool RunImpl() OVERRIDE;
};

class EnterManagedModeFunction : public AsyncExtensionFunction {
 public:
  DECLARE_EXTENSION_FUNCTION_NAME("managedModePrivate.enter")

 protected:
  virtual ~EnterManagedModeFunction();

  // ExtensionFunction:
  virtual bool RunImpl() OVERRIDE;

 private:
  // Called when we have either successfully entered managed mode or failed.
  void SendResult(bool success);
};

class GetPolicyFunction : public SyncExtensionFunction {
 public:
  DECLARE_EXTENSION_FUNCTION_NAME("managedModePrivate.getPolicy")

 protected:
  virtual ~GetPolicyFunction();

  // ExtensionFunction:
  virtual bool RunImpl() OVERRIDE;
};

class SetPolicyFunction : public SyncExtensionFunction {
 public:
  DECLARE_EXTENSION_FUNCTION_NAME("managedModePrivate.setPolicy")

 protected:
  virtual ~SetPolicyFunction();

  // ExtensionFunction:
  virtual bool RunImpl() OVERRIDE;
};

}  // namespace extensions

#endif  // CHROME_BROWSER_EXTENSIONS_API_MANAGED_MODE_MANAGED_MODE_API_H_


text:
<?xml version="1.0" encoding="utf-8"?>
<fragment
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:name="fr.lassiergedeon.dontbreakthechain.TaskViewerFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/detailView_fragment">
</fragment>


text:
layout: page
status: publish
published: true
title: UI and Shell
author:
  display_name: Tomas Restrepo
  login: tomasr
  email: tomas@winterdom.com
  url: http://winterdom.com/
author_login: tomasr
author_email: tomas@winterdom.com
author_url: http://winterdom.com/
wordpress_id: 1159
wordpress_url: http://winterdom.com/?page_id=1159
date: '2009-04-29 00:59:16 +0000'
date_gmt: '2009-04-29 00:59:16 +0000'
categories:
- Uncategorized
tags: []
comments: []
---

Here you'll find small articles on User Interface and Shell stuff. Don't expect these pages to be updated too often, because I don't do much UI stuff anymore.

If you want more shell samples, you should check out Chris Becke's excellent page at http://www.mvps.org/user32/

Getting an ITEMIDLIST for a Path

A simple function to use with SHBrowseForFolder() and other shell calls

The Windows NT internal WND structure

A work in progress on the internal window structures in WinNT.

WND Dump

The code written to dump the Windows NT internal WND structure information.


text:
NS_ASSUME_NONNULL_BEGIN

UIKIT_EXTERN NSString * const KMYUIItemKeyCollectionViewCellReuseIdentifier;
UIKIT_EXTERN NSString * const KMYUIItemKeyCollectionViewSupplementaryViewReuseIdentifier;

@interface KMYUISection (CollectionView)

@property (nonatomic, readonly, nullable)   NSString    *collectionViewSupplementaryViewReuseIdentifier;

@end

@interface KMYUIItem (CollectionView)

@property (nonatomic, readonly, nullable)   NSString    *collectionViewCellReuseIdentifier;
@property (nonatomic, readonly, nullable)   NSString    *collectionViewSupplementaryViewReuseIdentifier;

@end

NS_ASSUME_NONNULL_END


text:
/* ###
 * IP: GHIDRA
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package agent.dbgeng.model.impl;

import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;

import agent.dbgeng.dbgeng.DebugSessionId;
import agent.dbgeng.manager.*;
import agent.dbgeng.model.iface1.DbgModelSelectableObject;
import agent.dbgeng.model.iface1.DbgModelTargetInterpreter;
import agent.dbgeng.model.iface2.DbgModelTargetProcessContainer;
import agent.dbgeng.model.iface2.DbgModelTargetSession;
import ghidra.dbg.target.schema.*;
import ghidra.dbg.util.PathUtils;

@TargetObjectSchemaInfo(
	name = "Session",
	elements = {
		@TargetElementType(type = Void.class) },
	attributes = {
		@TargetAttributeType(
			name = "Attributes",
			type = DbgModelTargetSessionAttributesImpl.class,
			fixed = true),
		@TargetAttributeType(
			name = "Processes",
			type = DbgModelTargetProcessContainerImpl.class,
			required = true,
			fixed = true),
		@TargetAttributeType(type = Void.class) })
public class DbgModelTargetSessionImpl extends DbgModelTargetObjectImpl
		implements DbgModelTargetSession {

	protected static final String DBG_PROMPT = "(kd)";
	private Integer base = 16;

	// NB: This should almost certainly always be implemented by the root of the object tree

	protected static String indexSession(DebugSessionId debugSystemId) {
		return PathUtils.makeIndex(debugSystemId.id);
	}

	protected static String indexSession(DbgSession session) {
		return indexSession(session.getId());
	}

	protected static String keySession(DbgSession session) {
		return PathUtils.makeKey(indexSession(session));
	}

	protected final DbgModelTargetSessionAttributesImpl attributes;
	protected final DbgModelTargetProcessContainerImpl processes;
	private DbgModelSelectableObject focus;

	protected String debugger = "kd"; // Used by DbgModelTargetEnvironment

	public DbgModelTargetSessionImpl(DbgModelTargetSessionContainerImpl sessions,
			DbgSession session) {
		super(sessions.getModel(), sessions, keySession(session), "Session");
		this.getModel().addModelObject(session, this);

		this.attributes = new DbgModelTargetSessionAttributesImpl(this);
		this.processes = new DbgModelTargetProcessContainerImpl(this);

		changeAttributes(List.of(), List.of( //
			attributes, //
			processes //
		), Map.of( //
			ACCESSIBLE_ATTRIBUTE_NAME, accessible, //
			PROMPT_ATTRIBUTE_NAME, DbgModelTargetInterpreter.DBG_PROMPT, //
			STATE_ATTRIBUTE_NAME, TargetExecutionState.ALIVE //
		), "Initialized");

		getManager().addEventsListener(this);
	}

	@Override
	public CompletableFuture<Void> setActive() {
		//DbgManagerImpl manager = getManager();
		//DbgProcessImpl process = manager.getCurrentProcess();
		//return manager.execute(new DbgProcessSelectCommand(manager, process));
		return CompletableFuture.completedFuture(null);
	}

	@Override
	public boolean isAccessible() {
		return accessible;
	}

	@Override
	public DbgModelTargetProcessContainer getProcesses() {
		return processes;
	}

	@Override
	public void threadStateChanged(DbgThread thread, DbgState state, DbgCause cause,
			DbgReason reason) {
		TargetExecutionState targetState = convertState(state);
		setExecutionState(targetState, "ThreadStateChanged");
	}

}