text:
* apache-karaf-4.0.8
* apache-maven-3.3.9
* java version "1.8.0_91"

国内推荐使用aliyun的maven镜像:
```
	<mirror>
      <id>alimaven</id>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
      <mirrorOf>central</mirrorOf>
    </mirror>
```

## karaf常用命令
* `bundle:watch *`开发时监听SNAPSHOT版本的bundle,并及时自动更新
* 连接已经启动karaf `bin/client.bat`

## 1. 初识karaf,需手动安装依赖包
目标:

* 基于cxf提供rest接口,返回json数据
* 基于blueprint跨bundle调用bean

**安装cxf,支持rest**

	feature:repo-add cxf 3.1.5
	feature:install cxf http
	#feature:install cxf-jaxrs http-whiteboard

** 安装jackson依赖,使cxf支持json返回**

	install mvn:org.codehaus.jackson/jackson-core-asl/1.9.5
	install mvn:org.codehaus.jackson/jackson-mapper-asl/1.9.5
	install mvn:org.codehaus.jackson/jackson-jaxrs/1.9.5

	install mvn:org.slf4j/slf4j-api/1.6.1

	install mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.annotation.api/0.3

** 安装bundle,进行测试,测试地址:**

	install mvn:me.ezjs.quickstart.karaf/department-model/1.0-SNAPSHOT
	install mvn:me.ezjs.quickstart.karaf/department-server/1.0-SNAPSHOT

## 2. 创建feature,"自动"安装依赖包
通过feature方式安装bundle

	feature:repo-add mvn:me.ezjs.quickstart.karaf/department-feature/1.0-SNAPSHOT/xml/features

## 3. 连接Mysql数据库
参考[StackOverflow问答](http://stackoverflow.com/questions/31004170/com-mysql-jdbc-driver-not-found-by-bundle-in-karaf#answers),内容引用如下.

> Database drivers in OSGi are always a bit difficult as the most common approach outside OSGi using DriverManager is not really suitable for OSGi.

> The best approach in OSGi is to use a DataSourceFactory which is standardized by the OSGi alliance. Some database drivers already offer this. For others pax-jdbc provides an adapter. For mysql the second case applies.

即:在OSGI中应该使用符合OSGI联盟标准的DataSourceFactory.

#### 在karaf控制台操作
使用pax-jdbc连接数据库,以OSGI服务的形式提供,并在控制台测试

主要参考资料如下:

* [配置文件 Create DataSource from config](https://ops4j1.jira.com/wiki/display/PAXJDBC/Create+DataSource+from+config)
* [连接池 Pooling and XA support for DataSourceFactory](https://ops4j1.jira.com/wiki/display/PAXJDBC/Pooling+and+XA+support+for+DataSourceFactory)
* [Apache Karaf Tutorial Part 6 - Database Access](http://www.liquid-reality.de/display/liquid/2012/01/13/Apache+Karaf+Tutorial+Part+6+-+Database+Access)

在%KARAF_HOME%/etc目录下创建配置文件`org.ops4j.datasource-mysql-test.cfg`,内容如下
```
	osgi.jdbc.driver.class=com.mysql.jdbc.Driver
	osgi.jdbc.driver.name=mysql
	databaseName=test
	user=root
	password=root
	dataSourceName=test-mysql
```

在karaf控制台安装相关feature,并查看DataSourceFactory

	feature:repo-add pax-jdbc 0.8.0
	feature:install pax-jdbc-mysql pax-jdbc-config
	service:list DataSourceFactory

安装jdbc后,即可直接在karaf控制台执行sql

	feature:install jdbc
	jdbc:ds-list
	jdbc:tables test-mysql
	jdbc:execute test-mysql create table person (name varchar(100), twittername varchar(100))
	jdbc:execute test-mysql insert into person (name, twittername) values ('Christian Schneider', '@schneider_chris')
	jdbc:query test-mysql select * from person

#### 在bundle中使用camel-mybatis连接MySQL数据库,同样基于pax-jdbc创建的DataSourceFactory

参考Apache camel的[camel-examples-mybatis](https://github.com/apache/camel/tree/master/examples/camel-example-mybatis)`apache-camel-2.8.1/examples/camel-example-mybatis`, 其使用camel-mybatis连接Derby数据库,官方示例执行命令如下:

	feature:repo-add camel 2.18.1
	feature:install camel camel-mybatis
	bundle:install mvn:org.apache.derby/derby/10.11.1.1

安装测试bundle

	install mvn:me.ezjs.quickstart.karaf/department-model/1.0-SNAPSHOT
	install mvn:me.ezjs.quickstart.karaf/department-server/1.0-SNAPSHOT

	log:tail

**修改配置文件支持MySQL**

修改配置文件`department_model/src/main/resources/SqlMapConfig.xml`,即可连接MySQL数据库
> 配置参数参考网址[BasicDataSource Configuration Parameters](http://commons.apache.org/proper/commons-dbcp/configuration.html)
```
	<!--<property name="driver" value="org.apache.derby.jdbc.EmbeddedDriver"/>-->
	<!--<property name="url" value="jdbc:derby:memory:mybatis;create=true"/>-->
	<property name="driver" value="com.mysql.jdbc.Driver"/>
	<property name="url" value="jdbc:mysql://127.0.0.1:3306/test"/>
	<property name="username" value="root"/>
	<property name="password" value="root"/>
```

安装依赖,并测试

	feature:repo-add camel 2.18.1
	feature:install camel camel-mybatis

	feature:repo-add pax-jdbc 0.8.0
	feature:install pax-jdbc-mysql

	install mvn:me.ezjs.quickstart.karaf/department-model/1.0-SNAPSHOT
	install mvn:me.ezjs.quickstart.karaf/department-server/1.0-SNAPSHOT

	log:tail

## 3. 使用camel
**[URIs](http://camel.apache.org/uris.html)**

	feature:install camel-cxf

**Difference between using camel cxfrs and jaxrs server**
>First, these two are used to configure the server.
>But cxfrs:server is used to configure the server which is used by the camel-cxfrs to route the REST request to camel route, it doesn't invoke the resources classes instance method; jaxrs:server is used to expose the REST service which can accept the REST request and send response by invoke the resources classes instance that you configured.

install mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xalan/2.7.1_7
install mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.bcel/5.2_4


text:
package java.util.zip;

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

/**
 * This class implements a stream filter for writing compressed data in
 * the GZIP file format.
 * @author      David Connelly
 *
 */
public
class GZIPOutputStream extends DeflaterOutputStream {
    /**
     * CRC-32 of uncompressed data.
     */
    protected CRC32 crc = new CRC32();

    /*
     * GZIP header magic number.
     */
    private final static int GZIP_MAGIC = 0x8b1f;

    /*
     * Trailer size in bytes.
     *
     */
    private final static int TRAILER_SIZE = 8;

    /**
     * Creates a new output stream with the specified buffer size.
     *
     *
The new output stream instance is created as if by invoking
     * the 3-argument constructor GZIPOutputStream(out, size, false).
     *
     * @param out the output stream
     * @param size the output buffer size
     * @exception IOException If an I/O error has occurred.
     * @exception IllegalArgumentException if {@code size <= 0}
     */
    public GZIPOutputStream(OutputStream out, int size) throws IOException {
        this(out, size, false);
    }

    /**
     * Creates a new output stream with the specified buffer size and
     * flush mode.
     *
     * @param out the output stream
     * @param size the output buffer size
     * @param syncFlush
     *        if {@code true} invocation of the inherited
     *        {@link DeflaterOutputStream#flush() flush()} method of
     *        this instance flushes the compressor with flush mode
     *        {@link Deflater#SYNC_FLUSH} before flushing the output
     *        stream, otherwise only flushes the output stream
     * @exception IOException If an I/O error has occurred.
     * @exception IllegalArgumentException if {@code size <= 0}
     *
     * @since 1.7
     */
    public GZIPOutputStream(OutputStream out, int size, boolean syncFlush)
        throws IOException
    {
        super(out, new Deflater(Deflater.DEFAULT_COMPRESSION, true),
              size,
              syncFlush);
        usesDefaultDeflater = true;
        writeHeader();
        crc.reset();
    }

    /**
     * Creates a new output stream with a default buffer size.
     *
     *
The new output stream instance is created as if by invoking
     * the 2-argument constructor GZIPOutputStream(out, false).
     *
     * @param out the output stream
     * @exception IOException If an I/O error has occurred.
     */
    public GZIPOutputStream(OutputStream out) throws IOException {
        this(out, 512, false);
    }

    /**
     * Creates a new output stream with a default buffer size and
     * the specified flush mode.
     *
     * @param out the output stream
     * @param syncFlush
     *        if {@code true} invocation of the inherited
     *        {@link DeflaterOutputStream#flush() flush()} method of
     *        this instance flushes the compressor with flush mode
     *        {@link Deflater#SYNC_FLUSH} before flushing the output
     *        stream, otherwise only flushes the output stream
     *
     * @exception IOException If an I/O error has occurred.
     *
     * @since 1.7
     */
    public GZIPOutputStream(OutputStream out, boolean syncFlush)
        throws IOException
    {
        this(out, 512, syncFlush);
    }

    /**
     * Writes array of bytes to the compressed output stream. This method
     * will block until all the bytes are written.
     * @param buf the data to be written
     * @param off the start offset of the data
     * @param len the length of the data
     * @exception IOException If an I/O error has occurred.
     */
    public synchronized void write(byte[] buf, int off, int len)
        throws IOException
    {
        super.write(buf, off, len);
        crc.update(buf, off, len);
    }

    /**
     * Finishes writing compressed data to the output stream without closing
     * the underlying stream. Use this method when applying multiple filters
     * in succession to the same output stream.
     * @exception IOException if an I/O error has occurred
     */
    public void finish() throws IOException {
        if (!def.finished()) {
            def.finish();
            while (!def.finished()) {
                int len = def.deflate(buf, 0, buf.length);
                if (def.finished() && len <= buf.length - TRAILER_SIZE) {
                    // last deflater buffer. Fit trailer at the end
                    writeTrailer(buf, len);
                    len = len + TRAILER_SIZE;
                    out.write(buf, 0, len);
                    return;
                }
                if (len > 0)
                    out.write(buf, 0, len);
            }
            // if we can't fit the trailer at the end of the last
            // deflater buffer, we write it separately
            byte[] trailer = new byte[TRAILER_SIZE];
            writeTrailer(trailer, 0);
            out.write(trailer);
        }
    }

    /*
     * Writes GZIP member header.
     */
    private void writeHeader() throws IOException {
        out.write(new byte[] {
                      (byte) GZIP_MAGIC,        // Magic number (short)
                      (byte)(GZIP_MAGIC >> 8),  // Magic number (short)
                      Deflater.DEFLATED,        // Compression method (CM)
                      0,                        // Flags (FLG)
                      0,                        // Modification time MTIME (int)
                      0,                        // Modification time MTIME (int)
                      0,                        // Modification time MTIME (int)
                      0,                        // Modification time MTIME (int)
                      0,                        // Extra flags (XFLG)
                      0                         // Operating system (OS)
                  });
    }

    /*
     * Writes GZIP member trailer to a byte array, starting at a given
     * offset.
     */
    private void writeTrailer(byte[] buf, int offset) throws IOException {
        writeInt((int)crc.getValue(), buf, offset); // CRC-32 of uncompr. data
        writeInt(def.getTotalIn(), buf, offset + 4); // Number of uncompr. bytes
    }

    /*
     * Writes integer in Intel byte order to a byte array, starting at a
     * given offset.
     */
    private void writeInt(int i, byte[] buf, int offset) throws IOException {
        writeShort(i & 0xffff, buf, offset);
        writeShort((i >> 16) & 0xffff, buf, offset + 2);
    }

    /*
     * Writes short integer in Intel byte order to a byte array, starting
     * at a given offset
     */
    private void writeShort(int s, byte[] buf, int offset) throws IOException {
        buf[offset] = (byte)(s & 0xff);
        buf[offset + 1] = (byte)((s >> 8) & 0xff);
    }
}

redpajama_set_name: RedPajamaGithub


text:
@class OFTableSequenceControllerHelper;

@interface OFUserSettingActionCell : OFTableCellHelper<OFCallbackable>
{
@private
	OFTableSequenceControllerHelper* owner;
}

- (void)onResourceChanged:(OFResource*)resource;

@property (nonatomic, readonly, assign) IBOutlet OFTableSequenceControllerHelper* owner;

@end


text:
<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Connect with SoundCloud</title>

    This popup should automatically close in a few seconds


text:
from __future__ import unicode_literals

from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('securedpi_events', '0004_auto_20161013_0056'),
    ]

    operations = [
        migrations.AlterField(
            model_name='event',
            name='action',
            field=models.CharField(default='unlock', max_length=30),
        ),
    ]


text:
package main

type Config struct {
	Weather struct {
		Current struct {
			Temperature struct {
				Device string `json:"device"`
				Field  string `json:"field"`
			} `json:"temperature"`
			Humidity struct {
				Device string `json:"device"`
				Field  string `json:"field"`
			} `json:"humidity"`
		} `json:"current"`
	} `json:"weather"`
}


text:
import requests
import os

class DB():
    def __init__(self):
        self.base_url="https://jsonbin.org/me"
        self.DB_KEY=os.environ["DB_KEY"]
    def get(self,key):
        url=self.base_url+"/"+key
        headers={"authorization":"token {}".format(self.DB_KEY)}
        r=requests.get(url, headers=headers)
        if r.status_code!=200 or r.text=='null':
            return None
        return r.text
    def put(self,key,value):
        url=self.base_url
        payload={key:value}
        headers={"authorization":"token {}".format(self.DB_KEY)}
        r=requests.patch(url, headers=headers,data=payload)
        if r.status_code!=201:
            return -1
        return r.text
    def delete(self,key):
        url=self.base_url+"/"+key
        headers={"authorization":"token {}".format(self.DB_KEY)}
        r=requests.delete(url, headers=headers)
        if r.status_code!=200:
            return -1
        return 0


text:
<?xml version="1.0" encoding="UTF-8"?>
<sem:triples uri="http://www.lds.org/vrl/people/occupation/military/privets" xmlns:sem="http://marklogic.com/semantics">
  <sem:triple>
    <sem:subject>http://www.lds.org/vrl/people/occupation/military/privets</sem:subject>
    <sem:predicate>http://www.w3.org/2004/02/skos/core#prefLabel</sem:predicate>
    <sem:object datatype="xsd:string" xml:lang="eng">Privets</sem:object>
  </sem:triple>
  <sem:triple>
    <sem:subject>http://www.lds.org/vrl/people/occupation/military/privets</sem:subject>
    <sem:predicate>http://www.w3.org/2004/02/skos/core#inScheme</sem:predicate>
    <sem:object datatype="sem:iri">http://www.lds.org/concept-scheme/vrl</sem:object>
  </sem:triple>
  <sem:triple>
    <sem:subject>http://www.lds.org/vrl/people/occupation/military/privets</sem:subject>
    <sem:predicate>http://www.lds.org/core#entityType</sem:predicate>
    <sem:object datatype="sem:iri">http://www.schema.org/Place</sem:object>
  </sem:triple>
</sem:triples>


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Tools.Ribbon;

namespace OutlookJiraAddIn
{
    public partial class RibbonReadMessageTab
    {
        private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
        {
            ribbonExplorer.PopulateTemplatesFromDataModel();
        }
    }
}


text:
package org.apache.camel.spring;

import org.springframework.context.support.AbstractXmlApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Test for LifecycleStrategy injection.
 *
 * @version $Revision$
 */
public class LifecycleStrategyInjectionTest extends SpringTestSupport {

    @Override
    protected AbstractXmlApplicationContext createApplicationContext() {
        return new ClassPathXmlApplicationContext("org/apache/camel/spring/lifecycleStrategyInjection.xml");
    }

    public void testInjectedStrategy() throws Exception {
        assertEquals(2, context.getLifecycleStrategies().size());
        assertIsInstanceOf(DummyLifecycleStrategy.class, context.getLifecycleStrategies().get(1));
    }

}


text:
<?php

/**
 * helper class to display the right icon for different filetypes
 *
 * @version CVS: $Id: myFileIcon.class.php,v 1.12 2009/12/11 17:33:47 sanjeevan Exp $
 *
 */
class myFileIcon
{
  /**
   * maps file extensions to iconstype icons
   *
   * @var array
   */
  static $icon_map = array(
    'zip' => 'icons/page_white_compressed.png',
    'rar' => 'icons/page_white_compressed.png',

    // office
    'doc'   => 'icons/page_white_word.png',
    'docx'  => 'icons/page_white_word.png',
    'xls'   => 'icons/page_excel.png',
    'xlsx'  => 'icons/page_excel.png',
    'ppt'   => 'icons/page_white_powerpoint.png',
    'pptx'  => 'icons/page_white_powerpoint.png',
    'pub'   => 'icons/page_white_office.png',
    'mdb'   => 'icons/document-access.png',

    'txt' => 'icons/page_white_text.png',
    'pdf' => 'icons/page_white_acrobat.png',
    'rtf' => 'icons/page_white_text.png',

    // images
    'jpg' => 'icons/page_white_picture.png',
    'jpeg'=> 'icons/page_white_picture.png',
    'gif' => 'icons/page_white_picture.png',
    'png' => 'icons/page_white_picture.png',
    'bmp' => 'icons/page_white_picture.png',
    'psd' => 'icons/photoshop.png',

    // audio/video
    'wav' => 'icons/sound.png',
    'mp3' => 'icons/sound.png',
    'mov' => 'icons/television.png',
    'avi' => 'icons/television.png',
    'flv' => 'icons/page_white_flash.png',
    'wmv' => 'icons/television.png',
    '3gp' => 'icons/television.png',

    // misc
    'swf' => 'icons/page_white_flash.png'
  );

  /**
   * get icon for a file extension
   *
   * @param string $extension
   * @return string
   */
  static function getIconTagForExtension($extension)
  {
    $path = '';

    if (in_array($extension, array_keys(self::$icon_map)))
    {
      return image_tag(image_path(self::$icon_map[$extension]));
    }

    return image_tag(image_path('icons/package.png'));
  }

  /**
   * get path to mimetype icon for this file
   *
   * @param string $filename
   * @return string
   */
  static function getPath($filename)
  {
    $extension = myUtil::getFileExtension($filename);

    if (in_array($extension, array_keys(self::$icon_map)))
    {
      return image_path(self::$icon_map[$extension]);
    }
    else
    {
      return image_path('icons/package.png');
    }
  }

  /**
   * get html image tag for file's mimetype icon
   *
   * @param string $filename
   * @param array $options
   * @return string
   */
  static function getIconTag($filename, $options = null)
  {
    return image_tag(self::getPath($filename), $options);
  }

}
?>


text:
class Solution:
    def min_steps(self, piles):
        piles.sort(reverse = True)
        res = 0
        for i in range(1, len(piles)):
            if piles[i] != piles[i-1]:
                res += i
        return res


text:
import './vellum-monster.js'
import './vellum-npc.js'


text: Code 201 to AWWWWEEESSSOOOMMEEE!!!


text:
package com.linkedin.paldb.api;

import java.awt.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Arrays;
import org.testng.Assert;
import org.testng.annotations.Test;

public class TestConfiguration {

  @Test
  public void testConfiguration() {
    Configuration c = new Configuration();
    c.set("foo", "bar");
    Assert.assertEquals(c.get("foo", null), "bar");
    Assert.assertEquals(c.get("bar", "foo"), "foo");
  }

  @Test
  public void testConfigurationCopy() {
    Configuration c = new Configuration();
    c.set("foo", "bar");

    Configuration r = new Configuration(c);
    Assert.assertEquals(r.get("foo", null), "bar");

    c.set("foo", "");
    Assert.assertEquals(r.get("foo", null), "bar");
  }

  @Test(expectedExceptions = UnsupportedOperationException.class)
  public void testConfigurationReadOnly() {
    Configuration c = new Configuration();
    c.set("foo", "bar");

    Configuration r = new Configuration(c);
    r.set("foo", "bar");
  }

  @Test
  public void testEqualsEmpty() {
    Assert.assertEquals(new Configuration(), new Configuration());
  }

  @Test
  public void testEquals() {
    Configuration c1 = new Configuration();
    c1.set("foo", "bar");

    Configuration c2 = new Configuration();
    c2.set("foo", "bar");

    Configuration c3 = new Configuration();
    c3.set("foo", "notbar");

    Assert.assertEquals(c1, c2);
    Assert.assertNotEquals(c1, c3);
  }

  @Test
  public void testGetBoolean() {
    Configuration c = new Configuration();
    c.set("foo", "true");
    c.set("bar", "false");

    Assert.assertTrue(c.getBoolean("foo"));
    Assert.assertFalse(c.getBoolean("bar"));
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testGetBooleanMissing() {
    new Configuration().getBoolean("foo");
  }

  @Test
  public void testGetBooleanDefault() {
    Configuration c = new Configuration();
    c.set("foo", "true");

    Assert.assertTrue(c.getBoolean("foo", false));
    Assert.assertTrue(c.getBoolean("bar", true));
  }

  @Test
  public void testGetDouble() {
    Configuration c = new Configuration();
    c.set("foo", "1.0");

    Assert.assertEquals(c.getDouble("foo"), 1.0);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testGetDoubleMissing() {
    new Configuration().getDouble("foo");
  }

  @Test
  public void testGetDoubleDefault() {
    Configuration c = new Configuration();
    c.set("foo", "1.0");

    Assert.assertEquals(c.getDouble("foo", 2.0), 1.0);
    Assert.assertEquals(c.getDouble("bar", 2.0), 2.0);
  }

  @Test
  public void testGetFloat() {
    Configuration c = new Configuration();
    c.set("foo", "1.0");

    Assert.assertEquals(c.getFloat("foo"), 1f);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testGetFloatMissing() {
    new Configuration().getFloat("foo");
  }

  @Test
  public void testGetFloatDefault() {
    Configuration c = new Configuration();
    c.set("foo", "1.0");

    Assert.assertEquals(c.getFloat("foo", 2f), 1f);
    Assert.assertEquals(c.getFloat("bar", 2f), 2f);
  }

  @Test
  public void testGetInt() {
    Configuration c = new Configuration();
    c.set("foo", "1");

    Assert.assertEquals(c.getInt("foo"), 1);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testGetIntMissing() {
    new Configuration().getInt("foo");
  }

  @Test
  public void testGetIntDefault() {
    Configuration c = new Configuration();
    c.set("foo", "1");

    Assert.assertEquals(c.getInt("foo", 2), 1);
    Assert.assertEquals(c.getInt("bar", 2), 2);
  }

  @Test
  public void testGetShort() {
    Configuration c = new Configuration();
    c.set("foo", "1");

    Assert.assertEquals(c.getShort("foo"), (short) 1);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testGetShortMissing() {
    new Configuration().getShort("foo");
  }

  @Test
  public void testGetShortDefault() {
    Configuration c = new Configuration();
    c.set("foo", "1");

    Assert.assertEquals(c.getShort("foo", (short) 2), (short) 1);
    Assert.assertEquals(c.getShort("bar", (short) 2), (short) 2);
  }

  @Test
  public void testGetLong() {
    Configuration c = new Configuration();
    c.set("foo", "1");

    Assert.assertEquals(c.getLong("foo"), 1l);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testGetLongMissing() {
    new Configuration().getLong("foo");
  }

  @Test
  public void testGetLongDefault() {
    Configuration c = new Configuration();
    c.set("foo", "1");

    Assert.assertEquals(c.getLong("foo", 2l), 1l);
    Assert.assertEquals(c.getLong("bar", 2l), 2l);
  }

  @Test
  public void testGetClass()
      throws ClassNotFoundException {
    Configuration c = new Configuration();
    c.set("foo", Integer.class.getName());

    Assert.assertEquals(c.getClass("foo"), Integer.class);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testGetClassMissing()
      throws ClassNotFoundException {
    new Configuration().getClass("foo");
  }

  @Test
  public void testGetList() {
    Configuration c = new Configuration();
    c.set("foo", "foo,bar");

    Assert.assertEquals(c.getList("foo"), Arrays.asList("foo", "bar"));
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testGetListMissing() {
    new Configuration().getList("foo");
  }

  @Test
  public void testGetListDefault() {
    Configuration c = new Configuration();
    c.set("foo", "foo,bar");

    Assert.assertEquals(c.getList("foo", Arrays.asList("that")), Arrays.asList("foo", "bar"));
    Assert.assertEquals(c.getList("bar", Arrays.asList("that")), Arrays.asList("that"));
  }

  @Test
  public void testSerialization()
      throws Throwable {
    Configuration c = new Configuration();
    c.set("foo", "bar");
    c.registerSerializer(new PointSerializer());

    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream out = new ObjectOutputStream(bos);
    out.writeObject(c);
    out.close();
    bos.close();

    byte[] bytes = bos.toByteArray();
    ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
    ObjectInputStream in = new ObjectInputStream(bis);
    Configuration sc = (Configuration) in.readObject();
    in.close();
    bis.close();

    Assert.assertEquals(sc, c);
  }

  // UTILITY

  public static class PointSerializer implements Serializer<Point> {

    @Override
    public Point read(DataInput input) {
      return null;
    }

    @Override
    public void write(DataOutput output, Point input) {

    }

    @Override
    public int getWeight(Point instance) {
      return 0;
    }
  }
}


text:
module Vertica
  module Protocol
    class ErrorResponse < NoticeResponse
      message_id 'E'
    end
  end
end


text:
/**
 * Typescript type definition file.
 */

import * as angular from "angular";

declare module "angular" {
    export namespace RzSlider {
        type RzLabelType = "model"|"high"|"floor"|"ceil"|"tick-value";
        type RzPointerType = "min"|"max";
        type RzCallback = (id: string, modelValue: number, highValue: number, pointerType: "min"|"max") => void;
        type RzTranslate = (value: number, sliderId: string, label: RzLabelType) => string;

        /** RZ slider options typing */
        interface RzOptions {
            /** Number (defaults to 0): Minimum value for a slider. */
            floor?: number;
            /** Number (defaults to rz-slider-modelvalue): Maximum value for a slider. */
            ceil?: number;
            /** Number (defaults to 1): Step between each value. */
            step?: number;
            /** Number (defaults to 0): The precision to display values with. The toFixed() is used internally for this. */
            precision?: number;
            /** Number (defaults to null): The minimum value authorized on the slider. */
            minLimit?: number;
            /** Number (defaults to null): The maximum value authorized on the slider. */
            maxLimit?: number;
            /**
             * Object(defaults to null): Has two _Number_ properties, _from_ and _to_ that determine
             * the bounds of an area that is not authorized for values. _Applies to range slider only._
             */
            restrictedRange?: { from: number, to: number }
            /** Number (defaults to null): The minimum range authorized on the slider. Applies to range slider only. */
            minRange?: number;
            /** Number (defaults to null): The maximum range authorized on the slider. Applies to range slider only. */
            maxRange?: number;
            /**
             * Boolean (defaults to false): Set to true to have a push behavior. When the min handle goes above the max,
             * the max is moved as well (and vice-versa). The range between min and max is defined by the step option
             * (defaults to 1) and can also be override by the minRange option. Applies to range slider only.
             */
            pushRange?: boolean;
            /**
             * Custom translate function. Use this if you want to translate values displayed on the slider.
             * sliderId can be used to determine the slider for which we are translating the value.
             * label is a string that can take the following values:
             * 'model': the model label
             * 'high': the high label
             * 'floor': the floor label
             * 'ceil': the ceil label
             * 'tick-value': the ticks labels
             */
            translate?: RzTranslate;
            /**
             * Function(value, sliderId): Use to display legend under ticks. The function will be called with each tick
             * value and returned content will be displayed under the tick as a legend. If the returned value is null,
             * then no legend is displayed under the corresponding tick.
             */
            getLegend?: (value: number, sliderId: string) => string;
            /**
             * Any (defaults to null): If you want to use the same translate function for several sliders,
             * just set the id to anything you want, and it will be passed to the translate(value, sliderId)
             * function as a second argument.
             */
            id?: string;
            /**
             * Array: If you want to display a slider with non linear/number steps. Just pass an array with each slider
             * value and that's it; the floor, ceil and step settings of the slider will be computed automatically.
             * By default, the rz-slider-model and rz-slider-high values will be the value of the selected item in the stepsArray.
             * They can also be bound to the index of the selected item by setting the bindIndexForStepsArray option to true.
             *
             * stepsArray can also be an array of objects like:
             * [
             * {value: 'A'}, // the display value will be *A*
             * {value: 10, legend: 'Legend for 10'} // the display value will be 10 and a legend will be displayed under the corresponding tick.
             * ]
             */
            stepsArray?: number[] | Array<{value: number; legend?: string}>;
            /**
             * Boolean (defaults to false): Set to true to bind the index of the selected item to rz-slider-model and rz-slider-high.
             * (This was the default behavior prior to 4.0).
             */
            bindIndexForStepsArray?: boolean;
            /** Boolean (defaults to false): When set to true and using a range slider, the range can be dragged by the selection bar. Applies to range slider only. */
            draggableRange?: boolean;
            /** Boolean (defaults to false): Same as draggableRange but the slider range can't be changed. Applies to range slider only. */
            draggableRangeOnly?: boolean;
            /** Boolean (defaults to false): Set to true to always show the selection bar before the slider handle. */
            showSelectionBar?: boolean;
            /** Boolean (defaults to false): Set to true to always show the selection bar after the slider handle. */
            showSelectionBarEnd?: boolean;
            /** Boolean (defaults to false): Only for range slider. Set to true to visualize in different colour the areas on the left/right (top/bottom for vertical range slider) of selection bar between the handles. */
            showOuterSelectionBars?: boolean;
            /** Number (defaults to null): Set a number to draw the selection bar between this value and the slider handle. */
            showSelectionBarFromValue?: number;
            /**
             * Function(value) or Function(minVal, maxVal) (defaults to null): Function that returns the current color of the
             * selection bar. If your color won't changed, don't use this option but set it through CSS. If the returned color
             * depends on a model value (either rzScopeModelor 'rzSliderHigh), you should use the argument passed to the function.
             * Indeed, when the function is called, there is no certainty that the model has already been updated.
             */
            getSelectionBarColor?: (minVal: number, maxVal?: number) => string;
            /** Function(value) (defaults to null): Function that returns the color of a tick. showTicks must be enabled. */
            getTickColor?: (value: number) => string;
            /**
             * Function(value, pointerType) (defaults to null): Function that returns the current color of a pointer.
             * If your color won't changed, don't use this option but set it through CSS. If the returned color depends
             * on a model value (either rzScopeModelor 'rzSliderHigh), you should use the argument passed to the function.
             * Indeed, when the function is called, there is no certainty that the model has already been updated.
             * To handle range slider pointers independently, you should evaluate pointerType within the given function
             * where "min" stands for rzScopeModel and "max" for rzScopeHigh values.
             */
            getPointerColor?: (value: number, pointerType: RzPointerType) => string;
            /** Boolean (defaults to false): Set to true to hide pointer labels */
            hidePointerLabels?: boolean;
            /** Boolean (defaults to false): Set to true to hide min / max labels */
            hideLimitLabels?: boolean;
            /** Boolean (defaults to true): Set to false to disable the auto- hiding behavior of the limit labels. */
            autoHideLimitLabels?: boolean;
            /** Boolean (defaults to false): Set to true to make the slider read-only. */
            readOnly?: boolean;
            /** Boolean (defaults to false): Set to true to disable the slider. */
            disabled?: boolean;
            /**
             * Number in ms (defaults to 350): Internally, a throttle function (See http://underscorejs.org/#throttle) is used
             * when the model or high values of the slider are changed from outside the slider. This is to prevent from re-rendering
             * the slider too many times in a row. interval is the number of milliseconds to wait between two updates of the slider.
             */
            interval?: number;
            /** Boolean or Number (defaults to false): Set to true to display a tick for each step of the slider. Set an integer to display ticks at intermediate positions. */
            showTicks?: boolean | number;
            /** Boolean or Number (defaults to false): Set to true to display a tick and the step value for each step of the slider. Set an integer to display ticks and the step value at intermediate positions. */
            showTicksValues?: boolean | number;
            /** Array (defaults to null): Use to display ticks at specific positions. The array contains the index of the ticks that should be displayed. For example, [0, 1, 5] will display a tick for the first, second and sixth values. It also supports the { value: 0, legend: 'Bad' } format to display a legend for each tick. */
            ticksArray?: number[] | Array<{value: number; legend?: string}>;
            /** Function(value) (defaults to null): (requires angular-ui bootstrap) Used to display a tooltip when a tick is hovered. Set to a function that returns the tooltip content for a given value. */
            ticksTooltip?: (value: number) => string;
            /** Function(value) (defaults to null): Same as ticksTooltip but for ticks values. */
            ticksValuesTooltip?: (value: number) => string;
            /** Number (defaults to 1): If you display the slider in an element that uses transform: scale(0.5), set the scale value to 2 so that the slider is rendered properly and the events are handled correctly. */
            scale?: number;
            /** Boolean (defaults to true): Set to true to force the value to be rounded to the step, even when modified from the outside.. When set to false, if the model values are modified from outside the slider, they are not rounded and can be between two steps. */
            enforceStep?: boolean;
            /** Boolean (defaults to false): Set to true to round the rzSliderModel and rzSliderHigh to the slider range even when modified from outside the slider. When set to false, if the model values are modified from outside the slider, they are not rounded but they are still rendered properly on the slider. */
            enforceRange?: boolean;
            /** Boolean (defaults to false): Set to true to prevent to user from switching the min and max handles. Applies to range slider only. */
            noSwitching?: boolean;
            /** Boolean (defaults to false): Set to true to only bind events on slider handles. */
            onlyBindHandles?: boolean;
            /** Boolean (defaults to true): Set to true to keep the slider labels inside the slider bounds. */
            boundPointerLabels?: boolean;
            /** Boolean (defaults to false): Set to true to merge the range labels if they are the same. For instance, if min and max are 50, the label will be "50 - 50" if mergeRangeLabelsIfSame: false, else "50". */
            mergeRangeLabelsIfSame?: boolean;
            /** String (defaults to ' - '): Separator to use when the labels overlap. For instance, if min and max are -1 and 1, the label will be "-1 .. 1" if `labelOverlapSeparator: ' .. '`. */
            labelOverlapSeparator?: string;
            /** Function(sliderId, modelValue, highValue, pointerType): Function to be called when a slider update is started. If an id was set in the options, then it's passed to this callback. This callback is called before any update on the model. pointerType is either 'min' or 'max' depending on which handle is used. */
            onStart?: RzCallback;
            /**
             * Function to be called when rz-slider-model or rz-slider-high change. If an id was set in the options,
             * then it's passed to this callback. pointerType is either 'min' or 'max' depending
             * on which handle is used.
             */
            onChange?: RzCallback;
            /** Function(sliderId, modelValue, highValue, pointerType): Function to be called when a slider update is ended. If an id was set in the options, then it's passed to this callback. pointerType is either 'min' or 'max' depending on which handle is used. */
            onEnd?: RzCallback;
            /** Boolean (defaults to false): Set to true to show graphs right to left. If vertical is true it will be from top to bottom and left / right arrow functions reversed. */
            rightToLeft?: boolean;
            /**
             * Boolean (defaults to false): Set to true to display the slider vertically. The slider will take the full height of its parent.
             * Changing this value at runtime is not currently supported.
             */
            vertical?: boolean;
            /**
             * Boolean (defaults to true): Handles are focusable (on click or with tab) and can be modified using the following keyboard controls:
             *   - Left/bottom arrows: -1
             *   - Right/top arrows: +1
             *   - Page-down: -10%
             *   - Page-up: +10%
             *   - Home: minimum value
             *   - End: maximum value
             */
            keyboardSupport?: boolean;
            /**
             * Boolean (defaults to false): Set to true to reverse keyboard navigation:
             *  - Right/top arrows: -1
             *  - Left/bottom arrows: +1
             *  - Page-up: -10%
             *  - Page-down: +10%
             *  - End: minimum value
             *  - Home: maximum value
             */
            reversedControls?: boolean;
            /** Object (default to null): The properties defined in this object will be exposed in the slider template under custom.X. */
            customTemplateScope?: any;
            /** Boolean (defaults to false): Set to true to use a logarithmic scale to display the slider. */
            logScale?: boolean;
            /** Function(val, minVal, maxVal): percent: Function that returns the position on the slider for a given value.The position must be a percentage between 0 and 1. */
            customValueToPosition?: (val: number, minVal: number, maxVal: number) => number;
            /** Function(percent, minVal, maxVal): value: Function that returns the value for a given position on the slider. The position is a percentage between 0 and 1. */
            customPositionToValue?: (percent: number, minVal: number, maxVal: number) => number;
            /** Object(default to null): Use to display the selection bar as a gradient. The given object must contain from and to properties which are colors. */
            selectionBarGradient?: {from: string, to: string};
            /** String(default to null): Use to add a label directly to the slider(s) for accessibility. Adds the aria-label attribute. */
            ariaLabel?: string;
            /** String(default to null): Use to add a label directly to the slider(s) for accessibility. Adds the aria-label attribute. */
            ariaLabelHigh?: string;
            /** String(default to null): Use instead of ariaLabel and ariaLabelHigh to reference the id of an element which will be used to label the slider(s). Adds the aria-labelledby attribute. */
            ariaLabelledBy?: string;
            /** String(default to null): Use instead of ariaLabel and ariaLabelHigh to reference the id of an element which will be used to label the slider(s). Adds the aria-labelledby attribute. */
            ariaLabelledByHigh?: string;
            /** Boolean (defaults to false): Set to true to disable slider animation. */
            disableAnimation?: boolean;
        }
    }
}


text:
"""
Django settings for cajadoarquitetura project.

For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""

from os.path import abspath, dirname, join

# Absolute filesystem path to the Django project directory:
PROJECT_ROOT = dirname(dirname(dirname(abspath(__file__))))

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '-%xk6jpe2#i$5hf=7v(sef*q#ur6+=cgly@92+-gecv3-$e^-n'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

TEMPLATE_DEBUG = True

ALLOWED_HOSTS = []

# Application definition

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    'compressor',
    'taggit',
    'modelcluster',

    'wagtail.wagtailcore',
    'wagtail.wagtailadmin',
    'wagtail.wagtaildocs',
    'wagtail.wagtailsnippets',
    'wagtail.wagtailusers',
    'wagtail.wagtailsites',
    'wagtail.wagtailimages',
    'wagtail.wagtailembeds',
    'wagtail.wagtailsearch',
    'wagtail.wagtailredirects',
    'wagtail.wagtailforms',

    'core',
)

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',

    'wagtail.wagtailcore.middleware.SiteMiddleware',
    'wagtail.wagtailredirects.middleware.RedirectMiddleware',
)

ROOT_URLCONF = 'cajadoarquitetura.urls'
WSGI_APPLICATION = 'cajadoarquitetura.wsgi.application'

# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases

# SQLite (simplest install)
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': join(PROJECT_ROOT, 'db.sqlite3'),
    }
}

# PostgreSQL (Recommended, but requires the psycopg2 library and Postgresql development headers)
# DATABASES = {
#     'default': {
#         'ENGINE': 'django.db.backends.postgresql_psycopg2',
#         'NAME': 'cajadoarquitetura',
#         'USER': 'postgres',
#         'PASSWORD': '',
#         'HOST': '',  # Set to empty string for localhost.
#         'PORT': '',  # Set to empty string for default.
#         'CONN_MAX_AGE': 600,  # number of seconds database connections should persist for
#     }
# }

# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/

LANGUAGE_CODE = 'en-gb'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/

STATIC_ROOT = join(PROJECT_ROOT, 'static')
STATIC_URL = '/static/'

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'compressor.finders.CompressorFinder',
)

MEDIA_ROOT = join(PROJECT_ROOT, 'media')
MEDIA_URL = '/media/'

# Django compressor settings
# http://django-compressor.readthedocs.org/en/latest/settings/

COMPRESS_PRECOMPILERS = (
    ('text/x-scss', 'django_libsass.SassCompiler'),
)

# Template configuration

from django.conf import global_settings

TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + (
    'django.core.context_processors.request',
)

# Wagtail settings

LOGIN_URL = 'wagtailadmin_login'
LOGIN_REDIRECT_URL = 'wagtailadmin_home'

WAGTAIL_SITE_NAME = "cajadoarquitetura"

# Use Elasticsearch as the search backend for extra performance and better search results:
# http://wagtail.readthedocs.org/en/latest/howto/performance.html#search
# http://wagtail.readthedocs.org/en/latest/core_components/search/backends.html#elasticsearch-backend
#
# WAGTAILSEARCH_BACKENDS = {
#     'default': {
#         'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch.ElasticSearch',
#         'INDEX': 'cajadoarquitetura',
#     },
# }

# Whether to use face/feature detection to improve image cropping - requires OpenCV
WAGTAILIMAGES_FEATURE_DETECTION_ENABLED = False


text:
\documentclass[a4paper]{book}
\usepackage{makeidx}
\usepackage{natbib}
\usepackage{graphicx}
\usepackage{multicol}
\usepackage{float}
\usepackage{listings}
\usepackage{color}
\usepackage{ifthen}
\usepackage[table]{xcolor}
\usepackage{textcomp}
\usepackage{alltt}
\usepackage{ifpdf}
\ifpdf
\usepackage[pdftex,
            pagebackref=true,
            colorlinks=true,
            linkcolor=blue,
            unicode
           ]{hyperref}
\else
\usepackage[ps2pdf,
            pagebackref=true,
            colorlinks=true,
            linkcolor=blue,
            unicode
           ]{hyperref}
\usepackage{pspicture}
\fi
\usepackage[utf8]{inputenc}
\usepackage{mathptmx}
\usepackage[scaled=.90]{helvet}
\usepackage{courier}
\usepackage{sectsty}
\usepackage[titles]{tocloft}
\usepackage{doxygen}
\lstset{language=C++,inputencoding=utf8,basicstyle=\footnotesize,breaklines=true,breakatwhitespace=true,tabsize=8,numbers=left }
\makeindex
\setcounter{tocdepth}{3}
\renewcommand{\footrulewidth}{0.4pt}
\renewcommand{\familydefault}{\sfdefault}
\hfuzz=15pt
\setlength{\emergencystretch}{15pt}
\hbadness=750
\tolerance=750
\begin{document}
\hypersetup{pageanchor=false,citecolor=blue}
\begin{titlepage}
\vspace*{7cm}
\begin{center}
{\Large \-My \-Project }\\
\vspace*{1cm}
{\large \-Generated by Doxygen 1.7.6.1}\\
\vspace*{0.5cm}
{\small Mon Nov 17 2014 21:06:56}\\
\end{center}
\end{titlepage}
\clearemptydoublepage
\pagenumbering{roman}
\tableofcontents
\clearemptydoublepage
\pagenumbering{arabic}
\hypersetup{pageanchor=true,citecolor=blue}
\chapter{\-Class \-Index}
\input{annotated}
\chapter{\-Class \-Documentation}
\input{classCommandListener}
\input{classFrameListener}
\input{classLabeledMarker}
\input{classMarkerSet}
\input{classMocapFrame}
\input{classNatNet}
\input{classNatNetPacket}
\input{classNatNetSender}
\input{classPoint3f}
\input{classQuaternion4f}
\input{classRigidBody}
\input{classSkeleton}
\printindex
\end{document}


text:
<?php
/**
 * Created by PhpStorm.
 * User: Magdalena
 * Date: 2016-01-13
 * Time: 18:25
 */

namespace Itav;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\EventDispatcher\Event;

class ResponseEvent extends Event
{
    private $request;
    private $response;

    public function __construct(Response $response, Request $request)
    {
        $this->response = $response;
        $this->request = $request;
    }

    public function getResponse()
    {
        return $this->response;
    }

    public function getRequest()
    {
        return $this->request;
    }
}


text:
package org.apache.camel.component.spring.ws.bean;

import org.springframework.util.Assert;
import org.springframework.ws.context.MessageContext;
import org.springframework.ws.server.endpoint.MessageEndpoint;
import org.springframework.ws.server.endpoint.mapping.AbstractMapBasedEndpointMapping;

/**
 * Spring {@link MessageEndpoint} for dispatching messages received by Spring-WS to a Camel
 * endpoint. This class needs to be registered in the Spring <tt>ApplicationContext</tt>
 * when consuming messages using the <tt>spring-ws:beanname:</tt> URI scheme.
 *

 * For example, when using a route such as <tt>from("spring-ws:beanname:stockQuote").to("...");</tt>
 * the following bean definition needs to be present in the <tt>ApplicationContext</tt>:
 *

 * {@code
 * <bean id="stockQuote" class="org.apache.camel.component.spring.ws.bean.CamelEndpointDispatcher" />
 * }
 *
 * @see AbstractMapBasedEndpointMapping#setMappings(java.util.Properties)
 * @see AbstractMapBasedEndpointMapping#setEndpointMap(java.util.Map)
 */
public class CamelEndpointDispatcher implements MessageEndpoint {

    private MessageEndpoint consumerMessageEndpoint;

    public void invoke(MessageContext messageContext) throws Exception {
        Assert.notNull(consumerMessageEndpoint);
        consumerMessageEndpoint.invoke(messageContext);
    }

    public MessageEndpoint getConsumerMessageEndpoint() {
        return consumerMessageEndpoint;
    }

    public void setConsumerMessageEndpoint(MessageEndpoint consumer) {
        this.consumerMessageEndpoint = consumer;
    }
}


text:
package com.ozbilgic.java.samples.DatabaseSample;

import java.sql.*;

/**
 * @author Vision2
 * @version 0.0.0.1
 * @since 20.12.2014
 */
public class ConnectDatabase implements DataSource {
    private Connection connection;
    private Statement statement;
    private ResultSet resultSet;
    private String dbPath;
    private final String URL = "jdbc:sqlite:";
    private boolean connectionStatus;

    public ConnectDatabase(String dbPath) {
        this.dbPath = dbPath;
    }

    @Override
    public void connect() {
        try {
            Class.forName("org.sqlite.JDBC").newInstance();
            connection = DriverManager.getConnection(URL+dbPath);
            statement = connection.createStatement();
            resultSet = statement.executeQuery("SELECT * FROM ANATABLO");
            connectionStatus = true;
        } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | SQLException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void disconnect() {
        try {
            connection.close();
            connectionStatus = false;
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    @Override
    public boolean isConnectionStatus() {
        return connectionStatus;
    }

    @Override
    public void setData(String isim, String tel) {
        try {
            if (!isConnectionStatus()) connect();
            statement.executeUpdate("INSERT INTO ANATABLO (ISIM, TEL) VALUES ('"+isim+"', '"+tel+"')");
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            if (isConnectionStatus()) disconnect();
        }
    }

    @Override
    public void getAllData() {
        try {
            if (!isConnectionStatus()) connect();
            while (resultSet.next()) {
                System.out.println(resultSet.getInt("IDX")+" "+resultSet.getString("ISIM")+" "+resultSet.getString("TEL"));
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            if (isConnectionStatus()) disconnect();
        }
    }
}


text:
<tool id="snpEff" name="SnpEff" version="@WRAPPER_VERSION@.0">
    <description>Variant effect and annotation</description>
    <macros>
        <import>snpEff_macros.xml</import>
    </macros>
    <expand macro="requirements" />
    <expand macro="stdio" />
    <expand macro="version_command" />
    <command>
<![CDATA[
        @CONDA_SNPEFF_JAR_PATH@ &&
        java -Xmx6G -jar "\$SNPEFF_JAR_PATH/snpEff.jar" eff
        -c "\$SNPEFF_JAR_PATH/snpEff.config"
        -i $inputFormat -o ${outputConditional.outputFormat} -upDownStreamLen $udLength
        #if $spliceSiteSize and str($spliceSiteSize) != '':
          -spliceSiteSize "$spliceSiteSize"
        #end if
        #if $spliceRegion.setSpliceRegions == 'yes':
          #if $spliceRegion.spliceRegionExonSize and str($spliceRegion.spliceRegionExonSize) != '':
            -spliceRegionExonSize $spliceRegion.spliceRegionExonSize
          #end if
          #if $spliceRegion.spliceRegionIntronMin and str($spliceRegion.spliceRegionIntronMin) != '':
            -spliceRegionIntronMin $spliceRegion.spliceRegionIntronMin
          #end if
          #if $spliceRegion.spliceRegionIntronMax and str($spliceRegion.spliceRegionIntronMax) != '':
            -spliceRegionIntronMax $spliceRegion.spliceRegionIntronMax
          #end if
        #end if
        #if $annotations and str($annotations) != '':
          #echo " "
          #echo ' '.join(str($annotations).split(','))
        #end if
        #if $filterOut and str($filterOut) != '':
          #echo " "
          #echo ' '.join(str($filterOut).split(','))
        #end if
        #if $filter.specificEffects == 'yes' and $filter.effects:
          #for $eff in str($filter.effects).split(','):
            -no $eff
          #end for
        #end if
        #if str( $transcripts ) != 'None':
          -onlyTr $transcripts
        #end if
        #if str( $intervals ) != 'None':     ### fix this for multiple dataset input
          -interval $intervals
        #end if
        #if $statsFile:
          -stats $statsFile
        #end if
        #if str($offset) != 'default':
          ${offset}
        #end if
        #if str($chr).strip() != '':
          -chr "$chr"
        #end if
          $noLog
        #if $snpDb.genomeSrc == 'cached':
          -dataDir ${snpDb.genomeVersion.fields.path}
          #if $snpDb.extra_annotations and str($snpDb.extra_annotations) != '':
            #echo " "
            #echo ' '.join(str($snpDb.extra_annotations).split(','))
          #end if
          #if $snpDb.regulation and str($snpDb.regulation) != '':
            -reg #echo ' -reg '.join(str($snpDb.regulation).split(','))#
          #end if
          $snpDb.genomeVersion
        #elif $snpDb.genomeSrc == 'history':
          -dataDir ${snpDb.snpeff_db.extra_files_path}
          #if $snpDb.extra_annotations and str($snpDb.extra_annotations) != '':
            #set xannotations = [' '] + str($snpDb.extra_annotations).split(',')
            #echo " "
            #echo ' -'.join($xannotations)
          #end if
          #if $snpDb.regulation and str($snpDb.regulation) != '':
            -reg #echo ' -reg '.join(str($snpDb.regulation).split(','))#
          #end if
          ${snpDb.snpeff_db.metadata.genome_version}
        #else
          -download
          $snpDb.genome_version
        #end if
        "$input" > "$snpeff_output";
        #if $statsFile:
            #import os
            #set $genes_file = str($statsFile) + '.genes.txt'
            #set $genes_file_name = os.path.split($genes_file)[-1]
            mkdir $statsFile.files_path;
            mv "$genes_file" #echo os.path.join($statsFile.files_path, $genes_file_name)#;
        #end if
        #if $outputConditional.outputFormat == 'gatk' and $outputConditional.gatk_v1
          ## Replace real SnpEff version with 2.0.5 to prevent this GATK 1.x error: "The version of SnpEff used to generate the SnpEff input file (x.x) is not currently supported by the GATK. Supported versions are: [2.0.5]"
          sed -i.bak -e 's/^\#\#SnpEffVersion="\(\S*\s\)/\#\#SnpEffVersion="2.0.5 - real is \1/' "$snpeff_output"
        #end if
]]>
    </command>
    <inputs>
        <param format="vcf,tabular,pileup,bed" name="input" type="data" label="Sequence changes (SNPs, MNPs, InDels)"/>

        <param name="inputFormat" type="select" label="Input format">
            <option value="vcf" selected="true">VCF</option>
            <option value="bed">BED (Deprecated)</option>
        </param>

        <conditional name="outputConditional">
            <param name="outputFormat" type="select" label="Output format">
                <option value="vcf" selected="true">VCF (only if input is VCF)</option>
                <option value="gatk">GATK-compatible VCF (only if input is VCF)</option>
                <option value="bed">BED</option>
                <option value="bedAnn">BED annotations</option>
            </param>
            <when value="vcf" />
            <when value="gatk">
                <param name="gatk_v1" type="boolean" checked="true" label="Compatible with GATK 1.x" />
            </when>
            <when value="bed" />
            <when value="bedAnn" />
        </conditional>

        <conditional name="snpDb">
            <param name="genomeSrc" type="select" label="Genome source">
                <option value="cached">Locally installed reference genome</option>
                <option value="history">Reference genome from your history</option>
                <option value="named">Named on demand</option>
            </param>
            <when value="cached">
                <param name="genomeVersion" type="select" label="Genome">
                    <!--GENOME    DESCRIPTION-->
                    <options from_data_table="snpeffv_genomedb">
                           <filter type="static_value" name="snpeff_version" value="@SNPEFF_VERSION@" column="1"/>
                           <filter type="unique_value" column="2" />
                    </options>
                </param>
                <param name="extra_annotations" type="select" display="checkboxes" multiple="true" label="Additional annotations">
                       <help>These are available for only a few genomes</help>
                       <options from_data_table="snpeffv_annotations">
                           <filter type="param_value" ref="genomeVersion" key="genome" column="2" />
                           <filter type="unique_value" column="3" />
                       </options>
                </param>
                <param name="regulation" type="select" display="checkboxes" multiple="true" label="Non-coding and regulatory annotation">
                       <help>These are available for only a few genomes</help>
                       <options from_data_table="snpeffv_regulationdb">
                           <filter type="param_value" ref="genomeVersion" key="genome" column="2" />
                           <filter type="unique_value" column="3" />
                       </options>
                </param>
            </when>
            <when value="history">
                <param format="snpeffdb" name="snpeff_db" type="data" label="@SNPEFF_VERSION@ Genome Data">
                    <options options_filter_attribute="metadata.snpeff_version" >
                        <filter type="add_value" value="@SNPEFF_VERSION@" />
                    </options>
                    <validator type="expression" message="This version of SnpEff will only work with @SNPEFF_VERSION@ Genome databases.">value is not None and value.metadata.snpeff_version == "@SNPEFF_VERSION@"</validator>
                </param>
                <!-- From metadata -->
                <param name="extra_annotations" type="select" display="checkboxes" multiple="true" label="Additional annotations">
                    <help>These are available for only a few genomes</help>
                    <options>
                        <filter type="data_meta" ref="snpeff_db" key="annotation" />
                    </options>
                </param>
                <param name="regulation" type="select" display="checkboxes" multiple="true" label="Non-coding and regulatory annotation">
                    <help>These are available for only a few genomes</help>
                    <options>
                        <filter type="data_meta" ref="snpeff_db" key="regulation" />
                    </options>
                </param>
            </when>
            <when value="named">
                <param name="genome_version" type="text" value="" label="Snpff Genome Version Name (e.g. GRCh38.76)">
                    <help>@SNPEFF_DATABASE_URL@</help>
                    <validator type="regex" message="A genome version name is required">\S+</validator>
                </param>
            </when>
        </conditional>

        <param name="udLength" type="select" label="Upstream / Downstream length">
            <option value="0">No upstream / downstream intervals (0 bases)</option>
            <option value="200">200 bases</option>
            <option value="500">500 bases</option>
            <option value="1000">1000 bases</option>
            <option value="2000">2000 bases</option>
            <option value="5000" selected="true">5000 bases</option>
            <option value="10000">10000 bases</option>
            <option value="20000">20000 bases</option>
        </param>

        <param name="spliceSiteSize" type="select" optional="true" label="Set size for splice sites (donor and acceptor) in bases" help="Default: 2">
            <option value="1">1 base</option>
            <option value="2" selected="true">2 bases</option>
            <option value="3">3 bases</option>
            <option value="4">4 bases</option>
            <option value="5">5 bases</option>
            <option value="6">6 bases</option>
            <option value="7">7 bases</option>
            <option value="8">8 bases</option>
            <option value="9">9 bases</option>
        </param>

        <conditional name="spliceRegion">
            <param name="setSpliceRegions" type="select" label="spliceRegion Settings">
                <option value="no">Use Defaults</option>
                <option value="yes">Set Splice Region Parameters</option>
            </param>
            <when value="no"/>
            <when value="yes">
                <param name="spliceRegionExonSize" type="integer" value="" min="1" max="10" optional="true" label="Set size for splice site region within exons. Default: 3 bases"/>
                <param name="spliceRegionIntronMin" type="integer" value="" min="1" max="10" optional="true" label="Set minimum number of bases for splice site region within intron. Default: 3 bases"/>
                <param name="spliceRegionIntronMax" type="integer" value="" min="1" max="10" optional="true" label="Set maximum number of bases for splice site region within intron. Default: 8 bases"/>
            </when>
        </conditional>

        <param name="annotations" type="select" display="checkboxes" multiple="true" label="Annotation options">
            <option value="-cancer">Perform 'cancer' comparisons (somatic vs. germline)</option>
            <option value="-canon">Only use canonical transcripts</option>
            <option value="-geneId">Use gene ID instead of gene name (VCF output)</option>
            <option value="-lof">Add loss of function (LOF) and nonsense mediated decay (NMD) tags</option>
            <option value="-oicr">Add OICR tag in VCF file</option>
            <option value="-onlyReg">Only use regulation tracks</option>
            <option value="-classic">Use Classic Effect names and amino acid variant annotations (NON_SYNONYMOUS_CODING vs missense_variant and G180R vs p.Gly180Arg/c.538G>C)</option>
            <option value="-hgvs">Override classic and use HGVS annotations for amino acid annotations (p.Gly180Arg/c.538G>C vs G180R)</option>
            <option value="-sequenceOntology">Override classic and use Sequence Ontolgy terms for effects (missense_variant vs NON_SYNONYMOUS_CODING)</option>
            <option value="-formatEff">Use 'EFF' field compatible with older versions (instead of 'ANN').</option>
	    <option value="-noHgvs">Do not add HGVS annotations.</option>
	    <option value="-noLof">Do not add LOF and NMD annotations.</option>
	    <option value="-noShiftHgvs">Do not shift variants according to HGVS notation (most 3prime end).</option>
	    <option value="-oicr">Add OICR tag in VCF file. Default: false</option>
        </param>
        <!-- -cancerSamples <file>           : Two column TXT file defining 'oringinal \t derived' samples. -->
        <param name="intervals" format="bed" type="data" optional="true" label="Use custom interval file for annotation"/>
        <param name="transcripts" format="tabular" type="data" optional="true" label="Only use the transcripts in this file." help="Format is one transcript ID per line."/>
        <param name="filterOut" type="select" display="checkboxes" multiple="true" label="Filter output">
            <option value="-no-downstream">Do not show DOWNSTREAM changes</option>
            <option value="-no-intergenic">Do not show INTERGENIC changes</option>
            <option value="-no-intron">Do not show INTRON changes</option>
            <option value="-no-upstream">Do not show UPSTREAM changes</option>
            <option value="-no-utr">Do not show 5_PRIME_UTR or 3_PRIME_UTR changes</option>
        </param>
        <conditional name="filter">
            <param name="specificEffects" type="select" label="Filter out specific Effects">
                <option value="no">No</option>
                <option value="yes">Yes</option>
            </param>
            <when value="no"/>
            <when value="yes">
                <param name="effects" type="select" display="checkboxes" multiple="true" label="Filter output: do not report these Effects">
                    <option value="CDS">CDS  (coding_sequence_variant) The variant hits a CDS.  MODIFIER</option>
                    <option value="CHROMOSOME_LARGE_DELETION">CHROMOSOME_LARGE_DELETION  (chromosome) A large parte (over 1%) of the chromosome was deleted.  HIGH</option>
                    <option value="CODON_CHANGE">CODON_CHANGE  (coding_sequence_variant) One or many codons are changed e.g.: An MNP of size multiple of 3  MODERATE</option>
                    <option value="CODON_INSERTION">CODON_INSERTION  (inframe_insertion) One or many codons are inserted e.g.: An insert multiple of three in a codon boundary  MODERATE</option>
                    <option value="CODON_CHANGE_PLUS_CODON_INSERTION">CODON_CHANGE_PLUS_CODON_INSERTION  (disruptive_inframe_insertion) One codon is changed and one or many codons are inserted e.g.: An insert of size multiple of three, not at codon boundary  MODERATE</option>
                    <option value="CODON_DELETION">CODON_DELETION  (inframe_deletion) One or many codons are deleted e.g.: A deletion multiple of three at codon boundary  MODERATE</option>
                    <option value="CODON_CHANGE_PLUS_CODON_DELETION">CODON_CHANGE_PLUS_CODON_DELETION  (disruptive_inframe_deletion) One codon is changed and one or more codons are deleted e.g.: A deletion of size multiple of three, not at codon boundary  MODERATE</option>
                    <option value="DOWNSTREAM">DOWNSTREAM  (downstream_gene_variant) Downstream of a gene (default length: 5K bases)  MODIFIER</option>
                    <option value="EXON">EXON  (exon_variant) The variant hits an exon (from a non-coding transcript) or a retained intron.  MODIFIER</option>
                    <option value="EXON_DELETED">EXON_DELETED  (exon_loss_variant) A deletion removes the whole exon.  HIGH</option>
                    <option value="FRAME_SHIFT">FRAME_SHIFT  (frameshift_variant) Insertion or deletion causes a frame shift e.g.: An indel size is not multple of 3  HIGH</option>
                    <option value="GENE">GENE  (gene_variant) The variant hits a gene.  MODIFIER</option>
                    <option value="INTERGENIC">INTERGENIC  (intergenic_region) The variant is in an intergenic region  MODIFIER</option>
                    <option value="INTERGENIC_CONSERVED">INTERGENIC_CONSERVED  (conserved_intergenic_variant) The variant is in a highly conserved intergenic region  MODIFIER</option>
                    <option value="INTRAGENIC">INTRAGENIC  (intragenic_variant) The variant hits a gene, but no transcripts within the gene  MODIFIER</option>
                    <option value="INTRON">INTRON  (intron_variant) Variant hits and intron. Technically, hits no exon in the transcript.  MODIFIER</option>
                    <option value="INTRON_CONSERVED">INTRON_CONSERVED  (conserved_intron_variant) The variant is in a highly conserved intronic region  MODIFIER</option>
                    <option value="MICRO_RNA">MICRO_RNA  (miRNA) Variant affects an miRNA  MODIFIER</option>
                    <option value="NON_SYNONYMOUS_CODING">NON_SYNONYMOUS_CODING  (missense_variant) Variant causes a codon that produces a different amino acid e.g.: Tgg/Cgg, W/R  MODERATE</option>
                    <option value="NON_SYNONYMOUS_START">NON_SYNONYMOUS_START  (initiator_codon_variant) Variant causes start codon to be mutated into another start codon (the new codon produces a different AA).  e.g.: Atg/Ctg, M/L (ATG and CTG can be START codons)  LOW</option>
                    <option value="NON_SYNONYMOUS_STOP">NON_SYNONYMOUS_STOP  (stop_retained_variant) Variant causes stop codon to be mutated into another stop codon (the new codon produces a different AA).  e.g.: Atg/Ctg, M/L (ATG and CTG can be START codons)  LOW</option>
                    <option value="RARE_AMINO_ACID">RARE_AMINO_ACID  (rare_amino_acid_variant) The variant hits a rare amino acid thus is likely to produce protein loss of function  HIGH</option>
                    <option value="SPLICE_SITE_ACCEPTOR">SPLICE_SITE_ACCEPTOR  (splice_acceptor_variant) The variant hits a splice acceptor site (defined as two bases before exon start, except for the first exon).  HIGH</option>
                    <option value="SPLICE_SITE_DONOR">SPLICE_SITE_DONOR  (splice_donor_variant) The variant hits a Splice donor site (defined as two bases after coding exon end, except for the last exon).  HIGH</option>
                    <option value="SPLICE_SITE_REGION">SPLICE_SITE_REGION  (splice_region_variant) A sequence variant in which a change has occurred within the region of the splice site, either within 1-3 bases of the exon or 3-8 bases of the intron.  LOW</option>
                    <option value="SPLICE_SITE_BRANCH">SPLICE_SITE_BRANCH  (splice_region_variant) A varaint affective putative (Lariat) branch point, located in the intron.  LOW</option>
                    <option value="SPLICE_SITE_BRANCH_U12">SPLICE_SITE_BRANCH_U12  (splice_region_variant) A varaint affective putative (Lariat) branch point from U12 splicing machinery, located in the intron.  MODERATE</option>
                    <option value="STOP_LOST">STOP_LOST  (stop_lost) Variant causes stop codon to be mutated into a non-stop codon e.g.: Tga/Cga, */R  HIGH</option>
                    <option value="START_GAINED">START_GAINED  (5_prime_UTR_premature start_codon_gain_variant) A variant in 5'UTR region produces a three base sequence that can be a START codon.  LOW</option>
                    <option value="START_LOST">START_LOST  (start_lost) Variant causes start codon to be mutated into a non-start codon.  e.g.: aTg/aGg, M/R  HIGH</option>
                    <option value="STOP_GAINED">STOP_GAINED  (stop_gained) Variant causes a STOP codon e.g.: Cag/Tag, Q/*  HIGH</option>
                    <option value="SYNONYMOUS_CODING">SYNONYMOUS_CODING  (synonymous_variant) Variant causes a codon that produces the same amino acid e.g.: Ttg/Ctg, L/L  LOW</option>
                    <option value="SYNONYMOUS_START">SYNONYMOUS_START  (start_retained) Variant causes start codon to be mutated into another start codon.  e.g.: Ttg/Ctg, L/L (TTG and CTG can be START codons)  LOW</option>
                    <option value="SYNONYMOUS_STOP">SYNONYMOUS_STOP  (stop_retained_variant) Variant causes stop codon to be mutated into another stop codon.  e.g.: taA/taG, */*  LOW</option>
                    <option value="TRANSCRIPT">TRANSCRIPT  (transcript_variant) The variant hits a transcript.  MODIFIER</option>
                    <option value="REGULATION">REGULATION  (regulatory_region_variant) The variant hits a known regulatory feature (non-coding).  MODIFIER</option>
                    <option value="UPSTREAM">UPSTREAM  (upstream_gene_variant) Upstream of a gene (default length: 5K bases)  MODIFIER</option>
                    <option value="UTR_3_PRIME">UTR_3_PRIME  (3_prime_UTR_variant) Variant hits 3'UTR region  MODIFIER</option>
                    <option value="UTR_3_DELETED">UTR_3_DELETED  (3_prime_UTR_truncation + exon_loss) The variant deletes an exon which is in the 3'UTR of the transcript  MODERATE</option>
                    <option value="UTR_5_PRIME">UTR_5_PRIME  (5_prime_UTR_variant) Variant hits 5'UTR region  MODIFIER</option>
                    <option value="UTR_5_DELETED">UTR_5_DELETED  (5_prime_UTR_truncation + exon_loss_variant) The variant deletes an exon which is in the 5'UTR of the transcript  MODERATE</option>
                    <option value="NEXT_PROT">NEXT_PROT  (sequence_feature + exon_loss_variant) A 'NextProt' based annotation. Details are provided in the 'feature type' sub-field (ANN), or in the effect details (EFF).  MODERATE </option>

                </param>
            </when>
        </conditional>

        <param name="offset" type="select" display="radio" optional="true" label="Chromosomal position">
            <option value="default" selected="true">Use default (based on input type)</option>
            <option value="-0">Force zero-based positions (both input and output)</option>
            <option value="-1">Force one-based positions (both input and output)</option>
        </param>
        <param name="chr" type="text" label="Text to prepend to chromosome name">
            <help>
               By default SnpEff simplifies all chromosome names. For instance 'chr1' is just '1'.
               You can prepend any string you want to the chromosome name.
            </help>
            <validator type="regex" message="No whitespace allowed">^\S*$</validator>
        </param>
        <param name="generate_stats" type="boolean" truevalue="" falsevalue="-noStats" checked="true" label="Produce Summary Stats"/>
        <param name="noLog" type="boolean" truevalue="-noLog" falsevalue="" checked="true" label="Suppress reporting usage statistics to server"/>
    </inputs>
    <outputs>
        <data format="vcf" name="snpeff_output" >
            <change_format>
                <when input="outputConditional.outputFormat" value="bed" format="bed" />
                <when input="outputConditional.outputFormat" value="bedAnn" format="bed" />
            </change_format>
        </data>
        <data format="html" name="statsFile" label="${tool.name} on ${on_string} - stats">
            <filter>generate_stats == True</filter>
        </data>
    </outputs>
    <tests>
        <!-- Check that an effect was added in out VCF -->
        <!-- Check for a HTML header indicating that this was successful -->
        <!--
        <output name="statsFile">
            <assert_contents>
            <has_text text="SnpEff: Variant analysis" />
            </assert_contents>
        </output>
        -->
        <!-- Setting filterOut throws exception in twilltestcase.py
        <test>
        <param name="input" ftype="vcf" value="vcf_homhet.vcf"/>
        <param name="inputFormat" value="vcf"/>
        <param name="outputFormat" value="vcf"/>
        <param name="genomeSrc" value="named"/>
        <param name="genome_version" value="testCase"/>
        <param name="udLength" value="0"/>
        <param name="generate_stats" value="False"/>
        <param name="filterOut" value="+-no-upstream"/>
        <output name="snpeff_output">
            <assert_contents>
            <has_text text="EFF=" />
            </assert_contents>
        </output>
        </test>
        -->

        <test>
        <param name="input" ftype="vcf" value="vcf_homhet.vcf"/>
        <param name="inputFormat" value="vcf"/>
        <param name="outputFormat" value="vcf"/>
        <param name="genomeSrc" value="named"/>
        <param name="genome_version" value="testCase"/>
        <param name="udLength" value="0"/>
        <!--
        <param name="filterOut" value=""/>
        -->
        <param name="generate_stats" value="False"/>
        <output name="snpeff_output">
            <assert_contents>
            <!-- Check that deleletions were evaluated -->
            <has_text_matching expression="Y\t59030478\t.*intergenic_region" />
            <!-- Check that insertion on last line was NOT evaluated -->
            <has_text_matching expression="Y\t59032947\t.*\tGT" />
            </assert_contents>
        </output>
        </test>

        <!-- Check that NO UPSTREAM  effect was added -->
        <!-- Setting filterOut throws exception in twilltestcase.py
        <test>
        <param name="input" ftype="vcf" value="vcf_homhet.vcf"/>
        <param name="inputFormat" value="vcf"/>
        <param name="outputFormat" value="vcf"/>
        <param name="genomeSrc" value="named"/>
        <param name="genome_version" value="testCase"/>
        <param name="udLength" value="0"/>
        <param name="filterOut" value="+-no-upstream"/>
        <param name="generate_stats" value="False"/>
        <output name="snpeff_output">
            <assert_contents>
            <not_has_text text="UPSTREAM" />
            </assert_contents>
        </output>
        </test>
        -->

    </tests>
    <help><![CDATA[

This tool calculate the effect of variants (SNPs/MNPs/Insertions) and deletions.

@EXTERNAL_DOCUMENTATION@

]]>
    </help>
    <expand macro="citations" />
</tool>


text:
import {ServiceGroupCreatedEvent, ServiceAddedEvent} from '../domain/service-group';
import {ServiceGroupRepo} from '../persistence/service-group-repo';

export interface IServiceGroup {
    name: string;
    id: string;
}

export class ServiceGroupModelListener {
    private repo: ServiceGroupRepo;

    constructor(repo: ServiceGroupRepo = new ServiceGroupRepo()) {
        this.repo = repo;
    }

    async handleCreated(evt: ServiceGroupCreatedEvent): Promise<void> {
        await this.repo.create({
            id: evt.id,
            name: evt.name
        });
    }

    async handleServiceAdded(evt: ServiceAddedEvent): Promise<void> {

    }
}


text:
package org.song.java8;

import java.util.HashMap;
import java.util.Map;
import java.util.Stack;

/**
 * Purpose of this class is to
 */
public class ReversePolishNotation {
    private static enum Operator{
        Plus("+"){
            @Override
            public int operate(int i1, int i2) {
                return i1+i2;
            }
        },
        Minus("-"){
            @Override
            public int operate(int i1, int i2) {
                return i1-i2;
            }

        },
        Dvision("/"){
            @Override
            public int operate(int i1, int i2) {
                return i1/i2;
            }

        },
        Multiply("*"){
            @Override
            public int operate(int i1, int i2) {
                return i1*i2;
            }

        };

        private final String operator;
        private Operator(String operator){
            this.operator = operator;
        }

        private static final Map<String, Operator> map =
                new HashMap<>();
        static{
            for (Operator op : Operator.values()){
                map.put(op.operator, op);
            }
        }

        public static Operator getOperator(String s){
            return map.get(s);
        }

        public abstract int operate(int i1, int i2);

    }
    public int evalRPN(String[] tokens) {

        if (tokens == null || tokens.length == 0){

            return 0;
        }
        Stack<Object> stack = new Stack<>();
        for (String t : tokens){
            Operator op = Operator.getOperator(t);
            if (op == null){
                stack.push(Integer.parseInt(t));
            }
            else {
                int i2 = ((Integer)stack.pop()).intValue();
                int i1 = ((Integer)stack.pop()).intValue();
                stack.push(Integer.valueOf(op.operate(i1, i2)));
            }
        }

        return ((Integer)stack.pop()).intValue();
    }
}


text:
The source for Docker documentation is here under `sources/` and uses extended
Markdown, as implemented by [MkDocs](http://mkdocs.org).

The HTML files are built and hosted on `https://docs.docker.com`, and update
automatically after each change to the master or release branch of [Docker on
GitHub](https://github.com/docker/docker) thanks to post-commit hooks. The
`docs` branch maps to the "latest" documentation and the `master` (unreleased
development) branch maps to the "master" documentation.

## Contributing

Be sure to follow the [contribution guidelines](../CONTRIBUTING.md).
In particular, [remember to sign your work!](../CONTRIBUTING.md#sign-your-work)

## Getting Started

Docker documentation builds are done in a Docker container, which installs all
the required tools, adds the local `docs/` directory and builds the HTML docs.
It then starts a HTTP server on port 8000 so that you can connect and see your
changes.

In the root of the `docker` source directory:

    $ make docs
    .... (lots of output) ....
    docker run --rm -it  -e AWS_S3_BUCKET -p 8000:8000 "docker-docs:master" mkdocs serve
    Running at: http://0.0.0.0:8000/
    Live reload enabled.
    Hold ctrl+c to quit.

If you have any issues you need to debug, you can use `make docs-shell` and then
run `mkdocs serve`

## Testing the links

You can use `make docs-test` to generate a report of missing links that are referenced in
the documentation - there should be none.

## Adding a new document

New document (`.md`) files are added to the documentation builds by adding them
to the menu definition in the `docs/mkdocs.yml` file.

## Style guide

If you have questions about how to write for Docker's documentation (e.g.,
questions about grammar, syntax, formatting, styling, language, or tone) please
see the [style guide](sources/contributing/docs_style-guide.md). If something
isn't clear in the guide, please submit a PR to help us improve it.

## Working using GitHub's file editor

Alternatively, for small changes and typos you might want to use GitHub's built-
in file editor. It allows you to preview your changes right on-line (though
there can be some differences between GitHub Markdown and [MkDocs
Markdown](http://www.mkdocs.org/user-guide/writing-your-docs/)).  Just be
careful not to create many commits. And you must still [sign your
work!](../CONTRIBUTING.md#sign-your-work)

## Branches

**There are two branches related to editing docs**: `master` and `docs`. You
should always edit the documentation on a local branch of the `master`
branch, and send a PR against `master`.

That way your fixes will automatically get included in later releases, and docs
maintainers can easily cherry-pick your changes into the `docs` release branch.
In the rare case where your change is not forward-compatible, you may need to
base your changes on the `docs` branch.

Also, now that we have a `docs` branch, we can keep the
[http://docs.docker.com](http://docs.docker.com) docs up to date with any bugs
found between Docker code releases.

> **Warning**: When *reading* the docs, the
> [http://docs-stage.docker.com](http://docs-stage.docker.com) documentation may
> include features not yet part of any official Docker release. The `beta-docs`
> site should be used only for understanding bleeding-edge development and
> `docs.docker.com` (which points to the `docs` branch`) should be used for the
> latest official release.

## Publishing Documentation

To publish a copy of the documentation you need to have Docker up and running on
your machine. You'll also need a `docs/awsconfig` file containing the settings
you need to access the AWS bucket you'll be deploying to.

The release script will create an s3 if needed, and will then push the files to it.

    [profile dowideit-docs]
    aws_access_key_id = IHOIUAHSIDH234rwf....
    aws_secret_access_key = OIUYSADJHLKUHQWIUHE......
    region = ap-southeast-2

The `profile` name must be the same as the name of the bucket you are deploying
to - which you call from the `docker` directory:

    make AWS_S3_BUCKET=dowideit-docs docs-release

This will publish _only_ to the `http://bucket-url/v1.2/` version of the
documentation.

If you're publishing the current release's documentation, you need to
also update the root docs pages by running

    make AWS_S3_BUCKET=dowideit-docs BUILD_ROOT=yes docs-release

> **Note:**
> if you are using Boot2Docker on OSX and the above command returns an error,
> `Post http:///var/run/docker.sock/build?rm=1&t=docker-docs%3Apost-1.2.0-docs_update-2:
> dial unix /var/run/docker.sock: no such file or directory', you need to set the Docker
> host. Run `$(boot2docker shellinit)` to see the correct variable to set. The command
> will return the full `export` command, so you can just cut and paste.

## Cherry-picking documentation changes to update an existing release.

Whenever the core team makes a release, they publish the documentation based
on the `release` branch (which is copied into the `docs` branch). The
documentation team can make updates in the meantime, by cherry-picking changes
from `master` into any of the docs branches.

For example, to update the current release's docs:

    git fetch upstream
    git checkout -b post-1.2.0-docs-update-1 upstream/docs
    # Then go through the Merge commit linked to PR's (making sure they apply
    to that release)
    # see https://github.com/docker/docker/commits/master
    git cherry-pick -x fe845c4
    # Repeat until you have cherry picked everything you will propose to be merged
    git push upstream post-1.2.0-docs-update-1

Then make a pull request to merge into the `docs` branch, __NOT__ into master.

Once the PR has the needed `LGTM`s, merge it, then publish to our beta server
to test:

    git fetch upstream
    git checkout docs
    git reset --hard upstream/docs
    make AWS_S3_BUCKET=beta-docs.docker.io BUILD_ROOT=yes docs-release

Then go to http://beta-docs.docker.io.s3-website-us-west-2.amazonaws.com/
to view your results and make sure what you published is what you wanted.

When you're happy with it, publish the docs to our live site:

    make AWS_S3_BUCKET=docs.docker.com BUILD_ROOT=yes DISTRIBUTION_ID=C2K6......FL2F docs-release

Test the uncached version of the live docs at http://docs.docker.com.s3-website-us-east-1.amazonaws.com/

Note that the new docs will not appear live on the site until the cache (a complex,
distributed CDN system) is flushed. The `make docs-release` command will do this
_if_ the `DISTRIBUTION_ID` is set to the Cloudfront distribution ID (ask the meta
team) - this will take at least 15 minutes to run and you can check its progress
with the CDN Cloudfront Chrome addin.


text:
package com.example.yechy.tvass.widget;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;

import com.example.yechy.tvass.R;

/**
 * Created by 凯阳 on 2015/8/17.
 */
public class TouchPadView extends View {

    private Paint mPaint;
    private Bitmap mBitmap;

    //private int width = getWidth();
    //private int height = getHeight();

    private int lastX = getWidth();
    private int lastY = getHeight();

    public TouchPadView(Context context) {
        this(context, null);
    }

    public TouchPadView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public TouchPadView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    private void init() {

        mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mPaint.setStyle(Paint.Style.STROKE);
        mPaint.setDither(true);
        mPaint.setStrokeWidth(3);
        mPaint.setColor(Color.RED);
        mPaint.setStrokeJoin(Paint.Join.ROUND);
        mPaint.setStrokeCap(Paint.Cap.ROUND);

        mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_adjust_white_24dp);

    }

    /*
    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int widthSize = MeasureSpec.getSize(widthMeasureSpec);

        width = widthSize;
        height = width * 1080 /1920;

        lastX = width/2;
        lastY = height/2;

        setMeasuredDimension(width,height);
    }
    */
    @Override
    protected void onDraw(Canvas canvas) {
        canvas.drawBitmap(mBitmap, lastX, lastY, mPaint);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if (event.getAction() == MotionEvent.ACTION_MOVE) {
            int[] location = getSpace(lastX, lastY, (int)event.getX(),  (int)event.getY());
            if (location != null) {
                lastX = (int) event.getX();
                lastY = (int) event.getY();
            }
        }
        invalidate();
        return true;
    }

    private int[] getSpace(int x, int y, int pX, int pY) {
        if (pX < 0 || pX > getWidth()|| pY < 0 || pY > getHeight()) {
            return  null;
        }
        int w = Math.abs(pX - x);
        int h = Math.abs(pY - y);
        int dstX = pX - x;
        int dstY = pY - y;
        int space = (int) Math.sqrt((w*w+h*h));
        if (space > 50) {
            if(space > 50 && space < 100) {
                //// TODO: 2017/4/3
//                NetUtils.getInstance().sendVirtualMotionEvents(dstX, dstY, 0);
            }
            return new int[]{dstX, dstY};
        }
        return null;
    }
}


text:
module Azure::TrafficManager::Mgmt::V2018_02_01
  module Models
    #
    # Class containing endpoint monitoring settings in a Traffic Manager
    # profile.
    #
    class MonitorConfig

      include MsRestAzure

      # @return [ProfileMonitorStatus] The profile-level monitoring status of
      # the Traffic Manager profile. Possible values include:
      # 'CheckingEndpoints', 'Online', 'Degraded', 'Disabled', 'Inactive'
      attr_accessor :profile_monitor_status

      # @return [MonitorProtocol] The protocol (HTTP, HTTPS or TCP) used to
      # probe for endpoint health. Possible values include: 'HTTP', 'HTTPS',
      # 'TCP'
      attr_accessor :protocol

      # @return [Integer] The TCP port used to probe for endpoint health.
      attr_accessor :port

      # @return [String] The path relative to the endpoint domain name used to
      # probe for endpoint health.
      attr_accessor :path

      # @return [Integer] The monitor interval for endpoints in this profile.
      # This is the interval at which Traffic Manager will check the health of
      # each endpoint in this profile.
      attr_accessor :interval_in_seconds

      # @return [Integer] The monitor timeout for endpoints in this profile.
      # This is the time that Traffic Manager allows endpoints in this profile
      # to response to the health check.
      attr_accessor :timeout_in_seconds

      # @return [Integer] The number of consecutive failed health check that
      # Traffic Manager tolerates before declaring an endpoint in this profile
      # Degraded after the next failed health check.
      attr_accessor :tolerated_number_of_failures

      #
      # Mapper for MonitorConfig class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'MonitorConfig',
          type: {
            name: 'Composite',
            class_name: 'MonitorConfig',
            model_properties: {
              profile_monitor_status: {
                client_side_validation: true,
                required: false,
                serialized_name: 'profileMonitorStatus',
                type: {
                  name: 'String'
                }
              },
              protocol: {
                client_side_validation: true,
                required: false,
                serialized_name: 'protocol',
                type: {
                  name: 'String'
                }
              },
              port: {
                client_side_validation: true,
                required: false,
                serialized_name: 'port',
                type: {
                  name: 'Number'
                }
              },
              path: {
                client_side_validation: true,
                required: false,
                serialized_name: 'path',
                type: {
                  name: 'String'
                }
              },
              interval_in_seconds: {
                client_side_validation: true,
                required: false,
                serialized_name: 'intervalInSeconds',
                type: {
                  name: 'Number'
                }
              },
              timeout_in_seconds: {
                client_side_validation: true,
                required: false,
                serialized_name: 'timeoutInSeconds',
                type: {
                  name: 'Number'
                }
              },
              tolerated_number_of_failures: {
                client_side_validation: true,
                required: false,
                serialized_name: 'toleratedNumberOfFailures',
                type: {
                  name: 'Number'
                }
              }
            }
          }
        }
      end
    end
  end
end


text:
package org.ppwcode.vernacular.l10n_III.dwr;

import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;
import org.directwebremoting.WebContextFactory;
import org.directwebremoting.convert.ExceptionConverter;
import org.directwebremoting.dwrp.ObjectOutboundVariable;
import org.directwebremoting.extend.MarshallException;
import org.directwebremoting.extend.OutboundContext;
import org.directwebremoting.extend.OutboundVariable;
import org.directwebremoting.extend.Property;
import org.ppwcode.vernacular.l10n_III.LocalizedException;
import static org.ppwcode.metainfo_I.License.Type.APACHE_V2;

import org.ppwcode.metainfo_I.Copyright;
import org.ppwcode.metainfo_I.License;
import org.ppwcode.metainfo_I.vcs.SvnInfo;
import org.ppwcode.vernacular.l10n_III.I18nExceptionHelpers;
import org.ppwcode.vernacular.l10n_III.web.HttpRequestLocaleFilter;

/**
 * DWR converter for {@link LocalizedException}.
 * The "message" property of an exception is used as a key to find a localized error message, while
 * transforming the Java exception to a Javascript object.
 * The locale used for the localization, is the locale stored in the session scope.
 *
 * @author    Ruben Vandeginste
 * @author    PeopleWare n.v.
 */
@Copyright("2009 - $Date: 2009-02-12 15:55:44 +0100 (Thu, 12 Feb 2009) $, PeopleWare n.v.")
@License(APACHE_V2)
@SvnInfo(revision = "$Revision: 4107 $",
date = "$Date: 2009-02-12 15:55:44 +0100 (Thu, 12 Feb 2009) $")
public class LocalizedExceptionConverter extends ExceptionConverter {

  // convertOutBound implementation originally taken from BasicObjectConverter
  @Override
  public OutboundVariable convertOutbound(Object data, OutboundContext outctx) throws MarshallException {
    // Where we collect out converted children
    Map<String, OutboundVariable> ovs = new TreeMap<String, OutboundVariable>();

    // We need to do this before collecting the children to save recursion
    ObjectOutboundVariable ov = new ObjectOutboundVariable(outctx);
    outctx.put(data, ov);

    try {
      @SuppressWarnings("unchecked")
      Map<String, Property> properties = getPropertyMapFromObject(data, true, false);
      for (Iterator<Map.Entry<String, Property>> it = properties.entrySet().iterator(); it.hasNext();) {
        Map.Entry<String, Property> entry = it.next();
        String name = entry.getKey();
        Property property = entry.getValue();

        Object value = null;
        if (name.equals("message") || name.equals("localizedMessage")) {
          Locale locale = (Locale) WebContextFactory.get().getSession().
                  getAttribute(HttpRequestLocaleFilter.ATTRIBUTE_PREFERRED_LOCALE);
          if (data instanceof LocalizedException) {
            value = I18nExceptionHelpers.i18nExceptionMessage((LocalizedException)data, locale);
            if (value == null) value = "NULL";
          } else {
            throw new MarshallException(data.getClass(), "Not a LocalizedException");
          }
        } else {
          value = property.getValue(data);
        }
        OutboundVariable nested = getConverterManager().convertOutbound(value, outctx);

        ovs.put(name, nested);
      }
    } catch (MarshallException ex) {
      throw ex;
    } catch (Exception ex) {
      throw new MarshallException(data.getClass(), ex);
    }

    ov.init(ovs, getJavascript());

    return ov;
  }
}


text:
<?php

//--------------------------------------------------------------------------
// Proyecto: Icasus
// Archivo: logic/ILogicaProceso.php
// Tipo: definicion de Interfaz
// Desarrolladores: Juanan Ruiz (juanan@us.es), Jesus Martin Corredera (jjmc@us.es),
// Joaquín Valonero Zaera (tecnibus1@us.es)
//--------------------------------------------------------------------------
// Descripcion: Interface que contendra los métodos para la Lógica de Negocio
// de los Procesos en Icasus.
//--------------------------------------------------------------------------

interface ILogicaProceso
{

    //Comprueba los permisos del usuario sobre un proceso
    public function comprobar_responsable_proceso($id_usuario, $proceso);
}