text:
import sys

from seisflows.tools import array, unix
from seisflows.tools.tools import exists, findpath
from seisflows.tools.seismic import getpar, setpar

### input file writers

def write_sources(coords, path='.', ws=1., suffix=''):
    """ Writes source information to text file
    """
    sx, sy, sz = coords

    filename = findpath('seisflows.plugins') + '/' + 'solver/specfem2d/SOURCE'
    with open(filename, 'r') as f:
        lines = f.readlines()

    filename = 'DATA/SOURCE' + suffix
    with open(filename, 'w') as f:
        f.writelines(lines)

    # adjust source coordinates
    setpar('xs', sx, filename)
    setpar('zs', sy, filename)
    #setpar('ts', ts[0], filename)

    # adjust source amplitude
    try:
        fs = float(getpar('factor', filename))
        fs *= ws
        setpar('factor', str(fs), filename)
    except:
        pass

    # adjust source wavelet
    if 1:
        # Ricker wavelet
        setpar('time_function_type', 1, filename)
    elif 0:
        # first derivative of Gaussian
        setpar('time_function_type', 2, filename)
    elif 0:
        # Gaussian
        setpar('time_function_type', 3, filename)
    elif 0:
        # Dirac
        setpar('time_function_type', 4, filename)
    elif 0:
        # Heaviside
        setpar('time_function_type', 5, filename)

    #setpar('f0', par['F0'], filename)

def write_receivers(coords, path='.'):
    """ Writes receiver information to text file
    """
    rx, ry, rz = coords
    nr = len(coords[0])

    filename = path +'/'+ 'DATA/STATIONS'

    lines = []
    for ir in range(nr):
        line = ''
        line += 'S%06d' % ir + ' '
        line += 'AA' + ' '
        line += '%11.5e' % rx[ir] + ' '
        line += '%11.5e' % ry[ir] + ' '
        line += '%3.1f' % 0. + ' '
        line += '%3.1f' % 0. + '\n'
        lines.extend(line)

    with open(filename, 'w') as f:
        f.writelines(lines)

def smooth_legacy(input_path='', output_path='', parameters=[], span=0.):
        solver = sys.modules['seisflows_solver']
        PATH = sys.modules['seisflows_paths']

        if not exists(input_path):
            raise Exception

        if not exists(output_path):
            unix.mkdir(output_path)

        #if solver.mesh_properties.nproc!=1:
        #    raise NotImplementedError
	nproc = solver.mesh_properties.nproc

        # intialize arrays
        kernels = {}	# kernels is 2d dict indexed by parameters and slices
        for key in parameters or solver.parameters:
        	kernels[key] = []
	#print len(kernels[key])

        coords = {}
        for key in ['x', 'z']:
            	coords[key] = []

        # read kernels
        for key in parameters or solver.parameters:
	    for iproc in range(nproc):
        	kernels[key] += solver.io.read_slice(input_path, key+'_kernel', iproc)

        if not span:
            return kernels

        # read coordinates
        for key in ['x', 'z']:
	    for iproc in range(nproc):
        	coords[key] += solver.io.read_slice(PATH.MODEL_INIT, key, iproc)

	mesh = array.stack(coords['x'][0], coords['z'][0])
	if nproc > 1:
	    for iproc in range(nproc-1):
        	mesh = array.append(mesh,array.stack(coords['x'][iproc+1], coords['z'][iproc+1]))

        # apply smoother
        for key in parameters or solver.parameters:
            kernels[key][:] = array.meshsmooth(kernels[key][:], mesh, span)

        # write smooth kernels
        for key in parameters or solver.parameters:
	    for iproc in range(nproc):
        	solver.io.write_slice(kernels[key][iproc], output_path, key+'_kernel', iproc)

redpajama_set_name: RedPajamaGithub


text:
package net.duckling.vmt.service.impl;

import java.util.List;

import net.duckling.vmt.dao.INodeDAO;
import net.duckling.vmt.domain.ldap.LdapNode;
import net.duckling.vmt.domain.view.ListView;
import net.duckling.vmt.service.IAttributeService;
import net.duckling.vmt.service.INodeService;
import net.duckling.vmt.service.ISearchService;
import net.duckling.vmt.service.IVmtIndexService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ldap.core.DistinguishedName;
import org.springframework.stereotype.Service;
/**
 * @author lvly
 * @since 2013-6-21
 */
@Service
public class NodeServiceImpl implements INodeService{
	/**
	 * Node对应的dao
	 */
	@Autowired
	private INodeDAO nodeDAO;
	/**
	 * 属性更改service
	 */
	@Autowired
	private IAttributeService attrService;
	@Autowired
	private ISearchService searchService;
	@Autowired
	private IVmtIndexService indexService;
	@Override
	public LdapNode getNode(String dn) {
		return nodeDAO.getNode(dn);
	}
	@Override
	public void updateSonAndSelfDisplayName(String pdn, String newName) {
		DistinguishedName dn=new DistinguishedName(pdn);
		nodeDAO.updateSonsAndMyDisplayName(pdn,dn.size(),newName);
	}
	@Override
	public void updateMove(String dn, String moveto) {
		LdapNode node=getNode(moveto);
		attrService.update(dn, "vmt-current-display", node.getCurrentDisplay());
	}
	@Override
	public boolean isSymbolUsed(String pdn, String symbol) {
		return nodeDAO.isSymbolUsed(pdn, symbol);
	}
	public void updateSubObjectVisible(String dn,boolean visible,boolean updateSelf){
		List<ListView> views=searchService.searchAllByTree(dn);
		for(ListView view:views){
			if(!updateSelf&&view.getDn().equals(dn)){
				continue;
			}
			if(view.getType().equals(ListView.TYPE_USER)){
				indexService.updateUserVisible(view.getDn(),visible);
			}
			attrService.update(view.getDn(), "vmt-visible", visible);
		}
	}

}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Lecidea submarginiflexa Vain.

### Remarks
null


text:
#region licence
// =====================================================
// EfSchemeCompare Project - project to compare EF schema to SQL schema
// Filename: DbConnectionString.cs
// Date Created: 2016/04/06
//
// Under the MIT License (MIT)
//
// Written by Jon Smith : GitHub JonPSmith, www.thereformedprogrammer.net
// =====================================================
#endregion

using System;
using System.Data.Entity;

namespace Ef6SchemaCompare.InternalEf6
{
    internal static class DbConnectionString
    {
        public static string GetConnectionStringFromDbType<T>(this T db) where T : DbContext, new()
        {
            using (var originalDb = (DbContext) Activator.CreateInstance(typeof (T)))
            {
                return originalDb.Database.Connection.ConnectionString;
            }
        }
    }
}


text:
ANSIBLE_METADATA = {'metadata_version': '1.1',
                    'status': ['preview'],
                    'supported_by': 'community'}

DOCUMENTATION = '''
---
module: ce_mtu
version_added: "2.4"
short_description: Manages MTU settings on HUAWEI CloudEngine switches.
description:
    - Manages MTU settings on HUAWEI CloudEngine switches.
author: QijunPan (@CloudEngine-Ansible)
notes:
    - Either C(sysmtu) param is required or C(interface) AND C(mtu) params are req'd.
    - C(state=absent) unconfigures a given MTU if that value is currently present.
options:
    interface:
        description:
            - Full name of interface, i.e. 40GE1/0/22.
        required: false
        default: null
    mtu:
        description:
            - MTU for a specific interface.
              The value is an integer ranging from 46 to 9600, in bytes.
        required: false
        default: null
    jumbo_max:
        description:
            - Maximum frame size. The default value is 9216.
              The value is an integer and expressed in bytes. The value range is 1536 to 12224 for the CE12800
              and 1536 to 12288 for ToR switches.
        required: false
        default: null
    jumbo_min:
        description:
            - Non-jumbo frame size threshod. The default value is 1518.
              The value is an integer that ranges from 1518 to jumbo_max, in bytes.
        required: false
        default: null
    state:
        description:
            - Specify desired state of the resource.
        required: false
        default: present
        choices: ['present','absent']
'''

EXAMPLES = '''
- name: Mtu test
  hosts: cloudengine
  connection: local
  gather_facts: no
  vars:
    cli:
      host: "{{ inventory_hostname }}"
      port: "{{ ansible_ssh_port }}"
      username: "{{ username }}"
      password: "{{ password }}"
      transport: cli

  tasks:

  - name: "Config jumboframe on 40GE1/0/22"
    ce_mtu:
      interface: 40GE1/0/22
      jumbo_max: 9000
      jumbo_min: 8000
      provider: "{{ cli }}"

  - name: "Config mtu on 40GE1/0/22 (routed interface)"
    ce_mtu:
      interface: 40GE1/0/22
      mtu: 1600
      provider: "{{ cli }}"

  - name: "Config mtu on 40GE1/0/23 (switched interface)"
    ce_mtu:
      interface: 40GE1/0/22
      mtu: 9216
      provider: "{{ cli }}"

  - name: "Config mtu and jumboframe on 40GE1/0/22 (routed interface)"
    ce_mtu:
      interface: 40GE1/0/22
      mtu: 1601
      jumbo_max: 9001
      jumbo_min: 8001
      provider: "{{ cli }}"

  - name: "Unconfigure mtu and jumboframe on a given interface"
    ce_mtu:
      state: absent
      interface: 40GE1/0/22
      provider: "{{ cli }}"
'''

RETURN = '''
proposed:
    description: k/v pairs of parameters passed into module
    returned: always
    type: dict
    sample: {"mtu": "1700", "jumbo_max": "9000", jumbo_min: "8000"}
existing:
    description: k/v pairs of existing mtu/sysmtu on the interface/system
    returned: always
    type: dict
    sample: {"mtu": "1600", "jumbo_max": "9216", "jumbo_min": "1518"}
end_state:
    description: k/v pairs of mtu/sysmtu values after module execution
    returned: always
    type: dict
    sample: {"mtu": "1700", "jumbo_max": "9000", jumbo_min: "8000"}
updates:
    description: command sent to the device
    returned: always
    type: list
    sample: ["interface 40GE1/0/23", "mtu 1700", "jumboframe enable 9000 8000"]
changed:
    description: check to see if a change was made on the device
    returned: always
    type: boolean
    sample: true
'''

import re
import copy
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ce import ce_argument_spec, get_config, load_config, get_nc_config, set_nc_config

CE_NC_GET_INTF = """
<filter type="subtree">
  <ifm xmlns="http://www.huawei.com/netconf/vrp" content-version="1.0" format-version="1.0">
    <interfaces>
      <interface>
        <ifName>%s</ifName>
        <isL2SwitchPort></isL2SwitchPort>
        <ifMtu></ifMtu>
      </interface>
    </interfaces>
  </ifm>
</filter>
"""

CE_NC_XML_MERGE_INTF_MTU = """
  <ifm xmlns="http://www.huawei.com/netconf/vrp" content-version="1.0" format-version="1.0">
    <interfaces>
      <interface operation="merge">
        <ifName>%s</ifName>
        <ifMtu>%s</ifMtu>
      </interface>
    </interfaces>
  </ifm>
"""

def is_interface_support_setjumboframe(interface):
    """is interface support set jumboframe"""

    if interface is None:
        return False
    support_flag = False
    if interface.upper().startswith('GE'):
        support_flag = True
    elif interface.upper().startswith('10GE'):
        support_flag = True
    elif interface.upper().startswith('25GE'):
        support_flag = True
    elif interface.upper().startswith('4X10GE'):
        support_flag = True
    elif interface.upper().startswith('40GE'):
        support_flag = True
    elif interface.upper().startswith('100GE'):
        support_flag = True
    else:
        support_flag = False
    return support_flag

def get_interface_type(interface):
    """Gets the type of interface, such as 10GE, ETH-TRUNK, VLANIF..."""

    if interface is None:
        return None

    iftype = None

    if interface.upper().startswith('GE'):
        iftype = 'ge'
    elif interface.upper().startswith('10GE'):
        iftype = '10ge'
    elif interface.upper().startswith('25GE'):
        iftype = '25ge'
    elif interface.upper().startswith('4X10GE'):
        iftype = '4x10ge'
    elif interface.upper().startswith('40GE'):
        iftype = '40ge'
    elif interface.upper().startswith('100GE'):
        iftype = '100ge'
    elif interface.upper().startswith('VLANIF'):
        iftype = 'vlanif'
    elif interface.upper().startswith('LOOPBACK'):
        iftype = 'loopback'
    elif interface.upper().startswith('METH'):
        iftype = 'meth'
    elif interface.upper().startswith('ETH-TRUNK'):
        iftype = 'eth-trunk'
    elif interface.upper().startswith('VBDIF'):
        iftype = 'vbdif'
    elif interface.upper().startswith('NVE'):
        iftype = 'nve'
    elif interface.upper().startswith('TUNNEL'):
        iftype = 'tunnel'
    elif interface.upper().startswith('ETHERNET'):
        iftype = 'ethernet'
    elif interface.upper().startswith('FCOE-PORT'):
        iftype = 'fcoe-port'
    elif interface.upper().startswith('FABRIC-PORT'):
        iftype = 'fabric-port'
    elif interface.upper().startswith('STACK-PORT'):
        iftype = 'stack-Port'
    elif interface.upper().startswith('NULL'):
        iftype = 'null'
    else:
        return None

    return iftype.lower()

def build_config_xml(xmlstr):
    """ build_config_xml"""

    return '<config> ' + xmlstr + ' </config>'

class Mtu(object):
    """set mtu"""

    def __init__(self, argument_spec):
        self.spec = argument_spec
        self.module = None
        self.init_module()

        # interface info
        self.interface = self.module.params['interface']
        self.mtu = self.module.params['mtu']
        self.state = self.module.params['state']
        self.jbf_max = self.module.params['jumbo_max'] or None
        self.jbf_min = self.module.params['jumbo_min'] or None
        self.jbf_config = list()
        self.jbf_cli = ""
        self.commands = list()

        # state
        self.changed = False
        self.updates_cmd = list()
        self.results = dict()
        self.proposed = dict()
        self.existing = dict()
        self.end_state = dict()
        self.intf_info = dict()         # one interface info
        self.intf_type = None           # loopback tunnel ...

    def init_module(self):
        """ init_module"""

        self.module = AnsibleModule(
            argument_spec=self.spec, supports_check_mode=True)

    def check_response(self, xml_str, xml_name):
        """Check if response message is already succeed."""

        if "<ok/>" not in xml_str:
            self.module.fail_json(msg='Error: %s failed.' % xml_name)

    def get_interface_dict(self, ifname):
        """ get one interface attributes dict."""
        intf_info = dict()
        conf_str = CE_NC_GET_INTF % ifname
        ret_xml = get_nc_config(self.module, conf_str)
        if "<data/>" in ret_xml:
            return intf_info

        intf = re.findall(
            r'.*<ifName>(.*)</ifName>.*\s*'
            r'<isL2SwitchPort>(.*)</isL2SwitchPort>.*\s*'
            r'<ifMtu>(.*)</ifMtu>.*', ret_xml)

        if intf:
            intf_info = dict(ifName=intf[0][0],
                             isL2SwitchPort=intf[0][1],
                             ifMtu=intf[0][2])

        return intf_info

    def prase_jumboframe_para(self, config_str):
        """prase_jumboframe_para"""

        interface_cli = "interface %s" % self.interface
        if config_str.find(interface_cli) == -1:
            self.module.fail_json(msg='Error: Interface does not exist.')

        try:
            npos1 = config_str.index('jumboframe enable')
        except ValueError:
            # return default vale
            return [9216, 1518]
        try:
            npos2 = config_str.index('\n', npos1)
            config_str_tmp = config_str[npos1:npos2]
        except ValueError:
            config_str_tmp = config_str[npos1:]

        return re.findall(r'([0-9]+)', config_str_tmp)

    def cli_load_config(self, commands):
        """load config by cli"""

        if not self.module.check_mode:
            load_config(self.module, commands)

    def cli_add_command(self, command, undo=False):
        """add command to self.update_cmd and self.commands"""

        if undo and command.lower() not in ["quit", "return"]:
            cmd = "undo " + command
        else:
            cmd = command

        self.commands.append(cmd)          # set to device

    def get_jumboframe_config(self):
        """ get_jumboframe_config"""

        flags = list()
        exp = " all | section inc %s$" % self.interface.upper()
        flags.append(exp)
        output = get_config(self.module, flags)
        output = output.replace('*', '')

        return self.prase_jumboframe_para(output)

    def set_jumboframe(self):
        """ set_jumboframe"""

        if self.state == "present":
            if not self.jbf_max and not self.jbf_min:
                return

            jbf_value = self.get_jumboframe_config()
            self.jbf_config = copy.deepcopy(jbf_value)
            if len(jbf_value) == 1:
                jbf_value.append("1518")
                self.jbf_config.append("1518")
            if not self.jbf_max:
                return

            if (len(jbf_value) > 2) or (len(jbf_value) == 0):
                self.module.fail_json(
                    msg='Error: Get jubmoframe config value num error.')
            if self.jbf_min is None:
                if jbf_value[0] == self.jbf_max:
                    return
            else:
                if (jbf_value[0] == self.jbf_max) \
                        and (jbf_value[1] == self.jbf_min):
                    return
            if jbf_value[0] != self.jbf_max:
                jbf_value[0] = self.jbf_max
            if (jbf_value[1] != self.jbf_min) and (self.jbf_min is not None):
                jbf_value[1] = self.jbf_min
            else:
                jbf_value.pop(1)
        else:
            jbf_value = self.get_jumboframe_config()
            self.jbf_config = copy.deepcopy(jbf_value)
            if (jbf_value == [9216, 1518]):
                return
            jbf_value = [9216, 1518]

        # excute commands
        command = "interface %s" % self.interface
        self.cli_add_command(command)

        if len(jbf_value) == 2:
            self.jbf_cli = "jumboframe enable %s %s" % (
                jbf_value[0], jbf_value[1])
        else:
            self.jbf_cli = "jumboframe enable %s" % (jbf_value[0])
        self.cli_add_command(self.jbf_cli)

        if self.commands:
            self.cli_load_config(self.commands)
            self.changed = True
        if self.state == "present":
            if self.jbf_min:
                self.updates_cmd.append(
                    "jumboframe enable %s %s" % (self.jbf_max, self.jbf_min))
            else:
                self.updates_cmd.append("jumboframe enable %s" % (self.jbf_max))
        else:
            self.updates_cmd.append("undo jumboframe enable")

        return

    def merge_interface(self, ifname, mtu):
        """ Merge interface mtu."""

        xmlstr = ''
        change = False
        self.updates_cmd.append("interface %s" % ifname)
        if self.state == "present":
            if mtu and self.intf_info["ifMtu"] != mtu:
                xmlstr += CE_NC_XML_MERGE_INTF_MTU % (ifname, mtu)
                self.updates_cmd.append("mtu %s" % mtu)
                change = True
        else:
            if self.intf_info["ifMtu"] != '1500':
                xmlstr += CE_NC_XML_MERGE_INTF_MTU % (ifname, '1500')
                self.updates_cmd.append("undo mtu")
                change = True

        if not change:
            return

        conf_str = build_config_xml(xmlstr)
        ret_xml = set_nc_config(self.module, conf_str)
        self.check_response(ret_xml, "MERGE_INTF_MTU")
        self.changed = True

    def check_params(self):
        """Check all input params"""

        # interface type check
        if self.interface:
            self.intf_type = get_interface_type(self.interface)
            if not self.intf_type:
                self.module.fail_json(
                    msg='Error: Interface name of %s '
                        'is error.' % self.interface)

        if not self.intf_type:
            self.module.fail_json(
                msg='Error: Interface %s is error.')

        # mtu check mtu
        if self.mtu:
            if not self.mtu.isdigit():
                self.module.fail_json(msg='Error: Mtu is invalid.')
            # check mtu range
            if int(self.mtu) < 46 or int(self.mtu) > 9600:
                self.module.fail_json(
                    msg='Error: Mtu is not in the range from 46 to 9600.')
        # get interface info
        self.intf_info = self.get_interface_dict(self.interface)
        if not self.intf_info:
            self.module.fail_json(msg='Error: interface does not exists.')

        # check interface
        if self.mtu and self.intf_info['isL2SwitchPort'] == 'true':
            self.module.fail_json(msg='Error: L2Switch Port can not set mtu.')

        # check interface can set jumbo frame
        if self.state == 'present':
            if self.jbf_max:
                if not is_interface_support_setjumboframe(self.interface):
                    self.module.fail_json(
                        msg='Error: Interface %s does not support jumboframe set.' % self.interface)
                if not self.jbf_max.isdigit():
                    self.module.fail_json(
                        msg='Error: Max jumboframe is not digit.')
                if (int(self.jbf_max) > 12288) or (int(self.jbf_max) < 1536):
                    self.module.fail_json(
                        msg='Error: Max jumboframe is between 1536 to 12288.')

            if self.jbf_min:
                if not self.jbf_min.isdigit():
                    self.module.fail_json(
                        msg='Error: Min jumboframe is not digit.')
                if not self.jbf_max:
                    self.module.fail_json(
                        msg='Error: please specify max jumboframe value.')
                if (int(self.jbf_min) > self.jbf_max) or (int(self.jbf_min) < 1518):
                    self.module.fail_json(
                        msg='Error: Min jumboframe is between '
                            '1518 to jumboframe max value.')

            if self.jbf_min is not None:
                if self.jbf_max is None:
                    self.module.fail_json(
                        msg='Error: please input MAX jumboframe '
                            'value.')

    def get_proposed(self):
        """ get_proposed"""

        self.proposed['state'] = self.state
        if self.interface:
            self.proposed["interface"] = self.interface

        if self.state == 'present':
            if self.mtu:
                self.proposed["mtu"] = self.mtu
            if self.jbf_max:
                if self.jbf_min:
                    self.proposed["jumboframe"] = "jumboframe enable %s %s" % (
                        self.jbf_max, self.jbf_min)
                else:
                    self.proposed[
                        "jumboframe"] = "jumboframe enable %s %s" % (self.jbf_max, 1518)

    def get_existing(self):
        """ get_existing"""

        if self.intf_info:
            self.existing["interface"] = self.intf_info["ifName"]
            self.existing["mtu"] = self.intf_info["ifMtu"]

        if self.intf_info:
            if not self.existing["interface"]:
                self.existing["interface"] = self.interface

            if len(self.jbf_config) != 2:
                return

            self.existing["jumboframe"] = "jumboframe enable %s %s" % (
                self.jbf_config[0], self.jbf_config[1])

    def get_end_state(self):
        """ get_end_state"""

        if self.intf_info:
            end_info = self.get_interface_dict(self.interface)
            if end_info:
                self.end_state["interface"] = end_info["ifName"]
                self.end_state["mtu"] = end_info["ifMtu"]
        if self.intf_info:
            if not self.end_state["interface"]:
                self.end_state["interface"] = self.interface

            if self.state == 'absent':
                self.end_state["jumboframe"] = "jumboframe enable %s %s" % (
                    9216, 1518)
            elif not self.jbf_max and not self.jbf_min:
                if len(self.jbf_config) != 2:
                    return
                self.end_state["jumboframe"] = "jumboframe enable %s %s" % (
                    self.jbf_config[0], self.jbf_config[1])
            elif self.jbf_min:
                self.end_state["jumboframe"] = "jumboframe enable %s %s" % (
                    self.jbf_max, self.jbf_min)
            else:
                self.end_state[
                    "jumboframe"] = "jumboframe enable %s %s" % (self.jbf_max, 1518)

    def work(self):
        """worker"""
        self.check_params()

        self.get_proposed()

        self.merge_interface(self.interface, self.mtu)
        self.set_jumboframe()

        self.get_existing()
        self.get_end_state()
        self.results['changed'] = self.changed
        self.results['proposed'] = self.proposed
        self.results['existing'] = self.existing
        self.results['end_state'] = self.end_state
        if self.changed:
            self.results['updates'] = self.updates_cmd
        else:
            self.results['updates'] = list()

        self.module.exit_json(**self.results)

def main():
    """ main"""

    argument_spec = dict(
        interface=dict(required=True, type='str'),
        mtu=dict(type='str'),
        state=dict(choices=['absent', 'present'],
                   default='present', required=False),
        jumbo_max=dict(type='str'),
        jumbo_min=dict(type='str'),
    )
    argument_spec.update(ce_argument_spec)
    interface = Mtu(argument_spec)
    interface.work()

if __name__ == '__main__':
    main()


text:
V#!/usr/bin/env perl

use strict;
use warnings;
use utf8;

use WebService::Amazon::Route53;
use JSON;

my $client = WebService::Amazon::Route53->new(id => 'KEY_ID',
                                              key => 'SECRET_KEY');

my $response = $client->list_hosted_zones(max_items => 100);

for my $zones ($response->{'hosted_zones'}) {
    for my $zone (@$zones) {
        my $zonedetails = $client->list_resource_record_sets(zone_id => $zone->{'id'});
        print JSON::XS->new->utf8->pretty->encode($zonedetails);
    }
}


text:
(function () {
    'use strict';
}());
var mainpr = new Vue({
    el: '#main',
    data: {},
    methods: {
        register: function () {
            ipcRenderer.on('cover-message', function (event, arg) {
                console.log(arg);
            });
            ipcRenderer.once('version', function (event, arg) {
                console.log(arg);
            });
            ipcRenderer.send('register', 'programmer');
        }
    }
});


text:
package org.dita.dost.writer;

import static org.apache.commons.io.FileUtils.*;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;

import java.io.File;
import java.io.IOException;

import org.custommonkey.xmlunit.XMLUnit;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

import org.dita.dost.TestUtils;
import org.dita.dost.exception.DITAOTException;
import org.dita.dost.util.Job;

public class ImageMetadataFilterTest {

    private static final File resourceDir = TestUtils.getResourceDir(ImageMetadataFilterTest.class);
    private static final File srcDir = new File(resourceDir, "src");
    private static final File expDir = new File(resourceDir, "exp");
    private static File tempDir;

    @BeforeClass
    public static void setup() throws IOException {
        tempDir = TestUtils.createTempDir(ImageMetadataFilterTest.class);
    }

    @Test
    public void testWrite() throws DITAOTException, SAXException, IOException {
        final File f = new File(tempDir, "test.dita");
        copyFile(new File(srcDir, "test.dita"), f);

        final Job job = new Job(tempDir);
        job.setProperty("uplevels", "");
        final ImageMetadataFilter filter = new ImageMetadataFilter(srcDir, job);
        filter.setLogger(new TestUtils.TestLogger());
        filter.setJob(job);
        filter.write(f.getAbsoluteFile());

        TestUtils.resetXMLUnit();
        XMLUnit.setIgnoreWhitespace(true);
        assertXMLEqual(new InputSource(new File(expDir, "test.dita").toURI().toString()),
                new InputSource(f.toURI().toString()));
    }

    @Test
    public void testUplevelsWrite() throws DITAOTException, SAXException, IOException {
        final File f = new File(tempDir, "sub" + File.separator + "test.dita");
        f.getParentFile().mkdirs();
        copyFile(new File(srcDir, "test.dita"), f);

        final Job job = new Job(tempDir);
        job.setProperty("uplevels", ".." + File.separator);
        final ImageMetadataFilter filter = new ImageMetadataFilter(srcDir, job);
        filter.setLogger(new TestUtils.TestLogger());
        filter.setJob(job);
        filter.write(f.getAbsoluteFile());

        TestUtils.resetXMLUnit();
        XMLUnit.setIgnoreWhitespace(true);
        assertXMLEqual(new InputSource(new File(expDir, "test.dita").toURI().toString()),
                new InputSource(f.toURI().toString()));
    }

    @AfterClass
    public static void teardown() throws IOException {
        TestUtils.forceDelete(tempDir);
    }

}


text:
					 RESPUESTAS PARA UNA ALERTA ESPECÍFICA

					Prueba: <?php echo $infoAlerta['nombre_prueba']; ?>

Grupo de Instrumentos: <?php echo $infoAlerta['nombre_grupo_instrumentos']; ?>

Sesión: <?php echo $infoAlerta['sesion_prueba']; ?>

Fecha: <?php echo $infoAlerta['fecha']; ?>

					Alerta: <?php echo $infoAlerta['mensaje_alerta']; ?>

Tipo Alerta: <?php echo $infoAlerta['nombre_tipo_alerta']; ?>

Inicio Alerta: <?php echo $infoAlerta['fecha_inicio']; ?>

Fin Alerta: <?php echo $infoAlerta['fecha_fin']; ?>

					<a class="btn btn-success" href=" <?php echo base_url(). "dashboard/" . $rol; ?> "> Regresar
                     Alerta específica para varios sitios

								Dar respuesta
								Sitio
								Nodo o Región
								Departamento
								Municipio
								Códifo DANE
								Representante

								Dar respuesta
								Sitio
								Nodo o Región
								Departamento
								Municipio
								Códifo DANE
								Representante

		<?php

		if($infoAlertaVencida){
			foreach ($infoAlertaVencida as $lista):
				$arrParam = array(
						"idSitioSesion" => $lista['id_sitio_sesion'],
						"idAlerta" => $lista['id_alerta']
				);
				$respuesta = $this->general_model->get_respuestas_alertas_vencidas_by($arrParam);

				//si no tiene respuesta entonces buscar la información
				if(!$respuesta){
					$info = $this->general_model->get_informacion_respuestas_alertas_vencidas_by($arrParam);

							foreach ($info as $lista):
									echo "
";
									echo "";
									//si no existe el representante entonces no se muestra el enlace
									if($lista['fk_id_user_delegado']){
echo "Dar Respuesta ";
									}else{
										echo "
Falta asignar representante para este Sitio
";
									}
									echo "	";
									echo "";
									echo $lista['nombre_sitio'];
									echo "	";
									echo "";
									echo $lista['nombre_region'];
									echo "	";
									echo "";
									echo $lista['dpto_divipola_nombre'];
									echo "	";
									echo "";
									echo $lista['mpio_divipola_nombre'];
									echo "	";
									echo "";
									echo $lista['codigo_dane'];
									echo "	";
									echo "";
									echo $lista['nombre_delegado'];
									echo "
";

echo "".$lista['celular_delegado']."";

									echo "
" . $lista['email'];

									echo "	";
							endforeach;

				}
			endforeach;
		}

						?>


text:
//
//  BRCryptoPayment.h
//  BRCore
//
//  Created by Michael Carrara on 8/27/19.
//  Copyright © 2019 breadwallet. All rights reserved.
//
//  See the LICENSE file at the project root for license information.
//  See the CONTRIBUTORS file at the project root for a list of contributors.

#ifndef BRCryptoPayment_h
#define BRCryptoPayment_h

#include "BRCryptoBase.h"
#include "BRCryptoAddress.h"
#include "BRCryptoAmount.h"
#include "BRCryptoCurrency.h"
#include "BRCryptoNetwork.h"
#include "BRCryptoTransfer.h"

#ifdef __cplusplus
extern "C" {
#endif

    /// Mark: Forward Declarations

    typedef struct BRCryptoPaymentProtocolRequestBitPayBuilderRecord *BRCryptoPaymentProtocolRequestBitPayBuilder;

    typedef struct BRCryptoPaymentProtocolRequestRecord *BRCryptoPaymentProtocolRequest;

    typedef struct BRCryptoPaymentProtocolPaymentRecord *BRCryptoPaymentProtocolPayment;

    typedef struct BRCryptoPaymentProtocolPaymentACKRecord *BRCryptoPaymentProtocolPaymentACK;

    typedef enum {
        CRYPTO_PAYMENT_PROTOCOL_TYPE_BITPAY,
        CRYPTO_PAYMENT_PROTOCOL_TYPE_BIP70,
    } BRCryptoPaymentProtocolType;

    typedef enum {
        CRYPTO_PAYMENT_PROTOCOL_ERROR_NONE,
        CRYPTO_PAYMENT_PROTOCOL_ERROR_CERT_MISSING,
        CRYPTO_PAYMENT_PROTOCOL_ERROR_CERT_NOT_TRUSTED,
        CRYPTO_PAYMENT_PROTOCOL_ERROR_SIGNATURE_TYPE_NOT_SUPPORTED,
        CRYPTO_PAYMENT_PROTOCOL_ERROR_SIGNATURE_VERIFICATION_FAILED,
        CRYPTO_PAYMENT_PROTOCOL_ERROR_EXPIRED
    } BRCryptoPaymentProtocolError;

    typedef void * BRCryptoPayProtReqContext;

    typedef char * (*BRCryptoPayProtReqBitPayAndBip70CommonNameExtractor) (BRCryptoPaymentProtocolRequest request,
                                                                           BRCryptoPayProtReqContext context,
                                                                           const char *pkiType,
                                                                           uint8_t *certBytes[],
                                                                           size_t certLengths[],
                                                                           size_t certCount);

    typedef BRCryptoPaymentProtocolError (*BRCryptoPayProtReqBitPayAndBip70Validator) (BRCryptoPaymentProtocolRequest request,
                                                                                BRCryptoPayProtReqContext context,
                                                                                const char *pkiType,
                                                                                uint64_t expires,
                                                                                uint8_t *certBytes[],
                                                                                size_t certLengths[],
                                                                                size_t certCount,
                                                                                const uint8_t *digest,
                                                                                size_t digestLength,
                                                                                const uint8_t *signature,
                                                                                size_t signatureLength);

    typedef struct {
        BRCryptoPayProtReqContext context;
        BRCryptoPayProtReqBitPayAndBip70Validator validator;
        BRCryptoPayProtReqBitPayAndBip70CommonNameExtractor nameExtractor;
    } BRCryptoPayProtReqBitPayAndBip70Callbacks;

    typedef BRCryptoPayProtReqBitPayAndBip70Callbacks BRCryptoPayProtReqBitPayCallbacks;
    typedef BRCryptoPayProtReqBitPayAndBip70Callbacks BRCryptoPayProtReqBip70Callbacks;

    /// Mark: BitPay Payment Protocol Request Builder

    extern BRCryptoPaymentProtocolRequestBitPayBuilder
    cryptoPaymentProtocolRequestBitPayBuilderCreate (BRCryptoNetwork cryptoNetwork,
                                                     BRCryptoCurrency cryptoCurrency,
                                                     BRCryptoPayProtReqBitPayCallbacks callbacks,
                                                     const char *network,
                                                     uint64_t time,
                                                     uint64_t expires,
                                                     double feePerByte,
                                                     const char *memo,
                                                     const char *paymentURL,
                                                     const uint8_t *merchantData,
                                                     size_t merchDataLen);

    DECLARE_CRYPTO_GIVE_TAKE (BRCryptoPaymentProtocolRequestBitPayBuilder, cryptoPaymentProtocolRequestBitPayBuilder);

    extern void
    cryptoPaymentProtocolRequestBitPayBuilderAddOutput(BRCryptoPaymentProtocolRequestBitPayBuilder builder,
                                                       const char *address,
                                                       uint64_t amount);

    extern BRCryptoPaymentProtocolRequest
    cryptoPaymentProtocolRequestBitPayBuilderBuild(BRCryptoPaymentProtocolRequestBitPayBuilder builder);

    /// Mark: Payment Protocol Request

    extern BRCryptoBoolean
    cryptoPaymentProtocolRequestValidateSupported (BRCryptoPaymentProtocolType type,
                                                   BRCryptoNetwork network,
                                                   BRCryptoCurrency currency,
                                                   BRCryptoWallet wallet);

    extern BRCryptoPaymentProtocolRequest
    cryptoPaymentProtocolRequestCreateForBip70 (BRCryptoNetwork cryptoNetwork,
                                                BRCryptoCurrency cryptoCurrency,
                                                BRCryptoPayProtReqBip70Callbacks callbacks,
                                                uint8_t *serialization,
                                                size_t serializationLen);

    DECLARE_CRYPTO_GIVE_TAKE (BRCryptoPaymentProtocolRequest, cryptoPaymentProtocolRequest);

    extern BRCryptoPaymentProtocolType
    cryptoPaymentProtocolRequestGetType (BRCryptoPaymentProtocolRequest protoReq);

    extern BRCryptoBoolean
    cryptoPaymentProtocolRequestIsSecure (BRCryptoPaymentProtocolRequest protoReq);

    extern const char *
    cryptoPaymentProtocolRequestGetMemo (BRCryptoPaymentProtocolRequest protoReq);

    extern const char *
    cryptoPaymentProtocolRequestGetPaymentURL (BRCryptoPaymentProtocolRequest protoReq);

    extern BRCryptoAmount
    cryptoPaymentProtocolRequestGetTotalAmount (BRCryptoPaymentProtocolRequest protoReq);

    extern BRCryptoNetworkFee
    cryptoPaymentProtocolRequestGetRequiredNetworkFee (BRCryptoPaymentProtocolRequest protoReq);

    extern BRCryptoAddress
    cryptoPaymentProtocolRequestGetPrimaryTargetAddress (BRCryptoPaymentProtocolRequest protoReq);

    // If the return value is not NULL, it must be deallocated using free()
    extern char *
    cryptoPaymentProtocolRequestGetCommonName (BRCryptoPaymentProtocolRequest protoReq);

    extern BRCryptoPaymentProtocolError
    cryptoPaymentProtocolRequestIsValid(BRCryptoPaymentProtocolRequest protoReq);

    /// Mark: Payment Protocol Payment

    extern BRCryptoPaymentProtocolPayment
    cryptoPaymentProtocolPaymentCreate (BRCryptoPaymentProtocolRequest protoReq,
                                        BRCryptoTransfer transfer,
                                        BRCryptoAddress refundAddress);

    DECLARE_CRYPTO_GIVE_TAKE (BRCryptoPaymentProtocolPayment, cryptoPaymentProtocolPayment);

    extern uint8_t *
    cryptoPaymentProtocolPaymentEncode(BRCryptoPaymentProtocolPayment protoPay,
                                       size_t *encodedLen);

    /// Mark: Payment Protocol ACK

    extern BRCryptoPaymentProtocolPaymentACK
    cryptoPaymentProtocolPaymentACKCreateForBip70 (uint8_t *serialization,
                                                   size_t serializationLen);

    DECLARE_CRYPTO_GIVE_TAKE (BRCryptoPaymentProtocolPaymentACK, cryptoPaymentProtocolPaymentACK);

    extern const char *
    cryptoPaymentProtocolPaymentACKGetMemo (BRCryptoPaymentProtocolPaymentACK protoAck);

#ifdef __cplusplus
}
#endif

#endif /* BRCryptoPayment_h */


text:
<?xml version="1.0" encoding="UTF-8"?>
<!-- see http://www.mojohaus.org/clirr-maven-plugin/examples/ignored-differences.html -->
<differences>
    <difference>
        <differenceType>7012</differenceType>
        <className>com/google/cloud/bigtable/beam/hbasesnapshots/ImportJobFromHbaseSnapshot$ImportOptions</className>
        <method>*</method>
    </difference>
</differences>


text:
<?php

namespace Webforge\Common\System;

use Webforge\Common\StringUtil as S;
use Webforge\Common\Preg;
use Webforge\Common\ArrayUtil as A;
use Webforge\Common\DateTime\DateTime;
use InvalidArgumentException;
use LogicException;

/**
 *
 * translate API
 * Convention: every path has a trailing slash
 */
class Dir
{
    public const WINDOWS = 'WINDOWS';
    public const UNIX = 'UNIX';

    public const WITHOUT_TRAILINGSLASH = 0x000001;
    public const WITHOUT_TRAILING_SLASH = 0x000001;

    /**
     * Represents path like D:\ converted to unix as D:/
     */
    public const WINDOWS_DRIVE_WINDOWS_STYLE = 0x000001;

    /**
     * Represents path like D:\ converted to unix as /D:/
     *
     * (this is an alternative git path style)
     */
    public const WINDOWS_DRIVE_UNIX_STYLE = 0x000002;

    /**
     * Represents path like D:\ converted to unix as /cygdrive/d/
     *
     * (this is an alternative git path style)
     */
    public const WINDOWS_WITH_CYGWIN = 0x000004;

    public const SORT_ALPHABETICAL = 2;

    public const ORDER_ASC = 1024;
    public const ORDER_DESC = 2048;

    public const RECURSIVE = 2;

    public const RELATIVE = 'relative';

    public const ASSERT_EXISTS       = 0x000010;
    public const PARENT              = 0x000020;

    /**
     * The default chmod for new directories
     *
     * @var octal $mode
     */
    public static $defaultMod = 0744;

    /**
     * Path of the directory
     *
     * @var array all names of the subdirectories and the name itself
     */
    private $path = array();

    protected $prefix;

    /**
     * The name of the streamwrapper if path is wrapped
     *
     * @var string
     */
    protected $wrapper;

    /**
     * @var bool
     */
    protected $cygwin;

    /**
     * Globale ignores for directories
     *
     * @param array
     * @see getContents()
     */
    public $ignores = array();

    /**
     * Create a new Instance of a directory
     *
     * directories do not have to exist
     * @param string|Dir $path
     */
    public function __construct($path = null)
    {
        if ($path instanceof Dir) {
            $path = $path->getPath();
        }

        if (isset($path)) {
            $this->setPath($path);
        }
    }

    /**
     * Returns a new directory with $path
     *
     * @param string $path with trailing slash
     * @return Dir
     */
    public static function factory($path = null)
    {
        return new static($path);
    }

    /**
     * Returns a new directory with $path but $path does not have to be trailing slashed
     *
     * @param string $path does not need to have trailingslash
     */
    public static function factoryTS($path = null)
    {
        if (!isset($path)) {
            return new static(null);
        } else {
            return new static(rtrim($path, '\\/').DIRECTORY_SEPARATOR);
        }
    }

    /**
    * Creates the dir from a relative URL in relation to $base
    *
    * @return Psc\System\Dir
    */
    public static function createFromURL($url, Dir $base = null)
    {
        if (!isset($base)) {
            $base = new Dir(getcwd().DIRECTORY_SEPARATOR);
        }

        return $base->sub($url);
    }

    /**
     * Creates a temporary Directory
     */
    public static function createTemporary()
    {
        $file = File::createTemporary();
        $tempname = $file->getName();
        $file->delete();

        $dir = $file->getDirectory()->sub($tempname.'/');
        $dir->make();
        return $dir;
    }

    /**
     *
     * @param string $path mit trailin DIRECTORY_SEPERATOR
     */
    public function setPath($path)
    {
        $path = trim($path);

        $lastChar = mb_substr($path, -1);
        if ($lastChar !== '\\' && $lastChar !== '/') {
            throw new Exception($path.' should end with (back)slash.');
        }

        if ($this->cygwin = self::isCygwinPath($path)) {
            $parts = explode('/', $this->fixToUnixPath($path));
            $this->prefix = '/cygdrive/'.$parts[2].'/';
            $this->path = array_slice($parts, 3, -1);
        } elseif (self::isWrappedPath($path)) {
            $wrapper = null;
            $path = $this->extractWrapper($this->fixToUnixPath($path), $wrapper);
            $parts = explode('/', $path);

            // windows drive as unix path /C:/
            if (mb_strpos($parts[1], ':') === 1) {
                $this->prefix = mb_substr($parts[1], 0, 1).':\\';
                $this->path = array_slice($parts, 2, -1);
                $driveStyle = self::WINDOWS_DRIVE_UNIX_STYLE;
            // windows drive as windows path C:/
            } elseif (mb_strpos($parts[0], ':') === 1) {
                $this->prefix = mb_substr($parts[0], 0, 1).':\\';
                $this->path = array_slice($parts, 1, -1);
                $driveStyle = self::WINDOWS_DRIVE_WINDOWS_STYLE;
            } else {
                $this->path = array_slice($parts, 0, -1); // parts 0 maybe not empty for directory/ as rest of path
                if (mb_strpos($path, '/') === 0) {
                    $this->prefix = '/';
                }
                $driveStyle = self::WINDOWS_DRIVE_WINDOWS_STYLE;
            }

            $this->wrapWith($wrapper, $driveStyle);
        } elseif (self::isAbsolutePath($path)) {
            if (mb_strpos($path, '\\\\') === 0) {
                $parts = explode('\\', $this->fixToWindowsPath($path));
                $this->prefix = '\\\\'.$parts[1];
                $this->path = array_slice($parts, 1, -1);
            } elseif (DIRECTORY_SEPARATOR === '\\') {
                // windows drive as windows path D:\
                $parts = explode('\\', $this->fixToWindowsPath($path));

                if (mb_strpos($parts[0], ':') === 1) {
                    $this->prefix = $parts[0].'\\';
                    $this->path = array_slice($parts, 1, -1);

                // windows drive as unix path on windows
                } elseif (mb_strpos($parts[1], ':') === 1) {
                    $this->prefix = $parts[1].'\\';
                    $this->path = array_slice($parts, 2, -1);
                } else {
                    // unix path on windows
                    $this->prefix = '/';
                    $this->path = array_slice($parts, 0, -1);
                }
            } else {
                $parts = explode('/', $this->fixToUnixPath($path));

                // windows drive as windows path /C:/
                if (mb_strpos($parts[1], ':') === 1) {
                    $this->prefix = '/'.mb_substr($parts[1], 0, 1).':/';
                    $this->path = array_slice($parts, 2, -1);
                } elseif (mb_strpos($parts[0], ':') === 1) {
                    $this->prefix = '/'.mb_substr($parts[0], 0, 1).':/';
                    $this->path = array_slice($parts, 1, -1);
                } else {
                    $this->prefix = '/';
                    $this->path = array_slice($parts, 0, -1);
                }
            }
        } else {
            // relative
            $this->prefix = null;

            if (DIRECTORY_SEPARATOR === '\\') {
                $parts = explode('\\', $this->fixToWindowsPath($path));
            } else {
                $parts = explode('/', $this->fixToUnixPath($path));
            }

            $this->path = $parts;
        }

        // cleanup empty elements
        $this->path = array_filter(
            $this->path,
            function ($part) {
          return (mb_strlen($part) > 0);
      }
        );

        // renumber
        $this->path = array_merge($this->path);

        return $this;
    }

    public static function fixToUnixPath($mixedPath)
    {
        $bs = preg_quote('\\');
        return Preg::replace($mixedPath, '~'.$bs.'(?!(\s|'.$bs.'))~', '/');
    }

    protected static function fixToWindowsPath($mixedPath)
    {
        return str_replace('/', '\\', $mixedPath);
    }

    /**
     * @param string &$wrapper
     * @return string $path (verkürzt um den wrapper)
     */
    protected function extractWrapper($path, &$wrapper)
    {
        $m = array();
        if (Preg::match($path, '|^([a-z\.0-9]+)://(.*)$|', $m) > 0) {
            $wrapper = $m[1];
            $path = rtrim($m[2], '\\/').'/'; // cleanup trailing-backslash
        }

        return $path;
    }

    public static function isWrappedPath($path)
    {
        return Preg::match($path, '|^([a-z\.0-9]+)://(.*)$|') > 0;
    }

    public static function isCygwinPath($path)
    {
        return Preg::match($path, '|^/cygdrive/[a-z]/|i') > 0;
    }

    public function isCygwin()
    {
        return $this->cygwin;
    }

    /**
     * @return string ohne :// dahinter
     */
    public function getWrapper()
    {
        return $this->wrapper;
    }

    /**
     * Wraps the dir with the wrapper and converts windows paths
     *
     * @deprecated
     * @param string only the name of the wrapper like file or vfs or phar
     */
    public function setWrapper($wrapperName)
    {
        return $this->wrapWith($wrapperName);
    }

    /**
     * Wraps the dir with the wrapper and converts windows paths
     *
     * @param string only the name of the wrapper like file or vfs or phar
     */
    public function wrapWith($wrapperName, $driveStyle = null)
    {
        $this->wrapper = $wrapperName;

        $this->prefix = $this->wrapper.'://'.$this->getOSPrefix(self::UNIX, $driveStyle ?: self::WINDOWS_DRIVE_WINDOWS_STYLE);

        return $this;
    }

    /**
     * @return bool
     */
    public function isWrapped()
    {
        return $this->wrapper !== null;
    }

    /**
     * Resolves relative parts of the path an normalizes
     *
     * if path is relative its resolved to the current working directory
     *
     * the type of the path of getcwd will be used. So this might change the prefix-type of directory!
     * if dir is not relative this works like realpath with directories that do not exist
     * @uses PHP::getcwd()
     * @chainable
     */
    public function resolvePath()
    {
        if (count($this->path) == 0) {
            return $this;
        }

        if ($this->isRelative()) {
            /* wir ermitteln das aktuelle working directory und fügen dieses vor unserem bisherigen Pfad hinzu
             * den . am anfang brauchen wir nicht wegmachen, das wird nachher normalisiert
             */
            $cwd = self::factory(getcwd().DIRECTORY_SEPARATOR);
            $this->prefix = $cwd->getPrefix($this);

            $this->path = array_merge(
                $cwd->getPathArray(),
                $this->path
            );
        }

        /* pfad normalisieren */
        $newPath = array();
        foreach ($this->path as $dir) {
            if ($dir !== '.') { // dir2/dir1/./dir4/dir3 den . ignorieren
        if ($dir == '..') {  // ../ auflösen dadurch, dass wir ein verzeichnis zurückgehen
          array_pop($newPath);
        } else {
            $newPath[] = $dir;
        }
            }
        }

        $this->path = $newPath;

        return $this;
    }

    /**
     * Löst einen Pfad zu einem absoluten auf
     *
     * der Pfad ist ein string mit forwardslashes. beginnt er mit . oder mit .. wird er relativ zum objekt-path gesehen und angehängt
     * ansonsten wird er absolut interpretiert.
     * @param string $path
     * @return Dir (neue instance)
     */
    public function expand($path)
    {
        if (mb_strpos($path, '.') === 0) {
            return $this->sub($path);
        } else {
            return self::factory($path);
        }
    }

    /**
     * Verkürzt einen Pfad in Bezug auf ein anderes Verzeichnis
     *
     * Die Funktion kann z.b. dafür benutzt zu werden aus einem absoluten Verzeichnis ein Relatives zu machen.

     * Die Umwandlung in ein relatives Verzeichnis geschieht in Bezug auf das angegebene Verzeichnis.

     * Wenn das aktuelle Verzeichnis ein Unterverzeichnis des angegebenen ist, wird das Verzeichnis in ein relatives
     * umgewandelt (sofern es das nicht schon war) und der Pfad bis zum angegeben Verzeichnis verkürzt.
     * @param Dir $dir das Verzeichnis zu welchem Bezug genommen werden soll
     */
    public function makeRelativeTo(Dir $dir)
    {
        $dir = clone $dir;
        $removePath = (string) $dir->resolvePath();
        $thisPath = (string) $this->resolvePath();

        if (!S::startsWith($thisPath, $removePath) || mb_strlen($thisPath) < mb_strlen($removePath)) {
            throw new Exception('Das Verzeichnis ('.$thisPath.')[1] muss in ('.$removePath.')[2] sein. Kann [1] nicht relatv zu [2] machen, da [2] zu lang ist. Vielleicht Argumente falsch rum?');
        }

        if ($removePath == $thisPath) {
            $this->setPath('.'.DIRECTORY_SEPARATOR); // das Verzeichnis ist relativ gesehen zu sich selbst das aktuelle Verzeichnis
            return $this;
        }

        /* schneidet den zu entfernen pfad vom aktuellen ab */
        $this->path = array_slice($this->path, count($dir->getPathArray()));
        $this->makeRelative();

        /* ./ hinzufügen */
        array_unshift($this->path, '.');

        return $this;
    }

    /**
     * Sets the path to a relative one (no matter if its relative or absolute)
     *
     * this removes the absolute part of the path which will be:
     * /cygdrive/x for cygwin paths
     * X:\ for windows paths
     * / for unix paths
     * wrapper:// for wrapper-paths
     * @chainable
     */
    public function makeRelative()
    {
        $this->cygwin = false;
        $this->wrapper = null;
        $this->prefix = null;
        return $this;
    }

    /**
     * Gibt die URL zum Verzeichnis zurück
     *
     * das root Verzeichnis muss angegeben werden
     * URL hat keinen Trailingslash! aber einen slash davor
     */
    public function getURL(Dir $relativeDir = null)
    {
        if (!isset($relativeDir)) {
            $relativeDir = new Dir('.'.DIRECTORY_SEPARATOR);
        }

        $rel = clone $this;
        $rel->makeRelativeTo($relativeDir);
        $pa = $rel->getPathArray();
        unset($pa[0]);

        return '/'.implode('/', array_map('rawurlencode', $pa));
    }

    /**
     * Überprüft ob wir Unterverzeichnis eines anderen sind
     *
     * Gibt TRUE zurück wenn $this ein Unterverzeichnis von $parent ist
     * Gibt TRUE zurück wenn $this in $parent enthalten ist
     *
     * gibt FALSE zurück wenn $this und $parent gleich sind
     *
     * ansonsten False
     * @param Dir $parent das Oberverzeichnis zu überprüfen, wenn dies mit $this.equals() wird auch false zurückgegeben
     */
    public function isSubdirectoryOf(Dir $parent)
    {
        $parentPath = (string) $parent->resolvePath();
        $thisPath = (string) $this->resolvePath();

        return S::startsWith($thisPath, $parentPath) && mb_strlen($parentPath) < mb_strlen($thisPath); //das hintere schließt Gleichheit aus
    }

    /**
     * Fügt dem aktuellen Verzeichnis-Pfad ein Unterverzeichnis oder mehrere (einen Pfad) hinzu
     *
     * Wenn $dir der String ".." ist wird ins ParentDir gewechselt (sofern dies möglich ist)
     * Das angegebene Verzeichnis ist ein relatives Verzeichnis und dessen Pfad wird hinzugefügt
     *
     * wenn $dir eine File ist, wird das subverzeichnis angehängt und eine Referenz auf die Datei mit demselben Namen im Verzeichnis zurückgegeben, dabei muss das Verzeichnis von $file ein relatives Dir sein
     *
     * $dir->append('subdir/');
     * $dir->append('./banane/tanne/apfel/');
     * @param string|Dir $dir das Verzeichnis muss relativ sein
     * @chainable
     */
    public function append($dir)
    {
        if ($dir == null) {
            return $this;
        }
        if ($dir == '..' && count($this->path) >= 1) {
            array_pop($this->path);
            // clearcache
            return $this;
        }

        if (!($dir instanceof \Psc\System\Dir)) {
            $dir = (string) $dir;
            if (!s::endsWith($dir, '/')) {
                $dir .= '/';
            }

            $dir = str_replace('/', DIRECTORY_SEPARATOR, $dir);
            $dir = new Dir($dir);
        }

        foreach ($dir->getPathArray() as $part) {
            if ($part == '.') {
                continue;
            }
            $this->path[] = $part;
        }
        return $this;
    }

    /**
     * Returns a copy of the instance from a subdirectory
     *
     * @param string $subDirUrl with / at the end and / inbetween (dont' use backslash!)
     * @return Dir
     */
    public function sub($subDirUrl)
    {
        $sub = clone $this;
        return $sub->append($subDirUrl);
    }

    /**
     * Returns a copy of the instance of the parent directory
     *
     * @return Dir
     */
    public function up()
    {
        $up = clone $this;
        return $up->append('..');
    }

    /**
     * Slices parts of the path out (modifies the state)
     *
     * @chainable
     */
    public function slice($start, $length = null)
    {
        if (func_num_args() == 1) {
            $this->path = array_slice($this->path, $start);
        } else {
            $this->path = array_slice($this->path, $start, $length);
        }
        return $this;
    }

    /**
     * Returns a new instance from this directory
     */
    public function clone_()
    {
        return clone $this;
    }

    /**
     * Gibt einen Array über die Verzeichnisse und Dateien im Verzeichnis zurück
     *
     * Ignores:

     * bei den Ignores gibt es ein Paar Dinge zu beachten: Es ist zu beachten, dass strings in echte Reguläre Ausdrücke umgewandelt werden. Die Delimiter für die Ausdrücke sind //
     * Der reguläre Ausdruck wird mit ^ und $ ergänzt. D.h. gibt man als Array Eintrag '.svn' wird er umgewandelt in den Ausdruck '/^\.svn$/' besondere Zeichen werden gequotet
     * Wird der Delimiter / am Anfang und Ende angegeben, werden diese Modifikationen nicht gemacht

     * Diese Ignore Funktion ist nicht mit Wildcards zu verwechseln (diese haben in Regulären Ausdrücken andere Funktionen).
     *
     * Ignores von unserem Verzeichnis werden an die Unterverzeichnisse weitervererbt.
     *
     * Extensions:

     * Wird extensions angegeben (als array oder string) werden nur Dateien (keine Verzeichnisse) mit dieser/n Endungen in den Array gepackt.
     * Ignores werden trotzdem angewandt.
     *
     * @param array|string $extensions ein Array von Dateiendungen oder eine einzelne Dateiendung
     * @param array $ignores ein Array von Regulären Ausdrücken, die auf den Dateinamen/Verzeichnisnamen (ohne den kompletten Pfad) angewandt werden
     * @param int $sort eine Konstante die bestimmt, wie die Dateien in Verzeichnissen sortiert ausgegeben werden sollen
     * @return Array mit Dir und File
     */
    public function getContents($extensions = null, array $ignores=null, $sort = null, $subDirs = null)
    {
        if (!$this->exists()) {
            throw new Exception('Verzeichnis existiert nicht: '.$this);
        }

        if (!is_bool($subDirs)) {
            $subDirs = !isset($extensions);
        } // subDirs werden per Default durchsucht wenn extensions nicht angegeben ist

        $handle = opendir((string) $this);

        if ($handle === false) {
            throw new Exception('Fehler beim öffnen des Verzeichnisses mit opendir(). '.$this);
        }

        /* ignore Dirs schreiben */
        if (isset($this->ignores) || $ignores != null) {
            $ignores = array_merge($this->ignores, (array) $ignores);

            foreach ($ignores as $key=>$ignore) {
                if (!S::startsWith($ignore, '/') || !S::endsWith($ignore, '/')) {
                    $ignore = '/^'.$ignore.'$/';
                }

                $ignores[$key] = $ignore;
            }

            $callBack = array('Webforge\Common\Preg','match');
        }

        $content = array();
        while (false !== ($filename = readdir($handle))) {
            if ($filename != '.' && $filename != '..' && ! (isset($callBack) && count($ignores) > 0 && array_sum(array_map($callBack, array_fill(0, count($ignores), $filename), $ignores)) > 0)) {  // wenn keine ignore regel matched

                if (is_file($this->getPath().$filename)) {
                    $file = new File(clone $this, $filename);

                    if (isset($extensions) && (is_string($extensions) && $file->getExtension() != ltrim($extensions, '.') || is_array($extensions) && !in_array($file->getExtension(), $extensions))) {
                        continue;
                    }

                    $content[] = $file;
                }

                if (is_dir($this->getPath().$filename) && $subDirs) { // wenn extensions gesetzt ist, keine verzeichnisse, per default
                    $directory = new Dir($this->getPath().$filename.$this->getDS());
                    $directory->ignores = array_merge($directory->ignores, $ignores); // wir vererben unsere ignores

                    $content[] = $directory;
                }
            }
        }
        closedir($handle);

        if ($sort !== null) {
            if ($sort & self::ORDER_ASC) {
                $order = 'asc';
            } elseif ($sort & self::ORDER_DESC) {
                $order = 'desc';
            } else {
                $order = 'asc';
            }

            /* alphabetisch sortieren */
            if ($sort & self::SORT_ALPHABETICAL) {
                if ($order == 'asc') {
                    $function = create_function(
                        '$a,$b',
                        'return strcasecmp($a->getName(),$b->getName()); '
                    );
                } else {
                    $function = create_function(
                        '$a,$b',
                        'return strcasecmp($b->getName(),$a->getName()); '
                    );
                }

                uasort($content, $function);
            }
        }

        return $content;
    }

    /**
     * Gibt alle Dateien (auch in Unterverzeichnissen) zurück
     *
     * für andere Parameter siehe getContents()
     * @param bool $subdirs wenn TRUE wird auch in Subverzeichnissen gesucht
     * @see getContents()
     */
    public function getFiles($extensions = null, array $ignores = null, $subdirs = true)
    {
        if (is_string($extensions) && mb_strpos($extensions, '.') === 0) {
            $extensions = mb_substr($extensions, 1);
        }
        /* wir starten eine Breitensuche (BFS) auf dem Verzeichnis */

        $files = array();
        $dirs = array(); // Verzeichnisse die schon besucht wurden
        $queue = array($this);

        while (count($queue) > 0) {
            $elem = array_pop($queue);

            /* dies machen wir deshalb, da wenn extension gesetzt ist, keine verzeichnisse gesetzt werden */
            foreach ($elem->getContents(null, $ignores) as $item) {
                if ($item instanceof Dir && !in_array((string) $item, $dirs)) { // ist das verzeichnis schon besucht worden?

                    if ($subdirs) { // wenn nicht wird hier nichts der queue hinzugefügt und wir bearbeiten kein unterverzeichnis
                        array_unshift($queue, $item);
                    }

                    /* besucht markieren */
                    $dirs[] = (string) $item;
                }
            }

            foreach ($elem->getContents($extensions, $ignores) as $item) {
                if ($item instanceof File) {
                    $files[] = $item;
                }
            }
        }

        return $files;
    }

    /**
     * Gibt alle Unterverzeichnisse (auch in Unterverzeichnissen) zurück
     *
     * für andere Parameter siehe getContents()
     * @param bool $subdirs wenn TRUE wird auch in Subverzeichnissen gesucht, sonst werden nur verzeichnisse der ebene 1 ausgegeben
     * @see getContents()
     */
    public function getDirectories(array $ignores = null, $subdirs = true)
    {
        /* wir starten eine Breitensuche (BFS) auf dem Verzeichnis */

        $dirs = array(); // Verzeichnisse die schon besucht wurden
        $queue = array($this);

        while (count($queue) > 0) {
            $elem = array_pop($queue);

            /* dies machen wir deshalb, da wenn extension gesetzt ist, keine verzeichnisse gesetzt werden */
            foreach ($elem->getContents(null, $ignores) as $item) {
                if ($item instanceof Dir && !array_key_exists((string) $item, $dirs)) { // ist das verzeichnis schon besucht worden?

                    if ($subdirs) { // wenn nicht wird hier nichts der queue hinzugefügt und wir bearbeiten kein unterverzeichnis
                        array_unshift($queue, $item);
                    }

                    /* besucht markieren */
                    $dirs[(string) $item] = $item;
                }
            }
        }

        return $dirs;
    }

    /**
     * Setzt die Zugriffsrechte des Verzeichnisses
     *
     * Z.b. $file->chmod(0644);  für // u+rw g+rw a+r
     * @param octal $mode
     * @param int $flags
     * @chainable
     */
    public function chmod($mode, $flags = null)
    {
        $ret = chmod((string) $this, $mode);

        if ($ret === false) {
            throw new Exception('chmod für '.$this.' auf '.$mode.' nicht möglich');
        }

        if ($flags & self::RECURSIVE) {
            foreach ($this->getContents() as $item) {
                if (is_object($item) && ($item instanceof File || $item instanceof Dir)) {
                    $item->chmod($mode, $flags);
                }
            }
        }

        return $this;
    }

    /**
     * Löscht das Verzeichnis rekursiv
     *
     * @chainable
     */
    public function delete()
    {
        if ($this->exists()) {
            foreach ($this->getContents() as $item) {
                if (is_object($item) && ($item instanceof File || $item instanceof Dir)) {
                    $item->delete(); // rekursiver aufruf für Dir
                }
            }

            @rmdir((string) $this); // selbst löschen
        }

        return $this;
    }

    /**
     * Löscht die Inhalt des Verzeichnis rekursiv
     *
     * @chainable
     */
    public function wipe()
    {
        if ($this->exists()) {
            foreach ($this->getContents() as $item) {
                if (is_object($item) && ($item instanceof File || $item instanceof Dir)) {
                    $item->delete(); // rekursiver aufruf für Dir
                }
            }
        }

        return $this;
    }

    /**
     * Copies all Files *in* $this to $destination
     *
     * @param Dir $destination
     * @chainable
     */
    public function copy(Dir $destination, $extensions = null, $ignores = null, $subDirs = null)
    {
        if ((string) $destination == (string) $this) {
            throw new Exception('Kann nicht kopieren: Zielverzeichnis und Quellverzeichns sind gleich.');
        }

        if (!$destination->exists()) {
            $destination->create();
        }

        foreach ($this->getContents($extensions, $ignores, null, $subDirs) as $item) {
            if ($item instanceof File) {
                $destFile = clone $item;
                $destFile->setDirectory($destination);
                $item->copy($destFile);
            }

            if ($item instanceof Dir) {
                $relativeDir = clone $item;
                $relativeDir->makeRelativeTo($this);

                $destDir = clone $destination;
                $destDir->append($relativeDir); // path/to/destination/unterverzeichnis
        $item->copy($destDir); //rekursiver Aufruf
            }
        }
        return $this;
    }

    /**
     * Moves the directory and changes its internal state
     *
     * @param Dir $destination
     * @chainable
     */
    public function move(Dir $destination)
    {
        $ret = @rename((string) $this, (string) $destination);

        $errInfo = 'Kann Verzeichnis '.$this.' nicht nach '.$destination.' verschieben / umbenennen.';

        if (!$ret) {
            if ($destination->exists()) {
                throw new Exception($errInfo.' Das Zielverzeichnis existiert.');
            }

            if (!$this->exists()) {
                throw new Exception($errInfo.' Das Quellverzeichnis existiert nicht.');
            } else {
                throw new Exception($errInfo);
            }
        }

        /* wir übernehmen die Pfade von $destination */
        $this->path = $destination->getPathArray();
        return $this;
    }

    /**
     * Creates the full path to the directory, if it does not exist
     *
     * @chainable
     */
    public function create()
    {
        $this->make(self::PARENT | self::ASSERT_EXISTS);
        return $this;
    }

    /**
     * Creates the Directory
     *
     * @param bitmap $options self::PARENT to create the full path of the directory
     * @chainable
     */
    public function make($options=null)
    {
        if (is_int($options)) {
            $parent = ($options & self::PARENT) == self::PARENT;
            $assert = ($options & self::ASSERT_EXISTS) == self::ASSERT_EXISTS;
        } else {
            // legacy option
            $parent = (mb_strpos($options, '-p') !== false);
            $assert = false;
        }

        if (!$this->exists()) {
            $ret = @mkdir((string) $this, $this->getDefaultMod(), $parent);
            if ($ret == false) {
                throw new Exception('Fehler beim erstellen des Verzeichnisses: '.$this);
            }
        } else {
            if (!$assert) {
                throw new Exception('Verzeichnis '.$this.' kann nicht erstellt werden, da es schon existiert');
            }
        }

        return $this;
    }

    /**
     * Returns the correct default for mkdir() operations (and such) that respect a umask (if set)
     *
     * if env WEBFORGE_UMASK_SET is 1 then always 0777 is used, otherwise the content from self::$defaultMod is used
     */
    public function getDefaultMod()
    {
        if (getenv('WEBFORGE_UMASK_SET') == 1) {
            return 0777;
        } else {
            return self::$defaultMod;
        }
    }

    /**
     * Copy all files (just the files) from this dir into another
     *
     * wenn flat = TRUE ist, werden auch Unterverzeichnisse durchsucht. dies "flatted" die Files dann into $destination
     */
    public function copyFiles($extension, Dir $destination, $flat = false, array $ignores = null)
    {
        foreach ($this->getFiles($extension, $ignores, $flat) as $f) {
            $f->copy(new File($destination, $f->getName()));
        }
        return $this;
    }

    /**
     * Überprüft ob eine bestimmte Datei im Verzeichnis liegt (und gibt diese zurück)
     *
     * Wird ein File Objekt übergebeben wird der Name der Datei überprüft.
     * wenn $file ein relatives Verzeichnis hat wird die datei in dem passenden relativen Subverzeichnis zurückgegebeben
     * wenn die Datei nicht existiert, passiert nichts
     * gibt immer eine Datei zurück
     * ist die Datei absolut wird eine InvalidArgumentException geworfen
     *
     * @param string|File $file
     * @param const $relative
     * @return File
     */
    public function getFile($file)
    {
        if ($file instanceof File) {
            $fileName = $file->getName();
            $fileDir = $file->getDirectory();

            if ($fileDir->isRelative()) {
                $dir = $this->clone_()->append($file->getDirectory());
            } else {
                throw new \InvalidArgumentException('Wenn eine Datei übergeben wird, darf diese nicht absolut sein');
            }
        } elseif (is_string($file) && mb_strpos($file, '/') !== false) {
            return File::createFromURL($file, $this);
        } else {
            $fileName = $file;
            $dir = $this;
        }

        $file = new File($fileName, $dir);

        return $file;
    }

    /**
     *
     * @return bool
     */
    public function exists()
    {
        if (count($this->path) == 0) {
            return false;
        }
        return is_dir((string) $this);
    }

    /**
     * Is the directory empty?
     *
     * a directory is empty, if it has no files or directories in it
     * a directory is empty, if it does not exist
     * @return bool
     */
    public function isEmpty()
    {
        return !$this->exists() || count($this->getContents()) === 0;
    }

    /**
     * @return bool
     */
    public function isWriteable()
    {
        if (count($this->path) == 0) {
            return false;
        }
        return is_writable((string) $this);
    }

    /**
     * @return bool
     */
    public function isReadable()
    {
        if (count($this->path) == 0) {
            return false;
        }
        return is_readable((string) $this);
    }

    /**
     * @return bool
     */
    public function isRelative()
    {
        return $this->prefix === null;
    }

    /**
     * @return bool
     */
    public function isAbsolute()
    {
        return $this->prefix !== null;
    }

    /**
     * @return bool
     */
    public static function isAbsolutePath($path)
    {
        return   mb_strpos($path, '/') === 0 // unix
          || mb_strpos($path, ':') === 1 // windows C:\ etc
          || self::isCygwinPath($path)   // /cygdrive/c
          || self::isWrappedPath($path) // phar:// ...
          || mb_strpos($path, '\\\\') === 0;
    }

    /**
     * Returns the Path as string
     *
     * the path is returned for the current Operating System
     * @return string
     */
    public function getPath($flags = 0x000000)
    {
        $ds = $this->getDS();

        $trail = $flags & self::WITHOUT_TRAILINGSLASH ? '' : $ds;

        return $this->prefix.(empty($this->path) ? '' : implode($ds, $this->path).$trail);
    }

    /**
     * Returns the path without trailing slash
     */
    public function wtsPath()
    {
        return $this->getPath(self::WITHOUT_TRAILINGSLASH);
    }

    /**
     * Returns the path of the directory converted to specific OS
     *
     * some edge cases will throw an LogicException because they cannot be converted:
     *
     * D:\\windows is on unix: /D:/windows/ (like mozilla does it with file://)
     * /var/local/www/ is on windows??
     *
     * @return string
     * @param const $os self::WINDOWS|self::UNIX
     */
    public function getOSPath($os, $flags = 0x000000)
    {
        $osDS = $this->getOSDS($os, $flags);

        return $this->getOSPrefix($os, $flags).(empty($this->path) ? '' : implode($osDS, $this->path).$osDS);
    }

    /**
     * Returns a prefix which is converted to the specific os
     *
     * if prefix is absolute this ends with a slash or backslash
     * @return string
     */
    protected function getOSPrefix($os, $flags = 0x000000)
    {
        $letter = null;
        if ($this->isWindowsDrivePrefix($letter)) {
            $osPrefix = '';

            if (($flags & self::WINDOWS_WITH_CYGWIN) && $os === self::WINDOWS) {
                $osPrefix .= '/cygdrive/'.mb_strtolower($letter).'/';
            } else {
                if (!($flags & self::WINDOWS_DRIVE_WINDOWS_STYLE) && $os === self::UNIX) {
                    $osPrefix  .= '/';
                }

                $osPrefix .= $letter.':'.$this->getOSDS($os);
            }
        } else {
            $osPrefix = $this->prefix;
        }

        return $osPrefix;
    }

    /**
     * Returns the DirectorySeperator
     *
     * @return \ oder / (bei isWrapped() true ist dies immer / (oder by cygwin paths)
     */
    public function getDS()
    {
        return ($this->isWrapped() || $this->isCygwin()) ? '/' : DIRECTORY_SEPARATOR;
    }

    /**
     * Returns the DirectorySeperator for a specific operating system
     *
     * @return \ or /
     */
    public function getOSDS($os, $flags = 0x000000)
    {
        return ($this->isWrapped() || $this->isCygwin() || ($flags & self::WINDOWS_WITH_CYGWIN) || $os === self::UNIX) ? '/' : '\\';
    }

    /**
     * @return bool
     */
    protected function isWindowsDrivePrefix(&$letter = null)
    {
        if (mb_strpos($this->prefix, ':') === 1) {
            $letter = mb_substr($this->prefix, 0, 1);
            return true;
        } elseif (mb_strpos($this->prefix, ':') === 2) { // like /C:/
            $letter = mb_substr($this->prefix, 1, 1);
            return true;
        }

        return false;
    }

    /**
     * Returns on Unix an Unix path and on Windows an Cygdrive compatible path
     *
     * @return string
     */
    public function getUnixOrCygwinPath()
    {
        return $this->getOSPath($this->getOS(), Dir::WINDOWS_WITH_CYGWIN);
    }

    /**
     * Is the path to the other directory the same?
     * @return bool
     */
    public function equals(Dir $dir)
    {
        return $this->getPath() === $dir->getPath();
    }

    /**
     * @return array
     */
    public function getPathArray()
    {
        return $this->path;
    }

    /**
     * Returns the basename of the directory
     *
     * @return string
     */
    public function getName()
    {
        if (count($this->path) > 0) {
            return $this->path[count($this->path)-1];
        }
    }

    /**
     * @return DateTime
     */
    public function getModifiedTime()
    {
        return new Datetime(filemtime((string) $this));
    }

    /**
     * @return Psc\DateTime\DateTime
     */
    public function getAccessTime()
    {
        return new Datetime(fileatime((string) $this));
    }

    /**
     * @return Psc\DateTime\DateTime
     */
    public function getCreateTime()
    {
        return new Datetime(filectime((string) $this));
    }

    /**
     *
     * @return const WINDOWS|UNIX
     */
    public function getOS()
    {
        if (mb_substr(PHP_OS, 0, 3) == 'WIN') {
            $os = self::WINDOWS;
        } else {
            $os = self::UNIX;
        }
        return $os;
    }

    public function __toString()
    {
        return $this->getPath();
    }

    public function getQuotedString($flags = 0)
    {
        $str = (string) $this;

        if ($flags & self::WITHOUT_TRAILINGSLASH) {
            $str = mb_substr($str, 0, -1);
        }

        if (mb_strpos($str, ' ') !== false) {
            return escapeshellarg($str);
        }

        return $str;
    }

    /**
     * Extrahiert das Verzeichnis aus einer Angabe zu einer Datei
     *
     * @param string $string der zu untersuchende string
     * @return Dir
     */
    public static function extract($string)
    {
        if (mb_strlen($string) == 0) {
            throw new Exception('String ist leer, kann kein Verzeichnis extrahieren');
        }

        $path = dirname($string).DIRECTORY_SEPARATOR;
        try {
            $dir = new Dir($path);
        } catch (Exception $e) {
            throw new Exception('kann kein Verzeichnis aus dem extrahierten Verzeichnis "'.$path.'" erstellen: '.$e->getMessage());
        }

        return $dir;
    }

    /**
     *
     * function used from resolvePath()
     * @namespace-only
     */
    public function getPrefix(Dir $getter)
    {
        return $this->prefix;
    }
}


text:
package net.community.chest.awt.layout.gridbag;

import java.awt.GridBagConstraints;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import net.community.chest.util.collection.CollectionsUtils;

public enum GridBagGridSizingType {
    RELATIVE(GridBagConstraints.RELATIVE),
    REMAINDER(GridBagConstraints.REMAINDER);

    private final int    _specVal;
    public int getSpecValue ()
    {
        return _specVal;
    }

    GridBagGridSizingType (final int specVal)
    {
        _specVal = specVal;
    }

    public static final List<GridBagGridSizingType>    VALUES=Collections.unmodifiableList(Arrays.asList(values()));
    public static GridBagGridSizingType fromString (final String name)
    {
        return CollectionsUtils.fromString(VALUES, name, false);
    }

    public static GridBagGridSizingType fromSpecValue (final int specVal)
    {
        for (final GridBagGridSizingType v : VALUES)
        {
            if ((v != null) && (v.getSpecValue() == specVal))
                return v;
        }

        return null;
    }
}


text:
<?php

namespace Smoney\ActionBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Payment
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="Smoney\ActionBundle\Entity\PaymentRepository")
 */
class Payment
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var float
     *
     * @ORM\Column(name="amount", type="float")
     */
    private $amount;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="date", type="datetime")
     */
    private $date;

    /**
     * @var boolean
     *
     * @ORM\Column(name="confirmed", type="boolean")
     */
    private $confirmed;

    /**
     * @var boolean
     *
     * @ORM\Column(name="paid", type="boolean")
     */
    private $paid;

    /**
     * @var boolean
     *
     * @ORM\Column(name="received", type="boolean")
     */
    private $received;

    /**
     * @var boolean
     *
     * @ORM\Column(name="registered", type="boolean")
     */
    private $registered;

    /**
     * @ORM\ManyToOne(targetEntity="Tk\UserBundle\Entity\Member", cascade={"persist"})
     */
    protected $payer;

    /**
     * @ORM\OneToMany(targetEntity="Tk\ExpenseBundle\Entity\Expense", mappedBy="payment", cascade={"persist"})
     */
    protected $paybacks;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->confirmed = false;
        $this->paid = false;
        $this->received = false;
        $this->registered = false;
    }

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

    /**
     * Set amount
     *
     * @param float $amount
     * @return Payment
     */
    public function setAmount($amount)
    {
        $this->amount = $amount;

        return $this;
    }

    /**
     * Get amount
     *
     * @return float
     */
    public function getAmount()
    {
        return $this->amount;
    }

    /**
     * Set date
     *
     * @param \DateTime $date
     * @return Payment
     */
    public function setDate($date)
    {
        $this->date = $date;

        return $this;
    }

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

    /**
     * Set confirmed
     *
     * @param boolean $confirmed
     * @return Payment
     */
    public function setConfirmed($confirmed)
    {
        $this->confirmed = $confirmed;

        return $this;
    }

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

    /**
     * Set paid
     *
     * @param boolean $paid
     * @return Payment
     */
    public function setPaid($paid)
    {
        $this->paid = $paid;

        return $this;
    }

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

    /**
     * Set received
     *
     * @param boolean $received
     * @return Payment
     */
    public function setReceived($received)
    {
        $this->received = $received;

        return $this;
    }

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

    /**
     * Set registered
     *
     * @param boolean $registered
     * @return Payment
     */
    public function setRegistered($registered)
    {
        $this->registered = $registered;

        return $this;
    }

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

    /**
     * Set payer
     *
     * @param \Tk\UserBundle\Entity\Member $payer
     * @return Payment
     */
    public function setPayer(\Tk\UserBundle\Entity\Member $payer = null)
    {
        $this->payer = $payer;

        return $this;
    }

    /**
     * Get payer
     *
     * @return \Tk\UserBundle\Entity\Member
     */
    public function getPayer()
    {
        return $this->payer;
    }

    /**
     * Set receiver
     *
     * @param \Tk\UserBundle\Entity\Member $receiver
     * @return Payment
     */
    public function setReceiver(\Tk\UserBundle\Entity\Member $receiver = null)
    {
        $this->receiver = $receiver;

        return $this;
    }

    /**
     * Get receiver
     *
     * @return \Tk\UserBundle\Entity\Member
     */
    public function getReceiver()
    {
        return $this->receiver;
    }
}


text:
/* A multi-threaded telnet-like server that gives a Python prompt.

Usage: pysvr [port]

For security reasons, it only accepts requests from the current host.
This can still be insecure, but restricts violations from people who
can log in on your machine.  Use with caution!

*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>

#include <pthread.h>
#include <getopt.h>

/* XXX Umpfh.
   Python.h defines a typedef destructor, which conflicts with pthread.h.
   So Python.h must be included after pthread.h. */

#include "Python.h"

extern int Py_VerboseFlag;

#ifndef PORT
#define PORT 4000
#endif

struct workorder {
    int conn;
    struct sockaddr_in addr;
};

/* Forward */
static void init_python(void);
static void usage(void);
static void oprogname(void);
static void main_thread(int);
static void create_thread(int, struct sockaddr_in *);
static void *service_thread(struct workorder *);
static void run_interpreter(FILE *, FILE *);
static int run_command(char *, PyObject *);
static void ps(void);

static char *progname = "pysvr";

static PyThreadState *gtstate;

main(int argc, char **argv)
{
    int port = PORT;
    int c;

    if (argc > 0 && argv[0] != NULL && argv[0][0] != '\0')
        progname = argv[0];

    while ((c = getopt(argc, argv, "v")) != EOF) {
        switch (c) {
        case 'v':
            Py_VerboseFlag++;
            break;
        default:
            usage();
        }
    }

    if (optind < argc) {
        if (optind+1 < argc) {
            oprogname();
            fprintf(stderr, "too many arguments\n");
            usage();
        }
        port = atoi(argv[optind]);
        if (port <= 0) {
            fprintf(stderr, "bad port (%s)\n", argv[optind]);
            usage();
        }
    }

    main_thread(port);

    fprintf(stderr, "Bye.\n");

    exit(0);
}

static char usage_line[] = "usage: %s [port]\n";

static void
usage(void)
{
    fprintf(stderr, usage_line, progname);
    exit(2);
}

static void
main_thread(int port)
{
    int sock, conn, size, i;
    struct sockaddr_in addr, clientaddr;

    sock = socket(PF_INET, SOCK_STREAM, 0);
    if (sock < 0) {
        oprogname();
        perror("can't create socket");
        exit(1);
    }

#ifdef SO_REUSEADDR
    i = 1;
    setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *) &i, sizeof i);
#endif

    memset((char *)&addr, '\0', sizeof addr);
    addr.sin_family = AF_INET;
    addr.sin_port = htons(port);
    addr.sin_addr.s_addr = 0L;
    if (bind(sock, (struct sockaddr *)&addr, sizeof addr) < 0) {
        oprogname();
        perror("can't bind socket to address");
        exit(1);
    }

    if (listen(sock, 5) < 0) {
        oprogname();
        perror("can't listen on socket");
        exit(1);
    }

    fprintf(stderr, "Listening on port %d...\n", port);

    for (i = 0; ; i++) {
        size = sizeof clientaddr;
        memset((char *) &clientaddr, '\0', size);
        conn = accept(sock, (struct sockaddr *) &clientaddr, &size);
        if (conn < 0) {
            oprogname();
            perror("can't accept connection from socket");
            exit(1);
        }

        size = sizeof addr;
        memset((char *) &addr, '\0', size);
        if (getsockname(conn, (struct sockaddr *)&addr, &size) < 0) {
            oprogname();
            perror("can't get socket name of connection");
            exit(1);
        }
        if (clientaddr.sin_addr.s_addr != addr.sin_addr.s_addr) {
            oprogname();
            perror("connection from non-local host refused");
            fprintf(stderr, "(addr=%lx, clientaddr=%lx)\n",
                ntohl(addr.sin_addr.s_addr),
                ntohl(clientaddr.sin_addr.s_addr));
            close(conn);
            continue;
        }
        if (i == 4) {
            close(conn);
            break;
        }
        create_thread(conn, &clientaddr);
    }

    close(sock);

    if (gtstate) {
        PyEval_AcquireThread(gtstate);
        gtstate = NULL;
        Py_Finalize();
        /* And a second time, just because we can. */
        Py_Finalize(); /* This should be harmless. */
    }
    exit(0);
}

static void
create_thread(int conn, struct sockaddr_in *addr)
{
    struct workorder *work;
    pthread_t tdata;

    work = malloc(sizeof(struct workorder));
    if (work == NULL) {
        oprogname();
        fprintf(stderr, "out of memory for thread.\n");
        close(conn);
        return;
    }
    work->conn = conn;
    work->addr = *addr;

    init_python();

    if (pthread_create(&tdata, NULL, (void *)service_thread, work) < 0) {
        oprogname();
        perror("can't create new thread");
        close(conn);
        return;
    }

    if (pthread_detach(tdata) < 0) {
        oprogname();
        perror("can't detach from thread");
    }
}

static PyThreadState *the_tstate;
static PyInterpreterState *the_interp;
static PyObject *the_builtins;

static void
init_python(void)
{
    if (gtstate)
        return;
    Py_Initialize(); /* Initialize the interpreter */
    PyEval_InitThreads(); /* Create (and acquire) the interpreter lock */
    gtstate = PyEval_SaveThread(); /* Release the thread state */
}

static void *
service_thread(struct workorder *work)
{
    FILE *input, *output;

    fprintf(stderr, "Start thread for connection %d.\n", work->conn);

    ps();

    input = fdopen(work->conn, "r");
    if (input == NULL) {
        oprogname();
        perror("can't create input stream");
        goto done;
    }

    output = fdopen(work->conn, "w");
    if (output == NULL) {
        oprogname();
        perror("can't create output stream");
        fclose(input);
        goto done;
    }

    setvbuf(input, NULL, _IONBF, 0);
    setvbuf(output, NULL, _IONBF, 0);

    run_interpreter(input, output);

    fclose(input);
    fclose(output);

  done:
    fprintf(stderr, "End thread for connection %d.\n", work->conn);
    close(work->conn);
    free(work);
}

static void
oprogname(void)
{
    int save = errno;
    fprintf(stderr, "%s: ", progname);
    errno = save;
}

static void
run_interpreter(FILE *input, FILE *output)
{
    PyThreadState *tstate;
    PyObject *new_stdin, *new_stdout;
    PyObject *mainmod, *globals;
    char buffer[1000];
    char *p, *q;
    int n, end;

    PyEval_AcquireLock();
    tstate = Py_NewInterpreter();
    if (tstate == NULL) {
        fprintf(output, "Sorry -- can't create an interpreter\n");
        return;
    }

    mainmod = PyImport_AddModule("__main__");
    globals = PyModule_GetDict(mainmod);
    Py_INCREF(globals);

    new_stdin = PyFile_FromFile(input, "<socket-in>", "r", NULL);
    new_stdout = PyFile_FromFile(output, "<socket-out>", "w", NULL);

    PySys_SetObject("stdin", new_stdin);
    PySys_SetObject("stdout", new_stdout);
    PySys_SetObject("stderr", new_stdout);

    for (n = 1; !PyErr_Occurred(); n++) {
        Py_BEGIN_ALLOW_THREADS
        fprintf(output, "%d> ", n);
        p = fgets(buffer, sizeof buffer, input);
        Py_END_ALLOW_THREADS

        if (p == NULL)
            break;
        if (p[0] == '\377' && p[1] == '\354')
            break;

        q = strrchr(p, '\r');
        if (q && q[1] == '\n' && q[2] == '\0') {
            *q++ = '\n';
            *q++ = '\0';
        }

        while (*p && isspace(*p))
            p++;
        if (p[0] == '#' || p[0] == '\0')
            continue;

        end = run_command(buffer, globals);
        if (end < 0)
            PyErr_Print();

        if (end)
            break;
    }

    Py_XDECREF(globals);
    Py_XDECREF(new_stdin);
    Py_XDECREF(new_stdout);

    Py_EndInterpreter(tstate);
    PyEval_ReleaseLock();

    fprintf(output, "Goodbye!\n");
}

static int
run_command(char *buffer, PyObject *globals)
{
    PyObject *m, *d, *v;
    fprintf(stderr, "run_command: %s", buffer);
    if (strchr(buffer, '\n') == NULL)
        fprintf(stderr, "\n");
    v = PyRun_String(buffer, Py_single_input, globals, globals);
    if (v == NULL) {
        if (PyErr_Occurred() == PyExc_SystemExit) {
            PyErr_Clear();
            return 1;
        }
        PyErr_Print();
        return 0;
    }
    Py_DECREF(v);
    return 0;
}

static void
ps(void)
{
    char buffer[100];
    PyOS_snprintf(buffer, sizeof(buffer),
                  "ps -l -p %d </dev/null | sed 1d\n", getpid());
    system(buffer);
}


text:
<?php

class AdminController extends ControllerBase
{
    /**
     * Index action
     */
    public function indexAction()
    {

    }

    public function successAction()
    {

    }

    public function loginAction()
    {

        $username = $this->request->getPost('username');
        $password = $this->request->getPost('password');

        $user = Users::findFirstByUsername($username);
        if ($user) {
            if ($this->security->checkToken() && $this->security->checkHash($password, $user->password)) {
                $this->session->set('auth-identity', array(
                    'id' => $user->id,
                    'username' => $user->username
                    ));
                return $this->dispatcher->forward(array(
                    "controller" => "admin",
                    "action" => "success"
                    ));
            } else {
                return $this->dispatcher->forward(array(
                    "controller" => "admin",
                    "action" => "failed"
                    ));
            }
        } else {
            return $this->dispatcher->forward(array(
                "controller" => "admin",
                "action" => "notfound"
                ));
        }

    }

    public function logoutAction()
    {
        $this->session->remove('auth-identity');
    }

    public function failedAction()
    {
        $this->flash->error("login failed.");
        // return $this->dispatcher->forward(array(
        //     "controller" => "admin",
        //     "action" => "index"
        //     ));
    }

    public function notfoundAction()
    {
        $this->flash->error("account was not found");
        // return $this->dispatcher->forward(array(
        //     "controller" => "admin",
        //     "action" => "index"
        //     ));
    }

}


text:
define(['text!templates/terms.html','views/modals/sell'], function(termsTemplate, modalSell) {
  var termsView = Backbone.View.extend({
    el: $('#content'),

    render: function() {
      this.$el.html(termsTemplate);
        new modalSell();
      if(window.innerWidth < 750) {
        $('#backButton').show().click(function () {
          window.history.back();
        });
      }
    }
  });

  return termsView;
});