text:
AddCSLuaFile("shared.lua")
AddCSLuaFile("cl_init.lua")

include("shared.lua")

function ENT:FindClose()
    local tab = {}

    for k,v in pairs(player.GetAll()) do
        if v:GetPos():Distance(self:GetPos()) <= 1024 then
            table.insert(tab,v)
        end
    end

    return tab
end

function ENT:Process(printer)
    if CurTime() - self.ProcessTime <= 0 then return end

    self.ProcessTime = CurTime() + 0.05

    local theirpaper = printer.PrinterCurrentPaper
    local theirmaxpaper = printer.PrinterPaperMax

    if theirpaper < theirmaxpaper then
        if math.floor(theirmaxpaper - theirpaper) >= 1 then
            self:SetSheets(self.Sheets - 1)
            printer.PrinterCurrentPaper = printer.PrinterCurrentPaper + 1

            net.Start("printer_update")
                net.WriteEntity(printer)
                net.WriteString("paper")
                net.WriteFloat(printer.PrinterCurrentPaper)
            net.Send(printer:FindClose())

            self:EmitSound("items/itempickup.wav",60,math.random(90,110))
        end
    end

    if self.Sheets <= 0 then
        self:Remove()
    end
end

function ENT:SetSheets(sheets)
    net.Start("printer_update")
        net.WriteEntity(self)
        net.WriteString("sheets")
        net.WriteFloat(sheets)
    net.Send(self:FindClose())

    self.Sheets = sheets

    if sheets <= 0 then self:Remove() end
end

function ENT:Touch(ent)
    if not IsValid(ent) then return end

    if ent:GetClass() == self:GetClass() then
        ent:GetPhysicsObject():SetVelocity(Vector(0,0,0.1))
        --if self:EntIndex() > ent:EntIndex() then
            if self.MaxSheets - self.Sheets >= 1 then
                if math.floor(self.MaxSheets - self.Sheets) >= 1 then
                    local theirs = ent.Sheets
                    local mine = self.Sheets
                    local avail = self.MaxSheets - self.Sheets

                    if ent:GetPos().z > self:GetPos().z then
                        if theirs >= 1 and avail >= 1 then
                            self:SetSheets(self.Sheets + 1)
                            ent:SetSheets(theirs - 1)
                            self:EmitSound("items/itempickup.wav",60,math.random(90,110))
                        end
                    end
                end
            end
        --end
    end
end

function ENT:OnRemove()
    --if IsValid(self.paper) then
        --self.paper:Remove()
    --end
end


text:
require_relative 'response'

Response.add_response ['dog', 'cat', 'bird'], 'Do you like animals?', 'What about other animals?'
# Response.add_response 'dog', 'Do you like animals?', 'What about other animals?'
Response.add_response 'mom', 'Tell me more about your mother.', 'Tell me more about your family.'
Response.add_response 'hurt', 'How has your health been?'
Response.add_dummies 'Tell me more.', "That's interesting.", 'Go on.'

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Welcome to Ext JS 5.0</title>
    <meta name="description" content="Create amazing web apps built on web standards. Sencha Touch, HTML5 mobile app framework. Ext JS, cross-browser JavaScript framework. Ext GWT" />

    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <link rel="shortcut icon" type="image/ico" href="/favicon.ico" />

    <link rel="stylesheet" type="text/css" media="screen, projection, print" href="welcome/css/welcome.css" />

    <link rel="alternate" type="application/rss+xml" title="Sencha Blog" href="http://feeds.feedburner.com/SenchaBlog" />
    <link rel="alternate" type="application/rss+xml" title="Sencha in the News" href="http://www.sencha.com/company/news-rss">
    <link rel="alternate" type="application/rss+xml" title="Sencha Press Releases" href="http://www.sencha.com/company/press-rss">
    <link rel="alternate" type="application/rss+xml" title="Careers at Sencha" href="http://www.sencha.com/company/careers-rss">

Sencha

Welcome to Ext JS 5.0!

Ext JS 5.0 is a pure JavaScript application framework that works everywhere from IE8 to the latest Chrome. It enables you to create the best cross-platform applications using nothing but a browser, and has a phenomenal API.

View the Examples Discuss Ext JS on the forum

What’s New

Check out our new features and changes in the What's New Guide:

Tablet Support

Welcome MVVM!

Routing

Sencha Charts

Widgets

Guides

API Docs

Release Notes

Learn more on sencha.com

Upgrading

Check out our upgrade guides to see what has changed.

Ext JS 5 Upgrade

Sencha Cmd 5 Upgrade

Sencha Charts Upgrade

Sencha also offers training courses and professional services for companies wishing to use Ext JS 5.

Twitter

Facebook

Tumblr

LinkedIn

RSS Feed

Vimeo

© 2006-2014 Sencha Inc.


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

    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>pymatgen — pymatgen 2018.6.11 documentation</title>
    <link rel="stylesheet" href="_static/proBlue.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />

    <link rel="shortcut icon" href="_static/favicon.ico"/>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />

Navigation

          index

          modules |

pymatgen 2018.6.11 documentation »

pymatgen¶

pymatgen package

Subpackages

pymatgen.alchemy package

Subpackages

Submodules

pymatgen.alchemy.filters module

pymatgen.alchemy.materials module

pymatgen.alchemy.transmuters module

Module contents

pymatgen.analysis package

Subpackages

pymatgen.analysis.chemenv package

Subpackages

Module contents

pymatgen.analysis.cost package

Subpackages

Submodules

Module contents

pymatgen.analysis.defects package

Subpackages

Submodules

Module contents

pymatgen.analysis.diffraction package

Subpackages

Submodules

Module contents

pymatgen.analysis.elasticity package

Submodules

Module contents

pymatgen.analysis.ferroelectricity package

Submodules

Module contents

pymatgen.analysis.hhi package

Subpackages

Submodules

Module contents

pymatgen.analysis.magnetism package

Submodules

Module contents

pymatgen.analysis.structure_prediction package

Subpackages

Submodules

Module contents

pymatgen.analysis.xas package

Subpackages

Submodules

Module contents

Submodules

pymatgen.analysis.adsorption module

pymatgen.analysis.bond_valence module

pymatgen.analysis.diffusion_analyzer module

pymatgen.analysis.energy_models module

pymatgen.analysis.eos module

pymatgen.analysis.ewald module

pymatgen.analysis.excitation module

pymatgen.analysis.find_dimension module

pymatgen.analysis.graphs module

pymatgen.analysis.interface_reactions module

pymatgen.analysis.local_env module

pymatgen.analysis.molecule_matcher module

pymatgen.analysis.molecule_structure_comparator module

pymatgen.analysis.nmr module

pymatgen.analysis.path_finder module

pymatgen.analysis.phase_diagram module

pymatgen.analysis.piezo module

pymatgen.analysis.pourbaix_diagram module

pymatgen.analysis.quasiharmonic module

pymatgen.analysis.reaction_calculator module

pymatgen.analysis.structure_analyzer module

pymatgen.analysis.structure_matcher module

pymatgen.analysis.substrate_analyzer module

pymatgen.analysis.surface_analysis module

pymatgen.analysis.thermochemistry module

pymatgen.analysis.transition_state module

pymatgen.analysis.wulff module

Module contents

pymatgen.apps package

Subpackages

pymatgen.apps.battery package

Subpackages

Submodules

Module contents

pymatgen.apps.borg package

Subpackages

Submodules

Module contents

Module contents

pymatgen.cli package

Submodules

pymatgen.cli.feff_input_generation module

pymatgen.cli.feff_plot_cross_section module

pymatgen.cli.feff_plot_dos module

pymatgen.cli.gaussian_analyzer module

pymatgen.cli.get_environment module

pymatgen.cli.pmg module

pymatgen.cli.pmg_analyze module

pymatgen.cli.pmg_config module

pymatgen.cli.pmg_plot module

pymatgen.cli.pmg_potcar module

pymatgen.cli.pmg_query module

pymatgen.cli.pmg_structure module

pymatgen.cli.pydii module

Module contents

pymatgen.command_line package

Subpackages

Submodules

pymatgen.command_line.aconvasp_caller module

pymatgen.command_line.bader_caller module

pymatgen.command_line.critic2_caller module

pymatgen.command_line.enumlib_caller module

pymatgen.command_line.gulp_caller module

Module contents

pymatgen.core package

Subpackages

Submodules

pymatgen.core.bonds module

pymatgen.core.composition module

pymatgen.core.ion module

pymatgen.core.lattice module

pymatgen.core.libxcfunc module

pymatgen.core.molecular_orbitals module

pymatgen.core.operations module

pymatgen.core.periodic_table module

pymatgen.core.sites module

pymatgen.core.spectrum module

pymatgen.core.structure module

pymatgen.core.surface module

pymatgen.core.units module

pymatgen.core.xcfunc module

Module contents

pymatgen.electronic_structure package

Subpackages

Submodules

pymatgen.electronic_structure.bandstructure module

pymatgen.electronic_structure.boltztrap module

pymatgen.electronic_structure.cohp module

pymatgen.electronic_structure.core module

pymatgen.electronic_structure.dos module

pymatgen.electronic_structure.plotter module

Module contents

pymatgen.entries package

Subpackages

Submodules

pymatgen.entries.compatibility module

pymatgen.entries.computed_entries module

pymatgen.entries.entry_tools module

pymatgen.entries.exp_entries module

pymatgen.entries.post_processors_abc module

Module contents

pymatgen.ext package

Subpackages

Submodules

pymatgen.ext.cod module

pymatgen.ext.jhu module

pymatgen.ext.matproj module

Module contents

pymatgen.io package

Subpackages

pymatgen.io.abinit package

Subpackages

Submodules

Module contents

pymatgen.io.exciting package

Submodules

Module contents

pymatgen.io.feff package

Subpackages

Submodules

Module contents

pymatgen.io.lammps package

Subpackages

Submodules

Module contents

pymatgen.io.qchem_io package

Subpackages

Submodules

Module contents

pymatgen.io.vasp package

Subpackages

Submodules

Module contents

Submodules

pymatgen.io.adf module

pymatgen.io.aiida module

pymatgen.io.ase module

pymatgen.io.atat module

pymatgen.io.babel module

pymatgen.io.cif module

pymatgen.io.cssr module

pymatgen.io.fiesta module

pymatgen.io.gaussian module

pymatgen.io.lmto module

pymatgen.io.lobster module

pymatgen.io.nwchem module

pymatgen.io.phonopy module

pymatgen.io.pwscf module

pymatgen.io.qchem module

pymatgen.io.xcrysden module

pymatgen.io.xr module

pymatgen.io.xyz module

pymatgen.io.zeopp module

Module contents

pymatgen.optimization package

Subpackages

Submodules

pymatgen.optimization.linear_assignment module

pymatgen.optimization.linear_assignment_numpy module

Module contents

pymatgen.phonon package

Subpackages

Submodules

pymatgen.phonon.bandstructure module

pymatgen.phonon.dos module

pymatgen.phonon.plotter module

Module contents

pymatgen.symmetry package

Subpackages

Submodules

pymatgen.symmetry.analyzer module

pymatgen.symmetry.bandstructure module

pymatgen.symmetry.groups module

pymatgen.symmetry.maggroups module

pymatgen.symmetry.settings module

pymatgen.symmetry.structure module

Module contents

pymatgen.transformations package

Subpackages

Submodules

pymatgen.transformations.advanced_transformations module

pymatgen.transformations.defect_transformations module

pymatgen.transformations.site_transformations module

pymatgen.transformations.standard_transformations module

pymatgen.transformations.transformation_abc module

Module contents

pymatgen.util package

Subpackages

Submodules

pymatgen.util.convergence module

pymatgen.util.coord module

pymatgen.util.coord_cython module

pymatgen.util.io_utils module

pymatgen.util.num module

pymatgen.util.plotting module

pymatgen.util.provenance module

pymatgen.util.serialization module

pymatgen.util.string module

pymatgen.util.testing module

Module contents

pymatgen.vis package

Subpackages

Submodules

pymatgen.vis.plotters module

pymatgen.vis.structure_chemview module

pymatgen.vis.structure_vtk module

Module contents

Submodules

pymatgen.dao module

Module contents

This Page

Show Source

Quick search

    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

Navigation

          index

          modules |

pymatgen 2018.6.11 documentation »

        © Copyright 2011, Pymatgen Development Team.
      Created using Sphinx 1.7.5.

This page uses
Google Analytics to collect statistics. You can disable it by blocking
the JavaScript coming from www.google-analytics.com.


text:
extern "C" {
#endif

// SRDP frame types
//
#define SRDP_FT_REQ     0x01
#define SRDP_FT_ACK     0x02
#define SRDP_FT_ERR     0x03

// SRDP operations
//
#define SRDP_OP_SYNC    0x00
#define SRDP_OP_READ    0x01
#define SRDP_OP_WRITE   0x02
#define SRDP_OP_CHANGE  0x03

// SRDP errors
//
#define SRDP_ERR_NOT_IMPLEMENTED       -1
#define SRDP_ERR_NO_SUCH_DEVICE        -2
#define SRDP_ERR_NO_SUCH_REGISTER      -3
#define SRDP_ERR_INVALID_REG_POSLEN    -4
#define SRDP_ERR_INVALID_REG_OP        -5

// SRDP log levels
//
#define SRDP_LOGLEVEL_INFO    1
#define SRDP_LOGLEVEL_WARNING 2
#define SRDP_LOGLEVEL_ERROR   3

// SRDP frame header length (fixed)
//
#define SRDP_FRAME_HEADER_LEN      12

// SDRP frame data maximum length (configurable)
//
// MUST BE < (2^16 - SRDP_FRAME_HEADER_LEN) for UDP and as low
// as < (81 < SRDP_FRAME_HEADER_LEN) for transports such as 6LoWPAN
// over IEEE 802.15.4 with AES-CCM-128 leaving only 81 octets for
// the application layer.
//
#ifndef SRDP_FRAME_DATA_MAX_LEN
#  define SRDP_FRAME_DATA_MAX_LEN  (81 - SRDP_FRAME_HEADER_LEN)
#endif

#define SRDP_UDP_PORT 1910

#include <stddef.h>

#ifdef _MSC_VER
   // Oh well, even "stdint" is missing on VC2008 and older ..
   // http://stackoverflow.com/questions/126279/c99-stdint-h-header-and-ms-visual-studio
   // http://code.google.com/p/msinttypes/
#  include <windows_stdint.h>
#else
#  include <stdint.h>
#endif

#include <string.h>

// signed integer type large enough to hold any size_t value (which
// are unsigned)
typedef long ssize_t;

// Signature of transport reader function used by the SRDP channel.
// (API level: public)
//
typedef ssize_t (*srdp_transport_read) (void* userdata,
                                        uint8_t* data,
                                        size_t len);

// Signature of transport writer function used by the SRDP channel.
// (API level: public)
//
typedef ssize_t (*srdp_transport_write) (void* userdata,
                                         const uint8_t* data,
                                         size_t len);

// Callback for register read handler fired when host requests to
// read a register. (API level: public)
//
typedef int (*srdp_register_read) (void* userdata,
                                   int dev,
                                   int reg,
                                   int pos,
                                   int len,
                                   uint8_t* data);

// Callback for register write handler fired when host requests to
// write a register. (API level: public)
//
typedef int (*srdp_register_write) (void* userdata,
                                    int dev,
                                    int reg,
                                    int pos,
                                    int len,
                                    const uint8_t* data);

// Optional callback for SRDP library logging
//
typedef void (*srdp_log_message) (const char* msg, int level);

#ifdef SRDP_DEBUG_DUMMY

typedef char srdp_channel_t;

#else // SRDP_DEBUG_DUMMY

// SRDP frame header (API level: private)
//
typedef union {
   uint8_t buffer[SRDP_FRAME_HEADER_LEN];
   struct {
      uint16_t opdev;
      uint16_t seq;
      uint16_t reg;
      uint16_t pos;
      uint16_t len;
      uint16_t crc16;
   } fields;
} srdp_frame_header_t;

// SRDP frame (API level: private)
//
typedef struct {
   srdp_frame_header_t header;
   uint8_t data[SRDP_FRAME_DATA_MAX_LEN];
} srdp_frame_t;

// SRDP channel (API level: opaque)
//
typedef struct {

   // callbacks
   //
   srdp_transport_write transport_write;
   srdp_transport_read transport_read;
   srdp_register_write register_write;
   srdp_register_read register_read;
   srdp_log_message log_message;

   // arbitrary userdata forwarded to each callback
   //
   void* userdata;

   // incoming/outgoing frame
   //
   srdp_frame_t in;
   srdp_frame_t out;

   // incoming/outgoing frame sequence number
   //
   uint16_t _seq_in;
   uint16_t _seq_out;

   // currently received incoming data length
   //
   int _bytes_received;

   // the number of "SRDP_FT_REQ / SRDP_OP_CHANGE" frames we
   // sent to the host
   //
   uint32_t _sent_reg_change_req;

   // the number of "SRDP_FT_ACK / SRDP_OP_CHANGE" frames we
   // received from the host
   //
   uint32_t _recv_reg_change_ack;

   // the number of "SRDP_FT_ERR / SRDP_OP_CHANGE" frames we
   // received from the host
   //
   uint32_t _recv_reg_change_err;

   // wire level stats
   //
   uint64_t _loops;
   uint64_t _sent_octets;
   uint64_t _recv_octets;
   uint32_t _sent_frames;
   uint32_t _recv_frames;

} srdp_channel_t;

#endif // SRDP_DEBUG_DUMMY

// Initialize SRDP channel. (API level: public)
//
void srdp_init(srdp_channel_t* channel,
               srdp_transport_write transport_write,
               srdp_transport_read  transport_read,
               srdp_register_write  register_write,
               srdp_register_read   register_read,
               srdp_log_message     log_message,
               void* userdata);

// Called by driver when to transmit a register
// change (ie a sensor value change).  (API level: public)
//
int srdp_notify(srdp_channel_t* channel,
                int dev,
                int reg,
                int pos,
                int len);

// Called by driver to let SRDP processing happen.  (API level: public)
//
void srdp_loop(srdp_channel_t* channel);

// Set output frame to string value.
//
int srdp_set_string(uint8_t* data, const char* str);

#ifdef __cplusplus
}
#endif

#endif // SRDP_H


text:
<?php
/**
 * Admin View: Notice - Template Check
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

$theme = wp_get_theme();
?>

	<a class="woocommerce-message-close notice-dismiss" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-hide-notice', 'template_files' ), 'woocommerce_hide_notices_nonce', '_wc_notice_nonce' ) ); ?>"><?php _e( 'Dismiss', 'woocommerce' ); ?>

<?php printf( __( 'Your theme (%s) contains outdated copies of some WooCommerce template files. These files may need updating to ensure they are compatible with the current version of WooCommerce. You can see which files are affected from the %ssystem status page%s. If in doubt, check with the author of the theme.', 'woocommerce' ), esc_html( $theme['Name'] ), '', '' ); ?>

<?php _e( 'Learn More About Templates', 'woocommerce' ); ?>


text:
package org.zstack.header.storage.snapshot;

import org.zstack.header.core.ApiTimeout;
import org.zstack.header.message.DeletionMessage;
import org.zstack.header.vm.APIExpungeVmInstanceMsg;

/**
 */
@ApiTimeout(apiClasses = {APIDeleteVolumeSnapshotMsg.class, APIExpungeVmInstanceMsg.class})
public class VolumeSnapshotDeletionMsg extends DeletionMessage implements VolumeSnapshotMessage {
    private String snapshotUuid;
    private String volumeUuid;
    private boolean volumeDeletion;
    /**
     * @ignore
     */
    private String treeUuid;

    @Override
    public String getTreeUuid() {
        return treeUuid;
    }

    @Override
    public void setTreeUuid(String treeUuid) {
        this.treeUuid = treeUuid;
    }

    public boolean isVolumeDeletion() {
        return volumeDeletion;
    }

    public void setVolumeDeletion(boolean volumeDeletion) {
        this.volumeDeletion = volumeDeletion;
    }

    public String getSnapshotUuid() {
        return snapshotUuid;
    }

    @Override
    public String getVolumeUuid() {
        return volumeUuid;
    }

    @Override
    public void setVolumeUuid(String volumeUuid) {
        this.volumeUuid = volumeUuid;
    }

    public void setSnapshotUuid(String snapshotUuid) {
        this.snapshotUuid = snapshotUuid;
    }
}


text:
package com.adam.aslfms;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

import com.adam.aslfms.service.NetApp;
import com.adam.aslfms.service.ScrobblingService;
import com.adam.aslfms.util.AppSettings;
import com.adam.aslfms.util.AuthStatus;
import com.adam.aslfms.util.ScrobblesDatabase;
import com.adam.aslfms.util.Util;
import com.adam.aslfms.util.enums.SubmissionType;

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

/**
 * Created by bryan on 6/6/15.
 *
 * @author Bryan
 * @since 1.4.9
 */
public class StatusFragment extends Fragment {

    private static final String TAG = "StatusFragment";
    private static final String EXTRA_NETAPP = "StatusFragment.NETAPP";

    private NetApp mNetApp;

    private AppSettings settings;
    private ScrobblesDatabase mDb;

    private int mProfilePageLinkPosition = -1;

    private ListView mListView;

    public static StatusFragment newInstance(int netApp) {
        Bundle args = new Bundle();
        args.putSerializable(EXTRA_NETAPP, netApp);

        StatusFragment fragment = new StatusFragment();
        fragment.setArguments(args);

        return fragment;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_status, container, false);

        mListView = (ListView) rootView.findViewById(R.id.stats_list);
        mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                if (position == mProfilePageLinkPosition
                        && settings.getAuthStatus(mNetApp) == AuthStatus.AUTHSTATUS_OK) {
                    String url = mNetApp.getProfileUrl(settings);
                    Log.d(TAG, "Clicked link to profile page, opening: " + url);
                    Intent browser = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
                    startActivity(browser);
                }
            }
        });

        fillData();
        return rootView;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        int snapp = (int) getArguments().getSerializable(EXTRA_NETAPP);
        if (snapp < 1) {
            Log.e(TAG, "Got null snetapp");
            getActivity().finish();
        }
        mNetApp = NetApp.fromValue(snapp);

        settings = new AppSettings(getActivity());

        // TODO: remove
        mDb = new ScrobblesDatabase(getActivity());
        mDb.open();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        mDb.close();
    }

    @Override
    public void onPause() {
        super.onPause();

        getActivity().unregisterReceiver(onChange);
    }

    @Override
    public void onResume() {
        super.onResume();

        IntentFilter ifs = new IntentFilter();
        ifs.addAction(ScrobblingService.BROADCAST_ONSTATUSCHANGED);
        ifs.addAction(ScrobblingService.BROADCAST_ONAUTHCHANGED);
        getActivity().registerReceiver(onChange, ifs);

        fillData();
    }

    protected void fillData() {
        List<Pair> list = new ArrayList<Pair>();
        int numInCache = mDb.queryNumberOfScrobbles(mNetApp);

        // auth
        Pair auth = new Pair();
        if (settings.getAuthStatus(mNetApp) == AuthStatus.AUTHSTATUS_OK) {
            auth.setKey(getString(R.string.logged_in_just));
            auth.setValue(settings.getUsername(mNetApp));
        } else {
            auth.setKey(getString(R.string.not_logged_in));
            auth
                    .setValue(Util.getStatusSummary(getActivity(), settings, mNetApp,
                            false));
        }
        list.add(auth);

        // link to profile
        Pair prof_link = new Pair();
        prof_link.setKey(getString(R.string.profile_page));
        if (settings.getAuthStatus(mNetApp) == AuthStatus.AUTHSTATUS_OK) {
            prof_link.setValue(mNetApp.getProfileUrl(settings));
        } else {
            prof_link.setValue(getString(R.string.not_logged_in));
        }
        list.add(prof_link);
        mProfilePageLinkPosition = list.size() - 1;

        // scrobble
        Pair scrobble = new Pair();
        scrobble.setKey(getSubmissionStatusKey(SubmissionType.SCROBBLE));
        scrobble.setValue(getSubmissionStatusValue(SubmissionType.SCROBBLE));
        list.add(scrobble);

        // np
        Pair np = new Pair();
        np.setKey(getSubmissionStatusKey(SubmissionType.NP));
        np.setValue(getSubmissionStatusValue(SubmissionType.NP));
        list.add(np);

        // scrobbles in cache
        Pair cache = new Pair();
        cache.setKey(getString(R.string.scrobbles_cache_nonum));
        cache.setValue(Integer.toString(numInCache));
        list.add(cache);

        // scrobble stats
        Pair scstats = new Pair();
        scstats.setKey(getString(R.string.stats_scrobbles));
        scstats.setValue(Integer.toString(settings.getNumberOfSubmissions(
                mNetApp, SubmissionType.SCROBBLE)));
        list.add(scstats);

        // np stats
        Pair npstats = new Pair();
        npstats.setKey(getString(R.string.stats_nps));
        npstats.setValue(Integer.toString(settings.getNumberOfSubmissions(
                mNetApp, SubmissionType.NP)));
        list.add(npstats);

        // total scrobbles
        Pair tsStats = new Pair();
        tsStats.setKey(mNetApp.getName());
        tsStats.setValue(settings.getTotalScrobbles(mNetApp));
        list.add(tsStats);

        ArrayAdapter<Pair> adapter = new MyArrayAdapter(getActivity(),
                R.layout.status_info_row, R.id.key, list);

        mListView.setAdapter(adapter);
    }

    private String getSubmissionStatusKey(SubmissionType stype) {
        if (settings.wasLastSubmissionSuccessful(mNetApp, stype)) {
            return sGetLastAt(stype);
        } else {
            return sGetLastFailAt(stype);
        }
    }

    private String getSubmissionStatusValue(SubmissionType stype) {
        long time = settings.getLastSubmissionTime(mNetApp, stype);
        String when;
        String what;
        if (time == -1) {
            when = getString(R.string.never);
            what = "";
        } else {
            when = Util.timeFromLocalMillis(getActivity(), time);
            what = "\n" + settings.getLastSubmissionInfo(mNetApp, stype);
        }

        return when + what;
    }

    private String sGetLastAt(SubmissionType stype) {
        if (stype == SubmissionType.SCROBBLE) {
            return getString(R.string.scrobble_last_at);
        } else {
            return getString(R.string.nowplaying_last_at);
        }
    }

    private String sGetLastFailAt(SubmissionType stype) {
        if (stype == SubmissionType.SCROBBLE) {
            return getString(R.string.scrobble_last_fail_at);
        } else {
            return getString(R.string.nowplaying_last_fail_at);
        }
    }

    private BroadcastReceiver onChange = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            if (intent.getExtras() != null) {
                String snapp = intent.getStringExtra("netapp");
                if (snapp == null) {
                    Log.e(TAG, "Got null snetapp from broadcast");
                    return;
                }
                NetApp napp = NetApp.valueOf(snapp);
                if (napp == getNetApp()) {
                    StatusFragment.this.fillData();
                }
            }
        }
    };

    protected synchronized NetApp getNetApp() {
        return mNetApp;
    }

    private static class Pair {
        private String key;
        private String value;

        private Pair() {
            super();
        }

        private Pair(String key, String value) {
            super();
            this.key = key;
            this.value = value;
        }

        public String getKey() {
            return key;
        }

        public void setKey(String key) {
            this.key = key;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }
    }

    private class MyArrayAdapter extends ArrayAdapter<Pair> {

        public MyArrayAdapter(Context context, int resource,
                              int textViewResourceId, List<Pair> list) {
            super(context, resource, textViewResourceId, list);
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            View view = LayoutInflater.from(getContext()).inflate(
                    R.layout.status_info_row, parent, false);

            Pair item = this.getItem(position);

            TextView keyView = (TextView) view.findViewById(R.id.key);
            keyView.setText(item.getKey());

            TextView valueView = (TextView) view.findViewById(R.id.value);
            valueView.setText(item.getValue());

            return view;
        }

    }
}


text:
package iso20022

// Choice of format for the processing position.
type ProcessingPosition1Choice struct {

	// Processing position expressed as an ISO 20022 code.
	Code *ProcessingPosition3Code `xml:"Cd"`

	// Processing position expressed as a proprietary code.
	Proprietary *GenericIdentification20 `xml:"Prtry"`
}

func (p *ProcessingPosition1Choice) SetCode(value string) {
	p.Code = (*ProcessingPosition3Code)(&value)
}

func (p *ProcessingPosition1Choice) AddProprietary() *GenericIdentification20 {
	p.Proprietary = new(GenericIdentification20)
	return p.Proprietary
}


text:
# encoding: utf-8

require 'adhearsion/linux_proc_name'
require 'adhearsion/rayo/initializer'
require 'adhearsion/http_server'
require 'rbconfig'

module Adhearsion
  class Initializer

    class << self
      def start(*args, &block)
        new(*args, &block).start
      end
    end

    attr_reader :path

    def initialize(options = {})
      @@started = true
      @path     = path
      @console  = options[:console]
      @loaded_init_files  = options[:loaded_init_files]
      Adhearsion.root = '.'
    end

    def start
      catch :boot_aborted do
        configure_plugins
        load_lib_folder
        load_config_file
        load_events_file
        load_routes_file

        Adhearsion.statistics
        start_logging
        debugging_log
        launch_console if need_console?
        catch_termination_signal
        set_ahn_proc_name
        initialize_exception_logger
        setup_i18n_load_path
        Rayo::Initializer.init
        HTTPServer.start
        init_plugins

        Rayo::Initializer.run
        run_plugins
        trigger_after_initialized_hooks

        Adhearsion::Process.booted if Adhearsion.status == :booting

        logger.info "Adhearsion v#{Adhearsion::VERSION} initialized in \"#{Adhearsion.environment}\"!" if Adhearsion.status == :running
      end

      # This method will block until all important threads have finished.
      # When it does, the process will exit.
      join_important_threads
      self
    end

    def debugging_items
      [
        "OS: #{RbConfig::CONFIG['host_os']} - RUBY: #{RUBY_ENGINE} #{RUBY_VERSION}",
        "Environment: #{ENV.inspect}",
        Adhearsion.config.description(:all),
        "Gem versions: #{Gem.loaded_specs.inject([]) { |c,g| c << "#{g[0]} #{g[1].version}" }}"
      ]
    end

    def debugging_log
      debugging_items.each do |item|
        logger.trace item
      end
    end

    def setup_i18n_load_path
      Adhearsion.config.core.i18n.locale_path.each do |dir|
        logger.debug "Adding #{dir} to the I18n load path"
        I18n.load_path += Dir["#{dir}/**/*.yml"]
      end
    end

    def catch_termination_signal
      self_read, self_write = IO.pipe

      %w(INT TERM HUP ALRM ABRT).each do |sig|
        trap sig do
          self_write.puts sig
        end
      end

      Thread.new do
        begin
          while readable_io = IO.select([self_read])
            signal = readable_io.first[0].gets.strip
            handle_signal signal
          end
        rescue => e
          logger.error "Crashed reading signals"
          logger.error e
          exit 1
        end
      end
    end

    def handle_signal(signal)
      case signal
      when 'INT', 'TERM'
        logger.info "Received SIG#{signal}. Shutting down."
        Adhearsion::Process.shutdown
      when 'ALRM'
        logger.info "Received SIGALRM. Toggling trace logging."
        Adhearsion::Logging.toggle_trace!
      when 'ABRT'
        logger.info "Received ABRT signal. Forcing stop."
        Adhearsion::Process.force_stop
      end
    end

    ##
    # Loads files in application lib folder
    # @return [Boolean] if files have been loaded (lib folder is configured to not nil and actually exists)
    def load_lib_folder
      return false if Adhearsion.config.core.lib.nil?

      lib_folder = [Adhearsion.config.core.root, Adhearsion.config.core.lib].join '/'
      return false unless File.directory? lib_folder

      $LOAD_PATH.unshift lib_folder

      Dir.chdir lib_folder do
        rbfiles = File.join "**", "*.rb"
        Dir.glob(rbfiles).each do |file|
          require "#{lib_folder}/#{file}"
        end
      end
      true
    end

    def load_config_file
      load "#{Adhearsion.config.root}/config/adhearsion.rb"
    end

    def load_events_file
      Adhearsion::Events.init
      path = "#{Adhearsion.config.root}/config/events.rb"
      load path if File.exists?(path)
    end

    def load_routes_file
      path = "#{Adhearsion.config.root}/config/routes.rb"
      load path if File.exists?(path)
    end

    def configure_plugins
      Plugin.configure_plugins
    end

    def init_plugins
      Plugin.init_plugins
    end

    def run_plugins
      Plugin.run_plugins
    end

    def need_console?
      @console == true
    end

    def launch_console
      Thread.new do
        catching_standard_errors do
          Adhearsion::Console.run
        end
      end
    end

    def start_logging
      Adhearsion::Logging.start Adhearsion.config.core.logging.level, Adhearsion.config.core.logging.formatter
    end

    def initialize_exception_logger
      Events.register_handler :exception do |e, l|
        (l || logger).error e
      end
    end

    def set_ahn_proc_name
      Adhearsion::LinuxProcName.set_proc_name Adhearsion.config.core.process_name
    end

    def trigger_after_initialized_hooks
      Events.trigger_immediately :after_initialized
    end

    ##
    # This method will block Thread.main() until calling join() has returned for all Threads in Adhearsion::Process.important_threads.
    # Note: important_threads won't always contain Thread instances. It simply requires the objects respond to join().
    #
    def join_important_threads
      # Note: we're using this ugly accumulator to ensure that all threads have ended since IMPORTANT_THREADS will almost
      # certainly change sizes after this method is called.
      index = 0
      until index == Adhearsion::Process.important_threads.size
        begin
          Adhearsion::Process.important_threads[index].join
        rescue => e
          logger.error "Error after joining Thread #{Thread.inspect}. #{e.message}"
        ensure
          index = index + 1
        end
      end
    end

    InitializationFailedError = Class.new Adhearsion::Error
  end
end


text:
env="development"
if [ $# -gt 0 ]; then
	env=$1
fi

sudo gem uninstall eco_apps_auth -I
gem build eco_apps_auth.gemspec
sudo gem install --no-rdoc --no-ri eco_apps_auth-0.2.0.gem


text:
namespace ash {

class TestShellDelegate : public ShellDelegate {
 public:
  TestShellDelegate();
  ~TestShellDelegate() override;

  // Allows tests to override the MultiDeviceSetup binding behavior for this
  // TestShellDelegate.
  using MultiDeviceSetupBinder = base::RepeatingCallback<void(
      mojo::PendingReceiver<
          chromeos::multidevice_setup::mojom::MultiDeviceSetup>)>;
  void SetMultiDeviceSetupBinder(MultiDeviceSetupBinder binder) {
    multidevice_setup_binder_ = std::move(binder);
  }

  // Overridden from ShellDelegate:
  bool CanShowWindowForUser(const aura::Window* window) const override;
  std::unique_ptr<ScreenshotDelegate> CreateScreenshotDelegate() override;
  AccessibilityDelegate* CreateAccessibilityDelegate() override;
  std::unique_ptr<BackGestureContextualNudgeDelegate>
  CreateBackGestureContextualNudgeDelegate(
      BackGestureContextualNudgeController* controller) override;
  bool CanGoBack(gfx::NativeWindow window) const override;
  void BindNavigableContentsFactory(
      mojo::PendingReceiver<content::mojom::NavigableContentsFactory> receiver)
      override;
  void BindMultiDeviceSetup(
      mojo::PendingReceiver<
          chromeos::multidevice_setup::mojom::MultiDeviceSetup> receiver)
      override;

  void SetCanGoBack(bool can_go_back);

 private:
  // True if the current top window can back.
  bool can_go_back_ = true;

  MultiDeviceSetupBinder multidevice_setup_binder_;

  DISALLOW_COPY_AND_ASSIGN(TestShellDelegate);
};

}  // namespace ash

#endif  // ASH_TEST_SHELL_DELEGATE_H_


text:
namespace node_example
{
ExampleListener::ExampleListener(ros::NodeHandle nh)
{
  // Create a subscriber.
  // Name the topic, message queue, callback function with class name, and object containing callback function.
  sub_ = nh.subscribe("example", 10, &ExampleListener::messageCallback, this);
}

void ExampleListener::messageCallback(const node_example::NodeExampleData::ConstPtr &msg)
{
  // Note that these are only set to INFO so they will print to a terminal for example purposes.
  // Typically, they should be DEBUG.
  ROS_INFO("message is %s, a + b = %d", msg->message.c_str(), msg->a + msg->b);
}
}


text:
"""Power tools.

Created on Tue Jun 13 15:10:04 2017

@author: pasca
"""

from nipype.interfaces.base import BaseInterface,\
    BaseInterfaceInputSpec, traits, TraitedSpec
from ..power import _compute_mean_band_psd

class PowerBandInputSpec(BaseInterfaceInputSpec):
    """Input specification for PowerBand."""

    psds_file = traits.File(exists=True,
                            desc='psd tensor and frequencies in .npz format',
                            mandatory=True)

    freq_bands = traits.List(desc='frequency bands', mandatory=True)

class PowerBandOutputSpec(TraitedSpec):
    """Output spec for PowerBand."""

    mean_power_band_file = traits.File(exists=True,
                                       desc="mean psd in bands in .npy format")

class PowerBand(BaseInterface):
    """Compute mean power spectral density for each frequency band.

    Then, it's save in a  numpy file .npy

    Parameters
    ----------
    psds_file
        type = File, exists=True, desc='psd tensor and frequencies in .npz
               format', mandatory=True
    freq_bands
        type = List of Float, desc='frequency bands', mandatory=True

    Returns
    -------
    mean_power_band_file
        type = File, exists=True, desc="mean psd in bands in .npy format"
    """

    input_spec = PowerBandInputSpec
    output_spec = PowerBandOutputSpec

    def _run_interface(self, runtime):

        psds_file = self.inputs.psds_file
        freq_bands = self.inputs.freq_bands

        self.mean_power_band_file = _compute_mean_band_psd(psds_file,
                                                           freq_bands)

        return runtime

    def _list_outputs(self):

        outputs = self._outputs().get()
        outputs['mean_power_band_file'] = self.mean_power_band_file

        return outputs


text:
namespace content {
class ShellBrowserContext;
}

namespace views {
namespace examples {

class ExamplesBrowserMainParts;

class ExamplesContentBrowserClient : public content::ContentBrowserClient {
 public:
  ExamplesContentBrowserClient();
  virtual ~ExamplesContentBrowserClient();

  // Overridden from content::ContentBrowserClient:
  virtual content::BrowserMainParts* CreateBrowserMainParts(
      const content::MainFunctionParams& parameters) OVERRIDE;

  content::ShellBrowserContext* browser_context();

 private:
  ExamplesBrowserMainParts* examples_browser_main_parts_;

  DISALLOW_COPY_AND_ASSIGN(ExamplesContentBrowserClient);
};

}  // namespace examples
}  // namespace views

#endif  // UI_VIEWS_EXAMPLES_CONTENT_CLIENT_EXAMPLES_CONTENT_BROWSER_CLIENT_H_


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.firstteam1719.dashboard.dashboardtestrobot;

import edu.wpi.first.wpilibj.networktables.NetworkTable;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

/**
 *
 * @author aaroneline
 */
public class DashBoardTestRobot {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws InterruptedException {
        // TODO code application logic here

        NetworkTable.setClientMode();
        NetworkTable.setIPAddress("127.0.0.1");

        SmartDashboard.putNumber("Test", 3);

        NetworkTable.getTable("SmartDashboard");

    }
}


text:
package ru.hh.hadoop.webhcat.hive;

public class Column {
  private String name;
  private String type;
  private String comment;

  Column() {
  }

  Column(String name, String type, String comment) {
    this.name = name;
    this.type = type;
    this.comment = comment;
  }

  public String getName() {
    return name;
  }

  public String getType() {
    return type;
  }

  public String getComment() {
    return comment;
  }
}


text:
<?php

use yii\helpers\Inflector;
use yii\helpers\StringHelper;

/* @var $this yii\web\View */
/* @var $generator yii\gii\generators\crud\Generator */

echo "<?php\n";
?>

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model <?= ltrim($generator->searchModelClass, '\\') ?> */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="<?= Inflector::camel2id(StringHelper::basename($generator->modelClass)) ?>-search">

    <?= "<?php " ?>$form = ActiveForm::begin([
        'action' => ['index'],
        'method' => 'get',
    ]); ?>

<?php
$count = 0;
foreach ($generator->getColumnNames() as $attribute) {
    if (++$count < 6) {
        echo "    <?= " . $generator->generateActiveSearchField($attribute) . " ?>\n\n";
    } else {
        echo "    <?php // echo " . $generator->generateActiveSearchField($attribute) . " ?>\n\n";
    }
}
?>

        <?= "<?= " ?>Html::submitButton(<?= $generator->generateString('Buscar') ?>, ['class' => 'btn btn-primary']) ?>
        <?= "<?= " ?>Html::resetButton(<?= $generator->generateString('Reiniciar') ?>, ['class' => 'btn btn-default']) ?>

    <?= "<?php " ?>ActiveForm::end(); ?>


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white_grey"
    android:orientation="vertical">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/red_white"
        android:gravity="center_horizontal"
        android:text="@string/set_password"
        android:padding="10dp"
        android:textColor="@color/black"
        android:textSize="@dimen/txt_xl" />

    <EditText
        android:inputType="textPassword"
        android:id="@+id/et_password"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="请输入密码" />

    <EditText
        android:inputType="textPassword"
        android:id="@+id/et_cofirm"
        android:hint="请再次输入密码"
        android:layout_height="wrap_content"
        android:layout_width="match_parent" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <Button
            android:id="@+id/btnOk"
            android:layout_weight="1"
            android:layout_width="0dp"
            android:text="@string/confirm"
            android:layout_marginRight="@dimen/space_m"
            android:textColor="@color/black"
            android:layout_height="wrap_content" />

        <Button
            android:id="@+id/btnCan"
            android:text="@string/cancel"
            android:layout_marginLeft="@dimen/space_m"
            android:textColor="@color/black"
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="wrap_content" />
    </LinearLayout>

</LinearLayout>


text:
require File.expand_path('../base', __FILE__)

class EftStallTest < Test::Unit::TestCase
  include FunctionalBase

  def test_no_operation

    pdef = Ruote.define do
      stall
    end

    #@dashboard.noisy = true

    wfid = @dashboard.launch(pdef)

    sleep 0.750

    ps = @dashboard.ps(wfid)

    assert_equal 0, ps.errors.size
    assert_equal 2, ps.expressions.size
    assert_equal 'stall', ps.expressions.last.name
  end
end


text:
author_name: "Paul Tremblay"
link: "https://www.goodreads.com/review/show/3350312628?utm_medium=api&utm_source=rss"
image_url: "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1563468739l/49674113._SX50_SY75_.jpg"
small_image_url: "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1563468739l/49674113._SX50_SY75_.jpg"
medium_image_url: "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1563468739l/49674113._SX98_SY160_.jpg"
large_image_url: "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1563468739l/49674113._SX318_SY475_.jpg"
slug: "the-last-conversation"
date: "Fri, 22 May 2020 06:15:03 -0700"
group: "read"
title: "The Last Conversation"
collectionName: "books"
---
What's more frightening: Not knowing who you are? Or finding out? A Bram Stoker Award–winning author explores the answer in a chilling story about identity and human consciousness.

Imagine you've woken up in an unfamiliar room with no memory of who you are, how you got there, or where you were before. All you have is the disconnected voice of an attentive caretaker. Dr. Kuhn is there to help you—physically, emotionally, and psychologically. She'll help you remember everything. She'll make sure you reclaim your lost identity. Now answer one question: Are you sure you want to?

Paul Tremblay's *The Last Conversation*is part of Forward, a collection of six stories of the near and far future from out-of-this-world authors. Each piece can be read or listened to in a single thought-provoking sitting.


text:
BASESTRING='docker run -p 8888:8888 -p 6006:6006 -v /media/sf_shared:/root/sharedfolder lprisan/dl-docker-loadcaffe:cpu /root/sharedfolder/paper-JLA-deep-teaching-analytics/src/models/'
COUNT=($(wc -l $1))
echo "Running python scripts in docker...." $COUNT $BASESTRING

#IFS=$'\r\n' GLOBIGNORE='*' command eval  'XYZ=($(cat $1))'

counter=0
while read p; do
  COMMAND=$BASESTRING$p
  echo $counter "Executing" $COMMAND
  eval $COMMAND
  counter=$((counter+1))
done <$1


text:
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
	xmlns:g="urn:import:com.google.gwt.user.client.ui"
	xmlns:c="urn:import:gwt.material.design.client.custom">
	<ui:style>

	</ui:style>
	<g:HTMLPanel>

				Off
				<c:CustomCheckBox ui:field="cbBox"/>

				On

	</g:HTMLPanel>
</ui:UiBinder>


text:
require_relative 'functions'
require_relative 'xpath_parser'

module REXML
  # Wrapper class.  Use this class to access the XPath functions.
  class XPath
    include Functions
    # A base Hash object, supposing to be used when initializing a
    # default empty namespaces set, but is currently unused.
    # TODO: either set the namespaces=EMPTY_HASH, or deprecate this.
    EMPTY_HASH = {}

    # Finds and returns the first node that matches the supplied xpath.
    # element::
    #   The context element
    # path::
    #   The xpath to search for.  If not supplied or nil, returns the first
    #   node matching '*'.
    # namespaces::
    #   If supplied, a Hash which defines a namespace mapping.
    # variables::
    #   If supplied, a Hash which maps $variables in the query
    #   to values. This can be used to avoid XPath injection attacks
    #   or to automatically handle escaping string values.
    #
    #  XPath.first( node )
    #  XPath.first( doc, "//b"} )
    #  XPath.first( node, "a/x:b", { "x"=>"http://doofus" } )
    #  XPath.first( node, '/book/publisher/text()=$publisher', {}, {"publisher"=>"O'Reilly"})
    def XPath::first(element, path=nil, namespaces=nil, variables={}, options={})
      raise "The namespaces argument, if supplied, must be a hash object." unless namespaces.nil? or namespaces.kind_of?(Hash)
      raise "The variables argument, if supplied, must be a hash object." unless variables.kind_of?(Hash)
      parser = XPathParser.new(**options)
      parser.namespaces = namespaces
      parser.variables = variables
      path = "*" unless path
      element = [element] unless element.kind_of? Array
      parser.parse(path, element).flatten[0]
    end

    # Iterates over nodes that match the given path, calling the supplied
    # block with the match.
    # element::
    #   The context element
    # path::
    #   The xpath to search for.  If not supplied or nil, defaults to '*'
    # namespaces::
    #   If supplied, a Hash which defines a namespace mapping
    # variables::
    #   If supplied, a Hash which maps $variables in the query
    #   to values. This can be used to avoid XPath injection attacks
    #   or to automatically handle escaping string values.
    #
    #  XPath.each( node ) { |el| ... }
    #  XPath.each( node, '/*[@attr='v']' ) { |el| ... }
    #  XPath.each( node, 'ancestor::x' ) { |el| ... }
    #  XPath.each( node, '/book/publisher/text()=$publisher', {}, {"publisher"=>"O'Reilly"}) \
    #    {|el| ... }
    def XPath::each(element, path=nil, namespaces=nil, variables={}, options={}, &block)
      raise "The namespaces argument, if supplied, must be a hash object." unless namespaces.nil? or namespaces.kind_of?(Hash)
      raise "The variables argument, if supplied, must be a hash object." unless variables.kind_of?(Hash)
      parser = XPathParser.new(**options)
      parser.namespaces = namespaces
      parser.variables = variables
      path = "*" unless path
      element = [element] unless element.kind_of? Array
      parser.parse(path, element).each( &block )
    end

    # Returns an array of nodes matching a given XPath.
    def XPath::match(element, path=nil, namespaces=nil, variables={}, options={})
      parser = XPathParser.new(**options)
      parser.namespaces = namespaces
      parser.variables = variables
      path = "*" unless path
      element = [element] unless element.kind_of? Array
      parser.parse(path,element)
    end
  end
end


text:
package org.unique.web.core;

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

import org.unique.web.util.WebUtil;

/**
 * threadloacal context
 * @author:rex
 * @date:2014年8月22日
 * @version:1.0
 */
public final class ActionContext {

    private static final ThreadLocal<ActionContext> actionContextThreadLocal = new ThreadLocal<ActionContext>();

    private ServletContext context;
    private HttpServletRequest request;
    private HttpServletResponse response;

    /**
     * get ServletContext
     */
    public ServletContext getServletContext() {
        return context;
    }

    /**
     * get Request
     */
    public HttpServletRequest getHttpServletRequest() {
        return request;
    }

    /**
     * get Response
     */
    public HttpServletResponse getHttpServletResponse() {
        return response;
    }

    /**
     * get HttpSession
     */
    public HttpSession getHttpSession() {
        return request.getSession();
    }

    /**
     * get ActionContext
     */
    public static ActionContext single() {
        ActionContext actionContext = actionContextThreadLocal.get();
        if(null != actionContext){
            return actionContext;
        }
        actionContextThreadLocal.set(new ActionContext());
        return actionContextThreadLocal.get();
    }

    public String getContextPath(){
        return context.getContextPath();
    }

    void setActionContext(ServletContext context){
        WebUtil.setWebRootPath(context.getRealPath("/"));
        single().context = context;
    }

    void setActionContext(HttpServletRequest request, HttpServletResponse response) {
        single().request = request;
        single().response = response;
        actionContextThreadLocal.set(single());
    }

    static void removeActionContext() {
        actionContextThreadLocal.remove();
    }
}


text:
Blog-Site
=========

My blog website


text:
<?php

declare(strict_types = 1);

namespace WebHemi\Data\Driver;

/**
 * Interface DriverInterface.
 */
interface DriverInterface
{
}


text:
package uk.ac.ebi.arrayexpress.components;

import net.sf.saxon.Configuration;
import net.sf.saxon.om.DocumentInfo;
import net.sf.saxon.om.ValueRepresentation;
import net.sf.saxon.trans.XPathException;
import net.sf.saxon.xpath.XPathEvaluator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xmldb.api.base.ResourceSet;
import org.xmldb.api.modules.XPathQueryService;

import uk.ac.ebi.arrayexpress.app.Application;
import uk.ac.ebi.arrayexpress.app.ApplicationComponent;
import uk.ac.ebi.arrayexpress.components.Events.IEventInformation;
import uk.ac.ebi.arrayexpress.utils.RegexHelper;
import uk.ac.ebi.arrayexpress.utils.StringTools;
import uk.ac.ebi.arrayexpress.utils.persistence.FilePersistence;
import uk.ac.ebi.arrayexpress.utils.persistence.PersistableString;
import uk.ac.ebi.arrayexpress.utils.persistence.PersistableStringList;
import uk.ac.ebi.arrayexpress.utils.saxon.DocumentUpdater;
import uk.ac.ebi.arrayexpress.utils.saxon.ExtFunctions;
import uk.ac.ebi.arrayexpress.utils.saxon.IDocumentSource;
import uk.ac.ebi.arrayexpress.utils.saxon.PersistableDocumentContainer;
import uk.ac.ebi.arrayexpress.utils.saxon.search.IndexEnvironmentBiosamplesGroup;
import uk.ac.ebi.arrayexpress.utils.saxon.search.IndexEnvironmentExperiments;
import uk.ac.ebi.arrayexpress.utils.saxon.search.Indexer;

import javax.xml.transform.stream.StreamSource;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import java.io.File;
import java.net.URL;
import java.util.*;

import org.xmldb.api.base.Collection;

public class BioSamplesGroup extends ApplicationComponent implements
		IDocumentSource {
	// logging machinery
	private final Logger logger = LoggerFactory.getLogger(getClass());

	private final RegexHelper ARRAY_ACCESSION_REGEX = new RegexHelper(
			"^[aA]-\\w{4}-\\d+$", "");

	// private FilePersistence<PersistableDocumentContainer> document;

	private SaxonEngine saxon;
	private SearchEngine search;
	private Autocompletion autocompletion;

	private boolean buildIndexes;

	public final String INDEX_ID = "biosamplesgroup";

	public BioSamplesGroup() {

	}

	public void initialize() throws Exception {
		buildIndexes= Application
				.getInstance().getPreferences().getBoolean("bs.buildLuceneIndexes");

		this.saxon = (SaxonEngine) getComponent("SaxonEngine");
		this.search = (SearchEngine) getComponent("SearchEngine");
		this.autocompletion = (Autocompletion) getComponent("Autocompletion");

		//TODO: change this (I will never restart the server with an incremental update, even though I shoul change it)
				if(buildIndexes){
					updateIndex(Indexer.RebuildCategories.REBUILD);
				}
				else{
					updateIndex(Indexer.RebuildCategories.NOTREBUILD);
				}

//		TODO rpe
		//updateAccelerators(docTemp);
		this.saxon.registerDocumentSource(this);

		//
		// setExperimentsNumber(this.document.)
	}

	public void terminate() throws Exception {
	}

	// implementation of IDocumentSource.getDocumentURI()
	//TODO rpe (this must be reformulated)
	public String getDocumentURI() {
		return "BioSamplesGroup.xml";
	}

	// implementation of IDocumentSource.getDocument()
	// this is not the best way to do it ... but i dont know if in a near future
	// we will create a staging area and all the xml files references will
	// disappear, so
	public synchronized DocumentInfo getDocument() throws Exception {
		return getXmlFromFile(new File(getPreferences().getString(
				"bs.experiments.persistence-location")));
	}

	// implementation of IDocumentSource.setDocument(DocumentInfo)
	public synchronized void setDocument(DocumentInfo doc) throws Exception {
		throw new UnsupportedOperationException("This is temporary situation, all Xml reference are being removed, and this methos wont be supported in the future!");
	}

	private void updateIndex(Indexer.RebuildCategories rebuild) {
		try {

			this.search.getController().indexFromXmlDB(INDEX_ID, rebuild);
			//I need to do this because when I initialize the server with the interface.application.lucene.indexes.build=true I need to restart the indexreader;
			this.search.getController().getEnvironment(INDEX_ID).setup();

//			TODO review the autocompletion because of time it takes (maybe the problem is the xml field)
			this.autocompletion.rebuildBioSamplesGroup();
		} catch (Exception x) {
			this.logger.error("Caught an exception:", x);
		}
	}

	//used to reload the index after the synchronization process
	public void reloadIndex() {
		try {
			//String indexLocationDirectory= this.search.getController().getEnvironment(INDEX_ID).indexLocationDirectory + "_" + System.currentTimeMillis();
			this.search.getController().indexFromXmlDB(INDEX_ID, Indexer.RebuildCategories.NOTREBUILD);
			this.autocompletion.rebuildBioSamplesGroup();
		} catch (Exception x) {
			this.logger.error("Caught an exception:", x);
		}
	}

	//TODO move this to anoher place (i will not do now because i dont know from where I will read the xml source... maybe in the future I will not use the file!!
	public DocumentInfo getXmlFromFile(File file) throws Exception {
		Configuration config = ((SaxonEngine) Application
				.getAppComponent("SaxonEngine")).trFactory.getConfiguration();
		DocumentInfo doc = null;
		doc = config.buildDocument(new StreamSource(file));

		return doc;
	}

	@Override
	public String getMetaDataInformation(){

		String info=((IndexEnvironmentBiosamplesGroup)this.search.getController().getEnvironment(INDEX_ID)).getMetadataInformation();
    	return info;
    }

}


text:
package com.intellij.ide.fileTemplates.impl;

import com.intellij.ide.fileTemplates.FileTemplate;
import com.intellij.ide.fileTemplates.FileTemplateUtil;
import com.intellij.ui.ListSpeedSearch;
import com.intellij.ui.components.JBList;
import com.intellij.util.Function;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;

/**
 * @author Alexey Kudravtsev
 */
abstract class FileTemplateTabAsList extends FileTemplateTab {
  private final JList<FileTemplate> myList = new JBList<>();
  private MyListModel myModel;

  FileTemplateTabAsList(String title) {
    super(title);
    myList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    myList.setCellRenderer(new MyListCellRenderer());
    myList.addListSelectionListener(__ -> onTemplateSelected());
    new ListSpeedSearch(myList, (Function<Object, String>)o -> {
      if (o instanceof FileTemplate) {
        return ((FileTemplate)o).getName();
      }
      return null;
    });
  }

  private class MyListCellRenderer extends DefaultListCellRenderer {
    @Override
    public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
      super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
      Icon icon = null;
      if (value instanceof FileTemplate) {
        FileTemplate template = (FileTemplate) value;
        icon = FileTemplateUtil.getIcon(template);
        final boolean internalTemplate = AllFileTemplatesConfigurable.isInternalTemplate(template.getName(), getTitle());
        if (internalTemplate) {
          setFont(getFont().deriveFont(Font.BOLD));
          setText(template.getName());
        }
        else {
          setFont(getFont().deriveFont(Font.PLAIN));
          setText(template.getName());
        }

        if (!template.isDefault()) {
          if (!isSelected) {
            setForeground(MODIFIED_FOREGROUND);
          }
        }
      }
      setIcon(icon);
      return this;
    }
  }

  @Override
  public void removeSelected() {
    final FileTemplate selectedTemplate = getSelectedTemplate();
    if (selectedTemplate == null) {
      return;
    }
    final DefaultListModel model = (DefaultListModel) myList.getModel();
    final int selectedIndex = myList.getSelectedIndex();
    model.remove(selectedIndex);
    if (!model.isEmpty()) {
      myList.setSelectedIndex(Math.min(selectedIndex, model.size() - 1));
    }
    onTemplateSelected();
  }

  private static class MyListModel extends DefaultListModel<FileTemplate> {
    void fireListDataChanged() {
      int size = getSize();
      if (size > 0) {
        fireContentsChanged(this, 0, size - 1);
      }
    }
  }

  @Override
  protected void initSelection(FileTemplate selection) {
    myModel = new MyListModel();
    myList.setModel(myModel);
    for (FileTemplate template : myTemplates) {
      myModel.addElement(template);
    }
    if (selection != null) {
      selectTemplate(selection);
    }
    else if (myList.getModel().getSize() > 0) {
      myList.setSelectedIndex(0);
    }
  }

  @Override
  public void fireDataChanged() {
    myModel.fireListDataChanged();
  }

  @Override
  @NotNull
  public FileTemplate[] getTemplates() {
    final int size = myModel.getSize();
    List<FileTemplate> templates = new ArrayList<>(size);
    for (int i =0; i<size; i++) {
      templates.add(myModel.getElementAt(i));
    }
    return templates.toArray(new FileTemplate[templates.size()]);
  }

  @Override
  public void addTemplate(FileTemplate newTemplate) {
    myModel.addElement(newTemplate);
  }

  @Override
  public void selectTemplate(FileTemplate template) {
    myList.setSelectedValue(template, true);
  }

  @Override
  public FileTemplate getSelectedTemplate() {
    return myList.getSelectedValue();
  }

  @Override
  public JComponent getComponent() {
    return myList;
  }
}


text:
// Global reference to the code editor.
var editor;

/**
 * Add a new message to the message list above the console.
 */
function addMessage(message_class, message_text, callback) {
    var message = $("

");
    message.text(message_text);
    message.addClass("message");
    message.addClass(message_class);
    message.appendTo("#messages");
    message.fadeIn(200).delay(2000).slideUp(200, function() {
        message.remove();
        if (callback !== undefined) {
            callback();
        }
    });
}

/**
 * Remove all messages from the message list above the console.
 */
function clearMessages() {
    $("#messages").children().remove();
}

/**
 * Display all the compilation errors.
 */
function showErrors(errors) {
    clearErrors();
    for(var i=0;i!=errors.length;++i) {
		var error = errors[i];
        markError(error);
    }
}

/**
 * Add an appropriate marker for a given JSON error object, as
 * returned from the server.
 */
function markError(error) {
    if(error.start !== "" && error.end !== "" && error.line !== "") {
	// First, add error markers
        editor.getSession().setAnnotations([{
            row: error.line - 1,
            column: error.start,
            text: error.text.replace("\\n","\n"),
            type: "error"
        }]);
	underScoreError(error,"error-message","error");
	// Second, add context markers (if any)
	for (var i = 0; i < error.context.length; i++) {
	    underScoreError(error.context[i],"context-message","error");
	}
    } else {
        addMessage("error", error.text);
    }
}

function underScoreError(error,kind,message) {
    var range = new ace.Range(error.line-1, error.start, error.line-1, error.end+1);
    editor.markers.push(editor.getSession().addMarker(range, kind, message, false));
}

/**
 * Clear all the compilation errors.
 *
 * Clear all markers (including those in the gutter) from the editor.
 * This is to prevent markers from a previous compilation from hanging
 * around.
 */
function clearErrors() {
    editor.getSession().clearAnnotations();
    for (var i = 0; i < editor.markers.length; i++) {
        editor.getSession().removeMarker(editor.markers[i]);
    }
    editor.markers = [];
}

/**
 * Compile a given snippet of Whiley code.
 */
function compile() {
    var console = document.getElementById("console");
    var verify = document.getElementById("verification");
    var request = { code: editor.getValue(), verify: verify.checked };
    $.post(root_url + "/compile", request, function(response) {
        clearMessages();
        console.value = "";
        $("#spinner").hide();
        var response = $.parseJSON(response);
        if(response.result == "success") {
            clearErrors(true);
            addMessage("success", "Compiled successfully.");
        } else if(response.result == "errors") {
            var errors = response.errors;
            showErrors(errors);
            addMessage("error", "Compilation failed: " + errors.length + " error" + (errors.length > 1 ? "s." : "."));
        } else if(response.result == "error") {
            clearErrors(true);
            addMessage("error", response.error);
        }
    });
    $("#spinner").show();
}

/**
 * Compile and run a given snippet of Whiley code.
 */
function run() {
    var console = document.getElementById("console");
    var request = { code: editor.getValue() };
    $.post(root_url + "/run", request, function(response) {
        clearMessages();
        console.value = "";
        $("#spinner").hide();
        var response = $.parseJSON(response);
        if(response.result == "success") {
            clearErrors(true);
            addMessage("success", "Compiled successfully. Running...");
            setTimeout(function() {console.value = response.output;}, 500);
        } else if(response.result == "errors") {
            var errors = response.errors;
            showErrors(errors);
            addMessage("error", "Compilation failed: " + errors.length + " error" + (errors.length > 1 ? "s." : "."));
        } else if(response.result == "error") {
            clearErrors(true);
            addMessage("error", response.error);
        }
    });
    $("#spinner").show();
}

/**
 * Save a given snippet of Whiley code.
 */
function save() {
    var request = { code: editor.getValue() };
    $.post(root_url + "/save", request, function(response) {
        clearMessages();
        var response = $.parseJSON(response);
        $("#spinner").hide();
        addMessage("success", "Saved program as " + response.id + ".", function() {
            window.location.replace("?id=" + response.id);
        });
    });
    $("#spinner").show();
}

// Run this code when the page has loaded.
$(document).ready(function() {
    ace.Range = require('ace/range').Range;
    // Enable the editor with Whiley syntax.
    editor = ace.edit("code");
    var WhileyMode = require("ace/mode/whiley").Mode;
    editor.getSession().setMode(new WhileyMode());
    editor.setTheme("ace/theme/eclipse");
    editor.setFontSize("10pt");
    editor.setBehavioursEnabled(false);
    editor.setHighlightActiveLine(false);
    editor.setShowFoldWidgets(false);
    editor.setShowPrintMargin(false);
    editor.getSession().setUseSoftTabs(true);
    editor.getSession().setTabSize(4);
    editor.markers = [];

    $("#code").resizable({
        resize: function() {
            editor.resize();
        },
        handles: "s",
        cursor: "default",
        minHeight: $("#code").height()
    });

    // If there is an error, display the error message for 5 seconds.
    if(error != "") {
        var error_message = $("

");
        error_message.text(error);
        error_message.addClass("error");
        error_message.addClass("message");
        error_message.prependTo("#content");
        error_message.show().delay(2000).fadeOut(500, function() {
            // If the user should be redirected to the main page (due to invalid ID for example), do so.
            if(redirect == "YES") {
                window.location.replace(root_url + "/");
            }
        });
    }
});


text:
ROOT=`dirname $0`/../..
ROOT=`(cd $ROOT; echo $PWD)`

docker build --rm=false -t pluto_base -f $ROOT/dev_container/plutoBase.Dockerfile $ROOT/dev_container

docker build --rm=false -t pluto_dev -f $ROOT/dev_container/dev.Dockerfile $ROOT

docker build --rm=false -t pluto_test -f $ROOT/build/test.Dockerfile $ROOT

docker run  --rm -a stdout -a stderr pluto_test


text:
package org.zalando.nakadi.service;

import org.springframework.stereotype.Service;

import java.util.UUID;

@Service
public class CursorTokenService {

    public String generateToken() {
        return UUID.randomUUID().toString();
    }
}


text:
from __future__ import print_function
import sys
import re
from cssbeautifier.__version__ import __version__

#
# The MIT License (MIT)

# Copyright (c) 2013 Einar Lielmanis and contributors.

# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:

# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

class BeautifierOptions:
    def __init__(self):
        self.indent_size = 4
        self.indent_char = ' '
        self.indent_with_tabs = False
        self.selector_separator_newline = True
        self.end_with_newline = False
        self.newline_between_rules = True
        self.space_around_combinator = False
        self.eol = '\n'
        # deprecated
        self.space_around_selector_separator = False

    def __repr__(self):
        return \
"""indent_size = %d
indent_char = [%s]
indent_with_tabs = [%s]
separate_selectors_newline = [%s]
end_with_newline = [%s]
newline_between_rules = [%s]
space_around_combinator = [%s]
""" % (self.indent_size, self.indent_char, self.indent_with_tabs,
       self.selector_separator_newline, self.end_with_newline, self.newline_between_rules,
       self.space_around_combinator)

def default_options():
    return BeautifierOptions()

def beautify(string, opts=default_options()):
    b = Beautifier(string, opts)
    return b.beautify()

def beautify_file(file_name, opts=default_options()):
    if file_name == '-':  # stdin
        stream = sys.stdin
    else:
        stream = open(file_name)
    content = ''.join(stream.readlines())
    b = Beautifier(content, opts)
    return b.beautify()

def usage(stream=sys.stdout):

    print("cssbeautifier.py@" + __version__ + """

CSS beautifier (http://jsbeautifier.org/)

""", file=stream)
    if stream == sys.stderr:
        return 1
    else:
        return 0

WHITE_RE = re.compile("^\s+$")
WORD_RE = re.compile("[\w$\-_]")

class Printer:

    def __init__(self, indent_char, indent_size, default_indent=""):
        self.indentSize = indent_size
        self.singleIndent = (indent_size) * indent_char
        self.indentLevel = 0
        self.nestedLevel = 0

        self.baseIndentString = default_indent
        self.output = []

    def __lastCharWhitespace(self):
        return len(self.output) > 0 and WHITE_RE.search(self.output[-1]) is not None

    def indent(self):
        self.indentLevel += 1
        self.baseIndentString += self.singleIndent

    def outdent(self):
        if self.indentLevel:
            self.indentLevel -= 1
            self.baseIndentString = self.baseIndentString[:-(len(self.singleIndent))]

    def push(self, string):
        self.output.append(string)

    def openBracket(self):
        self.singleSpace()
        self.output.append("{")
        self.newLine()

    def closeBracket(self):
        self.newLine()
        self.output.append("}")
        self.newLine()

    def semicolon(self):
        self.output.append(";")
        self.newLine()

    def comment(self, comment):
        self.output.append(comment)

    def newLine(self, keepWhitespace=False):
        if len(self.output) > 0 :
            if not keepWhitespace and self.output[-1] != '\n':
                self.trim()

            self.output.append("\n")

            if len(self.baseIndentString) > 0:
                self.output.append(self.baseIndentString)

    def trim(self):
        while self.__lastCharWhitespace():
            self.output.pop()

    def singleSpace(self):
        if len(self.output) > 0 and not self.__lastCharWhitespace():
            self.output.append(" ")

    def preserveSingleSpace(self,isAfterSpace):
        if isAfterSpace:
            self.singleSpace()

    def result(self):
        if self.baseIndentString:
            return self.baseIndentString + "".join(self.output);
        else:
            return "".join(self.output)

class Beautifier:

    def __init__(self, source_text, opts=default_options()):
        # This is not pretty, but given how we did the version import
        # it is the only way to do this without having setup.py fail on a missing six dependency.
        self.six = __import__("six")

        if not source_text:
            source_text = ''

        # Continue to accept deprecated option
        opts.space_around_combinator = opts.space_around_combinator or opts.space_around_selector_separator

        # HACK: newline parsing inconsistent. This brute force normalizes the input newlines.
        lineBreak = re.compile(self.six.u("\r\n|[\r\u2028\u2029]"))
        source_text = re.sub(lineBreak, '\n', source_text)

        self.source_text = source_text
        self.opts = opts
        self.indentSize = opts.indent_size
        self.indentChar = opts.indent_char
        self.pos = -1
        self.ch = None

        if self.opts.indent_with_tabs:
            self.indentChar = "\t"
            self.indentSize = 1

        self.opts.eol = self.opts.eol.replace('\\r', '\r').replace('\\n', '\n')

        # https://developer.mozilla.org/en-US/docs/Web/CSS/At-rule
        # also in CONDITIONAL_GROUP_RULE below
        self.NESTED_AT_RULE = [ \
            "@page", \
            "@font-face", \
            "@keyframes", \
            "@media", \
            "@supports", \
            "@document"]
        self.CONDITIONAL_GROUP_RULE = [ \
            "@media", \
            "@supports", \
            "@document"]

    def next(self):
        self.pos = self.pos + 1
        if self.pos < len(self.source_text):
            self.ch = self.source_text[self.pos]
        else:
            self.ch = ''
        return self.ch

    def peek(self,skipWhitespace=False):
        start = self.pos
        if skipWhitespace:
            self.eatWhitespace()
        result = ""
        if self.pos + 1 < len(self.source_text):
            result = self.source_text[self.pos + 1]
        if skipWhitespace:
            self.pos = start - 1
            self.next()

        return result

    def eatString(self, endChars):
        start = self.pos
        while self.next():
            if self.ch == "\\":
                self.next()
            elif self.ch in endChars:
                break
            elif self.ch == "\n":
                break
        return self.source_text[start:self.pos] + self.ch

    def peekString(self, endChar):
        start = self.pos
        st = self.eatString(endChar)
        self.pos = start - 1
        self.next()
        return st

    def eatWhitespace(self):
        result = ''
        while WHITE_RE.search(self.peek()) is not None:
            self.next()
            result += self.ch
        return result

    def skipWhitespace(self):
        result = ''
        if self.ch and WHITE_RE.search(self.ch):
            result = self.ch

        while WHITE_RE.search(self.next()) is not None:
            result += self.ch
        return result

    def eatComment(self):
        start = self.pos
        singleLine = self.peek() == "/"
        self.next()
        while self.next():
            if not singleLine and self.ch == "*" and self.peek() == "/":
                self.next()
                break
            elif singleLine and self.ch == "\n":
                return self.source_text[start:self.pos]
        return self.source_text[start:self.pos] + self.ch

    def lookBack(self, string):
        past = self.source_text[self.pos - len(string):self.pos]
        return past.lower() == string

    # Nested pseudo-class if we are insideRule
    # and the next special character found opens
    # a new block
    def foundNestedPseudoClass(self):
        i = self.pos + 1
        openParen = 0
        while i < len(self.source_text):
            ch = self.source_text[i]
            if ch == "{":
                return True
            elif ch == "(":
                # pseudoclasses can contain ()
                openParen += 1
            elif ch == ")":
                if openParen == 0:
                    return False
                openParen -= 1
            elif ch == ";" or ch == "}":
                return False
            i += 1;

        return False

    def beautify(self):
        m = re.search("^[\t ]*", self.source_text)
        baseIndentString = m.group(0)
        printer = Printer(self.indentChar, self.indentSize, baseIndentString)

        insideRule = False
        insidePropertyValue = False
        enteringConditionalGroup = False
        top_ch = ''
        last_top_ch = ''
        parenLevel = 0

        while True:
            whitespace = self.skipWhitespace()
            isAfterSpace = whitespace != ''
            isAfterNewline = '\n' in whitespace
            last_top_ch = top_ch
            top_ch = self.ch

            if not self.ch:
                break
            elif self.ch == '/' and self.peek() == '*':
                header = printer.indentLevel == 0

                if not isAfterNewline or header:
                    printer.newLine()

                comment = self.eatComment()
                printer.comment(comment)
                printer.newLine()
                if header:
                    printer.newLine(True)
            elif self.ch == '/' and self.peek() == '/':
                if not isAfterNewline and last_top_ch != '{':
                    printer.trim()

                printer.singleSpace()
                printer.comment(self.eatComment())
                printer.newLine()
            elif self.ch == '@':
                printer.preserveSingleSpace(isAfterSpace)

                # deal with less propery mixins @{...}
                if self.peek(True) == '{':
                    printer.push(self.eatString('}'));
                else:
                    printer.push(self.ch)
                    # strip trailing space, if present, for hash property check
                    variableOrRule = self.peekString(": ,;{}()[]/='\"")

                    if variableOrRule[-1] in ": ":
                        # wwe have a variable or pseudo-class, add it and insert one space before continuing
                        self.next()
                        variableOrRule = self.eatString(": ")
                        if variableOrRule[-1].isspace():
                            variableOrRule = variableOrRule[:-1]
                        printer.push(variableOrRule)
                        printer.singleSpace();

                    if variableOrRule[-1].isspace():
                        variableOrRule = variableOrRule[:-1]

                    # might be a nesting at-rule
                    if variableOrRule in self.NESTED_AT_RULE:
                        printer.nestedLevel += 1
                        if variableOrRule in self.CONDITIONAL_GROUP_RULE:
                            enteringConditionalGroup = True
            elif self.ch == '#' and self.peek() == '{':
                printer.preserveSingleSpace(isAfterSpace)
                printer.push(self.eatString('}'));
            elif self.ch == '{':
                if self.peek(True) == '}':
                    self.eatWhitespace()
                    self.next()
                    printer.singleSpace()
                    printer.push("{}")
                    printer.newLine()
                    if self.opts.newline_between_rules and printer.indentLevel == 0:
                        printer.newLine(True)
                else:
                    printer.indent()
                    printer.openBracket()
                    # when entering conditional groups, only rulesets are allowed
                    if enteringConditionalGroup:
                        enteringConditionalGroup = False
                        insideRule = printer.indentLevel > printer.nestedLevel
                    else:
                        # otherwise, declarations are also allowed
                        insideRule = printer.indentLevel >= printer.nestedLevel
            elif self.ch == '}':
                printer.outdent()
                printer.closeBracket()
                insideRule = False
                insidePropertyValue = False
                if printer.nestedLevel:
                    printer.nestedLevel -= 1
                if self.opts.newline_between_rules and printer.indentLevel == 0:
                    printer.newLine(True)
            elif self.ch == ":":
                self.eatWhitespace()
                if (insideRule or enteringConditionalGroup) and \
                        not (self.lookBack('&') or self.foundNestedPseudoClass()) and \
                        not self.lookBack('('):
                    # 'property: value' delimiter
                    # which could be in a conditional group query
                    insidePropertyValue = True
                    printer.push(":")
                    printer.singleSpace()
                else:
                    # sass/less parent reference don't use a space
                    # sass nested pseudo-class don't use a space

                    # preserve space before pseudoclasses/pseudoelements, as it means "in any child"
                    if (self.lookBack(' ')) and (printer.output[-1] != ' '):
                        printer.push(" ")
                    if self.peek() == ":":
                        # pseudo-element
                        self.next()
                        printer.push("::")
                    else:
                        # pseudo-element
                        printer.push(":")
            elif self.ch == '"' or self.ch == '\'':
                printer.preserveSingleSpace(isAfterSpace)
                printer.push(self.eatString(self.ch))
            elif self.ch == ';':
                insidePropertyValue = False
                printer.semicolon()
            elif self.ch == '(':
                # may be a url
                if self.lookBack("url"):
                    printer.push(self.ch)
                    self.eatWhitespace()
                    if self.next():
                        if self.ch is not ')' and self.ch is not '"' \
                        and self.ch is not '\'':
                            printer.push(self.eatString(')'))
                        else:
                            self.pos = self.pos - 1
                else:
                    parenLevel += 1
                    printer.preserveSingleSpace(isAfterSpace)
                    printer.push(self.ch)
                    self.eatWhitespace()
            elif self.ch == ')':
                printer.push(self.ch)
                parenLevel -= 1
            elif self.ch == ',':
                printer.push(self.ch)
                self.eatWhitespace()
                if not insidePropertyValue and self.opts.selector_separator_newline and parenLevel < 1:
                    printer.newLine()
                else:
                    printer.singleSpace()
            elif (self.ch == '>' or self.ch == '+' or self.ch == '~') and \
                not insidePropertyValue and parenLevel < 1:
                # handle combinator spacing
                if self.opts.space_around_combinator:
                    printer.singleSpace()
                    printer.push(self.ch)
                    printer.singleSpace()
                else:
                    printer.push(self.ch)
                    self.eatWhitespace()
                    # squash extra whitespace
                    if self.ch and WHITE_RE.search(self.ch):
                        self.ch = ''
            elif self.ch == ']':
                printer.push(self.ch)
            elif self.ch == '[':
                printer.preserveSingleSpace(isAfterSpace)
                printer.push(self.ch)
            elif self.ch == '=':
                # no whitespace before or after
                self.eatWhitespace()
                self.ch = '='
                printer.push(self.ch)
            else:
                printer.preserveSingleSpace(isAfterSpace)
                printer.push(self.ch)

        sweet_code = re.sub('[\r\n\t ]+$', '', printer.result())

        # establish end_with_newline
        if self.opts.end_with_newline:
            sweet_code += '\n'

        if not self.opts.eol == '\n':
            sweet_code = sweet_code.replace('\n', self.opts.eol)

        return sweet_code


text:
'''
Copyright 2013 Cosnita Radu Viorel

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

.. codeauthor:: Radu Viorel Cosnita <radu.cosnita@gmail.com>
.. py:module:: fantastico.mvc.tests.test_dbsession_manager
'''
from fantastico.exceptions import FantasticoDbError
from fantastico.mvc import DbSessionManager
from fantastico.tests.base_case import FantasticoUnitTestsCase
from mock import Mock

class DbSessionManagerTests(FantasticoUnitTestsCase):
    '''This class provides the test cases for db session manager class. It is extremely important to kkep this running so that
    db connections are correctly managed by fantastico.'''

    _db_config = None
    _create_engine_fn = None
    _create_session_fn = None
    _db_manager = None
    _session = None
    _old_conn_data = None

    def init(self):
        '''This method setup common dependencies used within test cases.'''
        self._db_config = {"drivername": "blabla",
                          "username": "john.doe",
                          "password": "12345",
                          "host": "test_host",
                          "port": 3306,
                          "database": "mydb",
                          "additional_params": {}}

        self._create_engine_fn = Mock()

        self._session = Mock()
        self._session.remove = Mock()
        self._create_session_fn = Mock(return_value=self._session)

        DbSessionManager.ENGINE = None
        self._db_manager = DbSessionManager(self._db_config,
                                            create_engine_fn=self._create_engine_fn,
                                            create_session_fn=self._create_session_fn)

    def test_wrong_dbconfig(self):
        '''This test case ensures an exception is raised whenever dbconfig is incomplete or empty.'''

        db_config = {}

        with self.assertRaises(FantasticoDbError):
            DbSessionManager(db_config,
                             create_engine_fn=self._create_engine_fn,
                             create_session_fn=self._create_session_fn)

    def test_get_connection_ok(self):
        '''This test case ensure get connection is retrieved and cached accordingly.'''

        request_id = 1

        session = self._db_manager.get_connection(request_id)
        session2 = self._db_manager.get_connection(request_id)

        self.assertIsNotNone(session)
        self.assertIsNotNone(session2)
        self.assertEqual(session, session2)

        self.assertEqual(1, self._create_engine_fn.call_count)
        self.assertEqual(1, self._create_session_fn.call_count)

        return request_id

    def test_get_connection_close_onexception(self):
        '''This test case ensure cached session / request is closed in case an exception is raised while opening the session.'''

        create_session_fn = Mock(side_effect=Exception("Unexpected error"))

        self._db_manager = DbSessionManager(self._db_config,
                                            create_engine_fn=self._create_engine_fn,
                                            create_session_fn=create_session_fn)

        request_id = 1

        with self.assertRaises(FantasticoDbError) as ex:
            self._db_manager.get_connection(request_id)

        self.assertTrue(str(ex).find("Unexpected error"))

    def test_close_connection_ok(self):
        '''This method test close connection behavior for an existing request identifier cached connection.'''

        request_id = self.test_get_connection_ok()

        session = self._db_manager.get_connection(request_id)

        self.assertIsNotNone(session)

        self._db_manager.close_connection(request_id)
        self.assertEqual(1, self._session.remove.call_count)


text:
package com.andrsam.service.account;

import com.andrsam.model.Account;
import com.andrsam.response.OpenAccountResponse;

/**
 * used for saving accounts
 */
public interface AccountService {

    /**
     * Looks up an account by account id
     *
     * @param accountId
     * @return
     */
    Account get(String accountId);

    /**
     * creates and saves an account object into the storage
     *
     * @param accountId an account id
     * @return a response, that contains information about result of registration
     */
    OpenAccountResponse save(String accountId);
}


text:
using System;
using System.ComponentModel;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content.Pipeline;
using Microsoft.Xna.Framework.Content.Pipeline.Graphics;
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate;
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler;

namespace Delta.Graphics
{
#pragma warning disable 1591
    [EditorBrowsable(EditorBrowsableState.Never)]
    [ContentTypeSerializer]
    public class DepthStenctilStateSerializer : ContentTypeSerializer<DepthStencilState>
    {
        protected override DepthStencilState Deserialize(IntermediateReader input, ContentSerializerAttribute format, DepthStencilState existingInstance)
        {
            switch (input.Xml.ReadContentAsString().ToLower())
            {
                case "default":
                    return DepthStencilState.Default;
                case "depthread":
                    return DepthStencilState.DepthRead;
                case "none":
                    return DepthStencilState.None;
                default:
                    return new DepthStencilState();
            }
        }

        protected override void Serialize(IntermediateWriter output, DepthStencilState value, ContentSerializerAttribute format)
        {
            if (DepthStencilStateEquals(value, DepthStencilState.Default))
                output.Xml.WriteString("Default");
            else if (DepthStencilStateEquals(value, DepthStencilState.DepthRead))
                output.Xml.WriteString("DepthRead");
            else if (DepthStencilStateEquals(value, DepthStencilState.None))
                output.Xml.WriteString("None");
            else
                throw new InvalidContentException("Unknown DepthStencilState: " + value);
        }

        static bool DepthStencilStateEquals(DepthStencilState a, DepthStencilState b)
        {
            return a.CounterClockwiseStencilDepthBufferFail == b.CounterClockwiseStencilDepthBufferFail &&
                   a.CounterClockwiseStencilFail == b.CounterClockwiseStencilFail &&
                   a.CounterClockwiseStencilFunction == b.CounterClockwiseStencilFunction &&
                   a.CounterClockwiseStencilPass == b.CounterClockwiseStencilPass &&
                   a.DepthBufferEnable == b.DepthBufferEnable &&
                   a.DepthBufferFunction == b.DepthBufferFunction &&
                   a.DepthBufferWriteEnable == b.DepthBufferWriteEnable &&
                   a.ReferenceStencil == b.ReferenceStencil &&
                   a.StencilDepthBufferFail == b.StencilDepthBufferFail &&
                   a.StencilEnable == b.StencilEnable &&
                   a.StencilFail == b.StencilFail &&
                   a.StencilFunction == b.StencilFunction &&
                   a.StencilMask == b.StencilMask &&
                   a.StencilPass == b.StencilPass &&
                   a.StencilWriteMask == b.StencilWriteMask &&
                   a.TwoSidedStencilMode == b.TwoSidedStencilMode;
        }
    }
#pragma warning restore 1591
}


text:
<?php
/**
 * This file is part of the UpDown.Double
 *
 * @license http://opensource.org/licenses/bsd-license.php BSD
 */
namespace UpDown\Double\Exception;

interface ExceptionInterface
{
}