text:
package com.netflix.evcache.operation;

import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.util.List;
import java.util.concurrent.CancellationException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicReference;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.netflix.evcache.EVCacheGetOperationListener;
import com.netflix.evcache.metrics.EVCacheMetricsFactory;
import com.netflix.evcache.pool.ServerGroup;
import com.netflix.servo.annotations.DataSourceType;
import com.netflix.servo.monitor.Stopwatch;
import com.sun.management.GcInfo;

import net.spy.memcached.MemcachedConnection;
import net.spy.memcached.internal.CheckedOperationTimeoutException;
import net.spy.memcached.internal.OperationFuture;
import net.spy.memcached.ops.Operation;
import rx.Scheduler;
import rx.Single;

/**
 * Managed future for operations.
 *
 *

 * From an OperationFuture, application code can determine if the status of a
 * given Operation in an asynchronous manner.
 *
 *

 * If for example we needed to update the keys "user:<userid>:name",
 * "user:<userid>:friendlist" because later in the method we were going to
 * verify the change occurred as expected interacting with the user, we can fire
 * multiple IO operations simultaneously with this concept.
 *
 * @param <T>
 *            Type of object returned from this future.
 */
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings("EXS_EXCEPTION_SOFTENING_HAS_CHECKED")
public class EVCacheOperationFuture<T> extends OperationFuture<T> {

    private Logger log = LoggerFactory.getLogger(EVCacheOperationFuture.class);

    private final CountDownLatch latch;
    private final AtomicReference<T> objRef;
    private Operation op;
    private final String appName;
    private final ServerGroup serverGroup;
    private final String key;
    private final String metricName;

    public EVCacheOperationFuture(String k, CountDownLatch l, AtomicReference<T> oref, long opTimeout, ExecutorService service, String appName, ServerGroup serverGroup) {
        this(k, l, oref, opTimeout, service, appName, serverGroup, null);
    }

    public EVCacheOperationFuture(String k, CountDownLatch l, AtomicReference<T> oref, long opTimeout, ExecutorService service, String appName, ServerGroup serverGroup, String metricName) {
        super(k, l, oref, opTimeout, service);
        this.latch = l;
        this.objRef = oref;
        this.appName = appName;
        this.serverGroup = serverGroup;
        this.key = k;
        this.metricName = metricName;
    }

    public Operation getOperation() {
        return this.op;
    }

    public void setOperation(Operation to) {
        this.op = to;
        super.setOperation(to);
    }

    public String getApp() {
        return appName;
    }

    public String getKey() {
        return key;
    }

    public String getZone() {
        return (serverGroup == null ? "NA" : serverGroup.getZone());
    }

    public ServerGroup getServerGroup() {
        return serverGroup;
    }

    public EVCacheOperationFuture<T> addListener(EVCacheGetOperationListener<T> listener) {
        super.addToListeners(listener);
        return this;
    }

    public EVCacheOperationFuture<T> removeListener(EVCacheGetOperationListener<T> listener) {
        super.removeFromListeners(listener);
        return this;
    }

    /**
     * Get the results of the given operation.
     *
     * As with the Future interface, this call will block until the results of
     * the future operation has been received.
     *
     * Note: If we detect there was GC pause and our operation was caught in
     * between we wait again to see if we will be successful. This is effective
     * as the timeout we specify is very low.
     *
     * @param duration
     *            amount of time to wait
     * @param units
     *            unit of time to wait
     * @param if
     *            exeception needs to be thrown of null returned on a failed
     *            operation
     * @param has
     *            zone fallback
     * @return the operation results of this OperationFuture
     * @throws InterruptedException
     * @throws TimeoutException
     * @throws ExecutionException
     */
    public T get(long duration, TimeUnit units, boolean throwException, boolean hasZF) throws InterruptedException, TimeoutException, ExecutionException {
        final long startTime = System.currentTimeMillis();
        final Stopwatch operationDuration = EVCacheMetricsFactory.getStatsTimer(appName, serverGroup, (metricName == null) ? "GetOperation" : metricName).start();
        boolean status = latch.await(duration, units);
        if (!status) {
            boolean gcPause = false;
            final RuntimeMXBean runtimeBean = ManagementFactory.getRuntimeMXBean();
            final long vmStartTime = runtimeBean.getStartTime();
            final List<GarbageCollectorMXBean> gcMXBeans = ManagementFactory.getGarbageCollectorMXBeans();
            for (GarbageCollectorMXBean gcMXBean : gcMXBeans) {
                if (gcMXBean instanceof com.sun.management.GarbageCollectorMXBean) {
                    final GcInfo lastGcInfo = ((com.sun.management.GarbageCollectorMXBean) gcMXBean).getLastGcInfo();

                    // If no GCs, there was no pause.
                    if (lastGcInfo == null) {
                        continue;
                    }

                    final long gcStartTime = lastGcInfo.getStartTime() + vmStartTime;
                    if (gcStartTime > startTime) {
                        gcPause = true;
                        final long gcDuration = lastGcInfo.getDuration();
                        EVCacheMetricsFactory.getCounter(appName, null, serverGroup.getName(), appName + "-DelayDueToGCPause", DataSourceType.COUNTER).increment(gcDuration);
                        if (log.isDebugEnabled()) log.debug("Total duration due to gc event = " + gcDuration
                                + " msec.");
                        break;
                    }
                }
            }
            if (!gcPause) {
                final long gcDuration = System.currentTimeMillis() - startTime;
                gcPause = (gcDuration > units.toMillis(duration) + 10);
                if (gcPause) {
                    EVCacheMetricsFactory.getCounter(appName, null, serverGroup.getName(), appName + "-DelayProbablyDueToGCPause", DataSourceType.COUNTER).increment(gcDuration);
                }
            }
            // redo the same op once more since there was a chance of gc pause
            if (gcPause) {
                status = latch.await(duration, units);
                if (log.isDebugEnabled()) log.debug("Retry status : " + status);

                if (status) {
                    EVCacheMetricsFactory.getCounter(appName, null, serverGroup.getName(), appName + "-DelayDueToGCPause-Success", DataSourceType.COUNTER).increment();
                } else {
                    EVCacheMetricsFactory.getCounter(appName, null, serverGroup.getName(), appName + "-DelayDueToGCPause-Fail", DataSourceType.COUNTER).increment();
                }
            }
        }

        if (!status) {
            // whenever timeout occurs, continuous timeout counter will increase by 1.
            MemcachedConnection.opTimedOut(op);
            if (op != null) op.timeOut();
            if (!hasZF) EVCacheMetricsFactory.getCounter(appName, null, serverGroup.getName(), appName + "-get-CheckedOperationTimeout", DataSourceType.COUNTER).increment();
            if (throwException) {
                throw new CheckedOperationTimeoutException("Timed out waiting for operation", op);
            }
        } else {
            // continuous timeout counter will be reset
            MemcachedConnection.opSucceeded(op);
        }

        if (op != null && op.hasErrored()) {
            if (throwException) {
                throw new ExecutionException(op.getException());
            }
        }
        if (isCancelled()) {
            if (hasZF) EVCacheMetricsFactory.getCounter(appName, null, serverGroup.getName(), appName + "-get-Cancelled", DataSourceType.COUNTER).increment();
            if (throwException) {
                throw new ExecutionException(new CancellationException("Cancelled"));
            }
        }
        if (op != null && op.isTimedOut()) {
            if (throwException) {
                throw new ExecutionException(new CheckedOperationTimeoutException("Operation timed out.", op));
            }
        }
        operationDuration.stop();
        return objRef.get();
    }

    public Single<T> observe() {
        return Single.create(subscriber ->
            addListener((EVCacheGetOperationListener<T>) future -> {
                try {
                    subscriber.onSuccess(get());
                } catch (Throwable e) {
                    subscriber.onError(e);
                }
            })
        );
    }

    public Single<T> get(long duration, TimeUnit units, boolean throwException, boolean hasZF, Scheduler scheduler) {
        final Stopwatch operationDuration = EVCacheMetricsFactory.getStatsTimer(appName, serverGroup, (metricName == null) ? "LatencyGet" : metricName).start();;
        return observe().timeout(duration, units, Single.create(subscriber -> {
            // whenever timeout occurs, continuous timeout counter will increase by 1.
            MemcachedConnection.opTimedOut(op);
            if (op != null) op.timeOut();
            if (!hasZF) EVCacheMetricsFactory.increment(appName + "-get-CheckedOperationTimeout");
            if (throwException) {
                subscriber.onError(new CheckedOperationTimeoutException("Timed out waiting for operation", op));
            } else {
                if (isCancelled()) {
                    if (hasZF) EVCacheMetricsFactory.increment(appName + "-Cancelled");
                }
                subscriber.onSuccess(objRef.get());
            }
        }), scheduler).doAfterTerminate(() ->
            operationDuration.stop()
        );
    }

    public void signalComplete() {
        super.signalComplete();
    }

}


text:
<?php

namespace Pool\LinkmotorApiBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class PoolLinkmotorApiBundle extends Bundle
{
}

redpajama_set_name: RedPajamaGithub


text: export const CLICK = 'CLICK'


text:
<project
		xmlns="http://maven.apache.org/POM/4.0.0"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>org.adbcj</groupId>
		<artifactId>adbcj</artifactId>
		<version>0.2-SNAPSHOT</version>
	</parent>

	<artifactId>adbcj-tck</artifactId>
	<packaging>jar</packaging>
	<name>ADBCJ - TCK</name>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
					<suiteXmlFiles>
						<suitXmlFile>testng.xml</suitXmlFile>
					</suiteXmlFiles>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<dependencies>
		<dependency>
			<artifactId>adbcj-api</artifactId>
			<groupId>${project.groupId}</groupId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<artifactId>adbcj-jdbc</artifactId>
			<groupId>${project.groupId}</groupId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<artifactId>mysql-mina</artifactId>
			<groupId>${project.groupId}</groupId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<artifactId>mysql-netty</artifactId>
			<groupId>${project.groupId}</groupId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<artifactId>postgresql-mina</artifactId>
			<groupId>${project.groupId}</groupId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<artifactId>postgresql-netty</artifactId>
			<groupId>${project.groupId}</groupId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<artifactId>mysql-connector-java</artifactId>
			<groupId>mysql</groupId>
			<version>5.1.6</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<artifactId>postgresql</artifactId>
			<groupId>postgresql</groupId>
			<version>8.2-504.jdbc4</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<artifactId>slf4j-log4j12</artifactId>
			<groupId>org.slf4j</groupId>
			<version>${slf4j.version}</version>
			<scope>test</scope>
		</dependency>
	</dependencies>

</project>


text:
var socket = require('socket.io-client');
var Backbone = require('backbone');
var _ = require('lodash');
var CONST = require('../consts');
var Config = require('../init');
var ErrorDialog = require('../Views/Modals/ErrorDialog/ErrorDialog');

(function(global) {
    "use strict;"

    var socketIOManager = {

        io : null,

        init:function(){

            this.io = socket.connect(Config.socketUrl);

            this.io.on('socketerror', function(param){

                if(param.code){

                    ErrorDialog.show('Error',CONST.ERROR_CODES[param.code]);

                }else{
                    ErrorDialog.show('Error','Unknown Error');
                }

            });

            this.io.on('newUser', function(param){
                Backbone.trigger(CONST.EVENT_ON_LOGIN_NOTIFY, param);

                // call listener
                if(!_.isEmpty(window.parent.SpikaAdapter) &&
                    !_.isEmpty(window.parent.SpikaAdapter.listener)){

                    var listener = window.parent.SpikaAdapter.listener;

                    if(_.isFunction(listener.onNewUser))
                        listener.onNewMessage(param);

                }

            });

            this.io.on('userLeft', function(param){

                Backbone.trigger(CONST.EVENT_ON_LOGOUT_NOTIFY, param);

                // call listener
                if(!_.isEmpty(window.parent.SpikaAdapter) &&
                    !_.isEmpty(window.parent.SpikaAdapter.listener)){

                    var listener = window.parent.SpikaAdapter.listener;

                    if(_.isFunction(listener.onUserLeft))
                        listener.onUserLeft(param);

                }

            });

            this.io.on('newMessage', function(param){

                console.log('newMessage',param);

                Backbone.trigger(CONST.EVENT_ON_MESSAGE,param);

                // call listener
                if(!_.isEmpty(window.parent.SpikaAdapter) &&
                    !_.isEmpty(window.parent.SpikaAdapter.listener)){

                    var listener = window.parent.SpikaAdapter.listener;

                    if(_.isFunction(listener.onNewMessage))
                        listener.onNewMessage(param);

                }

            });

            this.io.on('sendTyping', function(param){

                Backbone.trigger(CONST.EVENT_ON_TYPING,param);

                 // call listener
                if(!_.isEmpty(window.parent.SpikaAdapter) &&
                    !_.isEmpty(window.parent.SpikaAdapter.listener)){

                    var listener = window.parent.SpikaAdapter.listener;

                    if(_.isFunction(listener.OnUserTyping))
                        listener.OnUserTyping(param);

                }

           });

            this.io.on('login', function(param){
                Backbone.trigger(CONST.EVENT_ON_LOGIN, param);
            });

            this.io.on('logout', function(param){
                Backbone.trigger(CONST.EVENT_ON_LOGOUT, param);
            });

            this.io.on('messageUpdated', function(param){
                Backbone.trigger(CONST.EVENT_ON_MESSAGE_UPDATED, param);

                 // call listener
                if(!_.isEmpty(window.parent.SpikaAdapter) &&
                    !_.isEmpty(window.parent.SpikaAdapter.listener)){

                    var listener = window.parent.SpikaAdapter.listener;

                    if(_.isFunction(listener.OnMessageChanges))
                        listener.OnMessageChanges(param);

                }

            });

        },

        emit:function(command,params){

            var command = arguments[0];
            this.io.emit(command, params);

        }

    };

    // Exports ----------------------------------------------
    module["exports"] = socketIOManager;

})((this || 0).self || global);


text:
id: 2946
title: Cambiare dimensione caratteri in WordPress
author: Stefano Marzorati
layout: post
guid: http://marzorati.co/?p=2946
permalink: /cambiare-dimensione-caratteri-in-wordpress/
authorsure_include_css:
  -
dsq_thread_id:
  - 2856151601
categories:
  - Linux
  - Windows
tags:
  - carattere
  - dimensione
  - fonts
  - ridimensionare
  - wordpress
---
Questi sono i TAG html supportati da WordPress:

<span style="font-size: xx-small;">Testo</span>
<span style="font-size: x-small;">Testo</span>
<span style="font-size: small;">Testo</span>
<span style="font-size: large;">Testo</span>
<span style="font-size: x-large;">Testo</span>
<span style="font-size: xx-large;">Testo</span>

Il risultato è questo:

Testo
Testo
Testo
Testo
Testo
Testo


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Encyclop. Mycol. 645 (1938)

#### Original name
Mycena pseudocrispula Kühner, 1938

### Remarks
null


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>aws.example.s3</groupId>
  <artifactId>s3examples</artifactId>
  <packaging>jar</packaging>
  <version>1.0</version>
  <name>Amazon S3 Examples</name>
  <url>http://maven.apache.org</url>
    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.amazonaws</groupId>
                <artifactId>aws-java-sdk-bom</artifactId>
                <version>1.11.837</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-s3</artifactId>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-sts</artifactId>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-iam</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcprov-jdk16</artifactId>
            <version>1.45</version>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-kms</artifactId>
         </dependency>
      </dependencies>
</project>


text:
class FileSystemMirrorExtension < Radiant::Extension
  version "0.1"
  description "Allows you to pull and push Layout, Snippet, and Page Part content between the file system and the Radiant database."
  url "http://webadvocate.com"

  def activate
    require 'file_system_mirror'
    FileSystemMirror.init
  end

  def deactivate
  end
end


text:
Adding a Bot to a Guild

Adding bot to a server

Get your ApplicationID.

Replace the APPID from the link below.

https://discordapp.com/oauth2/authorize?scope=bot&permissions=0&client_id=APPID

The link above gives the bot the lowest level of permissions. Currently Qilbot doesn’t require higher levels for more information about permissions check: Discord Permissions - this however may change in the future.

Visiting this URL you will see the page below.

Select which server you want your bot be and press authorise.

All done


text:
package com.edgar.core.mail;

import org.apache.velocity.app.VelocityEngine;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
import org.springframework.test.context.transaction.TransactionConfiguration;
import org.springframework.test.context.transaction.TransactionalTestExecutionListener;

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

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:spring/applicationContext.xml"})
@TransactionConfiguration(defaultRollback = true)
@TestExecutionListeners({DependencyInjectionTestExecutionListener.class,
        TransactionalTestExecutionListener.class})
public class MaiServiceTest {

    @Autowired
    private MailService mailService;

    @Autowired
    private VelocityEngine engine;

    @Test
    public void testSimpleMail() {
        mailService.sendSimpleMail("cdmserver@126.com", "yuzhou.zhang@csst.com", "测试邮件",
                "这是一封测试邮件");
    }

    @Test
    public void testSimpleMailTo2() {
        List<String> to = new ArrayList<String>();
        to.add("yuzhou.zhang@csst.com");
        to.add("edgar615@gmail.com");

        mailService.sendSimpleMail("cdmserver@126.com", to, "测试邮件", "这是一封测试邮件");
    }

    @Test
    public void testSimpleMailCc() {
        List<String> to = new ArrayList<String>();
        to.add("yuzhou.zhang@csst.com");
        List<String> cc = new ArrayList<String>();
        cc.add("edgar615@gmail.com");

        mailService.sendSimpleMail("cdmserver@126.com", to, cc, "测试邮件", "这是一封测试邮件");
    }

    @Test
    public void testVelocity() {
        List<String> to = new ArrayList<String>();
        to.add("yuzhou.zhang@csst.com");
        List<String> cc = new ArrayList<String>();
        cc.add("edgar615@gmail.com");

        Map<String, Object> model = new HashMap<String, Object>();
        model.put("emailAddress", "yuzhou.zhang@csst.com");
        mailService.sendTplEmail(
                "cdmserver@126.com",
                to,
                cc,
                "测试邮件",
                "
Hi ${user.userName}, welcome to the Chipping Sodbury On-the-Hill message boards!

Your email address is ${emailAddress}
",
                model);
    }

    @Test
    public void testVelocityLocation() {
        List<String> to = new ArrayList<String>();
        to.add("yuzhou.zhang@csst.com");
        List<String> cc = new ArrayList<String>();
        cc.add("edgar615@gmail.com");

        Map<String, Object> model = new HashMap<String, Object>();
        model.put("emailAddress", "yuzhou.zhang@csst.com");
        mailService.sendTplLocationEmail("cdmserver@126.com", to, cc, "测试邮件", "tpl/500.vm",
                model);
    }
}


text:
use "Northwind"
select ord.OrderDate as Year2, Count(OrderID) as Total from Orders as ord group by OrderDate


text: docker-compose -f docker-compose.prod.yml -p pypi_scraper "$@"


text:
package com.vmware.vim25.mo;

import java.rmi.RemoteException;

import com.vmware.vim25.*;

/**
 * The managed object class corresponding to the one defined in VI SDK API reference.
 * @author Steve JIN (http://www.doublecloud.org)
 */

public class HostHealthStatusSystem extends ManagedObject
{

  public HostHealthStatusSystem(ServerConnection serverConnection, ManagedObjectReference mor)
  {
    super(serverConnection, mor);
  }

  public HealthSystemRuntime getRuntime()
  {
    return (HealthSystemRuntime) getCurrentProperty("runtime");
  }

  public void refreshHealthStatusSystem() throws RuntimeFault, RemoteException
  {
    getVimService().refreshHealthStatusSystem(getMOR());
  }

  public void resetSystemHealthInfo() throws RuntimeFault, RemoteException
  {
    getVimService().resetSystemHealthInfo(getMOR());
  }

}


text:
import {
  form as findForm,
  login as findLogin,
  password as findPassword,
  submit as findSubmit,
} from './findInputs';

import { get as getOptions } from '../lib/options';

export function fillInPassEntry(password, login) {
  if (!password) {
    return Promise.reject('No password field found');
  }

  const form = findForm();

  if (!form) {
    return Promise.reject('No visible form with "input[type=password]" found');
  }

  const passwordInput = findPassword(form);

  if (!passwordInput) {
    return Promise.reject('No visible "form input[type=password]" found');
  }

  passwordInput.value = password;

  if (!login) {
    return Promise.resolve();
  }

  findLogin(form, loginInput => {
    if (!loginInput) {
      return Promise.reject('No visible login input field found');
    }
    loginInput.value = login;
  });

  const submit = findSubmit(form);

  if (!submit) {
    return Promise.resolve();
  }

  return getOptions().then(options => {
    if (options.autosubmit) {
      submit.click();
    } else {
      submit.focus();
    }
  });
}


text:
using System;

namespace AnimalGuessingGame
{
    class Program
    {
        static void Main(string[] args)
        {
            // creates the new tree with default questions and answers
            Tree newTree = new Tree("Is it a mammal?");
            newTree.Root.Left = new Node("Does it live in water?")
            {
                Left = new Node("shark"),
                Right = new Node("dog")
            };
            newTree.Root.Right = new Node("Does it have wings?")
            {
                Left = new Node("Eagle"),
                Right = new Node("cat")
            };

            // Now the game starts
            newTree.AskQuestion(newTree.Root);

            Console.Read();
        }
    }
}


text:
from process import process

from main.models import Show, Location, Episode, Raw_File, Cut_List

class review1(process):

    # this will bump everything past the review1 step
    ready_state = 6

    def process_ep(self, ep):
        if self.options.verbose: print ep.id, ep.name

        ret = True

        # ep.save()

        return ret

if __name__ == '__main__':
    p=review1()
    p.main()


text:
<!DOCTYPE html>

<meta charset="utf-8">
<title>WebGL - Rectangle with 2 colors</title>
<link type="text/css" href="resources/css/ui-lightness/jquery-ui-1.8.16.custom.css" rel="stylesheet" />
<link type="text/css" href="resources/webgl-tutorials.css" rel="stylesheet" />

Drag sliders to translate, rotate, and scale.

<canvas id="canvas" width="400" height="300"></canvas>


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>org.achartengine</groupId>
	<artifactId>achartengine</artifactId>
	<version>1.2.0</version>
	<packaging>jar</packaging>
	<name>AChartEngine</name>
	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	</properties>

	<dependencies>
		<dependency>
			<groupId>com.google.android</groupId>
			<artifactId>android</artifactId>
			<version>2.2.1</version>
			<scope>provided</scope>
		</dependency>
	</dependencies>

	<build>
		<sourceDirectory>${project.basedir}/src</sourceDirectory>
		<resources>
		    <resource>
				<directory>src</directory>
				<includes>
				    <include>**/*.png</include>
				</includes>
		    </resource>
		</resources>
		<plugins>
			<plugin>
				<groupId>com.jayway.maven.plugins.android.generation2</groupId>
				<artifactId>android-maven-plugin</artifactId>
				<version>3.3.0</version>
				<extensions>true</extensions>
			</plugin>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>2.5.1</version>
				<configuration>
					<source>1.6</source>
					<target>1.6</target>
				</configuration>
			</plugin>
		</plugins>
	</build>

</project>


text:
namespace TheFishingSpot.Web.Areas.News.Models
{
    using System.ComponentModel.DataAnnotations;
    using System.Web.Mvc;

    public class NewsInputViewModel
    {
        [Required]
        [MaxLength(150)]
        public string Title { get; set; }

        [Required]
        [DataType("tinymce_full")]
        [UIHint("tinymce_full")]
        [AllowHtml]
        public string Content { get; set; }
    }
}


text:
// This file is automatically generated.

package adila.db;

/*
 * LG Optimus Black
 *
 * DEVICE: bproj_262-XXX
 * MODEL: LG-P970
 */
final class bproj5f2622dxxx_lg2dp970 {
    public static final String DATA = "LG|Optimus Black|";
}


text:
      <draggable class="related-elements__draggable" :disabled="{{ isset($draggable) && $draggable ? 'false': 'true' }}" handle=".drag-handle">
          @foreach($groups as $key => $group)
              @include(AdminTemplate::getViewPath('form.element.related.group'), [
                  'name' => $name,
                  'group' => $group,
                  'index' => $key,
                  'draggable' => isset($draggable) ? $draggable : false,
              ])
          @endforeach

          <template v-for="index in newGroups">
              @include(AdminTemplate::getViewPath('form.element.related.group'), [
                  'name' => $name,
                  'group' => new \SleepingOwl\Admin\Form\Related\Group(null, $stub->all()),
                  'index' => "totalGroupsCount",
              ])
          </template>
      </draggable>

      @if (!$readonly)

          <button
            v-if="canAddMore"
            type='button'
            @click="addNewGroup"
            class='grouped-elements__action pull-right related-action_add btn btn-success btn-sm'
          >

            {{ trans('sleeping_owl::lang.button.add') }}
          </button>

      @endif

  <input v-for="id in removedExistingGroups" type='hidden' :name="`${name}[remove][]`" :value='id'>


text:
package org.springframework.boot.bind;

import java.beans.PropertyEditor;
import java.beans.PropertyEditorSupport;
import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * {@link PropertyEditor} for {@link InetAddress} objects.
 *
 * @author Dave Syer
 */
public class InetAddressEditor extends PropertyEditorSupport implements PropertyEditor {

	@Override
	public String getAsText() {
		return ((InetAddress) getValue()).getHostAddress();
	}

	@Override
	public void setAsText(String text) throws IllegalArgumentException {
		try {
			setValue(InetAddress.getByName(text));
		}
		catch (UnknownHostException ex) {
			throw new IllegalArgumentException("Cannot locate host", ex);
		}
	}

}


text:
<?php

declare(strict_types = 1);

use Sop\CryptoEncoding\PEM;
use Sop\CryptoTypes\Asymmetric\RSA\RSAPrivateKey;
use Sop\X509\Certificate\Extension\AuthorityKeyIdentifierExtension;
use Sop\X509\GeneralName\GeneralName;

require_once __DIR__ . '/RefExtTestHelper.php';

/**
 * @group certificate
 * @group extension
 * @group decode
 *
 * @internal
 */
class RefAuthorityKeyIdentifierTest extends RefExtTestHelper
{
    /**
     * @param Extensions $extensions
     *
     * @return AuthorityKeyIdentifierExtension
     */
    public function testAuthorityKeyIdentifier()
    {
        $ext = self::$_extensions->authorityKeyIdentifier();
        $this->assertInstanceOf(AuthorityKeyIdentifierExtension::class, $ext);
        return $ext;
    }

    /**
     * @depends testAuthorityKeyIdentifier
     *
     * @param AuthorityKeyIdentifierExtension $aki
     */
    public function testAuthorityKeyIdentifierKey(
        AuthorityKeyIdentifierExtension $aki)
    {
        $pem = PEM::fromFile(
            TEST_ASSETS_DIR . '/certs/keys/acme-interm-rsa.pem');
        $keyid = RSAPrivateKey::fromPEM($pem)->publicKey()
            ->publicKeyInfo()
            ->keyIdentifier();
        $this->assertEquals($keyid, $aki->keyIdentifier());
    }

    /**
     * @depends testAuthorityKeyIdentifier
     *
     * @param AuthorityKeyIdentifierExtension $aki
     */
    public function testAuthorityKeyIdentifierIssuer(
        AuthorityKeyIdentifierExtension $aki)
    {
        $issuer_dn = $aki->issuer()
            ->firstOf(GeneralName::TAG_DIRECTORY_NAME)
            ->dn()
            ->toString();
        $this->assertEquals('o=ACME Ltd.,c=FI,cn=ACME Root CA', $issuer_dn);
        $this->assertEquals(1, $aki->serial());
    }
}


text:
package aoc2015.jav;

import java.io.IOException;
import java.nio.file.*;
import java.util.*;

class Day22 {

  private static int solve(List<String> s, boolean hard) {
    PriorityQueue<Wizard> wizards = new PriorityQueue<>((a, b) -> Integer.compare(b.manaSpend, a.manaSpend));
    int minManaSpend = Integer.MAX_VALUE;
    List<List<String>> casts = new ArrayList<>();
    wizards.add(new Wizard(50, 500, parseBoss(s)));
    while (wizards.size() > 0) {
      Wizard curr = wizards.poll();
      if (hard && --curr.hp <= 0)
        continue;
      curr.applyEffect();
      for (int spell = 0; spell < Wizard.spells.length; spell++) {
        if (curr.canCast(spell)) {
          Wizard next = new Wizard(curr);
          next.castSpell(spell);
          next.applyEffect();
          next.hp -= Math.max(1, next.boss[1] - next.armor);

          if (next.boss[0] <= 0) {
            if (next.manaSpend == minManaSpend)
              casts.add(next.casts);
            else if (next.manaSpend < minManaSpend) {
              minManaSpend = next.manaSpend;
              casts.clear();
              casts.add(next.casts);
            }
          } else if (next.hp > 0 && next.manaSpend < minManaSpend)
            wizards.add(next);
        }
      }
    }
    casts.forEach(System.out::println);
    return minManaSpend;
  }

  private static int[] parseBoss(List<String> s) {
    int[] boss = new int[2];
    for (int i = 0; i < boss.length; i++)
      boss[i] = Integer.valueOf(s.get(i).split(": ")[1]);
    return boss;
  }

  public static void main(String[] args) throws IOException {
    List<String> s = Files.readAllLines(Paths.get("./input/2015/Day22_input.txt"));
    System.out.println("Part One = " + solve(s, false));
    System.out.println("Part Two = " + solve(s, true));
  }
}

class Wizard {

  static final int[][] spells = {{53, 0}, {73, 0}, {113, 6}, {173, 6}, {229, 5}};
  private static final String[] names = {"Magic Missile", "Drain", "Shield", "Poison", "Recharge"};
  final List<String> casts = new ArrayList<>();
  final int[] boss; // {hp, dmg}
  int hp;
  int armor;
  int manaSpend;
  private int mana;
  private int[] active_effects = new int[5];

  public Wizard(int hp, int mana, int[] boss) {
    this.hp = hp;
    this.mana = mana;
    this.boss = boss;
  }

  public Wizard(Wizard old) {
    this(old.hp, old.mana, old.boss.clone());
    this.manaSpend = old.manaSpend;
    this.active_effects = old.active_effects.clone();
    this.casts.addAll(old.casts);
  }

  boolean canCast(int i) {
    return mana >= spells[i][0] && active_effects[i] == 0;
  }

  void castSpell(int i) {
    casts.add(names[i]);
    mana -= spells[i][0];
    manaSpend += spells[i][0];
    active_effects[i] = spells[i][1];
    if (i == 0) { // Magic Missile
      boss[0] -= 4;
    } else if (i == 1) { // Drain
      hp += 2;
      boss[0] -= 2;
    }
  }

  void applyEffect() {
    for (int i = 0; i < active_effects.length; i++) {
      if (active_effects[i] > 0) {
        active_effects[i]--;
        switch (i) {
          case 2:  // activate Shield
            armor = 7;
            break;
          case 3:  // Poison
            boss[0] -= 3;
            break;
          case 4:  // Recharge
            mana += 101;
            break;
        }
      } else if (i == 2) // deactivate Shield
        armor = 0;
    }
  }
}


text:
package rape.brutal.gitstarship;

public class Main {

    public static void main(String[] args) {
        // write your code here
    }
}


text:
import Ember from 'ember-metal/core';
import Registry from 'container/registry';
import factory from 'container/tests/test-helpers/factory';
import { getOwner, OWNER } from 'container/owner';
import isEnabled from 'ember-metal/features';

var originalModelInjections;

QUnit.module('Container', {
  setup() {
    originalModelInjections = Ember.MODEL_FACTORY_INJECTIONS;
  },
  teardown() {
    Ember.MODEL_FACTORY_INJECTIONS = originalModelInjections;
  }
});

QUnit.test('A registered factory returns the same instance each time', function() {
  var registry = new Registry();
  var container = registry.container();
  var PostController = factory();

  registry.register('controller:post', PostController);

  var postController = container.lookup('controller:post');

  ok(postController instanceof PostController, 'The lookup is an instance of the factory');

  equal(postController, container.lookup('controller:post'));
});

QUnit.test('A registered factory is returned from lookupFactory', function() {
  var registry = new Registry();
  var container = registry.container();
  var PostController = factory();

  registry.register('controller:post', PostController);

  var PostControllerFactory = container.lookupFactory('controller:post');

  ok(PostControllerFactory, 'factory is returned');
  ok(PostControllerFactory.create() instanceof  PostController, 'The return of factory.create is an instance of PostController');
});

QUnit.test('A registered factory is returned from lookupFactory is the same factory each time', function() {
  var registry = new Registry();
  var container = registry.container();
  var PostController = factory();

  registry.register('controller:post', PostController);

  deepEqual(container.lookupFactory('controller:post'), container.lookupFactory('controller:post'), 'The return of lookupFactory is always the same');
});

QUnit.test('A factory returned from lookupFactory has a debugkey', function() {
  var registry = new Registry();
  var container = registry.container();
  var PostController = factory();

  registry.register('controller:post', PostController);
  var PostFactory = container.lookupFactory('controller:post');
  equal(PostFactory._debugContainerKey, 'controller:post', 'factory instance receives _debugContainerKey');
});

QUnit.test('fallback for to create time injections if factory has no extend', function() {
  var registry = new Registry();
  var container = registry.container();
  var AppleController = factory();
  var PostController = factory();

  PostController.extend = undefined; // remove extend

  registry.register('controller:apple', AppleController);
  registry.register('controller:post', PostController);
  registry.injection('controller:post', 'apple', 'controller:apple');

  var postController = container.lookup('controller:post');

  equal(postController._debugContainerKey, 'controller:post', 'instance receives _debugContainerKey');
  ok(postController.apple instanceof AppleController, 'instance receives an apple of instance AppleController');
});

QUnit.test('The descendants of a factory returned from lookupFactory have a container and debugkey', function() {
  var registry = new Registry();
  var container = registry.container();
  var PostController = factory();
  var instance;

  registry.register('controller:post', PostController);
  instance = container.lookupFactory('controller:post').create();

  equal(instance._debugContainerKey, 'controller:post', 'factory instance receives _debugContainerKey');

  ok(instance instanceof PostController, 'factory instance is instance of factory');
});

QUnit.test('A registered factory returns a fresh instance if singleton: false is passed as an option', function() {
  var registry = new Registry();
  var container = registry.container();
  var PostController = factory();

  registry.register('controller:post', PostController);

  var postController1 = container.lookup('controller:post');
  var postController2 = container.lookup('controller:post', { singleton: false });
  var postController3 = container.lookup('controller:post', { singleton: false });
  var postController4 = container.lookup('controller:post');

  equal(postController1.toString(), postController4.toString(), 'Singleton factories looked up normally return the same value');
  notEqual(postController1.toString(), postController2.toString(), 'Singleton factories are not equal to factories looked up with singleton: false');
  notEqual(postController2.toString(), postController3.toString(), 'Two factories looked up with singleton: false are not equal');
  notEqual(postController3.toString(), postController4.toString(), 'A singleton factory looked up after a factory called with singleton: false is not equal');

  ok(postController1 instanceof PostController, 'All instances are instances of the registered factory');
  ok(postController2 instanceof PostController, 'All instances are instances of the registered factory');
  ok(postController3 instanceof PostController, 'All instances are instances of the registered factory');
  ok(postController4 instanceof PostController, 'All instances are instances of the registered factory');
});

QUnit.test('A factory type with a registered injection\'s instances receive that injection', function() {
  var registry = new Registry();
  var container = registry.container();
  var PostController = factory();
  var Store = factory();

  registry.register('controller:post', PostController);
  registry.register('store:main', Store);

  registry.typeInjection('controller', 'store', 'store:main');

  var postController = container.lookup('controller:post');
  var store = container.lookup('store:main');

  equal(postController.store, store);
});

QUnit.test('An individual factory with a registered injection receives the injection', function() {
  var registry = new Registry();
  var container = registry.container();
  var PostController = factory();
  var Store = factory();

  registry.register('controller:post', PostController);
  registry.register('store:main', Store);

  registry.injection('controller:post', 'store', 'store:main');

  var postController = container.lookup('controller:post');
  var store = container.lookup('store:main');

  equal(store._debugContainerKey, 'store:main');

  equal(postController._debugContainerKey, 'controller:post');
  equal(postController.store, store, 'has the correct store injected');
});

QUnit.test('A factory with both type and individual injections', function() {
  var registry = new Registry();
  var container = registry.container();
  var PostController = factory();
  var Store = factory();
  var Router = factory();

  registry.register('controller:post', PostController);
  registry.register('store:main', Store);
  registry.register('router:main', Router);

  registry.injection('controller:post', 'store', 'store:main');
  registry.typeInjection('controller', 'router', 'router:main');

  var postController = container.lookup('controller:post');
  var store = container.lookup('store:main');
  var router = container.lookup('router:main');

  equal(postController.store, store);
  equal(postController.router, router);
});

QUnit.test('A factory with both type and individual factoryInjections', function() {
  var registry = new Registry();
  var container = registry.container();
  var PostController = factory();
  var Store = factory();
  var Router = factory();

  registry.register('controller:post', PostController);
  registry.register('store:main', Store);
  registry.register('router:main', Router);

  registry.factoryInjection('controller:post', 'store', 'store:main');
  registry.factoryTypeInjection('controller', 'router', 'router:main');

  var PostControllerFactory = container.lookupFactory('controller:post');
  var store = container.lookup('store:main');
  var router = container.lookup('router:main');

  equal(PostControllerFactory.store, store, 'PostControllerFactory has the instance of store');
  equal(PostControllerFactory.router, router, 'PostControllerFactory has the route instance');
});

QUnit.test('A non-singleton instance is never cached', function() {
  var registry = new Registry();
  var container = registry.container();
  var PostView = factory();

  registry.register('view:post', PostView, { singleton: false });

  var postView1 = container.lookup('view:post');
  var postView2 = container.lookup('view:post');

  ok(postView1 !== postView2, 'Non-singletons are not cached');
});

QUnit.test('A non-instantiated property is not instantiated', function() {
  var registry = new Registry();
  var container = registry.container();

  var template = function() {};
  registry.register('template:foo', template, { instantiate: false });
  equal(container.lookup('template:foo'), template);
});

QUnit.test('A failed lookup returns undefined', function() {
  var registry = new Registry();
  var container = registry.container();

  equal(container.lookup('doesnot:exist'), undefined);
});

QUnit.test('An invalid factory throws an error', function() {
  var registry = new Registry();
  var container = registry.container();

  registry.register('controller:foo', {});

  throws(function() {
    container.lookup('controller:foo');
  }, /Failed to create an instance of \'controller:foo\'/);
});

QUnit.test('Injecting a failed lookup raises an error', function() {
  Ember.MODEL_FACTORY_INJECTIONS = true;

  var registry = new Registry();
  var container = registry.container();

  var fooInstance = {};
  var fooFactory  = {};

  var Foo = {
    create(args) { return fooInstance; },
    extend(args) { return fooFactory;  }
  };

  registry.register('model:foo', Foo);
  registry.injection('model:foo', 'store', 'store:main');

  throws(function() {
    container.lookup('model:foo');
  });
});

QUnit.test('Injecting a falsy value does not raise an error', function() {
  var registry = new Registry();
  var container = registry.container();
  var ApplicationController = factory();

  registry.register('controller:application', ApplicationController);
  registry.register('user:current', null, { instantiate: false });
  registry.injection('controller:application', 'currentUser', 'user:current');

  strictEqual(container.lookup('controller:application').currentUser, null);
});

QUnit.test('The container returns same value each time even if the value is falsy', function() {
  let registry = new Registry();
  let container = registry.container();

  registry.register('falsy:value', null, { instantiate: false });

  strictEqual(container.lookup('falsy:value'), container.lookup('falsy:value'));
});

QUnit.test('Destroying the container destroys any cached singletons', function() {
  var registry = new Registry();
  var container = registry.container();
  var PostController = factory();
  var PostView = factory();
  var template = function() {};

  registry.register('controller:post', PostController);
  registry.register('view:post', PostView, { singleton: false });
  registry.register('template:post', template, { instantiate: false });

  registry.injection('controller:post', 'postView', 'view:post');

  var postController = container.lookup('controller:post');
  var postView = postController.postView;

  ok(postView instanceof PostView, 'The non-singleton was injected');

  container.destroy();

  ok(postController.isDestroyed, 'Singletons are destroyed');
  ok(!postView.isDestroyed, 'Non-singletons are not destroyed');
});

QUnit.test('The container can use a registry hook to resolve factories lazily', function() {
  var registry = new Registry();
  var container = registry.container();
  var PostController = factory();

  registry.resolver = {
    resolve(fullName) {
      if (fullName === 'controller:post') {
        return PostController;
      }
    }
  };

  var postController = container.lookup('controller:post');

  ok(postController instanceof PostController, 'The correct factory was provided');
});

QUnit.test('The container normalizes names before resolving', function() {
  var registry = new Registry();
  var container = registry.container();
  var PostController = factory();

  registry.normalizeFullName = function(fullName) {
    return 'controller:post';
  };

  registry.register('controller:post', PostController);
  var postController = container.lookup('controller:normalized');

  ok(postController instanceof PostController, 'Normalizes the name before resolving');
});

QUnit.test('The container normalizes names when looking factory up', function() {
  var registry = new Registry();
  var container = registry.container();
  var PostController = factory();

  registry.normalizeFullName = function(fullName) {
    return 'controller:post';
  };

  registry.register('controller:post', PostController);
  var fact = container.lookupFactory('controller:normalized');

  equal(fact.toString() === PostController.extend().toString(), true, 'Normalizes the name when looking factory up');
});

QUnit.test('Options can be registered that should be applied to a given factory', function() {
  var registry = new Registry();
  var container = registry.container();
  var PostView = factory();

  registry.resolver = {
    resolve(fullName) {
      if (fullName === 'view:post') {
        return PostView;
      }
    }
  };

  registry.options('view:post', { instantiate: true, singleton: false });

  var postView1 = container.lookup('view:post');
  var postView2 = container.lookup('view:post');

  ok(postView1 instanceof PostView, 'The correct factory was provided');
  ok(postView2 instanceof PostView, 'The correct factory was provided');

  ok(postView1 !== postView2, 'The two lookups are different');
});

QUnit.test('Options can be registered that should be applied to all factories for a given type', function() {
  var registry = new Registry();
  var container = registry.container();
  var PostView = factory();

  registry.resolver = {
    resolve(fullName) {
      if (fullName === 'view:post') {
        return PostView;
      }
    }
  };

  registry.optionsForType('view', { singleton: false });

  var postView1 = container.lookup('view:post');
  var postView2 = container.lookup('view:post');

  ok(postView1 instanceof PostView, 'The correct factory was provided');
  ok(postView2 instanceof PostView, 'The correct factory was provided');

  ok(postView1 !== postView2, 'The two lookups are different');
});

QUnit.test('An injected non-singleton instance is never cached', function() {
  var registry = new Registry();
  var container = registry.container();
  var PostView = factory();
  var PostViewHelper = factory();

  registry.register('view:post', PostView, { singleton: false });
  registry.register('view_helper:post', PostViewHelper, { singleton: false });
  registry.injection('view:post', 'viewHelper', 'view_helper:post');

  var postView1 = container.lookup('view:post');
  var postView2 = container.lookup('view:post');

  ok(postView1.viewHelper !== postView2.viewHelper, 'Injected non-singletons are not cached');
});

QUnit.test('Factory resolves are cached', function() {
  var registry = new Registry();
  var container = registry.container();
  var PostController = factory();
  var resolveWasCalled = [];
  registry.resolve = function(fullName) {
    resolveWasCalled.push(fullName);
    return PostController;
  };

  deepEqual(resolveWasCalled, []);
  container.lookupFactory('controller:post');
  deepEqual(resolveWasCalled, ['controller:post']);

  container.lookupFactory('controller:post');
  deepEqual(resolveWasCalled, ['controller:post']);
});

QUnit.test('factory for non extendables (MODEL) resolves are cached', function() {
  var registry = new Registry();
  var container = registry.container();
  var PostController = factory();
  var resolveWasCalled = [];
  registry.resolve = function(fullName) {
    resolveWasCalled.push(fullName);
    return PostController;
  };

  deepEqual(resolveWasCalled, []);
  container.lookupFactory('model:post');
  deepEqual(resolveWasCalled, ['model:post']);

  container.lookupFactory('model:post');
  deepEqual(resolveWasCalled, ['model:post']);
});

QUnit.test('factory for non extendables resolves are cached', function() {
  var registry = new Registry();
  var container = registry.container();
  var PostController = {};
  var resolveWasCalled = [];

  registry.resolve = function(fullName) {
    resolveWasCalled.push(fullName);
    return PostController;
  };

  deepEqual(resolveWasCalled, []);
  container.lookupFactory('foo:post');
  deepEqual(resolveWasCalled, ['foo:post']);

  container.lookupFactory('foo:post');
  deepEqual(resolveWasCalled, ['foo:post']);
});

QUnit.test('The `_onLookup` hook is called on factories when looked up the first time', function() {
  expect(2);

  var registry = new Registry();
  var container = registry.container();
  var Apple = factory();

  Apple.reopenClass({
    _onLookup(fullName) {
      equal(fullName, 'apple:main', 'calls lazy injection method with the lookup full name');
      equal(this, Apple, 'calls lazy injection method in the factory context');
    }
  });

  registry.register('apple:main', Apple);

  container.lookupFactory('apple:main');
  container.lookupFactory('apple:main');
});

QUnit.test('A factory\'s lazy injections are validated when first instantiated', function() {
  var registry = new Registry();
  var container = registry.container();
  var Apple = factory();
  var Orange = factory();

  Apple.reopenClass({
    _lazyInjections() {
      return ['orange:main', 'banana:main'];
    }
  });

  registry.register('apple:main', Apple);
  registry.register('orange:main', Orange);

  throws(function() {
    container.lookup('apple:main');
  }, /Attempting to inject an unknown injection: `banana:main`/);
});

QUnit.test('Lazy injection validations are cached', function() {
  expect(1);

  var registry = new Registry();
  var container = registry.container();
  var Apple = factory();
  var Orange = factory();

  Apple.reopenClass({
    _lazyInjections() {
      ok(true, 'should call lazy injection method');
      return ['orange:main'];
    }
  });

  registry.register('apple:main', Apple);
  registry.register('orange:main', Orange);

  container.lookup('apple:main');
  container.lookup('apple:main');
});

QUnit.test('An object with its owner pre-set should be returned from ownerInjection', function() {
  let owner = { };
  var registry = new Registry();
  var container = registry.container({ owner });

  let result = container.ownerInjection();

  equal(result[OWNER], owner, 'owner is properly included');
});

if (isEnabled('ember-container-inject-owner')) {
  QUnit.test('A deprecated `container` property is appended to every object instantiated from an extendable factory', function() {
    let registry = new Registry();
    let container = registry.container();
    let PostController = factory();
    registry.register('controller:post', PostController);
    let postController = container.lookup('controller:post');

    expectDeprecation(function() {
      Ember.get(postController, 'container');
    }, 'Using the injected `container` is deprecated. Please use the `getOwner` helper instead to access the owner of this object.');

    expectDeprecation(function() {
      let c = postController.container;
      strictEqual(c, container);
    }, 'Using the injected `container` is deprecated. Please use the `getOwner` helper instead to access the owner of this object.');
  });

  QUnit.test('A deprecated `container` property is appended to every object instantiated from a non-extendable factory, and a fake container is available during instantiation.', function() {
    expect(8);

    let owner = {};
    let registry = new Registry();
    let container = registry.container({ owner });

    // Define a simple non-extendable factory
    let PostController = function(options) {
      this.container = options.container;
    };

    PostController.create = function(options) {
      ok(options.container, 'fake container has been injected and is available during `create`.');

      expectDeprecation(function() {
        options.container.lookup('abc:one');
      }, 'Using the injected `container` is deprecated. Please use the `getOwner` helper to access the owner of this object and then call `lookup` instead.');

      expectDeprecation(function() {
        options.container.lookupFactory('abc:two');
      }, 'Using the injected `container` is deprecated. Please use the `getOwner` helper to access the owner of this object and then call `_lookupFactory` instead.');

      // non-deprecated usage of `lookup` and `_lookupFactory`
      owner.lookup = function(fullName) {
        equal(fullName, 'abc:one', 'lookup on owner called properly');
      };
      owner._lookupFactory = function(fullName) {
        equal(fullName, 'abc:two', '_lookupFactory on owner called properly');
      };
      let foundOwner = getOwner(options);
      foundOwner.lookup('abc:one');
      foundOwner._lookupFactory('abc:two');

      return new PostController(options);
    };

    registry.register('controller:post', PostController);
    let postController = container.lookup('controller:post');

    expectDeprecation(function() {
      Ember.get(postController, 'container');
    }, 'Using the injected `container` is deprecated. Please use the `getOwner` helper instead to access the owner of this object.');

    expectDeprecation(function() {
      let c = postController.container;
      strictEqual(c, container, 'Injected container is now regular (not fake) container, but access is still deprecated.');
    }, 'Using the injected `container` is deprecated. Please use the `getOwner` helper instead to access the owner of this object.');
  });

  QUnit.test('A deprecated `container` property is only set on a non-extendable factory instance if `container` is present and writable.', function() {
    expect(2);

    let owner = {};
    let registry = new Registry();
    let container = registry.container({ owner });

    // Define a non-extendable factory that is frozen after `create`
    let PostController = function() {};
    PostController.create = function() {
      let instance = new PostController();

      Object.seal(instance);

      return instance;
    };

    registry.register('controller:post', PostController);
    let postController = container.lookup('controller:post');

    equal(postController.container, undefined, 'container was not added');

    let OtherController = function() {
      this.container = 'foo';
    };

    OtherController.create = function() {
      let instance = new OtherController();

      Object.freeze(instance);

      return instance;
    };

    registry.register('controller:other', OtherController);
    let otherController = container.lookup('controller:other');

    equal(otherController.container, 'foo', 'container was not added');
  });

  QUnit.test('An extendable factory can provide `container` upon create, with a deprecation', function(assert) {
    let registry = new Registry();
    let container = registry.container();

    registry.register('controller:post', factory());

    let PostController = container.lookupFactory('controller:post');

    let postController;

    expectDeprecation(function() {
      postController = PostController.create({
        container: 'foo'
      });
    }, /Providing the \`container\` property to .+ is deprecated. Please use \`Ember.setOwner\` or \`owner.ownerInjection\(\)\` instead to provide an owner to the instance being created/);

    expectDeprecation(function() {
      let c = postController.container;
      assert.equal(c, 'foo', 'the `container` provided to `.create`was used');
    }, 'Using the injected `container` is deprecated. Please use the `getOwner` helper instead to access the owner of this object.');
  });
} else {
  QUnit.test('A `container` property is appended to every instantiated object', function() {
    let registry = new Registry();
    let container = registry.container();
    let PostController = factory();
    registry.register('controller:post', PostController);
    let postController = container.lookup('controller:post');

    strictEqual(postController.container, container, '');
  });
}

if (isEnabled('ember-htmlbars-local-lookup')) {
  QUnit.test('lookupFactory passes options through to expandlocallookup', function(assert) {
    let registry = new Registry();
    let container = registry.container();
    let PostController = factory();

    registry.register('controller:post', PostController);

    registry.expandLocalLookup = function(fullName, options) {
      assert.ok(true, 'expandLocalLookup was called');
      assert.equal(fullName, 'foo:bar');
      assert.deepEqual(options, { source: 'baz:qux' });

      return 'controller:post';
    };

    let PostControllerFactory = container.lookupFactory('foo:bar', { source: 'baz:qux' });

    assert.ok(PostControllerFactory.create() instanceof  PostController, 'The return of factory.create is an instance of PostController');
  });

  QUnit.test('lookup passes options through to expandlocallookup', function(assert) {
    let registry = new Registry();
    let container = registry.container();
    let PostController = factory();

    registry.register('controller:post', PostController);

    registry.expandLocalLookup = function(fullName, options) {
      assert.ok(true, 'expandLocalLookup was called');
      assert.equal(fullName, 'foo:bar');
      assert.deepEqual(options, { source: 'baz:qux' });

      return 'controller:post';
    };

    let PostControllerLookupResult = container.lookup('foo:bar', { source: 'baz:qux' });

    assert.ok(PostControllerLookupResult instanceof PostController);
  });
}


text:
package com.lance.lancezhihudaily.db;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

import com.lance.lancezhihudaily.bean.News;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/6/12 0012.
 */

public class DBDao {

    private DBHelper mHelper;

    public DBDao(Context context) {
        mHelper = DBHelper.getDBHelper(context);
    }

    public void insertFavorite(News news) {
        SQLiteDatabase db = mHelper.getWritableDatabase();
        ContentValues values = new ContentValues();
        values.put("newsId", news.getId());
        values.put("title", news.getTitle());
        values.put("image", news.getImages().get(0));
        db.insert("favorite", null, values);
    }

    public void deleteFavorite(News news) {
        SQLiteDatabase db = mHelper.getWritableDatabase();
        db.delete("favorite", "newsId = ?", new String[]{news.getId() + ""});
    }

    public boolean isFavorite(News news) {
        List<News> favoriteList = getFavoriteList();
        for (News favoriteNews :
                favoriteList) {
            if (favoriteNews.getId() == (news.getId())) {
                return true;
            }
        }
        return false;
    }

    public List<News> getFavoriteList() {
        List<News> favoriteList = new ArrayList<>();
        SQLiteDatabase db = mHelper.getWritableDatabase();
        Cursor cursor = db.query("favorite", null, null, null, null, null, null);
        if (cursor.moveToFirst()) {
            do {
                int id = cursor.getInt(cursor.getColumnIndex("newsId"));
                String title = cursor.getString(cursor.getColumnIndex("title"));
                String image = cursor.getString(cursor.getColumnIndex("image"));
                News news = new News(id, title, image);
                favoriteList.add(news);
            } while (cursor.moveToNext());
        }
        cursor.close();
        return favoriteList;
    }

    public void insertRead(News news) {
        SQLiteDatabase db = mHelper.getWritableDatabase();
        ContentValues values = new ContentValues();
        values.put("newsId", news.getId());
        values.put("title", news.getTitle());
        values.put("image", news.getImages().get(0));
        db.insert("read", null, values);
    }

    public List<News> getReadList() {
        List<News> readList = new ArrayList<>();
        SQLiteDatabase db = mHelper.getWritableDatabase();
        Cursor cursor = db.query("read", null, null, null, null, null, null);
        if (cursor.moveToFirst()) {
            do {
                int id = cursor.getInt(cursor.getColumnIndex("newsId"));
                String title = cursor.getString(cursor.getColumnIndex("title"));
                String image = cursor.getString(cursor.getColumnIndex("image"));
                News news = new News(id, title, image);
                readList.add(news);
            } while (cursor.moveToNext());
        }
        cursor.close();
        return readList;
    }

    public boolean isRead(News news) {
        List<News> readList = getReadList();
        for (News readNews :
                readList) {
            if (readNews.getId() == (news.getId())) {
                return true;
            }
        }
        return false;
    }
}


text:
/*
 * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package net.java.sip.communicator.impl.gui.main.chat.history;

import java.awt.*;
import java.util.*;

import javax.swing.*;

import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.plugin.desktoputil.*;
import net.java.sip.communicator.util.*;

/**
 * The <tt>DatesListRenderer</tt> is a <tt>ListCellRenderer</tt>, specialized
 * to show dates. It's meant to be used in the history window in order to
 * represent the list of history dates.
 *
 * @author Yana Stamcheva
 */
public class DatesListRenderer
    extends JPanel
    implements ListCellRenderer
{
    private JLabel label = new JLabel();
    private boolean isSelected;

    public DatesListRenderer()
    {
        super(new BorderLayout());

        this.add(label);
    }

    public Component getListCellRendererComponent(JList list, Object value,
            int index, boolean isSelected, boolean cellHasFocus)
    {
        Date dateValue = (Date) value;

        StringBuffer dateStrBuf = new StringBuffer();

        GuiUtils.formatDate(dateValue.getTime(), dateStrBuf);

        this.label.setText(dateStrBuf.toString());
        this.isSelected = isSelected;

        return this;
    }

    /**
     * Paint a round background for all selected cells.
     */
    @Override
    public void paintComponent(Graphics g) {
        super.paintComponent(g);

        g = g.create();
        try
        {
            AntialiasingManager.activateAntialiasing(g);

            Graphics2D g2 = (Graphics2D) g;

            if (this.isSelected)
            {

                g2.setColor(Constants.SELECTED_COLOR);
                g2.fillRoundRect(0, 0, this.getWidth(), this.getHeight(), 7, 7);

                g2.setColor(Constants.LIST_SELECTION_BORDER_COLOR);
                g2.setStroke(new BasicStroke(1.5f));
                g2.drawRoundRect(0, 0, this.getWidth() - 1,
                    this.getHeight() - 1, 7, 7);
            }
        }
        finally
        {
            g.dispose();
        }
    }
}


text:
{% if jekyll.environment == 'production' %}{% if page.comments and site.disqus.shortname %}{% capture identifier %}{% if page.wordpress_id %}{{ page.wordpress_id }}{% else %}{{ page.url }}{% endif %}{% endcapture %}

Please enable JavaScript to view the comments powered by Disqus.
comments powered by Disqus{% endif %}
{% endif %}


text:
My free-time attempt at making an easy-to-use keyvalue store. Intended to be as easy to use as PlayerPrefs (Unity3d) or NSUserDefaults (iOS) for a local program with very basic storage needs, while being more portable.

# Under Alpha Development, works but not efficient or well tested!

# AitocirKVS design

AitocirKVS is inspired by the API for Unity3d's PlayerPrefs, and the on-disk format from [cdb](http://cr.yp.to/cdb.html). It consists of a single binary file capable of storing usigned ints, signed ints, floats/doubles, booleans, and length-limited ASCII strings. The binary file is structured as follows:

    1) 14 bytes of header
      1a) 4 bytes, hard-wired to "AKVS" in ASCII for file verification
      1b) 2 bytes, unsigned integer indicating fixed key length to be used
      1c) 8 bytes, data used to decide how to weight what hash buckets get various value lengths
    2) 65536*4 bytes of hash indexes
      2a) first 4 bytes is a file byte address to the first element of the 0th hash bucket
      2b) second 4 bytes is a file byte address to the first element of the 1st hash bucket
      2c) ...
    3) n-byte length records appended one right after another
      3a) key (m bytes | m = value from 1b)
      3b) type, indicating what kind of value follows (1 byte)
      3c) value (p bytes | p = length of type from 3b)
      3d) next, 4 byte pointer to the file byte address of the next record in this hash bucket

Note that this database, like cdb, is limited to a 4GB file size because it uses 4 byte unsigned integers as file byte address pointers.

The commands AitocirKVS supports are as follows:

  SET
    This command will update the key if it already exists or add it if it doesn't. It uses the [Fowler-Noll-Vo](https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function) hash function to hash the key, then masks the top 4 bits with a value to ensure the hash goes into a hash bucket with the same value length as the value type. Each hash bucket only has values of a fixed length. For example, a single hash bucket containing 4 byte values may have uint32s and int32s in it, but no uint16s because it can only hold values of 4 bytes in length. Then it looks down that hash bucket for the end element. If it finds a deleted element along the way, it will re-use that space for this record and not append anything. Otherwise, it will append a new record and point that previous tail record to this new one.

  GET
    Gets value for the provided key and value type. (We're requiring a type so that eventaully the wrapper API knows what datatype it needs to return at call time. This isn't an issue for the delete command, which does not require the key's value type. See below.)

  DELETE
    Remove the key-value pair from the database by NULL-ing out the bytes from the record except for the next pointer. The reason for this is that the NULL-ed space can be re-used by the next ADD that uses this hash bucket instead of appending a new record to the end.


text:
package com.google.cloud.apigeeregistry.v1.samples;

// [START apigeeregistry_v1_generated_Provisioning_GetInstance_sync]
import com.google.cloud.apigeeregistry.v1.GetInstanceRequest;
import com.google.cloud.apigeeregistry.v1.Instance;
import com.google.cloud.apigeeregistry.v1.InstanceName;
import com.google.cloud.apigeeregistry.v1.ProvisioningClient;

public class SyncGetInstance {

  public static void main(String[] args) throws Exception {
    syncGetInstance();
  }

  public static void syncGetInstance() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (ProvisioningClient provisioningClient = ProvisioningClient.create()) {
      GetInstanceRequest request =
          GetInstanceRequest.newBuilder()
              .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
              .build();
      Instance response = provisioningClient.getInstance(request);
    }
  }
}
// [END apigeeregistry_v1_generated_Provisioning_GetInstance_sync]


text:
import { WEBKIT_PREFIX } from "../const";

const TRANSITION_EVENT_TYPE = WEBKIT_PREFIX ? "webkitTransitionEnd" : "transitionend";
const ANIMATION_EVENT_TYPE = WEBKIT_PREFIX ? "webkitAnimationEnd" : "animationend";

function AnimationHandler(node, animationName) {
    this.node = node;
    this.style = node.style;
    this.eventType = animationName ? ANIMATION_EVENT_TYPE : TRANSITION_EVENT_TYPE;
    this.animationName = animationName;
}

AnimationHandler.prototype = {
    handleEvent(e) {
        if (!this.animationName || e.animationName === this.animationName) {
            if (this.animationName) {
                this.style.animationName = "";
                this.style.animationDirection = "";
            }

            this.node.removeEventListener(this.eventType, this, true);

            if (typeof this.callback === "function") {
                this.callback();
            }
        }
    },
    start(callback, animationDirection) {
        this.callback = callback;

        if (this.animationName) {
            this.style.animationName = this.animationName;
            this.style.animationDirection = animationDirection;
        }

        this.node.addEventListener(this.eventType, this, true);
    }
};

export default AnimationHandler;


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package test.proxy.java;

import java.lang.reflect.Proxy;

/**
 * A Simple AOP Container
 *
 */
public class AopContainer {

    /**
     * @param clazz 被代理的接口
     * @param obj 被代理的类实例
     */
    public static <T> T getBean(final Class<T> clazz, final T obj) {
        assert clazz.isInterface();

        final T bean = clazz.cast(Proxy.newProxyInstance(clazz.getClassLoader(),
            new Class[]{clazz}, new AopInvocationHandlerImpl(obj)));
        return bean;
    }

    /**
     * @param clazz 被代理的接口
     * @param obj 被代理的类实例
     * @param name 后通知类Inform的方法的参数
     */
    public static <T> T getBean(final Class<T> clazz, final T obj, final String name) {
        assert clazz.isInterface();

        final T bean = clazz.cast(Proxy.newProxyInstance(clazz.getClassLoader(),
            new Class[]{clazz}, new AopInvocationHandlerImpl(obj, new Inform(name))));
        return bean;
    }

    /**
     * @param obj 被代理的类实例
     */
    public static Object getBean(final Object obj) {
        return Proxy.newProxyInstance(obj.getClass().getClassLoader(),
            obj.getClass().getInterfaces(), new AopInvocationHandlerImpl(obj));
    }

    /**
     * @param obj 被代理的类实例
     * @param name 后通知类Inform的方法的参数
     */
    public static Object getBean(final Object obj, final String name) {
        return Proxy.newProxyInstance(obj.getClass().getClassLoader(),
            obj.getClass().getInterfaces(), new AopInvocationHandlerImpl(obj, new Inform(name)));
    }
}


text:
package com.base.po;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
public class LandRentInfo {

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private int lr_id;
	private String lid;
	private String startTime;
	private String endTime;
	private String planting;
	private String userId;
	private Double rentMoney;
	private String chargeDate;
	private int applyDept;

	public int getApplyDept() {
		return applyDept;
	}
	public void setApplyDept(int applyDept) {
		this.applyDept = applyDept;
	}
	public int getLr_id() {
		return lr_id;
	}
	public void setLr_id(int lr_id) {
		this.lr_id = lr_id;
	}

	public String getLid() {
		return lid;
	}
	public void setLid(String lid) {
		this.lid = lid;
	}
	public String getStartTime() {
		return startTime;
	}
	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}
	public String getEndTime() {
		return endTime;
	}
	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}
	public String getPlanting() {
		return planting;
	}
	public void setPlanting(String planting) {
		this.planting = planting;
	}

	public String getUserId() {
		return userId;
	}
	public void setUserId(String userId) {
		this.userId = userId;
	}
	public Double getRentMoney() {
		return rentMoney;
	}
	public void setRentMoney(Double rentMoney) {
		this.rentMoney = rentMoney;
	}
	public String getChargeDate() {
		return chargeDate;
	}
	public void setChargeDate(String chargeDate) {
		this.chargeDate = chargeDate;
	}
	public LandRentInfo() {
		super();
	}
	public LandRentInfo(String lid, String startTime,
			String endTime, String planting, String userId, Double rentMoney,
			String chargeDate, int applyDept) {
		super();
		this.lid = lid;
		this.startTime = startTime;
		this.endTime = endTime;
		this.planting = planting;
		this.userId = userId;
		this.rentMoney = rentMoney;
		this.chargeDate = chargeDate;
		this.applyDept = applyDept;
	}
	public LandRentInfo(String lid, String startTime, String endTime,
			String planting, String userId, String chargeDate, int applyDept) {
		super();
		this.lid = lid;
		this.startTime = startTime;
		this.endTime = endTime;
		this.planting = planting;
		this.userId = userId;
		this.chargeDate = chargeDate;
		this.applyDept = applyDept;
	}

}


text:
from south.db import db
from django.db import models
from nepal.web.models import *

class Migration:
    no_dry_run = True

    def forwards(self, orm):
        for phpini in orm.PHPIni.objects.all():
            try:
                phpini.vhost = orm.VHost.objects.get(domain=phpini.domain)
                phpini.save()
            except orm.VHost.DoesNotExist:
                phpini.delete()

    def backwards(self, orm):
        # we destroyed data in forwards() so there is no going back
        raise NotImplementedException()

    models = {
        'account.userprofile': {
            'Meta': {'db_table': "'user_profile'"},
            'account_holder': ('django.db.models.fields.CharField', [], {'max_length': '64', 'blank': 'True'}),
            'account_no': ('django.db.models.fields.IntegerField', [], {'max_length': '16', 'null': 'True', 'blank': 'True'}),
            'bank_number': ('django.db.models.fields.IntegerField', [], {'max_length': '16', 'null': 'True', 'blank': 'True'}),
            'canbeactivated': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
            'city': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
            'company': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
            'country': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['countries.Country']"}),
            'customer_id': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
            'fax': ('django.db.models.fields.CharField', [], {'max_length': '32', 'blank': 'True'}),
            'iban': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True', 'blank': 'True'}),
            'jid': ('django.db.models.fields.EmailField', [], {'max_length': '128', 'blank': 'True'}),
            'language': ('django.db.models.fields.CharField', [], {'max_length': '32', 'blank': 'True'}),
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'child_set'", 'null': 'True', 'to': "orm['account.UserProfile']"}),
            'phone': ('django.db.models.fields.CharField', [], {'max_length': '32', 'blank': 'True'}),
            'role': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
            'state': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
            'street': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
            'swift_bic': ('django.db.models.fields.CharField', [], {'max_length': '11', 'null': 'True', 'blank': 'True'}),
            'user_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True', 'primary_key': 'True'}),
            'vatin': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True', 'blank': 'True'}),
            'zip': ('django.db.models.fields.CharField', [], {'max_length': '16'})
        },
        'auth.group': {
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'})
        },
        'auth.permission': {
            'Meta': {'unique_together': "(('content_type', 'codename'),)"},
            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
        },
        'auth.user': {
            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}),
            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
        },
        'contenttypes.contenttype': {
            'Meta': {'unique_together': "(('app_label', 'model'),)", 'db_table': "'django_content_type'"},
            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
        },
        'countries.country': {
            'Meta': {'db_table': "'country'"},
            'iso': ('django.db.models.fields.CharField', [], {'max_length': '2', 'primary_key': 'True'}),
            'iso3': ('django.db.models.fields.CharField', [], {'max_length': '3', 'null': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
            'numcode': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True'}),
            'printable_name': ('django.db.models.fields.CharField', [], {'max_length': '128'})
        },
        'domain.domain': {
            'Meta': {'unique_together': "(('name', 'parent'),)", 'db_table': "'domain'"},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'ip': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ip.IP']"}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'child_set'", 'null': 'True', 'to': "orm['domain.Domain']"}),
            'profile': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['account.UserProfile']"})
        },
        'ip.ip': {
            'Meta': {'db_table': "'ip'"},
            'address': ('django.db.models.fields.IPAddressField', [], {'unique': 'True', 'max_length': '15'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
        },
        'web.phpini': {
            'Meta': {'db_table': "'php_ini'"},
            'allow_url_fopen': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
            'display_errors': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
            'domain': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['domain.Domain']", 'unique': 'True'}),
            'error_reporting': ('django.db.models.fields.CharField', [], {'default': "'E_ALL & ~E_NOTICE'", 'max_length': '255'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'log_errors': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
            'max_execution_time': ('django.db.models.fields.PositiveIntegerField', [], {'default': '30'}),
            'max_input_time': ('django.db.models.fields.PositiveIntegerField', [], {'default': '60'}),
            'memory_limit': ('django.db.models.fields.PositiveIntegerField', [], {'default': '128'}),
            'post_max_size': ('django.db.models.fields.PositiveIntegerField', [], {'default': '8'}),
            'register_globals': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
            'register_long_arrays': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
            'session_only_cookies': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
            'vhost': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['web.VHost']", 'unique': 'True', 'null': 'True'})
        },
        'web.vhost': {
            'Meta': {'db_table': "'vhost'"},
            'domain': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['domain.Domain']", 'unique': 'True'}),
            'forward_canonical': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'})
        },
        'web.vhostalias': {
            'Meta': {'db_table': "'vhost_alias'"},
            'domain': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['domain.Domain']", 'unique': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'vhost': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['web.VHost']"})
        }
    }

    complete_apps = ['web']


text:
package com.mcoding.base.product.bean.category;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

@ApiModel(value="产品分类")
public class ProductCategory implements Serializable {

	//##########后期添加的,请不要覆盖##############
    @ApiModelProperty("子类")
    private List<ProductCategory> childern;

    public List<ProductCategory> getChildern() {
    	return childern;
    }

    public void setChildern(List<ProductCategory> childern) {
    	this.childern = childern;
    }

//	/##################

	@ApiModelProperty("类目id")
    private Integer id;

    @ApiModelProperty("店铺id")
    private Integer storeId;

    @ApiModelProperty("类目名称")
    private String categoryName;

    @ApiModelProperty("父类id 0.顶级类目")
    private Integer categoryParentId;

    @ApiModelProperty("创建时间")
    private Date createTime;

    private static final long serialVersionUID = 1L;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getStoreId() {
        return storeId;
    }

    public void setStoreId(Integer storeId) {
        this.storeId = storeId;
    }

    public String getCategoryName() {
        return categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName == null ? null : categoryName.trim();
    }

    public Integer getCategoryParentId() {
        return categoryParentId;
    }

    public void setCategoryParentId(Integer categoryParentId) {
        this.categoryParentId = categoryParentId;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}


text:
/**
 * (c) 2017 Ángel Olea Gómez   www.ovalo-software.com
 *
 * Form generator
 *
 * ---------------- ------------------------------------------
 * 2017-02-05 01:36 - aolea - creation
 *
 */

var FormGen = function (_, h$, m$, options) {
  const self = this
  options = _.extendOwn({keyErrors:'error', keyData:'data'}, options || {})
  const ERR = options.keyErrors
  const DAT = options.keyData

  m$.klass('Form', [

  ])

  m$.addBaseAttr('form', _checkFormAttr, _.identity)

  self.Generator = function (meta) {

    meta = m$.assertMeta(meta)

    this.control = function () {

    }

    this.field = function () {

    }
  }

  const _DataField = m$.getKlass('DataField')
  const _FormField = m$.klass('FormField', _.concat(_DataField.attrs, []))

  self.control = function (dataType) {

  }

  self.field = function (formField) {
    const result = _Field.validate(meta)
    if (result[ERR]) return function () { return result[ERR] }
    meta = result[DAT]

    return function (context) {

    }
  }

  self.get = function (ref) {
    ref = ref.split('.')
    return function (context) {
      var _val = context
      for (var i = 0; i < ref.length; i++) {
        _val = _val[ref[i]]
        if (_val === undefined) return ref
      }
      return _val
    }
  }

  self.getData = function (context) {
    if (_.isObject(context) && !_.isUndefined(context[options.keyData])) return context[options.keyData]
    return {}
  }

  self.getDataField = function (fieldName) {
    return function (context) { return self.getData(context)[fieldName] }
  }

  var _attrsOf = function (theItem, attrs, fixed) {
    attrs = attrs || {};
    fixed = fixed || {};
    attrs.class = [theItem, attrs.class, fixed.class].join(' ');
    return _.extendOwn({}, fixed, attrs)
  };

  self.form = function (attrs, children) {
    return h$.table(_attrsOf(DEFS.SEL.form, attrs, _obj(DEFS.DATA.type, 'object')), h$.captureChildren(arguments, 1));
  };

  self.row = function (attrs, children) {
    return h$.tr(_attrsOf('row', attrs),
      h$.td(_attrsOf('rowTd', {}, {colspan:2}), h$.captureChildren(arguments, 1)));
  };

  self.rowField = function (attrs, label, control) {
    return h$.
    tr(_attrsOf('rowField', attrs),
      h$.td(_attrsOf('rowFieldLabel'), self.label(label)),
      h$.td(_attrsOf('rowFieldControl'), control));
  };

  self.rowButtons = self.row;

  self.field = function (attrs, label, control) {
    return h$.span(_attrsOf('field', attrs), self.label(label), control);
  };

  self.label = function (label) {
    if (!_.isString(label)) return label;
    return h$.label(_attrsOf('label'), label);
  };

  self.each = function (collection, variable, renderItem) {
    return function (context) {
      return _.map(collection(context), function (item) {
        var ctx = _.extendOwn({}, context);
        ctx[variable] = item;
        return renderItem(ctx);
      });
    }
  };

  self.getErrors = function (context) {
    if (_.isObject(context) && context[options.keyErrors] !== undefined) return context[options.keyErrors];
    return {};
  };

  self.getErrorField = function (fieldName) {
    return function (context) { return self.getErrors(context)[fieldName]; }
  };

  self.msgError = function (fieldName) {
    var _terr = self.getErrorField(fieldName);
    var _herr = self.span('error', _terr);
    return function (context) {
      if (_terr(context)) return _herr(context);
      return '';
    }
  };

  self.text = function (fieldName, attrs) {
    attrs = attrs || {};
    attrs.type = 'text';
    attrs.name = fieldName;
    attrs.class = '';
    attrs[DEFS.DATA.type] = 'string';
    attrs.value = self.getDataField(fieldName);
    return h$.input(attrs);
  };

  self.checkbox = function (fieldName, attrs) {
    attrs = attrs || {};
    attrs.type = 'checkbox';
    attrs[DEFS.DATA.type] = 'boolean';
    attrs.name = fieldName;
    attrs.checked = function (context) { return self.getDataField(fieldName)(context) ? 'checked' : undefined; };
    return h$.input(attrs);
  };

  self.select = function (name, options, attrs) {
    attrs = attrs || {};
    attrs.name = name;
    attrs[DEFS.DATA.type] = 'string';
    var value = self.getDataField(name);
    options = _.map(options, function (opts) {
      var txt = _.isArray(opts) ? opts[1] : opts;
      var val = _.isArray(opts) ? opts[0] : opts;
      opts = {value:val};
      if (val === value) opts.selected = 'selected';
      return h$.option(opts, txt);
    });
    return h$.select(attrs, options);
  };

  self.array = function (fieldName, editItem, options) {
    options = _.extendOwn({
      canAdd:true, canMove:false, canRemove:true, tdLevel:false, header:false
    }, options || {});
    var addButton = options.canAdd ? self.button.add : '';
    var moveButton = options.canMove ? self.button.move : '';
    var removeButton = options.canRemove ? self.button.remove : '';
    var _editItem = options.tdLevel ? editItem : h$.td({}, editItem);
    _editItem = h$.tr('ts-item', h$.td({}, moveButton, removeButton), _editItem);
    var _id = _.uniqueId('ts-items-');
    var jsMove = options.canMove ? '$(function () { Tornus.sortable("#'+_id+'") });' : '';
    return h$.
    div(_attrsOf('ts-array', _obj(DEFS.DATA.type, 'array'), _obj(DEFS.DATA.attr, fieldName)),
      h$.table({}, h$.tbody({class:DEFS.SEL.template, style:'display:none'}, _editItem)),
      h$.table({}, h$.tbody({class:'ts-items', id: _id}, options.header || '', function (context) {
          return _.map(self.getData(context)[fieldName], function (row) {
            return _editItem({data:row})
          });
        }
      )), addButton, h$.script({}, jsMove)
    );
  };

  self.button = {};

  self.button.add = h$.button({}, 'add')
  self.button.move = h$.button({}, 'move')
  self.button.remove = h$.button({}, 'remove')
  self.button.cancel = h$.button({}, 'cancel')
  self.button.create = h$.button({'data-verb':'create',
                                  'data-subject':'form'}, 'create')

  //var mergeHtmlAttrs = function (/* attr0, attr1, ... */) {
  //  var list = _.flatten(_.map(arguments, function(it) { return _.isString(it) ? {class:it} : it}));
  //  var css = _.map(list, function(it) { return it && it.class || ''}).join(' ');
  //  var res = _.extendOwn.apply(this, list);
  //  res.class = css;
  //  return res;
  //};
  //
  //self.command = function (tag, attrs, text, verb, subject) {
  //  var _attrs = mergeHtmlAttrs({
  //    'class':'ts-btn-command',
  //    'data-ts-verb':verb,
  //    'data-ts-subject':subject
  //  }, attrs);
  //  var _text = attrs.text;
  //  if (_text) delete attrs.text;
  //  else _text = '';
  //  return h$.tag(tag, _attrs, h$.t$(_text+' '+(text || '')));
  //};
  //
  //self.linkCommand = _.partial(self.command, 'a');
  //self.buttonCommand = _.partial(self.command, 'button');
  //
  //self.iconButton = function (themeItem, attrs) {
  //  var _attrs = mergeHtmlAttrs({}, options.theme[themeItem], attrs);
  //  var _text = _attrs.text;
  //  if (_text) delete _attrs.text;
  //  else _text = '';
  //  return h$.button(_attrs, _text)
  //};
  //
  //self.button = {};
  //
  //self.button.add = function () {
  //  return self.iconButton('buttonAdd', {
  //    'class':'ts-btn-add',
  //    'data-ts-add-clone': '/.ts-array/.ts-template>.ts-item',
  //    'data-ts-add-to': '/.ts-array/.ts-items'})
  //};
  //
  //self.button.move = function () {
  //  return self.iconButton('buttonMove', { 'class':'ts-btn-move ui-sortable-handle' })
  //};
  //
  //self.button.remove = function () {
  //  return self.iconButton('buttonRemove', {
  //    'class':'ts-btn-remove', 'data-ts-remove': '/.ts-item'
  //  })
  //};
  //
  //self.button.new = function (text) {
  //  return self.buttonCommand(options.theme.buttonNew, text || null, 'new');
  //};
  //
  //self.button.edit = function () {
  //  return self.buttonCommand(options.theme.buttonEdit, null, 'edit');
  //};
  //
  //self.button.create = function () {
  //  return self.buttonCommand(options.theme.buttonCreate, null, 'create');
  //};
  //
  //self.button.update = function () {
  //  return self.buttonCommand(options.theme.buttonUpdate, null, 'update');
  //};
  //
  //self.button.delete = function () {
  //  return self.buttonCommand(options.theme.buttonDelete, null, 'delete');
  //};
  //
  //self.button.cancel = function (verb) {
  //  return self.buttonCommand(options.theme.buttonCancel, null, verb);
  //};

};

module.exports = {
  FormGen: FormGen
};


text:
The rails tagged logger is awesome, but it's only available in rails. This gem makes it available for non-rails applications.

## Installation

Add this line to your application's Gemfile:

    gem 'tagged_logging'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install tagged_logging

## Usage

```{ruby}
    logger = TaggedLogging.new(Logger.new(STDERR))

    logger.tagged('MyApplication', Process.pid) do |l|
      l.debug 'Initializing application'

      tagged("Perform") do
        info("performing some task")
      end
    end
```

The above will print the following:

    [2012-12-15T14:52:10+05:30] - INFO - [MyApplication] [11321] - Initializing application
    [2012-12-15T14:52:10+05:30] - INFO - [MyApplication] [11321] [Perform] - performing some task

You can also push and pop tags as required to the same effect

```{ruby}
    logger = TaggedLogging.new(Logger.new(STDERR))

    logger.push_tags('MyApplication', Po)
      l.debug 'Initializing application'

      tagged("Perform") do
        info("performing some task")
      end
    end
```

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

# License

MIT License (see the LICENSE file)