text:
package org.apache.hadoop.hbase.client;

import static org.junit.Assert.assertEquals;

import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Supplier;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessor;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.regionserver.HRegion;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread;
import org.junit.AfterClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;

public abstract class AbstractTestAsyncTableRegionReplicasRead {

  protected static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();

  protected static TableName TABLE_NAME = TableName.valueOf("async");

  protected static byte[] FAMILY = Bytes.toBytes("cf");

  protected static byte[] QUALIFIER = Bytes.toBytes("cq");

  protected static byte[] ROW = Bytes.toBytes("row");

  protected static byte[] VALUE = Bytes.toBytes("value");

  protected static int REPLICA_COUNT = 3;

  protected static AsyncConnection ASYNC_CONN;

  @Rule
  public TestName testName = new TestName();

  @Parameter
  public Supplier<AsyncTable<?>> getTable;

  private static AsyncTable<?> getRawTable() {
    return ASYNC_CONN.getTable(TABLE_NAME);
  }

  private static AsyncTable<?> getTable() {
    return ASYNC_CONN.getTable(TABLE_NAME, ForkJoinPool.commonPool());
  }

  @Parameters
  public static List<Object[]> params() {
    return Arrays.asList(
      new Supplier<?>[] { AbstractTestAsyncTableRegionReplicasRead::getRawTable },
      new Supplier<?>[] { AbstractTestAsyncTableRegionReplicasRead::getTable });
  }

  protected static volatile boolean FAIL_PRIMARY_GET = false;

  protected static ConcurrentMap<Integer, AtomicInteger> REPLICA_ID_TO_COUNT =
    new ConcurrentHashMap<>();

  public static final class FailPrimaryGetCP implements RegionObserver, RegionCoprocessor {

    @Override
    public Optional<RegionObserver> getRegionObserver() {
      return Optional.of(this);
    }

    private void recordAndTryFail(ObserverContext<RegionCoprocessorEnvironment> c)
        throws IOException {
      RegionInfo region = c.getEnvironment().getRegionInfo();
      if (!region.getTable().equals(TABLE_NAME)) {
        return;
      }
      REPLICA_ID_TO_COUNT.computeIfAbsent(region.getReplicaId(), k -> new AtomicInteger())
        .incrementAndGet();
      if (region.getReplicaId() == RegionReplicaUtil.DEFAULT_REPLICA_ID && FAIL_PRIMARY_GET) {
        throw new IOException("Inject error");
      }
    }

    @Override
    public void preGetOp(ObserverContext<RegionCoprocessorEnvironment> c, Get get,
        List<Cell> result) throws IOException {
      recordAndTryFail(c);
    }

    @Override
    public void preScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Scan scan)
        throws IOException {
      recordAndTryFail(c);
    }
  }

  private static boolean allReplicasHaveRow(byte[] row) throws IOException {
    for (RegionServerThread t : TEST_UTIL.getMiniHBaseCluster().getRegionServerThreads()) {
      for (HRegion region : t.getRegionServer().getRegions(TABLE_NAME)) {
        if (region.get(new Get(row), false).isEmpty()) {
          return false;
        }
      }
    }
    return true;
  }

  protected static void startClusterAndCreateTable() throws Exception {
    TEST_UTIL.startMiniCluster(3);
    TEST_UTIL.getAdmin().createTable(TableDescriptorBuilder.newBuilder(TABLE_NAME)
      .setColumnFamily(ColumnFamilyDescriptorBuilder.of(FAMILY)).setRegionReplication(REPLICA_COUNT)
      .setCoprocessor(FailPrimaryGetCP.class.getName()).build());
    TEST_UTIL.waitUntilAllRegionsAssigned(TABLE_NAME);
    ASYNC_CONN = ConnectionFactory.createAsyncConnection(TEST_UTIL.getConfiguration()).get();
  }

  protected static void waitUntilAllReplicasHaveRow(byte[] row) throws IOException {
    // this is the fastest way to let all replicas have the row
    TEST_UTIL.getAdmin().disableTable(TABLE_NAME);
    TEST_UTIL.getAdmin().enableTable(TABLE_NAME);
    TEST_UTIL.waitFor(30000, () -> allReplicasHaveRow(row));
  }

  @AfterClass
  public static void tearDownAfterClass() throws Exception {
    IOUtils.closeQuietly(ASYNC_CONN);
    TEST_UTIL.shutdownMiniCluster();
  }

  protected static int getSecondaryGetCount() {
    return REPLICA_ID_TO_COUNT.entrySet().stream()
      .filter(e -> e.getKey().intValue() != RegionReplicaUtil.DEFAULT_REPLICA_ID)
      .mapToInt(e -> e.getValue().get()).sum();
  }

  protected static int getPrimaryGetCount() {
    AtomicInteger primaryGetCount = REPLICA_ID_TO_COUNT.get(RegionReplicaUtil.DEFAULT_REPLICA_ID);
    return primaryGetCount != null ? primaryGetCount.get() : 0;
  }

  // replicaId = -1 means do not set replica
  protected abstract void readAndCheck(AsyncTable<?> table, int replicaId) throws Exception;

  @Test
  public void testNoReplicaRead() throws Exception {
    FAIL_PRIMARY_GET = false;
    REPLICA_ID_TO_COUNT.clear();
    AsyncTable<?> table = getTable.get();
    readAndCheck(table, -1);
    // the primary region is fine and the primary timeout is 1 second which is long enough, so we
    // should not send any requests to secondary replicas even if the consistency is timeline.
    Thread.sleep(5000);
    assertEquals(0, getSecondaryGetCount());
  }

  @Test
  public void testReplicaRead() throws Exception {
    // fail the primary get request
    FAIL_PRIMARY_GET = true;
    REPLICA_ID_TO_COUNT.clear();
    // make sure that we could still get the value from secondary replicas
    AsyncTable<?> table = getTable.get();
    readAndCheck(table, -1);
    // make sure that the primary request has been canceled
    Thread.sleep(5000);
    int count = getPrimaryGetCount();
    Thread.sleep(10000);
    assertEquals(count, getPrimaryGetCount());
  }

  @Test
  public void testReadSpecificReplica() throws Exception {
    FAIL_PRIMARY_GET = false;
    REPLICA_ID_TO_COUNT.clear();
    AsyncTable<?> table = getTable.get();
    for (int replicaId = 0; replicaId < REPLICA_COUNT; replicaId++) {
      readAndCheck(table, replicaId);
      assertEquals(1, REPLICA_ID_TO_COUNT.get(replicaId).get());
    }
  }
}


text:
namespace XDay
{
ModuleHandle::ModuleHandle(cpcstr module) : name(module), handle(nullptr)
{
    Log::Info("Loading module: {}", name);

#ifdef WINDOWS
    handle = static_cast<void*>(LoadLibraryA(name));
#else
    handle = dlopen(name, RTLD_LAZY);
#endif

    if (handle == nullptr)
    {
        Log::Error("Failed to load module: {}", name);
#ifdef LINUX
        Log::Error(dlerror());
#endif
    }
}

ModuleHandle::~ModuleHandle()
{
    bool closed = false;
#ifdef WINDOWS
    closed = FreeLibrary(static_cast<HMODULE>(handle)) != 0;
#else
    closed = dlclose(handle) == 0;
#endif

    if (closed == false)
    {
        Log::Error("Failed to close module: {}", name);
#ifdef WINDOWS
        Log::Error(std::to_string(GetLastError()));
#elif LINUX
        Log::Error(dlerror());
#endif
    }
}

void* ModuleHandle::GetProcAddress(cpcstr procedure) const
{
    void* proc = nullptr;

#ifdef WINDOWS
    proc = ::GetProcAddress(static_cast<HMODULE>(handle), procedure);
#else
    proc = dlsym(handle, procedure)
#endif

    if (proc == nullptr)
    {
        Log::Error("Failed to load procedure [{}] from module: {}", procedure, name);
#ifdef WINDOWS
        Log::Error(std::to_string(GetLastError()));
#elif LINUX
        Log::Error(dlerror());
#endif
    }

    return proc;
}
} // namespace XDay

redpajama_set_name: RedPajamaGithub


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

public enum ControlType
{
    // Move the player directionally in the world XZ plane.
    World = 1,
    // Tank controls, turn left/right, go forward back.
    Player = 2,
    // Move the player directionally relative to the camera along the XZ plane.
    Camera = 3,
    // Move the player directionally relative to the camera, but match player
    // yaw to camera yaw.
    Flight = 4,
    // Fly but constantly move forward. Only camera control works.
    AutoFlight = 5,
}

public class ThirdPersonEntity : Falken.EntityBase
{
    public void UpdateFrom(GameObject gameObject)
    {
        position = gameObject.transform.position;
        rotation = gameObject.transform.rotation;
    }
}

public class ThirdPersonObservations : Falken.ObservationsBase
{
    public ThirdPersonEntity camera;
    public ThirdPersonEntity goal;
    public ThirdPersonObservations()
    {
        camera = new ThirdPersonEntity();
        player = new ThirdPersonEntity();
        goal = new ThirdPersonEntity();
    }

    public void UpdateFrom(GameObject player, GameObject camera, GameObject goal)
    {
        ((ThirdPersonEntity)this.player).UpdateFrom(player);
        this.camera.UpdateFrom(camera);
        this.goal.UpdateFrom(goal);
    }
}

public class ThirdPersonActions : Falken.ActionsBase
{
    public Falken.Joystick joy_axis1;
    public Falken.Joystick joy_axis2;

    public ThirdPersonActions(ControlType controlType)
    {
        switch (controlType)
        {
            case ControlType.Camera:
            case ControlType.Flight:
            case ControlType.AutoFlight:
                joy_axis1 = new Falken.Joystick(
                    "joy_axis1", Falken.AxesMode.DirectionXZ,
                    Falken.ControlledEntity.Player, Falken.ControlFrame.Camera);
                break;

            case ControlType.Player:
                joy_axis1 = new Falken.Joystick(
                    "joy_axis1", Falken.AxesMode.DeltaPitchYaw,
                    Falken.ControlledEntity.Player, Falken.ControlFrame.World);
                break;
            case ControlType.World:
                joy_axis1 = new Falken.Joystick(
                    "joy_axis1", Falken.AxesMode.DirectionXZ,
                    Falken.ControlledEntity.Player, Falken.ControlFrame.World);
                break;
            default:
                Debug.Log("Unsupported action type");
                break;
        }
        joy_axis2 = new Falken.Joystick(
             "joy_axis2", Falken.AxesMode.DeltaPitchYaw,
              Falken.ControlledEntity.Camera, Falken.ControlFrame.World);
    }
}

public class ThirdPersonBrainSpec : Falken.BrainSpecBase
{
    public ThirdPersonBrainSpec() :
        base(new ThirdPersonActions(ControlType.Player), new ThirdPersonObservations()) {}

    public ThirdPersonBrainSpec(ControlType controlType) :
        base(new ThirdPersonActions(controlType), new ThirdPersonObservations()) {}

    public ThirdPersonActions Actions
    {
        get
        {
            return (ThirdPersonActions)ActionsBase;
        }
    }

    public ThirdPersonObservations Observations
    {
        get
        {
            return (ThirdPersonObservations)ObservationsBase;
        }
    }
}

public class CameraRelativeBrainSpec : ThirdPersonBrainSpec
{
    public CameraRelativeBrainSpec() : base(ControlType.Camera) {}
}

public class PlayerRelativeBrainSpec : ThirdPersonBrainSpec
{
    public PlayerRelativeBrainSpec() : base(ControlType.Player) {}
}

public class WorldRelativeBrainSpec : ThirdPersonBrainSpec
{
    public WorldRelativeBrainSpec() : base(ControlType.World) {}
}

public class FlightBrainSpec : ThirdPersonBrainSpec
{
    public FlightBrainSpec() : base(ControlType.Flight) {}
}

/// <summary>
/// <c>ThirdPersonPlayer</c> Provides 3P input handling, player physics, and camera control.
/// </summary>
public class ThirdPersonPlayer : MonoBehaviour
{
    [Tooltip("The camera object to control.")]
    public Camera thirdPersonCamera;
    [Tooltip("Determines the control scheme used by this player.")]
    public ControlType controlType;

    [Tooltip("Speed at which the player moves.")]
    public float playerForwardSpeed = 0.05f;
    [Tooltip("Speed at which the player rotates.")]
    public float playerRotateSpeed = 2f;
    [Tooltip("Speed at which the camera orbits.")]
    public float cameraYawPitchSpeed = 0.5f;
    [Tooltip("Offset from player object that the camera looks at.")]
    public Vector3 cameraLookOffset = Vector3.zero;
    [Tooltip("Whether the camera is locked to have no roll.")]
    public bool lockedCamera = true;

    private bool _humanControlled;
    private GameObject _goal;
    private float _cameraDistanceFromTarget;
    private Vector2 _cameraYawPitch = new Vector2(0, 0);

    private const float angleEpsilon = 1e-2f;
    private readonly Vector2 _yAxis = new Vector2(0, 1);

    private const float magnitudeEpsilon = 1e-3f;

    private Falken.Episode _episode;
    private ThirdPersonActions _actions;
    private ThirdPersonObservations _observations;

    /// <summary>
    /// Sets the current goal for this player.
    /// </summary>
    public GameObject Goal { set { _goal = value; } }

    /// <summary>
    /// Sets the active Falken actions and observations for this player to populate.
    /// </summary>
    public void SetActionsAndObservations(
        ThirdPersonActions actions, ThirdPersonObservations observations)
    {
        _actions = actions;
        _observations = observations;
    }

    /// <summary>
    /// Sets the active Falken episode.
    /// </summary>
    public Falken.Episode FalkenEpisode { set { _episode = value; } }

    /// <summary>
    /// Sets this player to be human or Falken controlled.
    /// </summary>
    public Boolean HumanControlled { set { _humanControlled = value; } }

    /// <summary>
    /// Resets the player's camera and related controls.
    /// </summary>
    public void Reset()
    {
        _cameraYawPitch.x = 0;
        if (controlType == ControlType.Flight || controlType == ControlType.AutoFlight)
        {
            _cameraYawPitch.y = 0;
        }
        else
        {
            _cameraYawPitch.y = 45;
        }

        PositionCamera();
    }

    #region Update player and camera based on input
    float GetDegreesRotation(Vector2 dir)
    {
        return Vector2.SignedAngle(dir, _yAxis);
    }

    void UpdateTargetWorldRelative(Vector2 dir)
    {
        if (dir.magnitude <= magnitudeEpsilon)
        {
            return;
        }
        float yawInDegrees = GetDegreesRotation(dir);
        transform.rotation = Quaternion.Euler(new Vector3(0, yawInDegrees, 0));
        transform.position += transform.forward * playerForwardSpeed * dir.magnitude;
    }

    void UpdateTargetPlayerRelative(Vector2 dir)
    {
        if (dir.magnitude <= magnitudeEpsilon)
        {
            return;
        }
        transform.rotation *= Quaternion.Euler(0, playerRotateSpeed * dir.x, 0);
        transform.position += transform.forward * playerForwardSpeed * dir.y;
    }

    void UpdateTargetCameraRelativeFlight(Vector2 dir)
    {
        if (dir.magnitude <= magnitudeEpsilon)
        {
            return;
        }
        Vector3 dir3d = new Vector3(dir.x, 0, dir.y);
        Vector3 target = thirdPersonCamera.transform.TransformDirection(dir3d);
        RotateTowardsTargetDir(target, thirdPersonCamera.transform.up);
        transform.position += transform.forward * playerForwardSpeed * dir.magnitude;
    }

    void UpdateTargetCameraRelativeAutoFlight()
    {
        RotateTowardsTargetDir(thirdPersonCamera.transform.forward, thirdPersonCamera.transform.up);
        transform.position += transform.forward * playerForwardSpeed;
    }

    void UpdateTargetCameraRelative(Vector2 dir)
    {
        // Note that the pitch of the camera is being ignored.

        // Draw debug planes.
        const float rayLength = 20f;
        for (int i = -20; i < 20; i++)
        {
            // Hint at camera YZ plane.
            Debug.DrawRay(
                thirdPersonCamera.transform.position +
                i * 0.1f * thirdPersonCamera.transform.up -
                thirdPersonCamera.transform.forward * rayLength / 2,
                thirdPersonCamera.transform.forward * rayLength,
                Color.white);

            // Hint at player XZ plane.
            Debug.DrawRay(
                transform.position + new Vector3(0, 0.1f, 0) +
                i * 0.1f * transform.right -
                transform.forward * rayLength / 2,
                transform.forward * rayLength,
                Color.green);
        }

        Vector3 cameraYZIntersectPlayerXZ = Vector3.Cross(
            thirdPersonCamera.transform.right,
            transform.up).normalized;

        float cameraRelativeHeading = GetDegreesRotation(dir);

        Vector3 target =
            Quaternion.AngleAxis(cameraRelativeHeading, transform.up) *
            cameraYZIntersectPlayerXZ;

        Vector3 cameraTarget =
            Quaternion.AngleAxis(
                -cameraRelativeHeading,
                thirdPersonCamera.transform.forward) *
            thirdPersonCamera.transform.up;

        Debug.DrawRay(
            transform.position, target * rayLength,
            Color.red);

        Debug.DrawRay(
            thirdPersonCamera.transform.position, cameraTarget * rayLength,
            Color.red);

        if (dir.magnitude == 0)
            return;

        RotateTowardsTargetDir(target, transform.up);
        transform.position += transform.forward * playerForwardSpeed * dir.magnitude;
    }

    void RotateTowardsTargetDir(Vector3 target, Vector3 up)
    {
        Quaternion lookAt = Quaternion.LookRotation(target, up);
        float angleToTarget = Quaternion.Angle(lookAt, transform.rotation);
        float amountToTurn = playerRotateSpeed / angleToTarget;
        transform.rotation = Quaternion.Lerp(transform.rotation, lookAt, amountToTurn);
    }

    void UpdateTarget(Vector2 moveInput)
    {
        switch (controlType)
        {
            case ControlType.World:
                UpdateTargetWorldRelative(moveInput);
                break;
            case ControlType.Player:
                UpdateTargetPlayerRelative(moveInput);
                break;
            case ControlType.Camera:
                UpdateTargetCameraRelative(moveInput);
                break;
            case ControlType.Flight:
                UpdateTargetCameraRelativeFlight(moveInput);
                break;
            case ControlType.AutoFlight:
                UpdateTargetCameraRelativeAutoFlight();
                break;
            default:
                throw new UnityException("Illegal value.");
        }
    }

    // Update the camera location.
    void UpdateCamera(Vector2 yawPitchInput)
    {
        Vector2 delta = yawPitchInput * cameraYawPitchSpeed;
        _cameraYawPitch += delta;

        _cameraYawPitch.x %= 360;
        if (lockedCamera)
        {
            // Clamp pitch to a half-space.
            _cameraYawPitch.y = Mathf.Clamp(
                _cameraYawPitch.y,
                -90f + angleEpsilon, 90f - angleEpsilon);
        }
        PositionCamera();
    }

    // Position the camerate to a given yaw and pitch around the target.
    void PositionCamera()
    {
        Vector3 playerToCamera = Vector3.back;
        playerToCamera = Quaternion.Euler(_cameraYawPitch.y, _cameraYawPitch.x, 0) * playerToCamera;

        Vector3 offset = playerToCamera * _cameraDistanceFromTarget;

        thirdPersonCamera.transform.position = transform.position + offset;

        if (lockedCamera)
        {
            thirdPersonCamera.transform.LookAt(
                transform.position + transform.rotation * cameraLookOffset);
        }
        else
        {
            thirdPersonCamera.transform.LookAt(transform, thirdPersonCamera.transform.up);
        }
    }
    #endregion

    #region Unity functions
    void OnEnable() {
        _cameraDistanceFromTarget = Vector3.Distance(
            thirdPersonCamera.transform.position,
            transform.position);
    }

    // Update is called once per frame
    void FixedUpdate()
    {
        Vector2 moveInput = Vector2.ClampMagnitude(
            new Vector2(Input.GetAxis("MoveX"), Input.GetAxis("MoveY")), 1f);
        Vector2 lookInput = Vector2.ClampMagnitude(
            new Vector2(Input.GetAxis("LookX"), Input.GetAxis("LookY")), 1f);

        if (_episode != null && !_episode.Completed)
        {
            _observations.UpdateFrom(gameObject, thirdPersonCamera.gameObject, _goal);

            if (_humanControlled)
            {
                _actions.joy_axis1.X = moveInput.x;
                _actions.joy_axis1.Y = moveInput.y;
                _actions.joy_axis2.X = lookInput.x;
                _actions.joy_axis2.Y = lookInput.y;
                _actions.ActionsSource = Falken.ActionsBase.Source.HumanDemonstration;
            }
            else
            {
                _actions.joy_axis1.X = 0f;
                _actions.joy_axis1.Y = 0f;
                _actions.joy_axis2.X = 0f;
                _actions.joy_axis2.Y = 0f;
                _actions.ActionsSource = Falken.ActionsBase.Source.BrainAction;
            }

            _episode.Step();

            if (!_humanControlled)
            {
                moveInput.x = _actions.joy_axis1.X;
                moveInput.y = _actions.joy_axis1.Y;
                lookInput.x = _actions.joy_axis2.X;
                lookInput.y = _actions.joy_axis2.Y;
            }
        }

        UpdateTarget(moveInput);
        UpdateCamera(lookInput);
    }

    void OnGUI()
    {
        GUI.Label(new Rect(10, 10, 300, 50), "Control_type: " + controlType.ToString());

        // Intersect camera YZ plane with target movement plane.
        Vector3 cameraInTargetPlane = Vector3.Cross(
            thirdPersonCamera.transform.right,
            transform.up);

        float angle = Vector3.SignedAngle(cameraInTargetPlane, transform.forward, transform.up);

        GUIStyle style = new GUIStyle(GUI.skin.label);
        style.normal.textColor = Color.red;
        style.fontSize = 50;
        style.alignment = TextAnchor.MiddleCenter;
        Rect indicatorRect = new Rect(30, 60, 50, 50);

        GUIUtility.RotateAroundPivot(angle, indicatorRect.center);
        GUI.Label(indicatorRect, "\u2191", style);  // arrow up
    }
    #endregion
}


text:
//
//  MQTabBarController.m
//  MultiplyThinkingNotGainSister
//
//  Created by tanmanqi on 15/9/1.
//  Copyright (c) 2015年 baidu. All rights reserved.
//

#import "MQTabBarController.h"
#import "MQNavigationController.h"
#import "MQTabBar.h"
#import "MQEssenceViewController.h"
#import "MQMeViewController.h"
#import "MQNewViewController.h"
#import "MQFriendTrendsViewController.h"

@interface MQTabBarController ()

@end

@implementation MQTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setUpChildViewController];
    [self setupItem];

}
#pragma mark- 添加一个子控制器
- (void)setOneChildViewController:(UIViewController *)vc title:(NSString *)title image:(UIImage *)image selectedImage:(UIImage *)selectImage{
    //设置图片和文字
    vc.navigationItem.title     = title;
    vc.tabBarItem.title         = title;
    vc.tabBarItem.image         = image;
    vc.tabBarItem.selectedImage = selectImage;
    //包装成导航控制器
    MQNavigationController *nav = [[MQNavigationController alloc] initWithRootViewController:vc];
    [self addChildViewController:nav];

}
#pragma mark- 添加Item所有的控制器
- (void)setUpChildViewController{

    //3.关注

    [self setOneChildViewController:[[MQFriendTrendsViewController alloc]init] title:@"关注" image:[UIImage imageNamed:@"tabBar_friendTrends_icon"] selectedImage:[UIImage imageNamed:@"tabBar_friendTrends_click_icon"]];
    //1.添加第一个控制器
    [self setOneChildViewController:[[MQEssenceViewController alloc] init]title:@"精华" image:[UIImage imageNamed:@"tabBar_essence_icon"] selectedImage:[UIImage imageNamed:@"tabBar_essence_click_icon"]];

    //4.我
    [self setOneChildViewController:[[MQMeViewController alloc]initWithStyle:UITableViewStyleGrouped] title:@"我" image:[UIImage imageNamed:@"tabBar_me_icon"] selectedImage:[UIImage imageNamed:@"tabBar_me_click_icon"]];

    //2.添加第二个控制器
    [self setOneChildViewController:[[MQNewViewController alloc]init] title:@"新帖" image:[UIImage imageNamed:@"tabBar_new_icon"] selectedImage:[UIImage imageNamed:@"tabBar_new_click_icon"]];

    //5.更换TabBar...通过kvc方式更换.
    [self setValue:[[MQTabBar alloc] init] forKeyPath:@"tabBar"];

}

#pragma mark- appearance设置皮肤
/**
 *  设置Item的属性
 *  通过appearance设置皮肤样式,可以设置到全局.
 */

- (void)setupItem{
    NSMutableDictionary *normalAttr = [NSMutableDictionary dictionary];
    normalAttr[NSForegroundColorAttributeName] = [UIColor grayColor];
    normalAttr[NSFontAttributeName] = [UIFont systemFontOfSize:12];
    // UIControlStateSelected状态下的文字属性
    NSMutableDictionary *selectAttr = [NSMutableDictionary dictionary];
    selectAttr[NSForegroundColorAttributeName] = [UIColor darkGrayColor];
    UITabBarItem *item = [UITabBarItem appearance];
    [item setTitleTextAttributes:normalAttr forState:UIControlStateNormal];
    [item setTitleTextAttributes:selectAttr forState:UIControlStateSelected];
}
@end


text:
package nl.knaw.dans.common.lang.repo;

import java.net.URI;

/**
 * A MetadataUnit is a minimal XMLBean capable of describing itself.
 *
 * @author ecco Oct 9, 2009
 */
public interface MetadataUnit extends Unit, TimestampedMinimalXMLBean
{

    String getUnitFormat();

    URI getUnitFormatURI();

}


text:
require 'ansible/ruby/modules/base'

module Ansible
  module Ruby
    module Modules
      # Collects a base set of device facts from a remote device that is running EdgeOS. This module prepends all of the base network fact keys with U(ansible_net_<fact>). The facts module will always collect a base set of facts from the device and can enable or disable collection of additional facts.
      class Edgeos_facts < Base
        # @return [String, nil] When supplied, this argument will restrict the facts collected to a given subset. Possible values for this argument include all, default, config, and neighbors. Can specify a list of values to include a larger subset. Values can also be used with an initial C(M(!)) to specify that a specific subset should not be collected.
        attribute :gather_subset
        validates :gather_subset, type: String
      end
    end
  end
end


text:
<!DOCTYPE html>
<title>CSS aspect-ratio: Test flex container's cross size (block axis) honoring automatic content-based minimum</title>
<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#aspect-ratio-minimum">
<link rel="match" href="../../reference/ref-filled-green-100px-square.xht" />

Test passes if there is a filled green square and no red.


text:
title: "{{ replace .TranslationBaseName "-" " " | title }}"
date: {{ .Date }}
draft: true
# image is relative to /static/images/
image: {{ .TranslationBaseName }}.jpg
type: post
tags:
---


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#000000" >

    <TextView
        android:id="@+id_book_top/title_bar"
        android:layout_width="fill_parent"
        android:layout_height="48dp"
        android:layout_alignParentTop="true"
        android:background="@drawable/title_bar"
        android:gravity="center"
        android:textColor="@color/title_color"
        android:textSize="20dp" />

    <ImageView
        android:id="@+id_book_top/top"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_below="@id_book_top/title_bar"
        android:adjustViewBounds="true"
        android:contentDescription="@string/noimage"
        android:scaleType="fitCenter" />

</RelativeLayout>


text:
`CartJS.removeItem(line_number, options = {})`

Remove the line item with the specified `line_number` from the cart.
Line numbers are one-indexed; that is, the first line item has a `line_number` of `1`.

```js
// Remove the first line item from the cart.
CartJS.removeItem(1);
```

See [addItem](#core-api-add-item) for details on the `options` hash.


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-b10
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2015.06.13 at 03:17:43 PM CST
//

package org.ovirt.engine.api.model;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for TransportTypes complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="TransportTypes">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="transport_type" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "TransportTypes", propOrder = {
    "transportTypes"
})
public class TransportTypes {

    @XmlElement(name = "transport_type")
    protected List<String> transportTypes;

    /**
     * Gets the value of the transportTypes property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the transportTypes property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getTransportTypes().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link String }
     *
     *
     */
    public List<String> getTransportTypes() {
        if (transportTypes == null) {
            transportTypes = new ArrayList<String>();
        }
        return this.transportTypes;
    }

    public boolean isSetTransportTypes() {
        return ((this.transportTypes!= null)&&(!this.transportTypes.isEmpty()));
    }

    public void unsetTransportTypes() {
        this.transportTypes = null;
    }

}


text:
<?php

namespace Oro\Bundle\SecurityBundle\Owner;

/**
 * Provides an interface for owner tree builder
 */
interface OwnerTreeBuilderInterface
{
    /**
     * Adds an user to the tree
     *
     * @param int|string      $userId
     * @param int|string|null $owningBusinessUnitId
     */
    public function addUser($userId, $owningBusinessUnitId = null);

    /**
     * Adds a organization to the given user
     *
     * @param int|string $userId
     * @param int|string $organizationId
     */
    public function addUserOrganization($userId, $organizationId);

    /**
     * Adds a business unit to the given user
     *
     * @param int|string      $userId
     * @param int|string      $organizationId
     * @param int|string|null $businessUnitId
     */
    public function addUserBusinessUnit($userId, $organizationId, $businessUnitId = null);

    /**
     * Adds a business unit to the tree
     *
     * @param int|string      $businessUnitId
     * @param int|string|null $owningOrganizationId
     */
    public function addBusinessUnit($businessUnitId, $owningOrganizationId = null);

    /**
     * Set array of subordinate business units to the given business unit
     *
     * @param int|string|null $parentBusinessUnitId
     * @param array           $businessUnitIds
     */
    public function setSubordinateBusinessUnitIds($parentBusinessUnitId, $businessUnitIds);

    /**
     * Gets the built owner tree
     *
     * @return OwnerTreeInterface
     */
    public function getTree();
}


text:
package com.tvd12.ezyfox.sfs2x.serializer;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import com.smartfoxserver.v2.entities.data.ISFSArray;
import com.smartfoxserver.v2.entities.data.SFSArray;
import com.smartfoxserver.v2.entities.variables.Variable;
import com.tvd12.ezyfox.core.structure.ClassUnwrapper;
import com.tvd12.ezyfox.core.structure.GetterMethodCover;
import com.tvd12.ezyfox.sfs2x.data.impl.SimpleTransformer;

/**
 * Support to serialize a java object to a list of smartfox variables
 *
 * @author tavandung12
 * Created on Jun 1, 2016
 *
 */
public abstract class AgentSerializer extends ParameterSerializer {

    /**
     * Create new variable object
     *
     * @param <T> the variable type
     * @param name name of variable
     * @param value value of variable
     * @param isHidden hidden or visible?
     * @return a variable object
     */
    protected abstract <T extends Variable> T newVariable(
            String name, Object value, boolean isHidden);

    /**
     * Serialize java object
     *
     * @param unwrapper structure of agent class
     * @param agent the agent object
     * @return List of variables
     */
    @SuppressWarnings({ "unchecked", "rawtypes" })
    public List serialize(ClassUnwrapper unwrapper, Object agent) {
	    List variables = new ArrayList<>();
	    List<GetterMethodCover> methods = unwrapper.getMethods();
	    for(GetterMethodCover method : methods) {
	        Object value = method.invoke(agent);
	        if(value == null)
	            continue;
            variables.add(newVariable(method.getKey(),
                    getValue(method, value),
                    method.isHidden()));
	    }
	    return variables;
	}

    /**
     * Call getter method and get value
     *
     * @param method structure of getter method
     * @param value object to call method
     * @return a value
     */
	@SuppressWarnings("rawtypes")
    protected Object getValue(GetterMethodCover method, Object value) {
        if(method.isByte()) {
            value = ((Byte)value).intValue();
        }
        else if(method.isChar()) {
            value = (int)((Character)value).charValue();
        }
        else if(method.isFloat()) {
            value = ((Float)value).doubleValue();
        }
        else if(method.isLong()) {
            value = ((Long)value).doubleValue();
        }
        else if(method.isShort()) {
            value = ((Short)value).intValue();
        }
        else if(method.isObject()) {
            value = parseObject(method, value);
        }
        else if(method.isObjectArray()) {
            value = parseArray(method, value);
        }
        else if(method.isArrayObjectCollection()) {
            return parseArrayObjectCollection(method, (Collection)value);
        }
        else if(method.isObjectCollection()) {
            return parseObjectCollection(method, (Collection)value);
        }
        else if(method.isArrayCollection()) {
            return parseArrayCollection(method, (Collection)value);
        }
        else if(method.isArray() || method.isColection()) {
            return transformSimpleValue(value);
        }
	    return value;
	}

	protected ISFSArray transformSimpleValue(Object value) {
	    ISFSArray answer = new SFSArray();
	    answer.add(TRANSFORMER.transform(value));
	    return answer;
	}

	private static final SimpleTransformer TRANSFORMER
        = new SimpleTransformer();
}


text:
using NPlant;

namespace Hello.NPlant.Diagrams;

// ReSharper disable once UnusedType.Global
public class SimpleRecursiveDiagram : ClassDiagram
{
    public SimpleRecursiveDiagram()
    {
        AddClass<Foo>();
    }

    public class Foo
    {
        public string SomeString;
        public Bar TheBar;
        public Baz TheBaz;
    }

    public class Bar
    {
        public DateTime? SomeDate;

    }

    public class Baz
    {
        public Foo TheFoo;
    }
}


text:
module WindowBlessing
class EventQueue
  attr_accessor :queue

  def initialize
    @queue = []
  end

  def <<(a)
    case a
    when Array then @queue += a
    else @queue << a
    end
  end

  def clear; @queue = [] end
  def pop_all; @queue.tap {clear} end
  def empty?; @queue.length == 0 end
end
end


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <title>
    {{SITE_NAME}} {{DEBUG|yesno:"DEBUG ,"}}| {% block title %} {% endblock %}
  </title>
  <meta name="description" content="Create your own microblog and connect with your friends. Post from the Web, by SMS, or from desktop clients. Add comments, use icons, link Webfeeds. Take it with you on your phone." />

  {{component.best.analytics.header|safe}}

  <link rel="icon" href="/themes/{{DEFAULT_THEME|urlencode}}/favicon.ico" type="image/x-icon" />

  {# base stylesheet #}
  <link rel="stylesheet" type="text/css" href="http://{{DOMAIN}}/css/core.css?17" media="screen,projection" />

  {# per-user theme override, usually set by a site admin #}
  {% if view.extra.theme %}
    <link rel="stylesheet" type="text/css" href="http://{{DOMAIN}}/themes/{{view.extra.theme|urlencode}}/screen.css" media="screen,projection" />

  {% else %}
    <link rel="stylesheet" type="text/css" href="http://{{DOMAIN}}/themes/{{DEFAULT_THEME|urlencode}}/screen.css" media="screen,projection" />

  {% endif %}

  {# per-user custom background #}

  {% for feed in feeds %}
  <link rel="alternate" type="application/{{feed.type}}+xml" title="{{feed.title}} ({{feed.type}})" href="{{feed.url}}" />
  {% endfor %}

  {% block head %}
  {% endblock %}

  {% block body %}
  {% endblock %}

  {% if DEBUG and 0 %}

    Toggle debug

<![CDATA[
      {% debug %}
      ]]>

  {% endif %}

  {{component.best.analytics.footer|safe}}


text:
<?php

namespace GitlabXMPPHook\Exception;

/**
 * PHP Gitlab Jabber Hook
 *
 * @package  php-gitlab-jabberhook
 * @author   Leon Jacobs <@leonjza>
 * @license  MIT
 * @link     https://leonjza.github.io/
 */

/**
 * EmptySource Exception
 */
class EmptySource extends \Exception
{

}


text:
require 'test_helper'

class CommoditySetTest < ActiveSupport::TestCase
  # Replace this with your real tests.
  test "the truth" do
    assert true
  end
end


text:
<?php
Library::import('recess.lang.Annotation');

class ViewAnnotation extends Annotation {

	const PREFIX = 'prefix';

	protected $prefix = '';

	protected $viewClass = 'LayoutsView';

	public function usage() {
		return '!View ViewProvider [, Prefix: pathWithinViews/]';
	}

	public function isFor() {
		return Annotation::FOR_CLASS;
	}

	protected function validate($class) {
		$this->acceptedKeys(array(self::PREFIX));
		$this->minimumParameterCount(1);
		$this->maximumParameterCount(2);
		$this->validOnSubclassesOf($class, Controller::CLASSNAME);
	}

	protected function expand($class, $reflection, $descriptor) {
		if(isset($this->values[0])) {
			$this->viewClass = $this->values[0];
			if(strpos($this->viewClass, 'View') === false) {
				$this->viewClass .= 'View';
			}
		}
		$descriptor->viewClass = $this->viewClass;
		$descriptor->viewsPrefix = $this->prefix;
	}

}
?>


text:
package br.edu.utfpr.recominer.metric.network;

/**
 *
 * @author Rodrigo T. Kuroda <rodrigokuroda at alunos.utfpr.edu.br>
 */
public class EmptyNetworkMetrics extends NetworkMetrics {

    public EmptyNetworkMetrics() {
        super();
    }

}


text:
namespace clang {
  class Module;
}

namespace swift {
class ModuleDecl;

using ImportModuleTy = PointerUnion<ModuleDecl*, const clang::Module*>;

/// Prints the declarations of \p M to \p os and collecting imports in
/// \p imports along the way.
void printModuleContentsAsObjC(raw_ostream &os,
                               llvm::SmallPtrSetImpl<ImportModuleTy> &imports,
                               ModuleDecl &M);

} // end namespace swift

#endif


text:
package com.analyticobjects.digitalsafe.net;

import org.junit.After;
import org.junit.AfterClass;
import static org.junit.Assert.fail;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

/**
 * Tests of DigitalServer.
 *
 * @author Joel Bondurant
 * @since 2013.10
 */
public class DigitalServerTest {

	public DigitalServerTest() {
	}

	@BeforeClass
	public static void setUpClass() {
	}

	@AfterClass
	public static void tearDownClass() {
	}

	@Before
	public void setUp() {
	}

	@After
	public void tearDown() {
	}

	/**
	 * Test of run method, of class DigitalServer.
	 */
	@Test
	public void testRun() {
		System.out.println("run");
		DigitalServer digiServer = DigitalServer.getInstance();
		try {
			digiServer.start();
		} catch (InterruptedException ex) {
			System.out.println(ex.getLocalizedMessage());
			fail();
		}
	}

}


text:
from mistral.tests import base
from mistral.utils.openstack import keystone

class KeystoneUtilsTest(base.BaseTest):
    def setUp(self):
        super(KeystoneUtilsTest, self).setUp()

        self.values = {'id': 'my_id'}

    def test_format_url_dollar_sign(self):
        url_template = "http://host:port/v1/$(id)s"

        expected = "http://host:port/v1/my_id"

        self.assertEqual(
            expected,
            keystone.format_url(url_template, self.values)
        )

    def test_format_url_percent_sign(self):
        url_template = "http://host:port/v1/%(id)s"

        expected = "http://host:port/v1/my_id"

        self.assertEqual(
            expected,
            keystone.format_url(url_template, self.values)
        )


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link href="../metro/css/metro-all.css?ver=@@b-version" rel="stylesheet">

    <title>Test Ripple effect - Metro 4 :: Popular HTML, CSS and JS library</title>

Ripple effect test page

        <button class="button" onclick="Metro.ripple('#b2')">Ripple button</button>
        <button class="button" onclick="Metro.ripple('.box')">Ripple block</button>

        <button class="command-button" data-role="ripple" data-ripple-color="gray" id="b1">

                Yes, share and connect
                Use this option for home or work

        </button>

        <button class="command-button alert" id="b2">

                Alarm!
                Use this option for home or work

        </button>


text:
package com.smeshlink.misty.service.channel;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

/**
 * A simplistic {@link IoBufferAllocator} which simply allocates a new
 * buffer every time.
 *
 * @author Apache MINA Project
 */
class SimpleBufferAllocator implements IoBufferAllocator {

    public IoBuffer allocate(int capacity, boolean direct) {
        return wrap(allocateNioBuffer(capacity, direct));
    }

    public ByteBuffer allocateNioBuffer(int capacity, boolean direct) {
        ByteBuffer nioBuffer;
        if (direct) {
            nioBuffer = ByteBuffer.allocateDirect(capacity);
        } else {
            nioBuffer = ByteBuffer.allocate(capacity);
        }
        return nioBuffer;
    }

    public IoBuffer wrap(ByteBuffer nioBuffer) {
        return new SimpleBuffer(nioBuffer);
    }

    public void dispose() {
        // Do nothing
    }

    private class SimpleBuffer extends AbstractIoBuffer {
        private ByteBuffer buf;

        protected SimpleBuffer(ByteBuffer buf) {
            super(SimpleBufferAllocator.this, buf.capacity());
            this.buf = buf;
            buf.order(ByteOrder.BIG_ENDIAN);
        }

        protected SimpleBuffer(SimpleBuffer parent, ByteBuffer buf) {
            super(parent);
            this.buf = buf;
        }

        public ByteBuffer buf() {
            return buf;
        }

        protected void buf(ByteBuffer buf) {
            this.buf = buf;
        }

        protected IoBuffer duplicate0() {
            return new SimpleBuffer(this, this.buf.duplicate());
        }

        protected IoBuffer slice0() {
            return new SimpleBuffer(this, this.buf.slice());
        }

        protected IoBuffer asReadOnlyBuffer0() {
            return new SimpleBuffer(this, this.buf.asReadOnlyBuffer());
        }

        public byte[] array() {
            return buf.array();
        }

        public int arrayOffset() {
            return buf.arrayOffset();
        }

        public boolean hasArray() {
            return buf.hasArray();
        }

        public void free() {
            // Do nothing
        }
    }
}


text:
from django.core.exceptions import ValidationError
from django.db.models import URLField
from django.utils.translation import gettext_lazy as _

from fluent_contents.plugins.oembeditem import backend

class OEmbedUrlField(URLField):
    """
    URL Field which validates whether the URL is supported by the OEmbed provider.

    This feature is provided as model field, so other apps can use the same logic too.
    """

    def __init__(self, *args, **kwargs):
        kwargs.setdefault(
            "help_text",
            _(
                "Enter the URL of the online content to embed (e.g. a YouTube or Vimeo video, SlideShare presentation, etc..)"
            ),
        )
        super().__init__(*args, **kwargs)

    def clean(self, *args, **kwargs):
        url = super().clean(*args, **kwargs)

        if not backend.has_provider_for_url(url):
            # It's also possible that the backend is configured as provider.
            raise ValidationError(_("The URL is not valid for embedding content"))

        return url


text:
<?php
/**
 * Created by PhpStorm.
 * User: zoy
 * Date: 20/12/16
 * Time: 21:43
 */

namespace Zoy\Accessuser\Bases\Repository;

use Illuminate\Support\Facades\DB;
use Zoy\Accessuser\Bases\Repository\Eloquent\Repository;

abstract  class BaseRepository extends Repository
{

    /**
     * Specify Model class name
     *
     * @return mixed
     */
    public  function model(){
        return null;
    }

    /**
     * Find or create acess
     *
     * @param $data
     * @param array $attr
     * @return mixed
     */
    public function findOrCreate($data,array $attr= ['*']){
        $collectData  = $this->findWhere($data,$attr);
        if($collectData->isEmpty()){
             $model =  $this->create($data);
        }
        else{
            $model = $collectData->first();
            $model->touch();
        }
        return $model;
    }

}


text:
package com.blinkbox.books.json

import com.blinkbox.books.json.Json4sExtensions._
import org.json4s.JsonAST.{JNothing, JString, JValue}
import org.json4s.JsonDSL._
import org.json4s.jackson.JsonMethods
import org.scalatest.FunSuite

class Json4sExtensionsTests extends FunSuite with JsonMethods {
  val json: JValue =
    ("details" -> (("name" -> "John") ~ ("surname" -> "Smith") ~ ("age" -> 20))) ~
    ("name" -> "John Smith") ~
    ("test" -> ("name" -> "test"))

  test("Removing a direct field should not remove any other fields with the same name") {
    val result = json.removeDirectField("name")
    assert(result \ "name" == JNothing)
    assert(result \ "details" \ "name" == JString("John"))
  }

  test("Removing a direct field that does not exist should not change the json") {
    val result = json.removeDirectField("whatever")
    assert(result == json)
  }

  test("Removing multiple direct fields should only remove direct fields") {
    val result = json.removeDirectFields("name", "test")
    assert(result \ "details" == (("name" -> "John") ~ ("surname" -> "Smith") ~ ("age" -> 20)))
    assert(result \ "test" == JNothing)
    assert(result \ "name" == JNothing)
  }

  test("Overwriting a direct field should not replace any other fields with the same name") {
    val result = json.overwriteDirectField("name", "Bob")
    assert(result \ "name" == JString("Bob"))
    assert(result \ "details" \ "name" == JString("John"))
  }

  test("Overwriting a direct field that does not exist should just add that field") {
    val result = json.overwriteDirectField("data", "abc123")
    assert(result \ "data" == JString("abc123"))
  }

  test("The sha1 hash of two identical json documents should be the same") {
    def j: JValue = ("f1" -> "a") ~ ("f2" -> "b")
    assert(j.sha1 == j.sha1)
  }

  test("The sha1 hash of two different json documents should not be the same") {
    val j1: JValue = ("f1" -> "a") ~ ("f2" -> "b")
    val j2: JValue = ("f2" -> "b") ~ ("f1" -> "a")
    assert(j1.sha1 != j2.sha1)
  }
}


text:
<?php namespace Softservlet\MediaCollection\Laravel\ORM;

use Illuminate\Database\Eloquent\Model;

/**
 * @author Marius Leustean <marius@softservlet.com>
 *
 * @version 1.0
 */

class CollectionDB extends Model
{
	//database table
	protected $table = 'collections';

	//unguard all
	protected $guarded = array();

	//relationship to objects
	public function objects()
	{
		return $this->belongsToMany('Softservlet\MediaCollection\Laravel\ORM\MediaObjectDB','collections_media_objects','collection_id','media_object_id');
	}
}


text:
import { ChartModule } from 'angular2-highcharts';

export function chartFactory() {
  return require('highcharts');
}


text:
namespace client {
namespace window_test {

namespace {

CefRefPtr<CefWindow> GetWindow(CefRefPtr<CefBrowser> browser) {
  CEF_REQUIRE_UI_THREAD();
  DCHECK(browser->GetHost()->HasView());

  CefRefPtr<CefBrowserView> browser_view =
      CefBrowserView::GetForBrowser(browser);
  DCHECK(browser_view.get());

  CefRefPtr<CefWindow> window = browser_view->GetWindow();
  DCHECK(window.get());
  return window;
}

}  // namespace

WindowTestRunnerViews::WindowTestRunnerViews() {
}

void WindowTestRunnerViews::SetPos(CefRefPtr<CefBrowser> browser,
                                   int x, int y, int width, int height) {
  CefRefPtr<CefWindow> window = GetWindow(browser);

  CefRect window_bounds(x, y, width, height);
  ModifyBounds(window->GetDisplay()->GetWorkArea(), window_bounds);

  window->SetBounds(window_bounds);
}

void WindowTestRunnerViews::Minimize(CefRefPtr<CefBrowser> browser) {
  GetWindow(browser)->Minimize();
}

void WindowTestRunnerViews::Maximize(CefRefPtr<CefBrowser> browser) {
  GetWindow(browser)->Maximize();
}

void WindowTestRunnerViews::Restore(CefRefPtr<CefBrowser> browser) {
  GetWindow(browser)->Restore();
}

}  // namespace window_test
}  // namespace client


text:
using DotVVM.Framework.Hosting;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;

namespace DotVVM.Framework.ResourceManagement
{
    /// <summary>
    /// Represents resource located on the server, so it can be loaded to stream easily.
    /// </summary>
    public interface ILocalResourceLocation: IResourceLocation
    {
        Stream LoadResource(IDotvvmRequestContext context);
    }
}


text:
#ifndef JAXC_STACK_H
#define JAXC_STACK_H

typedef struct jaxc_stack jaxc_stack_t;

jaxc_stack_t* jaxc_stack_create();

void jaxc_stack_free(jaxc_stack_t *stack);

void* jaxc_stack_pop(jaxc_stack_t *stack);

void jaxc_stack_push(jaxc_stack_t *stack, void* value);

int jaxc_stack_size(jaxc_stack_t *stack);

void* jaxc_stack_get(jaxc_stack_t *stack);

void* jaxc_stack_get_at(jaxc_stack_t *stack, int i);

#endif


text:
title: About
author: Dennis Pierce
date: 2014-04-20
template: article.hbs
---

This site is built using [WIntersmith][1]. Whenever putting together a blog or small site, Wordpress has become the standard go-to choice. But when you are dealing with a small site that isn't going to get a ton of updates and traffic, it always felt wrong to go through the entire process to install Wordpress, get mysql up and running, and then have every page view dynamically generated via PHP. Static site generators caught my eye because they are the perfect solution to the Wordpress
install problem. When making my choice, I wanted a generator that was actively updated and was built in Node.

I settled on Wintersmith because it looked like it was pretty flexible with support for plugins and different template engines. I immediately ripped out the Jade template engine and went with Handlebars. I'm not a fan of shorthand languages that compile into a real language (e.g., Jade and Coffeescript). I feel that it's better to be comfortable with the language the browsers are actually using rather than learning another layer removed. Also, HTML and Javascript are standards that aren't
going anywhere, but who knows how long Jade will be around since there are so many competing template engines. Also, I don't find HTML that hard to deal with so I don't need shortcuts. I do break my rule with SASS, but SASS succeeds for me because it uses CSS syntax as its base and then enhances on top of that. You can always drop down and write pure CSS and then start weaving in SASS enhancements as you like. Compare that to opening up a Jade or Coffeescript file where you are
presented with a completely different syntax that I find jarring after working with HTML and Javascript all day.

Anyway, so far Wintersmith has been a good tool to use, but in the future I'm going to see if I can find a similar tool that doesn't use Coffeescript.

The front-end is pretty basic with only some basic Jascript coding to toggle classes for the card flip effect and mobile menu dropdowns. I also rely on [band.js][2] for working with the WebAudio API.  Originally I was going to hand-code the WebAudio calls, but I wanted to specify rhythms and that's when things got more complicated than I wanted to deal with. band.js already has rhythms and notes worked out and it worked OK for the small tune to play when clicking the footer logo. There is
a small issue with the library not supporting the older Webkit WebAudio methods which causes the library to blow up on iOS devices. So to fix that I had to install a polyfill to provide a bridge from the Webkit api to the current standard (createGainNode to createGain).

The CSS framework is using Bourbon, Neat, and Bitters. I originally tried Gumby but explain why I switched to Bourbon in another [blog post][3].

Source code for my site is available on [github][5].

Last, but not least, the name for my company/domain  comes from a scene in the silent movie *Intolerance*.

>The girl of our story keeps
house for her father who works
in a Jenkins mill. With a wage
of $2.75 a day, a little garden,
four hens, ditto geese, and a
fair measure of happiness and contentment.

![The Dear One][4]

[1]: http://wintersmith.io
[2]: https://github.com/meenie/band.js
[3]: /articles/gumby-bourbon/
[4]: dearone.jpg "The Dear One"
[5]: https://github.com/stubenbaines/fairmeasureofhappiness


text:
import wx

class EekMexGui(wx.App):

    def __init__(self, redirect=False, filename=None, useBestVisual=False, clearSigInt=True):

        wx.App.__init__(self, redirect, filename, useBestVisual, clearSigInt)
	pass

    def main(self, parent):

        wx.Frame.__init__(self, None, wx.ID_ANY, "EekMex")

        pass

app = EekMexGui()
app.main('Temp')

# End of File


text:
package com.mapswithme.maps.search;

import android.os.Bundle;
import android.support.annotation.CallSuper;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import com.mapswithme.maps.R;
import com.mapswithme.maps.base.BaseMwmRecyclerFragment;
import com.mapswithme.maps.widget.PlaceholderView;
import com.mapswithme.maps.widget.SearchToolbarController;
import com.mapswithme.util.UiUtils;

public class SearchHistoryFragment extends BaseMwmRecyclerFragment
{
  private PlaceholderView mPlaceHolder;

  private void updatePlaceholder()
  {
    UiUtils.showIf(getAdapter() != null && getAdapter().getItemCount() == 0, mPlaceHolder);
  }

  @Override
  protected RecyclerView.Adapter createAdapter()
  {
    return new SearchHistoryAdapter(((SearchToolbarController.Container) getParentFragment()).getController());
  }

  @Override
  protected @LayoutRes int getLayoutRes()
  {
    return R.layout.fragment_search_base;
  }

  @Override
  public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState)
  {
    super.onViewCreated(view, savedInstanceState);
    getRecyclerView().setLayoutManager(new LinearLayoutManager(view.getContext()));
    mPlaceHolder = (PlaceholderView) view.findViewById(R.id.placeholder);
    mPlaceHolder.setContent(R.drawable.img_search_empty_history_light,
                            R.string.search_history_title, R.string.search_history_text);

    if (getAdapter() != null)
    {
      getAdapter().registerAdapterDataObserver(new RecyclerView.AdapterDataObserver()
      {
        @Override
        public void onChanged()
        {
          updatePlaceholder();
        }
      });
    }
    updatePlaceholder();
  }

  @CallSuper
  @Override
  public void onActivityCreated(@Nullable Bundle savedInstanceState)
  {
    super.onActivityCreated(savedInstanceState);
    ((SearchFragment) getParentFragment()).setRecyclerScrollListener(getRecyclerView());
  }
}


text:
using UnityEngine;
using System.Collections;

public class ScrollingUVs_Layers : MonoBehaviour
{
	//public int materialIndex = 0;
	public Vector2 uvAnimationRate = new Vector2( 1.0f, 0.0f );
	public string textureName = "_MainTex";

	Vector2 uvOffset = Vector2.zero;

	void LateUpdate()
	{
		uvOffset += ( uvAnimationRate * Time.deltaTime );
		if( GetComponent<Renderer>().enabled )
		{
			GetComponent<Renderer>().sharedMaterial.SetTextureOffset( textureName, uvOffset );
		}
	}
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!-- ======================================================================
     29 Sep 2008 16:36:29

     ====================================================================== -->
<project name="HelloWorld" default="compile" basedir=".">

	<property name="server.classes.additional.dir" value="classes/client" />

	<property file="${basedir}/build.properties" />

	<import file="${basedir}/../ant/build.xml" />

	<target name="servletWar" depends="compile">

		<war webxml="./resources/WEB-INF-servlet/web.xml" jarfile="${build.server.dir}/${ant.project.name}-servlet.war">
			<classes dir="${server.classes.additional.dir}" />
			<webinf dir="./resources/WEB-INF-servlet">
			    <include name="*"/>
			</webinf>
			<lib dir="${lib.dir}">
			    <include name="wise-*.jar"/>
			    <include name="milyn-*.jar"/>
  			</lib>
			<manifest>
				<attribute name="Dependencies" value="org.jboss.ws.cxf.jbossws-cxf-client,org.apache.cxf.impl optional,org.apache.commons.io,org.apache.commons.lang"/>
			</manifest>
		</war>
	</target>

	<target name="deployServlet" depends="servletWar" description="Deploys the client side archive of the current test">
		<copy todir="${JBossHome}/${ServerConfig}/deployments/" file="${build.server.dir}/${ant.project.name}-servlet.war" />
	</target>

	<target name="undeployServlet" description="Undeploys the client side archive of the current test">
		<delete file="${JBossHome}/${ServerConfig}/deployments/${ant.project.name}-servlet.war" />
	</target>

</project>


text:
/*
 * Do not modify this file. This file is generated from the devicefarm-2015-06-23.normal.json service model.
 */
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Text;
using System.IO;

using Amazon.Runtime;
using Amazon.Runtime.Internal;

namespace Amazon.DeviceFarm.Model
{
    /// <summary>
    /// Represents the screen resolution of a device in height and width, expressed in pixels.
    /// </summary>
    public partial class Resolution
    {
        private int? _height;
        private int? _width;

        /// <summary>
        /// Gets and sets the property Height.
        /// <para>
        /// The screen resolution's height, expressed in pixels.
        /// </para>
        /// </summary>
        public int Height
        {
            get { return this._height.GetValueOrDefault(); }
            set { this._height = value; }
        }

        // Check to see if Height property is set
        internal bool IsSetHeight()
        {
            return this._height.HasValue;
        }

        /// <summary>
        /// Gets and sets the property Width.
        /// <para>
        /// The screen resolution's width, expressed in pixels.
        /// </para>
        /// </summary>
        public int Width
        {
            get { return this._width.GetValueOrDefault(); }
            set { this._width = value; }
        }

        // Check to see if Width property is set
        internal bool IsSetWidth()
        {
            return this._width.HasValue;
        }

    }
}


text:
@implementation DBSHARINGLinkMetadata

#pragma mark - Constructors

- (instancetype)initWithUrl:(NSString *)url visibility:(DBSHARINGVisibility *)visibility expires:(NSDate *)expires {

  self = [super init];
  if (self) {
    _url = url;
    _visibility = visibility;
    _expires = expires;
  }
  return self;
}

- (instancetype)initWithUrl:(NSString *)url visibility:(DBSHARINGVisibility *)visibility {
  return [self initWithUrl:url visibility:visibility expires:nil];
}

#pragma mark - Serialization methods

+ (NSDictionary *)serialize:(id)instance {
  return [DBSHARINGLinkMetadataSerializer serialize:instance];
}

+ (id)deserialize:(NSDictionary *)dict {
  return [DBSHARINGLinkMetadataSerializer deserialize:dict];
}

#pragma mark - Description method

- (NSString *)description {
  return [[DBSHARINGLinkMetadataSerializer serialize:self] description];
}

@end

#pragma mark - Serializer Object

@implementation DBSHARINGLinkMetadataSerializer

+ (NSDictionary *)serialize:(DBSHARINGLinkMetadata *)valueObj {
  NSMutableDictionary *jsonDict = [[NSMutableDictionary alloc] init];

  jsonDict[@"url"] = valueObj.url;
  jsonDict[@"visibility"] = [DBSHARINGVisibilitySerializer serialize:valueObj.visibility];
  if (valueObj.expires) {
    jsonDict[@"expires"] = [DBNSDateSerializer serialize:valueObj.expires dateFormat:@"%Y-%m-%dT%H:%M:%SZ"];
  }

  if ([valueObj isKindOfClass:[DBSHARINGPathLinkMetadata class]]) {
    NSDictionary *subTypeFields = [DBSHARINGPathLinkMetadataSerializer serialize:(DBSHARINGPathLinkMetadata *)valueObj];
    for (NSString *key in subTypeFields) {
      jsonDict[key] = subTypeFields[key];
    }
    jsonDict[@".tag"] = @"path";
  } else if ([valueObj isKindOfClass:[DBSHARINGCollectionLinkMetadata class]]) {
    NSDictionary *subTypeFields =
        [DBSHARINGCollectionLinkMetadataSerializer serialize:(DBSHARINGCollectionLinkMetadata *)valueObj];
    for (NSString *key in subTypeFields) {
      jsonDict[key] = subTypeFields[key];
    }
    jsonDict[@".tag"] = @"collection";
  }

  return jsonDict;
}

+ (DBSHARINGLinkMetadata *)deserialize:(NSDictionary *)valueDict {
  if ([valueDict[@".tag"] isEqualToString:@"path"]) {
    return [DBSHARINGPathLinkMetadataSerializer deserialize:valueDict];
  }
  if ([valueDict[@".tag"] isEqualToString:@"collection"]) {
    return [DBSHARINGCollectionLinkMetadataSerializer deserialize:valueDict];
  }

  @throw([NSException
      exceptionWithName:@"InvalidTag"
                 reason:[NSString stringWithFormat:@"Tag has an invalid value: \"%@\".", valueDict[@".tag"]]
               userInfo:nil]);
}

@end


text:
#import "EaseChatBarMoreView.h"

#define CHAT_BUTTON_SIZE CGSizeMake(50,60)
#define INSETS 10
#define MOREVIEW_COL 4
#define MOREVIEW_ROW 2
#define MOREVIEW_BUTTON_TAG 1000

@implementation UIView (MoreView)

- (void)removeAllSubview
{
    for (UIView *view in self.subviews) {
        [view removeFromSuperview];
    }
}

@end

@interface EaseChatBarMoreView ()<UIScrollViewDelegate>
{
    EMChatToolbarType _type;
    NSInteger _maxIndex;
}

@property (nonatomic, strong) UIScrollView *scrollview;
@property (nonatomic, strong) UIPageControl *pageControl;

@property (nonatomic, strong) UIButton *photoButton;
@property (nonatomic, strong) UIButton *takePicButton;
@property (nonatomic, strong) UIButton *locationButton;
@property (nonatomic, strong) UIButton *videoButton;
@property (nonatomic, strong) UIButton *audioCallButton;
@property (nonatomic, strong) UIButton *videoCallButton;

@end

@implementation EaseChatBarMoreView

+ (void)initialize
{
    // UIAppearance Proxy Defaults
    EaseChatBarMoreView *moreView = [self appearance];
    moreView.moreViewBackgroundColor = [UIColor whiteColor];
}

- (instancetype)initWithFrame:(CGRect)frame type:(EMChatToolbarType)type
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        _type = type;
        [self setupSubviewsForType:_type];
    }
    return self;
}

- (void)setupSubviewsForType:(EMChatToolbarType)type
{
    //self.backgroundColor = [UIColor clearColor];
    self.accessibilityIdentifier = @"more_view";

    _scrollview = [[UIScrollView alloc] init];
    _scrollview.pagingEnabled = YES;
    _scrollview.showsHorizontalScrollIndicator = NO;
    _scrollview.showsVerticalScrollIndicator = NO;
    _scrollview.delegate = self;
    [self addSubview:_scrollview];

    _pageControl = [[UIPageControl alloc] init];
    _pageControl.currentPage = 0;
    _pageControl.numberOfPages = 1;
    [self addSubview:_pageControl];

    CGFloat insets = (self.frame.size.width - 4 * CHAT_BUTTON_SIZE.width) / 5;

    _photoButton = [self btnWithImage:[UIImage imageNamed:@"EaseUIResource.bundle/chatBar_colorMore_photo"]
                     highlightedImage:[UIImage imageNamed:@"EaseUIResource.bundle/chatBar_colorMore_photoSelected"]
                                title:@"相册"];

    _photoButton.accessibilityIdentifier = @"image";
    [_photoButton setFrame:CGRectMake(insets, 10, CHAT_BUTTON_SIZE.width , CHAT_BUTTON_SIZE.height)];
    [_photoButton addTarget:self action:@selector(photoAction) forControlEvents:UIControlEventTouchUpInside];
    _photoButton.tag = MOREVIEW_BUTTON_TAG;
    [_scrollview addSubview:_photoButton];

    _locationButton = [self btnWithImage:[UIImage imageNamed:@"EaseUIResource.bundle/chatBar_colorMore_location"]
                        highlightedImage:[UIImage imageNamed:@"EaseUIResource.bundle/chatBar_colorMore_locationSelected"]
                                   title:@"位置"];
    _locationButton.accessibilityIdentifier = @"location";
    [_locationButton setFrame:CGRectMake(insets * 2 + CHAT_BUTTON_SIZE.width, 10, CHAT_BUTTON_SIZE.width , CHAT_BUTTON_SIZE.height)];
    [_locationButton addTarget:self action:@selector(locationAction) forControlEvents:UIControlEventTouchUpInside];
    _locationButton.tag = MOREVIEW_BUTTON_TAG + 1;
    [_scrollview addSubview:_locationButton];

    _takePicButton = [self btnWithImage:[UIImage imageNamed:@"EaseUIResource.bundle/chatBar_colorMore_camera"]
                       highlightedImage:[UIImage imageNamed:@"EaseUIResource.bundle/chatBar_colorMore_cameraSelected"]
                                  title:@"拍照"];
    [_takePicButton setFrame:CGRectMake(insets * 3 + CHAT_BUTTON_SIZE.width * 2, 10, CHAT_BUTTON_SIZE.width , CHAT_BUTTON_SIZE.height)];
    [_takePicButton addTarget:self action:@selector(takePicAction) forControlEvents:UIControlEventTouchUpInside];
    _takePicButton.tag = MOREVIEW_BUTTON_TAG + 2;
    _maxIndex = 2;
    [_scrollview addSubview:_takePicButton];

    CGRect frame = self.frame;
    if (type == EMChatToolbarTypeChat) {
        frame.size.height = 150;
        _audioCallButton = [self btnWithImage:[UIImage imageNamed:@"EaseUIResource.bundle/chatBar_colorMore_audioCall"]
                             highlightedImage:[UIImage imageNamed:@"EaseUIResource.bundle/chatBar_colorMore_audioCallSelected"]
                                        title:@"语音"];
        [_audioCallButton setFrame:CGRectMake(insets * 4 + CHAT_BUTTON_SIZE.width * 3, 10, CHAT_BUTTON_SIZE.width , CHAT_BUTTON_SIZE.height)];
        [_audioCallButton addTarget:self action:@selector(takeAudioCallAction) forControlEvents:UIControlEventTouchUpInside];
        _audioCallButton.tag = MOREVIEW_BUTTON_TAG + 3;
        [_scrollview addSubview:_audioCallButton];

        _videoCallButton = [self btnWithImage:[UIImage imageNamed:@"EaseUIResource.bundle/chatBar_colorMore_videoCall"]
                             highlightedImage:[UIImage imageNamed:@"EaseUIResource.bundle/chatBar_colorMore_videoCallSelected"]
                                        title:@"视频"];
        [_videoCallButton setFrame:CGRectMake(insets, 10 * 2 + CHAT_BUTTON_SIZE.height + 10, CHAT_BUTTON_SIZE.width , CHAT_BUTTON_SIZE.height)];
        [_videoCallButton addTarget:self action:@selector(takeVideoCallAction) forControlEvents:UIControlEventTouchUpInside];
        _videoCallButton.tag =MOREVIEW_BUTTON_TAG + 4;
        _maxIndex = 4;
        [_scrollview addSubview:_videoCallButton];
    }
    else if (type == EMChatToolbarTypeGroup)
    {
        frame.size.height = 80;
    }
    self.frame = frame;
    _scrollview.frame = CGRectMake(0, 0, CGRectGetWidth(frame), CGRectGetHeight(frame));
    _pageControl.frame = CGRectMake(0, CGRectGetHeight(frame) - 20, CGRectGetWidth(frame), 20);
    _pageControl.hidden = _pageControl.numberOfPages<=1;
}

- (UIButton *)btnWithImage:(UIImage *)aImage highlightedImage:(UIImage *)aHighLightedImage title:(NSString *)aTitle {
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [btn setImage:aImage forState:UIControlStateNormal];
    [btn setImage:aHighLightedImage forState:UIControlStateHighlighted];
    [btn setTitle:aTitle forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    btn.titleLabel.font = [UIFont systemFontOfSize: 12.0];
    btn.imageEdgeInsets = UIEdgeInsetsMake(-10, 0, 20, 0);
    btn.titleEdgeInsets = UIEdgeInsetsMake(14, -60, -20, 0);
    return btn;
}

- (void)insertItemWithImage:(UIImage *)image highlightedImage:(UIImage *)highLightedImage title:(NSString *)title
{
    CGFloat insets = (self.frame.size.width - MOREVIEW_COL * CHAT_BUTTON_SIZE.width) / 5;
    CGRect frame = self.frame;
    _maxIndex++;
    NSInteger pageSize = MOREVIEW_COL*MOREVIEW_ROW;
    NSInteger page = _maxIndex/pageSize;
    NSInteger row = (_maxIndex%pageSize)/MOREVIEW_COL;
    NSInteger col = _maxIndex%MOREVIEW_COL;
    UIButton *moreButton = [self btnWithImage:image highlightedImage:highLightedImage title:title];
    [moreButton setFrame:CGRectMake(page * CGRectGetWidth(self.frame) + insets * (col + 1) + CHAT_BUTTON_SIZE.width * col, INSETS + INSETS * 2 * row + CHAT_BUTTON_SIZE.height * row, CHAT_BUTTON_SIZE.width , CHAT_BUTTON_SIZE.height)];
    [moreButton setImage:image forState:UIControlStateNormal];
    [moreButton setImage:highLightedImage forState:UIControlStateHighlighted];
    [moreButton addTarget:self action:@selector(moreAction:) forControlEvents:UIControlEventTouchUpInside];
    moreButton.tag = MOREVIEW_BUTTON_TAG+_maxIndex;
    [_scrollview addSubview:moreButton];
    [_scrollview setContentSize:CGSizeMake(CGRectGetWidth(self.frame) * (page + 1), CGRectGetHeight(self.frame))];
    [_pageControl setNumberOfPages:page + 1];
    if (_maxIndex >=5) {
        frame.size.height = 150;
        _scrollview.frame = CGRectMake(0, 0, CGRectGetWidth(frame), CGRectGetHeight(frame));
        _pageControl.frame = CGRectMake(0, CGRectGetHeight(frame) - 20, CGRectGetWidth(frame), 20);
    }
    self.frame = frame;
    _pageControl.hidden = _pageControl.numberOfPages<=1;
}

- (void)updateItemWithImage:(UIImage *)image highlightedImage:(UIImage *)highLightedImage title:(NSString *)title atIndex:(NSInteger)index
{
    UIView *moreButton = [_scrollview viewWithTag:MOREVIEW_BUTTON_TAG+index];
    if (moreButton && [moreButton isKindOfClass:[UIButton class]]) {
        [(UIButton*)moreButton setImage:image forState:UIControlStateNormal];
        [(UIButton*)moreButton setImage:highLightedImage forState:UIControlStateHighlighted];
    }
}

- (void)removeItematIndex:(NSInteger)index
{
    UIView *moreButton = [_scrollview viewWithTag:MOREVIEW_BUTTON_TAG+index];
    if (moreButton && [moreButton isKindOfClass:[UIButton class]]) {
        [self _resetItemFromIndex:index];
        [moreButton removeFromSuperview];
    }
}

#pragma mark - private

- (void)_resetItemFromIndex:(NSInteger)index
{
    CGFloat insets = (self.frame.size.width - MOREVIEW_COL * CHAT_BUTTON_SIZE.width) / 5;
    CGRect frame = self.frame;
    for (NSInteger i = index + 1; i<_maxIndex + 1; i++) {
        UIView *moreButton = [_scrollview viewWithTag:MOREVIEW_BUTTON_TAG+i];
        if (moreButton && [moreButton isKindOfClass:[UIButton class]]) {
            NSInteger moveToIndex = i - 1;
            NSInteger pageSize = MOREVIEW_COL*MOREVIEW_ROW;
            NSInteger page = moveToIndex/pageSize;
            NSInteger row = (moveToIndex%pageSize)/MOREVIEW_COL;
            NSInteger col = moveToIndex%MOREVIEW_COL;
            [moreButton setFrame:CGRectMake(page * CGRectGetWidth(self.frame) + insets * (col + 1) + CHAT_BUTTON_SIZE.width * col, INSETS + INSETS * 2 * row + CHAT_BUTTON_SIZE.height * row, CHAT_BUTTON_SIZE.width , CHAT_BUTTON_SIZE.height)];
            moreButton.tag = MOREVIEW_BUTTON_TAG+moveToIndex;
            [_scrollview setContentSize:CGSizeMake(CGRectGetWidth(self.frame) * (page + 1), CGRectGetHeight(self.frame))];
            [_pageControl setNumberOfPages:page + 1];
        }
    }
    _maxIndex--;
    if (_maxIndex >=5) {
        frame.size.height = 150;
    } else {
        frame.size.height = 80;
    }
    self.frame = frame;
    _scrollview.frame = CGRectMake(0, 0, CGRectGetWidth(frame), CGRectGetHeight(frame));
    _pageControl.frame = CGRectMake(0, CGRectGetHeight(frame) - 20, CGRectGetWidth(frame), 20);
    _pageControl.hidden = _pageControl.numberOfPages<=1;
}

#pragma setter
//- (void)setMoreViewColumn:(NSInteger)moreViewColumn
//{
//    if (_moreViewColumn != moreViewColumn) {
//        _moreViewColumn = moreViewColumn;
//        [self setupSubviewsForType:_type];
//    }
//}
//
//- (void)setMoreViewNumber:(NSInteger)moreViewNumber
//{
//    if (_moreViewNumber != moreViewNumber) {
//        _moreViewNumber = moreViewNumber;
//        [self setupSubviewsForType:_type];
//    }
//}

- (void)setMoreViewBackgroundColor:(UIColor *)moreViewBackgroundColor
{
    _moreViewBackgroundColor = moreViewBackgroundColor;
    if (_moreViewBackgroundColor) {
        [self setBackgroundColor:_moreViewBackgroundColor];
    }
}

/*
- (void)setMoreViewButtonImages:(NSArray *)moreViewButtonImages
{
    _moreViewButtonImages = moreViewButtonImages;
    if ([_moreViewButtonImages count] > 0) {
        for (UIView *view in self.subviews) {
            if ([view isKindOfClass:[UIButton class]]) {
                UIButton *button = (UIButton *)view;
                if (button.tag < [_moreViewButtonImages count]) {
                    NSString *imageName = [_moreViewButtonImages objectAtIndex:button.tag];
                    [button setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
                }
            }
        }
    }
}

- (void)setMoreViewButtonHignlightImages:(NSArray *)moreViewButtonHignlightImages
{
    _moreViewButtonHignlightImages = moreViewButtonHignlightImages;
    if ([_moreViewButtonHignlightImages count] > 0) {
        for (UIView *view in self.subviews) {
            if ([view isKindOfClass:[UIButton class]]) {
                UIButton *button = (UIButton *)view;
                if (button.tag < [_moreViewButtonHignlightImages count]) {
                    NSString *imageName = [_moreViewButtonHignlightImages objectAtIndex:button.tag];
                    [button setImage:[UIImage imageNamed:imageName] forState:UIControlStateHighlighted];
                }
            }
        }
    }
}*/

#pragma mark - UIScrollViewDelegate

-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
    CGPoint offset =  scrollView.contentOffset;
    if (offset.x == 0) {
        _pageControl.currentPage = 0;
    } else {
        int page = offset.x / CGRectGetWidth(scrollView.frame);
        _pageControl.currentPage = page;
    }
}

#pragma mark - action

- (void)takePicAction{
    if(_delegate && [_delegate respondsToSelector:@selector(moreViewTakePicAction:)]){
        [_delegate moreViewTakePicAction:self];
    }
}

- (void)photoAction
{
    if (_delegate && [_delegate respondsToSelector:@selector(moreViewPhotoAction:)]) {
        [_delegate moreViewPhotoAction:self];
    }
}

- (void)locationAction
{
    if (_delegate && [_delegate respondsToSelector:@selector(moreViewLocationAction:)]) {
        [_delegate moreViewLocationAction:self];
    }
}

- (void)takeAudioCallAction
{
    if (_delegate && [_delegate respondsToSelector:@selector(moreViewAudioCallAction:)]) {
        [_delegate moreViewAudioCallAction:self];
    }
}

- (void)takeVideoCallAction
{
    if (_delegate && [_delegate respondsToSelector:@selector(moreViewVideoCallAction:)]) {
        [_delegate moreViewVideoCallAction:self];
    }
}

- (void)moreAction:(id)sender
{
    UIButton *button = (UIButton*)sender;
    if (button && _delegate && [_delegate respondsToSelector:@selector(moreView:didItemInMoreViewAtIndex:)]) {
        [_delegate moreView:self didItemInMoreViewAtIndex:button.tag-MOREVIEW_BUTTON_TAG];
    }
}

@end


text:
{% load cms_tags %}

{{ instance.name }}

{{ instance.description|linebreaks }}


text: Menampilkan Semua Color yang sudah tidak diproduksi lagi


text:
const gutil = require('gulp-util');
const util = require('../util');
const ROOT = require('../const').ROOT;
const args = util.args;
const Server = require('karma').Server;

const karmaConfig = {
  logLevel: 'warn',
  configFile: ROOT + '/config/karma.conf.js'
};

// Make full build of JS and CSS
exports.dependencies = ['build'];

exports.task = function (done) {
  if (args.browsers)  karmaConfig.browsers = args.browsers.trim().split(',');
  if (args.reporters) karmaConfig.reporters = args.reporters.trim().split(',');
  if (args.config)    karmaConfig.configFile = ROOT + '/' + args.config.trim();

  gutil.log(gutil.colors.blue('Running unit tests on unminified source.'));

  const karma = new Server(karmaConfig, function(exitCode){
    // Immediately exit the process if Karma reported errors, because due to
    // potential still running tunnel-browsers gulp won't exit properly.
    // eslint-disable-next-line no-process-exit
    exitCode === 0 ? done() : process.exit(exitCode);
  });
  karma.start();
};


text:
<?php

?>
@extends('layouts.app')

@section('head-title')
    Edit Director / Bareos Reporter
@endsection

@section('content-header')

Edit Director

@endsection

<?php
        $enc_password = $catalog->password;
        if(!empty($enc_password))
        {
            $password = \Illuminate\Support\Facades\Crypt::decrypt($catalog->password);
        }
?>
@section('content')

{{ $director->director_name }}

                        <form class="form-add-director" method="POST" action="/directors/save/{{ $director->id }}">
                            {!! csrf_field() !!}
                            <input type="hidden" id="driver_check" name="driver_check" value="{{ $catalog->driver }}" />

Bareos Director Details

has('director_name') ? ' has-error' : '' }}">
                                Director Name:
                                <input type="text" class="form-control" name="director_name" value="{{ $director->director_name }}" />
                                @if ($errors->has('director_name'))

                                        {{ $errors->first('director_name') }}

                                @endif

has('director_ip') ? ' has-error' : '' }}">
                                Director IP (FQDN):
                                <input type="text" class="form-control" name="director_ip" value="{{ $director->ip_address }}" />
                                @if ($errors->has('director_ip'))

                                        {{ $errors->first('director_ip') }}

                                @endif

has('director_port') ? ' has-error' : '' }}">
                                Director Port:
                                <input type="text" class="form-control" name="director_port" placeholder="9101" value="{{ $director->director_port }}" />
                                @if ($errors->has('director_port'))

                                        {{ $errors->first('director_port') }}

                                @endif

Catalog Details

has('catalog_name') ? ' has-error' : '' }}">
                                Catalog Name:
                                <input type="text" class="form-control" name="catalog_name" value="{{ $catalog->name }}"/>
                                @if ($errors->has('catalog_name'))

                                        {{ $errors->first('catalog_name') }}

                                @endif

has('driver') ? ' has-error' : '' }}">
                                Database Driver:
                                <select id="driver-select" class="selectpicker form-control" name="driver">
                                    @if($catalog->driver == 'mysql')
                                        <option value="mysql" selected="selected">MySQL</option>
                                    @else
                                        <option value="mysql">MySQL</option>
                                    @endif
                                    @if($catalog->driver == 'pgsql')
                                        <option value="pgsql" selected="selected">PostgreSQL</option>
                                    @else
                                        <option value="pgsql">PostgreSQL</option>
                                    @endif
                                    @if($catalog->driver == 'sqlite')
                                        <option value="sqlite" selected="selected">SQLite</option>
                                    @else
                                        <option value="sqlite">SQLite</option>
                                    @endif
                                </select>
                                @if ($errors->has('driver'))

                                        {{ $errors->first('driver') }}

                                @endif

has('host-mysql') ? ' has-error' : '' }}">
                                    Host:
                                    @if($catalog->driver == 'mysql')
                                        <input type="text" class="form-control" name="host-mysql" value="{{ $catalog->host }}" />
                                    @else
                                        <input type="text" class="form-control" name="host-mysql" />
                                    @endif
                                    @if ($errors->has('host-mysql'))

                                        {{ $errors->first('host-mysql') }}

                                    @endif

has('port-mysql') ? ' has-error' : '' }}">
                                    Port:
                                    @if($catalog->driver == 'mysql')
                                        <input type="text" class="form-control" name="port-mysql" placeholder="3306" value="{{ $catalog->port }}" />
                                    @else
                                        <input type="text" class="form-control" name="port-mysql" placeholder="3306" />
                                    @endif
                                    @if ($errors->has('port-mysql'))

                                        {{ $errors->first('port-mysql') }}

                                    @endif

has('database-mysql') ? ' has-error' : '' }}">
                                    Database:
                                    @if($catalog->driver == 'mysql')
                                        <input type="text" class="form-control" name="database-mysql" value="{{ $catalog->database }}" />
                                    @else
                                        <input type="text" class="form-control" name="database-mysql" />
                                    @endif
                                    @if ($errors->has('database-mysql'))

                                        {{ $errors->first('database-mysql') }}

                                    @endif

has('username-mysql') ? ' has-error' : '' }}">
                                    Username:
                                    @if($catalog->driver == 'mysql')
                                        <input type="text" class="form-control" name="username-mysql" value="{{ $catalog->username }}" />
                                    @else
                                        <input type="text" class="form-control" name="username-mysql" />
                                    @endif
                                    @if ($errors->has('username-mysql'))

                                        {{ $errors->first('username-mysql') }}

                                    @endif

has('password-mysql') ? ' has-error' : '' }}">
                                    Password:
                                    @if($catalog->driver == 'mysql')
                                        <input type="password" class="form-control" name="password-mysql" value="{{ $password }}" />
                                    @else
                                        <input type="password" class="form-control" name="password-mysql" />
                                    @endif
                                    @if ($errors->has('password-mysql'))

                                        {{ $errors->first('password-mysql') }}

                                    @endif

has('charset-mysql') ? ' has-error' : '' }}">
                                    Charset:
                                    <select id="charset-select" class="selectpicker form-control" name="charset-mysql">
                                        @if(!empty($mysql_charsets))
                                            @foreach($mysql_charsets as $charset)
                                                @if($charset->CHARACTER_SET_NAME == $catalog->charset)
                                                    <option value="{{ $charset->CHARACTER_SET_NAME }}" selected="selected">{{ $charset->CHARACTER_SET_NAME }}</option>
                                                @else
                                                    <option value="{{ $charset->CHARACTER_SET_NAME }}">{{ $charset->CHARACTER_SET_NAME }}</option>
                                                @endif
                                            @endforeach
                                        @else
                                            <option value="-1">No Charsets Loaded</option>
                                        @endif
                                    </select>
                                    @if ($errors->has('charset-mysql'))

                                                {{ $errors->first('charset-mysql') }}

                                    @endif

has('collation-mysql') ? ' has-error' : '' }}">
                                    Collation:
                                    <select id="collation-select" class="selectpicker form-control" name="collation-mysql">
                                        @if(!empty($mysql_collations))
                                            @foreach($mysql_collations as $collation)
                                                @if($collation->COLLATION_NAME == $catalog->collation)
                                                    <option value="{{ $collation->COLLATION_NAME }}" selected="selected">{{ $collation->COLLATION_NAME }}</option>
                                                @else
                                                    <option value="{{ $collation->COLLATION_NAME }}">{{ $collation->COLLATION_NAME }}</option>
                                                @endif
                                            @endforeach
                                        @else
                                            <option value="-1">No Collations Loaded</option>
                                        @endif
                                    </select>
                                    @if ($errors->has('collation-mysql'))

                                                {{ $errors->first('collation-mysql') }}

                                    @endif

has('prefix-mysql') ? ' has-error' : '' }}">
                                    Prefix:
                                    @if($catalog->driver == 'mysql')
                                        <input type="text" class="form-control" name="prefix-mysql" value="{{ $catalog->prefix }}" />
                                    @else
                                        <input type="text" class="form-control" name="prefix-mysql" />
                                    @endif
                                    @if ($errors->has('prefix-mysql'))

                                        {{ $errors->first('prefix-mysql') }}

                                    @endif

has('strict-mysql') ? ' has-error' : '' }}">
                                    SQL Strict:
                                    <select id="strict-select" class="selectpicker form-control" name="strict-mysql" >
                                        @if($catalog->strict == 0)
                                            <option value="0" selected="selected">No</option>
                                        @elseif($catalog->strict == 1)
                                            <option value="1" selected="selected">Yes</option>
                                        @else
                                            <option value="0" selected="selected">No</option>
                                        @endif
                                        <option value="1">Yes</option>
                                    </select>
                                    @if ($errors->has('strict-mysql'))

                                        {{ $errors->first('strict-mysql') }}

                                    @endif

                                <input type="hidden" class="form-control" name="engine" value="null" />

has('host-pgsql') ? ' has-error' : '' }}">
                                    Host:
                                    @if($catalog->driver == 'pgsql')
                                        <input type="text" class="form-control" name="host-pgsql" value="{{ $catalog->host }}" />
                                    @else
                                        <input type="text" class="form-control" name="host-pgsql" />
                                    @endif
                                    @if ($errors->has('host-pgsql'))

                                        {{ $errors->first('host-pgsql') }}

                                    @endif

has('port-pgsql') ? ' has-error' : '' }}">
                                    Port:
                                    @if($catalog->driver == 'pgsql')
                                        <input type="text" class="form-control" name="port-pgsql" value="{{ $catalog->port }}" />
                                    @else
                                        <input type="text" class="form-control" name="port-pgsql" />
                                    @endif
                                    @if ($errors->has('port-pgsql'))

                                        {{ $errors->first('port-pgsql') }}

                                    @endif

has('database-pgsql') ? ' has-error' : '' }}">
                                    Database:
                                    @if($catalog->driver == 'pgsql')
                                        <input type="text" class="form-control" name="database-pgsql" value="{{ $catalog->database }}" />
                                    @else
                                        <input type="text" class="form-control" name="database-pgsql" />
                                    @endif
                                    @if ($errors->has('database-pgsql'))

                                        {{ $errors->first('database-pgsql') }}

                                    @endif

has('username-pgsql') ? ' has-error' : '' }}">
                                    Username:
                                    @if($catalog->driver == 'pgsql')
                                        <input type="text" class="form-control" name="username-pgsql" value="{{ $catalog->username }}" />
                                    @else
                                        <input type="text" class="form-control" name="username-pgsql" />
                                    @endif
                                    @if ($errors->has('username-pgsql'))

                                        {{ $errors->first('username-pgsql') }}

                                    @endif

has('password-pgsql') ? ' has-error' : '' }}">
                                    Password:
                                    @if($catalog->driver == 'pgsql')
                                        <input type="password" class="form-control" name="password-pgsql" value="{{ $password }}" />
                                    @else
                                        <input type="password" class="form-control" name="password-pgsql" />
                                    @endif
                                    @if ($errors->has('password-pgsql'))

                                        {{ $errors->first('password-pgsql') }}

                                    @endif

has('charset-pgsql') ? ' has-error' : '' }}">
                                    Charset:
                                    <select id="charset-select" class="selectpicker form-control" name="charset-pgsql">
                                        @if(!empty($pgsql_charsets))
                                            @foreach($pgsql_charsets as $charset)
                                                @if($charset->name == $catalog->charset)
                                                    <option value="{{ $charset->name }}" selected="selected">{{ $charset->name }}</option>
                                                @else
                                                    <option value="{{ $charset->name }}">{{ $charset->name }}</option>
                                                @endif
                                            @endforeach
                                        @else
                                            <option value="-1">No Charsets Loaded</option>
                                        @endif
                                    </select>
                                    @if ($errors->has('charset-pgsql'))

                                                {{ $errors->first('charset-pgsql') }}

                                    @endif

has('prefix-pgsql') ? ' has-error' : '' }}">
                                    Prefix:
                                    @if($catalog->driver == 'pgsql')
                                        <input type="text" class="form-control" name="prefix-pgsql" value="{{ $catalog->prefix }}" />
                                    @else
                                        <input type="text" class="form-control" name="prefix-pgsql" />
                                    @endif
                                    @if ($errors->has('prefix-pgsql'))

                                            {{ $errors->first('prefix-pgsql') }}

                                    @endif

has('schema-pgsql') ? ' has-error' : '' }}">
                                    Schema:
                                    @if($catalog->driver == 'pgsql')
                                        <input type="text" class="form-control" name="schema" value="{{ $catalog->schema }}" />
                                    @else
                                        <input type="text" class="form-control" name="schema" value="public" />
                                    @endif
                                    @if ($errors->has('schema-pgsql'))

                                            {{ $errors->first('schema-pgsql') }}

                                    @endif

has('database-sqlite') ? ' has-error' : '' }}">
                                    Database Path:
                                    @if($catalog->driver == 'sqlite')
                                        <input type="text" class="form-control" name="database-sqlite" value="{{ $catalog->database }}" />
                                    @else
                                        <input type="text" class="form-control" name="database-sqlite" />
                                    @endif
                                    @if ($errors->has('database-sqlite'))

                                            {{ $errors->first('database-sqlite') }}

                                    @endif

has('prefix-sqlite') ? ' has-error' : '' }}">
                                    Prefix:
                                    @if($catalog->driver == 'sqlite')
                                        <input type="text" class="form-control" name="prefix-sqlite" value="{{ $catalog->prefix }}" />
                                    @else
                                        <input type="text" class="form-control" name="prefix-sqlite" />
                                    @endif
                                    @if ($errors->has('prefix-sqlite'))

                                            {{ $errors->first('prefix-sqlite') }}

                                    @endif

                                <button type="submit" class="btn btn-flat btn-primary" style="margin-right: 10px;">Save</button>
                                <button type="submit" class="btn btn-flat btn-info" disabled> Test Connection</button>

                        </form>

                            <button class="btn btn-flat btn-danger" data-record-id="{{ $director->id }}" data-record-title="{{ $director->director_name }}" data-toggle="modal" data-target="#confirm-director-delete">Delete</button>

                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

Confirm Delete

You are about to delete {{ $director->director_name }}, this procedure is irreversible.

Do you want to proceed?

                                    <button type="button" class="btn btn-flat btn-default" data-dismiss="modal">Cancel</button>
                                    <button type="button" class="btn btn-flat btn-danger btn-ok">Delete</button>

@endsection