text:
//
//  FPPopoverController.m
//
//  Created by Alvise Susmel on 1/5/12.
//  Copyright (c) 2012 Fifty Pixels Ltd. All rights reserved.
//
//  https://github.com/50pixels/FPPopover

#import "FPPopoverController.h"

//ivars
@interface FPPopoverController()
{
    FPTouchView *_touchView;
    FPPopoverView *_contentView;
    UIViewController *_viewController;
    UIWindow *_window;
    UIView *_parentView;
    UIView *_fromView;
    UIDeviceOrientation _deviceOrientation;

    BOOL _shadowsHidden;
    CGColorRef _shadowColor;
}
@end

//private methods
@interface FPPopoverController(Private)
-(CGPoint)originFromView:(UIView*)fromView;

-(CGFloat)parentWidth;
-(CGFloat)parentHeight;

#pragma mark Space management
/* This methods help the controller to found a proper way to display the view.
 * If the "from point" will be on the left, the arrow will be on the left and the
 * view will be move on the right of the from point.
 */

-(CGRect)bestArrowDirectionAndFrameFromView:(UIView*)v;

@end

@implementation FPPopoverController
@synthesize delegate = _delegate;
@synthesize contentView = _contentView;
@synthesize touchView = _touchView;
@synthesize contentSize = _contentSize;
@synthesize origin = _origin;
@synthesize arrowDirection = _arrowDirection;
@synthesize tint = _tint;
@synthesize border = _border;
@synthesize alpha = _alpha;

-(void)addObservers
{
    [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];

    [[NSNotificationCenter defaultCenter]
     addObserver:self
     selector:@selector(deviceOrientationDidChange:)
     name:@"UIDeviceOrientationDidChangeNotification"
     object:nil];

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(willPresentNewPopover:) name:@"FPNewPopoverPresented" object:nil];

    _deviceOrientation = [UIDevice currentDevice].orientation;

}

-(void)removeObservers
{
    [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
    [[NSNotificationCenter defaultCenter] removeObserver:self];
    [_viewController removeObserver:self forKeyPath:@"title"];
}

-(void)dealloc
{
    [self removeObservers];
    if(_shadowColor) CGColorRelease(_shadowColor);

#ifdef FP_DEBUG
    NSLog(@"FPPopoverController dealloc");
#endif

    SAFE_ARC_RELEASE(_contentView);
    SAFE_ARC_RELEASE(_touchView);
    self.delegate = nil;

    SAFE_ARC_RELEASE(_viewController);
    _viewController = nil;

    SAFE_ARC_SUPER_DEALLOC();
}

-(id)initWithViewController:(UIViewController*)viewController {
	return [self initWithViewController:viewController delegate:nil];
}

-(id)initWithViewController:(UIViewController*)viewController
				   delegate:(id<FPPopoverControllerDelegate>)delegate
{
    self = [super init];
    if(self)
    {
		self.delegate = delegate;

        self.alpha = 1.0;
        self.arrowDirection = FPPopoverArrowDirectionAny;
        self.view.userInteractionEnabled = YES;
        _border = YES;

        _touchView = [[FPTouchView alloc] initWithFrame:self.view.bounds];
        _touchView.backgroundColor = [UIColor clearColor];
        _touchView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
        _touchView.clipsToBounds = NO;
        [self.view addSubview:_touchView];

#if __has_feature(objc_arc)
        //ARC on
        id bself = self;
#else
        //ARC off
        __block id bself = self;
#endif

        [_touchView setTouchedOutsideBlock:^{
            [bself dismissPopoverAnimated:YES];
        }];

        self.contentSize = CGSizeMake(200, 300); //default size

        _contentView = [[FPPopoverView alloc] initWithFrame:CGRectMake(0, 0,
                                              self.contentSize.width, self.contentSize.height)];

        _viewController = SAFE_ARC_RETAIN(viewController);

        [_touchView addSubview:_contentView];

        [_contentView addContentView:_viewController.view];
        _viewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
        self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
        self.view.clipsToBounds = NO;

        _touchView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
        _touchView.clipsToBounds = NO;

        //setting contentview
        _contentView.title = _viewController.title;
        _contentView.clipsToBounds = NO;

        [_viewController addObserver:self forKeyPath:@"title" options:NSKeyValueObservingOptionNew context:nil];
    }
    return self;
}

-(void)setTint:(FPPopoverTint)tint
{
    _contentView.tint = tint;
    [_contentView setNeedsDisplay];
}

-(FPPopoverTint)tint
{
    return _contentView.tint;
}

#pragma mark - View lifecycle

-(void)setupView
{
    self.view.frame = CGRectMake(0, 0, [self parentWidth], [self parentHeight]);
    _touchView.frame = self.view.bounds;

    //view position, size and best arrow direction
    [self bestArrowDirectionAndFrameFromView:_fromView];

    [_contentView setNeedsDisplay];
    [_touchView setNeedsDisplay];
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    //initialize and load the content view
    [_contentView setArrowDirection:FPPopoverArrowDirectionUp];
    [_contentView addContentView:_viewController.view];

    [self setupView];
    [self addObservers];
}

#pragma mark Orientation

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
	if ([_viewController respondsToSelector:@selector(shouldAutorotateToInterfaceOrientation:)])
		return [_viewController shouldAutorotateToInterfaceOrientation:toInterfaceOrientation];
	return YES;
}

#pragma mark presenting

-(CGFloat)parentWidth
{
    return _parentView.bounds.size.width;
    //return UIDeviceOrientationIsPortrait(_deviceOrientation) ? _parentView.frame.size.width : _parentView.frame.size.height;
}
-(CGFloat)parentHeight
{
    return _parentView.bounds.size.height;
    //return UIDeviceOrientationIsPortrait(_deviceOrientation) ? _parentView.frame.size.height : _parentView.frame.size.width;
}

-(void)presentPopoverFromPoint:(CGPoint)fromPoint
{
    self.origin = fromPoint;

    //NO BORDER
    if(self.border == NO)
    {
        _viewController.title = nil;
        _viewController.view.clipsToBounds = YES;
    }

    _contentView.relativeOrigin = [_parentView convertPoint:fromPoint toView:_contentView];

    [self.view removeFromSuperview];
    NSArray *windows = [UIApplication sharedApplication].windows;
    if(windows.count > 0)
    {
          _parentView=nil;
        _window = [windows objectAtIndex:0];
        //keep the first subview
        if(_window.subviews.count > 0)
        {
            _parentView = [_window.subviews objectAtIndex:0];
            [_parentView addSubview:self.view];
            [_viewController viewDidAppear:YES];
        }

   }
    else
    {
        [self dismissPopoverAnimated:NO];
    }

    [self setupView];
    self.view.alpha = 0.0;
    [UIView animateWithDuration:0.2 animations:^{

        self.view.alpha = self.alpha;
    }];

    [[NSNotificationCenter defaultCenter] postNotificationName:@"FPNewPopoverPresented" object:self];

    //navigation controller bar fix
    if([_viewController isKindOfClass:[UINavigationController class]])
    {
        UINavigationController *nc = (UINavigationController*)_viewController;
        UINavigationBar *b = nc.navigationBar;
        CGRect bar_frame = b.frame;
        bar_frame.origin.y = 0;
        b.frame = bar_frame;
    }
}

-(CGPoint)originFromView:(UIView*)fromView
{
    CGPoint p;
    if([_contentView arrowDirection] == FPPopoverArrowDirectionUp ||
       [_contentView arrowDirection] == FPPopoverNoArrow)
    {
        p.x = fromView.frame.origin.x + fromView.frame.size.width/2.0;
        p.y = fromView.frame.origin.y + fromView.frame.size.height;
    }
    else if([_contentView arrowDirection] == FPPopoverArrowDirectionDown)
    {
        p.x = fromView.frame.origin.x + fromView.frame.size.width/2.0;
        p.y = fromView.frame.origin.y;
    }
    else if([_contentView arrowDirection] == FPPopoverArrowDirectionLeft)
    {
        p.x = fromView.frame.origin.x + fromView.frame.size.width;
        p.y = fromView.frame.origin.y + fromView.frame.size.height/2.0;
    }
    else if([_contentView arrowDirection] == FPPopoverArrowDirectionRight)
    {
        p.x = fromView.frame.origin.x;
        p.y = fromView.frame.origin.y + fromView.frame.size.height/2.0;
    }

    return p;
}

-(void)presentPopoverFromView:(UIView*)fromView
{
    SAFE_ARC_RELEASE(_fromView);
    _fromView = SAFE_ARC_RETAIN(fromView);
    [self presentPopoverFromPoint:[self originFromView:_fromView]];
}

-(void)dismissPopover
{
    [self.view removeFromSuperview];
    if([self.delegate respondsToSelector:@selector(popoverControllerDidDismissPopover:)])
    {
        [self.delegate popoverControllerDidDismissPopover:self];
    }
     _window=nil;
     _parentView=nil;
}

-(void)dismissPopoverAnimated:(BOOL)animated {
	[self dismissPopoverAnimated:animated completion:nil];
}

-(void)dismissPopoverAnimated:(BOOL)animated completion:(FPPopoverCompletion)completionBlock
{
    if(animated)
    {
        [UIView animateWithDuration:0.2 animations:^{
            self.view.alpha = 0.0;
        } completion:^(BOOL finished) {
            [self dismissPopover];
			if (completionBlock)
				completionBlock();
        }];
    }
    else
    {
        [self dismissPopover];
		if (completionBlock)
			completionBlock();
    }

}

-(void)setOrigin:(CGPoint)origin
{
    _origin = origin;
}

#pragma mark observing

-(void)deviceOrientationDidChange:(NSNotification*)notification
{
	_deviceOrientation = [UIDevice currentDevice].orientation;

	BOOL shouldResetView = NO;

    //iOS6 has a new orientation implementation.
    //we ask to reset the view if is >= 6.0
	if ([_viewController respondsToSelector:@selector(shouldAutorotateToInterfaceOrientation:)] &&
        [[[UIDevice currentDevice] systemVersion] floatValue] < 6.0)
	{
		UIInterfaceOrientation interfaceOrientation;
		switch (_deviceOrientation)
		{
			case UIDeviceOrientationLandscapeLeft:
				interfaceOrientation = UIInterfaceOrientationLandscapeLeft;
				break;
			case UIDeviceOrientationLandscapeRight:
				interfaceOrientation = UIInterfaceOrientationLandscapeRight;
				break;
			case UIDeviceOrientationPortrait:
				interfaceOrientation = UIInterfaceOrientationPortrait;
				break;
			case UIDeviceOrientationPortraitUpsideDown:
				interfaceOrientation = UIInterfaceOrientationPortraitUpsideDown;
				break;
			default:
				return;	// just ignore face up / face down, etc.
		}
	}
	else
	{
		shouldResetView = YES;
	}

	if (shouldResetView)
		[UIView animateWithDuration:0.2 animations:^{
			[self setupView];
		}];
}

-(void)willPresentNewPopover:(NSNotification*)notification
{
    if(notification.object != self)
    {
        if([self.delegate respondsToSelector:@selector(presentedNewPopoverController:shouldDismissVisiblePopover:)])
        {
            [self.delegate presentedNewPopoverController:notification.object
                             shouldDismissVisiblePopover:self];
        }
    }
}

-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
    if(object == _viewController && [keyPath isEqualToString:@"title"])
    {
        _contentView.title = _viewController.title;
        [_contentView setNeedsDisplay];
    }
}

#pragma mark Space management

-(CGRect)bestArrowDirectionAndFrameFromView:(UIView*)v
{
    // thanks @Niculcea
    // If we presentFromPoint with _fromView nil will calculate based on self.orgin with 2x2 size.
    // Fix for presentFromPoint from avolovoy's FPPopover fork
    float width = 2.0f;
    float height = 2.0f;
    CGPoint p = CGPointMake(self.origin.x, self.origin.y);

    if (v != nil) {
        p = [v.superview convertPoint:v.frame.origin toView:self.view];
        width = v.frame.size.width;
        height = v.frame.size.height;
    }

    CGFloat ht = p.y; //available vertical space on top of the view
    CGFloat hb = [self parentHeight] -  (p.y + v.frame.size.height); //on the bottom
    CGFloat wl = p.x; //on the left
    CGFloat wr = [self parentWidth] - (p.x + v.frame.size.width); //on the right

    CGFloat best_h = MAX(ht, hb); //much space down or up ?
    CGFloat best_w = MAX(wl, wr);

    CGRect r;
    r.size = self.contentSize;

    FPPopoverArrowDirection bestDirection;

    //if the user wants vertical arrow, check if the content will fit vertically
    if(FPPopoverArrowDirectionIsVertical(self.arrowDirection) ||
       (self.arrowDirection == FPPopoverArrowDirectionAny && best_h >= best_w))
    {

        //ok, will be vertical
        if(ht == best_h || self.arrowDirection == FPPopoverArrowDirectionDown)
        {
            //on the top and arrow down
            bestDirection = FPPopoverArrowDirectionDown;

            r.origin.x = p.x + v.frame.size.width/2.0 - r.size.width/2.0;
            r.origin.y = p.y - r.size.height;
        }
        else
        {
            //on the bottom and arrow up
            bestDirection = FPPopoverArrowDirectionUp;

            r.origin.x = p.x + v.frame.size.width/2.0 - r.size.width/2.0;
            r.origin.y = p.y + v.frame.size.height;
        }

    }

    else
    {
        //ok, will be horizontal
        //the arrow must NOT be forced to left
        if((wl == best_w || self.arrowDirection == FPPopoverArrowDirectionRight) && self.arrowDirection != FPPopoverArrowDirectionLeft)
        {
            //on the left and arrow right
            bestDirection = FPPopoverArrowDirectionRight;

            r.origin.x = p.x - r.size.width;
            r.origin.y = p.y + v.frame.size.height/2.0 - r.size.height/2.0;

        }
        else
        {
            //on the right then arrow left
            bestDirection = FPPopoverArrowDirectionLeft;

            r.origin.x = p.x + v.frame.size.width;
            r.origin.y = p.y + v.frame.size.height/2.0 - r.size.height/2.0;
        }

    }

    //need to moved left ?
    if(r.origin.x + r.size.width > [self parentWidth])
    {
        r.origin.x = [self parentWidth] - r.size.width;
    }

    //need to moved right ?
    else if(r.origin.x < 0)
    {
        r.origin.x = 0;
    }

    //need to move up?
    if(r.origin.y < 0)
    {
        CGFloat old_y = r.origin.y;
        r.origin.y = 0;
        r.size.height += old_y;
    }

    //need to be resized horizontally ?
    if(r.origin.x + r.size.width > [self parentWidth])
    {
        r.size.width = [self parentWidth] - r.origin.x;
    }

    //need to be resized vertically ?
    if(r.origin.y + r.size.height > [self parentHeight])
    {
        r.size.height = [self parentHeight] - r.origin.y;
    }

    if([[UIApplication sharedApplication] isStatusBarHidden] == NO)
    {
        if(r.origin.y <= 20) r.origin.y += 20;
    }

    //check if the developer wants and arrow
    if(self.arrowDirection != FPPopoverNoArrow)
        _contentView.arrowDirection = bestDirection;

    //no arrow
    else _contentView.arrowDirection = FPPopoverNoArrow;

    //using the frame calculated
    _contentView.frame = r;

    self.origin = CGPointMake(p.x + v.frame.size.width/2.0, p.y + v.frame.size.height/2.0);
    _contentView.relativeOrigin = [_parentView convertPoint:self.origin toView:_contentView];

    return r;
}

-(void)setShadowsHidden:(BOOL)hidden
{
    _shadowsHidden = hidden;
    if(hidden)
    {
        _contentView.layer.shadowOpacity = 0;
        _contentView.layer.shadowRadius = 0;
        _contentView.layer.shadowOffset = CGSizeMake(0, 0);
        _shadowColor = CGColorRetain(_contentView.layer.shadowColor);
        _contentView.layer.shadowColor = nil;
    }
    else
    {
        _contentView.layer.shadowOpacity = 0.7;
        _contentView.layer.shadowRadius = 5;
        _contentView.layer.shadowOffset = CGSizeMake(-3, 3);
        _contentView.layer.shadowColor = _shadowColor;
        if(_shadowColor)
        {
            CGColorRelease(_shadowColor);
            _shadowColor=nil;
        }
    }
}

#pragma mark 3D Border

-(void)setBorder:(BOOL)border
{
    _border = border;
    _contentView.border = border;
    [_contentView setNeedsDisplay];
}

#pragma mark Transparency
-(void)setAlpha:(CGFloat)alpha
{
    _alpha = alpha;
    self.view.alpha = alpha;
}

@end


text:
package rbxmk

import (
	"io"

	"github.com/anaminus/rbxmk/dump"
	"github.com/anaminus/rbxmk/rtypes"
	"github.com/robloxapi/types"
)

// Format defines a format for encoding between a sequence of bytes and a
// types.Value. The format can be registered with a World.
type Format struct {
	// Name is the name that identifies the format. The name matches a file
	// extension.
	Name string

	// EncodeTypes is an optional list of types that Encode can receive. These
	// are called with State.PullAnyOf to reflect the value to a type known by
	// the encoder. If empty, then the value is pulled as Variant.
	EncodeTypes []string

	// MediaTypes is a list of media types that are associated with the format,
	// to be used by sources as needed.
	MediaTypes []string

	// Options maps a field name to a number of value types. A FormatOptions
	// received by Encode or Decode will have only these fields. The value of a
	// field, if it exists, will be one of the specified type.
	Options map[string][]string

	// CanDecode returns whether the format decodes into the given type.
	CanDecode func(g rtypes.Global, opt FormatOptions, typeName string) bool

	// Encode receives a value of one of a number of types and encodes it as a
	// sequence of bytes written to w.
	Encode func(g rtypes.Global, opt FormatOptions, w io.Writer, v types.Value) error

	// Decode receives a sequence of bytes read from r, and decodes it into a
	// value of a single type.
	Decode func(g rtypes.Global, opt FormatOptions, r io.Reader) (types.Value, error)

	// Dump returns a description of the format.
	Dump func() dump.Format

	// Types returns a list of type reflectors expected by the format. Before
	// registering the format, each reflector is registered.
	Types []func() Reflector
}

// FormatOptions contains options to be passed to a Format.
type FormatOptions interface {
	// ValueOf returns the value of field. Returns nil if the value does not
	// exist.
	ValueOf(field string) types.Value
}

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using RolePlayingGameData;
#endregion

namespace RolePlaying
{
    /// <summary>
    /// Displays the gear in the party inventory and allows the user to sell them.
    /// </summary>
    class StoreSellScreen : InventoryScreen
    {
        #region Graphics Data

        /// <summary>
        /// The left-facing quantity arrow.
        /// </summary>
        private Texture2D leftQuantityArrow;

        /// <summary>
        /// The right-facing quantity arrow.
        /// </summary>
        private Texture2D rightQuantityArrow;

        #endregion

        #region Columns

        private const int nameColumnInterval = 80;
        private const int powerColumnInterval = 270;
        private const int quantityColumnInterval = 340;

        private string priceColumnText = "Price";
        private const int priceColumnInterval = 120;

        #endregion

        #region Data Access

        /// <summary>
        /// The store whose goods are being displayed.
        /// </summary>
        private Store store;

        /// <summary>
        /// The selected quantity of the current entry.
        /// </summary>
        private int selectedQuantity = 0;

        /// <summary>
        /// Resets the selected quantity to the maximum value for the selected entry.
        /// </summary>
        private void ResetQuantities()
        {
            selectedQuantity = 1;
        }

        #endregion

        #region List Navigation

        /// <summary>
        /// Move the current selection up one entry.
        /// </summary>
        protected override void MoveCursorUp()
        {
            base.MoveCursorUp();
            ResetQuantities();
        }

        /// <summary>
        /// Move the current selection down one entry.
        /// </summary>
        protected override void MoveCursorDown()
        {
            base.MoveCursorDown();
            ResetQuantities();
        }

        /// <summary>
        /// Decrease the selected quantity by one.
        /// </summary>
        protected override void MoveCursorLeft()
        {
            ReadOnlyCollection<ContentEntry<Gear>> entries = GetDataList();
            if (entries.Count > 0)
            {
                // loop to one if the selected quantity is already at maximum.
                if (selectedQuantity > 1)
                {
                    selectedQuantity--;
                }
                else
                {
                    selectedQuantity = entries[SelectedIndex].Count;
                }
            }
            else
            {
                selectedQuantity = 0;
            }
        }

        /// <summary>
        /// Increase the selected quantity by one.
        /// </summary>
        protected override void MoveCursorRight()
        {
            ReadOnlyCollection<ContentEntry<Gear>> entries = GetDataList();
            if (entries.Count > 0)
            {
                // loop to one if the selected quantity is already at maximum.
                selectedQuantity = selectedQuantity < entries[SelectedIndex].Count ?
                    selectedQuantity + 1 : 1;
            }
            else
            {
                selectedQuantity = 0;
            }
        }

        #endregion

        #region Initialization

        /// <summary>
        /// Creates a new StoreSellScreen object for the given store.
        /// </summary>
        public StoreSellScreen(Store store)
            : base(true)
        {
            // check the parameter
            if ((store == null) || (store.StoreCategories.Count <= 0))
            {
                throw new ArgumentNullException("store");
            }
            this.store = store;

            // configure the menu text
            selectButtonText = "Sell";
            backButtonText = "Back";
            xButtonText = String.Empty;
            yButtonText = String.Empty;

            ResetQuantities();
        }

        /// <summary>
        /// Load the graphics content from the content manager.
        /// </summary>
        public override void LoadContent()
        {
            base.LoadContent();

            ContentManager content = ScreenManager.Game.Content;

            leftQuantityArrow =
                content.Load<Texture2D>(@"Textures\Buttons\QuantityArrowLeft");
            rightQuantityArrow =
                content.Load<Texture2D>(@"Textures\Buttons\QuantityArrowRight");
        }

        #endregion

        #region Input Handling

        /// <summary>
        /// Respond to the triggering of the Select action.
        /// </summary>
        protected override void SelectTriggered(ContentEntry<Gear> entry)
        {
            // check the parameter
            if ((entry == null) || (entry.Content == null))
            {
                return;
            }

            // make sure the selected quantity is valid
            selectedQuantity = Math.Min(selectedQuantity, entry.Count);

            // add the gold to the party's inventory
            Session.Party.PartyGold += selectedQuantity *
                (int)Math.Ceiling(entry.Content.GoldValue * store.SellMultiplier);

            // remove the items from the party's inventory
            Session.Party.RemoveFromInventory(entry.Content, selectedQuantity);

            // reset the quantities - either gold has gone down or the total was bad
            ResetQuantities();
        }

        /// <summary>
        /// Switch to the previous store category.
        /// </summary>
        protected override void PageScreenLeft()
        {
            isItems = !isItems;
            ResetTriggerText();
            ResetQuantities();
        }

        /// <summary>
        /// Switch to the next store category.
        /// </summary>
        protected override void PageScreenRight()
        {
            isItems = !isItems;
            ResetTriggerText();
            ResetQuantities();
        }

        /// <summary>
        /// Reset the trigger button text to the names of the
        /// previous and next UI screens.
        /// </summary>
        protected override void ResetTriggerText()
        {
            leftTriggerText = rightTriggerText = isItems ? "Equipment" : "Items";
        }

        #endregion

        #region Drawing

        /// <summary>
        /// Draw the entry at the given position in the list.
        /// </summary>
        /// <param name="contentEntry">The entry to draw.</param>
        /// <param name="position">The position to draw the entry at.</param>
        /// <param name="isSelected">If true, this item is selected.</param>
        protected override void DrawEntry(ContentEntry<Gear> entry, Vector2 position,
            bool isSelected)
        {
            // check the parameter
            if ((entry == null) || (entry.Content == null))
            {
                throw new ArgumentNullException("entry");
            }

            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
            Vector2 drawPosition = position;

            // draw the icon
            spriteBatch.Draw(entry.Content.IconTexture, drawPosition + iconOffset,
                Color.White);

            // draw the name
            Color color = isSelected ? Fonts.HighlightColor : Fonts.DisplayColor;
            drawPosition.Y += listLineSpacing / 4;
            drawPosition.X += nameColumnInterval;
            spriteBatch.DrawString(Fonts.GearInfoFont, entry.Content.Name,
                drawPosition, color);

            // draw the power
            drawPosition.X += powerColumnInterval;
            string powerText = entry.Content.GetPowerText();
            Vector2 powerTextSize = Fonts.GearInfoFont.MeasureString(powerText);
            Vector2 powerPosition = drawPosition;
            powerPosition.Y -= (float)Math.Ceiling((powerTextSize.Y - 30f) / 2);
            spriteBatch.DrawString(Fonts.GearInfoFont, powerText,
                powerPosition, color);

            // draw the quantity
            drawPosition.X += quantityColumnInterval;
            if (isSelected)
            {
                Vector2 quantityPosition = drawPosition;
                // draw the left selection arrow
                quantityPosition.X -= leftQuantityArrow.Width;
                spriteBatch.Draw(leftQuantityArrow,
                    new Vector2(quantityPosition.X, quantityPosition.Y - 4),
                    Color.White);
                quantityPosition.X += leftQuantityArrow.Width;
                // draw the selected quantity ratio
                string quantityText = selectedQuantity.ToString() + "/" +
                    entry.Count.ToString();
                spriteBatch.DrawString(Fonts.GearInfoFont, quantityText,
                    quantityPosition, color);
                quantityPosition.X +=
                    Fonts.GearInfoFont.MeasureString(quantityText).X;
                // draw the right selection arrow
                spriteBatch.Draw(rightQuantityArrow,
                    new Vector2(quantityPosition.X, quantityPosition.Y - 4),
                    Color.White);
                quantityPosition.X += rightQuantityArrow.Width;
                // draw the purchase button
                selectButtonText = "Sell";
            }
            else
            {
                spriteBatch.DrawString(Fonts.GearInfoFont, entry.Count.ToString(),
                    drawPosition, color);
            }

            // draw the price
            drawPosition.X += priceColumnInterval;
            string priceText = String.Empty;
            if (isSelected)
            {
                int totalPrice = selectedQuantity *
                    (int)Math.Ceiling(entry.Content.GoldValue * store.SellMultiplier);
                priceText = totalPrice.ToString();
            }
            else
            {
                priceText = ((int)Math.Ceiling(entry.Content.GoldValue *
                    store.SellMultiplier)).ToString();
            }
            spriteBatch.DrawString(Fonts.GearInfoFont, priceText,
                drawPosition, color);
        }

        /// <summary>
        /// Draw the description of the selected item.
        /// </summary>
        protected override void DrawSelectedDescription(ContentEntry<Gear> entry)
        {
            // check the parameter
            if ((entry == null) || (entry.Content == null))
            {
                throw new ArgumentNullException("entry");
            }

            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
            Vector2 position = descriptionTextPosition;

            // draw the description
            // -- it's up to the content owner to fit the description
            string text = entry.Content.Description;
            if (!String.IsNullOrEmpty(text))
            {
                spriteBatch.DrawString(Fonts.DescriptionFont, text, position,
                    Fonts.DescriptionColor);
                position.Y += Fonts.DescriptionFont.LineSpacing;
            }

            // draw the modifiers
            Equipment equipment = entry.Content as Equipment;
            if (equipment != null)
            {
                text = equipment.OwnerBuffStatistics.GetModifierString();
                if (!String.IsNullOrEmpty(text))
                {
                    spriteBatch.DrawString(Fonts.DescriptionFont, text, position,
                        Fonts.DescriptionColor);
                    position.Y += Fonts.DescriptionFont.LineSpacing;
                }
            }

            // draw the restrictions
            text = entry.Content.GetRestrictionsText();
            if (!String.IsNullOrEmpty(text))
            {
                spriteBatch.DrawString(Fonts.DescriptionFont, text, position,
                    Fonts.DescriptionColor);
                position.Y += Fonts.DescriptionFont.LineSpacing;
            }
        }

        /// <summary>
        /// Draw the column headers above the list.
        /// </summary>
        protected override void DrawColumnHeaders()
        {
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
            Vector2 position = listEntryStartPosition;

            position.X += nameColumnInterval;
            if (!String.IsNullOrEmpty(nameColumnText))
            {
                spriteBatch.DrawString(Fonts.CaptionFont, nameColumnText, position,
                    Fonts.CaptionColor);
            }

            position.X += powerColumnInterval;
            if (!String.IsNullOrEmpty(powerColumnText))
            {
                spriteBatch.DrawString(Fonts.CaptionFont, powerColumnText, position,
                    Fonts.CaptionColor);
            }

            position.X += quantityColumnInterval;
            if (!String.IsNullOrEmpty(quantityColumnText))
            {
                spriteBatch.DrawString(Fonts.CaptionFont, quantityColumnText, position,
                    Fonts.CaptionColor);
            }

            position.X += priceColumnInterval;
            if (!String.IsNullOrEmpty(priceColumnText))
            {
                spriteBatch.DrawString(Fonts.CaptionFont, priceColumnText, position,
                    Fonts.CaptionColor);
            }
        }

        #endregion
    }
}


text:
#include <hxcpp.h>

#ifndef INCLUDED_Std
#include <Std.h>
#endif
#ifndef INCLUDED_openfl__v2_gl_GL
#include <openfl/_v2/gl/GL.h>
#endif
#ifndef INCLUDED_openfl__v2_gl_GLObject
#include <openfl/_v2/gl/GLObject.h>
#endif
namespace openfl{
namespace _v2{
namespace gl{

Void GLObject_obj::__construct(int version,Dynamic id)
{
HX_STACK_FRAME("openfl._v2.gl.GLObject","new",0x00c6546e,"openfl._v2.gl.GLObject.new","openfl/_v2/gl/GLObject.hx",14,0x19c6b463)
HX_STACK_THIS(this)
HX_STACK_ARG(version,"version")
HX_STACK_ARG(id,"id")
{
	HX_STACK_LINE(16)
	this->version = version;
	HX_STACK_LINE(17)
	this->id = id;
}
;
	return null();
}

//GLObject_obj::~GLObject_obj() { }

Dynamic GLObject_obj::__CreateEmpty() { return  new GLObject_obj; }
hx::ObjectPtr< GLObject_obj > GLObject_obj::__new(int version,Dynamic id)
{  hx::ObjectPtr< GLObject_obj > result = new GLObject_obj();
	result->__construct(version,id);
	return result;}

Dynamic GLObject_obj::__Create(hx::DynamicArray inArgs)
{  hx::ObjectPtr< GLObject_obj > result = new GLObject_obj();
	result->__construct(inArgs[0],inArgs[1]);
	return result;}

::String GLObject_obj::getType( ){
	HX_STACK_FRAME("openfl._v2.gl.GLObject","getType",0x352c457e,"openfl._v2.gl.GLObject.getType","openfl/_v2/gl/GLObject.hx",24,0x19c6b463)
	HX_STACK_THIS(this)
	HX_STACK_LINE(24)
	return HX_CSTRING("GLObject");
}

HX_DEFINE_DYNAMIC_FUNC0(GLObject_obj,getType,return )

Void GLObject_obj::invalidate( ){
{
		HX_STACK_FRAME("openfl._v2.gl.GLObject","invalidate",0x7c92532d,"openfl._v2.gl.GLObject.invalidate","openfl/_v2/gl/GLObject.hx",31,0x19c6b463)
		HX_STACK_THIS(this)
		HX_STACK_LINE(31)
		this->id = null();
	}
return null();
}

HX_DEFINE_DYNAMIC_FUNC0(GLObject_obj,invalidate,(void))

bool GLObject_obj::isValid( ){
	HX_STACK_FRAME("openfl._v2.gl.GLObject","isValid",0xe3debbc0,"openfl._v2.gl.GLObject.isValid","openfl/_v2/gl/GLObject.hx",38,0x19c6b463)
	HX_STACK_THIS(this)
	HX_STACK_LINE(38)
	if (((this->id != null()))){
		HX_STACK_LINE(38)
		int _g = ::openfl::_v2::gl::GL_obj::get_version();		HX_STACK_VAR(_g,"_g");
		HX_STACK_LINE(38)
		return (this->version == _g);
	}
	else{
		HX_STACK_LINE(38)
		return false;
	}
	HX_STACK_LINE(38)
	return false;
}

HX_DEFINE_DYNAMIC_FUNC0(GLObject_obj,isValid,return )

bool GLObject_obj::isInvalid( ){
	HX_STACK_FRAME("openfl._v2.gl.GLObject","isInvalid",0x78a05abb,"openfl._v2.gl.GLObject.isInvalid","openfl/_v2/gl/GLObject.hx",45,0x19c6b463)
	HX_STACK_THIS(this)
	HX_STACK_LINE(45)
	return !(this->isValid());
}

HX_DEFINE_DYNAMIC_FUNC0(GLObject_obj,isInvalid,return )

::String GLObject_obj::toString( ){
	HX_STACK_FRAME("openfl._v2.gl.GLObject","toString",0x0f5cd9de,"openfl._v2.gl.GLObject.toString","openfl/_v2/gl/GLObject.hx",50,0x19c6b463)
	HX_STACK_THIS(this)
	HX_STACK_LINE(52)
	::String _g = this->getType();		HX_STACK_VAR(_g,"_g");
	HX_STACK_LINE(52)
	::String _g1 = (_g + HX_CSTRING("("));		HX_STACK_VAR(_g1,"_g1");
	HX_STACK_LINE(52)
	::String _g2 = ::Std_obj::string(this->id);		HX_STACK_VAR(_g2,"_g2");
	HX_STACK_LINE(52)
	::String _g3 = (_g1 + _g2);		HX_STACK_VAR(_g3,"_g3");
	HX_STACK_LINE(52)
	return (_g3 + HX_CSTRING(")"));
}

HX_DEFINE_DYNAMIC_FUNC0(GLObject_obj,toString,return )

bool GLObject_obj::get_invalidated( ){
	HX_STACK_FRAME("openfl._v2.gl.GLObject","get_invalidated",0x733d4b2e,"openfl._v2.gl.GLObject.get_invalidated","openfl/_v2/gl/GLObject.hx",66,0x19c6b463)
	HX_STACK_THIS(this)
	HX_STACK_LINE(66)
	return this->isInvalid();
}

HX_DEFINE_DYNAMIC_FUNC0(GLObject_obj,get_invalidated,return )

bool GLObject_obj::get_valid( ){
	HX_STACK_FRAME("openfl._v2.gl.GLObject","get_valid",0xaebbd3e1,"openfl._v2.gl.GLObject.get_valid","openfl/_v2/gl/GLObject.hx",73,0x19c6b463)
	HX_STACK_THIS(this)
	HX_STACK_LINE(73)
	return this->isValid();
}

HX_DEFINE_DYNAMIC_FUNC0(GLObject_obj,get_valid,return )

GLObject_obj::GLObject_obj()
{
}

void GLObject_obj::__Mark(HX_MARK_PARAMS)
{
	HX_MARK_BEGIN_CLASS(GLObject);
	HX_MARK_MEMBER_NAME(id,"id");
	HX_MARK_MEMBER_NAME(invalidated,"invalidated");
	HX_MARK_MEMBER_NAME(valid,"valid");
	HX_MARK_MEMBER_NAME(version,"version");
	HX_MARK_END_CLASS();
}

void GLObject_obj::__Visit(HX_VISIT_PARAMS)
{
	HX_VISIT_MEMBER_NAME(id,"id");
	HX_VISIT_MEMBER_NAME(invalidated,"invalidated");
	HX_VISIT_MEMBER_NAME(valid,"valid");
	HX_VISIT_MEMBER_NAME(version,"version");
}

Dynamic GLObject_obj::__Field(const ::String &inName,bool inCallProp)
{
	switch(inName.length) {
	case 2:
		if (HX_FIELD_EQ(inName,"id") ) { return id; }
		break;
	case 5:
		if (HX_FIELD_EQ(inName,"valid") ) { return inCallProp ? get_valid() : valid; }
		break;
	case 7:
		if (HX_FIELD_EQ(inName,"version") ) { return version; }
		if (HX_FIELD_EQ(inName,"getType") ) { return getType_dyn(); }
		if (HX_FIELD_EQ(inName,"isValid") ) { return isValid_dyn(); }
		break;
	case 8:
		if (HX_FIELD_EQ(inName,"toString") ) { return toString_dyn(); }
		break;
	case 9:
		if (HX_FIELD_EQ(inName,"isInvalid") ) { return isInvalid_dyn(); }
		if (HX_FIELD_EQ(inName,"get_valid") ) { return get_valid_dyn(); }
		break;
	case 10:
		if (HX_FIELD_EQ(inName,"invalidate") ) { return invalidate_dyn(); }
		break;
	case 11:
		if (HX_FIELD_EQ(inName,"invalidated") ) { return inCallProp ? get_invalidated() : invalidated; }
		break;
	case 15:
		if (HX_FIELD_EQ(inName,"get_invalidated") ) { return get_invalidated_dyn(); }
	}
	return super::__Field(inName,inCallProp);
}

Dynamic GLObject_obj::__SetField(const ::String &inName,const Dynamic &inValue,bool inCallProp)
{
	switch(inName.length) {
	case 2:
		if (HX_FIELD_EQ(inName,"id") ) { id=inValue.Cast< Dynamic >(); return inValue; }
		break;
	case 5:
		if (HX_FIELD_EQ(inName,"valid") ) { valid=inValue.Cast< bool >(); return inValue; }
		break;
	case 7:
		if (HX_FIELD_EQ(inName,"version") ) { version=inValue.Cast< int >(); return inValue; }
		break;
	case 11:
		if (HX_FIELD_EQ(inName,"invalidated") ) { invalidated=inValue.Cast< bool >(); return inValue; }
	}
	return super::__SetField(inName,inValue,inCallProp);
}

void GLObject_obj::__GetFields(Array< ::String> &outFields)
{
	outFields->push(HX_CSTRING("id"));
	outFields->push(HX_CSTRING("invalidated"));
	outFields->push(HX_CSTRING("valid"));
	outFields->push(HX_CSTRING("version"));
	super::__GetFields(outFields);
};

static ::String sStaticFields[] = {
	String(null()) };

#if HXCPP_SCRIPTABLE
static hx::StorageInfo sMemberStorageInfo[] = {
	{hx::fsObject /*Dynamic*/ ,(int)offsetof(GLObject_obj,id),HX_CSTRING("id")},
	{hx::fsBool,(int)offsetof(GLObject_obj,invalidated),HX_CSTRING("invalidated")},
	{hx::fsBool,(int)offsetof(GLObject_obj,valid),HX_CSTRING("valid")},
	{hx::fsInt,(int)offsetof(GLObject_obj,version),HX_CSTRING("version")},
	{ hx::fsUnknown, 0, null()}
};
#endif

static ::String sMemberFields[] = {
	HX_CSTRING("id"),
	HX_CSTRING("invalidated"),
	HX_CSTRING("valid"),
	HX_CSTRING("version"),
	HX_CSTRING("getType"),
	HX_CSTRING("invalidate"),
	HX_CSTRING("isValid"),
	HX_CSTRING("isInvalid"),
	HX_CSTRING("toString"),
	HX_CSTRING("get_invalidated"),
	HX_CSTRING("get_valid"),
	String(null()) };

static void sMarkStatics(HX_MARK_PARAMS) {
	HX_MARK_MEMBER_NAME(GLObject_obj::__mClass,"__mClass");
};

#ifdef HXCPP_VISIT_ALLOCS
static void sVisitStatics(HX_VISIT_PARAMS) {
	HX_VISIT_MEMBER_NAME(GLObject_obj::__mClass,"__mClass");
};

#endif

Class GLObject_obj::__mClass;

void GLObject_obj::__register()
{
	hx::Static(__mClass) = hx::RegisterClass(HX_CSTRING("openfl._v2.gl.GLObject"), hx::TCanCast< GLObject_obj> ,sStaticFields,sMemberFields,
	&__CreateEmpty, &__Create,
	&super::__SGetClass(), 0, sMarkStatics
#ifdef HXCPP_VISIT_ALLOCS
    , sVisitStatics
#endif
#ifdef HXCPP_SCRIPTABLE
    , sMemberStorageInfo
#endif
);
}

void GLObject_obj::__boot()
{
}

} // end namespace openfl
} // end namespace _v2
} // end namespace gl


text:
declare namespace openfl.filters {

	/**
	 * The BitmapFilterQuality class contains values to set the rendering quality
	 * of a BitmapFilter object.
	 */
	export enum BitmapFilterQuality {

		/**
		 * Defines the high quality filter setting.
		 */
		HIGH = 3,

		/**
		 * Defines the medium quality filter setting.
		 */
		MEDIUM = 2,

		/**
		 * Defines the low quality filter setting.
		 */
		LOW = 1

	}

}

export default openfl.filters.BitmapFilterQuality;


text:
<?xml version="1.0" encoding="UTF-8"?>
<routes xmlns="http://symfony.com/schema/routing"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">

    <!-- Subject Routes -->
    <import resource="@SynopsisSubjectBundle/Resources/config/routing/subject.xml" prefix="subjects" />

    <!-- Subject Action Routes -->
    <import resource="@SynopsisSubjectBundle/Resources/config/routing/action.xml" prefix="actions" />
</routes>


text:
package org.springframework.cloud.config.server.environment;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.springframework.cloud.config.environment.Environment;
import org.springframework.cloud.config.environment.PropertySource;
import org.springframework.core.Ordered;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.ResultSetExtractor;
import org.springframework.util.StringUtils;

/**
 * An {@link EnvironmentRepository} that picks up data from a relational database. The
 * database should have a table called "PROPERTIES" with columns "APPLICATION", "PROFILE",
 * "LABEL" (with the usual {@link Environment} meaning), plus "KEY" and "VALUE" for the
 * key and value pairs in {@link Properties} style. Property values behave in the same way
 * as they would if they came from Spring Boot properties files named
 * <code>{application}-{profile}.properties</code>, including all the encryption and
 * decryption, which will be applied as post-processing steps (i.e. not in this repository
 * directly).
 *
 * @author Dave Syer
 *
 */
public class JdbcEnvironmentRepository implements EnvironmentRepository, Ordered {

	private static final Log logger = LogFactory.getLog(JdbcEnvironmentRepository.class);

	private final JdbcTemplate jdbc;

	private final PropertiesResultSetExtractor extractor;

	private int order;

	private String sql;

	private boolean failOnError;

	@Deprecated
	public JdbcEnvironmentRepository(JdbcTemplate jdbc, JdbcEnvironmentProperties properties) {
		this(jdbc, properties, new PropertiesResultSetExtractor());
	}

	public JdbcEnvironmentRepository(JdbcTemplate jdbc, JdbcEnvironmentProperties properties,
			PropertiesResultSetExtractor extractor) {
		this.jdbc = jdbc;
		this.order = properties.getOrder();
		this.sql = properties.getSql();
		this.failOnError = properties.isFailOnError();
		this.extractor = extractor;
	}

	public String getSql() {
		return this.sql;
	}

	public void setSql(String sql) {
		this.sql = sql;
	}

	@Override
	public Environment findOne(String application, String profile, String label) {
		String config = application;
		if (StringUtils.isEmpty(label)) {
			label = "master";
		}
		if (StringUtils.isEmpty(profile)) {
			profile = "default";
		}
		if (!profile.startsWith("default")) {
			profile = "default," + profile;
		}
		String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
		Environment environment = new Environment(application, profiles, label, null, null);
		if (!config.startsWith("application")) {
			config = "application," + config;
		}
		List<String> applications = new ArrayList<>(
				new LinkedHashSet<>(Arrays.asList(StringUtils.commaDelimitedListToStringArray(config))));
		List<String> envs = new ArrayList<>(new LinkedHashSet<>(Arrays.asList(profiles)));
		Collections.reverse(applications);
		Collections.reverse(envs);
		for (String app : applications) {
			for (String env : envs) {
				try {
					Map<String, Object> next = this.jdbc.query(this.sql, this.extractor, app, env, label);
					if (next != null && !next.isEmpty()) {
						environment.add(new PropertySource(app + "-" + env, next));
					}
				}
				catch (DataAccessException e) {
					if (!failOnError) {
						if (logger.isDebugEnabled()) {
							logger.debug("Failed to retrieve configuration from JDBC Repository", e);
						}
					}
					else {
						throw e;
					}
				}
			}
		}
		return environment;
	}

	@Override
	public int getOrder() {
		return this.order;
	}

	public void setOrder(int order) {
		this.order = order;
	}

	public boolean isFailOnError() {
		return failOnError;
	}

	public void setFailOnError(boolean failOnError) {
		this.failOnError = failOnError;
	}

	public static class PropertiesResultSetExtractor implements ResultSetExtractor<Map<String, Object>> {

		@Override
		public Map<String, Object> extractData(ResultSet rs) throws SQLException, DataAccessException {
			Map<String, Object> map = new LinkedHashMap<>();
			while (rs.next()) {
				map.put(rs.getString(1), rs.getString(2));
			}
			return map;
		}

	}

}


text:
{% assign posts=site.posts | where:"ref", page.ref | sort: 'lang' %}
{% for post in posts %}

    {{ post.lang }}

{% endfor %}

{% assign pages=site.pages | where:"ref", page.ref | sort: 'lang' %}
{% for page in pages %}

    {{ page.lang }}

{% endfor %}


text:
@interface OwnerIntegralViewController ()<UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate>
@property (nonatomic,strong)IntegralView *integralView;
@property(nonatomic,copy) UITableView *tableView;
@property(nonatomic,strong) OwnerPointModel *pointModel;

@end

@implementation OwnerIntegralViewController

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self initnavi];
    [[UIApplication sharedApplication] setStatusBarStyle:(UIStatusBarStyleDefault)];
}

- (void)viewDidLoad {
    [super viewDidLoad];

    [self setUI];
    [self loadDataList];
    [self loadData];
}

- (void)initnavi{
    [self initNav:@"积分排行" color:[UIColor whiteColor] imgName:@"back_black"];
    [self rightTitle:@"搜索"];
    [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
    self.navigationController.navigationBar.shadowImage = [UIImage new];

    self.navigationController.navigationBar.translucent = NO;
    self.navigationController.navigationBar.titleTextAttributes = [NSDictionary dictionaryWithObjectsAndKeys:kDarkText,NSForegroundColorAttributeName,[UIFont systemFontOfSize:18],NSFontAttributeName, nil];
    [self.navigationItem.rightBarButtonItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:kDarkText,NSForegroundColorAttributeName,[UIFont systemFontOfSize:15],NSFontAttributeName, nil] forState:(UIControlStateNormal)];
}

- (void)rightAction{
    OwnerSearchMemberViewController *searchVC = [[OwnerSearchMemberViewController alloc] init];
    [self.navigationController pushViewController:searchVC animated:YES];
}

- (void)setUI{
    [self.view addSubview:({
        _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, ScreenW, ScreenH - 64) style:(UITableViewStylePlain)];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.rowHeight = 55;
        [_tableView registerNib:[UINib nibWithNibName:@"OwnerPointTableViewCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"cell"];
        _tableView;
    })];

    [_tableView setTableHeaderView:({
        _integralView = [[[NSBundle mainBundle] loadNibNamed:@"IntegralView" owner:nil options:nil] firstObject];
        _integralView.frame = CGRectMake(0, 0, ScreenW, 385);
        _integralView.icon.image = _icon;
        _integralView.username.text = _name;
        _integralView;
    })];
}

- (void)loadDataList{
    [self.view loadingOnAnyView];
    [HYBNetworking getWithUrl:@"IosIndex/pointList" refreshCache:NO params:nil success:^(id response) {
        SESSIONSTATE state = [Utils getStatus:response View:self showSuccessMsg:NO showErrorMsg:YES];
        if (state == SESSIONSUCCESS) {
            NSError *error;
            _pointModel = [[OwnerPointModel alloc] initWithDictionary:response error:&error];
            if (!error) {
                [_tableView reloadData];
            }
        }
    } fail:^(NSError *error) {
        [self.view removeAnyView];
    }];
}

- (void)loadData{
    [self.view loadingOnAnyView];
    [HYBNetworking getWithUrl:@"IosIndex/myPoint" refreshCache:NO params:@{@"u_id":[Utils getValueForKey:@"u_id"]} success:^(id response) {
        SESSIONSTATE state = [Utils getStatus:response View:self showSuccessMsg:NO showErrorMsg:YES];
        if (state == SESSIONSUCCESS) {
            _integralView.rankingLabel.text = [NSString stringWithFormat:@"第%@名",response[@"data"][@"ming"]];
            _integralView.totalSorce.text = [NSString stringWithFormat:@"%@",response[@"data"][@"zong"]];
            NSMutableArray *nameArr = [NSMutableArray array];
            NSMutableArray *valueArr = [NSMutableArray array];
            for (int i = 1; i < 8; i ++) {
                NSString *key = [NSString stringWithFormat:@"a%d",i];
                NSString *name = response[@"data"][key][@"name"];
                [nameArr addObject:name.length > 0 ? name : @""];
                [valueArr addObject:[response[@"data"][key][@"num"] boolValue] ? response[@"data"][key][@"num"] : @0];
            }
            [_integralView getChartsWithValueArray:valueArr nameArray:nameArr];
        }
    } fail:^(NSError *error) {
        [self.view removeAnyView];
    }];
}

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

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    OwnerPointTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
    [cell cellConfigureModel:_pointModel.data[indexPath.row] index:indexPath.row];
    [cell.support addTarget:self action:@selector(supportMe:) forControlEvents:(UIControlEventTouchUpInside)];
    cell.support.tag = indexPath.row + 100;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 55.0;
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenW, 55)];
    view.backgroundColor = [UIColor whiteColor];
    [view addSubview:({
        UIView *gray = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenW, 8)];
        gray.backgroundColor = [UIColor colorWithHex:0xf2f2f2];
        gray;
    })];

    [view addSubview:({
        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(14, 15, 60, 25)];
        label.text = @"排行榜";
        label.textAlignment = NSTextAlignmentLeft;
        label;
    })];

//    [view addSubview:({
//        UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(90, 15, ScreenW - 105, 30)];
//        textField.placeholder = @"   搜索行业/人名";
//        textField.font = kFont(15);
//        textField.layer.cornerRadius = 5;
//        textField.layer.masksToBounds = YES;
//        textField.borderStyle = UITextBorderStyleNone;
//        textField.layer.borderColor = [UIColor colorWithHex:0xdfdfdf].CGColor;
//        textField.layer.borderWidth = 0.5;
//        textField.delegate = self;
//        textField;
//    })];

    [view addSubview:({
        UIView *gray = [[UIView alloc] initWithFrame:CGRectMake(0, 54, ScreenW, 1)];
        gray.backgroundColor = [UIColor colorWithHex:0xf2f2f2];
        gray;
    })];
    return view;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    OnerInfoViewController *infoVC = [[OnerInfoViewController alloc] init];
    infoVC.oid = [_pointModel.data[indexPath.row] Id];
    [self.navigationController pushViewController:infoVC animated:YES];
}

- (void)supportMe:(UIButton *)btn{

    [self.view Message:@"关注成功" HiddenAfterDelay:1];
}

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{

    return NO;
}

@end


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
null

#### Original name
Loranthus pendens Engl. & K.Krause

### Remarks
null


text:
/*************************************************************************
	File Name   : socketAcceptThunderingHerd.cpp
	Author      : LIZHENG
	Mail        : lizhenghn@gmail.com
	Created Time: Mon 29 Dec 2014 10:21:57 PM CST
 ************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <sys/epoll.h>
#include <netinet/in.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <errno.h>
#include <assert.h>

/**
 * 阻塞方式时,accept好像并不惊群。
 * 比如使用epoll来管理listenfd,如果设置为非阻塞的,可能出现"惊群"现象
 *
 */
int create_master_worker_process(int child_num, void (*callback)(void *));
void child_process_accept(void *);  // just call ::accept
void child_process_epoll(void *);   // create epoll and accept
int createSocketAndListen(const char *ip, int port, int backlog);
int setNonBlocking(int fd, bool nonBlocking/* = true*/);

#define CHILD_PROCESS_USE_EPOLL

int listenfd;
int epfd;   // not use

int main(int argc, char *argv[])
{
    // create listen socket before creating worker process
    listenfd = createSocketAndListen("127.0.0.1", 8888, 5);
    assert(listenfd > 0);

    // // epoll fd create before creating child process
    //epfd = ::epoll_create(1024);
    //assert(epfd > 0 && " epoll create failure!");
    //struct epoll_event ev;
    //ev.data.fd = listenfd;
    //ev.events = EPOLLIN;
    //epoll_ctl(epfd, EPOLL_CTL_ADD, listenfd, &ev);

    // create worker process, and bind callback for accepting client
    #ifdef CHILD_PROCESS_USE_EPOLL
        setNonBlocking(listenfd, true);
        create_master_worker_process(20, child_process_epoll);
    #else
        create_master_worker_process(20, child_process_accept);
    #endif

    return 0;
}

void child_process_accept(void *arg)
{
    int childId = *((int*)arg);
    struct sockaddr_in cliaddr;
    socklen_t clilen = sizeof(cliaddr);
    while(1)
    {
        int connfd = ::accept(listenfd, (struct sockaddr *)&cliaddr, &clilen);
        printf("child[%d] process[%d] : accept [%d], error[%d]\n", childId, ::getpid(), connfd, errno);
        //::close(connfd);
    }
}

void child_process_epoll(void *arg)
{
    int childId = *((int*)arg);
    int epfd = ::epoll_create(1024);
    assert(epfd > 0 && " epoll create failure!");
    struct epoll_event ev;
    ev.data.fd = listenfd;
    ev.events = EPOLLIN;
    epoll_ctl(epfd, EPOLL_CTL_ADD, listenfd, &ev);

    struct epoll_event events[128];
    while(1)
    {
        int nfds = epoll_wait(epfd, events, 128, -1);
        //printf("child[%d] process[%d] : events[%d]\n", childId, ::getpid(), nfds);
        for(int i=0; i < nfds; ++i)
        {
            if(events[i].data.fd == listenfd)
            {
                struct sockaddr_in cliaddr;
                socklen_t clilen = sizeof(cliaddr);
                int connfd = ::accept(listenfd, (struct sockaddr *)&cliaddr, &clilen);
                if(connfd < 0)
                    printf("child[%d] process[%d] : error on epoll accept [%d], error[%d:%s]\n", childId, ::getpid(), connfd, errno, strerror(errno));
                else
                    printf("child[%d] process[%d] : epoll accept [%d], error[%d]\n", childId, ::getpid(), connfd, errno);
            }
        }
    }
}

int create_master_worker_process(int child_num, void (*callback)(void *))
{
    assert(child_num >= 0);
    if(child_num == 0)
    {
        printf("this is father process\n");
        return 0;
    }

    printf("this is master process[%d]\n", ::getpid());

    long childId = 0;
    bool child = false;
    //prefork child
    while(!child)
    {
        if(child_num > 0)    // continue create process
        {
            childId ++;
            switch(fork())
            {
            case -1:         // fork error
                return -1;
            case 0:          // child process, set flag for breaking while-loop
                child = true;
                break;
            default:         // master process
                child_num--;
                break;
            }
        }
        else                 // all children be created, just wait children exit
        {
            int status;
            if(-1 != ::wait(&status))  // one child process exit
            {
                printf("master process: get one child exit\n");
                child_num++;
            }
            else
            {
                switch (errno)
                {
                case EINTR:
                    break;
                default:
                    break;
                }
            }
        }
    } // end of while

    //for the parent this is the exit-point
    if (!child)
    {
        return 0;
    }

    // child process do some work
    printf("this is child[%d], process id[%d], father process id[%d]\n", childId, ::getpid(), ::getppid());
    callback(&childId);
}

int createSocketAndListen(const char *ip, int port, int backlog)
{
    int sockfd = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
    if(sockfd < 0) return sockfd;

    //setNonBlocking(sockfd, true);
    struct sockaddr_in  sockaddr;
    ::memset(&sockaddr, 0, sizeof(sockaddr));
    sockaddr.sin_family = AF_INET;
    sockaddr.sin_port = htons(port);
    int nIP = 0;
    if(!ip || '\0' == *ip || 0 == strcmp(ip, "0")
        || 0 == strcmp(ip, "0.0.0.0") || 0 == strcmp(ip, "*"))
    {
        nIP = htonl(INADDR_ANY);
    }
    else
    {
        nIP = inet_addr(ip);
    }
    sockaddr.sin_addr.s_addr = nIP;

    int optval = 1;
    ::setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *)&optval, sizeof(optval));

    int res = ::bind(sockfd, (struct sockaddr *) &sockaddr, sizeof(sockaddr));
    if(res < 0) return res;

    res = ::listen(sockfd, backlog);
    if(res < 0) return res;

    printf("server socket listening on [%s:%d]\n", ip, port);
    return sockfd;
}

int setNonBlocking(int fd, bool nonBlocking/* = true*/)
{
    int flags = fcntl(fd, F_GETFL);
    if(flags < 0)
        return flags;

    nonBlocking ? flags |= O_NONBLOCK : flags &= (~O_NONBLOCK);
    return fcntl(fd, F_SETFL, flags);
}


text:
<?php

namespace JoliCode\SecretSanta\Model;

class User
{
    private $identifier;
    private $name;
    private $extra;

    /**
     * @param array<string, mixed> $extra
     */
    public function __construct(string $identifier, string $name, array $extra = [])
    {
        $this->identifier = $identifier;
        $this->name = $name;
        $this->extra = $extra;
    }

    public function getIdentifier(): string
    {
        return $this->identifier;
    }

    public function getName(): string
    {
        return $this->name;
    }

    /**
     * @return array<string, mixed>
     */
    public function getExtra(): array
    {
        return $this->extra;
    }
}


text:
<?php

namespace Your\WebApp\Presenters\MyProfile;

use Rhubarb\Crown\Exceptions\ForceResponseException;
use Rhubarb\Crown\Layout\LayoutModule;
use Rhubarb\Crown\Response\RedirectResponse;
use Rhubarb\Patterns\Mvp\Crud\ModelForm\ModelFormPresenter;
use Your\WebApp\Layouts\PortalLayout;
use Your\WebApp\LoginProviders\CustomLoginProvider;

class MyProfileCollectionPresenter extends ModelFormPresenter
{
    public function __construct($name = "")
    {
        LayoutModule::setLayoutClassName( PortalLayout::class );
        parent::__construct($name);
    }

    protected function createView()
    {
        if( !CustomLoginProvider::isAdmin() )
        {
            $user = CustomLoginProvider::getLoggedInUser();
            throw new ForceResponseException( new RedirectResponse( '/users/' . $user->UniqueIdentifier . '/edit/' ) );
        }
        return new MyProfileCollectionView();
    }
}


text:
var tab = require('tabalot')
var fs = require('fs')
var path = require('path')
var gasket = require('./')

process.stdout.setMaxListeners(0)
process.stderr.setMaxListeners(0)
process.stdin.setMaxListeners(0)

process.stdout.on('error', function(err) {
  if (err.code !== 'EPIPE') throw err
})

var help = function(code) {
  console.log(fs.readFileSync(path.join(__dirname, 'help.txt'), 'utf-8'))
  process.exit(code)
}

var onerror = function(err) {
  console.error(err.message || err)
  process.exit(2)
}

var save = function(filename, data) {
  var write = function(data) {
    fs.writeFile(filename, JSON.stringify(data, null, 2), function(err) {
      if (err) return onerror(err)
      process.exit()
    })
  }

  if (path.basename(filename) === 'gasket.json') return write(data)

  fs.readFile(filename, 'utf-8', function(err, pkg) {
    if (err) return onerror(err)
    try {
      pkg = JSON.parse(pkg)
    } catch (err) {
      return onerror(err)
    }
    pkg.gasket = data
    write(pkg)
  })
}

var load = function(opts, cb) {
  gasket.load(opts.config, function(err, g) {
    if (err) return onerror(err)
    cb(g)
  })
}

// completions

var bin = function(cb) {
  fs.readdir('node_modules/.bin', cb)
}

var pipes = function(pipe, opts, cb) {
  load(opts, function(gasket) {
    cb(null, gasket.list().filter(function(pipe) {
      return opts._.indexOf(pipe, 1) === -1
    }))
  })
}

// commands

tab()
  ('--config', '-c', '@file')

tab('ls')
  (function(opts) {
    load(opts, function(gasket) {
      console.log(gasket.list().join('\n'))
    })
  })

tab('exec')
  ('*', bin)
  (function(opts) {
    if (opts._.length < 2) return onerror('Usage: gasket exec [commands...]')
    process.stdin
      .pipe(gasket().exec(opts._.slice(1).join(' '), opts['--'] || [], {stderr:true})).on('end', process.exit)
      .pipe(process.stdout)
  })

tab('version')
  (function() {
    console.log(require('./package.json').version)
  })

tab('help')
  (function() {
    help(0)
  })

tab('add')
  (pipes)
  ('*', bin)
  (function(pipe, opts) {
    if (!pipe || opts._.length < 3) return onerror('Usage: gasket add [pipe] [command]')

    load(opts, function(gasket) {
      var data = gasket.toJSON()
      if (!data[pipe]) data[pipe] = []
      data[pipe].push(opts._.slice(2).join(' '))
      save(gasket.config, data)
    })
  })

tab('show')
  (pipes)
  (function(pipe, opts) {
    if (!pipe) pipe = 'main'
    load(opts, function(gasket) {
      pipe = (gasket.toJSON()[pipe] || [])
        .map(function(line) {
          return line ? (' | '+line) : '\n'
        })
        .join('').split('\n')
        .map(function(line) {
          return line.replace(/^ \| /, '')
        })
        .join('\n').trim()

      console.log(pipe)
    })
  })

tab('rm')
  (pipes)
  (function(pipe, opts) {
    if (!pipe) return onerror('Usage: gasket rm [pipe]')

    load(opts, function(gasket) {
      var data = gasket.toJSON()
      delete data[pipe]
      save(gasket.config, data)
    })
  })

tab('run')
  ('*', pipes)
  (function(opts) {
    var names = opts._.slice(1)
    if (!names.length) names = ['main']

    load(opts, function(gasket) {
      var first = true
      var loop = function() {
        var name = names.shift()
        if (!name) return process.exit()

        if (!gasket.has(name)) {
          if (name !== 'main') console.error(name+' does not exist')
          return loop()
        }

        var t = gasket.run(name, opts['--'] || [], {stderr:true})

        t.pipe(process.stdout)
        t.on('end', loop)
      }

      loop()
    })
  })

tab('pipe')
  ('*', pipes)
  (function(opts) {
    var names = opts._.slice(1)
    if (!names.length) names = ['main']

    load(opts, function(gasket) {
      var streams = names
        .map(function(name) {
          if (!gasket.has(name)) {
            if (name !== 'main') console.error(name+' does not exist')
            return null
          }
          return gasket.pipe(name, opts['--'] || [], {stderr:true})
        })
        .filter(function(s) {
          return s
        })

      if (!streams.length) return

      var last = [process.stdin].concat(streams).concat(process.stdout).reduce(function(a, b) {
        return a.pipe(b)
      })

      last.on('end', function() {
        process.exit(0)
      })
    })
  })

tab.parse({'--':true}) || help(1)


text:
package pl.zankowski.iextrading4j.api.stocks;

import com.flextrade.jfixture.JFixture;
import nl.jqno.equalsverifier.EqualsVerifier;
import org.junit.jupiter.api.Test;
import pl.zankowski.iextrading4j.api.util.ToStringVerifier;

import java.math.BigDecimal;
import java.time.LocalDate;

import static org.assertj.core.api.Assertions.assertThat;

class EarningTest {

    private final JFixture fixture = new JFixture();

    @Test
    void constructor() {
        final BigDecimal actualEPS = fixture.create(BigDecimal.class);
        final BigDecimal consensusEPS = fixture.create(BigDecimal.class);
        final BigDecimal estimatedEPS = fixture.create(BigDecimal.class);
        final String announceTime = fixture.create(String.class);
        final BigDecimal numberOfEstimates = fixture.create(BigDecimal.class);
        final BigDecimal EPSSurpriseDollar = fixture.create(BigDecimal.class);
        final LocalDate EPSReportDate = fixture.create(LocalDate.class);
        final String fiscalPeriod = fixture.create(String.class);
        final LocalDate fiscalEndDate = fixture.create(LocalDate.class);
        final BigDecimal yearAgo = fixture.create(BigDecimal.class);
        final BigDecimal yearAgoChangePercent = fixture.create(BigDecimal.class);
        final String currency = fixture.create(String.class);

        final Earning earning = new Earning(actualEPS, consensusEPS, estimatedEPS, announceTime,
                numberOfEstimates, EPSSurpriseDollar, EPSReportDate, fiscalPeriod, fiscalEndDate,
                yearAgo, yearAgoChangePercent, currency);

        assertThat(earning.getActualEPS()).isEqualTo(actualEPS);
        assertThat(earning.getConsensusEPS()).isEqualTo(consensusEPS);
        assertThat(earning.getEstimatedEPS()).isEqualTo(estimatedEPS);
        assertThat(earning.getAnnounceTime()).isEqualTo(announceTime);
        assertThat(earning.getNumberOfEstimates()).isEqualTo(numberOfEstimates);
        assertThat(earning.getEPSSurpriseDollar()).isEqualTo(EPSSurpriseDollar);
        assertThat(earning.getEPSReportDate()).isEqualTo(EPSReportDate);
        assertThat(earning.getFiscalPeriod()).isEqualTo(fiscalPeriod);
        assertThat(earning.getFiscalEndDate()).isEqualTo(fiscalEndDate);
        assertThat(earning.getYearAgo()).isEqualByComparingTo(yearAgo);
        assertThat(earning.getYearAgoChangePercent()).isEqualByComparingTo(yearAgoChangePercent);
        assertThat(earning.getCurrency()).isEqualTo(currency);
    }

    @Test
    void equalsContract() {
        EqualsVerifier.forClass(Earning.class)
                .usingGetClass()
                .verify();
    }

    @Test
    void toStringVerification() {
        ToStringVerifier.forObject(fixture.create(Earning.class))
                .verify();
    }

}


text:
package org.waveprotocol.wave.model.document.operation.impl;

import org.waveprotocol.wave.model.document.operation.AnnotationBoundaryMap;
import org.waveprotocol.wave.model.document.operation.Attributes;
import org.waveprotocol.wave.model.document.operation.BufferedDocInitialization;
import org.waveprotocol.wave.model.document.operation.impl.OperationComponents.AnnotationBoundary;
import org.waveprotocol.wave.model.document.operation.impl.OperationComponents.Characters;
import org.waveprotocol.wave.model.document.operation.impl.OperationComponents.DocInitializationComponent;
import org.waveprotocol.wave.model.document.operation.impl.OperationComponents.DocOpComponent;
import org.waveprotocol.wave.model.document.operation.impl.OperationComponents.ElementEnd;
import org.waveprotocol.wave.model.document.operation.impl.OperationComponents.ElementStart;

import java.util.ArrayList;

/**
 * A builder for {@link BufferedDocInitialization}s.
 *
 * Use {@link DocInitializationBuffer} instead if you need an implementation of
 * the interface
 * {@link org.waveprotocol.wave.model.document.operation.EvaluatingDocOpCursor}.
 */
public class DocInitializationBuilder {
  private static final DocInitializationComponent[] EMPTY_ARRAY =
      new DocInitializationComponent[0];

  private final ArrayList<DocOpComponent> accu = new ArrayList<DocOpComponent>();

  /**
   * Constructs an operation from this builder's state.
   *
   * Behaviour is undefined if this builder is used after calling this method.
   */
  public final BufferedDocInitialization build() {
    // TODO: This should not need a call to asInitialization().
    return DocOpUtil.asInitialization(BufferedDocOpImpl.create(accu.toArray(EMPTY_ARRAY)));
  }

  /** @see #build() */
  // This is dangerous; we currently use it for ill-formedness-detection
  // tests, and may use it for efficiency in other places in the future.
  public final BufferedDocInitialization buildUnchecked() {
    // TODO: This should not need a call to asInitialization().
    return DocOpUtil.asInitialization(BufferedDocOpImpl.createUnchecked(accu.toArray(EMPTY_ARRAY)));
  }

  public final DocInitializationBuilder annotationBoundary(AnnotationBoundaryMap map) {
    accu.add(new AnnotationBoundary(map));
    return this;
  }
  public final DocInitializationBuilder characters(String s) {
    accu.add(new Characters(s));
    return this;
  }
  public final DocInitializationBuilder elementEnd() {
    accu.add(ElementEnd.INSTANCE);
    return this;
  }
  public final DocInitializationBuilder elementStart(String type, Attributes attrs) {
    accu.add(new ElementStart(type, attrs));
    return this;
  }
}


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

describe "comamnd spec" do
  subject{ c = Eye::Controller.new; c.load(fixture("dsl/load.eye")); c }

  before :each do
    @apps = subject.applications

    @app1 = @apps.first
    @app2 = @apps.last

    @gr1 = @app1.groups[0]
    @gr2 = @app1.groups[1]
    @gr3 = @app1.groups[2]
    @gr4 = @app2.groups[0]

    @p1 = @gr1.processes[0]
    @p2 = @gr1.processes[1]
    @p3 = @gr2.processes[0]
    @p4 = @gr3.processes[0]
    @p5 = @gr3.processes[1]
    @p6 = @gr4.processes[0]
  end

  describe "remove objects" do
    it "remove app" do
      subject.remove_object_from_tree(@app2)
      subject.applications.size.should == 1
      subject.applications.first.should == @app1
    end

    it "remove group" do
      subject.remove_object_from_tree(@gr1)
      @app1.groups.should_not include(@gr1)

      subject.remove_object_from_tree(@gr2)
      @app1.groups.should_not include(@gr2)

      subject.remove_object_from_tree(@gr3)
      @app1.groups.should_not include(@gr3)

      @app1.groups.should be_empty
    end

    it "remove process" do
      subject.remove_object_from_tree(@p1)
      @gr1.processes.should_not include(@p1)

      subject.remove_object_from_tree(@p2)
      @gr1.processes.should_not include(@p2)

      @gr1.processes.should be_empty
    end
  end

  it "unknown" do
    subject.load(fixture("dsl/load.eye")).should_be_ok
    subject.command(:st33art, "2341234").should == :unknown_command
  end

  it "ping" do
    subject.command(:ping).should == :pong
  end

  it "quit" do
    mock(Eye::System).send_signal($$, :TERM)
    mock(Eye::System).send_signal($$, :KILL)
    subject.command(:quit)
  end

  describe "send_command" do
    it "command load" do
      res = subject.command(:load, fixture("dsl/load.eye"))
      res.class.should == Hash
    end

    it "nothing" do
      subject.load(fixture("dsl/load.eye")).should_be_ok
      subject.send_command(:start, "2341234").should == {:result => []}
    end

    it "unknown" do
      subject.load(fixture("dsl/load.eye")).should_be_ok
      subject.send_command(:st33art, "2341234").should == {:result=>[]}
    end

    [:start, :stop, :restart, :unmonitor].each do |cmd|
      it "should send_command #{cmd}" do
        sleep 0.3
        any_instance_of(Eye::Process) do |p|
          dont_allow(p).send_command(cmd)
        end

        mock(@p1).send_command(cmd)

        subject.send_command cmd, "p1", :some_flag => true
      end
    end

    it "unmonitor group" do
      sleep 0.5
      cmd = :unmonitor

      subject.send_command cmd, "gr1"
      sleep 0.5

      @p1.schedule_history.states.should == [:monitor, :unmonitor]
      @p2.schedule_history.states.should == [:monitor, :unmonitor]
      @p3.schedule_history.states.should == [:monitor]
    end

    it "stop group with skip_group_action for @p2" do
      sleep 0.5
      cmd = :stop

      stub(@p2).skip_group_action?(:stop) { true }

      subject.send_command cmd, "gr1"
      sleep 0.5

      @p1.schedule_history.states.should == [:monitor, :stop]
      @p2.schedule_history.states.should == [:monitor]
      @p3.schedule_history.states.should == [:monitor]
    end

    it "delete obj" do
      sleep 0.5
      any_instance_of(Eye::Process) do |p|
        dont_allow(p).send_command(:delete)
      end

      mock(@p1).send_command(:delete)
      subject.send_command :delete, "p1"

      subject.all_processes.should_not include(@p1)
      subject.all_processes.should include(@p2)
    end
  end

end


text:
    Master

    Framework
    {{framework.id}}

  <button class="close" data-dismiss="alert">×</button>
  {{alert_message}}

Name:

{{framework.name}}

User:

{{framework.user}}

Registered:

          <m-timestamp value="{{framework.registered_time * 1000}}"></m-timestamp>

Re-registered:

-

          <m-timestamp value="{{framework.reregistered_time * 1000}}"></m-timestamp>

Active tasks:

{{framework.tasks.length | number}}

CPUs:

{{framework.resources.cpus | number}}

Mem:

{{framework.resources.mem * (1024 * 1024) | dataSize}}

          ID
          Name
          State
          Started
          Host

              {{task.id}}

          {{task.name}}
          {{task.state | truncateMesosState}}

            <m-timestamp value="{{task.start_time}}"></m-timestamp>

              {{slaves[task.slave_id].hostname}}

              Slave offline

              Sandbox

              Slave offline

          ID
          Name
          State
          Started
          Stopped
          Host

          {{task.id}}
          {{task.name}}
          {{task.state | truncateMesosState}}

            <m-timestamp value="{{task.start_time}}"></m-timestamp>

            <m-timestamp value="{{task.finish_time}}"></m-timestamp>

              {{slaves[task.slave_id].hostname}}

              Slave offline

              Sandbox

              Slave offline


text:
import logging

try:
    import psycopg2 as Database
except ImportError, e:
    from django.core.exceptions import ImproperlyConfigured
    raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)

from librdbms.server.rdbms_base_lib import BaseRDBMSDataTable, BaseRDBMSResult, BaseRDMSClient

LOG = logging.getLogger(__name__)

class DataTable(BaseRDBMSDataTable): pass

class Result(BaseRDBMSResult): pass

class PostgreSQLClient(BaseRDMSClient):
  """Same API as Beeswax"""

  data_table_cls = DataTable
  result_cls = Result

  def __init__(self, *args, **kwargs):
    super(PostgreSQLClient, self).__init__(*args, **kwargs)
    self.connection = Database.connect(**self._conn_params)

  @property
  def _conn_params(self):
    params = {
      'user': self.query_server['username'],
      'password': self.query_server['password'],
      'host': self.query_server['server_host'],
      'port': self.query_server['server_port'] == 0 and 5432 or self.query_server['server_port'],
      'database': self.query_server['name']
    }

    if self.query_server['options']:
      params.update(self.query_server['options'])
      # handle transaction commits manually.
      if 'autocommit' in params:
        del params['autocommit']

    return params

  def use(self, database):
    # No op since postgresql requires a new connection per database
    pass

  def execute_statement(self, statement):
    cursor = self.connection.cursor()
    cursor.execute(statement)
    self.connection.commit()
    if cursor.description:
      columns = [column[0] for column in cursor.description]
    else:
      columns = []
    return self.data_table_cls(cursor, columns)

  def get_databases(self):
    # List all the schemas in the database
    cursor = self.connection.cursor()
    cursor.execute('SELECT schema_name FROM information_schema.schemata')
    self.connection.commit()
    return [row[0] for row in cursor.fetchall()]

  def get_tables(self, database, table_names=[]):
    cursor = self.connection.cursor()
    cursor.execute("SELECT table_name FROM information_schema.tables WHERE table_schema='%s'" % database)
    self.connection.commit()
    return [row[0] for row in cursor.fetchall()]

  def get_columns(self, database, table):
    cursor = self.connection.cursor()
    cursor.execute("SELECT column_name FROM information_schema.columns WHERE table_schema='%s' and table_name='%s'" % (database, table))
    self.connection.commit()
    return [row[0] for row in cursor.fetchall()]


text:
class ThinkingSphinx::ActiveRecord::Associations
  JoinDependency = ::ActiveRecord::Associations::JoinDependency

  attr_reader :model

  def initialize(model)
    @model = model
    @joins = ActiveSupport::OrderedHash.new
  end

  def add_join_to(stack)
    join_for(stack)
  end

  def aggregate_for?(stack)
    return false if stack.empty?

    joins_for(stack).compact.any? { |join|
      [:has_many, :has_and_belongs_to_many].include?(
        join.reflection.macro
      )
    }
  end

  def alias_for(stack)
    return model.quoted_table_name if stack.empty?

    join_for(stack).aliased_table_name
  end

  def join_values
    @joins.values.compact
  end

  def model_for(stack)
    return model if stack.empty?

    join = join_for(stack)
    join.nil? ? nil : join.reflection.klass
  end

  private

  def base
    @base ||= JoinDependency.new model, [], []
  end

  def join_for(stack)
    @joins[stack] ||= begin
      reflection = reflection_for stack
      reflection.nil? ? nil : JoinDependency::JoinAssociation.new(
        reflection, base, parent_join_for(stack)
      ).tap { |join|
        join.join_type = Arel::OuterJoin

        rewrite_conditions_for join
      }
    end
  end

  def joins_for(stack)
    if stack.length == 1
      [join_for(stack)]
    else
      [joins_for(stack[0..-2]), join_for(stack)].flatten
    end
  end

  def parent_for(stack)
    stack.length == 1 ? base : join_for(stack[0..-2])
  end

  def parent_join_for(stack)
    stack.length == 1 ? base.join_base : parent_for(stack)
  end

  def reflection_for(stack)
    parent_for(stack).active_record.reflections[stack.last]
  end

  def rewrite_conditions_for(join)
    conditions = Array(join.conditions).flatten
    conditions.each do |condition|
      next unless condition.is_a?(String)

      condition.gsub! /::ts_join_alias::/,
        model.connection.quote_table_name(join.parent.aliased_table_name)
    end
  end
end


text:
package com.google.devtools.intellij.protoeditor.lang.psi.util;

import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiElement;
import com.intellij.psi.util.PsiTreeUtil;
import org.jetbrains.annotations.NotNull;

/** An extension of PsiTreeUtil with additional utilities. */
public class PbPsiTreeUtil extends PsiTreeUtil {

  public static boolean isFirstInside(@NotNull PsiElement element, @NotNull PsiElement ancestor) {
    TextRange ancestorTextRange = ancestor.getTextRange();
    TextRange elementTextRange = element.getTextRange();
    if (ancestorTextRange == null || elementTextRange == null) {
      return false;
    }
    return ancestorTextRange.getStartOffset() == elementTextRange.getStartOffset();
  }
}


text:
.itemdetailpage {
    overflow-x:auto;
}
.itemdetailpage .content {
    -ms-grid-row: 2;
/*    column-gap: 20px;
    column-width: 410px;*/
    display: block;
    height: 100%;
    overflow-x: auto;
    position: relative;
    width: 127%;
    z-index: 0;
}
.main-area {
    /*columns:1;*/
    height: 95%;
    margin-left: 120px;
    margin-top: 5px;
    width: 400px;
    height:100%;
}
.floater {
    float:left;
    margin-right:50px;
}
.item-subtitle {
    margin-bottom: 20px;
}

.itemdetailpage .shot-info {
    width:400px;
    padding: 0 15px;
    box-sizing: border-box;
}

    .itemdetailpage .shot-info .box {
        width:32%;
        display:inline-block;
        text-align:center;
        padding: 15px 0;
    }

    .itemdetailpage .shot-info .box-middle {
        border-right: 1px solid #666;
        border-left: 1px solid #666;
    }

        .itemdetailpage .shot-info .box .number {
            font-size: 150%;
            font-weight:bold;
        }

        .itemdetailpage .shot-info .box .subtitle {
            font-size: 80%;
            color:#666;
            text-transform: uppercase;
        }

.comments {
    height:auto;
    width:650px;
    height:500px;
    overflow-y:auto;
    /*columns: 2;*/
}

.shots-list {
    width:610px;
    /*columns:1;*/
}
    .itemdetailpage .comment {
        padding: 10px 0;
        margin-bottom: 10px;
        width:300px;
        background: #525252;
        float:left;
    }

    .comment.first {
        margin-right:10px;
    }

    .comment.second:after {
        content: "";
        display: block;
        height: 0;
        clear: both;
        visibility: hidden;
    }

    .itemdetailpage .comment img {
        width:50px;
        height:auto;
        float:left;
        margin-left:15px;
        margin-right:15px;
    }

    .itemdetailpage .comment .author {
        font-weight:bold;
    }

    .itemdetailpage .comment .comments-content {
        padding:10px 10px 10px 30px;
    }

    .itemdetailpage .comment .comments-meta {
        font-size: 80%;
        color: #666;
        float:right;
        margin-right:20px;
    }

.itemdetailpage .shots-list .recent-shot {
    width: 200px;
    height: auto;
    display:inline-block;
}

    .itemdetailpage .shots-list .recent-shot img {
        width: 200px;
        height: auto;
    }

    .itemdetailpage .content article {
        /* Define a multi-column, horizontally scrolling article by default. */
        height: 95%;
        margin-left: 120px;
        margin-top: 5px;
        width: 400px;
    }

        .itemdetailpage .content header .item-title {
            margin-bottom: 20px;
            margin-top: 0;
        }

        .itemdetailpage .content header .item-subtitle {
            margin-bottom: 20px;
            margin-top: 0;
        }

        .itemdetailpage .content .item-image {
            height: 300px;
            margin-bottom: 3px;
            width: 400px;
        }

        .itemdetailpage .content .item-content p {
            margin-bottom: 20px;
            margin-right: 20px;
            vertical-align: baseline;
        }

.recent-shots {
    margin-top: -50px;
}

@media screen and (-ms-view-state: snapped) {
    .itemdetailpage .content {
        overflow-x: hidden;
        overflow-y: auto;
    }

        .itemdetailpage .content article {
            /* Define a single column, vertically scrolling article in snapped mode. */
            -ms-grid-columns: 300px 1fr;
            -ms-grid-row: 2;
            -ms-grid-rows: auto 60px;
            display: -ms-grid;
            height: 100%;
            margin-left: 20px;
            width: 300px;
        }

            .itemdetailpage .content article .item-image {
                height: 600px;
                width: 800px;
            }

            .itemdetailpage .content article .item-content {
                padding-bottom: 60px;
            }
}

@media screen and (-ms-view-state: fullscreen-portrait) {
    .itemdetailpage .content article {
        margin-left: 100px;
    }
}

.clearfix {
    clear: both;
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Secotium drummondii Berk. ex F. Muell.

### Remarks
null


text:
import os
import tensorflow as tf
import numpy as np
from text_loader import TextLoader
from model import Model
from parameters import model_params
from midi_interaction import MusicLoader
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'

def train():

    """ Train Action """

    # Our model
    model = Model(model_params)

    with tf.Session() as sess:

        sess.run(tf.global_variables_initializer())
        saver = tf.train.Saver(tf.global_variables())

        # Init from already existing model, if any
        if model_params.init_from_model is not None:
            checkpoint = tf.train.get_checkpoint_state(
                            'model_saved/%s' % model_params.init_from_model)
            saver.restore(sess, checkpoint.model_checkpoint_path)
            print('Model restored !')
        print('Start training ..')
        dir_ = os.listdir('data')
        data_loaders = []

        # Load texts via DataLoader object
        for f in dir_:
            if f[-4:] == '.txt':
                data_loader = TextLoader(f,
                                         model_params.batch_size,
                                         model_params.seq_size)
                data_loaders.append(data_loader)

        # Training phase

        # We will make n_epoch epochs
        for e in range(model_params.n_epoch):
            n_f_done = 0
            for data_loader in data_loaders:
                print('Epoch %s  %s / %s' % (e, n_f_done, len(dir_)), end='\r')
                # Get at start of file
                data_loader.reset_batch_pointer()

                # Assign learning rate to be learning_rate / sqrt(n_batches), the
                # number of batches in this text. So training on 1 min piece
                # has ~ the same impact as training on 1 hour piece.
                sess.run(tf.assign(model.lr,
                         (model_params.learning_rate /
                          int(np.sqrt(data_loader.n_batches)))))

                # Init state
                state = sess.run(model.initial_state)

                # For all batches
                for b in range(data_loader.n_batches):
                    data, target = data_loader.get_next_batch()

                    # We will feed data, target, and state (we update state
                    # component manually) state for all neuron will be a tuple
                    # (c, h), this is relative to how LSTM works
                    feed = {model.input_data: data, model.targets: target}
                    for i, (c, h) in enumerate(model.initial_state):
                        feed[c] = state[i].c
                        feed[h] = state[i].h

                    # Do training operation
                    _ = sess.run([model.train_op], feed)

                n_f_done += 1

            # Save model
            saver.save(sess, 'model_saved/%s/model.checkpoint' %
                       model_params.model_save_name)
            print("""End of epoch %s Model Saved""" %
                  e)
        print('Done !')

if __name__ == '__main__':
    stop = False
    if model_params.init_from_model is not None:
        if model_params.init_from_model not in os.listdir('model_saved'):
            stop = True
            print("You try to init from a model that doesn't exists")
    print("""You start a new training, do you want to clear already
            existing data files ? [Y/N]""", end=' ')
    choice = input()
    if choice == 'Y' or choice == 'y':
        music_loader = MusicLoader()
        music_loader.clear_data()
    elif choice == 'N' or choice == 'n':
        pass
    else:
        input('[Y/N] :')
    if model_params.init_from_model is None:
        if model_params.model_save_name in os.listdir('model_saved'):
            print("""You start a new training from scratch, but there is
                  already a model with the name you chose, do you want to
                  delete it ? [Y/N]'""", end=' ')
            choice = input()
            if choice == 'Y' or choice == 'y':
                pass
            elif choice == 'N' or choice == 'n':
                stop = True
                print('Please choose another name in the config.ini file')
            else:
                input('[Y/N] :')
        if model_params.model_save_name not in os.listdir('model_saved'):
            os.makedirs('model_saved/%s' % model_params.model_save_name)

    if not stop:
        if os.listdir('data') == []:
            print('Found data dir empty, reading midis ..')
            music_loader = MusicLoader()
            music_loader.read_all()

        train()


text:
package circlebinder.common.event;

import android.os.Parcel;
import android.os.Parcelable;

public final class SpaceBuilder implements Parcelable {

    String name;
    String simpleName;
    long blockId;
    String blockName;
    int spaceNo;
    String spaceNoSub;

    public Space build() {
        return new Space(this);
    }

    public SpaceBuilder setName(String name) {
        this.name = name;
        return this;
    }

    public SpaceBuilder setSimpleName(String simpleName) {
        this.simpleName = simpleName;
        return this;
    }

    public SpaceBuilder setBlockName(String blockName) {
        this.blockName = blockName;
        return this;
    }

    public SpaceBuilder setNo(int spaceNo) {
        this.spaceNo = spaceNo;
        return this;
    }

    public SpaceBuilder setNoSub(String noSub) {
        this.spaceNoSub = noSub;
        return this;
    }

    public SpaceBuilder setBlockId(long blockId) {
        this.blockId = blockId;
        return this;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.name);
        dest.writeString(this.simpleName);
        dest.writeString(this.blockName);
        dest.writeInt(this.spaceNo);
        dest.writeString(this.spaceNoSub);
    }

    public SpaceBuilder() {
    }

    private SpaceBuilder(Parcel in) {
        this.name = in.readString();
        this.simpleName = in.readString();
        this.blockName = in.readString();
        this.spaceNo = in.readInt();
        this.spaceNoSub = in.readString();
    }

    public static Parcelable.Creator<SpaceBuilder> CREATOR = new Parcelable.Creator<SpaceBuilder>() {
        public SpaceBuilder createFromParcel(Parcel source) {
            return new SpaceBuilder(source);
        }

        public SpaceBuilder[] newArray(int size) {
            return new SpaceBuilder[size];
        }
    };

    public void clear() {
        this.name = null;
        this.simpleName = null;
        this.blockName = null;
        this.spaceNo = 0;
        this.spaceNoSub = null;
    }
}


text:
int main(int argc, char* argv[])
{

   printf("%s", BOOST_LIB_VERSION);
   return 0;
}


text:
import numpy as np

class Dataset(object):
    def __init__(self, X_train, X_val, y_train, y_val, zca=None, metadata=""):
        self.X_train = X_train
        self.X_val = X_val
        self.y_train = y_train
        self.y_val = y_val
        self.zca = zca
        self.metadata = metadata

    def save_file(self, filename):
        with open(filename, 'w') as f:
            np.savez(f, X_train=self.X_train,
                        X_val=self.X_val,
                        y_train=self.y_train,
                        y_val=self.y_val,
                        zca=self.zca,
                        metadata=self.metadata)

    @classmethod
    def load_file(cls, filename):
        with open(filename, 'r') as f:
            data = np.load(f)
            X_train = data['X_train']
            X_val = data['X_val']
            y_train = data['y_train']
            y_val = data['y_val']
            zca = None
            try:
                zca = data['zca']
            except KeyError:
                pass
            metadata = None
            try:
                metadata = data['metadata']
            except KeyError:
                pass
            return cls(X_train, X_val, y_train, y_val, zca=zca, metadata=metadata)


text:
import os, sys
from envparse import env
from django.conf import settings
import django

DEFAULT_SETTINGS = dict(
    INSTALLED_APPS=(
        'django.contrib.postgres',
        'justeventme',
        'tests',
    ),
    DATABASES={
        "default": {
        #    "ENGINE": "django.db.backends.sqlite3"
        #}
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'justeventme',
        'HOST': '',
        'PORT': '5432',
        'USER': env.str('DBUSER'),
        'PASSWORD': env.str('DBPASSWD'),
        }
    },
    #SILENCED_SYSTEM_CHECKS=["1_7.W001"],
)

def runtests():
    if not settings.configured:
        settings.configure(**DEFAULT_SETTINGS)

    django.setup()

    parent = os.path.dirname(os.path.abspath(__file__))
    sys.path.insert(0, parent)

    from django.test.runner import DiscoverRunner
    runner_class = DiscoverRunner
    test_args = ['tests']

    failures = runner_class(
        verbosity=1, interactive=True, failfast=False).run_tests(test_args)
    sys.exit(failures)

if __name__ == '__main__':
    runtests()


text:
#ifndef STATUS_H
#define STATUS_H

#include <be/app/Message.h>
#include <be/interface/Bitmap.h>
#include <be/support/Archivable.h>
#include <be/support/String.h>
#include <be/support/SupportDefs.h>
#include <map>

/** Class representing different IM statusses
	@author Tim de Jong
 */
class Status : public BArchivable
{
	public:
		Status();
		Status(BString statusName, BString statusAbbr, BBitmap* icon, bool usrChoice, rgb_color statusColour);
		Status(BMessage* archive);
		virtual				~Status();

		void				SetStatusName(BString name);
		BString				GetStatusName();

		void				SetAbbreviation(BString abbreviation);
		BString				GetAbbreviation();

		BBitmap*			GetStatusIcon(int32 width = 18);
		void				AddIcon(BBitmap *statusIcon);

		bool				IsOnline() const;

		void				SetUserChoice(bool userChoice);
		bool				IsUserChoice() const;

		void				SetStatusColour(rgb_color colour);
		rgb_color			StatusColour() const;

		//archivable methods
		static BArchivable*	Instantiate(BMessage *archive);
		virtual status_t	Archive(BMessage *archive, bool deep = true) const;

	private:
		BString					m_statusName,
								m_statusAbbreviation;

		bool					m_userChoice;
		rgb_color				m_statusColour;

		map< int32,BBitmap* >	m_statusIcons;
};

#endif


text:
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace AxSoft.Angular.Net.Validation
{
	/// <summary>
	/// Provides an adapter for the <see cref="StringLengthAttribute"/> attribute.
	/// </summary>
	public class StringLengthAttributeAdapter : AngularDataAnnotationsModelValidator<StringLengthAttribute>
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="StringLengthAttributeAdapter"/> class.
		/// </summary>
		/// <param name="metadata">The model metadata.</param>
		/// <param name="context">The AngularJS binding context.</param>
		/// <param name="attribute">The string-length attribute.</param>
		public StringLengthAttributeAdapter(ModelMetadata metadata, AngularBindingContext context, StringLengthAttribute attribute)
			: base(metadata, context, attribute)
		{
		}

		/// <summary>
		/// Gets a list of string-length client validation rules.
		/// </summary>
		/// <returns>A list of string-length client validation rules.</returns>
		public override IEnumerable<ValidationRule> GetClientValidationRules()
		{
			return new[] { new StringLengthValidationRule(ErrorMessage, Attribute.MinimumLength, Attribute.MaximumLength) };
		}
	}
}