text:
module Helpers.Delahaye (column, delahayeList, rowTable, antidiagonalTable, missingFromTables) where
import Data.Set (Set)
import qualified Data.Set as Set
import Helpers.Table (tableByAntidiagonals, triangleByRows)

type ExtensionCriteria a = [Integer] -> a -> Integer -> Bool
type TableUpdate a = Integer -> [Integer] -> a -> a

delahayeList :: Integer -> a -> ExtensionCriteria a -> TableUpdate a -> [Integer]
delahayeList k initialTable isValidExtension updateTable = thisList where
  thisList = k : recurse 1 initialTable where
    recurse n table = nextTerm : recurse (n+1) (updateTable nextTerm knownTerms table) where
      knownTerms = take n thisList
      nextTerm = head $ filter (isValidExtension knownTerms table) [maximum knownTerms + 1 ..]

column :: (Integer -> Integer -> Integer) -> [Integer] -> Integer -> Set Integer
column f knownTerms k = Set.fromList (map (f k) (k:knownTerms))

rowTable :: (Integer -> Integer -> Integer) -> (Int -> Integer) -> [Integer]
rowTable f aNumber = map ((\(i, j) -> f (aNumber (i + 1)) (aNumber (j + 1))) . triangleByRows) [0..]

antidiagonalTable :: (Integer -> Integer -> Integer) -> (Int -> Integer) -> [Integer]
antidiagonalTable f aNumber = map ((\(i, j) -> f (aNumber (i + 1)) (aNumber (j + 1))) . tableByAntidiagonals) [0..]

missingFromTables :: [Integer -> Integer -> Integer] -> [Integer] -> [Integer]
missingFromTables operations sequence = recurse 1 sequence Set.empty [] where
  recurse lower (n:ns) table knownTerms = newValues ++ recurse n ns table' (n:knownTerms) where
    table' = foldr1 Set.union (table : map (\f -> column f knownTerms n) operations)
    newValues = Set.toAscList $ Set.difference (Set.fromList [lower..n-1]) table

redpajama_set_name: RedPajamaGithub


text:
import { Component, OnInit } from '@angular/core';
//要想让ngSubmit事件生效,必须加上这个。
import { NgForm } from '@angular/forms'
import { HttpService } from '../utility/service/http/http.service';
import { Router } from '@angular/router'

@Component({
    selector: 'storeRegister',
    templateUrl: './register.component.html',
    styleUrls: ['./login.css']
})

export class RegisterComponent implements OnInit {
    //userName = "";
    constructor(private httpService: HttpService, private router: Router) { }

    ngOnInit() { }

    handleSubmit(data: any) {

        this.httpService.sendPostRequest(
            '/user/register.php/?&callback=JSONP_CALLBACK',
            "uname=" + data.uname + "&upwd=" + data.upwd + "&phone=" + data.phone + "&email=" + data.email
        )
            .subscribe((result: any) => {
                console.log(result);
                //var pageToJump = result.pageToJump ? result.pageToJump : 'index';
                if (result.code = '200') {
                    this.router.navigateByUrl('/login')
                }
                else {
                    alert('注册失败')
                }
            })
    }
}


text:
package comjeffersonschmitt.github.bancoandroid.domain;

import com.activeandroid.Model;
import com.activeandroid.annotation.Column;
import com.activeandroid.annotation.Table;

@Table(name = "user")
public class User extends Model{

  @Column(name = "Login") String login;
  @Column(name = "Nome") String nome;
  @Column(name = "Senha") String senha;
  @Column(name = "Cpf") String cpf;

  public User() {
    super();
  }

  public User(String login, String nome, String senha, String cpf) {
    this.login = login;
    this.nome = nome;
    this.senha = senha;
    this.cpf = cpf;
  }

  public User(String login, String senha) { //contrutor da conta
    this.login = login;
    this.senha = senha;
  }

  public String getLogin() {
    return login;
  } //pega o login

  public String getNome(){return nome;} // pega o nome

  public String getSenha() {
    return senha;
  } // pega o senha

  public String getCpf() {
    return cpf;
  }// pega o cpf

}


text:
require 'rails'
require 'yaml'

require 'honeybadger/ruby'

module Honeybadger
  module Init
    module Rails
      class Railtie < ::Rails::Railtie
        rake_tasks do
          load 'honeybadger/tasks.rb'
        end

        initializer 'honeybadger.install_middleware' do |app|
          app.config.middleware.insert(0, Honeybadger::Rack::ErrorNotifier)
          app.config.middleware.insert_before(Honeybadger::Rack::ErrorNotifier, Honeybadger::Rack::UserInformer)
          app.config.middleware.insert_before(Honeybadger::Rack::ErrorNotifier, Honeybadger::Rack::UserFeedback)
        end

        config.before_initialize do
          Honeybadger.init!({
            :root           => ::Rails.root.to_s,
            :env            => ::Rails.env,
            :'config.path'  => ::Rails.root.join('config', 'honeybadger.yml'),
            :logger         => Logging::FormattedLogger.new(::Rails.logger),
            :framework      => :rails
          })
        end

        config.after_initialize do
          Honeybadger.load_plugins!
        end
      end
    end
  end
end

Honeybadger.install_at_exit_callback


text:
.. peewee documentation master file, created by
   sphinx-quickstart on Thu Nov 25 21:20:29 2010.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

peewee
======

.. image:: peewee-logo.png

Peewee is a simple and small ORM. It has few (but expressive) concepts, making it easy to learn and intuitive to use.

* A small, expressive ORM
* Written in python with support for versions 2.6+ and 3.2+.
* built-in support for sqlite, mysql and postgresql
* tons of extensions available in the :ref:`playhouse` (postgres hstore/json/arrays, sqlite full-text-search, schema migrations, and much more).

.. image:: postgresql.png
    :target: peewee/database.html#using-postgresql
    :alt: postgresql

.. image:: mysql.png
    :target: peewee/database.html#using-mysql
    :alt: mysql

.. image:: sqlite.png
    :target: peewee/database.html#using-sqlite
    :alt: sqlite

Peewee's source code hosted on `GitHub <https://github.com/coleifer/peewee>`_.

New to peewee? Here is a list of documents you might find most helpful when getting
started:

* :ref:`Quickstart guide <quickstart>` -- this guide covers all the bare essentials. It will take you between 5 and 10 minutes to go through it.
* :ref:`Guide to the various query operators <query-operators>` describes how to construct queries and combine expressions.
* :ref:`Field types table <field_types_table>` lists the various field types peewee supports and the parameters they accept.

Contents:
---------

.. toctree::
   :maxdepth: 2
   :glob:

   peewee/installation
   peewee/quickstart
   peewee/example
   peewee/more-resources
   peewee/database
   peewee/models
   peewee/querying
   peewee/transactions
   peewee/api
   peewee/playhouse
   peewee/hacks

Note
----

If you find any bugs, odd behavior, or have an idea for a new feature please don't hesitate to `open an issue <https://github.com/coleifer/peewee/issues?state=open>`_ on GitHub or `contact me <http://charlesleifer.com/contact/>`_.

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`


text:
function output = calloptidsdp(interfacedata)

% Retrieve needed data
options = interfacedata.options;
F_struc = interfacedata.F_struc;
c       = interfacedata.c;
K       = interfacedata.K;
x0      = interfacedata.x0;
ub      = interfacedata.ub;
lb      = interfacedata.lb;

model = yalmip2optidsdp(interfacedata);
if options.showprogress;showprogress(['Calling ' interfacedata.solver.tag],options.showprogress);end

if options.savedebug
    save dsdpdebug model
end

solvertime = clock;
[y,fvals,exitflag,stats,X] = dsdp(model.f,model.A,model.b,model.lb,model.ub,model.sdcone,model.y0,model.ops);
solvertime = etime(clock,solvertime);

% Create dual variable in internal format
if options.saveduals
    if K.l > 0
        top = 1;
        D_struc = X{1};
    else
        top = 0;
        D_struc = [];
    end
    if K.s(1) > 0
        for j = 1:length(K.s)
            n = K.s(j);
            Z = triu(ones(n));
            i = find(Z);
            Z(i) = X{j+top};
            Z = Z + Z' - diag(diag(Z));
            D_struc = [D_struc;Z(:)];
        end
    end
else
    D_struc = [];
end

x = y;  % Our notation do not coincide ...
switch exitflag
    case 1
        switch stats.pdflag
            case 1
                problem = 0;
            case 3
                problem = 2;
            case 4
                problem = 1;
            otherwise
                problem = 4;
        end
    case -6
        problem = 6;
    case {-2,-8,-9}
        problem = 4;
    case 7
        problem = 16;
    case {-3,-27}
        problem = 3;
    otherwise
        problem = -1;
end
infostr = yalmiperror(problem,interfacedata.solver.tag);

if options.savesolveroutput
	solveroutput.y = y;
    solveroutput.fvals = fvals;
    solveroutput.exitflag = exitflag;
    solveroutput.stats = stats;
    solveroutput.X = X;
else
	solveroutput = [];
end

if options.savesolverinput
	solverinput.model = model;
else
	solverinput = [];
end

% Standard interface
output.Primal      = x;
output.Dual        = D_struc;
output.Slack       = [];
output.problem     = problem;
output.infostr     = infostr;
output.solverinput = solverinput;
output.solveroutput= solveroutput;
output.solvertime  = solvertime;


text:
#ifndef _H_MESSAGES
#define _H_MESSAGES

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

#include <spice/protocol.h>
#include <spice/macros.h>

#ifdef USE_SMARTCARD
#include <vscard_common.h>
#endif

#include "draw.h"

SPICE_BEGIN_DECLS

typedef struct SpiceMsgData {
    uint32_t data_size;
    uint8_t data[0];
} SpiceMsgData;

typedef struct SpiceMsgEmpty {
    uint8_t padding;
} SpiceMsgEmpty;

typedef struct SpiceMsgInputsInit {
    uint32_t keyboard_modifiers;
} SpiceMsgInputsInit;

typedef struct SpiceMsgInputsKeyModifiers {
    uint32_t modifiers;
} SpiceMsgInputsKeyModifiers;

typedef struct SpiceMsgMainMultiMediaTime {
    uint32_t time;
} SpiceMsgMainMultiMediaTime;

typedef struct SpiceMigrationDstInfo {
    uint16_t port;
    uint16_t sport;
    uint32_t host_size;
    uint8_t *host_data;
    uint16_t pub_key_type;
    uint32_t pub_key_size;
    uint8_t *pub_key_data;
    uint32_t cert_subject_size;
    uint8_t *cert_subject_data;
} SpiceMigrationDstInfo;

typedef struct SpiceMsgMainMigrationBegin {
    SpiceMigrationDstInfo dst_info;
} SpiceMsgMainMigrationBegin;

typedef struct SpiceMsgMainMigrateBeginSeamless {
    SpiceMigrationDstInfo dst_info;
    uint32_t src_mig_version;
} SpiceMsgMainMigrateBeginSeamless;

typedef struct SpiceMsgcMainMigrateDstDoSeamless {
    uint32_t src_version;
} SpiceMsgcMainMigrateDstDoSeamless;

typedef struct SpiceMsgMainMigrationSwitchHost {
    uint16_t port;
    uint16_t sport;
    uint32_t host_size;
    uint8_t *host_data;
    uint32_t cert_subject_size;
    uint8_t *cert_subject_data;
} SpiceMsgMainMigrationSwitchHost;

typedef struct SpiceMsgMigrate {
    uint32_t flags;
} SpiceMsgMigrate;

typedef struct SpiceResourceID {
    uint8_t type;
    uint64_t id;
} SpiceResourceID;

typedef struct SpiceResourceList {
    uint16_t count;
    SpiceResourceID resources[0];
} SpiceResourceList;

typedef struct SpiceMsgSetAck {
    uint32_t generation;
    uint32_t window;
} SpiceMsgSetAck;

typedef struct SpiceMsgcAckSync {
  uint32_t generation;
} SpiceMsgcAckSync;

typedef struct SpiceWaitForChannel {
    uint8_t channel_type;
    uint8_t channel_id;
    uint64_t message_serial;
} SpiceWaitForChannel;

typedef struct SpiceMsgWaitForChannels {
    uint8_t wait_count;
    SpiceWaitForChannel wait_list[0];
} SpiceMsgWaitForChannels;

typedef struct SpiceChannelId {
    uint8_t type;
    uint8_t id;
} SpiceChannelId;

typedef struct SpiceMsgMainInit {
    uint32_t session_id;
    uint32_t display_channels_hint;
    uint32_t supported_mouse_modes;
    uint32_t current_mouse_mode;
    uint32_t agent_connected;
    uint32_t agent_tokens;
    uint32_t multi_media_time;
    uint32_t ram_hint;
} SpiceMsgMainInit;

typedef struct SpiceMsgDisconnect {
    uint64_t time_stamp;
    uint32_t reason; // SPICE_ERR_?
} SpiceMsgDisconnect;

typedef struct SpiceMsgNotify {
    uint64_t time_stamp;
    uint32_t severity;
    uint32_t visibilty;
    uint32_t what;
    uint32_t message_len;
    uint8_t message[0];
} SpiceMsgNotify;

typedef struct SpiceMsgChannels {
    uint32_t num_of_channels;
    SpiceChannelId channels[0];
} SpiceMsgChannels;

typedef struct SpiceMsgMainName {
    uint32_t name_len;
    uint8_t name[0];
} SpiceMsgMainName;

typedef struct SpiceMsgMainUuid {
    uint8_t uuid[16];
} SpiceMsgMainUuid;

typedef struct SpiceMsgMainMouseMode {
    uint32_t supported_modes;
    uint32_t current_mode;
} SpiceMsgMainMouseMode;

typedef struct SpiceMsgPing {
    uint32_t id;
    uint64_t timestamp;
    void *data;
    uint32_t data_len;
} SpiceMsgPing;

typedef struct SpiceMsgMainAgentDisconnect {
    uint32_t error_code; // SPICE_ERR_?
} SpiceMsgMainAgentDisconnect;

#define SPICE_AGENT_MAX_DATA_SIZE 2048

typedef struct SpiceMsgMainAgentTokens {
    uint32_t num_tokens;
} SpiceMsgMainAgentTokens, SpiceMsgcMainAgentTokens, SpiceMsgcMainAgentStart;

typedef struct SpiceMsgMainAgentTokens SpiceMsgMainAgentConnectedTokens;

typedef struct SpiceMsgcClientInfo {
    uint64_t cache_size;
} SpiceMsgcClientInfo;

typedef struct SpiceMsgcMainMouseModeRequest {
    uint32_t mode;
} SpiceMsgcMainMouseModeRequest;

typedef struct SpiceCursor {
    uint32_t flags;
    SpiceCursorHeader header;
    uint32_t data_size;
    uint8_t *data;
} SpiceCursor;

typedef struct SpiceMsgDisplayMode {
    uint32_t x_res;
    uint32_t y_res;
    uint32_t bits;
} SpiceMsgDisplayMode;

typedef struct SpiceMsgSurfaceCreate {
    uint32_t surface_id;
    uint32_t width;
    uint32_t height;
    uint32_t format;
    uint32_t flags;
} SpiceMsgSurfaceCreate;

typedef struct SpiceMsgSurfaceDestroy {
    uint32_t surface_id;
} SpiceMsgSurfaceDestroy;

typedef struct SpiceMsgDisplayBase {
    uint32_t surface_id;
    SpiceRect box;
    SpiceClip clip;
} SpiceMsgDisplayBase;

typedef struct SpiceMsgDisplayDrawFill {
    SpiceMsgDisplayBase base;
    SpiceFill data;
} SpiceMsgDisplayDrawFill;

typedef struct SpiceMsgDisplayDrawOpaque {
    SpiceMsgDisplayBase base;
    SpiceOpaque data;
} SpiceMsgDisplayDrawOpaque;

typedef struct SpiceMsgDisplayDrawCopy {
    SpiceMsgDisplayBase base;
    SpiceCopy data;
} SpiceMsgDisplayDrawCopy;

typedef struct SpiceMsgDisplayDrawTransparent {
    SpiceMsgDisplayBase base;
    SpiceTransparent data;
} SpiceMsgDisplayDrawTransparent;

typedef struct SpiceMsgDisplayDrawAlphaBlend {
    SpiceMsgDisplayBase base;
    SpiceAlphaBlend data;
} SpiceMsgDisplayDrawAlphaBlend;

typedef struct SpiceMsgDisplayDrawComposite {
    SpiceMsgDisplayBase base;
    SpiceComposite data;
} SpiceMsgDisplayDrawComposite;

typedef struct SpiceMsgDisplayCopyBits {
    SpiceMsgDisplayBase base;
    SpicePoint src_pos;
} SpiceMsgDisplayCopyBits;

typedef SpiceMsgDisplayDrawCopy SpiceMsgDisplayDrawBlend;

typedef struct SpiceMsgDisplayDrawRop3 {
    SpiceMsgDisplayBase base;
    SpiceRop3 data;
} SpiceMsgDisplayDrawRop3;

typedef struct SpiceMsgDisplayDrawBlackness {
    SpiceMsgDisplayBase base;
    SpiceBlackness data;
} SpiceMsgDisplayDrawBlackness;

typedef struct SpiceMsgDisplayDrawWhiteness {
    SpiceMsgDisplayBase base;
    SpiceWhiteness data;
} SpiceMsgDisplayDrawWhiteness;

typedef struct SpiceMsgDisplayDrawInvers {
    SpiceMsgDisplayBase base;
    SpiceInvers data;
} SpiceMsgDisplayDrawInvers;

typedef struct SpiceMsgDisplayDrawStroke {
    SpiceMsgDisplayBase base;
    SpiceStroke data;
} SpiceMsgDisplayDrawStroke;

typedef struct SpiceMsgDisplayDrawText {
    SpiceMsgDisplayBase base;
    SpiceText data;
} SpiceMsgDisplayDrawText;

typedef struct SpiceMsgDisplayInvalOne {
    uint64_t id;
} SpiceMsgDisplayInvalOne;

typedef struct SpiceMsgDisplayStreamCreate {
    uint32_t surface_id;
    uint32_t id;
    uint32_t flags;
    uint32_t codec_type;
    uint64_t stamp;
    uint32_t stream_width;
    uint32_t stream_height;
    uint32_t src_width;
    uint32_t src_height;
    SpiceRect dest;
    SpiceClip clip;
} SpiceMsgDisplayStreamCreate;

typedef struct SpiceStreamDataHeader {
    uint32_t id;
    uint32_t multi_media_time;
} SpiceStreamDataHeader;

typedef struct SpiceMsgDisplayStreamData {
    SpiceStreamDataHeader base;
    uint32_t data_size;
    uint8_t data[0];
} SpiceMsgDisplayStreamData;

typedef struct SpiceMsgDisplayStreamDataSized {
    SpiceStreamDataHeader base;
    uint32_t width;
    uint32_t height;
    SpiceRect dest;
    uint32_t data_size;
    uint8_t data[0];
} SpiceMsgDisplayStreamDataSized;

typedef struct SpiceMsgDisplayStreamClip {
    uint32_t id;
    SpiceClip clip;
} SpiceMsgDisplayStreamClip;

typedef struct SpiceMsgDisplayStreamDestroy {
    uint32_t id;
} SpiceMsgDisplayStreamDestroy;

typedef struct SpiceMsgDisplayStreamActivateReport {
    uint32_t stream_id;
    uint32_t unique_id;
    uint32_t max_window_size;
    uint32_t timeout_ms;
} SpiceMsgDisplayStreamActivateReport;

typedef struct SpiceMsgcDisplayStreamReport {
    uint32_t stream_id;
    uint32_t unique_id;
    uint32_t start_frame_mm_time;
    uint32_t end_frame_mm_time;
    uint32_t num_frames;
    uint32_t num_drops;
    int32_t last_frame_delay;
    uint32_t audio_delay;
} SpiceMsgcDisplayStreamReport;

typedef struct SpiceMsgCursorInit {
    SpicePoint16 position;
    uint16_t trail_length;
    uint16_t trail_frequency;
    uint8_t visible;
    SpiceCursor cursor;
} SpiceMsgCursorInit;

typedef struct SpiceMsgCursorSet {
    SpicePoint16 position;
    uint8_t visible;
    SpiceCursor cursor;
} SpiceMsgCursorSet;

typedef struct SpiceMsgCursorMove {
    SpicePoint16 position;
} SpiceMsgCursorMove;

typedef struct SpiceMsgCursorTrail {
    uint16_t length;
    uint16_t frequency;
} SpiceMsgCursorTrail;

typedef struct SpiceMsgcDisplayInit {
    uint8_t pixmap_cache_id;
    int64_t pixmap_cache_size; //in pixels
    uint8_t glz_dictionary_id;
    int32_t glz_dictionary_window_size;       // in pixels
} SpiceMsgcDisplayInit;

typedef struct SpiceMsgcKeyDown {
    uint32_t code;
} SpiceMsgcKeyDown;

typedef struct SpiceMsgcKeyUp {
    uint32_t code;
} SpiceMsgcKeyUp;

typedef struct SpiceMsgcKeyModifiers {
    uint32_t modifiers;
} SpiceMsgcKeyModifiers;

typedef struct SpiceMsgcMouseMotion {
    int32_t dx;
    int32_t dy;
    uint32_t buttons_state;
} SpiceMsgcMouseMotion;

typedef struct SpiceMsgcMousePosition {
    uint32_t x;
    uint32_t y;
    uint32_t buttons_state;
    uint8_t display_id;
} SpiceMsgcMousePosition;

typedef struct SpiceMsgcMousePress {
    int32_t button;
    int32_t buttons_state;
} SpiceMsgcMousePress;

typedef struct SpiceMsgcMouseRelease {
    int32_t button;
    int32_t buttons_state;
} SpiceMsgcMouseRelease;

typedef struct SpiceMsgAudioVolume {
    uint8_t nchannels;
    uint16_t volume[0];
} SpiceMsgAudioVolume;

typedef struct SpiceMsgAudioMute {
    uint8_t mute;
} SpiceMsgAudioMute;

typedef struct SpiceMsgPlaybackMode {
    uint32_t time;
    uint32_t mode; //SPICE_AUDIO_DATA_MODE_?
    uint8_t *data;
    uint32_t data_size;
} SpiceMsgPlaybackMode, SpiceMsgcRecordMode;

typedef struct SpiceMsgPlaybackStart {
    uint32_t channels;
    uint32_t format; //SPICE_AUDIO_FMT_?
    uint32_t frequency;
    uint32_t time;
} SpiceMsgPlaybackStart;

typedef struct SpiceMsgPlaybackPacket {
    uint32_t time;
    uint8_t *data;
    uint32_t data_size;
} SpiceMsgPlaybackPacket, SpiceMsgcRecordPacket;

typedef struct SpiceMsgPlaybackLatency {
    uint32_t latency_ms;
} SpiceMsgPlaybackLatency;

typedef struct SpiceMsgRecordStart {
    uint32_t channels;
    uint32_t format; //SPICE_AUDIO_FMT_?
    uint32_t frequency;
} SpiceMsgRecordStart;

typedef struct SpiceMsgcRecordStartMark {
    uint32_t time;
} SpiceMsgcRecordStartMark;

typedef struct SpiceMsgTunnelInit {
    uint16_t max_num_of_sockets;
    uint32_t max_socket_data_size;
} SpiceMsgTunnelInit;

typedef uint8_t SpiceTunnelIPv4[4];

typedef struct SpiceMsgTunnelIpInfo {
    uint16_t type;
    union {
      SpiceTunnelIPv4 ipv4;
    } u;
    uint8_t data[0];
} SpiceMsgTunnelIpInfo;

typedef struct SpiceMsgTunnelServiceIpMap {
    uint32_t service_id;
    SpiceMsgTunnelIpInfo virtual_ip;
} SpiceMsgTunnelServiceIpMap;

typedef struct SpiceMsgTunnelSocketOpen {
    uint16_t connection_id;
    uint32_t service_id;
    uint32_t tokens;
} SpiceMsgTunnelSocketOpen;

/* connection id must be the first field in msgs directed to a specific connection */

typedef struct SpiceMsgTunnelSocketFin {
    uint16_t connection_id;
} SpiceMsgTunnelSocketFin;

typedef struct SpiceMsgTunnelSocketClose {
    uint16_t connection_id;
} SpiceMsgTunnelSocketClose;

typedef struct SpiceMsgTunnelSocketData {
    uint16_t connection_id;
    uint8_t data[0];
} SpiceMsgTunnelSocketData;

typedef struct SpiceMsgTunnelSocketTokens {
    uint16_t connection_id;
    uint32_t num_tokens;
} SpiceMsgTunnelSocketTokens;

typedef struct SpiceMsgTunnelSocketClosedAck {
    uint16_t connection_id;
} SpiceMsgTunnelSocketClosedAck;

typedef struct SpiceMsgcTunnelAddGenericService {
    uint32_t type;
    uint32_t id;
    uint32_t group;
    uint32_t port;
    uint64_t name;
    uint64_t description;
    union {
        SpiceMsgTunnelIpInfo ip;
    } u;
} SpiceMsgcTunnelAddGenericService;

typedef struct SpiceMsgcTunnelRemoveService {
    uint32_t id;
} SpiceMsgcTunnelRemoveService;

/* connection id must be the first field in msgs directed to a specific connection */

typedef struct SpiceMsgcTunnelSocketOpenAck {
    uint16_t connection_id;
    uint32_t tokens;
} SpiceMsgcTunnelSocketOpenAck;

typedef struct SpiceMsgcTunnelSocketOpenNack {
    uint16_t connection_id;
} SpiceMsgcTunnelSocketOpenNack;

typedef struct SpiceMsgcTunnelSocketData {
    uint16_t connection_id;
    uint8_t data[0];
} SpiceMsgcTunnelSocketData;

typedef struct SpiceMsgcTunnelSocketFin {
    uint16_t connection_id;
} SpiceMsgcTunnelSocketFin;

typedef struct SpiceMsgcTunnelSocketClosed {
    uint16_t connection_id;
} SpiceMsgcTunnelSocketClosed;

typedef struct SpiceMsgcTunnelSocketClosedAck {
    uint16_t connection_id;
} SpiceMsgcTunnelSocketClosedAck;

typedef struct SpiceMsgcTunnelSocketTokens {
    uint16_t connection_id;
    uint32_t num_tokens;
} SpiceMsgcTunnelSocketTokens;

#ifdef USE_SMARTCARD
typedef struct SpiceMsgSmartcard {
    VSCMsgType type;
    uint32_t length;
    uint32_t reader_id;
    uint8_t data[0];
} SpiceMsgSmartcard;

typedef struct SpiceMsgcSmartcard {
    VSCMsgHeader header;
    union {
        VSCMsgError error;
        VSCMsgATR atr_data;
        VSCMsgReaderAdd add;
    };
} SpiceMsgcSmartcard;
#endif

typedef struct SpiceMsgDisplayHead {
    uint32_t id;
    uint32_t surface_id;
    uint32_t width;
    uint32_t height;
    uint32_t x;
    uint32_t y;
    uint32_t flags;
} SpiceHead;

typedef struct SpiceMsgDisplayMonitorsConfig {
    uint16_t count;
    uint16_t max_allowed;
    SpiceHead heads[0];
} SpiceMsgDisplayMonitorsConfig;

typedef struct SpiceMsgPortInit {
    uint32_t name_size;
    uint8_t *name;
    uint8_t opened;
} SpiceMsgPortInit;

typedef struct SpiceMsgPortEvent {
    uint8_t event;
} SpiceMsgPortEvent;

typedef struct SpiceMsgcPortEvent {
    uint8_t event;
} SpiceMsgcPortEvent;

SPICE_END_DECLS

#endif /* _H_SPICE_PROTOCOL */


text:
import {TwingBaseNodeVisitor} from "../base-node-visitor";
import {TwingNode, TwingNodeType} from "../node";
import {TwingEnvironment} from "../environment";

const objectHash = require('object-hash');

interface Bucket {
    key: any,
    value: Array<string>
}

export class TwingNodeVisitorSafeAnalysis extends TwingBaseNodeVisitor {
    private data: Map<string, Array<Bucket>> = new Map();
    private safeVars: Array<any> = [];

    constructor() {
        super();

        this.TwingNodeVisitorInterfaceImpl = this;
    }

    setSafeVars(safeVars: Array<any>) {
        this.safeVars = safeVars;
    }

    /**
     *
     * @param {TwingNode} node
     * @returns {Array<string>}
     */
    getSafe(node: TwingNode): Array<TwingNode | string | false> {
        let hash = objectHash(node);

        if (!this.data.has(hash)) {
            return;
        }

        let bucket = this.data.get(hash).find(function (bucket: Bucket) {
            if (bucket.key === node) {
                if (bucket.value.includes('html_attr')) {
                    bucket.value.push('html');
                }

                return true;
            }
        });

        return bucket ? bucket.value : null;
    }

    private setSafe(node: TwingNode, safe: Array<string>) {
        let hash = objectHash(node);
        let bucket = null;

        if (this.data.has(hash)) {
            bucket = this.data.get(hash).find(function (bucket: Bucket) {
                if (bucket.key === node) {
                    bucket.value = safe;

                    return true;
                }
            });
        }

        if (!bucket) {
            if (!this.data.has(hash)) {
                this.data.set(hash, []);
            }

            this.data.get(hash).push({
                key: node,
                value: safe
            });
        }
    }

    protected doEnterNode(node: TwingNode, env: TwingEnvironment): TwingNode {
        return node;
    }

    protected doLeaveNode(node: TwingNode, env: TwingEnvironment): TwingNode {
        if (node.getType() === TwingNodeType.EXPRESSION_CONSTANT) {
            // constants are marked safe for all
            this.setSafe(node, ['all']);
        }
        else if (node.getType() === TwingNodeType.EXPRESSION_BLOCK_REFERENCE) {
            // blocks are safe by definition
            this.setSafe(node, ['all']);
        }
        else if (node.getType() === TwingNodeType.EXPRESSION_PARENT) {
            // parent block is safe by definition
            this.setSafe(node, ['all']);
        }
        else if (node.getType() === TwingNodeType.EXPRESSION_CONDITIONAL) {
            // intersect safeness of both operands
            let safe = this.intersectSafe(this.getSafe(node.getNode('expr2')), this.getSafe(node.getNode('expr3')));
            this.setSafe(node, safe);
        }
        else if (node.getType() === TwingNodeType.EXPRESSION_FILTER) {
            // filter expression is safe when the filter is safe
            let name = node.getNode('filter').getAttribute('value');
            let filterArgs = node.getNode('arguments');
            let filter = env.getFilter(name);

            if (filter) {
                let safe = filter.getSafe(filterArgs);

                if (safe.length < 1) {
                    safe = this.intersectSafe(this.getSafe(node.getNode('node')), filter.getPreservesSafety());
                }

                this.setSafe(node, safe);
            }
            else {
                this.setSafe(node, []);
            }
        }
        else if (node.getType() === TwingNodeType.EXPRESSION_FUNCTION) {
            // function expression is safe when the function is safe
            let name = node.getAttribute('name');
            let functionArgs = node.getNode('arguments');
            let functionNode = env.getFunction(name);

            if (functionNode) {
                this.setSafe(node, functionNode.getSafe(functionArgs));
            }
            else {
                this.setSafe(node, []);
            }
        }
        else if (node.getType() === TwingNodeType.EXPRESSION_METHOD_CALL) {
            if (node.getAttribute('safe')) {
                this.setSafe(node, ['all']);
            }
            else {
                this.setSafe(node, []);
            }
        }
        else if (node.getType() === TwingNodeType.EXPRESSION_GET_ATTR && node.getNode('node').getType() === TwingNodeType.EXPRESSION_NAME) {
            let name = node.getNode('node').getAttribute('name');

            if (this.safeVars.includes(name)) {
                this.setSafe(node, ['all']);
            }
            else {
                this.setSafe(node, []);
            }
        }
        else {
            this.setSafe(node, []);
        }

        return node;
    }

    private intersectSafe(a: Array<any>, b: Array<any>) {
        if (a === null || b === null) {
            return [];
        }

        if (a.includes('all')) {
            return b;
        }

        if (b.includes('all')) {
            return a;
        }

        // array_intersect
        return a.filter(function (n) {
            return b.includes(n);
        });
    }

    getPriority() {
        return 0;
    }
}


text:
package org.springframework.cloud.dataflow.rest.client;

import java.net.URI;
import java.util.HashMap;
import java.util.Map;

import org.springframework.hateoas.Link;
import org.springframework.hateoas.ResourceSupport;
import org.springframework.hateoas.UriTemplate;
import org.springframework.web.client.RestTemplate;

/**
 * Implementation of DataFlowOperations delegating to sub-templates, discovered
 * via REST relations.
 *
 *  @author Ilayaperumal Gopinathan
 *  @author Mark Fisher
 *  @author Glenn Renfro
 *  @author Patrick Peralta
 *  @author Gary Russell
 *  @author Eric Bottard
 */
public class DataFlowTemplate implements DataFlowOperations {

	/**
	 * A template used for http interaction.
	 */
	protected final RestTemplate restTemplate;

	/**
	 * Holds discovered URLs of the API.
	 */
	protected final Map<String, UriTemplate> resources = new HashMap<String, UriTemplate>();

	/**
	 * REST client for stream operations.
	 */
	private final StreamOperations streamOperations;

	/**
	 * REST client for counter operations.
	 */
	private final CounterOperations counterOperations;

	/**
	 * REST client for field value counter operations.
	 */
	private final FieldValueCounterOperations fieldValueCounterOperations;

	/**
	 * REST client for task operations.
	 */
	private final TaskOperations taskOperations;

	/**
	 * REST client for module operations.
	 */
	private final ModuleOperations moduleOperations;

	/**
	 * REST client for library operations.
	 */
	private final LibraryOperations libraryOperations;

	/**
	 * REST client for completion operations.
	 */
	private final CompletionOperations completionOperations;

	/**
	 * REST Client for runtime operations.
	 */
	private final RuntimeOperations runtimeOperations;

	public DataFlowTemplate(URI baseURI, RestTemplate restTemplate) {
		this.restTemplate = restTemplate;
		ResourceSupport resourceSupport = restTemplate.getForObject(baseURI, ResourceSupport.class);

		this.streamOperations = new StreamTemplate(restTemplate, resourceSupport);
		this.counterOperations = new CounterTemplate(restTemplate, resourceSupport);
		this.fieldValueCounterOperations = new FieldValueCounterTemplate(restTemplate, resourceSupport);
		this.taskOperations = new TaskTemplate(restTemplate, resourceSupport);
		this.moduleOperations = new ModuleTemplate(restTemplate, resourceSupport);
		this.libraryOperations = new LibraryTemplate(restTemplate, resourceSupport);
		this.completionOperations = new CompletionTemplate(restTemplate, resourceSupport.getLink("completions/stream"));
		this.runtimeOperations = new RuntimeTemplate(restTemplate, resourceSupport);
	}

	public Link getLink(ResourceSupport resourceSupport, String rel) {
		Link link = resourceSupport.getLink(rel);
		if (link == null) {
			throw new DataFlowServerException("Server did not return a link for '" + rel + "', links: '"
					+ resourceSupport + "'");
		}
		return link;
	}

	@Override
	public StreamOperations streamOperations() {
		return streamOperations;
	}

	@Override
	public CounterOperations counterOperations() {
		return counterOperations;
	}

	@Override
	public FieldValueCounterOperations fieldValueCounterOperations() {
		return fieldValueCounterOperations;
	}

	@Override
	public TaskOperations taskOperations() {
		return taskOperations;
	}

	@Override
	public ModuleOperations moduleOperations() {
		return moduleOperations;
	}

	@Override
	public LibraryOperations libraryOperations() {
		return libraryOperations;
	}

	@Override
	public CompletionOperations completionOperations() {
		return completionOperations;
	}

	@Override
	public RuntimeOperations runtimeOperations() {
		return runtimeOperations;
	}
}


text: APP_AUTHOR = YAML.load_file(Rails.root.join('config', 'author.yml'))


text:
layout: page
weight: 0
title: Whitelabel Wizard
breadcrumbs: true
navigation:
  show: true
---

<meta itemprop="name" content="{{ page.title }}">

### Whitelabel Wizard

What is whitelabeling and why should you use it? Mohammed explains what this powerful feature is used for and quickly walks you through the 3 step whitelabeling process. The whitelabel feature is available on Silver packages and higher.


text:
var searchData=
[
  ['cacheobject_3aversion_3aobject_3a',['cacheObject:version:object:',['../protocol_s_l_t_repository_protocol_delegate-p.html#a6c44678d1e32382f5c81ec0bb7f2b3fd',1,'SLTRepositoryProtocolDelegate-p']]],
  ['connect',['connect',['../interface_s_l_t_saltr.html#a38d8df5968bd62590acbfca625a4a1dc',1,'SLTSaltr']]],
  ['connectwithbasicproperties_3a',['connectWithBasicProperties:',['../interface_s_l_t_saltr.html#a4a5285990a851b8cb9adfc860fb4e4a6',1,'SLTSaltr']]],
  ['connectwithbasicproperties_3aandcustomproperties_3a',['connectWithBasicProperties:andCustomProperties:',['../interface_s_l_t_saltr.html#a75b5d3c0692cc0762de992e6d52bc6e1',1,'SLTSaltr']]]
];


text:
package com.unicorn.utilities;

import android.graphics.Bitmap;
import android.widget.ImageView;
import android.widget.ProgressBar;

public class LoadBitmapItem {

	private ImageView imgView;
	private ProgressBar progress;

	private Bitmap bitmap;
	private String url;
	private boolean isMask;

	private int sideLength;

	public int getSideLength() {
		return sideLength;
	}

	public void setSideLength(int sideLength) {
		this.sideLength = sideLength;
	}

	public Bitmap getBitmap() {
		return bitmap;
	}

	public void setBitmap(Bitmap bitmap) {
		this.bitmap = bitmap;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public ImageView getImgView() {
		return imgView;
	}

	public void setImgView(ImageView imgView) {
		this.imgView = imgView;
	}

	public ProgressBar getProgress() {
		return progress;
	}

	public void setProgress(ProgressBar progress) {
		this.progress = progress;
	}

	public boolean isMask() {
		return isMask;
	}

	public void setMask(boolean isMask) {
		this.isMask = isMask;
	}

}


text:
package com.facebook.buck.jvm.java.abi.source;

import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.type.ArrayType;
import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.ErrorType;
import javax.lang.model.type.ExecutableType;
import javax.lang.model.type.IntersectionType;
import javax.lang.model.type.NoType;
import javax.lang.model.type.NullType;
import javax.lang.model.type.PrimitiveType;
import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.type.TypeVariable;
import javax.lang.model.type.TypeVisitor;
import javax.lang.model.type.UnionType;
import javax.lang.model.type.WildcardType;

/**
 * An implementation of {@link TypeMirror} that is not dependent on any particular compiler
 * implementation. Subclasses may require {@link javax.lang.model.element.Element}s and/or {@link
 * javax.lang.model.type.TypeMirror}s, but do not depend on any particular implementation of them
 * (beyond the spec).
 *
 * <p>NOTE: A Java 11 copy of this file exists in ../java11/StandaloneTypeMirror.java. Please make
 * sure to update the other copy when modifying this file.
 */
abstract class StandaloneTypeMirror implements TypeMirror {
  private final TypeKind kind;
  private final List<? extends AnnotationMirror> annotations;

  protected StandaloneTypeMirror(TypeKind kind) {
    this(kind, Collections.emptyList());
  }

  protected StandaloneTypeMirror(TypeKind kind, List<? extends AnnotationMirror> annotations) {
    this.kind = kind;
    this.annotations = Collections.unmodifiableList(new ArrayList<>(annotations));
  }

  @Override
  public TypeKind getKind() {
    return kind;
  }

  @Override
  public <R, P> R accept(TypeVisitor<R, P> v, P p) {
    switch (kind) {
      case BOOLEAN:
      case BYTE:
      case SHORT:
      case INT:
      case LONG:
      case CHAR:
      case FLOAT:
      case DOUBLE:
        return v.visitPrimitive((PrimitiveType) this, p);
      case PACKAGE:
      case VOID:
      case NONE:
        return v.visitNoType((NoType) this, p);
      case NULL:
        return v.visitNull((NullType) this, p);
      case ARRAY:
        return v.visitArray((ArrayType) this, p);
      case DECLARED:
        return v.visitDeclared((DeclaredType) this, p);
      case ERROR:
        return v.visitError((ErrorType) this, p);
      case TYPEVAR:
        return v.visitTypeVariable((TypeVariable) this, p);
      case WILDCARD:
        return v.visitWildcard((WildcardType) this, p);
      case EXECUTABLE:
        return v.visitExecutable((ExecutableType) this, p);
      case OTHER:
        return v.visit(this, p);
      case UNION:
        return v.visitUnion((UnionType) this, p);
      case INTERSECTION:
        return v.visitIntersection((IntersectionType) this, p);
      default:
        throw new AssertionError(String.format("Unknown TypeKind: %s", kind));
    }
  }

  @Override
  public List<? extends AnnotationMirror> getAnnotationMirrors() {
    return this.annotations;
  }

  @Override
  public <A extends Annotation> A getAnnotation(Class<A> annotationType) {
    // This one is really difficult to implement, and also generally a bad thing to use anyway
    throw new UnsupportedOperationException();
  }

  @Override
  public <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationType) {
    // This one is really difficult to implement, and also generally a bad thing to use anyway
    throw new UnsupportedOperationException();
  }
}


text:
template: formations.jade
title: Education
---


text:
package org.apache.activemq.artemis.rest.test;

import org.apache.activemq.artemis.rest.queue.QueueDeployment;
import org.apache.activemq.artemis.rest.util.Constants;
import org.apache.activemq.artemis.rest.util.CustomHeaderLinkStrategy;
import org.apache.activemq.artemis.rest.util.LinkHeaderLinkStrategy;
import org.jboss.logging.Logger;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.spi.Link;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

import static org.jboss.resteasy.test.TestPortProvider.generateURL;

public class ClientAckQueueTest extends MessageTestBase {
   private static final Logger log = Logger.getLogger(ClientAckQueueTest.class);

   @BeforeClass
   public static void setup() throws Exception {
      QueueDeployment deployment1 = new QueueDeployment("testQueue", true);
      manager.getQueueManager().deploy(deployment1);
   }

   @Test
   public void testAckTimeoutX2() throws Exception {
      QueueDeployment deployment = new QueueDeployment();
      deployment.setConsumerSessionTimeoutSeconds(1);
      deployment.setDuplicatesAllowed(true);
      deployment.setDurableSend(false);
      deployment.setName("testAck");
      manager.getQueueManager().deploy(deployment);

      manager.getQueueManager().setLinkStrategy(new LinkHeaderLinkStrategy());
      testAckTimeout();
      manager.getQueueManager().setLinkStrategy(new CustomHeaderLinkStrategy());
      testAckTimeout();
   }

   private void testAckTimeout() throws Exception {
      ClientRequest request = new ClientRequest(generateURL("/queues/testAck"));

      ClientResponse<?> response = Util.head(request);

      Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
      log.debug("create: " + sender);
      Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
      log.debug("pull: " + consumers);
      response = Util.setAutoAck(consumers, false);
      Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
      log.debug("poller: " + consumeNext);

      {
         ClientResponse<?> res = sender.request().body("text/plain", Integer.toString(1)).post();
         res.releaseConnection();
         Assert.assertEquals(201, res.getStatus());

         res = consumeNext.request().post(String.class);
         res.releaseConnection();
         Assert.assertEquals(200, res.getStatus());
         Link ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
         log.debug("ack: " + ack);
         Assert.assertNotNull(ack);
         Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consumer");
         log.debug("session: " + session);
         consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledge-next");
         log.debug("consumeNext: " + consumeNext);

         // test timeout
         Thread.sleep(2000);

         ClientResponse ackRes = ack.request().formParameter("acknowledge", "true").post();
         ackRes.releaseConnection();
         Assert.assertEquals(412, ackRes.getStatus());
         log.debug("**** Successfully failed ack");
         consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), ackRes, "acknowledge-next");
         log.debug("consumeNext: " + consumeNext);
      }
      {
         ClientResponse<?> res = consumeNext.request().header(Constants.WAIT_HEADER, "2").post(String.class);
         res.releaseConnection();
         Assert.assertEquals(200, res.getStatus());
         Link ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
         log.debug("ack: " + ack);
         Assert.assertNotNull(ack);
         Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consumer");
         log.debug("session: " + session);
         consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledge-next");
         log.debug("consumeNext: " + consumeNext);

         ClientResponse ackRes = ack.request().formParameter("acknowledge", "true").post();
         if (ackRes.getStatus() != 204) {
            log.debug(ackRes.getEntity(String.class));
         }
         ackRes.releaseConnection();
         Assert.assertEquals(204, ackRes.getStatus());

         Assert.assertEquals(204, session.request().delete().getStatus());
      }
   }

   @Test
   public void testSuccessFirstX2() throws Exception {
      String testName = "testSuccessFirstX2";

      QueueDeployment queueDeployment = new QueueDeployment(testName, true);
      manager.getQueueManager().deploy(queueDeployment);

      manager.getQueueManager().setLinkStrategy(new LinkHeaderLinkStrategy());
      testSuccessFirst(1, testName);
      manager.getQueueManager().setLinkStrategy(new CustomHeaderLinkStrategy());
      testSuccessFirst(3, testName);
   }

   private void testSuccessFirst(int start, String queueName) throws Exception {
      ClientRequest request = new ClientRequest(generateURL(Util.getUrlPath(queueName)));

      ClientResponse<?> response = Util.head(request);
      Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
      log.debug("create: " + sender);
      Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
      log.debug("pull-consumers: " + consumers);
      response = Util.setAutoAck(consumers, false);
      Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
      log.debug("acknowledge-next: " + consumeNext);

      String data = Integer.toString(start);
      log.debug("Sending: " + data);
      ClientResponse<?> res = sender.request().body("text/plain", data).post();
      res.releaseConnection();
      Assert.assertEquals(201, res.getStatus());

      log.debug("call acknowledge-next");
      res = consumeNext.request().post(String.class);
      Assert.assertEquals(200, res.getStatus());
      Assert.assertEquals(Integer.toString(start++), res.getEntity());
      res.releaseConnection();
      Link ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
      log.debug("ack: " + ack);
      Assert.assertNotNull(ack);
      Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consumer");
      log.debug("session: " + session);
      consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledge-next");
      log.debug("consumeNext: " + consumeNext);
      ClientResponse ackRes = ack.request().formParameter("acknowledge", "true").post();
      ackRes.releaseConnection();
      Assert.assertEquals(204, ackRes.getStatus());
      consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), ackRes, "acknowledge-next");

      log.debug("sending next...");
      String data2 = Integer.toString(start);
      log.debug("Sending: " + data2);
      res = sender.request().body("text/plain", data2).post();
      res.releaseConnection();
      Assert.assertEquals(201, res.getStatus());

      log.debug(consumeNext);
      res = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
      Assert.assertEquals(200, res.getStatus());
      Assert.assertEquals(Integer.toString(start++), res.getEntity());
      res.releaseConnection();
      ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
      log.debug("ack: " + ack);
      Assert.assertNotNull(ack);
      session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consumer");
      log.debug("session: " + session);
      ackRes = ack.request().formParameter("acknowledge", "true").post();
      ackRes.releaseConnection();
      Assert.assertEquals(204, ackRes.getStatus());
      consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), ackRes, "acknowledge-next");
      log.debug("consumeNext: " + consumeNext);
      res = consumeNext.request().post(String.class);
      res.releaseConnection();

      log.debug(res.getStatus());

      Assert.assertEquals(204, session.request().delete().getStatus());
   }

   @Test
   public void testPullX2() throws Exception {
      String testName = "testPullX2";

      QueueDeployment queueDeployment = new QueueDeployment(testName, true);
      manager.getQueueManager().deploy(queueDeployment);

      manager.getQueueManager().setLinkStrategy(new LinkHeaderLinkStrategy());
      testPull(1, testName);
      manager.getQueueManager().setLinkStrategy(new CustomHeaderLinkStrategy());
      testPull(4, testName);
   }

   private void testPull(int start, String queueName) throws Exception {
      ClientRequest request = new ClientRequest(generateURL(Util.getUrlPath(queueName)));

      ClientResponse<?> response = Util.head(request);
      Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
      log.debug("create: " + sender);
      Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
      log.debug("pull: " + consumers);
      response = Util.setAutoAck(consumers, false);
      Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
      log.debug("poller: " + consumeNext);

      ClientResponse<String> res = consumeNext.request().post(String.class);
      res.releaseConnection();
      Assert.assertEquals(503, res.getStatus());
      consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledge-next");
      log.debug(consumeNext);
      res = sender.request().body("text/plain", Integer.toString(start)).post();
      res.releaseConnection();
      Assert.assertEquals(201, res.getStatus());
      res = consumeNext.request().post(String.class);
      Assert.assertEquals(200, res.getStatus());
      Assert.assertEquals(Integer.toString(start++), res.getEntity());
      res.releaseConnection();
      Link ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
      log.debug("ack: " + ack);
      ClientResponse ackRes = ack.request().formParameter("acknowledge", "true").post();
      ackRes.releaseConnection();
      Assert.assertEquals(204, ackRes.getStatus());
      res = consumeNext.request().post();
      res.releaseConnection();
      Assert.assertEquals(503, res.getStatus());
      res = sender.request().body("text/plain", Integer.toString(start)).post();
      res.releaseConnection();
      Assert.assertEquals(201, res.getStatus());
      res = sender.request().body("text/plain", Integer.toString(start + 1)).post();
      res.releaseConnection();
      Assert.assertEquals(201, res.getStatus());

      res = consumeNext.request().post(String.class);
      Assert.assertEquals(200, res.getStatus());
      Assert.assertEquals(Integer.toString(start++), res.getEntity());
      res.releaseConnection();
      ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
      log.debug("ack: " + ack);
      ackRes = ack.request().formParameter("acknowledge", "true").post();
      ackRes.releaseConnection();
      Assert.assertEquals(204, ackRes.getStatus());

      res = consumeNext.request().post(String.class);
      Assert.assertEquals(200, res.getStatus());
      Assert.assertEquals(Integer.toString(start++), res.getEntity());
      res.releaseConnection();
      ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
      log.debug("ack: " + ack);
      ackRes = ack.request().formParameter("acknowledge", "true").post();
      ackRes.releaseConnection();
      Assert.assertEquals(204, ackRes.getStatus());
      Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), ackRes, "consumer");

      res = consumeNext.request().post();
      res.releaseConnection();
      Assert.assertEquals(503, res.getStatus());
      log.debug(session);
      res = session.request().delete();
      res.releaseConnection();
      Assert.assertEquals(204, res.getStatus());
   }

   @Test
   public void testReconnectX2() throws Exception {
      String testName = "testReconnectX2";

      QueueDeployment queueDeployment = new QueueDeployment(testName, true);
      manager.getQueueManager().deploy(queueDeployment);

      manager.getQueueManager().setLinkStrategy(new LinkHeaderLinkStrategy());
      testReconnect(testName);
      manager.getQueueManager().setLinkStrategy(new CustomHeaderLinkStrategy());
      testReconnect(testName);
   }

   private void testReconnect(String queueName) throws Exception {
      ClientRequest request = new ClientRequest(generateURL(Util.getUrlPath(queueName)));

      ClientResponse<?> response = Util.head(request);
      Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
      log.debug("create: " + sender);
      Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
      log.debug("pull: " + consumers);
      response = Util.setAutoAck(consumers, false);
      Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
      log.debug("poller: " + consumeNext);

      ClientResponse<?> res = sender.request().body("text/plain", Integer.toString(1)).post();
      res.releaseConnection();
      Assert.assertEquals(201, res.getStatus());

      res = consumeNext.request().post(String.class);
      res.releaseConnection();
      Assert.assertEquals(200, res.getStatus());
      Link ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
      log.debug("ack: " + ack);
      Assert.assertNotNull(ack);
      Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consumer");
      log.debug("session: " + session);
      consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledge-next");
      log.debug("consumeNext: " + consumeNext);
      ClientResponse ackRes = ack.request().formParameter("acknowledge", "true").post();
      ackRes.releaseConnection();
      Assert.assertEquals(204, ackRes.getStatus());
      consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), ackRes, "acknowledge-next");
      log.debug("before close session consumeNext: " + consumeNext);

      // test reconnect with a disconnected acknowledge-next
      Assert.assertEquals(204, session.request().delete().getStatus());

      res = sender.request().body("text/plain", Integer.toString(2)).post();
      res.releaseConnection();
      Assert.assertEquals(201, res.getStatus());

      res = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
      res.releaseConnection();
      Assert.assertEquals(200, res.getStatus());
      ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
      log.debug("ack: " + ack);
      Assert.assertNotNull(ack);
      ackRes = ack.request().formParameter("acknowledge", "true").post();
      ackRes.releaseConnection();
      Assert.assertEquals(204, ackRes.getStatus());
      session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), ackRes, "consumer");
      consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), ackRes, "acknowledge-next");
      log.debug("session: " + session);

      // test reconnect with disconnected acknowledge

      res = sender.request().body("text/plain", Integer.toString(3)).post();
      res.releaseConnection();
      Assert.assertEquals(201, res.getStatus());
      res = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
      res.releaseConnection();
      Assert.assertEquals(200, res.getStatus());
      ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
      log.debug("ack: " + ack);
      Assert.assertNotNull(ack);

      Assert.assertEquals(204, session.request().delete().getStatus());

      ackRes = ack.request().formParameter("acknowledge", "true").post();
      ackRes.releaseConnection();
      Assert.assertEquals(412, ackRes.getStatus());
      consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), ackRes, "acknowledge-next");
      res = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
      res.releaseConnection();
      Assert.assertEquals(200, res.getStatus());
      ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
      log.debug("ack: " + ack);
      Assert.assertNotNull(ack);
      ackRes = ack.request().formParameter("acknowledge", "true").post();
      ackRes.releaseConnection();
      Assert.assertEquals(204, ackRes.getStatus());
      session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), ackRes, "consumer");

      Assert.assertEquals(204, session.request().delete().getStatus());
   }
}


text:
import gsap from 'gsap';

declare var spirit: spirit.SpiritStatic;

export = spirit;
export as namespace spirit;

declare namespace spirit {
  type GSAP = typeof gsap;

  interface SpiritStatic {
    config: Config;

    version: string;

    setup(gsapInstance: GSAP): Promise<void>;

    create(data: DataGroup | DataGroup[], element?: Element): Groups;

    load(url: string, element?: Element): Promise<Groups>;

    groups: Groups;

    loadAnimation(
      options: LoadAnimationOptions
    ): Promise<{ [group: string]: gsap.core.Timeline } & gsap.core.Timeline>;
  }

  type LoadAnimationOptions = ({ path: string } | { animationData: object }) &
    Partial<{
      container: Element;

      autoPlay: boolean;

      loop: boolean | number;

      yoyo: boolean;

      delay: number;

      timeScale: number;
    }>;

  interface EvalMap {
    regex: RegExp;

    map: any;
  }

  type sortFn = (a: number | object, b: number | object) => number | boolean;

  interface List<T> extends Iterable<T> {
    [key: number]: T;

    [Symbol.iterator](): Iterator<T>;

    duplicates: boolean | object;

    checkOnDuplicates(): void;

    sortOn: boolean | string | sortFn;

    sort(): void;

    linkedList: boolean;

    linkItems(): void;

    list: T[];

    length: number;

    at(index: number): T;

    add(item: T | object | Array<T | object>): T | T[];

    remove(item: T | T[]): T | T[];

    clear(): void;

    each<K>(callback: (item: T) => K): K[];

    toArray(): T[];
  }

  interface Props extends List<Prop> {
    mappings: EvalMap[];

    get(name: string): Prop;

    haveProp(name: string): boolean;

    toObject(): object;

    destroy(): void;
  }

  interface Prop {
    keyframes: Keyframes;

    list: Props;

    next(): Prop | null;

    prev(): Prop | null;

    setupBubbleEvents(): void;

    toObject(): object;

    isCSSTransform(): boolean;

    destroy(): void;
  }

  interface Keyframes extends List<Keyframe> {
    get(time: string | number): Keyframe;

    mappings(): EvalMap[];

    toObject(): object;

    destroy(): void;
  }

  interface Keyframe {
    time: number;

    ease?: string;

    value: any;

    list: Keyframes;

    prev(): Keyframe | null;

    next(): Keyframe | null;

    isEval(): boolean;

    toObject(): object;

    destroy(): void;
  }

  interface Timelines extends List<Timeline> {
    get(transformObject: Element | object): Timeline;
  }

  interface Timeline {
    type: 'dom' | 'object';

    transferObject: Element | object | null;

    label?: string;

    path: string;

    id?: string;

    props: Props;

    toObject(): object;

    destroy(): void;
  }

  interface Config {
    debug: boolean;

    overwriteAnimations: boolean;

    gsap: {
      instance: GSAP | null;

      autoInject: boolean;

      autoInjectUrl: string;
    };
  }

  interface Groups extends List<Group> {
    get(name: string): Group;

    groupNames(): string[];
  }

  interface Group {
    timeline: gsap.core.Timeline;

    timelines: Timelines;

    timeScale: number;

    duration: number;

    list: Groups;

    name: string;

    toObject(): object;

    construct(): gsap.core.Timeline;
  }

  interface DataTimeline {
    type: 'dom' | 'object';

    id?: string;

    label?: string;

    path?: string;

    props?: object;
  }

  interface DataGroup {
    name: string;

    timeScale?: number;

    timelines?: DataTimeline[];
  }
}


text:
package gengorums

import (
	"bytes"
	"fmt"
	"strings"
	"text/template"

	"github.com/relab/gorums"
	"google.golang.org/protobuf/compiler/protogen"
	"google.golang.org/protobuf/proto"
	"google.golang.org/protobuf/runtime/protoimpl"
)

// importMap holds the mapping between short-hand import name
// and full import path for the default package.
var importMap = map[string]protogen.GoImportPath{
	"io":           protogen.GoImportPath("io"),
	"time":         protogen.GoImportPath("time"),
	"fmt":          protogen.GoImportPath("fmt"),
	"log":          protogen.GoImportPath("log"),
	"math":         protogen.GoImportPath("math"),
	"rand":         protogen.GoImportPath("math/rand"),
	"sync":         protogen.GoImportPath("sync"),
	"atomic":       protogen.GoImportPath("sync/atomic"),
	"context":      protogen.GoImportPath("context"),
	"trace":        protogen.GoImportPath("golang.org/x/net/trace"),
	"grpc":         protogen.GoImportPath("google.golang.org/grpc"),
	"codes":        protogen.GoImportPath("google.golang.org/grpc/codes"),
	"status":       protogen.GoImportPath("google.golang.org/grpc/status"),
	"backoff":      protogen.GoImportPath("google.golang.org/grpc/backoff"),
	"proto":        protogen.GoImportPath("google.golang.org/protobuf/proto"),
	"gorums":       protogen.GoImportPath("github.com/relab/gorums"),
	"ordering":     protogen.GoImportPath("github.com/relab/gorums/ordering"),
	"protoreflect": protogen.GoImportPath("google.golang.org/protobuf/reflect/protoreflect"),
}

func addImport(path, ident string, g *protogen.GeneratedFile) string {
	pkg := path[strings.LastIndex(path, "/")+1:]
	impPath, ok := importMap[pkg]
	if !ok {
		impPath = protogen.GoImportPath(path)
		importMap[pkg] = impPath
	}
	return g.QualifiedGoIdent(impPath.Ident(ident))
}

var funcMap = template.FuncMap{
	// this function will stop the generator if incorrect input is used
	// the output contains the descriptive strings below to help debug any bad inputs.
	"use": func(pkgIdent string, g *protogen.GeneratedFile) string {
		if strings.Count(pkgIdent, ".") != 1 {
			return "EXPECTED PACKAGE NAME AND IDENTIFIER, but got: " + pkgIdent
		}
		i := strings.Index(pkgIdent, ".")
		path, ident := pkgIdent[0:i], pkgIdent[i+1:]
		pkg, ok := importMap[path]
		if !ok {
			return "IMPORT NOT FOUND: " + path
		}
		return g.QualifiedGoIdent(pkg.Ident(ident))
	},
	"hasPerNodeArg": func(method *protogen.Method) bool {
		return hasMethodOption(method, gorums.E_PerNodeArg)
	},
	"perNodeArg": func(method *protogen.Method, arg string) string {
		if hasMethodOption(method, gorums.E_PerNodeArg) {
			return arg
		}
		return ""
	},
	"perNodeFnType": func(g *protogen.GeneratedFile, method *protogen.Method, arg string) string {
		if hasMethodOption(method, gorums.E_PerNodeArg) {
			inType := g.QualifiedGoIdent(method.Input.GoIdent)
			return arg + " func(*" + inType + ", uint32) *" + inType
		}
		return ""
	},
	"correctableStream": func(method *protogen.Method) bool {
		return hasMethodOption(method, gorums.E_Correctable) && method.Desc.IsStreamingServer()
	},
	"withCorrectable": func(method *protogen.Method, arg string) string {
		if hasMethodOption(method, gorums.E_Correctable) {
			return arg
		}
		return ""
	},
	"withPromise": func(method *protogen.Method, arg string) string {
		if hasMethodOption(method, callTypesWithPromiseObject...) {
			return arg
		}
		return ""
	},
	"docName": func(method *protogen.Method) string {
		return callType(method).docName
	},
	"fullName": func(method *protogen.Method) string {
		return fmt.Sprintf("/%s/%s", method.Parent.Desc.FullName(), method.Desc.Name())
	},
	"serviceName": func(method *protogen.Method) string {
		return string(method.Parent.Desc.Name())
	},
	"in": func(g *protogen.GeneratedFile, method *protogen.Method) string {
		return g.QualifiedGoIdent(method.Input.GoIdent)
	},
	"isOneway": func(method *protogen.Method) bool {
		return hasMethodOption(method, gorums.E_Multicast, gorums.E_Unicast)
	},
	"methods": func(services []*protogen.Service) (methods []*protogen.Method) {
		for _, s := range services {
			methods = append(methods, s.Methods...)
		}
		return
	},
	"out":                   out,
	"outType":               outType,
	"internalOut":           internalOut,
	"customOut":             customOut,
	"mapInternalOutType":    mapInternalOutType,
	"mapCorrectableOutType": mapCorrectableOutType,
	"mapAsyncOutType":       mapAsyncOutType,
	"qspecServices":         qspecServices,
	"qspecMethods":          qspecMethods,
	"unexport":              unexport,
	"contains":              strings.Contains,
	"field":                 field,
}

type mapFunc func(*protogen.GeneratedFile, *protogen.Method, map[string]string)

// mapType returns a map of types as defined by the function mapFn.
func mapType(g *protogen.GeneratedFile, services []*protogen.Service, mapFn mapFunc) (s map[string]string) {
	s = make(map[string]string)
	for _, service := range services {
		for _, method := range service.Methods {
			mapFn(g, method, s)
		}
	}
	return s
}

func out(g *protogen.GeneratedFile, method *protogen.Method) string {
	return g.QualifiedGoIdent(method.Output.GoIdent)
}

func outType(method *protogen.Method, out string) string {
	return fmt.Sprintf("%s%s", callType(method).outPrefix, field(out))
}

func internalOut(out string) string {
	return fmt.Sprintf("internal%s", field(out))
}

// customOut returns the output type to be used for the given method.
// This may be the output type specified in the rpc line,
// or if a custom_return_type option is provided for the method,
// this provided custom type will be returned.
func customOut(g *protogen.GeneratedFile, method *protogen.Method) string {
	ext := protoimpl.X.MessageOf(method.Desc.Options()).Interface()
	customOutType := fmt.Sprintf("%v", proto.GetExtension(ext, gorums.E_CustomReturnType))
	outType := method.Output.GoIdent
	if customOutType != "" {
		outType.GoName = customOutType
	}
	return g.QualifiedGoIdent(outType)
}

func mapInternalOutType(g *protogen.GeneratedFile, services []*protogen.Service) (s map[string]string) {
	return mapType(g, services, func(g *protogen.GeneratedFile, method *protogen.Method, s map[string]string) {
		if hasMethodOption(method, callTypesWithInternal...) {
			out := out(g, method)
			intOut := internalOut(out)
			s[intOut] = out
		}
	})
}

func mapAsyncOutType(g *protogen.GeneratedFile, services []*protogen.Service) (s map[string]string) {
	return mapType(g, services, func(g *protogen.GeneratedFile, method *protogen.Method, s map[string]string) {
		if hasAllMethodOption(method, gorums.E_Quorumcall, gorums.E_Async) {
			out := customOut(g, method)
			futOut := outType(method, out)
			s[futOut] = out
		}
	})
}

func mapCorrectableOutType(g *protogen.GeneratedFile, services []*protogen.Service) (s map[string]string) {
	return mapType(g, services, func(g *protogen.GeneratedFile, method *protogen.Method, s map[string]string) {
		if hasMethodOption(method, gorums.E_Correctable) {
			out := customOut(g, method)
			corrOut := outType(method, out)
			s[corrOut] = out
		}
	})
}

// field derives an embedded field name from the given typeName.
// If typeName contains a package, this will be removed.
func field(typeName string) string {
	return typeName[strings.LastIndex(typeName, ".")+1:]
}

func unexport(s string) string { return strings.ToLower(s[:1]) + s[1:] }

func parseTemplate(name, tmpl string) *template.Template {
	return template.Must(template.New(name).Funcs(funcMap).Parse(tmpl))
}

func mustExecute(t *template.Template, data interface{}) string {
	var b bytes.Buffer
	if err := t.Execute(&b, data); err != nil {
		panic(err)
	}
	return b.String()
}


text:
require "url2yml/version"
require 'uri'
require 'cgi'

module Url2yml
  def self.cassandra_url2yml url, environment
    parser = CassandraUrlParser.new
    if parser.parse url
      parser.to_yml environment
    else
      "INVALID CASSANDRA URL: #{url}"
    end
  end

  def self.db_url2yml url, environment
    parser = DbUrlParser.new
    if parser.parse url
      parser.to_yml environment
    else
      "INVALID DB URL: #{url}"
    end
  end

  def self.s3_url2yml url
    parser = S3UrlParser.new
    if parser.parse url
      "access_key_id: #{parser.h_data[:access_key_id]}\n" +
      "secret_access_key: #{parser.h_data[:secret_access_key]}\n"
    else
      "INVALID S3 URL: #{url}"
    end
  end

  class S3UrlParser
    attr_accessor :h_data

    # s3://access_key_id:secret_access_key
    def parse url
       begin
        @h_data = {}
        match_data = /s3:\/\/(?<access_key_id>[[:alnum:]]+):(?<secret_access_key>[[:alnum:]]+)/.match(url)

        @h_data[:access_key_id] = match_data[:access_key_id]
        @h_data[:secret_access_key] = match_data[:secret_access_key]
        true
       rescue
          msg = "ERROR PARSING S3 URL #{url}: #{$!}"
          if defined?( Rails )
            Rails.logger.error msg
          else
            puts msg
          end
         false
       end
    end
  end

  class CassandraUrlParser
    attr_accessor :h_data

    # cassandra://hostname:port/keyspace
    # TODO: add usr/pwd
    def parse url
       begin
        @h_data = {}

        scheme, remaining_url = url.split( '://' )
        raise "invalid scheme" unless scheme == 'cassandra'
        raise "invalid url" if remaining_url.strip.nil? || remaining_url.strip == ''

        host_port, keyspace = remaining_url.split( '/' )
        raise "no keyspace" if keyspace.nil? || keyspace.strip == ''

        host, port = host_port.split( ':' )

        port = 9160 if port.nil? || post.strip == ''
        @h_data[:host] = host
        @h_data[:port] = port
        @h_data[:keyspace] = keyspace

        true
       rescue
          msg = "ERROR PARSING CASSANDRA URL #{url}: #{$!}"
          if defined?( Rails )
            Rails.logger.error msg
          else
            puts msg
          end
         false
       end
    end

    def to_yml rails_env
      rails_env = (ENV["RAILS_ENV"] || ENV["RACK_ENV"]) if rails_env.nil? || rails_env.strip == ''

      # Very important to always ensure test env has test suffix so we never blow away a
      # db other than test, ALSO allow a development url to have '_development' replaced with
      # '_test' so you don't have to explicitly change URLs when running 'rake spec' etc
      if rails_env == "test"
        keyspace = h_data[:keyspace]
        h_data[:keyspace] = keyspace.gsub( /_development$/, '' ) if keyspace =~ /_development$/
        h_data[:keyspace] = h_data[:keyspace] + '_test' unless h_data[:keyspace]=~ /_test$/
      end

      yml = "#{rails_env}:\n"
      [:host, :port, :keyspace].each do |attr|
        v = h_data[attr]
        yml += " #{attr.to_s}: #{v}\n" if v
      end
      yml
    end
  end

  class DbUrlParser
    attr_accessor :h_data

    def parse url
       begin
        @h_data = {}
        uri = URI.parse(url)

        adapter = uri.scheme
        adapter = "postgresql" if adapter == "postgres"
        @h_data[:adapter] = adapter

        @h_data[:database] = (uri.path || "").split("/")[1]

        @h_data[:username] = uri.user
        @h_data[:password] = uri.password

        @h_data[:host] = uri.host

        @h_data[:port] = uri.port

        @h_data[:params] = CGI.parse(uri.query || "")

        @h_data[:adapter] && @h_data[:database] && @h_data[:password]
        true
       rescue
          msg = "ERROR PARSING DB URL #{url}: #{$!}"
          if defined?( Rails )
            Rails.logger.error msg
          else
            puts msg
          end
         false
       end
    end

    def to_yml rails_env
      rails_env = (ENV["RAILS_ENV"] || ENV["RACK_ENV"]) if rails_env.nil? || rails_env.strip == ''

      # Very important to always ensure test env has test suffix so we never blow away a
      # db other than test, ALSO allow a development url to have '_development' replaced with
      # '_test' so you don't have to explicitly change URLs when running 'rake spec' etc
      if rails_env == "test"
        database = h_data[:database]
        if database =~ /_development$/
          h_data[:database] = database.gsub( /_development$/, '' )
        end

        unless h_data[:database]=~ /_test$/
          h_data[:database] = h_data[:database] + '_test'
        end
      end

      yml = "#{rails_env}:\n"
      [:adapter, :database, :username, :password, :host, :port].each do |attr|
        v = h_data[attr]
        yml += " #{attr.to_s}: #{v}\n" if v
      end
      if h_data[:params]
        h_data[:params].keys.each do |attr|
          v = h_data[:params][attr]
          v = v[0] if v && v.is_a?(Array) && v.size == 1
          yml += " #{attr.to_s}: #{v}\n" if v
        end
      end
      yml
    end
  end
end


text:
'use strict';

/**
 * Module dependencies.
 */
var mongoose = require('mongoose'),
    errorHandler = require('./errors.server.controller'),
    Busline = mongoose.model('Busline'),
    _ = require('lodash');

/**
 * Create a article
 */
exports.create = function(req, res) {
    var busline = new Busline(req.body);
    busline.user = req.user;

    busline.save(function(err) {
        if (err) {
            return res.status(400).send({
                message: errorHandler.getErrorMessage(err)
            });
        } else {
            res.json(busline);
        }
    });
};

/**
 * Show the current busline
 */
exports.read = function(req, res) {
    res.json(req.busline);
};

/**
 * Update a busline
 */
exports.update = function(req, res) {
    var busline = req.busline;

    busline = _.extend(busline, req.body);

    busline.save(function(err) {
        if (err) {
            return res.status(400).send({
                message: errorHandler.getErrorMessage(err)
            });
        } else {
            res.json(busline);
        }
    });
};

/**
 * Delete an busline
 */
exports.delete = function(req, res) {
    var busline = req.busline;

    busline.remove(function(err) {
        if (err) {
            return res.status(400).send({
                message: errorHandler.getErrorMessage(err)
            });
        } else {
            res.json(busline);
        }
    });
};

/**
 * List of Articles
 */
exports.list = function(req, res) {
    Busline.find().sort('-created').populate('user', 'displayName').exec(function(err, buslines) {
        if (err) {
            return res.status(400).send({
                message: errorHandler.getErrorMessage(err)
            });
        } else {
            res.json(buslines);
        }
    });
};

/**
 * Article middleware
 */
exports.buslineByID = function(req, res, next, id) {
    Busline.findById(id).populate('user', 'displayName').exec(function(err, busline) {
        if (err) return next(err);
        if (!busline) return next(new Error('Failed to load busline ' + id));
        req.busline = busline;
        next();
    });
};

/**
 * Article authorization middleware
 */
exports.hasAuthorization = function(req, res, next) {
    if (req.busline.user.id !== req.user.id) {
        return res.status(403).send({
            message: 'User is not authorized'
        });
    }
    next();
};