text:
require 'spec_helper'

describe Groups::DestroyService, services: true do
  include DatabaseConnectionHelpers

  let!(:user)         { create(:user) }
  let!(:group)        { create(:group) }
  let!(:nested_group) { create(:group, parent: group) }
  let!(:project)      { create(:empty_project, namespace: group) }
  let!(:notification_setting) { create(:notification_setting, source: group)}
  let!(:gitlab_shell) { Gitlab::Shell.new }
  let!(:remove_path)  { group.path + "+#{group.id}+deleted" }

  before do
    group.add_user(user, Gitlab::Access::OWNER)
  end

  shared_examples 'group destruction' do |async|
    context 'database records' do
      before do
        destroy_group(group, user, async)
      end

      it { expect(Group.unscoped.all).not_to include(group) }
      it { expect(Group.unscoped.all).not_to include(nested_group) }
      it { expect(Project.unscoped.all).not_to include(project) }
      it { expect(NotificationSetting.unscoped.all).not_to include(notification_setting) }
    end

    context 'file system' do
      context 'Sidekiq inline' do
        before do
          # Run sidekiq immediatly to check that renamed dir will be removed
          Sidekiq::Testing.inline! { destroy_group(group, user, async) }
        end

        it { expect(gitlab_shell.exists?(project.repository_storage_path, group.path)).to be_falsey }
        it { expect(gitlab_shell.exists?(project.repository_storage_path, remove_path)).to be_falsey }
      end

      context 'Sidekiq fake' do
        before do
          # Don't run sidekiq to check if renamed repository exists
          Sidekiq::Testing.fake! { destroy_group(group, user, async) }
        end

        it { expect(gitlab_shell.exists?(project.repository_storage_path, group.path)).to be_falsey }
        it { expect(gitlab_shell.exists?(project.repository_storage_path, remove_path)).to be_truthy }
      end
    end

    def destroy_group(group, user, async)
      if async
        Groups::DestroyService.new(group, user).async_execute
      else
        Groups::DestroyService.new(group, user).execute
      end
    end
  end

  describe 'asynchronous delete' do
    it_behaves_like 'group destruction', true

    context 'potential race conditions' do
      context "when the `GroupDestroyWorker` task runs immediately" do
        it "deletes the group" do
          # Commit the contents of this spec's transaction so far
          # so subsequent db connections can see it.
          #
          # DO NOT REMOVE THIS LINE, even if you see a WARNING with "No
          # transaction is currently in progress". Without this, this
          # spec will always be green, since the group created in setup
          # cannot be seen by any other connections / threads in this spec.
          Group.connection.commit_db_transaction

          group_record = run_with_new_database_connection do |conn|
            conn.execute("SELECT * FROM namespaces WHERE id = #{group.id}").first
          end

          expect(group_record).not_to be_nil

          # Execute the contents of `GroupDestroyWorker` in a separate thread, to
          # simulate data manipulation by the Sidekiq worker (different database
          # connection / transaction).
          expect(GroupDestroyWorker).to receive(:perform_async).and_wrap_original do |m, group_id, user_id|
            Thread.new { m[group_id, user_id] }.join(5)
          end

          # Kick off the initial group destroy in a new thread, so that
          # it doesn't share this spec's database transaction.
          Thread.new { Groups::DestroyService.new(group, user).async_execute }.join(5)

          group_record = run_with_new_database_connection do |conn|
            conn.execute("SELECT * FROM namespaces WHERE id = #{group.id}").first
          end

          expect(group_record).to be_nil
        end
      end
    end
  end

  describe 'synchronous delete' do
    it_behaves_like 'group destruction', false
  end

  context 'projects in pending_delete' do
    before do
      project.pending_delete = true
      project.save
    end

    it_behaves_like 'group destruction', false
  end
end


text:
clean:
	@echo "Cleaning..."
	@rm -rf news_html
	@rm -rf news_txt

search:
	@./query_es.sh > News.json

fetch:
	@mkdir news_html
	python get_news.py News.json news_html

convert_txt:
	@mkdir news_txt
	python html2txt.py news_html news_txt

all: clean search fetch convert_txt

redpajama_set_name: RedPajamaGithub


text:
FindFilesystem
##############

This module supports the C++17 standard library's filesystem utilities. Use the
:imp-target:`std::filesystem` imported target to

Options
*******

The ``COMPONENTS`` argument to this module supports the following values:

.. find-component:: Experimental
    :name: fs.Experimental

    Allows the module to find the "experimental" Filesystem TS version of the
    Filesystem library. This is the library that should be used with the
    ``std::experimental::filesystem`` namespace.

.. find-component:: Final
    :name: fs.Final

    Finds the final C++17 standard version of the filesystem library.

If no components are provided, behaves as if the
:find-component:`fs.Final` component was specified.

If both :find-component:`fs.Experimental` and :find-component:`fs.Final` are
provided, first looks for ``Final``, and falls back to ``Experimental`` in case
of failure. If ``Final`` is found, :imp-target:`std::filesystem` and all
:ref:`variables <fs.variables>` will refer to the ``Final`` version.

Imported Targets
****************

.. imp-target:: std::filesystem

    The ``std::filesystem`` imported target is defined when any requested
    version of the C++ filesystem library has been found, whether it is
    *Experimental* or *Final*.

    If no version of the filesystem library is available, this target will not
    be defined.

    .. note::
        This target has ``cxx_std_17`` as an ``INTERFACE``
        :ref:`compile language standard feature <req-lang-standards>`. Linking
        to this target will automatically enable C++17 if no later standard
        version is already required on the linking target.

.. _fs.variables:

Variables
*********

.. variable:: CXX_FILESYSTEM_IS_EXPERIMENTAL

    Set to ``TRUE`` when the :find-component:`fs.Experimental` version of C++
    filesystem library was found, otherwise ``FALSE``.

.. variable:: CXX_FILESYSTEM_HAVE_FS

    Set to ``TRUE`` when a filesystem header was found.

.. variable:: CXX_FILESYSTEM_HEADER

    Set to either ``filesystem`` or ``experimental/filesystem`` depending on
    whether :find-component:`fs.Final` or :find-component:`fs.Experimental` was
    found.

.. variable:: CXX_FILESYSTEM_NAMESPACE

    Set to either ``std::filesystem`` or ``std::experimental::filesystem``
    depending on whether :find-component:`fs.Final` or
    :find-component:`fs.Experimental` was found.

Examples
********

Using `find_package(Filesystem)` with no component arguments:

.. code-block:: cmake

    find_package(Filesystem REQUIRED)

    add_executable(my-program main.cpp)
    target_link_libraries(my-program PRIVATE std::filesystem)

#]=======================================================================]

if(TARGET std::filesystem)
    # This module has already been processed. Don't do it again.
    return()
endif()

include(CMakePushCheckState)
include(CheckIncludeFileCXX)
include(CheckCXXSourceCompiles)

cmake_push_check_state()
set(CMAKE_REQUIRED_QUIET ${Filesystem_FIND_QUIETLY})

# All of our tests required C++17 or later
set(CMAKE_CXX_STANDARD 17)

# Normalize and check the component list we were given
set(want_components ${Filesystem_FIND_COMPONENTS})
if(Filesystem_FIND_COMPONENTS STREQUAL "")
    set(want_components Final)
endif()

# Warn on any unrecognized components
set(extra_components ${want_components})
list(REMOVE_ITEM extra_components Final Experimental)
foreach(component IN LISTS extra_components)
    message(WARNING "Extraneous find_package component for Filesystem: ${component}")
endforeach()

# Detect which of Experimental and Final we should look for
set(find_experimental TRUE)
set(find_final TRUE)
if(NOT "Final" IN_LIST want_components)
    set(find_final FALSE)
endif()
if(NOT "Experimental" IN_LIST want_components)
    set(find_experimental FALSE)
endif()

if(find_final)
    check_include_file_cxx("filesystem" _CXX_FILESYSTEM_HAVE_HEADER)
    mark_as_advanced(_CXX_FILESYSTEM_HAVE_HEADER)
    if(_CXX_FILESYSTEM_HAVE_HEADER)
        # We found the non-experimental header. Don't bother looking for the
        # experimental one.
        set(find_experimental FALSE)
    endif()
else()
    set(_CXX_FILESYSTEM_HAVE_HEADER FALSE)
endif()

if(find_experimental)
    check_include_file_cxx("experimental/filesystem" _CXX_FILESYSTEM_HAVE_EXPERIMENTAL_HEADER)
    mark_as_advanced(_CXX_FILESYSTEM_HAVE_EXPERIMENTAL_HEADER)
else()
    set(_CXX_FILESYSTEM_HAVE_EXPERIMENTAL_HEADER FALSE)
endif()

if(_CXX_FILESYSTEM_HAVE_HEADER)
    set(_have_fs TRUE)
    set(_fs_header filesystem)
    set(_fs_namespace std::filesystem)
elseif(_CXX_FILESYSTEM_HAVE_EXPERIMENTAL_HEADER)
    set(_have_fs TRUE)
    set(_fs_header experimental/filesystem)
    set(_fs_namespace std::experimental::filesystem)
else()
    set(_have_fs FALSE)
endif()

set(CXX_FILESYSTEM_HAVE_FS ${_have_fs} CACHE BOOL "TRUE if we have the C++ filesystem headers")
set(CXX_FILESYSTEM_HEADER ${_fs_header} CACHE STRING "The header that should be included to obtain the filesystem APIs")
set(CXX_FILESYSTEM_NAMESPACE ${_fs_namespace} CACHE STRING "The C++ namespace that contains the filesystem APIs")

set(_found FALSE)

if(CXX_FILESYSTEM_HAVE_FS)
    # We have some filesystem library available. Do link checks
    ## HERE STARTS MODIFICATION 2
    string(CONFIGURE [[
        #include <@CXX_FILESYSTEM_HEADER@>

        int main() {
            @CXX_FILESYSTEM_NAMESPACE@::path testpath = \"../\";
            @CXX_FILESYSTEM_NAMESPACE@::exists(testpath);
            auto cwd = @CXX_FILESYSTEM_NAMESPACE@::current_path();
            return static_cast<int>(cwd.string().size());
        }
    ]] code @ONLY)

    if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
        # ON MSVC we shouldn't need a linker flag
        check_cxx_source_compiles("${code}" CXX_FILESYSTEM_NO_LINK_NEEDED)
        set(can_link ${CXX_FILESYSTEM_NO_LINK_NEEDED})
    else()
        # Try to compile a simple filesystem program with the libstdc++ flag
        # If the linker flag exists it's preferrable to use it to avoid spurious undefined references
        set(CMAKE_REQUIRED_LIBRARIES  -lstdc++fs)
        check_cxx_source_compiles("${code}" CXX_FILESYSTEM_STDCPPFS_NEEDED)
        set(can_link ${CXX_FILESYSTEM_STDCPPFS_NEEDED})
        if(NOT CXX_FILESYSTEM_STDCPPFS_NEEDED)
            # Try to compile a simple filesystem program with the libc++ flag
            set(CMAKE_REQUIRED_LIBRARIES -lc++fs)
            check_cxx_source_compiles("${code}" CXX_FILESYSTEM_CPPFS_NEEDED)
            set(can_link ${CXX_FILESYSTEM_CPPFS_NEEDED})
            if(NOT CXX_FILESYSTEM_CPPFS_NEEDED)
                # Try to compile a simple filesystem program without any linker flags
                check_cxx_source_compiles("${code}" CXX_FILESYSTEM_NO_LINK_NEEDED)
                set(can_link ${CXX_FILESYSTEM_NO_LINK_NEEDED})
            endif()
        endif()
    endif()
    ## HERE ENDS MODIFICATION 2

    if(can_link)
        add_library(std::filesystem INTERFACE IMPORTED)
        target_compile_features(std::filesystem INTERFACE cxx_std_17)
        set(_found TRUE)

        if(CXX_FILESYSTEM_NO_LINK_NEEDED)
            # Nothing to add...
        elseif(CXX_FILESYSTEM_STDCPPFS_NEEDED)
            target_link_libraries(std::filesystem INTERFACE -lstdc++fs)
        elseif(CXX_FILESYSTEM_CPPFS_NEEDED)
            target_link_libraries(std::filesystem INTERFACE -lc++fs)
        endif()
    endif()
endif()

cmake_pop_check_state()

set(Filesystem_FOUND ${_found} CACHE BOOL "TRUE if we can compile and link a program using std::filesystem" FORCE)

if(Filesystem_FIND_REQUIRED AND NOT Filesystem_FOUND)
    message(FATAL_ERROR "Cannot Compile simple program using std::filesystem")
endif()


text:
<?php
/**
 * User preferences form
 */

declare(strict_types=1);

namespace PhpMyAdmin\Config\Forms\Setup;

use function array_diff;

class FeaturesForm extends \PhpMyAdmin\Config\Forms\User\FeaturesForm
{
    /**
     * @return array
     */
    public static function getForms()
    {
        // phpcs:disable Squiz.Arrays.ArrayDeclaration.KeySpecified,Squiz.Arrays.ArrayDeclaration.NoKeySpecified
        $result = parent::getForms();
        /* Remove only_db/hide_db, we have proper Server form in setup */
        $result['Databases'] = array_diff(
            $result['Databases'],
            [
                'Servers/1/only_db',
                'Servers/1/hide_db',
            ]
        );
        /* Following are not available to user */
        $result['Import_export'] = [
            'UploadDir',
            'SaveDir',
            'RecodingEngine' => ':group',
            'IconvExtraParams',
            ':group:end',
            'ZipDump',
            'GZipDump',
            'BZipDump',
            'CompressOnFly',
        ];
        $result['Security'] = [
            'blowfish_secret',
            'CheckConfigurationPermissions',
            'TrustedProxies',
            'AllowUserDropDatabase',
            'AllowArbitraryServer',
            'ArbitraryServerRegexp',
            'LoginCookieRecall',
            'LoginCookieStore',
            'LoginCookieDeleteAll',
            'CaptchaLoginPublicKey',
            'CaptchaLoginPrivateKey',
            'CaptchaSiteVerifyURL',
        ];
        $result['Developer'] = [
            'UserprefsDeveloperTab',
            'DBG/sql',
        ];
        $result['Other_core_settings'] = [
            'OBGzip',
            'PersistentConnections',
            'ExecTimeLimit',
            'MemoryLimit',
            'UseDbSearch',
            'ProxyUrl',
            'ProxyUser',
            'ProxyPass',
            'AllowThirdPartyFraming',
            'ZeroConf',
        ];

        return $result;

        // phpcs:enable
    }
}


text:
public class hw
{
  public static void main(String agrs[])
  {
   System.out.println("Hello World!");
  }
}


text:
<publishData>
    <publishProfile publishUrl="https://majesticphoto-001-site1.smarterasp.net:8172/msdeploy.axd"
msdeploySite="majesticphoto-001-site1"
 destinationAppUrl="http://majesticphoto-001-site1.smarterasp.net/"
 profileName="Default Settings"
 publishMethod="MSDeploy"
 userName="ifc\majesticphoto-001" />
</publishData>


text:
Travel and Help [![Build Status](https://travis-ci.org/travel-and-help/start-kit.svg?branch=master)](https://travis-ci.org/travel-and-help/start-kit) [![Coverage](https://codecov.io/github/travel-and-help/start-kit/coverage.svg?branch=master)](https://codecov.io/github/travel-and-help/start-kit?branch=master)
=========
Travel and Help is a mobile application, which lets travelers perform some social activities called challenges in chosen city or country. Challenge makers will have the possibility to create social challenges and they will be posted after verification.

* Web site: https://start-kit.herokuapp.com
* Travis-CI: https://travis-ci.org/travel-and-help/start-kit
* Sauce Labs: https://saucelabs.com/beta/dashboard/tests
* Design mockups: https://projects.invisionapp.com/share/Q66S0N79F#/screens
* Dashboard: https://tree.taiga.io/project/kucherenko-travel-and-help/backlog
* Developer Guide: https://github.com/travel-and-help/start-kit/wiki/Developer-Guide

Building
---------
[Once you have set up your environment](https://github.com/travel-and-help/start-kit/wiki/Developer-Guide), just run:

    npm start

Running tests
-------------
To execute all unit tests, use:

    npm run test:unit

To execute end-to-end (e2e) tests, use:

    npm run test:e2e

To learn more about npm scripts, use [npm scripts guide](https://docs.npmjs.com/misc/scripts)


text:
namespace TeraPacketParser.Messages
{
    public class S_LEAVE_PRIVATE_CHANNEL : ParsedMessage
    {
        public uint Id { get; private set; }
        public S_LEAVE_PRIVATE_CHANNEL(TeraMessageReader reader) : base(reader)
        {
            Id = reader.ReadUInt32();
        }
    }
}


text:
CREATE TABLE GSPANOTHER.FILE_TBL (
  FILE_ID NUMBER NOT NULL,
  FILE_NAME VARCHAR(30) NOT NULL,
  CONTENT BLOB,
  PRIMARY KEY (FILE_ID)
);


text:
set -e
set -o pipefail

source "setup-secrets.sh"

PROVIDER=aws vagrant "$@"


text:
<?php

namespace Hrms\Bundle\EmployeeBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * HrmCompanynotification
 *
 * @ORM\Table(name="hrm_companynotification")
 * @ORM\Entity
 */
class HrmCompanynotification
{
    /**
     * @var boolean
     *
     * @ORM\Column(name="birthday", type="boolean", nullable=true)
     */
    private $birthday;

    /**
     * @var boolean
     *
     * @ORM\Column(name="contract_end", type="boolean", nullable=true)
     */
    private $contractEnd;

    /**
     * @var boolean
     *
     * @ORM\Column(name="notification_status", type="boolean", nullable=true)
     */
    private $notificationStatus;

    /**
     * @var boolean
     *
     * @ORM\Column(name="emp_add", type="boolean", nullable=true)
     */
    private $empAdd;

    /**
     * @var boolean
     *
     * @ORM\Column(name="emp_modify", type="boolean", nullable=true)
     */
    private $empModify;

    /**
     * @var boolean
     *
     * @ORM\Column(name="emp_remove", type="boolean", nullable=true)
     */
    private $empRemove;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="add_date", type="datetime", nullable=false)
     */
    private $addDate;

    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var \Hrms\Bundle\EmployeeBundle\Entity\HrmEmployee
     *
     * @ORM\ManyToOne(targetEntity="Hrms\Bundle\EmployeeBundle\Entity\HrmEmployee")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="employee", referencedColumnName="id")
     * })
     */
    private $employee;

    /**
     * @var \Hrms\Bundle\EmployeeBundle\Entity\HrmCompany
     *
     * @ORM\ManyToOne(targetEntity="Hrms\Bundle\EmployeeBundle\Entity\HrmCompany")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="company", referencedColumnName="id")
     * })
     */
    private $company;

    /**
     * Set birthday
     *
     * @param boolean $birthday
     * @return HrmCompanynotification
     */
    public function setBirthday($birthday)
    {
        $this->birthday = $birthday;

        return $this;
    }

    /**
     * Get birthday
     *
     * @return boolean
     */
    public function getBirthday()
    {
        return $this->birthday;
    }

    /**
     * Set contractEnd
     *
     * @param boolean $contractEnd
     * @return HrmCompanynotification
     */
    public function setContractEnd($contractEnd)
    {
        $this->contractEnd = $contractEnd;

        return $this;
    }

    /**
     * Get contractEnd
     *
     * @return boolean
     */
    public function getContractEnd()
    {
        return $this->contractEnd;
    }

    /**
     * Set notificationStatus
     *
     * @param boolean $notificationStatus
     * @return HrmCompanynotification
     */
    public function setNotificationStatus($notificationStatus)
    {
        $this->notificationStatus = $notificationStatus;

        return $this;
    }

    /**
     * Get notificationStatus
     *
     * @return boolean
     */
    public function getNotificationStatus()
    {
        return $this->notificationStatus;
    }

    /**
     * Set empAdd
     *
     * @param boolean $empAdd
     * @return HrmCompanynotification
     */
    public function setEmpAdd($empAdd)
    {
        $this->empAdd = $empAdd;

        return $this;
    }

    /**
     * Get empAdd
     *
     * @return boolean
     */
    public function getEmpAdd()
    {
        return $this->empAdd;
    }

    /**
     * Set empModify
     *
     * @param boolean $empModify
     * @return HrmCompanynotification
     */
    public function setEmpModify($empModify)
    {
        $this->empModify = $empModify;

        return $this;
    }

    /**
     * Get empModify
     *
     * @return boolean
     */
    public function getEmpModify()
    {
        return $this->empModify;
    }

    /**
     * Set empRemove
     *
     * @param boolean $empRemove
     * @return HrmCompanynotification
     */
    public function setEmpRemove($empRemove)
    {
        $this->empRemove = $empRemove;

        return $this;
    }

    /**
     * Get empRemove
     *
     * @return boolean
     */
    public function getEmpRemove()
    {
        return $this->empRemove;
    }

    /**
     * Set addDate
     *
     * @param \DateTime $addDate
     * @return HrmCompanynotification
     */
    public function setAddDate($addDate)
    {
        $this->addDate = $addDate;

        return $this;
    }

    /**
     * Get addDate
     *
     * @return \DateTime
     */
    public function getAddDate()
    {
        return $this->addDate;
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set employee
     *
     * @param \Hrms\Bundle\EmployeeBundle\Entity\HrmEmployee $employee
     * @return HrmCompanynotification
     */
    public function setEmployee(\Hrms\Bundle\EmployeeBundle\Entity\HrmEmployee $employee = null)
    {
        $this->employee = $employee;

        return $this;
    }

    /**
     * Get employee
     *
     * @return \Hrms\Bundle\EmployeeBundle\Entity\HrmEmployee
     */
    public function getEmployee()
    {
        return $this->employee;
    }

    /**
     * Set company
     *
     * @param \Hrms\Bundle\EmployeeBundle\Entity\HrmCompany $company
     * @return HrmCompanynotification
     */
    public function setCompany(\Hrms\Bundle\EmployeeBundle\Entity\HrmCompany $company = null)
    {
        $this->company = $company;

        return $this;
    }

    /**
     * Get company
     *
     * @return \Hrms\Bundle\EmployeeBundle\Entity\HrmCompany
     */
    public function getCompany()
    {
        return $this->company;
    }
}


text:
<?php

// No direct access
defined('_HZEXEC_') or die();

$this->css();
?>
<div class="item-watch <?php echo $this->watched ? 'watching' : ''; ?>">
	<?php if ($this->watched) { ?>

			<a class="btn unsubscribe" href="<?php echo Route::url($this->publication->link('version') . '&active=watch&confirm=1&action=unsubscribe'); ?>"><?php echo Lang::txt('PLG_PUBLICATIONS_WATCH_UNSUBSCRIBE'); ?>

	<?php } else { ?>

			<a class="btn subscribe" href="<?php echo Route::url($this->publication->link('version') . '&active=watch&confirm=1&action=subscribe'); ?>"><?php echo Lang::txt('PLG_PUBLICATIONS_WATCH_SUBSCRIBE'); ?>

	<?php } ?>

		<?php echo Lang::txt('PLG_PUBLICATIONS_WATCH_EXPLAIN'); ?>


text:
module Lostag
  module Resources
    VERSION = 20032014
  end
end


text:
<?php
$servername = "...";
$username = "...";
$password = "...";
$dbname = "...";
$mydate=getdate(date("U"));
$name=$_POST['rtname'];
$ip=$_SERVER['REMOTE_ADDR'];

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

$sql = "DELETE FROM Players LIMIT 1";

$sql01 = "INSERT INTO Log (Time, Message)
        VALUES ('$mydate[year]-$mydate[mon]-$mydate[mday] $mydate[hours]-$mydate[minutes]-$mydate[seconds]', 'LuisGPlays has deleted the top name from the list.')";

if ($conn->query($sql) === TRUE) {
    echo "New record created successfully";
    $conn->query($sql01);
} else {
    echo "Error: " . $sql . "
" . $conn->error;
}

$conn->close();
?>

If not redirected automatically, click here.

    <?php header("Location: dashboard.php"); ?>


text:
<?php
// auto-generated by sfDatabaseConfigHandler
// date: 2014/09/06 19:59:05

return array(
'doctrine' => new sfDoctrineDatabase(array (
  'dsn' => 'mysql:host=localhost;dbname=educenter_db',
  'username' => 'root',
  'password' => 'sunshine',
  'attributes' =>
  array (
    'DEFAULT_TABLE_TYPE' => 'INNODB',
    'DEFAULT_TABLE_CHARSET' => 'utf8',
    'DEFAULT_TABLE_COLLATE' => 'utf8_general_ci',
  ),
  'name' => 'doctrine',
)),);


text:
package main

import (
	"encoding/base64"
	"encoding/json"
	"flag"
	"fmt"
	"html/template"
	"log"
	"net/http"
	"path/filepath"
	"time"
	"strings"

	"github.com/julienschmidt/httprouter"
	"github.com/karrick/godirwalk"
)

var videosPath string
var bindAddr string
var omx string
var p Player

// Page is the HTML page struct
type Page struct {
	Title     string
	Timestamp int64
}

// Video struct contains has two fields:
// filename and base32 hash of the filepath
type Video struct {
	File string `json:"file"`
	Hash string `json:"hash"`
}

// Index func that serves the HTML for the home page
func Index(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
	p := &Page{Title: "go-omxremote", Timestamp: time.Now().Unix()}
	tmpl, err := FSString(false, "/views/index.html")
	if err != nil {
		fmt.Println(err.Error())
	}

	t, _ := template.New("index").Parse(tmpl)
	t.Execute(w, p)
}

// List function - outputs json with all video files in the videoPath
func List(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
	var files []*Video
	var root = videosPath
	_ = godirwalk.Walk(root, &godirwalk.Options{
		Unsorted: true, // set true for faster yet non-deterministic enumeration (see godoc)
		Callback: func(osPathname string, de *godirwalk.Dirent) error {
			if de.IsDir() == false {
				if filepath.Ext(osPathname) == ".mkv" || filepath.Ext(osPathname) == ".mp4" || filepath.Ext(osPathname) == ".avi" {
					files = append(files, &Video{File: filepath.Base(osPathname), Hash: base64.URLEncoding.EncodeToString([]byte(osPathname))})
				}
			}
			return nil
		},
		ErrorCallback: func(osPathname string, err error) godirwalk.ErrorAction {
			return godirwalk.SkipNode
		},
	})

	encoder := json.NewEncoder(w)
	encoder.Encode(files)
}

// Start playback http handler
func Start(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
	log.Printf("Start %s", ps.ByName("name"))
	filename, _ := base64.URLEncoding.DecodeString(ps.ByName("name"))
	stringFilename := string(filename[:])
	omxOptions := append(strings.Split(omx, " "), stringFilename)

	err := p.Start(omxOptions)
	if err != nil {
		p.Playing = false
		http.Error(w, err.Error(), 500)
		return
	}

	log.Printf("Playing media file: %s\n", stringFilename)
	w.WriteHeader(http.StatusOK)
}

// SendCommand is the HTTP handler for sending a command to the player
func SendCommand(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
	err := p.SendCommand(ps.ByName("command"))
	if err != nil {
		log.Println(err.Error())
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	w.WriteHeader(http.StatusOK)
}

func main() {
	flag.StringVar(&videosPath, "media", ".", "Path to look for videos in")
	flag.StringVar(&bindAddr, "bind", ":31415", "Address to bind on.")
	flag.StringVar(&omx, "omx", "-o hdmi", "Options to pass to omxplayer")
	flag.Parse()

	router := httprouter.New()
	router.GET("/", Index)
	router.GET("/files.json", List)

	router.POST("/start/:name", Start)
	router.POST("/player/:command", SendCommand)

	router.ServeFiles("/dist/*filepath", FS(false))
	log.Fatal(http.ListenAndServe(bindAddr, router))
}


text:
package edu.pdx.cs410J.family;

import java.io.*;
import java.text.*;
import java.util.*;

/**
 * This class parses the text output generated by a
 * TextDumper and creates a family tree.
 *
 * @see TextDumper
 */
public class TextParser implements Parser {

  private LineNumberReader in;     // Read input from here
  private FamilyTree tree;         // The family tree we're building

  ///////////////////////  Static Methods  ///////////////////////

  private static final PrintStream out = System.out;

  private static void db(String s) {
    if (Boolean.getBoolean("TextParser.DEBUG")) {
      out.println(s);
    }
  }

  ////////////////////////  Constructors  ////////////////////////

  /**
   * Creates a new text parser that reads its input from a file of a
   * given name.
   */
  public TextParser(String fileName) throws FileNotFoundException{
    this(new File(fileName));
  }

  /**
   * Creates a new text parser that reads its input from the given
   * file.
   */
  public TextParser(File file) throws FileNotFoundException {
    this(new FileReader(file));
  }

  /**
   * Creates a new text parser that reads its input from the given
   * writer.  This lets us read from a sources other than files.
   */
  public TextParser(Reader reader) {
    this.in = new LineNumberReader(reader);
  }

  //////////////////////  Instance Methods  //////////////////////

  /**
   * Helper method that creates an error string and throws a
   * FamilyTreeException.
   */
  private void error(String message) throws FamilyTreeException {
    int lineNumber = this.in.getLineNumber();
    String m = "Error at line " + lineNumber + ": " + message;
    throw new FamilyTreeException(m);
  }

  /**
   * Parses the specified input source and from it creates a family
   * tree.
   *
   * @throws FamilyTreeException
   *         The data source is malformatted
   */
  public FamilyTree parse() throws FamilyTreeException {
    this.tree = new FamilyTree();

    // Examine each line of the file.  The first line should contain a
    // header of the form "x n" where "x" is either "P" or "M" and "n"
    // is the number of lines the entry takes up.  Parse this header
    // and delegate the responsibility for constructing objects to
    // other methods.

    try {
      while (this.in.ready()) {
	String line = this.in.readLine();

	// Ignore empty lines
        if (line == null) {
          break;

        } else if(line.equals("")) {
	  continue;
	}

        db("Read line: \"" + line + "\"");

	// Parse the header line
	String type = null;
	String nLines = null;
	StringTokenizer st = new StringTokenizer(line, " ");
	if(st.hasMoreTokens()) {
	  type = st.nextToken();

	} else {
	  error("Missing type token in header");
	}

	if(st.hasMoreTokens()) {
	  nLines = st.nextToken();

	} else {
	  error("Missing line count in header");
	}

	try {
	  int n = Integer.parseInt(nLines);
	  if (type.equals("P")) {
	    this.parsePerson(n);

	  } else if (type.equals("M")) {
	    this.parseMarriage(n);

	  } else {
	    error("Invalid type string: " + type);
	  }

	} catch (NumberFormatException ex) {
	  error("Malformatted line count: " + nLines);
	}

      }

    } catch (IOException ex) {
      int lineNumber = this.in.getLineNumber();
      String m = "Parsing error at line " + lineNumber;
      throw new FamilyTreeException(m);
    }

    // Okay, we're all done parsing the tree now we need to "patch up"
    // the Person objects to make sure that their mothers and fathers
    // all exist.
    Iterator people = this.tree.getPeople().iterator();
    while (people.hasNext()) {
      Person person = (Person) people.next();
      person.patchUp(this.tree);
    }

    return this.tree;
  }

  /**
   * Helper method that parses the source, creates a
   * Person, and adds it to the family tree.
   */
  private void parsePerson(int nLines) throws FamilyTreeException {
    Person person = null;

    DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM);

    for (int i = 0; i < nLines; i++) {
      String line = null;
      try {
	if(!this.in.ready()) {
	  // The reader should be ready, Houston we have a problem!
	  error("Unexpected end of file");
	}

	line = this.in.readLine();

      } catch (IOException ex) {
	error("IOException: " + ex.getMessage());
      }

      if (line == null) {
        break;
      }

      // Ignore empty lines
      if (line.equals("")) {
	continue;
      }

      db("Read line: \"" + line + "\"");

      // Parse the line
      String key = null;
      String value = null;

      StringTokenizer st = new StringTokenizer(line, ":");

      if (st.hasMoreTokens()) {
	key = st.nextToken();

      } else {
	error("No key specified");
      }

      if (st.hasMoreTokens()) {
	StringBuffer sb = new StringBuffer();
	while(st.hasMoreTokens()) {
	  sb.append(st.nextToken() + " ");
	}
	value = sb.toString().trim();

      } else {
	error("No value specified");
      }

      // Now do a "switch" on the key and parse the value
      // appropriately
      if (key.equals("id")) {
	// id
	try {
	  int id = Integer.parseInt(value);
          if (this.tree.getPerson(id) != null) {
            error("FamilyTree already has person " + id);

          } else {
            // Call this Person constructor because we will fill in
            // the gender later
            person = new Person(id);
            this.tree.addPerson(person);
          }

	} catch (NumberFormatException ex) {
	  error("Malformatted id: " + value);
	}

      } else if (key.equals("g")) {
        // gender
        if (person != null) {
          try {
            Person.Gender gender = Person.Gender.valueOf(value);
            person.setGender(gender);
            db("Set gender of " + person + " to " + gender);

          } catch (IllegalArgumentException ex) {
            error("Malformed gender: " + value);
          }

        } else {
          error("Id must be specified before gender");
        }

      } else if (key.equals("fn")) {
	// firstName
	if(person != null) {
	  person.setFirstName(value);

	} else {
	  error("Id must be specified before first name");
	}

      } else if (key.equals("mn")) {
	// middleName
	if(person != null) {
	  person.setMiddleName(value);

	} else {
	  error("Id must be specified before middle name");
	}

      } else if (key.equals("ln")) {
	// lastName
	if(person != null) {
	  person.setLastName(value);

	} else {
	  error("Id must be specified before last name");
	}

      } else if (key.equals("f")) {
	// father
	if(person != null) {
	  try {
	    int fatherId  = Integer.parseInt(value);
	    person.setFatherId(fatherId);

	  } catch (NumberFormatException ex) {
	    error("Malformatted father id: " + value);
	  }

	} else {
	  error("Id must be specified before father");
	}

      } else if (key.equals("m")) {
	// mother
	if(person != null) {
	  try {
	    int motherId = Integer.parseInt(value);
	    person.setMotherId(motherId);

	  } catch (NumberFormatException ex) {
	    error("Malformatted mother id: " + value);
	  }

	} else {
	  error("Id must be specified before mother");
	}

      } else if (key.equals("dob")) {
	// date of birth
	if(person != null) {
	  try {
	    person.setDateOfBirth(df.parse(value));

	  } catch (ParseException ex) {
	    error("Malformatted date of birth: " + value);
	  }

	} else {
	  error("Id must be specified before date of birth");
	}

      } else if (key.equals("dod")) {
	// date of death
	if(person != null) {
	  try {
	    person.setDateOfDeath(df.parse(value));

	  } catch (ParseException ex) {
	    error("Malformatted date of death: " + value);
	  }

	} else {
	  error("Id must be specified before date of death");
	}

      } else {
	error("Unknown person key: " + key);
      }
    }
  }

  /**
   * Helper method that parses the source and create marriages.
   */
  private void parseMarriage(int nLines) throws FamilyTreeException {
    Marriage marriage = null;

    DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM);

    if (nLines < 1) {
      error("Missing ids in marriage");
    }

    String line = null;
    try {
      if (!this.in.ready()) {
	// The reader should be ready, Houston we have a problem!
	error("Unexpected end of file");
      }

      line = this.in.readLine();

    } catch (IOException ex) {
      error("IOException: " + ex.getMessage());
    }

    // The first line should be the id of the husband followed by the
    // id of the wife
    Person husband = null;
    Person wife = null;
    StringTokenizer st = new StringTokenizer(line, " ");
    if (st.hasMoreTokens()) {
      String s = st.nextToken();
      try {
	int husbandId = Integer.parseInt(s);
	husband = this.tree.getPerson(husbandId);

      } catch (NumberFormatException ex) {
	error("Malformatted husband id: " + s);
      }

    } else {
      error("Missing husband id");
    }

    if (st.hasMoreTokens()) {
      String s = st.nextToken();
      try {
	int wifeId = Integer.parseInt(s);
	wife = this.tree.getPerson(wifeId);

      } catch (NumberFormatException ex) {
	error("Malformatted wife id: " + s);
      }

    } else {
      error("Missing wife id");
    }

    marriage = new Marriage(husband, wife);
    wife.addMarriage(marriage);
    husband.addMarriage(marriage);

    // Parse the rest
    for (int i = 1; i < nLines; i++) {
      line = null;
      try {
	if(!this.in.ready()) {
	  // The reader should be ready, Houston we have a problem!
	  error("Unexpected end of file");
	}

        line = this.in.readLine();

      } catch (IOException ex) {
        error("IOException: " + ex.getMessage());
      }

      // Ignore empty lines
      if (line.equals("")) {
        continue;
      }

      // Parse the line
      String key = null;
      String value = null;

      st = new StringTokenizer(line, ":");

      if (st.hasMoreTokens()) {
        key = st.nextToken();

      } else {
        error("No key specified");
      }

      if (st.hasMoreTokens()) {
        StringBuffer sb = new StringBuffer();
        while (st.hasMoreTokens()) {
          sb.append(st.nextToken() + " ");
        }
        value = sb.toString().trim();

      } else {
        error("No value specified for key " + key);
      }

      // Now do a "switch" on the key and parse the value
      // appropriately
      if (key.equals("d")) {
	// date
	try {
	  marriage.setDate(df.parse(value));

	} catch (ParseException ex) {
	  error("Malformatted marriage date: " + value);
	}

      } else if (key.equals("l")) {
	marriage.setLocation(value);

      } else {
	error("Unknown marriage key: " + key);
      }
    }
  }

  /**
   * Test program.  Parse the file that is given on the command line.
   * Pretty print the resulting family tree.
   */
  public static void main(String[] args) {
    if (args.length == 0) {
      System.err.println("** Missing file name");
      System.exit(1);
    }

    // Parse the input file
    String fileName = args[0];
    try {
      TextParser parser = new TextParser(fileName);
      FamilyTree tree = parser.parse();

      PrintWriter out = new PrintWriter(System.out, true);
      PrettyPrinter pretty = new PrettyPrinter(out);
      pretty.dump(tree);

    } catch (FileNotFoundException ex) {
      System.err.println("** Could not find file " + fileName);

    } catch (FamilyTreeException ex) {
      System.err.println("** " + ex.getMessage());
    }
  }

}


text:
require 'rdf'

module Seek
  module Ontologies

    class TechnologyTypeReader < OntologyReader

      def default_parent_class_uri
        RDF::URI.new(Seek::Config.technology_type_base_uri)
      end

      def ontology_file
        Seek::Config.technology_type_ontology_file
      end

    end
  end
end


text:
package routers

import (
	"u3d_update/controllers"

	"github.com/astaxie/beego"
)

func init() {
	beego.Router("/", &controllers.MainController{})

	u3d := new(controllers.U3DController)
	beego.Router("/u3d3/ver/:platform", u3d, "get:GetVer")
}


text:
package gojq

import (
	"encoding/json"
	"errors"
	"fmt"
	"math/big"
	"reflect"
)

type expectedObjectError struct {
	v interface{}
}

func (err *expectedObjectError) Error() string {
	return fmt.Sprintf("expected an object but got: %s", typeErrorPreview(err.v))
}

type expectedArrayError struct {
	v interface{}
}

func (err *expectedArrayError) Error() string {
	return fmt.Sprintf("expected an array but got: %s", typeErrorPreview(err.v))
}

type iteratorError struct {
	v interface{}
}

func (err *iteratorError) Error() string {
	return fmt.Sprintf("cannot iterate over: %s", typeErrorPreview(err.v))
}

type arrayIndexTooLargeError struct {
	v interface{}
}

func (err *arrayIndexTooLargeError) Error() string {
	return fmt.Sprintf("array index too large: %s", previewValue(err.v))
}

type objectKeyNotStringError struct {
	v interface{}
}

func (err *objectKeyNotStringError) Error() string {
	return fmt.Sprintf("expected a string for object key but got: %s", typeErrorPreview(err.v))
}

type arrayIndexNotNumberError struct {
	v interface{}
}

func (err *arrayIndexNotNumberError) Error() string {
	return fmt.Sprintf("expected a number for indexing an array but got: %s", typeErrorPreview(err.v))
}

type expectedStartEndError struct {
	v interface{}
}

func (err *expectedStartEndError) Error() string {
	return fmt.Sprintf(`expected "start" and "end" for slicing but got: %s`, typeErrorPreview(err.v))
}

type inputNotAllowedError struct {
}

func (*inputNotAllowedError) Error() string {
	return "input(s)/0 is not allowed"
}

type funcNotFoundError struct {
	f *Func
}

func (err *funcNotFoundError) Error() string {
	return fmt.Sprintf("function not defined: %s/%d", err.f.Name, len(err.f.Args))
}

type funcTypeError struct {
	name string
	v    interface{}
}

func (err *funcTypeError) Error() string {
	return fmt.Sprintf("%s cannot be applied to: %s", err.name, typeErrorPreview(err.v))
}

type exitCodeError struct {
	value interface{}
	code  int
	halt  bool
}

func (err *exitCodeError) Error() string {
	if s, ok := err.value.(string); ok {
		return fmt.Sprintf("error: %s", s)
	}
	bs, _ := json.Marshal(normalizeValues(err.value))
	return fmt.Sprintf("error: %s", string(bs))
}

func (err *exitCodeError) IsEmptyError() bool {
	return err.value == nil
}

func (err *exitCodeError) ExitCode() int {
	return err.code
}

type funcContainsError struct {
	l, r interface{}
}

func (err *funcContainsError) Error() string {
	return fmt.Sprintf("cannot check contains(%s): %s", previewValue(err.r), typeErrorPreview(err.l))
}

type hasKeyTypeError struct {
	l, r interface{}
}

func (err *hasKeyTypeError) Error() string {
	return fmt.Sprintf("cannot check wether %s has a key: %s", typeErrorPreview(err.l), typeErrorPreview(err.r))
}

type unaryTypeError struct {
	name string
	v    interface{}
}

func (err *unaryTypeError) Error() string {
	return fmt.Sprintf("cannot %s: %s", err.name, typeErrorPreview(err.v))
}

type binopTypeError struct {
	name string
	l, r interface{}
}

func (err *binopTypeError) Error() string {
	return fmt.Sprintf("cannot %s: %s and %s", err.name, typeErrorPreview(err.l), typeErrorPreview(err.r))
}

type zeroDivisionError struct {
	l, r interface{}
}

func (err *zeroDivisionError) Error() string {
	return fmt.Sprintf("cannot divide %s by: %s", typeErrorPreview(err.l), typeErrorPreview(err.r))
}

type zeroModuloError struct {
	l, r interface{}
}

func (err *zeroModuloError) Error() string {
	return fmt.Sprintf("cannot modulo %s by: %s", typeErrorPreview(err.l), typeErrorPreview(err.r))
}

type formatNotFoundError struct {
	n string
}

func (err *formatNotFoundError) Error() string {
	return fmt.Sprintf("format not defined: %s", err.n)
}

type formatCsvTsvRowError struct {
	typ string
	v   interface{}
}

func (err *formatCsvTsvRowError) Error() string {
	return fmt.Sprintf("invalid %s row: %s", err.typ, typeErrorPreview(err.v))
}

type formatShError struct {
	v interface{}
}

func (err *formatShError) Error() string {
	return fmt.Sprintf("cannot escape for shell: %s", typeErrorPreview(err.v))
}

var errTooManyVariableValues = errors.New("too many variable values provided")

type expectedVariableError struct {
	n string
}

func (err *expectedVariableError) Error() string {
	return fmt.Sprintf("variable defined but not bound: %s", err.n)
}

type variableNotFoundError struct {
	n string
}

func (err *variableNotFoundError) Error() string {
	return fmt.Sprintf("variable not defined: %s", err.n)
}

type variableNameError struct {
	n string
}

func (err *variableNameError) Error() string {
	return "invalid variable name: " + err.n
}

type breakError struct {
	n string
}

func (err *breakError) Error() string {
	return fmt.Sprintf(`label not defined: %q`, err.n)
}

type stringLiteralError struct {
	s string
}

func (err *stringLiteralError) Error() string {
	return fmt.Sprintf("expected a string but got: %s", err.s)
}

type tryEndError struct {
	err error
}

func (err *tryEndError) Error() string {
	return err.err.Error()
}

type invalidPathError struct {
	v interface{}
}

func (err *invalidPathError) Error() string {
	return fmt.Sprintf("invalid path against: %s", typeErrorPreview(err.v))
}

type invalidPathIterError struct {
	v interface{}
}

func (err *invalidPathIterError) Error() string {
	return fmt.Sprintf("invalid path on iterating against: %s", typeErrorPreview(err.v))
}

type getpathError struct {
	v, path interface{}
}

func (err *getpathError) Error() string {
	return fmt.Sprintf("cannot getpath with %s against: %s", previewValue(err.path), typeErrorPreview(err.v))
}

type queryParseError struct {
	typ, fname, contents string
	err                  error
}

func (err *queryParseError) QueryParseError() (string, string, string, error) {
	return err.typ, err.fname, err.contents, err.err
}

func (err *queryParseError) Error() string {
	return fmt.Sprintf("invalid %s: %s: %s", err.typ, err.fname, err.err)
}

type jsonParseError struct {
	fname, contents string
	err             error
}

func (err *jsonParseError) JSONParseError() (string, string, error) {
	return err.fname, err.contents, err.err
}

func (err *jsonParseError) Error() string {
	return fmt.Sprintf("invalid json: %s: %s", err.fname, err.err)
}

func typeErrorPreview(v interface{}) string {
	p := preview(v)
	if p != "" {
		p = " (" + p + ")"
	}
	return typeof(v) + p
}

func typeof(v interface{}) (s string) {
	if v == nil {
		return "null"
	}
	k := reflect.TypeOf(v).Kind()
	switch k {
	case reflect.Array, reflect.Slice:
		return "array"
	case reflect.Map:
		return "object"
	case reflect.Bool:
		return "boolean"
	case reflect.Int, reflect.Uint, reflect.Float64:
		return "number"
	case reflect.String:
		return "string"
	case reflect.Ptr:
		if _, ok := v.(*big.Int); ok {
			return "number"
		}
		return "ptr"
	default:
		return k.String()
	}
}

func preview(v interface{}) string {
	if v == nil {
		return ""
	}
	s, err := encodeJSON(v)
	if err != nil {
		return ""
	}
	if l := 25; len(s) > l {
		s = s[:l-3] + " ..."
	}
	return s
}

func previewValue(v interface{}) string {
	if v == nil {
		return "null"
	}
	return preview(v)
}


text:
template void do_test_spots<double, boost::ulong_long_type>(double, boost::ulong_long_type);
#endif


text:
namespace peloton {
namespace expression {

// Evaluates the arguments in order and returns the current value of the first
// expression that initially does not evaluate to NULL.
class CoalesceExpression : public AbstractExpression {
 public:
  typedef std::unique_ptr<AbstractExpression> AbstractExprPtr;
  CoalesceExpression(ValueType vt, std::vector<AbstractExprPtr> &expressions)
      : AbstractExpression(EXPRESSION_TYPE_OPERATOR_COALESCE, vt),
        expressions_(std::move(expressions)) {}

  Value Evaluate(const AbstractTuple *tuple1, const AbstractTuple *tuple2,
                 executor::ExecutorContext *context) const override {
    for (auto &expression : expressions_) {
      auto result = expression->Evaluate(tuple1, tuple2, context);
      if (result.IsNull()) continue;
      return result;
    }

    return Value::GetNullValue(GetValueType());
  }

  std::string DebugInfo(const std::string &spacer) const override {
    return spacer + "CoalesceExpression";
  }

  AbstractExpression *Copy() const override {
    std::vector<AbstractExprPtr> copied_expression;
    for (auto &expression : expressions_) {
      if (expression == nullptr) {
        continue;
      }
      copied_expression.push_back(AbstractExprPtr(expression->Copy()));
    }

    return new CoalesceExpression(GetValueType(), copied_expression);
  }

 private:
  // Expression arguments
  std::vector<AbstractExprPtr> expressions_;
};

}  // End expression namespace
}  // End peloton namespace


text:
Reduction examples and tutorial
===============================

Here are some examples and different repositories using `ccdproc`.

* `Extended guide to image calibration using ccdproc`_
* `ipython notebook`_
* `WHT basic reductions`_
* `pyhrs`_
* `reduceccd`_
* `astrolib`_
* `mont4k_reduction`_ *Processes multi-image-extension FITS files*

.. _Extended guide to image calibration using ccdproc: https://mwcraig.github.io/ccd-as-book/00-00-Preface
.. _ipython notebook: http://nbviewer.ipython.org/gist/mwcraig/06060d789cc298bbb08e
.. _WHT basic reductions: https://github.com/crawfordsm/wht_reduction_scripts/blob/master/wht_basic_reductions.py
.. _pyhrs: https://github.com/saltastro/pyhrs
.. _reduceccd: https://github.com/rgbIAA/reduceccd
.. _astrolib: https://github.com/yucelkilic/astrolib
.. _mont4k_reduction: https://github.com/bjweiner/ARTN/tree/master/mont4k_pipeline


text:
struct Pool *pool_new(int maxSize, void *(*create) (), void (*free) (void *)) {
    struct PoolInt *p = (struct PoolInt *) malloc(sizeof (struct PoolInt));
    if (p) {
        memset(p, 0, sizeof (struct PoolInt));
        list_init(&p->list);
        pthread_mutex_init(&p->mutex, NULL);
        p->maxSize = maxSize < 1 ? 1 : maxSize;
        p->create = create;
        p->free = free;
    }
    return &p->pool;
}


text:
module ThinController
  module Command
    class Base
      include ThinController::Command::HasController

    end
  end
end


text:
package com.amazonaws.services.iotanalytics.model;

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 *

 * An activity that adds data from the IoT device registry to your message.
 *

 *
 * @see AWS API Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DeviceRegistryEnrichActivity implements Serializable, Cloneable, StructuredPojo {

    /**
     *

     * The name of the deviceRegistryEnrich activity.
     *

     */
    private String name;
    /**
     *

     * The name of the attribute that is added to the message.
     *

     */
    private String attribute;
    /**
     *

     * The name of the IoT device whose registry information is added to the message.
     *

     */
    private String thingName;
    /**
     *

     * The ARN of the role that allows access to the device's registry information.
     *

     */
    private String roleArn;
    /**
     *

     * The next activity in the pipeline.
     *

     */
    private String next;

    /**
     *

     * The name of the deviceRegistryEnrich activity.
     *

     *
     * @param name
     *        The name of the deviceRegistryEnrich activity.
     */

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

    /**
     *

     * The name of the deviceRegistryEnrich activity.
     *

     *
     * @return The name of the deviceRegistryEnrich activity.
     */

    public String getName() {
        return this.name;
    }

    /**
     *

     * The name of the deviceRegistryEnrich activity.
     *

     *
     * @param name
     *        The name of the deviceRegistryEnrich activity.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DeviceRegistryEnrichActivity withName(String name) {
        setName(name);
        return this;
    }

    /**
     *

     * The name of the attribute that is added to the message.
     *

     *
     * @param attribute
     *        The name of the attribute that is added to the message.
     */

    public void setAttribute(String attribute) {
        this.attribute = attribute;
    }

    /**
     *

     * The name of the attribute that is added to the message.
     *

     *
     * @return The name of the attribute that is added to the message.
     */

    public String getAttribute() {
        return this.attribute;
    }

    /**
     *

     * The name of the attribute that is added to the message.
     *

     *
     * @param attribute
     *        The name of the attribute that is added to the message.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DeviceRegistryEnrichActivity withAttribute(String attribute) {
        setAttribute(attribute);
        return this;
    }

    /**
     *

     * The name of the IoT device whose registry information is added to the message.
     *

     *
     * @param thingName
     *        The name of the IoT device whose registry information is added to the message.
     */

    public void setThingName(String thingName) {
        this.thingName = thingName;
    }

    /**
     *

     * The name of the IoT device whose registry information is added to the message.
     *

     *
     * @return The name of the IoT device whose registry information is added to the message.
     */

    public String getThingName() {
        return this.thingName;
    }

    /**
     *

     * The name of the IoT device whose registry information is added to the message.
     *

     *
     * @param thingName
     *        The name of the IoT device whose registry information is added to the message.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DeviceRegistryEnrichActivity withThingName(String thingName) {
        setThingName(thingName);
        return this;
    }

    /**
     *

     * The ARN of the role that allows access to the device's registry information.
     *

     *
     * @param roleArn
     *        The ARN of the role that allows access to the device's registry information.
     */

    public void setRoleArn(String roleArn) {
        this.roleArn = roleArn;
    }

    /**
     *

     * The ARN of the role that allows access to the device's registry information.
     *

     *
     * @return The ARN of the role that allows access to the device's registry information.
     */

    public String getRoleArn() {
        return this.roleArn;
    }

    /**
     *

     * The ARN of the role that allows access to the device's registry information.
     *

     *
     * @param roleArn
     *        The ARN of the role that allows access to the device's registry information.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DeviceRegistryEnrichActivity withRoleArn(String roleArn) {
        setRoleArn(roleArn);
        return this;
    }

    /**
     *

     * The next activity in the pipeline.
     *

     *
     * @param next
     *        The next activity in the pipeline.
     */

    public void setNext(String next) {
        this.next = next;
    }

    /**
     *

     * The next activity in the pipeline.
     *

     *
     * @return The next activity in the pipeline.
     */

    public String getNext() {
        return this.next;
    }

    /**
     *

     * The next activity in the pipeline.
     *

     *
     * @param next
     *        The next activity in the pipeline.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DeviceRegistryEnrichActivity withNext(String next) {
        setNext(next);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getName() != null)
            sb.append("Name: ").append(getName()).append(",");
        if (getAttribute() != null)
            sb.append("Attribute: ").append(getAttribute()).append(",");
        if (getThingName() != null)
            sb.append("ThingName: ").append(getThingName()).append(",");
        if (getRoleArn() != null)
            sb.append("RoleArn: ").append(getRoleArn()).append(",");
        if (getNext() != null)
            sb.append("Next: ").append(getNext());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof DeviceRegistryEnrichActivity == false)
            return false;
        DeviceRegistryEnrichActivity other = (DeviceRegistryEnrichActivity) obj;
        if (other.getName() == null ^ this.getName() == null)
            return false;
        if (other.getName() != null && other.getName().equals(this.getName()) == false)
            return false;
        if (other.getAttribute() == null ^ this.getAttribute() == null)
            return false;
        if (other.getAttribute() != null && other.getAttribute().equals(this.getAttribute()) == false)
            return false;
        if (other.getThingName() == null ^ this.getThingName() == null)
            return false;
        if (other.getThingName() != null && other.getThingName().equals(this.getThingName()) == false)
            return false;
        if (other.getRoleArn() == null ^ this.getRoleArn() == null)
            return false;
        if (other.getRoleArn() != null && other.getRoleArn().equals(this.getRoleArn()) == false)
            return false;
        if (other.getNext() == null ^ this.getNext() == null)
            return false;
        if (other.getNext() != null && other.getNext().equals(this.getNext()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
        hashCode = prime * hashCode + ((getAttribute() == null) ? 0 : getAttribute().hashCode());
        hashCode = prime * hashCode + ((getThingName() == null) ? 0 : getThingName().hashCode());
        hashCode = prime * hashCode + ((getRoleArn() == null) ? 0 : getRoleArn().hashCode());
        hashCode = prime * hashCode + ((getNext() == null) ? 0 : getNext().hashCode());
        return hashCode;
    }

    @Override
    public DeviceRegistryEnrichActivity clone() {
        try {
            return (DeviceRegistryEnrichActivity) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

    @com.amazonaws.annotation.SdkInternalApi
    @Override
    public void marshall(ProtocolMarshaller protocolMarshaller) {
        com.amazonaws.services.iotanalytics.model.transform.DeviceRegistryEnrichActivityMarshaller.getInstance().marshall(this, protocolMarshaller);
    }
}


text:
<?php
require_once "vendor/autoload.php";
use Blog\Post;

require_once "db_connection.php";

$post = new Post($connection);
$posts = $post->getAllPosts();

require_once "public/view/index.view.php";


text:
using UnityEngine;

namespace Fungus
{
    public class EnumFlagAttribute : PropertyAttribute
    {
        public string enumName;

        public EnumFlagAttribute() { }

        public EnumFlagAttribute(string name)
        {
            enumName = name;
        }
    }
}


text:
@interface TestRouteRegistry : NSObject

@end


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>NodeInitializer (Hazelcast Root 3.3.3 API)</title>
<meta name="date" content="2014-11-12">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.hazelcast.instance

Interface NodeInitializer

All Known Implementing Classes:

DefaultNodeInitializer

public interface NodeInitializer

Method Summary

Methods

Modifier and Type
Method and Description

void
afterInitialize(Node node)

void
beforeInitialize(Node node)

PacketReader
createPacketReader(TcpIpConnection connection,
                  IOService ioService)

PacketWriter
createPacketWriter(TcpIpConnection connection,
                  IOService ioService)

void
destroy()

MemberSocketInterceptor
getMemberSocketInterceptor()

Storage<DataRef>
getOffHeapStorage()

SecurityContext
getSecurityContext()

SocketChannelWrapperFactory
getSocketChannelWrapperFactory()

WanReplicationService
geWanReplicationService()

void
printNodeInfo(Node node)

Method Detail

beforeInitialize

void beforeInitialize(Node node)

printNodeInfo

void printNodeInfo(Node node)

afterInitialize

void afterInitialize(Node node)

getSecurityContext

SecurityContext getSecurityContext()

getOffHeapStorage

Storage<DataRef> getOffHeapStorage()

geWanReplicationService

WanReplicationService geWanReplicationService()

getMemberSocketInterceptor

MemberSocketInterceptor getMemberSocketInterceptor()

getSocketChannelWrapperFactory

SocketChannelWrapperFactory getSocketChannelWrapperFactory()

createPacketReader

PacketReader createPacketReader(TcpIpConnection connection,
                              IOService ioService)

createPacketWriter

PacketWriter createPacketWriter(TcpIpConnection connection,
                              IOService ioService)

destroy

void destroy()

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright © 2014 Hazelcast, Inc.. All Rights Reserved.


text:
/*	$NetBSD: coda_vnops.h,v 1.4 1998/09/15 02:03:00 rvb Exp $	*/

/*
 *
 *             Coda: an Experimental Distributed File System
 *                              Release 3.1
 *
 *           Copyright (c) 1987-1998 Carnegie Mellon University
 *                          All Rights Reserved
 *
 * Permission  to  use, copy, modify and distribute this software and its
 * documentation is hereby granted,  provided  that  both  the  copyright
 * notice  and  this  permission  notice  appear  in  all  copies  of the
 * software, derivative works or  modified  versions,  and  any  portions
 * thereof, and that both notices appear in supporting documentation, and
 * that credit is given to Carnegie Mellon University  in  all  documents
 * and publicity pertaining to direct or indirect use of this code or its
 * derivatives.
 *
 * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS  KNOWN  TO  HAVE  BUGS,
 * SOME  OF  WHICH MAY HAVE SERIOUS CONSEQUENCES.  CARNEGIE MELLON ALLOWS
 * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.   CARNEGIE  MELLON
 * DISCLAIMS  ANY  LIABILITY  OF  ANY  KIND  FOR  ANY  DAMAGES WHATSOEVER
 * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE  OR  OF
 * ANY DERIVATIVE WORK.
 *
 * Carnegie  Mellon  encourages  users  of  this  software  to return any
 * improvements or extensions that  they  make,  and  to  grant  Carnegie
 * Mellon the rights to redistribute these changes without encumbrance.
 *
 * 	@(#) coda/coda_vnops.h,v 1.1.1.1 1998/08/29 21:26:46 rvb Exp $
 */

/*
 * Mach Operating System
 * Copyright (c) 1990 Carnegie-Mellon University
 * Copyright (c) 1989 Carnegie-Mellon University
 * All rights reserved.  The CMU software License Agreement specifies
 * the terms and conditions for use and redistribution.
 */

/*
 * This code was written for the Coda file system at Carnegie Mellon
 * University.  Contributers include David Steere, James Kistler, and
 * M. Satyanarayanan.
 */

/*
 * HISTORY
 * $Log: coda_vnops.h,v $
 * Revision 1.4  1998/09/15 02:03:00  rvb
 * Final piece of rename cfs->coda
 *
 * Revision 1.3  1998/09/12 15:05:49  rvb
 * Change cfs/CFS in symbols, strings and constants to coda/CODA
 * to avoid fs conflicts.
 *
 * Revision 1.2  1998/09/08 17:12:48  rvb
 * Pass2 complete
 *
 * Revision 1.1.1.1  1998/08/29 21:26:46  rvb
 * Very Preliminary Coda
 *
 * Revision 1.7  1998/08/28 18:12:24  rvb
 * Now it also works on FreeBSD -current.  This code will be
 * committed to the FreeBSD -current and NetBSD -current
 * trees.  It will then be tailored to the particular platform
 * by flushing conditional code.
 *
 * Revision 1.6  1998/08/18 17:05:22  rvb
 * Don't use __RCSID now
 *
 * Revision 1.5  1998/08/18 16:31:47  rvb
 * Sync the code for NetBSD -current; test on 1.3 later
 *
 * Revision 1.4  98/01/23  11:53:49  rvb
 * Bring RVB_CODA1_1 to HEAD
 *
 * Revision 1.3.2.3  98/01/23  11:21:13  rvb
 * Sync with 2.2.5
 *
 * Revision 1.3.2.2  97/12/16  12:40:20  rvb
 * Sync with 1.3
 *
 * Revision 1.3.2.1  97/12/10  14:08:34  rvb
 * Fix O_ flags; check result in coda_call
 *
 * Revision 1.3  97/12/05  10:39:25  rvb
 * Read CHANGES
 *
 * Revision 1.2.34.2  97/11/20  11:46:54  rvb
 * Capture current coda_venus
 *
 * Revision 1.2.34.1  97/11/13  22:03:04  rvb
 * pass2 cfs_NetBSD.h mt
 *
 * Revision 1.2  96/01/02  16:57:14  bnoble
 * Added support for Coda MiniCache and raw inode calls (final commit)
 *
 * Revision 1.1.2.1  1995/12/20 01:57:40  bnoble
 * Added Coda-specific files
 *
 */

/* NetBSD interfaces to the vnodeops */
int coda_open      __P((void *));
int coda_close     __P((void *));
int coda_read      __P((void *));
int coda_write     __P((void *));
int coda_ioctl     __P((void *));
/* 1.3 int coda_select    __P((void *));*/
int coda_getattr   __P((void *));
int coda_setattr   __P((void *));
int coda_access    __P((void *));
int coda_abortop   __P((void *));
int coda_readlink  __P((void *));
int coda_fsync     __P((void *));
int coda_inactive  __P((void *));
int coda_lookup    __P((void *));
int coda_create    __P((void *));
int coda_remove    __P((void *));
int coda_link      __P((void *));
int coda_rename    __P((void *));
int coda_mkdir     __P((void *));
int coda_rmdir     __P((void *));
int coda_symlink   __P((void *));
int coda_readdir   __P((void *));
int coda_bmap      __P((void *));
int coda_strategy  __P((void *));
int coda_reclaim   __P((void *));
int coda_lock      __P((void *));
int coda_unlock    __P((void *));
int coda_islocked  __P((void *));
int coda_vop_error   __P((void *));
int coda_vop_nop     __P((void *));

int (**coda_vnodeop_p)(void *);
int coda_rdwr(struct vnode *vp, struct uio *uiop, enum uio_rw rw,
    int ioflag, struct ucred *cred, struct proc *p);

int coda_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp);
void print_vattr(struct vattr *attr);
void print_cred(struct ucred *cred);


text:
/*
============================================================================
  The Ohio State University Research Foundation, The University of Chicago -
  Argonne National Laboratory, Emory University, SemanticBits LLC,
  and Ekagra Software Technologies Ltd.

  Distributed under the OSI-approved BSD 3-Clause License.
  See http://ncip.github.com/cagrid-portal/LICENSE.txt for details.
============================================================================
*/
create table ActivityTracker (
	activityTrackerId bigint not null primary key,
	groupId bigint,
	companyId bigint,
	userId bigint,
	userName varchar(75) null,
	createDate timestamp null,
	classNameId bigint,
	classPK bigint,
	activity varchar(75) null,
	extraData varchar null,
	receiverUserId bigint,
	receiverUserName varchar(75) null
);

alter table BlogsEntry add uuid_ varchar(75) null;

alter table BookmarksEntry add uuid_ varchar(75) null;

alter table BookmarksFolder add uuid_ varchar(75) null;

alter table CalEvent add uuid_ varchar(75) null;

alter table DLFileEntry add uuid_ varchar(75) null;

alter table DLFileShortcut add uuid_ varchar(75) null;

alter table DLFolder add uuid_ varchar(75) null;

update Group_ set type_ = '0' where type_ is null;
update Group_ set type_ = '0' where type_ = '';
update Group_ set type_ = '1' where type_ = 'COMMUNITY_OPEN';
update Group_ set type_ = '2' where type_ = 'COMMUNITY_RESTRICTED';
update Group_ set type_ = '3' where type_ = 'COMMUNITY_CLOSED';
update Group_ set type_ = '3' where type_ = '0';

alter table IGFolder add uuid_ varchar(75) null;

alter table IGImage add uuid_ varchar(75) null;

alter table JournalArticle add uuid_ varchar(75) null;
alter table JournalArticle add smallImage boolean;
alter table JournalArticle add smallImageId bigint;
alter table JournalArticle add smallImageURL varchar(75) null;

alter table JournalArticleImage add uuid_ varchar(75) null;

create table JournalFeed (
	uuid_ varchar(75) null,
	id_ bigint not null primary key,
	groupId bigint,
	companyId bigint,
	userId bigint,
	userName varchar(75) null,
	createDate timestamp null,
	modifiedDate timestamp null,
	feedId varchar(75) null,
	name varchar(75) null,
	description varchar null,
	type_ varchar(75) null,
	structureId varchar(75) null,
	templateId varchar(75) null,
	rendererTemplateId varchar(75) null,
	delta int,
	orderByCol varchar(75) null,
	orderByType varchar(75) null,
	targetLayoutFriendlyUrl varchar(75) null,
	targetPortletId varchar(75) null,
	contentField varchar(75) null,
	feedType varchar(75) null,
	feedVersion float
);

alter table JournalStructure add uuid_ varchar(75) null;

alter table JournalTemplate add uuid_ varchar(75) null;
alter table JournalTemplate add cacheable boolean;

commit;

update JournalTemplate set cacheable = TRUE;

alter table MBCategory add uuid_ varchar(75) null;

alter table MBMessage add uuid_ varchar(75) null;

create table MembershipRequest (
	membershipRequestId bigint not null primary key,
	companyId bigint,
	userId bigint,
	createDate timestamp null,
	groupId bigint,
	comments varchar null,
	replyComments varchar null,
	replyDate timestamp null,
	replierUserId bigint,
	statusId int
);

alter table PollsChoice add uuid_ varchar(75) null;

alter table PollsQuestion add uuid_ varchar(75) null;

alter table TagsAsset add groupId bigint;
alter table TagsAsset add priority float;
alter table TagsAsset add viewCount int;

commit;

update TagsAsset set priority = 0, viewCount = 0;

alter table User_ add uuid_ varchar(75) null;

create table WebDAVProps (
	webDavPropsId bigint not null primary key,
	companyId bigint,
	createDate timestamp null,
	modifiedDate timestamp null,
	classNameId bigint,
	classPK bigint,
	props varchar null
);

alter table WikiNode add uuid_ varchar(75) null;

alter table WikiPage add uuid_ varchar(75) null;


text:
<?php
class Login extends CI_Controller {

        function __construct(){
		parent::__construct();
	}

        public function index($msg = NULL)
        {
            $data['msg'] = $msg;
            if($this->session->userdata('username')){
                redirect('home');
            }else{
                $this->load->view('login', $data);
            }

        }
        public function process(){
            // Load the model
		$this->load->model('Login_model');
		// Validate the user can login
		$result = $this->Login_model->validate();
		// Now we verify the result
		if(! $result){
			// If user did not validate, then show them login page again
			$msg = 'Invalid username and/or password.
';
			$this->index($msg);
		}else{
			if($this->session->userdata('role') == 'admin'){
                            redirect('admin/home');
                        }else{
                            redirect('home');
                        }

		}
        }
}


text:
[![Style Checking](https://styleci.io/repos/49147985/shield)](https://styleci.io/analyses/zRpW9X)

Template Engine to empowered Style Guide Driven Development

## TODO

 * Foreach data


text:
{-# LANGUAGE TypeSynonymInstances #-}

module Graphics.Rendering.OpenGL.GL.CoordTrans (
   -- * Controlling the Viewport
   depthRange,
   Position(..), Size(..), viewport, maxViewportDims,

   -- * Matrices
   MatrixMode(..), matrixMode,
   MatrixOrder(..), MatrixComponent(rotate,translate,scale), Matrix(..),
   matrix, multMatrix, GLmatrix, loadIdentity,
   ortho, frustum, depthClamp,
   activeTexture,
   preservingMatrix, unsafePreservingMatrix,
   stackDepth, maxStackDepth,

   -- * Normal Transformation
   rescaleNormal, normalize,

   -- * Generating Texture Coordinates
   Plane(..), TextureCoordName(..), TextureGenMode(..), textureGenMode
) where

import Foreign.ForeignPtr
import Foreign.Marshal.Alloc
import Foreign.Marshal.Array
import Foreign.Marshal.Utils
import Foreign.Ptr
import Foreign.Storable
import Graphics.Rendering.OpenGL.GL.StateVar
import Graphics.Rendering.OpenGL.GL.Tensor
import Graphics.Rendering.OpenGL.GL.Capability
import Graphics.Rendering.OpenGL.GL.Exception
import Graphics.Rendering.OpenGL.GL.PeekPoke
import Graphics.Rendering.OpenGL.GL.QueryUtils
import Graphics.Rendering.OpenGL.GL.Texturing.TextureUnit
import Graphics.Rendering.OpenGL.GLU.ErrorsInternal
import Graphics.Rendering.OpenGL.Raw

--------------------------------------------------------------------------------

-- | After clipping and division by /w/, depth coordinates range from -1 to 1,
-- corresponding to the near and far clipping planes. 'depthRange' specifies a
-- linear mapping of the normalized depth coordinates in this range to window
-- depth coordinates. Regardless of the actual depth buffer implementation,
-- window coordinate depth values are treated as though they range from 0
-- through 1 (like color components). Thus, the values accepted by 'depthRange'
-- are both clamped to this range before they are accepted.
--
-- The initial setting of (0, 1) maps the near plane to 0 and the far plane to
-- 1. With this mapping, the depth buffer range is fully utilized.
--
-- It is not necessary that the near value be less than the far value. Reverse
-- mappings such as (1, 0) are acceptable.

depthRange :: StateVar (GLclampd, GLclampd)
depthRange = makeStateVar (getClampd2 (,) GetDepthRange) (uncurry glDepthRange)

--------------------------------------------------------------------------------

-- | A 2-dimensional position, measured in pixels.
data Position = Position !GLint !GLint
   deriving ( Eq, Ord, Show )

-- | A 2-dimensional size, measured in pixels.
data Size = Size !GLsizei !GLsizei
   deriving ( Eq, Ord, Show )

-- | Controls the affine transformation from normalized device coordinates to
-- window coordinates. The viewport state variable consists of the coordinates
-- (/x/, /y/) of the lower left corner of the viewport rectangle, (in pixels,
-- initial value (0,0)), and the size (/width/, /height/) of the viewport. When
-- a GL context is first attached to a window, /width/ and /height/ are set to
-- the dimensions of that window.
--
-- Let (/xnd/, /ynd/) be normalized device coordinates. Then the window
-- coordinates (/xw/, /yw/) are computed as follows:
--
-- /xw/ = (/xnd/ + 1) (/width/  \/ 2) + /x/
--
-- /yw/ = (/ynd/ + 1) (/heigth/ \/ 2) + /y/
--
-- Viewport width and height are silently clamped to a range that depends on the
-- implementation, see 'maxViewportDims'.

viewport :: StateVar (Position, Size)
viewport = makeStateVar (getInteger4 makeVp GetViewport)
                        (\(Position x y, Size w h) -> glViewport x y w h)
   where makeVp x y w h = (Position x y, Size (fromIntegral w) (fromIntegral h))

-- | The implementation-dependent maximum viewport width and height.

maxViewportDims :: GettableStateVar Size
maxViewportDims = makeGettableStateVar (getSizei2 Size GetMaxViewportDims)

--------------------------------------------------------------------------------

-- | A matrix stack.

data MatrixMode =
     Modelview GLsizei  -- ^ The modelview matrix stack of the specified vertex unit.
   | Projection         -- ^ The projection matrix stack.
   | Texture            -- ^ The texture matrix stack.
   | Color              -- ^ The color matrix stack.
   | MatrixPalette      -- ^ The matrix palette stack.
   deriving ( Eq, Ord, Show )

marshalMatrixMode :: MatrixMode -> Maybe GLenum
marshalMatrixMode x = case x of
   Modelview i -> modelviewIndexToEnum i
   Projection -> Just gl_PROJECTION
   Texture -> Just gl_TEXTURE
   Color -> Just gl_COLOR
   MatrixPalette -> Just gl_MATRIX_PALETTE

unmarshalMatrixMode :: GLenum -> MatrixMode
unmarshalMatrixMode x
   | x == gl_PROJECTION = Projection
   | x == gl_TEXTURE = Texture
   | x == gl_COLOR = Color
   | x == gl_MATRIX_PALETTE = MatrixPalette
   | otherwise =
        case modelviewEnumToIndex x of
           Just i -> Modelview i
           Nothing -> error ("unmarshalMatrixMode: illegal value " ++ show x)

matrixModeToGetMatrix :: MatrixMode -> PNameMatrix
matrixModeToGetMatrix x = case x of
   Modelview _   -> GetModelviewMatrix -- ???
   Projection    -> GetProjectionMatrix
   Texture       -> GetTextureMatrix
   Color         -> GetColorMatrix
   MatrixPalette -> GetMatrixPalette

matrixModeToGetStackDepth :: MatrixMode -> PName1I
matrixModeToGetStackDepth x =  case x of
   Modelview _   -> GetModelviewStackDepth
   Projection    -> GetProjectionStackDepth
   Texture       -> GetTextureStackDepth
   Color         -> GetColorMatrixStackDepth
   MatrixPalette -> error "matrixModeToGetStackDepth: impossible"

matrixModeToGetMaxStackDepth :: MatrixMode -> PName1I
matrixModeToGetMaxStackDepth x = case x of
   Modelview _    -> GetMaxModelviewStackDepth
   Projection     -> GetMaxProjectionStackDepth
   Texture        -> GetMaxTextureStackDepth
   Color          -> GetMaxColorMatrixStackDepth
   MatrixPalette  -> GetMaxMatrixPaletteStackDepth

--------------------------------------------------------------------------------

-- | Controls which matrix stack is the target for subsequent matrix operations.
-- The initial value is ('Modelview' 0).

matrixMode :: StateVar MatrixMode
matrixMode =
   makeStateVar (getEnum1 unmarshalMatrixMode GetMatrixMode)
                (maybe recordInvalidValue glMatrixMode . marshalMatrixMode)

--------------------------------------------------------------------------------

data MatrixOrder = ColumnMajor | RowMajor
   deriving ( Eq, Ord, Show )

--------------------------------------------------------------------------------

class Storable c => MatrixComponent c where
   getMatrix :: GetPNameMatrix p => p -> Ptr c -> IO ()
   loadMatrix :: Ptr c -> IO ()
   loadTransposeMatrix :: Ptr c -> IO ()
   multMatrix_ :: Ptr c -> IO ()
   multTransposeMatrix :: Ptr c -> IO ()
   rotate :: c -> Vector3 c -> IO ()
   translate :: Vector3 c -> IO ()
   scale :: c -> c -> c -> IO ()

instance MatrixComponent GLfloat where
   getMatrix = getMatrixf
   loadMatrix = glLoadMatrixf
   loadTransposeMatrix = glLoadTransposeMatrixf
   multMatrix_ = glMultMatrixf
   multTransposeMatrix = glMultTransposeMatrixf
   rotate a (Vector3 x y z) = glRotatef a x y z
   translate (Vector3 x y z) = glTranslatef x y z
   scale = glScalef

instance MatrixComponent GLdouble where
   getMatrix = getMatrixd
   loadMatrix = glLoadMatrixd
   loadTransposeMatrix = glLoadTransposeMatrixd
   multMatrix_ = glMultMatrixd
   multTransposeMatrix = glMultTransposeMatrixd
   rotate a (Vector3 x y z) = glRotated a x y z
   translate (Vector3 x y z) = glTranslated x y z
   scale = glScaled

--------------------------------------------------------------------------------

class Matrix m where
   -- | Create a new matrix of the given order (containing undefined elements)
   -- and call the action to fill it with 4x4 elements.
   withNewMatrix ::
      MatrixComponent c => MatrixOrder -> (Ptr c -> IO ()) -> IO (m c)

   -- | Call the action with the given matrix. /Note:/ The action is /not/
   -- allowed to modify the matrix elements!
   withMatrix ::
      MatrixComponent c => m c -> (MatrixOrder -> Ptr c -> IO a) -> IO a

   newMatrix :: MatrixComponent c => MatrixOrder -> [c] -> IO (m c)
   getMatrixComponents :: MatrixComponent c => MatrixOrder -> m c -> IO [c]

   withNewMatrix order act =
      allocaArray 16 $ \p -> do
         act p
         components <- peekArray 16 p
         newMatrix order components

   withMatrix mat act = do
      components <- getMatrixComponents ColumnMajor mat
      withArray components $ act ColumnMajor

   newMatrix order components =
      withNewMatrix order $ flip pokeArray (take 16 components)

   getMatrixComponents desiredOrder mat =
      withMatrix mat $ \order p ->
        if desiredOrder == order
           then peekArray 16 p
           else mapM (peekElemOff p) [ 0, 4,  8, 12,
                                       1, 5,  9, 13,
                                       2, 6, 10, 14,
                                       3, 7, 11, 15 ]

--------------------------------------------------------------------------------

matrix :: (Matrix m, MatrixComponent c) => Maybe MatrixMode -> StateVar (m c)
matrix maybeMode =
   makeStateVar
      (maybe (get matrixMode) return maybeMode >>= (getMatrix' . matrixModeToGetMatrix))
      (maybe id withMatrixMode maybeMode . setMatrix)

withMatrixMode :: MatrixMode -> IO a -> IO a
withMatrixMode mode act =
   preservingMatrixMode $ do
      matrixMode $= mode
      act

getMatrix' :: (Matrix m, MatrixComponent c) => PNameMatrix -> IO (m c)
getMatrix' = withNewMatrix ColumnMajor . getMatrix

setMatrix :: (Matrix m, MatrixComponent c) => m c -> IO ()
setMatrix mat =
   withMatrix mat $ \order ->
      case order of
         ColumnMajor -> loadMatrix
         RowMajor    -> loadTransposeMatrix

multMatrix :: (Matrix m, MatrixComponent c) => m c -> IO ()
multMatrix mat =
   withMatrix mat $ \order ->
      case order of
         ColumnMajor -> multMatrix_
         RowMajor    -> multTransposeMatrix

--------------------------------------------------------------------------------

data GLmatrix a = GLmatrix MatrixOrder (ForeignPtr a)
   deriving ( Eq, Ord, Show )

instance Matrix GLmatrix where
   withNewMatrix order f = do
      fp <- mallocForeignPtrArray 16
      withForeignPtr fp f
      return $ GLmatrix order fp

   withMatrix (GLmatrix order fp) f = withForeignPtr fp (f order)

--------------------------------------------------------------------------------

loadIdentity :: IO ()
loadIdentity = glLoadIdentity

--------------------------------------------------------------------------------

ortho :: GLdouble -> GLdouble -> GLdouble -> GLdouble -> GLdouble -> GLdouble -> IO ()
ortho = glOrtho

frustum :: GLdouble -> GLdouble -> GLdouble -> GLdouble -> GLdouble -> GLdouble -> IO ()
frustum = glFrustum

--------------------------------------------------------------------------------

depthClamp :: StateVar Capability
depthClamp = makeCapability CapDepthClamp

--------------------------------------------------------------------------------

activeTexture :: StateVar TextureUnit
activeTexture = makeStateVar (getEnum1 unmarshalTextureUnit GetActiveTexture)
                             (glActiveTexture . marshalTextureUnit)

--------------------------------------------------------------------------------

-- | Push the current matrix stack down by one, duplicating the current matrix,
-- excute the given action, and pop the current matrix stack, replacing the
-- current matrix with the one below it on the stack (i.e. restoring it to its
-- previous state). The returned value is that of the given action. Note that
-- a round-trip to the server is probably required. For a more efficient
-- version, see 'unsafePreservingMatrix'.

preservingMatrix :: IO a -> IO a
preservingMatrix = unsafePreservingMatrix . preservingMatrixMode

-- performance paranoia: No (un-)marshaling by avoiding matrixMode
preservingMatrixMode :: IO a -> IO a
preservingMatrixMode = bracket (getEnum1 id GetMatrixMode) glMatrixMode . const

-- | A more efficient, but potentially dangerous version of 'preservingMatrix':
-- The given action is not allowed to throw an exception or change the
-- current matrix mode permanently.

unsafePreservingMatrix :: IO a -> IO a
unsafePreservingMatrix = unsafeBracket_ glPushMatrix glPopMatrix

--------------------------------------------------------------------------------

stackDepth :: Maybe MatrixMode -> GettableStateVar GLsizei
stackDepth maybeMode =
   makeGettableStateVar $
      case maybeMode of
         Nothing -> getSizei1 id GetCurrentMatrixStackDepth -- only with ARB_fragment_program
         Just MatrixPalette -> do recordInvalidEnum ; return 0
         Just mode -> getSizei1 id (matrixModeToGetStackDepth mode)

maxStackDepth :: MatrixMode -> GettableStateVar GLsizei
maxStackDepth =
   makeGettableStateVar . getSizei1 id . matrixModeToGetMaxStackDepth

--------------------------------------------------------------------------------

-- | If 'rescaleNormal' contains 'Enabled', normal vectors specified with
-- 'Graphics.Rendering.OpenGL.GL.VertexSpec.normal' are scaled by a scaling
-- factor derived from the modelview matrix. 'rescaleNormal' requires that the
-- originally specified normals were of unit length, and that the modelview
-- matrix contains only uniform scales for proper results. The initial value of
-- 'rescaleNormal' is 'Disabled'.

rescaleNormal :: StateVar Capability
rescaleNormal = makeCapability CapRescaleNormal

-- | If 'normalize' contains 'Enabled', normal vectors specified with
-- 'Graphics.Rendering.OpenGL.GL.VertexSpec.normal' are scaled to unit length
-- after transformation. The initial value of 'normalize' is 'Disabled'.

normalize :: StateVar Capability
normalize = makeCapability CapNormalize

--------------------------------------------------------------------------------

data Plane a = Plane !a !a !a !a
   deriving ( Eq, Ord, Show )

instance Storable a => Storable (Plane a) where
   sizeOf    ~(Plane a _ _ _) = 4 * sizeOf a
   alignment ~(Plane a _ _ _) = alignment a
   peek                       = peek4 Plane . castPtr
   poke ptr   (Plane a b c d) = poke4 (castPtr ptr) a b c d

--------------------------------------------------------------------------------

data TextureCoordName =
     S
   | T
   | R
   | Q
   deriving ( Eq, Ord, Show )

marshalTextureCoordName :: TextureCoordName -> GLenum
marshalTextureCoordName x = case x of
   S -> gl_S
   T -> gl_T
   R -> gl_R
   Q -> gl_Q

--------------------------------------------------------------------------------

data TextureGenParameter =
     TextureGenMode
   | ObjectPlane
   | EyePlane

marshalTextureGenParameter :: TextureGenParameter -> GLenum
marshalTextureGenParameter x = case x of
   TextureGenMode -> gl_TEXTURE_GEN_MODE
   ObjectPlane -> gl_OBJECT_PLANE
   EyePlane -> gl_EYE_PLANE

--------------------------------------------------------------------------------

data TextureGenMode' =
     EyeLinear'
   | ObjectLinear'
   | SphereMap'
   | NormalMap'
   | ReflectionMap'

marshalTextureGenMode' :: TextureGenMode' -> GLint
marshalTextureGenMode' x = fromIntegral $ case x of
   EyeLinear' -> gl_EYE_LINEAR
   ObjectLinear' -> gl_OBJECT_LINEAR
   SphereMap' -> gl_SPHERE_MAP
   NormalMap' -> gl_NORMAL_MAP
   ReflectionMap' -> gl_REFLECTION_MAP

unmarshalTextureGenMode' :: GLint -> TextureGenMode'
unmarshalTextureGenMode' x
   | y == gl_EYE_LINEAR = EyeLinear'
   | y == gl_OBJECT_LINEAR = ObjectLinear'
   | y == gl_SPHERE_MAP = SphereMap'
   | y == gl_NORMAL_MAP = NormalMap'
   | y == gl_REFLECTION_MAP = ReflectionMap'
   | otherwise = error ("unmarshalTextureGenMode': illegal value " ++ show x)
   where y = fromIntegral x

--------------------------------------------------------------------------------

data TextureGenMode =
     EyeLinear    (Plane GLdouble)
   | ObjectLinear (Plane GLdouble)
   | SphereMap
   | NormalMap
   | ReflectionMap
   deriving ( Eq, Ord, Show )

marshalTextureGenMode :: TextureGenMode -> GLint
marshalTextureGenMode = marshalTextureGenMode' . convertMode
   where convertMode (EyeLinear    _) = EyeLinear'
         convertMode (ObjectLinear _) = ObjectLinear'
         convertMode SphereMap        = SphereMap'
         convertMode NormalMap        = NormalMap'
         convertMode ReflectionMap    = ReflectionMap'

--------------------------------------------------------------------------------

textureGenMode :: TextureCoordName -> StateVar (Maybe TextureGenMode)
textureGenMode coord =
   makeStateVarMaybe
      (return $ textureCoordNameToEnableCap coord)
      (do mode <- getMode coord
          case mode of
             EyeLinear'     -> fmap EyeLinear $ getPlane coord EyePlane
             ObjectLinear'  -> fmap ObjectLinear $ getPlane coord ObjectPlane
             SphereMap'     -> return SphereMap
             NormalMap'     -> return NormalMap
             ReflectionMap' -> return ReflectionMap)
      (\mode -> do
         setMode coord mode
         case mode of
            EyeLinear    plane -> setPlane coord EyePlane    plane
            ObjectLinear plane -> setPlane coord ObjectPlane plane
            _ -> return ())

--------------------------------------------------------------------------------

textureCoordNameToEnableCap :: TextureCoordName -> EnableCap
textureCoordNameToEnableCap coord = case coord of
   S -> CapTextureGenS
   T -> CapTextureGenT
   R -> CapTextureGenR
   Q -> CapTextureGenQ

--------------------------------------------------------------------------------

getMode :: TextureCoordName -> IO TextureGenMode'
getMode coord = alloca $ \buf -> do
   glGetTexGeniv (marshalTextureCoordName coord)
                 (marshalTextureGenParameter TextureGenMode)
                 buf
   peek1 unmarshalTextureGenMode' buf

setMode :: TextureCoordName -> TextureGenMode -> IO ()
setMode coord mode =
   glTexGeni (marshalTextureCoordName coord)
             (marshalTextureGenParameter TextureGenMode)
             (marshalTextureGenMode mode)

--------------------------------------------------------------------------------

getPlane :: TextureCoordName -> TextureGenParameter -> IO (Plane GLdouble)
getPlane coord param = alloca $ \planeBuffer -> do
   glGetTexGendv (marshalTextureCoordName coord)
                 (marshalTextureGenParameter param)
                 (castPtr planeBuffer)
   peek planeBuffer

setPlane :: TextureCoordName -> TextureGenParameter -> Plane GLdouble -> IO ()
setPlane coord param plane =
   with plane $ \planeBuffer ->
      glTexGendv (marshalTextureCoordName coord)
                 (marshalTextureGenParameter param)
                 (castPtr planeBuffer)


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Cryptog. Mycol. 19(3): 188 (1998)

#### Original name
Dendrocorticium nasti Boidin & Gilles

### Remarks
null


text:
package cz.znj.kvr.sw.exp.java.commons.beanutils;

import org.apache.commons.beanutils.ConvertUtils;
import org.junit.Assert;
import org.junit.Test;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.util.Date;
import java.util.List;

public class ConvertUtilsTest
{
	@Test
	public void			testConversions()
	{
		Assert.assertEquals(0, ConvertUtils.convert("0", Integer.class));
		Assert.assertEquals(10, ConvertUtils.convert("10", Integer.class));
		Assert.assertEquals(-10, (int)ConvertUtils.convert("-10", int.class));
		Assert.assertEquals(false, ConvertUtils.convert("false", boolean.class));
		Assert.assertEquals(true, ConvertUtils.convert("true", boolean.class));
		Assert.assertEquals(true, ConvertUtils.convert("1", boolean.class));
		Assert.assertEquals("hello", ConvertUtils.convert("hello", String.class));
		Assert.assertEquals(false, ConvertUtils.convert(0, boolean.class));
		Assert.assertEquals(true, ConvertUtils.convert(1, boolean.class));
		Assert.assertEquals(new Date(36000_000), ConvertUtils.convert("1970-01-01T10:00:00", Date.class));
	}
}


text:
package com.mamu.repository.schema.property.accessor;

import java.lang.reflect.Field;

/**
 * A {@link AbstractGremlinFieldPropertyAccessor} for enum properties that will be mapped with the name (String).
 *
 * @author Johnny
 */
public class GremlinEnumStringFieldPropertyAccessor extends AbstractGremlinFieldPropertyAccessor<String> {

    protected Class<? extends Enum> numnum;

    public GremlinEnumStringFieldPropertyAccessor(Field field, Class<?> numnum) {
        super(field);
        this.numnum = (Class<? extends Enum>) numnum;
    }

    @Override
    public String get(Object object) {

        try {
            Object result = field.get(object);

            if (result == null) {
                return null;
            }
            return result.toString();
        } catch (IllegalAccessException e) {
            throw new IllegalStateException(e.getMessage(), e);
        }
    }

    @Override
    public void set(Object object, String name) {
        try {
            if (name == null) {
                field.set(object, name);
            }
            for (Enum num : numnum.getEnumConstants()) {
                if (num.name().equals(name)) {
                    field.set(object, num);
                    break;
                }
            }
        } catch (IllegalAccessException e) {
            throw new IllegalStateException(e.getMessage(), e);
        }
    }
}


text:
/*
Navicat MySQL Data Transfer

Source Server         : localhost
Source Server Version : 50522
Source Host           : localhost:3306
Source Database       : crawl

Target Server Type    : MYSQL
Target Server Version : 50522
File Encoding         : 65001

Date: 2015-02-18 12:40:47
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for crawl_shiti123
-- ----------------------------
DROP TABLE IF EXISTS `crawl_shiti123`;
CREATE TABLE `crawl_shiti123` (
  `cs_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `gr_id` int(10) unsigned NOT NULL,
  `co_id` int(10) unsigned NOT NULL,
  `cs_title` varchar(255) NOT NULL DEFAULT '',
  `cs_download_url` varchar(255) NOT NULL DEFAULT '',
  `cs_content` text NOT NULL,
  `cs_url` varchar(255) NOT NULL DEFAULT '',
  `cs_status` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `cs_create_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `cs_update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`cs_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;