text:
@interface iAPManager() <SKProductsRequestDelegate, SKPaymentTransactionObserver>
@property (nonatomic, retain) NSMutableDictionary *products_hard;
@end

@implementation iAPManager

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
{
    for (SKPaymentTransaction *transaction in transactions)
    {
        switch (transaction.transactionState)
        {
            case SKPaymentTransactionStatePurchased:
                [self completedTransaction:transaction];
                NSLog(@"Transaction purchased");
                break;
            case SKPaymentTransactionStateFailed:
                [self failedTransaction:transaction];
                NSLog(@"Transaction f    ailed: %@",transaction.error);
                break;
            case SKPaymentTransactionStateRestored:
                [self restoreTransaction:transaction];
                NSLog(@"Transaction restored");
                break;
        }
    }
}

- (void) restoreTransaction:(SKPaymentTransaction *)transaction
{
    iAPProduct *product = [self.products objectForKey:transaction.originalTransaction.payment.productIdentifier];
    [self.delegate restoreProduct:product];
    [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
}

- (void) completedTransaction:(SKPaymentTransaction *)transaction
{
    iAPProduct *product = [self.products objectForKey:transaction.payment.productIdentifier];
    [self.delegate completedTransactionForProduct:product];
    [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
}

- (void) failedTransaction:(SKPaymentTransaction *)transaction
{
    iAPProduct *product = [self.products objectForKey:transaction.payment.productIdentifier];
    [self.delegate errorOccuredForProduct:product];
    [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
}

- (void) restoreProducts {
    [[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
}

- (void) purchaseProductForProduct:(iAPProduct *)product
{
    SKProduct *productSK = [self.products_hard objectForKey:product.productID];
    iAPProduct *easyProduct = [self.products objectForKey:product.productID];
    if (product == nil) {
        [self.delegate errorOccuredForProduct:easyProduct];
        NSLog(@"No product");
    } else {
        @try {
            [[SKPaymentQueue defaultQueue] addPayment:[SKPayment paymentWithProduct:productSK]];
            [self.delegate productIsBeingPurchased:easyProduct];
        }
        @catch (NSException *exception) {
            [self.delegate errorOccuredForProduct:easyProduct];
            NSLog(@"Exception: %@",exception);
        }
    }
}

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
    NSArray *myProducts = response.products;
    NSMutableArray *myEasyProducts = [NSMutableArray array];
    for (unsigned int i = 0; i < myProducts.count; i++)
    {
        SKProduct *product = [myProducts objectAtIndex:i];
        NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
        [numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
        [numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
        [numberFormatter setLocale:product.priceLocale];
        NSString *formattedString = [numberFormatter stringFromNumber:product.price];

        iAPProduct *product_easy = [iAPProduct productWithPrice:formattedString productID:product.productIdentifier title:product.localizedTitle description:product.localizedDescription];
        [self.products_hard setObject:product forKey:product.productIdentifier];
        [self.products setObject:product_easy forKey:product.productIdentifier];
        if ([self.delegate respondsToSelector:@selector(productLoaded:)])
        {
            [self.delegate productLoaded:product_easy];
        }
        [myEasyProducts addObject:product_easy];
    }

    if ([self.delegate respondsToSelector:@selector(productsLoaded:)] && myEasyProducts)
    {
        [self.delegate productsLoaded:myProducts];
    }
    else if (myEasyProducts == nil)
    {
        [self.delegate errorForLoadDidOccur];
    }

    if ([self.delegate respondsToSelector:@selector(storeIsDoneLoading)])
        [self.delegate storeIsDoneLoading];
}

- (id) initWithProductIDs:(NSArray *)ids delegate:(id<iAPManagerDelegate>)delegate_T
{
    if ([SKPaymentQueue canMakePayments]) {
        // Display a store to the user.
        self.products = [NSMutableDictionary dictionary];
        self.products_hard = [NSMutableDictionary dictionary];
        self.delegate = delegate_T;
        [[SKPaymentQueue defaultQueue] addTransactionObserver:self];
        SKProductsRequest *request = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithArray:ids]];
        [request setDelegate:self];
        [request start];
    } else {
        // Warn the user that purchases are disabled.
        [self.delegate errorForLoadDidOccur];
    }
    return self;
}

- (void) paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue
{
    if([queue.transactions count]>0){
        NSLog(@"Received restored transactions: %lu", (unsigned long)queue.transactions.count);
    }
    else {
        NSLog(@"No Product to restore");
        [self.delegate noProductsRestored];
    }
}

//
// call this before making a purchase
//
-(BOOL)canMakePurchases{
    return [SKPaymentQueue canMakePayments];
}

@end


text:
/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 4.0.2
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package org.pjsip.pjsua2;

public class SipEventBody {
  private transient long swigCPtr;
  protected transient boolean swigCMemOwn;

  protected SipEventBody(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  protected static long getCPtr(SipEventBody obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  @SuppressWarnings("deprecation")
  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        pjsua2JNI.delete_SipEventBody(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public void setTimer(TimerEvent value) {
    pjsua2JNI.SipEventBody_timer_set(swigCPtr, this, TimerEvent.getCPtr(value), value);
  }

  public TimerEvent getTimer() {
    long cPtr = pjsua2JNI.SipEventBody_timer_get(swigCPtr, this);
    return (cPtr == 0) ? null : new TimerEvent(cPtr, false);
  }

  public void setTsxState(TsxStateEvent value) {
    pjsua2JNI.SipEventBody_tsxState_set(swigCPtr, this, TsxStateEvent.getCPtr(value), value);
  }

  public TsxStateEvent getTsxState() {
    long cPtr = pjsua2JNI.SipEventBody_tsxState_get(swigCPtr, this);
    return (cPtr == 0) ? null : new TsxStateEvent(cPtr, false);
  }

  public void setTxMsg(TxMsgEvent value) {
    pjsua2JNI.SipEventBody_txMsg_set(swigCPtr, this, TxMsgEvent.getCPtr(value), value);
  }

  public TxMsgEvent getTxMsg() {
    long cPtr = pjsua2JNI.SipEventBody_txMsg_get(swigCPtr, this);
    return (cPtr == 0) ? null : new TxMsgEvent(cPtr, false);
  }

  public void setTxError(TxErrorEvent value) {
    pjsua2JNI.SipEventBody_txError_set(swigCPtr, this, TxErrorEvent.getCPtr(value), value);
  }

  public TxErrorEvent getTxError() {
    long cPtr = pjsua2JNI.SipEventBody_txError_get(swigCPtr, this);
    return (cPtr == 0) ? null : new TxErrorEvent(cPtr, false);
  }

  public void setRxMsg(RxMsgEvent value) {
    pjsua2JNI.SipEventBody_rxMsg_set(swigCPtr, this, RxMsgEvent.getCPtr(value), value);
  }

  public RxMsgEvent getRxMsg() {
    long cPtr = pjsua2JNI.SipEventBody_rxMsg_get(swigCPtr, this);
    return (cPtr == 0) ? null : new RxMsgEvent(cPtr, false);
  }

  public void setUser(UserEvent value) {
    pjsua2JNI.SipEventBody_user_set(swigCPtr, this, UserEvent.getCPtr(value), value);
  }

  public UserEvent getUser() {
    long cPtr = pjsua2JNI.SipEventBody_user_get(swigCPtr, this);
    return (cPtr == 0) ? null : new UserEvent(cPtr, false);
  }

  public SipEventBody() {
    this(pjsua2JNI.new_SipEventBody(), true);
  }

}

redpajama_set_name: RedPajamaGithub


text:
static const char *cgl_dl_gl_path =
    "/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL";

static bool
cgl_dl_check_enum(int32_t waffle_dl)
{
    switch (waffle_dl) {
        case WAFFLE_DL_OPENGL:
            return true;
        case WAFFLE_DL_OPENGL_ES1:
            wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
                         "CGL does not support OpenGL ES1");
            return false;
        case WAFFLE_DL_OPENGL_ES2:
            wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
                         "CGL does not support OpenGL ES2");
            return false;
        case WAFFLE_DL_OPENGL_ES3:
            wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
                         "CGL does not support OpenGL ES3");
            return false;
        default:
            assert(false);
            return false;
   }
}

static bool
cgl_dl_open(struct cgl_platform *plat)
{
    plat->dl_gl = dlopen(cgl_dl_gl_path, RTLD_LAZY);

    if (!plat->dl_gl) {
        wcore_errorf(WAFFLE_ERROR_UNKNOWN,
                     "dlopen(\"%s\") failed", cgl_dl_gl_path);
        return false;
    }

    return true;
}

bool
cgl_dl_can_open(struct wcore_platform *wc_plat,
                int32_t waffle_dl)
{
    struct cgl_platform *plat = cgl_platform(wc_plat);

    if (!cgl_dl_check_enum(waffle_dl))
        return false;

    if (plat->dl_gl != NULL)
        return true;

    WCORE_ERROR_DISABLED({
        cgl_dl_open(plat);
    });

    return plat->dl_gl != NULL;
}

void*
cgl_dl_sym(struct wcore_platform *wc_plat,
          int32_t waffle_dl,
          const char *name)
{
    struct cgl_platform *plat = cgl_platform(wc_plat);

    if (!cgl_dl_check_enum(waffle_dl))
        return NULL;

    if (plat->dl_gl == NULL)
        cgl_dl_open(plat);

    if (plat->dl_gl == NULL)
        return NULL;

    // Clear any previous error.
    dlerror();

    void *sym = dlsym(plat->dl_gl, name);

    if (sym)
        return sym;

    // dlsym returned NULL. Check if an error occured.
    const char *error = dlerror();
    if (error) {
        wcore_errorf(WAFFLE_ERROR_UNKNOWN,
                     "dlsym(libname=\"%s\", symbol=\"%s\") failed: %s",
                     cgl_dl_gl_path, name, error);
    }

    return NULL;
}

bool
cgl_dl_close(struct wcore_platform *wc_plat)
{
    struct cgl_platform *plat = cgl_platform(wc_plat);

    int error_code = 0;
    const char *error_msg = NULL;

    if (!plat->dl_gl)
        return true;

    error_code = dlclose(plat->dl_gl);

    if (!error_code)
        return true;

    error_msg = dlerror();

    if (error_msg) {
        wcore_errorf(WAFFLE_ERROR_UNKNOWN,
                     "dlclose(libname=\"%s\") failed: %s",
                     cgl_dl_gl_path, error_msg);
    }
    else {
        wcore_errorf(WAFFLE_ERROR_UNKNOWN,
                     "dlclose(libname=\"%s\") failed",
                     cgl_dl_gl_path);
    }

    return false;
}


text:
module RightAws

  class Ec2

    #-----------------------------------------------------------------
    #      Spot Instances
    #-----------------------------------------------------------------

    # Describe Spot Price history.
    #
    # Options: :start_time, :end_time, instance_types, product_description
    #
    # Filters: instance-type, product-description, spot-price, timestamp
    #
    #  ec2.describe_spot_price_history #=>
    #    [{:spot_price=>0.054,
    #      :timestamp=>"2009-12-07T12:12:58.000Z",
    #      :product_description=>"Windows",
    #      :instance_type=>"m1.small"},
    #     {:spot_price=>0.06,
    #      :timestamp=>"2009-12-07T12:18:32.000Z",
    #      :product_description=>"Linux/UNIX",
    #      :instance_type=>"c1.medium"},
    #     {:spot_price=>0.198,
    #      :timestamp=>"2009-12-07T12:58:00.000Z",
    #      :product_description=>"Windows",
    #      :instance_type=>"m1.large"},
    #     {:spot_price=>0.028,
    #      :timestamp=>"2009-12-07T13:48:50.000Z",
    #      :product_description=>"Linux/UNIX",
    #      :instance_type=>"m1.small"}, ... ]
    #
    #  ec2.describe_spot_price_history(:start_time => 1.day.ago,
    #                                  :end_time => 10.minutes.ago,
    #                                  :instance_types => ["c1.medium", "m1.small"],
    #                                  :product_description => "Linux/UNIX" ) #=>
    #    [{:product_description=>"Linux/UNIX",
    #      :timestamp=>"2010-02-04T05:44:36.000Z",
    #      :spot_price=>0.031,
    #      :instance_type=>"m1.small"},
    #     {:product_description=>"Linux/UNIX",
    #      :timestamp=>"2010-02-04T17:56:25.000Z",
    #      :spot_price=>0.058,
    #      :instance_type=>"c1.medium"}, ... ]
    #
    #  ec2.describe_spot_price_history(:filters => {'spot-price' => '0.2' })
    #
    #  ec2.describe_spot_price_history(:instance_types => ["c1.medium"], :filters => {'spot-price' => '0.2' })
    #
    #
    # P.S. filters: http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-query-DescribeSpotPriceHistory.html
    #
    def describe_spot_price_history(options={})
      options = options.dup
      request_hash = {}
      request_hash.merge!(amazonize_list(['Filter.?.Name', 'Filter.?.Value.?'], options[:filters])) unless options[:filters].right_blank?
      request_hash['StartTime']          = AwsUtils::utc_iso8601(options[:start_time])      unless options[:start_time].right_blank?
      request_hash['EndTime']            = AwsUtils::utc_iso8601(options[:end_time])        unless options[:end_time].right_blank?
      request_hash['ProductDescription'] = options[:product_description]                   unless options[:product_description].right_blank?
      request_hash.merge!(amazonize_list('InstanceType', Array(options[:instance_types]))) unless options[:instance_types].right_blank?
      link = generate_request("DescribeSpotPriceHistory", request_hash, :api_version => '2011-05-15')
      request_info(link, QEc2DescribeSpotPriceHistoryParser.new)
    rescue Exception
      on_exception
    end

    # Describe Spot Instance requests.
    #
    # Accepts a list of requests and/or a set of filters as the last parameter.
    #
    # Filters: availability-zone-group, create-time, fault-code, fault-message, instance-id, launch-group,
    # launch.block-device-mapping.delete-on-termination, launch.block-device-mapping.device-name,
    # launch.block-device-mapping.snapshot-id, launch.group-id, launch.image-id, launch.instance-type,
    # launch.kernel-id, launch.key-name, launch.monitoring-enabled, launch.ramdisk-id, product-description,
    # spot-instance-request-id, spot-price, state, tag-key, tag-value, tag:key, type, valid-from, valid-until
    #
    #  ec2.describe_spot_instance_requests #=>
    #    [{:product_description=>"Linux/UNIX",
    #      :type=>"one-time",
    #      :availability_zone=>"us-east-1b",
    #      :monitoring_enabled=>false,
    #      :tags=>{},
    #      :image_id=>"ami-08f41161",
    #      :groups=>[{:group_id=>"sg-a0b85dc9", :group_name=>"default"}],
    #      :spot_price=>0.01,
    #      :create_time=>"2010-03-24T10:41:28.000Z",
    #      :instance_type=>"c1.medium",
    #      :state=>"open",
    #      :spot_instance_request_id=>"sir-9652a604",
    #      :key_name=>"rightscale_test"},
    #     {:product_description=>"Linux/UNIX",
    #      :type=>"one-time",
    #      :availability_zone=>"us-east-1b",
    #      :monitoring_enabled=>false,
    #      :tags=>{},
    #      :image_id=>"ami-08f41161",
    #      :groups=>[{:group_id=>"sg-a0b85dc9", :group_name=>"default"}],
    #      :spot_price=>0.01,
    #      :create_time=>"2010-03-24T11:40:27.000Z",
    #      :instance_type=>"c1.medium",
    #      :state=>"open",
    #      :spot_instance_request_id=>"sir-fa912802",
    #      :key_name=>"rightscale_test"}, ... ]
    #
    #  ec2.describe_spot_instance_requests(:filters => {'type'=>"one-time", 'state'=>"open"})
    #
    # P.S. filters: http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-query-DescribeSpotInstanceRequests.html
    #
    def describe_spot_instance_requests(*list_and_options)
      describe_resources_with_list_and_options('DescribeSpotInstanceRequests', 'SpotInstanceRequestId', QEc2DescribeSpotInstanceParser, list_and_options)
    end

    # Create a Spot Instance request.
    #
    # Mandatory params: :image_id, :spot_price, :instance_type
    # Optional params: :valid_from, :valid_until, :instance_count, :type, :launch_group,
    # :availability_zone_group, :key_name, :user_data, :addressing_type, :kernel_id,
    # :ramdisk_id, :subnet_id, :availability_zone, :monitoring_enabled, :groups,
    # :block_device_mappings
    #
    #  ec2.request_spot_instances(
    #    :image_id => 'ami-08f41161',
    #    :spot_price => 0.01,
    #    :key_name => 'tim',
    #    :instance_count => 2,
    #    :group_ids => ["sg-a0b85dc9"],
    #    :instance_type => 'c1.medium') #=>
    #
    #    [{:product_description=>"Linux/UNIX",
    #      :type=>"one-time",
    #      :spot_instance_requestId=>"sir-7a893003",
    #      :monitoring_enabled=>false,
    #      :image_id=>"ami-08f41161",
    #      :state=>"open",
    #      :spot_price=>0.01,
    #      :groups=>[{:group_id=>"sg-a0b85dc9", :group_name=>"default"}],
    #      :key_name=>"tim",
    #      :create_time=>"2010-03-10T10:33:09.000Z",
    #      :instance_type=>"c1.medium"},
    #     {:product_description=>"Linux/UNIX",
    #      :type=>"one-time",
    #      :spot_instance_requestId=>"sir-13dc9a03",
    #      :monitoring_enabled=>false,
    #      :image_id=>"ami-08f41161",
    #      :state=>"open",
    #      :spot_price=>0.01,
    #      :groups=>[{:group_id=>"sg-a0b85dc9", :group_name=>"default"}],
    #      :key_name=>"tim",
    #      :create_time=>"2010-03-10T10:33:09.000Z",
    #      :instance_type=>"c1.medium"}]
    #
    #  ec2.request_spot_instances(
    #    :image_id => 'ami-08f41161',
    #    :spot_price => 0.01,
    #    :instance_type => 'm1.small',
    #    :valid_from => 10.minutes.since,
    #    :valid_until => 1.hour.since,
    #    :instance_count => 1,
    #    :key_name => 'tim',
    #    :group_names => ['default'],
    #    :availability_zone => 'us-east-1a',
    #    :monitoring_enabled => true,
    #    :launch_group => 'lg1',
    #    :availability_zone_group => 'azg1',
    #    :block_device_mappings => [ { :device_name => '/dev/sdk',
    #                                  :ebs_snapshot_id => 'snap-145cbc7d',
    #                                  :ebs_delete_on_termination => true,
    #                                  :ebs_volume_size => 3,
    #                                  :virtual_name => 'ephemeral2'
    #                                 } ] ) #=>
    #    [{:type=>"one-time",
    #      :image_id=>"ami-08f41161",
    #      :availability_zone_group=>"azg1",
    #      :key_name=>"default",
    #      :spot_instance_request_id=>"sir-66c79a12",
    #      :block_device_mappings=>
    #       [{:ebs_volume_size=>3,
    #         :virtual_name=>"ephemeral2",
    #         :device_name=>"/dev/sdk",
    #         :ebs_snapshot_id=>"snap-145cbc7d",
    #         :ebs_delete_on_termination=>true}],
    #      :spot_price=>0.01,
    #      :product_description=>"Linux/UNIX",
    #      :state=>"open",
    #      :instance_type=>"m1.small",
    #      :availability_zone=>"us-east-1a",
    #      :groups=>[{:group_id=>"sg-a0b85dc9", :group_name=>"default"}],
    #      :valid_from=>"2011-07-01T14:26:33.000Z",
    #      :tags=>{},
    #      :monitoring_enabled=>true,
    #      :valid_until=>"2011-07-01T14:28:03.000Z",
    #      :create_time=>"2011-07-01T14:26:24.000Z",
    #      :launch_group=>"lg1"}]
    #
    def request_spot_instances(options)
      options[:user_data] = options[:user_data].to_s
      request_hash = map_api_keys_and_values( options,
        :spot_price, :availability_zone_group, :launch_group, :type, :instance_count,
        :image_id              => 'LaunchSpecification.ImageId',
        :instance_type         => 'LaunchSpecification.InstanceType',
        :key_name              => 'LaunchSpecification.KeyName',
        :addressing_type       => 'LaunchSpecification.AddressingType',
        :kernel_id             => 'LaunchSpecification.KernelId',
        :ramdisk_id            => 'LaunchSpecification.RamdiskId',
        :subnet_id             => 'LaunchSpecification.SubnetId',
        :availability_zone     => 'LaunchSpecification.Placement.AvailabilityZone',
        :monitoring_enabled    => 'LaunchSpecification.Monitoring.Enabled',
        :valid_from            => { :value => Proc.new { !options[:valid_from].right_blank?  && AwsUtils::utc_iso8601(options[:valid_from]) }},
        :valid_until           => { :value => Proc.new { !options[:valid_until].right_blank? && AwsUtils::utc_iso8601(options[:valid_until]) }},
        :user_data             => { :name  => 'LaunchSpecification.UserData',
                                    :value => Proc.new { !options[:user_data].empty? && Base64.encode64(options[:user_data]).delete("\n") }},
        :group_names           => { :amazonize_list => 'LaunchSpecification.SecurityGroup'},
        :group_ids             => { :amazonize_list => 'LaunchSpecification.SecurityGroupId'},
        :block_device_mappings => { :amazonize_bdm  => 'LaunchSpecification.BlockDeviceMapping'})
      link = generate_request("RequestSpotInstances", request_hash)
      request_info(link, QEc2DescribeSpotInstanceParser.new(:logger => @logger))
    end

    # Cancel one or more Spot Instance requests.
    #
    #  ec2.cancel_spot_instance_requests('sir-60662c03',"sir-d3c96e04", "sir-4fa8d804","sir-6992ce04") #=>
    #    [{:state=>"cancelled", :spot_instance_request_id=>"sir-60662c03"},
    #     {:state=>"cancelled", :spot_instance_request_id=>"sir-6992ce04"},
    #     {:state=>"cancelled", :spot_instance_request_id=>"sir-4fa8d804"},
    #     {:state=>"cancelled", :spot_instance_request_id=>"sir-d3c96e04"}]
    #
    def cancel_spot_instance_requests(*spot_instance_request_ids)
      link = generate_request("CancelSpotInstanceRequests", amazonize_list('SpotInstanceRequestId', spot_instance_request_ids.flatten))
      request_info(link, QEc2CancelSpotInstanceParser.new(:logger => @logger))
    end

    # Create the data feed for Spot Instances
    # (Enables to view Spot Instance usage logs)
    #
    #  ec2.create_spot_datafeed_subscription('bucket-for-konstantin-eu', 'splogs/') #=>
    #    { :owner_id=>"826693181925",
    #      :bucket=>"bucket-for-konstantin-eu",
    #      :prefix=>"splogs/",
    #      :state=>"Active"}
    #
    def create_spot_datafeed_subscription(bucket, prefix=nil)
      request_hash = { 'Bucket' => bucket }
      request_hash['Prefix'] = prefix unless prefix.right_blank?
      link = generate_request("CreateSpotDatafeedSubscription", request_hash)
      request_info(link, QEc2DescribeSpotDatafeedSubscriptionParser.new(:logger => @logger))
    end

    # Describe the data feed for Spot Instances.
    #
    #  ec2.describe_spot_datafeed_subscription #=>
    #    { :owner_id=>"826693181925",
    #      :bucket=>"bucket-for-konstantin-eu",
    #      :prefix=>"splogs/",
    #      :state=>"Active"}
    #
    def describe_spot_datafeed_subscription
      link = generate_request("DescribeSpotDatafeedSubscription")
      request_info(link, QEc2DescribeSpotDatafeedSubscriptionParser.new(:logger => @logger))
    end

    # Delete the data feed for Spot Instances.
    #
    #  ec2.delete_spot_datafeed_subscription #=> true
    #
    def delete_spot_datafeed_subscription()
      link = generate_request("DeleteSpotDatafeedSubscription")
      request_info(link, RightBoolResponseParser.new(:logger => @logger))
    end

    #-----------------------------------------------------------------
    #      PARSERS: Spot Instances
    #-----------------------------------------------------------------

    class QEc2DescribeSpotPriceHistoryParser < RightAWSParser #:nodoc:
      def tagstart(name, attributes)
        @item = {} if name == 'item'
      end
      def tagend(name)
        case name
        when 'instanceType'       then @item[:instance_type]       = @text
        when 'productDescription' then @item[:product_description] = @text
        when 'spotPrice'          then @item[:spot_price]          = @text.to_f
        when 'timestamp'          then @item[:timestamp]           = @text
        when 'availabilityZone'   then @item[:availability_zone]   = @text
        when 'item'               then @result                    << @item
        end
      end
      def reset
        @result = []
      end
    end

    class QEc2DescribeSpotInstanceParser < RightAWSParser #:nodoc:
      def tagstart(name, attributes)
        case full_tag_name
        when %r{spotInstanceRequestSet/item$}
          @item = { :tags => {} }
        when %r{groupSet$}
          @item[:groups] = []
        when %r{groupSet/item$}
          @group  = {}
        when %r{/blockDeviceMapping/item$}
          @item[:block_device_mappings] ||= []
          @block_device_mapping = {}
        when %r{/tagSet/item$}
          @aws_tag = {}
        end
      end
      def tagend(name)
        case name
        when 'spotInstanceRequestId' then @item[:spot_instance_request_id]= @text
        when 'spotPrice'             then @item[:spot_price]              = @text.to_f
        when 'type'                  then @item[:type]                    = @text
        when 'state'                 then @item[:state]                   = @text
        when 'code'                  then @item[:fault_code]              = @text
        when 'message'               then @item[:fault_message]           = @text
        when 'validFrom'             then @item[:valid_from]              = @text
        when 'validUntil'            then @item[:valid_until]             = @text
        when 'launchGroup'           then @item[:launch_group]            = @text
        when 'availabilityZoneGroup' then @item[:availability_zone_group] = @text
        when 'imageId'               then @item[:image_id]                = @text
        when 'keyName'               then @item[:key_name]                = @text
        when 'userData'              then @item[:userData]                = @text
        when 'data'                  then @item[:data]                    = @text
        when 'addressingType'        then @item[:addressing_type]         = @text
        when 'instanceType'          then @item[:instance_type]           = @text
        when 'availabilityZone'      then @item[:availability_zone]       = @text
        when 'kernelId'              then @item[:kernel_id]               = @text
        when 'ramdiskId'             then @item[:ramdisk_id]              = @text
        when 'subnetId'              then @item[:subnet_id]               = @text
        when 'instanceId'            then @item[:instance_id]             = @text
        when 'createTime'            then @item[:create_time]             = @text
        when 'productDescription'    then @item[:product_description]     = @text
        else
          case full_tag_name
          when %r{/groupSet/item} # no trailing $
            case name
            when 'groupId'   then @group[:group_id]   = @text
            when 'groupName' then @group[:group_name] = @text
            when 'item'      then @item[:groups]     << @group
            end
          when %r{monitoring/enabled$}
            @item[:monitoring_enabled] = @text == 'true'
          when %r{/blockDeviceMapping/item} # no trailing $
            case name
            when 'deviceName'          then @block_device_mapping[:device_name]                = @text
            when 'virtualName'         then @block_device_mapping[:virtual_name]               = @text
            when 'volumeSize'          then @block_device_mapping[:ebs_volume_size]            = @text.to_i
            when 'snapshotId'          then @block_device_mapping[:ebs_snapshot_id]            = @text
            when 'deleteOnTermination' then @block_device_mapping[:ebs_delete_on_termination]  = @text == 'true' ? true : false
            when 'item'                then @item[:block_device_mappings]                     << @block_device_mapping
            end
          when %r{/tagSet/item/key$}   then @aws_tag[:key]               = @text
          when %r{/tagSet/item/value$} then @aws_tag[:value]             = @text
          when %r{/tagSet/item$}       then @item[:tags][@aws_tag[:key]] = @aws_tag[:value]
          when %r{spotInstanceRequestSet/item$} then @result << @item
          end
        end
      end
      def reset
        @result = []
      end
    end

    class QEc2CancelSpotInstanceParser < RightAWSParser #:nodoc:
      def tagstart(name, attributes)
        @item = {} if name == 'item'
      end
      def tagend(name)
        case name
        when 'spotInstanceRequestId' then @item[:spot_instance_request_id] = @text
        when 'state'                 then @item[:state]                    = @text
        when 'item'                  then @result                         << @item
        end
      end
      def reset
        @result = []
      end
    end

    class QEc2DescribeSpotDatafeedSubscriptionParser < RightAWSParser #:nodoc:
      def tagend(name)
        case name
        when 'ownerId' then @result[:owner_id] = @text
        when 'bucket'  then @result[:bucket]   = @text
        when 'prefix'  then @result[:prefix]   = @text
        when 'state'   then @result[:state]    = @text
        when 'code'    then @result[:fault_code]     = @text
        when 'message' then @result[:fault_message]  = @text
        end
      end
      def reset
        @result = {}
      end
    end

  end

end


text:
See Something? Say Something

      <form>

              Choose Officer's Offence

              <select class="form-control">
                <option>Active in the community</option>
                <option>Mentor</option>
                <option>Harassment</option>
                <option>Misconduct</option>
              </select>

              <textarea class="form-control review" cols="40" rows="5" placeholder="Write Brief Report Summary..."></textarea>

Upload a photo or video

      </form>

      <button ng-click="gotToSumbit()" class="btn btn-info">Submit</button>


text:
/**
 * @file FighterStats.cpp
 * Brief Description.
 */

#include "FighterStats.h"
#include "InputManager.h"

using std::to_string;

// FIXME: Trocar side pra enum

/**
 * Brief Description.
 *
 * @param p_fighter
 * @param p_index_fighter
 * @param p_side
 * @param p_x
 * @param p_y
 */
FighterStats::FighterStats(Fighter *p_fighter, int p_index_fighter, int p_side,
                           double p_x, double p_y)
        : fighter(p_fighter)
        , percent_to_draw_life(1.0)
        , percent_to_draw_special(percent_to_draw_life)
        , index_fighter(p_index_fighter)
        , side(p_side)
        , condition(0)
        , is_ultimate_diff(fighter->is("flesh"))
        , x(p_x)
        , y(p_y) {
    bg[0] = Sprite("hud/life" + to_string(index_fighter) + "_frame.png");
    bg[1] = bg[2] =
        Sprite("hud/life" + to_string(index_fighter) + "_frame.png");
    if (is_ultimate_diff)
        bg[2] = Sprite("hud/life" + to_string(index_fighter) +
                       "_frame_ultimate.png");

    // Left
    if (side == 0) {
        empty_bg[0] = Sprite("hud/empty_background.png");
        empty_bg[1] = empty_bg[2] = Sprite("hud/empty_background.png");
        if (is_ultimate_diff)
            empty_bg[2] = Sprite("hud/empty_background_ultimate.png");
        life[0] = life[2] = Sprite("hud/left_life.png");
        life[1] = Sprite("hud/full_left_life.png");
        if (is_ultimate_diff)
            life[2] = Sprite("hud/in_ultimate_left_life.png");
        special[0] = Sprite("hud/left_special_bar.png");
        special[1] = Sprite("hud/full_left_special_bar.png");
        special[2] = Sprite("hud/in_ultimate_left_special_bar.png");
    }

    // Right
    if (side == 1) {
        empty_bg[0] = Sprite("hud/empty_background.png");
        empty_bg[1] = empty_bg[2] = Sprite("hud/empty_background.png");
        if (is_ultimate_diff)
            empty_bg[2] = Sprite("hud/empty_background_ultimate.png");
        life[0] = life[2] = Sprite("hud/right_life.png");
        life[1] = Sprite("hud/full_right_life.png");
        if (is_ultimate_diff)
            life[2] = Sprite("hud/in_ultimate_right_life.png");
        special[0] = Sprite("hud/right_special_bar.png");
        special[1] = Sprite("hud/full_right_special_bar.png");
        special[2] = Sprite("hud/in_ultimate_right_special_bar.png");
    }

    player_image = Sprite(fighter->get_path() + "miniature.png");

    box = Rectangle(x, y, bg[0].get_width(), bg[0].get_height());
}

/**
 * Brief Description.
 */
FighterStats::~FighterStats() {
}

/**
 * Brief Description.
 *
 * @param float
 */
void FighterStats::update(float) {
    if (fighter) {
        percent_to_draw_life =
            (fighter->get_remaining_life() * 1.0) / fighter->get_max_life();
        percent_to_draw_special =
            (fighter->get_special() * 1.0) / Fighter::MAX_SPECIAL;

        condition = (percent_to_draw_special == 1.0) ? 1 : 0;
        if (fighter->is("in_ultimate"))
            condition = 2;
        // Left
        if (side == 0) {
            special[condition].set_clip(
                special[condition].get_width() * (1 - percent_to_draw_special),
                0, special[condition].get_width() * percent_to_draw_special,
                special[condition].get_height());
            life[condition].set_clip(
                0, 0, life[condition].get_width() * percent_to_draw_life,
                life[condition].get_height());
        }

        // Right
        if (side == 1) {
            special[condition].set_clip(
                0, 0, special[condition].get_width() * percent_to_draw_special,
                special[condition].get_height());
            life[condition].set_clip(
                life[condition].get_width() * (1 - percent_to_draw_life), 0,
                life[condition].get_width() * percent_to_draw_life,
                life[condition].get_height());
        }
    }
    if (fighter and fighter->is("dying")) {
        player_image = Sprite(fighter->get_path() + "dead_miniature.png");
        fighter = nullptr;
    }
}

/**
 * Brief Description.
 */
void FighterStats::render() {
    int offset = -3 * ((index_fighter + 1) % 2);

    int y_offset = is_ultimate_diff and condition == 2 ? -15 : 0;
    int y_even_offset =
        is_ultimate_diff and condition == 2 and index_fighter % 2 == 0 ? 3 : 0;
    int x_right_offset = is_ultimate_diff and condition == 2 ? -88 : 0;
    int x_right_bg_offset = is_ultimate_diff and condition == 2 ? -30 : 0;
    int x_right_ebg_offset = is_ultimate_diff and condition == 2 ? -22 : 0;
    // Left
    if (side == 0) {
        special[condition].render(82, box.get_draw_y());

        empty_bg[condition].render(
            82, box.get_draw_y() + 22 + offset + y_even_offset);
        player_image.render(box.get_draw_x() + 7, box.get_draw_y() + 9);
        life[condition].render(box.get_draw_x() + 82,
                               box.get_draw_y() + 22 + offset + y_even_offset);
        bg[condition].render(box.get_draw_x(), box.get_draw_y() + y_offset);
    }

    // Right
    if (side == 1) {
        SDL_RendererFlip flip = SDL_FLIP_HORIZONTAL;
        special[condition].render(
            box.get_draw_x() - 12 +
                special[condition].get_width() * (1 - percent_to_draw_special),
            box.get_draw_y());

        empty_bg[condition].render(
            box.get_draw_x() + 8 + x_right_ebg_offset,
            box.get_draw_y() + 22 + offset + y_even_offset);
        player_image.render(box.get_draw_x() + 197, box.get_draw_y() + 9, 0,
                            flip);
        life[condition].render(
            box.get_draw_x() + 8 +
                life[condition].get_width() * (1 - percent_to_draw_life) +
                x_right_offset,
            box.get_draw_y() + 22 + offset + y_even_offset);
        bg[condition].render(box.get_draw_x() + x_right_bg_offset,
                             box.get_draw_y() + y_offset);
    }
}

/**
 * Brief Description.
 *
 * @returns
 */
bool FighterStats::is_dead() {
    return false;
}

/**
 * Brief Description.
 *
 * @param
 */
void FighterStats::notify_collision(const GameObject &) {
}


text:
layout: page
title: "JavaScript asinh function"
comments: true
sharing: true
footer: true
alias:
- /functions/view/asinh:353
- /functions/view/asinh
- /functions/view/353
- /functions/asinh:353
- /functions/353
---
<!-- Generated by Rakefile:build -->
A JavaScript equivalent of PHP's asinh

{% codeblock math/asinh.js lang:js https://raw.github.com/kvz/phpjs/master/functions/math/asinh.js raw on github %}
function asinh(arg) {
  //  discuss at: http://phpjs.org/functions/asinh/
  // original by: Onno Marsman
  //   example 1: asinh(8723321.4);
  //   returns 1: 16.67465779841863

  return Math.log(arg + Math.sqrt(arg * arg + 1));
}
{% endcodeblock %}

 - [Raw function on GitHub](https://github.com/kvz/phpjs/blob/master/functions/math/asinh.js)

Please note that php.js uses JavaScript objects as substitutes for PHP arrays, they are
the closest match to this hashtable-like data structure.

Please also note that php.js offers community built functions and goes by the
[McDonald's Theory](https://medium.com/what-i-learned-building/9216e1c9da7d). We'll put online
functions that are far from perfect, in the hopes to spark better contributions.
Do you have one? Then please just:

 - [Edit on GitHub](https://github.com/kvz/phpjs/edit/master/functions/math/asinh.js)

### Other PHP functions in the math extension
{% render_partial _includes/custom/math.html %}


text:
namespace Egg {
	namespace Mesh
	{
		struct IndexBufferDesc
		{
			static const unsigned short defaultData[6];

			DXGI_FORMAT indexFormat;
			unsigned int nPrimitives;
			D3D11_PRIMITIVE_TOPOLOGY topology;
			unsigned int nIndices;
			void* indexData;
			D3D11_USAGE usage;
			UINT bindFlags;
			UINT cpuAccessFlags;
			UINT miscFlags;

			unsigned int getIndexStride()
			{
				return (indexFormat == DXGI_FORMAT_R16_UINT) ? sizeof(unsigned short) : sizeof(unsigned int);
			}

			IndexBufferDesc() :indexFormat(DXGI_FORMAT_R16_UINT), nPrimitives(2), topology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST), nIndices(0), indexData((void*)defaultData), usage(D3D11_USAGE_IMMUTABLE), bindFlags(D3D11_BIND_INDEX_BUFFER), cpuAccessFlags(0), miscFlags(0) {}
		};

		class VertexStream;

		class Indexed : public Mesh::Geometry {

			Microsoft::WRL::ComPtr<ID3D11Buffer>* vertexBuffers;
			unsigned int* vertexStrides;
			unsigned int nVertexBuffers;

			const D3D11_INPUT_ELEMENT_DESC* elements;
			unsigned int nElements;

			Microsoft::WRL::ComPtr<ID3D11Buffer> indexBuffer;

			DXGI_FORMAT indexFormat;
			unsigned int nPrimitives;
			unsigned int nIndices;

			D3D11_PRIMITIVE_TOPOLOGY topology;

		public:
			Indexed(Microsoft::WRL::ComPtr<ID3D11Device> device, IndexBufferDesc& desc, VertexStream::pointer_array_t & vertexStreams);

			static std::shared_ptr<Indexed> createFromSingleStream(Microsoft::WRL::ComPtr<ID3D11Device> device, IndexBufferDesc& desc, std::shared_ptr<VertexStream> vertexStream) {
				VertexStream::pointer_array_t arr(1); arr.at(0) = vertexStream; return std::make_shared<Indexed>(device, desc, arr);
			}
			static std::shared_ptr<Indexed> createQuad(Microsoft::WRL::ComPtr<ID3D11Device> device) {
				return Indexed::createFromSingleStream(device, IndexBufferDesc(), std::make_shared<VertexStream>(device, VertexStreamDesc()));
			}

			~Indexed(void);

			void getElements(const D3D11_INPUT_ELEMENT_DESC*& elements, unsigned int& nElements);

			void draw(Microsoft::WRL::ComPtr<ID3D11DeviceContext> context);

			unsigned int getVertexBufferCount() { return nVertexBuffers; }
			Microsoft::WRL::ComPtr<ID3D11Buffer>* getVertexBuffers() { return vertexBuffers; }
			Microsoft::WRL::ComPtr<ID3D11Buffer> getPrimaryBuffer() { return vertexBuffers[0]; }
			unsigned int* getVertexStrides() { return vertexStrides; }

			unsigned int getPrimitiveCount() { return nPrimitives; }
			DXGI_FORMAT getIndexFormat() { return indexFormat; }
			D3D11_PRIMITIVE_TOPOLOGY getTopology() { return topology; }
			Microsoft::WRL::ComPtr<ID3D11Buffer> getIndexBuffer() { return indexBuffer; }

			unsigned int getIndexCount() { return nIndices; }
		};

	}
} // namespace Egg::Mesh


text:
package ru.vryazanov.tasks5.extratask;

/**
 * Node operations class
 * <p>
 * Class that contains operations with nodes.
 *
 * @author vryazanov
 * @version 1.0
 * @since 12.08.2017
 */
public class NodeOperations {
    /**
     * Return reversed list of incoming nodes.
     *
     * @param <E> any type of the generic
     * @param startingNode first of incoming nodes
     * @return new starting element for reversed nodes.
     */
    static <E> Node<E> reverseNodeList(Node<E> startingNode) {
        Node<E> nextNode = null;
        Node<E> currentNode = startingNode;

        while (currentNode.getNextNode() != null) {
            Node<E> temp = currentNode.getNextNode();
            currentNode.setNextNode(nextNode);
            nextNode = currentNode;
            currentNode = temp;
        }
        currentNode.setNextNode(nextNode);
        return currentNode;
    }
}


text:
package hudson.plugins.codeviation;

import hudson.model.Project;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.codeviation.model.JavaFile;
import org.codeviation.model.Package;
import org.codeviation.model.SourceRoot;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;

/**
 *
 * @author pzajac
 */
public class SourceRootView extends JavaFileIterableView {
    public SourceRoot srcRoot;
    public Project project;
    private static final String SLASH_PATTERN = "-.-";

    public SourceRootView(SourceRoot srcRoot,Project project) {
        if (srcRoot == null) {
            throw new NullPointerException();
        }
        this.srcRoot = srcRoot;
        this.project = project;
    }

    public String getDisplayName() {
        return srcRoot.getRelPath();
    }
    public String getUrl() {
        return srcRoot.getRelPath().replace("/",SLASH_PATTERN);
    }

    public static String decodeUrl(String srcRootName) {
        return srcRootName.replace(SLASH_PATTERN,"/");
    }
    public List<PackageView> getPackageViews() {
        List<PackageView> packs =  new ArrayList<PackageView>();
        for (Package pack : srcRoot.getPackages()) {
            packs.add(new PackageView(pack,project));
        }
        return packs;
    }

    protected Date getMinDate() {
        return srcRoot.getMinTagDate();
    }

    protected Date getMaxDate() {
        return srcRoot.getMaxTagDate();
    }

    protected Iterable<JavaFile> getJavaFiles() {
        int size = 0;
        for (JavaFile jf : srcRoot) {
            size++;
        }
        getLogger().info("JavaFiles: " + size);
        return srcRoot;
    }

     public PackageView getDynamic(String token, StaplerRequest req, StaplerResponse rsp ) throws IOException {
         Package pack = srcRoot.getPackage(token,false);
         return  (pack == null) ? null :
            new PackageView(pack,project);
    }
}


text:
View at http://bl.ocks.org/wllmtrng/ff72bf455078448e5e40ece3bff15354

## Design
The Prosper Marketplace provides an alternative avenue for people to invest and borrow money.
When a potential borrower fills out an application, a Prosper Score from 1 to 11 is assigned.
Lending to an individual of a lower score will have a better return on investment,
but also have increased chances of defaulting. Lending to an individual of a higher score will have a
lower chance of defaulting, but a lower return on investment.

Quite often, investors use historical data and group past borrowers by certain criteria to
compare against potential borrowers of similar criteria. One criteria used often is Occupations.
Potential borrowers with Occupations that have a higher Prosper Score on average can be generally more credit worthy.

Initially I chose to use this [dashboard](http://bl.ocks.org/NPashaP/96447623ef4d342ee09b) type of visualization because:

1. Bar plots are useful in showing the difference in frequency among the Prosper Scores.
2. The Pie Chart and Legend on the right is able to provide secondary distribution of Occupation for a selected Prosper Score.
3. The Pie Chart can show drastic differences between the distribution of Occupation for a certain Prosper Score.
4. The Legend complements the Pie Chart by showing differences between Occupations with higher resolution.

There are a total of 68 occupations recorded in the Prosper Loan Dataset. I took the top ten occupations by count for
my visualization. Originally amongst the top ten, there were occupations that weren't clear, so I omitted them and
replaced them with the next occupation.

After some feedback from my submission and reading an [article](http://www.businessinsider.com/pie-charts-are-the-worst-2013-6) which
discourages the use of pie charts, I sought to change the visualization to remove the pie chart. I came across a [hierarchical bar chart](http://bl.ocks.org/mbostock/1283663)
example and thought it conveyed my story better.

## Feedback

### Ronald Truong

What I see right away is a bar plot showing the distribution of Prosper Scores from 1 - 11. I noticed that by
hovering over the bars, the pie chart and legend changes to account for how the occupations listed make up
percentage wise for that score.

What I don't like is that there are two Occupation types that the data is skewed towards. Other and Professional
Occupations don't give much value. Although they are indeed the top 10 Occupation, I believe they should be removed.

It's interesting to see that Computer Programmers are very credit worthy occupations. They have a high prosper score on
average compared to all the other professions, besides Executive.

### t0mkaka

Forum Mentor

@wllmtrng

Hi William,

Great work with all the plot and data in sync. I was testing how fast the numbers can be changed :slight_smile:

I can notice that there are few borowwers for the lower end and upper end of the scores and most of the loans are from mid -level. The pie-chart on the right is also showing the values and I can see the distribution for a particular profession by hovering over the pies

    Is there something you don't understand in the graphic?

I would suggest you work more on this. Your plots are great but to a person who does not know about loan data this is very confusing.

    Title - A title tells information we are going to see. An appropriate title helps in better understanding.
    Axis Labels - There is no labels on axis in your bar plots. As a person unaware of the data it took me some time to understand whats on x-axis and what is on y-axis.
    Pie-Chart - I am not so against pie-chart when they convey clear information (which is usually the case when there are only 2-3 sections) . You have 10 and it is very difficult to interpret percentage numbers from that. The numbers are on the table to the right but again, one has to check table then match color.

These are all my suggestions but number 1 and 2 will definitely improve the readability.

Will wait for your iterations. All the best.

include all feedback you received from others on your visualization from the first sketch to the final
visualization

### Dai Ying Wu
The title could be changed to reflect a more targetted story you're trying to get across. I'm assuming you want to show
people what professions are most credit worthy. One thing you can do to demonstrate that more properly is to maybe sort the legend when a Prosper Score is highlighted.

The things I do notice is that the distribution amongs occupations is pretty even in the midrange prosper scores. In the
higher end executives, nurses, and programmers dominate. On the lower end, Teachers, Administrative Assistants, Executives,
and Accountants take much of the proportion. It is ironic that for the Prosper Score of 1 that 13% of them are Accountants.

## Resources and References
- [Prosper Loan Data](https://www.google.com/url?q=https://s3.amazonaws.com/udacity-hosted-downloads/ud651/prosperLoanData.csv&sa=D&ust=1470535594989000&usg=AFQjCNFnP-1MaAOimLzkxa8Wjq5TC7Ez-Q)
- [Prosper Loan Data Dictionary](https://www.google.com/url?q=https://docs.google.com/spreadsheet/ccc?key%3D0AllIqIyvWZdadDd5NTlqZ1pBMHlsUjdrOTZHaVBuSlE%26usp%3Dsharing&sa=D&ust=1470535594992000&usg=AFQjCNE55Bq3n5BUUUUn6t_0QAQ7GxqkSA)
  - The description for Prosper Scores is incorrect. Prosper Scores range from 1 - 11.
- [2009 Post Relaunch - Wikipedia](https://en.wikipedia.org/wiki/Prosper_Marketplace#2009_post_SEC_relaunch)
- [1st Feedback](https://discussions.udacity.com/t/propser-loans-feedback-request/185271)
- [D3 Axis and Titles](http://www.d3noob.org/2013/01/adding-title-to-your-d3js-graph.html)
- [D3 Dashboard Example](http://bl.ocks.org/NPashaP/96447623ef4d342ee09b)
- [D3 Chart Example](http://www.alexrothenberg.com/2014/01/06/learning-d3-by-building-a-chart.js.html)
- [Estimated Vs. Realized Returns Prosper](https://angel.co/projects/289416-expected-vs-realized-returns-for-prosper-loans?src=user_profile)
- [D3 Gallery](https://github.com/d3/d3/wiki/gallery)
- [Hierarchical Bar Chart](http://bl.ocks.org/mbostock/1283663)
- [Pie Charts Are The Worst](http://www.businessinsider.com/pie-charts-are-the-worst-2013-6)


text:
package org.wso2.carbon.webapp.authenticator.framework.authorizer;

import org.apache.catalina.connector.Request;
import org.wso2.carbon.webapp.authenticator.framework.AuthenticationInfo;
import org.wso2.carbon.webapp.authenticator.framework.authenticator.WebappAuthenticator;

/**
 * This class represents the methods that are used to authorize requests based on the tenant subscription.
 */
public class WebappTenantAuthorizer {
	private static final String SHARED_WITH_ALL_TENANTS_PARAM_NAME = "isSharedWithAllTenants";
	private static final String PROVIDER_TENANT_DOMAIN_PARAM_NAME = "providerTenantDomain";

	public static WebappAuthenticator.Status authorize(Request request, AuthenticationInfo authenticationInfo) {
		String tenantDomain = authenticationInfo.getTenantDomain();
		if (tenantDomain != null && isSharedWithAllTenants(request) || isProviderTenant(request, tenantDomain)) {
			return WebappAuthenticator.Status.CONTINUE;
		}
		return WebappAuthenticator.Status.FAILURE;
	}

	private static boolean isSharedWithAllTenants(Request request) {
		String param = request.getContext().findParameter(SHARED_WITH_ALL_TENANTS_PARAM_NAME);
		return (param == null || Boolean.parseBoolean(param));
	}

	private static boolean isProviderTenant(Request request, String requestTenantDomain) {
		String param = request.getContext().findParameter(PROVIDER_TENANT_DOMAIN_PARAM_NAME);
		return (param == null || requestTenantDomain.equals(param));
	}
}


text:
package net.sf.fjep.fatjar.wizards.export;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
import org.eclipse.jdt.launching.IRuntimeClasspathProvider;
import org.eclipse.jdt.launching.JavaRuntime;

/**
 * capsules JProject and LaunchConfiguration
 */
public class JProjectConfiguration {

    private static final String FATJAR_CONFIG_PREFIX = "fatjar_cfg_eraseme_";

    private boolean newLaunchConfig = false;

    public boolean isNewLaunchConfig() {
        return newLaunchConfig;
    }

    public void setNewLaunchConfig(boolean newLaunchConfig) {
        this.newLaunchConfig = newLaunchConfig;
    }

    private IJavaProject jproject;

    private List jProjectCollection;

    private ILaunchConfiguration launchConfig;

    private String propertiesFilename;

    public void setPropertiesFilename(String filename) {
        propertiesFilename = filename;
    }

    public String getPropertiesFilename() {
        return propertiesFilename;
    }

    public JProjectConfiguration(IJavaProject jproject,
            ILaunchConfiguration launchConfig) {
        this.jproject = jproject;

        if (launchConfig == null) {
            String prjName = jproject.getElementName();
            launchConfig = findConfiguration(FATJAR_CONFIG_PREFIX + prjName);
            if (launchConfig == null) {
                launchConfig = createConfiguration(FATJAR_CONFIG_PREFIX
                        + prjName, prjName);
            }
        }

        this.launchConfig = launchConfig;
    }

    public JProjectConfiguration(List projectCollection) {
        this.jProjectCollection = projectCollection;
        // TODO: remove this code, temporary for regression test
        this.jproject = (IJavaProject) projectCollection.get(0);
        String prjName = jproject.getElementName();

        ILaunchConfiguration launchConfig = findConfiguration(FATJAR_CONFIG_PREFIX + prjName);
        if (launchConfig == null) {
            launchConfig = createConfiguration(FATJAR_CONFIG_PREFIX + prjName,
                    prjName);
        }
        this.launchConfig = launchConfig;
    }

    public IJavaProject getJproject() {
        return jproject;
    }

    public ILaunchConfiguration getLaunchConfig() {
        return launchConfig;
    }

    /**
     * return path to project root as absolute path
     *
     * @return
     */
    public String getAbsProjectDir() {

        IProject project = getProject();
        String absProjectDir = absPath(project.getLocation());
        return absProjectDir;
    }

    /**
     * use folder project/TempFatjarBuildDir_erase_me for tempory build files
     */
    public String getTempBuildDir() {

        String absProjectDir = getAbsProjectDir();
        String buildDir = "TempFatjarBuildDir_erase_me";
        String result = absProjectDir + File.separator + buildDir;
        return result;
    }

    /**
     * convert IPath to absolute (canonical) string path
     *
     * @param path
     * @return null if path is null or an invalid path
     */
    public String absPath(IPath path) {

        String result = null;
        if (path != null) {
            File f = path.toFile();
            try {
                result = f.getCanonicalPath();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return result;
    }

    /**
     * @return associated IProject
     */
    public IProject getProject() {
        IProject result = null;
        if (jproject != null) {
            result = jproject.getProject();
        }
        return result;
    }

    /**
     * @return associated IResource
     */
    public IResource[] getResource() {
        IResource []results = new IResource[this.jProjectCollection.size()];
        for (int i = 0; i<this.jProjectCollection.size();i++) {
            IJavaProject project = (IJavaProject) this.jProjectCollection.get(i);
            try {
                results[i] = project.getCorrespondingResource();
            } catch (JavaModelException e) {
                e.printStackTrace();
            }
        }
        return results;
    }

    /**
     * @param name
     * @return
     */
    public IFile getIFile(String name) {

        IFile result = null;
        IProject project = getProject();
        if (project != null) {
            result = project.getFile(name);
        }
        return result;
    }

    /**
     * @return "<project>.<lauchconfig>"
     */
    public String getName() {
        String prjName = getProjectName();
        String lcName = getLaunchConfigName();
        return prjName + "." + lcName;
    }

    /**
     * @return name of the project
     * @see getName()
     */
    public String getProjectName() {
        String result = null;
        IProject project = getProject();
        if (project != null) {
            result = project.getName();
        }
        return result;
    }

    /**
     * @return name of the LaunchConfiguration
     * @see getName()
     */
    public String getLaunchConfigName() {
        String result = null;
        ILaunchConfiguration lc = getLaunchConfig();
        if (lc != null) {
            result = lc.getName();
        }
        if ((result == null) || result.startsWith(FATJAR_CONFIG_PREFIX)) {
            result = "<default>";
        }
        return result;
    }

    public IWorkspaceRoot getWorkspaceRoot() {
        IWorkspaceRoot result = null;
        if (jproject != null) {
            result = jproject.getProject().getWorkspace().getRoot();
        }
        return result;
    }

    /**
     * get absolute path for /project/xyz by resolving "project" location
     *
     * @param path
     * @return
     */
    public String getAbsProjectPath(String path) {
        int n = path.indexOf(File.separatorChar, 1);
        String jarProjectName;
        String jarProjectPath;
        if (n != -1) {
            jarProjectName = path.substring(1, n);
            jarProjectPath = path.substring(n);
        } else {
            jarProjectName = path.substring(1);
            jarProjectPath = "";
        }
        IProject jarProject = getWorkspaceRoot().getProject(jarProjectName);
        String jarProjectRoot = absPath(jarProject.getLocation());
        String result = null;
        if (jarProjectRoot != null)
            result = jarProjectRoot + jarProjectPath;
        return result;
    }

    /**
     * add classe-dir of the project to classesDirs if it exists
     *
     * @param classesDirs
     */
    public void getClassesDir(Vector classesDirs) {

        if (jproject != null) {
            IProject project = jproject.getProject();
            IWorkspaceRoot workspaceRoot = project.getWorkspace().getRoot();
            String outputDir = null;
            try {
                outputDir = getAbsProjectPath(relPath(jproject
                        .getOutputLocation()));
            } catch (JavaModelException e) {
                e.printStackTrace();
            }
            if (!classesDirs.contains(outputDir))
                classesDirs.add(outputDir);
        }
    }

    /**
     * @return output class-dir of the project or null if none exists
     */
    public String getProjectOutputDir() {

        String outputDir = null;
        if (jproject != null) {
            IProject project = jproject.getProject();
            IWorkspaceRoot workspaceRoot = project.getWorkspace().getRoot();
            try {
                outputDir = getAbsProjectPath(relPath(jproject
                        .getOutputLocation()));
            } catch (JavaModelException e) {
                e.printStackTrace();
            }
        }
        return outputDir;
    }

    /**
     * Add all jars and class-folders referenced by jproject to jarfiles /
     * classesDirs. If exportedOnly is true, then only jars/class-folders which
     * are marked as exported will be added.
     *
     * JRE_LIB (.../jre/lib/rt.jar) is ignored and not added to jarfiles
     *
     * @param jarfiles
     * @param classesDirs
     * @param exportedOnly
     */
    public void addClassPathEntries(Vector jarfiles, Vector classesDirs,
            Vector projects, boolean exportedOnly) {

        IClasspathEntry[] cpes = getRawClasspathEntries();
        if (cpes != null) {
            for (int i = 0; i < cpes.length; i++) {
                IClasspathEntry cpe = JavaCore
                        .getResolvedClasspathEntry(cpes[i]);
                if ((cpe != null) && (!exportedOnly || cpe.isExported())) {
                    int kind = cpe.getEntryKind();
                    String dir = relPath(cpe.getPath());
                    if (kind == IClasspathEntry.CPE_CONTAINER) {
                        try {
                            IClasspathContainer container = JavaCore
                                    .getClasspathContainer(cpe.getPath(),
                                            jproject);
                            if ((container.getKind() == IClasspathContainer.K_APPLICATION)
                                    || (container.getKind() == IClasspathContainer.K_SYSTEM)) {
                                IClasspathEntry[] cpes2 = container
                                        .getClasspathEntries();
                                for (int j = 0; j < cpes2.length; j++) {
                                    IClasspathEntry cpe2 = cpes2[j];
                                    int kind2 = cpe2.getEntryKind();
                                    String dir2 = relPath(cpe2.getPath());
                                    String jar2 = getAbsOrProjectPath(dir2);
                                    if (jar2 == null) {
                                        System.err
                                                .println("invalid classpath entry: "
                                                        + cpe2.toString());
                                    } else {
                                        File f2 = new File(jar2);
                                        if (f2.isDirectory()) {
                                            if (!classesDirs.contains(jar2)) {
                                                classesDirs.add(jar2);
                                            }
                                        } else { // assume jar file
                                            if (!jarfiles.contains(jar2)) {
                                                jarfiles.add(jar2);
                                            }
                                        }
                                    }
                                }
                            }
                        } catch (JavaModelException e) {
                        }
                    } else if (kind == IClasspathEntry.CPE_LIBRARY) {
                        String jar = getAbsOrProjectPath(dir);
                        if (jar == null) {
                            System.err.println("invalid classpath entry: "
                                    + cpe.toString());
                        } else {

                            // ignore JRE_LIB
                            if (!jar.replace(File.separatorChar, '/')
                                    .toLowerCase().endsWith("/jre/lib/rt.jar")) {
                                File f = new File(jar);
                                if (f.isDirectory()) {
                                    if (!classesDirs.contains(jar)) {
                                        classesDirs.add(jar);
                                    }
                                } else { // assume jar file
                                    if (!jarfiles.contains(jar)) {
                                        jarfiles.add(jar);
                                    }
                                }
                            }
                        }
                    } else if (kind == IClasspathEntry.CPE_PROJECT) {
                        if (!exportedOnly || cpe.isExported()) {
                            IJavaProject jPro = jproject.getJavaModel()
                                    .getJavaProject(dir);
                            JProjectConfiguration jProCon = new JProjectConfiguration(
                                    jPro, null);
                            if (!projects.contains(jProCon)) {
                                projects.add(jProCon);
                            }
                        }
                    }
                }
            }
        }
    }

    /**
     * Add all jars and class-folders referenced by jproject to jarfiles /
     * classesDirs. If exportedOnly is true, then only jars/class-folders which
     * are marked as exported will be added.
     *
     * JRE_LIB (.../jre/lib/rt.jar) is ignored and not added to jarfiles
     *
     * @param jarfiles
     * @param classesDirs
     * @param exportedOnly
     */
    public void getClassPathJars(Vector jarfiles, Vector classesDirs,
            boolean exportedOnly) {

        IClasspathEntry[] cpes = getRawClasspathEntries();
        if (cpes != null) {
            for (int i = 0; i < cpes.length; i++) {
                IClasspathEntry cpe = JavaCore
                        .getResolvedClasspathEntry(cpes[i]);
                if ((cpe != null) && (!exportedOnly || cpe.isExported())) {
                    int kind = cpe.getEntryKind();
                    String dir = relPath(cpe.getPath());
                    if (kind == IClasspathEntry.CPE_CONTAINER) {
                        try {
                            IClasspathContainer container = JavaCore
                                    .getClasspathContainer(cpe.getPath(),
                                            jproject);
                            if ((container.getKind() == IClasspathContainer.K_APPLICATION)
                                    || (container.getKind() == IClasspathContainer.K_SYSTEM)) {
                                IClasspathEntry[] cpes2 = container
                                        .getClasspathEntries();
                                for (int j = 0; j < cpes2.length; j++) {
                                    IClasspathEntry cpe2 = cpes2[j];
                                    int kind2 = cpe2.getEntryKind();
                                    String dir2 = relPath(cpe2.getPath());
                                    String jar2 = getAbsOrProjectPath(dir2);
                                    if (jar2 == null) {
                                        System.err
                                                .println("invalid classpath entry: "
                                                        + cpe2.toString());
                                    } else {
                                        File f2 = new File(jar2);
                                        if (f2.isDirectory()) {
                                            if (!classesDirs.contains(jar2)) {
                                                classesDirs.add(jar2);
                                            }
                                        } else { // assume jar file
                                            if (!jarfiles.contains(jar2)) {
                                                jarfiles.add(jar2);
                                            }
                                        }
                                    }
                                }
                            }
                        } catch (JavaModelException e) {
                        }
                    } else if (kind == IClasspathEntry.CPE_LIBRARY) {
                        String jar = getAbsOrProjectPath(dir);
                        if (jar == null) {
                            System.err.println("invalid classpath entry: "
                                    + cpe.toString());
                        } else {

                            // ignore JRE_LIB
                            if (!jar.replace(File.separatorChar, '/')
                                    .toLowerCase().endsWith("/jre/lib/rt.jar")) {
                                File f = new File(jar);
                                if (f.isDirectory()) {
                                    if (!classesDirs.contains(jar)) {
                                        classesDirs.add(jar);
                                    }
                                } else { // assume jar file
                                    if (!jarfiles.contains(jar)) {
                                        jarfiles.add(jar);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    public void getChildProjects(Vector projects, boolean exportedOnly) {

        IClasspathEntry[] cpes = this.getRawClasspathEntries();
        if (cpes != null) {
            for (int i = 0; i < cpes.length; i++) {
                IClasspathEntry cpe = JavaCore
                        .getResolvedClasspathEntry(cpes[i]);
                if (cpe == null) {
                    System.err.println("Error: cpes[" + i + "]=" + cpes[i]
                            + " does not resolve");
                    continue;
                }
                int kind = cpe.getEntryKind();
                String name = relPath(cpe.getPath());
                if (kind == IClasspathEntry.CPE_CONTAINER) {
                    try {
                        IClasspathContainer container = JavaCore
                                .getClasspathContainer(cpe.getPath(), jproject);
                        if ((container.getKind() == IClasspathContainer.K_APPLICATION)
                                || (container.getKind() == IClasspathContainer.K_SYSTEM)) {
                            IClasspathEntry[] cpes2 = container
                                    .getClasspathEntries();
                            for (int j = 0; j < cpes2.length; j++) {
                                IClasspathEntry cpe2 = cpes2[j];
                                int kind2 = cpe2.getEntryKind();
                                String name2 = relPath(cpe2.getPath());
                                if (name2 == null) {
                                    System.err
                                            .println("invalid classpath entry: "
                                                    + cpe2.toString());
                                } else {
                                    if (kind2 == IClasspathEntry.CPE_PROJECT) {
                                        if (!exportedOnly || cpe2.isExported()) {
                                            if (!projects.contains(name2)) {
                                                IJavaProject jChildProject2 = jproject
                                                        .getJavaModel()
                                                        .getJavaProject(name2);
                                                JProjectConfiguration jpcChild2 = new JProjectConfiguration(
                                                        jChildProject2, null);
                                                projects.add(jpcChild2);
                                                jpcChild2.getChildProjects(
                                                        projects, true);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    } catch (JavaModelException e) {
                    }
                } else if (kind == IClasspathEntry.CPE_PROJECT) {
                    if (name == null) {
                        System.err.println("invalid classpath entry: "
                                + cpe.toString());
                    } else {
                        if (!exportedOnly || cpe.isExported()) {
                            if (!projects.contains(name)) {
                                IJavaProject jChildProject = jproject
                                        .getJavaModel().getJavaProject(name);
                                JProjectConfiguration jpcChild = new JProjectConfiguration(
                                        jChildProject, null);
                                projects.add(jpcChild);
                                jpcChild.getChildProjects(projects, true);
                            }
                        }
                    }
                }
            }
        }
    }

    /**
     * get mainclass set in launch configuration
     *
     * @return "" if not set, never null
     */
    public String getMainClass() {
        String result = null;
        if (launchConfig != null) {
            try {
                result = launchConfig.getAttribute(
                        IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME,
                        (String) null);
            } catch (CoreException ignore) {
            }
        }
        if (result == null) {
            result = "";
        }
        return result;
    }

    /**
     * get program arguments set in launch configuration
     *
     * @return "" if not set, never null
     */
    public String getArguments() {
        String result = null;
        if (launchConfig != null) {
            try {
                result = launchConfig
                        .getAttribute(
                                IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
                                (String) null);
            } catch (CoreException ignore) {
            }
        }
        if (result == null) {
            result = "";
        }
        return result;
    }

    /**
     * get vm arguments set in launch configuration
     *
     * @return "" if not set, never null
     */
    public String getVMArguments() {
        String result = null;
        if (launchConfig != null) {
            try {
                result = launchConfig.getAttribute(
                        IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS,
                        (String) null);
            } catch (CoreException ignore) {
            }
        }
        if (result == null) {
            result = "";
        }
        return result;
    }

    protected ILaunchConfiguration findConfiguration(String configname) {
        String projectName = getProjectName();
        ILaunchConfiguration result = null;
        try {
            ILaunchConfiguration[] configs = DebugPlugin.getDefault()
                    .getLaunchManager().getLaunchConfigurations();
            for (int i = 0; i < configs.length; i++) {
                ILaunchConfiguration configuration = configs[i];
                if (configuration.getName().equals(configname)) {
                    String confProjectName = configuration
                            .getAttribute(
                                    IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME,
                                    "");
                    if (projectName.equals(confProjectName)) {
                        result = configuration;
                    }
                }
            }
        } catch (CoreException ignore) {
        }
        return result;
    }

    /**
     *
     * @return list of names of all existing launch configuration for this
     *         project
     */
    public String[] getProjectConfigurations() {
        String projectName = getProjectName();
        ArrayList result = new ArrayList();
        try {
            ILaunchConfiguration[] configs = DebugPlugin.getDefault()
                    .getLaunchManager().getLaunchConfigurations();
            for (int i = 0; i < configs.length; i++) {
                ILaunchConfiguration configuration = configs[i];
                String attrProjectName = configuration
                        .getAttribute(
                                IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME,
                                "");
                if (attrProjectName.equals(projectName)) {
                    String lcName = configuration.getName();
                    if (lcName.startsWith(FATJAR_CONFIG_PREFIX)) {
                        lcName = "<default>";
                    }
                    result.add(lcName);
                }
            }
        } catch (CoreException ignore) {
        }
        String[] resultArray = (String[]) result.toArray(new String[result
                .size()]);
        return resultArray;
    }

    // from
    // org.eclipse.jdt.internal.debug.ui.launcher.JavaApplicationLaunchShortcut
    protected ILaunchConfiguration createConfiguration(String configname,
            String projectName) {
        ILaunchConfiguration config = null;
        ILaunchConfigurationWorkingCopy wc = null;
        try {
            ILaunchConfigurationType configType = getJavaLaunchConfigType();
            wc = configType.newInstance(null, getLaunchManager()
                    .generateUniqueLaunchConfigurationNameFrom(configname));
        } catch (CoreException exception) {
            exception.printStackTrace();
            return null;
        }
        // wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME,
        // fqcnMain);
        wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME,
                projectName);
        try {
            config = wc.doSave();
        } catch (CoreException exception) {
            exception.printStackTrace();
        }
        return config;
    }

    protected ILaunchConfigurationType getJavaLaunchConfigType() {
        return getLaunchManager().getLaunchConfigurationType(
                IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
    }

    protected ILaunchManager getLaunchManager() {
        return DebugPlugin.getDefault().getLaunchManager();
    }

    private IClasspathEntry[] getRawClasspathEntries() {

        IClasspathEntry[] result = null;
        ILaunchConfiguration lc = getLaunchConfig();
        if (lc != null) {
            try {
                Vector cpeList = new Vector();
                // JavaRuntime.computeUnresolvedRuntimeClasspath(lc);
                IRuntimeClasspathProvider rcp = JavaRuntime
                        .getClasspathProvider(lc);
                if (rcp != null) {
                    IRuntimeClasspathEntry[] rawRcpes = rcp
                            .computeUnresolvedClasspath(lc);
                    IRuntimeClasspathEntry[] entries = JavaRuntime
                            .resolveRuntimeClasspath(rawRcpes, lc);
                    List userEntries = new ArrayList(entries.length);
                    for (int i = 0; i < entries.length; i++) {
                        if (entries[i].getClasspathProperty() == IRuntimeClasspathEntry.USER_CLASSES) {
                            String location = entries[i].getLocation();
                            if (location != null) {
                                System.out.println("cpe[" + i + "]='"
                                        + entries[i].getLocation() + "'");
                                IClasspathEntry cpe = entries[i]
                                        .getClasspathEntry();
                                if (cpe != null) {
                                    cpeList.add(cpe);
                                }
                            }
                        }
                    }
                }
                result = (IClasspathEntry[]) cpeList
                        .toArray(new IClasspathEntry[cpeList.size()]);
            } catch (CoreException e) {
                e.printStackTrace();
            }
        }
        return result;
    }

    /**
     * @return
     */
    private IClasspathEntry[] oldGetRawClasspathEntries() {
        IClasspathEntry[] result = null;

        ILaunchConfiguration lc = getLaunchConfig();
        if (lc != null) {
            try {
                Vector cpeList = new Vector();
                // JavaRuntime.computeUnresolvedRuntimeClasspath(lc);
                IRuntimeClasspathProvider rcp = JavaRuntime
                        .getClasspathProvider(lc);
                if (rcp != null) {
                    IRuntimeClasspathEntry[] rawRcpes = rcp
                            .computeUnresolvedClasspath(lc);
                    // IRuntimeClasspathEntry[] rcpes =
                    // rcp.resolveClasspath(rawRcpes, lc);
                    if (rawRcpes != null) {
                        for (int i = 0; i < rawRcpes.length; i++) {
                            IRuntimeClasspathEntry rcpe = rawRcpes[i];
                            System.out.println("cpe[" + i + "]='"
                                    + rcpe.getLocation() + "'");
                            IClasspathEntry cpe = rcpe.getClasspathEntry();
                            if (cpe != null) {
                                cpeList.add(cpe);
                            }
                        }
                    }
                }
                result = (IClasspathEntry[]) cpeList
                        .toArray(new IClasspathEntry[cpeList.size()]);
            } catch (CoreException e) {
                e.printStackTrace();
            }
        }
        if (result == null) {
            result = jproject.readRawClasspath();
        }
        return result;
    }

    /**
     * convert IPath to relative string path
     *
     * @param path
     * @return
     */
    private String relPath(IPath path) {

        String result = null;
        File f = path.toFile();
        result = f.getPath();
        return result;
    }

    /**
     * check if path is absolute by checking file existence, resolve as project
     * path "/<project>/.." otherwise
     *
     * @param path
     *            an absolute path or an project path
     * @return
     */
    public String getAbsOrProjectPath(String path) {
        String result = path;
        try {
            File f = new File(path);
            if (!f.exists()) {
                result = getAbsProjectPath(path);
            }
        } catch (Exception e) {
        }
        return result;
    }

    /*
     * (non-Javadoc)
     *
     * @see java.lang.Object#equals(java.lang.Object)
     */
    public boolean equals(Object arg0) {
        boolean result = false;
        if (arg0 instanceof JProjectConfiguration) {
            JProjectConfiguration otherJP = (JProjectConfiguration) arg0;
            if (getName().equals(otherJP.getName())) {
                result = true;
            }
        }
        return result;
    }

    /*
     * (non-Javadoc)
     *
     * @see java.lang.Object#hashCode()
     */
    public int hashCode() {
        String hashSeed = getName();
        return hashSeed.hashCode();
    }

    /*
     * (non-Javadoc)
     *
     * @see java.lang.Object#toString()
     */
    public String toString() {
        return getName();
    }

    public static void removeTempFatjarConfigs() {
        try {
            ILaunchConfiguration[] configs = DebugPlugin.getDefault()
                    .getLaunchManager().getLaunchConfigurations();
            for (int i = 0; i < configs.length; i++) {
                ILaunchConfiguration configuration = configs[i];
                if (configuration.getName().startsWith(FATJAR_CONFIG_PREFIX)) {
                    configuration.delete();
                }
            }
        } catch (CoreException e) {
            e.printStackTrace();
        }
    }

    public List getJProjectCollection() {
        return jProjectCollection;
    }

    public void setJProjectCollection(List projectCollection) {
        jProjectCollection = projectCollection;
    }

}


text:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PageUp.Lib.Infrastructure.Classes;
using PageUp.Lib.Models;

namespace PageUp.Test
{
    [TestClass]
    public class Infrastructures
    {
        [TestMethod]
        [Description("Empty product")]
        public void TestMethod1()
        {
            new ProductBox();
        }

        [TestMethod]
        [Description("Fill product")]
        public void TestMethod2()
        {
            new ProductBox(0, 0, 0);
        }

        [TestMethod]
        [Description("Empty delivery")]
        public void TestMethod3()
        {
            new DeliveryItem();
        }

        [TestMethod]
        [Description("Fill delivery without weight")]
        public void TestMethod4()
        {
            new DeliveryItem(new ProductBox());
        }

        [TestMethod]
        [Description("Fill delivery include weight")]
        public void TestMethod5()
        {
            new DeliveryItem(new ProductBox(0, 0, 0), 0);
        }
    }
}


text:
description('Tests for ES6 class syntax expressions');

var constructorCallCount = 0;
const staticMethodValue = [1];
const instanceMethodValue = [2];
const getterValue = [3];
var setterValue = undefined;
var A = class {
    constructor() { constructorCallCount++; }
    static someStaticMethod() { return staticMethodValue; }
    static get someStaticGetter() { return getterValue; }
    static set someStaticSetter(value) { setterValue = value; }
    someInstanceMethod() { return instanceMethodValue; }
    get someGetter() { return getterValue; }
    set someSetter(value) { setterValue = value; }
};

shouldBe("constructorCallCount", "0");
shouldBe("A.someStaticMethod()", "staticMethodValue");
shouldBe("A.someStaticGetter", "getterValue");
shouldBe("setterValue = undefined; A.someStaticSetter = 123; setterValue", "123");
shouldBe("(new A).someInstanceMethod()", "instanceMethodValue");
shouldBe("constructorCallCount", "1");
shouldBe("(new A).someGetter", "getterValue");
shouldBe("constructorCallCount", "2");
shouldBe("(new A).someGetter", "getterValue");
shouldBe("setterValue = undefined; (new A).someSetter = 789; setterValue", "789");
shouldBe("(new A).__proto__", "A.prototype");
shouldBe("A.prototype.constructor", "A");

shouldThrow("x = class", "'SyntaxError: Unexpected end of input'");
shouldThrow("x = class {", "'SyntaxError: Unexpected end of input'");
shouldThrow("x = class { ( }", "'SyntaxError: Unexpected token ('");
shouldNotThrow("x = class {}");

shouldThrow("x = class { constructor() {} constructor() {} }", "'SyntaxError: A class may only have one constructor'");
shouldThrow("x = class { get constructor() {} }", "'SyntaxError: Class constructor may not be an accessor'");
shouldThrow("x = class { set constructor() {} }", "'SyntaxError: Class constructor may not be an accessor'");
shouldNotThrow("x = class { constructor() {} static constructor() { return staticMethodValue; } }");
shouldBe("x = class { constructor() {} static constructor() { return staticMethodValue; } }; x.constructor()", "staticMethodValue");

shouldThrow("x = class { constructor() {} static prototype() {} }", "'SyntaxError: Classes may not have static property named prototype'");
shouldThrow("x = class { constructor() {} static get prototype() {} }", "'SyntaxError: Classes may not have static property named prototype'");
shouldThrow("x = class { constructor() {} static set prototype() {} }", "'SyntaxError: Classes may not have static property named prototype'");
shouldNotThrow("x = class  { constructor() {} prototype() { return instanceMethodValue; } }");
shouldBe("x = class { constructor() {} prototype() { return instanceMethodValue; } }; (new x).prototype()", "instanceMethodValue");

shouldNotThrow("x = class { constructor() {} set foo(a) {} }");
shouldNotThrow("x = class { constructor() {} set foo({x, y}) {} }");
shouldThrow("x = class { constructor() {} set foo() {} }");
shouldThrow("x = class { constructor() {} set foo(a, b) {} }");
shouldNotThrow("x = class { constructor() {} get foo() {} }");
shouldThrow("x = class { constructor() {} get foo(x) {} }");
shouldThrow("x = class { constructor() {} get foo({x, y}) {} }");

var successfullyParsed = true;


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Proc. Am. philos. Soc. 57: 364 (1918)

#### Original name
Galera bryophila (Peck) Sacc.

### Remarks
null


text:
namespace Microsoft.JScript {

    using System;
    using System.Diagnostics;
    using System.Text;

    public class StringConstructor : ScriptFunction{
      internal static readonly StringConstructor ob = new StringConstructor();

      private StringPrototype originalPrototype;

      internal StringConstructor()
        : base(FunctionPrototype.ob, "String", 1) {
        this.originalPrototype = StringPrototype.ob;
        StringPrototype._constructor = this;
        this.proto = StringPrototype.ob;
      }

      internal StringConstructor(FunctionPrototype parent, LenientStringPrototype prototypeProp)
        : base(parent, "String", 1) {
        this.originalPrototype = prototypeProp;
        prototypeProp.constructor = this;
        this.proto = prototypeProp;
        this.noExpando = false;
      }

      internal override Object Call(Object[] args, Object thisob){
        if (args.Length == 0)
          return "";
        else
          return Convert.ToString(args[0]);
      }

      internal StringObject Construct(){
        return new StringObject(this.originalPrototype, "", false);
      }

      internal override Object Construct(Object[] args){
        return this.CreateInstance(args);
      }

      internal StringObject ConstructImplicitWrapper(String arg){
        return new StringObject(this.originalPrototype, arg, true);
      }

      internal StringObject ConstructWrapper(String arg){
        return new StringObject(this.originalPrototype, arg, false);
      }

      [JSFunctionAttribute(JSFunctionAttributeEnum.HasVarArgs)]
      public new StringObject CreateInstance(params Object[] args){
        return new StringObject(this.originalPrototype, args.Length == 0 ? "" : Convert.ToString(args[0]), false);
      }

      public String Invoke(Object arg){
        return Convert.ToString(arg);
      }

      [JSFunctionAttribute(JSFunctionAttributeEnum.HasVarArgs, JSBuiltin.String_fromCharCode)]
      public static String fromCharCode(params Object[] args){
        StringBuilder str = new StringBuilder(args.Length);
        for (int i = 0; i < args.Length; i++)
          str.Append(Convert.ToChar(args[i]));
        return str.ToString();
      }
    }
}


text:
namespace __scudo {

void NORETURN reportCallocOverflow(uptr Count, uptr Size) {
  dieWithMessage("calloc parameters overflow: count * size (%zd * %zd) cannot "
      "be represented with type size_t\n", Count, Size);
}

void NORETURN reportPvallocOverflow(uptr Size) {
  dieWithMessage("pvalloc parameters overflow: size 0x%zx rounded up to system "
      "page size 0x%zx cannot be represented in type size_t\n", Size,
      GetPageSizeCached());
}

void NORETURN reportAllocationAlignmentTooBig(uptr Alignment,
                                              uptr MaxAlignment) {
  dieWithMessage("invalid allocation alignment: %zd exceeds maximum supported "
      "allocation of %zd\n", Alignment, MaxAlignment);
}

void NORETURN reportAllocationAlignmentNotPowerOfTwo(uptr Alignment) {
  dieWithMessage("invalid allocation alignment: %zd, alignment must be a power "
      "of two\n", Alignment);
}

void NORETURN reportInvalidPosixMemalignAlignment(uptr Alignment) {
  dieWithMessage("invalid alignment requested in posix_memalign: %zd, alignment"
      " must be a power of two and a multiple of sizeof(void *) == %zd\n",
      Alignment, sizeof(void *));  // NOLINT
}

void NORETURN reportInvalidAlignedAllocAlignment(uptr Size, uptr Alignment) {
#if SANITIZER_POSIX
  dieWithMessage("invalid alignment requested in aligned_alloc: %zd, alignment "
      "must be a power of two and the requested size 0x%zx must be a multiple "
      "of alignment\n", Alignment, Size);
#else
  dieWithMessage("invalid alignment requested in aligned_alloc: %zd, the "
      "requested size 0x%zx must be a multiple of alignment\n", Alignment,
      Size);
#endif
}

void NORETURN reportAllocationSizeTooBig(uptr UserSize, uptr TotalSize,
                                         uptr MaxSize) {
  dieWithMessage("requested allocation size 0x%zx (0x%zx after adjustments) "
      "exceeds maximum supported size of 0x%zx\n", UserSize, TotalSize,
      MaxSize);
}

void NORETURN reportRssLimitExceeded() {
  dieWithMessage("specified RSS limit exceeded, currently set to "
      "soft_rss_limit_mb=%zd\n", common_flags()->soft_rss_limit_mb);
}

void NORETURN reportOutOfMemory(uptr RequestedSize) {
  dieWithMessage("allocator is out of memory trying to allocate 0x%zx bytes\n",
                 RequestedSize);
}

}  // namespace __scudo


text:
/*
Title: Historic
Description: L.N. Consulting is a mechanical, electrical, and energy services engineering design firm, with geothermal and renewable energy systems integration experience
*/

# Historic

Champlain College Aiken Hall Renovation Project, 	    Burlington, VT

						    LEED gold

Champlain College Perry Hall Renovation Project, 	    Burlington, VT

						    LEED platinum

Middlebury College Franklin Environmental Center at Hillcrest Hall, Middlebury, VT

						    LEED platinum

Middlebury College ? Proctor Hall Renovation Project, 	    Middlebury, VT

Moran Center Project, 	    Burlington, VT

Shelburne Farms PV Installation Project, 	    Shelburne, VT

Shelburne Farms Residential Learning Center, 	    Shelburne, VT

Teal Farm, 	    Huntington, VT

University of Vermont, Given Building Infill Project, 	    Burlington, VT

						    LEED gold


text:
from datetime import datetime

from django.forms import SplitHiddenDateTimeWidget
from django.test import override_settings
from django.utils import translation

from .base import WidgetTest

class SplitHiddenDateTimeWidgetTest(WidgetTest):
    widget = SplitHiddenDateTimeWidget()

    def test_render_empty(self):
        self.check_html(self.widget, 'date', '', html=(
            '<input type="hidden" name="date_0" /><input type="hidden" name="date_1" />'
        ))

    def test_render_value(self):
        d = datetime(2007, 9, 17, 12, 51, 34, 482548)
        self.check_html(self.widget, 'date', d, html=(
            '<input type="hidden" name="date_0" value="2007-09-17" />'
            '<input type="hidden" name="date_1" value="12:51:34" />'
        ))
        self.check_html(self.widget, 'date', datetime(2007, 9, 17, 12, 51, 34), html=(
            '<input type="hidden" name="date_0" value="2007-09-17" />'
            '<input type="hidden" name="date_1" value="12:51:34" />'
        ))
        self.check_html(self.widget, 'date', datetime(2007, 9, 17, 12, 51), html=(
            '<input type="hidden" name="date_0" value="2007-09-17" />'
            '<input type="hidden" name="date_1" value="12:51:00" />'
        ))

    @override_settings(USE_L10N=True)
    @translation.override('de-at')
    def test_l10n(self):
        d = datetime(2007, 9, 17, 12, 51)
        self.check_html(self.widget, 'date', d, html=(
            """
            <input type="hidden" name="date_0" value="17.09.2007" />
            <input type="hidden" name="date_1" value="12:51:00" />
            """
        ))