text:
/*
 * File: Test_Stateflow_private.h
 *
 * Code generated for Simulink model :Test_Stateflow.
 *
 * Model version      : 1.24
 * Simulink Coder version    : 8.6 (R2014a) 27-Dec-2013
 * TLC version       : 8.6 (Jan 30 2014)
 * C/C++ source code generated on  : Tue Oct 06 10:23:43 2015
 *
 * Target selection: stm32.tlc
 * Embedded hardware selection: STMicroelectronics->STM32 32-bit Cortex-M
 * Code generation objectives: Unspecified
 * Validation result: Not run
 *
 *
 *
 * ******************************************************************************
 * * attention
 * *
 * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
 * * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
 * * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
 * * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
 * * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
 * * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
 * *
 * ******************************************************************************
 */

#ifndef RTW_HEADER_Test_Stateflow_private_h_
#define RTW_HEADER_Test_Stateflow_private_h_
#include "rtwtypes.h"
#ifndef __RTWTYPES_H__
#error This file requires rtwtypes.h to be included
#endif                                 /* __RTWTYPES_H__ */
#endif                                 /* RTW_HEADER_Test_Stateflow_private_h_ */

/* File trailer for Real-Time Workshop generated code.
 *
 * [EOF] Test_Stateflow_private.h
 */


text:
#if XAML
#if NETFX_CORE
using Windows.UI.Xaml;
using Windows.UI.Xaml.Media;
#else
using System;
using System.Windows;
using System.Windows.Media;
#endif

namespace NReact
{
  static partial class NConverters
  {
    public static object ToBrush(object value)
    {
      return ToBrushT(value);
    }

    public static Brush ToBrushT(object value)
    {
      var result = value as Brush;
      if (result != null)
        return result;

      return new SolidColorBrush(ToColorT(value));
    }
  }
}
#endif

redpajama_set_name: RedPajamaGithub


text:
Spree::Core::Engine.routes.draw do
  namespace :admin do
    resources :price_filters
  end
end


text:
package com.hitsoysauce.designpattern.composite2;

import java.util.List;

public interface Component
{
	public void doSomething();

	public void add(Component component);

	public void remove(Component component);

	public List<Component> getAll();
}


text:
<link href="http://ormma.googlecode.com/svn/trunk/AdSamples/CrispTestSuite/functional/shake.css" rel="stylesheet" type="text/css"/>

shake Event Test

    <input id='button' type='button' value='reset'/>
    <select id='select'>
      <option value='none'>none (use default)</option>
      <option value='intensity'>intensity</option>
      <option value='interval'>interval</option>
    </select>
    <input id='text' type='number' size='10'>


text:
package com.tactfactory.harmony.test.orm;

import java.util.Collection;

import org.junit.After;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

import com.tactfactory.harmony.command.OrmCommand;
import com.tactfactory.harmony.command.ProjectCommand;
import com.tactfactory.harmony.meta.ApplicationMetadata;
import com.tactfactory.harmony.test.CommonTest;

@RunWith(Parameterized.class)
/**
 * Entities updates test class.
 *
 */
public class OrmUpdateEntitiesTest extends CommonTest {

    public OrmUpdateEntitiesTest(ApplicationMetadata currentMetadata)
            throws Exception {
        super(currentMetadata);
    }

    @Override
    public void setUpBeforeNewParameter() throws Exception {
        super.setUpBeforeNewParameter();

        this.initAll();
    }

    @Before
    @Override
    public final void setUp() throws RuntimeException {
        super.setUp();
    }

    @After
    @Override
    public final void tearDown() throws RuntimeException {
        super.tearDown();

        //TODO : enable !! FileUtils.deleteRecursive(dirproj);
    }

    /**
     * Generate the entities.
     */
    private void initAll() {
        getHarmony().findAndExecute(ProjectCommand.INIT_ANDROID, null, null);
        makeEntities();
        getHarmony().findAndExecute(OrmCommand.GENERATE_ENTITIES, new String[] {}, null);
        // The real test
        getHarmony().findAndExecute(OrmCommand.GENERATE_ENTITIES, new String[] {}, null);
    }

    @Parameters
    public static Collection<Object[]> getParameters() {
        return CommonTest.getParameters();
    }
}


text: require 'capistrano/foreman_export/backend/supervisord'


text:
typedef struct ClaySettings {
  GColor TopBackgroundColor;
  GColor TopForegroundColor;
  GColor BottomBackgroundColor;
  GColor BottomForegroundColor;
  bool BluetoothVibe;
  bool HourlyVibe;
  bool Blink;
  bool DateFormat;
  bool WeatherIsFahrenheit;
  int WeatherTemperature;
  int WeatherHigh;
  int WeatherLow;
  int WeatherIcon;
} __attribute__((__packed__)) ClaySettings;


text:
package io.codearte.jFairyOnline.config;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint;
import org.springframework.stereotype.Component;

/**
 * @author Olga Maciaszek-Sharma
 * @since 9/2/17
 */
@Component
class AuthenticationEntryPoint extends BasicAuthenticationEntryPoint {

	private static final String REALM = "JFO_REALM";

	@Override
	public void afterPropertiesSet() throws Exception {
		setRealmName(REALM);
		super.afterPropertiesSet();
	}

	@Override
	public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException {
		super.commence(request, response, authException);
	}
}


text:
. ${srcdir}/tests/common.shi
${RUNENV} ${MEMCHECK} ./rwfile -compress zip ${SRCDIR}/input_bilevel.miff MIFF


text:
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
 * Copyright (c) 2011, 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation;
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Author: Nicola Baldo <nbaldo@cttc.es>
 */

#include <ns3/fatal-error.h>
#include <ns3/log.h>
#include <ns3/object-map.h>
#include <ns3/object-factory.h>
#include <ns3/node-list.h>
#include <ns3/node.h>
#include <ns3/simulator.h>

#include "lte-ue-rrc.h"
#include "lte-enb-rrc.h"
#include "lte-rlc.h"
#include "lte-rlc-tm.h"
#include "lte-rlc-um.h"
#include "lte-rlc-am.h"
#include "lte-pdcp.h"
#include "lte-pdcp-sap.h"
#include "lte-radio-bearer-info.h"
#include "lte-as-sap.h"
#include "lte-enb-net-device.h"

NS_LOG_COMPONENT_DEFINE ("LteUeRrc");

namespace ns3 {

/////////////////////////////
// CMAC SAP forwarder
/////////////////////////////

class UeMemberLteUeCmacSapUser : public LteUeCmacSapUser
{
public:
  UeMemberLteUeCmacSapUser (LteUeRrc* rrc);

  virtual void SetTemporaryCellRnti (uint16_t rnti);
  virtual void NotifyRandomAccessSuccessful ();
  virtual void NotifyRandomAccessFailed ();

private:
  LteUeRrc* m_rrc;
};

UeMemberLteUeCmacSapUser::UeMemberLteUeCmacSapUser (LteUeRrc* rrc)
  : m_rrc (rrc)
{
}

void
UeMemberLteUeCmacSapUser::SetTemporaryCellRnti (uint16_t rnti)
{
  m_rrc->DoSetTemporaryCellRnti (rnti);
}

void
UeMemberLteUeCmacSapUser::NotifyRandomAccessSuccessful ()
{
  m_rrc->DoNotifyRandomAccessSuccessful ();
}

void
UeMemberLteUeCmacSapUser::NotifyRandomAccessFailed ()
{
  m_rrc->DoNotifyRandomAccessFailed ();
}

const char* g_ueRrcStateName[LteUeRrc::NUM_STATES] =
  {
    "IDLE_CELL_SELECTION",
    "IDLE_WAIT_SYSTEM_INFO",
    "IDLE_CAMPED_NORMALLY",
    "IDLE_RANDOM_ACCESS",
    "IDLE_CONNECTING",
    "CONNECTED_NORMALLY",
    "CONNECTED_REESTABLISHING",
    "CONNECTED_HANDOVER"
  };

std::string ToString (LteUeRrc::State s)
{
  return std::string (g_ueRrcStateName[s]);
}

/////////////////////////////
// ue RRC methods
/////////////////////////////

NS_OBJECT_ENSURE_REGISTERED (LteUeRrc);

LteUeRrc::LteUeRrc ()
  : m_cphySapProvider (0),
    m_cmacSapProvider (0),
    m_rrcSapUser (0),
    m_macSapProvider (0),
    m_asSapUser (0),
    m_state (IDLE_CELL_SELECTION),
    m_imsi (0),
    m_rnti (0),
    m_cellId (0),
    m_useRlcSm (true),
    m_connectionPending (0),
    m_receivedMib (0),
    m_receivedSib2 (0)

{
  NS_LOG_FUNCTION (this);
  m_cphySapUser = new MemberLteUeCphySapUser<LteUeRrc> (this);
  m_cmacSapUser = new UeMemberLteUeCmacSapUser (this);
  m_rrcSapProvider = new MemberLteUeRrcSapProvider<LteUeRrc> (this);
  m_drbPdcpSapUser = new LtePdcpSpecificLtePdcpSapUser<LteUeRrc> (this);
  m_asSapProvider = new MemberLteAsSapProvider<LteUeRrc> (this);
}

LteUeRrc::~LteUeRrc ()
{
  NS_LOG_FUNCTION (this);
}

void
LteUeRrc::DoDispose ()
{
  NS_LOG_FUNCTION (this);
  delete m_cphySapUser;
  delete m_cmacSapUser;
  delete m_rrcSapProvider;
  delete m_drbPdcpSapUser;
  delete m_asSapProvider;
  m_drbMap.clear ();
}

TypeId
LteUeRrc::GetTypeId (void)
{
  static TypeId tid = TypeId ("ns3::LteUeRrc")
    .SetParent<Object> ()
    .AddConstructor<LteUeRrc> ()
    .AddAttribute ("DataRadioBearerMap", "List of UE RadioBearerInfo for Data Radio Bearers by LCID.",
                   ObjectMapValue (),
                   MakeObjectMapAccessor (&LteUeRrc::m_drbMap),
                   MakeObjectMapChecker<LteDataRadioBearerInfo> ())
    .AddAttribute ("Srb0", "SignalingRadioBearerInfo for SRB0",
                   PointerValue (),
                   MakePointerAccessor (&LteUeRrc::m_srb0),
                   MakePointerChecker<LteSignalingRadioBearerInfo> ())
    .AddAttribute ("Srb1", "SignalingRadioBearerInfo for SRB1",
                   PointerValue (),
                   MakePointerAccessor (&LteUeRrc::m_srb1),
                   MakePointerChecker<LteSignalingRadioBearerInfo> ())
    .AddAttribute ("CellId",
                   "Serving cell identifier",
                   UintegerValue (0), // unused, read-only attribute
                   MakeUintegerAccessor (&LteUeRrc::GetCellId),
                   MakeUintegerChecker<uint16_t> ())
    .AddAttribute ("C-RNTI",
                   "Cell Radio Network Temporary Identifier",
                   UintegerValue (0), // unused, read-only attribute
                   MakeUintegerAccessor (&LteUeRrc::GetRnti),
                   MakeUintegerChecker<uint16_t> ())
    .AddTraceSource ("StateTransition",
                     "trace fired upon every UE RRC state transition",
                     MakeTraceSourceAccessor (&LteUeRrc::m_stateTransitionTrace))
    .AddTraceSource ("RandomAccessSuccessful",
                     "trace fired upon successful completion of the random access procedure",
                     MakeTraceSourceAccessor (&LteUeRrc::m_randomAccessSuccessfulTrace))
    .AddTraceSource ("ConnectionEstablished",
                     "trace fired upon successful RRC connection establishment",
                     MakeTraceSourceAccessor (&LteUeRrc::m_connectionEstablishedTrace))
    .AddTraceSource ("ConnectionReconfiguration",
                     "trace fired upon RRC connection reconfiguration",
                     MakeTraceSourceAccessor (&LteUeRrc::m_connectionReconfigurationTrace))
    .AddTraceSource ("HandoverStart",
                     "trace fired upon start of a handover procedure",
                     MakeTraceSourceAccessor (&LteUeRrc::m_handoverStartTrace))
    .AddTraceSource ("HandoverEndOk",
                     "trace fired upon successful termination of a handover procedure",
                     MakeTraceSourceAccessor (&LteUeRrc::m_handoverEndOkTrace))
    ;
  return tid;
}

void
LteUeRrc::SetLteUeCphySapProvider (LteUeCphySapProvider * s)
{
  NS_LOG_FUNCTION (this << s);
  m_cphySapProvider = s;
}

LteUeCphySapUser*
LteUeRrc::GetLteUeCphySapUser ()
{
  NS_LOG_FUNCTION (this);
  return m_cphySapUser;
}

void
LteUeRrc::SetLteUeCmacSapProvider (LteUeCmacSapProvider * s)
{
  NS_LOG_FUNCTION (this << s);
  m_cmacSapProvider = s;
}

LteUeCmacSapUser*
LteUeRrc::GetLteUeCmacSapUser ()
{
  NS_LOG_FUNCTION (this);
  return m_cmacSapUser;
}

void
LteUeRrc::SetLteUeRrcSapUser (LteUeRrcSapUser * s)
{
  NS_LOG_FUNCTION (this << s);
  m_rrcSapUser = s;
}

LteUeRrcSapProvider*
LteUeRrc::GetLteUeRrcSapProvider ()
{
  NS_LOG_FUNCTION (this);
  return m_rrcSapProvider;
}

void
LteUeRrc::SetLteMacSapProvider (LteMacSapProvider * s)
{
  NS_LOG_FUNCTION (this << s);
  m_macSapProvider = s;
}

void
LteUeRrc::SetAsSapUser (LteAsSapUser* s)
{
  m_asSapUser = s;
}

LteAsSapProvider*
LteUeRrc::GetAsSapProvider ()
{
  return m_asSapProvider;
}

void
LteUeRrc::SetImsi (uint64_t imsi)
{
  NS_LOG_FUNCTION (this << imsi);
  m_imsi = imsi;
}

uint64_t
LteUeRrc::GetImsi (void)
{
  return m_imsi;
}

uint16_t
LteUeRrc::GetRnti () const
{
  NS_LOG_FUNCTION (this);
  return m_rnti;
}

uint16_t
LteUeRrc::GetCellId () const
{
  NS_LOG_FUNCTION (this);
  return m_cellId;
}

uint8_t
LteUeRrc::GetUlBandwidth () const
{
  NS_LOG_FUNCTION (this);
  return m_ulBandwidth;
}

uint8_t
LteUeRrc::GetDlBandwidth () const
{
  NS_LOG_FUNCTION (this);
  return m_dlBandwidth;
}

uint16_t
LteUeRrc::GetDlEarfcn () const
{
  return m_dlEarfcn;
}

uint16_t
LteUeRrc::GetUlEarfcn () const
{
  NS_LOG_FUNCTION (this);
  return m_ulEarfcn;
}

LteUeRrc::State
LteUeRrc::GetState (void)
{
  NS_LOG_FUNCTION (this);
  return m_state;
}

void
LteUeRrc::SetUseRlcSm (bool val)
{
  NS_LOG_FUNCTION (this);
  m_useRlcSm = val;
}

void
LteUeRrc::DoInitialize (void)
{
  NS_LOG_FUNCTION (this);

  // setup the UE side of SRB0
  uint8_t lcid = 0;

  Ptr<LteRlc> rlc = CreateObject<LteRlcTm> ()->GetObject<LteRlc> ();
  rlc->SetLteMacSapProvider (m_macSapProvider);
  rlc->SetRnti (m_rnti);
  rlc->SetLcId (lcid);

  m_srb0 = CreateObject<LteSignalingRadioBearerInfo> ();
  m_srb0->m_rlc = rlc;
  m_srb0->m_srbIdentity = 0;
  LteUeRrcSapUser::SetupParameters ueParams;
  ueParams.srb0SapProvider = m_srb0->m_rlc->GetLteRlcSapProvider ();
  ueParams.srb1SapProvider = 0;
  m_rrcSapUser->Setup (ueParams);

  // CCCH (LCID 0) is pre-configured, here is the hardcoded configuration:
  LteUeCmacSapProvider::LogicalChannelConfig lcConfig;
  lcConfig.priority = 0; // highest priority
  lcConfig.prioritizedBitRateKbps = 65535; // maximum
  lcConfig.bucketSizeDurationMs = 65535; // maximum
  lcConfig.logicalChannelGroup = 0; // all SRBs mapped to LCG 0

  m_cmacSapProvider->AddLc (lcid, lcConfig, rlc->GetLteMacSapUser ());

}

void
LteUeRrc::DoSendData (Ptr<Packet> packet, uint8_t bid)
{
  NS_LOG_FUNCTION (this << packet);

  uint8_t drbid = Bid2Drbid (bid);

  std::map<uint8_t, Ptr<LteDataRadioBearerInfo> >::iterator it =   m_drbMap.find (drbid);
  NS_ASSERT_MSG (it != m_drbMap.end (), "could not find bearer with drbid == " << drbid);

  LtePdcpSapProvider::TransmitPdcpSduParameters params;
  params.pdcpSdu = packet;
  params.rnti = m_rnti;
  params.lcid = it->second->m_logicalChannelIdentity;

  NS_LOG_LOGIC (this << " RNTI=" << m_rnti << " sending " << packet << "on DRBID " << (uint32_t) drbid << " (LCID" << params.lcid << ")" << " (" << packet->GetSize () << " bytes)");
  it->second->m_pdcp->GetLtePdcpSapProvider ()->TransmitPdcpSdu (params);
}

void
LteUeRrc::DoDisconnect ()
{
  NS_LOG_FUNCTION (this);

  switch (m_state)
    {
    case IDLE_CELL_SELECTION:
    case IDLE_CAMPED_NORMALLY:
      NS_LOG_INFO ("already disconnected");
      break;

    case IDLE_CONNECTING:
      NS_LOG_INFO ("aborting connection setup procedure");
      SwitchToState (IDLE_CAMPED_NORMALLY);
      break;

    case CONNECTED_NORMALLY:
    case CONNECTED_REESTABLISHING:
    case CONNECTED_HANDOVER:
      LeaveConnectedMode ();
      break;

    default:
      NS_FATAL_ERROR ("method unexpected in state " << ToString (m_state));
      break;
    }
}

void
LteUeRrc::DoReceivePdcpSdu (LtePdcpSapUser::ReceivePdcpSduParameters params)
{
  NS_LOG_FUNCTION (this);
  m_asSapUser->RecvData (params.pdcpSdu);
}

void
LteUeRrc::DoSetTemporaryCellRnti (uint16_t rnti)
{
  NS_LOG_FUNCTION (this << rnti);
  m_rnti = rnti;
  m_srb0->m_rlc->SetRnti (m_rnti);
  m_cphySapProvider->SetRnti (m_rnti);
}

void
LteUeRrc::DoNotifyRandomAccessSuccessful ()
{
  NS_LOG_FUNCTION (this << m_imsi << ToString (m_state));
  m_randomAccessSuccessfulTrace (m_imsi, m_cellId, m_rnti);
  switch (m_state)
    {
    case IDLE_RANDOM_ACCESS:
      {
        // we just received a RAR with a T-C-RNTI and an UL grant
        // send RRC connection request as message 3 of the random access procedure
        SwitchToState (IDLE_CONNECTING);
        LteRrcSap::RrcConnectionRequest msg;
        msg.ueIdentity = m_imsi;
        m_rrcSapUser->SendRrcConnectionRequest (msg);
      }
      break;

    case CONNECTED_HANDOVER:
      {
        LteRrcSap::RrcConnectionReconfigurationCompleted msg;
        msg.rrcTransactionIdentifier = m_lastRrcTransactionIdentifier;
        m_rrcSapUser->SendRrcConnectionReconfigurationCompleted (msg);
        SwitchToState (CONNECTED_NORMALLY);
        m_handoverEndOkTrace (m_imsi, m_cellId, m_rnti);
      }
      break;

    default:
      NS_FATAL_ERROR ("unexpected event in state " << ToString (m_state));
      break;
    }
}

void
LteUeRrc::DoNotifyRandomAccessFailed ()
{
  NS_LOG_FUNCTION (this);
}

void
LteUeRrc::DoForceCampedOnEnb (uint16_t cellId, uint16_t earfcn)
{
  NS_LOG_FUNCTION (this << cellId << earfcn);

  m_cellId = cellId;
  m_dlEarfcn = earfcn;
  m_cphySapProvider->SyncronizeWithEnb (m_cellId, m_dlEarfcn);
  SwitchToState (IDLE_WAIT_SYSTEM_INFO);
}

void
LteUeRrc::DoConnect ()
{
  NS_LOG_FUNCTION (this);
  switch (m_state)
    {
    case IDLE_CELL_SELECTION:
    case IDLE_WAIT_SYSTEM_INFO:
      m_connectionPending = true;
      break;

    case IDLE_CAMPED_NORMALLY:
      StartConnection ();
      break;

    case IDLE_RANDOM_ACCESS:
    case IDLE_CONNECTING:
      NS_LOG_WARN ("already connecting (state " << ToString (m_state) << ")");
      break;

    case CONNECTED_NORMALLY:
    case CONNECTED_REESTABLISHING:
    case CONNECTED_HANDOVER:
      NS_LOG_WARN ("already connected (state " << ToString (m_state) << ")");
      break;

    default:
      NS_FATAL_ERROR ("cannot connect while in state " << ToString (m_state));
      break;
    }

}

// CPHY SAP methods

void
LteUeRrc::DoRecvMasterInformationBlock (LteRrcSap::MasterInformationBlock msg)
{
  NS_LOG_FUNCTION (this);
  m_dlBandwidth = msg.dlBandwidth;
  m_cphySapProvider->SetDlBandwidth (msg.dlBandwidth);
  m_receivedMib = true;
  if (m_state == IDLE_WAIT_SYSTEM_INFO && m_receivedMib && m_receivedSib2)
    {
       SwitchToState (IDLE_CAMPED_NORMALLY);
    }
}

// RRC SAP methods

void
LteUeRrc::DoCompleteSetup (LteUeRrcSapProvider::CompleteSetupParameters params)
{
  NS_LOG_FUNCTION (this);
  m_srb0->m_rlc->SetLteRlcSapUser (params.srb0SapUser);
  if (m_srb1)
    {
      m_srb1->m_pdcp->SetLtePdcpSapUser (params.srb1SapUser);
    }
}

void
LteUeRrc::DoRecvSystemInformationBlockType1 (LteRrcSap::SystemInformationBlockType1 msg)
{
  NS_LOG_FUNCTION (this);
  // to be implemented
}

void
LteUeRrc::DoRecvSystemInformation (LteRrcSap::SystemInformation msg)
{
  NS_LOG_FUNCTION (this);
  if (msg.haveSib2)
    {
      m_receivedSib2 = true;
      m_ulBandwidth = msg.sib2.freqInfo.ulBandwidth;
      m_ulEarfcn = msg.sib2.freqInfo.ulCarrierFreq;
      LteUeCmacSapProvider::RachConfig rc;
      rc.numberOfRaPreambles = msg.sib2.radioResourceConfigCommon.rachConfigCommon.preambleInfo.numberOfRaPreambles;
      rc.preambleTransMax = msg.sib2.radioResourceConfigCommon.rachConfigCommon.raSupervisionInfo.preambleTransMax;
      rc.raResponseWindowSize = msg.sib2.radioResourceConfigCommon.rachConfigCommon.raSupervisionInfo.raResponseWindowSize;
      m_cmacSapProvider->ConfigureRach (rc);
      m_cphySapProvider->ConfigureUplink (m_ulEarfcn, m_ulBandwidth);
    }
  if (m_state == IDLE_WAIT_SYSTEM_INFO && m_receivedMib && m_receivedSib2)
    {
       SwitchToState (IDLE_CAMPED_NORMALLY);
    }
}

void
LteUeRrc::DoRecvRrcConnectionSetup (LteRrcSap::RrcConnectionSetup msg)
{
  NS_LOG_FUNCTION (this);
  switch (m_state)
    {
    case IDLE_CONNECTING:
      {
        ApplyRadioResourceConfigDedicated (msg.radioResourceConfigDedicated);
        SwitchToState (CONNECTED_NORMALLY);
        LteRrcSap::RrcConnectionSetupCompleted msg2;
        msg2.rrcTransactionIdentifier = msg.rrcTransactionIdentifier;
        m_rrcSapUser->SendRrcConnectionSetupCompleted (msg2);
        m_asSapUser->NotifyConnectionSuccessful ();
        m_connectionEstablishedTrace (m_imsi, m_cellId, m_rnti);
      }
      break;

    default:
      NS_FATAL_ERROR ("method unexpected in state " << ToString (m_state));
      break;
    }
}

void
LteUeRrc::DoRecvRrcConnectionReconfiguration (LteRrcSap::RrcConnectionReconfiguration msg)
{
  NS_LOG_FUNCTION (this << " RNTI " << m_rnti);
  switch (m_state)
    {
    case CONNECTED_NORMALLY:
      if (msg.haveMobilityControlInfo)
        {
          NS_LOG_INFO ("haveMobilityControlInfo == true");
          SwitchToState (CONNECTED_HANDOVER);
          const LteRrcSap::MobilityControlInfo& mci = msg.mobilityControlInfo;
          m_handoverStartTrace (m_imsi, m_cellId, m_rnti, mci.targetPhysCellId);
          m_cmacSapProvider->Reset ();
          m_cphySapProvider->Reset ();
          m_cellId = mci.targetPhysCellId;
          NS_ASSERT (mci.haveCarrierFreq);
          NS_ASSERT (mci.haveCarrierBandwidth);
          m_cphySapProvider->SyncronizeWithEnb (m_cellId, mci.carrierFreq.dlCarrierFreq);
          m_cphySapProvider->SetDlBandwidth ( mci.carrierBandwidth.dlBandwidth);
          m_cphySapProvider->ConfigureUplink (mci.carrierFreq.ulCarrierFreq, mci.carrierBandwidth.ulBandwidth);
          m_rnti = msg.mobilityControlInfo.newUeIdentity;
          m_srb0->m_rlc->SetRnti (m_rnti);
          NS_ASSERT_MSG (mci.haveRachConfigDedicated, "handover is only supported with non-contention-based random access procedure");
          m_cmacSapProvider->StartNonContentionBasedRandomAccessProcedure (m_rnti, mci.rachConfigDedicated.raPreambleIndex, mci.rachConfigDedicated.raPrachMaskIndex);
          m_cphySapProvider->SetRnti (m_rnti);
          m_lastRrcTransactionIdentifier = msg.rrcTransactionIdentifier;
          NS_ASSERT (msg.haveRadioResourceConfigDedicated);

          // we re-establish SRB1 by creating a new entity
          // note that we can't dispose the old entity now, because
          // it's in the current stack, so we would corrupt the stack
          // if we did so. Hence we schedule it for later disposal
          m_srb1Old = m_srb1;
          Simulator::ScheduleNow (&LteUeRrc::DisposeOldSrb1, this);
          m_srb1 = 0; // new instance will be be created within ApplyRadioResourceConfigDedicated

          m_drbMap.clear (); // dispose all DRBs
          ApplyRadioResourceConfigDedicated (msg.radioResourceConfigDedicated);
          // RRC connection reconfiguration completed will be sent
          // after handover is complete
        }
      else
        {
          NS_LOG_INFO ("haveMobilityControlInfo == false");
          if (msg.haveRadioResourceConfigDedicated)
            {
              ApplyRadioResourceConfigDedicated (msg.radioResourceConfigDedicated);
            }
          LteRrcSap::RrcConnectionReconfigurationCompleted msg2;
          msg2.rrcTransactionIdentifier = msg.rrcTransactionIdentifier;
          m_rrcSapUser->SendRrcConnectionReconfigurationCompleted (msg2);
          m_connectionReconfigurationTrace (m_imsi, m_cellId, m_rnti);
        }
      break;

    default:
      NS_FATAL_ERROR ("method unexpected in state " << ToString (m_state));
      break;
    }
}

void
LteUeRrc::DoRecvRrcConnectionReestablishment (LteRrcSap::RrcConnectionReestablishment msg)
{
  switch (m_state)
    {
    case CONNECTED_REESTABLISHING:
      {
      }
      break;

    default:
      NS_FATAL_ERROR ("method unexpected in state " << ToString (m_state));
      break;
    }
}

void
LteUeRrc::DoRecvRrcConnectionReestablishmentReject (LteRrcSap::RrcConnectionReestablishmentReject msg)
{
  NS_LOG_FUNCTION (this);
  switch (m_state)
    {
    case CONNECTED_REESTABLISHING:
      {
        LeaveConnectedMode ();
      }
      break;

    default:
      NS_FATAL_ERROR ("method unexpected in state " << ToString (m_state));
      break;
    }
}

void
LteUeRrc::DoRecvRrcConnectionRelease (LteRrcSap::RrcConnectionRelease msg)
{
  NS_LOG_FUNCTION (this);
}

void
LteUeRrc::DoRecvRrcConnectionReject (LteRrcSap::RrcConnectionReject msg)
{
  NS_LOG_FUNCTION (this);
  m_cmacSapProvider->Reset ();
  SwitchToState (IDLE_CAMPED_NORMALLY);
}

void
LteUeRrc::ApplyRadioResourceConfigDedicated (LteRrcSap::RadioResourceConfigDedicated rrcd)
{
  NS_LOG_FUNCTION (this);
  const struct LteRrcSap::PhysicalConfigDedicated& pcd = rrcd.physicalConfigDedicated;

  if (pcd.haveAntennaInfoDedicated)
    {
      m_cphySapProvider->SetTransmissionMode (pcd.antennaInfo.transmissionMode);
    }
  if (pcd.haveSoundingRsUlConfigDedicated)
    {
      m_cphySapProvider->SetSrsConfigurationIndex (pcd.soundingRsUlConfigDedicated.srsConfigIndex);
    }

  std::list<LteRrcSap::SrbToAddMod>::const_iterator stamIt = rrcd.srbToAddModList.begin ();
  if (stamIt != rrcd.srbToAddModList.end ())
    {
      if (m_srb1 == 0)
        {
          // SRB1 not setup yet
          NS_ASSERT_MSG ((m_state == IDLE_CONNECTING) || (m_state == CONNECTED_HANDOVER),
                         "unexpected state " << ToString (m_state));
          NS_ASSERT_MSG (stamIt->srbIdentity == 1, "only SRB1 supported");

          const uint8_t lcid = 1; // fixed LCID for SRB1

          Ptr<LteRlc> rlc = CreateObject<LteRlcAm> ();
          rlc->SetLteMacSapProvider (m_macSapProvider);
          rlc->SetRnti (m_rnti);
          rlc->SetLcId (lcid);

          Ptr<LtePdcp> pdcp = CreateObject<LtePdcp> ();
          pdcp->SetRnti (m_rnti);
          pdcp->SetLcId (lcid);
          pdcp->SetLtePdcpSapUser (m_drbPdcpSapUser);
          pdcp->SetLteRlcSapProvider (rlc->GetLteRlcSapProvider ());
          rlc->SetLteRlcSapUser (pdcp->GetLteRlcSapUser ());

          m_srb1 = CreateObject<LteSignalingRadioBearerInfo> ();
          m_srb1->m_rlc = rlc;
          m_srb1->m_pdcp = pdcp;
          m_srb1->m_srbIdentity = 1;

          m_srb1->m_logicalChannelConfig.priority = stamIt->logicalChannelConfig.priority;
          m_srb1->m_logicalChannelConfig.prioritizedBitRateKbps = stamIt->logicalChannelConfig.prioritizedBitRateKbps;
          m_srb1->m_logicalChannelConfig.bucketSizeDurationMs = stamIt->logicalChannelConfig.bucketSizeDurationMs;
          m_srb1->m_logicalChannelConfig.logicalChannelGroup = stamIt->logicalChannelConfig.logicalChannelGroup;

          struct LteUeCmacSapProvider::LogicalChannelConfig lcConfig;
          lcConfig.priority = stamIt->logicalChannelConfig.priority;
          lcConfig.prioritizedBitRateKbps = stamIt->logicalChannelConfig.prioritizedBitRateKbps;
          lcConfig.bucketSizeDurationMs = stamIt->logicalChannelConfig.bucketSizeDurationMs;
          lcConfig.logicalChannelGroup = stamIt->logicalChannelConfig.logicalChannelGroup;

          m_cmacSapProvider->AddLc (lcid, lcConfig, rlc->GetLteMacSapUser ());

          ++stamIt;
          NS_ASSERT_MSG (stamIt == rrcd.srbToAddModList.end (), "at most one SrbToAdd supported");

          LteUeRrcSapUser::SetupParameters ueParams;
          ueParams.srb0SapProvider = m_srb0->m_rlc->GetLteRlcSapProvider ();
          ueParams.srb1SapProvider = m_srb1->m_pdcp->GetLtePdcpSapProvider ();
          m_rrcSapUser->Setup (ueParams);
        }
      else
        {
          NS_LOG_INFO ("request to modify SRB1 (skipping as currently not implemented)");
          // would need to modify m_srb1, and then propagate changes to the MAC
        }
    }

  std::list<LteRrcSap::DrbToAddMod>::const_iterator dtamIt;
  for (dtamIt = rrcd.drbToAddModList.begin ();
       dtamIt != rrcd.drbToAddModList.end ();
       ++dtamIt)
    {
      NS_LOG_INFO (this << " IMSI " << m_imsi << " adding/modifying DRBID " << (uint32_t) dtamIt->drbIdentity << " LC " << (uint32_t) dtamIt->logicalChannelIdentity);
      NS_ASSERT_MSG (dtamIt->logicalChannelIdentity > 2, "LCID value " << dtamIt->logicalChannelIdentity << " is reserved for SRBs");

      std::map<uint8_t, Ptr<LteDataRadioBearerInfo> >::iterator drbMapIt = m_drbMap.find (dtamIt->drbIdentity);
      if (drbMapIt == m_drbMap.end ())
        {
          NS_LOG_INFO ("New Data Radio Bearer");

          TypeId rlcTypeId;
          if (m_useRlcSm)
            {
              rlcTypeId = LteRlcSm::GetTypeId ();
            }
          else
            {
              switch (dtamIt->rlcConfig.choice)
                {
                case LteRrcSap::RlcConfig::AM:
                  rlcTypeId = LteRlcAm::GetTypeId ();
                  break;

                case LteRrcSap::RlcConfig::UM_BI_DIRECTIONAL:
                  rlcTypeId = LteRlcUm::GetTypeId ();
                  break;

                default:
                  NS_FATAL_ERROR ("unsupported RLC configuration");
                  break;
                }
            }

          ObjectFactory rlcObjectFactory;
          rlcObjectFactory.SetTypeId (rlcTypeId);
          Ptr<LteRlc> rlc = rlcObjectFactory.Create ()->GetObject<LteRlc> ();
          rlc->SetLteMacSapProvider (m_macSapProvider);
          rlc->SetRnti (m_rnti);
          rlc->SetLcId (dtamIt->logicalChannelIdentity);

          Ptr<LteDataRadioBearerInfo> drbInfo = CreateObject<LteDataRadioBearerInfo> ();
          drbInfo->m_rlc = rlc;
          drbInfo->m_epsBearerIdentity = dtamIt->epsBearerIdentity;
          drbInfo->m_logicalChannelIdentity = dtamIt->logicalChannelIdentity;
          drbInfo->m_drbIdentity = dtamIt->drbIdentity;

          // we need PDCP only for real RLC, i.e., RLC/UM or RLC/AM
          // if we are using RLC/SM we don't care of anything above RLC
          if (rlcTypeId != LteRlcSm::GetTypeId ())
            {
              Ptr<LtePdcp> pdcp = CreateObject<LtePdcp> ();
              pdcp->SetRnti (m_rnti);
              pdcp->SetLcId (dtamIt->logicalChannelIdentity);
              pdcp->SetLtePdcpSapUser (m_drbPdcpSapUser);
              pdcp->SetLteRlcSapProvider (rlc->GetLteRlcSapProvider ());
              rlc->SetLteRlcSapUser (pdcp->GetLteRlcSapUser ());
              drbInfo->m_pdcp = pdcp;
            }

          m_bid2DrbidMap[dtamIt->epsBearerIdentity] = dtamIt->drbIdentity;

          m_drbMap.insert (std::pair<uint8_t, Ptr<LteDataRadioBearerInfo> > (dtamIt->drbIdentity, drbInfo));

          struct LteUeCmacSapProvider::LogicalChannelConfig lcConfig;
          lcConfig.priority = dtamIt->logicalChannelConfig.priority;
          lcConfig.prioritizedBitRateKbps = dtamIt->logicalChannelConfig.prioritizedBitRateKbps;
          lcConfig.bucketSizeDurationMs = dtamIt->logicalChannelConfig.bucketSizeDurationMs;
          lcConfig.logicalChannelGroup = dtamIt->logicalChannelConfig.logicalChannelGroup;

          m_cmacSapProvider->AddLc (dtamIt->logicalChannelIdentity,
                                    lcConfig,
                                    rlc->GetLteMacSapUser ());
          rlc->Initialize ();
        }
      else
        {
          NS_LOG_INFO ("request to modify existing DRBID");
          Ptr<LteDataRadioBearerInfo> drbInfo = drbMapIt->second;
          // TODO: currently not implemented. Would need to modify drbInfo, and then propagate changes to the MAC
        }
    }

  std::list<uint8_t>::iterator dtdmIt;
  for (dtdmIt = rrcd.drbToReleaseList.begin ();
       dtdmIt != rrcd.drbToReleaseList.end ();
       ++dtdmIt)
    {
      uint8_t drbid = *dtdmIt;
      NS_LOG_INFO (this << " IMSI " << m_imsi << " releasing DRB " << (uint32_t) drbid << drbid);
      std::map<uint8_t, Ptr<LteDataRadioBearerInfo> >::iterator it =   m_drbMap.find (drbid);
      NS_ASSERT_MSG (it != m_drbMap.end (), "could not find bearer with given lcid");
      m_drbMap.erase (it);
      m_bid2DrbidMap.erase (drbid);
    }
}

void
LteUeRrc::StartConnection ()
{
  NS_LOG_FUNCTION (this);
  m_connectionPending = false;
  SwitchToState (IDLE_RANDOM_ACCESS);
  m_cmacSapProvider->StartContentionBasedRandomAccessProcedure ();
}

void
LteUeRrc::LeaveConnectedMode ()
{
  NS_LOG_FUNCTION (this << m_imsi);
  m_asSapUser->NotifyConnectionReleased ();
  m_cmacSapProvider->RemoveLc (1);
  std::map<uint8_t, Ptr<LteDataRadioBearerInfo> >::iterator it;
  for (it = m_drbMap.begin (); it != m_drbMap.end (); ++it)
    {
      m_cmacSapProvider->RemoveLc (it->second->m_logicalChannelIdentity);
    }
  m_drbMap.clear ();
  m_bid2DrbidMap.clear ();
  m_srb1 = 0;
  SwitchToState (IDLE_CAMPED_NORMALLY);
}

void
LteUeRrc::DisposeOldSrb1 ()
{
  NS_LOG_FUNCTION (this);
  m_srb1Old = 0;
}

uint8_t
LteUeRrc::Bid2Drbid (uint8_t bid)
{
  std::map<uint8_t, uint8_t>::iterator it = m_bid2DrbidMap.find (bid);
  NS_ASSERT_MSG (it != m_bid2DrbidMap.end (), "could not find BID " << bid);
  return it->second;
}

void
LteUeRrc::SwitchToState (State newState)
{
  NS_LOG_FUNCTION (this << newState);
  State oldState = m_state;
  m_state = newState;
  NS_LOG_INFO ("IMSI " << m_imsi << " RNTI " << m_rnti << " UeRrc " << ToString (oldState) << " --> " << ToString (newState));
  m_stateTransitionTrace (m_imsi, m_cellId, m_rnti, oldState, newState);

  switch (newState)
    {
    case IDLE_CELL_SELECTION:
      break;

    case IDLE_WAIT_SYSTEM_INFO:
      break;

    case IDLE_CAMPED_NORMALLY:
      if (m_connectionPending)
        {
          StartConnection ();
        }
      break;

    case IDLE_RANDOM_ACCESS:
      break;

    case IDLE_CONNECTING:
      break;

    case CONNECTED_NORMALLY:
      break;

    case CONNECTED_REESTABLISHING:
      break;

    case CONNECTED_HANDOVER:
      break;

    default:
      break;
    }
}

} // namespace ns3


text:
import Vue from 'vue'
import Vuex from 'vuex'

import i18n from './global/i18n'

Vue.use(Vuex)

const store = new Vuex.Store({
  modules: {
    // Globals
    i18n
  },
  strict: process.env.NODE_ENV !== 'production',
  plugins: []
})

export default store


text:
package com.facebook.buck.tools.dxanalysis;

import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import javax.annotation.Nullable;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.commons.AnalyzerAdapter;
import org.objectweb.asm.tree.ClassNode;

/**
 * A static analyzer to find uses of reference equality checks on the RegisterSpec class, including
 * its superclasses, interfaces, superclass interfaces, interface superinterfaces...
 */
public class RegisterSpecAnalyzer {

  // TODO(or_not): Infer this automatically.
  private static final ImmutableSet<String> RISKY_TYPES =
      ImmutableSet.of(
          "com/android/dx/rop/code/RegisterSpec",
          "com/android/dx/rop/type/TypeBearer",
          "com/android/dx/util/ToHuman",
          "java/lang/Comparable",
          "java/lang/Object");

  /** All classes under analysis. */
  private final ImmutableMap<String, ClassNode> allClasses;

  /** Log of messages. */
  private List<String> log = new ArrayList<>();

  public RegisterSpecAnalyzer(ImmutableMap<String, ClassNode> allClasses) {
    this.allClasses = allClasses;
  }

  public static RegisterSpecAnalyzer analyze(ImmutableMap<String, ClassNode> allClasses) {
    RegisterSpecAnalyzer analyzer = new RegisterSpecAnalyzer(allClasses);
    analyzer.go();
    return analyzer;
  }

  public ImmutableList<String> getLog() {
    return ImmutableList.copyOf(log);
  }

  private void go() {
    for (ClassNode klass : allClasses.values()) {
      klass.accept(new RegSpecClassVisitor());
    }
  }

  private class RegSpecClassVisitor extends ClassVisitor {
    @Nullable private String className;

    public RegSpecClassVisitor() {
      super(Opcodes.ASM7);
    }

    @Override
    public void visit(
        int version,
        int access,
        String name,
        String signature,
        String superName,
        String[] interfaces) {
      super.visit(version, access, name, signature, superName, interfaces);

      Preconditions.checkState(this.className == null);
      this.className = name;
    }

    @Override
    public MethodVisitor visitMethod(
        int access, String name, String desc, String signature, String[] exceptions) {
      RegSpecMethodVisitor mv = new RegSpecMethodVisitor(className, name);
      AnalyzerAdapter adapter = new AnalyzerAdapter(className, access, name, desc, mv);
      mv.adapter = adapter;
      return adapter;
    }
  }

  private class RegSpecMethodVisitor extends MethodVisitor {
    private final String className;
    private final String methodName;
    @Nullable AnalyzerAdapter adapter;

    public RegSpecMethodVisitor(String className, String methodName) {
      super(Opcodes.ASM7);
      this.className = className;
      this.methodName = methodName;
    }

    @Override
    public void visitJumpInsn(int opcode, Label label) {
      // There are only two opcodes for comparing object references.
      if (opcode != Opcodes.IF_ACMPEQ && opcode != Opcodes.IF_ACMPNE) {
        return;
      }
      // There should be two arguments on the stack.
      Preconditions.checkState(adapter.stack.size() >= 2);
      Object val1 = adapter.stack.get(adapter.stack.size() - 2);
      Object val2 = adapter.stack.get(adapter.stack.size() - 1);
      // If either is known null, then the comparison is benign.
      if (val1 == Opcodes.NULL || val2 == Opcodes.NULL) {
        return;
      }
      // If not, they both should be strings (class names).
      Preconditions.checkState(val1 instanceof String);
      Preconditions.checkState(val2 instanceof String);
      // If both are risky, report.
      if (RISKY_TYPES.contains(val1) && RISKY_TYPES.contains(val2)) {
        log.add(
            String.format((Locale) null, "RegisterSpec comparison: %s.%s", className, methodName));
      }
    }
  }
}


text:
#include "condor_common.h"
#include "condor_api.h"
#include "condor_config.h"
#include <errno.h>
#include <string.h>
#include "file_sql.h"
#include "truncate.h"
#include "subsystem_info.h"
#include "file_lock.h"

#include <sys/stat.h>

#define FILESIZELIMT 1900000000L

FILESQL::FILESQL(bool use_sql_log)
{
	if(use_sql_log == false) {
    	is_dummy = true;
	} else {
		is_dummy = false;
	}
	is_open = false;
	is_locked = false;
	outfilename = (char *) 0;
	fileflags = O_WRONLY|O_CREAT|O_APPEND;
	outfiledes = -1;
	fp = NULL;
	lock = (FileLock *)0;
}

FILESQL::FILESQL(const char *outputfilename, int flags, bool use_sql_log)
{
	if(use_sql_log == false) {
    	is_dummy = true;
	} else {
		is_dummy = false;
	}
	is_open = false;
	is_locked = false;
	this->outfilename = strdup(outputfilename);
	fileflags = flags;
	outfiledes = -1;
	fp = NULL;
	lock = (FileLock *)0;
}

FILESQL::~FILESQL()
{
	if(file_isopen()) {
		file_close();
	}
	is_open = false;
	is_locked = false;
	if (outfilename) free(outfilename);
	outfiledes = -1;
	fp = NULL;
}

bool FILESQL::file_isopen()
{
	return is_open;
}

bool FILESQL::file_islocked()
{
	return is_locked;
}

QuillErrCode FILESQL::file_truncate() {
	int retval;

    if (is_dummy) return QUILL_SUCCESS;

	if(!file_isopen()) {
		dprintf(D_ALWAYS, "Error calling truncate: the file needs to be first opened\n");
		return QUILL_FAILURE;
	}

	retval = ftruncate(outfiledes, 0);

	if(retval < 0) {
		dprintf(D_ALWAYS, "Error calling ftruncate, errno = %d\n", errno);
		return QUILL_FAILURE;
	}

	return QUILL_SUCCESS;
}

QuillErrCode FILESQL::file_open()
{
    if (is_dummy) return QUILL_SUCCESS;

	if (!outfilename) {
		dprintf(D_ALWAYS,"No SQL log file specified\n");
		return QUILL_FAILURE;
	}

	outfiledes = safe_open_wrapper_follow(outfilename,fileflags,0644);

	if(outfiledes < 0)
	{
		dprintf(D_ALWAYS,"Error opening SQL log file %s : %s\n",outfilename,strerror(errno));
		is_open = false;
		return QUILL_FAILURE;
	}
	else
	{
		is_open = true;

		/* Create a lock object when opening the file.
		 * Note: We very purposefully pass the "outfilename" to the
		 * FileLock ctor here; doing so enables the FileLock object
		 * to use kernel mutexes instead of on-disk file locks.  Not
		 * only is this more efficient, but on Windows it is required
		 * because later we will try to read from the locked file.  If
		 * it is "really" locked -vs- using Condor's advisory locking
		 * via the kernel mutexes, these reads will fail on Win32.
		 */
		lock = new FileLock(outfiledes,NULL,outfilename);
		return QUILL_SUCCESS;
	}
}

QuillErrCode FILESQL::file_close()
{
	int retval;

    if (is_dummy) return QUILL_SUCCESS;

    if (!is_open)
		return QUILL_FAILURE;

	if (lock) {
			/* This also releases the lock on the file, were it held */
		delete lock;
		lock  = (FileLock *)0;
	}

		/* fp is associated with the outfiledes, we should be closing one or
		 * the other, but not both. Otherwise the second one will give an
		 * error.
		 */
	if (fp) {
		retval = fclose(fp);
		fp = NULL;
	}
	else {
		retval = close(outfiledes);
		if(retval < 0)
			dprintf(D_ALWAYS, "Error closing SQL log file %s : %s\n",outfilename,strerror(errno));
	}

	is_open = false;
	is_locked = false;
	outfiledes = -1;

	if (retval < 0) {
		return QUILL_FAILURE;
	}
	else {
		return QUILL_SUCCESS;
	}
}

QuillErrCode FILESQL::file_lock()
{
    if (is_dummy) return QUILL_SUCCESS;

	if(!is_open)
	{
		dprintf(D_ALWAYS,"Error locking :SQL log file %s not open yet\n",outfilename);
		return QUILL_FAILURE;
	}

	if(is_locked)
		return QUILL_SUCCESS;

	if(lock->obtain(WRITE_LOCK) == 0) /* 0 means an unsuccessful lock */
	{
		dprintf(D_ALWAYS,"Error locking SQL log file %s\n",outfilename);
		return QUILL_FAILURE;
	}
	else
		is_locked = true;

	return QUILL_SUCCESS;
}

QuillErrCode FILESQL::file_unlock()
{
    if (is_dummy) return QUILL_SUCCESS;

	if(!is_open)
	{
		dprintf(D_ALWAYS,"Error unlocking :SQL log file %s not open yet\n",outfilename);
		return QUILL_FAILURE;
	}

	if(!is_locked)
		return QUILL_SUCCESS;

	if(lock->release() == 0) /* 0 means an unsuccessful lock */
	{
		dprintf(D_ALWAYS,"Error unlocking SQL log file %s\n",outfilename);
		return QUILL_FAILURE;
	}
	else
		is_locked = false;

	return QUILL_SUCCESS;
}

int FILESQL::file_readline(MyString *buf)
{
    if (is_dummy) return TRUE;

	if(!fp)
		fp = fdopen(outfiledes, "r");

	return (buf->readLine(fp, true));
}

AttrList *FILESQL::file_readAttrList()
{
	AttrList *ad = 0;

	if(is_dummy) return ad;

	if(!fp)
		fp = fdopen(outfiledes, "r");

	int EndFlag=0;
	int ErrorFlag=0;
	int EmptyFlag=0;

    if( !( ad=new AttrList(fp,"***\n", EndFlag, ErrorFlag, EmptyFlag) ) ){
		EXCEPT("file_readAttrList Error:  Out of memory\n" );
    }

    if( ErrorFlag ) {
		dprintf( D_ALWAYS, "\t*** Warning: Bad Log file; skipping malformed Attr List\n" );
		ErrorFlag=0;
		delete ad;
		ad = 0;
    }

	if( EmptyFlag ) {
		dprintf( D_ALWAYS, "\t*** Warning: Empty Attr List\n" );
		EmptyFlag=0;
		delete ad;
		ad = 0;
    }

	return ad;
}

QuillErrCode FILESQL::file_newEvent(const char *eventType, AttrList *info) {
	int retval = 0;
	struct stat file_status;

    if (is_dummy) return QUILL_SUCCESS;
	if(!is_open)
	{
		dprintf(D_ALWAYS,"Error in logging new event to Quill SQL log : File not open\n");
		return QUILL_FAILURE;
	}

	if(file_lock() == QUILL_FAILURE) {
		return QUILL_FAILURE;
	}

	fstat(outfiledes, &file_status);

		// only write to the log if it's not exceeding the log size limit
	if (file_status.st_size < FILESIZELIMT) {
		retval = write(outfiledes,"NEW ", strlen("NEW "));
		retval = write(outfiledes,eventType, strlen(eventType));
		retval = write(outfiledes,"\n", strlen("\n"));

		MyString temp;
		const char *tempv;

		retval = sPrintAd(temp, *info);
		tempv = temp.Value();
		retval = write(outfiledes,tempv, strlen(tempv));

		retval = write(outfiledes,"***",3); /* Now the delimitor*/
		retval = write(outfiledes,"\n",1); /* Now the newline*/
	}

	if(file_unlock() == QUILL_FAILURE) {
		return QUILL_FAILURE;
	}

	if (retval < 0) {
		return QUILL_FAILURE;
	} else {
		return QUILL_SUCCESS;
	}
}

QuillErrCode FILESQL::file_updateEvent(const char *eventType,
									   AttrList *info,
									   AttrList *condition) {
	int retval = 0;
	struct stat file_status;

    if (is_dummy) return QUILL_SUCCESS;
	if(!is_open)
	{
		dprintf(D_ALWAYS,"Error in logging event to Quill SQL Log : File not open\n");
		return QUILL_FAILURE;
	}

	if(file_lock() == QUILL_FAILURE) {
		return QUILL_FAILURE;
	}

	fstat(outfiledes, &file_status);

		// only write to the log if it's not exceeding the log size limit
	if (file_status.st_size < FILESIZELIMT) {
		retval = write(outfiledes,"UPDATE ", strlen("UPDATE "));
		retval = write(outfiledes,eventType, strlen(eventType));
		retval = write(outfiledes,"\n", strlen("\n"));

		MyString temp, temp1;
		const char *tempv;

		retval = sPrintAd(temp, *info);
		tempv = temp.Value();
		retval = write(outfiledes,tempv, strlen(tempv));

		retval = write(outfiledes,"***",3); /* Now the delimitor*/
		retval = write(outfiledes,"\n",1); /* Now the newline*/

		retval = sPrintAd(temp1, *condition);
		tempv = temp1.Value();
		retval = write(outfiledes,tempv, strlen(tempv));

		retval = write(outfiledes,"***",3); /* Now the delimitor*/
		retval = write(outfiledes,"\n",1); /* Now the newline*/
	}

	if(file_unlock() == QUILL_FAILURE) {
		return QUILL_FAILURE;
	}

	if (retval < 0) {
		return QUILL_FAILURE;
	} else {
		return QUILL_SUCCESS;
	}
}

#if 0
QuillErrCode FILESQL::file_deleteEvent(const char *eventType,
									   AttrList *condition) {
	int retval = 0;
	struct stat file_status;

	if(!is_open)
	{
		dprintf(D_ALWAYS,"Error in logging to file : File not open\n");
		return QUILL_FAILURE;
	}

	if(file_lock() == QUILL_FAILURE) {
		return QUILL_FAILURE;
	}

	fstat(outfiledes, &file_status);

		// only write to the log if it's not exceeding the log size limit
	if (file_status.st_size < FILESIZELIMT) {
		retval = write(outfiledes,"DELETE ", strlen("DELETE "));
		retval = write(outfiledes,eventType, strlen(eventType));
		retval = write(outfiledes,"\n", strlen("\n"));

		MyString temp;
		const char *tempv;

		retval = sPrintAd(temp, *condition);
		tempv = temp.Value();
		retval = write(outfiledes,tempv, strlen(tempv));

		retval = write(outfiledes,"***",3); /* Now the delimitor*/
		retval = write(outfiledes,"\n",1); /* Now the newline*/
	}

	if(file_unlock() == QUILL_FAILURE) {
		return QUILL_FAILURE;
	}

	if (retval < 0) {
		return QUILL_FAILURE;
	}
	else {
		return QUILL_SUCCESS;
	}

}
#endif

/* We put FileObj definition here because modules such as file_transfer.o and
 * classad_log.o uses FILEObj and they are part of cplus_lib.a. This way we
 * won't get the FILEObj undefined error during compilation of any code which
 * needs cplus_lib.a. Notice the FILEObj is just a pointer, the real object
 * should be created only when a real database connection is needed. E.g.
 * most daemons need database connection, there we can create a database
 * connection in the  main function of daemon process.
 */

FILESQL *FILEObj = NULL;

/*static */ FILESQL *
FILESQL::createInstance(bool use_sql_log) {
	if ( !use_sql_log ) {
		return NULL;
	}

	FILESQL *ptr = NULL;
	MyString outfilename = "";

	MyString param_name;
	param_name.formatstr("%s_SQLLOG", get_mySubSystem()->getName());

	char *tmp = param(param_name.Value());
	if( tmp ) {
		outfilename = tmp;
		free(tmp);
	}
	else {
		tmp = param ("LOG");

		if (tmp) {
			outfilename.formatstr("%s/sql.log", tmp);
			free(tmp);
		}
		else {
			outfilename.formatstr("sql.log");
		}
	}

	ptr = new FILESQL(outfilename.Value(), O_WRONLY|O_CREAT|O_APPEND, use_sql_log);

	if (ptr->file_open() == QUILL_FAILURE) {
		dprintf(D_ALWAYS, "FILESQL createInstance failed\n");
	}

	return ptr;
}

/*static */ void
FILESQL::daemonAdInsert(
ClassAd *cl,
const char *adType,
FILESQL *dbh,
int &prevLHF)
{
	ClassAd clCopy;
	MyString tmp;

		// make a copy so that we can add timestamp attribute into it
	clCopy = *cl;

	tmp.formatstr("%s = %d", "PrevLastReportedTime", prevLHF);
	(&clCopy)->Insert(tmp.Value());

		// set the lastReportedTime and make it the new prevLHF
	prevLHF = (int)time(NULL);

	tmp.formatstr("%s = %d", "LastReportedTime", prevLHF);
	(&clCopy)->Insert(tmp.Value());

	ASSERT( dbh );
	dbh->file_newEvent(adType, &clCopy);
}


text:
namespace media {

namespace {

constexpr uint32_t kMPEG1StartCodeMask = 0xffe00000;

// Maps version and layer information in the frame header
// into an index for the |kBitrateMap|.
// Derived from: http://mpgedit.org/mpgedit/mpeg_format/MP3Format.html
constexpr int kVersionLayerMap[4][4] = {
    // { reserved, L3, L2, L1 }
    {5, 4, 4, 3},  // MPEG 2.5
    {5, 5, 5, 5},  // reserved
    {5, 4, 4, 3},  // MPEG 2
    {5, 2, 1, 0}   // MPEG 1
};

// Maps the bitrate index field in the header and an index
// from |kVersionLayerMap| to a frame bitrate.
// Derived from: http://mpgedit.org/mpgedit/mpeg_format/MP3Format.html
constexpr int kBitrateMap[16][6] = {
    // { V1L1, V1L2, V1L3, V2L1, V2L2 & V2L3, reserved }
    {0, 0, 0, 0, 0, 0},           {32, 32, 32, 32, 8, 0},
    {64, 48, 40, 48, 16, 0},      {96, 56, 48, 56, 24, 0},
    {128, 64, 56, 64, 32, 0},     {160, 80, 64, 80, 40, 0},
    {192, 96, 80, 96, 48, 0},     {224, 112, 96, 112, 56, 0},
    {256, 128, 112, 128, 64, 0},  {288, 160, 128, 144, 80, 0},
    {320, 192, 160, 160, 96, 0},  {352, 224, 192, 176, 112, 0},
    {384, 256, 224, 192, 128, 0}, {416, 320, 256, 224, 144, 0},
    {448, 384, 320, 256, 160, 0}, {0, 0, 0, 0, 0}};

// Maps the sample rate index and version fields from the frame header
// to a sample rate.
// Derived from: http://mpgedit.org/mpgedit/mpeg_format/MP3Format.html
constexpr int kSampleRateMap[4][4] = {
    // { V2.5, reserved, V2, V1 }
    {11025, 0, 22050, 44100},
    {12000, 0, 24000, 48000},
    {8000, 0, 16000, 32000},
    {0, 0, 0, 0}};

// Offset in bytes from the end of the MP3 header to "Xing" or "Info" tags which
// indicate a frame is silent metadata frame.  Values taken from FFmpeg.
constexpr int kXingHeaderMap[2][2] = {{32, 17}, {17, 9}};

// Frame header field constants.
constexpr int kBitrateFree = 0;
constexpr int kBitrateBad = 0xf;
constexpr int kSampleRateReserved = 3;
constexpr int kCodecDelay = 529;

}  // namespace

// static
bool MPEG1AudioStreamParser::ParseHeader(MediaLog* media_log,
                                         size_t* media_log_limit,
                                         const uint8_t* data,
                                         Header* header) {
  BitReader reader(data, kHeaderSize);
  int sync;
  int version;
  int layer;
  int is_protected;
  int bitrate_index;
  int sample_rate_index;
  int has_padding;
  int is_private;
  int channel_mode;
  int other_flags;

  if (!reader.ReadBits(11, &sync) || !reader.ReadBits(2, &version) ||
      !reader.ReadBits(2, &layer) || !reader.ReadBits(1, &is_protected) ||
      !reader.ReadBits(4, &bitrate_index) ||
      !reader.ReadBits(2, &sample_rate_index) ||
      !reader.ReadBits(1, &has_padding) || !reader.ReadBits(1, &is_private) ||
      !reader.ReadBits(2, &channel_mode) || !reader.ReadBits(6, &other_flags)) {
    return false;
  }

  DVLOG(2) << "Header data :" << std::hex << " sync 0x" << sync << " version 0x"
           << version << " layer 0x" << layer << " bitrate_index 0x"
           << bitrate_index << " sample_rate_index 0x" << sample_rate_index
           << " channel_mode 0x" << channel_mode;

  if (sync != 0x7ff || version == kVersionReserved || layer == kLayerReserved ||
      bitrate_index == kBitrateFree || bitrate_index == kBitrateBad ||
      sample_rate_index == kSampleRateReserved) {
    if (media_log) {
      LIMITED_MEDIA_LOG(DEBUG, media_log, *media_log_limit, 5)
          << "Invalid MP3 header data :" << std::hex << " sync 0x" << sync
          << " version 0x" << version << " layer 0x" << layer
          << " bitrate_index 0x" << bitrate_index << " sample_rate_index 0x"
          << sample_rate_index << " channel_mode 0x" << channel_mode;
    }
    return false;
  }

  // Note: For MPEG2 we don't check if a given bitrate or channel layout is
  // allowed per spec since all tested decoders don't seem to care.

  int bitrate = kBitrateMap[bitrate_index][kVersionLayerMap[version][layer]];

  if (bitrate == 0) {
    if (media_log) {
      LIMITED_MEDIA_LOG(DEBUG, media_log, *media_log_limit, 5)
          << "Invalid MP3 bitrate :" << std::hex << " version " << version
          << " layer " << layer << " bitrate_index " << bitrate_index;
    }
    return false;
  }

  DVLOG(2) << " bitrate " << bitrate;

  int frame_sample_rate = kSampleRateMap[sample_rate_index][version];
  if (frame_sample_rate == 0) {
    if (media_log) {
      LIMITED_MEDIA_LOG(DEBUG, media_log, *media_log_limit, 5)
          << "Invalid MP3 sample rate :" << std::hex << " version " << version
          << " sample_rate_index " << sample_rate_index;
    }
    return false;
  }

  // http://teslabs.com/openplayer/docs/docs/specs/mp3_structure2.pdf
  // Table 2.1.5
  int samples_per_frame;
  switch (layer) {
    case kLayer1:
      samples_per_frame = 384;
      break;

    case kLayer2:
      samples_per_frame = 1152;
      break;

    case kLayer3:
      if (version == kVersion2 || version == kVersion2_5) {
        samples_per_frame = 576;
      } else {
        samples_per_frame = 1152;
      }
      break;

    default:
      return false;
  }

  if (!header)
    return true;

  header->sample_rate = frame_sample_rate;
  header->sample_count = samples_per_frame;

  // http://teslabs.com/openplayer/docs/docs/specs/mp3_structure2.pdf
  // Text just below Table 2.1.5.
  if (layer == kLayer1) {
    // This formulation is a slight variation on the equation below,
    // but has slightly different truncation characteristics to deal
    // with the fact that Layer 1 has 4 byte "slots" instead of single
    // byte ones.
    header->frame_size = 4 * (12 * bitrate * 1000 / frame_sample_rate);
  } else {
    header->frame_size =
        ((samples_per_frame / 8) * bitrate * 1000) / frame_sample_rate;
  }

  if (has_padding)
    header->frame_size += (layer == kLayer1) ? 4 : 1;

  // Map Stereo(0), Joint Stereo(1), and Dual Channel (2) to
  // CHANNEL_LAYOUT_STEREO and Single Channel (3) to CHANNEL_LAYOUT_MONO.
  header->channel_layout =
      (channel_mode == 3) ? CHANNEL_LAYOUT_MONO : CHANNEL_LAYOUT_STEREO;

  header->version = static_cast<Version>(version);
  header->layer = static_cast<Layer>(layer);
  header->channel_mode = channel_mode;
  return true;
}

MPEG1AudioStreamParser::MPEG1AudioStreamParser()
    : MPEGAudioStreamParserBase(kMPEG1StartCodeMask,
                                AudioCodec::kMP3,
                                kCodecDelay) {}

MPEG1AudioStreamParser::~MPEG1AudioStreamParser() = default;

int MPEG1AudioStreamParser::ParseFrameHeader(const uint8_t* data,
                                             int size,
                                             int* frame_size,
                                             int* sample_rate,
                                             ChannelLayout* channel_layout,
                                             int* sample_count,
                                             bool* metadata_frame,
                                             std::vector<uint8_t>* extra_data) {
  DCHECK(data);
  DCHECK_GE(size, 0);
  DCHECK(frame_size);

  if (size < kHeaderSize)
    return 0;

  Header header;
  if (!ParseHeader(media_log(), &mp3_parse_error_limit_, data, &header))
    return -1;

  *frame_size = header.frame_size;
  if (sample_rate)
    *sample_rate = header.sample_rate;
  if (sample_count)
    *sample_count = header.sample_count;
  if (channel_layout)
    *channel_layout = header.channel_layout;
  if (metadata_frame)
    *metadata_frame = false;

  const int header_bytes_read = kHeaderSize;
  if (header.layer != kLayer3)
    return header_bytes_read;

  // Check if this is a XING frame and tell the base parser to skip it if so.
  const int xing_header_index =
      kXingHeaderMap[header.version == kVersion2 ||
                     header.version == kVersion2_5][header.channel_mode == 3];
  uint32_t tag = 0;

  // It's not a XING frame if the frame isn't big enough to be one.
  if (*frame_size <
      header_bytes_read + xing_header_index + static_cast<int>(sizeof(tag))) {
    return header_bytes_read;
  }

  // If we don't have enough data available to check, return 0 so frame parsing
  // will be retried once more data is available.
  BitReader reader(data + header_bytes_read, size - header_bytes_read);
  if (!reader.SkipBits(xing_header_index * 8) ||
      !reader.ReadBits(sizeof(tag) * 8, &tag)) {
    return 0;
  }

  // Check to see if the tag contains 'Xing' or 'Info'
  if (tag == 0x496e666f || tag == 0x58696e67) {
    MEDIA_LOG(DEBUG, media_log()) << "Skipping XING header.";
    if (metadata_frame)
      *metadata_frame = true;
    return header_bytes_read + reader.bits_read() / 8;
  }

  // If it wasn't a XING frame, just return the number consumed bytes.
  return header_bytes_read;
}

}  // namespace media


text:
from nipype.testing import assert_equal
from nipype.interfaces.base import BaseInterface

def test_BaseInterface_inputs():
    input_map = dict(ignore_exception=dict(nohash=True,
    usedefault=True,
    ),
    )
    inputs = BaseInterface.input_spec()

    for key, metadata in input_map.items():
        for metakey, value in metadata.items():
            yield assert_equal, getattr(inputs.traits()[key], metakey), value


text:
require 'rails_helper'

describe 'application/_auth.html.haml', type: :view do

  context 'when there is a current_user' do

    before(:each) do
      @user = User.create email: 'tim@example.com'

      allow(view).to receive(:current_user).and_return(@user)

      render
    end

    it 'should display logout link' do
      expect(rendered).to include 'Get a new sign in email'
    end

  end

  context 'when there is no current_user' do

    before(:each) do
      allow(view).to receive(:current_user).and_return(nil)

      render
    end

    it 'should display the login form' do
      assert_select('input[name="email"]')
      assert_select('button[type="submit"]')
    end

  end

end


text:
package org.springframework.boot.logging;

import java.net.URLClassLoader;
import java.util.Arrays;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.boot.context.event.ApplicationFailedEvent;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.event.SmartApplicationListener;
import org.springframework.core.Ordered;

/**
 * A {@link SmartApplicationListener} that reacts to {@link ApplicationStartedEvent start
 * events} by logging the classpath of the thread context class loader (TCCL) at
 * {@code DEBUG} level and to {@link ApplicationFailedEvent error events} by logging the
 * TCCL's classpath at {@code INFO} level.
 *
 * @author Andy Wilkinson
 */
public final class ClasspathLoggingApplicationListener implements
		SmartApplicationListener {

	private static final int ORDER = Ordered.HIGHEST_PRECEDENCE + 12;

	private final Log logger = LogFactory.getLog(getClass());

	@Override
	public void onApplicationEvent(ApplicationEvent event) {
		if (event instanceof ApplicationStartedEvent) {
			if (this.logger.isDebugEnabled()) {
				this.logger
						.debug("Application started with classpath: " + getClasspath());
			}
		}
		else if (event instanceof ApplicationFailedEvent) {
			if (this.logger.isInfoEnabled()) {
				this.logger.info("Application failed to start with classpath: "
						+ getClasspath());
			}
		}
	}

	@Override
	public int getOrder() {
		return ORDER;
	}

	@Override
	public boolean supportsEventType(Class<? extends ApplicationEvent> type) {
		return ApplicationStartedEvent.class.isAssignableFrom(type)
				|| ApplicationFailedEvent.class.isAssignableFrom(type);
	}

	@Override
	public boolean supportsSourceType(Class<?> sourceType) {
		return true;
	}

	private String getClasspath() {
		ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
		if (classLoader instanceof URLClassLoader) {
			return Arrays.toString(((URLClassLoader) classLoader).getURLs());
		}
		return "unknown";
	}

}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.communication.chat.implementation.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** The CreateChatThreadOptions model. */
@Fluent
public final class CreateChatThreadOptions {
    /*
     * The chat thread topic.
     */
    @JsonProperty(value = "topic", required = true)
    private String topic;

    /*
     * Members to be added to the chat thread.
     */
    @JsonProperty(value = "members", required = true)
    private List<ChatThreadMember> members;

    /**
     * Get the topic property: The chat thread topic.
     *
     * @return the topic value.
     */
    public String getTopic() {
        return this.topic;
    }

    /**
     * Set the topic property: The chat thread topic.
     *
     * @param topic the topic value to set.
     * @return the CreateChatThreadOptions object itself.
     */
    public CreateChatThreadOptions setTopic(String topic) {
        this.topic = topic;
        return this;
    }

    /**
     * Get the members property: Members to be added to the chat thread.
     *
     * @return the members value.
     */
    public List<ChatThreadMember> getMembers() {
        return this.members;
    }

    /**
     * Set the members property: Members to be added to the chat thread.
     *
     * @param members the members value to set.
     * @return the CreateChatThreadOptions object itself.
     */
    public CreateChatThreadOptions setMembers(List<ChatThreadMember> members) {
        this.members = members;
        return this;
    }
}


text:
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using System.Collections.Generic;

namespace Microsoft.CodeAnalysis.FlowAnalysis
{
    internal static class ControlFlowRegionExtensions
    {
        public static bool ContainsRegionOrSelf(this ControlFlowRegion controlFlowRegion, ControlFlowRegion nestedRegion)
            => controlFlowRegion.FirstBlockOrdinal <= nestedRegion.FirstBlockOrdinal &&
            controlFlowRegion.LastBlockOrdinal >= nestedRegion.LastBlockOrdinal;

        public static IEnumerable<IOperation> DescendantOperations(this ControlFlowRegion controlFlowRegion, ControlFlowGraph cfg)
        {
            for (var i = controlFlowRegion.FirstBlockOrdinal; i <= controlFlowRegion.LastBlockOrdinal; i++)
            {
                var block = cfg.Blocks[i];
                foreach (var operation in block.DescendantOperations())
                {
                    yield return operation;
                }
            }
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using Microsoft.SharePoint.Client;
using SharePointPnP.PowerShell.CmdletHelpAttributes;
using SharePointPnP.PowerShell.Commands.Enums;
using Resources = SharePointPnP.PowerShell.Commands.Properties.Resources;

namespace SharePointPnP.PowerShell.Commands.Branding
{
    [Cmdlet(VerbsCommon.Remove, "PnPJavaScriptLink", SupportsShouldProcess = true)]
    [CmdletAlias("Remove-SPOJavaScriptLink")]
    [CmdletHelp("Removes a JavaScript link or block from a web or sitecollection",
        Category = CmdletHelpCategory.Branding)]
    [CmdletExample(Code = "PS:> Remove-PnPJavaScriptLink -Name jQuery",
                Remarks = "Removes the injected JavaScript file with the name jQuery from the current web after confirmation",
                SortOrder = 1)]
    [CmdletExample(Code = "PS:> Remove-PnPJavaScriptLink -Name jQuery -Scope Site",
                Remarks = "Removes the injected JavaScript file with the name jQuery from the current site collection after confirmation",
                SortOrder = 2)]
    [CmdletExample(Code = "PS:> Remove-PnPJavaScriptLink -Name jQuery -Scope Site -Force",
                Remarks = "Removes the injected JavaScript file with the name jQuery from the current site collection and will not ask for confirmation",
                SortOrder = 3)]
    [CmdletExample(Code = "PS:> Remove-PnPJavaScriptLink -Scope Site",
                Remarks = "Removes all the injected JavaScript files with from the current site collection after confirmation for each of them",
                SortOrder = 4)]
    public class RemoveJavaScriptLink : SPOWebCmdlet
    {
        [Parameter(Mandatory = false, ValueFromPipeline = true, Position = 0, HelpMessage = "Name of the JavaScriptLink to remove. Omit if you want to remove all JavaScript Links.")]
        [Alias("Key")]
        public string Name = string.Empty;

        [Parameter(Mandatory = false)]
        [Obsolete("Use Scope parameter")]
        public SwitchParameter FromSite;

        [Parameter(Mandatory = false, HelpMessage = "Use the -Force flag to bypass the confirmation question")]
        public SwitchParameter Force;

        [Parameter(Mandatory = false, HelpMessage = "Define if the JavaScriptLink is to be found at the web or site collection scope. Specify All to allow deletion from either web or site collection.")]
        public CustomActionScope Scope = CustomActionScope.Web;

        protected override void ExecuteCmdlet()
        {
            // Following code to handle desprecated parameter
            if (MyInvocation.BoundParameters.ContainsKey("FromSite"))
            {
                Scope = CustomActionScope.Site;
            }

            List<UserCustomAction> actions = new List<UserCustomAction>();

            if (Scope == CustomActionScope.All || Scope == CustomActionScope.Web)
            {
                actions.AddRange(SelectedWeb.GetCustomActions().Where(c => c.Location == "ScriptLink"));
            }
            if (Scope == CustomActionScope.All || Scope == CustomActionScope.Site)
            {
                actions.AddRange(ClientContext.Site.GetCustomActions().Where(c => c.Location == "ScriptLink"));
            }

            if (!actions.Any()) return;

            if(!string.IsNullOrEmpty(Name))
            {
                actions = actions.Where(action => action.Name == Name).ToList();
            }

            foreach (var action in actions.Where(action => Force || ShouldContinue(string.Format(Resources.RemoveJavaScript0, action.Name), Resources.Confirm)))
            {
                switch (action.Scope)
                {
                    case UserCustomActionScope.Web:
                        SelectedWeb.DeleteJsLink(action.Name);
                        break;

                    case UserCustomActionScope.Site:
                        ClientContext.Site.DeleteJsLink(action.Name);
                        break;
                }
            }
        }
    }
}


text:
// @allowjs: true
// @checkJs: true
// @noEmit: true

// @filename: a.js
////// @ts-check
////let x = "";
////[|x|] = 1;

// verify.codeFixAvailable([
//     { description: ts.Diagnostics.Ignore_this_error_message.message },
//     { description: ts.Diagnostics.Disable_checking_for_this_file.message }
// ]);

verify.codeFix({
    description: ts.Diagnostics.Disable_checking_for_this_file.message,
    index: 1,
    newFileContent:
`// @ts-nocheck
let x = "";
x = 1;`,
});


text:
package adminserver

import (
	"context"
	"fmt"
	"testing"
	"time"

	"github.com/golang/mock/gomock"
	"github.com/golang/protobuf/proto" //nolint:staticcheck
	"github.com/golang/protobuf/ptypes"
	"github.com/google/keytransparency/core/directory"
	"github.com/google/keytransparency/core/fake"
	spb "github.com/google/keytransparency/core/sequencer/sequencer_go_proto"
	"github.com/google/trillian/crypto/keys/der"
	"github.com/google/trillian/crypto/keyspb"
	"github.com/google/trillian/storage/testdb"
	"github.com/google/trillian/testonly"
	"github.com/google/trillian/testonly/integration"
	"google.golang.org/grpc/codes"
	"google.golang.org/grpc/status"

	pb "github.com/google/keytransparency/core/api/v1/keytransparency_go_proto"
	tpb "github.com/google/trillian"

	_ "github.com/google/trillian/crypto/keys/der/proto" // Register PrivateKey ProtoHandler
	_ "github.com/google/trillian/merkle/coniks"         // Register hasher
	_ "github.com/google/trillian/merkle/rfc6962"        // Register hasher
)

func vrfKeyGen(ctx context.Context, spec *keyspb.Specification) (proto.Message, error) {
	return der.NewProtoFromSpec(spec)
}

type miniEnv struct {
	ms             *testonly.MockServer
	srv            *Server
	stopMockServer func()
	stopController func()
}

func newMiniEnv(ctx context.Context, t *testing.T) (*miniEnv, error) {
	fakeDirectories := fake.NewDirectoryStorage()
	dir := &directory.Directory{DirectoryID: "existingdirectory"}
	if err := fakeDirectories.Write(ctx, dir); err != nil {
		return nil, fmt.Errorf("admin.Write(): %v", err)
	}

	ctrl := gomock.NewController(t)
	s, stopFakeServer, err := testonly.NewMockServer(ctrl)
	if err != nil {
		return nil, fmt.Errorf("error starting fake server: %v", err)
	}
	srv := New(s.LogClient, s.MapClient, s.AdminClient, s.AdminClient, fakeDirectories, nil, fakeBatcher{}, vrfKeyGen)

	return &miniEnv{
		ms:             s,
		srv:            srv,
		stopController: ctrl.Finish,
		stopMockServer: stopFakeServer,
	}, nil
}

func (e *miniEnv) Close() {
	e.stopController()
	e.stopMockServer()
}

type fakeQueueAdmin struct{}

func (fakeQueueAdmin) AddLogs(_ context.Context, _ string, _ ...int64) error          { return nil }
func (fakeQueueAdmin) SetWritable(_ context.Context, _ string, _ int64, _ bool) error { return nil }
func (fakeQueueAdmin) ListLogs(_ context.Context, _ string, _ bool) ([]int64, error)  { return nil, nil }

type fakeBatcher struct{}

func (fakeBatcher) WriteBatchSources(_ context.Context, _ string, _ int64, _ *spb.MapMetadata) error {
	return nil
}

func TestCreateDirectory(t *testing.T) {
	for _, tc := range []struct {
		desc        string
		directoryID string
		wantCode    codes.Code
		expect      func(*miniEnv)
	}{
		{
			desc:        "Already Exists",
			directoryID: "existingdirectory",
			wantCode:    codes.AlreadyExists,
			expect:      func(e *miniEnv) {},
		},
		{
			desc:        "Create map fails",
			directoryID: "mapinitfails",
			wantCode:    codes.Internal,
			expect: func(e *miniEnv) {
				e.ms.Admin.EXPECT().CreateTree(gomock.Any(), gomock.Any()).Return(&tpb.Tree{TreeType: tpb.TreeType_PREORDERED_LOG}, nil)
				e.ms.Log.EXPECT().InitLog(gomock.Any(), gomock.Any()).Return(&tpb.InitLogResponse{}, nil)
				e.ms.Log.EXPECT().GetLatestSignedLogRoot(gomock.Any(), gomock.Any()).Return(&tpb.GetLatestSignedLogRootResponse{}, nil)
				e.ms.Admin.EXPECT().CreateTree(gomock.Any(), gomock.Any()).Return(&tpb.Tree{TreeType: tpb.TreeType_MAP}, nil)
				e.ms.Map.EXPECT().InitMap(gomock.Any(), gomock.Any()).Return(&tpb.InitMapResponse{}, nil)
				e.ms.Map.EXPECT().GetSignedMapRootByRevision(gomock.Any(), gomock.Any()).
					Return(&tpb.GetSignedMapRootResponse{}, status.Errorf(codes.FailedPrecondition, "tree needs init")).MinTimes(1)
			},
		},
		{
			desc:        "log init with map root fails",
			directoryID: "initfails",
			wantCode:    codes.Internal,
			expect: func(e *miniEnv) {
				e.ms.Admin.EXPECT().CreateTree(gomock.Any(), gomock.Any()).Return(&tpb.Tree{TreeType: tpb.TreeType_PREORDERED_LOG}, nil)
				e.ms.Log.EXPECT().InitLog(gomock.Any(), gomock.Any()).Return(&tpb.InitLogResponse{}, nil)
				e.ms.Log.EXPECT().GetLatestSignedLogRoot(gomock.Any(), gomock.Any()).Return(&tpb.GetLatestSignedLogRootResponse{}, nil)
				e.ms.Admin.EXPECT().CreateTree(gomock.Any(), gomock.Any()).Return(&tpb.Tree{TreeType: tpb.TreeType_MAP}, nil)
				e.ms.Map.EXPECT().InitMap(gomock.Any(), gomock.Any()).Return(&tpb.InitMapResponse{}, nil)
				e.ms.Map.EXPECT().GetSignedMapRootByRevision(gomock.Any(), gomock.Any()).
					Return(&tpb.GetSignedMapRootResponse{}, nil).MinTimes(1)
				// Verify that we delete the log and map when the sequencer's init fails.
				// In this case the sequencer's init fails because it can't create a verifier for a fake tree. HashStrategy is UNKNOWN.
				e.ms.Admin.EXPECT().DeleteTree(gomock.Any(), gomock.Any()).Return(&tpb.Tree{}, nil).MinTimes(2)
			},
		},
	} {
		t.Run(tc.desc, func(t *testing.T) {
			ctx, cancel := context.WithTimeout(context.Background(), 500*time.Millisecond)
			defer cancel()
			e, err := newMiniEnv(ctx, t)
			if err != nil {
				t.Fatalf("newMiniEnv(): %v", err)
			}
			defer e.Close()

			tc.expect(e)

			if _, err := e.srv.CreateDirectory(ctx, &pb.CreateDirectoryRequest{
				DirectoryId: tc.directoryID,
				MinInterval: ptypes.DurationProto(60 * time.Hour),
				MaxInterval: ptypes.DurationProto(60 * time.Hour),
			}); status.Code(err) != tc.wantCode {
				t.Errorf("CreateDirectory(): %v, want %v", err, tc.wantCode)
			}
		})
	}
}

func TestCreateRead(t *testing.T) {
	testdb.SkipIfNoMySQL(t)
	ctx := context.Background()
	storage := fake.NewDirectoryStorage()

	// Map server
	mapEnv, err := integration.NewMapEnv(ctx, false)
	if err != nil {
		t.Fatalf("Failed to create trillian map server: %v", err)
	}

	// Log server
	numSequencers := 1
	unused := ""
	logEnv, err := integration.NewLogEnv(ctx, numSequencers, unused)
	if err != nil {
		t.Fatalf("Failed to create trillian log server: %v", err)
	}

	svr := New(logEnv.Log, mapEnv.Map, logEnv.Admin, mapEnv.Admin, storage, fakeQueueAdmin{}, fakeBatcher{}, vrfKeyGen)

	for _, tc := range []struct {
		directoryID              string
		minInterval, maxInterval time.Duration
	}{
		{
			directoryID: "testdirectory",
			minInterval: 1 * time.Second,
			maxInterval: 5 * time.Second,
		},
	} {
		_, err := svr.CreateDirectory(ctx, &pb.CreateDirectoryRequest{
			DirectoryId: tc.directoryID,
			MinInterval: ptypes.DurationProto(tc.minInterval),
			MaxInterval: ptypes.DurationProto(tc.maxInterval),
		})
		if err != nil {
			t.Fatalf("CreateDirectory(): %v", err)
		}
		directory, err := svr.GetDirectory(ctx, &pb.GetDirectoryRequest{DirectoryId: tc.directoryID})
		if err != nil {
			t.Fatalf("GetDirectory(): %v", err)
		}
		if got, want := directory.Log.TreeType, tpb.TreeType_PREORDERED_LOG; got != want {
			t.Errorf("Log.TreeType: %v, want %v", got, want)
		}
		if got, want := directory.Map.TreeType, tpb.TreeType_MAP; got != want {
			t.Errorf("Map.TreeType: %v, want %v", got, want)
		}
	}
}

func TestDelete(t *testing.T) {
	testdb.SkipIfNoMySQL(t)
	ctx := context.Background()
	storage := fake.NewDirectoryStorage()

	// Map server
	mapEnv, err := integration.NewMapEnv(ctx, false)
	if err != nil {
		t.Fatalf("Failed to create trillian map server: %v", err)
	}

	// Log server
	numSequencers := 1
	unused := ""
	logEnv, err := integration.NewLogEnv(ctx, numSequencers, unused)
	if err != nil {
		t.Fatalf("Failed to create trillian log server: %v", err)
	}

	svr := New(logEnv.Log, mapEnv.Map, logEnv.Admin, mapEnv.Admin, storage, fakeQueueAdmin{}, fakeBatcher{}, vrfKeyGen)

	for _, tc := range []struct {
		directoryID              string
		minInterval, maxInterval time.Duration
	}{
		{
			directoryID: "testdirectory",
			minInterval: 1 * time.Second,
			maxInterval: 5 * time.Second,
		},
	} {
		if _, err := svr.CreateDirectory(ctx, &pb.CreateDirectoryRequest{
			DirectoryId: tc.directoryID,
			MinInterval: ptypes.DurationProto(tc.minInterval),
			MaxInterval: ptypes.DurationProto(tc.maxInterval),
		}); err != nil {
			t.Fatalf("CreateDirectory(): %v", err)
		}
		if _, err := svr.DeleteDirectory(ctx, &pb.DeleteDirectoryRequest{DirectoryId: tc.directoryID}); err != nil {
			t.Fatalf("DeleteDirectory(): %v", err)
		}
		if _, err := svr.GarbageCollect(ctx, &pb.GarbageCollectRequest{
			Before: ptypes.TimestampNow(),
		}); err != nil {
			t.Fatalf("GarbageCollect(): %v", err)
		}
		_, err = svr.GetDirectory(ctx, &pb.GetDirectoryRequest{DirectoryId: tc.directoryID, ShowDeleted: true})
		if got, want := status.Code(err), codes.NotFound; got != want {
			t.Fatalf("GetDirectory(): %v, want %v", got, want)
		}
	}
}

func TestListDirectories(t *testing.T) {
	testdb.SkipIfNoMySQL(t)
	ctx := context.Background()
	storage := fake.NewDirectoryStorage()

	// Map server
	mapEnv, err := integration.NewMapEnv(ctx, false)
	if err != nil {
		t.Fatalf("Failed to create trillian map server: %v", err)
	}

	// Log server
	numSequencers := 1
	unused := ""
	logEnv, err := integration.NewLogEnv(ctx, numSequencers, unused)
	if err != nil {
		t.Fatalf("Failed to create trillian log server: %v", err)
	}

	svr := New(logEnv.Log, mapEnv.Map, logEnv.Admin, mapEnv.Admin, storage, fakeQueueAdmin{}, fakeBatcher{}, vrfKeyGen)

	for _, tc := range []struct {
		directoryIDs []string
	}{
		{
			directoryIDs: []string{"A", "B"},
		},
	} {
		for _, directory := range tc.directoryIDs {
			if _, err := svr.CreateDirectory(ctx, &pb.CreateDirectoryRequest{
				DirectoryId: directory,
				MinInterval: ptypes.DurationProto(60 * time.Hour),
				MaxInterval: ptypes.DurationProto(60 * time.Hour),
			}); err != nil {
				t.Fatalf("CreateDirectory(%v): %v", directory, err)
			}
		}
		resp, err := svr.ListDirectories(ctx, &pb.ListDirectoriesRequest{})
		if err != nil {
			t.Fatalf("ListDirectories(): %v", err)
		}
		// Make sure we got all the same directories back.
		want := make(map[string]bool)
		for _, d := range tc.directoryIDs {
			want[d] = true
		}
		for _, d := range resp.GetDirectories() {
			directoryID := d.GetDirectoryId()
			if ok := want[directoryID]; !ok {
				t.Errorf("Did not find directory %v in list response", directoryID)
			}
		}
	}
}


text:
@interface MBSetupController (Friend)
- (void)pageControllerProceedToPreviousPage:(UIViewController *)controller;
- (void)pageControllerProceedToNextPage:(UIViewController *)controller;
@end

@interface MBBasePageController ()
@property (nonatomic) NSLayoutConstraint *leftMarginConstraint;
@property (nonatomic) NSLayoutConstraint *rightMarginConstraint;
@end

@implementation MBBasePageController

- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
    self = [super initWithCoder:aDecoder];
    if (self) {
        _horizontalMargin = PAGE_DEFAULT_HORIZONTAL_MARGIN;
        _automaticallyAdjustMargins = YES;
    }
    return self;
}

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        _horizontalMargin = PAGE_DEFAULT_HORIZONTAL_MARGIN;
        _automaticallyAdjustMargins = YES;
    }
    return self;
}

- (void)setHidesBackButton:(BOOL)hide
{
    _hidesBackButton = hide;
    self.navigationItem.hidesBackButton = hide;
}

- (void)setHidesNextButton:(BOOL)hide
{
    _hidesNextButton = hide;
    [self configureBarButtonItemsAnimated:NO];
}

- (void)configureBarButtonItemsAnimated:(BOOL)animate
{
    if (!_nextButtonItem) {
        _nextButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Next" style:UIBarButtonItemStylePlain target:self action:@selector(nextTap:)];
    }

    UINavigationItem *navItem = self.navigationItem;
    navItem.hidesBackButton = self.hidesBackButton;

    BOOL shouldPresentNextButton = !self.hidesNextButton;
    BOOL presentingNextButton = [navItem.rightBarButtonItems containsObject:_nextButtonItem];

    NSMutableArray *mutableRightBarButtonItems = [navItem.rightBarButtonItems mutableCopy];

    if (shouldPresentNextButton && !presentingNextButton) {
        //Add next button
        if (!mutableRightBarButtonItems) {
            mutableRightBarButtonItems = [NSMutableArray new];
        }

        [mutableRightBarButtonItems addObject:_nextButtonItem];
        [navItem setRightBarButtonItems:mutableRightBarButtonItems animated:animate];
    } else {
        //Remove next button
        [mutableRightBarButtonItems removeObject:_nextButtonItem];
        [navItem setRightBarButtonItems:mutableRightBarButtonItems animated:animate];
    }
}

- (IBAction)nextTap:(id)sender
{
    BOOL success = YES;

    UIView *firstResponder = [self.view mbFindFirstResponder];
    if (firstResponder) {
        success = [firstResponder resignFirstResponder];
    }

    [self handleNextButtonTap];
}

- (void)adjustMargins
{
    if (!self.automaticallyAdjustMargins) {
        return;
    }

    CGFloat margin = 0.0;
    if (self.mbIsRegularHorizontalSizeClass) {
        margin = self.horizontalMargin;
    }

    _leftMarginConstraint.constant = margin;
    _rightMarginConstraint.constant = margin;
}

- (void)addContentView
{
    UIView *contentView = [[UIView alloc] init];
    contentView.translatesAutoresizingMaskIntoConstraints = NO;
    [self.view addSubview:contentView];

    _leftMarginConstraint = [NSLayoutConstraint constraintWithItem:contentView
                                                         attribute:NSLayoutAttributeLeading
                                                         relatedBy:NSLayoutRelationEqual
                                                            toItem:self.view
                                                         attribute:NSLayoutAttributeLeading
                                                        multiplier:1.0
                                                          constant:0];
    [self.view addConstraint:_leftMarginConstraint];

    _rightMarginConstraint = [NSLayoutConstraint constraintWithItem:self.view
                                                          attribute:NSLayoutAttributeTrailing
                                                          relatedBy:NSLayoutRelationEqual
                                                             toItem:contentView
                                                          attribute:NSLayoutAttributeTrailing
                                                         multiplier:1.0
                                                           constant:0];
    [self.view addConstraint:_rightMarginConstraint];
    [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[contentView]|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(contentView)]];
    _contentView = contentView;
}

#pragma mark - Overridden Methods

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.view.backgroundColor = [UIColor whiteColor];
    [self addContentView];
    [self configureBarButtonItemsAnimated:NO];
    [self adjustMargins];
}

- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection
{
    [super traitCollectionDidChange:previousTraitCollection];
    [self adjustMargins];
}

#pragma mark - Navigation

- (void)handleNextButtonTap
{
    [self proceedToNextPage];
}

- (void)proceedToPreviousPage
{
    [self.mbSetupController pageControllerProceedToPreviousPage:self];
}

- (void)proceedToNextPage
{
    [self.mbSetupController pageControllerProceedToNextPage:self];
}

- (void)skip
{
    _skipped = YES;
    [self.mbSetupController pageControllerProceedToNextPage:self];
}

@end


text:
using System;
using System.Collections.Generic;
using System.Text;

namespace ScrimpNet
{
    public static partial class Guard
    {

    }
}


text:
Without types, simple and fast to use (doted names and autoprefixed methods)

### Example:
```javascript
// Init module Todos
const todos = {
  state: {
    list: []
  },

  getters: {
    all ( state ) {
      return state.list
    }
  }

  actions: {
    add ( { commit }, { todo }) {
      commit('todos.add', { todo })
    }
  },

  mutations: {
    add ( state, { todo } ) {
      state.push(todo)
    }
  }

}
```

```javascript
// Todo component
import { mapActions, mapGetters } from 'vuex'

export default {
    //...

    computed: {
      ...mapGetters({
        all: 'todos.all',
        firstUser: 'users.first'
      })
    },

    methods: {
      ...mapActions({
        add: 'todos.add',
      })
    },

    mounted() {
      this.add( { title: "simple", user: this.firstUser } )
      console.log( this.all )

      // and other things:
      this.$store.dispatch('users.delete', this.firstUser.id)
    }

}

```

### How install
```bash
npm install --save dotted-vuex

```
```javascript
import {module, hack} from 'dotted-vuex'

import todos from './modules/todos'
import users from './modules/users'

Vue.use(Vuex)

var store = new Vuex.Store({
  modules: {
    todos: module(todos, 'todos'),
    users: module(users, 'users')
  },
  actions,
  getters
})

store = hack(store)

export default store
```
### License
[MIT](http://opensource.org/licenses/MIT)


text:
This directory is used to produce a containerized production Teleport build.
No need to have Golang. Only Docker is required.

It is a part of Gravitational CI/CD pipeline. To build Teleport type:

```
make
```

### DynamoDB static binary docker build

The static binary will be built along with all nodejs assets inside the container.
From the root directory of the source checkout run:
```
docker build -f build.assets/Dockerfile.dynamodb -t teleportbuilder .
```

Then you can upload the result to an S3 bucket for release.
```
docker run -it -e AWS_ACL=public-read -e S3_BUCKET=my-teleport-releases -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY teleportbuilder
```

Or simply copy the binary out of the image using a volume (it will be copied to current directory/build/teleport.
```
docker run -v $(pwd)/build:/builds -it teleportbuilder cp /gopath/src/github.com/gravitational/teleport/teleport.tgz /builds
```

# OS package repo migrations

An OS package repo migration is semi-manually publishing specific releases to the new APT and YUM repos. This is required in several situations:
* A customer requests that we add an older version to the repos
* We add another OS package repo (for example APK)
* A OS package promotion fails (for example https://drone.platform.teleport.sh/gravitational/teleport/14666/1/3), requires a PR to fix, and we don't want to cut another minor version

Multiple migrations can be performed at once. To run a migration do the following:
1. Clone https://github.com/gravitational/teleport.git.
2. Change to the directory the repo was cloned to.
3. Create a new branch from master.
4. Add the Teleport versions you wish to migration as demonstrated here: https://github.com/gravitational/teleport/commit/151a2f489e3116fc7ce8f55e056529361d3233a6#diff-2e3a64c97d186491e06fb2c7ead081b7ace2b67c4a4d974a563daf7c117a2c50.
5. Set the `migrationBranch` variable to the name of the branch you created in (3) as demonstrated here: https://github.com/gravitational/teleport/commit/151a2f489e3116fc7ce8f55e056529361d3233a6#diff-2e3a64c97d186491e06fb2c7ead081b7ace2b67c4a4d974a563daf7c117a2c50.
6. Get your Drone credentials from here: https://drone.platform.teleport.sh/account.
7. Export your drone credentials as shown under "Example CLI Usage" on the Drone account page
8. Open a new terminal.
9. Run `tsh app login drone` and follow any prompts.
10. Run `tsh proxy app drone` and copy the printed socket. This should look something like `127.0.0.1:60982`
11. Switch back to your previous terminal.
12. Run `export DRONE_SERVER=http://{host:port}`, replacing `{host:port}` with the data you copied in (10)
13. Run `make dronegen`
14. Commit the two changed files and push/publish the branch
15. Open a PR merging your changes into master via https://github.com/gravitational/teleport/compare
16. Under the "checks" section, click "details" on the check labeled "continuous-integration/drone/push"
17. Once the pipelines complete, comment out the versions you added and blank out the `migrationBranch` string set in (4, 5) as demonstrated here: https://github.com/gravitational/teleport/pull/15531/commits/9095880560cfe6c93e491e39a7604b1faf72c600#diff-2e3a64c97d186491e06fb2c7ead081b7ace2b67c4a4d974a563daf7c117a2c50
18. Run `make dronegen`
19. Commit and push the changes.
20. Merge the PR and backport if required.


text:
package org.javalite.activejdbc.test_models;

import org.javalite.activejdbc.Model;

public class Salary extends Model {
    static{
        validatePresenceOf("salary").message("salary is missing!!!");
        zeroToNull("salary");
    }
}


text:
<?php
/*
 *  AnyExample's good_query_... library.
 *
 *  See:
 *  http://www.anyexample.com/programming/php/5_useful_php_functions_for_mysql_data_fetching.xml
 *
 *  Published under AnyExample License:
 *  http://www.anyexample.com/license.xml
 *
 *   - Do whatever you want, but do not publish
 *     in an article or book.
 *
 *   - Code provided as is, without any warranty
 */
function good_query($string, $debug=0)
{
    if ($debug == 1)
        print $string;

    if ($debug == 2)
        error_log($string);

    $result = mysql_query($string);

    if ($result == false)
    {
        error_log("SQL error: ".mysql_error()."\n\nOriginal query: $string\n");
	// Remove following line from production servers
        die("SQL error: ".mysql_error()."\b
\n
Original query: $string \n
\n
");
    }
    return $result;
}

function good_query_list($sql, $debug=0)
{
    // this function require presence of good_query() function
    $result = good_query($sql, $debug);

    if($lst = mysql_fetch_row($result))
    {
	mysql_free_result($result);
	return $lst;
    }
    mysql_free_result($result);
    return false;
}

function good_query_assoc($sql, $debug=0)
{
    // this function require presence of good_query() function
    $result = good_query($sql, $debug);

    if($lst = mysql_fetch_assoc($result))
    {
	mysql_free_result($result);
	return $lst;
    }
    mysql_free_result($result);
    return false;
}

function good_query_value($sql, $debug=0)
{
    // this function require presence of good_query_list() function
    $lst = good_query_list($sql, $debug);
    return is_array($lst)?$lst[0]:false;
}

function good_query_table($sql, $debug=0)
{
    // this function require presence of good_query() function
    $result = good_query($sql, $debug);

    $table = array();
    if (mysql_num_rows($result) > 0)
    {
        $i = 0;
        while($table[$i] = mysql_fetch_assoc($result))
			$i++;
        unset($table[$i]);
    }
    mysql_free_result($result);
    return $table;
}

// MySQL connecting and disconnecting
function good_connect($host, $user, $pwd, $db)
{
	$link = @mysql_connect($host, $user, $pwd);
	if (!$link) {
		die('Can\'t connect to database server (check $host, $user, $pwd)');
		error_log('Can\'t connect to database server (check $host, $user, $pwd)');
	}

	$has_db = mysql_select_db($db);
	if (!$has_db)
	{
		die('Can\'t select database (check $db)');
		error_log('Can\'t select database (check $db)');
	}
        return $link;
}

function good_close()
{
	mysql_close();
}

// Another trivial functions

function good_row(&$result)
{
    return mysql_fetch_row($result);
}

function good_assoc(&$result)
{
    return mysql_fetch_assoc($result);
}

function good_num(&$result)
{
    return mysql_num_rows($result);
}

function good_free(&$result)
{
    return mysql_free_result($result);
}

// if you don't remember which functions
// do need MySQL resource, and which don't
// you may pass MySQL resource to all...
function good_last($notused = 0)
{
    return mysql_insert_id();
}

function good_affected($notused = 0)
{
    return mysql_affected_rows();
}

//$dbhost='localhost';
//$dbname='naikgunung';
//$dbuser='root';
//$dbpass='';

 $dbhost='mysql.idhostinger.com';
 $dbname='u888572812_puskes';
 $dbuser='u888572812_mimin';
 $dbpass='j4k4rt411';

$db = good_connect($dbhost,$dbuser,$dbpass,$dbname);
$statuskoneksi = "Bisa konek ke DB";

function html_price($num) {

    $output = "Rp ".number_format($num, 0, '', '.').",-";

    return $output;
}
session_start();

function cekNull($variabel, $n=NULL){
     return isset($variabel) ? $variabel : $n;
}

function getSession(){
    return @$_SESSION['order_session'];
}

function cekLogin(){
    return cekNull(@$_SESSION['username'],'non');
}

function updateKeranjang($session, $id, $warna, $ukuran, $jumlah){
     $sql = "UPDATE ng_order_tmp
            SET order_warna = '{$warna}',
                order_ukuran = '{$ukuran}',
                order_jumlah = '{$jumlah}'
            where order_session = '{$session}' and order_id ='{$id}' ";
    $update = good_query($sql);
    //$update = "session=$session, id=$id, warna=$warna, ukuran=$ukuran, jumlah=$jumlah";

    return $update; //1= true Sukses, 0= false Gagal
}

function hapusKeranjang($session, $id){
    $sql = "DELETE FROM ng_order_tmp
            where order_session = '{$session}' and order_id ='{$id}' ";
    $delete = good_query($sql);
    return $delete;
}

//error_reporting(0);
?>


text:
package com.mobilejazz.library;

public class PersistentSQLiteObject extends PersistentObject
{
	public static long UNDEFINED_DATABASE_ID = -1;

	private long dbID;
	private PersistentSQLiteStore persistentStore;

	// ---------------------------------------------------------------------------------------------------------
	// Creating instances and initializing
	// ---------------------------------------------------------------------------------------------------------

	public PersistentSQLiteObject()
	{
		super();
		this.dbID = UNDEFINED_DATABASE_ID;
	}

	public PersistentSQLiteObject(long dbID)
	{
		super();
		this.dbID = dbID;
		this.setHasChanges(true);
	}

	// ---------------------------------------------------------------------------------------------------------
	// Getters & Setters
	// ---------------------------------------------------------------------------------------------------------

	public long getDbID()
	{
		return dbID;
	}

	protected void setDbID(long dbID)
	{
		this.setHasChanges(dbID != this.dbID);
		this.dbID = dbID;
	}

	protected PersistentSQLiteStore getPersistentStore()
	{
		return persistentStore;
	}

	protected void setPersistentStore(PersistentSQLiteStore persistentStore)
	{
		this.persistentStore = persistentStore;
	}

	@Override
	protected void setHasChanges(boolean hasChanges)
	{
		super.setHasChanges(hasChanges);

		if (persistentStore != null && hasChanges == true)
			persistentStore.didChangePersistentSQLiteObject(this);
	}
}


text:
package com.zireck.calories.data.entity;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit.
/**
 * Entity mapped to table USER_ENTITY.
 */
public class UserEntity extends UserEntityBase  {

    private Long id;
    private String name;
    private int gender;
    /** Not-null value. */
    private java.util.Date birthday;
    private Integer age;
    private double weight;
    private int height;
    private int activityFactor;
    private Double bmr;
    private int goal;
    private Double maintain;
    private Double burn;
    private Double gain;

    public UserEntity() {
    }

    public UserEntity(Long id) {
        this.id = id;
    }

    public UserEntity(Long id, String name, int gender, java.util.Date birthday, Integer age, double weight, int height, int activityFactor, Double bmr, int goal, Double maintain, Double burn, Double gain) {
        this.id = id;
        this.name = name;
        this.gender = gender;
        this.birthday = birthday;
        this.age = age;
        this.weight = weight;
        this.height = height;
        this.activityFactor = activityFactor;
        this.bmr = bmr;
        this.goal = goal;
        this.maintain = maintain;
        this.burn = burn;
        this.gain = gain;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getGender() {
        return gender;
    }

    public void setGender(int gender) {
        this.gender = gender;
    }

    /** Not-null value. */
    public java.util.Date getBirthday() {
        return birthday;
    }

    /** Not-null value; ensure this value is available before it is saved to the database. */
    public void setBirthday(java.util.Date birthday) {
        this.birthday = birthday;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public double getWeight() {
        return weight;
    }

    public void setWeight(double weight) {
        this.weight = weight;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public int getActivityFactor() {
        return activityFactor;
    }

    public void setActivityFactor(int activityFactor) {
        this.activityFactor = activityFactor;
    }

    public Double getBmr() {
        return bmr;
    }

    public void setBmr(Double bmr) {
        this.bmr = bmr;
    }

    public int getGoal() {
        return goal;
    }

    public void setGoal(int goal) {
        this.goal = goal;
    }

    public Double getMaintain() {
        return maintain;
    }

    public void setMaintain(Double maintain) {
        this.maintain = maintain;
    }

    public Double getBurn() {
        return burn;
    }

    public void setBurn(Double burn) {
        this.burn = burn;
    }

    public Double getGain() {
        return gain;
    }

    public void setGain(Double gain) {
        this.gain = gain;
    }

}