text:
/* AUTO-GENERATED FILE.  DO NOT MODIFY.
 *
 * This class was automatically generated by the
 * aapt tool from the resource data it found.  It
 * should not be modified by hand.
 */

package com.o3dr.android.client.test;

public final class R {
    public static final class attr {
        /**
Must be a boolean value, either "true" or "false".

This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
         */
        public static final int circleCrop=0x7f010002;
        /**
Must be a floating point value, such as "1.2".

This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
         */
        public static final int imageAspectRatio=0x7f010001;
        /**
Must be one of the following constant values.

<colgroup align="left" />
<colgroup align="left" />
<colgroup align="left" />

Constant	Value	Description

none	0

adjust_width	1

adjust_height	2

         */
        public static final int imageAspectRatioAdjust=0x7f010000;
    }
    public static final class color {
        public static final int common_action_bar_splitter=0x7f060000;
        public static final int common_signin_btn_dark_text_default=0x7f060001;
        public static final int common_signin_btn_dark_text_disabled=0x7f060002;
        public static final int common_signin_btn_dark_text_focused=0x7f060003;
        public static final int common_signin_btn_dark_text_pressed=0x7f060004;
        public static final int common_signin_btn_default_background=0x7f060005;
        public static final int common_signin_btn_light_text_default=0x7f060006;
        public static final int common_signin_btn_light_text_disabled=0x7f060007;
        public static final int common_signin_btn_light_text_focused=0x7f060008;
        public static final int common_signin_btn_light_text_pressed=0x7f060009;
        public static final int common_signin_btn_text_dark=0x7f06000a;
        public static final int common_signin_btn_text_light=0x7f06000b;
    }
    public static final class drawable {
        public static final int common_full_open_on_phone=0x7f020000;
        public static final int common_ic_googleplayservices=0x7f020001;
        public static final int common_signin_btn_icon_dark=0x7f020002;
        public static final int common_signin_btn_icon_disabled_dark=0x7f020003;
        public static final int common_signin_btn_icon_disabled_focus_dark=0x7f020004;
        public static final int common_signin_btn_icon_disabled_focus_light=0x7f020005;
        public static final int common_signin_btn_icon_disabled_light=0x7f020006;
        public static final int common_signin_btn_icon_focus_dark=0x7f020007;
        public static final int common_signin_btn_icon_focus_light=0x7f020008;
        public static final int common_signin_btn_icon_light=0x7f020009;
        public static final int common_signin_btn_icon_normal_dark=0x7f02000a;
        public static final int common_signin_btn_icon_normal_light=0x7f02000b;
        public static final int common_signin_btn_icon_pressed_dark=0x7f02000c;
        public static final int common_signin_btn_icon_pressed_light=0x7f02000d;
        public static final int common_signin_btn_text_dark=0x7f02000e;
        public static final int common_signin_btn_text_disabled_dark=0x7f02000f;
        public static final int common_signin_btn_text_disabled_focus_dark=0x7f020010;
        public static final int common_signin_btn_text_disabled_focus_light=0x7f020011;
        public static final int common_signin_btn_text_disabled_light=0x7f020012;
        public static final int common_signin_btn_text_focus_dark=0x7f020013;
        public static final int common_signin_btn_text_focus_light=0x7f020014;
        public static final int common_signin_btn_text_light=0x7f020015;
        public static final int common_signin_btn_text_normal_dark=0x7f020016;
        public static final int common_signin_btn_text_normal_light=0x7f020017;
        public static final int common_signin_btn_text_pressed_dark=0x7f020018;
        public static final int common_signin_btn_text_pressed_light=0x7f020019;
        public static final int ic_plusone_medium_off_client=0x7f02001a;
        public static final int ic_plusone_small_off_client=0x7f02001b;
        public static final int ic_plusone_standard_off_client=0x7f02001c;
        public static final int ic_plusone_tall_off_client=0x7f02001d;
    }
    public static final class id {
        public static final int adjust_height=0x7f080000;
        public static final int adjust_width=0x7f080001;
        public static final int dialog_cancel_button=0x7f080005;
        public static final int dialog_install_button=0x7f080006;
        public static final int dialog_message=0x7f080004;
        public static final int dialog_title=0x7f080003;
        public static final int dialog_update_button=0x7f080007;
        public static final int none=0x7f080002;
    }
    public static final class integer {
        public static final int google_play_services_version=0x7f070000;
    }
    public static final class layout {
        public static final int activity_install_service_dialog=0x7f030000;
        public static final int activity_update_service_dialog=0x7f030001;
    }
    public static final class raw {
        public static final int gtm_analytics=0x7f040000;
    }
    public static final class string {
        public static final int common_android_wear_notification_needs_update_text=0x7f050000;
        public static final int common_android_wear_update_text=0x7f050001;
        public static final int common_android_wear_update_title=0x7f050002;
        public static final int common_google_play_services_enable_button=0x7f050003;
        public static final int common_google_play_services_enable_text=0x7f050004;
        public static final int common_google_play_services_enable_title=0x7f050005;
        public static final int common_google_play_services_error_notification_requested_by_msg=0x7f050006;
        public static final int common_google_play_services_install_button=0x7f050007;
        public static final int common_google_play_services_install_text_phone=0x7f050008;
        public static final int common_google_play_services_install_text_tablet=0x7f050009;
        public static final int common_google_play_services_install_title=0x7f05000a;
        public static final int common_google_play_services_invalid_account_text=0x7f05000b;
        public static final int common_google_play_services_invalid_account_title=0x7f05000c;
        public static final int common_google_play_services_needs_enabling_title=0x7f05000d;
        public static final int common_google_play_services_network_error_text=0x7f05000e;
        public static final int common_google_play_services_network_error_title=0x7f05000f;
        public static final int common_google_play_services_notification_needs_installation_title=0x7f050010;
        public static final int common_google_play_services_notification_needs_update_title=0x7f050011;
        public static final int common_google_play_services_notification_ticker=0x7f050012;
        public static final int common_google_play_services_unknown_issue=0x7f050013;
        public static final int common_google_play_services_unsupported_text=0x7f050014;
        public static final int common_google_play_services_unsupported_title=0x7f050015;
        public static final int common_google_play_services_update_button=0x7f050016;
        public static final int common_google_play_services_update_text=0x7f050017;
        public static final int common_google_play_services_update_title=0x7f050018;
        public static final int common_open_on_phone=0x7f050019;
        public static final int common_signin_button_text=0x7f05001a;
        public static final int common_signin_button_text_long=0x7f05001b;
        public static final int install_service_dialog_install_button=0x7f05001c;
        public static final int install_service_dialog_message=0x7f05001d;
        public static final int install_service_dialog_title=0x7f05001e;
        public static final int update_service_dialog_message=0x7f05001f;
        public static final int update_service_dialog_title=0x7f050020;
        public static final int update_service_dialog_update_button=0x7f050021;
    }
    public static final class styleable {
        /** Attributes that can be used with a LoadingImageView.

Includes the following attributes:

           <colgroup align="left" />
           <colgroup align="left" />

Attribute	Description

{@link #LoadingImageView_circleCrop com.o3dr.android.client.test:circleCrop}

{@link #LoadingImageView_imageAspectRatio com.o3dr.android.client.test:imageAspectRatio}

{@link #LoadingImageView_imageAspectRatioAdjust com.o3dr.android.client.test:imageAspectRatioAdjust}

           @see #LoadingImageView_circleCrop
           @see #LoadingImageView_imageAspectRatio
           @see #LoadingImageView_imageAspectRatioAdjust
         */
        public static final int[] LoadingImageView = {
            0x7f010000, 0x7f010001, 0x7f010002
        };
        /**

This symbol is the offset where the {@link com.o3dr.android.client.test.R.attr#circleCrop}
          attribute's value can be found in the {@link #LoadingImageView} array.

Must be a boolean value, either "true" or "false".

This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
          @attr name com.o3dr.android.client.test:circleCrop
        */
        public static final int LoadingImageView_circleCrop = 2;
        /**

This symbol is the offset where the {@link com.o3dr.android.client.test.R.attr#imageAspectRatio}
          attribute's value can be found in the {@link #LoadingImageView} array.

Must be a floating point value, such as "1.2".

This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
          @attr name com.o3dr.android.client.test:imageAspectRatio
        */
        public static final int LoadingImageView_imageAspectRatio = 1;
        /**

This symbol is the offset where the {@link com.o3dr.android.client.test.R.attr#imageAspectRatioAdjust}
          attribute's value can be found in the {@link #LoadingImageView} array.

Must be one of the following constant values.

<colgroup align="left" />
<colgroup align="left" />
<colgroup align="left" />

Constant	Value	Description

none	0

adjust_width	1

adjust_height	2

          @attr name com.o3dr.android.client.test:imageAspectRatioAdjust
        */
        public static final int LoadingImageView_imageAspectRatioAdjust = 0;
    };
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.springframework.cloud</groupId>
		<artifactId>spring-cloud-config</artifactId>
		<version>1.1.0.BUILD-SNAPSHOT</version>
		<relativePath>..</relativePath>
	</parent>
	<artifactId>spring-cloud-config-monitor</artifactId>
	<name>spring-cloud-config-monitor</name>
	<description>Spring Cloud Config Monitor</description>
	<properties>
		<main.basedir>${basedir}/../..</main.basedir>
	</properties>
	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.springframework.cloud</groupId>
				<artifactId>spring-cloud-bus-dependencies</artifactId>
				<version>${spring-cloud-bus.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>
	<dependencies>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-config-server</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-bus</artifactId>
		</dependency>
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<!-- Only needed at compile time -->
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>
</project>

redpajama_set_name: RedPajamaGithub


text:
#include "CDataTimer.hpp"

namespace NData {
	CDataTimer::CDataTimer(uint32_t samplingRate, NCommon::CMutex *pMutexTimer) :
		CAbstractTimer(samplingRate),
		mpMutexTimer(pMutexTimer)
		{

		// nothing todo
	}

	CDataTimer::~CDataTimer(void) {
		// nothing todo
	}

	void *CDataTimer::startThread(void *pThreadObject) {
		CDataTimer* thread = static_cast<CDataTimer*>(pThreadObject);

		thread->run();

		return 0;
	}

	void CDataTimer::start(void) {
		pthread_create(&mThreadID, NULL, &startThread, (void *)this);
	}

	void CDataTimer::run (void) {
		mThreadStateRun		= true;
		mThreadStateStop	= false;

		while (!mThreadStateStop) {
			nanosleep(&mTimer, NULL);

			mpMutexTimer->unlock();
		}

		exit();
	}
}


text:
QInnerFrame::QInnerFrame(QWidget *parent, Qt::AnchorPoint anchor, int autoCloseSpace)
    : QFrame(parent)
    , m_mainWindow(parent)
    , m_topWidget(nullptr)
    , m_anchor(anchor)
	, m_autoCloseSpace(autoCloseSpace)
    , m_toShowNormal(false)
    , m_valid(true)
{
    connect(&m_timer, &QTimer::timeout, this, [&]{
        if(!isMinimized())
            closeWhenMouseIsOut();
    });
    m_mainWindow->installEventFilter(this);

    // Since no background is set, borrow the setting of the top level Widget
    auto layout = new QBoxLayout(
                Qt::AnchorTop || Qt::AnchorBottom ? QBoxLayout::TopToBottom : QBoxLayout::LeftToRight,
                this);
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setSpacing(0);
    setLayout(layout);
    QPalette Pal(parent->topLevelWidget()->palette());
    qDebug() << Pal;
    Pal.setColor(QPalette::Base, Pal.color(QPalette::Window));
    setAutoFillBackground(true);
    setPalette(Pal);
}

bool QInnerFrame::eventFilter(QObject *watched, QEvent *event)
{
//    qDebug() << watched << event;
    if(m_mainWindow == dynamic_cast<QWidget*>(watched)) {
        switch(event->type()) {
        case QEvent::Resize:
            close();
            break;
        default:
            break;
        }
    }
    return false;
}

void QInnerFrame::showWithoutTitleBar()
{
    emit init();
    showNormal();

    QRect rectMain = mainGeometry();
    setMaximumHeight(size().height());
    switch(m_anchor) {
    case Qt::AnchorTop:
        setGeometry(QRect(rectMain.topLeft(),
                                   QSize(rectMain.width(), height())));
        break;
    case Qt::AnchorBottom:
        setGeometry(QRect(QPoint(rectMain.left(), rectMain.bottom()-height()+1),
                                   QSize(rectMain.width(), height())));
        break;
    case Qt::AnchorLeft:
        setGeometry(QRect(rectMain.topLeft(),
                                   QSize(width(), rectMain.height())));
        break;
    case Qt::AnchorRight:
        setGeometry(QRect(QPoint(rectMain.right()-width()+1, rectMain.top()),
                                   QSize(width(), rectMain.height())));
        break;
    default:
        break;
    }
    closeWhenMouseIsOut();
    if(isValid())
        m_timer.start(2000);
}

void QInnerFrame::closeAndShowNormal()
{
    m_toShowNormal = true;
    close();
}

void QInnerFrame::closeEvent(QCloseEvent *event)
{
    m_timer.stop();
    m_mainWindow->removeEventFilter(this);
    m_valid = false;
    emit deinit();

    if(m_toShowNormal) {
        emit toShowNormal();
    }
    QFrame::closeEvent(event);
    emit closed();
}

void QInnerFrame::closeWhenMouseIsOut()
{
    QPoint ptInMain = m_mainWindow->mapFromGlobal(cursor().pos());
    if(!mainGeometry().contains(ptInMain)) {
        close();
        return;
    }
    switch(m_anchor) {
    case Qt::AnchorTop:
        if(ptInMain.y() > height()+ m_autoCloseSpace) {
            close();
        }
        break;
    case Qt::AnchorBottom:
        if(ptInMain.y() < m_mainWindow->height()-height()- m_autoCloseSpace) {
            close();
        }
        break;
    case Qt::AnchorLeft:
        if(ptInMain.x() > width()+ m_autoCloseSpace) {
            close();
        }
        break;
    case Qt::AnchorRight:
        if(ptInMain.x() < m_mainWindow->width()-width()- m_autoCloseSpace) {
            close();
        }
        break;
    default:
        break;
    }
}

QRect QInnerFrame::mainGeometry()
{
    return QRect(QPoint(), m_mainWindow->size());
}


text:
package Google::Ads::AdWords::v201809::CustomerSyncService::CustomerSyncServiceInterfacePort;
use strict;
use warnings;
use Class::Std::Fast::Storable;
use Scalar::Util qw(blessed);
use base qw(SOAP::WSDL::Client::Base);

# only load if it hasn't been loaded before
require Google::Ads::AdWords::v201809::TypeMaps::CustomerSyncService
    if not Google::Ads::AdWords::v201809::TypeMaps::CustomerSyncService->can('get_class');

sub START {
    $_[0]->set_proxy('https://adwords.google.com/api/adwords/ch/v201809/CustomerSyncService') if not $_[2]->{proxy};
    $_[0]->set_class_resolver('Google::Ads::AdWords::v201809::TypeMaps::CustomerSyncService')
        if not $_[2]->{class_resolver};

    $_[0]->set_prefix($_[2]->{use_prefix}) if exists $_[2]->{use_prefix};
}

sub get {
    my ($self, $body, $header) = @_;
    die "get must be called as object method (\$self is <$self>)" if not blessed($self);
    return $self->SUPER::call({
        operation => 'get',
        soap_action => '',
        style => 'document',
        body => {

           'use'            => 'literal',
            namespace       => 'http://schemas.xmlsoap.org/wsdl/soap/',
            encodingStyle   => '',
            parts           =>  [qw( Google::Ads::AdWords::v201809::CustomerSyncService::get )],
        },
        header => {

           'use' => 'literal',
            namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
            encodingStyle => '',
            parts => [qw( Google::Ads::AdWords::v201809::CustomerSyncService::RequestHeader )],
        },
        headerfault => {

        }
    }, $body, $header);
}

1;

__END__

=pod

=head1 NAME

Google::Ads::AdWords::v201809::CustomerSyncService::CustomerSyncServiceInterfacePort - SOAP Interface for the CustomerSyncService Web Service

=head1 SYNOPSIS

 use Google::Ads::AdWords::v201809::CustomerSyncService::CustomerSyncServiceInterfacePort;
 my $interface = Google::Ads::AdWords::v201809::CustomerSyncService::CustomerSyncServiceInterfacePort->new();

 my $response;
 $response = $interface->get();

=head1 DESCRIPTION

SOAP Interface for the CustomerSyncService web service
located at https://adwords.google.com/api/adwords/ch/v201809/CustomerSyncService.

=head1 SERVICE CustomerSyncService

=head2 Port CustomerSyncServiceInterfacePort

=head1 METHODS

=head2 General methods

=head3 new

Constructor.

All arguments are forwarded to L<SOAP::WSDL::Client|SOAP::WSDL::Client>.

=head2 SOAP Service methods

Method synopsis is displayed with hash refs as parameters.

The commented class names in the method's parameters denote that objects
of the corresponding class can be passed instead of the marked hash ref.

You may pass any combination of objects, hash and list refs to these
methods, as long as you meet the structure.

List items (i.e. multiple occurences) are not displayed in the synopsis.
You may generally pass a list ref of hash refs (or objects) instead of a hash
ref - this may result in invalid XML if used improperly, though. Note that
SOAP::WSDL always expects list references at maximum depth position.

XML attributes are not displayed in this synopsis and cannot be set using
hash refs. See the respective class' documentation for additional information.

=head3 get

Returns information about changed entities inside a customer's account. @param selector Specifies the filter for selecting changehistory events for a customer. @return A Customer->Campaign->AdGroup hierarchy containing information about the objects changed at each level. All Campaigns that are requested in the selector will be returned, regardless of whether or not they have changed, but unchanged AdGroups will be ignored.

Returns a L<Google::Ads::AdWords::v201809::CustomerSyncService::getResponse|Google::Ads::AdWords::v201809::CustomerSyncService::getResponse> object.

 $response = $interface->get( {
    selector =>  $a_reference_to, # see Google::Ads::AdWords::v201809::CustomerSyncSelector
  },,
 );

=head1 AUTHOR

Generated by SOAP::WSDL on Thu Sep 20 11:05:35 2018

=cut


text:
package play.learn.java.design.specification;

public enum Color {

	DARK("dark"), LIGHT("light"), GREEN("green"), RED("red");

	private String title;

	Color(String title) {
		this.title = title;
	}

	@Override
	public String toString() {
		return title;
	}

}


text:
```dart
import 'package:keyclic_sdk_api/api.dart';
```

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**href** | **String** | The URI of the plans associated to the given feedback. | [optional] [default to null]
**iriTemplate** | [**FeedbackLinksPlansIriTemplate**](FeedbackLinksPlansIriTemplate.md) |  | [optional] [default to null]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


text:
package fr.inra.maiage.bibliome.alvisir.core.query;

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

/**
 * Boolean conjunction query node where all operands are term queries on the same field.
 * @author rbossy
 *
 */
public class AlvisIRTermListQueryNode implements AlvisIRQueryNode {
	private final AlvisIRAndQueryNode.Operator operator;
	private final String field;
	private final List<String> texts = new ArrayList<String>();

	/**
	 * Creates a phrase query node with the specified field and slop.
	 * @param field field name
	 * @param slop phrase slop.
	 */
	public AlvisIRTermListQueryNode(AlvisIRAndQueryNode.Operator operator, String field) {
		super();
		this.operator = operator;
		this.field = field;
	}

	public AlvisIRAndQueryNode.Operator getOperator() {
		return operator;
	}

	/**
	 * Returns the field name.
	 * @return
	 */
	public String getField() {
		return field;
	}

	/**
	 * Returns the texts of terms in the phrase.
	 * @return
	 */
	public List<String> getTexts() {
		return Collections.unmodifiableList(texts);
	}

	/**
	 * Appends a term text to this phrase query node.
	 * @param text
	 */
	public void addText(String text) {
		texts.add(text);
	}

	public AlvisIRAndQueryNode toAndQueryNode() {
		AlvisIRAndQueryNode result = new AlvisIRAndQueryNode();
		for (String t : texts) {
			result.addClause(operator, new AlvisIRTermQueryNode(field, t));
		}
		return result;
	}

	@Override
	public <R,P,X extends Exception> R accept(AlvisIRQueryNodeVisitor<R,P,X> visitor, P param) throws X {
		return visitor.visit(this, param);
	}
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Docums Mycol. 19(no. 74): 61 (1988)

#### Original name
Clitocybe inornata subsp. occidentalis H.E. Bigelow

### Remarks
null


text:
import React from 'react';
import { connect } from 'react-redux';
import { Modal, ButtonGroup, Button, FormGroup } from 'react-bootstrap';
import TextInput from './generic/TextInput';
import { makeApiPost } from './../scripts/api'
import { updateToDo } from './../redux/reducers/board.reducer';
class ToDoCreationModal extends React.Component {
  constructor(props) {
    super(props);

    this.state = {
      toDoTitle: '',
      toDoText: '',
    }

    this.submitToDo = this.submitToDo.bind(this);
    this.handleToDoTextInput = this.handleToDoTextInput.bind(this);
    this.handleToDoTitleInput = this.handleToDoTitleInput.bind(this);
  }

  componentWillUpdate(nextProps, nextState) {
    // Reset text when modal closes
    if(nextProps.open === false) {
      if (nextState.toDoText !== '') this.setState({toDoText: ''});
      if (nextState.toDoTitle !== '') this.setState({toDoTitle: ''});
    }
  }

  handleToDoTextInput(e) { this.setState({toDoText: e.target.value}); }
  handleToDoTitleInput(e) { this.setState({toDoTitle: e.target.value}); }

  submitToDo() {
    let url = 'makeToDo/';
    url = `${url}?board=${this.props.boardName}`;
    url = `${url}&title=${this.state.toDoTitle}`;
    url = `${url}&text=${this.state.toDoText}`;
    makeApiPost(url)({
      success: (res) => {
        // Check if the response came back valid
        if (res.status === 201) {
          res.json().then((toDo) => {
            this.props.dispatch(updateToDo(toDo));
          }).catch(console.error);
        }
      },
      failure: console.error,
    });
    this.props.closeModal();
  }

  render() {
    return (
      <Modal show={this.props.open}>
        <Modal.Header>
          <Modal.Title>Add To Do</Modal.Title>
        </Modal.Header>
        <Modal.Body className='text-center'>
          <FormGroup>
            <TextInput
              title='Title'
              placeholder='Type The Title Here'
              value={this.state.toDoTitle}
              updateValue={this.handleToDoTitleInput}
            />
            <br/>
            <TextInput
              title='Task'
              placeholder='Type The Task Here'
              value={this.state.toDoText}
              updateValue={this.handleToDoTextInput}
            />
          </FormGroup>
        </Modal.Body>
        <Modal.Footer>
          <ButtonGroup>
            <Button bsStyle='success' onClick={this.submitToDo}>Update</Button>
            <Button bsStyle='danger' onClick={this.props.closeModal}>Cancel</Button>
          </ButtonGroup>
        </Modal.Footer>
      </Modal>
    )
  }
}

export default connect()(ToDoCreationModal);


text:
package org.kuali.kra.krms;

/**
 *
 * This interface is for the bo class of the rulecontext class has.
 * for example : Protocol, developmentproposal
 */
public interface KcKrmsContextBo {
    /**
     *
     * This method to get the RuleContext, which is this bo's document class, of this bo class.
     * @return
     */
    KrmsRulesContext getKrmsRulesContext();
}


text:
package arg

import (
	"os"
	"strings"
	"testing"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
)

func parse(cmdline string, dest interface{}) error {
	p, err := NewParser(dest)
	if err != nil {
		return err
	}
	return p.Parse(strings.Split(cmdline, " "))
}

func TestStringSingle(t *testing.T) {
	var args struct {
		Foo string
	}
	err := parse("--foo bar", &args)
	require.NoError(t, err)
	assert.Equal(t, "bar", args.Foo)
}

func TestMixed(t *testing.T) {
	var args struct {
		Foo  string `arg:"-f"`
		Bar  int
		Baz  uint `arg:"positional"`
		Ham  bool
		Spam float32
	}
	args.Bar = 3
	err := parse("123 -spam=1.2 -ham -f xyz", &args)
	require.NoError(t, err)
	assert.Equal(t, "xyz", args.Foo)
	assert.Equal(t, 3, args.Bar)
	assert.Equal(t, uint(123), args.Baz)
	assert.Equal(t, true, args.Ham)
	assert.EqualValues(t, 1.2, args.Spam)
}

func TestRequired(t *testing.T) {
	var args struct {
		Foo string `arg:"required"`
	}
	err := parse("", &args)
	require.Error(t, err, "--foo is required")
}

func TestShortFlag(t *testing.T) {
	var args struct {
		Foo string `arg:"-f"`
	}

	err := parse("-f xyz", &args)
	require.NoError(t, err)
	assert.Equal(t, "xyz", args.Foo)

	err = parse("-foo xyz", &args)
	require.NoError(t, err)
	assert.Equal(t, "xyz", args.Foo)

	err = parse("--foo xyz", &args)
	require.NoError(t, err)
	assert.Equal(t, "xyz", args.Foo)
}

func TestInvalidShortFlag(t *testing.T) {
	var args struct {
		Foo string `arg:"-foo"`
	}
	err := parse("", &args)
	assert.Error(t, err)
}

func TestLongFlag(t *testing.T) {
	var args struct {
		Foo string `arg:"--abc"`
	}

	err := parse("-abc xyz", &args)
	require.NoError(t, err)
	assert.Equal(t, "xyz", args.Foo)

	err = parse("--abc xyz", &args)
	require.NoError(t, err)
	assert.Equal(t, "xyz", args.Foo)
}

func TestCaseSensitive(t *testing.T) {
	var args struct {
		Lower bool `arg:"-v"`
		Upper bool `arg:"-V"`
	}

	err := parse("-v", &args)
	require.NoError(t, err)
	assert.True(t, args.Lower)
	assert.False(t, args.Upper)
}

func TestCaseSensitive2(t *testing.T) {
	var args struct {
		Lower bool `arg:"-v"`
		Upper bool `arg:"-V"`
	}

	err := parse("-V", &args)
	require.NoError(t, err)
	assert.False(t, args.Lower)
	assert.True(t, args.Upper)
}

func TestPositional(t *testing.T) {
	var args struct {
		Input  string `arg:"positional"`
		Output string `arg:"positional"`
	}
	err := parse("foo", &args)
	require.NoError(t, err)
	assert.Equal(t, "foo", args.Input)
	assert.Equal(t, "", args.Output)
}

func TestPositionalPointer(t *testing.T) {
	var args struct {
		Input  string    `arg:"positional"`
		Output []*string `arg:"positional"`
	}
	err := parse("foo bar baz", &args)
	require.NoError(t, err)
	assert.Equal(t, "foo", args.Input)
	bar := "bar"
	baz := "baz"
	assert.Equal(t, []*string{&bar, &baz}, args.Output)
}

func TestRequiredPositional(t *testing.T) {
	var args struct {
		Input  string `arg:"positional"`
		Output string `arg:"positional,required"`
	}
	err := parse("foo", &args)
	assert.Error(t, err)
}

func TestTooManyPositional(t *testing.T) {
	var args struct {
		Input  string `arg:"positional"`
		Output string `arg:"positional"`
	}
	err := parse("foo bar baz", &args)
	assert.Error(t, err)
}

func TestMultiple(t *testing.T) {
	var args struct {
		Foo []int
		Bar []string
	}
	err := parse("--foo 1 2 3 --bar x y z", &args)
	require.NoError(t, err)
	assert.Equal(t, []int{1, 2, 3}, args.Foo)
	assert.Equal(t, []string{"x", "y", "z"}, args.Bar)
}

func TestMultipleWithEq(t *testing.T) {
	var args struct {
		Foo []int
		Bar []string
	}
	err := parse("--foo 1 2 3 --bar=x", &args)
	require.NoError(t, err)
	assert.Equal(t, []int{1, 2, 3}, args.Foo)
	assert.Equal(t, []string{"x"}, args.Bar)
}

func TestExemptField(t *testing.T) {
	var args struct {
		Foo string
		Bar interface{} `arg:"-"`
	}
	err := parse("--foo xyz", &args)
	require.NoError(t, err)
	assert.Equal(t, "xyz", args.Foo)
}

func TestUnknownField(t *testing.T) {
	var args struct {
		Foo string
	}
	err := parse("--bar xyz", &args)
	assert.Error(t, err)
}

func TestMissingRequired(t *testing.T) {
	var args struct {
		Foo string   `arg:"required"`
		X   []string `arg:"positional"`
	}
	err := parse("x", &args)
	assert.Error(t, err)
}

func TestMissingValue(t *testing.T) {
	var args struct {
		Foo string
	}
	err := parse("--foo", &args)
	assert.Error(t, err)
}

func TestInvalidInt(t *testing.T) {
	var args struct {
		Foo int
	}
	err := parse("--foo=xyz", &args)
	assert.Error(t, err)
}

func TestInvalidUint(t *testing.T) {
	var args struct {
		Foo uint
	}
	err := parse("--foo=xyz", &args)
	assert.Error(t, err)
}

func TestInvalidFloat(t *testing.T) {
	var args struct {
		Foo float64
	}
	err := parse("--foo xyz", &args)
	require.Error(t, err)
}

func TestInvalidBool(t *testing.T) {
	var args struct {
		Foo bool
	}
	err := parse("--foo=xyz", &args)
	require.Error(t, err)
}

func TestInvalidIntSlice(t *testing.T) {
	var args struct {
		Foo []int
	}
	err := parse("--foo 1 2 xyz", &args)
	require.Error(t, err)
}

func TestInvalidPositional(t *testing.T) {
	var args struct {
		Foo int `arg:"positional"`
	}
	err := parse("xyz", &args)
	require.Error(t, err)
}

func TestInvalidPositionalSlice(t *testing.T) {
	var args struct {
		Foo []int `arg:"positional"`
	}
	err := parse("1 2 xyz", &args)
	require.Error(t, err)
}

func TestNoMoreOptions(t *testing.T) {
	var args struct {
		Foo string
		Bar []string `arg:"positional"`
	}
	err := parse("abc -- --foo xyz", &args)
	require.NoError(t, err)
	assert.Equal(t, "", args.Foo)
	assert.Equal(t, []string{"abc", "--foo", "xyz"}, args.Bar)
}

func TestHelpFlag(t *testing.T) {
	var args struct {
		Foo string
		Bar interface{} `arg:"-"`
	}
	err := parse("--help", &args)
	assert.Equal(t, ErrHelp, err)
}

func TestPanicOnNonPointer(t *testing.T) {
	var args struct{}
	assert.Panics(t, func() {
		parse("", args)
	})
}

func TestPanicOnNonStruct(t *testing.T) {
	var args string
	assert.Panics(t, func() {
		parse("", &args)
	})
}

func TestUnsupportedType(t *testing.T) {
	var args struct {
		Foo interface{}
	}
	err := parse("--foo", &args)
	assert.Error(t, err)
}

func TestUnsupportedSliceElement(t *testing.T) {
	var args struct {
		Foo []interface{}
	}
	err := parse("--foo", &args)
	assert.Error(t, err)
}

func TestUnknownTag(t *testing.T) {
	var args struct {
		Foo string `arg:"this_is_not_valid"`
	}
	err := parse("--foo xyz", &args)
	assert.Error(t, err)
}

func TestParse(t *testing.T) {
	var args struct {
		Foo string
	}
	os.Args = []string{"example", "--foo", "bar"}
	err := Parse(&args)
	require.NoError(t, err)
	assert.Equal(t, "bar", args.Foo)
}

func TestParseError(t *testing.T) {
	var args struct {
		Foo string `arg:"this_is_not_valid"`
	}
	os.Args = []string{"example", "--bar"}
	err := Parse(&args)
	assert.Error(t, err)
}

func TestMustParse(t *testing.T) {
	var args struct {
		Foo string
	}
	os.Args = []string{"example", "--foo", "bar"}
	MustParse(&args)
	assert.Equal(t, "bar", args.Foo)
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/atom10full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" xml:lang="en-US">
  <title>TrotterCashion - Home</title>
  <id>tag:trottercashion.com,2008:mephisto/</id>
  <generator uri="http://mephistoblog.com" version="0.8.0">Mephisto Drax</generator>

  <link href="http://trottercashion.com/" rel="alternate" type="text/html" />
  <updated>2008-12-13T17:48:58Z</updated>
  <link rel="self" href="http://feeds.feedburner.com/trottercashion" type="application/atom+xml" /><entry xml:base="http://trottercashion.com/">
    <author>
      <name>trotter</name>
    </author>
    <id>tag:trottercashion.com,2008-12-13:53</id>
    <published>2008-12-13T17:43:00Z</published>
    <updated>2008-12-13T17:48:58Z</updated>
    <category term="dataurls" />
    <category term="javascript" />
    <link href="http://feeds.feedburner.com/~r/trottercashion/~3/483840026/data-urls-and-document-domain" rel="alternate" type="text/html" />
    <title>Data Urls and document.domain</title>
<content type="html">

Well this is a bummer. It turns out that all data urls share a common domain of "". This is a problem in HTML5, because access to sqlite databases is based on the document.domain (This is true in safari at least). Therefore, all data urls will share a common sqlite db environment, meaning that a data url from Google,could look in the database created by a Yahoo data url, given that they were able to guess the name of the database. Since I see data urls as a better way to do offline web apps than google gears, this is a problem that pains me. Does anyone know if there is a solution?

My main thought on how to fix this would be to require the domain for any data url that is a target of an link be set to the domain of the linker. The same would go for any data url that is loaded via a src="", but this shouldn't matter as all scripts use the document domain and not their own domain for security purposes. In cases where this is no linker, data urls get their domain set to an md5 hash of their data. Anyone see any problems with this solution?

If you don't know what data urls are, check out my previous post.

          </content>  <feedburner:origLink>http://trottercashion.com/2008/12/13/data-urls-and-document-domain</feedburner:origLink></entry>
  <entry xml:base="http://trottercashion.com/">
    <author>
      <name>trotter</name>
    </author>
    <id>tag:trottercashion.com,2008-12-12:48</id>
    <published>2008-12-12T13:03:00Z</published>
    <updated>2008-12-12T13:04:13Z</updated>
    <category term="dataurls" />
    <category term="iphone" />
    <link href="http://feeds.feedburner.com/~r/trottercashion/~3/482664882/data-urls-are-fun" rel="alternate" type="text/html" />
    <title>Data Urls Are Fun!</title>
<content type="html">

Lately I've been playing with data urls in an effort to use them as an alternative way to build iPhone apps. W. Clawpaws wrote an interesting post on this a year ago, but it seems that not much has been done since. If it's possible, I plan to have a simple library built by end of year that will allow you to write data url apps that connect to a central server when available. Basically, it'll make the persistence and speed arguments for writing native apps null and void.

Anyway, enough of what I plan to do and more about actual data urls. "Data urls"http://en.wikipedia.org/wiki/Data_URI_scheme allow you to store a single image, some javascript, or even an entire web page in a url. The browser will then render that information as if it were pulling it from a normal http:// url. So they will increase the initial payload of your web page, but result in faster interactions once the page is loaded.

Data urls have a format of

data:[&lt;MIME-type&gt;][;charset="&lt;encoding&gt;"][;base64],&lt;data&gt;

So if you see something like data:text/html;base64,PGh0bWw+, you're looking at a data url. To see one in action, click the link below and have a look at the url in your navigation bar.

Data url in action!

Check back in the near future for progress on the iPhone idea. In the meantime, enjoy playing with data urls.

          </content>  <feedburner:origLink>http://trottercashion.com/2008/12/12/data-urls-are-fun</feedburner:origLink></entry>
  <entry xml:base="http://trottercashion.com/">
    <author>
      <name>trotter</name>
    </author>
    <id>tag:trottercashion.com,2008-12-11:44</id>
    <published>2008-12-11T14:48:00Z</published>
    <updated>2008-12-11T14:49:22Z</updated>
    <category term="iphone" />
    <category term="rails" />
    <category term="speaking" />
    <link href="http://feeds.feedburner.com/~r/trottercashion/~3/481739351/iphone-on-rails-the-presentation" rel="alternate" type="text/html" />
    <title>iPhone on Rails: The Presentation</title>
<content type="html">

Last night's presentation went pretty well. I gave a fairly high level (except for the XCode part) overview of developing web and native apps for the iPhone. I hope to spruce this one up based on the questions asked during the talk last night and give it again some place else. Anyway, slides are below.

iPhone on Rails&lt;object height="355" width="425">&lt;param />&lt;param />&lt;param />&lt;embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=iphonerails-1229006573528763-1&amp;#38;stripped_title=iphonerails-presentation" height="355" width="425">&lt;/embed>&lt;/object>
View SlideShare presentation or Upload your own. (tags: rails iphone)

          </content>  <feedburner:origLink>http://trottercashion.com/2008/12/11/iphone-on-rails-the-presentation</feedburner:origLink></entry>
  <entry xml:base="http://trottercashion.com/">
    <author>
      <name>trotter</name>
    </author>
    <id>tag:trottercashion.com,2008-12-10:43</id>
    <published>2008-12-10T16:17:00Z</published>
    <updated>2008-12-10T16:17:37Z</updated>
    <category term="iphone" />
    <category term="speaking" />
    <link href="http://feeds.feedburner.com/~r/trottercashion/~3/480717107/iphone-on-rails" rel="alternate" type="text/html" />
    <title>iPhone on Rails</title>
<content type="html">

I'm a little late to this party, but I'm speaking at philly.rb tonight. The talk is about making rails backed iPhone apps, both web and native. It should be a raucous good time, so come on over if you're near Philly.

As an aside, there's a chance that this will be taped or that I'll actually upload my slides for once. That said, if you miss the talk, you're probably shit out of luck for my valuable knowledge.

          </content>  <feedburner:origLink>http://trottercashion.com/2008/12/10/iphone-on-rails</feedburner:origLink></entry>
  <entry xml:base="http://trottercashion.com/">
    <author>
      <name>trotter</name>
    </author>
    <id>tag:trottercashion.com,2008-10-01:39</id>
    <published>2008-10-01T23:17:00Z</published>
    <updated>2008-10-01T23:39:57Z</updated>
    <link href="http://feeds.feedburner.com/~r/trottercashion/~3/408719167/iphone-resources" rel="alternate" type="text/html" />
    <title>iPhone Resources</title>
<content type="html">

I'm sure you've heard by now that the iPhone NDA has been lifted. This is great news for those of us that pretend to be iPhone developers, because we're going to start seeing a lot more resources at our fingertips.

I'm going to start keeping a moderated page of iPhone development resources including links to blog posts, books, and maybe even podcasts. If you see any blog posts (I'm sure there'll be tons in the next few days). Let me know and I'll add them to the list.

          </content>  <feedburner:origLink>http://trottercashion.com/2008/10/1/iphone-resources</feedburner:origLink></entry>
  <entry xml:base="http://trottercashion.com/">
    <author>
      <name>trotter</name>
    </author>
    <id>tag:trottercashion.com,2008-10-01:38</id>
    <published>2008-10-01T23:10:00Z</published>
    <updated>2008-10-01T23:11:49Z</updated>
    <category term="javascript" />
    <category term="rspec" />
    <category term="screw-unit" />
    <category term="testing" />
    <link href="http://feeds.feedburner.com/~r/trottercashion/~3/408699804/mocking-screw-unit-part-deux" rel="alternate" type="text/html" />
    <title>Mocking Screw-Unit Part Deux</title>
<content type="html">

I wrote earlier about how Topper mocked out the dom for screw-unit testing. Taking his lead, I started playing with screw-unit and adding some mocking and stubbing in the rspec way. It's not quite release worthy, but it's on github now and I think it's nearly usable. Basically, it lets you do things like this:

user = {login: 'bob'};
Screw.Stub.stub(user, 'login').andReturn('nancy');
user.login; // =&gt; 'nancy'
Screw.Stub.reset(); // Called automatically after each spec
user.login; // =&gt; 'bob'

// Will throw a spec failure if user.email() is never called.
Screw.stub.shouldReceive(user, 'email');

Obviously shouldReceive is not quite complete. It's missing with(), numberOfTimes(), and other things. Still, it's good enough that others can start iterating on the model I've laid down. As I said earlier, my fork of screw-unit is available on github now, so have a look and feel free to leave questions in the comments.

          </content>  <feedburner:origLink>http://trottercashion.com/2008/10/1/mocking-screw-unit-part-deux</feedburner:origLink></entry>
  <entry xml:base="http://trottercashion.com/">
    <author>
      <name>trotter</name>
    </author>
    <id>tag:trottercashion.com,2008-09-27:33</id>
    <published>2008-09-27T23:33:00Z</published>
    <updated>2008-10-14T14:10:17Z</updated>
    <category term="bugs" />
    <category term="git" />
    <category term="git-bisect" />
    <link href="http://feeds.feedburner.com/~r/trottercashion/~3/405022957/git-bisect-is-your-new-best-friend" rel="alternate" type="text/html" />
    <title>git-bisect Is Your New Best Friend</title>
<content type="html">

To anyone not using git, jump to the bottom of the post then come back up.

Update: I've got an even faster method at the bottom now. Skip down there if you already know the basics of git-bisect.

Ok, now let's move on to the cool shit, git-bisect. Git-bisect helps you figure out exactly what code change broke a feature in your app, even when that code change was made months ago. It works by assisting you in a binary tree search through your commits, pausing at each one so that you can run a test and mark that commit as good or bad. This can remarkably decrease the amount of time you spend trying to figure out what is causing a new bug, because you quickly can find the exact code change that introduced it.

To use git-bisect, you first need a good test to run. Though you could do a manual test like loading a page in your browser and verifying that things look correct, you will be much happier if you write an automated test that you can run for each commit. Since I usually live in Ruby land, I'm fairly partial to TestUnit and rSpec for my automated tests. If you're in iPhone land, I strongly recommend using google-toolbox-for-mac.

With automated test in hand, you can kick off git-bisect with git bisect start. You then mark your current commit as bad using git bisect bad. You then checkout a known good commit using git checkout commit_hash. Run your test and mark it as good when it passes using git bisect good. At this point, git-bisect takes over and starts moving you through commit after commit. At each stop, you run your test and then mark the commit using either git bisect bad or git bisect good. At the end, git-bisect will tell you which commit first caused your error. You can then use git diff commit_hash to see what was changed in that commit. When you're done, you run git bisect reset to set everything back to normal.

A typical git-bisect session looks somewhat like this:

(master) $ git bisect start

(master|BISECTING) $ git bisect bad

(master|BISECTING) $ git checkout eb5eecbb8fc4e2a964e8d2043d8b95f4eb7b563a
HEAD is now at eb5eecb... Add MainViewController

... run test which passes ...

(eb5eecb...|BISECTING) $ git bisect good
Bisecting: 3 revisions left to test after this
[d82c1595b6363484fe0d7f60f9ffa096d777bf17] First CompsView test

... run test which fails ...

(d82c159...|BISECTING) $ git bisect bad
Bisecting: 1 revisions left to test after this
[93af33167019fa039f5372dff602a76cbcbc99bb] Add first integration test

... run test which passes ...

(93af331...|BISECTING) $ git bisect good
Bisecting: 0 revisions left to test after this
[4f12091a287c363737ceb650df46196e5008d3f2] Add Comps target

... run test which fails ...

(4f12091...|BISECTING) $ git bisect bad
4f12091a287c363737ceb650df46196e5008d3f2 is first bad commit
commit 4f12091a287c363737ceb650df46196e5008d3f2
Author: Trotter Cashion &lt;cashion@example.com&gt;
Date:   Tue Sep 23 20:18:09 2008 -0400

    Add Comps target

:000000 100644 0000000000000000000000000000000000000000 789bf7877c6059a7f3ac8cb2b53fdb2c903e58ff A    Comps-Info.plist
:040000 040000 d260571a48328d4a575a7395cd6ece3d651a93ac a622a23fdb80c915eaba49d1d53f7bf0dbf44a70 M    ShootAndSpeak.xcodeproj

... Figure out what's wrong ...

(4f12091...|BISECTING) $ git bisect reset
Switched to branch "master"

I hope you learn to use and love git-bisect. It's really helped me when trying to find the cause of nasty bugs that seemingly came out of nowhere.

Update

The above is too much work. While searching the net, I found something even easier and faster. You can start git-bisect with the commit hashes like so git bisect start bad_commit good_commit. Even better, you can then tell git-bisect to run the tests itself… this is where things get awesome: git bisect run some_test. It'll iterate through your commits until it finds the bad one. Checkout the sample session below.

/tmp/fake(master) $ git bisect start 68d5ab7a61a871fd097d8820e248cfd168395e4e 20cbc038973d6c78805bc8bfc3d187c2b537f183
Bisecting: 1 revisions left to test after this
[3da37ed0ee87c9129a61142ecefef17ab0de7f0f] Test works

/tmp/fake(3da37ed...|BISECTING) $ git bisect run testrb test/unit/some_test.rb -n test_truth
running testrb test/unit/some_test.rb -n test_truth
Loaded suite some_test.rb
Started
.
Finished in 0.000338 seconds.

1 tests, 1 assertions, 0 failures, 0 errors
Bisecting: 0 revisions left to test after this
[765d7e5c4eba730078907fc00121b8b35ada64b0] Test fails
running testrb test/unit/some_test.rb -n test_truth
Loaded suite some_test.rb
Started
F
Finished in 0.009607 seconds.

  1) Failure:
test_truth(ThisTest) [./test/unit/some_test.rb:5]:
&lt;false&gt; is not true.

1 tests, 1 assertions, 1 failures, 0 errors
765d7e5c4eba730078907fc00121b8b35ada64b0 is first bad commit
commit 765d7e5c4eba730078907fc00121b8b35ada64b0
Author: Trotter Cashion &lt;cashion@example.com&gt;
Date:   Sun Sep 28 13:13:09 2008 -0400

    Test fails

:040000 040000 167dd04f2b4101ea256a7a6525859bc03e5433d3 0b062d4b5b03e7ac51ac4050fc7397c8983a2f13 M    test
bisect run success

/tmp/fake(765d7e5...|BISECTING) $

As you can see above, I'm using ruby for this set of tests. My preferred method is to have git-bisect run testrb (or spec) and specify a single test for it to execute. This ensures that everything runs quite quickly.

Land Here!

If you jumped here from the top, I regret to inform you that this post will make you very sad. Turn back now before you're stuck improving your life by installing git. Once you've installed git, go check out Peepcode. They've got a really good screencast and pdf that explain git excellently.

          </content>  <feedburner:origLink>http://trottercashion.com/2008/9/27/git-bisect-is-your-new-best-friend</feedburner:origLink></entry>
  <entry xml:base="http://trottercashion.com/">
    <author>
      <name>trotter</name>
    </author>
    <id>tag:trottercashion.com,2008-08-08:31</id>
    <published>2008-08-08T11:35:00Z</published>
    <updated>2008-08-08T11:36:11Z</updated>
    <category term="javascript" />
    <category term="mocks" />
    <category term="screw-unit" />
    <link href="http://feeds.feedburner.com/~r/trottercashion/~3/359351596/mocking-screw-unit" rel="alternate" type="text/html" />
    <title>Mocking Screw-Unit</title>
<content type="html">

I'm big on tests. Unit testing helps me clarify my thinking on problems and ensure that my code works well. When writing tests, it's essential to have a good mocking framework to separate the things you are testing from the things you are not. In Ruby, I like using flexmock for Test::Unit and rSpec's built in mocking framework when using it. In Javascript though, screw-unit doesn't really come with a way to mock by default. (As an aside, screw-unit totally rocks for testing js.)

Thankfully, my coworker Topper (who's a kickass dev, btw), has been playing around with adding mocking to screw-unit. He's got a fork on github, docs at the previous link, and a quick example blog post. Click through and check this shit out, cause it's hot.

          </content>  <feedburner:origLink>http://trottercashion.com/2008/8/8/mocking-screw-unit</feedburner:origLink></entry>
  <entry xml:base="http://trottercashion.com/">
    <author>
      <name>trotter</name>
    </author>
    <id>tag:trottercashion.com,2008-07-07:27</id>
    <published>2008-07-07T17:19:00Z</published>
    <updated>2008-07-07T17:21:30Z</updated>
    <category term="floats" />
    <category term="ruby" />
    <link href="http://feeds.feedburner.com/~r/trottercashion/~3/329041849/floating-pain" rel="alternate" type="text/html" />
    <title>Floating Pain</title>
<content type="html">

Topper mentioned a tweet he saw to me in which someone asked why (4.6 * 100).to_i #=&gt; 459. Though this seems like a ruby bug, it's really just one of the annoying things you hit with rounding errors and floats. At issue is that #to_i floors the float, instead of rounding it. Since the value may be approximated at 459.999999, the #to_i floors it to 459. To have things work like you'd expect, use #round when converting Float to Fixnum. See below for some code examples:

  4.6.to_i           # =&gt; 4
  4.6.round          # =&gt; 5
  (4.6 * 100).to_i   # =&gt; 459
  (4.6 * 100).round  # =&gt; 460

          </content>  <feedburner:origLink>http://trottercashion.com/2008/7/7/floating-pain</feedburner:origLink></entry>
  <entry xml:base="http://trottercashion.com/">
    <author>
      <name>trotter</name>
    </author>
    <id>tag:trottercashion.com,2008-06-27:26</id>
    <published>2008-06-27T03:06:00Z</published>
    <updated>2008-06-27T03:07:05Z</updated>
    <category term="programming" />
    <category term="trotter cashion" />
    <link href="http://feeds.feedburner.com/~r/trottercashion/~3/321023468/how-i-got-started-programming" rel="alternate" type="text/html" />
    <title>How I Got Started Programming</title>
<content type="html">

Paul says I've got to do this, and I don't want to let him
down. Giles tagged him first, so you should probably read his too.

How old were you when you started programming?

In third grade (when I was 8) I started started taking super nerd math classes
with other super nerds. As part of those classes, they had us programming a
turtle to draw things on the screen. Logo) was totally awesome and had me hooked
on the magic of programming.

How did you get started programming?

After Logo, my dad (he was a CTO at the time) bought me Visual Studio and a few
books on Visual Basic. It was lots of "Teach Yourself X in X days", and I ran
through VB, C++, and a little Delphi. Naturally, those books didn't teach me to
actually be good, though I did figure out how to make a few small games that I
could play.

My dad was a CTO at an investment bank, which is the kind of place that treats a
CTO like crap. I didn't want to be the guy that got shat on, so in high school I
dropped programming and started learning businessy things. I even picked my
college based on the strength of its business school. Once I showed up, I
realized that I didn't like anyone at the business school, that philosophy was
fun, and that math/econ could make me money. I promptly switched my major.

After college, I went to work at a job that I ended up hating, quit it, took a
few months to figure out my life, and realized that I really loved programming.
Thankfully I got lucky and read a blog post that tipped me to
the beta book of AWDWR, which taught me a lot about real programming. I
consider that the start of me becomming a real programmer, and not just some kid
that can code.

What was your first language?

Logo! Drawing with turtles rocks so hard. After that it was VB, which let me
push Windows around and made me a little cash.

What was the first real program you wrote?

I wrote my first useful program while working as an intern at a financial
services firm. The company was using Axys (really bad website alert!) for portfolio analysis and had a
tedious process for reconciling their branches with the back office. I wrote a
VB program that helped them to perform these reconciliations more quickly, which
I hear they still use.

What languages have you used since you started programming?

Logo, VB, C, C++, Delphi, Ruby, Objective-C, Erlang, Scheme, Javascript, Java, and maybe something else. Of those, I'd feel comfortable working on a project using Ruby, Javascript, Objective-C, or Erlang. I'm skilled enough in some of the others, but have vowed to never use them again. I'll let you guess which.

What was your first professional programming gig?

2005 at the Nathan Kline Institute for Mental Health. There was a PhD there who
needed ImageJ to talk to his microscope over a serial port and to have a
lot of old scripts from ObjectImage translated into ImageJ. It was a fun job
that let me work at my own pace and play a lot with the art of programming.

If there is one thing you learned along the way that you would tell new
developers, what would it be?

Surround yourself with great people, and never be the smartest guy in the room. If you're lucky enough to work at a
company with some great programmers, you'll learn a whole lot that way. If
your company is full of 9-5 coders, join a local developer group or start your
own. Nyc.rb and Philly On Rails totally rock, so you could always move to New York or Philly and learn from some of the best.

What's the most fun you've ever had programming?

Logo. I used to love making that little turtle draw all sorts of fun things on
the screen. There was no real need to make the turtle do things, I was doing it
just for the joy of it. I managed to recreate some of that feeling when working
on spec-unit, which is really my only useful open source contribution to
date. Unfortunately, it only has one release ever, and I haven't messed with it in two years.

          </content>  <feedburner:origLink>http://trottercashion.com/2008/6/27/how-i-got-started-programming</feedburner:origLink></entry>
  <entry xml:base="http://trottercashion.com/">
    <author>
      <name>trotter</name>
    </author>
    <id>tag:trottercashion.com,2008-06-22:5</id>
    <published>2008-06-22T22:23:00Z</published>
    <updated>2008-06-22T22:44:05Z</updated>
    <category term="business" />
    <category term="working remotely" />
    <link href="http://feeds.feedburner.com/~r/trottercashion/~3/317690654/on-working-remotely" rel="alternate" type="text/html" />
    <title>On Working Remotely</title>
<content type="html">

Being on my honeymoon in St. Barths has got me thinking a bit about working remotely. Don't worry, I'm not working on this trip. I'm more trying to think if ways I could stay on this trip indefinitely, but still manage to make some cash.

I'm no stranger to remote work. As some of you may know, I live in Philly but continue to work for Motionbox in New York. I commute two days per week, and spend the rest working from home in Philly. Over the past year, I've started to catalog my likes and dislikes with this arrangement, and I'm going to list some of my dislikes here along with some possible ways to improve things. For now, we'll just look at the first problem I've encountered:

You're out of touch

If you're distributed while the rest of the team is collocated, you will be out of the loop. When your boss is walking around the office and stopping at various desks, he won't be stopping at yours. If you're looking to be recognized for your accomplishments, this can be a major problem. It's difficult to advance in the company if you're not visible.

To combat this problem, I've found getting everyone on IM and IRC to be very helpful. If your company uses an open office, you're in luck. The noise from the floor plan typically causes people to use headphones, so they'll be much more prone to use IM and IRC for all their communication (even with those people right next to them). Another good technique is to send copious amounts of email. If people are cataloging what should be done and who has done what through email (a good practice regardless), then it's much easier for you to keep track of what is happening in the office.

I don't think that Skype or frequent phone calls help much in this regard. Typically, you're only talking to one person and all the speaker phone arrangements I've seen aren't that great. Voice is great for quickly hashing out the details of a plan with one other person, but is terrible as a mechanism for keeping up with the goings on of the company.

Making time (and spending the money) to get to the office at least once a month is invaluable. Though email, IM, and IRC help, they're not a real substitute for quality time in person. One of the most important things I've done at Motionbox is to know when people are going out for after work drinks to celebrate various accomplishments and made sure that I was able to be in town for them. Though it sounds silly to talk about drinking as an important part of work, the main thing you miss by being remote is the social component. It's much more important to get in town to socialize than it is to do actual work. You'll have plenty of time to work when you're home alone the next day.

Anyone have any thoughts on other ways to keep in touch while working remotely?

          </content>  <feedburner:origLink>http://trottercashion.com/2008/6/22/on-working-remotely</feedburner:origLink></entry>
  <entry xml:base="http://trottercashion.com/">
    <author>
      <name>trotter</name>
    </author>
    <id>tag:trottercashion.com,2008-06-11:20</id>
    <published>2008-06-11T02:30:00Z</published>
    <updated>2008-06-11T02:46:16Z</updated>
    <category term="belongstodemeter" />
    <category term="rails" />
    <category term="ruby" />
    <link href="http://feeds.feedburner.com/~r/trottercashion/~3/309293334/belongstodemeter" rel="alternate" type="text/html" />
    <title>BelongsToDemeter</title>
<content type="html">

While playing with Rails the other day, I thought it would be fun if you could get at attributes of a belongs_to association without having to do the whole traverse association and check for nil thing.

# Something like...
@person.group_name  # => "Pizza Fans!" || nil

# Instead of...
@person.group ? @person.group.name : nil # => "Pizza Fans!" || nil

Thinking this would be a fun chance to play with some meta, I threw together BelongsToDemeter, which you can find over on GitHub. It's a rails plugin, but don't expect it to actually install using script/plugin. The code is complete and utter crap, so it's probably best that Rails won't install it. It is slow, and most likely prone to error. Still, it's a fun little thought experiment, and I may decide to clean it up then speed it up if someone tells me they like it.

It does what I explained above and also lets you do fun things like this, which I think are useful when assigning associations through a form:

# Lookup the user 'Bob' by login and assign
# it to the user association
@character.user               # => nil
@character.user_login = "bob"
@character.user.login         # => "bob"

Anyway, go over to GitHub and check out BelongsToDemeter. When you're done, let me know if you like the concept. After all that, go erase all memory of the implementation details from your mind, they're ugly.

          </content>  <feedburner:origLink>http://trottercashion.com/2008/6/11/belongstodemeter</feedburner:origLink></entry>
  <entry xml:base="http://trottercashion.com/">
    <author>
      <name>trotter</name>
    </author>
    <id>tag:trottercashion.com,2008-06-05:16</id>
    <published>2008-06-05T02:22:00Z</published>
    <updated>2008-06-11T02:48:00Z</updated>
    <category term="macro tests" />
    <category term="rspec" />
    <category term="ruby" />
    <link href="http://feeds.feedburner.com/~r/trottercashion/~3/304990208/macro-tests" rel="alternate" type="text/html" />
    <title>Macro Tests</title>
<content type="html">

I went to Josh Susser's talk at RailsConf last week, where he mentioned that no one really writes macro tests with rSpec. Naturally, I found this to be a true shame, since I think macro tests are a great way to clean up your code. What's a macro test you ask? Sit right there and I'll tell you.

A macro test is a test that defines other tests for you. It's a great way to reduce repetition in your test code, thereby making it easier to read. Take these three tests as an example:

describe 'GET /users/:user_id/posts/:post_id/comments' do
  it 'should be a success' do
    get :index, :user_id =&gt; 2, :post_id =&gt; 3
    response.should be_success
  end

  it 'should 404 without a user id' do
    get :index, :post_id =&gt; 3
    response.headers['Status'].to_i.should == 404
  end

  it 'should 404 without a post id' do
    get :index, :user_id =&gt; 2
    response.headers['Status'].to_i.should == 404
  end
end

Obviously there's a little bit of duplication in the 404's. Let's define macro tests to clean that up.

describe 'GET /users/:user_id/posts/:post_id/comments' do
  def self.should_404_without(param)
    # Since you're calling this method within the describe block,
    # it is being called within the correct context.
    it "should 404 without #{param}" do
      get :index, paramz.merge(param.to_sym =&gt; nil)
      response.headers['Status'].to_i.should == 404
    end
  end

  should_404_without "user_id"
  should_404_without "post_id"

  # Normally I put this at the bottom, only here to keep it close to the above.
  # This method is called by the test the macro test defines to hand off the params.
  def paramz
    {:user_id =&gt; 2, :post_id =&gt; 3}
  end

  it 'should be a success' do
    get :index, paramz
    response.should be_success
  end
end

Hmm... this doesn't really look any cleaner. The problem is that we did this for only one action. If we generalize should_404_without more, then we can put it into its own shared example set that we can include in any describe block. Let's look at that now.

shared_examples_for "controllers" do
  def self.should_normally_succeed
    it 'should be a success' do
      get @action, paramz
      response.should be_success
    end
  end

  def self.should_404_without(param)
    it "should 404 without #{param}" do
      get @action, paramz.merge(param.to_sym =&gt; nil)
      response.headers['Status'].to_i.should == 404
    end
  end
end

describe 'GET /users/:user_id/posts/:post_id/comments' do
  it_should_behave_like "controllers"

  before(:each) { @action = :index }

  should_normally_succeed
  should_404_without "user_id"
  should_404_without "post_id"

  def paramz
    {:user_id =&gt; 2, :post_id =&gt; 3}
  end
end

Oh snap! That describe block is a lot cleaner, and we can tuck the shared examples into spec_helper.rb to really clean things up. Using macro tests, you'll find it's very easy to create a lot of REST controllers very quickly. In fact, I plan on open sourcing something to help with that very soon...

Update: See the comments for David's advice on pulling this out of shared examples and into a module that you can then add to rSpec. This cleans up the describe blocks even more. Mega win!

          </content>  <feedburner:origLink>http://trottercashion.com/2008/6/5/macro-tests</feedburner:origLink></entry>
  <entry xml:base="http://trottercashion.com/">
    <author>
      <name>trotter</name>
    </author>
    <id>tag:trottercashion.com,2008-05-04:12</id>
    <published>2008-05-04T04:14:00Z</published>
    <updated>2008-05-04T14:39:31Z</updated>
    <category term="moving" />
    <category term="starting" />
    <link href="http://feeds.feedburner.com/~r/trottercashion/~3/283393385/starting-the-car" rel="alternate" type="text/html" />
    <title>Starting the Car</title>
<content type="html">

Well, it's not much of a start, but every trip must have a beginning. As I wake up and wipe my bleary eyes, I'm going to slowly pull this car out of the driveway and put it on the road. The tunes aren't yet cranking; no Allman Brothers is yet helping us greet the open road. Still, we've left that old home that is lifecoding and are starting out on something new, something fresh. We're running on rubies with a comfortable walking shoe pushing the accelerator. I hope you enjoy this ride.

          </content>  <feedburner:origLink>http://trottercashion.com/2008/5/4/starting-the-car</feedburner:origLink></entry>
</feed>


text:
package com.cnpc.framework.base.service.impl;

import org.springframework.stereotype.Service;

import com.cnpc.framework.base.entity.User;
import com.cnpc.framework.base.service.UserDemoService;

/**
 * Created by HANZO on 2016/6/17.
 */
@Service("userDemoService")
public class UserDemoServiceImpl extends BaseServiceImpl implements UserDemoService {

    @Override
    public User saveUser(User user) {
        User res = null;

        if (user != null) {
            String id = user.getId();
            if (id == null || "".equals(id.trim())) {
                this.save(user);
                res = user;
            } else {
                User old = this.get(User.class, id);
                if (old != null) {
                    old.setName(user.getName());
                    old.setSex(user.getSex());
                    old.setBirthday(user.getBirthday());
                    old.setLoginName(user.getLoginName());
                    old.setTelphone(user.getTelphone());
                    old.setMobile(user.getMobile());
                    old.setEmail(user.getEmail());
                    old.setQq(user.getQq());

                    this.update(old);

                    res = old;
                }
            }
        }

        return res;
    }
}


text:
var app = require('./app');
var config = require('./config');

app.start(config);


text:
package com.groupon.jenkins.dynamic.buildconfiguration.plugins;

import hudson.ExtensionList;
import hudson.ExtensionPoint;
import hudson.FilePath;
import hudson.Launcher;
import hudson.model.BuildListener;

import java.io.IOException;
import java.util.Map;

import jenkins.model.Jenkins;

import com.groupon.jenkins.dynamic.build.DynamicSubBuild;
import com.groupon.jenkins.dynamic.build.DynamicBuild;
import com.groupon.jenkins.dynamic.buildconfiguration.InvalidDotCiYmlException;

public abstract class DotCiPluginAdapter implements ExtensionPoint {
	protected String pluginInputFiles;
	private final String name;
	protected Object options;

	protected DotCiPluginAdapter(String name, String pluginInputFiles) {
		this.name = name;
		this.pluginInputFiles = pluginInputFiles;

	}

	public static ExtensionList<DotCiPluginAdapter> all() {
		return Jenkins.getInstance().getExtensionList(DotCiPluginAdapter.class);
	}

	public static DotCiPluginAdapter create(String pluginName, Object options) {
		if (pluginName.equals("test_output")) {
			pluginName = (((Map<String, String>) options).get("format"));
		}
		for (DotCiPluginAdapter adapter : all()) {
			if (adapter.getName().equals(pluginName)) {
				try {
					adapter = adapter.getClass().newInstance();
				} catch (Exception e) {
					throw new RuntimeException(e);
				}
				adapter.setOptions(options);
				return adapter;
			}

		}
		throw new InvalidDotCiYmlException("Plugin " + pluginName + " not supported");
	}

	private void setOptions(Object options) {
		this.options = options;
	}

	private String getName() {
		return this.name;
	}

	public abstract boolean perform(DynamicBuild dynamicBuild, Launcher launcher, BuildListener listener);

	public void runFinished(DynamicSubBuild run, DynamicBuild parent, BuildListener listener) throws IOException {
		copyFiles(run, parent, pluginInputFiles, listener);
	}

	protected void copyFiles(DynamicSubBuild run, DynamicBuild parent, String outputFiles, BuildListener listener) throws IOException {
		String baseWorkSpace;
		try {
			listener.getLogger().println("Copying files :" + outputFiles);
			FilePath workspacePath = run.getWorkspace();
			FilePath targetPath = parent.getWorkspace();
			if (workspacePath != null && targetPath != null) {
				baseWorkSpace = workspacePath.toURI().toString();
				for (FilePath file : workspacePath.list(outputFiles)) {
					String dir = file.toURI().toString().replaceAll(baseWorkSpace, "").replaceAll(file.getName(), "");
					FilePath targetChildDir = targetPath.child(dir);
					if (!targetChildDir.exists()) {
						targetChildDir.mkdirs();
					}
					file.copyTo(targetChildDir.child(file.getName()));
				}
			}
		} catch (InterruptedException e) {
			Thread.currentThread().interrupt();
		}
	}

}


text:
var searchData=
[
  ['cameraconfigurable_2ecs',['CameraConfigurable.cs',['../_camera_configurable_8cs.html',1,'']]],
  ['camerafitter_2ecs',['CameraFitter.cs',['../_camera_fitter_8cs.html',1,'']]],
  ['cameraobservationtexturecontroller_2ecs',['CameraObservationTextureController.cs',['../_camera_observation_texture_controller_8cs.html',1,'']]],
  ['camerasensor_2ecs',['CameraSensor.cs',['../_camera_sensor_8cs.html',1,'']]],
  ['camerasensorcomponent_2ecs',['CameraSensorComponent.cs',['../_camera_sensor_component_8cs.html',1,'']]],
  ['camerssensorsystem_2ecs',['CamersSensorSystem.cs',['../_camers_sensor_system_8cs.html',1,'']]],
  ['canvasbardisplayer_2ecs',['CanvasBarDisplayer.cs',['../_canvas_bar_displayer_8cs.html',1,'']]],
  ['canvastextdisplayer_2ecs',['CanvasTextDisplayer.cs',['../_canvas_text_displayer_8cs.html',1,'']]],
  ['categoricalsensor_2ecs',['CategoricalSensor.cs',['../_categorical_sensor_8cs.html',1,'']]],
  ['categorysegmenter_2ecs',['CategorySegmenter.cs',['../_category_segmenter_8cs.html',1,'']]],
  ['changelog_2emd',['CHANGELOG.md',['../_c_h_a_n_g_e_l_o_g_8md.html',1,'']]],
  ['changematerialonrenderbyinstance_2ecs',['ChangeMaterialOnRenderByInstance.cs',['../_change_material_on_render_by_instance_8cs.html',1,'']]],
  ['changematerialonrenderbytag_2ecs',['ChangeMaterialOnRenderByTag.cs',['../_change_material_on_render_by_tag_8cs.html',1,'']]],
  ['childcollider2dsensor_2ecs',['ChildCollider2DSensor.cs',['../_child_collider2_d_sensor_8cs.html',1,'']]],
  ['childcollider3dsensor_2ecs',['ChildCollider3DSensor.cs',['../_child_collider3_d_sensor_8cs.html',1,'']]],
  ['childcollidersensor_2ecs',['ChildColliderSensor.cs',['../_child_collider_sensor_8cs.html',1,'']]],
  ['childselectorconfigurable_2ecs',['ChildSelectorConfigurable.cs',['../_child_selector_configurable_8cs.html',1,'']]],
  ['colorconfigurable_2ecs',['ColorConfigurable.cs',['../_color_configurable_8cs.html',1,'']]],
  ['colorencoding_2ecs',['ColorEncoding.cs',['../_color_encoding_8cs.html',1,'']]],
  ['compasssensor_2ecs',['CompassSensor.cs',['../_compass_sensor_8cs.html',1,'']]],
  ['configurable_2ecs',['Configurable.cs',['../_configurable_8cs.html',1,'']]],
  ['configurablecomponentmenupath_2ecs',['ConfigurableComponentMenuPath.cs',['../_configurable_component_menu_path_8cs.html',1,'']]],
  ['configurablesampletogglelist_2ecs',['ConfigurableSampleToggleList.cs',['../_configurable_sample_toggle_list_8cs.html',1,'']]],
  ['configuration_2ecs',['Configuration.cs',['../_configuration_8cs.html',1,'']]],
  ['coordinatesystem_2ecs',['CoordinateSystem.cs',['../_coordinate_system_8cs.html',1,'']]],
  ['corners_2ecs',['Corners.cs',['../_corners_8cs.html',1,'']]],
  ['createstereocubemaps_2ecs',['CreateStereoCubemaps.cs',['../_create_stereo_cubemaps_8cs.html',1,'']]],
  ['curriculum_2ecs',['Curriculum.cs',['../_curriculum_8cs.html',1,'']]],
  ['curriculummanager_2ecs',['CurriculumManager.cs',['../_curriculum_manager_8cs.html',1,'']]],
  ['customflatbufferimplementation_2ecs',['CustomFlatBufferImplementation.cs',['../_custom_flat_buffer_implementation_8cs.html',1,'']]],
  ['cylinderlinerenderer_2ecs',['CylinderLineRenderer.cs',['../_cylinder_line_renderer_8cs.html',1,'']]]
];


text:
<?php

namespace PHPExif\Common\Data\ValueObject;

use PHPExif\Common\Data\ValueObject\StringObject;

/**
 * Make class
 *
 * A value object to describe the Make data
 *
 * @category    PHPExif
 * @package     Common
 */
class Make extends StringObject
{
    /**
     * Creates a new instance from given Make object
     *
     * @param Make $make
     *
     * @return Make
     */
    public static function fromMake(Make $make)
    {
        return new self(
            (string) $make
        );
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
Uses of Interface soot.baf.Inst (Soot API)
</TITLE>

<META NAME="date" CONTENT="2012-01-22">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Interface
soot.baf.Inst

Packages that use Inst

soot.baf
Public classes for the Baf intermediate representation.

soot.baf.internal
Internal, messy, implementation-specific classes for the Baf intermediate representation.

Uses of Inst in soot.baf

Subinterfaces of Inst in soot.baf

 interface
AddInst

 interface
AndInst

 interface
ArrayLengthInst

 interface
ArrayReadInst

 interface
ArrayWriteInst

 interface
CmpgInst

 interface
CmpInst

 interface
CmplInst

 interface
DivInst

 interface
Dup1_x1Inst

 interface
Dup1_x2Inst

 interface
Dup1Inst

 interface
Dup2_x1Inst

 interface
Dup2_x2Inst

 interface
Dup2Inst

 interface
DupInst

 interface
DynamicInvokeInst

 interface
EnterMonitorInst

 interface
ExitMonitorInst

 interface
FieldArgInst

 interface
FieldGetInst

 interface
FieldPutInst

 interface
GotoInst

 interface
IdentityInst

 interface
IfCmpEqInst

 interface
IfCmpGeInst

 interface
IfCmpGtInst

 interface
IfCmpLeInst

 interface
IfCmpLtInst

 interface
IfCmpNeInst

 interface
IfEqInst

 interface
IfGeInst

 interface
IfGtInst

 interface
IfLeInst

 interface
IfLtInst

 interface
IfNeInst

 interface
IfNonNullInst

 interface
IfNullInst

 interface
IncInst

 interface
InstanceCastInst

 interface
InstanceOfInst

 interface
InterfaceInvokeInst

 interface
JSRInst

 interface
LoadInst

 interface
LookupSwitchInst

 interface
MethodArgInst

 interface
MulInst

 interface
NegInst

 interface
NewArrayInst

 interface
NewInst

 interface
NewMultiArrayInst

 interface
NoArgInst

 interface
NopInst

 interface
OpTypeArgInst

 interface
OrInst

 interface
PopInst

 interface
PrimitiveCastInst

 interface
PushInst

 interface
RemInst

 interface
RetInst

 interface
ReturnInst

 interface
ReturnVoidInst

 interface
ShlInst

 interface
ShrInst

 interface
SpecialInvokeInst

 interface
StaticGetInst

 interface
StaticInvokeInst

 interface
StaticPutInst

 interface
StoreInst

 interface
SubInst

 interface
SwapInst

 interface
TableSwitchInst

 interface
TargetArgInst

 interface
ThrowInst

 interface
UshrInst

 interface
VirtualInvokeInst

 interface
XorInst

Classes in soot.baf that implement Inst

 class
PlaceholderInst

Uses of Inst in soot.baf.internal

Classes in soot.baf.internal that implement Inst

 class
AbstractBranchInst

 class
AbstractInst

 class
AbstractOpTypeBranchInst

 class
AbstractOpTypeInst

 class
AbstractRefTypeInst

 class
BAddInst

 class
BAndInst

 class
BArrayLengthInst

 class
BArrayReadInst

 class
BArrayWriteInst

 class
BCmpgInst

 class
BCmpInst

 class
BCmplInst

 class
BDivInst

 class
BDup1_x1Inst

 class
BDup1_x2Inst

 class
BDup1Inst

 class
BDup2_x1Inst

 class
BDup2_x2Inst

 class
BDup2Inst

 class
BDupInst

 class
BDynamicInvokeInst

 class
BEnterMonitorInst

 class
BExitMonitorInst

 class
BFieldGetInst

 class
BFieldPutInst

 class
BGotoInst

 class
BIdentityInst

 class
BIfCmpEqInst

 class
BIfCmpGeInst

 class
BIfCmpGtInst

 class
BIfCmpLeInst

 class
BIfCmpLtInst

 class
BIfCmpNeInst

 class
BIfEqInst

 class
BIfGeInst

 class
BIfGtInst

 class
BIfLeInst

 class
BIfLtInst

 class
BIfNeInst

 class
BIfNonNullInst

 class
BIfNullInst

 class
BIncInst

 class
BInstanceCastInst

 class
BInstanceOfInst

 class
BInterfaceInvokeInst

 class
BJSRInst

 class
BLoadInst

 class
BLookupSwitchInst

 class
BMulInst

 class
BNegInst

 class
BNewArrayInst

 class
BNewInst

 class
BNewMultiArrayInst

 class
BNopInst

 class
BOrInst

 class
BPopInst

 class
BPrimitiveCastInst

 class
BPushInst

 class
BRemInst

 class
BReturnInst

 class
BReturnVoidInst

 class
BShlInst

 class
BShrInst

 class
BSpecialInvokeInst

 class
BStaticGetInst

 class
BStaticInvokeInst

 class
BStaticPutInst

 class
BStoreInst

 class
BSubInst

 class
BSwapInst

 class
BTableSwitchInst

 class
BThrowInst

 class
BUshrInst

 class
BVirtualInvokeInst

 class
BXorInst

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes


text:
"use strict";

var debug = require("debug")("lc:pubsub");

module.exports = function Pubsub(socket, nats, options) {
  debug("pubsub object created with options:", options);
  if ( nats )   { debug("socket client given"); }
  if ( socket ) { debug("nats client given");   }

  var publishNats = function(msg) {
    if ( !nats ) return false;
    var subject = parseNatsSubject(msg.method, msg.endpoint);
    try {
      nats.publish(subject, JSON.stringify(msg.data));
    } catch ( err ) {
      debug("ERROR: publishing to NATS", err);
    }
  };

  var publishSocketIO = function(msg) {
    if ( !socket ) return false;
    var channel = `[${msg.method}]${msg.endpoint}`;
    socket.emit(channel, msg.data);
  };

  Pubsub.prototype.publish = function publish(msg, next) {
    debug("told to publish message: ", msg);

    if ( !isValidMessage(msg) ) {
      debug("Error: Option must be an instance of type { method: string, endpoint: string, data: object }");
      debug("Invalid message: ", msg);
      next && next();
      return;
    }

    // remove query params from the endpoint
    if (msg.endpoint.match(/\?/)) {
      msg.endpoint = msg.endpoint.split("?").shift();
    }

    // remove the api root from the front of the URL
    if ( options.removeApiRoot === true ) {
      msg.endpoint = msg.endpoint.replace(options.apiRoot, "");
    }

    // always make the method upper case
    msg.method = msg.method.toUpperCase();

    debug("publishing message %s %s", msg.method, msg.endpoint);
    debug("message data:", msg.data);

    publishNats(msg);
    publishSocketIO(msg);

    next && next();
  };
};

var isValidMessage = function(msg) {
  return (msg && msg.method && msg.endpoint && msg.data);
};

var parseNatsSubject = function(method, endpoint) {
  var sub = [method.toUpperCase()];
  endpoint.split("/").forEach(function(bit) {
    if ( bit == "" ) return;
    sub.push(bit);
  });

  return sub.join(".");
};