text:
namespace views {
namespace examples {

class SingleSplitViewExample : public ExampleBase,
                               public SingleSplitViewListener {
 public:
  SingleSplitViewExample();
  virtual ~SingleSplitViewExample();

  // Overridden from ExampleBase:
  virtual void CreateExampleView(View* container) OVERRIDE;

 private:
  virtual bool SplitHandleMoved(SingleSplitView* sender) OVERRIDE;

  SingleSplitView* single_split_view_;

  DISALLOW_COPY_AND_ASSIGN(SingleSplitViewExample);
};

}  // namespace examples
}  // namespace views

#endif  // UI_VIEWS_EXAMPLES_SINGLE_SPLIT_VIEW_EXAMPLE_H_

redpajama_set_name: RedPajamaGithub


text:
class AppCacheDispatcher;
class AudioInputMessageFilter;
class AudioMessageFilter;
class CompositorThread;
class DBMessageFilter;
class DevToolsAgentFilter;
class DomStorageDispatcher;
class GpuChannelHost;
class IndexedDBDispatcher;
class RendererWebKitPlatformSupportImpl;
class SkBitmap;
class VideoCaptureImplManager;
struct ViewMsg_New_Params;
class WebDatabaseObserverImpl;

namespace WebKit {
class WebMediaStreamCenter;
class WebMediaStreamCenterClient;
}

namespace base {
class MessageLoopProxy;
class Thread;
namespace win {
class ScopedCOMInitializer;
}
}

namespace content {
class MediaStreamCenter;
class RenderProcessObserver;
}

namespace v8 {
class Extension;
}

// The RenderThreadImpl class represents a background thread where RenderView
// instances live.  The RenderThread supports an API that is used by its
// consumer to talk indirectly to the RenderViews and supporting objects.
// Likewise, it provides an API for the RenderViews to talk back to the main
// process (i.e., their corresponding WebContentsImpl).
//
// Most of the communication occurs in the form of IPC messages.  They are
// routed to the RenderThread according to the routing IDs of the messages.
// The routing IDs correspond to RenderView instances.
class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread,
                                        public ChildThread,
                                        public GpuChannelHostFactory {
 public:
  static RenderThreadImpl* current();

  RenderThreadImpl();
  // Constructor that's used when running in single process mode.
  explicit RenderThreadImpl(const std::string& channel_name);
  virtual ~RenderThreadImpl();

  // Returns the routing ID of the RenderWidget containing the current script
  // execution context (corresponding to WebFrame::frameForCurrentContext).
  static int32 RoutingIDForCurrentContext();

  // When initializing WebKit, ensure that any schemes needed for the content
  // module are registered properly.  Static to allow sharing with tests.
  static void RegisterSchemes();

  // content::RenderThread implementation:
  virtual bool Send(IPC::Message* msg) OVERRIDE;
  virtual MessageLoop* GetMessageLoop() OVERRIDE;
  virtual IPC::SyncChannel* GetChannel() OVERRIDE;
  virtual std::string GetLocale() OVERRIDE;
  virtual IPC::SyncMessageFilter* GetSyncMessageFilter() OVERRIDE;
  virtual void AddRoute(int32 routing_id,
                        IPC::Channel::Listener* listener) OVERRIDE;
  virtual void RemoveRoute(int32 routing_id) OVERRIDE;
  virtual int GenerateRoutingID() OVERRIDE;
  virtual void AddFilter(IPC::ChannelProxy::MessageFilter* filter) OVERRIDE;
  virtual void RemoveFilter(IPC::ChannelProxy::MessageFilter* filter) OVERRIDE;
  virtual void SetOutgoingMessageFilter(
      IPC::ChannelProxy::OutgoingMessageFilter* filter) OVERRIDE;
  virtual void AddObserver(content::RenderProcessObserver* observer) OVERRIDE;
  virtual void RemoveObserver(
      content::RenderProcessObserver* observer) OVERRIDE;
  virtual void SetResourceDispatcherDelegate(
      content::ResourceDispatcherDelegate* delegate) OVERRIDE;
  virtual void WidgetHidden() OVERRIDE;
  virtual void WidgetRestored() OVERRIDE;
  virtual void EnsureWebKitInitialized() OVERRIDE;
  virtual void RecordUserMetrics(const std::string& action) OVERRIDE;
  virtual base::SharedMemoryHandle HostAllocateSharedMemoryBuffer(
      uint32 buffer_size) OVERRIDE;
  virtual void RegisterExtension(v8::Extension* extension) OVERRIDE;
  virtual bool IsRegisteredExtension(
      const std::string& v8_extension_name) const OVERRIDE;
  virtual void ScheduleIdleHandler(int64 initial_delay_ms) OVERRIDE;
  virtual void IdleHandler() OVERRIDE;
  virtual int64 GetIdleNotificationDelayInMs() const OVERRIDE;
  virtual void SetIdleNotificationDelayInMs(
      int64 idle_notification_delay_in_ms) OVERRIDE;
#if defined(OS_WIN)
  virtual void PreCacheFont(const LOGFONT& log_font) OVERRIDE;
  virtual void ReleaseCachedFonts() OVERRIDE;
#endif

  // content::ChildThread:
  virtual bool IsWebFrameValid(WebKit::WebFrame* frame) OVERRIDE;

  // GpuChannelHostFactory implementation:
  virtual bool IsMainThread() OVERRIDE;
  virtual bool IsIOThread() OVERRIDE;
  virtual MessageLoop* GetMainLoop() OVERRIDE;
  virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() OVERRIDE;
  virtual base::WaitableEvent* GetShutDownEvent() OVERRIDE;
  virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory(
      uint32 size) OVERRIDE;
  virtual int32 CreateViewCommandBuffer(
      int32 surface_id,
      const GPUCreateCommandBufferConfig& init_params) OVERRIDE;

  // Synchronously establish a channel to the GPU plugin if not previously
  // established or if it has been lost (for example if the GPU plugin crashed).
  // If there is a pending asynchronous request, it will be completed by the
  // time this routine returns.
  virtual GpuChannelHost* EstablishGpuChannelSync(
      content::CauseForGpuLaunch) OVERRIDE;

  // These methods modify how the next message is sent.  Normally, when sending
  // a synchronous message that runs a nested message loop, we need to suspend
  // callbacks into WebKit.  This involves disabling timers and deferring
  // resource loads.  However, there are exceptions when we need to customize
  // the behavior.
  void DoNotSuspendWebKitSharedTimer();
  void DoNotNotifyWebKitOfModalLoop();

  // Will be NULL if threaded compositing has not been enabled.
  CompositorThread* compositor_thread() const {
    return compositor_thread_.get();
  }

  AppCacheDispatcher* appcache_dispatcher() const {
    return appcache_dispatcher_.get();
  }

  AudioInputMessageFilter* audio_input_message_filter() {
    return audio_input_message_filter_.get();
  }

  AudioMessageFilter* audio_message_filter() {
    return audio_message_filter_.get();
  }

  // Creates the embedder implementation of WebMediaStreamCenter.
  // The resulting object is owned by WebKit and deleted by WebKit at tear-down.
  WebKit::WebMediaStreamCenter* CreateMediaStreamCenter(
      WebKit::WebMediaStreamCenterClient* client);

  VideoCaptureImplManager* video_capture_impl_manager() const {
    return vc_manager_.get();
  }

  bool plugin_refresh_allowed() const { return plugin_refresh_allowed_; }

  // Get the GPU channel. Returns NULL if the channel is not established or
  // has been lost.
  GpuChannelHost* GetGpuChannel();

  // Returns a MessageLoopProxy instance corresponding to the message loop
  // of the thread on which file operations should be run. Must be called
  // on the renderer's main thread.
  scoped_refptr<base::MessageLoopProxy> GetFileThreadMessageLoopProxy();

  // Causes the idle handler to skip sending idle notifications
  // on the two next scheduled calls, so idle notifications are
  // not sent for at least one notification delay.
  void PostponeIdleNotification();

 private:
  virtual bool OnControlMessageReceived(const IPC::Message& msg) OVERRIDE;

  void Init();

  void OnSetZoomLevelForCurrentURL(const std::string& host, double zoom_level);
  void OnSetCSSColors(const std::vector<CSSColors::CSSColorMapping>& colors);
  void OnCreateNewView(const ViewMsg_New_Params& params);
  void OnTransferBitmap(const SkBitmap& bitmap, int resource_id);
  void OnPurgePluginListCache(bool reload_pages);
  void OnNetworkStateChanged(bool online);
  void OnGetAccessibilityTree();
  void OnTempCrashWithData(const GURL& data);

  void IdleHandlerInForegroundTab();

  // These objects live solely on the render thread.
  scoped_ptr<AppCacheDispatcher> appcache_dispatcher_;
  scoped_ptr<DomStorageDispatcher> dom_storage_dispatcher_;
  scoped_ptr<IndexedDBDispatcher> main_thread_indexed_db_dispatcher_;
  scoped_ptr<RendererWebKitPlatformSupportImpl> webkit_platform_support_;

  // Used on the render thread and deleted by WebKit at shutdown.
  content::MediaStreamCenter* media_stream_center_;

  // Used on the renderer and IPC threads.
  scoped_refptr<DBMessageFilter> db_message_filter_;
  scoped_refptr<AudioInputMessageFilter> audio_input_message_filter_;
  scoped_refptr<AudioMessageFilter> audio_message_filter_;
  scoped_refptr<DevToolsAgentFilter> devtools_agent_message_filter_;

  // Used on multiple threads.
  scoped_refptr<VideoCaptureImplManager> vc_manager_;

  // Used on multiple script execution context threads.
  scoped_ptr<WebDatabaseObserverImpl> web_database_observer_impl_;

  // Initialize COM when using plugins outside the sandbox (Windows only).
  scoped_ptr<base::win::ScopedCOMInitializer> initialize_com_;

  // If true, then a GetPlugins call is allowed to rescan the disk.
  bool plugin_refresh_allowed_;

  // The count of RenderWidgets running through this thread.
  int widget_count_;

  // The count of hidden RenderWidgets running through this thread.
  int hidden_widget_count_;

  // The current value of the idle notification timer delay.
  int64 idle_notification_delay_in_ms_;

  // The number of idle handler calls that skip sending idle notifications.
  int idle_notifications_to_skip_;

  bool suspend_webkit_shared_timer_;
  bool notify_webkit_of_modal_loop_;

  // Timer that periodically calls IdleHandler.
  base::RepeatingTimer<RenderThreadImpl> idle_timer_;

  // The channel from the renderer process to the GPU process.
  scoped_refptr<GpuChannelHost> gpu_channel_;

  // A lazily initiated thread on which file operations are run.
  scoped_ptr<base::Thread> file_thread_;

  // Map of registered v8 extensions. The key is the extension name.
  std::set<std::string> v8_extensions_;

  bool compositor_initialized_;
  scoped_ptr<CompositorThread> compositor_thread_;

  ObserverList<content::RenderProcessObserver> observers_;

  DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl);
};

#endif  // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_


text: If enabled, Dependency-Check will analyze all Node.js package files.


text:
module.exports = class extends require('stream').Writable {
	_write(chunk, encoding, cb) {
		const chunkBuffer = Buffer.from(chunk, encoding);
		if (!this.body) {
			this.body = chunkBuffer;
		} else {
			this.body = Buffer.concat([this.body, chunkBuffer]);
		}
		cb();
	}
};


text:
package com.oculusinfo.tilegen.util

import java.util.Properties

import org.scalatest.FunSuite

class ArgumentParserTestSuite extends FunSuite {
	test("boolean property") {
		val args = Array("-b1", "t", "-b2", "tr", "-b3", "tru", "-b4", "true", "-b5", " true", "-b6", "truely",
		                 "-b7", "y", "-b8", "ye", "-b9", "yes", "-b10", "yes ", "-b11", "yesterday",
		                 "-b12", " -1 ", "-b13", " 0 ", "-b14", " 1 ", "-b15", "1.0")
		val argParser = new ArgumentParser(args)
		assert(true === argParser.getBoolean("b1", ""))
		assert(true === argParser.getBoolean("b2", ""))
		assert(true === argParser.getBoolean("b3", ""))
		assert(true === argParser.getBoolean("b4", ""))
		assert(true === argParser.getBoolean("b5", ""))
		assert(false === argParser.getBoolean("b6", ""))
		assert(true === argParser.getBoolean("b7", ""))
		assert(true === argParser.getBoolean("b8", ""))
		assert(true === argParser.getBoolean("b9", ""))
		assert(true === argParser.getBoolean("b10", ""))
		assert(false === argParser.getBoolean("b11", ""))
		assert(true === argParser.getBoolean("b12", ""))
		assert(false === argParser.getBoolean("b13", ""))
		assert(true === argParser.getBoolean("b14", ""))
		assert(false === argParser.getBoolean("b15", ""))
	}
}


text:
<?xml version="1.0" encoding="UTF-8"?><module codename="org.openide.dialogs">
    <module_version install_time="1416338195273" last="true" origin="installer" specification_version="7.38.1">
        <file crc="807629635" name="config/Modules/org-openide-dialogs.xml"/>
        <file crc="680965614" name="modules/locale/org-openide-dialogs_ja.jar"/>
        <file crc="2248316741" name="modules/locale/org-openide-dialogs_pt_BR.jar"/>
        <file crc="224679047" name="modules/locale/org-openide-dialogs_ru.jar"/>
        <file crc="3826815634" name="modules/locale/org-openide-dialogs_zh_CN.jar"/>
        <file crc="2517916052" name="modules/org-openide-dialogs.jar"/>
    </module_version>
</module>


text:
class InstallPandasException(Exception):
    pass

class APIColumnNameError(Exception):
    pass

class InvalidFrequencyError(Exception):
    pass

class MissingRequiredArgumentError(Exception):
    pass


text:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class T_menu extends MY_Model
{

	protected $_table_name = 'menus'; // table name

	protected $_primary_key = 'id'; // Delete this if value is 'id'

	protected $_primary_filter = 'intval'; // Delete this if value is 'intval'

	protected $_order_by = '';

	protected $_timestamps = FALSE; // Delete this if value is FALSE

	public $rules = array(

		'some_field' => array(

			'field' => '',

			'label' => '',

			'rules' => 'trim',

		),

	);

	public function __construct() {

		parent::__construct();

		$this->table_name = $this->db->dbprefix.$this->_table_name;

	}
	/**
	 * [get_data_by_id Using to get record data base on id record]
	 * @param  string $select [The field want to select]
	 * @param  [type] $id     [The id for record data]
	 * @return [type]         [null || record data]
	 */
	function get_data_by_id($select = "*", $id = null){

		//validate data
		if(!is_null($id) && is_numeric($id)){

			$this->db->where("ID = $id LIMIT 1");

		}
		else{

			return null;

		}

		//select data
		if(strcmp($select, "*") != 0){

			$this->db->select($select);

		} else {

			$this->db->select();

		}

		//query db
		$query = $this->db->get($this->table_name);

		$query = $this->result_data($query);

		//return result
		if (count($query) > 0) {

			return $query[0];

		}
		else {

			return null;

		}

	}

	/**
	 * [get_data_by_property Using get property of record base on any conditions]
	 * @param  [type] $select [The field want to select]
	 * @param  array  $where  [Array conditions]
	 * @param  optional  $limit  [Array or number limit record]
	 * @return [type]         [null || multi record data]
	 */
	function get_data_by_property($select, $where = array(), $limit = null){

		//validate data
		if(!is_null($where) && is_array($where)){

			$this->db->where($where);

		}
		else {

			return null;

		}

		//select data
		if(strcmp($select, "*") != 0) {

			$this->db->select($select);

		}
		else {

			$this->db->select();

		}

		if (isset($limit)) {

			if (is_array($limit)) {

				$this->db->limit(@$limit[0], @$limit[1]);

			}
			else {

				$this->db->limit($limit);

			}

		}

		//query
		$query = $this->db->get($this->table_name);

		//return result
		$query = $this->result_data($query);

		//return result
		if (count($query) > 0) {

			return $query;

		}
		else {

			return null;

		}

	}

	/**
	 * [set_data Using to insert data in table]
	 * @param array   $data   [Array data]
	 * @param integer $result [id || records]
	 */
	function set_data($data = array(), $result = 0){

		if(is_null($data) || !is_array($data)) {

			return null;

		}

		//insert data
		$this->db->insert($this->table_name, $data);

		//get last id
		$id = $this->db->insert_id();

		//return result
		if($result == 0){

			return $id;

		}
		else {

			$user = $this->get_data_by_id("*", $id);

			return $user;

		}

	}

	/**
	 * [update_data_by_id Using update data for a record]
	 * @param  array  $data [data update]
	 * @param  [type] $id   [id of record]
	 * @return [type]       [true || false]
	 */
	function update_data_by_id($data = array(), $id){

		//validate data
		if(is_null($data) || !is_array($data)){

			return null;

		}

		//get data by id
		$this->db->where("id", $id );

		//update
		$this->db->update($this->table_name, $data);

		//return result
		if($this->db->affected_rows() > 0){

			return true;

		}
		else {

			return false;

		}

	}

	/**
	 * [insert_all description]
	 * @param  array  $data [description]
	 * @return [type]       [description]
	 */
	public function insert_all($data = array())
	{

		if(count($data) > 0) {

			return $this->db->insert_batch($this->table_name, $data);

		}
		else {

			return null;

		}

	}

	/**
	 * [update_data_by_property description]
	 * @param  array  $data  [description]
	 * @param  array  $where [description]
	 * @return [type]        [description]
	 */
	function update_data_by_property ($data = array(), $where = array()){

		//validate data
		if(is_null($data) || !is_array($data)){

			return null;

		}

		if(is_null($where) || !is_array($where)){

			return null;

		}

		//get data by condition where
		$this->db->where($where);

		//update data
		$this->db->update($this->table_name, $data);

		//return result
		if($this->db->affected_rows() > 0){

			return true;

		}
		else {

			return false;

		}

	}

	public function get_menu_by_template($select = '*', $where = array())
	{

		$this->load->model('t_menu_loader');

		$target_table = $this->t_menu_loader->table_name;

		$conditions = $this->table_name . '.' . 'id' . '=' . $target_table . '.menu_id';

		$left = 'inner';

		$this->db->join($target_table, $conditions, $left);

		$menus = $this->get_data_by_property($select, $where);

		if (count($menus)) {

			$this->load->model('t_sub_menu');

			foreach ($menus as $key => $menu) {

				$menu_id = @$menu['id'] ? $menu['id'] : $menu['menu_id'];

				$menus[$key]['tmpl_sub_menu_loader'] = $this->t_sub_menu->get_data_by_property('*', array('menu_id' => $menu_id));

			}

		}

		return $menus;

	}

	public function get_sub_menu_by_template($select = '*', $where = array())
	{

		$target_table = $this->db->dbprefix.'sub_menus';

		$conditions = $this->table_name . '.' . 'id' . '=' . $target_table . '.menu_id';

		$left = 'inner';

		$this->db->join($target_table, $conditions, $left);

		$menus = $this->get_data_by_property($select, $where);

		if (count($menus)) {

			$this->load->model('t_sub_menu');

			foreach ($menus as $key => $menu) {

				$menu_id = @$menu['id'] ? $menu['id'] : $menu['menu_id'];

				$menus[$key]['tmpl_sub_menu_loader'] = $this->t_sub_menu->get_data_by_property('*', array('menu_id' => $menu_id));

			}

		}

		return $menus;

	}

}


text:
#ifndef cursor_h
#define cursor_h

#include "common.h"
#include <map>

class Cursor : public ComSingleObject<IAvnCursor, &IID_IAvnCursor>
{
private:
    NSCursor * _native;
    bool _isHidden;
public:
    FORWARD_IUNKNOWN()
    Cursor(NSCursor * cursor, bool isHidden = false)
    {
        _native = cursor;
        _isHidden = isHidden;
    }

    NSCursor* GetNative()
    {
        return _native;
    }

    bool IsHidden ()
    {
        return _isHidden;
    }
};

extern std::map<AvnStandardCursorType, Cursor*> s_cursorMap;
#endif /* cursor_h */


text:
use util::errors::{
    Result,
    Error,
};

use term::terminfo::TermInfo;
use term::terminfo::parm;
use term::terminfo::parm::{
    Param,
    Variables,
};

// String constants correspond to terminfo capnames and are used inside the module for convenience.
const ENTER_CA: &'static str = "smcup";
const EXIT_CA: &'static str = "rmcup";
const SHOW_CURSOR: &'static str = "cnorm";
const HIDE_CURSOR: &'static str = "civis";
const SET_CURSOR: &'static str = "cup";
const CLEAR: &'static str = "clear";
const RESET: &'static str = "sgr0";
const UNDERLINE: &'static str = "smul";
const BOLD: &'static str = "bold";
const BLINK: &'static str = "blink";
const REVERSE: &'static str = "rev";
const SETFG: &'static str = "setaf";
const SETBG: &'static str = "setab";

// Array of terminal capabilities. Used as an iterator to test for functionality.
//
// At the moment all functionality is required, however in the future we should implement optional
// functionality checks so the absence of underlining or reverse video doesn't cause initialization
// to fail.
static CAPABILITIES: &'static [&'static str] = &[
    ENTER_CA,
    EXIT_CA,
    SHOW_CURSOR,
    HIDE_CURSOR,
    SET_CURSOR,
    CLEAR,
    RESET,
    UNDERLINE,
    BOLD,
    REVERSE,
    SETFG,
    SETBG,
];

// Driver capabilities are an enum instead of string constants (there are string constants private
// to the module however, those are only used for naming convenience and disambiguation)
// to take advantage of compile-time type-checking instead of hoping invalid strings aren't passed.
// This allows us to guarantee that driver accesses will succeed. In addition, using an enum means
// Driver doesn't need hard-coded methods for each capability we want to use.
#[allow(dead_code)]
pub enum DevFn {
    EnterCa,
    ExitCa,
    ShowCursor,
    HideCursor,
    SetCursor(usize, usize),
    Clear,
    Reset,
    Underline,
    Bold,
    Blink,
    Reverse,
    SetFg(u8),
    SetBg(u8),
}

impl DevFn {
    fn as_str(&self) -> &'static str {
        match *self {
            DevFn::EnterCa => ENTER_CA,
            DevFn::ExitCa => EXIT_CA,
            DevFn::ShowCursor => SHOW_CURSOR,
            DevFn::HideCursor => HIDE_CURSOR,
            DevFn::SetCursor(..) => SET_CURSOR,
            DevFn::Clear => CLEAR,
            DevFn::Reset => RESET,
            DevFn::Underline => UNDERLINE,
            DevFn::Bold => BOLD,
            DevFn::Blink => BLINK,
            DevFn::Reverse => REVERSE,
            DevFn::SetFg(..) => SETFG,
            DevFn::SetBg(..) => SETBG,
        }
    }
}

pub struct Driver {
    tinfo: &'static TermInfo,
}

lazy_static! {
    static ref TINFO: TermInfo = {
        TermInfo::from_env().unwrap_or({
            TermInfo {
                names: Default::default(),
                bools: Default::default(),
                numbers: Default::default(),
                strings: Default::default(),
            }
        })
    };
}

// Validates and returns a reference to the terminfo database.
//
// If this function returns Ok(..), the contained terminfo database is guaranteed to have the
// functionality found in CAPABILITIES.
//
// If this function returns Err(..), the terminfo database did not contain all the required
// functionality; the error returned will provide more specific detail.
fn get_tinfo() -> Result<&'static TermInfo> {
    let tinfo = &*TINFO;

    for capname in CAPABILITIES {
        if !tinfo.strings.contains_key(*capname) {
            return Err(Error::new(format!("terminal missing capability: '{}'", capname)));
        }
    }
    Ok(tinfo)
}

impl Driver {
    // Creates a new `Driver`
    //
    // If successful, the terminfo database is guaranteed to contain all capabilities we support.
    pub fn new() -> Result<Driver> {
        let tinfo = try!(get_tinfo());
        Ok(Driver {
            tinfo: tinfo,
        })
    }

    // Returns the device specific escape sequence for the given `DevFn`.
    //
    // get() will not return an error, and (in theory) should never panic. The `DevFn` enum
    // restricts possible inputs to a subset that will not fail when passed to `parm::expand()`.
    // This can be verified by examining the source of the `parm::expand()` function in the `term`
    // crate.
    //
    // Furthermore, the pre-flight checks on initialization of `Driver` ensure that every
    // capability is present, thus the call to `Hashmap::get()` should never fail.
    pub fn get(&self, dfn: DevFn) -> Vec<u8> {
        let capname = dfn.as_str();
        let cap = self.tinfo.strings.get(capname).unwrap();

        match dfn {
            DevFn::SetFg(attr) | DevFn::SetBg(attr) => {
                let params = &[Param::Number(attr as i16)];
                let mut vars = Variables::new();
                parm::expand(cap, params, &mut vars).unwrap()
            },
            DevFn::SetCursor(x, y) => {
                let params = &[Param::Number(y as i16), Param::Number(x as i16)];
                let mut vars = Variables::new();
                parm::expand(cap, params, &mut vars).unwrap()
            },
            _ => {
                cap.clone()
            },
        }
    }
}


text:
layout: post
title: What's in Store
cover: brainstorm.png
type: blog
datetime: 1/22/2017
published: true
---

Here are some notes from one of our brainstorming meetings.  We're thinking about what information will be most useful to users, and looking for datasets and visualizations to feature.

What do you want to see on the Resistance Dashboard?  Submit ideas [here](https://docs.google.com/a/graphicacy.com/forms/d/e/1FAIpQLSfsWewwlROipPyvcP_67wPhpPJDhQDFk6qEKDcf2vnkdA1QWw/viewform){:target="_blank"}!


text:
<?php
/**
 * PHP version 5.6
 *
 * This source file is subject to the license that is bundled with this package in the file LICENSE.
 */
namespace Codeup\DomainEvents;

class PersistEventSubscriber implements EventSubscriber
{
    /** @var EventStore */
    private $eventStore;

    /**
     * @param EventStore $eventStore
     */
    public function __construct(EventStore $eventStore)
    {
        $this->eventStore = $eventStore;
    }

    /**
     * @param Event $event
     * @return boolean
     */
    public function isSubscribedTo(Event $event)
    {
        return true;
    }

    /**
     * @param Event $event
     * @return boolean
     */
    public function handle(Event $event)
    {
        $this->eventStore->append($event);
    }
}


text:
package nl.tud.dcs.fddg.game.entities;

import java.io.Serializable;

public class Unit implements Serializable {
    protected int maxHitPoints, attackPower, curHitPoints;
    protected int xPos, yPos;
    protected int unitId;

    public int getHitpoints() {
        return maxHitPoints;
    }

    public void setHitpoints(int hitpoints) {
        this.maxHitPoints = hitpoints;
    }

    public int getAttackPower() {
        return attackPower;
    }

    public void setAttackPower(int attackPower) {
        this.attackPower = attackPower;
    }

    public int getxPos() {
        return xPos;
    }

    public void setxPos(int xPos) {
        this.xPos = xPos;
    }

    public int getyPos() {
        return yPos;
    }

    public void setyPos(int yPos) {
        this.yPos = yPos;
    }

    public int getCurHitPoints() {
        return curHitPoints;
    }

    public void setCurHitPoints(int curHitPoints) {
        this.curHitPoints = curHitPoints;
    }

    public int getUnitId() {
        return unitId;
    }

    public void setUnitId(int unitId) {
        this.unitId = unitId;
    }

    public double getHitPointsPercentage() {
        return (double) curHitPoints / (double) maxHitPoints;
    }
}


text:
from distutils.core import setup, Extension
import numpy

mod = Extension('CorrCoef',
    include_dirs = [numpy.get_include()],
    sources = ['CorrCoef.c'],
    extra_compile_args=['-fopenmp'],
    extra_link_args=['-lgomp']
)

setup (name = 'CorrCoef',
    author = 'Aljoscha Rheinwalt',
    author_email = 'aljoscha.rheinwalt@uni-potsdam.de',
    ext_modules = [mod]
)


text:
package org.elasticsearch.index.mapper;

import org.elasticsearch.common.Strings;
import org.elasticsearch.script.CompositeFieldScript;
import org.elasticsearch.script.LongFieldScript;
import org.elasticsearch.script.Script;
import org.elasticsearch.script.ScriptContext;
import org.elasticsearch.search.lookup.LeafSearchLookup;
import org.elasticsearch.search.lookup.SearchLookup;
import org.elasticsearch.xcontent.XContentBuilder;
import org.elasticsearch.xcontent.XContentType;

import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;

import static org.hamcrest.Matchers.containsString;

public class CompositeRuntimeFieldTests extends MapperServiceTestCase {

    @Override
    @SuppressWarnings("unchecked")
    protected <T> T compileScript(Script script, ScriptContext<T> context) {
        if (context == CompositeFieldScript.CONTEXT) {
            return (T) (CompositeFieldScript.Factory) (fieldName, params, searchLookup) -> ctx -> new CompositeFieldScript(
                fieldName,
                params,
                searchLookup,
                ctx
            ) {
                @Override
                public void execute() {
                    if (script.getIdOrCode().equals("split-str-long")) {
                        List<Object> values = extractFromSource("field");
                        String input = values.get(0).toString();
                        String[] parts = input.split(" ");
                        emit("str", parts[0]);
                        emit("long", parts[1]);
                    }
                }
            };
        }
        if (context == LongFieldScript.CONTEXT) {
            return (T) (LongFieldScript.Factory) (field, params, lookup) -> ctx -> new LongFieldScript(field, params, lookup, ctx) {
                @Override
                public void execute() {

                }
            };
        }
        throw new UnsupportedOperationException("Unknown context " + context.name);
    }

    public void testObjectDefinition() throws IOException {
        MapperService mapperService = createMapperService(topMapping(b -> {
            b.startObject("runtime");
            b.startObject("obj");
            b.field("type", "composite");
            b.startObject("script").field("source", "dummy").endObject();
            b.startObject("fields");
            b.startObject("long-subfield").field("type", "long").endObject();
            b.startObject("str-subfield").field("type", "keyword").endObject();
            b.startObject("double-subfield").field("type", "double").endObject();
            b.startObject("boolean-subfield").field("type", "boolean").endObject();
            b.startObject("ip-subfield").field("type", "ip").endObject();
            b.startObject("geopoint-subfield").field("type", "geo_point").endObject();
            b.endObject();
            b.endObject();
            b.endObject();
        }));

        assertNull(mapperService.mappingLookup().getFieldType("obj"));
        assertNull(mapperService.mappingLookup().getFieldType("long-subfield"));
        assertNull(mapperService.mappingLookup().getFieldType("str-subfield"));
        assertNull(mapperService.mappingLookup().getFieldType("double-subfield"));
        assertNull(mapperService.mappingLookup().getFieldType("boolean-subfield"));
        assertNull(mapperService.mappingLookup().getFieldType("ip-subfield"));
        assertNull(mapperService.mappingLookup().getFieldType("geopoint-subfield"));
        assertNull(mapperService.mappingLookup().getFieldType("obj.any-subfield"));
        MappedFieldType longSubfield = mapperService.mappingLookup().getFieldType("obj.long-subfield");
        assertEquals("obj.long-subfield", longSubfield.name());
        assertEquals("long", longSubfield.typeName());
        MappedFieldType strSubfield = mapperService.mappingLookup().getFieldType("obj.str-subfield");
        assertEquals("obj.str-subfield", strSubfield.name());
        assertEquals("keyword", strSubfield.typeName());
        MappedFieldType doubleSubfield = mapperService.mappingLookup().getFieldType("obj.double-subfield");
        assertEquals("obj.double-subfield", doubleSubfield.name());
        assertEquals("double", doubleSubfield.typeName());
        MappedFieldType booleanSubfield = mapperService.mappingLookup().getFieldType("obj.boolean-subfield");
        assertEquals("obj.boolean-subfield", booleanSubfield.name());
        assertEquals("boolean", booleanSubfield.typeName());
        MappedFieldType ipSubfield = mapperService.mappingLookup().getFieldType("obj.ip-subfield");
        assertEquals("obj.ip-subfield", ipSubfield.name());
        assertEquals("ip", ipSubfield.typeName());
        MappedFieldType geoPointSubfield = mapperService.mappingLookup().getFieldType("obj.geopoint-subfield");
        assertEquals("obj.geopoint-subfield", geoPointSubfield.name());
        assertEquals("geo_point", geoPointSubfield.typeName());

        RuntimeField rf = mapperService.mappingLookup().getMapping().getRoot().getRuntimeField("obj");
        assertEquals("obj", rf.name());
        Collection<MappedFieldType> mappedFieldTypes = rf.asMappedFieldTypes().collect(Collectors.toList());
        for (MappedFieldType mappedFieldType : mappedFieldTypes) {
            if (mappedFieldType.name().equals("obj.long-subfield")) {
                assertSame(longSubfield, mappedFieldType);
            } else if (mappedFieldType.name().equals("obj.str-subfield")) {
                assertSame(strSubfield, mappedFieldType);
            } else if (mappedFieldType.name().equals("obj.double-subfield")) {
                assertSame(doubleSubfield, mappedFieldType);
            } else if (mappedFieldType.name().equals("obj.boolean-subfield")) {
                assertSame(booleanSubfield, mappedFieldType);
            } else if (mappedFieldType.name().equals("obj.ip-subfield")) {
                assertSame(ipSubfield, mappedFieldType);
            } else if (mappedFieldType.name().equals("obj.geopoint-subfield")) {
                assertSame(geoPointSubfield, mappedFieldType);
            } else {
                fail("unexpected subfield [" + mappedFieldType.name() + "]");
            }
        }
    }

    public void testUnsupportedLeafType() {
        Exception e = expectThrows(MapperParsingException.class, () -> createMapperService(topMapping(b -> {
            b.startObject("runtime");
            b.startObject("obj");
            b.field("type", "composite");
            b.startObject("script").field("source", "dummy").endObject();
            b.startObject("fields");
            b.startObject("long-subfield").field("type", "unsupported").endObject();
            b.endObject();
            b.endObject();
            b.endObject();
        })));
        assertThat(e.getMessage(), containsString(""));
    }

    public void testToXContent() throws IOException {
        MapperService mapperService = createMapperService(topMapping(b -> {
            b.startObject("runtime");
            b.startObject("message");
            b.field("type", "composite");
            b.field("script", "dummy");
            b.startObject("meta").field("test-meta", "value").endObject();
            b.startObject("fields").startObject("response").field("type", "long").endObject().endObject();
            b.endObject();
            b.endObject();
        }));
        assertEquals(
            """
                {"_doc":{"runtime":{"message":{"type":"composite","meta":{"test-meta":"value"},\
                "script":{"source":"dummy","lang":"painless"},"fields":{"response":{"type":"long"}}}}}}""",
            Strings.toString(mapperService.mappingLookup().getMapping())
        );
    }

    public void testScriptOnSubFieldThrowsError() {
        Exception e = expectThrows(MapperParsingException.class, () -> createMapperService(runtimeMapping(b -> {
            b.startObject("obj");
            b.field("type", "composite");
            b.field("script", "dummy");
            b.startObject("fields");
            b.startObject("long").field("type", "long").field("script", "dummy").endObject();
            b.endObject();
            b.endObject();
        })));

        assertThat(e.getMessage(), containsString("Cannot use [script] parameter on sub-field [long] of composite field [obj]"));
    }

    public void testObjectWithoutScript() {
        Exception e = expectThrows(MapperParsingException.class, () -> createMapperService(runtimeMapping(b -> {
            b.startObject("obj");
            b.field("type", "composite");
            b.startObject("fields");
            b.startObject("long").field("type", "long").endObject();
            b.endObject();
            b.endObject();
        })));
        assertThat(e.getMessage(), containsString("composite runtime field [obj] must declare a [script]"));
    }

    public void testObjectNullScript() {
        Exception e = expectThrows(MapperParsingException.class, () -> createMapperService(runtimeMapping(b -> {
            b.startObject("obj");
            b.field("type", "composite");
            b.nullField("script");
            b.startObject("fields");
            b.startObject("long").field("type", "long").endObject();
            b.endObject();
            b.endObject();
        })));
        assertThat(e.getMessage(), containsString(" [script] on runtime field [obj] of type [composite] must not have a [null] value"));

    }

    public void testObjectWithoutFields() {
        {
            Exception e = expectThrows(MapperParsingException.class, () -> createMapperService(runtimeMapping(b -> {
                b.startObject("obj");
                b.field("type", "composite");
                b.field("script", "dummy");
                b.endObject();
            })));
            assertThat(e.getMessage(), containsString("composite runtime field [obj] must declare its [fields]"));
        }
        {
            Exception e = expectThrows(MapperParsingException.class, () -> createMapperService(runtimeMapping(b -> {
                b.startObject("obj");
                b.field("type", "composite");
                b.field("script", "dummy");
                b.startObject("fields").endObject();
                b.endObject();
            })));
            assertThat(e.getMessage(), containsString("composite runtime field [obj] must declare its [fields]"));
        }
    }

    public void testMappingUpdate() throws IOException {
        MapperService mapperService = createMapperService(topMapping(b -> {
            b.startObject("runtime");
            b.startObject("obj");
            b.field("type", "composite");
            b.startObject("script").field("source", "dummy").endObject();
            b.startObject("fields");
            b.startObject("long-subfield").field("type", "long").endObject();
            b.startObject("str-subfield").field("type", "keyword").endObject();
            b.endObject();
            b.endObject();
            b.endObject();
        }));

        XContentBuilder b = XContentBuilder.builder(XContentType.JSON.xContent());
        b.startObject();
        b.startObject("_doc");
        b.startObject("runtime");
        b.startObject("obj");
        b.field("type", "composite");
        b.startObject("script").field("source", "dummy2").endObject();
        b.startObject("fields");
        b.startObject("double-subfield").field("type", "double").endObject();
        b.endObject();
        b.endObject();
        b.endObject();
        b.endObject();
        b.endObject();

        merge(mapperService, b);

        assertNull(mapperService.mappingLookup().getFieldType("obj.long-subfield"));
        assertNull(mapperService.mappingLookup().getFieldType("obj.str-subfield"));
        MappedFieldType doubleSubField = mapperService.mappingLookup().getFieldType("obj.double-subfield");
        assertEquals("obj.double-subfield", doubleSubField.name());
        assertEquals("double", doubleSubField.typeName());

        RuntimeField rf = mapperService.mappingLookup().getMapping().getRoot().getRuntimeField("obj");
        assertEquals("obj", rf.name());

        Collection<MappedFieldType> mappedFieldTypes = rf.asMappedFieldTypes().collect(Collectors.toList());
        assertEquals(1, mappedFieldTypes.size());
        assertSame(doubleSubField, mappedFieldTypes.iterator().next());

        assertEquals("""
            {"obj":{"type":"composite","script":{"source":"dummy2","lang":"painless"},\
            "fields":{"double-subfield":{"type":"double"}}}}""", Strings.toString(rf));
    }

    public void testFieldDefinedTwiceWithSameName() throws IOException {
        IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> createMapperService(topMapping(b -> {
            b.startObject("runtime");
            b.startObject("obj.long-subfield").field("type", "long").endObject();
            b.startObject("obj");
            b.field("type", "composite");
            b.startObject("script").field("source", "dummy").endObject();
            b.startObject("fields");
            b.startObject("long-subfield").field("type", "long").endObject();
            b.endObject();
            b.endObject();
            b.endObject();
        })));
        assertThat(e.getMessage(), containsString("Found two runtime fields with same name [obj.long-subfield]"));

        MapperService mapperService = createMapperService(topMapping(b -> {
            b.startObject("runtime");
            b.startObject("obj.str-subfield").field("type", "long").endObject();
            b.startObject("obj");
            b.field("type", "composite");
            b.startObject("script").field("source", "dummy").endObject();
            b.startObject("fields");
            b.startObject("long-subfield").field("type", "long").endObject();
            b.endObject();
            b.endObject();
            b.endObject();
        }));

        XContentBuilder builder = XContentBuilder.builder(XContentType.JSON.xContent());
        builder.startObject();
        builder.startObject("_doc");
        builder.startObject("runtime");
        builder.startObject("obj.long-subfield").field("type", "long").endObject();
        builder.endObject();
        builder.endObject();
        builder.endObject();
        IllegalArgumentException iae = expectThrows(IllegalArgumentException.class, () -> merge(mapperService, builder));
        assertThat(iae.getMessage(), containsString("Found two runtime fields with same name [obj.long-subfield]"));
    }

    public void testParseDocumentSubFieldAccess() throws IOException {
        MapperService mapperService = createMapperService(topMapping(b -> {
            b.field("dynamic", false);
            b.startObject("runtime");
            b.startObject("obj");
            b.field("type", "composite");
            b.field("script", "split-str-long");
            b.startObject("fields");
            b.startObject("str").field("type", "keyword").endObject();
            b.startObject("long").field("type", "long").endObject();
            b.endObject();
            b.endObject();
            b.endObject();
        }));

        ParsedDocument doc1 = mapperService.documentMapper().parse(source(b -> b.field("field", "foo 1")));
        ParsedDocument doc2 = mapperService.documentMapper().parse(source(b -> b.field("field", "bar 2")));

        withLuceneIndex(mapperService, iw -> iw.addDocuments(Arrays.asList(doc1.rootDoc(), doc2.rootDoc())), reader -> {
            SearchLookup searchLookup = new SearchLookup(
                mapperService::fieldType,
                (mft, lookupSupplier) -> mft.fielddataBuilder("test", lookupSupplier).build(null, null)
            );

            LeafSearchLookup leafSearchLookup = searchLookup.getLeafSearchLookup(reader.leaves().get(0));

            leafSearchLookup.setDocument(0);
            assertEquals("foo", leafSearchLookup.doc().get("obj.str").get(0));
            assertEquals(1L, leafSearchLookup.doc().get("obj.long").get(0));

            leafSearchLookup.setDocument(1);
            assertEquals("bar", leafSearchLookup.doc().get("obj.str").get(0));
            assertEquals(2L, leafSearchLookup.doc().get("obj.long").get(0));
        });
    }

    public void testParseDocumentDynamicMapping() throws IOException {
        MapperService mapperService = createMapperService(topMapping(b -> {
            b.startObject("runtime");
            b.startObject("obj");
            b.field("type", "composite");
            b.field("script", "dummy");
            b.startObject("fields");
            b.startObject("str").field("type", "keyword").endObject();
            b.startObject("long").field("type", "long").endObject();
            b.endObject();
            b.endObject();
            b.endObject();
        }));

        ParsedDocument doc1 = mapperService.documentMapper().parse(source(b -> b.field("obj.long", 1L).field("obj.str", "value")));
        assertNull(doc1.rootDoc().get("obj.long"));
        assertNull(doc1.rootDoc().get("obj.str"));

        assertNull(mapperService.mappingLookup().getMapper("obj.long"));
        assertNull(mapperService.mappingLookup().getMapper("obj.str"));
        assertNotNull(mapperService.mappingLookup().getFieldType("obj.long"));
        assertNotNull(mapperService.mappingLookup().getFieldType("obj.str"));

        XContentBuilder builder = XContentBuilder.builder(XContentType.JSON.xContent());
        builder.startObject();
        builder.startObject("_doc");
        builder.startObject("properties");
        builder.startObject("obj");
        builder.startObject("properties");
        builder.startObject("long").field("type", "long").endObject();
        builder.endObject();
        builder.endObject();
        builder.endObject();
        builder.endObject();
        builder.endObject();
        merge(mapperService, builder);

        ParsedDocument doc2 = mapperService.documentMapper().parse(source(b -> b.field("obj.long", 2L)));
        assertNotNull(doc2.rootDoc().get("obj.long"));
        assertNull(doc2.rootDoc().get("obj.str"));

        assertNotNull(mapperService.mappingLookup().getMapper("obj.long"));
        assertNull(mapperService.mappingLookup().getMapper("obj.str"));
        assertNotNull(mapperService.mappingLookup().getFieldType("obj.long"));
        assertNotNull(mapperService.mappingLookup().getFieldType("obj.str"));
    }

    public void testParseDocumentSubfieldsOutsideRuntimeObject() throws IOException {
        MapperService mapperService = createMapperService(topMapping(b -> {
            b.startObject("runtime");
            b.startObject("obj");
            b.field("type", "composite");
            b.field("script", "dummy");
            b.startObject("fields");
            b.startObject("long").field("type", "long").endObject();
            b.endObject();
            b.endObject();
            b.endObject();
        }));

        ParsedDocument doc1 = mapperService.documentMapper().parse(source(b -> b.field("obj.long", 1L).field("obj.bool", true)));
        assertNull(doc1.rootDoc().get("obj.long"));
        assertNotNull(doc1.rootDoc().get("obj.bool"));

        assertEquals("""
            {"_doc":{"properties":{"obj":{"properties":{"bool":{"type":"boolean"}}}}}}""", Strings.toString(doc1.dynamicMappingsUpdate()));

        MapperService mapperService2 = createMapperService(topMapping(b -> {
            b.field("dynamic", "runtime");
            b.startObject("runtime");
            b.startObject("obj");
            b.field("type", "composite");
            b.field("script", "dummy");
            b.startObject("fields");
            b.startObject("long").field("type", "long").endObject();
            b.endObject();
            b.endObject();
            b.endObject();
        }));

        ParsedDocument doc2 = mapperService2.documentMapper().parse(source(b -> b.field("obj.long", 1L).field("obj.bool", true)));
        assertNull(doc2.rootDoc().get("obj.long"));
        assertNull(doc2.rootDoc().get("obj.bool"));
        assertEquals("""
            {"_doc":{"dynamic":"runtime","runtime":{"obj.bool":{"type":"boolean"}}}}""", Strings.toString(doc2.dynamicMappingsUpdate()));
    }
}


text:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.kamilors.react">

</manifest>


text:
<?php echo \core\error::display($error); ?>

<a href="<?php echo DIR; ?>admin/">Inicio

<a href="<?php echo DIR; ?>admin/articulo">Articulos

Crear Articulo

    <form action="" method ="post" enctype="multipart/form-data">
        <legend>
Crear Nuevo Articulo
</legend>

            Fecha creación:
            <input type="datetime" class="form-control" name="fecha" placeholder="Fecha de creación" value="<?php echo date("Y/m/d H:i:s"); ?>" readonly>

                <label class="btn btn-primary <?php echo $active; ?>">
                    <input <?php echo $checked; ?> name="estado" type="checkbox" autocomplete="off"> Publicado

                <label class="btn btn-info <?php echo $active; ?>">
                    <input <?php echo $checked; ?> name="especial" type="checkbox" autocomplete="off"> Favorito

            Autor:
            <input type="text" class="form-control" name="autor" placeholder="Nombre del Autor" value="<?php echo \helpers\session::get("usuario"); ?>" readonly>

            Titulo:
            <input type="text" class="form-control" name="titulo" placeholder="Titulo del articulo" value="<?php
            if (isset($error)) {
                echo filter_input(INPUT_POST, "titulo");
            }
            ?>">

            <textarea name="descripcion" rows="4" class="col-md-12 form-control"></textarea>

            <textarea name="contenido" rows="10" class="col-md-12 form-control"></textarea>

            Imagen
            <input type="file" name="image">

                archivo de imagen que representa el articulo.

Archivos soportados "gif", "jpeg", "jpg", "png", "svg"

        <input class="btn btn-success" name="submit" type="submit" value="Guardar">
        <a href="<?php echo DIR; ?>admin/articulo" class="btn btn-primary">Volver
    </form>


text:
Spree::Core::Engine.routes.draw do
  match 'orders/return_authorizations/search', to: 'return_authorizations#search', via: [:get, :post]

  resources :orders do
    resources :return_authorizations, only: [:new, :create, :labels], shallow: true do
      member do
        get 'labels'
      end
    end
  end

  namespace :admin do
   resource :return_requests_settings, only: [:edit, :update]
  end
end


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

import java.io.Serializable;

/**
 *

 * Describes a key pair.
 *

 */
public class KeyPair implements Serializable, Cloneable {

    /**
     *

     * The public key.
     *

     */
    private String publicKey;
    /**
     *

     * The private key.
     *

     */
    private String privateKey;

    /**
     *

     * The public key.
     *

     *
     * @param publicKey
     *        The public key.
     */
    public void setPublicKey(String publicKey) {
        this.publicKey = publicKey;
    }

    /**
     *

     * The public key.
     *

     *
     * @return The public key.
     */
    public String getPublicKey() {
        return this.publicKey;
    }

    /**
     *

     * The public key.
     *

     *
     * @param publicKey
     *        The public key.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public KeyPair withPublicKey(String publicKey) {
        setPublicKey(publicKey);
        return this;
    }

    /**
     *

     * The private key.
     *

     *
     * @param privateKey
     *        The private key.
     */
    public void setPrivateKey(String privateKey) {
        this.privateKey = privateKey;
    }

    /**
     *

     * The private key.
     *

     *
     * @return The private key.
     */
    public String getPrivateKey() {
        return this.privateKey;
    }

    /**
     *

     * The private key.
     *

     *
     * @param privateKey
     *        The private key.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public KeyPair withPrivateKey(String privateKey) {
        setPrivateKey(privateKey);
        return this;
    }

    /**
     * Returns a string representation of this object; useful for testing and
     * debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getPublicKey() != null)
            sb.append("PublicKey: " + getPublicKey() + ",");
        if (getPrivateKey() != null)
            sb.append("PrivateKey: " + getPrivateKey());
        sb.append("}");
        return sb.toString();
    }

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

        if (obj instanceof KeyPair == false)
            return false;
        KeyPair other = (KeyPair) obj;
        if (other.getPublicKey() == null ^ this.getPublicKey() == null)
            return false;
        if (other.getPublicKey() != null
                && other.getPublicKey().equals(this.getPublicKey()) == false)
            return false;
        if (other.getPrivateKey() == null ^ this.getPrivateKey() == null)
            return false;
        if (other.getPrivateKey() != null
                && other.getPrivateKey().equals(this.getPrivateKey()) == false)
            return false;
        return true;
    }

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

        hashCode = prime * hashCode
                + ((getPublicKey() == null) ? 0 : getPublicKey().hashCode());
        hashCode = prime * hashCode
                + ((getPrivateKey() == null) ? 0 : getPrivateKey().hashCode());
        return hashCode;
    }

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


text:
Apache Avro for Golang
=====================

[![Build Status](https://travis-ci.org/elodina/go-avro.svg?branch=master)](https://travis-ci.org/elodina/go-avro)

Please note that this project is still an early alpha and is subject to change.

Installation is as easy as follows:

`go get github.com/elodina/go-avro`

Some usage examples are located in [examples folder](https://github.com/elodina/go-avro/tree/master/examples):

* [DataFileReader](https://github.com/elodina/go-avro/blob/master/examples/data_file/data_file.go)
* [GenericDatumReader/Writer](https://github.com/elodina/go-avro/blob/master/examples/generic_datum/generic_datum.go)
* [SpecificDatumReader/Writer](https://github.com/elodina/go-avro/blob/master/examples/specific_datum/specific_datum.go)
* [Schema loading](https://github.com/elodina/go-avro/blob/master/examples/load_schema/load_schema.go)

**go-avro** now also supports code generation from Avro schemas which is available in [codegen folder](https://github.com/elodina/go-avro/tree/master/codegen)


text: The content on this folder will all be redacted due to security concerns.


text:
package org.ovirt.engine.api.resource;

import javax.ws.rs.Path;
import javax.ws.rs.Produces;

import org.ovirt.engine.api.model.Cluster;
import org.ovirt.engine.api.resource.gluster.GlusterHooksResource;
import org.ovirt.engine.api.resource.gluster.GlusterVolumesResource;

@Produces({ApiMediaType.APPLICATION_XML, ApiMediaType.APPLICATION_JSON, ApiMediaType.APPLICATION_X_YAML})
public interface ClusterResource extends UpdatableResource<Cluster> {

    @Path("networks")
    public AssignedNetworksResource getAssignedNetworksSubResource();

    @Path("permissions")
    public AssignedPermissionsResource getPermissionsResource();

    @Path("glustervolumes")
    public GlusterVolumesResource getGlusterVolumesResource();

    @Path("glusterhooks")
    public GlusterHooksResource getGlusterHooksResource();

    @Path("affinitygroups")
    public AffinityGroupsResource getAffinityGroupsResource();
}


text:
package org.jacpfx.failure;

import io.netty.handler.codec.http.HttpResponseStatus;
import io.vertx.core.DeploymentOptions;
import io.vertx.core.Handler;
import io.vertx.core.Vertx;
import io.vertx.core.http.HttpClient;
import io.vertx.core.http.HttpClientOptions;
import io.vertx.core.http.HttpClientRequest;
import io.vertx.core.http.HttpClientResponse;
import io.vertx.core.json.JsonObject;
import io.vertx.core.spi.cluster.ClusterManager;
import io.vertx.test.core.VertxTestBase;
import io.vertx.test.fakecluster.FakeClusterManager;
import java.io.IOException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import org.jacpfx.entity.Payload;
import org.jacpfx.entity.encoder.ExampleByteEncoder;
import org.jacpfx.vxms.common.ServiceEndpoint;
import org.jacpfx.vxms.common.util.Serializer;
import org.jacpfx.vxms.rest.base.response.RestHandler;
import org.jacpfx.vxms.services.VxmsEndpoint;
import org.junit.Before;
import org.junit.Test;

/** Created by Andy Moncsek on 23.04.15. */
public class RESTServiceOnFailureObjectResponseTest extends VertxTestBase {

  public static final String SERVICE_REST_GET = "/wsService";
  public static final int PORT = 9998;
  private static final int MAX_RESPONSE_ELEMENTS = 4;
  private static final String HOST = "127.0.0.1";
  private HttpClient client;

  protected int getNumNodes() {
    return 1;
  }

  protected Vertx getVertx() {
    return vertices[0];
  }

  @Override
  protected ClusterManager getClusterManager() {
    return new FakeClusterManager();
  }

  @Override
  public void setUp() throws Exception {
    super.setUp();
    startNodes(getNumNodes());
  }

  @Before
  public void startVerticles() throws InterruptedException {

    CountDownLatch latch2 = new CountDownLatch(1);
    DeploymentOptions options = new DeploymentOptions().setInstances(1);
    options.setConfig(new JsonObject().put("clustered", false).put("host", HOST));
    // Deploy the module - the System property `vertx.modulename` will contain the name of the
    // module so you
    // don'failure have to hardecode it in your tests

    getVertx()
        .deployVerticle(
            new WsServiceOne(),
            options,
            asyncResult -> {
              // Deployment is asynchronous and this this handler will be called when it's complete
              // (or failed)
              System.out.println("start service: " + asyncResult.succeeded());
              assertTrue(asyncResult.succeeded());
              assertNotNull("deploymentID should not be null", asyncResult.result());
              // If deployed correctly then start the tests!
              //   latch2.countDown();

              latch2.countDown();
            });

    awaitLatch(latch2);
  }

  @Test
  public void simpleOnFailureResponseBlocking() throws InterruptedException {
    HttpClientOptions options = new HttpClientOptions();
    options.setDefaultPort(PORT);
    options.setDefaultHost(HOST);
    HttpClient client = vertx.createHttpClient(options);

    HttpClientRequest request =
        client.get(
            "/wsService/simpleOnFailureResponseBlocking",
            new Handler<HttpClientResponse>() {
              public void handle(HttpClientResponse resp) {
                resp.bodyHandler(
                    body -> {
                      Payload<String> pp = null;
                      try {
                        pp = (Payload<String>) Serializer.deserialize(body.getBytes());
                      } catch (IOException e) {
                        e.printStackTrace();
                      } catch (ClassNotFoundException e) {
                        e.printStackTrace();
                      }

                      System.out.println("--------catchedAsyncByteErrorDelay: " + pp.getValue());
                      assertEquals("on failure", pp.getValue());
                      testComplete();
                    });
              }
            });
    request.end();

    await(10000, TimeUnit.MILLISECONDS);
  }

  @Test
  public void simpleOnFailureResponse() throws InterruptedException {

    System.setProperty("sun.net.http.allowRestrictedHeaders", "true");

    HttpClientOptions options = new HttpClientOptions();
    options.setDefaultPort(PORT);
    options.setDefaultHost(HOST);
    HttpClient client = vertx.createHttpClient(options);

    HttpClientRequest request =
        client.get(
            "/wsService/simpleOnFailureResponse",
            new Handler<HttpClientResponse>() {
              public void handle(HttpClientResponse resp) {
                resp.bodyHandler(
                    body -> {
                      Payload<String> pp = null;
                      try {
                        pp = (Payload<String>) Serializer.deserialize(body.getBytes());
                      } catch (IOException e) {
                        e.printStackTrace();
                      } catch (ClassNotFoundException e) {
                        e.printStackTrace();
                      }

                      System.out.println("--------catchedAsyncByteErrorDelay: " + pp.getValue());
                      assertEquals("on failure", pp.getValue());
                      testComplete();
                    });
              }
            });
    request.end();

    await(10000, TimeUnit.MILLISECONDS);
  }

  @Test
  public void simpleOnFailureResponse400() throws InterruptedException {
    HttpClientOptions options = new HttpClientOptions();
    options.setDefaultPort(PORT);
    options.setDefaultHost(HOST);
    HttpClient client = vertx.createHttpClient(options);

    HttpClientRequest request =
        client.get(
            "/wsService/simpleOnFailureResponse400",
            new Handler<HttpClientResponse>() {
              public void handle(HttpClientResponse resp) {
                resp.bodyHandler(
                    body -> {
                      Payload<String> pp = null;
                      try {
                        pp = (Payload<String>) Serializer.deserialize(body.getBytes());
                      } catch (IOException e) {
                        e.printStackTrace();
                      } catch (ClassNotFoundException e) {
                        e.printStackTrace();
                      }
                      System.out.println(
                          "--------catchedAsyncByteErrorDelay: "
                              + pp.getValue()
                              + "  status: "
                              + resp.statusMessage()
                              + "  status nr.:"
                              + resp.statusCode());
                      assertEquals("on failure", pp.getValue());
                      assertEquals(400, resp.statusCode());
                      testComplete();
                    });
              }
            });
    request.end();

    await(10000, TimeUnit.MILLISECONDS);
  }

  @Test
  public void simpleOnFailureResponse400RetryStateless() throws InterruptedException {
    HttpClientOptions options = new HttpClientOptions();
    options.setDefaultPort(PORT);
    options.setDefaultHost(HOST);
    HttpClient client = vertx.createHttpClient(options);

    HttpClientRequest request =
        client.get(
            "/wsService/simpleOnFailureResponse400RetryStateless",
            new Handler<HttpClientResponse>() {
              public void handle(HttpClientResponse resp) {
                resp.bodyHandler(
                    body -> {
                      Payload<String> pp = null;
                      try {
                        pp = (Payload<String>) Serializer.deserialize(body.getBytes());
                      } catch (IOException e) {
                        e.printStackTrace();
                      } catch (ClassNotFoundException e) {
                        e.printStackTrace();
                      }
                      System.out.println(
                          "--------catchedAsyncByteErrorDelay: "
                              + pp.getValue()
                              + "  status: "
                              + resp.statusMessage()
                              + "  status nr.:"
                              + resp.statusCode());
                      assertEquals("on failure", pp.getValue());
                      assertEquals(400, resp.statusCode());
                      testComplete();
                    });
              }
            });
    request.end();

    await(10000, TimeUnit.MILLISECONDS);
  }

  public HttpClient getClient() {
    return client;
  }

  @ServiceEndpoint(name = SERVICE_REST_GET, contextRoot = SERVICE_REST_GET, port = PORT)
  public class WsServiceOne extends VxmsEndpoint {

    @Path("/simpleOnFailureResponseBlocking")
    @GET
    public void simpleOnFailureResponseBlocking(RestHandler reply) {
      reply
          .response()
          .blocking()
          .objectResponse(
              () -> {
                throw new NullPointerException("test");
              },
              new ExampleByteEncoder())
          .onFailureRespond(
              (t) -> {
                System.out.print("the stack trace --> ");
                t.printStackTrace();
                return new Payload<>("on failure");
              },
              new ExampleByteEncoder())
          .execute();
    }

    @Path("/simpleOnFailureResponse")
    @GET
    public void simpleOnFailureResponse(RestHandler reply) {
      reply
          .response()
          .objectResponse(
              (future) -> {
                throw new NullPointerException("test");
              },
              new ExampleByteEncoder())
          .onFailureRespond(
              (t, future) -> {
                System.out.print("the stack trace --> ");
                t.printStackTrace();
                future.complete(new Payload<>("on failure"));
              },
              new ExampleByteEncoder())
          .execute();
    }

    @Path("/simpleOnFailureResponse400")
    @GET
    public void simpleOnFailureResponse400(RestHandler reply) {
      reply
          .response()
          .objectResponse(
              (future) -> {
                throw new NullPointerException("test");
              },
              new ExampleByteEncoder())
          .onFailureRespond(
              (t, future) -> {
                System.out.print("the stack trace --> ");
                t.printStackTrace();
                future.complete(new Payload<>("on failure"));
              },
              new ExampleByteEncoder())
          .httpErrorCode(HttpResponseStatus.BAD_REQUEST)
          .execute();
    }

    @Path("/simpleOnFailureResponse400RetryStateless")
    @GET
    public void simpleOnFailureResponse400RetryStateless(RestHandler reply) {
      reply
          .response()
          .objectResponse(
              (future) -> {
                throw new NullPointerException("test");
              },
              new ExampleByteEncoder())
          .onError(t -> System.out.println(t.getMessage()))
          .onFailureRespond(
              (t, future) -> {
                System.out.print("the stack trace --> ");
                t.printStackTrace();
                future.complete(new Payload<>("on failure"));
              },
              new ExampleByteEncoder())
          .httpErrorCode(HttpResponseStatus.BAD_REQUEST)
          .retry(3)
          .execute();
    }
  }
}


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

using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace Dapplo.Jira.Entities;

/// <summary>
///     Board information
/// </summary>
[JsonObject]
public class Board : BaseProperties<long>
{
    /// <summary>
    ///     Name of the Board
    /// </summary>
    [JsonProperty("name")]
    public string Name { get; set; }

    /// <summary>
    ///     Board type
    /// </summary>
    [JsonProperty("type")]
    [JsonConverter(typeof(StringEnumConverter))]
    public BoardTypes Type { get; set; }

    /// <summary>
    ///     Filter for the board, used when creating
    /// </summary>
    [JsonProperty("filterId")]
    public long FilterId { get; set; }
}


text:
package com.example.clarence.myapp.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.Toast;

import com.example.clarence.libwidget.pinnedsection.PinnedSectionListView;
import com.example.clarence.myapp.R;
import com.example.clarence.myapp.data.UserInfoDO;

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

public class ContactsFragment extends Fragment {
    PinnedSectionListView listView;
    ContactsFragmentAdapter adapter;

    List<ContactsItem> data = new ArrayList<>();

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getIntentData();
        loadData();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.contacts_fragment, container, false);
        initView(view);
        return view;
    }

    private void initView(View view) {
        listView = (PinnedSectionListView) view.findViewById(R.id.listView);
        adapter = new ContactsFragmentAdapter(getContext(), data);
        listView.setAdapter(adapter);
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                ContactsItem item = adapter.getItem(position);
                if (item != null) {
                    if (item.type == ContactsItem.SECTION) {
                        Toast.makeText(getContext(), "section " + position + ": " + item.userInfoDO.getName(), Toast.LENGTH_SHORT).show();
                    } else {
                        Toast.makeText(getContext(), "Item " + position + ": " + item.userInfoDO.getName(), Toast.LENGTH_SHORT).show();
                    }
                } else {
                    Toast.makeText(getContext(), "erro", Toast.LENGTH_SHORT).show();
                }
            }
        });
    }

    private void getIntentData() {
        Bundle bundle = getArguments();
    }

    private void loadData() {
        final int sectionsNumber = 'Z' - 'A' + 1;
        int sectionPosition = 0, listPosition = 0;
        UserInfoDO userInfoDO;
        for (char i = 0; i < sectionsNumber; i++) {
            userInfoDO = new UserInfoDO();
            userInfoDO.setName(String.valueOf((char) ('A' + i)));
            userInfoDO.setTelephone(i + "");
            ContactsItem section = new ContactsItem(ContactsItem.SECTION, userInfoDO);
            section.sectionPosition = sectionPosition;
            section.listPosition = listPosition++;
            data.add(section);

            final int itemsNumber = (int) Math.abs((Math.cos(2f * Math.PI / 3f * sectionsNumber / (i + 1f)) * 25f));
            for (int j = 0; j < itemsNumber; j++) {
                userInfoDO = new UserInfoDO();
                userInfoDO.setName(section.userInfoDO.getName().toUpperCase(Locale.ENGLISH) + " - " + j);
                userInfoDO.setTelephone(i + "");
                ContactsItem item = new ContactsItem(ContactsItem.ITEM, userInfoDO);
                item.sectionPosition = sectionPosition;
                item.listPosition = listPosition++;
                data.add(item);
            }
            sectionPosition++;
        }
    }

}


text:
import re
from urllib.parse import parse_qs, urlparse

from django.conf import settings
from django.contrib.auth import logout as auth_logout
from django.shortcuts import redirect
from django.urls import reverse
from django.utils import translation
from django.utils.http import quote
from django.views.generic.base import TemplateView
from oauth2_provider.models import get_application_model
from oidc_provider.models import Client
from oidc_provider.views import AuthorizeView

from oidc_apis.models import ApiScope

from .models import LoginMethod, OidcClientOptions

class LoginView(TemplateView):
    template_name = "login.html"

    def get(self, request, *args, **kwargs):  # noqa  (too complex)
        next_url = request.GET.get('next')
        app = None
        oidc_client = None

        if next_url:
            # Determine application from the 'next' query argument.
            # FIXME: There should be a better way to get the app id.
            params = parse_qs(urlparse(next_url).query)
            client_id = params.get('client_id')

            if client_id and len(client_id):
                client_id = client_id[0].strip()

            if client_id:
                try:
                    app = get_application_model().objects.get(client_id=client_id)
                except get_application_model().DoesNotExist:
                    pass

                try:
                    oidc_client = Client.objects.get(client_id=client_id)
                except Client.DoesNotExist:
                    pass

            next_url = quote(next_url)

        allowed_methods = None
        if app:
            allowed_methods = app.login_methods.all()
        elif oidc_client:
            try:
                client_options = OidcClientOptions.objects.get(oidc_client=oidc_client)
                allowed_methods = client_options.login_methods.all()
            except OidcClientOptions.DoesNotExist:
                pass

        if allowed_methods is None:
            allowed_methods = LoginMethod.objects.all()

        methods = []
        for m in allowed_methods:
            assert isinstance(m, LoginMethod)
            if m.provider_id == 'saml':
                continue  # SAML support removed

            m.login_url = reverse('social:begin', kwargs={'backend': m.provider_id})
            if next_url:
                m.login_url += '?next=' + next_url

            methods.append(m)

        if len(methods) == 1:
            return redirect(methods[0].login_url)

        self.login_methods = methods
        return super(LoginView, self).get(request, *args, **kwargs)

    def get_context_data(self, **kwargs):
        context = super(LoginView, self).get_context_data(**kwargs)
        context['login_methods'] = self.login_methods
        return context

class LogoutView(TemplateView):
    template_name = 'logout_done.html'

    def get(self, *args, **kwargs):
        if self.request.user.is_authenticated:
            auth_logout(self.request)
        url = self.request.GET.get('next')
        if url and re.match(r'http[s]?://', url):
            return redirect(url)
        return super(LogoutView, self).get(*args, **kwargs)

class EmailNeededView(TemplateView):
    template_name = 'email_needed.html'

    def get_context_data(self, **kwargs):
        context = super(EmailNeededView, self).get_context_data(**kwargs)
        reauth_uri = self.request.GET.get('reauth_uri', '')
        if '//' in reauth_uri:  # Prevent open redirect
            reauth_uri = ''
        context['reauth_uri'] = reauth_uri
        return context

class AuthenticationErrorView(TemplateView):
    template_name = 'account/signup_closed.html'

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        return context

class TunnistamoOidcAuthorizeView(AuthorizeView):
    def get(self, request, *args, **kwargs):
        request.GET = _extend_scope_in_query_params(request.GET)
        request_locales = [l.strip() for l in request.GET.get('ui_locales', '').split(' ') if l]
        available_locales = [l[0] for l in settings.LANGUAGES]

        for locale in request_locales:
            if locale in available_locales:
                with translation.override(locale):
                    return super().get(request, *args, **kwargs)

        return super().get(request, *args, **kwargs)

    def post(self, request, *args, **kwargs):
        request.POST = _extend_scope_in_query_params(request.POST)
        return super().post(request, *args, **kwargs)

def _extend_scope_in_query_params(query_params):
    scope = query_params.get('scope')
    if scope:
        query_params = query_params.copy()
        query_params['scope'] = _add_api_scopes(scope)
    return query_params

def _add_api_scopes(scope_string):
    scopes = scope_string.split()
    extended_scopes = ApiScope.extend_scope(scopes)
    return ' '.join(extended_scopes)


text:
package org.vizzini.illyriad.map;

import java.awt.Toolkit;
import java.io.File;
import java.io.IOException;
import java.io.Writer;
import java.util.BitSet;

import org.vizzini.core.TimePrinter;
import org.vizzini.illyriad.FileUtilities;
import org.vizzini.illyriad.Region;

/**
 * Provides a preprocessor for world map data. Use a java argument such as '-Xmx2048m' to allow enough memory.
 */
public final class FastWorldMapPreprocessor
{
    /**
     * Application method.
     *
     * @param args Application arguments.
     */
    public static void main(final String args[])
    {
        final long start = System.currentTimeMillis();

        // {
        // final boolean isElgea = true;
        // final GeoIdConverter converter = new GeoIdConverter(isElgea);
        // final FastWorldMapPreprocessor preprocessor = new FastWorldMapPreprocessor(converter);
        // preprocessor.preprocess();
        // }

        {
            final boolean isElgea = false;
            final GeoIdConverter converter = new GeoIdConverter(isElgea);
            final FastWorldMapPreprocessor preprocessor = new FastWorldMapPreprocessor(converter);
            preprocessor.preprocess();
        }

        final long end = System.currentTimeMillis();
        new TimePrinter().printElapsedTime("\nFastWorldMapPreprocessor", start, end);
        Toolkit.getDefaultToolkit().beep();
    }

    /** Geospatial ID converter. */
    private final GeoIdConverter converter;

    /** File utilities. */
    private final FileUtilities fileUtils = new FileUtilities();

    /** Bit set formatter. */
    private final BitSetFormat formatter;

    /**
     * Construct this object.
     *
     * @param converter Geospatial ID converter.
     */
    @SuppressWarnings("hiding")
    public FastWorldMapPreprocessor(final GeoIdConverter converter)
    {
        if (converter == null)
        {
            throw new IllegalArgumentException("converter is null");
        }

        this.converter = converter;

        formatter = new BitSetFormat();
    }

    /**
     * Pre-process.
     */
    public void preprocess()
    {
        final WorldMapDatabase worldMapDatabase = new DefaultWorldMapDatabase(converter);

        final String base = "mapData/" + (converter.isElgea() ? "elgea" : "brokenLands");
        final File parent = new File(base);

        writeBitSet(new File(parent, "sevenFoodSquares.txt"), worldMapDatabase.getSevenFoodSquares());
        writeBitSet(new File(parent, "eightFoodSquares.txt"), worldMapDatabase.getEightFoodSquares());
        writeBitSet(new File(parent, "highFoodSquares.txt"), worldMapDatabase.getHighFoodSquares());
        writeBitSet(new File(parent, "fiveWoodSquares.txt"), worldMapDatabase.getFiveWoodSquares());
        writeBitSet(new File(parent, "fiveClaySquares.txt"), worldMapDatabase.getFiveClaySquares());
        writeBitSet(new File(parent, "fiveIronSquares.txt"), worldMapDatabase.getFiveIronSquares());
        writeBitSet(new File(parent, "fiveStoneSquares.txt"), worldMapDatabase.getFiveStoneSquares());

        final Region[] regionValues = (converter.isElgea() ? Region.valuesElgea() : Region.valuesBrokenLands());

        for (final Region region : regionValues)
        {
            writeRegionSquares(parent, region, worldMapDatabase);
        }

        for (final TerrainCombat terrain : TerrainCombat.values())
        {
            writeTerrainCombatSquares(parent, terrain, worldMapDatabase);
        }

        for (final TerrainSpecific terrain : TerrainSpecific.values())
        {
            writeTerrainSpecificSquares(parent, terrain, worldMapDatabase);
        }
    }

    /**
     * @param file File.
     * @param bitSet Bit set.
     */
    private void writeBitSet(final File file, final BitSet bitSet)
    {
        Writer writer = null;

        try
        {
            writer = fileUtils.createFileWriter(file);
            writer.write(formatter.format(bitSet));
        }
        catch (final IOException e)
        {
            throw new RuntimeException(e);
        }
        finally
        {
            fileUtils.close(writer);
        }
    }

    /**
     * @param parent Parent directory.
     * @param region Region.
     * @param worldMapDatabase World map database.
     */
    private void writeRegionSquares(final File parent, final Region region, final WorldMapDatabase worldMapDatabase)
    {
        final File file = new File(parent, "regionSquares_" + region.name() + ".txt");
        Writer writer = null;

        try
        {
            writer = fileUtils.createFileWriter(file);
            final BitSet bitSet = worldMapDatabase.getRegionSquares(region);

            if ((bitSet != null) && !bitSet.isEmpty())
            {
                writer.write(formatter.format(bitSet));
            }
        }
        catch (final IOException e)
        {
            throw new RuntimeException(e);
        }
        finally
        {
            fileUtils.close(writer);
        }
    }

    /**
     * @param parent Parent directory.
     * @param terrain Terrain combat.
     * @param worldMapDatabase World map database.
     */
    private void writeTerrainCombatSquares(final File parent, final TerrainCombat terrain,
            final WorldMapDatabase worldMapDatabase)
    {
        final File file = new File(parent, "terrainCombatSquares_" + terrain.name() + ".txt");
        Writer writer = null;

        try
        {
            writer = fileUtils.createFileWriter(file);
            final BitSet bitSet = worldMapDatabase.getTerrainCombatSquares(terrain);

            if ((bitSet != null) && !bitSet.isEmpty())
            {
                writer.write(formatter.format(bitSet));
            }
        }
        catch (final IOException e)
        {
            throw new RuntimeException(e);
        }
        finally
        {
            fileUtils.close(writer);
        }
    }

    /**
     * @param parent Parent directory.
     * @param terrain Terrain combat.
     * @param worldMapDatabase World map database.
     */
    private void writeTerrainSpecificSquares(final File parent, final TerrainSpecific terrain,
            final WorldMapDatabase worldMapDatabase)
    {
        final File file = new File(parent, "terrainSpecificSquares_" + terrain.name() + ".txt");
        Writer writer = null;

        try
        {
            writer = fileUtils.createFileWriter(file);
            final BitSet bitSet = worldMapDatabase.getTerrainSpecificSquares(terrain);

            if ((bitSet != null) && !bitSet.isEmpty())
            {
                writer.write(formatter.format(bitSet));
            }
        }
        catch (final IOException e)
        {
            throw new RuntimeException(e);
        }
        finally
        {
            fileUtils.close(writer);
        }
    }
}


text:
package jwt

import "fmt"

type VoiceGrant struct {
	Incoming          Incoming `json:"incoming"`
	Outgoing          Outgoing `json:"outgoing"`
	PushCredentialSid string   `json:"push_credential_sid"`
	EndpointID        string   `json:"endpoint_id"`
}

type Incoming struct {
	Allow bool `json:"allow"`
}

type Outgoing struct {
	ApplicationSid    string                 `json:"application_sid"`
	ApplicationParams map[string]interface{} `json:"params"`
}

func (voiceGrant *VoiceGrant) Key() string {
	return "voice"
}

func (voiceGrant *VoiceGrant) ToPayload() map[string]interface{} {
	grant := make(map[string]interface{})
	if voiceGrant.Incoming.Allow {
		grant["incoming"] = map[string]interface{}{
			"allow": true,
		}
	}
	if voiceGrant.Outgoing.ApplicationSid != "" {
		grant["outgoing"] = map[string]interface{}{
			"application_sid": voiceGrant.Outgoing.ApplicationSid,
		}
		if len(voiceGrant.Outgoing.ApplicationParams) != 0 {
			grant["outgoing"].(map[string]interface{})["params"] = voiceGrant.Outgoing.ApplicationParams
		}
	}

	if voiceGrant.PushCredentialSid != "" {
		grant["push_credential_sid"] = voiceGrant.PushCredentialSid
	}
	if voiceGrant.EndpointID != "" {
		grant["endpoint_id"] = voiceGrant.EndpointID
	}

	return grant
}

func (voiceGrant *VoiceGrant) ToString() string {
	return fmt.Sprintf("<%s %s>", "VoiceGrant", voiceGrant.ToPayload())
}


text:
@interface RUDBManager : NSObject
{
    NSString *databasePath;
    FMDatabase *db;
}

+ (RUDBManager *) getSharedInstance;

- (BOOL) insertIntoTable: (NSString *) withName withParameters: (NSArray *) parameters;
- (BOOL) executeUpdate: (NSString *) update;
- (FMResultSet *) executeQuery: (NSString *) query;

- (void) makeBestFriendWithFirstName: (NSString *) firstName
                        withLastName: (NSString *) lastName
                        andWithPhone: (NSString *) phone;

- (void) makeFavoriteBarWithPhone: (NSString *) phone;

- (NSMutableArray *) getBeers;
- (NSArray *) getFriends;
- (NSMutableArray *) getBestFriends;
- (NSMutableArray *) getBars;

@end