text:
require 'mocha/infinite_range'
require 'mocha/pretty_parameters'
require 'mocha/expectation_error'
require 'mocha/return_values'
require 'mocha/exception_raiser'
require 'mocha/yield_parameters'
require 'mocha/is_a'

module Mocha # :nodoc:

  # Methods on expectations returned from Mock#expects, Mock#stubs, Object#expects and Object#stubs.
  class Expectation

    # :stopdoc:

    class AlwaysEqual
      def ==(other)
        true
      end
    end

    attr_reader :method_name, :backtrace

    def initialize(mock, method_name, backtrace = nil)
      @mock, @method_name = mock, method_name
      @expected_count = 1
      @parameters, @parameter_block = AlwaysEqual.new, nil
      @invoked_count, @return_values = 0, ReturnValues.new
      @backtrace = backtrace || caller
      @yield_parameters = YieldParameters.new
    end

    def match?(method_name, *arguments)
      return false unless @method_name == method_name
      if @parameter_block then
        return false unless @parameter_block.call(*arguments)
      else
        return false unless (@parameters == arguments)
      end
      if @expected_count.is_a?(Range) then
        return false unless @invoked_count < @expected_count.last
      else
        return false unless @invoked_count < @expected_count
      end
      return true
    end

    # :startdoc:

    # :call-seq: times(range) -> expectation
    #
    # Modifies expectation so that the number of calls to the expected method must be within a specific +range+.
    #
    # +range+ can be specified as an exact integer or as a range of integers
    #   object = mock()
    #   object.expects(:expected_method).times(3)
    #   3.times { object.expected_method }
    #   # => verify succeeds
    #
    #   object = mock()
    #   object.expects(:expected_method).times(3)
    #   2.times { object.expected_method }
    #   # => verify fails
    #
    #   object = mock()
    #   object.expects(:expected_method).times(2..4)
    #   3.times { object.expected_method }
    #   # => verify succeeds
    #
    #   object = mock()
    #   object.expects(:expected_method).times(2..4)
    #   object.expected_method
    #   # => verify fails
    def times(range)
      @expected_count = range
      self
    end

    # :call-seq: once() -> expectation
    #
    # Modifies expectation so that the expected method must be called exactly once.
    # Note that this is the default behaviour for an expectation, but you may wish to use it for clarity/emphasis.
    #   object = mock()
    #   object.expects(:expected_method).once
    #   object.expected_method
    #   # => verify succeeds
    #
    #   object = mock()
    #   object.expects(:expected_method).once
    #   object.expected_method
    #   object.expected_method
    #   # => verify fails
    #
    #   object = mock()
    #   object.expects(:expected_method).once
    #   # => verify fails
    def once()
      times(1)
      self
    end

    # :call-seq: never() -> expectation
    #
    # Modifies expectation so that the expected method must never be called.
    #   object = mock()
    #   object.expects(:expected_method).never
    #   object.expected_method
    #   # => verify fails
    #
    #   object = mock()
    #   object.expects(:expected_method).never
    #   object.expected_method
    #   # => verify succeeds
    def never
      times(0)
      self
    end

    # :call-seq: at_least(minimum_number_of_times) -> expectation
    #
    # Modifies expectation so that the expected method must be called at least a +minimum_number_of_times+.
    #   object = mock()
    #   object.expects(:expected_method).at_least(2)
    #   3.times { object.expected_method }
    #   # => verify succeeds
    #
    #   object = mock()
    #   object.expects(:expected_method).at_least(2)
    #   object.expected_method
    #   # => verify fails
    def at_least(minimum_number_of_times)
      times(Range.at_least(minimum_number_of_times))
      self
    end

    # :call-seq: at_least_once() -> expectation
    #
    # Modifies expectation so that the expected method must be called at least once.
    #   object = mock()
    #   object.expects(:expected_method).at_least_once
    #   object.expected_method
    #   # => verify succeeds
    #
    #   object = mock()
    #   object.expects(:expected_method).at_least_once
    #   # => verify fails
    def at_least_once()
      at_least(1)
      self
    end

    # :call-seq: at_most(maximum_number_of_times) -> expectation
    #
    # Modifies expectation so that the expected method must be called at most a +maximum_number_of_times+.
    #   object = mock()
    #   object.expects(:expected_method).at_most(2)
    #   2.times { object.expected_method }
    #   # => verify succeeds
    #
    #   object = mock()
    #   object.expects(:expected_method).at_most(2)
    #   3.times { object.expected_method }
    #   # => verify fails
    def at_most(maximum_number_of_times)
      times(Range.at_most(maximum_number_of_times))
      self
    end

    # :call-seq: at_most_once() -> expectation
    #
    # Modifies expectation so that the expected method must be called at most once.
    #   object = mock()
    #   object.expects(:expected_method).at_most_once
    #   object.expected_method
    #   # => verify succeeds
    #
    #   object = mock()
    #   object.expects(:expected_method).at_most_once
    #   2.times { object.expected_method }
    #   # => verify fails
    def at_most_once()
      at_most(1)
      self
    end

    # :call-seq: with(*arguments, &parameter_block) -> expectation
    #
    # Modifies expectation so that the expected method must be called with specified +arguments+.
    #   object = mock()
    #   object.expects(:expected_method).with(:param1, :param2)
    #   object.expected_method(:param1, :param2)
    #   # => verify succeeds
    #
    #   object = mock()
    #   object.expects(:expected_method).with(:param1, :param2)
    #   object.expected_method(:param3)
    #   # => verify fails
    # May be used with parameter matchers in Mocha::ParameterMatchers.
    #
    # If a +parameter_block+ is given, the block is called with the parameters passed to the expected method.
    # The expectation is matched if the block evaluates to +true+.
    #   object = mock()
    #   object.expects(:expected_method).with() { |value| value % 4 == 0 }
    #   object.expected_method(16)
    #   # => verify succeeds
    #
    #   object = mock()
    #   object.expects(:expected_method).with() { |value| value % 4 == 0 }
    #   object.expected_method(17)
    #   # => verify fails
    def with(*arguments, &parameter_block)
      @parameters, @parameter_block = arguments, parameter_block
      class << @parameters; def to_s; join(', '); end; end
      self
    end

    # :call-seq: yields(*parameters) -> expectation
    #
    # Modifies expectation so that when the expected method is called, it yields with the specified +parameters+.
    #   object = mock()
    #   object.expects(:expected_method).yields('result')
    #   yielded_value = nil
    #   object.expected_method { |value| yielded_value = value }
    #   yielded_value # => 'result'
    # May be called multiple times on the same expectation for consecutive invocations. Also see Expectation#then.
    #   object = mock()
    #   object.stubs(:expected_method).yields(1).then.yields(2)
    #   yielded_values_from_first_invocation = []
    #   yielded_values_from_second_invocation = []
    #   object.expected_method { |value| yielded_values_from_first_invocation << value } # first invocation
    #   object.expected_method { |value| yielded_values_from_second_invocation << value } # second invocation
    #   yielded_values_from_first_invocation # => [1]
    #   yielded_values_from_second_invocation # => [2]
    def yields(*parameters)
      @yield_parameters.add(*parameters)
      self
    end

    # :call-seq: multiple_yields(*parameter_groups) -> expectation
    #
    # Modifies expectation so that when the expected method is called, it yields multiple times per invocation with the specified +parameter_groups+.
    #   object = mock()
    #   object.expects(:expected_method).multiple_yields(['result_1', 'result_2'], ['result_3'])
    #   yielded_values = []
    #   object.expected_method { |*values| yielded_values << values }
    #   yielded_values # => [['result_1', 'result_2'], ['result_3]]
    # May be called multiple times on the same expectation for consecutive invocations. Also see Expectation#then.
    #   object = mock()
    #   object.stubs(:expected_method).multiple_yields([1, 2], [3]).then.multiple_yields([4], [5, 6])
    #   yielded_values_from_first_invocation = []
    #   yielded_values_from_second_invocation = []
    #   object.expected_method { |*values| yielded_values_from_first_invocation << values } # first invocation
    #   object.expected_method { |*values| yielded_values_from_second_invocation << values } # second invocation
    #   yielded_values_from_first_invocation # => [[1, 2], [3]]
    #   yielded_values_from_second_invocation # => [[4], [5, 6]]
    def multiple_yields(*parameter_groups)
      @yield_parameters.multiple_add(*parameter_groups)
      self
    end

    # :call-seq: returns(value) -> expectation
    # :call-seq: returns(*values) -> expectation
    #
    # Modifies expectation so that when the expected method is called, it returns the specified +value+.
    #   object = mock()
    #   object.stubs(:stubbed_method).returns('result')
    #   object.stubbed_method # => 'result'
    #   object.stubbed_method # => 'result'
    # If multiple +values+ are given, these are returned in turn on consecutive calls to the method.
    #   object = mock()
    #   object.stubs(:stubbed_method).returns(1, 2)
    #   object.stubbed_method # => 1
    #   object.stubbed_method # => 2
    # May be called multiple times on the same expectation. Also see Expectation#then.
    #   object = mock()
    #   object.stubs(:expected_method).returns(1, 2).then.returns(3)
    #   object.expected_method # => 1
    #   object.expected_method # => 2
    #   object.expected_method # => 3
    # May be called in conjunction with Expectation#raises on the same expectation.
    #   object = mock()
    #   object.stubs(:expected_method).returns(1, 2).then.raises(Exception)
    #   object.expected_method # => 1
    #   object.expected_method # => 2
    #   object.expected_method # => raises exception of class Exception1
    # If +value+ is a +Proc+, then the expected method will return the result of calling <tt>Proc#call</tt>.
    #
    # This usage is _deprecated_.
    # Use explicit multiple return values and/or multiple expectations instead.
    #
    # A +Proc+ instance will be treated the same as any other value in a future release.
    #   object = mock()
    #   object.stubs(:stubbed_method).returns(lambda { rand(100) })
    #   object.stubbed_method # => 41
    #   object.stubbed_method # => 77
    def returns(*values)
      @return_values += ReturnValues.build(*values)
      self
    end

    # :call-seq: raises(exception = RuntimeError, message = nil) -> expectation
    #
    # Modifies expectation so that when the expected method is called, it raises the specified +exception+ with the specified +message+.
    #   object = mock()
    #   object.expects(:expected_method).raises(Exception, 'message')
    #   object.expected_method # => raises exception of class Exception and with message 'message'
    # May be called multiple times on the same expectation. Also see Expectation#then.
    #   object = mock()
    #   object.stubs(:expected_method).raises(Exception1).then.raises(Exception2)
    #   object.expected_method # => raises exception of class Exception1
    #   object.expected_method # => raises exception of class Exception2
    # May be called in conjunction with Expectation#returns on the same expectation.
    #   object = mock()
    #   object.stubs(:expected_method).raises(Exception).then.returns(2, 3)
    #   object.expected_method # => raises exception of class Exception1
    #   object.expected_method # => 2
    #   object.expected_method # => 3
    def raises(exception = RuntimeError, message = nil)
      @return_values += ReturnValues.new(ExceptionRaiser.new(exception, message))
      self
    end

    # :call-seq: then() -> expectation
    #
    # Syntactic sugar to improve readability. Has no effect on state of the expectation.
    #   object = mock()
    #   object.stubs(:expected_method).returns(1, 2).then.raises(Exception).then.returns(4)
    #   object.expected_method # => 1
    #   object.expected_method # => 2
    #   object.expected_method # => raises exception of class Exception
    #   object.expected_method # => 4
    def then
      self
    end

    # :stopdoc:

    def invoke
      @invoked_count += 1
      if block_given? then
        @yield_parameters.next_invocation.each do |yield_parameters|
          yield(*yield_parameters)
        end
      end
      @return_values.next
    end

    def verify
      yield(self) if block_given?
      unless (@expected_count === @invoked_count) then
        error = ExpectationError.new(error_message(@expected_count, @invoked_count))
        error.set_backtrace(filtered_backtrace)
        raise error
      end
    end

    def mocha_lib_directory
      File.expand_path(File.join(File.dirname(__FILE__), "..")) + File::SEPARATOR
    end

    def filtered_backtrace
      backtrace.reject { |location| Regexp.new(mocha_lib_directory).match(File.expand_path(location)) }
    end

    def method_signature
      return "#{method_name}" if @parameters.__is_a__(AlwaysEqual)
      "#{@method_name}(#{PrettyParameters.new(@parameters).pretty})"
    end

    def error_message(expected_count, actual_count)
      "#{@mock.mocha_inspect}.#{method_signature} - expected calls: #{expected_count.mocha_inspect}, actual calls: #{actual_count}"
    end

    # :startdoc:

  end

end


text:
package com.cqupt.carManage.dao;

import java.util.List;

import com.cqupt.carManage.model.TransferList;

public interface HBaseDao {

	List<?> Hquery(TransferList tf);
	boolean Hadd(TransferList tf);
	List<?> HaddQuery(TransferList tf);
}

redpajama_set_name: RedPajamaGithub


text:
/**
 * Application main test package.
 *
 * @author Grzegorz Gajos
 * @version $Id$
 * @since 0.5
 */
package com.opentangerine.clean;


text:
package com.kzmen.sczxjf.bean.entitys;

import com.kzmen.sczxjf.EnMoneySelectEntity;

/**
 * describe:
 * notice:
 * Created by FuPei on 2016/5/25.
 */
public class WeiXinEntity extends EnMoneySelectEntity {

    /**
     * uid : 49
     * weixin_text : 测试麻辣成都
     * fans : 100000
     * multiple_one_price : 50.00
     * single_price : 5.00
     * multiple_three_real_price : 97.50
     * avatar : http://ipx.2016.360netnews.com/Uploads/2016-05-16/5739955bc73f7/malachengdu.jpg
     * recommend_index : 0
     * city : 成都
     * id : 0ecc6afbfee66877638a6dccebdef51a
     * is_collect : 0
     * category : 323
     * single_real_price : 7.50
     * multiple_two_price : 55.00
     * province : 四川
     * authentication_type : 0
     * authentication_text : null
     * desc_remark : null
     * falg : 0
     * multiple_three_price : 65.00
     * weixin_account : woaixxc
     * counts : 20928
     * categorystr : 娱乐八卦
     * multiple_two_real_price : 82.50
     * multiple_one_real_price : 75.00
     */

    private String uid;
    private String weixin_text;
    private String fans;
    private String single_price;
    private String avatar;
    private String recommend_index;
    private String city;
    private String id;
    private String province;
    private String weixin_account;
    private String categorystr;
    private String multiple_one_real_price;
    private String single_real_price;
    private String multiple_two_real_price;
    private String multiple_three_real_price;
    private String authentication_text;

    public String getAuthentication_text() {
        return authentication_text;
    }

    public void setAuthentication_text(String authentication_text) {
        this.authentication_text = authentication_text;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getMultiple_two_real_price() {
        return multiple_two_real_price;
    }

    public void setMultiple_two_real_price(String multiple_two_real_price) {
        this.multiple_two_real_price = multiple_two_real_price;
    }

    public String getMultiple_three_real_price() {
        return multiple_three_real_price;
    }

    public void setMultiple_three_real_price(String multiple_three_real_price) {
        this.multiple_three_real_price = multiple_three_real_price;
    }

    public String getMultiple_one_real_price() {
        return multiple_one_real_price;
    }

    public void setMultiple_one_real_price(String multiple_one_real_price) {
        this.multiple_one_real_price = multiple_one_real_price;
    }

    public String getSingle_real_price() {
        return single_real_price;
    }

    public void setSingle_real_price(String single_real_price) {
        this.single_real_price = single_real_price;
    }

    public String getWeixin_text() {
        return weixin_text;
    }

    public void setWeixin_text(String weixin_text) {
        this.weixin_text = weixin_text;
    }

    public String getFans() {
        return fans;
    }

    public void setFans(String fans) {
        this.fans = fans;
    }

    public String getSingle_price() {
        return single_price;
    }

    public void setSingle_price(String single_price) {
        this.single_price = single_price;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getRecommend_index() {
        return recommend_index;
    }

    public void setRecommend_index(String recommend_index) {
        this.recommend_index = recommend_index;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getId() {
        return id;
    }

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

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getWeixin_account() {
        return weixin_account;
    }

    public void setWeixin_account(String weixin_account) {
        this.weixin_account = weixin_account;
    }

    public String getCategorystr() {
        return categorystr;
    }

    public void setCategorystr(String categorystr) {
        this.categorystr = categorystr;
    }

    @Override
    public float getMoney() {
        return getMinMoney();
    }

    @Override
    public String getIdentify() {
        return getId();
    }

    public float getMaxMoney() {
        float money = Float.MIN_VALUE;
        try{
            if(getSingle_real_price() != null && getSingle_real_price().indexOf("--") == -1) {
                if(Float.valueOf(getSingle_real_price()) >= money) {
                    money = Float.valueOf(getSingle_real_price());
                }
            }
            if(getMultiple_one_real_price() != null && getMultiple_one_real_price().indexOf("--") == -1) {
                if(Float.valueOf(getMultiple_one_real_price()) >= money) {
                    money = Float.valueOf(getMultiple_one_real_price());
                }
            }
            if(getMultiple_two_real_price() != null && getMultiple_two_real_price().indexOf("--") == -1) {
                if(Float.valueOf(getMultiple_two_real_price()) >= money) {
                    money = Float.valueOf(getMultiple_two_real_price());
                }
            }
            if(getMultiple_three_real_price() != null && getMultiple_three_real_price().indexOf("--") == -1) {
                if(Float.valueOf(getMultiple_three_real_price()) >= money) {
                    money = Float.valueOf(getMultiple_three_real_price());
                }
            }
        } catch (Exception e){

        }
        if(money == Float.MIN_VALUE) {
            money = 0;
        }
        return money;
    }

    public float getMinMoney() {
        float money = Float.MAX_VALUE;
        try{
            if(getSingle_real_price() != null && getSingle_real_price().indexOf("--") == -1) {
                if(Float.valueOf(getSingle_real_price()) <= money) {
                    money = Float.valueOf(getSingle_real_price());
                }
            }
            if(getMultiple_one_real_price() != null && getMultiple_one_real_price().indexOf("--") == -1) {
                if(Float.valueOf(getMultiple_one_real_price()) <= money) {
                    money = Float.valueOf(getMultiple_one_real_price());
                }
            }
            if(getMultiple_two_real_price() != null && getMultiple_two_real_price().indexOf("--") == -1) {
                if(Float.valueOf(getMultiple_two_real_price()) <= money) {
                    money = Float.valueOf(getMultiple_two_real_price());
                }
            }
            if(getMultiple_three_real_price() != null && getMultiple_three_real_price().indexOf("--") == -1) {
                if(Float.valueOf(getMultiple_three_real_price()) <= money) {
                    money = Float.valueOf(getMultiple_three_real_price());
                }
            }
        } catch (Exception e) {

        }
        if(money == Float.MAX_VALUE) {
            money = 0;
        }
        return money;
    }
}


text:
package at.dotpoint.gradle.cross.variant.model.buildtype;

import org.gradle.model.Managed;

/**
 *
 */
@Managed
//
public interface IBuildTypeInternal extends IBuildType
{

}


text:
package net.francesbagual.github.eip.pattern.router.compositeprocessor.mdb;

import static javax.jms.Session.AUTO_ACKNOWLEDGE;

import javax.annotation.Resource;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.inject.Inject;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.JMSContext;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

@MessageDriven(name = "CompositeHelloMDB", activationConfig = {
		@ActivationConfigProperty(propertyName = "destinationLookup", propertyValue = "queue/compositehello"),
		@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
		@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
		@ActivationConfigProperty(propertyName = "MaxPoolSize", propertyValue = "1") })
public class CompositeHelloMDB implements MessageListener {

	@Inject JMSContext context;
	@Resource(lookup = "jms/queue/compositeaggregator")
	private Queue aggregator;
	@Resource(lookup = "jms/queue/invalidmessage")
	private Queue invalidMessageQueue;

	@Override
	public void onMessage(Message message) {
		try {
			if (message instanceof TextMessage) sendToAggregator((TextMessage) message);
			else sentToInvalidMessageQueue(message);
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

	private void sendToAggregator(TextMessage message) throws JMSException, NamingException {
		String content = "Hello " + message.getText();
		String correlationId = message.getJMSCorrelationID();
		Long numberOfMessages = message.getLongProperty("numberOfMessages");
		send(content, correlationId, numberOfMessages);
	}

	private void send(String content, String correlationId, Long numberOfMessages) throws NamingException, JMSException {
		Connection conn = null;
		try {
			Context ctx = new InitialContext();
			ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup("java:/ConnectionFactory");
			conn = connectionFactory.createConnection();
			conn.start();
			Session consumerSession = conn.createSession(false, AUTO_ACKNOWLEDGE);
			consumerSession.createProducer(aggregator).send(createMessage(consumerSession, content, correlationId, numberOfMessages));
			consumerSession.close();
		} finally {
			try {
				conn.close();
			} catch (Exception ignore) {}
		}
	}

	private Message createMessage(Session session, String content, String correlationId, Long numberOfMessages) throws JMSException {
		Message message = session.createTextMessage(content);
		message.setJMSCorrelationID(correlationId);
		message.setLongProperty("numberOfMessages", numberOfMessages);
		return message;
	}

	private void sentToInvalidMessageQueue(Message message) {
		context.createProducer().send(invalidMessageQueue, "Splitter only accept text messages. Received: " + message);
	}

}


text:
Sample application to demonstrate the usage of the cordova-plugin-myo project.

## Sample app for Android

## Installation
0. (Prerequisite) If you haven't already, download and install the [Android SDK Build Tools](https://developer.android.com/tools/revisions/build-tools.html) and the [Cordova CLI](http://cordova.apache.org/docs/en/edge/guide_cli_index.md.html#The%20Command-Line%20Interface_installing_the_cordova_cli)
1. Clone this repository in your computer:

```git clone https://github.com/TribalyteTechnologies/cordova-plugin-myo-demo.git```
2. Go to the project root folder:

```cd cordova-plugin-myo-demo```
3. Add the cordova-plugin-myo:

```cordova plugin add https://github.com/TribalyteTechnologies/cordova-plugin-myo.git```
4. Add the Android platform:

```cordova platform add android```
5. Connect a compatible Android device and launch the application:

```cordova run android```
6. Make sure the Bluetooth interface of the mobile device is on.
7. Make sure the Myo device is on (put it on or shake it until the light starts blinking).

## Features
* Connect the Myo device using the attach buttons or the scan dialog available in the GUI
* Check the information of the connected Myo
* Make the Myo vibrate

![Application screenshot](screenshot.png?raw=true "Application screenshot")

# License
The MIT License (http://www.opensource.org/licenses/mit-license.html)

Copyright (c) 2014 Tribalyte Technologies S.L. (http://www.tribalyte.com/)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


text:
title: Self-Aware Faith
subblog: yhwh
tags:
---


text:
package ch.fhnw.oop2.academyApp;

import ch.fhnw.oop2.academyApp.models.Model;
import ch.fhnw.oop2.academyApp.models.Movie;
import javafx.beans.binding.Bindings;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.FlowPane;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import javafx.util.converter.NumberStringConverter;

import java.io.*;
import java.net.URI;
import java.net.URL;
import java.util.ResourceBundle;

/**
 * Created by Michael on 5/12/2015.
 */
public class Controller implements Initializable {

    private Model model;
    private Stage stage;

    public Controller() {
        model = new Model(new File(getClass().getResource("movies.dat").getFile()));
        model.load();
    }

    @FXML
    private TableView<Movie> grid;

    @FXML
    private TableColumn<Movie, String> titleCol;

    @FXML
    private TableColumn<Movie, Integer> yearOfAwardCol;

    @FXML
    private TableColumn<Movie, String> directorCol;

    @FXML
    private TableColumn<Movie, String> mainActorCol;

    @FXML
    private TableColumn<Movie, String> titleEnglishCol;

    @FXML
    private TableColumn<Movie, Integer> yearOfProductionCol;

    @FXML
    private TableColumn<Movie, String> countryCol;

    @FXML
    private TableColumn<Movie, Integer> durationCol;

    @FXML
    private TableColumn<Movie, Integer> fskCol;

    @FXML
    private TableColumn<Movie, Integer> oscarCntCol;

    @FXML
    private TextField title;

    @FXML
    private TextField director;

    @FXML
    private TextField mainactor;

    @FXML
    private TextField duration;

    @FXML
    private TextField fsk;

    @FXML
    private TextField genre;

    @FXML
    private TextField yearOfAward;

    @FXML
    private TextField yearOfProduction;

    @FXML
    private TextField country;

    @FXML
    private Slider oscarCnt;

    @FXML
    private ImageView poster;

    @FXML
    private FlowPane oscarStatuettes;

    @FXML
    private DatePicker releaseDatePicker;

    @FXML
    private ImageView countryFlag;

    @FXML
    private Label titleTall;

    private Image oscarImg;

    @Override
    public void initialize(URL location, ResourceBundle resources) {

        try {
            oscarImg = new Image(new FileInputStream(getClass().getResource("/oscar.png").getFile()));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }

        country.textProperty().addListener(this::onCountryChanged);
        oscarCnt.valueProperty().addListener(this::onOscarCntChanged);

        titleCol.setCellValueFactory(new PropertyValueFactory("title"));

        yearOfAwardCol.setCellValueFactory(new PropertyValueFactory("yearOfAward"));
        yearOfAwardCol.setEditable(true);

        directorCol.setCellValueFactory(new PropertyValueFactory("director"));
        mainActorCol.setCellValueFactory(new PropertyValueFactory("mainActor"));
        titleEnglishCol.setCellValueFactory(new PropertyValueFactory("titleEnglish"));
        yearOfProductionCol.setCellValueFactory(new PropertyValueFactory("yearOfProduction"));
        countryCol.setCellValueFactory(new PropertyValueFactory("country"));
        durationCol.setCellValueFactory(new PropertyValueFactory("duration"));
        fskCol.setCellValueFactory(new PropertyValueFactory("fsk"));
        oscarCntCol.setCellValueFactory(new PropertyValueFactory("oscarCnt"));

        grid.setItems(model.getMovieList());
        grid.getSelectionModel().selectedItemProperty().addListener(this::onSelectionChanged);

        if (model.getMovieList().size() > 0) {
            grid.getSelectionModel().select(model.getMovieList().get(0));
        }

        titleTall.textProperty().bindBidirectional(title.textProperty());

    }

    private void onCountryChanged(ObservableValue<? extends String> observable, String oldValue, String newValue) {

        boolean success = false;
        try {
            URL path = getClass().getResource("/flags_iso/24/" + ("" + newValue).toLowerCase() + ".png");

            if (path != null) {

                File f = new File(path.getFile());

                if (f.exists()) {
                    FileInputStream stream = new FileInputStream(path.getFile());
                    Image flag = new Image(stream);
                    countryFlag.setImage(flag);
                    success = true;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        if (!success) {
            //use empty Image
            FileInputStream stream = null;
            try {
                stream = new FileInputStream(getClass().getResource("/flags_iso/24/empty.png").getFile());
                countryFlag.setImage(new Image(stream));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }
    }

    private void onOscarCntChanged(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {

        oscarStatuettes.getChildren().clear();

        for (int i = newValue.intValue(); i > 0; i--) {
            oscarStatuettes.getChildren().add(new ImageView(oscarImg));
        }
    }

    public void setStage(Stage stage) {
        this.stage = stage;
    }

    private void onSelectionChanged(ObservableValue<? extends Movie> observable, Movie oldValue, Movie newValue) {

        if (oldValue != null) {
            title.textProperty().unbindBidirectional(oldValue.titleProperty());
            director.textProperty().unbindBidirectional(oldValue.directorProperty());
            mainactor.textProperty().unbindBidirectional(oldValue.mainActorProperty());
            fsk.textProperty().unbindBidirectional(oldValue.fskProperty());
            duration.textProperty().unbindBidirectional(oldValue.durationProperty());
            oscarCnt.valueProperty().unbindBidirectional(oldValue.oscarCntProperty());
            genre.textProperty().unbindBidirectional(oldValue.genreProperty());
            country.textProperty().unbindBidirectional(oldValue.countryProperty());
            yearOfAward.textProperty().unbindBidirectional(oldValue.yearOfAwardProperty());
            yearOfProduction.textProperty().unbindBidirectional(oldValue.yearOfProductionProperty());
            releaseDatePicker.valueProperty().unbindBidirectional(oldValue.releaseProperty());
        }

        if (newValue != null) {
            title.textProperty().bindBidirectional(newValue.titleProperty());
            director.textProperty().bindBidirectional(newValue.directorProperty());
            mainactor.textProperty().bindBidirectional(newValue.mainActorProperty());
            fsk.textProperty().bindBidirectional(newValue.fskProperty(), new NumberStringConverter());
            duration.textProperty().bindBidirectional(newValue.durationProperty(), new NumberStringConverter());
            oscarCnt.valueProperty().bindBidirectional(newValue.oscarCntProperty());
            genre.textProperty().bindBidirectional(newValue.genreProperty());
            country.textProperty().bindBidirectional(newValue.countryProperty());
            yearOfAward.textProperty().bindBidirectional(newValue.yearOfAwardProperty(), new NumberStringConverter("####"));
            yearOfProduction.textProperty().bindBidirectional(newValue.yearOfProductionProperty(), new NumberStringConverter("####"));
            releaseDatePicker.valueProperty().bindBidirectional(newValue.releaseProperty());
        }
        String path = "/poster/" + newValue.imageFilename().get();
        if (path != null && getClass().getResource(path) != null) {
            File file = new File(getClass().getResource(path).getFile());
            if (file.exists()) {
                try {
                    Image img = new Image(new FileInputStream(file));
                    poster.setImage(img);
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                }
            }
        }
    }

    @FXML
    private void importBtnClick(ActionEvent event) {
        FileChooser fc = new FileChooser();
        fc.setTitle("Import .csv File");
        fc.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(".csv-File", "csv"));
        File file = fc.showOpenDialog(stage);
        model.loadFromCsv(file);
    }

    @FXML
    private void newBtnClick(ActionEvent event) {
        Movie m = new Movie();
        grid.getItems().add(m);
        grid.getSelectionModel().select(m);
    }

    @FXML
    private void saveBtnClick(ActionEvent event) {

        try {
            model.save();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @FXML
    private void deleteBtnClick(ActionEvent event) {
        Movie m = grid.getSelectionModel().getSelectedItem();
        grid.getItems().remove(m);
    }

    /**
     * Save the changes of model
     */
    public void saveModel() {
        try {
            model.save();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}


text:
<!DOCTYPE html>

  <meta charset="utf-8">

  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>example_google module — CaptsLog  documentation</title>

    <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />

        <link rel="index" title="Index"
              href="genindex.html"/>
        <link rel="search" title="Search" href="search.html"/>
    <link rel="top" title="CaptsLog  documentation" href="index.html"/>

             CaptsLog

                0.1

  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>

captslog

          CaptsLog

Docs »

example_google module

             View page source

example_google module¶

        © Copyright 2017, Jaehoon H., Chet L., Conor S., Katshuri K..

  Built with Sphinx using a theme provided by Read the Docs.


text:
/* Move down content because we have a fixed navbar that is 50px tall */
body {
  padding-top: 50px;
  padding-bottom: 20px;
}


text:
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;

namespace AccountGoWeb.Controllers
{
    [Microsoft.AspNetCore.Authorization.Authorize]
    public class HomeController : BaseController
    {
        public HomeController(IConfiguration config)
        {
            _baseConfig = config;
            Models.SelectListItemHelper._config = config;
        }
        public IActionResult Index()
        {
            ViewBag.PageContentHeader = "Dashboard";
            ViewBag.ApiMontlySales = _baseConfig["ApiUrl"] + "sales/getmonthlysales";
            return View();
        }
    }
}


text:
<?php

namespace Google\Service\CloudResourceManager;

class CreateFolderMetadata extends \Google\Model
{
  /**
   * @var string
   */
  public $displayName;
  /**
   * @var string
   */
  public $parent;

  /**
   * @param string
   */
  public function setDisplayName($displayName)
  {
    $this->displayName = $displayName;
  }
  /**
   * @return string
   */
  public function getDisplayName()
  {
    return $this->displayName;
  }
  /**
   * @param string
   */
  public function setParent($parent)
  {
    $this->parent = $parent;
  }
  /**
   * @return string
   */
  public function getParent()
  {
    return $this->parent;
  }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(CreateFolderMetadata::class, 'Google_Service_CloudResourceManager_CreateFolderMetadata');


text:
package sim

type Progress interface {
	Start(s *ProgressStat)
	Tick(s *ProgressStat)
	Stop(s *ProgressStat)
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>tinystr.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">

Main Page   Class Hierarchy   Compound List   File List   Compound Members

tinystr.h

00001 /*
00002 www.sourceforge.net/projects/tinyxml
00003 Original file by Yves Berquin.
00004
00005 This software is provided 'as-is', without any express or implied
00006 warranty. In no event will the authors be held liable for any
00007 damages arising from the use of this software.
00008
00009 Permission is granted to anyone to use this software for any
00010 purpose, including commercial applications, and to alter it and
00011 redistribute it freely, subject to the following restrictions:
00012
00013 1. The origin of this software must not be misrepresented; you must
00014 not claim that you wrote the original software. If you use this
00015 software in a product, an acknowledgment in the product documentation
00016 would be appreciated but is not required.
00017
00018 2. Altered source versions must be plainly marked as such, and
00019 must not be misrepresented as being the original software.
00020
00021 3. This notice may not be removed or altered from any source
00022 distribution.
00023 */
00024
00025 #include "tinyxml.h"
00026
00027
00028 #ifndef TIXML_USE_STL
00029
00030 #ifndef TIXML_STRING_INCLUDED
00031 #define TIXML_STRING_INCLUDED
00032
00033 #ifdef _MSC_VER
00034 #pragma warning( disable : 4786 )   // Debugger truncating names.
00035 #endif
00036
00037 #include <assert.h>
00038
00039 /*
00040    TiXmlString is an emulation of the std::string template.
00041    Its purpose is to allow compiling TinyXML on compilers with no or poor STL support.
00042    Only the member functions relevant to the TinyXML project have been implemented.
00043    The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase
00044    a string and there's no more room, we allocate a buffer twice as big as we need.
00045 */
00046 class TiXmlString
00047 {
00048   public :
00049     // TiXmlString constructor, based on a string
00050     TiXmlString (const char * instring);
00051
00052     // TiXmlString empty constructor
00053     TiXmlString ()
00054     {
00055         allocated = 0;
00056         cstring = NULL;
00057         current_length = 0;
00058     }
00059
00060     // TiXmlString copy constructor
00061     TiXmlString (const TiXmlString& copy);
00062
00063     // TiXmlString destructor
00064     ~ TiXmlString ()
00065     {
00066         empty_it ();
00067     }
00068
00069     // Convert a TiXmlString into a classical char *
00070     const char * c_str () const
00071     {
00072         if (allocated)
00073             return cstring;
00074         return "";
00075     }
00076
00077     // Return the length of a TiXmlString
00078     unsigned length () const
00079     {
00080         return ( allocated ) ? current_length : 0;
00081     }
00082
00083     // TiXmlString = operator
00084     void operator = (const char * content);
00085
00086     // = operator
00087     void operator = (const TiXmlString & copy);
00088
00089     // += operator. Maps to append
00090     TiXmlString& operator += (const char * suffix)
00091     {
00092         append (suffix);
00093         return *this;
00094     }
00095
00096     // += operator. Maps to append
00097     TiXmlString& operator += (char single)
00098     {
00099         append (single);
00100         return *this;
00101     }
00102
00103     // += operator. Maps to append
00104     TiXmlString& operator += (TiXmlString & suffix)
00105     {
00106         append (suffix);
00107         return *this;
00108     }
00109     bool operator == (const TiXmlString & compare) const;
00110     bool operator < (const TiXmlString & compare) const;
00111     bool operator > (const TiXmlString & compare) const;
00112
00113     // Checks if a TiXmlString is empty
00114     bool empty () const
00115     {
00116         return length () ? false : true;
00117     }
00118
00119     // single char extraction
00120     const char& at (unsigned index) const
00121     {
00122         assert( index < length ());
00123         return cstring [index];
00124     }
00125
00126     // find a char in a string. Return TiXmlString::notfound if not found
00127     unsigned find (char lookup) const
00128     {
00129         return find (lookup, 0);
00130     }
00131
00132     // find a char in a string from an offset. Return TiXmlString::notfound if not found
00133     unsigned find (char tofind, unsigned offset) const;
00134
00135     /*  Function to reserve a big amount of data when we know we'll need it. Be aware that this
00136         function clears the content of the TiXmlString if any exists.
00137     */
00138     void reserve (unsigned size)
00139     {
00140         empty_it ();
00141         if (size)
00142         {
00143             allocated = size;
00144             cstring = new char [size];
00145             cstring [0] = 0;
00146             current_length = 0;
00147         }
00148     }
00149
00150     // [] operator
00151     char& operator [] (unsigned index) const
00152     {
00153         assert( index < length ());
00154         return cstring [index];
00155     }
00156
00157     // Error value for find primitive
00158     enum {  notfound = 0xffffffff,
00159             npos = notfound };
00160
00161     void append (const char *str, int len );
00162
00163   protected :
00164
00165     // The base string
00166     char * cstring;
00167     // Number of chars allocated
00168     unsigned allocated;
00169     // Current string size
00170     unsigned current_length;
00171
00172     // New size computation. It is simplistic right now : it returns twice the amount
00173     // we need
00174     unsigned assign_new_size (unsigned minimum_to_allocate)
00175     {
00176         return minimum_to_allocate * 2;
00177     }
00178
00179     // Internal function that clears the content of a TiXmlString
00180     void empty_it ()
00181     {
00182         if (cstring)
00183             delete [] cstring;
00184         cstring = NULL;
00185         allocated = 0;
00186         current_length = 0;
00187     }
00188
00189     void append (const char *suffix );
00190
00191     // append function for another TiXmlString
00192     void append (const TiXmlString & suffix)
00193     {
00194         append (suffix . c_str ());
00195     }
00196
00197     // append for a single char.
00198     void append (char single)
00199     {
00200         if ( cstring && current_length < (allocated-1) )
00201         {
00202             cstring[ current_length ] = single;
00203             ++current_length;
00204             cstring[ current_length ] = 0;
00205         }
00206         else
00207         {
00208             char smallstr [2];
00209             smallstr [0] = single;
00210             smallstr [1] = 0;
00211             append (smallstr);
00212         }
00213     }
00214
00215 } ;
00216
00217 /*
00218    TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString.
00219    Only the operators that we need for TinyXML have been developped.
00220 */
00221 class TiXmlOutStream : public TiXmlString
00222 {
00223 public :
00224     TiXmlOutStream () : TiXmlString () {}
00225
00226     // TiXmlOutStream << operator. Maps to TiXmlString::append
00227     TiXmlOutStream & operator << (const char * in)
00228     {
00229         append (in);
00230         return (* this);
00231     }
00232
00233     // TiXmlOutStream << operator. Maps to TiXmlString::append
00234     TiXmlOutStream & operator << (const TiXmlString & in)
00235     {
00236         append (in . c_str ());
00237         return (* this);
00238     }
00239 } ;
00240
00241 #endif  // TIXML_STRING_INCLUDED
00242 #endif  // TIXML_USE_STL

<address style="align: right;">Generated on Sun Aug 1 12:06:33 2004 for TinyXml by

1.2.18 </address>


text:
If your MQTT server ("controller") and remote device ("car")
are operating without keyboard & display, then it's convenient
to have a way to shut down the Raspberry Pis easily.

These scripts create a user-space demon for doing that,
but to be perfectly honest it's a bad and hackish solution.

If car.py/controller.py crash on execution, then you will
need to mount the SD card on another machine to edit out the
shutdown command... I speak from experience.


text:
--TEST--
Test ord() function : error conditions
--FILE--
<?php

/* Prototype  : int ord  ( string $string  )
 * Description: Return ASCII value of character
 * Source code: ext/standard/string.c
*/

echo "*** Testing ord() : error conditions ***\n";

echo "\n-- Testing ord() function with no arguments --\n";
var_dump( ord() );

echo "\n-- Testing ord() function with more than expected no. of arguments --\n";
$extra_arg = 10;
var_dump( ord(72, $extra_arg) );

?>
===DONE===
--EXPECTF--
*** Testing ord() : error conditions ***

-- Testing ord() function with no arguments --

Warning: ord() expects exactly 1 parameter, 0 given in %s on line %d
NULL

-- Testing ord() function with more than expected no. of arguments --

Warning: ord() expects exactly 1 parameter, 2 given in %s on line %d
NULL
===DONE===


text:
YUI.add('parent-binder-static', function(Y, NAME) {

/**
 * The parent-binder-static module.
 *
 * @module parent-binder-static
 */

    /**
     * Constructor for the Binder class.
     *
     * @param mojitProxy {Object} The proxy to allow the binder to interact
     *        with its owning mojit.
     *
     * @class Binder
     * @constructor
     */
    Y.namespace('mojito.binders')[NAME] = {

        /**
         * Binder initialization method, invoked after all binders on the page
         * have been constructed.
         */
        init: function(mojitProxy) {
            this.mp = mojitProxy;
            Y.log(this.mp);
        },

        /**
         * The binder method, invoked to allow the mojit to attach DOM event
         * handlers.
         *
         * @param node {Node} The DOM node to which this mojit is attached.
         */
        bind: function(node) {
            this.node = node;
            this.mp.listen('hover', function(data) {
                Y.log('heard hover from ' + data.source);
            });
        },

        handleClick: function(evt) {
            var event, message, child, self = this;
            if (evt.currentTarget.get('tagName') === 'BUTTON') {
                event = this.node.one('#event').get('value');
                message = this.node.one('#message').get('value');
                child = this.node.one('#child').get('value');
                this.mp.broadcast(event, {message: message}, {target: {slot: child}});
            }
        }

    };

}, '0.0.1', {requires: ['mojito-client']});


text:
// File: GenericImage.xaml.cs
// Project: ROS_ImageWPF
//
// ROS.NET
// Eric McCann <emccann@cs.uml.edu>
// UMass Lowell Robotics Laboratory
//
// Reimplementation of the ROS (ros.org) ros_cpp client in C#.
//
// Created: 04/28/2015
// Updated: 10/07/2015

#region USINGZ

using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using PixelFormat = System.Drawing.Imaging.PixelFormat;
using Point = System.Drawing.Point;
using Size = System.Windows.Size;

#endregion

namespace ROS_ImageWPF
{
    /// <summary>
    ///     Interaction logic for GenericImage.xaml
    /// </summary>
    public partial class GenericImage : UserControl
    {
        public event FPSEvent fpsevent;
        private int frames;
        private DateTime lastFrame = DateTime.Now;

        public GenericImage()
        {
            InitializeComponent();
            impl = new GenericImageIMPL(image);
        }

        private GenericImageIMPL impl;

        /// <summary>
        ///     Looks up the bitmaps dress, then starts passing the image around as a Byte[] and a System.Media.Size to the
        ///     overloaded UpdateImages that make this work
        /// </summary>
        /// <param name="bmp">
        /// </param>
        public void UpdateImage(Bitmap bmp)
        {
            impl.UpdateImage(bmp);
        }

        /// <summary>
        ///     if hasHeader is true, then UpdateImage(byte[]) is called
        ///     otherwise, the size is compared to lastSize,
        ///     if they differ or header is null, a header is created, and concatinated with data, then UpdateImage(byte[]) is
        ///     called
        /// </summary>
        /// <param name="data">
        ///     image data
        /// </param>
        /// <param name="size">
        ///     image size
        /// </param>
        /// <param name="hasHeader">
        ///     whether or not a header needs to be concatinated
        /// </param>
        public void UpdateImage(byte[] data, Size size, bool hasHeader, string encoding = null)
        {
            impl.UpdateImage(data, size, hasHeader, encoding);
        }

        /// <summary>
        ///     Uses a memory stream to turn a byte array into a BitmapImage via helper method, BytesToImage, then passes the image
        ///     to UpdateImage(BitmapImage)
        /// </summary>
        /// <param name="data">
        /// </param>
        public void UpdateImage(byte[] data)
        {
            impl.UpdateImage(data);
            frames = (frames + 1) % 10;
            if (frames == 0)
            {
                if (fps.Visibility == Visibility.Visible)
                    fps.Content = "" + Math.Round(10.0 / DateTime.Now.Subtract(lastFrame).TotalMilliseconds * 1000.0, 2);
                if (fpsevent != null)
                    fpsevent(Math.Round(10.0 / DateTime.Now.Subtract(lastFrame).TotalMilliseconds * 1000.0, 2));
                lastFrame = DateTime.Now;
            }
        }

        /// <summary>
        /// Directly sets this GenericImage's image based on an already created WPF ImageSource
        /// </summary>
        /// <param name="imgsrc">The image to show on this GenericImage</param>
        public void UpdateImage(ImageSource imgsrc)
        {
            impl.UpdateImage(imgsrc);
        }

        /// <summary>
        /// Apply specified scale transformation to this GenericImage's image (most useful with 1 or -1 to correct inversions)
        /// </summary>
        /// <param name="scalex">X Scale</param>
        /// <param name="scaley">Y Scale</param>
        public void Transform(double scalex, double scaley)
        {
            image.Transform = new ScaleTransform(scalex, scaley, ActualWidth/2, ActualHeight/2);
        }

        /// <summary>
        /// Apply specified scale transformation to this GenericImage's image (most useful with 1 or -1 to correct inversions)
        /// </summary>
        /// <param name="scalex">X Scale</param>
        /// <param name="scaley">Y Scale</param>
        public void Transform(int scalex, int scaley)
        {
            image.Transform = new ScaleTransform(1.0*scalex, 1.0*scaley, ActualWidth/2, ActualHeight/2);
        }

        /// <summary>
        /// Returns a frozen deep copy of this GenericImage's ImageSource
        /// </summary>
        /// <returns>a clone of the ImageSource</returns>
        public ImageSource CloneImage()
        {
            if (image.ImageSource == null)
                return null;
            ImageSource ret = image.ImageSource.Clone();
            if (ret.CanFreeze) ret.Freeze();
            return ret;
        }
    }

    public class GenericImageIMPL
    {
        private ImageBrush image;

        /// <summary>
        /// Create a GenericImageIMPL to render images on specified ImageBrush UIElement
        /// </summary>
        /// <param name="ib">Target ImageBrush</param>
        public GenericImageIMPL(ImageBrush ib)
        {
            image = ib;
        }

        #region variables and such

        /// <summary>
        ///     54 byte bitmap file header to be stuck on the front of every byte array from the blimp
        /// </summary>
        private byte[] header;

        /// <summary>
        ///     Used to update the header (if it's needed) if the size of the image is different than the one used to make the
        ///     header
        /// </summary>
        private Size lastSize;

        #endregion

        #region UpdateImage overloads that will take a byte[] (with or without header), a System.Drawing.Bitmap, or a System.Windows.Media.whatever.BitmapImage

        /// <summary>
        ///     Looks up the bitmaps dress, then starts passing the image around as a Byte[] and a System.Media.Size to the
        ///     overloaded UpdateImages that make this work
        /// </summary>
        /// <param name="bmp">
        /// </param>
        public void UpdateImage(Bitmap bmp)
        {
            try
            {
                // look up the image's dress
                BitmapData bData = bmp.LockBits(new Rectangle(new Point(), bmp.Size),
                    ImageLockMode.ReadOnly,
                    PixelFormat.Format24bppRgb);

                // d.Imaging.PixelFormat.Format32bppArgb);
                int byteCount = bData.Stride*bmp.Height;
                byte[] rgbData = new byte[byteCount];

                // turn the bitmap into a byte[]
                Marshal.Copy(bData.Scan0, rgbData, 0, byteCount);
                bmp.UnlockBits(bData);

                // starts the overload cluster-mess to show the image
                UpdateImage(rgbData, SizeConverter(bmp.Size), false);

                // get that stuff out of memory so it doesn't mess our day up.
                bmp.Dispose();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }

        /// <summary>
        ///     if hasHeader is true, then UpdateImage(byte[]) is called
        ///     otherwise, the size is compared to lastSize,
        ///     if they differ or header is null, a header is created, and concatinated with data, then UpdateImage(byte[]) is
        ///     called
        /// </summary>
        /// <param name="data">
        ///     image data
        /// </param>
        /// <param name="size">
        ///     image size
        /// </param>
        /// <param name="hasHeader">
        ///     whether or not a header needs to be concatinated
        /// </param>
        public void UpdateImage(byte[] data, Size size, bool hasHeader, string encoding = null)
        {
            //Console.WriteLine(1 / DateTime.Now.Subtract(wtf).TotalSeconds);
            //wtf = DateTime.Now;
            if (hasHeader)
            {
                UpdateImage(data);
                return;
            }

            if (data != null)
            {
                byte[] correcteddata;
                switch (encoding)
                {
                    case "mono16":
                        correcteddata = new byte[(int) Math.Round(3d*data.Length/2d)];
                        for (int i = 0, ci = 0; i < data.Length; i += 2, ci += 3)
                        {
                            ushort realDepth = (ushort) ((data[i] << 8) | (data[i + 1]));
                            byte pixelcomponent = (byte) Math.Floor(realDepth/255d);
                            correcteddata[ci] = correcteddata[ci + 1] = correcteddata[ci + 2] = pixelcomponent;
                        }
                        break;
                    case "16UC1":
                    {
                        correcteddata = new byte[(int) Math.Round(3d*data.Length/2d)];
                        int[] balls = new int[(int) Math.Round(data.Length/2d)];
                        int maxball = 0;
                        int minball = int.MaxValue;
                        for (int i = 0, ci = 0; i < data.Length; i += 2, ci += 3)
                        {
                            balls[i/2] = (data[i + 1] << 8) | (data[i]);
                            if (balls[i/2] > maxball)
                                maxball = balls[i/2];
                            if (balls[i/2] < minball)
                                minball = balls[i/2];
                        }
                        for (int i = 0, ci = 0; i < balls.Length; i++, ci += 3)
                        {
                            byte intensity = (byte) Math.Round((maxball - (255d*balls[i]/(maxball - minball))));
                            correcteddata[ci] = correcteddata[ci + 1] = correcteddata[ci + 2] = intensity;
                        }
                    }
                        break;
                    case "mono8":
                    case "bayer_grbg8":
                        correcteddata = new byte[3*data.Length];
                        for (int i = 0, ci = 0; i < data.Length; i += 1, ci += 3)
                        {
                            correcteddata[ci] = correcteddata[ci + 1] = correcteddata[ci + 2] = data[i];
                        }
                        break;
                    case "32FC1":
                    {
                        correcteddata = new byte[(int) Math.Round(3d*data.Length/4d)];
                        for (int i = 0, ci = 0; i < data.Length; i += 4, ci += 3)
                        {
                            correcteddata[ci] = correcteddata[ci + 1] = correcteddata[ci + 2] = (byte) Math.Floor(255d*BitConverter.ToSingle(data, i));
                        }
                    }
                        break;
                    default:
                        correcteddata = data;
                        break;
                }
                // make a bitmap file header if we don't already have one
                if (header == null || size != lastSize)
                    MakeHeader(correcteddata, size);

                // stick it on the bitmap data
                try
                {
                    UpdateImage(concat(header, correcteddata));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
                data = null;
                correcteddata = null;
            }
        }

        /// <summary>
        ///     Uses a memory stream to turn a byte array into a BitmapImage via helper method, BytesToImage, then passes the image
        ///     to UpdateImage(BitmapImage)
        /// </summary>
        /// <param name="data">
        /// </param>
        public void UpdateImage(byte[] data)
        {
            BitmapImage img = new BitmapImage();
            ImageSource target = image.ImageSource;
            try
            {
                if (BytesToImage(data, ref img) && img.DecodePixelWidth >= 0)
                {
                    target = img;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            image.ImageSource = target;
            img = null;
            target = null;
        }

        /// <summary>
        /// Directly sets this GenericImage's image based on an already created WPF ImageSource
        /// </summary>
        /// <param name="imgsrc">The image to show on this GenericImage</param>
        public void UpdateImage(ImageSource imgsrc)
        {
            image.ImageSource = imgsrc;
        }

        /// <summary>
        ///     turns a System.Drawing.Size into the WPF double,double version
        /// </summary>
        /// <param name="s">
        /// </param>
        /// <returns>
        /// </returns>
        protected static Size SizeConverter(System.Drawing.Size s)
        {
            return new Size(s.Width, s.Height);
        }

        /// <summary>
        /// Attempts to convert the byte array, data, into a valid Image, img
        /// </summary>
        /// <param name="data">image data (ideally)</param>
        /// <param name="img">target image</param>
        /// <returns>true if successful</returns>
        public static bool BytesToImage(byte[] data, ref BitmapImage img)
        {
            bool ret = false;
            if (data.Length > 0)
            {
                // makes a memory stream with the data
                using (MemoryStream ms = new MemoryStream())
                {
                    try
                    {
                        ms.Write(data, 0, data.Length);
                        ms.Seek(0, SeekOrigin.Begin);
                        // tries to turn the memory stream into an image
                        img.BeginInit();
                        img.CacheOption = BitmapCacheOption.OnLoad; //stop being lazy. for serious.
                        img.StreamSource = ms;
                        img.EndInit();
                        ret = true;
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                    }
                    ms.Close();
                }
            }
            return ret;
        }

        #endregion

        #region helper methods

        /// <summary>
        ///     makes a file header with appropriate width, height, length, and such for the bytearray + drawing.size sent as
        ///     members of the lazycopypastefixerupper
        /// </summary>
        /// <param name="rawdata">
        ///     The rawdata.
        /// </param>
        /// <param name="size">
        ///     The size.
        /// </param>
        private void MakeHeader(byte[] rawdata, Size size)
        {
            lastSize = size;
            int length = rawdata.Length;
            int wholelength = rawdata.Length + 54;
            int width = (int) size.Width;
            int height = (int) size.Height;

            //Console.WriteLine("width= " + width + "\nheight= " + height + "\nlength=" + length + "\nbpp= " + (length / (width * height)));
            byte bitmask = 255;
            header = new byte[54];
            header[0] = (byte) 'B';
            header[1] = (byte) 'M';
            header[2] = (byte) (wholelength & bitmask);
            wholelength = wholelength >> 8;
            header[3] = (byte) (wholelength & bitmask);
            wholelength = wholelength >> 8;
            header[4] = (byte) (wholelength & bitmask);
            wholelength = wholelength >> 8;
            header[5] = (byte) (wholelength & bitmask);

            header[10] = 54;
            header[11] = 0;
            header[12] = 0;
            header[13] = 0;

            header[14] = 40;
            header[15] = 0;
            header[16] = 0;
            header[17] = 0;

            header[18] = (byte) (width & bitmask);
            width = width >> 8;
            header[19] = (byte) (width & bitmask);
            width = width >> 8;
            header[20] = (byte) (width & bitmask);
            width = width >> 8;
            header[21] = (byte) (width & bitmask);

            header[22] = (byte) (height & bitmask);
            height = height >> 8;
            header[23] = (byte) (height & bitmask);
            height = height >> 8;
            header[24] = (byte) (height & bitmask);
            height = height >> 8;
            header[25] = (byte) (height & bitmask);
            header[26] = 1;
            header[27] = 0;
            int bpp = ((int) (Math.Floor(rawdata.Length/(size.Width*size.Height)))*8);
            //Console.WriteLine("BPP = " + bpp);
            header[28] = (byte) bpp;
            header[29] = 0;

            header[30] = 0;
            header[31] = 0;
            header[32] = 0;
            header[33] = 0;

            header[34] = 0x13;
            header[35] = 0x0B;
            header[36] = 0;
            header[37] = 0;

            header[38] = 0x13;
            header[39] = 0x0B;
            header[40] = 0;
            header[41] = 0;

            header[42] = 0;
            header[43] = 0;
            header[44] = 0;
            header[45] = 0;

            header[46] = 0;
            header[47] = 0;
            header[48] = 0;
            header[49] = 0;

            header[50] = (byte) (length & bitmask);
            length = length >> 8;
            header[51] = (byte) (length & bitmask);
            length = length >> 8;
            header[52] = (byte) (length & bitmask);
            length = length >> 8;
            header[53] = (byte) (length & bitmask);
        }

        /// <summary>
        ///     takes 1 byte array, and 1 byte array, and then returns 1 byte array
        /// </summary>
        /// <param name="a">
        /// </param>
        /// <param name="b">
        /// </param>
        /// <returns>
        /// </returns>
        private static byte[] concat(byte[] a, byte[] b)
        {
            byte[] result = new byte[a.Length + b.Length];
            Array.Copy(a, result, a.Length);
            Array.Copy(b, 0, result, a.Length, b.Length);
            return result;
        }

        #endregion
    }

    public delegate void FPSEvent(double fps);
}


text:
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.selector import HtmlXPathSelector
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.selector import HtmlXPathSelector
from scrapy.item import Item, Field
import re

snpp_base_url = "http://www.snpp.com/episodes.html"
ss_base_url = "http://www.springfieldspringfield.co.uk/episode_scripts.php"
sc_base_url = "http://www.simpsoncrazy.com/scripts"

class Script(Item):
    url = Field()
    episode_name = Field()
    script = Field()

class SimpsonsSpider(CrawlSpider):
    name = "snpp"
    allowed_domains = ['www.snpp.com', 'snpp.com']
    start_urls = [snpp_base_url]
    rules = [Rule(SgmlLinkExtractor(allow=['/episodes/\w+.html']), 'parse_script')]

    def fix_field_names(self, field_name):
        field_name = re.sub(" ","_", field_name)
        field_name = re.sub(":","", field_name)
        return field_name

    def parse_script(self, response):
        x = HtmlXPathSelector(response)

        script = Script()

        script['url'] = response.url
        script['episode_name'] = "".join(x.select("//h1/text()").extract())
        script['script'] = " ".join(x.select("//pre/text()").extract())
        return script

class SubtitleSpider(CrawlSpider):
    name = "ss"
    allowed_domains = ['www.springfieldspringfield.co.uk', 'springfieldspringfield.co.uk']
    start_urls = [ss_base_url]
    rules = [Rule(SgmlLinkExtractor(allow=['/view_episode_scripts.php\?tv-show=the-simpsons&episode=\w+']), 'parse_script')]

    def fix_field_names(self, field_name):
        field_name = re.sub(" ","_", field_name)
        field_name = re.sub(":","", field_name)
        return field_name

    def parse_script(self, response):
        x = HtmlXPathSelector(response)

        script = Script()

        script['url'] = response.url
        script['episode_name'] = "".join(x.select("//h3/text()").extract())
        script['script'] = "\n".join(x.select("//div[@class='episode_script']/text()").extract())
        return script

class SimpsonsSpider2(CrawlSpider):
    name = "sc"
    allowed_domains = ['www.simpsoncrazy.com', 'simpsoncrazy.com']
    start_urls = [sc_base_url]
    rules = [Rule(SgmlLinkExtractor(allow=['/scripts/\w+']), 'parse_script')]

    def fix_field_names(self, field_name):
        field_name = re.sub(" ","_", field_name)
        field_name = re.sub(":","", field_name)
        return field_name

    def parse_script(self, response):
        x = HtmlXPathSelector(response)

        script = Script()

        script['url'] = response.url
        script['episode_name'] = "".join(x.select("//h1/text()").extract())
        all_text = x.select("//p/text()").extract()

        for i in xrange(0,len(all_text)):
            all_text[i] = re.sub("[\r\t\n]","",all_text[i]).strip()

        counter = 0
        new_text = []
        while counter<len(all_text):
            if(all_text[counter].upper()==all_text[counter]):
                nt = all_text[counter].title() + ": " + all_text[counter+1]
                new_text.append(nt)
                counter=counter+2
            else:
                counter+=1

        script['script'] = "\n".join(new_text)
        return script


text:
"use strict";

// Abstracts constructing a Blob object, so it also works in older
// browsers that don't support the native Blob constructor (e.g.
// old QtWebKit versions, Android < 4.4).
function createBlob(parts, properties) {
  parts = parts || [];
  properties = properties || {};
  try {
    return new Blob(parts, properties);
  } catch (e) {
    if (e.name !== "TypeError") {
      throw e;
    }
    var BlobBuilder = global.BlobBuilder ||
                      global.MSBlobBuilder ||
                      global.MozBlobBuilder ||
                      global.WebKitBlobBuilder;
    var builder = new BlobBuilder();
    for (var i = 0; i < parts.length; i += 1) {
      builder.append(parts[i]);
    }
    return builder.getBlob(properties.type);
  }
}

module.exports = createBlob;


text:
using System;
using Zirpl.AppEngine.Service;
using Zirpl.Examples.CodeGeneration.VS2013.Commerce.Model.Promotions;

namespace Zirpl.Examples.CodeGeneration.VS2013.Commerce.Service.Promotions
{
    public partial interface IReferralService  : ICompleteService<Referral, int>
    {
    }
}


text:
package ch.qos.logback.classic.boolex;

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Marker;

import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.boolex.EvaluationException;
import ch.qos.logback.core.boolex.EventEvaluatorBase;

/**
 * Evaluates to true when the logging event passed as parameter contains one of
 * the user-specified markers.
 *
 * @author Ceki Gülcü
 */
public class OnMarkerEvaluator extends EventEvaluatorBase<ILoggingEvent> {

  List<String> markerList = new ArrayList<String>();

  public void addMarker(String markerStr) {
    markerList.add(markerStr);
  }

  /**
   * Return true if event passed as parameter contains one of the specified
   * user-markers.
   */
  public boolean evaluate(ILoggingEvent event) throws NullPointerException,
      EvaluationException {

    Marker eventsMarker = event.getMarker();
    if (eventsMarker == null) {
      return false;
    }

    for (String markerStr : markerList) {
      if (eventsMarker.contains(markerStr)) {
        return true;
      }
    }
    return false;
  }
}


text:
using System;
using System.Linq;
using Cadena.Data;
using Cadena.Data.Streams;
using Cadena.Data.Streams.Events;
using Cadena.Data.Streams.Warnings;
using Cadena.Engine.StreamReceivers;
using Cadena.Meteor;
using Cadena.Util;

namespace Cadena.Engine._Internals.Parsers
{
    internal static class TwitterStreamParser
    {
        /// <summary>
        /// Parse streamed JSON line
        /// </summary>
        /// <param name="line">JSON line</param>
        /// <param name="handler">result handler</param>
        public static void ParseStreamLine(string line, IStreamHandler handler)
        {
            try
            {
                var element = MeteorJson.Parse(line);
                if (!ParseStreamLineAsStatus(element, handler))
                {
                    ParseNotStatusStreamLine(element, handler);
                }
            }
            catch (Exception ex)
            {
                handler.OnException(new StreamParseException(
                    "JSON parse failed.", line, ex));
            }
        }

        /// <summary>
        /// Check parse streamed JSON line as normal (not direct-message) status
        /// </summary>
        /// <param name="graph">JSON object graph</param>
        /// <param name="handler">stream handler</param>
        /// <returns></returns>
        internal static bool ParseStreamLineAsStatus(JsonValue graph, IStreamHandler handler)
        {
            if (!graph.ContainsKey("text")) return false;
            handler.OnStatus(new TwitterStatus(graph));
            return true;
        }

        /// <summary>
        /// Parse streamed JSON line (which is not a status)
        /// </summary>
        /// <param name="graph">JSON object graph</param>
        /// <param name="handler">result handler</param>
        internal static void ParseNotStatusStreamLine(JsonValue graph, IStreamHandler handler)
        {
            try
            {
                // element.foo() -> element.IsDefined("foo")

                // direct message
                if (graph.TryGetValue("direct_message", out var directMessage))
                {
                    handler.OnStatus(new TwitterStatus(directMessage));
                    return;
                }

                // delete
                if (graph.TryGetValue("delete", out var delete))
                {
                    var timestamp = GetTimestamp(delete);
                    if (delete.TryGetValue("status", out var delstatus))
                    {
                        handler.OnMessage(new StreamDelete(
                            Int64.Parse(delstatus["id_str"].AsString()),
                            Int64.Parse(delstatus["user_id_str"].AsString()),
                            timestamp));
                        return;
                    }
                    if (delete.TryGetValue("direct_message", out var delmsg))
                    {
                        handler.OnMessage(new StreamDelete(
                            Int64.Parse(delmsg["id_str"].AsString()),
                            Int64.Parse(delmsg["user_id"].AsString()),
                            timestamp));
                        return;
                    }
                }

                // scrub_geo
                if (graph.TryGetValue("scrub_geo", out var scrubGeo))
                {
                    handler.OnMessage(new StreamScrubGeo(
                        Int64.Parse(scrubGeo["user_id_str"].AsString()),
                        Int64.Parse(scrubGeo["up_to_status_id_str"].AsString()),
                        GetTimestamp(scrubGeo)));
                    return;
                }

                // limit
                if (graph.TryGetValue("limit", out var limit))
                {
                    handler.OnMessage(new StreamLimit(
                        limit["track"].AsLong(),
                        GetTimestamp(limit)));
                    return;
                }

                // withheld
                if (graph.TryGetValue("status_withheld", out var statusWithheld))
                {
                    handler.OnMessage(new StreamWithheld(
                        statusWithheld["user_id"].AsLong(),
                        statusWithheld["id"].AsLong(),
                        ((JsonArray)statusWithheld["withheld_in_countries"]).Select(s => s.AsString()).ToArray(),
                        GetTimestamp(statusWithheld)));
                    return;
                }
                if (graph.TryGetValue("user_withheld", out var userWithheld))
                {
                    handler.OnMessage(new StreamWithheld(
                        userWithheld["id"].AsLong(),
                        ((JsonArray)statusWithheld["withheld_in_countries"]).Select(s => s.AsString()).ToArray(),
                        GetTimestamp(statusWithheld)));
                    return;
                }

                // disconnect
                if (graph.TryGetValue("disconnect", out var disconnect))
                {
                    handler.OnMessage(new StreamDisconnect(
                        (DisconnectCode)disconnect["code"].AsLong(),
                        disconnect["stream_name"].AsString(),
                        disconnect["reason"].AsString(),
                        GetTimestamp(disconnect)));
                    return;
                }

                // stall warning
                if (graph.TryGetValue("warning", out var warning))
                {
                    var timestamp = GetTimestamp(warning);
                    var code = warning["code"].AsString();
                    if (code == "FALLING_BEHIND")
                    {
                        handler.OnMessage(new StreamStallWarning(
                            code,
                            warning["message"].AsString(),
                            (int)warning["percent_full"].AsLong(),
                            timestamp));
                        return;
                    }
                }

                // user update
                if (graph.TryGetValue("event", out var @event))
                {
                    var ev = @event.AsString().ToLower();
                    if (ev == StreamUserEvent.UserUpdateEventKey)
                    {
                        // parse user_update only in generic streams.
                        handler.OnMessage(new StreamUserEvent(
                            new TwitterUser(graph["source"]),
                            new TwitterUser(graph["target"]),
                            ev, graph["created_at"].AsString().ParseTwitterDateTime()));
                        return;
                    }
                    // unknown event...
                    handler.OnMessage(new StreamUnknownMessage("event: " + ev, graph.ToString()));
                }

                // unknown event-type...
                handler.OnMessage(new StreamUnknownMessage(null, graph.ToString()));
            }
            catch (Exception ex)
            {
                handler.OnException(new StreamParseException(
                    "Stream graph parse failed.", graph.ToString(), ex));
            }
        }

        /// <summary>
        /// Get timestamp_ms field or pseudo timestamp string.
        /// </summary>
        /// <param name="graph">json object graph</param>
        /// <returns>timestamp code(millisecond)</returns>
        internal static string GetTimestamp(JsonValue graph)
        {
            return graph.ContainsKey("timestamp_ms")
                ? graph["timestamp_ms"].AsString()
                : ((long)(DateTime.Now.ToUniversalTime() - StreamMessage.SerialTimeStandard)
                    .TotalMilliseconds).ToString();
        }
    }
}


text:
/**
 * Autogenerated by Thrift Compiler (0.16.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.accumulo.core.clientImpl.thrift;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
public class ThriftNotActiveServiceException extends org.apache.thrift.TException implements org.apache.thrift.TBase<ThriftNotActiveServiceException, ThriftNotActiveServiceException._Fields>, java.io.Serializable, Cloneable, Comparable<ThriftNotActiveServiceException> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ThriftNotActiveServiceException");

  private static final org.apache.thrift.protocol.TField SERV_FIELD_DESC = new org.apache.thrift.protocol.TField("serv", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField DESCRIPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("description", org.apache.thrift.protocol.TType.STRING, (short)2);

  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new ThriftNotActiveServiceExceptionStandardSchemeFactory();
  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new ThriftNotActiveServiceExceptionTupleSchemeFactory();

  public @org.apache.thrift.annotation.Nullable java.lang.String serv; // required
  public @org.apache.thrift.annotation.Nullable java.lang.String description; // required

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    SERV((short)1, "serv"),
    DESCRIPTION((short)2, "description");

    private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();

    static {
      for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // SERV
          return SERV;
        case 2: // DESCRIPTION
          return DESCRIPTION;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByName(java.lang.String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final java.lang.String _fieldName;

    _Fields(short thriftId, java.lang.String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public java.lang.String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.SERV, new org.apache.thrift.meta_data.FieldMetaData("serv", org.apache.thrift.TFieldRequirementType.DEFAULT,
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.DESCRIPTION, new org.apache.thrift.meta_data.FieldMetaData("description", org.apache.thrift.TFieldRequirementType.DEFAULT,
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ThriftNotActiveServiceException.class, metaDataMap);
  }

  public ThriftNotActiveServiceException() {
  }

  public ThriftNotActiveServiceException(
    java.lang.String serv,
    java.lang.String description)
  {
    this();
    this.serv = serv;
    this.description = description;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public ThriftNotActiveServiceException(ThriftNotActiveServiceException other) {
    if (other.isSetServ()) {
      this.serv = other.serv;
    }
    if (other.isSetDescription()) {
      this.description = other.description;
    }
  }

  public ThriftNotActiveServiceException deepCopy() {
    return new ThriftNotActiveServiceException(this);
  }

  @Override
  public void clear() {
    this.serv = null;
    this.description = null;
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getServ() {
    return this.serv;
  }

  public ThriftNotActiveServiceException setServ(@org.apache.thrift.annotation.Nullable java.lang.String serv) {
    this.serv = serv;
    return this;
  }

  public void unsetServ() {
    this.serv = null;
  }

  /** Returns true if field serv is set (has been assigned a value) and false otherwise */
  public boolean isSetServ() {
    return this.serv != null;
  }

  public void setServIsSet(boolean value) {
    if (!value) {
      this.serv = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getDescription() {
    return this.description;
  }

  public ThriftNotActiveServiceException setDescription(@org.apache.thrift.annotation.Nullable java.lang.String description) {
    this.description = description;
    return this;
  }

  public void unsetDescription() {
    this.description = null;
  }

  /** Returns true if field description is set (has been assigned a value) and false otherwise */
  public boolean isSetDescription() {
    return this.description != null;
  }

  public void setDescriptionIsSet(boolean value) {
    if (!value) {
      this.description = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case SERV:
      if (value == null) {
        unsetServ();
      } else {
        setServ((java.lang.String)value);
      }
      break;

    case DESCRIPTION:
      if (value == null) {
        unsetDescription();
      } else {
        setDescription((java.lang.String)value);
      }
      break;

    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.Object getFieldValue(_Fields field) {
    switch (field) {
    case SERV:
      return getServ();

    case DESCRIPTION:
      return getDescription();

    }
    throw new java.lang.IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new java.lang.IllegalArgumentException();
    }

    switch (field) {
    case SERV:
      return isSetServ();
    case DESCRIPTION:
      return isSetDescription();
    }
    throw new java.lang.IllegalStateException();
  }

  @Override
  public boolean equals(java.lang.Object that) {
    if (that instanceof ThriftNotActiveServiceException)
      return this.equals((ThriftNotActiveServiceException)that);
    return false;
  }

  public boolean equals(ThriftNotActiveServiceException that) {
    if (that == null)
      return false;
    if (this == that)
      return true;

    boolean this_present_serv = true && this.isSetServ();
    boolean that_present_serv = true && that.isSetServ();
    if (this_present_serv || that_present_serv) {
      if (!(this_present_serv && that_present_serv))
        return false;
      if (!this.serv.equals(that.serv))
        return false;
    }

    boolean this_present_description = true && this.isSetDescription();
    boolean that_present_description = true && that.isSetDescription();
    if (this_present_description || that_present_description) {
      if (!(this_present_description && that_present_description))
        return false;
      if (!this.description.equals(that.description))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + ((isSetServ()) ? 131071 : 524287);
    if (isSetServ())
      hashCode = hashCode * 8191 + serv.hashCode();

    hashCode = hashCode * 8191 + ((isSetDescription()) ? 131071 : 524287);
    if (isSetDescription())
      hashCode = hashCode * 8191 + description.hashCode();

    return hashCode;
  }

  @Override
  public int compareTo(ThriftNotActiveServiceException other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetServ(), other.isSetServ());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetServ()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serv, other.serv);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetDescription(), other.isSetDescription());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDescription()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.description, other.description);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  @org.apache.thrift.annotation.Nullable
  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    scheme(iprot).read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    scheme(oprot).write(oprot, this);
  }

  @Override
  public java.lang.String toString() {
    java.lang.StringBuilder sb = new java.lang.StringBuilder("ThriftNotActiveServiceException(");
    boolean first = true;

    sb.append("serv:");
    if (this.serv == null) {
      sb.append("null");
    } else {
      sb.append(this.serv);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("description:");
    if (this.description == null) {
      sb.append("null");
    } else {
      sb.append(this.description);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // check for sub-struct validity
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
    try {
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class ThriftNotActiveServiceExceptionStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public ThriftNotActiveServiceExceptionStandardScheme getScheme() {
      return new ThriftNotActiveServiceExceptionStandardScheme();
    }
  }

  private static class ThriftNotActiveServiceExceptionStandardScheme extends org.apache.thrift.scheme.StandardScheme<ThriftNotActiveServiceException> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, ThriftNotActiveServiceException struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
          break;
        }
        switch (schemeField.id) {
          case 1: // SERV
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.serv = iprot.readString();
              struct.setServIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // DESCRIPTION
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.description = iprot.readString();
              struct.setDescriptionIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, ThriftNotActiveServiceException struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.serv != null) {
        oprot.writeFieldBegin(SERV_FIELD_DESC);
        oprot.writeString(struct.serv);
        oprot.writeFieldEnd();
      }
      if (struct.description != null) {
        oprot.writeFieldBegin(DESCRIPTION_FIELD_DESC);
        oprot.writeString(struct.description);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class ThriftNotActiveServiceExceptionTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public ThriftNotActiveServiceExceptionTupleScheme getScheme() {
      return new ThriftNotActiveServiceExceptionTupleScheme();
    }
  }

  private static class ThriftNotActiveServiceExceptionTupleScheme extends org.apache.thrift.scheme.TupleScheme<ThriftNotActiveServiceException> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, ThriftNotActiveServiceException struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetServ()) {
        optionals.set(0);
      }
      if (struct.isSetDescription()) {
        optionals.set(1);
      }
      oprot.writeBitSet(optionals, 2);
      if (struct.isSetServ()) {
        oprot.writeString(struct.serv);
      }
      if (struct.isSetDescription()) {
        oprot.writeString(struct.description);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, ThriftNotActiveServiceException struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet incoming = iprot.readBitSet(2);
      if (incoming.get(0)) {
        struct.serv = iprot.readString();
        struct.setServIsSet(true);
      }
      if (incoming.get(1)) {
        struct.description = iprot.readString();
        struct.setDescriptionIsSet(true);
      }
    }
  }

  private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
  private static void unusedMethod() {}
}


text:
module Boundy
  module Formatter
    def sql
      Boundy::Formatter::Sql
    end
  end
end