text:
package de.danoeh.antennapod;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.util.Log;

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

import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.core.feed.FeedImage;
import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.storage.DBWriter;

/*
 * This class's job is do perform maintenance tasks whenever the app has been updated
 */
public class UpdateManager {

    public static final String TAG = UpdateManager.class.getSimpleName();

    private static final String PREF_NAME = "app_version";
    private static final String KEY_VERSION_CODE = "version_code";

    private static int currentVersionCode;

    private static Context context;
    private static SharedPreferences prefs;

    public static void init(Context context) {
        UpdateManager.context = context;
        prefs = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
        PackageManager pm = context.getPackageManager();
        try {
            PackageInfo info = pm.getPackageInfo(context.getPackageName(), 0);
            currentVersionCode = info.versionCode;
        } catch (PackageManager.NameNotFoundException e) {
            Log.e(TAG, "Failed to obtain package info for package name: " + context.getPackageName(), e);
            currentVersionCode = 0;
            return;
        }
        final int oldVersionCode = getStoredVersionCode();
        Log.d(TAG, "old: " + oldVersionCode + ", current: " + currentVersionCode);
        if(oldVersionCode < currentVersionCode) {
            onUpgrade(oldVersionCode, currentVersionCode);
            setCurrentVersionCode();
        }
    }

    public static int getStoredVersionCode() {
        return prefs.getInt(KEY_VERSION_CODE, -1);
    }

    public static void setCurrentVersionCode() {
        prefs.edit().putInt(KEY_VERSION_CODE, currentVersionCode).apply();
    }

    private static void onUpgrade(final int oldVersionCode, final int newVersionCode) {
        if(oldVersionCode < 1030099) {
            // delete the now obsolete image cache
            // from now on, Glide will handle caching images
            new Thread() {
                public void run() {
                    List<Feed> feeds = DBReader.getFeedList(context);
                    for (Feed podcast : feeds) {
                        List<FeedItem> episodes = DBReader.getFeedItemList(context, podcast);
                        for (FeedItem episode : episodes) {
                            FeedImage image = episode.getImage();
                            if (image != null && image.isDownloaded() && image.getFile_url() != null) {
                                File imageFile = new File(image.getFile_url());
                                if (imageFile.exists()) {
                                    imageFile.delete();
                                }
                                image.setFile_url(null); // calls setDownloaded(false)
                                DBWriter.setFeedImage(context, image);
                            }
                        }
                    }
                }
            }.start();
        }
    }

}

redpajama_set_name: RedPajamaGithub


text:
A binding of URL paths to a Page class that can render the results for those URLs.

`path: String | RegEx | [ String | RegEx ]`

* A string or regex that will be tested against the path of the URL to
  determine if this route applies.

`method, optional: undefined | String | [String]`

* The HTTP method(s) that are acceptable.  Use an array of strings to specify multiple methods.  Do not
  set this value to `null` or `[]`.  To match all HTTP methods, either leave out the parameter altogether or explicitly
  set the value to `undefined`.

* Default: undefined

`page: Page`
* The page to render

# Page

An HTML page to be rendered. Note that this Page may be rendered as a result
of either an HTTP request or a client-side navigation. The Page's core
responsibilities are to:

* handle redirects or forwarding to other pages
* translate the URL/request into any necessary backend data requests
* produce all of the elements to be included in the HTML Page `<head>`.
* produce one or more ReactElements that will render the page

The rendering process follows the following flow:

1. The request is compared to all the routes, and a Page constructor is
   retrieved.
1. The Page constructor is called.
1. `setConfigValues` is called.  This method may return an object representing
   configuration overrides for the page.
1. `handleRoute` is called with the current Request to determine if this
   request needs to be redirected or forwarded.
 * If a redirect is returned (code 301 or 302), the user-visible URL will
   change, and the routing process will start again at step #1.
 * If a forward is returned (a Page constructor), then routing will jump back
   to step #2 with the new Page constructor.
 * Otherwise, continue on.
1. If they exist, `getTitle`, `getScripts`, `getSystemScripts`,
   `getHeadStylesheets`, `getMetaTags`, and `getBodyClasses` are called, and
   their results are written into the head of the response (via
   `response.write` on server and DOM operations on the client). On the
   server, if any of those methods return a Promise, the writing of the
   ReactElements is blocked until the Promises resolve. On the client,
   ReactElements can be written out to the document body before the title or
   meta tags are resolved.
1. `getElements` is called, and the resulting ReactElements are rendered and
   written out to the document in the order they were returned from
   getElements. On both client and server side, rendering of element N will
   always block on rendering of element N - 1. We may ease this restriction
   later.
1. If a timeout is reached on the server, the EarlyPromises of ReactElements
   may be forced to resolve via `getValue`, and the resulting elements will be
   rendered and written out to the document. If `getElements` returns a
   Promise that is not an EarlyPromise, then nothing will be written out in
   the case of a timeout.

# Page methods

There are three groups of methods that are relevant to page objects, and they
are all defined in simple data structures with ample commentary near the top of
react-server/core/util/PageUtil.js.  That is the authoritative reference for the
react-server page interface.

* Please see: `react-server/core/util/PageUtil.js`

## Static methods

`constructor()`

`static middleware() : [Page classes]`

* An array of page classes that should be used as mixins for this page. See
  Middleware section below to see what these are for.

## PAGE_METHODS

Each of these methods receives a function, `next`, as its sole argument.
This `next function may be used to call the default implementation of the
function in question.

`handleRoute(request:Request, loader:Loader, next: Function), optional:
{code?: int, location?: String, page?:Page} | Promise({code?: int, location?:
String, page?:Page})`

* This method is called before any of the other methods, and its purpose is to
  kick off any async data fetching the page needs to do and to make sure that
  we are on the correct page. It returns an object (or Promise of object) that
  always has a `code` field, which is the HTTP result code to return.

* `handleRoute` takes in a Request object so that the Page will know exactly
  what information it should display. For best performance, the Page should
  start any data requests that are necessary for first render in handleRoute.

* The Loader is an HTTP loading interface that supports client caching of
  results in HTML and late arrival of HTTP responses that occur after a
  rendering timeout.

* If the `code` is 301 or 302, then it must also return a `location` String to
  tell the browser where to redirect.

* If the `handleRoute` returns an object with a `page` property and no `code`
  property, then the current page object is thrown away, and routing forwards
  control to the page that was returned, starting with `handleRoute()`. This
  is helpful for having centralized error pages for things like 404 Not Found
  or 500 Server Error.

* Note that HTTP codes will not be returned when performing client-side page
  transitions. However, 302 and 301 codes will use the History API to change
  the URL on client-side transitions, resulting in an effective redirect. For
  browsers that do not support the History API, the browser may load the new
  page from scratch.

* The other methods in this Page object will not be called until and unless
  the result from `handleRoute` resolves and the return value has a `code`
  property.

* Default: `{code:200}`

`getTitle(next: Function), optional: String | Promise(String)`

* A string (or promise thereof) that is the title of this page.

* Default: ""

`getScripts(next: Function): String | Script | [String | Script]`

* URLs for the script files that should be loaded in the head for this page.

`getSystemScripts(next: Function): String | Script | [String | Script]`

* URLs for the critical client-side JavaScript files that make react-server
  run on the client side, including both the react-server runtime, this page
  class, and its bundled dependencies. Do not override this method unless you
  are doing something very tricky, like packaging react-server for the client
  with something other than the standard Webpack.

* Default: the URLs of the files that react-server needs to run on the client-side.

`getHeadStylesheets(next: Function): String |  Style | [String | Style]`

* URLs for the stylesheets that should be loaded in the head for this page.

* If the method returns a `String` value, it is interpreted as a `Style` of
  the form `{href:<value>, type:"text/css"}`.

`getMetaTags(next: Function): Meta | Promise(Meta) | [Meta | Promise(Meta)]`

* A set of Meta objects that represent the meta tags for this page. If it's a
  promise and the promise returns null, the meta tag will not be used.

* Default: []

`getLinkTags(next: Function): Link | Promise(Link) | [Link | Promise(Link)]`

* A set of Link objects that represent the link tags for this page. If it's a
  promise and the promise returns null, the link tag will not be used.

* Default: []

`getBase(next: Function): Base | Promise(Base | null) | null`

* Returns the value of the HTML `<base>` tag. If null, there will be no <base>
  tag in the head.

* Default: null

`getBodyClasses(next: Function): Classes | Promise(Classes)`

* Returns an array of classes to add to the `<body>` tag.

* Default: []

`getElements(next: Function): ReactElement | EarlyPromise(ReactElement) |
Promise(ReactElement) | [ ReactElement | EarlyPromise(ReactElement) |
Promise(ReactElement) ]`

* The React elements, in page order, which make up the HTML of this Page. For
  convenience, you can return a single element or an array of elements.

* When an array is returned, each of the elements will be put in a separate
  container div, which will be siblings of each other. If an element is null,
  it will not result in anything rendered to the document.

* If the any of the return values are EarlyPromises, they may be rendered in a
  partial state using `getValue`.

`getResponseData(next: Function): String | Buffer | Promise(String) | Promise(Buffer)`

* This method is only part of the "raw response" page lifecycle.  See

`getHttpHeaders(next:Function): HttpHeader | Promise(HttpHeader) | [HttpHeader | Promise(HttpHeader)]`

* The set of HTTP headers that should be sent back from this page. Has no
  effect when a page is transitioned to on the client.

## PAGE_HOOKS

These are additional methods that a page/middleware may implement.

`setConfigValues()`: Config object

Return configuration overrides for the page.

`addConfigValues()`: Config object

Add new configuration values, with defaults (only used by middleware).

`handleComplete()`: Called when the request is complete and the full response has been sent.

### Config values

There are two config values that are honored by the navigator

* `isFragment` (boolean) indicates a response is a fragment of a page, rather than a full page
* `isRawResponse` (boolean) indicates a response is to be served as-is

## PAGE_MIXIN

These are methods that are automatically made available on the page object.
The page may call these methods on itself.

`getRequest()`: Get the request object (see "Request", below)

`getConfig(key)`: Get a single page configuration value.

`getExpressResponse()`: Get the express response object (only available for raw response pages).

# Middleware

Middlewares are objects that implement any subset of the Page API and are
called before a `Page` in a chained fashion. If a middleware doesn't implement
a method, it is skipped. If a middleware does implement a method, it can
completely handle the method (thereby completely ignoring the Page's
implementation), or it can pass through to the Page's implementation using the
`next` argument.

# Request

The request that led to rendering a page, which is similar to a standard
Express Request but is somewhat more constrained because of the need to be
applicable on both client and server side. Note that several methods return
special "not available" values when run on the client side.

`getUrl(): String`

`getBody(): ReadableStream`

`getMethod()`

`getRouteName() : String`

* Gets the name of the route that is currently being matched.

`getHttpHeader(name: String): String | Request.HEADERS_NOT_AVAILABLE`

* Gets the value for a particular HTTP header. If this is a client-side page
  transition, then the response will always be Request.HEADERS_NOT_AVAILABLE.

`getHttpHeaders(): Object | Request.HEADERS_NOT_AVAILABLE`

* Returns all the HTTP headers as name:value pairs. If this is a client-side
  page transition, then the response will always be
  Request.HEADERS_NOT_AVAILABLE.

`getCookie(name: String): String`

* Retrieves the value of the cookie with the specified name. Note that
  httpOnly cookies will not be available on the client-side.

`getCookies(): Object`

* Returns all cookies as name:value pairs. Note that httpOnly cookies will not
  be available on the client-side.

# EarlyPromise(T) extends Promise(T)

A Promise that can be interrupted and forced to return a value while still
pending, perhaps with a value that is only partly finished. The main use case
is for timeouts that fire before Promise fulfillment, but for values that
could be useful in a partially finished state (imagine an image that could be
useful, if fuzzy, when half-decrypted). This allows the client to retrieve a
partially usable value even if the Promise never fulfills.

`getValue(): T`

* Returns the value of the Promise, perhaps in a partially completed state if
  the promise is still pending. May return null if there is nothing of
  interest yet available. If the promise has already fulfilled, then get
  **MUST** return the value that was resolved. If the promise rejected, then
  get **MUST** throw that same error.

* This method **MUST NOT** throw an error if it is fulfilled or pending.


text: Intel(R) Fortran Compiler XE for applications running on IA-32, Version 12.0 Build 20110309


text:
/*global describe, beforeEach, assert, it  */
'use strict';

describe('<%= _.classify(name) %> View', function () {

    beforeEach(function () {
        this.<%= _.classify(name) %> = new <%= _.camelize(appname) %>.Views.<%= _.classify(name) %>View();
    });

});


text:
'use strict';

var gulp = require('gulp'),
		imagemin = require('gulp-imagemin'),
		pngquant = require('imagemin-pngquant'),
    imageResize = require('gulp-image-resize'),
    rename = require("gulp-rename");

gulp.task('imagemin', function() {
	return gulp.src('src/images/**/*')
    .pipe(imagemin({
        progressive: true,
        svgoPlugins: [{removeViewBox: false}],
        use: [pngquant()]
    }))
    .pipe(gulp.dest('dist/images'));
});

gulp.task('rename', function() {
  return gulp.src('src/images/**/1.png')
    .pipe(rename({
      basename: '4'
    }))
    .pipe(imageResize({
      width: 120,
      height: 120,
      crop: true,
      upscale: true
    }))
    .pipe(gulp.dest('src/images'));
});

gulp.task('default', ['rename'], function() {
  gulp.start('imagemin');
})


text:
- [Thiemo Wiedemeyer](https://ai.uni-bremen.de/team/thiemo_wiedemeyer) <<wiedemeyer@cs.uni-bremen.de>>, [Institute for Artificial Intelligence](http://ai.uni-bremen.de/), University of Bremen

*Note:* ***Please use the GitHub issues*** *for questions and problems regarding the iai_kinect2 package and its components.* ***Do not write emails.***

## Description

This tool uses OpenCV to calibrate two cameras to each other. It is specially designed for the Kinect One. It uses chess or circle boards.

## Dependencies

- ROS Hydro/Indigo
- OpenCV

*for the ROS packages look at the package.xml*

## Usage

```
kinect2_calibration [options]
  name: 'any string' equals to the kinect2_bridge topic base name
  mode: 'record' or 'calibrate'
  source: 'color', 'ir', 'sync', 'depth'
  board:
    'circle<WIDTH>x<HEIGHT>x<SIZE>'  for symmetric circle grid
    'acircle<WIDTH>x<HEIGHT>x<SIZE>' for asymmetric circle grid
    'chess<WIDTH>x<HEIGHT>x<SIZE>'   for chessboard pattern
  distortion model: 'rational' for using model with 8 instead of 5 coefficients
  output path: '-path <PATH>'
```

## Key bindings

Windows:
- `ESC`, `q`: Quit
- `SPACE`, `s`: Save the current image for calibration
- `l`: decrease min and max value for IR value rage
- `h`: increase min and max value for IR value rage
- `1`: decrease min value for IR value rage
- `2`: increase min value for IR value rage
- `3`: decrease max value for IR value rage
- `4`: increase max value for IR value rage

Terminal:
- `CRTL`+`c`: Quit

## Calibration patterns

Any chessboard pattern or symmetric or asymmetric circle grid should work. Three different chessboard patterns are located inside the `kinect2_calibration/patterns` folder:
- [chess5x7x0.03.pdf](patterns/chess5x7x0.03.pdf)
- [chess7x9x0.025.pdf](patterns/chess7x9x0.025.pdf)
- [chess9x11x0.02.pdf](patterns/chess9x11x0.02.pdf)

Other patterns are available at OpenCV:
- [Chessboard pattern](http://docs.opencv.org/2.4.2/_downloads/pattern.png)
- [Asymmetric circle grid](http://docs.opencv.org/2.4.2/_downloads/acircles_pattern.png)

The standard board is a 7x6 0.108m chessboard from the PR2. But any other board can be specified with as parameter. For example a circle board with 8x7 circles in 0.02m distance between them `rosrun kinect2_calibration kinect2_calibration record color circle8x7x0.02`.

Recently, to calibrate our sensors, we have used the chess5x7x0.03 pattern, as it can be printed easily on a good laser printer on A4 paper.

## Calibrating the Kinect One

*Recommended preparation:*
- Print your calibration pattern (for the examples, we used chess5x7x0.03) and glue it to a flat object. It is very important that the calibration pattern is very flat. Also, check with a caliper that the distance between the features of the printed pattern is correct. Sometimes printers scale the document, and the calibration won't work. For the mentioned pattern, the distance between intersections of black and white corners should be 3cm exactly.
- Get two tripods, one for holding the calibration pattern, and another one for holding the kinect2 sensor. Ideally, the tripod for the kinect2 will have a ball head, to allow you to move it easily and lock it in place before you take an image. It is very important that the sensor is stable (and the image is clear and not blurred) before you take an image. The tripod will specially help you to make sure that the sensor has not moved between the moment the IR and the RGB images are taken.
- When recording images for all the steps indicated below (RGB, IR, SYNC), start the recording program, then press spacebar to record each image. The calibration pattern should be detected (indicated by color lines overlayed on the calibration pattern), and the image should be clear and stable.
- It is recommended to take images that show the calibration pattern in all areas of the image, and with different orientations of the pattern (tilting the pattern relative to the plane of the image), and at least two distances. So you can easily reach 100 images per calibration set.
- We normally start at a short distance, where the calibration pattern covers most of the image, there we take several pictures tilting the calibration pattern vertically, then horizontally. Imagine a ray coming out of the camera sensor, this makes sure that you have images where the calibration pattern is not perpendicular to that ray.
- Then we move the calibration pattern further away, and for different orientations (tilting) of the pattern, we take many images so that we calibration pattern is present around most of the camera image. For example, at first the calibration pattern is on the left upper corner. Then on the next image on the upper middle, then on the upper right corner. Then some images where the calibration pattern is in the middle vertically, etc...

*Typical calibration setup*
![kinect2_calibration_setup_small.jpg](https://ai.uni-bremen.de/_media/kinect2_calibration_setup_small.jpg)

*Detailed steps:*

0. If you haven't already, start the kinect2_bridge with a low number of frames per second (to make it easy on your CPU): `rosrun kinect2_bridge kinect2_bridge _fps_limit:=2`
1. create a directory for your calibration data files, for example: `mkdir ~/kinect_cal_data; cd ~/kinect_cal_data`
2. Record images for the color camera: `rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 record color`
3. Calibrate the intrinsics: `rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 calibrate color`
4. Record images for the ir camera: `rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 record ir`
5. Calibrate the intrinsics of the ir camera: `rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 calibrate ir`
6. Record images on both cameras synchronized: `rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 record sync`
7. Calibrate the extrinsics: `rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 calibrate sync`
8. Calibrate the depth measurements: `rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 calibrate depth`
9. Find out the serial number of your kinect2 by looking at the first lines printed out by the kinect2_bridge. The line looks like this:
  `device serial: 012526541941`
10. Create the calibration results directory in kinect2_bridge/data/$serial: `roscd kinect2_bridge/data; mkdir 012526541941`
11. Copy the following files from your calibration directory (~/kinect_cal_data) into the directory you just created: `calib_color.yaml  calib_depth.yaml  calib_ir.yaml  calib_pose.yaml`
12. Restart the kinect2_bridge and be amazed at the better data.

## Calibration of the depth measurements

I did some tests on the measured and the computed distance based on the detected chess board. It seems like the Kinect2 (or at least the Kinect2s I am using) has a static offset of around 24 mm. As shown in the following images, one can see, that the difference between measured and computed distance is unrelated to the x and y coordinates of the pixel and also unrelated to the distance.

![plot.png](http://ai.uni-bremen.de/wiki/_media/software/plot.png)
![plot_x.png](http://ai.uni-bremen.de/wiki/_media/software/plot_x.png)
![plot_y.png](http://ai.uni-bremen.de/wiki/_media/software/plot_y.png)
![plot_xy.png](http://ai.uni-bremen.de/wiki/_media/software/plot_xy.png)

For the images above ~400 images of a 4x5x0.03 chessboard in different orientations, distances and image positions were used. The code for computing the depth offset is added to the calibration tool.

### GNUPlot

The depth calibration creates a file named `plot.dat` inside the calibration folder. This files contains the results of the calibration in 5 columns: x, y, computed depth, measured depth, difference between computed and measured depth.

- Difference between measured/computed distance

```
set xlabel "Measured distance"
set ylabel "Computed distance"
plot 'plot.dat' using 3:4 with dots title "Difference between measured/computed distance"
```

- Difference relative to x coordinate

```
set xlabel "X"
set ylabel "Distance difference"
plot 'plot.dat' using 1:5 with dots title "Difference relative to X-coordinate"
```

- Difference relative to y coordinate

```
set xlabel "Y"
set ylabel "Distance difference"
plot 'plot.dat' using 2:5 with dots title "Difference relative to Y-coordinate"
```

- Difference relative to XY-coordinate

```
set xlabel "X"
set ylabel "Y"
set zlabel "Distance difference"
splot 'plot.dat' using 1:2:5 with dots palette title "Difference relative to XY-coordinate"
```

## Example results

Example calibration results can be found in the directory [kinect2_bridge/data/](../kinect2_bridge/data).

The following images were made before and after the calibration, using the kinect2 viewer.
 - For the superimposed images: `rosrun kinect2_viewer kinect2_viewer hd image`
 - For the point cloud images: `rosrun kinect2_viewer kinect2_viewer hd cloud`
 - For the superimposed and point cloud images: `rosrun kinect2_viewer kinect2_viewer hd both`

raw here stands for raw data transmission aka uncompressed.

Uncalibrated rectified images (depth and RGB superimposed):
![kinect2_cloud_calib](https://ai.uni-bremen.de/_media/kinect2_raw_nocalib.png)

Calibrated rectified images (depth and RGB superimposed):
![kinect2_cloud_calib](https://ai.uni-bremen.de/_media/kinect2_raw_calib.png)

Uncalibrated depth cloud:
![kinect2_cloud_calib](https://ai.uni-bremen.de/_media/kinect2_cloud_nocalib.png)

Calibrated depth cloud:
![kinect2_cloud_calib](https://ai.uni-bremen.de/_media/kinect2_cloud_calib.png)

Note how the color is now correctly applied on the depth data. This is specially evident around strong edges, like the edge of the white column on the left.


text:
require 'logger'
require 'time'
require 'cgi'
require 'uri'
require 'net/http'
require 'base64'
require 'openssl'
require 'rexml/document'
require 'rexml/xpath'

require 'aws_sdb'

domain = "FreeBase_Names_Guide"

# Amazon Elastic MapReduce will always have a /home/hadoop/conf/hadoop-site.xml file. One of
# of the configuration values in that file is your Amazon account key and secret.

file = File.read('/home/hadoop/conf/hadoop-site.xml')
xml = REXML::Document.new(file)

secret = xml.elements['/configuration/property[name="fs.s3n.awsSecretAccessKey"]'].elements['value'].text
key = xml.elements['/configuration/property[name="fs.s3n.awsAccessKeyId"]'].elements['value'].text

options = {}
options[:access_key_id] = key
options[:secret_access_key] = secret

sdb = AwsSdb::Service.new(options)

# create our domain; this is causes one more network hit than we need, but it saves us from making an extra installer; since we are batch processing it's OK
sdb.create_domain(domain)

STDIN.each_line do |line|

  # we are only going to have 2 words - the name and the id
  words = line.chomp.split(/\t/)

  if (words.size >= 2)

    name = words[0]
    id = words[1]

    # this will indicate whether we were successful writing to SimpleDB or not
    success = false

    # we will sleep and retry a few times before giving up
    decay = 0
    decay_max = 10

    while success == false

        # we may get a failure when trying to write to SimpleDB; we will use a simple back-off algorithm to try
        # again a few times

        begin

          # put this into SimpleDB, we don't care about dubes since we are using replaceable attributes
          attributes = {}
          attributes["Name"] = name

          sdb.put_attributes(domain, id, attributes)

          # if we got here, we were successful so exit our loop
          success = true

        rescue

          # if there was an error, wait a little bit of time and then try again; eventually
          # we will just give up
          if (decay < decay_max)

            decay += 1
            sleep(decay)

          else

            # at this point just give up, something must just be wrong
            success = true

          end
        end
    end
  end

end


text:
using System;
using System.Collections.Generic;
using PatientManagement.Administration;
using PatientManagement.Web.Modules.PatientManagement.Notifications;
using Serenity.Abstractions;
using Serenity.Reporting;
using Serenity.Web;

namespace PatientManagement.PatientManagement.Endpoints
{
    using Serenity;
    using Serenity.Data;
    using Serenity.Services;
    using System.Data;
    using Microsoft.AspNetCore.Mvc;
    using MyRepository = Repositories.NotificationsRepository;
    using MyRow = Entities.NotificationsRow;

    [Route("Services/PatientManagement/Notifications/[action]")]
    [ConnectionKey(typeof(MyRow)), ServiceAuthorize(typeof(MyRow))]
    public class NotificationsController : ServiceEndpoint
    {
        [HttpPost, AuthorizeCreate(typeof(MyRow))]
        public SaveResponse Create(IUnitOfWork uow, SaveRequest<MyRow> request)
        {
            return new MyRepository().Create(uow, request);
        }

        [HttpPost, AuthorizeUpdate(typeof(MyRow))]
        public SaveResponse Update(IUnitOfWork uow, SaveRequest<MyRow> request)
        {
            return new MyRepository().Update(uow, request);
        }

        [HttpPost]
        public SaveResponse MarkAsSeen(IUnitOfWork uow, SaveRequest<MyRow> request)
        {
            return new MyRepository().MarkAsSeen(uow, request);
        }

        [HttpPost, AuthorizeDelete(typeof(MyRow))]
        public DeleteResponse Delete(IUnitOfWork uow, DeleteRequest request)
        {
            return new MyRepository().Delete(uow, request);
        }

        public RetrieveResponse<MyRow> Retrieve(IDbConnection connection, RetrieveRequest request)
        {
            return new MyRepository().Retrieve(connection, request);
        }

        public ListResponse<MyRow> List(IDbConnection connection, ListRequest request)
        {
            return new MyRepository().List(connection, request);
        }
        public ListResponse<MyRow> ListForDropdown(IDbConnection connection, ListRequest request)
        {
            return new MyRepository().ListForDropdown(connection, request);

        }
        public CountNotificationsResponse CountNotifications(IDbConnection connection, ListRequest request)
        {
            var some = new MyRepository().ListForDropdown(connection, request);
            return new CountNotificationsResponse
            {

                Count = some.Entities.Count
            };
        }

        public FileContentResult ListExcel(IDbConnection connection, ListRequest request)
        {
            var data = List(connection, request).Entities;
            var report = new DynamicDataReport(data, request.IncludeColumns, typeof(Columns.NotificationsColumns));
            var bytes = new ReportRepository().Render(report);
            return ExcelContentResult.Create(bytes, "PaymentList_" +
                                                    DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".xlsx");
        }
    }

    public class CountNotificationsRequest : ServiceRequest
    {
        public decimal Count { get; set; }
    }
    public class CountNotificationsResponse : ServiceResponse
    {
        public int Count { get; set; }
    }

}


text:
states = ['position', 'direction', 'speed', 'treasure', 'color']
brains = ['treasure_guard']


text:
phonenumbers Python Library
===========================

This is a Python port of [libphonenumber](https://github.com/googlei18n/libphonenumber).

Original Java code is Copyright (C) 2009-2016 The Libphonenumber Authors

Manual phonenumbers Installation
--------------------------------

Install using `setup.py`:

```console
$ tar xfz phonenumbers-<version>.tar.gz
$ cd phonenumbers-<version>
$ python setup.py build
$ sudo python setup.py install  # or su first
```

Running Tests
-------------

With phonenumbers on the Python path, run:

```console
$ python -m testwrapper
```

Auto-Generating Python Code
---------------------------

Several subdirectories under `python/phonenumbers` are automatically generated
from the master metadata under `resources/`:

 - `python/phonenumbers/data` is generated from `resources/PhoneNumberMetadata.xml`.
 - `python/phonenumbers/shortdata` is generated from `resources/ShortNumberMetadata.xml`.
 - `python/phonenumbers/geodata` is generated from files under `resources/geocoding/`.
 - `python/phonenumbers/carrierdata` is generated from files under `resources/carrier/`.
 - `python/phonenumbers/tzdata` is generated from files under `resources/timezones/`.

The script `tools/buildmetadatafromxml.py` performs the first pair of autogenerations.
The script `tools/buildprefixdata.py` performs the latter 3 sets of autogenerations.

This approach results in a large set of Python files, but makes it easy
to apply local fixes to the formatting metadata.

The `phonenumberslite` version of the package does not include the prefix-based
metadata (in order to reduce package size), so `phonenumbers.geodata`,
`phonenumbers.carrierdata` and `phonenumbers.tzdata` are all unavailable with this
version.

Library Developer Internals
---------------------------

The Python code is derived from the original Java code, and
mostly sticks to the structure of that code to make it easier
to include future changes to the upstream code.

However, there are a number of differences:
 - Naming conventions are converted to Python standards; in
   particular, method names are `connected_with_underscores`
   rather than `beingInCamelCase`.
 - The `PhoneNumber` and `PhoneMetadata` classes are written by hand
   based on the Java code and the protocol buffer definitions,
   rather than by using the the Python protocol buffer library.
   This makes the mapping to the Java code easier to follow, and
   allows for the custom modifications that have been made to
   the base protocol buffer.  Attribute values of `None` are used
   to indicate that a particular (optional) attribute is not
   present (instead of `hasAttribute()` methods).
 - The Java `PhoneNumberUtil` class was a singleton, and so its
   contents are included at the top level in `phonenumberutil.py`.
   Static methods from the `PhoneNumberUtil` class thus become
   functions in `phonenumberutil.py`; private and package methods
   get a leading underscore in their name.
 - Accessor functions (`setAttribute()` and `getAttribute()` are
   avoided, and direct access to attributes is used instead.
 - Methods named `get_something_from(object)` are typically renamed
   to `something_from(object)`.
 - The `format()` methods in `PhoneNumberUtil` were renamed to
   `format_number()` to avoid clashing with the Python built-in
   `format()`.
 - The internals of `phonenumberutil.py` do not have logging.
 - The Python version is less concerned with speed and size
   optimization than the Java version (as Python code is more likely
   to run on a server platform, and less likely to run on an
   embedded/smartphone platform).

Much of the functionality of this library depends on regular
expressions, so it's worth highlighting the translation between
Java and Python regexps:
 - Java replacement group references are `"$1 $2"` etc, Python's are
   `"\1 \2"` etc.
 - Java `Matcher(x).lookingAt()` translates to Python `re_obj.match(x)`.
 - Java `Matcher(x).find()` translates to Python `m = re.search(x)`.
 - Java `Matcher(x).matches()` translates to Python `m = re_obj.match(x)`
   together with a check that `m.end() == len(x)`.
The last of these is encapsulated in the `fullmatch()` function in
`re_util.py`.

Some other mappings between the Java and Python versions:

|Java                                      | Python                                     |
|------------------------------------------|--------------------------------------------|
|`countryCallingCodeToRegionCodeMap`       |`COUNTRY_CODE_TO_REGION_CODE`               |
|`getSupportedRegions()`                   |N/A                                         |
|`supportedRegions`                        |`SUPPORTED_REGIONS`                         |
|`getSupportedGlobalNetworkCallingCodes()` |N/A                                         |
|`countryCodesForNonGeographicalRegions`   |`COUNTRY_CODES_FOR_NON_GEO_REGIONS`         |
|`getMetadataForNonGeographicalRegion()`   |`PhoneMetadata.metadata_for_nongeo_region()`|

Release Procedure
-----------------

 - Ensure that `python/HISTORY` file is up-to-date, and includes
   descriptions of changes in this version (adapted from the
   upstream [release notes](https://github.com/googlei18n/libphonenumber/blob/master/java/release_notes.txt),
   skipping the metadata changes chunks).
 - Set the `__version__` field in `python/phonenumbers/__init__.py`
 - Check that the list of symbols in `python/phonenumbers/__init__.py` `__all__` is
   up to date.  The `tools/python/allcheck.py` script helps with this.
 - Optionally, force metadata regeneration:
     `cd tools/python && make metaclean alldata`
 - Check that the unit tests all run successfully:
     `cd tools/python && make test`
 - Optionally, check that metadata regeneration works in Py3k:
     `cd tools/python && make PYTHON=python3 metaclean alldata`
 - Check that the unit tests all run successfully in Py3k:
     `cd tools/python && make PYTHON=python3 test`
 - Check that Python 2.5 is still supported:
     `cd tools/python && make PYTHON=python2.5 test`
 - Create a release-<version> tag:
     `git tag release-<version>`
 - Push the tag to Github with:
     `git push <github-remote> release-<version>`
 - Push the package to PyPI with:
     `cd python && setup.py sdist bdist_wheel upload`
 - Push the lite package to PyPI with:
     `cd python && setup.py lite sdist bdist_wheel upload`


text:
slider
======

example project

***test***


text:
/**
 * This file is generated with Kurento ktool-rom-processor.
 * Please don't edit. Changes should go to kms-interface-rom and
 * ktool-rom-processor templates.
 */
package org.kurento.client;

/**
 *
 * Event raised when the stream that the element sends out is finished.
 *
 **/
public class EndOfStreamEvent extends MediaEvent {

/**
 *
 * Event raised when the stream that the element sends out is finished.
 *
 * @param source
 *       Object that raised the event
 * @param timestamp
 *
 * @param tags
 *
 * @param type
 *       Type of event that was raised
 *
 **/
  public EndOfStreamEvent(@org.kurento.client.internal.server.Param("source") org.kurento.client.MediaObject source, @org.kurento.client.internal.server.Param("timestamp") String timestamp, @org.kurento.client.internal.server.Param("tags") java.util.List<org.kurento.client.Tag> tags, @org.kurento.client.internal.server.Param("type") String type) {
    super(source, timestamp, tags, type);
  }

}


text:
'use strict';

/**
 * Module dependencies.
 */
var mongoose = require('mongoose'),
    passport = require('passport');
    // logger = require('mean-logger');

/**
 * Main application entry file.
 * Please note that the order of loading is important.
 */

// Initializing system variables
var config = require('./server/config/config');
var app = {};
var db = mongoose.connect(config.db, function(err) {
    if (err) {
	console.error('Error:', err.message);
	return console.error('**Could not connect to MongoDB. Please ensure mongod is running and restart MEAN app.**');
    }

    // Bootstrap Models, Dependencies, Routes and the app as an express app
    app = require('./server/config/system/bootstrap')(passport, db);

    // // Start the app by listening on <port>, optional hostname
    // var io = require('socket.io')(app.listen(config.port, config.hostname));

    console.log('MEAN app started on port ' + config.port + ' (' + process.env.NODE_ENV + ')');

    // Initializing logger
    // logger.init(app, passport, mongoose);
});

// Expose app
exports = module.exports = app;


text:
package unversioned

import (
	"k8s.io/kubernetes/pkg/api"
	"k8s.io/kubernetes/pkg/apis/batch"
	"k8s.io/kubernetes/pkg/watch"
)

// ScheduledJobsNamespacer has methods to work with ScheduledJob resources in a namespace
type ScheduledJobsNamespacer interface {
	ScheduledJobs(namespace string) ScheduledJobInterface
}

// ScheduledJobInterface exposes methods to work on ScheduledJob resources.
type ScheduledJobInterface interface {
	List(opts api.ListOptions) (*batch.ScheduledJobList, error)
	Get(name string) (*batch.ScheduledJob, error)
	Create(scheduledJob *batch.ScheduledJob) (*batch.ScheduledJob, error)
	Update(scheduledJob *batch.ScheduledJob) (*batch.ScheduledJob, error)
	Delete(name string, options *api.DeleteOptions) error
	Watch(opts api.ListOptions) (watch.Interface, error)
	UpdateStatus(scheduledJob *batch.ScheduledJob) (*batch.ScheduledJob, error)
}

// scheduledJobs implements ScheduledJobsNamespacer interface
type scheduledJobs struct {
	r  *BatchClient
	ns string
}

// newScheduledJobs returns a scheduledJobs
func newScheduledJobs(c *BatchClient, namespace string) *scheduledJobs {
	return &scheduledJobs{c, namespace}
}

// Ensure statically that scheduledJobs implements ScheduledJobInterface.
var _ ScheduledJobInterface = &scheduledJobs{}

// List returns a list of scheduled jobs that match the label and field selectors.
func (c *scheduledJobs) List(opts api.ListOptions) (result *batch.ScheduledJobList, err error) {
	result = &batch.ScheduledJobList{}
	err = c.r.Get().Namespace(c.ns).Resource("scheduledjobs").VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
	return
}

// Get returns information about a particular scheduled job.
func (c *scheduledJobs) Get(name string) (result *batch.ScheduledJob, err error) {
	result = &batch.ScheduledJob{}
	err = c.r.Get().Namespace(c.ns).Resource("scheduledjobs").Name(name).Do().Into(result)
	return
}

// Create creates a new scheduled job.
func (c *scheduledJobs) Create(job *batch.ScheduledJob) (result *batch.ScheduledJob, err error) {
	result = &batch.ScheduledJob{}
	err = c.r.Post().Namespace(c.ns).Resource("scheduledjobs").Body(job).Do().Into(result)
	return
}

// Update updates an existing scheduled job.
func (c *scheduledJobs) Update(job *batch.ScheduledJob) (result *batch.ScheduledJob, err error) {
	result = &batch.ScheduledJob{}
	err = c.r.Put().Namespace(c.ns).Resource("scheduledjobs").Name(job.Name).Body(job).Do().Into(result)
	return
}

// Delete deletes a scheduled job, returns error if one occurs.
func (c *scheduledJobs) Delete(name string, options *api.DeleteOptions) (err error) {
	return c.r.Delete().Namespace(c.ns).Resource("scheduledjobs").Name(name).Body(options).Do().Error()
}

// Watch returns a watch.Interface that watches the requested scheduled jobs.
func (c *scheduledJobs) Watch(opts api.ListOptions) (watch.Interface, error) {
	return c.r.Get().
		Prefix("watch").
		Namespace(c.ns).
		Resource("scheduledjobs").
		VersionedParams(&opts, api.ParameterCodec).
		Watch()
}

// UpdateStatus takes the name of the scheduled job and the new status.  Returns the server's representation of the scheduled job, and an error, if it occurs.
func (c *scheduledJobs) UpdateStatus(job *batch.ScheduledJob) (result *batch.ScheduledJob, err error) {
	result = &batch.ScheduledJob{}
	err = c.r.Put().Namespace(c.ns).Resource("scheduledjobs").Name(job.Name).SubResource("status").Body(job).Do().Into(result)
	return
}


text:
package org.kuali.coeus.propdev.impl.s2s;

import org.apache.commons.lang3.StringUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.upload.FormFile;
import org.kuali.coeus.propdev.api.s2s.UserAttachedFormService;
import org.kuali.coeus.propdev.impl.core.DevelopmentProposal;
import org.kuali.coeus.propdev.impl.core.ProposalDevelopmentAction;
import org.kuali.coeus.propdev.impl.core.ProposalDevelopmentDocument;
import org.kuali.coeus.propdev.impl.core.ProposalDevelopmentForm;
import org.kuali.coeus.propdev.impl.s2s.connect.S2sCommunicationException;
import org.kuali.coeus.sys.framework.controller.StrutsConfirmation;
import org.kuali.coeus.sys.framework.service.KcServiceLocator;
import org.kuali.kra.infrastructure.Constants;
import org.kuali.kra.infrastructure.KeyConstants;
import org.kuali.coeus.propdev.impl.hierarchy.ProposalHierarchyException;
import org.kuali.coeus.s2sgen.api.core.S2SException;
import org.kuali.coeus.propdev.api.s2s.S2sOppFormsContract;
import org.kuali.coeus.propdev.api.s2s.S2sUserAttachedFormAttFileContract;
import org.kuali.coeus.propdev.api.s2s.S2sUserAttachedFormFileContract;
import org.kuali.rice.krad.util.GlobalVariables;
import org.kuali.rice.krad.util.KRADConstants;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;

import static org.kuali.kra.infrastructure.KeyConstants.QUESTION_DELETE_OPPORTUNITY_CONFIRMATION;
import static org.kuali.rice.krad.util.KRADConstants.QUESTION_INST_ATTRIBUTE_NAME;

public class ProposalDevelopmentGrantsGovAction extends ProposalDevelopmentAction {
    private static final String CONFIRM_REMOVE_OPPRTUNITY_KEY = "confirmRemoveOpportunity";
    private static final String EMPTY_STRING = "";
    private static final String CONTENT_TYPE_XML = "text/xml";
    private static final String XML_FILE_EXTENSION = "xml";
    private static final String CONTENT_TYPE_PDF = "application/pdf";

    private S2sSubmissionService s2sSubmissionService;
    private S2sUserAttachedFormService s2SUserAttachedFormService;
    private UserAttachedFormService userAttachedFormService;

	/**
     *
     * @see org.kuali.coeus.propdev.impl.core.ProposalDevelopmentAction#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
     */
    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response)throws Exception{
        ProposalDevelopmentForm proposalDevelopmentForm = (ProposalDevelopmentForm) form;
        ProposalDevelopmentDocument proposalDevelopmentDocument = (ProposalDevelopmentDocument)proposalDevelopmentForm.getDocument();

        // In a Hierarchy Child, the G.g tab is disabled, so this exception should only happen if the app is being hacked.
        DevelopmentProposal developmentProposal = proposalDevelopmentDocument.getDevelopmentProposal();
        if (developmentProposal.isChild()) throw new ProposalHierarchyException("Cannot perform Grants.gov tasks on a Proposal Hierarchy child");

        if(developmentProposal.getS2sOpportunity()!=null){
                proposalDevelopmentForm.setGrantsGovSelectFlag(true);
            if(developmentProposal.getS2sOpportunity().getProposalNumber()==null){
                developmentProposal.getS2sOpportunity().setDevelopmentProposal(developmentProposal);
            }
            if(developmentProposal.getS2sOpportunity().getOpportunityId()!=null){
                developmentProposal.setProgramAnnouncementNumber(developmentProposal.getS2sOpportunity().getOpportunityId());
            }
            if(developmentProposal.getS2sOpportunity().getOpportunityTitle()!=null){
                developmentProposal.setProgramAnnouncementTitle(developmentProposal.getS2sOpportunity().getOpportunityTitle());
            }
            if(developmentProposal.getS2sOpportunity().getCfdaNumber()!=null){
                developmentProposal.setCfdaNumber(developmentProposal.getS2sOpportunity().getCfdaNumber());
            }
        }
        ActionForward actionForward = super.execute(mapping, form, request, response);
        return actionForward;
    }

    /**
     * Upon returning from Grants.gov lookup, this method gets called. It uses the schemaUrl returned from
     * lookup to retrieve the forms associated with the opportunity
     * @see org.kuali.rice.kns.web.struts.action.KualiDocumentActionBase#refresh(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
     */
    @Override
    public ActionForward refresh(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        super.refresh(mapping, form, request, response);
        ProposalDevelopmentForm proposalDevelopmentForm = (ProposalDevelopmentForm) form;
        ProposalDevelopmentDocument proposalDevelopmentDocument = proposalDevelopmentForm.getProposalDevelopmentDocument();
        Boolean mandatoryFormNotAvailable = false;
        List<S2sOppForms> s2sOppForms = new ArrayList<>();

        DevelopmentProposal developmentProposal = proposalDevelopmentDocument.getDevelopmentProposal();
        if(proposalDevelopmentForm.getNewS2sOpportunity() != null
                && StringUtils.isNotEmpty(proposalDevelopmentForm.getNewS2sOpportunity().getOpportunityId())) {
            developmentProposal.setS2sOpportunity(proposalDevelopmentForm.getNewS2sOpportunity());
            proposalDevelopmentForm.setNewS2sOpportunity(new S2sOpportunity());
        }

        S2sOpportunity s2sOpportunity = developmentProposal.getS2sOpportunity();
        s2sOpportunity.setDevelopmentProposal(developmentProposal);
        try {
            List<String> mandatoryForms = new ArrayList<String>();
            if (s2sOpportunity != null && s2sOpportunity.getSchemaUrl() != null) {
                s2sOppForms = getS2sSubmissionService().parseOpportunityForms(s2sOpportunity);
                if(s2sOppForms!=null){
                    for(S2sOppFormsContract s2sOppForm:s2sOppForms){
                        if(s2sOppForm.getMandatory() && !s2sOppForm.getAvailable()){
                            mandatoryFormNotAvailable = true;
                            mandatoryForms.add(s2sOppForm.getFormName());
//                            break;
                        }
                    }
                }
                if(!mandatoryFormNotAvailable){
                    s2sOpportunity.setS2sOppForms(s2sOppForms);
                    s2sOpportunity.setVersionNumber(proposalDevelopmentForm.getVersionNumberForS2sOpportunity());
                    proposalDevelopmentForm.setVersionNumberForS2sOpportunity(null);
                }else{
                    GlobalVariables.getMessageMap().putError(Constants.NO_FIELD, KeyConstants.ERROR_IF_OPPORTUNITY_ID_IS_INVALID,
                                        developmentProposal.getS2sOpportunity().getOpportunityId(),mandatoryForms.toString());
                    developmentProposal.setS2sOpportunity(new S2sOpportunity());
                }
            }
        }catch(S2sCommunicationException ex){
            if(ex.getErrorKey().equals(KeyConstants.ERROR_GRANTSGOV_NO_FORM_ELEMENT)) {
                ex.setMessage(s2sOpportunity.getOpportunityId());
            }
            if(ex.getTabErrorKey()!=null){
                GlobalVariables.getMessageMap().putError(ex.getTabErrorKey(), ex.getErrorKey(),ex.getMessageWithParams());
            }else{
                GlobalVariables.getMessageMap().putError(Constants.NO_FIELD, ex.getErrorKey(),ex.getMessageWithParams());
            }
            developmentProposal.setS2sOpportunity(new S2sOpportunity());
            return mapping.findForward(Constants.MAPPING_BASIC);
        }
        return mapping.findForward(Constants.MAPPING_BASIC);
    }

    /**
     *
     * This method removes/deletes an opportunity from the KRA tables; is called from removeOpportunity method
     * @param mapping
     * @param form
     * @param request
     * @param response
     * @return
     * @throws Exception
     */
    public ActionForward confirmRemoveOpportunity(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        Object question = request.getParameter(QUESTION_INST_ATTRIBUTE_NAME);
        if (CONFIRM_REMOVE_OPPRTUNITY_KEY.equals(question)) {
            ProposalDevelopmentForm proposalDevelopmentForm = (ProposalDevelopmentForm) form;
            ProposalDevelopmentDocument proposalDevelopmentDocument = (ProposalDevelopmentDocument)proposalDevelopmentForm.getDocument();
            proposalDevelopmentForm.setVersionNumberForS2sOpportunity(proposalDevelopmentDocument.getDevelopmentProposal().getS2sOpportunity().getVersionNumber());
            proposalDevelopmentDocument.getDevelopmentProposal().getS2sOpportunity().setS2sOppForms(null);
            proposalDevelopmentDocument.getDevelopmentProposal().setS2sOpportunity(null);
            proposalDevelopmentDocument.getDevelopmentProposal().setProgramAnnouncementNumber(null);
            proposalDevelopmentDocument.getDevelopmentProposal().setProgramAnnouncementTitle(null);
            proposalDevelopmentDocument.getDevelopmentProposal().setCfdaNumber(null);
        }
        return mapping.findForward(Constants.MAPPING_BASIC);
    }

    /**
     *
     * This method removes/deletes an opportunity from the KRA tables
     * @param mapping
     * @param form
     * @param request
     * @param response
     * @return
     * @throws Exception
     */
    public ActionForward removeOpportunity(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        return confirm(buildDeleteOpportunityConfirmationQuestion(mapping, form, request, response), CONFIRM_REMOVE_OPPRTUNITY_KEY, EMPTY_STRING);
    }

    /**
     *
     * This method builds a Opportunity Delete Confirmation Question as part of the Questions Framework
     * @param mapping
     * @param form
     * @param request
     * @param response
     * @return
     * @throws Exception
     */
    private StrutsConfirmation buildDeleteOpportunityConfirmationQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        ProposalDevelopmentForm proposalDevelopmentForm = (ProposalDevelopmentForm) form;
        ProposalDevelopmentDocument proposalDevelopmentDocument = (ProposalDevelopmentDocument)proposalDevelopmentForm.getDocument();
        String description = proposalDevelopmentDocument.getDevelopmentProposal().getS2sOpportunity().getOpportunityId();
        return buildParameterizedConfirmationQuestion(mapping, form, request, response, CONFIRM_REMOVE_OPPRTUNITY_KEY, QUESTION_DELETE_OPPORTUNITY_CONFIRMATION, description);
    }

    /**
     *
     * This method is called to print forms
     * @param mapping
     * @param form
     * @param request
     * @param response
     * @return
     * @throws Exception
     */
    public ActionForward printForms(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        return super.printForms(mapping, form, request, response);
    }

    public ActionForward refreshSubmissionDetails(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        ProposalDevelopmentForm proposalDevelopmentForm = (ProposalDevelopmentForm) form;
        ProposalDevelopmentDocument proposalDevelopmentDocument = (ProposalDevelopmentDocument)proposalDevelopmentForm.getDocument();
        try{
            if(getS2sSubmissionService().refreshGrantsGov(proposalDevelopmentDocument)){
                proposalDevelopmentDocument.getDevelopmentProposal().refreshReferenceObject("s2sAppSubmission");
                return mapping.findForward(Constants.MAPPING_BASIC);
            }else{
                throw new RuntimeException("Refresh Failed");
            }
        }catch(S2sCommunicationException ex){
            GlobalVariables.getMessageMap().putError(Constants.NO_FIELD, ex.getErrorKey(),ex.getMessage());
            return mapping.findForward(Constants.MAPPING_BASIC);
        }
    }

    public ActionForward performLookup(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        ProposalDevelopmentForm proposalDevelopmentForm = (ProposalDevelopmentForm) form;
        ProposalDevelopmentDocument proposalDevelopmentDocument = (ProposalDevelopmentDocument)proposalDevelopmentForm.getDocument();
        if(proposalDevelopmentDocument.getDevelopmentProposal().getS2sOpportunity()!=null && proposalDevelopmentForm.getVersionNumberForS2sOpportunity()==null){
            proposalDevelopmentForm.setVersionNumberForS2sOpportunity(proposalDevelopmentDocument.getDevelopmentProposal().getS2sOpportunity().getVersionNumber());
        }
        return super.performLookup(mapping, form, request, response);
    }

    @Override
    public ActionForward save(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        final ProposalDevelopmentForm proposalDevelopmentForm = (ProposalDevelopmentForm) form;
        final ProposalDevelopmentDocument proposalDevelopmentDocument = proposalDevelopmentForm.getProposalDevelopmentDocument();

        if (!((ProposalDevelopmentForm)form).isGrantsGovEnabled()) {
            GlobalVariables.getMessageMap().putWarning(Constants.NO_FIELD, KeyConstants.ERROR_IF_GRANTS_GOV_IS_DISABLED);
            return mapping.findForward(Constants.MAPPING_BASIC);
        }

        final String proposalTypeCodeRevision = this.getParameterService().getParameterValueAsString(ProposalDevelopmentDocument.class,
                KeyConstants.PROPOSALDEVELOPMENT_PROPOSALTYPE_REVISION);

        if(proposalDevelopmentDocument.getDevelopmentProposal().getS2sOpportunity()!= null && proposalDevelopmentDocument.getDevelopmentProposal().getS2sOpportunity().getOpportunityId()!= null &&
                StringUtils.equalsIgnoreCase(proposalDevelopmentDocument.getDevelopmentProposal().getProposalTypeCode(), proposalTypeCodeRevision) &&
                StringUtils.isBlank(proposalDevelopmentDocument.getDevelopmentProposal().getS2sOpportunity().getRevisionCode())) {
            GlobalVariables.getMessageMap().putError("document.developmentProposalList[0].s2sOpportunity.revisionCode", KeyConstants.ERROR_REQUIRED_REVISIONTYPE);
            return mapping.findForward(Constants.MAPPING_BASIC);
        }

        return super.save(mapping, form, request, response);
    }
    /**
     *
     * This method enable the ability to save the generated system to system XML
     * @param mapping
     * @param form
     * @param request
     * @param response
     * @return
     * @throws Exception
     */
    public ActionForward saveXml(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {

        ProposalDevelopmentForm proposalDevelopmentForm = (ProposalDevelopmentForm) form;
        ProposalDevelopmentDocument proposalDevelopmentDocument = (ProposalDevelopmentDocument)proposalDevelopmentForm.getDocument();
        proposalDevelopmentDocument.getDevelopmentProposal().setGrantsGovSelectFlag(true);
        proposalDevelopmentForm.setDocument(proposalDevelopmentDocument);
        return super.printForms(mapping, proposalDevelopmentForm, request, response);

    }

    /**
     *
     * This method enable the ability to save the generated system to system XML
     * @param mapping
     * @param form
     * @param request
     * @param response
     * @return
     * @throws Exception
     */
    public ActionForward addS2sUserAttachedForm(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        ProposalDevelopmentForm proposalDevelopmentForm = (ProposalDevelopmentForm) form;
        ProposalDevelopmentDocument proposalDevelopmentDocument = (ProposalDevelopmentDocument)proposalDevelopmentForm.getDocument();
        DevelopmentProposal developmentProposal = proposalDevelopmentDocument.getDevelopmentProposal();
        S2sUserAttachedForm newS2sUserAttachedForm = proposalDevelopmentForm.getNewS2sUserAttachedForm();
        FormFile userAttachedFormFile = newS2sUserAttachedForm.getNewFormFile();
        newS2sUserAttachedForm.setNewFormFileBytes(userAttachedFormFile.getFileData());
        newS2sUserAttachedForm.setFormFileName(userAttachedFormFile.getFileName());
        newS2sUserAttachedForm.setProposalNumber(developmentProposal.getProposalNumber());
        List<S2sUserAttachedForm> userAttachedForms = new ArrayList<S2sUserAttachedForm>();
        try{
            userAttachedForms = getS2SUserAttachedFormService().
                                                extractNSaveUserAttachedForms(developmentProposal,newS2sUserAttachedForm);
            developmentProposal.getS2sUserAttachedForms().addAll(userAttachedForms);
            proposalDevelopmentForm.setNewS2sUserAttachedForm(new S2sUserAttachedForm());
        }catch(S2SException ex){
            if(ex.getTabErrorKey()!=null){
                if(GlobalVariables.getMessageMap().getErrorMessagesForProperty(ex.getTabErrorKey())==null){
                    GlobalVariables.getMessageMap().putError(ex.getTabErrorKey(), ex.getErrorKey(),ex.getParams());
                }
            }else{
                GlobalVariables.getMessageMap().putError(Constants.NO_FIELD, ex.getErrorKey(),ex.getMessageWithParams());
            }
        }
        return mapping.findForward(Constants.MAPPING_BASIC);
    }

    /**
     *
     * This method enable the ability to save the generated system to system XML
     * @param mapping
     * @param form
     * @param request
     * @param response
     * @return
     * @throws Exception
     */
    public ActionForward viewUserAttachedFormXML(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        ProposalDevelopmentForm proposalDevelopmentForm = (ProposalDevelopmentForm) form;
        ProposalDevelopmentDocument proposalDevelopmentDocument = (ProposalDevelopmentDocument)proposalDevelopmentForm.getDocument();
        DevelopmentProposal developmentProposal = proposalDevelopmentDocument.getDevelopmentProposal();
        List<S2sUserAttachedForm> s2sAttachedForms = developmentProposal.getS2sUserAttachedForms();
        S2sUserAttachedForm selectedForm = s2sAttachedForms.get(getSelectedLine(request));

        S2sUserAttachedFormFileContract userAttachedFormFile = getUserAttachedFormService().findUserAttachedFormFile(selectedForm);
        if(userAttachedFormFile!=null){
            streamToResponse(userAttachedFormFile.getXmlFile().getBytes(), selectedForm.getFormName()+".xml", CONTENT_TYPE_XML, response);
        }else{
            return mapping.findForward(Constants.MAPPING_BASIC);
        }
        return null;
    }

    /**
     *
     * This method enable the ability to save the generated system to system XML
     * @param mapping
     * @param form
     * @param request
     * @param response
     * @return
     * @throws Exception
     */
    public ActionForward viewUserAttachedFormPdf(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        ProposalDevelopmentForm proposalDevelopmentForm = (ProposalDevelopmentForm) form;
        ProposalDevelopmentDocument proposalDevelopmentDocument = (ProposalDevelopmentDocument)proposalDevelopmentForm.getDocument();
        DevelopmentProposal developmentProposal = proposalDevelopmentDocument.getDevelopmentProposal();
        List<S2sUserAttachedForm> s2sAttachedForms = developmentProposal.getS2sUserAttachedForms();
        S2sUserAttachedForm selectedForm = s2sAttachedForms.get(getSelectedLine(request));
        S2sUserAttachedFormFileContract userAttachedFormFile = getUserAttachedFormService().findUserAttachedFormFile(selectedForm);
        if(userAttachedFormFile!=null){
            streamToResponse(userAttachedFormFile.getFormFile(), selectedForm.getFormFileName(), CONTENT_TYPE_PDF, response);
        }else{
            return mapping.findForward(Constants.MAPPING_BASIC);
        }
        return null;
    }
    /**
     *
     * This method enable the ability to save the generated system to system XML
     * @param mapping
     * @param form
     * @param request
     * @param response
     * @return
     * @throws Exception
     */
    public ActionForward viewUserAttachedFormAttachment(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        ProposalDevelopmentForm proposalDevelopmentForm = (ProposalDevelopmentForm) form;
        ProposalDevelopmentDocument proposalDevelopmentDocument = (ProposalDevelopmentDocument)proposalDevelopmentForm.getDocument();
        DevelopmentProposal developmentProposal = proposalDevelopmentDocument.getDevelopmentProposal();
        List<S2sUserAttachedForm> s2sAttachedForms = developmentProposal.getS2sUserAttachedForms();
        S2sUserAttachedForm selectedForm = s2sAttachedForms.get(getSelectedLine(request));
        S2sUserAttachedFormAtt attachment = selectedForm.getS2sUserAttachedFormAtts().get(getParameterForToken(request, "attIndex"));
        S2sUserAttachedFormAttFileContract userAttachedFormFile = getUserAttachedFormService().findUserAttachedFormAttFile(attachment);
        if(userAttachedFormFile!=null){
            streamToResponse(userAttachedFormFile.getAttachment(), attachment.getName(), attachment.getType(), response);
        }else{
            return mapping.findForward(Constants.MAPPING_BASIC);
        }

        return null;
    }
    protected int getParameterForToken(HttpServletRequest request,String token) {
        int selectedLine = -1;
        String parameterName = (String) request.getAttribute(KRADConstants.METHOD_TO_CALL_ATTRIBUTE);
        if (StringUtils.isNotBlank(parameterName)) {
            String lineNumber = StringUtils.substringBetween(parameterName, ("."+token), ".");
            if (StringUtils.isEmpty(lineNumber)) {
                return selectedLine;
            }
            selectedLine = Integer.parseInt(lineNumber);
        }

        return selectedLine;
    }

    /**
     *
     * This method enable the ability to save the generated system to system XML
     * @param mapping
     * @param form
     * @param request
     * @param response
     * @return
     * @throws Exception
     */
    public ActionForward deleteUserAttachedForm(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        ProposalDevelopmentForm proposalDevelopmentForm = (ProposalDevelopmentForm) form;
        ProposalDevelopmentDocument proposalDevelopmentDocument = (ProposalDevelopmentDocument)proposalDevelopmentForm.getDocument();
        DevelopmentProposal developmentProposal = proposalDevelopmentDocument.getDevelopmentProposal();
        S2sUserAttachedForm deleteForm = developmentProposal.getS2sUserAttachedForms().remove(getSelectedLine(request));
        getS2SUserAttachedFormService().resetFormAvailability(developmentProposal,deleteForm.getNamespace());
        return mapping.findForward(Constants.MAPPING_BASIC);
    }

    protected S2sUserAttachedFormService getS2SUserAttachedFormService() {
        if (s2SUserAttachedFormService == null)
            s2SUserAttachedFormService = KcServiceLocator.getService(S2sUserAttachedFormService.class);
        return s2SUserAttachedFormService;
    }

    protected UserAttachedFormService getUserAttachedFormService() {
        if (userAttachedFormService == null)
            userAttachedFormService = KcServiceLocator.getService(UserAttachedFormService.class);
        return userAttachedFormService;
    }

    protected S2sSubmissionService getS2sSubmissionService() {
        if (s2sSubmissionService == null)
            s2sSubmissionService = KcServiceLocator.getService(S2sSubmissionService.class);
        return s2sSubmissionService;
    }

}


text:
using System;
using Microsoft.Extensions.DependencyInjection.Extensions;
using NETCore.RedisKit;
using NETCore.RedisKit.Configuration;
using NETCore.RedisKit.Loging;
using NETCore.RedisKit.Infrastructure;
using NETCore.RedisKit.Services;

namespace Microsoft.Extensions.DependencyInjection
{
    public static class RedisKitServiceCollectionExtensions
    {
        /// <summary>
        /// Creates a builder.
        /// </summary>
        /// <param name="services">The services.</param>
        /// <param name="setUpAction">The setup action.</param>
        /// <param name="isShowLog">Is show log</param>
        /// <returns></returns>
        public static IRedisKitBuilder AddRedisKit(this IServiceCollection services, Action<RedisKitOptions> setUpAction)
        {
            var builder = new RedisKitBuilder(services);

            builder.Services.TryAddScoped<IRedisLogger, RedisLogger>();
            builder.Services.TryAddScoped<IRedisService, RedisService>();
            builder.Services.TryAddScoped<ISerializeService, DefaultJosnSerializeService>();

            builder.Services.Configure(setUpAction);

            builder.Services.TryAddSingleton<IRedisProvider, RedisProvider>();

            //add platform require servcies
            builder.AddRequiredPlatformServices();

            return builder;
        }
    }
}


text:
! { dg-do run }
! PR25697 Check that reading from a file that is at end-of-file does not
! segfault or give error.  Test case derived from example in PR from Dale Ranta.
! Contributed by Jerry DeLisle  <jvdelisle@gcc.gnu.org>
       integer data(9)
       do i = 1,9
         data(i)=-3
       enddo
       open(unit=11,status='scratch',form='unformatted')
       write(11)data
       read(11,end=        1000 )data
       call abort()
 1000  continue
       backspace 11
       backspace 11
       write(11)data
       rewind 11
       data = 0
       read(11,end=        1001 )data
 1001  continue
       read(11,end=        1002 )data
       call abort
 1002  continue
       if (.not. all(data == -3)) call abort()
       close(11)
       end


text:
import os,sys,glob,shutil

fullset = range(1,240)
outfiles = []
completednumbers = []
queueline = []
for file in glob.glob('reformatted*/jacob*'):
	completednumbers.append(int(file.split('.')[1].split('_')[1]))
redo = [int(i) for i in fullset]
redo3 = list(set(redo).difference(completednumbers))
str1 = ""
for n in redo3:
	str1 = str1 + "," + str(n)
print str1
dirnames = []

for d in dirnames:
	print d


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Mycena subinclinata Murrill

### Remarks
null


text:
{% extends "base.html" %}

{% block bodyclass %}edit{% endblock %}

{% block title %}{{ gettext('Edit - ') }}{{dataview.title}}{% endblock %}

{% block content %}

    {{ gettext("Edit your ") }}TimeMap

  <form class="js-dataview-edit form-horizontal" action="" method="POST">
    {% include 'dataview/form.html' %}

        <button type="submit" class="btn btn-primary js-submit">{{ gettext('Update') }} »</button>

  </form>

{% endblock %}

{% block extrabody %}

{% endblock %}


text:
namespace SLeek
{
    partial class frmPreferences
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.lbxPanes = new System.Windows.Forms.ListBox();
            this.pnlPanes = new System.Windows.Forms.Panel();
            this.btnOK = new System.Windows.Forms.Button();
            this.btnCancel = new System.Windows.Forms.Button();
            this.btnApply = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // lbxPanes
            //
            this.lbxPanes.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
            this.lbxPanes.IntegralHeight = false;
            this.lbxPanes.ItemHeight = 36;
            this.lbxPanes.Location = new System.Drawing.Point(12, 12);
            this.lbxPanes.Name = "lbxPanes";
            this.lbxPanes.Size = new System.Drawing.Size(128, 300);
            this.lbxPanes.TabIndex = 0;
            this.lbxPanes.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.lbxPanes_DrawItem);
            this.lbxPanes.SelectedIndexChanged += new System.EventHandler(this.lbxPanes_SelectedIndexChanged);
            //
            // pnlPanes
            //
            this.pnlPanes.Location = new System.Drawing.Point(146, 12);
            this.pnlPanes.Name = "pnlPanes";
            this.pnlPanes.Size = new System.Drawing.Size(344, 300);
            this.pnlPanes.TabIndex = 1;
            //
            // btnOK
            //
            this.btnOK.Location = new System.Drawing.Point(253, 318);
            this.btnOK.Name = "btnOK";
            this.btnOK.Size = new System.Drawing.Size(75, 23);
            this.btnOK.TabIndex = 2;
            this.btnOK.Text = "OK";
            this.btnOK.UseVisualStyleBackColor = true;
            this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
            //
            // btnCancel
            //
            this.btnCancel.Location = new System.Drawing.Point(334, 318);
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.Size = new System.Drawing.Size(75, 23);
            this.btnCancel.TabIndex = 3;
            this.btnCancel.Text = "Cancel";
            this.btnCancel.UseVisualStyleBackColor = true;
            this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
            //
            // btnApply
            //
            this.btnApply.Location = new System.Drawing.Point(415, 318);
            this.btnApply.Name = "btnApply";
            this.btnApply.Size = new System.Drawing.Size(75, 23);
            this.btnApply.TabIndex = 4;
            this.btnApply.Text = "Apply";
            this.btnApply.UseVisualStyleBackColor = true;
            this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
            //
            // frmPreferences
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(502, 353);
            this.Controls.Add(this.btnApply);
            this.Controls.Add(this.btnCancel);
            this.Controls.Add(this.btnOK);
            this.Controls.Add(this.pnlPanes);
            this.Controls.Add(this.lbxPanes);
            this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "frmPreferences";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "Preferences";
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.ListBox lbxPanes;
        private System.Windows.Forms.Panel pnlPanes;
        private System.Windows.Forms.Button btnOK;
        private System.Windows.Forms.Button btnCancel;
        private System.Windows.Forms.Button btnApply;
    }
}


text:
<?php
Class Config extends CActiveRecord{
	public $name;
	public $title;
	public $keywords;
	public $description;
	public $favicon;
	public $logo;
	public $copyright;
	public $tagline;
	public $phone;
	public $contact = array(
			'contact'=>array(
				'description'=>'',
				'address'=>'',
				'email'=>'',
				'skype'=>'',
				'mobile'=>'',
			),
	);
	public $facebook;
	public $twitter;

	public $inject_code;
	public $og_facebook;
	public $og_twitter;
	public $google_analytic;

	public $seoWebsite = array(
		'name','title','keywords','description','favicon','logo','logo','copyright','google_analytic','tagline','phone','contact','facebook','twitter',
	);

	public static function model($className=__CLASS__){
		return parent::model($className);
	}

	public function tableName(){
		return 'sb_config';
	}

	public function rules(){
		return array(
			array('name,title,logo','required'),
			array('keywords,description,copyright,google_analytic,favicon,inject_code,og_facebook,og_twitter,tagline,phone,facebook,twitter','safe')
		);
	}

	public function attributeLabels(){
		return array(
			'name'=>'Website name',
			'title'=>'Website title',
			'keywords'=>'Website keywords',
			'description'=>'Website description',
			'favicon'=>'Favicon',
			'logo'=>'Logo',
			'copyright'=>'Copyright',
			'google_analytic'=>'Google Analytic Code',
			'tagline'=>'Tag Line',
			'phone'=>'Contact Number',
		);
	}

	public function saveSeoWebsite($value){
		foreach($this->seoWebsite as $var){
			$DATA = $this::model()->find(
				array(
						'condition'=>'name=:name',
						'params'=>array(':name'=>$var)
					)
			);
			if(!empty($DATA)){
				if($var!='contact'){
					$DATA->value  = $value->{$var};
					$DATA->save(FALSE);
				}
			}
		}
		return TRUE;
	}

	public function saveContact($value){
		foreach($this->seoWebsite as $var){
			$DATA = $this::model()->find(
				array(
						'condition'=>'name=:name',
						'params'=>array(':name'=>'contact')
					)
			);

			$DATA->value  = $value;
			$DATA->save(FALSE);

		}
		return TRUE;
	}

	public function data(){
		$DATA =  $this::model()->findAll(array("order"=>'name ASC'));
		$WD = array();
		foreach($DATA as $value){
			$WD[$value->name] = $value->value;
		}
		foreach($WD as $key=>$val){
			$this->{$key} = $val;
		}
		return;
	}
}


text:
package net.smartcosmos.builder;

import com.google.common.base.Preconditions;
import net.smartcosmos.model.extension.ExtensionType;
import net.smartcosmos.model.extension.IExternalExtension;
import net.smartcosmos.pojo.extension.ExternalExtension;

/**
 * Convenience Builder pattern class for creating new {@link IExternalExtension} instances.
 *

 * The minimum fields required to define a new instance are:
 *

 *
{@link net.smartcosmos.Field#NAME_FIELD}

 *
{@link net.smartcosmos.Field#DESCRIPTION_FIELD}

 *
{@link net.smartcosmos.Field#LONG_DESCRIPTION_FIELD}

 *
{@link net.smartcosmos.Field#REDIRECT_URL_FIELD}

 *
{@link net.smartcosmos.Field#EXTENSION_TYPE_FIELD}

 *
{@link net.smartcosmos.Field#SUPPORT_EMAIL_FIELD}

 *
{@link net.smartcosmos.Field#WEB_SITE_FIELD}

 *

 */
public final class ExtensionBuilder extends AbstractNamedObjectBuilder<IExternalExtension, ExtensionBuilder>
{
    public ExtensionBuilder(String name)
    {
        super(new ExternalExtension());
        this.instance.setName(name);
    }

    public ExtensionBuilder setDescription(String description)
    {
        instance.setDescription(description);
        return this;
    }

    public ExtensionBuilder setLongDescription(String longDescription)
    {
        instance.setLongDescription(longDescription);
        return this;
    }

    public ExtensionBuilder setRedirectUrl(String redirectUrl)
    {
        instance.setRedirectUrl(redirectUrl);
        return this;
    }

    public ExtensionBuilder setExtensionType(ExtensionType extensionType)
    {
        instance.setExtensionType(extensionType);
        return this;
    }

    public ExtensionBuilder setSupportEmailAddress(String emailAddress)
    {
        instance.setSupportEmail(emailAddress);
        return this;
    }

    public ExtensionBuilder setWebSiteUrl(String webSitUrl)
    {
        instance.setWebSiteUrl(webSitUrl);
        return this;
    }

    @Override
    protected void onValidate()
    {
        Preconditions.checkNotNull(instance.getName(), "name must not be null");
        Preconditions.checkNotNull(instance.getDescription(), "description must not be null");
        Preconditions.checkNotNull(instance.getLongDescription(), "long description must not be null");
        Preconditions.checkNotNull(instance.getRedirectUrl(), "redirect url must not be null");
        Preconditions.checkNotNull(instance.getExtensionType(), "extension type must not be null");
        Preconditions.checkNotNull(instance.getSupportEmail(), "support email must not be null");
        Preconditions.checkNotNull(instance.getWebSiteUrl(), "web site url must not be null");
    }
}


text:
/**************************************************************************
*
* Mission.h
*
* Campaign mission manipulation routines
*
**************************************************************************/

#ifndef MISSION_H
#define MISSION_H

#include "F4Vu.h"
#include "CmpGlobl.h"
#include "campwp.h"

#define AMIS_TAKEOFF_DELAY	10			// Minimum wait til takeoff, in minutes

// ===================================================
// Mission defines
// ===================================================

// Mission defines for aircraft
enum MissionTypeEnum {        // NOTE: This must fit int a uchar!
       AMIS_NONE           = 0,
       AMIS_BARCAP         = 1,			// BARCAP missions to protect a target area
       AMIS_BARCAP2        = 2,			// BARCAP missions to defend a border
       AMIS_HAVCAP         = 3,
       AMIS_TARCAP         = 4,
       AMIS_RESCAP         = 5,
       AMIS_AMBUSHCAP      = 6,
       AMIS_SWEEP          = 7,
       AMIS_ALERT          = 8,
       AMIS_INTERCEPT      = 9,
       AMIS_ESCORT         = 10,
       AMIS_SEADSTRIKE     = 11,
       AMIS_SEADESCORT     = 12,
       AMIS_OCASTRIKE      = 13,			// OCA strike (direct w/escort & sead)
       AMIS_INTSTRIKE      = 14,			// Interdiction (direct, alone)
       AMIS_STRIKE         = 15,			//
       AMIS_DEEPSTRIKE     = 16,			// Deep strike (safe path, w/escort & sead)
       AMIS_STSTRIKE       = 17,			// Stealth strike (safe path, alone)
       AMIS_STRATBOMB      = 18,
       AMIS_FAC            = 19,
       AMIS_ONCALLCAS      = 20,			// On call CAS
       AMIS_PRPLANCAS      = 21,			// Pre planned CAS
       AMIS_CAS            = 22,			// Immediate CAS
       AMIS_SAD            = 23,			// Search and destroy interdiction
       AMIS_INT            = 24,			// Interdiction (vs supply/fuel lines only)
       AMIS_BAI            = 25,			// Battlefield area interdiction
       AMIS_AWACS          = 26,
       AMIS_JSTAR          = 27,
       AMIS_TANKER         = 28,
       AMIS_RECON          = 29,
       AMIS_BDA            = 30,
       AMIS_ECM            = 31,
       AMIS_AIRCAV         = 32,
       AMIS_AIRLIFT        = 33,
       AMIS_SAR            = 34,
       AMIS_ASW            = 35,
       AMIS_ASHIP          = 36,
       AMIS_PATROL         = 37,
       AMIS_RECONPATROL    = 38,			// Recon for enemy ground vehicles
       AMIS_ABORT          = 39,
       AMIS_TRAINING       = 40,
       AMIS_OTHER          = 41,
};

// Mission rolls
enum MissionRollEnum {
       ARO_CA              = 1,
       ARO_TACTRANS        = 2,     // AMIS_SAR | AMIS_AIRCAV
       ARO_S               = 3,     // AMIS_OCASTRIKE | AMIS_INTSTRIKE | 																// Strike target
       ARO_GA              = 4,     // AMIS_SAD | AMIS_BAI | AMIS_ONCALLCAS | AMIS_PRPLANCAS	 									// Ground attack
       ARO_SB              = 5,     // AMIS_STRATBOMB           																		// Strategic bomb
       ARO_ECM             = 6,     // AMIS_ELJAM           																				// Jam radar
       ARO_SEAD            = 7,     // AMIS_SEADSTRIKE | AMIS_SEADESCORT																// SEAD
       ARO_ASW             = 8,	   // AMIS_ASW
       ARO_ASHIP           = 9,     // AMIS_ASHIP
       ARO_REC             = 10,    // AMIS_BDA | AMIS_RECON | AMIS_PATROL																// Recon
       ARO_TRANS           = 11,    // AMIS_AIRBORNE | AMIS_AIRLIFT          														// Drop off cargo
       ARO_ELINT           = 12,    // AMIS_AWACS
       ARO_AWACS           = 12,
       ARO_JSTAR           = 13,    // AMIS_JSTAR
       ARO_TANK            = 14,    // AMIS_TANKER
       ARO_FAC             = 15,
       ARO_OTHER           = 16,
};

// Target Type
enum MissionTargetTypeEnum {
       AMIS_TAR_NONE       = 0,
       AMIS_TAR_OBJECTIVE  = 1,
       AMIS_TAR_UNIT       = 2,
       AMIS_TAR_LOCATION   = 3,
};

// Additional Escort condition modes (normally ATM_MODE_OCA, DCA or INT)
enum MissionEscortConditionEnum {
       AMIS_ESC_ALWAYS     = 99,
       AMIS_ESC_NONE       = 98,
};

// Tanker conditional modes
enum TankerConditionalModeEnum {
       TANKER_NONE         = 0,
       TANKER_HALF         = 1,
       TANKER_FULL         = 2,
       TANKER_ALWAYS       = 3,
};

// flags for mission data
enum MissionDataFlagEnum {
       AMIS_ADDAWACS       = 0x01,				// Request AWACS
       AMIS_ADDJSTAR       = 0x02,				// Request JSTAR
       AMIS_ADDECM         = 0x04,				// Request ECM
       AMIS_ADDBDA         = 0x08,				// Request BDA
       AMIS_ADDESCORT      = 0x10,				// Request CA Escort (if enemy responds)
       AMIS_ADDSEAD        = 0x20,				// Request SEAD Escort (if enemy AD present)
       AMIS_ADDBARCAP      = 0x40,				// Trigger enemy BARCAP
       AMIS_ADDSWEEP       = 0x80,				// Trigger enemy Sweep
       AMIS_ADDOCASTRIKE   = 0x100,				// Trigger friendly OCA Strike vs enemy assets found
       AMIS_ADDTANKER      = 0x200,				// Add a tanker, if possible
       AMIS_NEEDTANKER     = 0x400,				// This mission can't go w/o a tanker
       AMIS_ADDFAC         = 0x800,				// Request FAC aircraft
       AMIS_ADDINTERCEPT   = 0x1000,			// Add an enemy intercept mission to intercept this mission

       AMIS_NOTHREAT       = 0x2000,			// Abort if above the minimum threat threshold
       AMIS_AVOIDTHREAT    = 0x4000,			// Dodge ADs vertically
       AMIS_HIGHTHREAT     = 0x8000,			// Abort only if extreme threat
       AMIS_IMMEDIATE      = 0x10000,			// Set if I'm looking for aircraft in flight
       AMIS_MATCHSPEED     = 0x20000,			// Try to build package with equivalent speed a/c
       AMIS_TARGET_ONLY    = 0x40000,			// go directly to target and back
       AMIS_NO_BREAKPT     = 0x80000,			// Don't add a breakpoint to this mission
       AMIS_DONT_COORD     = 0x100000,			// Don't match ingress/egress times with the main flight
       AMIS_AIR_LAUNCH_OK  = 0x200000,			// This mission can launch in mid-air (ie: from the edge of the map)
       AMIS_DONT_USE_AC    = 0x400000,			// Don't subtract aircraft from the squadron
       AMIS_NPC_ONLY       = 0x800000,			// Don't assign to potential player squadrons
       AMIS_FUDGE_RANGE    = 0x1000000,		// This mission is always in range - we'll just load more fuel
       AMIS_EXPECT_DIVERT  = 0x2000000,		// We want to sit around until we're told to divert
       AMIS_ASSIGNED_TAR   = 0x4000000,		// Used for diverts with a specific target in mind
       AMIS_NO_DIST_BONUS  = 0x8000000,		// Don't adjust mission priority by distance to front (add a constant)
       AMIS_NO_TARGETABORT = 0x10000000,			// Don't abort after reaching our target - just fly home
       AMIS_FLYALWAYS      = 0x20000000,			// Don't restrict percentage of missions flown
       AMIS_HELP_REQUEST   = 0x40000000,		// 2001-10-27 S.G. It's from an help request
};

// Flags for mission requests
enum MissionRequestFlagEnum {
       REQF_USERESERVES    = 0x01,				// Use reserve aircraft for this request, if nessesary (mostly for support)
       REQF_CHECKED        = 0x02,				// This request has already been checked at least once
       REQF_NEEDRESPONSE   = 0x04,				// This needs to be dealt with immediately, and returns a response
       REQF_MET            = 0x08,				// This has been met already (in planned list)
       REQF_ONETRY         = 0x100,				// We get one try at building this, otherwise cancel
       REQF_USE_REQ_SQUAD  = 0x200,				// Use the squadron which requested the mission
       REQF_PART_OF_ACTION = 0x400,				// This target is part of a larger action by this team
       REQF_ALLOW_ERRORS   = 0x800,				// Allow missions to be planned with errors (for tactical engagement)
	   REQF_TE_MISSION	   = 0x1000,		    // This is a TE mission, correct mission length calculation mission.cpp
};

// Returned by TargetThreats
// Flags for what we really need
enum TargetThreatReturnFlagEnum {
       NEED_SEAD           = 0x01,
       NEED_ECM            = 0x02,

// Specifics as to the threat types
       THREAT_LALT_SAM     = 0x10,
       THREAT_HALT_SAM     = 0x20,
       THREAT_AAA          = 0x40,

// Specifics as to the threat location
       THREAT_ENROUTE      = 0x100,
       THREAT_TARGET       = 0x200,
};

// Mission profiles
enum MissionProfileEnum {
       MPROF_LOW           = 0x01,				// Low engress profile
       MPROF_HIGH          = 0x02,				// High engress profile
};

// Target area profiles
enum TargetAreaProfileEnum {
       TPROF_NONE          = 0,					// No target WP
       TPROF_ATTACK        = 1,					// IP, Target, Turn point  (Assembly, Break point)
       TPROF_HPATTACK      = 2,					// IP, Target (Assembly, Break point)
       TPROF_LOITER        = 3,					// 2 Turn points (Assembly)
       TPROF_TARGET        = 4,					// Target only (Assembly, Break point)
       TPROF_AVOID         = 5,					// Break point, Turn point (Assembly)
       TPROF_SWEEP         = 6,					// 3 circular Turn points
       TPROF_FLYBY         = 7,					// Pass over target, at lowest possible threat
       TPROF_SEARCH        = 8,					// Like loiter, but at full speed
       TPROF_LAND          = 9,					// Land at target for station time, then takeoff again
};

// Target desctiption types (when to use target actions)
enum TargetDescriptionType {
       TDESC_NONE          = 0,
       TDESC_TTL           = 1,					// Takeoff To Landing (mission actions during whole route)
       TDESC_ATA           = 2,					// Assembly To Assembly
       TDESC_TAO           = 3,					// Target Area Only
};

// Special time on target types
enum SpecialTOTTypeEnum {
       TOT_TAKEOFF         = 10,
       TOT_ENROUTE         = 11,
       TOT_INGRESS         = 12,
};

// Mission request contexts (Why this mission is being requested)
typedef enum {	noContext,						// We don't really know why
				enemyUnitAdvanceBridge,			// An enemy unit is advancing over a bridge
				enemyUnitMoveBridge,			// An enemy unit is moving over a bridge
				enemyUnitAdvance,				// An enemy unit is advancing
				enemyUnitMove,					// An enemy unit is moving
				enemyUnitAttacking,				// An enemy unit is attacking our forces
				enemyUnitDefending,				// An enemy unit is defending against our forces
				enemyForcesPresent,				// Enemy forces are suspected to be here
				attackEnemyUnit,				// FAC CALL: Attack specific enemy unit (8)
				emptyUnit1,						// TBD (9)
				emptyUnit2,						// TBD (10)
				friendlyUnitAirborneMovement,	// a friendly unit needs airborne transportation
				emptyUnit5,						// TBD (12)
				emptyUnit6,						// TBD (13)
				enemyStrikesExpected,			// Enemy air strikes expected in this area
				enemyAircraftPresent,			// Enemy aircraft are expected (generic) (15)
				enemyGroundForcesPresent,		// Enemy ground forces are expected (JSTAR trigger)
				enemyRadarPresent,				// Enemy radar operating (ECM trigger)
				enemySupportAircraftPresent,	// Enemy support aircraft operating
				enemyCASAircraftPresent,		// Enemy ground attack aircraft are present
				interceptEnemyAircraft,			// AWACS CALL: Intercept specific enemy aircraft (20)
				emptyEnemyAir1,					// TBD (21)
				hostileAircraftPresent,			// Hostile aircraft operating in an area
				emptyHostileAir1,				// TBD (23)
				friendlyRescueExpected,			// Friendly SAR craft will be operating in the area
				friendlyCASExpected,			// Friendly CAS aircraft will be entering the area (25)
				friendlyAssetsExpected,			// Generic 'Friendly assets' will be operating here
				friendlyAssetsRefueling,		// Friendly aircraft will be refueling in the area (TANKER trigger)
				emptyFriendly1,					// TBD (28)
				emptyFriendly2,					// TBD (29)
				enemySupplyInterdictionBridge,	// Enemy supplies are being transported through here (30)
				enemySupplyInterdictionPort,	// Enemy supplies are being transported through here
				enemySupplyInterdictionDepot,	// Enemy supplies are being stored here
				enemySupplyInterdictionZone,	// Enemy supplies are being moved through here
				emptySupply1,					// TBD (34)
				enemyProductionSource,			// This is producing enemy war materials
				enemyFuelSource,				// This is producing or storing fuel.
				enemyEnergySource,				// This is a source of enemy electrical power
				enemyCommand,					// This is being used as an enemy CCC module
				enemyAirDefense,				// Enemy air defenses are blocking friendly missions
				enemyAirPowerAirbase,			// This is being used to promote enemy air power (40)
				enemyAirPowerRadar,				// This is being used to promote enemy air power
				emptyObj1,						// TBD (42)
				emptyObj2,						// TBD (43)
				friendlyAWACSNeeded,			// We need an awacs (AWACS trigger)
				friendlySuppliesIncomingAir,	// We've got friendly supplies coming in by air
				friendlySuppliesIncomingNaval,	// Same by naval
				friendlySuppliesIncomingGround,	// Same by ground
				friendlySuppliesIncomingRail,	// Same by rail
				targetReconNeeded,				// Need recon of this objective
				emptyx,							// TBD (50)
				emptyy,							// TBD (51)
				AirActionPrepAD,				// OCA vs Air Defenses part of any air action
				AirActionPrepAB,				// OCA vs Air Bases/Radar part of non-OCA action
				AirActionPrepAir,				// Sweep/Escort part of a any action
				AirActionDCA,					// Part of a DCA action
				AirActionOCA,					// Part of an OCA action
				AirActionInterdiction,			// Part of an interdiction action
				AirActionAttrition,				// Part of an attrition action
				AirActionCAS,					// Part of a CAS action (59)
				emptyAction1,					// TBD (60)
				enemyNavalForceActive,			// Ships are operating here
				enemyNavalForceStatic,			// Ships in port
				enemyNavalForceUnloading,		// Transport ships unloading in port
				otherContext } MissionContext;

// These classes include mission.h and are used by the mission class, so need prototypes
class	PackagePlanningClass;
typedef	PackagePlanningClass *PackPlan;
class	UnitClass;
typedef	UnitClass *Unit;
class	FlightClass;
typedef FlightClass *Flight;
class	ObjectiveClass;
typedef	ObjectiveClass *Objective;
class	BasePathClass;
typedef BasePathClass *Path;

// ===================================================
// Mission Request Class
// ===================================================

// This class is filled in order to request a mission
class MissionRequestClass {
#ifdef USE_SH_POOLS
   public:
      // Overload new/delete to use a SmartHeap fixed size pool
      void *operator new(size_t size) { ShiAssert( size == sizeof(MissionRequestClass) ); return MemAllocFS(pool);	};
      void operator delete(void *mem) { if (mem) MemFreeFS(mem); };
      static void InitializeStorage()	{ pool = MemPoolInitFS( sizeof(MissionRequestClass), 50, 0 ); };
      static void ReleaseStorage()	{ MemPoolFree( pool ); };
      static MEM_POOL	pool;
#endif
	private:
	public:
		VU_ID				requesterID;
		VU_ID				targetID;
		VU_ID				secondaryID;				// Is this being used?
		VU_ID				pakID;
		Team				who;
		Team				vs;
		CampaignTime		tot;
		GridIndex			tx,ty;
		ulong				flags;
		short				caps;
		short				target_num;
		short				speed;
		short				match_strength;				// How much Air to Air strength we should try to match
		short				priority;
		uchar				tot_type;
		uchar				action_type;				// Type of action we're associated with
		uchar				mission;
		uchar				aircraft;
		uchar				context;					// Context code (why this was requested)
		uchar				roe_check;
		uchar				delayed;					// number of times it's been pushed back
		uchar				start_block;				// time block we're taking off during
		uchar				final_block;				// time block we're landing during
		uchar				slots[4];					// squadron slots we're using.
		char				min_to;						// minimum block we found planes for
		char				max_to;						// maximum block we found planes for
	public:
		MissionRequestClass(void);
		~MissionRequestClass(void);
		int RequestMission (void);
		int RequestEnemyMission (void);
	};
typedef MissionRequestClass *MissionRequest;

// ======================================================
// Mission Data Type - Stores data used to build missions
// ======================================================

struct MissionDataType {
	uchar					type;
	uchar					target;						// Target type
	uchar					skill;						// Primary skill to look for
	uchar					mission_profile;			// Allowable mission profiles
	uchar					target_profile;				// Type of target profile
	uchar					target_desc;				// When to use our target action (target area/whole mission/etc)
	uchar					routewp;					// Waypoint type along route
	uchar					targetwp;					// What to do at target location
	short					minalt;						// Minimum alt at target (in hundreds of feet)
	short					maxalt;						// Maximum alt at target (in hundreds of feet)
	short					missionalt;					// Suggested mission altitude (in hundreds of feet)
	short					separation;					// Seperation from main flight, in seconds
	short					loitertime;					// Loiter time in minutes
	uchar					str;						// Aircraft strength typically assigned
	uchar					min_time;					// Minimum # of minutes in advance to consider a planned mission
	uchar					max_time;					// Maximum # of minutes in advance to consider a planned mission
	uchar					escorttype;					// What sort of mission to build for an escort
	uchar					mindistance;				// Minimum distance between two similar missions
	uchar					mintime;					// Minimum time between missions of similar types
	uchar					caps;						// Special capibilities required (stealth, navy, etc)
	ulong					flags;						// flags
	};

extern MissionDataType MissionData[AMIS_OTHER];

// ===================================================
// Global functions
// ===================================================

extern int BuildPathToTarget (Flight u, MissionRequestClass *mis, VU_ID airbaseID);

extern void BuildDivertPath (Flight u, MissionRequestClass *mis);

extern void AddInformationWPs (Flight u, MissionRequestClass *mis);

extern void ClearDivertWayPoints (Flight flight);

extern int AddTankerWayPoint (Flight u, int refuel); // M.N.

extern long SetWPTimes (Flight u, MissionRequestClass *mis);

extern long SetWPTimesTanker (Flight u, MissionRequestClass *mis, bool type, CampaignTime time);

extern int SetWPAltitudes (Flight u);

extern int CheckPathThreats (Unit u);

extern int TargetThreats (Team team, int priority, F4PFList list, MoveType mt, CampaignTime time, long target_flags, short* targeted);
extern BOOL LoadMissionData();

#endif