text:
    sock_define_const("SOCK_STREAM", SOCK_STREAM);
#endif

#ifdef SOCK_DGRAM
    sock_define_const("SOCK_DGRAM", SOCK_DGRAM);
#endif

#ifdef SOCK_RAW
    sock_define_const("SOCK_RAW", SOCK_RAW);
#endif

#ifdef SOCK_RDM
    sock_define_const("SOCK_RDM", SOCK_RDM);
#endif

#ifdef SOCK_SEQPACKET
    sock_define_const("SOCK_SEQPACKET", SOCK_SEQPACKET);
#endif

#ifdef SOCK_PACKET
    sock_define_const("SOCK_PACKET", SOCK_PACKET);
#endif

#ifdef AF_INET
    sock_define_const("AF_INET", AF_INET);
#endif

#ifdef PF_INET
    sock_define_const("PF_INET", PF_INET);
#endif

#ifdef AF_UNIX
    sock_define_const("AF_UNIX", AF_UNIX);
#endif

#ifdef PF_UNIX
    sock_define_const("PF_UNIX", PF_UNIX);
#endif

#ifdef AF_AX25
    sock_define_const("AF_AX25", AF_AX25);
#endif

#ifdef PF_AX25
    sock_define_const("PF_AX25", PF_AX25);
#endif

#ifdef AF_IPX
    sock_define_const("AF_IPX", AF_IPX);
#endif

#ifdef PF_IPX
    sock_define_const("PF_IPX", PF_IPX);
#endif

#ifdef AF_APPLETALK
    sock_define_const("AF_APPLETALK", AF_APPLETALK);
#endif

#ifdef PF_APPLETALK
    sock_define_const("PF_APPLETALK", PF_APPLETALK);
#endif

#ifdef AF_UNSPEC
    sock_define_const("AF_UNSPEC", AF_UNSPEC);
#endif

#ifdef PF_UNSPEC
    sock_define_const("PF_UNSPEC", PF_UNSPEC);
#endif

#ifdef AF_LOCAL
    sock_define_const("AF_LOCAL", AF_LOCAL);
#endif

#ifdef PF_LOCAL
    sock_define_const("PF_LOCAL", PF_LOCAL);
#endif

#ifdef AF_IMPLINK
    sock_define_const("AF_IMPLINK", AF_IMPLINK);
#endif

#ifdef PF_IMPLINK
    sock_define_const("PF_IMPLINK", PF_IMPLINK);
#endif

#ifdef AF_PUP
    sock_define_const("AF_PUP", AF_PUP);
#endif

#ifdef PF_PUP
    sock_define_const("PF_PUP", PF_PUP);
#endif

#ifdef AF_CHAOS
    sock_define_const("AF_CHAOS", AF_CHAOS);
#endif

#ifdef PF_CHAOS
    sock_define_const("PF_CHAOS", PF_CHAOS);
#endif

#ifdef AF_NS
    sock_define_const("AF_NS", AF_NS);
#endif

#ifdef PF_NS
    sock_define_const("PF_NS", PF_NS);
#endif

#ifdef AF_ISO
    sock_define_const("AF_ISO", AF_ISO);
#endif

#ifdef PF_ISO
    sock_define_const("PF_ISO", PF_ISO);
#endif

#ifdef AF_OSI
    sock_define_const("AF_OSI", AF_OSI);
#endif

#ifdef PF_OSI
    sock_define_const("PF_OSI", PF_OSI);
#endif

#ifdef AF_ECMA
    sock_define_const("AF_ECMA", AF_ECMA);
#endif

#ifdef PF_ECMA
    sock_define_const("PF_ECMA", PF_ECMA);
#endif

#ifdef AF_DATAKIT
    sock_define_const("AF_DATAKIT", AF_DATAKIT);
#endif

#ifdef PF_DATAKIT
    sock_define_const("PF_DATAKIT", PF_DATAKIT);
#endif

#ifdef AF_CCITT
    sock_define_const("AF_CCITT", AF_CCITT);
#endif

#ifdef PF_CCITT
    sock_define_const("PF_CCITT", PF_CCITT);
#endif

#ifdef AF_SNA
    sock_define_const("AF_SNA", AF_SNA);
#endif

#ifdef PF_SNA
    sock_define_const("PF_SNA", PF_SNA);
#endif

#ifdef AF_DEC
    sock_define_const("AF_DEC", AF_DEC);
#endif

#ifdef PF_DEC
    sock_define_const("PF_DEC", PF_DEC);
#endif

#ifdef AF_DLI
    sock_define_const("AF_DLI", AF_DLI);
#endif

#ifdef PF_DLI
    sock_define_const("PF_DLI", PF_DLI);
#endif

#ifdef AF_LAT
    sock_define_const("AF_LAT", AF_LAT);
#endif

#ifdef PF_LAT
    sock_define_const("PF_LAT", PF_LAT);
#endif

#ifdef AF_HYLINK
    sock_define_const("AF_HYLINK", AF_HYLINK);
#endif

#ifdef PF_HYLINK
    sock_define_const("PF_HYLINK", PF_HYLINK);
#endif

#ifdef AF_ROUTE
    sock_define_const("AF_ROUTE", AF_ROUTE);
#endif

#ifdef PF_ROUTE
    sock_define_const("PF_ROUTE", PF_ROUTE);
#endif

#ifdef AF_LINK
    sock_define_const("AF_LINK", AF_LINK);
#endif

#ifdef PF_LINK
    sock_define_const("PF_LINK", PF_LINK);
#endif

#ifdef AF_COIP
    sock_define_const("AF_COIP", AF_COIP);
#endif

#ifdef PF_COIP
    sock_define_const("PF_COIP", PF_COIP);
#endif

#ifdef AF_CNT
    sock_define_const("AF_CNT", AF_CNT);
#endif

#ifdef PF_CNT
    sock_define_const("PF_CNT", PF_CNT);
#endif

#ifdef AF_SIP
    sock_define_const("AF_SIP", AF_SIP);
#endif

#ifdef PF_SIP
    sock_define_const("PF_SIP", PF_SIP);
#endif

#ifdef AF_NDRV
    sock_define_const("AF_NDRV", AF_NDRV);
#endif

#ifdef PF_NDRV
    sock_define_const("PF_NDRV", PF_NDRV);
#endif

#ifdef AF_ISDN
    sock_define_const("AF_ISDN", AF_ISDN);
#endif

#ifdef PF_ISDN
    sock_define_const("PF_ISDN", PF_ISDN);
#endif

#ifdef AF_NATM
    sock_define_const("AF_NATM", AF_NATM);
#endif

#ifdef PF_NATM
    sock_define_const("PF_NATM", PF_NATM);
#endif

#ifdef AF_SYSTEM
    sock_define_const("AF_SYSTEM", AF_SYSTEM);
#endif

#ifdef PF_SYSTEM
    sock_define_const("PF_SYSTEM", PF_SYSTEM);
#endif

#ifdef AF_NETBIOS
    sock_define_const("AF_NETBIOS", AF_NETBIOS);
#endif

#ifdef PF_NETBIOS
    sock_define_const("PF_NETBIOS", PF_NETBIOS);
#endif

#ifdef AF_PPP
    sock_define_const("AF_PPP", AF_PPP);
#endif

#ifdef PF_PPP
    sock_define_const("PF_PPP", PF_PPP);
#endif

#ifdef AF_ATM
    sock_define_const("AF_ATM", AF_ATM);
#endif

#ifdef PF_ATM
    sock_define_const("PF_ATM", PF_ATM);
#endif

#ifdef AF_NETGRAPH
    sock_define_const("AF_NETGRAPH", AF_NETGRAPH);
#endif

#ifdef PF_NETGRAPH
    sock_define_const("PF_NETGRAPH", PF_NETGRAPH);
#endif

#ifdef AF_MAX
    sock_define_const("AF_MAX", AF_MAX);
#endif

#ifdef PF_MAX
    sock_define_const("PF_MAX", PF_MAX);
#endif

#ifdef AF_E164
    sock_define_const("AF_E164", AF_E164);
#endif

#ifdef PF_XTP
    sock_define_const("PF_XTP", PF_XTP);
#endif

#ifdef PF_RTIP
    sock_define_const("PF_RTIP", PF_RTIP);
#endif

#ifdef PF_PIP
    sock_define_const("PF_PIP", PF_PIP);
#endif

#ifdef PF_KEY
    sock_define_const("PF_KEY", PF_KEY);
#endif

#ifdef MSG_OOB
    sock_define_const("MSG_OOB", MSG_OOB);
#endif

#ifdef MSG_PEEK
    sock_define_const("MSG_PEEK", MSG_PEEK);
#endif

#ifdef MSG_DONTROUTE
    sock_define_const("MSG_DONTROUTE", MSG_DONTROUTE);
#endif

#ifdef MSG_EOR
    sock_define_const("MSG_EOR", MSG_EOR);
#endif

#ifdef MSG_TRUNC
    sock_define_const("MSG_TRUNC", MSG_TRUNC);
#endif

#ifdef MSG_CTRUNC
    sock_define_const("MSG_CTRUNC", MSG_CTRUNC);
#endif

#ifdef MSG_WAITALL
    sock_define_const("MSG_WAITALL", MSG_WAITALL);
#endif

#ifdef MSG_DONTWAIT
    sock_define_const("MSG_DONTWAIT", MSG_DONTWAIT);
#endif

#ifdef MSG_EOF
    sock_define_const("MSG_EOF", MSG_EOF);
#endif

#ifdef MSG_FLUSH
    sock_define_const("MSG_FLUSH", MSG_FLUSH);
#endif

#ifdef MSG_HOLD
    sock_define_const("MSG_HOLD", MSG_HOLD);
#endif

#ifdef MSG_SEND
    sock_define_const("MSG_SEND", MSG_SEND);
#endif

#ifdef MSG_HAVEMORE
    sock_define_const("MSG_HAVEMORE", MSG_HAVEMORE);
#endif

#ifdef MSG_RCVMORE
    sock_define_const("MSG_RCVMORE", MSG_RCVMORE);
#endif

#ifdef MSG_COMPAT
    sock_define_const("MSG_COMPAT", MSG_COMPAT);
#endif

#ifdef SOL_SOCKET
    sock_define_const("SOL_SOCKET", SOL_SOCKET);
#endif

#ifdef SOL_IP
    sock_define_const("SOL_IP", SOL_IP);
#endif

#ifdef SOL_IPX
    sock_define_const("SOL_IPX", SOL_IPX);
#endif

#ifdef SOL_AX25
    sock_define_const("SOL_AX25", SOL_AX25);
#endif

#ifdef SOL_ATALK
    sock_define_const("SOL_ATALK", SOL_ATALK);
#endif

#ifdef SOL_TCP
    sock_define_const("SOL_TCP", SOL_TCP);
#endif

#ifdef SOL_UDP
    sock_define_const("SOL_UDP", SOL_UDP);
#endif

#ifdef IPPROTO_IP
    sock_define_const("IPPROTO_IP", IPPROTO_IP);
#else
    sock_define_const("IPPROTO_IP", 0);
#endif

#ifdef IPPROTO_ICMP
    sock_define_const("IPPROTO_ICMP", IPPROTO_ICMP);
#else
    sock_define_const("IPPROTO_ICMP", 1);
#endif

#ifdef IPPROTO_IGMP
    sock_define_const("IPPROTO_IGMP", IPPROTO_IGMP);
#endif

#ifdef IPPROTO_GGP
    sock_define_const("IPPROTO_GGP", IPPROTO_GGP);
#endif

#ifdef IPPROTO_TCP
    sock_define_const("IPPROTO_TCP", IPPROTO_TCP);
#else
    sock_define_const("IPPROTO_TCP", 6);
#endif

#ifdef IPPROTO_EGP
    sock_define_const("IPPROTO_EGP", IPPROTO_EGP);
#endif

#ifdef IPPROTO_PUP
    sock_define_const("IPPROTO_PUP", IPPROTO_PUP);
#endif

#ifdef IPPROTO_UDP
    sock_define_const("IPPROTO_UDP", IPPROTO_UDP);
#else
    sock_define_const("IPPROTO_UDP", 17);
#endif

#ifdef IPPROTO_IDP
    sock_define_const("IPPROTO_IDP", IPPROTO_IDP);
#endif

#ifdef IPPROTO_HELLO
    sock_define_const("IPPROTO_HELLO", IPPROTO_HELLO);
#endif

#ifdef IPPROTO_ND
    sock_define_const("IPPROTO_ND", IPPROTO_ND);
#endif

#ifdef IPPROTO_TP
    sock_define_const("IPPROTO_TP", IPPROTO_TP);
#endif

#ifdef IPPROTO_XTP
    sock_define_const("IPPROTO_XTP", IPPROTO_XTP);
#endif

#ifdef IPPROTO_EON
    sock_define_const("IPPROTO_EON", IPPROTO_EON);
#endif

#ifdef IPPROTO_BIP
    sock_define_const("IPPROTO_BIP", IPPROTO_BIP);
#endif

#ifdef IPPROTO_RAW
    sock_define_const("IPPROTO_RAW", IPPROTO_RAW);
#else
    sock_define_const("IPPROTO_RAW", 255);
#endif

#ifdef IPPROTO_MAX
    sock_define_const("IPPROTO_MAX", IPPROTO_MAX);
#endif

#ifdef IPPORT_RESERVED
    sock_define_const("IPPORT_RESERVED", IPPORT_RESERVED);
#else
    sock_define_const("IPPORT_RESERVED", 1024);
#endif

#ifdef IPPORT_USERRESERVED
    sock_define_const("IPPORT_USERRESERVED", IPPORT_USERRESERVED);
#else
    sock_define_const("IPPORT_USERRESERVED", 5000);
#endif

#ifdef INADDR_ANY
    sock_define_const("INADDR_ANY", INADDR_ANY);
#else
    sock_define_const("INADDR_ANY", 0x00000000);
#endif

#ifdef INADDR_BROADCAST
    sock_define_const("INADDR_BROADCAST", INADDR_BROADCAST);
#else
    sock_define_const("INADDR_BROADCAST", 0xffffffff);
#endif

#ifdef INADDR_LOOPBACK
    sock_define_const("INADDR_LOOPBACK", INADDR_LOOPBACK);
#else
    sock_define_const("INADDR_LOOPBACK", 0x7F000001);
#endif

#ifdef INADDR_UNSPEC_GROUP
    sock_define_const("INADDR_UNSPEC_GROUP", INADDR_UNSPEC_GROUP);
#else
    sock_define_const("INADDR_UNSPEC_GROUP", 0xe0000000);
#endif

#ifdef INADDR_ALLHOSTS_GROUP
    sock_define_const("INADDR_ALLHOSTS_GROUP", INADDR_ALLHOSTS_GROUP);
#else
    sock_define_const("INADDR_ALLHOSTS_GROUP", 0xe0000001);
#endif

#ifdef INADDR_MAX_LOCAL_GROUP
    sock_define_const("INADDR_MAX_LOCAL_GROUP", INADDR_MAX_LOCAL_GROUP);
#else
    sock_define_const("INADDR_MAX_LOCAL_GROUP", 0xe00000ff);
#endif

#ifdef INADDR_NONE
    sock_define_const("INADDR_NONE", INADDR_NONE);
#else
    sock_define_const("INADDR_NONE", 0xffffffff);
#endif

#ifdef IP_OPTIONS
    sock_define_const("IP_OPTIONS", IP_OPTIONS);
#endif

#ifdef IP_HDRINCL
    sock_define_const("IP_HDRINCL", IP_HDRINCL);
#endif

#ifdef IP_TOS
    sock_define_const("IP_TOS", IP_TOS);
#endif

#ifdef IP_TTL
    sock_define_const("IP_TTL", IP_TTL);
#endif

#ifdef IP_RECVOPTS
    sock_define_const("IP_RECVOPTS", IP_RECVOPTS);
#endif

#ifdef IP_RECVRETOPTS
    sock_define_const("IP_RECVRETOPTS", IP_RECVRETOPTS);
#endif

#ifdef IP_RECVDSTADDR
    sock_define_const("IP_RECVDSTADDR", IP_RECVDSTADDR);
#endif

#ifdef IP_RETOPTS
    sock_define_const("IP_RETOPTS", IP_RETOPTS);
#endif

#ifdef IP_MULTICAST_IF
    sock_define_const("IP_MULTICAST_IF", IP_MULTICAST_IF);
#endif

#ifdef IP_MULTICAST_TTL
    sock_define_const("IP_MULTICAST_TTL", IP_MULTICAST_TTL);
#endif

#ifdef IP_MULTICAST_LOOP
    sock_define_const("IP_MULTICAST_LOOP", IP_MULTICAST_LOOP);
#endif

#ifdef IP_ADD_MEMBERSHIP
    sock_define_const("IP_ADD_MEMBERSHIP", IP_ADD_MEMBERSHIP);
#endif

#ifdef IP_DROP_MEMBERSHIP
    sock_define_const("IP_DROP_MEMBERSHIP", IP_DROP_MEMBERSHIP);
#endif

#ifdef IP_DEFAULT_MULTICAST_TTL
    sock_define_const("IP_DEFAULT_MULTICAST_TTL", IP_DEFAULT_MULTICAST_TTL);
#endif

#ifdef IP_DEFAULT_MULTICAST_LOOP
    sock_define_const("IP_DEFAULT_MULTICAST_LOOP", IP_DEFAULT_MULTICAST_LOOP);
#endif

#ifdef IP_MAX_MEMBERSHIPS
    sock_define_const("IP_MAX_MEMBERSHIPS", IP_MAX_MEMBERSHIPS);
#endif

#ifdef SO_DEBUG
    sock_define_const("SO_DEBUG", SO_DEBUG);
#endif

#ifdef SO_REUSEADDR
    sock_define_const("SO_REUSEADDR", SO_REUSEADDR);
#endif

#ifdef SO_REUSEPORT
    sock_define_const("SO_REUSEPORT", SO_REUSEPORT);
#endif

#ifdef SO_TYPE
    sock_define_const("SO_TYPE", SO_TYPE);
#endif

#ifdef SO_ERROR
    sock_define_const("SO_ERROR", SO_ERROR);
#endif

#ifdef SO_DONTROUTE
    sock_define_const("SO_DONTROUTE", SO_DONTROUTE);
#endif

#ifdef SO_BROADCAST
    sock_define_const("SO_BROADCAST", SO_BROADCAST);
#endif

#ifdef SO_SNDBUF
    sock_define_const("SO_SNDBUF", SO_SNDBUF);
#endif

#ifdef SO_RCVBUF
    sock_define_const("SO_RCVBUF", SO_RCVBUF);
#endif

#ifdef SO_KEEPALIVE
    sock_define_const("SO_KEEPALIVE", SO_KEEPALIVE);
#endif

#ifdef SO_OOBINLINE
    sock_define_const("SO_OOBINLINE", SO_OOBINLINE);
#endif

#ifdef SO_NO_CHECK
    sock_define_const("SO_NO_CHECK", SO_NO_CHECK);
#endif

#ifdef SO_PRIORITY
    sock_define_const("SO_PRIORITY", SO_PRIORITY);
#endif

#ifdef SO_LINGER
    sock_define_const("SO_LINGER", SO_LINGER);
#endif

#ifdef SO_PASSCRED
    sock_define_const("SO_PASSCRED", SO_PASSCRED);
#endif

#ifdef SO_PEERCRED
    sock_define_const("SO_PEERCRED", SO_PEERCRED);
#endif

#ifdef SO_RCVLOWAT
    sock_define_const("SO_RCVLOWAT", SO_RCVLOWAT);
#endif

#ifdef SO_SNDLOWAT
    sock_define_const("SO_SNDLOWAT", SO_SNDLOWAT);
#endif

#ifdef SO_RCVTIMEO
    sock_define_const("SO_RCVTIMEO", SO_RCVTIMEO);
#endif

#ifdef SO_SNDTIMEO
    sock_define_const("SO_SNDTIMEO", SO_SNDTIMEO);
#endif

#ifdef SO_ACCEPTCONN
    sock_define_const("SO_ACCEPTCONN", SO_ACCEPTCONN);
#endif

#ifdef SO_USELOOPBACK
    sock_define_const("SO_USELOOPBACK", SO_USELOOPBACK);
#endif

#ifdef SO_ACCEPTFILTER
    sock_define_const("SO_ACCEPTFILTER", SO_ACCEPTFILTER);
#endif

#ifdef SO_DONTTRUNC
    sock_define_const("SO_DONTTRUNC", SO_DONTTRUNC);
#endif

#ifdef SO_WANTMORE
    sock_define_const("SO_WANTMORE", SO_WANTMORE);
#endif

#ifdef SO_WANTOOBFLAG
    sock_define_const("SO_WANTOOBFLAG", SO_WANTOOBFLAG);
#endif

#ifdef SO_NREAD
    sock_define_const("SO_NREAD", SO_NREAD);
#endif

#ifdef SO_NKE
    sock_define_const("SO_NKE", SO_NKE);
#endif

#ifdef SO_NOSIGPIPE
    sock_define_const("SO_NOSIGPIPE", SO_NOSIGPIPE);
#endif

#ifdef SO_SECURITY_AUTHENTICATION
    sock_define_const("SO_SECURITY_AUTHENTICATION", SO_SECURITY_AUTHENTICATION);
#endif

#ifdef SO_SECURITY_ENCRYPTION_TRANSPORT
    sock_define_const("SO_SECURITY_ENCRYPTION_TRANSPORT", SO_SECURITY_ENCRYPTION_TRANSPORT);
#endif

#ifdef SO_SECURITY_ENCRYPTION_NETWORK
    sock_define_const("SO_SECURITY_ENCRYPTION_NETWORK", SO_SECURITY_ENCRYPTION_NETWORK);
#endif

#ifdef SO_BINDTODEVICE
    sock_define_const("SO_BINDTODEVICE", SO_BINDTODEVICE);
#endif

#ifdef SO_ATTACH_FILTER
    sock_define_const("SO_ATTACH_FILTER", SO_ATTACH_FILTER);
#endif

#ifdef SO_DETACH_FILTER
    sock_define_const("SO_DETACH_FILTER", SO_DETACH_FILTER);
#endif

#ifdef SO_PEERNAME
    sock_define_const("SO_PEERNAME", SO_PEERNAME);
#endif

#ifdef SO_TIMESTAMP
    sock_define_const("SO_TIMESTAMP", SO_TIMESTAMP);
#endif

#ifdef SOPRI_INTERACTIVE
    sock_define_const("SOPRI_INTERACTIVE", SOPRI_INTERACTIVE);
#endif

#ifdef SOPRI_NORMAL
    sock_define_const("SOPRI_NORMAL", SOPRI_NORMAL);
#endif

#ifdef SOPRI_BACKGROUND
    sock_define_const("SOPRI_BACKGROUND", SOPRI_BACKGROUND);
#endif

#ifdef IPX_TYPE
    sock_define_const("IPX_TYPE", IPX_TYPE);
#endif

#ifdef TCP_NODELAY
    sock_define_const("TCP_NODELAY", TCP_NODELAY);
#endif

#ifdef TCP_MAXSEG
    sock_define_const("TCP_MAXSEG", TCP_MAXSEG);
#endif

#ifdef EAI_ADDRFAMILY
    sock_define_const("EAI_ADDRFAMILY", EAI_ADDRFAMILY);
#endif

#ifdef EAI_AGAIN
    sock_define_const("EAI_AGAIN", EAI_AGAIN);
#endif

#ifdef EAI_BADFLAGS
    sock_define_const("EAI_BADFLAGS", EAI_BADFLAGS);
#endif

#ifdef EAI_FAIL
    sock_define_const("EAI_FAIL", EAI_FAIL);
#endif

#ifdef EAI_FAMILY
    sock_define_const("EAI_FAMILY", EAI_FAMILY);
#endif

#ifdef EAI_MEMORY
    sock_define_const("EAI_MEMORY", EAI_MEMORY);
#endif

#ifdef EAI_NODATA
    sock_define_const("EAI_NODATA", EAI_NODATA);
#endif

#ifdef EAI_NONAME
    sock_define_const("EAI_NONAME", EAI_NONAME);
#endif

#ifdef EAI_SERVICE
    sock_define_const("EAI_SERVICE", EAI_SERVICE);
#endif

#ifdef EAI_SOCKTYPE
    sock_define_const("EAI_SOCKTYPE", EAI_SOCKTYPE);
#endif

#ifdef EAI_SYSTEM
    sock_define_const("EAI_SYSTEM", EAI_SYSTEM);
#endif

#ifdef EAI_BADHINTS
    sock_define_const("EAI_BADHINTS", EAI_BADHINTS);
#endif

#ifdef EAI_PROTOCOL
    sock_define_const("EAI_PROTOCOL", EAI_PROTOCOL);
#endif

#ifdef EAI_MAX
    sock_define_const("EAI_MAX", EAI_MAX);
#endif

#ifdef AI_PASSIVE
    sock_define_const("AI_PASSIVE", AI_PASSIVE);
#endif

#ifdef AI_CANONNAME
    sock_define_const("AI_CANONNAME", AI_CANONNAME);
#endif

#ifdef AI_NUMERICHOST
    sock_define_const("AI_NUMERICHOST", AI_NUMERICHOST);
#endif

#ifdef AI_MASK
    sock_define_const("AI_MASK", AI_MASK);
#endif

#ifdef AI_ALL
    sock_define_const("AI_ALL", AI_ALL);
#endif

#ifdef AI_V4MAPPED_CFG
    sock_define_const("AI_V4MAPPED_CFG", AI_V4MAPPED_CFG);
#endif

#ifdef AI_ADDRCONFIG
    sock_define_const("AI_ADDRCONFIG", AI_ADDRCONFIG);
#endif

#ifdef AI_V4MAPPED
    sock_define_const("AI_V4MAPPED", AI_V4MAPPED);
#endif

#ifdef AI_DEFAULT
    sock_define_const("AI_DEFAULT", AI_DEFAULT);
#endif

#ifdef NI_MAXHOST
    sock_define_const("NI_MAXHOST", NI_MAXHOST);
#endif

#ifdef NI_MAXSERV
    sock_define_const("NI_MAXSERV", NI_MAXSERV);
#endif

#ifdef NI_NOFQDN
    sock_define_const("NI_NOFQDN", NI_NOFQDN);
#endif

#ifdef NI_NUMERICHOST
    sock_define_const("NI_NUMERICHOST", NI_NUMERICHOST);
#endif

#ifdef NI_NAMEREQD
    sock_define_const("NI_NAMEREQD", NI_NAMEREQD);
#endif

#ifdef NI_NUMERICSERV
    sock_define_const("NI_NUMERICSERV", NI_NUMERICSERV);
#endif

#ifdef NI_DGRAM
    sock_define_const("NI_DGRAM", NI_DGRAM);
#endif

#ifdef SHUT_RD
    sock_define_const("SHUT_RD", SHUT_RD);
#else
    sock_define_const("SHUT_RD", 0);
#endif

#ifdef SHUT_WR
    sock_define_const("SHUT_WR", SHUT_WR);
#else
    sock_define_const("SHUT_WR", 1);
#endif

#ifdef SHUT_RDWR
    sock_define_const("SHUT_RDWR", SHUT_RDWR);
#else
    sock_define_const("SHUT_RDWR", 2);
#endif

#ifdef IPV6_JOIN_GROUP
    sock_define_const("IPV6_JOIN_GROUP", IPV6_JOIN_GROUP);
#endif

#ifdef IPV6_LEAVE_GROUP
    sock_define_const("IPV6_LEAVE_GROUP", IPV6_LEAVE_GROUP);
#endif

#ifdef IPV6_MULTICAST_HOPS
    sock_define_const("IPV6_MULTICAST_HOPS", IPV6_MULTICAST_HOPS);
#endif

#ifdef IPV6_MULTICAST_IF
    sock_define_const("IPV6_MULTICAST_IF", IPV6_MULTICAST_IF);
#endif

#ifdef IPV6_MULTICAST_LOOP
    sock_define_const("IPV6_MULTICAST_LOOP", IPV6_MULTICAST_LOOP);
#endif

#ifdef IPV6_UNICAST_HOPS
    sock_define_const("IPV6_UNICAST_HOPS", IPV6_UNICAST_HOPS);
#endif

#ifdef IPV6_V6ONLY
    sock_define_const("IPV6_V6ONLY", IPV6_V6ONLY);
#endif

#ifdef IPV6_CHECKSUM
    sock_define_const("IPV6_CHECKSUM", IPV6_CHECKSUM);
#endif

#ifdef IPV6_DONTFRAG
    sock_define_const("IPV6_DONTFRAG", IPV6_DONTFRAG);
#endif

#ifdef IPV6_DSTOPTS
    sock_define_const("IPV6_DSTOPTS", IPV6_DSTOPTS);
#endif

#ifdef IPV6_HOPLIMIT
    sock_define_const("IPV6_HOPLIMIT", IPV6_HOPLIMIT);
#endif

#ifdef IPV6_HOPOPTS
    sock_define_const("IPV6_HOPOPTS", IPV6_HOPOPTS);
#endif

#ifdef IPV6_NEXTHOP
    sock_define_const("IPV6_NEXTHOP", IPV6_NEXTHOP);
#endif

#ifdef IPV6_PATHMTU
    sock_define_const("IPV6_PATHMTU", IPV6_PATHMTU);
#endif

#ifdef IPV6_PKTINFO
    sock_define_const("IPV6_PKTINFO", IPV6_PKTINFO);
#endif

#ifdef IPV6_RECVDSTOPTS
    sock_define_const("IPV6_RECVDSTOPTS", IPV6_RECVDSTOPTS);
#endif

#ifdef IPV6_RECVHOPLIMIT
    sock_define_const("IPV6_RECVHOPLIMIT", IPV6_RECVHOPLIMIT);
#endif

#ifdef IPV6_RECVHOPOPTS
    sock_define_const("IPV6_RECVHOPOPTS", IPV6_RECVHOPOPTS);
#endif

#ifdef IPV6_RECVPKTINFO
    sock_define_const("IPV6_RECVPKTINFO", IPV6_RECVPKTINFO);
#endif

#ifdef IPV6_RECVRTHDR
    sock_define_const("IPV6_RECVRTHDR", IPV6_RECVRTHDR);
#endif

#ifdef IPV6_RECVTCLASS
    sock_define_const("IPV6_RECVTCLASS", IPV6_RECVTCLASS);
#endif

#ifdef IPV6_RTHDR
    sock_define_const("IPV6_RTHDR", IPV6_RTHDR);
#endif

#ifdef IPV6_RTHDRDSTOPTS
    sock_define_const("IPV6_RTHDRDSTOPTS", IPV6_RTHDRDSTOPTS);
#endif

#ifdef IPV6_RTHDR_TYPE_0
    sock_define_const("IPV6_RTHDR_TYPE_0", IPV6_RTHDR_TYPE_0);
#endif

#ifdef IPV6_RECVPATHMTU
    sock_define_const("IPV6_RECVPATHMTU", IPV6_RECVPATHMTU);
#endif

#ifdef IPV6_TCLASS
    sock_define_const("IPV6_TCLASS", IPV6_TCLASS);
#endif

#ifdef IPV6_USE_MIN_MTU
    sock_define_const("IPV6_USE_MIN_MTU", IPV6_USE_MIN_MTU);
#endif


text:
<?php

/** PHPExcel */
require_once 'PHPExcel.php';

/** PHPExcel_Cell */
require_once 'PHPExcel/Cell.php';

/** PHPExcel_Cell_DataType */
require_once 'PHPExcel/Cell/DataType.php';

/** PHPExcel_Worksheet_RowDimension */
require_once 'PHPExcel/Worksheet/RowDimension.php';

/** PHPExcel_Worksheet_ColumnDimension */
require_once 'PHPExcel/Worksheet/ColumnDimension.php';

/** PHPExcel_Worksheet_PageSetup */
require_once 'PHPExcel/Worksheet/PageSetup.php';

/** PHPExcel_Worksheet_PageMargins */
require_once 'PHPExcel/Worksheet/PageMargins.php';

/** PHPExcel_Worksheet_HeaderFooter */
require_once 'PHPExcel/Worksheet/HeaderFooter.php';

/** PHPExcel_Worksheet_BaseDrawing */
require_once 'PHPExcel/Worksheet/BaseDrawing.php';

/** PHPExcel_Worksheet_Drawing */
require_once 'PHPExcel/Worksheet/Drawing.php';

/** PHPExcel_Worksheet_MemoryDrawing */
require_once 'PHPExcel/Worksheet/MemoryDrawing.php';

/** PHPExcel_Worksheet_HeaderFooterDrawing */
require_once 'PHPExcel/Worksheet/HeaderFooterDrawing.php';

/** PHPExcel_Worksheet_SheetView */
require_once 'PHPExcel/Worksheet/SheetView.php';

/** PHPExcel_Worksheet_Protection */
require_once 'PHPExcel/Worksheet/Protection.php';

/** PHPExcel_Worksheet_RowIterator */
require_once 'PHPExcel/Worksheet/RowIterator.php';

/** PHPExcel_Comment */
require_once 'PHPExcel/Comment.php';

/** PHPExcel_Style */
require_once 'PHPExcel/Style.php';

/** PHPExcel_Style_Fill */
require_once 'PHPExcel/Style/Fill.php';

/** PHPExcel_Style_NumberFormat */
require_once 'PHPExcel/Style/NumberFormat.php';

/** PHPExcel_IComparable */
require_once 'PHPExcel/IComparable.php';

/** PHPExcel_Shared_Font */
require_once 'PHPExcel/Shared/Font.php';

/** PHPExcel_Shared_PasswordHasher */
require_once 'PHPExcel/Shared/PasswordHasher.php';

/** PHPExcel_ReferenceHelper */
require_once 'PHPExcel/ReferenceHelper.php';

/**
 * PHPExcel_Worksheet
 *
 * @category   PHPExcel
 * @package    PHPExcel_Worksheet
 * @copyright  Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
 */
class PHPExcel_Worksheet implements PHPExcel_IComparable
{
	/* Break types */
	const BREAK_NONE	= 0;
	const BREAK_ROW		= 1;
	const BREAK_COLUMN	= 2;

	/**
	 * Parent spreadsheet
	 *
	 * @var PHPExcel
	 */
	private $_parent;

	/**
	 * Collection of cells
	 *
	 * @var PHPExcel_Cell[]
	 */
	private $_cellCollection = array();

	/**
	 * Collection of row dimensions
	 *
	 * @var PHPExcel_Worksheet_RowDimension[]
	 */
	private $_rowDimensions = array();

	/**
	 * Default row dimension
	 *
	 * @var PHPExcel_Worksheet_RowDimension
	 */
	private $_defaultRowDimension = null;

	/**
	 * Collection of column dimensions
	 *
	 * @var PHPExcel_Worksheet_ColumnDimension[]
	 */
	private $_columnDimensions = array();

	/**
	 * Default column dimension
	 *
	 * @var PHPExcel_Worksheet_ColumnDimension
	 */
	private $_defaultColumnDimension = null;

	/**
	 * Collection of drawings
	 *
	 * @var PHPExcel_Worksheet_BaseDrawing[]
	 */
	private $_drawingCollection = null;

	/**
	 * Worksheet title
	 *
	 * @var string
	 */
	private $_title;

	/**
	 * Page setup
	 *
	 * @var PHPExcel_Worksheet_PageSetup
	 */
	private $_pageSetup;

	/**
	 * Page margins
	 *
	 * @var PHPExcel_Worksheet_PageMargins
	 */
	private $_pageMargins;

	/**
	 * Page header/footer
	 *
	 * @var PHPExcel_Worksheet_HeaderFooter
	 */
	private $_headerFooter;

	/**
	 * Sheet view
	 *
	 * @var PHPExcel_Worksheet_SheetView
	 */
	private $_sheetView;

	/**
	 * Protection
	 *
	 * @var PHPExcel_Worksheet_Protection
	 */
	private $_protection;

	/**
	 * Collection of styles
	 *
	 * @var PHPExcel_Style[]
	 */
	private $_styles = array();

	/**
	 * Conditional styles. Indexed by cell coordinate, e.g. 'A1'
	 *
	 * @var array
	 */
	private $_conditionalStylesCollection = array();

	/**
	 * Is the current cell collection sorted already?
	 *
	 * @var boolean
	 */
	private $_cellCollectionIsSorted = false;

	/**
	 * Collection of breaks
	 *
	 * @var array
	 */
	private $_breaks = array();

	/**
	 * Collection of merged cell ranges
	 *
	 * @var array
	 */
	private $_mergeCells = array();

	/**
	 * Collection of protected cell ranges
	 *
	 * @var array
	 */
	private $_protectedCells = array();

	/**
	 * Autofilter Range
	 *
	 * @var string
	 */
	private $_autoFilter = '';

	/**
	 * Freeze pane
	 *
	 * @var string
	 */
	private $_freezePane = '';

	/**
	 * Show gridlines?
	 *
	 * @var boolean
	 */
	private $_showGridlines = true;

	/**
	* Print gridlines?
	*
	* @var boolean
	*/
	private $_printGridlines = false;

	/**
	 * Show summary below? (Row/Column outline)
	 *
	 * @var boolean
	 */
	private $_showSummaryBelow = true;

	/**
	 * Show summary right? (Row/Column outline)
	 *
	 * @var boolean
	 */
	private $_showSummaryRight = true;

	/**
	 * Collection of comments
	 *
	 * @var PHPExcel_Comment[]
	 */
	private $_comments = array();

	/**
	 * Selected cell
	 *
	 * @var string
	 */
	private $_selectedCell = 'A1';

	/**
	 * Cached highest column
	 *
	 * @var string
	 */
	private $_cachedHighestColumn = null;

	/**
	 * Cached highest row
	 *
	 * @var int
	 */
	private $_cachedHighestRow = null;

	/**
	 * Create a new worksheet
	 *
	 * @param PHPExcel 		$pParent
	 * @param string 		$pTitle
	 */
	public function __construct(PHPExcel $pParent = null, $pTitle = 'Worksheet')
	{
		// Set parent and title
		$this->_parent = $pParent;
		$this->setTitle($pTitle);

		// Set page setup
		$this->_pageSetup 			= new PHPExcel_Worksheet_PageSetup();

		// Set page margins
		$this->_pageMargins 		= new PHPExcel_Worksheet_PageMargins();

		// Set page header/footer
		$this->_headerFooter 		= new PHPExcel_Worksheet_HeaderFooter();

		// Set sheet view
		$this->_sheetView           = new PHPExcel_Worksheet_SheetView();

    	// Drawing collection
    	$this->_drawingCollection 	= new ArrayObject();

    	// Protection
    	$this->_protection			= new PHPExcel_Worksheet_Protection();

    	// Gridlines
    	$this->_showGridlines		= true;
		$this->_printGridlines		= false;

    	// Outline summary
    	$this->_showSummaryBelow	= true;
    	$this->_showSummaryRight	= true;

    	// Default row dimension
    	$this->_defaultRowDimension = new PHPExcel_Worksheet_RowDimension(null);

    	// Default column dimension
    	$this->_defaultColumnDimension = new PHPExcel_Worksheet_ColumnDimension(null);
	}

	/**
	 * Get collection of cells
	 *
	 * @param boolean $pSorted Also sort the cell collection?
	 * @return PHPExcel_Cell[]
	 */
	public function getCellCollection($pSorted = true)
	{
		if ($pSorted) {
			// Re-order cell collection
			$this->sortCellCollection();
		}

		return $this->_cellCollection;
	}

	/**
	 * Sort collection of cells
	 */
	public function sortCellCollection()
	{
		if (!$this->_cellCollectionIsSorted) {
			// Re-order cell collection
        	// uasort($this->_cellCollection, array('PHPExcel_Cell', 'compareCells')); <-- slow

			$indexed = array();
			foreach (array_keys($this->_cellCollection) as $index) {
				$rowNum = $this->_cellCollection[$index]->getRow();
				$colNum = PHPExcel_Cell::columnIndexFromString($this->_cellCollection[$index]->getColumn());

				// Columns are limited to ZZZ (18278), so 20000 is plenty to assure no conflicts
				$key =  $rowNum * 20000 + $colNum;

				$indexed[$key] = $index; // &$this->_cellCollection[$index];
			}
			ksort($indexed);

			// Rebuild cellCollection from the sorted index
			$newCellCollection = array();
		    foreach ($indexed as $index) {
		        $newCellCollection[$index] = $this->_cellCollection[$index];
			}

			$this->_cellCollection = $newCellCollection;

			$this->_cellCollectionIsSorted = true;
		}
	}

	/**
	 * Get collection of row dimensions
	 *
	 * @return PHPExcel_Worksheet_RowDimension[]
	 */
	public function getRowDimensions()
	{
		return $this->_rowDimensions;
	}

	/**
	 * Get default row dimension
	 *
	 * @return PHPExcel_Worksheet_RowDimension
	 */
	public function getDefaultRowDimension()
	{
		return $this->_defaultRowDimension;
	}

	/**
	 * Get collection of column dimensions
	 *
	 * @return PHPExcel_Worksheet_ColumnDimension[]
	 */
	public function getColumnDimensions()
	{
		return $this->_columnDimensions;
	}

	/**
	 * Get default column dimension
	 *
	 * @return PHPExcel_Worksheet_ColumnDimension
	 */
	public function getDefaultColumnDimension()
	{
		return $this->_defaultColumnDimension;
	}

	/**
	 * Get collection of drawings
	 *
	 * @return PHPExcel_Worksheet_BaseDrawing[]
	 */
	public function getDrawingCollection()
	{
		return $this->_drawingCollection;
	}

	/**
	 * Refresh column dimensions
	 */
	public function refreshColumnDimensions()
	{
		$currentColumnDimensions = $this->getColumnDimensions();
		$newColumnDimensions = array();

		foreach ($currentColumnDimensions as $objColumnDimension) {
			$newColumnDimensions[$objColumnDimension->getColumnIndex()] = $objColumnDimension;
		}

		$this->_columnDimensions = $newColumnDimensions;
	}

	/**
	 * Refresh row dimensions
	 */
	public function refreshRowDimensions()
	{
		$currentRowDimensions = $this->getRowDimensions();
		$newRowDimensions = array();

		foreach ($currentRowDimensions as $objRowDimension) {
			$newRowDimensions[$objRowDimension->getRowIndex()] = $objRowDimension;
		}

		$this->_rowDimensions = $newRowDimensions;
	}

    /**
     * Calculate worksheet dimension
     *
     * @return string  String containing the dimension of this worksheet
     */
    public function calculateWorksheetDimension()
    {
        // Return
        return 'A1' . ':' .  $this->getHighestColumn() . $this->getHighestRow();
    }

    /**
     * Calculate widths for auto-size columns
     *
     * @param  boolean  $calculateMergeCells  Calculate merge cell width
     */
    public function calculateColumnWidths($calculateMergeCells = false)
    {
		$autoSizes = array();
        foreach ($this->getColumnDimensions() as $colDimension) {
			if ($colDimension->getAutoSize()) {
				$autoSizes[$colDimension->getColumnIndex()] = -1;
			}
        }

		foreach ($this->getCellCollection() as $cell) {
			if (isset($autoSizes[$cell->getColumn()])) {
				$cellValue = $cell->getCalculatedValue();

				foreach ($this->getMergeCells() as $cells) {
					if ($cell->isInRange($cells) && !$calculateMergeCells) {
						$cellValue = ''; // do not calculate merge cells
					}
				}

				$autoSizes[$cell->getColumn()] = max(
					(float)$autoSizes[$cell->getColumn()],
					(float)PHPExcel_Shared_Font::calculateColumnWidth(
						$this->getParent()->getCellXfByIndex($cell->getXfIndex())->getFont()->getSize(),
						false,
						$cellValue,
						$this->getParent()->getCellXfByIndex($cell->getXfIndex())->getAlignment()->getTextRotation()
					)
				);
			}
		}
		foreach ($autoSizes as $columnIndex => $width) {
			if ($width == -1) $width = $this->getDefaultColumnDimension()->getWidth();
			$this->getColumnDimension($columnIndex)->setWidth($width);
		}
    }

    /**
     * Get parent
     *
     * @return PHPExcel
     */
    public function getParent() {
    	return $this->_parent;
    }

    /**
     * Re-bind parent
     *
     * @param PHPExcel $parent
     */
    public function rebindParent(PHPExcel $parent) {
		$namedRanges = $this->_parent->getNamedRanges();
		foreach ($namedRanges as $namedRange) {
			$parent->addNamedRange($namedRange);
		}

		$this->_parent->removeSheetByIndex(
			$this->_parent->getindex($this)
		);
		$this->_parent = $parent;
    }

	/**
	 * Get title
	 *
	 * @return string
	 */
	public function getTitle()
	{
		return $this->_title;
	}

    /**
     * Set title
     *
     * @param string $pValue String containing the dimension of this worksheet
     */
    public function setTitle($pValue = 'Worksheet')
    {
    	// Is this a 'rename' or not?
    	if ($this->getTitle() == $pValue) {
    		return;
    	}

    	// Old title
    	$oldTitle = $this->getTitle();

    	// Loop trough all sheets in parent PHPExcel and verify unique names
    	$titleCount	= 0;
    	$aNames 	= $this->getParent()->getSheetNames();

		foreach ($aNames as $strName) {
			if ($strName == $pValue || substr($strName, 0, strrpos($strName, ' ')) == $pValue) {
				++$titleCount;
			}
		}

		// Eventually, add a number to the sheet name
		if ($titleCount > 0) {
			$this->setTitle($pValue . ' ' . $titleCount);
			return;
		}

		// Set title
        $this->_title = $pValue;

    	// New title
    	$newTitle = $this->getTitle();
    	PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->getParent(), $oldTitle, $newTitle);
    }

    /**
     * Get page setup
     *
     * @return PHPExcel_Worksheet_PageSetup
     */
    public function getPageSetup()
    {
    	return $this->_pageSetup;
    }

    /**
     * Set page setup
     *
     * @param PHPExcel_Worksheet_PageSetup	$pValue
     */
    public function setPageSetup(PHPExcel_Worksheet_PageSetup $pValue)
    {
   		$this->_pageSetup = $pValue;
    }

    /**
     * Get page margins
     *
     * @return PHPExcel_Worksheet_PageMargins
     */
    public function getPageMargins()
    {
    	return $this->_pageMargins;
    }

    /**
     * Set page margins
     *
     * @param PHPExcel_Worksheet_PageMargins	$pValue
     */
    public function setPageMargins(PHPExcel_Worksheet_PageMargins $pValue)
    {
   		$this->_pageMargins = $pValue;
    }

    /**
     * Get page header/footer
     *
     * @return PHPExcel_Worksheet_HeaderFooter
     */
    public function getHeaderFooter()
    {
    	return $this->_headerFooter;
    }

    /**
     * Set page header/footer
     *
     * @param PHPExcel_Worksheet_HeaderFooter	$pValue
     */
    public function setHeaderFooter(PHPExcel_Worksheet_HeaderFooter $pValue)
    {
    	$this->_headerFooter = $pValue;
    }

    /**
     * Get sheet view
     *
     * @return PHPExcel_Worksheet_HeaderFooter
     */
    public function getSheetView()
    {
    	return $this->_sheetView;
    }

    /**
     * Set sheet view
     *
     * @param PHPExcel_Worksheet_SheetView	$pValue
     */
    public function setSheetView(PHPExcel_Worksheet_SheetView $pValue)
    {
    	$this->_sheetView = $pValue;
    }

    /**
     * Get Protection
     *
     * @return PHPExcel_Worksheet_Protection
     */
    public function getProtection()
    {
    	return $this->_protection;
    }

    /**
     * Set Protection
     *
     * @param PHPExcel_Worksheet_Protection	$pValue
     */
    public function setProtection(PHPExcel_Worksheet_Protection $pValue)
    {
   		$this->_protection = $pValue;
    }

    /**
     * Get highest worksheet column
     *
     * @return string Highest column name
     */
    public function getHighestColumn()
    {
		// Cached?
		if (!is_null($this->_cachedHighestColumn)) {
			return $this->_cachedHighestColumn;
		}

        // Highest column
        $highestColumn = -1;

        // Loop trough cells
        foreach ($this->_cellCollection as $cell) {
        	if ($highestColumn < PHPExcel_Cell::columnIndexFromString($cell->getColumn())) {
        		$highestColumn = PHPExcel_Cell::columnIndexFromString($cell->getColumn());
        	}
        }

        // Loop trough column dimensions
        foreach ($this->_columnDimensions as $dimension) {
        	if ($highestColumn < PHPExcel_Cell::columnIndexFromString($dimension->getColumnIndex())) {
        		$highestColumn = PHPExcel_Cell::columnIndexFromString($dimension->getColumnIndex());
        	}
        }

        // Return & cache
		if ($highestColumn < 0) {
			$this->_cachedHighestColumn = 'A';
		} else {
			$this->_cachedHighestColumn = PHPExcel_Cell::stringFromColumnIndex(--$highestColumn);
		}

        return $this->_cachedHighestColumn;
    }

    /**
     * Get highest worksheet row
     *
     * @return int Highest row number
     */
    public function getHighestRow()
    {
		// Cached?
		if (!is_null($this->_cachedHighestRow)) {
			return $this->_cachedHighestRow;
		}

        // Highest row
        $highestRow = 1;

        // Loop trough cells
        foreach ($this->_cellCollection as $cell) {
        	if ($cell->getRow() > $highestRow) {
        		$highestRow = $cell->getRow();
        	}
        }

        // Loop trough row dimensions
        foreach ($this->_rowDimensions as $dimension) {
        	if ($highestRow < $dimension->getRowIndex()) {
        		$highestRow = $dimension->getRowIndex();
        	}
        }

		// Cache
		$this->_cachedHighestRow = $highestRow;

        // Return
        return $highestRow;
    }

    /**
     * Set a cell value
     *
     * @param string 	$pCoordinate	Coordinate of the cell
     * @param mixed 	$pValue			Value of the cell
     */
    public function setCellValue($pCoordinate = 'A1', $pValue = null)
    {
    	// Set value
    	$this->getCell($pCoordinate)->setValue($pValue, true);
    }

    /**
     * Set a cell value by using numeric cell coordinates
     *
     * @param string 	$pColumn		Numeric column coordinate of the cell
     * @param string 	$pRow			Numeric row coordinate of the cell
     * @param mixed 	$pValue			Value of the cell
     */
    public function setCellValueByColumnAndRow($pColumn = 0, $pRow = 0, $pValue = null)
    {
    	$this->setCellValue(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow, $pValue);
    }

    /**
     * Set a cell value
     *
     * @param string 	$pCoordinate	Coordinate of the cell
     * @param mixed 	$pValue			Value of the cell
     * @param string	$pDataType		Explicit data type
     */
    public function setCellValueExplicit($pCoordinate = 'A1', $pValue = null, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING)
    {
    	// Set value
    	$this->getCell($pCoordinate)->setValueExplicit($pValue, $pDataType);
    }

    /**
     * Set a cell value by using numeric cell coordinates
     *
     * @param string 	$pColumn		Numeric column coordinate of the cell
     * @param string 	$pRow			Numeric row coordinate of the cell
     * @param mixed 	$pValue			Value of the cell
     * @param string	$pDataType		Explicit data type
     */
    public function setCellValueExplicitByColumnAndRow($pColumn = 0, $pRow = 0, $pValue = null, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING)
    {
    	$this->setCellValueExplicit(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow, $pValue, $pDataType);
    }

    /**
     * Get cell at a specific coordinate
     *
     * @param 	string 			$pCoordinate	Coordinate of the cell
     * @throws 	Exception
     * @return 	PHPExcel_Cell 	Cell that was found
     */
    public function getCell($pCoordinate = 'A1')
    {
		// Worksheet reference?
		if (strpos($pCoordinate, '!') !== false) {
			$worksheetReference = PHPExcel_Worksheet::extractSheetTitle($pCoordinate, true);
			return $this->getParent()->getSheetByName($worksheetReference[0])->getCell($worksheetReference[1]);
		}

		// Named range?
		$namedRange = PHPExcel_NamedRange::resolveRange($pCoordinate, $this);
		if (!is_null($namedRange)) {
			$pCoordinate = $namedRange->getRange();
			if ($this->getHashCode() != $namedRange->getWorksheet()->getHashCode()) {
				if (!$namedRange->getLocalOnly()) {
					return $namedRange->getWorksheet()->getCell($pCoordinate);
				} else {
					throw new Exception('Named range ' . $namedRange->getName() . ' is not accessible from within sheet ' . $this->getTitle());
				}
			}
		}

    	// Uppercase coordinate
    	$pCoordinate = strtoupper($pCoordinate);

    	if (strpos($pCoordinate,':') !== false || strpos($pCoordinate,',') !== false) {
    		throw new Exception('Cell coordinate can not be a range of cells.');
    	} elseif (strpos($pCoordinate,'$') !== false) {
    		throw new Exception('Cell coordinate must not be absolute.');
    	} else {
	    	// Coordinates
	    	$aCoordinates = PHPExcel_Cell::coordinateFromString($pCoordinate);

	        // Cell exists?
	        if (!isset($this->_cellCollection[$pCoordinate])) {
	        	$this->_cellCollection[$pCoordinate] = new PHPExcel_Cell($aCoordinates[0], $aCoordinates[1], null, null, $this);
	        	$this->_cellCollectionIsSorted = false;

				$this->_cachedHighestColumn = null;
				$this->_cachedHighestRow = null;
	        }

	        return $this->_cellCollection[$pCoordinate];
    	}
    }

    /**
     * Get cell at a specific coordinate by using numeric cell coordinates
     *
     * @param 	string $pColumn		Numeric column coordinate of the cell
     * @param 	string $pRow		Numeric row coordinate of the cell
     * @return 	PHPExcel_Cell 		Cell that was found
     */
    public function getCellByColumnAndRow($pColumn = 0, $pRow = 0)
    {
    	return $this->getCell(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow);
    }

    /**
     * Cell at a specific coordinate exists?
     *
     * @param 	string 			$pCoordinate	Coordinate of the cell
     * @throws 	Exception
     * @return 	boolean
     */
    public function cellExists($pCoordinate = 'A1')
    {
    	// Worksheet reference?
		if (strpos($pCoordinate, '!') !== false) {
			$worksheetReference = PHPExcel_Worksheet::extractSheetTitle($pCoordinate, true);
			return $this->getParent()->getSheetByName($worksheetReference[0])->cellExists($worksheetReference[1]);
		}

		// Named range?
		$namedRange = PHPExcel_NamedRange::resolveRange($pCoordinate, $this);
		if (!is_null($namedRange)) {
			$pCoordinate = $namedRange->getRange();
			if ($this->getHashCode() != $namedRange->getWorksheet()->getHashCode()) {
				if (!$namedRange->getLocalOnly()) {
					return $namedRange->getWorksheet()->cellExists($pCoordinate);
				} else {
					throw new Exception('Named range ' . $namedRange->getName() . ' is not accessible from within sheet ' . $this->getTitle());
				}
			}
		}

    	// Uppercase coordinate
    	$pCoordinate = strtoupper($pCoordinate);

    	if (strpos($pCoordinate,':') !== false || strpos($pCoordinate,',') !== false) {
    		throw new Exception('Cell coordinate can not be a range of cells.');
    	} elseif (strpos($pCoordinate,'$') !== false) {
    		throw new Exception('Cell coordinate must not be absolute.');
    	} else {
	    	// Coordinates
	    	$aCoordinates = PHPExcel_Cell::coordinateFromString($pCoordinate);

	        // Cell exists?
	        return isset($this->_cellCollection[$pCoordinate]);
    	}
    }

    /**
     * Cell at a specific coordinate by using numeric cell coordinates exists?
     *
     * @param 	string $pColumn		Numeric column coordinate of the cell
     * @param 	string $pRow		Numeric row coordinate of the cell
     * @return 	boolean
     */
    public function cellExistsByColumnAndRow($pColumn = 0, $pRow = 0)
    {
    	return $this->cellExists(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow);
    }

    /**
     * Get row dimension at a specific row
     *
     * @param int $pRow	Numeric index of the row
     * @return PHPExcel_Worksheet_RowDimension
     */
    public function getRowDimension($pRow = 0)
    {
    	// Found
    	$found = null;

        // Get row dimension
        if (!isset($this->_rowDimensions[$pRow])) {
        	$this->_rowDimensions[$pRow] = new PHPExcel_Worksheet_RowDimension($pRow);
			$this->_cachedHighestRow = null;
        }
        return $this->_rowDimensions[$pRow];
    }

    /**
     * Get column dimension at a specific column
     *
     * @param string $pColumn	String index of the column
     * @return PHPExcel_Worksheet_ColumnDimension
     */
    public function getColumnDimension($pColumn = 'A')
    {
    	// Uppercase coordinate
    	$pColumn = strtoupper($pColumn);

    	// Fetch dimensions
    	if (!isset($this->_columnDimensions[$pColumn])) {
    		$this->_columnDimensions[$pColumn] = new PHPExcel_Worksheet_ColumnDimension($pColumn);
			$this->_cachedHighestColumn = null;
    	}
    	return $this->_columnDimensions[$pColumn];
    }

    /**
     * Get column dimension at a specific column by using numeric cell coordinates
     *
     * @param 	string $pColumn		Numeric column coordinate of the cell
     * @param 	string $pRow		Numeric row coordinate of the cell
     * @return 	PHPExcel_Worksheet_ColumnDimension
     */
    public function getColumnDimensionByColumn($pColumn = 0)
    {
        return $this->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($pColumn));
    }

    /**
     * Get styles
     *
     * @return PHPExcel_Style[]
     */
    public function getStyles()
    {
    	return $this->_styles;
    }

    /**
     * Get default style of workbork.
     *
     * @deprecated
     * @return 	PHPExcel_Style
     * @throws 	Exception
     */
    public function getDefaultStyle()
    {
    	return $this->_parent->getDefaultStyle();
    }

    /**
     * Set default style - should only be used by PHPExcel_IReader implementations!
     *
     * @deprecated
     * @param 	PHPExcel_Style $value
     * @throws 	Exception
     */
    public function setDefaultStyle(PHPExcel_Style $value)
    {
		$this->_parent->setDefaultStyle($value);
    }

    /**
     * Get style for cell
     *
     * @param 	string 	$pCellCoordinate	Cell coordinate to get style for
     * @return 	PHPExcel_Style
     * @throws 	Exception
     */
    public function getStyle($pCellCoordinate = 'A1')
    {
		// set this sheet as active
		$this->_parent->setActiveSheetIndex($this->_parent->getIndex($this));

		// set cell coordinate as active
		$this->_selectedCell = $pCellCoordinate;

		return $this->_parent->getCellXfSupervisor();
    }

	/**
	 * Get conditional styles for a cell
	 *
	 * @param string $pCoordinate
	 * @return PHPExcel_Style_Conditional[]
	 */
	public function getConditionalStyles($pCoordinate = 'A1')
	{
		if (!isset($this->_conditionalStylesCollection[$pCoordinate])) {
			$this->_conditionalStylesCollection[$pCoordinate] = array();
		}
		return $this->_conditionalStylesCollection[$pCoordinate];
	}

	/**
	 * Do conditional styles exist for this cell?
	 *
	 * @param string $pCoordinate
	 * @return boolean
	 */
	public function conditionalStylesExists($pCoordinate = 'A1')
	{
		if (isset($this->_conditionalStylesCollection[$pCoordinate])) {
			return true;
		}
		return false;
	}

	/**
	 * Removes conditional styles for a cell
	 *
	 * @param string $pCoordinate
	 */
	public function removeConditionalStyles($pCoordinate = 'A1')
	{
		unset($this->_conditionalStylesCollection[$pCoordinate]);
	}

	/**
	 * Get collection of conditional styles
	 *
	 * @return array
	 */
	public function getConditionalStylesCollection()
	{
		return $this->_conditionalStylesCollection;
	}

	/**
	 * @param $pCoordinate string E.g. 'A1'
	 * @param $pValue PHPExcel_Style_Conditional[]
	 */
	public function setConditionalStyles($pCoordinate = 'A1', $pValue)
	{
		$this->_conditionalStylesCollection[$pCoordinate] = $pValue;
	}

    /**
     * Get style for cell by using numeric cell coordinates
     *
     * @param 	int $pColumn	Numeric column coordinate of the cell
     * @param 	int $pRow		Numeric row coordinate of the cell
     * @return 	PHPExcel_Style
     */
    public function getStyleByColumnAndRow($pColumn = 0, $pRow = 0)
    {
    	return $this->getStyle(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow);
    }

    /**
     * Set shared cell style to a range of cells
     *
     * Please note that this will overwrite existing cell styles for cells in range!
     *
     * @deprecated
     * @param 	PHPExcel_Style	$pSharedCellStyle	Cell style to share
     * @param 	string			$pRange				Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")
     * @throws	Exception
     */
     public function setSharedStyle(PHPExcel_Style $pSharedCellStyle = null, $pRange = '')
    {
		$this->duplicateStyle($pSharedCellStyle, $pRange);
    }

    /**
     * Duplicate cell style to a range of cells
     *
     * Please note that this will overwrite existing cell styles for cells in range!
     *
     * @param 	PHPExcel_Style	$pCellStyle	Cell style to duplicate
     * @param 	string			$pRange		Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")
     * @throws	Exception
     */
    public function duplicateStyle(PHPExcel_Style $pCellStyle = null, $pRange = '')
    {
    	// make sure we have a real style and not supervisor
		$style = $pCellStyle->getIsSupervisor() ? $pCellStyle->getSharedComponent() : $pCellStyle;

		// Add the style to the workbook if necessary
		$workbook = $this->_parent;
		if ($existingStyle = $this->_parent->getCellXfByHashCode($pCellStyle->getHashCode())) {
			// there is already such cell Xf in our collection
			$xfIndex = $existingStyle->getIndex();
		} else {
			// we don't have such a cell Xf, need to add
			$workbook->addCellXf($pCellStyle);
			$xfIndex = $pCellStyle->getIndex();
		}

		// Uppercase coordinate
    	$pRange = strtoupper($pRange);

   		// Is it a cell range or a single cell?
   		$rangeA 	= '';
   		$rangeB 	= '';
   		if (strpos($pRange, ':') === false) {
   			$rangeA = $pRange;
   			$rangeB = $pRange;
   		} else {
   			list($rangeA, $rangeB) = explode(':', $pRange);
   		}

   		// Calculate range outer borders
   		$rangeStart = PHPExcel_Cell::coordinateFromString($rangeA);
   		$rangeEnd 	= PHPExcel_Cell::coordinateFromString($rangeB);

   		// Translate column into index
   		$rangeStart[0]	= PHPExcel_Cell::columnIndexFromString($rangeStart[0]) - 1;
   		$rangeEnd[0]	= PHPExcel_Cell::columnIndexFromString($rangeEnd[0]) - 1;

   		// Make sure we can loop upwards on rows and columns
   		if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) {
   			$tmp = $rangeStart;
   			$rangeStart = $rangeEnd;
   			$rangeEnd = $tmp;
   		}

   		// Loop trough cells and apply styles
   		for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) {
   			for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) {
   				$this->getCell(PHPExcel_Cell::stringFromColumnIndex($col) . $row)->setXfIndex($xfIndex);
   			}
   		}
    }

    /**
     * Duplicate cell style array to a range of cells
     *
     * Please note that this will overwrite existing cell styles for cells in range,
     * if they are in the styles array. For example, if you decide to set a range of
     * cells to font bold, only include font bold in the styles array.
     *
     * @param	array			$pStyles	Array containing style information
     * @param 	string			$pRange		Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")
     * @throws	Exception
     */
    public function duplicateStyleArray($pStyles = null, $pRange = '')
    {
    	if (is_array($pStyles)) {
    	    // Uppercase coordinate
	    	$pRange = strtoupper($pRange);

	   		// Is it a cell range or a single cell?
	   		$rangeA 	= '';
	   		$rangeB 	= '';
	   		if (strpos($pRange, ':') === false) {
	   			$rangeA = $pRange;
	   			$rangeB = $pRange;
	   		} else {
	   			list($rangeA, $rangeB) = explode(':', $pRange);
	   		}

	   		// Calculate range outer borders
	   		$rangeStart = PHPExcel_Cell::coordinateFromString($rangeA);
	   		$rangeEnd 	= PHPExcel_Cell::coordinateFromString($rangeB);

	   		// Translate column into index
	   		$rangeStart[0]	= PHPExcel_Cell::columnIndexFromString($rangeStart[0]) - 1;
	   		$rangeEnd[0]	= PHPExcel_Cell::columnIndexFromString($rangeEnd[0]) - 1;

	   		// Make sure we can loop upwards on rows and columns
	   		if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) {
	   			$tmp = $rangeStart;
	   			$rangeStart = $rangeEnd;
	   			$rangeEnd = $tmp;
	   		}

	   		// First loop through cells to find out which styles are affected by this operation
			$oldXfIndexes = array();
	   		for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) {
	   			for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) {
					$oldXfIndexes[$this->getCell(PHPExcel_Cell::stringFromColumnIndex($col) . $row)->getXfIndex()] = true;
	   			}
	   		}

			// clone each of the affected styles, apply the style arrray, and add the new styles to the workbook
			$workbook = $this->_parent;
			foreach ($oldXfIndexes as $oldXfIndex => $dummy) {
				$style = $workbook->getCellXfByIndex($oldXfIndex);
				$newStyle = clone $style;
				$newStyle->applyFromArray($pStyles);

				if ($existingStyle = $this->_parent->getCellXfByHashCode($newStyle->getHashCode())) {
					// there is already such cell Xf in our collection
					$newXfIndexes[$oldXfIndex] = $existingStyle->getIndex();
				} else {
					// we don't have such a cell Xf, need to add
					$workbook->addCellXf($newStyle);
					$newXfIndexes[$oldXfIndex] = $newStyle->getIndex();
				}
			}

			// Loop through cells again and update the XF index
	   		for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) {
	   			for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) {
					$oldXfIndex = $this->getCell(PHPExcel_Cell::stringFromColumnIndex($col) . $row)->getXfIndex();
					$this->getCell(PHPExcel_Cell::stringFromColumnIndex($col) . $row)->setXfIndex($newXfIndexes[$oldXfIndex]);
	   			}
	   		}

    	} else {
    		throw new Exception("Invalid style array passed.");
    	}
    }

    /**
     * Set break on a cell
     *
     * @param 	string			$pCell		Cell coordinate (e.g. A1)
     * @param 	int				$pBreak		Break type (type of PHPExcel_Worksheet::BREAK_*)
     * @throws	Exception
     */
    public function setBreak($pCell = 'A1', $pBreak = PHPExcel_Worksheet::BREAK_NONE)
    {
    	// Uppercase coordinate
    	$pCell = strtoupper($pCell);

    	if ($pCell != '') {
    		$this->_breaks[$pCell] = $pBreak;
    	} else {
    		throw new Exception('No cell coordinate specified.');
    	}
    }

    /**
     * Set break on a cell by using numeric cell coordinates
     *
     * @param 	int 	$pColumn	Numeric column coordinate of the cell
     * @param 	int 	$pRow		Numeric row coordinate of the cell
     * @param 	int		$pBreak		Break type (type of PHPExcel_Worksheet::BREAK_*)
     * @throws	Exception
     */
    public function setBreakByColumnAndRow($pColumn = 0, $pRow = 0, $pBreak = PHPExcel_Worksheet::BREAK_NONE)
    {
    	$this->setBreak(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow, $pBreak);
    }

    /**
     * Get breaks
     *
     * @return array[]
     */
    public function getBreaks()
    {
    	return $this->_breaks;
    }

    /**
     * Set merge on a cell range
     *
     * @param 	string			$pRange		Cell range (e.g. A1:E1)
     * @throws	Exception
     */
    public function mergeCells($pRange = 'A1:A1')
    {
    	// Uppercase coordinate
    	$pRange = strtoupper($pRange);

    	if (strpos($pRange,':') !== false) {
    		$this->_mergeCells[$pRange] = $pRange;
    	} else {
    		throw new Exception('Merge must be set on a range of cells.');
    	}
    }

    /**
     * Set merge on a cell range by using numeric cell coordinates
     *
     * @param 	int $pColumn1	Numeric column coordinate of the first cell
     * @param 	int $pRow1		Numeric row coordinate of the first cell
     * @param 	int $pColumn2	Numeric column coordinate of the last cell
     * @param 	int $pRow2		Numeric row coordinate of the last cell
     * @throws	Exception
     */
    public function mergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 0, $pColumn2 = 0, $pRow2 = 0)
    {
    	$cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2;
    	$this->mergeCells($cellRange);
    }

    /**
     * Remove merge on a cell range
     *
     * @param 	string			$pRange		Cell range (e.g. A1:E1)
     * @throws	Exception
     */
    public function unmergeCells($pRange = 'A1:A1')
    {
    	// Uppercase coordinate
    	$pRange = strtoupper($pRange);

    	if (strpos($pRange,':') !== false) {
    		if (isset($this->_mergeCells[$pRange])) {
    			unset($this->_mergeCells[$pRange]);
    		} else {
    			throw new Exception('Cell range ' . $pRange . ' not known as merged.');
    		}
    	} else {
    		throw new Exception('Merge can only be removed from a range of cells.');
    	}
    }

    /**
     * Remove merge on a cell range by using numeric cell coordinates
     *
     * @param 	int $pColumn1	Numeric column coordinate of the first cell
     * @param 	int $pRow1		Numeric row coordinate of the first cell
     * @param 	int $pColumn2	Numeric column coordinate of the last cell
     * @param 	int $pRow2		Numeric row coordinate of the last cell
     * @throws	Exception
     */
    public function unmergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 0, $pColumn2 = 0, $pRow2 = 0)
    {
    	$cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2;
    	$this->unmergeCells($cellRange);
    }

    /**
     * Get merge cells
     *
     * @return array[]
     */
    public function getMergeCells()
    {
    	return $this->_mergeCells;
    }

    /**
     * Set protection on a cell range
     *
     * @param 	string			$pRange				Cell (e.g. A1) or cell range (e.g. A1:E1)
     * @param 	string			$pPassword			Password to unlock the protection
     * @param 	boolean 		$pAlreadyHashed 	If the password has already been hashed, set this to true
     * @throws	Exception
     */
    public function protectCells($pRange = 'A1', $pPassword = '', $pAlreadyHashed = false)
    {
    	// Uppercase coordinate
    	$pRange = strtoupper($pRange);

    	if (!$pAlreadyHashed) {
    		$pPassword = PHPExcel_Shared_PasswordHasher::hashPassword($pPassword);
    	}
    	$this->_protectedCells[$pRange] = $pPassword;
    }

    /**
     * Set protection on a cell range by using numeric cell coordinates
     *
     * @param 	int 	$pColumn1			Numeric column coordinate of the first cell
     * @param 	int 	$pRow1				Numeric row coordinate of the first cell
     * @param 	int 	$pColumn2			Numeric column coordinate of the last cell
     * @param 	int 	$pRow2				Numeric row coordinate of the last cell
     * @param 	string	$pPassword			Password to unlock the protection
     * @param 	boolean $pAlreadyHashed 	If the password has already been hashed, set this to true
     * @throws	Exception
     */
    public function protectCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 0, $pColumn2 = 0, $pRow2 = 0, $pPassword = '', $pAlreadyHashed = false)
    {
    	$cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2;
    	$this->protectCells($cellRange, $pPassword, $pAlreadyHashed);
    }

    /**
     * Remove protection on a cell range
     *
     * @param 	string			$pRange		Cell (e.g. A1) or cell range (e.g. A1:E1)
     * @throws	Exception
     */
    public function unprotectCells($pRange = 'A1')
    {
    	// Uppercase coordinate
    	$pRange = strtoupper($pRange);

    	if (isset($this->_protectedCells[$pRange])) {
    		unset($this->_protectedCells[$pRange]);
    	} else {
    		throw new Exception('Cell range ' . $pRange . ' not known as protected.');
    	}
    }

    /**
     * Remove protection on a cell range by using numeric cell coordinates
     *
     * @param 	int 	$pColumn1			Numeric column coordinate of the first cell
     * @param 	int 	$pRow1				Numeric row coordinate of the first cell
     * @param 	int 	$pColumn2			Numeric column coordinate of the last cell
     * @param 	int 	$pRow2				Numeric row coordinate of the last cell
     * @param 	string	$pPassword			Password to unlock the protection
     * @param 	boolean $pAlreadyHashed 	If the password has already been hashed, set this to true
     * @throws	Exception
     */
    public function unprotectCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 0, $pColumn2 = 0, $pRow2 = 0, $pPassword = '', $pAlreadyHashed = false)
    {
    	$cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2;
    	$this->unprotectCells($cellRange, $pPassword, $pAlreadyHashed);
    }

    /**
     * Get protected cells
     *
     * @return array[]
     */
    public function getProtectedCells()
    {
    	return $this->_protectedCells;
    }

    /**
     * Get Autofilter Range
     *
     * @return string
     */
    public function getAutoFilter()
    {
    	return $this->_autoFilter;
    }

    /**
     * Set Autofilter Range
     *
     * @param 	string		$pRange		Cell range (i.e. A1:E10)
     * @throws 	Exception
     */
    public function setAutoFilter($pRange = '')
    {
    	// Uppercase coordinate
    	$pRange = strtoupper($pRange);

    	if (strpos($pRange,':') !== false) {
    		$this->_autoFilter = $pRange;
    	} else {
    		throw new Exception('Autofilter must be set on a range of cells.');
    	}
    }

    /**
     * Set Autofilter Range by using numeric cell coordinates
     *
     * @param 	int 	$pColumn1	Numeric column coordinate of the first cell
     * @param 	int 	$pRow1		Numeric row coordinate of the first cell
     * @param 	int 	$pColumn2	Numeric column coordinate of the second cell
     * @param 	int 	$pRow2		Numeric row coordinate of the second cell
     * @throws 	Exception
     */
    public function setAutoFilterByColumnAndRow($pColumn1 = 0, $pRow1 = 0, $pColumn2 = 0, $pRow2 = 0)
    {
    	$this->setAutoFilter(
    		PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1
    		. ':' .
    		PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2
    	);
    }

    /**
     * Get Freeze Pane
     *
     * @return string
     */
    public function getFreezePane()
    {
    	return $this->_freezePane;
    }

    /**
     * Freeze Pane
     *
     * @param 	string		$pCell		Cell (i.e. A1)
     * @throws 	Exception
     */
    public function freezePane($pCell = '')
    {
    	// Uppercase coordinate
    	$pCell = strtoupper($pCell);

    	if (strpos($pCell,':') === false && strpos($pCell,',') === false) {
    		$this->_freezePane = $pCell;
    	} else {
    		throw new Exception('Freeze pane can not be set on a range of cells.');
    	}
    }

    /**
     * Freeze Pane by using numeric cell coordinates
     *
     * @param 	int 	$pColumn	Numeric column coordinate of the cell
     * @param 	int 	$pRow		Numeric row coordinate of the cell
     * @throws 	Exception
     */
    public function freezePaneByColumnAndRow($pColumn = 0, $pRow = 0)
    {
    	$this->freezePane(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow);
    }

    /**
     * Unfreeze Pane
     *
     * @return string
     */
    public function unfreezePane()
    {
    	$this->freezePane('');
    }

    /**
     * Insert a new row, updating all possible related data
     *
     * @param 	int	$pBefore	Insert before this one
     * @param 	int	$pNumRows	Number of rows to insert
     * @throws 	Exception
     */
    public function insertNewRowBefore($pBefore = 1, $pNumRows = 1) {
    	if ($pBefore >= 1) {
    		$objReferenceHelper = PHPExcel_ReferenceHelper::getInstance();
    		$objReferenceHelper->insertNewBefore('A' . $pBefore, 0, $pNumRows, $this);
    	} else {
    		throw new Exception("Rows can only be inserted before at least row 1.");
    	}
    }

    /**
     * Insert a new column, updating all possible related data
     *
     * @param 	int	$pBefore	Insert before this one
     * @param 	int	$pNumCols	Number of columns to insert
     * @throws 	Exception
     */
    public function insertNewColumnBefore($pBefore = 'A', $pNumCols = 1) {
    	if (!is_numeric($pBefore)) {
    		$objReferenceHelper = PHPExcel_ReferenceHelper::getInstance();
    		$objReferenceHelper->insertNewBefore($pBefore . '1', $pNumCols, 0, $this);
    	} else {
    		throw new Exception("Column references should not be numeric.");
    	}
    }

    /**
     * Insert a new column, updating all possible related data
     *
     * @param 	int	$pBefore	Insert before this one (numeric column coordinate of the cell)
     * @param 	int	$pNumCols	Number of columns to insert
     * @throws 	Exception
     */
    public function insertNewColumnBeforeByIndex($pBefore = 0, $pNumCols = 1) {
    	if ($pBefore >= 0) {
    		$this->insertNewColumnBefore(PHPExcel_Cell::stringFromColumnIndex($pBefore), $pNumCols);
    	} else {
    		throw new Exception("Columns can only be inserted before at least column A (0).");
    	}
    }

    /**
     * Delete a row, updating all possible related data
     *
     * @param 	int	$pRow		Remove starting with this one
     * @param 	int	$pNumRows	Number of rows to remove
     * @throws 	Exception
     */
    public function removeRow($pRow = 1, $pNumRows = 1) {
    	if ($pRow >= 1) {
    		$objReferenceHelper = PHPExcel_ReferenceHelper::getInstance();
    		$objReferenceHelper->insertNewBefore('A' . ($pRow + $pNumRows), 0, -$pNumRows, $this);
    	} else {
    		throw new Exception("Rows to be deleted should at least start from row 1.");
    	}
    }

    /**
     * Remove a column, updating all possible related data
     *
     * @param 	int	$pColumn	Remove starting with this one
     * @param 	int	$pNumCols	Number of columns to remove
     * @throws 	Exception
     */
    public function removeColumn($pColumn = 'A', $pNumCols = 1) {
    	if (!is_numeric($pColumn)) {
    		$pColumn = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($pColumn) - 1 + $pNumCols);
    		$objReferenceHelper = PHPExcel_ReferenceHelper::getInstance();
    		$objReferenceHelper->insertNewBefore($pColumn . '1', -$pNumCols, 0, $this);
    	} else {
    		throw new Exception("Column references should not be numeric.");
    	}
    }

    /**
     * Remove a column, updating all possible related data
     *
     * @param 	int	$pColumn	Remove starting with this one (numeric column coordinate of the cell)
     * @param 	int	$pNumCols	Number of columns to remove
     * @throws 	Exception
     */
    public function removeColumnByIndex($pColumn = 0, $pNumCols = 1) {
    	if ($pColumn >= 0) {
    		$this->removeColumn(PHPExcel_Cell::stringFromColumnIndex($pColumn), $pNumCols);
    	} else {
    		throw new Exception("Columns can only be inserted before at least column A (0).");
    	}
    }

    /**
     * Show gridlines?
     *
     * @return boolean
     */
    public function getShowGridlines() {
    	return $this->_showGridlines;
    }

    /**
     * Set show gridlines
     *
     * @param boolean $pValue	Show gridlines (true/false)
     */
    public function setShowGridlines($pValue = false) {
    	$this->_showGridlines = $pValue;
    }

	/**
	* Print gridlines?
	*
	* @return boolean
	*/
	public function getPrintGridlines() {
		return $this->_printGridlines;
	}

	/**
	* Set print gridlines
	*
	* @param boolean $pValue Print gridlines (true/false)
	*/
	public function setPrintGridlines($pValue = false) {
		$this->_printGridlines = $pValue;
	}

    /**
     * Show summary below? (Row/Column outlining)
     *
     * @return boolean
     */
    public function getShowSummaryBelow() {
    	return $this->_showSummaryBelow;
    }

    /**
     * Set show summary below
     *
     * @param boolean $pValue	Show summary below (true/false)
     */
    public function setShowSummaryBelow($pValue = true) {
    	$this->_showSummaryBelow = $pValue;
    }

    /**
     * Show summary right? (Row/Column outlining)
     *
     * @return boolean
     */
    public function getShowSummaryRight() {
    	return $this->_showSummaryRight;
    }

    /**
     * Set show summary right
     *
     * @param boolean $pValue	Show summary right (true/false)
     */
    public function setShowSummaryRight($pValue = true) {
    	$this->_showSummaryRight = $pValue;
    }

    /**
     * Get comments
     *
     * @return PHPExcel_Comment[]
     */
    public function getComments()
    {
    	return $this->_comments;
    }

    /**
     * Get comment for cell
     *
     * @param 	string 	$pCellCoordinate	Cell coordinate to get comment for
     * @return 	PHPExcel_Comment
     * @throws 	Exception
     */
    public function getComment($pCellCoordinate = 'A1')
    {
    	// Uppercase coordinate
    	$pCellCoordinate = strtoupper($pCellCoordinate);

    	if (strpos($pCellCoordinate,':') !== false || strpos($pCellCoordinate,',') !== false) {
    		throw new Exception('Cell coordinate string can not be a range of cells.');
    	} else if (strpos($pCellCoordinate,'$') !== false) {
    		throw new Exception('Cell coordinate string must not be absolute.');
    	} else if ($pCellCoordinate == '') {
    		throw new Exception('Cell coordinate can not be zero-length string.');
    	} else {
    		// Check if we already have a comment for this cell.
    		// If not, create a new comment.
    		if (isset($this->_comments[$pCellCoordinate])) {
    			return $this->_comments[$pCellCoordinate];
    		} else {
    			$newComment = new PHPExcel_Comment();
    			$this->_comments[$pCellCoordinate] = $newComment;
    			return $newComment;
    		}
    	}
    }

    /**
     * Get comment for cell by using numeric cell coordinates
     *
     * @param 	int $pColumn	Numeric column coordinate of the cell
     * @param 	int $pRow		Numeric row coordinate of the cell
     * @return 	PHPExcel_Comment
     */
    public function getCommentByColumnAndRow($pColumn = 0, $pRow = 0)
    {
    	return $this->getComment(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow);
    }

    /**
     * Get selected cell
     *
     * @return string
     */
    public function getSelectedCell()
    {
    	return $this->_selectedCell;
    }

    /**
     * Selected cell
     *
     * @param 	string		$pCell		Cell (i.e. A1)
     * @throws 	Exception
     */
    public function setSelectedCell($pCell = '')
    {
    	// Uppercase coordinate
    	$pCell = strtoupper($pCell);

    	if (strpos($pCoordinate,':') !== false || strpos($pCoordinate,',') !== false) {
    		$this->_selectedCell = $pCell;
    	} else {
    		throw new Exception('Selected cell can not be set on a range of cells.');
    	}
    }

    /**
     * Selected cell by using numeric cell coordinates
     *
     * @param 	int 	$pColumn	Numeric column coordinate of the cell
     * @param 	int 	$pRow		Numeric row coordinate of the cell
     * @throws 	Exception
     */
    public function setSelectedCellByColumnAndRow($pColumn = 0, $pRow = 0)
    {
    	$this->setSelectedCell(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow);
    }

    /**
     * Fill worksheet from values in array
     *
     * @param array $source	Source array
     * @param mixed $nullValue Value treated as "null"
     * @throws Exception
     */
    public function fromArray($source = null, $nullValue = null) {
    	if (is_array($source)) {
			// Loop trough $source
			$currentRow = 0;
			$rowData = null;
			foreach ($source as $rowData) {
				++$currentRow;

				$rowCount = count($rowData);
				for ($i = 0; $i < $rowCount; ++$i) {
					if ($rowData[$i] != $nullValue) {
						// Set cell value
						$this->setCellValue(
							PHPExcel_Cell::stringFromColumnIndex($i) . $currentRow, $rowData[$i]
						);
					}
				}
			}
    	} else {
    		throw new Exception("Parameter \$source should be an array.");
    	}
    }

    /**
     * Create array from worksheet
     *
     * @param mixed $nullValue Value treated as "null"
     * @param boolean $calculateFormulas Should formulas be calculated?
     * @return array
     */
    public function toArray($nullValue = null, $calculateFormulas = true) {
    	// Returnvalue
    	$returnValue = array();

        // Garbage collect...
        $this->garbageCollect();

    	// Get worksheet dimension
    	$dimension = explode(':', $this->calculateWorksheetDimension());
    	$dimension[0] = PHPExcel_Cell::coordinateFromString($dimension[0]);
    	$dimension[0][0] = PHPExcel_Cell::columnIndexFromString($dimension[0][0]) - 1;
    	$dimension[1] = PHPExcel_Cell::coordinateFromString($dimension[1]);
    	$dimension[1][0] = PHPExcel_Cell::columnIndexFromString($dimension[1][0]) - 1;

    	// Loop trough cells
    	for ($row = $dimension[0][1]; $row <= $dimension[1][1]; ++$row) {
    		for ($column = $dimension[0][0]; $column <= $dimension[1][0]; ++$column) {
    			// Cell exists?
    			if ($this->cellExistsByColumnAndRow($column, $row)) {
    				$cell = $this->getCellByColumnAndRow($column, $row);

    				if ($cell->getValue() instanceof PHPExcel_RichText) {
    					$returnValue[$row][$column] = $cell->getValue()->getPlainText();
    				} else {
	    				if ($calculateFormulas) {
	    					$returnValue[$row][$column] = $cell->getCalculatedValue();
	    				} else {
	    					$returnValue[$row][$column] = $cell->getValue();
	    				}
    				}

					$style = $this->_parent->getCellXfByIndex($cell->getXfIndex());

    				$returnValue[$row][$column] = PHPExcel_Style_NumberFormat::toFormattedString($returnValue[$row][$column], $style->getNumberFormat()->getFormatCode());
    			} else {
    				$returnValue[$row][$column] = $nullValue;
    			}
    		}
    	}

    	// Return
    	return $returnValue;
    }

	/**
	 * Get row iterator
	 *
	 * @return PHPExcel_Worksheet_RowIterator
	 */
	public function getRowIterator() {
		return new PHPExcel_Worksheet_RowIterator($this);
	}

    /**
     * Run PHPExcel garabage collector.
     */
    public function garbageCollect() {
    	// Build a reference table from images
    	$imageCoordinates = array();
  		$iterator = $this->getDrawingCollection()->getIterator();
   		while ($iterator->valid()) {
   			$imageCoordinates[$iterator->current()->getCoordinates()] = true;

   			$iterator->next();
   		}

    	// Find cells that can be cleaned
    	foreach ($this->_cellCollection as $coordinate => $cell) {
    		// Can be cleaned?
    		$canBeCleaned = false;

    		// Empty value?
    		if (is_null($cell->getValue()) || (!is_object($cell->getValue()) && $cell->getValue() === '' && !$cell->hasHyperlink())) {
				// default style ?
				if ($cell->getXfIndex() == 0) {
					$canBeCleaned = true;
				}
    		}

    		// Referenced in image?
    		if (isset($imageCoordinates[$coordinate]) && $imageCoordinates[$coordinate] === true) {
    			$canBeCleaned = false;
    		}

    		// Clean?
    		if ($canBeCleaned) {
    			unset($this->_cellCollection[$coordinate]);
    		}
    	}
    }

	/**
	 * Get hash code
	 *
	 * @return string	Hash code
	 */
	public function getHashCode() {
    	return md5(
    		  $this->_title
    		. $this->_autoFilter
    		. ($this->_protection->isProtectionEnabled() ? 't' : 'f')
    		//. $this->calculateWorksheetDimension()
    		. __CLASS__
    	);
    }

    /**
     * Hash index
     *
     * @var string
     */
    private $_hashIndex;

	/**
	 * Get hash index
	 *
	 * Note that this index may vary during script execution! Only reliable moment is
	 * while doing a write of a workbook and when changes are not allowed.
	 *
	 * @return string	Hash index
	 */
	public function getHashIndex() {
		return $this->_hashIndex;
	}

	/**
	 * Set hash index
	 *
	 * Note that this index may vary during script execution! Only reliable moment is
	 * while doing a write of a workbook and when changes are not allowed.
	 *
	 * @param string	$value	Hash index
	 */
	public function setHashIndex($value) {
		$this->_hashIndex = $value;
	}

    /**
     * Extract worksheet title from range.
     *
     * Example: extractSheetTitle('test!A1') ==> 'test'
     * Example: extractSheetTitle('test!A1', true) ==> array('test', 'A1');
     *
     * @param string $pRange	Range to extract title from
     * @param bool $returnRange	Return range? (see example)
     * @return mixed
     */
    public static function extractSheetTitle($pRange, $returnRange = false) {
    	// Sheet title included?
    	if (strpos($pRange, '!') === false) {
    		return '';
    	}

    	// Extract sheet title
    	$reference = explode('!', $pRange);
    	//$reference[0] = str_replace("'", "", $reference[0]);

    	if ($returnRange) {
    		return $reference;
    	} else {
    		return $reference[1];
    	}
    }

	/**
	 * Copy worksheet (!= clone!)
	 *
	 * @return PHPExcel_Worksheet
	 */
	public function copy() {
		$copied = clone $this;

		foreach ($copied->_cellCollection as $coordinate => $cell) {
			$newCell = clone $cell;
			$newCell->rebindParent($copied);
			$copied->_cellCollection[$coordinate] = $newCell;
		}

		return $copied;
	}

	/**
	 * Implement PHP __clone to create a deep clone, not just a shallow copy.
	 */
	public function __clone() {
		$vars = get_object_vars($this);
		foreach ($vars as $key => $value) {
			if (is_object($value)) {
				$this->$key = clone $value;
			} else {
				$this->$key = $value;
			}
		}
	}
}

redpajama_set_name: RedPajamaGithub


text:
package cz.muni.fi.pa165.mushrooms.mvc.controllers;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

import cz.muni.fi.pa165.mushrooms.dto.MushroomHunterAuthenticateDTO;
import cz.muni.fi.pa165.mushrooms.dto.MushroomHunterCreateDTO;
import cz.muni.fi.pa165.mushrooms.dto.MushroomHunterDTO;
import cz.muni.fi.pa165.mushrooms.facade.MushroomHunterFacade;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import org.springframework.web.util.UriComponentsBuilder;

@Controller
@RequestMapping("/auth")
public class AuthenticationController {

    private final static Logger log = LoggerFactory.getLogger(AuthenticationController.class);

    @Autowired
    private MushroomHunterFacade hunterFacade;

    @RequestMapping(value = "", method = RequestMethod.GET)
    public String loginUser(Model model, HttpServletRequest request) {

        if(request.getSession().getAttribute("user") != null){
            return "home";
        }

        log.debug("[AUTH] Login");

        model.addAttribute("userLogin", new MushroomHunterAuthenticateDTO());
        return "/auth/login";
    }

    @RequestMapping(value = "/logout", method = RequestMethod.GET)
    public String logoutUser(Model model, HttpServletRequest request) {
        log.debug("[AUTH] Logout");
        request.getSession().removeAttribute("user");
        return "home";
    }

    @RequestMapping(value = "/register", method = RequestMethod.GET)
    public String registerUser(Model model, HttpServletRequest request) {
        log.debug("[AUTH] Register");
        model.addAttribute("userRegister", new MushroomHunterCreateDTO());
        return "auth/register";
    }

    @RequestMapping(value = "/register", method = RequestMethod.POST)
    public String register(@Valid @ModelAttribute("userRegister") MushroomHunterCreateDTO formBean, BindingResult bindingResult,
        Model model, RedirectAttributes redirectAttributes, UriComponentsBuilder uriBuilder, HttpServletRequest request) {
        log.debug("register(userRegister={})", formBean);

        if (bindingResult.hasErrors()) {
            for (ObjectError ge : bindingResult.getGlobalErrors()) {
                log.debug("ObjectError: {}", ge);
            }
            for (FieldError fe : bindingResult.getFieldErrors()) {
                model.addAttribute(fe.getField() + "_error", true);
                log.debug("FieldError: {}", fe);
            }

            model.addAttribute("userRegister", formBean);
            return "/auth/register";
        }

        if(hunterFacade.findHunterByNickname(formBean.getUserNickname()) != null){
            redirectAttributes.addFlashAttribute("alert_warning", "Nick " + formBean.getUserNickname() + " already exists!");
            return "redirect:" + uriBuilder.path("/auth/register").build().toUriString();
        }

        MushroomHunterDTO user = hunterFacade.registerHunter(formBean);
        request.getSession().setAttribute("user", user);
        //report success
        redirectAttributes.addFlashAttribute("alert_success", "Register " + formBean.getUserNickname() + " succeeded");

        return "redirect:" + uriBuilder.path("/").build().toUriString(); //TODO: change to "profile" page
    }

    @RequestMapping(value = "/login", method = RequestMethod.POST)
    public String login(@Valid @ModelAttribute("userLogin") MushroomHunterAuthenticateDTO formBean, BindingResult bindingResult,
        Model model, RedirectAttributes redirectAttributes, UriComponentsBuilder uriBuilder, HttpServletRequest request) {
        log.debug("login(userLogin={})", formBean);

        if (bindingResult.hasErrors()) {
            for (ObjectError ge : bindingResult.getGlobalErrors()) {
                log.debug("ObjectError: {}", ge);
            }
            for (FieldError fe : bindingResult.getFieldErrors()) {
                model.addAttribute(fe.getField() + "_error", true);
                log.debug("FieldError: {}", fe);
            }
            model.addAttribute("userLogin", new MushroomHunterAuthenticateDTO());
            return "/auth/login";
        }

        MushroomHunterDTO matchingUser = hunterFacade.findHunterByNickname(formBean.getNickname());
        if(matchingUser==null) {
            log.warn("no user with nick {}", formBean.getNickname());
            redirectAttributes.addFlashAttribute("alert_warning", "No user with nick: " + formBean.getNickname());
            return "redirect:" + uriBuilder.path("/auth").build().toUriString();
        }

        if (!hunterFacade.authenticate(formBean)) {
            log.warn("wrong credentials: user={} password={}", formBean.getNickname(), formBean.getPassword());
            redirectAttributes.addFlashAttribute("alert_warning", "Login " + formBean.getNickname() + " failed ");
            return "redirect:" + uriBuilder.path("/auth").build().toUriString();
        }
        request.getSession().setAttribute("user", matchingUser);
        //report success
        redirectAttributes.addFlashAttribute("alert_success", "Login " + formBean.getNickname() + " succeeded ");
        return "redirect:" + uriBuilder.path("/hunters/read/" + matchingUser.getId()).build().toUriString();
    }
}


text:
package com.dmdirc.events;

import com.dmdirc.interfaces.Connection;

/**
 * Event raised when a reconnection attempt has been scheduled.
 */
public class ServerReconnectScheduledEvent extends ServerDisplayableEvent {

    private final int seconds;

    public ServerReconnectScheduledEvent(final Connection connection, final int seconds) {
        super(connection);
        this.seconds = seconds;
    }

    public int getSeconds() {
        return seconds;
    }

}


text:
package org.jboss.migration.wfly10.to.eap7;

import org.jboss.migration.core.jboss.JBossSubsystemNames;
import org.jboss.migration.wfly10.config.task.management.subsystem.UpdateSubsystemResources;
import org.jboss.migration.wfly11.task.subsystem.undertow.AddHttpInvoker;
import org.jboss.migration.wfly13.task.subsystem.undertow.UnsetDefaultHostResponseHeaderServer;
import org.jboss.migration.wfly13.task.subsystem.undertow.UnsetDefaultHostResponseHeaderXPoweredBy;

/**
 * @author emmartins
 */
public class WildFly10_1ToEAP7_2UpdateUndertowSubsystem<S> extends UpdateSubsystemResources<S> {
    public WildFly10_1ToEAP7_2UpdateUndertowSubsystem() {
        super(JBossSubsystemNames.UNDERTOW,
                new UnsetDefaultHostResponseHeaderServer<>(),
                new UnsetDefaultHostResponseHeaderXPoweredBy<>(),
                new AddHttpInvoker<>());
    }
}


text:
using UnityEngine;
using UnityEditor;
using UnityEditorInternal;

namespace Polybrush
{
	[CustomEditor(typeof(z_ColorPalette))]
	public class z_ColorPaletteEditor : Editor
	{
		public class DragState
		{
			public enum Status
			{
				Ready,
				Dragging,
				DragInvalid
			}

			private Status _status = Status.Ready;
			private Status queued_status = Status.Ready;
			public SerializedProperty swatch;
			private int _sourceIndex;
			private int _destinationIndex;
			private int queued_destinationIndex, queued_sourceIndex;
			public Vector2 offset;

			public Status status {
				get {
					return _status;
				}

				set {
					queued_status = value;
					wantsUpdate = true;
				}
			}

			public int sourceIndex {
				get {
					return _sourceIndex;
				}

				set {
					queued_sourceIndex = value;
					wantsUpdate = true;
				}
			}

			public int destinationIndex {
				get {
					return _destinationIndex;
				}

				set {
					queued_destinationIndex = value;
					wantsUpdate = true;
				}
			}

			private bool wantsUpdate = false;
			private bool isBetweenRepaint = true;

			public void Init(int index, SerializedProperty swatch, Vector2 mouseOffset)
			{
				this.sourceIndex = index;
				this.destinationIndex = index;
				this.swatch = swatch;
				this.status = Status.Dragging;
				this.offset = mouseOffset;
				this.isBetweenRepaint = true;
				this.wantsUpdate = true;
			}

			public void Reset()
			{
				this.status = DragState.Status.Ready;
				this.swatch = null;
				this.sourceIndex = -1;
				this.destinationIndex = -1;
			}

			public void Update(Event e)
			{
				if(e.type == EventType.Layout)
					isBetweenRepaint = true;
				else if(e.type == EventType.Repaint)
					isBetweenRepaint = false;

				if(!wantsUpdate || isBetweenRepaint)
					return;

				wantsUpdate = false;

				_status = queued_status;
				_sourceIndex = queued_sourceIndex;
				_destinationIndex = queued_destinationIndex;

				z_Editor.DoRepaint();
			}

			public override string ToString()
			{
				return string.Format("{0}: {1} -> {2}", status, sourceIndex, destinationIndex);
			}
		}

		private SerializedProperty currentProperty;
		private SerializedProperty colorsProperty;

		public Delegate<Color> onSelectIndex = null;
		public Delegate<z_ColorPalette> onSaveAs = null;

		DragState drag = new DragState();
		const int DRAG_OVER_NULL = -1;
		const int DRAG_OVER_TRASH = -42;

		GUIContent gc_AddColorSwatch = new GUIContent( (Texture2D) null, "Add Selected Color to Palette");

		private void OnEnable()
		{
			currentProperty = serializedObject.FindProperty("current");
			colorsProperty = serializedObject.FindProperty("colors");
			gc_AddColorSwatch.image = z_IconUtility.GetIcon("Icon/AddColor");
		}

		private void SetCurrent(Color color)
		{
			if(onSelectIndex != null)
				onSelectIndex(color);

			currentProperty.colorValue = color;
		}

		int IncrementIndex(int index, int rowSize)
		{
			index++;

			if(index % rowSize == 0)
			{
				GUILayout.EndHorizontal();
				GUILayout.BeginHorizontal();
			}

			return index;
		}

		public override void OnInspectorGUI()
		{
			z_GUI.PushGUISkin(z_GUI.PolybrushSkin);

			Event e = Event.current;

			serializedObject.Update();

			Color current = currentProperty.colorValue;

			z_GUI.PushUnitySkin();
			EditorGUI.BeginChangeCheck();
			current = EditorGUILayout.ColorField(current);
			if(EditorGUI.EndChangeCheck())
				SetCurrent(current);
			z_GUI.PopGUISkin();

			int swatchSize = 18;
			int viewWidth = (int) EditorGUIUtility.currentViewWidth - 12;
			int swatchesPerRow = viewWidth / (swatchSize + 4);
			swatchSize += (viewWidth % (swatchSize + 4)) / swatchesPerRow;

			GUILayout.BeginHorizontal();

			int mouseOverIndex = DRAG_OVER_NULL;
			int index = 0;
			int arraySize = colorsProperty.arraySize;
			int arraySizeWithAdd = colorsProperty.arraySize + 1;

			for(int i = 0; i < arraySizeWithAdd; i++)
			{
				bool isColorSwatch = i < arraySize;
				bool isActiveDrag = drag.status == DragState.Status.Dragging && drag.destinationIndex == i && i != arraySizeWithAdd - 1;
				SerializedProperty swatch = isColorSwatch ? colorsProperty.GetArrayElementAtIndex(i) : null;
				Rect swatchRect = new Rect(-1f, -1f, 0f, 0f);

				if(isActiveDrag)
				{
					GUILayout.Space(swatchSize + 4);
					index = IncrementIndex(index, swatchesPerRow);
				}

				if(isColorSwatch)
				{
					GUI.backgroundColor = swatch.colorValue;

					if(drag.status != DragState.Status.Dragging || i != drag.sourceIndex)
					{
						GUILayout.Label("", "ColorSwatch",
								GUILayout.MinWidth(swatchSize),
								GUILayout.MaxWidth(swatchSize),
								GUILayout.MinHeight(swatchSize),
								GUILayout.MaxHeight(swatchSize) );

						swatchRect = GUILayoutUtility.GetLastRect();

						index = IncrementIndex(index, swatchesPerRow);
					}
				}
				else
				{
					if( drag.status != DragState.Status.Dragging )
					{
						GUI.backgroundColor = current;

						if( GUILayout.Button(gc_AddColorSwatch, "ColorSwatch",
								GUILayout.MinWidth(swatchSize),
								GUILayout.MaxWidth(swatchSize),
								GUILayout.MinHeight(swatchSize),
								GUILayout.MaxHeight(swatchSize) ))
						{
							colorsProperty.arraySize++;
							SerializedProperty added = colorsProperty.GetArrayElementAtIndex(colorsProperty.arraySize - 1);
							added.colorValue = current;
						}
					}
					else
					{
						GUILayout.FlexibleSpace();
						GUILayout.Label(z_IconUtility.GetIcon("Icon/Trashcan"));
					}

					swatchRect = GUILayoutUtility.GetLastRect();
					index = IncrementIndex(index, swatchesPerRow);
				}

				GUI.backgroundColor = Color.white;

				if( swatchRect.Contains(e.mousePosition) )
				{
					if(drag.status == DragState.Status.Dragging)
						mouseOverIndex = i >= drag.destinationIndex ? i + 1 : i;
					else
						mouseOverIndex = i;

					if(i == arraySize)
						mouseOverIndex = DRAG_OVER_TRASH;

					if(e.type == EventType.MouseDrag)
					{
						if( drag.status == DragState.Status.Ready && isColorSwatch )
						{
							e.Use();
							drag.Init(mouseOverIndex, colorsProperty.GetArrayElementAtIndex(mouseOverIndex), swatchRect.position - e.mousePosition);
						}
						else if(drag.status == DragState.Status.Dragging)
						{
							drag.destinationIndex = mouseOverIndex;
						}
					}
					else if(e.type == EventType.MouseUp && drag.status != DragState.Status.Dragging &&  isColorSwatch)
					{
						if( onSelectIndex != null )
						{
							SetCurrent(swatch.colorValue);
						}
					}
				}
			}

			GUILayout.EndHorizontal();

			// If drag was previously over the trash bin but has moved, reset the index to be over the last array entry
			// instead.
			if( e.type == EventType.MouseDrag &&
				drag.status == DragState.Status.Dragging &&
				mouseOverIndex == DRAG_OVER_NULL &&
				drag.destinationIndex == DRAG_OVER_TRASH)
			{
				drag.destinationIndex = arraySize;
			}

			bool dragIsOverTrash = drag.destinationIndex == DRAG_OVER_TRASH;

			if(drag.status == DragState.Status.Dragging && drag.swatch != null)
			{
				Rect r = new Rect(e.mousePosition.x + drag.offset.x, e.mousePosition.y + drag.offset.y, swatchSize, swatchSize);
				GUI.backgroundColor = drag.swatch.colorValue;
				GUI.Label(r, "", dragIsOverTrash ? "ColorSwatchGhost" : "ColorSwatch");
				GUI.backgroundColor = Color.white;

				z_Editor.DoRepaint();
				Repaint();
			}

			switch( e.type )
			{
				case EventType.MouseUp:
				{
					if(drag.status == DragState.Status.Dragging)
					{
						if(drag.destinationIndex != DRAG_OVER_NULL)
						{
							if(dragIsOverTrash)
								colorsProperty.DeleteArrayElementAtIndex(drag.sourceIndex);
							else
								colorsProperty.MoveArrayElement(drag.sourceIndex, drag.destinationIndex > drag.sourceIndex ? drag.destinationIndex - 1 : drag.destinationIndex);
						}
					}

					drag.Reset();

					z_Editor.DoRepaint();
					Repaint();
				}
				break;
			}

			serializedObject.ApplyModifiedProperties();
			drag.Update(e);

			z_GUI.PopGUISkin();
		}

		private void DrawHeader(Rect rect)
		{
			EditorGUI.LabelField(rect, serializedObject.targetObject.name);
		}

		private void DrawListElement(Rect rect, int index, bool isActive, bool isFocused)
		{
			SerializedProperty col = colorsProperty.GetArrayElementAtIndex(index);
			Rect r = new Rect(rect.x, rect.y + 2, rect.width, rect.height - 5);
			EditorGUI.PropertyField(r, col);
		}

		private void OnAddItem(ReorderableList list)
		{
			ReorderableList.defaultBehaviours.DoAddButton(list);

			SerializedProperty col = colorsProperty.GetArrayElementAtIndex(list.index);
			col.colorValue = Color.white;
		}

		public static z_ColorPalette AddNew()
		{
			string path = z_EditorUtility.FindFolder(z_Pref.ProductName + "/" + "Color Palettes");

			if(string.IsNullOrEmpty(path))
				path = "Assets";

			path = AssetDatabase.GenerateUniqueAssetPath(path + "/New Color Palette.asset");

			if(!string.IsNullOrEmpty(path))
			{
				z_ColorPalette palette = ScriptableObject.CreateInstance<z_ColorPalette>();
				palette.SetDefaultValues();

				AssetDatabase.CreateAsset(palette, path);
				AssetDatabase.Refresh();

				EditorGUIUtility.PingObject(palette);

				return palette;
			}

			return null;
		}
	}
}


text:
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008-2016. All Rights Reserved.                        */
/* Open Source Software - may be modified and shared by FRC teams. The code   */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project.                                                               */
/*----------------------------------------------------------------------------*/

#include "ADXL345_I2C.h"
#include "I2C.h"
#include "HAL/HAL.hpp"
#include "LiveWindow/LiveWindow.h"

const uint8_t ADXL345_I2C::kAddress;
const uint8_t ADXL345_I2C::kPowerCtlRegister;
const uint8_t ADXL345_I2C::kDataFormatRegister;
const uint8_t ADXL345_I2C::kDataRegister;
constexpr double ADXL345_I2C::kGsPerLSB;

/**
 * Constructs the ADXL345 Accelerometer over I2C.
 *
 * @param port The I2C port the accelerometer is attached to
 * @param range The range (+ or -) that the accelerometer will measure.
 * @param deviceAddress the I2C address of the accelerometer (0x1D or 0x53)
 */
ADXL345_I2C::ADXL345_I2C(Port port, Range range, int deviceAddress) : I2C(port, deviceAddress) {
  // Turn on the measurements
  Write(kPowerCtlRegister, kPowerCtl_Measure);
  // Specify the data format to read
  SetRange(range);

  HALReport(HALUsageReporting::kResourceType_ADXL345,
            HALUsageReporting::kADXL345_I2C, 0);
  LiveWindow::GetInstance()->AddSensor("ADXL345_I2C", port, this);
}

/** {@inheritdoc} */
void ADXL345_I2C::SetRange(Range range) {
  Write(kDataFormatRegister, kDataFormat_FullRes | (uint8_t)range);
}

/** {@inheritdoc} */
double ADXL345_I2C::GetX() { return GetAcceleration(kAxis_X); }

/** {@inheritdoc} */
double ADXL345_I2C::GetY() { return GetAcceleration(kAxis_Y); }

/** {@inheritdoc} */
double ADXL345_I2C::GetZ() { return GetAcceleration(kAxis_Z); }

/**
 * Get the acceleration of one axis in Gs.
 *
 * @param axis The axis to read from.
 * @return Acceleration of the ADXL345 in Gs.
 */
double ADXL345_I2C::GetAcceleration(ADXL345_I2C::Axes axis) {
  int16_t rawAccel = 0;
  Read(kDataRegister + (uint8_t)axis, sizeof(rawAccel), (uint8_t *)&rawAccel);
  return rawAccel * kGsPerLSB;
}

/**
 * Get the acceleration of all axes in Gs.
 *
 * @return An object containing the acceleration measured on each axis of the
 * ADXL345 in Gs.
 */
ADXL345_I2C::AllAxes ADXL345_I2C::GetAccelerations() {
  AllAxes data = AllAxes();
  int16_t rawData[3];
  Read(kDataRegister, sizeof(rawData), (uint8_t *)rawData);

  data.XAxis = rawData[0] * kGsPerLSB;
  data.YAxis = rawData[1] * kGsPerLSB;
  data.ZAxis = rawData[2] * kGsPerLSB;
  return data;
}

std::string ADXL345_I2C::GetSmartDashboardType() const {
  return "3AxisAccelerometer";
}

void ADXL345_I2C::InitTable(std::shared_ptr<ITable> subtable) {
  m_table = subtable;
  UpdateTable();
}

void ADXL345_I2C::UpdateTable() {
  m_table->PutNumber("X", GetX());
  m_table->PutNumber("Y", GetY());
  m_table->PutNumber("Z", GetZ());
}

std::shared_ptr<ITable> ADXL345_I2C::GetTable() const { return m_table; }