text:
import { Pipe, PipeTransform } from '@angular/core';

// Filter that check if there is no another values with this key
// in this collection
@Pipe({
    name: 'isUnique'
})
export class isUniquePipe implements PipeTransform {
    transform(collection: any[], key: any, value: any): boolean {
        var count = 0;

        collection.forEach(function(item) {
            if (item[key] === value) {
                count++;
            }
        });

        // 1 - itself
        return count > 1 ? false : true;
    }
}


text:
import { AbstractControl } from '@angular/forms';
import { Component, HostBinding, Input } from '@angular/core';

@Component({
    selector: 'app-form-control-container',
    templateUrl: './form-control-container.component.html',
    styleUrls: ['./form-control-container.component.scss']
})
export class FormControlContainerComponent {

    @Input() control: AbstractControl;

    @HostBinding('class.has-error') get hasError(): boolean {
        return this.control.invalid && this.control.dirty;
    }

}

redpajama_set_name: RedPajamaGithub


text:
from pysnmp.carrier.twisted.dispatch import TwistedDispatcher
from pysnmp.carrier.base import AbstractTransport

class AbstractTwistedTransport(AbstractTransport):
    protoTransportDispatcher = TwistedDispatcher
    """Base Twisted Transport, to be used with TwistedDispatcher"""
    def __init__(self):
        self._writeQ = []


text:
import os
import sys
from unittest import skip

from django.conf import settings
from django.db.backends.base.creation import BaseDatabaseCreation
from django.utils.module_loading import import_string

class DatabaseCreation(BaseDatabaseCreation):
    """
    Spanner-specific wrapper for Django class encapsulating methods for
    creation and destruction of the underlying test database.
    """

    def mark_skips(self):
        """Skip tests that don't work on Spanner."""
        for test_name in self.connection.features.skip_tests:
            test_case_name, _, method_name = test_name.rpartition(".")
            test_app = test_name.split(".")[0]
            # Importing a test app that isn't installed raises RuntimeError.
            if test_app in settings.INSTALLED_APPS:
                test_case = import_string(test_case_name)
                method = getattr(test_case, method_name)
                setattr(
                    test_case,
                    method_name,
                    skip("unsupported by Spanner")(method),
                )

    def create_test_db(self, *args, **kwargs):
        """Create a test database.

        :rtype: str
        :returns: The name of the newly created test Database.
        """
        # This environment variable is set by the Travis build script or
        # by a developer running the tests locally.
        if os.environ.get("RUNNING_SPANNER_BACKEND_TESTS") == "1":
            self.mark_skips()
        super().create_test_db(*args, **kwargs)

    def _create_test_db(self, verbosity, autoclobber, keepdb=False):
        """
        Create dummy test tables. This method is mostly copied from the
        base class but removes usage of `_nodb_connection` since Spanner doesn't
        have or need one.
        """
        # Mostly copied from the base class but removes usage of
        # _nodb_connection since Spanner doesn't have or need one.
        test_database_name = self._get_test_db_name()
        # Don't quote the test database name because google.cloud.spanner_v1
        # does it.
        test_db_params = {"dbname": test_database_name}
        # Create the test database.
        try:
            self._execute_create_test_db(None, test_db_params, keepdb)
        except Exception as e:
            # If the db should be kept, then no need to do any of the below,
            # just return and skip it all.
            if keepdb:
                return test_database_name
            self.log("Got an error creating the test database: %s" % e)
            if not autoclobber:
                confirm = input(
                    "Type 'yes' if you would like to try deleting the test "
                    "database '%s', or 'no' to cancel: " % test_database_name
                )
            if autoclobber or confirm == "yes":
                try:
                    if verbosity >= 1:
                        self.log(
                            "Destroying old test database for alias %s..."
                            % (
                                self._get_database_display_str(
                                    verbosity, test_database_name
                                ),
                            )
                        )
                    self._destroy_test_db(test_database_name, verbosity)
                    self._execute_create_test_db(None, test_db_params, keepdb)
                except Exception as e:
                    self.log(
                        "Got an error recreating the test database: %s" % e
                    )
                    sys.exit(2)
            else:
                self.log("Tests cancelled.")
                sys.exit(1)
        return test_database_name

    def _execute_create_test_db(self, cursor, parameters, keepdb=False):
        self.connection.instance.database(parameters["dbname"]).create()

    def _destroy_test_db(self, test_database_name, verbosity):
        self.connection.instance.database(test_database_name).drop()


text:
set -e

# clone repo
git clone git://gitorious.org/mediagoblin/mediagoblin.git
cd mediagoblin
git submodule update --init

# set up the deps and main code
(virtualenv --system-site-packages . || virtualenv .) && ./bin/python setup.py develop

# install flup for fcgi
./bin/easy_install flup


text:
<link rel="import" href="/bower_components/polymer/polymer.html">
<link rel="import" href="/layouts/sidebar-layout.html">
<link rel="import" href="/elements/refund-list.html">

<polymer-element name="payments-page" attributes="pathArg1" noscript>
  <template>
    <sidebar-layout selected="payments">

Payments

	    <refund-list></refund-list>

    </sidebar-layout>
  </template>
</polymer-element>


text:
from collections import Callable
from django.http import HttpResponseNotAllowed

import warnings

HTTP_METHODS = {
    'get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace', 'connect'
}

def _warn_if_unknown_http_method(method):
    if method not in HTTP_METHODS:
        warnings.warn('Warning: {} may not be a valid HTTP method'.format(method))

def _perform_route_http_assertions(method_view_pairs):
    assert len(method_view_pairs), 'At least one HTTP method to mapping must be present'

    # check to make sure http methods are listed only once.
    methods_used = set()
    for methods, view_func in method_view_pairs:
        assert isinstance(methods, set), 'Methods must be a Set'
        assert isinstance(view_func, Callable), '{} must be a callable'.format(view_func.__name__)

        for method in methods:
            assert methods not in methods_used, "{} is listed more than once. Associated view " \
                                                "function is {}".format(method, view_func.__name__)
            methods_used.add(method)

            _warn_if_unknown_http_method(method)

def _make_method_viewfunc_dict(method_view_pairs):
    method_viewfunc_dict = {}
    for methods, view_func in method_view_pairs:
        for method in methods:
            method_viewfunc_dict[method] = view_func
    return method_viewfunc_dict

def route_multiple(*method_view_pairs):
    """
    usage should be:
    route_multiple(
        ({'get', 'head'}, render_form_view),
        ({'post'}, submit_form_view),
    )
    """
    _perform_route_http_assertions(method_view_pairs)

    method_viewfunc_dict = _make_method_viewfunc_dict(method_view_pairs)

    def inner_func(request, *args, **kwargs):
        try:
            view_func = method_viewfunc_dict[request.method.lower()]
        except KeyError:
            return HttpResponseNotAllowed("The {} method is not allowed")
        else:
            return view_func(request, *args, **kwargs)
    return inner_func

def route(**method_dict):
    """
    wrapper around route_multiple for a simpler API, namely:

    route(
        get=render_form_view,
        post=submit_form_view
    )
    """
    method_func_pairs = [
        ({method}, view_func) for method, view_func in method_dict.items()
    ]

    return route_multiple(*method_func_pairs)

def route_all(view_func):
    """
    Convenience wrapper function in the case that all HTTP methods should be routed to one function.
    """
    return route_multiple(
        ({method for method in HTTP_METHODS}, view_func)
    )


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

package com.google.gerrit.httpd;

import static com.google.common.base.Strings.emptyToNull;
import static com.google.common.net.HttpHeaders.AUTHORIZATION;

import org.eclipse.jgit.util.Base64;

import javax.servlet.http.HttpServletRequest;

public class RemoteUserUtil {
  /**
   * Tries to get username from a request with following strategies:
   *

   *
ServletRequest#getRemoteUser

   *
HTTP 'Authorization' header

   *
Custom HTTP header

   *

   *
   * @param req request to extract username from.
   * @param loginHeader name of header which is used for extracting
   *    username.
   * @return the extracted username or null.
   */
  public static String getRemoteUser(HttpServletRequest req,
      String loginHeader) {
    if (AUTHORIZATION.equals(loginHeader)) {
      String user = emptyToNull(req.getRemoteUser());
      if (user != null) {
        // The container performed the authentication, and has the user
        // identity already decoded for us. Honor that as we have been
        // configured to honor HTTP authentication.
        return user;
      }

      // If the container didn't do the authentication we might
      // have done it in the front-end web server. Try to split
      // the identity out of the Authorization header and honor it.
      String auth = req.getHeader(AUTHORIZATION);
      return extractUsername(auth);
    } else {
      // Nonstandard HTTP header. We have been told to trust this
      // header blindly as-is.
      return emptyToNull(req.getHeader(loginHeader));
    }
  }

  /**
   * Extracts username from an HTTP Basic or Digest authentication
   * header.
   *
   * @param auth header value which is used for extracting.
   * @return username if available or null.
   */
  public static String extractUsername(String auth) {
    auth = emptyToNull(auth);

    if (auth == null) {
      return null;

    } else if (auth.startsWith("Basic ")) {
      auth = auth.substring("Basic ".length());
      auth = new String(Base64.decode(auth));
      final int c = auth.indexOf(':');
      return c > 0 ? auth.substring(0, c) : null;

    } else if (auth.startsWith("Digest ")) {
      final int u = auth.indexOf("username=\"");
      if (u <= 0) {
        return null;
      }
      auth = auth.substring(u + 10);
      final int e = auth.indexOf('"');
      return e > 0 ? auth.substring(0, e) : null;

    } else {
      return null;
    }
  }
}


text:
package io.proleap.cobol.asg.metamodel.data.screen.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import io.proleap.cobol.CobolParser.PictureStringContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionAutoClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionBackgroundColorClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionBellClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionBlankClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionBlankWhenZeroClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionBlinkClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionColumnClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionControlClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionEntryContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionEraseClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionForegroundColorClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionFromClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionFullClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionGridClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionJustifiedClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionLightClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionLineClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionPictureClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionPromptClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionRequiredClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionReverseVideoClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionSecureClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionSignClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionSizeClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionUnderlineClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionUsageClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionUsingClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionValueClauseContext;
import io.proleap.cobol.CobolParser.ScreenDescriptionZeroFillClauseContext;
import io.proleap.cobol.asg.metamodel.IntegerLiteral;
import io.proleap.cobol.asg.metamodel.Literal;
import io.proleap.cobol.asg.metamodel.ProgramUnit;
import io.proleap.cobol.asg.metamodel.call.Call;
import io.proleap.cobol.asg.metamodel.call.ScreenDescriptionEntryCall;
import io.proleap.cobol.asg.metamodel.data.screen.AutoClause;
import io.proleap.cobol.asg.metamodel.data.screen.BackgroundColorClause;
import io.proleap.cobol.asg.metamodel.data.screen.BellClause;
import io.proleap.cobol.asg.metamodel.data.screen.BlankClause;
import io.proleap.cobol.asg.metamodel.data.screen.BlankWhenZeroClause;
import io.proleap.cobol.asg.metamodel.data.screen.BlinkClause;
import io.proleap.cobol.asg.metamodel.data.screen.ColumnNumberClause;
import io.proleap.cobol.asg.metamodel.data.screen.ControlClause;
import io.proleap.cobol.asg.metamodel.data.screen.EraseClause;
import io.proleap.cobol.asg.metamodel.data.screen.ForegroundColorClause;
import io.proleap.cobol.asg.metamodel.data.screen.FromClause;
import io.proleap.cobol.asg.metamodel.data.screen.FullClause;
import io.proleap.cobol.asg.metamodel.data.screen.GridClause;
import io.proleap.cobol.asg.metamodel.data.screen.JustifiedClause;
import io.proleap.cobol.asg.metamodel.data.screen.LightClause;
import io.proleap.cobol.asg.metamodel.data.screen.LineNumberClause;
import io.proleap.cobol.asg.metamodel.data.screen.PictureClause;
import io.proleap.cobol.asg.metamodel.data.screen.PromptClause;
import io.proleap.cobol.asg.metamodel.data.screen.RequiredClause;
import io.proleap.cobol.asg.metamodel.data.screen.ReverseVideoClause;
import io.proleap.cobol.asg.metamodel.data.screen.ScreenDescriptionEntry;
import io.proleap.cobol.asg.metamodel.data.screen.SecureClause;
import io.proleap.cobol.asg.metamodel.data.screen.SignClause;
import io.proleap.cobol.asg.metamodel.data.screen.SizeClause;
import io.proleap.cobol.asg.metamodel.data.screen.UnderlineClause;
import io.proleap.cobol.asg.metamodel.data.screen.UsageClause;
import io.proleap.cobol.asg.metamodel.data.screen.UsingClause;
import io.proleap.cobol.asg.metamodel.data.screen.ValueClause;
import io.proleap.cobol.asg.metamodel.data.screen.ZeroFillClause;
import io.proleap.cobol.asg.metamodel.impl.CobolDivisionElementImpl;
import io.proleap.cobol.asg.metamodel.valuestmt.ValueStmt;

public class ScreenDescriptionEntryImpl extends CobolDivisionElementImpl implements ScreenDescriptionEntry {

	protected AutoClause autoClause;

	protected BackgroundColorClause backgroundColorClause;

	protected BellClause bellClause;

	protected BlankClause blankClause;

	protected BlankWhenZeroClause blankWhenZeroClause;

	protected BlinkClause blinkClause;

	protected final List<ScreenDescriptionEntryCall> calls = new ArrayList<ScreenDescriptionEntryCall>();

	protected ColumnNumberClause columnNumberClause;

	protected ControlClause controlClause;

	protected ScreenDescriptionEntryContext ctx;

	protected EraseClause eraseClause;

	protected Boolean filler;

	protected ForegroundColorClause foregroundColorClause;

	protected FromClause fromClause;

	protected FullClause fullClause;

	protected GridClause gridClause;

	protected JustifiedClause justifiedClause;

	protected Integer levelNumber;

	protected LightClause lightClause;

	protected LineNumberClause lineNumberClause;

	protected final String name;

	protected ScreenDescriptionEntry parentScreenDescriptionEntry;

	protected PictureClause pictureClause;

	protected ScreenDescriptionEntry predecessor;

	protected PromptClause promptClause;

	protected RequiredClause requiredClause;

	protected ReverseVideoClause reverseVideoClause;

	protected List<ScreenDescriptionEntry> screenDescriptionEntries = new ArrayList<ScreenDescriptionEntry>();

	protected Map<String, ScreenDescriptionEntry> screenDescriptionEntriesSymbolTable = new HashMap<String, ScreenDescriptionEntry>();

	protected SecureClause secureClause;

	protected SignClause signClause;

	protected SizeClause sizeClause;

	protected ScreenDescriptionEntry successor;

	protected UnderlineClause underlineClause;

	protected UsageClause usageClause;

	protected UsingClause usingClause;

	protected ValueClause valueClause;

	protected ZeroFillClause zeroFillClause;

	public ScreenDescriptionEntryImpl(final String name, final ProgramUnit programUnit,
			final ScreenDescriptionEntryContext ctx) {
		super(programUnit, ctx);

		this.name = name;
		this.ctx = ctx;
	}

	@Override
	public AutoClause addAutoClause(final ScreenDescriptionAutoClauseContext ctx) {
		AutoClause result = (AutoClause) getASGElement(ctx);

		if (result == null) {
			result = new AutoClauseImpl(programUnit, ctx);

			// type
			final AutoClause.AutoClauseType type;

			if (ctx.AUTO() != null) {
				type = AutoClause.AutoClauseType.AUTO;
			} else if (ctx.AUTO_SKIP() != null) {
				type = AutoClause.AutoClauseType.AUTO_SKIP;
			} else {
				type = null;
			}

			result.setAutoClauseType(type);

			autoClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public BackgroundColorClause addBackgroundColorClause(final ScreenDescriptionBackgroundColorClauseContext ctx) {
		BackgroundColorClause result = (BackgroundColorClause) getASGElement(ctx);

		if (result == null) {
			result = new BackgroundColorClauseImpl(programUnit, ctx);

			final ValueStmt colorValueStmt = createValueStmt(ctx.identifier(), ctx.integerLiteral());
			result.setColorValueStmt(colorValueStmt);

			backgroundColorClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public BellClause addBellClause(final ScreenDescriptionBellClauseContext ctx) {
		BellClause result = (BellClause) getASGElement(ctx);

		if (result == null) {
			result = new BellClauseImpl(programUnit, ctx);

			// type
			final BellClause.BellClauseType type;

			if (ctx.BELL() != null) {
				type = BellClause.BellClauseType.BELL;
			} else if (ctx.BEEP() != null) {
				type = BellClause.BellClauseType.BEEP;
			} else {
				type = null;
			}

			result.setBellClauseType(type);

			bellClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public BlankClause addBlankClause(final ScreenDescriptionBlankClauseContext ctx) {
		BlankClause result = (BlankClause) getASGElement(ctx);

		if (result == null) {
			result = new BlankClauseImpl(programUnit, ctx);

			// type
			final BlankClause.BlankClauseType type;

			if (ctx.SCREEN() != null) {
				type = BlankClause.BlankClauseType.SCREEN;
			} else if (ctx.LINE() != null) {
				type = BlankClause.BlankClauseType.LINE;
			} else {
				type = null;
			}

			result.setBlankClauseType(type);

			blankClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public BlankWhenZeroClause addBlankWhenZeroClause(final ScreenDescriptionBlankWhenZeroClauseContext ctx) {
		BlankWhenZeroClause result = (BlankWhenZeroClause) getASGElement(ctx);

		if (result == null) {
			result = new BlankWhenZeroClauseImpl(programUnit, ctx);

			result.setBlankWhenZero(true);

			blankWhenZeroClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public BlinkClause addBlinkClause(final ScreenDescriptionBlinkClauseContext ctx) {
		BlinkClause result = (BlinkClause) getASGElement(ctx);

		if (result == null) {
			result = new BlinkClauseImpl(programUnit, ctx);

			result.setBlink(true);

			blinkClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public void addCall(final ScreenDescriptionEntryCall call) {
		calls.add(call);
	}

	@Override
	public ColumnNumberClause addColumnNumberClause(final ScreenDescriptionColumnClauseContext ctx) {
		ColumnNumberClause result = (ColumnNumberClause) getASGElement(ctx);

		if (result == null) {
			result = new ColumnNumberClauseImpl(programUnit, ctx);

			// type
			final ColumnNumberClause.ColumnNumberClauseType type;

			if (ctx.PLUS() != null) {
				type = ColumnNumberClause.ColumnNumberClauseType.PLUS;
			} else if (ctx.PLUSCHAR() != null) {
				type = ColumnNumberClause.ColumnNumberClauseType.PLUS;
			} else if (ctx.MINUSCHAR() != null) {
				type = ColumnNumberClause.ColumnNumberClauseType.MINUS;
			} else {
				type = ColumnNumberClause.ColumnNumberClauseType.EQUAL;
			}

			result.setColumnNumberClauseType(type);

			// line number
			if (ctx.integerLiteral() != null) {
				final IntegerLiteral lineNumber = createIntegerLiteral(ctx.integerLiteral());
				result.setIntegerLiteral(lineNumber);
			}

			columnNumberClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public ControlClause addControlClause(final ScreenDescriptionControlClauseContext ctx) {
		ControlClause result = (ControlClause) getASGElement(ctx);

		if (result == null) {
			result = new ControlClauseImpl(programUnit, ctx);

			if (ctx.identifier() != null) {
				final Call controlCall = createCall(ctx.identifier());
				result.setControlCall(controlCall);
			}

			controlClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public EraseClause addEraseClause(final ScreenDescriptionEraseClauseContext ctx) {
		EraseClause result = (EraseClause) getASGElement(ctx);

		if (result == null) {
			result = new EraseClauseImpl(programUnit, ctx);

			// type
			final EraseClause.EraseClauseType type;

			if (ctx.EOL() != null) {
				type = EraseClause.EraseClauseType.EOL;
			} else if (ctx.EOS() != null) {
				type = EraseClause.EraseClauseType.EOS;
			} else {
				type = null;
			}

			result.setEraseClauseType(type);

			eraseClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public ForegroundColorClause addForegroundColorClause(final ScreenDescriptionForegroundColorClauseContext ctx) {
		ForegroundColorClause result = (ForegroundColorClause) getASGElement(ctx);

		if (result == null) {
			result = new ForegroundColorClauseImpl(programUnit, ctx);

			final ValueStmt colorValueStmt = createValueStmt(ctx.identifier(), ctx.integerLiteral());
			result.setColorValueStmt(colorValueStmt);

			foregroundColorClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public FromClause addFromClause(final ScreenDescriptionFromClauseContext ctx) {
		FromClause result = (FromClause) getASGElement(ctx);

		if (result == null) {
			result = new FromClauseImpl(programUnit, ctx);

			// from
			final ValueStmt fromValueStmt = createValueStmt(ctx.identifier(), ctx.literal());
			result.setFromValueStmt(fromValueStmt);

			// to
			if (ctx.screenDescriptionToClause() != null) {
				result.addTo(ctx.screenDescriptionToClause());
			}

			fromClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public FullClause addFullClause(final ScreenDescriptionFullClauseContext ctx) {
		FullClause result = (FullClause) getASGElement(ctx);

		if (result == null) {
			result = new FullClauseImpl(programUnit, ctx);

			// type
			final FullClause.FullClauseType type;

			if (ctx.FULL() != null) {
				type = FullClause.FullClauseType.FULL;
			} else if (ctx.LENGTH_CHECK() != null) {
				type = FullClause.FullClauseType.LENGTH_CHECK;
			} else {
				type = null;
			}

			result.setFullClauseType(type);

			fullClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public GridClause addGridClause(final ScreenDescriptionGridClauseContext ctx) {
		GridClause result = (GridClause) getASGElement(ctx);

		if (result == null) {
			result = new GridClauseImpl(programUnit, ctx);

			// type
			final GridClause.GridClauseType type;

			if (ctx.GRID() != null) {
				type = GridClause.GridClauseType.GRID;
			} else if (ctx.LEFTLINE() != null) {
				type = GridClause.GridClauseType.LEFTLINE;
			} else if (ctx.OVERLINE() != null) {
				type = GridClause.GridClauseType.OVERLINE;
			} else {
				type = null;
			}

			result.setGridClauseType(type);

			gridClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public JustifiedClause addJustifiedClause(final ScreenDescriptionJustifiedClauseContext ctx) {
		JustifiedClause result = (JustifiedClause) getASGElement(ctx);

		if (result == null) {
			result = new JustifiedClauseImpl(programUnit, ctx);

			// type
			final JustifiedClause.Justified type;

			if (ctx.RIGHT() != null) {
				type = JustifiedClause.Justified.JUSTIFIED_RIGHT;
			} else {
				type = JustifiedClause.Justified.JUSTIFIED;
			}

			result.setJustified(type);

			justifiedClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public LightClause addLightClause(final ScreenDescriptionLightClauseContext ctx) {
		LightClause result = (LightClause) getASGElement(ctx);

		if (result == null) {
			result = new LightClauseImpl(programUnit, ctx);

			// type
			final LightClause.LightClauseType type;

			if (ctx.HIGHLIGHT() != null) {
				type = LightClause.LightClauseType.HIGHLIGHT;
			} else if (ctx.LOWLIGHT() != null) {
				type = LightClause.LightClauseType.LOWLIGHT;
			} else {
				type = null;
			}

			result.setLightClauseType(type);

			lightClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public LineNumberClause addLineNumberClause(final ScreenDescriptionLineClauseContext ctx) {
		LineNumberClause result = (LineNumberClause) getASGElement(ctx);

		if (result == null) {
			result = new LineNumberClauseImpl(programUnit, ctx);

			// type
			final LineNumberClause.LineNumberClauseType type;

			if (ctx.PLUS() != null) {
				type = LineNumberClause.LineNumberClauseType.PLUS;
			} else if (ctx.PLUSCHAR() != null) {
				type = LineNumberClause.LineNumberClauseType.PLUS;
			} else if (ctx.MINUSCHAR() != null) {
				type = LineNumberClause.LineNumberClauseType.MINUS;
			} else {
				type = LineNumberClause.LineNumberClauseType.EQUAL;
			}

			result.setLineNumberClauseType(type);

			// line number
			if (ctx.integerLiteral() != null) {
				final IntegerLiteral lineNumber = createIntegerLiteral(ctx.integerLiteral());
				result.setIntegerLiteral(lineNumber);
			}

			lineNumberClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public PictureClause addPictureClause(final ScreenDescriptionPictureClauseContext ctx) {
		PictureClause result = (PictureClause) getASGElement(ctx);

		if (result == null) {
			result = new PictureClauseImpl(programUnit, ctx);

			final PictureStringContext pictureString = ctx.pictureString();
			result.setPictureString(pictureString.getText());

			pictureClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public PromptClause addPromptClause(final ScreenDescriptionPromptClauseContext ctx) {
		PromptClause result = (PromptClause) getASGElement(ctx);

		if (result == null) {
			result = new PromptClauseImpl(programUnit, ctx);

			// character
			final ValueStmt characterValueStmt = createValueStmt(ctx.identifier(), ctx.literal());
			result.setCharacterValueStmt(characterValueStmt);

			// occurs
			if (ctx.screenDescriptionPromptOccursClause() != null) {
				result.addOccurs(ctx.screenDescriptionPromptOccursClause());
			}

			promptClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public RequiredClause addRequiredClause(final ScreenDescriptionRequiredClauseContext ctx) {
		RequiredClause result = (RequiredClause) getASGElement(ctx);

		if (result == null) {
			result = new RequiredClauseImpl(programUnit, ctx);

			// type
			final RequiredClause.RequiredClauseType type;

			if (ctx.REQUIRED() != null) {
				type = RequiredClause.RequiredClauseType.REQUIRED;
			} else if (ctx.EMPTY_CHECK() != null) {
				type = RequiredClause.RequiredClauseType.EMPTY_CHECK;
			} else {
				type = null;
			}

			result.setRequiredClauseType(type);

			requiredClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public ReverseVideoClause addReverseVideoClause(final ScreenDescriptionReverseVideoClauseContext ctx) {
		ReverseVideoClause result = (ReverseVideoClause) getASGElement(ctx);

		if (result == null) {
			result = new ReverseVideoClauseImpl(programUnit, ctx);

			result.setReverseVideo(true);

			reverseVideoClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public void addScreenDescriptionEntry(final ScreenDescriptionEntry screenDescriptionEntry) {
		final String name = screenDescriptionEntry.getName();

		screenDescriptionEntries.add(screenDescriptionEntry);
		screenDescriptionEntriesSymbolTable.put(getSymbol(name), screenDescriptionEntry);
	}

	@Override
	public SecureClause addSecureClause(final ScreenDescriptionSecureClauseContext ctx) {
		SecureClause result = (SecureClause) getASGElement(ctx);

		if (result == null) {
			result = new SecureClauseImpl(programUnit, ctx);

			// type
			final SecureClause.SecureClauseType type;

			if (ctx.SECURE() != null) {
				type = SecureClause.SecureClauseType.SECURE;
			} else if (ctx.NO_ECHO() != null) {
				type = SecureClause.SecureClauseType.NO_ECHO;
			} else {
				type = null;
			}

			result.setSecureClauseType(type);

			secureClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public SignClause addSignClause(final ScreenDescriptionSignClauseContext ctx) {
		SignClause result = (SignClause) getASGElement(ctx);

		if (result == null) {
			result = new SignClauseImpl(programUnit, ctx);

			// type
			final SignClause.SignClauseType type;

			if (ctx.LEADING() != null) {
				type = SignClause.SignClauseType.LEADING;
			} else if (ctx.TRAILING() != null) {
				type = SignClause.SignClauseType.TRAILING;
			} else {
				type = null;
			}

			result.setSignClauseType(type);

			signClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public SizeClause addSizeClause(final ScreenDescriptionSizeClauseContext ctx) {
		SizeClause result = (SizeClause) getASGElement(ctx);

		if (result == null) {
			result = new SizeClauseImpl(programUnit, ctx);

			final ValueStmt sizeValueStmt = createValueStmt(ctx.identifier(), ctx.integerLiteral());
			result.setSizeValueStmt(sizeValueStmt);

			sizeClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public UnderlineClause addUnderlineClause(final ScreenDescriptionUnderlineClauseContext ctx) {
		UnderlineClause result = (UnderlineClause) getASGElement(ctx);

		if (result == null) {
			result = new UnderlineClauseImpl(programUnit, ctx);

			result.setUnderline(true);

			underlineClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public UsageClause addUsageClause(final ScreenDescriptionUsageClauseContext ctx) {
		UsageClause result = (UsageClause) getASGElement(ctx);

		if (result == null) {
			result = new UsageClauseImpl(programUnit, ctx);

			// type
			final UsageClause.UsageClauseType type;

			if (ctx.DISPLAY() != null) {
				type = UsageClause.UsageClauseType.DISPLAY;
			} else if (ctx.DISPLAY_1() != null) {
				type = UsageClause.UsageClauseType.DISPLAY_1;
			} else {
				type = null;
			}

			result.setUsageClauseType(type);

			usageClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public UsingClause addUsingClause(final ScreenDescriptionUsingClauseContext ctx) {
		UsingClause result = (UsingClause) getASGElement(ctx);

		if (result == null) {
			result = new UsingClauseImpl(programUnit, ctx);

			if (ctx.identifier() != null) {
				final Call usingCall = createCall(ctx.identifier());
				result.setUsingCall(usingCall);
			}

			usingClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public ValueClause addValueClause(final ScreenDescriptionValueClauseContext ctx) {
		ValueClause result = (ValueClause) getASGElement(ctx);

		if (result == null) {
			result = new ValueClauseImpl(programUnit, ctx);

			if (ctx.literal() != null) {
				final Literal literal = createLiteral(ctx.literal());
				result.setLiteral(literal);
			}

			valueClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public ZeroFillClause addZeroFillClause(final ScreenDescriptionZeroFillClauseContext ctx) {
		ZeroFillClause result = (ZeroFillClause) getASGElement(ctx);

		if (result == null) {
			result = new ZeroFillClauseImpl(programUnit, ctx);

			result.setZeroFill(true);

			zeroFillClause = result;
			registerASGElement(result);
		}

		return result;
	}

	@Override
	public AutoClause getAutoClause() {
		return autoClause;
	}

	@Override
	public BackgroundColorClause getBackgroundColorClause() {
		return backgroundColorClause;
	}

	@Override
	public BellClause getBellClause() {
		return bellClause;
	}

	@Override
	public BlankClause getBlankClause() {
		return blankClause;
	}

	@Override
	public BlankWhenZeroClause getBlankWhenZeroClause() {
		return blankWhenZeroClause;
	}

	@Override
	public BlinkClause getBlinkClause() {
		return blinkClause;
	}

	@Override
	public List<ScreenDescriptionEntryCall> getCalls() {
		return calls;
	}

	@Override
	public ColumnNumberClause getColumnNumberClause() {
		return columnNumberClause;
	}

	@Override
	public ControlClause getControlClause() {
		return controlClause;
	}

	@Override
	public EraseClause getEraseClause() {
		return eraseClause;
	}

	@Override
	public Boolean getFiller() {
		return filler;
	}

	@Override
	public ForegroundColorClause getForegroundColorClause() {
		return foregroundColorClause;
	}

	@Override
	public FromClause getFromClause() {
		return fromClause;
	}

	@Override
	public FullClause getFullClause() {
		return fullClause;
	}

	@Override
	public GridClause getGridClause() {
		return gridClause;
	}

	@Override
	public JustifiedClause getJustifiedClause() {
		return justifiedClause;
	}

	@Override
	public Integer getLevelNumber() {
		return levelNumber;
	}

	@Override
	public LightClause getLightClause() {
		return lightClause;
	}

	@Override
	public LineNumberClause getLineNumberClause() {
		return lineNumberClause;
	}

	@Override
	public String getName() {
		return name;
	}

	@Override
	public ScreenDescriptionEntry getParentScreenDescriptionEntry() {
		return parentScreenDescriptionEntry;
	}

	@Override
	public PictureClause getPictureClause() {
		return pictureClause;
	}

	@Override
	public ScreenDescriptionEntry getPredecessor() {
		return predecessor;
	}

	@Override
	public PromptClause getPromptClause() {
		return promptClause;
	}

	@Override
	public RequiredClause getRequiredClause() {
		return requiredClause;
	}

	@Override
	public ReverseVideoClause getReverseVideoClause() {
		return reverseVideoClause;
	}

	@Override
	public List<ScreenDescriptionEntry> getScreenDescriptionEntries() {
		return screenDescriptionEntries;
	}

	@Override
	public ScreenDescriptionEntry getScreenDescriptionEntry(final String name) {
		return screenDescriptionEntriesSymbolTable.get(getSymbol(name));
	}

	@Override
	public SecureClause getSecureClause() {
		return secureClause;
	}

	@Override
	public SignClause getSignClause() {
		return signClause;
	}

	@Override
	public SizeClause getSizeClause() {
		return sizeClause;
	}

	@Override
	public ScreenDescriptionEntry getSuccessor() {
		return successor;
	}

	@Override
	public UnderlineClause getUnderlineClause() {
		return underlineClause;
	}

	@Override
	public UsageClause getUsageClause() {
		return usageClause;
	}

	@Override
	public UsingClause getUsingClause() {
		return usingClause;
	}

	@Override
	public ValueClause getValueClause() {
		return valueClause;
	}

	@Override
	public ZeroFillClause getZeroFillClause() {
		return zeroFillClause;
	}

	@Override
	public void setFiller(final Boolean filler) {
		this.filler = filler;
	}

	@Override
	public void setLevelNumber(final Integer levelNumber) {
		this.levelNumber = levelNumber;
	}

	@Override
	public void setParentScreenDescriptionEntry(final ScreenDescriptionEntry parentScreenDescriptionEntry) {
		this.parentScreenDescriptionEntry = parentScreenDescriptionEntry;
	}

	@Override
	public void setPredecessor(final ScreenDescriptionEntry predecessor) {
		this.predecessor = predecessor;
	}

	@Override
	public void setSuccessor(final ScreenDescriptionEntry successor) {
		this.successor = successor;
	}

	@Override
	public String toString() {
		return "name=[" + name + "]";
	}
}


text:
"""
Spyder Editor

This is a temporary script file.
"""

import sys;
sys.path.append("allinpay projects")
from imp import reload
import creditscore.creditscore
reload(creditscore.creditscore)
from creditscore.creditscore import CreditScore
import pandas as pd
import time
from sklearn.externals import joblib

class TLSWscoring(CreditScore):

    def __init__(self, dataname, label=None):
        super(TLSWscoring, self).__init__(dataname)
        self.dataname =  dataname
        self.label = label
        self.data = self.suanhuadata()

    def suanhuadata_raw(self):
        temp2001 = self.data_from_mysql('T_POSITION_2001')
        temp2001 = temp2001.drop(['status', 'successStatus', 'errors', 'insertTime', 'source'], axis = 1)
        temp3012 = self.data_from_mysql('T_MOBILE_CREDIT_3012')
        temp3012 = temp3012.drop(['status', 'successStatus', 'errors', 'insertTime', 'source'], axis = 1)
        temp5001 = self.data_from_mysql('T_CONSUMPTION_ACT_5001')
        temp5001 = temp5001.drop(['status', 'success', 'errors', 'insertTime', 'source', 'cot_score', 'cna_score'], axis = 1)
        temp5003 = self.data_from_mysql('T_CONSUMPTION_INFO_5003')
        temp5003 = temp5003.drop(['status', 'successStatus', 'errors', 'insertTime', 'source'], axis = 1)
        data = pd.merge(temp2001, temp3012)
        data = pd.merge(data, temp5001)
        data = pd.merge(data, temp5003)

        return data

    def suanhuadata(self):
        temp2001 = self.data_from_mysql('T_POSITION_2001')
        temp2001 = temp2001.drop_duplicates(['idCard'])
        data = temp2001[['name', 'idCard', 'mobileNum', 'sexId', 'maritalStatus', 'education', 'company']].copy()
        data['sexId'] = '1'
        data['maritalStatus'] = data['maritalStatus'].astype('object')
        data['education'] = data['education'].astype('object')
        data['age'] = 0

        for i in data.index:
            data.ix[i, 'phone3'] = str(data.ix[i, 'mobileNum'])[0:3]
            data.ix[i, 'age'] = time.localtime().tm_year - int(data.ix[i, 'idCard'][6:10])
            if int(data.ix[i, 'idCard'][(len(data.ix[i, 'idCard'])-2):(len(data.ix[i, 'idCard'])-1)]) % 2 == 0:
                data.ix[i, 'sexId'] = '2'
            if data.ix[i, 'company'] in ['NULL', '不详', '无', '无业', '待业人员' ]:
                data.ix[i, 'company'] = 0
            else:
                data.ix[i, 'company'] = 1

        '''
        temp3012 = self.data_from_mysql('T_MOBILE_CREDIT_3012')
        temp = temp3012[['idCard', 'mobileNum', 'isUseTime']].copy()
        temp['phone3'] = temp['mobileNum']
        for i in temp.index:
            temp.ix[i, 'phone3'] = str(temp.ix[i, 'phone3'])[0:3]
        data = pd.merge(temp, data)
        '''
        temp5003 = self.data_from_mysql('T_CONSUMPTION_INFO_5003')
        temp5003 = temp5003.drop_duplicates(['idCard'])
        temp = temp5003[['idCard', 'cardNum', 'MCC_6_var1', 'MON_6_var1', 'RFM_6_var1', 'RFM_6_var2', 'RFM_6_var3', 'RFM_6_var5', 'LOC_6_var11', \
                        'RFM_12_var30', 'RFM_12_var40', 'RFM_12_var47']].copy()
        temp['MCC_6_var1'] = pd.to_numeric(temp['MCC_6_var1'], errors='coerce')
        temp['MON_6_var1'] = pd.to_numeric(temp['MON_6_var1'], errors='coerce')
        temp['RFM_6_var1'] = pd.to_numeric(temp['RFM_6_var1'], errors='coerce')
        temp['RFM_6_var2'] = pd.to_numeric(temp['RFM_6_var2'], errors='coerce')
        temp['RFM_6_var3'] = pd.to_numeric(temp['RFM_6_var3'], errors='coerce')
        temp['RFM_6_var5'] = pd.to_numeric(temp['RFM_6_var5'], errors='coerce')
        temp['RFM_12_var30'] = pd.to_numeric(temp['RFM_12_var30'], errors='coerce')
        temp['RFM_12_var40'] = pd.to_numeric(temp['RFM_12_var40'], errors='coerce')
        temp['RFM_12_var47'] = pd.to_numeric(temp['RFM_12_var47'], errors='coerce')
        data = pd.merge(data, temp)

        temp5001 = self.data_from_mysql('T_CONSUMPTION_ACT_5001')
        temp5001 = temp5001.drop_duplicates(['idCard'])
        temp = temp5001[['idCard', 'cardNum', 'cst_score', 'cnp_score', 'cnt_score', 'chv_score', 'dsi_score', 'rsk_score']].copy()
        temp['dsi_score'] = pd.to_numeric(temp['dsi_score'], errors='coerce')
        temp['rsk_score'] = pd.to_numeric(temp['rsk_score'], errors='coerce')
        data = pd.merge(data, temp)

        fillna_value = pd.DataFrame({'name':'null'}, index=[0])
        for col in data.columns:
            if data[col].dtype == 'O':
                data[col] = data[col].fillna('null')
                fillna_value[col] = 'null'
            else:
                data[col] = data[col].fillna(data[col].mean())
                fillna_value[col] = data[col].mean()

        if self.label != None:#label==None 用于建模训练,label!=None用于保存生产模型
            joblib.dump(fillna_value, "allinpay projects\\creditscore_TLSW_fyz\\pkl\\fillna_value_" + self.label + '.pkl')

        return data

    def data_analysis(self):
        data = self.data
        temp = data[data['rsk_score'] < 9000]
        grouped = temp['rsk_score'].groupby(temp['education'])
        tempmean = pd.DataFrame(grouped.mean())
        tempmean.columns = ['rsk_mean']
        tempcount = pd.DataFrame(grouped.count())
        tempcount.columns = ['rsk_count']
        stat_education = pd.merge(tempmean, tempcount,left_index=True,right_index=True)
        stat_education = stat_education.sort_values(by = ['rsk_mean'], ascending = [0])

        temp = data[data['rsk_score'] < 9000]
        grouped = temp['rsk_score'].groupby(temp['sexId'])
        tempmean = pd.DataFrame(grouped.mean())
        tempmean.columns = ['rsk_mean']
        tempcount = pd.DataFrame(grouped.count())
        tempcount.columns = ['rsk_count']
        stat_sex = pd.merge(tempmean, tempcount,left_index=True,right_index=True)
        stat_sex = stat_sex.sort_values(by = ['rsk_mean'], ascending = [0])

        temp = data[data['rsk_score'] < 9000]
        grouped = temp['rsk_score'].groupby(temp['company'])
        tempmean = pd.DataFrame(grouped.mean())
        tempmean.columns = ['rsk_mean']
        tempcount = pd.DataFrame(grouped.count())
        tempcount.columns = ['rsk_count']
        stat_company = pd.merge(tempmean, tempcount,left_index=True,right_index=True)
        stat_company = stat_company.sort_values(by = ['rsk_mean'], ascending = [0])

        temp = data[data['rsk_score'] < 9000]
        grouped = temp['rsk_score'].groupby(temp['maritalStatus'])
        tempmean = pd.DataFrame(grouped.mean())
        tempmean.columns = ['rsk_mean']
        tempcount = pd.DataFrame(grouped.count())
        tempcount.columns = ['rsk_count']
        stat_marital = pd.merge(tempmean, tempcount,left_index=True,right_index=True)
        stat_marital = stat_marital.sort_values(by = ['rsk_mean'], ascending = [0])

        #data = self.data.copy()


text:
<?php

namespace Blanfordia\Visitors\Vendor\Laravel\Models;

class GeoIp extends Base {

	protected $table = 'visitors_geoip';

	protected $fillable = array(
		'country_code',
		'country_code3',
		'country_name',
		'region',
		'city',
		'postal_code',
		'latitude',
		'longitude',
		'area_code',
		'dma_code',
		'metro_code',
		'continent_code',
	);

}


text:
import _extends from "@babel/runtime/helpers/extends";
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["height", "style"];
import { createScopedElement } from "../../lib/jsxRuntime";
import * as React from "react";
import Spinner from "../Spinner/Spinner";

var PanelSpinner = function PanelSpinner(_ref) {
  var height = _ref.height,
      style = _ref.style,
      restProps = _objectWithoutProperties(_ref, _excluded);

  return createScopedElement(Spinner, _extends({
    size: "regular"
  }, restProps, {
    style: _objectSpread({
      height: height
    }, style)
  }));
};

PanelSpinner.defaultProps = {
  height: 96
}; // eslint-disable-next-line import/no-default-export

export default /*#__PURE__*/React.memo(PanelSpinner);
//# sourceMappingURL=PanelSpinner.js.map


text:
<?php
/**
 * Created by PhpStorm.
 * User: User
 * Date: 2/24/2015
 * Time: 12:18 PM
 */

namespace common\modules\tracking\widgets\driver;

use common\modules\reporting\widgets\assets\YiiAjaxFormSubmitAsset;
use common\modules\tracking\models\Driver;
use yii\base\Exception;
use yii\base\Widget;
use yii\helpers\Json;

class Registration extends Widget
{
    public $actionRoute;
    public $model;
    public $mapDivId;
    public $widgetId;
    public $clientOptions;
    public $juiDialogOptions;
    public $jqToggleBtnSelector;
    public $formId;
    public $jQueryFormSelector;
    public function  init()
    {
        if(!$this->actionRoute){
            throw new Exception(
                    'route to the action to which the form to be submitted must be specified! Example :: /girc/dmis/frontend/web/site/damage-create'
            );
        }
        $this->formId=($this->formId)?$this->formId:'formDamageCreate';
        $this->jQueryFormSelector = '#'.$this->formId;
        $this->widgetId=($this->widgetId)?$this->widgetId:$this->id;

        $this->clientOptions['formId']=$this->formId;
        $this->clientOptions['actionRoute']=$this->actionRoute;
        $this->clientOptions['widgetId']=$this->widgetId;
        $this->clientOptions['jqToggleBtnSelector']=$this->jqToggleBtnSelector;
        $this->clientOptions = Json::encode($this->clientOptions);
        $this->registerClientScripts();
    }

    public function run()
    {
        $this->model = new Driver();

        return $this->render('_form',
            [
                'model'=>$this->model,
                'formId'=>$this->formId,
                'jQueryFormSelector'=>$this->jQueryFormSelector,
                'actionRoute'=>$this->actionRoute,
                'widgetId'=>$this->widgetId,
                'jqToggleBtnSelector'=>$this->jqToggleBtnSelector,
                'clientOptions'=>$this->clientOptions,
            ]);

    }
    public function registerClientScripts(){
        \common\assets\YiiAjaxFormSubmitAsset::register($this->getView());
        $this->getView()->registerJs("$('#$this->widgetId').yiiAjaxFormWidget($this->clientOptions);", \yii\web\View::POS_READY);
    }
}


text:
package ca.uhn.fhir.rest.server;

import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

import org.apache.commons.io.IOUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.hl7.fhir.dstu3.model.IdType;
import org.hl7.fhir.dstu3.model.OperationOutcome;
import org.hl7.fhir.dstu3.model.Patient;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.rest.annotation.ConditionalUrlParam;
import ca.uhn.fhir.rest.annotation.Create;
import ca.uhn.fhir.rest.annotation.IdParam;
import ca.uhn.fhir.rest.annotation.OptionalParam;
import ca.uhn.fhir.rest.annotation.ResourceParam;
import ca.uhn.fhir.rest.annotation.Search;
import ca.uhn.fhir.rest.api.MethodOutcome;
import ca.uhn.fhir.util.PortUtil;

public class CustomTypeServerDstu3 {
	private static CloseableHttpClient ourClient;

	private static String ourLastConditionalUrl;
	private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(CustomTypeServerDstu3.class);
	private static int ourPort;
	private static Server ourServer;
	private static IdType ourLastId;
	private static IdType ourLastIdParam;
	private static boolean ourLastRequestWasSearch;
	private static FhirContext ourCtx = FhirContext.forDstu3();

	@Before
	public void before() {
		ourLastId = null;
		ourLastConditionalUrl = null;
		ourLastIdParam = null;
		ourLastRequestWasSearch = false;
	}

	@Test
	public void testCreateWithIdInBody() throws Exception {

		Patient patient = new Patient();
		patient.setId("2");
		patient.addIdentifier().setValue("002");

		HttpPost httpPost = new HttpPost("http://localhost:" + ourPort + "/Patient");
//		httpPost.addHeader(Constants.HEADER_IF_NONE_EXIST, "Patient?identifier=system%7C001");
		httpPost.setEntity(new StringEntity(ourCtx.newXmlParser().encodeResourceToString(patient), ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));

		HttpResponse status = ourClient.execute(httpPost);

		String responseContent = IOUtils.toString(status.getEntity().getContent());
		IOUtils.closeQuietly(status.getEntity().getContent());

		ourLog.info("Response was:\n{}", responseContent);

		assertEquals(400, status.getStatusLine().getStatusCode());
		OperationOutcome oo = ourCtx.newXmlParser().parseResource(OperationOutcome.class, responseContent);
		assertEquals("Can not create resource with ID \"2\", an ID element must not be supplied in the resource body on a create (POST) operation", oo.getIssue().get(0).getDiagnostics());
	}

	@Test
	public void testCreateWithIdInUrl() throws Exception {

		Patient patient = new Patient();
		patient.addIdentifier().setValue("002");

		HttpPost httpPost = new HttpPost("http://localhost:" + ourPort + "/Patient/2");
//		httpPost.addHeader(Constants.HEADER_IF_NONE_EXIST, "Patient?identifier=system%7C001");
		httpPost.setEntity(new StringEntity(ourCtx.newXmlParser().encodeResourceToString(patient), ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));

		HttpResponse status = ourClient.execute(httpPost);

		String responseContent = IOUtils.toString(status.getEntity().getContent());
		IOUtils.closeQuietly(status.getEntity().getContent());

		ourLog.info("Response was:\n{}", responseContent);

		assertEquals(400, status.getStatusLine().getStatusCode());
		OperationOutcome oo = ourCtx.newXmlParser().parseResource(OperationOutcome.class, responseContent);
		assertEquals("Can not create resource with ID \"2\", ID must not be supplied on a create (POST) operation (use an HTTP PUT / update operation if you wish to supply an ID)", oo.getIssue().get(0).getDiagnostics());
	}

	@Test
	public void testCreateWithIdInUrlForConditional() throws Exception {

		Patient patient = new Patient();
		patient.addIdentifier().setValue("002");

		HttpPost httpPost = new HttpPost("http://localhost:" + ourPort + "/Patient/2");
		httpPost.addHeader(Constants.HEADER_IF_NONE_EXIST, "Patient?identifier=system%7C001");
		httpPost.setEntity(new StringEntity(ourCtx.newXmlParser().encodeResourceToString(patient), ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));

		HttpResponse status = ourClient.execute(httpPost);

		String responseContent = IOUtils.toString(status.getEntity().getContent());
		IOUtils.closeQuietly(status.getEntity().getContent());

		ourLog.info("Response was:\n{}", responseContent);

		assertEquals(400, status.getStatusLine().getStatusCode());
		OperationOutcome oo = ourCtx.newXmlParser().parseResource(OperationOutcome.class, responseContent);
		assertEquals("Can not create resource with ID \"2\", ID must not be supplied on a create (POST) operation (use an HTTP PUT / update operation if you wish to supply an ID)", oo.getIssue().get(0).getDiagnostics());
	}

	@AfterClass
	public static void afterClass() throws Exception {
		ourServer.stop();
	}

	@BeforeClass
	public static void beforeClass() throws Exception {
		ourPort = PortUtil.findFreePort();
		ourServer = new Server(ourPort);

		PatientProvider patientProvider = new PatientProvider();

		ServletHandler proxyHandler = new ServletHandler();
		RestfulServer servlet = new RestfulServer(ourCtx);
		servlet.setResourceProviders(patientProvider);
		ServletHolder servletHolder = new ServletHolder(servlet);
		proxyHandler.addServletWithMapping(servletHolder, "/*");
		ourServer.setHandler(proxyHandler);
		ourServer.start();

		PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS);
		HttpClientBuilder builder = HttpClientBuilder.create();
		builder.setConnectionManager(connectionManager);
		ourClient = builder.build();

	}

	public static class PatientProvider implements IResourceProvider {

		@Override
		public Class<Patient> getResourceType() {
			return Patient.class;
		}

		@Search
		public List<IResource> search(@OptionalParam(name = "foo") StringDt theString) {
			ourLastRequestWasSearch = true;
			return new ArrayList<IResource>();
		}

		@Create()
		public MethodOutcome createPatient(@ResourceParam Patient thePatient, @ConditionalUrlParam String theConditional, @IdParam IdType theIdParam) {
			ourLastConditionalUrl = theConditional;
			ourLastId = thePatient.getIdElement();
			ourLastIdParam = theIdParam;
			return new MethodOutcome(new IdType("Patient/001/_history/002"));
		}

	}

}


text:
'use strict';

describe('ngTouchend', function () {

	var element;

	beforeEach(function () {
		module('ngTouchend');
	});

	it('should get called on touchend', inject(function($rootScope, $compile) {
		element =  $compile('

')($rootScope);
		$rootScope.$digest();
		expect($rootScope.ended).toBeUndefined();
		element.triggerHandler('touchstart');
		element.triggerHandler('touchend');
		expect($rootScope.ended).toEqual(true);
	}));
});


text:
  #!/usr/bin/python
# -*- coding: utf-8 -*-

# ---------------------------------------------------------------------
# Copyright (c) 2012 Michael Hull.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
#  - Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#  - Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in
#    the documentation and/or other materials provided with the
#    distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
#  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ----------------------------------------------------------------------

from morphforge.stdimports import units

class PostSynapticMech_ExpSyn_Base(object):
    def __init__(self, tau, e_rev, peak_conductance, **kwargs):
        super(PostSynapticMech_ExpSyn_Base, self).__init__( **kwargs)
        self._default_parameters = { 'tau':tau, 'e_rev':e_rev, 'peak_conductance':peak_conductance}

    @classmethod
    def get_variables(self,):
        return ['tau', 'e_rev', 'peak_conductance']

    @classmethod
    def get_preferred_unit(cls, varname):
        _units = {
                'tau': units.ms,
                'e_rev': units.mV,
                'peak_conductance': units.nS,
                }
        return _units[varname]

    def get_summary_description(self, instance):
        return "Exp1Syn"


text:
#include "stdafx.h"
#include "DebrisManager.h"
#include "DebrisZone.h"
#include "Debris.h"

DebrisManager* GDebrisManager = nullptr;

DebrisManager::DebrisManager()
{
	m_DebrisZoneList.fill( nullptr );
}

DebrisManager::~DebrisManager()
{
}

void DebrisManager::Init()
{
	// debris zone 초기화
	for ( int i = 0; i < DEBRIS_ZONE_NUMBER; ++i )
	{
		if ( m_DebrisZoneList[i] == nullptr )
			m_DebrisZoneList[i] = new DebrisZone();

		m_DebrisZoneList[i]->Init( i );
	}
}

void DebrisManager::Update( float dt )
{
	for ( int i = 0; i < DEBRIS_ZONE_NUMBER; ++i )
	{
		m_DebrisZoneList[i]->Update( dt );
	}
}

void DebrisManager::ChangeDebrisZone( Debris* debris, int prevZone, int newZone )
{
	// 모아놨다가 한 번에 처리???
}


text:
published: true
title: Google Launches IoT Developer Kit
layout: post
tags: [ioT, Q42, Google]
---
At [Q42](http://www.q42.com) we love IoT. So much so that we've created a [connected coffee counter](https://medium.com/q42bv/hacking-the-coffee-machine-5802172b17c1#.3995xcjyu), a [remote controller for our Phillips Hue office lights](https://medium.com/q42bv/control-our-office-lights-from-our-website-b4bb7342186d#.vafbs3m9e) and of course [connected toilets](https://medium.com/q42bv/happy-plees-voor-nerds-e03fcbf66e94#.7jo47wfis). Needless to say we were very excited when Google asked us to help them building their [IoT Developer Kit](https://cloud.google.com/solutions/iot/kit/).

![IoT Developer Prototyping Kit](https://www.seeedstudio.com/upload/image/20160913/1473731372346783.jpg)

## My First IoT

If you've always wanted to try this IoT thing but were overwhelmed by the options in terms of dev boards and cloud hostings, look no further.
Starting with a [Beagle Bone Green Wireless](https://beagleboard.org/green-wireless), a variant of the popular [Beagle Bone Black](https://beagleboard.org/black), you first add some sensors, like an accelerometer or a light sensor, and then you send that sensor data straight up into The Cloud. Once in the cloud, your data can be visualized in real-time on a webpage for example.
Easy duzzit!

So this kit, which has been available to developers worldwide for about a week now, will walk you through connecting the included sensors to the Internets. Which Internets? Well [Google's Cloud Platform](https://cloud.google.com/) of course :-)

## What's inside
If that has piqued your interest, here's what you'll find inside the kit:

![a look inside](https://statics3.seeedstudio.com/seeed/img/2016-06/8x2YakiOAIR9FrZ3wox1Vklh.jpg)

 - said Beagle Bone Green Wireless
 - 5 sensors: temperature, accelerometer, tilt, light, motion
 - buzzer
 - multi-color LED
 - 96x96 OLED screen
 - button
 - Grove cables
 - a Grove base cape

## Where to get it
You can [buy this puppy here](https://www.seeedstudio.com/item_detail.html?p_id=2684) and don't forget to drop us a note if you've built something with this kit. Happy hacking!

![IoT Developer Prototyping Kit](https://cloud.google.com/images/iot/iot-lead-graphic-2x.png)


text:
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class Form_NotifyIconKeeper
    Inherits System.Windows.Forms.Form

    'Form 重写 Dispose,以清理组件列表。
    <System.Diagnostics.DebuggerNonUserCode()>
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Windows 窗体设计器所必需的
    Private components As System.ComponentModel.IContainer

    '注意: 以下过程是 Windows 窗体设计器所必需的
    '可以使用 Windows 窗体设计器修改它。
    '不要使用代码编辑器修改它。
    <System.Diagnostics.DebuggerStepThrough()>
    Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container()
        Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form_NotifyIconKeeper))
        Me.NotifyIcon_Default = New System.Windows.Forms.NotifyIcon(Me.components)
        Me.ContextMenuStrip_Default = New System.Windows.Forms.ContextMenuStrip(Me.components)
        Me.ToolStripMenuItem_ShowHideDMJForm = New System.Windows.Forms.ToolStripMenuItem()
        Me.ToolStripMenuItem_RestartPlugin = New System.Windows.Forms.ToolStripMenuItem()
        Me.ToolStripMenuItem_StopPlugin = New System.Windows.Forms.ToolStripMenuItem()
        Me.ToolStripMenuItem_CheckUpd = New System.Windows.Forms.ToolStripMenuItem()
        Me.ToolStripMenuItem_ShowMgmtWindow = New System.Windows.Forms.ToolStripMenuItem()
        Me.ToolStripMenuItem_LeaveDMJ = New System.Windows.Forms.ToolStripMenuItem()
        Me.ContextMenuStrip_Default.SuspendLayout()
        Me.SuspendLayout()
        '
        'NotifyIcon_Default
        '
        Me.NotifyIcon_Default.ContextMenuStrip = Me.ContextMenuStrip_Default
        Me.NotifyIcon_Default.Icon = CType(resources.GetObject("NotifyIcon_Default.Icon"), System.Drawing.Icon)
        Me.NotifyIcon_Default.Text = "TTSDanmaku"
        Me.NotifyIcon_Default.Visible = True
        '
        'ContextMenuStrip_Default
        '
        Me.ContextMenuStrip_Default.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripMenuItem_ShowHideDMJForm, Me.ToolStripMenuItem_RestartPlugin, Me.ToolStripMenuItem_StopPlugin, Me.ToolStripMenuItem_CheckUpd, Me.ToolStripMenuItem_ShowMgmtWindow, Me.ToolStripMenuItem_LeaveDMJ})
        Me.ContextMenuStrip_Default.Name = "ContextMenuStrip_Default"
        Me.ContextMenuStrip_Default.Size = New System.Drawing.Size(235, 136)
        '
        'ToolStripMenuItem_ShowHideDMJForm
        '
        Me.ToolStripMenuItem_ShowHideDMJForm.Font = New System.Drawing.Font("Microsoft YaHei UI", 9.0!, System.Drawing.FontStyle.Bold)
        Me.ToolStripMenuItem_ShowHideDMJForm.Image = Global.TTSDanmaku.My.Resources.Resources.dmj
        Me.ToolStripMenuItem_ShowHideDMJForm.Name = "ToolStripMenuItem_ShowHideDMJForm"
        Me.ToolStripMenuItem_ShowHideDMJForm.Size = New System.Drawing.Size(234, 22)
        Me.ToolStripMenuItem_ShowHideDMJForm.Text = "显示 / 隐藏弹幕姬主窗口 (&D)"
        Me.ToolStripMenuItem_ShowHideDMJForm.ToolTipText = "显示或隐藏弹幕姬主窗口。"
        '
        'ToolStripMenuItem_RestartPlugin
        '
        Me.ToolStripMenuItem_RestartPlugin.Enabled = False
        Me.ToolStripMenuItem_RestartPlugin.Image = Global.TTSDanmaku.My.Resources.Resources.run
        Me.ToolStripMenuItem_RestartPlugin.Name = "ToolStripMenuItem_RestartPlugin"
        Me.ToolStripMenuItem_RestartPlugin.Size = New System.Drawing.Size(234, 22)
        Me.ToolStripMenuItem_RestartPlugin.Text = "重新启用插件 (&R)"
        Me.ToolStripMenuItem_RestartPlugin.ToolTipText = "重新启用插件。" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "此选项仅在启动插件一次后生效。"
        '
        'ToolStripMenuItem_StopPlugin
        '
        Me.ToolStripMenuItem_StopPlugin.Enabled = False
        Me.ToolStripMenuItem_StopPlugin.Image = Global.TTSDanmaku.My.Resources.Resources.stopplugin
        Me.ToolStripMenuItem_StopPlugin.Name = "ToolStripMenuItem_StopPlugin"
        Me.ToolStripMenuItem_StopPlugin.Size = New System.Drawing.Size(234, 22)
        Me.ToolStripMenuItem_StopPlugin.Text = "停用插件 (&Q)"
        Me.ToolStripMenuItem_StopPlugin.ToolTipText = "请求停用插件。"
        '
        'ToolStripMenuItem_CheckUpd
        '
        Me.ToolStripMenuItem_CheckUpd.Image = Global.TTSDanmaku.My.Resources.Resources.update
        Me.ToolStripMenuItem_CheckUpd.Name = "ToolStripMenuItem_CheckUpd"
        Me.ToolStripMenuItem_CheckUpd.Size = New System.Drawing.Size(234, 22)
        Me.ToolStripMenuItem_CheckUpd.Text = "检查更新 (&U)"
        '
        'ToolStripMenuItem_ShowMgmtWindow
        '
        Me.ToolStripMenuItem_ShowMgmtWindow.Font = New System.Drawing.Font("Microsoft YaHei UI", 9.0!)
        Me.ToolStripMenuItem_ShowMgmtWindow.Image = Global.TTSDanmaku.My.Resources.Resources.settings
        Me.ToolStripMenuItem_ShowMgmtWindow.Name = "ToolStripMenuItem_ShowMgmtWindow"
        Me.ToolStripMenuItem_ShowMgmtWindow.Size = New System.Drawing.Size(234, 22)
        Me.ToolStripMenuItem_ShowMgmtWindow.Text = "显示管理窗口 (&S)"
        Me.ToolStripMenuItem_ShowMgmtWindow.ToolTipText = "显示插件管理窗口。"
        '
        'ToolStripMenuItem_LeaveDMJ
        '
        Me.ToolStripMenuItem_LeaveDMJ.Image = Global.TTSDanmaku.My.Resources.Resources.warning
        Me.ToolStripMenuItem_LeaveDMJ.Name = "ToolStripMenuItem_LeaveDMJ"
        Me.ToolStripMenuItem_LeaveDMJ.Size = New System.Drawing.Size(234, 22)
        Me.ToolStripMenuItem_LeaveDMJ.Text = "退出弹幕姬 (&E)"
        Me.ToolStripMenuItem_LeaveDMJ.ToolTipText = "退出弹幕姬。"
        '
        'Form_NotifyIconKeeper
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 17.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.BackColor = System.Drawing.Color.White
        Me.ClientSize = New System.Drawing.Size(284, 61)
        Me.Font = New System.Drawing.Font("微软雅黑", 9.0!)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "Form_NotifyIconKeeper"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "TTSDanmaku NotifyIcon Keeper"
        Me.ContextMenuStrip_Default.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

    Friend WithEvents NotifyIcon_Default As Windows.Forms.NotifyIcon
    Friend WithEvents ContextMenuStrip_Default As Windows.Forms.ContextMenuStrip
    Friend WithEvents ToolStripMenuItem_ShowMgmtWindow As Windows.Forms.ToolStripMenuItem
    Friend WithEvents ToolStripMenuItem_LeaveDMJ As Windows.Forms.ToolStripMenuItem
    Friend WithEvents ToolStripMenuItem_ShowHideDMJForm As Windows.Forms.ToolStripMenuItem
    Friend WithEvents ToolStripMenuItem_RestartPlugin As Windows.Forms.ToolStripMenuItem
    Friend WithEvents ToolStripMenuItem_StopPlugin As Windows.Forms.ToolStripMenuItem
    Friend WithEvents ToolStripMenuItem_CheckUpd As Windows.Forms.ToolStripMenuItem
End Class


text:
<?php

namespace wott\BackBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class wottBackBundle extends Bundle
{
}


text:
using System;
using System.Xml;

namespace StructureMap.Configuration.Xml
{
    public static class XmlExtensions
    {
        public static string GetAttribute(this XmlNode node, string attributeName, string defaultValue)
        {
            XmlNode attribute = node.Attributes.GetNamedItem(attributeName);
            return attribute == null ? defaultValue : attribute.InnerText;
        }

        public static XmlTextExpression ForTextInChild(this XmlNode node, string xpath)
        {
            return new XmlTextExpression(node, xpath);
        }

        public static XmlNodeExpression ForEachChild(this XmlNode node, string xpath)
        {
            return new XmlNodeExpression(node, xpath);
        }

        public static void ForAttributeValue(this XmlNode node, string attributeName, Action<string> action)
        {
            XmlNode attNode = node.Attributes.GetNamedItem(attributeName);
            if (attNode != null)
            {
                action(attNode.InnerText);
            }
        }

        public static HasXmlElementExpression IfHasNode(this XmlNode node, string xpath)
        {
            return new HasXmlElementExpression(node, xpath);
        }

        #region Nested type: HasXmlElementExpression

        public class HasXmlElementExpression
        {
            private readonly XmlElement _element;

            internal HasXmlElementExpression(XmlNode parent, string xpath)
            {
                _element = (XmlElement)parent.SelectSingleNode(xpath);
            }

            public HasXmlElementExpression Do(Action<XmlElement> action)
            {
                if (_element != null)
                {
                    action(_element);
                }

                return this;
            }

            public void Else(Action action)
            {
                if (_element == null)
                {
                    action();
                }
            }
        }

        #endregion

        #region Nested type: XmlNodeExpression

        public class XmlNodeExpression
        {
            private readonly XmlNodeList _list;

            internal XmlNodeExpression(XmlNode parent, string xpath)
            {
                _list = parent.SelectNodes(xpath);
            }

            public void Do(Action<XmlElement> action)
            {
                if (_list == null) return;

                foreach (XmlNode node in _list)
                {
                    action((XmlElement)node);
                }
            }
        }

        #endregion

        #region Nested type: XmlTextExpression

        public class XmlTextExpression
        {
            private readonly XmlNodeList _list;

            internal XmlTextExpression(XmlNode parent, string attributePath)
            {
                _list = parent.SelectNodes(attributePath);
            }

            public void Do(Action<string> action)
            {
                if (_list == null) return;

                foreach (XmlNode node in _list)
                {
                    action(node.InnerText);
                }
            }
        }

        #endregion
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      tools:keep="@menu/activator_top_bar">
    <item android:id="@+id/menu_restart_events"
          android:title="@string/menu_restart_events"
          android:orderInCategory="100"
          app:showAsAction="always|withText"
          android:icon="?attr/actionEventsRestartIcon"
          tools:ignore="AlwaysShowAction"/>
    <item android:id="@+id/menu_edit_profiles"
          android:title="@string/menu_edit_profiles"
          android:orderInCategory="110"
          app:showAsAction="always|withText"
          android:icon="?attr/actionEditProfilesIcon"
          tools:ignore="AlwaysShowAction" />
</menu>


text:
package com.linkcld.toms.common.utils.excel.utils;

import com.linkcld.toms.common.utils.excel.bean.ExcelColBean;
import com.linkcld.toms.common.utils.excel.exception.ImportExcelException;
import com.linkcld.toms.common.utils.excel.utils.anno.ExcelSupport;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.util.StringUtils;

import javax.mail.internet.MimeUtility;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.net.URLEncoder;
import java.text.ParseException;
import java.util.*;

/**
 * @Description: Excel导入导出辅助工具类
 * @package: com.beyond.transafemrg.common.utils.
 * Created by ll_wang on 16/4/1.
 */
public class ExcelUtils {
    /**
     * 设置下载文件中文件的名称
     *
     * @param filename
     * @param request
     * @return
     */
    public static String encodeFilename(String filename, HttpServletRequest request) {
        /**
         * 获取客户端浏览器和操作系统信息
         * 在IE浏览器中得到的是:User-Agent=Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon; Alexa Toolbar)
         * 在Firefox中得到的是:User-Agent=Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.7.10) Gecko/20050717 Firefox/1.0.6
         */
        String agent = request.getHeader("USER-AGENT");
        try {
            if ((agent != null) && (-1 != agent.indexOf("MSIE"))) {
                String newFileName = URLEncoder.encode(filename, "UTF-8");
                newFileName = StringUtils.replace(newFileName, "+", "%20");
                if (newFileName.length() > 150) {
                    newFileName = new String(filename.getBytes("GB2312"), "ISO8859-1");
                    newFileName = StringUtils.replace(newFileName, " ", "%20");
                }
                return newFileName;
            }
            if ((agent != null) && (-1 != agent.indexOf("Mozilla")))
                return MimeUtility.encodeText(filename, "UTF-8", "B");

            return filename;
        } catch (Exception ex) {
            return filename;
        }
    }

    /**
     * 解析注解
     * @param obj
     * @return
     */
    public static List<ExcelColBean> resolveAnno(Object obj) {
        ExcelSupport anno = null;
        List<ExcelColBean> beans = new ArrayList<ExcelColBean>();
        ExcelColBean col = null;
        Class clazz = obj.getClass();
        Field[] fields = clazz.getDeclaredFields();
        for(Field field : fields) {
            col = new ExcelColBean();
            anno = field.getDeclaredAnnotation(ExcelSupport.class);
            if (anno != null && anno.use()) {
                col.setName(field.getName());
                col.setTitle(anno.name());
                col.setSort(anno.sort());
                col.setWidth(anno.cellWidth());
                col.setWrap(anno.wrap());
                col.setCode(anno.code());
                col.setFormat(anno.format());
                beans.add(col);
            }
        }

        // 对列表排序
        Collections.sort(beans, new Comparator<ExcelColBean>() {
            public int compare(ExcelColBean arg0, ExcelColBean arg1) {
                int hits0 = arg0.getSort();
                int hits1 = arg1.getSort();
                if (hits1 > hits0) {
                    return -1;
                } else if (hits1 == hits0) {
                    return 0;
                } else {
                    return 1;
                }
            }
        });
        return beans;
    }

    /**
     *  字段名转换为方法名
     * @param field 字段
     * @param prefix 前缀
     * @param suffix 后缀
     * @return
     */
    public static String strToMethod(String field, String prefix, String suffix) {
        field = toUpperCaseFirstOne(field);
        return prefix + field + suffix;
    }
    public static String strToMethod(String field, String prefix) {
        return strToMethod(field, prefix, "");
    }

    //首字母转大写
    public static String toUpperCaseFirstOne(String s) {
        if(Character.isUpperCase(s.charAt(0)))
            return s;
        else
            return (new StringBuilder()).append(Character.toUpperCase(s.charAt(0))).append(s.substring(1)).toString();
    }

    //集合中是否有名为methodStr的方法名
    public static boolean clazzHasMethod(Method[] methods, String methodStr) {
        for(Method method : methods) {
            if (method.getName().equals(methodStr)) {
                return true;
            }
        }
        return false;
    }

    /**
     * 从编码表中获取对应的值
     * @param codes 集合
     * @param field 字段对应的编码表
     * @param value 字符串对应的编码
     * @return
     */
    public static String getBmCode(Map<String,List<Map<String,Object>>> codes, String field, String value) {
        List<Map<String,Object>> bmCode = codes.get(field);
        if (field == null) {
            field = "";
        }
        if (bmCode != null) {
            for (Map<String,Object> code: bmCode) {
                if (value.equals(code.get("code"))) {
                    return (String) code.get("text");
                }
            }
        }
        return value;
    }

    /**
     * 从编码表中获取对应的值
     * @param codes 集合
     * @param field 字段对应的编码表
     * @param value 字符串对应的编码
     * @return
     */
    public static String getBmText(Map<String,List<Map<String,Object>>> codes, String field, String value) {
        List<Map<String,Object>> bmCode = codes.get(field);
        if (field == null) {
            field = "";
        }
        if (bmCode != null) {
            for (Map<String,Object> code: bmCode) {
                if (value.equals(code.get("text"))) {
                    return (String) code.get("code");
                }
            }
        }
        return value;
    }

    public static String dateFormat() {

        return null;
    }

    /**
     * 获取单元格对应的值
     * @param cell
     * @return
     */
    public static String getCellStringValue(HSSFCell cell) {
        String cellValue = "";
        switch (cell.getCellType()) {
            case HSSFCell.CELL_TYPE_STRING://字符串类型
                cellValue = cell.getStringCellValue();
                if (cellValue.trim().equals("") || cellValue.trim().length() <= 0)
                    cellValue = "";
                break;
            case HSSFCell.CELL_TYPE_NUMERIC: //数值类型
                cellValue = String.valueOf(cell.getNumericCellValue());
                break;
            case HSSFCell.CELL_TYPE_FORMULA: //公式
                cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
                cellValue = String.valueOf(cell.getNumericCellValue());
                break;
            case HSSFCell.CELL_TYPE_BLANK:
                cellValue = " ";
                break;
            case HSSFCell.CELL_TYPE_BOOLEAN:
                break;
            case HSSFCell.CELL_TYPE_ERROR:
                break;
            default:
                break;
        }
        return cellValue;
    }

    /**
     * 将字符串转换为制定的类型
     * @param value
     * @param type
     * @return
     */
    public static Object getValueType(String value, Type type) {
        if (value != null) {
            value = value.trim();
        } else {
            value = "";
        }

        try {
            if (type == String.class) {
                return value;
            } else if (type == Integer.class && !"".equals(value)) {
                return Integer.parseInt(value);
            } else if (type == Short.class && !"".equals(value)) {
                return Short.parseShort(value);
            } else if (type == Long.class && !"".equals(value)) {
                return Long.parseLong(value);
            } else if (type == Double.class && !"".equals(value)) {
                return Double.parseDouble(value);
            } else if (type == Float.class && !"".equals(value)) {
                return Float.parseFloat(value);
            } else if (type == Date.class) {
                //TODO : 日期处理
                try {
                    if (value != null && !"".equals(value)) {
                        return DateUtils.parseDate(value, new String[]{"yyyy-MM-dd HH:mm:ss"});
                    }
                } catch (ParseException e) {
                    e.printStackTrace();
                }
            } else if (type == Boolean.class) {
                return Boolean.parseBoolean(value);
            }
        }catch(Exception e) {
            return null;
        }

        return null;
    }

    /**
     * 将字符串转换为制定的类型
     * @param type
     * @return
     */
    public static Class<?> type2Clazz(Type type) {
        if (type == String.class) {
            return String.class;
        } else if (type == Integer.class) {
            return Integer.class;
        } else if (type == Short.class) {
            return Short.class;
        } else if (type == Long.class) {
            return Long.class;
        } else if (type == Double.class) {
            return Double.class;
        } else if (type == Float.class) {
            return Float.class;
        } else if (type == Date.class) {
            return Date.class;
        } else if (type == Boolean.class) {
            return Boolean.class;
        }
        return null;
    }

    /**
     * 将excel文件读取到list中
     * @author ll_wang
     * @param inputStream excel文件流
     * @param clazz 需操作的对象类型
     * @return
     * @throws IOException
     */
    public static List<Object> excelToList(InputStream inputStream, Class clazz, Map<String,List<Map<String,Object>>> codes) throws IOException, ImportExcelException {
        HSSFWorkbook hssfWorkbook = new HSSFWorkbook(inputStream);
        List<Object> beans = new ArrayList<Object>();
        ExcelSupport anno = null;
        Field[] fields = clazz.getDeclaredFields();
        Method[] methods = clazz.getDeclaredMethods();
        Method method = null;
        Object bean;
        HSSFRow hssfRow = null;
        HSSFCell brandIdHSSFCell = null;
        String value = "", fieldName = "";
        Type fieldType = null;
        List<Object> fieldArr, annoArr, useArr = new ArrayList<Object>();//创建字段数组和注解数组,以便最佳解析
        if(hssfWorkbook.getNumberOfSheets() == 0) {
            throw new ImportExcelException("没找到工作薄");
        }
        //循环工作薄
        for (int numSheet = 0; numSheet < hssfWorkbook.getNumberOfSheets(); numSheet++) {
            HSSFSheet hssfSheet = hssfWorkbook.getSheetAt(numSheet);
            if (hssfSheet == null) {
                continue;
            }
            if(hssfSheet.getLastRowNum() == 0) {
                throw new ImportExcelException("工作薄:" + hssfSheet.getSheetName() + ",没有内容");
            }
            // 循环行Row
            for (int rowNum = 0; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
                hssfRow = hssfSheet.getRow(rowNum);
                //获取第一行标题字段
                if (rowNum == 0) {
                    fieldArr = new ArrayList<Object>();
                    annoArr = new ArrayList<Object>();
                    for (int i = 0; i < hssfRow.getLastCellNum(); i++) {
                        value = getCellStringValue(hssfRow.getCell(i));
                        for (Field field : fields) {
                            anno = field.getDeclaredAnnotation(ExcelSupport.class);
                            fieldName = field.getName();
                            fieldType = field.getType();
                            if (fieldName.equals(value)) {
                                fieldArr.add(new Object[]{fieldName, fieldType});
                            }
                            if (anno != null && value.equals(anno.name())) {
                                annoArr.add(new Object[]{fieldName, fieldType, anno.code()});
                            }
                        }
                    }

                    //按匹配到字段较多的方式进行解析
                    if (fieldArr.size() > annoArr.size()) {
                        useArr = new ArrayList<Object>(Arrays.asList(new String[fieldArr.size()]));
                        Collections.copy(useArr, fieldArr);
                    } else {
                        useArr = new ArrayList<Object>(Arrays.asList(new String[annoArr.size()]));
                        Collections.copy(useArr, annoArr);
                    }
                    if(useArr.size() == 0) {
                        throw new ImportExcelException("该工作薄没有首行字段行");
                    }
                    continue;
                }
                try {
                    bean = clazz.newInstance();
                    //类反射实例对象
                    try {
                        for (int j = 0; j < useArr.size(); j ++) {
                            brandIdHSSFCell = hssfRow.getCell(j);
                            value = getCellStringValue(brandIdHSSFCell);
                            Object[] field = (Object[])useArr.get(j);
                            String methodStr = strToMethod((String)field[0], "set");
                            //反编码
                            if (field.length == 3 && (Boolean)field[2]) {
                                value = getBmText(codes, (String)field[0], value);
                            }
                            if(clazzHasMethod(methods, methodStr)) {
                                method = clazz.getDeclaredMethod(methodStr, type2Clazz((Type)field[1]));
                                method.invoke(bean, getValueType(value, (Type)field[1]));
                            } else if (clazzHasMethod(methods, (String)field[0])) {
                                method = clazz.getDeclaredMethod((String) field[0], type2Clazz((Type) field[1]));
                                method.invoke(bean, getValueType(value, (Class) field[1]));
                            } else if (clazzHasMethod(methods, "set" + field[0])) {
                                method = clazz.getDeclaredMethod("set" + field[0], type2Clazz((Type) field[1]));
                                method.invoke(bean, getValueType(value, (Class) field[1]));
                            }
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                        throw new ImportExcelException(rowNum + "行,字段:" + method + "的值:"+ value +"有误");
                    }
                    beans.add(bean);
                } catch (InstantiationException e) {
                    e.printStackTrace();
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }

            }
        }

        return beans;
    }

    public static void main(String[] args) {
        System.out.println(strToMethod("wangll", "get"));
    }

}


text:
<feed version="0.3" xmlns="http://purl.org/atom/ns#" xml:base="http://example.com/parent/">
<entry>
  <title type="application/xhtml+xml" xml:base="http://example.com/test/">
Example test
</title>

blah blah blah

</entry>
</feed>


text:
// Copyright 2004-present Facebook. All Rights Reserved.

package com.instagram.common.json.annotation.processor.uut;

import com.instagram.common.json.annotation.JsonField;
import com.instagram.common.json.annotation.JsonType;

import static com.instagram.common.json.annotation.JsonField.TypeMapping.*;

/**
 * UUT for testing the {@link JsonField.TypeMapping#EXACT} mapping.
 */
@JsonType
public class ExactMappingUUT {
  public static final String BOOLEAN_FIELD_NAME = "boolean";
  public static final String BOOLEAN_OBJ_FIELD_NAME = "Boolean";
  public static final String INT_FIELD_NAME = "int";
  public static final String INTEGER_FIELD_NAME = "Integer";
  public static final String LONG_FIELD_NAME = "long";
  public static final String LONG_OBJ_FIELD_NAME = "Long";
  public static final String FLOAT_FIELD_NAME = "float";
  public static final String FLOAT_OBJ_FIELD_NAME = "Float";
  public static final String DOUBLE_FIELD_NAME = "double";
  public static final String DOUBLE_OBJ_FIELD_NAME = "Double";
  public static final String STRING_FIELD_NAME = "String";

  @JsonField(fieldName = BOOLEAN_FIELD_NAME, mapping = EXACT)
  public boolean booleanField;

  @JsonField(fieldName = BOOLEAN_OBJ_FIELD_NAME, mapping = EXACT)
  public Boolean BooleanField;

  @JsonField(fieldName = INT_FIELD_NAME, mapping = EXACT)
  public int intField;

  @JsonField(fieldName = INTEGER_FIELD_NAME, mapping = EXACT)
  public Integer IntegerField;

  @JsonField(fieldName = LONG_FIELD_NAME, mapping = EXACT)
  public long longField;

  @JsonField(fieldName = LONG_OBJ_FIELD_NAME, mapping = EXACT)
  public Long LongField;

  @JsonField(fieldName = FLOAT_FIELD_NAME, mapping = EXACT)
  public float floatField;

  @JsonField(fieldName = FLOAT_OBJ_FIELD_NAME, mapping = EXACT)
  public Float FloatField;

  @JsonField(fieldName = DOUBLE_FIELD_NAME, mapping = EXACT)
  public double doubleField;

  @JsonField(fieldName = DOUBLE_OBJ_FIELD_NAME, mapping = EXACT)
  public Double DoubleField;

  @JsonField(fieldName = STRING_FIELD_NAME, mapping = EXACT)
  public String StringField;
}


text:
const p1 = Promise.resolve({id: 1})
p1.then(result => console.log(result))

const p2 = Promise.reject(new Error('Reason for rejection'))
p2.catch(err => console.log(err))

const p3 = new Promise(resolve => {
	setTimeout(() => {
		console.log('Async operation 1...')
		resolve(1)
	}, 3000)
})

const p4 = new Promise(resolve => {
	setTimeout(() => {
		console.log('Async operation 2...')
		resolve(2)
	}, 2000)
})

Promise.all([p1, p2, p3, p4])
	.then(result => console.log(result))
	.catch(err => console.log(err))

Promise.race([p1, p2, p3, p4])
	.then(result => console.log(result))
	.catch(err => console.log(err))


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="org.mybatis.weigao.persistence.CustomerMapper">

    <cache/>

    <select id="getCustomer" parameterType="Customer" resultType="Customer">
        SELECT CUST.uid
        ,CUST.IsSelect
        ,CUST.IsDisable
        ,CUST.Creator
        ,CUST.CreationDate
        ,CUST.Operator
        ,CUST.OperDate
        ,CUST.CUSTOMER as customerName
        ,CUST.ZECT
        ,CUST.Coop_Type
        ,CUST.CustVAL
        ,CUST.Feedback
        ,CUST.Address
        ,CUST.Website
        ,CUST.HealthClass
        ,CUST.HealtMemo
        ,CUST.Hierarchy
        ,CUST.Open_DT
        ,CUST.Coop_DT
        ,CUST.PortID
        ,CUST.Clerk
        ,CUST.SalesRegion
        ,CUST.LabOffice
        ,CUST.LabOMemo
        ,CUST.LabTEL
        ,CUST.HospitalMemo
        ,CUST.PostalCode
        ,CUST.IsActive
        ,CUST.IsDirect
        ,CUST.ChargeLimit
        ,CUST.IsVerify
        ,CUST.Verifier
        ,CUST.VerifyDate
        ,P1.Port, P1.ProvinceID, P2.Province
        FROM [WEGO].[dbo].[bCUSTOMER] AS CUST LEFT OUTER JOIN
        dbo.b0Port AS P1 ON CUST.PortID = P1.UID LEFT OUTER JOIN
        dbo.b0Province AS P2 ON P1.ProvinceID = P2.UID
        WHERE 1=1
        <if test="customerName != null">
            AND CUST.CUSTOMER like '%'+#{customerName}+'%'
        </if>
        <if test="salesRegion != null">
            AND CUST.salesRegion like '%'+#{salesRegion}+'%'
        </if>
        <if test="clerk != null">
            AND CUST.clerk like '%'+#{clerk}+'%'
        </if>
        <if test="port != null">
            AND port like '%'+#{port}+'%'
        </if>
        <if test="uid != 0">
                    AND CUST.uid =#{uid}
                </if>
    </select>

    <update id="updateCustomer" parameterType="Customer">
               UPDATE dbo.bCUSTOMER
               SET
                  Creator = #{creator},
                  CreationDate = #{creationDate},
                  Operator = #{operator},
                  OperDate = #{operDate},
                  Customer = #{customerName},
                  ZECT = #{zect},
                  Coop_Type = #{coopType},
                  CustVAL = #{custVal} ,
                  Feedback = #{feedback},
                  Address = #{address} ,
                  Website = #{website},
                  HealthClass = #{healthClass},
                  HealtMemo = #{healtMemo},
                  Hierarchy = #{hierarchy},
                  Open_DT =  #{openDt} ,
                  Coop_DT = #{coop_DT} ,
                  PortID = #{portID},
                  Clerk = #{clerk},
                  SalesRegion = #{salesRegion},
                  LabOffice = #{labOffice},
                  LabOMemo =  #{labOMemo},
                  LabTEL = #{labTEL},
                  HospitalMemo = #{hospitalMemo},
                  PostalCode = #{postalCode},
                  IsActive = #{active},
                  IsDirect = #{direct},
                  ChargeLimit = #{chargeLimit},
                  Verifier = #{verifier},
                  VerifyDate = #{verifyDate}
               WHERE UID = #{uid}
           </update>

</mapper>


text:
package codesum.lm.topicsum;

import java.io.File;
import java.io.Serializable;
import java.util.List;

import org.apache.commons.io.FileUtils;

import com.esotericsoftware.kryo.DefaultSerializer;
import com.esotericsoftware.kryo.serializers.CompatibleFieldSerializer;

@DefaultSerializer(CompatibleFieldSerializer.class)
public class Cluster implements Serializable {

	private static final long serialVersionUID = -5437190745303350925L;
	private final File clusterLoc;

	private final Document[] docs;
	private int ndocs;

	public Cluster(final File f, final Tokens alphabet) {

		clusterLoc = f;
		ndocs = 0;

		docs = new Document[getFilesInCluster(null).size()];

		getDocs(alphabet);
	}

	private void getDocs(final Tokens alphabet) {
		final List<File> files = getFilesInCluster(null);

		int i=0;
		int total = files.size();
		//for (int i = 0; i < clusterLoc.listFiles().length; i++) {

		for(File file : files){
			if (i % 100 == 0)
				System.out.println("At file " + i + " of " + total);

			// if the file is not a hidden file (shouldn't need this)
			if (file.getName().charAt(0) != '.'
					&& file.getName().charAt(
							file.getName().length() - 1) != '~') {
				docs[i] = new Document(file, alphabet);
				ndocs++;
			}
			i++;
		}
	}

	private List<File> getFilesInCluster(String[] extns) {
		if(extns == null){
			extns = new String[] { "java" };
		}
		// Get all files with extn extension in the cluster
		final List<File> files = (List<File>) FileUtils.listFiles(clusterLoc, extns, true);
		return files;
	}

	public int ndocs() {
		return ndocs;
	}

	public Document getDoc(final int d) {
		return docs[d];
	}

	public String getName() {
		return clusterLoc.getName();
	}

	public int getIndexDoc(final String filePath) {

		for (int di = 0; di < ndocs; di++) {
			//Just check if the relative filepath of a java file
			// is a subset of the token document location.
			if ((docs[di].getDocLoc().getPath().contains(filePath)))
				return di;
		}
		return -1;

	}

}


text:
<?php
// Your database login details go here i.e. database server name, database username, user password to database, and the database name
$db_conx = mysqli_connect("localhost", "db_username", "db_password", "db_name");
// Noew lets evaluate the connection
if (mysqli_connect_errno()) {
	echo mysqli_connect_error();
	exit();
} // else {
//	echo "Sucessfully connected to the database.  Now lets code!!!!!";
// }
?>


text:
<!DOCTYPE HTML>

  <title>Test for Bug 419132</title>

  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>

Mozilla Bug 419132