text:
import cronjobs
import waffle

from kitsune.karma.manager import KarmaManager
from kitsune.karma.models import Title

@cronjobs.register
def update_top_contributors():
    """"Update the top contributor lists and titles."""
    if not waffle.switch_is_active('karma'):
        return

    KarmaManager().update_top()

    top25 = KarmaManager().top_users('3m', count=25)
    Title.objects.set_top10_contributors(top25[:10])
    Title.objects.set_top25_contributors(top25[10:25])

redpajama_set_name: RedPajamaGithub


text:
'use strict';

//global object
window.Modules = [];

require('./global/styles/styles.scss');
require('./global/scripts/utils.js');
require('./global/scripts/module.js');
require('./business.js');


text:
<?php
    include("mod/connect.php");
    include("mod/sessioncheck.php");
?>

<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Stock Application</title>

    <link href="../vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">

    <link href="../vendor/metisMenu/metisMenu.min.css" rel="stylesheet">

    <link href="../dist/css/sb-admin-2.css" rel="stylesheet">

    <link href="../vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    Toggle navigation

                </button>
                Stock Application

                     Logout

                                <input type="text" class="form-control" placeholder="Search...">

                                <button class="btn btn-default" type="button">

                                </button>

                        <?php

                            if($role=='worker'){
                                ?>

                             View Data

                             Update Data

                             Log Transaction

                        <?php

                            }else{

                                    ?>

                             Dashboard

                             View Data

                             Input Data

                             Update Data

                            View Bond

                            Input Bond

                             Log Transaction

                                    <?php

                            }
                         ?>

Bond Forms

                            Insert Form Bond

                                    <form action="/pages/mod/doinsertbond.php" method="POST" role="form">

                                            Supplier
                                            <input class="form-control" placeholder="Supplier" name="supplier" required autofocus>

                                            Date
                                            <input class="form-control" type="Date" placeholder="Date" name="date" required>

                                            Nomor Nota
                                            <input class="form-control" placeholder="Nomor Nota" name="nonota" required>

                                            Total
                                            <input class="form-control" placeholder="Total" name="total" required>

                                            Sales
                                            <input class="form-control" placeholder="Sales" name="sales" required>

                                            Status
                                            <input class="form-control" placeholder="Status" name="status" required>

                                            Keterangan
                                            <input class="form-control" placeholder="Keterangan" name="keterangan">

                                        <button type="submit" class="btn btn-default">Submit</button>
                                        <button type="reset" class="btn btn-default">Reset</button>
                                    </form>

                            Retur Form Bond

                                    <form action="/pages/mod/doupdatebond.php" method="POST" role="form">

                                            ID Bond
                                            <input class="form-control" placeholder="ID Bond" name="idbond" required autofocus>

                                            Total
                                            <input class="form-control" placeholder="Total" name="total" required>

                                            Keterangan
                                            <input class="form-control" placeholder="Keterangan" name="keterangan" required>

                                        <button type="submit" class="btn btn-default">Submit</button>
                                        <button type="reset" class="btn btn-default">Reset</button>
                                    </form>

                            Update Form Status Lunas / Belum Lunas

                                    <form action="/pages/mod/doupdatebondstatus.php" method="POST" role="form">

                                            ID Bond
                                            <input class="form-control" placeholder="ID Bond" name="idbond" required autofocus>

                                            Status
                                            <input class="form-control" placeholder="Status" name="status" required>

                                        <button type="submit" class="btn btn-default">Submit</button>
                                        <button type="reset" class="btn btn-default">Reset</button>
                                    </form>


text:
// Copyright (c) 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "net/third_party/quiche/src/quic/core/uber_quic_stream_id_manager.h"

#include "net/third_party/quiche/src/quic/core/quic_utils.h"
#include "net/third_party/quiche/src/quic/core/quic_versions.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_stream_id_manager_peer.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"

using testing::_;
using testing::StrictMock;

namespace quic {
namespace test {
namespace {

struct TestParams {
  explicit TestParams(ParsedQuicVersion version, Perspective perspective)
      : version(version), perspective(perspective) {}

  ParsedQuicVersion version;
  Perspective perspective;
};

// Used by ::testing::PrintToStringParamName().
std::string PrintToString(const TestParams& p) {
  return quiche::QuicheStrCat(
      ParsedQuicVersionToString(p.version), "_",
      (p.perspective == Perspective::IS_CLIENT ? "client" : "server"));
}

std::vector<TestParams> GetTestParams() {
  std::vector<TestParams> params;
  for (const ParsedQuicVersion& version : AllSupportedVersions()) {
    if (!version.HasIetfQuicFrames()) {
      continue;
    }
    params.push_back(TestParams(version, Perspective::IS_CLIENT));
    params.push_back(TestParams(version, Perspective::IS_SERVER));
  }
  return params;
}

class MockDelegate : public QuicStreamIdManager::DelegateInterface {
 public:
  MOCK_METHOD(void,
              SendMaxStreams,
              (QuicStreamCount stream_count, bool unidirectional),
              (override));
};

class UberQuicStreamIdManagerTest : public QuicTestWithParam<TestParams> {
 protected:
  UberQuicStreamIdManagerTest()
      : manager_(perspective(),
                 version(),
                 &delegate_,
                 0,
                 0,
                 kDefaultMaxStreamsPerConnection,
                 kDefaultMaxStreamsPerConnection) {}

  QuicStreamId GetNthClientInitiatedBidirectionalId(int n) {
    return QuicUtils::GetFirstBidirectionalStreamId(transport_version(),
                                                    Perspective::IS_CLIENT) +
           QuicUtils::StreamIdDelta(transport_version()) * n;
  }

  QuicStreamId GetNthClientInitiatedUnidirectionalId(int n) {
    return QuicUtils::GetFirstUnidirectionalStreamId(transport_version(),
                                                     Perspective::IS_CLIENT) +
           QuicUtils::StreamIdDelta(transport_version()) * n;
  }

  QuicStreamId GetNthServerInitiatedBidirectionalId(int n) {
    return QuicUtils::GetFirstBidirectionalStreamId(transport_version(),
                                                    Perspective::IS_SERVER) +
           QuicUtils::StreamIdDelta(transport_version()) * n;
  }

  QuicStreamId GetNthServerInitiatedUnidirectionalId(int n) {
    return QuicUtils::GetFirstUnidirectionalStreamId(transport_version(),
                                                     Perspective::IS_SERVER) +
           QuicUtils::StreamIdDelta(transport_version()) * n;
  }

  QuicStreamId GetNthPeerInitiatedBidirectionalStreamId(int n) {
    return ((perspective() == Perspective::IS_SERVER)
                ? GetNthClientInitiatedBidirectionalId(n)
                : GetNthServerInitiatedBidirectionalId(n));
  }
  QuicStreamId GetNthPeerInitiatedUnidirectionalStreamId(int n) {
    return ((perspective() == Perspective::IS_SERVER)
                ? GetNthClientInitiatedUnidirectionalId(n)
                : GetNthServerInitiatedUnidirectionalId(n));
  }
  QuicStreamId GetNthSelfInitiatedBidirectionalStreamId(int n) {
    return ((perspective() == Perspective::IS_CLIENT)
                ? GetNthClientInitiatedBidirectionalId(n)
                : GetNthServerInitiatedBidirectionalId(n));
  }
  QuicStreamId GetNthSelfInitiatedUnidirectionalStreamId(int n) {
    return ((perspective() == Perspective::IS_CLIENT)
                ? GetNthClientInitiatedUnidirectionalId(n)
                : GetNthServerInitiatedUnidirectionalId(n));
  }

  QuicStreamId StreamCountToId(QuicStreamCount stream_count,
                               Perspective perspective,
                               bool bidirectional) {
    return ((bidirectional) ? QuicUtils::GetFirstBidirectionalStreamId(
                                  transport_version(), perspective)
                            : QuicUtils::GetFirstUnidirectionalStreamId(
                                  transport_version(), perspective)) +
           ((stream_count - 1) * QuicUtils::StreamIdDelta(transport_version()));
  }

  ParsedQuicVersion version() { return GetParam().version; }
  QuicTransportVersion transport_version() {
    return version().transport_version;
  }

  Perspective perspective() { return GetParam().perspective; }

  testing::StrictMock<MockDelegate> delegate_;
  UberQuicStreamIdManager manager_;
};

INSTANTIATE_TEST_SUITE_P(Tests,
                         UberQuicStreamIdManagerTest,
                         ::testing::ValuesIn(GetTestParams()),
                         ::testing::PrintToStringParamName());

TEST_P(UberQuicStreamIdManagerTest, Initialization) {
  EXPECT_EQ(GetNthSelfInitiatedBidirectionalStreamId(0),
            manager_.next_outgoing_bidirectional_stream_id());
  EXPECT_EQ(GetNthSelfInitiatedUnidirectionalStreamId(0),
            manager_.next_outgoing_unidirectional_stream_id());
}

TEST_P(UberQuicStreamIdManagerTest, SetMaxOpenOutgoingStreams) {
  const size_t kNumMaxOutgoingStream = 123;
  // Set the uni- and bi- directional limits to different values to ensure
  // that they are managed separately.
  EXPECT_TRUE(manager_.MaybeAllowNewOutgoingBidirectionalStreams(
      kNumMaxOutgoingStream));
  EXPECT_TRUE(manager_.MaybeAllowNewOutgoingUnidirectionalStreams(
      kNumMaxOutgoingStream + 1));
  EXPECT_EQ(kNumMaxOutgoingStream,
            manager_.max_outgoing_bidirectional_streams());
  EXPECT_EQ(kNumMaxOutgoingStream + 1,
            manager_.max_outgoing_unidirectional_streams());
  // Check that, for each directionality, we can open the correct number of
  // streams.
  int i = kNumMaxOutgoingStream;
  while (i) {
    EXPECT_TRUE(manager_.CanOpenNextOutgoingBidirectionalStream());
    manager_.GetNextOutgoingBidirectionalStreamId();
    EXPECT_TRUE(manager_.CanOpenNextOutgoingUnidirectionalStream());
    manager_.GetNextOutgoingUnidirectionalStreamId();
    i--;
  }
  // One more unidirectional
  EXPECT_TRUE(manager_.CanOpenNextOutgoingUnidirectionalStream());
  manager_.GetNextOutgoingUnidirectionalStreamId();

  // Both should be exhausted...
  EXPECT_FALSE(manager_.CanOpenNextOutgoingUnidirectionalStream());
  EXPECT_FALSE(manager_.CanOpenNextOutgoingBidirectionalStream());
}

TEST_P(UberQuicStreamIdManagerTest, SetMaxOpenIncomingStreams) {
  const size_t kNumMaxIncomingStreams = 456;
  manager_.SetMaxOpenIncomingUnidirectionalStreams(kNumMaxIncomingStreams);
  // Do +1 for bidirectional to ensure that uni- and bi- get properly set.
  manager_.SetMaxOpenIncomingBidirectionalStreams(kNumMaxIncomingStreams + 1);
  EXPECT_EQ(kNumMaxIncomingStreams + 1,
            manager_.GetMaxAllowdIncomingBidirectionalStreams());
  EXPECT_EQ(kNumMaxIncomingStreams,
            manager_.GetMaxAllowdIncomingUnidirectionalStreams());
  EXPECT_EQ(manager_.max_incoming_bidirectional_streams(),
            manager_.advertised_max_incoming_bidirectional_streams());
  EXPECT_EQ(manager_.max_incoming_unidirectional_streams(),
            manager_.advertised_max_incoming_unidirectional_streams());
  // Make sure that we can create kNumMaxIncomingStreams incoming unidirectional
  // streams and kNumMaxIncomingStreams+1 incoming bidirectional streams.
  size_t i;
  for (i = 0; i < kNumMaxIncomingStreams; i++) {
    EXPECT_TRUE(manager_.MaybeIncreaseLargestPeerStreamId(
        GetNthPeerInitiatedUnidirectionalStreamId(i), nullptr));
    EXPECT_TRUE(manager_.MaybeIncreaseLargestPeerStreamId(
        GetNthPeerInitiatedBidirectionalStreamId(i), nullptr));
  }
  // Should be able to open the next bidirectional stream
  EXPECT_TRUE(manager_.MaybeIncreaseLargestPeerStreamId(
      GetNthPeerInitiatedBidirectionalStreamId(i), nullptr));

  // We should have exhausted the counts, the next streams should fail
  std::string error_details;
  EXPECT_FALSE(manager_.MaybeIncreaseLargestPeerStreamId(
      GetNthPeerInitiatedUnidirectionalStreamId(i), &error_details));
  EXPECT_EQ(error_details,
            quiche::QuicheStrCat(
                "Stream id ", GetNthPeerInitiatedUnidirectionalStreamId(i),
                " would exceed stream count limit ", kNumMaxIncomingStreams));
  EXPECT_FALSE(manager_.MaybeIncreaseLargestPeerStreamId(
      GetNthPeerInitiatedBidirectionalStreamId(i + 1), &error_details));
  EXPECT_EQ(
      error_details,
      quiche::QuicheStrCat(
          "Stream id ", GetNthPeerInitiatedBidirectionalStreamId(i + 1),
          " would exceed stream count limit ", kNumMaxIncomingStreams + 1));
}

TEST_P(UberQuicStreamIdManagerTest, GetNextOutgoingStreamId) {
  EXPECT_TRUE(manager_.MaybeAllowNewOutgoingBidirectionalStreams(10));
  EXPECT_TRUE(manager_.MaybeAllowNewOutgoingUnidirectionalStreams(10));
  EXPECT_EQ(GetNthSelfInitiatedBidirectionalStreamId(0),
            manager_.GetNextOutgoingBidirectionalStreamId());
  EXPECT_EQ(GetNthSelfInitiatedBidirectionalStreamId(1),
            manager_.GetNextOutgoingBidirectionalStreamId());
  EXPECT_EQ(GetNthSelfInitiatedUnidirectionalStreamId(0),
            manager_.GetNextOutgoingUnidirectionalStreamId());
  EXPECT_EQ(GetNthSelfInitiatedUnidirectionalStreamId(1),
            manager_.GetNextOutgoingUnidirectionalStreamId());
}

TEST_P(UberQuicStreamIdManagerTest, AvailableStreams) {
  EXPECT_TRUE(manager_.MaybeIncreaseLargestPeerStreamId(
      GetNthPeerInitiatedBidirectionalStreamId(3), nullptr));
  EXPECT_TRUE(
      manager_.IsAvailableStream(GetNthPeerInitiatedBidirectionalStreamId(1)));
  EXPECT_TRUE(
      manager_.IsAvailableStream(GetNthPeerInitiatedBidirectionalStreamId(2)));

  EXPECT_TRUE(manager_.MaybeIncreaseLargestPeerStreamId(
      GetNthPeerInitiatedUnidirectionalStreamId(3), nullptr));
  EXPECT_TRUE(
      manager_.IsAvailableStream(GetNthPeerInitiatedUnidirectionalStreamId(1)));
  EXPECT_TRUE(
      manager_.IsAvailableStream(GetNthPeerInitiatedUnidirectionalStreamId(2)));
}

TEST_P(UberQuicStreamIdManagerTest, MaybeIncreaseLargestPeerStreamId) {
  EXPECT_TRUE(manager_.MaybeIncreaseLargestPeerStreamId(
      StreamCountToId(manager_.max_incoming_bidirectional_streams(),
                      QuicUtils::InvertPerspective(perspective()),
                      /* bidirectional=*/true),
      nullptr));
  EXPECT_TRUE(manager_.MaybeIncreaseLargestPeerStreamId(
      StreamCountToId(manager_.max_incoming_bidirectional_streams(),
                      QuicUtils::InvertPerspective(perspective()),
                      /* bidirectional=*/false),
      nullptr));

  std::string expected_error_details =
      perspective() == Perspective::IS_SERVER
          ? "Stream id 400 would exceed stream count limit 100"
          : "Stream id 401 would exceed stream count limit 100";
  std::string error_details;

  EXPECT_FALSE(manager_.MaybeIncreaseLargestPeerStreamId(
      StreamCountToId(manager_.max_incoming_bidirectional_streams() + 1,
                      QuicUtils::InvertPerspective(perspective()),
                      /* bidirectional=*/true),
      &error_details));
  EXPECT_EQ(expected_error_details, error_details);
  expected_error_details =
      perspective() == Perspective::IS_SERVER
          ? "Stream id 402 would exceed stream count limit 100"
          : "Stream id 403 would exceed stream count limit 100";

  EXPECT_FALSE(manager_.MaybeIncreaseLargestPeerStreamId(
      StreamCountToId(manager_.max_incoming_bidirectional_streams() + 1,
                      QuicUtils::InvertPerspective(perspective()),
                      /* bidirectional=*/false),
      &error_details));
  EXPECT_EQ(expected_error_details, error_details);
}

TEST_P(UberQuicStreamIdManagerTest, OnStreamsBlockedFrame) {
  QuicStreamCount stream_count =
      manager_.advertised_max_incoming_bidirectional_streams() - 1;

  QuicStreamsBlockedFrame frame(kInvalidControlFrameId, stream_count,
                                /*unidirectional=*/false);
  EXPECT_CALL(delegate_,
              SendMaxStreams(manager_.max_incoming_bidirectional_streams(),
                             frame.unidirectional));
  EXPECT_TRUE(manager_.OnStreamsBlockedFrame(frame, nullptr));

  stream_count = manager_.advertised_max_incoming_unidirectional_streams() - 1;
  frame.stream_count = stream_count;
  frame.unidirectional = true;

  EXPECT_CALL(delegate_,
              SendMaxStreams(manager_.max_incoming_unidirectional_streams(),
                             frame.unidirectional));
  EXPECT_TRUE(manager_.OnStreamsBlockedFrame(frame, nullptr));
}

TEST_P(UberQuicStreamIdManagerTest, SetMaxOpenOutgoingStreamsPlusFrame) {
  const size_t kNumMaxOutgoingStream = 123;
  // Set the uni- and bi- directional limits to different values to ensure
  // that they are managed separately.
  EXPECT_TRUE(manager_.MaybeAllowNewOutgoingBidirectionalStreams(
      kNumMaxOutgoingStream));
  EXPECT_TRUE(manager_.MaybeAllowNewOutgoingUnidirectionalStreams(
      kNumMaxOutgoingStream + 1));
  EXPECT_EQ(kNumMaxOutgoingStream,
            manager_.max_outgoing_bidirectional_streams());
  EXPECT_EQ(kNumMaxOutgoingStream + 1,
            manager_.max_outgoing_unidirectional_streams());
  // Check that, for each directionality, we can open the correct number of
  // streams.
  int i = kNumMaxOutgoingStream;
  while (i) {
    EXPECT_TRUE(manager_.CanOpenNextOutgoingBidirectionalStream());
    manager_.GetNextOutgoingBidirectionalStreamId();
    EXPECT_TRUE(manager_.CanOpenNextOutgoingUnidirectionalStream());
    manager_.GetNextOutgoingUnidirectionalStreamId();
    i--;
  }
  // One more unidirectional
  EXPECT_TRUE(manager_.CanOpenNextOutgoingUnidirectionalStream());
  manager_.GetNextOutgoingUnidirectionalStreamId();

  // Both should be exhausted...
  EXPECT_FALSE(manager_.CanOpenNextOutgoingUnidirectionalStream());
  EXPECT_FALSE(manager_.CanOpenNextOutgoingBidirectionalStream());
}

}  // namespace
}  // namespace test
}  // namespace quic


text:
package seedu.dailyplanner.logic.commands;

import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;

import seedu.dailyplanner.commons.exceptions.IllegalValueException;
import seedu.dailyplanner.commons.util.DateUtil;
import seedu.dailyplanner.model.category.Category;
import seedu.dailyplanner.model.category.UniqueCategoryList;
import seedu.dailyplanner.model.task.*;
import seedu.dailyplanner.history.*;

/**
 * Adds a task to the daily planner.
 */
public class AddCommand extends Command {

    public static final String COMMAND_WORD = "add";
  //@@author A0139102U
    public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a task to the daily planner. "
            + "Format: add [TASKNAME] s/[STARTDATE] [STARTTIME] e/[ENDDATE] [ENDTIME] c/CATEGORY...\n" + "Example: "
            + COMMAND_WORD + " CS2103 Assignment s/today 10pm e/11pm c/urgent c/important";

    public static final String MESSAGE_SUCCESS = "New task added: %1$s";
    public static final String MESSAGE_DUPLICATE_TASK = "This task already exists in the daily planner";
    public static final String MESSAGE_WARNING_CLASH = "Warning! Current timeslot clashes with the following task: %1$s";
    private List<ReadOnlyTask> taskList;
    private final Task toAdd;

    /**
     * Convenience constructor using raw values.
     *
     * @param endDate
     *
     * @throws IllegalValueException
     *             if any of the raw values are invalid
     */

    public AddCommand(String taskName, DateTime start, DateTime end, Set<String> cats) throws IllegalValueException {
        final Set<Category> catSet = new HashSet<>();
        for (String catName : cats) {
            catSet.add(new Category(catName));
        }
        this.toAdd = new Task(taskName, start, end, false, false, new UniqueCategoryList(catSet));

    }
  //@@author A0140124B
    @Override
    public CommandResult execute() {
        assert model != null;
        try {
            taskList = model.getDailyPlanner().getTaskList();
            model.getHistory().stackDeleteInstruction(toAdd);
            model.addTask(toAdd);
            model.updatePinBoard();

            int indexOfClashingTask = getIndexOfClashingTask(toAdd);

            if (isClash(indexOfClashingTask))
                return new CommandResult(
                        String.format(MESSAGE_WARNING_CLASH, taskList.get(indexOfClashingTask)));

            return new CommandResult(String.format(MESSAGE_SUCCESS, toAdd));
        } catch (UniqueTaskList.DuplicateTaskException e) {
            return new CommandResult(MESSAGE_DUPLICATE_TASK);
        }

    }//@@author

    private boolean isClash(int indexOfClashingTask) {
        return indexOfClashingTask > -1;
    }
  //@@author A0139102U
    /**
     * Returns the index of the task clashing with argument, returns -1 if no
     * clash
     */
    public int getIndexOfClashingTask(Task toCheck) {

        if (!(DateUtil.hasStartandEndTime(toCheck))) {
            return -1;
        }
        Time toAddStartTiming = toCheck.getStart().getTime();
        Time toAddEndTiming = toCheck.getEnd().getTime();

        for (int i = 0; i < taskList.size(); i++) {
            ReadOnlyTask storedTask = taskList.get(i);
            if (DateUtil.hasStartandEndTime(storedTask)) {
                if (notSameTask(toCheck, storedTask)) {
                    if (isSameStartDate(toCheck, storedTask)) {
                        Time tasksEndTiming = storedTask.getEnd().getTime();
                        Time tasksStartTiming = storedTask.getStart().getTime();

                        if (isStartTimeClashing(toAddStartTiming, tasksEndTiming, tasksStartTiming)) {
                            return i;
                        }
                        if (isEndTimeClashing(toAddEndTiming, tasksEndTiming, tasksStartTiming)) {
                            return i;
                        }
                        if (timingSpansEntireTask(toAddStartTiming, toAddEndTiming, tasksEndTiming, tasksStartTiming)) {
                            return i;
                        }
                    }
                }

            }
        }
        return -1;
    }

    private boolean notSameTask(Task toCheck, ReadOnlyTask storedTask) {
        return !(toCheck == storedTask);
    }

    private boolean timingSpansEntireTask(Time toAddStartTiming, Time toAddEndTiming, Time tasksEndTiming,
            Time tasksStartTiming) {
        return ((toAddEndTiming.compareTo(tasksEndTiming) > 0) || (toAddEndTiming.compareTo(tasksEndTiming) == 0))
                && ((toAddStartTiming.compareTo(tasksStartTiming) < 0)
                        || (toAddStartTiming.compareTo(tasksStartTiming) == 0));
    }

    private boolean isEndTimeClashing(Time toAddEndTiming, Time tasksEndTiming, Time tasksStartTiming) {
        return (toAddEndTiming.compareTo(tasksStartTiming) > 0) && (toAddEndTiming.compareTo(tasksEndTiming) < 0);
    }

    private boolean isStartTimeClashing(Time toAddStartTiming, Time tasksEndTiming, Time tasksStartTiming) {
        return (toAddStartTiming.compareTo(tasksEndTiming) < 0) && (toAddStartTiming.compareTo(tasksStartTiming) > 0);
    }

    private boolean isSameStartDate(Task toCheck, ReadOnlyTask storedTask) {
        return toCheck.getStart().getDate().compareTo(storedTask.getStart().getDate()) == 0;
    }

}


text:
package org.aikodi.chameleon.support.expression;

import org.aikodi.chameleon.core.element.ElementImpl;

/**
 * @author Tim Laeremans
 * @author Marko van Dooren
 */
public abstract class ArrayIndex extends ElementImpl {
    public ArrayIndex() {
        super();
    }

//    public abstract ArrayIndex clone();

}


text:
namespace Native {
  class WindowProcedure static_ {
  public:
    using ControlDictionary = System::Collections::Generic::Dictionary<intptr, ref<System::Windows::Forms::Control>>;
    static ControlDictionary Controls;

    static int32 GetMouseButtonState(NSEvent* event);
    static void WndProc(NSEvent* event);

  private:
    static ref<System::Windows::Forms::Control> GetChildAtPoint(const System::Windows::Forms::Control& control, System::Drawing::Point& point);
    static int32 GetMouseXCoordinateRelativeToClientArea(NSEvent* event, System::Windows::Forms::Control& control);
    static int32 GetMouseYCoordinateRelativeToClientArea(NSEvent* event, System::Windows::Forms::Control& control);
    static void MouseEnterEvent(NSEvent* event, System::Windows::Forms::Control& control);
    static void MouseLeaveEvent(NSEvent* event, System::Windows::Forms::Control& control);
    static void LeftMouseDownEvent(NSEvent* event, System::Windows::Forms::Control& control);
    static void LeftMouseUpEvent(NSEvent* event, System::Windows::Forms::Control& control);
    static void OtherMouseUpEvent(NSEvent* event, System::Windows::Forms::Control& control);
    static void OtherMouseDownEvent(NSEvent* event, System::Windows::Forms::Control& control);
    static void RightMouseDownEvent(NSEvent* event, System::Windows::Forms::Control& control);
    static void RightMouseUpEvent(NSEvent* event, System::Windows::Forms::Control& control);
    static void MouseMoveEvent(NSEvent* event, System::Windows::Forms::Control& control);

    static bool messageLoopRunning ;
    static const int32 notUsed = 0;
    static bool hover;
  };
}

#endif


text:
import random
from impacket.dcerpc import srvsvc, dcerpc, svcctl, transport
from impacket import smb,smb3
from impacket.smbconnection import *
import string

class ServiceInstall():
    def __init__(self, SMBObject, exeFile):
        self._rpctransport = 0
        self.__service_name = ''.join([random.choice(string.letters) for i in range(4)])
        self.__binary_service_name = ''.join([random.choice(string.letters) for i in range(8)]) + '.exe'
        self.__exeFile = exeFile

        # We might receive two different types of objects, always end up
        # with a SMBConnection one
        if isinstance(SMBObject, smb.SMB) or isinstance(SMBObject, smb3.SMB3):
            self.connection = SMBConnection(existingConnection = SMBObject)
        else:
            self.connection = SMBObject

        self.share = ''

    def getShare(self):
        return self.share

    def getShares(self):
        # Setup up a DCE SMBTransport with the connection already in place
        print "[*] Requesting shares on %s....." % (self.connection.getRemoteHost())
        try:
            self._rpctransport = transport.SMBTransport('','',filename = r'\srvsvc', smb_connection = self.connection)
            self._dce = dcerpc.DCERPC_v5(self._rpctransport)
            self._dce.connect()

            self._dce.bind(srvsvc.MSRPC_UUID_SRVSVC)
            srv_svc = srvsvc.DCERPCSrvSvc(self._dce)
            resp = srv_svc.get_share_enum_1(self._rpctransport.get_dip())
            return resp
        except:
            print "[!] Error requesting shares on %s, aborting....." % (self.connection.getRemoteHost())
            raise

    def createService(self, handle, share, path):
        print "[*] Creating service %s on %s....." % (self.__service_name, self.connection.getRemoteHost())

        # First we try to open the service in case it exists. If it does, we remove it.
        try:
            resp = self.rpcsvc.OpenServiceW(handle, self.__service_name.encode('utf-16le'))
        except Exception, e:
            if e.get_error_code() == svcctl.ERROR_SERVICE_DOES_NOT_EXISTS:
                # We're good, pass the exception
                pass
            else:
                raise
        else:
            # It exists, remove it
            self.rpcsvc.DeleteService(resp['ContextHandle'])
            self.rpcsvc.CloseServiceHandle(resp['ContextHandle'])

        # Create the service
        command = '%s\\%s' % (path, self.__binary_service_name)
        try:
            resp = self.rpcsvc.CreateServiceW(handle, self.__service_name.encode('utf-16le'), self.__service_name.encode('utf-16le'), command.encode('utf-16le'))
        except:
            print "[!] Error creating service %s on %s" % (self.__service_name, self.connection.getRemoteHost())
            raise
        else:
            return resp['ContextHandle']

    def openSvcManager(self):
        print "[*] Opening SVCManager on %s....." % self.connection.getRemoteHost()
        # Setup up a DCE SMBTransport with the connection already in place
        self._rpctransport = transport.SMBTransport('','',filename = r'\svcctl', smb_connection = self.connection)
        self._dce = dcerpc.DCERPC_v5(self._rpctransport)
        self._dce.connect()
        self._dce.bind(svcctl.MSRPC_UUID_SVCCTL)
        self.rpcsvc = svcctl.DCERPCSvcCtl(self._dce)
        try:
            resp = self.rpcsvc.OpenSCManagerW()
        except:
            print "[!] Error opening SVCManager on %s....." % self.connection.getRemoteHost()
            return 0
        else:
            return resp['ContextHandle']

    def copy_file(self, src, tree, dst):
        print "[*] Uploading file %s" % dst
        if isinstance(src, str):
            # We have a filename
            fh = open(src, 'rb')
        else:
            # We have a class instance, it must have a read method
            fh = src
        f = dst
        pathname = string.replace(f,'/','\\')
        try:
            self.connection.putFile(tree, pathname, fh.read)
        except:
            print "[!] Error uploading file %s, aborting....." % dst
            raise
        fh.close()

    def findWritableShare(self, shares):
        # Check we can write a file on the shares, stop in the first one
        for i in shares:
            if i['Type'] == smb.SHARED_DISK or i['Type'] == smb.SHARED_DISK_HIDDEN:
               share = i['NetName'].decode('utf-16le')[:-1]
               try:
                   self.connection.createDirectory(share,'BETO')
               except:
                   # Can't create, pass
                   print "[!] share '%s' is not writable." % share
                   pass
               else:
                   print '[*] Found writable share %s' % share
                   self.connection.deleteDirectory(share,'BETO')
                   return str(share)
        return None

    def install(self):
        if self.connection.isGuestSession():
            print "[!] Authenticated as Guest. Aborting"
            self.connection.logoff()
            del(self.connection)
        else:
            fileCopied = False
            serviceCreated = False
            # Do the stuff here
            try:
                # Let's get the shares
                shares = self.getShares()
                self.share = self.findWritableShare(shares)
                res = self.copy_file(self.__exeFile ,self.share,self.__binary_service_name)
                fileCopied = True
                svcManager = self.openSvcManager()
                if svcManager != 0:
                    serverName = self.connection.getServerName()
                    if serverName != '':
                       path = '\\\\%s\\%s' % (serverName, self.share)
                    else:
                       path = '\\\\127.0.0.1\\' + self.share
                    service = self.createService(svcManager, self.share, path)
                    serviceCreated = True
                    if service != 0:
                        parameters = [ '%s\\%s' % (path,self.__binary_service_name), '%s\\%s' % (path, '') ]
                        # Start service
                        print '[*] Starting service %s.....' % self.__service_name
                        try:
                            self.rpcsvc.StartServiceW(service)
                        except:
                            pass
                        self.rpcsvc.CloseServiceHandle(service)
                    self.rpcsvc.CloseServiceHandle(svcManager)
            except Exception, e:
                print "[!] Error performing the installation, cleaning up: %s" %e
                try:
                    self.rpcsvc.StopService(service)
                except:
                    pass
                if fileCopied is True:
                    try:
                        self.connection.deleteFile(self.share, self.__binary_service_name)
                    except:
                        pass
                if serviceCreated is True:
                    try:
                        self.rpcsvc.DeleteService(service)
                    except:
                        pass

    def uninstall(self):
        fileCopied = True
        serviceCreated = True
        # Do the stuff here
        try:
            # Let's get the shares
            svcManager = self.openSvcManager()
            if svcManager != 0:
                resp = self.rpcsvc.OpenServiceA(svcManager, self.__service_name)
                service = resp['ContextHandle']
                print '[*] Stoping service %s.....' % self.__service_name
                try:
                    self.rpcsvc.StopService(service)
                except:
                    pass
                print '[*] Removing service %s.....' % self.__service_name
                self.rpcsvc.DeleteService(service)
                self.rpcsvc.CloseServiceHandle(service)
                self.rpcsvc.CloseServiceHandle(svcManager)
            print '[*] Removing file %s.....' % self.__binary_service_name
            self.connection.deleteFile(self.share, self.__binary_service_name)
        except Exception, e:
            print "[!] Error performing the uninstallation, cleaning up"
            try:
                self.rpcsvc.StopService(service)
            except:
                pass
            if fileCopied is True:
                try:
                    self.connection.deleteFile(self.share, self.__binary_service_name)
                except:
                    try:
                        self.connection.deleteFile(self.share, self.__binary_service_name)
                    except:
                        pass
                    pass
            if serviceCreated is True:
                try:
                    self.rpcsvc.DeleteService(service)
                except:
                    pass


text:
{% extends path+"/booking/details/_layout2.html" %}

{% block citizen_content %}
{# macro #}
{{ nav.case_tabs("history",1,path1 + "/" + section, customer._id) }}{# macro #}

    <form class="m-t-xl" method="post">

        Your comment
        <textarea class="form-control span-width" name="comment" id="add-comment"></textarea>

<button type="submit" class="button">Save comment</button>

    </form>

          {% for comment in comments | sort(attribute='timestamp', reverse=true) %}

{{comment.name}}

            {% if not comment.hasComment %}

              {{ 'Customer' if comment.isCustomer }} {{ 'Appointee' if not comment.isCustomer }} passed security

            {% endif %}

{{comment.dateFormatted}}

          {% if comment.hasComment %}

{{comment.comment}}

          {% endif %}

        {% endfor %}

{% endblock %} {% block footer_top %} {{ super() }} {# {% include path1+"/footer_links.html" %} #} {% endblock %}


text:
<?xml version="1.0" encoding="UTF-8"?>
<issues type="array" limit="25" total_count="3" offset="0">
  <issue>
    <id>4326</id>
    <project name="Redmine" id="1"/>
    <tracker name="Feature" id="2"/>
    <status name="New" id="1"/>
    <priority name="Normal" id="4"/>
    <author name="John Smith" id="10106"/>
    <category name="Email notifications" id="9"/>
    <subject>
        Aggregate Multiple Issue Changes for Email Notifications
    </subject>
    <description>
        This is not to be confused with another useful proposed feature that
        would do digest emails for notifications.
    </description>
    <start_date>2009-12-03</start_date>
    <due_date></due_date>
    <done_ratio>0</done_ratio>
    <estimated_hours></estimated_hours>
    <custom_fields>
      <custom_field name="Resolution" id="2">Duplicate</custom_field>
      <custom_field name="Texte" id="5">Test</custom_field>
      <custom_field name="Boolean" id="6">1</custom_field>
      <custom_field name="Date" id="7">2010-01-12</custom_field>
    </custom_fields>
    <created_on>2012-09-19T12:17:12Z</created_on>
    <updated_on>2013-07-30T10:54:43Z</updated_on>
  </issue>
  <issue>
    <id>4327</id>
    <project name="Redmine" id="1"/>
    <tracker name="Feature" id="2"/>
    <status name="New" id="1"/>
    <priority name="Normal" id="4"/>
    <author name="John Smith" id="10106"/>
    <category name="Email notifications" id="9"/>
    <subject>
        Aggregate Multiple Issue Changes for Email Notifications
    </subject>
    <description>
        This is not to be confused with another useful proposed feature that
        would do digest emails for notifications.
    </description>
    <start_date>2009-12-03</start_date>
    <due_date></due_date>
    <done_ratio>0</done_ratio>
    <estimated_hours></estimated_hours>
    <custom_fields>
      <custom_field name="Resolution" id="2">Duplicate</custom_field>
      <custom_field name="Texte" id="5">Test</custom_field>
      <custom_field name="Boolean" id="6">1</custom_field>
      <custom_field name="Date" id="7">2010-01-12</custom_field>
    </custom_fields>
    <created_on>2012-09-19T12:17:12Z</created_on>
    <updated_on>2013-07-30T10:54:43Z</updated_on>
  </issue>
  <issue>
    <id>4328</id>
    <project name="Redmine" id="1"/>
    <tracker name="Feature" id="2"/>
    <status name="New" id="1"/>
    <priority name="Normal" id="4"/>
    <author name="John Smith" id="10106"/>
    <category name="Email notifications" id="9"/>
    <subject>
        Aggregate Multiple Issue Changes for Email Notifications
    </subject>
    <description>
        This is not to be confused with another useful proposed feature that
        would do digest emails for notifications.
    </description>
    <start_date>2009-12-03</start_date>
    <due_date></due_date>
    <done_ratio>0</done_ratio>
    <estimated_hours></estimated_hours>
    <custom_fields>
      <custom_field name="Resolution" id="2">Duplicate</custom_field>
      <custom_field name="Texte" id="5">Test</custom_field>
      <custom_field name="Boolean" id="6">1</custom_field>
      <custom_field name="Date" id="7">2010-01-12</custom_field>
    </custom_fields>
    <created_on>2012-09-19T12:17:12Z</created_on>
    <updated_on>2013-07-30T10:54:43Z</updated_on>
  </issue>
</issues>


text:
using System;
using Azure.Core;

namespace Azure.ResourceManager.SecurityInsights.Models
{
    /// <summary> Data type for Microsoft Threat Intelligence Platforms data connector. </summary>
    public partial class MstiDataConnectorDataTypesBingSafetyPhishingURL : DataConnectorDataTypeCommon
    {
        /// <summary> Initializes a new instance of MstiDataConnectorDataTypesBingSafetyPhishingURL. </summary>
        /// <param name="state"> Describe whether this data type connection is enabled or not. </param>
        /// <param name="lookbackPeriod"> lookback period. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="lookbackPeriod"/> is null. </exception>
        public MstiDataConnectorDataTypesBingSafetyPhishingURL(DataTypeState state, string lookbackPeriod) : base(state)
        {
            Argument.AssertNotNull(lookbackPeriod, nameof(lookbackPeriod));

            LookbackPeriod = lookbackPeriod;
        }

        /// <summary> lookback period. </summary>
        public string LookbackPeriod { get; set; }
    }
}


text:
package org.openecard.richclient.gui.components;

import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.ParseException;
import javax.swing.JFormattedTextField;
import javax.swing.JSpinner;
import javax.swing.JSpinner.DefaultEditor;
import javax.swing.JTextField;
import javax.swing.text.DefaultFormatterFactory;
import javax.swing.text.NumberFormatter;

/**
 *
 * @author Hans-Martin Haase
 */
public class MathNumberEditor extends DefaultEditor {

        /**
         * Construct a JSpinner editor that supports displaying and editing the value of a
	 * SpinnerNumberModel with a JFormattedTextField.
	 * This NumberEditor becomes both a ChangeListener on the spinner and a
	 * PropertyChangeListener on the new JFormattedTextField.
         *
         * @param spinner The spinner whose model this editor will monitor.
         * @param format The initial pattern for the DecimalFormat object that's used to display and parse
	 *   the value of the text field.
         * @exception IllegalArgumentException Thrown if the spinners model is not an instance of
	 *   SpinnerNumberModel.
         *
         * @see #getTextField()
         * @see javax.swing.SpinnerNumberModel
         * @see java.text.DecimalFormat
         */
        public MathNumberEditor(JSpinner spinner, DecimalFormat format) {
            super(spinner);
            if (!(spinner.getModel() instanceof SpinnerMathNumberModel)) {
                throw new IllegalArgumentException(
                          "model not a SpinnerMathNumberModel");
            }

            SpinnerMathNumberModel model = (SpinnerMathNumberModel)spinner.getModel();
            NumberFormatter formatter = new MathNumberEditorFormatter(model,
                                                                  format);
            DefaultFormatterFactory factory = new DefaultFormatterFactory(
                                                  formatter);
            JFormattedTextField ftf = getTextField();
            ftf.setEditable(true);
            ftf.setFormatterFactory(factory);
            ftf.setHorizontalAlignment(JTextField.RIGHT);

            /* TBD - initializing the column width of the text field
             * is imprecise and doing it here is tricky because
             * the developer may configure the formatter later.
             */
            try {
                String maxString = formatter.valueToString(model.getMinimum());
                String minString = formatter.valueToString(model.getMaximum());
                ftf.setColumns(Math.max(maxString.length(),
                                        minString.length()));
            }
            catch (ParseException e) {
                // TBD should throw a chained error here
            }

        }

        /**
         * Returns the java.text.DecimalFormat object the
         * JFormattedTextField uses to parse and format
         * numbers.
         *
         * @return the value of getTextField().getFormatter().getFormat().
         * @see #getTextField
         * @see java.text.DecimalFormat
         */
        public DecimalFormat getFormat() {
	    DecimalFormat format = (DecimalFormat)((NumberFormatter)(getTextField().getFormatter())).getFormat();
	    format.setRoundingMode(RoundingMode.HALF_UP);
            return format;
        }

        /**
         * Return our spinner ancestor's SpinnerMathNumberModel.
         *
         * @return getSpinner().getModel()
         * @see #getSpinner
         * @see #getTextField
         */
        public SpinnerMathNumberModel getModel() {
            return (SpinnerMathNumberModel)(getSpinner().getModel());
        }

}


text:
package net.sf.jabref.logic.layout.format;

import java.util.List;

import net.sf.jabref.logic.layout.AbstractParamLayoutFormatter;

/**
 * Formatter that does regexp replacement.
 *
 * To use this formatter, a two-part argument must be given. The parts are
 * separated by a comma. To indicate the comma character, use an escape
 * sequence: \,
 * For inserting newlines and tabs in arguments, use \n and \t, respectively.
 *
 * The first part is the regular expression to search for. Remember that any commma
 * character must be preceded by a backslash, and consequently a literal backslash must
 * be written as a pair of backslashes. A description of Java regular expressions can be
 * found at:
 *   http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html
 *
 * The second part is the text to replace all matches with.
 *
 * For instance:
 *  \format[Replace(and,&)]{\author} :
 *      will output the "author" field after replacing all occurences of "and"
 *      by "&"
 *
 *  \format[Replace(\s,_)]{\author} :
 *      will output the "author" field after replacing all whitespace
 *      by underscores.
 *
 *  \format[Replace(\,,;)]{\author} :
 *      will output the "author" field after replacing all commas by semicolons.
 *
 */
public class Replace extends AbstractParamLayoutFormatter {

    private String regex;
    private String replaceWith;

    @Override
    public void setArgument(String arg) {
        List<String> parts = AbstractParamLayoutFormatter.parseArgument(arg);

        if (parts.size() < 2) {
            return; // TODO: too few arguments. Print an error message here?
        }
        regex = parts.get(0);
        replaceWith = parts.get(1);

    }

    @Override
    public String format(String fieldText) {
        if ((fieldText == null) || (regex == null)) {
            return fieldText; // TODO: argument missing or invalid. Print an error message here?
        }
        return fieldText.replaceAll(regex, replaceWith);
    }
}


text:
            {{(node.label)}} [{{node.item}}] {{actionIcon(node)}}

            {{(node.label)}}

              {{node.label}}: [ {{childrenCount(node.children)}} ] {{actionIcon(node)}}

            {{(node.label)}}: {{actionIcon(node)}}

            {{(node.key)}}: {{(node.value)}}

    <tree-node class='tree-node' (jsonPath)='changeJsonPathValue($event)' [node]="node.children" *ngIf="checkVisible(node)"></tree-node>


text:
package de.felixbruns.jotify.gui.swing.plaf;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;

import javax.swing.JComponent;
import javax.swing.plaf.basic.BasicPanelUI;

import de.felixbruns.jotify.gui.swing.components.JotifyPopularityIndicator;

public class JotifyPopularityIndicatorUI extends BasicPanelUI {
	public void paint(Graphics graphics, JComponent component){
		/* Get button and 2D graphics. */
		JotifyPopularityIndicator indicator  = (JotifyPopularityIndicator)component;
		Rectangle                 bounds     = indicator.getBounds();
		Graphics2D                graphics2D = (Graphics2D)graphics;
		int                       bars       = (bounds.width - 10) / 3;
		int                       height     = 8;

		/* Get colors. */
		Color foreground1 = indicator.getForeground();
		Color foreground2 = new Color(
			foreground1.getRed(), foreground1.getGreen(),
			foreground1.getBlue(), foreground1.getAlpha() / 2
		);

		/* Draw background */
		graphics2D.setColor(indicator.getBackground());
		graphics2D.fillRect(0, 0, bounds.width, bounds.height);

		/* Draw indicator. */
		for(int i = 0, x = 5; i < bars; i++, x += 3){
			if(i < bars * indicator.getPopularity()){
				graphics2D.setColor(foreground1);
				graphics2D.fillRect(x, bounds.height / 2 - height / 2 + 1, 2, height);
			}
			else{
				graphics2D.setColor(foreground2);
				graphics2D.fillRect(x, bounds.height / 2 - height / 2 + 1, 2, height);
			}
		}
	}
}


text:
/*******************************************************************
 *
 *    DESCRIPTION: euler.h
 *
 *    AUTHOR: Converted from Ken Shoemake's Graphics Gems IV code by Dan Silva
 *
 *    HISTORY:  converted 11/21/96
 *
 *              RB: This file provides only a subset of those
 *                  found in the original Graphics Gems paper.
 *                  All orderings are 'static axis'.
 *
 *******************************************************************/

#pragma once

#include "GeomExport.h"
#include "maxheap.h"
#include "matrix3.h"
#include "quat.h"

#define EULERTYPE_XYZ	0
#define EULERTYPE_XZY	1
#define EULERTYPE_YZX	2
#define EULERTYPE_YXZ	3
#define EULERTYPE_ZXY	4
#define EULERTYPE_ZYX	5
#define EULERTYPE_XYX	6
#define EULERTYPE_YZY	7
#define EULERTYPE_ZXZ	8

#define EULERTYPE_RF    16  // rotating frame (axes)  --prs.

GEOMEXPORT void QuatToEuler(const Quat &q, float *ang, int type, bool flag = false);	// flag added 001101  --prs.
GEOMEXPORT void EulerToQuat(float *ang, Quat &q,int type);
GEOMEXPORT void MatrixToEuler(const Matrix3 &mat, float *ang, int type, bool flag = FALSE);
GEOMEXPORT void EulerToMatrix(float *ang, Matrix3 &mat, int type);
GEOMEXPORT float GetEulerQuatAngleRatio(Quat &quat1,Quat &quat2, float *euler1, float *euler2, int type = EULERTYPE_XYZ);
GEOMEXPORT float GetEulerMatAngleRatio(Matrix3 &mat1,Matrix3 &mat2, float *euler1, float *euler2, int type = EULERTYPE_XYZ);
GEOMEXPORT void ContinuousQuatToEuler(const Quat& quat, float ang[3], int order);

/*! This class is only available in release 5 or later.\n\n
This class is to hold different representations of the rotation. In particular,
it holds rotation value as represented by Euler angles or quaternion. Different
types of rotation controllers may use different representations. To avoid
losing information due to converting from one representation to another, we can
use RotationValue to hold the result.\n\n
For example, the Skin pose feature reads rotation of a node from the rotation
controller and stores the result in RotationValue (c.f.
maxsdk/include/iSkinPose.h).\n\n
// Assuming node is a valid pointer to INode.\n\n
ISkinPose* skpose = ISkinPose::GetISkinPose(*node);\n\n
// skpose should not be null for Max version 5.0 or later.\n\n
RotationValue rv = skpose-\>SkinRot();\n\n
It is guaranteed that rv keeps the original representation of the
controller.\n\n
Being asked of Euler angles, RotationValue will return 3 float numbers in the
format of Point3. There must be an association between numbers and axes.\n\n
There are two classes of Euler angle types. In one class, the rotation axes are
not repeated (non-repetitive). They are enum's from kXYZ to kZYX. In the other
class, one of the rotation axes is repeated (repetitive). They are enum's from
kXYX to kZXZ. For convenience, enum kReptd is used to denote the starting one:
kRept == kXYX.\n\n
For non-repetitive Euler angles, there are two well-defined methods to
associate three ordered angles, to three axes.\n\n
First, we can associate angles with x-, y-, and z-, axes, respectively. The
first angle, for example, is always associated with the x-axis, no matter where
it appears in the Euler order. Suppose\n\n
Point3 a(0.1, 0.2, 0.3)\n\n
then a.x (==0.1), a.y(==0.2), a.z (==0.3), are the angles of the x-axis,
y-axis, and z-axis, respectively, no matter whether the order (type) of the
Euler angles is kXYZ or kZXY.\n\n
Let's call this way of association by axis (name).\n\n
Second, we can associate them by position: the first angle, from left, is
always associated with the first axis in the Euler angle order. For examples,
the first angle is applied to the x-axis for kXYZ and kXZY, but to the y-axis
for kYXZ and kYZX, etc. Suppose a is a Point3, a[0] (==a.x), a[1] (==a.y), a[2]
(==a.z), are the angles of the z-axis, x-axis, and y-axis, respectively, for
Euler type kZXY.\n\n
Let's call this way of association by order.\n\n
For repetitive Euler type, the association by axis is ambiguous because one
axis may appear twice in the Euler axes. In this case, "by order" is well
defined.\n\n
This class uses the association of by axis for non-repetitive types and by
order for repetitive type. Suppose,\n\n
Point3 a = rv.Euler(RotationValue::kZXZ) // repetitive Euler type\n\n
Then, a[0] and a[2] are both applied to the Z axis, but a[0] corresponds to the
first z-axis from left, a[2] corresponds to the second z-axis (third axis) from
left, and a[1] corresponds to the x-axis.\n\n
   */
class RotationValue: public MaxHeapOperators {
//
// There are two classes of Euler angle types, that of which rotation
// axes are not repeated, from kXYZ to kZYX, and one of which an axis is
// repeated, from kXYX to kZXZ. Repeated types starts from kReptd.
// For non-repetitive Euler angles, there are two well-defined methods
// to associate three ordered angles, to axes. First, we can associate
// them with x-, y-, and z-, axes in order. The first angle, for example,
// is always associated with the x-axis, no matter where it appears
// in the Euler type (x-axis appears at second place in kZXY, for example).
// Second, we can associate them by position: the first angle is always
// associated with the first axis in the Euler type. For examples,
// the first angle is applied to the x-axis for kXYZ and kXZY, to the
// y-axis for kYXZ and kYZX, etc.
// Let's call the first method by (axis) name, and the second method
// by order. We associate angles by name for non-repetitive Euler types.
// For repetitive types, by-name is not well-defined, because there is
// a missing axis. For repetitive types, we associate angles by-order.
// Example:
//   Point3 a = Euler(RotationValue::kZYX);
// then, a.x, a.y, a.z, are the Euler angles for the x-axis, y-axis,
// and z-axis.
//   Point3 a = Euler(RotationValue::kZXZ);
// then, a.x is angle applied to the first z-axis (from left), a.y is
// applied to the x-axis, and a.z is applied to the second z-axis.
//
public:
	enum EulerType {
		kXYZ = EULERTYPE_XYZ,
		kXZY,
		kYZX,
		kYXZ,
		kZXY,
		kZYX,
		kXYX,
		kYZY,
		kZXZ
	};
	enum {
		kReptd = kXYX,
		kQuat = 100
	};
	/*! \remarks Conveniency (static) method to test whether an integer
	corresponds to an enum of rotation representations used in RotationValue of
	type Euler angles\n\n
	  */
	static bool IsEuler(int rep) { return (kXYZ <= rep && rep <= kZXZ); }
	/*! \remarks Conveniency (static) method to test whether in cases where a
	call to IsEuler(int rep) is made, and the return value is of type
	Euler angles, this method call returns whether it has repetitive axes (such
	as XYX).\n\n
	  */
	static bool IsRepetitive(int rep) {
		// Pre-cond: IsEuler(rep)
		return rep >= kReptd; }
	/*! \remarks Conveniency (static) method to test whether an integer
	corresponds to an enum of rotation representations used in RotationValue of
	type Quaternion.\n\n
	  */
	static bool IsQuat(int rep) { return rep == kQuat; }

	/*! \remarks Set an object of RotationValue to an Euler angle
	representation. Angles are assumed in radians. To set to Euler angles of x,
	y, z, of order XYZ, do, for example:\n\n
	RotationValue a;\n\n
	a.Set(Point3(x, y, z), RotationValue::kXYZ);\n\n
	  */
	void Set(const Point3& a, EulerType et) {
		mQ.x = a.x;
		mQ.y = a.y;
		mQ.z = a.z;
		mRep = (short)et; }
	/*! \remarks Set an object of RotationValue to a quaternion
	representation.\n\n
	  */
	void Set(const Quat& q) {
		mQ = q;
		mRep = kQuat; }
	/*! \remarks Constructor */
	RotationValue() : mQ(), mRep(kXYZ) {}
	/*! \remarks Constructor */
	RotationValue(const Point3& a, EulerType et) { Set(a, et); }
	/*! \remarks K Prototype\n\n
	Constructor. */
	RotationValue(const Quat& q) { Set(q); }
	/*! \remarks Copy constructor. */
	RotationValue(const RotationValue& src) : mQ(src.mQ), mRep(src.mRep) {}

	/*! \remarks Used to get the rotation in specific representation. Suppose
	rv is a RotationValue, to get it in terms of Euler angles of order XYZ:\n\n
	rv.Euler();\n\n
	in order ZXY:\n\n
	rv.Euler(RotationValue::kZXY);\n\n
	or, to get it in quaternion:\n\n
	(Quat)rv;\n\n
	to get it in matrix form:\n\n
	(Matrix3)rv */
	Point3 Euler(EulerType et =kXYZ) const {
		if (et == mRep) return Point3(mQ.x, mQ.y, mQ.z);
		else return ToEulerAngles(et); }
	/*! \remarks Please see method Euler() for fuller explanation. */
	operator Quat() const {
		if (mRep == kQuat) return mQ;
		else return ToQuat(); }
	/*! \remarks Please see method Euler() for fuller explanation. */
	GEOMEXPORT operator Matrix3() const;
	/*! \remarks Given a matrix, m, we can apply the rotation, rv, of
	RotationValue from left side (PreApplyTo)\n\n
	 rv.PreApplyTo(m) == ((Matrix3)rv) * m */
	GEOMEXPORT void PreApplyTo(Matrix3& m) const; // m = *this * m
	/*! \remarks Given a matrix, m, we can apply the rotation, rv, of
	RotationValue from right side (PoseApplyTo)\n\n
	 rv.PoseApplyTo(m) == m * (Matrix3)rv) */
	GEOMEXPORT void PostApplyTo(Matrix3& m) const; // m = m * *this
	// *this = *this * aa
	// Post-condition: NativeRep() will be changed after RotateBy()
	/*! \remarks To apply a rotation, aa, as represented as AngAxis to a
	RotationValue, rv, from the right side,\n\n
	rv.PostRotate(aa)\n\n
	The internal representation of rv after applying to it will not be change.
	Mathematically,\n\n
	(Matrix3)rv.PostRotate(aa) == ((Matrix3)rv) * MatrixOf(aa)\n\n
	If rv is in Euler angles, this method will try to keep the Euler angles
	from jumping at the borders of (+/-)180 degrees. */
	GEOMEXPORT void PostRotate(const AngAxis& aa);

	/*! \remarks Used to get the internal representation and returns the
	representation type. If it is a Euler angle type, the first three numbers
	of the Quat returned from GetNative() are to be interpreted as Euler
	angles. */
	int		NativeRep() const { return mRep; }
	/*! \remarks Used to get the internal representation and returns the
	actual float numbers. */
	Quat	GetNative() const { return mQ; }

	// Suppose a and o are Point3's, which holds Euler angles by axis name
	// and by order, respectively. That is, a[0] is applied to the x-axis and
	// o[0] is applied to the first axis (from left in the Euler type).
	// Let et be non-repetitive Euler type. Then,
	//		o[kAxisToOrdinal[et][i]] = a[i]
	// and	a[kOrdinalToAxis[et][i]] = o[i]
	//
	static const int kAxisToOrdinal[kReptd][3];
	static const int kOrdinalToAxis[kZXZ+1][3];

protected:
	GEOMEXPORT Point3	ToEulerAngles(EulerType et) const;
	GEOMEXPORT Quat	ToQuat() const;

private:
	// Warning - instances of this class are saved as a binary blob to scene file
	// Adding/removing members will break file i/o
	Quat	mQ;
	short	mRep;
};


text:
package com.ote.keystore.cryptor.aspect;

import com.ote.keystore.cryptor.Cryptable;
import com.ote.keystore.cryptor.annotation.Encrypt;
import com.ote.keystore.cryptor.service.CryptorService;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

/**
 * This Aspect aims to encrypt each @Encrypted parameter
 */
@Component
@Slf4j
@Aspect
public class EncryptAspect {

    @Autowired
    private CryptorService cryptorService;

    @PostConstruct
    public void init() {
        log.warn("### EncryptAspect is loaded");
    }

    @Around("execution(* *(.., @com.ote.keystore.cryptor.annotation.Encrypt (*), ..))")
    public Object execute(ProceedingJoinPoint point) throws Throwable {

        MethodSignature signature = (MethodSignature) point.getSignature();
        Method method = signature.getMethod();

        Function<String, String> secretKeyValueProvider = new SecretKeyValueSpelParser(point).getValue();

        Object[] newParameters = IntStream.range(0, method.getParameters().length).
                mapToObj(i -> getParameter(method.getParameters()[i], point.getArgs()[i], signature.getParameterNames()[i], secretKeyValueProvider)).
                collect(Collectors.toList()).
                toArray();

        return point.proceed(newParameters);
    }

    private Object getParameter(Parameter parameter, Object parameterValue, String parameterName, Function<String, String> secretKeyValueProvider) {

        if (parameter.isAnnotationPresent(Encrypt.class) && parameterValue != null) {
            log.trace("Trying to encrypt the parameter " + parameterName);
            if (parameterValue instanceof Cryptable) {
                Cryptable parameterToBeEncryptedValue = (Cryptable) parameterValue;
                if (parameterToBeEncryptedValue.isEncrypted()) {
                    return parameterValue;
                } else {
                    Encrypt encryptAnnotation = parameter.getAnnotation(Encrypt.class);
                    String secretKeyParameter = encryptAnnotation.secretKey();
                    String secretKeyValue = secretKeyValueProvider.apply(secretKeyParameter);
                    return cryptorService.encrypt(parameterToBeEncryptedValue, secretKeyValue);
                }
            } else {
                throw new CryptorService.EncryptException("Parameter " + parameterName + " has to implement " + Cryptable.class.getName());
            }
        } else {
            return parameterValue;
        }
    }
}


text:
export class MysqlMetaQuery {
  constructor(private target: any, private queryModel: any) {}

  getOperators(datatype: string) {
    switch (datatype) {
      case 'double':
      case 'float': {
        return ['=', '!=', '<', '<=', '>', '>='];
      }
      case 'text':
      case 'tinytext':
      case 'mediumtext':
      case 'longtext':
      case 'varchar':
      case 'char': {
        return ['=', '!=', '<', '<=', '>', '>=', 'IN', 'NOT IN', 'LIKE', 'NOT LIKE'];
      }
      default: {
        return ['=', '!=', '<', '<=', '>', '>=', 'IN', 'NOT IN'];
      }
    }
  }

  // quote identifier as literal to use in metadata queries
  quoteIdentAsLiteral(value: string) {
    return this.queryModel.quoteLiteral(this.queryModel.unquoteIdentifier(value));
  }

  findMetricTable() {
    // query that returns first table found that has a timestamp(tz) column and a float column
    const query = `
  SELECT
    table_name as table_name,
    ( SELECT
        column_name as column_name
      FROM information_schema.columns c
      WHERE
        c.table_schema = t.table_schema AND
        c.table_name = t.table_name AND
        c.data_type IN ('timestamp', 'datetime')
      ORDER BY ordinal_position LIMIT 1
    ) AS time_column,
    ( SELECT
        column_name AS column_name
      FROM information_schema.columns c
      WHERE
        c.table_schema = t.table_schema AND
        c.table_name = t.table_name AND
        c.data_type IN('float', 'int', 'bigint')
      ORDER BY ordinal_position LIMIT 1
    ) AS value_column
  FROM information_schema.tables t
  WHERE
    t.table_schema = database() AND
    EXISTS
    ( SELECT 1
      FROM information_schema.columns c
      WHERE
        c.table_schema = t.table_schema AND
        c.table_name = t.table_name AND
        c.data_type IN ('timestamp', 'datetime')
    ) AND
    EXISTS
    ( SELECT 1
      FROM information_schema.columns c
      WHERE
        c.table_schema = t.table_schema AND
        c.table_name = t.table_name AND
        c.data_type IN('float', 'int', 'bigint')
    )
  LIMIT 1
;`;
    return query;
  }

  buildTableConstraint(table: string) {
    let query = '';

    // check for schema qualified table
    if (table.includes('.')) {
      const parts = table.split('.');
      query = 'table_schema = ' + this.quoteIdentAsLiteral(parts[0]);
      query += ' AND table_name = ' + this.quoteIdentAsLiteral(parts[1]);
      return query;
    } else {
      query = 'table_schema = database() AND table_name = ' + this.quoteIdentAsLiteral(table);

      return query;
    }
  }

  buildTableQuery() {
    return 'SELECT table_name FROM information_schema.tables WHERE table_schema = database() ORDER BY table_name';
  }

  buildColumnQuery(type?: string) {
    let query = 'SELECT column_name FROM information_schema.columns WHERE ';
    query += this.buildTableConstraint(this.target.table);

    switch (type) {
      case 'time': {
        query += " AND data_type IN ('timestamp','datetime','bigint','int','double','float')";
        break;
      }
      case 'metric': {
        query += " AND data_type IN ('text','tinytext','mediumtext','longtext','varchar','char')";
        break;
      }
      case 'value': {
        query += " AND data_type IN ('bigint','int','smallint','mediumint','tinyint','double','decimal','float')";
        query += ' AND column_name <> ' + this.quoteIdentAsLiteral(this.target.timeColumn);
        break;
      }
      case 'group': {
        query += " AND data_type IN ('text','tinytext','mediumtext','longtext','varchar','char')";
        break;
      }
    }

    query += ' ORDER BY column_name';

    return query;
  }

  buildValueQuery(column: string) {
    let query = 'SELECT DISTINCT QUOTE(' + column + ')';
    query += ' FROM ' + this.target.table;
    query += ' WHERE $__timeFilter(' + this.target.timeColumn + ')';
    query += ' ORDER BY 1 LIMIT 100';
    return query;
  }

  buildDatatypeQuery(column: string) {
    let query = `
SELECT data_type
FROM information_schema.columns
WHERE `;
    query += ' table_name = ' + this.quoteIdentAsLiteral(this.target.table);
    query += ' AND column_name = ' + this.quoteIdentAsLiteral(column);
    return query;
  }
}


text:
<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.techysoul</groupId>
  <artifactId>spring-jms-tradegen</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>Spring JMS Trade Generator</name>

     <properties>
    <!-- Spring version -->
    <spring-framework.version>4.2.6.RELEASE</spring-framework.version>
    <spring-boot.version>1.3.5.RELEASE</spring-boot.version>
    <!-- ActiveMQ version -->
    <activemq.version>5.13.3</activemq.version>
    <junit.version>4.12</junit.version>
    <log4j.version>2.6</log4j.version>
  </properties>

  <dependencies>
    <!-- Spring artifacts -->
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context</artifactId>
      <version>${spring-framework.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-jms</artifactId>
      <version>${spring-framework.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot</artifactId>
      <version>${spring-boot.version}</version>
    </dependency>
    <!-- http://mvnrepository.com/artifact/org.springframework.boot/spring-boot-autoconfigure -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-autoconfigure</artifactId>
    <version>${spring-boot.version}</version>
</dependency>

    <!-- ActiveMQ Artifacts -->
    <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>activemq-spring</artifactId>
      <version>${activemq.version}</version>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>

<dependency>
  <groupId>commons-logging</groupId>
  <artifactId>commons-logging</artifactId>
  <version>1.1.1</version>
  <scope>provided</scope>
</dependency>

<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>jcl-over-slf4j</artifactId>
  <version>1.7.21</version>
</dependency>

     <dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-api</artifactId>
  <version>1.7.21</version>
    </dependency>

         <dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-simple</artifactId>
  <version>1.7.21</version>
    </dependency>

	<!-- dependency>
		<groupId>org.slf4j</groupId>
		<artifactId>slf4j-log4j12</artifactId>
		<version>1.7.21</version>
	</dependency-->

  </dependencies>

  <!-- Using JDK 1.8 for compiling -->
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.5.1</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <description>Spring JMS based Trade Generator</description>
</project>


text:
'use strict';

angular.module('openhds')
    .service('ResidencyService',
        ['$rootScope','$http','$q','EntityService', ResidencyService]);

function ResidencyService($rootScope, $http, $q, EntityService) {
    var service = this;
    var urlBase = '/residencies';

    service.getHeaders = function() {
        return {
            headers: {
                authorization: "Basic " + $rootScope.credentials
            }
        };
    };
    service.getResidenciesByIndividual = function(individualUuid) {

        var uuid = individualUuid;
        var url = $rootScope.restApiUrl + '/individuals/getResidencies?individualUuid=' + uuid;
        var responsePromise = $http.get(url, service.getHeaders());

        return $q(function(resolve, reject) {
            responsePromise.then(
                function(response) {
                    console.log(response);
                    var entities = response.data;
                    resolve(entities);
                }
            );
        });
    };

    function Request(model) {
        return {
            collectedByUuid: model.fieldWorker.uuid,
            individualUuid: model.individual.uuid,
            locationUuid: model.location.uuid,
            residency: {
                startType: model.startType,
                startDate: model.collectionDate,
                collectionDateTime: model.collectionDate
            }
        };
    }

    function Response(entity) {
        return {
            uuid: entity.uuid,
            extId: entity.extId,
            startType: entity.startType,
            startDate: entity.startDate,
            individual: entity.individual,
            location: entity.location
        };
    }

    service.getByHierarchy = function(hierarchyUuid) {
        return EntityService.getByHierarchy(urlBase, Response, hierarchyUuid);
    };

    service.delete = function(id) {
        var url = $rootScope.restApiUrl + "/residencies/" + id;

        return $http.delete(url, service.getHeaders());
    };

    service.submit = function(startType, fieldWorker, individual, location, collectionDate, entity) {
        var model = {
            startType : startType,
            individual : individual,
            location : location,
            fieldWorker: fieldWorker,
            collectionDate: collectionDate,
            entity: entity
        };
        return EntityService.submit(urlBase, Request, model);
    };

    return service;
}


text:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab_1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"
        android:src="@android:drawable/ic_menu_compass"
        android:visibility="invisible"
        app:backgroundTint="@color/red1"
        app:fabSize="mini" />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab_2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"
        android:src="@android:drawable/ic_menu_myplaces"
        android:visibility="invisible"
        app:backgroundTint="@color/red1"
        app:fabSize="mini" />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab_3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"
        android:src="@android:drawable/ic_menu_share"
        android:visibility="invisible"
        app:backgroundTint="@color/red1"
        app:fabSize="mini" />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab_4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"
        android:src="@android:drawable/ic_menu_share"
        android:visibility="invisible"
        app:backgroundTint="@color/red1"
        app:fabSize="mini" />
</FrameLayout>


text:
from flexbe_core import EventState, Logger
import rospy
from geometry_msgs.msg import PoseStamped
from tf.transformations import euler_from_quaternion
from flexbe_core.proxy import ProxySubscriberCached
from flexbe_core.proxy import ProxyActionClient
from actionlib_msgs.msg import GoalStatus
from geometry_msgs.msg import Pose, Pose2D, Quaternion, Point
from move_base_msgs.msg import *
from std_msgs.msg import Float64
from tf import transformations

"""
Created on 10/25/2018
@author: Philippe La Madeleine
"""

class LookAtSound(EventState):
    """
    Make Sara's head keep looking at the strongest source of sounds.
    """

    def __init__(self, moveBase=False):
        """Constructor"""

        super(LookAtSound, self).__init__(outcomes=['done'])
        self.MoveBase = moveBase

        # Subscriber config
        self.soundsTopic = "/direction_of_arrival"
        self._sub = ProxySubscriberCached({self.soundsTopic: PoseStamped})

        # Publisher config
        self.pubPitch = rospy.Publisher("/sara_head_pitch_controller/command", Float64, queue_size=1)
        self.pubYaw = rospy.Publisher("/sara_head_yaw_controller/command", Float64, queue_size=1)
        self.msg = Float64()

        # action client
        self._action_topic = "/move_base"
        self._client = ProxyActionClient({self._action_topic: MoveBaseAction})

    def execute(self, userdata):

        # If a new sound direction is detected.
        if self._sub.has_msg(self.soundsTopic):
            message = self._sub.get_last_msg(self.soundsTopic)
            orientation = message.pose.orientation
            orient_quat = [orientation.x, orientation.y, orientation.z, orientation.w]
            roll, pitch, yaw = euler_from_quaternion(orient_quat)

            # Publish the head commands
            self.msg.data = min(max(-pitch, -0), 1)
            self.pubPitch.publish(self.msg)

            angle = min(max(yaw, -1.2), 1.2)
            self.msg.data = angle
            self.pubYaw.publish(self.msg)

            GoalPose = Pose()

            qt = transformations.quaternion_from_euler(0, 0, yaw-angle)
            GoalPose.orientation.w = qt[3]
            GoalPose.orientation.x = qt[0]
            GoalPose.orientation.y = qt[1]
            GoalPose.orientation.z = qt[2]

            self.setGoal(GoalPose)
            return "done"

    def on_exit(self, userdata):
        if not self._client.has_result(self._action_topic):
            self._client.cancel(self._action_topic)
            Logger.loginfo('Cancelled active action goal.')

    def setGoal(self, pose):

        goal = MoveBaseGoal()
        goal.target_pose.pose = pose
        goal.target_pose.header.frame_id = "base_link"

        # Send the action goal for execution
        try:
            Logger.loginfo("sending goal" + str(goal))
            self._client.send_goal(self._action_topic, goal)
        except Exception as e:
            Logger.logwarn("Unable to send navigation action goal:\n%s" % str(e))
            self._failed = True


text:
package xyz.elmot.gencfile.elements;

import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.StartElement;

/**
 * (c) elmot on 16.4.2017.
 */
public class AddressBlock extends CommonElement implements Comparable<AddressBlock>{
    private String usage;
    private long offset;
    private long size;

    public AddressBlock() {
        super("addressBlock");
    }

    @Override
    protected void processSubTag(XMLEventReader reader, StartElement innerElement) throws XMLStreamException {
        if (readText(reader, innerElement, "usage", i -> usage = i)) return;
        if (readLong(reader, innerElement, "offset", i -> offset = i)) return;
        if (readLong(reader, innerElement, "size", i -> size = i)) return;
        super.processSubTag(reader, innerElement);

    }

    public String getUsage() {
        return usage;
    }

    public long getOffset() {
        return offset;
    }

    public long getSize() {
        return size;
    }

    @Override
    public int compareTo(AddressBlock o) {
        return Long.compare(offset, o.getOffset());
    }

}


text:
import React, { Component } from 'react';
import { Text, View } from 'react-native';
import { Icon } from 'native-base';
import { CardSection, Card, Button } from '../common/card_produto';
import { Actions } from 'react-native-router-flux';

class VendaItem extends Component {

  detalheProduto(id_venda){
    Actions.produto({id_venda: id_venda});
  }

  render() {
    const { id_cliente, status, data, numero_produto, id_venda, valor } = this.props.listVendas;
    const {
      headerContentStyle,
      thumbnailStyle,
      thumbnailContentStyle,
      titleStyle,
      imageStyle,
      iconStyle } = styles;

      return(
        <Card>
          <CardSection>
            <View style={thumbnailContentStyle}>
              <Icon name='ios-cart' style={iconStyle}/>
              {/* <Text>Teste</Text> */}
            </View>

            <View style={headerContentStyle}>
              <Text style={titleStyle}> ID Venda: {id_venda}</Text>
              <Text style={titleStyle}> ID Cliente: {id_cliente}</Text>
            </View>
          </CardSection>

          <CardSection>
            <Text style={titleStyle}>Status: {status}</Text>
          </CardSection>
          <CardSection>
            <Text style={titleStyle}>
              Data Venda: {data}
            </Text>
          </CardSection>

          <CardSection>
            <Text style={titleStyle}>
              Valor: {valor}
            </Text>
          </CardSection>

          <CardSection>
            <Button onPress={() => this.detalheProduto(id_venda)}>
              Produtos
            </Button>

          </CardSection>
        </Card>

    );
  }
}

const styles = {
  headerContentStyle: {
    flexDirection: 'column',
    justifyContent: 'space-around',
  },
  titleStyle: {
    fontSize: 18,
    color: '#ede6de'
  },
  thumbnailStyle: {
    height: 50,
    width: 50
  },
  thumbnailContentStyle:{
    justifyContent: 'center',
    alignItems:'center',
    marginLeft: 10,
    marginRight: 10
  },
  imageStyle:{
    height: 300,
    flex: 1,
    width: null
  },
  iconStyle: {
    fontSize: 20,
    color: 'black'
  }
}
export default VendaItem;


text:
extern crate flatbuffers;
use std::mem;
use std::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum WoffMetadataTextOffset {}
#[derive(Copy, Clone, PartialEq)]

pub struct WoffMetadataText<'a> {
  pub _tab: flatbuffers::Table<'a>,
}

impl<'a> flatbuffers::Follow<'a> for WoffMetadataText<'a> {
  type Inner = WoffMetadataText<'a>;
  #[inline]
  fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
    Self { _tab: flatbuffers::Table { buf, loc } }
  }
}

impl<'a> WoffMetadataText<'a> {
  pub const VT_TEXT: flatbuffers::VOffsetT = 4;
  pub const VT_LANGUAGE: flatbuffers::VOffsetT = 6;
  pub const VT_DIR: flatbuffers::VOffsetT = 8;
  pub const VT_CLASS: flatbuffers::VOffsetT = 10;

  #[inline]
  pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    WoffMetadataText { _tab: table }
  }
  #[allow(unused_mut)]
  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
    _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
    args: &'args WoffMetadataTextArgs<'args>
  ) -> flatbuffers::WIPOffset<WoffMetadataText<'bldr>> {
    let mut builder = WoffMetadataTextBuilder::new(_fbb);
    if let Some(x) = args.class { builder.add_class(x); }
    if let Some(x) = args.dir { builder.add_dir(x); }
    if let Some(x) = args.language { builder.add_language(x); }
    if let Some(x) = args.text { builder.add_text(x); }
    builder.finish()
  }

  #[inline]
  pub fn text(&self) -> &'a str {
    self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(WoffMetadataText::VT_TEXT, None).unwrap()
  }
  #[inline]
  pub fn language(&self) -> Option<&'a str> {
    self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(WoffMetadataText::VT_LANGUAGE, None)
  }
  #[inline]
  pub fn dir(&self) -> Option<&'a str> {
    self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(WoffMetadataText::VT_DIR, None)
  }
  #[inline]
  pub fn class(&self) -> Option<&'a str> {
    self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(WoffMetadataText::VT_CLASS, None)
  }
}

impl flatbuffers::Verifiable for WoffMetadataText<'_> {
  #[inline]
  fn run_verifier(
    v: &mut flatbuffers::Verifier, pos: usize
  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
    use self::flatbuffers::Verifiable;
    v.visit_table(pos)?
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("text", Self::VT_TEXT, true)?
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("language", Self::VT_LANGUAGE, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("dir", Self::VT_DIR, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("class", Self::VT_CLASS, false)?
     .finish();
    Ok(())
  }
}
pub struct WoffMetadataTextArgs<'a> {
    pub text: Option<flatbuffers::WIPOffset<&'a str>>,
    pub language: Option<flatbuffers::WIPOffset<&'a str>>,
    pub dir: Option<flatbuffers::WIPOffset<&'a str>>,
    pub class: Option<flatbuffers::WIPOffset<&'a str>>,
}
impl<'a> Default for WoffMetadataTextArgs<'a> {
  #[inline]
  fn default() -> Self {
    WoffMetadataTextArgs {
      text: None, // required field
      language: None,
      dir: None,
      class: None,
    }
  }
}
pub struct WoffMetadataTextBuilder<'a: 'b, 'b> {
  fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
  start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b> WoffMetadataTextBuilder<'a, 'b> {
  #[inline]
  pub fn add_text(&mut self, text: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(WoffMetadataText::VT_TEXT, text);
  }
  #[inline]
  pub fn add_language(&mut self, language: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(WoffMetadataText::VT_LANGUAGE, language);
  }
  #[inline]
  pub fn add_dir(&mut self, dir: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(WoffMetadataText::VT_DIR, dir);
  }
  #[inline]
  pub fn add_class(&mut self, class: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(WoffMetadataText::VT_CLASS, class);
  }
  #[inline]
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> WoffMetadataTextBuilder<'a, 'b> {
    let start = _fbb.start_table();
    WoffMetadataTextBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> flatbuffers::WIPOffset<WoffMetadataText<'a>> {
    let o = self.fbb_.end_table(self.start_);
    self.fbb_.required(o, WoffMetadataText::VT_TEXT,"text");
    flatbuffers::WIPOffset::new(o.value())
  }
}

impl std::fmt::Debug for WoffMetadataText<'_> {
  fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
    let mut ds = f.debug_struct("WoffMetadataText");
      ds.field("text", &self.text());
      ds.field("language", &self.language());
      ds.field("dir", &self.dir());
      ds.field("class", &self.class());
      ds.finish()
  }
}