text:
minish
======

Minish makes it easy to write applications that interact with a user using a simple shell-like command-line interface.

## Installing

```shell
$ npm install --save minish
```

## Usage

Starting an interactive command-line session is very simple. Just *require* minish, declare some commands and start a command prompt:

```javascript
var shell = require('minish');

// 'hello' command
shell.command("hello", function (context) {

    // display something
	shell.write("Hello world!");

	// make sure to end each command properly
    context.end();
});

shell.command("exit", function (context) {

    // exit the application
    shell.exit();
});

// start prompting for commands
shell.prompt();
```

Commands accept arguments and options. Both of these get parsed with [minimist](https://www.npmjs.com/package/minimist) and are passed to the callback with *command context* object:

```javascript
shell.command("echo", function (context) {
    // retrieve command arguments and options (parsed with minimist)
    var args = context.args;
    var opts = context.options;

    // show arguments
    shell.write(args, opts);

    // end the command
    context.end();
});
```

Minish makes it simple to ask for input. It can also ask for passwords discretely:

```javascript
// ask for a password without revealing its characters:
shell.password("Type a secret password:", function (password) {

    // ask whether to show the password
    shell.question("Type 'show' to display the password:", function (reply) {

        // show the password if needed
        if (reply === "show") shell.write("The password was:", password);
    });
});
```

Let's try something more complicated:

```javascript
var shell = require('minish');

// 'hello' command
shell.command("hello", function (context) {
    // write to shell's output (the console by default)
    shell.write("Hello world!");

    // end the command
    context.end();
});

// 'echo' command
shell.command("echo", "Shows arguments and options", function (context) {
    // retrieve command arguments and options (parsed with minimist)
    var args = context.args;
    var opts = context.options;

    // show arguments
    shell.write(args, opts);

    // end the command
    context.end();
});

// 'ask' command
shell.command("ask", "Asks a question", function (context) {

    // ask a question and await answer
    shell.question("What's your name?", function (reply) {

        // show reply
        shell.write("Your name is:", reply);

        context.end();
    });
});

// 'passwd' command
shell.command("passwd", "Asks for a password without revealing its characters", function (context) {

    // aks for a password
    shell.password("Type a secret password:", function (password) {

        // ask whether to show the password
        shell.question("Type 'show' to display the password:", function (reply) {

            // show the password if needed
            if (reply === "show") shell.write("The password was:", password);

            context.end();
        });
    });
});

// 'quit' and 'exit' commands
shell.command(["quit", "exit"], "Exits the example", function (context) {
    shell.write("Ending...");
    shell.exit();
});

// override default 'command not supported' handler
shell.command("_", function (context) {
    context.fail("Command '" + context.command + "' not supported");
});

// display a welcome message
shell.write("Welcome to minish.");
shell.write("Type 'help' to see a list of available commands.");

// start prompting for commands
shell.prompt("> ");
```

Check out [minish TypeScript typings](https://github.com/lukaaash/minish/raw/master/typings/minish/minish.d.ts) for a quick overview of the rest of available API.


text:
-include ../common/rules.mk
-include ../../common/rules.mk

redpajama_set_name: RedPajamaGithub


text:
namespace Enterprise.BasicSamples {
    export interface OrdersByShipperResponse extends Serenity.ServiceResponse {
        Values?: { [key: string]: any }[];
        ShipperKeys?: string[];
        ShipperLabels?: string[];
    }
}


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


text:
<?php

namespace Steam\Command\UserStats;

use Steam\Command\CommandInterface;

class GetGlobalAchievementPercentagesForAppTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var GetGlobalAchievementPercentagesForApp
     */
    protected $instance;

    public function setUp()
    {
        $this->instance = new GetGlobalAchievementPercentagesForApp(123);
    }

    public function testImplementsInterface()
    {
        $this->assertTrue($this->instance instanceof CommandInterface);
    }

    public function testValues()
    {
        $this->assertEquals('ISteamUserStats', $this->instance->getInterface());
        $this->assertEquals('GetGlobalAchievementPercentagesForApp', $this->instance->getMethod());
        $this->assertEquals('v2', $this->instance->getVersion());
        $this->assertEquals('GET', $this->instance->getRequestMethod());
    }

    public function testParamValues()
    {
        $this->assertEquals([
            'gameid' => 123,
        ], $this->instance->getParams());
    }
}


text:
\hypertarget{classrocksdb_1_1UtilityDB}{}\section{rocksdb\+:\+:Utility\+DB Class Reference}
\label{classrocksdb_1_1UtilityDB}\index{rocksdb\+::\+Utility\+DB@{rocksdb\+::\+Utility\+DB}}
\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item
static \hyperlink{classrocksdb_1_1Status}{Status} {\bfseries Open\+Ttl\+DB} (const \hyperlink{structrocksdb_1_1Options}{Options} \&options, const std\+::string \&name, \hyperlink{classrocksdb_1_1StackableDB}{Stackable\+DB} $\ast$$\ast$dbptr, int32\+\_\+t ttl=0, bool read\+\_\+only=false)\hypertarget{classrocksdb_1_1UtilityDB_a368929b924620d34b634b1a53f5a730a}{}\label{classrocksdb_1_1UtilityDB_a368929b924620d34b634b1a53f5a730a}

\end{DoxyCompactItemize}

The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item
Appserver/src/external/rocksdb/utilities/utility\+\_\+db.\+h\end{DoxyCompactItemize}


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>Conditional Statements</title>
    <link href="../Style.css" rel="stylesheet">

Using objects

02. Remove elements

Write a function that removes all elements with a given value.

Attach it to the array type.

    You may see the result in the console :)


text:
@interface LoadMoreDemoTableViewController ()

@property (nonatomic, strong) MMLoadMoreDefaultView *loadMoreFooterView1;
@property (nonatomic, strong) NSArray *listData;
@end

@implementation LoadMoreDemoTableViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{

    if (self = [super initWithListType:MMListLoadMoreOnly]) {
        self.view.backgroundColor = [UIColor whiteColor];

        self.placeholderView = [[MMListEmptyDefaultView alloc] initWithFrame:CGRectZero];
        self.loadingView = [[MMLoadingDefaultView alloc] initWithFrame:CGRectZero];

        self.listData = @[@1, @2, @3, @4, @5, @6, @7, @8, @2, @3, @4, @45, @2, @2];
    }

    return self;
}

- (void)loadView
{
    [super loadView];

    self.loadMoreFooterView = self.loadMoreFooterView1;
    [self.view addSubview:self.tableView];
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.title = @"Load More";
}

#pragma mark -
#pragma mark Internal Methods

- (BOOL)empty
{
    return self.listData.count == 0;
}

- (IBAction)refreshData:(id)sender
{
    [self forceRefresh];
}

- (void)refresh
{
    [super refresh];

    [self performSelector:@selector(refreshCompleted)
               withObject:nil
               afterDelay:1.0];
    return;
}

- (void)refreshCompleted
{
    [super refreshCompletedWithAnimated:NO];

    self.tabBarController.navigationItem.rightBarButtonItem = [UIBarButtonItem exRefreshButtonItemWithTarget:self action:@selector(refreshData:)];
}

- (void)loadMore
{
    [super loadMore];

    self.allLoadFinished = YES;
    [self performSelector:@selector(loadMoreCompletedWithAnimated:)
               withObject:nil
               afterDelay:1.0];
    return;
}

#pragma mark -
#pragma mark - UITableViewDelegate

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.listData.count;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 60.f;
}

#pragma mark -
#pragma mark - UITableViewDataSrouce

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *kCellIdentifier = @"noticesCellIndentifier";
    //    NSString *kCellIdentifier = [NSString stringWithFormat:@"cell_%d", indexPath.row];
    UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:kCellIdentifier];

    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
                                      reuseIdentifier:kCellIdentifier];
        cell.accessoryType = UITableViewCellAccessoryNone;
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.textLabel.text = [NSString stringWithFormat:@"%d", indexPath.row];
    }

    return cell;
}

- (MMLoadMoreDefaultView *)loadMoreFooterView1
{
    if (!_loadMoreFooterView1) {
		_loadMoreFooterView1 = [[MMLoadMoreDefaultView alloc] init];
	}

    return _loadMoreFooterView1;
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end


text:
This repository is the code repository for the firmware running on the STM32
Nucleo L152RE development boards.  In STM32Hardware there are schematics and
design files for an expansion board that was made to expand the STM32 Nucleo
board with additional storage, wireless, and sensors.

Dustin


text:
layout: page
title: Moses Exquisite Trade Trade Fair
date: 2016-05-24
author: Larry Byrd
tags: weekly links, java
status: published
summary: Donec magna mi, cursus ut metus in, pharetra.
banner: images/banner/office-01.jpg
booking:
  startDate: 02/04/2016
  endDate: 02/05/2016
  ctyhocn: CAKMDHX
  groupCode: METTF
published: true
---
Nulla nec cursus ligula. Duis tincidunt diam vitae tempor pellentesque. Curabitur sollicitudin euismod dolor. Donec eget enim velit. Nulla vitae aliquam metus, et finibus odio. Ut laoreet enim sit amet tellus tempus convallis. Donec auctor tincidunt massa id tempor.

* Etiam id mi vehicula, sagittis est sed, facilisis tellus
* Duis convallis justo id nibh malesuada, non iaculis libero vulputate
* Sed scelerisque urna sit amet dolor egestas ultricies
* Proin nec ipsum euismod eros rhoncus fermentum
* Sed dictum mauris sit amet lectus lacinia volutpat.

Donec metus lorem, euismod nec elit id, feugiat luctus dolor. Cras ac rutrum nulla. Interdum et malesuada fames ac ante ipsum primis in faucibus. Nam finibus enim ut metus ultricies blandit. Curabitur aliquam vitae libero ut hendrerit. Nunc aliquam interdum ornare. Quisque ullamcorper justo non quam faucibus sagittis. Quisque sed erat et ante commodo pellentesque ut quis sem.


text:
<?php
/**
 * Abstract service implementation.
 * @package kenobi883\GoToMeeting\Services
 */

namespace kenobi883\GoToMeeting\Services;

/**
 * Abstract service implementation. Additional services should extend this class.
 *
 * @package kenobi883\GoToMeeting\Services
 */
class AbstractService
{
    /**
     * @var string root URL for authorizing requests
     */
    protected $endpoint = '';

    /**
     * @var \kenobi883\GoToMeeting\Client
     */
    protected $client;

    /**
     * Default constructor.
     *
     * @param \kenobi883\GoToMeeting\Client $client
     */
    public function __construct($client)
    {
        $this->client = $client;
    }

}


text:
define([
    './rb-section.tpl.html'
], function (template) {

    /**
     * @ngdoc directive
     * @name rbSection
     * @module rb-section
     *
     * @restrict E
     *
     * @description
     *
     * @usage
     * <hljs lang="html">
     *    <rb-section>
     *     </rb-section>
     * </hljs>
     *
     * @ngInject
     */
    function rbSectionDirective () {

        return {
            scope: {
                heading: '@',
                gutterless: '@',
                hideHeading: '@'
            },
            restrict: 'E',
            replace: true,
            transclude: true,
            template: template,
            link: function (scope, ele, attrs) {
                // Default centered to false
                scope.centered = 'false';

                if (angular.isDefined(attrs['centered'])) {
                    scope.centered = attrs['centered'];
                }
            }
        };
    }

    return rbSectionDirective;
});


text:
package com.javarush.test.level19.lesson03.task02;

import java.io.IOException;

interface AmigoStringWriter {

  void flush() throws IOException;

  void writeString(String s) throws IOException;

  void close() throws IOException;
}


text:
require File.dirname(__FILE__) + '/../test_helper'

class ResortTest < ActiveSupport::TestCase
  include Birdstack::Resort

  def test_insert_first
    insert_first(Order.find_by_latin_name('blah3'))
    gen_sort_orders
    assert_equal 1, Order.find_by_latin_name('blah3').sort_order
    assert_equal 2, Order.find_by_latin_name('blah').sort_order
    assert_equal 3, Order.find_by_latin_name('blah2').sort_order
  end

  # Verifies that the new family will be inserted very first
  # because this family belongs to the first order
  def test_insert_first_family_in_first_order
    f = Family.new
    f.latin_name = 'blah2'
    f.english_name = 'blah2'
    f.order = Order.find_by_latin_name('blah')
    insert_first(f)
    gen_sort_orders
    assert_equal 1, Family.find_by_latin_name('blah2').sort_order
    assert_equal 2, Family.find_by_latin_name('blah').sort_order
  end

  # This test verifies that the code will be able to correctly
  # identify that this new family should be sorted after the family
  # in the first order
  def test_insert_first_family_in_second_order
    f = Family.new
    f.latin_name = 'blah2'
    f.english_name = 'blah2'
    f.order = Order.find_by_latin_name('blah2')
    insert_first(f)
    gen_sort_orders
    assert_equal 1, Family.find_by_latin_name('blah').sort_order
    assert_equal 2, Family.find_by_latin_name('blah2').sort_order
  end

  # And this verifies that it can find that first family, even when
  # there's an empty family in between
  def test_insert_first_family_in_third_order
    f = Family.new
    f.latin_name = 'blah2'
    f.english_name = 'blah2'
    f.order = Order.find_by_latin_name('blah3')
    insert_first(f)
    gen_sort_orders
    assert_equal 1, Family.find_by_latin_name('blah').sort_order
    assert_equal 2, Family.find_by_latin_name('blah2').sort_order
  end

  def test_move_family_from_first_to_another_first
    # Insert family in 3rd order
    f = Family.new
    f.latin_name = 'blah2'
    f.english_name = 'blah2'
    f.order = Order.find_by_latin_name('blah3')
    insert_first(f)
    # Now move to first position in first order
    f.order = Order.find_by_latin_name('blah')
    insert_first(f)
    gen_sort_orders
    assert_equal 1, Family.find_by_latin_name('blah2').sort_order
    assert_equal 2, Family.find_by_latin_name('blah').sort_order
  end

  def test_move_family_from_middle_to_another_middle
    # Insert family in 1st order so there are now 2
    f = Family.new
    f.latin_name = 'blah2'
    f.english_name = 'blah2'
    f.order = Order.find_by_latin_name('blah')
    insert_after(Family.find_by_latin_name('blah'), f)

    # Insert families in 2nd order so there are now 3
    f = Family.new
    f.latin_name = 'blah3'
    f.english_name = 'blah3'
    f.order = Order.find_by_latin_name('blah2')
    insert_first(f)
    f = Family.new
    f.latin_name = 'blah5'
    f.english_name = 'blah5'
    f.order = Order.find_by_latin_name('blah2')
    insert_after(Family.find_by_latin_name('blah3'), f)
    f = Family.new
    f.latin_name = 'blah4'
    f.english_name = 'blah4'
    f.order = Order.find_by_latin_name('blah2')
    insert_after(Family.find_by_latin_name('blah3'), f)

    # Now move to middle position in first order
    f.order = Order.find_by_latin_name('blah')
    insert_after(Family.find_by_latin_name('blah'), f)
    gen_sort_orders
    assert_equal 1, Family.find_by_latin_name('blah').sort_order
    assert_equal 2, Family.find_by_latin_name('blah4').sort_order
    assert_equal 3, Family.find_by_latin_name('blah2').sort_order
    assert_equal 4, Family.find_by_latin_name('blah3').sort_order
    assert_equal 5, Family.find_by_latin_name('blah5').sort_order
  end

  def test_move_family_after_other_family_in_other_order
    f = Family.new
    f.latin_name = 'blah2'
    f.english_name = 'blah2'
    f.order = Order.find_by_latin_name('blah3')
    insert_first(f)
    # Can't have this one sorted after a family in another order
    assert_raise RuntimeError do
      insert_after(Family.find_by_latin_name('blah'), f)
    end
  end

  def test_move_bottom_up_one
    insert_after(Order.find_by_latin_name('blah'), Order.find_by_latin_name('blah3'))
    gen_sort_orders
    assert_equal 1, Order.find_by_latin_name('blah').sort_order
    assert_equal 2, Order.find_by_latin_name('blah3').sort_order
    assert_equal 3, Order.find_by_latin_name('blah2').sort_order
  end

  def test_move_first_to_last
    insert_after(Order.find_by_latin_name('blah3'), Order.find_by_latin_name('blah'))
    gen_sort_orders
    assert_equal 1, Order.find_by_latin_name('blah2').sort_order
    assert_equal 2, Order.find_by_latin_name('blah3').sort_order
    assert_equal 3, Order.find_by_latin_name('blah').sort_order
  end

  def test_move_first_to_last_last_to_first
    insert_first(Order.find_by_latin_name('blah3'))
    insert_after(Order.find_by_latin_name('blah2'), Order.find_by_latin_name('blah'))
    gen_sort_orders
    assert_equal 1, Order.find_by_latin_name('blah3').sort_order
    assert_equal 2, Order.find_by_latin_name('blah2').sort_order
    assert_equal 3, Order.find_by_latin_name('blah').sort_order
  end

  def test_insert_same_position
    insert_after(Order.find_by_latin_name('blah2'), Order.find_by_latin_name('blah3'))
    gen_sort_orders
    assert_equal 1, Order.find_by_latin_name('blah').sort_order
    assert_equal 2, Order.find_by_latin_name('blah2').sort_order
    assert_equal 3, Order.find_by_latin_name('blah3').sort_order
  end

  def test_insert_own_position
    insert_after(Order.find_by_latin_name('blah2'), Order.find_by_latin_name('blah2'))
    gen_sort_orders
    assert_equal 1, Order.find_by_latin_name('blah').sort_order
    assert_equal 2, Order.find_by_latin_name('blah2').sort_order
    assert_equal 3, Order.find_by_latin_name('blah3').sort_order
  end

  def test_insert_same_position_middle
    insert_after(Order.find_by_latin_name('blah'), Order.find_by_latin_name('blah2'))
    gen_sort_orders
    assert_equal 1, Order.find_by_latin_name('blah').sort_order
    assert_equal 2, Order.find_by_latin_name('blah2').sort_order
    assert_equal 3, Order.find_by_latin_name('blah3').sort_order
  end

  def test_insert_new_order_first
    o = Order.new
    o.latin_name = 'blah4'
    insert_first(o)
    gen_sort_orders
    assert_equal 1, Order.find_by_latin_name('blah4').sort_order
    assert_equal 2, Order.find_by_latin_name('blah').sort_order
    assert_equal 3, Order.find_by_latin_name('blah2').sort_order
    assert_equal 4, Order.find_by_latin_name('blah3').sort_order
  end

  def test_insert_new_order_middle
    o = Order.new
    o.latin_name = 'blah4'
    insert_after(Order.find_by_latin_name('blah2'), o)
    gen_sort_orders
    assert_equal 1, Order.find_by_latin_name('blah').sort_order
    assert_equal 2, Order.find_by_latin_name('blah2').sort_order
    assert_equal 3, Order.find_by_latin_name('blah4').sort_order
    assert_equal 4, Order.find_by_latin_name('blah3').sort_order
  end

  def test_insert_new_order_middle_then_move_first_after
    o = Order.new
    o.latin_name = 'blah4'
    insert_after(Order.find_by_latin_name('blah2'), o)
    insert_after(Order.find_by_latin_name('blah4'), Order.find_by_latin_name('blah'))
    gen_sort_orders
    assert_equal 1, Order.find_by_latin_name('blah2').sort_order
    assert_equal 2, Order.find_by_latin_name('blah4').sort_order
    assert_equal 3, Order.find_by_latin_name('blah').sort_order
    assert_equal 4, Order.find_by_latin_name('blah3').sort_order
  end

  def test_insert_new_order_last
    o = Order.new
    o.latin_name = 'blah4'
    insert_after(Order.find_by_latin_name('blah3'), o)
    gen_sort_orders
    assert_equal 1, Order.find_by_latin_name('blah').sort_order
    assert_equal 2, Order.find_by_latin_name('blah2').sort_order
    assert_equal 3, Order.find_by_latin_name('blah3').sort_order
    assert_equal 4, Order.find_by_latin_name('blah4').sort_order
  end

  def test_delete_first_order
    # Have to create a new first one because our real first one is used elsewhere
    # Stupid fixtures...
    o = Order.new
    o.latin_name = 'blah4'
    insert_first(o)
    gen_sort_orders
    assert_equal 1, Order.find_by_latin_name('blah4').sort_order
    assert_equal 2, Order.find_by_latin_name('blah').sort_order
    assert_equal 3, Order.find_by_latin_name('blah2').sort_order
    assert_equal 4, Order.find_by_latin_name('blah3').sort_order

    Order.find_by_latin_name('blah4').destroy
    gen_sort_orders
    assert_equal 1, Order.find_by_latin_name('blah').sort_order
    assert_equal 2, Order.find_by_latin_name('blah2').sort_order
    assert_equal 3, Order.find_by_latin_name('blah3').sort_order
  end

  def test_delete_middle_order
    Order.find_by_latin_name('blah2').destroy
    gen_sort_orders
    assert_equal 1, Order.find_by_latin_name('blah').sort_order
    assert_equal 2, Order.find_by_latin_name('blah3').sort_order
  end

  def test_delete_last_order
    Order.find_by_latin_name('blah3').destroy
    gen_sort_orders
    assert_equal 1, Order.find_by_latin_name('blah').sort_order
    assert_equal 2, Order.find_by_latin_name('blah2').sort_order
  end
end


text:
@interface OXmlWriter : NSObject

@property(strong,nonatomic,readonly)OXmlContext *context;
@property(strong,nonatomic,readonly)OXmlMapper *mapper;
@property(strong,nonatomic,readwrite)OXmlPrinter *printer;
@property(strong,nonatomic,readwrite)NSString *xmlHeader;
@property(strong,nonatomic,readwrite)NSString *schemaLocation;
@property(strong,nonatomic,readwrite)NSDictionary *rootNodeAttributes;
@property(strong,nonatomic,readonly) NSArray *errors;

#pragma mark - writer
- (NSString *)writeXml:(id)object;
- (NSString *)writeXml:(id)object prettyPrint:(BOOL)prettyPrint;

#pragma mark - constructors
+ (id)writerWithMapper:(OXmlMapper *)mapper;
+ (id)writerWithMapper:(OXmlMapper *)mapper context:(OXmlContext *)context;

#pragma mark - builder
- (OXmlWriter *)rootAttributes:(NSDictionary *)attributes;

@end

//
//  Copyright (c) 2013 Outsource Cafe, Inc. All rights reserved.
//
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
//


text:
using System;
using System.Collections.Generic;

namespace SeptaBus.Decorators
{
    public static class HeadersExtensions
    {
        public static string By(this IHasHeaders message)
        {
            return message.GetHeader<string>("By");
        }

        public static T By<T>(this T message, string value) where T : IHasHeaders
        {
            return message.SetHeader<T>("By", value);
        }

        public static DateTime On(this IHasHeaders message)
        {
            return message.GetHeader<DateTime>("On");
        }

        public static T On<T>(this T message, DateTime value) where T : IHasHeaders
        {
            return message.SetHeader<T>("On", value);
        }

        public static IEnumerable<string> Roles(this IHasHeaders message)
        {
            return message.GetHeader<IEnumerable<string>>("Roles");
        }

        public static T Roles<T>(this T message, IEnumerable<string> roles) where T : IHasHeaders
        {
            return message.SetHeader<T>("Roles", roles);
        }

        private static T GetHeader<T>(this IHasHeaders message, string key)
        {
            return (T)message.GetHeader(key);
        }

        private static T SetHeader<T>(this T message, string key, object value) where T : IHasHeaders
        {
            message.SetHeader(key, value);
            return message;
        }
    }
}


text:
package org.frameworkset.web.multipart;

import javax.servlet.http.HttpServletRequest;

import org.frameworkset.web.multipart.commons.CommonsMultipartResolver;

public interface MultipartResolver {
	public static final String mimetype_application_octet_stream = "application/octet-stream";

	/**
	 * Determine if the given request contains multipart content.
	 * <p>Will typically check for content type "multipart/form-data", but the actually
	 * accepted requests might depend on the capabilities of the resolver implementation.
	 * @param request the servlet request to be evaluated
	 * @return whether the request contains multipart content
	 */
	boolean isMultipart(HttpServletRequest request);

	/**
	 * Parse the given HTTP request into multipart files and parameters,
	 * and wrap the request inside a
	 * {@link MultipartHttpServletRequest} object
	 * that provides access to file descriptors and makes contained
	 * parameters accessible via the standard ServletRequest methods.
	 * @param request the servlet request to wrap (must be of a multipart content type)
	 * @return the wrapped servlet request
	 * @throws MultipartException if the servlet request is not multipart, or if
	 * implementation-specific problems are encountered (such as exceeding file size limits)
	 * @see MultipartHttpServletRequest#getFile
	 * @see MultipartHttpServletRequest#getFileNames
	 * @see MultipartHttpServletRequest#getFileMap
	 * @see javax.servlet.http.HttpServletRequest#getParameter
	 * @see javax.servlet.http.HttpServletRequest#getParameterNames
	 * @see javax.servlet.http.HttpServletRequest#getParameterMap
	 */
	MultipartHttpServletRequest resolveMultipart(HttpServletRequest request) throws MultipartException;

	/**
	 * Cleanup any resources used for the multipart handling,
	 * like a storage for the uploaded files.
	 * @param request the request to cleanup resources for
	 */
	void cleanupMultipart(MultipartHttpServletRequest request);

}


text:
require "simpleanagram/version"
require "simpleanagram/word"
module Simpleanagram
  # Your code goes here...
end


text:
<?php

final class PhabricatorSubscriptionsEditEngineExtension
  extends PhabricatorEditEngineExtension {

  const EXTENSIONKEY = 'subscriptions.subscribers';

  public function getExtensionPriority() {
    return 750;
  }

  public function isExtensionEnabled() {
    return true;
  }

  public function getExtensionName() {
    return pht('Subscriptions');
  }

  public function supportsObject(
    PhabricatorEditEngine $engine,
    PhabricatorApplicationTransactionInterface $object) {
    return ($object instanceof PhabricatorSubscribableInterface);
  }

  public function buildCustomEditFields(
    PhabricatorEditEngine $engine,
    PhabricatorApplicationTransactionInterface $object) {

    $subscribers_type = PhabricatorTransactions::TYPE_SUBSCRIBERS;

    $object_phid = $object->getPHID();
    if ($object_phid) {
      $sub_phids = PhabricatorSubscribersQuery::loadSubscribersForPHID(
        $object_phid);
    } else {
      $sub_phids = array();
    }

    $subscribers_field = id(new PhabricatorSubscribersEditField())
      ->setKey('subscriberPHIDs')
      ->setLabel(pht('Subscribers'))
      ->setEditTypeKey('subscribers')
      ->setAliases(array('subscriber', 'subscribers'))
      ->setIsCopyable(true)
      ->setUseEdgeTransactions(true)
      ->setCommentActionLabel(pht('Change Subscribers'))
      ->setDescription(pht('Choose subscribers.'))
      ->setTransactionType($subscribers_type)
      ->setValue($sub_phids);

    $subscribers_field->setViewer($engine->getViewer());

    $edit_add = $subscribers_field->getConduitEditType('subscribers.add')
      ->setConduitDescription(pht('Add subscribers.'));

    $edit_set = $subscribers_field->getConduitEditType('subscribers.set')
      ->setConduitDescription(
        pht('Set subscribers, overwriting current value.'));

    $edit_rem = $subscribers_field->getConduitEditType('subscribers.remove')
      ->setConduitDescription(pht('Remove subscribers.'));

    return array(
      $subscribers_field,
    );
  }

}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>cr-parser</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="Libcroco Reference Manual">
<link rel="up" href="ch01.html" title="Extensive APIs description">
<link rel="prev" href="libcroco-cr-om-parser.html" title="cr-om-parser">
<link rel="next" href="libcroco-cr-parsing-location.html" title="cr-parsing-location">
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">

Libcroco Reference Manual

Top
                   |
                  Description

cr-parser

cr-parser

Synopsis

struct              CRParser;
                    CRParserPriv;
void                cr_parser_destroy                   (CRParser *a_this);
enum CRStatus       cr_parser_get_parsing_location      (CRParser const *a_this,
                                                         CRParsingLocation *a_loc);
enum CRStatus       cr_parser_get_sac_handler           (CRParser *a_this,
                                                         CRDocHandler **a_handler);
enum CRStatus       cr_parser_get_tknzr                 (CRParser *a_this,
                                                         CRTknzr **a_tknzr);
enum CRStatus       cr_parser_get_use_core_grammar      (CRParser const *a_this,
                                                         gboolean *a_use_core_grammar);
CRParser *          cr_parser_new                       (CRTknzr *a_tknzr);
CRParser *          cr_parser_new_from_buf              (guchar *a_buf,
                                                         gulong a_len,
                                                         enum CREncoding a_enc,
                                                         gboolean a_free_buf);
CRParser *          cr_parser_new_from_file             (const guchar *a_file_uri,
                                                         enum CREncoding a_enc);
CRParser *          cr_parser_new_from_input            (CRInput *a_input);
enum CRStatus       cr_parser_parse                     (CRParser *a_this);
enum CRStatus       cr_parser_parse_buf                 (CRParser *a_this,
                                                         const guchar *a_buf,
                                                         gulong a_len,
                                                         enum CREncoding a_enc);
enum CRStatus       cr_parser_parse_charset             (CRParser *a_this,
                                                         CRString **a_value,
                                                         CRParsingLocation *a_charset_sym_location);
enum CRStatus       cr_parser_parse_declaration         (CRParser *a_this,
                                                         CRString **a_property,
                                                         CRTerm **a_expr,
                                                         gboolean *a_important);
enum CRStatus       cr_parser_parse_expr                (CRParser *a_this,
                                                         CRTerm **a_expr);
enum CRStatus       cr_parser_parse_file                (CRParser *a_this,
                                                         const guchar *a_file_uri,
                                                         enum CREncoding a_enc);
enum CRStatus       cr_parser_parse_font_face           (CRParser *a_this);
enum CRStatus       cr_parser_parse_import              (CRParser *a_this,
                                                         GList **a_media_list,
                                                         CRString **a_import_string,
                                                         CRParsingLocation *a_location);
enum CRStatus       cr_parser_parse_media               (CRParser *a_this);
enum CRStatus       cr_parser_parse_page                (CRParser *a_this);
enum CRStatus       cr_parser_parse_prio                (CRParser *a_this,
                                                         CRString **a_prio);
enum CRStatus       cr_parser_parse_ruleset             (CRParser *a_this);
enum CRStatus       cr_parser_parse_statement_core      (CRParser *a_this);
enum CRStatus       cr_parser_parse_term                (CRParser *a_this,
                                                         CRTerm **a_term);
enum CRStatus       cr_parser_set_default_sac_handler   (CRParser *a_this);
enum CRStatus       cr_parser_set_sac_handler           (CRParser *a_this,
                                                         CRDocHandler *a_handler);
enum CRStatus       cr_parser_set_tknzr                 (CRParser *a_this,
                                                         CRTknzr *a_tknzr);
enum CRStatus       cr_parser_set_use_core_grammar      (CRParser *a_this,
                                                         gboolean a_use_core_grammar);
enum CRStatus       cr_parser_try_to_skip_spaces_and_comments
                                                        (CRParser *a_this);

Description

Details

struct CRParser

struct CRParser {
        CRParserPriv *priv ;
};

CRParserPriv

typedef struct _CRParserPriv CRParserPriv;

cr_parser_destroy ()

void                cr_parser_destroy                   (CRParser *a_this);

Destroys the current instance
of CRParser.

<col align="left" valign="top">

a_this :

the current instance of CRParser to
destroy.

cr_parser_get_parsing_location ()

enum CRStatus       cr_parser_get_parsing_location      (CRParser const *a_this,
                                                         CRParsingLocation *a_loc);

Gets the current parsing location.

<col align="left" valign="top">

a_this :

the current instance of CRParser

a_loc :

the parsing location to get.

Returns :

CR_OK upon succesful completion, an error code
otherwise.

cr_parser_get_sac_handler ()

enum CRStatus       cr_parser_get_sac_handler           (CRParser *a_this,
                                                         CRDocHandler **a_handler);

Gets the SAC document handler.

<col align="left" valign="top">

a_this :

the "this pointer" of the current instance of
CRParser.

a_handler :

out parameter. The returned handler.

Returns :

CR_OK upon successfull completion, an error code
otherwise.

cr_parser_get_tknzr ()

enum CRStatus       cr_parser_get_tknzr                 (CRParser *a_this,
                                                         CRTknzr **a_tknzr);

Getter of the parser's underlying tokenizer

<col align="left" valign="top">

a_this :

the current instance of CRParser

a_tknzr :

out parameter. The returned tokenizer

Returns :

CR_OK upon succesful completion, an error code
otherwise

cr_parser_get_use_core_grammar ()

enum CRStatus       cr_parser_get_use_core_grammar      (CRParser const *a_this,
                                                         gboolean *a_use_core_grammar);

<col align="left" valign="top">

a_this :

the current instance of CRParser.

a_use_core_grammar :

wether to use the core grammar or not.

Returns :

CR_OK upon succesful completion, an error code otherwise.

cr_parser_new ()

CRParser *          cr_parser_new                       (CRTknzr *a_tknzr);

Creates a new parser to parse data
coming the input stream given in parameter.

<col align="left" valign="top">

a_tknzr :

the tokenizer to use for the parsing.

Returns :

the newly created instance of CRParser,
or NULL if an error occured.

cr_parser_new_from_buf ()

CRParser *          cr_parser_new_from_buf              (guchar *a_buf,
                                                         gulong a_len,
                                                         enum CREncoding a_enc,
                                                         gboolean a_free_buf);

Instanciates a new parser from a memory buffer.

<col align="left" valign="top">

a_buf :

the buffer to parse.

a_len :

the length of the data in the buffer.

a_enc :

the encoding of the input buffer a_buf.

a_free_buf :

if set to TRUE, a_buf will be freed
during the destruction of the newly built instance
of CRParser. If set to FALSE, it is up to the caller to
eventually free it.

Returns :

the newly built parser, or NULL if an error arises.

cr_parser_new_from_file ()

CRParser *          cr_parser_new_from_file             (const guchar *a_file_uri,
                                                         enum CREncoding a_enc);

<col align="left" valign="top">

a_file_uri :

the uri of the file to parse.

a_enc :

the file encoding to use.

Returns :

the newly built parser.

cr_parser_new_from_input ()

CRParser *          cr_parser_new_from_input            (CRInput *a_input);

<col align="left" valign="top">

a_input :

the parser input stream to use.

Returns :

a newly built parser input.

cr_parser_parse ()

enum CRStatus       cr_parser_parse                     (CRParser *a_this);

Parses the data that comes from the
input previously associated to the current instance of
CRParser.

<col align="left" valign="top">

a_this :

the current instance of CRParser.

Returns :

CR_OK upon succesful completion, an error code otherwise.

cr_parser_parse_buf ()

enum CRStatus       cr_parser_parse_buf                 (CRParser *a_this,
                                                         const guchar *a_buf,
                                                         gulong a_len,
                                                         enum CREncoding a_enc);

Parses a stylesheet from a buffer

<col align="left" valign="top">

a_this :

the current instance of CRparser

a_buf :

the input buffer

a_len :

the length of the input buffer

a_enc :

the encoding of the buffer

Returns :

CR_OK upon successful completion, an error code otherwise.

cr_parser_parse_charset ()

enum CRStatus       cr_parser_parse_charset             (CRParser *a_this,
                                                         CRString **a_value,
                                                         CRParsingLocation *a_charset_sym_location);

Parses a charset declaration as defined implictly by the css2 spec in
appendix D.1:
charset ::= CHARSET_SYM S* STRING S* ';'

<col align="left" valign="top">

a_this :

the "this pointer" of the current instance of CRParser.

a_value :

out parameter. The actual parsed value of the charset
declararation. Note that for safety check reasons, *a_value must be
set to NULL.

a_charset_sym_location :

the parsing location of the charset rule

Returns :

CR_OK upon successfull completion, an error code otherwise.

cr_parser_parse_declaration ()

enum CRStatus       cr_parser_parse_declaration         (CRParser *a_this,
                                                         CRString **a_property,
                                                         CRTerm **a_expr,
                                                         gboolean *a_important);

TODO: return the parsed priority, so that
upper layers can take benefit from it.
Parses a "declaration" as defined by the css2 spec in appendix D.1:
declaration ::= [property ':' S* expr prio?]?

<col align="left" valign="top">

a_this :

the "this pointer" of the current instance of CRParser.

a_property :

the successfully parsed property. The caller
*must* free the returned pointer.

a_expr :

the expression that represents the attribute value.
The caller *must* free the returned pointer.

Returns :

CR_OK upon successfull completion, an error code otherwise.

cr_parser_parse_expr ()

enum CRStatus       cr_parser_parse_expr                (CRParser *a_this,
                                                         CRTerm **a_expr);

Parses an expression as defined by the css2 spec in appendix
D.1:
expr: term [ operator term ]*

<col align="left" valign="top">

a_this :

the current instance of CRParser.

a_expr :

out parameter. the parsed expression.

Returns :

CR_OK upon successful completion, an error code otherwise.

cr_parser_parse_file ()

enum CRStatus       cr_parser_parse_file                (CRParser *a_this,
                                                         const guchar *a_file_uri,
                                                         enum CREncoding a_enc);

Parses a the given in parameter.

<col align="left" valign="top">

a_this :

a pointer to the current instance of CRParser.

a_file_uri :

the uri to the file to load. For the time being,

a_enc :

the encoding of the file to parse.
only local files are supported.

Returns :

CR_OK upon successfull completion, an error code otherwise.

cr_parser_parse_font_face ()

enum CRStatus       cr_parser_parse_font_face           (CRParser *a_this);

Parses the "@font-face" rule specified in the css1 spec in
appendix D.1:

font_face ::= FONT_FACE_SYM S*
'{' S* declaration [ ';' S* declaration ]* '}' S*

This function will call SAC handlers whenever it is necessary.

<col align="left" valign="top">

a_this :

the current instance of CRParser.

Returns :

CR_OK upon successfull completion, an error code otherwise.

cr_parser_parse_import ()

enum CRStatus       cr_parser_parse_import              (CRParser *a_this,
                                                         GList **a_media_list,
                                                         CRString **a_import_string,
                                                         CRParsingLocation *a_location);

Parses an 'import' declaration as defined in the css2 spec
in appendix D.1:

import ::=
@import [STRING|URI] S* [ medium [ ',' S* medium]* ]? ';' S*

<col align="left" valign="top">

a_this :

the "this pointer" of the current instance
of CRParser.

a_media_list :

out parameter. A linked list of
CRString
Each CRString is a string that contains
a 'medium' declaration part of the successfully
parsed 'import' declaration.

a_import_string :

out parameter.
A string that contains the 'import
string". The import string can be either an uri (if it starts with
the substring "uri(") or a any other css2 string. Note that
*a_import_string must be initially set to NULL or else, this function
will return CR_BAD_PARAM_ERROR.

a_location :

the location (line, column) where the import has been parsed

Returns :

CR_OK upon sucessfull completion, an error code otherwise.

cr_parser_parse_media ()

enum CRStatus       cr_parser_parse_media               (CRParser *a_this);

Parses a 'media' declaration as specified in the css2 spec at
appendix D.1:

media ::= @media S* medium [ ',' S* medium ]* '{' S* ruleset* '}' S*

Note that this function calls the required sac handlers during the parsing
to notify media productions. See CRDocHandler to know the callback called
during @media parsing.

<col align="left" valign="top">

a_this :

the "this pointer" of the current instance of CRParser.

Returns :

CR_OK upon successfull completion, an error code otherwise.

cr_parser_parse_page ()

enum CRStatus       cr_parser_parse_page                (CRParser *a_this);

Parses '@page' rule as specified in the css2 spec in appendix D.1:
page ::= PAGE_SYM S* IDENT? pseudo_page? S*
'{' S* declaration [ ';' S* declaration ]* '}' S*

This function also calls the relevant SAC handlers whenever it
encounters a construction that must
be reported to the calling application.

<col align="left" valign="top">

a_this :

the "this pointer" of the current instance of CRParser.

Returns :

CR_OK upon successfull completion, an error code otherwise.

cr_parser_parse_prio ()

enum CRStatus       cr_parser_parse_prio                (CRParser *a_this,
                                                         CRString **a_prio);

Parses a declaration priority as defined by
the css2 grammar in appendix C:
prio: IMPORTANT_SYM S*

<col align="left" valign="top">

a_this :

the current instance of CRParser.

a_prio :

a string representing the priority.
Today, only "!important" is returned as only this
priority is defined by css2.

Returns :

CR_OK upon successful completion, an error code otherwise.

cr_parser_parse_ruleset ()

enum CRStatus       cr_parser_parse_ruleset             (CRParser *a_this);

Parses a "ruleset" as defined in the css2 spec at appendix D.1.
ruleset ::= selector [ ',' S* selector ]*
'{' S* declaration? [ ';' S* declaration? ]* '}' S*;

This methods calls the the SAC handler on the relevant SAC handler
callbacks whenever it encounters some specific constructions.
See the documentation of CRDocHandler (the SAC handler) to know
when which SAC handler is called.

<col align="left" valign="top">

a_this :

the "this pointer" of the current instance of CRParser.

Returns :

CR_OK upon successfull completion, an error code otherwise.

cr_parser_parse_statement_core ()

enum CRStatus       cr_parser_parse_statement_core      (CRParser *a_this);

Parses a statement as defined by the css core grammar in
chapter 4.1 of the css2 spec.
statement   : ruleset | at-rule;

<col align="left" valign="top">

a_this :

the current instance of CRParser.

Returns :

CR_OK upon successfull completion, an error code otherwise.

cr_parser_parse_term ()

enum CRStatus       cr_parser_parse_term                (CRParser *a_this,
                                                         CRTerm **a_term);

Parses a "term" as defined in the css2 spec, appendix D.1:
term ::= unary_operator? [NUMBER S* | PERCENTAGE S* | LENGTH S* |
EMS S* | EXS S* | ANGLE S* | TIME S* | FREQ S* | function ] |
STRING S* | IDENT S* | URI S* | RGB S* | UNICODERANGE S* | hexcolor

TODO: handle parsing of 'RGB'

<col align="left" valign="top">

a_term :

out parameter. The successfully parsed term.

Returns :

CR_OK upon successfull completion, an error code otherwise.

cr_parser_set_default_sac_handler ()

enum CRStatus       cr_parser_set_default_sac_handler   (CRParser *a_this);

Sets the SAC handler associated to the current instance
of CRParser to the default SAC handler.

<col align="left" valign="top">

a_this :

a pointer to the current instance of CRParser.

Returns :

CR_OK upon successfull completion, an error code otherwise.

cr_parser_set_sac_handler ()

enum CRStatus       cr_parser_set_sac_handler           (CRParser *a_this,
                                                         CRDocHandler *a_handler);

Sets a SAC document handler to the parser.

<col align="left" valign="top">

a_this :

the "this pointer" of the current instance of CRParser.

a_handler :

the handler to set.

Returns :

CR_OK upon successfull completion, an error code otherwise.

cr_parser_set_tknzr ()

enum CRStatus       cr_parser_set_tknzr                 (CRParser *a_this,
                                                         CRTknzr *a_tknzr);

<col align="left" valign="top">

a_this :

the current instance of CRParser;

a_tknzr :

the new tokenizer.

Returns :

CR_OK upon successful completion, an error code otherwise.

cr_parser_set_use_core_grammar ()

enum CRStatus       cr_parser_set_use_core_grammar      (CRParser *a_this,
                                                         gboolean a_use_core_grammar);

<col align="left" valign="top">

a_this :

the current instance of CRParser.

a_use_core_grammar :

where to parse against the css core grammar.

Returns :

CR_OK upon succesful completion, an error code otherwise.

cr_parser_try_to_skip_spaces_and_comments ()

enum CRStatus       cr_parser_try_to_skip_spaces_and_comments
                                                        (CRParser *a_this);

Same as cr_parser_try_to_skip_spaces() but this one skips
spaces and comments.

<col align="left" valign="top">

a_this :

the current instance of CRParser.

Returns :

CR_OK upon successfull completion, an error code otherwise.

          Generated by GTK-Doc V1.18


text:
#include "MCData.h"

#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <unicode/ucsdet.h>
#include <libetpan/libetpan.h>
#include <iconv.h>
#if __APPLE__
#include <CoreFoundation/CoreFoundation.h>
#endif

#include "MCString.h"
#include "MCHash.h"
#include "MCUtils.h"
#include "MCHashMap.h"
#include "MCBase64.h"
#include "MCSet.h"

#define DEFAULT_CHARSET "iso-8859-1"

using namespace mailcore;

void Data::allocate(unsigned int length)
{
    length ++;
    if (length < mAllocated)
        return;

    if (mAllocated == 0) {
        mAllocated = 4;
    }
    while (length > mAllocated) {
        mAllocated *= 2;
    }

    mBytes = (char *) realloc(mBytes, mAllocated);
}

void Data::reset()
{
    free(mBytes);
    mAllocated = 0;
    mLength = 0;
    mBytes = NULL;
}

Data::Data()
{
    mBytes = NULL;
    reset();
}

Data::Data(Data * otherData) : Object()
{
    mBytes = NULL;
    reset();
    appendData(otherData);
}

Data::Data(const char * bytes, unsigned int length)
{
    mBytes = NULL;
    reset();
    appendBytes(bytes, length);
}

Data::Data(int capacity)
{
    mBytes = NULL;
    reset();
    allocate(capacity);
}

Data::~Data()
{
    reset();
}

Data * Data::dataWithBytes(const char * bytes, unsigned int length)
{
    Data * result = new Data(bytes, length);
    return (Data *) result->autorelease();
}

char * Data::bytes()
{
    return mBytes;
}

unsigned int Data::length()
{
    return mLength;
}

void Data::appendData(Data * otherData)
{
    appendBytes(otherData->bytes(), otherData->length());
}

void Data::appendBytes(const char * bytes, unsigned int length)
{
    allocate(mLength + length);
    memcpy(&mBytes[mLength], bytes, length);
    mLength += length;
}

void Data::setBytes(const char * bytes, unsigned int length)
{
    reset();
    appendBytes(bytes, length);
}

void Data::setData(Data * otherData)
{
    reset();
    appendData(otherData);
}

String * Data::description()
{
    return String::stringWithUTF8Format("<%s:%p %i bytes>", MCUTF8(className()), this, length());
}

Object * Data::copy()
{
    return new Data(this);
}

bool Data::isEqual(Object * otherObject)
{
    Data * otherData = (Data *) otherObject;
    if (length() != otherData->length())
        return false;
    if (memcmp(bytes(), otherData->bytes(), mLength) != 0)
        return false;
    return true;
}

unsigned int Data::hash()
{
    return hashCompute(mBytes, mLength);
}

String * Data::stringWithDetectedCharset()
{
    String * result;
    result = stringWithDetectedCharset(NULL, false);
    return result;
}

static String * normalizeCharset(String * charset)
{
    if ((charset->caseInsensitiveCompare(MCSTR("iso-2022-jp")) == 0) ||
    (charset->caseInsensitiveCompare(MCSTR("iso-2022-jp-2")) == 0)) {
        charset = MCSTR("iso-2022-jp-2");
    }
    else if (charset->caseInsensitiveCompare(MCSTR("ks_c_5601-1987")) == 0) {
        charset = MCSTR("euckr");
    }
    else if ((charset->caseInsensitiveCompare(MCSTR("iso-8859-8-i")) == 0) ||
    (charset->caseInsensitiveCompare(MCSTR("iso-8859-8-e")) == 0)) {
        charset = MCSTR("iso-8859-8");
    }
    else if ((charset->caseInsensitiveCompare(MCSTR("GB2312")) == 0) ||
    (charset->caseInsensitiveCompare(MCSTR("GB_2312-80")) == 0)) {
        charset = MCSTR("GBK");
    }

    return charset->lowercaseString();
}

String * Data::stringWithCharset(const char * charset)
{
    String * result = new String(this, charset);
    if ((length() != 0) && (result->length() == 0)) {
        result->release();
        return NULL;
    }
    return (String *) result->autorelease();
}

static bool isHintCharsetValid(String * hintCharset)
{
    static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
    static Set * knownCharset = NULL;

    pthread_mutex_lock(&lock);
    if (knownCharset == NULL) {
        knownCharset = new Set();

        UCharsetDetector * detector;
        UEnumeration * iterator;
        UErrorCode err = U_ZERO_ERROR;

        detector = ucsdet_open(&err);
        iterator = ucsdet_getAllDetectableCharsets(detector, &err);
        while (1) {
            const char * validCharset = uenum_next(iterator, NULL, &err);
            if (err != U_ZERO_ERROR)
                break;
            if (validCharset == NULL)
                break;
            knownCharset->addObject(String::stringWithUTF8Characters(validCharset));
        }
        uenum_close(iterator);
        ucsdet_close(detector);
    }
    pthread_mutex_unlock(&lock);

    if (hintCharset != NULL) {
        hintCharset = normalizeCharset(hintCharset);

        if (hintCharset->isEqual(MCSTR("tis-620"))) {
            return true;
        }
        else if (hintCharset->isEqual(MCSTR("koi8-r"))) {
            return true;
        }
        else if (hintCharset->isEqual(MCSTR("euc-kr"))) {
            return true;
        }
        else if (hintCharset->isEqual(MCSTR("windows-1256"))) {
            return true;
        }

        if (!knownCharset->containsObject(hintCharset)) {
            return true;
        }
    }

    return false;
}

String * Data::stringWithDetectedCharset(String * hintCharset, bool isHTML)
{
    String * result;
    String * charset;

    if (hintCharset != NULL) {
        hintCharset = normalizeCharset(hintCharset);
    }
    if (isHintCharsetValid(hintCharset)) {
        charset = hintCharset;
    }
    else {
        if (hintCharset == NULL) {
            charset = charsetWithFilteredHTML(isHTML);
        }
        else {
            charset = charsetWithFilteredHTML(isHTML, hintCharset);
        }
    }

    if (charset == NULL) {
        charset = MCSTR(DEFAULT_CHARSET);
    }

    charset = normalizeCharset(charset);

    // Remove whitespace at the end of the string to fix conversion.
    if (charset->isEqual(MCSTR("iso-2022-jp-2"))) {
        const char * theBytes;
        Data * data;

        theBytes = bytes();
        data = this;
        if (length() >= 2) {
            unsigned int idx;

            idx = length();
            while ((theBytes[idx - 1] == '\n') || (theBytes[idx - 1] == '\r')) {
                idx --;
                if (idx == 0)
                    break;
            }

            if (idx != length()) {
                data = Data::dataWithBytes(theBytes, idx);
            }
        }
        result = data->stringWithCharset("iso-2022-jp-2");
        if (result == NULL) {
            result = data->stringWithCharset("iso-2022-jp");
        }
        if (result == NULL) {
            result = MCSTR("");
        }

        return result;
    }

    result = stringWithCharset(charset->UTF8Characters());
    if (result == NULL) {
        result = stringWithCharset("iso-8859-1");
    }
    if (result == NULL) {
        result = stringWithCharset("windows-1252");
    }
    if (result == NULL) {
        result = stringWithCharset("utf-8");
    }
    if (result == NULL) {
        result = MCSTR("");
    }

    return result;
}

String * Data::charsetWithFilteredHTMLWithoutHint(bool filterHTML)
{
    UCharsetDetector * detector;
    const UCharsetMatch * match;
    UErrorCode err = U_ZERO_ERROR;
    const char * cName;
    String * result;

    detector = ucsdet_open(&err);
    ucsdet_setText(detector, bytes(), length(), &err);
    ucsdet_enableInputFilter(detector, filterHTML);
    match = ucsdet_detect(detector, &err);
    if (match == NULL) {
        ucsdet_close(detector);
        return NULL;
    }

    cName = ucsdet_getName(match, &err);

    result = String::stringWithUTF8Characters(cName);
    ucsdet_close(detector);

    return result;
}

String * Data::charsetWithFilteredHTML(bool filterHTML, String * hintCharset)
{
    if (hintCharset == NULL)
        return charsetWithFilteredHTMLWithoutHint(filterHTML);

    const UCharsetMatch ** matches;
    int32_t matchesCount;
    UCharsetDetector * detector;
    UErrorCode err = U_ZERO_ERROR;
    String * result;

    hintCharset = hintCharset->lowercaseString();

    detector = ucsdet_open(&err);
    ucsdet_setText(detector, bytes(), length(), &err);
    ucsdet_enableInputFilter(detector, filterHTML);
    matches = ucsdet_detectAll(detector,  &matchesCount, &err);
    if (matches == NULL) {
        ucsdet_close(detector);
        return hintCharset;
    }
    if (matchesCount == 0) {
        ucsdet_close(detector);
        return hintCharset;
    }

    result = NULL;

    for(int32_t i = 0 ; i < matchesCount ; i ++) {
        const char * cName;
        String * name;
        int32_t confidence;

        cName = ucsdet_getName(matches[i], &err);
        name = String::stringWithUTF8Characters(cName);
        name = name->lowercaseString();
        confidence = ucsdet_getConfidence(matches[i], &err);
        if ((confidence >= 50) && name->isEqual(hintCharset)) {
            result = name;
            break;
        }
    }

    if (result == NULL) {
        int32_t maxConfidence;

        maxConfidence = 49;

        for(int32_t i = 0 ; i < matchesCount ; i ++) {
            const char * cName;
            String * name;
            int32_t confidence;

            cName = ucsdet_getName(matches[i], &err);
            confidence = ucsdet_getConfidence(matches[i], &err);
            name = String::stringWithUTF8Characters(cName);
            if (confidence > maxConfidence) {
                result = name;
                maxConfidence = confidence;
            }
        }
    }
    ucsdet_close(detector);

    if (result == NULL)
        result = hintCharset;

    return result;
}

Data * Data::dataWithContentsOfFile(String * filename)
{
    int r;
    size_t read_items;
    struct stat stat_buf;
    FILE * f;
    char * buf;
    Data * data;

    f = fopen(filename->fileSystemRepresentation(), "rb");
    if (f == NULL) {
        return NULL;
    }

    r = fstat(fileno(f), &stat_buf);
    if (r < 0) {
        fclose(f);
        return NULL;
    }

    buf = (char *) malloc((size_t) stat_buf.st_size);

    read_items = fread(buf, 1, (size_t)  stat_buf.st_size, f);
    if ((off_t) read_items != stat_buf.st_size) {
        free(buf);
        fclose(f);
        return NULL;
    }

    data = Data::dataWithBytes(buf, (unsigned int) stat_buf.st_size);
    free(buf);

    fclose(f);

    return data;
}

static size_t uudecode(char * text, size_t size)
{
    unsigned int count = 0;
    char *b = text;		/* beg */
    char *s = b;			/* src */
    char *d = b;			/* dst */
    char *e = b+size;			/* end */
    int out = (*s++ & 0x7f) - 0x20;

    /* don't process lines without leading count character */
    if (out < 0)
        return size;

    /* don't process begin and end lines */
    if ((strncasecmp((const char *)b, "begin ", 6) == 0) ||
        (strncasecmp((const char *)b, "end",    3) == 0))
        return size;

    //while (s < e - 4)
    while (s < e)
    {
        int v = 0;
        int i;
        for (i = 0; i < 4; i += 1) {
            char c = *s++;
            v = v << 6 | ((c - 0x20) & 0x3F);
        }
        for (i = 2; i >= 0; i -= 1) {
            char c = (char) (v & 0xFF);
            d[i] = c;
            v = v >> 8;
        }
        d += 3;
        count += 3;
    }
    *d = (char) '\0';
    return count;
}

Data * Data::decodedDataUsingEncoding(Encoding encoding)
{
    const char * text;
    size_t text_length;

    text = bytes();
    text_length = length();

    switch (encoding) {
        case Encoding7Bit:
        case Encoding8Bit:
        case EncodingBinary:
        case EncodingOther:
        default:
        {
            return this;
        }
        case EncodingBase64:
        case EncodingQuotedPrintable:
        {
            char * decoded;
            size_t decoded_length;
            size_t cur_token;
            int mime_encoding;
            Data * data;

            switch (encoding) {
                default: //disable warning
                case EncodingBase64:
                    mime_encoding = MAILMIME_MECHANISM_BASE64;
                    break;
                case EncodingQuotedPrintable:
                    mime_encoding = MAILMIME_MECHANISM_QUOTED_PRINTABLE;
                    break;
            }

            cur_token = 0;
            mailmime_part_parse(text, text_length, &cur_token,
                                mime_encoding, &decoded, &decoded_length);
            data = Data::dataWithBytes(decoded, (unsigned int) decoded_length);
            mailmime_decoded_part_free(decoded);
            return data;
        }
        case EncodingUUEncode:
        {
            char * dup_data;
            size_t decoded_length;
            Data * data;
            char * current_p;

            data = Data::dataWithCapacity((unsigned int) text_length);

            dup_data = (char *) malloc(text_length);
            memcpy(dup_data, text, text_length);

            current_p = dup_data;
            while (1) {
                size_t length;
                char * p;
                char * p1;
                char * p2;
                char * end_line;

                p1 = strchr(current_p, '\n');
                p2 = strchr(current_p, '\r');
                if (p1 == NULL) {
                    p = p2;
                }
                else if (p2 == NULL) {
                    p = p1;
                }
                else {
                    if (p1 - current_p < p2 - current_p) {
                        p = p1;
                    }
                    else {
                        p = p2;
                    }
                }
                end_line = p;
                if (p != NULL) {
                    while ((size_t) (p - dup_data) < text_length) {
                        if ((* p != '\r') && (* p != '\n')) {
                            break;
                        }
                        p ++;
                    }
                }
                if (p == NULL) {
                    length = text_length - (current_p - dup_data);
                }
                else {
                    length = end_line - current_p;
                }
                if (length == 0) {
                    break;
                }
                decoded_length = uudecode(current_p, length);
                if (decoded_length != 0 && decoded_length < length) {
                    data->appendBytes(current_p, (unsigned int) decoded_length);
                }

                if (p == NULL)
                    break;

                current_p = p;
                while ((size_t) (current_p - dup_data) < text_length) {
                    if ((* current_p != '\r') && (* current_p != '\n')) {
                        break;
                    }
                    current_p ++;
                }
            }
            free(dup_data);

            return data;
        }
    }
}

Data * Data::data()
{
    return dataWithCapacity(0);
}

Data * Data::dataWithCapacity(int capacity)
{
    Data * result = new Data(capacity);
    return (Data *) result->autorelease();
}

String * Data::base64String()
{
    char * encoded = MCEncodeBase64(bytes(), length());
    String * result = String::stringWithUTF8Characters(encoded);
    free(encoded);
    return result;
}

HashMap * Data::serializable()
{
    HashMap * result = Object::serializable();
    result->setObjectForKey(MCSTR("data"), base64String());
    return result;
}

void Data::importSerializable(HashMap * serializable)
{
    setData(((String *) (serializable->objectForKey(MCSTR("data"))))->decodedBase64Data());
}

#if __APPLE__
static CFStringEncoding encodingFromCString(const char * charset)
{
    CFStringEncoding encoding;
    CFStringRef charsetString;
    CFDataRef charsetData;

    charsetData = CFDataCreate(NULL, (const UInt8 *) charset, strlen(charset));
    charsetString = CFStringCreateFromExternalRepresentation(NULL, charsetData, kCFStringEncodingUTF8);
    encoding = CFStringConvertIANACharSetNameToEncoding(charsetString);
    CFRelease(charsetString);
    CFRelease(charsetData);

    return encoding;
}

static size_t lepIConvInternal(iconv_t cd,
                               const char **inbuf, size_t *inbytesleft,
                               char **outbuf, size_t *outbytesleft,
                               char **inrepls, const char *outrepl)
{
    size_t ret = 0, ret1;
    char *ib = (char *) *inbuf;
    size_t ibl = *inbytesleft;
    char *ob = *outbuf;
    size_t obl = *outbytesleft;

    for (;;)
    {
        ret1 = iconv (cd, &ib, &ibl, &ob, &obl);
        if (ret1 != (size_t)-1)
            ret += ret1;
        if (ibl && obl && errno == EILSEQ)
        {
            if (inrepls)
            {
                /* Try replacing the input */
                char **t;
                for (t = inrepls; *t; t++)
                {
                    char *ib1 = *t;
                    size_t ibl1 = strlen (*t);
                    char *ob1 = ob;
                    size_t obl1 = obl;
                    iconv (cd, &ib1, &ibl1, &ob1, &obl1);
                    if (!ibl1)
                    {
                        ++ib, --ibl;
                        ob = ob1, obl = obl1;
                        ++ret;
                        break;
                    }
                }
                if (*t)
                    continue;
            }
            if (outrepl)
            {
                /* Try replacing the output */
                size_t n = strlen (outrepl);
                if (n <= obl)
                {
                    memcpy (ob, outrepl, n);
                    ++ib, --ibl;
                    ob += n, obl -= n;
                    ++ret;
                    continue;
                }
            }
        }
        *inbuf = ib, *inbytesleft = ibl;
        *outbuf = ob, *outbytesleft = obl;
        return ret;
    }
}

static int lepIConv(const char * tocode, const char * fromcode,
                    const char * str, size_t length,
                    char * result, size_t * result_len)

{
    size_t out_size;
    size_t old_out_size;
    iconv_t conv;
    char * p_result;
    int res;
    size_t r;

    conv = iconv_open(tocode, fromcode);
    if (conv == (iconv_t) -1) {
        res = MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET;
        goto err;
    }

    out_size = length * 6;
    old_out_size = out_size;
    p_result = result;

    r = lepIConvInternal(conv, &str, &length,
                         &p_result, &out_size, NULL, "?");
    if (r == (size_t) -1) {
        res = MAIL_CHARCONV_ERROR_CONV;
        goto close_iconv;
    }

    iconv_close(conv);

    * result_len = old_out_size - out_size;
    * p_result = '\0';

    return MAIL_CHARCONV_NO_ERROR;

close_iconv:
    iconv_close(conv);
err:
    return res;
}

static int lepCFConv(const char * tocode, const char * fromcode,
                     const char * str, size_t length,
                     char * result, size_t * result_len)
{
    CFDataRef data;
    CFStringRef resultString;
    CFStringEncoding fromEncoding;
    CFStringEncoding toEncoding;
    CFDataRef resultData;

    fromEncoding = encodingFromCString(fromcode);
    toEncoding = encodingFromCString(tocode);
    if (fromEncoding == kCFStringEncodingInvalidId)
        return MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET;
    if (toEncoding == kCFStringEncodingInvalidId)
        return MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET;

    data = CFDataCreate(NULL, (const UInt8 *) str, length);
    resultString = CFStringCreateFromExternalRepresentation(NULL, data, fromEncoding);
    if (resultString == NULL) {
        CFRelease(data);
        return MAIL_CHARCONV_ERROR_CONV;
    }

    resultData = CFStringCreateExternalRepresentation(NULL, resultString, toEncoding, (UInt8) '?');

    unsigned int len;
    len = (unsigned int) CFDataGetLength(resultData);
    CFDataGetBytes(resultData, CFRangeMake(0, len), (UInt8 *) result);
    * result_len = len;
    result[len] = 0;

    CFRelease(resultData);
    CFRelease(resultString);
    CFRelease(data);

    return MAIL_CHARCONV_NO_ERROR;
}

static int lepMixedConv(const char * tocode, const char * fromcode,
                        const char * str, size_t length,
                        char * result, size_t * result_len)
{
    int r;

    if (strcasecmp(fromcode, "iso-2022-jp-2") == 0) {
        r = lepCFConv(tocode, fromcode, str, length,
                      result, result_len);
        if (r == MAIL_CHARCONV_NO_ERROR)
            return r;
    }

    r = lepIConv(tocode, fromcode, str, length,
                 result, result_len);
    if (r == MAIL_CHARCONV_NO_ERROR)
        return r;

    return r;
}
#endif

static void * createObject()
{
    return new Data();
}

__attribute__((constructor))
static void initialize()
{
    Object::registerObjectConstructor("mailcore::Data", &createObject);
#if __APPLE__
    extended_charconv = lepMixedConv;
#endif
}


text:
/*
 * $Id: SGTPoint.java,v 1.1 2004/12/27 16:15:22 luca Exp $
 *
 * This software is provided by NOAA for full, free and open release.  It is
 * understood by the recipient/user that NOAA assumes no liability for any
 * errors contained in the code.  Although this software is released without
 * conditions or restrictions in its use, it is expected that appropriate
 * credit be given to its author and to the National Oceanic and Atmospheric
 * Administration should the software be included by the recipient as an
 * element in other product development.
 */

package gov.noaa.pmel.sgt.dm;

import gov.noaa.pmel.util.GeoDate;

/**
 * Defines a data object to be of Point type. Interpretation
 * of X and Y is determined by the CoordinateSystem.  For
 * Cartesian, X and Y are the Cartesian coordinates. For
 * Polar,
 * X and Y are R (radius) and Theta (angle), respectively.
 *
 * The SGTPoint interface only defines data access, not how
 * the data will be constructed or set.
 *
 * @author Donald Denbo
 * @version $Revision: 1.1 $, $Date: 2004/12/27 16:15:22 $
 * @since 1.0
 * @see SGTData
 * @see CoordinateSystem
 * @see Cartesian
 * @see Polar
 * @see SimplePoint
 */
public interface SGTPoint extends SGTData {
  /**
   * Get the x coordinate.
   */
  public double getX();
  /**
   * Get the y coordinate.
   */
  public double getY();
  /**
   * Test if a value is associated with the SGTPoint.
   */
  public boolean hasValue();
  /**
   * Get the associated value.
   */
  public double getValue();
  /**
   * Get the SGTMetaData object associated with the value.
   */
  public SGTMetaData getValueMetaData();
  /**
   * Get the Time value.
   */
  public GeoDate getTime();
  /**
   * Get the time as long referenced from
   * 1970-01-01.
   *
   * @since 3.0
   */
  public long getLongTime();
}


text:
<?php

namespace RSchedule\Bundle\RScheduleBundle\Tests;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

/**
 * Class RScheduleBundleTestCase
 * @package RSchedule\Bundle\RScheduleBundle\Tests
 *
 */
class RScheduleBundleTestCase extends WebTestCase
{

    protected function setUp()
    {
        self::createClient();
    }

    protected function getEntityManager()
    {
        return static::$kernel->getContainer()->get('doctrine')->getManager();
    }

    /**
     * @return \RSchedule\Bundle\RScheduleBundle\RScheduleBundle
     */
    protected function getBundle()
    {
        return static::$kernel->getBundle('RScheduleBundle');
    }
//    /**
//     * @var \Doctrine\ORM\EntityManager
//     */
//    private $em;
//
//    /**
//     * {@inheritDoc}
//     */
//    public function setUp()
//    {
//        self::bootKernel();
//        $this->em = static::$kernel->getContainer()
//            ->get('doctrine')
//            ->getManager();
//    }
//
//    /**
//     * @return \Doctrine\ORM\EntityManager
//     */
//    protected function getEntityManager()
//    {
//        return $this->em;
//    }
//
//    /**
//     * @return  \RSchedule\Bundle\RScheduleBundle\GmanBundle
//     */
//    protected function getBundle()
//    {
//        return static::$kernel->getBundle('GmanBundle');
//    }
//
//    /**
//     * {@inheritDoc}
//     */
//    protected function tearDown()
//    {
//        parent::tearDown();
//        //$this->em->close();
//    }
//
//    protected function getContainer()
//    {
//        $container = static::$kernel->getContainer();
//        return $container;
//    }
}


text:
FireBind v0.5.1
========

Knockout bindings for Firebase

There are two objects added to Knockout by this script. ```ko.fireSet``` for observableArray's that are back by Firebase collections, and ```ko.fireModel``` for objects with observable properties that are back by a Firebase location. They are intended to be used together, but either can be used on their own.

Sets
---

Firesets wrap ```ko.observableArray```. ```ko.fireSet``` will return an observableArray that has all of its collection modifying methods replaced with methods that instead call Firebase's methods. It also wires up Firebase events for the supplied location so that they modify the underlying observableArray.

The result is that you have an array that you can bind to, and modify, as your normally would. Like observableArrays, Firesets only track the items in its array, not the properties of those items.

To construct a Fireset, call ```ko.fireSet``` with the Firebase reference for the collection, and a Constructor function to use for the items that are added. This Constructor is passed the id of the object (Firebase calls it a 'name'), the object itself, and the Firebase reference for that object (which is a child of the Set).

A 3rd parameter to ```ko.fireSet```, the ```config```, controls the 'id' property of its children, and the sorting property of its children.

Children *must* have id properties, but the config property will default to 'id' if not supplied. Without an 'id' property, there would be no way to track local adds or remote removal.

Firebase ordered sets are used for all Firesets. By default, the priority will just be a number generated by Firebind. This will allow you to reorder children with the standard array methods as you like, without needing to specify a config property. If you would like the ordering to be done based on a property of the children, you must specify this property with ```config.orderBy```. If you do this, ```reverse``` and ```splice``` (when used to add items) will throw errors if called, since you cannot manually control the order. ```sort()``` will simply do nothing in this case.

To add queries (like limits) to a Fireset, simply add them to the Firebase reference you pass to ```ko.fireSet```.

Models
---
Models are objects that have Computed Observable properties that intercept writes and pass them to Firebase. The underlying observables are wired to Firebase ```value``` events, so that they are kept up to date. The result is an object whose properties are synced with the properties of a Firebase reference.

The intended use pattern is inside of a constructor, like the one called by Firesets. ```ko.fireModel``` does not return an object, instead it modifies the first parameter passed to it (which will be ```this``` inside of a constructor). The second parameter is a map, an object whose properties will be added to the model (the first paramter), and whose values represent defaults. The third parameter is the Firebase reference.

Here is a common example:

	var User = function(id, data, fireRef) {
	    this.id = id;
		var map = {
			firstName: data.firstName || '',
			lastName: data.lastName || ''
		}
	    ko.fireModel(this, map, fireRef);
	};

This constructor can be used by a Fireset.

You can see both of these in use in this fiddle: http://jsfiddle.net/tyrsius/eaeY5/

For quick, easy use, add firebind with this URL: https://rawgithub.com/tyrsius/FireBind/master/firebind.js

Comments, suggestions, and optimizations welcome


text:
package org.springframework.beans.factory.xml;

import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanDefinitionHolder;
import org.springframework.beans.factory.config.RuntimeBeanReference;
import org.springframework.core.Conventions;

/**
 * Simple NamespaceHandler implementation that maps custom attributes
 * directly through to bean properties. An important point to note is that this
 * NamespaceHandler does not have a corresponding schema since there
 * is no way to know in advance all possible attribute names.
 *
 *
An example of the usage of this NamespaceHandler is shown below:
 *
 *

 * <bean id="rob" class="..TestBean" p:name="Rob Harrop" p:spouse-ref="sally"/>

 *
 * Here the 'p:name' corresponds directly to the 'name'
 * property on class 'TestBean'. The 'p:spouse-ref'
 * attributes corresponds to the 'spouse' property and, rather
 * than being the concrete value, it contains the name of the bean that will
 * be injected into that property.
 *
 * @author Rob Harrop
 * @since 2.0
 */
public class SimplePropertyNamespaceHandler implements NamespaceHandler {

	private static final String REF_SUFFIX = "-ref";

	public void init() {
	}

	public BeanDefinition parse(Element element, ParserContext parserContext) {
		parserContext.getReaderContext().error(
				"Class [" + getClass().getName() + "] does not support custom elements.", element);
		return null;
	}

	public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext) {
		if (node instanceof Attr) {
			Attr attr = (Attr) node;
			String propertyName = attr.getLocalName();
			String propertyValue = attr.getValue();
			MutablePropertyValues pvs = definition.getBeanDefinition().getPropertyValues();
			if (pvs.contains(propertyName)) {
				parserContext.getReaderContext().error("Property '" + propertyName + "' is already defined using " +
						"both <property> and inline syntax. Only one approach may be used per property.", attr);
			}
			if (propertyName.endsWith(REF_SUFFIX)) {
				propertyName = propertyName.substring(0, propertyName.length() - REF_SUFFIX.length());
				pvs.addPropertyValue(
						Conventions.attributeNameToPropertyName(propertyName), new RuntimeBeanReference(propertyValue));
			}
			else {
				pvs.addPropertyValue(Conventions.attributeNameToPropertyName(propertyName), propertyValue);
			}
		}
		return definition;
	}

}


text:
<?php

namespace Thruway\Message;

/**
 * Class EventMessage
 * Event dispatched by Broker to Subscribers for subscription the event was matching.
 * [EVENT, SUBSCRIBED.Subscription|id, PUBLISHED.Publication|id, Details|dict]
 * [EVENT, SUBSCRIBED.Subscription|id, PUBLISHED.Publication|id, Details|dict, PUBLISH.Arguments|list]
 * [EVENT, SUBSCRIBED.Subscription|id, PUBLISHED.Publication|id, Details|dict, PUBLISH.Arguments|list, PUBLISH.ArgumentsKw|dict]
 *
 * @package Thruway\Message
 */

class EventMessage extends Message
{

    /**
     * using arguments trait
     * @see \Thruway\Message\ArgumentsTrait
     */
    use ArgumentsTrait;

    /**
     * @var int
     */
    private $subscriptionId;
    /**
     * @var int
     */
    private $publicationId;
    /**
     * @var mixed
     */
    private $details;

    /**
     * Constructor
     *
     * @param int $subscriptionId
     * @param int $publicationId
     * @param mixed $details
     * @param mixed $arguments
     * @param mixed $argumentsKw
     */
    public function __construct($subscriptionId, $publicationId, $details, $arguments = null, $argumentsKw = null)
    {
        parent::__construct();

        $this->setArguments($arguments);
        $this->setArgumentsKw($argumentsKw);
        $this->details        = $details;
        $this->publicationId  = $publicationId;
        $this->subscriptionId = $subscriptionId;
    }

    /**
     * Get message code
     *
     * @return int
     */
    public function getMsgCode()
    {
        return static::MSG_EVENT;
    }

    /**
     * This is used by get message parts to get the parts of the message beyond
     * the message code
     *
     * @return array
     */
    public function getAdditionalMsgFields()
    {
        $details = $this->getDetails();
        if ($details === null) {
            $details = new \stdClass();
        }

        $details = (object)$details;

        $a = [
            $this->getSubscriptionId(),
            $this->getPublicationId(),
            $details
        ];

        $a = array_merge($a, $this->getArgumentsForSerialization());

        return $a;
    }

    /**
     * Create event message from publish message
     *
     * @param \Thruway\Message\PublishMessage $msg
     * @param int $subscriptionId
     * @return \Thruway\Message\EventMessage
     */
    public static function createFromPublishMessage(PublishMessage $msg, $subscriptionId)
    {
        return new static(
            $subscriptionId,
            $msg->getRequestId(),
            $msg->getOptions(),
            $msg->getArguments(),
            $msg->getArgumentsKw()
        );
    }

    /**
     * set event details
     *
     * @param mixed $details
     */
    public function setDetails($details)
    {
        $this->details = $details;
    }

    /**
     * get event details
     *
     * @return mixed
     */
    public function getDetails()
    {
        return $this->details;
    }

    /**
     * Set publication ID
     *
     * @param int $publicationId
     */
    public function setPublicationId($publicationId)
    {
        $this->publicationId = $publicationId;
    }

    /**
     * Get publication ID
     *
     * @return int
     */
    public function getPublicationId()
    {
        return $this->publicationId;
    }

    /**
     * Set subscription ID
     *
     * @param int $subscriptionId
     */
    public function setSubscriptionId($subscriptionId)
    {
        $this->subscriptionId = $subscriptionId;
    }

    /**
     * Get subscription ID
     *
     * @return int
     */
    public function getSubscriptionId()
    {
        return $this->subscriptionId;
    }

}


text:
import React from "react";
import PropTypes from "prop-types";

require('../styles/style.css');

class Loading extends React.Component {
	render() {
		return <div className="loading" />;
	};
};

export default Loading;


text:
.SimpleSelect {
  display: inline-block;
  width: 220px;
  font: 14px/1 sans-serif;
}

.SimpleSelect-button {
  width: 100%;
  height: 35px;
  padding: 0;
  margin: 0;
  border: 1px solid #000;
  background: none;
  text-align: left;
  font: inherit;
  outline: none;
  cursor: pointer;
}

.SimpleSelect.is-open .SimpleSelect-button {
  background-color: #ccc;
}

.SimpleSelect-button:hover {
  background-color: #f1f1f1;
}

.SimpleSelect-caret {
  float: right;
  margin: 5px 10px 0 0;
  border-top: 5px solid #000;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}

.SimpleSelect-itemSelected {
  margin-left: 5px;
}

.SimpleSelect-optContainer {
  display: none;
  border-right: 1px solid;
  border-left: 1px solid;
  border-bottom: 1px solid;
  border-color: #000;
}

.SimpleSelect-options {
  list-style: none;
  padding: 0;
  margin: 0;
}

.SimpleSelect-options li {
  padding: 5px;
  cursor: pointer;
}

.SimpleSelect-options li:hover {
  background-color: #f1f1f1;
}


text:
*Data and scripts for our Code Coverage vs Code Quality analysis.*

## Usage

These analysis tools can be run via a [Docker][docker] container, which will simplify the process of installing dependencies.

### With Docker

* You will need Docker installed. Please see the [installation instructions for your platform][dockerdocs] to get started.
* Run the `setup` script. This will download the Docker image (if necessary), startup the container and connect the current directory into the container for saving any outputs. When you exit the container it will be automatically cleaned up.
 * If you would rather run the Docker container with your own options you can do so in the usual way - see the `setup` script for more details. The image is [available on the Docker Hub][dockerhub].
* Change into the `scripts` directory.
* Run: `python regression_combined.py`

### Without Docker

* You will need to install:
 * `Python`
 * `numpy`
 * `pandas`
 * `matplotlib`
* Change into the `scripts` directory.
* Run: `python regression_combined.py`

## Licence

Copyright (c) 2015, 2016 The University of Manchester, UK.

BSD licenced. See LICENCE for details.

[docker]: https://www.docker.com/
[dockerdocs]: https://docs.docker.com/
[dockerhub]: https://hub.docker.com/r/hainesr/quality/


text:
<extend name="desktop_default/template/base_index2" />

<block name="area_header">
	<link rel="stylesheet" href="__PUBLIC__/Home/Index/css/base.css">

</block>

<block name="area_body">
	<include file="desktop_default/width/right" />
	<include file="desktop_default/width/top"/>

		<include file="desktop_default/width/daohang"/>

		意见反馈!

		意见建议:<textarea cols="35" rows="3" placeholder="请填写您的意见或建议">

		</textarea>

			联系方式: <input type="text" name="lxfs" />

		提交继续逛逛

	 <include file="desktop_default/width/floor" />

</block>

<block name="area_footer">

</block>


text:
package laika.rewrite

import laika.ast.Path.Root
import laika.ast.RelativePath.CurrentTree
import laika.ast._
import laika.ast.sample.{BuilderKey, SampleConfig, SampleTrees}
import laika.config.LaikaKeys
import laika.format.HTML
import laika.rewrite.nav.{ConfigurablePathTranslator, TargetFormats, TargetLookup, TranslatorConfig}
import munit.FunSuite

class PathTranslatorSpec extends FunSuite {

  private val rootCursor = {

    val versions = Versions(Version("0.42.x", "0.42"), Nil)

    def doc2 (key: BuilderKey): Seq[Block] = Seq(
      Header(1, "Title").withOptions(Id("ref")),
      Paragraph("text")
    )

    SampleTrees.sixDocuments
      .root.config(_.withValue(versions).withValue(LaikaKeys.siteBaseURL, "http://external.com/"))
      .root.config(SampleConfig.versioned(true))
      .doc1.config(SampleConfig.versioned(false))
      .doc2.config(SampleConfig.versioned(false))
      .static1.config(SampleConfig.versioned(false))
      .staticDoc(Root / "static-1" / "doc-7.txt")
      .staticDoc(Root / "static-2" / "doc-8.txt")
      .docContent(doc2 _)
      .suffix("md")
      .buildCursor
      .getOrElse(fail("unable to create cursor"))
  }

  val translatorConfig = TranslatorConfig.readFrom(rootCursor.config).getOrElse(TranslatorConfig.empty)
  val lookup = new TargetLookup(rootCursor)
  val versionedRef = ConfigurablePathTranslator(translatorConfig, OutputContext(HTML), Root / "tree-1" / "doc-3.md", lookup)
  val unversionedRef = ConfigurablePathTranslator(translatorConfig, OutputContext(HTML), Root / "doc-1.md", lookup)
  val epubRef = ConfigurablePathTranslator(translatorConfig, OutputContext("epub.xhtml", "epub"), Root / "tree-1" / "doc-3.md", lookup)

  test("between two unversioned documents") {
    val input    = ResolvedInternalTarget(Root / "doc-2.md", CurrentTree / "doc-2.md")
    val expected = ResolvedInternalTarget(Root / "doc-2.html", CurrentTree / "doc-2.html")
    assertEquals(unversionedRef.translate(input), expected)
  }

  test("between two versioned documents") {
    val input    = ResolvedInternalTarget(Root / "tree-2" / "doc-5.md", RelativePath.parse("../tree-2/doc-5.md"))
    val expected = ResolvedInternalTarget(Root / "0.42" / "tree-2" / "doc-5.html", RelativePath.parse("../tree-2/doc-5.html"))
    assertEquals(versionedRef.translate(input), expected)
  }

  test("versioned to unversioned document") {
    val input    = ResolvedInternalTarget(Root / "doc-2.md", RelativePath.parse("../doc-2.md"))
    val expected = ResolvedInternalTarget(Root / "doc-2.html", RelativePath.parse("../../doc-2.html"))
    assertEquals(versionedRef.translate(input), expected)
  }

  test("unversioned to versioned document") {
    val input    = ResolvedInternalTarget(Root / "tree-2" / "doc-5.md", RelativePath.parse("tree-2/doc-5.md"))
    val expected = ResolvedInternalTarget(Root / "0.42" / "tree-2" / "doc-5.html", RelativePath.parse("0.42/tree-2/doc-5.html"))
    assertEquals(unversionedRef.translate(input), expected)
  }

  test("static unversioned document") {
    val input    = ResolvedInternalTarget(Root / "static-1" / "doc-7.txt", RelativePath.parse("../static-1/doc-7.txt"))
    val expected = ResolvedInternalTarget(Root / "static-1" / "doc-7.txt", RelativePath.parse("../../static-1/doc-7.txt"))
    assertEquals(versionedRef.translate(input), expected)
  }

  test("static versioned document") {
    val input    = ResolvedInternalTarget(Root / "static-2" / "doc-8.txt", RelativePath.parse("../static-2/doc-8.txt"))
    val expected = ResolvedInternalTarget(Root / "0.42" / "static-2" / "doc-8.txt", RelativePath.parse("../static-2/doc-8.txt"))
    assertEquals(versionedRef.translate(input), expected)
  }

  test("ignore versions when output format is not HTML") {
    val input    = ResolvedInternalTarget(Root / "tree-2" / "doc-5.md", RelativePath.parse("../tree-2/doc-5.md"))
    val expected = ResolvedInternalTarget(Root / "tree-2" / "doc-5.epub.xhtml", RelativePath.parse("../tree-2/doc-5.epub.xhtml"))
    assertEquals(epubRef.translate(input), expected)
  }

  test("apply versions when substituting an internal target with an external one") {
    val input    = ResolvedInternalTarget(Root / "tree-2" / "doc-5.md", RelativePath.parse("../tree-2/doc-5.md"), TargetFormats.Selected("html"))
    val expected = ExternalTarget("http://external.com/0.42/tree-2/doc-5.html")
    assertEquals(epubRef.translate(input), expected)
  }

}


text:
@interface LZHumidityCountLabel : UIView

@property (nonatomic, strong) NSNumber *fromValue;

@property (nonatomic, strong) NSNumber *toValue;

@property (nonatomic, strong) LZHumidityCount *humidityCont;

@property (nonatomic, strong) UILabel *countLabel;

- (void)showDuration:(CGFloat)duration;

- (void)hideDuration:(CGFloat)duration;

@end


text:
import { Column, Entity, Index, PrimaryGeneratedColumn } from "typeorm";

@Index(
  "index_activities_on_investigation_id_and_position",
  ["investigationId", "position"],
  {}
)
@Index("featured_public", ["isFeatured", "publicationStatus"], {})
@Index("pub_status", ["publicationStatus"], {})
@Entity("activities", { schema: "portal_development" })
export class Activities {
  @PrimaryGeneratedColumn({ type: "int", name: "id" })
  id: number;

  @Column("int", { name: "user_id", nullable: true })
  userId: number | null;

  @Column("varchar", { name: "uuid", nullable: true, length: 36 })
  uuid: string | null;

  @Column("varchar", { name: "name", nullable: true, length: 255 })
  name: string | null;

  @Column("longtext", { name: "description", nullable: true })
  description: string | null;

  @Column("datetime", { name: "created_at" })
  createdAt: Date;

  @Column("datetime", { name: "updated_at" })
  updatedAt: Date;

  @Column("int", { name: "position", nullable: true })
  position: number | null;

  @Column("int", { name: "investigation_id", nullable: true })
  investigationId: number | null;

  @Column("int", { name: "original_id", nullable: true })
  originalId: number | null;

  @Column("tinyint", {
    name: "teacher_only",
    nullable: true,
    width: 1,
    default: () => "'0'",
  })
  teacherOnly: boolean | null;

  @Column("varchar", {
    name: "publication_status",
    nullable: true,
    length: 255,
  })
  publicationStatus: string | null;

  @Column("int", {
    name: "offerings_count",
    nullable: true,
    default: () => "'0'",
  })
  offeringsCount: number | null;

  @Column("tinyint", {
    name: "student_report_enabled",
    nullable: true,
    width: 1,
    default: () => "'1'",
  })
  studentReportEnabled: boolean | null;

  @Column("tinyint", {
    name: "show_score",
    nullable: true,
    width: 1,
    default: () => "'0'",
  })
  showScore: boolean | null;

  @Column("varchar", { name: "teacher_guide_url", nullable: true, length: 255 })
  teacherGuideUrl: string | null;

  @Column("varchar", { name: "thumbnail_url", nullable: true, length: 255 })
  thumbnailUrl: string | null;

  @Column("tinyint", {
    name: "is_featured",
    nullable: true,
    width: 1,
    default: () => "'0'",
  })
  isFeatured: boolean | null;

  @Column("tinyint", {
    name: "is_assessment_item",
    nullable: true,
    width: 1,
    default: () => "'0'",
  })
  isAssessmentItem: boolean | null;
}


text:
SELECT player_id,
       device_id
FROM   Activity
WHERE  ( player_id, event_date ) IN (SELECT player_id,
                                            MIN(event_date)
                                     FROM   Activity
                                     GROUP  BY player_id);


text:
"""
Retrieves images from the Yale Public Figures Face Dataset and writes them out to a folder.
The list of development set images is stored at http://www.cs.columbia.edu/CAVE/databases/pubfig/download/dev_urls.txt
The list of evaluation set images is stored at http://www.cs.columbia.edu/CAVE/databases/pubfig/download/eval_urls.txt

Created by : Sayan Ghosh   Date: July 11, 2014
"""

import csv
import sys
import os
import numpy as np
from urllib.request import urlopen,HTTPError,URLError
#from io import StringIO
from io import BytesIO

#import SimpleCV as cv2
from PIL import Image

def create_opencv_image_from_stringio(img_stream, cv2_img_flag=0):
    img_stream.seek(0)
    img_array = np.asarray(bytearray(img_stream.read()), dtype=np.uint8)
    return cv2.imdecode(img_array, cv2_img_flag)

def create_opencv_image_from_url(url, cv2_img_flag=0):
    request = urlopen(url)
    img_array = np.asarray(bytearray(request.read()), dtype=np.uint8)
    return cv2.imdecode(img_array, cv2_img_flag)

class ImageDescription:
    """
    ImageDescription class represents a image from the PubFig dataset along with person name, image number, URL, bounding rectangle and md5sum
    Attribs:
        person_name : Person's name
        image_num : Image number
        url : URL where image is located
        rect : Bounding rectangle dimensions containing only the face
        md5sum : 128 bit MD5 hash
    """
    def __init__(self,person_name,image_num,url,rect,md5sum):
        """ Class constructor """
        self.person_name=person_name
        self.image_num=image_num
        self.url=url
        self.rect=rect
        self.md5sum=md5sum

    def print_image_description(self):
        """ Displays the attributes"""
        print("Person name:"+self.person_name)
        print("Image Number:"+self.image_num)
        print("URL :"+self.url)
        print("Rect :"+self.rect)
        print("md5sum :"+self.md5sum)

    def dump_file(self,path):
        """ Retrieves the image from the URL and saves it in the specified path
        Argument :
             path : Path where the image is to be stored
        """
        # First retrieve the URL and obtain the file
        try:
            # Get image from URL
            print("Open Url0")
            url_res=urlopen(self.url,timeout=1)
            print("Open Url1")
            image=url_res.read()
            #img_array=imread(StringIO(image),flatten=True)
            print("Open Url2");
            pil_image=Image.open(BytesIO(image))
            print("Open Url3");
            url_res.close()
            print("Open Url4");
            #image_mat=create_opencv_image_from_url(self.url, 1);
            #
            # Parse the string containing the area to cut out
            rect_list=[int(z) for z in self.rect.split(',')]
            print("Open Url5");
            #img_array_crop=image_mat[rect_list[1]:rect_list[3],rect_list[0]:rect_list[2]]
            #img_array_crop=image_mat
            img_folder=path+"\\"+self.person_name
            print("Open folder " + img_folder)
            os.makedirs(img_folder, exist_ok=True)
            jpg_img_string=img_folder+"\\"+self.image_num+".jpg"
            print("Open Url6");
            #imsave(jpg_img_string,img_array_crop)
            #cv2.imsave(jpg_img_string,img_array_crop)
            print("Save to " + jpg_img_string)
            #Image.write(jpg_img_string, pil_image)
            pil_image.save(jpg_img_string)

            pil_image=pil_image.crop((rect_list[0],rect_list[1],rect_list[2],rect_list[3]))
            img_folder=path+"_crop\\"+self.person_name
            print("Open folder " + img_folder)
            os.makedirs(img_folder, exist_ok=True)
            jpg_img_string=img_folder+"\\"+self.image_num+".jpg"
            pil_image.save(jpg_img_string)
            print("Open Url7");
        except: # Errors could be due to different reasons like invalid format, or broken image links, catching all possible errors
            print(self.image_num+"   "+self.url + " has trouble !")

class ReadDataWriteImages:
    """
    ReadDataWriteImages class contains methods for reading in a PubFig data file description, and then writing it out to a folder
    """
    def __init__(self,datafile_name,path):
        self.datafile_name=datafile_name
        self.path=path
    def read_datafile(self):
        """
            This function reads in a data file description and stores it in a list of image_description objects
        """
        description_list=[]
        with open(self.datafile_name,'rt') as file_handle:
            csv_reader=csv.reader(file_handle,delimiter='\t')
            # Skip the first two rows
            next(csv_reader)
            next(csv_reader)
            # Start reading the rows
            for row in csv_reader:
                description_list.append(ImageDescription(row[0],row[1],row[2],row[3],row[4]))
        return description_list

    def write_out_images(self):
        """
        This function writes out images to a specified path

        """
        read_list=self.read_datafile()
        for item in read_list:
            item.dump_file(self.path)

# Process command line arguments
if __name__=="__main__":

    if len(sys.argv)<3:
        print ("Usage : python read_pub_fig.py datafile_name path")
    else:
        read_data_object=ReadDataWriteImages(sys.argv[1],sys.argv[2])
        read_data_object.write_out_images()