text:
![Angular Seed Advanced](https://d2wp4shknjcfjl.cloudfront.net/api/file/olEzxJQ2KcXrZHzbt9UA)![Angular Seed Advanced Integrations](https://d2wp4shknjcfjl.cloudfront.net/api/file/SPLl77rSTuGZ7APrXizi)

[![Angular Style Guide](https://mgechev.github.io/angular2-style-guide/images/badge.svg)](https://angular.io/styleguide)
[![Build Status](https://travis-ci.org/NathanWalker/angular-seed-advanced.svg?branch=master)](https://travis-ci.org/NathanWalker/angular-seed-advanced)
[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)
[![Dependency Status](https://david-dm.org/NathanWalker/angular-seed-advanced.svg)](https://david-dm.org/NathanWalker/angular-seed-advanced)
[![devDependency Status](https://david-dm.org/NathanWalker/angular-seed-advanced/dev-status.svg)](https://david-dm.org/NathanWalker/angular-seed-advanced#info=devDependencies)

This is an **advanced** seed project for Angular apps based on [Minko Gechev's](https://github.com/mgechev) [angular-seed](https://github.com/mgechev/angular-seed) that expands on all of its great features to include core support for:

#### Integration with:
- [ngrx/store](https://github.com/ngrx/store) RxJS powered state management, inspired by **Redux**
- [ngrx/effects](https://github.com/ngrx/effects) Side effect model for @ngrx/store
- [ngx-translate](https://github.com/ngx-translate/core) for i18n
  - Usage is optional but on by default
  - Up to you and your team how you want to utilize it. It can be easily removed if not needed.
- [angulartics2](https://github.com/angulartics/angulartics2) Vendor-agnostic analytics for Angular applications.
  - Out of box support for [Segment](https://segment.com/)
    - When using the seed, be sure to change your `write_key` [here](https://github.com/NathanWalker/angular-seed-advanced/blob/master/src/client/index.html#L24)
  - Can be changed to any vendor, [learn more here](https://github.com/angulartics/angulartics2#supported-providers)
- [lodash](https://lodash.com/) Helps reduce blocks of code down to single lines and enhances readability
- [NativeScript](https://www.nativescript.org/) cross platform mobile (w/ native UI) apps. [Setup instructions here](#nativescript-app).
- [Electron](http://electron.atom.io/) cross platform desktop apps (Mac, Windows and Linux). [Setup instructions here](#electron-app).

| ![Multiple Platforms](https://cdn.filestackcontent.com/zZlQKKKjQUaBr9pLkEVK) |
| :---: |
| *The zen of multiple platforms.* Chrome, Android and iPhone all running the same code. |

| ![Desktop](https://d2wp4shknjcfjl.cloudfront.net/api/file/1O4FRGsSHS8g0Lz3EKNy) |
| :---: |
| *Programming Nirvana.* Mac and Windows desktop both running the same code. |

# Table of Contents

- [Prerequisites](#prerequisites)
- [How to start](#how-to-start)
- [How to start with AoT](#how-to-start-with-aot)
- [Mobile app](#mobile-app)
- [Desktop app](#desktop-app)
- [Running tests](#running-tests)
- [Web configuration options](#web-configuration-options)
- [Code organization overview](#code-organization-overview)
- [How-tos](#how-tos)
- [General best practice guide to sharing code](#general-best-practice-guide-to-sharing-code)
- [Integration guides](https://github.com/NathanWalker/angular-seed-advanced/wiki)
- [How best to use for your project](#how-best-to-use-for-your-project)
- [Dockerization](#dockerization)
  + [How to build and start the dockerized version of the application](#how-to-build-and-start-the-dockerized-version-of-the-application)
  + [Development build and deployment](#development-build-and-deployment)
  + [Production build and deployment](#production-build-and-deployment)
- [Contributing](#contributing)
- [License](#license)

**Advice**: If your project is intended to target a single platform (i.e, web only), then [angular-seed](https://github.com/mgechev/angular-seed) is likely more than suitable for your needs. However if your project goals are to target multiple platforms (web, native mobile and native desktop), with powerful out of the box library support and highly configurable/flexible testing options, then you might want to keep reading.

### Prerequisites

**Note** you should have **node v6.5.0 or higher** and **npm 3.10.3 or higher**.

* To run the NativeScript app:

```
npm install -g nativescript
npm install -g typescript
```

## How to start

```bash
# install the project's dependencies
$ npm install
# fast install (via Yarn, https://yarnpkg.com)
$ yarn install  # or yarn

# watches your files and uses livereload by default
$ npm start
# api document for the app
# npm run build.docs

# generate api documentation
$ npm run compodoc
$ npm run serve.compodoc

# to start deving with livereload site and coverage as well as continuous testing
$ npm run start.deving

# dev build
$ npm run build.dev
# prod build
$ npm run build.prod
```

## How to start with AoT

**Note** that AoT compilation requires **node v6.5.0 or higher** and **npm 3.10.3 or higher**.

In order to start the seed with AoT use:

```bash
# prod build with AoT compilation, will output the production application in `dist/prod`
# the produced code can be deployed (rsynced) to a remote server
$ npm run build.prod.aot
```

## Mobile app

The mobile app is provided via [NativeScript](https://www.nativescript.org/), an open source framework for building truly native mobile apps.

#### Setup

```
npm install -g nativescript
```

#### Dev Workflow

You can make changes to files in `src/client/app` or `nativescript/src/app` folders. A symbolic link exists between the web `src/client/app` and the `nativescript/src/app` folder so changes in either location are mirrored because they are the same directory inside.

Create `.tns.html` and `.tns.scss` NativeScript view files for every web component view file you have. You will see an example of the `app.component.html` as a [NativeScript view file here](https://github.com/NathanWalker/angular-seed-advanced/blob/master/src/client/app/components/app.component.tns.html).

The root module for the mobile app is `nativescript/src/native.module.ts`: `NativeModule`.

#### Run

```
iOS:                      npm run start.ios
iOS (device):             npm run start.ios.device

// or...

Android:                      npm run start.android
Android (device):             npm run start.android.device
```

* Requires an image setup via AVD Manager. [Learn more here](http://developer.android.com/intl/zh-tw/tools/devices/managing-avds.html) and [here](https://github.com/NativeScript/nativescript-cli#the-commands).

OR...

* [GenyMotion Android Emulator](https://www.genymotion.com/)

##### Building with Webpack for release builds

Create AoT builds for deployment to App Store and Google Play.

```
Android:   npm run build.android
iOS:       npm run build.ios
```

## Desktop app

The desktop app is provided via [Electron](http://electron.atom.io/), cross platform desktop apps
with JavaScript, HTML, and CSS.

#### Develop

```
Mac:      npm run start.desktop
Windows:  npm run start.desktop.windows
```

#### Develop with livesync
```
Mac:      npm run start.livesync.desktop
Windows:  npm run start.livesync.desktop.windows
```

#### Release: Package Electron App for Mac, Windows or Linux

```
Mac:      npm run build.desktop.mac
Windows:  npm run build.desktop.windows
Linux:    npm run build.desktop.linux
```

## Running tests

```bash
$ npm test

# Development. Your app will be watched by karma
# on each change all your specs will be executed.
$ npm run test.watch
# NB: The command above might fail with a "EMFILE: too many open files" error.
# Some OS have a small limit of opened file descriptors (256) by default
# and will result in the EMFILE error.
# You can raise the maximum of file descriptors by running the command below:
$ ulimit -n 10480

# code coverage (istanbul)
# auto-generated at the end of `npm test`
# view coverage report:
$ npm run serve.coverage

# e2e (aka. end-to-end, integration) - In three different shell windows
# Make sure you don't have a global instance of Protractor

# npm install webdriver-manager <- Install this first for e2e testing
# npm run webdriver-update <- You will need to run this the first time
$ npm run webdriver-start
$ npm run serve.e2e
$ npm run e2e

# e2e live mode - Protractor interactive mode
# Instead of last command above, you can use:
$ npm run e2e.live
```
You can learn more about [Protractor Interactive Mode here](https://github.com/angular/protractor/blob/master/docs/debugging.md#testing-out-protractor-interactively)

## Web configuration options

Default application server configuration

```javascript
var PORT             = 5555;
var LIVE_RELOAD_PORT = 4002;
var DOCS_PORT        = 4003;
var APP_BASE         = '/';
```

Configure at runtime

```bash
npm start -- --port 8080 --reload-port 4000 --base /my-app/
```

## Environment configuration

If you have different environments and you need to configure them to use different end points, settings, etc. you can use the files `dev.ts` or `prod.ts` in`./tools/env/`. The name of the file is environment you want to use.

The environment can be specified by using:

```bash
$ npm start -- --env-config ENV_NAME
```

Currently the `ENV_NAME`s are `dev`, `prod`, `staging`, but you can simply add a different file `"ENV_NAME.ts".` file in order to alter extra such environments.

# Tools documentation

A documentation of the provided tools can be found in [tools/README.md](tools/README.md).

## Code organization overview

- `nativescript`: Root of this directory is reserved for mobile app.
  - `src`: mobile app src.
    - `app`: Symbolic link of shared code from web app.
    - `App_Resources`: iOS and Android platform specific config files and images.
    - `mobile`: Mobile specific services, etc. Build out mobile specific services here as well as overrides for web services that need to be provided for in the mobile app. **Safe to import {N} modules here.**
    - [native.module.ts](https://github.com/NathanWalker/angular-seed-advanced/blob/master/nativescript/src/native.module.ts): Root module for the mobile app provided by NativeScript. Override/provide native mobile implementations of services here.
- `src/client`: Root of this directory is reserved for web and desktop.
  - `app`: All the code in this directory is shared with the mobile app via a symbolic link.
    - `components`: Reserved for primary routing components. Since each app usually has it's own set of unique routes, you can provide the app's primary routing components here.
    - `shared`: Shared code across all platforms. Reusable sub components, services, utilities, etc.
      - `analytics`: Provides services for analytics. Out of the box, [Segment](https://segment.com/) is configured.
      - `core`: Low level services. Foundational layer.
      - `electron`: Services specific to electron integration. Could be refactored out in the future since this is not needed to be shared with the mobile app.
      - `i18n`: Various localization features.
      - `ngrx`: Central ngrx coordination. Brings together state from any other feature modules etc. to setup the initial app state.
      - `sample`: Just a sample module pre-configured with a scalable ngrx setup.
      - `test`: Testing utilities. This could be refactored into a different location in the future.
  - `assets`: Various locale files, images and other assets the app needs to load.
  - `css`: List of the main style files to be created via the SASS compilation (enabled by default).
  - `scss`: Partial SASS files - reserved for things like `_variables.scss` and other imported partials for styling.
  - [index.html](https://github.com/NathanWalker/angular-seed-advanced/blob/master/src/client/index.html): The index file for the web and desktop app (which share the same setup).
  - [main.desktop.ts](https://github.com/NathanWalker/angular-seed-advanced/blob/master/src/client/main.desktop.ts): The  file used by Electron to start the desktop app.
  - [main.web.prod.ts](https://github.com/NathanWalker/angular-seed-advanced/blob/master/src/client/main.web.prod.ts): Bootstraps the AoT web build. *Generally won't modify anything here*
  - [main.web.ts](https://github.com/NathanWalker/angular-seed-advanced/blob/master/src/client/main.web.ts): Bootstraps the development web build. *Generally won't modify anything here*
  - [package.json](https://github.com/NathanWalker/angular-seed-advanced/blob/master/src/client/package.json): Used by Electron to start the desktop app.
  - [system-config.ts](https://github.com/NathanWalker/angular-seed-advanced/blob/master/src/client/system-config.ts): This loads the SystemJS configuration defined [here](https://github.com/NathanWalker/angular-seed-advanced/blob/master/tools/config/seed.config.ts#L397) and extended in your own app's customized [project.config.ts](https://github.com/NathanWalker/angular-seed-advanced/blob/master/tools/config/project.config.ts).
  - [tsconfig.json](https://github.com/NathanWalker/angular-seed-advanced/blob/master/src/client/tsconfig.json): Used by [compodoc](https://compodoc.github.io/compodoc/) - The missing documentation tool for your Angular application - to generate api docs for your code.
  - [web.module.ts](https://github.com/NathanWalker/angular-seed-advanced/blob/master/src/client/web.module.ts): The root module for the web and desktop app.
- `src/e2e`: Integration/end-to-end tests for the web app.

## How-tos

### i18n

* how to add a language?
  - `src/client/assets/i18n/`
    - add `[language code].json` (copy existing one and adapt the translation strings)
  - Create a file similar to the [sample app-config](https://github.com/NathanWalker/angular-seed-advanced/blob/master/src/client/app/shared/sample/services/app-config.ts)
    - Define your app's `SUPPORTED_LANGUAGES`.
  - `src/client/app/shared/i18n/components/lang-switcher.component.spec.ts`
    - fix test

## General best practice guide to sharing code

There's actually only a few things to keep in mind when sharing code between web/mobile. The seed does take care of quite a few of those things but here's a brief list:

* Don't import {N} modules into your components/services. {N} modules can only be used inside the {N} app therefore cannot be shared. To get around this, use `OpaqueTokens` which is a fancy name for something quite simple. [Learn more here](http://blog.thoughtram.io/angular/2016/05/23/opaque-tokens-in-angular-2.html). A great example of how to integrate 2 different plugins (1 for web, 1 for {N}) and share all the code exists in [this wiki article: How to integrate Firebase across all platforms](https://github.com/NathanWalker/angular-seed-advanced/wiki/How-to-integrate-Firebase-across-all-platforms-(web-nativescript-desktop)) written by the awesome [Scott Lowe](https://twitter.com/scott_d_lowe).
* Use the conditional hooks provided by the seed in shared methods where you may need to handle something differently in {N} than you do on the web. For example, see [here](https://github.com/NathanWalker/angular-seed-advanced/blob/master/src/client/app/shared/i18n/components/lang-switcher.component.ts#L35-L41).
* Don't use window global. Inject the `WindowService` provided by the seed instead. This includes usage of `alert`, `confirm`, etc. For example:

If you were thinking about doing: `alert('Something happened!');`, *Don't*.
Instead inject `WindowService`:
```
constructor(private win: WindowService) {}

public userAction() {
  if (success) {
    // do stuff
  } else {
    this.win.alert('Something happened!');
  }
}
```

This ensures that when the same code is run in the {N} app, the native `dialogs` module will be used.

* Lastly, understand this video: http://www.nativescriptsnacks.com/videos/2016/06/13/zoned-callbacks.html … As far as dealing with {N} and 3rd party plugins, you want to understand that.

The advice I like to give is:

> Code with web mentality first. Then provide the native capability using Angular's `{provide: SomeWebService, useClass: SomeNativeService }` during bootstrap.

There are some cases where you may want to use `useValue` vs. `useClass`, and other times may need to use `useFactory`. Read [the Angular docs here to learn more about which you may need for your use case](https://angular.io/docs/ts/latest/cookbook/dependency-injection.html#!#provide).

## How best to use for your project

#### Setup

*NOTE*: This should be done first before you start making any changes and building out your project.

1. `git clone https://github.com/NathanWalker/angular-seed-advanced.git [your-project-name]`
2. `cd [your-project-name]`
3. `git remote set-url origin [your-project-git-repo]` - This will setup `origin` properly.
4. `git remote add upstream https://github.com/NathanWalker/angular-seed-advanced.git` - This will setup `upstream` properly to merge in upstream changes later.
5. `git push` - Go ahead and push up the initial project.
6. Now you have `git` setup and ready to develop your app as well as merge in upstream changes in the future.
7. `npm install` (and all other usage docs in this `README` apply) - continue following instructions [here](https://github.com/NathanWalker/angular-seed-advanced#how-to-start).
8. Create a new folder (or several sub-folders) for your app in `src/client/app/shared` to build your codebase out. Say your app is called `AwesomeApp`, then create `awesomeapp` and start building out all your components and services in there. Create other frameworks as you see fit to organize.

#### Merging latest upstream changes

1. `git fetch upstream` - This will fetch latest `upstream`.
2. `git merge upstream/master` - This will merge in upstream changes.
3. Handle any conflicts to get latest upstream into your app.
4. Continue building your app.

You can read more about [syncing a fork here](https://help.github.com/articles/syncing-a-fork/).

If you have any suggestions to this workflow, please post [here](https://github.com/NathanWalker/angular-seed-advanced/issues).

# Dockerization

The application provides full Docker support. You can use it for both development as well as production builds and deployments.

## How to build and start the dockerized version of the application

The Dockerization infrastructure is described in the `docker-compose.yml` (respectively `docker-compose.production.yml`.
The application consists of two containers:
- `angular-seed` - In development mode, this container serves the angular app. In production mode it builds the angular app, with the build artifacts being served by the Nginx container
- `angular-seed-nginx` - This container is used only production mode. It serves the built angular app with Nginx.

## Development build and deployment

Run the following:

```bash
$ docker-compose build
$ docker-compose up -d
```

Now open your browser at http://localhost:5555

## Production build and deployment

Run the following:

```bash
$ docker-compose -f docker-compose.production.yml build
$ docker-compose -f docker-compose.production.yml up angular-seed   # Wait until this container has finished building, as the nginx container is dependent on the production build artifacts
$ docker-compose -f docker-compose.production.yml up -d angular-seed-nginx  # Start the nginx container in detached mode
```

Now open your browser at http://localhost:5555

## Contributing

Please see the [CONTRIBUTING](https://github.com/NathanWalker/angular-seed-advanced/blob/master/CONTRIBUTING.md) file for guidelines.

# Awesome Contributors

[](https://github.com/mgechev) |[](https://github.com/NathanWalker) |[](https://github.com/ludohenin) |[](https://github.com/d3viant0ne) |[](https://github.com/Shyam-Chen) |[](https://github.com/Nightapes) |
:---: |:---: |:---: |:---: |:---: |:---: |
[mgechev](https://github.com/mgechev) |[NathanWalker](https://github.com/NathanWalker) |[ludohenin](https://github.com/ludohenin) |[d3viant0ne](https://github.com/d3viant0ne) |[Shyam-Chen](https://github.com/Shyam-Chen) |[Nightapes](https://github.com/Nightapes) |

[](https://github.com/tarlepp) |[](https://github.com/robstoll) |[](https://github.com/TheDonDope) |[](https://github.com/m-abs) |[](https://github.com/hank-ehly) |[](https://github.com/nareshbhatia) |
:---: |:---: |:---: |:---: |:---: |:---: |
[tarlepp](https://github.com/tarlepp) |[robstoll](https://github.com/robstoll) |[TheDonDope](https://github.com/TheDonDope) |[m-abs](https://github.com/m-abs) |[hank-ehly](https://github.com/hank-ehly) |[nareshbhatia](https://github.com/nareshbhatia) |

[](https://github.com/kiuka) |[](https://github.com/jesperronn) |[](https://github.com/daniru) |[](https://github.com/njs50) |[](https://github.com/vyakymenko) |[](https://github.com/aboeglin) |
:---: |:---: |:---: |:---: |:---: |:---: |
[kiuka](https://github.com/kiuka) |[jesperronn](https://github.com/jesperronn) |[daniru](https://github.com/daniru) |[njs50](https://github.com/njs50) |[vyakymenko](https://github.com/vyakymenko) |[aboeglin](https://github.com/aboeglin) |

[](https://github.com/eppsilon) |[](https://github.com/netstart) |[](https://github.com/sasikumardr) |[](https://github.com/ivannugo) |[](https://github.com/gkalpak) |[](https://github.com/ryzy) |
:---: |:---: |:---: |:---: |:---: |:---: |
[eppsilon](https://github.com/eppsilon) |[netstart](https://github.com/netstart) |[sasikumardr](https://github.com/sasikumardr) |[ivannugo](https://github.com/ivannugo) |[gkalpak](https://github.com/gkalpak) |[ryzy](https://github.com/ryzy) |

[](https://github.com/markwhitfeld) |[](https://github.com/jvitor83) |[](https://github.com/sfabriece) |[](https://github.com/JakePartusch) |[](https://github.com/nosachamos) |[](https://github.com/pgrzeszczak) |
:---: |:---: |:---: |:---: |:---: |:---: |
[markwhitfeld](https://github.com/markwhitfeld) |[jvitor83](https://github.com/jvitor83) |[sfabriece](https://github.com/sfabriece) |[JakePartusch](https://github.com/JakePartusch) |[nosachamos](https://github.com/nosachamos) |[pgrzeszczak](https://github.com/pgrzeszczak) |

[](https://github.com/natarajanmca11) |[](https://github.com/e-oz) |[](https://github.com/Kaffiend) |[](https://github.com/fulls1z3) |[](https://github.com/jerryorta-dev) |[](https://github.com/LuxDie) |
:---: |:---: |:---: |:---: |:---: |:---: |
[natarajanmca11](https://github.com/natarajanmca11) |[e-oz](https://github.com/e-oz) |[Kaffiend](https://github.com/Kaffiend) |[fulls1z3](https://github.com/fulls1z3) |[jerryorta-dev](https://github.com/jerryorta-dev) |[LuxDie](https://github.com/LuxDie) |

[](https://github.com/admosity) |[](https://github.com/JohnCashmore) |[](https://github.com/larsthorup) |[](https://github.com/ouq77) |[](https://github.com/irsick) |[](https://github.com/StefanKoenen) |
:---: |:---: |:---: |:---: |:---: |:---: |
[admosity](https://github.com/admosity) |[JohnCashmore](https://github.com/JohnCashmore) |[larsthorup](https://github.com/larsthorup) |[ouq77](https://github.com/ouq77) |[irsick](https://github.com/irsick) |[StefanKoenen](https://github.com/StefanKoenen) |

[](https://github.com/amedinavalencia) |[](https://github.com/troyanskiy) |[](https://github.com/tsm91) |[](https://github.com/domfarolino) |[](https://github.com/juristr) |[](https://github.com/JayKan) |
:---: |:---: |:---: |:---: |:---: |:---: |
[amedinavalencia](https://github.com/amedinavalencia) |[troyanskiy](https://github.com/troyanskiy) |[tsm91](https://github.com/tsm91) |[domfarolino](https://github.com/domfarolino) |[juristr](https://github.com/juristr) |[JayKan](https://github.com/JayKan) |

[](https://github.com/turbohappy) |[](https://github.com/devanp92) |[](https://github.com/evanplaice) |[](https://github.com/hAWKdv) |[](https://github.com/JunaidZA) |[](https://github.com/c-ice) |
:---: |:---: |:---: |:---: |:---: |:---: |
[turbohappy](https://github.com/turbohappy) |[devanp92](https://github.com/devanp92) |[evanplaice](https://github.com/evanplaice) |[hAWKdv](https://github.com/hAWKdv) |[JunaidZA](https://github.com/JunaidZA) |[c-ice](https://github.com/c-ice) |

[](https://github.com/markharding) |[](https://github.com/ojacquemart) |[](https://github.com/Sn3b) |[](https://github.com/TuiKiken) |[](https://github.com/gotenxds) |[](https://github.com/edud69) |
:---: |:---: |:---: |:---: |:---: |:---: |
[markharding](https://github.com/markharding) |[ojacquemart](https://github.com/ojacquemart) |[Sn3b](https://github.com/Sn3b) |[TuiKiken](https://github.com/TuiKiken) |[gotenxds](https://github.com/gotenxds) |[edud69](https://github.com/edud69) |

[](https://github.com/karlhaas) |[](https://github.com/kbrandwijk) |[](https://github.com/Yonet) |[](https://github.com/Green-Cat) |[](https://github.com/ip512) |[](https://github.com/joshboley) |
:---: |:---: |:---: |:---: |:---: |:---: |
[karlhaas](https://github.com/karlhaas) |[kbrandwijk](https://github.com/kbrandwijk) |[Yonet](https://github.com/Yonet) |[Green-Cat](https://github.com/Green-Cat) |[ip512](https://github.com/ip512) |[joshboley](https://github.com/joshboley) |

[](https://github.com/Marcelh29) |[](https://github.com/Bigous) |[](https://github.com/robbatt) |[](https://github.com/divramod) |[](https://github.com/alexweber) |[](https://github.com/vakrilov) |
:---: |:---: |:---: |:---: |:---: |:---: |
[Marcelh29](https://github.com/Marcelh29) |[Bigous](https://github.com/Bigous) |[robbatt](https://github.com/robbatt) |[divramod](https://github.com/divramod) |[alexweber](https://github.com/alexweber) |[vakrilov](https://github.com/vakrilov) |

[](https://github.com/allenhwkim) |[](https://github.com/Falinor) |[](https://github.com/amaltsev) |[](https://github.com/nulldev07) |[](https://github.com/taguan) |[](https://github.com/yassirh) |
:---: |:---: |:---: |:---: |:---: |:---: |
[allenhwkim](https://github.com/allenhwkim) |[Falinor](https://github.com/Falinor) |[amaltsev](https://github.com/amaltsev) |[nulldev07](https://github.com/nulldev07) |[taguan](https://github.com/taguan) |[yassirh](https://github.com/yassirh) |

[](https://github.com/urmaul) |[](https://github.com/sonicparke) |[](https://github.com/brendanbenson) |[](https://github.com/brian428) |[](https://github.com/briantopping) |[](https://github.com/ckapilla) |
:---: |:---: |:---: |:---: |:---: |:---: |
[urmaul](https://github.com/urmaul) |[sonicparke](https://github.com/sonicparke) |[brendanbenson](https://github.com/brendanbenson) |[brian428](https://github.com/brian428) |[briantopping](https://github.com/briantopping) |[ckapilla](https://github.com/ckapilla) |

[](https://github.com/cadriel) |[](https://github.com/dszymczuk) |[](https://github.com/dmurat) |[](https://github.com/peah90) |[](https://github.com/dstockhammer) |[](https://github.com/dwido) |
:---: |:---: |:---: |:---: |:---: |:---: |
[cadriel](https://github.com/cadriel) |[dszymczuk](https://github.com/dszymczuk) |[dmurat](https://github.com/dmurat) |[peah90](https://github.com/peah90) |[dstockhammer](https://github.com/dstockhammer) |[dwido](https://github.com/dwido) |

[](https://github.com/dcsw) |[](https://github.com/totev) |[](https://github.com/ericdoerheit) |[](https://github.com/ericli1018) |[](https://github.com/Swiftwork) |[](https://github.com/fbascheper) |
:---: |:---: |:---: |:---: |:---: |:---: |
[dcsw](https://github.com/dcsw) |[totev](https://github.com/totev) |[ericdoerheit](https://github.com/ericdoerheit) |[ericli1018](https://github.com/ericli1018) |[Swiftwork](https://github.com/Swiftwork) |[fbascheper](https://github.com/fbascheper) |

[](https://github.com/gsamokovarov) |[](https://github.com/koodikindral) |[](https://github.com/hpinsley) |[](https://github.com/NN77) |[](https://github.com/isidroamv) |[](https://github.com/JohnnyQQQQ) |
:---: |:---: |:---: |:---: |:---: |:---: |
[gsamokovarov](https://github.com/gsamokovarov) |[koodikindral](https://github.com/koodikindral) |[hpinsley](https://github.com/hpinsley) |[NN77](https://github.com/NN77) |[isidroamv](https://github.com/isidroamv) |[JohnnyQQQQ](https://github.com/JohnnyQQQQ) |

[](https://github.com/jeffbcross) |[](https://github.com/jlooper) |[](https://github.com/Jimmysh) |[](https://github.com/Drane) |[](https://github.com/johnjelinek) |[](https://github.com/fourctv) |
:---: |:---: |:---: |:---: |:---: |:---: |
[jeffbcross](https://github.com/jeffbcross) |[jlooper](https://github.com/jlooper) |[Jimmysh](https://github.com/Jimmysh) |[Drane](https://github.com/Drane) |[johnjelinek](https://github.com/johnjelinek) |[fourctv](https://github.com/fourctv) |

[](https://github.com/JunusErgin) |[](https://github.com/justindujardin) |[](https://github.com/lihaibh) |[](https://github.com/Brooooooklyn) |[](https://github.com/tandu) |[](https://github.com/inkidotcom) |
:---: |:---: |:---: |:---: |:---: |:---: |
[JunusErgin](https://github.com/JunusErgin) |[justindujardin](https://github.com/justindujardin) |[lihaibh](https://github.com/lihaibh) |[Brooooooklyn](https://github.com/Brooooooklyn) |[tandu](https://github.com/tandu) |[inkidotcom](https://github.com/inkidotcom) |

[](https://github.com/daixtrose) |[](https://github.com/MathijsHoogland) |[](https://github.com/mjwwit) |[](https://github.com/oferze) |[](https://github.com/ocombe) |[](https://github.com/gdi2290) |
:---: |:---: |:---: |:---: |:---: |:---: |
[daixtrose](https://github.com/daixtrose) |[MathijsHoogland](https://github.com/MathijsHoogland) |[mjwwit](https://github.com/mjwwit) |[oferze](https://github.com/oferze) |[ocombe](https://github.com/ocombe) |[gdi2290](https://github.com/gdi2290) |

[](https://github.com/typekpb) |[](https://github.com/peter-norton) |[](https://github.com/philipooo) |[](https://github.com/pidupuis) |[](https://github.com/redian) |[](https://github.com/robertpenner) |
:---: |:---: |:---: |:---: |:---: |:---: |
[typekpb](https://github.com/typekpb) |[peter-norton](https://github.com/peter-norton) |[philipooo](https://github.com/philipooo) |[pidupuis](https://github.com/pidupuis) |[redian](https://github.com/redian) |[robertpenner](https://github.com/robertpenner) |

[](https://github.com/Sjiep) |[](https://github.com/RoxKilly) |[](https://github.com/SamVerschueren) |[](https://github.com/sclausen) |[](https://github.com/heavymery) |[](https://github.com/tjvantoll) |
:---: |:---: |:---: |:---: |:---: |:---: |
[Sjiep](https://github.com/Sjiep) |[RoxKilly](https://github.com/RoxKilly) |[SamVerschueren](https://github.com/SamVerschueren) |[sclausen](https://github.com/sclausen) |[heavymery](https://github.com/heavymery) |[tjvantoll](https://github.com/tjvantoll) |

[](https://github.com/tapas4java) |[](https://github.com/gitter-badger) |[](https://github.com/valera-rozuvan) |[](https://github.com/miltador) |[](https://github.com/vincentpalita) |[](https://github.com/VladimirMakaev) |
:---: |:---: |:---: |:---: |:---: |:---: |
[tapas4java](https://github.com/tapas4java) |[gitter-badger](https://github.com/gitter-badger) |[valera-rozuvan](https://github.com/valera-rozuvan) |[miltador](https://github.com/miltador) |[vincentpalita](https://github.com/vincentpalita) |[VladimirMakaev](https://github.com/VladimirMakaev) |

[](https://github.com/ghys) |[](https://github.com/Yalrafih) |[](https://github.com/arnaudvalle) |[](https://github.com/billsworld) |[](https://github.com/blackheart01) |[](https://github.com/butterfieldcons) |
:---: |:---: |:---: |:---: |:---: |:---: |
[ghys](https://github.com/ghys) |[Yalrafih](https://github.com/Yalrafih) |[arnaudvalle](https://github.com/arnaudvalle) |[billsworld](https://github.com/billsworld) |[blackheart01](https://github.com/blackheart01) |[butterfieldcons](https://github.com/butterfieldcons) |

[](https://github.com/danielcrisp) |[](https://github.com/jgolla) |[](https://github.com/omerfarukyilmaz) |[](https://github.com/pbazurin-softheme) |[](https://github.com/ZuSe) |[](https://github.com/rossedfort) |
:---: |:---: |:---: |:---: |:---: |:---: |
[danielcrisp](https://github.com/danielcrisp) |[jgolla](https://github.com/jgolla) |[omerfarukyilmaz](https://github.com/omerfarukyilmaz) |[pbazurin-softheme](https://github.com/pbazurin-softheme) |[ZuSe](https://github.com/ZuSe) |[rossedfort](https://github.com/rossedfort) |

[](https://github.com/ruffiem) |[](https://github.com/savcha) |[](https://github.com/s-f-a-g) |[](https://github.com/ultrasonicsoft) |[](https://github.com/bbarry) |
:---: |:---: |:---: |:---: |:---: |
[ruffiem](https://github.com/ruffiem) |[savcha](https://github.com/savcha) |[s-f-a-g](https://github.com/s-f-a-g) |[ultrasonicsoft](https://github.com/ultrasonicsoft) |[bbarry](https://github.com/bbarry) |

## License

MIT


text:
def get_banks(name):
    if name == "Irek": return ["Bank of America", "Chase"]
    elif name == "John": return ["PNC Bank", "Wells Fargo"]
    elif name == "Alex": return ["TD Bank"]
    else: return []

def get_accounts(bank, name):
    if   name == "Irek" and bank == "Bank of America": return [1, 2]
    elif name == "Irek" and bank == "Chase": return [3]
    elif name == "John" and bank == "PNC Bank": return [4]
    elif name == "John" and bank == "Wells Fargo": return [5, 6]
    elif name == "Alex" and bank == "TD Bank": return [7, 8]
    else: return []

def get_balance(bank, account):
    return 250000

def qualified_amount(balance):
    if balance > 200000: return balance
    else: return 0

# iterate through multiple banks and each account in the bank given name, via for-loop in list comprehension
def get_loan(name):
    return [ qualified_amount(get_balance(bank, account))
        for bank in get_banks(name)
        for account in get_accounts(bank, name) ]

names = ["Irek", "John", "Alex", "Fred"]
loans = map(get_loan, names)
for name, loan in zip(names, loans):
    print "%s: %s" % (name, loan)

redpajama_set_name: RedPajamaGithub


text:
source('concerns/fieldBase', ['concerns/concerns'], function() {
    concerns.inheritWidgetBase('fieldBase', {
        _create: function() {
            this._super();

            var $input = $('input', this.element);

            this.getInput = function() {
                return $input;
            };

            this.getValue = function() {
                return $input.val();
            };

            this.setValue = function(val) {
                $input.val(val);
            };
       },
    });
});


text:
@implementation MPAPIEndpoints

static BOOL sUsesHTTPS = false;

+ (void)setUsesHTTPS:(BOOL)usesHTTPS
{
    sUsesHTTPS = usesHTTPS;
}

+ (NSString *)APIScheme
{
    return sUsesHTTPS ? @"https" : @"http";
}

+ (NSString *)baseURLStringWithPath:(NSString *)path testing:(BOOL)testing
{
    return [NSString stringWithFormat:@"%@://%@%@",
            [[self class] APIScheme],
            testing ? MOPUB_BASE_HOSTNAME_FOR_TESTING : MOPUB_BASE_HOSTNAME,
            path];
}

@end


text:
package com.asakusafw.dag.compiler.extension.internalio;

import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;

import java.io.File;
import java.util.Arrays;

import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExternalResource;

import com.asakusafw.dag.compiler.extension.internalio.testing.InternalIoTestHelper;
import com.asakusafw.dag.runtime.testing.MockDataModel;
import com.asakusafw.lang.compiler.common.Location;
import com.asakusafw.lang.compiler.packaging.ResourceUtil;
import com.asakusafw.lang.compiler.tester.CompilerProfile;
import com.asakusafw.lang.compiler.tester.executor.JobflowExecutor;
import com.asakusafw.lang.compiler.tester.externalio.TestInput;
import com.asakusafw.lang.compiler.tester.externalio.TestOutput;
import com.asakusafw.runtime.windows.WindowsSupport;
import com.asakusafw.vanilla.compiler.core.VanillaCompilerTesterRoot;
import com.asakusafw.vanilla.compiler.tester.InProcessVanillaTaskExecutor;
import com.asakusafw.vanilla.compiler.tester.externalio.TestIoTaskExecutor;

/**
 * Test for {@link InternalPortDriver}.
 */
public class InternalPortDriverTest extends VanillaCompilerTesterRoot {

    static final File WORKING = new File("target/" + InternalPortDriverTest.class.getSimpleName());

    static final Location LOCATION_CORE_CONFIGURATION = Location.of("core/conf/asakusa-resources.xml"); //$NON-NLS-1$

    /**
     * Support for Windows platform.
     */
    @ClassRule
    public static final WindowsSupport WINDOWS_SUPPORT = new WindowsSupport();

    /**
     * profile helper.
     */
    @Rule
    public final ExternalResource initializer = new ExternalResource() {
        @Override
        protected void before() throws Throwable {
            profile.forToolRepository()
                .useDefaults();
            profile.forCompilerOptions()
                .withRuntimeWorkingDirectory(WORKING.getAbsolutePath(), false);
        }
    };

    final CompilerProfile profile = new CompilerProfile(getClass().getClassLoader());

    /**
     * Test helper.
     */
    @Rule
    public final InternalIoTestHelper helper = new InternalIoTestHelper();

    final TestIoTaskExecutor testio = new TestIoTaskExecutor();

    final JobflowExecutor executor = new JobflowExecutor(Arrays.asList(new InProcessVanillaTaskExecutor(), testio))
            .withBefore(testio::check)
            .withBefore((a, c) -> ResourceUtil.delete(WORKING))
            .withAfter((a, c) -> ResourceUtil.delete(WORKING));

    /**
     * input.
     * @throws Exception if failed
     */
    @Test
    public void input() throws Exception {
        helper.input(MockDataModel.class, "input-*.bin", o -> {
            o.write(new MockDataModel(0, "Hello, world!"));
        });
        testio.output("t", MockDataModel.class, o -> {
            assertThat(o, contains(new MockDataModel(0, "Hello, world!")));
        });
        run(profile, executor, g -> g
                .input("in", helper.input(MockDataModel.class, "input-*.bin"))
                .output("out", TestOutput.of("t", MockDataModel.class))
                .connect("in", "out"));
    }

    /**
     * output.
     * @throws Exception if failed
     */
    @Test
    public void output() throws Exception {
        testio.input("t", MockDataModel.class, o -> {
            o.write(new MockDataModel(0, "Hello, world!"));
        });
        run(profile, executor, g -> g
                .input("in", TestInput.of("t", MockDataModel.class))
                .output("out", helper.output(MockDataModel.class, "output-*.bin"))
                .connect("in", "out"));
        helper.output(MockDataModel.class, "output-*.bin", o -> {
            assertThat(o, contains(new MockDataModel(0, "Hello, world!")));
        });
    }

    /**
     * orphaned output.
     * @throws Exception if failed
     */
    @Test
    public void output_orphaned() throws Exception {
        testio.input("t", MockDataModel.class, o -> {
            o.write(new MockDataModel(0, "Hello, world!"));
        });
        testio.output("t", MockDataModel.class, o -> {
            assertThat(o, contains(new MockDataModel(0, "Hello, world!")));
        });
        run(profile, executor, g -> g
                .output("orphaned", helper.output(MockDataModel.class, "output-*.bin"))
                .input("in", TestInput.of("t", MockDataModel.class))
                .output("out", TestOutput.of("t", MockDataModel.class)).connect("in", "out"));
        helper.output(MockDataModel.class, "output-*.bin", o -> {
            assertThat(o, hasSize(0));
        });
    }
}


text:
namespace OrchardCore.ReCaptcha.ActionFilters.Detection
{
    /// <summary>
    /// This interface describes the contract for components that can detect Robots.
    /// </summary>
    public interface IDetectRobots
    {
        /// <summary>
        /// Performs a check to see if the current request could be submitted by a robot
        /// </summary>
        /// <returns>Detection result</returns>
        RobotDetectionResult DetectRobot();

        /// <summary>
        /// Clear the detectors internal state, we are not dealing with a robot
        /// </summary>
        void IsNotARobot();

        /// <summary>
        /// We are dealing with a robot, shields up
        /// </summary>
        void FlagAsRobot();
    }

    public class RobotDetectionResult
    {
        public bool IsRobot { get; set; }
    }
}


text:
using System;
using NUnit.Framework;
using ruibarbo.core;
using ruibarbo.core.Debug;
using ruibarbo.core.Search;
using ruibarbo.core.Win32;
using ruibarbo.core.Wpf;

namespace ruibarbo.sampletest
{
    /// <summary>
    /// Some basic tests to demonstrate the library foundation.
    /// </summary>
    [TestFixture]
    public class BasicTest
    {
        private Engine _engine;

        [SetUp]
        public void SetUp()
        {
            _engine = new Engine();
            _engine.Start(new SampleApplication());
        }

        [TearDown]
        public void TearDown()
        {
            _engine.ShutDown();
            CollectionAssert.IsEmpty(_engine.UnhandledExceptions);
        }

        [Test]
        public void DoDaThing()
        {
            var window = _engine.Desktop.FindFirstChild<WpfWindow>(By.Name("WndMain"));

            window.MoveTo(400, 400);

            Console.WriteLine("Found window, Element name path: '{0}'; class path: {1}", window.ElementNamePath(), window.ElementClassPath());
            var button = window.FindFirstChild<WpfButton>(By.Name("BtnSubmit"));
            Console.WriteLine("Found button, Element name path: '{0}'; class path: {1}", button.ElementNamePath(), button.ElementClassPath());
            Console.WriteLine("Button, Element name or class path: '{0}'", button.ElementNameOrClassPath());
            Console.WriteLine("Button, Element search by path: '{0}'", button.ElementSearchPath());
            button.Click();
            var messageBox = _engine.Desktop.FindFirstChild<Win32Control>(By.Class("#32770"));
            var okButton = messageBox.FindFirstChild<Win32Control>(By.Class("Button"));
            okButton.Click();
            // TODO: button.Trigger() to click it programmatically
            var textbox = window.FindFirstChild<WpfTextBox>(By.Name("TxtInput"));
            Console.WriteLine("Found textbox, Element name path: '{0}'; class path: {1}", textbox.ElementNamePath(), textbox.ElementClassPath());
            textbox.Click();
            textbox.Type("Smurf");
            // TODO: textbox.Text = "Smurf";
        }
    }
}


text:
import { Document } from "mongoose";
import { IUser } from "../interfaces/user";

export interface IUserModel extends IUser, Document {
  //custom methods for your model would be defined here
}


text:
{% extends 'oscar/dashboard/layout.html' %}
{% load currency_filters %}
{% load i18n %}

{% block body_class %}{{ block.super }} create-page{% endblock %}

{% block title %}
    {% blocktrans with name=voucher_set.name %}Delete voucher set '{{ name }}'?{% endblocktrans %} | {% trans "Voucher sets" %} | {{ block.super }}
{% endblock %}

{% block breadcrumbs %}

{% trans "Dashboard" %}

{% trans "Voucher sets" %}

{{ voucher_set }}

{% trans "Delete?" %}

{% endblock %}

{% block headertext %}
    {% blocktrans with name=voucher_set.name count=voucher_set.count %}Delete voucher set '{{ name }}' and its {{ count }} vouchers?{% endblocktrans %}
{% endblock %}

{% block dashboard_content %}

{% trans "Voucher set details" %}

        {% include "oscar/dashboard/vouchers/partials/voucher_set_details_table.html" %}
        <form method="post">
            {% csrf_token %}

                <button class="btn btn-danger" type="submit" data-loading-text="{% trans 'Deleting...' %}">{% trans "Delete" %}</button> {% trans "or" %}
                {% trans "cancel" %}

        </form>

{% endblock dashboard_content %}


text:
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace osu.Framework.Threading
{
    /// <summary>
    /// Provides a scheduler that uses a managed thread "pool".
    /// </summary>
    public sealed class ThreadedTaskScheduler : TaskScheduler, IDisposable
    {
        private readonly BlockingCollection<Task> tasks;

        private readonly ImmutableArray<Thread> threads;

        /// <summary>
        /// Initializes a new instance of the StaTaskScheduler class with the specified concurrency level.
        /// </summary>
        /// <param name="numberOfThreads">The number of threads that should be created and used by this scheduler.</param>
        public ThreadedTaskScheduler(int numberOfThreads)
        {
            if (numberOfThreads < 1)
                throw new ArgumentOutOfRangeException(nameof(numberOfThreads));

            tasks = new BlockingCollection<Task>();

            threads = Enumerable.Range(0, numberOfThreads).Select(i =>
            {
                var thread = new Thread(processTasks)
                {
                    Name = "LoadComponentThreadPool",
                    IsBackground = true
                };

                thread.Start();

                return thread;
            }).ToImmutableArray();
        }

        /// <summary>
        /// Continually get the next task and try to execute it.
        /// This will continue as a blocking operation until the scheduler is disposed and no more tasks remain.
        /// </summary>
        private void processTasks()
        {
            foreach (var t in tasks.GetConsumingEnumerable()) TryExecuteTask(t);
        }

        /// <summary>
        /// Queues a Task to be executed by this scheduler.
        /// </summary>
        /// <param name="task">The task to be executed.</param>
        protected override void QueueTask(Task task) => tasks.Add(task);

        /// <summary>
        /// Provides a list of the scheduled tasks for the debugger to consume.
        /// </summary>
        /// <returns>An enumerable of all tasks currently scheduled.</returns>
        protected override IEnumerable<Task> GetScheduledTasks() => tasks.ToArray();

        /// <summary>
        /// Determines whether a Task may be inlined.
        /// </summary>
        /// <param name="task">The task to be executed.</param>
        /// <param name="taskWasPreviouslyQueued">Whether the task was previously queued.</param>
        /// <returns>true if the task was successfully inlined; otherwise, false.</returns>
        protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)
        {
            return threads.Contains(Thread.CurrentThread) && TryExecuteTask(task);
        }

        /// <summary>Gets the maximum concurrency level supported by this scheduler.</summary>
        public override int MaximumConcurrencyLevel => threads.Length;

        /// <summary>
        /// Cleans up the scheduler by indicating that no more tasks will be queued.
        /// This method blocks until all threads successfully shutdown.
        /// </summary>
        public void Dispose()
        {
            tasks.CompleteAdding();

            foreach (var thread in threads)
                thread.Join();

            tasks.Dispose();
        }
    }
}


text:
package com.amazonaws.services.autoscaling.model;

import java.io.Serializable;

import com.amazonaws.AmazonWebServiceRequest;

/**
 * Container for the parameters to the {@link com.amazonaws.services.autoscaling.AmazonAutoScaling#setDesiredCapacity(SetDesiredCapacityRequest) SetDesiredCapacity operation}.
 *

 * Sets the size of the specified Auto Scaling group.
 *

 *

 * For more information about desired capacity, see
 *  What Is Auto Scaling?
 * in the Auto Scaling Developer Guide .
 *

 *
 * @see com.amazonaws.services.autoscaling.AmazonAutoScaling#setDesiredCapacity(SetDesiredCapacityRequest)
 */
public class SetDesiredCapacityRequest extends AmazonWebServiceRequest implements Serializable, Cloneable {

    /**
     * The name of the Auto Scaling group.
     *

     * Constraints:

     * Length: 1 - 1600

     * Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

     */
    private String autoScalingGroupName;

    /**
     * The number of EC2 instances that should be running in the Auto Scaling
     * group.
     */
    private Integer desiredCapacity;

    /**
     * By default, SetDesiredCapacity overrides any cooldown
     * period associated with the Auto Scaling group. Specify
     * True to make Auto Scaling to wait for the cool-down
     * period associated with the Auto Scaling group to complete before
     * initiating a scaling activity to set your Auto Scaling group to its
     * new capacity.
     */
    private Boolean honorCooldown;

    /**
     * The name of the Auto Scaling group.
     *

     * Constraints:

     * Length: 1 - 1600

     * Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

     *
     * @return The name of the Auto Scaling group.
     */
    public String getAutoScalingGroupName() {
        return autoScalingGroupName;
    }

    /**
     * The name of the Auto Scaling group.
     *

     * Constraints:

     * Length: 1 - 1600

     * Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

     *
     * @param autoScalingGroupName The name of the Auto Scaling group.
     */
    public void setAutoScalingGroupName(String autoScalingGroupName) {
        this.autoScalingGroupName = autoScalingGroupName;
    }

    /**
     * The name of the Auto Scaling group.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *

     * Constraints:

     * Length: 1 - 1600

     * Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

     *
     * @param autoScalingGroupName The name of the Auto Scaling group.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public SetDesiredCapacityRequest withAutoScalingGroupName(String autoScalingGroupName) {
        this.autoScalingGroupName = autoScalingGroupName;
        return this;
    }

    /**
     * The number of EC2 instances that should be running in the Auto Scaling
     * group.
     *
     * @return The number of EC2 instances that should be running in the Auto Scaling
     *         group.
     */
    public Integer getDesiredCapacity() {
        return desiredCapacity;
    }

    /**
     * The number of EC2 instances that should be running in the Auto Scaling
     * group.
     *
     * @param desiredCapacity The number of EC2 instances that should be running in the Auto Scaling
     *         group.
     */
    public void setDesiredCapacity(Integer desiredCapacity) {
        this.desiredCapacity = desiredCapacity;
    }

    /**
     * The number of EC2 instances that should be running in the Auto Scaling
     * group.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param desiredCapacity The number of EC2 instances that should be running in the Auto Scaling
     *         group.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public SetDesiredCapacityRequest withDesiredCapacity(Integer desiredCapacity) {
        this.desiredCapacity = desiredCapacity;
        return this;
    }

    /**
     * By default, SetDesiredCapacity overrides any cooldown
     * period associated with the Auto Scaling group. Specify
     * True to make Auto Scaling to wait for the cool-down
     * period associated with the Auto Scaling group to complete before
     * initiating a scaling activity to set your Auto Scaling group to its
     * new capacity.
     *
     * @return By default, SetDesiredCapacity overrides any cooldown
     *         period associated with the Auto Scaling group. Specify
     *         True to make Auto Scaling to wait for the cool-down
     *         period associated with the Auto Scaling group to complete before
     *         initiating a scaling activity to set your Auto Scaling group to its
     *         new capacity.
     */
    public Boolean isHonorCooldown() {
        return honorCooldown;
    }

    /**
     * By default, SetDesiredCapacity overrides any cooldown
     * period associated with the Auto Scaling group. Specify
     * True to make Auto Scaling to wait for the cool-down
     * period associated with the Auto Scaling group to complete before
     * initiating a scaling activity to set your Auto Scaling group to its
     * new capacity.
     *
     * @param honorCooldown By default, SetDesiredCapacity overrides any cooldown
     *         period associated with the Auto Scaling group. Specify
     *         True to make Auto Scaling to wait for the cool-down
     *         period associated with the Auto Scaling group to complete before
     *         initiating a scaling activity to set your Auto Scaling group to its
     *         new capacity.
     */
    public void setHonorCooldown(Boolean honorCooldown) {
        this.honorCooldown = honorCooldown;
    }

    /**
     * By default, SetDesiredCapacity overrides any cooldown
     * period associated with the Auto Scaling group. Specify
     * True to make Auto Scaling to wait for the cool-down
     * period associated with the Auto Scaling group to complete before
     * initiating a scaling activity to set your Auto Scaling group to its
     * new capacity.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param honorCooldown By default, SetDesiredCapacity overrides any cooldown
     *         period associated with the Auto Scaling group. Specify
     *         True to make Auto Scaling to wait for the cool-down
     *         period associated with the Auto Scaling group to complete before
     *         initiating a scaling activity to set your Auto Scaling group to its
     *         new capacity.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public SetDesiredCapacityRequest withHonorCooldown(Boolean honorCooldown) {
        this.honorCooldown = honorCooldown;
        return this;
    }

    /**
     * By default, SetDesiredCapacity overrides any cooldown
     * period associated with the Auto Scaling group. Specify
     * True to make Auto Scaling to wait for the cool-down
     * period associated with the Auto Scaling group to complete before
     * initiating a scaling activity to set your Auto Scaling group to its
     * new capacity.
     *
     * @return By default, SetDesiredCapacity overrides any cooldown
     *         period associated with the Auto Scaling group. Specify
     *         True to make Auto Scaling to wait for the cool-down
     *         period associated with the Auto Scaling group to complete before
     *         initiating a scaling activity to set your Auto Scaling group to its
     *         new capacity.
     */
    public Boolean getHonorCooldown() {
        return honorCooldown;
    }

    /**
     * Returns a string representation of this object; useful for testing and
     * debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getAutoScalingGroupName() != null) sb.append("AutoScalingGroupName: " + getAutoScalingGroupName() + ",");
        if (getDesiredCapacity() != null) sb.append("DesiredCapacity: " + getDesiredCapacity() + ",");
        if (isHonorCooldown() != null) sb.append("HonorCooldown: " + isHonorCooldown() );
        sb.append("}");
        return sb.toString();
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getAutoScalingGroupName() == null) ? 0 : getAutoScalingGroupName().hashCode());
        hashCode = prime * hashCode + ((getDesiredCapacity() == null) ? 0 : getDesiredCapacity().hashCode());
        hashCode = prime * hashCode + ((isHonorCooldown() == null) ? 0 : isHonorCooldown().hashCode());
        return hashCode;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null) return false;

        if (obj instanceof SetDesiredCapacityRequest == false) return false;
        SetDesiredCapacityRequest other = (SetDesiredCapacityRequest)obj;

        if (other.getAutoScalingGroupName() == null ^ this.getAutoScalingGroupName() == null) return false;
        if (other.getAutoScalingGroupName() != null && other.getAutoScalingGroupName().equals(this.getAutoScalingGroupName()) == false) return false;
        if (other.getDesiredCapacity() == null ^ this.getDesiredCapacity() == null) return false;
        if (other.getDesiredCapacity() != null && other.getDesiredCapacity().equals(this.getDesiredCapacity()) == false) return false;
        if (other.isHonorCooldown() == null ^ this.isHonorCooldown() == null) return false;
        if (other.isHonorCooldown() != null && other.isHonorCooldown().equals(this.isHonorCooldown()) == false) return false;
        return true;
    }

    @Override
    public SetDesiredCapacityRequest clone() {

            return (SetDesiredCapacityRequest) super.clone();
    }

}


text:
/*! \file error.h */
#include <Inventor/C/errors/error.h>

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */

#include <cstdio>
#include <cassert>
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* STDERR_FILENO */
#endif /* HAVE_UNISTD_H */

#ifdef COIN_THREADSAFE
#include <Inventor/C/threads/mutex.h>
#include "threads/mutexp.h"
#endif /* COIN_THREADSAFE */

#include "coindefs.h"
#include "tidbitsp.h"

/* ********************************************************************** */

/*!
  \struct cc_error error.h Inventor/C/errors/error.h
  \typedef struct cc_error cc_error
  \brief The cc_error type is an internal Coin structure for error management.
  \ingroup errors

  This is a Coin extension.
*/

/*!
  \var cc_error::debugstring

  The error message.
*/

/*!
  \typedef void cc_error_cb(const cc_error * err, void * data)

  The definition for an error callback handler.
*/

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#ifdef COIN_THREADSAFE
static cc_mutex * cc_error_mutex = NULL;
static void cc_error_mutex_cleanup(void) {
  if (cc_error_mutex) {
    cc_mutex_destruct(cc_error_mutex);
    cc_error_mutex = NULL;
  }
}
#endif /* COIN_THREADSAFE */

/* FIXME: should be hidden from public API, and only visible to
   subclasses. 20020526 mortene. */
/*!
  \relates cc_error
*/

void
cc_error_default_handler_cb(const cc_error * err, void * COIN_UNUSED_ARG(data))
{
  /* It is not possible to "pass" C library data from the application
     to a MSWin .DLL, so this is necessary to get hold of the stderr
     FILE*. Just using fprintf(stderr, ...) or fprintf(stdout, ...)
     directly will result in a crash when Coin has been compiled as a
     .DLL. */
  FILE * coin_stderr = coin_get_stderr();

  if (coin_stderr) {
    const cc_string * str = cc_error_get_debug_string(err);
    (void)fprintf(coin_stderr, "%s\n", cc_string_get_text(str));
    (void)fflush(coin_stderr);
  }
}

static cc_error_cb * cc_error_callback = cc_error_default_handler_cb;
static void * cc_error_callback_data = NULL;
static SbBool cc_error_cleanup_function_set = FALSE;

static void
cc_error_cleanup(void)
{
  cc_error_callback = cc_error_default_handler_cb;
  cc_error_callback_data = NULL;
  cc_error_cleanup_function_set = FALSE;
}

/*!
  \relates cc_error
*/

void
cc_error_init(cc_error * me)
{
  cc_string_construct(&(me->debugstring));
}

/*!
  \relates cc_error
*/

void
cc_error_clean(cc_error * me)
{
  cc_string_clean(&(me->debugstring));
}

/*!
  \relates cc_error
*/

void
cc_error_copy(const cc_error * src, cc_error * dst)
{
  cc_string_set_string(&dst->debugstring, &src->debugstring);
}

/*!
  \relates cc_error
*/

void
cc_error_set_debug_string(cc_error * me, const char * str)
{
  cc_string_set_text(&(me->debugstring), str);
}

/*!
  \relates cc_error
*/

void
cc_error_append_to_debug_string(cc_error * me, const char * str)
{
  cc_string_append_text(&(me->debugstring), str);
}

/*!
  \relates cc_error
*/

void
cc_error_handle(cc_error * me)
{
  void * arg = NULL;

  cc_error_cb * function = cc_error_get_handler(&arg);
  assert(function != NULL);

#ifdef COIN_THREADSAFE
  if (!cc_error_mutex) {
    /* extra locking to avoid that two threads create the mutex */
    /* FIXME: this is not smart, as it means that if the first call to
       e.g. SoDebugError::post*() will hang if it happens within a
       region where the global lock is already taken. 20050708 mortene.*/
    cc_mutex_global_lock();
    if (cc_error_mutex == NULL) {
      cc_error_mutex = cc_mutex_construct();
      coin_atexit(cc_error_mutex_cleanup, CC_ATEXIT_MSG_SUBSYSTEM);
    }
    cc_mutex_global_unlock();
  }
  cc_mutex_lock(cc_error_mutex);
#endif /* COIN_THREADSAFE */

  (*function)(me, arg);

#ifdef COIN_THREADSAFE
  cc_mutex_unlock(cc_error_mutex);
#endif /* COIN_THREADSAFE */
}

/*!
  \relates cc_error
*/

void
cc_error_set_handler_callback(cc_error_cb * func, void * data)
{
  cc_error_callback = func;
  cc_error_callback_data = data;

  if (!cc_error_cleanup_function_set) {
    coin_atexit((coin_atexit_f*) cc_error_cleanup, CC_ATEXIT_MSG_SUBSYSTEM);
    cc_error_cleanup_function_set = TRUE;
  }
}

/*!
  \relates cc_error
*/

cc_error_cb *
cc_error_get_handler_callback(void)
{
  return cc_error_callback;
}

/*!
  \relates cc_error
*/

void *
cc_error_get_handler_data(void)
{
  return cc_error_callback_data;
}

/*!
  \relates cc_error
*/

cc_error_cb *
cc_error_get_handler(void ** data)
{
  *data = cc_error_callback_data;
  return cc_error_callback;
}

/*!
  \relates cc_error
*/

const cc_string *
cc_error_get_debug_string(const cc_error * me)
{
  return &(me->debugstring);
}

/*!
  \relates cc_error
*/

void
cc_error_post_arglist(const char * format, va_list args)
{
  cc_string s;
  cc_error err;

  cc_string_construct(&s);

  cc_string_vsprintf(&s, format, args);

  cc_error_init(&err);
  cc_error_set_debug_string(&err, cc_string_get_text(&s));
  cc_error_handle(&err);
  cc_error_clean(&err);

  cc_string_clean(&s);
}

/*!
  \relates cc_error
*/

void
cc_error_post(const char * format, ...)
{
  va_list argptr;
  va_start(argptr, format);
  cc_error_post_arglist(format, argptr);
  va_end(argptr);
}

#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */


text:
package com.sjcqs.rawlauncher.items.suggestions;

import android.support.annotation.NonNull;
import android.support.v4.util.ArrayMap;
import android.support.v7.util.SortedList;
import android.util.Log;

import com.sjcqs.rawlauncher.items.Item;

import java.text.Collator;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Locale;
import java.util.Map;
import java.util.NoSuchElementException;

/**
 * Created by satyan on 8/25/17.
 */

public class SuggestionList implements List<Suggestion>  {

    private SortedList<Suggestion> list;
    private Map<Suggestion, Item> itemMap;
    private final SortedList.Callback<Suggestion> callback = new SortedList.Callback<Suggestion>() {
        private final Collator COLLATOR = Collator.getInstance(Locale.getDefault());

        @Override
        public int compare(Suggestion item1, Suggestion item2) {
            double rate1 = item1.getRate(), rate2 = item2.getRate();
            int rateCmp = Double.compare(rate1,rate2);
            return (rateCmp != 0 ?
                    rateCmp : (COLLATOR.compare(item1.getLabel(), item2.getLabel())));
        }

        @Override
        public void onChanged(int position, int count) {

        }

        @Override
        public boolean areContentsTheSame(Suggestion oldItem, Suggestion newItem) {
            return oldItem.getRate() == newItem.getRate();
        }

        @Override
        public boolean areItemsTheSame(Suggestion item1, Suggestion item2) {
            return item1.getItem().equals(item2.getItem());
        }

        @Override
        public void onInserted(int position, int count) {

        }

        @Override
        public void onRemoved(int position, int count) {

        }

        @Override
        public void onMoved(int fromPosition, int toPosition) {
        }
    };

    public SuggestionList() {
        list = new SortedList<>(Suggestion.class, callback);
        itemMap = new ArrayMap<>();
    }

    public boolean containsItem(Item item){
        return itemMap.containsValue(item);
    }

    @Override
    public int size() {
        return list.size();
    }

    @Override
    public boolean isEmpty() {
        return size() == 0;
    }

    @Override
    public boolean contains(Object o) {
        return o instanceof Suggestion && list.indexOf((Suggestion) o) != SortedList.INVALID_POSITION;
    }

    @NonNull
    @Override
    public Iterator<Suggestion> iterator() {
        return new Iterator<Suggestion>() {
            private int index = 0;
            @Override
            public boolean hasNext() {
                return index < size();
            }

            @Override
            public Suggestion next() {
                if (!hasNext()){
                    throw new NoSuchElementException();
                }
                Suggestion suggestion = get(index);
                index++;
                return suggestion;
            }
        };
    }

    @NonNull
    @Override
    public Suggestion[] toArray() {
        Suggestion array[] = new Suggestion[size()];
        for (int i = 0; i < this.size(); i++) {
            array[i] = get(i);
        }
        return array;
    }

    @NonNull
    @Override
    public <T> T[] toArray(@NonNull T[] ts) {

        for (int i = 0; i < ts.length; i++) {
            if (i < size()){
                ts[i] = (T) get(i);
            } else {
                ts[i] = null;
            }
        }
        return ts;
    }

    @Override
    public boolean add(Suggestion suggestion) {
        list.add(suggestion);
        itemMap.put(suggestion,suggestion.getItem());
        return contains(suggestion);
    }

    @Override
    public boolean remove(Object o) {
        itemMap.remove(o);
        return list.remove((Suggestion) o);
    }

    @Override
    public boolean containsAll(@NonNull Collection<?> collection) {
        for (Object o : collection) {
            Suggestion suggestion = (Suggestion)o;
            if (!contains(suggestion)){
                return false;
            }
        }
        return true;
    }

    @Override
    public boolean addAll(@NonNull Collection<? extends Suggestion> collection) {
        list.addAll((Collection<Suggestion>) collection);
        for (Suggestion suggestion : collection) {
            itemMap.put(suggestion, suggestion.getItem());
        }
        return containsAll(collection);
    }

    @Override
    public boolean addAll(int i, @NonNull Collection<? extends Suggestion> collection) {
        list.addAll((Collection<Suggestion>) collection);
        for (Suggestion suggestion : collection) {
            itemMap.put(suggestion, suggestion.getItem());
        }
        return containsAll(collection);
    }

    @Override
    public boolean removeAll(@NonNull Collection<?> collection) {
        boolean changed = false;
        for (Object o : collection) {
            Suggestion suggestion = (Suggestion)o;
            if(remove(suggestion)){
                itemMap.remove(suggestion);
                changed = true;
            }
        }
        return changed;
    }

    @Override
    public boolean retainAll(@NonNull Collection<?> collection) {
        throw new UnsupportedOperationException();
    }

    @Override
    public void clear() {
        list.clear();
        itemMap.clear();
    }

    @Override
    public Suggestion get(int i) {
        return list.get(i);
    }

    @Override
    public Suggestion set(int i, Suggestion suggestion) {
        throw new UnsupportedOperationException();
    }

    @Override
    public void add(int i, Suggestion suggestion) {
        throw new UnsupportedOperationException();
    }

    @Override
    public Suggestion remove(int i) {
        Suggestion suggestion = list.removeItemAt(i);
        itemMap.remove(suggestion);
        return suggestion;
    }

    @Override
    public int indexOf(Object o) {
        return list.indexOf((Suggestion) o);
    }

    @Override
    public int lastIndexOf(Object o) {
        return list.indexOf((Suggestion) o);
    }

    @Override
    public ListIterator<Suggestion> listIterator() {
        return listIterator(0);
    }

    @NonNull
    @Override
    public ListIterator<Suggestion> listIterator(final int i) {
        return new ListIterator<Suggestion>() {
            private int index = i;
            @Override
            public boolean hasNext() {
                return index < size();
            }

            @Override
            public Suggestion next() {
                if (!hasNext()){
                    throw new NoSuchElementException();
                }
                Suggestion suggestion = get(index);
                index++;
                return suggestion;
            }

            @Override
            public boolean hasPrevious() {
                int prev = index - 1;
                return prev > 0 && prev < size();
            }

            @Override
            public Suggestion previous() {
                if (!hasPrevious()){
                    throw new NoSuchElementException();
                }
                Suggestion suggestion = get(index);
                index--;
                return suggestion;
            }

            @Override
            public int nextIndex() {
                return index + 1;
            }

            @Override
            public int previousIndex() {
                return index - 1;
            }

            @Override
            public void remove() {
                Suggestion suggestion = list.removeItemAt(index);
                itemMap.remove(suggestion);
            }

            @Override
            public void set(Suggestion suggestion) {
                throw new UnsupportedOperationException();
            }

            @Override
            public void add(Suggestion suggestion) {
                throw new UnsupportedOperationException();
            }
        };
    }

    @NonNull
    @Override
    public List<Suggestion> subList(int fromIndex, int toIndex) {
        SuggestionList list = new SuggestionList();
        if((fromIndex < 0 || toIndex > size() || fromIndex > toIndex)){
            throw new IndexOutOfBoundsException();
        }
        for (int i = fromIndex; i < toIndex; i++) {
            list.add(get(i));
        }
        return list;
    }
}


text:
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>

Gửi tin nhắn

1.Nếu bạn không có thời gian chat thì bạn có thể nhập số điện thoại tại đây.

          2.Bạn có thể gửi email cho chúng tôi, chúng tôi sẽ trả lời câu hỏi của bạn.

1.Số điện thoại

 hoặc

2. Email

             <form id="frm-gui-tin-nhan-dienthoai" action="DangKyKham/Luu_sdt_tinnhan" method="post" style="margin:0 20px">

                 Số điện thoại:
                 <input type="text" class="form-control" name="dienthoai" id="_dienthoai" placeholder="Số điện thoại của bạn">

          Chọn khoa :
           <select class="form-control" name="khoa" id="khoa">
          <?php
          $catDB = new CatalogDB();
        foreach ($catDB->getParentActive() as $item) {
              echo "<option value=\"".$item->idLoai."\">".$item->TieuDe."</option>\n";
          }
          ?>
          </select>

                 Nội dung:
                 <textarea class="form-control" name="noidung" id="DH-noidung" placeholder="Nội dung mà bạn khám"></textarea>

             </form>

           <form id="frm-gui-tin-nhan-email" action="<?php echo base_url(); ?>DangKyKham/Luu_email_tinnhan" method="post" style="margin:0 20px;">

               Email:
               <input type="text" class="form-control" name="email" id="DH-email" placeholder="Email của bạn">

          Chọn khoa :
           <select class="form-control" name="khoa" id="khoa">
          <?php
          $catDB = new CatalogDB();
        foreach ($catDB->getParentActive() as $item) {
              echo "<option value=\"".$item->idLoai."\">".$item->TieuDe."</option>\n";
          }
          ?>
          </select>

               Nội dung:
               <textarea class="form-control" name="noidung" id="DH-noidung" placeholder="Nội dung mà bạn khám"></textarea>

            </form>

        <button type="button" class="btn btn-default" data-dismiss="modal">Đóng lại</button>
        <input type="submit" class="btn btn-primary" id="btn_gui_tin_nhan" value="Lưu lại"/>


text:
function doc_cascading_styles
% DOC_CASCADING_STYLES  Document set_plot cascading style options
%
% CALL:
%    doc_cascading_styles
%
% This function writes the full chart for the cascading styles based on the
% contents of of the 'set_plot>help_cascading_styles' MATLAB documentation.
% It converts it to a table to be produced in a form useful to Sphinx.
%

%----------------------------------------------------------------------
% Copyright (c) 2011-2013
%   Derek J. Dalle <derek.dalle@gmail.com> and
%   Sean M. Torrez <smtorrez@umich.edu>
%
% Distributed under the terms of the Modified BSD License.
%
% The full license is available in the file LICENSE, distributed with
% this software package in the top-level directory.
%----------------------------------------------------------------------

% Versions:
%  2013-10-11 @dalle   : First version

% Be safe.
try
    % Get the text of the help file.
    s = help('set_plot>help_cascading_styles');

    % Split into lines.
    lines = strtrim(regexp(s, '\n', 'split'));

    % Open the file.
    fid = fopen('cascading_styles.rst', 'w');
catch err
    % Setup failed.
    fprintf(2, 'Setup failed:\n   %s\n', err.message);
    return
end

% Be safe with the file.
try
    % Write some metadata.
    fprintf(fid, '..\n');
    fprintf(fid, '    This is an automatically generated file. Do not edit it.\n');
    fprintf(fid, '    To change its contents, see ''doc_cascading_stiles.m''.\n');
    fprintf(fid, '\n    Written on %s\n', datestr(date, 29));
    fprintf(fid, '\n\n');

    % Make a label.
    fprintf(fid, '.. _cascading-styles:\n\n');

    % Write the headings.
    fprintf(fid, 'Cascading Style Chart\n');
    fprintf(fid, '---------------------\n');

    % Introductory text.
    fprintf(fid, '\nThe following lists all cascading styles and the values\n');
    fprintf(fid, 'that the parent and child format keys take.\n\n');

    % Number of parent keys found.
    nParent = 0;
    % Bars...
    bar1 = pnchar('-', 17);
    bar2 = pnchar('-', 47);
    bar3 = pnchar('-', 23);
    bar4 = pnchar('-', 23);
    bar5 = pnchar('=', 17);
    bar6 = pnchar('=', 23);
    bar7 = pnchar('=', 23);
    % Loop through the lines.
    for i = 1:numel(lines);
        % Get the line
        line = lines{i};
        % Try to find a parent.  (e.g. 'FigureStyle')
        n = regexp(line, '(?<parent>\w+)', 'names');
        % Check if any were found.
        if numel(n) == 1
            % Check the Parent count.
            if nParent > 0
               % Print the bottom of the previous table.
               fprintf(fid, '%8s+%s+%s+%s+\n', '', bar1, bar3, bar4);
            end
            % Increase the parent number.
            nParent = nParent + 1;
            % Reset value count.
            nValue = 0;
            nChild = 1;
            % Print the headings.
            fprintf(fid, '\n    **%s**\n', n.parent);
            % Table headings.
            fprintf(fid, '%8s+%s+%s+\n', '', bar1, bar2);
            fprintf(fid, '%8s| %-15s | %-45s |\n', '', 'Value', 'Child');
            fprintf(fid, '%8s+%s+%s+%s+\n', '',bar5, bar6, bar7);
            continue
        elseif nParent == 0
            % Don't even read the line.
            continue
        end
        % Check for a parent value. (e.g. '''pretty''')
        n = regexp(line, '^[''\w]+$');
        % Check if one was found.
        if numel(n) == 1
            % Check Value count.
            if nValue > 0
                % Print the tabile formatting for the previous value.
                fprintf(fid, '%8s+%s+%s+%s+\n', '', bar1, bar3, bar4);
            end
            % Increase the value count.
            nValue = nValue + 1;
            % Reset the child count.
            nChild = 0;
            % Print the value.
            fprintf(fid, '%8s| %-15s ', '', ['``',line,'``']);
            continue
        end
        % Check for a child. (e.g. 'AspectRatio   -> ''auto''')
        n = regexp(line, '(?<key>\w+)\s*->\s*(?<value>.*$)', 'names');
        % Cehck if one was found.
        if numel(n) == 1
            % Check the Child count.
            if nChild > 0
                % Print the table formatting for the previous line.
                fprintf(fid, '%8s|%17s+%s+%s+\n', '', '', bar3, bar4);
                % Print the beginning of the line.
                fprintf(fid, '%8s|%17s', '', '');
            end
            % Print the name/value pair.
            fprintf(fid, '| %-21s | %-21s |\n', n.key, ['``',n.value,'``']);

            % Increase the child count.
            nChild = nChild + 1;
        end
    end

    % Print the bottom of the last table.
    fprintf(fid, '%8s+%s+%s+%s+\n', '', bar1, bar3, bar4);

catch err
    % Write failed.
    fprintf(2, 'Write failed:\n   %s\n', err.message);
    % Close the file.
    fclose(fid);
    return
end

% Close the file.
try
    fclose(fid);
catch err
    fprintf(2, 'Failed to close file:\n    %s\n', err.messae);
end

% --- SUBFUNCTION: Create string of N chars ---
function s = pnchar(c, n)
%PNCHAR Repeat a char n times
%
% CALL:
%    s = pnchar(c, n)
%
% INPUTS:
%    c : single character
%    n : number of times to print character.
%
% OUTPUTS:
%    s : character repeated ``n`` times
%
% This function takes a single character and repeats it ``n`` times.  The
% input must be a char with exactly one character.
%

% String to give to sprintf to produce n spaces.
t = sprintf('%%%is', n);

% Make a string of n spaces.
s = sprintf(t, '');

% Replace the spaces with the character.
s = strrep(s, ' ', c);


text:
{% extends '!layout.html' %}

{% block footer %}

         Back to top

         © Copyright {{ copyright }}

         Created using Sphinx 1.3.6.

         Icons made by Trinh Ho from www.flaticon.com is licensed by CC 3.0 BY

{% endblock %}


text:
source /usr/local/opt/chruby/share/chruby/chruby.sh
chruby ruby

xcodebuild -workspace framework/YapDatabaseExtensions.xcworkspace -scheme YapDatabaseExtensions test | xcpretty -c && exit ${PIPESTATUS[0]}


text:
import clientInstance from './client-instance';

const tagResource = {
	getTags: function() {
		return clientInstance.get('/tags');
	}
}

export default tagResource;


text:
! { dg-do compile }
! This checks the fix for PR30406.
!
! Contributed by Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
!===============================================================

function f()
  logical(8) :: f
  f = .false._8
end function f


text:
var Rawr = require('../lib/promptosaurus');

// create new instance
var rawr = new Rawr();

// add new queries. First pass question as a string,
// then add a callback (optional, see the handleAllOnDone.js example).
// The callback will be passed the user's input.
rawr.add('what is this? ', function(data){

    // to keep your logging formatted as the rest of Promptosaurus'
    // output, you can use it's own .log() function
    this.log(data);
})
.add('who are you? ', function(data){
    this.log(data);
})
.done(function(){

    // handle any clean up or final processing
    // once all questions have been addressed.
    this.log('We are done. You can go now');
})
.ask();


text:
package stdlib

import (
	"fmt"
	"reflect"
)

func init() {
	Symbols["fmt"] = map[string]reflect.Value{
		// function, constant and variable definitions
		"Errorf":   reflect.ValueOf(fmt.Errorf),
		"Fprint":   reflect.ValueOf(fmt.Fprint),
		"Fprintf":  reflect.ValueOf(fmt.Fprintf),
		"Fprintln": reflect.ValueOf(fmt.Fprintln),
		"Fscan":    reflect.ValueOf(fmt.Fscan),
		"Fscanf":   reflect.ValueOf(fmt.Fscanf),
		"Fscanln":  reflect.ValueOf(fmt.Fscanln),
		"Print":    reflect.ValueOf(fmt.Print),
		"Printf":   reflect.ValueOf(fmt.Printf),
		"Println":  reflect.ValueOf(fmt.Println),
		"Scan":     reflect.ValueOf(fmt.Scan),
		"Scanf":    reflect.ValueOf(fmt.Scanf),
		"Scanln":   reflect.ValueOf(fmt.Scanln),
		"Sprint":   reflect.ValueOf(fmt.Sprint),
		"Sprintf":  reflect.ValueOf(fmt.Sprintf),
		"Sprintln": reflect.ValueOf(fmt.Sprintln),
		"Sscan":    reflect.ValueOf(fmt.Sscan),
		"Sscanf":   reflect.ValueOf(fmt.Sscanf),
		"Sscanln":  reflect.ValueOf(fmt.Sscanln),

		// type definitions
		"Formatter":  reflect.ValueOf((*fmt.Formatter)(nil)),
		"GoStringer": reflect.ValueOf((*fmt.GoStringer)(nil)),
		"ScanState":  reflect.ValueOf((*fmt.ScanState)(nil)),
		"Scanner":    reflect.ValueOf((*fmt.Scanner)(nil)),
		"State":      reflect.ValueOf((*fmt.State)(nil)),
		"Stringer":   reflect.ValueOf((*fmt.Stringer)(nil)),

		// interface wrapper definitions
		"_Formatter":  reflect.ValueOf((*_fmt_Formatter)(nil)),
		"_GoStringer": reflect.ValueOf((*_fmt_GoStringer)(nil)),
		"_ScanState":  reflect.ValueOf((*_fmt_ScanState)(nil)),
		"_Scanner":    reflect.ValueOf((*_fmt_Scanner)(nil)),
		"_State":      reflect.ValueOf((*_fmt_State)(nil)),
		"_Stringer":   reflect.ValueOf((*_fmt_Stringer)(nil)),
	}
}

// _fmt_Formatter is an interface wrapper for Formatter type
type _fmt_Formatter struct {
	WFormat func(f fmt.State, c rune)
}

func (W _fmt_Formatter) Format(f fmt.State, c rune) { W.WFormat(f, c) }

// _fmt_GoStringer is an interface wrapper for GoStringer type
type _fmt_GoStringer struct {
	WGoString func() string
}

func (W _fmt_GoStringer) GoString() string { return W.WGoString() }

// _fmt_ScanState is an interface wrapper for ScanState type
type _fmt_ScanState struct {
	WRead       func(buf []byte) (n int, err error)
	WReadRune   func() (r rune, size int, err error)
	WSkipSpace  func()
	WToken      func(skipSpace bool, f func(rune) bool) (token []byte, err error)
	WUnreadRune func() error
	WWidth      func() (wid int, ok bool)
}

func (W _fmt_ScanState) Read(buf []byte) (n int, err error)      { return W.WRead(buf) }
func (W _fmt_ScanState) ReadRune() (r rune, size int, err error) { return W.WReadRune() }
func (W _fmt_ScanState) SkipSpace()                              { W.WSkipSpace() }
func (W _fmt_ScanState) Token(skipSpace bool, f func(rune) bool) (token []byte, err error) {
	return W.WToken(skipSpace, f)
}
func (W _fmt_ScanState) UnreadRune() error         { return W.WUnreadRune() }
func (W _fmt_ScanState) Width() (wid int, ok bool) { return W.WWidth() }

// _fmt_Scanner is an interface wrapper for Scanner type
type _fmt_Scanner struct {
	WScan func(state fmt.ScanState, verb rune) error
}

func (W _fmt_Scanner) Scan(state fmt.ScanState, verb rune) error { return W.WScan(state, verb) }

// _fmt_State is an interface wrapper for State type
type _fmt_State struct {
	WFlag      func(c int) bool
	WPrecision func() (prec int, ok bool)
	WWidth     func() (wid int, ok bool)
	WWrite     func(b []byte) (n int, err error)
}

func (W _fmt_State) Flag(c int) bool                   { return W.WFlag(c) }
func (W _fmt_State) Precision() (prec int, ok bool)    { return W.WPrecision() }
func (W _fmt_State) Width() (wid int, ok bool)         { return W.WWidth() }
func (W _fmt_State) Write(b []byte) (n int, err error) { return W.WWrite(b) }

// _fmt_Stringer is an interface wrapper for Stringer type
type _fmt_Stringer struct {
	WString func() string
}

func (W _fmt_Stringer) String() string { return W.WString() }


text:
window.onload = inicia;

function inicia() {
	campo=document.getElementById("txtMoneda");
	campo.focus();
	var url="scripts/catalogoGeneral.php?operacion=6&tabla=cmonedas&campo=cveMoneda&campo2=descripcion";
	$("divClave").className = "autocomplete";

	new Ajax.Autocompleter("txtMoneda", "divClave", url, {paramName: "caracteres",afterUpdateElement:existe});
	$("btnBuscar").onclick=existe;

	$("btnCancelar").disabled=true;
	$("btnGuardar").disabled=true;
	$("btnModificar").disabled=true;

	//Total de Monedas
	$Ajax("scripts/catalogoTotales.php?operacion=2&opc=2", {onfinish: cargarTotales, tipoRespuesta: $tipo.JSON, avisoCargando:"loading"});

	$("btnCancelar").onclick=cancelar;
	$Ajax("scripts/datosGenerales.php?operacion=8&valor="+	$("txtMoneda").value, {onfinish: llenaGrid, tipoRespuesta: $tipo.JSON, avisoCargando:"loading"});

	//Evaluaremos según usuario, las acciones que podrá realizar
	numP=$("txthPer").value;
	if(numP==6)
	{
		$("btnGuardar").style.visibility="hidden";
		$("btnModificar").style.visibility="hidden";

		$("btnGuardar").style.display="none";
		$("btnModificar").style.display="none";
	}

}
function cancelar()
{
	$("txtMoneda").disabled=false;
	$("status").innerHTML="";
	$("act_des").style.visibility="hidden";
	$("act_des").style.display="none";
	$("btnBuscar").disabled=false;
	$("btnModificar").disabled=true;
	$("btnGuardar").disabled=true;
	$("btnCancelar").disabled=true;
	quitar_invalidos();
	campo=document.getElementById("txtMoneda");
	campo.focus();
	$Ajax("scripts/catalogoTotales.php?operacion=2&opc=2", {onfinish: cargarTotales, tipoRespuesta: $tipo.JSON, avisoCargando:"loading"});
	$Ajax("scripts/datosGenerales.php?operacion=8&valor="+	$("txtMoneda").value, {onfinish: llenaGrid, tipoRespuesta: $tipo.JSON, avisoCargando:"loading"});
}
var indiceFilaFormulario=1;
function llenaGrid(campos)
{
	if(document.getElementById("tblMonedas").rows.length>1){
		var ultima = document.getElementById("tblMonedas").rows.length;
		for(var j=ultima; j>1; j--){
			 document.getElementById("tblMonedas").deleteRow(1);
		}
	}
	var separacion=0;
	for (var i=0; i<campos.length; i++){
		 var campo = campos[i];
		 if((separacion==0)&&(campo.estado==0)) //Se agregara una separacion para Activos e Inactivos
		 {
			 myNewRow = document.getElementById("tblMonedas").insertRow(-1);
			 myNewRow.id=indiceFilaFormulario;
			 myNewCell=myNewRow.insertCell(-1);
			 myNewCell.colSpan="3";
			 myNewCell.innerHTML="Monedas Desactivadas	";
			 separacion++;
			 indiceFilaFormulario++;

		 }
		 myNewRow = document.getElementById("tblMonedas").insertRow(-1);
		 myNewRow.id=indiceFilaFormulario;
		 myNewCell=myNewRow.insertCell(-1);
		 myNewCell.innerHTML="" + campo.cveMoneda +"	";
		 myNewCell=myNewRow.insertCell(-1);
		 myNewCell.innerHTML="" + campo.descripcion +"	";
		 myNewCell=myNewRow.insertCell(-1);
		 myNewCell.innerHTML="<input type='hidden' id='cveDetalle_"+indiceFilaFormulario+"' value='" + campo.cveMoneda +"'/><input type='button' name='Editar["+					indiceFilaFormulario+"]'  value='Editar' onclick='editarDetalle(this,cveDetalle_"+indiceFilaFormulario+".value)'>	";
		 indiceFilaFormulario++;
   }
}
function existe() {

	if ($("txtMoneda").value!=""){
		var url = "scripts/existe.php?keys=8&table=cmonedas&field1=cveMoneda&f1value=" + $("txtMoneda").value;
		$Ajax(url, {onfinish: next_existe, tipoRespuesta: $tipo.JSON});
	}else{ alert("Ingrese una Moneda."); document.getElementById("txtMoneda").focus();}
}
function editarDetalle(obj,cveDetalle){
	$("txtMoneda").value=cveDetalle;
	existe();
	//Eliminamos la fila una vez que se cargan los datos
	var oTr = obj;
	while(oTr.nodeName.toLowerCase()!='tr'){
	  oTr=oTr.parentNode;
	}
	var root = oTr.parentNode;
	root.removeChild(oTr);
}
function insertar(){
	if(allgood()){
		var valores = "&txtMoneda="		+$("txtMoneda").value		+"&txtDescripcion="		+$("txtDescripcion").value;
		var usuario="&usuario="+$("hdnUsuario").value  +  "&empresa="+$("hdnEmpresaS").value;
		valores=valores +usuario;
		$Ajax("scripts/administraMonedas.php?operacion=1", {metodo: $metodo.POST, onfinish: fin, parametros: valores, avisoCargando:"loading"});
		$("txtMoneda").disabled=false;
	}
	$Ajax("scripts/datosGenerales.php?operacion=8&valor="+	$("txtMoneda").value, {onfinish: llenaGrid, tipoRespuesta: $tipo.JSON, avisoCargando:"loading"});
}

function actualizar(){
	if(allgood()){
		if($("chkActivado").checked)
			 estado=1;
		else estado=0;

		var valores = "&txtMoneda="		+$("txtMoneda").value		+"&txtDescripcion="		+$("txtDescripcion").value+"&txthClaveMon="		+$("txthClaveMon").value;
		var usuario="&usuario="+$("hdnUsuario").value  +  "&empresa="+$("hdnEmpresaS").value+"&estado="		+estado;
		valores=valores +usuario;
		$Ajax("scripts/administraMonedas.php?operacion=2", {metodo: $metodo.POST, onfinish: fin, parametros: valores, avisoCargando:"loading"});
		$("txtMoneda").disabled=false;
	}
	$Ajax("scripts/datosGenerales.php?operacion=8&valor="+	$("txtMoneda").value, {onfinish: llenaGrid, tipoRespuesta: $tipo.JSON, avisoCargando:"loading"});
}

function llenaDatos(campos){

	//Tomamos el primer objeto del json, ya que siempre devolvera un unico registro
	var campo = campos[0];
	//Asignamos los valores a los campos del formulario para que el usuario pueda visualizarlos
	if(campo.estado==1)
	{
		$("lblActivado").value="Activado";
		$("chkActivado").checked=true;
	}
	else if(campo.estado==0)
	{
		$("lblActivado").value="Desactivado";
		$("chkActivado").checked=false;
	}
	$("txtMoneda").value = campo.cveMoneda;
	$("txthClaveMon").value = campo.cveMoneda;
	$("txtDescripcion").value = campo.descripcion;

}

function fin(res){
	alert(res);
	cancelar();
}

function allgood(){
	var notGood = 0;
	if($("txtMoneda").value=='')  {$("txtMoneda").addClassName("invalid"); notGood ++;} else{$("txtMoneda").removeClassName("invalid");}
	if($("txtDescripcion").value=='')  {$("txtDescripcion").addClassName("invalid"); notGood ++;} else{$("txtDescripcion").removeClassName("invalid");}

	if(notGood > 0){
		alert("Hay Informacion erronea que ha sido resaltada en color!");
		return false;
	} else {return true;}

}
function next_existe(ex){
	//Extraemos el valor retornado por el servidor en un objeto json
	var exx=ex[0];
	var exists = exx.existe;
	var cve=exx.cve;
	$("btnBuscar").disabled=true;
	$("btnCancelar").disabled=false;
	campo=document.getElementById("txtMoneda");
	campo.focus();

	//si el valor es mayor que cero, entonces el registro existe
	if (exists > 0){
		$Ajax("scripts/datosGenerales.php?operacion=7&valor="+cve, {onfinish: llenaDatos, tipoRespuesta: $tipo.JSON, avisoCargando:"loading"});
		$("act_des").style.visibility="visible";
	    if (navigator.appName.indexOf("Explorer") != -1)
			$("act_des").style.display="block";
		else
			$("act_des").style.display="table-row";
		//cambiamos el manejador del boton actualizar para que apunte a la funcion
		//que actualiza el registro
		$("btnModificar").disabled=false;
		$("btnModificar").onclick=actualizar;
		$("btnGuardar").disabled=true;
		//imprimimos un mensaje de actualizando
		$("status").innerHTML="Actualizando registro";
	}
	else{	//Si la funcion devolvio cero, no existe el registro
		$("act_des").style.visibility="hidden";
		$("act_des").style.display="none";
		$("btnModificar").disabled=true;
		//limpiamos los campos del form
		$("btnGuardar").disabled=false;
		$("btnGuardar").onclick=insertar;
		//imprimimos un aviso de que se trata de un registro nuevo
		$("status").innerHTML="Agregando nuevo registro";
		//el boton borrar y modificar no es útil aqui, por lo tanto lo ocultamos
		$("btnbuscar").disabled=true;
   }
}


text:
package com.example.fw;

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

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

import com.example.tests.ContactName;

public class ContactHelper extends HelperBase {

	public static boolean CREATION = true;
	public static boolean MODIFICATION = false;

	public ContactHelper(ApplicationManager manager) {
		super(manager);
	}

	public void addNameContact() {
		click(By.linkText("add new"));
	}

	public void fillContactForm(ContactName contact, boolean formType) {
		type(By.name("firstname"), contact.firstname);
		type(By.name("lastname"), contact.lastname);
		type(By.name("address"), contact.address);
		type(By.name("home"), contact.home);
		type(By.name("mobile"), contact.mobiletel);
		type(By.name("work"), contact.worktel);
		type(By.name("email"), contact.email);
		type(By.name("email2"), contact.email2);
		selectByText(By.name("bday"), contact.bday);
		selectByText(By.name("bmonth"), contact.bmonth);
		type(By.name("byear"), contact.byear);
		if (formType == CREATION) {
			// selectByText(By.name("new_group"), group 1);
		} else {
			if (driver.findElements(By.name("new_group")).size() != 0) {
				throw new Error("Group selector exists in cintact modification form");
			}
		}

		type(By.name("address2"), contact.address2);
		type(By.name("phone2"), contact.phone2);
	}

	public void submitContactCreation() {
		click(By.name("submit"));
	}

	public void returnToContactPage() {
		click(By.linkText("home page"));
	}

	public void selectContactByIndex(int index) {
		click(By.xpath("//input[@name='selected[]'][" + (index + 1) + "]"));
	}

	public void modeContactEdit() {
		driver.findElement(By.cssSelector("img[alt=\"Edit\"]")).click();
	}

	public void initContactRemove() {
		driver.findElement(By.xpath("(//input[@name='update'])[2]")).click();
	}

	public void initContactModification(int index) {
		selectContactByIndex(index);
		modeContactEdit();
		initContactEdit();
	}

	public void initContactEdit() {
		driver.findElement(By.name("update")).click();
	}

	public List<ContactName> getContacts() {
		List<ContactName> contacts = new ArrayList<ContactName>();
		List<WebElement> rows = getContactRows();
		for (WebElement row : rows) {
			ContactName contact = new ContactName(null, null, null, null, null, null, null, null, null, null, null,
					null, null);

			contact.lastname = getLastNameInRow(row);
			if (contact.lastname == null) {
				contact.lastname = "";
			}
			contact.firstname = getFirstNameInRow(row);
			if (contact.firstname == null) {
				contact.firstname = "";
			}
			contacts.add(contact);
		}
		return contacts;
	}

	public String getFirstNameInRow(WebElement row) {
		return row.findElement(By.xpath("./td[3]")).getText();
	}

	public String getLastNameInRow(WebElement row) {
		return row.findElement(By.xpath("./td[2]")).getText();
	}

	private List<WebElement> getContactRows() {
		return driver.findElements(By.xpath("//tr[@name='entry']"));
	}

}
package com.example.fw;

import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

import com.example.tests.ContactName;
import com.example.utils.SortedListOf;;

public class ContactHelper extends HelperBase {

	public static boolean CREATION = false;
	public static boolean MODIFICATION = false;

	public ContactHelper(ApplicationManager manager) {
		super(manager);
	}

	private SortedListOf<ContactName> cachedContacts;

	public SortedListOf<ContactName> getContacts() {
		if (cachedContacts == null) {
			rebuildCacheContacts();
		}
		return cachedContacts;
	}

	private void rebuildCacheContacts() {
		cachedContacts = new SortedListOf<ContactName>();
		manager.navigateTo().mainPage();
		List<WebElement> rows = getContactRows();
		for (WebElement row : rows) {
			ContactName contact = new ContactName().withfirstname(row.findElement(By.xpath(".//td[3]")).getText())
					.withlastname(row.findElement(By.xpath(".//td[2]")).getText());
			cachedContacts.add(contact);
		}
	}

	public ContactHelper createContact(ContactName contact) {
		manager.navigateTo().mainPage();
		clickOnAddContact();
		fillContactForm(contact, CREATION);
		submitContactCreation();
		returnToContactPage();
		rebuildCacheContacts();
		return this;
	}

	public void modifyContact(int contactId, ContactName contact) {
		getContactId();
		selectContactByIndex(contactId);
		fillContactForm(contact, MODIFICATION);
		submitContactEdit(contactId);
		returnToContactPage();
		rebuildCacheContacts();
	}

	public void deleteContact(int contactId) {
		selectContactByIndex(contactId);
		submitContactDeletion();
		returnToContactPage();
		rebuildCacheContacts();
	}

	// -----------------------------------------------------------------------------------------

	public ContactHelper clickOnAddContact() {
		click(By.linkText("add new"));
		return this;
	}

	public SortedListOf<Integer> getContactId() {
		SortedListOf<Integer> contactId = new SortedListOf<Integer>();
		List<WebElement> checkboxes = driver.findElements(By
				.xpath("//tr[@name=\"entry\"]/td[@class=\"center\"]/input[@type=\"checkbox\"][@name=\"selected[]\"]"));
		for (WebElement checkbox : checkboxes) {
			String idx = checkbox.getAttribute("value");
			int index = Integer.parseInt(idx);
			contactId.add(index);
		}
		return contactId;
	}

	public ContactHelper fillContactForm(ContactName contact, boolean formtype) {
		type(By.name("firstname"), contact.getFirstname());
		type(By.name("lastname"), contact.getLastname());
		type(By.name("address"), contact.getAddress());
		type(By.name("home"), contact.getHome());
		type(By.name("mobile"), contact.getMobiletel());
		type(By.name("work"), contact.getWorktel());
		type(By.name("email"), contact.getEmail());
		type(By.name("email2"), contact.getEmail2());
		selectByText(By.name("bday"), contact.getBday());
		selectByText(By.name("bmonth"), contact.getBmonth());
		type(By.name("byear"), contact.getByear());

		if (formtype == CREATION) {
			// selectByText(By.name("new_group"), group 1);
		} else {
			if (driver.findElements(By.name("new_group")).size() != 0) {
				throw new Error("Group selector exists in contact modification form");
			}
		}

		type(By.name("address2"), contact.getAddress2());
		type(By.name("phone2"), contact.getPhone2());
		return this;
	}

	public ContactHelper submitContactCreation() {
		click(By.name("submit"));
		cachedContacts = null;
		return this;
	}

	public ContactHelper returnToContactPage() {
		driver.findElement(By.linkText("home page")).click();
		return this;
	}

	public ContactHelper selectContactByIndex(int index) {
		click(By.xpath("//a[@href=\"edit.php?id=" + index + "\"]"));
		return this;
	}

	public ContactHelper modeContactEdit() {
		driver.findElement(By.cssSelector("img[alt=\"Edit\"]")).click();
		return this;
	}

	public String getFirstNameInRow(WebElement row) {
		return row.findElement(By.xpath("./td[2]")).getText();
	}

	public String getLastNameInRow(WebElement row) {
		return row.findElement(By.xpath("./td[3]")).getText();
	}

	private List<WebElement> getContactRows() {
		return driver.findElements(By.xpath("//tr[@name='entry']"));
	}

	public ContactHelper submitContactEdit(int index) {
		driver.findElement(By.name("update")).click();
		cachedContacts = null;
		return this;
	}

	public ContactHelper submitContactDeletion() {
		driver.findElement(By.xpath("(//input[@name='update'])[2]")).click();
		cachedContacts = null;
		return this;
	}

}