text:
import {NgModule,Component,OnInit,OnDestroy,Input,Output,EventEmitter,Optional} from '@angular/core';
import {CommonModule} from '@angular/common';
import {trigger,state,style,transition,animate} from '@angular/animations';
import {Message} from '../common/message';
import {MessageService} from '../common/messageservice';
import {Subscription} from 'rxjs';

@Component({
    selector: 'p-messages',
    template: `
        <div *ngIf="hasMessages()" class="ui-messages ui-widget ui-corner-all" style="display:block"
                    [ngClass]="{'ui-messages-info':(value[0].severity === 'info'),
                    'ui-messages-warn':(value[0].severity === 'warn'),
                    'ui-messages-error':(value[0].severity === 'error'),
                    'ui-messages-success':(value[0].severity === 'success')}"
                    [ngStyle]="style" [class]="styleClass" [@messageAnimation]="{value: 'visible', params: {showTransitionParams: showTransitionOptions, hideTransitionParams: hideTransitionOptions}}">

    `,
    animations: [
        trigger('messageAnimation', [
            state('visible', style({
                transform: 'translateY(0)',
                opacity: 1
            })),
            transition('void => *', [
                style({transform: 'translateY(-25%)', opacity: 0}),
                animate('{{showTransitionParams}}')
            ]),
            transition('* => void', [
                animate(('{{hideTransitionParams}}'), style({
                    opacity: 0,
                    transform: 'translateY(-25%)'
                }))
            ])
        ])
    ]
})
export class Messages implements OnInit, OnDestroy {

    @Input() value: Message[];

    @Input() closable: boolean = true;

    @Input() style: any;

    @Input() styleClass: string;

    @Input() enableService: boolean = true;

    @Input() key: string;

    @Input() showTransitionOptions: string = '300ms ease-out';

    @Input() hideTransitionOptions: string = '250ms ease-in';

    @Output() valueChange: EventEmitter<Message[]> = new EventEmitter<Message[]>();

    messageSubscription: Subscription;

    clearSubscription: Subscription;

    constructor(@Optional() public messageService: MessageService) {}

    ngOnInit() {
        if(this.messageService && this.enableService) {
            this.messageSubscription = this.messageService.messageObserver.subscribe((messages: any) => {
                if(messages) {
                    if(messages instanceof Array) {
                        let filteredMessages = messages.filter(m => this.key === m.key);
                        this.value = this.value ? [...this.value, ...filteredMessages] : [...filteredMessages];
                    }
                    else if (this.key === messages.key) {
                        this.value = this.value ? [...this.value, ...[messages]] : [messages];
                    }
                }
            });

            this.clearSubscription = this.messageService.clearObserver.subscribe(key => {
                if (key) {
                    if (this.key === key) {
                        this.value = null;
                    }
                }
                else {
                    this.value = null;
                }
            });
        }
    }

    hasMessages() {
        return this.value && this.value.length > 0;
    }

    getSeverityClass() {
        return this.value[0].severity;
    }

    clear(event) {
        this.value = [];
        this.valueChange.emit(this.value);

        event.preventDefault();
    }

    get icon(): string {
        let icon: string = null;
        if(this.hasMessages()) {
            let msg = this.value[0];
            switch(msg.severity) {
                case 'success':
                    icon = 'pi-check';
                break;

                case 'info':
                    icon = 'pi-info-circle';
                break;

                case 'error':
                    icon = 'pi-times';
                break;

                case 'warn':
                    icon = 'pi-exclamation-triangle';
                break;

                default:
                    icon = 'pi-info-circle';
                break;
            }
        }

        return icon;
    }

    ngOnDestroy() {
        if (this.messageSubscription) {
            this.messageSubscription.unsubscribe();
        }

        if (this.clearSubscription) {
            this.clearSubscription.unsubscribe();
        }
    }
}

@NgModule({
    imports: [CommonModule],
    exports: [Messages],
    declarations: [Messages]
})
export class MessagesModule { }


text:
package org.apache.phoenix.coprocessor;

import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.Set;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.CoprocessorEnvironment;
import org.apache.hadoop.hbase.DoNotRetryIOException;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.coprocessor.BaseEnvironment;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.regionserver.HRegion;
import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost;
import org.apache.hadoop.hbase.security.User;
import org.apache.phoenix.query.QueryServices;
import org.apache.phoenix.query.QueryServicesOptions;
import org.apache.phoenix.schema.PIndexState;
import org.apache.phoenix.schema.PTable;
import org.apache.phoenix.schema.PTableType;

public class PhoenixMetaDataCoprocessorHost
        extends CoprocessorHost<PhoenixCoprocessor,PhoenixMetaDataCoprocessorHost.PhoenixMetaDataControllerEnvironment> {
    private RegionCoprocessorEnvironment env;
    public static final String PHOENIX_META_DATA_COPROCESSOR_CONF_KEY =
            "hbase.coprocessor.phoenix.classes";
    public static final String DEFAULT_PHOENIX_META_DATA_COPROCESSOR_CONF_KEY="org.apache.phoenix.coprocessor.PhoenixAccessController";

    public PhoenixMetaDataCoprocessorHost(RegionCoprocessorEnvironment env) throws IOException {
        super(null);
        this.env = env;
        this.conf = new Configuration();
        Iterator<Entry<String, String>> iterator = env.getConfiguration().iterator();
        while (iterator.hasNext()) {
            Entry<String,String> entry = iterator.next();
            conf.set(entry.getKey(), entry.getValue());
        }
        boolean accessCheckEnabled = this.conf.getBoolean(QueryServices.PHOENIX_ACLS_ENABLED,
                QueryServicesOptions.DEFAULT_PHOENIX_ACLS_ENABLED);
        if (this.conf.get(PHOENIX_META_DATA_COPROCESSOR_CONF_KEY) == null && accessCheckEnabled) {
            this.conf.set(PHOENIX_META_DATA_COPROCESSOR_CONF_KEY, DEFAULT_PHOENIX_META_DATA_COPROCESSOR_CONF_KEY);
        }
       loadSystemCoprocessors(conf, PHOENIX_META_DATA_COPROCESSOR_CONF_KEY);
    }

    private ObserverGetter<PhoenixCoprocessor, MetaDataEndpointObserver> phoenixObserverGetter =
            PhoenixCoprocessor::getPhoenixObserver;

    private abstract class PhoenixObserverOperation extends ObserverOperationWithoutResult<MetaDataEndpointObserver> {
        public PhoenixObserverOperation() {
            super(phoenixObserverGetter);
        }

        public PhoenixObserverOperation(User user) {
            super(phoenixObserverGetter, user);
        }

        public PhoenixObserverOperation(User user, boolean bypassable) {
            super(phoenixObserverGetter, user, bypassable);
        }

        void callObserver() throws IOException {
            Optional<MetaDataEndpointObserver> observer = phoenixObserverGetter.apply(getEnvironment().getInstance());
            if (observer.isPresent()) {
                call(observer.get());
            }
        }

        @Override
        protected void postEnvCall() {}
    }

    private boolean execOperation(
            final PhoenixObserverOperation ctx)
            throws IOException {
        if (ctx == null) return false;
        boolean bypass = false;
        for (PhoenixMetaDataControllerEnvironment env : coprocEnvironments) {
            if (env.getInstance() instanceof MetaDataEndpointObserver) {
                ctx.prepare(env);
                Thread currentThread = Thread.currentThread();
                ClassLoader cl = currentThread.getContextClassLoader();
                try {
                    currentThread.setContextClassLoader(env.getClassLoader());
                    ctx.callObserver();
                } catch (Throwable e) {
                    handleCoprocessorThrowable(env, e);
                } finally {
                    currentThread.setContextClassLoader(cl);
                }
                bypass |= ctx.shouldBypass();
                if (bypass) {
                    break;
                }
            }
            ctx.postEnvCall();
        }
        return bypass;
    }

    @Override
    protected void handleCoprocessorThrowable(final PhoenixMetaDataControllerEnvironment env, final Throwable e)
            throws IOException {
        if (e instanceof IOException) {
            if (e.getCause() instanceof DoNotRetryIOException) { throw (IOException)e.getCause(); }
        }
        super.handleCoprocessorThrowable(env, e);
    }

    /**
     * Encapsulation of the environment of each coprocessor
     */
    static class PhoenixMetaDataControllerEnvironment extends BaseEnvironment<PhoenixCoprocessor>
            implements CoprocessorEnvironment<PhoenixCoprocessor> {

        private RegionCoprocessorEnvironment env;

        public PhoenixMetaDataControllerEnvironment(RegionCoprocessorEnvironment env, PhoenixCoprocessor instance,
                int priority, int sequence, Configuration conf) {
            super(instance, priority, sequence, conf);
            this.env = env;
        }

        public RegionCoprocessorHost getCoprocessorHost() {
            return ((HRegion)env.getRegion()).getCoprocessorHost();
        }
    }

    public void preGetTable(final String tenantId, final String tableName, final TableName physicalTableName)
            throws IOException {
        execOperation(new PhoenixObserverOperation() {
            @Override
            public void call(MetaDataEndpointObserver observer) throws IOException {
                observer.preGetTable(this, tenantId, tableName, physicalTableName);
            }
        });
    }

    public void preCreateTable(final String tenantId, final String tableName, final TableName physicalTableName,
            final TableName parentPhysicalTableName, final PTableType tableType, final Set<byte[]> familySet, final Set<TableName> indexes)
            throws IOException {
        execOperation(new PhoenixObserverOperation() {
            @Override
            public void call(MetaDataEndpointObserver observer) throws IOException {
                observer.preCreateTable(this, tenantId, tableName, physicalTableName, parentPhysicalTableName, tableType,
                        familySet, indexes);
            }
        });
    }

    public void preDropTable(final String tenantId, final String tableName, final TableName physicalTableName,
            final TableName parentPhysicalTableName, final PTableType tableType, final List<PTable> indexes) throws IOException {
        execOperation(new PhoenixObserverOperation() {
            @Override
            public void call(MetaDataEndpointObserver observer) throws IOException {
                observer.preDropTable(this, tenantId, tableName, physicalTableName, parentPhysicalTableName, tableType, indexes);
            }
        });
    }

    public void preAlterTable(final String tenantId, final String tableName, final TableName physicalTableName,
            final TableName parentPhysicalTableName, final PTableType type) throws IOException {
        execOperation(new PhoenixObserverOperation() {
            @Override
            public void call(MetaDataEndpointObserver observer) throws IOException {
                observer.preAlterTable(this, tenantId, tableName, physicalTableName, parentPhysicalTableName, type);
            }
        });
    }

    public void preGetSchema(final String schemaName) throws IOException {
        execOperation(new PhoenixObserverOperation() {
            @Override
            public void call(MetaDataEndpointObserver observer) throws IOException {
                observer.preGetSchema(this, schemaName);
            }
        });
    }

    public void preCreateSchema(final String schemaName) throws IOException {

        execOperation(new PhoenixObserverOperation() {
            @Override
            public void call(MetaDataEndpointObserver observer) throws IOException {
                observer.preCreateSchema(this, schemaName);
            }
        });
    }

    public void preDropSchema(final String schemaName) throws IOException {
        execOperation(new PhoenixObserverOperation() {
            @Override
            public void call(MetaDataEndpointObserver observer) throws IOException {
                observer.preDropSchema(this, schemaName);
            }
        });
    }

    public void preIndexUpdate(final String tenantId, final String indexName, final TableName physicalTableName,
            final TableName parentPhysicalTableName, final PIndexState newState) throws IOException {
        execOperation(new PhoenixObserverOperation() {
            @Override
            public void call(MetaDataEndpointObserver observer) throws IOException {
                observer.preIndexUpdate(this, tenantId, indexName, physicalTableName, parentPhysicalTableName, newState);
            }
        });
    }

    @Override
    public PhoenixCoprocessor checkAndGetInstance(Class<?> implClass)
            throws InstantiationException, IllegalAccessException {
        if (PhoenixCoprocessor.class
                .isAssignableFrom(implClass)) { return (PhoenixCoprocessor)implClass.newInstance(); }
        return null;
    }

    @Override
    public PhoenixMetaDataControllerEnvironment createEnvironment(PhoenixCoprocessor instance, int priority,
            int sequence, Configuration conf) {
        return new PhoenixMetaDataControllerEnvironment(env, instance, priority, sequence, conf);
    }
}

redpajama_set_name: RedPajamaGithub


text:
namespace FunctionalTests.Services.Ordering;

public class OrderingScenarios : OrderingScenariosBase
{
    [Fact]
    public async Task Cancel_basket_and_check_order_status_cancelled()
    {
        using var orderServer = new OrderingScenariosBase().CreateServer();
        using var basketServer = new BasketScenariosBase().CreateServer();
        // Expected data
        var cityExpected = $"city-{Guid.NewGuid()}";
        var orderStatusExpected = "cancelled";

        var basketClient = basketServer.CreateIdempotentClient();
        var orderClient = orderServer.CreateIdempotentClient();

        // GIVEN a basket is created
        var contentBasket = new StringContent(BuildBasket(), UTF8Encoding.UTF8, "application/json");
        await basketClient.PostAsync(BasketScenariosBase.Post.CreateBasket, contentBasket);

        // AND basket checkout is sent
        await basketClient.PostAsync(BasketScenariosBase.Post.CheckoutOrder, new StringContent(BuildCheckout(cityExpected), UTF8Encoding.UTF8, "application/json"));

        // WHEN Order is created in Ordering.api
        var newOrder = await TryGetNewOrderCreated(cityExpected, orderClient);

        // AND Order is cancelled in Ordering.api
        await orderClient.PutAsync(OrderingScenariosBase.Put.CancelOrder, new StringContent(BuildCancelOrder(newOrder.OrderNumber), UTF8Encoding.UTF8, "application/json"));

        // AND the requested order is retrieved
        var order = await TryGetOrder(newOrder.OrderNumber, orderClient);

        // THEN check status
        Assert.Equal(orderStatusExpected, order.Status);
    }

    async Task<Order> TryGetOrder(string orderNumber, HttpClient orderClient)
    {
        var ordersGetResponse = await orderClient.GetStringAsync(OrderingScenariosBase.Get.Orders);
        var orders = JsonSerializer.Deserialize<List<Order>>(ordersGetResponse, new JsonSerializerOptions
        {
            PropertyNameCaseInsensitive = true
        });

        return orders.Single(o => o.OrderNumber == orderNumber);
    }

    private async Task<Order> TryGetNewOrderCreated(string city, HttpClient orderClient)
    {
        var counter = 0;
        Order order = null;

        while (counter < 20)
        {
            //get the orders and verify that the new order has been created
            var ordersGetResponse = await orderClient.GetStringAsync(OrderingScenariosBase.Get.Orders);
            var orders = JsonSerializer.Deserialize<List<Order>>(ordersGetResponse, new JsonSerializerOptions
            {
                PropertyNameCaseInsensitive = true
            });

            if (orders == null || orders.Count == 0)
            {
                counter++;
                await Task.Delay(100);
                continue;
            }

            var lastOrder = orders.OrderByDescending(o => o.Date).First();
            int.TryParse(lastOrder.OrderNumber, out int id);
            var orderDetails = await orderClient.GetStringAsync(OrderingScenariosBase.Get.OrderBy(id));
            order = JsonSerializer.Deserialize<Order>(orderDetails, new JsonSerializerOptions
            {
                PropertyNameCaseInsensitive = true
            });

            order.City = city;

            if (IsOrderCreated(order, city))
            {
                break;
            }
        }

        return order;
    }

    private bool IsOrderCreated(Order order, string city)
    {
        return order.City == city;
    }

    string BuildBasket()
    {
        var order = new CustomerBasket("9e3163b9-1ae6-4652-9dc6-7898ab7b7a00");
        order.Items = new List<Microsoft.eShopOnContainers.Services.Basket.API.Model.BasketItem>()
        {
            new Microsoft.eShopOnContainers.Services.Basket.API.Model.BasketItem()
            {
                Id = "1",
                ProductName = "ProductName",
                ProductId = 1,
                UnitPrice = 10,
                Quantity = 1
            }
        };
        return JsonSerializer.Serialize(order);
    }

    string BuildCancelOrder(string orderId)
    {
        var order = new OrderDTO()
        {
            OrderNumber = orderId
        };
        return JsonSerializer.Serialize(order);
    }

    string BuildCheckout(string cityExpected)
    {
        var checkoutBasket = new BasketDTO()
        {
            City = cityExpected,
            Street = "street",
            State = "state",
            Country = "coutry",
            ZipCode = "zipcode",
            CardNumber = "1111111111111",
            CardHolderName = "CardHolderName",
            CardExpiration = DateTime.Now.AddYears(1),
            CardSecurityNumber = "123",
            CardTypeId = 1,
            Buyer = "Buyer",
            RequestId = Guid.NewGuid()
        };

        return JsonSerializer.Serialize(checkoutBasket);
    }
}


text:
var Firebase = require('firebase');
var AppConstants = require('../constants/AppConstants');

var FBInstance = null;

var firebaseUtils = {
  homeInstance: function(){
    if (FBInstance !== null) {
      return FBInstance;
    } else {
      FBInstance = new Firebase(AppConstants.FIREBASE_HOST);
      return FBInstance;
    }
  },

  addNote: function(noteObj){
    this.homeInstance().child(noteObj.user).push(noteObj.note);
  },

  removeNote: function(noteObj) {
    this.homeInstance().child(noteObj.user).child(noteObj.key).remove();
  },

  toArray: function(obj){
    var arr = [];
    for(var key in obj){
      arr.push(
        {
          note: obj[key],
          key: key
        }
      );
    }
    return arr;
  }
};

module.exports = firebaseUtils;


text:
import {Injectable} from '@angular/core';
import {Observable} from "rxjs/Observable";
import {HttpClient} from "@angular/common/http";

@Injectable()
export class EventScheduleService {

  private baseUrl = '/api/admin/event';

  constructor(private http: HttpClient) {
  }

  public createOne(groupId, item: Schedule): Observable<Schedule> {
    const url = this.baseUrl + `/${groupId}` + '/schedule';
    return this.http.post<Schedule>(url, item);
  }

}

export interface Schedule {
  groupId: number;
  dateFrom: Date;
  dateTo: Date;
  eventName: string;
  event?: Event[];
}


text:
import { AppRegistry } from 'react-native';
import App from 'bakareader/src/App';

AppRegistry.registerComponent('bakareader', () => App);


text:
//
//  UserAuthentication.cs
//  Venture
//
//  Created by Batuhan Erden.
//  Copyright © 2016 Batuhan Erden. All rights reserved.
//

using UnityEngine;
using System.Collections;

public class UserAuthentication : MonoBehaviour {

	private const string URL_REGISTER_USER = "http://138.68.143.170/VailaBall_DATA/Computer_DATA/r88732gb23g7g3b3u2g1873rb13ubdn131mc218nec811.php";
	private string username = "";
	private string password = "";
	private string message = "";
	public GameObject mainMenu;

	private void OnGUI() {
		if (DatabaseLoader.databaseLoaded && GameMaster.loggedUser == null) {
			GUI.Label(new Rect(Screen.width / 2 - 90, Screen.height - 150, 80, 20), "Username:");
			GUI.Label(new Rect(Screen.width / 2 - 90, Screen.height - 120, 80, 20), "Password:");

			username = GUI.TextField(new Rect(Screen.width / 2 - 10, Screen.height - 150, 100, 20), username, 12);
			password = GUI.TextField(new Rect(Screen.width / 2 - 10, Screen.height - 120, 100, 20), password, 12);

			if (GUI.Button(new Rect(Screen.width / 2 - 85, Screen.height - 90, 80, 25), "Login"))
				tryLogin();
			else if (GUI.Button(new Rect(Screen.width / 2 + 5, Screen.height - 90, 80, 25), "Register") && canRegister())
				StartCoroutine(register());

			GUI.TextArea(new Rect(30, Screen.height - 45, Screen.width - 60, 25), message);
		} else if (DatabaseLoader.databaseLoaded && GameMaster.loggedUser != null) {
			mainMenu.SetActive(true);
		}
	}

	private void tryLogin() {
		if (isEntryEmpty())
			return;

		foreach (User user in GameMaster.users) {
			if (user.getUsername().ToLower() == username.ToLower()) {
				if (user.getPassword() == password) {
					login(user);
					return;
				}
			}
		}

		message = GameMaster.CONSOLE_INITIAL + "Your entries are not correct. Please check them again. ";
		resetEntries();
	}

	private void login(User user) {
		message = GameMaster.CONSOLE_INITIAL + "Login success!";
		resetEntries();
		GameMaster.loggedUser = user;
	}

	private bool canRegister() {
		if (isEntryEmpty())
			return false;

		foreach (User user in GameMaster.users) {
			if (user.getUsername().ToLower() == username.ToLower()) {
				message = GameMaster.CONSOLE_INITIAL + "Username already exists. Please choose another one.";
				resetEntries();
				return false;
			}
		}

		return true;
	}

	private IEnumerator register() {
		WWWForm form = new WWWForm();
		form.AddField("form_username", username);
		form.AddField("form_password", password);

		WWW www = new WWW(URL_REGISTER_USER, form);
		message = GameMaster.CONSOLE_INITIAL + "Registering....";
		yield return www; // Wait for the data to be uploaded.

		message = GameMaster.CONSOLE_INITIAL + "Register success!";
		resetEntries();

		StartCoroutine(DatabaseLoader.loadDatabase()); // Load the database again.
	}

	private bool isEntryEmpty() {
		if (username.Length == 0 || password.Length == 0) {
			message = GameMaster.CONSOLE_INITIAL + "Username or Password cannot be empty.";
			resetEntries();
			return true;
		}

		return false;
	}

	private void resetEntries() {
		username = "";
		password = "";
	}
}


text:
package org.telegram.api.functions.phone;

import org.telegram.api.input.phonecall.TLInputPhoneCall;
import org.telegram.api.phone.call.discardreason.TLAbsPhoneCallDiscardReason;
import org.telegram.api.updates.TLAbsUpdates;
import org.telegram.tl.*;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/**
 * @author Ruben Bermudez
 * @version 1.0
 */
public class TLRequestPhoneDiscardCall extends TLMethod<TLAbsUpdates> {
    public static final int CLASS_ID = 0x78d413a6;

    private TLInputPhoneCall peer;
    private int duration;
    private TLAbsPhoneCallDiscardReason reason;
    private long connectionId;

    public TLRequestPhoneDiscardCall() {
        super();
    }

    @Override
    public TLAbsUpdates deserializeResponse(InputStream stream, TLContext context) throws IOException {
        TLObject res = StreamingUtils.readTLObject(stream, context);
        if (res == null) {
            throw new IOException("Unable to parse response");
        }
        if (res instanceof TLAbsUpdates) {
            return (TLAbsUpdates) res;
        }
        throw new IOException("Incorrect response type. Expected " + TLAbsUpdates.class.getCanonicalName() +
                ", got: " + res.getClass().getCanonicalName());
    }

    public TLInputPhoneCall getPeer() {
        return peer;
    }

    public void setPeer(TLInputPhoneCall peer) {
        this.peer = peer;
    }

    public int getDuration() {
        return duration;
    }

    public void setDuration(int duration) {
        this.duration = duration;
    }

    public TLAbsPhoneCallDiscardReason getReason() {
        return reason;
    }

    public void setReason(TLAbsPhoneCallDiscardReason reason) {
        this.reason = reason;
    }

    public long getConnectionId() {
        return connectionId;
    }

    public void setConnectionId(long connectionId) {
        this.connectionId = connectionId;
    }

    @Override
    public int getClassId() {
        return CLASS_ID;
    }

    @Override
    public void serializeBody(OutputStream stream) throws IOException {
        StreamingUtils.writeTLObject(peer, stream);
        StreamingUtils.writeInt(duration, stream);
        StreamingUtils.writeTLObject(reason, stream);
        StreamingUtils.writeLong(connectionId, stream);
    }

    @Override
    public void deserializeBody(InputStream stream, TLContext context) throws IOException {
        peer = StreamingUtils.readTLObject(stream, context, TLInputPhoneCall.class);
        duration = StreamingUtils.readInt(stream);
        reason = StreamingUtils.readTLObject(stream, context, TLAbsPhoneCallDiscardReason.class);
        connectionId = StreamingUtils.readLong(stream);
    }

    @Override
    public String toString() {
        return "phone.discardCall#78d413a6";
    }
}


text:
using UnityEditor;
using UnityEngine;
using System.Collections.Generic;
using UnityEditor.IMGUI.Controls;

namespace AssetBundleBrowser
{
    internal class BundleDetailItem : TreeViewItem
    {
        internal BundleDetailItem(int id, int depth, string displayName, MessageType type) : base(id, depth, displayName)
        {
            MessageLevel = type;
        }

        internal MessageType MessageLevel
        { get; set; }
    }
    internal class BundleDetailList : TreeView
    {
        HashSet<AssetBundleModel.BundleDataInfo> m_Selecteditems;
        Rect m_TotalRect;

        const float k_DoubleIndent = 32f;
        const string k_SizeHeader = "Size: ";
        const string k_DependencyHeader = "Dependent On:";
        const string k_DependencyEmpty = k_DependencyHeader + " - None";
        const string k_MessageHeader = "Messages:";
        const string k_MessageEmpty = k_MessageHeader + " - None";

        internal BundleDetailList(TreeViewState state) : base(state)
        {
            m_Selecteditems = new HashSet<AssetBundleModel.BundleDataInfo>();
            showBorder = true;
        }
        internal void Update()
        {
            bool dirty = false;
            foreach (var bundle in m_Selecteditems)
            {
                dirty |= bundle.dirty;
            }
            if (dirty)
            {
                Reload();
                ExpandAll();
            }
        }
        protected override TreeViewItem BuildRoot()
        {
            var root = new TreeViewItem(-1, -1);
            root.children = new List<TreeViewItem>();
            if (m_Selecteditems != null)
            {
                foreach(var bundle in m_Selecteditems)
                {
                    root.AddChild(AppendBundleToTree(bundle));
                }
            }
            return root;
        }

        protected override void RowGUI(RowGUIArgs args)
        {
            if ((args.item as BundleDetailItem) != null)
            {
                EditorGUI.HelpBox(
                    new Rect(args.rowRect.x + k_DoubleIndent, args.rowRect.y, args.rowRect.width - k_DoubleIndent, args.rowRect.height),
                    args.item.displayName,
                    (args.item as BundleDetailItem).MessageLevel);
            }
            else
            {
                Color old = GUI.color;
                if (args.item.depth == 1 &&
                    (args.item.displayName == k_MessageEmpty || args.item.displayName == k_DependencyEmpty))
                    GUI.color = AssetBundleModel.Model.k_LightGrey;
                base.RowGUI(args);
                GUI.color = old;
            }
        }
        public override void OnGUI(Rect rect)
        {
            m_TotalRect = rect;
            base.OnGUI(rect);
        }
        protected override float GetCustomRowHeight(int row, TreeViewItem item)
        {
            if( (item as BundleDetailItem) != null)
            {
                float height = DefaultStyles.backgroundEven.CalcHeight(new GUIContent(item.displayName), m_TotalRect.width);
                return height + 3f;
            }
            return base.GetCustomRowHeight(row, item);
        }

        internal static TreeViewItem AppendBundleToTree(AssetBundleModel.BundleDataInfo bundle)
        {
            var itemName = bundle.m_Name.fullNativeName;
            var bunRoot = new TreeViewItem(itemName.GetHashCode(), 0, itemName);

            var str = itemName + k_SizeHeader;
            var sz = new TreeViewItem(str.GetHashCode(), 1, k_SizeHeader + bundle.TotalSize());

            str = itemName + k_DependencyHeader;
            var dependency = new TreeViewItem(str.GetHashCode(), 1, k_DependencyEmpty);
            var depList = bundle.GetBundleDependencies();
            if(depList.Count > 0)
            {
                dependency.displayName = k_DependencyHeader;
                foreach (var dep in bundle.GetBundleDependencies())
                {
                    str = itemName + dep;
                    dependency.AddChild(new TreeViewItem(str.GetHashCode(), 2, dep));
                }
            }

            str = itemName + k_MessageHeader;
            var msg = new TreeViewItem(str.GetHashCode(), 1, k_MessageEmpty);
            if (bundle.HasMessages())
            {
                msg.displayName = k_MessageHeader;
                var currMessages = bundle.GetMessages();

                foreach(var currMsg in currMessages)
                {
                    str = itemName + currMsg.message;
                    msg.AddChild(new BundleDetailItem(str.GetHashCode(), 2, currMsg.message, currMsg.severity));
                }
            }

            bunRoot.AddChild(sz);
            bunRoot.AddChild(dependency);
            bunRoot.AddChild(msg);

            return bunRoot;
        }

        internal void SetItems(IEnumerable<AssetBundleModel.BundleInfo> items)
        {
            m_Selecteditems.Clear();
            foreach(var item in items)
            {
                CollectBundles(item);
            }
            SetSelection(new List<int>());
            Reload();
            ExpandAll();
        }
        internal void CollectBundles(AssetBundleModel.BundleInfo bundle)
        {
            var bunData = bundle as AssetBundleModel.BundleDataInfo;
            if (bunData != null)
                m_Selecteditems.Add(bunData);
            else
            {
                var bunFolder = bundle as AssetBundleModel.BundleFolderInfo;
                foreach (var bun in bunFolder.GetChildList())
                {
                    CollectBundles(bun);
                }
            }
        }

    }
}


text:
'''
A simple script for testing the syntax of the files.
It uses just the messages of the reading and parsing exceptions in the yaml library.
Run the script multiple times until you solve all the syntax errors in the file.

Usage: check_yaml.py <yaml_file_to_check>
'''

import yaml
import sys

if len(sys.argv) != 2:
    print 'Usage: %s <yaml_file_to_check>' % (sys.argv[0])
    exit(1)

try:
    f = open(sys.argv[1])
except IOError as e:
    print "I/O error(%s): %s" % (e.errno, e.strerror)
    exit(1)

try:
    yaml.safe_load(f)
    print 'YAML syntax is OK'
    exit(0)
except yaml.reader.ReaderError as e:
    print "YAML reader error: %s" % (e)
    exit(1)
except yaml.parser.ParserError as e:
    print "YAML parser error: %s" % (e)
    exit(1)


text:
package org.opendatakit.briefcase.model;

public class RemoteFormDefinition implements IFormDefinition {

  final String formName;
  final String formId;
  final String versionString;
  final String downloadUrl;
  final String manifestUrl;

  public RemoteFormDefinition(String formName, String formId,
      String versionString, String downloadUrl, String manifestUrl) {
    this.formName = formName;
    this.formId = formId;
    this.versionString = versionString;
    this.downloadUrl = downloadUrl;
    this.manifestUrl = manifestUrl;
  }

  @Override
  public LocationType getFormLocation() {
    return LocationType.REMOTE;
  }

  @Override
  public String getFormName() {
    return formName;
  }

  @Override
  public String getFormId() {
    return formId;
  }

  public String getDownloadUrl() {
    return downloadUrl;
  }

  public String getManifestUrl() {
    return manifestUrl;
  }

  public String getVersionString() {
    return versionString;
  }
}


text:
categories:
- tumblr
- archive
- video
date: 2007-10-16T00:58:51Z
title: Video 20071016
url: /2007/10/16/video-20071016/
---

<iframe width="500" height="375"  id="youtube_iframe" src="https://www.youtube.com/embed/7WqOMPakGCg?feature=oembed&enablejsapi=1&origin=https://safe.txmblr.com&wmode=opaque" frameborder="0" allowfullscreen></iframe>

Suicide - Ghost Rider


text: export { PauseFilled24 as default } from "../../";


text:
#include <Python.h>

#define BUFFER_MODULE
#include "buffer.h"

// ------------------------ DECLARATIONS --------------------------------- //
//
// ---- GLOBALS
static PyObject *amfast_mod;
static PyObject *amfast_Error;
static PyObject *amfast_BufferError;

static PyObject* Buffer_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
    BufferObj *self;

    self = (BufferObj *)type->tp_alloc(type, 0);
    if (self != NULL) {
        self->src_str = NULL;
        self->buf = NULL;
        self->len = 0;
        self->pos = 0;
    }

    return (PyObject *)self;
}

static int Buffer_init(BufferObj *self, PyObject *args, PyObject *kwargs)
{
    static char *kwlist[] = {"source", NULL};
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O", kwlist, &self->src_str))
        return -1;

    if (self->src_str != NULL) {
        Py_INCREF(self->src_str);
        self->buf = PyString_AsString(self->src_str);
        self->len = PyString_GET_SIZE(self->src_str);
    } else {
        self->len = 256;
        self->buf = (char*)malloc(sizeof(char*) * (size_t)self->len);
    }

    return 0;
}

static void Buffer_dealloc(BufferObj *self)
{
    Py_XDECREF(self->src_str);
    if (!self->src_str)
        free(self->buf);
    self->ob_type->tp_free((PyObject*)self);
}

/*
 * Returns the current position in the buffer.
 */
static int Buffer_tell(BufferObj *self)
{
    return self->pos;
}

/*
 * Python exposed version of Buffer_tell.
 */
static PyObject* PyBuffer_tell(BufferObj *self)
{
    return PyInt_FromLong((long)Buffer_tell(self));
}

/*
 * Moves to a specific position in the buffer.
 *
 * Returns position or -1 on error.
 */
static int Buffer_seek(BufferObj *self, int pos)
{
    if (pos < 0) {
        PyErr_SetString(amfast_BufferError, "Attempted to seek before start of buffer.");
        return -1;
    }

    if (pos > self->len) {
        PyErr_SetString(amfast_BufferError, "Attempted to seek past end of buffer.");
        return -1;
    }

    self->pos = pos;
    return pos;
}

/*
 * Python exposed version of Buffer_seek.
 */
static PyObject* PyBuffer_seek(BufferObj *self, PyObject *args, PyObject *kwargs)
{
    int pos;

    if (!PyArg_ParseTuple(args, "i", &pos))
        return NULL;

    int new_pos = Buffer_seek(self, pos);
    if (new_pos == -1)
        return NULL;

    return PyInt_FromLong((long)new_pos);
}

/*
 * Returns a pointer to the current buffer position
 * and increments the position by the given length.
 */
static char* Buffer_read(BufferObj *self, int len)
{
    int new_pos = self->pos + len;
    if (new_pos < 0) {
        PyErr_SetString(amfast_BufferError, "Attempted to read before start of buffer.");
        return NULL;
    }

    if (new_pos > self->len) {
        PyErr_SetString(amfast_BufferError, "Attempted to read past end of buffer.");
        return NULL;
    }

    char* result = (char*)(self->buf + self->pos);
    self->pos = new_pos;
    return result;
}

/*
 * Returns a PyString.
 */
static PyObject* Buffer_readPyString(BufferObj *self, int len)
{
    char *str = Buffer_read(self, len);
    if (!str)
       return NULL;

    return PyString_FromStringAndSize(str, (Py_ssize_t)len);
}

/*
 * Python exposed version of Buffer_readPyString.
 */
static PyObject* PyBuffer_readPyString(BufferObj *self, PyObject *args, PyObject *kwargs)
{
    int len;

    if (!PyArg_ParseTuple(args, "i", &len))
        return NULL;

    if (!self->src_str) {
        PyErr_SetString(amfast_BufferError, "Cannot read from write-only buffer.");
        return NULL;
    }

    return Buffer_readPyString(self, len);
}

/*
 * Expand the length of the buffer.
 *
 * len == number of bytes to expand by.
 *
 * Returns size of new buffer, or -1 if failed.
 *
 */
static int Buffer_grow(BufferObj *self, int len)
{
    int new_len = self->pos + len;
    int current_len = self->len;

    while (new_len > current_len) {
        // Buffer is not large enough.
        // Double its memory, so that we don't need to realloc everytime.
        current_len *= 2;
    }

    if (current_len != self->len) {
        self->buf = (char*)realloc(self->buf, sizeof(char*) * (size_t)current_len);
        if (!self->buf) {
            PyErr_SetNone(PyExc_MemoryError);
            return -1;
        }
        self->len = current_len;
    }

    return current_len;
}

/*
 * Write a C string.
 *
 * Returns 1 on success, 0 on failure.
 */
static int Buffer_write(BufferObj *self, char *str, int len)
{
    if (Buffer_grow(self, len) == -1)
        return 0;

    memcpy(self->buf + self->pos, str, (size_t)len);
    self->pos += len;
    return 1;
}

/*
 * Writes a Python string.
 */
static int Buffer_writePyString(BufferObj *self, PyObject* py_str)
{
    char *c_str = PyString_AS_STRING(py_str);
    int len = PyString_GET_SIZE(py_str);

    return Buffer_write(self, c_str, len);
}

/*
 * Python exposed version of Buffer_writePyString.
 */
static PyObject* PyBuffer_writePyString(BufferObj *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_str;

    if (!PyArg_ParseTuple(args, "O", &py_str))
        return NULL;

    if (self->src_str != NULL) {
        PyErr_SetString(amfast_BufferError, "Cannot write to read-only buffer.");
        return NULL;
    }

    if (PyString_Check(py_str) == 0) {
        PyErr_SetString(amfast_BufferError, "Argument must be a string.");
        return NULL;
    }

    int result = Buffer_writePyString(self, py_str);
    if (result == 0)
        return NULL;

    Py_RETURN_NONE;
}

/*
 * Gets Python string for entire buffer.
 */
static PyObject* PyBuffer_getPyString(BufferObj *self, PyObject *args, PyObject *kwargs)
{
    if (!self->src_str) {
        return PyString_FromStringAndSize(self->buf, (Py_ssize_t)self->pos);
    } else {
        Py_XINCREF(self->src_str);
        return self->src_str;
    }
}

static PyMethodDef Buffer_methods[] = {
    {"read", (PyCFunction)PyBuffer_readPyString, METH_VARARGS | METH_KEYWORDS,
     "Read from buffer. Returns a string.\n\n"
     "arguments\n"
     "==========\n"
     " * len - int, length to read from buffer."},
    {"getvalue", (PyCFunction)PyBuffer_getPyString, METH_VARARGS | METH_KEYWORDS,
     "Gets a string value.\n"},
    {"tell", (PyCFunction)PyBuffer_tell, METH_NOARGS,
     "Returns the current position in the buffer.\n\n"},
    {"seek", (PyCFunction)PyBuffer_seek, METH_VARARGS  | METH_KEYWORDS,
     "Moves to a specified position in the buffer.\n\n"
     "arguments\n"
     "==========\n"
     " * pos - int, position to move to in the buffer."},
    {"write", (PyCFunction)PyBuffer_writePyString, METH_VARARGS | METH_KEYWORDS,
     "Writes a string to the buffer.\n\n"
     "arguments\n"
     "==========\n"
     " * str - str, string to write to the buffer."},
    {NULL}  /* Sentinel */
};

static PyTypeObject BufferType = {
    PyObject_HEAD_INIT(NULL)
    0,                         /*ob_size*/
    "amfast.buffer.Buffer",    /*tp_name*/
    sizeof(BufferObj),         /*tp_basicsize*/
    0,                         /*tp_itemsize*/
    (destructor)Buffer_dealloc,                         /*tp_dealloc*/
    0,                         /*tp_print*/
    0,                         /*tp_getattr*/
    0,                         /*tp_setattr*/
    0,                         /*tp_compare*/
    0,                         /*tp_repr*/
    0,                         /*tp_as_number*/
    0,                         /*tp_as_sequence*/
    0,                         /*tp_as_mapping*/
    0,                         /*tp_hash */
    0,                         /*tp_call*/
    0,                         /*tp_str*/
    0,                         /*tp_getattro*/
    0,                         /*tp_setattro*/
    0,                         /*tp_as_buffer*/
    Py_TPFLAGS_DEFAULT,        /*tp_flags*/
    "A buffer used to encode and decode AMF strings.",           /* tp_doc */
    0,		               /* tp_traverse */
    0,		               /* tp_clear */
    0,		               /* tp_richcompare */
    0,		               /* tp_weaklistoffset */
    0,		               /* tp_iter */
    0,		               /* tp_iternext */
    Buffer_methods,            /* tp_methods */
    0,                         /* tp_members */
    0,                         /* tp_getset */
    0,                         /* tp_base */
    0,                         /* tp_dict */
    0,                         /* tp_descr_get */
    0,                         /* tp_descr_set */
    0,                         /* tp_dictoffset */
    (initproc)Buffer_init,      /* tp_init */
    0,                         /* tp_alloc */
    Buffer_new,                 /* tp_new */
};

static PyMethodDef buffer_methods[] = {
    {NULL}  /* Sentinel */
};

#ifndef PyMODINIT_FUNC
#define PyMODINIT_FUNC void
#endif
PyMODINIT_FUNC
initbuffer(void)
{
    PyObject *m = Py_InitModule3("buffer", buffer_methods,
        "Tools for encoding and decoding AMF strings.");

    // Import modules
    if (!amfast_mod) {
        amfast_mod = PyImport_ImportModule("amfast");
        if(!amfast_mod)
            return;
    }

    // Setup exceptions
    amfast_Error = PyObject_GetAttrString(amfast_mod, "AmFastError");
    if (!amfast_Error)
        return;

    amfast_BufferError = PyErr_NewException("amfast.encoder.BufferError", amfast_Error, NULL);
    if (!amfast_BufferError)
        return;

    if (PyModule_AddObject(m, "BufferError", amfast_BufferError) == -1)
        return;

    // Setup types
    BufferType.tp_new = Buffer_new;
    if (PyType_Ready(&BufferType) < 0)
        return;

    Py_INCREF(&BufferType);
    PyModule_AddObject(m, "Buffer", (PyObject *)&BufferType);

    // Export Buffer C API
    static void *PyBuffer_API[PyBuffer_API_pointers];

    PyBuffer_API[Buffer_read_NUM] = (void*)Buffer_read;
    PyBuffer_API[Buffer_readPyString_NUM] = (void*)Buffer_readPyString;
    PyBuffer_API[Buffer_tell_NUM] = (void*)Buffer_tell;
    PyBuffer_API[Buffer_seek_NUM] = (void*)Buffer_seek;
    PyBuffer_API[Buffer_write_NUM] = (void*)Buffer_write;
    PyBuffer_API[Buffer_writePyString_NUM] = (void*)Buffer_writePyString;

    PyObject *c_api = PyCObject_FromVoidPtr((void*)PyBuffer_API, NULL);
    if (c_api != NULL)
        PyModule_AddObject(m, "_C_API", c_api);
}


text:
import logging
import unittest
import librato
from mock_connection import MockConnect, server

#logging.basicConfig(level=logging.DEBUG)
# Mock the server
librato.HTTPSConnection = MockConnect

class TestLibratoInstruments(unittest.TestCase):
    def setUp(self):
        self.conn = librato.connect('user_test', 'key_test')
        server.clean()

    def test_list_instruments_when_none(self):
        ins = self.conn.list_instruments()
        assert len(ins) == 0

    def test_adding_a_new_instrument_without_streams(self):
        name = "my_INST"
        ins = self.conn.create_instrument(name)
        assert type(ins) == librato.Instrument
        assert ins.name == name
        assert len(ins.streams) == 0

    def test_adding_a_new_instrument_with_streams(self):
        name = "my_INST_with_STREAMS"
        ins = self.conn.create_instrument(name)
        assert type(ins) == librato.Instrument
        assert ins.name == name
        assert len(ins.streams) == 0
        assert ins.id == 1

        self.conn.submit('a_gauge', 12, description='the desc for a gauge')
        ins.new_stream('a_gauge')
        self.conn.update_instrument(ins)
        #list_ins = self.conn.list_instruments()
        assert ins.name == name
        assert len(ins.streams) == 1
        assert ins.id == 1
        assert ins.streams[0].metric == "a_gauge"

    def test_get_instrument(self):
        name = "my_INST_with_STREAMS"
        ins = self.conn.create_instrument(name)

        self.conn.submit('a_gauge', 12, description='the desc for a gauge')
        ins.new_stream('a_gauge')
        self.conn.update_instrument(ins)

        si = self.conn.get_instrument(ins.id)  # si ; same instrument
        assert type(si) == librato.Instrument
        assert si.name == name
        assert len(si.streams) == 1
        assert si.id == 1
        assert si.streams[0].metric == "a_gauge"

if __name__ == '__main__':
    unittest.main()


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Sydowia 9(1-6): 424 (1955)

#### Original name
Boletus squamatus Berk.

### Remarks
null


text:
CoffeeLint No Explicit Parens
===============================
[![Build Status](https://travis-ci.org/tarruda/coffeelint-no-explicit-parens.png)](https://travis-ci.org/tarruda/coffeelint-no-explicit-parens)

[CoffeeLint](http://www.coffeelint.org/) plugin for prohibiting explicit parens in function calls.

Usage
-----

Install it:

```
$ npm install --save-dev coffeelint-no-explicit-parens
```

Use it:

```json
{
  "no_explicit_parens": {
    "module": "coffeelint-no-explicit-parens",
    "level": "ignore",
    "strict": true
  }
}
```

It is possible to use this rule with `no_implicit_parens` if both are configured
with `strict` set to `false`. This would lead to coffeelint enforcing a mixed
style for parens: Explicit for single line calls and implicit for multi line
calls. For example:

```coffee
# good
myFunction(a, b, c)
# good
myFunction a, ->
  console.log('hello!')
# good
myFunction(a, -> console.log('hello!'))
# bad
myFunction a, b, c
# bad
myFunction(a, ->
  console.log('hello!')
)
# bad
myFunction(a, -> console.log('hello!')
)
```


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

namespace SqlSugar
{
    public class MapperExpressionResolve
    {
        private Expression expression;
        private List<MapperExpression> mappers;
        private InvalidOperationException ex;
        private SqlSugarProvider context;
        private QueryBuilder querybuiler;
        private ISqlBuilder sqlBuilder;
        private string sql;
        public MapperExpressionResolve(Expression expression, InvalidOperationException ex)
        {
            this.expression = expression;
            this.ex = ex;
            this.mappers = CallContext.MapperExpression.Value;
            Error01();
            var isMember = expression is MemberExpression;
            if (isMember)
            {
                ResolveMember();
            }
            else
            {
                ResolveList();
            }
        }

        private void ResolveList()
        {
            var methodExpression = expression as MethodCallExpression;
            var callName = methodExpression.Method.Name;
            var exp= methodExpression.Arguments[0] as MemberExpression;
            ThrowTrue(exp == null);
            var childExpression = exp;
            MapperExpression mapper = GetMapperMany(exp);
            var fillInfo = GetFillInfoMany(childExpression, mapper);
            var mappingFild1Info = GetMappingFild1ManyInfo(childExpression, mapper);
            var mappingFild1Info2 = GetMappingFild2Info(childExpression, mapper);
            //var SelectInfo = GetSelectInfo(expression);
            this.context.InitMappingInfo(childExpression.Expression.Type);
            var entity = this.context.EntityMaintenance.GetEntityInfo(childExpression.Expression.Type);
            oneToMany(methodExpression, callName, entity, childExpression.Expression.ToString(), fillInfo, mappingFild1Info, mappingFild1Info2);
        }

        private void ResolveMember()
        {
            var exp = expression as MemberExpression;
            ThrowTrue(exp.Expression == null);
            var childExpression = exp.Expression;
            MapperExpression mapper = GetMapper(exp);
            var fillInfo=GetFillInfo(childExpression, mapper);
            var mappingFild1Info = GetMappingFild1Info(childExpression, mapper);
            var mappingFild1Info2 = GetMappingFild2Info(childExpression, mapper);
            var SelectInfo = GetSelectInfo(expression);
            var entity = this.context.EntityMaintenance.GetEntityInfo(childExpression.Type);

            var isExMapper = mappingFild1Info2!=null;
            var isFillFild1SameType = fillInfo.Type == mappingFild1Info.Type;
            var isSameProperty = false;

            if (isExMapper)
            {
                ExtMapper(fillInfo, mappingFild1Info, mappingFild1Info2, SelectInfo);
            }
            else if (isSameProperty)
            {

            }
            else if (isFillFild1SameType)
            {
                throw new NotSupportedException(expression.ToString());
            }
            else
            {
                oneToOne(fillInfo, mappingFild1Info, mappingFild1Info2,SelectInfo);
            }
        }

        private void oneToOne(MapperExpressionInfo fillInfo, MapperExpressionInfo mappingFild1Info, MapperExpressionInfo mappingFild1Info2, MapperExpressionInfo selectInfo)
        {
            var pkColumn = selectInfo.EntityInfo.Columns.Where(it => it.IsPrimarykey == true).FirstOrDefault();
            if (pkColumn == null)
            {
                pkColumn = selectInfo.EntityInfo.Columns.First();
            }
            var tableName = sqlBuilder.GetTranslationTableName(fillInfo.EntityInfo.DbTableName);
            var whereLeft = sqlBuilder.GetTranslationColumnName(pkColumn.DbColumnName);
            var whereRight = sqlBuilder.GetTranslationColumnName(mappingFild1Info.FieldString);
            this.sql = this.context.Queryable<object>()
                                                        .AS(tableName)
                                                        .Where(string.Format(" {0}={1} ",whereLeft , whereRight))
                                                        .Select(sqlBuilder.GetTranslationColumnName(selectInfo.FieldName)).ToSql().Key;
        }

        private void oneToMany(MethodCallExpression methodCallExpression,string methodName,EntityInfo mainEntity,string shortName,MapperExpressionInfo fillInfo, MapperExpressionInfo mappingFild1Info, MapperExpressionInfo mappingFild1Info2)
        {
            var pkColumn = mainEntity.Columns.FirstOrDefault(it => it.IsPrimarykey == true);
            if (pkColumn == null)
            {
                pkColumn = mainEntity.Columns.FirstOrDefault();
            }
            var tableName = sqlBuilder.GetTranslationTableName(fillInfo.EntityInfo.DbTableName);
            var whereLeft = sqlBuilder.GetTranslationColumnName(mappingFild1Info.FieldString);
            var whereRight = sqlBuilder.GetTranslationColumnName(shortName + "." + pkColumn.DbColumnName);
            string whereExpression = GetWhereExpression(methodCallExpression);
            if (methodName == "Any")
            {
                this.sql = " (" + this.context.Queryable<object>()
                                                            .AS(tableName)
                                                            .Where(string.Format(" {0}={1} ", whereLeft, whereRight))
                                                            .WhereIF(!string.IsNullOrEmpty(whereExpression), whereExpression)
                                                            .Select("COUNT(1)").ToSql().Key + ")>0 ";
            }
            else
            {
                this.sql = this.context.Queryable<object>()
                                                         .AS(tableName)
                                                         .Where(string.Format(" {0}={1} ", whereLeft, whereRight))
                                                         .WhereIF(!string.IsNullOrEmpty(whereExpression), whereExpression)
                                                         .Select("COUNT(1)").ToSql().Key;
            }
        }

        private string GetWhereExpression(MethodCallExpression methodCallExpression)
        {
            if (methodCallExpression.Arguments.Count <= 1)
                return null;
            var exp= methodCallExpression.Arguments[1];
            var querybuiler=InstanceFactory.GetQueryBuilder(this.context.CurrentConnectionConfig);
            querybuiler.LambdaExpressions = InstanceFactory.GetLambdaExpressions(this.context.CurrentConnectionConfig);
            querybuiler.Builder = InstanceFactory.GetSqlbuilder(this.context.CurrentConnectionConfig);
            querybuiler.Builder.Context = querybuiler.Context;
            querybuiler.Builder.QueryBuilder = querybuiler;
            querybuiler.Context = this.context;
            var expValue=querybuiler.GetExpressionValue(exp, ResolveExpressType.WhereMultiple);
            var paramterName = (exp as LambdaExpression).Parameters[0].Name;
            var sql = expValue.GetResultString();
            sql = sql.Replace(querybuiler.Builder.GetTranslationColumnName(paramterName) + ".", "");
            if (querybuiler.Parameters != null && querybuiler.Parameters.Count > 0)
            {
                foreach (var item in querybuiler.Parameters)
                {
                    sql = sql.Replace(item.ParameterName,item.Value.ObjToString().ToSqlValue());
                }
            }
            return sql;
        }

        private MapperExpressionInfo GetSelectInfo(Expression expression)
        {

            var field = expression;
            if (field is UnaryExpression)
            {
                field = (field as UnaryExpression).Operand;
            }
            var type = ((field as MemberExpression).Expression).Type;
            this.context.InitMappingInfo(type);
            var name = (field as MemberExpression).Member.Name;
            var entity = this.context.EntityMaintenance.GetEntityInfo(type);
            var fieldName = entity.Columns.First(it => it.PropertyName == name).DbColumnName;
            return new MapperExpressionInfo()
            {
                Type = type,
                FieldName = fieldName,
                EntityInfo= entity
            };
        }

        private MapperExpressionInfo GetMappingFild2Info(Expression childExpression, MapperExpression mapper)
        {
            if (mapper.MappingField2Expression == null)
                return null;
            var exp = mapper.MappingField2Expression;
            var field = (exp as LambdaExpression).Body;
            if (field is UnaryExpression)
            {
                field = (field as UnaryExpression).Operand;
            }
            var type = ((field as MemberExpression).Expression).Type;
            this.context.InitMappingInfo(type);
            var name = (field as MemberExpression).Member.Name;
            var entity = this.context.EntityMaintenance.GetEntityInfo(type);
            var fieldName = entity.Columns.First(it => it.PropertyName == name).DbColumnName;
            return new MapperExpressionInfo()
            {
                Type = type,
                FieldName = fieldName
            };
        }

        private MapperExpressionInfo GetMappingFild1Info(Expression childExpression, MapperExpression mapper)
        {
            var exp = mapper.MappingField1Expression;
            var field = (exp as LambdaExpression).Body;
            if (field is UnaryExpression)
            {
                field = (field as UnaryExpression).Operand;
            }
            var type = ((field as MemberExpression).Expression).Type;
            this.context.InitMappingInfo(type);
            var name =(field as MemberExpression).Member.Name;
            var entity = this.context.EntityMaintenance.GetEntityInfo(type);
            var fieldName=entity.Columns.First(it => it.PropertyName == name).DbColumnName;
            var array = (field as MemberExpression).ToString().Split('.').ToList();
            array[array.Count()-1] = fieldName;
            var filedString = string.Join(".", array);
            return new MapperExpressionInfo()
            {
                 Type=type,
                 FieldName = fieldName,
                 FieldString= filedString,
                 EntityInfo= entity
            };
        }

        private MapperExpressionInfo GetFillInfo(Expression childExpression, MapperExpression mapper)
        {
            this.querybuiler = mapper.QueryBuilder;
            this.context = mapper.Context;
            this.sqlBuilder = mapper.SqlBuilder;
            if (this.querybuiler.TableShortName.IsNullOrEmpty())
            {
                this.querybuiler.TableShortName = (childExpression as MemberExpression).Expression.ToString();
            }
            this.context.InitMappingInfo(childExpression.Type);
            return new MapperExpressionInfo() {
                 EntityInfo=this.context.EntityMaintenance.GetEntityInfo(childExpression.Type)
            };
        }

        private MapperExpression GetMapper(MemberExpression exp)
        {
            var mapper= mappers.Where(it => it.Type == MapperExpressionType.oneToOne)
                .Reverse()
                .Where(it => (it.FillExpression as LambdaExpression).Body.ToString() == exp.Expression.ToString()).FirstOrDefault();
            ThrowTrue(mapper == null);
            return mapper;
        }

        public string GetMemberName(MemberExpression memberExpression)
        {
            return "";
        }

        private void  ExtMapper(MapperExpressionInfo fillInfo, MapperExpressionInfo mappingFild1Info, MapperExpressionInfo mappingFild1Info2, MapperExpressionInfo selectInfo)
        {
            var tableName = sqlBuilder.GetTranslationTableName(fillInfo.EntityInfo.DbTableName);
            var whereLeft = sqlBuilder.GetTranslationColumnName(mappingFild1Info2.FieldName);
            var whereRight = sqlBuilder.GetTranslationColumnName(mappingFild1Info.FieldString);
            this.sql = this.context.Queryable<object>()
                                                        .AS(tableName)
                                                        .Where(string.Format(" {0}={1} ", whereLeft, whereRight))
                                                        .Select(sqlBuilder.GetTranslationColumnName(selectInfo.FieldName)).ToSql().Key;
        }

        public MapperSql GetSql()
        {
            return new MapperSql() { Sql = " (" + this.sql + ") " };
        }

        private MapperExpression GetMapperMany(MemberExpression exp)
        {
            var mapper = mappers.Where(it => it.Type == MapperExpressionType.oneToN)
                .Reverse()
                .Where(it => (it.FillExpression as LambdaExpression).Body.ToString() == exp.ToString()).FirstOrDefault();
            ThrowTrue(mapper == null);
            return mapper;
        }
        private MapperExpressionInfo GetFillInfoMany(Expression childExpression, MapperExpression mapper)
        {
            this.querybuiler = mapper.QueryBuilder;
            this.context = mapper.Context;
            this.sqlBuilder = mapper.SqlBuilder;
            if (this.querybuiler.TableShortName.IsNullOrEmpty())
            {
                this.querybuiler.TableShortName = (childExpression as MemberExpression).Expression.ToString();
            }
            var type = (childExpression as MemberExpression).Type.GetGenericArguments()[0];
            this.context.InitMappingInfo(type);
            return new MapperExpressionInfo()
            {
                EntityInfo = this.context.EntityMaintenance.GetEntityInfo(type)
            };
        }
        private MapperExpressionInfo GetMappingFild1ManyInfo(Expression childExpression, MapperExpression mapper)
        {
            var exp = mapper.MappingField1Expression;
            var field = (exp as LambdaExpression).Body;
            if (field is UnaryExpression)
            {
                field = (field as UnaryExpression).Operand;
            }
            var type = ((field as MemberExpression).Expression).Type;
            this.context.InitMappingInfo(type);
            var name = (field as MemberExpression).Member.Name;
            var entity = this.context.EntityMaintenance.GetEntityInfo(type);
            var fieldName = entity.Columns.First(it => it.PropertyName == name).DbColumnName;
            //var array = (field as MemberExpression).ToString().Split('.').ToList();
            //array[array.Count() - 1] = fieldName;
            //var filedString = string.Join(".", array);
            return new MapperExpressionInfo()
            {
                Type = type,
                FieldName = fieldName,
                FieldString = fieldName,
                EntityInfo = entity
            };
        }

        void Error01()
        {
            Check.Exception(mappers == null, ErrorMessage.GetThrowMessage(expression.ToString() + "no support", "当前表达式" + expression.ToString() + "必须在Mapper之后使用"));
        }
        void ThrowTrue(bool isError)
        {
            Check.Exception(isError, ErrorMessage.GetThrowMessage(expression.ToString() + "no support", "不支持表达式" + expression.ToString()+ " 1.检查当前表达式中的别名是否与Mapper中的一致 2.目前只支持 1对1 Mapper下的 Where "));
        }
    }

    public class MapperSql
    {
        public string Sql { get; set; }
    }

    public class MapperExpressionInfo
    {
        public Type Type { get; set; }
        public EntityInfo EntityInfo { get; set; }
        public string FieldName { get;  set; }
        public string FieldString { get;  set; }
    }
}


text:
package com.red_folder.phonegap.plugin.availabilitymonitor.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class SQLiteHelper extends SQLiteOpenHelper {

	private static final String DATABASE_NAME = "AvailabilityMonitor.db";
	private static final int DATABASE_VERSION = 1;

	public SQLiteHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		onUpgrade(db, 0, 1);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		SQLiteMonitorProvider.UpgradeDatabase(db, oldVersion, newVersion);
		SQLiteHTTPMonitorProvider.UpgradeDatabase(db, oldVersion, newVersion);

		SQLiteResultProvider.UpgradeDatabase(db, oldVersion, newVersion);
		SQLiteHTTPResultProvider.UpgradeDatabase(db, oldVersion, newVersion);
	}

}


text:
local json = require "json"
local parse = require "parse"
local param = require "param"
local property = require "property"
local localization = require "localization"
local database = require "database"
local exception = require "exception"
local exceptionHandler = require "exceptionHandler"
local userService = require "userService"
local localeService = require "localeService"
local priceService = require "priceService"
local cartService = require "cartService"

local function process (db, data)
	local locale = localeService.getLocale(db)
	data.locale = locale

	local user = userService.authenticatedUser(db)
	if user then
		ordersData = {}
		data.ordersData = ordersData

		ordersData.orders = user.orders
		ordersData.actionUrl = property.shopUrl .. property.accountOrderUrl
		ordersData.actionName = localization.viewOrder[locale]
	end

	exceptionHandler.fromCookieToData(data)
end

local data = {}
local db = database.connect()
local status, err = pcall(process, db, data)
db:close()
if not status then
	exceptionHandler.toData(data, err)
end

ngx.say(parse(require("BaselineHtmlTemplate"), {
	title = "Account Orders",
	externalJS = [[

	]],
	externalCSS = [[
		<link href="/shop/static/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" />

		<link rel="stylesheet" href="/shop/static/style.css" type="text/css" />
	]],
	initJS = parse([[
		var vars = {}

		vars.locale = {{locale}}

		Widget.setContainerToPage([
			[
				{size: "12u", widget: new Widget.ShopHeader()}
			],
			[
				{size: "3u", medium: "6u", small: "12u", widget: new Widget.Logo()},
				{size: "3u", medium: "6u", small: "12u", widget: new Widget.CallUs()},
				{size: "3u", medium: "6u", small: "12u", widget: new Widget.Search()},
				{size: "3u", medium: "6u", small: "12u", widget: new Widget.MiniCart()}
			],
			[
				{size: "12u", widget: new Widget.Error({{error}})}
			],
			[
				{size: "6u", medium: "8u", small: "12u", widget: "
My Account
"}
			],
			[
				{size: "3u", medium: "6u", small: "12u", widget: new Widget.AccountOptions()},
				{size: "9u", medium: "6u", small: "12u", widget: new Widget.Orders({{ordersData}})}
			]
		]);
	]], json.encodeProperties(data))
}))


text:
/**
 * Test of Tas.js
 * (c) 2017 Owen Luke
 * https://github.com/tasjs/tas
 * Released under the MIT License.
 */

var tester = require('../tester');
var expect = require('chai').expect;

describe('4.usage: mixing sync / async tasks', function(){
	it('should return ,10', function(done){

		var test = function(done, count){

			var tas = require('../tas').begin();
			var app = require('./mixing-sync-async-tasks/app').do(count);

			tas(function (){ // ignored when count === 1
				done(count, app.get());
				tas.end();
			});
		};

		var check = function(results){
			expect(results.toString() === ',10').to.be.equal(true);
			done();
		};

		// Run the test twice
		tester.do(test, check, 2);
	});
});


text:
namespace armnn
{
using namespace armcomputetensorutils;

arm_compute::Status ClBatchNormalizationValidate(const TensorInfo& input,
                                                 const TensorInfo& output,
                                                 const TensorInfo& mean,
                                                 const TensorInfo& var,
                                                 const TensorInfo& beta,
                                                 const TensorInfo& gamma,
                                                 const BatchNormalizationDescriptor& descriptor,
                                                 const ActivationDescriptor* activationDescriptor)
{
    const arm_compute::TensorInfo aclInputInfo =
        armcomputetensorutils::BuildArmComputeTensorInfo(input, descriptor.m_DataLayout);
    const arm_compute::TensorInfo aclOutputInfo =
        armcomputetensorutils::BuildArmComputeTensorInfo(output, descriptor.m_DataLayout);
    const arm_compute::TensorInfo aclMeanInfo =
        armcomputetensorutils::BuildArmComputeTensorInfo(mean, descriptor.m_DataLayout);
    const arm_compute::TensorInfo aclVarInfo =
        armcomputetensorutils::BuildArmComputeTensorInfo(var, descriptor.m_DataLayout);
    const arm_compute::TensorInfo aclBetaInfo =
        armcomputetensorutils::BuildArmComputeTensorInfo(beta, descriptor.m_DataLayout);
    const arm_compute::TensorInfo aclGammaInfo =
        armcomputetensorutils::BuildArmComputeTensorInfo(gamma, descriptor.m_DataLayout);

    const arm_compute::ActivationLayerInfo activationInfo = ConvertActivationDescriptorToAclActivationLayerInfo(
            activationDescriptor);

    return arm_compute::CLBatchNormalizationLayer::validate(&aclInputInfo,
                                                            &aclOutputInfo,
                                                            &aclMeanInfo,
                                                            &aclVarInfo,
                                                            &aclBetaInfo,
                                                            &aclGammaInfo,
                                                            descriptor.m_Eps,
                                                            activationInfo);
}

ClBatchNormalizationFloatWorkload::ClBatchNormalizationFloatWorkload(
    const BatchNormalizationQueueDescriptor& descriptor,
    const WorkloadInfo& info,
    const arm_compute::CLCompileContext& clCompileContext)
    : FloatWorkload<BatchNormalizationQueueDescriptor>(descriptor, info)
{
    // Report Profiling Details
    ARMNN_REPORT_PROFILING_WORKLOAD_DESC("ClBatchNormalizationWorkload_Construct",
                                         descriptor.m_Parameters,
                                         info,
                                         this->GetGuid());

    m_Mean = std::make_unique<arm_compute::CLTensor>();
    BuildArmComputeTensor(*m_Mean, m_Data.m_Mean->GetTensorInfo());

    m_Variance = std::make_unique<arm_compute::CLTensor>();
    BuildArmComputeTensor(*m_Variance, m_Data.m_Variance->GetTensorInfo());

    m_Gamma = std::make_unique<arm_compute::CLTensor>();
    BuildArmComputeTensor(*m_Gamma, m_Data.m_Gamma->GetTensorInfo());

    m_Beta = std::make_unique<arm_compute::CLTensor>();
    BuildArmComputeTensor(*m_Beta, m_Data.m_Beta->GetTensorInfo());

    m_Data.ValidateInputsOutputs("ClBatchNormalizationFloatWorkload", 1, 1);

    arm_compute::ICLTensor& input  = static_cast<IClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
    arm_compute::ICLTensor& output = static_cast<IClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();

    arm_compute::DataLayout aclDataLayout = ConvertDataLayout(m_Data.m_Parameters.m_DataLayout);
    input.info()->set_data_layout(aclDataLayout);
    output.info()->set_data_layout(aclDataLayout);

    const arm_compute::ActivationLayerInfo activationInfo = ConvertAdditionalInfoToAclActivationLayerInfo(descriptor);

    {
        ARMNN_SCOPED_PROFILING_EVENT(Compute::Undefined, "ClBatchNormalizationFloatWorkload_configure");
        m_Layer.configure(clCompileContext,
                          &input,
                          &output,
                          m_Mean.get(),
                          m_Variance.get(),
                          m_Beta.get(),
                          m_Gamma.get(),
                          m_Data.m_Parameters.m_Eps,
                          activationInfo);
    }

    InitializeArmComputeClTensorData(*m_Mean, m_Data.m_Mean);
    InitializeArmComputeClTensorData(*m_Variance, m_Data.m_Variance);
    InitializeArmComputeClTensorData(*m_Beta, m_Data.m_Beta);
    InitializeArmComputeClTensorData(*m_Gamma, m_Data.m_Gamma);

    // Force Compute Library to perform the necessary copying and reshaping, after which
    // delete all the input tensors that will no longer be needed
    m_Layer.prepare();
    FreeUnusedTensors();
}

void ClBatchNormalizationFloatWorkload::Execute() const
{
    ARMNN_SCOPED_PROFILING_EVENT_CL_GUID("ClBatchNormalizationFloatWorkload_Execute", this->GetGuid());
    RunClFunction(m_Layer, CHECK_LOCATION());
}

void ClBatchNormalizationFloatWorkload::FreeUnusedTensors()
{
    FreeTensorIfUnused(m_Mean);
    FreeTensorIfUnused(m_Variance);
    FreeTensorIfUnused(m_Gamma);
    FreeTensorIfUnused(m_Beta);
}

void ClBatchNormalizationFloatWorkload::ReplaceInputTensorHandle(ITensorHandle* tensorHandle, unsigned int slot)
{
    ITensorHandle* backupHandle = this->m_Data.m_Inputs[slot];
    this->m_Data.m_Inputs[slot] = tensorHandle;
    try
    {
        Reconfigure();
    }
    catch(armnn::UnimplementedException& e)
    {
        // Cannot reconfigure, revert the slot back and throw the exception.
        this->m_Data.m_Inputs[slot] = backupHandle;
        throw e;
    }
}

// Replace output tensor handle with the given TensorHandle
void ClBatchNormalizationFloatWorkload::ReplaceOutputTensorHandle(ITensorHandle* tensorHandle, unsigned int slot)
{
    ITensorHandle* backupHandle = this->m_Data.m_Inputs[slot];
    this->m_Data.m_Inputs[slot] = tensorHandle;
    try
    {
        Reconfigure();
    }
    catch(armnn::UnimplementedException& e)
    {
        // Cannot reconfigure, revert the slot back and throw the exception.
        this->m_Data.m_Inputs[slot] = backupHandle;
        throw e;
    }
}

void ClBatchNormalizationFloatWorkload::Reconfigure()
{
    throw armnn::UnimplementedException("Reconfigure not implemented for this workload");
}

} //namespace armnn


text:
import ComponentView from './ComponentTextNodeView';

export default class ComponentCommentView extends ComponentView {
  _createElement() {
    return document.createComment(this.model.get('content'));
  }
}


text:
$LOAD_PATH.unshift File.dirname(__FILE__)

require 'net/http'
require 'net/https'
require 'uri'

require 'messagebird/config'
require 'messagebird/deliverable'
require 'messagebird/helpers'
require 'messagebird/sms'
require 'messagebird/http/local_connection'
require 'messagebird/http/sender'
require 'messagebird/http/sms'
require 'messagebird/http/response_code'
require 'messagebird/http/response'

module MessageBird
  class << self

    def deliver(originator, recipients, message, options={}, &block)
      MessageBird::SMS.deliver(originator, recipients, message, options, &block)
    end

    def configure(&block)
      MessageBird::Config.configure(&block)
    end

  end
end


text:
<?php

namespace EventWeb\UserBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\Request;

use EventWeb\UserBundle\Entity\User;
use EventWeb\UserBundle\Form\RegisterFormType;

class RegisterController extends Controller{

    /**
     * @Route("/register", name="user_register")
     * @Template()
     */

    public function registerAction(Request $request){

        $defaultData = new User;
        $form = $this->createForm(new RegisterFormType(),$defaultData);

        if('POST'==$request->getMethod()){
            $form->bind($request);
            if ($form->isValid()){

                $user = $form->getData();
                $user->setPassword($this->encodePassword($user,$user->getPlainPassword()));
                $user->setRoles(array('USER_ROLE'));
                $manager = $this->getDoctrine()->getManager();
                $manager->persist($user);
                $manager->flush();
                return $this->redirect('/');
            }
        }
        return array("form" => $form->createView());
    }

     private function encodePassword($user,$plainPassword){
        $encoder = $this->container->get("security.encoder_factory")
                ->getEncoder($user);
        return $encoder->encodePassword($plainPassword, $user->getSalt());
    }

}


text:
<?php
/**
 * SqlFunction.php at ld2.my
 * Created by Babenoff at 28.08.16 - 0:52
 * Maksim Babenko <mb.babenoff@yandex.ru>
 */

namespace LD2\QueryBuilder\Additional;

use InvalidArgumentException;

/**
 * Class SqlFunction
 * @package LD2\QueryBuilder\Additional
 */
class SqlFunction implements MQB_Field
{
    private $name;
    private $values;
    private $alias;
    private $validNames = array('substring', 'year', 'month', 'day', 'date', 'length');
    /**
     * Designated constructor, which generates representation of '$name($value1, $value2, ... $valueN) as $alias' sql-construct
     * $values can either be literal, MQB_Field or array of literals and MQB_Fields
     *
     * @param string $name
     * @param mixed $values
     * @param string $alias
     * @throws InvalidArgumentException
     */
    public function __construct($name, $values, $alias = null)
    {
        if (!is_string($name) or !in_array($name, $this->validNames))
            throw new InvalidArgumentException('Invalid sql-function: '.$name);
        if (!is_array($values))
            $values = array($values);
        foreach ($values as $v) {
            if (is_object($v) and !($v instanceof MQB_Field))
                throw new InvalidArgumentException("Something wrong passed as a parameter");
        }
        $this->name = $name;
        $this->values = $values;
        $this->alias = $alias;
    }
    public function getSql(array &$parameters)
    {
        $result = strtoupper($this->name)."(";
        $first = true;
        foreach ($this->values as $v) {
            if ($first) {
                $first = false;
            } else {
                $result .= ', ';
            }
            if (is_object($v)) {
                $result .= $v->getSql($parameters);
            } else {
                $result .= $v;
            }
        }
        $result .= ')';
        if (null !== $this->alias) {
            $result .= ' AS '.$this->getAlias();
        }
        return $result;
    }
    /**
     * accessor for internal "number of alias" property. returns NULL, if alias is not set
     *
     * @return string|null
     */
    public function getAlias()
    {
        if (null === $this->alias)
            return null;
        return '`'.$this->alias.'`';
    }
    /**
     * accessor for internal "name of the function" property
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }
}


text:
import sys
import csv
import pprint
import cPickle

import numpy as np
import pandas as pd

from sklearn.ensemble import RandomForestClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.tree import export_graphviz
from sklearn.externals.six import StringIO

def splitData(df, index, testSize=50):

	indexCopy = index[:]
	np.random.shuffle(indexCopy)

	trainingData = df.ix[indexCopy[:-testSize]]
	testingData = df.ix[indexCopy[-testSize:]]

	return (trainingData, testingData)

csvFilePath = sys.argv[1]

print "Reading from: ", csvFilePath

dataList = []
header = []
userIndex = []

with open(csvFilePath, 'r') as csvFile:
	csvObj = csv.reader(csvFile, delimiter=',')

	for headerStr in csvObj.next():
		header.append(headerStr.strip())

	for row in csvObj:

		# strippedRow = [x.strip() for x in row]
		strippedRow = []

		for i in range(len(row)):
			if ( i < 2 ):
				strippedRow.append(row[i].strip())
			else:
				strippedRow.append(float(row[i].strip()))

		dataList.append(strippedRow)
		userIndex.append("%s-%s"%(strippedRow[0], strippedRow[1]))

df = pd.DataFrame(dataList, columns=header, index=userIndex)

shuffledIndex = userIndex[:]
np.random.shuffle(shuffledIndex)

bestClassifier = {'classifier':None, 'score':0}
classifierList = []

featureList = [
	# 'neighbors',
	'density',
	'degreedist',
	'neighborprop',
	'tieprop',
	'cluster',
	'triangle'
]

for _ in range(100):
	(trainDf, testDf) = splitData(df, userIndex)

	trainLabels = trainDf['isanswer'].values
	trainData = trainDf[featureList]

	# classifier = RandomForestClassifier(
	# 	n_estimators=100,
	# 	max_features=None,
	# 	# verbose=2,
	# 	# compute_importances=True,
	# 	n_jobs=4,
	# 	random_state=0,
	# )
	classifier = DecisionTreeClassifier()
	classifier.fit(trainData, trainLabels)

	testLabels = testDf['isanswer'].values
	testData = testDf[featureList]

	score = classifier.score(testData, testLabels)

	if ( score > bestClassifier['score']):
		bestClassifier['score'] = score
		bestClassifier['classifier'] = classifier

	print score

	classifierList.append({'classifier':classifier, 'score':score})

print "Best score: ", bestClassifier['score']

with open("tree.dot", 'w') as f:
	f = export_graphviz(bestClassifier['classifier'],
		out_file=f,
		feature_names=featureList)

# save the classifier
with open('my_classifier.pkl', 'wb') as fid:
    cPickle.dump(bestClassifier['classifier'], fid)


text:
Angular offers two kinds of built-in directives: [_attribute_ directives](guide/attribute-directives) and [_structural_ directives](guide/structural-directives).

See the <live-example></live-example> for a working example containing the code snippets in this guide.

For more detail, including how to build your own custom directives, see [Attribute Directives](guide/attribute-directives) and [Structural Directives](guide/structural-directives).

{@a attribute-directives}

## Built-in attribute directives

Attribute directives listen to and modify the behavior of
other HTML elements, attributes, properties, and components.
You usually apply them to elements as if they were HTML attributes, hence the name.

Many NgModules such as the [`RouterModule`](guide/router "Routing and Navigation")
and the [`FormsModule`](guide/forms "Forms") define their own attribute directives.
The most common attribute directives are as follows:

* [`NgClass`](guide/built-in-directives#ngClass)—adds and removes a set of CSS classes.
* [`NgStyle`](guide/built-in-directives#ngStyle)—adds and removes a set of HTML styles.
* [`NgModel`](guide/built-in-directives#ngModel)—adds two-way data binding to an HTML form element.

{@a ngClass}

## `NgClass`

Add or remove several CSS classes simultaneously with `ngClass`.

To add or remove a *single* class, use [class binding](guide/attribute-binding#class-binding) rather than `NgClass`.

Consider a `setCurrentClasses()` component method that sets a component property,
`currentClasses`, with an object that adds or removes three classes based on the
`true`/`false` state of three other component properties. Each key of the object is a CSS class name; its value is `true` if the class should be added,
`false` if it should be removed.

Adding an `ngClass` property binding to `currentClasses` sets the element's classes accordingly:

Remember that in this situation you'd call `setCurrentClasses()`,
both initially and when the dependent properties change.

{@a ngStyle}

## `NgStyle`

Use `NgStyle` to set many inline styles simultaneously and dynamically, based on the state of the component.

### Without `NgStyle`

For context, consider setting a *single* style value with [style binding](guide/attribute-binding#style-binding), without `NgStyle`.

However, to set *many* inline styles at the same time, use the `NgStyle` directive.

The following is a `setCurrentStyles()` method that sets a component
property, `currentStyles`, with an object that defines three styles,
based on the state of three other component properties:

Adding an `ngStyle` property binding to `currentStyles` sets the element's styles accordingly:

Remember to call `setCurrentStyles()`, both initially and when the dependent properties change.

{@a ngModel}

## `[(ngModel)]`: Two-way binding

The `NgModel` directive allows you to display a data property and
update that property when the user makes changes. Here's an example:

### Import `FormsModule` to use `ngModel`

Before using the `ngModel` directive in a two-way data binding,
you must import the `FormsModule` and add it to the NgModule's `imports` list.
Learn more about the `FormsModule` and `ngModel` in [Forms](guide/forms#ngModel).

Remember to import the `FormsModule` to make `[(ngModel)]` available as follows:

You could achieve the same result with separate bindings to
the `<input>` element's  `value` property and `input` event:

To streamline the syntax, the `ngModel` directive hides the details behind its own `ngModel` input and `ngModelChange` output properties:

The `ngModel` data property sets the element's value property and the `ngModelChange` event property
listens for changes to the element's value.

### `NgModel` and value accessors

The details are specific to each kind of element and therefore the `NgModel` directive only works for an element
supported by a [ControlValueAccessor](api/forms/ControlValueAccessor)
that adapts an element to this protocol.
Angular provides *value accessors* for all of the basic HTML form elements and the
[Forms](guide/forms) guide shows how to bind to them.

You can't apply `[(ngModel)]` to a non-form native element or a
third-party custom component until you write a suitable value accessor. For more information, see
the API documentation on [DefaultValueAccessor](api/forms/DefaultValueAccessor).

You don't need a value accessor for an Angular component that
you write because you can name the value and event properties
to suit Angular's basic [two-way binding syntax](guide/two-way-binding)
and skip `NgModel` altogether.
The `sizer` in the
[Two-way Binding](guide/two-way-binding) section is an example of this technique.

Separate `ngModel` bindings are an improvement over binding to the
element's native properties, but you can streamline the binding with a
single declaration using the `[(ngModel)]` syntax:

This `[(ngModel)]` syntax can only _set_ a data-bound property.
If you need to do something more, you can write the expanded form;
for example, the following changes the `<input>` value to uppercase:

Here are all variations in action, including the uppercase version:

{@a structural-directives}

## Built-in _structural_ directives

Structural directives are responsible for HTML layout.
They shape or reshape the DOM's structure, typically by adding, removing, and manipulating
the host elements to which they are attached.

This section is an introduction to the common built-in structural directives:

* [`NgIf`](guide/built-in-directives#ngIf)—conditionally creates or destroys subviews from the template.
* [`NgFor`](guide/built-in-directives#ngFor)—repeat a node for each item in a list.
* [`NgSwitch`](guide/built-in-directives#ngSwitch)—a set of directives that switch among alternative views.

The deep details of structural directives are covered in the
[Structural Directives](guide/structural-directives) guide,
which explains the following:

* Why you
[prefix the directive name with an asterisk (\*)](guide/structural-directives#the-asterisk--prefix).
* Using [`<ng-container>`](guide/structural-directives#ngcontainer "<ng-container>")
to group elements when there is no suitable host element for the directive.
* How to write your own structural directive.
* That you can only apply [one structural directive](guide/structural-directives#one-per-element "one per host element") to an element.

{@a ngIf}

## NgIf

You can add or remove an element from the DOM by applying an `NgIf` directive to
a host element.
Bind the directive to a condition expression like `isActive` in this example.

Don't forget the asterisk (`*`) in front of `ngIf`. For more information
on the asterisk, see the [asterisk (*) prefix](guide/structural-directives#the-asterisk--prefix) section of
[Structural Directives](guide/structural-directives).

When the `isActive` expression returns a truthy value, `NgIf` adds the
`ItemDetailComponent` to the DOM.
When the expression is falsy, `NgIf` removes the `ItemDetailComponent`
from the DOM, destroying that component and all of its sub-components.

### Show/hide vs. `NgIf`

Hiding an element is different from removing it with `NgIf`.
For comparison, the following example shows how to control
the visibility of an element with a
[class](guide/attribute-binding#class-binding) or [style](guide/attribute-binding#style-binding) binding.

When you hide an element, that element and all of its descendants remain in the DOM.
All components for those elements stay in memory and
Angular may continue to check for changes.
You could be holding onto considerable computing resources and degrading performance
unnecessarily.

`NgIf` works differently. When `NgIf` is `false`, Angular removes the element and its descendants from the DOM.
It destroys their components, freeing up resources, which
results in a better user experience.

If you are hiding large component trees, consider `NgIf` as a more
efficient alternative to showing/hiding.

For more information on `NgIf` and `ngIfElse`, see the [API documentation about NgIf](api/common/NgIf).

### Guard against null

Another advantage of `ngIf` is that you can use it to guard against null. Show/hide
is best suited for very simple use cases, so when you need a guard, opt instead for `ngIf`. Angular will throw an error if a nested expression tries to access a property of `null`.

The following shows `NgIf` guarding two `<div>`s.
The `currentCustomer` name appears only when there is a `currentCustomer`.
The `nullCustomer` will not be displayed as long as it is `null`.

See also the
[safe navigation operator](guide/template-expression-operators#safe-navigation-operator "Safe navigation operator (?.)") below.

{@a ngFor}
## `NgFor`

`NgFor` is a repeater directive—a way to present a list of items.
You define a block of HTML that defines how a single item should be displayed
and then you tell Angular to use that block as a template for rendering each item in the list.
The text assigned to `*ngFor` is the instruction that guides the repeater process.

The following example shows `NgFor` applied to a simple `<div>`. (Don't forget the asterisk (`*`) in front of `ngFor`.)

Don't forget the asterisk (`*`) in front of `ngFor`. For more information
on the asterisk, see the [asterisk (*) prefix](guide/structural-directives#the-asterisk--prefix) section of
[Structural Directives](guide/structural-directives).

You can also apply an `NgFor` to a component element, as in the following example.

{@a microsyntax}

*ngFor microsyntax

The string assigned to `*ngFor` is not a [template expression](guide/interpolation). Rather,
it's a *microsyntax*—a little language of its own that Angular interprets.
The string `"let item of items"` means:

> *Take each item in the `items` array, store it in the local `item` looping variable, and
make it available to the templated HTML for each iteration.*

Angular translates this instruction into an `<ng-template>` around the host element,
then uses this template repeatedly to create a new set of elements and bindings for each `item`
in the list.
For more information about microsyntax, see the [Structural Directives](guide/structural-directives#microsyntax) guide.

{@a template-input-variable}

{@a template-input-variables}

### Template input variables

The `let` keyword before `item` creates a template input variable called `item`.
The `ngFor` directive iterates over the `items` array returned by the parent component's `items` property
and sets `item` to the current item from the array during each iteration.

Reference `item` within the `ngFor` host element
as well as within its descendants to access the item's properties.
The following example references `item` first in an interpolation
and then passes in a binding to the `item` property of the `<app-item-detail>` component.

For more information about template input variables, see
[Structural Directives](guide/structural-directives#template-input-variable).

### `*ngFor` with `index`

The `index` property of the `NgFor` directive context
returns the zero-based index of the item in each iteration.
You can capture the `index` in a template input variable and use it in the template.

The next example captures the `index` in a variable named `i` and displays it with the item name.

`NgFor` is implemented by the `NgForOf` directive. Read more about the other `NgForOf` context values such as `last`, `even`,
and `odd` in the [NgForOf API reference](api/common/NgForOf).

{@a trackBy}
### *ngFor with `trackBy`

If you use `NgFor` with large lists, a small change to one item, such as removing or adding an item, can trigger a cascade of DOM manipulations. For example, re-querying the server could reset a list with all new item objects, even when those items were previously displayed. In this case, Angular sees only a fresh list of new object references and has no choice but to replace the old DOM elements with all new DOM elements.

You can make this more efficient with `trackBy`.
Add a method to the component that returns the value `NgFor` should track.
In this case, that value is the hero's `id`. If the `id` has already been rendered,
Angular keeps track of it and doesn't re-query the server for the same `id`.

In the microsyntax expression, set `trackBy` to the `trackByItems()` method.

Here is an illustration of the `trackBy` effect.
"Reset items" creates new items with the same `item.id`s.
"Change ids" creates new items with new `item.id`s.

* With no `trackBy`, both buttons trigger complete DOM element replacement.
* With `trackBy`, only changing the `id` triggers element replacement.

Built-in directives use only public APIs; that is,
they do not have special access to any private APIs that other directives can't access.

{@a ngSwitch}
## The `NgSwitch` directives

NgSwitch is like the JavaScript `switch` statement.
It displays one element from among several possible elements, based on a switch condition.
Angular puts only the selected element into the DOM.

`NgSwitch` is actually a set of three, cooperating directives:
`NgSwitch`, `NgSwitchCase`, and `NgSwitchDefault` as in the following example.

`NgSwitch` is the controller directive. Bind it to an expression that returns
the *switch value*, such as `feature`. Though the `feature` value in this
example is a string, the switch value can be of any type.

**Bind to `[ngSwitch]`**. You'll get an error if you try to set `*ngSwitch` because
`NgSwitch` is an *attribute* directive, not a *structural* directive.
Rather than touching the DOM directly, it changes the behavior of its companion directives.

**Bind to `*ngSwitchCase` and `*ngSwitchDefault`**.
The `NgSwitchCase` and `NgSwitchDefault` directives are _structural_ directives
because they add or remove elements from the DOM.

* `NgSwitchCase` adds its element to the DOM when its bound value equals the switch value and removes
its bound value when it doesn't equal the switch value.

* `NgSwitchDefault` adds its element to the DOM when there is no selected `NgSwitchCase`.

The switch directives are particularly useful for adding and removing *component elements*.
This example switches among four `item` components defined in the `item-switch.components.ts` file.
Each component has an `item` [input property](guide/inputs-outputs#input "Input property")
which is bound to the `currentItem` of the parent component.

Switch directives work as well with native elements and web components too.
For example, you could replace the `<app-best-item>` switch case with the following.