text:
date: 2017-02-07 00:00:00
title: RSS and Atom feeds
video_id: 5LYMioN1Qmc
description: Add a RSS or Atom feed to your Jekyll site
category: Blogging
tags:
  - jekyll-blogging
  - jekyll-liquid
  - jekyll-plugins
resources:
  - name: Source code
    link: 'https://github.com/CloudCannon/bakery-store/tree/navigation'
type: Video
set: intermediate
set_order: 7
---
## Introduction

Most blogs have an RSS or Atom feed to notify readers of new content on the site. There's two ways we can add a Atom or RSS feed to our Jekyll site: either using Liquid or a Jekyll plugin. Using a plugin is the best way because the code has been tested by thousands of people. However, it's still useful to look at implementing RSS using pure Liquid to understand how it works.

## What is an RSS Feed?

A RSS feed is an XML document which has basic meta data about a site, followed by a list of content items (usually blog posts) which typically have a title, description, publish date and link.

Here's an example of a simple RSS feed.

{% raw %}
~~~xml
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>RSS Feed Exmple</title>
    <description>RSS is a fascinating technology. The uses for RSS are expanding daily.</description>
    <link>http://www.feedforall.com/industry-solutions.htm</link>
    <item>
      <title>RSS Solutions for Restaurants</title>
      <description>FeedForAll helps Restaurants communicate with customers. Let your customers know the latest specials or events.</description>
      <link>http://www.feedforall.com/restaurant.htm</link>
      <comments>http://www.feedforall.com/forum</comments>
      <pubDate>Tue, 19 Oct 2004 11:09:11 -0400</pubDate>
    </item>
    <item>
      <title>RSS Solutions for Schools and Colleges</title>
      <description>FeedForAll helps Educational Institutions communicate with students about school wide activities, events, and schedules</description>
      <link>http://www.feedforall.com/schools.htm</link>
      <comments>http://www.feedforall.com/forum</comments>
      <pubDate>Tue, 19 Oct 2004 11:09:09 -0400</pubDate>
    </item>
  </channel>
</rss>
~~~
{% endraw %}

When someone subscribes to an RSS feed their RSS aggregator will periodically check this document for new items.

## Using Liquid

Using Liquid we can output an XML file with this format for our site. First we'll create `/feed.xml` with the following content:

{% raw %}
~~~xml
---
layout: none
---
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Bakery Store - Articles</title>
    <description>Your latest baking news</description>
    <link>{{ site.url }}</link>
    {% for post in site.posts %}
      {% unless post.draft %}
        <item>
          <title>{{ post.title | xml_escape }}</title>
          <description>{{ post.content | xml_escape }}</description>
          <pubDate>{{ post.date | date_to_xmlschema }}</pubDate>
          <link>{{ post.url | prepend: site.url }}</link>
          <guid isPermaLink="true">{{ post.url | prepend: site.url }}</guid>
        </item>
      {% endunless %}
    {% endfor %}
  </channel>
</rss>
~~~
{% endraw %}

This loops over our blog posts and outputs metadata in an RSS XML format. You might of noticed we're using a variable `site.url` which isn't defined yet. Let's go ahead and define it in `_config.yml`.

~~~yaml
...
url: http://bakery-store.example.com
...
~~~

Finally, we need to add a link to the RSS feed to `<head>` in `_layouts/default.html`.

~~~html
...
<link rel="alternate" type="application/rss+xml" title="Bakery Store RSS" href="/feed.xml">
...
~~~

Now when we go to `/feed.xml` on the live site we see the full feed.

{% raw %}
~~~xml
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Bakery Store - Articles</title>
    <description>Your latest baking news</description>
    <link>http://bakery-store.example.com</link>
        <item>
          <title>Where Did The Cookie Come From</title>
          <description><p>The chocolate chip cookie was invented by Ruth Graves Wakefield. She owned the Toll House Inn, in Whitman, Massachusetts, a very popular restaurant that featured home cooking in the 1930s. Her cookbook, Toll House Tried and True Recipes, was first published in 1936 by M. Barrows &amp; Company, New York. The 1938 edition of the cookbook was the first to include the recipe "Toll House Chocolate Crunch Cookie" which rapidly became a favorite cookie in American homes.</p>

<p>Source / Read more <a href="https://en.wikipedia.org/wiki/Chocolate_chip_cookie">Wikipedia</a></p>
</description>
          <pubDate>2016-01-02T00:00:00+13:00</pubDate>
          <link>http://bakery-store.example.com/information/2016/01/02/where-did-the-cookie-come-from.html</link>
          <guid isPermaLink="true">http://bakery-store.example.com/information/2016/01/02/where-did-the-cookie-come-from.html</guid>
        </item>
        <item>
          <title>What Is Sour Dough</title>
          <description><p>Sourdough bread is made by the fermentation of dough using naturally-occurring lactobacilli and yeast. Sourdough bread has a mildly sour taste not present in most breads made with baker's yeast and better inherent keeping qualities than other breads, due to the lactic acid produced by the lactobacilli.</p>

<p>Source / Read more <a href="https://en.wikipedia.org/wiki/Sourdough">Wikipedia</a></p>
</description>
          <pubDate>2016-01-01T00:00:00+13:00</pubDate>
          <link>http://bakery-store.example.com/information/2016/01/01/what-is-sour-dough.html</link>
          <guid isPermaLink="true">http://bakery-store.example.com/information/2016/01/01/what-is-sour-dough.html</guid>
        </item>
  </channel>
</rss>
~~~
{% endraw %}

## jekyll-feed plugin

Let's go through using the jekyll-feed plugin instead of the pure Liquid approach. Create `Gemfile` in the root of the site and add the `jekyll` and `jekyll-feed` gem:

{% raw %}
~~~ruby
source 'https://rubygems.org'

gem 'jekyll'

group :jekyll_plugins do
  gem 'jekyll-feed'
end
~~~
{% endraw %}

Instead of adding a `<link>` to RSS in the layout like the previous section, we can use a Liquid tag from the plugin:

{% raw %}
~~~html
...
{% feed_meta %}
...
~~~
{% endraw %}

The last step is to run `bundle install` on the command line to install `jekyll-feed` and run jekyll with `bundle exec`:

{% raw %}
~~~bash
bundle exec jekyll serve
~~~
{% endraw %}

When we navigate to `/feed.xml` on the live site we get a feed of our posts.

{% raw %}
~~~xml
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <generator uri="http://jekyllrb.com" version="3.1.2">Jekyll</generator>
  <link href="http://bakery-store.example.com/feed.xml" rel="self" type="application/atom+xml" />
  <link href="http://bakery-store.example.com/" rel="alternate" type="text/html" />
  <updated>2016-05-13T16:22:08+12:00</updated>
  <id>http://bakery-store.example.com/</id>
  <entry>
    <title>Where Did The Cookie Come From</title>
    <link href="http://bakery-store.example.com/information/2016/01/02/where-did-the-cookie-come-from.html" rel="alternate" type="text/html" title="Where Did The Cookie Come From" />
    <published>2016-01-02T00:00:00+13:00</published>
    <updated>2016-01-02T00:00:00+13:00</updated>
    <id>http://bakery-store.example.com/information/2016/01/02/where-did-the-cookie-come-from</id>
    <content type="html" xml:base="http://bakery-store.example.com/information/2016/01/02/where-did-the-cookie-come-from.html"><p>The chocolate chip cookie was invented by Ruth Graves Wakefield. She owned the Toll House Inn, in Whitman, Massachusetts, a very popular restaurant that featured home cooking in the 1930s. Her cookbook, Toll House Tried and True Recipes, was first published in 1936 by M. Barrows &amp; Company, New York. The 1938 edition of the cookbook was the first to include the recipe "Toll House Chocolate Crunch Cookie" which rapidly became a favorite cookie in American homes.</p>

<p>Source / Read more <a href="https://en.wikipedia.org/wiki/Chocolate_chip_cookie">Wikipedia</a></p>
    </content>
    <category term="Information" />
    The chocolate chip cookie was invented by Ruth Graves Wakefield. She owned the Toll House Inn, in Whitman, Massachusetts, a very popular restaurant that featured home cooking in the 1930s. Her cookbook, Toll House Tried and True Recipes, was first published in 1936 by M. Barrows &amp; Company, New York. The 1938 edition of the cookbook was the first to include the recipe "Toll House Chocolate Crunch Cookie" which rapidly became a favorite cookie in American homes.
  </entry>
  <entry>
    <title>What Is Sour Dough</title>
    <link href="http://bakery-store.example.com/information/2016/01/01/what-is-sour-dough.html" rel="alternate" type="text/html" title="What Is Sour Dough" />
    <published>2016-01-01T00:00:00+13:00</published>
    <updated>2016-01-01T00:00:00+13:00</updated>
    <id>http://bakery-store.example.com/information/2016/01/01/what-is-sour-dough</id>
    <content type="html" xml:base="http://bakery-store.example.com/information/2016/01/01/what-is-sour-dough.html"><p>Sourdough bread is made by the fermentation of dough using naturally-occurring lactobacilli and yeast. Sourdough bread has a mildly sour taste not present in most breads made with baker's yeast and better inherent keeping qualities than other breads, due to the lactic acid produced by the lactobacilli.</p>

<p>Source / Read more <a href="https://en.wikipedia.org/wiki/Sourdough">Wikipedia</a></p>
    </content>
    <category term="Information" />
    Sourdough bread is made by the fermentation of dough using naturally-occurring lactobacilli and yeast. Sourdough bread has a mildly sour taste not present in most breads made with baker's yeast and better inherent keeping qualities than other breads, due to the lactic acid produced by the lactobacilli.
  </entry>
</feed>
~~~
{% endraw %}

You can customize all the fields and add extra metadata such as an author. Check out the [jekyll-feed](https://github.com/jekyll/jekyll-feed) GitHub repository for more information.


text:
import {IList, ListFilters} from '../table/table-models';

export enum Features {
  invoices = 'invoices',
  clients = 'clients',
  consultants = 'consultants',
  projects = 'projects',
  projectMonths = 'projectMonths',
  users = 'users',
  roles = 'roles',
}

export interface IFeature<TModel, TFilterModel extends ListFilters = {}> {
  /**
   * Unique key that matches the keys in the store
   * */
  key: Features;
  /**
   * Used for routing:
   * return /${key}/:slug
   */
  nav: (m: TModel | 'create') => string;
  /** Translations */
  trans: IFeatureTranslations<TModel>;
  /**
   * A simple table with filters and action buttons
   * */
  list: IList<TModel, TFilterModel>;
}

export interface IFeatureTranslations<TModel> {
  /** "Entity" */
  title: string;
  listTitle: string;
  /** "New Entity" */
  createNew: string;
  /** Translations for each model property */
  props: TModel;
}

export interface IFeatureBuilderConfig<TModel, TFilters extends ListFilters> {
  data: TModel[];
  save: (model: TModel, stayOnPage?: boolean) => void;
  filters: TFilters;
  setFilters: (f: TFilters) => void;
}

redpajama_set_name: RedPajamaGithub


text:
USE [VipunenTK_DW]
GO
/****** Object:  StoredProcedure [dbo].[p_lataa_f_2_3efg]    Script Date: 26.10.2017 16:28:09 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[p_lataa_f_2_3efg] AS

--execute VipunenTK_DW.dbo.p_lataa_OTV_f_2_3

truncate table VipunenTK.[dbo].f_2_3efg_Lukiokoulutuksen_ja_ammatillisen_koulutuksen_opiskelijat;

INSERT INTO [VipunenTK].[dbo].[f_2_3efg_Lukiokoulutuksen_ja_ammatillisen_koulutuksen_opiskelijat]

SELECT

	 f.tilastointivuosi
	,f.tilv_date
	,f.lahde
	,lahde_id = coalesce(d1.id,-1)
	,f.koulutuksen_jarjestaja
	,koulutuksen_jarjestaja_id = coalesce(d3.id,-1)
	,koulutuksen_jarjestaja_historia_id = coalesce(d3h.id,-1)
	,f.oppisopimuskoulutuksen_jarjestaja
	,oppisopimuskoulutuksen_jarjestaja_id = coalesce(d4.id,-1)
	,oppisopimuskoulutuksen_jarjestaja_historia_id = coalesce(d4h.id,-1)
	,f.koulutusluokitus
	,koulutusluokitus_id = coalesce(d5.id,-1)
	,koulutusluokitus_historia_id = coalesce(d5h.id,-1)
	,f.koulutuksen_kieli
	,koulutuksen_kieli_id = coalesce(d6.id,-1)
	,f.koulutuksen_kunta
	,koulutuksen_kunta_id = coalesce(d7.id,-1)
	,koulutuksen_kunta_historia_id = coalesce(d7h.id,-1)
	,f.opetushallinnon_koulutus
	,opetushallinnon_koulutus_id = coalesce(d8.id,-1)

	,f.sukupuoli
	,sukupuoli_id = coalesce(d9.id,-1)
	,f.aidinkieli
	,aidinkieli_versio1_id = coalesce(d10.id,-1)
	,f.kirjoihintulovuosi
	,kirjoihintulovuosi_id = coalesce(d11.kausi_id,'-1')
	,f.opiskelijan_olo_syys
	,opiskelijan_olo_syys_id = coalesce(d14.id,-1)
	,f.aikuisopiskelija
	,aikuisopiskelija_id = coalesce(d15.id,-1)

	,f.ika_kirjoihintulovuonna
	,ika_kirjoihintulovuonna_id = coalesce(d16.id,-1)
	,ikaryhma_kirjoihintulovuonna_id = coalesce(d16_2.id,-1)
	,f.ika
	,ika_id = coalesce(d17.id,-1)
	,ikaryhma_id = coalesce(d17_2.id,-1)

	,f.lukumaara
	,f.nuorten_aikuisten_koulutus
	,nuorten_aikuisten_koulutus_id = coalesce(d18.id,-1)
	,f.koulutuksen_tutkinnon_aloitusvuosi
	,koulutuksen_tutkinnon_aloitusvuosi_id = coalesce(d19.kausi_id,'-1')
	,f.ammatillisen_koulutuksen_koulutuslaji
	,ammatillisen_koulutuksen_koulutuslaji_id = coalesce(d21.id,-1)
	,f.tutkintonimike_ammpk
	,tutkintonimike_ammpk_id = coalesce(d22.id,-1)
	,f.koulutusohjelma_ammpk
	,koulutusohjelma_ammpk_id = coalesce(d23.id,-1)
	,f.opetussuunnitelmaperusteinen_koulutus_nayttotutkintoon_valmistava_koulutus
	,opetussuunnitelmaperusteinen_koulutus_nayttotutkintoon_valmistava_koulutus_id = coalesce(d24.id,-1)
	,f.rahoituslahde_amm
	,rahoituslahde_amm_id = coalesce(d26.id,-1)
	,f.tutkinnon_tavoite
	,tutkinnon_tavoite_id = coalesce(d29.id,-1)
	,f.asuinmaakunta
	,asuinmaakunta_id = coalesce(d36.id,-1)
	,asuinmaakunta_historia_id = coalesce(d36h.id,-1)
	,f.tietolahde
	,f.rivinumero
	,f.aineistotunnus
	,f.koulutussektori
	,koulutussektori_id = coalesce(d37.id,-1)
	,f.koulutuksen_jarjestamismuoto
	,koulutuksen_jarjestamismuoto_id = coalesce(d39.id,-1)
	,f.ammatillinen_peruskoulutus_lisakoulutus
	,ammatillinen_peruskoulutus_lisakoulutus_id = coalesce(d40.id,-1)
	,f.koulutuksen_tavoite_toteuma
	,koulutuksen_tavoite_toteuma_id = coalesce(d41.id,-1)

	,f.aloittaneet
	,f.opiskelijat
	,f.opiskelijat_lasna
	,aineisto_id = -1
	,aineisto_OTV_id = coalesce(d43.id,-1)
    ,koulutuksen_jarjestaja_kunta_id = coalesce(d51.id,-1)
    ,koulutuksen_jarjestaja_kunta_historia_id = coalesce(d51h.id,-1)

	,nuorten_aikuisten_koulutus_amm_id = coalesce(d53.id, -1)
	,koulutuslaji_OKM_id = coalesce(d54.id, -1)

	,yht_koulutuksen_jarjestaja_id = coalesce(d55.id, -1)
	,yht_koulutuksen_jarjestaja_historia_id = coalesce(d55h.id, -1)

    ,yht_koulutuksen_jarjestaja_kunta_id = coalesce(d57.id,-1)
    ,yht_koulutuksen_jarjestaja_kunta_historia_id = coalesce(d57h.id,-1)

	,hallinnonala2_id = coalesce(d8b.id,-1)

--into [VipunenTK].[dbo].[f_2_3efg_Lukiokoulutuksen_ja_ammatillisen_koulutuksen_opiskelijat]

FROM VipunenTK_DW.dbo.v_f_2_3efg_Lukiokoulutuksen_ja_ammatillisen_koulutuksen_opiskelijat AS f
LEFT JOIN VipunenTK..d_lahde AS d1 ON d1.lahde_koodi=f.lahde AND f.tilv_date between d1.alkaa and d1.paattyy

LEFT JOIN VipunenTK..d_oppilaitoksen_taustatiedot AS d3 ON d3.oppilaitos_avain=f.koulutuksen_jarjestaja
LEFT JOIN VipunenTK..d_oppilaitoksen_taustatiedot AS d4 ON d4.oppilaitos_avain=f.oppisopimuskoulutuksen_jarjestaja
LEFT JOIN VipunenTK..d_oppilaitoksen_taustatiedot_historia AS d3h ON d3h.oppilaitos_avain=f.koulutuksen_jarjestaja AND f.tilv_date between d3h.alkaa and d3h.paattyy
LEFT JOIN VipunenTK..d_oppilaitoksen_taustatiedot_historia AS d4h ON d4h.oppilaitos_avain=f.oppisopimuskoulutuksen_jarjestaja AND f.tilv_date between d4h.alkaa and d4h.paattyy
LEFT JOIN VipunenTK..d_koulutusluokitus AS d5 ON d5.koulutusluokitus_avain=f.koulutusluokitus
LEFT JOIN VipunenTK..d_koulutusluokitus_historia AS d5h ON d5h.koulutusluokitus_avain=f.koulutusluokitus AND f.tilv_date between d5h.alkaa and d5h.paattyy
LEFT JOIN VipunenTK..d_kieli AS d6 ON d6.kieli_koodi=f.koulutuksen_kieli AND f.tilv_date between d6.alkaa and d6.paattyy

LEFT JOIN VipunenTK..d_alueluokitus AS d7 ON d7.alueluokitus_avain=f.koulutuksen_kunta
LEFT JOIN VipunenTK..d_alueluokitus_historia AS d7h ON d7h.alueluokitus_avain=f.koulutuksen_kunta AND f.tilv_date between d7h.alkaa and d7h.paattyy

LEFT JOIN VipunenTK..d_opetushallinnon_koulutus AS d8 ON d8.opetushallinnon_koulutus_koodi=f.opetushallinnon_koulutus AND f.tilv_date between d8.alkaa and d8.paattyy
LEFT JOIN VipunenTK..d_hallinnonala2 d8b ON d8b.hallinnonala_koodi=f.hallinnonala2 AND f.tilv_date between d8b.alkaa and d8b.paattyy
LEFT JOIN VipunenTK..d_sukupuoli AS d9 ON d9.sukupuoli_koodi=f.sukupuoli AND f.tilv_date between d9.alkaa and d9.paattyy
LEFT JOIN VipunenTK..d_aidinkieli_versio1 AS d10 ON d10.aidinkieli_versio1_koodi=f.aidinkieli AND f.tilv_date between d10.alkaa and d10.paattyy
LEFT JOIN VipunenTK..d_kausi AS d11 ON d11.kausi_id	=(case when isnull(f.kirjoihintulovuosi,'') in ('9999','XXXX','') then '-1' else f.kirjoihintulovuosi end)

LEFT JOIN VipunenTK..d_opiskelijan_olo AS d14 ON d14.opiskelijan_olo_koodi=f.opiskelijan_olo_syys AND f.tilv_date between d14.alkaa and d14.paattyy
LEFT JOIN VipunenTK..d_aikuisopiskelija AS d15 ON d15.aikuisopiskelija_koodi=f.aikuisopiskelija AND f.tilv_date between d15.alkaa and d15.paattyy
LEFT JOIN VipunenTK..d_ika AS d16 ON d16.ika_avain=f.ika_kirjoihintulovuonna
LEFT JOIN VipunenTK..d_ika AS d16_2 ON d16_2.ika_avain=f.ikaryhma_kirjoihintulovuonna
LEFT JOIN VipunenTK..d_ika AS d17 ON d17.ika_avain=f.ika
LEFT JOIN VipunenTK..d_ika AS d17_2 ON d17_2.ika_avain=f.ikaryhma

LEFT JOIN VipunenTK..d_nuorten_aikuisten_koulutus AS d18 ON d18.nuorten_aikuisten_koulutus_koodi=f.nuorten_aikuisten_koulutus AND f.tilv_date between d18.alkaa and d18.paattyy
LEFT JOIN VipunenTK..d_kausi AS d19 ON d19.kausi_id	=(case when isnull(f.koulutuksen_tutkinnon_aloitusvuosi,'') in ('9999','XXXX','') then '-1' else f.koulutuksen_tutkinnon_aloitusvuosi end)

LEFT JOIN VipunenTK..d_ammatillisen_koulutuksen_koulutuslaji AS d21 ON d21.ammatillisen_koulutuksen_koulutuslaji_koodi=f.ammatillisen_koulutuksen_koulutuslaji AND f.tilv_date between d21.alkaa and d21.paattyy
LEFT JOIN VipunenTK..d_tutkintonimike_ammpk AS d22 ON d22.tutkintonimike_ammpk_koodi=f.tutkintonimike_ammpk AND f.tilv_date between d22.alkaa and d22.paattyy
LEFT JOIN VipunenTK..d_koulutusohjelma_ammpk AS d23 ON d23.koulutusohjelma_ammpk_koodi=(case when f.koulutusohjelma_ammpk='9999' then '-1' else f.koulutusohjelma_ammpk end) AND f.tilv_date between d23.alkaa and d23.paattyy
LEFT JOIN VipunenTK..d_opetussuunnitelmaperusteinen_koulutus_nayttotutkintoon_valmistava_koulutus AS d24 ON d24.opetussuunnitelmaperusteinen_koulutus_nayttotutkintoon_valmistava_koulutus_koodi=f.opetussuunnitelmaperusteinen_koulutus_nayttotutkintoon_valmistava_koulutus AND f.tilv_date between d24.alkaa and d24.paattyy

LEFT JOIN VipunenTK..d_rahoituslahde_amm AS d26 ON d26.rahoituslahde_amm_koodi=f.rahoituslahde_amm AND f.tilv_date between d26.alkaa and d26.paattyy

LEFT JOIN VipunenTK..d_tutkinnon_tavoite AS d29 ON d29.tutkinnon_tavoite_koodi=f.tutkinnon_tavoite AND f.tilv_date between d29.alkaa and d29.paattyy

LEFT JOIN VipunenTK..d_alueluokitus AS d36 ON d36.alueluokitus_avain='MAAK'+f.asuinmaakunta
LEFT JOIN VipunenTK..d_alueluokitus_historia AS d36h ON d36h.alueluokitus_avain='MAAK'+f.asuinmaakunta AND f.tilv_date between d36h.alkaa and d36h.paattyy

LEFT JOIN VipunenTK..d_koulutussektori AS d37 ON d37.koulutussektori_koodi=f.koulutussektori AND f.tilv_date between d37.alkaa and d37.paattyy
LEFT JOIN VipunenTK..d_koulutuksen_jarjestamismuoto AS d39 ON d39.koulutuksen_jarjestamismuoto_koodi=f.koulutuksen_jarjestamismuoto AND f.tilv_date between d39.alkaa and d39.paattyy
LEFT JOIN VipunenTK..d_ammatillinen_peruskoulutus_lisakoulutus AS d40 ON d40.ammatillinen_peruskoulutus_lisakoulutus_koodi=f.ammatillinen_peruskoulutus_lisakoulutus AND f.tilv_date between d40.alkaa and d40.paattyy
LEFT JOIN VipunenTK..d_koulutuksen_tavoite_toteuma AS d41 ON d41.koulutuksen_tavoite_toteuma_koodi=f.koulutuksen_tavoite_toteuma AND f.tilv_date between d41.alkaa and d41.paattyy

LEFT JOIN VipunenTK..d_aineisto_OTV AS d43 ON d43.aineisto_koodi=f.aineistotunnus AND f.tilv_date between d43.alkaa and d43.paattyy

/* koulutuksen järjestäjän sijaintikunta */

LEFT JOIN VipunenTK..d_alueluokitus AS d51 ON d51.alueluokitus_avain =
		(select koulutuksen_jarjestajan_ksijaintikuntakoodi from vipunentk..d_oppilaitoksen_taustatiedot where oppilaitos_avain = f.koulutuksen_jarjestaja)

LEFT JOIN VipunenTK..d_alueluokitus_historia AS d51h ON d51h.alueluokitus_avain =
		(select koulutuksen_jarjestajan_ksijaintikuntakoodi from vipunentk..d_oppilaitoksen_taustatiedot where oppilaitos_avain = f.koulutuksen_jarjestaja AND f.tilv_date between d51h.alkaa and d51h.paattyy)
		AND f.tilv_date between d51h.alkaa and d51h.paattyy

LEFT JOIN VipunenTK..d_nuorten_aikuisten_koulutus_amm as d53 on d53.nuorten_aikuisten_koulutus_amm_koodi = f.nuorten_aikuisten_koulutus_amm

LEFT JOIN VipunenTK..d_koulutuslaji_okm AS d54 ON d54.koulutuslaji_okm_avain = f.koulutuslaji_OKM_avain

/*********** yhteinen koulutuksen järjestäjä, oppilaitos & niihin liittyvät aluetiedot -- Lasse 3.9.2015 ***********/

LEFT JOIN VipunenTK..d_oppilaitoksen_taustatiedot AS d55 ON d55.oppilaitos_avain=f.yhtjarj
LEFT JOIN VipunenTK..d_oppilaitoksen_taustatiedot_historia AS d55h ON d55h.oppilaitos_avain=f.yhtjarj AND f.tilv_date between d55h.alkaa and d55h.paattyy

/* yhteisen koulutuksen järjestäjän sijaintikunta */

LEFT JOIN VipunenTK..d_alueluokitus AS d57 ON d57.alueluokitus_avain =
		(select koulutuksen_jarjestajan_ksijaintikuntakoodi from vipunentk..d_oppilaitoksen_taustatiedot where oppilaitos_avain = f.yhtjarj)

LEFT JOIN VipunenTK..d_alueluokitus_historia AS d57h ON d57h.alueluokitus_avain =
		(select koulutuksen_jarjestajan_ksijaintikuntakoodi from vipunentk..d_oppilaitoksen_taustatiedot where oppilaitos_avain = f.yhtjarj AND f.tilv_date between d57h.alkaa and d57h.paattyy)
		AND f.tilv_date between d57h.alkaa and d57h.paattyy

GO
USE [ANTERO]


text:
source .venv/bin/activate
cd tukey_cli/
python tukey_server.py localhost 9292 -p 9292 -l /var/log/tukey/glance-api.log -d


text:
package com.icfcc.common.utils;

import org.junit.Test;

/**
 * Created by root on 15-6-13.
 */
public class SortUtilTest {

    @Test
    public void testsortpopup(){
        Integer[] array = new Integer[]{3,44,2,56,7,8,33};
        array = SortUtil.sortPopup(array);
        for (int i = 0; i < array.length; i++) {
            System.out.println(array[i]);
        }
    }
}


text:
#if !defined(BOOST_SPIRIT_SIMPLE_TRACE_DECEMBER_06_2008_1102AM)
#define BOOST_SPIRIT_SIMPLE_TRACE_DECEMBER_06_2008_1102AM

#if defined(_MSC_VER)
#pragma once
#endif

#include <boost/spirit/home/support/unused.hpp>
#include <boost/spirit/home/qi/nonterminal/debug_handler_state.hpp>
#include <boost/fusion/include/out.hpp>
#include <iostream>
#include <boost/mpl/if.hpp>
#include <boost/mpl/and.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/spirit/home/support/attributes.hpp>

//  The stream to use for debug output
#if !defined(BOOST_SPIRIT_DEBUG_OUT)
#define BOOST_SPIRIT_DEBUG_OUT std::cerr
#endif

//  number of tokens to print while debugging
#if !defined(BOOST_SPIRIT_DEBUG_PRINT_SOME)
#define BOOST_SPIRIT_DEBUG_PRINT_SOME 20
#endif

//  number of spaces to indent
#if !defined(BOOST_SPIRIT_DEBUG_INDENT)
#define BOOST_SPIRIT_DEBUG_INDENT 2
#endif

namespace boost { namespace spirit { namespace qi
{
    namespace detail
    {
        template<typename Char>
        inline void token_printer(std::ostream& o, Char c)
        {
            // allow to customize the token printer routine
            spirit::traits::print_token(o, c);
        }
    }

    struct simple_trace
    {
        int& get_indent() const
        {
            static int indent = 0;
            return indent;
        }

        void print_indent(int n) const
        {
            n *= BOOST_SPIRIT_DEBUG_INDENT;
            for (int i = 0; i != n; ++i)
                BOOST_SPIRIT_DEBUG_OUT << ' ';
        }

        template <typename Iterator>
        void print_some(
            char const* tag
          , int indent
          , Iterator first, Iterator const& last) const
        {
            print_indent(get_indent());
            BOOST_SPIRIT_DEBUG_OUT << '<' << tag << '>';
            int const n = BOOST_SPIRIT_DEBUG_PRINT_SOME;
            for (int i = 0; first != last && i != n && *first; ++i, ++first)
                detail::token_printer(BOOST_SPIRIT_DEBUG_OUT, *first);
            BOOST_SPIRIT_DEBUG_OUT << "</" << tag << '>' << std::endl;

            // $$$ FIXME convert invalid xml characters (e.g. '<') to valid
            // character entities. $$$
        }

        template <typename Iterator, typename Context, typename State>
        void operator()(
            Iterator const& first
          , Iterator const& last
          , Context const& context
          , State state
          , std::string const& rule_name) const
        {
            switch (state)
            {
                case pre_parse:
                    print_indent(get_indent()++);
                    BOOST_SPIRIT_DEBUG_OUT
                        << '<' << rule_name << '>'
                        << std::endl;
                    print_some("try", get_indent(), first, last);
                    break;
                case successful_parse:
                    print_some("success", get_indent(), first, last);
                    print_indent(get_indent());
                    BOOST_SPIRIT_DEBUG_OUT
                        << "<attributes>";
                    traits::print_attribute(
                        BOOST_SPIRIT_DEBUG_OUT,
                        context.attributes
                    );
                    BOOST_SPIRIT_DEBUG_OUT
                        << "</attributes>";
                    if (!fusion::empty(context.locals))
                        BOOST_SPIRIT_DEBUG_OUT
                            << "<locals>"
                            << context.locals
                            << "</locals>";
                    BOOST_SPIRIT_DEBUG_OUT << std::endl;
                    print_indent(--get_indent());
                    BOOST_SPIRIT_DEBUG_OUT
                        << "</" << rule_name << '>'
                        << std::endl;
                    break;
                case failed_parse:
                    print_indent(get_indent());
                    BOOST_SPIRIT_DEBUG_OUT << "<fail/>" << std::endl;
                    print_indent(--get_indent());
                    BOOST_SPIRIT_DEBUG_OUT
                        << "</" << rule_name << '>'
                        << std::endl;
                    break;
            }
        }
    };
}}}

#endif


text:
About Huskify

  Huskify is a simple web application for creating a nice looking printable webpage which displays the order of huskies pulling the sledges.

  You can quickly add new dogs and sledges, simply by
  writing the name and pressing enter. After choosing a sledge you can select dogs by clicking, and use drag and drop to organize them in the sledges.

  The application is written for Extreme Huskies, using some of the latest web technologies and developent tools: Angular.js, angular-local-storage, Font Awesome, ngDialog, Gulp, PureCSS and etc.

There was two main purposes in bulding this:

Learn Angular programming and other new web technologies

Ease Extreme Huskies' employers' trouble when organizing sledges

  {{year}}

  nullbox


text:
package com.haulmont.cuba.core.entity.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Indicates that auto case conversion should be used for text input fields bound with marked entity field.
 */

@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@MetaAnnotation
public @interface CaseConversion {

    /**
     * A conversion type to be used: ConversionType.UPPER or
     * ConversionType.LOWER
     */
    ConversionType type() default ConversionType.UPPER;
}


text:
/* Will be compiled down to a single stylesheet with your sass files */

li.sproutstudy-tab-cohort {
    border-top: 3px solid #005aa8;
    padding-top: 0px;
    float: right;
    line-height: 17px;
    background-color: #e5e5e5;
    -webkit-box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125);
    -moz-box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125);
    box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125);
}
li.sproutstudy-tab-reset {
    border-top: 3px solid #005aa8;
    padding-top: 0px;
    /*float: right;*/
    line-height: 17px;
    /*background-color: #e5e5e5;*/
    /*-webkit-box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125);*/
    /*-moz-box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125);*/
    /*box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125);*/
}
ul.sproutstudy-tab-container-reset {
    margin: 0px 0px 0px 0px;
}

.table-vcenter td {
    vertical-align: middle!important;
}
th.sortable {
    cursor: pointer;
}

.ace_editor { height: 200px; }

div.modal-narrative-template {
    /* background-color: #FDFDBF; */
    background-color: #EFEFEF;
    border: solid #CCCCCC 1px;
}

pre.sprout-transform-model-content {
    overflow: auto;
    -ms-text-overflow: ellipsis;
    -o-text-overflow: ellipsis;
    text-overflow: ellipsis;
    width: inherit;
    min-height: 10px;
}

div.sprout-transform-narrative-content {
    overflow: auto;
    -ms-text-overflow: ellipsis;
    -o-text-overflow: ellipsis;
    text-overflow: ellipsis;
    width: inherit;
    min-height: 10px;
}

div.sprout-study-narrative-content {
    overflow: auto;
    -ms-text-overflow: ellipsis;
    -o-text-overflow: ellipsis;
    text-overflow: ellipsis;
    width: inherit;
    min-height: 10px;
}

pre {padding: 5px; margin: 5px; border-radius: 0px;}
.sprout-transform-model-type-string { color: #FDA339; }
.sprout-transform-model-type-number { color: darkorange; }
.sprout-transform-model-type-boolean { color: blue; }
.sprout-transform-model-type-null { color: magenta; }
.sprout-transform-model-type-key { color: #971885; }
.sprout-transform-model-highlight { background-color: #f8ff00; }

.sprout-transform-locate {
    cursor: pointer;
    margin-left: 5px;
    color: #971885;
    display: inline;
    vertical-align: middle;
}

span.sprout-form-loading-message {
    padding-left: 10px;
    padding-right: 10px;
}

span.sprout-form-loading {
    padding: 6px;
}

div.sprout-transform-narrative-content {
    background-color: #F5F5F5;
    outline: 1px solid #ccc;
    padding: 5px;
}

.sprout-transform-template-error {
    color: #faa732;
}

.dimmed {
  position: relative;
}

.dimmed:after {
  content: " ";
  z-index: 10;
  display: block;
  position: absolute;
  height: 100%;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.05);
}

.sprout-study-form-narrative-split-frame {
	height: 1px;
	width: 100%;
	border: 0px solid #aaa;
}

.sproutstudy-split-frame-content-narrative {
    margin: 10px;
    display: none;
}

.sprout-study-form-narrative-split-frame div {
	overflow: auto;
}

.splitter {
	height: 0px;
}

.ui-state-default { background-color: #CCCCCC }
.ui-state-hover { background-color: #f89406 }
.ui-state-highlight { background-color: #FDD9A7 }
.ui-state-error { background-color: #eaa }

.splitter-pane {
	overflow: auto;
}
.splitter-bar-vertical {
	width: 6px;
	background-image: url(img/vgrabber.gif);
	background-repeat: no-repeat;
	background-position: center;
	border-radius: 3px;
}
.splitter-bar-vertical-docked {
	width: 10px;
	background-image: url(img/vdockbar-trans.gif);
	background-repeat: no-repeat;
	background-position: center;
	border-radius: 4px;
}
.splitter-bar.ui-state-highlight {
	/* opacity: 0.9; */
}
.ssplitter-iframe-hide {
	visibility: hidden;
}

.form-active-icon {
    /*color: rgb(43, 80, 226);*/
    color: #3B99FC;
}

.sprout-study-badge-close {
    cursor: pointer;
}

.sprout-dropdown-header {
    white-space: nowrap;
}

.sprout-default-tab-icon {
    margin-left: 5px;
    /*color: #5EA845;*/
}

.sprout-default-tab {
    /*font-weight: bold;*/
    /*text-decoration: underline ;*/
    /*-moz-text-decoration-color: #5EA845; /!* Code for Firefox *!/*/
    /*-webkit-text-decoration-color: #5EA845; /!* Code for Firefox *!/*/
    /*text-decoration-color: #5EA845;*/
    /*text-decoration-style: dashed;*/
    /*-moz-text-decoration-style: dashed;*/
    /*-webkit-text-decoration-style: dashed;*/
}

.sprout-forms-saving-alert {
    font-size: 16px;
    line-height: 20px;
    width: 200px;
    height: 20px;
    /*text-align: right;*/
    position: fixed;
    left: 50%;
    /*margin-left: -100px;*/
    margin-left: -100px;
    /*top: 45px;*/
    padding: 2px 10px 2px 10px;
}

.table-striped tbody tr.highlight td { background-color: #f8ff00; }


text:
---
title:  "Welcome to Jekyll!"
header:
  teaser: "https://farm5.staticflickr.com/4076/4940499208_b79b77fb0a_z.jpg"
categories:
  - some-category
tags:
  - update
---

You'll find this post in your `_posts` directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run `jekyll serve`, which launches a web server and auto-regenerates your site when a file is updated.

To add new posts, simply add a file in the `_posts` directory that follows the convention `YYYY-MM-DD-name-of-post.ext` and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works.

Jekyll also offers powerful support for code snippets - here's some Scala code:

```scala
/**
 * Function that starts an asynchronous consumer run-loop or in case
 * a run-loop is already in progress this function increments the
 * itemsToPush count. And in case we've exceeded the bufferSize, then
 * we start to apply back-pressure.
 */
@tailrec private def pushToConsumer(state: State): Future[Ack] = {
  // no run-loop is active? then we need to start one
  if (state.itemsToPush == 0) {
    val update = state.copy(
      nextAckPromise = Promise[Ack](),
      appliesBackPressure = false,
      itemsToPush = 1)

    if (!stateRef.compareAndSet(state, update)) {
      // CAS failed, retry
      pushToConsumer(stateRef.get)
    }
    else {
      scheduler.execute(new Runnable { def run() = fastLoop(update, 0, 0) })
      Continue
    }
  }
  else {
    val appliesBackPressure = state.shouldBackPressure(bufferSize)
    val update = state.copy(
      itemsToPush = state.itemsToPush + 1,
      appliesBackPressure = appliesBackPressure)

    if (!stateRef.compareAndSet(state, update)) {
      // CAS failed, retry
      pushToConsumer(stateRef.get)
    }
    else if (appliesBackPressure) {
      // the buffer is full, so we need to apply back-pressure
      state.nextAckPromise.future
    }
    else {
      // everything normal, buffer is not full
      Continue
    }
  }
}
```

Check out the [Jekyll docs][jekyll-docs] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll's GitHub repo][jekyll-gh]. If you have questions, you can ask them on [Jekyll Talk][jekyll-talk].

[jekyll-docs]: http://jekyllrb.com/docs/home
[jekyll-gh]:   https://github.com/jekyll/jekyll
[jekyll-talk]: https://talk.jekyllrb.com/


text:
A library to parse a MacGourmet 3 export file and convert into an Evernote
export file. The resulting Evernote export file (*.enex) can be imported into
Evernote.

This converts most, but not all, MacGourmet recipe attributes.

## Installation

Download and install [FreeImage](http://sourceforge.net/projects/freeimage/).
  [Homebrew](http://brew.sh) users can:

    brew install freeimage

Add this line to your application's Gemfile:

    gem 'mg2en'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install mg2en

## Usage

    mg2en -h

## Contributing

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


text:
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/**
* @name: S15.5.4.12_A1_T3;
* @section: 15.5.4.12;
* @assertion: String.prototype.search (regexp);
* @description: Checking by using eval;
*/

var search = String.prototype.search;

if (typeof toString === "undefined"){
    var toString = Object.prototype.toString;
}

var __class__ = toString();

//////////////////////////////////////////////////////////////////////////////
//CHECK#1
if (search(eval("\"bj\"")) !== 2) {
  $ERROR('#1: search = String.prototype.search; search(eval("\\"bj\\"")) === 2. Actual: '+search(eval("\"bj\"")) );
}
//
//////////////////////////////////////////////////////////////////////////////


text:
package de.hsbremen.chat.client;

import de.hsbremen.chat.events.EventArgs;
import de.hsbremen.chat.events.listeners.IErrorListener;
import de.hsbremen.chat.network.ITransferable;

import javax.swing.*;

/**
 * Created by cschaf on 17.04.2015.
 */
public class ErrorListener implements IErrorListener{
    private Gui gui;
    private Controller ctrl;

    public ErrorListener(Gui gui, Controller ctrl){

        this.gui = gui;
        this.ctrl = ctrl;
    }
    public void onError(EventArgs<ITransferable> eventArgs) {
        gui.traMessages.append(eventArgs.getItem().toString() + "\n");
        this.ctrl.logout();
        gui.changeNavbarEnableState(true);
        DefaultListModel<String> model = (DefaultListModel<String>) gui.listUsers.getModel();
        model.clear();
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>

<databaseChangeLog
        xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">

    <changeSet id="1" author="nvoxland">
        <createTable schemaName="liquibaseb" tableName="person2">
            <column name="id" type="int">
                <constraints primaryKey="true" nullable="false"/>
            </column>
            <column name="firstname" type="varchar(50)"/>
            <column name="lastname" type="varchar(50)">
                <constraints nullable="false"/>
            </column>
        </createTable>
    </changeSet>
    <changeSet id="2" author="nvoxland">
        <comment>Add a username column so we can use "person" for authentication</comment>
        <addColumn schemaName="liquibaseb" tableName="person2">
            <column name="username" type="varchar(8)"/>
        </addColumn>
    </changeSet>
    <changeSet id="5" author="nvoxland" context="test">
        <insert schemaName="liquibaseb" tableName="person2">
            <column name="id" valueNumeric="1"/>
            <column name="firstname" value="John"/>
            <column name="lastname" value="Doe"/>
            <column name="username" value="jdoe"/>
        </insert>
        <insert schemaName="liquibaseb" tableName="person2">
            <column name="id" valueNumeric="2"/>
            <column name="firstname" value="Jane"/>
            <column name="lastname" value="Doe"/>
            <column name="username" value="janedoe"/>
        </insert>
        <insert schemaName="liquibaseb" tableName="person2">
            <column name="id" valueNumeric="3"/>
            <column name="firstname" value="Bob"/>
            <column name="lastname" value="Johnson"/>
            <column name="username" value="bjohnson"/>
        </insert>
    </changeSet>
    <!--<changeSet id="6" author="nvoxland">-->
        <!--<dropColumn schemaName="liquibaseb" tableName="person2" columnName="username"/>-->
    <!--</changeSet>-->
    <changeSet id="7" author="nvoxland">
        <createTable schemaName="liquibaseb" tableName="company2">
            <column name="id" type="int">
                <constraints primaryKey="true" nullable="false"/>
            </column>
            <column name="name" type="varchar(50)">
                <constraints nullable="false"/>
            </column>
        </createTable>
    </changeSet>
    <changeSet id="7" author="bjohnson" context="test">
        <insert schemaName="liquibaseb" tableName="company2">
            <column name="id" valueNumeric="1"/>
            <column name="name" value="ACME Corp"/>
        </insert>
        <insert schemaName="liquibaseb" tableName="company2">
            <column name="id" valueNumeric="2"/>
            <column name="name" value="Widgets Inc."/>
        </insert>
    </changeSet>
    <!--<changeSet id="7a" author="nvoxland">-->
        <!--<addColumn schemaName="liquibaseb" tableName="company2">-->
            <!--<column name="company_id" type="int">-->
                <!--<constraints nullable="true" foreignKeyName="fk_employee_company" references="employee(id)"/>-->
            <!--</column>-->
        <!--</addColumn>-->
    <!--</changeSet>-->
    <changeSet id="8" author="bjohnson">
        <dropNotNullConstraint schemaName="liquibaseb" tableName="company2" columnName="name" columnDataType="varchar(50)"/>
    </changeSet>
    <!--<changeSet id="8.1" author="bjohnson">-->
        <!--<addNotNullConstraint schemaName="liquibaseb" tableName='company2' columnName="name" defaultNullValue="UNKNOWN"-->
                              <!--columnDataType="varchar(50)"/>-->
    <!--</changeSet>-->
    <!--<changeSet id="9" author="nvoxland">-->
        <!--<renameTable schemaName="liquibaseb" oldTableName="employee2" newTableName="company2"/>-->
    <!--</changeSet>-->
    <changeSet id="10" author="nvoxland">
        <createTable schemaName="liquibaseb" tableName="testtable2">
            <column name="id" type="int">
                <constraints primaryKey="true" nullable="false"/>
            </column>
            <column name="valueCol" type="varchar(50)">
                <constraints nullable="false"/>
            </column>
            <column name="person_id" type="int">
                <constraints nullable="false" foreignKeyName="fk_test_person" references="liquibaseb.person2(id)"/>
            </column>
        </createTable>
    </changeSet>
    <changeSet id="11" author="nvoxland">
        <dropTable schemaName="liquibaseb" tableName="testtable2"/>
    </changeSet>

    <changeSet id="12" author="nvoxland">
        <createIndex indexName="idx_company_name2" schemaName="liquibaseb" tableName="company2">
            <column name="name"/>
        </createIndex>
        <createIndex indexName="idx_person_lastname2" schemaName="liquibaseb" tableName="person2">
            <column name="lastname"/>
        </createIndex>
    </changeSet>

    <changeSet id="13" author="nvoxland">
        <dropIndex indexName="idx_person_lastname2" schemaName="liquibaseb" tableName="person2"/>
    </changeSet>

    <changeSet id="19" author="nvoxland">
        <mergeColumns
                schemaName="liquibaseb"
                tableName="person2"
                column1Name="firstname"
                joinString=" "
                column2Name="lastname"
                finalColumnName="fullname"
                finalColumnType="varchar(100)"/>
    </changeSet>

    <changeSet id="22" author="nvoxland">
        <addColumn schemaName="liquibaseb" tableName="person2">
            <column name="employer_id" type="int"/>
        </addColumn>
    </changeSet>

    <changeSet id="23" author="nvoxland">
        <addForeignKeyConstraint
                baseTableSchemaName="liquibaseb" baseTableName="person2" baseColumnNames="employer_id"
                constraintName="fk_person_employer"
                referencedTableSchemaName="liquibaseb" referencedTableName="company2" referencedColumnNames="id"
                deleteCascade="true"/>
    </changeSet>

    <changeSet id="24" author="nvoxland">
        <dropForeignKeyConstraint baseTableSchemaName="liquibaseb" baseTableName="person2" constraintName="fk_person_employer"/>
    </changeSet>

    <changeSet id="25" author="nvoxland">
        <createTable schemaName="liquibaseb" tableName="address2">
            <column name="id" type="int"/>
            <column name="line1" type="varchar(255)"/>
            <column name="line2" type="varchar(255)"/>
            <column name="city" type="varchar(255)"/>
            <column name="state" type="char(2)"/>
            <column name="postalcode" type="varchar(15)"/>
        </createTable>
    </changeSet>

    <changeSet id="25.1" author="nvoxland">
        <addNotNullConstraint schemaName="liquibaseb" tableName="address2" columnName="id" columnDataType="int" defaultNullValue="0"/>
    </changeSet>

    <changeSet id="25.2" author="nvoxland">
        <addPrimaryKey schemaName="liquibaseb" tableName="address2" columnNames="id" constraintName="pk_address2"/>
    </changeSet>

    <changeSet id="26" author="nvoxland">
        <insert schemaName="liquibaseb" tableName="address2">
            <column name="id" valueNumeric="1"/>
            <column name="line1" value="123 4th St"/>
            <column name="line2" value="Suite 432"/>
            <column name="city" value="New York"/>
            <column name="state" value="NY"/>
            <column name="postalcode" value="01235"/>
        </insert>
        <insert schemaName="liquibaseb" tableName="address2">
            <column name="id" valueNumeric="2"/>
            <column name="line1" value="6123 64th St"/>
            <column name="city" value="New York"/>
            <column name="state" value="NY"/>
            <column name="postalcode" value="01235"/>
        </insert>
        <insert schemaName="liquibaseb" tableName="address2">
            <column name="id" valueNumeric="3"/>
            <column name="line1" value="One Liquibase Way"/>
            <column name="city" value="Fargo"/>
            <column name="state" value="ND"/>
            <column name="postalcode" value="58103"/>
        </insert>
        <insert schemaName="liquibaseb" tableName="address2">
            <column name="id" valueNumeric="4"/>
            <column name="line1" value="123 Main Ave"/>
            <column name="city" value="City With No State"/>
            <column name="postalcode" value="00000"/>
        </insert>
    </changeSet>

    <!--<changeSet id="27" author="nvoxland">-->
        <!--<addLookupTable-->
                <!--existingTableSchemaName="liquibaseb" existingTableName="address2" existingColumnName="state"-->
                <!--newTableSchemaName="liquibaseb" newTableName="state2" newColumnName="id" newColumnDataType="char(2)"/>-->
    <!--</changeSet>-->

    <changeSet id="28" author="nvoxland">
        <addDefaultValue schemaName="liquibaseb" tableName="address2" columnName="line2" columnDataType="varchar(255)" defaultValue="N/A"/>
    </changeSet>

    <changeSet id="29" author="nvoxland">
        <dropDefaultValue schemaName="liquibaseb" tableName="address2" columnName="line2" columnDataType="varchar(255)"/>
    </changeSet>

    <changeSet id="30" author="nvoxland">
        <createTable schemaName="liquibaseb" tableName="pkTest2">
            <column name="id" type="int"/>
            <column name="valueCol" type="varchar(50)"/>
        </createTable>
    </changeSet>

    <!--<changeSet id="31" author="nvoxland">-->
        <!--<addPrimaryKey schemaName="liquibaseb" tableName="pkTest2" columnNames="id" constraintName="pk_pktest"/>-->
    <!--</changeSet>-->

    <!--<changeSet id="32" author="nvoxland">-->
        <!--<dropPrimaryKey schemaName="liquibaseb" tableName="pkTest2" constraintName="pk_pktest"/>-->
    <!--</changeSet>-->

    <!--<changeSet id="33" author="nvoxland">-->
        <!--<addUniqueConstraint schemaName="liquibaseb" tableName="address2" columnNames="line1, line2" constraintName="uq_address_l1l2"/>-->
    <!--</changeSet>-->

    <!--<changeSet id="34" author="nvoxland">-->
        <!--<dropUniqueConstraint schemaName="liquibaseb" tableName="address2" constraintName="uq_address_l1l2"/>-->
    <!--</changeSet>-->

    <changeSet id="35" author="nvoxland">
        <createTable schemaName="liquibaseb" tableName="tableToRollback2">
            <column name="id" type="int"/>
        </createTable>
    </changeSet>

    <changeSet id="50" author="nvoxland">
        <modifyDataType tableName="address" columnName="postalcode" newDataType="varchar(20)"/>
    </changeSet>

</databaseChangeLog>


text:
layout: post
title: "Useful Tools I Use"
---

# [k2pdfopt](http://www.willus.com/k2pdfopt/)
A tool, transforms pdf files to easy-read pdf in mobile device.
K2pdfopt optimizes PDF/DJVU files for mobile e-readers (e.g. the Kindle) and smartphones. It works well on multi-column PDF/DJVU files and can re-flow text even on scanned PDF files. It can also be used as a general PDF copying/cropping/re-sizing/OCR-ing manipulation tool.

# [Coherent PDF](http://community.coherentpdf.com)
The Coherent PDF Command Line Tools allow you to manipulate existing PDF files in a variety of ways. E.g.:
* Merge PDF files together, or split them apart
* Encrypt and decrypt
* Scale, crop and rotate pages
* Read and set document info and metadata
* Copy, add or remove bookmarks
* Stamp logos, text, dates, page numbers
* Add or remove attachments
* Losslessly compress PDF files

GNU Aspell is a Free and Open Source spell checker.

## Basic usage
1. For any files: `aspell -c [file]`
2. For tex files: `aspell -t -c [file]`

# [htop](http://hisham.hm/htop/)
An interactive text-mode process viewer for Unix systems.

## Basic usage
1. Run it: `htop`
2. Sort by a column: `<F6>`
3. Filter to locate your interested process: `<F4>`
4. Setup all things: `<F2>`

# [AutoIt](https://www.autoitscript.com/site/autoit/)(For windows)
AutoIt is a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting.

## What I use it for?
1. Game automation.
2. Auto fillout web form.

# Online markdown editor: [dillinger](http://dillinger.io)
Well, a perfect online markdown editor, except not supporting chinese.

# [Expect](http://expect.sourceforge.net/)
Expect is a tool for automating interactive applications such as telnet, ftp, passwd, fsck, rlogin, tip, etc. Expect really makes this stuff trivial. Expect is also useful for testing these same applications. And by adding Tk, you can also wrap interactive applications in X11 GUIs.

## My example
~~~
#!/usr/bin/expect
set timeout 2
# This line login your server
spawn ssh [your-server]

# After login your sever, run a script, which need a sudo priviledge
expect "$"
send "./startRun.sh\r"

# Send the password.
expect "Password:"
send "[yourPassword]\r"

expect "$"
send "cd ~/Projects\r"
interact
#expect eof
~~~


text:
from django.apps import apps
from django.utils.html import mark_safe
from mako.exceptions import RichTraceback
from mako.template import Template as MakoTemplate
from mako.runtime import Context as MakoContext, _populate_self_namespace

import io
import os, os.path

def template_inheritance(obj):
    '''
    Generator that iterates the template and its ancestors.
    The order is from most specialized (furthest descendant) to
    most general (furthest ancestor).

    obj can be either:
        1. Mako Template object
        2. Mako `self` object (available within a rendering template)
    '''
    if isinstance(obj, MakoTemplate):
        obj = create_mako_context(obj)['self']
    elif isinstance(obj, MakoContext):
        obj = obj['self']
    while obj is not None:
        yield obj.template
        obj = obj.inherits

def create_mako_context(template_obj, **kwargs):
    # I'm hacking into private Mako methods here, but I can't see another
    # way to do this.  Hopefully this can be rectified at some point.
    kwargs.pop('self', None)  # some contexts have self in them, and it messes up render_unicode below because we get two selfs
    runtime_context = MakoContext(io.StringIO(), **kwargs)
    runtime_context._set_with_template(template_obj)
    _, mako_context = _populate_self_namespace(runtime_context, template_obj)
    return mako_context

def get_template_debug(template_name, error):
    '''
    This structure is what Django wants when errors occur in templates.
    It gives the user a nice stack trace in the error page during debug.
    '''
    # This is taken from mako.exceptions.html_error_template(), which has an issue
    # in Py3 where files get loaded as bytes but `lines = src.split('\n')` below
    # splits with a string. Not sure if this is a bug or if I'm missing something,
    # but doing a custom debugging template allows a workaround as well as a custom
    # DMP look.
    # I used to have a file in the templates directory for this, but too many users
    # reported TemplateNotFound errors. This function is a bit of a hack, but it only
    # happens during development (and mako.exceptions does this same thing).
    #   /justification
    stacktrace_template = MakoTemplate(r"""
<%! from mako.exceptions import syntax_highlight, pygments_html_formatter %>

<%

    src = tback.source
    line = tback.lineno
    if isinstance(src, bytes):
        src = src.decode()
    if src:
        lines = src.split('\n')
    else:
        lines = None
%>

${tback.errorname}: ${tback.message}

% if lines:

    % for index in range(max(0, line-4),min(len(lines), line+5)):
        <%
        if pygments_html_formatter:
            pygments_html_formatter.linenostart = index + 1
        %>
        % if index + 1 == line:
        <%
        if pygments_html_formatter:
            old_cssclass = pygments_html_formatter.cssclass
            pygments_html_formatter.cssclass = 'error ' + old_cssclass
        %>
            ${lines[index] | n,syntax_highlight(language='mako')}
        <%
        if pygments_html_formatter:
            pygments_html_formatter.cssclass = old_cssclass
        %>
        % else:
            ${lines[index] | n,syntax_highlight(language='mako')}
        % endif
    % endfor

% endif

% for (filename, lineno, function, line) in tback.reverse_traceback:

${filename}, line ${lineno}:

    <%
       if pygments_html_formatter:
           pygments_html_formatter.linenostart = lineno
    %>

${line | n,syntax_highlight(filename)}

% endfor

""")
    tback = RichTraceback(error, error.__traceback__)
    lines = stacktrace_template.render_unicode(tback=tback)
    return {
        'message': '',
        'source_lines': [
            ( '', mark_safe(lines) ),
        ],
        'before': '',
        'during': '',
        'after': '',
        'top': 0,
        'bottom': 0,
        'total': 0,
        'line': tback.lineno or 0,
        'name': template_name,
        'start': 0,
        'end': 0,
    }


text:
.PHONY: test

test:
	python3 -m unittest discover -s cocytus
	python3 -m unittest discover -s cocytus_net/C


text:
package it.cavallium.warppi.math.parser.features.interfaces;

import it.cavallium.warppi.math.Function;
import it.cavallium.warppi.math.MathContext;
import it.cavallium.warppi.util.Error;

public abstract interface Feature {

	Function toFunction(MathContext context) throws Error;

}


text:
// SJCL is open. You can use, modify and redistribute it under a BSD
// license or under the GNU GPL, version 2.0.
//
// ---------------------------------------------------------------------
//
// http://opensource.org/licenses/BSD-2-Clause
//
// Copyright (c) 2009-2015, Emily Stark, Mike Hamburg and Dan Boneh at
// Stanford University. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

/**
 * @fileoverview (PseudoMersenne) Prime fields and field points.
 *
 * @author Emily Stark
 * @author Mike Hamburg
 * @author Dan Boneh
 * @author Matthew Wampler-Doty
 */

goog.provide('secp256k1.sjcl.bn.prime.Field');
goog.require('secp256k1.sjcl.bn');

/**
 * @constructor
 * @struct
 * @final
 * @param {!number} exponent Exponent of the power of two of the Pseudo-Mersenne Prime.
 * @param {!Array<!Array<number>>} coeff Coefficients that parametrizes the prime field.
 */
secp256k1.sjcl.bn.prime.Field = function (exponent, coeff) {
    var i,
        tmp = exponent / secp256k1.sjcl.bn.radix,
        mo = Math.ceil(tmp);

    /**
     * Offset for performing approximate modulus reductions
     * @type {number}
     */
    this.modOffset = mo;
    this.exponent = exponent;
    this.offset = new Array(coeff.length);
    this.factor = new Array(coeff.length);
    this.minOffset = mo;
    this.fullOffset = new Array(coeff.length);
    this.fullFactor = new Array(coeff.length);
    this.modulus = new secp256k1.sjcl.bn(Math.pow(2, exponent));
    this.fullMask = 0 | -Math.pow(2, exponent % secp256k1.sjcl.bn.radix);

    for (i = 0; i < coeff.length; i++) {
        this.offset[i] = Math.floor(coeff[i][0] / secp256k1.sjcl.bn.radix - tmp);
        this.fullOffset[i] = Math.ceil(coeff[i][0] / secp256k1.sjcl.bn.radix - tmp);
        this.factor[i] = coeff[i][1] * Math.pow(1 / 2, exponent - coeff[i][0] + this.offset[i] * secp256k1.sjcl.bn.radix);
        this.fullFactor[i] = coeff[i][1] *
            Math.pow(1 / 2, exponent - coeff[i][0] + this.fullOffset[i] * secp256k1.sjcl.bn.radix);
        this.modulus.addM(new secp256k1.sjcl.bn(Math.pow(2, coeff[i][0]) * coeff[i][1]));
        this.minOffset = Math.min(this.minOffset, -this.offset[i]); // conservative
    }
};


text: R CMD REMOVE --library=$PREFIX/lib/R/library/ TxDb.Athaliana.BioMart.plantsmart28


text:
package io.trivium.dep.org.apache.commons.cli;

/**
 * Base for Exceptions thrown during parsing of a command-line.
 *
 * @version $Id: ParseException.java 1443102 2013-02-06 18:12:16Z tn $
 */
public class ParseException extends Exception
{
    /**
     * This exception {@code serialVersionUID}.
     */
    private static final long serialVersionUID = 9112808380089253192L;

    /**
     * Construct a new ParseException
     * with the specified detail message.
     *
     * @param message the detail message
     */
    public ParseException(String message)
    {
        super(message);
    }
}


text:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using CodeStage.AntiCheat.ObscuredTypes;
using TentacleGuitarUnity;
using Assets.ExternalCode.WebApi;
using Assets.ExternalCode.Models;
using System.IO;

/// <summary>
/// 网络管理器
///
/// 游戏主体 与 网络管理器 在此对♂接♀
///
/// 1、登陆登出等常用指令
/// 2、获取谱面信息,下载谱面
///
/// </summary>
public class NetworkManager
{

    #region -------- Param --------

    /// <summary>
    /// 获取当前用户的登陆令牌("记住我"功能使用,加密保存至本地,不要直接返回真实密码),未登录的话返回""
    /// </summary>
    public static ObscuredString LoginToken
    {
        set
        {
            ObscuredPrefs.SetString("LoginToken", value);
        }
        get
        {
            return ObscuredPrefs.GetString("LoginToken", "");
        }
    }

    /// <summary>
    /// 获取歌曲列表的歌曲总数,包含下载的和未下载的
    /// 这步要获取在本地的Cache,不要访问服务器
    /// </summary>
    public static List<Music> SongList = new List<Music>();

    #endregion

    #region -------- Server Logic --------

    /// <summary>
    /// 尝试登陆
    /// </summary>
    /// <param name="name"> 用户名 </param>
    /// <param name="passWord"> 密码或登陆令牌 </param>
    /// <param name="useRealPassWord"> 若为true 则参数passWord是真实密码,否则为"记住我"功能使用的登陆令牌,这个令牌我会加密保存在本地 </param>
    public static IEnumerator TryLogin(ObscuredString name, ObscuredString passWord)
    {

        //string token = Account.SignIn(name, passWord);

        var t = Account.SignInAsync(name, passWord);

        while (!t.IsCompleted)
        {
            yield return new WaitForSeconds(0.01f);
        }

        string token = t.Result;

        if (string.IsNullOrEmpty(token))
        {
            Stage.LoginDone(false, false, "Fail to Sign In.");
        }
        else
        {
            LoginToken = token;
            Stage.LoginDone(true);
        }

    }

    /// <summary>
    /// 尝试加载歌曲列表的信息
    /// </summary>
    public static IEnumerator TryLoadSongListInfo()
    {
        SongList.Clear();

        var t = Game.GetMusicsAsync();

        while (!t.IsCompleted)
        {
            yield return new WaitForSeconds(0.01f);
        }

        SongList = t.Result;

        Stage.LoadSongListDone(true);
    }

    /// <summary>
    /// 尝试下载列表中的一首歌
    /// </summary>
	public static IEnumerator TryDownloadSong (string id)
	{

		Stage.SetDownLoadProgress(id, 0.2f);

		var t0 = Game.GetInstrumentAsync(new System.Guid(id));
        while (!t0.IsCompleted)
        {
            yield return new WaitForSeconds(0.01f);
        }
        byte[] b = t0.Result;

        FileUtility.ByteToFile(
            b,
            Application.persistentDataPath + "/" + id + "/Music.wav"
        );

        Stage.SetDownLoadProgress(id, 0.8f);

        var t1 = Game.GetTabularStringAsync(new System.Guid(id));
        while (!t1.IsCompleted)
        {
            yield return new WaitForSeconds(0.01f);
        }
        FileUtility.WriteText(
            JsonHelper.FormatJson(t1.Result),
            Application.persistentDataPath + "/" + id + "/BeatMap.json"
        );

        Stage.SetDownLoadProgress(id, 1f);
        Stage.DownLoadDone(true, id);

        yield return null;
    }

    /// <summary>
    /// 上传玩家成绩
    /// </summary>
    /// <param name="songID">歌曲ID</param>
    /// <param name="score">分数</param>
    /// <param name="maxCombo">最大连击数</param>
    public static void TryUploadResult(string songID, int score, int maxCombo)
    {
        Game.SubmitScoreAsync(new System.Guid(songID), LoginToken, score);
    }

    #endregion

    #region -------- Local Logic --------

    /// <summary>
    /// 查看列表里的某首歌是否已经下载完毕 或 曾经下载过
    /// </summary>
    /// <param name="id">  </param>
    /// <returns>  </returns>
    public static bool SongIsDownLoaded(string id)
    {
		return File.Exists(Path.Combine(Path.Combine(Application.persistentDataPath, id), "Music.wav")) &&
			File.Exists(Path.Combine(Path.Combine(Application.persistentDataPath, id), "BeatMap.json"));
    }

    /// <summary>
    /// 获取列表里的某首歌音乐文件在本地的完整路径
    /// 游戏主体可以保证
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public static string GetSongLocalPath(string id)
    {
		return Path.Combine(Path.Combine(Application.persistentDataPath, id), "Music.wav");
    }

    /// <summary>
    /// 获取列表里的某首歌谱面文件在本地的完整路径
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public static string GetBeatMapLocalPath(string id)
    {
		return Path.Combine(Path.Combine(Application.persistentDataPath, id), "BeatMap.json");
    }

    #endregion

}


text:
List all existing branches

    $ git branch

Switch HEAD branch

    $ git checkout &ltbranch&gt

Create a new branch based on your current HEAD

    $ git branch &ltnew-branch&gt

Create a new tracking branch based on a remote branch

    $ git checkout --track &ltremote/branch&gt

Delete a local branch

    $ git branch -d &ltbranch&gt

Mark the current commit with a tag

    $ git tag &lttag-name&gt


text:
<?php
/**
 * The contents of this file was generated using the WSDLs as provided by eBay.
 *
 * DO NOT EDIT THIS FILE!
 */

namespace DTS\eBaySDK\Trading\Enums;

/**
 *
 */
class PromotionItemSelectionCodeType
{
    const C_AUTOMATIC = 'Automatic';
    const C_CUSTOM_CODE = 'CustomCode';
    const C_MANUAL = 'Manual';
}


text:
namespace TaskDistribution {
  ComputingUnitManager::ComputingUnitManager(
      ObjectArchive<Key>& archive):
    archive_(archive) { }

  void ComputingUnitManager::process_local(TaskEntry& task) {
    if (task.result_key.is_valid())
      return;

    task.result_key = new_key(Key::Result);

    // Assumes that the computing unit is defined. TODO: remove this assumption.
    BaseComputingUnit const* unit;

    // Gets the correct computing unit and executes it
    unit = BaseComputingUnit::get_by_key(task.computing_unit_id_key);
    if (unit == nullptr) {
      std::string computing_unit_id;
      archive_.load(task.computing_unit_id_key, computing_unit_id);
      // Assumes true is always returned.
      BaseComputingUnit::bind_key(computing_unit_id,
          task.computing_unit_id_key);
      unit = BaseComputingUnit::get_by_key(task.computing_unit_id_key);
    }

    // Processes the task using the correct unit
    unit->execute(archive_, task, *this);

    archive_.insert(task.task_key, task);
  }

  Key ComputingUnitManager::new_key(Key::Type type) {
    return Key::new_key(type);
  }
}


text:
/*
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */

package javax.lang.model;

import java.lang.annotation.*;
import java.util.List;
import javax.lang.model.element.*;
import javax.lang.model.type.*;

/**
 * Represents a construct that can be annotated.
 *
 * A construct is either an {@linkplain
 * javax.lang.model.element.Element element} or a {@linkplain
 * javax.lang.model.type.TypeMirror type}.  Annotations on an element
 * are on a declaration, whereas annotations on a type are on
 * a specific use of a type name.
 *
 * The terms directly present, present,
 * indirectly present, and associated  are used
 * throughout this interface to describe precisely which annotations
 * are returned by the methods defined herein.
 *
 *
In the definitions below, an annotation A has an
 * annotation type AT. If AT is a repeatable annotation
 * type, the type of the containing annotation is ATC.
 *
 *
Annotation A is directly present on a construct
 * C if either:
 *
 *

 *
 *
A is explicitly or implicitly declared as applying to
 * the source code representation of C.
 *
 *
Typically, if exactly one annotation of type AT appears in
 * the source code of representation of C, then A is
 * explicitly declared as applying to C.
 *
 * If there are multiple annotations of type AT present on
 * C, then if AT is repeatable annotation type, an
 * annotation of type ATC is implicitly declared on C.
 *
 *
 A representation of A appears in the executable output
 * for C, such as the {@code RuntimeVisibleAnnotations} or
 * {@code RuntimeVisibleParameterAnnotations} attributes of a class
 * file.
 *
 *

 *
 *
An annotation A is present on a
 * construct C if either:
 *

 *
 *
A is directly present on C.
 *
 *
No annotation of type AT is directly present on
 * C, and C is a class and AT is inheritable
 * and A is present on the superclass of C.
 *
 *

 *
 * An annotation A is indirectly present on a construct
 * C if both:
 *
 *

 *
 *
AT is a repeatable annotation type with a containing
 * annotation type ATC.
 *
 *
An annotation of type ATC is directly present on
 * C and A is an annotation included in the result of
 * calling the {@code value} method of the directly present annotation
 * of type ATC.
 *
 *

 *
 * An annotation A is associated with a construct
 * C if either:
 *
 *

 *
 *
 A is directly or indirectly present on C.
 *
 *
 No annotation of type AT is directly or indirectly
 * present on C, and C is a class, and AT is
 * inheritable, and A is associated with the superclass of
 * C.
 *
 *

 *
 * @since 1.8
 * @jls 9.6 Annotation Types
 * @jls 9.6.3.3 @Inherited
 */
public interface AnnotatedConstruct {
    /**
     * Returns the annotations that are directly present on
     * this construct.
     *
     * @return the annotations directly present on this
     * construct; an empty list if there are none
     */
    List<? extends AnnotationMirror> getAnnotationMirrors();

    /**
     * Returns this construct's annotation of the specified type if
     * such an annotation is present, else {@code null}.
     *
     *
 The annotation returned by this method could contain an element
     * whose value is of type {@code Class}.
     * This value cannot be returned directly:  information necessary to
     * locate and load a class (such as the class loader to use) is
     * not available, and the class might not be loadable at all.
     * Attempting to read a {@code Class} object by invoking the relevant
     * method on the returned annotation
     * will result in a {@link MirroredTypeException},
     * from which the corresponding {@link TypeMirror} may be extracted.
     * Similarly, attempting to read a {@code Class[]}-valued element
     * will result in a {@link MirroredTypesException}.
     *
     *

     * Note: This method is unlike others in this and related
     * interfaces.  It operates on runtime reflective information —
     * representations of annotation types currently loaded into the
     * VM — rather than on the representations defined by and used
     * throughout these interfaces.  Consequently, calling methods on
     * the returned annotation object can throw many of the exceptions
     * that can be thrown when calling methods on an annotation object
     * returned by core reflection.  This method is intended for
     * callers that are written to operate on a known, fixed set of
     * annotation types.
     *

     *
     * @param   the annotation type
     * @param annotationType  the {@code Class} object corresponding to
     *          the annotation type
     * @return this construct's annotation for the specified
     * annotation type if present, else {@code null}
     *
     * @see #getAnnotationMirrors()
     * @see java.lang.reflect.AnnotatedElement#getAnnotation
     * @see EnumConstantNotPresentException
     * @see AnnotationTypeMismatchException
     * @see IncompleteAnnotationException
     * @see MirroredTypeException
     * @see MirroredTypesException
     * @jls 9.6.1 Annotation Type Elements
     */
     A getAnnotation(Class annotationType);

    /**
     * Returns annotations that are associated with this construct.
     *
     * If there are no annotations associated with this construct, the
     * return value is an array of length 0.
     *
     * The order of annotations which are directly or indirectly
     * present on a construct C is computed as if indirectly present
     * annotations on C are directly present on C in place of their
     * container annotation, in the order in which they appear in the
     * value element of the container annotation.
     *
     * The difference between this method and {@link #getAnnotation(Class)}
     * is that this method detects if its argument is a repeatable
     * annotation type, and if so, attempts to find one or more
     * annotations of that type by "looking through" a container annotation.
     *
     *
 The annotations returned by this method could contain an element
     * whose value is of type {@code Class}.
     * This value cannot be returned directly:  information necessary to
     * locate and load a class (such as the class loader to use) is
     * not available, and the class might not be loadable at all.
     * Attempting to read a {@code Class} object by invoking the relevant
     * method on the returned annotation
     * will result in a {@link MirroredTypeException},
     * from which the corresponding {@link TypeMirror} may be extracted.
     * Similarly, attempting to read a {@code Class[]}-valued element
     * will result in a {@link MirroredTypesException}.
     *
     *

     * Note: This method is unlike others in this and related
     * interfaces.  It operates on runtime reflective information —
     * representations of annotation types currently loaded into the
     * VM — rather than on the representations defined by and used
     * throughout these interfaces.  Consequently, calling methods on
     * the returned annotation object can throw many of the exceptions
     * that can be thrown when calling methods on an annotation object
     * returned by core reflection.  This method is intended for
     * callers that are written to operate on a known, fixed set of
     * annotation types.
     *

     *
     * @param   the annotation type
     * @param annotationType  the {@code Class} object corresponding to
     *          the annotation type
     * @return this construct's annotations for the specified annotation
     *         type if present on this construct, else an empty array
     *
     * @see #getAnnotationMirrors()
     * @see #getAnnotation(Class)
     * @see java.lang.reflect.AnnotatedElement#getAnnotationsByType(Class)
     * @see EnumConstantNotPresentException
     * @see AnnotationTypeMismatchException
     * @see IncompleteAnnotationException
     * @see MirroredTypeException
     * @see MirroredTypesException
     * @jls 9.6 Annotation Types
     * @jls 9.6.1 Annotation Type Elements
     */
     A[] getAnnotationsByType(Class annotationType);
}


text:
try:
    from socket import inet_ntop, inet_pton, AF_INET
except ImportError:
    from socket import inet_ntoa, inet_aton, AF_INET
    inet_ntop = lambda x,y: inet_ntoa(y)
    inet_pton = lambda x,y: inet_aton(y)

from pyasn1.compat.octets import int2oct, oct2int

( OctetString, ) = mibBuilder.importSymbols('ASN1', 'OctetString')
( ConstraintsIntersection, ConstraintsUnion, SingleValueConstraint, ValueRangeConstraint, ValueSizeConstraint, ) = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ConstraintsUnion", "SingleValueConstraint", "ValueRangeConstraint", "ValueSizeConstraint")
( ModuleIdentity, MibIdentifier, ObjectIdentity, snmpModules, snmpDomains, snmpProxys ) = mibBuilder.importSymbols('SNMPv2-SMI', 'ModuleIdentity', 'MibIdentifier', 'ObjectIdentity', 'snmpModules', 'snmpDomains', 'snmpProxys')
( TextualConvention, ) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention')

snmpv2tm = ModuleIdentity(snmpModules.name + (19,)).setRevisions(("2002-10-16 00:00",))

snmpUDPDomain = ObjectIdentity(snmpDomains.name + (1,))

class SnmpUDPAddress(TextualConvention, OctetString):
    subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(6, 6)
    displayHint = "1d.1d.1d.1d/2d"

    def prettyIn(self, value):
        if isinstance(value, tuple):
            # Wild hack -- need to implement TextualConvention.prettyIn
            value = inet_pton(AF_INET, value[0]) + \
                    int2oct((value[1] >> 8) & 0xff) + \
                    int2oct(value[1] & 0xff)
        return OctetString.prettyIn(self, value)

    # Socket address syntax coercion
    def __getitem__(self, i):
        if not hasattr(self, '__tuple_value'):
            v = self.asOctets()
            self.__tuple_value = (
                inet_ntop(AF_INET, v[:4]),
                oct2int(v[4]) << 8 | oct2int(v[5])
            )
        return self.__tuple_value[i]

snmpCLNSDomain = ObjectIdentity(snmpDomains.name + (2,))
snmpCONSDomain = ObjectIdentity(snmpDomains.name + (3,))

class SnmpOSIAddress(TextualConvention, OctetString):
    subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(1, 85)
    displayHint = "*1x:/1x:"

snmpDDPDomain = ObjectIdentity(snmpDomains.name + (4,))

class SnmpNBPAddress(OctetString, TextualConvention):
    subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(3, 99)

snmpIPXDomain = ObjectIdentity(snmpDomains.name + (5,))

class SnmpIPXAddress(TextualConvention, OctetString):
    subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(12, 12)
    displayHint = "4x.1x:1x:1x:1x:1x:1x.2d"

rfc1157Proxy = MibIdentifier(snmpProxys.name + (1,))
rfc1157Domain = MibIdentifier(rfc1157Proxy.name + (1,))

# Module identity
mibBuilder.exportSymbols("SNMPv2-TM", PYSNMP_MODULE_ID=snmpv2tm)

mibBuilder.exportSymbols(
    'SNMPv2-TM', snmpv2tm=snmpv2tm, snmpUDPDomain=snmpUDPDomain,
    SnmpUDPAddress=SnmpUDPAddress,
    snmpCLNSDomain=snmpCLNSDomain, snmpCONSDomain=snmpCONSDomain,
    SnmpOSIAddress=SnmpOSIAddress, snmpDDPDomain=snmpDDPDomain,
    SnmpNBPAddress=SnmpNBPAddress, snmpIPXDomain=snmpIPXDomain,
    SnmpIPXAddress=SnmpIPXAddress, rfc1157Proxy=rfc1157Proxy,
    rfc1157Domain=rfc1157Domain
    )


text:
var buttonsInstance = (
  <ButtonToolbar>
    <Button disabled>Default - disabled</Button>
    <Button amStyle="primary" disabled>Primary - disabled</Button>
  </ButtonToolbar>
);

ReactDOM.render(buttonsInstance, mountNode);