text:
package net

import (
	"errors"
	"time"
)

var (
	// supportsIPv4 reports whether the platform supports IPv4
	// networking functionality.
	supportsIPv4 bool

	// supportsIPv6 reports whether the platform supports IPv6
	// networking functionality.
	supportsIPv6 bool

	// supportsIPv4map reports whether the platform supports
	// mapping an IPv4 address inside an IPv6 address at transport
	// layer protocols. See RFC 4291, RFC 4038 and RFC 3493.
	supportsIPv4map bool
)

// An addrList represents a list of network endpoint addresses.
type addrList []Addr

// isIPv4 returns true if the Addr contains an IPv4 address.
func isIPv4(addr Addr) bool {
	switch addr := addr.(type) {
	case *TCPAddr:
		return addr.IP.To4() != nil
	case *UDPAddr:
		return addr.IP.To4() != nil
	case *IPAddr:
		return addr.IP.To4() != nil
	}
	return false
}

// first returns the first address which satisfies strategy, or if
// none do, then the first address of any kind.
func (addrs addrList) first(strategy func(Addr) bool) Addr {
	for _, addr := range addrs {
		if strategy(addr) {
			return addr
		}
	}
	return addrs[0]
}

// partition divides an address list into two categories, using a
// strategy function to assign a boolean label to each address.
// The first address, and any with a matching label, are returned as
// primaries, while addresses with the opposite label are returned
// as fallbacks. For non-empty inputs, primaries is guaranteed to be
// non-empty.
func (addrs addrList) partition(strategy func(Addr) bool) (primaries, fallbacks addrList) {
	var primaryLabel bool
	for i, addr := range addrs {
		label := strategy(addr)
		if i == 0 || label == primaryLabel {
			primaryLabel = label
			primaries = append(primaries, addr)
		} else {
			fallbacks = append(fallbacks, addr)
		}
	}
	return
}

var errNoSuitableAddress = errors.New("no suitable address found")

// filterAddrList applies a filter to a list of IP addresses,
// yielding a list of Addr objects. Known filters are nil, ipv4only,
// and ipv6only. It returns every address when the filter is nil.
// The result contains at least one address when error is nil.
func filterAddrList(filter func(IPAddr) bool, ips []IPAddr, inetaddr func(IPAddr) Addr) (addrList, error) {
	var addrs addrList
	for _, ip := range ips {
		if filter == nil || filter(ip) {
			addrs = append(addrs, inetaddr(ip))
		}
	}
	if len(addrs) == 0 {
		return nil, errNoSuitableAddress
	}
	return addrs, nil
}

// ipv4only reports whether the kernel supports IPv4 addressing mode
// and addr is an IPv4 address.
func ipv4only(addr IPAddr) bool {
	return supportsIPv4 && addr.IP.To4() != nil
}

// ipv6only reports whether the kernel supports IPv6 addressing mode
// and addr is an IPv6 address except IPv4-mapped IPv6 address.
func ipv6only(addr IPAddr) bool {
	return supportsIPv6 && len(addr.IP) == IPv6len && addr.IP.To4() == nil
}

// SplitHostPort splits a network address of the form "host:port",
// "[host]:port" or "[ipv6-host%zone]:port" into host or
// ipv6-host%zone and port. A literal address or host name for IPv6
// must be enclosed in square brackets, as in "[::1]:80",
// "[ipv6-host]:http" or "[ipv6-host%zone]:80".
func SplitHostPort(hostport string) (host, port string, err error) {
	j, k := 0, 0

	// The port starts after the last colon.
	i := last(hostport, ':')
	if i < 0 {
		goto missingPort
	}

	if hostport[0] == '[' {
		// Expect the first ']' just before the last ':'.
		end := byteIndex(hostport, ']')
		if end < 0 {
			err = &AddrError{Err: "missing ']' in address", Addr: hostport}
			return
		}
		switch end + 1 {
		case len(hostport):
			// There can't be a ':' behind the ']' now.
			goto missingPort
		case i:
			// The expected result.
		default:
			// Either ']' isn't followed by a colon, or it is
			// followed by a colon that is not the last one.
			if hostport[end+1] == ':' {
				goto tooManyColons
			}
			goto missingPort
		}
		host = hostport[1:end]
		j, k = 1, end+1 // there can't be a '[' resp. ']' before these positions
	} else {
		host = hostport[:i]
		if byteIndex(host, ':') >= 0 {
			goto tooManyColons
		}
		if byteIndex(host, '%') >= 0 {
			goto missingBrackets
		}
	}
	if byteIndex(hostport[j:], '[') >= 0 {
		err = &AddrError{Err: "unexpected '[' in address", Addr: hostport}
		return
	}
	if byteIndex(hostport[k:], ']') >= 0 {
		err = &AddrError{Err: "unexpected ']' in address", Addr: hostport}
		return
	}

	port = hostport[i+1:]
	return

missingPort:
	err = &AddrError{Err: "missing port in address", Addr: hostport}
	return

tooManyColons:
	err = &AddrError{Err: "too many colons in address", Addr: hostport}
	return

missingBrackets:
	err = &AddrError{Err: "missing brackets in address", Addr: hostport}
	return
}

func splitHostZone(s string) (host, zone string) {
	// The IPv6 scoped addressing zone identifier starts after the
	// last percent sign.
	if i := last(s, '%'); i > 0 {
		host, zone = s[:i], s[i+1:]
	} else {
		host = s
	}
	return
}

// JoinHostPort combines host and port into a network address of the
// form "host:port" or, if host contains a colon or a percent sign,
// "[host]:port".
func JoinHostPort(host, port string) string {
	// If host has colons or a percent sign, have to bracket it.
	if byteIndex(host, ':') >= 0 || byteIndex(host, '%') >= 0 {
		return "[" + host + "]:" + port
	}
	return host + ":" + port
}

// internetAddrList resolves addr, which may be a literal IP
// address or a DNS name, and returns a list of internet protocol
// family addresses. The result contains at least one address when
// error is nil.
func internetAddrList(net, addr string, deadline time.Time) (addrList, error) {
	var (
		err        error
		host, port string
		portnum    int
	)
	switch net {
	case "tcp", "tcp4", "tcp6", "udp", "udp4", "udp6":
		if addr != "" {
			if host, port, err = SplitHostPort(addr); err != nil {
				return nil, err
			}
			if portnum, err = LookupPort(net, port); err != nil {
				return nil, err
			}
		}
	case "ip", "ip4", "ip6":
		if addr != "" {
			host = addr
		}
	default:
		return nil, UnknownNetworkError(net)
	}
	inetaddr := func(ip IPAddr) Addr {
		switch net {
		case "tcp", "tcp4", "tcp6":
			return &TCPAddr{IP: ip.IP, Port: portnum, Zone: ip.Zone}
		case "udp", "udp4", "udp6":
			return &UDPAddr{IP: ip.IP, Port: portnum, Zone: ip.Zone}
		case "ip", "ip4", "ip6":
			return &IPAddr{IP: ip.IP, Zone: ip.Zone}
		default:
			panic("unexpected network: " + net)
		}
	}
	if host == "" {
		return addrList{inetaddr(IPAddr{})}, nil
	}
	// Try as a literal IP address.
	var ip IP
	if ip = parseIPv4(host); ip != nil {
		return addrList{inetaddr(IPAddr{IP: ip})}, nil
	}
	var zone string
	if ip, zone = parseIPv6(host, true); ip != nil {
		return addrList{inetaddr(IPAddr{IP: ip, Zone: zone})}, nil
	}
	// Try as a DNS name.
	ips, err := lookupIPDeadline(host, deadline)
	if err != nil {
		return nil, err
	}
	var filter func(IPAddr) bool
	if net != "" && net[len(net)-1] == '4' {
		filter = ipv4only
	}
	if net != "" && net[len(net)-1] == '6' {
		filter = ipv6only
	}
	return filterAddrList(filter, ips, inetaddr)
}

func zoneToString(zone int) string {
	if zone == 0 {
		return ""
	}
	if ifi, err := InterfaceByIndex(zone); err == nil {
		return ifi.Name
	}
	return uitoa(uint(zone))
}

func zoneToInt(zone string) int {
	if zone == "" {
		return 0
	}
	if ifi, err := InterfaceByName(zone); err == nil {
		return ifi.Index
	}
	n, _, _ := dtoi(zone, 0)
	return n
}

redpajama_set_name: RedPajamaGithub


text: ARKit + Core ML Demo


text:
REVOKE CONNECT ON DATABASE acdwide FROM PUBLIC, acdwide;
DROP DATABASE IF EXISTS acdwide;
DROP ROLE acdwide;

CREATE ROLE acdwide LOGIN ENCRYPTED PASSWORD 'md5ba3c6ad6edd7233f0024691483526660' VALID UNTIL 'infinity';
CREATE DATABASE acdwide WITH ENCODING='UTF8' OWNER=acdwide CONNECTION LIMIT=-1;
\c acdwide;

--
-- PostgreSQL database dump
--

-- Dumped from database version 9.1.15
-- Dumped by pg_dump version 9.1.15
-- Started on 2015-04-22 11:18:19 EEST

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;

--
-- TOC entry 188 (class 3079 OID 11685)
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--

CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;

--
-- TOC entry 2087 (class 0 OID 0)
-- Dependencies: 188
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--

COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';

SET search_path = public, pg_catalog;

--
-- TOC entry 513 (class 1247 OID 62278)
-- Dependencies: 6
-- Name: list_type; Type: TYPE; Schema: public; Owner: postgres
--

CREATE TYPE list_type AS ENUM (
    'white',
    'black'
);

ALTER TYPE public.list_type OWNER TO postgres;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- TOC entry 161 (class 1259 OID 62267)
-- Dependencies: 1879 1880 1881 1882 6
-- Name: agents_logs; Type: TABLE; Schema: public; Owner: acdwide; Tablespace:
--

CREATE TABLE agents_logs (
    id serial NOT NULL,
    dt timestamp without time zone,
    agent integer,
    event integer,
    callerid character varying(32),
    timer integer,
    acdgroup character varying(16) DEFAULT 0,
    extention text,
    beforeanswer integer DEFAULT 0,
    dialstatus integer DEFAULT 0,
    begin_time timestamp without time zone,
    record_id integer DEFAULT 0
);

ALTER TABLE public.agents_logs OWNER TO acdwide;

--
-- TOC entry 164 (class 1259 OID 62292)
-- Dependencies: 6
-- Name: calls; Type: TABLE; Schema: public; Owner: acdwide; Tablespace:
--

CREATE TABLE calls (
    id1 integer NOT NULL,
    id bigint,
    dt timestamp without time zone,
    acdgroup character varying(10),
    agent integer,
    status smallint,
    beforeanswer integer,
    answertime integer,
    queuetime integer,
    queuecount integer,
    callerid character varying(32),
    exten character varying,
    holdtime integer,
    crossid integer,
    operator character varying(1)
);

ALTER TABLE public.calls OWNER TO acdwide;

--
-- TOC entry 165 (class 1259 OID 62298)
-- Dependencies: 6
-- Name: calls_id1_seq; Type: SEQUENCE; Schema: public; Owner: acdwide
--

CREATE SEQUENCE calls_id1_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER TABLE public.calls_id1_seq OWNER TO acdwide;

--
-- TOC entry 166 (class 1259 OID 62300)
-- Dependencies: 6 164
-- Name: calls_id1_seq1; Type: SEQUENCE; Schema: public; Owner: acdwide
--

CREATE SEQUENCE calls_id1_seq1
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER TABLE public.calls_id1_seq1 OWNER TO acdwide;

--
-- TOC entry 2088 (class 0 OID 0)
-- Dependencies: 166
-- Name: calls_id1_seq1; Type: SEQUENCE OWNED BY; Schema: public; Owner: acdwide
--

ALTER SEQUENCE calls_id1_seq1 OWNED BY calls.id1;

--
-- TOC entry 162 (class 1259 OID 62283)
-- Dependencies: 1883 6 513
-- Name: calls_rules; Type: TABLE; Schema: public; Owner: acdwide; Tablespace:
--

CREATE TABLE calls_rules (
    id integer NOT NULL,
    date timestamp without time zone,
    type list_type,
    number text,
    count integer DEFAULT 0,
    text text,
    service text
);

ALTER TABLE public.calls_rules OWNER TO acdwide;

--
-- TOC entry 163 (class 1259 OID 62290)
-- Dependencies: 6 162
-- Name: calls_rules_id_seq; Type: SEQUENCE; Schema: public; Owner: acdwide
--

CREATE SEQUENCE calls_rules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER TABLE public.calls_rules_id_seq OWNER TO acdwide;

--
-- TOC entry 2089 (class 0 OID 0)
-- Dependencies: 163
-- Name: calls_rules_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: acdwide
--

ALTER SEQUENCE calls_rules_id_seq OWNED BY calls_rules.id;

--
-- TOC entry 171 (class 1259 OID 62318)
-- Dependencies: 6
-- Name: languages; Type: TABLE; Schema: public; Owner: acdwide; Tablespace:
--

CREATE TABLE languages (
    id integer NOT NULL,
    name text,
    name_short text
);

ALTER TABLE public.languages OWNER TO acdwide;

--
-- TOC entry 172 (class 1259 OID 62324)
-- Dependencies: 6 171
-- Name: languages_id_seq; Type: SEQUENCE; Schema: public; Owner: acdwide
--

CREATE SEQUENCE languages_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER TABLE public.languages_id_seq OWNER TO acdwide;

--
-- TOC entry 2090 (class 0 OID 0)
-- Dependencies: 172
-- Name: languages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: acdwide
--

ALTER SEQUENCE languages_id_seq OWNED BY languages.id;

--
-- TOC entry 167 (class 1259 OID 62302)
-- Dependencies: 6
-- Name: location; Type: TABLE; Schema: public; Owner: acdwide; Tablespace:
--

CREATE TABLE location (
    id integer NOT NULL,
    name text,
    ip inet
);

ALTER TABLE public.location OWNER TO acdwide;

--
-- TOC entry 168 (class 1259 OID 62308)
-- Dependencies: 6 167
-- Name: location_id_seq; Type: SEQUENCE; Schema: public; Owner: acdwide
--

CREATE SEQUENCE location_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER TABLE public.location_id_seq OWNER TO acdwide;

--
-- TOC entry 2091 (class 0 OID 0)
-- Dependencies: 168
-- Name: location_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: acdwide
--

ALTER SEQUENCE location_id_seq OWNED BY location.id;

--
-- TOC entry 169 (class 1259 OID 62310)
-- Dependencies: 6
-- Name: managers; Type: TABLE; Schema: public; Owner: acdwide; Tablespace:
--

CREATE TABLE managers (
    id integer NOT NULL,
    name text
);

ALTER TABLE public.managers OWNER TO acdwide;

--
-- TOC entry 170 (class 1259 OID 62316)
-- Dependencies: 6 169
-- Name: managers_id_seq; Type: SEQUENCE; Schema: public; Owner: acdwide
--

CREATE SEQUENCE managers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER TABLE public.managers_id_seq OWNER TO acdwide;

--
-- TOC entry 2092 (class 0 OID 0)
-- Dependencies: 170
-- Name: managers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: acdwide
--

ALTER SEQUENCE managers_id_seq OWNED BY managers.id;

--
-- TOC entry 173 (class 1259 OID 62326)
-- Dependencies: 6
-- Name: operators; Type: TABLE; Schema: public; Owner: acdwide; Tablespace:
--

CREATE TABLE operators (
    id integer NOT NULL,
    name text,
    password text,
    manager_id integer,
    date_hire date,
    date_fired date,
    can_outgoing smallint
);

ALTER TABLE public.operators OWNER TO acdwide;

--
-- TOC entry 178 (class 1259 OID 62348)
-- Dependencies: 6 173
-- Name: operators_id_seq; Type: SEQUENCE; Schema: public; Owner: acdwide
--

CREATE SEQUENCE operators_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER TABLE public.operators_id_seq OWNER TO acdwide;

--
-- TOC entry 2094 (class 0 OID 0)
-- Dependencies: 178
-- Name: operators_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: acdwide
--

ALTER SEQUENCE operators_id_seq OWNED BY operators.id;

--
-- TOC entry 174 (class 1259 OID 62332)
-- Dependencies: 6
-- Name: operators_languages; Type: TABLE; Schema: public; Owner: acdwide; Tablespace:
--

CREATE TABLE operators_languages (
    id integer NOT NULL,
    operator_id integer,
    lang_id integer
);

ALTER TABLE public.operators_languages OWNER TO acdwide;

--
-- TOC entry 175 (class 1259 OID 62335)
-- Dependencies: 174 6
-- Name: operators_languages_id_seq; Type: SEQUENCE; Schema: public; Owner: acdwide
--

CREATE SEQUENCE operators_languages_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER TABLE public.operators_languages_id_seq OWNER TO acdwide;

--
-- TOC entry 2095 (class 0 OID 0)
-- Dependencies: 175
-- Name: operators_languages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: acdwide
--

ALTER SEQUENCE operators_languages_id_seq OWNED BY operators_languages.id;

--
-- TOC entry 179 (class 1259 OID 62350)
-- Dependencies: 1895 6
-- Name: operators_services; Type: TABLE; Schema: public; Owner: acdwide; Tablespace:
--

CREATE TABLE operators_services (
    id integer NOT NULL,
    service_id integer,
    operator_id integer,
    weigth integer DEFAULT 0
);

ALTER TABLE public.operators_services OWNER TO acdwide;

--
-- TOC entry 180 (class 1259 OID 62354)
-- Dependencies: 179 6
-- Name: operators_services_id_seq; Type: SEQUENCE; Schema: public; Owner: acdwide
--

CREATE SEQUENCE operators_services_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER TABLE public.operators_services_id_seq OWNER TO acdwide;

--
-- TOC entry 2096 (class 0 OID 0)
-- Dependencies: 180
-- Name: operators_services_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: acdwide
--

ALTER SEQUENCE operators_services_id_seq OWNED BY operators_services.id;

--
-- TOC entry 176 (class 1259 OID 62337)
-- Dependencies: 1891 1892 1893 6
-- Name: operators_working; Type: TABLE; Schema: public; Owner: acdwide; Tablespace:
--

CREATE TABLE operators_working (
    id integer NOT NULL,
    operator_id integer,
    "time" timestamp without time zone,
    status integer,
    location text,
    calls integer DEFAULT 0,
    calls_time integer DEFAULT 0,
    rate integer,
    number text,
    service_id integer,
    channels text,
    channels_check integer,
    state smallint DEFAULT 0,
    "timestamp" integer
);

ALTER TABLE public.operators_working OWNER TO acdwide;

--
-- TOC entry 177 (class 1259 OID 62346)
-- Dependencies: 176 6
-- Name: operators_working_id_seq; Type: SEQUENCE; Schema: public; Owner: acdwide
--

CREATE SEQUENCE operators_working_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER TABLE public.operators_working_id_seq OWNER TO acdwide;

--
-- TOC entry 2097 (class 0 OID 0)
-- Dependencies: 177
-- Name: operators_working_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: acdwide
--

ALTER SEQUENCE operators_working_id_seq OWNED BY operators_working.id;

--
-- TOC entry 181 (class 1259 OID 62356)
-- Dependencies: 6
-- Name: queues; Type: TABLE; Schema: public; Owner: acdwide; Tablespace:
--

CREATE TABLE queues (
    id integer NOT NULL,
    service_id integer,
    weight integer,
    busy integer,
    "time" timestamp without time zone,
    number text,
    channel text,
    time_from timestamp without time zone,
    "timestamp" integer,
    timestamp_from integer
);

ALTER TABLE public.queues OWNER TO acdwide;

--
-- TOC entry 182 (class 1259 OID 62362)
-- Dependencies: 6 181
-- Name: queues_id_seq; Type: SEQUENCE; Schema: public; Owner: acdwide
--

CREATE SEQUENCE queues_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER TABLE public.queues_id_seq OWNER TO acdwide;

--
-- TOC entry 2098 (class 0 OID 0)
-- Dependencies: 182
-- Name: queues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: acdwide
--

ALTER SEQUENCE queues_id_seq OWNED BY queues.id;

--
-- TOC entry 183 (class 1259 OID 62364)
-- Dependencies: 6
-- Name: records; Type: TABLE; Schema: public; Owner: acdwide; Tablespace:
--

CREATE TABLE records (
    id integer NOT NULL,
    date timestamp without time zone,
    file_name character varying(100),
    uniqueid character varying(100),
    context character varying(100),
    extension character varying(100),
    callerid character varying(100)
);

ALTER TABLE public.records OWNER TO acdwide;

--
-- TOC entry 184 (class 1259 OID 62370)
-- Dependencies: 6 183
-- Name: records_id_seq; Type: SEQUENCE; Schema: public; Owner: acdwide
--

CREATE SEQUENCE records_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER TABLE public.records_id_seq OWNER TO acdwide;

--
-- TOC entry 2100 (class 0 OID 0)
-- Dependencies: 184
-- Name: records_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: acdwide
--

ALTER SEQUENCE records_id_seq OWNED BY records.id;

--
-- TOC entry 185 (class 1259 OID 62372)
-- Dependencies: 1899 1900 6
-- Name: services; Type: TABLE; Schema: public; Owner: acdwide; Tablespace:
--

CREATE TABLE services (
    id integer NOT NULL,
    name text,
    weight integer,
    message text,
    service_order integer DEFAULT 0,
    access_type smallint DEFAULT 0,
    extensions character varying(60)[]
);

ALTER TABLE public.services OWNER TO acdwide;

--
-- TOC entry 186 (class 1259 OID 62380)
-- Dependencies: 185 6
-- Name: services_id_seq; Type: SEQUENCE; Schema: public; Owner: acdwide
--

CREATE SEQUENCE services_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER TABLE public.services_id_seq OWNER TO acdwide;

--
-- TOC entry 2101 (class 0 OID 0)
-- Dependencies: 186
-- Name: services_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: acdwide
--

ALTER SEQUENCE services_id_seq OWNED BY services.id;

--
-- TOC entry 187 (class 1259 OID 62382)
-- Dependencies: 6
-- Name: summary_agents_calls_sac_id_seq; Type: SEQUENCE; Schema: public; Owner: acdwide
--

CREATE SEQUENCE summary_agents_calls_sac_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER TABLE public.summary_agents_calls_sac_id_seq OWNER TO acdwide;

-----
-- CREATING VIEWS
-----

CREATE VIEW operators_working_count_all
AS SELECT COUNT(*) as c, se.name as name
FROM operators_working ol
LEFT JOIN operators_services os ON (ol.operator_id=os.operator_id)
LEFT JOIN services se ON (os.service_id=se.id)
GROUP BY name;

ALTER VIEW public.operators_working_count_all OWNER TO acdwide;

CREATE VIEW operators_working_count_free
AS SELECT COUNT(*) as c, se.name as name
FROM operators_working ol
LEFT JOIN operators_services os ON (ol.operator_id=os.operator_id)
LEFT JOIN services se ON (os.service_id=se.id)
WHERE ol.status = 1 AND ol.timestamp < extract(epoch from now())
GROUP BY name;

ALTER VIEW public.operators_working_count_free OWNER TO acdwide;

CREATE VIEW operators_last_vip_service
AS SELECT COUNT(*) AS c, MAX(ol.operator_id) AS operator_id
FROM operators_services os
INNER JOIN services sr ON (sr.id=os.service_id)
INNER JOIN operators_working ol ON (ol.operator_id=os.operator_id)
WHERE sr.weight>=100 AND status=1
GROUP BY name;

ALTER VIEW public.operators_last_vip_service OWNER TO acdwide;

CREATE VIEW client_queue_next
AS SELECT min(qu.id) FROM queues qu
JOIN operators_services os ON (os.service_id = qu.service_id)
JOIN operators_working ow ON (ow.operator_id = os.operator_id)
WHERE qu.busy=0 AND ow.status=1
GROUP BY qu.service_id, qu.weight
ORDER by qu.weight DESC;

ALTER VIEW public.client_queue_next OWNER TO acdwide;

CREATE VIEW operators_free_online
AS SELECT op.operator_id, sr.weight, op.timestamp, sr.id
FROM operators_working op
INNER JOIN operators_services os ON (op.operator_id=os.operator_id)
INNER JOIN services sr ON (sr.id=os.service_id)
WHERE op.status=1
ORDER BY os.weigth DESC, op.timestamp ASC;

ALTER VIEW public.operators_free_online OWNER TO acdwide;

--
-- TOC entry 1885 (class 2604 OID 62385)
-- Dependencies: 166 164
-- Name: id1; Type: DEFAULT; Schema: public; Owner: acdwide
--

ALTER TABLE ONLY calls ALTER COLUMN id1 SET DEFAULT nextval('calls_id1_seq1'::regclass);

--
-- TOC entry 1884 (class 2604 OID 62384)
-- Dependencies: 163 162
-- Name: id; Type: DEFAULT; Schema: public; Owner: acdwide
--

ALTER TABLE ONLY calls_rules ALTER COLUMN id SET DEFAULT nextval('calls_rules_id_seq'::regclass);

--
-- TOC entry 1888 (class 2604 OID 62388)
-- Dependencies: 172 171
-- Name: id; Type: DEFAULT; Schema: public; Owner: acdwide
--

ALTER TABLE ONLY languages ALTER COLUMN id SET DEFAULT nextval('languages_id_seq'::regclass);

--
-- TOC entry 1886 (class 2604 OID 62386)
-- Dependencies: 168 167
-- Name: id; Type: DEFAULT; Schema: public; Owner: acdwide
--

ALTER TABLE ONLY location ALTER COLUMN id SET DEFAULT nextval('location_id_seq'::regclass);

--
-- TOC entry 1887 (class 2604 OID 62387)
-- Dependencies: 170 169
-- Name: id; Type: DEFAULT; Schema: public; Owner: acdwide
--

ALTER TABLE ONLY managers ALTER COLUMN id SET DEFAULT nextval('managers_id_seq'::regclass);

--
-- TOC entry 1889 (class 2604 OID 62389)
-- Dependencies: 178 173
-- Name: id; Type: DEFAULT; Schema: public; Owner: acdwide
--

ALTER TABLE ONLY operators ALTER COLUMN id SET DEFAULT nextval('operators_id_seq'::regclass);

--
-- TOC entry 1890 (class 2604 OID 62390)
-- Dependencies: 175 174
-- Name: id; Type: DEFAULT; Schema: public; Owner: acdwide
--

ALTER TABLE ONLY operators_languages ALTER COLUMN id SET DEFAULT nextval('operators_languages_id_seq'::regclass);

--
-- TOC entry 1896 (class 2604 OID 62392)
-- Dependencies: 180 179
-- Name: id; Type: DEFAULT; Schema: public; Owner: acdwide
--

ALTER TABLE ONLY operators_services ALTER COLUMN id SET DEFAULT nextval('operators_services_id_seq'::regclass);

--
-- TOC entry 1894 (class 2604 OID 62391)
-- Dependencies: 177 176
-- Name: id; Type: DEFAULT; Schema: public; Owner: acdwide
--

ALTER TABLE ONLY operators_working ALTER COLUMN id SET DEFAULT nextval('operators_working_id_seq'::regclass);

--
-- TOC entry 1897 (class 2604 OID 62393)
-- Dependencies: 182 181
-- Name: id; Type: DEFAULT; Schema: public; Owner: acdwide
--

ALTER TABLE ONLY queues ALTER COLUMN id SET DEFAULT nextval('queues_id_seq'::regclass);

--
-- TOC entry 1898 (class 2604 OID 62394)
-- Dependencies: 184 183
-- Name: id; Type: DEFAULT; Schema: public; Owner: acdwide
--

ALTER TABLE ONLY records ALTER COLUMN id SET DEFAULT nextval('records_id_seq'::regclass);

--
-- TOC entry 1901 (class 2604 OID 62395)
-- Dependencies: 186 185
-- Name: id; Type: DEFAULT; Schema: public; Owner: acdwide
--

ALTER TABLE ONLY services ALTER COLUMN id SET DEFAULT nextval('services_id_seq'::regclass);

--
-- TOC entry 2053 (class 0 OID 62267)
-- Dependencies: 161 2080
-- Data for Name: agents_logs; Type: TABLE DATA; Schema: public; Owner: acdwide
--

COPY agents_logs (dt, agent, event, callerid, timer, acdgroup, extention, beforeanswer, dialstatus, begin_time, record_id) FROM stdin;
\.

--
-- TOC entry 2056 (class 0 OID 62292)
-- Dependencies: 164 2080
-- Data for Name: calls; Type: TABLE DATA; Schema: public; Owner: acdwide
--

COPY calls (id1, id, dt, acdgroup, agent, status, beforeanswer, answertime, queuetime, queuecount, callerid, exten, holdtime, crossid, operator) FROM stdin;
\.

--
-- TOC entry 2102 (class 0 OID 0)
-- Dependencies: 165
-- Name: calls_id1_seq; Type: SEQUENCE SET; Schema: public; Owner: acdwide
--

SELECT pg_catalog.setval('calls_id1_seq', 1, false);

--
-- TOC entry 2103 (class 0 OID 0)
-- Dependencies: 166
-- Name: calls_id1_seq1; Type: SEQUENCE SET; Schema: public; Owner: acdwide
--

SELECT pg_catalog.setval('calls_id1_seq1', 1, true);

--
-- TOC entry 2054 (class 0 OID 62283)
-- Dependencies: 162 2080
-- Data for Name: calls_rules; Type: TABLE DATA; Schema: public; Owner: acdwide
--

COPY calls_rules (id, date, type, number, count, text, service) FROM stdin;
\.

--
-- TOC entry 2104 (class 0 OID 0)
-- Dependencies: 163
-- Name: calls_rules_id_seq; Type: SEQUENCE SET; Schema: public; Owner: acdwide
--

SELECT pg_catalog.setval('calls_rules_id_seq', 1, false);

--
-- TOC entry 2063 (class 0 OID 62318)
-- Dependencies: 171 2080
-- Data for Name: languages; Type: TABLE DATA; Schema: public; Owner: acdwide
--

COPY languages (id, name, name_short) FROM stdin;
1	English	en
2	Mandarin	ch
3	Spanish	es
4	Hindi	hi
5	Arabic	ar
6	Portuguese	po
7	German	gr
8	French	fr
\.

--
-- TOC entry 2105 (class 0 OID 0)
-- Dependencies: 172
-- Name: languages_id_seq; Type: SEQUENCE SET; Schema: public; Owner: acdwide
--

SELECT pg_catalog.setval('languages_id_seq', 9, false);

--
-- TOC entry 2059 (class 0 OID 62302)
-- Dependencies: 167 2080
-- Data for Name: location; Type: TABLE DATA; Schema: public; Owner: acdwide
--

COPY location (id, name, ip) FROM stdin;
1	SIP/3001	192.168.0.51
2	SIP/3002	192.168.0.52
\.

--
-- TOC entry 2106 (class 0 OID 0)
-- Dependencies: 168
-- Name: location_id_seq; Type: SEQUENCE SET; Schema: public; Owner: acdwide
--

SELECT pg_catalog.setval('location_id_seq', 3, true);

--
-- TOC entry 2061 (class 0 OID 62310)
-- Dependencies: 169 2080
-- Data for Name: managers; Type: TABLE DATA; Schema: public; Owner: acdwide
--

COPY managers (id, name) FROM stdin;
1	Brand Joober
\.

--
-- TOC entry 2107 (class 0 OID 0)
-- Dependencies: 170
-- Name: managers_id_seq; Type: SEQUENCE SET; Schema: public; Owner: acdwide
--

SELECT pg_catalog.setval('managers_id_seq', 2, false);

--
-- TOC entry 2065 (class 0 OID 62326)
-- Dependencies: 173 2080
-- Data for Name: operators; Type: TABLE DATA; Schema: public; Owner: acdwide
--

COPY operators (id, name, password, manager_id, date_hire, date_fired, can_outgoing) FROM stdin;
1	John Dumas	3144	1	2015-03-22	\N	1
2	Lara Victoria	8181	1	2015-03-22	\N	0
3	Peter Newman	8182	1	2015-03-24	\N	0
\.

--
-- TOC entry 2108 (class 0 OID 0)
-- Dependencies: 178
-- Name: operators_id_seq; Type: SEQUENCE SET; Schema: public; Owner: acdwide
--

SELECT pg_catalog.setval('operators_id_seq', 4, true);

--
-- TOC entry 2066 (class 0 OID 62332)
-- Dependencies: 174 2080
-- Data for Name: operators_languages; Type: TABLE DATA; Schema: public; Owner: acdwide
--

COPY operators_languages (id, operator_id, lang_id) FROM stdin;
1	2	2
2	1	2
3	1	1
\.

--
-- TOC entry 2109 (class 0 OID 0)
-- Dependencies: 175
-- Name: operators_languages_id_seq; Type: SEQUENCE SET; Schema: public; Owner: acdwide
--

SELECT pg_catalog.setval('operators_languages_id_seq', 4, true);

--
-- TOC entry 2071 (class 0 OID 62350)
-- Dependencies: 179 2080
-- Data for Name: operators_services; Type: TABLE DATA; Schema: public; Owner: acdwide
--

COPY operators_services (id, service_id, operator_id, weigth) FROM stdin;
1	1	1	100
2	2	1	50
3	2	2	100
\.

--
-- TOC entry 2110 (class 0 OID 0)
-- Dependencies: 180
-- Name: operators_services_id_seq; Type: SEQUENCE SET; Schema: public; Owner: acdwide
--

SELECT pg_catalog.setval('operators_services_id_seq', 4, true);

--
-- TOC entry 2068 (class 0 OID 62337)
-- Dependencies: 176 2080
-- Data for Name: operators_working; Type: TABLE DATA; Schema: public; Owner: acdwide
--

COPY operators_working (id, operator_id, "time", status, location, calls, calls_time, rate, number, service_id, channels, channels_check, state, "timestamp") FROM stdin;
\.

--
-- TOC entry 2111 (class 0 OID 0)
-- Dependencies: 177
-- Name: operators_working_id_seq; Type: SEQUENCE SET; Schema: public; Owner: acdwide
--

SELECT pg_catalog.setval('operators_working_id_seq', 1, true);

--
-- TOC entry 2073 (class 0 OID 62356)
-- Dependencies: 181 2080
-- Data for Name: queues; Type: TABLE DATA; Schema: public; Owner: acdwide
--

COPY queues (id, service_id, weight, busy, "time", number, channel, time_from, "timestamp", timestamp_from) FROM stdin;
\.

--
-- TOC entry 2112 (class 0 OID 0)
-- Dependencies: 182
-- Name: queues_id_seq; Type: SEQUENCE SET; Schema: public; Owner: acdwide
--

SELECT pg_catalog.setval('queues_id_seq', 1, true);

--
-- TOC entry 2075 (class 0 OID 62364)
-- Dependencies: 183 2080
-- Data for Name: records; Type: TABLE DATA; Schema: public; Owner: acdwide
--

COPY records (id, date, file_name, uniqueid, context, extension, callerid) FROM stdin;
\.

--
-- TOC entry 2113 (class 0 OID 0)
-- Dependencies: 184
-- Name: records_id_seq; Type: SEQUENCE SET; Schema: public; Owner: acdwide
--

SELECT pg_catalog.setval('records_id_seq', 1, true);

--
-- TOC entry 2077 (class 0 OID 62372)
-- Dependencies: 185 2080
-- Data for Name: services; Type: TABLE DATA; Schema: public; Owner: acdwide
--

COPY services (id, name, weight, message, service_order, access_type, extensions) FROM stdin;
1	840	50	840, %%name%%, %%hello%%	1	0	\N
2	123	20	Support, %%name%%, %%hello%%	2	0	\N
\.

--
-- TOC entry 2114 (class 0 OID 0)
-- Dependencies: 186
-- Name: services_id_seq; Type: SEQUENCE SET; Schema: public; Owner: acdwide
--

SELECT pg_catalog.setval('services_id_seq', 3, true);

--
-- TOC entry 2115 (class 0 OID 0)
-- Dependencies: 187
-- Name: summary_agents_calls_sac_id_seq; Type: SEQUENCE SET; Schema: public; Owner: acdwide
--

SELECT pg_catalog.setval('summary_agents_calls_sac_id_seq', 1, false);

--
-- TOC entry 1922 (class 2606 OID 62403)
-- Dependencies: 171 171 2081
-- Name: languages_pkey; Type: CONSTRAINT; Schema: public; Owner: acdwide; Tablespace:
--

ALTER TABLE ONLY agents_logs
    ADD CONSTRAINT agents_logs_pkey PRIMARY KEY (id);

--
-- TOC entry 1922 (class 2606 OID 62403)
-- Dependencies: 171 171 2081
-- Name: languages_pkey; Type: CONSTRAINT; Schema: public; Owner: acdwide; Tablespace:
--

ALTER TABLE ONLY calls
    ADD CONSTRAINT calls_pkey PRIMARY KEY (id1);

--
-- TOC entry 1922 (class 2606 OID 62403)
-- Dependencies: 171 171 2081
-- Name: languages_pkey; Type: CONSTRAINT; Schema: public; Owner: acdwide; Tablespace:
--

ALTER TABLE ONLY calls_rules
    ADD CONSTRAINT calls_rules_pkey PRIMARY KEY (id);

--
-- TOC entry 1903 (class 2606 OID 62397)
-- Dependencies: 161 161 161 161 161 2081
-- Name: agents_logs_dt_key; Type: CONSTRAINT; Schema: public; Owner: acdwide; Tablespace:
--

ALTER TABLE ONLY agents_logs
    ADD CONSTRAINT agents_logs_dt_key UNIQUE (dt, agent, event, callerid);

--
-- TOC entry 1922 (class 2606 OID 62403)
-- Dependencies: 171 171 2081
-- Name: languages_pkey; Type: CONSTRAINT; Schema: public; Owner: acdwide; Tablespace:
--

ALTER TABLE ONLY operators_working
    ADD CONSTRAINT operators_working_pkey PRIMARY KEY (id);

--
-- TOC entry 1922 (class 2606 OID 62403)
-- Dependencies: 171 171 2081
-- Name: languages_pkey; Type: CONSTRAINT; Schema: public; Owner: acdwide; Tablespace:
--

ALTER TABLE ONLY languages
    ADD CONSTRAINT languages_pkey PRIMARY KEY (id);

--
-- TOC entry 1918 (class 2606 OID 62399)
-- Dependencies: 167 167 2081
-- Name: location_pkey; Type: CONSTRAINT; Schema: public; Owner: acdwide; Tablespace:
--

ALTER TABLE ONLY location
    ADD CONSTRAINT location_pkey PRIMARY KEY (id);

--
-- TOC entry 1920 (class 2606 OID 62401)
-- Dependencies: 169 169 2081
-- Name: managers_pkey; Type: CONSTRAINT; Schema: public; Owner: acdwide; Tablespace:
--

ALTER TABLE ONLY managers
    ADD CONSTRAINT managers_pkey PRIMARY KEY (id);

--
-- TOC entry 1929 (class 2606 OID 62405)
-- Dependencies: 174 174 2081
-- Name: operators_languages_pkey; Type: CONSTRAINT; Schema: public; Owner: acdwide; Tablespace:
--

ALTER TABLE ONLY operators_languages
    ADD CONSTRAINT operators_languages_pkey PRIMARY KEY (id);

--
-- TOC entry 1926 (class 2606 OID 62407)
-- Dependencies: 173 173 2081
-- Name: operators_pkey; Type: CONSTRAINT; Schema: public; Owner: acdwide; Tablespace:
--

ALTER TABLE ONLY operators
    ADD CONSTRAINT operators_pkey PRIMARY KEY (id);

--
-- TOC entry 1935 (class 2606 OID 62409)
-- Dependencies: 179 179 2081
-- Name: operators_services_pkey; Type: CONSTRAINT; Schema: public; Owner: acdwide; Tablespace:
--

ALTER TABLE ONLY operators_services
    ADD CONSTRAINT operators_services_pkey PRIMARY KEY (id);

--
-- TOC entry 1941 (class 2606 OID 62411)
-- Dependencies: 181 181 2081
-- Name: queues_pkey; Type: CONSTRAINT; Schema: public; Owner: acdwide; Tablespace:
--

ALTER TABLE ONLY queues
    ADD CONSTRAINT queues_pkey PRIMARY KEY (id);

--
-- TOC entry 1944 (class 2606 OID 62413)
-- Dependencies: 183 183 2081
-- Name: records_pkey; Type: CONSTRAINT; Schema: public; Owner: acdwide; Tablespace:
--

ALTER TABLE ONLY records
    ADD CONSTRAINT records_pkey PRIMARY KEY (id);

--
-- TOC entry 1947 (class 2606 OID 62415)
-- Dependencies: 185 185 2081
-- Name: services_pkey; Type: CONSTRAINT; Schema: public; Owner: acdwide; Tablespace:
--

ALTER TABLE ONLY services
    ADD CONSTRAINT services_pkey PRIMARY KEY (id);

--
-- TOC entry 1904 (class 1259 OID 62416)
-- Dependencies: 161 161 161 2081
-- Name: agents_logs_idx1; Type: INDEX; Schema: public; Owner: acdwide; Tablespace:
--

CREATE INDEX agents_logs_idx1 ON agents_logs USING btree (dt, event, agent);

--
-- TOC entry 1905 (class 1259 OID 62417)
-- Dependencies: 161 161 161 161 2081
-- Name: agents_logs_idx2; Type: INDEX; Schema: public; Owner: acdwide; Tablespace:
--

CREATE INDEX agents_logs_idx2 ON agents_logs USING btree (dt, event, agent, acdgroup);

--
-- TOC entry 1906 (class 1259 OID 62418)
-- Dependencies: 161 161 161 161 2081
-- Name: agents_logs_idx3; Type: INDEX; Schema: public; Owner: acdwide; Tablespace:
--

CREATE INDEX agents_logs_idx3 ON agents_logs USING btree (dt, event, agent, extention);

--
-- TOC entry 1907 (class 1259 OID 62419)
-- Dependencies: 161 161 161 161 2081
-- Name: agents_logs_idx4; Type: INDEX; Schema: public; Owner: acdwide; Tablespace:
--

CREATE INDEX agents_logs_idx4 ON agents_logs USING btree (dt, agent, event, dialstatus);

--
-- TOC entry 1908 (class 1259 OID 62420)
-- Dependencies: 161 161 161 161 161 2081
-- Name: agents_logs_idx5; Type: INDEX; Schema: public; Owner: acdwide; Tablespace:
--

CREATE INDEX agents_logs_idx5 ON agents_logs USING btree (dt, agent, event, acdgroup, dialstatus);

--
-- TOC entry 1909 (class 1259 OID 62421)
-- Dependencies: 161 161 161 161 161 2081
-- Name: agents_logs_idx6; Type: INDEX; Schema: public; Owner: acdwide; Tablespace:
--

CREATE INDEX agents_logs_idx6 ON agents_logs USING btree (dt, agent, event, dialstatus, extention);

--
-- TOC entry 1910 (class 1259 OID 62426)
-- Dependencies: 161 2081
-- Name: agents_logs_idx7; Type: INDEX; Schema: public; Owner: acdwide; Tablespace:
--

CREATE INDEX agents_logs_idx7 ON agents_logs USING btree (agent);

ALTER TABLE agents_logs CLUSTER ON agents_logs_idx7;

--
-- TOC entry 1911 (class 1259 OID 62427)
-- Dependencies: 161 2081
-- Name: agents_logs_idx8; Type: INDEX; Schema: public; Owner: acdwide; Tablespace:
--

CREATE INDEX agents_logs_idx8 ON agents_logs USING btree (dt);

--
-- TOC entry 1912 (class 1259 OID 62428)
-- Dependencies: 161 2081
-- Name: agents_logs_idx9; Type: INDEX; Schema: public; Owner: acdwide; Tablespace:
--

CREATE INDEX agents_logs_idx9 ON agents_logs USING btree (event);

--
-- TOC entry 1914 (class 1259 OID 62423)
-- Dependencies: 164 2081
-- Name: calls_idx; Type: INDEX; Schema: public; Owner: acdwide; Tablespace:
--

CREATE INDEX calls_idx ON calls USING btree (dt);

--
-- TOC entry 1915 (class 1259 OID 62424)
-- Dependencies: 164 2081
-- Name: calls_idx1; Type: INDEX; Schema: public; Owner: acdwide; Tablespace:
--

CREATE INDEX calls_idx1 ON calls USING btree (callerid);

--
-- TOC entry 1913 (class 1259 OID 62422)
-- Dependencies: 162 162 2081
-- Name: calls_rules_number_service_idx; Type: INDEX; Schema: public; Owner: acdwide; Tablespace:
--

CREATE INDEX calls_rules_number_service_idx ON calls_rules USING btree (number, service);

--
-- TOC entry 1916 (class 1259 OID 62425)
-- Dependencies: 167 2081
-- Name: location_name_idx; Type: INDEX; Schema: public; Owner: acdwide; Tablespace:
--

CREATE INDEX location_name_idx ON location USING btree (name);

--
-- TOC entry 1923 (class 1259 OID 62434)
-- Dependencies: 173 2081
-- Name: operators_idx1; Type: INDEX; Schema: public; Owner: acdwide; Tablespace:
--

CREATE INDEX operators_idx1 ON operators USING btree (manager_id);

--
-- TOC entry 1924 (class 1259 OID 62437)
-- Dependencies: 173 2081
-- Name: operators_idx2; Type: INDEX; Schema: public; Owner: acdwide; Tablespace:
--

CREATE INDEX operators_idx2 ON operators USING hash (password);

--
-- TOC entry 1927 (class 1259 OID 62435)
-- Dependencies: 174 2081
-- Name: operators_languages_idx1; Type: INDEX; Schema: public; Owner: acdwide; Tablespace:
--

CREATE INDEX operators_languages_idx1 ON operators_languages USING btree (operator_id);

--
-- TOC entry 1933 (class 1259 OID 62431)
-- Dependencies: 179 2081
-- Name: operators_services_idx3; Type: INDEX; Schema: public; Owner: acdwide; Tablespace:
--

CREATE INDEX operators_services_idx3 ON operators_services USING btree (operator_id);

ALTER TABLE operators_services CLUSTER ON operators_services_idx3;

--
-- TOC entry 1930 (class 1259 OID 62436)
-- Dependencies: 176 2081
-- Name: operators_working_idx; Type: INDEX; Schema: public; Owner: acdwide; Tablespace:
--

CREATE INDEX operators_working_idx ON operators_working USING btree (operator_id);

--
-- TOC entry 1931 (class 1259 OID 62429)
-- Dependencies: 176 2081
-- Name: operators_working_idx1; Type: INDEX; Schema: public; Owner: acdwide; Tablespace:
--

CREATE INDEX operators_working_idx1 ON operators_working USING btree (location);

--
-- TOC entry 1932 (class 1259 OID 62430)
-- Dependencies: 176 176 2081
-- Name: operators_working_idx2; Type: INDEX; Schema: public; Owner: acdwide; Tablespace:
--

CREATE INDEX operators_working_idx2 ON operators_working USING btree (operator_id, status);

--
-- TOC entry 1936 (class 1259 OID 62432)
-- Dependencies: 181 181 2081
-- Name: queues_idx1; Type: INDEX; Schema: public; Owner: acdwide; Tablespace:
--

CREATE INDEX queues_idx1 ON queues USING btree (busy, service_id);

--
-- TOC entry 1937 (class 1259 OID 62433)
-- Dependencies: 181 2081
-- Name: queues_idx2; Type: INDEX; Schema: public; Owner: acdwide; Tablespace:
--

CREATE INDEX queues_idx2 ON queues USING btree ("time");

--
-- TOC entry 1938 (class 1259 OID 62438)
-- Dependencies: 181 181 2081
-- Name: queues_idx3; Type: INDEX; Schema: public; Owner: acdwide; Tablespace:
--

CREATE INDEX queues_idx3 ON queues USING btree (service_id, weight);

--
-- TOC entry 1939 (class 1259 OID 62439)
-- Dependencies: 181 181 181 2081
-- Name: queues_idx4; Type: INDEX; Schema: public; Owner: acdwide; Tablespace:
--

CREATE INDEX queues_idx4 ON queues USING btree (busy, id, service_id);

--
-- TOC entry 1942 (class 1259 OID 62440)
-- Dependencies: 183 2081
-- Name: records_idx; Type: INDEX; Schema: public; Owner: acdwide; Tablespace:
--

CREATE INDEX records_idx ON records USING btree (file_name);

--
-- TOC entry 1945 (class 1259 OID 62441)
-- Dependencies: 185 2081
-- Name: services_idx; Type: INDEX; Schema: public; Owner: acdwide; Tablespace:
--

CREATE INDEX services_idx ON services USING btree (name);

--
-- TOC entry 1979 (class 2606 OID 28688)
-- Dependencies: 1973 186 178 2114
-- Name: fk_services_operators_services; Type: FK CONSTRAINT; Schema: public; Owner: acdwide
--

ALTER TABLE ONLY operators_services
    ADD CONSTRAINT services_operators_services_fkey FOREIGN KEY (service_id) REFERENCES services(id) ON UPDATE CASCADE ON DELETE CASCADE;

--
-- TOC entry 1948 (class 2606 OID 62442)
-- Dependencies: 1921 174 171 2081
-- Name: operators_languages_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: acdwide
--

ALTER TABLE ONLY operators_languages
    ADD CONSTRAINT operators_languages_id_fkey FOREIGN KEY (lang_id) REFERENCES languages(id) ON UPDATE CASCADE ON DELETE CASCADE;

--
-- TOC entry 1949 (class 2606 OID 62447)
-- Dependencies: 1925 173 174 2081
-- Name: operators_languages_operator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: acdwide
--

ALTER TABLE ONLY operators_languages
    ADD CONSTRAINT operators_languages_operator_id_fkey FOREIGN KEY (operator_id) REFERENCES operators(id) ON UPDATE CASCADE ON DELETE CASCADE;

--
-- TOC entry 1950 (class 2606 OID 62452)
-- Dependencies: 179 173 1925 2081
-- Name: operators_services_operator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: acdwide
--

ALTER TABLE ONLY operators_services
    ADD CONSTRAINT operators_services_operator_id_fkey FOREIGN KEY (operator_id) REFERENCES operators(id) ON UPDATE CASCADE ON DELETE CASCADE;

--
-- TOC entry 1951 (class 2606 OID 62457)
-- Dependencies: 179 1946 185 2081
-- Name: operators_services_service_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: acdwide
--

ALTER TABLE ONLY operators_services
    ADD CONSTRAINT operators_services_service_id_fkey FOREIGN KEY (service_id) REFERENCES services(id) ON UPDATE CASCADE ON DELETE CASCADE;

--
-- TOC entry 2086 (class 0 OID 0)
-- Dependencies: 6
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;

--
-- TOC entry 2093 (class 0 OID 0)
-- Dependencies: 173
-- Name: operators; Type: ACL; Schema: public; Owner: acdwide
--

REVOKE ALL ON TABLE operators FROM PUBLIC;
REVOKE ALL ON TABLE operators FROM acdwide;
GRANT ALL ON TABLE operators TO acdwide;

--
-- TOC entry 2099 (class 0 OID 0)
-- Dependencies: 183
-- Name: records; Type: ACL; Schema: public; Owner: acdwide
--

REVOKE ALL ON TABLE records FROM PUBLIC;
REVOKE ALL ON TABLE records FROM acdwide;
GRANT ALL ON TABLE records TO acdwide;

-- Completed on 2015-04-22 11:18:19 EEST

--
-- PostgreSQL database dump complete
--


text:
package wire

import (
	"bytes"
	"io"
	"reflect"
	"testing"
)

// TestFilterCLearLatest tests the MsgFilterLoad API against the latest protocol
// version.
func TestFilterLoadLatest(t *testing.T) {
	pver := ProtocolVersion
	enc := BaseEncoding

	data := []byte{0x01, 0x02}
	msg := NewMsgFilterLoad(data, 10, 0, 0)

	// Ensure the command is expected value.
	wantCmd := "filterload"
	if cmd := msg.Command(); cmd != wantCmd {
		t.Errorf("NewMsgFilterLoad: wrong command - got %v want %v",
			cmd, wantCmd)
	}

	// Ensure max payload is expected value for latest protocol version.
	wantPayload := uint32(36012)
	maxPayload := msg.MaxPayloadLength(pver)
	if maxPayload != wantPayload {
		t.Errorf("MaxPayLoadLength: wrong max payload length for "+
			"protocol version %d - got %v, want %v", pver,
			maxPayload, wantPayload)
	}

	// Test encode with latest protocol version.
	var buf bytes.Buffer
	err := msg.Encode(&buf, pver, enc)
	if err != nil {
		t.Errorf("encode of MsgFilterLoad failed %v err <%v>", msg, err)
	}

	// Test decode with latest protocol version.
	readmsg := MsgFilterLoad{}
	err = readmsg.Decode(&buf, pver, enc)
	if err != nil {
		t.Errorf("decode of MsgFilterLoad failed [%v] err <%v>", buf, err)
	}
}

// TestFilterLoadCrossProtocol tests the MsgFilterLoad API when encoding with
// the latest protocol version and decoding with BIP0031Version.
func TestFilterLoadCrossProtocol(t *testing.T) {
	data := []byte{0x01, 0x02}
	msg := NewMsgFilterLoad(data, 10, 0, 0)

	// Encode with latest protocol version.
	var buf bytes.Buffer
	err := msg.Encode(&buf, ProtocolVersion, BaseEncoding)
	if err != nil {
		t.Errorf("encode of NewMsgFilterLoad failed %v err <%v>", msg,
			err)
	}

	// Decode with old protocol version.
	var readmsg MsgFilterLoad
	err = readmsg.Decode(&buf, BIP0031Version, BaseEncoding)
	if err == nil {
		t.Errorf("decode of MsgFilterLoad succeeded when it shouldn't have %v",
			msg)
	}
}

// TestFilterLoadMaxFilterSize tests the MsgFilterLoad API maximum filter size.
func TestFilterLoadMaxFilterSize(t *testing.T) {
	data := bytes.Repeat([]byte{0xff}, 36001)
	msg := NewMsgFilterLoad(data, 10, 0, 0)

	// Encode with latest protocol version.
	var buf bytes.Buffer
	err := msg.Encode(&buf, ProtocolVersion, BaseEncoding)
	if err == nil {
		t.Errorf("encode of MsgFilterLoad succeeded when it shouldn't "+
			"have %v", msg)
	}

	// Decode with latest protocol version.
	readbuf := bytes.NewReader(data)
	err = msg.Decode(readbuf, ProtocolVersion, BaseEncoding)
	if err == nil {
		t.Errorf("decode of MsgFilterLoad succeeded when it shouldn't "+
			"have %v", msg)
	}
}

// TestFilterLoadMaxHashFuncsSize tests the MsgFilterLoad API maximum hash functions.
func TestFilterLoadMaxHashFuncsSize(t *testing.T) {
	data := bytes.Repeat([]byte{0xff}, 10)
	msg := NewMsgFilterLoad(data, 61, 0, 0)

	// Encode with latest protocol version.
	var buf bytes.Buffer
	err := msg.Encode(&buf, ProtocolVersion, BaseEncoding)
	if err == nil {
		t.Errorf("encode of MsgFilterLoad succeeded when it shouldn't have %v",
			msg)
	}

	newBuf := []byte{
		0x0a,                                                       // filter size
		0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // filter
		0x3d, 0x00, 0x00, 0x00, // max hash funcs
		0x00, 0x00, 0x00, 0x00, // tweak
		0x00, // update Type
	}
	// Decode with latest protocol version.
	readbuf := bytes.NewReader(newBuf)
	err = msg.Decode(readbuf, ProtocolVersion, BaseEncoding)
	if err == nil {
		t.Errorf("decode of MsgFilterLoad succeeded when it shouldn't have %v",
			msg)
	}
}

// TestFilterLoadWireErrors performs negative tests against wire encode and decode
// of MsgFilterLoad to confirm error paths work correctly.
func TestFilterLoadWireErrors(t *testing.T) {
	pver := ProtocolVersion
	pverNoFilterLoad := BIP0037Version - 1
	wireErr := &MessageError{}

	baseFilter := []byte{0x01, 0x02, 0x03, 0x04}
	baseFilterLoad := NewMsgFilterLoad(baseFilter, 10, 0, BloomUpdateNone)
	baseFilterLoadEncoded := append([]byte{0x04}, baseFilter...)
	baseFilterLoadEncoded = append(baseFilterLoadEncoded,
		0x00, 0x00, 0x00, 0x0a, // HashFuncs
		0x00, 0x00, 0x00, 0x00, // Tweak
		0x00) // Flags

	tests := []struct {
		in       *MsgFilterLoad  // Value to encode
		buf      []byte          // Wire encoding
		pver     uint32          // Protocol version for wire encoding
		enc      MessageEncoding // Message encoding format
		max      int             // Max size of fixed buffer to induce errors
		writeErr error           // Expected write error
		readErr  error           // Expected read error
	}{
		// Latest protocol version with intentional read/write errors.
		// Force error in filter size.
		{
			baseFilterLoad, baseFilterLoadEncoded, pver, BaseEncoding, 0,
			io.ErrShortWrite, io.EOF,
		},
		// Force error in filter.
		{
			baseFilterLoad, baseFilterLoadEncoded, pver, BaseEncoding, 1,
			io.ErrShortWrite, io.EOF,
		},
		// Force error in hash funcs.
		{
			baseFilterLoad, baseFilterLoadEncoded, pver, BaseEncoding, 5,
			io.ErrShortWrite, io.EOF,
		},
		// Force error in tweak.
		{
			baseFilterLoad, baseFilterLoadEncoded, pver, BaseEncoding, 9,
			io.ErrShortWrite, io.EOF,
		},
		// Force error in flags.
		{
			baseFilterLoad, baseFilterLoadEncoded, pver, BaseEncoding, 13,
			io.ErrShortWrite, io.EOF,
		},
		// Force error due to unsupported protocol version.
		{
			baseFilterLoad, baseFilterLoadEncoded, pverNoFilterLoad, BaseEncoding,
			10, wireErr, wireErr,
		},
	}

	t.Logf("Running %d tests", len(tests))
	for i, test := range tests {
		// Encode to wire format.
		w := newFixedWriter(test.max)
		err := test.in.Encode(w, test.pver, test.enc)
		if reflect.TypeOf(err) != reflect.TypeOf(test.writeErr) {
			t.Errorf("Encode #%d wrong error got: %v, want: %v",
				i, err, test.writeErr)
			continue
		}

		// For errors which are not of type MessageError, check them for
		// equality.
		if _, ok := err.(*MessageError); !ok {
			if err != test.writeErr {
				t.Errorf("Encode #%d wrong error got: %v, "+
					"want: %v", i, err, test.writeErr)
				continue
			}
		}

		// Decode from wire format.
		var msg MsgFilterLoad
		r := newFixedReader(test.max, test.buf)
		err = msg.Decode(r, test.pver, test.enc)
		if reflect.TypeOf(err) != reflect.TypeOf(test.readErr) {
			t.Errorf("Decode #%d wrong error got: %v, want: %v",
				i, err, test.readErr)
			continue
		}

		// For errors which are not of type MessageError, check them for
		// equality.
		if _, ok := err.(*MessageError); !ok {
			if err != test.readErr {
				t.Errorf("Decode #%d wrong error got: %v, "+
					"want: %v", i, err, test.readErr)
				continue
			}
		}

	}
}


text:
+++
Title = "Gleidson Nascimento"
Twitter = "slaterx"
image = "gleidson-nascimento.jpg"
type = "speaker"
linktitle = "gleidson-nascimento"

+++

Gleidson Nascimento is a software engineering leader based in Wellington, New Zealand. He has been responsible for delivering automation to large and complex integration environments and for helping CxO-level executives to technically bootstrap start-ups, from ideation all the way to Series C funding.

He is also an active open-source developer, helping organisations to deliver FOSS solutions to the community such as Moleculer-go and goa.design. He is also a member of CentOS PaaS SIG.

Currently, he works at SECTION6 as a Consultant, assisting to foster a continuous learning and improvement culture to its employees. He also publicly speaks at conferences and provides workshops about company culture, automation and communication.


text:
A handy set of utility for android

[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg?style=flat-square)](https://www.apache.org/licenses/LICENSE-2.0.html) [![API](https://img.shields.io/badge/API-14%2B-green.svg?style=flat)](https://android-arsenal.com/api?level=14) [![JitPack](https://img.shields.io/jitpack/v/aaabidunique/android-utility.svg)](https://jitpack.io/#aaabidunique/android-utility) [![Build Status](https://travis-ci.org/aaabidunique/android-utility.svg?branch=master)](https://travis-ci.org/aaabidunique/android-utility) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-android%20utility-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/5353)
[![$ Donate!](https://img.shields.io/badge/$-donate-ff69b4.svg?maxAge=2592000&style=flat)](https://www.paypal.me/aaabidunique) [![Say Thanks!](https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg)](https://saythanks.io/to/aaabidunique)

For integration refer [here](https://github.com/aaabidunique/android-utility/wiki/Integration)
For Usage docs refer [here](https://github.com/aaabidunique/android-utility/wiki/Usage)

**For complete docs click [here](https://github.com/aaabidunique/android-utility/wiki)**

### Available utility/helper
+  `Validation`
    - [ValidationUtility](https://github.com/aaabidunique/android-utility/wiki/Usage#validationutility)
+  `Utility`
    - [ActionUtility](https://github.com/aaabidunique/android-utility/wiki/Usage#actionutility)
     - [ClipboardUtility](https://github.com/aaabidunique/android-utility/wiki/Usage#clipboardutility)
     - [SoftwareUtility](https://github.com/aaabidunique/android-utility/wiki/Usage#softwareutility)
+  `Helper`
    - [DefaultSharedPreferenceHelper](https://github.com/aaabidunique/android-utility/wiki/Usage#defaultsharedpreferencehelper)
     - [SharedPreferenceHelper](https://github.com/aaabidunique/android-utility/wiki/Usage#sharedpreferencehelper)
+  `APK`
    - [AppManager](https://github.com/aaabidunique/android-utility/wiki/Usage#appmanager)
     - [ApkParser](https://github.com/aaabidunique/android-utility/wiki/Usage#apkparser)

### Including in your project
android-utility is made available through `jitpack.io`, so getting it as simple as adding it as a dependency.

Add this in your root `build.gradle` file (**not** your module `build.gradle` file):
```gradle
allprojects {
	repositories {
		...
		maven { url "https://jitpack.io" }
	}
}
```
Add this to your module's `build.gradle` file (make sure to change LATEST with the version in the JitPack badge):
```gradle
dependencies {
	...
	compile 'com.github.aaabidunique:android-utility:LATEST'
}
```
where `LATEST` corresponds to latest release created on this repository
+ `android-utility` - [![JitPack](https://img.shields.io/jitpack/v/aaabidunique/android-utility.svg)](https://jitpack.io/#aaabidunique/android-utility)

# Changelog
Changes exist in the [here](https://github.com/aaabidunique/android-utility/blob/master/CHANGELOG.md).

# Issues/Pull Requests
I welcome and encourage all Issues/Pull requests. It usually will take me within 24-48 hours to respond to any issue or request. Here are some basic guidelines:
  1. For feature or issue, please only change specified code mentioned in the request.
  2. Please keep titles easy to read and descriptive of changes, this will make them easier to merge/fix.
  3. Check for existing [issues](https://github.com/aaabidunique/android-utility/issues) first, before filing an issue.
  Have fun!

### Apps using android-utility
> If you are using android-utility in your app and would like to be listed here, please let me know by opening a [new issue](https://github.com/aaabidunique/android-utility/issues/new)!
>  + Device Tool - [Playstore](https://play.google.com/store/apps/details?id=com.ali.deviceinfo)

### Created & Maintained By
[Abid Ali](https://github.com/aaabidunique/)

> If you found this library helpful and want to help the developer, consider buying a cup of :coffee:
>  + [PayPal](https://www.paypal.me/aaabidunique)


text:
layout: post
title: "IRCAnywhere"
slug: ircanywhere
source: http://ircanywhere.com/
---

<img src="/screenshots/ircanywhere.png">


text:
//=====================================================================
// Copyright 2016 (c), Advanced Micro Devices, Inc. All rights reserved.
//
/// \author AMD Developer Tools Team
/// \file osDirectory.cpp
///
//=====================================================================

//------------------------------ osDirectory.cpp ------------------------------

// POSIX:
#include <sys/stat.h>
#include <sys/types.h>

#ifndef __APPLE__
#include <sys/sendfile.h>
#endif

#include <unistd.h>
#include <dirent.h>
#include <fnmatch.h>
#include <stdio.h>
#include <fcntl.h>

// Infra:
#include <amdt_base_tools/Include/gtAssert.h>

// Local:
#include <amdt_os_wrappers/Include/osOSDefinitions.h>
#include <amdt_os_wrappers/Include/osDirectory.h>
#include <amdt_os_wrappers/Include/osSystemError.h>

// ---------------------------------------------------------------------------
// Name:        osDirectory::exists
// Description: Returns true iff this directory exists on disk.
// Author:      AMD Developer Tools Team
// Date:        15/5/2004
// ---------------------------------------------------------------------------
bool osDirectory::exists() const
{
    bool retVal = false;

    // Convert directory to UTF8
    std::string utf8Path;
    _directoryPath.asString().asUtf8(utf8Path);

    // Try to get the file status:
    struct stat fileStatus;
    int rc = ::stat(utf8Path.c_str(), &fileStatus);

    if (rc == 0)
    {
        // If this is a directory:
        if (S_ISDIR(fileStatus.st_mode))
        {
            retVal = true;
        }
    }

    return retVal;
}

// ---------------------------------------------------------------------------
// Name:        osDirectory::create
// Description: Create the directory on the disk. Return true when succeed.
// Author:      AMD Developer Tools Team
// Date:        2/11/2006
// ---------------------------------------------------------------------------
bool osDirectory::create()
{
    bool retVal = false;

    // If directory exists no need to create it:
    if (exists())
    {
        retVal = true;
    }
    else
    {
        gtString directoryAsStr = _directoryPath.asString();
        mode_t directoryPremissions = S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH;

        // Start creating the sub directories if they don't exist skipping the initial root dir:
        int rc = 0;

        // Do not look at the first slash of the root directory:
        int slashPosition = 1;

        while (0 == rc && -1 != slashPosition)
        {
            // Find the next sub directory:
            slashPosition = directoryAsStr.find('/', slashPosition);

            // Get the sub directory string (take full name if there is not next subsection):
            gtString subDirectoryStr = directoryAsStr;

            if (slashPosition != -1)
            {
                directoryAsStr.getSubString(0, slashPosition - 1, subDirectoryStr);
            }

            osFilePath subDirectoryPath(subDirectoryStr);
            osDirectory subDirectory(subDirectoryPath);

            // If sub directory does not exist create it:
            if (!subDirectory.exists())
            {
                std::string utf8Path;
                subDirectoryStr.asUtf8(utf8Path);
                rc = ::mkdir(utf8Path.c_str(), directoryPremissions);
            }

            // Move the slash Position after the slash:
            if (slashPosition != -1)
            {
                slashPosition++;
            }
        }

        if (0 == rc)
        {
            retVal = true;
        }
    }

    return retVal;
}

// ---------------------------------------------------------------------------
// Name:        osDirectory::deleteFile
// Description: Deletes a file that is contained in this directory.
// Arguments:   fileName - The contained file name (including extension)
// Return Val:  bool - Success / failure.
// Author:      AMD Developer Tools Team
// Date:        2/11/2006
// ---------------------------------------------------------------------------
bool osDirectory::deleteFile(const gtString& fileName)
{
    bool retVal = false;

    // Get the full path of the file:
    gtString filePath = _directoryPath.asString();
    filePath += osFilePath::osPathSeparator;
    filePath += fileName;

    std::string utf8Path;
    filePath.asUtf8(utf8Path);

    int rc = ::unlink(utf8Path.c_str());

    if (rc == 0)
    {
        retVal = true;
    }

    return retVal;
}

// ---------------------------------------------------------------------------
// Name:        osDirectory::deleteRecursively
// Description: Deletes this directory, its sub directories and contained files
//              (recurse into sub directories)
// Return Val:  bool - Success / failure.
// Author:      AMD Developer Tools Team
// Date:        2/11/2006
// ---------------------------------------------------------------------------
bool osDirectory::deleteRecursively()
{
    bool retVal = true;

    // Step A - Get this directory contained files and sub directories:
    // ---------------------------------------------------------------

    // Get the sub-directories paths:
    gtList<osFilePath> subDirectoriesPaths;
    bool rc1 = getSubDirectoriesPaths(SORT_BY_NAME_ASCENDING, subDirectoriesPaths);

    // Get the contained files paths:
    gtList<osFilePath> containedFilesPaths;
    bool rc2 = getContainedFilePaths(OS_ALL_CONTAINED_FILES_SEARCH_STR, containedFilesPaths);

    if (!rc1 || !rc2)
    {
        retVal = false;
    }

    // Step B - delete contained files:
    // -------------------------------
    gtList<osFilePath>::const_iterator iter = containedFilesPaths.begin();
    gtList<osFilePath>::const_iterator endIter = containedFilesPaths.end();

    while (iter != endIter)
    {
        const osFilePath& currFilePath = *iter;
        osFile currFile(currFilePath);
        bool rc3 = currFile.deleteFile();

        if (rc3 == false)
        {
            GT_ASSERT(false);
            retVal = false;
        }

        ++iter;
    }

    // Step C - delete contained sub directories recursively:
    // -----------------------------------------------------
    iter = subDirectoriesPaths.begin();
    endIter = subDirectoriesPaths.end();

    while (iter != endIter)
    {
        const osFilePath currentSubDirPath = (*iter);
        osDirectory currentSubDir(currentSubDirPath);
        bool rc4 = currentSubDir.deleteRecursively();

        if (!rc4)
        {
            GT_ASSERT(false);
            retVal = false;
        }

        ++iter;
    }

    // Step D - delete this directory:
    // -------------------------------
    std::string utf8Path;
    _directoryPath.asString().asUtf8(utf8Path);

    int rc5 = ::rmdir(utf8Path.c_str());

    if (rc5 != 0)
    {
        GT_ASSERT(rc5 == 0);
        retVal = false;
    }

    return retVal;
}

// ---------------------------------------------------------------------------
// Name:        osDirectory::getSubDirectoriesPaths
// Description: Returns a list of the paths of this directory child directories.
//              (Direct children directories only - non recursive)
// Arguments:
//   sortMethod - The order in which the output sub directory paths will be sorted.
//   subDirectoriesPaths - The output sub directories path list.
// Return Val:  bool - Success / failure.
// Author:      AMD Developer Tools Team
// Date:        15/5/2004
// ---------------------------------------------------------------------------
bool osDirectory::getSubDirectoriesPaths(SortMethod sortMethod,
                                         gtList<osFilePath>& subDirectoriesPaths) const
{
    bool retVal = false;

    // Make the output list empty:
    subDirectoriesPaths.clear();

    // Open the input directory:
    std::string utf8DirectoryPath;
    _directoryPath.asString().asUtf8(utf8DirectoryPath);
    DIR* pDirectoryStream = ::opendir(utf8DirectoryPath.c_str());
    GT_IF_WITH_ASSERT(pDirectoryStream != NULL)
    {
        retVal = true;

        // Iterate the directory files:
        struct dirent* pCurrDirFile = ::readdir(pDirectoryStream);

        while (pCurrDirFile != NULL)
        {
            // Get the current file name:
            gtString currFileName;
            currFileName.fromUtf8String(pCurrDirFile->d_name);

            // Ignore this directory, the "." and ".." directories:
            if ((!currFileName.isEmpty() && (currFileName != L".") && (currFileName != L"..")))
            {
                // Build the current file full path:
                gtString currFilePathAsStr = _directoryPath.asString();
                currFilePathAsStr += osFilePath::osPathSeparator;
                currFilePathAsStr += currFileName;
                osFilePath currFilePath = currFilePathAsStr;

                // If the current file is a directory:
                if (currFilePath.isDirectory())
                {
                    // Add the current file to the output files list:
                    subDirectoriesPaths.push_back(currFilePath);
                }
            }

            // Next directory file:
            pCurrDirFile = ::readdir(pDirectoryStream);
        }

        // Close the directory:
        int rc1 = ::closedir(pDirectoryStream);
        GT_ASSERT(rc1 == 0);
    }

    // Apply the sorting:
    sortFilePathsListFromAscendingNameOrder(subDirectoriesPaths, sortMethod);

    return retVal;
}

// ---------------------------------------------------------------------------
// Name:        osDirectory::getContainedFilePaths
// Description: Returns a list of paths of the files that are contained in this directory.
//              (Direct children directories only - non recursive).
//              On NTFS - the files are returned in alphabetic order.
// Arguments:
//   fileNameSearchString - A search string for the file name.
//                          The search string can contain wildcard characters (* and ?).
//                          Example: "*.txt".
//   filePaths - The output file paths list.
//   clearOutVal - true if we clear filePaths before filling it up
// Return Val:  bool - Success / failure.
// Author:      AMD Developer Tools Team
// Date:        15/5/2004
// ---------------------------------------------------------------------------
bool osDirectory::getContainedFilePaths(const gtString& fileNameSearchString,
                                        gtList<osFilePath>& filePaths, bool clearOutVal/* = true*/) const
{
    bool retVal = false;

    // Make the output list empty:
    if (clearOutVal)
    {
        filePaths.clear();
    }

    // Open the input directory:
    std::string utf8DirectoryPath;
    _directoryPath.asString().asUtf8(utf8DirectoryPath);
    DIR* pDirectoryStream = ::opendir(utf8DirectoryPath.c_str());
    GT_IF_WITH_ASSERT(pDirectoryStream != NULL)
    {
        retVal = true;

        // Iterate the directory files:
        struct dirent* pCurrDirFile = ::readdir(pDirectoryStream);

        while (pCurrDirFile != NULL)
        {
            // Get the current file name:
            gtString currFileName;
            currFileName.fromUtf8String(pCurrDirFile->d_name);

            // Ignore this directory, the "." and ".." directories:
            if ((!currFileName.isEmpty() && (currFileName != L".") && (currFileName != L"..")))
            {
                // Build the current file full path:
                gtString currFilePathAsStr = _directoryPath.asString();
                currFilePathAsStr += osFilePath::osPathSeparator;
                currFilePathAsStr += currFileName;
                osFilePath currFilePath = currFilePathAsStr;

                // If the current file is a regular file:
                if (currFilePath.isRegularFile())
                {
                    // If the current file match the input search string:
                    std::string utf8fileNameSearchString, utf8currFileName;
                    fileNameSearchString.asUtf8(utf8fileNameSearchString);
                    currFileName.asUtf8(utf8currFileName);
                    int rc1 = ::fnmatch(utf8fileNameSearchString.c_str(), utf8currFileName.c_str(), 0);

                    if (rc1 == 0)
                    {
                        // Add the current file to the output files list:
                        filePaths.push_back(currFilePath);
                    }
                }
            }

            // Next directory file:
            pCurrDirFile = ::readdir(pDirectoryStream);
        }

        // Close the directory:
        int rc2 = ::closedir(pDirectoryStream);
        GT_ASSERT(rc2 == 0);
    }

    return retVal;
}

// ---------------------------------------------------------------------------
// Name:        osDirectory::rename
// Description: Renames this directory.
// Return Val:  bool - Success / failure.
// Author:      AMD Developer Tools Team
// Date:        4/24/2012
// ---------------------------------------------------------------------------
bool osDirectory::rename(const gtString& newPathName)
{
    bool retVal(true);
    osFilePath newDirectoryPath;

    // if newName is empty
    retVal = !newPathName.isEmpty();

    //Check to see if the new directory exists
    if (retVal)
    {
        newDirectoryPath.setFileDirectory(newPathName);
        retVal = !newDirectoryPath.exists();
    }

    if (retVal)
    {
        std::string utf8OldPath, utf8NewPath;
        _directoryPath.fileDirectoryAsString().asUtf8(utf8OldPath);
        newDirectoryPath.fileDirectoryAsString().asUtf8(utf8NewPath);

        retVal = (0 == ::rename(utf8OldPath.c_str(), utf8NewPath.c_str()));

        if (retVal)
        {
            _directoryPath = newDirectoryPath;
        }
    }

    return retVal;
}


text:
<!-- Needs Manual Review -->

# Pasta With Corn Zucchini And Tomatoes

> Based on [https://cooking.nytimes.com/recipes/11305-pasta-with-corn-zucchini-and-tomatoes](https://cooking.nytimes.com/recipes/11305-pasta-with-corn-zucchini-and-tomatoes)

<!-- {cts} rating=3; (User can specify rating on scale of 1-5) -->

Personal rating: :fontawesome-solid-star: :fontawesome-solid-star: :fontawesome-solid-star: :fontawesome-solid-star: :fontawesome-solid-star: :fontawesome-solid-star: :fontawesome-regular-star: :fontawesome-regular-star:

<!-- {cte} -->

<!-- {cts} name_image=pasta_with_corn_zucchini_and_tomatoes.jpeg; (User can specify image name) -->

![pasta_with_corn_zucchini_and_tomatoes.jpeg](./pasta_with_corn_zucchini_and_tomatoes.jpeg){: .image-recipe loading=lazy }

<!-- {cte} -->

## Ingredients

* [ ] Salt and pepper
* [ ] 3 tbsp extra virgin olive oil
* [ ] 1 cup corn kernels (from 2-3 ears) or 1 can
* [ ] 1 cup diced zucchini or summer squash (from 2 or 3 small vegetables)
* [ ] 1 medium onion or 3-4 shallots, diced
* [ ] (optional) 1⁄4 tsp minced garlic
* [ ] 1-2 sprigs tarragon
* [ ] 4 plum or 2 large tomatoes, diced
* [ ] 1 pound cut pasta, like Farfalle or penne

## Recipe

* Set a large pot of water to boil. Put 2 tbsp oil in a large skillet over medium-high heat and add corn. Cook, stirring occasionally, until corn begins to brown
* Add zucchini and some salt and pepper. Cook, stirring occasionally, until zucchini begins to brown
* Add onion or shallots and garlic if you are using it. Cook, stirring occasionally, until onion softens (about 5 min)
* Add tarragon and cook for 30 sec, then tomatoes
* Cook pasta according to directions with shortest cook time
* While pasta cooks continue to cook sauce, reducing heat when tomatoes begin to break down. If sauce dries out (with plum tomatoes, this is likely), add some pasta cooking water, about 1/2 cup at a time
* When pasta is done, drain it, toss with sauce and remaining oil or butter, and serve immediately


text:
/* eslint-disable no-unused-vars */

import postcss from 'postcss'
import mkdirp from 'mkdirp'
import path from 'path'
import fs from 'fs'

import nesting from 'postcss-nesting'

const getRootAtRule = atRule => {
  return (atRule.parent && atRule.parent.type === 'atrule') ? getRootAtRule(atRule.parent) : atRule
}

const hasAtRuleInside = (rule, atRuleName) => {
  let hasAtRule = false
  rule.walkAtRules(atRuleName, () => {
    hasAtRule = true
  })
  return hasAtRule
}

export default postcss.plugin('postcss-extract', (options = {}) => {
  const instance = postcss()

  // atRules = Object where key is atRule and value is path where save file
  const atRules = options.extract

  // do nothing if no extract
  if (!atRules) return instance

  // bubble atRules
  instance.use(nesting({ bubble: Object.keys(atRules) }))

  const plugin = (css, result) => {
    return new Promise((resolve, reject) => {
      Object.keys(atRules).forEach(atRuleToExract => {
        const extracted = postcss.root()
        css.walkAtRules(atRuleToExract, rule => {
          extracted.append(getRootAtRule(rule))
          rule.remove()
        })

        // clean all rules except rules inside at-rule to extract
        extracted.walkRules(rule => {
          if (rule.parent.name === atRuleToExract) return
          rule.remove()
        })

        extracted.walkAtRules(rule => {
          if (rule.name === atRuleToExract) {
            // remove at-rule to extract wrapper
            rule.replaceWith(rule.nodes)
            return
          }
          if (!hasAtRuleInside(rule, atRuleToExract)) {
            // remove at-rules without at-rule to extract
            rule.remove()
          }
        })

        const pathToDistFile = atRules[atRuleToExract]
        mkdirp(path.parse(pathToDistFile).dir, err => {
          if (err) {
            reject(err)
            return
          }
          fs.writeFile(pathToDistFile, extracted.toResult().css, error => {
            if (error) {
              reject(error)
            }
            resolve()
          })
        })
      })
    })
  }

  return instance.use(plugin)
})


text:
class Browser;

// An interface implemented by an object that can retrieve information about
// the monitors on the system.
class MonitorInfoProvider {
 public:
  virtual ~MonitorInfoProvider() {}

  // Returns the bounds of the work area of the primary monitor.
  virtual gfx::Rect GetPrimaryMonitorWorkArea() const = 0;

  // Returns the bounds of the primary monitor.
  virtual gfx::Rect GetPrimaryMonitorBounds() const = 0;

  // Returns the bounds of the work area of the monitor that most closely
  // intersects the provided bounds.
  virtual gfx::Rect GetMonitorWorkAreaMatching(
      const gfx::Rect& match_rect) const = 0;
};

///////////////////////////////////////////////////////////////////////////////
// WindowSizer
//
//  A class that determines the best new size and position for a window to be
//  shown at based several factors, including the position and size of the last
//  window of the same type, the last saved bounds of the window from the
//  previous session, and default system metrics if neither of the above two
//  conditions exist. The system has built-in providers for monitor metrics
//  and persistent storage (using preferences) but can be overrided with mocks
//  for testing.
//
class WindowSizer {
 public:
  class StateProvider;

  // WindowSizer owns |state_provider| and will create a default
  // MonitorInfoProvider using the physical screen.
  explicit WindowSizer(StateProvider* state_provider);

  // WindowSizer owns |state_provider| and |monitor_info_provider|.
  // It will use the supplied monitor info provider. Used only for testing.
  WindowSizer(StateProvider* state_provider,
              MonitorInfoProvider* monitor_info_provider);

  virtual ~WindowSizer();

  // An interface implemented by an object that can retrieve state from either a
  // persistent store or an existing window.
  class StateProvider {
   public:
    virtual ~StateProvider() {}

    // Retrieve the persisted bounds of the window. Returns true if there was
    // persisted data to retrieve state information, false otherwise.
    virtual bool GetPersistentState(gfx::Rect* bounds,
                                    gfx::Rect* work_area) const = 0;

    // Retrieve the bounds of the most recent window of the matching type.
    // Returns true if there was a last active window to retrieve state
    // information from, false otherwise.
    virtual bool GetLastActiveWindowState(gfx::Rect* bounds) const = 0;
  };

  // Determines the position and size for a window as it is created. This
  // function uses several strategies to figure out optimal size and placement,
  // first looking for an existing active window, then falling back to persisted
  // data from a previous session, finally utilizing a default
  // algorithm. If |specified_bounds| are non-empty, this value is returned
  // instead. For use only in testing.
  void DetermineWindowBounds(const gfx::Rect& specified_bounds,
                             gfx::Rect* bounds) const;

  // Determines the size, position and maximized state for the browser window.
  // See documentation for DetermineWindowBounds above. Normally,
  // |window_bounds| is calculated by calling GetLastActiveWindowState(). To
  // explicitly specify a particular window to base the bounds on, pass in a
  // non-NULL value for |browser|.
  static void GetBrowserWindowBounds(const std::string& app_name,
                                     const gfx::Rect& specified_bounds,
                                     const Browser* browser,
                                     gfx::Rect* window_bounds);

  // Returns the default origin for popups of the given size.
  static gfx::Point GetDefaultPopupOrigin(const gfx::Size& size);

  // How much horizontal and vertical offset there is between newly
  // opened windows.  This value may be different on each platform.
  static const int kWindowTilePixels;

 private:
  // The edge of the screen to check for out-of-bounds.
  enum Edge { TOP, LEFT, BOTTOM, RIGHT };

  // Gets the size and placement of the last window. Returns true if this data
  // is valid, false if there is no last window and the application should
  // restore saved state from preferences using RestoreWindowPosition.
  bool GetLastWindowBounds(gfx::Rect* bounds) const;

  // Gets the size and placement of the last window in the last session, saved
  // in local state preferences. Returns true if local state exists containing
  // this information, false if this information does not exist and a default
  // size should be used.
  bool GetSavedWindowBounds(gfx::Rect* bounds) const;

  // Gets the default window position and size if there is no last window and
  // no saved window placement in prefs. This function determines the default
  // size based on monitor size, etc.
  void GetDefaultWindowBounds(gfx::Rect* default_bounds) const;

  // Adjusts |bounds| to be visible onscreen, biased toward the work area of the
  // monitor containing |other_bounds|.  Despite the name, this doesn't
  // guarantee the bounds are fully contained within this monitor's work rect;
  // it just tried to ensure the edges are visible on _some_ work rect.
  // If |saved_work_area| is non-empty, it is used to determine whether the
  // monitor cofiguration has changed. If it has, bounds are repositioned and
  // resized if necessary to make them completely contained in the current work
  // area.
  void AdjustBoundsToBeVisibleOnMonitorContaining(
      const gfx::Rect& other_bounds,
      const gfx::Rect& saved_work_area,
      gfx::Rect* bounds) const;

  // Providers for persistent storage and monitor metrics.
  scoped_ptr<StateProvider> state_provider_;
  scoped_ptr<MonitorInfoProvider> monitor_info_provider_;

  DISALLOW_COPY_AND_ASSIGN(WindowSizer);
};

#endif  // CHROME_BROWSER_UI_WINDOW_SIZER_H_


text:
<?php
namespace Application\Form;

use DoctrineModule\Persistence\ObjectManagerAwareInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Zend\Form\Form;

class PostForm extends Form implements ObjectManagerAwareInterface
{
    protected $objectManager;

    public function __construct(ObjectManager $objectManager)
    {
        $this->setObjectManager($objectManager);
        // On ne veut pas tenir compte du parametre $name,
        // On va le surcharger via le contructeur du parent
        parent::__construct('Post');

        $this->add(array(
            'name' => 'post_id',
            'type' => 'Hidden',
        ));

        $this->add(array(
            'name' => 'title',
            'type' => 'text',
            'options' => array(
                'label' => 'Titre',
            ),
        ));

        $this->add(array(
            'name' => 'content',
            'type' => 'textarea',
            'options' => array(
                'label' => 'Contenue',
            ),
        ));

        $this->add(array(
            'name' => 'author',
            'type' => 'text',
            'options' => array(
                'label' => 'Auteur',
            ),
        ));

        $this->add(array(
            'name' => 'path_picture',
            'type' => 'text',
            'options' => array(
                'label' => 'Url de l\'image',
            ),
        ));

        $this->add(array(
            'type' => 'DoctrineModule\Form\Element\ObjectSelect',
            'name' => 'category_id',
            'options' => array(
                'label' => 'Categorie',
                'object_manager' => $this->getObjectManager(),
                'target_class'   => 'Application\Entity\Category',
                'property'       => 'name',
                'empty_option' => 'Selectionner un catégorie',
            )
        ));

        $this->add(array(
            'type' => 'DoctrineModule\Form\Element\ObjectMultiCheckbox',
            'name' => 'tags',
            'options' => array(
                'label' => 'Tags',
                'object_manager' => $this->getObjectManager(),
                'target_class'   => 'Application\Entity\Tag',
                'property'       => 'name',
                'attributes' => array(
                    'id' => 'tag_name',
                ),
            )
        ));

        // Le bouton Submit
        $this->add(array(
            'name' => 'submit',        // Nom du champ
            'type' => 'Submit',        // Type du champ
            'attributes' => array(     // On va définir quelques attributs
                'value' => 'Ajouter',  // comme la valeur
                'id' => 'submit',      // et l'id
            ),
        ));
    }

    /**
     * Set the object manager
     *
     * @param ObjectManager $objectManager
     * @return $this
     */
    public function setObjectManager(ObjectManager $objectManager) {
        $this->objectManager = $objectManager;
        return $this;
    }

    /**
     * Get the object manager
     *
     * @return ObjectManager
     */
    public function getObjectManager() {
        return $this->objectManager;
    }
}


text:
using namespace std;
using namespace cv;
using namespace perf;
using namespace testing;
using std::tr1::make_tuple;
using std::tr1::get;

typedef std::tr1::tuple<string, Point, int, int, int, int> Size_Source_Fl_t;
typedef perf::TestBaseWithParam<Size_Source_Fl_t> Size_Source_Fl;

PERF_TEST_P(Size_Source_Fl, floodFill1, Combine(
    testing::Values("cv/shared/fruits.png", "cv/optflow/RubberWhale1.png"), //images
            testing::Values(Point(120, 82), Point(200, 140)), //seed points
            testing::Values(4,8), //connectivity
            testing::Values((int)IMREAD_COLOR, (int)IMREAD_GRAYSCALE), //color image, or not
            testing::Values(0, 1, 2), //use fixed(1), gradient (2) or simple(0) mode
            testing::Values((int)CV_8U, (int)CV_32F, (int)CV_32S) //image depth
            ))
{
    //test given image(s)
    string filename = getDataPath(get<0>(GetParam()));
    Point pseed;
    pseed = get<1>(GetParam());

    int connectivity = get<2>(GetParam());
    int colorType = get<3>(GetParam());
    int modeType = get<4>(GetParam());
    int imdepth = get<5>(GetParam());

    Mat image0 = imread(filename, colorType);

    Scalar newval, loVal, upVal;
    if (modeType == 0)
    {
        loVal = Scalar(0, 0, 0);
        upVal = Scalar(0, 0, 0);
    }
    else
    {
        loVal = Scalar(4, 4, 4);
        upVal = Scalar(20, 20, 20);
    }
    int newMaskVal = 255;  //base mask for floodfill type
    int flags = connectivity + (newMaskVal << 8) + (modeType == 1 ? FLOODFILL_FIXED_RANGE : 0);

    int b = 152;//(unsigned)theRNG() & 255;
    int g = 136;//(unsigned)theRNG() & 255;
    int r = 53;//(unsigned)theRNG() & 255;
    newval = (colorType == IMREAD_COLOR) ? Scalar(b, g, r) : Scalar(r*0.299 + g*0.587 + b*0.114);

    Rect outputRect = Rect();
    Mat source = Mat();

    for (;  next(); )
    {
        image0.convertTo(source, imdepth);
        startTimer();
        cv::floodFill(source, pseed, newval, &outputRect, loVal, upVal, flags);
        stopTimer();
    }
    EXPECT_EQ(image0.cols, source.cols);
    EXPECT_EQ(image0.rows, source.rows);
    SANITY_CHECK_NOTHING();
}


text:
package com.groupdocs.comparison.examples.advanced_usage.generate_page_previews;

import com.groupdocs.comparison.Comparer;
import com.groupdocs.comparison.common.delegates.Delegates;
import com.groupdocs.comparison.examples.SampleFiles;
import com.groupdocs.comparison.examples.Utils;
import com.groupdocs.comparison.options.PreviewOptions;
import com.groupdocs.comparison.options.enums.PreviewFormats;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.OutputStream;

/**
 * This example demonstrates how to get document previews
 */
public class GetPagePreviewsForSourceDocument {
    public static void run() {
        try (Comparer comparer = new Comparer(SampleFiles.SOURCE_WORD)) {

            {
                // Note: It is the same with commented code below
                comparer.getSource().generatePreview(new PreviewOptions.Builder(
                        new Delegates.CreatePageStream() {
                            @Override
                            public OutputStream invoke(int pageNumber) {
                                String pagePath = Utils.OUTPUT_PATH + "/result-GetPagePreviewsForSourceDocument_" + pageNumber + ".png";
                                try {
                                    return new FileOutputStream(pagePath);
                                } catch (FileNotFoundException e) {
                                    e.printStackTrace();
                                    throw new RuntimeException(e);
                                }
                            }
                        })
                        .setPreviewFormat(PreviewFormats.PNG)
                        .setPageNumbers(new int[]{1, 2})
                        .build());

                // Note: It is the same with the code above
//                PreviewOptions previewOptions = new PreviewOptions(new Delegates.CreatePageStream() {
//                    @Override
//                    public OutputStream invoke(int pageNumber) {
//                        String pagePath = Utils.SAMPLES_PATH + "/result-GetPagePreviewsForSourceDocument_" + pageNumber + ".png";
//                        try {
//                            return new FileOutputStream(pagePath);
//                        } catch (FileNotFoundException e) {
//                            e.printStackTrace();
//                            throw new RuntimeException(e);
//                        }
//                    }
//                });
//                previewOptions.setPreviewFormat(PreviewFormats.PNG);
//                previewOptions.setPageNumbers(new int[]{1, 2});
//                comparer.getSource().generatePreview(previewOptions);
            }
        }
          System.out.println("\nDocument previews generated successfully.\nCheck output in " + Utils.OUTPUT_PATH + ".");
    }
}


text:
//
//  WMTableViewController.h
//  百思不得姐
//
//  Created by 王蒙 on 15/7/27.
//  Copyright (c) 2015年 wm. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface WMWordController : UITableViewController
/**枚举*/
@property (nonatomic,assign) EssenceType essenceType;
@end


text:
using System.Collections.Generic;
using SCNDISC.Server.Domain.Aggregates.Partners;
using SCNDISC.Server.Core.Models.Partner;

namespace SCNDISC.Server.Core.Mapper
{
    public abstract class WebAddressMapper
    {
        public static IEnumerable<WebAddressModel> MapToWebAddressModels(IEnumerable<WebAddress> webAddresses)
        {
            List<WebAddressModel> webAddressModels = new List<WebAddressModel>();
            foreach (var web in webAddresses)
            {
                var webAdr = FromWebAddressToWebAddressModel(web);
                webAddressModels.Add(webAdr);
            }

            return webAddressModels;
        }

        public static IEnumerable<WebAddress> MapToWebAddresses(IEnumerable<WebAddressModel> webAddressModels)
        {
            List<WebAddress> webAddresses = new List<WebAddress>();
            foreach (var web in webAddressModels)
            {
                var webAdr = FromWebAddressModelToWebAddress(web);
                webAddresses.Add(webAdr);
            }

            return webAddresses;
        }

        private static WebAddressModel FromWebAddressToWebAddressModel(WebAddress webAddress)
        {
            WebAddressModel webAddressModel = new WebAddressModel();
            webAddressModel.Id = webAddress.Id;
            webAddressModel.SocialNetwork = webAddress.Category;
            webAddressModel.URL = webAddress.Url;
            return webAddressModel;
        }

        private static WebAddress FromWebAddressModelToWebAddress(WebAddressModel webAddressModel)
        {
            WebAddress webAddress = new WebAddress();
            webAddress.Id = webAddressModel.Id;
            webAddress.Category = webAddressModel.SocialNetwork;
            webAddress.Url = webAddressModel.URL;
            return webAddress;
        }

    }
}