text:
/****************
 * commands.cpp *
 ****************/

/****************************************************************************
 *   Written By Mark Pelletier  2017 - Aleph Objects, Inc.                  *
 *   Written By Marcio Teixeira 2018 - Aleph Objects, Inc.                  *
 *                                                                          *
 *   This program is free software: you can redistribute it and/or modify   *
 *   it under the terms of the GNU General Public License as published by   *
 *   the Free Software Foundation, either version 3 of the License, or      *
 *   (at your option) any later version.                                    *
 *                                                                          *
 *   This program is distributed in the hope that it will be useful,        *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
 *   GNU General Public License for more details.                           *
 *                                                                          *
 *   To view a copy of the GNU General Public License, go to the following  *
 *   location: <https://www.gnu.org/licenses/>.                             *
 ****************************************************************************/

  /****************************************************************************
  *                       FUNCTION MAP                                        *
  *                                                                           *
  * SPI and FT800/810 Commands                                                *
  *                                                                           *
  * CLCD::spi_select()                 Set CS line to 0                       *
  * CLCD::spi_deselect()               Set CS Line to 1                       *
  * CLCD::reset()                      Toggle FT800/810 Power Down Line 50 ms *
  * CLCD::spi_init()                   Configure I/O Lines for SPI            *
  * CLCD::spi_transfer()               Send/Receive 1 SPI Byte                *
  * CLCD::init()                       Set FT800/810 Registers                *
  * CLCD::enable()                     Turn On FT800/810 PCLK                 *
  * CLCD::disable()                    Turn Off FT8880/810 PCLK               *
  * CLCD::set_backlight()              Set LCD Backlight Level                *
  *                                                                           *
  * MEMORY READ FUNCTIONS                                                     *
  *                                                                           *
  * CLCD::mem_read_addr()              Send 32-Bit Address                    *
  * CLCD::mem_read_8()                 Read 1 Byte                            *
  * CLCD::mem_read_16()                Read 2 Bytes                           *
  * CLCD::mem_read_32()                Read 4 Bytes                           *
  *                                                                           *
  * MEMORY WRITE FUNCTIONS                                                    *
  *                                                                           *
  * CLCD::mem_write_addr()             Send 24-Bit Address                    *
  * CLCD::mem_write_8()                Write 1 Byte                           *
  * CLCD::mem_write_16()               Write 2 Bytes                          *
  * CLCD::mem_write_32()               Write 4 Bytes                          *
  *                                                                           *
  * HOST COMMAND FUNCTION                                                     *
  *                                                                           *
  * CLCD::host_cmd()                   Send 24-Bit Host Command               *
  *                                                                           *
  * COMMAND BUFFER FUNCTIONS                                                  *
  *                                                                           *
  * CLCD::cmd()                        Send 32-Bit Value(4 Bytes)CMD Buffer   *
  * CLCD::cmd()                        Send Data Structure with 32-Bit Cmd    *
  * CLCD::str()                        Send Text String in 32-Bit Multiples   *

  *                                                                           *
  * FT800/810 GRAPHIC COMMANDS                                                *
  *                                                                           *
  * class CLCD:CommandFifo {}          Class to control Cmd FIFO              *

  * CommandFifo::start()               Wait for CP finish - Set FIFO Ptr      *
  * CommandFifo::execute()             Set REG_CMD_WRITE and start CP         *
  * CommandFifo::reset()               Set Cmd Buffer Pointers to 0           *
  *
  * CommandFifo::fgcolor               Set Graphic Item Foreground Color      *
  * CommandFifo::bgcolor               Set Graphic Item Background Color      *
  * CommandFifo::begin()               Begin Drawing a Primitive              *
  * CommandFifo::mem_copy()            Copy a Block of Memory                 *
  * CommandFifo::append()              Append Commands to Current DL          *
  * CommandFifo::gradient_color()      Set 3D Button Highlight Color          *
  * CommandFifo::button()              Draw Button with Bulk Write            *
  * CommandFifo::text()                Draw Text with Bulk Write              *
  *****************************************************************************/

 /**************************************************
  * RAM_G Graphics RAM Allocation                  *
  *                                                *
  * Address    Use                                 *
  *                                                *
  *    8000    Extruder Bitmap                     *
  *    8100    Bed Heat Bitmap                     *
  *    8200    Fan Bitmap                          *
  *    8300    Thumb Drive Symbol Bitmap           *
  *   35000    Static DL Space (FT800)             *
  *   F5000    Static DL Space (FT810)             *
  **************************************************/

#pragma once

typedef const __FlashStringHelper *progmem_str;

class UIStorage;

class CLCD {
  friend class UIStorage;

  public:
    typedef FTDI::ftdi_registers  REG;
    typedef FTDI::ftdi_memory_map MAP;

    static void     spi_write_addr (uint32_t reg_address);
    static void     spi_read_addr  (uint32_t reg_address);

    static uint8_t  mem_read_8     (uint32_t reg_address);
    static uint16_t mem_read_16    (uint32_t reg_address);
    static uint32_t mem_read_32    (uint32_t reg_address);
    static void     mem_read_bulk  (uint32_t reg_address, uint8_t *data, uint16_t len);

    static void     mem_write_8    (uint32_t reg_address, uint8_t w_data);
    static void     mem_write_16   (uint32_t reg_address, uint16_t w_data);
    static void     mem_write_32   (uint32_t reg_address, uint32_t w_data);
    static void     mem_write_fill (uint32_t reg_address, uint8_t w_data, uint16_t len);
    static void     mem_write_bulk (uint32_t reg_address, const void *data, uint16_t len, uint8_t padding = 0);
    static void     mem_write_pgm  (uint32_t reg_address, const void *data, uint16_t len, uint8_t padding = 0);
    static void     mem_write_bulk (uint32_t reg_address, progmem_str str, uint16_t len, uint8_t padding = 0);
    static void     mem_write_xbm  (uint32_t reg_address, progmem_str str, uint16_t len, uint8_t padding = 0);

  public:
    class CommandFifo;
    class FontMetrics;

    static void init();
    static void default_touch_transform();
    static void default_display_orientation();
    static void turn_on_backlight();
    static void enable();
    static void disable();
    static void set_brightness (uint8_t brightness);
    static uint8_t get_brightness();
    static void host_cmd (unsigned char host_command, unsigned char byte2);
    static uint32_t dl_size() {return CLCD::mem_read_32(REG::CMD_DL) & 0x1FFF;}

    static void get_font_metrics (uint8_t font, struct FontMetrics &fm);
    static uint16_t get_text_width(const uint8_t font, const char *str);
    static uint16_t get_text_width_P(const uint8_t font, const char *str);

    static uint8_t get_tag ()     {return mem_read_8(REG::TOUCH_TAG);}
    static bool is_touching ()    {return (mem_read_32(REG::TOUCH_DIRECT_XY) & 0x80000000) == 0;}

    static uint8_t get_tracker (uint16_t &value) {
      uint32_t tracker = mem_read_32(REG::TRACKER);
      value            = tracker >> 16;
      return tracker & 0xFF;
    }
};

/*************************** FT800/810 Font Metrics ****************************/

class CLCD::FontMetrics {
  public:
    uint8_t   char_widths[128];
    uint32_t  format;
    uint32_t  stride;
    uint32_t  width;
    uint32_t  height;
    uint32_t  ptr;

    FontMetrics() {}
    FontMetrics(uint8_t font) {load(font);}

    void load(uint8_t font);

    // Returns width of string, up to a maximum of n characters.
    uint16_t get_text_width(const char *str, size_t n = SIZE_MAX) const;
    uint16_t get_text_width(progmem_str str, size_t n = SIZE_MAX) const;
};

/******************* FT800/810 Graphic Commands *********************************/

class CLCD::CommandFifo {
  protected:
    #if FTDI_API_LEVEL >= 810
      uint32_t getRegCmdBSpace();
    #else
      static uint32_t command_write_ptr;
      template <class T> bool _write_unaligned(T data, uint16_t len);
    #endif
    void start();

  public:
    template <class T> bool write(T data, uint16_t len);

  public:
    CommandFifo() {start();}

    static void reset();
    static bool is_processing();
    static bool has_fault();

    void execute();

    void cmd(uint32_t cmd32);
    void cmd(void *data, uint16_t len);

    void dlstart()      {cmd(FTDI::CMD_DLSTART);}
    void swap()         {cmd(FTDI::CMD_SWAP);}
    void coldstart()    {cmd(FTDI::CMD_COLDSTART);}
    void screensaver()  {cmd(FTDI::CMD_SCREENSAVER);}
    void stop()         {cmd(FTDI::CMD_STOP);}
    void loadidentity() {cmd(FTDI::CMD_LOADIDENTITY);}
    void setmatrix()    {cmd(FTDI::CMD_SETMATRIX);}

    void fgcolor     (uint32_t rgb);
    void bgcolor     (uint32_t rgb);
    void gradcolor   (uint32_t rgb);

    void track       (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t tag);
    void clock       (int16_t x, int16_t y, int16_t r,            uint16_t options, int16_t h, int16_t m, int16_t s, int16_t ms);
    void gauge       (int16_t x, int16_t y, int16_t r,            uint16_t options, uint16_t major, uint16_t minor, uint16_t val, uint16_t range);
    void dial        (int16_t x, int16_t y, int16_t r,            uint16_t options, uint16_t val);
    void slider      (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t options, uint16_t val, uint16_t range);
    void progress    (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t options, uint16_t val, uint16_t range);
    void scrollbar   (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t options, uint16_t val, uint16_t size, uint16_t range);
    void number      (int16_t x, int16_t y, int16_t font, uint16_t options, int32_t n);
    void spinner     (int16_t x, int16_t y, uint16_t style, uint16_t scale);
    void sketch      (int16_t x, int16_t y, uint16_t w, uint16_t h, uint32_t ptr, uint16_t format);
    void gradient    (int16_t x0, int16_t y0, uint32_t rgb0, int16_t x1, int16_t y1, uint32_t rgb1);
    void snapshot    (uint32_t ptr);
    void loadimage   (uint32_t ptr, uint32_t options);
    void getprops    (uint32_t ptr, uint32_t width, uint32_t height);

    void scale       (int32_t sx, int32_t sy);
    void rotate      (int32_t a);
    void translate   (int32_t tx, int32_t ty);

    #if FTDI_API_LEVEL >= 810
      void setbase   (uint8_t base);
      void setrotate (uint8_t rotation);
      void setbitmap (uint32_t ptr, uint16_t fmt, uint16_t w, uint16_t h);
      void snapshot2 (uint32_t fmt, uint32_t ptr, int16_t x, int16_t y, uint16_t w, uint16_t h);
      void mediafifo (uint32_t ptr, uint32_t size);
      void playvideo (uint32_t options);
      void videostart();
      void videoframe(uint32_t dst, uint32_t ptr);
      void romfont   (uint8_t font, uint8_t romslot);
    #endif

    // All the following must be followed by str()
    void text      (int16_t x, int16_t y,                       int16_t font, uint16_t options);
    void button    (int16_t x, int16_t y, int16_t w, int16_t h, int16_t font, uint16_t option);
    void toggle    (int16_t x, int16_t y, int16_t w,            int16_t font, uint16_t options, bool state);
    void keys      (int16_t x, int16_t y, int16_t w, int16_t h, int16_t font, uint16_t options);

    // Sends the string portion of text, button, toggle and keys.
    void str (const char * data, size_t maxlen);
    void str (const char * data);
    void str (progmem_str data);

    void memzero  (uint32_t ptr, uint32_t size);
    void memset   (uint32_t ptr, uint32_t value, uint32_t size);
    void memcpy   (uint32_t dst, uint32_t src, uint32_t size);
    void memcrc   (uint32_t ptr, uint32_t num, uint32_t result);
    void memwrite (uint32_t ptr, uint32_t value);
    void inflate  (uint32_t ptr);
    void getptr   (uint32_t result);
    void append   (uint32_t ptr, uint32_t size);
};

redpajama_set_name: RedPajamaGithub


text:
package command_factory_test

import (
	"errors"

	config_package "github.com/cloudfoundry-incubator/ltc/config"
	"github.com/cloudfoundry-incubator/ltc/exit_handler/exit_codes"
	"github.com/cloudfoundry-incubator/ltc/exit_handler/fake_exit_handler"
	"github.com/cloudfoundry-incubator/ltc/terminal"
	"github.com/cloudfoundry-incubator/ltc/test_helpers"
	"github.com/cloudfoundry-incubator/ltc/version"
	"github.com/cloudfoundry-incubator/ltc/version/command_factory"
	"github.com/cloudfoundry-incubator/ltc/version/fake_version_manager"
	"github.com/codegangsta/cli"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gbytes"
)

var _ = Describe("Version CommandFactory", func() {
	var (
		config             *config_package.Config
		outputBuffer       *gbytes.Buffer
		terminalUI         terminal.UI
		fakeExitHandler    *fake_exit_handler.FakeExitHandler
		fakeVersionManager *fake_version_manager.FakeVersionManager
		commandFactory     *command_factory.VersionCommandFactory
	)

	BeforeEach(func() {
		config = config_package.New(nil)
		config.SetTarget("lattice.xip.io")

		outputBuffer = gbytes.NewBuffer()
		terminalUI = terminal.NewUI(nil, outputBuffer, nil)
		fakeExitHandler = &fake_exit_handler.FakeExitHandler{}
		fakeVersionManager = &fake_version_manager.FakeVersionManager{}
		fakeVersionManager.LatticeVersionReturns("some-client-lattice-sha")
		commandFactory = command_factory.NewVersionCommandFactory(
			config,
			terminalUI,
			fakeExitHandler,
			"darwin",
			"/fake/ltc",
			fakeVersionManager)
	})

	Describe("Version Command", func() {
		var versionCommand cli.Command

		BeforeEach(func() {
			versionCommand = commandFactory.MakeVersionCommand()
			fakeVersionManager.ServerVersionsReturns(version.ServerVersions{
				CFRelease:           "v219",
				CFRoutingRelease:    "v220",
				DiegoRelease:        "v221",
				GardenLinuxRelease:  "v222",
				LatticeRelease:      "some-server-lattice-sha",
				LatticeReleaseImage: "some-server-lattice-image-sha",
				LTC:                 "v225",
				Receptor:            "v226",
			}, nil)
		})

		It("Prints the CLI and API versions", func() {
			test_helpers.ExecuteCommandWithArgs(versionCommand, []string{})

			Expect(fakeVersionManager.ServerVersionsCallCount()).To(Equal(1))
			Expect(fakeVersionManager.ServerVersionsArgsForCall(0)).To(Equal("http://receptor.lattice.xip.io"))

			Expect(outputBuffer).To(test_helpers.SayLine("Client: some-client-lattice-sha"))
			Expect(outputBuffer).To(test_helpers.SayLine("Server: some-server-lattice-sha"))
			Expect(outputBuffer).To(test_helpers.SayLine("\tImage: some-server-lattice-image-sha"))
			Expect(outputBuffer).To(test_helpers.SayLine("\tCF: v219"))
			Expect(outputBuffer).To(test_helpers.SayLine("\tDiego: v221"))
			Expect(outputBuffer).To(test_helpers.SayLine("\tGarden-Linux: v222"))
			Expect(outputBuffer).To(test_helpers.SayLine("\tRouting: v220"))
		})

		Context("when the version manager returns an error", func() {
			It("should print an error", func() {
				fakeVersionManager.ServerVersionsReturns(version.ServerVersions{}, errors.New("failed"))

				test_helpers.ExecuteCommandWithArgs(versionCommand, []string{})

				Expect(outputBuffer).To(test_helpers.SayLine("Error: failed"))
				Expect(fakeVersionManager.ServerVersionsCallCount()).To(Equal(1))
				Expect(fakeExitHandler.ExitCalledWith).To(Equal([]int{exit_codes.CommandFailed}))
			})
		})
	})

	Describe("SyncCommand", func() {
		var syncCommand cli.Command

		BeforeEach(func() {
			syncCommand = commandFactory.MakeSyncCommand()
		})

		It("should sync ltc", func() {
			test_helpers.ExecuteCommandWithArgs(syncCommand, []string{})

			Expect(outputBuffer).To(test_helpers.SayLine("Updated ltc to the latest version."))
			Expect(fakeVersionManager.SyncLTCCallCount()).To(Equal(1))
			actualLTCPath, actualArch, actualConfig := fakeVersionManager.SyncLTCArgsForCall(0)
			Expect(actualLTCPath).To(Equal("/fake/ltc"))
			Expect(actualArch).To(Equal("osx"))
			Expect(actualConfig).To(Equal(config))
		})

		Context("when not targeted", func() {
			It("should print an error", func() {
				config.SetTarget("")

				test_helpers.ExecuteCommandWithArgs(syncCommand, []string{})

				Expect(outputBuffer).To(test_helpers.SayLine("Error: Must be targeted to sync."))
				Expect(fakeVersionManager.SyncLTCCallCount()).To(Equal(0))
				Expect(fakeExitHandler.ExitCalledWith).To(Equal([]int{exit_codes.CommandFailed}))
			})
		})

		Context("when the architecture is unknown", func() {
			It("should print an error", func() {
				commandFactory := command_factory.NewVersionCommandFactory(config, terminalUI, fakeExitHandler, "unknown-arch", "fakeltc", fakeVersionManager)
				syncCommand = commandFactory.MakeSyncCommand()

				test_helpers.ExecuteCommandWithArgs(syncCommand, []string{})

				Expect(outputBuffer).To(test_helpers.SayLine("Error: Unknown architecture unknown-arch. Sync not supported."))
				Expect(fakeVersionManager.SyncLTCCallCount()).To(Equal(0))
				Expect(fakeExitHandler.ExitCalledWith).To(Equal([]int{exit_codes.CommandFailed}))
			})
		})

		Context("when the ltc binary can't be found", func() {
			It("should print an error", func() {
				commandFactory := command_factory.NewVersionCommandFactory(config, terminalUI, fakeExitHandler, "darwin", "", fakeVersionManager)
				syncCommand = commandFactory.MakeSyncCommand()

				test_helpers.ExecuteCommandWithArgs(syncCommand, []string{})

				Expect(outputBuffer).To(test_helpers.SayLine("Error: Unable to locate the ltc binary. Sync not supported."))
				Expect(fakeVersionManager.SyncLTCCallCount()).To(Equal(0))
				Expect(fakeExitHandler.ExitCalledWith).To(Equal([]int{exit_codes.CommandFailed}))
			})
		})

		Context("when SyncLTC fails", func() {
			It("should print an error", func() {
				fakeVersionManager.SyncLTCReturns(errors.New("failed"))

				test_helpers.ExecuteCommandWithArgs(syncCommand, []string{})

				Expect(outputBuffer).To(test_helpers.SayLine("Error: failed"))
				Expect(fakeVersionManager.SyncLTCCallCount()).To(Equal(1))
				Expect(fakeExitHandler.ExitCalledWith).To(Equal([]int{exit_codes.CommandFailed}))
			})
		})
	})
})


text:
package org.kaazing.gateway.client.transport.ws;

import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.logging.Logger;

public class FrameProcessor {

    private static final String CLASS_NAME = FrameProcessor.class.getName();
    private static final Logger LOG = Logger.getLogger(CLASS_NAME);

    FrameProcessorListener listener;
    DecodingState state;
    WsFrameEncodingSupport.Opcode opcode;
    int dataLength;
    Boolean masked;
    int maskkey;
    ByteBuffer payLoadLengthBuf;
    ByteBuffer maskkeyBuf;
    Boolean fin;
    ByteBuffer data;

    FrameProcessor(FrameProcessorListener listener) {
        this.listener = listener;
        this.state = DecodingState.START_OF_FRAME;
    }

    /*
     * Processing state machine
     */
    static enum DecodingState {
        START_OF_FRAME,
        READING_PAYLOADLENGTH,
        READING_PAYLOADLENGTH_EXT,
        READING_MASK_KEY,
        READING_PAYLOAD,
        END_OF_FRAME,
    };

    /**
     * Process frames from inbound messages
     * @param byteBuffer
     */
    boolean process(InputStream inputStream) throws IOException {
        LOG.entering(CLASS_NAME, "process");
        int b;
        for (;;) {

            switch (state) {
            // handle alignment with start-of-frame boundary (after mark)
            case START_OF_FRAME:
                b = inputStream.read();
                if (b == -1) {
                    return false; //end of stream
                }
                fin = (b & 0x80) != 0;
                opcode = WsFrameEncodingSupport.Opcode.getById((b & 0x0f));
                state = DecodingState.READING_PAYLOADLENGTH; //start read mask & payload length byte
            break;

            case READING_PAYLOADLENGTH:

                //reading mask bit and payload length (7)
                b = inputStream.read();
                if (b == -1) {
                    return false; //end of stream
                }

                masked = (b & 0x80) != 0;
                if (masked) {
                    maskkeyBuf = ByteBuffer.allocate(4); //4 byte mask key
                }
                dataLength = b & 0x7f;

                if (dataLength==126) {
                    //length is 16 bit long unsigned int - must fill first two bytes with 0,0 to handle unsigned
                    state = DecodingState.READING_PAYLOADLENGTH_EXT;
                    payLoadLengthBuf = ByteBuffer.allocate(4);
                    payLoadLengthBuf.put(new byte[] {0x00, 0x00}); //fill 2 bytes with 0
                } else if (dataLength==127) {
                    //length is 64 bit long
                    state = DecodingState.READING_PAYLOADLENGTH_EXT;
                    payLoadLengthBuf = ByteBuffer.allocate(8);
                }
                else {
                    state = DecodingState.READING_MASK_KEY;

                }
            break;

            case READING_PAYLOADLENGTH_EXT:
                byte[] bytes = new byte[payLoadLengthBuf.remaining()];
                int num = inputStream.read(bytes);
                if (num == -1) {
                    return false; //end of stream
                }
                payLoadLengthBuf.put(bytes, 0, num);
                if (!payLoadLengthBuf.hasRemaining()) {
                    //payload length bytes has been read
                    payLoadLengthBuf.flip();
                    if (payLoadLengthBuf.capacity() == 4) {
                        // 16 bit length
                        dataLength = payLoadLengthBuf.getInt();
                    }
                    else {
                        dataLength = (int) payLoadLengthBuf.getLong();
                    }
                    state = DecodingState.READING_MASK_KEY;
                    break;
                }
            break;

            case READING_MASK_KEY:
                if (!masked) {
                    //unmasked, skip READ_MASK_KEY
                    data = ByteBuffer.allocate(dataLength);
                    state = DecodingState.READING_PAYLOAD;
                    break;
                }
                bytes = new byte[maskkeyBuf.remaining()];
                num = inputStream.read(bytes);
                if (num == -1) {
                    return false; //end of stream
                }
                maskkeyBuf.put(bytes, 0, num);
                if (!maskkeyBuf.hasRemaining()) {
                    //4 bytes has been read, done with mask key
                    maskkeyBuf.flip(); //move postion to 0
                    maskkey = maskkeyBuf.getInt();
                    data = ByteBuffer.allocate(dataLength);
                    state = DecodingState.READING_PAYLOAD;
                }
            break;

            case READING_PAYLOAD:
                if (dataLength == 0) {
                    // empty message
                    state = DecodingState.END_OF_FRAME;
                    break;
                }
                bytes = new byte[data.remaining()];
                num = inputStream.read(bytes);
                if (num == -1) {
                    return false; //end of stream
                }
                data.put(bytes, 0, num);
                if (!data.hasRemaining()) {
                    //all payload has been read
                    data.flip();
                    state = DecodingState.END_OF_FRAME;
                    break;
                }
            break;

            case END_OF_FRAME:
                //finished load payload
                switch (opcode) {
                    case BINARY:
                        if (masked) {
                            WsFrameEncodingSupport.unmask(data, maskkey);
                        }
                        listener.messageReceived(data, "BINARY");
                        break;
                    case TEXT:
                        if (masked) {
                            WsFrameEncodingSupport.unmask(data, maskkey);
                        }
                        listener.messageReceived(data, "TEXT");
                        break;
                    case PING:
                        listener.messageReceived(data, "PING");
                    break;
                    case PONG:
                        //do nothing
                        break;
                    case CLOSE:
                        listener.messageReceived(data, "CLOSE");
                        break;
                }
                state = DecodingState.START_OF_FRAME;

            break;
            }
        }

    }
}


text:
package org.kuali.khr.lm.tests.selenium;

import static org.kuali.khr.hub.util.Helper.waitHere;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.kuali.khr.hub.tests.selenium.KhrBase;
import org.kuali.khr.hub.util.SeleniumBase;
import org.kuali.khr.lm.pages.LeaveCalendar;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.PageFactory;

public class LeaveCalendarUIT extends KhrBase
{

	private static WebDriver driver = SeleniumBase.getDriver();
	private static LeaveCalendar leave_calendar;
//	private static final String USERNAME = "inlmclockdetail1";
	private static final String USERNAME = "inlmdetail1";

	@BeforeClass
	public static void setUp()
	{
		login(USERNAME);
		waitHere();
	}

	@Before
	public void setUpBeforeTest()
	{
		leave_calendar = loadPage();
		leave_calendar.gotoPage();
		waitHere();

	}

	@Test
	public void checkLabels()
	{
		// TODO create tests
	}

	private static LeaveCalendar loadPage() {
		return PageFactory.initElements(driver, LeaveCalendar.class);
	}

}


text:
while echo $1 | grep -q ^-; do
    eval $( echo $1 | sed 's/^-//' )=$2
    shift
    shift
done

#
# SYSTEM SETTINGS
#

#if [ -n "$password" ]; then
	# EMPTY - DONE IN LUA SERVER SCRIPT
#fi

if [ -n "$hostname" ]; then
	/sbin/uci set system.@system[0].hostname="$hostname"
	/sbin/uci commit system
fi

if [ -n "$timezone" ]; then
	/sbin/uci set system.@system[0].timezone="$timezone"
	/sbin/uci commit system
fi

if [ -n "$restapi" ]; then
	/sbin/uci set arduino.@arduino[0].secure_rest_api="$restapi"
    /sbin/uci commit arduino
fi

#
# WIFI SETTINGS
#

wifiwasset=false

if [ -n "$wifipassword" ]; then
	/sbin/uci set wireless.@wifi-iface[0].key="$wifipassword"
	wifiwasset=true
fi

if [ -n "$wifissid" ]; then
	/sbin/uci set wireless.@wifi-iface[0].ssid="$wifissid"
	wifiwasset=true
fi

if [ -n "$wifiencryption" ]; then
	/sbin/uci set wireless.@wifi-iface[0].encryption="$wifiencryption"
	wifiwasset=true
fi

if [ "$wifiwasset" = true ]; then
	/sbin/uci set wireless.@wifi-iface[0].mode=sta
	/sbin/uci set  network.lan=interface
	/sbin/uci set  network.lan.proto=dhcp
	/sbin/uci delete  network.lan.ipaddr
	/sbin/uci delete  network.lan.netmask
	/sbin/uci commit network
	/sbin/uci commit wireless
	/sbin/wifi
	# /etc/init.d/network reload
fi

sleep 5
reboot


text:
FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh

/// @ingroup advanced_usage
/// \class _NoInfo
/// dummy class, used as a default template argument
class _NoInfo {};

/// @ingroup advanced_usage
/// \class NNHInfo
/// template that will help initialise a BJ with a PseudoJet and extra information
template<class I> class NNHInfo {
public:
  NNHInfo()         : _info(NULL) {}
  NNHInfo(I * info) : _info(info) {}
  template<class NNBJ> void init_jet(NNBJ * briefjet, const fastjet::PseudoJet & jet, int index) { briefjet->init(jet, index, _info);}
private:
  I * _info;
};

/// @ingroup advanced_usage
/// Specialisation of NNHInfo for cases where there is no extra info
template<> class NNHInfo<_NoInfo>  {
public:
  NNHInfo()               {}
  NNHInfo(_NoInfo * info) {}
  template<class NNBJ> void init_jet(NNBJ * briefjet, const fastjet::PseudoJet & jet, int index) { briefjet->init(jet, index);}
};

//----------------------------------------------------------------------
/// @ingroup advanced_usage
/// \class NNH
/// Help solve closest pair problems with generic interparticle and
/// beam distance.
///
/// Class to help solve closest pair problems with generic interparticle
/// distances and a beam distance, using Anderberg's Nearest Neighbour
/// Heuristic.
///
/// It is templated with a BJ (brief jet) class --- BJ should
/// basically cache the minimal amount of information that is needed
/// to efficiently calculate interparticle distances and particle-beam
/// distances.
///
/// This class can be used with or without an extra "Information" template,
/// i.e. NNB<BJ> or NNH<BJ,I>
///
/// For the NNH<BJ> version of the class to function, BJ must provide
/// three member functions
///
///  - void   BJ::init(const PseudoJet & jet);       // initialise with a PseudoJet
///  - double BJ::distance(const BJ * other_bj_jet); // distance between this and other_bj_jet
///  - double BJ::beam_distance()                  ; // distance to the beam
///
/// For the NNH<BJ,I> version to function, the BJ::init(...) member
/// must accept an extra argument
///
///  - void   BJ::init(const PseudoJet & jet, I * info);   // initialise with a PseudoJet + info
///
/// where info might be a pointer to a class that contains, e.g., information
/// about R, or other parameters of the jet algorithm
///
/// For an example of how the NNH<BJ> class is used, see the Jade (and
/// EECambridge) plugins
///
/// NB: the NNH algorithm is expected N^2, but has a worst case of
/// N^3. Many QCD problems tend to place one closer to the N^3 end of
/// the spectrum than one would like. There is scope for further
/// progress (cf Eppstein, Cardinal & Eppstein), nevertheless the
/// current class is already significantly faster than standard N^3
/// implementations.
///
///
/// Implementation note: this class derives from NNHInfo, which deals
/// with storing any global information that is needed during the clustering

template<class BJ, class I = _NoInfo> class NNH : public NNHInfo<I> {
public:

  /// constructor with an initial set of jets (which will be assigned indices
  /// 0 ... jets.size()-1
  NNH(const std::vector<PseudoJet> & jets) {start(jets);}
  NNH(const std::vector<PseudoJet> & jets, I * info) : NNHInfo<I>(info) {start(jets);}

  void start(const std::vector<PseudoJet> & jets);

  /// return the dij_min and indices iA, iB, for the corresponding jets.
  /// If iB < 0 then iA recombines with the beam
  double dij_min(int & iA, int & iB);

  /// remove the jet pointed to by index iA
  void remove_jet(int iA);

  /// merge the jets pointed to by indices A and B and replace them with
  /// jet, assigning it an index jet_index.
  void merge_jets(int iA, int iB, const PseudoJet & jet, int jet_index);

  /// a destructor
  ~NNH() {
    delete[] briefjets;
  }

private:
  class NNBJ; // forward declaration

  /// establish the nearest neighbour for jet, and cross check constistency
  /// of distances for the other jets that are encountered. Assumes
  /// jet not contained within begin...end
  void set_NN_crosscheck(NNBJ * jet, NNBJ * begin, NNBJ * end);

  /// establish the nearest neighbour for jet; don't cross check other jets'
  /// distances and allow jet to be contained within begin...end
  void set_NN_nocross   (NNBJ * jet, NNBJ * begin, NNBJ * end);

  /// contains the briefjets
  NNBJ * briefjets;

  /// semaphores for the current extent of our structure
  NNBJ * head, * tail;

  /// currently active number of jets
  int n;

  /// where_is[i] contains a pointer to the jet with index i
  std::vector<NNBJ *> where_is;

  /// a class that wraps around the BJ, supplementing it with extra information
  /// such as pointers to neighbours, etc.
  class NNBJ : public BJ {
  public:
    void init(const PseudoJet & jet, int index) {
      BJ::init(jet);
      other_init(index);
    }
    void init(const PseudoJet & jet, int index, I * info) {
      BJ::init(jet, info);
      other_init(index);
    }
    void other_init(int index) {
      _index = index;
      NN_dist = BJ::beam_distance();
      NN = NULL;
    }
    int index() const {return _index;}

    double NN_dist;
    NNBJ * NN;

  private:
    int _index;
  };

};

//----------------------------------------------------------------------
template<class BJ, class I> void NNH<BJ,I>::start(const std::vector<PseudoJet> & jets) {
  n = jets.size();
  briefjets = new NNBJ[n];
  where_is.resize(2*n);

  NNBJ * jetA = briefjets;

  // initialise the basic jet info
  for (int i = 0; i< n; i++) {
    //jetA->init(jets[i], i);
    this->init_jet(jetA, jets[i], i);
    where_is[i] = jetA;
    jetA++; // move on to next entry of briefjets
  }
  tail = jetA; // a semaphore for the end of briefjets
  head = briefjets; // a nicer way of naming start

  // now initialise the NN distances: jetA will run from 1..n-1; and
  // jetB from 0..jetA-1
  for (jetA = head + 1; jetA != tail; jetA++) {
    // set NN info for jetA based on jets running from head..jetA-1,
    // checking in the process whether jetA itself is an undiscovered
    // NN of one of those jets.
    set_NN_crosscheck(jetA, head, jetA);
  }
  //std::cout << "OOOO "  << briefjets[1].NN_dist << " " << briefjets[1].NN - briefjets << std::endl;
}

//----------------------------------------------------------------------
template<class BJ, class I> double NNH<BJ,I>::dij_min(int & iA, int & iB) {
  // find the minimum of the diJ on this round
  double diJ_min = briefjets[0].NN_dist;
  int diJ_min_jet = 0;
  for (int i = 1; i < n; i++) {
    if (briefjets[i].NN_dist < diJ_min) {
      diJ_min_jet = i;
      diJ_min  = briefjets[i].NN_dist;
    }
  }

  // return information to user about recombination
  NNBJ * jetA = & briefjets[diJ_min_jet];
  //std::cout << jetA - briefjets << std::endl;
  iA = jetA->index();
  iB = jetA->NN ? jetA->NN->index() : -1;
  return diJ_min;
}

//----------------------------------------------------------------------
// remove jetA from the list
template<class BJ, class I> void NNH<BJ,I>::remove_jet(int iA) {
  NNBJ * jetA = where_is[iA];
  // now update our nearest neighbour info and diJ table
  // first reduce size of table
  tail--; n--;
  // Copy last jet contents and diJ info into position of jetA
  *jetA = *tail;
  // update the info on where the given index is stored
  where_is[jetA->index()] = jetA;

  for (NNBJ * jetI = head; jetI != tail; jetI++) {
    // see if jetI had jetA or jetB as a NN -- if so recalculate the NN
    if (jetI->NN == jetA) set_NN_nocross(jetI, head, tail);

    // if jetI's NN is the new tail then relabel it so that it becomes jetA
    if (jetI->NN == tail) {jetI->NN = jetA;}
  }
}

//----------------------------------------------------------------------
template<class BJ, class I> void NNH<BJ,I>::merge_jets(int iA, int iB,
					const PseudoJet & jet, int index) {

  NNBJ * jetA = where_is[iA];
  NNBJ * jetB = where_is[iB];

  // If necessary relabel A & B to ensure jetB < jetA, that way if
  // the larger of them == newtail then that ends up being jetA and
  // the new jet that is added as jetB is inserted in a position that
  // has a future!
  if (jetA < jetB) std::swap(jetA,jetB);

  // initialise jetB based on the new jet
  //jetB->init(jet, index);
  this->init_jet(jetB, jet, index);
  // and record its position (making sure we have the space)
  if (index >= int(where_is.size())) where_is.resize(2*index);
  where_is[jetB->index()] = jetB;

  // now update our nearest neighbour info
  // first reduce size of table
  tail--; n--;
  // Copy last jet contents into position of jetA
  *jetA = *tail;
  // update the info on where the tail's index is stored
  where_is[jetA->index()] = jetA;

  for (NNBJ * jetI = head; jetI != tail; jetI++) {
    // see if jetI had jetA or jetB as a NN -- if so recalculate the NN
    if (jetI->NN == jetA || jetI->NN == jetB) {
      set_NN_nocross(jetI, head, tail);
    }

    // check whether new jetB is closer than jetI's current NN and
    // if need be update things
    double dist = jetI->distance(jetB);
    if (dist < jetI->NN_dist) {
      if (jetI != jetB) {
	jetI->NN_dist = dist;
	jetI->NN = jetB;
      }
    }
    if (dist < jetB->NN_dist) {
      if (jetI != jetB) {
	jetB->NN_dist = dist;
	jetB->NN      = jetI;
      }
    }

    // if jetI's NN is the new tail then relabel it so that it becomes jetA
    if (jetI->NN == tail) {jetI->NN = jetA;}
  }
}

//----------------------------------------------------------------------
// this function assumes that jet is not contained within begin...end
template <class BJ, class I> void NNH<BJ,I>::set_NN_crosscheck(NNBJ * jet,
		    NNBJ * begin, NNBJ * end) {
  double NN_dist = jet->beam_distance();
  NNBJ * NN      = NULL;
  for (NNBJ * jetB = begin; jetB != end; jetB++) {
    double dist = jet->distance(jetB);
    if (dist < NN_dist) {
      NN_dist = dist;
      NN = jetB;
    }
    if (dist < jetB->NN_dist) {
      jetB->NN_dist = dist;
      jetB->NN = jet;
    }
  }
  jet->NN = NN;
  jet->NN_dist = NN_dist;
}

//----------------------------------------------------------------------
// set the NN for jet without checking whether in the process you might
// have discovered a new nearest neighbour for another jet
template <class BJ, class I>  void NNH<BJ,I>::set_NN_nocross(
                 NNBJ * jet, NNBJ * begin, NNBJ * end) {
  double NN_dist = jet->beam_distance();
  NNBJ * NN      = NULL;
  if (head < jet) {
    for (NNBJ * jetB = head; jetB != jet; jetB++) {
      double dist = jet->distance(jetB);
      if (dist < NN_dist) {
	NN_dist = dist;
	NN = jetB;
      }
    }
  }
  if (tail > jet) {
    for (NNBJ * jetB = jet+1; jetB != tail; jetB++) {
      double dist = jet->distance (jetB);
      if (dist < NN_dist) {
	NN_dist = dist;
	NN = jetB;
      }
    }
  }
  jet->NN = NN;
  jet->NN_dist = NN_dist;
}

FASTJET_END_NAMESPACE      // defined in fastjet/internal/base.hh

#endif // __NNH_HH__


text:
// Copyright © 2018 Wave Engine S.L. All rights reserved. Use is subject to license terms.

#region Using Statements
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using WaveEngine.Common.Graphics;
using WaveEngine.Framework;
using WaveEngine.Framework.Graphics;
using WaveEngine.Framework.UI;
#endregion

namespace WaveEngine.Components.UI
{
    /// <summary>
    /// UI decorator base class
    /// </summary>
    public abstract class UIBase : BaseDecorator
    {
        #region Properties

        /// <summary>
        /// Gets or sets a value indicating whether this instance is border.
        /// </summary>
        /// <value>
        ///   <c>true</c> if this instance is border; otherwise, <c>false</c>.
        /// </value>
        public bool IsBorder
        {
            get
            {
                return this.entity.FindComponent<BorderRenderer>() != null ? true : false;
            }

            set
            {
                if (value)
                {
                    if (this.entity.FindComponent<BorderRenderer>() == null)
                    {
                        this.entity.AddComponent(new BorderRenderer());
                    }
                }
                else
                {
                    BorderRenderer borderRenderer = this.entity.FindComponent<BorderRenderer>();
                    if (borderRenderer != null)
                    {
                        this.entity.RemoveComponent<BorderRenderer>();
                    }
                }

                this.entity.RefreshDependencies();
            }
        }

        /// <summary>
        /// Gets or sets the color of the border.
        /// </summary>
        /// <value>
        /// The color of the border.
        /// </value>
        /// <exception cref="InvalidOperationException">There isn't Border component. You must set Border=true</exception>
        public Color BorderColor
        {
            get
            {
                BorderRenderer borderRenderer = this.entity.FindComponent<BorderRenderer>();
                if (borderRenderer != null)
                {
                    return borderRenderer.Color;
                }
                else
                {
                    throw new InvalidOperationException("There isn't Border component. You must set Border=true");
                }
            }

            set
            {
                BorderRenderer borderRenderer = this.entity.FindComponent<BorderRenderer>();
                if (borderRenderer != null)
                {
                    borderRenderer.Color = value;
                }
            }
        }

        /// <summary>
        /// Gets or sets the element draw order.
        /// </summary>
        /// <value>
        /// The element draw order [0-1].
        /// </value>
        public float DrawOrder
        {
            get
            {
                Transform2D transform = this.entity.FindComponent<Transform2D>();
                if (transform != null)
                {
                    return transform.DrawOrder;
                }
                else
                {
                    throw new InvalidOperationException("There isn't Transform2D component.");
                }
            }

            set
            {
                Transform2D transform = this.entity.FindComponent<Transform2D>();
                if (transform != null)
                {
                    transform.DrawOrder = value;
                }
            }
        }

        /// <summary>
        /// Gets or sets the opacity.
        /// </summary>
        /// <value>
        /// The opacity property [0-Transparent 1-Opaque].
        /// </value>
        /// <exception cref="InvalidOperationException">There isn't Transform2D component.</exception>
        public float Opacity
        {
            get
            {
                Transform2D transform = this.entity.FindComponent<Transform2D>();
                if (transform != null)
                {
                    return transform.Opacity;
                }
                else
                {
                    throw new InvalidOperationException("There isn't Transform2D component.");
                }
            }

            set
            {
                Transform2D transform = this.entity.FindComponent<Transform2D>();
                if (transform != null)
                {
                    transform.Opacity = value;
                }
            }
        }

        #endregion

        /// <summary>
        /// Sets the value.
        /// </summary>
        /// <param name="dp">The dp.</param>
        /// <param name="value">The value.</param>
        public void SetValue(DependencyProperty dp, object value)
        {
            Control control = this.entity.FindComponent<Control>(false);
            if (control != null)
            {
                control.SetValue(dp, value);
            }
        }

        /// <summary>
        /// Gets the value.
        /// </summary>
        /// <param name="dp">The dp.</param>
        /// <returns>DependencyProperty value</returns>
        public object GetValue(DependencyProperty dp)
        {
            object result = null;

            Control control = this.entity.FindComponent<Control>(false);
            if (control != null)
            {
                result = control.GetValue(dp);
            }

            return result;
        }

        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public override void Dispose()
        {
            FocusBehavior focusBehavior = this.entity.FindComponent<FocusBehavior>();
            if (focusBehavior != null)
            {
                if (FocusBehavior.CurrentFocus == focusBehavior)
                {
                    FocusBehavior.CurrentFocus = null;
                }
            }

            base.Dispose();
        }
    }
}


text: Slidecole::Application.config.session_store :cookie_store, key: '_slidecole_session'


text:
/**
 * @author Caspar Addyman
 *
 * helper functions for reading and writing drunk settings
 * to and from the database tables Pissonyms and  DrunkenessReports
 */

	//maintain a database connection we can use
	var conn;
	if (!conn){
		conn = Titanium.Database.install('/ybob.db','ybob');
	}

	//get data for the maximum row id
	exports.selectNRandomRows = function (numRows, frequencyRange){
		var returnData = [];
		var nRows = parseInt(numRows, 10);
		//TODO Filter by frequency range
		//ROW 0 is entry for Sober so skip that
		var rows =conn.execute('SELECT * FROM pissonyms WHERE ID > 0 ORDER BY RANDOM() LIMIT ?', nRows);
		if (rows !== null ) {
			while(rows.isValidRow()){
				returnData.push({
					ID: parseInt(rows.fieldByName('ID'),10),
					Pissonym: rows.fieldByName('Pissonym'),
					DrunkFactor:parseFloat(rows.fieldByName('DrunkFactor')),
					DrunkListID: parseInt(rows.fieldByName('DrunkListID')),
					Frequency: parseFloat(rows.fieldByName('Frequency'))
				});
				rows.next();
			};
			rows.close();
			return returnData;
		}
		//something didn't work
		return false;
	};

	exports.getWordInfo = function (word){
		var returnData = [];
		//TODO Filter by frequency range
		var rows =conn.execute('SELECT * FROM pissonyms WHERE Pissonym = ?', word);
		if (rows !== null ) {
			while(rows.isValidRow()){
				returnData.push({
					ID: parseInt(rows.fieldByName('ID')),
					Pissonym: rows.fieldByName('Pissonym'),
					DrunkFactor:parseFloat(rows.fieldByName('DrunkFactor')),
					DrunkListID: parseInt(rows.fieldByName('DrunkListID')),
					Frequency: parseFloat(rows.fieldByName('Frequency'))
				});
				rows.next();
			};
			rows.close();
			return returnData;
		}
		//something didn't work
		return false;
	};

	/**
	 * Participant has chosen a pissonym - record their choice
	 * @param {Object} choiceData
	 */
	exports.Chosen = function (choiceData){
		Titanium.API.debug('chosen Pissonym ' + JSON.stringify(choiceData));
		var sessionID = Titanium.App.Properties.getInt('SessionID');
		for (var i=0; i<choiceData.length; i++){
			var insertstr = 'INSERT INTO WordChoices (SessionID,WordType,chosenWord,WordList,ChoiceStart,ChoiceFinish) VALUES(?,?,?,?,?,?)';
			conn.execute(insertstr,sessionID, 'Pissonym',choiceData[i].ChosenWord, choiceData[i].WordList, choiceData[i].StartTime,choiceData[i].EndTime);
			Titanium.API.debug('Emotional Word choices, rowsAffected = ' +conn.rowsAffected);
			Titanium.API.debug('Emotional Word choices, lastInsertRowId = ' +conn.lastInsertRowId);
		}
	};

	exports.PlayCount = function (){
		var selectStr = 'SELECT COUNT(*) from WORDCHOICES  where WordType = ?';
		var rows =conn.execute(selectStr, 'Pissonym');
		if (rows !== null) {
			var retval = parseInt(rows.field(0))
			rows.close();
			return retval;
		}else{
			return 0;
		}
	};
	exports.LastPlayed = function(){
		var selectStr = 'SELECT max(ChoiceFinish) from WORDCHOICES  where WordType = ?';
		var rows =conn.execute(selectStr, 'Pissonym');
		if (rows !== null) {
			var retval = parseInt(rows.field(0))
			rows.close();
			return retval;
		}else{
			return 0;
		}
	}

	/**
	 * Participant has suggested new pissonym. Let's add it to the list
	 */
	exports.addUserPissonym = function (pissonym){
		Titanium.API.debug('addUserPissonym');

		//first check that suggestion is actually new.
		var rows =conn.execute('SELECT COUNT(*) From pissonymns where pissonym = ?', pissonym)
		if (rows !== null){
			select
			var insertstr = 'INSERT INTO TripReports (ReportStarted,ReportChanged,SessionID,Content)';
			insertstr += 'VALUES(?,?,?,?)';
			conn.execute(insertstr,newData.ReportStarted,newData.ReportChanged,newData.SessionID,newData.Content);
			Titanium.API.debug('TripReports updated, rowsAffected = ' +conn.rowsAffected);
			Titanium.API.debug('TripReports, lastInsertRowId = ' +conn.lastInsertRowId);
		}
		//TODO also an entry to the tripreport table about this
	};


text:
<!DOCTYPE html>

<meta charset=utf-8>
<title>Curriculum Vitae van Tommy Carlier</title>
<meta http-equiv=refresh content="0;url=http://etc.tcx.be/cv/">
{% include page-meta.html %}
{% include page-header.html %}
Redirecting to etc.tcx.be/cv…
{% include page-footer.html %}


text:
USING_NS_CC;

#pragma mark - Public Interface

bool HudLayer::init() {
  if (!Layer::init()) {
    return false;
  }

  this->setName(HUD_LAYER_NAME);
  this->_setupChildren();

  return true;
}

void HudLayer::adjustLevel(int level) {
  this->_getLevelLabel()->setString(this->_append(HUD_LEVEL_STRING, level));
}

void HudLayer::adjustXp(int xp) {
  this->_getXpLabel()->setString(this->_append(HUD_XP_STRING, xp));
}

void HudLayer::adjustCoins(int coins) {
  this->_getCoinsLabel()->setString(this->_append(HUD_COINS_STRING, coins));
}

#pragma mark - Private Interface

void HudLayer::_setupChildren() {
  auto padding = 12;

  auto x = 40;
  auto y = this->getContentSize().height - padding;

  auto initialLevel = this->_append(HUD_LEVEL_STRING, 0);
  auto levelLabel = Label::createWithTTF(initialLevel, HUD_FONT_NAME, HUD_FONT_SIZE);
  levelLabel->setAnchorPoint(Vec2::ANCHOR_MIDDLE_LEFT);
  levelLabel->setName(HUD_LEVEL_LABEL_NAME);
  levelLabel->setPosition(Vec2(x, y));
  this->addChild(levelLabel);

  y = levelLabel->getPosition().y - levelLabel->getContentSize().height;

  auto initialXp = this->_append(HUD_XP_STRING, INITIAL_EXPERIENCE);
  auto xpLabel = Label::createWithTTF(initialXp, HUD_FONT_NAME, HUD_FONT_SIZE);
  xpLabel->setAnchorPoint(Vec2::ANCHOR_MIDDLE_LEFT);
  xpLabel->setName(HUD_XP_LABEL_NAME);
  xpLabel->setPosition(Vec2(x, y));
  this->addChild(xpLabel);

  y = xpLabel->getPosition().y - xpLabel->getContentSize().height;

  auto initialCoins = this->_append(HUD_COINS_STRING, INITIAL_COINS);
  auto coinsLabel = Label::createWithTTF(initialCoins, HUD_FONT_NAME, HUD_FONT_SIZE);
  coinsLabel->setAnchorPoint(Vec2::ANCHOR_MIDDLE_LEFT);
  coinsLabel->setName(HUD_COINS_LABEL_NAME);
  coinsLabel->setPosition(Vec2(x, y));
  this->addChild(coinsLabel);
}

Label* HudLayer::_getLevelLabel() {
  return this->getChildByName<Label*>(HUD_LEVEL_LABEL_NAME);
}

Label* HudLayer::_getXpLabel() {
  return this->getChildByName<Label*>(HUD_XP_LABEL_NAME);
}

Label* HudLayer::_getCoinsLabel() {
  return this->getChildByName<Label*>(HUD_COINS_LABEL_NAME);
}

std::string HudLayer::_append(std::string base, int number) {
  std::stringstream ss;
  ss << base;
  ss << " ";
  ss << number;
  return ss.str();
}


text:
{% from 'macros/flag.html' import render_flag %}

{% macro nav_link_security(endpoint, text, icon=None) %}

    {% if icon %} {% endif %}
    {{ text }}

{% endmacro %}

{% macro nav_link(endpoint, text, level, icon=None) %}

    {% if icon %} {% endif %}
    {{ text }}

{% endmacro %}

{% macro language_switcher() %}

    {{ render_flag(current_locale) }}

    {% for locale in locales %}

        {{ render_flag(locale) }} {{ locale.language_name | capitalize }}

    {% endfor %}

{% endmacro %}

{% macro main_nav() %}

      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
        {{ _('Toggle navigation') }}

      </button>
      {{ _('Ascoderu') }}

        {{ nav_link('home', _('Home'), level=0, icon='home') }}
        {{ nav_link('about', _('About'), level=0, icon='info-circle') }}
        {{ nav_link('email_inbox', _('Email'), level=0, icon='envelope') }}
        {{ nav_link('users', _('Users'), level=0, icon='users') }}
        {{ nav_link('news', _('News'), level=0, icon='comments') }}
        {% if current_user.is_admin and not local_only %}
        {{ nav_link('settings', _('Settings'), level=0, icon='cog') }}
        {% endif %}

        {{ language_switcher() }}
        {% if current_user.is_authenticated %}

            {{ current_user.email }}

{{ nav_link_security('change_password', _('Change password'), icon='key') }}

{{ nav_link_security('logout', _('Logout'), icon='sign-out') }}

        {% else %}
        {{ nav_link_security('login', _('Login')) }}
        {{ nav_link_security('register', _('Register')) }}
        {% endif %}

{% endmacro %}

{% macro email_subnav() %}

  {{ nav_link('email_inbox', _('Inbox'), level=1) }}
  {{ nav_link('email_sent', _('Sent'), level=1) }}
  {{ nav_link('email_outbox', _('Outbox'), level=1) }}
  {{ nav_link('email_new', _('Write email'), level=1) }}
  {{ nav_link('email_search', _('Search'), level=1) }}

{% endmacro %}


text:
/* Author: Ioan Sucan */

#include "ompl/base/StateStorage.h"
#include "ompl/base/PrecomputedStateSampler.h"
#include "ompl/util/Exception.h"
#include <fstream>
#include <algorithm>
#include <boost/bind.hpp>

#include <boost/serialization/binary_object.hpp>
#include <boost/archive/archive_exception.hpp>

/// @cond IGNORE
static ompl::base::StateSamplerPtr allocPrecomputedStateSampler(const ompl::base::StateSpace *space,
                                                                const std::vector<int> &expectedSignature,
                                                                const std::vector<const ompl::base::State*> *states,
                                                                std::size_t minIndex, std::size_t maxIndex)
{
    std::vector<int> sig;
    space->computeSignature(sig);
    if (sig != expectedSignature)
    {
        std::stringstream ss;
        ss << "Cannot allocate state sampler for a state space whose signature does not match that of the stored states. ";
        ss << "Expected signature ";
        for (std::size_t i = 0 ; i < expectedSignature.size() ; ++i)
            ss << expectedSignature[i] << " ";
        ss << "but space " << space->getName() << " has signature ";
        for (std::size_t i = 0 ; i < sig.size() ; ++i)
            ss << sig[i] << " ";
        throw ompl::Exception(ss.str());
    }
    return ompl::base::StateSamplerPtr(new ompl::base::PrecomputedStateSampler(space, *states, minIndex, maxIndex));
}

static const boost::uint32_t OMPL_ARCHIVE_MARKER = 0x4C504D4F; // this spells OMPL
/// @endcond

ompl::base::StateStorage::StateStorage(const StateSpacePtr &space) : space_(space), hasMetadata_(false)
{
}

ompl::base::StateStorage::~StateStorage()
{
    freeMemory();
}

void ompl::base::StateStorage::load(const char *filename)
{
    std::ifstream in(filename, std::ios::binary);
    load(in);
    in.close();
}

void ompl::base::StateStorage::store(const char *filename)
{
    std::ofstream out(filename, std::ios::binary);
    store(out);
    out.close();
}

void ompl::base::StateStorage::load(std::istream &in)
{
    clear();
    if (!in.good() || in.eof())
    {
        OMPL_WARN("Unable to load states");
        return;
    }
    try
    {

        boost::archive::binary_iarchive ia(in);
        Header h;
        ia >> h;
        if (h.marker != OMPL_ARCHIVE_MARKER)
        {
            OMPL_ERROR("OMPL archive marker not found");
            return;
        }

        std::vector<int> sig;
        space_->computeSignature(sig);
        if (h.signature != sig)
        {
            OMPL_ERROR("State space signatures do not match");
            return;
        }
        loadStates(h, ia);
        loadMetadata(h, ia);
    }

    catch (boost::archive::archive_exception &ae)
    {
        OMPL_ERROR("Unable to load archive: %s", ae.what());
    }

}

void ompl::base::StateStorage::loadStates(const Header &h, boost::archive::binary_iarchive &ia)
{
    OMPL_DEBUG("Deserializing %u states", h.state_count);
    // load the file
    unsigned int l = space_->getSerializationLength();
    char *buffer = new char[l];
    State *s = space_->allocState();
    for (std::size_t i = 0 ; i < h.state_count ; ++i)
    {
        ia >> boost::serialization::make_binary_object(buffer, l);
        space_->deserialize(s, buffer);
        addState(s);
    }
    space_->freeState(s);
    delete[] buffer;
}

void ompl::base::StateStorage::loadMetadata(const Header& /*h*/, boost::archive::binary_iarchive& /*ia*/)
{
}

void ompl::base::StateStorage::store(std::ostream &out)
{
    if (!out.good())
    {
        OMPL_WARN("Unable to store states");
        return;
    }
    try
    {
        Header h;
        h.marker = OMPL_ARCHIVE_MARKER;
        h.state_count = states_.size();
        space_->computeSignature(h.signature);

        boost::archive::binary_oarchive oa(out);
        oa << h;

        storeStates(h, oa);
        storeMetadata(h, oa);
    }
    catch (boost::archive::archive_exception &ae)
    {
        OMPL_ERROR("Unable to save archive: %s", ae.what());
    }
}

void ompl::base::StateStorage::storeStates(const Header& /*h*/, boost::archive::binary_oarchive &oa)
{
    OMPL_DEBUG("Serializing %u states", (unsigned int)states_.size());

    unsigned int l = space_->getSerializationLength();
    char *buffer = new char[l];
    for (std::size_t i = 0 ; i < states_.size() ; ++i)
    {
        space_->serialize(buffer, states_[i]);
        oa << boost::serialization::make_binary_object(buffer, l);
    }
    delete[] buffer;
}

void ompl::base::StateStorage::storeMetadata(const Header& /*h*/, boost::archive::binary_oarchive& /*oa*/)
{
}

void ompl::base::StateStorage::addState(const State *state)
{
    State *copy = space_->allocState();
    space_->copyState(copy, state);
    states_.push_back(copy);
}

void ompl::base::StateStorage::generateSamples(unsigned int count)
{
    StateSamplerPtr ss = space_->allocStateSampler();
    states_.reserve(states_.size() + count);
    State *s = space_->allocState();
    for (unsigned int i = 0 ; i < count ; ++i)
    {
        ss->sampleUniform(s);
        addState(s);
    }
    space_->freeState(s);
}

void ompl::base::StateStorage::freeMemory()
{
    for (std::size_t i = 0 ; i < states_.size() ; ++i)
        space_->freeState(const_cast<State*>(states_[i]));
}

void ompl::base::StateStorage::clear()
{
    freeMemory();
    states_.clear();
}

void ompl::base::StateStorage::sort(const boost::function<bool(const State*, const State*)> &op)
{
    std::sort(states_.begin(), states_.end(), op);
}

ompl::base::StateSamplerAllocator ompl::base::StateStorage::getStateSamplerAllocator() const
{
    return getStateSamplerAllocatorRange(0, states_.empty() ? 0 : states_.size() - 1);
}

ompl::base::StateSamplerAllocator ompl::base::StateStorage::getStateSamplerAllocatorRangeUntil(std::size_t until) const
{
    return getStateSamplerAllocatorRange(0, until);
}

ompl::base::StateSamplerAllocator ompl::base::StateStorage::getStateSamplerAllocatorRangeAfter(std::size_t after) const
{
    return getStateSamplerAllocatorRange(after, states_.empty() ? 0 : states_.size() - 1);
}

ompl::base::StateSamplerAllocator ompl::base::StateStorage::getStateSamplerAllocatorRange(std::size_t from, std::size_t to) const
{
    if (states_.empty())
        throw Exception("Cannot allocate state sampler from empty state storage");
    std::vector<int> sig;
    space_->computeSignature(sig);
    return boost::bind(&allocPrecomputedStateSampler, _1, sig, &states_, from, to);
}

void ompl::base::StateStorage::print(std::ostream &out) const
{
    for (std::size_t i = 0 ; i < states_.size() ; ++i)
        space_->printState(states_[i], out);
}


text:
from __future__ import absolute_import
# Generated by Django 1.9 on 2016-05-03 02:48
from __future__ import unicode_literals

from django.db import migrations

class Migration(migrations.Migration):

    dependencies = [
        ('podcasts', '0014_auto_20160503_0247'),
    ]

    operations = [
        migrations.RemoveField(
            model_name='podcast',
            name='tip_last_payout',
        ),
        migrations.RemoveField(
            model_name='podcast',
            name='tip_last_payout_amount',
        ),
        migrations.RemoveField(
            model_name='podcast',
            name='tip_value',
        ),
    ]


text:
package nl.pvanassen.ns.model.reisadvies;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * http://www.ns.nl/api/api#api-documentatie-reisadviezen
 *
 * @author Paul van Assen
 *
 */
@Data
@AllArgsConstructor(access = AccessLevel.PACKAGE)
public class ReisStop implements Serializable {
    private final String naam;
    private final Date tijd;
    private final String spoor;
    private final boolean gewijzigdVertrekspoor;
}


text:
% Styles

* [Layout Grid](styles/layout-grid.html)

    An introduction to the layout grid, which gives developers and designers a
    common point of reference when designing application screens

* [Fonts](styles/fonts.html)

    An overview of the fonts that may be used in webOS TV apps, along with
    information on the webOS TV system fonts

* [Color](styles/color.html)

    An overview of the webOS TV system colors

* [Icons](styles/icons.html)

    Guidelines for designing appropriate icons for your app


text:
cordova.define('cordova/plugin_list', function(require, exports, module) {
module.exports = [
    {
        "id": "de.appplant.cordova.plugin.email-composer.EmailComposer",
        "file": "plugins/de.appplant.cordova.plugin.email-composer/www/email_composer.js",
        "pluginId": "de.appplant.cordova.plugin.email-composer",
        "clobbers": [
            "cordova.plugins.email",
            "plugin.email"
        ]
    }
];
module.exports.metadata =
// TOP OF METADATA
{
    "de.appplant.cordova.plugin.email-composer": "0.8.2"
};
// BOTTOM OF METADATA
});


text:
SELECT Id, Company, Salary FROM
(
SELECT e.Id, e.Salary, e.Company,  IF (@Prev = e.Company , @Rank := @Rank + 1, @Rank := 1) AS Rank, @Prev := e.Company
FROM Employee e , (SELECT @Rank := 0, @prev := 0) AS Temp ORDER BY e.Company, e.Salary, e.Id
) Ranking
INNER JOIN
(
SELECT COUNT(*) AS TotalCount, Company AS Name FROM Employee e2 GROUP BY e2.Company
) CompanyCount
ON CompanyCount.Name = Ranking.Company
WHERE Rank = floor((TotalCount+1)/2) OR Rank = floor((TotalCount+2)/2)


text:
"""
Tests for L{eliot.logwriter}.
"""

from __future__ import unicode_literals

import time
import threading

# Make sure to use StringIO that only accepts unicode:
from io import BytesIO, StringIO
from unittest import skipIf
import json as pyjson
from warnings import catch_warnings, simplefilter

from six import PY2

try:
    from zope.interface.verify import verifyClass
    from twisted.internet import reactor
    from twisted.trial.unittest import TestCase
    from twisted.application.service import IService
    from twisted.python import threadable
except ImportError:
    # Make tests not run at all.
    TestCase = object
else:
    # Make sure we always import this if Twisted is available, so broken
    # logwriter.py causes a failure:
    from ..logwriter import ThreadedFileWriter, ThreadedWriter

from .. import Logger, removeDestination, FileDestination

class BlockingFile(object):
    """
    A file-like whose writes can be blocked.

    Also, allow calling C{getvalue} after C{close}, unlike L{BytesIO}.
    """

    def __init__(self):
        self.file = BytesIO()
        self.lock = threading.Lock()
        self.data = b""

    def block(self):
        """
        Prevent writes until L{unblock} is called.
        """
        self.lock.acquire()

    def unblock(self):
        """
        Allow writes if L{block} was previous called.
        """
        self.lock.release()

    def getvalue(self):
        """
        Get written bytes.

        @return: Written bytes.
        """
        return self.data

    def write(self, data):
        with self.lock:
            self.file.write(data)

    def flush(self):
        self.data = self.file.getvalue()

    def close(self):
        self.file.close()

class ThreadedWriterTests(TestCase):
    """
    Tests for L{ThreadedWriter}.

    Many of these tests involve interactions across threads, so they
    arbitrarily wait for up to 5 seconds to reduce chances of slow thread
    switching causing the test to fail.
    """

    def test_interface(self):
        """
        L{ThreadedWriter} provides L{IService}.
        """
        verifyClass(IService, ThreadedWriter)

    def test_name(self):
        """
        L{ThreadedWriter} has a name.
        """
        self.assertEqual(ThreadedWriter.name, "Eliot Log Writer")

    def test_startServiceRunning(self):
        """
        L{ThreadedWriter.startService} starts the service as required by the
        L{IService} interface.
        """
        writer = ThreadedWriter(FileDestination(file=BytesIO()), reactor)
        self.assertFalse(writer.running)
        writer.startService()
        self.addCleanup(writer.stopService)
        self.assertTrue(writer.running)

    def test_stopServiceRunning(self):
        """
        L{ThreadedWriter.stopService} stops the service as required by the
        L{IService} interface.
        """
        writer = ThreadedWriter(FileDestination(file=BytesIO()), reactor)
        writer.startService()
        d = writer.stopService()
        d.addCallback(lambda _: self.assertFalse(writer.running))
        return d

    def test_startServiceStartsThread(self):
        """
        L{ThreadedWriter.startService} starts up a thread running
        L{ThreadedWriter._writer}.
        """
        previousThreads = threading.enumerate()
        result = []
        event = threading.Event()

        def _writer():
            current = threading.currentThread()
            if current not in previousThreads:
                result.append(current)
            event.set()

        writer = ThreadedWriter(FileDestination(file=BytesIO()), reactor)
        writer._writer = _writer
        writer.startService()
        event.wait()
        self.assertTrue(result)
        # Make sure thread is dead so it doesn't die half way through another
        # test:
        result[0].join(5)

    def test_stopServiceStopsThread(self):
        """
        L{ThreadedWriter.stopService} stops the writer thread.
        """
        previousThreads = set(threading.enumerate())
        writer = ThreadedWriter(FileDestination(file=BytesIO()), reactor)
        writer.startService()
        start = time.time()
        while set(threading.enumerate()) == previousThreads and (
            time.time() - start < 5
        ):
            time.sleep(0.0001)
        # If not true the next assertion might pass by mistake:
        self.assertNotEqual(set(threading.enumerate()), previousThreads)
        writer.stopService()
        while set(threading.enumerate()) != previousThreads and (
            time.time() - start < 5
        ):
            time.sleep(0.0001)
        self.assertEqual(set(threading.enumerate()), previousThreads)

    def test_stopServiceFinishesWriting(self):
        """
        L{ThreadedWriter.stopService} stops the writer thread, but only after
        all queued writes are written out.
        """
        f = BlockingFile()
        writer = ThreadedWriter(FileDestination(file=f), reactor)
        f.block()
        writer.startService()
        for i in range(100):
            writer({"write": 123})
        threads = threading.enumerate()
        writer.stopService()
        # Make sure writes didn't happen before the stopService, thus making the
        # test pointless:
        self.assertEqual(f.getvalue(), b"")
        f.unblock()
        start = time.time()
        while threading.enumerate() == threads and time.time() - start < 5:
            time.sleep(0.0001)
        self.assertEqual(f.getvalue(), b'{"write": 123}\n' * 100)

    def test_stopServiceResult(self):
        """
        L{ThreadedWriter.stopService} returns a L{Deferred} that fires only
        after the thread has shut down.
        """
        f = BlockingFile()
        writer = ThreadedWriter(FileDestination(file=f), reactor)
        f.block()
        writer.startService()

        writer({"hello": 123})
        threads = threading.enumerate()
        d = writer.stopService()
        f.unblock()

        def done(_):
            self.assertEqual(f.getvalue(), b'{"hello": 123}\n')
            self.assertNotEqual(threading.enumerate(), threads)

        d.addCallback(done)
        return d

    def test_noChangeToIOThread(self):
        """
        Running a L{ThreadedWriter} doesn't modify the Twisted registered IO
        thread.
        """
        writer = ThreadedWriter(FileDestination(file=BytesIO()), reactor)
        writer.startService()
        d = writer.stopService()
        # Either the current thread (the one running the tests) is the the I/O
        # thread or the I/O thread was never set. Either may happen depending on
        # how and whether the reactor has been started by the unittesting
        # framework.
        d.addCallback(
            lambda _: self.assertIn(
                threadable.ioThread, (None, threading.currentThread().ident)
            )
        )
        return d

    def test_startServiceRegistersDestination(self):
        """
        L{ThreadedWriter.startService} registers itself as an Eliot log
        destination.
        """
        f = BlockingFile()
        writer = ThreadedWriter(FileDestination(file=f), reactor)
        writer.startService()
        Logger().write({"x": "abc"})
        d = writer.stopService()
        d.addCallback(lambda _: self.assertIn(b"abc", f.getvalue()))
        return d

    def test_stopServiceUnregistersDestination(self):
        """
        L{ThreadedWriter.stopService} unregisters itself as an Eliot log
        destination.
        """
        writer = ThreadedWriter(FileDestination(file=BytesIO()), reactor)
        writer.startService()
        d = writer.stopService()
        d.addCallback(lambda _: removeDestination(writer))
        return self.assertFailure(d, ValueError)

    def test_call(self):
        """
        The message passed to L{ThreadedWriter.__call__} is passed to the
        underlying destination in the writer thread.
        """
        result = []

        def destination(message):
            result.append((message, threading.currentThread().ident))

        writer = ThreadedWriter(destination, reactor)
        writer.startService()
        thread_ident = writer._thread.ident
        msg = {"key": 123}
        writer(msg)
        d = writer.stopService()
        d.addCallback(lambda _: self.assertEqual(result, [(msg, thread_ident)]))
        return d

class ThreadedFileWriterTests(TestCase):
    """
    Tests for ``ThreadedFileWriter``.
    """

    def test_deprecation_warning(self):
        """
        Instantiating ``ThreadedFileWriter`` gives a ``DeprecationWarning``.
        """
        with catch_warnings(record=True) as warnings:
            ThreadedFileWriter(BytesIO(), reactor)
            simplefilter("always")  # Catch all warnings
            self.assertEqual(warnings[-1].category, DeprecationWarning)

    def test_write(self):
        """
        Messages passed to L{ThreadedFileWriter.__call__} are then written by
        the writer thread with a newline added.
        """
        f = BytesIO()
        writer = ThreadedFileWriter(f, reactor)
        writer.startService()
        self.addCleanup(writer.stopService)

        writer({"hello": 123})
        start = time.time()
        while not f.getvalue() and time.time() - start < 5:
            time.sleep(0.0001)
        self.assertEqual(f.getvalue(), b'{"hello": 123}\n')

    @skipIf(PY2, "Python 2 files always accept bytes")
    def test_write_unicode(self):
        """
        Messages passed to L{ThreadedFileWriter.__call__} are then written by
        the writer thread with a newline added to files that accept
        unicode.
        """
        f = StringIO()
        writer = ThreadedFileWriter(f, reactor)
        writer.startService()
        self.addCleanup(writer.stopService)

        original = {"hello\u1234": 123}
        writer(original)
        start = time.time()
        while not f.getvalue() and time.time() - start < 5:
            time.sleep(0.0001)
        self.assertEqual(f.getvalue(), pyjson.dumps(original) + "\n")

    def test_stopServiceClosesFile(self):
        """
        L{ThreadedWriter.stopService} closes the file.
        """
        f = BytesIO()
        writer = ThreadedFileWriter(f, reactor)
        writer.startService()
        d = writer.stopService()

        def done(_):
            self.assertTrue(f.closed)

        d.addCallback(done)
        return d


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

    <RelativeLayout
        android:id="@+id/topView"
		android:layout_width="match_parent"
		android:layout_height="match_parent">

		<TextView
		    android:id="@+id/title"
		    android:layout_width="wrap_content"
		    android:layout_height="wrap_content"
		    android:layout_alignParentTop="true"
		    android:textSize="@dimen/upload_box_text" />

		<TextView
		    android:id="@+id/counter"
		    android:layout_width="wrap_content"
		    android:layout_height="wrap_content"
		    android:layout_alignParentRight="true"
		    android:layout_above="@+id/legend"
		    android:textSize="@dimen/upload_box_counter_text" />

		<TextView
		    android:id="@+id/legend"
		    android:layout_width="wrap_content"
		    android:layout_height="wrap_content"
		    android:layout_alignParentRight="true"
		    android:layout_alignParentBottom="true"
		    android:textSize="@dimen/upload_box_text" />

    </RelativeLayout>

    <ImageButton
        android:id="@+id/uploadBtn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:contentDescription="@string/image_description"
        android:src="@drawable/ic_summary_upload_btn" />

</merge>


text:
@import url(../../timeline/style.css);
@import url(layout.css);
@import url(theme-gray.css);

/* hide inactive sublists */
.smil-toc li ul {
  display: none;
}
.smil-toc li.current ul {
  display: block;
}

/* put the video+ToC on the left */
#swap {
  left: 330px;
  background-image: url(swap-reverse.png);
}
div#images {
  left: 360px;
}
div.smil-toc {
  right: auto;
  left: 0;
}
video {
  left: 25px;
}


text:
BSLS_IDENT_RCSID(s_baltst_basicrecord_cpp,"$Id$ $CSID$")

#include <s_baltst_basicrecord.h>

#include <bdlat_formattingmode.h>
#include <bdlat_valuetypefunctions.h>
#include <bdlb_print.h>
#include <bdlb_printmethods.h>
#include <bdlb_string.h>

#include <bdlt_datetimetz.h>
#include <bsl_string.h>
#include <s_baltst_address.h>
#include <bslim_printer.h>
#include <bsls_assert.h>

#include <bsl_iomanip.h>
#include <bsl_limits.h>
#include <bsl_ostream.h>

namespace BloombergLP {
namespace s_baltst {

                             // -----------------
                             // class BasicRecord
                             // -----------------

// CONSTANTS

const char BasicRecord::CLASS_NAME[] = "BasicRecord";

const bdlat_AttributeInfo BasicRecord::ATTRIBUTE_INFO_ARRAY[] = {
    {
        ATTRIBUTE_ID_I1,
        "i1",
        sizeof("i1") - 1,
        "",
        bdlat_FormattingMode::e_DEC
    },
    {
        ATTRIBUTE_ID_I2,
        "i2",
        sizeof("i2") - 1,
        "",
        bdlat_FormattingMode::e_DEC
    },
    {
        ATTRIBUTE_ID_DT,
        "dt",
        sizeof("dt") - 1,
        "",
        bdlat_FormattingMode::e_DEFAULT
    },
    {
        ATTRIBUTE_ID_S,
        "s",
        sizeof("s") - 1,
        "",
        bdlat_FormattingMode::e_TEXT
    }
};

// CLASS METHODS

const bdlat_AttributeInfo *BasicRecord::lookupAttributeInfo(
        const char *name,
        int         nameLength)
{
    for (int i = 0; i < 4; ++i) {
        const bdlat_AttributeInfo& attributeInfo =
                    BasicRecord::ATTRIBUTE_INFO_ARRAY[i];

        if (nameLength == attributeInfo.d_nameLength
        &&  0 == bsl::memcmp(attributeInfo.d_name_p, name, nameLength))
        {
            return &attributeInfo;
        }
    }

    return 0;
}

const bdlat_AttributeInfo *BasicRecord::lookupAttributeInfo(int id)
{
    switch (id) {
      case ATTRIBUTE_ID_I1:
        return &ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_I1];
      case ATTRIBUTE_ID_I2:
        return &ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_I2];
      case ATTRIBUTE_ID_DT:
        return &ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_DT];
      case ATTRIBUTE_ID_S:
        return &ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_S];
      default:
        return 0;
    }
}

// CREATORS

BasicRecord::BasicRecord(bslma::Allocator *basicAllocator)
: d_s(basicAllocator)
, d_dt()
, d_i1()
, d_i2()
{
}

BasicRecord::BasicRecord(const BasicRecord& original,
                         bslma::Allocator *basicAllocator)
: d_s(original.d_s, basicAllocator)
, d_dt(original.d_dt)
, d_i1(original.d_i1)
, d_i2(original.d_i2)
{
}

#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
BasicRecord::BasicRecord(BasicRecord&& original) noexcept
: d_s(bsl::move(original.d_s))
, d_dt(bsl::move(original.d_dt))
, d_i1(bsl::move(original.d_i1))
, d_i2(bsl::move(original.d_i2))
{
}

BasicRecord::BasicRecord(BasicRecord&& original,
                         bslma::Allocator *basicAllocator)
: d_s(bsl::move(original.d_s), basicAllocator)
, d_dt(bsl::move(original.d_dt))
, d_i1(bsl::move(original.d_i1))
, d_i2(bsl::move(original.d_i2))
{
}
#endif

BasicRecord::~BasicRecord()
{
}

// MANIPULATORS

BasicRecord&
BasicRecord::operator=(const BasicRecord& rhs)
{
    if (this != &rhs) {
        d_i1 = rhs.d_i1;
        d_i2 = rhs.d_i2;
        d_dt = rhs.d_dt;
        d_s = rhs.d_s;
    }

    return *this;
}

#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
BasicRecord&
BasicRecord::operator=(BasicRecord&& rhs)
{
    if (this != &rhs) {
        d_i1 = bsl::move(rhs.d_i1);
        d_i2 = bsl::move(rhs.d_i2);
        d_dt = bsl::move(rhs.d_dt);
        d_s = bsl::move(rhs.d_s);
    }

    return *this;
}
#endif

void BasicRecord::reset()
{
    bdlat_ValueTypeFunctions::reset(&d_i1);
    bdlat_ValueTypeFunctions::reset(&d_i2);
    bdlat_ValueTypeFunctions::reset(&d_dt);
    bdlat_ValueTypeFunctions::reset(&d_s);
}

// ACCESSORS

bsl::ostream& BasicRecord::print(
        bsl::ostream& stream,
        int           level,
        int           spacesPerLevel) const
{
    bslim::Printer printer(&stream, level, spacesPerLevel);
    printer.start();
    printer.printAttribute("i1", d_i1);
    printer.printAttribute("i2", d_i2);
    printer.printAttribute("dt", d_dt);
    printer.printAttribute("s", d_s);
    printer.end();
    return stream;
}

}  // close package namespace
}  // close enterprise namespace

// GENERATED BY BLP_BAS_CODEGEN_2020.03.30
// USING bas_codegen.pl s_baltst.xsd -m msg -p s_baltst -C tmp_singles --msgSplit 1 --noExternalization --noHashSupport --noAggregateConversion
// ----------------------------------------------------------------------------
// NOTICE:
//      Copyright 2020 Bloomberg Finance L.P. All rights reserved.
//      Property of Bloomberg Finance L.P. (BFLP)
//      This software is made available solely pursuant to the
//      terms of a BFLP license agreement which governs its use.
// ------------------------------- END-OF-FILE --------------------------------


text:
            Home
            About

        <router-outlet></router-outlet>


text:
// TypeScript Version: 2.0

// EXPORTS //

/**
* Returns a Number object.
*
* ## Notes
*
* -   This constructor should be used sparingly. Always prefer number primitives.
*/
export = Number;


text:
//@@author A0142255M
package seedu.tache.commons.events.ui;

import seedu.tache.commons.events.BaseEvent;

/**
 * Indicates that the task list type is changed.
 */
public class TaskListTypeChangedEvent extends BaseEvent {

    public final String newTaskListType;

    public TaskListTypeChangedEvent(String newTaskListType) {
        this.newTaskListType = newTaskListType;
    }

    public String getTaskListType() {
        return newTaskListType;
    }

    @Override
    public String toString() {
        return this.getClass().getSimpleName();
    }

}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <meta name="author" content="Eyo O. E., GDG Akure">
    <meta name="description" content="Sharing Technology. For Designers, Developers and Serious Tech Enthusiasts.">
    <meta name="keywords" content="event, gdg, devfest, google, programming, android, chrome, developers, akure">
    <meta name="google-site-verification" content="" />
    <link rel="canonical" href="http://akure.gdg.ng">

    <meta name="twitter:card" content="summary">
    <meta name="twitter:site" content="@GDGAkure">
    <meta name="twitter:title" content="Polymer 101: An Introduction to Material Design">
    <meta name="twitter:description" content="Sharing Technology. For Designers, Developers and Serious Tech Enthusiasts.">
    <meta name="twitter:image:src" content="http://akure.gdg.ng/img/seo/sharing-twitter.png">

    <meta property="og:title" content="Polymer 101: An Introduction to Material Design" />
    <meta property="og:site_name" content="GDG Akure" />
    <meta property="og:type" content="website" />
    <meta property="og:url" content="http://akure.gdg.ng" />
    <meta property="og:image" content="http://akure.gdg.ng/img/seo/sharing-facebook.png" />
    <meta property="og:description" content="Sharing Technology. For Designers, Developers and Serious Tech Enthusiasts." />

    <title>Polymer 101: An Introduction to Material Design • GDG Akure</title>
    <link rel="shortcut icon" href="/img/favicons/favicon.ico">
    <link rel="apple-touch-icon" sizes="152x152" href="/img/favicons/apple-touch-icon-152x152.png">
    <link rel="apple-touch-icon" sizes="144x144" href="/img/favicons/apple-touch-icon-144x144.png">
    <link rel="apple-touch-icon" sizes="120x120" href="/img/favicons/apple-touch-icon-120x120.png">
    <link rel="apple-touch-icon" sizes="114x114" href="/img/favicons/apple-touch-icon-114x114.png">
    <link rel="apple-touch-icon" sizes="76x76" href="/img/favicons/apple-touch-icon-76x76.png">
    <link rel="apple-touch-icon" sizes="72x72" href="/img/favicons/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="60x60" href="/img/favicons/apple-touch-icon-60x60.png">
    <link rel="apple-touch-icon" sizes="57x57" href="/img/favicons/apple-touch-icon-57x57.png">
    <link rel="icon" type="image/png" href="/img/favicons/favicon-196x196.png">
    <link rel="icon" type="image/png" href="/img/favicons/favicon-160x160.png">
    <link rel="icon" type="image/png" href="/img/favicons/favicon-96x96.png">
    <link rel="icon" type="image/png" href="/img/favicons/favicon-32x32.png">
    <link rel="icon" type="image/png" href="/img/favicons/favicon-16x16.png">
    <meta name="msapplication-TileColor" content="#2b5797">
    <meta name="msapplication-TileImage" content="/img/favicons/mstile-144x144.png">
    <meta name="msapplication-config" content="/img/favicons/browserconfig.xml">

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

    <svg id="menu-trigger" class="menu-trigger icon icon-menu visible-xs" viewBox="0 0 32 32" data-effect="st-effect">
        <use xlink:href="/img/sprites/sprites.svg#icon-menu"></use>
    </svg>

                Home

                Blog

                Events

                I/O Extended 2015

                Community

                Meet Akure

                Become a Member

            Register for I/O Extended 2015

Polymer 101: An Introduction to Material Design

 For everybody that watched the Google I/O keynote you'd know about the new material design that google is implementing in the web, and trying to change the way we have web experiences, if maybe you didnt have the opportunity to watch the Google I/O key note maybe you should just head over to Google Design and have a feel of how it actually is... this development was actually rolled out to be the main big thing for the upcoming android L but then Google decided to extend it to the web so the released a library called POLYMER check it out the website at The Polymer website kinda of like jQuery, Bootstrap to help with incorporating it in our webpages... it should be noted that apparently the design ability has being extended to Angular.JS too for yall that already have an hang of Angular.

So leaving all the great news behind this is a kind of tutorial on setting up the polymer designer tool locally on your system, since for some of us maybe the steps on the polymer website is kind of overwhelming i know it was for me. if you've headed over to the polymer website to get a feel of it you'd notice that there is a designer tool on the website to help generate the polymer code for us... maybe you dont have the intermittent internet connection to do fiddle around with it this is the guide to help you set it up locally so you can have all the time in the whole world to fiddle and learn.

So items we'll need or you probably have to download first:

        you have to install a git client (http://git-scm.com/downloads) you'll need it cause you would be fetching files from github add git into your environment variables if you try typing "git" on your cmd prompt and you get path is not defined, add PATH ="C:\Program Files (x86)\Git\bin;"

        Node.Js, head over to http://nodejs.org/download it just a 5mb installer or so also youll need to add node to your environment variables PATH= "C:\Users\yourusername\AppData\Roaming\npm;"

       Next you need Bower on nodeJs after installing it open the command line and run npm bower install, bower helps you pull other components the developer used that the project requires to work

       polymer would not run without an HTTP server running, so inside your nodeJS run npm install serve it will help you install a mini  http server that can handle polymer all you have to do is cd into your project and run "serve" on your command line and it automatically serves your directory on "http://localhost:3000"

        then head over to the github polmer designer page either clone the project or download the zip folder to your PC

follow the steps in the README file

         cd into your project directory, run bower install, if youve done everything correctly you will see npm download quite some files. when it completes start up your serve with "serve" and load "http://localhost:3000" viola there you have it the designer locally.

 Now to gain an understanding of Polymer a little Hello World example:

&nbsp

 1 <head>
 2     <title>Test</title>
 3         <meta charset="utf-8">
 4         <meta http-equiv="X-UA-Compatible" content="IE-edge,chrome=1">
 5         <meta name="viewport" content="width=device-width, initial-scale=1.0">
 6
 7 <!-- you can get the polymer.js and platform.js by running bower install polymer on node.js -->
 8         <script src="bower_components/platform/platform.js"></script>
 9 <!-- one of the new concept rolled off polymer is the ability to import into an html just like the @import in css -->
10         <link rel="import" href="bower_components/polymer/polymer.html">
11
12     </head>
13     <body>
14     <!-- we start my creating a polymer element thats named, attr noscript is added to let the browser no not to expect any script -->
15
16         <polymer-element name="test" noscript>
17      <!-- we then create a template to encase our content, this is all based on the shadow DOM concept, even I am just trying to grasp the whole idea -->
18             <template>
19               <style>
20                 h1 {
21                 color: #ccf;
22                     }
23               </style>
24                 <h1>Hello Eyo!</h1>
25             </template>
26         </polymer-element>
27 <!-- now to call what we wrote inside our polymer element template, we simply just use the name of our polymer element as a tag -->
28 <!--- and it displays the info in the named element, so it should be noted that the styles applied inside the elemnt are encapusalted to test only  -->
29         <test></test>
30 <!-- any other normal html tag placed anywhere inside the html document is exposed to the global style, for instance-->
31         <h1>I am default</h1>
32
33     </body>

P.S. You need to have an HTTP server for any of this run, else it'd seem like your getting it wrong

                                « GDG AKure in...

                                #GCDC Akure »

Links

Akure.GDG.ng

Google Developers

Contacts

tomiwaijaware@gmail.com

FAQ

Code of Conduct

						<svg class="icon icon-google-plus" viewBox="0 0 30 32">
							<use xlink:href="/img/sprites/sprites.svg#icon-google-plus"></use>
						</svg>

						<svg class="icon icon-twitter" viewBox="0 0 30 32">
							<use xlink:href="/img/sprites/sprites.svg#icon-twitter"></use>
						</svg>

						<svg class="icon icon-facebook" viewBox="0 0 30 32">
							<use xlink:href="/img/sprites/sprites.svg#icon-facebook"></use>
						</svg>

						<svg class="icon icon-rss" viewBox="0 0 30 32">
							<use xlink:href="/img/sprites/sprites.svg#icon-rss"></use>
						</svg>

				© 2014 Based on Project Zeppelin. Designed and created by Oleh Zasadnyy · GDG Lviv


text:
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/pm.h>
#include <linux/suspend.h>

extern void (*cpu_wait)(void);

static int goldfish_pm_enter(suspend_state_t state)
{
	if (cpu_wait)
		(*cpu_wait)();
	return 0;
}

static struct platform_suspend_ops goldfish_pm_ops = {
	.enter		= goldfish_pm_enter,
	.valid		= suspend_valid_only_mem,
};

static int __init goldfish_pm_init(void)
{
	suspend_set_ops(&goldfish_pm_ops);
	return 0;
}

device_initcall(goldfish_pm_init);


text:
<?xml version="1.0" encoding="UTF-8"?>

<recipeml version="0.5">
  <recipe>
    <head>
      <title>Baking Powder Biscuits</title>
      <categories>
        <cat>Biscuits</cat></categories>
      <yield>4</yield></head>
    <ingredients>
      <ing>
        <amt>
          <qty>1</qty>
          <unit/></amt>
        <item>Bag; (5 lb.) self-rising flour</item></ing>
      <ing>
        <amt>
          <qty>3/4</qty>
          <unit>cups</unit></amt>
        <item>Sugar</item></ing>
      <ing>
        <amt>
          <qty>2</qty>
          <unit>packages</unit></amt>
        <item>(1 qt.) dried milk</item></ing>
      <ing>
        <amt>
          <qty>1 1/2</qty>
          <unit>pounds</unit></amt>
        <item>Lard</item></ing>
      <ing>
        <amt>
          <qty>6</qty>
          <unit>cups</unit></amt>
        <item>Water</item></ing></ingredients>
    <directions>
      <step>  Mix the first three ingredients well using a large shredder. Shred the
  shortening into the dry mix. Use a pastry blender and cut shortening into
  fine particles*. Add 6 cups water and stir - turn out on floured board (use
  part of dry mix as flour). Knead several times. Roll out 1/2-3/4 inch
  thickness. Cut out and place on ungreased cookie pan. Bake at 450 degrees
  for 15 minutes or until nicely browned - makes 5 dozen.

  This mixture can be made up and stored in large container. Measure out
  amount needed for biscuits, dumplings, etc., and add liquid as needed. The
  more moisture you can use the lighter your biscuits.

  Recipe by: Key Gourmet

  Posted to recipelu-digest by James and Susan Kirkland <kirkland@gj.net> on
  Feb 16, 1998

</step></directions></recipe></recipeml>