text:
using CocosSharp;

namespace tests.FontTest
{
	public class SystemFontTestScene : TestScene
	{
		private static int fontIdx;

		private static readonly string[] fontList =
		{
#if IOS || IPHONE || MACOS
			"Chalkboard SE",
			"Chalkduster",
			"Noteworthy",
			"Marker Felt",
			"Papyrus",
			"American Typewriter",
			"Arial",
			"fonts/A Damn Mess.ttf",
			"fonts/Abberancy.ttf",
			"fonts/Abduction.ttf",
			"fonts/American Typewriter.ttf",
			"fonts/Courier New.ttf",
			"fonts/Marker Felt.ttf",
			"fonts/Paint Boy.ttf",
			"fonts/Schwarzwald Regular.ttf",
			"fonts/Scissor Cuts.ttf",
			"fonts/tahoma.ttf",
			"fonts/Thonburi.ttf",
			"fonts/ThonburiBold.ttf"

#endif
#if WINDOWS || WINDOWSGL || NETFX_CORE
            "A Damn Mess",  // A Damn Mess.ttf
            "Abberancy",    // Abberancy.ttf
            "Abduction",    //Abduction.ttf
            "AmerType Md BT",  // American Typewriter.ttf
            "Scissor Cuts", //Scissor Cuts.ttf
            "Felt",         //Marker Felt.ttf
            "arial",
            "Courier New",
            "Marker Felt",
			"Comic Sans MS",
			"Felt",
			"MoolBoran",
			"Courier New",
			"Georgia",
			"Symbol",
            "Wingdings",
			"Arial",

            //"fonts/A Damn Mess.ttf",
            //"fonts/Abberancy.ttf",
            //"fonts/Abduction.ttf",
            //"fonts/American Typewriter.ttf",
            //"fonts/arial.ttf",
            //"fonts/Courier New.ttf",
            //"fonts/Marker Felt.ttf",
            //"fonts/Paint Boy.ttf",
            //"fonts/Schwarzwald Regular.ttf",
            //"fonts/Scissor Cuts.ttf",
            //"fonts/tahoma.ttf",
            //"fonts/Thonburi.ttf",
            //"fonts/ThonburiBold.ttf"
#endif
#if ANDROID
			"Arial",
			"Courier New",
			"Georgia",

            "fonts/A Damn Mess.ttf",
            "fonts/Abberancy.ttf",
            "fonts/Abduction.ttf",
            "fonts/American Typewriter.ttf",
            "fonts/arial.ttf",
            "fonts/Courier New.ttf",
            "fonts/Marker Felt.ttf",
            "fonts/Paint Boy.ttf",
            "fonts/Schwarzwald Regular.ttf",
            "fonts/Scissor Cuts.ttf",
            "fonts/tahoma.ttf",
            "fonts/Thonburi.ttf",
            "fonts/ThonburiBold.ttf"
#endif
		};

		public static int verticalAlignIdx = 0;

		public static CCVerticalTextAlignment[] verticalAlignment =
		{
			CCVerticalTextAlignment.Top,
			CCVerticalTextAlignment.Center,
			CCVerticalTextAlignment.Bottom
		};

		public override void runThisTest()
		{
			CCLayer pLayer = new SystemFontTest();
			AddChild(pLayer);

			Scene.Director.ReplaceScene(this);
		}

		protected override void NextTestCase()
		{
			nextAction();
		}
		protected override void PreviousTestCase()
		{
			backAction();
		}
		protected override void RestTestCase()
		{
			restartAction();
		}
		public static string nextAction()
		{
			fontIdx++;
			if (fontIdx >= fontList.Length)
			{
				fontIdx = 0;
				verticalAlignIdx = (verticalAlignIdx + 1) % verticalAlignment.Length;
			}
			return fontList[fontIdx];
		}

		public static string backAction()
		{
			fontIdx--;
			if (fontIdx < 0)
			{
				fontIdx = fontList.Length - 1;
				verticalAlignIdx--;
				if (verticalAlignIdx < 0)
					verticalAlignIdx = verticalAlignment.Length - 1;
			}

			return fontList[fontIdx];
		}

		public static string restartAction()
		{
			return fontList[fontIdx];
		}
	}

	public class SystemFontTest : TestNavigationLayer
	{
		private const int kTagLabel1 = 1;
		private const int kTagLabel2 = 2;
		private const int kTagLabel3 = 3;
		private const int kTagLabel4 = 4;

		private CCSize blockSize;
        private CCSize visibleRect;
		private float fontSize = 36;

		public SystemFontTest()
		{
		}

        public override void OnEnter()
        {
            base.OnEnter();

            var leftColor = new Background(blockSize, new CCColor4B(100, 100, 100, 255));
            var centerColor = new Background(blockSize, new CCColor4B(200, 100, 100, 255));
            var rightColor = new Background(blockSize, new CCColor4B(100, 100, 200, 255));

            leftColor.IgnoreAnchorPointForPosition = false;
            centerColor.IgnoreAnchorPointForPosition = false;
            rightColor.IgnoreAnchorPointForPosition = false;

            leftColor.AnchorPoint = new CCPoint(0, 0.5f);
            centerColor.AnchorPoint = new CCPoint(0, 0.5f);
            rightColor.AnchorPoint = new CCPoint(0, 0.5f);

            leftColor.Position = new CCPoint(0, visibleRect.Height / 2);
            centerColor.Position = new CCPoint(blockSize.Width, visibleRect.Height / 2);
            rightColor.Position = new CCPoint(blockSize.Width * 2, visibleRect.Height / 2);

            AddChild(leftColor, -1);
            AddChild(rightColor, -1);
            AddChild(centerColor, -1);

            showFont(SystemFontTestScene.restartAction());
        }

        protected override void AddedToScene()
        {
            base.AddedToScene();

            visibleRect = VisibleBoundsWorldspace.Size;
            blockSize = new CCSize(visibleRect.Width / 3, visibleRect.Height / 2);
        }

		public void showFont(string pFont)
		{

			RemoveChildByTag(kTagLabel1, true);
			RemoveChildByTag(kTagLabel2, true);
			RemoveChildByTag(kTagLabel3, true);
			RemoveChildByTag(kTagLabel4, true);

            var top = new CCLabel(pFont,"Helvetica", 32);

            var center = new CCLabel("alignment center", pFont, fontSize,
				blockSize, CCTextAlignment.Center,
				SystemFontTestScene.verticalAlignment[SystemFontTestScene.verticalAlignIdx]);

            var left = new CCLabel("alignment left", pFont, fontSize,
                blockSize, CCTextAlignment.Left,
                SystemFontTestScene.verticalAlignment[SystemFontTestScene.verticalAlignIdx]);

			var right = new CCLabel("alignment right", pFont, fontSize,
				blockSize, CCTextAlignment.Right,
				SystemFontTestScene.verticalAlignment[SystemFontTestScene.verticalAlignIdx]);

            top.AnchorPoint = CCPoint.AnchorMiddleTop;
            left.AnchorPoint = CCPoint.AnchorMiddleLeft;
            center.AnchorPoint = CCPoint.AnchorMiddleLeft;
            right.AnchorPoint = CCPoint.AnchorMiddleLeft;

            top.Position = TitleLabel.Position - new CCPoint(0, 20);
            left.Position = new CCPoint(0, visibleRect.Height / 2);
            center.Position = new CCPoint(blockSize.Width, visibleRect.Height / 2);
            right.Position = new CCPoint(blockSize.Width * 2, visibleRect.Height / 2);

            AddChild(left, 0, kTagLabel1);
            AddChild(right, 0, kTagLabel2);
            AddChild(center, 0, kTagLabel3);
            AddChild(top, 0, kTagLabel4);
		}

        public override void RestartCallback(object sender)
        {
            base.RestartCallback(sender);
			showFont(SystemFontTestScene.restartAction());
		}

        public override void NextCallback(object sender)
        {
            base.NextCallback(sender);
			showFont(SystemFontTestScene.nextAction());
		}

        public override void BackCallback(object sender)
        {
            base.BackCallback(sender);
			showFont(SystemFontTestScene.backAction());
		}

        public override string Title
        {
            get
            {
                return "System Font test";
            }
        }
	}
}


text:
package com.xivvic.args.schema;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;

import java.util.Map;

import org.junit.Before;
import org.junit.Test;

import com.xivvic.args.error.ErrorStrategy;
import com.xivvic.args.schema.item.Item;

public class ParserShortFormTest
{
	private ParserShortForm subject;

	@Before
	public void setUp() throws Exception
	{
		subject = new ParserShortForm(ErrorStrategy.FAIL_FAST);
	}

	@Test
	public void testSchemaBuilderSingleBooleanTest() throws Exception
	{
		// Arrange
		//
		String opt = "b";

		// Act
		//
		Map<String, Map<String, String>> parseResult = subject.parse(opt);
		Map<String, String> def = parseResult.get(opt);

		// Assert
		//
		assertSimpleItemForm(def, opt, OptionType.BOOLEAN);
	}

	@Test
	public void testSchemaBuilderSingleStringTest() throws Exception
	{
		// Arrange
		//
		String opt = "s";
		String fmt = "s*";

		// Act
		//
		Map<String, Map<String, String>> parseResult = subject.parse(fmt);
		Map<String, String> def = parseResult.get(opt);

		// Assert
		//
		assertSimpleItemForm(def, opt, OptionType.STRING);
	}

	@Test
	public void testSchemaBuilderOneDouble() throws Exception
	{
		// Arrange
		//
		String opt = "d";
		String fmt = "d##";

		// Act
		//
		Map<String, Map<String, String>> parseResult = subject.parse(fmt);
		Map<String, String> def = parseResult.get(opt);

		// Assert
		//
		assertSimpleItemForm(def, opt, OptionType.DOUBLE);
	}

	@Test
	public void testSchemaBuilderOneStringList() throws Exception
	{
		// Arrange
		//
		String opt = "l";
		String fmt = "l[*]";

		// Act
		//
		Map<String, Map<String, String>> parseResult = subject.parse(fmt);
		Map<String, String> def = parseResult.get(opt);

		// Assert
		//
		assertSimpleItemForm(def, opt, OptionType.STRING_LIST);
	}

	@Test
	public void testSchemaBuilderSingleIntegerTest() throws Exception
	{
		// Arrange
		//
		String opt = "i";
		String fmt = "i#";

		// Act
		//
		Map<String, Map<String, String>> parseResult = subject.parse(fmt);
		Map<String, String> def = parseResult.get(opt);

		// Assert
		//
		assertSimpleItemForm(def, opt, OptionType.INTEGER);
	}

	@Test
	public void testSchemaBuilderBSITest() throws Exception
	{
		// Arrange
		//
		String fmt = "b,s*,i#";

		// Act
		//
		Map<String, Map<String, String>> parseResult = subject.parse(fmt);
		Map<String, String> def1 = parseResult.get("b");
		Map<String, String> def2 = parseResult.get("s");
		Map<String, String> def3 = parseResult.get("i");

		// Assert
		//
		assertSimpleItemForm(def1, "b", OptionType.BOOLEAN);
		assertSimpleItemForm(def2, "s", OptionType.STRING);
		assertSimpleItemForm(def3, "i", OptionType.INTEGER);
	}

	@Test
	public void testSchemaBuilderBIBWithSpaces() throws Exception
	{
		// Arrange
		//
		String fmt = "b, i# , x";

		// Act
		//
		Map<String, Map<String, String>> parseResult = subject.parse(fmt);
		Map<String, String> def1 = parseResult.get("b");
		Map<String, String> def2 = parseResult.get("i");
		Map<String, String> def3 = parseResult.get("x");

		// Assert
		//
		assertSimpleItemForm(def1, "b", OptionType.BOOLEAN);
		assertSimpleItemForm(def2, "i", OptionType.INTEGER);
		assertSimpleItemForm(def3, "x", OptionType.BOOLEAN);
	}

	///////////////////////////////
	// Helper Methods            //
	///////////////////////////////

	private void assertSimpleItemForm(Map<String, String> def, String name, OptionType type)
	{
		assertNotNull(def);
		assertEquals(name, def.get(Item.NAME));
		assertEquals(type.name(), def.get(Item.TYPE));

		assertNull(def.get(Item.REQUIRED));
		assertNull(def.get(Item.DESCRIPTION));
		assertNull(def.get(Item.DEFAULT));
		assertNull(def.get(Item.ENV_VAR));
	}
}

redpajama_set_name: RedPajamaGithub


text:
using HtmlConsole.Dom;

namespace HtmlConsole.Rendering
{
    public class ReplacedContentRenderer : BlockRenderer
    {
        public ReplacedContentRenderer(ElementNode domNode) : base(domNode)
        {
        }

        public override IRenderer Clone()
        {
            return new ReplacedContentRenderer((ElementNode)DomNode);
        }
    }
}


text:
package net.aeten.core.event;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

class FutureDone<Data extends EventData<?, ?>> implements Future<Data> {
	private final Data data;

	public FutureDone(Data data) {
		this.data = data;
	}

	@Override
	public boolean cancel(boolean mayInterruptIfRunning) {
		return false;
	}

	@Override
	public Data get() throws InterruptedException, ExecutionException {
		return data;
	}

	@Override
	public Data get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
		return data;
	}

	@Override
	public boolean isCancelled() {
		return false;
	}

	@Override
	public boolean isDone() {
		return true;
	}

}


text:
package com.sleepycat.persist.impl;

import java.lang.reflect.Array;
import java.util.IdentityHashMap;
import java.util.Map;
import java.util.Set;

import com.sleepycat.db.DatabaseEntry;
import com.sleepycat.persist.raw.RawObject;

/**
 * An array of objects having a specified number of dimensions.  All
 * multidimensional arrays are handled by this class, since even a primitive
 * array of more than one dimension is an array of objects, where the component
 * objects may be primitive arrays.  The {@link PrimitiveArrayFormat} class
 * handles primitive arrays of one dimension only.
 *
 * In this class, and {@link PrimitiveArrayFormat}, we resort to using
 * reflection to allocate multidimensional arrays.  If there is a need for it,
 * reflection could be avoided in the future by generating code as new array
 * formats are encountered.
 *
 * @author Mark Hayes
 */
public class ObjectArrayFormat extends Format {

    private static final long serialVersionUID = 4317004346690441892L;

    private Format componentFormat;
    private int nDimensions;
    private transient Format useComponentFormat;

    ObjectArrayFormat(Class type) {
        super(type);
        String name = getClassName();
        for (nDimensions = 0;
             name.charAt(nDimensions) == '[';
             nDimensions += 1) {
        }
    }

    @Override
    public boolean isArray() {
        return true;
    }

    @Override
    public int getDimensions() {
        return nDimensions;
    }

    @Override
    public Format getComponentType() {
        return (useComponentFormat != null) ?
            useComponentFormat : componentFormat  ;
    }

    @Override
    void collectRelatedFormats(Catalog catalog,
                               Map<String,Format> newFormats) {
        Class cls = getType().getComponentType();
        catalog.createFormat(cls, newFormats);
    }

    @Override
    void initialize(Catalog catalog, int initVersion) {
        /* Set the component format for a new (never initialized) format. */
        if (componentFormat == null) {
            Class cls = getType().getComponentType();
            componentFormat = catalog.getFormat(cls.getName());
        }
        useComponentFormat = componentFormat.getLatestVersion();
    }

    @Override
    boolean isAssignableTo(Format format) {
        if (super.isAssignableTo(format)) {
            return true;
        }
        if (format instanceof ObjectArrayFormat) {
            ObjectArrayFormat other = (ObjectArrayFormat) format;
            if (useComponentFormat.isAssignableTo(other.useComponentFormat)) {
                return true;
            }
        }
        return false;
    }

    @Override
    Object newArray(int len) {
        return Array.newInstance(getType(), len);
    }

    @Override
    public Object newInstance(EntityInput input, boolean rawAccess) {
        int len = input.readArrayLength();
        if (rawAccess) {
            return new RawObject(this, new Object[len]);
        } else {
            return useComponentFormat.newArray(len);
        }
    }

    @Override
    public Object readObject(Object o, EntityInput input, boolean rawAccess) {
        Object[] a;
        if (rawAccess) {
            a = ((RawObject) o).getElements();
        } else {
            a = (Object[]) o;
        }
        for (int i = 0; i < a.length; i += 1) {
            a[i] = input.readObject();
        }
        return o;
    }

    @Override
    void writeObject(Object o, EntityOutput output, boolean rawAccess) {
        Object[] a;
        if (rawAccess) {
            a = ((RawObject) o).getElements();
        } else {
            a = (Object[]) o;
        }
        output.writeArrayLength(a.length);
        for (int i = 0; i < a.length; i += 1) {
            output.writeObject(a[i], useComponentFormat);
        }
    }

    @Override
    Object convertRawObject(Catalog catalog,
                            boolean rawAccess,
                            RawObject rawObject,
                            IdentityHashMap converted) {
        RawArrayInput input = new RawArrayInput
            (catalog, rawAccess, converted, rawObject, useComponentFormat);
        Object a = newInstance(input, rawAccess);
        converted.put(rawObject, a);
        return readObject(a, input, rawAccess);
    }

    @Override
    void skipContents(RecordInput input) {
        int len = input.readPackedInt();
        for (int i = 0; i < len; i += 1) {
            input.skipField(useComponentFormat);
        }
    }

    @Override
    void copySecMultiKey(RecordInput input, Format keyFormat, Set results) {
        int len = input.readPackedInt();
        for (int i = 0; i < len; i += 1) {
            KeyLocation loc = input.getKeyLocation(useComponentFormat);
            if (loc == null) {
                throw new IllegalArgumentException
                    ("Secondary key values in array may not be null");
            }
            if (loc.format != useComponentFormat) {
                throw new IllegalStateException
                    (useComponentFormat.getClassName());
            }
            int off1 = loc.input.getBufferOffset();
            useComponentFormat.skipContents(loc.input);
            int off2 = loc.input.getBufferOffset();
            DatabaseEntry entry = new DatabaseEntry
                (loc.input.getBufferBytes(), off1, off2 - off1);
            results.add(entry);
        }
    }

    @Override
    boolean evolve(Format newFormat, Evolver evolver) {

        /*
         * When the class name of the component changes, we need a new format
         * that references it.  Otherwise, don't propogate changes from
         * components upward to their arrays.
         */
        Format latest = componentFormat.getLatestVersion();
        if (latest != componentFormat &&
            !latest.getClassName().equals(componentFormat.getClassName())) {
            evolver.useEvolvedFormat(this, newFormat, newFormat);
        } else {
            evolver.useOldFormat(this, newFormat);
        }
        return true;
    }
}


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<feed><tipo>Beco</tipo><logradouro>da Vitória</logradouro><bairro>Beberibe</bairro><cidade>Recife</cidade><uf>PE</uf><cep>52130245</cep></feed>


text:
static NSString* const kStarImageName = @"Star";
static NSString* const kStarFilledImageName = @"Star-Filled";

@interface BookDetailTableViewController ()

@property(weak, nonatomic) IBOutlet UIBarButtonItem* starButton;

@property(nonatomic, strong) NSDictionary* bookDetail;
@property(nonatomic, assign) BOOL bFetchDataFailed;

@end

@implementation BookDetailTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.navigationItem.rightBarButtonItem setEnabled:NO];

    [[NSNotificationCenter defaultCenter] addObserver:self.tableView
                                             selector:@selector(reloadData)
                                                 name:SVProgressHUDDidDisappearNotification
                                               object:nil];
    [self fetchBookDetail];
}

- (void)fetchBookDetail {
    self.tableView.backgroundView = nil;
    [SVProgressHUD showWithStatus:@"正在加载..." maskType:SVProgressHUDMaskTypeBlack];

    [LibraryService getBookDetailWithUrl:self.url
                                 success:^(NSDictionary* bookDetail) {
                                     _bookDetail = bookDetail;
                                     _bFetchDataFailed = NO;
                                     [SVProgressHUD dismiss];
                                     [self.navigationItem.rightBarButtonItem setEnabled:YES];
                                     [self updateStarButtonStatus];
                                 }
                                 failure:^{
                                     _bookDetail = [NSDictionary new];
                                     _bFetchDataFailed = YES;
                                     [SVProgressHUD showErrorWithStatus:@"网络异常:-P" maskType:SVProgressHUDMaskTypeBlack];
                                 }];
}

enum { BASIC_SECTION = 0,
    STATUS_SECTION };

#pragma mark - Table view delegate

- (CGFloat)tableView:(UITableView*)tableView heightForHeaderInSection:(NSInteger)section {
    return section == BASIC_SECTION ? 10 : UITableViewAutomaticDimension;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.section == BASIC_SECTION) {
        NSString *item = _bookDetail[@"basic"][@"keys"][indexPath.row];
        NSString *itemContent = _bookDetail[@"basic"][item];
        CGFloat itemLabelWidth = [item sizeWithAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:17.0]}].width;

        // 36 = |15-textLabel-6-detailTextLabel-15|
        CGRect rect = [itemContent boundingRectWithSize:CGSizeMake(tableView.frame.size.width - (itemLabelWidth + 36), FLT_MAX)
                                         options:NSStringDrawingUsesLineFragmentOrigin
                                      attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:17.0]}
                                         context:nil];
        return rect.size.height + 20;
    }
    return tableView.rowHeight;
}

- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 44;
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView*)tableView {
    if (_bFetchDataFailed) {
        UILabel* hintMsgLabel = [UILabel new];
        hintMsgLabel.text = @"点击屏幕重新加载";
        hintMsgLabel.textAlignment = NSTextAlignmentCenter;
        hintMsgLabel.font = [UIFont systemFontOfSize:26];
        hintMsgLabel.textColor = [UIColor grayColor];

        self.tableView.backgroundView = hintMsgLabel;

        hintMsgLabel.userInteractionEnabled = YES;
        [hintMsgLabel addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self
                                                                                action:@selector(fetchBookDetail)]];
    }

    return [_bookDetail count];
}

- (NSString*)tableView:(UITableView*)tableView titleForHeaderInSection:(NSInteger)section {
    switch (section) {
        case STATUS_SECTION: {
            NSUInteger left = [_bookDetail[@"status"][@"in"] count];
            NSUInteger total = left + [_bookDetail[@"status"][@"out"] count];
            if (total) {
                return [NSString stringWithFormat:@"馆藏 [%lu/%lu]", (unsigned long)left, (unsigned long)total];
            }
            return nil;
        }
        default:
            return nil;
    }
}

- (NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section {
    switch (section) {
        case BASIC_SECTION:
            return [_bookDetail[@"basic"][@"keys"] count];
        case STATUS_SECTION:
            return [_bookDetail[@"status"][@"in"] count] + [_bookDetail[@"status"][@"out"] count];
        default:
            return 0;
    }
}

- (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath {
    switch (indexPath.section) {
        case BASIC_SECTION: {
            UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@"bookBasicDetailCell"];
            if (cell == nil) {
                cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"bookBasicDetailCell"];
                [cell.detailTextLabel setNumberOfLines:0];
            }
            cell.textLabel.text = _bookDetail[@"basic"][@"keys"][indexPath.row];
            cell.detailTextLabel.text = _bookDetail[@"basic"][cell.textLabel.text];
            return cell;
        }
        case STATUS_SECTION: {
            BookStatusTableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@"bookStatusCell"];
            NSInteger inCount = [_bookDetail[@"status"][@"in"] count];
            if (indexPath.row < inCount) {
                cell.barcodeInfoLabel.text = _bookDetail[@"status"][@"in"][indexPath.row][0];
                cell.indexInfoLabel.text = _bookDetail[@"status"][@"in"][indexPath.row][1];
                cell.statusLabel.text = _bookDetail[@"status"][@"in"][indexPath.row][2];
                cell.otherInfoLabel.text = _bookDetail[@"status"][@"in"][indexPath.row][3];
                cell.otherLabel.text = @"流通类别";
            } else {
                cell.barcodeInfoLabel.text = _bookDetail[@"status"][@"out"][indexPath.row - inCount][0];
                cell.indexInfoLabel.text = _bookDetail[@"status"][@"out"][indexPath.row - inCount][1];
                cell.otherInfoLabel.text = _bookDetail[@"status"][@"out"][indexPath.row - inCount][2];
                cell.statusLabel.text = @"借出";
                cell.otherLabel.text = @"应还日期";
                cell.barcodeLabel.textColor = cell.statusLabel.textColor = cell.otherLabel.textColor = cell.indexLabel.textColor = [UIColor lightGrayColor];
            }
            return cell;
        }
        default:
            return nil;
    }
}

#pragma mark - IB Actions
- (IBAction)starButtonClicked:(id)sender {
    NSString* isbn = _bookDetail[@"basic"][@"ISBN"];
    if ([MyStarBooks hasBook:isbn]) {
        [MyStarBooks removeBook:isbn];
//        [SVProgressHUD showErrorWithStatus:@"取消收藏" maskType:SVProgressHUDMaskTypeBlack];
//        [JDStatusBarNotification showWithStatus:@"取消收藏" dismissAfter:1.5 styleName:JDStatusBarStyleWarning];
        [TSMessage showNotificationWithTitle:@"取消收藏" type:TSMessageNotificationTypeError];
    } else {
        [MyStarBooks addBookWithName:_bookDetail[@"basic"][@"书 名"] isbn:isbn url:_url];
//        [SVProgressHUD showSuccessWithStatus:@"收藏成功" maskType:SVProgressHUDMaskTypeBlack];
//        [JDStatusBarNotification showWithStatus:@"收藏成功" dismissAfter:1 styleName:JDStatusBarStyleSuccess];
        [TSMessage showNotificationWithTitle:@"收藏成功" type:TSMessageNotificationTypeSuccess];
    }
    [self updateStarButtonStatus];
}

- (void)updateStarButtonStatus {
    if ([MyStarBooks hasBook:_bookDetail[@"basic"][@"ISBN"]]) {
        self.starButton.image = [UIImage imageNamed:kStarFilledImageName];
    } else {
        self.starButton.image = [UIImage imageNamed:kStarImageName];
    }
}

@end


text:
require 'valuable'

require 'schema_plus_columns'
require 'schema_validations/version'
require 'schema_validations/active_record/validations'
require 'schema_validations/railtie' if defined?(Rails::Railtie)

module SchemaValidations

  # The configuation options for SchemaValidations. Set them globally in
  # <tt>config/initializers/schema_validations.rb</tt>, e.g.:
  #
  #    SchemaValidations.setup do |config|
  #       config.auto_create = false
  #    end
  #
  # or override them per-model, e.g.:
  #
  #     class MyModel < ActiveRecord::Base
  #        schema_validations :only => [:name, :active]
  #     end
  #
  class Config < Valuable
    ##
    # :attr_accessor: auto_create
    #
    # Whether to automatically create validations based on database constraints.
    # Boolean, default is +true+.
    has_value :auto_create, :klass => :boolean, :default => true

    ##
    # :attr_accessor: only
    #
    # List of field names to include in automatic validation.
    # Value is a single name, and array of names, or +nil+.  Default is +nil+.
    has_value :only, :default => nil

    ##
    # :attr_accessor: whitelist
    #
    # List of field names to exclude from automatic validation.
    # Value is a single name, an array of names, or +nil+.  Default is <tt>[:created_at, :updated_at, :created_on, :updated_on]</tt>.
    has_value :whitelist, :default => [:created_at, :updated_at, :created_on, :updated_on]

    ##
    # :attr_accessor: except
    #
    # List of field names to exclude from automatic validation.
    # Value is a single name, and array of names, or +nil+.  Default is +nil+.
    has_value :except, :default => nil

    ##
    # :attr_accessor: whitelist_type
    #
    # List of validation types to exclude from automatic validation.
    # Value is a single type, and array of types, or +nil+.  Default is +nil+.
    # A type is specified as, e.g., +:validates_presence_of+ or simply +:presence+.
    has_value :whitelist_type, :default => nil

    ##
    # :attr_accessor: except_type
    #
    # List of validation types to exclude from automatic validation.
    # Value is a single type, and array of types, or +nil+.  Default is +nil+.
    # A type is specified as, e.g., +:validates_presence_of+ or simply +:presence+.
    has_value :except_type, :default => nil

    ##
    # :attr_accessor: only_type
    #
    # List of validation types to include in automatic validation.
    # Value is a single type, and array of types, or +nil+.  Default is +nil+.
    # A type is specified as, e.g., +:validates_presence_of+ or simply +:presence+.
    has_value :only_type, :default => nil

    def dup #:nodoc:
      self.class.new(Hash[attributes.collect{ |key, val| [key, Valuable === val ?  val.class.new(val.attributes) : val] }])
    end

    def update_attributes(opts)#:nodoc:
      opts = opts.dup
      opts.keys.each { |key| self.send(key).update_attributes(opts.delete(key)) if self.class.attributes.include? key and Hash === opts[key] }
      super(opts)
      self
    end

    def merge(opts)#:nodoc:
      dup.update_attributes(opts)
    end

  end

  # Returns the global configuration, i.e., the singleton instance of Config
  def self.config
    @config ||= Config.new
  end

  # Initialization block is passed a global Config instance that can be
  # used to configure SchemaValidations behavior.  E.g., if you want to
  # disable automation creation validations put the following in
  # config/initializers/schema_validations.rb :
  #
  #    SchemaValidations.setup do |config|
  #       config.auto_create = false
  #    end
  #
  def self.setup # :yields: config
    yield config
  end

  def self.insert #:nodoc:
    return if @inserted
    @inserted = true
    ::ActiveRecord::Base.extend SchemaValidations::ActiveRecord::Validations
  end

end

SchemaValidations.insert unless defined? Rails::Railtie


text:
namespace System.Net
{

    using System;
    using System.Runtime.InteropServices;
    using System.Net.Sockets;
    using System.Text;
    using System.Globalization;
    using Microsoft.SPOT.Hardware;

    public class SocketAddress
    {
        internal const int IPv4AddressSize = 16;

        internal byte[] m_Buffer;

        public AddressFamily Family
        {
            get
            {
                return (AddressFamily)(m_Buffer[0] | (m_Buffer[1] << 8));
            }
        }

        internal SocketAddress(byte[] address)
        {
            m_Buffer = address;
        }

        public SocketAddress(AddressFamily family, int size)
        {
            Microsoft.SPOT.Debug.Assert(size > 2);

            m_Buffer = new byte[size]; //(size / IntPtr.Size + 2) * IntPtr.Size];//sizeof DWORD

            m_Buffer[0] = unchecked((byte)((int)family     ));
            m_Buffer[1] = unchecked((byte)((int)family >> 8));
        }

        public int Size
        {
            get { return m_Buffer.Length; }
        }

        public byte this[int offset]
        {
            get { return m_Buffer[offset]; }
            set { m_Buffer[offset] = value; }
        }

    } // class SocketAddress
} // namespace System.Net


text:
require 'chef/encrypted_data_bag_item/check_encrypted'
require 'chef/mixin/deep_merge'

# Helpers to hoist group-level attributes from a Policyfile.
#
# @since 1.0.0
module PoiseHoist
  extend Chef::EncryptedDataBagItem::CheckEncrypted

  autoload :VERSION, 'poise_hoist/version'

  # Run the attribute hoist process.
  #
  # @param node [Chef::Node] Node object to modify.
  # @return [void]
  def self.hoist!(node)
    policy_group = (defined?(node.policy_group) && node.policy_group) || \
                   Chef::Config[:policy_group] || \
                   (Chef::Config[:deployment_group] && Chef::Config[:deployment_group].split(/-/).last)
    # Don't continue if we aren't using policies.
    return unless policy_group
    Chef::Log.debug("Running attribute Hoist for group #{policy_group}")
    # Hoist away, mateys!
    Chef::Mixin::DeepMerge.hash_only_merge!(node.role_default, node.role_default[policy_group]) if node.role_default.include?(policy_group)
    Chef::Mixin::DeepMerge.hash_only_merge!(node.role_override, node.role_override[policy_group]) if node.role_override.include?(policy_group)
    # Grab from a data bag if one is configured. Remember this might run very
    # early on newer Chef versions, before attribute loading.
    hoist_from_data_bag!(node, policy_group, node['poise-hoist']['data_bag']) if node['poise-hoist'] && node['poise-hoist']['data_bag']
    # Install the patch for chef_environment.
    patch_chef_environment!(node, policy_group)
  end

  # Pull attribute data in from a data bag. Checks for an item matching the
  # node node, and then the policy group.
  #
  # @api private
  # @param node [Chef::Node] Node object to modify.
  # @param policy_group [String] Policy group name.
  # @param data_bag [String] Data bag name to load from.
  # @return [void]
  def self.hoist_from_data_bag!(node, policy_group, data_bag)
    item = begin
      data_bag_item(data_bag, node.name)
    rescue Exception
      data_bag_item(data_bag, policy_group)
    end
    Chef::Mixin::DeepMerge.hash_only_merge!(node.role_override, item)
  end

  # A copy of Chef's data_bag_item method, modified to remove some spurious
  # error logging and returns a plain hash without the `id` field instead of
  # one of the data bag item objects.
  #
  # @api private
  # @param bag [String] Data bag name.
  # @param item [String] Data bag item name.
  # @param secret [String, nil] Data bag secret.
  # @return [Hash]
  def self.data_bag_item(bag, item, secret = nil)
    Chef::DataBag.validate_name!(bag.to_s)
    Chef::DataBagItem.validate_id!(item)

    item = Chef::DataBagItem.load(bag, item)
    data = if encrypted?(item.raw_data)
      Chef::Log.debug("Data bag item looks encrypted: #{bag.inspect} #{item.inspect}")

      # Try to load the data bag item secret, if secret is not provided.
      # Chef::EncryptedDataBagItem.load_secret may throw a variety of errors.
      secret ||= Chef::EncryptedDataBagItem.load_secret
      Chef::EncryptedDataBagItem.new(item.raw_data, secret).to_hash
    else
      item.raw_data
    end
    data.delete('id')

    data
  end

  # Patch `node.chef_environment` to return the policy group name if enabled
  # via `node['poise-hoist']['hoist_chef_environment']`.
  #
  # @api private
  # @since 1.1.0
  # @param node [Chef::Node] Node object to modify.
  # @param policy_group [String] Policy group name.
  # @return [void]
  def self.patch_chef_environment!(node, policy_group)
    old_accessor = node.method(:chef_environment)
    # Not using Poise::NOT_PASSED because this doesn't depend on Poise.
    node.define_singleton_method(:chef_environment) do |*args|
      if args.empty? && node['poise-hoist']['hoist_chef_environment']
        policy_group
      else
        old_accessor.call(*args)
      end
    end
  end

end


text:
@implementation HYBubbleButton
{
    CGPoint _startPoint;
    CGFloat _maxWidth;
    NSMutableSet *_recyclePool;
    NSMutableArray *_array;
}

- (instancetype)initWithFrame:(CGRect)frame
                      maxLeft:(CGFloat)maxLeft
                     maxRight:(CGFloat)maxRight
                    maxHeight:(CGFloat)maxHeight{

    self = [super initWithFrame:frame];
    if (self) {
        _maxHeight = maxHeight;
        _maxLeft   = maxLeft;
        _maxRight  = maxRight;

        [self initData];
    }
    return self;
}

- (id)initWithCoder:(NSCoder *)aDecoder{
    self = [super initWithCoder:aDecoder];
    if (self) {

        [self initData];
    }
    return self;
}

- (void)initData{
    _array       = @[].mutableCopy;
    _recyclePool = [NSMutableSet set];
}

- (void)generateBubbleInRandom{
    CALayer *layer;

    if (_recyclePool.count > 0) {

        layer = [_recyclePool anyObject];

        [_recyclePool removeObject:layer];

    }else{
        UIImage *image = self.images[arc4random() % self.images.count];

        layer = [self createLayerWithImage:image];
    }

    [self.layer addSublayer:layer];
    [self generateBubbleWithCAlayer:layer];
}

- (void)generateBubbleWithImage:(UIImage *)image{

    CALayer *layer = [self createLayerWithImage:image];

    [self.layer addSublayer:layer];
    [self generateBubbleWithCAlayer:layer];
}

- (void)generateBubbleWithCAlayer:(CALayer *)layer
{
    _maxWidth = _maxLeft + _maxRight;

    _startPoint = CGPointMake(self.frame.size.width / 2, 0);

    CGPoint endPoint   = CGPointMake(_maxWidth * [self randomFloat] - _maxLeft, -_maxHeight);
    CGPoint controlPoint1 =
    CGPointMake(_maxWidth * [self randomFloat] - _maxLeft, -_maxHeight * 0.2);
    CGPoint controlPoint2 =
    CGPointMake(_maxWidth * [self randomFloat] - _maxLeft, -_maxHeight * 0.6);

    CGMutablePathRef curvedPath = CGPathCreateMutable();
    CGPathMoveToPoint(curvedPath, NULL, _startPoint.x, _startPoint.y);
    CGPathAddCurveToPoint(curvedPath, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, endPoint.x, endPoint.y);

    CAKeyframeAnimation *keyFrame = [CAKeyframeAnimation animation];
    keyFrame.keyPath = @"position";
    keyFrame.path = CFAutorelease(curvedPath);
    keyFrame.duration = self.duration;
    keyFrame.calculationMode = kCAAnimationPaced;

    [layer addAnimation:keyFrame forKey:@"keyframe"];

    CABasicAnimation *scale = [CABasicAnimation animation];
    scale.keyPath = @"transform.scale";
    scale.toValue = @1;
    scale.fromValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.1, 0.1, 0.1)];
    scale.duration = 0.5;

    CABasicAnimation *alpha = [CABasicAnimation animation];
    alpha.keyPath = @"opacity";
    alpha.fromValue = @1;
    alpha.toValue = @0.1;
    alpha.duration = self.duration * 0.4;
    alpha.beginTime = self.duration - alpha.duration;

    CAAnimationGroup *group = [CAAnimationGroup animation];
    group.animations = @[keyFrame, scale, alpha];
    group.duration = self.duration;
    group.delegate = self;
    group.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
    group.fillMode = kCAFillModeForwards;
    group.removedOnCompletion = NO;
    [layer addAnimation:group forKey:@"group"];

    [_array addObject:layer];
}

#pragma private
- (CGFloat)randomFloat{
    return (arc4random() % 100)/100.0f;
}

- (CALayer *)createLayerWithImage:(UIImage *)image{
    CGFloat scale = [UIScreen mainScreen].scale;
    CALayer *layer = [CALayer layer];
    layer.frame    = CGRectMake(0, 0, image.size.width / scale, image.size.height / scale);
    layer.contents = (__bridge id)image.CGImage;;
    return layer;
}

- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag {
    if (flag) {
        CALayer *layer = [_array firstObject];
        [layer removeAllAnimations];
        [layer removeFromSuperlayer];
        [_array removeObject:layer];
        [_recyclePool addObject:layer];
    }
}
@end


text:
from django.apps import AppConfig

class MudmapConfig(AppConfig):
    name = 'mudmap'


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Elasticsearch.Net;
using Elasticsearch.Net.Connection;
using FluentAssertions;
using Nest.Resolvers.Converters;
using Nest.Tests.MockData.Domain;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using NUnit.Framework;

namespace Nest.Tests.Unit.Reproduce
{
	/// <summary>
	/// tests to reproduce reported errors
	/// </summary>
	[TestFixture]
	public class Reproduce1396Tests : BaseJsonTests
	{
		[JsonConverter(typeof(CustomJsonConverter))]
		public class TermOrder : ICustomJson
		{
			public string Key { get; set; }
			public SortOrder Order { get; set; }
			public object GetCustomJson()
			{
				return new Dictionary<string, SortOrder> {{this.Key, this.Order}};
			}
		}

		public class MyTermsAggregationFix : TermsAggregator
		{
			[JsonProperty("order")]
			public new List<TermOrder> TermsOrder { get; set; }
		}

		public class MyTermsAggregationsFluentFix<T> : TermsAggregationDescriptor<T>
			where T : class
		{
			[JsonProperty("order")]
			internal List<TermOrder> TermsOrder { get; set; }

			public MyTermsAggregationsFluentFix<T> PatchedOrder(List<TermOrder> order)
			{
				this.TermsOrder = order;
				return this;
			}

		}

		[Test]
		public void FixDslThroughCustomInterfaceImplementation()
		{
			var order = new List<TermOrder>()
			{
				new TermOrder { Key = "x", Order = SortOrder.Ascending},
				new TermOrder { Key = "y", Order = SortOrder.Descending}
			};
			var agg = new MyTermsAggregationFix
			{
				Field = "x",
				TermsOrder = order
			};
			var search = new SearchRequest
			{
				Aggregations = new Dictionary<string, IAggregationContainer>
				{
					{
						"my_terms_agg", new AggregationContainer
						{
							Terms = agg
						}
					}
				}
			};
			this.JsonEquals(search, MethodBase.GetCurrentMethod(), "PatchedTermsAggSort");
		}

		[Test]
		public void FixDslThroughCustomInterfaceImplementationUsingFluent()
		{
			var order = new List<TermOrder>()
			{
				new TermOrder { Key = "x", Order = SortOrder.Ascending},
				new TermOrder { Key = "y", Order = SortOrder.Descending}
			};
			var search = new SearchDescriptor<ElasticsearchProject>()
				.Aggregations(aggs=>aggs
					.Terms("my_terms_agg", t=> new MyTermsAggregationsFluentFix<ElasticsearchProject>()
						.PatchedOrder(order)
						.Field("x")
					)
				)

			;
			this.JsonEquals(search, MethodBase.GetCurrentMethod(), "PatchedTermsAggSort");
		}

	}
}


text: Модуль создания пресс-центра для Drupal 8.


text:
<?php

namespace Hubzero\User;

use Hubzero\Config\Registry;
use Hubzero\Utility\Date;
use Hubzero\Access\Access;
use Hubzero\Access\Map;
use Exception;
use Event;

/**
 * Users database model
 *
 * @uses \Hubzero\Database\Relational
 */
class User extends \Hubzero\Database\Relational
{
	/**
	 * Default order by for model
	 *
	 * @var    string
	 * @since  2.1.0
	 */
	public $orderBy = 'id';

	/**
	 * Default order direction for select queries
	 *
	 * @var    string
	 * @since  2.1.0
	 */
	public $orderDir = 'asc';

	/**
	 * Guest status
	 *
	 * @var    bool
	 * @since  2.1.0
	 */
	public $guest = true;

	/**
	 * Fields and their validation criteria
	 *
	 * @var    array
	 * @since  2.1.0
	 */
	protected $rules = array(
		'name'     => 'notempty',
		'email'    => 'notempty',
		'username' => 'notempty'
	);

	/**
	 * Automatic fields to populate every time a row is created
	 *
	 * @var    array
	 * @since  2.1.0
	 */
	public $initiate = array(
		'registerDate',
		'registerIP',
		'access'
	);

	/**
	 * A cached switch for if this user has root access rights.
	 *
	 * @var    boolean
	 * @since  2.1.0
	 */
	protected $isRoot = null;

	/**
	 * User params
	 *
	 * @var    object
	 * @since  2.1.0
	 */
	protected $userParams = null;

	/**
	 * Authorised access groups
	 *
	 * @var    array
	 * @since  2.1.0
	 */
	protected $authGroups = null;

	/**
	 * Authorised access levels
	 *
	 * @var    array
	 * @since  2.1.0
	 */
	protected $authLevels = null;

	/**
	 * Authorised access actions
	 *
	 * @var    array
	 * @since  2.1.0
	 */
	protected $authActions = null;

	/**
	 * Link pattern
	 *
	 * @var    string
	 * @since  2.1.0
	 */
	public static $linkBase = null;

	/**
	 * List of picture resolvers
	 *
	 * @var    array
	 * @since  2.1.0
	 */
	public static $pictureResolvers = array();

	/**
	 * Serializes the model data for storage
	 *
	 * @return  string
	 * @since   2.1.0
	 */
	public function serialize()
	{
		$attr = $this->getAttributes();

		$attr['guest'] = $this->guest;

		return serialize($attr);
	}

	/**
	 * Unserializes the data into a new model
	 *
	 * @param   string  $data  The data to build from
	 * @return  void
	 * @since   2.1.0
	 */
	public function unserialize($data)
	{
		$this->__construct();

		$data = unserialize($data);

		if (isset($data['guest']))
		{
			$this->guest = $data['guest'];
			unset($data['guest']);
		}

		$this->set($data);
	}

	/**
	 * Sets up additional custom rules
	 *
	 * @return  void
	 */
	public function setup()
	{
		// Check that username conforms to rules
		$this->addRule('username', function($data)
		{
			$username = $data['username'];

			// We do this here because we need to allow one possible
			// "invalid" username to pass through, used when creating
			// temp accounts during the 3rd party auth registration
			if (is_numeric($username) && $username < 0)
			{
				return false;
			}

			if (preg_match('#[<>"\'%;()&\\\\]|\\.\\./#', $username)
			 || strlen(utf8_decode($username)) < 2
			 || trim($username) != $username)
			{
				return \Lang::txt('JLIB_DATABASE_ERROR_VALID_AZ09', 2);
			}

			return false;
		});

		// Check for existing username
		$this->addRule('username', function($data)
		{
			$user = self::oneByUsername($data['username']);

			if ($user->get('id') && $user->get('id') != $data['id'])
			{
				return \Lang::txt('JLIB_DATABASE_ERROR_USERNAME_INUSE');
			}

			return false;
		});

		// Check for valid email address
		// We do this here because we need to allow one possible
		// "invalid" address to pass through, used when creating
		// temp accounts during the 3rd party auth registration
		$this->addRule('email', function($data)
		{
			$email = $data['email'];

			if (preg_match('/^-[0-9]+@invalid$/', $email))
			{
				return false;
			}

			return (\Hubzero\Utility\Validate::email($email) ? false : 'Email does not appear to be valid');
		});
	}

	/**
	 * Generates automatic registerDate field value
	 *
	 * @param   array   $data  the data being saved
	 * @return  string
	 */
	public function automaticRegisterDate($data)
	{
		$dt = new Date('now');

		return $dt->toSql();
	}

	/**
	 * Generates automatic registerIP field value
	 *
	 * @param   array   $data  the data being saved
	 * @return  string
	 */
	public function automaticRegisterIP($data)
	{
		if (!isset($data['registerIP']))
		{
			$data['registerIP'] = \Request::ip();
		}
		return $data['registerIP'];
	}

	/**
	 * Generates automatic access field value
	 *
	 * @param   array   $data  the data being saved
	 * @return  string
	 */
	public function automaticAccess($data)
	{
		if (!isset($data['access']) || !$data['access'])
		{
			$data['access'] = 1;
		}
		return $data['access'];
	}

	/**
	 * Defines a one to many relationship between users and reset tokens
	 *
	 * @return  object  \Hubzero\Database\Relationship\OneToMany
	 * @since   2.0.0
	 */
	public function tokens()
	{
		return $this->oneToMany('Hubzero\User\Token', 'user_id');
	}

	/**
	 * Defines a one to one relationship between a user and their reputation
	 *
	 * @return  object  \Hubzero\Database\Relationship\OneToOne
	 * @since   2.0.0
	 */
	public function reputation()
	{
		return $this->oneToOne('Hubzero\User\Reputation', 'user_id');
	}

	/**
	 * Get access groups
	 *
	 * @return  object
	 */
	public function accessgroups()
	{
		return $this->oneToMany('Hubzero\Access\Map', 'user_id');
	}

	/**
	 * Get groups
	 *
	 * @param   string  $role
	 * @return  array
	 */
	public function groups($role = 'all')
	{
		//return $this->manyToMany('Hubzero\User\Extended\Group', 'id', 'uidNumber');

		static $groups;

		if (!isset($groups))
		{
			$groups = array(
				'applicants' => array(),
				'invitees'   => array(),
				'members'    => array(),
				'managers'   => array(),
				'all'        => array()
			);
			$all = Helper::getGroups($this->get('id'), 'all', 1);

			if ($all)
			{
				$groups['all'] = $all;

				foreach ($groups['all'] as $item)
				{
					if ($item->registered)
					{
						if (!$item->regconfirmed)
						{
							$groups['applicants'][] = $item;
						}
						else
						{
							if ($item->manager)
							{
								$groups['managers'][] = $item;
							}
							else
							{
								$groups['members'][] = $item;
							}
						}
					}
					else
					{
						$groups['invitees'][] = $item;
					}
				}
			}
		}

		if ($role)
		{
			return (isset($groups[$role])) ? $groups[$role] : array();
		}

		return $groups;
	}

	/**
	 * Defines a relationship with a generic user logging class (not a relational model itself)
	 *
	 * @return  object  \Hubzero\User\Logger
	 * @since   2.0.0
	 */
	public function logger()
	{
		return new Logger($this);
	}

	/**
	 * Gets an attribute by key
	 *
	 * This will not retrieve properties directly attached to the model,
	 * even if they are public - those should be accessed directly!
	 *
	 * Also, make sure to access properties in transformers using the get method.
	 * Otherwise you'll just get stuck in a loop!
	 *
	 * @param   string  $key      The attribute key to get
	 * @param   mixed   $default  The value to provide, should the key be non-existent
	 * @return  mixed
	 */
	public function get($key, $default = null)
	{
		if ($key == 'guest')
		{
			return $this->isGuest();
		}

		if ($key == 'uidNumber')
		{
			$key = 'id';
		}

		// If the givenName, middleName, or surname isn't set, try to determine it from the name
		if (($key == 'givenName' || $key == 'middleName' || $key == 'surname') && parent::get($key, null) == null)
		{
			return $this->parseName($key);
		}

		// Legacy code expects get('id') to always
		// return an integer, even if user is logged out
		if ($key == 'id' && is_null($default))
		{
			$default = 0;
		}

		return parent::get($key, $default);
	}

	/**
	 * Sets attributes (i.e. fields) on the model
	 *
	 * This must be used when setting data to be saved. Otherwise, the properties
	 * will be attached directly to the model itself and not included in the save.
	 *
	 * @param   array|string  $key    The key to set, or array of key/value pairs
	 * @param   mixed         $value  The value to set if key is string
	 * @return  object        $this   Chainable
	 * @since   2.1.0
	 */
	public function set($key, $value = null)
	{
		if (is_string($key) && $key == 'guest')
		{
			return $this->guest = $value;
		}

		if (is_string($key) && $key == 'uidNumber')
		{
			$key = 'id';
		}

		return parent::set($key, $value);
	}

	/**
	 * Is the current user a guest (logged out) or not?
	 *
	 * @return  boolean
	 */
	public function isGuest()
	{
		$pubkeyb64 = Config::get('jwt_pub_key', null);
		$env = substr(Config::get('application_env', ''), -5);

		// check for a jwt if user is not logged in
		if ($this->guest && array_key_exists('jwt', $_COOKIE) &&
			$env == 'cloud' && !is_null($pubkeyb64))
		{
			try
			{
				// decode public key and use it to check jwt signature
				$pubkey = base64_decode($pubkeyb64);
				$jwt = \Firebase\JWT\JWT::decode($_COOKIE['jwt'], $pubkey, array('RS512'));

				// if we have information for a user, populate the user variable
				if (isset($jwt->email) && isset($jwt->id) && isset($jwt->username) && isset($jwt->name) && isset($jwt->exp))
				{
					if ($jwt->exp < time())
					{
						setcookie('jwt', -86400, '', '/', '.' . \Hubzero\Utility\Dns::domain(), true, true);
						return $this->guest();
					}
					$jwtid = $jwt->id;
					$jwtemail = $jwt->email;
					$jwtuser = $jwt->username;
					$jwtname = $jwt->name;

					// check if we have a user by this email address
					$user = \User::oneByEmail($jwtemail);

					// this user does not exist
					// we should create this in the hub database
					if ($user->isNew())
					{
						// Using SQL here because the ORM does not currently support writing
						// new records with a specific primary key value
						$db = App::get('db');
						$query = "INSERT INTO `#__users` (`id`, `name`, `username`, `email`, `password`, `usertype`, `block`, " .
							"`approved`, `sendEmail`, `activation`, `params`, `access`, `usageAgreement`, `homeDirectory`, `loginShell`, `ftpShell`)
							VALUES (" . $db->quote($jwtid) . ", " . $db->quote($jwtname) . ", " . $db->quote($jwtuser) .
							", " . $db->quote($jwtemail) . ", " . $db->quote('') . ", " . $db->quote('') . ", " .
							$db->quote('0') . ", " . $db->quote('2') . ", " . $db->quote('0') . ", " . $db->quote('1') .
							", " . $db->quote('') . ", " . $db->quote('5') . ", " . $db->quote('1') . ", " .
							$db->quote('/home/' . $jwtuser) . ", " . $db->quote('/bin/bash') . ", " .
							$db->quote('/usr/lib/sftp-server') . ")";

						$db->setQuery($query);
						$result = $db->query();

						$usersConfig = Component::params('com_members');
						$newUsertype = $usersConfig->get('new_usertype', '2');
						$query = "INSERT INTO `#__user_usergroup_map` (`user_id`, `group_id`) VALUES (" . $db->quote($jwtid) . ", " . $db->quote($newUsertype) . ")";
						$db->setQuery($query);
						$result = $db->query();
						// Clear the session that was not logged in
						App::get('session')->restart();
					}

					// set up the user object to be logged in
					\User::set('id', $user->get('id'));
					\User::set('email', $jwtemail);
					\User::set('username', $jwtuser);
					\User::set('guest', false);
					\User::set('approved', 2);

					// set the user object in the session such that
					// next visit and other plugins that use the session
					// know what user is logged in
					App::get('session')->set('user', App::get('user')->getInstance());
					$this->guest = false;

					$data = App::get('user')->getInstance()->toArray();
					\Event::trigger('user.onUserLogin', array($data));
				}
			}
			catch (Exception $e)
			{
				// something likely went wrong with the jwt
			}
		}
		return $this->guest;
	}

	/**
	 * Transform parameters into object
	 *
	 * @return  object  \Hubzero\Config\Registry
	 * @since   2.1.0
	 */
	public function transformParams()
	{
		if (!isset($this->userParams))
		{
			$this->userParams = new Registry($this->get('params'));
		}

		return $this->userParams;
	}

	/**
	 * Method to get a parameter value
	 *
	 * @param   string  $key      Parameter key
	 * @param   mixed   $default  Parameter default value
	 * @return  mixed   The value or the default if it did not exist
	 * @since   2.1.0
	 */
	public function getParam($key, $default = null)
	{
		return $this->params->get($key, $default);
	}

	/**
	 * Method to set a parameter
	 *
	 * @param   string  $key    Parameter key
	 * @param   mixed   $value  Parameter value
	 * @return  mixed   Set parameter value
	 * @since   2.1.0
	 */
	public function setParam($key, $value)
	{
		return $this->params->set($key, $value);
	}

	/**
	 * Method to set a default parameter if it does not exist
	 *
	 * @param   string  $key    Parameter key
	 * @param   mixed   $value  Parameter value
	 * @return  mixed   Set parameter value
	 * @since   2.1.0
	 */
	public function defParam($key, $value)
	{
		return $this->params->def($key, $value);
	}

	/**
	 * Get a user's picture
	 *
	 * @param   integer  $anonymous  Is user anonymous?
	 * @param   boolean  $thumbnail  Show thumbnail or full picture?
	 * @param   boolean  $serveFile  Serve file?
	 * @return  string
	 * @since   2.1.0
	 */
	public function picture($anonymous=0, $thumbnail=true, $serveFile=true)
	{
		static $fallback;

		if (!isset($fallback))
		{
			$image = "<svg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64' style='stroke-width: 0px; background-color: #ffffff;'>" .
					"<path fill='#d9d9d9' d='M63.9 64v-3c-.6-.9-1-1.8-1.4-2.8l-1.2-3c-.4-1-.9-1.9-1.4-2.8S58.8 50.9 58 " .
					"50c-.8-.8-1.5-1.3-2.4-1.5-.6-.2-1.1-.3-1.7-.4-.6 0-2.1-.3-4.4-.6l-8.4-1.3c-.2-.8-.4-1.5-.5-2.4-.1-" .
					".8-.3-1.5-.6-2.4.3-.6.7-1 1.1-1.5.4-.6.8-1 1.1-1.5.4-.6.7-1.3 1-2.2.3-.8.8-3.5 1.3-7.8l.4-3c.1-.9." .
					"1-1.4.1-1.5 0-2.9-1-5.6-3.1-8-1-1.3-2.4-2.4-4.1-3.2-1.8-.9-3.7-1.4-6-1.4-2.2 0-4.3.4-6 1.3-1.8.9-3" .
					".1 2-4.2 3.2-1.1 1.3-1.8 2.6-2.3 4.1-.6 1.4-.7 2.5-.7 3.2 0 .7 0 1.5.1 2.3l.4 2.9.4 3.1.4 3.3c.2 1" .
					".1.7 2.4 1.5 3.7.3.6.7 1.1 1.1 1.5l1.1 1.5c-.2.8-.4 1.5-.6 2.4-.1.8-.3 1.5-.6 2.4l-5.6.8-4.6.8c-1." .
					"2.2-2.1.3-2.6.4-.6.1-1.1.2-1.7.4-2.1.8-4 3.1-5.7 6.8L.9 58.5c-.4 1-.8 1.9-1.3 2.8V64h64.3z'/>" .
					"</svg>";

			$fallback = sprintf('data:image/svg+xml;base64,%s', base64_encode($image));
		}

		if (!$this->get('id') || $anonymous)
		{
			return $fallback;
		}

		$picture = null;

		foreach (self::$pictureResolvers as $resolver)
		{
			$picture = $resolver->picture($this->get('id'), $this->get('name'), $this->get('email'), $thumbnail);

			if ($picture)
			{
				break;
			}
		}

		if (!$picture)
		{
			$picture = $fallback;
		}

		return $picture;
	}

	/**
	 * Generate and return various links to the entry
	 * Link will vary depending upon action desired such as edit, delete, etc.
	 *
	 * @param   string  $type  The type of link to return
	 * @return  string
	 * @since   2.1.0
	 */
	public function link($type='')
	{
		if (!$this->get('id') || !self::$linkBase)
		{
			return '';
		}

		$link = str_replace(
			array(
				'{ID}',
				'{USERNAME}',
				'{EMAIL}',
				'{NAME}'
			),
			array(
				$this->get('id'),
				$this->get('username'),
				$this->get('email'),
				str_replace(' ', '+', $this->get('name'))
			),
			self::$linkBase
		);

		return $link;
	}

	/**
	 * Finds a user by username
	 *
	 * @param   string  $username
	 * @return  object
	 * @since   2.1.0
	 */
	public static function oneByUsername($username)
	{
		return self::all()
			->whereEquals('username', $username)
			->row();
	}

	/**
	 * Finds a user by email
	 *
	 * @param   string  $email
	 * @return  object
	 * @since   2.1.0
	 */
	public static function oneByEmail($email)
	{
		if (!filter_var($email, FILTER_VALIDATE_EMAIL))
		{
			return self::oneByUsername($email);
		}

		return self::all()
			->whereEquals('email', $email)
			->row();
	}

	/**
	 * Finds a user by activation token
	 *
	 * @param   string  $token
	 * @return  object
	 * @since   2.1.0
	 */
	public static function oneByActivationToken($token)
	{
		return self::all()
			->whereEquals('activation', $token)
			->row();
	}

	/**
	 * Pass through method to the table for setting the last visit date
	 *
	 * @param   integer  $timestamp  The timestamp, defaults to 'now'.
	 * @return  boolean  True on success.
	 * @since   2.1.0
	 */
	public function setLastVisit($timestamp = 'now')
	{
		$timestamp = new Date($timestamp);

		$query = $this->getQuery()
			->update($this->getTableName())
			->set(array('lastvisitDate' => $timestamp->toSql()))
			->whereEquals('id', $this->get('id'));

		return $query->execute();
	}

	/**
	 * Alias for authorise() method
	 *
	 * @param   string   $action     The name of the action to check for permission.
	 * @param   string   $assetname  The name of the asset on which to perform the action.
	 * @return  boolean  True if authorised
	 * @since   2.1.0
	 */
	public function authorize($action, $assetname = null)
	{
		return $this->authorise($action, $assetname);
	}

	/**
	 * Method to check User object authorisation against an access control
	 * object and optionally an access extension object
	 *
	 * @param   string   $action     The name of the action to check for permission.
	 * @param   string   $assetname  The name of the asset on which to perform the action.
	 * @return  boolean  True if authorised
	 * @since   2.1.0
	 */
	public function authorise($action, $assetname = null)
	{
		// Make sure we only check for core.admin once during the run.
		if ($this->isRoot === null)
		{
			$this->isRoot = false;

			// Check for the configuration file failsafe.
			$rootUser = \App::get('config')->get('root_user');

			// The root_user variable can be a numeric user ID or a username.
			if (is_numeric($rootUser) && $this->get('id') > 0 && $this->get('id') == $rootUser)
			{
				$this->isRoot = true;
			}
			elseif ($this->username && $this->username == $rootUser)
			{
				$this->isRoot = true;
			}
			else
			{
				// Get all groups against which the user is mapped.
				$identities = $this->getAuthorisedGroups();

				array_unshift($identities, $this->get('id') * -1);

				if (Access::getAssetRules(1)->allow('core.admin', $identities))
				{
					$this->isRoot = true;
					return true;
				}
			}
		}

		return $this->isRoot ? true : Access::check($this->get('id'), $action, $assetname);
	}

	/**
	 * Method to return a list of all categories that a user has permission for a given action
	 *
	 * @param   string  $component  The component from which to retrieve the categories
	 * @param   string  $action     The name of the section within the component from which to retrieve the actions.
	 * @return  array   List of categories that this group can do this action to (empty array if none). Categories must be published.
	 * @since   2.1.0
	 */
	public function getAuthorisedCategories($component, $action)
	{
		// Brute force method: get all published category rows for the component and check each one
		// TODO: Move to ORM-based models
		$db = \App::get('db');
		$query = $db->getQuery()
			->select('c.id', 'id')
			->select('a.name', 'asset_name')
			->from('#__categories', 'c')
			->join('#__assets AS a', 'c.asset_id', 'a.id', 'inner')
			->whereEquals('c.extension', $component)
			->whereEquals('c.published', '1');
		$db->setQuery($query->toString());

		$allCategories = $db->loadObjectList('id');

		$allowedCategories = array();

		foreach ($allCategories as $category)
		{
			if ($this->authorise($action, $category->asset_name))
			{
				$allowedCategories[] = (int) $category->id;
			}
		}

		return $allowedCategories;
	}

	/**
	 * Gets an array of the authorised access levels for the user
	 *
	 * @return  array
	 * @since   2.1.0
	 */
	public function getAuthorisedViewLevels()
	{
		if (is_null($this->authLevels))
		{
			$this->authLevels = array();
		}

		if (empty($this->_authLevels))
		{
			$this->authLevels = Access::getAuthorisedViewLevels($this->get('id'));
		}

		return $this->authLevels;
	}

	/**
	 * Gets an array of the authorised user groups
	 *
	 * @return  array
	 * @since   2.1.0
	 */
	public function getAuthorisedGroups()
	{
		if (is_null($this->authGroups))
		{
			$this->authGroups = array();
		}

		if (empty($this->authGroups))
		{
			$this->authGroups = Access::getGroupsByUser($this->get('id'));
		}

		return $this->authGroups;
	}

	/**
	 * Save data
	 *
	 * @return  boolean
	 */
	public function save()
	{
		// Trigger the onUserBeforeSave event.
		$data  = $this->toArray();
		$isNew = $this->isNew();

		// Allow an exception to be thrown.
		try
		{
			$oldUser = self::oneOrNew($this->get('id'));

			// Trigger the onUserBeforeSave event.
			$result = Event::trigger('user.onUserBeforeSave', array($oldUser->toArray(), $isNew, $data));

			if (in_array(false, $result, true))
			{
				// Plugin will have to raise its own error or throw an exception.
				return false;
			}

			// Get any set access groups
			$groups = null;

			if ($this->hasAttribute('accessgroups'))
			{
				$groups = $this->get('accessgroups');

				$this->removeAttribute('accessgroups');
			}

			// Save record
			$result = parent::save();

			if (!$result)
			{
				throw new Exception($this->getError());
			}

			// Update access groups
			if ($groups && is_array($groups))
			{
				Map::destroyByUser($this->get('id'));

				Map::addUserToGroup($this->get('id'), $groups);
			}

			// In case it's a new user, we need to grab the ID
			$data['id'] = $this->get('id');

			// Fire the onUserAfterSave event
			Event::trigger('user.onUserAfterSave', array($data, $isNew, $result, $this->getError()));

			$this->purgeCache();
		}
		catch (Exception $e)
		{
			$this->addError($e->getMessage());

			$result = false;
		}

		return $result;
	}

	/**
	 * Delete the record and associated data
	 *
	 * @return  boolean  False if error, True on success
	 */
	public function destroy()
	{
		$data = $this->toArray();

		// Trigger the onUserBeforeDelete event
		Event::trigger('user.onUserBeforeDelete', array($data));

		// Remove associated data
		if ($this->reputation->get('id'))
		{
			if (!$this->reputation->destroy())
			{
				$this->addError($this->reputation->getError());
				return false;
			}
		}

		foreach ($this->tokens()->rows() as $token)
		{
			if (!$token->destroy())
			{
				$this->addError($token->getError());
				return false;
			}
		}

		Map::destroyByUser($this->get('id'));

		// Attempt to delete the record
		$result = parent::destroy();

		if ($result)
		{
			// Trigger the onUserAfterDelete event
			Event::trigger('user.onUserAfterDelete', array($data, true, $this->getError()));
		}

		return $result;
	}

	/**
	 * Parse a users name and set the name parts on the instance
	 *
	 * @return void
	 */
	private function parseName($key=null)
	{
		$name = $this->get('name');
		if ($name)
		{
			$firstname  = "";
			$middlename = "";
			$lastname   = "";

			$words = array_map('trim', explode(' ', $this->get('name')));
			$count = count($words);

			if ($count == 1)
			{
				$firstname = $words[0];
			}
			else if ($count == 2)
			{
				$firstname = $words[0];
				$lastname  = $words[1];
			}
			else if ($count == 3)
			{
				$firstname  = $words[0];
				$middlename = $words[1];
				$lastname   = $words[2];
			}
			else
			{
				$firstname  = $words[0];
				$lastname   = $words[$count-1];
				$middlename = $words[1];

				for ($i = 2; $i < $count-1; $i++)
				{
					$middlename .= ' ' . $words[$i];
				}
			}
			switch ($key)
			{
				case 'givenName':
					return trim($firstname);
					break;
				case 'middleName':
					return trim($middlename);
					break;
				case 'surname':
					return trim($lastname);
					break;
				default:
					return '';
			}
		}
	}
}


text:
#ifndef __ASM__ARCH_OMAP_I2C_H
#define __ASM__ARCH_OMAP_I2C_H

#include <linux/i2c.h>
#include <linux/i2c-omap.h>

#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
extern int omap_register_i2c_bus(int bus_id, u32 clkrate,
				 struct i2c_board_info const *info,
				 unsigned len);
#else
static inline int omap_register_i2c_bus(int bus_id, u32 clkrate,
				 struct i2c_board_info const *info,
				 unsigned len)
{
	return 0;
}
#endif

/**
 * i2c_dev_attr - OMAP I2C controller device attributes for omap_hwmod
 * @fifo_depth: total controller FIFO size (in bytes)
 * @flags: differences in hardware support capability
 *
 * @fifo_depth represents what exists on the hardware, not what is
 * actually configured at runtime by the device driver.
 */
struct omap_i2c_dev_attr {
	u8	fifo_depth;
	u32	flags;
};

void __init omap1_i2c_mux_pins(int bus_id);
void __init omap2_i2c_mux_pins(int bus_id);

struct omap_hwmod;
int omap_i2c_reset(struct omap_hwmod *oh);

#endif /* __ASM__ARCH_OMAP_I2C_H */


text:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# no unicode literals
import sys
import time
log_file_name = sys.argv[1]

# Copy json from stdin to the log file
with open(log_file_name, 'a') as f:
    print('trigjson.py: Copying STDIN to %s' % log_file_name)
    json_in = sys.stdin.read()
    print('stdin: %s' % json_in)
    f.write(json_in)


text:
//
//  BuglyConfig.h
//
//
//  Copyright (c) 2016年 Tencent. All rights reserved.
//

#pragma once

#define BLY_UNAVAILABLE(x) __attribute__((unavailable(x)))

#if __has_feature(nullability)
#define BLY_NONNULL __nonnull
#define BLY_NULLABLE __nullable
#define BLY_START_NONNULL _Pragma("clang assume_nonnull begin")
#define BLY_END_NONNULL _Pragma("clang assume_nonnull end")
#else
#define BLY_NONNULL
#define BLY_NULLABLE
#define BLY_START_NONNULL
#define BLY_END_NONNULL
#endif

#import <Foundation/Foundation.h>
#import "BuglyLog.h"

BLY_START_NONNULL

@protocol BuglyDelegate <NSObject>

@optional
/**
 *  发生异常时回调
 *
 *  @param exception 异常信息
 *
 *  @return 返回需上报记录,随异常上报一起上报
 */
- (NSString * BLY_NULLABLE)attachmentForException:(NSException * BLY_NULLABLE)exception;

@end

@interface BuglyConfig : NSObject

/**
 *  SDK Debug信息开关, 默认关闭
 */
@property (nonatomic, assign) BOOL debugMode;

/**
 *  设置自定义渠道标识
 */
@property (nonatomic, copy) NSString *channel;

/**
 *  设置自定义版本号
 */
@property (nonatomic, copy) NSString *version;

/**
 *  设置自定义设备唯一标识
 */
@property (nonatomic, copy) NSString *deviceId;

/**
 *  卡顿监控开关,默认关闭
 */
@property (nonatomic) BOOL blockMonitorEnable;

/**
 *  卡顿监控判断间隔,单位为秒
 */
@property (nonatomic) NSTimeInterval blockMonitorTimeout;

/**
 *  设置 App Groups Id (如有使用 Bugly iOS Extension SDK,请设置该值)
 */
@property (nonatomic, copy) NSString *applicationGroupIdentifier;

/**
 *  ATS开关,默认开启
 */
@property (nonatomic) BOOL appTransportSecurityEnable;

/**
 *  进程内还原开关,默认开启
 */
@property (nonatomic) BOOL symbolicateInProcessEnable;

/**
 *  非正常退出事件记录开关,默认关闭
 */
@property (nonatomic) BOOL unexpectedTerminatingDetectionEnable;

/**
 *  页面信息记录开关,默认开启
 */
@property (nonatomic) BOOL viewControllerTrackingEnable;

/**
 *  Bugly Delegate
 */
@property (nonatomic, assign) id<BuglyDelegate> delegate;

/**
 * 控制自定义日志上报,默认值为BuglyLogLevelSilent,即关闭日志记录功能。
 * 如果设置为BuglyLogLevelWarn,则在崩溃时会上报Warn、Error接口打印的日志
 */
@property (nonatomic, assign) BuglyLogLevel reportLogLevel;

/**
 *  崩溃数据过滤器,如果崩溃堆栈的模块名包含过滤器中设置的关键字,则崩溃数据不会进行上报
 *  例如,过滤崩溃堆栈中包含搜狗输入法的数据,可以添加过滤器关键字SogouInputIPhone.dylib等
 */
@property (nonatomic, copy) NSArray * excludeModuleFilter;

@end
BLY_END_NONNULL


text:
"""Generator for Pnacl Shim functions that bridges the calling conventions
between GCC and PNaCl.  """

from datetime import datetime
import difflib
import glob
import os
import sys

from idl_c_proto import CGen
from idl_gen_wrapper import Interface, WrapperGen
from idl_log import ErrOut, InfoOut, WarnOut
from idl_option import GetOption, Option, ParseOptions
from idl_parser import ParseFiles

Option('pnaclshim', 'Name of the pnacl shim file.',
       default='temp_pnacl_shim.c')

Option('disable_pnacl_opt', 'Turn off optimization of pnacl shim.')

class PnaclGen(WrapperGen):
  """PnaclGen generates shim code to bridge the Gcc ABI with PNaCl.

  This subclass of WrapperGenerator takes the IDL sources and
  generates shim methods for bridging the calling conventions between GCC
  and PNaCl (LLVM). Some of the PPAPI methods do not need shimming, so
  this will also detect those situations and provide direct access to the
  original PPAPI methods (rather than the shim methods).
  """

  def __init__(self):
    WrapperGen.__init__(self,
                        'Pnacl',
                        'Pnacl Shim Gen',
                        'pnacl',
                        'Generate the PNaCl shim.')
    self.cgen = CGen()
    self._skip_opt = False
    self._pnacl_attribute = '__attribute__((pnaclcall))'

  ############################################################

  def OwnHeaderFile(self):
    """Return the header file that specifies the API of this wrapper.
    We do not generate the header files.  """
    return 'ppapi/generators/pnacl_shim.h'

  def InterfaceNeedsWrapper(self, iface, releases):
    """Return true if the interface has ANY methods that need wrapping.
    """
    if self._skip_opt:
      return True
    for release in iface.GetUniqueReleases(releases):
      version = iface.GetVersion(release)
      if self.InterfaceVersionNeedsWrapping(iface, version):
        return True
    return False

  def InterfaceVersionNeedsWrapping(self, iface, version):
    """Return true if the interface+version has ANY methods that
    need wrapping.
    """
    if self._skip_opt:
      return True
    for member in iface.GetListOf('Member'):
      release = member.GetRelease(version)
      if self.MemberNeedsWrapping(member, release):
        return True
    return False

  def MemberNeedsWrapping(self, member, release):
    """Return true if a particular member function at a particular
    release needs wrapping.
    """
    if self._skip_opt:
      return True
    if not member.InReleases([release]):
      return False
    ret, name, array, args_spec = self.cgen.GetComponents(member,
                                                          release,
                                                          'store')
    return self.TypeNeedsWrapping(ret, []) or self.ArgsNeedWrapping(args_spec)

  def ArgsNeedWrapping(self, args):
    """Return true if any parameter in the list needs wrapping.
    """
    for arg in args:
      (type_str, name, array_dims, more_args) = arg
      if self.TypeNeedsWrapping(type_str, array_dims):
        return True
    return False

  def TypeNeedsWrapping(self, type_node, array_dims):
    """Return true if a parameter type needs wrapping.
    Currently, this is true for byval aggregates.
    """
    is_aggregate = type_node.startswith('struct') or \
        type_node.startswith('union')
    is_reference = (type_node.find('*') != -1 or array_dims != [])
    return is_aggregate and not is_reference

  ############################################################

  def GenerateWrapperForPPBMethod(self, iface, member):
    result = []
    func_prefix = self.WrapperMethodPrefix(iface.node, iface.release)
    sig = self.cgen.GetSignature(member, iface.release, 'store',
                                 func_prefix, False)
    result.append('static %s\n%s {\n' % (self._pnacl_attribute, sig))
    result.append('  const struct %s *iface = %s.real_iface;\n' %
                  (iface.struct_name, self.GetWrapperInfoName(iface)))
    ret, name, array, cspec = self.cgen.GetComponents(member,
                                                      iface.release,
                                                      'store')
    ret_str, args_str = self.GetReturnArgs(ret, cspec)
    result.append('  %siface->%s(%s);\n}\n\n' % (ret_str,
                                                 member.GetName(), args_str))
    return result

  def GenerateWrapperForPPPMethod(self, iface, member):
    result = []
    func_prefix = self.WrapperMethodPrefix(iface.node, iface.release)
    sig = self.cgen.GetSignature(member, iface.release, 'store',
                                 func_prefix, False)
    result.append('static %s {\n' % sig)
    result.append('  const struct %s *iface = %s.real_iface;\n' %
                  (iface.struct_name, self.GetWrapperInfoName(iface)))
    temp_fp = self.cgen.GetSignature(member, iface.release, 'return',
                                     'temp_fp',
                                     func_as_ptr=True,
                                     ptr_prefix=self._pnacl_attribute + ' ',
                                     include_name=False)
    cast = self.cgen.GetSignature(member, iface.release, 'return',
                                  prefix='',
                                  func_as_ptr=True,
                                  ptr_prefix=self._pnacl_attribute + ' ',
                                  include_name=False)
    result.append('  %s = ((%s)iface->%s);\n' % (temp_fp,
                                                 cast,
                                                 member.GetName()))
    ret, name, array, cspec = self.cgen.GetComponents(member,
                                                      iface.release,
                                                      'store')
    ret_str, args_str = self.GetReturnArgs(ret, cspec)
    result.append('  %stemp_fp(%s);\n}\n\n' % (ret_str, args_str))
    return result

  def GenerateRange(self, ast, releases, options):
    """Generate shim code for a range of releases.
    """
    self._skip_opt = GetOption('disable_pnacl_opt')
    self.SetOutputFile(GetOption('pnaclshim'))
    return WrapperGen.GenerateRange(self, ast, releases, options)

pnaclgen = PnaclGen()

######################################################################
# Tests.

# Clean a string representing an object definition and return then string
# as a single space delimited set of tokens.
def CleanString(instr):
  instr = instr.strip()
  instr = instr.split()
  return ' '.join(instr)

def PrintErrorDiff(old, new):
  oldlines = old.split(';')
  newlines = new.split(';')
  d = difflib.Differ()
  diff = d.compare(oldlines, newlines)
  ErrOut.Log('Diff is:\n%s' % '\n'.join(diff))

def GetOldTestOutput(ast):
  # Scan the top-level comments in the IDL file for comparison.
  old = []
  for filenode in ast.GetListOf('File'):
    for node in filenode.GetChildren():
      instr = node.GetOneOf('Comment')
      if not instr: continue
      instr.Dump()
      old.append(instr.GetName())
  return CleanString(''.join(old))

def TestFiles(filenames, test_releases):
  ast = ParseFiles(filenames)
  iface_releases = pnaclgen.DetermineInterfaces(ast, test_releases)
  new_output = CleanString(pnaclgen.GenerateWrapperForMethods(
      iface_releases, comments=False))
  old_output = GetOldTestOutput(ast)
  if new_output != old_output:
    PrintErrorDiff(old_output, new_output)
    ErrOut.Log('Failed pnacl generator test.')
    return 1
  else:
    InfoOut.Log('Passed pnacl generator test.')
    return 0

def Main(args):
  filenames = ParseOptions(args)
  test_releases = ['M13', 'M14', 'M15']
  if not filenames:
    idldir = os.path.split(sys.argv[0])[0]
    idldir = os.path.join(idldir, 'test_gen_pnacl', '*.idl')
    filenames = glob.glob(idldir)
  filenames = sorted(filenames)
  if GetOption('test'):
    # Run the tests.
    return TestFiles(filenames, test_releases)

  # Otherwise, generate the output file (for potential use as golden file).
  ast = ParseFiles(filenames)
  return pnaclgen.GenerateRange(ast, test_releases, filenames)

if __name__ == '__main__':
  retval = Main(sys.argv[1:])
  sys.exit(retval)


text:
//Customer.cs
//Created by Evgeniya O'Regan Pevchikh, 8/1/2015
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Project.CustomerFiles
{
     [Serializable]
    /// <summary>
    /// this class inherits from Person class
    /// </summary>
    public class Customer: Person
    {
        //customer ID
        private int m_id;
        //instance of product class
        private Product m_product;

        /// <summary>
        /// Default constructor - calls another constructor in this class
        /// </summary>
        public Customer()
            : this(null, null, new Address(), null, new Product(), 0)
        {
        }

        /// <summary>
        /// Constructor with 6 parameters. This is  constructor that has most
        /// number of parameters. It is in this constructor that all coding
        /// should be done.
        /// </summary>
        /// <param name="fname">first name</param>
        /// <param name="lname">surname</param>
        /// <param name="addr">address data</param>
        /// <param name="email">email</param>
        /// <param name="product">product data</param>
        /// <param name="id">customer id</param>
        public Customer(string fname, string lname, Address addr, string email, Product product, int id)
            : base(fname, lname, addr, email)
        {
            m_id = id;
            m_product = product;
        }

        /// <summary>
        /// read and write access to customer id value
        /// </summary>
        public int CustomerId
        {
            get { return m_id; }
            set { m_id = value; }
        }

        /// <summary>
        /// read and write access to product data
        /// </summary>
        public Product ProductData
        {
            get { return m_product; }
            set { m_product = value; }
        }

        /// <summary>
        /// returns a formatted string containing all the object's data
        /// </summary>
        /// <returns>formatted string</returns>
        public override string ToString()
        {
            string strOut = string.Format("{0,-4} {1, -40} {2, 30}", m_id, base.ToString(), m_product.ToString());

            return strOut;
        }
    }
}


text:
@implementation ZFRemovePhotoSetTitlePhoto

#if FL_MRC
- (void) dealloc {
    [super dealloc];
}
#endif
@synthesize photoSetId = _photoSetId;
+ (ZFRemovePhotoSetTitlePhoto*) removePhotoSetTitlePhoto {
    return FLAutorelease([[[self class] alloc] init]);
}

@end


text:
import System.Random (randomIO)
import Data.Time.Clock (getCurrentTime, UTCTime)
import Database.HDBC
import Database.HDBC.PostgreSQL
import Database.NySQL.TH
import Database.NySQL.Options
import Control.Monad
import Control.Monad.Trans
import Control.Exception

import Control.Monad.Catch

$(mkSqlWith (defOpts { paramModifier = ('_':) }) "src/sql/createUser.sql")

main :: IO ()
main = do

  c <- connectPostgreSQL "dbname=example host=localhost user=postgres password=postgres"
  n <- getCurrentTime

  k0 :: Int <- randomIO
  k1 :: Int <- randomIO

  void $ runStmt c CreateUser
    { _key        = show k0
    , _username   = "jsmith"
    , _password   = "Testing0123"
    , _first_name = "John"
    , _last_name  = "Smith"
    , _created_on = n
    , _deleted_on = Nothing :: Maybe UTCTime
    }

  void $ runStmt c CreateUser
    { _key        = show k1
    , _username   = "jsmith"
    , _password   = "Testing0123"
    , _first_name = "John"
    , _last_name  = "Smith"
    , _created_on = n
    , _deleted_on = Nothing :: Maybe UTCTime
    }


text:
package com.android.uiautomator.tree;

public class AttributePair {
    public String key, value;

    public AttributePair(String key, String value) {
        this.key = key;
        this.value = value;
    }
}


text:
+++
author = "John Wang"
title = "Performance is a Feature"
date = "2011-10-04"
tags = [
    "performance",
]
url = "/performance/is-a-feature"
disqus_identifier = "/performance/is-a-feature"
+++

The phrase "Performance is a Feature" has been growing in popularity. Lately, it's importance for me is underlined by the fact the most common response I get from showing off my early-stage mailing list archive, Grokbase, is that "it's fast." I first heard this idea similarly phrased in [Google's Think Quartlerly](https://mashable.com/2011/03/24/think-quarterly/) and then in [Jeff Atwood's Coding Horror](https://blog.codinghorror.com/performance-is-a-feature/) which was [covered on Hacker News](https://news.ycombinator.com/item?id=2676673). Matt Brittin, managing director of Google for UK and IE ops said it like this:

<!--more-->

> At Google, we often think that speed is the forgotten 'killer application' – the ingredient that can differentiate winners from the rest. We know that the faster we deliver results, the more useful people find our service.

I've worked in some high-performance environments (enterprise search for billion+ document archives) and written benchmark reports so I know performance is important; however, this got me thinking, sure "we" (those in the know) know that performance is important, but what about the meta-question, why is it important to say it is important?

# Motivation

For me, the strongest reason for talking about Performance as a Feature is that it can help motivate and focus development. This is important because performance can be vitally important and yet be difficult to achieve and result in little to show using metrics such as lines of code and visible features. Indeed, a product screen shot can look exactly the same after a 100x speed up.

The reason performance can be hard to achieve is three fold.

## Performance is Mentally Challenging

Often times, performance is an architectural problem-solving exercise and not the mere act of taking a requirement and executing on it. Additionally, often times you need to taken into account many domain-specific properties in order to fully optimize the system. So you may need to understand the problem space in detail, come up with a solution, and then communicate / convince others that the design should be accepted even before you get started coding.

## Performance is not Greenfield

Once you come up with a good solution, often times you cannot just implement it as you are improving an existing process. The new solution needs to integrate into the existing solution and either be a drop-in replacement or change the code around it. Like repainting a car after it gets dinged, the affected code can be much larger than the immediate problem. Further, if data conversion is needed, once the new code has been implemented, the conversion process may take longer than development or deployment.

## Performance is Hard to See

Finally, it can be hard to tell your peers what you accomplished if what you accomplished was a performance improvement since there is nothing to see. To complicate matters, you are not necessarily working on a new product or even a new feature. Indeed, you may be just speeding up someone else's creative work. That the speed-up itself is what makes the work useful at all may be hard to convey. Here, metrics tell the best story to other developers but to people using the app, it may be simply fast.

# Summary

As developers, we like to see the fruits of our labor and this often means working on new features that are visible and we can talk about. However, when talking to users, often times the first thing they notice and talk about may be your app's performance. So when developing an app, it is important to remember, that:

Performance is not just any feature, it may be a killer feature.

Have you had to implement performance features? What were the challenges you faced?


text:
<?php

namespace Omnipay\Weixin;

use Omnipay\Common\AbstractGateway;

/**
 * Weixin Base Gateway Class
 */
abstract class BaseAbstractGateway extends AbstractGateway
{

    public function getDefaultParameters()
    {
        return array(
            'partner'      => '',
            'key'          => '',
            'signType'     => 'MD5',
            'inputCharset' => 'utf-8',
            'transport'    => 'http',
            'paymentType'  => 1,
            'itBPay'       => '1d',
        );
    }

    public function getProductId()
    {
        return $this->getParameter('product_id');
    }

    public function setProductId($value)
    {
        $this->setParameter('product_id', $value);
    }

    public function getTradeType()
    {
        return $this->getParameter('trade_type');
    }

    public function setTradeType($value)
    {
        $this->setParameter('trade_type', $value);
    }

    public function getApiKey()
    {
        return $this->getParameter('api_key');
    }

    public function setApiKey($value)
    {
        $this->setParameter('api_key', $value);
    }

    public function getSpbillCreateIp()
    {
        return $this->getParameter('spbill_create_ip');
    }

    public function setSpbillCreateIp($value)
    {
        return $this->setParameter('spbill_create_ip', $value);
    }

    public function getAppid()
    {
        return $this->getParameter('appid');
    }

    public function setAppid($value)
    {
        $this->setParameter('appid', $value);
    }

    public function getMchid()
    {
        return $this->getParameter('mch_id');
    }

    public function setMchid($value)
    {
        $this->setParameter('mch_id', $value);
    }

    public function getBody()
    {
        return $this->getParameter('body');
    }

    public function setBody($value)
    {
        $this->setParameter('body', $value);
    }

    public function getDetail()
    {
        return $this->getParameter('detail');
    }

    public function setDetail($value)
    {
        $this->setParameter('detail', $value);
    }

    public function getOutTradeNo()
    {
        return $this->getParameter('out_trade_no');
    }

    public function setOutTradeNo($value)
    {
        $this->setParameter('out_trade_no', $value);
    }

    public function getNotifyUrl()
    {
        return $this->getParameter('notify_url');
    }

    public function setNotifyUrl($value)
    {
        $this->setParameter('notify_url', $value);
    }

    public function getTotalFee()
    {
        return $this->getParameter('total_fee');
    }

    public function setTotalFee($value)
    {
        $this->setParameter('total_fee', $value);
    }

    public function getTimeStart()
    {
        return $this->getParameter('time_start')?:date('YmdHis');
    }

    public function setTimeStart($value)
    {
        $this->setParameter('time_start', $value);
    }

    public function getTimeExpire()
    {
        return $this->getParameter('time_start')?:date('YmdHis',time()+60000);
    }

    public function setTimeExpire($value)
    {
        $this->setParameter('time_start', $value);
    }

    public function setCaCertPath($value)
    {
        if (! is_file($value)) {
            throw new InvalidRequestException("The ca_cert_path($value) is not exists");
        }

        return $this->setParameter('ca_cert_path', $value);
    }

    public function purchase(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\Weixin\Message\ExpressPurchaseRequest', $parameters);
    }

    public function completePurchase(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\Weixin\Message\ExpressCompletePurchaseRequest', $parameters);
    }
}


text:
using NUnit.Framework;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ConferenceScheduler.Optimizer;
using ConferenceScheduler.Entities;
using ConferenceScheduler.Interfaces;

namespace ConferenceScheduler.Optimizer.Test
{
    [TestFixture]
    public class Engine_Process_ShouldRespectDependenciesBy
    {
        [Test]
        public void ReturningTheOnlyPossibleAssignmentIfTheFirstSessionIsDependentOnTheSecond()
        {
            var engine = (null as IConferenceOptimizer).Create();

            var sessions = new SessionsCollection();
            var session1 = sessions.Add(1, null, Presenter.Create(1));
            var session2 = sessions.Add(2, null, Presenter.Create(1));
            session1.AddDependency(session2);

            var rooms = new List<Room>();
            rooms.Add(Room.Create(1, 10));

            var timeslots = new List<Timeslot>();
            timeslots.Add(Timeslot.Create(1, 10));
            timeslots.Add(Timeslot.Create(2, 11));

            var assignments = engine.Process(sessions, rooms, timeslots);
            var session1Assignment = assignments.Where(a => a.SessionId.Value == 1).Single();
            assignments.WriteSchedule();
            Assert.That(session1Assignment.TimeslotId, Is.EqualTo(2), "Session 1 must be assigned to timeslot 2 to satisfy the dependencies.");
        }

        [Test]
        public void ReturningTheOnlyPossibleAssignmentIfTheSecondSessionIsDependentOnTheFirst()
        {
            var engine = (null as IConferenceOptimizer).Create();

            var sessions = new SessionsCollection();
            var session1 = sessions.Add(1, null, Presenter.Create(1));
            var session2 = sessions.Add(2, null, Presenter.Create(1));
            session2.AddDependency(session1);

            var rooms = new List<Room>();
            rooms.Add(Room.Create(1, 10));

            var timeslots = new List<Timeslot>();
            timeslots.Add(Timeslot.Create(1, 10));
            timeslots.Add(Timeslot.Create(2, 11));

            var assignments = engine.Process(sessions, rooms, timeslots);
            var session2Assignment = assignments.Where(a => a.SessionId.Value == 2).Single();
            assignments.WriteSchedule();
            Assert.That(session2Assignment.TimeslotId, Is.EqualTo(2), "Session 2 must be assigned to timeslot 2 to satisfy the dependencies.");
        }

        [Test]
        public void FindingTheOnlyValidTimeslotForASessionWithChainedDependencies()
        {
            var engine = (null as IConferenceOptimizer).Create();

            var sessions = new SessionsCollection();

            var session1 = sessions.Add(1, null, Presenter.Create(1));
            var session2 = sessions.Add(2, null, Presenter.Create(3));
            var session3 = sessions.Add(3, null, Presenter.Create(1));
            var session4 = sessions.Add(4, null, Presenter.Create(2));
            var session5 = sessions.Add(5, null, Presenter.Create(2));
            var session6 = sessions.Add(6, null, Presenter.Create(2));

            session5.AddDependency(session6);
            session4.AddDependency(session5);

            var rooms = new List<Room>();
            rooms.Add(Room.Create(1));
            rooms.Add(Room.Create(2));

            var timeslots = new List<Timeslot>();
            timeslots.Add(Timeslot.Create(1, 8.5));
            timeslots.Add(Timeslot.Create(2, 9.75));
            timeslots.Add(Timeslot.Create(3, 11.0));

            var assignments = engine.Process(sessions, rooms, timeslots);
            assignments.WriteSchedule();
            var testAssignment = assignments.Single(a => a.SessionId == 4);
            Assert.That(testAssignment.TimeslotId, Is.EqualTo(3), "Session 4 must be in the 3rd timeslot");
        }

        [Test]
        public void FindingTheOnlyValidTimeslotForASessionWithMultipleDependencies()
        {
            var engine = (null as IConferenceOptimizer).Create();

            var sessions = new SessionsCollection();

            var session1 = sessions.Add(1, null, Presenter.Create(1));
            var session2 = sessions.Add(2, null, Presenter.Create(3));
            var session3 = sessions.Add(3, null, Presenter.Create(1));
            var session4 = sessions.Add(4, null, Presenter.Create(2));
            var session5 = sessions.Add(5, null, Presenter.Create(2));
            var session6 = sessions.Add(6, null, Presenter.Create(2));

            session4.AddDependency(session6);
            session4.AddDependency(session5);
            session4.AddDependency(session1);
            session4.AddDependency(session2);

            var rooms = new List<Room>();
            rooms.Add(Room.Create(1));
            rooms.Add(Room.Create(2));

            var timeslots = new List<Timeslot>();
            timeslots.Add(Timeslot.Create(1, 8.5));
            timeslots.Add(Timeslot.Create(2, 9.75));
            timeslots.Add(Timeslot.Create(3, 11.0));

            var assignments = engine.Process(sessions, rooms, timeslots);
            assignments.WriteSchedule();
            var testAssignment = assignments.Single(a => a.SessionId == 4);
            Assert.That(testAssignment.TimeslotId, Is.EqualTo(3), "Session 4 must be in the 3rd timeslot");
        }

        [Test]
        public void FindingTheOnlyValidTimeslotForASessionWithMoreDependenciesThenRooms()
        {
            var engine = (null as IConferenceOptimizer).Create();

            var sessions = new SessionsCollection();

            var session1 = sessions.Add(1, null, Presenter.Create(1));
            var session2 = sessions.Add(2, null, Presenter.Create(3));
            var session3 = sessions.Add(3, null, Presenter.Create(1));
            var session4 = sessions.Add(4, null, Presenter.Create(2));
            var session5 = sessions.Add(5, null, Presenter.Create(2));
            var session6 = sessions.Add(6, null, Presenter.Create(2));

            session4.AddDependency(session6);
            session4.AddDependency(session5);
            session4.AddDependency(session1);
            session4.AddDependency(session2);

            var rooms = new List<Room>();
            rooms.Add(Room.Create(1));
            rooms.Add(Room.Create(2));

            var timeslots = new List<Timeslot>();
            timeslots.Add(Timeslot.Create(1, 8.5));
            timeslots.Add(Timeslot.Create(2, 9.75));
            timeslots.Add(Timeslot.Create(3, 11.0));

            var assignments = engine.Process(sessions, rooms, timeslots);
            assignments.WriteSchedule();
            var testAssignment = assignments.Single(a => a.SessionId == 4);
            Assert.That(testAssignment.TimeslotId, Is.EqualTo(3), "Session 4 must be in the 3rd timeslot");
        }

        [Test]
        public void AssigningAllDependenciesOfASessionPriorToThatSession()
        {
            var engine = (null as IConferenceOptimizer).Create();

            var sessions = new SessionsCollection();

            var session1 = sessions.Add(1, null, Presenter.Create(1));
            var session2 = sessions.Add(2, null, Presenter.Create(3));
            var session3 = sessions.Add(3, null, Presenter.Create(1));
            var session4 = sessions.Add(4, null, Presenter.Create(2));
            var session5 = sessions.Add(5, null, Presenter.Create(2));
            var session6 = sessions.Add(6, null, Presenter.Create(2));

            session4.AddDependency(session6);
            session4.AddDependency(session5);
            session4.AddDependency(session1);
            session4.AddDependency(session2);

            var rooms = new List<Room>();
            rooms.Add(Room.Create(1));
            rooms.Add(Room.Create(2));

            var timeslots = new List<Timeslot>();
            timeslots.Add(Timeslot.Create(1, 8.5));
            timeslots.Add(Timeslot.Create(2, 9.75));
            timeslots.Add(Timeslot.Create(3, 11.0));

            var assignments = engine.Process(sessions, rooms, timeslots);
            assignments.WriteSchedule();

            var targetTimeslotId = assignments.Single(a => a.SessionId == 4).TimeslotId;
            var dependentSessionIds = new List<int>() { 1, 2, 5, 6 };
            var maxTimeslotId = assignments.Where(a => dependentSessionIds.Contains(a.SessionId.Value)).Max(a => a.TimeslotId);

            Assert.That(maxTimeslotId, Is.LessThan(targetTimeslotId), "All dependent sessions must assigned earlier than the dependency session.");
        }

    }
}


text:
namespace ClosedXML.Excel
{
    //Use the class to store magic strings or variables.
    public static class XLConstants
    {
        public const string PivotTableValuesSentinalLabel = "{{Values}}";
        public const int NumberOfBuiltInStyles = 163;

        internal static class Comment
        {
            internal const string ShapeTypeId = "#_x0000_t202";
            internal const string AlternateShapeTypeId = "#_xssf_cell_comment";
        }
    }
}


text:
all:
	go build

test:
	go test

doc:
	markdown-cli -i JSONToTable.md -o JSONToTable.html -c ../markdown-cfg.json

mkdocs:
	cat JSONToTable.md  >>../tmp2
	echo "JSONToTable/JSONToTable.md" >>../m.list


text:
from pybbix.api import API

class Map(API):
    pass


text:
package com.lothrazar.cyclic.item.torchthrow;

import javax.annotation.Nonnull;
import com.lothrazar.cyclic.base.ItemBase;
import net.minecraft.block.Blocks;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.world.World;

public class ItemTorchThrower extends ItemBase {

  public ItemTorchThrower(Properties properties) {
    super(properties.maxStackSize(1).maxDamage(256));
  }

  @Override
  public void inventoryTick(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) {
    if (entity instanceof PlayerEntity) {
      PlayerEntity player = (PlayerEntity) entity;
      tryRepairWith(stack, player, Blocks.TORCH.asItem());
    }
  }

  @Override
  public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity shooter, @Nonnull Hand hand) {
    shootMe(world, shooter, new EntityTorchBolt(shooter, world));
    shooter.getHeldItem(hand).damageItem(1, shooter, (p) -> {
      p.sendBreakAnimation(hand);
    });
    return super.onItemRightClick(world, shooter, hand);
  }
}