text:
#if !defined(AFX_UVLCWRITER_H__EA98D347_89D5_4D2D_B6D5_FB3A374CD295__INCLUDED_)
#define AFX_UVLCWRITER_H__EA98D347_89D5_4D2D_B6D5_FB3A374CD295__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "MbSymbolWriteIf.h"
#include "H264AVCCommonLib/HeaderSymbolWriteIf.h"
#include "BitWriteBufferIf.h"

H264AVC_NAMESPACE_BEGIN

#define REFSYM_MB                                     384

class UcSymGrpWriter;

class UvlcWriter :
public MbSymbolWriteIf
, public HeaderSymbolWriteIf

{
protected:
	UvlcWriter( Bool bTraceEnable = false );
	virtual ~UvlcWriter();
  ErrVal xRQencodeNewTCoeffs( TCoeff*       piCoeff,
                                    TCoeff*       piCoeffBase,
                                    UInt          uiStart,
                                    UInt          uiStop,
                                    UInt          uiStride,
                                    const UChar*  pucScan,
                                    UInt          uiScanIndex,
                                    UInt*         pauiEobShift,
                                    Bool&         rbLast,
                                    UInt&         ruiNumCoefWritten );
  ErrVal xRQencodeTCoeffsRef( TCoeff*       piCoeff,
                                  TCoeff*       piCoeffBase,
                                  const UChar*  pucScan,
                                  UInt          uiScanIndex );

  ErrVal xRQencodeSigMagGreater1( TCoeff* piCoeff, TCoeff* piCoeffBase, UInt uiBaseCode, UInt uiStart, UInt uiStop, UInt uiVlcTable, const UChar*  pucScan, UInt& ruiNumMagG1, UInt uiStride = 1 );
  ErrVal xWriteSigRunCode ( UInt uiSymbol, UInt uiTableIdx );
  ErrVal xWriteUnaryCode (UInt uiSymbol );
  ErrVal xWriteCodeCB1 (UInt uiSymbol );
  ErrVal xWriteCodeCB2 (UInt uiSymbol );
  ErrVal xWriteGolomb(UInt uiSymbol, UInt uiK);
  ErrVal xEncodeMonSeq ( UInt* auiSeq, UInt uiStartVal, UInt uiLen );
  ErrVal xRQencodeEobOffsets ( UInt* auiSeq, UInt uiLen );
  UInt m_auiShiftLuma[16];
  UInt m_auiShiftChroma[16];
  UInt m_auiBestCodeTabMap[16];
  UInt m_uiCbpStats[3][2];
  UcSymGrpWriter* m_pSymGrp;
  UInt m_uiCbpStat4x4[2];

public:
  static ErrVal create( UvlcWriter*& rpcUvlcWriter, Bool bTraceEnable = true );
  ErrVal destroy();

  ErrVal init(  BitWriteBufferIf* pcBitWriteBufferIf );
  ErrVal uninit();

  ErrVal  startSlice( const SliceHeader& rcSliceHeader );
  ErrVal  startFragment(); //JVT-P031
  ErrVal  getLastByte(UChar &uiLastByte, UInt &uiLastBitPos); //FIX_FRAG_CAVLC
  ErrVal  setFirstBits(UChar ucByte,UInt uiLastBitPos); //FIX_FRAG_CAVLC
  ErrVal  finishSlice();

  ErrVal closeSlice();

  ErrVal  blockModes( MbDataAccess& rcMbDataAccess );
  ErrVal  mbMode( MbDataAccess& rcMbDataAccess/*, Bool bBLQRefFlag*/ );
  ErrVal  resPredFlag( MbDataAccess& rcMbDataAccess );
  ErrVal  resPredFlag_FGS( MbDataAccess& rcMbDataAccess, Bool bBaseCoeff );
  ErrVal  fieldFlag           ( MbDataAccess& rcMbDataAccess ); //th
	ErrVal  smoothedRefFlag( MbDataAccess& rcMbDataAccess );	// JVT-R091

  ErrVal  mvd( MbDataAccess& rcMbDataAccess, ListIdx eLstIdx );
  ErrVal  mvd( MbDataAccess& rcMbDataAccess, ListIdx eLstIdx, ParIdx16x8 eParIdx  );
  ErrVal  mvd( MbDataAccess& rcMbDataAccess, ListIdx eLstIdx, ParIdx8x16 eParIdx  );
  ErrVal  mvd( MbDataAccess& rcMbDataAccess, ListIdx eLstIdx, ParIdx8x8  eParIdx  );
  ErrVal  mvd( MbDataAccess& rcMbDataAccess, ListIdx eLstIdx, ParIdx8x8  eParIdx, SParIdx8x4 eSParIdx );
  ErrVal  mvd( MbDataAccess& rcMbDataAccess, ListIdx eLstIdx, ParIdx8x8  eParIdx, SParIdx4x8 eSParIdx );
  ErrVal  mvd( MbDataAccess& rcMbDataAccess, ListIdx eLstIdx, ParIdx8x8  eParIdx, SParIdx4x4 eSParIdx );

  ErrVal  cbp( MbDataAccess& rcMbDataAccess );
  ErrVal  refFrame( MbDataAccess& rcMbDataAccess, ListIdx eLstIdx );
  ErrVal  refFrame( MbDataAccess& rcMbDataAccess, ListIdx eLstIdx, ParIdx16x8 eParIdx  );
  ErrVal  refFrame( MbDataAccess& rcMbDataAccess, ListIdx eLstIdx, ParIdx8x16 eParIdx  );
  ErrVal  refFrame( MbDataAccess& rcMbDataAccess, ListIdx eLstIdx, ParIdx8x8  eParIdx  );

  ErrVal  motionPredFlag( MbDataAccess& rcMbDataAccess, ListIdx eLstIdx );
  ErrVal  motionPredFlag( MbDataAccess& rcMbDataAccess, ListIdx eLstIdx, ParIdx16x8 eParIdx  );
  ErrVal  motionPredFlag( MbDataAccess& rcMbDataAccess, ListIdx eLstIdx, ParIdx8x16 eParIdx  );
  ErrVal  motionPredFlag( MbDataAccess& rcMbDataAccess, ListIdx eLstIdx, ParIdx8x8  eParIdx  );

  ErrVal  residualBlock( MbDataAccess& rcMbDataAccess, LumaIdx cIdx, ResidualMode eResidualMode );
  ErrVal  residualBlock( MbDataAccess& rcMbDataAccess, ChromaIdx cIdx, ResidualMode eResidualMode );

  ErrVal  transformSize8x8Flag( MbDataAccess& rcMbDataAccess );
  ErrVal  residualBlock8x8    ( MbDataAccess& rcMbDataAccess, B8x8Idx cIdx, ResidualMode eResidualMode );

  ErrVal  deltaQp( MbDataAccess& rcMbDataAccess );
  ErrVal  intraPredModeLuma( MbDataAccess& rcMbDataAccess, LumaIdx cIdx );
  ErrVal  intraPredModeChroma( MbDataAccess& rcMbDataAccess );
  ErrVal  samplesPCM( MbDataAccess& rcMbDataAccess );
  ErrVal  skipFlag( MbDataAccess& rcMbDataAccess, Bool bNotAllowed );
  ErrVal  BLSkipFlag( MbDataAccess& rcMbDataAccess );

  ErrVal  terminatingBit ( UInt uiIsLast ) { return Err::m_nOK;}

  ErrVal writeUvlc( UInt uiCode, Char* pcTraceString );
  ErrVal writeSvlc( Int iCode, Char* pcTraceString );
  ErrVal writeCode( UInt uiCode, UInt uiLength, Char* pcTraceString );
  ErrVal writeSCode( Int iCode, UInt uiLength, Char* pcTraceString );
  ErrVal writeFlag( Bool bFlag, Char* pcTraceString );

  UInt getNumberOfWrittenBits();

  UInt xGetCoeffCost() { return m_uiCoeffCost; }
  Void xSetCoeffCost(UInt uiCost) { m_uiCoeffCost = uiCost; }

  ErrVal xPredictNonZeroCnt( MbDataAccess& rcMbDataAccess, LumaIdx cIdx, UInt uiCoeffCount, UInt uiTrailingOnes );
  ErrVal xPredictNonZeroCnt( MbDataAccess& rcMbDataAccess, ChromaIdx cIdx, UInt uiCoeffCount, UInt uiTrailingOnes );

  ErrVal xWriteMvd( Mv cMv );

  ErrVal xWriteTrailingOnes4( UInt uiCoeffCount, UInt uiTrailingOnes );
  ErrVal xWriteTrailingOnes16( UInt uiLastCoeffCount, UInt uiCoeffCount, UInt uiTrailingOnes );
  ErrVal xWriteTotalRun4( UInt uiVlcPos, UInt uiTotalRun );
  ErrVal xWriteTotalRun16( UInt uiVlcPos, UInt uiTotalRun );
  ErrVal xWriteLevelVLC0( Int iLevel );
  ErrVal xWriteLevelVLCN( Int iLevel, UInt uiVlcLength );
  ErrVal xWriteRun( UInt uiVlcPos, UInt uiRun );
  ErrVal xWriteRunLevel( Int* aiLevelRun, UInt uiCoeffCnt, UInt uiTrailingOnes, UInt uiMaxCoeffs, UInt uiTotalRun );
  ErrVal xWriteRefFrame( Bool bWriteBit, UInt uiRefFrame );
  ErrVal xWriteMotionPredFlag( Bool bFlag );

  ErrVal xWriteUvlcCode( UInt uiVal);
  ErrVal xWriteSvlcCode( Int iVal);

  ErrVal xRQprescanTCoeffsRef( TCoeff*       piCoeff,
                               TCoeff*       piCoeffBase,
                               const UChar*  pucScan,
                               UInt          uiScanIndex );

  UInt xConvertToUInt( Int iValue )  {  return ( iValue <= 0) ? -iValue<<1 : (iValue<<1)-1; }

  Bool    RQencodeCBP_8x8( MbDataAccess& rcMbDataAccess, MbDataAccess& rcMbDataAccessBase, B8x8Idx c8x8Idx );
  Bool    RQencodeBCBP_4x4( MbDataAccess& rcMbDataAccess, MbDataAccess& rcMbDataAccessBase, LumaIdx cIdx );
  Bool    RQencodeCBP_Chroma( MbDataAccess& rcMbDataAccess, MbDataAccess& rcMbDataAccessBase );
  Bool    RQencodeBCBP_ChromaAC( MbDataAccess&  rcMbDataAccess, MbDataAccess&  rcMbDataAccessBase, ChromaIdx cIdx );
  Bool    RQencodeBCBP_ChromaDC( MbDataAccess&   rcMbDataAccess, MbDataAccess&   rcMbDataAccessBase, ChromaIdx cIdx );
  Bool    RQencodeCBP_ChromaAC( MbDataAccess& rcMbDataAccess, MbDataAccess& rcMbDataAccessBase );
  ErrVal  RQencodeDeltaQp( MbDataAccess& rcMbDataAccess );
  ErrVal  RQencode8x8Flag( MbDataAccess& rcMbDataAccess, MbDataAccess& rcMbDataAccessBase );
  ErrVal  RQencodeNewTCoeff_8x8( MbDataAccess&   rcMbDataAccess,
                                      MbDataAccess&   rcMbDataAccessBase,
                                      B8x8Idx         c8x8Idx,
                                      UInt            uiScanIndex,
                                      Bool&           rbLast,
                                      UInt&           ruiNumCoefWritten );
  ErrVal  RQeo8b                    ( Bool&           bEob );
  ErrVal RQencodeNewTCoeff_Luma ( MbDataAccess&   rcMbDataAccess,
                                        MbDataAccess&   rcMbDataAccessBase,
                                        ResidualMode    eResidualMode,
                                        LumaIdx         cIdx,
                                        UInt            uiScanIndex,
                                        Bool&           rbLast,
                                        UInt&           ruiNumCoefWritten );
  ErrVal RQencodeNewTCoeff_Chroma ( MbDataAccess&   rcMbDataAccess,
                                          MbDataAccess&   rcMbDataAccessBase,
                                          ResidualMode    eResidualMode,
                                          ChromaIdx       cIdx,
                                          UInt            uiScanIndex,
                                          Bool&           rbLast,
                                          UInt&           ruiNumCoefWritten );
  ErrVal RQencodeTCoeffRef_8x8( MbDataAccess&   rcMbDataAccess,
                                      MbDataAccess&   rcMbDataAccessBase,
                                      B8x8Idx         c8x8Idx,
                                      UInt            uiScanIndex );
  ErrVal RQencodeTCoeffRef_Luma ( MbDataAccess&   rcMbDataAccess,
                                        MbDataAccess&   rcMbDataAccessBase,
                                        LumaIdx         cIdx,
                                        UInt            uiScanIndex );
  ErrVal RQencodeTCoeffRef_Chroma ( MbDataAccess&   rcMbDataAccess,
                                        MbDataAccess&   rcMbDataAccessBase,
                                        ResidualMode    eResidualMode,
                                        ChromaIdx       cIdx,
                                        UInt            uiScanIndex );
  ErrVal RQencodeCycleSymbol( UInt uiCycle );
  ErrVal RQencodeTermBit ( UInt uiIsLast ) { return Err::m_nOK;}
  Bool   RQpeekCbp4x4(MbDataAccess& rcMbDataAccess, MbDataAccess&  rcMbDataAccessBase, LumaIdx cIdx);
  ErrVal RQencodeEobOffsets_Luma ( UInt* auiSeq );
  ErrVal RQencodeEobOffsets_Chroma( UInt* auiSeq );
  ErrVal RQencodeBestCodeTableMap( UInt* auiTable, UInt uiMaxH );
  ErrVal RQupdateVlcTable         ();
  ErrVal RQvlcFlush               ();
  static UInt   peekGolomb(UInt uiSymbol, UInt uiK);
  ErrVal RQcountFragmentedSymbols();
  ErrVal resetFragmentedSymbols() {m_uiFragmentedSymbols = 0; return Err::m_nOK;}
private:
  __inline ErrVal xWriteCode( UInt uiCode, UInt uiLength );
  __inline ErrVal xWriteFlag( UInt uiCode );

protected:
  BitWriteBufferIf* m_pcBitWriteBufferIf;
  UInt m_uiBitCounter;
  UInt m_uiPosCounter;

  UInt m_uiCoeffCost;
  Bool m_bTraceEnable;

  Bool m_bRunLengthCoding;
  UInt m_uiRun;

  UChar m_auiPrescannedSymbols[REFSYM_MB];
  UInt  m_uiRefSymbols;
  UInt  m_uiCodedSymbols;
  UInt  m_uiFragmentedSymbols;
};

class UcSymGrpWriter
{
public:
  UcSymGrpWriter( UvlcWriter* pParent );
  ErrVal Init();
  ErrVal Flush();
  ErrVal Write( UChar ucBit );
  Bool   UpdateVlc();
  UInt   getTable()                   { return m_uiTable;       }
  Void   setCodedFlag(UInt uiFlag)    { m_uiCodedFlag = uiFlag; }
  Void   incrementCounter(UInt uiSym) { m_auiSymCount[uiSym]++; }

protected:
  UvlcWriter* m_pParent;
  UInt m_auiSymCount[3];
  UInt m_uiTable;
  UInt m_uiCodedFlag;
  UInt m_uiCode;
  UInt m_uiLen;
};

H264AVC_NAMESPACE_END

#endif // !defined(AFX_UVLCWRITER_H__EA98D347_89D5_4D2D_B6D5_FB3A374CD295__INCLUDED_)


text:
<!--
# license: Licensed to the Apache Software Foundation (ASF) under one
#         or more contributor license agreements.  See the NOTICE file
#         distributed with this work for additional information
#         regarding copyright ownership.  The ASF licenses this file
#         to you under the Apache License, Version 2.0 (the
#         "License"); you may not use this file except in compliance
#         with the License.  You may obtain a copy of the License at
#
#           http://www.apache.org/licenses/LICENSE-2.0
#
#         Unless required by applicable law or agreed to in writing,
#         software distributed under the License is distributed on an
#         "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
#         KIND, either express or implied.  See the License for the
#         specific language governing permissions and limitations
#         under the License.
-->

# cordova-plugin-device

[![Build Status](https://travis-ci.org/apache/cordova-plugin-device.svg?branch=master)](https://travis-ci.org/apache/cordova-plugin-device)

Questo plugin definisce un global `device` oggetto che descrive il dispositivo hardware e software. Sebbene l'oggetto sia in ambito globale, non è disponibile fino a dopo il `deviceready` evento.

    document.addEventListener("deviceready", onDeviceReady, false);
    function onDeviceReady() {
        console.log(device.cordova);
    }

## Installazione

    cordova plugin add cordova-plugin-device

## Proprietà

  * device.cordova
  * device.model
  * device.platform
  * device.uuid
  * device.version

## device.cordova

Ottenere la versione di Cordova in esecuzione nel dispositivo.

### Piattaforme supportate

  * Amazon fuoco OS
  * Android
  * BlackBerry 10
  * Browser
  * Firefox OS
  * iOS
  * Tizen
  * Windows Phone 7 e 8
  * Windows 8

## device.model

Il `device.model` restituisce il nome del modello del dispositivo o del prodotto. Il valore viene impostato dal produttore del dispositivo e può essere differente tra le versioni dello stesso prodotto.

### Piattaforme supportate

  * Android
  * BlackBerry 10
  * Browser
  * iOS
  * Tizen
  * Windows Phone 7 e 8
  * Windows 8

### Esempio rapido

    // Android:    Nexus One       returns "Passion" (Nexus One code name)
    //             Motorola Droid  returns "voles"
    // BlackBerry: Torch 9800      returns "9800"
    // Browser:    Google Chrome   returns "Chrome"
    //             Safari          returns "Safari"
    // iOS:     for the iPad Mini, returns iPad2,5; iPhone 5 is iPhone 5,1. Vedi http://theiphonewiki.com/wiki/index.php?title=Models / / modello var = device.model;

### Stranezze Android

  * Ottiene il [nome del prodotto](http://developer.android.com/reference/android/os/Build.html#PRODUCT) anziché il [nome del modello](http://developer.android.com/reference/android/os/Build.html#MODEL), che è spesso il nome di codice di produzione. Ad esempio, restituisce il Nexus One `Passion` , e Motorola Droid restituisce`voles`.

### Tizen stranezze

  * Restituisce il modello di dispositivo assegnato dal fornitore, ad esempio,`TIZEN`

### Windows Phone 7 e 8 stranezze

  * Restituisce il modello di dispositivo specificato dal produttore. Ad esempio, restituisce il Samsung Focus`SGH-i917`.

## device.platform

Ottenere il nome del sistema operativo del dispositivo.

    var string = device.platform;

### Piattaforme supportate

  * Android
  * BlackBerry 10
  * Browser4
  * Firefox OS
  * iOS
  * Tizen
  * Windows Phone 7 e 8
  * Windows 8

### Esempio rapido

    // Depending on the device, a few examples are:
    //   - "Android"
    //   - "BlackBerry 10"
    //   - Browser:         returns "MacIntel" on Mac
    //                      returns "Win32" on Windows
    //   - "iOS"
    //   - "WinCE"
    //   - "Tizen"
    var devicePlatform = device.platform;

### Windows Phone 7 capricci

Windows Phone 7 dispositivi segnalano la piattaforma come`WinCE`.

### Windows Phone 8 stranezze

Dispositivi Windows Phone 8 segnalano la piattaforma come`Win32NT`.

## device.uuid

Ottenere identificatore del dispositivo univoco universale ([UUID](http://en.wikipedia.org/wiki/Universally_Unique_Identifier)).

    var string = device.uuid;

### Descrizione

I dettagli di come viene generato un UUID sono determinati dal produttore del dispositivo e sono specifici per la piattaforma o il modello del dispositivo.

### Piattaforme supportate

  * Android
  * BlackBerry 10
  * iOS
  * Tizen
  * Windows Phone 7 e 8
  * Windows 8

### Esempio rapido

    / / Android: restituisce un intero casuale di 64 bit (come stringa, ancora una volta!) / / il numero intero è generato al primo avvio del dispositivo / / / / BlackBerry: restituisce il numero PIN del dispositivo / / questo è un valore integer univoco a nove cifre (come stringa, benchè!) / / / / iPhone: (parafrasato dalla documentazione della classe UIDevice) / / restituisce una stringa di valori hash creata dall'hardware più identifica.
    / / È garantito per essere unica per ogni dispositivo e non può essere legato / / per l'account utente.
    / / Windows Phone 7: restituisce un hash dell'utente corrente, + dispositivo / / se l'utente non è definito, un guid generato e persisterà fino a quando l'applicazione viene disinstallata / / Tizen: restituisce il dispositivo IMEI (International Mobile Equipment Identity o IMEI è un numero / / unico per ogni cellulare GSM e UMTS.
    var deviceID = device.uuid;

### iOS Quirk

Il `uuid` su iOS non è univoco per un dispositivo, ma varia per ogni applicazione, per ogni installazione. Cambia se si elimina e re-installare l'app, e possibilmente anche quando aggiornare iOS o anche aggiornare l'app per ogni versione (apparente in iOS 5.1). Il `uuid` non è un valore affidabile.

### Windows Phone 7 e 8 stranezze

Il `uuid` per Windows Phone 7 richiede l'autorizzazione `ID_CAP_IDENTITY_DEVICE` . Microsoft probabilmente sarà presto deprecare questa proprietà. Se la funzionalità non è disponibile, l'applicazione genera un guid persistente che viene mantenuto per la durata dell'installazione dell'applicazione sul dispositivo.

## device.version

Ottenere la versione del sistema operativo.

    var string = device.version;

### Piattaforme supportate

  * Android 2.1 +
  * BlackBerry 10
  * Browser
  * iOS
  * Tizen
  * Windows Phone 7 e 8
  * Windows 8

### Esempio rapido

    // Android:    Froyo OS would return "2.2"
    //             Eclair OS would return "2.1", "2.0.1", or "2.0"
    //             Version can also return update level "2.1-update1"
    //
    // BlackBerry: Torch 9800 using OS 6.0 would return "6.0.0.600"
    //
    // Browser:    Returns version number for the browser
    //
    // iPhone:     iOS 3.2 returns "3.2"
    //
    // Windows Phone 7: returns current OS version number, ex. on Mango returns 7.10.7720
    // Tizen: returns "TIZEN_20120425_2"
    var deviceVersion = device.version;

redpajama_set_name: RedPajamaGithub


text:
from bambou import NURESTFetcher

class NUMultiCastListsFetcher(NURESTFetcher):
    """ Represents a NUMultiCastLists fetcher

        Notes:
            This fetcher enables to fetch NUMultiCastList objects.

        See:
            bambou.NURESTFetcher
    """

    @classmethod
    def managed_class(cls):
        """ Return NUMultiCastList class that is managed.

            Returns:
                .NUMultiCastList: the managed class
        """

        from .. import NUMultiCastList
        return NUMultiCastList


text:
class AddTitleToCourse < ActiveRecord::Migration
  def change
    add_column :courses, :title, :string
  end
end


text:
package ru.shestakov.models;

public class Bug extends Item {

}


text:
function handler() {
  console.log('handler');
}

var obj = {
  // __proto__
  // __proto__: theProtoObj,
  // Shorthand for 'handler: handler'
  handler,
  // Methods
  toString() {
    // Super calls
    return 'd ' + super.toString();
  },
  // Computed (dynamic) property names
  ['prop_' + (() => 42)()]: 42
};

console.log(obj);

console.log('---');


text:
layout: docs
title:  "Scala.js and Scala Native"
position: 6
---

# Scala.js and Scala Native

As of version `0.3.0`, `decline` is available for Scala.js!

Everything that works on the JVM should work in JavaScript as well,
including everything in the [main guide](./usage.html).
(If you find something that doesn't, please [open an issue][new-issue]!)
This document has a few more details on the nuts and bolts
of getting a command-line application up and running.

[new-issue]: https://github.com/bkirwi/decline/issues/new

## Working with CommandApp

If you're using a command-line parsing library like `decline`,
you're probably writing a command-line application...
and these work quite differently on the JVM and in JavaScript.
In particular,
JavaScript environments have no concept of a "`main` method" --
runtimes like Node.js provide their own interfaces for accessing command-line arguments
for applications that need them.

[`decline`'s `CommandApp` abstracts over these differences.][defining-an-application]
If you define an application using that style...

```scala mdoc:to-string
import com.monovore.decline._

object MyApp extends CommandApp(
  name = "my-app",
  header = "This compiles to JavaScript!",
  main = {
    val loudOpt = Opts.flag("loud", "Do something noisy!").orFalse

    for (loud <- loudOpt) yield {
      if (loud) println("HELLO WORLD!")
      else println("hello world!")
    }
  }
)
```

...and compile it to JS, you should be able to kick it off with:

```bash
$ node my-compiled-app.js --loud
HELLO WORLD!
```

This makes it possible to write a single command-line application
and compile it for both Node and the JVM!

If you haven't written a CLI app with Scala.js before, some things to remember:

  - Make sure you configure Scala.js to [compile your code as an application][building].
  - The standard SBT `run` command won't forward the arguments along;
    you'll need to build the JavaScript file and then invoke it manually with `node`.

## Ambient Arguments

If you'd rather not use `CommandApp` to set up a main method for you,
it's still possible to use `decline` as a library.
However, it gets a little tricky to get ahold of the command-line arguments --
when Scala.js calls your main method with an `Array[String]`,
the array is always empty!

As a workaround,
`decline` wraps [Node.js' `process.argv` interface][process.argv]
for platforms where that is available:

```scala mdoc:to-string
import com.monovore.decline.PlatformApp

PlatformApp.ambientArgs match {
  case None => // No arguments available! (JVM / Browser)
  case Some(args) => // Found 'em! (Node.js)
}
```

Of course, this means your code has to handle running under the JVM or Node.js differently,
which makes things more complicated than the `CommandApp` style above.

# Scala Native

`decline` also publishes artifacts for Scala Native.

Older versions of Scala Native have a bug that prevents `CommandApp` and
`CommandIOApp` from working correctly. Make sure you're using Scala Native
0.4.4 or later!

[defining-an-application]: ./usage.html#defining-an-application
[building]: https://www.scala-js.org/doc/project/building.html#actually-do-something
[process.argv]: https://nodejs.org/api/process.html#process_process_argv


text:
compact-tl
==========

Compact and fully customisable mini template engine.


text:
package org.keycloak.authentication.authenticators.broker.util;

/**
 * @author Marek Posolda
 */
public interface PostBrokerLoginConstants {

    // ClientSession note with serialized BrokeredIdentityContext used during postBrokerLogin flow
    String PBL_BROKERED_IDENTITY_CONTEXT = "PBL_BROKERED_IDENTITY_CONTEXT";

    // ClientSession note flag specifying if postBrokerLogin flow was triggered after 1st login with this broker after firstBrokerLogin flow is finished (true)
    // or after 2nd or more login with this broker (false)
    String PBL_AFTER_FIRST_BROKER_LOGIN = "PBL_AFTER_FIRST_BROKER_LOGIN";

    // Prefix for the clientSession note key (suffix will be identityProvider alias, so the whole note key will be something like PBL_AUTH_STATE.facebook )
    // It holds the flag whether PostBrokerLogin flow for specified broker was successfully executed for this clientSession
    String PBL_AUTH_STATE_PREFIX = "PBL_AUTH_STATE.";
}


text:
// Generated from ./src/main/java/com/metadave/kash/parser/Kash.g4 by ANTLR 4.5
package com.metadave.kash.parser;
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.tree.ParseTreeListener;

/**
 * This interface defines a complete listener for a parse tree produced by
 * {@link KashParser}.
 */
public interface KashListener extends ParseTreeListener {
	/**
	 * Enter a parse tree produced by {@link KashParser#stmts}.
	 * @param ctx the parse tree
	 */
	void enterStmts(KashParser.StmtsContext ctx);
	/**
	 * Exit a parse tree produced by {@link KashParser#stmts}.
	 * @param ctx the parse tree
	 */
	void exitStmts(KashParser.StmtsContext ctx);
	/**
	 * Enter a parse tree produced by {@link KashParser#connect_stmt}.
	 * @param ctx the parse tree
	 */
	void enterConnect_stmt(KashParser.Connect_stmtContext ctx);
	/**
	 * Exit a parse tree produced by {@link KashParser#connect_stmt}.
	 * @param ctx the parse tree
	 */
	void exitConnect_stmt(KashParser.Connect_stmtContext ctx);
	/**
	 * Enter a parse tree produced by {@link KashParser#hostport}.
	 * @param ctx the parse tree
	 */
	void enterHostport(KashParser.HostportContext ctx);
	/**
	 * Exit a parse tree produced by {@link KashParser#hostport}.
	 * @param ctx the parse tree
	 */
	void exitHostport(KashParser.HostportContext ctx);
	/**
	 * Enter a parse tree produced by {@link KashParser#create_topic}.
	 * @param ctx the parse tree
	 */
	void enterCreate_topic(KashParser.Create_topicContext ctx);
	/**
	 * Exit a parse tree produced by {@link KashParser#create_topic}.
	 * @param ctx the parse tree
	 */
	void exitCreate_topic(KashParser.Create_topicContext ctx);
	/**
	 * Enter a parse tree produced by {@link KashParser#describe_topic}.
	 * @param ctx the parse tree
	 */
	void enterDescribe_topic(KashParser.Describe_topicContext ctx);
	/**
	 * Exit a parse tree produced by {@link KashParser#describe_topic}.
	 * @param ctx the parse tree
	 */
	void exitDescribe_topic(KashParser.Describe_topicContext ctx);
	/**
	 * Enter a parse tree produced by {@link KashParser#keyvalues}.
	 * @param ctx the parse tree
	 */
	void enterKeyvalues(KashParser.KeyvaluesContext ctx);
	/**
	 * Exit a parse tree produced by {@link KashParser#keyvalues}.
	 * @param ctx the parse tree
	 */
	void exitKeyvalues(KashParser.KeyvaluesContext ctx);
	/**
	 * Enter a parse tree produced by {@link KashParser#keyvalue}.
	 * @param ctx the parse tree
	 */
	void enterKeyvalue(KashParser.KeyvalueContext ctx);
	/**
	 * Exit a parse tree produced by {@link KashParser#keyvalue}.
	 * @param ctx the parse tree
	 */
	void exitKeyvalue(KashParser.KeyvalueContext ctx);
	/**
	 * Enter a parse tree produced by {@link KashParser#valuetype}.
	 * @param ctx the parse tree
	 */
	void enterValuetype(KashParser.ValuetypeContext ctx);
	/**
	 * Exit a parse tree produced by {@link KashParser#valuetype}.
	 * @param ctx the parse tree
	 */
	void exitValuetype(KashParser.ValuetypeContext ctx);
	/**
	 * Enter a parse tree produced by {@link KashParser#string_value}.
	 * @param ctx the parse tree
	 */
	void enterString_value(KashParser.String_valueContext ctx);
	/**
	 * Exit a parse tree produced by {@link KashParser#string_value}.
	 * @param ctx the parse tree
	 */
	void exitString_value(KashParser.String_valueContext ctx);
}


text:
require 'spec_helper'

describe BotFramework::Bot do
  subject(:bot) { described_class }

  let(:hook) { proc { |_args| } }

  it '.add_recognizer' do
    expect(described_class.recognizers).to be_empty
    recognizer = instance_double('recognizer')
    described_class.add_recognizer(recognizer)
    expect(described_class.recognizers).to eq([recognizer])
  end

  it 'register event callback' do
    bot.on('created', &hook)
    expect(bot.hooks['created']).to be_eql(hook)
  end

  it 'register intent callback' do
    bot.on_intent('get_name', &hook)
    expect(bot.intent_callbacks['get_name']).to be_eql(hook)
  end

  describe '.trigger' do
    let(:hook) { proc { |args| args } }

    it 'returns false when event is not registered' do
      expect(bot.trigger('created')).to be_falsy
    end

    it 'execute the hook if the event is already registered' do
      response = instance_spy('response')
      hook = proc { response }
      bot.on('created', &hook)
      expect(bot.trigger('created')).to be_eql(response)
    end
  end
end


text:
if [ "$(/bin/whoami)" != 'git' ]; then
  echo "This script have to be performed only by git user!"
  exit 1
fi

cd /home/git/
git clone https://github.com/sitaramc/gitolite.git
mkdir -p $HOME/bin
gitolite/install -to $HOME/bin
$HOME/bin/gitolite setup -pk admin.pub


text:
<?php

    class phpbmsTable{

        var $db = NULL;
        var $backurl = NULL;
        var $verifyErrors = array();
        var $customFieldsQueryResult = false;

        var $id;
        var $uuid;
        var $fields = array();

        var $payemnts;

        /**
          *  $dateFormat
          *
          *  @var The format of dates being passed to the insert/updates
          */
        var $dateFormat = "";

        /**
          *  $timeFormat
          *
          *  @var The format of times being passed to the insert/updates
          */
        var $timeFormat = "";

        /**
          *  $encryptedFields
          *
          *  @var array A list of field names that are encrypted.  This affects
          *  the getRecord, insertRecord, and updateRecord.
          */
        var $encryptedFields = array();

        /**
         * Initializes phpBMS Table object
         *
         * @param object $db database object
         * @param string $tabledefid table definition's uuid
         * @param string $backurl string with the web URL of where to redirect
         */
        function phpbmsTable($db, $tabledefid, $backurl = NULL){

            if(is_object($db))
                if(get_class($db) == "db")
                    $this->db = $db;

            if($this->db === NULL)
                $error = new appError(-800,"database object is required for parameter 1.","Initializing phpbmsTable Class");

            $this->uuid = mysql_real_escape_string($tabledefid);

            if(!$this->getTableInfo())
                $error = new appError(-810,"Table definition not found for id ".$this->id,"Initializing phpbmsTable Class");

            if($backurl == NULL)
                $this->backurl = APP_PATH."search.php?id=".urlencode($this->uuid);
            else
                $this->backurl = $backurl;

            if(defined("DATE_FORMAT"))
                $this->dateFormat = DATE_FORMAT;

            if(defined("TIME_FORMAT"))
                $this->timeFormat = TIME_FORMAT;

        }//end function init

        /**
         * rerieves table definition information and creates object variables of the data retrieved
         */
        function getTableInfo(){

            $querystatement = "
                SELECT
                    *
                FROM
                    `tabledefs`
                WHERE
                    `uuid` = '".$this->uuid."'";

            $queryresult = $this->db->query($querystatement);

            if($this->db->numRows($queryresult)){

                foreach($this->db->fetchArray($queryresult) as $key => $value)
                    $this->$key = $value;

                $this->fields = $this->db->tableInfo($this->maintable);

                foreach($this->encryptedFields as $encryptFieldname)
                    $this->fields[$encryptFieldname]["select"] = $this->db->decrypt("`".$encryptFieldname."`");

                return true;

            } else
                return false;

        }//end function getTableInfo

        // gets a default value for a field
        // given it's type
        function getDefaultByType($fieldtype){

            switch ($fieldtype){

                    case "blob":
                    case "string":
                        $default = "";
                        break;

                    case "real":
                    case "int":
                        $default = 0;
                        break;

                    case "date":
                        $default = dateToString(mktime(),"SQL");
                        break;

                    case "time":
                        $default = timeToString(mktime(),"SQL");
                        break;

                    case "year":
                        $default = @strftime("%Y");
                        break;

                    case "datetime":
                    case "timestamp":
                        $default = dateToString(mktime(),"SQL")." ".timeToString(mktime(),"24 Hour");
                        break;

                    default:
                        $default = null;

            }//endswitch

            return $default;

        }//end function getDefaultsByType

        /**
          *  function prepareFieldForSQL
          *
          *  Given a value, and field type, prepare the
          *  value for SQL insertion (replacing nul with the SQL string NULL,
          *  and typeing variables)
          *
          *  @param string/int $value to be prepared.
          *  @param string $type mysql field type
          *  @param string $flags A list of flags seperated by spaces (" ").
          */
        function prepareFieldForSQL($value,$type,$flags){

            switch ($type){

                case "blob":
                case "string":
                    if($value === "" or $value === NULL){

                        if(strpos($flags,"not_null") === false)
                            $value = NULL;
                        else
                            $value = "''";

                    } else
                        $value = "'".$value."'";
                    break;

                case "real":
                    if($value === "" or $value === NULL){

                        if(strpos($flags,"not_null") === false)
                            $value = NULL;
                        else
                            $value = 0;

                    } else
                        $value = (real) $value;
                    break;

                case "int":
                    if($value === "" or $value === NULL){

                        if(strpos($flags,"not_null") === false)
                            $value = NULL;
                        else
                            $value = 0;

                    } else
                        $value = (int) $value;
                    break;

                case "date":
                    if($value === "" or $value === NULL){

                        if(strpos($flags,"not_null") === false)
                            $value = NULL;
                        else
                            $value = "'".dateToString(mktime(),"SQL")."'";
                    } else
                        $value = "'".sqlDateFromString($value, $this->dateFormat)."'";
                    break;

                case "time":
                    if($value === "" or $value === NULL){

                        if(strpos($flags,"not_null") === false)
                            $value = NULL;
                        else
                            $value = "'".timeToString(mktime(),"SQL")."'";

                    } else
                        $value = "'".sqlTimeFromString($value, $this->timeFormat)."'";
                    break;

                case "year":
                    if($value === "" or $value === NULL)
                        if(strpos($flags,"not_null") === false)
                            $value = NULL;
                        else
                            $value = @strftime("%Y");
                    break;

                case "datetime":
                case "timestamp":
                    if($value === "" or $value === NULL){

                        if(strpos($flags,"not_null") === false)
                            $value = NULL;
                        else
                            $value = "'".dateToString(mktime(),"SQL")." ".timeToString(mktime(),"24 Hour")."'";

                    } else {

                        $datetimearray = explode(" ",$value);
                        $date = null;
                        $time = null;

                        //If the value can be split by spaces we assume we
                        // are looking at a "date time"
                        if(count($datetimearray) > 1){

                            $date = sqlDateFromString($datetimearray[0], $this->dateFormat);

                            //times can have spaces... so we need
                            //to resemble in some cases.
                            if(count($datetimearray) > 2)
                                $datetimearray[1] = $datetimearray[1]." ".$datetimearray[2];

                            $time = sqlTimeFromString($datetimearray[1], $this->timeFormat);

                        }//endif

                        //If we don't have a date, perhaps only a date was passed
                        if(!$date){

                            $date = sqlDateFromString($value, $this->dateFormat);

                            //still no date?, then assume only a time was passed,
                            // so we need to set the time to the deafult
                            // date.
                            if(!$date)
                                $date = "0000-00-00";

                        }//endif

                        //if we don't have a time, let's try the getting the
                        //time from the full value.
                        if(!$time)
                            $time = sqlTimeFromString($value, $this->timeFormat);

                        $value = "'".trim($date." ".$time)."'";

                    }//end if

                    break;

                case "password":
                    $value = "ENCODE('".$value."','".ENCRYPTION_SEED."')";
                    break;

            }//end switch

            if($value === NULL)
                $value = "NULL";

            return $value;

        }//end function prepareFieldForSQL

        /**
          * Retrieves default values for a single record
          *
          * Uses the field names to guess a default value.  If it cannot find
          * one of the standard names it sets the default value based on the type
          *
          * @retrun array associative array with record defaults
          */
        function getDefaults(){

            $therecord = array();

            foreach($this->fields as $fieldname => $thefield){

                switch($fieldname){

                    case "id":
                    case "modifiedby":
                    case "modifieddate":
                        $therecord[$fieldname] = NULL;
                        break;

                    case "uuid":
                        $therecord["uuid"] = uuid($this->prefix.":");
                        break;

                    case "createdby":
                        $therecord["createdby"] = $_SESSION["userinfo"]["id"];
                        break;

                    default:
                        if(strpos($thefield["flags"],"not_null") === false)
                            $therecord[$fieldname] = NULL;
                        else
                            $therecord[$fieldname] = $this->getDefaultByType($thefield["type"]);

                        break;

                }//endswitch

            }//endforeach

            return $therecord;

        }//end function getDefaults

        /**
         * Retrieves a single record from the database
         *
         * @param integer|string $id the record id or uuid
         * @param bool $useUuid specifies whther the $id is a uuid (true) or not.  Default is false
         *
         * @return array the record as an associative array
         */
        function getRecord($id, $useUuid = false){

            $whereclause = "`".$this->maintable."`.";

            if($useUuid){

                $id = mysql_real_escape_string($id);
                $whereclause .= "`uuid` = '".$id."'";

            } else {

                $id = (int) $id;
                $whereclause .= "`id` = ".$id;

            }//endif

            // iterate through all possible fields and comprise a list
            // of columns to retrieve

            $fieldlist = "";
            foreach($this->fields as $fieldname => $thefield){

                if(isset($thefield["select"]))
                    $fieldlist .= ", (".$thefield["select"].") AS `".$fieldname."`";
                else
                    $fieldlist .= ", `".$fieldname."`";

            }//end foreach

            if($fieldlist)
                $fieldlist = substr($fieldlist, 1);

            $querystatement = "
                SELECT
                    ".$fieldlist."
                FROM
                    `".$this->maintable."`
                WHERE
                    ".$whereclause;

            $queryresult = $this->db->query($querystatement);

            if($this->db->numRows($queryresult))
                $therecord = $this->db->fetchArray($queryresult);
            else
                $therecord = $this-> getDefaults();

            return $therecord;

        }//end getRecord function

        /**
         * prepares variables (usually from a form) for inserting or updating
         *
         * @param array $variables associative array with the record information
         *
         * @return array associative array with the record information 'prepped'
         */
        function prepareVariables($variables){

            if(isset($variables["uuid"]))
                if(!$variables["uuid"])
                    $variables["uuid"] = uuid($this->prefix.":");

            return $variables;

        }//end function prepareVariables

        /**
         * function _loadUUIDList
         *
         * @param string $tableName The name of a table with `uuid` field.
         *
         * @return array A list of uuids used in the table.
         */
        function _loadUUIDList($tableName) {

            $list = array();
            $tableName = mysql_real_escape_string($tableName);

            $querystatement = "
                SELECT
                    `uuid`
                FROM
                    `".$tableName."`
                ";

            $queryresult = $this->db->query($querystatement);

            while($therecord = $this->db->fetchArray($queryresult))
                $list[] = $therecord["uuid"];

            return $list;

        }//end method --_loadUUIDList--

        /**
         * function _checkForPresentUUID
         *
         * @param string $tableName The name of a table with `uuid` field.
         * @param string $uuid The uuid to be checked.
         *
         * @return boolean Whether or not the $uuid is a `uuid` in $tablename.
         */
        function _checkForValidUUID($tableName, $uuid) {

            $tableName = mysql_real_escape_string($tableName);
            $uuid = mysql_real_escape_string($uuid);

            $querystatement = "
                SELECT
                    `uuid`
                FROM
                    `".$tableName."`
                WHERE
                    `uuid` = '".$uuid."'
                ";

            $queryresult = $this->db->query($querystatement);

            if($this->db->numRows($queryresult))
                return true;
            else
                return false;

        }//end method --_checkForValidUUID--

        //verifies if variables passes will constitute a valid record creation/update
        function verifyVariables($variables){

            $thereturn = array();

            if(!isset($this->verifyErrors))
                $this->verifyErrors = array();

            if(isset($variables["id"]))
                if(!is_numeric($variables["id"]) && $variables["id"])
                    $this->verifyErrors[] = "The `id` field must be numeric or equivalent to zero (although positive is recommended).";

            if(isset($variables["uuid"]))
                if(!$variables["uuid"])
                    $this->verifyErrors[] = "The `uuid` field cannot be blank";

            if(isset($variables["inactive"]))
                if($variables["inactive"] && $variables["inactive"] != 1)
                    $this->verifyErrors[] = "The `inactive` field must be a boolean (equivalent to 0 or exactly 1).";

            if(count($this->verifyErrors))
                $thereturn = $this->verifyErrors;

            unset($this->verifyErrors);

            return $thereturn;

        }//end function verifyVariables

        /**
         * function updateRecord
         *
         * updates a record
         *
         * @param array $variables associative array with the record information
         * @param int|NULL $modifiedby The user's id that modiied the record.
         *                             If the modified is not passed or is NULL the function will use
         *                             the currently logged in user.
         * @param bool $useUuid specifies whther to use the id or the uuid (true) in the whereclause.  Default is false.
         *
         * @return bool true or false depending upon update success
         */
        function updateRecord($variables, $modifiedby = NULL, $useUuid = false){

            //escape slashes
            $variables = addSlashesToArray($variables);

            // if no modified by was passed, use the currently logged in user
            if($modifiedby === NULL)
                if(isset($_SESSION["userinfo"]["id"]))
                    $modifiedby = $_SESSION["userinfo"]["id"];
                else
                    $error = new appError(-840,"Session Timed Out.","Updating Record");

            $updatestatement = "
                UPDATE
                    `".$this->maintable."`
                SET ";

            foreach($this->fields as $fieldname => $thefield){
                if(!isset($thefield["select"])){

                    switch($fieldname){

                        case "id":
                        case "uuid":
                        case "creationdate":
                        case "createdby":
                            break;

                        case "modifiedby":
                            $updatestatement .= "`modifiedby` = ".((int) $modifiedby).", ";
                            break;

                        case "modifieddate":
                            $updatestatement .= "`modifieddate` = NOW(), ";
                            break;

                        default:
                            if(!isset($variables[$fieldname]) && strpos($thefield["flags"],"not_null") !== false)
                                $variables[$fieldname] = $this->getDefaultByType($thefield["type"],true);

                            if(isset($variables[$fieldname]))
                                $updatestatement .= "`".$fieldname."` = ".$this->prepareFieldForSQL($variables[$fieldname],$thefield["type"],$thefield["flags"]).", ";
                            break;

                    }//end switch field name

                }//end if
            }//end foreach

            $updatestatement = substr($updatestatement, 0, strlen($updatestatement)-2);

            if(!$useUuid){

                if(!isset($variables["id"]))
                    $variables["id"] = 0;

                $updatestatement .= "
                    WHERE
                        `id`=".((int) $variables["id"]);

            } else {

                if(!isset($variables["uuid"]))
                    $variables["uuid"] = '';

                $updatestatement .= "
                    WHERE
                        `uuid` = '".mysql_real_escape_string($variables["uuid"])."'";

            }//endif

            $this->db->query($updatestatement);

            return true;

        }//end function updateRecord

        /**
         * Inserts a new record into the table.
         *
         * @param array $variables associaive array with the record information
         * @param int $createdby id of the user creating the record.  If NULL (default) it will use the currently logged in user
         * @param bool $overrideID Whether to override the `id` field with the new given value (if it exists)
         * @param bool $replace use the SQL replace statement (true) instead of insert (false, deault)
         * @param bool $useUuid generates a uuid and specifies the function to retrn an array with uuid and id instead of just the id
         *
         * @return int|array|bool retruns the id of the newly created record of false on error.  If $useUuid is set to true, it will
         *                        return an associaive array with both the new uuid and new id.
         */
        function insertRecord($variables, $createdby = NULL, $overrideID = false, $replace = false, $useUuid = false){

            if($createdby === NULL)
                if(isset($_SESSION["userinfo"]["id"]))
                    $createdby = $_SESSION["userinfo"]["id"];
                else
                    $error = new appError(-840,"Session Timed Out.","Creating New Record");

            $variables = addSlashesToArray($variables);

            $fieldlist = "";
            $insertvalues = "";

            foreach($this->fields as $fieldname => $thefield){

                if(!isset($thefield["select"])){

                    switch($fieldname){
                        case "id":
                            if($overrideID && isset($variables["id"])){

                                if($variables["id"]){
                                    $fieldlist .= "id, ";
                                    $insertvalues .= ((int) $variables["id"]).", ";
                                }//end if

                            }//endif

                            break;

                        case "uuid":
                            if(!$useUuid){

                                $fieldlist .= "`uuid`, ";
                                $insertvalues .= "'".mysql_real_escape_string($variables["uuid"])."', ";

                            }//endif
                            break;

                        case "createdby":
                        case "modifiedby":
                            $fieldlist .= $fieldname.", ";
                            $insertvalues .= ((int) $createdby).", ";
                            break;

                        case "creationdate":
                        case "modifieddate":
                            $fieldlist .= $fieldname.", ";
                            $insertvalues .= "NOW(), ";
                            break;

                        default:

                            if(!isset($variables[$fieldname]) && strpos($thefield["flags"],"not_null") !== false)
                                $variables[$fieldname] = $this->getDefaultByType($thefield["type"],true);

                            if(isset($variables[$fieldname])){

                                $fieldlist .= "`".$fieldname."`, ";
                                $insertvalues .= $this->prepareFieldForSQL($variables[$fieldname],$thefield["type"],$thefield["flags"]).", ";

                            }//endif - fieldname

                            break;

                    }//end switch field name

                }//end if

            }//end foreach

            //generate uuid
            if($useUuid && isset($this->fields["uuid"])){

                $fieldlist .= "`uuid`, ";
                $variables["uuid"] = uuid($this->prefix.":");
                $insertvalues .= "'".$variables["uuid"]."', ";

            }//endif

            $fieldlist = substr($fieldlist, 0, strlen($fieldlist)-2);
            $insertvalues = substr($insertvalues, 0, strlen($insertvalues)-2);

            if($replace)
                $insertstatement = "REPLACE";
            else
                $insertstatement = "INSERT";

            $insertstatement .= " INTO ".$this->maintable." (".$fieldlist.") VALUES (".$insertvalues.")";

            $insertresult = $this->db->query($insertstatement);

            if($insertresult) {

                $newid = $this->db->insertId();

                if($useUuid)
                    return array("uuid" => $variables["uuid"], "id" => $newid);
                else
                    return $newid;

            } else
                return false;

        }//end function insertRecord

        // default stucture for processing an addedit page.  It assumes that the
        // page receives it's information through a post, and that it at least
        // includes a command parameter.  The presence of an id field value
        // dictates wehter the proess should insert or update a record
        function processAddEditPage(){

            // no command parameter present?
            if(!isset($_POST["command"])){

                // assuming just entered the page (no POST)
                // presence of a GET id means editing an existing record
                // (vs. creating a new)
                if(isset($_GET["id"])){

                    //editing... make sure they have access to edit
                    if(!hasRights($this->editroleid))
                        goURL(APP_PATH."noaccess.php");
                    else {

                        $this->getCustomFieldInfo();
                        return $this->getRecord((integer) $_GET["id"]);

                    }//endif

                } else {

                    //creating new record
                    if(!hasRights($this->addroleid))
                        goURL(APP_PATH."noaccess.php");
                    else {

                        $this->getCustomFieldInfo();
                        return $this->getDefaults();

                    }//endif

                }//end if GET-id

            } else {

                // command present
                switch($_POST["command"]){

                    //pressed the cancel button
                    case "cancel":

                        // if we needed to do any clean up (deleteing temp line items)
                        if(!isset($_POST["id"])) $_POST["id"]=0;

                        $theurl = $this->backurl;

                        if(isset($_POST["id"]))
                                $theurl .= "#".((int) $_POST["id"]);

                        goURL($theurl);
                        break;

                    case "save":

                        if(!hasRights($this->editroleid))
                            goURL(APP_PATH."noaccess.php");

                        $variables = $this->prepareVariables($_POST);
                        $errorArray = $this->verifyVariables($variables);

                        if($_POST["id"]) {

                            $theid = $variables["id"];

                            if(!count($errorArray)){

                                $this->updateRecord($variables);
                                if(isset($variables["getid"]))
                                    if(is_numeric($variables["getid"]))
                                        $theid = (int) $variables["getid"];// special variable to override the
                                        //id for get record

                                //get record
                                $this->getCustomFieldInfo();
                                $therecord = $this->getRecord($theid);
                                $therecord["phpbmsStatus"] = "Record Updated";

                            } else {

                                foreach($errorArray as $error)
                                    $logError = new appError(-900, $error, "Verification Error");

                                //get record
                                $this->getCustomFieldInfo();
                                $therecord = $this->getRecord($theid);
                                $therecord["phpbmsStatus"] = "Data Verification Error";

                            }//end if

                            return $therecord;

                        } else {

                            $theid = 0;

                            if(!count($errorArray)){

                                $theid = $this->insertRecord($variables);
                                //get record
                                $therecord = $this->getRecord($theid);
                                $therecord["phpbmsStatus"] = "<div style=\"float:right;margin-top:-3px;\"><button type=\"button\" accesskey=\"n\" class=\"smallButtons\" onclick=\"document.location='".str_replace("&","&",$_SERVER["REQUEST_URI"])."'\">add new</button></div>";
                                $therecord["phpbmsStatus"] .= "Record Created";

                            } else {

                                foreach($errorArray as $error)
                                    $logError = new appError(-900, $error, "Verification Error");

                                //get record
                                $therecord = $this->getRecord($theid);
                                $therecord["phpbmsStatus"] .= "Data Verification Error";

                            }//end if

                            return $therecord;

                        }//endif

                        break;

                }//end command switch

            }// end if - command present

        }//end function processAddEditPage

        function getCustomFieldInfo(){

            if($this->hascustomfields){

                $querystatement = "
                    SELECT
                        `tabledefid`,
                        `field`,
                        `name`,
                        `format`,
                        `generator`,
                        `roleid`,
                        `required`
                    FROM
                        `tablecustomfields`
                    WHERE
                        `tabledefid` = '".$this->uuid."'
                    ORDER BY
                        `displayorder`";

                $this->customFieldsQueryResult = $this->db->query($querystatement);

            }//end if

        }//end function getCustomFieldInfo

    }//end class
?>


text:
package com.msopentech.thali.utilities.java.test;

import com.msopentech.thali.utilities.xmlhttprequestbridge.BridgeTestLoadHtml;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.Scene;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
import org.w3c.dom.Document;

public class JavaXmlHttpRequestLoadHtml implements BridgeTestLoadHtml {
    private final WebView browser;
    private final Stage stage;

    public JavaXmlHttpRequestLoadHtml(WebView browser, Stage stage) {
        this.browser = browser;
        this.stage = stage;
    }

    @Override
    public void LoadWebPage(String url) {
        stage.setTitle("I am a test of JavaXmlHttpRequestLoad");
        Scene scene = new Scene(browser);
        stage.setScene(scene);

        // taken from http://stackoverflow.com/questions/17387981/javafx-webview-webengine-firebuglite-or-some-other-debugger
//        browser.getEngine().documentProperty().addListener(new ChangeListener<Document>() {
//            @Override public void changed(ObservableValue<? extends Document> prop, Document oldDoc, Document newDoc) {
//                enableFirebug(browser.getEngine());
//            }
//        });

        browser.getEngine().load(url);
        stage.show();
    }

    /**
     * Enables Firebug Lite for debugging a webEngine.
     * @param engine the webEngine for which debugging is to be enabled.
     */
//    private static void enableFirebug(final WebEngine engine) {
//        engine.executeScript("if (!document.getElementById('FirebugLite')){E = document['createElement' + 'NS'] && document.documentElement.namespaceURI;E = E ? document['createElement' + 'NS'](E, 'script') : document['createElement']('script');E['setAttribute']('id', 'FirebugLite');E['setAttribute']('src', 'https://getfirebug.com/' + 'firebug-lite.js' + '#startOpened');E['setAttribute']('FirebugLite', '4');(document['getElementsByTagName']('head')[0] || document['getElementsByTagName']('body')[0]).appendChild(E);E = new Image;E['setAttribute']('src', 'https://getfirebug.com/' + '#startOpened');}");
//    }
}


text:
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;

#nullable disable

namespace Microsoft.Build.BackEnd
{
    /// <summary>
    /// Reasons why the node shut down.
    /// </summary>
    internal enum NodeShutdownReason
    {
        /// <summary>
        /// The node shut down because it was requested to shut down.
        /// </summary>
        Requested,

        /// <summary>
        /// The node shut down because of an error.
        /// </summary>
        Error,

        /// <summary>
        /// The node shut down because the connection failed.
        /// </summary>
        ConnectionFailed,
    }

    /// <summary>
    /// Implementation of INodePacket for the packet informing the build manager than a node has shut down.
    /// This is the last packet the BuildManager will receive from a Node, and as such can be used to trigger
    /// any appropriate cleanup behavior.
    /// </summary>
    internal class NodeShutdown : INodePacket
    {
        /// <summary>
        /// The reason the node shut down.
        /// </summary>
        private NodeShutdownReason _reason;

        /// <summary>
        /// The exception - if any.
        /// </summary>
        private Exception _exception;

        /// <summary>
        /// Constructor
        /// </summary>
        public NodeShutdown(NodeShutdownReason reason)
            : this(reason, null)
        {
        }

        /// <summary>
        /// Constructor
        /// </summary>
        public NodeShutdown(NodeShutdownReason reason, Exception e)
        {
            _reason = reason;
            _exception = e;
        }

        /// <summary>
        /// Constructor for deserialization
        /// </summary>
        private NodeShutdown()
        {
        }

        #region INodePacket Members

        /// <summary>
        /// Returns the packet type.
        /// </summary>
        public NodePacketType Type
        {
            get { return NodePacketType.NodeShutdown; }
        }

        #endregion

        /// <summary>
        /// The reason for shutting down.
        /// </summary>
        public NodeShutdownReason Reason
        {
            get { return _reason; }
        }

        /// <summary>
        /// The exception, if any.
        /// </summary>
        public Exception Exception
        {
            get { return _exception; }
        }

        #region INodePacketTranslatable Members

        /// <summary>
        /// Serializes or deserializes a packet.
        /// </summary>
        public void Translate(ITranslator translator)
        {
            translator.TranslateEnum(ref _reason, (int)_reason);
            translator.TranslateException(ref _exception);
        }

        /// <summary>
        /// Factory method for deserialization
        /// </summary>
        internal static NodeShutdown FactoryForDeserialization(ITranslator translator)
        {
            NodeShutdown shutdown = new NodeShutdown();
            shutdown.Translate(translator);
            return shutdown;
        }

        #endregion
    }
}


text:
set -o errexit  # Exit with error on non-zero exit codes
set -o pipefail # Check the exit code of *all* commands in a pipeline
set -o nounset  # Error if accessing an unbound variable
set -x          # Print each command as it is run

TAG=$(git describe --tags --exact-match 2> /dev/null || git rev-parse --short HEAD)

sed "s/\$PROJECT_ID/${PROJECT_ID}/g;s/\$GCP_PROVIDER_SHA/${TAG}/g" test/e2e/templates/provider-gcp-plugin.yaml.tmpl | kubectl apply -f -


text:
package com.percipient24.cgc.entities.boss;

import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.Animation;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.Filter;
import com.badlogic.gdx.physics.box2d.Fixture;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;
import com.badlogic.gdx.utils.Timer;
import com.percipient24.cgc.*;
import com.percipient24.helpers.BodyFactory;
import com.percipient24.helpers.LayerHandler;
import com.percipient24.cgc.entities.ChainLink;
import com.percipient24.cgc.entities.GameEntity;
import com.percipient24.cgc.entities.Wall;
import com.percipient24.cgc.entities.players.Player;
import com.percipient24.cgc.entities.players.Prisoner;
import com.percipient24.cgc.entities.players.SteelHorseRider;
import com.percipient24.cgc.maps.MapBuilder;
import com.percipient24.enums.DeathType;
import com.percipient24.enums.EntityType;

/*
 * Handles the logic for the SteelHorse boss
 *
 * @version 0.2 14/3/19
 * @author Christopher Rider
 * @author JD Kelly
 */
public class SteelHorse extends Boss
{
	private int hp = 0;
	public static int MAX_HP = 0;

	//Determines how far off the SteelHorse can be when seeking a target
	public static float accuracy = 0;
	//Determines how fast the SteelHorse will turn away from Walls in front of it
	public static float wallAvoidanceSpeed = 0;

	private float offset = 0.0f;
	private Prisoner target = null;

	//Starting velocity for crashing
	private Vector2 startVel;

	private float maxSpeed = 4.0f;
	private float maxForce = 2.0f;

	//Players
	private SteelHorseRider leftShooter = null;
	private SteelHorseRider rightShooter = null;

	//AI Controller
	private Sheriff sheriff = null;

	//Crash variables
	private boolean crashing = false;
	private CGCTimer crashTimer;
	private Timer.Task crashTask;
	private boolean down = false;

	//Boost variables
	private CGCTimer boostClock;
	private Timer.Task boostTask;
	private float boostTime = 2.0f;
	private boolean canBoost = true;
	private boolean boosting = false;

	//Boost Reset Variables
	private CGCTimer resetClock;
	private Timer.Task resetTask;
	private float resetTime = 3.0f;

	//Cooldown Variables
	private CGCTimer cooldownClock;
	private Timer.Task cooldownTask;
	private float cooldownTime = 3.0f;

	//BodyType Swap Variables
	private CGCTimer btSwapClock;
	private Timer.Task btSwapTask;
	private float btSwapTime = 0.1f;

	//BackUp variables
	private CGCTimer backUpClock;
	private Timer.Task backUpTask;
	private float backUpTime = 0.5f;

	//Die Timer
	private CGCTimer dieClock;
	private Timer.Task dieTask;
	private float dieTime = 0.1f;

	private boolean swapped = false;

	/*
	 * Creates a new SteelHorse object
	 *
	 * @param newLowAnimation		The Animation for the bottom of this object
	 * @param newMidAnimation		The Animation for the middle of this object
	 * @param newHighAnimation		The Animation for the top of this object
	 * @param pEntityType			The type of entity this object is
	 * @param attachedBody			The Body object that represents this GameEntity in the world
	 */
	public SteelHorse(Animation newLowAnimation, Animation newMidAnimation,
			Animation newHighAnimation, EntityType pEntityType, Body attachedBody)
	{
		super(newLowAnimation, newMidAnimation, newHighAnimation, pEntityType, attachedBody);

		setTimers();

		hp = MAX_HP;

		offset = (float) ((Math.random() - 0.5f) * accuracy);

		target = CGCWorld.getPrisoners().random();

		Vector2 sheriffPos = body.getWorldCenter().cpy().sub(new Vector2(0, getImageHalfHeight(0) / 2).rotate(rotation));
		Body b = CGCWorld.getBF().createCircle(0, 0,
				0.6f, BodyType.StaticBody, BodyFactory.CAT_IMPASSABLE, BodyFactory.MASK_SHERIFF_GROUND);

		sheriff = new Sheriff(com.percipient24.cgc.art.TextureAnimationDrawer.sheriffAnim, com.percipient24.cgc.art.TextureAnimationDrawer.sheriffAnim, com.percipient24.cgc.art.TextureAnimationDrawer.sheriffAnim, EntityType.SHERIFF, b, this);
		sheriff.addToWorldLayers(CGCWorld.getLH());
		//sheriff.addTargeter();
		b.setUserData(sheriff);
		b.setTransform(sheriffPos, 0);

	}

	/*
	 * Creates a new SteelHorse object
	 *
	 * @param newLowAnimation		The Animation for the bottom of this object
	 * @param newMidAnimation		The Animation for the middle of this object
	 * @param newHighAnimation		The Animation for the top of this object
	 * @param pEntityType			The type of entity this object is
	 * @param attachedBody			The Body object that represents this GameEntity in the world
	 * @param startAlpha			The starting alpha for this entity
	 */
	public SteelHorse(Animation newLowAnimation, Animation newMidAnimation,
			Animation newHighAnimation, EntityType pEntityType, Body attachedBody, float startAlpha)
	{
		this(newLowAnimation, newMidAnimation, newHighAnimation, pEntityType, attachedBody);
		alpha = startAlpha;
	}

	/*
	 * Timestep-based update method
	 *
	 * @param deltaTime				Seconds elapsed since the last frame
	 * @param layer					The parallax layer to animate
	 */
	public void step(float deltaTime, int layer)
	{
		if(BossFight.lost() && !swapped)
		{
			if(leftShooter != null)
			{
				Vector2 leftPos = sheriff.getBody().getPosition().cpy().add(new Vector2(0, leftShooter.getImageHalfHeight(0) - 0.15f).rotate(rotation));

				leftShooter.getBody().setTransform(leftPos.cpy(), 0);
				leftShooter.setRotation(rotation);
				leftShooter.updatePlayer(deltaTime);

				if (rightShooter != null)
				{
					Vector2 rightPos = leftShooter.getBody().getPosition().cpy().add(new Vector2(0, rightShooter.getImageHalfHeight(0)).rotate(rotation));

					rightShooter.getBody().setTransform(rightPos.cpy(), 0);
					rightShooter.setRotation(rotation);
					rightShooter.updatePlayer(deltaTime);
				}
			}

			sheriff.setRotation(rotation);

			Vector2 sheriffPos = body.getWorldCenter().cpy().sub(new Vector2(0, getImageHalfHeight(0) / 2).rotate(rotation));

			sheriff.getBody().setTransform(sheriffPos, 0);
			sheriff.update(deltaTime);
		}
	}

	/*
	 * Makes the Steel Horse pause its timers
	 * @see com.percipient24.cgc.entities.Boss#pause()
	 */
	public void pause()
	{

	}

	/*
	 * Makes the Steel Horse resume its timers
	 * @see com.percipient24.cgc.entities.Boss#pause()
	 */
	public void resume()
	{

	}

	/*
	 * @see com.percipient24.cgc.entities.GameEntity#addToWorldLayers(com.percipient24.helpers.BodyFactory)
	 */
	public void addToWorldLayers(LayerHandler lh)
	{
		lh.addEntityToLayer(this, LayerHandler.ground);
		lh.addEntityToLayer(this, LayerHandler.mid);
		lh.addEntityToLayer(this, LayerHandler.bossTop);
	}

	/*
	 * @see com.percipient24.cgc.entities.GameEntity#removeFromWorldLayers(com.percipient24.helpers.BodyFactory)
	 */
	public void removeFromWorldLayers(LayerHandler lh)
	{
		if(swapped)
		{
			lh.removeEntityFromLayer(this, LayerHandler.ground);
		}
		else
		{
			lh.removeEntityFromLayer(this, LayerHandler.mid);
			lh.removeEntityFromLayer(this, LayerHandler.bossTop);
		}
	}

	/*
	 * Draws the SteelHorse in the CGCWorld
	 *
	 * @param sBatch				The SpriteBatch the game is using
	 * @param delta					Seconds elapsed since the last frame
	 * @param layerNumber			Which BodyFactory layer to draw
	 */
	public void draw(SpriteBatch sBatch, float delta, int layerNumber)
	{
		Color oldColor = sBatch.getColor().cpy();
		if (!CGCWorld.lost())
		{
			float healthRatio = (float)(hp + 0.001f) / (float)MAX_HP;

			Color tint = new Color(1.0f, healthRatio, healthRatio, 1.0f);
			sBatch.setColor(tint);
		}

		super.draw(sBatch, delta, layerNumber);

		sBatch.setColor(oldColor);
	}

	/*
	 * Determines the first class type in a collision
	 *
	 * @param ge					The second entity colliding
	 */
	public void collide(GameEntity ge)
	{
		ge.collide(this);
	}

	/*
	 * Determines the second class type in a collision
	 *
	 * @param w						The first entity colliding
	 */
	public void collide(Wall w)
	{
		if(w.isVertical())
		{
			if(!BossFight.lost())
			{
				body.setLinearVelocity(-body.getLinearVelocity().cpy().x, body.getLinearVelocity().cpy().y);
			}
		}
		else
		{
			if(!BossFight.lost())
			{
				body.setLinearVelocity(body.getLinearVelocity().cpy().x, -body.getLinearVelocity().cpy().y);
			}
		}

		if ((boosting || crashing) && !BossFight.lost())
		{
			if(boosting)
			{
				TimerManager.removeTimer(boostClock);
				boosting = false;
				maxSpeed /= 2;
				maxForce /= 2;
			}

			if (crashing)
			{
				TimerManager.removeTimer(crashTimer);
			}

			hp--;

			setLowAnim(com.percipient24.cgc.art.TextureAnimationDrawer.crashAnim);
			setMidAnim(com.percipient24.cgc.art.TextureAnimationDrawer.crashAnim);
			setHighAnim(com.percipient24.cgc.art.TextureAnimationDrawer.crashAnim);

			if (hp > 0)
			{
				startVel = body.getLinearVelocity().cpy();

				rotation = startVel.angle() - 90;
				TimerManager.addTimer(backUpClock);

				canBoost = false;
				down = true;
			}
		}
		else if(BossFight.lost())
		{
			startVel = body.getLinearVelocity().cpy();
			TimerManager.addTimer(backUpClock);;
		}
	}
	/*
	 * Handles the end of the collision with a wall
	 */
	public void endCollide(Wall w)
	{
		if(isDead() && !swapped)
		{
			die();
		}
	}

	/*
	 * Determines the second class type in a collision
	 *
	 * @param p						The first entity colliding
	 */
	public void collide(Player p)
	{
		p.collide(this);
	}

	/*
	 * Determines the second class type in a collision
	 *
	 * @param p						The first entity colliding
	 */
	public void collide(Prisoner p)
	{
		if (!(down || crashing))
		{
			if (body.getLinearVelocity().cpy().len2() >= maxSpeed * maxSpeed / 4)
			{
				Vector2 dif = body.getPosition().cpy().sub(p.getPosition().cpy());
				if (dif.dot(body.getLinearVelocity().cpy().nor()) >= 0)
				{
					p.die(DeathType.BOSS);
				}
			}
		}
	}

	/*
	 * Determines the second class type in a collision
	 *
	 * @param c						The first entity colliding
	 */
	public void collide(ChainLink c)
	{
		Player left = c.gLeft();

		if (!resetClock.isRunning() && !crashTimer.isRunning())
		{
			if (left != null)
			{
				if (left.isAlive())
				{
					Player right = left.getRightPlayer();
					if (right != null)
					{
						if (right.isAlive())
						{
							Vector2 lPos = left.getBody().getWorldCenter().cpy();
							Vector2 lDis = lPos.sub(body.getWorldCenter().cpy()).nor();
							float lDot = body.getLinearVelocity().cpy().nor().dot(lDis);

							Vector2 rPos = right.getBody().getWorldCenter().cpy();
							Vector2 rDis = rPos.sub(body.getWorldCenter().cpy()).nor();
							float rDot = body.getLinearVelocity().cpy().nor().dot(rDis);

							if (lDot >= 0 && rDot >= 0)
							{
								if(body.getLinearVelocity().cpy().len2() >= 9.0f)
								{
									float distance = left.getPosition().cpy().dst(right.getPosition().cpy());

									if (distance >= (CGCWorld.gNumChains() * 0.2f + 0.3f) * 0.5f)
									{
										crashing = true;
										startVel = body.getLinearVelocity().cpy();
										rotation = startVel.angle() - 90;
										TimerManager.addTimer(crashTimer);

										if (boostClock.isRunning())
										{
											TimerManager.removeTimer(boostClock);
											maxSpeed /= 2;
											maxForce /= 2;
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}

	/*
	 * Quick getter for down
	 *
	 * @return						Whether or not this is down
	 */
	public boolean isDown()
	{
		return down;
	}

	/*
	 * Quick getter for crashing
	 *
	 * @return						Whether or not this is crashing
	 */
	public boolean isCrashing()
	{
		return crashing;
	}

	/*
	 * Doubles the max speed and max force of the SteelHorse if it can boost
	 */
	public void boost()
	{
		if (canBoost)
		{
			maxSpeed *= 2;
			maxForce *= 2;
			canBoost = false;
			boosting = true;
			setLowAnim(com.percipient24.cgc.art.TextureAnimationDrawer.boostAnim);
			setMidAnim(com.percipient24.cgc.art.TextureAnimationDrawer.boostAnim);
			setHighAnim(com.percipient24.cgc.art.TextureAnimationDrawer.boostAnim);
			TimerManager.addTimer(boostClock);
		}
	}

	/*
	 * Creates the Timers for this class
	 */
	public void setTimers()
	{
		crashTask = new Timer.Task() {

			public void run() {
				body.setLinearVelocity(startVel.cpy().scl(1 - crashTimer.getPercent()));

				if (crashTimer.getPercent() >= 1.0f)
				{
					crashing = false;
					down = true;
					hp--;
					body.setType(BodyType.StaticBody);

					setLowAnim(com.percipient24.cgc.art.TextureAnimationDrawer.crashAnim);
					setMidAnim(com.percipient24.cgc.art.TextureAnimationDrawer.crashAnim);
					setHighAnim(com.percipient24.cgc.art.TextureAnimationDrawer.crashAnim);

					if (hp > 0)
					{
						TimerManager.addTimer(resetClock);

						TimerManager.removeTimer(crashTimer);
					}
					else if (hp == 0)
					{
						TimerManager.addTimer(dieClock);
					}
				}
			}
		};

		crashTimer = new CGCTimer(crashTask, CGCWorld.WORLD_DELAY, (int)(1 / CGCWorld.WORLD_DELAY));

		resetTask = new Timer.Task() {

			public void run() {
				down = false;
				canBoost = true;
				crashing = false;
				body.setTransform(body.getPosition().cpy().sub(body.getLinearVelocity().cpy().nor().scl(0.8f)), 0);
				body.setType(BodyType.DynamicBody);

				setLowAnim(com.percipient24.cgc.art.TextureAnimationDrawer.steelHorseAnim);
				setMidAnim(com.percipient24.cgc.art.TextureAnimationDrawer.steelHorseAnim);
				setHighAnim(com.percipient24.cgc.art.TextureAnimationDrawer.steelHorseAnim);

				pickTarget();
				offset = (float) (Math.random() * accuracy);
				Vector2 newVel = target.getPosition().cpy().add(new Vector2((float) Math.cos(offset), (float) Math.sin(offset)).scl(1.5f)).sub(body.getPosition().cpy()).nor().scl(maxSpeed / 2);
				body.setLinearVelocity(newVel);
			}
		};

		resetClock = new CGCTimer(resetTask, resetTime, false, "resetClock");

		boostTask = new Timer.Task()
		{
			public void run()
			{

				setLowAnim(com.percipient24.cgc.art.TextureAnimationDrawer.steelHorseAnim);
				setMidAnim(com.percipient24.cgc.art.TextureAnimationDrawer.steelHorseAnim);
				setHighAnim(com.percipient24.cgc.art.TextureAnimationDrawer.steelHorseAnim);

				boosting = false;
				maxSpeed /= 2;
				maxForce /= 2;

				cooldownClock.reset();
				TimerManager.addTimer(cooldownClock);
			}
		};

		boostClock = new CGCTimer(boostTask, boostTime, false, "boostClock");

		cooldownTask = new Timer.Task()
		{
			public void run()
			{

				canBoost = true;
				boostClock.reset();
			}
		};

		cooldownClock = new CGCTimer(cooldownTask, cooldownTime, false, "cooldownClock");

		btSwapTask = new Timer.Task()
		{
			public void run()
			{
				body.setType(BodyType.StaticBody);
			}
		};

		btSwapClock = new CGCTimer(btSwapTask, btSwapTime, false, "btSwapClock");

		backUpTask = new Timer.Task() {

			public void run() {
				body.setLinearVelocity(startVel.cpy().scl(1 - backUpClock.getPercent()));

				if(backUpClock.getPercent() >= 1.0f)
				{
					TimerManager.addTimer(resetClock);
					TimerManager.addTimer(btSwapClock);
				}
			}
		};

		backUpClock = new CGCTimer(backUpTask, backUpTime, false, "backUpClock");

		dieTask = new Timer.Task() {

			public void run() {
				die();
			}
		};

		dieClock = new CGCTimer(dieTask, dieTime, false, "dieClock");
	}

	/*
	 * Quick getter for maxForce
	 *
	 * @return						Max force
	 */
	public float gMaxForce()
	{
		return maxForce;
	}

	/*
	 * Quick getter for maxSpeed
	 *
	 * @return						Max speed
	 */
	public float gMaxSpeed()
	{
		return maxSpeed;
	}

	/*
	 * Adds a rider to the array
	 *
	 * @param shr						A SteelHorseRider to ride this SteelHorse
	 */
	public void addRider(SteelHorseRider shr)
	{
		if (leftShooter == null)
		{
			leftShooter = shr;
			Vector2 leftPos = sheriff.getBody().getPosition().cpy().add(new Vector2(0, leftShooter.getImageHalfHeight(0) - 0.15f).rotate(rotation));

			leftShooter.getBody().setTransform(leftPos.cpy(), 0);
			sheriff.removeTargeter();
		}

		else
		{
			double ran = Math.random();
			Vector2 rightPos = leftShooter.getBody().getPosition().cpy().add(new Vector2(0, rightShooter.getImageHalfHeight(0)).rotate(rotation));

			if (ran < 0.5)
			{
				rightShooter = shr;
				rightShooter.getBody().setTransform(rightPos, 0);
			}
			else
			{
				Vector2 leftPos = sheriff.getBody().getPosition().cpy().add(new Vector2(0, leftShooter.getImageHalfHeight(0) - 0.15f).rotate(rotation));

				leftShooter.removeFromWorldLayers(CGCWorld.getLH());
				rightShooter = leftShooter;
				leftShooter = shr;
				leftShooter.addToWorldLayers(CGCWorld.getLH());
				rightShooter.addToWorldLayers(CGCWorld.getLH());

				leftShooter.getBody().setTransform(leftPos, 0);
				rightShooter.getBody().setTransform(rightPos, 0);
			}

		}
		shr.mount(this);
	}

	/*
	 * @see com.percipient24.cgc.entities.boss.Boss#update(float)
	 */
	public void update(float deltaTime)
	{
		if (hp > 0)
		{
			pickTarget();

			Vector2 desVel = new Vector2(0, 0);

			if (!down && !crashing)
			{
				if(target != null)
				{
					Vector2 avg = target.getPosition();
					desVel = avg.sub(body.getPosition()).nor().scl(maxSpeed * 1.5f);
				}

				Vector2 steer = desVel.sub(body.getLinearVelocity().cpy());
				steer.clamp(0, maxForce * 1.5f);
				steer = steer.cpy().scl(1.0f/body.getMass());
				steer = steer.cpy().rotate(offset);

				Vector2 myPos = body.getPosition().cpy();
				boolean avoiding = false;
				if(myPos.x <= 3.0f && body.getLinearVelocity().cpy().x <= 0)
				{
					steer = steer.cpy().add(new Vector2(wallAvoidanceSpeed, 0));
					avoiding = true;
				}
				else if(myPos.x >= MapBuilder.chunkWidth - 3 && body.getLinearVelocity().cpy().x >= 0)
				{
					steer = steer.cpy().add(new Vector2(-wallAvoidanceSpeed, 0));
					avoiding = true;
				}

				if(myPos.y <= 3.0f && body.getLinearVelocity().cpy().y <= 0)
				{
					steer = steer.cpy().add(new Vector2(0, wallAvoidanceSpeed));
					avoiding = true;
				}
				else if(myPos.y >= BossFight.getLevel().getLevelLength() * 11 - 5.0f && body.getLinearVelocity().cpy().y >= 0)
				{
					steer = steer.cpy().add(new Vector2(0, -wallAvoidanceSpeed));
					avoiding = true;
				}

				Vector2 vel = body.getLinearVelocity().cpy().add(steer.scl(deltaTime));
				vel.clamp(0, maxSpeed);

				if (vel.len2() >= maxSpeed * maxSpeed * 9 / 16)
				{
					boost();
				}

				body.setLinearVelocity(vel);
				vel = body.getLinearVelocity().cpy();

				rotation = body.getLinearVelocity().angle() - 90;

			}

			if(leftShooter != null)
			{
				Vector2 leftPos = sheriff.getBody().getPosition().cpy().add(new Vector2(0, leftShooter.getImageHalfHeight(0) - 0.15f).rotate(rotation));

				leftShooter.getBody().setTransform(leftPos.cpy(), 0);
				leftShooter.setRotation(rotation);
				leftShooter.updatePlayer(deltaTime);

				if (rightShooter != null)
				{
					Vector2 rightPos = leftShooter.getBody().getPosition().cpy().add(new Vector2(0, rightShooter.getImageHalfHeight(0)).rotate(rotation));

					rightShooter.getBody().setTransform(rightPos.cpy(), 0);
					rightShooter.setRotation(rotation);
					rightShooter.updatePlayer(deltaTime);
				}
			}

			sheriff.setRotation(rotation);

			Vector2 sheriffPos = body.getWorldCenter().cpy().sub(new Vector2(0, getImageHalfHeight(0) / 2).rotate(rotation));

			sheriff.getBody().setTransform(sheriffPos, 0);
			sheriff.update(deltaTime);

			if(BossFight.getLivingPrisoners().size <= 0)
			{
				sheriff.getBody().setType(BodyType.DynamicBody);
				sheriff.getBody().setLinearVelocity(body.getLinearVelocity().cpy());
			}
		}
		else
		{
			if(body.getLinearVelocity().cpy().len2() >= 0.01f)
			{
				body.setLinearVelocity(body.getLinearVelocity().cpy().scl(0.94f));

				if(leftShooter != null)
				{
					Vector2 leftPos = sheriff.getBody().getPosition().cpy().add(new Vector2(0, leftShooter.getImageHalfHeight(0) - 0.15f).rotate(rotation));

					leftShooter.getBody().setTransform(leftPos.cpy(), 0);
					leftShooter.setRotation(rotation);

					if (rightShooter != null)
					{
						Vector2 rightPos = leftShooter.getBody().getPosition().cpy().add(new Vector2(0, rightShooter.getImageHalfHeight(0)).rotate(rotation));

						rightShooter.getBody().setTransform(rightPos.cpy(), 0);
						rightShooter.setRotation(rotation);
					}
				}

				sheriff.setRotation(rotation);

				Vector2 sheriffPos = body.getWorldCenter().cpy().sub(new Vector2(0, getImageHalfHeight(0) / 2).rotate(rotation));
				sheriff.getBody().setTransform(sheriffPos, 0);
			}
			else
			{
				body.setLinearVelocity(0, 0);
			}
			if (sheriff != null)
			{
				sheriff.update(deltaTime);
			}

			if (leftShooter != null)
			{
				leftShooter.updatePlayer(deltaTime);
			}

			if (rightShooter != null)
			{
				rightShooter.updatePlayer(deltaTime);
			}
		}
	}

	/*
	 * Picks the target for the SteelHorse and determines offset
	 */
	public void pickTarget()
	{
		if(BossFight.getLivingPrisoners().size == 0)
		{
			target = null;
			return;
		}

		if (target == null || !target.isAlive())
		{
			if (!CGCWorld.lost())
			{
				do
				{
					target = CGCWorld.getPrisoners().random();
				}while(!target.isAlive() || target == null);
			}
		}

		offset = (float) ((Math.random() - 0.5f) * accuracy);
	}

	/*
	 * Gets Whether or not the SteelHorse is dead but the boss fight is still going
	 *
	 * @return						If the SteelHorse is dead
	 */
	public boolean isDead()
	{
		return (hp <= 0);
	}

	/*
	 * Quick getter for the Sheriff
	 *
	 * @return						The Sheriff
	 */
	public Sheriff gSheriff()
	{
		return sheriff;
	}

	/*
	 * Handles the death of the SteelHorse
	 */
	public void die()
	{
		removeFromWorldLayers(CGCWorld.getLH());
		swapped = true;

		Fixture f = body.getFixtureList().get(0);
		Filter fi = f.getFilterData();
		fi.categoryBits = BodyFactory.CAT_NON_INTERACTIVE;
		fi.maskBits = BodyFactory.MASK_NON_INTERACTIVE;
		f.setFilterData(fi);
		body.getFixtureList().set(0, f);
		body.setUserData(this);

		if (leftShooter != null)
		{
			if (rightShooter != null)
			{
				rightShooter.dismount();
			}
				leftShooter.dismount();
				sheriff.addTargeter();
		}

		sheriff.swapWorldLayers(CGCWorld.getLH());
		sheriff.getBody().setUserData(sheriff);
		TimerManager.removeTimer(dieClock);
	}

	/*
	 * Quick getter for the number of players in this fight
	 *
	 * @return						The number of player controlled cops in this battle
	 */
	public int getNumCops()
	{
		if (leftShooter != null)
		{
			if(rightShooter != null)
			{
				return 2;
			}
			return 1;
		}
		return 0;
	}
} // End class


text:
package net.pla1.sda;

public class ChannelMap {
    private String stationID;
    private String channel;

    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(stationID).append(" ");
        sb.append(channel);
        return sb.toString();
    }

    public String getStationID() {
        return stationID;
    }

    public void setStationID(String stationID) {
        this.stationID = stationID;
    }

    public String getChannel() {
        return channel;
    }

    public void setChannel(String channel) {
        this.channel = channel;
    }
}


text:
import URL from 'url';
import { PLATFORM_TYPE_GITLAB } from '../../constants/platforms';
import { logger } from '../../logger';
import * as hostRules from '../../util/host-rules';
import { Http } from '../../util/http';
import { regEx } from '../../util/regex';
import { trimTrailingSlash } from '../../util/url';
import * as bitbucket from '../bitbucket-tags';
import * as github from '../github-tags';
import * as gitlab from '../gitlab-tags';
import type { DigestConfig, GetReleasesConfig, ReleaseResult } from '../types';
import type { DataSource } from './types';

export const id = 'go';
export const customRegistrySupport = false;

const http = new Http(id);
const gitlabRegExp = /^(https:\/\/[^/]*gitlab.[^/]*)\/(.*)$/;

async function getDatasource(goModule: string): Promise<DataSource | null> {
  if (goModule.startsWith('gopkg.in/')) {
    const [pkg] = goModule.replace('gopkg.in/', '').split('.');
    if (pkg.includes('/')) {
      return { datasource: github.id, lookupName: pkg };
    }
    return {
      datasource: github.id,
      lookupName: `go-${pkg}/${pkg}`,
    };
  }
  if (goModule.startsWith('github.com/')) {
    const split = goModule.split('/');
    const lookupName = split[1] + '/' + split[2];
    return {
      datasource: github.id,
      lookupName,
    };
  }

  if (goModule.startsWith('bitbucket.org/')) {
    const split = goModule.split('/');
    const lookupName = split[1] + '/' + split[2];
    return {
      datasource: bitbucket.id,
      lookupName,
    };
  }

  const pkgUrl = `https://${goModule}?go-get=1`;
  const res = (await http.get(pkgUrl)).body;
  const sourceMatch = regEx(
    `<meta\\s+name="go-source"\\s+content="([^\\s]+)\\s+([^\\s]+)`
  ).exec(res);
  if (sourceMatch) {
    const [, prefix, goSourceUrl] = sourceMatch;
    if (!goModule.startsWith(prefix)) {
      logger.trace({ goModule }, 'go-source header prefix not match');
      return null;
    }
    logger.debug({ goModule, goSourceUrl }, 'Go lookup source url');
    if (goSourceUrl?.startsWith('https://github.com/')) {
      return {
        datasource: github.id,
        lookupName: goSourceUrl
          .replace('https://github.com/', '')
          .replace(/\/$/, ''),
      };
    }
    const gitlabRes = gitlabRegExp.exec(goSourceUrl);
    if (gitlabRes) {
      return {
        datasource: gitlab.id,
        registryUrl: gitlabRes[1],
        lookupName: gitlabRes[2].replace(/\/$/, ''),
      };
    }

    const opts = hostRules.find({
      hostType: PLATFORM_TYPE_GITLAB,
      url: goSourceUrl,
    });
    if (opts.token) {
      // get server base url from import url
      const parsedUrl = URL.parse(goSourceUrl);

      // split the go module from the URL: host/go/module -> go/module
      const split = goModule.split('/');
      const lookupName = split[1] + '/' + split[2];

      const registryUrl = `${parsedUrl.protocol}//${parsedUrl.host}`;

      return {
        datasource: gitlab.id,
        registryUrl,
        lookupName,
      };
    }
  } else {
    // GitHub Enterprise only returns a go-import meta
    const importMatch = regEx(
      `<meta\\s+name="go-import"\\s+content="([^\\s]+)\\s+([^\\s]+)\\s+([^\\s]+)">`
    ).exec(res);
    if (importMatch) {
      const [, prefix, , goImportURL] = importMatch;
      if (!goModule.startsWith(prefix)) {
        logger.trace({ goModule }, 'go-import header prefix not match');
        return null;
      }
      logger.debug({ goModule, goImportURL }, 'Go lookup import url');

      // get server base url from import url
      const parsedUrl = URL.parse(goImportURL);

      // split the go module from the URL: host/go/module -> go/module
      const lookupName = trimTrailingSlash(parsedUrl.pathname)
        .replace(/\.git$/, '')
        .split('/')
        .slice(-2)
        .join('/');

      return {
        datasource: github.id,
        registryUrl: `${parsedUrl.protocol}//${parsedUrl.host}`,
        lookupName,
      };
    }

    logger.trace({ goModule }, 'No go-source or go-import header found');
  }
  return null;
}

/**
 * go.getReleases
 *
 * This datasource resolves a go module URL into its source repository
 *  and then fetch it if it is on GitHub.
 *
 * This function will:
 *  - Determine the source URL for the module
 *  - Call the respective getReleases in github/gitlab to retrieve the tags
 *  - Filter module tags according to the module path
 */
export async function getReleases({
  lookupName,
}: GetReleasesConfig): Promise<ReleaseResult | null> {
  logger.trace(`go.getReleases(${lookupName})`);
  const source = await getDatasource(lookupName);

  if (!source) {
    logger.info(
      { lookupName },
      'Unsupported go host - cannot look up versions'
    );
    return null;
  }

  let res: ReleaseResult;

  switch (source.datasource) {
    case github.id: {
      res = await github.getReleases(source);
      break;
    }
    case gitlab.id: {
      res = await gitlab.getReleases(source);
      break;
    }
    case bitbucket.id: {
      res = await bitbucket.getReleases(source);
      break;
    }
    /* istanbul ignore next: can never happen, makes lint happy */
    default: {
      return null;
    }
  }

  // istanbul ignore if
  if (!res) {
    return null;
  }

  /**
   * github.com/org/mod/submodule should be tagged as submodule/va.b.c
   * and that tag should be used instead of just va.b.c, although for compatibility
   * the old behaviour stays the same.
   */
  const nameParts = lookupName.replace(/\/v\d+$/, '').split('/');
  logger.trace({ nameParts, releases: res.releases }, 'go.getReleases');

  // If it has more than 3 parts it's a submodule
  if (nameParts.length > 3) {
    const prefix = nameParts.slice(3, nameParts.length).join('/');
    logger.trace(`go.getReleases.prefix:${prefix}`);

    // Filter the releases so that we only get the ones that are for this submodule
    // Also trim the submodule prefix from the version number
    const submodReleases = res.releases
      .filter((release) => release.version?.startsWith(prefix))
      .map((release) => {
        const r2 = release;
        r2.version = r2.version.replace(`${prefix}/`, '');
        return r2;
      });
    logger.trace({ submodReleases }, 'go.getReleases');

    return {
      sourceUrl: res.sourceUrl,
      releases: submodReleases,
    };
  }

  if (res.releases) {
    res.releases = res.releases.filter((release) =>
      release.version?.startsWith('v')
    );
  }

  return res;
}

/**
 * go.getDigest
 *
 * This datasource resolves a go module URL into its source repository
 *  and then fetches the digest it if it is on GitHub.
 *
 * This function will:
 *  - Determine the source URL for the module
 *  - Call the respective getDigest in github to retrieve the commit hash
 */
export async function getDigest(
  { lookupName }: Partial<DigestConfig>,
  value?: string
): Promise<string | null> {
  const source = await getDatasource(lookupName);
  if (!source) {
    return null;
  }

  // ignore v0.0.0- pseudo versions that are used Go Modules - look up default branch instead
  const tag = value && !value.startsWith('v0.0.0-2') ? value : undefined;

  switch (source.datasource) {
    case github.id: {
      return github.getDigest(source, tag);
    }
    case bitbucket.id: {
      return bitbucket.getDigest(source, tag);
    }
    /* istanbul ignore next: can never happen, makes lint happy */
    default: {
      return null;
    }
  }
}