text:
const publicUserRoutes = require('./publicUserRoutes');
const protectedUserRoutes = require('./protectedUserRoutes');

module.exports = {
  protectedUserRoutes,
  publicUserRoutes
};


text:
namespace Fortran::evaluate {

template <int KIND>
Expr<Type<TypeCategory::Complex, KIND>> FoldIntrinsicFunction(
    FoldingContext &context,
    FunctionRef<Type<TypeCategory::Complex, KIND>> &&funcRef) {
  using T = Type<TypeCategory::Complex, KIND>;
  ActualArguments &args{funcRef.arguments()};
  auto *intrinsic{std::get_if<SpecificIntrinsic>(&funcRef.proc().u)};
  CHECK(intrinsic);
  std::string name{intrinsic->name};
  if (name == "acos" || name == "acosh" || name == "asin" || name == "asinh" ||
      name == "atan" || name == "atanh" || name == "cos" || name == "cosh" ||
      name == "exp" || name == "log" || name == "sin" || name == "sinh" ||
      name == "sqrt" || name == "tan" || name == "tanh") {
    if (auto callable{context.hostIntrinsicsLibrary()
                          .GetHostProcedureWrapper<Scalar, T, T>(name)}) {
      return FoldElementalIntrinsic<T, T>(
          context, std::move(funcRef), *callable);
    } else {
      context.messages().Say(
          "%s(complex(kind=%d)) cannot be folded on host"_en_US, name, KIND);
    }
  } else if (name == "conjg") {
    return FoldElementalIntrinsic<T, T>(
        context, std::move(funcRef), &Scalar<T>::CONJG);
  } else if (name == "cmplx") {
    using Part = typename T::Part;
    if (args.size() == 1) {
      if (auto *x{UnwrapExpr<Expr<SomeComplex>>(args[0])}) {
        return Fold(context, ConvertToType<T>(std::move(*x)));
      }
      Expr<SomeType> re{std::move(*args[0].value().UnwrapExpr())};
      Expr<SomeType> im{AsGenericExpr(Constant<Part>{Scalar<Part>{}})};
      return Fold(context,
          Expr<T>{ComplexConstructor<KIND>{ToReal<KIND>(context, std::move(re)),
              ToReal<KIND>(context, std::move(im))}});
    }
    CHECK(args.size() == 2 || args.size() == 3);
    Expr<SomeType> re{std::move(*args[0].value().UnwrapExpr())};
    Expr<SomeType> im{args[1] ? std::move(*args[1].value().UnwrapExpr())
                              : AsGenericExpr(Constant<Part>{Scalar<Part>{}})};
    return Fold(context,
        Expr<T>{ComplexConstructor<KIND>{ToReal<KIND>(context, std::move(re)),
            ToReal<KIND>(context, std::move(im))}});
  } else if (name == "merge") {
    return FoldMerge<T>(context, std::move(funcRef));
  }
  // TODO: cshift, dot_product, eoshift, matmul, pack, product,
  // reduce, spread, sum, transfer, transpose, unpack
  return Expr<T>{std::move(funcRef)};
}

template <int KIND>
Expr<Type<TypeCategory::Complex, KIND>> FoldOperation(
    FoldingContext &context, ComplexConstructor<KIND> &&x) {
  if (auto array{ApplyElementwise(context, x)}) {
    return *array;
  }
  using Result = Type<TypeCategory::Complex, KIND>;
  if (auto folded{OperandsAreConstants(x)}) {
    return Expr<Result>{
        Constant<Result>{Scalar<Result>{folded->first, folded->second}}};
  }
  return Expr<Result>{std::move(x)};
}

FOR_EACH_COMPLEX_KIND(template class ExpressionBase, )
template class ExpressionBase<SomeComplex>;
} // namespace Fortran::evaluate

redpajama_set_name: RedPajamaGithub


text:
package com.intel.analytics.bigdl.torch

import com.intel.analytics.bigdl.nn.MultiLabelSoftMarginCriterion
import com.intel.analytics.bigdl.tensor.Tensor
import org.scalatest.{BeforeAndAfter, FlatSpec, Matchers}

@com.intel.analytics.bigdl.tags.Serial
class MultiLabelSoftMarginCriterionSpec extends FlatSpec with BeforeAndAfter with Matchers{
  before {
    if (!TH.hasTorch()) {
      cancel("Torch is not installed")
    }
  }

  "A MultiLabelSoftMarginCriterion Criterion " should
    "generate correct output and grad" in {
    val criterion = new MultiLabelSoftMarginCriterion[Double]()

    val input = Tensor[Double](3)
    input(Array(1)) = 0.4
    input(Array(2)) = 0.5
    input(Array(3)) = 0.6

    val target = Tensor[Double](3)
    target(Array(1)) = 0
    target(Array(2)) = 1
    target(Array(3)) = 1

    val start = System.nanoTime()
    val output = criterion.forward(input, target)
    val gradInput = criterion.backward(input, target)
    val end = System.nanoTime()
    val scalaTime = end - start

    val code = "abs = nn.MultiLabelSoftMarginCriterion()\n" +
      "output = abs:forward(input, target)\n " +
      "gradInput = abs:backward(input, target)"

    val (luaTime, torchResult) = TH.run(code, Map("input" -> input, "target" -> target),
      Array("output", "gradInput"))
    val luaOutput1 = torchResult("output").asInstanceOf[Double]
    val luaOutput2 = torchResult("gradInput").asInstanceOf[Tensor[Double]]

    luaOutput1 should be(output)
    luaOutput2 should be(gradInput)

    println("Test case : MultiLabelSoftMarginCriterion, Torch : " +
      luaTime + " s, Scala : " + scalaTime / 1e9 + " s")
  }

}


text:
The teacher got "ana" package, which was done also with MVC pattern. We got 14 out of 15. MVC was not asked, but anyway.

> a) Programmieren Sie eine Swing-Oberfläche für die CashMachine (Aufgabe 1)!
>
> Der Benutzer soll über die Oberfläche die Kontonummer eingeben können (das simuliert die Eingabe einer CashCard). Die Überprüfung der Existenz des Kontos erfolgt durch die Betätigung einer Schaltfläche. Ist das Konto vorhanden, soll es möglich sein den PIN einzugeben und zu bestätigen.
>
> Ist eine korrekte Kontonummer angegeben oder der PIN korrekt eingegeben, soll eine Kontoinformationenabfrage möglich sein (in beiden Fällen).
>
> Ist der PIN korrekt eingegeben soll es möglich sein aus einer Auswahl festgelegte Geldbeträge vom Konto abzuheben.
>
> Die Zustände und Meldungen sollen auf der Oberfläche in einem Informationsbereich angezeigt werden (z.B. mittels eines JLabel-Objekts), Expections sollen weiterhin zusätzlich auf der Konsole ausgegeben werden. Die Logik des Programmes soll dabei durch Wiederverwendung der Klasse CashMachine aus Aufgabe 1 erfolgen!
>
> Im Prinzip sind Sie frei die Oberfläche zu gestalten (Komponenten, Layout, etc.). Eine Möglichkeit wäre es für die Eingaben (Kontonr, PIN) die Klasse JTextField zu nutzen. Für die Bestätigung oder den Abfragen wären Button (Klasse JButton) möglich und für die Wahl der Geldbeträge eine Auswahlbox (Klasse JComboxBox).
>
> Achtung: Fehlerhafte Eingaben müssen erkannt, die entsprechenden Exceptions abgefangen und geeignete Hinweise den Benutzern im Informationsbereich angezeigt werden.
>
> Geldautomat
>
> Abb. 1: Beispiel Oberfläche für die CashMachine
>
> b)
>
> Ändern Sie das Abheben so ab, dass zusätzlich zur Auswahl eines vorgegebenen Betrags ein Betrag frei eingegeben werden kann. Die Oberfläche muss jedoch verhindern, dass gleichzeitig ein vorgegebener Betrag ausgewählt und ein freier Betrag eingegeben werden kann. Nutzen Sie für die Lösung die Klasse JRadioButton, mit der ein Nutzer auswählen kann ob die Auswahl eines vorgegebenen Betrags oder die Eingabe eines freien Betrags berücksichtigt werden soll.


text:
package ru.job4j.strategy;

import org.junit.Test;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

/**Testing Paint.*/
public class PaintTest {

	/**Testing draw().*/
	@Test
	public void whenTriangleThenDrawsTriangle() {
		ByteArrayOutputStream out = new ByteArrayOutputStream();
		System.setOut(new PrintStream(out));
		Paint paint = new Paint();
		paint.draw(new Triangle());
		StringBuilder str = new StringBuilder().append("   ^   \n")
								.append("  ^ ^  \n")
								.append(" ^   ^ \n")
								.append("^^^^^^^\n");
		assertThat(out.toString(), is(str.toString()));
	}

	/**Testing draw().*/
	@Test
	public void whenSquareThenDrawsSquare() {
		ByteArrayOutputStream out = new ByteArrayOutputStream();
		System.setOut(new PrintStream(out));
		Paint paint = new Paint();
		paint.draw(new Square());
		StringBuilder str = new StringBuilder().append("^^^^^^^\n")
								.append("^     ^\n")
								.append("^     ^\n")
								.append("^     ^\n")
								.append("^^^^^^^\n");
		assertThat(out.toString(), is(str.toString()));
	}

}


text:
use clap::{App, Arg};

fn main() {
    let matches = App::new("Number Printer")
        .about("Print some numbers")
        .arg(Arg::with_name("rng").help("Print a random number"))
        .arg(
            Arg::with_name("num")
                .help("Print this number")
                .takes_value(true),
        )
        .get_matches();

    let num = match matches.value_of("num") {
        Some(value) => value.parse::<i32>().unwrap(),
        None => 1337,
    };

    if matches.is_present("rng") {
        println!("{}", printer::say_random_number());
    } else {
        println!("{}", printer::say_number(num));
    }
}


text:
using System;
using System.Linq;

namespace _04.CharacterMultiplier
{
    class CharacterMultiplier
    {
        static void Main()
        {
            string[] input = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            string firstString = input[0];
            string secondString = input[1];

            int sum = 0;

            if (firstString.Length > secondString.Length)
            {
                sum = CalculateChars(secondString, firstString);
            }
            else if (secondString.Length > firstString.Length)
            {
                sum = CalculateChars(firstString, secondString);
            }
            else
            {
                for (int i = 0; i < firstString.Length; i++)
                {
                    sum += firstString[i] * secondString[i];
                }
            }

            Console.WriteLine(sum);
        }

        static int CalculateChars(string shortStr, string longStr)
        {
            int sum = 0;

            for (int i = 0; i < shortStr.Length; i++)
            {
                sum += shortStr[i] * longStr[i];
            }

            char[] arr = longStr.ToCharArray().Skip(shortStr.Length).ToArray();

            for (int i = 0; i < arr.Length; i++)
            {
                sum += arr[i];
            }

            return sum;
        }
    }
}


text:
class SignalHistory
	include Mongoid::Document
	field :signalable_type
	field :signalable_id
	field :end_at, :type => Integer
	field :signal_id, :type => Object
	field :user_id, :type => Object

	index([:user_id, :signalable_type, :signalable_id])
	index :end_at

	attr_protected :_id

	store_in :signal_histories

	def self.clean(time =nil)
		time ||= Time.new.to_i
 		Mongoid::Persistence::RemoveAll.new(SignalHistory, {}, {:end_at => {'$lt' => time.to_i}}).persist
	end

	def self.find_for(instance, user, time)
		SignalHistory.where(:user_id => user.id, :signalable_type => instance.class.name, :signalable_id => instance.id,  :end_at.gt => time.to_i)
	end
end


text:
import {Component, Input} from '@angular/core';

import {Property} from '../../../backend/utils';

@Component({
  selector: 'node-attributes',
  template: require('./node-attributes.html'),
  styles: [require('to-string!./node-attributes.css')],
})
export class NodeAttributes {
  @Input() private attributes: Array<Property>;
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
N. Z. Jl Bot. 17(2): 152 (1979)

#### Original name
Endophragmia oblonga Matsush.

### Remarks
null


text:
import { NgModule } from '@angular/core';
import { BrowserModule} from '@angular/platform-browser';
import { routing } from './app.routing';

// Application components
import { AppComponent } from './app.component';
import { TabsComponent } from './components/tabs/tabs.component';
import { TabComponent } from './components/tabs/tab/tab.component';
import { HeaderComponent } from './components/common/header/header.component';
import { TableComponent } from './components/table/table.component';
import { CorrectScoreComponent } from './components/correctScore/correctScore.component';
import { ResultBetsComponent } from './components/resultBets/resultBets.component';
import { ResultBetComponent } from './components/resultBets/resultBet/resultBet.component';

// Pipes
import { CorrectScorePipe } from './pipes/filterCorrectScore.pipe';

@NgModule({
    declarations: [
      AppComponent,
      TabsComponent,
      TabComponent,
      HeaderComponent,
      TableComponent,
      CorrectScoreComponent,
      CorrectScorePipe,
      ResultBetsComponent,
      ResultBetComponent
      ], //defines which components we are going to use in this module
    imports: [BrowserModule, routing], //describes which dependencies this module has
    bootstrap: [AppComponent] //this property tells Angular to load, in this case, App component as the top-level component.
})

export class AppModule {
  debugger;
}


text:
//
//  GPKXYZOverlay.h
//  geopackage-ios
//
//  Created by Brian Osborn on 7/1/15.
//  Copyright (c) 2015 NGA. All rights reserved.
//

#import <MapKit/MapKit.h>
#import "GPKGTileDao.h"
#import "GPKGBoundedOverlay.h"

/**
 * XYZ Overlay, assumes XYZ tiles
 */
@interface GPKGXYZOverlay : GPKGBoundedOverlay

/**
 *  Initialize
 *
 *  @param tileDao tile dao
 *
 *  @return new xyz overlay
 */
-(instancetype) initWithTileDao: (GPKGTileDao *) tileDao;

@end


text:
var assert = require('assert');

var checkval = require('../src/checkval');

describe('Validate english chars', function() {

	it('Throwing errors', function() {

		var value, isValid;

		value = 'abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789 +-.,!@#$%^&*()[]{};\/|<>"\'';
		isValid = true;
		try {
			checkval().add(value, 'field').englishChars().throw(); // valid
		} catch (err) {
			isValid = false;
		}
		assert(isValid);

		value = undefined;
		isValid = true;
		try {
			checkval().add(value, 'field').englishChars().throw(); // invalid
		} catch (err) {
			isValid = false;
		}
		assert(!isValid);

		value = 'This is a invalid text: Ñ';
		isValid = true;
		try {
			checkval().add(value, 'field').englishChars().throw(); // invalid
		} catch (err) {
			isValid = false;
		}
		assert(!isValid);

		value = '1234';
		isValid = true;
		try {
			checkval().add(value, 'field').englishChars().throw(); // valid
		} catch (err) {
			isValid = false;
		}
		assert(isValid);

		value = 'Test';
		isValid = true;
		try {
			checkval().add(value, 'field').englishChars().throw(); // valid
		} catch (err) {
			isValid = false;
		}
		assert(isValid);

		value = 50;
		isValid = true;
		try {
			checkval().add(value, 'field').englishChars().throw(); // valid
		} catch (err) {
			isValid = false;
		}
		assert(isValid);
	});
});


text:
require 'addressable/uri'
require 'net/http'
require 'simple_cache'
require 'nokogiri'

# The Http module defines a
#
#   Http.get(url)
#
# method.
module Http
  extend self

  # the default expiration time for get requests.
  module MaxAge
    DEFAULT_MAX_AGE = 86_400

    def self.config
      @config ||= (App.config["cache-max-age"] || {}).to_a
    end

    def self.for(url)
      config.each do |pattern, max_age|
        return max_age if url.index(pattern)
      end

      DEFAULT_MAX_AGE
    end
  end

  def get(url, max_age = nil)
    get_body(url, max_age, :text)
  end

  def get_binary(url, max_age = nil)
    get_body(url, max_age, :binary)
  end

  def get_body(url, max_age, mode)
    max_age ||= MaxAge.for(url)

    App.logger.benchmark("[GET] #{url}", :minimum => 20) do
      SimpleCache.cached("g-#{url}", max_age) do
        App.logger.debug "[GET] #{url}"
        body, headers = get_body_and_headers_(url)

        if mode == :text
          content_types = (headers["content-type"] || []).join(";")
          body = reencode body, content_types
        end

        body
      end
    end
  end

  private

  def get_body_and_headers_(uri_str, limit = 10)
    raise 'too many redirections' if limit == 0

    uri =  Addressable::URI.parse(uri_str)

    http = Net::HTTP.new(uri.host, uri.port)
    if uri.scheme == "https"
      http.use_ssl = true
      http.verify_mode = OpenSSL::SSL::VERIFY_NONE
    end
    request = Net::HTTP::Get.new(uri.request_uri)
    response = http.request(request)

    case response
    when Net::HTTPSuccess then
      [ response.body, response.to_hash ]
    when Net::HTTPRedirection then
      location = response['location']
      App.logger.debug "redirected to #{location}"
      get_body_and_headers_(location, limit - 1)
    else
      [ response.value, nil ]
    end
  end

  def reencode(body, content_type)
    encodings = [ "ISO-8859-1", "UTF-8" ]

    encodings.unshift($1)                   if content_type =~ /;\s*charset=(\S+)/
    encodings.unshift(html_encoding(body))  if content_type =~ /html/
    encodings.unshift(xml_encoding(body))   if content_type =~ /xml/

    force_valid_encoding body, *encodings
  end

  def force_valid_encoding(string, *encodings)
    encodings.each do |enc|
      next unless enc
      begin
        s = string.force_encoding(enc)
        next unless s.valid_encoding?
        return s.encode("UTF-8")
      rescue Encoding::UndefinedConversionError
      end
    end

    nil
  end

  def html_encoding(html)
    doc = Nokogiri.HTML(html)
    node = doc.css("meta[http-equiv='Content-Type']").first

    return unless node &&  node["content"] =~ /; charset=(\S+)/
    $1
  end

  def xml_encoding(xml)
    Nokogiri.XML(xml).encoding
  end
end


text:
//
//  S2UICaseContainer.h
//  S2AppKit/S2UICase
//
//  Created by 古川 文生 on 12/06/30.
//  Copyright (c) 2012年 Straight Splirits Co. Ltd. All rights reserved.
//

#import "S2UIKit.h"

@class S2UICase, S2UIModel;

typedef enum {
	S2UICaseContainerTransitionNormal,
	S2UICaseContainerTransitionRotate,
} S2UICaseContainerTransitionMode;

/*
 *	UIケースコンテナ
 */
@interface S2UICaseContainer : UIViewController

@property (readonly) S2UIModel* uiModel;

@property (readonly) NSUserDefaults* userDefaults;
- (void)loadUserDefaults:(NSUserDefaults*)userDefaults;	// override if needed.

@property BOOL startupAnimation;
@property S2UICaseContainerTransitionMode transitionMode;

- (void)setupUICases:(NSArray*)uicases initialUICaseName:(NSString*)uicaseName privateSettings:(NSDictionary*)privateSettings;
- (void)setupUICases:(NSArray*)uicases initialUICase:(S2UICase*)uicase privateSettings:(NSDictionary*)privateSettings;

- (S2UICase*)uicaseByName:(NSString*)uicaseName;

- (void)transitionStartupUICase:(S2UICase*)uicase animation:(BOOL)animation;
- (void)transitionUICaseWithName:(NSString*)uicaseName;
- (void)transitionUICase:(S2UICase*)toUICase animated:(BOOL)animated;
@property (readonly) S2UICase* currentUICase;

// タイトルバー
@property (readonly) UINavigationBar *titleBar;
// コンテンツビュー
@property (readonly) UIView *contentView;

@end

@interface S2UICaseContainer (LicenseCheck)

// ライセンスチェック
- (BOOL)needServiceLicenseCheck;
- (void)checkServiceLicense;

@end

@interface S2UICaseContainer (Events)

- (void)worldStarted:(S2UICase*)initialUICase;

@end

/*
 *	iPad専用の、アプレットナビゲーションバー付きコンテナ
 */
@interface S2TitledUICaseContainer : S2UICaseContainer

@end


text:
'use strict';

const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
const nedb = require('nedb');
const bluebird = require('bluebird');

const testSystemPrefsDb = bluebird.promisifyAll(new nedb({ filename: 'testSystemPrefs.db', autoload: true, inMemoryOnly: true}));

chai.use(chaiAsPromised);

const expect = chai.expect;

describe('System Preferences', function() {
    let systemPrefs;
    before(function(done) {
        testSystemPrefsDb.insertAsync({
            name: 'port',
            type: 'text',
            value: '8080'
        }).then(() => {
            return testSystemPrefsDb.insertAsync({
                name: 'default_permission',
                type: 'text',
                value: 'standard'
            });
        }).then(() => {
            return testSystemPrefsDb.insertAsync({
                name: 'falsy',
                type: 'checkbox',
                value: false
            });
        }).then(() => {
            const systemPrefsClass = require('../../lib/systemPrefs.js');
            systemPrefs = new systemPrefsClass(testSystemPrefsDb);
            done();
        });
    });

    it('get returns the correct value', function() {
        const enabled = systemPrefs.get('port');

        return expect(enabled).to.eventually.equal('8080');
    });

    it('get returns a falsy value where relevant', function() {
        const enabled = systemPrefs.get('falsy');

        return expect(enabled).to.eventually.be.false;
    });

    it('get throws an exception if pref key not found', function() {
        const enabled = systemPrefs.get('fake');

        return expect(enabled).to.be.rejectedWith(Error, 'System pref fake not found');
    });
});


text:
.class public Landroid/filterpacks/videosrc/CameraSource;
.super Landroid/filterfw/core/Filter;
.source "CameraSource.java"

# static fields
.field private static final NEWFRAME_TIMEOUT:I = 0x64

.field private static final NEWFRAME_TIMEOUT_REPEAT:I = 0xa

.field private static final TAG:Ljava/lang/String; = "CameraSource"

.field private static final mFrameShader:Ljava/lang/String; = "#extension GL_OES_EGL_image_external : require\nprecision mediump float;\nuniform samplerExternalOES tex_sampler_0;\nvarying vec2 v_texcoord;\nvoid main() {\n  gl_FragColor = texture2D(tex_sampler_0, v_texcoord);\n}\n"

.field private static final mSourceCoords:[F

# instance fields
.field private mCamera:Landroid/hardware/Camera;

.field private mCameraFrame:Landroid/filterfw/core/GLFrame;

.field private mCameraId:I
    .annotation runtime Landroid/filterfw/core/GenerateFieldPort;
        hasDefault = true
        name = "id"
    .end annotation
.end field

.field private mCameraParameters:Landroid/hardware/Camera$Parameters;

.field private mCameraTransform:[F

.field private mFps:I
    .annotation runtime Landroid/filterfw/core/GenerateFieldPort;
        hasDefault = true
        name = "framerate"
    .end annotation
.end field

.field private mFrameExtractor:Landroid/filterfw/core/ShaderProgram;

.field private mHeight:I
    .annotation runtime Landroid/filterfw/core/GenerateFieldPort;
        hasDefault = true
        name = "height"
    .end annotation
.end field

.field private final mLogVerbose:Z

.field private mMappedCoords:[F

.field private mNewFrameAvailable:Z

.field private mOutputFormat:Landroid/filterfw/core/MutableFrameFormat;

.field private mSurfaceTexture:Landroid/graphics/SurfaceTexture;

.field private mWaitForNewFrame:Z
    .annotation runtime Landroid/filterfw/core/GenerateFinalPort;
        hasDefault = true
        name = "waitForNewFrame"
    .end annotation
.end field

.field private mWidth:I
    .annotation runtime Landroid/filterfw/core/GenerateFieldPort;
        hasDefault = true
        name = "width"
    .end annotation
.end field

.field private onCameraFrameAvailableListener:Landroid/graphics/SurfaceTexture$OnFrameAvailableListener;

# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 87
    const/16 v0, 0x10

    new-array v0, v0, [F

    fill-array-data v0, :array_0

    sput-object v0, Landroid/filterpacks/videosrc/CameraSource;->mSourceCoords:[F

    return-void

    :array_0
    .array-data 0x4
        0x0t 0x0t 0x0t 0x0t
        0x0t 0x0t 0x80t 0x3ft
        0x0t 0x0t 0x0t 0x0t
        0x0t 0x0t 0x80t 0x3ft
        0x0t 0x0t 0x80t 0x3ft
        0x0t 0x0t 0x80t 0x3ft
        0x0t 0x0t 0x0t 0x0t
        0x0t 0x0t 0x80t 0x3ft
        0x0t 0x0t 0x0t 0x0t
        0x0t 0x0t 0x0t 0x0t
        0x0t 0x0t 0x0t 0x0t
        0x0t 0x0t 0x80t 0x3ft
        0x0t 0x0t 0x80t 0x3ft
        0x0t 0x0t 0x0t 0x0t
        0x0t 0x0t 0x0t 0x0t
        0x0t 0x0t 0x80t 0x3ft
    .end array-data
.end method

.method public constructor <init>(Ljava/lang/String;)V
    .locals 2
    .parameter "name"

    .prologue
    const/16 v1, 0x10

    .line 112
    invoke-direct {p0, p1}, Landroid/filterfw/core/Filter;-><init>(Ljava/lang/String;)V

    .line 54
    const/4 v0, 0x0

    iput v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mCameraId:I

    .line 58
    const/16 v0, 0x140

    iput v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mWidth:I

    .line 62
    const/16 v0, 0xf0

    iput v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mHeight:I

    .line 66
    const/16 v0, 0x1e

    iput v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mFps:I

    .line 74
    const/4 v0, 0x1

    iput-boolean v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mWaitForNewFrame:Z

    .line 346
    new-instance v0, Landroid/filterpacks/videosrc/CameraSource$1;

    invoke-direct {v0, p0}, Landroid/filterpacks/videosrc/CameraSource$1;-><init>(Landroid/filterpacks/videosrc/CameraSource;)V

    iput-object v0, p0, Landroid/filterpacks/videosrc/CameraSource;->onCameraFrameAvailableListener:Landroid/graphics/SurfaceTexture$OnFrameAvailableListener;

    .line 113
    new-array v0, v1, [F

    iput-object v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mCameraTransform:[F

    .line 114
    new-array v0, v1, [F

    iput-object v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mMappedCoords:[F

    .line 116
    const-string v0, "CameraSource"

    const/4 v1, 0x2

    invoke-static {v0, v1}, Landroid/util/Log;->isLoggable(Ljava/lang/String;I)Z

    move-result v0

    iput-boolean v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mLogVerbose:Z

    .line 117
    return-void
.end method

.method static synthetic access$000(Landroid/filterpacks/videosrc/CameraSource;)Z
    .locals 1
    .parameter "x0"

    .prologue
    .line 49
    iget-boolean v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mLogVerbose:Z

    return v0
.end method

.method static synthetic access$102(Landroid/filterpacks/videosrc/CameraSource;Z)Z
    .locals 0
    .parameter "x0"
    .parameter "x1"

    .prologue
    .line 49
    iput-boolean p1, p0, Landroid/filterpacks/videosrc/CameraSource;->mNewFrameAvailable:Z

    return p1
.end method

.method private createFormats()V
    .locals 3

    .prologue
    const/4 v2, 0x3

    .line 127
    iget v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mWidth:I

    iget v1, p0, Landroid/filterpacks/videosrc/CameraSource;->mHeight:I

    invoke-static {v0, v1, v2, v2}, Landroid/filterfw/format/ImageFormat;->create(IIII)Landroid/filterfw/core/MutableFrameFormat;

    move-result-object v0

    iput-object v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mOutputFormat:Landroid/filterfw/core/MutableFrameFormat;

    .line 130
    return-void
.end method

.method private findClosestFpsRange(ILandroid/hardware/Camera$Parameters;)[I
    .locals 11
    .parameter "fps"
    .parameter "params"

    .prologue
    const-wide v9, 0x408f400000000000L

    const/4 v8, 0x1

    const/4 v7, 0x0

    .line 324
    invoke-virtual {p2}, Landroid/hardware/Camera$Parameters;->getSupportedPreviewFpsRange()Ljava/util/List;

    move-result-object v3

    .line 325
    .local v3, supportedFpsRanges:Ljava/util/List;,"Ljava/util/List<[I>;"
    invoke-interface {v3, v7}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, [I

    .line 326
    .local v0, closestRange:[I
    invoke-interface {v3}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v1

    .local v1, i$:Ljava/util/Iterator;
    :cond_0
    :goto_0
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v4

    if-eqz v4, :cond_1

    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v2

    check-cast v2, [I

    .line 327
    .local v2, range:[I
    aget v4, v2, v7

    mul-int/lit16 v5, p1, 0x3e8

    if-ge v4, v5, :cond_0

    aget v4, v2, v8

    mul-int/lit16 v5, p1, 0x3e8

    if-le v4, v5, :cond_0

    aget v4, v2, v7

    aget v5, v0, v7

    if-le v4, v5, :cond_0

    aget v4, v2, v8

    aget v5, v0, v8

    if-ge v4, v5, :cond_0

    .line 333
    move-object v0, v2

    goto :goto_0

    .line 336
    .end local v2           #range:[I
    :cond_1
    iget-boolean v4, p0, Landroid/filterpacks/videosrc/CameraSource;->mLogVerbose:Z

    if-eqz v4, :cond_2

    const-string v4, "CameraSource"

    new-instance v5, Ljava/lang/StringBuilder;

    invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V

    const-string v6, "Requested fps: "

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v5

    const-string v6, ".Closest frame rate range: ["

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    aget v6, v0, v7

    int-to-double v6, v6

    div-double/2addr v6, v9

    invoke-virtual {v5, v6, v7}, Ljava/lang/StringBuilder;->append(D)Ljava/lang/StringBuilder;

    move-result-object v5

    const-string v6, ","

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    aget v6, v0, v8

    int-to-double v6, v6

    div-double/2addr v6, v9

    invoke-virtual {v5, v6, v7}, Ljava/lang/StringBuilder;->append(D)Ljava/lang/StringBuilder;

    move-result-object v5

    const-string v6, "]"

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-static {v4, v5}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I

    .line 343
    :cond_2
    return-object v0
.end method

.method private findClosestSize(IILandroid/hardware/Camera$Parameters;)[I
    .locals 12
    .parameter "width"
    .parameter "height"
    .parameter "parameters"

    .prologue
    const/4 v11, 0x0

    .line 284
    invoke-virtual {p3}, Landroid/hardware/Camera$Parameters;->getSupportedPreviewSizes()Ljava/util/List;

    move-result-object v4

    .line 285
    .local v4, previewSizes:Ljava/util/List;,"Ljava/util/List<Landroid/hardware/Camera$Size;>;"
    const/4 v2, -0x1

    .line 286
    .local v2, closestWidth:I
    const/4 v0, -0x1

    .line 287
    .local v0, closestHeight:I
    invoke-interface {v4, v11}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v8

    check-cast v8, Landroid/hardware/Camera$Size;

    iget v7, v8, Landroid/hardware/Camera$Size;->width:I

    .line 288
    .local v7, smallestWidth:I
    invoke-interface {v4, v11}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v8

    check-cast v8, Landroid/hardware/Camera$Size;

    iget v6, v8, Landroid/hardware/Camera$Size;->height:I

    .line 289
    .local v6, smallestHeight:I
    invoke-interface {v4}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v3

    .local v3, i$:Ljava/util/Iterator;
    :cond_0
    :goto_0
    invoke-interface {v3}, Ljava/util/Iterator;->hasNext()Z

    move-result v8

    if-eqz v8, :cond_2

    invoke-interface {v3}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v5

    check-cast v5, Landroid/hardware/Camera$Size;

    .line 294
    .local v5, size:Landroid/hardware/Camera$Size;
    iget v8, v5, Landroid/hardware/Camera$Size;->width:I

    if-gt v8, p1, :cond_1

    iget v8, v5, Landroid/hardware/Camera$Size;->height:I

    if-gt v8, p2, :cond_1

    iget v8, v5, Landroid/hardware/Camera$Size;->width:I

    if-lt v8, v2, :cond_1

    iget v8, v5, Landroid/hardware/Camera$Size;->height:I

    if-lt v8, v0, :cond_1

    .line 298
    iget v2, v5, Landroid/hardware/Camera$Size;->width:I

    .line 299
    iget v0, v5, Landroid/hardware/Camera$Size;->height:I

    .line 301
    :cond_1
    iget v8, v5, Landroid/hardware/Camera$Size;->width:I

    if-ge v8, v7, :cond_0

    iget v8, v5, Landroid/hardware/Camera$Size;->height:I

    if-ge v8, v6, :cond_0

    .line 303
    iget v7, v5, Landroid/hardware/Camera$Size;->width:I

    .line 304
    iget v6, v5, Landroid/hardware/Camera$Size;->height:I

    goto :goto_0

    .line 307
    .end local v5           #size:Landroid/hardware/Camera$Size;
    :cond_2
    const/4 v8, -0x1

    if-ne v2, v8, :cond_3

    .line 309
    move v2, v7

    .line 310
    move v0, v6

    .line 313
    :cond_3
    iget-boolean v8, p0, Landroid/filterpacks/videosrc/CameraSource;->mLogVerbose:Z

    if-eqz v8, :cond_4

    .line 314
    const-string v8, "CameraSource"

    new-instance v9, Ljava/lang/StringBuilder;

    invoke-direct {v9}, Ljava/lang/StringBuilder;-><init>()V

    const-string v10, "Requested resolution: ("

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    invoke-virtual {v9, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v9

    const-string v10, ", "

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    invoke-virtual {v9, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v9

    const-string v10, "). Closest match: ("

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    invoke-virtual {v9, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v9

    const-string v10, ", "

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    invoke-virtual {v9, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v9

    const-string v10, ")."

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    invoke-virtual {v9}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v9

    invoke-static {v8, v9}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I

    .line 319
    :cond_4
    const/4 v8, 0x2

    new-array v1, v8, [I

    aput v2, v1, v11

    const/4 v8, 0x1

    aput v0, v1, v8

    .line 320
    .local v1, closestSize:[I
    return-object v1
.end method

# virtual methods
.method public close(Landroid/filterfw/core/FilterContext;)V
    .locals 3
    .parameter "context"

    .prologue
    const/4 v2, 0x0

    .line 220
    iget-boolean v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mLogVerbose:Z

    if-eqz v0, :cond_0

    const-string v0, "CameraSource"

    const-string v1, "Closing"

    invoke-static {v0, v1}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I

    .line 222
    :cond_0
    iget-object v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mCamera:Landroid/hardware/Camera;

    invoke-virtual {v0}, Landroid/hardware/Camera;->release()V

    .line 223
    iput-object v2, p0, Landroid/filterpacks/videosrc/CameraSource;->mCamera:Landroid/hardware/Camera;

    .line 224
    iget-object v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mSurfaceTexture:Landroid/graphics/SurfaceTexture;

    invoke-virtual {v0}, Landroid/graphics/SurfaceTexture;->release()V

    .line 225
    iput-object v2, p0, Landroid/filterpacks/videosrc/CameraSource;->mSurfaceTexture:Landroid/graphics/SurfaceTexture;

    .line 226
    return-void
.end method

.method public fieldPortValueUpdated(Ljava/lang/String;Landroid/filterfw/core/FilterContext;)V
    .locals 4
    .parameter "name"
    .parameter "context"

    .prologue
    .line 237
    const-string v1, "framerate"

    invoke-virtual {p1, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_0

    .line 238
    invoke-virtual {p0}, Landroid/filterpacks/videosrc/CameraSource;->getCameraParameters()Landroid/hardware/Camera$Parameters;

    .line 239
    iget v1, p0, Landroid/filterpacks/videosrc/CameraSource;->mFps:I

    iget-object v2, p0, Landroid/filterpacks/videosrc/CameraSource;->mCameraParameters:Landroid/hardware/Camera$Parameters;

    invoke-direct {p0, v1, v2}, Landroid/filterpacks/videosrc/CameraSource;->findClosestFpsRange(ILandroid/hardware/Camera$Parameters;)[I

    move-result-object v0

    .line 240
    .local v0, closestRange:[I
    iget-object v1, p0, Landroid/filterpacks/videosrc/CameraSource;->mCameraParameters:Landroid/hardware/Camera$Parameters;

    const/4 v2, 0x0

    aget v2, v0, v2

    const/4 v3, 0x1

    aget v3, v0, v3

    invoke-virtual {v1, v2, v3}, Landroid/hardware/Camera$Parameters;->setPreviewFpsRange(II)V

    .line 242
    iget-object v1, p0, Landroid/filterpacks/videosrc/CameraSource;->mCamera:Landroid/hardware/Camera;

    iget-object v2, p0, Landroid/filterpacks/videosrc/CameraSource;->mCameraParameters:Landroid/hardware/Camera$Parameters;

    invoke-virtual {v1, v2}, Landroid/hardware/Camera;->setParameters(Landroid/hardware/Camera$Parameters;)V

    .line 244
    .end local v0           #closestRange:[I
    :cond_0
    return-void
.end method

.method public declared-synchronized getCameraParameters()Landroid/hardware/Camera$Parameters;
    .locals 6

    .prologue
    .line 247
    monitor-enter p0

    const/4 v0, 0x0

    .line 248
    .local v0, closeCamera:Z
    :try_start_0
    iget-object v3, p0, Landroid/filterpacks/videosrc/CameraSource;->mCameraParameters:Landroid/hardware/Camera$Parameters;

    if-nez v3, :cond_1

    .line 249
    iget-object v3, p0, Landroid/filterpacks/videosrc/CameraSource;->mCamera:Landroid/hardware/Camera;

    if-nez v3, :cond_0

    .line 250
    iget v3, p0, Landroid/filterpacks/videosrc/CameraSource;->mCameraId:I

    invoke-static {v3}, Landroid/hardware/Camera;->open(I)Landroid/hardware/Camera;

    move-result-object v3

    iput-object v3, p0, Landroid/filterpacks/videosrc/CameraSource;->mCamera:Landroid/hardware/Camera;

    .line 251
    const/4 v0, 0x1

    .line 253
    :cond_0
    iget-object v3, p0, Landroid/filterpacks/videosrc/CameraSource;->mCamera:Landroid/hardware/Camera;

    invoke-virtual {v3}, Landroid/hardware/Camera;->getParameters()Landroid/hardware/Camera$Parameters;

    move-result-object v3

    iput-object v3, p0, Landroid/filterpacks/videosrc/CameraSource;->mCameraParameters:Landroid/hardware/Camera$Parameters;

    .line 255
    if-eqz v0, :cond_1

    .line 256
    iget-object v3, p0, Landroid/filterpacks/videosrc/CameraSource;->mCamera:Landroid/hardware/Camera;

    invoke-virtual {v3}, Landroid/hardware/Camera;->release()V

    .line 257
    const/4 v3, 0x0

    iput-object v3, p0, Landroid/filterpacks/videosrc/CameraSource;->mCamera:Landroid/hardware/Camera;

    .line 261
    :cond_1
    iget v3, p0, Landroid/filterpacks/videosrc/CameraSource;->mWidth:I

    iget v4, p0, Landroid/filterpacks/videosrc/CameraSource;->mHeight:I

    iget-object v5, p0, Landroid/filterpacks/videosrc/CameraSource;->mCameraParameters:Landroid/hardware/Camera$Parameters;

    invoke-direct {p0, v3, v4, v5}, Landroid/filterpacks/videosrc/CameraSource;->findClosestSize(IILandroid/hardware/Camera$Parameters;)[I

    move-result-object v2

    .line 262
    .local v2, closestSize:[I
    const/4 v3, 0x0

    aget v3, v2, v3

    iput v3, p0, Landroid/filterpacks/videosrc/CameraSource;->mWidth:I

    .line 263
    const/4 v3, 0x1

    aget v3, v2, v3

    iput v3, p0, Landroid/filterpacks/videosrc/CameraSource;->mHeight:I

    .line 264
    iget-object v3, p0, Landroid/filterpacks/videosrc/CameraSource;->mCameraParameters:Landroid/hardware/Camera$Parameters;

    iget v4, p0, Landroid/filterpacks/videosrc/CameraSource;->mWidth:I

    iget v5, p0, Landroid/filterpacks/videosrc/CameraSource;->mHeight:I

    invoke-virtual {v3, v4, v5}, Landroid/hardware/Camera$Parameters;->setPreviewSize(II)V

    .line 266
    iget v3, p0, Landroid/filterpacks/videosrc/CameraSource;->mFps:I

    iget-object v4, p0, Landroid/filterpacks/videosrc/CameraSource;->mCameraParameters:Landroid/hardware/Camera$Parameters;

    invoke-direct {p0, v3, v4}, Landroid/filterpacks/videosrc/CameraSource;->findClosestFpsRange(ILandroid/hardware/Camera$Parameters;)[I

    move-result-object v1

    .line 268
    .local v1, closestRange:[I
    iget-object v3, p0, Landroid/filterpacks/videosrc/CameraSource;->mCameraParameters:Landroid/hardware/Camera$Parameters;

    const/4 v4, 0x0

    aget v4, v1, v4

    const/4 v5, 0x1

    aget v5, v1, v5

    invoke-virtual {v3, v4, v5}, Landroid/hardware/Camera$Parameters;->setPreviewFpsRange(II)V

    .line 271
    iget-object v3, p0, Landroid/filterpacks/videosrc/CameraSource;->mCameraParameters:Landroid/hardware/Camera$Parameters;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    monitor-exit p0

    return-object v3

    .line 247
    .end local v1           #closestRange:[I
    .end local v2           #closestSize:[I
    :catchall_0
    move-exception v3

    monitor-exit p0

    throw v3
.end method

.method public open(Landroid/filterfw/core/FilterContext;)V
    .locals 6
    .parameter "context"

    .prologue
    .line 141
    iget-boolean v1, p0, Landroid/filterpacks/videosrc/CameraSource;->mLogVerbose:Z

    if-eqz v1, :cond_0

    const-string v1, "CameraSource"

    const-string v2, "Opening"

    invoke-static {v1, v2}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I

    .line 143
    :cond_0
    iget v1, p0, Landroid/filterpacks/videosrc/CameraSource;->mCameraId:I

    invoke-static {v1}, Landroid/hardware/Camera;->open(I)Landroid/hardware/Camera;

    move-result-object v1

    iput-object v1, p0, Landroid/filterpacks/videosrc/CameraSource;->mCamera:Landroid/hardware/Camera;

    .line 146
    invoke-virtual {p0}, Landroid/filterpacks/videosrc/CameraSource;->getCameraParameters()Landroid/hardware/Camera$Parameters;

    .line 147
    iget-object v1, p0, Landroid/filterpacks/videosrc/CameraSource;->mCamera:Landroid/hardware/Camera;

    iget-object v2, p0, Landroid/filterpacks/videosrc/CameraSource;->mCameraParameters:Landroid/hardware/Camera$Parameters;

    invoke-virtual {v1, v2}, Landroid/hardware/Camera;->setParameters(Landroid/hardware/Camera$Parameters;)V

    .line 150
    invoke-direct {p0}, Landroid/filterpacks/videosrc/CameraSource;->createFormats()V

    .line 153
    invoke-virtual {p1}, Landroid/filterfw/core/FilterContext;->getFrameManager()Landroid/filterfw/core/FrameManager;

    move-result-object v1

    iget-object v2, p0, Landroid/filterpacks/videosrc/CameraSource;->mOutputFormat:Landroid/filterfw/core/MutableFrameFormat;

    const/16 v3, 0x68

    const-wide/16 v4, 0x0

    invoke-virtual {v1, v2, v3, v4, v5}, Landroid/filterfw/core/FrameManager;->newBoundFrame(Landroid/filterfw/core/FrameFormat;IJ)Landroid/filterfw/core/Frame;

    move-result-object v1

    check-cast v1, Landroid/filterfw/core/GLFrame;

    iput-object v1, p0, Landroid/filterpacks/videosrc/CameraSource;->mCameraFrame:Landroid/filterfw/core/GLFrame;

    .line 156
    new-instance v1, Landroid/graphics/SurfaceTexture;

    iget-object v2, p0, Landroid/filterpacks/videosrc/CameraSource;->mCameraFrame:Landroid/filterfw/core/GLFrame;

    invoke-virtual {v2}, Landroid/filterfw/core/GLFrame;->getTextureId()I

    move-result v2

    invoke-direct {v1, v2}, Landroid/graphics/SurfaceTexture;-><init>(I)V

    iput-object v1, p0, Landroid/filterpacks/videosrc/CameraSource;->mSurfaceTexture:Landroid/graphics/SurfaceTexture;

    .line 158
    :try_start_0
    iget-object v1, p0, Landroid/filterpacks/videosrc/CameraSource;->mCamera:Landroid/hardware/Camera;

    iget-object v2, p0, Landroid/filterpacks/videosrc/CameraSource;->mSurfaceTexture:Landroid/graphics/SurfaceTexture;

    invoke-virtual {v1, v2}, Landroid/hardware/Camera;->setPreviewTexture(Landroid/graphics/SurfaceTexture;)V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    .line 165
    iget-object v1, p0, Landroid/filterpacks/videosrc/CameraSource;->mSurfaceTexture:Landroid/graphics/SurfaceTexture;

    iget-object v2, p0, Landroid/filterpacks/videosrc/CameraSource;->onCameraFrameAvailableListener:Landroid/graphics/SurfaceTexture$OnFrameAvailableListener;

    invoke-virtual {v1, v2}, Landroid/graphics/SurfaceTexture;->setOnFrameAvailableListener(Landroid/graphics/SurfaceTexture$OnFrameAvailableListener;)V

    .line 167
    const/4 v1, 0x0

    iput-boolean v1, p0, Landroid/filterpacks/videosrc/CameraSource;->mNewFrameAvailable:Z

    .line 168
    iget-object v1, p0, Landroid/filterpacks/videosrc/CameraSource;->mCamera:Landroid/hardware/Camera;

    invoke-virtual {v1}, Landroid/hardware/Camera;->startPreview()V

    .line 169
    return-void

    .line 159
    :catch_0
    move-exception v0

    .line 160
    .local v0, e:Ljava/io/IOException;
    new-instance v1, Ljava/lang/RuntimeException;

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "Could not bind camera surface texture: "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v0}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, "!"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-direct {v1, v2}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw v1
.end method

.method public prepare(Landroid/filterfw/core/FilterContext;)V
    .locals 2
    .parameter "context"

    .prologue
    .line 134
    iget-boolean v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mLogVerbose:Z

    if-eqz v0, :cond_0

    const-string v0, "CameraSource"

    const-string v1, "Preparing"

    invoke-static {v0, v1}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I

    .line 136
    :cond_0
    new-instance v0, Landroid/filterfw/core/ShaderProgram;

    const-string v1, "#extension GL_OES_EGL_image_external : require\nprecision mediump float;\nuniform samplerExternalOES tex_sampler_0;\nvarying vec2 v_texcoord;\nvoid main() {\n  gl_FragColor = texture2D(tex_sampler_0, v_texcoord);\n}\n"

    invoke-direct {v0, p1, v1}, Landroid/filterfw/core/ShaderProgram;-><init>(Landroid/filterfw/core/FilterContext;Ljava/lang/String;)V

    iput-object v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mFrameExtractor:Landroid/filterfw/core/ShaderProgram;

    .line 137
    return-void
.end method

.method public process(Landroid/filterfw/core/FilterContext;)V
    .locals 15
    .parameter "context"

    .prologue
    .line 173
    iget-boolean v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mLogVerbose:Z

    if-eqz v0, :cond_0

    const-string v0, "CameraSource"

    const-string v1, "Processing new frame"

    invoke-static {v0, v1}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I

    .line 175
    :cond_0
    iget-boolean v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mWaitForNewFrame:Z

    if-eqz v0, :cond_4

    .line 176
    const/4 v13, 0x0

    .line 177
    .local v13, waitCount:I
    :cond_1
    :goto_0
    iget-boolean v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mNewFrameAvailable:Z

    if-nez v0, :cond_3

    .line 178
    const/16 v0, 0xa

    if-ne v13, v0, :cond_2

    .line 179
    new-instance v0, Ljava/lang/RuntimeException;

    const-string v1, "Timeout waiting for new frame"

    invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 182
    :cond_2
    const-wide/16 v0, 0x64

    :try_start_0
    invoke-virtual {p0, v0, v1}, Ljava/lang/Object;->wait(J)V
    :try_end_0
    .catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 183
    :catch_0
    move-exception v9

    .line 184
    .local v9, e:Ljava/lang/InterruptedException;
    iget-boolean v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mLogVerbose:Z

    if-eqz v0, :cond_1

    const-string v0, "CameraSource"

    const-string v1, "Interrupted while waiting for new frame"

    invoke-static {v0, v1}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0

    .line 187
    .end local v9           #e:Ljava/lang/InterruptedException;
    :cond_3
    const/4 v0, 0x0

    iput-boolean v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mNewFrameAvailable:Z

    .line 188
    iget-boolean v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mLogVerbose:Z

    if-eqz v0, :cond_4

    const-string v0, "CameraSource"

    const-string v1, "Got new frame"

    invoke-static {v0, v1}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I

    .line 191
    .end local v13           #waitCount:I
    :cond_4
    iget-object v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mSurfaceTexture:Landroid/graphics/SurfaceTexture;

    invoke-virtual {v0}, Landroid/graphics/SurfaceTexture;->updateTexImage()V

    .line 193
    iget-boolean v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mLogVerbose:Z

    if-eqz v0, :cond_5

    const-string v0, "CameraSource"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Using frame extractor in thread: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I

    .line 194
    :cond_5
    iget-object v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mSurfaceTexture:Landroid/graphics/SurfaceTexture;

    iget-object v1, p0, Landroid/filterpacks/videosrc/CameraSource;->mCameraTransform:[F

    invoke-virtual {v0, v1}, Landroid/graphics/SurfaceTexture;->getTransformMatrix([F)V

    .line 195
    iget-object v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mMappedCoords:[F

    const/4 v1, 0x0

    iget-object v2, p0, Landroid/filterpacks/videosrc/CameraSource;->mCameraTransform:[F

    const/4 v3, 0x0

    sget-object v4, Landroid/filterpacks/videosrc/CameraSource;->mSourceCoords:[F

    const/4 v5, 0x0

    invoke-static/range {v0 .. v5}, Landroid/opengl/Matrix;->multiplyMM([FI[FI[FI)V

    .line 198
    iget-object v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mFrameExtractor:Landroid/filterfw/core/ShaderProgram;

    iget-object v1, p0, Landroid/filterpacks/videosrc/CameraSource;->mMappedCoords:[F

    const/4 v2, 0x0

    aget v1, v1, v2

    iget-object v2, p0, Landroid/filterpacks/videosrc/CameraSource;->mMappedCoords:[F

    const/4 v3, 0x1

    aget v2, v2, v3

    iget-object v3, p0, Landroid/filterpacks/videosrc/CameraSource;->mMappedCoords:[F

    const/4 v4, 0x4

    aget v3, v3, v4

    iget-object v4, p0, Landroid/filterpacks/videosrc/CameraSource;->mMappedCoords:[F

    const/4 v5, 0x5

    aget v4, v4, v5

    iget-object v5, p0, Landroid/filterpacks/videosrc/CameraSource;->mMappedCoords:[F

    const/16 v6, 0x8

    aget v5, v5, v6

    iget-object v6, p0, Landroid/filterpacks/videosrc/CameraSource;->mMappedCoords:[F

    const/16 v7, 0x9

    aget v6, v6, v7

    iget-object v7, p0, Landroid/filterpacks/videosrc/CameraSource;->mMappedCoords:[F

    const/16 v8, 0xc

    aget v7, v7, v8

    iget-object v8, p0, Landroid/filterpacks/videosrc/CameraSource;->mMappedCoords:[F

    const/16 v14, 0xd

    aget v8, v8, v14

    invoke-virtual/range {v0 .. v8}, Landroid/filterfw/core/ShaderProgram;->setSourceRegion(FFFFFFFF)Z

    .line 203
    invoke-virtual/range {p1 .. p1}, Landroid/filterfw/core/FilterContext;->getFrameManager()Landroid/filterfw/core/FrameManager;

    move-result-object v0

    iget-object v1, p0, Landroid/filterpacks/videosrc/CameraSource;->mOutputFormat:Landroid/filterfw/core/MutableFrameFormat;

    invoke-virtual {v0, v1}, Landroid/filterfw/core/FrameManager;->newFrame(Landroid/filterfw/core/FrameFormat;)Landroid/filterfw/core/Frame;

    move-result-object v10

    .line 204
    .local v10, output:Landroid/filterfw/core/Frame;
    iget-object v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mFrameExtractor:Landroid/filterfw/core/ShaderProgram;

    iget-object v1, p0, Landroid/filterpacks/videosrc/CameraSource;->mCameraFrame:Landroid/filterfw/core/GLFrame;

    invoke-virtual {v0, v1, v10}, Landroid/filterfw/core/Program;->process(Landroid/filterfw/core/Frame;Landroid/filterfw/core/Frame;)V

    .line 206
    iget-object v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mSurfaceTexture:Landroid/graphics/SurfaceTexture;

    invoke-virtual {v0}, Landroid/graphics/SurfaceTexture;->getTimestamp()J

    move-result-wide v11

    .line 207
    .local v11, timestamp:J
    iget-boolean v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mLogVerbose:Z

    if-eqz v0, :cond_6

    const-string v0, "CameraSource"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Timestamp: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    long-to-double v2, v11

    const-wide v4, 0x41cdcd6500000000L

    div-double/2addr v2, v4

    invoke-virtual {v1, v2, v3}, Ljava/lang/StringBuilder;->append(D)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, " s"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I

    .line 208
    :cond_6
    invoke-virtual {v10, v11, v12}, Landroid/filterfw/core/Frame;->setTimestamp(J)V

    .line 210
    const-string/jumbo v0, "video"

    invoke-virtual {p0, v0, v10}, Landroid/filterfw/core/Filter;->pushOutput(Ljava/lang/String;Landroid/filterfw/core/Frame;)V

    .line 213
    invoke-virtual {v10}, Landroid/filterfw/core/Frame;->release()Landroid/filterfw/core/Frame;

    .line 215
    iget-boolean v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mLogVerbose:Z

    if-eqz v0, :cond_7

    const-string v0, "CameraSource"

    const-string v1, "Done processing new frame"

    invoke-static {v0, v1}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I

    .line 216
    :cond_7
    return-void
.end method

.method public declared-synchronized setCameraParameters(Landroid/hardware/Camera$Parameters;)V
    .locals 2
    .parameter "params"

    .prologue
    .line 276
    monitor-enter p0

    :try_start_0
    iget v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mWidth:I

    iget v1, p0, Landroid/filterpacks/videosrc/CameraSource;->mHeight:I

    invoke-virtual {p1, v0, v1}, Landroid/hardware/Camera$Parameters;->setPreviewSize(II)V

    .line 277
    iput-object p1, p0, Landroid/filterpacks/videosrc/CameraSource;->mCameraParameters:Landroid/hardware/Camera$Parameters;

    .line 278
    invoke-virtual {p0}, Landroid/filterfw/core/Filter;->isOpen()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 279
    iget-object v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mCamera:Landroid/hardware/Camera;

    iget-object v1, p0, Landroid/filterpacks/videosrc/CameraSource;->mCameraParameters:Landroid/hardware/Camera$Parameters;

    invoke-virtual {v0, v1}, Landroid/hardware/Camera;->setParameters(Landroid/hardware/Camera$Parameters;)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 281
    :cond_0
    monitor-exit p0

    return-void

    .line 276
    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public setupPorts()V
    .locals 2

    .prologue
    const/4 v1, 0x3

    .line 122
    const-string/jumbo v0, "video"

    invoke-static {v1, v1}, Landroid/filterfw/format/ImageFormat;->create(II)Landroid/filterfw/core/MutableFrameFormat;

    move-result-object v1

    invoke-virtual {p0, v0, v1}, Landroid/filterfw/core/Filter;->addOutputPort(Ljava/lang/String;Landroid/filterfw/core/FrameFormat;)V

    .line 124
    return-void
.end method

.method public tearDown(Landroid/filterfw/core/FilterContext;)V
    .locals 1
    .parameter "context"

    .prologue
    .line 230
    iget-object v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mCameraFrame:Landroid/filterfw/core/GLFrame;

    if-eqz v0, :cond_0

    .line 231
    iget-object v0, p0, Landroid/filterpacks/videosrc/CameraSource;->mCameraFrame:Landroid/filterfw/core/GLFrame;

    invoke-virtual {v0}, Landroid/filterfw/core/Frame;->release()Landroid/filterfw/core/Frame;

    .line 233
    :cond_0
    return-void
.end method


text:
package leetCode.langcommon;

import org.junit.Test;

import java.util.*;

/**
 * 环境变量
 *
 * @author Dave
 * @create 2017-11-06 20:58
 **/

public class EnvironmentVariables {

    @Test
    public void getEnvironmentVariablesTest() {
        for (Map.Entry entry : System.getenv().entrySet()) {
            System.out.println(entry.getKey() + " : " + entry.getValue());
        }
    }

    @Test
    public void modifyingArraysAsListTest() {
        Random random = new Random(47);
        Integer[] ia = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
        List<Integer> list1 = new ArrayList<Integer>(Arrays.asList(ia));
        System.out.println("Before shuffling : " + list1);
        Collections.shuffle(list1, random);
        System.out.println("After shuffling : " + list1);
        System.out.println("Array:" + Arrays.asList(ia));

        List<Integer> list2 = Arrays.asList(ia);
        System.out.println("Before shuffling : " + list2);
        Collections.shuffle(list2, random);
        System.out.println("After shuffling : " + list2);
        System.out.println("Array:" + Arrays.toString(ia));
    }
}


text:
framework.Scene().SceneAdded.connect(OnSceneAdded);

var scene = null;
var avatarEntityId = 0;

function OnSceneAdded(scenename)
{
    // Get pointer to scene through framework
    scene = framework.Scene().GetScene(scenename);
    scene.EntityCreated.connect(OnEntityCreated);
}

function OnEntityCreated(entity, change)
{
    if (!server.IsRunning() && entity.name == "Avatar" + client.connectionId)
    {
        avatarEntityId = entity.id;
        frame.Updated.connect(ProduceRandomMovement);
    }
}

function ProduceRandomMovement()
{
    var entity = scene.GetEntity(avatarEntityId);
    if (entity == null)
    {
        frame.Updated.disconnect(ProduceRandomMovement);
        return;
    }

    var decision = Math.floor(Math.random() * 64);
    if (decision == 1)
        entity.Exec(2, "Move", "forward");
    if (decision == 2)
        entity.Exec(2, "Move", "back");
    if (decision == 3)
        entity.Exec(2, "Move", "right");
    if (decision == 4)
        entity.Exec(2, "Move", "left");
    if (decision == 5)
        entity.Exec(2, "Stop", "forward");
    if (decision == 6)
        entity.Exec(2, "Stop", "back");
    if (decision == 7)
        entity.Exec(2, "Stop", "right");
    if (decision == 8)
        entity.Exec(2, "Stop", "left");
}


text:
(function (window) {
  'use strict';
  function Timer() {
    this.canvas = new Canvas('timer', 100, 70);
    this.time = 0;
    this.timerId;
    this._init();
  }

  Timer.prototype = {
    constructor: Timer,
    _init: function () {
      var self = this;
      this._render();
      this.resume();
    },
    _format: function (seconds) {
      var hours = Math.floor(seconds / 3600);
      seconds = seconds - hours * 3600;
      var minutes = Math.floor(seconds / 60);
      seconds = seconds - minutes * 60;
      if (hours < 10) {
        hours = '0' + hours;
      }
      if (minutes < 10) {
        minutes = '0' + minutes;
      }
      if (seconds < 10) {
        seconds = '0' + seconds;
      }
      return hours + ':' + minutes + ':' + seconds;
    },
    _render: function () {
      this.canvas.drawText(this._format(this.time));
    },
    pause: function () {
      window.clearInterval(this.timerId);
    },
    resume: function () {
      var self = this;
      this.timerId = window.setInterval(function () {
        self.time += 1;
        self._render();
      }, 1000);
    },
    stop: function () {
      this.pause();
    }
  };

  window.Timer = Timer;
})(window);


text:
CREATE OR REPLACE FUNCTION FUNC_WITH_DEPENDENT_VIEW ()

RETURNS integer language SQL NOT deterministic NO EXTERNAL ACTION READS SQL DATA

RETURN VALUES (1)
GO


text:
namespace DiscUtils.Streams
{
    public static class Sizes
    {
        public const long OneKiB = 1024;
        public const long OneMiB = 1024 * OneKiB;
        public const long OneGiB = 1024 * OneMiB;

        public const int Sector = 512;
    }
}


text:
<resources>
    <string name="app_name">DecryptionStranger</string>

    <string name="all_rights_reserved">Copyright © 2015-2016 way. All Rights Reserved.</string>
    <string name="setting_about_description">解密-陌生人</string>
    <string name="et_account_hint">账号</string>
    <string name="et_password_hint">密码</string>
    <string name="login">登陆</string>
    <string name="register">新用户</string>
    <string name="forget_password">忘记密码?</string>
    <string name="tv_tips_name">请填写你的账号</string>
    <string name="tv_tips_password">请填写你的密码</string>
    <string name="et_name_hint">账号</string>
    <string name="btn_next">下一步</string>
    <string name="register_setPhoto">设置一下头像吧!</string>
    <string name="register_complete">完成</string>
    <string name="status_available">在线</string>
    <string name="status_away">离开</string>
    <string name="status_chat">Q我吧</string>
    <string name="status_dnd">请勿打扰</string>
    <string name="status_xa">隐身</string>
    <string name="status_offline">离线</string>
    <string name="status_busy">忙碌</string>
    <string name="status_online">在线</string>
    <string name="run_bg_ticker">解密陌生人正在后台运行</string>
    <string name="request_failed">登录失败:</string>
    <string name="timeout_try_again">网络连接超时,请重试</string>
    <string name="auto_save_password">记住密码</string>
    <string name="hide_login">隐身登录</string>
    <string name="new_group_name">新建分组</string>
    <string name="user_name">User Name</string>
    <string name="user_sign">User Sign</string>
    <string name="default_member_number">0</string>
    <string name="delete_user">删除好友</string>
    <string name="add_new_user">添加好友</string>
    <string name="add_new_group">添加分组</string>
    <string name="delete_group">删除分组</string>
    <string name="manage_group">管理分组</string>
    <string name="nick_name">昵称</string>
    <string name="user_sex">性别</string>
    <string name="contact_menu">联系人</string>
    <string name="net_error_tip">未连接...</string>
    <string name="pull_to_refresh_pull_label">下拉刷新…</string>
    <string name="pull_to_refresh_release_label">放开以刷新…</string>
    <string name="pull_to_refresh_refreshing_label">正在载入…</string>
    <string name="pull_to_refresh_from_bottom_pull_label">@string/pull_to_refresh_pull_label</string>
    <string name="pull_to_refresh_from_bottom_release_label">@string/pull_to_refresh_release_label</string>
    <string name="pull_to_refresh_from_bottom_refreshing_label">@string/pull_to_refresh_refreshing_label</string>
    <string name="status_qme">Q我吧</string>

    <string name="status_ys">隐身</string>
    <string name="net_error">网络未连接</string>
    <string name="rename">重命名</string>
    <string name="add_friend">加好友</string>
    <string name="group_rename_failed">默认分组不能重命名</string>
    <string name="login_prompt">登录中</string>
    <string name="rename_group_title">重命名分组</string>
    <string name="rename_group_template">将分组%s重命名为:</string>
    <string name="addContact_spinnerPrompt">选择分组</string>
    <string name="newGroup_editTextField_hint">新分组名称</string>
    <string name="addrosteritemaddgroupchoice">增加新分组</string>
    <string name="default_group">我的好友</string>
    <string name="add_friend_title">请输入对方账号,备注名并选择分组</string>
    <string name="account_number_hint">user@example.com</string>
    <string name="nickname_hint">备注</string>
    <string name="add_friend_dialog_title">添加好友</string>
    <string name="open">打开</string>
    <string name="move">移动到</string>
    <string name="delete">删除</string>
    <string name="error_input">非法输入</string>
    <string name="deleteUser_title">删除好友</string>
    <string name="deleteUser_message">确定删除%1$s(%2$s)?</string>
    <string name="press_again_backrun">再按一次返回桌面</string>
    <string name="MoveRosterEntryToGroupDialog_summ">是否移动</string>
    <string name="icon_menu_home">好友</string>
    <string name="icon_menu_chat">最近会话</string>
    <string name="icon_menu_setting">设置</string>
    <string name="hello_world">helloworld</string>
    <string name="action_settings">Settings</string>
    <string name="icon_menu_search">搜索好友</string>
    <string name="icon_menu_new_group">新建分组</string>
    <string name="icon_menu_shack">摇一摇</string>
    <string name="icon_menu_love">缘分墙</string>
    <string name="icon_menu_exit">退出</string>
    <string name="male_string">男</string>
    <string name="female_string">女</string>

    <string name="make_friend">添加为好友</string>
    <string name="location_recv">[%1$s的位置]</string>
    <string name="location_prefix">[我的位置]</string>

    <string name="voice">[语音]</string>
    <string name="picture">[图片]</string>
    <string name="video">[视频]</string>
    <string name="file">[文件]</string>
    <string name="voice_call">[语音通话]</string>

    <string name="connect_failuer_toast">请检查网络或稍候重试</string>
    <string name="network_unavailable">网络连接不可用,请检查网络</string>
    <string name="copy">复制</string>
    <string name="forward">转发</string>
    <string name="button_logout">退出登录</string>
    <string name="button_uploadlog">上传运行日志</string>
    <string name="ok">确定</string>
    <string name="cancel">取消</string>
    <string name="prompt">提示</string>
    <string name="clear_records">清空记录</string>
    <string name="clear_all_records">是否清空所有聊天记录?</string>
    <string name="location_message">位置信息</string>
    <string name="recording_video">录制视频</string>

    <string name="button_cancel">取消</string>
    <string name="button_save">保存</string>
    <string name="button_search">查找</string>
    <string name="button_add">添加</string>
    <string name="search_header">搜</string>

    <string name="network_isnot_available">网络不可用</string>

    <string name="pull_to_refresh">下拉可以刷新</string>
    <string name="release_to_refresh">松开可以刷新</string>
    <string name="lastUpdateTime">最近更新:%s</string>
    <string name="load_full">已加载全部</string>
    <string name="no_data">暂无数据</string>
    <string name="more">加载中</string>
    <!-- 消除警告,可忽略 -->
    <string name="d">图片描述</string>

</resources>


text:
import sys, collections, pprint, itertools
def ranges(covered):
    for c, g in itertools.groupby(covered.items(), lambda x: x[1]):
        indices = [i for i,c in g]
        beg = min(indices)
        end = max(indices) + 1
        yield beg, end, c
def check(iref, ireads):
    """For now, expect a full-line of bases, not split.
    """
    reads = list()
    header = iref.readline()
    n = int(header.split('/')[-1].split('_')[-1])
    dna = iref.readline().strip()
    assert n == len(dna), '%d != %d' %(n, len(dna))
    while True:
        header = ireads.readline()
        if not header:
            break
        beg, end = map(int, header.split('/')[-1].split('_'))
        assert end >= beg
        assert n >= end
        bases = ireads.readline() # discard for now
        reads.append([beg, end])
    reads.sort()
    covered = {i:0 for i in range(n)}
    #collections.defaultdict(int)
    for beg, end in reads:
        #print beg, end, covered[beg]
        for i in range(beg, end):
            covered[i] += 1
    for beg, end, c in ranges(covered):
        if c <=1:
            print beg, end, c
    return
    pprint.pprint(sorted([(i,c) for i,c in covered.items() if c < 3]))
def main(prog, fn_ref, fn_reads):
    """Check lines of 'reads' FASTA vs. 'ref' FASTA.
    """
    with open(fn_ref) as ref, open(fn_reads) as reads:
        check(ref, reads)
if __name__ == "__main__":
    main(*sys.argv)


text:
@interface QTTitleButton : UIButton

@end


text:
using UnityEngine.SceneManagement;

namespace lizzard.ValueObjects
{
    public struct LoadedSceneVO
    {
        public LoadedSceneVO(Scene scene, LoadSceneMode loadSceneMode)
        {
            this.Scene = scene;
            this.LoadSceneMode = loadSceneMode;
        }

        public Scene Scene;
        public LoadSceneMode LoadSceneMode;
    }
}


text:
package com.coreoz.plume.jersey.security.permission;

import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

/**
 * Limit access to a web-service only to users having the required permission.
 */
@Documented
@Retention (RUNTIME)
@Target({TYPE, METHOD})
public @interface RestrictTo {

	/**
	 * The permission a user must have to access the web-service
	 */
	String value();

}


text:
```bash
yarn test
```

## Deploy page

```bash
yarn demo:build
yarn demo:release
```

## Publish new version

```bash
yarn release
```

## ToDo

# tsconfig-build.json

-   strictMetadataEmit = true
-   strict = true (en todos los tsconfig)

# otros

-   limpiear dependecies packages.json
-   mover demo files to demo/app
-   core.ts: hacer condig sin <any>


text:
namespace ChatSystem.Models
{
    using System.Security.Claims;
    using System.Threading.Tasks;
    using Microsoft.AspNet.Identity;
    using Microsoft.AspNet.Identity.EntityFramework;

    /// <summary>
    /// This is MS identity user.
    /// </summary>
    public class User : IdentityUser
    {
        public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<User> manager, string authenticationType)
        {
            var userIdentity = await manager.CreateIdentityAsync(this, authenticationType);
            return userIdentity;
        }
    }
}


text:
<?php

namespace Prontotype;

use Symfony\Component\Yaml\Yaml;

Class RouteMatcher {

    protected $app;

    protected $routeCache = array();

    protected $loadPaths = array();

    protected $tokens = array(
        '{any}' => '([^/]*)',
        '{num}' => '(\d*)',
        '{all}' => '(.*)'
    );

    public function __construct($app, $loadPaths = array())
    {
        $this->app = $app;
        foreach($loadPaths as $path) {
            $this->addLoadPath($path);
        }
        $this->routes = $this->mergeRoutes();
    }

    public function convertRoute($route)
    {
        $route = trim($route,'/');
        $originalRoute = $route;

        if ( isset($this->routeCache[$route]) ) {
            return $this->routeCache[$route];
        }

        // lets see if we need to do any checking of custom routes
        $routes = $this->getRoutes();
        $root = $this->app['pt.prototype.path'] . '/';
        $replacements = array();
        if ( count($routes) ) {
            foreach( $routes as $name => $details ) {
                $routeSpec = $details['match'];
                // see if there are any page ID placeholders that need parsing out
                $replacements = array();
                if ( preg_match('/\[([^\]]*)\]/', $routeSpec, $matches) ) {
                    if ( $routePage = $this->app['pt.pages']->getById($matches[1]) ) {
                        $replacements[] = trim($routePage->getUnPrefixedUrlPath(),'/');
                        if ( $root == '/' ) {
                            $routeSpec = str_replace(
                                array($matches[0],'index.php'),
                                array($routePage->getUrlPath(),''),
                                $routeSpec
                            );
                        } else {
                            $routeSpec = str_replace(
                                array($matches[0],'index.php', $root),
                                array($routePage->getUrlPath(),'', ''),
                                $routeSpec
                            );
                        }
                    } else {
                        continue;
                    }
                }

                $routeSpec = ltrim($root,'/') . trim($routeSpec,'/');

                // replace helper placeholders
                if ( preg_match( $this->makeRegexp($routeSpec, $this->tokens), $route, $matches ) ) {
                    // we have a match!
                    for( $i = 0; $i < count($matches); $i++ ) {
                        if ( $i !== 0) {
                            $replacements[] = $matches[$i];
                        }
                    }
                    $route = $details['display'];
                    break;
                }
            }

            // replace reference tokens in the route
            $replacementTokens = array();
            for ( $j = 0; $j < count($replacements); $j++ ) {
                $replacementTokens['$' . ($j+1)] = $replacements[$j];
            }
            $route = str_replace(array_keys($replacementTokens), array_values($replacementTokens), $route);

            // replace any page ID placeholders in the route itself
            $route = $this->replaceIds($route);
        }
        $route = trim(str_replace('//', '/', $route),'/');
        $this->routeCache[$originalRoute] = $route;
        return $route;
    }

    public function getUrlForRoute($routeName, $params = array())
    {
        if ( $urlPath = $this->getUrlPathForRoute($routeName, $params) ) {
            return $this->app['pt.request']->getUriForPath($urlPath);
        }
    }

    public function getUrlPathForRoute($routeName, $params = array())
    {
        $routes = $this->getRoutes();
        if ( ! isset($routes[$routeName], $routes[$routeName]['display']) ) {
            return null;
        }
        $route = $routes[$routeName];
        if ( strpos($route['display'], '[') === false && strpos($route['display'], '$') === false ) {
            return $route['display']; // no tokens in the route to display, so can just return as-is
        }

        $route = $route['match'];

        // check we've got enough params
        preg_match_all('/\{([^\}]*)\}/', $route, $matches);

        if ( count($matches[0]) !== count($params) ) {
            return null;
        }
        foreach ( $params as $param ) {
            $route = preg_replace('/\{([^\}]*)\}/', $param, $route, 1);
        }
        $route = $this->replaceIds($route);
        $route = '/' . trim($route,'/');
        return $this->prefixRoute($route);
    }

    protected function makeRegexp($route, $tokens)
    {
        $route = str_replace(
            array_merge(array_keys($tokens), array('/')),
            array_merge(array_values($tokens), array('\/')),
            $route
        );
        return '/^' . $route . '$/';
    }

    protected function replaceIds($route)
    {
        $root = $this->app['pt.prototype.path'] . '/';
        if ( preg_match('/\[([^\]]*)\]/', $route, $matches) ) {
            if ( $routePage = $this->app['pt.pages']->getById($matches[1]) ) {
                if ( $root == '/' ) {
                    $route = $root . str_replace(
                        array($matches[0],'index.php'),
                        array($routePage->getUrlPath(),''),
                        $route
                    );
                } else {
                    $route = $root . str_replace(
                        array($matches[0],'index.php',$root),
                        array($routePage->getUrlPath(),'',''),
                        $route
                    );
                }
            }
        }
        return $route;
    }

    protected function getRoutes()
    {
        return $this->routes;
    }

    protected function prefixRoute($route)
    {
        $prefix = '';
        if ( ! $this->app['pt.env.clean_urls'] ) {
            $prefix = '/index.php';
        }
        return $prefix . $route;
    }

    public function addLoadPath($path)
    {
        if ( file_exists($path) ) {
            $this->loadPaths[] = $path . '/routes.yml';
        }
    }

    public function getLoadPaths()
    {
        return array_reverse($this->loadPaths);
    }

    protected function mergeRoutes()
    {
        $routes = array();
        $loadPaths = $this->getLoadPaths();
        foreach($loadPaths as $loadPath) {
            if ( file_exists($loadPath)) {
                if ( trim(file_get_contents($loadPath)) !== '' ) {
                    $parsed = Yaml::parse($loadPath);
                    if ($parsed !== null) {
                        $routes = $this->merge($routes, $parsed);
                    }
                }
            }
        }
        $configRoutes = $this->app['pt.config']->get('pages.routes') ? $this->app['pt.config']->get('pages.routes') : array();
        $routes = $this->merge($routes, $configRoutes);
        return $this->cleanRoutes($routes);
    }

    protected function cleanRoutes($rawRoutes)
    {
        $routes = array();
        foreach( $rawRoutes as $name => $details ) {
            if ( isset($details['match'], $details['display']) ) {
                if ( is_array($details['display']) ) {
                    // should be string, probably forgot to quote an id in square brackets in the yml config
                    $details['display'] = '[' . $details['display'][0] . ']';
                }
                if ( is_array($details['match']) ) {
                    // should be string, probably forgot to quote an id in square brackets in the yml config
                    $details['match'] = '[' . $details['match'][0] . ']';
                }
                $match = ltrim($details['match'], '/');
                $display = $this->app['pt.prototype.path'] . '/' . ltrim($details['display'], '/');
                $routes[$name] = array(
                    'match'   => $match,
                    'display' => $display,
                    'name'    => $name
                );
            }
        }
        return $routes;
    }

    protected function merge( array &$array1, array &$array2 )
    {
        $merged = $array1;
        foreach ( $array2 as $key => &$value ) {
            if ( is_array ( $value ) && isset ( $merged [$key] ) && is_array ( $merged [$key] ) ) {
                $merged [$key] = $this->merge( $merged [$key], $value );
            } else {
                $merged [$key] = $value;
            }
        }
        return $merged;
    }

}


text:
Testing enterprise service bus implementations - MassTransit and RabbitMQ Client API

Folder Shop shows basic MassTransit implementation with Retry Policy

In folder MassTransit_IoC_Example/Shop, in project Shop.Notification.Service you can find IoC example with StructureMap


text:
var gulp  = require('gulp'),
    uglifyJS = require('gulp-uglify'),
    rename = require("gulp-rename");

gulp.task('uglify', function() {
    return gulp.src('source/gesture-recorder.js')
        .pipe(uglifyJS())
        .pipe(rename("gesture-recorder.min.js"))
        .pipe(gulp.dest('./release/'));
});

gulp.task('copy', function() {
    return gulp.src('source/gesture-recorder.js')
        .pipe(gulp.dest('./example/'));
});

gulp.task('default', ['uglify', 'copy']);


text:
<?php

namespace GoalioRememberMe\Form;

use ZfcUser\Options\AuthenticationOptionsInterface;
use Godana\Form\Login as ZfcLoginForm;

class Login extends ZfcLoginForm
{
    /**
     * @var AuthenticationOptionsInterface
     */
    protected $authOptions;

    public function __construct($name = null, AuthenticationOptionsInterface $options)
    {
        parent::__construct($name, $options);

        $this->add(array(
            'type' => 'Zend\Form\Element\Checkbox',
            'name' => 'remember_me',
            'options' => array(
                'label' => 'Stay logged in',
                'use_hidden_element' => false,
                'checked_value' => '1',
                'unchecked_value' => '0'
            ),
//            'attributes' => array('class' => 'ace-checkbox-2')
        ));
    }
}


text:
MEDUSA_BEGIN;

void GraphPath::AddNode(GraphNode* node)
{
	mNodes.Add(node);
}

MEDUSA_END;


text:
<?php
require_once dirname(__FILE__).'/../bootstrap.php';

/**
 * Macro: cache manager test
 *
 * @author  Maxim Oleinik <maxim.oleinik@gmail.com>
 */
class Replica_Macro_CacheManagerTest extends ReplicaTestCase
{
    private $manager;

    /**
     * SetUp
     */
    protected function _setup()
    {
        $this->manager = new Replica_Macro_CacheManager($this->_dirActual);
    }

    /**
     * Run macro and cache result
     */
    public function testRunMacroAndCache()
    {
        $imageProxy = new Replica_ImageProxy_FromFile($this->getFileNameInput('png_120x90'));

        $macro = $this->getMock('Replica_Macro_ThumbnailFit', array('run'), array(10, 20));
        $macro->expects($this->once())
              ->method('run');
        Replica::setMacro('macro', $macro);

        // Run and cache
        $path = $this->manager->get('macro', $imageProxy);

        $file = $this->_dirActual . '/' . $path;
        $this->assertRegExp("/\.png$/", $path);
        $this->assertImageFile($this->getFileNameInput('png_120x90'), $file);

        // From cache
        $this->assertEquals($path, $this->manager->get('macro', $imageProxy));
    }

    /**
     * File exension
     */
    public function testFileExtension()
    {
        $imageProxy = new Replica_ImageProxy_FromFile($this->getFileNameInput('png_120x90'));
        $macro = new Replica_Macro_Null;

        $types = array(
            'image/png'  => 'png',
            'image/gif'  => 'gif',
            'image/jpeg' => 'jpg',
        );

        foreach ($types as $type => $extension) {
            $imageProxy->setMimeType($type);
            $path = $this->manager->get($macro, $imageProxy);
            $file = $this->_dirActual . '/' . $path;

            $image = new Replica_Image_Gd;
            $image->loadFromFile($file);

            $this->assertImage($image, 120, 90, $type, $type);
            $this->assertRegExp("/\.{$extension}$/", $path, $type);
        }
    }

    /**
     * Parameters invalidate cache
     */
    public function testParametersInvalidateCache()
    {
        $imageProxy = new Replica_ImageProxy_FromFile($this->getFileNameInput('png_120x90'));

        $pathA = $this->manager->get(new Replica_Macro_ThumbnailFit(10, 20), $imageProxy);
        $pathB = $this->manager->get(new Replica_Macro_ThumbnailFit(15, 25), $imageProxy);

        $this->assertNotEquals($pathA, $pathB);
    }

    /**
     * Quality invalidates cache
     */
    public function testQualityInvalidateCache()
    {
        $imageProxy = new Replica_ImageProxy_FromFile($this->getFileNameInput('png_120x90'));
        $imageProxy->setQuality(10);
        $pathA = $this->manager->get(new Replica_Macro_Null, $imageProxy);

        $imageProxy = new Replica_ImageProxy_FromFile($this->getFileNameInput('png_120x90'));
        $imageProxy->setQuality(20);
        $pathB = $this->manager->get(new Replica_Macro_Null, $imageProxy);

        $this->assertNotEquals($pathA, $pathB);
    }

    /**
     * Failed mime type
     */
    public function testFailedMimeType()
    {
        $imageProxy = new Replica_ImageProxy_FromFile($this->getFileNameInput('png_120x90'));
        $imageProxy->setMimeType('unknown type');
        $macro = new Replica_Macro_Null;

        $this->setExpectedException('Replica_Exception', 'Unknown image type');
        $path = $this->manager->get($macro, $imageProxy);
    }

    /**
     * Save dir not defined
     */
    public function testNoSaveDir()
    {
        $this->setExpectedException('InvalidArgumentException', 'Expected save dir');
        $this->manager = new Replica_Macro_CacheManager('');
    }

    /**
     * Failed to create save dir
     */
    public function testFailedToCreateSaveDir()
    {
        $dir = $this->_dirActual . '/' . $this->getName();
        mkdir($dir, 0400);
        $this->manager = new Replica_Macro_CacheManager($dir);

        $imageProxy = new Replica_ImageProxy_FromFile($this->getFileNameInput('png_120x90'));
        $macro = new Replica_Macro_Null;

        $this->setExpectedException('Replica_Exception', 'Failed to create directory');
        $this->manager->get($macro, $imageProxy);
    }

}


text:
extern int verbose;
extern int ddssock;
extern pthread_mutex_t dds_comm_lock;
void dds_exit(void *arg)
{
   int *sockfd = (int *) arg;
   pthread_t tid;
   tid = pthread_self();
}

void *dds_register_seq(void *arg)
{
  struct DriverMsg msg;
  struct ControlProgram *control_program;
  struct timeval t0,t1;
  int index;

  control_program=arg;
  pthread_mutex_lock(&dds_comm_lock);

  msg.type=DDS_REGISTER_SEQ;
  msg.status=1;
  send_data(ddssock, &msg, sizeof(struct DriverMsg));
  send_data(ddssock, control_program->parameters, sizeof(struct ControlPRM));
  index=control_program->parameters->current_pulseseq_index;
  send_data(ddssock, &index, sizeof(index)); //requested index
  send_data(ddssock,control_program->state->pulseseqs[index], sizeof(struct TSGbuf)); // requested pulseseq

  send_data(ddssock,control_program->state->pulseseqs[index]->rep,
    sizeof(unsigned char)*control_program->state->pulseseqs[index]->len); // requested pulseseq
  send_data(ddssock,control_program->state->pulseseqs[index]->code,
    sizeof(unsigned char)*control_program->state->pulseseqs[index]->len); // requested pulseseq
  recv_data(ddssock, &msg, sizeof(struct DriverMsg));
  pthread_mutex_unlock(&dds_comm_lock);
  pthread_exit(NULL);
}

void *dds_rxfe_settings(void *arg)
{
  struct DriverMsg msg;
  struct SiteSettings *site_settings;

  site_settings=arg;
  pthread_mutex_lock(&dds_comm_lock);
  if (site_settings!=NULL) {
    msg.type=DDS_RXFE_SETTINGS;
    msg.status=1;
    send_data(ddssock, &msg, sizeof(struct DriverMsg));
    send_data(ddssock, &site_settings->ifmode, sizeof(site_settings->ifmode));
    send_data(ddssock, &site_settings->rf_settings, sizeof(struct RXFESettings));
    send_data(ddssock, &site_settings->if_settings, sizeof(struct RXFESettings));
    recv_data(ddssock, &msg, sizeof(struct DriverMsg));
  }
  pthread_mutex_unlock(&dds_comm_lock);
}
void *dds_ready_controlprogram(void *arg)
{
  struct DriverMsg msg;
  struct ControlProgram *control_program;
  struct timeval t0,t1;
  control_program=arg;
  pthread_mutex_lock(&dds_comm_lock);
   if (control_program!=NULL) {
     if (control_program->state->pulseseqs[control_program->parameters->current_pulseseq_index]!=NULL) {
       msg.type=DDS_CtrlProg_READY;
       msg.status=1;
       send_data(ddssock, &msg, sizeof(struct DriverMsg));
       send_data(ddssock, control_program->parameters, sizeof(struct ControlPRM));
       recv_data(ddssock, &msg, sizeof(struct DriverMsg));
     }
   }
   pthread_mutex_unlock(&dds_comm_lock);
   pthread_exit(NULL);

};

void *dds_end_controlprogram(void *arg)
{
  struct DriverMsg msg;
  struct timeval t0,t1;
  pthread_mutex_lock(&dds_comm_lock);
  msg.type=DDS_CtrlProg_END;
  msg.status=1;
  send_data(ddssock, &msg, sizeof(struct DriverMsg));
  pthread_mutex_unlock(&dds_comm_lock);
  pthread_exit(NULL);

};

void *dds_pretrigger(void *arg)
{
  struct DriverMsg msg;
  struct ControlProgram *control_program;
  struct timeval t0,t1;
  int total=0;
  control_program=arg;
  pthread_mutex_lock(&dds_comm_lock);
  msg.type=DDS_PRETRIGGER;
  msg.status=1;
  send_data(ddssock, &msg, sizeof(struct DriverMsg));
  total=recv_data(ddssock, &msg, sizeof(struct DriverMsg));
  pthread_mutex_unlock(&dds_comm_lock);
  pthread_exit(NULL);

};

void *dds_posttrigger(void *arg)
{
  struct timeval t0,t1;
  pthread_mutex_lock(&dds_comm_lock);
  pthread_mutex_unlock(&dds_comm_lock);
};


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <name>Moho Sample AutomaticRedial</name>
  <artifactId>Moho-Sample-AutomaticRedial</artifactId>
  <packaging>war</packaging>

  <parent>
    <groupId>com.voxeo.moho</groupId>
    <artifactId>moho-sample-parent</artifactId>
    <version>trunk-SNAPSHOT</version>
  </parent>

  <scm>
    <connection>${svnUrlBase}/moho-sample/AutomaticRedial</connection>
    <url>${svnUrlBase}/moho-sample/AutomaticRedial</url>
  </scm>

</project>