text:
const IS_PRODUCTION = (process.argv.length > 2 && process.argv[2] === "prod");

var express = require('express');
var bodyParser = require('body-parser');
var emailUtil = require('./email');
var SocketIO = require('socket.io');

var cloud_services = {
  google_drive: require('./google.js'),
  dropbox: require('./dropbox.js')
}

var mongo_express = require('mongo-express/lib/middleware');
var mongo_express_config = require('mongo-express/config.default.js');
var ResetDatabase = require('./resetdatabase');
var MongoDB = require('mongodb');
var ObjectID = MongoDB.ObjectID;
var MongoClient = MongoDB.MongoClient;
var url = 'mongodb://localhost:27017/nectarime';

var app = express();
var server = null;
var port = 0;

if (IS_PRODUCTION) {
  var fs = require('fs');
  var https = require('https');
  var privateKey  = fs.readFileSync('sslcert/nectari_me.key', 'utf8');
  var certificate = fs.readFileSync('sslcert/nectari_me.crt', 'utf8');
  var credentials = {key: privateKey, cert: certificate};
  server = https.createServer(credentials, app);
  port = 443;

  // set up plain http server with a route to redirect http to https
  var redirectApp = express();
  redirectApp.get('*',function(req,res){
      res.redirect('https://' + req.get('host') + req.originalUrl)
  })
  redirectApp.listen(80);
}
else {
  var http = require('http');
  server = http.createServer(app);
  port = 3000;
}

var io = SocketIO(server);

/**
 * Get the user ID from a token. Returns -1 (an invalid ID)
 * if it fails.
 */
function getUserIdFromToken(authorizationLine) {
  try {
    // Cut off "Bearer " from the header value.
    var token = authorizationLine.slice(7);
    // Convert the base64 string to a UTF-8 string.
    var regularString = new Buffer(token, 'base64').toString('utf8');
    // Convert the UTF-8 string into a JavaScript object.
    var tokenObj = JSON.parse(regularString);
    var id = tokenObj['id'];
    // Check that id is a string.
    if (typeof id === 'string') {
      return id;
    } else {
      // Not a string. Return "", an invalid ID.
      return "";
    }
  } catch (e) {
    // Return an invalid ID.
    return -1;
  }
}

MongoClient.connect(url, function(err, db) {
  app.use(bodyParser.text());
  app.use(bodyParser.json());
  app.use(express.static('../client/build'));
  app.use('/mongo_express', mongo_express(mongo_express_config));
  // Add custom endpoints here

  function getUserData(user, callback) {
    db.collection('users').findOne({
      _id: user
    }, function(err, userData) {
      if (err) {
        // An error occured.
        return callback(err);
      } else if (userData === null) {
        // User not found.
        return callback(null, null);
      }
      callback(null, userData);
    });
  }

  // service = userData.cloud_services[req.params.service]
  function getToken(service, callback) {
    db.collection('cloud_services').findOne({
      _id: service
    }, function(err, token) {
      if (err) {
        // An error occured.
        return callback(err);
      } else if (token === null) {
        // Token not found.
        return callback(null, null);
      }
      callback(null, token);
    })
  }

  // getUserData
  app.get('/users/:userId', function(req, res) {
    var userId = req.params.userId;
    var fromUser = getUserIdFromToken(req.get('Authorization'));
    if (fromUser === userId) {
      getUserData(new ObjectID(userId), function(err, userData) {
        if (err) {
          // Database Error
          // Internal Error: 500
          res.status(500).send("Database error: " + err);
        } else if (userData === null) {
          res.status(400).send("Could not find User: " + userId);
        } else {
          res.send(userData);
        }
      });
    } else {
      // 401: Unauthorized request.
      res.status(401).end();
    }
  });

  app.put('/users/:userId', function(req, res) {
    var userId = req.params.userId;
    var fromUser = getUserIdFromToken(req.get('Authorization'));
    // Check that the requester is the user itself.
    if (fromUser === userId) {
      db.collection('users').updateOne({
        _id: new ObjectID(userId)
      }, {$set: {
      "name": req.body.name,
      "email": req.body.email,
      "password": req.body.password,
      "image": req.body.image
    }}, function(err, result) {
      if (err) {
        // Database Error
        // Internal Error: 500
        res.status(500).send("Database error: " + err);
      } else if (userId === null) {
        res.status(400).send("Could not find User: " + userId);
      } else if (result.modifiedCount === 0) {
          // 400: Bad request.
      return res.status(400).end();
    }
  });
}
});

  app.get('/user/cloudservices', function(req, res) {
    var userId = new ObjectID(getUserIdFromToken(req.get('Authorization')));
    getUserData(new ObjectID(userId), function(err, userData) {
      if (err) {
        // Database Error
        // Internal Error: 500
        res.status(500).send("Database error: " + err);
      } else if (userData === null) {
        res.status(400).send("Could not find User: " + userId);
      } else {
        res.send(userData.cloud_services);
      }
    });
  });

  app.get('/user/cloudservices/:service/oauth', function(req, res) {
    res.writeHead(302, {
    'Location': cloud_services[req.params.service].getOAuthURL()
    });
    res.end();
  });

  app.post('/email', function(req,res) {
    var body = req.body;
    emailUtil.sendEmail(
      body.email,
      'contact@nectari.me',
      body.typeOfIssue,
      'Name: ' + body.name + '\nEmail: ' + body.email + '\n\n' + body.question,
      (data) => {
        if (data.success) {
          res.send({ success : true });
        } else {
          res.status(400).end();
        }
      }
    );
  });

  //After clicking on "Add Connection" button, this adds a new cloud service
  // for that cloud service to user.
  app.post('/user/cloudservices/:service', function(req, res) {
    var body = req.body;
    cloud_services[req.params.service].getTokenFromKey(body, token => {
      if(token == null) {
        res.status(403).end();
      } else {
        var userId = getUserIdFromToken(req.get('Authorization'));
        db.collection('cloud_services').insertOne(token, err => {
          if (err) {
            res.status(500).send("Database error: " + err);
          } else {
            var $set = {};
            $set["cloud_services." + req.params.service] = token._id
            db.collection('users').updateOne(
              { "_id" : new ObjectID(userId) },
              { $set: $set },
              function(err) {
                if (err) {
                  res.status(500).send("Database error: " + err);
                } else {
                  getUserData(new ObjectID(userId), function(err, userData) {
                    if (err) {
                      res.status(500).send("Database error: " + err);
                    } else if (userData === null) {
                      res.status(400).send("Could not find User: " + userId);
                    } else {
                      res.send(userData.cloud_services);
                    }
                  });
                }
              }
            );
          }
        });
      }
    });
  })

  app.delete('/user/cloudservices/:type', function(req, res) {
    var userId = new ObjectID(getUserIdFromToken(req.get('Authorization')));
    getUserData(new ObjectID(userId), function(err, userData) {
      if (err) {
        res.status(500).send("Database error: " + err);
      } else if (userData === null) {
        res.status(400).send("Could not find User: " + userId);
      } else {
        var $unset = {};
        $unset["cloud_services." + req.params.type] = ""
        db.collection('users').updateOne(
          { "_id" : new ObjectID(userId) },
          { $unset: $unset},
          function(err) {
            if (err) {
              res.status(500).send("Database error: " + err);
            } else {
              delete userData.cloud_services[req.params.type];
              res.send(userData.cloud_services);
            }
          }
        );
      }
    });
  });

  app.get('/user/cloudservices/:service/files', function(req, res) {
    var userId = new ObjectID(getUserIdFromToken(req.get('Authorization')));
    getUserData(userId, function(err, userData) {
      if (err) {
        // Database Error
        // Internal Error: 500
        res.status(500).send("Database error: " + err);
      } else if (userData === null) {
        res.status(400).send("Could not find User: " + userId);
      } else {
        if (userData.cloud_services[req.params.service] == null) {
          res.status(403).end()
        }
        var tokenId = userData.cloud_services[req.params.service];
        getToken(tokenId, function(err, token) {
          if (err) {
            // Database Error
            res.status(500).send("Database error: " + err);
          } else if (token === null) {
            res.status(400).send("Could not find Cloud Service: " + tokenId)
          } else {
            var path = req.query.path;
            var cursor = req.query.cursor;
            cloud_services[req.params.service].getFiles(token, path, cursor, response => {
              if(response == null) {
                res.status(400).end();
              } else {
                res.send(response);
              }
            });
          }
        })
      }
    });
  })

  app.get('/user/cloudservices/:service/file/:fileId', function(req, res) {
    var userId = new ObjectID(getUserIdFromToken(req.get('Authorization')));
    getUserData(userId, function(err, userData) {
      if (err) {
        // Database Error
        // Internal Error: 500
        res.status(500).send("Database error: " + err);
      } else if (userData === null) {
        res.status(400).send("Could not find User: " + userId);
      } else {
        if (userData.cloud_services[req.params.service] == null) {
          res.status(403).end()
        }
        var tokenId = userData.cloud_services[req.params.service];
        getToken(tokenId, function(err, token) {
          if (err) {
            // Database Error
            res.status(500).send("Database error: " + err);
          } else if (token === null) {
            res.status(400).send("Could not find Cloud Service: " + tokenId)
          } else {
            cloud_services[req.params.service].getSharedLink(token, req.params.fileId, response => {
              if(response == null) {
                res.status(400).end();
              } else {
                res.send(response);
              }
            });
          }
        })
      }
    });
  })

  io.on('connection', function (socket) {
    socket.send({action: 'init'});
    setTimeout(() => {
      socket.disconnect(true);
    }, 45000);
  });

  app.post('/device/url', function(req, res) {
    var userId = new ObjectID(getUserIdFromToken(req.get('Authorization')));
    if (userId != null) {
      var body = req.body;
      var url = body.url;
      var socketId = body.deviceId;
      var socket = io.sockets.sockets[socketId];
      if (socket != null) {
        socket.send({action: 'url', url: url}, (data) => {
          if (data.success) {
            res.send();
          } else {
            res.status(500).end();
          }
          socket.disconnect(true);
        });
      } else {
        res.status(400).end();
      }
    } else {
      res.status(401).end();
    }
  })

  // Reset the database.
  app.post('/resetdb', function(req, res) {
    console.log("Resetting database...");
    ResetDatabase(db, function() {
      res.send();
    })
  });

  /**
  * Translate JSON Schema Validation failures into error 400s.
  */
  app.use(function(err, req, res, next) {
    if (err.name === 'JsonSchemaValidation') {
      // Set a bad request http response status
      res.status(400).end();
    } else {
      // It's some other sort of error; pass it to next error middleware handler
      next(err);
    }
  });

  server.listen(port, function () {
    console.log('Example app listening on port ' + port + "!");
  });
});


text:
function showhidefield1()
 {
   if (document.frm1.upload_form.checked)
   {
     document.getElementById("hideablearea1").style.display = "block";
   }
   else
   {
     document.getElementById("hideablearea1").style.display = "none";
   }
 }

function showhidefield2()
 {
   if (document.frm2.new_international_rate.checked)
   {
     document.getElementById("hideablearea2").style.display = "block";
   }
   else
   {
     document.getElementById("hideablearea2").style.display = "none";
   }
 }

function validateFiles(inputFile) {
  var maxExceededMessage = "This file exceeds the maximum allowed file size";
  var extErrorMessage = "Only image file with extension: .jpg, .jpeg, .gif or .png is allowed";
  var allowedExtension = ["jpg", "jpeg", "gif", "png"];

  var extName;
  var maxFileSize = $(inputFile).data('max-file-size');
  var sizeExceeded = false;
  var extError = false;

  $.each(inputFile.files, function() {
    if (this.size && maxFileSize && this.size > parseInt(maxFileSize)) {sizeExceeded=true;};
    extName = this.name.split('.').pop();
    if ($.inArray(extName, allowedExtension) == -1) {extError=true;};
  });
  if (sizeExceeded) {
    window.alert(maxExceededMessage);
    $(inputFile).val('');
  };

  if (extError) {
    window.alert(extErrorMessage);
    $(inputFile).val('');
  };
}

redpajama_set_name: RedPajamaGithub


text:
package org.terracotta.offheapstore.storage;

import java.util.Arrays;
import java.util.Random;

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import org.terracotta.offheapstore.OffHeapHashMap;
import org.terracotta.offheapstore.WriteLockedOffHeapClockCache;
import org.terracotta.offheapstore.buffersource.OffHeapBufferSource;
import org.terracotta.offheapstore.paging.UnlimitedPageSource;
import org.terracotta.offheapstore.paging.UpfrontAllocatingPageSource;
import org.terracotta.offheapstore.storage.portability.ByteArrayPortability;
import org.terracotta.offheapstore.storage.portability.SerializablePortability;
import org.terracotta.offheapstore.util.MemoryUnit;
import org.terracotta.offheapstore.util.OffHeapAndDiskStorageEngineDependentTest.OffHeapTestMode;
import org.terracotta.offheapstore.util.ParallelParameterized;
import org.terracotta.offheapstore.util.StorageEngineDependentTest;

@RunWith(Parameterized.class)
public class OffHeapBufferStorageEngineIT extends StorageEngineDependentTest {

  @ParallelParameterized.Parameters
  public static Iterable<Object[]> data() {
    return Arrays.asList(
            new Object[] {OffHeapTestMode.REGULAR_INT},
            new Object[] {OffHeapTestMode.REGULAR_LONG},
            new Object[] {OffHeapTestMode.COMPRESSING_INT},
            new Object[] {OffHeapTestMode.COMPRESSING_LONG}
    );
  }

  public OffHeapBufferStorageEngineIT(TestMode mode) {
    super(mode);
  }

  @Test
  public void testEmptyPayload() {
    StorageEngine<byte[], byte[]> engine = create(createPageSource(1, MemoryUnit.MEGABYTES), ByteArrayPortability.INSTANCE, ByteArrayPortability.INSTANCE);

    long p = engine.writeMapping(new byte[0], new byte[0], 0, 0);
    Assert.assertTrue(p >= 0);

    byte[] b = engine.readKey(p, 0);

    Assert.assertNotNull(b);
    Assert.assertEquals(0, b.length);
  }

  @Test
  public void testSmallPayloads() {
    StorageEngine<byte[], byte[]> engine = create(new UnlimitedPageSource(new OffHeapBufferSource()), ByteArrayPortability.INSTANCE, ByteArrayPortability.INSTANCE);

    Random rndm = new Random();

    for (int i = 0; i < 64; i++) {
      byte[] b = new byte[i];

      rndm.nextBytes(b);

      long p = engine.writeMapping(b, b, 0, 0);
      Assert.assertTrue(p >= 0);

      byte[] b2 = engine.readKey(p, 0);

      Assert.assertNotNull(b2);
      Assert.assertArrayEquals(b, b2);

      engine.freeMapping(p, 0, true);
    }
  }

  @Test
  public void testPortabilityCacheInvalidation() {
    OffHeapHashMap<Integer, int[]> map = new WriteLockedOffHeapClockCache<>(new UnlimitedPageSource(new OffHeapBufferSource()), create(new UpfrontAllocatingPageSource(new OffHeapBufferSource(), 1024, 1024), new SerializablePortability(), new SerializablePortability()));

    int[] mutable = new int[1];
    for (int i = 0; i < 100; i++) {
      mutable[0] = i;
      map.put(i, mutable);
      Assert.assertEquals(i, map.get(i)[0]);
    }
  }
}


text:
import metrics_quickstart

def test_quickstart_main(capsys):
    # Run the quickstart, making sure that it runs successfully
    metrics_quickstart.main()
    output = capsys.readouterr()
    assert "Fake latency recorded" in output.out


text:
> `@marko/webpack` >= 7 Only supports Marko 5+.
> For Marko 4 support use `@marko/webpack@6`.

```console
npm install @marko/webpack
```

### Loader: `@marko/webpack/loader`

The loader portion of this module can be used standalone and simply transforms your Marko templates into the appropriate JavaScript depending on your webpack target.

You can override the output by adding a `target` option to the loader of `target: "server" | "browser"`.

### Plugin: `@marko/webpack/plugin`

The plugin actually creates two separate webpack plugins, the `browser` plugin and the `server` plugin.

These are intended to be used in a isomorphic [webpack multi compiler](https://github.com/webpack/webpack/tree/master/examples/multi-compiler) where you are bundling both the server and the browser. The way it works is that the server plugin is going to analyze the top level Marko components in your server and automatically communicate with the browser compiler to retrieve the assets for that template.

This plugin also analyzes the top level Marko templates and determines if it is possible for them to rerender (currently the heuristic is simply does the component have an associated `class` or `component.js`). The plugin will automatically skip sending down any unnecessary top level templates to the browser.

The end result is that you setup a multi compiler (as shown below) and you can simply import Marko templates, and all assets are automatically generated and inlined into an optimized server response. No need to keep track of a webpack manifest yourself!

### Tag: `<webpack-assets>`

The `<webpack-assets>` tag can be used along with the plugin in a multi-compiler setup. This tag allows you to inject `<script>`/`<style>` tags into a server-rendered template for the assets of an entry in the client compiler.

#### Example Usage

```marko
<webpack-assets entry="tracking"/>
```

#### Example Config

```js
// ...
export default [
  {
    entry: "./server.js",
    plugins: [markoPlugin.server]
    // ...
  },
  {
    // ...
    entry: {
      tracking: "./tracking.js"
    },
    plugins: [markoPlugin.browser]
  }
];
```

# Example

```javascript
import MarkoPlugin from "@marko/webpack/plugin";

const markoPlugin = new MarkoPlugin();

export default [
  {
    entry: "./server.js",
    module: {
      rules: [
        {
          test: /\.marko$/,
          loader: "@marko/webpack/loader"
        }
      ]
    },
    plugins: [markoPlugin.server]
  },
  {
    rules: [
      {
        test: /\.marko$/,
        loader: "@marko/webpack/loader"
      },
      // If using `style` blocks with Marko you must use an appropriate loader
      {
        test: /\.css$/,
        use: ["style-loader", "css-loader"]
      }
    ],
    plugins: [markoPlugin.browser]
  }
];
```

## Babel options (Marko 5+)

If you are using Marko 5 with this plugin you can manually override the Babel configuration used by passing a `babelConfig` object along side the `@marko/webpack/loader`. By default Babels regular [config file resolution](https://babeljs.io/docs/en/config-files) will be used.

```javascript
export default {
    module: {
      rules: [
        {
          test: /\.marko$/,
          loader: "@marko/webpack/loader",
          options: {
            babelConfig: {
              presets: [
                ["@babel/preset-env", { node: "current" }]
              ]
            }
          }
        }
      ]
    }
  },
```

## Multiple client-side compilers

Sometimes you need multiple compilers for your client-side bundles. For example, with [`i18n`](https://github.com/webpack/webpack/tree/master/examples/i18n) or [even shipping dynamic runtime bundles to the browser](https://github.com/eBay/arc/tree/master/packages/arc-webpack).

The `@marko/webpack` plugin's `.browser` property can be passed to multiple Webpack compilers. While rendering at runtime, you can provide a `$global.buildName` property to choose which assets from the Webpack compiler are included in the page.

For example, with the Webpack internationalization plugin, you might have a config like the following:

```js
import MarkoPlugin from "@marko/webpack/plugin";
import I18nPlugin from "i18n-webpack-plugin";
import germanTranslations from "./de.json";

const languages = {
  en: null,
  de: germanTranslations
};

const markoPlugin = new MarkoPlugin();

export default [
  {
    name: "Server",
    entry: "./server.js",
    module: {
      rules: [
        {
          test: /\.marko$/,
          loader: "@marko/webpack/loader"
        }
      ]
    },
    plugins: [markoPlugin.server]
  },
  ...Object.keys(languages).map(language => ({
    name: `Browser-${language}`,
    rules: [
      {
        test: /\.marko$/,
        loader: "@marko/webpack/loader"
      },
      // If using `style` blocks with Marko you must use an appropriate loader
      {
        test: /\.css$/,
        use: ["style-loader", "css-loader"]
      }
    ],
    plugins: [new I18nPlugin(languages[language]), markoPlugin.browser]
  }))
];
```

With the above config, you can render your top-level Marko template server-side with a `$global.buildName` like so:

```javascript
template.render({ $global: { buildName: "Browser-de" } });
```

That will automatically send German assets. However, what you _probably_ want instead of always serving German is conditionally sending appropriate assets for a user's locale. This can be done like so:

```javascript
template.render({ $global: { buildName: `Browser-${req.language}` } });
```

**Note:** If a bundle with the provided `buildName` does not exist, an error is thrown.

## Multiple copies of Marko

In some cases you may want to embed multiple isolated copies of Marko on the page. Since Marko relies on some `window` properties to initialize this can cause issues. For example, by default Marko will read the server rendered hydration code from `window.$components`. In Marko you can change these `window` properties by rendering with `{ $global: { runtimeId: "MY_MARKO_RUNTIME_ID" } }` as input on the server side.

This plugin exposes a `runtimeId` option produces output that automatically sets `$global.runtimeId` on the server side and initializes properly in the browser.
The `runtimeId` will default to the [`uniqueName` option](https://webpack.js.org/configuration/output/#outputuniquename) from the server compiler in the webpack config.

```js
import MarkoPlugin from "@marko/webpack/plugin";

const markoPlugin = new MarkoPlugin({
  runtimeId: "MY_MARKO_RUNTIME_ID" // default to webpack `output.uniqueName` option.
});
```

Note: This option will also override the default values for the `jsonpFunction`, `chunkCallbackName` and `hotUpdateFunction` webpack `output` options, which all use global variables, to be prefixed with the `runtimeId`.

## Dynamic public paths

When using the plugin, the server will automatically sync the runtime [`__webpack_public_path__`](https://webpack.js.org/guides/public-path/#on-the-fly) with the browser.
This means that you only need to setup the dynamic public path on the server side.


text:
package net.java.sip.communicator.impl.muc;

import java.util.*;

import net.java.sip.communicator.service.contactsource.*;
import net.java.sip.communicator.service.muc.*;
import net.java.sip.communicator.service.protocol.*;

/**
 * Basic source contact for the chat rooms.
 *
 * @author Hristo Terezov
 */
public class BaseChatRoomSourceContact
    extends SortedGenericSourceContact
{

    /**
     * The parent contact query.
     */
    protected final ContactQuery parentQuery;

    /**
     * The name of the chat room associated with the contact.
     */
    private String chatRoomName;

    /**
     * The ID of the chat room associated with the contact.
     */
    private String chatRoomID;

    /**
     * The protocol provider of the chat room associated with the contact.
     */
    private ProtocolProviderService provider;

    /**
     * Contsructs new chat room source contact.
     * @param chatRoomName the name of the chat room associated with the room.
     * @param chatRoomID the id of the chat room associated with the room.
     * @param query the query associated with the contact.
     * @param pps the protocol provider of the contact.
     */
    public BaseChatRoomSourceContact(String chatRoomName,
        String chatRoomID, ContactQuery query, ProtocolProviderService pps)
    {
        super(query, query.getContactSource(), chatRoomName,
            generateDefaultContactDetails(chatRoomName));

        this.chatRoomName = chatRoomName;
        this.chatRoomID = chatRoomID;
        this.provider = pps;
        this.parentQuery = query;

        initContactProperties(ChatRoomPresenceStatus.CHAT_ROOM_OFFLINE);
        setDisplayDetails(pps.getAccountID().getDisplayName());
    }

    /**
     * Sets the given presence status and the name of the chat room associated
     * with the contact.
     * @param status the presence status to be set.
     */
    protected void initContactProperties(PresenceStatus status)
    {
        setPresenceStatus(status);
        setContactAddress(chatRoomName);
    }

    /**
     * Generates the default contact details for
     * <tt>BaseChatRoomSourceContact</tt> instances.
     *
     * @param chatRoomName the name of the chat room associated with the contact
     * @return list of default <tt>ContactDetail</tt>s for the contact.
     */
    private static List<ContactDetail> generateDefaultContactDetails(
        String chatRoomName)
    {
        ContactDetail contactDetail
            = new ContactDetail(chatRoomName);
        List<Class<? extends OperationSet>> supportedOpSets
            = new ArrayList<Class<? extends OperationSet>>();

        supportedOpSets.add(OperationSetMultiUserChat.class);
        contactDetail.setSupportedOpSets(supportedOpSets);

        List<ContactDetail> contactDetails
            = new ArrayList<ContactDetail>();

        contactDetails.add(contactDetail);
        return contactDetails;
    }

    /**
     * Returns the id of the chat room associated with the contact.
     *
     * @return the chat room id.
     */
    public String getChatRoomID()
    {
        return chatRoomID;
    }

    /**
     * Returns the name of the chat room associated with the contact.
     *
     * @return the chat room name
     */
    public String getChatRoomName()
    {
        return chatRoomName;
    }

    /**
     * Returns the provider of the chat room associated with the contact.
     *
     * @return the provider
     */
    public ProtocolProviderService getProvider()
    {
        return provider;
    }

    /**
     * Returns the index of this source contact in its parent group.
     *
     * @return the index of this contact in its parent
     */
    public int getIndex()
    {
        if(parentQuery instanceof ServerChatRoomQuery)
            return ((ServerChatRoomQuery)parentQuery).indexOf(this);
        return -1;
    }
}


text:
'''Tets for the configuration class'''
import pytest

from pymco import config as _config
from pymco import exc
from pymco.test import ctxt
from pymco.test.utils import mock

def test_init_configfile():
    '''Tests :py:method:`Config.from_configfile` static method.'''
    conf = _config.Config.from_configfile(configfile=ctxt.TEST_CFG)
    assert conf['connector'] == 'activemq'

def test_default_identity():
    '''Tests :py:method:`Congfig.__init__` no identity'''
    _ctxt = ctxt.DEFAULT_CTXT.copy()
    del _ctxt['identity']
    conf = _config.Config(_ctxt)
    assert conf.get('identity') != None

def test_get(config):
    '''Tests :py:method:`Config.get` happy path.'''
    assert config.get('connector') == 'activemq'

def test_get_missing(config):
    '''Tests :py:method:`Config.get` bad path.'''
    with pytest.raises(KeyError):
        config.get('missing')

def test_get_default(config):
    '''Tests :py:method:`Config.get` bad path with default.'''
    assert config.get('missing', default='activemq') == 'activemq'

def test_getint(config):
    '''Tests :py:method:`Config.getint` happy path.'''
    assert config.getint('plugin.activemq.pool.size') == 2

def test_getint_missing(config):
    '''Tests :py:method:`Config.getint` bad path.'''
    with pytest.raises(KeyError):
        config.getint('missing')

def test_getint_default(config):
    '''Tests :py:method:`Config.getint` bad path with default.'''
    assert config.getint('missing', default=1) == 1

def test_getfloat(config):
    '''Tests :py:method:`Config.getfloat` happy path.'''
    assert config.getfloat('plugin.activemq.pool.size') == 2.0

def test_getfloat_missing(config):
    '''Tests :py:method:`Config.getfloat` bad path.'''
    with pytest.raises(KeyError):
        config.getfloat('missing')

def test_getfloat_default(config):
    '''Tests :py:method:`Config.getfloat` bad path with default.'''
    assert config.getfloat('missing', default=1.0) == 1.0

def test_getboolean(config):
    '''Tests :py:method:`Config.getboolean` happy path.'''
    truly = ('y', 'true', '1')
    falsy = ('n', 'false', '0')
    for expected, values in ((True, truly), (False, falsy)):
        with mock.patch.dict(config.config,
                             dict([(val, val) for val in values])):
            for val in values:
                assert config.getboolean(val) == expected

def test_getboolean_missing(config):
    '''Tests :py:method:`Config.getboolean` bad path.'''
    with pytest.raises(KeyError):
        config.getboolean('missing')

def test_getboolean_default(config):
    '''Tests :py:method:`Config.getboolean` bad path with default.'''
    assert config.getboolean('missing', default=True)

def test_length(config):
    '''Test configuration length'''
    assert len(config) == len(config.config)

def test_iter(config):
    '''Test configuration iteration.'''
    assert list(config) == list(config.config)

@mock.patch('pymco.utils.import_object')
def test_get_connector(import_object, config):
    with mock.patch.dict('pymco.connector.Connector.plugins',
                         {'activemq': 'connector.foo.FooConnector'}):
        assert config.get_connector() == import_object.return_value
        import_object.assert_called_once_with('connector.foo.FooConnector',
                                              config=config)

@mock.patch('pymco.utils.import_object')
def test_get_security(import_object, config):
    with mock.patch.dict('pymco.security.SecurityProvider.plugins',
                         {'ssl': 'security.foo.FooProvider'}):
        assert config.get_security() == import_object.return_value
        import_object.assert_called_once_with('security.foo.FooProvider',
                                              config=config)

@mock.patch('pymco.utils.import_object')
def test_get_serializer(import_object, config):
    with mock.patch.dict('pymco.serializers.SerializerBase.plugins',
                         {'yaml': 'serializer.foo.FooSerializer'}):
        assert config.get_serializer('plugin.ssl_serializer'
                                     ) == import_object.return_value
        import_object.assert_called_once_with('serializer.foo.FooSerializer')

def test_get_host_and_ports(config):
    assert config.get_host_and_ports() == [('localhost', 6163),
                                           ('localhost', 6164)]

def test_get_host_and_ports_stomp(config):
    with mock.patch.dict(config.config, {'connector': 'stomp',
                                         'plugin.stomp.host': 'host',
                                         'plugin.stomp.port': '6163'}):
        assert config.get_host_and_ports() == [('host', 6163)]

def test_get_user_and_password(config):
    assert ('mcollective', 'secret') == config.get_user_and_password(
        ('localhost', 6163))

def test_get_user_and_password__raises_value_error(config):
    with pytest.raises(ValueError):
        config.get_user_and_password()

def test_get_user_and_password__raises_config_lookup_error(config):
    with pytest.raises(exc.ConfigLookupError):
        config.get_user_and_password(('host', 345))

def test_get_ssl_params(config):
    assert config.get_ssl_params() == [
        {
            'for_hosts': (('localhost', 6163),),
            'cert_file': 'tests/fixtures/activemq_cert.pem',
            'key_file': 'tests/fixtures/activemq_private.pem',
            'ca_certs': 'tests/fixtures/ca.pem',
        },
        {
            'for_hosts': (('localhost', 6164),),
            'cert_file': 'tests/fixtures/activemq_cert.pem',
            'key_file': 'tests/fixtures/activemq_private.pem',
            'ca_certs': 'tests/fixtures/ca.pem',
        },
    ]

def test_get_ssl_parameters__stomp(config):
    config.config['connector'] = 'stomp'
    assert len(config.get_ssl_params()) == 0

def test_get_conn_params__defaults(config):
    assert config.get_conn_params() == {
        'host_and_ports': [('localhost', 6163), ('localhost', 6164)],
        'reconnect_sleep_initial': 0.01,
        #'reconnect_sleep_increase': ,
        #'reconnect_sleep_jitter': ,
        'reconnect_sleep_max': 30.0,
        'reconnect_attempts_max': 9999999999999999999,
        'timeout': None,
    }

def test_get_conn_params__custom(config):
    config.config['plugin.activemq.initial_reconnect_delay'] = 0.5
    config.config['plugin.activemq.max_recconnect_delay'] = 60
    config.config['plugin.activemq.max_recconect_attempts'] = 5
    config.config['plugin.activemq.timeout'] = 60
    assert config.get_conn_params() == {
        'host_and_ports': [('localhost', 6163), ('localhost', 6164)],
        'reconnect_sleep_initial': 0.5,
        'reconnect_sleep_max': 60,
        'reconnect_attempts_max': 5,
        'timeout': 60,
    }

def test_get_conn_params__stomp(config):
    config.config['connector'] = 'stomp'
    config.config['plugin.stomp.host'] = 'localhost'
    config.config['plugin.stomp.port'] = 6163
    assert config.get_conn_params() == {
        'host_and_ports': [('localhost', 6163)],
    }


text:
**Mermaid diagram generation design doc**

**Objective**

- Explore alternatives for PlantUML for diagram generation.

**Background**

Generating diagram using PlantUML requires making HTTP requests to the PlantUML server. In order to support systems generating several diagrams at once, it is not advisable to rely on an external service which could also affect performance and reliability. This issue also impedes our ability to integrate diagram generation as a part of CI.

**Summary**

Mermaid diagram generator offers users a way to generate diagrams similar to that of what PlantUML diagram generator offers. The four types of diagrams that can be generated are *sequence diagrams*, *integration diagrams*, *endpoint analysis diagrams* and *data model diagrams*. The sysl modules produced from parsing a sysl file contains all the information to generate a mermaid file. The mermaid diagram generator iterates through and prints the appropriate mermaid code. The data model diagram generator makes use of the sysl wrapper that simplifies the sysl modules to maps of simplified types for easy access to defined types.

**Detailed Design**

**Sequence Diagram** (https://github.com/anz-bank/sysl/pull/756)

GenerateSequenceDiagram function takes in a sysl module, an app name and an endpoint as input and returns a string that contains the mermaid code for the sequence diagram. The sysl statements for that app and endpoint is retrieved and iterated through in the function printSequenceDiagramStatements. If the statement is a group or a condition, this function is recursively called. If the statement is a call to another application and endpoint, the function GenerateSequenceDiagram is called recursively and the appropriate mermaid code is generated and stored. For returns, actions and loops, the appropriate mermaid output is generated and stored.

**Integration Diagram** (https://github.com/anz-bank/sysl/pull/787)

Integration diagrams can be generated via three different functions.

- `GenerateFullIntegrationDiagram` takes in the sysl module, iterates through all its applications and stores all the calls that each of the applications makes to other applications and generates and stores the appropriate mermaid output for that relationship.
- `GenerateIntegrationDiagram` takes in an application and does a similar process, but finds all the relationships for that application only.
- `GenerateMultipleAppIntegrationDiagram` takes in a list of applications and follows the same process.

**Endpoint Analysis Diagram** (https://github.com/anz-bank/sysl/pull/803)

The endpoint analysis diagram generator is an extension of integration diagram generator, but it adds the concept of a subgraph from mermaid in order to display the endpoints of each of the applications in the generated diagram.

**Data-model Diagram** (https://github.com/anz-bank/sysl/pull/838)

The data-model diagram generator uses the sysl wrapper library to simplify the process of iterating through types defined in different applications. There are two functions for generating diagrams here.

- `GenerateFullDataDiagram` takes a sysl module and uses the sysl wrapper library to generating a map of strings to Type. The types in these maps can be the either of the following – **tuple, relation, enum, map or empty**. Tuples and relations consist of primitive types, lists of other types or references to other types. If a type refers to or is a list of another type, this relationship is stored and printed in the diagram. Maps take a similar approach as well. Enums do not contain any references, thus appropriate mermaid output is printed directly.
- `GetDataDiagramWithAppAndType` takes a sysl module, along with an app and a type. This runs in a similar fashion to the previous function but it runs through it twice. The first iteration captures all the relationships that exists in that module and this result is used to find all the relationship that the given app and types has to other types. The resulting types are run through in the second iteration and the appropriate mermaid code is generated along with the relationships between the printed types. This uses the class diagram concept in mermaid.
- `GenerateDataDiagramWithMapper` takes a syslwrapper.AppMapper along with an app and a type. This allows mapper.Index and Mapper.ConvertTypes to be run once and passed in when generating large numbers of type diagrams, vastly improving performance.

**Command Line Parameters**

-     sysl diagram --help

Generate mermaid diagrams

Optional flags:

-     --help                  Show context-sensitive help (also try --help-long and --help-man).
-     --version               Show application version.
-     --log="warn"            log level: [off,debug,info,warn,trace]
-     -v, --verbose           enable verbose logging
-     --root=ROOT             sysl root directory for input model file. If root is not found, the module directory becomes the root, but the module can not import with absolute paths (or imports must be
                              relative).
-     -i, --integration           Generate an integration diagram (Optional- specify --app)
-     -s, --sequence              Generate a sequence diagram (Specify --app and --endpoint)
-     -p, --endpointanalysis      Generate an integration diagram with its endpoints (Optional- specify --app)
-     -d, --data                  Generate a Data model diagram
-     -a, --app=APP               Application
-     -e, --endpoint=ENDPOINT     Endpoint
-     -o, --output="diagram.svg"  Output file (Default: diagram.svg)

**Alternatives Considered**

- The current approach in sequence, integration and endpoint analysis uses recursion which makes the resulting string non deterministic which makes it hard to assert the resulting mermaid code. Though it doesn't change the resulting diagram, it would be nice to have a map that hold all the information and iterate through it so that the resulting code is in order.

**Enhancements/Future works**

- Enhancement on this would be to add a logger to detect if there are any nil references for bad inputs.
- Escape special characters instead of replacing them in mermaid code. (https://github.com/mermaid-js/mermaid/issues/170)


text:
class Api::V1::QuestionsController < Api::V1::BaseController
  def index
    authorize Question
    @questions = Question.all
    respond_with @questions
  end

  def show
    @question = Question.find(params[:id])
    authorize @question
    respond_with @question
  end

  def create
    authorize Question
    respond_with(@question = current_resource_owner.questions.create(question_params))
  end

  private

  def question_params
    params.require(:question).permit(:title, :body)
  end
end


text:
import os
import sys

from zplgen import __version__
from setuptools import setup

from codecs import open

# Publish to Pypi
if sys.argv[-1] == 'publish':
    os.system('rm -r dist/')
    os.system('python setup.py sdist')
    os.system('python setup.py bdist_wheel')
    os.system('twine upload dist/* -r pypi')
    sys.exit()

here = os.path.abspath(os.path.dirname(__file__))

# Get the long description from the README file
with open(os.path.join(here, 'README.rst'), encoding='utf-8') as f:
    long_description = f.read()

setup(
    name='zplgen',
    version=__version__,

    description='A library to aid in generating ZPL2 code.',
    long_description=long_description,

    url='https://github.com/kolonialno/zplgen',

    author='Kolonial.no',
    author_email='tech@kolonial.no',

    license='MIT',

    # See https://pypi.python.org/pypi?%3Aaction=list_classifiers
    classifiers=[
        # Maturity
        'Development Status :: 4 - Beta',

        # Indicate who your project is intended for
        'Intended Audience :: Developers',
        'Intended Audience :: Manufacturing',
        'Topic :: Software Development :: Code Generators',

        # Pick your license as you wish (should match "license" above)
        'License :: OSI Approved :: MIT License',

        # Python versions supported
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 3',
    ],

    # What does your project relate to?
    keywords='zpl zpl2',

    packages=['zplgen'],

    install_requires=[
        'future',
    ],
)


text:
@echo off
rem #------------------------------------------------------------------------------
rem # Copyright 2014 Esri
rem # Licensed under the Apache License, Version 2.0 (the "License");
rem # you may not use this file except in compliance with the License.
rem # You may obtain a copy of the License at
rem #
rem #   http://www.apache.org/licenses/LICENSE-2.0
rem #
rem # Unless required by applicable law or agreed to in writing, software
rem # distributed under the License is distributed on an "AS IS" BASIS,
rem # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem # See the License for the specific language governing permissions and
rem # limitations under the License.
rem #==============================================================================
rem # Name:          InstallOpsServer.bat
rem #
rem # Purpose:       This is the main Ops Server installation script.
rem #
rem #==============================================================================
title Operations Server Installer

REM ---------------------------------------------------------------------
REM Set user specified variables
REM ---------------------------------------------------------------------
Call InstallSettings.bat

REM ---------------------------------------------------------------------
REM Set other variables
REM ---------------------------------------------------------------------
set ops_AGSVersion=10.4
set ops_PortalVersion=10.4

REM Define ArcGIS Data Store Path
REM NOTE: must have "\" at end of path
set ops_agsDataStoreDIR=C:\arcgisdatastore\

REM Define PostgreSQL paths
set ops_postgresqlInstallDIR=C:\PostgreSQL\9.3
set ops_postgresqlDataDIR=%ops_postgresqlInstallDIR%\data

REM Define path to Esri SoftwareAuthorization.exe
set ops_softwareAuthExePath="C:\Program Files\Common Files\ArcGIS\bin\SoftwareAuthorization.exe"

REM Define path to ConfigureWebAdaptor.exe
set ops_ConfWebAdaptorExePath="C:\Program Files (x86)\Common Files\ArcGIS\WebAdaptor\IIS\Tools\ConfigureWebAdaptor.exe"

REM ---------------------------------------------------------------------
REM Set the names of ArcGIS Server Web Adaptor and Portal for ArcGIS Web Adaptor
set ops_WebAdaptor_AGS=ags
set ops_WebAdaptor_Portal=arcgis

set sectionBreak===================================================================================
set ops_tempInstallDir=C:\OpsServerInstallTemp
cls

REM ---------------------------------------------------------------------
REM Check if command prompt is running in elevated permissions mode
REM (i.e. "run as administrator)
REM ---------------------------------------------------------------------
echo.
echo --Checking if Windows Command window is running as administrator
echo   by querying LOCAL SERVICE user registry entries...
echo.
reg query HKU\S-1-5-19
if "%ERRORLEVEL%"=="1" (
    echo.
    echo **********************************************************
    echo **  ERROR:
    echo **  You are _NOT_ running Windows Command window
    echo **  in elevated administrator mode ^(i.e., the CMD.exe
    echo **  must be "Run as administrator"^).
    echo **  Exiting InstallOpsServer.bat.
    echo **********************************************************
    echo.
    goto end
)
cls

REM ---------------------------------------------------------------------
REM Check if user "installed" configuration script in correct location
REM ---------------------------------------------------------------------
echo.
echo --Checking if installation scripts are installed in the correct location...

set ops_ScriptRootName=ops-server-config
set ops_ScriptRoot=C:\%ops_ScriptRootName%\

echo %~dp0 | find /I "%ops_ScriptRoot%"

if "%ERRORLEVEL%"=="1" (
    echo.
    echo **********************************************************
    echo **  ERROR:
    echo **  The '%ops_ScriptRootName%' folder is not installed in
    echo **  the correct location. It should be located at:
    echo **  %ops_ScriptRoot%
    echo **  Exiting InstallOpsServer.bat.
    echo **********************************************************
    echo.
    goto end
)
cls

REM ---------------------------------------------------------------------
REM Check if Software Root path exists and you have access to the folder
REM ---------------------------------------------------------------------

echo.
echo --Checking if specified software root path '%ops_softwareRoot%' exists...

if not exist %ops_softwareRoot% (
    echo.
    echo **********************************************************
    echo **  ERROR:
    echo **  The software root path ^(variable 'ops_softwareRoot'^)
    echo **  '%ops_softwareRoot%'
    echo **  you have specified does not exist or your account does
    echo **  not have access to this location.
    echo **  Exiting InstallOpsServer.bat.
    echo **********************************************************
    echo.
    goto end
)
cls

echo.
echo --Checking if you have access to the software root path '%ops_softwareRoot%'...

dir %ops_softwareRoot%
if "%ERRORLEVEL%"=="1" (
    echo.
    echo **********************************************************
    echo **  ERROR:
    echo **  Your account does not have access to the sofware root
    echo **  folder path '%ops_ScriptRoot%'
    echo **  Exiting InstallOpsServer.bat.
    echo **********************************************************
    echo.
    goto end
)
cls

REM ---------------------------------------------------------------------
REM Check software dependencies
REM ---------------------------------------------------------------------
REM Always call SetOverallErrorLevel.bat after running one of the "check"
REM batch files under the "Checks" folder.

REM Set error "flag" to initial "good" value of zero.
set ops_OverallErrLvl=0

REM Check if IIS is running/installed.
Call %~dp0..\SupportFiles\BatchFiles\Checks\IsInstalled_IIS.bat
Call %~dp0..\SupportFiles\BatchFiles\SetOverallErrorLevel.bat %ops_CheckErrLvl%

REM Check if .NET 3.5 is installed.
Call %~dp0..\SupportFiles\BatchFiles\Checks\IsInstalled_NETFramework3_5.bat
Call %~dp0..\SupportFiles\BatchFiles\SetOverallErrorLevel.bat %ops_CheckErrLvl%

REM Check if .NET 4.5 is installed
Call %~dp0..\SupportFiles\BatchFiles\Checks\IsInstalled_NETFramework4_5.bat
Call %~dp0..\SupportFiles\BatchFiles\SetOverallErrorLevel.bat %ops_CheckErrLvl%

REM Pause script execution if dependencies are not met.
Call %~dp0..\SupportFiles\BatchFiles\CheckErrorLevel.bat %ops_OverallErrLvl%

REM Clear screen
cls

:start
REM ---------------------------------------------------------------------
REM Start Block
REM ---------------------------------------------------------------------
echo *************************************************************************
echo *                    Operations Server Installation                     *
echo *************************************************************************
echo.
echo 1. Install
echo.
echo 0. Quit
echo.

set /p choice="Enter the number of your choice: "

if "%choice%"=="1" (
    set opsServerInstallType=Install
    REM was having problems with the IIS check on some systems;
    REM for now, set variable to "NO" so that it does not run
    REM the check. Not critical to run the check, since we do tell
    REM users that they have to uninstall IIS if it is already installed.
    set ops_Check_IIS_Existence=NO
    set ops_Check_DriveExistence=YES
    goto ValidationBeforeExecution
)
if "%choice%"=="0" exit
echo Invalid choice: %choice%
echo.
pause
cls
goto start

:ValidationBeforeExecution
REM ---------------------------------------------------------------------
REM Validate before executing the rest of the installation process
REM ---------------------------------------------------------------------

REM -------------------------------------------
REM Check if IIS is running
REM -------------------------------------------
if "%ops_Check_IIS_Existence%"=="YES" (
    REM ERRORLEVEL values when using the following "sc query" statement...
    REM If IIS service exists and is running: 0
    REM If IIS service exists and is stopped: 1
    REM If IIS service does not exist       : 1

    echo.
    echo.
    echo --Checking if IIS Web Server is running on this machine...
    echo.

    sc query W3SVC | find "RUNNING"
    if "%ERRORLEVEL%"=="0" (
        echo.
        echo **********************************************************
        echo **  ERROR:
        echo **  You have choosen to install Portal on a machine where
        echo **  IIS Web Server is also running. Please stop the IIS service
        echo **  ^(i.e. World Wide Web Publishing Service^) and set the startup
        echo **  type to "Manual", or uninstall IIS Web Server.
        echo **  Exiting InstallOpsServer.bat.
        echo **********************************************************
        echo.
        goto end
    )
    echo  IIS Web Server is not running or is not installed.
    echo.

)

REM -------------------------------------------
REM Check drives specified in cache and data
REM drive variables exist.
REM -------------------------------------------
if "%ops_Check_DriveExistence%"=="YES" (

    REM More info about using 'EXIST' command to determine drive
    REM existance can be found at: http://support.microsoft.com/kb/65994.
    REM An alternate choice to determine drive existance is to use:
    REM WMIC logicaldisk get name | find /I "%ops_cacheDrive%:"
    REM Then check immediately afterward if "%ERRORLEVEL%"=="1",
    REM which means drive letter does not exist.

    echo.
    echo --Checking if specified cache drive '%ops_cacheDrive%' exists...

    if not exist %ops_cacheDrive%:\NUL (
        echo.
        echo **********************************************************
        echo **  ERROR:
        echo **  The cache drive you have specified '%ops_cacheDrive%'
        echo **  does not exist. Either the 'ops_cacheDrive' variable in
        echo **  the InstallOpsServer.bat file is set to an incorrect
        echo **  drive letter or the drive is not mounted.
        echo **  Exiting InstallOpsServer.bat.
        echo **********************************************************
        echo.
        goto end
    ) else (
        echo Cache drive '%ops_cacheDrive%' exists.
    )

    echo.
    echo --Checking if specified data drive '%ops_dataDrive%' exists...

    if not exist %ops_dataDrive%:\NUL (
        echo.
        echo **********************************************************
        echo **  ERROR:
        echo **  The data drive you have specified '%ops_dataDrive%'
        echo **  does not exist. Either the 'ops_dataDrive' variable in
        echo **  the InstallOpsServer.bat file is set to an incorrect
        echo **  drive letter or the drive is not mounted.
        echo **  Exiting InstallOpsServer.bat.
        echo **********************************************************
        echo.
        goto end
    ) else (
        echo Data drive '%ops_dataDrive%' exists.
    )

)

if "%opsServerInstallType%"=="Install" goto Install

:Install
REM ---------------------------------------------------------------------
REM Install Software
REM ---------------------------------------------------------------------
echo.
echo Installation of Ops Server starting...
date /T
time /T
echo.

REM Install RDBMS
if "%ops_install_rdbms%"=="YES" (
    Call %~dp0PostgreSQL\InstallPostgreSQL.bat
)

REM Install ArcGIS Server
if "%ops_install_server%"=="YES" (
    Call %~dp0ArcGISServer\InstallArcGISServer.bat
)

REM Create ArcGIS Server site and data stores
if "%ops_create_ags_site%"=="YES" (
    Call %~dp0ArcGISServer\CreateArcGISServerSite.bat
)

REM Install Web Adaptor
if "%ops_install_webadaptor%"=="YES" (
    Call %~dp0WebAdaptorIIS\InstallWebAdaptor.bat
)

REM Change ArcGIS security configuration
if "%ops_change_ags_security%"=="YES" (
    Call %~dp0ArcGISServer\SupportFiles\ChangeAGSSecurityConfig.bat
)

REM Register ArcGIS Server with the web adaptor as HTTPS
if "%ops_register_ags_https%"=="YES" (
    Call %~dp0WebAdaptorIIS\RegisterAGSwithWebAdaptorHTTPS.bat
)

REM Install ArcGIS Data Store
if "%ops_install_ags_datastore%"=="YES" (
    Call %~dp0ArcGISDataStore\InstallAGSDataStore.bat
)

REM Create ArcGIS Data Store
if "%ops_create_ags_datastore%"=="YES" (
    Call %~dp0ArcGISDataStore\SupportFiles\CreateAGSDataStore.bat
)

REM Install Message Simulator - Copy Message Simulator files and
REM create a Windows Scheduled Task
if "%ops_install_message_simulator%"=="YES" (
    Call %~dp0MessageSimulator\InstallMessageSimulator.bat
)

REM Install Portal Related Software
if "%ops_install_portal%"=="YES" (
    Call %~dp0Portal\InstallPortal.bat
)

REM Install Esri Maps for Office Web Content
if "%ops_install_em4o_webcontent%"=="YES" (
    Call %~dp0EsriMapsForOffice\WebContent\InstallEM4OWebContent.bat
)

REM Create Operations Dashboard ClickOnce Application and deploy to portal folders
if "%ops_create_opsdashboard_installer%"=="YES" (
    Call %~dp0OpsDashboardUtility\CreateOneClickInstaller.bat
)

REM Create the portal primary administrator account
if "%ops_create_portal_admin_account%"=="YES" (
    Call %~dp0Portal\Portal\CreatePortalAdminAccount.bat
)

REM Register portal with the webadaptor
if "%ops_register_portal%"=="YES" (
    Call %~dp0WebAdaptorIIS\RegisterPortalwithWebAdaptor.bat
)

REM Federate ArcGIS Server site with portal, set hosted server,
REM set SSL properties, and reset Utility service URLs
if "%ops_federate_ags%"=="YES" (
    Call %~dp0ArcGISServer\SupportFiles\FederateAGS.bat
)

REM Install ArcGIS GeoEvent Extension for ArcGIS Server
if "%ops_install_geoevent%"=="YES" (
    Call %~dp0GeoEvent\InstallGeoEvent.bat
)

REM Install Geoevent Extension for ArcGIS Server Patches
if "%ops_install_geoevent_patches%"=="YES" (
    Call %~dp0GeoEvent\InstallGeoEventPatches.bat
)

REM Install Predictive Analysis Web Services
if "%ops_install_predictive_analysis%"=="YES" (
    Call %~dp0PredictiveAnalysis\InstallPredictiveAnalysis.bat
)

goto end

:end
REM ---------------------------------------------------------------------
REM End Block
REM ---------------------------------------------------------------------
echo.
echo.
echo %sectionBreak%
echo Clean Up...

REM ------------------------------------------
REM Remove temp install folder
REM ------------------------------------------
echo.
echo Removing temp OpsServer install folder if exists...

IF EXIST %ops_tempInstallDir% (
 rmdir /S /Q %ops_tempInstallDir%
)
echo.
echo.
echo Execution of InstallOpsServer.bat script completed.
date /T
time /T
echo.
pause
REM exit


text:
require 'gem-checkout/repository/git-hub'

RSpec.describe Gem::Checkout::Repository::GitHub do
  let(:uri) { URI.parse('https://github.com/foo/foo') }
  let(:git_uri) { URI.parse('https://github.com/foo/foo.git') }

  subject { described_class.new(uri) }

  let(:git) { instance_double(Gem::Checkout::Repository::Git) }

  before do
    allow(Gem::Checkout::Repository::Git).to receive(:new).with(git_uri).and_return(git)
  end

  describe '#initialize' do
    context 'with a valid GitHub repository page url' do
      let(:uri) { URI.parse('http://github.com/foo/bar?foo=bar&bar=baz#contributing') }
      let(:expected) { URI.parse('https://github.com/foo/bar.git') }

      it 'normalizes the url' do
        allow(Gem::Checkout::Repository::Git).to receive(:new).with(expected)
        subject
      end
    end

    context 'with a non GitHub url' do
      let(:uri) { URI.parse('https://example.com/foo/bar') }
      it 'fails' do
        expect { subject }.to raise_error(described_class::Error::BadURI::NotGitHub)
      end
    end

    context 'with an incomplete GitHub url' do
      let(:uri) { URI.parse('https://github.com/foo') }
      it 'fails' do
        expect { subject }.to raise_error(described_class::Error::BadURI::NoProjectName)
      end
    end

    context 'with a dashed repo name' do
      let(:uri) { URI.parse('https://github.com/foo/bar-baz') }
      let(:expected) { URI.parse('https://github.com/foo/bar-baz.git') }

      it 'uses the correct url' do
        allow(Gem::Checkout::Repository::Git).to receive(:new).with(expected)
        subject
      end
    end

    context 'with various allowed characters' do
      let(:uri) { URI.parse('https://github.com/foo-_./bar-_.') }
      let(:expected) { URI.parse('https://github.com/foo-_./bar-_..git') }

      it 'uses the correct url' do
        allow(Gem::Checkout::Repository::Git).to receive(:new).with(expected)
        subject
      end
    end
  end

  describe '#clone' do
    let(:options) { { directory: 'bar' } }

    context "when cloning succeeds" do
      before do
        allow(git).to receive(:clone)
      end

      it "clones to given directory" do
        expect(git).to receive(:clone).with(options)
        subject.clone(options)
      end
    end

    context "when cloning fails" do
      before do
        allow(git).to receive(:clone).and_raise(Gem::Checkout::Repository::Git::Error)
      end

      it "raises an error" do
        expect do
          subject.clone(options)
        end.to raise_error(Gem::Checkout::Repository::Git::Error)
      end
    end
  end

  describe '#checkout' do
    let(:ref) { 'a0b3de8f' }

    context "when checking out succeeds" do
      before do
        allow(git).to receive(:checkout)
      end

      it "checks out by reference" do
        expect(git).to receive(:checkout).with(ref)
        subject.checkout(ref)
      end
    end

    context "when checking out fails" do
      before do
        allow(git).to receive(:checkout).
          and_raise(Gem::Checkout::Repository::Git::Error)
      end

      it "raises an error" do
        expect do
          subject.checkout(ref)
        end.to raise_error(Gem::Checkout::Repository::Git::Error)
      end
    end
  end

  describe '#get_tag_ref' do
    let(:tag) { '0.1.2' }
    let(:expected_ref) { 'a0b3de8f' }

    context "when the tag exists" do
      before do
        allow(git).to receive(:get_tag_ref).and_return(expected_ref)
      end

      it "returns the tag's hash" do
        expect(subject.get_tag_ref(tag)).to eq(expected_ref)
      end
    end

    context "when the tag does not exist" do
      before do
        allow(git).to receive(:get_tag_ref).
          and_raise(Gem::Checkout::Repository::Git::Error)
      end

      it "raises an error" do
        expect do
          subject.get_tag_ref(tag)
        end.to raise_error(Gem::Checkout::Repository::Git::Error)
      end
    end

    context "when something fails" do
      before do
        allow(git).to receive(:get_tag_ref).
          and_raise(Gem::Checkout::Repository::Git::Error)
      end

      it "raises an error" do
        expect do
          subject.get_tag_ref(tag)
        end.to raise_error(Gem::Checkout::Repository::Git::Error)
      end
    end
  end
end


text:
package org.apache.camel.component.aws.lambda;

import com.amazonaws.Protocol;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.lambda.AWSLambdaClient;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;

import static org.mockito.Mockito.mock;

public class LambdaComponentConfigurationTest extends CamelTestSupport {

    @Test
    public void createEndpointWithMinimalConfiguration() throws Exception {
        AWSLambdaClient awsLambdaClient = mock(AWSLambdaClient.class);
        context.getRegistry().bind("awsLambdaClient", awsLambdaClient);
        LambdaComponent component = context.getComponent("aws-lambda", LambdaComponent.class);
        LambdaEndpoint endpoint = (LambdaEndpoint) component.createEndpoint(
            "aws-lambda://myFunction?operation=getFunction&awsLambdaClient=#awsLambdaClient&accessKey=xxx&secretKey=yyy");

        assertEquals("xxx", endpoint.getConfiguration().getAccessKey());
        assertEquals("yyy", endpoint.getConfiguration().getSecretKey());
        assertNotNull(endpoint.getConfiguration().getAwsLambdaClient());
    }

    @Test(expected = IllegalArgumentException.class)
    public void createEndpointWithoutOperation() throws Exception {
        LambdaComponent component = context.getComponent("aws-lambda", LambdaComponent.class);
        component.createEndpoint("aws-lambda://myFunction");
    }

    @Test(expected = IllegalArgumentException.class)
    public void createEndpointWithoutAmazonLambdaClientConfiguration() throws Exception {
        LambdaComponent component = context.getComponent("aws-lambda", LambdaComponent.class);
        component.createEndpoint("aws-lambda://myFunction?operation=getFunction");
    }

    @Test(expected = IllegalArgumentException.class)
    public void createEndpointWithoutAccessKeyConfiguration() throws Exception {
        LambdaComponent component = context.getComponent("aws-lambda", LambdaComponent.class);
        component.createEndpoint("aws-lambda://myFunction?operation=getFunction&secretKey=yyy");
    }

    @Test(expected = IllegalArgumentException.class)
    public void createEndpointWithoutSecretKeyConfiguration() throws Exception {
        LambdaComponent component = context.getComponent("aws-lambda", LambdaComponent.class);
        component.createEndpoint("aws-lambda://myFunction?operation=getFunction&accessKey=xxx");
    }

    @Test
    public void createEndpointWithoutSecretKeyAndAccessKeyConfiguration() throws Exception {
        AWSLambdaClient awsLambdaClient = mock(AWSLambdaClient.class);
        context.getRegistry().bind("awsLambdaClient", awsLambdaClient);
        LambdaComponent component = context.getComponent("aws-lambda", LambdaComponent.class);
        component.createEndpoint("aws-lambda://myFunction?operation=getFunction&awsLambdaClient=#awsLambdaClient");
    }

    @Test
    public void createEndpointWithComponentElements() throws Exception {
        LambdaComponent component = context.getComponent("aws-lambda", LambdaComponent.class);
        component.getConfiguration().setAccessKey("XXX");
        component.getConfiguration().setSecretKey("YYY");
        LambdaEndpoint endpoint = (LambdaEndpoint)component.createEndpoint("aws-lambda://myFunction");

        assertEquals("myFunction", endpoint.getFunction());
        assertEquals("XXX", endpoint.getConfiguration().getAccessKey());
        assertEquals("YYY", endpoint.getConfiguration().getSecretKey());
    }

    @Test
    public void createEndpointWithComponentAndEndpointElements() throws Exception {
        LambdaComponent component = context.getComponent("aws-lambda", LambdaComponent.class);
        component.getConfiguration().setAccessKey("XXX");
        component.getConfiguration().setSecretKey("YYY");
        component.getConfiguration().setRegion(Regions.US_WEST_1.toString());
        LambdaEndpoint endpoint = (LambdaEndpoint)component.createEndpoint("aws-lambda://myFunction?accessKey=xxxxxx&secretKey=yyyyy&region=US_EAST_1");

        assertEquals("myFunction", endpoint.getFunction());
        assertEquals("xxxxxx", endpoint.getConfiguration().getAccessKey());
        assertEquals("yyyyy", endpoint.getConfiguration().getSecretKey());
        assertEquals("US_EAST_1", endpoint.getConfiguration().getRegion());
    }

    @Test
    public void createEndpointWithComponentEndpointElementsAndProxy() throws Exception {
        LambdaComponent component = context.getComponent("aws-lambda", LambdaComponent.class);
        component.getConfiguration().setAccessKey("XXX");
        component.getConfiguration().setSecretKey("YYY");
        component.getConfiguration().setRegion(Regions.US_WEST_1.toString());
        LambdaEndpoint endpoint = (LambdaEndpoint)component.createEndpoint("aws-lambda://label?accessKey=xxxxxx&secretKey=yyyyy&region=US_EAST_1&proxyHost=localhost&proxyPort=9000&proxyProtocol=HTTP");

        assertEquals("xxxxxx", endpoint.getConfiguration().getAccessKey());
        assertEquals("yyyyy", endpoint.getConfiguration().getSecretKey());
        assertEquals("US_EAST_1", endpoint.getConfiguration().getRegion());
        assertEquals(Protocol.HTTP, endpoint.getConfiguration().getProxyProtocol());
        assertEquals("localhost", endpoint.getConfiguration().getProxyHost());
        assertEquals(Integer.valueOf(9000), endpoint.getConfiguration().getProxyPort());
    }
}


text:
export interface IAppConfig {
  apiEndpoint: string;
  apiUrl: string;
  fileUrl: string;
  OAUTH_KEY: string;
}


text:
using OQF.Net.LanMessaging.NetworkMessageBase;
using OQF.Net.LanMessaging.Types;

namespace OQF.Net.LanMessaging.NetworkMessages.Notifications
{
	public class ClientDisconnect : NetworkMessageBase.NetworkMessageBase
	{
		public ClientDisconnect(ClientId clientId)
			: base(NetworkMessageType.ClientDisconnect, clientId)
		{
		}

		public override string AsString()
		{
			return "----";
		}

		public static ClientDisconnect Parse(ClientId clientId, string s)
		{
			return new ClientDisconnect(clientId);
		}
	}
}


text:
#include "common/debug.hpp"
#include "common/instance.hpp"
#include "common/message.hpp"
#include "common/random.hpp"

#include "test_platform.h"
#include "test_util.hpp"

namespace ot {

void TestMessage(void)
{
    enum : uint16_t
    {
        kMaxSize    = (kBufferSize * 3 + 24),
        kOffsetStep = 101,
        kLengthStep = 21,
    };

    Instance *   instance;
    MessagePool *messagePool;
    Message *    message;
    Message *    message2;
    uint8_t      writeBuffer[kMaxSize];
    uint8_t      readBuffer[kMaxSize];
    uint8_t      zeroBuffer[kMaxSize];

    memset(zeroBuffer, 0, sizeof(zeroBuffer));

    instance = static_cast<Instance *>(testInitInstance());
    VerifyOrQuit(instance != nullptr, "Null OpenThread instance\n");

    messagePool = &instance->Get<MessagePool>();

    Random::NonCrypto::FillBuffer(writeBuffer, kMaxSize);

    VerifyOrQuit((message = messagePool->New(Message::kTypeIp6, 0)) != nullptr, "Message::New failed");
    SuccessOrQuit(message->SetLength(kMaxSize), "Message::SetLength failed");
    message->WriteBytes(0, writeBuffer, kMaxSize);
    SuccessOrQuit(message->Read(0, readBuffer, kMaxSize), "Message::Read failed");
    VerifyOrQuit(memcmp(writeBuffer, readBuffer, kMaxSize) == 0, "Message compare failed");
    VerifyOrQuit(message->GetLength() == kMaxSize, "Message::GetLength failed");

    for (uint16_t offset = 0; offset < kMaxSize; offset++)
    {
        for (uint16_t length = 0; length <= kMaxSize - offset; length++)
        {
            for (uint16_t i = 0; i < length; i++)
            {
                writeBuffer[offset + i]++;
            }

            message->WriteBytes(offset, &writeBuffer[offset], length);

            SuccessOrQuit(message->Read(0, readBuffer, kMaxSize), "Message::Read failed");
            VerifyOrQuit(memcmp(writeBuffer, readBuffer, kMaxSize) == 0, "Message compare failed");

            memset(readBuffer, 0, sizeof(readBuffer));
            SuccessOrQuit(message->Read(offset, readBuffer, length), "Message::Read failed");
            VerifyOrQuit(memcmp(readBuffer, &writeBuffer[offset], length) == 0, "Message compare failed");
            VerifyOrQuit(memcmp(&readBuffer[length], zeroBuffer, kMaxSize - length) == 0, "Message read after length");
        }

        // Verify `ReadBytes()` behavior when requested read length goes beyond available bytes in the message.

        for (uint16_t length = kMaxSize - offset + 1; length <= kMaxSize + 1; length++)
        {
            uint16_t readLength;

            memset(readBuffer, 0, sizeof(readBuffer));
            readLength = message->ReadBytes(offset, readBuffer, length);
            VerifyOrQuit(readLength <= length, "Message::ReadBytes() returned longer length");
            VerifyOrQuit(readLength == kMaxSize - offset, "Message::Read failed");
            VerifyOrQuit(memcmp(readBuffer, &writeBuffer[offset], readLength) == 0, "Message compare failed");
            VerifyOrQuit(memcmp(&readBuffer[readLength], zeroBuffer, kMaxSize - readLength) == 0, "read after length");
        }
    }

    VerifyOrQuit(message->GetLength() == kMaxSize, "Message::GetLength failed");

    // Test `Message::CopyTo()` behavior.

    VerifyOrQuit((message2 = messagePool->New(Message::kTypeIp6, 0)) != nullptr, "Message::New failed");
    SuccessOrQuit(message2->SetLength(kMaxSize), "Message::SetLength failed");

    for (uint16_t srcOffset = 0; srcOffset < kMaxSize; srcOffset += kOffsetStep)
    {
        for (uint16_t dstOffset = 0; dstOffset < kMaxSize; dstOffset += kOffsetStep)
        {
            for (uint16_t length = 0; length <= kMaxSize - dstOffset; length += kLengthStep)
            {
                uint16_t bytesCopied;

                message2->WriteBytes(0, zeroBuffer, kMaxSize);

                bytesCopied = message->CopyTo(srcOffset, dstOffset, length, *message2);

                if (srcOffset + length <= kMaxSize)
                {
                    VerifyOrQuit(bytesCopied == length, "CopyTo() failed");
                }
                else
                {
                    VerifyOrQuit(bytesCopied == kMaxSize - srcOffset, "CopyTo() failed");
                }

                SuccessOrQuit(message2->Read(0, readBuffer, kMaxSize), "Message::Read failed");

                VerifyOrQuit(memcmp(&readBuffer[0], zeroBuffer, dstOffset) == 0, "read before length");
                VerifyOrQuit(memcmp(&readBuffer[dstOffset], &writeBuffer[srcOffset], bytesCopied) == 0,
                             "Compare failed");
                VerifyOrQuit(
                    memcmp(&readBuffer[dstOffset + bytesCopied], zeroBuffer, kMaxSize - bytesCopied - dstOffset) == 0,
                    "read after length");
            }
        }
    }

    // Verify `CopyTo()` with same source and destination message and a backward copy.

    for (uint16_t srcOffset = 0; srcOffset < kMaxSize; srcOffset++)
    {
        uint16_t bytesCopied;

        message->WriteBytes(0, writeBuffer, kMaxSize);

        bytesCopied = message->CopyTo(srcOffset, 0, kMaxSize, *message);
        VerifyOrQuit(bytesCopied == kMaxSize - srcOffset, "CopyTo() failed");

        SuccessOrQuit(message->Read(0, readBuffer, kMaxSize), "Message::Read failed");

        VerifyOrQuit(memcmp(&readBuffer[0], &writeBuffer[srcOffset], bytesCopied) == 0,
                     "CopyTo() changed before srcOffset");
        VerifyOrQuit(memcmp(&readBuffer[bytesCopied], &writeBuffer[bytesCopied], kMaxSize - bytesCopied) == 0,
                     "CopyTo() write error");
    }

    message->Free();
    message2->Free();

    testFreeInstance(instance);
}

} // namespace ot

int main(void)
{
    ot::TestMessage();
    printf("All tests passed\n");
    return 0;
}


text:
cask 'virtualbox' do
  version '5.1.20-114629'
  sha256 '774f79d770d2176fad2c1cdba52f424dc28154c02339c22c7d1fd17a227dc642'

  url "http://download.virtualbox.org/virtualbox/#{version.sub(%r{-.*}, '')}/VirtualBox-#{version}-OSX.dmg"
  appcast 'http://download.virtualbox.org/virtualbox/LATEST.TXT',
          checkpoint: '840fe5c7e77518c74fcb29830e0b3933596dc2a41784e7f3e76ce418fac96a66'
  name 'Oracle VirtualBox'
  homepage 'https://www.virtualbox.org/'

  pkg 'VirtualBox.pkg'

  uninstall script:  {
                       executable: 'VirtualBox_Uninstall.tool',
                       args:       %w[--unattended],
                     },
            pkgutil: 'org.virtualbox.pkg.*'

  zap delete: [
                '/Library/Application Support/VirtualBox',
                '~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/org.virtualbox.app.virtualbox.sfl',
                '~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/org.virtualbox.app.virtualboxvm.sfl',
                '~/Library/VirtualBox',
                '~/Library/Preferences/org.virtualbox.app.VirtualBox.plist',
                '~/Library/Preferences/org.virtualbox.app.VirtualBoxVM.plist',
                '~/Library/Saved Application State/org.virtualbox.app.VirtualBox.savedState',
                '~/Library/Saved Application State/org.virtualbox.app.VirtualBoxVM.savedState',
              ],
      rmdir:  '~/VirtualBox VMs'
end


text:
namespace org {
  namespace apache {
    namespace lucene {
      namespace index {
        class IndexReader;
      }
      namespace search {
        namespace suggest {
          class InputIterator;
        }
      }
      namespace queries {
        namespace function {
          class ValueSource;
        }
      }
    }
  }
}
namespace java {
  namespace lang {
    class Class;
    class String;
  }
  namespace io {
    class IOException;
  }
}
template<class T> class JArray;

namespace org {
  namespace apache {
    namespace lucene {
      namespace search {
        namespace suggest {

          class DocumentValueSourceDictionary : public ::org::apache::lucene::search::suggest::DocumentDictionary {
          public:
            enum {
              mid_init$_11b82207,
              mid_init$_c3072aa9,
              mid_init$_8f8f3fa3,
              mid_getEntryIterator_23dc46b1,
              max_mid
            };

            static ::java::lang::Class *class$;
            static jmethodID *mids$;
            static bool live$;
            static jclass initializeClass(bool);

            explicit DocumentValueSourceDictionary(jobject obj) : ::org::apache::lucene::search::suggest::DocumentDictionary(obj) {
              if (obj != NULL)
                env->getClass(initializeClass);
            }
            DocumentValueSourceDictionary(const DocumentValueSourceDictionary& obj) : ::org::apache::lucene::search::suggest::DocumentDictionary(obj) {}

            DocumentValueSourceDictionary(const ::org::apache::lucene::index::IndexReader &, const ::java::lang::String &, const ::org::apache::lucene::queries::function::ValueSource &);
            DocumentValueSourceDictionary(const ::org::apache::lucene::index::IndexReader &, const ::java::lang::String &, const ::org::apache::lucene::queries::function::ValueSource &, const ::java::lang::String &);
            DocumentValueSourceDictionary(const ::org::apache::lucene::index::IndexReader &, const ::java::lang::String &, const ::org::apache::lucene::queries::function::ValueSource &, const ::java::lang::String &, const ::java::lang::String &);

            ::org::apache::lucene::search::suggest::InputIterator getEntryIterator() const;
          };
        }
      }
    }
  }
}

#include <Python.h>

namespace org {
  namespace apache {
    namespace lucene {
      namespace search {
        namespace suggest {
          extern PyTypeObject PY_TYPE(DocumentValueSourceDictionary);

          class t_DocumentValueSourceDictionary {
          public:
            PyObject_HEAD
            DocumentValueSourceDictionary object;
            static PyObject *wrap_Object(const DocumentValueSourceDictionary&);
            static PyObject *wrap_jobject(const jobject&);
            static void install(PyObject *module);
            static void initialize(PyObject *module);
          };
        }
      }
    }
  }
}

#endif


text:
Ph.D. Program Supervisory Committee

		<form class="essie-form">

			Term: <input type="text" class="form-control" ng-model="form.Term" placeholder="Spring/Summer/Fall, Year">

Student Information:

				Last: <input type="text" class="form-control" ng-model="user.lastName">

					First: <input type="text" class="form-control" ng-model="user.firstName">

					MI: <input type="text" class="form-control" ng-model="form.m_Initial">

			UF-ID #: <input type="text" ng-model="user.ufid">
			E-mail address: <input type="text" ng-model="user.email">

Members of Committee:

			Chair:	<select name="form.Chair.name" ng-model="form.Chair.name">
						<option value=""></option>
	      			   <option ng-repeat="approver in Approvers" value="{{approver.name}}">{{approver.name}}</option>
	     			</select>

			Department of Member: <select name="form.Chair.department" ng-model="form.Chair.department">
										<option value=""></option>
										<option value="Civil">Civil</option>
										<option value="Coastal">Coastal</option>
										<option value="Environmental">Environmental</option>
										<option value="N/A">N/A</option>
							</select>

			Co-Chair: <select name="form.co_Chair.name" ng-model="form.co_Chair.name">
					   <option value=""></option>
	      			   <option ng-repeat="approver in Approvers" value="{{approver.name}}">{{approver.name}}</option>
	     			</select>

			Department of Member: <select name="form.Chair.department" ng-model="form.co_Chair.department">
										<option value=""></option>
										<option value="Civil">Civil</option>
										<option value="Coastal">Coastal</option>
										<option value="Environmental">Environmental</option>
										<option value="N/A">N/A</option>
							</select>

			Member: <select name="form.member_1.name" ng-model="form.member_1.name">
						<option value=""></option>
	      			   <option ng-repeat="approver in Approvers" value="{{approver.name}}">{{approver.name}}</option>
	     			</select>

			Department of Member: <select name="form.Chair.department" ng-model="form.member_1.department">
										<option value=""></option>
										<option value="Civil">Civil</option>
										<option value="Coastal">Coastal</option>
										<option value="Environmental">Environmental</option>
										<option value="N/A">N/A</option>
							</select>

			Member: <select name="form.member_2.name" ng-model="form.member_2.name">
						<option value=""></option>
	      			   <option ng-repeat="approver in Approvers" value="{{approver.name}}">{{approver.name}}</option>
	     			</select>

			Department of Member: <select name="form.Chair.department" ng-model="form.member_2.department">
										<option value=""></option>
										<option value="Civil">Civil</option>
										<option value="Coastal">Coastal</option>
										<option value="Environmental">Environmental</option>
										<option value="N/A">N/A</option>
							</select>

			Member: <select name="form.member_3.name" ng-model="form.member_3.name">
						<option value=""></option>
	      			   <option ng-repeat="approver in Approvers" value="{{approver.name}}">{{approver.name}}</option>
	     			</select>

			Department of Member: <select name="form.Chair.department" ng-model="form.member_3.department">
										<option value=""></option>
										<option value="Civil">Civil</option>
										<option value="Coastal">Coastal</option>
										<option value="Environmental">Environmental</option>
										<option value="N/A">N/A</option>
							</select>

			External: <select name="form.external.name" ng-model="form.external.name">
						<option value=""></option>
	      			   <option ng-repeat="approver in Approvers" value="{{approver.name}}">{{approver.name}}</option>
	     			</select>

			Department of Member: <select name="form.Chair.department" ng-model="form.external.department">
										<option value=""></option>
										<option value="Civil">Civil</option>
										<option value="Coastal">Coastal</option>
										<option value="Environmental">Environmental</option>
										<option value="N/A">N/A</option>
							</select>

			<input type="button" id="submit" name="form-submit-btn" class="btn btn-success" ng-click="submitForm()" value="Submit">
			<button type="reset" id="reset" name="form-reset-btn" class="btn btn-danger">Reset</button>
		</form>


text:
docker_settings_file = Helpers::Docker.docker_settings_file(node)
docker_upstart_conf_file = Helpers::Docker.docker_upstart_conf_file(node)
docker_service = Helpers::Docker.docker_service(node)

template docker_upstart_conf_file do
  source 'docker.conf.erb'
  mode '0600'
  owner 'root'
  group 'root'
end

template docker_settings_file do
  source 'docker.sysconfig.erb'
  mode '0644'
  owner 'root'
  group 'root'
  variables(
    'daemon_options' => Helpers::Docker.daemon_cli_args(node)
  )
  # DEPRECATED: stop and start only necessary for 0.x cookbook upgrades
  # Default docker Upstart job now sources default file for DOCKER_OPTS
  notifies :stop, "service[#{docker_service}]", :immediately
  notifies :start, "service[#{docker_service}]", :immediately
end

service docker_service do
  provider Chef::Provider::Service::Upstart
  supports :status => true, :restart => true, :reload => true
  action [:start]
end


text:
[![view on npm](http://img.shields.io/npm/v/ansi-escape-sequences.svg)](https://www.npmjs.org/package/ansi-escape-sequences)
[![npm module downloads](http://img.shields.io/npm/dt/ansi-escape-sequences.svg)](https://www.npmjs.org/package/ansi-escape-sequences)
[![Build Status](https://travis-ci.org/75lb/ansi-escape-sequences.svg?branch=master)](https://travis-ci.org/75lb/ansi-escape-sequences)
[![Dependency Status](https://david-dm.org/75lb/ansi-escape-sequences.svg)](https://david-dm.org/75lb/ansi-escape-sequences)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)

# ansi-escape-sequences
A simple library containing all known terminal [ansi escape codes and sequences](http://en.wikipedia.org/wiki/ANSI_escape_code). Useful for adding colour to your command-line output, or building a dynamic text user interface.

## Command-line usage
Format text in the terminal (bold red, in this case):

$ echo yeah | ansi format bold red
yeah

## API Reference
**Example**
```js
var ansi = require('ansi-escape-sequences')
```

* [ansi-escape-sequences](#module_ansi-escape-sequences)
    * [.style](#module_ansi-escape-sequences.style) : enum
    * [.cursor](#module_ansi-escape-sequences.cursor)
        * [.hide](#module_ansi-escape-sequences.cursor.hide)
        * [.show](#module_ansi-escape-sequences.cursor.show)
        * [.up([lines])](#module_ansi-escape-sequences.cursor.up) ⇒ string
        * [.down([lines])](#module_ansi-escape-sequences.cursor.down) ⇒ string
        * [.forward([lines])](#module_ansi-escape-sequences.cursor.forward) ⇒ string
        * [.back([lines])](#module_ansi-escape-sequences.cursor.back) ⇒ string
        * [.nextLine([lines])](#module_ansi-escape-sequences.cursor.nextLine) ⇒ string
        * [.previousLine([lines])](#module_ansi-escape-sequences.cursor.previousLine) ⇒ string
        * [.horizontalAbsolute(n)](#module_ansi-escape-sequences.cursor.horizontalAbsolute) ⇒ string
        * [.position(n, m)](#module_ansi-escape-sequences.cursor.position) ⇒ string
    * [.erase](#module_ansi-escape-sequences.erase)
        * [.display(n)](#module_ansi-escape-sequences.erase.display) ⇒ string
        * [.inLine(n)](#module_ansi-escape-sequences.erase.inLine) ⇒ string
    * [.styles(effectArray)](#module_ansi-escape-sequences.styles) ⇒ string
    * [.format(str, [styleArray])](#module_ansi-escape-sequences.format) ⇒ string

## ansi.style : enum
Various formatting styles (aka Select Graphic Rendition codes).

**Kind**: static enum property of [ansi-escape-sequences](#module_ansi-escape-sequences)
**Properties**

| Name | Type | Default |
| --- | --- | --- |
| reset | string | "\u001b[0m" |
| bold | string | "\u001b[1m" |
| italic | string | "\u001b[3m" |
| underline | string | "\u001b[4m" |
| fontDefault | string | "\u001b[10m" |
| font2 | string | "\u001b[11m" |
| font3 | string | "\u001b[12m" |
| font4 | string | "\u001b[13m" |
| font5 | string | "\u001b[14m" |
| font6 | string | "\u001b[15m" |
| imageNegative | string | "\u001b[7m" |
| imagePositive | string | "\u001b[27m" |
| black | string | "\u001b[30m" |
| red | string | "\u001b[31m" |
| green | string | "\u001b[32m" |
| yellow | string | "\u001b[33m" |
| blue | string | "\u001b[34m" |
| magenta | string | "\u001b[35m" |
| cyan | string | "\u001b[36m" |
| white | string | "\u001b[37m" |
| "bg-black" | string | "\u001b[40m" |
| "bg-red" | string | "\u001b[41m" |
| "bg-green" | string | "\u001b[42m" |
| "bg-yellow" | string | "\u001b[43m" |
| "bg-blue" | string | "\u001b[44m" |
| "bg-magenta" | string | "\u001b[45m" |
| "bg-cyan" | string | "\u001b[46m" |
| "bg-white" | string | "\u001b[47m" |

**Example**
```js
console.log(ansi.style.red + 'this is red' + ansi.style.reset)
```

## ansi.cursor
cursor-related sequences

**Kind**: static property of [ansi-escape-sequences](#module_ansi-escape-sequences)

* [.cursor](#module_ansi-escape-sequences.cursor)
    * [.hide](#module_ansi-escape-sequences.cursor.hide)
    * [.show](#module_ansi-escape-sequences.cursor.show)
    * [.up([lines])](#module_ansi-escape-sequences.cursor.up) ⇒ string
    * [.down([lines])](#module_ansi-escape-sequences.cursor.down) ⇒ string
    * [.forward([lines])](#module_ansi-escape-sequences.cursor.forward) ⇒ string
    * [.back([lines])](#module_ansi-escape-sequences.cursor.back) ⇒ string
    * [.nextLine([lines])](#module_ansi-escape-sequences.cursor.nextLine) ⇒ string
    * [.previousLine([lines])](#module_ansi-escape-sequences.cursor.previousLine) ⇒ string
    * [.horizontalAbsolute(n)](#module_ansi-escape-sequences.cursor.horizontalAbsolute) ⇒ string
    * [.position(n, m)](#module_ansi-escape-sequences.cursor.position) ⇒ string

### cursor.hide
Hides the cursor

**Kind**: static property of [cursor](#module_ansi-escape-sequences.cursor)

### cursor.show
Shows the cursor

**Kind**: static property of [cursor](#module_ansi-escape-sequences.cursor)

### cursor.up([lines]) ⇒ string
Moves the cursor `lines` cells up. If the cursor is already at the edge of the screen, this has no effect

**Kind**: static method of [cursor](#module_ansi-escape-sequences.cursor)

| Param | Type | Default |
| --- | --- | --- |
| [lines] | number | 1 |

### cursor.down([lines]) ⇒ string
Moves the cursor `lines` cells down. If the cursor is already at the edge of the screen, this has no effect

**Kind**: static method of [cursor](#module_ansi-escape-sequences.cursor)

| Param | Type | Default |
| --- | --- | --- |
| [lines] | number | 1 |

### cursor.forward([lines]) ⇒ string
Moves the cursor `lines` cells forward. If the cursor is already at the edge of the screen, this has no effect

**Kind**: static method of [cursor](#module_ansi-escape-sequences.cursor)

| Param | Type | Default |
| --- | --- | --- |
| [lines] | number | 1 |

### cursor.back([lines]) ⇒ string
Moves the cursor `lines` cells back. If the cursor is already at the edge of the screen, this has no effect

**Kind**: static method of [cursor](#module_ansi-escape-sequences.cursor)

| Param | Type | Default |
| --- | --- | --- |
| [lines] | number | 1 |

### cursor.nextLine([lines]) ⇒ string
Moves cursor to beginning of the line n lines down.

**Kind**: static method of [cursor](#module_ansi-escape-sequences.cursor)

| Param | Type | Default |
| --- | --- | --- |
| [lines] | number | 1 |

### cursor.previousLine([lines]) ⇒ string
Moves cursor to beginning of the line n lines up.

**Kind**: static method of [cursor](#module_ansi-escape-sequences.cursor)

| Param | Type | Default |
| --- | --- | --- |
| [lines] | number | 1 |

### cursor.horizontalAbsolute(n) ⇒ string
Moves the cursor to column n.

**Kind**: static method of [cursor](#module_ansi-escape-sequences.cursor)

| Param | Type | Description |
| --- | --- | --- |
| n | number | column number |

### cursor.position(n, m) ⇒ string
Moves the cursor to row n, column m. The values are 1-based, and default to 1 (top left corner) if omitted.

**Kind**: static method of [cursor](#module_ansi-escape-sequences.cursor)

| Param | Type | Description |
| --- | --- | --- |
| n | number | row number |
| m | number | column number |

## ansi.erase
erase sequences

**Kind**: static property of [ansi-escape-sequences](#module_ansi-escape-sequences)

* [.erase](#module_ansi-escape-sequences.erase)
    * [.display(n)](#module_ansi-escape-sequences.erase.display) ⇒ string
    * [.inLine(n)](#module_ansi-escape-sequences.erase.inLine) ⇒ string

### erase.display(n) ⇒ string
Clears part of the screen. If n is 0 (or missing), clear from cursor to end of screen. If n is 1, clear from cursor to beginning of the screen. If n is 2, clear entire screen.

**Kind**: static method of [erase](#module_ansi-escape-sequences.erase)

| Param | Type |
| --- | --- |
| n | number |

### erase.inLine(n) ⇒ string
Erases part of the line. If n is zero (or missing), clear from cursor to the end of the line. If n is one, clear from cursor to beginning of the line. If n is two, clear entire line. Cursor position does not change.

**Kind**: static method of [erase](#module_ansi-escape-sequences.erase)

| Param | Type |
| --- | --- |
| n | number |

## ansi.styles(effectArray) ⇒ string
Returns an ansi sequence setting one or more effects

**Kind**: static method of [ansi-escape-sequences](#module_ansi-escape-sequences)

| Param | Type | Description |
| --- | --- | --- |
| effectArray | string | Array.<string> | a style, or list or styles |

**Example**
```js
> ansi.styles('green')
'\u001b[32m'

> ansi.styles([ 'green', 'underline' ])
'\u001b[32;4m'
```

## ansi.format(str, [styleArray]) ⇒ string
A convenience function, applying the provided styles to the input string and then resetting.

Inline styling can be applied using the syntax `[style-list]{text to format}`, where `style-list` is a space-separated list of styles from [ansi.style](#module_ansi-escape-sequences.style). For example `[bold white bg-red]{bold white text on a red background}`.

**Kind**: static method of [ansi-escape-sequences](#module_ansi-escape-sequences)

| Param | Type | Description |
| --- | --- | --- |
| str | string | the string to format |
| [styleArray] | Array.<string> | a list of styles to add to the input string |

**Example**
```js
> ansi.format('what?', 'green')
'\u001b[32mwhat?\u001b[0m'

> ansi.format('what?', ['green', 'bold'])
'\u001b[32;1mwhat?\u001b[0m'

> ansi.format('[green bold]{what?}')
'\u001b[32;1mwhat?\u001b[0m'
```

## Install
As a library:

```
$ npm install ansi-escape-sequences --save
```

As a command-line tool:
```
$ npm install -g ansi-escape-sequences
```

* * *

© 2015 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).


text:
using System.Web.Mvc;

namespace Moonlit.Mvc
{
    public class ToEntityContext
    {
        public ControllerContext ControllerContext { get; set; }
    }
}


text:
/**
 * llvm_exts.cpp: Extensions for LLVM callable from Rust.
 *
 * This file (built as a statically linked library) contains a number of LLVM
 * extensions callable from Rust that do not exist in `llvm_sys`.
 *
 * The library must be dynamically linked with the LLVM libraries.
 */
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>

#include <llvm/Support/Host.h>
#include <llvm/ADT/StringMap.h>
#include <llvm/ADT/Triple.h>
#include <llvm/Analysis/TargetLibraryInfo.h>
#include <llvm/Target/TargetMachine.h>
#include <llvm/IR/LegacyPassManager.h>
#include <llvm/CodeGen/TargetPassConfig.h>
#include <llvm/Transforms/IPO/PassManagerBuilder.h>

#include <llvm-c/Target.h>
#include <llvm-c/TargetMachine.h>
#include <llvm-c/Types.h>
#include <llvm-c/Transforms/PassManagerBuilder.h>

#define BUFSZ 4096

using namespace std;
using namespace llvm;

/**
 * Returns a target triple for the JIT.
 */
extern "C" const char *LLVMExtGetProcessTriple() {
  static char buf[BUFSZ];
  string triple = sys::getProcessTriple();
  strncpy(buf, triple.c_str(), BUFSZ);
  return buf;
}

/**
 * Returns the host CPU name.
 * The return value can be used as a value for the "target-cpu" attribute in LLVM.
 */
extern "C" const char *LLVMExtGetHostCPUName() {
  static char buf[BUFSZ];
  string host_name = sys::getHostCPUName();
  strncpy(buf, host_name.c_str(), BUFSZ);
  return buf;
}

/**
 * Returns the target features of the current machine, formatted for use as an
 * attribute in LLVM IR.
 * The return value can be used as a value for the "target-features" attribute in LLVM.
 */
extern "C" const char *LLVMExtGetHostCPUFeatures() {
  static char buf[BUFSZ];
  StringMap<bool> features;
  sys::getHostCPUFeatures(features);
  vector<string> features_present;
  vector<string> features_missing;
  for (auto it = features.begin(); it != features.end(); it++) {
    if (it->second) {
      features_present.push_back("+" + it->first().str());
    } else {
      features_missing.push_back("-" + it->first().str());
    }
  }

  sort(features_present.begin(), features_present.end());
  sort(features_missing.begin(), features_missing.end());

  string result;
  for (auto it = features_present.begin(); it != features_present.end(); it++) {
    result += *it;
    result += ",";
  }
  for (auto it = features_missing.begin(); it != features_missing.end(); it++) {
    result += *it;
    result += ",";
  }
  result.pop_back();
  strncpy(buf, result.c_str(), BUFSZ);
  return buf;
}

extern "C" void LLVMExtAddTargetPassConfig(LLVMTargetMachineRef target, LLVMPassManagerRef manager) {
  legacy::PassManagerBase *Passes = reinterpret_cast<legacy::PassManagerBase *>(manager);
  TargetMachine *TM = reinterpret_cast<TargetMachine *>(target);
  auto &LTM = static_cast<LLVMTargetMachine &>(*TM);
  Pass *TPC = LTM.createPassConfig(static_cast<PassManagerBase &>(*Passes));
  Passes->add(TPC);
}

extern "C" void LLVMExtAddTargetLibraryInfo(LLVMPassManagerRef manager){
  legacy::PassManagerBase *Passes = reinterpret_cast<legacy::PassManagerBase *>(manager);
  Triple triple = Triple(LLVMExtGetProcessTriple());
  TargetLibraryInfoWrapperPass *D = new TargetLibraryInfoWrapperPass(triple);
  Passes->add(D);
}

/** Disable or enable vectorization.
 *
 * The naming scheme of this function mirrors the LLVM `SetDisableUnrollLoops` function.
 */
extern "C" void LLVMExtPassManagerBuilderSetDisableVectorize(LLVMPassManagerBuilderRef P, unsigned i) {
  PassManagerBuilder *b = reinterpret_cast<PassManagerBuilder*>(P);
  b->LoopVectorize = (i == 0);
  b->SLPVectorize = (i == 0);
}