text:
<?php

namespace Oro\Bundle\SecurityBundle\Tests\Unit\Configuration;

use Oro\Bundle\SecurityBundle\Configuration\PermissionConfiguration;
use Symfony\Component\Config\Definition\Processor;

class PermissionConfigurationTest extends \PHPUnit\Framework\TestCase
{
    /**
     * @param array $configs
     *
     * @return array
     */
    private function processConfiguration(array $configs): array
    {
        $processor = new Processor();

        return $processor->processConfiguration(new PermissionConfiguration(), $configs);
    }

    /**
     * @param array $input
     * @param array $expected
     * @dataProvider processDataProvider
     */
    public function testProcess(array $input, array $expected): void
    {
        $this->assertEquals($expected, $this->processConfiguration([$input]));
    }

    /**
     * @return array
     */
    public function processDataProvider(): array
    {
        return [
            'permissions list 1' => [
                'input' => [
                    'permission1' => [],
                    'permission2' => [
                        'label' => 'My Label',
                        'group_names' => ['default', 'frontend', '', ''],
                    ],
                    'permission3' => [
                        'label' => 'Test Label',
                        'apply_to_all' => false,
                        'group_names' => 'frontend',
                        'exclude_entities' => ['Entity1'],
                        'apply_to_entities' => ['Entity2'],
                        'apply_to_interfaces' => ['Interface1'],
                        'description' => 'Test Description',
                    ],
                ],
                'expected' => [
                    'permission1' => [
                        'label' => 'permission1',
                        'apply_to_all' => true,
                        'group_names' => ['default'],
                        'exclude_entities' => [],
                        'apply_to_entities' => [],
                        'apply_to_interfaces' => [],
                    ],
                    'permission2' => [
                        'label' => 'My Label',
                        'apply_to_all' => true,
                        'group_names' => ['default', 'frontend'],
                        'exclude_entities' => [],
                        'apply_to_entities' => [],
                        'apply_to_interfaces' => [],
                    ],
                    'permission3' => [
                        'label' => 'Test Label',
                        'apply_to_all' => false,
                        'group_names' => ['frontend'],
                        'exclude_entities' => ['Entity1'],
                        'apply_to_entities' => ['Entity2'],
                        'description' => 'Test Description',
                        'apply_to_interfaces' => ['Interface1'],
                    ],
                ],
            ]
        ];
    }
}

redpajama_set_name: RedPajamaGithub


text:
/*!
 * @header IOCDBlockStorageDevice
 * @abstract
 * This header contains the IOCDBlockStorageDevice class definition.
 */

#ifndef _IOCDBLOCKSTORAGEDEVICE_H
#define _IOCDBLOCKSTORAGEDEVICE_H

#include <IOKit/storage/IOCDTypes.h>

/*!
 * @defined kIOCDBlockStorageDeviceClass
 * @abstract
 * kIOCDBlockStorageDeviceClass is the name of the IOCDBlockStorageDevice class.
 * @discussion
 * kIOCDBlockStorageDeviceClass is the name of the IOCDBlockStorageDevice class.
 */

#define kIOCDBlockStorageDeviceClass "IOCDBlockStorageDevice"

#endif /* !_IOCDBLOCKSTORAGEDEVICE_H */


text:
package session;

import java.util.List;

import javax.ejb.Remote;

import model.Rent;
import model.Vehicle;
import utils.CartItem;

@Remote
public interface UserSessionRemote {

	public void initialize(String token);
	public boolean connect(String username, String password);
	public void register(String username, String password, String email);
	public void addItemToCart(List<Vehicle> item, long start_date, long end_date);
	public void removeItemFromCart(int id);
	public void validateCart();
	public void emptyCart();
	public List<CartItem> displayCart();
	public List<Rent> displayRents();

}


text:
/*
 * $Id: TimeDatatypeValidator.cpp 471747 2006-11-06 14:31:56Z amassari $
 */

// ---------------------------------------------------------------------------
//  Includes
// ---------------------------------------------------------------------------
#include <xercesc/validators/datatype/TimeDatatypeValidator.hpp>
#include <xercesc/util/OutOfMemoryException.hpp>

XERCES_CPP_NAMESPACE_BEGIN

// ---------------------------------------------------------------------------
//  Constructors and Destructor
// ---------------------------------------------------------------------------
TimeDatatypeValidator::TimeDatatypeValidator(MemoryManager* const manager)
:DateTimeValidator(0, 0, 0, DatatypeValidator::Time, manager)
{
    setOrdered(XSSimpleTypeDefinition::ORDERED_PARTIAL);
}

TimeDatatypeValidator::TimeDatatypeValidator(
                          DatatypeValidator*            const baseValidator
                        , RefHashTableOf<KVStringPair>* const facets
                        , RefArrayVectorOf<XMLCh>*      const enums
                        , const int                           finalSet
                        , MemoryManager* const                manager)
:DateTimeValidator(baseValidator, facets, finalSet, DatatypeValidator::Time, manager)
{
    init(enums, manager);
}

TimeDatatypeValidator::~TimeDatatypeValidator()
{}

DatatypeValidator* TimeDatatypeValidator::newInstance
(
      RefHashTableOf<KVStringPair>* const facets
    , RefArrayVectorOf<XMLCh>* const      enums
    , const int                           finalSet
    , MemoryManager* const                manager
)
{
    return (DatatypeValidator*) new (manager) TimeDatatypeValidator(this, facets, enums, finalSet, manager);
}

//
// caller need to release the date created here
//
XMLDateTime* TimeDatatypeValidator::parse(const XMLCh* const content, MemoryManager* const manager)
{
    XMLDateTime *pRetDate = new (manager) XMLDateTime(content, manager);
    Janitor<XMLDateTime> jan(pRetDate);

    try
    {
        pRetDate->parseTime();
    }
    catch(const OutOfMemoryException&)
    {
        jan.release();

        throw;
    }

    return jan.release();
}

void TimeDatatypeValidator::parse(XMLDateTime* const pDate)
{
    pDate->parseTime();
}

const XMLCh* TimeDatatypeValidator::getCanonicalRepresentation(const XMLCh*         const rawData
                                                              ,      MemoryManager* const memMgr
                                                              ,      bool                 toValidate) const
{
    MemoryManager* toUse = memMgr? memMgr : fMemoryManager;

    if (toValidate)
    {
        TimeDatatypeValidator* temp = (TimeDatatypeValidator*) this;

        try
        {
            temp->checkContent(rawData, 0, false, toUse);
        }
        catch (...)
        {
            return 0;
        }
    }

    try
    {
        XMLDateTime aDateTime(rawData, toUse);
        aDateTime.parseTime();
        return aDateTime.getTimeCanonicalRepresentation(toUse);
    }
    catch (...)
    {
        return 0;
    }

}

/***
 * Support for Serialization/De-serialization
 ***/

IMPL_XSERIALIZABLE_TOCREATE(TimeDatatypeValidator)

void TimeDatatypeValidator::serialize(XSerializeEngine& serEng)
{
    DateTimeValidator::serialize(serEng);
}

XERCES_CPP_NAMESPACE_END

/**
  * End of file TimeDatatypeValidator::cpp
  */


text:
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace ShackBattles.account {

    public partial class Default {

        /// <summary>
        /// TextBoxGamerTag control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.TextBox TextBoxGamerTag;

        /// <summary>
        /// TextBoxPSN control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.TextBox TextBoxPSN;

        /// <summary>
        /// TextBoxNintendo control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.TextBox TextBoxNintendo;

        /// <summary>
        /// TextBoxBattleNet control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.TextBox TextBoxBattleNet;

        /// <summary>
        /// TextBoxSteam control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.TextBox TextBoxSteam;

        /// <summary>
        /// TextBoxOrigin control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.TextBox TextBoxOrigin;

        /// <summary>
        /// UserControlShackTags control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::ShackBattles.Webcontrols.ShackTags UserControlShackTags;

        /// <summary>
        /// TextBoxBio control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.TextBox TextBoxBio;

        /// <summary>
        /// ButtonSubmit control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Button ButtonSubmit;

        /// <summary>
        /// RepeaterPreviousBattles control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Repeater RepeaterPreviousBattles;
    }
}


text:
#ifndef _CMAKESETUPFRAME_H_
#define _CMAKESETUPFRAME_H_

#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "CMakeSetupFrame.cpp"
#endif

/*!
 * Includes
 */

////@begin includes
#include "wx/frame.h"
#include "wx/splitter.h"
#include "wx/grid.h"
#include "wx/statline.h"
#include "wx/statusbr.h"
////@end includes

#include <wx/config.h>
#include <wx/dataobj.h>
#include <wx/dnd.h>

#include "../cmake.h"
#include "progressdlg.h"
#include "optionsdlg.h"
#include "CommandLineInfo.h"
#include "config.h"

// this ID should be taken as base to make sure they are unique
// NOTE: DialogBlocks starts at 10100 so 10000 to 10099 are free
#define CM_NEXT_USABLEID      CM_RECENT_BUILD_ITEM + CM_MAX_RECENT_PATHS

/*!
 * Forward declarations
 */

////@begin forward declarations
class wxSplitterWindow;
class wxPropertyList;
////@end forward declarations

/*!
 * Control identifiers
 */

////@begin control identifiers
#define ID_FRAME 10100
#define SYMBOL_CMAKESETUPFRM_STYLE wxDEFAULT_FRAME_STYLE|wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxCLOSE_BOX|wxSUNKEN_BORDER
#define SYMBOL_CMAKESETUPFRM_TITLE _("CMake Setup v2.0.x")
#define SYMBOL_CMAKESETUPFRM_IDNAME ID_FRAME
#define SYMBOL_CMAKESETUPFRM_SIZE wxSize(600, 550)
#define SYMBOL_CMAKESETUPFRM_POSITION wxDefaultPosition
#define ID_SPLITTERWINDOW 10101
#define ID_MAINPANEL 10102
#define ID_PROJECT_PATH 10103
#define ID_BROWSE_PROJECT 10104
#define ID_SOURCE_BUILD_PATH 10105
#define ID_BROWSE_BUILD 10106
#define ID_CHOOSE_GENERATOR 10107
#define ID_SEARCHQUERY 10109
#define ID_SHOW_ADVANCED 10108
#define ID_OPTIONS 10110
#define ID_LOGPANEL 10111
#define ID_LOG_AREA 10112
#define ID_DESCRIPTION 10113
#define ID_DO_CONFIGURE 10114
#define ID_DO_OK 10115
#define ID_DO_CANCEL 10116
#define ID_DO_DELETE_CACHE 10117
#define ID_CLEAR_LOG 10118
#define ID_BROWSE_GRID 10119
#define ID_STATUSBAR 10120
#define ID_MENU_RELOAD_CACHE 10122
#define ID_MENU_DELETE_CACHE 10123
#define ID_MENU_QUIT 10125
#define ID_MENU_CONFIGURE 10126
#define ID_MENU_EXITGENERATE 10127
#define ID_MENU_TOGGLE_ADVANCED 10128
#define ID_CMAKE_OPTIONS 10124
#define ID_ABOUTDLG 10121
////@end control identifiers

/*!
 * Compatibility
 */

#ifndef wxCLOSE_BOX
#define wxCLOSE_BOX 0x1000
#endif
#ifndef wxFIXED_MINSIZE
#define wxFIXED_MINSIZE 0
#endif

class DnDFile : public wxFileDropTarget
{
public:
    DnDFile(wxTextCtrl *pOwner)
        : m_pOwner(pOwner)
    {
    };

    virtual bool OnDropFiles(wxCoord x, wxCoord y,
                             const wxArrayString& filenames);

private:
    wxTextCtrl *m_pOwner;
};

/*!
 * CMakeSetupFrm class declaration
 */

class CMakeSetupFrm: public wxFrame
{
    DECLARE_CLASS( CMakeSetupFrm )
    DECLARE_EVENT_TABLE()

public:
    /// Constructors
    CMakeSetupFrm( );
    CMakeSetupFrm( wxWindow* parent, wxWindowID id = SYMBOL_CMAKESETUPFRM_IDNAME, const wxString& caption = SYMBOL_CMAKESETUPFRM_TITLE, const wxPoint& pos = SYMBOL_CMAKESETUPFRM_POSITION, const wxSize& size = SYMBOL_CMAKESETUPFRM_SIZE, long style = SYMBOL_CMAKESETUPFRM_STYLE );

    // Destructor
    virtual ~CMakeSetupFrm();

    bool Create( wxWindow* parent, wxWindowID id = SYMBOL_CMAKESETUPFRM_IDNAME, const wxString& caption = SYMBOL_CMAKESETUPFRM_TITLE, const wxPoint& pos = SYMBOL_CMAKESETUPFRM_POSITION, const wxSize& size = SYMBOL_CMAKESETUPFRM_SIZE, long style = SYMBOL_CMAKESETUPFRM_STYLE );

    /// Creates the controls and sizers
    void CreateControls();

    /** Logs a message. For the kind parameter use;
        1  - neutral message
        0  - warning message (blue text)
        -1 - error message (red text)
    */
    void LogMessage(int logkind, const char *msg);

    void UpdateProgress(float progress) {
        if(m_progressDlg)
            m_progressDlg->SetProgress(progress);

        // also show in the tiny field
        wxStatusBar *bar = GetStatusBar();
        if(bar)
        {
            wxString str;
            str.Printf("%2.1f %%", (progress * 100));
            bar->SetStatusText(str, 1);
        }
    };

    void IssueUpdate();

    /** Initialise all crap in the frame, like listing the make generators,
        selecting the best one to use, and loading the cache for the first time
        when the build paths were set */
    void DoInitFrame(cmCommandLineInfo &cm, const wxString &fn);

////@begin CMakeSetupFrm event handler declarations

    /// wxEVT_CLOSE_WINDOW event handler for ID_FRAME
    void OnCloseWindow( wxCloseEvent& event );

    /// wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING event handler for ID_SPLITTERWINDOW
    void OnSplitterPosChanging( wxSplitterEvent& event );

    /// wxEVT_COMMAND_SPLITTER_DOUBLECLICKED event handler for ID_SPLITTERWINDOW
    void OnSplitterwindowSashDClick( wxSplitterEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BROWSE_PROJECT
    void OnButtonBrowseProject( wxCommandEvent& event );

    /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_SOURCE_BUILD_PATH
    void OnSourceBuildPathUpdated( wxCommandEvent& event );

    /// wxEVT_COMMAND_TEXT_ENTER event handler for ID_SOURCE_BUILD_PATH
    void OnSourceBuildPathEnter( wxCommandEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BROWSE_BUILD
    void OnButtonBrowseBuild( wxCommandEvent& event );

    /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_SEARCHQUERY
    void OnSearchquerySelected( wxCommandEvent& event );

    /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_SEARCHQUERY
    void OnSearchqueryUpdated( wxCommandEvent& event );

    /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_SHOW_ADVANCED
    void OnShowAdvancedValues( wxCommandEvent& event );

    /// wxEVT_GRID_CELL_CHANGE event handler for ID_OPTIONS
    void OnCellChange( wxGridEvent& event );

    /// wxEVT_GRID_SELECT_CELL event handler for ID_OPTIONS
    void OnGridSelectCell( wxGridEvent& event );

    /// wxEVT_MOTION event handler for ID_OPTIONS
    void OnPropertyMotion( wxMouseEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DO_CONFIGURE
    void OnButtonConfigure( wxCommandEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DO_OK
    void OnButtonOk( wxCommandEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DO_CANCEL
    void OnButtonCancel( wxCommandEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DO_DELETE_CACHE
    void OnButtonDeleteCache( wxCommandEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_CLEAR_LOG
    void OnClearLogClick( wxCommandEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BROWSE_GRID
    void OnBrowseGridClick( wxCommandEvent& event );

    /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_MENU_RELOAD_CACHE
    void OnMenuReloadCacheClick( wxCommandEvent& event );

    /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_MENU_DELETE_CACHE
    void OnMenuDeleteCacheClick( wxCommandEvent& event );

    /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_MENU_QUIT
    void OnMenuQuitClick( wxCommandEvent& event );

    /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_MENU_CONFIGURE
    void OnMenuConfigureClick( wxCommandEvent& event );

    /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_MENU_EXITGENERATE
    void OnMenuGenerateClick( wxCommandEvent& event );

    /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_MENU_TOGGLE_ADVANCED
    void OnMenuToggleAdvancedClick( wxCommandEvent& event );

    /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_CMAKE_OPTIONS
    void OnOptionsClick( wxCommandEvent& event );

    /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_ABOUTDLG
    void OnAboutClick( wxCommandEvent& event );

////@end CMakeSetupFrm event handler declarations

    void OnRecentFileMenu( wxCommandEvent &event );

    void OnAddQuery ( wxCommandEvent &event );

////@begin CMakeSetupFrm member function declarations

    /// Retrieves bitmap resources
    wxBitmap GetBitmapResource( const wxString& name );

    /// Retrieves icon resources
    wxIcon GetIconResource( const wxString& name );
////@end CMakeSetupFrm member function declarations

    /// Should we show tooltips?
    static bool ShowToolTips();

        /** Load cache for the CMakeLists to the GUI */
    void LoadCacheFromDiskToGUI();

    /** Display the grid with the loaded cache. */
    void FillCacheGUIFromCacheManager();

    int RunCMake(bool generateProjectFiles);

    /** Save cache to disk from the GUI */
    void SaveCacheFromGUI();

    void FillCacheManagerFromCacheGUI();

    /** Update the cache and mark all the new items as old */
    bool PerformCacheRun();

    /** Shows the property matched by the row in the description area
        or nothing when the row is not correct */
    void ShowPropertyDescription(int row);

    /** Disable or enable controls based upon the internal state of the
        program */
    void UpdateWindowState();

    void AppendPathToRecentList(const wxString &p);

    /** Used to synchonise any options that have immediate effect on the GUI
        form, like clearing a search list, resetting a spitter perhaps, etc */
    void SyncFormOptions(CMOptionsDlg *dlg);

    void DoCancelButton();

    void DoReloadCache();

    void DoDeleteCache();

    void DoConfigure();

    void DoGenerate();

    void OnExitTimer(wxTimerEvent &event);

////@begin CMakeSetupFrm member variables
    wxSplitterWindow* m_splitter;
    wxTextCtrl* m_cmProjectPath;
    wxButton* m_BrowseProjectPathButton;
    wxTextCtrl* m_cmBuildPath;
    wxButton* m_BrowseSourcePathButton;
    wxComboBox* m_cmGeneratorChoice;
    wxComboBox* m_cmSearchQuery;
    wxCheckBox* m_cmShowAdvanced;
    wxPropertyList* m_cmOptions;
    wxTextCtrl* m_cmLog;
    wxTextCtrl* m_cmDescription;
    wxButton* m_ConfigureButton;
    wxButton* m_OkButton;
    wxButton* m_CancelButton;
    wxButton* m_DeleteCacheButton;
    wxButton* m_ClearLogButton;
    wxButton* m_cmBrowseCell;
////@end CMakeSetupFrm member variables

    // this is the cmake instance with which we will communicate
    // to generate our stuff, and get the info from.
    cmake *m_cmake;

    // the config class for project build dir and source path
    wxTimer *m_ExitTimer;
    wxConfig *m_config;
    wxString m_PathToExecutable;
    wxArrayString m_recentPaths;
    CMProgressDialog *m_progressDlg;
    bool m_RunningConfigure;
    bool m_noRefresh;
    bool m_quitAfterGenerating;
};

#endif
    // _CMAKESETUPFRAME_H_


text:
title: "Quick Start"
description: "Quick start documentation for Sensu."
product: "Sensu Core"
version: "1.4"
weight: 10
layout: "base-for-directory-listing"
menu:
  sensu-core-1.4:
    identifier: quick-start
---

{{< directoryListing >}}


text:
/* @flow */

import React from 'react';

import {
  Platform,
  StyleSheet,
  Text,
} from 'react-native';

import type {
  Style,
} from '../TypeDefinition';

type Props = {
  tintColor?: ?string;
  style?: Style,
};

const HeaderTitle = ({ style, ...rest }: Props) => (
  <Text numberOfLines={1} {...rest} style={[styles.title, style]} />
);

const styles = StyleSheet.create({
  title: {
    fontSize: Platform.OS === 'ios' ? 17 : 18,
    fontWeight: Platform.OS === 'ios' ? '600' : '500',
    color: 'rgba(0, 0, 0, .9)',
    textAlign: Platform.OS === 'ios' ? 'center' : 'left',
    marginHorizontal: 16,
  },
});

HeaderTitle.propTypes = {
  style: Text.propTypes.style,
};

export default HeaderTitle;


text:
'use strict'

// This snapshot test serves as a reminder to update all usages of
// event names whenever any name is updated.
const events = require('../events')

/* globals test, expect */
test('event names have not changed', () => {
  expect(events).toMatchSnapshot()
})


text:
Cover

nakDS

Easy and beautiful

    <button class="nk-button nk-button--color nk-mtx">Try now</button>


text:
/*global describe, it, before */

"use strict";

var buster = require("buster");
var RUList = require("../lib/RUList");

buster.spec.expose();
var expect = buster.expect;

describe("Recently-Used List", function() {
    before(function() {
        this.list = new RUList();
    });

    it("is initially empty", function() {
        expect(this.list.length).toEqual(0);
    });

    it("adds items in reverse order", function() {
        this.list.add('one');
        this.list.add('two');

        expect(this.list.get(0)).toEqual('two');
    });

    it("doesn't repeat items", function() {
	this.list.add('item');
	this.list.add('item');
        expect(this.list.length).toEqual(1);
    });

    it("list max size is 10", function() {
	for (var i = 0, len = 11; i < len; i++) {
	    this.list.add('item' + i);
	}
        expect(this.list.length).toEqual(10);
    });

    it("oldest item is removed", function() {
	for (var i = 0, len = 10; i < len; i++) {
	    this.list.add('item' + i);
	}
	this.list.add('item10');
        expect(this.list.get(this.list.length-1)).toEqual('item1');
    });

     it("add repeated item as most recent", function() {
        this.list.add('one');
        this.list.add('two');
	this.list.add('one');

        expect(this.list.get(this.list.length-1)).toEqual('one');
    });

});


text:
using storage::FileSystemURL;

namespace sync_file_system {

namespace {

void WriteCallbackAdapter(
    const SyncableFileSystemOperation::WriteCallback& callback,
    base::File::Error status) {
  callback.Run(status, 0, true);
}

}  // namespace

class SyncableFileSystemOperation::QueueableTask
    : public SyncableFileOperationRunner::Task {
 public:
  QueueableTask(base::WeakPtr<SyncableFileSystemOperation> operation,
                const base::Closure& task)
      : operation_(operation),
        task_(task),
        target_paths_(operation->target_paths_) {}

  ~QueueableTask() override { DCHECK(!operation_); }

  void Run() override {
    if (!operation_)
      return;
    DCHECK(!task_.is_null());
    task_.Run();
    operation_.reset();
  }

  void Cancel() override {
    DCHECK(!task_.is_null());
    if (operation_)
      operation_->OnCancelled();
    task_.Reset();
    operation_.reset();
  }

  const std::vector<FileSystemURL>& target_paths() const override {
    return target_paths_;
  }

 private:
  base::WeakPtr<SyncableFileSystemOperation> operation_;
  base::Closure task_;
  std::vector<FileSystemURL> target_paths_;
  DISALLOW_COPY_AND_ASSIGN(QueueableTask);
};

SyncableFileSystemOperation::~SyncableFileSystemOperation() {}

void SyncableFileSystemOperation::CreateFile(
    const FileSystemURL& url,
    bool exclusive,
    const StatusCallback& callback) {
  DCHECK(CalledOnValidThread());
  if (!operation_runner_.get()) {
    callback.Run(base::File::FILE_ERROR_NOT_FOUND);
    return;
  }
  DCHECK(operation_runner_.get());
  target_paths_.push_back(url);
  completion_callback_ = callback;
  scoped_ptr<SyncableFileOperationRunner::Task> task(new QueueableTask(
      weak_factory_.GetWeakPtr(),
      base::Bind(&FileSystemOperation::CreateFile,
                 base::Unretained(impl_.get()),
                 url, exclusive,
                 base::Bind(&self::DidFinish, weak_factory_.GetWeakPtr()))));
  operation_runner_->PostOperationTask(task.Pass());
}

void SyncableFileSystemOperation::CreateDirectory(
    const FileSystemURL& url,
    bool exclusive,
    bool recursive,
    const StatusCallback& callback) {
  DCHECK(CalledOnValidThread());
  if (!operation_runner_.get()) {
    callback.Run(base::File::FILE_ERROR_NOT_FOUND);
    return;
  }
  DCHECK(operation_runner_.get());
  target_paths_.push_back(url);
  completion_callback_ = callback;
  scoped_ptr<SyncableFileOperationRunner::Task> task(new QueueableTask(
      weak_factory_.GetWeakPtr(),
      base::Bind(&FileSystemOperation::CreateDirectory,
                 base::Unretained(impl_.get()),
                 url, exclusive, recursive,
                 base::Bind(&self::DidFinish, weak_factory_.GetWeakPtr()))));
  operation_runner_->PostOperationTask(task.Pass());
}

void SyncableFileSystemOperation::Copy(
    const FileSystemURL& src_url,
    const FileSystemURL& dest_url,
    CopyOrMoveOption option,
    const CopyProgressCallback& progress_callback,
    const StatusCallback& callback) {
  DCHECK(CalledOnValidThread());
  if (!operation_runner_.get()) {
    callback.Run(base::File::FILE_ERROR_NOT_FOUND);
    return;
  }
  DCHECK(operation_runner_.get());
  target_paths_.push_back(dest_url);
  completion_callback_ = callback;
  scoped_ptr<SyncableFileOperationRunner::Task> task(new QueueableTask(
      weak_factory_.GetWeakPtr(),
      base::Bind(&FileSystemOperation::Copy,
                 base::Unretained(impl_.get()),
                 src_url, dest_url, option, progress_callback,
                 base::Bind(&self::DidFinish, weak_factory_.GetWeakPtr()))));
  operation_runner_->PostOperationTask(task.Pass());
}

void SyncableFileSystemOperation::Move(
    const FileSystemURL& src_url,
    const FileSystemURL& dest_url,
    CopyOrMoveOption option,
    const StatusCallback& callback) {
  DCHECK(CalledOnValidThread());
  if (!operation_runner_.get()) {
    callback.Run(base::File::FILE_ERROR_NOT_FOUND);
    return;
  }
  DCHECK(operation_runner_.get());
  target_paths_.push_back(src_url);
  target_paths_.push_back(dest_url);
  completion_callback_ = callback;
  scoped_ptr<SyncableFileOperationRunner::Task> task(new QueueableTask(
      weak_factory_.GetWeakPtr(),
      base::Bind(&FileSystemOperation::Move,
                 base::Unretained(impl_.get()),
                 src_url, dest_url, option,
                 base::Bind(&self::DidFinish, weak_factory_.GetWeakPtr()))));
  operation_runner_->PostOperationTask(task.Pass());
}

void SyncableFileSystemOperation::DirectoryExists(
    const FileSystemURL& url,
    const StatusCallback& callback) {
  DCHECK(CalledOnValidThread());
  impl_->DirectoryExists(url, callback);
}

void SyncableFileSystemOperation::FileExists(
    const FileSystemURL& url,
    const StatusCallback& callback) {
  DCHECK(CalledOnValidThread());
  impl_->FileExists(url, callback);
}

void SyncableFileSystemOperation::GetMetadata(
    const FileSystemURL& url,
    const GetMetadataCallback& callback) {
  DCHECK(CalledOnValidThread());
  impl_->GetMetadata(url, callback);
}

void SyncableFileSystemOperation::ReadDirectory(
    const FileSystemURL& url,
    const ReadDirectoryCallback& callback) {
  DCHECK(CalledOnValidThread());
  // This is a read operation and there'd be no hard to let it go even if
  // directory operation is disabled. (And we should allow this if it's made
  // on the root directory)
  impl_->ReadDirectory(url, callback);
}

void SyncableFileSystemOperation::Remove(
    const FileSystemURL& url, bool recursive,
    const StatusCallback& callback) {
  DCHECK(CalledOnValidThread());
  if (!operation_runner_.get()) {
    callback.Run(base::File::FILE_ERROR_NOT_FOUND);
    return;
  }
  DCHECK(operation_runner_.get());
  target_paths_.push_back(url);
  completion_callback_ = callback;
  scoped_ptr<SyncableFileOperationRunner::Task> task(new QueueableTask(
      weak_factory_.GetWeakPtr(),
      base::Bind(&FileSystemOperation::Remove,
                 base::Unretained(impl_.get()),
                 url, recursive,
                 base::Bind(&self::DidFinish, weak_factory_.GetWeakPtr()))));
  operation_runner_->PostOperationTask(task.Pass());
}

void SyncableFileSystemOperation::Write(
    const FileSystemURL& url,
    scoped_ptr<storage::FileWriterDelegate> writer_delegate,
    scoped_ptr<net::URLRequest> blob_request,
    const WriteCallback& callback) {
  DCHECK(CalledOnValidThread());
  if (!operation_runner_.get()) {
    callback.Run(base::File::FILE_ERROR_NOT_FOUND, 0, true);
    return;
  }
  DCHECK(operation_runner_.get());
  target_paths_.push_back(url);
  completion_callback_ = base::Bind(&WriteCallbackAdapter, callback);
  scoped_ptr<SyncableFileOperationRunner::Task> task(new QueueableTask(
      weak_factory_.GetWeakPtr(),
      base::Bind(&FileSystemOperation::Write,
                 base::Unretained(impl_.get()),
                 url,
                 base::Passed(&writer_delegate),
                 base::Passed(&blob_request),
                 base::Bind(&self::DidWrite, weak_factory_.GetWeakPtr(),
                            callback))));
  operation_runner_->PostOperationTask(task.Pass());
}

void SyncableFileSystemOperation::Truncate(
    const FileSystemURL& url, int64 length,
    const StatusCallback& callback) {
  DCHECK(CalledOnValidThread());
  if (!operation_runner_.get()) {
    callback.Run(base::File::FILE_ERROR_NOT_FOUND);
    return;
  }
  DCHECK(operation_runner_.get());
  target_paths_.push_back(url);
  completion_callback_ = callback;
  scoped_ptr<SyncableFileOperationRunner::Task> task(new QueueableTask(
      weak_factory_.GetWeakPtr(),
      base::Bind(&FileSystemOperation::Truncate,
                 base::Unretained(impl_.get()),
                 url, length,
                 base::Bind(&self::DidFinish, weak_factory_.GetWeakPtr()))));
  operation_runner_->PostOperationTask(task.Pass());
}

void SyncableFileSystemOperation::TouchFile(
    const FileSystemURL& url,
    const base::Time& last_access_time,
    const base::Time& last_modified_time,
    const StatusCallback& callback) {
  DCHECK(CalledOnValidThread());
  impl_->TouchFile(url, last_access_time, last_modified_time, callback);
}

void SyncableFileSystemOperation::OpenFile(
    const FileSystemURL& url,
    int file_flags,
    const OpenFileCallback& callback) {
  NOTREACHED();
}

void SyncableFileSystemOperation::Cancel(
    const StatusCallback& cancel_callback) {
  DCHECK(CalledOnValidThread());
  impl_->Cancel(cancel_callback);
}

void SyncableFileSystemOperation::CreateSnapshotFile(
    const FileSystemURL& path,
    const SnapshotFileCallback& callback) {
  DCHECK(CalledOnValidThread());
  impl_->CreateSnapshotFile(path, callback);
}

void SyncableFileSystemOperation::CopyInForeignFile(
    const base::FilePath& src_local_disk_path,
    const FileSystemURL& dest_url,
    const StatusCallback& callback) {
  DCHECK(CalledOnValidThread());
  if (!operation_runner_.get()) {
    callback.Run(base::File::FILE_ERROR_NOT_FOUND);
    return;
  }
  DCHECK(operation_runner_.get());
  target_paths_.push_back(dest_url);
  completion_callback_ = callback;
  scoped_ptr<SyncableFileOperationRunner::Task> task(new QueueableTask(
      weak_factory_.GetWeakPtr(),
      base::Bind(&FileSystemOperation::CopyInForeignFile,
                 base::Unretained(impl_.get()),
                 src_local_disk_path, dest_url,
                 base::Bind(&self::DidFinish, weak_factory_.GetWeakPtr()))));
  operation_runner_->PostOperationTask(task.Pass());
}

void SyncableFileSystemOperation::RemoveFile(
    const FileSystemURL& url,
    const StatusCallback& callback) {
  DCHECK(CalledOnValidThread());
  impl_->RemoveFile(url, callback);
}

void SyncableFileSystemOperation::RemoveDirectory(
    const FileSystemURL& url,
    const StatusCallback& callback) {
  DCHECK(CalledOnValidThread());
  impl_->RemoveDirectory(url, callback);
}

void SyncableFileSystemOperation::CopyFileLocal(
    const FileSystemURL& src_url,
    const FileSystemURL& dest_url,
    CopyOrMoveOption option,
    const CopyFileProgressCallback& progress_callback,
    const StatusCallback& callback) {
  DCHECK(CalledOnValidThread());
  impl_->CopyFileLocal(src_url, dest_url, option, progress_callback, callback);
}

void SyncableFileSystemOperation::MoveFileLocal(
    const FileSystemURL& src_url,
    const FileSystemURL& dest_url,
    CopyOrMoveOption option,
    const StatusCallback& callback) {
  DCHECK(CalledOnValidThread());
  impl_->MoveFileLocal(src_url, dest_url, option, callback);
}

base::File::Error SyncableFileSystemOperation::SyncGetPlatformPath(
    const FileSystemURL& url,
    base::FilePath* platform_path) {
  return impl_->SyncGetPlatformPath(url, platform_path);
}

SyncableFileSystemOperation::SyncableFileSystemOperation(
    const FileSystemURL& url,
    storage::FileSystemContext* file_system_context,
    scoped_ptr<storage::FileSystemOperationContext> operation_context)
    : url_(url), weak_factory_(this) {
  DCHECK(file_system_context);
  SyncFileSystemBackend* backend =
      SyncFileSystemBackend::GetBackend(file_system_context);
  DCHECK(backend);
  if (!backend->sync_context()) {
    // Syncable FileSystem is opened in a file system context which doesn't
    // support (or is not initialized for) the API.
    // Returning here to leave operation_runner_ as NULL.
    return;
  }
  impl_.reset(storage::FileSystemOperation::Create(
      url_, file_system_context, operation_context.Pass()));
  operation_runner_ = backend->sync_context()->operation_runner();
}

void SyncableFileSystemOperation::DidFinish(base::File::Error status) {
  DCHECK(CalledOnValidThread());
  DCHECK(!completion_callback_.is_null());
  if (operation_runner_.get())
    operation_runner_->OnOperationCompleted(target_paths_);
  completion_callback_.Run(status);
}

void SyncableFileSystemOperation::DidWrite(
    const WriteCallback& callback,
    base::File::Error result,
    int64 bytes,
    bool complete) {
  DCHECK(CalledOnValidThread());
  if (!complete) {
    callback.Run(result, bytes, complete);
    return;
  }
  if (operation_runner_.get())
    operation_runner_->OnOperationCompleted(target_paths_);
  callback.Run(result, bytes, complete);
}

void SyncableFileSystemOperation::OnCancelled() {
  DCHECK(!completion_callback_.is_null());
  completion_callback_.Run(base::File::FILE_ERROR_ABORT);
}

}  // namespace sync_file_system


text:
@implementation Stats

- (void)report:(BOOL)right
{
	if (right) {
		currentStatus = RIGHT;
		countRight += (countWrong > 0 ? 1 : 2);
		countWrong = 0;
	} else {
		currentStatus = WRONG;
		countWrong ++;
		countRight = 0;
	}
}

- (NSString *)smiley
{
	NSString *ret = @"neutral.png";
	if (currentStatus == RIGHT) {
		ret = countRight > 1 ? @"right.png" : @"neutral.png";
	} else if (currentStatus == WRONG) {
		ret = countWrong <= 1 ? @"wrong.png" : @"terrible.png";
	}
	return ret;
}

@end


text:
package cn.com.newcapec.citycard.common.action;

import java.text.DecimalFormat;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.ServletActionContext;

import cn.com.newcapec.common.domain.NameValue;
import cn.com.newcapec.common.exception.BusinessException;
import cn.com.newcapec.common.util.BaseDataHelper;
import cn.com.newcapec.common.util.HttpServletHelper;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import cn.com.newcapec.citycard.common.po.TLog;
import cn.com.newcapec.citycard.common.service.ICommonService;
import cn.com.newcapec.citycard.system.service.ITLogService;

/**
 *

 * 功能描述:项目公共Action
 *
 * Author : Wangjian
 * Date   : 2008-05-08
 * Time   : 14:47:15
 * Version: 1.0
 *

 */
public class CommonAction extends ActionSupport{
	private static final long serialVersionUID = -8235898437446285705L;
	protected final Log log = LogFactory.getLog(this.getClass());
	protected ICommonService commonService;//项目公共服务接口
	protected String prompt;//提示
	protected Integer orderNo;//排序号
	protected String act;//动作,添加、删除(add、update)

	//数字格式化
	public String formatDouble(double s) {
		DecimalFormat fmt = new DecimalFormat("##0.00");
		return fmt.format(s);
	}
	public void setCommonService(ICommonService commonService){
		this.commonService = commonService;
	}

	public String getPrompt(){
		return prompt;
	}

	public void setPrompt(String prompt){
		this.prompt = prompt;
	}

	public String getAct() {
		return act;
	}

	public void setAct(String act) {
		this.act = act;
	}

	public Integer getOrderNo(){
		return orderNo;
	}

	/**
	 *

	 * 功能描述:设置下一个排序号
	 *
	 * @param cls 持久化实体类
	 *

	 */
	protected void setNextOrderNo(Class cls){
		orderNo=commonService.getNextOrderNo(cls);
	}

	/**
	 * id集合,用以处理列表的多条更新时候用到
	 * */
	protected List<Integer> id;
	public List<Integer> getId() {
		return id;
	}
	public void setId(List<Integer> id) {
		this.id = id;
	}

	/**
	 *

	 * 功能描述:执行假删除若干条记录
	 * @author Wangjian
	 * @param cls 		持久化实体类
	 * @param idList	id集合
	 * @return
	 *

	 */
	protected void delFlagRecords(Class cls){
		commonService.removeRecords(cls, id);
	}

	/**
	 *

	 * 功能描述:执行删除若干条记录,根据主键集合
	 * @author Wangjian
	 * @param cls 		持久化实体类
	 * @param idList	id集合
	 * @return
	 *

	 */
	protected void delRecordsByPK(Class cls){
		commonService.delRecords(cls, id,null);
	}

	/**
	 *

	 * 功能描述:执行删除若干条记录,根据指定的字段及集合
	 * @author Wangjian
	 * @param cls 		持久化实体类
	 * @param idList	id集合
	 * @return
	 *

	 */
	protected void delRecords(Class cls,List values,String columnName){
		commonService.delRecords(cls, values, columnName);
	}
	/**
	 *

	 * 获取Request对象
	 * @author Wangjian
	 * @return	HttpServletRequest
	 *

	 */
	protected HttpServletRequest getRequest(){
		return HttpServletHelper.getRequest(ActionContext.getContext());
	}

	/**
	 *

	 * 获取Session对象
	 * @author Wangjian
	 * @return	HttpSession
	 *

	 */
	protected HttpSession getSession(){
		return HttpServletHelper.getSession(ActionContext.getContext());
	}

	/**
	 *

	 * 获取Request中的参数值
	 * @author Wangjian
	 * @param para
	 * @return
	 * String
	 *

	 */
	protected String getParameter(String para){
		return HttpServletHelper.getReqyestParameter(ActionContext.getContext(),para);
	}

	/**
	 * 向session设置值
	 * @param key
	 * @param value
	 * void
	 *
	 */
	protected void setSessionValue(String key,String value){
		HttpServletHelper.setSessionValue(ActionContext.getContext(), key, value);
	}

	/**
	 * 获取session中的参数值
	 * @param key
	 * @return
	 * String
	 *
	 */
	protected String getSessionValue(String key){
		return (String)HttpServletHelper.getSessionValue(ActionContext.getContext(), key);
	}

	protected BaseDataHelper logAction;						//日志动作类型
    protected BaseDataHelper logModule;						//日志模块类型
    protected TLog logInfo;								//日志po
    protected ITLogService logInfoService;				//日志service
	/**
	 * @return the logActionHelper
	 */
	public BaseDataHelper getLogAction() {
		return logAction;
	}

	/**
	 * @param logActionHelper the logActionHelper to set
	 */
	public void setLogAction(BaseDataHelper logAction) {
		this.logAction = logAction;
	}

	/**
	 * @return the logModule
	 */
	public BaseDataHelper getLogModule() {
		return logModule;
	}

	/**
	 * @param logModule the logModule to set
	 */
	public void setLogModule(BaseDataHelper logModule) {
		this.logModule = logModule;
	}

	/**
	 * @return the logInfo
	 */
	public TLog getTLog() {
		return logInfo;
	}

	/**
	 * @param logInfo the logInfo to set
	 */
	public void setTLog(TLog logInfo) {
		this.logInfo = logInfo;
	}

	/**
	 * @return the logInfoService
	 */
	public ITLogService getTLogService() {
		return logInfoService;
	}

	/**
	 * @param logInfoService the logInfoService to set
	 */
	public void setTLogService(ITLogService logInfoService) {
		this.logInfoService = logInfoService;
	}

	/**
	 * 功能描述:根据PK得到Obj
	 * @param id 	PK
	 *
	 */
	public Object getObjByPk(Class cls,Integer id) throws BusinessException{
		return commonService.getObj(cls, id);
	}

	/**
	 * 查找指定的Object数量
	 *
	 * @param cls			对象实例Class
	 * @param attrColl		属性键值对集合
	 * @return integer		对象数量
	 */
	public Integer getObjCount(Class cls,NameValue[] attrColl){
		return commonService.getObjCountByAttr(cls, attrColl);
	}

	/**
	 * 查找指定的Object列表
	 * @param cls			对象实例Class
	 * @param attrColl		属性键值对集合
	 * @return List 		根据给定的属性返回当前列表
	 */
	public List getObjList(Class cls,NameValue[] attrColl) {
		return commonService.getObjListByAttr(cls, attrColl);
	}

	/**
	 * 查找指定的Object分页列表
	 * @param cls			对象实例Class
	 * @param attrColl		属性键值对集合
	 * @return List 		根据给定的属性返回当前分页列表
	 */
	public List getObjPaginationList(Class cls,NameValue[] attrColl, int firstResult, int maxResults) {
		return commonService.getObjPaginationListByAttr(cls, attrColl, firstResult, maxResults);
	}

	/**
	 * 保存Object
	 *
	 * @param	obj			Object
	 * @return
	 * @throws Exception
	 */
	public void saveObj(Object obj)throws Exception{
		commonService.saveObj(obj);
	}

	/**
	 * 修改Object
	 *
	 * @param	obj			Object
	 * @return
	 * @throws Exception
	 */
	public void updateObj(Object obj)throws Exception{
		commonService.updateObj(obj);
	}
}


text:
A simple Unity project template for viewing photospheres / 360-degree photos using Google VR (aka Cardboard) devices.

There are three methods demonstrated here:

  1. Use of a double sided unlit shader so that both sides of the sphere are visible.

  2. Use of a sphere mesh with the normals flipped so that the mesh is visible from inside the sphere.

  3. Use a standard Unity skybox with the photo imported as a "Latitude-Longitude Layout (Cylindrical)" mapped texture.

## Getting started

Download and import the [Unity package of this project](https://github.com/omgwtfgames/unity-cardboard-photosphere/raw/master/unity-cardboard-photosphere.unitypackage), or clone this git repo.

The [Google VR plugin for Unity](https://github.com/googlevr/gvr-unity-sdk) (v0.8.5) is included - if you want to update to different version, delete the `GoogleVR` and `Plugins` folders and import the new version.

The default Unity Sphere primitive is UV mapped with an equirectangular projection, so most common photospheres should work. When adding your own photosphere textures, make sure you set the import size of the image as high as possible (8192). Ensure that the Tiling X value is -1 on the Material, otherwise your image will be a horizontal mirror image.

There are also some examples of stereo 3D photospheres (eg two spheres, use Layers so left/right cameras only see one sphere).

## Some details

The Gvr prefabs used in these scenes have some small changes to the default settings:

  * On GvrHead, Track Position is turned off (we only want rotation)
  * On StereoController, we reduce Stereo Multiplier to zero (this makes both eyes see the same image for monoscopic photos, and for stereoscopic photos we don't want any eye separation in Unity's 3D space since the left and right image already have a stereo offset).
  * The Camera Far Clipping Plane is set to 1000, and the Sphere has a radius of 999 - this means that the inside of the sphere will be distant, so even if Stereo Multiplier is non-zero there should be no detectable stereo parallax.
  * A custom version of GvrEye.cs is included which allows a different skybox to be assigned to each eye.

## Changelog

**7-May-2016** - Updated to use Google VR plugin (v0.8.5), added stereo examples.

**3-Dec-2015** - Bugfix - material tiling x = -1 to prevent horizontal mirror image (thanks [/u/redskins78](https://www.reddit.com/user/redskins78) !)

**28-Nov-2015** - initial release, added skybox method (thanks [/u/cjdavies](https://www.reddit.com/user/cjdavies) !)

## License

The code is provided under the Apache License, Version 2.0.

The "Double Arch Photosphere" by Mark Doliner (https://www.flickr.com/photos/markdoliner/14094296347) is under a Creative Commons Attribution 2.0 Generic License [CC BY 2.0](https://creativecommons.org/licenses/by/2.0/).

The `LyonvilleSpring__AndrewPerry__PublicDomain` image is provided under a [CC0 license](https://creativecommons.org/publicdomain/zero/1.0/), and is dedicated to the public domain.


text:
<?php
$title = 'Base2Tone Colorschemes';
$type = 'index';
$theme = 'space';
$themeId = 'space-index';
$id = 'space-dark';
$description = 'Base2Tone Colorschemes, 2 base hues - 32 variations > 1 theme';
$bg = 'dark';
$swaptext1 = 'Color Schemes';
$swaptext2 = 'Base2Tone';
include '../inc/config.inc';
include '../inc/head.inc';
include '../inc/header.inc';
?>

<?php
  include '../inc/nav-themes.inc';
  include '../inc/intro.inc';
  include '../inc/demo-tiles-header_index.inc';
  include '../inc/demo-tiles.inc';
  include '../inc/code-samples.inc';
ob_start('compress_markup'); ?>

Templates for illustrations

    <?php include '../../output/svg/interior-base2tone-space.svg.inc'; ?>

<a href="output/svg/interior-base2tone-<?= $theme ?>.svg.inc" class="button _mtm">download vector image
Designed by Freepik

<?php ob_end_flush(); function compress_markup($buffer) { $search = array("/>[[:space:]]+/", "/[[:space:]]+</"); $replace = array(">","<"); return preg_replace($search, $replace, $buffer); } ?>
    <?php include '../../output/html/table/table-base2tone-space.inc'; ?>

<?php include '../inc/footer.inc'; ?>


text:
<?php
//as1d1f
include_once($prevFolder."classes/member.php");
include_once($prevFolder."classes/rank.php");
include_once($prevFolder."classes/consoleoption.php");
include_once($prevFolder."classes/game.php");
include_once($prevFolder."classes/shoutbox.php");

// LOG IN BOX - NOT LOGGED IN
// (CONTINUE BELOW TO EDIT THE BOX WHEN LOGGED IN)
$dispLoginBox = "

	<form action='".$MAIN_ROOT."login.php' method='post'>

			Username:

			<input type='text' name='user' class='textBox' style='width: 125px'>

			Password:

			<input type='password' name='pass' class='textBox' style='width: 125px'>

			Remember Me: <input type='checkbox' value='1' name='rememberme' class='checkBox'>

			<input type='submit' name='submit' class='submitButton' value='Log In'>

	</form>

";

$mainShoutboxObj = new Shoutbox($mysqli, "news", "news_id");

$mainShoutboxObj->strDivID = "mainShoutbox";
$mainShoutboxObj->intDispWidth = 124;
$mainShoutboxObj->intDispHeight = 300;

if(isset($_SESSION['btUsername']) AND isset($_SESSION['btPassword'])) {

	$memberObj = new Member($mysqli);
	if($memberObj->select($_SESSION['btUsername'])) {

		if($memberObj->authorizeLogin($_SESSION['btPassword'])) {
			define("LOGGED_IN", true);

			$memberInfo = $memberObj->get_info();
			$memberUsername = $memberInfo['username'];
			$memberID = $memberInfo['member_id'];

			if($memberInfo['loggedin'] == 0) {
				$memberObj->update(array("loggedin"), array(1));
			}

			$actualPageNameLoc = strrpos($PAGE_NAME," - ");
			$actualPageName = substr($PAGE_NAME, 0, $actualPageNameLoc);

			if($PAGE_NAME == "") {
				$actualPageName = "Home Page";
			}

			if(trim($_SERVER['HTTPS']) == "" || $_SERVER['HTTPS'] == "off") {
				$dispHTTP = "http://";
			}
			else {
				$dispHTTP = "https://";
			}

			$lastSeenLink = "".$actualPageName."";
			$arrUpdateColLastSeen = array("lastseen", "lastseenlink");
			$arrUpdateValLastSeen = array(time(), $lastSeenLink);

			if((time()-$memberInfo['lastlogin']) > 3600) {
				$arrUpdateColLastSeen[] = "lastlogin";
				$arrUpdateValLastSeen[] = time();
			}

			$memberObj->update($arrUpdateColLastSeen, $arrUpdateValLastSeen);

			$rankObj = new Rank($mysqli);
			$rankObj->select($memberInfo['rank_id']);
			$rankInfo = $rankObj->get_info();
			$memberRank = $rankInfo['name'];

			$consoleOptionObj = new ConsoleOption($mysqli);

			// Shoutbox

			$manageNewsCID = $consoleOptionObj->findConsoleIDByName("Manage News");

			$consoleOptionObj->select($manageNewsCID);

			if($memberObj->hasAccess($consoleOptionObj)) {
				$mainShoutboxObj->strEditLink = $MAIN_ROOT."members/console.php?cID=".$manageNewsCID."&newsID=";
				$mainShoutboxObj->strDeleteLink = $MAIN_ROOT."members/include/news/include/deleteshoutpost.php";

			}

			$postShoutboxCID = $consoleOptionObj->findConsoleIDByName("Post in Shoutbox");

			$consoleOptionObj->select($postShoutboxCID);

			if($memberObj->hasAccess($consoleOptionObj)) {
				$mainShoutboxObj->strPostLink = $MAIN_ROOT."members/include/news/include/postshoutbox.php";
			}

			// PMs

			$pmCID = $consoleOptionObj->findConsoleIDByName("Private Messages");

			$totalPMs = $memberObj->countPMs();
			$totalNewPMs = $memberObj->countPMs(true);

			if($totalNewPMs > 0) {
				$dispPMCount = "(".$totalNewPMs.") ";
			}
			else {
				$dispPMCount = "(".$totalPMs.")";
			}

			$memberObj = "";
			$rankObj = "";
			$memberInfo = "";
			$rankInfo = "";

			// LOG IN BOX - LOGGED IN
			$dispLoginBox = "

					 Account Name:
					  ".$memberUsername."

					 Rank:

					  ".$memberRank."

					 Member Options:

					  · My Account

					  · PM Inbox ".$dispPMCount."

					  · Sign Out

			";
		}

	}

}

if(!defined("LOGGED_IN")) {
	define("LOGGED_IN", false);
}

$hitCountObj = new Basic($mysqli, "hitcounter", "hit_id");
$hitCountObj->addNew(array("ipaddress", "dateposted", "pagename"), array($IP_ADDRESS, time(), $PAGE_NAME));

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<title><?php echo $PAGE_NAME.$CLAN_NAME; ?></title>
<link rel='stylesheet' type='text/css' href='<?php echo $MAIN_ROOT; ?>themes/bluefade/style.css'>
<link rel='stylesheet' type='text/css' href='<?php echo $MAIN_ROOT; ?>themes/bluefade/btcs4.css'>
<link rel='stylesheet' type='text/css' href='<?php echo $MAIN_ROOT; ?>js/css/jquery-ui-1.8.17.custom.css'>

<?php if(isset($EXTERNAL_JAVASCRIPT))
        echo $EXTERNAL_JAVASCRIPT; ?>

<audio id='notificationSound'>
	<source src='<?php echo $MAIN_ROOT; ?>themes/<?php echo $THEME; ?>/notification.mp3'></source>
	<source src='<?php echo $MAIN_ROOT; ?>themes/<?php echo $THEME; ?>/notification.ogg'></source>
</audio>

									<img src='<?php echo $MAIN_ROOT; ?>themes/bluefade/images/transparent.png' class='menu_MainMenu'>

										· <a href='<?php echo $MAIN_ROOT; ?>'>Home

										· <a href='<?php echo $MAIN_ROOT; ?>news'>News

										· <a href='<?php echo $MAIN_ROOT; ?>members.php'>Members

										· <a href='<?php echo $MAIN_ROOT; ?>ranks.php'>Ranks

										· <a href='<?php echo $MAIN_ROOT; ?>squads'>Squads

										· <a href='<?php echo $MAIN_ROOT; ?>tournaments'>Tournaments

										· <a href='<?php echo $MAIN_ROOT; ?>diplomacy'>Diplomacy

										· <a href='<?php echo $MAIN_ROOT; ?>medals.php'>Medals

										· <a href='<?php echo $MAIN_ROOT; ?>custompage.php?pID=11'>History

										· <a href='<?php echo $MAIN_ROOT; ?>custompage.php?pID=12'>Rules

										<?php
											if($websiteInfo['memberregistration'] == 0 && constant('LOGGED_IN') != true) {
												echo "· Sign Up
";
											}
										?>

									<img src='<?php echo $MAIN_ROOT; ?>themes/bluefade/images/transparent.png' class='menu_TopPlayers'>

										· <a href='<?php echo $MAIN_ROOT; ?>top-players/recruiters.php'>Recruiters

										<?php
											$hpGameObj = new Game($mysqli);
											$arrGames = $hpGameObj->getGameList();
											foreach($arrGames as $gameID) {
												$hpGameObj->select($gameID);
												echo "· ".$hpGameObj->get_info_filtered("name")."
";
											}
										?>

									<img src='<?php echo $MAIN_ROOT; ?>themes/bluefade/images/transparent.png' class='menu_Forum'>

									· <a href='<?php echo $websiteInfo['forumurl']; ?>'>Enter the Forum

						<?php

							// Get UTC TIME
							$utcTime = time();

							// Clock Display
							$displaydate = date("l, F j, Y");

							$easternDate = new DateTime(date("Y-m-d"), new DateTimeZone('America/New_York'));
							$eastOffset = $easternDate->getOffset();
							$eastTime = ($utcTime+$eastOffset);
							$eastHour = gmdate("G", $eastTime);
							$eastMinutes = gmdate("i", $eastTime);

							$centralDate = new DateTime(date("Y-m-d"), new DateTimeZone('America/Chicago'));
							$centralOffset = $centralDate->getOffset();
							$centralTime = ($utcTime+$centralOffset);
							$centralHour = gmdate("G", $centralTime);
							$centralMinutes = gmdate("i", $centralTime);

							$mountainDate = new DateTime(date("Y-m-d"), new DateTimeZone('America/Denver'));
							$mountainOffset = $mountainDate->getOffset();
							$mountainTime = ($utcTime+$mountainOffset);
							$mountainHour = gmdate("G", $mountainTime);
							$mountainMinutes = gmdate("i", $mountainTime);

							$pacificDate = new DateTime(date("Y-m-d"), new DateTimeZone('America/Los_Angeles'));
							$pacificOffset = $pacificDate->getOffset();
							$pacificTime = ($utcTime+$pacificOffset);
							$pacificHour = gmdate("G", $pacificTime);
							$pacificMinutes = gmdate("i", $pacificTime);

							echo "

								".$displaydate."

									Eastern Time:  || Central Time:  || Mountain Time:  || Pacific Time:

							";

						?>


text:
<!DOCTYPE html><html><head><meta charset="utf-8" />
<meta http-equiv="refresh" content="0;url=/place/kenya/emissions/" />
</head></html>


text:
"""
EasyBuild support for CUDA, implemented as an easyblock

Ref: https://speakerdeck.com/ajdecon/introduction-to-the-cuda-toolkit-for-building-applications

@author: George Tsouloupas (Cyprus Institute)
@author: Fotis Georgatos (Uni.lu)
@author: Kenneth Hoste (Ghent University)
"""
import os

from easybuild.easyblocks.generic.binary import Binary
from easybuild.tools.filetools import patch_perl_script_autoflush
from easybuild.tools.run import run_cmd, run_cmd_qa
from distutils.version import LooseVersion

class EB_CUDA(Binary):
    """
    Support for installing CUDA.
    """

    def extract_step(self):
        """Extract installer to have more control, e.g. options, patching Perl scripts, etc."""
        execpath = self.src[0]['path']
        run_cmd("/bin/sh " + execpath + " --noexec --nox11 --target " + self.builddir)
        self.src[0]['finalpath'] = self.builddir

    def install_step(self):
        """Install CUDA using Perl install script."""

        # define how to run the installer
        # script has /usr/bin/perl hardcoded, but we want to have control over which perl is being used
        if LooseVersion(self.version) <= LooseVersion("5"):
            install_script = "install-linux.pl"
            install_script_path = os.path.join(self.builddir, install_script)
            cmd = "perl ./%s --prefix=%s %s" % (install_script, self.installdir, self.cfg['installopts'])
        else:
            # the following would require to include "osdependencies = 'libglut'" because of samples
            # installparams = "-samplespath=%(x)s/samples/ -toolkitpath=%(x)s -samples -toolkit" % {'x': self.installdir}
            install_script = "cuda-installer.pl"
            installparams = "-toolkitpath=%s -toolkit" % self.installdir
            cmd = "perl ./%s -verbose -silent %s %s" % (install_script, installparams, self.cfg['installopts'])

        # prepare for running install script autonomously
        qanda = {}
        stdqa = {
            # this question is only asked if CUDA tools are already available system-wide
            r"Would you like to remove all CUDA files under .*? (yes/no/abort): ": "no",
        }
        noqanda = [
            r"^Configuring",
            r"Installation Complete",
            r"Verifying archive integrity.*",
            r"^Uncompressing NVIDIA CUDA",
            r".* -> .*",
        ]

        # patch install script to handle Q&A autonomously
        patch_perl_script_autoflush(os.path.join(self.builddir, install_script))

        # make sure $DISPLAY is not defined, which may lead to (weird) problems
        # this is workaround for not being able to specify --nox11 to the Perl install scripts
        if 'DISPLAY' in os.environ:
            os.environ.pop('DISPLAY')

        run_cmd_qa(cmd, qanda, std_qa=stdqa, no_qa=noqanda, log_all=True, simple=True)

    def sanity_check_step(self):
        """Custom sanity check for CUDA."""

        chk_libdir = ["lib64"]

        # Versions higher than 6 do not provide 32 bit libraries
        if LooseVersion(self.version) < LooseVersion("6"):
            chk_libdir += ["lib"]

        custom_paths = {
            'files': ["bin/%s" % x for x in ["fatbinary", "nvcc", "nvlink", "ptxas"]] +
                     ["%s/lib%s.so" % (x, y) for x in chk_libdir for y in ["cublas", "cudart", "cufft",
                                                                           "curand", "cusparse"]] +
                     ["open64/bin/nvopencc"],
            'dirs': ["include"],
        }

        super(EB_CUDA, self).sanity_check_step(custom_paths=custom_paths)

    def make_module_req_guess(self):
        """Specify CUDA custom values for PATH etc."""

        guesses = super(EB_CUDA, self).make_module_req_guess()

        guesses.update({
            'PATH': ['open64/bin', 'bin'],
            'LD_LIBRARY_PATH': ['lib64'],
            'CPATH': ['include'],
            'CUDA_HOME': [''],
            'CUDA_PATH': [''],
        })

        return guesses


text:
<?php
$endpoints_list  = array_keys(auth_oauth::$endpoints_list);
$endpoints_list = array_combine($endpoints_list , $endpoints_list );

//$user_infos['auth_ldap_soap_endpoint_name'])?<br>


text:
using Microsoft.AspNet.Mvc;
using System;
using System.Linq;
using System.Threading.Tasks;
using Web.Models;

// For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860

namespace Web.Controllers
{
    public class TestController : Controller
    {

		private ApplicationDbContext context;

		public TestController(ApplicationDbContext context)
		{
			this.context = context;
		}

		// GET: /<controller>/
        public async Task<IActionResult> Index()
        {
			var rand = new Random();

			Enumerable.Range(0, 10).Select(i => new TestModel { Id = rand.Next(1000) }).ToList().ForEach((t) =>
			{
				context.TestModels.Add(t);
			});

			await context.SaveChangesAsync();

			return View(context.TestModels.ToList());
        }
    }
}


text:
package ch.admin.seco.jobroom.security.registration.eiam;

class MultipleEiamUsersFound extends EiamClientRuntimeException {

    MultipleEiamUsersFound(EiamClientRuntimeException.Identification identification, String id) {
        super("Multiple Users found having : " + identification + " " + id);
    }

}


text:
<?php
/**
 * Created by PhpStorm.
 * User: Kurma Sufi
 * Date: 8/20/2017
 * Time: 18:46
 */

defined('BASEPATH') OR exit('No direct script access allowed');

class Halaman extends CI_Controller
{

    public $data = array(
        'main_view' => 'dashboard/login',
        'judul_lengkap' => 'Login Administrator',
        'judul_pendek' => 'Login',
    );

    public function __construct()
    {
        parent::__construct();
        $this->load->database();
        $this->load->library(array('ion_auth', 'form_validation'));
        $this->load->helper(array('url', 'language'));

        $this->form_validation->set_error_delimiters($this->config->item('error_start_delimiter', 'ion_auth'), $this->config->item('error_end_delimiter', 'ion_auth'));

        $this->lang->load('auth');

        $this->load->model('M_dashboard', 'admin', TRUE);

        $this->load->model('M_identitas', 'identitas', TRUE);
        $this->data['iden_data'] = $this->identitas->get_identitas();
    }

    public function index()
    {
        if (!$this->ion_auth->logged_in())
        {
            redirect('dashboard/login', 'refresh');
        }
        else {

            $keyword = '';

            $config['base_url'] = base_url() . 'dashboard/halaman/index/';
            $config['total_rows'] = $this->admin->total_rows_halaman();
            $config['per_page'] = 10;
            $config['uri_segment'] = 4;
            $config['first_url'] = base_url() . 'dashboard/halaman';
            $this->pagination->initialize($config);

            $start = $this->uri->segment(4, 0);
            $halaman = $this->admin->index_limit_halaman($config['per_page'], $start);

            $this->data['halaman_data']   = $halaman;
            $this->data['keyword']      = $keyword;
            $this->data['pagination']   = $this->pagination->create_links();
            $this->data['total_rows']   = $config['total_rows'];
            $this->data['start']        = $start;
            $this->data['judul_pendek'] = 'Halaman Statis';

            //ambil variabel URL
            $mau_ke					= $this->uri->segment(3);
            $idu					= $this->uri->segment(4);
            if($mau_ke == "create"){

                $this->data['button']       = 'Tambah Data';
                $this->data['action']       = site_url('dashboard/halaman/create_action');
                $this->data['id_halaman']     = set_value('id_halaman');
                $this->data['judul']     = set_value('judul');
                $this->data['pic_halaman']    = set_value('pic_halaman');
                $this->data['isi_halaman']  = set_value('isi_halaman');
                $this->data['aktif_hal']    = set_value('aktif_hal');
                $this->data['option_aktif']  = array(
                    'Y' => 'Ya',
                    'N' => 'Tidak',
                );
                $this->data['main_view']	= "dashboard/halaman/halaman_form";
            }
            elseif($mau_ke == "update"){

                $row = $this->admin->get_by_id_halaman($idu);

                if ($row) {

                    $this->data['button']       = 'Update Data';
                    $this->data['action']       = site_url('dashboard/halaman/update_action');
                    $this->data['id_halaman']    = set_value('id_halaman', $row->id_halaman);
                    $this->data['judul']    = set_value('judul', $row->judul);
                    $this->data['pic_halaman']   = set_value('pic_halaman', $row->pic_halaman);
                    $this->data['isi_halaman']  = set_value('isi_halaman', $row->isi_halaman);
                    $this->data['aktif_hal']    = set_value('aktif_hal', $row->aktif_hal);
                    $this->data['option_aktif'] = array(
                        'Y' => 'Ya',
                        'N' => 'Tidak',
                    );

                    $this->data['main_view']	= "dashboard/halaman/halaman_form";
                } else {
                    $this->session->set_flashdata('message', 'Record Not Found');
                    redirect(site_url('dashboard/halaman'));
                }

            }
            elseif($mau_ke == "delete"){
                $row = $this->admin->get_by_id_halaman($idu);

                if ($row) {

                    if(!empty($row->pic_halaman)){

                        //lokasi file secara spesifik
                        $file = './uploads/foto_halaman/'.$row->pic_halaman;
                        if (!unlink($file)){
                            $this->session->set_flashdata('message', 'File tidak dapat dihapus.');
                            redirect(site_url('dashboard/halaman'));
                        } else {
                            $this->admin->delete_halaman($idu);
                            $this->session->set_flashdata('message', 'Hapus data berhasil.');
                            redirect(site_url('dashboard/halaman'));
                        }
                    } else {
                        $this->admin->delete_halaman($idu);
                        $this->session->set_flashdata('message', 'Hapus data berhasil.');
                        redirect(site_url('dashboard/halaman'));
                    }
                } else {
                    $this->session->set_flashdata('message', 'Data tidak ditemukan.');
                    redirect(site_url('dashboard/halaman'));
                }

            }
            elseif($mau_ke == "create_action"){
                $this->_rules_halaman();

                if ($this->form_validation->run() == FALSE) {
                    redirect(site_url('dashboard/halaman/create'));
                } else {
                    $nmfile = "file_".date('YmdHis');
                    $config = array (
                        'file_name' =>$nmfile,
                        'upload_path' => './uploads/foto_halaman/',
                        'allowed_types' => 'jpg|jpeg|gif|png|bmp',
                        'file_ext_tolower' => TRUE,
                        'overwrite' => TRUE,
                        'max_size' => 200000,
                        'max_filename' => 0,
                        'remove_spaces' => TRUE
                    );
                    $this->load->library('upload', $config);

                    if (!$this->upload->do_upload()){
                        $data = array(
                            'judul' => $this->input->post('judul',TRUE),
                            'judul_seo' => seo_title($this->input->post('judul',TRUE)),
                            'isi_halaman' => $this->input->post('isi_halaman',TRUE),
                            'aktif_hal' => $this->input->post('aktif_hal',TRUE)
                        );
                    } else {
                        $data = array(
                            'judul' => $this->input->post('judul',TRUE),
                            'judul_seo' => seo_title($this->input->post('judul',TRUE)),
                            'isi_halaman' => $this->input->post('isi_halaman',TRUE),
                            'aktif_hal' => $this->input->post('aktif_hal',TRUE),
                            'pic_halaman' => $this->upload->file_name
                        );
                    }

                    $this->admin->insert_halaman($data);
                    $this->session->set_flashdata('message', 'Tambah Data Berhasil');
                    redirect(site_url('dashboard/halaman'));
                }

            }
            elseif($mau_ke == "update_action"){
                $this->_rules_halaman();

                if ($this->form_validation->run() == FALSE) {
                    redirect(site_url('dashboard/halaman/update/'.$this->input->post('id_halaman', TRUE)));
                } else {

                    $nmfile = "file_".date('YmdHis');
                    $config = array (
                        'file_name' =>$nmfile,
                        'upload_path' => './uploads/foto_halaman/',
                        'file_ext_tolower' => TRUE,
                        'overwrite' => TRUE,
                        'max_size' => 200000,
                        'max_filename' => 0,
                        'remove_spaces' => TRUE
                    );
                    $this->load->library('upload', $config);

                    /*$result = $this->upload->data();
                    echo "
";
                    print_r($result);
                    echo "
";*/

                    if (!$this->upload->do_upload()){
                        $data = array(
                            'judul' => $this->input->post('judul',TRUE),
                            'judul_seo' => seo_title($this->input->post('judul',TRUE)),
                            'isi_halaman' => $this->input->post('isi_halaman',TRUE),
                            'aktif_hal' => $this->input->post('aktif_hal',TRUE)
                        );
                    }
                    else {

                        //delete dulu foto yang lama ---------------------------------
                        $row = $this->admin->get_by_id_halaman($this->input->post('id_halaman', TRUE));
                        if ($row) {
                            if(!empty($row->pic_halaman)){
                                $file = './uploads/foto_halaman/'.$row->pic_halaman;
                                unlink($file);
                            }
                        }
                        //------------------------------------------------------------
                        $data = array(
                            'judul' => $this->input->post('judul',TRUE),
                            'judul_seo' => seo_title($this->input->post('judul',TRUE)),
                            'isi_halaman' => $this->input->post('isi_halaman',TRUE),
                            'aktif_hal' => $this->input->post('aktif_hal',TRUE),
                            'pic_halaman' => $this->upload->file_name
                        );
                    }

                    $this->admin->update_halaman($this->input->post('id_halaman', TRUE), $data);
                    $this->session->set_flashdata('message', 'Update Data Berhasil');
                    redirect(site_url('dashboard/halaman'));
                }

            }
            elseif($mau_ke == "search"){
                $keyword = $this->uri->segment(4, $this->input->post('keyword', TRUE));
                $this->load->library('pagination');

                if ($this->uri->segment(3)=='search') {
                    $config['base_url'] = base_url() . 'dashboard/halaman/search/' . $keyword;
                } else {
                    $config['base_url'] = base_url() . 'dashboard/halaman/index/';
                }

                $config['total_rows'] = $this->admin->search_total_rows_halaman($keyword);
                $config['per_page'] = 10;
                $config['uri_segment'] = 5;
                $config['first_url'] = base_url() . 'dashboard/halaman/search/'.$keyword;
                $this->pagination->initialize($config);

                $start = $this->uri->segment(5, 0);
                $halaman = $this->admin->search_index_limit_halaman($config['per_page'], $start, $keyword);

                $this->data['halaman_data']   = $halaman;
                $this->data['keyword']      = $keyword;
                $this->data['pagination']   = $this->pagination->create_links();
                $this->data['total_rows']   = $config['total_rows'];
                $this->data['start']        = $start;

                $this->data['main_view']	= "dashboard/halaman/halaman_list";

            }
            else {
                $this->data['main_view']	= "dashboard/halaman/halaman_list";
            }

            $this->load->view('dashboard/dashboard', $this->data);

        }
    }
    function _rules_halaman()
    {
        $this->form_validation->set_rules('judul', '', 'trim|required');
        $this->form_validation->set_rules('isi_halaman', '', 'trim');
        $this->form_validation->set_rules('pic_halaman', '', 'trim');

        $this->form_validation->set_rules('id_halaman', 'id_halaman', 'trim');
        $this->form_validation->set_error_delimiters('', '');
    }

    public function create(){

        $this->load->view('dashboard/dashboard', $this->data);

    }
    public function update($id){

        $this->load->view('dashboard/dashboard', $this->data);

    }
    public function delete($id){

        $this->load->view('dashboard/dashboard', $this->data);

    }
    public function create_action(){

        $this->load->view('dashboard/dashboard', $this->data);

    }
    public function update_action(){

        $this->load->view('dashboard/dashboard', $this->data);

    }
    public function search(){

        $this->load->view('dashboard/dashboard', $this->data);

    }

}


text:
REGISTRATION (PROFILE)

            <form role="form" id="form_new_user" enctype="multipart/form-data">

                  <img id="image_profile" src="<?=base_url('love_academy_files/users/avatars/avatar_user_default.jpg')?>" class="img-responsive" style="width: 250px; height: 250px; border: 1px solid #000;">

UPLOAD IMAGE

                    <input type="file" name="avatar" id="input_image" >

                  DISPLAY NAME *
                  <input type="text" class="form-control" id="name" name="display_name">

                  BIO
                  <textarea class="form-control" id="bio" type="text" name="bio" style="height: 142px; background-color: transparent; "></textarea>

YOUR LINKS (OPTIONAL)

                FACEBOOK
                <input type="text" class="form-control" id="form_birthday" placeholder="" name="facebook">

                INSTAGRAM
                <input type="text" class="form-control" id="form_birthday" placeholder="" name="instagram">

                TWITTER
                <input type="text" class="form-control" id="form_birthday" placeholder="" name="twitter">

                NAME *

                  <input type="text" class="form-control pull-left" id="first_name" name="name">

First Name

                  <input type="text" class="form-control pull-right" id="last_name" name="last_name">

Last Name

                EMAIL *
                <input type="email" class="form-control" id="email" name="email">

                SKYPE NAME *
                <input type="text" class="form-control" id="skype_name" name="skype">

                GENDER *

                  <select class="form-control " id="lac-select" name="gender">
                    <option value="masculine">MASCULINE</option>
                    <option value="female">FEMALE</option>
                  </select>

                PASSWORD *
                <input type="password" class="form-control" id="password" name="password">

                CONFIRM PASSWORD *
                <input type="password" class="form-control" id="confirm_password" name="confirm_password">

WHERE DO YOU LIVE?

                COUNTRY OF RESIDENCE *

                  <select class="form-control" id="countryId" name="country">
                  </select>

                STATE OF RESIDENCE *

                  <select class="form-control" id="stateId" name="state">
                    <option value="0">SELECT STATE</option>
                  </select>

                CITY OF RESIDENCE *

                  <select class="form-control" id="cityId" name="cities_id">
                    <option value="0">SELECT CITY</option>
                  </select>

                LANGUAGE *

                    <input type="radio" name="language" checked="checked" value="1">ENGLISH
                    <input type="radio" name="language" value="2">SPANISH
                    <input type="radio" name="language" value="3">FRENCH
                    <input type="radio" name="language" value="4">RUSSIAN

                CEL PHONE *
                <input type="number" class="form-control" id="phone" name="phone">

YOUR BIRTH INFO

                BIRTH DATE *

                  <input type="text"  class="form-control" name="birth_date" id="birth_date">

                BIRTH TIME (OPTIONAL)

                  <input type="text" class="form-control" name="birth_hour" id="birth_hour">

                HOW DID YOU HEARD ABOUT US?
                <input type="text" class="form-control" id="email" name="heard_about">

              <button type="submit" id="fire" class="btn btn-default pull-right">Submit</button>

            </form>

        <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>

Crop Image

            <input type="file" class="avatar-input" id="avatarInputAvatar" name="avatar_file">

        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary" data-dismiss="modal" id="cropImageButton">Crop Image</button>