text:
.clearfix {
  *zoom: 1;
}
.clearfix:before,
.clearfix:after {
  display: table;
  content: "";
  line-height: 0;
}
.clearfix:after {
  clear: both;
}
.hide-text {
  font: 0/0 a;
  color: transparent;
  text-shadow: none;
  background-color: transparent;
  border: 0;
}
.input-block-level {
  display: block;
  width: 100%;
  min-height: 30px;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
nav,
section {
  display: block;
}
audio,
canvas,
video {
  display: inline-block;
  *display: inline;
  *zoom: 1;
}
audio:not([controls]) {
  display: none;
}
html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}
a:focus {
  outline: thin dotted #333;
  outline: 5px auto -webkit-focus-ring-color;
  outline-offset: -2px;
}
a:hover,
a:active {
  outline: 0;
}
sub,
sup {
  position: relative;
  font-size: 75%;
  line-height: 0;
  vertical-align: baseline;
}
sup {
  top: -0.5em;
}
sub {
  bottom: -0.25em;
}
img {
  /* Responsive images (ensure images don't scale beyond their parents) */

  max-width: 100%;
  /* Part 1: Set a maxium relative to the parent */

  width: auto\9;
  /* IE7-8 need help adjusting responsive images */

  height: auto;
  /* Part 2: Scale the height according to the width, otherwise you get stretching */

  vertical-align: middle;
  border: 0;
  -ms-interpolation-mode: bicubic;
}
#map_canvas img,
.google-maps img {
  max-width: none;
}
button,
input,
select,
textarea {
  margin: 0;
  font-size: 100%;
  vertical-align: middle;
}
button,
input {
  *overflow: visible;
  line-height: normal;
}
button::-moz-focus-inner,
input::-moz-focus-inner {
  padding: 0;
  border: 0;
}
button,
html input[type="button"],
input[type="reset"],
input[type="submit"] {
  -webkit-appearance: button;
  cursor: pointer;
}
input[type="search"] {
  -webkit-box-sizing: content-box;
  -moz-box-sizing: content-box;
  box-sizing: content-box;
  -webkit-appearance: textfield;
}
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}
textarea {
  overflow: auto;
  vertical-align: top;
}
body {
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 20px;
  color: #333333;
  background-color: #ffffff;
}
a {
  color: #0088cc;
  text-decoration: none;
}
a:hover {
  color: #005580;
  text-decoration: underline;
}
.img-rounded {
  -webkit-border-radius: 6px;
  -moz-border-radius: 6px;
  border-radius: 6px;
}
.img-polaroid {
  padding: 4px;
  background-color: #fff;
  border: 1px solid #ccc;
  border: 1px solid rgba(0, 0, 0, 0.2);
  -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.img-circle {
  -webkit-border-radius: 500px;
  -moz-border-radius: 500px;
  border-radius: 500px;
}
code,
pre {
  padding: 0 3px 2px;
  font-family: Monaco, Menlo, Consolas, "Courier New", monospace;
  font-size: 12px;
  color: #333333;
  -webkit-border-radius: 3px;
  -moz-border-radius: 3px;
  border-radius: 3px;
}
code {
  padding: 2px 4px;
  color: #d14;
  background-color: #f7f7f9;
  border: 1px solid #e1e1e8;
}
pre {
  display: block;
  padding: 9.5px;
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 20px;
  word-break: break-all;
  word-wrap: break-word;
  white-space: pre;
  white-space: pre-wrap;
  background-color: #f5f5f5;
  border: 1px solid #ccc;
  border: 1px solid rgba(0, 0, 0, 0.15);
  -webkit-border-radius: 4px;
  -moz-border-radius: 4px;
  border-radius: 4px;
}
pre.prettyprint {
  margin-bottom: 20px;
}
pre code {
  padding: 0;
  color: inherit;
  background-color: transparent;
  border: 0;
}
.pre-scrollable {
  max-height: 340px;
  overflow-y: scroll;
}
table {
  max-width: 100%;
  background-color: transparent;
  border-collapse: collapse;
  border-spacing: 0;
}
.table {
  width: 100%;
  margin-bottom: 20px;
}
.table th,
.table td {
  padding: 8px;
  line-height: 20px;
  text-align: left;
  vertical-align: top;
  border-top: 1px solid #dddddd;
}
.table th {
  font-weight: bold;
}
.table thead th {
  vertical-align: bottom;
}
.table caption + thead tr:first-child th,
.table caption + thead tr:first-child td,
.table colgroup + thead tr:first-child th,
.table colgroup + thead tr:first-child td,
.table thead:first-child tr:first-child th,
.table thead:first-child tr:first-child td {
  border-top: 0;
}
.table tbody + tbody {
  border-top: 2px solid #dddddd;
}
.table-condensed th,
.table-condensed td {
  padding: 4px 5px;
}
.table-bordered {
  border: 1px solid #dddddd;
  border-collapse: separate;
  *border-collapse: collapse;
  border-left: 0;
  -webkit-border-radius: 4px;
  -moz-border-radius: 4px;
  border-radius: 4px;
}
.table-bordered th,
.table-bordered td {
  border-left: 1px solid #dddddd;
}
.table-bordered caption + thead tr:first-child th,
.table-bordered caption + tbody tr:first-child th,
.table-bordered caption + tbody tr:first-child td,
.table-bordered colgroup + thead tr:first-child th,
.table-bordered colgroup + tbody tr:first-child th,
.table-bordered colgroup + tbody tr:first-child td,
.table-bordered thead:first-child tr:first-child th,
.table-bordered tbody:first-child tr:first-child th,
.table-bordered tbody:first-child tr:first-child td {
  border-top: 0;
}
.table-bordered thead:first-child tr:first-child th:first-child,
.table-bordered tbody:first-child tr:first-child td:first-child {
  -webkit-border-top-left-radius: 4px;
  border-top-left-radius: 4px;
  -moz-border-radius-topleft: 4px;
}
.table-bordered thead:first-child tr:first-child th:last-child,
.table-bordered tbody:first-child tr:first-child td:last-child {
  -webkit-border-top-right-radius: 4px;
  border-top-right-radius: 4px;
  -moz-border-radius-topright: 4px;
}
.table-bordered thead:last-child tr:last-child th:first-child,
.table-bordered tbody:last-child tr:last-child td:first-child,
.table-bordered tfoot:last-child tr:last-child td:first-child {
  -webkit-border-radius: 0 0 0 4px;
  -moz-border-radius: 0 0 0 4px;
  border-radius: 0 0 0 4px;
  -webkit-border-bottom-left-radius: 4px;
  border-bottom-left-radius: 4px;
  -moz-border-radius-bottomleft: 4px;
}
.table-bordered thead:last-child tr:last-child th:last-child,
.table-bordered tbody:last-child tr:last-child td:last-child,
.table-bordered tfoot:last-child tr:last-child td:last-child {
  -webkit-border-bottom-right-radius: 4px;
  border-bottom-right-radius: 4px;
  -moz-border-radius-bottomright: 4px;
}
.table-bordered caption + thead tr:first-child th:first-child,
.table-bordered caption + tbody tr:first-child td:first-child,
.table-bordered colgroup + thead tr:first-child th:first-child,
.table-bordered colgroup + tbody tr:first-child td:first-child {
  -webkit-border-top-left-radius: 4px;
  border-top-left-radius: 4px;
  -moz-border-radius-topleft: 4px;
}
.table-bordered caption + thead tr:first-child th:last-child,
.table-bordered caption + tbody tr:first-child td:last-child,
.table-bordered colgroup + thead tr:first-child th:last-child,
.table-bordered colgroup + tbody tr:first-child td:last-child {
  -webkit-border-top-right-radius: 4px;
  border-top-right-radius: 4px;
  -moz-border-radius-topright: 4px;
}
.table-striped tbody tr:nth-child(odd) td,
.table-striped tbody tr:nth-child(odd) th {
  background-color: #f9f9f9;
}
.table-hover tbody tr:hover td,
.table-hover tbody tr:hover th {
  background-color: #f5f5f5;
}
table td[class*="span"],
table th[class*="span"],
.row-fluid table td[class*="span"],
.row-fluid table th[class*="span"] {
  display: table-cell;
  float: none;
  margin-left: 0;
}
.table td.span1,
.table th.span1 {
  float: none;
  width: 44px;
  margin-left: 0;
}
.table td.span2,
.table th.span2 {
  float: none;
  width: 124px;
  margin-left: 0;
}
.table td.span3,
.table th.span3 {
  float: none;
  width: 204px;
  margin-left: 0;
}
.table td.span4,
.table th.span4 {
  float: none;
  width: 284px;
  margin-left: 0;
}
.table td.span5,
.table th.span5 {
  float: none;
  width: 364px;
  margin-left: 0;
}
.table td.span6,
.table th.span6 {
  float: none;
  width: 444px;
  margin-left: 0;
}
.table td.span7,
.table th.span7 {
  float: none;
  width: 524px;
  margin-left: 0;
}
.table td.span8,
.table th.span8 {
  float: none;
  width: 604px;
  margin-left: 0;
}
.table td.span9,
.table th.span9 {
  float: none;
  width: 684px;
  margin-left: 0;
}
.table td.span10,
.table th.span10 {
  float: none;
  width: 764px;
  margin-left: 0;
}
.table td.span11,
.table th.span11 {
  float: none;
  width: 844px;
  margin-left: 0;
}
.table td.span12,
.table th.span12 {
  float: none;
  width: 924px;
  margin-left: 0;
}
.table tbody tr.success td {
  background-color: #dff0d8;
}
.table tbody tr.error td {
  background-color: #f2dede;
}
.table tbody tr.warning td {
  background-color: #fcf8e3;
}
.table tbody tr.info td {
  background-color: #d9edf7;
}
.table-hover tbody tr.success:hover td {
  background-color: #d0e9c6;
}
.table-hover tbody tr.error:hover td {
  background-color: #ebcccc;
}
.table-hover tbody tr.warning:hover td {
  background-color: #faf2cc;
}
.table-hover tbody tr.info:hover td {
  background-color: #c4e3f3;
}
[class^="icon-"],
[class*=" icon-"] {
  display: inline-block;
  width: 14px;
  height: 14px;
  *margin-right: .3em;
  line-height: 14px;
  vertical-align: text-top;
  background-image: url("../img/glyphicons-halflings.png");
  background-position: 14px 14px;
  background-repeat: no-repeat;
  margin-top: 1px;
}
/* White icons with optional class, or on hover/active states of certain elements */
.icon-white,
.nav-pills > .active > a > [class^="icon-"],
.nav-pills > .active > a > [class*=" icon-"],
.nav-list > .active > a > [class^="icon-"],
.nav-list > .active > a > [class*=" icon-"],
.navbar-inverse .nav > .active > a > [class^="icon-"],
.navbar-inverse .nav > .active > a > [class*=" icon-"],
.dropdown-menu > li > a:hover > [class^="icon-"],
.dropdown-menu > li > a:hover > [class*=" icon-"],
.dropdown-menu > .active > a > [class^="icon-"],
.dropdown-menu > .active > a > [class*=" icon-"],
.dropdown-submenu:hover > a > [class^="icon-"],
.dropdown-submenu:hover > a > [class*=" icon-"] {
  background-image: url("../img/glyphicons-halflings-white.png");
}
.icon-glass {
  background-position: 0      0;
}
.icon-music {
  background-position: -24px 0;
}
.icon-search {
  background-position: -48px 0;
}
.icon-envelope {
  background-position: -72px 0;
}
.icon-heart {
  background-position: -96px 0;
}
.icon-star {
  background-position: -120px 0;
}
.icon-star-empty {
  background-position: -144px 0;
}
.icon-user {
  background-position: -168px 0;
}
.icon-film {
  background-position: -192px 0;
}
.icon-th-large {
  background-position: -216px 0;
}
.icon-th {
  background-position: -240px 0;
}
.icon-th-list {
  background-position: -264px 0;
}
.icon-ok {
  background-position: -288px 0;
}
.icon-remove {
  background-position: -312px 0;
}
.icon-zoom-in {
  background-position: -336px 0;
}
.icon-zoom-out {
  background-position: -360px 0;
}
.icon-off {
  background-position: -384px 0;
}
.icon-signal {
  background-position: -408px 0;
}
.icon-cog {
  background-position: -432px 0;
}
.icon-trash {
  background-position: -456px 0;
}
.icon-home {
  background-position: 0 -24px;
}
.icon-file {
  background-position: -24px -24px;
}
.icon-time {
  background-position: -48px -24px;
}
.icon-road {
  background-position: -72px -24px;
}
.icon-download-alt {
  background-position: -96px -24px;
}
.icon-download {
  background-position: -120px -24px;
}
.icon-upload {
  background-position: -144px -24px;
}
.icon-inbox {
  background-position: -168px -24px;
}
.icon-play-circle {
  background-position: -192px -24px;
}
.icon-repeat {
  background-position: -216px -24px;
}
.icon-refresh {
  background-position: -240px -24px;
}
.icon-list-alt {
  background-position: -264px -24px;
}
.icon-lock {
  background-position: -287px -24px;
}
.icon-flag {
  background-position: -312px -24px;
}
.icon-headphones {
  background-position: -336px -24px;
}
.icon-volume-off {
  background-position: -360px -24px;
}
.icon-volume-down {
  background-position: -384px -24px;
}
.icon-volume-up {
  background-position: -408px -24px;
}
.icon-qrcode {
  background-position: -432px -24px;
}
.icon-barcode {
  background-position: -456px -24px;
}
.icon-tag {
  background-position: 0 -48px;
}
.icon-tags {
  background-position: -25px -48px;
}
.icon-book {
  background-position: -48px -48px;
}
.icon-bookmark {
  background-position: -72px -48px;
}
.icon-print {
  background-position: -96px -48px;
}
.icon-camera {
  background-position: -120px -48px;
}
.icon-font {
  background-position: -144px -48px;
}
.icon-bold {
  background-position: -167px -48px;
}
.icon-italic {
  background-position: -192px -48px;
}
.icon-text-height {
  background-position: -216px -48px;
}
.icon-text-width {
  background-position: -240px -48px;
}
.icon-align-left {
  background-position: -264px -48px;
}
.icon-align-center {
  background-position: -288px -48px;
}
.icon-align-right {
  background-position: -312px -48px;
}
.icon-align-justify {
  background-position: -336px -48px;
}
.icon-list {
  background-position: -360px -48px;
}
.icon-indent-left {
  background-position: -384px -48px;
}
.icon-indent-right {
  background-position: -408px -48px;
}
.icon-facetime-video {
  background-position: -432px -48px;
}
.icon-picture {
  background-position: -456px -48px;
}
.icon-pencil {
  background-position: 0 -72px;
}
.icon-map-marker {
  background-position: -24px -72px;
}
.icon-adjust {
  background-position: -48px -72px;
}
.icon-tint {
  background-position: -72px -72px;
}
.icon-edit {
  background-position: -96px -72px;
}
.icon-share {
  background-position: -120px -72px;
}
.icon-check {
  background-position: -144px -72px;
}
.icon-move {
  background-position: -168px -72px;
}
.icon-step-backward {
  background-position: -192px -72px;
}
.icon-fast-backward {
  background-position: -216px -72px;
}
.icon-backward {
  background-position: -240px -72px;
}
.icon-play {
  background-position: -264px -72px;
}
.icon-pause {
  background-position: -288px -72px;
}
.icon-stop {
  background-position: -312px -72px;
}
.icon-forward {
  background-position: -336px -72px;
}
.icon-fast-forward {
  background-position: -360px -72px;
}
.icon-step-forward {
  background-position: -384px -72px;
}
.icon-eject {
  background-position: -408px -72px;
}
.icon-chevron-left {
  background-position: -432px -72px;
}
.icon-chevron-right {
  background-position: -456px -72px;
}
.icon-plus-sign {
  background-position: 0 -96px;
}
.icon-minus-sign {
  background-position: -24px -96px;
}
.icon-remove-sign {
  background-position: -48px -96px;
}
.icon-ok-sign {
  background-position: -72px -96px;
}
.icon-question-sign {
  background-position: -96px -96px;
}
.icon-info-sign {
  background-position: -120px -96px;
}
.icon-screenshot {
  background-position: -144px -96px;
}
.icon-remove-circle {
  background-position: -168px -96px;
}
.icon-ok-circle {
  background-position: -192px -96px;
}
.icon-ban-circle {
  background-position: -216px -96px;
}
.icon-arrow-left {
  background-position: -240px -96px;
}
.icon-arrow-right {
  background-position: -264px -96px;
}
.icon-arrow-up {
  background-position: -289px -96px;
}
.icon-arrow-down {
  background-position: -312px -96px;
}
.icon-share-alt {
  background-position: -336px -96px;
}
.icon-resize-full {
  background-position: -360px -96px;
}
.icon-resize-small {
  background-position: -384px -96px;
}
.icon-plus {
  background-position: -408px -96px;
}
.icon-minus {
  background-position: -433px -96px;
}
.icon-asterisk {
  background-position: -456px -96px;
}
.icon-exclamation-sign {
  background-position: 0 -120px;
}
.icon-gift {
  background-position: -24px -120px;
}
.icon-leaf {
  background-position: -48px -120px;
}
.icon-fire {
  background-position: -72px -120px;
}
.icon-eye-open {
  background-position: -96px -120px;
}
.icon-eye-close {
  background-position: -120px -120px;
}
.icon-warning-sign {
  background-position: -144px -120px;
}
.icon-plane {
  background-position: -168px -120px;
}
.icon-calendar {
  background-position: -192px -120px;
}
.icon-random {
  background-position: -216px -120px;
  width: 16px;
}
.icon-comment {
  background-position: -240px -120px;
}
.icon-magnet {
  background-position: -264px -120px;
}
.icon-chevron-up {
  background-position: -288px -120px;
}
.icon-chevron-down {
  background-position: -313px -119px;
}
.icon-retweet {
  background-position: -336px -120px;
}
.icon-shopping-cart {
  background-position: -360px -120px;
}
.icon-folder-close {
  background-position: -384px -120px;
}
.icon-folder-open {
  background-position: -408px -120px;
  width: 16px;
}
.icon-resize-vertical {
  background-position: -432px -119px;
}
.icon-resize-horizontal {
  background-position: -456px -118px;
}
.icon-hdd {
  background-position: 0 -144px;
}
.icon-bullhorn {
  background-position: -24px -144px;
}
.icon-bell {
  background-position: -48px -144px;
}
.icon-certificate {
  background-position: -72px -144px;
}
.icon-thumbs-up {
  background-position: -96px -144px;
}
.icon-thumbs-down {
  background-position: -120px -144px;
}
.icon-hand-right {
  background-position: -144px -144px;
}
.icon-hand-left {
  background-position: -168px -144px;
}
.icon-hand-up {
  background-position: -192px -144px;
}
.icon-hand-down {
  background-position: -216px -144px;
}
.icon-circle-arrow-right {
  background-position: -240px -144px;
}
.icon-circle-arrow-left {
  background-position: -264px -144px;
}
.icon-circle-arrow-up {
  background-position: -288px -144px;
}
.icon-circle-arrow-down {
  background-position: -312px -144px;
}
.icon-globe {
  background-position: -336px -144px;
}
.icon-wrench {
  background-position: -360px -144px;
}
.icon-tasks {
  background-position: -384px -144px;
}
.icon-filter {
  background-position: -408px -144px;
}
.icon-briefcase {
  background-position: -432px -144px;
}
.icon-fullscreen {
  background-position: -456px -144px;
}


text:
(function (document, window, Ornament, Utils) {
  "use strict";

  Ornament.U.nodeListArray = function(nodeList){
    return Array.prototype.slice.call(nodeList);
  }

}(document, window, Ornament, Ornament.Utilities));

redpajama_set_name: RedPajamaGithub


text:
#include "schema.h"
#include "comparator.h"
#include <string>
#include <vector>

/**
 * Class evaluates a special form of conjunction, where every clause is of the
 * form X op Y.
 */
class ConjunctionEvaluator
{
	public:
		void init(Schema& s1, Schema& s2,
				vector<unsigned short>& attr1, vector<unsigned short>& attr2,
				vector<Comparator::Comparison>& op);
		inline bool eval(void* tup1, void* tup2);

	private:
		vector<Comparator> comps;
};

bool ConjunctionEvaluator::eval(void* tup1, void* tup2) {
	for (unsigned int i=0; i<comps.size(); ++i)
	{
		if (comps[i].eval(tup1, tup2) == false) {
			return false;
		}
	}
	return true;
}

/**
 * Class evaluates a special form of conjunction, where every clause is of the
 * form X==Y.
 */
class ConjunctionEqualsEvaluator : public ConjunctionEvaluator
{
	public:
		void init(Schema& s1, Schema& s2,
				vector<unsigned short>& attr1, vector<unsigned short>& attr2);
};


text:
export as namespace fuzzaldrin

export class Query {
    $$__internal: Symbol
}

export interface IOptions {
    allowErrors?: boolean | undefined
    usePathScoring?: boolean | undefined
    useExtensionBonus?: boolean | undefined
    pathSeparator?: '/' | '\\' | string | undefined
    optCharRegEx?: RegExp | undefined
    wrap?: { tagOpen?: string | undefined; tagClass?: string | undefined; tagClose?: string | undefined } | undefined
    preparedQuery?: Query | undefined
}

export type IFilterOptions<T> = IOptions & {
    key?: T extends string ? never : keyof T | undefined
    maxResults?: number | undefined
    maxInners?: number | undefined
}

export function filter<T>(
    data: T[],
    query: string,
    options?: IFilterOptions<T>
): T[]
export function score(str: string, query: string, options?: IOptions): number
export function match(str: string, query: string, options?: IOptions): number[]
export function wrap(str: string, query: string, options?: IOptions): string
export function prepareQuery(query: string, options?: IOptions): Query


text:
\documentclass[a4paper,10pt]{article}
\usepackage[utf8x]{inputenc}
\usepackage{dirtree}
\usepackage[margin=1in]{geometry}
\usepackage[UKenglish]{babel}
\usepackage[fixlanguage]{babelbib}
\usepackage[square,sort,nonamebreak,comma]{natbib}  % citação bibliográfica alpha (alpha-ime.bst)
\usepackage{listings}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{hyperref}

\title{iModel: Icosahedral grid tools for geosphysical fluid dynamics modelling}
\author{Pedro S. Peixoto (pedrosp@ime.usp.br)}

\begin{document}
\maketitle

The software is a pack of tools to work with icosahedral and Voronoi geodesic grid based geophysical fluid models. It contains
\begin{itemize}
 \item Grid generator and grid tools, including grid optimization
 \item Interpolation and vector reconstruction pack
  \item A Multigrid solver
 \item A transport model
 \item A shallow water model
\end{itemize}

This code is mainly for research and educational purposes. It is in constant change and has not been tested for all its configurations possibilities.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY. See the GNU General Public License for more details.

For references check my website: \url{www.ime.usp.br/~pedrosp}. Do not hesitate to contact me in case of problems or doubts. Please contact me if you wish to have pre-calculated optimized grids, since they are very large, they are not shipped with the code.

\section{Requirements}

The software is very much self contained and does not rely on extra third party software other than the compiler. It is built for \textbf{linux platforms}, but may be run on Windows via Cygwin.

It was designed to run with very basic Fortran 90 coding, therefore tends to runs on any version of \textbf{GNU gfortran} compilers or \textbf{Intel ifort} compilers. Intel compiler will chosen as default if installed.

The outputs of the program are either text files or maps with binary data files. The maps are outputted to be read and graphed using \textbf{Generic Mapping Tool} Version 4.x.x, and several scripts for this purpose are provided. It is also possible to use \textbf{Generic Mapping Tool} Version 5.x.x, with the scripts with *gmt5.sh in gmt/ folder. GMT 5.x.x can be installed by ``apt-get'' in Ubuntu and Debian systems very easily.

Some output data can be easily analysed in Matlab, but since they are outputted as text files, any other software may be used.

The code is not very optimized, but uses openmp shared memory parallelism in many places.

\section{Code structure}

Main files of program

\dirtree{%
.1 imodel/ \hspace{1cm}  \begin{minipage}[t]{10cm}
                  Makefile \\
		  readme{.}txt\\
                \end{minipage}.
.2 bin/ \hspace{1cm}  \begin{minipage}[t]{10cm}
          This directory holds executable files (binary files)\\
          \end{minipage}.
.2 data/ \hspace{1cm}  \begin{minipage}[t]{10cm}
          Directory where output from imodel is written\\
          \end{minipage}.
.2 doc/ \hspace{1cm}  \begin{minipage}[t]{10cm}
          Directory for documentation\\
          \end{minipage}.
.2 gmt/ \hspace{1cm}  \begin{minipage}[t]{10cm}
          Generic Mapping Tool (GMT) scripts\\
          \end{minipage}.
.3 {.}sh \hspace{1cm}  \begin{minipage}[t]{10cm}
          GMT bash scripts\\
	  the main one being plot{.}sh for plotting grids, scalar and vector fields\\
	  anin{.}sh may be used to create animations\\
	  \end{minipage}.
.3 {.cpt} \hspace{1cm}  \begin{minipage}[t]{10cm}
	    Color pallets \\
          \end{minipage}.
.2 graphs/ \hspace{1cm}  \begin{minipage}[t]{10cm}
          Output directory for GMT maps (eps and pdf)\\
          \end{minipage}.
.2 grid/ \hspace{1cm}  \begin{minipage}[t]{10cm}
          Directory for all grid files\\
	  iModel will automatic save and load the grids from this directory\\
	  GMT will read grid files from this directory to draw figures of grids\\
          \end{minipage}.
.3 {.}dat \hspace{1cm}  \begin{minipage}[t]{10cm}
          Fortran binary files with saved grid information to be loaded\\
	  \end{minipage}.
.3 {.gmt} \hspace{1cm}  \begin{minipage}[t]{10cm}
	    Text grid files for GMT to read and graph\\
          \end{minipage}.
.2 matlab/ \hspace{1cm}  \begin{minipage}[t]{10cm}
          Directory for matlab scripts\\
          \end{minipage}.
.2 par/ \hspace{1cm}  \begin{minipage}[t]{10cm}
          Directory for input parameter files
          \end{minipage}.
.3 mesh{.}par \hspace{1cm}  \begin{minipage}[t]{10cm}
          Parameters for grid to be used (generate or load)\\
	  \end{minipage}.
.3 simul{.}par \hspace{1cm}  \begin{minipage}[t]{10cm}
	    Parameters for several simulations of differential operator and interpolation testing\\
          \end{minipage}.
.3 multigrid{.}par \hspace{1cm}  \begin{minipage}[t]{10cm}
	    Parameters for Multigrid solver\\
          \end{minipage}.
.3 trans{.}par \hspace{1cm}  \begin{minipage}[t]{10cm}
	    Parameters for Semi-Lagrangian Transport model\\
          \end{minipage}.
.3 swm{.}par \hspace{1cm}  \begin{minipage}[t]{10cm}
	    Parameters for Shallow Water Model\\
          \end{minipage}.
.2 ref/ \hspace{1cm}  \begin{minipage}[t]{10cm}
          Directory for reference solutions\\
	  Currently has ENDGame source files\\
	  Reference solutions will be read from this directory\\
	  Edit eg-swm-ref-{.}f90 and run Makefile to create the reference data \\
	  See EG-refsoln-doc{.}pdf for details
          \end{minipage}.
.2 sh/ \hspace{1cm}  \begin{minipage}[t]{10cm}
          Bash scripts to run several instances of the program with different parameter configurations
          \end{minipage}.
.2 src/ \hspace{1cm}  \begin{minipage}[t]{10cm}
          Fortran 90 source files and extra bash scripts\\
          \end{minipage}.
.3 imodel{.}f90 \hspace{1cm}  \begin{minipage}[t]{10cm}
          Main driver for program\\
	  Use par/mesh{.}par to select which program component you want to run\\
	  \end{minipage}.
.3 constants{.}f90 \hspace{1cm}  \begin{minipage}[t]{10cm}
          Refers to all constants used in the program\\
	  \end{minipage}.
.3 datastruct*{.}f90 \hspace{1cm}  \begin{minipage}[t]{10cm}
          Refers to all datastructure used for the grids\\
	  datastruct{.}f90 is general and datastructmult{.}f90 is for the multigrid solver \\
	  \end{minipage}.
.3 stripackm{.}f90 \hspace{1cm}  \begin{minipage}[t]{10cm}
	    Robert Renka Algorithm 772 for Parameters for Delaunay Triangulation and Voronoi Diagram on the Surface of a Sphere\\
          \end{minipage}.
.3 smeshpack{.}f90 \hspace{1cm}  \begin{minipage}[t]{10cm}
          Main program for grid generation \\
	  Has many tools to load and work with geodesic grids\\
	  Configure it using par/mesh{.}par
	  \end{minipage}.
.3 interpack{.}f90 \hspace{1cm}  \begin{minipage}[t]{10cm}
          Pack with scalar and vector interpolation routines \\
	  \end{minipage}.
.3 diffoperpack{.}f90 \hspace{1cm}  \begin{minipage}[t]{10cm}
          Pack with some discrete differential operators\\
	  \end{minipage}.
.3 simulpack{.}f90 \hspace{1cm}  \begin{minipage}[t]{10cm}
          Main program for simulations with interpolations and basic discrete differential operator analysis\\
	  Parameters set with par/simul{.}par\\
	  \end{minipage}.
.3 multigrid{.}f90 \hspace{1cm}  \begin{minipage}[t]{10cm}
	    Multigrid solver\\
          \end{minipage}.
.3 transport{.}f90 \hspace{1cm}  \begin{minipage}[t]{10cm}
	    Semi-Lagrangian transport model\\
          \end{minipage}.
.3 swm{.}f90 \hspace{1cm}  \begin{minipage}[t]{10cm}
	    Shallow Water Model\\
	    Relies on data structure dataswm{.}f90
	    \end{minipage}.
.4 dataswm{.}f90 \hspace{1cm}  \begin{minipage}[t]{10cm}
	    Shallow Water Model data structure\\
          \end{minipage}.
.3 *{.}sh \hspace{1cm}  \begin{minipage}[t]{10cm}
	    Scripts for: \\
	    Code archive to tar.bz2 (tarfiles)\\
	    Code backup (backup)\\
	    Verify compiler (compiler) \\
	    Create program directory structure (dirs) \\
	    Create binary link for imodel (link) \\
          \end{minipage}.
}

\section{Usage and Pre-setup programs}

Type ``make'' to compile all source code. Use the parameter files in ``par/*.par'' to setup what you wish to run. Run with ``./imodel'' from the main folder.

Programs already setup. Select in par/mesh.par:\\
\begin{verse}
!  case(1) !Test geodesic to regular grid conversion tool\\
!  case(2) !Test grid point search methods\\
!  case(3) !Mesh quality and distortion tests\\
!  case(4) !Divergence Tests\\
!  case(5) !Laplacian Tests\\
!  case(6) !Test scalar interpolations\\
!  case(7) !Test vector interpolation\\
!  case(8) !Test vector reconstruction\\
!  case(9) !Passive advection simulation\\
!  case(10)!Transport flow simulation\\
!  case(11)!Multigrid tests\\
!  case(12)!Tg reconstruction test\\
!  case(13)!Rotational discretization test\\
!  case(14)!Horizontal Discret Shallow water model diagnostics\\
!  case(15)!Shallow water model test cases\\
\end{verse}

\section{Grid generator}

The grid generator creates spherical triangular grids with its dual Voronoi grid and all the necessary relationship between nodes, edges, triangles and Voronoi cells (see datastruct.f90 for details). All the grid specifications need to be setup um par/mesh.par.

Kinds of grids generated:\\
\begin{verse}
!   icos (icosahedral) \\
!   octg (octahedral) \\
!   read (read from file - give filename where indicated) \\
!   rand (random points - be careful, you can get ugly meshes...) \\
\end{verse}

When using `icos' or `octg', you need to specify the number of nodes wanted as well. It does not need to be exact, as the code will adjust the next icosahedral or octahedral grid with the proper number of nodes.

You may read grid nodes from a text file. This may be with lat/lon  coordinates (which should have extension .gmt) or x/y/z coordinates (which should have extension .xyz) of the points. For x/y/z coordinates, you must first add the number of nodes that will be read. For lat/long, this is not necessary. The order of the points may matter, as we do not want to have the first 3 points aligned. A file with the connection from one node to its neighbour indexes may also be read with extension .ngb (the mesh generator will check if the ngb file exists, if so, use it). These files must be in the grid/ folder in runtime.

The position of the mesh with respect to geographic coordinates may be chosen from:\\
!Mesh Positions \\
\begin{verse}
!  eqs (equator symmetric)\\
!  pol (north pole point)\\
!  ran (all random points)\\
!  ref (local mesh refinement - needs scvt optimization)\\
\end{verse}

Once the grid is generated, you may use all the pre computed data stored in the datastruct of type `mesh'. You may chose to save the generated grid to later load it directly from the binary files.

A regular latitude-longitude grid table containing for each latitude-longitude box the index of the grid nodes it intersects is also generated. This allows a very quick search within the grid, since the regular grid resolution is calculated to be very fine and have on average almost only 1 grid cell intersection. This is useful in Semi-Lagrangian methods, or other procedures that require interpolations of arbitrary points.

\subsection{Grid optimizations}

The grid generator has the following grid optimizers coded:\\
!Optimization of mesh \\
\begin{verse}
!  nopt (no optimization) \\
!  sprg (spring dynamics - ok until level 8) \\
!  scvt (centroidal voronoi) \\
!  salt (aligned tesselation - not debuged ...) \\
!  hr95 (Heikes and Randall 1995 optimization using Miura's alg - not debuged...) \\
\end{verse}

The `salt' optimization tries to align a grid with respect to the index given in \cite{Peixoto2013}, but is not successful. The HR95 grid optimizer is not producing the expected results. It uses and algorithm proposed by  \cite{Miura2005}, that does not seem to converge properly.

There is an option to generate locally refined grids with SCVT tessellations, as in \cite{Ringler2013}. The density function needs to be set in src/smeshpack.f90 function dens\_f. Also, option regarding the way the grid is constructed, recursively (hierarchically)or not.\\

!Hierarchical grid construction: \\
!  0-No; \\
!  1-Yes; \\
!  2 - Optimizes only the new points in hierarchy; \\
!  3 - Do not optimize nodes that belong to primary icosahedral edges\\

\subsection{Testing}
The main testing programs can be selected in the par/mesh.par file as one of the bellow.\\
!  case(1) !Test geodesic to regular grid conversion tool\\
!  case(2) !Test grid point search methods\\
!  case(3) !Mesh quality and distortion tests\\

\subsection{Grid visualization and examples}

To view the grid generated, go to the gmt/ folder and use the `plot.sh' script (for GMT4) or `plot{\textunderscore}gmt5.sh' (for GMT5). You need to provide as command line input the name of the grid you want to be plotted. This is done by passing the name of the file that contain the `*nodes.gmt' in the grd/ folder. The script will guide you through its options, for either plotting just the triangular grid, Voronoi grid and other options. Outputs will be placed in graphs/ folder. Edit plot.sh to fulfill your needs.

\subsubsection{Example 1 - icosahedral grid level 2}
To generate the grid set in par/mesh.par the following parameters (leave the rest as default):
No. of vertices: 42 \\
Kind of mesh: icos \\
Optimization: nopt \\
Run any program of grid testing, e.g. cases 1,2,3, or actually any other test case should generate the grid.
\begin{lstlisting}[language=bash]
$ ./imodel
\end{lstlisting}
Once the grid is generated, run:
\begin{lstlisting}[language=bash]
$ cd gmt
$ ./plot.sh ../grid/icos_pol_nopt_2_nodes.gmt
Options : 1-> 1-> 6
Output in graphs/icos_pol_nopt_2.pdf
\end{lstlisting}

\includegraphics[scale=0.5]{icos_pol_nopt_2}

\subsubsection{Example 2 - Locally refined grid}

Follow the same example as above, but set grid parameters in par/mesh.par to:
No. of vertices: 600 \\
Kind of mesh: icos \\
Position: ref \\
Optimization: scvt \\
It will start from icosahedral grids and use SCVT algorithms to get locally refined ones based on a density function given in src/smeshpack.f90 function dens\_f. The generation can take some minutes.

\begin{lstlisting}[language=bash]
$ cd gmt
$ ./plot.sh ../grid/icos_ref_scvt_h1_3_nodes.gmt
Options : 1-> 1-> 5
Output in graphs/icos_ref_scvt_h1_3.pdf
\end{lstlisting}

\includegraphics[scale=0.5]{icos_ref_scvt_h1_3}

\subsection{Important}

Some grid generations with optimizations can take hours and even days (months in case of very fine grids). The grid points are saved in .xyz of .gmt for future use in this or other codes. All the grid structures and pre calculated features are store as well, and this can be loaded at runtime setting the load option in par/mesh.par. Setting the read option in par/mesh.par read only the node points in cartesian or lat-long coordinates, but regenerates all other data structures and pre computable mesh properties. Please contact me if you wish to have pre-calculated optimized grids, since they are very large, they are not shipped with the code.

\section{Interpolations}

The main module for interpolations on spherical geodesic grids is src/interpack.f90. It contains several kinds of methods and possibilities. These maybe set via par/simul.par, and several testing programs exist to analyse the methods.

\subsection{Variable location}

The variables may be located in the grid in the following different ways:\\
  ! List of Stags for interpolation - (if no vector - considers scalars on vector positions)\\
  ! HA  - Scalars and vectors on triangle vertices, hexagon centers\\
  ! HC  - Scalars on triangle vertices, hexagon centers and vectors hexagon edge midpoints\\
  ! TA  - Scalars and vectors on triangle circumcenter, hexagon vertices\\
  ! TC  - Scalars on triangle vertices, hexagon centers and vectors triangle edge midpoints\\
  ! HCT - Voronoi staggered grid but with vectors on intersection of hx edge and tr edge.\\

Note: Not all methods are implemented for all positionings.

\subsection{Scalar interpolations}

Implemented scalar interpolation methods:\\
    !*** (For values given on triangle vertices - Stag=HA) ***\\
    ! none     = Just get triangle\\
    ! neartrv  = Nearest node  (default)\\
    ! lintrv   = Linear TR - values on tr vertices - default\\
    ! linhxb   = Linear TR - values on Voronoi cell centroids\\
    ! lsqhx    = Quadratic Least Squares \\
    ! hermtrv  = Cubic (R.Renka C1 Hermite)\\
    ! rbftr    = RadialBasisFunction TR (3pts)\\
    ! rbfetr   = RadialBasisFunction ETR(11,12pts)\\
    ! rbfhx    = RadialBasisFunction HX (6,7pts)\\
    ! natlap   = Natural Coordinate with Laplace\\
    ! natsib   = Natural Coordinate with Sibson\\
    ! natfar   = Natural Coordinate with Farin\\
    ! lmshep   = Local Modified Shepard Method\\
    ! qdshep   = Quadratic Shepard Method\\
    !*** (For values given on triangle circumcenters - Stag=TA) ***\\
    ! none     = Just get triangle\\
    ! neartrc  = Nearest triangle\\
    ! wach     = Wachspress interpolation - default\\
    !*** (For values given on triangle edge midpoints - Stag=TC) ***
    ! none     = Just get triangle\\
    ! p1nc     = P1 Non corforming element - default\\
    !*** (For values given on voronoi edge midpoints - Stag=HC) ***
    ! none     = Just get triangle \\
    ! wach     = Modified Wachspress interpolation (linear) - default \\
    ! lmshep   = Local Modified Shepard Method\\
    ! p1nc     = P1 Non corforming element - may do extrapolation\\
    !*** (For values given on Voronoi centroids) ***\\
    ! neartrv  = Nearest node  (default)\\
    !*** (For values given on triangle centroids) ***\\
    ! neartrc  = Nearest triangle  (default)\\

    Use "none" to set no interpolation. Used only to calculate basic computational cost. Some of these scalar interpolations, such as `lintrv' and `wach', may be used to do vector interpolation when the full vector is given pointwise.

\subsection{Vector reconstructions}

See \cite{Peixoto2014} for the vector reconstruction problem definition and methods. The methods implemented are as follows.

    !Kind of reconstruction\\
    !  none   = Just find the nearest node\\
    !  rbf    = Radial Basis Function\\
    !     rbfhx  - rbf for 6 point Voronoi cell\\
    !     rbftr  - rbf for 3 point triangle\\
    !     rbf*pc- rbf* with constant polynomial\\
    !  per    = Perot (2000) recosntruction\\
    !     perhx  - Perot for Hexagons\\
    !     pertr  - Perot for Triangles\\
    !     perpj  - Perot for Hexagons projecting to tang plane\\
    !     pered  - Perot vector for edges (tangent recon)\\
    !  lsq    = Least Square Fit\\
    !     lsqhxe - 12 point hexagon stencil\\
    !     lsqtrc - 9 point triangle based stencil\\
    !  rt0    = Raviart Thomas 0th order element reconstruction\\
    !  dtred  = Dual triangle tangent reconstruction\\
    !  wht    = Whitney Edge element reconstruction\\
    !  kls    = Klausen reconstruction with Wachspress coords\\
    !  trsk   = TRISK tangent vector reconstruction\\

\subsection{Testing}
The main testing programs can be found in src/simulpack.f90, and the test can be selected in the par/mesh.par file as one of the bellow.\\
!  case(6) !Test scalar interpolations\\
!  case(7) !Test vector interpolation\\
!  case(8) !Test vector reconstruction\\
!  case(12)!Tg reconstruction test\\

There are several scalar and vector function options that can be selected, see par/simul.par.

Once a test has been run, the results are stored in data/ folder with either numerical text files (for errors and diagnostics) or .dat files, for field plots. To plot a field, you can use the plot.sh GMT script.

Example setting staggering to HA in par/simul.par and keeping the rest default - shows the exact scalar function to be interpolated:
\begin{lstlisting}[language=bash]
$ cd gmt
$ ./plot.sh ../data/sinterp_f5_HA_lintrv_exact_icos_pol_nopt_5.dat
Options : 2-> 2-> 0-> 6
Output in ../graphs/sinterp_f5_HA_lintrv_exact_icos_pol_nopt_5.pdf
\end{lstlisting}
\includegraphics[scale=0.5]{sinterp_f5_HA_lintrv_exact_icos_pol_nopt_5}

\section{Differential operators}

The analysis of the differential operator done in \cite{Peixoto2013} were mainly using the code in simulpack.f90 and diffoperpack.f90. You can chose the variable location as with the interpolation methods.

\subsection{Testing}
The main testing programs can be selected in the par/mesh.par file as one of the bellow.\\
!  case(4) !Divergence Tests\\
!  case(5) !Laplacian Tests\\

Use the same plotting routines as used in interpolation routines. Example setting staggering to HC in par/simul.par and keeping the rest default - shows the error in the divergence calculation:

\begin{lstlisting}[language=bash]
$ cd gmt
$ ./plot.sh ../data/divtest_f5_HC_error_icos_pol_nopt_5.dat
Options : 2-> 1-> 0-> 2
Output in ../graphs/divtest_f5_HC_error_icos_pol_nopt_5.pdf
\end{lstlisting}
\includegraphics[scale=0.5]{divtest_f5_HC_error_icos_pol_nopt_5}

\section{Multigrid solver}

This part of the code was developed by Marline I. Silva in Sept 2014. It reads the parameter from par/multigrid.par and runs several tests for the multigrid solver. Select the following test case in par/mesh.par to run this program:\\
!  case(11)!Multigrid tests

This part of the code has not been thoroughly debug, and some tiding up may be necessary.

\section{Transport model}

The transport model is a Semi-Lagrangian as described in \cite{Peixoto2013b} and \cite{Peixoto2014}. You can run several test cases editing par/trans.par and selecting in par/mesh.par the following cases:\\
!  case(9) !Passive advection simulation\\
!  case(10)!Transport flow simulation\\

There is GMT script to create animations in gmt/anim.sh - please refer to it on usage.

\section{Shallow Water Model}

The shallow water model is a finite volume method with some methods implemented. The main module is swm.f90. First it has the TRSK method of \cite{Thuburn2009} and \cite{Ringler2010}, but also the modified scheme proposed in \cite{Peixoto2015}. Edit par/swm.par to configure the shallow water model.

!Test Cases implemented\\
2 : Steady State Will92\\
5 : Flow over mountain Will92\\
6 : Rossby-Haurwitz Will92 \\
11 : Linearized equations - for mode calculation - fsphere\\
12 : Linearized equations - for mode calculation - f variable\\
21 : Galewski et al Barotropically unstable jet with perturbation\\
22 : Galewski et al Barotropically unstable jet without perturbation\\
32 : Hollingsworth instability with tc2\\
33 : Hollingsworth instability with constant h and non rotating frame  \\
42 : Rotated Steady state localised test on f-sphere\\
51 : Flow over mountain Will92 smooth mountain (Gaussian)\\

Some test cases rely on reference solutions to calculate errors. These solutions, if wanted, need to be pre-computed from the reference folder (ref/) with the ENDGame shallow water model - there is special documentation file in that folder to help.

To set up the new modified scheme proposed in \cite{Peixoto2015}, set in swm.par the following parameters:
\begin{verse}
!Scalar/vector location (HC or HTC) \\
HC \\
!Cell vec reconstruction method (Kenergy) / Gassmann parameter (if gass set) \\
perhx 0.75 \\
!Coriolis vec reconstruction method \\
pered \\
!Scalar interpolations \\
bary \\
!Gradient discrete method \\
trsk \\
\end{verse}
You also should set the HR95 grids to be read in par/mesh.par - the grid generator is not able to generate these with the same properties as in \cite{Heikes1995a}, so the .xyz grid nodes must be provided.

For TRSK, use
\begin{verse}
!Scalar/vector location (HC or HTC) \\
HTC \\
!Cell vec reconstruction method (Kenergy) / Gassmann parameter (if gass set) \\
trsk 0.75 \\
!Coriolis vec reconstruction method \\
trsk \\
!Scalar interpolations \\
trsk \\
!Gradient discrete method \\
trsk \\
\end{verse}

You can get the preprint of \cite{Peixoto2015} in \url{www.ime.usp.br/~pedrosp}, but I do apologize that some of the notation is different in the paper and code. Please contact me if you wish to have pre-calculated HR95 optimized grids.

\bibliographystyle{plainnat}% citação bibliográfica alpha
\bibliography{bibliography}  % associado ao arquivo: 'bibliografia.bib'

\end{document}


text:
<!doctype html>

    <meta charset="utf-8">
    <title>Release done! (And what we are working on) - Blog - Lygue</title>
    <meta name="description" content="As you may have probably noticed, a major release has been done 3 days ago. We are very happy of this release. We think the site is cleaner and simplier.">
    <meta name="author" content="Dominic Martineau">
    <meta name="keywords" content="lygue,league,manager,hockey,baseball,soccer,football">
    <meta property="og:site_name" content="Blog @ Lygue">
    <meta property="og:title" content="Release done! (And what we are working on)">
    <meta property="og:description" content="As you may have probably noticed, a major release has been done 3 days ago. We are very happy of this release. We think the site is cleaner and simplier.">
    <meta property="article:author" content="https://www.facebook.com/Lygue">
    <meta property="og:type" content="article">
    <meta property="og:url" content="http://blog.lygue.com/release-done-and-what-we-are-working-on.html">
    <meta property="og:locale" content="en_US">

    <link href="//fonts.googleapis.com/css?family=Noto+Serif" rel="stylesheet" type="text/css">
    <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" media="all" href="assets/css/styles.css">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="assets/favicon.png" type="image/x-icon">
    <link rel="icon" type="image/png" href="assets/favicon.png">

        Manage my league
        Learn more

            <time datetime="2010-08-22" itemprop="datePublished">August 22, 2010</time>

Release done! (And what we are working on)

As you may have probably noticed, a major release has been done 3 days ago. We are very happy of this release. We think the site is cleaner and simplier. Here a short list of what's new:

Cleaner and simplier look

Standing and Top players widgets

New section called Places

New section called Players

Possiblity to add a Facebook fan page widget on leagues' homepage

Leagues' schedule on one page

We are currently working hard to get these things done:

A function to send an email to an entire team or to all players at once

A function to relook your league's header (background image, etc)

Add much more places

More news coming soon about this. Oh and by the way, we just release a minor homepage improvment.

            <time datetime="2010-08-29">August 29, 2010</time>
            Homepage, filter by city & discussions

We are still working on the homepage because we are not satisfied by the current one. Our goal is to do a page that will show the three main sections: Leagues, Places and Players.

            Read →

Manage your sport league with Lygue

Better organize your league. Manage, share, discuss and archive everything that's essential for your league. Give Lygue a try, it's free for 30 days.

            Manage my league
            Learn more


text:
package myTodoList.bin;

/**
 * EventedList'þµÄÊÊÅäÆ÷
 *
 * @author Frank
 */
public class EventedListAdapter<ListItem> implements EventedListListener<ListItem>{
	/**
	 * ItemÐ޸ĵÄʱºòµ÷ÓÃ
	 * @author Frank
	 * @param ÒªÐ޸ĵÄItem
	 */
	public void itemModified(ListItem item){}
	/**
	 * Õâ¸öÁÐ±í¶¼ÐÞ¸ÄÁË£¬µ÷ÓÃ
	 * @author Frank
	 * @param еÄListItem
	 */
	public void listModified(EventedList<ListItem> newVersion){}
}


text:
package org.bongiorno.aspects.latency.esper;

import com.espertech.esper.client.*;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;

@org.springframework.context.annotation.Configuration
public class EsperConfig {

    @Bean(destroyMethod = "destroy")
    public EPServiceProvider getEPServiceProvider(ApplicationContext context) {
        Configuration configuration = new Configuration();
        configuration.addEventType("MethodCalledEvent", MethodCalledEvent.class);

        return EPServiceProviderManager.getProvider(context.getId(), configuration);
    }

    @Bean
    public EPRuntime getEPRuntime(EPServiceProvider provider) {
        return provider.getEPRuntime();
    }

    @Bean(name = "esperAdmin")
    public EPAdministrator getEPAdministrator(EPServiceProvider provider) {
        return provider.getEPAdministrator();
    }
}


text:
layout: post
title: Week 12 – Software Engineering
---
Hello, software engineer.

We finally wrapped up SQL on Wednesday. Since I took Data Management last semester, most, if not all, of the stuffs we went over in class were reviews for me. I do have to mention that Downing does a much better job teaching SQL and taught me more about the language than what my Data Management class did. I'm not sure if this is interesting or just downright sad.

Anyway, once we finished up SQL, we moved on to some really cool stuffs – stuffs called software engineering. We started going over refactoring – the process of changing the code structure to make it more reusable and reliable without changing the external behavior – and boy is it fun. We analyzed a sample code from the textbook (I think, although I remember Downing saying that the textbook didn't give the code and he actually wrote the code himself. Anyway, it doesn't matter) and refactor it for better reusability and minimal increase in efficiency.

The best part is that, when we were analyzing the code and Downing was going over what can be improved with refactoring techniques, I couldn't help but keep thinking about the code I've written for projects from other classes and what I can do now to refactor it further. Friday's class was definitely the best class of the semester so far and it really reminds me of why I wanted to take SWE in the first place. It seems that there are only 4 lectures left, and I truly hope that this kind of lectures is what Downing has in store for the final lectures. After all, they are my final lectures with Downing. I really hope we can end on a great note.

**What did you do this past week?**

 I tried to deploy our app to Carina again without any luck. Although it seems that we can use VM for the final stage, I kind of want to give Carina one more shot as we did get it to work last time and it seems that there's a solution for my problem according to a post from my fellow classmate on Piazza.

**What's in your way?**

Besides the final stage of the project, I'll have to start focusing on other non-programming classes like economics and algorithm as I need to do a giant load of homework and study for the exam on Friday. This is gonna be so fun.

**What will you do next week?**

As I mentioned above, I will do the homework from algorithm and economics. I'll also register classes for Fall and I'm really hoping that I can get all the classes I want. It is my last semester, and I really hope the department doesn't screw me over again.

**Tip of the Week**:

Do you like docker? [Hitler]( https://www.youtube.com/watch?v=PivpCKEiQOQ&feature=youtu.be&ab_channel=AvishaiIsh-Shalom) doesn't like it either.

**Tip of the Week 2**:

Please tell me you watched the video and at the very least chuckled. Here is another tip of the week for this entry, and it's all about digital encryption. The videos are made by CGPGrey and I highly recommend them.

[Should All Locks Have Keys? – CGPGrey]( https://www.youtube.com/watch?v=VPBH1eW28mo&ab_channel=CGPGrey)

[I, Phone - CGPGrey]( https://www.youtube.com/watch?v=e-ZpsxnmmbE&ab_channel=CGPGrey)

And here's a bonus video on mass surveillance by Kurzgesagt

[Safe and Sorry - Kurzgesagt]( https://www.youtube.com/watch?v=V9_PjdU3Mpo&ab_channel=Kurzgesagt–InaNutshell)


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using Moq;

namespace IntergalacticTravel.Tests
{
    [TestFixture]
    public class ResourcesFactoryTests
    {

        [TestCase("create resources gold(20) silver(30) bronze(40)")]
        [TestCase("create resources silver(30) bronze(40) gold(20)")]
        [TestCase("create resources silver(30) gold(20) bronze(40)")]
        [TestCase("create resources bronze(40) gold(20) silver(30)")]
        [TestCase("create resources bronze(40) silver(30) gold(20)")]
        public void GetResources_WhenPassedValidArgumentsInspiteOfTheiOrder_ShouldReturnNewlyCreatedResources(
              string command)
        {
            // Arrange
            var resourceFactory = new ResourcesFactory();

            // Act
            var resource = resourceFactory.GetResources(command);

            // Assert
            Assert.AreEqual(20, resource.GoldCoins);
            Assert.AreEqual(30, resource.SilverCoins);
            Assert.AreEqual(40, resource.BronzeCoins);
        }

        [TestCase("RandomStringThatShouldThrowException")]
        [TestCase("RandomStringThatShouldThrowException")]
        [TestCase("craft resource bronze[40] silver[30] gold[20]")]
        public void GetResources_WhenInvalidCommandIsPassed_ShouldThrowInvalidOperationException(string invalidComamnd)
        {
            // Arrange
            var resourceFactory = new ResourcesFactory();

            // Act and Assert
            Assert.Throws<InvalidOperationException>(() => resourceFactory.GetResources(invalidComamnd));
        }

        [TestCase("create resources gold(200000000000) silver(30) bronze(40)")]
        [TestCase("create resources silver(30) bronze(40000000000000) gold(20)")]
        [TestCase("create resources silver(3000000000000) gold(20) bronze(40)")]
        public void
            GetResources_WhenInputStringIsInCorrectFormatButAnyOfTheValuesOverflowsTheUintMaxValue_ShouldThrowOverflowException
            (string command)
        {
            // Arrange
            var factory = new ResourcesFactory();

            // Act and Assert
            Assert.Throws<OverflowException>(() => factory.GetResources(command));
        }
    }
}


text:
<!doctype html>

    <title>Code coverage report for All files</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="prettify.css" />
    <link rel="stylesheet" href="base.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1">

      All files

        86.47%
        Statements
        115/133

        59.02%
        Branches
        36/61

        87.1%
        Functions
        27/31

        89.26%
        Lines
        108/121

   File

   Statements

   Branches

   Functions

   Lines

	src

	87.74%
	93/106
	59.02%
	36/61
	95.24%
	20/21
	91.49%
	86/94

	src/instances

	81.48%
	22/27
	100%
	0/0
	70%
	7/10
	81.48%
	22/27

  Code coverage
  generated by istanbul at Sun Sep 18 2016 08:51:40 GMT+0100 (GMT Daylight Time)


text:
define(function(require) {

    var $   = require('jquery');
    var old = $.fn.select;
    require('./util');

    // SELECT CONSTRUCTOR AND PROTOTYPE

    var Select = function (element, options) {
        this.$element = $(element);
        this.options = $.extend({}, $.fn.select.defaults, options);
        this.$element.on('click', 'a', $.proxy(this.itemclicked, this));
        this.$button = this.$element.find('.btn');
        this.$hiddenField = this.$element.find('.hidden-field');
        this.$label = this.$element.find('.dropdown-label');
        this.setDefaultSelection();

        if (options.resize === 'auto') {
            this.resize();
        }
    };

    Select.prototype = {

        constructor: Select,

        itemclicked: function (e) {
            this.$selectedItem = $(e.target).parent();
            this.$hiddenField.val(this.$selectedItem.attr('data-value'));
            this.$label.text(this.$selectedItem.text());

            // pass object including text and any data-attributes
            // to onchange event
            var data = this.selectedItem();

            // trigger changed event
            this.$element.trigger('changed', data);

            e.preventDefault();
        },

        resize: function() {
            var newWidth = 0;
            var sizer = $('<div/>').addClass('select-sizer');
            var width = 0;

            if( Boolean( $(document).find( 'html' ).hasClass( 'fuelux' ) ) ) {
                // default behavior for fuel ux setup. means fuelux was a class on the html tag
                $( document.body ).append( sizer );
            } else {
                // fuelux is not a class on the html tag. So we'll look for the first one we find so the correct styles get applied to the sizer
                $( '.fuelux:first' ).append( sizer );
            }

            // iterate through each item to find longest string
            this.$element.find('a').each(function () {
                sizer.text($(this).text());
                newWidth = sizer.outerWidth();
                if(newWidth > width) {
                    width = newWidth;
                }
            });

            sizer.remove();

            this.$label.width(width);
        },

        selectedItem: function() {
            var txt = this.$selectedItem.text();
            return $.extend({ text: txt }, this.$selectedItem.data());
        },

        selectByText: function(text) {
            var selector = 'li a:fuelTextExactCI(' + text + ')';
            this.selectBySelector(selector);
        },

        selectByValue: function(value) {
            var selector = 'li[data-value="' + value + '"]';
            this.selectBySelector(selector);
        },

        selectByIndex: function(index) {
            // zero-based index
            var selector = 'li:eq(' + index + ')';
            this.selectBySelector(selector);
        },

        selectBySelector: function(selector) {
            var item = this.$element.find(selector);

            this.$selectedItem = item;
            this.$hiddenField.val(this.$selectedItem.attr('data-value'));
            this.$label.text(this.$selectedItem.text());
        },

        setDefaultSelection: function() {
            var selector = 'li[data-selected=true]:first';
            var item = this.$element.find(selector);
            if(item.length === 0) {
                // select first item
                this.selectByIndex(0);
            }
            else {
                // select by data-attribute
                this.selectBySelector(selector);
                item.removeData('selected');
                item.removeAttr('data-selected');
            }
        },

        enable: function() {
            this.$button.removeClass('disabled');
        },

        disable: function() {
            this.$button.addClass('disabled');
        }

    };

    // SELECT PLUGIN DEFINITION

    $.fn.select = function (option) {
        var args = Array.prototype.slice.call(arguments, 1);
        var methodReturn;

        var $set = this.each(function () {
            var $this = $(this);
            var data = $this.data('select');
            var options = typeof option === 'object' && option;

            if (!data) $this.data('select', (data = new Select(this, options)));
            if (typeof option === 'string') methodReturn = data[option].apply(data, args);
        });

        return ( methodReturn === undefined ) ? $set : methodReturn;
    };

    $.fn.select.defaults = {};

    $.fn.select.Constructor = Select;

    $.fn.select.noConflict = function () {
      $.fn.select = old;
      return this;
    };

    // SELECT DATA-API

    $(function () {

        $(window).on('load', function () {
            $('.select').each(function () {
                var $this = $(this);
                if ($this.data('select')) return;
                $this.select($this.data());
            });
        });

        $('body').on('mousedown.select.data-api', '.select', function () {
            var $this = $(this);
            if ($this.data('select')) return;
            $this.select($this.data());
        });
    });

});


text:
<?php

/**
 * Este script ejecuta la carga de KumbiaPHP
 *
 * @category   Kumbia
 * @package    Core
 */

// Inicia la sesion
session_start();

// Iniciar el buffer de salida
ob_start();

// Versión de KumbiaPHP
function kumbia_version()
{
    return '1.0 Beta 2';
}

// @see KumbiaException
function handle_exception($e)
{
    KumbiaException::handle_exception($e);
}

// Registrar la autocarga
spl_autoload_register('auto');

// Inicializar el ExceptionHandler
set_exception_handler('handle_exception');

// @see Util
require CORE_PATH . 'kumbia/util.php';

// @see Config
require CORE_PATH . 'kumbia/config.php';

// Lee la configuracion
$config = Config::read('config');

// Constante que indica si la aplicacion se encuentra en produccion
if (!defined('PRODUCTION')) {
    define('PRODUCTION', $config['application']['production']);
}

// Carga la cache y verifica si esta cacheado el template, al estar en produccion
if (PRODUCTION) {
    // @see Cache
    require CORE_PATH . 'libs/cache/cache.php';

    //Asigna el driver por defecto usando el config.ini
    if (isset($config['application']['cache_driver']))
        Cache::setDefault($config['application']['cache_driver']);

    // Verifica si esta cacheado el template
    if ($template = Cache::driver()->get($url, 'kumbia.templates')) { //verifica cache de template para la url
        echo $template;
        echo '<!-- Tiempo: ' . round(microtime(1) - START_TIME, 4) . ' seg. -->';
        exit(0);
    }
}

// Asignando locale
if (isset($config['application']['locale'])) {
    setlocale(LC_ALL, $config['application']['locale']);
}

// Establecer el timezone para las fechas y horas
if (isset($config['application']['timezone'])) {
    ini_set('date.timezone', $config['application']['timezone']);
}

// Establecer el charset de la app en la constante APP_CHARSET
if (isset($config['application']['charset'])) {
    define('APP_CHARSET', strtoupper($config['application']['charset']));
} else {
    define('APP_CHARSET', 'UTF-8');
}

// Autocarga de clases
function auto($class)
{

    // Optimizando carga
    if ($class == 'ActiveRecord') {
        return include APP_PATH . 'libs/active_record.php';
    }
    if ($class == 'Load') {
        return include CORE_PATH . 'kumbia/load.php';
    }

    // Pasando a smallcase
    $class = Util::smallcase($class);
    if (is_file(APP_PATH . "extensions/helpers/$class.php")) {
        return include APP_PATH . "extensions/helpers/$class.php";
    }
    if (is_file(CORE_PATH . "extensions/helpers/$class.php")) {
        return include CORE_PATH . "extensions/helpers/$class.php";
    }
    if (is_file(APP_PATH . "libs/$class.php")) {
        return include APP_PATH . "libs/$class.php";
    }
    if (is_file(CORE_PATH . "libs/$class/$class.php")) {
        return include CORE_PATH . "libs/$class/$class.php";
    }

    if ($class == 'kumbia_exception') {
        include CORE_PATH . 'kumbia/kumbia_exception.php';
    }
}

// @see Router
require CORE_PATH . 'kumbia/router.php';

// @see Controller
require APP_PATH . 'libs/app_controller.php';

// @see KumbiaView
require APP_PATH . 'libs/view.php';

// Ejecuta el request
try {
    // Dispatch y renderiza la vista
    View::render(Router::execute($url), $url);
} catch (KumbiaException $e) {
    KumbiaException::handle_exception($e);
}

// Fin del request
exit();


text:
package edu.wustl.common.cde.xml;

/*
 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

import java.io.FileInputStream;
import java.io.IOException;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;

/*
 * $Id: Main.java,v 1.1 2006/03/29 06:42:49 Gautam Exp $
 *
 * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
 *
 * This software is the proprietary information of Sun Microsystems, Inc.
 * Use is subject to license terms.
 *
 */

public class Main
{

    // This sample application demonstrates how to unmarshal an instance
    // document into a Java content tree and access data contained within it.

    public static void main( String[] args )
	{
        try
		{
            // create a JAXBContext capable of handling classes generated into
            // the pspl.cde package
            JAXBContext jc = JAXBContext.newInstance( "edu.wustl.common.cde.xml" );

            // create an Unmarshaller
            Unmarshaller u = jc.createUnmarshaller();

            // unmarshal a root instance document into a tree of Java content
            // objects composed of classes from the pspl.cde package.
            XMLCDECACHE root =
                (XMLCDECACHE)u.unmarshal( new FileInputStream( "CDEConfig.xml" ) );

            // display the cde details
			java.util.List l1 = root.getXMLCDE();
			if (!l1.isEmpty())
			{
				for (int z =0; z<l1.size(); z++ )
				{
					XMLCDE cdeobj = (XMLCDE)l1.get(z);
					displayCde( cdeobj );

				}
			}

        }
		catch( JAXBException je )
		{
            je.printStackTrace();
        }
		catch( IOException ioe )
		{
            ioe.printStackTrace();
        }

  } // main

	public static void displayCde( XMLCDE cdeojb )
	{
        // display the cdeojb

        System.out.println( "NAME : \t" + cdeojb.getName() );
        System.out.println( "PUBLICID : \t" + cdeojb.getPublicId() );
	    System.out.println( "CACHE : \t" + cdeojb.isCache() );
		System.out.println( "LAZYLOADING : \t" + cdeojb.isLazyLoading() );

		java.util.List l2 = cdeojb.getXMLPermissibleValues();
			if (!l2.isEmpty())
			{
	            XMLPermissibleValueType pvt = (XMLPermissibleValueType)l2.get(0);
		        displayPV(pvt);
			}
		System.out.println( "\n\t----------------------------------------");
    } //displayCde

	public static void displayPV(XMLPermissibleValueType pvt)
	{
		System.out.println( "\tEVS Term: " + pvt.getEvsTerminology());
		System.out.println( "\tConcept Code: " + pvt.getConceptCode());
		System.out.println( "\tParentConcept Code: " + pvt.getParentConceptCode());
		System.out.println( "\tTree Depth: " + pvt.getDepthOfHierarchyTree());

	} // displayPV

} // class

// --------------------------------------------------------
/*
    public static void displayAddress( CDE cdeojb ) {
        // display the cdeojb
        System.out.println( "\t" + cdeojb.getName() );
        System.out.println( "\t" + cdeojb.getPublicId() );
    }

    public static void displayItems( PermissibleValueType pvt ) {
        // the items object contains a List of pspl.cde.ItemType objects
        List itemTypeList = items.getItem();

        // iterate over List
        for( Iterator iter = itemTypeList.iterator(); iter.hasNext(); ) {
            Items.ItemType item = (Items.ItemType)iter.next();
            System.out.println( "\t" + item.getQuantity() +
                                " copies of \"" + item.getProductName() +
                                "\"" );
        }
    }
*/


text:
<?php

namespace AppBundle\Responses;
use Symfony\Component\HttpFoundation\Response;

class ErrorResponse extends Response
{
    /**
     * Creates a new ErrorResponse object
     *
     * @param int    $statusCode       The HTTP response code to send back
     * @param int    $errorCode        The code associated with the error
     * @param string $errorDescription A human readable description of the error
     * @param string $errorTrace       The stack trace from the error
     * @param string $errorLocation    The location of the error
     * @param string $errorType        Type of error (normally the class name of the exception)
     *
     * @return ErrorResponse
     */
    public function __construct(
        $statusCode,
        $errorCode,
        $errorDescription,
        $errorTrace = null,
        $errorLocation = null,
        $errorType = 'Unhandled'
    ) {
        // Build the response
        $content['errorCode'] = $errorCode;
        $content['errorDescription'] = $errorDescription;

        if ($errorType != null) {
            $types = explode("\\", $errorType);
            $content['errorType'] = array_pop($types);
        }

        if ($errorLocation != null) {
            $content['errorLocation'] = $errorLocation;
        }

        if ($errorTrace != null) {
            $content['errorTrace'] = $errorTrace;
        }

        // Call the parent constructor
        parent::__construct(
            json_encode($content),
            $statusCode,
            array('Content-Type' => 'application/json')
        );
    }
}


text:
fortitude_Image *fortitude_createImage(SDL_Renderer *renderer, const char *path)
{
	fortitude_Image *image = (fortitude_Image *)malloc(sizeof(fortitude_Image));
	SDL_Surface *surface = IMG_Load(path);
	char error[255];
	if (surface == NULL)
	{
		strcpy(error, "Image ");
		strcpy(error, path);
		strcpy(error," couldn't be loaded!");
		fortitude_throwError(error, ASSET_LOAD_FAILURE);
		surface = IMG_Load("assets/img/fallback.png");
		if (surface == NULL)
		{
			fortitude_throwError("Fallback image is missing!", ESSENTIAL_ASSET_MISSING);
		}
		error[0] = '\0';
	}
	SDL_SetColorKey(surface, SDL_TRUE, SDL_MapRGB(surface->format, 0xFF, 0x00, 0xFF));
	image->texture = SDL_CreateTextureFromSurface(renderer, surface);
	if (image->texture == NULL)
	{
		strcpy(error, "Texture failed to be created from image ");
		strcpy(error, path);
		strcpy(error, "!");
		fortitude_throwError(error, TEXTURE_CREATION_FAILURE);
	}
	SDL_FreeSurface(surface);
	return image;
}

fortitude_SpriteSheet *fortitude_createSpriteSheet(SDL_Renderer *renderer, const char *path, int spriteWidth, int spriteHeight, int spriteColumns, int spriteRows)
{
	fortitude_SpriteSheet *spriteSheet = (fortitude_SpriteSheet *)malloc(sizeof(fortitude_SpriteSheet));
	SDL_Surface *surface = IMG_Load(path);
	char error[255];
	if (surface == NULL)
	{
		strcpy(error, "Image ");
		strcpy(error, path);
		strcpy(error, " couldn't be loaded!");
		fortitude_throwError(error, ASSET_LOAD_FAILURE);
		surface = IMG_Load("assets/img/fallback.png");
		if (surface == NULL)
		{
			fortitude_throwError("Fallback image is missing!", ESSENTIAL_ASSET_MISSING);
		}
		error[0] = '\0';
	}
	SDL_SetColorKey(surface, SDL_TRUE, SDL_MapRGB(surface->format, 0xFF, 0x00, 0xFF));
	spriteSheet->texture = SDL_CreateTextureFromSurface(renderer, surface);
	if (spriteSheet->texture == NULL)
	{
		strcpy(error, "Texture failed to be created from image ");
		strcpy(error, path);
		strcpy(error, "!");
		fortitude_throwError(error, TEXTURE_CREATION_FAILURE);
	}
	SDL_FreeSurface(surface);
	spriteSheet->spriteHeight = spriteHeight;
	spriteSheet->spriteWidth = spriteWidth;
	spriteSheet->spriteRows = spriteRows;
	spriteSheet->spriteColumns = spriteColumns;
	return spriteSheet;
}

void fortitude_renderSpriteSheetClip(SDL_Renderer *renderer, fortitude_SpriteSheet *spriteSheet, int x, int y, int sX, int sY)
{
	SDL_Rect srcRect;
	SDL_Rect dstRect;

	if (renderer == NULL) fortitude_throwError("Renderer was passed as NULL!", PASSED_NULL_CONTEXT);

	srcRect.w = spriteSheet->spriteWidth;
	srcRect.h = spriteSheet->spriteHeight;
	if (sX >= spriteSheet->spriteColumns) fortitude_throwError("SpriteSheet column was out of bounds!", ARGUMENT_OOB);
	srcRect.x = spriteSheet->spriteWidth*sX;
	if (sY >= spriteSheet->spriteRows) fortitude_throwError("SpriteSheet row was out of bounds!", ARGUMENT_OOB);
	srcRect.y = spriteSheet->spriteHeight*sY;

	dstRect.w = spriteSheet->spriteWidth;
	dstRect.h = spriteSheet->spriteHeight;
	dstRect.x = x;
	dstRect.y = y;
	SDL_RenderCopy(renderer, spriteSheet->texture, &srcRect, &dstRect);
}


text:
package org.apache.calcite.sql.ddl;

import org.apache.calcite.sql.SqlIdentifier;
import org.apache.calcite.sql.SqlKind;
import org.apache.calcite.sql.SqlOperator;
import org.apache.calcite.sql.SqlSpecialOperator;
import org.apache.calcite.sql.parser.SqlParserPos;

/**
 * Parse tree for {@code DROP TABLE} statement.
 */
public class SqlDropTable extends SqlDropObject {
  private static final SqlOperator OPERATOR =
      new SqlSpecialOperator("DROP TABLE", SqlKind.DROP_TABLE);

  /** Creates a SqlDropTable. */
  SqlDropTable(SqlParserPos pos, boolean ifExists, SqlIdentifier name) {
    super(OPERATOR, pos, ifExists, name);
  }
}


text:
package org.openqa.selenium.remote.server.commandhandler;

import static com.google.common.net.MediaType.JSON_UTF_8;
import static java.net.HttpURLConnection.HTTP_OK;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.openqa.selenium.remote.ErrorCodes.SUCCESS;

import com.google.common.collect.ImmutableMap;

import org.openqa.selenium.json.Json;
import org.openqa.selenium.remote.http.HttpRequest;
import org.openqa.selenium.remote.http.HttpResponse;
import org.openqa.selenium.remote.server.ActiveSessions;
import org.openqa.selenium.remote.server.CommandHandler;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;

public class GetAllSessions implements CommandHandler {

  private final ActiveSessions allSessions;
  private final Json json;

  public GetAllSessions(ActiveSessions allSessions, Json json) {
    this.allSessions = Objects.requireNonNull(allSessions);
    this.json = Objects.requireNonNull(json);
  }

  @Override
  public void execute(HttpRequest req, HttpResponse resp) throws IOException {
    List<Map<String, Object>> value = new ArrayList<>();

    allSessions.getAllSessions().forEach(s -> value.add(
        ImmutableMap.of("id", s.getId().toString(), "capabilities", s.getCapabilities())));

    Map<String, Object> payloadObj = ImmutableMap.of(
        "status", SUCCESS,
        "value", value);

    // Write out a minimal W3C status response.
    byte[] payload = json.toJson(payloadObj).getBytes(UTF_8);

    resp.setStatus(HTTP_OK);
    resp.setHeader("Content-Type", JSON_UTF_8.toString());
    resp.setHeader("Content-Length", String.valueOf(payload.length));

    resp.setContent(payload);
  }
}


text:
var on = require("./events/on");

module.exports = {
  outerHTML: function(oldEl, newEl) {
    oldEl.outerHTML = newEl.outerHTML;
    this.onSwitch();
  },

  innerHTML: function(oldEl, newEl) {
    oldEl.innerHTML = newEl.innerHTML;

    if (newEl.className === "") {
      oldEl.removeAttribute("class");
    } else {
      //oldEl.className = newEl.className;
    }

    this.onSwitch();
  },

  switchElementsAlt: function(oldEl, newEl) {
    oldEl.innerHTML = newEl.innerHTML;

    // Copy attributes from the new element to the old one
    if (newEl.hasAttributes()) {
      var attrs = newEl.attributes;
      for (var i = 0; i < attrs.length; i++) {
        oldEl.attributes.setNamedItem(attrs[i].cloneNode());
      }
    }

    this.onSwitch();
  },

  // Equivalent to outerHTML(), but doesn't require switchElementsAlt() for <head> and <body>
  replaceNode: function(oldEl, newEl) {
    oldEl.parentNode.replaceChild(newEl, oldEl);
    this.onSwitch();
  },

  sideBySide: function(oldEl, newEl, options, switchOptions) {
    var forEach = Array.prototype.forEach;
    var elsToRemove = [];
    var elsToAdd = [];
    var fragToAppend = document.createDocumentFragment();
    var animationEventNames =
      "animationend webkitAnimationEnd MSAnimationEnd oanimationend";
    var animatedElsNumber = 0;
    var sexyAnimationEnd = function(e) {
      if (e.target !== e.currentTarget) {
        // end triggered by an animation on a child
        return;
      }

      animatedElsNumber--;
      if (animatedElsNumber <= 0 && elsToRemove) {
        elsToRemove.forEach(function(el) {
          // browsing quickly can make the el
          // already removed by last page update ?
          if (el.parentNode) {
            el.parentNode.removeChild(el);
          }
        });

        elsToAdd.forEach(function(el) {
          el.className = el.className.replace(
            el.getAttribute("data-pjax-classes"),
            ""
          );
          el.removeAttribute("data-pjax-classes");
        });

        elsToAdd = null; // free memory
        elsToRemove = null; // free memory

        // this is to trigger some repaint (example: picturefill)
        this.onSwitch();
      }
    }.bind(this);

    switchOptions = switchOptions || {};

    forEach.call(oldEl.childNodes, function(el) {
      elsToRemove.push(el);
      if (el.classList && !el.classList.contains("js-Pjax-remove")) {
        // for fast switch, clean element that just have been added, & not cleaned yet.
        if (el.hasAttribute("data-pjax-classes")) {
          el.className = el.className.replace(
            el.getAttribute("data-pjax-classes"),
            ""
          );
          el.removeAttribute("data-pjax-classes");
        }
        el.classList.add("js-Pjax-remove");
        if (switchOptions.callbacks && switchOptions.callbacks.removeElement) {
          switchOptions.callbacks.removeElement(el);
        }
        if (switchOptions.classNames) {
          el.className +=
            " " +
            switchOptions.classNames.remove +
            " " +
            (options.backward
              ? switchOptions.classNames.backward
              : switchOptions.classNames.forward);
        }
        animatedElsNumber++;
        on(el, animationEventNames, sexyAnimationEnd, true);
      }
    });

    forEach.call(newEl.childNodes, function(el) {
      if (el.classList) {
        var addClasses = "";
        if (switchOptions.classNames) {
          addClasses =
            " js-Pjax-add " +
            switchOptions.classNames.add +
            " " +
            (options.backward
              ? switchOptions.classNames.forward
              : switchOptions.classNames.backward);
        }
        if (switchOptions.callbacks && switchOptions.callbacks.addElement) {
          switchOptions.callbacks.addElement(el);
        }
        el.className += addClasses;
        el.setAttribute("data-pjax-classes", addClasses);
        elsToAdd.push(el);
        fragToAppend.appendChild(el);
        animatedElsNumber++;
        on(el, animationEventNames, sexyAnimationEnd, true);
      }
    });

    // pass all className of the parent
    oldEl.className = newEl.className;
    oldEl.appendChild(fragToAppend);
  }
};


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="match_parent">
    <ListView
        android:id="@+id/lv_year_report"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbars="none"
        android:dividerHeight="10dp"
        android:divider="@null"
        android:paddingTop="10dp"
        android:clipToPadding="false"
        ></ListView>
</LinearLayout>


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

<RelativeLayout
    android:id="@+id/widget"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/material_deep_teal_500"
    android:padding="8dp"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <ImageView
        android:id="@+id/widget_image"
        android:layout_width="@dimen/widget_today_min_resize_width"
        android:layout_height="match_parent"
        android:layout_centerVertical="true"
        android:scaleType="centerInside"
        tools:src="@drawable/art_clear" />

    <TextView
        android:id="@+id/widget_description"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_toEndOf="@id/widget_image"
        android:layout_toRightOf="@id/widget_image"
        android:fontFamily="sans-serif-condensed"
        android:paddingLeft="16dp"
        android:paddingStart="16dp"
        android:textAppearance="?android:textAppearanceLarge"
        android:textColor="@color/white"
         />

    <TextView
        android:id="@+id/widget_temp_low"
        android:layout_width="@dimen/forecast_text_width"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_centerVertical="true"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:gravity="end"
        android:fontFamily="sans-serif-light"
        android:textColor="@color/white"
        android:textSize="@dimen/forecast_text_size"
        />

    <TextView
        android:id="@+id/widget_temp_high"
        android:layout_width="@dimen/forecast_text_width"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_centerVertical="true"
        android:gravity="end"
        android:layout_toLeftOf="@id/widget_temp_low"
        android:layout_toStartOf="@id/widget_temp_low"
        android:layout_marginRight="@dimen/forecast_temperature_space"
        android:layout_marginEnd="@dimen/forecast_temperature_space"
        android:fontFamily="sans-serif-light"
        android:textColor="@color/white"
        android:textSize="@dimen/forecast_text_size"
        />

</RelativeLayout>


text:
using namespace cv;
using namespace std;

int main(int argc, char** argv)
{
    CvMat* Intrinsic0 = (CvMat*)cvLoad("/home/hitcsc/catkin_ws/src/iarc/doc/navigation/Intrinsics.xml");
    Mat Intrinsic = Mat(Intrinsic0, true);
    CvMat* Distortion0 = (CvMat*)cvLoad("/home/hitcsc/catkin_ws/src/iarc/doc/navigation/Distortion.xml");
    Mat Distortion = Mat(Distortion0, true);

    Mat NewCameraMatrix =Mat(3, 3, CV_32FC1, Scalar(0));
    Size size=Size(640,480);
    NewCameraMatrix = getOptimalNewCameraMatrix(Intrinsic, Distortion, size, 0);
    cout << NewCameraMatrix << endl;
    CvMat* NewCameraMatrix1 = cvCreateMat(3, 3, CV_32FC1);
    CvMat temp = NewCameraMatrix;
    cvCopy(&temp, NewCameraMatrix1);
    cvSave("/home/hitcsc/catkin_ws/src/iarc/doc/navigation/NewIntrinsics.xml", NewCameraMatrix1);
    cvReleaseMat(&NewCameraMatrix1);
    return 0;
}


text:
package org.drools.model.consequences;

import org.drools.model.Consequence;
import org.drools.model.Drools;
import org.drools.model.RuleItemBuilder;
import org.drools.model.Variable;
import org.drools.model.functions.*;
import org.drools.model.functions.ScriptBlock;

// Generated by ConsequenceGenerator, please do not change this file manually
public class ConsequenceBuilder {

    public _0 execute(Block0 block) {
        return new _0(block);
    }

    public _0 execute(Block1<Drools> block) {
        return new _0(block);
    }

    public <A> _1<A> on(Variable<A> dec1) {
        return new _1(dec1);
    }

    public <A, B> _2<A, B> on(Variable<A> decl1, Variable<B> decl2) {
        return new _2(decl1, decl2);
    }

    public interface ValidBuilder extends RuleItemBuilder<Consequence> { }

    public static abstract class AbstractValidBuilder<T extends AbstractValidBuilder> implements ValidBuilder {
        private final Variable[] declarations;
        protected BlockN block;
        protected boolean usingDrools = false;
        protected boolean breaking = false;
        protected String language = "java";

        protected AbstractValidBuilder(Variable... declarations) {
            this.declarations = declarations;
        }

        @Override
        public Consequence get() {
            return new ConsequenceImpl( block,
                                        declarations,
                                        usingDrools,
                                        breaking,
                                        language);
        }

        public T breaking() {
            breaking = true;
            return (T) this;
        }
    }

    public static class _0 extends AbstractValidBuilder<_0> {
        public _0(final Block0 block) {
            super(new Variable[0]);
            this.block = block.asBlockN();
        }

        public _0(final Block1<Drools> block) {
            super();
            this.usingDrools = true;
            this.block = block.asBlockN();
        }

        public _0(String language, Class<?> ruleClass, String script) {
            super();
            this.usingDrools = true;
            this.language = language;
            this.block = new ScriptBlock(ruleClass, script);
        }
    }

    // This is used as both an example and the template with which the inner class is generated
    public static class _ARITY_CLASS_NAME<A, B, C, D, E> extends AbstractValidBuilder<_ARITY_CLASS_NAME<A,B,C,D,E>> {
        public _ARITY_CLASS_NAME(Variable<A> decl1, Variable<B> decl2, Variable<C> decl3, Variable<D> decl4, Variable<E> decl5) {
            super(decl1, decl2, decl3, decl4, decl5);
        }

        public _ARITY_CLASS_NAME<A, B, C, D, E> execute(final _ARITY_BLOCK<A, B, C, D, E> block) {
            this.block = block.asBlockN();
            return this;
        }

        public _ARITY_CLASS_NAME<A, B, C, D, E> execute(final _ARITY_BLOCK_PLUS_ONE<Drools, A, B, C, D, E> block ) {
            this.usingDrools = true;
            this.block = block.asBlockN();
            return this;
        }

        public _ARITY_CLASS_NAME<A, B, C, D, E> executeScript(String language, Class<?> ruleClass, String script) {
            this.usingDrools = true;
            this.language = language;
            this.block = new ScriptBlock(ruleClass, script);
            return this;
        }
    }

    public static class _N extends AbstractValidBuilder<_N> {

        public _N(Variable... declarations) {
            super(declarations);
        }

        public _N executeScript(String language, Class<?> ruleClass, String script) {
            this.usingDrools = true;
            this.language = language;
            this.block = new ScriptBlock(ruleClass, script);
            return this;
        }
    }
}


text:
module CurrencySpy
  # A class designed to fetch currency information from the website of The Polish National Bank (Narodowy Bank Polski).
  class Nbp < CurrencySpy::ScraperBase

    # Constructor method.
    # Initializes the following:
    # * a url of the source
    # * and the name of the source
    # * a list of currency codes available
    def initialize
      super
      @url = 'http://www.nbp.pl/home.aspx?f=/kursy/kursyc.html'
      @institution = "Narodowy Bank Polski"
      @available_codes = %w(EUR USD GBP CHF AUS AUD CAD CZK DKK NOK SEK)
    end

    # Get the buying rate from the parsed website
    def buy_rate
      regexp = Regexp.new(currency_code)
      page.search('//tr[@valign="middle"]').each do |tr|
        tr.search('td').each do |td|
          if regexp.match(td.content)
            return td.next_element.content.sub(',','.').to_f
          end
        end
      end
    end

    # Get the selling rate from the parsed website
    def sell_rate
      regexp = Regexp.new(currency_code)
      page.search('//tr[@valign="middle"]').each do |tr|
        tr.search('td').each do |td|
          if regexp.match(td.content)
            return td.next_element.next_element.content.sub(',','.').to_f
          end
        end
      end
    end

    # Get the time for this rate (based on the information on the website)
    def rate_time
      regexp = Regexp.new(/\d\d\d\d-\d\d-\d\d/)
      page.search('//p[@class="nag"]').each do |p|
        p.search('b').each do |b|
          if regexp.match(b.content)
            return DateTime.strptime(b.content, "%Y-%m-%d")
          end
        end
      end
    end

  end
end


text:
using System.Drawing;
using System.IO;
using Avanade.AzureDAM.Integrations.Repositories;
using Avanade.AzureDAM.Messages;
using Avanade.AzureDAM.Models;
using ImageProcessor;
using ImageProcessor.Imaging.Formats;

namespace Avanade.AzureDAM.MessageHandlers
{
    internal class GenerateThumbnail : IHandle<NewImageAdded>
    {
        private readonly ImageFileRepository _fileRepository;
        private readonly AssetDocumentRepository _documentRepository;

        public GenerateThumbnail(ImageFileRepository fileRepository, AssetDocumentRepository documentRepository)
        {
            _fileRepository = fileRepository;
            _documentRepository = documentRepository;
        }

        public void Handle(NewImageAdded message)
        {
            var originalAsset = _fileRepository.ReadImage(message.ImageName);

            var thumbnailLocation = Generate(originalAsset);
            AddDerivate(message, thumbnailLocation);

        }

        private string Generate(StoredAsset originalAsset)
        {
            using (var inputStream = originalAsset.FileStream)
            using (var outputStream = new MemoryStream())
            using (var factory = new ImageFactory())
            {
                factory.Load(inputStream)
                    .Resize(new Size(0, 150))
                    .Format(new JpegFormat() {Quality = 70})
                    .Save(outputStream);

                var outputBytes = new byte[outputStream.Length];
                outputStream.Read(outputBytes, 0, (int) outputStream.Length);
                var thumbnail = _fileRepository.StoreAsset(originalAsset.Id, "thumbnail" + originalAsset.Extension, originalAsset.ContentType,
                    outputBytes);

                return thumbnail.StorageLocation;
            }
        }

        private void AddDerivate(NewImageAdded message, string thumbnailLocation)
        {
            var metadata = _documentRepository.Get(message.Id);

            metadata.Published = true;
            var newDerivate = new Derivate
            {
                Name = "Thumbnail",
                Url = thumbnailLocation
            };

            metadata.Derivates.Add(newDerivate);
            _documentRepository.Update(metadata);
        }
    }
}


text:
package org.apache.jmeter.util;

import junit.framework.TestCase;

public class PackageTest extends TestCase {

    public PackageTest() {
        super();
    }

    public PackageTest(String arg0) {
        super(arg0);
    }

    public void testServer() throws Exception {
        BeanShellServer bshs = new BeanShellServer(9876, "");
        assertNotNull(bshs);
        // Not sure we can test anything else here
    }
    public void testSub1() throws Exception {
        String input = "http://jakarta.apache.org/jmeter/index.html";
        String pattern = "jakarta.apache.org";
        String sub = "${server}";
        assertEquals("http://${server}/jmeter/index.html", StringUtilities.substitute(input, pattern, sub));
    }

    public void testSub2() throws Exception {
        String input = "arg1=param1;param1";
        String pattern = "param1";
        String sub = "${value}";
        assertEquals("arg1=${value};${value}", StringUtilities.substitute(input, pattern, sub));
    }

    public void testSub3() throws Exception {
        String input = "jakarta.apache.org";
        String pattern = "jakarta.apache.org";
        String sub = "${server}";
        assertEquals("${server}", StringUtilities.substitute(input, pattern, sub));
    }

    public void testSub4() throws Exception {
        String input = "//a///b////c";
        String pattern = "//";
        String sub = "/";
        assertEquals("/a//b//c", StringUtilities.substitute(input, pattern, sub));
    }

}


text:
<?php

namespace Oro\Bundle\CurrencyBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Exception\LogicException;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\Intl\Intl;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;

use Oro\Bundle\CurrencyBundle\Provider\CurrencyProviderInterface;
use Oro\Bundle\CurrencyBundle\Provider\ViewTypeProviderInterface;
use Oro\Bundle\CurrencyBundle\Utils\CurrencyNameHelper;
use Oro\Bundle\FormBundle\Utils\FormUtils;
use Oro\Bundle\LocaleBundle\Model\LocaleSettings;

abstract class AbstractCurrencySelectionType extends AbstractType
{
    /**
     * @var CurrencyProviderInterface
     */
    protected $currencyProvider;

    /**
     * @var LocaleSettings
     */
    protected $localeSettings;

    /**
     * @var string
     */
    protected $currencySelectorConfigKey;

    /**
     * @var CurrencyNameHelper
     */
    protected $currencyNameHelper;

    /**
     * @param CurrencyProviderInterface $currencyProvider
     * @param LocaleSettings $localeSettings
     * @param CurrencyNameHelper $currencyNameHelper
     */
    public function __construct(
        CurrencyProviderInterface $currencyProvider,
        LocaleSettings $localeSettings,
        CurrencyNameHelper $currencyNameHelper
    ) {
        $this->currencyProvider = $currencyProvider;
        $this->localeSettings = $localeSettings;
        $this->currencyNameHelper = $currencyNameHelper;
    }

    /**
     * {@inheritDoc}
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults([
            'choices' => function (Options $options) {
                $this->checkOptions($options);

                if ($options['full_currency_list']) {
                    return $this->currencyNameHelper->getCurrencyFilteredList();
                }

                $currencies = $options['currencies_list'];
                if (!count($currencies)) {
                    $currencies = $this->getCurrencies();
                }

                $currencies = array_merge($currencies, (array)$options['additional_currencies']);

                $this->checkCurrencies($currencies);

                return array_flip($currencies);
            },
            'compact' => false,
            'currencies_list' => null,
            'additional_currencies' => null,
            'full_currency_list' => false,
            'full_currency_name' => false,
        ]);

        $resolver->setNormalizer('choice_label', function (Options $options, $value) {
            $viewType = null;

            if ($options['full_currency_name']) {
                $viewType = ViewTypeProviderInterface::VIEW_TYPE_FULL_NAME;
            }

            if ($options['compact']) {
                $viewType = ViewTypeProviderInterface::VIEW_TYPE_ISO_CODE;
            }

            return function ($currencyCode) use ($viewType) {
                return $this->currencyNameHelper->getCurrencyName($currencyCode, $viewType);
            };
        });
    }

    /**
     * @param FormView $view
     * @param FormInterface $form
     * @param array $options
     */
    public function buildView(FormView $view, FormInterface $form, array $options)
    {
        $view->vars['hidden_field'] = (count($options['choices']) <= 1);
    }

    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($options) {
            $selectedCurrency = $event->getData();
            if (empty($selectedCurrency)) {
                $selectedCurrency = $this->getDefaultCurrency();
                if ($this->isMultiple($options)) {
                    $selectedCurrency = [$selectedCurrency => 0];
                }
                $event->setData($selectedCurrency);
            }
        });

        $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($options) {
            $formData = $event->getData();

            if (!empty($formData) && !$this->isMultiple($options) && $this->isMissedCurrency($formData, $options)) {
                FormUtils::replaceField(
                    $event->getForm()->getParent(),
                    $event->getForm()->getName(),
                    ['additional_currencies' => [$formData]],
                    ['choice_list', 'choices']
                );
            }
        });
    }

    /**
     * @param Options $options
     * @throws LogicException
     */
    protected function checkOptions(Options $options)
    {
        if (($options['currencies_list'] !== null && !is_array($options['currencies_list']))
            || (is_array($options['currencies_list']) && empty($options['currencies_list']))
        ) {
            throw new LogicException('The option "currencies_list" must be null or not empty array.');
        }

        if ($options['additional_currencies'] !== null && !is_array($options['additional_currencies'])) {
            throw new LogicException('The option "additional_currencies" must be null or array.');
        }
    }

    /**
     * @param array $currencies
     * @throws LogicException
     */
    protected function checkCurrencies(array $currencies)
    {
        $invalidCurrencies = [];

        foreach ($currencies as $currency) {
            $name = Intl::getCurrencyBundle()->getCurrencyName($currency, $this->localeSettings->getLocale());

            if (!$name) {
                $invalidCurrencies[] = $currency;
            }
        }

        if ($invalidCurrencies) {
            throw new LogicException(sprintf('Found unknown currencies: %s.', implode(', ', $invalidCurrencies)));
        }
    }

    /**
     * {@inheritDoc}
     */
    public function getParent()
    {
        return 'choice';
    }

    /**
     * @return array
     */
    protected function getCurrencies()
    {
        return $this->currencyProvider->getCurrencyList();
    }

    /**
     * @return string
     */
    protected function getDefaultCurrency()
    {
        return $this->currencyProvider->getDefaultCurrency();
    }

    /**
     * @param array $options
     * @return bool
     */
    protected function isMultiple(array $options)
    {
        return isset($options['multiple']) && $options['multiple'];
    }

    /**
     * @param string $currencyCode
     * @param array $options
     * @return bool
     */
    private function isMissedCurrency($currencyCode, array $options)
    {
        return (empty($options['choices']) || !isset($options['choices'][$currencyCode]));
    }
}