text
stringlengths
2
97.5k
meta
dict
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; namespace EasyNetQ { internal static class ConnectionConfigurationExtensions { public static void SetDefaultProperties(this ConnectionConfiguration configuration) { Preconditions.CheckNotNull(configuration, "configuration"); if ( configuration.AmqpConnectionString != null && configuration.Hosts.All(h => h.Host != configuration.AmqpConnectionString.Host) ) { if (configuration.Port == ConnectionConfiguration.DefaultPort) { if (configuration.AmqpConnectionString.Port > 0) configuration.Port = (ushort) configuration.AmqpConnectionString.Port; else if ( configuration.AmqpConnectionString.Scheme.Equals("amqps", StringComparison.OrdinalIgnoreCase) ) configuration.Port = ConnectionConfiguration.DefaultAmqpsPort; } if (configuration.AmqpConnectionString.Segments.Length > 1) configuration.VirtualHost = configuration.AmqpConnectionString.Segments.Last(); configuration.Hosts.Add(new HostConfiguration {Host = configuration.AmqpConnectionString.Host}); } if (configuration.Hosts.Count == 0) throw new EasyNetQException( "Invalid connection string. 'host' value must be supplied. e.g: \"host=myserver\""); foreach (var hostConfiguration in configuration.Hosts) if (hostConfiguration.Port == 0) hostConfiguration.Port = configuration.Port; #if !NETFX var version = typeof(ConnectionConfigurationExtensions).GetTypeInfo().Assembly.GetName().Version.ToString(); #else var version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); #endif var applicationNameAndPath = Environment.GetCommandLineArgs()[0]; var applicationName = "unknown"; var applicationPath = "unknown"; if (!string.IsNullOrWhiteSpace(applicationNameAndPath)) try { // Will only throw an exception if the applicationName contains invalid characters, is empty, or too long // Silently catch the exception, as we will just leave the application name and path to "unknown" applicationName = Path.GetFileName(applicationNameAndPath); applicationPath = Path.GetDirectoryName(applicationNameAndPath); } catch (ArgumentException) { } catch (PathTooLongException) { } var hostname = Environment.MachineName; var netVersion = Environment.Version.ToString(); configuration.Product ??= applicationName; configuration.Platform ??= hostname; configuration.Name ??= applicationName; AddValueIfNotExists(configuration.ClientProperties, "client_api", "EasyNetQ"); AddValueIfNotExists(configuration.ClientProperties, "product", configuration.Product); AddValueIfNotExists(configuration.ClientProperties, "platform", configuration.Platform); AddValueIfNotExists(configuration.ClientProperties, "net_version", netVersion); AddValueIfNotExists(configuration.ClientProperties, "version", version); AddValueIfNotExists(configuration.ClientProperties, "easynetq_version", version); AddValueIfNotExists(configuration.ClientProperties, "application", applicationName); AddValueIfNotExists(configuration.ClientProperties, "application_location", applicationPath); AddValueIfNotExists(configuration.ClientProperties, "machine_name", hostname); AddValueIfNotExists(configuration.ClientProperties, "timeout", configuration.Timeout.ToString()); AddValueIfNotExists( configuration.ClientProperties, "publisher_confirms", configuration.PublisherConfirms.ToString() ); AddValueIfNotExists( configuration.ClientProperties, "persistent_messages", configuration.PersistentMessages.ToString() ); } private static void AddValueIfNotExists(IDictionary<string, object> clientProperties, string name, string value) { if (!clientProperties.ContainsKey(name)) clientProperties.Add(name, value); } } }
{ "pile_set_name": "Github" }
list-file-users(1) asadmin Utility Subcommands list-file-users(1) NAME list-file-users - lists the file users SYNOPSIS list-file-users [--help] [--authrealmname auth_realm_name] [target] DESCRIPTION The list-file-users subcommand displays a list of file users supported by file realm authentication. OPTIONS --help, -? Displays the help text for the subcommand. --authrealmname Lists only the users in the specified authentication realm. OPERANDS target Specifies the target for which you want to list file users. The following values are valid: server Lists the file users on the default server instance. This is the default value. configuration_name Lists the file users in the specified configuration. cluster_name Lists the file users on all server instances in the specified cluster. instance_name Lists the file users on a specified server instance. EXAMPLES Example 1, Listing Users in a Specific File Realm The following example lists the users in the file realm named sample_file_realm. asadmin> list-file-users --authrealmname sample_file_realm sample_user05 sample_user08 sample_user12 Command list-file-users executed successfully EXIT STATUS 0 subcommand executed successfully 1 error in executing the subcommand SEE ALSO create-file-user(1), delete-file-user(1), update-file-user(1), list-file-groups(1) asadmin(1M) Java EE 8 21 Jun 2011 list-file-users(1)
{ "pile_set_name": "Github" }
/* Copyright 2016 Goldman Sachs. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package com.gs.fw.common.mithra.attribute.numericType; import com.gs.fw.common.mithra.attribute.calculator.arithmeticCalculator.ArithmeticAttributeCalculator; import com.gs.fw.common.mithra.attribute.NumericAttribute; public interface NonPrimitiveNumericType extends NumericType { public ArithmeticAttributeCalculator createDivisionCalculator(NumericAttribute attr1, NumericAttribute attr2, int scale); }
{ "pile_set_name": "Github" }
// mksyscall.pl -openbsd syscall_bsd.go syscall_openbsd.go syscall_openbsd_amd64.go // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // +build amd64,openbsd package unix import ( "syscall" "unsafe" ) var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getgroups(ngid int, gid *_Gid_t) (n int, err error) { r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(ngid int, gid *_Gid_t) (err error) { _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socket(domain int, typ int, proto int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Shutdown(s int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { var _p0 unsafe.Pointer if len(mib) > 0 { _p0 = unsafe.Pointer(&mib[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) use(_p0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func utimes(path string, timeval *[2]Timeval) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func futimes(fd int, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fcntl(fd int, cmd int, arg int) (val int, err error) { r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pipe(p *[2]_C_int) (err error) { _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chflags(path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chmod(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chown(path string, uid int, gid int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chroot(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exit(code int) { Syscall(SYS_EXIT, uintptr(code), 0, 0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchdir(fd int) (err error) { _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchflags(fd int, flags int) (err error) { _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmod(fd int, mode uint32) (err error) { _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fpathconf(fd int, name int) (val int, err error) { r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatfs(fd int, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getegid() (egid int) { r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) egid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Geteuid() (uid int) { r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) uid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getgid() (gid int) { r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) gid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgid(pid int) (pgid int, err error) { r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgrp() (pgrp int) { r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) pgrp = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpid() (pid int) { r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) pid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getppid() (ppid int) { r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) ppid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpriority(which int, who int) (prio int, err error) { r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrusage(who int, rusage *Rusage) (err error) { _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getsid(pid int) (sid int, err error) { r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getuid() (uid int) { r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) uid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Issetugid() (tainted bool) { r0, _, _ := Syscall(SYS_ISSETUGID, 0, 0, 0) tainted = bool(r0 != 0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kill(pid int, signum syscall.Signal) (err error) { _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kqueue() (fd int, err error) { r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lchown(path string, uid int, gid int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Link(path string, link string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(link) if err != nil { return } _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, backlog int) (err error) { _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lstat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdir(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkfifo(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknod(path string, mode uint32, dev int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlock(b []byte) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { _p0 = unsafe.Pointer(&b[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlockall(flags int) (err error) { _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mprotect(b []byte, prot int) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { _p0 = unsafe.Pointer(&b[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlock(b []byte) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { _p0 = unsafe.Pointer(&b[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlockall() (err error) { _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Open(path string, mode int, perm uint32) (fd int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) use(unsafe.Pointer(_p0)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pathconf(path string, name int) (val int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) use(unsafe.Pointer(_p0)) val = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pread(fd int, p []byte, offset int64) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pwrite(fd int, p []byte, offset int64) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func read(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlink(path string, buf []byte) (n int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 unsafe.Pointer if len(buf) > 0 { _p1 = unsafe.Pointer(&buf[0]) } else { _p1 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) use(unsafe.Pointer(_p0)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rename(from string, to string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(from) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(to) if err != nil { return } _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Revoke(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rmdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { r0, _, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(whence), 0, 0) newoffset = int64(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setegid(egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seteuid(euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setgid(gid int) (err error) { _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setlogin(name string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(name) if err != nil { return } _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpgid(pid int, pgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpriority(which int, who int, prio int) (err error) { _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setregid(rgid int, egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setreuid(ruid int, euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setresgid(rgid int, egid int, sgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setresuid(ruid int, euid int, suid int) (err error) { _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Settimeofday(tp *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setuid(uid int) (err error) { _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Stat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Statfs(path string, stat *Statfs_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlink(path string, link string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(link) if err != nil { return } _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() (err error) { _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Truncate(path string, length int64) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length)) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(newmask int) (oldmask int) { r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) oldmask = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlink(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unmount(path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func write(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), 0, 0) ret = uintptr(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func munmap(addr uintptr, length uintptr) (err error) { _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func readlen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func writelen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return }
{ "pile_set_name": "Github" }
/* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch licenses this file to you under * the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.elasticsearch.client.core; import org.elasticsearch.action.get.GetRequest; import org.elasticsearch.client.Validatable; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; public final class GetSourceRequest implements Validatable { private String routing; private String preference; private boolean refresh = false; private boolean realtime = true; private FetchSourceContext fetchSourceContext; private final String index; private final String id; public GetSourceRequest(String index, String id) { this.index = index; this.id = id; } public static GetSourceRequest from(GetRequest getRequest) { return new GetSourceRequest(getRequest.index(), getRequest.id()) .routing(getRequest.routing()) .preference(getRequest.preference()) .refresh(getRequest.refresh()) .realtime(getRequest.realtime()) .fetchSourceContext(getRequest.fetchSourceContext()); } /** * Controls the shard routing of the request. Using this value to hash the shard * and not the id. */ public GetSourceRequest routing(String routing) { if (routing != null && routing.length() == 0) { this.routing = null; } else { this.routing = routing; } return this; } /** * Sets the preference to execute the search. Defaults to randomize across shards. Can be set to * {@code _local} to prefer local shards or a custom value, which guarantees that the same order * will be used across different requests. */ public GetSourceRequest preference(String preference) { this.preference = preference; return this; } /** * Should a refresh be executed before this get operation causing the operation to * return the latest value. Note, heavy get should not set this to {@code true}. Defaults * to {@code false}. */ public GetSourceRequest refresh(boolean refresh) { this.refresh = refresh; return this; } public GetSourceRequest realtime(boolean realtime) { this.realtime = realtime; return this; } /** * Allows setting the {@link FetchSourceContext} for this request, controlling if and how _source should be returned. * Note, the {@code fetchSource} field of the context must be set to {@code true}. */ public GetSourceRequest fetchSourceContext(FetchSourceContext context) { this.fetchSourceContext = context; return this; } public String index() { return index; } public String id() { return id; } public String routing() { return routing; } public String preference() { return preference; } public boolean refresh() { return refresh; } public boolean realtime() { return realtime; } public FetchSourceContext fetchSourceContext() { return fetchSourceContext; } }
{ "pile_set_name": "Github" }
package cn.wizzer.app.web.modules.controllers.platform.sys; import cn.wizzer.app.sys.modules.models.Sys_config; import cn.wizzer.app.sys.modules.services.SysConfigService; import cn.wizzer.app.web.commons.base.Globals; import cn.wizzer.app.web.commons.slog.annotation.SLog; import cn.wizzer.app.web.commons.utils.StringUtil; import cn.wizzer.framework.base.Result; import cn.wizzer.framework.page.datatable.DataTableColumn; import cn.wizzer.framework.page.datatable.DataTableOrder; import com.alibaba.dubbo.config.annotation.Reference; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.nutz.dao.Cnd; import org.nutz.integration.jedis.pubsub.PubSubService; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.lang.Strings; import org.nutz.log.Log; import org.nutz.log.Logs; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Param; import java.util.List; /** * Created by wizzer on 2016/6/28. */ @IocBean @At("/platform/sys/conf") public class SysConfController { private static final Log log = Logs.get(); @Inject @Reference private SysConfigService sysConfigService; @Inject private PubSubService pubSubService; @At("") @Ok("beetl:/platform/sys/conf/index.html") @RequiresPermissions("sys.manager.conf") public void index() { } @At @Ok("beetl:/platform/sys/conf/add.html") @RequiresPermissions("sys.manager.conf") public void add() { } @At @Ok("json") @RequiresPermissions("sys.manager.conf.add") @SLog(tag = "添加参数", msg = "${args[0].configKey}:${args[0].configValue}") public Object addDo(@Param("..") Sys_config conf) { try { conf.setOpBy(StringUtil.getPlatformUid()); if (sysConfigService.insert(conf) != null) { pubSubService.fire("nutzwk:web:platform","sys_config"); } return Result.success("system.success"); } catch (Exception e) { return Result.error("system.error"); } } @At("/edit/?") @Ok("beetl:/platform/sys/conf/edit.html") @RequiresPermissions("sys.manager.conf") public Object edit(String id) { return sysConfigService.fetch(id); } @At @Ok("json") @RequiresPermissions("sys.manager.conf.edit") @SLog(tag = "修改参数", msg = "${args[0].configKey}:${args[0].configValue}") public Object editDo(@Param("..") Sys_config conf) { try { if (sysConfigService.updateIgnoreNull(conf) > 0) { pubSubService.fire("nutzwk:web:platform","sys_config"); } return Result.success("system.success"); } catch (Exception e) { return Result.error("system.error"); } } @At("/delete/?") @Ok("json") @RequiresPermissions("sys.manager.conf.delete") @SLog(tag = "删除参数", msg = "参数:${args[0]}") public Object delete(String configKey) { try { if (Strings.sBlank(configKey).startsWith("App")) { return Result.error("系统参数不可删除"); } if (sysConfigService.delete(configKey) > 0) { pubSubService.fire("nutzwk:web:platform","sys_config"); } return Result.success("system.success"); } catch (Exception e) { return Result.error("system.error"); } } @At @Ok("json:full") @RequiresPermissions("sys.manager.conf") public Object data(@Param("length") int length, @Param("start") int start, @Param("draw") int draw, @Param("::order") List<DataTableOrder> order, @Param("::columns") List<DataTableColumn> columns) { Cnd cnd = Cnd.NEW(); return sysConfigService.data(length, start, draw, order, columns, cnd, null); } }
{ "pile_set_name": "Github" }
import GoogleMapsLoader from 'google-maps'; import {GMapsLayerView, GMapsLayerModel} from './GMapsLayer'; export class SimpleHeatmapLayerModel extends GMapsLayerModel { defaults() { return { ...super.defaults(), _view_name: 'SimpleHeatmapLayerView', _model_name: 'SimpleHeatmapLayerModel', }; } } export class WeightedHeatmapLayerModel extends GMapsLayerModel { defaults() { return { ...super.defaults(), _view_name: 'WeightedHeatmapLayerView', _model_name: 'WeightedHeatmapLayerModel', }; } } class HeatmapLayerBaseView extends GMapsLayerView { constructor(options) { super(options); this.canDownloadAsPng = true; } render() { this.modelEvents(); GoogleMapsLoader.load(google => { this.heatmap = new google.maps.visualization.HeatmapLayer({ data: this.getData(), radius: this.model.get('point_radius'), maxIntensity: this.model.get('max_intensity'), dissipating: this.model.get('dissipating'), opacity: this.model.get('opacity'), gradient: this.model.get('gradient'), }); }); } resetData() { this.heatmap.setData(this.getData()); } addToMapView(mapView) { this.heatmap.setMap(mapView.map); } modelEvents() { // Simple properties: // [nameInView, nameInModel] const properties = [ ['maxIntensity', 'max_intensity'], ['opacity', 'opacity'], ['radius', 'point_radius'], ['dissipating', 'dissipating'], ['gradient', 'gradient'], ]; properties.forEach(([nameInView, nameInModel]) => { const callback = () => this.heatmap.set(nameInView, this.model.get(nameInModel)); this.model.on(`change:${nameInModel}`, callback, this); }); } } export class SimpleHeatmapLayerView extends HeatmapLayerBaseView { modelEvents() { super.modelEvents(); this.model.on('change:locations', this.resetData, this); } getData() { const data = this.model.get('locations'); const dataAsGoogle = new google.maps.MVCArray( data.map(([lat, lng]) => new google.maps.LatLng(lat, lng)) ); return dataAsGoogle; } } export class WeightedHeatmapLayerView extends HeatmapLayerBaseView { modelEvents() { super.modelEvents(); this.model.on('change:locations', this.resetData, this); this.model.on('change:weights', this.resetData, this); } getData() { const data = this.model.get('locations'); const weights = this.model.get('weights'); const dataAsGoogle = new google.maps.MVCArray( data.map(([lat, lng], i) => { const weight = weights[i]; const location = new google.maps.LatLng(lat, lng); return {location, weight}; }) ); return dataAsGoogle; } }
{ "pile_set_name": "Github" }
{ "log": { "version": "1.2", "creator": { "name": "WebInspector", "version": "537.36" }, "pages": [ { "startedDateTime": "2018-10-21T03:12:27.822Z", "id": "page_1", "title": "https://example.com/", "pageTimings": { "onContentLoad": 267.33600001898594, "onLoad": 267.79300000634976 } } ], "entries": [ { "startedDateTime": "2018-10-21T03:12:27.822Z", "time": 256.87030297788044, "request": { "method": "GET", "url": "https://example.com/", "httpVersion": "http/2.0", "headers": [ { "name": ":method", "value": "GET" }, { "name": ":authority", "value": "example.com" }, { "name": ":scheme", "value": "https" }, { "name": ":path", "value": "/" }, { "name": "upgrade-insecure-requests", "value": "1" }, { "name": "user-agent", "value": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36" }, { "name": "accept", "value": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" }, { "name": "accept-encoding", "value": "gzip, deflate, br" }, { "name": "accept-language", "value": "en-US,en;q=0.9" } ], "queryString": [], "cookies": [], "headersSize": -1, "bodySize": 0 }, "response": { "status": 200, "statusText": "", "httpVersion": "http/2.0", "headers": [ { "name": "status", "value": "200" }, { "name": "content-encoding", "value": "gzip" }, { "name": "accept-ranges", "value": "bytes" }, { "name": "cache-control", "value": "max-age=604800" }, { "name": "content-type", "value": "text/html; charset=UTF-8" }, { "name": "date", "value": "Sun, 21 Oct 2018 03:12:27 GMT" }, { "name": "etag", "value": "\"1541025663+ident\"" }, { "name": "expires", "value": "Sun, 28 Oct 2018 03:12:27 GMT" }, { "name": "last-modified", "value": "Fri, 09 Aug 2013 23:54:35 GMT" }, { "name": "server", "value": "ECS (sjc/4E68)" }, { "name": "vary", "value": "Accept-Encoding" }, { "name": "x-cache", "value": "HIT" }, { "name": "content-length", "value": "606" } ], "cookies": [], "content": { "size": 1270, "mimeType": "text/html", "text": "<!doctype html>\n<html>\n<head>\n <title>Example Domain</title>\n\n <meta charset=\"utf-8\" />\n <meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <style type=\"text/css\">\n body {\n background-color: #f0f0f2;\n margin: 0;\n padding: 0;\n font-family: \"Open Sans\", \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n \n }\n div {\n width: 600px;\n margin: 5em auto;\n padding: 50px;\n background-color: #fff;\n border-radius: 1em;\n }\n a:link, a:visited {\n color: #38488f;\n text-decoration: none;\n }\n @media (max-width: 700px) {\n body {\n background-color: #fff;\n }\n div {\n width: auto;\n margin: 0 auto;\n border-radius: 0;\n padding: 1em;\n }\n }\n </style> \n</head>\n\n<body>\n<div>\n <h1>Example Domain</h1>\n <p>This domain is established to be used for illustrative examples in documents. You may use this\n domain in examples without prior coordination or asking for permission.</p>\n <p><a href=\"http://www.iana.org/domains/example\">More information...</a></p>\n</div>\n</body>\n</html>\n" }, "redirectURL": "", "headersSize": -1, "bodySize": -1, "_transferSize": 805 }, "cache": {}, "timings": { "blocked": 0.49330299997888505, "dns": 30.448, "ssl": 95.516, "connect": 160.245, "send": 0.25200000000000955, "wait": 60.972999989045775, "receive": 4.458999988855794, "_blocked_queueing": 0.3029999788850546 }, "serverIPAddress": "93.184.216.34", "connection": "776286", "pageref": "page_1" }, { "startedDateTime": "2018-10-21T03:12:28.248Z", "time": 64.68735900550382, "request": { "method": "GET", "url": "https://example.com/favicon.ico", "httpVersion": "http/2.0", "headers": [ { "name": ":path", "value": "/favicon.ico" }, { "name": "accept-encoding", "value": "gzip, deflate, br" }, { "name": "accept-language", "value": "en-US,en;q=0.9" }, { "name": "user-agent", "value": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36" }, { "name": "accept", "value": "image/webp,image/apng,image/*,*/*;q=0.8" }, { "name": "referer", "value": "https://example.com/" }, { "name": ":authority", "value": "example.com" }, { "name": ":scheme", "value": "https" }, { "name": ":method", "value": "GET" } ], "queryString": [], "cookies": [], "headersSize": -1, "bodySize": 0 }, "response": { "status": 404, "statusText": "", "httpVersion": "http/2.0", "headers": [ { "name": "date", "value": "Sun, 21 Oct 2018 03:12:28 GMT" }, { "name": "content-encoding", "value": "gzip" }, { "name": "last-modified", "value": "Wed, 17 Oct 2018 17:27:32 GMT" }, { "name": "server", "value": "ECS (sjc/4E91)" }, { "name": "vary", "value": "Accept-Encoding" }, { "name": "x-cache", "value": "404-HIT" }, { "name": "content-type", "value": "text/html; charset=UTF-8" }, { "name": "status", "value": "404" }, { "name": "cache-control", "value": "max-age=604800" }, { "name": "accept-ranges", "value": "bytes" }, { "name": "content-length", "value": "606" }, { "name": "expires", "value": "Sun, 28 Oct 2018 03:12:28 GMT" } ], "cookies": [], "content": { "size": 1270, "mimeType": "text/html", "text": "<!doctype html>\n<html>\n<head>\n <title>Example Domain</title>\n\n <meta charset=\"utf-8\" />\n <meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <style type=\"text/css\">\n body {\n background-color: #f0f0f2;\n margin: 0;\n padding: 0;\n font-family: \"Open Sans\", \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n \n }\n div {\n width: 600px;\n margin: 5em auto;\n padding: 50px;\n background-color: #fff;\n border-radius: 1em;\n }\n a:link, a:visited {\n color: #38488f;\n text-decoration: none;\n }\n @media (max-width: 700px) {\n body {\n background-color: #fff;\n }\n div {\n width: auto;\n margin: 0 auto;\n border-radius: 0;\n padding: 1em;\n }\n }\n </style> \n</head>\n\n<body>\n<div>\n <h1>Example Domain</h1>\n <p>This domain is established to be used for illustrative examples in documents. You may use this\n domain in examples without prior coordination or asking for permission.</p>\n <p><a href=\"http://www.iana.org/domains/example\">More information...</a></p>\n</div>\n</body>\n</html>\n" }, "redirectURL": "", "headersSize": -1, "bodySize": -1, "_transferSize": 731 }, "cache": {}, "timings": { "blocked": 0.3323589999978431, "dns": -1, "ssl": -1, "connect": -1, "send": 0.177, "wait": 55.911000008074566, "receive": 8.266999997431412, "_blocked_queueing": 0.3589999978430569 }, "serverIPAddress": "93.184.216.34", "connection": "776286", "pageref": "page_1" } ] } }
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>智能社——http://www.zhinengshe.com</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black"> <script src="zepto.min.js"></script> <script src="zepto-scrolltop.js"></script> <style> .btn1{ position: fixed; right:20px; bottom:20px; padding: 20px; } </style> <script> $(function(){ $('#btn1').on('tap',function(){ $.scrollTop({duration:1000, target:100}); }); $('#btn2').on('tap',function(){ $.scrollTop(); }); }); </script> </head> <body style="height:3000px;"> <p>welcome to</p> <p style="margin-top:100px">welcome to 100</p> <input class="btn1" type="button" value="回到顶部100" id="btn1"> <input class="btn1" type="button" value="回到顶部0" id="btn2" style="right:140px"> </body> </html>
{ "pile_set_name": "Github" }
agrupar_cargo: false
{ "pile_set_name": "Github" }
/* cops.c: LocalTalk driver for Linux. * * Authors: * - Jay Schulist <jschlst@samba.org> * * With more than a little help from; * - Alan Cox <alan@lxorguk.ukuu.org.uk> * * Derived from: * - skeleton.c: A network driver outline for linux. * Written 1993-94 by Donald Becker. * - ltpc.c: A driver for the LocalTalk PC card. * Written by Bradford W. Johnson. * * Copyright 1993 United States Government as represented by the * Director, National Security Agency. * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * * Changes: * 19970608 Alan Cox Allowed dual card type support * Can set board type in insmod * Hooks for cops_setup routine * (not yet implemented). * 19971101 Jay Schulist Fixes for multiple lt* devices. * 19980607 Steven Hirsch Fixed the badly broken support * for Tangent type cards. Only * tested on Daystar LT200. Some * cleanup of formatting and program * logic. Added emacs 'local-vars' * setup for Jay's brace style. * 20000211 Alan Cox Cleaned up for softnet */ static const char *version = "cops.c:v0.04 6/7/98 Jay Schulist <jschlst@samba.org>\n"; /* * Sources: * COPS Localtalk SDK. This provides almost all of the information * needed. */ /* * insmod/modprobe configurable stuff. * - IO Port, choose one your card supports or 0 if you dare. * - IRQ, also choose one your card supports or nothing and let * the driver figure it out. */ #include <linux/module.h> #include <linux/kernel.h> #include <linux/types.h> #include <linux/fcntl.h> #include <linux/interrupt.h> #include <linux/ptrace.h> #include <linux/ioport.h> #include <linux/in.h> #include <linux/string.h> #include <linux/errno.h> #include <linux/init.h> #include <linux/netdevice.h> #include <linux/etherdevice.h> #include <linux/skbuff.h> #include <linux/if_arp.h> #include <linux/if_ltalk.h> #include <linux/delay.h> /* For udelay() */ #include <linux/atalk.h> #include <linux/spinlock.h> #include <linux/bitops.h> #include <linux/jiffies.h> #include <asm/io.h> #include <asm/dma.h> #include "cops.h" /* Our Stuff */ #include "cops_ltdrv.h" /* Firmware code for Tangent type cards. */ #include "cops_ffdrv.h" /* Firmware code for Dayna type cards. */ /* * The name of the card. Is used for messages and in the requests for * io regions, irqs and dma channels */ static const char *cardname = "cops"; #ifdef CONFIG_COPS_DAYNA static int board_type = DAYNA; /* Module exported */ #else static int board_type = TANGENT; #endif static int io = 0x240; /* Default IO for Dayna */ static int irq = 5; /* Default IRQ */ /* * COPS Autoprobe information. * Right now if port address is right but IRQ is not 5 this will * return a 5 no matter what since we will still get a status response. * Need one more additional check to narrow down after we have gotten * the ioaddr. But since only other possible IRQs is 3 and 4 so no real * hurry on this. I *STRONGLY* recommend using IRQ 5 for your card with * this driver. * * This driver has 2 modes and they are: Dayna mode and Tangent mode. * Each mode corresponds with the type of card. It has been found * that there are 2 main types of cards and all other cards are * the same and just have different names or only have minor differences * such as more IO ports. As this driver is tested it will * become more clear on exactly what cards are supported. The driver * defaults to using Dayna mode. To change the drivers mode, simply * select Dayna or Tangent mode when configuring the kernel. * * This driver should support: * TANGENT driver mode: * Tangent ATB-II, Novell NL-1000, Daystar Digital LT-200, * COPS LT-1 * DAYNA driver mode: * Dayna DL2000/DaynaTalk PC (Half Length), COPS LT-95, * Farallon PhoneNET PC III, Farallon PhoneNET PC II * Other cards possibly supported mode unknown though: * Dayna DL2000 (Full length), COPS LT/M (Micro-Channel) * * Cards NOT supported by this driver but supported by the ltpc.c * driver written by Bradford W. Johnson <johns393@maroon.tc.umn.edu> * Farallon PhoneNET PC * Original Apple LocalTalk PC card * * N.B. * * The Daystar Digital LT200 boards do not support interrupt-driven * IO. You must specify 'irq=0xff' as a module parameter to invoke * polled mode. I also believe that the port probing logic is quite * dangerous at best and certainly hopeless for a polled card. Best to * specify both. - Steve H. * */ /* * Zero terminated list of IO ports to probe. */ static unsigned int ports[] = { 0x240, 0x340, 0x200, 0x210, 0x220, 0x230, 0x260, 0x2A0, 0x300, 0x310, 0x320, 0x330, 0x350, 0x360, 0 }; /* * Zero terminated list of IRQ ports to probe. */ static int cops_irqlist[] = { 5, 4, 3, 0 }; static struct timer_list cops_timer; /* use 0 for production, 1 for verification, 2 for debug, 3 for verbose debug */ #ifndef COPS_DEBUG #define COPS_DEBUG 1 #endif static unsigned int cops_debug = COPS_DEBUG; /* The number of low I/O ports used by the card. */ #define COPS_IO_EXTENT 8 /* Information that needs to be kept for each board. */ struct cops_local { int board; /* Holds what board type is. */ int nodeid; /* Set to 1 once have nodeid. */ unsigned char node_acquire; /* Node ID when acquired. */ struct atalk_addr node_addr; /* Full node address */ spinlock_t lock; /* RX/TX lock */ }; /* Index to functions, as function prototypes. */ static int cops_probe1 (struct net_device *dev, int ioaddr); static int cops_irq (int ioaddr, int board); static int cops_open (struct net_device *dev); static int cops_jumpstart (struct net_device *dev); static void cops_reset (struct net_device *dev, int sleep); static void cops_load (struct net_device *dev); static int cops_nodeid (struct net_device *dev, int nodeid); static irqreturn_t cops_interrupt (int irq, void *dev_id); static void cops_poll (unsigned long ltdev); static void cops_timeout(struct net_device *dev); static void cops_rx (struct net_device *dev); static netdev_tx_t cops_send_packet (struct sk_buff *skb, struct net_device *dev); static void set_multicast_list (struct net_device *dev); static int cops_ioctl (struct net_device *dev, struct ifreq *rq, int cmd); static int cops_close (struct net_device *dev); static void cleanup_card(struct net_device *dev) { if (dev->irq) free_irq(dev->irq, dev); release_region(dev->base_addr, COPS_IO_EXTENT); } /* * Check for a network adaptor of this type, and return '0' iff one exists. * If dev->base_addr == 0, probe all likely locations. * If dev->base_addr in [1..0x1ff], always return failure. * otherwise go with what we pass in. */ struct net_device * __init cops_probe(int unit) { struct net_device *dev; unsigned *port; int base_addr; int err = 0; dev = alloc_ltalkdev(sizeof(struct cops_local)); if (!dev) return ERR_PTR(-ENOMEM); if (unit >= 0) { sprintf(dev->name, "lt%d", unit); netdev_boot_setup_check(dev); irq = dev->irq; base_addr = dev->base_addr; } else { base_addr = dev->base_addr = io; } if (base_addr > 0x1ff) { /* Check a single specified location. */ err = cops_probe1(dev, base_addr); } else if (base_addr != 0) { /* Don't probe at all. */ err = -ENXIO; } else { /* FIXME Does this really work for cards which generate irq? * It's definitely N.G. for polled Tangent. sh * Dayna cards don't autoprobe well at all, but if your card is * at IRQ 5 & IO 0x240 we find it every time. ;) JS */ for (port = ports; *port && cops_probe1(dev, *port) < 0; port++) ; if (!*port) err = -ENODEV; } if (err) goto out; err = register_netdev(dev); if (err) goto out1; return dev; out1: cleanup_card(dev); out: free_netdev(dev); return ERR_PTR(err); } static const struct net_device_ops cops_netdev_ops = { .ndo_open = cops_open, .ndo_stop = cops_close, .ndo_start_xmit = cops_send_packet, .ndo_tx_timeout = cops_timeout, .ndo_do_ioctl = cops_ioctl, .ndo_set_rx_mode = set_multicast_list, }; /* * This is the real probe routine. Linux has a history of friendly device * probes on the ISA bus. A good device probes avoids doing writes, and * verifies that the correct device exists and functions. */ static int __init cops_probe1(struct net_device *dev, int ioaddr) { struct cops_local *lp; static unsigned version_printed; int board = board_type; int retval; if(cops_debug && version_printed++ == 0) printk("%s", version); /* Grab the region so no one else tries to probe our ioports. */ if (!request_region(ioaddr, COPS_IO_EXTENT, dev->name)) return -EBUSY; /* * Since this board has jumpered interrupts, allocate the interrupt * vector now. There is no point in waiting since no other device * can use the interrupt, and this marks the irq as busy. Jumpered * interrupts are typically not reported by the boards, and we must * used AutoIRQ to find them. */ dev->irq = irq; switch (dev->irq) { case 0: /* COPS AutoIRQ routine */ dev->irq = cops_irq(ioaddr, board); if (dev->irq) break; /* No IRQ found on this port, fallthrough */ case 1: retval = -EINVAL; goto err_out; /* Fixup for users that don't know that IRQ 2 is really * IRQ 9, or don't know which one to set. */ case 2: dev->irq = 9; break; /* Polled operation requested. Although irq of zero passed as * a parameter tells the init routines to probe, we'll * overload it to denote polled operation at runtime. */ case 0xff: dev->irq = 0; break; default: break; } /* Reserve any actual interrupt. */ if (dev->irq) { retval = request_irq(dev->irq, cops_interrupt, 0, dev->name, dev); if (retval) goto err_out; } dev->base_addr = ioaddr; lp = netdev_priv(dev); spin_lock_init(&lp->lock); /* Copy local board variable to lp struct. */ lp->board = board; dev->netdev_ops = &cops_netdev_ops; dev->watchdog_timeo = HZ * 2; /* Tell the user where the card is and what mode we're in. */ if(board==DAYNA) printk("%s: %s at %#3x, using IRQ %d, in Dayna mode.\n", dev->name, cardname, ioaddr, dev->irq); if(board==TANGENT) { if(dev->irq) printk("%s: %s at %#3x, IRQ %d, in Tangent mode\n", dev->name, cardname, ioaddr, dev->irq); else printk("%s: %s at %#3x, using polled IO, in Tangent mode.\n", dev->name, cardname, ioaddr); } return 0; err_out: release_region(ioaddr, COPS_IO_EXTENT); return retval; } static int __init cops_irq (int ioaddr, int board) { /* * This does not use the IRQ to determine where the IRQ is. We just * assume that when we get a correct status response that it's the IRQ. * This really just verifies the IO port but since we only have access * to such a small number of IRQs (5, 4, 3) this is not bad. * This will probably not work for more than one card. */ int irqaddr=0; int i, x, status; if(board==DAYNA) { outb(0, ioaddr+DAYNA_RESET); inb(ioaddr+DAYNA_RESET); mdelay(333); } if(board==TANGENT) { inb(ioaddr); outb(0, ioaddr); outb(0, ioaddr+TANG_RESET); } for(i=0; cops_irqlist[i] !=0; i++) { irqaddr = cops_irqlist[i]; for(x = 0xFFFF; x>0; x --) /* wait for response */ { if(board==DAYNA) { status = (inb(ioaddr+DAYNA_CARD_STATUS)&3); if(status == 1) return irqaddr; } if(board==TANGENT) { if((inb(ioaddr+TANG_CARD_STATUS)& TANG_TX_READY) !=0) return irqaddr; } } } return 0; /* no IRQ found */ } /* * Open/initialize the board. This is called (in the current kernel) * sometime after booting when the 'ifconfig' program is run. */ static int cops_open(struct net_device *dev) { struct cops_local *lp = netdev_priv(dev); if(dev->irq==0) { /* * I don't know if the Dayna-style boards support polled * operation. For now, only allow it for Tangent. */ if(lp->board==TANGENT) /* Poll 20 times per second */ { init_timer(&cops_timer); cops_timer.function = cops_poll; cops_timer.data = (unsigned long)dev; cops_timer.expires = jiffies + HZ/20; add_timer(&cops_timer); } else { printk(KERN_WARNING "%s: No irq line set\n", dev->name); return -EAGAIN; } } cops_jumpstart(dev); /* Start the card up. */ netif_start_queue(dev); return 0; } /* * This allows for a dynamic start/restart of the entire card. */ static int cops_jumpstart(struct net_device *dev) { struct cops_local *lp = netdev_priv(dev); /* * Once the card has the firmware loaded and has acquired * the nodeid, if it is reset it will lose it all. */ cops_reset(dev,1); /* Need to reset card before load firmware. */ cops_load(dev); /* Load the firmware. */ /* * If atalkd already gave us a nodeid we will use that * one again, else we wait for atalkd to give us a nodeid * in cops_ioctl. This may cause a problem if someone steals * our nodeid while we are resetting. */ if(lp->nodeid == 1) cops_nodeid(dev,lp->node_acquire); return 0; } static void tangent_wait_reset(int ioaddr) { int timeout=0; while(timeout++ < 5 && (inb(ioaddr+TANG_CARD_STATUS)&TANG_TX_READY)==0) mdelay(1); /* Wait 1 second */ } /* * Reset the LocalTalk board. */ static void cops_reset(struct net_device *dev, int sleep) { struct cops_local *lp = netdev_priv(dev); int ioaddr=dev->base_addr; if(lp->board==TANGENT) { inb(ioaddr); /* Clear request latch. */ outb(0,ioaddr); /* Clear the TANG_TX_READY flop. */ outb(0, ioaddr+TANG_RESET); /* Reset the adapter. */ tangent_wait_reset(ioaddr); outb(0, ioaddr+TANG_CLEAR_INT); } if(lp->board==DAYNA) { outb(0, ioaddr+DAYNA_RESET); /* Assert the reset port */ inb(ioaddr+DAYNA_RESET); /* Clear the reset */ if (sleep) msleep(333); else mdelay(333); } netif_wake_queue(dev); } static void cops_load (struct net_device *dev) { struct ifreq ifr; struct ltfirmware *ltf= (struct ltfirmware *)&ifr.ifr_ifru; struct cops_local *lp = netdev_priv(dev); int ioaddr=dev->base_addr; int length, i = 0; strcpy(ifr.ifr_name,"lt0"); /* Get card's firmware code and do some checks on it. */ #ifdef CONFIG_COPS_DAYNA if(lp->board==DAYNA) { ltf->length=sizeof(ffdrv_code); ltf->data=ffdrv_code; } else #endif #ifdef CONFIG_COPS_TANGENT if(lp->board==TANGENT) { ltf->length=sizeof(ltdrv_code); ltf->data=ltdrv_code; } else #endif { printk(KERN_INFO "%s; unsupported board type.\n", dev->name); return; } /* Check to make sure firmware is correct length. */ if(lp->board==DAYNA && ltf->length!=5983) { printk(KERN_WARNING "%s: Firmware is not length of FFDRV.BIN.\n", dev->name); return; } if(lp->board==TANGENT && ltf->length!=2501) { printk(KERN_WARNING "%s: Firmware is not length of DRVCODE.BIN.\n", dev->name); return; } if(lp->board==DAYNA) { /* * We must wait for a status response * with the DAYNA board. */ while(++i<65536) { if((inb(ioaddr+DAYNA_CARD_STATUS)&3)==1) break; } if(i==65536) return; } /* * Upload the firmware and kick. Byte-by-byte works nicely here. */ i=0; length = ltf->length; while(length--) { outb(ltf->data[i], ioaddr); i++; } if(cops_debug > 1) printk("%s: Uploaded firmware - %d bytes of %d bytes.\n", dev->name, i, ltf->length); if(lp->board==DAYNA) /* Tell Dayna to run the firmware code. */ outb(1, ioaddr+DAYNA_INT_CARD); else /* Tell Tang to run the firmware code. */ inb(ioaddr); if(lp->board==TANGENT) { tangent_wait_reset(ioaddr); inb(ioaddr); /* Clear initial ready signal. */ } } /* * Get the LocalTalk Nodeid from the card. We can suggest * any nodeid 1-254. The card will try and get that exact * address else we can specify 0 as the nodeid and the card * will autoprobe for a nodeid. */ static int cops_nodeid (struct net_device *dev, int nodeid) { struct cops_local *lp = netdev_priv(dev); int ioaddr = dev->base_addr; if(lp->board == DAYNA) { /* Empty any pending adapter responses. */ while((inb(ioaddr+DAYNA_CARD_STATUS)&DAYNA_TX_READY)==0) { outb(0, ioaddr+COPS_CLEAR_INT); /* Clear interrupts. */ if((inb(ioaddr+DAYNA_CARD_STATUS)&0x03)==DAYNA_RX_REQUEST) cops_rx(dev); /* Kick any packets waiting. */ schedule(); } outb(2, ioaddr); /* Output command packet length as 2. */ outb(0, ioaddr); outb(LAP_INIT, ioaddr); /* Send LAP_INIT command byte. */ outb(nodeid, ioaddr); /* Suggest node address. */ } if(lp->board == TANGENT) { /* Empty any pending adapter responses. */ while(inb(ioaddr+TANG_CARD_STATUS)&TANG_RX_READY) { outb(0, ioaddr+COPS_CLEAR_INT); /* Clear interrupt. */ cops_rx(dev); /* Kick out packets waiting. */ schedule(); } /* Not sure what Tangent does if nodeid picked is used. */ if(nodeid == 0) /* Seed. */ nodeid = jiffies&0xFF; /* Get a random try */ outb(2, ioaddr); /* Command length LSB */ outb(0, ioaddr); /* Command length MSB */ outb(LAP_INIT, ioaddr); /* Send LAP_INIT byte */ outb(nodeid, ioaddr); /* LAP address hint. */ outb(0xFF, ioaddr); /* Int. level to use */ } lp->node_acquire=0; /* Set nodeid holder to 0. */ while(lp->node_acquire==0) /* Get *True* nodeid finally. */ { outb(0, ioaddr+COPS_CLEAR_INT); /* Clear any interrupt. */ if(lp->board == DAYNA) { if((inb(ioaddr+DAYNA_CARD_STATUS)&0x03)==DAYNA_RX_REQUEST) cops_rx(dev); /* Grab the nodeid put in lp->node_acquire. */ } if(lp->board == TANGENT) { if(inb(ioaddr+TANG_CARD_STATUS)&TANG_RX_READY) cops_rx(dev); /* Grab the nodeid put in lp->node_acquire. */ } schedule(); } if(cops_debug > 1) printk(KERN_DEBUG "%s: Node ID %d has been acquired.\n", dev->name, lp->node_acquire); lp->nodeid=1; /* Set got nodeid to 1. */ return 0; } /* * Poll the Tangent type cards to see if we have work. */ static void cops_poll(unsigned long ltdev) { int ioaddr, status; int boguscount = 0; struct net_device *dev = (struct net_device *)ltdev; del_timer(&cops_timer); if(dev == NULL) return; /* We've been downed */ ioaddr = dev->base_addr; do { status=inb(ioaddr+TANG_CARD_STATUS); if(status & TANG_RX_READY) cops_rx(dev); if(status & TANG_TX_READY) netif_wake_queue(dev); status = inb(ioaddr+TANG_CARD_STATUS); } while((++boguscount < 20) && (status&(TANG_RX_READY|TANG_TX_READY))); /* poll 20 times per second */ cops_timer.expires = jiffies + HZ/20; add_timer(&cops_timer); } /* * The typical workload of the driver: * Handle the network interface interrupts. */ static irqreturn_t cops_interrupt(int irq, void *dev_id) { struct net_device *dev = dev_id; struct cops_local *lp; int ioaddr, status; int boguscount = 0; ioaddr = dev->base_addr; lp = netdev_priv(dev); if(lp->board==DAYNA) { do { outb(0, ioaddr + COPS_CLEAR_INT); status=inb(ioaddr+DAYNA_CARD_STATUS); if((status&0x03)==DAYNA_RX_REQUEST) cops_rx(dev); netif_wake_queue(dev); } while(++boguscount < 20); } else { do { status=inb(ioaddr+TANG_CARD_STATUS); if(status & TANG_RX_READY) cops_rx(dev); if(status & TANG_TX_READY) netif_wake_queue(dev); status=inb(ioaddr+TANG_CARD_STATUS); } while((++boguscount < 20) && (status&(TANG_RX_READY|TANG_TX_READY))); } return IRQ_HANDLED; } /* * We have a good packet(s), get it/them out of the buffers. */ static void cops_rx(struct net_device *dev) { int pkt_len = 0; int rsp_type = 0; struct sk_buff *skb = NULL; struct cops_local *lp = netdev_priv(dev); int ioaddr = dev->base_addr; int boguscount = 0; unsigned long flags; spin_lock_irqsave(&lp->lock, flags); if(lp->board==DAYNA) { outb(0, ioaddr); /* Send out Zero length. */ outb(0, ioaddr); outb(DATA_READ, ioaddr); /* Send read command out. */ /* Wait for DMA to turn around. */ while(++boguscount<1000000) { barrier(); if((inb(ioaddr+DAYNA_CARD_STATUS)&0x03)==DAYNA_RX_READY) break; } if(boguscount==1000000) { printk(KERN_WARNING "%s: DMA timed out.\n",dev->name); spin_unlock_irqrestore(&lp->lock, flags); return; } } /* Get response length. */ if(lp->board==DAYNA) pkt_len = inb(ioaddr) & 0xFF; else pkt_len = inb(ioaddr) & 0x00FF; pkt_len |= (inb(ioaddr) << 8); /* Input IO code. */ rsp_type=inb(ioaddr); /* Malloc up new buffer. */ skb = dev_alloc_skb(pkt_len); if(skb == NULL) { printk(KERN_WARNING "%s: Memory squeeze, dropping packet.\n", dev->name); dev->stats.rx_dropped++; while(pkt_len--) /* Discard packet */ inb(ioaddr); spin_unlock_irqrestore(&lp->lock, flags); return; } skb->dev = dev; skb_put(skb, pkt_len); skb->protocol = htons(ETH_P_LOCALTALK); insb(ioaddr, skb->data, pkt_len); /* Eat the Data */ if(lp->board==DAYNA) outb(1, ioaddr+DAYNA_INT_CARD); /* Interrupt the card */ spin_unlock_irqrestore(&lp->lock, flags); /* Restore interrupts. */ /* Check for bad response length */ if(pkt_len < 0 || pkt_len > MAX_LLAP_SIZE) { printk(KERN_WARNING "%s: Bad packet length of %d bytes.\n", dev->name, pkt_len); dev->stats.tx_errors++; dev_kfree_skb_any(skb); return; } /* Set nodeid and then get out. */ if(rsp_type == LAP_INIT_RSP) { /* Nodeid taken from received packet. */ lp->node_acquire = skb->data[0]; dev_kfree_skb_any(skb); return; } /* One last check to make sure we have a good packet. */ if(rsp_type != LAP_RESPONSE) { printk(KERN_WARNING "%s: Bad packet type %d.\n", dev->name, rsp_type); dev->stats.tx_errors++; dev_kfree_skb_any(skb); return; } skb_reset_mac_header(skb); /* Point to entire packet. */ skb_pull(skb,3); skb_reset_transport_header(skb); /* Point to data (Skip header). */ /* Update the counters. */ dev->stats.rx_packets++; dev->stats.rx_bytes += skb->len; /* Send packet to a higher place. */ netif_rx(skb); } static void cops_timeout(struct net_device *dev) { struct cops_local *lp = netdev_priv(dev); int ioaddr = dev->base_addr; dev->stats.tx_errors++; if(lp->board==TANGENT) { if((inb(ioaddr+TANG_CARD_STATUS)&TANG_TX_READY)==0) printk(KERN_WARNING "%s: No TX complete interrupt.\n", dev->name); } printk(KERN_WARNING "%s: Transmit timed out.\n", dev->name); cops_jumpstart(dev); /* Restart the card. */ dev->trans_start = jiffies; /* prevent tx timeout */ netif_wake_queue(dev); } /* * Make the card transmit a LocalTalk packet. */ static netdev_tx_t cops_send_packet(struct sk_buff *skb, struct net_device *dev) { struct cops_local *lp = netdev_priv(dev); int ioaddr = dev->base_addr; unsigned long flags; /* * Block a timer-based transmit from overlapping. */ netif_stop_queue(dev); spin_lock_irqsave(&lp->lock, flags); if(lp->board == DAYNA) /* Wait for adapter transmit buffer. */ while((inb(ioaddr+DAYNA_CARD_STATUS)&DAYNA_TX_READY)==0) cpu_relax(); if(lp->board == TANGENT) /* Wait for adapter transmit buffer. */ while((inb(ioaddr+TANG_CARD_STATUS)&TANG_TX_READY)==0) cpu_relax(); /* Output IO length. */ outb(skb->len, ioaddr); if(lp->board == DAYNA) outb(skb->len >> 8, ioaddr); else outb((skb->len >> 8)&0x0FF, ioaddr); /* Output IO code. */ outb(LAP_WRITE, ioaddr); if(lp->board == DAYNA) /* Check the transmit buffer again. */ while((inb(ioaddr+DAYNA_CARD_STATUS)&DAYNA_TX_READY)==0); outsb(ioaddr, skb->data, skb->len); /* Send out the data. */ if(lp->board==DAYNA) /* Dayna requires you kick the card */ outb(1, ioaddr+DAYNA_INT_CARD); spin_unlock_irqrestore(&lp->lock, flags); /* Restore interrupts. */ /* Done sending packet, update counters and cleanup. */ dev->stats.tx_packets++; dev->stats.tx_bytes += skb->len; dev_kfree_skb (skb); return NETDEV_TX_OK; } /* * Dummy function to keep the Appletalk layer happy. */ static void set_multicast_list(struct net_device *dev) { if(cops_debug >= 3) printk("%s: set_multicast_list executed\n", dev->name); } /* * System ioctls for the COPS LocalTalk card. */ static int cops_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { struct cops_local *lp = netdev_priv(dev); struct sockaddr_at *sa = (struct sockaddr_at *)&ifr->ifr_addr; struct atalk_addr *aa = &lp->node_addr; switch(cmd) { case SIOCSIFADDR: /* Get and set the nodeid and network # atalkd wants. */ cops_nodeid(dev, sa->sat_addr.s_node); aa->s_net = sa->sat_addr.s_net; aa->s_node = lp->node_acquire; /* Set broardcast address. */ dev->broadcast[0] = 0xFF; /* Set hardware address. */ dev->dev_addr[0] = aa->s_node; dev->addr_len = 1; return 0; case SIOCGIFADDR: sa->sat_addr.s_net = aa->s_net; sa->sat_addr.s_node = aa->s_node; return 0; default: return -EOPNOTSUPP; } } /* * The inverse routine to cops_open(). */ static int cops_close(struct net_device *dev) { struct cops_local *lp = netdev_priv(dev); /* If we were running polled, yank the timer. */ if(lp->board==TANGENT && dev->irq==0) del_timer(&cops_timer); netif_stop_queue(dev); return 0; } #ifdef MODULE static struct net_device *cops_dev; MODULE_LICENSE("GPL"); module_param(io, int, 0); module_param(irq, int, 0); module_param(board_type, int, 0); static int __init cops_module_init(void) { if (io == 0) printk(KERN_WARNING "%s: You shouldn't autoprobe with insmod\n", cardname); cops_dev = cops_probe(-1); return PTR_RET(cops_dev); } static void __exit cops_module_exit(void) { unregister_netdev(cops_dev); cleanup_card(cops_dev); free_netdev(cops_dev); } module_init(cops_module_init); module_exit(cops_module_exit); #endif /* MODULE */
{ "pile_set_name": "Github" }
MyLoveReader ==== 简介 ---- Android平台上的多功能文档阅读器,支持PDF、TXT、WORD、EXCEL阅读。 功能界面借鉴了IReader的形式,“书架”形式展示颇具动态性。 演示图片 ---- +![](http://img.my.csdn.net/uploads/201307/06/1373073361_7339.png) 功能简介 ---- *PDF文档阅读 *TXT文档阅读 *DOC文档阅读 *EXCEL文档阅读 收尾 ---- By kiritor 个人博客:[CSDN:Kiritor](http://blog.csdn.net/kiritor "Title")
{ "pile_set_name": "Github" }
<?php /** * Licensed under The GPL-3.0 License * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @since 2.0.0 * @author Christopher Castro <chris@quickapps.es> * @link http://www.quickappscms.org * @license http://opensource.org/licenses/gpl-3.0.html GPL-3.0 License */ namespace Menu\Model\Entity; use Cake\ORM\Entity; use Cake\ORM\TableRegistry; use Cake\Utility\Text; /** * Represents a single "menu" within "menus" table. * * @property int $id * @property string $slug * @property string $title * @property string $description * @property string $handler * @property array $settings */ class Menu extends Entity { /** * Gets a brief description of 80 characters long. * * @return string */ protected function _getBriefDescription() { $description = $this->get('description'); if (empty($description)) { return '---'; } return Text::truncate($description, 80); } }
{ "pile_set_name": "Github" }
// Copyright 2019+ Klaus Post. All rights reserved. // License information can be found in the LICENSE file. // Based on work by Yann Collet, released under BSD License. package zstd import "math/bits" type seqCoders struct { llEnc, ofEnc, mlEnc *fseEncoder llPrev, ofPrev, mlPrev *fseEncoder } // swap coders with another (block). func (s *seqCoders) swap(other *seqCoders) { *s, *other = *other, *s } // setPrev will update the previous encoders to the actually used ones // and make sure a fresh one is in the main slot. func (s *seqCoders) setPrev(ll, ml, of *fseEncoder) { compareSwap := func(used *fseEncoder, current, prev **fseEncoder) { // We used the new one, more current to history and reuse the previous history if *current == used { *prev, *current = *current, *prev c := *current p := *prev c.reUsed = false p.reUsed = true return } if used == *prev { return } // Ensure we cannot reuse by accident prevEnc := *prev prevEnc.symbolLen = 0 return } compareSwap(ll, &s.llEnc, &s.llPrev) compareSwap(ml, &s.mlEnc, &s.mlPrev) compareSwap(of, &s.ofEnc, &s.ofPrev) } func highBit(val uint32) (n uint32) { return uint32(bits.Len32(val) - 1) } var llCodeTable = [64]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24} // Up to 6 bits const maxLLCode = 35 // llBitsTable translates from ll code to number of bits. var llBitsTable = [maxLLCode + 1]byte{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16} // llCode returns the code that represents the literal length requested. func llCode(litLength uint32) uint8 { const llDeltaCode = 19 if litLength <= 63 { // Compiler insists on bounds check (Go 1.12) return llCodeTable[litLength&63] } return uint8(highBit(litLength)) + llDeltaCode } var mlCodeTable = [128]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42} // Up to 6 bits const maxMLCode = 52 // mlBitsTable translates from ml code to number of bits. var mlBitsTable = [maxMLCode + 1]byte{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16} // note : mlBase = matchLength - MINMATCH; // because it's the format it's stored in seqStore->sequences func mlCode(mlBase uint32) uint8 { const mlDeltaCode = 36 if mlBase <= 127 { // Compiler insists on bounds check (Go 1.12) return mlCodeTable[mlBase&127] } return uint8(highBit(mlBase)) + mlDeltaCode } func ofCode(offset uint32) uint8 { // A valid offset will always be > 0. return uint8(bits.Len32(offset) - 1) }
{ "pile_set_name": "Github" }
{ "images" : [ { "idiom" : "universal", "filename" : "tz.pdf" } ], "info" : { "version" : 1, "author" : "xcode" }, "properties" : { "preserves-vector-representation" : true } }
{ "pile_set_name": "Github" }
package org.myrobotlab.service; import java.awt.image.BufferedImage; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import org.bytedeco.javacv.IPCameraFrameGrabber; import org.myrobotlab.framework.Service; import org.myrobotlab.image.SerializableImage; import org.myrobotlab.logging.Level; import org.myrobotlab.logging.LoggerFactory; import org.myrobotlab.logging.Logging; import org.myrobotlab.logging.LoggingFactory; import org.slf4j.Logger; /** * IPCamera - a service to allow streaming of video from an IP based camera. * * Android related - * http://stackoverflow.com/questions/8301543/android-bitmap-to-bufferedimage * Bitmap to BufferedImage - conversion once Bitmap class is serialized */ public class IpCamera extends Service { public class VideoProcess implements Runnable { @Override public void run() { try { grabber.start(); capturing = true; while (capturing) { BufferedImage bi = grabber.grabBufferedImage(); log.debug("grabbed"); if (bi != null) { log.debug("publishDisplay"); invoke("publishDisplay", new Object[] { getName(), bi }); } } } catch (Exception e) { } } } private static final long serialVersionUID = 1L; transient private IPCameraFrameGrabber grabber = null; transient private Thread videoProcess = null; public String controlURL; private boolean capturing = false; private boolean enableControls = true; public final static Logger log = LoggerFactory.getLogger(IpCamera.class.getCanonicalName()); public final static int FOSCAM_MOVE_UP = 0; public final static int FOSCAM_MOVE_STOP_UP = 1; public final static int FOSCAM_MOVE_DOWN = 2; public final static int FOSCAM_MOVE_STOP_DOWN = 3; public final static int FOSCAM_MOVE_LEFT = 4; public final static int FOSCAM_MOVE_STOP_LEFT = 5; public final static int FOSCAM_MOVE_RIGHT = 6; public final static int FOSCAM_MOVE_STOP_RIGHT = 7; public final static int FOSCAM_MOVE_CENTER = 25; public final static int FOSCAM_MOVE_VERTICLE_PATROL = 26; public final static int FOSCAM_MOVE_STOP_VERTICLE_PATROL = 27; public final static int FOSCAM_MOVE_HORIZONTAL_PATROL = 28; public final static int FOSCAM_MOVE_STOP_HORIZONTAL_PATROL = 29; public final static int FOSCAM_MOVE_IO_OUTPUT_HIGH = 94; public final static int FOSCAM_MOVE_IO_OUTPUT_LOW = 95; public final static int FOSCAM_ALARM_MOTION_ARMED_DISABLED = 0; public final static int FOSCAM_ALARM_MOTION_ARMED_ENABLED = 1; public final static int FOSCAM_ALARM_MOTION_SENSITIVITY_HIGH = 0; public final static int FOSCAM_ALARM_MOTION_SENSITIVITY_MEDIUM = 1; public final static int FOSCAM_ALARM_MOTION_SENSITIVITY_LOW = 2; public final static int FOSCAM_ALARM_MOTION_SENSITIVITY_ULTRALOW = 3; public final static int FOSCAM_ALARM_INPUT_ARMED_DISABLED = 0; public final static int FOSCAM_ALARM_INPUT_ARMED_ENABLED = 1; public final static int FOSCAM_ALARM_MAIL_DISABLED = 0; public final static int FOSCAM_ALARM_MAIL_ENABLED = 1; public static void main(String[] args) { LoggingFactory.init(Level.INFO); try { IpCamera foscam = (IpCamera) Runtime.start("foscam", "IpCamera"); foscam.startService(); foscam.startService(); SwingGui gui = (SwingGui) Runtime.start("gui", "SwingGui"); gui.startService(); } catch (Exception e) { Logging.logError(e); } } public final static SerializableImage publishFrame(String source, BufferedImage img) { SerializableImage si = new SerializableImage(img, source); return si; } public IpCamera(String n, String id) { super(n, id); } /* * method to determine connectivity of a valid host, user &amp; password to a * foscam camera. * * @return */ /* * public String getStatus() { StringBuffer ret = new StringBuffer(); try { * * URL url = new URL("http://" + host + "/get_status.cgi?user=" + user + * "&pwd=" + password); log.debug("getStatus " + url); URLConnection con = * url.openConnection(); BufferedReader in = new BufferedReader(new * InputStreamReader(con.getInputStream())); String inputLine; * * // TODO - parse for good info * * while ((inputLine = in.readLine()) != null) { ret.append(inputLine); } * in.close(); * * log.debug(String.format("%d",ret.indexOf("var id"))); * * if (ret.indexOf("var id") != -1) { ret = new StringBuffer("connected"); } * else { } } catch (Exception e) { ret.append(e.getMessage()); * logException(e); } return ret.toString(); } */ public void capture() { if (videoProcess != null) { capturing = false; videoProcess = null; } videoProcess = new Thread(new VideoProcess(), getName() + "_videoProcess"); videoProcess.start(); } // "http://" + host + "/videostream.cgi?user=" + user + "&pwd=" + password public boolean connectVideoStream(String url) throws MalformedURLException { grabber = new IPCameraFrameGrabber(url); // invoke("getStatus"); capture(); return true; } /* * public String setAlarm(int armed, int sensitivity, int inputArmed, int * ioLinkage, int mail, int uploadInterval) { StringBuffer ret = new * StringBuffer(); try { * * URL url = new URL("http://" + host + "/set_alarm.cgi?motion_armed=" + armed * + "user=" + user + "&pwd=" + password); URLConnection con = * url.openConnection(); BufferedReader in = new BufferedReader(new * InputStreamReader(con.getInputStream())); String inputLine; * * while ((inputLine = in.readLine()) != null) { ret.append(inputLine); } * in.close(); } catch (Exception e) { logException(e); } return * ret.toString(); } */ public String move(Integer param) { if (!enableControls) { return null; } log.info("move " + param); StringBuffer ret = new StringBuffer(); try { // TODO - re-use connection optimization // URL url = new URL("http://" + host + // "/decoder_control.cgi?command=" + param + "&user=" + user + // "&pwd=" + password); URL url = new URL(controlURL + param); URLConnection con = url.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) { ret.append(inputLine); } in.close(); } catch (Exception e) { log.error("move threw", e); } return ret.toString(); } public SerializableImage publishDisplay(String source, BufferedImage img) { return new SerializableImage(img, source); } public void setControlURL(String url) { controlURL = url; } public Boolean setEnableControls(Boolean v) { enableControls = v; return v; } public void stopCapture() { capturing = false; if (videoProcess != null) { capturing = false; videoProcess = null; } } }
{ "pile_set_name": "Github" }
/* * Copyright(c) 2006 to 2018 ADLINK Technology Limited and others * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License * v. 1.0 which is available at * http://www.eclipse.org/org/documents/edl-v10.php. * * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause */ #include <assert.h> #include <string.h> /** \file os/vxworks/os_platform_heap.c * \brief VxWorks heap memory management * * Implements heap memory management for VxWorks * by including the common implementation */ #if defined(OS_USE_ALLIGNED_MALLOC) #ifndef NDEBUG #include "os/os.h" atomic_t os__reallocdoublecopycount = 0; #endif void * ddsrt_malloc( size_t size) { void *ptr; void *origptr; origptr = malloc(size+12); ptr=origptr; if (!ptr) { return NULL; } assert ( ((char *)ptr - (char *)0) % 4 == 0 ); if ( ((char *)ptr - (char *)0) % 8 != 0 ) { /* malloc returned memory not 8 byte aligned */ /* move pointer by 4 so that it will be aligned again */ ptr=((uint32_t *)ptr) + 1; } /* Store requested size */ /* 8 bytes before the pointer we return */ *(((size_t *)ptr)) = size; ptr=((size_t *)ptr) + 1; /* Store pointer to result of malloc "before" the allocation */ /* 4 bytes before the pointer we return */ *((void **)ptr)= origptr; ptr=((uint32_t *)ptr) + 1; assert ( ((char *)ptr - (char *)0) % 8 == 0 ); return ptr; } void *ddsrt_realloc( void *ptr, size_t size) { void *newptr; /* Address returned from system realloc */ void *origptr; /* Address returned by previous *alloc */ void *olddata; /* Address of original user data immediately after realloc. */ void *newdata; /* Address user data will be at on return. */ size_t origsize; /* Size before realloc */ if ( ptr == NULL ) { return (ddsrt_malloc(size)); } assert ( ((char *)ptr - (char *)0) % 8 == 0 ); origptr = *(((void **)ptr)-1); if ( size == 0 ) { /* really a free */ realloc(origptr, size); return NULL; } origsize = *(((size_t *)ptr)-2); newptr = realloc(origptr, size+12); if ( newptr == NULL ) { /* realloc failed, everything is left untouched */ return NULL; } olddata = (char *)newptr + ((char *)ptr - (char *)origptr); assert ( ((char *)newptr - (char *)0) % 4 == 0 ); if ( ((char *)newptr - (char *)0) % 8 == 0 ) { /* Allow space for size and pointer */ newdata = ((uint32_t *)newptr)+2; } else { /* malloc returned memory not 8 byte aligned */ /* realign, and Allow space for size and pointer */ newdata = ((uint32_t *)newptr)+3; } assert ( ((char *)newdata - (char *)0) % 8 == 0 ); if ( (((char *)newptr - (char *)0) % 8) != (((char *)origptr - (char *)0) % 8) ) { /* realloc returned memory with different alignment */ assert ( ((char *)newdata)+4 == ((char *)olddata) ||((char *)olddata)+4 == ((char *)newdata)); #ifndef NDEBUG vxAtomicInc( &os__reallocdoublecopycount); #endif memmove(newdata, olddata, origsize < size ? origsize : size); } /* Store requested size */ /* 8 bytes before the pointer we return */ *(((size_t *)newdata)-2) = size; /* Store pointer to result of realloc "before" the allocation */ /* 4 bytes before the pointer we return */ *(((void **)newdata)-1) = newptr; return newdata; } void ddsrt_free( void *ptr) { assert ( ((char *)ptr - (char *)0) % 8 == 0 ); free(*(((void **)ptr)-1)); } #else /* For 64bit use the native ops align to 8 bytes */ #include "../snippets/code/os_heap.c" #endif /* OS_USE_ALLIGNED_MALLOC */
{ "pile_set_name": "Github" }
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.gobblin.data.management.conversion.hive.converter; import java.io.IOException; import java.util.List; import org.apache.avro.Schema; import org.apache.commons.lang.StringUtils; import org.apache.hadoop.hive.metastore.api.FieldSchema; import org.apache.hadoop.hive.metastore.api.Partition; import org.apache.hadoop.hive.metastore.api.Table; import org.testng.Assert; import org.testng.annotations.Test; import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.typesafe.config.Config; import com.typesafe.config.ConfigFactory; import org.apache.gobblin.configuration.WorkUnitState; import org.apache.gobblin.data.management.ConversionHiveTestUtils; import org.apache.gobblin.data.management.conversion.hive.LocalHiveMetastoreTestUtils; import org.apache.gobblin.data.management.conversion.hive.dataset.ConvertibleHiveDataset; import org.apache.gobblin.data.management.conversion.hive.dataset.ConvertibleHiveDatasetTest; import org.apache.gobblin.data.management.conversion.hive.entities.QueryBasedHiveConversionEntity; import org.apache.gobblin.data.management.conversion.hive.entities.SchemaAwareHivePartition; import org.apache.gobblin.data.management.conversion.hive.entities.SchemaAwareHiveTable; import org.apache.gobblin.data.management.copy.hive.WhitelistBlacklist; @Test(groups = { "gobblin.data.management.conversion" }) public class HiveAvroToOrcConverterTest { private static String resourceDir = "hiveConverterTest"; private LocalHiveMetastoreTestUtils hiveMetastoreTestUtils; public HiveAvroToOrcConverterTest() { this.hiveMetastoreTestUtils = LocalHiveMetastoreTestUtils.getInstance(); } /*** * Test flattened DDL and DML generation * @throws IOException */ @Test public void testFlattenSchemaDDLandDML() throws Exception { String dbName = "testdb"; String tableName = "testtable"; String tableSdLoc = "/tmp/testtable"; this.hiveMetastoreTestUtils.getLocalMetastoreClient().dropDatabase(dbName, false, true, true); Table table = this.hiveMetastoreTestUtils.createTestAvroTable(dbName, tableName, tableSdLoc, Optional.<String> absent()); Schema schema = ConversionHiveTestUtils.readSchemaFromJsonFile(resourceDir, "recordWithinRecordWithinRecord_nested.json"); WorkUnitState wus = ConversionHiveTestUtils.createWus(dbName, tableName, 0); try (HiveAvroToFlattenedOrcConverter converter = new HiveAvroToFlattenedOrcConverter();) { Config config = ConfigFactory.parseMap( ImmutableMap.<String, String>builder().put("destinationFormats", "flattenedOrc") .put("flattenedOrc.destination.dbName", dbName) .put("flattenedOrc.destination.tableName", tableName + "_orc") .put("flattenedOrc.destination.dataPath", "file:" + tableSdLoc + "_orc").build()); ConvertibleHiveDataset cd = ConvertibleHiveDatasetTest.createTestConvertibleDataset(config); List<QueryBasedHiveConversionEntity> conversionEntities = Lists.newArrayList(converter.convertRecord(converter.convertSchema(schema, wus), new QueryBasedHiveConversionEntity(cd, new SchemaAwareHiveTable(table, schema)), wus)); Assert.assertEquals(conversionEntities.size(), 1, "Only one query entity should be returned"); QueryBasedHiveConversionEntity queryBasedHiveConversionEntity = conversionEntities.get(0); List<String> queries = queryBasedHiveConversionEntity.getQueries(); Assert.assertEquals(queries.size(), 4, "4 DDL and one DML query should be returned"); // Ignoring part before first bracket in DDL and 'select' clause in DML because staging table has // .. a random name component String actualDDLQuery = StringUtils.substringAfter("(", queries.get(0).trim()); String actualDMLQuery = StringUtils.substringAfter("SELECT", queries.get(0).trim()); String expectedDDLQuery = StringUtils.substringAfter("(", ConversionHiveTestUtils.readQueryFromFile(resourceDir, "recordWithinRecordWithinRecord_flattened.ddl")); String expectedDMLQuery = StringUtils.substringAfter("SELECT", ConversionHiveTestUtils.readQueryFromFile(resourceDir, "recordWithinRecordWithinRecord_flattened.dml")); Assert.assertEquals(actualDDLQuery, expectedDDLQuery); Assert.assertEquals(actualDMLQuery, expectedDMLQuery); } } /*** * Test nested DDL and DML generation * @throws IOException */ @Test public void testNestedSchemaDDLandDML() throws Exception { String dbName = "testdb"; String tableName = "testtable"; String tableSdLoc = "/tmp/testtable"; this.hiveMetastoreTestUtils.getLocalMetastoreClient().dropDatabase(dbName, false, true, true); Table table = this.hiveMetastoreTestUtils.createTestAvroTable(dbName, tableName, tableSdLoc, Optional.<String> absent()); Schema schema = ConversionHiveTestUtils.readSchemaFromJsonFile(resourceDir, "recordWithinRecordWithinRecord_nested.json"); WorkUnitState wus = ConversionHiveTestUtils.createWus(dbName, tableName, 0); wus.getJobState().setProp("orc.table.flatten.schema", "false"); try (HiveAvroToNestedOrcConverter converter = new HiveAvroToNestedOrcConverter();) { Config config = ConfigFactory.parseMap(ImmutableMap.<String, String> builder() .put("destinationFormats", "nestedOrc") .put("nestedOrc.destination.tableName","testtable_orc_nested") .put("nestedOrc.destination.dbName",dbName) .put("nestedOrc.destination.dataPath","file:/tmp/testtable_orc_nested") .build()); ConvertibleHiveDataset cd = ConvertibleHiveDatasetTest.createTestConvertibleDataset(config); List<QueryBasedHiveConversionEntity> conversionEntities = Lists.newArrayList(converter.convertRecord(converter.convertSchema(schema, wus), new QueryBasedHiveConversionEntity(cd , new SchemaAwareHiveTable(table, schema)), wus)); Assert.assertEquals(conversionEntities.size(), 1, "Only one query entity should be returned"); QueryBasedHiveConversionEntity queryBasedHiveConversionEntity = conversionEntities.get(0); List<String> queries = queryBasedHiveConversionEntity.getQueries(); Assert.assertEquals(queries.size(), 4, "4 DDL and one DML query should be returned"); // Ignoring part before first bracket in DDL and 'select' clause in DML because staging table has // .. a random name component String actualDDLQuery = StringUtils.substringAfter("(", queries.get(0).trim()); String actualDMLQuery = StringUtils.substringAfter("SELECT", queries.get(0).trim()); String expectedDDLQuery = StringUtils.substringAfter("(", ConversionHiveTestUtils.readQueryFromFile(resourceDir, "recordWithinRecordWithinRecord_nested.ddl")); String expectedDMLQuery = StringUtils.substringAfter("SELECT", ConversionHiveTestUtils.readQueryFromFile(resourceDir, "recordWithinRecordWithinRecord_nested.dml")); Assert.assertEquals(actualDDLQuery, expectedDDLQuery); Assert.assertEquals(actualDMLQuery, expectedDMLQuery); } } @Test public void dropReplacedPartitionsTest() throws Exception { Table table = ConvertibleHiveDatasetTest.getTestTable("dbName", "tableName"); table.setTableType("VIRTUAL_VIEW"); table.setPartitionKeys(ImmutableList.of(new FieldSchema("year", "string", ""), new FieldSchema("month", "string", ""))); Partition part = new Partition(); part.setParameters(ImmutableMap.of("gobblin.replaced.partitions", "2015,12|2016,01")); SchemaAwareHiveTable hiveTable = new SchemaAwareHiveTable(table, null); SchemaAwareHivePartition partition = new SchemaAwareHivePartition(table, part, null); QueryBasedHiveConversionEntity conversionEntity = new QueryBasedHiveConversionEntity(null, hiveTable, Optional.of(partition)); List<ImmutableMap<String, String>> expected = ImmutableList.of(ImmutableMap.of("year", "2015", "month", "12"), ImmutableMap.of("year", "2016", "month", "01")); Assert.assertEquals(AbstractAvroToOrcConverter.getDropPartitionsDDLInfo(conversionEntity), expected); // Make sure that a partition itself is not dropped Partition replacedSelf = new Partition(); replacedSelf.setParameters(ImmutableMap.of("gobblin.replaced.partitions", "2015,12|2016,01|2016,02")); replacedSelf.setValues(ImmutableList.of("2016", "02")); conversionEntity = new QueryBasedHiveConversionEntity(null, hiveTable, Optional.of(new SchemaAwareHivePartition(table, replacedSelf, null))); Assert.assertEquals(AbstractAvroToOrcConverter.getDropPartitionsDDLInfo(conversionEntity), expected); } @Test /*** * More comprehensive tests for WhiteBlackList are in: {@link org.apache.gobblin.data.management.copy.hive.WhitelistBlacklistTest} */ public void hiveViewRegistrationWhiteBlackListTest() throws Exception { WorkUnitState wus = ConversionHiveTestUtils.createWus("dbName", "tableName", 0); Optional<WhitelistBlacklist> optionalWhitelistBlacklist = AbstractAvroToOrcConverter.getViewWhiteBackListFromWorkUnit(wus); Assert.assertTrue(!optionalWhitelistBlacklist.isPresent(), "No whitelist blacklist specified in WUS, WhiteListBlackList object should be absent"); wus.setProp(AbstractAvroToOrcConverter.HIVE_CONVERSION_VIEW_REGISTRATION_WHITELIST, ""); wus.setProp(AbstractAvroToOrcConverter.HIVE_CONVERSION_VIEW_REGISTRATION_BLACKLIST, ""); optionalWhitelistBlacklist = AbstractAvroToOrcConverter.getViewWhiteBackListFromWorkUnit(wus); Assert.assertTrue(optionalWhitelistBlacklist.isPresent(), "Whitelist blacklist specified in WUS, WhiteListBlackList object should be present"); Assert.assertTrue(optionalWhitelistBlacklist.get().acceptDb("mydb")); Assert.assertTrue(optionalWhitelistBlacklist.get().acceptTable("mydb", "mytable")); wus.setProp(AbstractAvroToOrcConverter.HIVE_CONVERSION_VIEW_REGISTRATION_WHITELIST, "yourdb"); wus.setProp(AbstractAvroToOrcConverter.HIVE_CONVERSION_VIEW_REGISTRATION_BLACKLIST, ""); optionalWhitelistBlacklist = AbstractAvroToOrcConverter.getViewWhiteBackListFromWorkUnit(wus); Assert.assertTrue(optionalWhitelistBlacklist.isPresent(), "Whitelist blacklist specified in WUS, WhiteListBlackList object should be present"); Assert.assertTrue(!optionalWhitelistBlacklist.get().acceptDb("mydb")); Assert.assertTrue(!optionalWhitelistBlacklist.get().acceptTable("mydb", "mytable")); Assert.assertTrue(optionalWhitelistBlacklist.get().acceptDb("yourdb")); Assert.assertTrue(optionalWhitelistBlacklist.get().acceptTable("yourdb", "mytable")); wus.setProp(AbstractAvroToOrcConverter.HIVE_CONVERSION_VIEW_REGISTRATION_WHITELIST, "yourdb.yourtable"); wus.setProp(AbstractAvroToOrcConverter.HIVE_CONVERSION_VIEW_REGISTRATION_BLACKLIST, ""); optionalWhitelistBlacklist = AbstractAvroToOrcConverter.getViewWhiteBackListFromWorkUnit(wus); Assert.assertTrue(optionalWhitelistBlacklist.isPresent(), "Whitelist blacklist specified in WUS, WhiteListBlackList object should be present"); Assert.assertTrue(!optionalWhitelistBlacklist.get().acceptDb("mydb")); Assert.assertTrue(!optionalWhitelistBlacklist.get().acceptTable("yourdb", "mytable")); Assert.assertTrue(optionalWhitelistBlacklist.get().acceptDb("yourdb")); Assert.assertTrue(optionalWhitelistBlacklist.get().acceptTable("yourdb", "yourtable")); wus.setProp(AbstractAvroToOrcConverter.HIVE_CONVERSION_VIEW_REGISTRATION_WHITELIST, ""); wus.setProp(AbstractAvroToOrcConverter.HIVE_CONVERSION_VIEW_REGISTRATION_BLACKLIST, "yourdb.yourtable"); optionalWhitelistBlacklist = AbstractAvroToOrcConverter.getViewWhiteBackListFromWorkUnit(wus); Assert.assertTrue(optionalWhitelistBlacklist.isPresent(), "Whitelist blacklist specified in WUS, WhiteListBlackList object should be present"); Assert.assertTrue(optionalWhitelistBlacklist.get().acceptDb("mydb")); Assert.assertTrue(optionalWhitelistBlacklist.get().acceptTable("yourdb", "mytable")); Assert.assertTrue(optionalWhitelistBlacklist.get().acceptDb("yourdb")); Assert.assertTrue(!optionalWhitelistBlacklist.get().acceptTable("yourdb", "yourtable")); } }
{ "pile_set_name": "Github" }
{ "randomStatetest" : { "env" : { "currentCoinbase" : "945304eb96065b2a98b57a48a06ae28d285a71b5", "currentDifficulty" : "0x051d6a3cd647", "currentGasLimit" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", "currentNumber" : "0x00", "currentTimestamp" : "0x01", "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" }, "logs" : [ ], "out" : "0x", "post" : { "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "balance" : "0x00", "code" : "0x7f00000000000000000000000000000000000000000000000000000000000000017f00000000000000000000000100000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000001077f00000000000000000000000100000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000c3504419860b9754998d503105a033436e67133a60005155", "nonce" : "0x00", "storage" : { } }, "945304eb96065b2a98b57a48a06ae28d285a71b5" : { "balance" : "0x3f263119", "code" : "0x6000355415600957005b60203560003555", "nonce" : "0x00", "storage" : { } }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "0x0de0b6b3683dcf15", "code" : "0x", "nonce" : "0x01", "storage" : { } } }, "postStateRoot" : "83d3dca909b55515e4a851828b28e38cac53e65c0db3b53997a2c0dda1222de7", "pre" : { "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "balance" : "0x00", "code" : "0x7f00000000000000000000000000000000000000000000000000000000000000017f00000000000000000000000100000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000001077f00000000000000000000000100000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000c3504419860b9754998d503105a033436e67133a60005155", "nonce" : "0x00", "storage" : { } }, "945304eb96065b2a98b57a48a06ae28d285a71b5" : { "balance" : "0x2e", "code" : "0x6000355415600957005b60203560003555", "nonce" : "0x00", "storage" : { } }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "0x0de0b6b3a7640000", "code" : "0x", "nonce" : "0x00", "storage" : { } } }, "transaction" : { "data" : "0x7f00000000000000000000000000000000000000000000000000000000000000017f00000000000000000000000100000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000001077f00000000000000000000000100000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000c3504419860b9754998d503105a033436e67133a", "gasLimit" : "0x3f2630eb", "gasPrice" : "0x01", "nonce" : "0x00", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "0x6ec35ec4" } } }
{ "pile_set_name": "Github" }
package main import ( "bufio" "fmt" "os" "os/signal" "strings" "syscall" "golang.org/x/net/context" "github.com/pkg/errors" "github.com/urfave/cli" "github.com/currantlabs/ble" "github.com/currantlabs/ble/examples/lib" "github.com/currantlabs/ble/examples/lib/dev" "github.com/currantlabs/ble/linux" ) var curr struct { device ble.Device client ble.Client clients map[string]ble.Client uuid ble.UUID addr ble.Addr profile *ble.Profile } var ( errNotConnected = fmt.Errorf("not connected") errNoProfile = fmt.Errorf("no profile") errNoUUID = fmt.Errorf("no UUID") errInvalidUUID = fmt.Errorf("invalid UUID") ) func main() { curr.clients = make(map[string]ble.Client) app := cli.NewApp() app.Name = "blesh" app.Usage = "A CLI tool for ble" app.Version = "0.0.1" app.Action = cli.ShowAppHelp app.Commands = []cli.Command{ { Name: "status", Aliases: []string{"st"}, Usage: "Display current status", Before: setup, Action: cmdStatus, }, { Name: "adv", Aliases: []string{"a"}, Usage: "Advertise name, UUIDs, iBeacon (TODO)", Before: setup, Action: cmdAdv, Flags: []cli.Flag{flgTimeout, flgName}, }, { Name: "serve", Aliases: []string{"sv"}, Usage: "Start the GATT Server", Before: setup, Action: cmdServe, Flags: []cli.Flag{flgTimeout, flgName}, }, { Name: "scan", Aliases: []string{"s"}, Usage: "Scan surrounding with specified filter", Before: setup, Action: cmdScan, Flags: []cli.Flag{flgTimeout, flgName, flgAddr, flgSvc, flgAllowDup}, }, { Name: "connect", Aliases: []string{"c"}, Usage: "Connect to a peripheral device", Before: setup, Action: cmdConnect, Flags: []cli.Flag{flgTimeout, flgName, flgAddr, flgSvc}, }, { Name: "disconnect", Aliases: []string{"x"}, Usage: "Disconnect a connected peripheral device", Before: setup, Action: cmdDisconnect, Flags: []cli.Flag{flgAddr}, }, { Name: "discover", Aliases: []string{"d"}, Usage: "Discover profile on connected device", Before: setup, Action: cmdDiscover, Flags: []cli.Flag{flgTimeout, flgName, flgAddr}, }, { Name: "explore", Aliases: []string{"e"}, Usage: "Display discovered profile", Before: setup, Action: cmdExplore, Flags: []cli.Flag{flgTimeout, flgName, flgAddr}, }, { Name: "read", Aliases: []string{"r"}, Usage: "Read value from a characteristic or descriptor", Before: setup, Action: cmdRead, Flags: []cli.Flag{flgUUID, flgTimeout, flgName, flgAddr}, }, { Name: "write", Aliases: []string{"w"}, Usage: "Write value to a characteristic or descriptor", Before: setup, Action: cmdWrite, Flags: []cli.Flag{flgUUID, flgTimeout, flgName, flgAddr}, }, { Name: "sub", Usage: "Subscribe to notification (or indication)", Before: setup, Action: cmdSub, Flags: []cli.Flag{flgUUID, flgInd, flgTimeout, flgName, flgAddr}, }, { Name: "unsub", Usage: "Unsubscribe to notification (or indication)", Before: setup, Action: cmdUnsub, Flags: []cli.Flag{flgUUID, flgInd, flgAddr}, }, { Name: "shell", Aliases: []string{"sh"}, Usage: "Enter interactive mode", Before: setup, Action: func(c *cli.Context) { cmdShell(app) }, }, } // app.Before = setup app.Run(os.Args) } func setup(c *cli.Context) error { if curr.device != nil { return nil } fmt.Printf("Initializing device ...\n") d, err := dev.NewDevice("default") if err != nil { return errors.Wrap(err, "can't new device") } ble.SetDefaultDevice(d) curr.device = d // Optinal. Demostrate changing HCI parameters on Linux. if dev, ok := d.(*linux.Device); ok { return errors.Wrap(updateLinuxParam(dev), "can't update hci parameters") } return nil } func cmdStatus(c *cli.Context) error { m := map[bool]string{true: "yes", false: "no"} fmt.Printf("Current status:\n") fmt.Printf(" Initialized: %s\n", m[curr.device != nil]) if curr.addr != nil { fmt.Printf(" Address: %s\n", curr.addr) } else { fmt.Printf(" Address:\n") } fmt.Printf(" Connected:") for k := range curr.clients { fmt.Printf(" %s", k) } fmt.Printf("\n") fmt.Printf(" Profile:\n") if curr.profile != nil { fmt.Printf("\n") explore(curr.client, curr.profile) } if curr.uuid != nil { fmt.Printf(" UUID: %s\n", curr.uuid) } else { fmt.Printf(" UUID:\n") } return nil } func cmdAdv(c *cli.Context) error { fmt.Printf("Advertising for %s...\n", c.Duration("tmo")) ctx := ble.WithSigHandler(context.WithTimeout(context.Background(), c.Duration("tmo"))) return chkErr(ble.AdvertiseNameAndServices(ctx, "Gopher")) } func cmdScan(c *cli.Context) error { fmt.Printf("Scanning for %s...\n", c.Duration("tmo")) ctx := ble.WithSigHandler(context.WithTimeout(context.Background(), c.Duration("tmo"))) return chkErr(ble.Scan(ctx, c.Bool("dup"), advHandler, filter(c))) } func cmdServe(c *cli.Context) error { testSvc := ble.NewService(lib.TestSvcUUID) testSvc.AddCharacteristic(lib.NewCountChar()) testSvc.AddCharacteristic(lib.NewEchoChar()) if err := ble.AddService(testSvc); err != nil { return errors.Wrap(err, "can't add service") } fmt.Printf("Serving GATT Server for %s...\n", c.Duration("tmo")) ctx := ble.WithSigHandler(context.WithTimeout(context.Background(), c.Duration("tmo"))) return chkErr(ble.AdvertiseNameAndServices(ctx, "Gopher", testSvc.UUID)) } func cmdConnect(c *cli.Context) error { curr.client = nil var cln ble.Client var err error ctx := ble.WithSigHandler(context.WithTimeout(context.Background(), c.Duration("tmo"))) if c.String("addr") != "" { curr.addr = ble.NewAddr(c.String("addr")) fmt.Printf("Dialing to specified address: %s\n", curr.addr) cln, err = ble.Dial(ctx, curr.addr) } else if filter(c) != nil { fmt.Printf("Scanning with filter...\n") if cln, err = ble.Connect(ctx, filter(c)); err == nil { curr.addr = cln.Address() fmt.Printf("Connected to %s\n", curr.addr) } } else if curr.addr != nil { fmt.Printf("Dialing to implicit address: %s\n", curr.addr) cln, err = ble.Dial(ctx, curr.addr) } else { return fmt.Errorf("no filter specified, and cached peripheral address") } if err == nil { curr.client = cln curr.clients[cln.Address().String()] = cln } go func() { <-cln.Disconnected() delete(curr.clients, cln.Address().String()) curr.client = nil fmt.Printf("\n%s disconnected\n", cln.Address().String()) }() return err } func cmdDisconnect(c *cli.Context) error { if c.String("addr") != "" { curr.client = curr.clients[c.String("addr")] } if curr.client == nil { return errNotConnected } defer func() { delete(curr.clients, curr.client.Address().String()) curr.client = nil curr.profile = nil }() fmt.Printf("Disconnecting [ %s ]... (this might take up to few seconds on OS X)\n", curr.client.Address()) return curr.client.CancelConnection() } func cmdDiscover(c *cli.Context) error { curr.profile = nil if curr.client == nil { if err := cmdConnect(c); err != nil { return errors.Wrap(err, "can't connect") } } fmt.Printf("Discovering profile...\n") p, err := curr.client.DiscoverProfile(true) if err != nil { return errors.Wrap(err, "can't discover profile") } curr.profile = p return nil } func cmdExplore(c *cli.Context) error { if curr.client == nil { if err := cmdConnect(c); err != nil { return errors.Wrap(err, "can't connect") } } if curr.profile == nil { if err := cmdDiscover(c); err != nil { return errors.Wrap(err, "can't discover profile") } } return explore(curr.client, curr.profile) } func cmdRead(c *cli.Context) error { if err := doGetUUID(c); err != nil { return err } if err := doConnect(c); err != nil { return err } if err := doDiscover(c); err != nil { return err } if u := curr.profile.Find(ble.NewCharacteristic(curr.uuid)); u != nil { b, err := curr.client.ReadCharacteristic(u.(*ble.Characteristic)) if err != nil { return errors.Wrap(err, "can't read characteristic") } fmt.Printf(" Value %x | %q\n", b, b) return nil } if u := curr.profile.Find(ble.NewDescriptor(curr.uuid)); u != nil { b, err := curr.client.ReadDescriptor(u.(*ble.Descriptor)) if err != nil { return errors.Wrap(err, "can't read descriptor") } fmt.Printf(" Value %x | %q\n", b, b) return nil } return errNoUUID } func cmdWrite(c *cli.Context) error { if err := doGetUUID(c); err != nil { return err } if err := doConnect(c); err != nil { return err } if err := doDiscover(c); err != nil { return err } if u := curr.profile.Find(ble.NewCharacteristic(curr.uuid)); u != nil { err := curr.client.WriteCharacteristic(u.(*ble.Characteristic), []byte("hello"), true) return errors.Wrap(err, "can't write characteristic") } if u := curr.profile.Find(ble.NewDescriptor(curr.uuid)); u != nil { err := curr.client.WriteDescriptor(u.(*ble.Descriptor), []byte("fixme")) return errors.Wrap(err, "can't write descriptor") } return errNoUUID } func cmdSub(c *cli.Context) error { if err := doGetUUID(c); err != nil { return err } if err := doConnect(c); err != nil { return err } if err := doDiscover(c); err != nil { return err } // NotificationHandler h := func(req []byte) { fmt.Printf("notified: %x | %q\n", req, req) } if u := curr.profile.Find(ble.NewCharacteristic(curr.uuid)); u != nil { err := curr.client.Subscribe(u.(*ble.Characteristic), c.Bool("ind"), h) return errors.Wrap(err, "can't subscribe to characteristic") } return errNoUUID } func cmdUnsub(c *cli.Context) error { if err := doGetUUID(c); err != nil { return err } if err := doConnect(c); err != nil { return err } if u := curr.profile.Find(ble.NewCharacteristic(curr.uuid)); u != nil { err := curr.client.Unsubscribe(u.(*ble.Characteristic), c.Bool("ind")) return errors.Wrap(err, "can't unsubscribe to characteristic") } return errNoUUID } func cmdShell(app *cli.App) { cli.OsExiter = func(c int) {} reader := bufio.NewReader(os.Stdin) sigs := make(chan os.Signal, 1) go func() { for range sigs { fmt.Printf("\n(type quit or q to exit)\n\nblesh >") } }() defer close(sigs) signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) for { fmt.Print("blesh > ") text, _ := reader.ReadString('\n') text = strings.TrimSpace(text) if text == "" { continue } if text == "quit" || text == "q" { break } app.Run(append(os.Args[1:], strings.Split(text, " ")...)) } signal.Stop(sigs) }
{ "pile_set_name": "Github" }
#*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | # / __| | | | |_) | | # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # # Copyright (C) 2004 - 2015, Guenter Knauf, <http://www.gknw.net/phpbb>. # Copyright (C) 2001 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at https://curl.haxx.se/docs/copyright.html. # # You may opt to use, copy, modify, merge, publish, distribute and/or sell # copies of the Software, and permit persons to whom the Software is # furnished to do so, under the terms of the COPYING file. # # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY # KIND, either express or implied. # #*************************************************************************** ################################################################# # ## Makefile for building libcurl.nlm (NetWare version - gnu make) ## ## Use: make -f Makefile.netware # ################################################################# # Edit the path below to point to the base of your Novell NDK. ifndef NDKBASE NDKBASE = c:/novell endif # Edit the path below to point to the base of your Zlib sources. ifndef ZLIB_PATH ZLIB_PATH = ../../zlib-1.2.8 endif # Edit the path below to point to the base of your OpenSSL package. ifndef OPENSSL_PATH OPENSSL_PATH = ../../openssl-1.0.2a endif # Edit the path below to point to the base of your LibSSH2 package. ifndef LIBSSH2_PATH LIBSSH2_PATH = ../../libssh2-1.5.0 endif # Edit the path below to point to the base of your axTLS package. ifndef AXTLS_PATH AXTLS_PATH = ../../axTLS-1.2.7 endif # Edit the path below to point to the base of your libidn package. ifndef LIBIDN_PATH LIBIDN_PATH = ../../libidn-1.18 endif # Edit the path below to point to the base of your librtmp package. ifndef LIBRTMP_PATH LIBRTMP_PATH = ../../librtmp-2.3 endif # Edit the path below to point to the base of your nghttp2 package. ifndef NGHTTP2_PATH NGHTTP2_PATH = ../../nghttp2-0.6.7 endif # Edit the path below to point to the base of your fbopenssl package. ifndef FBOPENSSL_PATH FBOPENSSL_PATH = ../../fbopenssl-0.4 endif # Edit the path below to point to the base of your c-ares package. ifndef LIBCARES_PATH LIBCARES_PATH = ../ares endif ifndef INSTDIR INSTDIR = ..$(DS)curl-$(LIBCURL_VERSION_STR)-bin-nw endif # Edit the vars below to change NLM target settings. TARGET = libcurl VERSION = $(LIBCURL_VERSION) COPYR = Copyright (C) $(LIBCURL_COPYRIGHT_STR) DESCR = curl libcurl $(LIBCURL_VERSION_STR) ($(LIBARCH)) - https://curl.haxx.se MTSAFE = YES STACK = 64000 SCREEN = none EXPORTF = $(TARGET).imp EXPORTS = @$(EXPORTF) # Uncomment the next line to enable linking with POSIX semantics. # POSIXFL = 1 # Edit the var below to point to your lib architecture. ifndef LIBARCH LIBARCH = LIBC endif # must be equal to NDEBUG or DEBUG, CURLDEBUG ifndef DB DB = NDEBUG endif # Optimization: -O<n> or debugging: -g ifeq ($(DB),NDEBUG) OPT = -O2 OBJDIR = release else OPT = -g OBJDIR = debug endif # The following lines defines your compiler. ifdef CWFolder METROWERKS = $(CWFolder) endif ifdef METROWERKS # MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support/Metrowerks Support CC = mwccnlm else CC = gcc endif PERL = perl # Here you can find a native Win32 binary of the original awk: # http://www.gknw.net/development/prgtools/awk-20100523.zip AWK = awk CP = cp -afv MKDIR = mkdir # RM = rm -f # If you want to mark the target as MTSAFE you will need a tool for # generating the xdc data for the linker; here's a minimal tool: # http://www.gknw.net/development/prgtools/mkxdc.zip MPKXDC = mkxdc # LIBARCH_U = $(shell $(AWK) 'BEGIN {print toupper(ARGV[1])}' $(LIBARCH)) LIBARCH_L = $(shell $(AWK) 'BEGIN {print tolower(ARGV[1])}' $(LIBARCH)) # Include the version info retrieved from curlver.h -include $(OBJDIR)/version.inc # Global flags for all compilers CFLAGS += $(OPT) -D$(DB) -DNETWARE -DHAVE_CONFIG_H -nostdinc ifeq ($(CC),mwccnlm) LD = mwldnlm LDFLAGS = -nostdlib $(PRELUDE) $(OBJL) -o $@ -commandfile AR = mwldnlm ARFLAGS = -nostdlib -type library -o LIBEXT = lib #RANLIB = CFLAGS += -msgstyle gcc -gccinc -inline off -opt nointrinsics -proc 586 CFLAGS += -relax_pointers #CFLAGS += -w on ifeq ($(LIBARCH),LIBC) ifeq ($(POSIXFL),1) PRELUDE = $(NDK_LIBC)/imports/posixpre.o else PRELUDE = $(NDK_LIBC)/imports/libcpre.o endif CFLAGS += -align 4 else # PRELUDE = $(NDK_CLIB)/imports/clibpre.o # to avoid the __init_* / __deinit_* woes don't use prelude from NDK PRELUDE = "$(MWCW_PATH)/libraries/runtime/prelude.obj" # CFLAGS += -include "$(MWCW_PATH)/headers/nlm_clib_prefix.h" CFLAGS += -align 1 endif else LD = nlmconv LDFLAGS = -T AR = ar ARFLAGS = -cq LIBEXT = a RANLIB = ranlib CFLAGS += -m32 CFLAGS += -fno-builtin -fno-strict-aliasing ifeq ($(findstring gcc,$(CC)),gcc) CFLAGS += -fpcc-struct-return endif CFLAGS += -Wall # -pedantic ifeq ($(LIBARCH),LIBC) ifeq ($(POSIXFL),1) PRELUDE = $(NDK_LIBC)/imports/posixpre.gcc.o else PRELUDE = $(NDK_LIBC)/imports/libcpre.gcc.o endif else PRELUDE = $(NDK_CLIB)/imports/clibpre.gcc.o # to avoid the __init_* / __deinit_* woes don't use prelude from NDK # http://www.gknw.net/development/mk_nlm/gcc_pre.zip # PRELUDE = $(NDK_ROOT)/pre/prelude.o CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h endif endif NDK_ROOT = $(NDKBASE)/ndk ifndef NDK_CLIB NDK_CLIB = $(NDK_ROOT)/nwsdk endif ifndef NDK_LIBC NDK_LIBC = $(NDK_ROOT)/libc endif ifndef NDK_LDAP NDK_LDAP = $(NDK_ROOT)/cldapsdk/netware endif CURL_INC = ../include CURL_LIB = ../lib INCLUDES = -I$(CURL_INC) -I$(CURL_LIB) ifeq ($(findstring -static,$(CFG)),-static) LINK_STATIC = 1 endif ifeq ($(findstring -ares,$(CFG)),-ares) WITH_ARES = 1 endif ifeq ($(findstring -rtmp,$(CFG)),-rtmp) WITH_RTMP = 1 WITH_SSL = 1 WITH_ZLIB = 1 endif ifeq ($(findstring -ssh2,$(CFG)),-ssh2) WITH_SSH2 = 1 WITH_SSL = 1 WITH_ZLIB = 1 endif ifeq ($(findstring -axtls,$(CFG)),-axtls) WITH_AXTLS = 1 WITH_SSL = else ifeq ($(findstring -ssl,$(CFG)),-ssl) WITH_SSL = 1 ifeq ($(findstring -srp,$(CFG)),-srp) ifeq "$(wildcard $(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L)/openssl/srp.h)" "$(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L)/openssl/srp.h" WITH_SRP = 1 endif endif endif endif ifeq ($(findstring -zlib,$(CFG)),-zlib) WITH_ZLIB = 1 endif ifeq ($(findstring -idn,$(CFG)),-idn) WITH_IDN = 1 endif ifeq ($(findstring -nghttp2,$(CFG)),-nghttp2) WITH_NGHTTP2 = 1 endif ifeq ($(findstring -ipv6,$(CFG)),-ipv6) ENABLE_IPV6 = 1 endif ifdef WITH_ARES INCLUDES += -I$(LIBCARES_PATH) LDLIBS += $(LIBCARES_PATH)/libcares.$(LIBEXT) endif ifdef WITH_SSH2 INCLUDES += -I$(LIBSSH2_PATH)/include ifdef LINK_STATIC LDLIBS += $(LIBSSH2_PATH)/nw/libssh2.$(LIBEXT) else MODULES += libssh2.nlm IMPORTS += @$(LIBSSH2_PATH)/nw/libssh2.imp endif endif ifdef WITH_RTMP INCLUDES += -I$(LIBRTMP_PATH) LDLIBS += $(LIBRTMP_PATH)/librtmp/librtmp.$(LIBEXT) endif ifdef WITH_SSL INCLUDES += -I$(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L) LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/ssl.$(LIBEXT) LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/crypto.$(LIBEXT) IMPORTS += GetProcessSwitchCount RunningProcess INSTDEP += ca-bundle.crt else ifdef WITH_AXTLS INCLUDES += -I$(AXTLS_PATH)/inc ifdef LINK_STATIC LDLIBS += $(AXTLS_PATH)/lib/libaxtls.$(LIBEXT) else MODULES += libaxtls.nlm IMPORTS += $(AXTLS_PATH)/lib/libaxtls.imp endif INSTDEP += ca-bundle.crt endif endif ifdef WITH_ZLIB INCLUDES += -I$(ZLIB_PATH) ifdef LINK_STATIC LDLIBS += $(ZLIB_PATH)/nw/$(LIBARCH)/libz.$(LIBEXT) else MODULES += libz.nlm IMPORTS += @$(ZLIB_PATH)/nw/$(LIBARCH)/libz.imp endif endif ifdef WITH_IDN INCLUDES += -I$(LIBIDN_PATH)/include LDLIBS += $(LIBIDN_PATH)/lib/libidn.$(LIBEXT) endif ifdef WITH_NGHTTP2 INCLUDES += -I$(NGHTTP2_PATH)/include LDLIBS += $(NGHTTP2_PATH)/lib/libnghttp2.$(LIBEXT) endif ifeq ($(LIBARCH),LIBC) INCLUDES += -I$(NDK_LIBC)/include # INCLUDES += -I$(NDK_LIBC)/include/nks # INCLUDES += -I$(NDK_LIBC)/include/winsock CFLAGS += -D_POSIX_SOURCE else INCLUDES += -I$(NDK_CLIB)/include/nlm # INCLUDES += -I$(NDK_CLIB)/include/nlm/obsolete # INCLUDES += -I$(NDK_CLIB)/include endif ifndef DISABLE_LDAP INCLUDES += -I$(NDK_LDAP)/$(LIBARCH_L)/inc endif CFLAGS += $(INCLUDES) ifeq ($(MTSAFE),YES) XDCOPT = -n endif ifeq ($(MTSAFE),NO) XDCOPT = -u endif ifdef XDCOPT XDCDATA = $(OBJDIR)/$(TARGET).xdc endif ifeq ($(findstring /sh,$(SHELL)),/sh) DL = ' DS = / PCT = % #-include $(NDKBASE)/nlmconv/ncpfs.inc else DS = \\ PCT = %% endif # Makefile.inc provides the CSOURCES and HHEADERS defines include Makefile.inc OBJS := $(patsubst %.c,$(OBJDIR)/%.o,$(strip $(notdir $(CSOURCES)))) $(OBJDIR)/nwos.o OBJL = $(OBJS) $(OBJDIR)/nwlib.o $(LDLIBS) vpath %.c . vauth vtls all: lib nlm nlm: prebuild $(TARGET).nlm lib: prebuild $(TARGET).$(LIBEXT) prebuild: $(OBJDIR) $(OBJDIR)/version.inc curl_config.h $(OBJDIR)/%.o: %.c # @echo Compiling $< $(CC) $(CFLAGS) -c $< -o $@ $(OBJDIR)/version.inc: $(CURL_INC)/curl/curlver.h $(OBJDIR) @echo Creating $@ @$(AWK) -f ../packages/NetWare/get_ver.awk $< > $@ install: $(INSTDIR) all $(INSTDEP) @$(CP) $(TARGET).nlm $(INSTDIR) @$(CP) $(TARGET).$(LIBEXT) $(INSTDIR) @$(CP) ../CHANGES $(INSTDIR) @$(CP) ../COPYING $(INSTDIR) @$(CP) ../README $(INSTDIR) @$(CP) ../RELEASE-NOTES $(INSTDIR) ifdef WITH_SSL @-$(CP) ca-bundle.crt $(INSTDIR)/ca-bundle.crt endif clean: -$(RM) curl_config.h -$(RM) -r $(OBJDIR) distclean vclean: clean -$(RM) $(TARGET).$(LIBEXT) $(TARGET).nlm $(TARGET).imp -$(RM) certdata.txt ca-bundle.crt $(OBJDIR) $(INSTDIR): @$(MKDIR) $@ $(TARGET).$(LIBEXT): $(OBJS) @echo Creating $@ @-$(RM) $@ @$(AR) $(ARFLAGS) $@ $^ ifdef RANLIB @$(RANLIB) $@ endif $(TARGET).nlm: $(OBJDIR)/$(TARGET).def $(OBJL) $(EXPORTF) $(XDCDATA) @echo Linking $@ @-$(RM) $@ @$(LD) $(LDFLAGS) $< $(OBJDIR)/%.xdc: Makefile.netware @echo Creating $@ @$(MPKXDC) $(XDCOPT) $@ $(OBJDIR)/%.def: Makefile.netware @echo $(DL)# DEF file for linking with $(LD)$(DL) > $@ @echo $(DL)# Do not edit this file - it is created by make!$(DL) >> $@ @echo $(DL)# All your changes will be lost!!$(DL) >> $@ @echo $(DL)#$(DL) >> $@ @echo $(DL)copyright "$(COPYR)"$(DL) >> $@ @echo $(DL)description "$(DESCR)"$(DL) >> $@ @echo $(DL)version $(VERSION)$(DL) >> $@ ifdef NLMTYPE @echo $(DL)type $(NLMTYPE)$(DL) >> $@ endif ifdef STACK @echo $(DL)stack $(STACK)$(DL) >> $@ endif ifdef SCREEN @echo $(DL)screenname "$(SCREEN)"$(DL) >> $@ else @echo $(DL)screenname "DEFAULT"$(DL) >> $@ endif ifneq ($(DB),NDEBUG) @echo $(DL)debug$(DL) >> $@ endif @echo $(DL)threadname "$(TARGET)"$(DL) >> $@ ifdef XDCDATA @echo $(DL)xdcdata $(XDCDATA)$(DL) >> $@ endif @echo $(DL)flag_on 64$(DL) >> $@ ifeq ($(LIBARCH),CLIB) @echo $(DL)start _Prelude$(DL) >> $@ @echo $(DL)exit _Stop$(DL) >> $@ @echo $(DL)import @$(NDK_CLIB)/imports/clib.imp$(DL) >> $@ @echo $(DL)import @$(NDK_CLIB)/imports/threads.imp$(DL) >> $@ @echo $(DL)import @$(NDK_CLIB)/imports/nlmlib.imp$(DL) >> $@ @echo $(DL)import @$(NDK_CLIB)/imports/socklib.imp$(DL) >> $@ @echo $(DL)module clib$(DL) >> $@ ifndef DISABLE_LDAP @echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapsdk.imp$(DL) >> $@ @echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapssl.imp$(DL) >> $@ # @echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapx.imp$(DL) >> $@ @echo $(DL)module ldapsdk ldapssl$(DL) >> $@ endif else ifeq ($(POSIXFL),1) @echo $(DL)flag_on 4194304$(DL) >> $@ endif @echo $(DL)pseudopreemption$(DL) >> $@ ifeq ($(findstring posixpre,$(PRELUDE)),posixpre) @echo $(DL)start POSIX_Start$(DL) >> $@ @echo $(DL)exit POSIX_Stop$(DL) >> $@ @echo $(DL)check POSIX_CheckUnload$(DL) >> $@ else @echo $(DL)start _LibCPrelude$(DL) >> $@ @echo $(DL)exit _LibCPostlude$(DL) >> $@ @echo $(DL)check _LibCCheckUnload$(DL) >> $@ endif @echo $(DL)import @$(NDK_LIBC)/imports/libc.imp$(DL) >> $@ @echo $(DL)import @$(NDK_LIBC)/imports/netware.imp$(DL) >> $@ @echo $(DL)module libc$(DL) >> $@ ifndef DISABLE_LDAP @echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapsdk.imp$(DL) >> $@ @echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapssl.imp$(DL) >> $@ # @echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapx.imp$(DL) >> $@ @echo $(DL)module lldapsdk lldapssl$(DL) >> $@ endif endif ifdef MODULES @echo $(DL)module $(MODULES)$(DL) >> $@ endif ifdef EXPORTS @echo $(DL)export $(EXPORTS)$(DL) >> $@ endif ifdef IMPORTS @echo $(DL)import $(IMPORTS)$(DL) >> $@ endif ifeq ($(findstring nlmconv,$(LD)),nlmconv) @echo $(DL)input $(PRELUDE)$(DL) >> $@ @echo $(DL)input $(OBJL)$(DL) >> $@ #ifdef LDLIBS # @echo $(DL)input $(LDLIBS)$(DL) >> $@ #endif @echo $(DL)output $(TARGET).nlm$(DL) >> $@ endif curl_config.h: Makefile.netware @echo Creating $@ @echo $(DL)/* $@ for NetWare target.$(DL) > $@ @echo $(DL)** Do not edit this file - it is created by make!$(DL) >> $@ @echo $(DL)** All your changes will be lost!!$(DL) >> $@ @echo $(DL)*/$(DL) >> $@ @echo $(DL)#ifndef NETWARE$(DL) >> $@ @echo $(DL)#error This $(notdir $@) is created for NetWare platform!$(DL) >> $@ @echo $(DL)#endif$(DL) >> $@ @echo $(DL)#define VERSION "$(LIBCURL_VERSION_STR)"$(DL) >> $@ @echo $(DL)#define PACKAGE_BUGREPORT "a suitable curl mailing list => https://curl.haxx.se/mail/"$(DL) >> $@ ifeq ($(LIBARCH),CLIB) @echo $(DL)#define OS "i586-pc-clib-NetWare"$(DL) >> $@ @echo $(DL)#define NETDB_USE_INTERNET 1$(DL) >> $@ @echo $(DL)#define HAVE_STRICMP 1$(DL) >> $@ @echo $(DL)#define HAVE_STRNICMP 1$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG2 char *$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG3 int$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@ @echo $(DL)#define RECV_TYPE_RETV int$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_ARG1 int$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_ARG2 char$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_ARG3 int$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_ARG4 int$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_ARG5 struct sockaddr$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_ARG6 int$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_RETV int$(DL) >> $@ @echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG2 char *$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@ @echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@ @echo $(DL)#define SIZEOF_SIZE_T 4$(DL) >> $@ @echo $(DL)#define pressanykey PressAnyKeyToContinue$(DL) >> $@ else @echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@ @echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@ @echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@ @echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@ @echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@ @echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@ @echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@ @echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@ @echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@ @echo $(DL)#define HAVE_STRTOLL 1$(DL) >> $@ @echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@ @echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@ @echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG2 void *$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG3 size_t$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@ @echo $(DL)#define RECV_TYPE_RETV ssize_t$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_ARG1 int$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_ARG2 void$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_ARG3 size_t$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_ARG4 int$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_ARG5 struct sockaddr$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_ARG6 size_t$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_RETV ssize_t$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_ARG2_IS_VOID 1$(DL) >> $@ @echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG2 void *$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG3 size_t$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@ @echo $(DL)#define SEND_TYPE_RETV ssize_t$(DL) >> $@ @echo $(DL)#define SIZEOF_OFF_T 8$(DL) >> $@ @echo $(DL)#define SIZEOF_SIZE_T 8$(DL) >> $@ @echo $(DL)#define _LARGEFILE 1$(DL) >> $@ ifdef ENABLE_IPV6 @echo $(DL)#define ENABLE_IPV6 1$(DL) >> $@ @echo $(DL)#define HAVE_AF_INET6 1$(DL) >> $@ @echo $(DL)#define HAVE_PF_INET6 1$(DL) >> $@ @echo $(DL)#define HAVE_FREEADDRINFO 1$(DL) >> $@ @echo $(DL)#define HAVE_GETADDRINFO 1$(DL) >> $@ @echo $(DL)#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1$(DL) >> $@ @echo $(DL)#define HAVE_STRUCT_ADDRINFO 1$(DL) >> $@ @echo $(DL)#define HAVE_STRUCT_IN6_ADDR 1$(DL) >> $@ @echo $(DL)#define HAVE_STRUCT_SOCKADDR_IN6 1$(DL) >> $@ @echo $(DL)#define SIZEOF_STRUCT_IN6_ADDR 16$(DL) >> $@ endif endif @echo $(DL)#define USE_MANUAL 1$(DL) >> $@ @echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@ @echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@ @echo $(DL)#define HAVE_ERRNO_H 1$(DL) >> $@ @echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@ @echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@ @echo $(DL)#define HAVE_GETHOSTBYADDR 1$(DL) >> $@ @echo $(DL)#define HAVE_GETHOSTBYNAME 1$(DL) >> $@ @echo $(DL)#define HAVE_GETPROTOBYNAME 1$(DL) >> $@ @echo $(DL)#define HAVE_GMTIME_R 1$(DL) >> $@ @echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@ @echo $(DL)#define HAVE_IOCTL 1$(DL) >> $@ @echo $(DL)#define HAVE_IOCTL_FIONBIO 1$(DL) >> $@ @echo $(DL)#define HAVE_LL 1$(DL) >> $@ @echo $(DL)#define HAVE_LOCALE_H 1$(DL) >> $@ @echo $(DL)#define HAVE_LOCALTIME_R 1$(DL) >> $@ @echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@ @echo $(DL)#define HAVE_NETINET_IN_H 1$(DL) >> $@ @echo $(DL)#define HAVE_RECV 1$(DL) >> $@ @echo $(DL)#define HAVE_RECVFROM 1$(DL) >> $@ @echo $(DL)#define HAVE_SELECT 1$(DL) >> $@ @echo $(DL)#define HAVE_SEND 1$(DL) >> $@ @echo $(DL)#define HAVE_SETJMP_H 1$(DL) >> $@ @echo $(DL)#define HAVE_SETLOCALE 1$(DL) >> $@ @echo $(DL)#define HAVE_SIGNAL 1$(DL) >> $@ @echo $(DL)#define HAVE_SIGNAL_H 1$(DL) >> $@ @echo $(DL)#define HAVE_SIG_ATOMIC_T 1$(DL) >> $@ @echo $(DL)#define HAVE_SOCKET 1$(DL) >> $@ @echo $(DL)#define HAVE_STDLIB_H 1$(DL) >> $@ @echo $(DL)#define HAVE_STRDUP 1$(DL) >> $@ @echo $(DL)#define HAVE_STRFTIME 1$(DL) >> $@ @echo $(DL)#define HAVE_STRING_H 1$(DL) >> $@ @echo $(DL)#define HAVE_STRSTR 1$(DL) >> $@ @echo $(DL)#define HAVE_STRUCT_TIMEVAL 1$(DL) >> $@ @echo $(DL)#define HAVE_SYS_IOCTL_H 1$(DL) >> $@ @echo $(DL)#define HAVE_SYS_STAT_H 1$(DL) >> $@ @echo $(DL)#define HAVE_SYS_TIME_H 1$(DL) >> $@ @echo $(DL)#define HAVE_TIME_H 1$(DL) >> $@ @echo $(DL)#define HAVE_UNAME 1$(DL) >> $@ @echo $(DL)#define HAVE_UNISTD_H 1$(DL) >> $@ @echo $(DL)#define HAVE_UTIME 1$(DL) >> $@ @echo $(DL)#define HAVE_UTIME_H 1$(DL) >> $@ @echo $(DL)#define HAVE_WRITEV 1$(DL) >> $@ @echo $(DL)#define RETSIGTYPE void$(DL) >> $@ @echo $(DL)#define SIZEOF_INT 4$(DL) >> $@ @echo $(DL)#define SIZEOF_SHORT 2$(DL) >> $@ @echo $(DL)#define SIZEOF_STRUCT_IN_ADDR 4$(DL) >> $@ @echo $(DL)#define STDC_HEADERS 1$(DL) >> $@ @echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@ ifdef DISABLE_LDAP @echo $(DL)#define CURL_DISABLE_LDAP 1$(DL) >> $@ else @echo $(DL)#define CURL_HAS_NOVELL_LDAPSDK 1$(DL) >> $@ ifndef DISABLE_LDAPS @echo $(DL)#define HAVE_LDAP_SSL 1$(DL) >> $@ endif @echo $(DL)#define HAVE_LDAP_SSL_H 1$(DL) >> $@ @echo $(DL)#define HAVE_LDAP_URL_PARSE 1$(DL) >> $@ endif ifdef NW_WINSOCK @echo $(DL)#define HAVE_CLOSESOCKET 1$(DL) >> $@ else @echo $(DL)#define USE_BSD_SOCKETS 1$(DL) >> $@ @echo $(DL)#define HAVE_SYS_TYPES_H 1$(DL) >> $@ @echo $(DL)#define HAVE_SYS_SOCKET_H 1$(DL) >> $@ @echo $(DL)#define HAVE_SYS_SOCKIO_H 1$(DL) >> $@ @echo $(DL)#define HAVE_NETDB_H 1$(DL) >> $@ endif ifdef WITH_ARES @echo $(DL)#define USE_ARES 1$(DL) >> $@ endif ifdef WITH_ZLIB @echo $(DL)#define HAVE_ZLIB_H 1$(DL) >> $@ @echo $(DL)#define HAVE_LIBZ 1$(DL) >> $@ endif ifdef WITH_SSL @echo $(DL)#define USE_SSLEAY 1$(DL) >> $@ @echo $(DL)#define USE_OPENSSL 1$(DL) >> $@ @echo $(DL)#define HAVE_OPENSSL_X509_H 1$(DL) >> $@ @echo $(DL)#define HAVE_OPENSSL_SSL_H 1$(DL) >> $@ @echo $(DL)#define HAVE_OPENSSL_RSA_H 1$(DL) >> $@ @echo $(DL)#define HAVE_OPENSSL_PEM_H 1$(DL) >> $@ @echo $(DL)#define HAVE_OPENSSL_ERR_H 1$(DL) >> $@ @echo $(DL)#define HAVE_OPENSSL_CRYPTO_H 1$(DL) >> $@ @echo $(DL)#define HAVE_OPENSSL_ENGINE_H 1$(DL) >> $@ @echo $(DL)#define HAVE_LIBSSL 1$(DL) >> $@ @echo $(DL)#define HAVE_LIBCRYPTO 1$(DL) >> $@ @echo $(DL)#define OPENSSL_NO_KRB5 1$(DL) >> $@ ifdef WITH_SRP @echo $(DL)#define HAVE_SSLEAY_SRP 1$(DL) >> $@ @echo $(DL)#define USE_TLS_SRP 1$(DL) >> $@ endif ifdef WITH_SPNEGO @echo $(DL)#define HAVE_SPNEGO 1$(DL) >> $@ endif else ifdef WITH_AXTLS @echo $(DL)#define USE_AXTLS 1$(DL) >> $@ endif endif ifdef WITH_SSH2 @echo $(DL)#define USE_LIBSSH2 1$(DL) >> $@ @echo $(DL)#define HAVE_LIBSSH2_H 1$(DL) >> $@ endif ifdef WITH_IDN @echo $(DL)#define HAVE_LIBIDN 1$(DL) >> $@ @echo $(DL)#define HAVE_TLD_H 1$(DL) >> $@ endif ifdef WITH_RTMP @echo $(DL)#define USE_LIBRTMP 1$(DL) >> $@ endif ifdef WITH_NGHTTP2 @echo $(DL)#define USE_NGHTTP2 1$(DL) >> $@ endif @echo $(DL)#ifdef __GNUC__$(DL) >> $@ @echo $(DL)#define HAVE_VARIADIC_MACROS_GCC 1$(DL) >> $@ @echo $(DL)#else$(DL) >> $@ @echo $(DL)#define HAVE_VARIADIC_MACROS_C99 1$(DL) >> $@ @echo $(DL)#endif$(DL) >> $@ ifdef CABUNDLE @echo $(DL)#define CURL_CA_BUNDLE "$(CABUNDLE)"$(DL) >> $@ else @echo $(DL)#define CURL_CA_BUNDLE getenv("CURL_CA_BUNDLE")$(DL) >> $@ endif $(EXPORTF): $(CURL_INC)/curl/curl.h $(CURL_INC)/curl/easy.h $(CURL_INC)/curl/multi.h $(CURL_INC)/curl/mprintf.h @echo Creating $@ @$(AWK) -f ../packages/NetWare/get_exp.awk $^ > $@ FORCE: ; info: $(OBJDIR)/version.inc @echo Configured to build $(TARGET) with these options: @echo libarchitecture: $(LIBARCH) @echo curl version: $(LIBCURL_VERSION_STR) @echo compiler/linker: $(CC) / $(LD) ifdef CABUNDLE @echo ca-bundle path: $(CABUNDLE) endif ifdef WITH_SSL @echo SSL support: enabled (OpenSSL) else @echo SSL support: no endif ifdef WITH_SRP @echo SRP support: enabled else @echo SRP support: no endif ifdef WITH_SSH2 @echo SSH2 support: enabled (libssh2) else @echo SSH2 support: no endif ifdef WITH_ZLIB @echo zlib support: enabled else @echo zlib support: no endif ifdef WITH_NGHTTP2 @echo http2 support: enabled else @echo http2 support: no endif ifdef WITH_ARES @echo c-ares support: enabled else @echo c-ares support: no endif ifdef ENABLE_IPV6 @echo IPv6 support: enabled else @echo IPv6 support: no endif $(LIBCARES_PATH)/libcares.$(LIBEXT): $(MAKE) -C $(LIBCARES_PATH) -f Makefile.netware lib ca-bundle.crt: mk-ca-bundle.pl @echo Creating $@ @-$(PERL) $< -b -n $@
{ "pile_set_name": "Github" }
// // Prefix header for all source files of the 'WeiboSDK_Sample_NoLib' target in the 'WeiboSDK_Sample_NoLib' project // #import <Availability.h> #ifndef __IPHONE_3_0 #warning "This project uses features only available in iOS SDK 3.0 and later." #endif #ifdef __OBJC__ #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> #endif
{ "pile_set_name": "Github" }
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef BASE_DEBUG_GDI_DEBUG_UTIL_WIN_H_ #define BASE_DEBUG_GDI_DEBUG_UTIL_WIN_H_ #include <windows.h> #include "base/base_export.h" namespace base { namespace debug { struct BASE_EXPORT GdiHandleCounts { int dcs = 0; int regions = 0; int bitmaps = 0; int palettes = 0; int fonts = 0; int brushes = 0; int pens = 0; int unknown = 0; int total_tracked = 0; }; // Crashes the process, using base::debug::Alias to leave valuable debugging // information in the crash dump. Pass values for |header| and |shared_section| // in the event of a bitmap allocation failure, to gather information about // those as well. BASE_EXPORT void CollectGDIUsageAndDie(BITMAPINFOHEADER* header = nullptr, HANDLE shared_section = nullptr); BASE_EXPORT GdiHandleCounts GetGDIHandleCountsInCurrentProcessForTesting(); } // namespace debug } // namespace base #endif // BASE_DEBUG_GDI_DEBUG_UTIL_WIN_H_
{ "pile_set_name": "Github" }
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jboss.weld.tests.builtinBeans.ee; import jakarta.ejb.Stateful; @Stateful public class Horse implements HorseRemote { public boolean ping() { return true; } }
{ "pile_set_name": "Github" }
{ "category": "Layers", "description": "Blend a hillshade with a raster by specifying the elevation data. The resulting raster looks similar to the original raster, but with some terrain shading, giving it a textured look.", "formal_name": "ChangeBlendRenderer", "ignore": false, "images": [ "ChangeBlendRenderer.jpg" ], "keywords": [ "Elevation", "Hillshade", "RasterLayer", "color ramp", "elevation", "image", "visualization" ], "nuget_packages": { "Esri.ArcGISRuntime": "100.9.0", "Esri.ArcGISRuntime.Xamarin.Android": "100.9.0" }, "offline_data": [ "caeef9aa78534760b07158bb8e068462" ], "redirect_from": [ "/net/latest/android/sample-code/changeblendrenderer.htm" ], "relevant_apis": [ "BlendRenderer", "ColorRamp", "Raster", "RasterLayer" ], "snippets": [ "ChangeBlendRenderer.cs" ], "title": "Blend renderer" }
{ "pile_set_name": "Github" }
{ "created_at": "2015-02-27T22:28:23.898988", "description": "Debug clojure from the browser", "fork": false, "full_name": "prismofeverything/schmetterling", "language": "JavaScript", "updated_at": "2015-02-27T23:42:35.555182" }
{ "pile_set_name": "Github" }
/** * \file PipelineGlobalSinkFilter.h */ #ifndef ATK_CORE_PIPELINEGLOBALSINKFILTER_H #define ATK_CORE_PIPELINEGLOBALSINKFILTER_H #include <ATK/Core/BaseFilter.h> #include <vector> namespace ATK { /// Class that can be used to process a pipeline that has more than one final sink. By adding these sinks to this filter, the processing is done for all sinks. class ATK_CORE_EXPORT PipelineGlobalSinkFilter final : public BaseFilter { protected: /// Simplify parent calls using Parent = BaseFilter; public: /// Constructor of the multiple sinks filter PipelineGlobalSinkFilter(); /// destructor ~PipelineGlobalSinkFilter() override = default; /*! * @brief Adds a filter to the list of filters to process * @param filter is an additional filter */ void add_filter(gsl::not_null<BaseFilter*> filter); /*! * @brief Removes a filter from the list of filters to process * @param filter is an additional filter */ void remove_filter(gsl::not_null<const BaseFilter*> filter); int get_type() const final; void set_input_port(gsl::index input_port, gsl::not_null<BaseFilter*> filter, gsl::index output_port) final; void set_input_port(gsl::index input_port, BaseFilter& filter, gsl::index output_port) final; /*! * @brief Indicates if we can process the pipeline in parallel */ void set_parallel(bool parallel); protected: void process_impl(gsl::index size) const final; void prepare_process(gsl::index size) final; void prepare_outputs(gsl::index size) final; /// List of filters in this sink std::vector<gsl::not_null<BaseFilter*>> filters; /// Are we in parallel mode? bool activate_parallel = false; }; } #endif
{ "pile_set_name": "Github" }
const { splitWhen } = require('ramda'); async function performance(page) { try { const performanceTiming = JSON.parse( await page.evaluate(() => JSON.stringify(window.performance.timing)) ); return extractDataFromPerformanceTiming( performanceTiming, 'responseEnd', 'domInteractive', 'domContentLoadedEventEnd', 'loadEventEnd' ); } catch (err) { console.error(err); } } const extractDataFromPerformanceTiming = (timing, ...dataNames) => { const navigationStart = timing.navigationStart; const extractedData = {}; dataNames.forEach(name => { extractedData[name] = timing[name] - navigationStart; }); return extractedData; }; async function metrics(page, bench, testFunction) { try { await page.tracing.start({ path: 'trace.json' }); await page.evaluate(() => console.timeStamp('initBenchmark')); let client; if (bench.throttleCPU) { client = await page.target().createCDPSession(); await client.send('Emulation.setCPUThrottlingRate', { rate: bench.throttleCPU }); } await page.evaluate(() => console.timeStamp('runBenchmark')); await testFunction.apply(null, arguments); if (bench.throttleCPU) { await client.send('Emulation.setCPUThrottlingRate', { rate: 1 }); } // Wait a little so the paint event is traced. await page.waitFor(100); await page.evaluate(() => console.timeStamp('finishBenchmark')); const trace = JSON.parse((await page.tracing.stop()).toString()); const events = getBenchEventsWindow(trace.traceEvents); const duration = getLastPaint(events) - getFirstClick(events); console.log('***', bench.lib.padEnd(10), bench.id.padEnd(23), duration); if (duration < 0) { console.log('soundness check failed. reported duration is less than 0'); throw 'soundness check failed. reported duration is less than 0'; } return { time: duration }; } catch (err) { console.error(err); } } function getBenchEventsWindow(events) { events = splitWhen(x => { return x.name === 'TimeStamp' && x.args.data.message === 'runBenchmark'; }, events); events = splitWhen(x => { return x.name === 'TimeStamp' && x.args.data.message === 'finishBenchmark'; }, events[1]); return events[0]; } // const getTimestamp = (trace, msg) => // trace.traceEvents.find(x => { // return x.name === 'TimeStamp' && x.args.data.message === msg; // }).ts / 1000; const getFirstClick = events => { const clicks = events.filter(x => { return x.name === 'EventDispatch' && x.args.data.type === 'click'; }); if (clicks.length !== 1) { console.log('exactly one click event is expected', events); throw 'exactly one click event is expected'; } return clicks[0].ts / 1000; }; const getLastPaint = events => { const paints = events .filter(x => x.name === 'Paint') .map(x => ({ end: x.ts + x.dur })); let lastPaint = paints.reduce( (max, elem) => (max.end > elem.end ? max : elem), { end: 0 } ); return lastPaint.end / 1000; }; function randomNoRepeats(array) { var copy = array.slice(0); return function() { if (copy.length < 1) { copy = array.slice(0); } var index = Math.floor(Math.random() * copy.length); var item = copy[index]; copy.splice(index, 1); return item; }; } function pairwise(a, b) { var pairs = []; for (var i = 0; i < a.length; i++) { for (var j = 0; j < b.length; j++) { pairs.push([a[i], b[j]]); } } return pairs; } async function testTextContains(page, path, value) { const elHandle = await page.waitForXPath(path); return page.waitFor( (el, value) => el && el.textContent.includes(value), {}, elHandle, value ); } async function getTextByXPath(page, path) { const elHandle = await page.waitForXPath(path); return page.evaluate(el => el && el.textContent, elHandle); } async function clickElementByXPath(page, path) { const elHandle = await page.waitForXPath(path); return page.evaluate(el => el && el.click(), elHandle); } async function testClassContains(page, path, value) { const elHandle = await page.waitForXPath(path); return page.evaluate( (el, value) => el && el.className.includes(value), elHandle, value ); } module.exports = { performance, metrics, randomNoRepeats, pairwise, testTextContains, getTextByXPath, clickElementByXPath, testClassContains };
{ "pile_set_name": "Github" }
/* Copyright 2014 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package clientcmd import ( "encoding/json" "fmt" "io" "io/ioutil" "os" "golang.org/x/crypto/ssh/terminal" clientauth "k8s.io/client-go/tools/auth" ) // AuthLoaders are used to build clientauth.Info objects. type AuthLoader interface { // LoadAuth takes a path to a config file and can then do anything it needs in order to return a valid clientauth.Info LoadAuth(path string) (*clientauth.Info, error) } // default implementation of an AuthLoader type defaultAuthLoader struct{} // LoadAuth for defaultAuthLoader simply delegates to clientauth.LoadFromFile func (*defaultAuthLoader) LoadAuth(path string) (*clientauth.Info, error) { return clientauth.LoadFromFile(path) } type PromptingAuthLoader struct { reader io.Reader } // LoadAuth parses an AuthInfo object from a file path. It prompts user and creates file if it doesn't exist. func (a *PromptingAuthLoader) LoadAuth(path string) (*clientauth.Info, error) { // Prompt for user/pass and write a file if none exists. if _, err := os.Stat(path); os.IsNotExist(err) { authPtr, err := a.Prompt() auth := *authPtr if err != nil { return nil, err } data, err := json.Marshal(auth) if err != nil { return &auth, err } err = ioutil.WriteFile(path, data, 0600) return &auth, err } authPtr, err := clientauth.LoadFromFile(path) if err != nil { return nil, err } return authPtr, nil } // Prompt pulls the user and password from a reader func (a *PromptingAuthLoader) Prompt() (*clientauth.Info, error) { var err error auth := &clientauth.Info{} auth.User, err = promptForString("Username", a.reader, true) if err != nil { return nil, err } auth.Password, err = promptForString("Password", nil, false) if err != nil { return nil, err } return auth, nil } func promptForString(field string, r io.Reader, show bool) (result string, err error) { fmt.Printf("Please enter %s: ", field) if show { _, err = fmt.Fscan(r, &result) } else { var data []byte if terminal.IsTerminal(int(os.Stdin.Fd())) { data, err = terminal.ReadPassword(int(os.Stdin.Fd())) result = string(data) } else { return "", fmt.Errorf("error reading input for %s", field) } } return result, err } // NewPromptingAuthLoader is an AuthLoader that parses an AuthInfo object from a file path. It prompts user and creates file if it doesn't exist. func NewPromptingAuthLoader(reader io.Reader) *PromptingAuthLoader { return &PromptingAuthLoader{reader} } // NewDefaultAuthLoader returns a default implementation of an AuthLoader that only reads from a config file func NewDefaultAuthLoader() AuthLoader { return &defaultAuthLoader{} }
{ "pile_set_name": "Github" }
<?php /** * Class for backwards compatibility only */
{ "pile_set_name": "Github" }
Fragen und Antworten • Duplikate ausschließen - wie? ==================================================== Date: 2014-08-28 20:00:08 Hallo,\ \ ziemlich unschöne Trefferliste [site:gimpforum.de Vorgabe Massstab](http://79.227.13.212/yacysearch.html?query=site%3Agimpforum.de+Vorgabe+Massstab&contentdom=text&former=site%3Agimpforum.de+%22Vorgabe-Massstab%22&maximumRecords=10&startRecord=0&verify=ifexist&resource=global&nav=location%2Chosts%2Cauthors%2Cnamespace%2Ctopics%2Cfiletype%2Cprotocol%2Clanguage&prefermaskfilter=&depth=0&cat=href&constraint=&meanCount=5){.postlink}. Duplikate auf zwei Seiten. Was k.m. dagegen tun? Wie fitten? Bzw. was habe ich evtl. beim Crawlen falsch gemacht? Statistik: Verfasst von [flegno](http://forum.yacy-websuche.de/memberlist.php?mode=viewprofile&u=9475) --- Do Aug 28, 2014 7:00 pm ------------------------------------------------------------------------
{ "pile_set_name": "Github" }
// Copyright Aleksey Gurtovoy 2000-2004 // Copyright Jaap Suter 2003 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // Preprocessed version of "boost/mpl/bitxor.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { template< typename Tag1 , typename Tag2 > struct bitxor_impl : if_c< ( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1) > BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2) ) , aux::cast2nd_impl< bitxor_impl< Tag1,Tag1 >,Tag1, Tag2 > , aux::cast1st_impl< bitxor_impl< Tag2,Tag2 >,Tag1, Tag2 > >::type { }; /// for Digital Mars C++/compilers with no CTPS/TTP support template<> struct bitxor_impl< na,na > { template< typename U1, typename U2 > struct apply { typedef apply type; BOOST_STATIC_CONSTANT(int, value = 0); }; }; template< typename Tag > struct bitxor_impl< na,Tag > { template< typename U1, typename U2 > struct apply { typedef apply type; BOOST_STATIC_CONSTANT(int, value = 0); }; }; template< typename Tag > struct bitxor_impl< Tag,na > { template< typename U1, typename U2 > struct apply { typedef apply type; BOOST_STATIC_CONSTANT(int, value = 0); }; }; template< typename T > struct bitxor_tag { typedef typename T::tag type; }; template< typename BOOST_MPL_AUX_NA_PARAM(N1) , typename BOOST_MPL_AUX_NA_PARAM(N2) , typename N3 = na, typename N4 = na, typename N5 = na > struct bitxor_ : bitxor_< bitxor_< bitxor_< bitxor_< N1,N2 >, N3>, N4>, N5> { BOOST_MPL_AUX_LAMBDA_SUPPORT( 5 , bitxor_ , ( N1, N2, N3, N4, N5 ) ) }; template< typename N1, typename N2, typename N3, typename N4 > struct bitxor_< N1,N2,N3,N4,na > : bitxor_< bitxor_< bitxor_< N1,N2 >, N3>, N4> { BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( 5 , bitxor_ , ( N1, N2, N3, N4, na ) ) }; template< typename N1, typename N2, typename N3 > struct bitxor_< N1,N2,N3,na,na > : bitxor_< bitxor_< N1,N2 >, N3> { BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( 5 , bitxor_ , ( N1, N2, N3, na, na ) ) }; template< typename N1, typename N2 > struct bitxor_< N1,N2,na,na,na > : bitxor_impl< typename bitxor_tag<N1>::type , typename bitxor_tag<N2>::type >::template apply< N1,N2 >::type { BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( 5 , bitxor_ , ( N1, N2, na, na, na ) ) }; BOOST_MPL_AUX_NA_SPEC2(2, 5, bitxor_) }} namespace boost { namespace mpl { template<> struct bitxor_impl< integral_c_tag,integral_c_tag > { template< typename N1, typename N2 > struct apply : integral_c< typename aux::largest_int< typename N1::value_type , typename N2::value_type >::type , ( BOOST_MPL_AUX_VALUE_WKND(N1)::value ^ BOOST_MPL_AUX_VALUE_WKND(N2)::value ) > { }; }; }}
{ "pile_set_name": "Github" }
#TMSH-VERSION: 13.1.1 sys global-settings { hostname f5_bigip_structured_net_trunk_interface_implicit } net trunk trunk1 { interfaces { 1.0 } }
{ "pile_set_name": "Github" }
! -*- f90 -*- ! ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Info_free_f08(info,ierror) use :: mpi_f08_types, only : MPI_Info use :: ompi_mpifh_bindings, only : ompi_info_free_f implicit none TYPE(MPI_Info), INTENT(INOUT) :: info INTEGER, OPTIONAL, INTENT(OUT) :: ierror integer :: c_ierror call ompi_info_free_f(info%MPI_VAL,c_ierror) if (present(ierror)) ierror = c_ierror end subroutine PMPI_Info_free_f08
{ "pile_set_name": "Github" }
<template> <v-select v-model="incidentStatuses" :items="items" :menu-props="{ maxHeight: '400' }" :label="label" multiple clearable chips /> </template> <script> import { cloneDeep } from "lodash" export default { name: "IncidentStatusMultiSelect", props: { value: { priority: Array, default: function() { return [] } }, label: { priority: String, default: function() { return "Statuses" } } }, data() { return { items: ["Active", "Stable", "Closed"] } }, computed: { incidentStatuses: { get() { return cloneDeep(this.value) }, set(value) { this.$emit("input", value) } } } } </script>
{ "pile_set_name": "Github" }
// Copyright (C) 2013 Vicente J. Botet Escriba // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // 2013/10 Vicente J. Botet Escriba // Creation. #ifndef BOOST_CSBL_MEMORY_ALLOCATOR_TRAITS_HPP #define BOOST_CSBL_MEMORY_ALLOCATOR_TRAITS_HPP #include <boost/thread/csbl/memory/config.hpp> // 20.7.8, allocator traits #if defined BOOST_NO_CXX11_ALLOCATOR #include <boost/container/allocator_traits.hpp> namespace boost { namespace csbl { using ::boost::container::allocator_traits; } } #else namespace boost { namespace csbl { using ::std::allocator_traits; } } #endif // BOOST_NO_CXX11_POINTER_TRAITS #endif // header
{ "pile_set_name": "Github" }
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0/ * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ #include "RangeController/RangeControllerAttributeBuilder.h" #include <cmath> #include <AVSCommon/Utils/Logger/Logger.h> namespace alexaClientSDK { namespace capabilityAgents { namespace rangeController { using namespace avsCommon::avs; using namespace avsCommon::sdkInterfaces; using namespace avsCommon::sdkInterfaces::rangeController; using namespace avsCommon::utils; /// String to identify log entries originating from this file. static const std::string TAG{"RangeControllerAttributeBuilder"}; /** * Create a LogEntry using this file's TAG and the specified event string. * * @param The event string for this @c LogEntry. */ #define LX(event) avsCommon::utils::logger::LogEntry(TAG, event) std::unique_ptr<RangeControllerAttributeBuilder> RangeControllerAttributeBuilder::create() { return std::unique_ptr<RangeControllerAttributeBuilder>(new RangeControllerAttributeBuilder()); } RangeControllerAttributeBuilder::RangeControllerAttributeBuilder() : m_invalidAttribute{false}, m_unitOfMeasure{Optional<resources::AlexaUnitOfMeasure>()} { } RangeControllerAttributeBuilder& RangeControllerAttributeBuilder::withCapabilityResources( const CapabilityResources& capabilityResources) { ACSDK_DEBUG5(LX(__func__)); if (!capabilityResources.isValid()) { ACSDK_ERROR(LX("withCapabilityResourcesFailed").d("reason", "invalidCapabilityResources")); m_invalidAttribute = true; return *this; } m_capabilityResources = capabilityResources; return *this; } RangeControllerAttributeBuilder& RangeControllerAttributeBuilder::withUnitOfMeasure( const resources::AlexaUnitOfMeasure& unitOfMeasure) { ACSDK_DEBUG5(LX(__func__)); if (unitOfMeasure.empty()) { ACSDK_ERROR(LX("withUnitOfMeasureFailed").d("reason", "invalidUnitOfMeasure")); m_invalidAttribute = true; return *this; } m_unitOfMeasure = Optional<resources::AlexaUnitOfMeasure>(unitOfMeasure); return *this; } RangeControllerAttributeBuilder& RangeControllerAttributeBuilder::addPreset( const std::pair<double, PresetResources>& preset) { ACSDK_DEBUG5(LX(__func__)); if (!preset.second.isValid()) { ACSDK_ERROR(LX("addPresetFailed").d("reason", "invalidPresetResources")); m_invalidAttribute = true; return *this; } ACSDK_DEBUG5(LX(__func__).sensitive("preset", preset.first).sensitive("presetResources", preset.second.toJson())); m_presets.push_back(preset); return *this; } avsCommon::utils::Optional<RangeControllerAttributes> RangeControllerAttributeBuilder::build() { ACSDK_DEBUG5(LX(__func__)); avsCommon::utils::Optional<RangeControllerAttributes> controllerAttribute; if (m_invalidAttribute) { ACSDK_ERROR(LX("buildFailed").d("reason", "invalidAttribute")); return controllerAttribute; } ACSDK_DEBUG5(LX(__func__).sensitive("capabilityResources", m_capabilityResources.toJson())); ACSDK_DEBUG5(LX(__func__).sensitive("unitOfMeasure", m_unitOfMeasure.valueOr(""))); ACSDK_DEBUG5(LX(__func__).d("#presets", m_presets.size())); return avsCommon::utils::Optional<RangeControllerAttributes>({m_capabilityResources, m_unitOfMeasure, m_presets}); } } // namespace rangeController } // namespace capabilityAgents } // namespace alexaClientSDK
{ "pile_set_name": "Github" }
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.camel.component.exec; import org.apache.camel.Exchange; import org.apache.camel.component.exec.impl.DefaultExecCommandExecutor; import org.apache.camel.spi.CamelLogger; import org.apache.camel.support.DefaultProducer; import org.apache.camel.util.ObjectHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Exec producer. * * @see {link Producer} */ public class ExecProducer extends DefaultProducer { private final Logger log; private final CamelLogger logger; private final ExecEndpoint endpoint; public ExecProducer(ExecEndpoint endpoint) { super(endpoint); this.endpoint = endpoint; this.log = LoggerFactory.getLogger(ExecProducer.class); this.logger = new CamelLogger(log); } @Override public void process(Exchange exchange) throws Exception { ExecCommand execCommand = getBinding().readInput(exchange, endpoint); ExecCommandExecutor executor = endpoint.getCommandExecutor(); if (executor == null) { // create a new non-shared executor executor = new DefaultExecCommandExecutor(); } logger.log(String.format("Executing %s", execCommand), execCommand.getCommandLogLevel()); ExecResult result = executor.execute(execCommand); ObjectHelper.notNull(result, "The command executor must return a not-null result"); logger.log(String.format("The command %s had exit value %s", execCommand, result.getExitValue()), execCommand.getCommandLogLevel()); if (result.getExitValue() != 0) { log.error("The command {} returned exit value {}", execCommand, result.getExitValue()); } getBinding().writeOutput(exchange, result); } private ExecBinding getBinding() { return endpoint.getBinding(); } }
{ "pile_set_name": "Github" }
geometry_msgs/Pose pose --- bool success string message
{ "pile_set_name": "Github" }
load_lib libgomp-dg.exp load_gcc_lib gcc-dg.exp load_gcc_lib gfortran-dg.exp global shlib_ext global ALWAYS_CFLAGS set shlib_ext [get_shlib_extension] set lang_library_path "../libgfortran/.libs" set lang_link_flags "-lgfortran -foffload=-lgfortran" if [info exists lang_include_flags] then { unset lang_include_flags } set lang_test_file_found 0 set quadmath_library_path "../libquadmath/.libs" # Initialize dg. dg-init # Turn on OpenMP. lappend ALWAYS_CFLAGS "additional_flags=-fopenmp" if { $blddir != "" } { set lang_source_re {^.*\.[fF](|90|95|03|08)$} set lang_include_flags "-fintrinsic-modules-path=${blddir}" # Look for a static libgfortran first. if [file exists "${blddir}/${lang_library_path}/libgfortran.a"] { set lang_test_file "${lang_library_path}/libgfortran.a" set lang_test_file_found 1 # We may have a shared only build, so look for a shared libgfortran. } elseif [file exists "${blddir}/${lang_library_path}/libgfortran.${shlib_ext}"] { set lang_test_file "${lang_library_path}/libgfortran.${shlib_ext}" set lang_test_file_found 1 } else { puts "No libgfortran library found, will not execute fortran tests" } } elseif [info exists GFORTRAN_UNDER_TEST] { set lang_test_file_found 1 # Needs to exist for libgomp.exp. set lang_test_file "" } else { puts "GFORTRAN_UNDER_TEST not defined, will not execute fortran tests" } if { $lang_test_file_found } { # Gather a list of all tests. set tests [lsort [find $srcdir/$subdir *.\[fF\]{,90,95,03,08}]] if { $blddir != "" } { if { [file exists "${blddir}/${quadmath_library_path}/libquadmath.a"] || [file exists "${blddir}/${quadmath_library_path}/libquadmath.${shlib_ext}"] } { lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/${quadmath_library_path}/" # Allow for spec subsitution. lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/${quadmath_library_path}/" set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}:${blddir}/${quadmath_library_path}" } else { set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}" } } else { set ld_library_path "$always_ld_library_path" } append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST] set_ld_library_path_env_vars # For Fortran we're doing torture testing, as Fortran has far more tests # with arrays etc. that testing just -O0 or -O2 is insufficient, that is # typically not the case for C/C++. gfortran-dg-runtest $tests "" "" } # All done. dg-finish
{ "pile_set_name": "Github" }
<?php /** * @file * Contains the basic 'node_revision' field handler. */ class views_handler_field_node_revision extends views_handler_field_node { function init(&$view, $options) { parent::init($view, $options); if (!empty($this->options['link_to_node_revision'])) { $this->additional_fields['vid'] = 'vid'; $this->additional_fields['nid'] = 'nid'; if (module_exists('translation')) { $this->additional_fields['language'] = array('table' => 'node', 'field' => 'language'); } } } function option_definition() { $options = parent::option_definition(); $options['link_to_node_revision'] = array('default' => FALSE); return $options; } /** * Provide link to revision option. */ function options_form(&$form, &$form_state) { parent::options_form($form, $form_state); $form['link_to_node_revision'] = array( '#title' => t('Link this field to its node revision'), '#description' => t('This will override any other link you have set.'), '#type' => 'checkbox', '#default_value' => !empty($this->options['link_to_node_revision']), ); } /** * Render whatever the data is as a link to the node. * * Data should be made XSS safe prior to calling this function. */ function render_link($data, $values) { if (!empty($this->options['link_to_node_revision']) && $data !== NULL && $data !== '') { $this->options['alter']['make_link'] = TRUE; $this->options['alter']['path'] = "node/" . $values->{$this->aliases['nid']} . '/revisions/' . $values->{$this->aliases['vid']} .'/view'; if (isset($this->aliases['language'])) { $languages = language_list(); if (isset($languages[$values->{$this->aliases['language']}])) { $this->options['alter']['language'] = $languages[$values->{$this->aliases['language']}]; } } } else { return parent::render_link($data, $values); } return $data; } }
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>CSS Masking: mask-size: mask layer size</title> <link rel="author" title="Astley Chen" href="mailto:aschen@mozilla.com"> <link rel="author" title="Mozilla" href="https://www.mozilla.org"> <link rel="help" href="https://www.w3.org/TR/css-masking-1/#the-mask-size"> <link rel="match" href="mask-size-auto-length-ref.html"> <meta name="assert" content="Test checks whether sizing mask layer works correctly or not."> <style type="text/css"> #outer { border: 1px solid black; width: 64px; height: 128px; } #inner { width: 64px; height: 128px; background-color: purple; mask-image: url(support/50x50-opaque-blue.svg); mask-repeat: no-repeat; mask-position: left top; mask-size: auto 15.625%; } </style> </head> <body> <div id="outer"> <div id="inner"></div> </div> </body> </html>
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <config xmlns="http://www.knime.org/2008/09/XMLConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.knime.org/2008/09/XMLConfig http://www.knime.org/XMLConfig_2008_09.xsd" key="settings.xml"> <entry key="node_file" type="xstring" value="settings.xml"/> <config key="flow_stack"/> <config key="internal_node_subsettings"> <entry key="memory_policy" type="xstring" value="CacheSmallInMemory"/> </config> <config key="model"> <config key="variable-filter"> <entry key="filter-type" type="xstring" value="STANDARD"/> <config key="included_names"> <entry key="array-size" type="xint" value="0"/> </config> <config key="excluded_names"> <entry key="array-size" type="xint" value="0"/> </config> <entry key="enforce_option" type="xstring" value="EnforceInclusion"/> <config key="name_pattern"> <entry key="pattern" type="xstring" value=""/> <entry key="type" type="xstring" value="Wildcard"/> <entry key="caseSensitive" type="xboolean" value="true"/> </config> </config> <entry key="variable-prefix" type="xstring" isnull="true" value=""/> <config key="port-names"> <entry key="array-size" type="xint" value="1"/> <entry key="0" type="xstring" value="Port 1"/> </config> <config key="port-descriptions"> <entry key="array-size" type="xint" value="1"/> <entry key="0" type="xstring" value=""/> </config> </config> <entry key="customDescription" type="xstring" isnull="true" value=""/> <entry key="state" type="xstring" value="IDLE"/> <entry key="isDeletable" type="xboolean" value="false"/> <entry key="factory" type="xstring" value="org.knime.core.node.workflow.virtual.subnode.VirtualSubNodeOutputNodeFactory"/> <entry key="node-name" type="xstring" value="Component Output"/> <entry key="node-bundle-name" type="xstring" value="KNIME Core API"/> <entry key="node-bundle-symbolic-name" type="xstring" value="org.knime.core"/> <entry key="node-bundle-vendor" type="xstring" value="KNIME AG, Zurich, Switzerland"/> <entry key="node-bundle-version" type="xstring" value="4.1.0.qualifier"/> <entry key="node-feature-name" type="xstring" isnull="true" value=""/> <entry key="node-feature-symbolic-name" type="xstring" isnull="true" value=""/> <entry key="node-feature-vendor" type="xstring" isnull="true" value=""/> <entry key="node-feature-version" type="xstring" value="0.0.0"/> <config key="factory_settings"> <config key="port_0"> <entry key="index" type="xint" value="0"/> <config key="type"> <entry key="object_class" type="xstring" value="org.knime.core.node.BufferedDataTable"/> </config> </config> </config> <entry key="name" type="xstring" value="Component Output"/> <entry key="hasContent" type="xboolean" value="false"/> <entry key="isInactive" type="xboolean" value="false"/> <config key="ports"/> <config key="filestores"> <entry key="file_store_location" type="xstring" isnull="true" value=""/> <entry key="file_store_id" type="xstring" isnull="true" value=""/> </config> </config>
{ "pile_set_name": "Github" }
// Code generated by protoc-gen-go. DO NOT EDIT. // source: grpc/gcp/altscontext.proto package grpc_gcp import ( fmt "fmt" proto "github.com/golang/protobuf/proto" math "math" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type AltsContext struct { // The application protocol negotiated for this connection. ApplicationProtocol string `protobuf:"bytes,1,opt,name=application_protocol,json=applicationProtocol,proto3" json:"application_protocol,omitempty"` // The record protocol negotiated for this connection. RecordProtocol string `protobuf:"bytes,2,opt,name=record_protocol,json=recordProtocol,proto3" json:"record_protocol,omitempty"` // The security level of the created secure channel. SecurityLevel SecurityLevel `protobuf:"varint,3,opt,name=security_level,json=securityLevel,proto3,enum=grpc.gcp.SecurityLevel" json:"security_level,omitempty"` // The peer service account. PeerServiceAccount string `protobuf:"bytes,4,opt,name=peer_service_account,json=peerServiceAccount,proto3" json:"peer_service_account,omitempty"` // The local service account. LocalServiceAccount string `protobuf:"bytes,5,opt,name=local_service_account,json=localServiceAccount,proto3" json:"local_service_account,omitempty"` // The RPC protocol versions supported by the peer. PeerRpcVersions *RpcProtocolVersions `protobuf:"bytes,6,opt,name=peer_rpc_versions,json=peerRpcVersions,proto3" json:"peer_rpc_versions,omitempty"` // Additional attributes of the peer. PeerAttributes map[string]string `protobuf:"bytes,7,rep,name=peer_attributes,json=peerAttributes,proto3" json:"peer_attributes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } func (m *AltsContext) Reset() { *m = AltsContext{} } func (m *AltsContext) String() string { return proto.CompactTextString(m) } func (*AltsContext) ProtoMessage() {} func (*AltsContext) Descriptor() ([]byte, []int) { return fileDescriptor_6647a41e53a575a3, []int{0} } func (m *AltsContext) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AltsContext.Unmarshal(m, b) } func (m *AltsContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_AltsContext.Marshal(b, m, deterministic) } func (m *AltsContext) XXX_Merge(src proto.Message) { xxx_messageInfo_AltsContext.Merge(m, src) } func (m *AltsContext) XXX_Size() int { return xxx_messageInfo_AltsContext.Size(m) } func (m *AltsContext) XXX_DiscardUnknown() { xxx_messageInfo_AltsContext.DiscardUnknown(m) } var xxx_messageInfo_AltsContext proto.InternalMessageInfo func (m *AltsContext) GetApplicationProtocol() string { if m != nil { return m.ApplicationProtocol } return "" } func (m *AltsContext) GetRecordProtocol() string { if m != nil { return m.RecordProtocol } return "" } func (m *AltsContext) GetSecurityLevel() SecurityLevel { if m != nil { return m.SecurityLevel } return SecurityLevel_SECURITY_NONE } func (m *AltsContext) GetPeerServiceAccount() string { if m != nil { return m.PeerServiceAccount } return "" } func (m *AltsContext) GetLocalServiceAccount() string { if m != nil { return m.LocalServiceAccount } return "" } func (m *AltsContext) GetPeerRpcVersions() *RpcProtocolVersions { if m != nil { return m.PeerRpcVersions } return nil } func (m *AltsContext) GetPeerAttributes() map[string]string { if m != nil { return m.PeerAttributes } return nil } func init() { proto.RegisterType((*AltsContext)(nil), "grpc.gcp.AltsContext") proto.RegisterMapType((map[string]string)(nil), "grpc.gcp.AltsContext.PeerAttributesEntry") } func init() { proto.RegisterFile("grpc/gcp/altscontext.proto", fileDescriptor_6647a41e53a575a3) } var fileDescriptor_6647a41e53a575a3 = []byte{ // 411 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0x4d, 0x6f, 0x13, 0x31, 0x10, 0x86, 0xb5, 0x0d, 0x2d, 0xe0, 0x88, 0xb4, 0xb8, 0xa9, 0x58, 0x45, 0x42, 0x8a, 0xb8, 0xb0, 0x5c, 0x76, 0x21, 0x5c, 0x10, 0x07, 0x50, 0x8a, 0x38, 0x20, 0x71, 0x88, 0xb6, 0x12, 0x07, 0x2e, 0x2b, 0x77, 0x3a, 0xb2, 0x2c, 0x5c, 0x8f, 0x35, 0x76, 0x22, 0xf2, 0xb3, 0xf9, 0x07, 0x68, 0xed, 0xcd, 0x07, 0x1f, 0xb7, 0x9d, 0x79, 0x9f, 0x19, 0xbf, 0xb3, 0x33, 0x62, 0xa6, 0xd9, 0x43, 0xa3, 0xc1, 0x37, 0xca, 0xc6, 0x00, 0xe4, 0x22, 0xfe, 0x8c, 0xb5, 0x67, 0x8a, 0x24, 0x1f, 0xf5, 0x5a, 0xad, 0xc1, 0xcf, 0xaa, 0x3d, 0x15, 0x59, 0xb9, 0xe0, 0x89, 0x63, 0x17, 0x10, 0xd6, 0x6c, 0xe2, 0xb6, 0x03, 0xba, 0xbf, 0x27, 0x97, 0x6b, 0x5e, 0xfc, 0x1a, 0x89, 0xf1, 0xd2, 0xc6, 0xf0, 0x29, 0x77, 0x92, 0x6f, 0xc4, 0x54, 0x79, 0x6f, 0x0d, 0xa8, 0x68, 0xc8, 0x75, 0x09, 0x02, 0xb2, 0x65, 0x31, 0x2f, 0xaa, 0xc7, 0xed, 0xe5, 0x91, 0xb6, 0x1a, 0x24, 0xf9, 0x52, 0x9c, 0x33, 0x02, 0xf1, 0xdd, 0x81, 0x3e, 0x49, 0xf4, 0x24, 0xa7, 0xf7, 0xe0, 0x07, 0x31, 0xd9, 0x9b, 0xb0, 0xb8, 0x41, 0x5b, 0x8e, 0xe6, 0x45, 0x35, 0x59, 0x3c, 0xab, 0x77, 0xc6, 0xeb, 0x9b, 0x41, 0xff, 0xda, 0xcb, 0xed, 0x93, 0x70, 0x1c, 0xca, 0xd7, 0x62, 0xea, 0x11, 0xb9, 0x0b, 0xc8, 0x1b, 0x03, 0xd8, 0x29, 0x00, 0x5a, 0xbb, 0x58, 0x3e, 0x48, 0xaf, 0xc9, 0x5e, 0xbb, 0xc9, 0xd2, 0x32, 0x2b, 0x72, 0x21, 0xae, 0x2c, 0x81, 0xb2, 0xff, 0x94, 0x9c, 0xe6, 0x71, 0x92, 0xf8, 0x57, 0xcd, 0x17, 0xf1, 0x34, 0xbd, 0xc2, 0x1e, 0xba, 0x0d, 0x72, 0x30, 0xe4, 0x42, 0x79, 0x36, 0x2f, 0xaa, 0xf1, 0xe2, 0xf9, 0xc1, 0x68, 0xeb, 0x61, 0x37, 0xd7, 0xb7, 0x01, 0x6a, 0xcf, 0xfb, 0xba, 0xd6, 0xc3, 0x2e, 0x21, 0x5b, 0x91, 0x52, 0x9d, 0x8a, 0x91, 0xcd, 0xed, 0x3a, 0x62, 0x28, 0x1f, 0xce, 0x47, 0xd5, 0x78, 0xf1, 0xea, 0xd0, 0xe8, 0xe8, 0xe7, 0xd7, 0x2b, 0x44, 0x5e, 0xee, 0xd9, 0xcf, 0x2e, 0xf2, 0xb6, 0x9d, 0xf8, 0x3f, 0x92, 0xb3, 0xa5, 0xb8, 0xfc, 0x0f, 0x26, 0x2f, 0xc4, 0xe8, 0x07, 0x6e, 0x87, 0x35, 0xf5, 0x9f, 0x72, 0x2a, 0x4e, 0x37, 0xca, 0xae, 0x71, 0x58, 0x46, 0x0e, 0xde, 0x9f, 0xbc, 0x2b, 0xae, 0xad, 0xb8, 0x32, 0x94, 0x1d, 0xf4, 0x47, 0x54, 0x1b, 0x17, 0x91, 0x9d, 0xb2, 0xd7, 0x17, 0x47, 0x66, 0xd2, 0x74, 0xab, 0xe2, 0xfb, 0x47, 0x4d, 0xa4, 0x2d, 0xd6, 0x9a, 0xac, 0x72, 0xba, 0x26, 0xd6, 0x4d, 0x3a, 0x2e, 0x60, 0xbc, 0x43, 0x17, 0x8d, 0xb2, 0x21, 0x9d, 0x62, 0xb3, 0xeb, 0xd2, 0xa4, 0x2b, 0x48, 0x50, 0xa7, 0xc1, 0xdf, 0x9e, 0xa5, 0xf8, 0xed, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9b, 0x8c, 0xe4, 0x6a, 0xba, 0x02, 0x00, 0x00, }
{ "pile_set_name": "Github" }
#ifndef betr_algorithm_h_ #define betr_algorithm_h_ //: // \file // \brief The base class for betr algorithms // \author J.L. Mundy // \date July 4, 2016 // #include <string> #include <utility> #ifdef _MSC_VER # include <vcl_msvc_warnings.h> #endif #include <vbl/vbl_ref_count.h> #include <vil/vil_image_resource.h> #include <vsol/vsol_box_2d.h> #include <vsol/vsol_polygon_2d.h> #include <vsol/vsol_polygon_2d_sptr.h> #include "betr_params.h" class betr_algorithm : public vbl_ref_count { public: betr_algorithm() : name_("no_name") , identifier_("null") , offset_(0.0) , alpha_(1.0) , verbose_(false) , params_(nullptr){} betr_algorithm(std::string name) : name_(std::move(name)) , offset_(0.0) , alpha_(1.0) , verbose_(false) , params_(nullptr) {} betr_algorithm(std::string name, double offset, double alpha) : name_(std::move(name)) , offset_(offset) , alpha_(alpha) , verbose_(false) , multiple_ref_(false) , params_(nullptr) {} betr_algorithm(std::string name, betr_params_sptr const& params, double offset, double alpha) : name_(std::move(name)) , offset_(offset) , alpha_(alpha) , verbose_(false) , multiple_ref_(false) , params_(params) {} //: sigmoid performance parameters - may be specialized for each algorithm void set_offset(double offset){offset_ = offset;} void set_alpha(double alpha){alpha_ = alpha;} //: algorithm parameters, e.g. edge detection threshold void set_params(betr_params_sptr const& params){params_ = params;} //: data inputs //: reference image(s) void set_reference_image(vil_image_resource_sptr const& ref_imgr){ref_rescs_.clear(); ref_rescs_.push_back(ref_imgr);} void set_reference_images(std::vector<vil_image_resource_sptr> const& ref_rescs){ref_rescs_ = ref_rescs;} //: event image - an algorithm processes one event region per event image at a time void set_event_image(vil_image_resource_sptr const& evt_imgr){evt_imgr_ = evt_imgr;} //: projected 3-d region(s) using the camera model for an image // the projected reference regions (one per reference image) void set_proj_ref_ref_object(vsol_polygon_2d_sptr const& ref_poly) {ref_ref_polys_.clear();ref_ref_polys_.push_back(ref_poly);} void set_proj_ref_ref_objects(std::vector<vsol_polygon_2d_sptr> const& ref_polys){ref_ref_polys_= ref_polys;} //: the event regions (one per reference image) void set_proj_ref_evt_object(vsol_polygon_2d_sptr const& evt_poly) {ref_evt_polys_.clear();ref_evt_polys_.push_back(evt_poly);} void set_proj_ref_evt_objects(std::vector<vsol_polygon_2d_sptr> const& evt_polys){ref_evt_polys_= evt_polys;} //: regions in the event image // reference region void set_proj_evt_ref_object(vsol_polygon_2d_sptr const& ref_poly){evt_ref_poly_ = ref_poly;} // event region void set_proj_evt_evt_object(vsol_polygon_2d_sptr const& evt_poly){evt_evt_poly_ = evt_poly;} //: accessors std::string name() const {return name_;} betr_params_sptr params(){return params_;} bool requires_multiple_ref_images() const { return multiple_ref_; } //: procedural methods virtual bool process(){return false;} //: only a probability if calibrated using sigmoid parameters or other means virtual double prob_change() const {return 0.0;} //: An image of pixel change values (0:255) - used for change display purposes // offset is with respect to the event image coordinate system virtual vil_image_resource_sptr change_image(unsigned& i_offset, unsigned& j_offset) const {return nullptr;} //: clear the algorithm state to process a new event region and/or new reference image(s) // subclasses may have additonal clear operations virtual void clear(){ ref_rescs_.clear(); evt_imgr_ = nullptr; ref_ref_polys_.clear(); ref_evt_polys_.clear(); evt_ref_poly_ = nullptr; evt_evt_poly_ = nullptr; } //: debug //====================== void set_verbose(bool verbose){verbose_ = verbose;} //: an identifier for a particular execution run void set_identifier(std::string identifier){identifier_ = identifier;} protected: //:algorithm name std::string name_; //: unique id for identifying individual algorithm executions // For example,an algorithm executes once per event region in the case of // multiple event regions std::string identifier_; //:reference image resources std::vector<vil_image_resource_sptr> ref_rescs_; //: the event image resource vil_image_resource_sptr evt_imgr_; //: one 3-d reference region projected into multiple reference images // same index order as ref_rescs std::vector< vsol_polygon_2d_sptr> ref_ref_polys_; //: projected event region in muliple reference images, one per reference image // same index order as ref_rescs std::vector< vsol_polygon_2d_sptr> ref_evt_polys_; //: the projected reference region in the event image vsol_polygon_2d_sptr evt_ref_poly_; //: the projected event region in the event image vsol_polygon_2d_sptr evt_evt_poly_; //:sigmoid parameters as in p_change = 1/(1+e^-alpha*(change-offset)) double offset_; double alpha_; bool verbose_; bool multiple_ref_;//does the algorithm require multiple reference images betr_params_sptr params_; }; #endif // DO NOT ADD CODE AFTER THIS LINE! END OF DEFINITION FOR CLASS betr_algorithm. #include "betr_algorithm_sptr.h"
{ "pile_set_name": "Github" }
--- title: 'チュートリアル: Azure Active Directory と Reviewsnap の統合 | Microsoft Docs' description: Azure Active Directory と Reviewsnap の間でシングル サインオンを構成する方法について説明します。 services: active-directory author: jeevansd manager: CelesteDG ms.reviewer: celested ms.service: active-directory ms.subservice: saas-app-tutorial ms.workload: identity ms.topic: tutorial ms.date: 03/26/2019 ms.author: jeedes ms.openlocfilehash: 354aeca01cb2d5244c68e1691642e4d2b41869dc ms.sourcegitcommit: 023d10b4127f50f301995d44f2b4499cbcffb8fc ms.translationtype: HT ms.contentlocale: ja-JP ms.lasthandoff: 08/18/2020 ms.locfileid: "88534508" --- # <a name="tutorial-azure-active-directory-integration-with-reviewsnap"></a>チュートリアル: Azure Active Directory と Reviewsnap の統合 このチュートリアルでは、Reviewsnap と Azure Active Directory (Azure AD) を統合する方法について説明します。 Reviewsnap と Azure AD の統合には、次の利点があります。 * Reviewsnap にアクセスできる Azure AD ユーザーを制御できます。 * ユーザーが自分の Azure AD アカウントを使用して Reviewsnap に自動的にサインイン (シングル サインオン) できるようにすることができます。 * 1 つの中央サイト (Azure Portal) でアカウントを管理できます。 SaaS アプリと Azure AD の統合の詳細については、「 [Azure Active Directory のアプリケーション アクセスとシングル サインオンとは](https://docs.microsoft.com/azure/active-directory/active-directory-appssoaccess-whatis)」を参照してください。 Azure サブスクリプションをお持ちでない場合は、開始する前に[無料アカウントを作成](https://azure.microsoft.com/free/)してください。 ## <a name="prerequisites"></a>前提条件 Reviewsnap と Azure AD の統合を構成するには、次のものが必要です。 * Azure AD サブスクリプション。 Azure AD の環境がない場合は、[無料アカウント](https://azure.microsoft.com/free/)を取得できます * Reviewsnap でのシングル サインオンが有効なサブスクリプション ## <a name="scenario-description"></a>シナリオの説明 このチュートリアルでは、テスト環境で Azure AD のシングル サインオンを構成してテストします。 * Reviewsnap では、**SP と IDP** によって開始される SSO がサポートされます ## <a name="adding-reviewsnap-from-the-gallery"></a>ギャラリーからの Reviewsnap の追加 Azure AD への Reviewsnap の統合を構成するには、ギャラリーから管理対象 SaaS アプリの一覧に Reviewsnap を追加する必要があります。 **ギャラリーから Reviewsnap を追加するには、次の手順に従います。** 1. **[Azure Portal](https://portal.azure.com)** の左側のナビゲーション ウィンドウで、 **[Azure Active Directory]** アイコンをクリックします。 ![Azure Active Directory のボタン](common/select-azuread.png) 2. **[エンタープライズ アプリケーション]** に移動し、 **[すべてのアプリケーション]** オプションを選択します。 ![[エンタープライズ アプリケーション] ブレード](common/enterprise-applications.png) 3. 新しいアプリケーションを追加するには、ダイアログの上部にある **[新しいアプリケーション]** をクリックします。 ![[新しいアプリケーション] ボタン](common/add-new-app.png) 4. 検索ボックスに「**Reviewsnap**」と入力し、結果パネルで **[Reviewsnap]** を選び、 **[追加]** をクリックしてアプリケーションを追加します。 ![結果リストの Reviewsnap](common/search-new-app.png) ## <a name="configure-and-test-azure-ad-single-sign-on"></a>Azure AD シングル サインオンの構成とテスト このセクションでは、**Britta Simon** というテスト ユーザーに基づいて、Reviewsnap で Azure AD のシングル サインオンを構成し、テストします。 シングル サインオンを機能させるには、Azure AD ユーザーと Reviewsnap 内の関連ユーザー間にリンク関係が確立されている必要があります。 Reviewsnap で Azure AD のシングル サインオンを構成してテストするには、次の構成要素を完了する必要があります。 1. **[Azure AD シングル サインオンの構成](#configure-azure-ad-single-sign-on)** - ユーザーがこの機能を使用できるようにします。 2. **[Reviewsnap シングル サインオンの構成](#configure-reviewsnap-single-sign-on)** - アプリケーション側でシングル サインオン設定を構成します。 3. **[Azure AD のテスト ユーザーの作成](#create-an-azure-ad-test-user)** - Britta Simon で Azure AD のシングル サインオンをテストします。 4. **[Azure AD テスト ユーザーの割り当て](#assign-the-azure-ad-test-user)** - Britta Simon が Azure AD シングル サインオンを使用できるようにします。 5. **[Reviewsnap テスト ユーザーの作成](#create-reviewsnap-test-user)** - Reviewsnap で Britta Simon に対応するユーザーを作成し、Azure AD の Britta Simon にリンクさせます。 6. **[シングル サインオンのテスト](#test-single-sign-on)** - 構成が機能するかどうかを確認します。 ### <a name="configure-azure-ad-single-sign-on"></a>Azure AD シングル サインオンの構成 このセクションでは、Azure portal 上で Azure AD のシングル サインオンを有効にします。 Reviewsnap で Azure AD シングル サインオンを構成するには、次の手順に従います。 1. [Azure portal](https://portal.azure.com/) の **Reviewsnap** アプリケーション統合ページで、 **[シングル サインオン]** を選択します。 ![シングル サインオン構成のリンク](common/select-sso.png) 2. **[シングル サインオン方式の選択]** ダイアログで、 **[SAML/WS-Fed]** モードを選択して、シングル サインオンを有効にします。 ![シングル サインオン選択モード](common/select-saml-option.png) 3. **[SAML でシングル サインオンをセットアップします]** ページで、 **[編集]** アイコンをクリックして **[基本的な SAML 構成]** ダイアログを開きます。 ![基本的な SAML 構成を編集する](common/edit-urls.png) 4. **[基本的な SAML 構成]** セクションで、アプリケーションを **IDP** 開始モードで構成する場合は、次の手順を実行します。 ![[Reviewsnap のドメインと URL] のシングル サインオン情報](common/idp-intiated.png) a. **[識別子]** テキスト ボックスに、`https://app.reviewsnap.com` という URL を入力します。 b. **[応答 URL]** ボックスに、`https://app.reviewsnap.com/auth/saml/callback?namespace=<CUSTOMER_NAMESPACE>` のパターンを使用して URL を入力します 5. アプリケーションを **SP** 開始モードで構成する場合は、 **[追加の URL を設定します]** をクリックして次の手順を実行します。 ![[Reviewsnap のドメインと URL] のシングル サインオン情報](common/metadata-upload-additional-signon.png) **[サインオン URL]** テキスト ボックスに URL として「`https://app.reviewsnap.com/login`」と入力します。 > [!NOTE] > 応答 URL 値は、実際の値ではありません。 実際の応答 URL でこの値を更新します。 この値を取得するには、[Reviewsnap クライアント サポート チーム](mailto:support@reviewsnap.com)に連絡してください。 Azure portal の **[基本的な SAML 構成]** セクションに示されているパターンを参照することもできます。 6. **[SAML でシングル サインオンをセットアップします]** ページの **[SAML 署名証明書]** セクションで、 **[ダウンロード]** をクリックして要件のとおりに指定したオプションからの**証明書 (Base64)** をダウンロードして、お使いのコンピューターに保存します。 ![証明書のダウンロードのリンク](common/certificatebase64.png) 7. **[Reviewsnap のセットアップ]** セクションで、要件西多賀って適切な URL をコピーします。 ![構成 URL のコピー](common/copy-configuration-urls.png) a. ログイン URL b. Azure AD 識別子 c. ログアウト URL ### <a name="configure-reviewsnap-single-sign-on"></a>Reviewsnap シングル サインオンの構成 **Reviewsnap** 側でシングル サインオンを構成するには、ダウンロードした**証明書 (Base64)** と Azure portal からコピーした適切な URL を [Reviewsnap サポート チーム](mailto:support@reviewsnap.com)に送信する必要があります。 サポート チームはこれを設定して、SAML SSO 接続が両方の側で正しく設定されるようにします。 ### <a name="create-an-azure-ad-test-user"></a>Azure AD のテスト ユーザーの作成 このセクションの目的は、Azure Portal で Britta Simon というテスト ユーザーを作成することです。 1. Azure portal の左側のウィンドウで、 **[Azure Active Directory]** 、 **[ユーザー]** 、 **[すべてのユーザー]** の順に選択します。 ![[ユーザーとグループ] と [すべてのユーザー] リンク](common/users.png) 2. 画面の上部にある **[新しいユーザー]** を選択します。 ![[新しいユーザー] ボタン](common/new-user.png) 3. [ユーザーのプロパティ] で、次の手順を実行します。 ![[ユーザー] ダイアログ ボックス](common/user-properties.png) a. **[名前]** フィールドに「**BrittaSimon**」と入力します。 b. **[ユーザー名]** フィールドに「`brittasimon@yourcompanydomain.extension`」と入力します。 たとえば、BrittaSimon@contoso.com のように指定します。 c. **[パスワードを表示]** チェック ボックスをオンにし、[パスワード] ボックスに表示された値を書き留めます。 d. **Create** をクリックしてください。 ### <a name="assign-the-azure-ad-test-user"></a>Azure AD テスト ユーザーの割り当て このセクションでは、Britta Simon に Reviewsnap へのアクセスを許可することで、このユーザーが Azure シングル サインオンを使用できるようにします。 1. Azure portal で **[エンタープライズ アプリケーション]** を選択し、 **[すべてのアプリケーション]** を選択してから、 **[Reviewsnap]** を選択します。 ![[エンタープライズ アプリケーション] ブレード](common/enterprise-applications.png) 2. アプリケーションの一覧で **[Reviewsnap]** を選択します。 ![アプリケーションの一覧の [Reviewsnap] リンク](common/all-applications.png) 3. 左側のメニューで **[ユーザーとグループ]** を選びます。 ![[ユーザーとグループ] リンク](common/users-groups-blade.png) 4. **[ユーザーの追加]** をクリックし、 **[割り当ての追加]** ダイアログで **[ユーザーとグループ]** を選択します。 ![[割り当ての追加] ウィンドウ](common/add-assign-user.png) 5. **[ユーザーとグループ]** ダイアログの [ユーザー] の一覧で **[Britta Simon]** を選択し、画面の下部にある **[選択]** ボタンをクリックします。 6. SAML アサーション内に任意のロール値が必要な場合、 **[ロールの選択]** ダイアログでユーザーに適したロールを一覧から選択し、画面の下部にある **[選択]** をクリッします。 7. **[割り当ての追加]** ダイアログで、 **[割り当て]** ボタンをクリックします。 ### <a name="create-reviewsnap-test-user"></a>Reviewsnap テスト ユーザーの作成 このセクションでは、Reviewsnap で Britta Simon というユーザーを作成します。  [Reviewsnap サポート チーム](mailto:support@reviewsnap.com)と連携して、Reviewsnap プラットフォームにユーザーを追加してください。 シングル サインオンを使用する前に、ユーザーを作成し、有効化する必要があります。 ### <a name="test-single-sign-on"></a>シングル サインオンのテスト このセクションでは、アクセス パネルを使用して Azure AD のシングル サインオン構成をテストします。 アクセス パネルで [Reviewsnap] タイルをクリックすると、SSO を設定した Reviewsnap に自動的にサインインします。 アクセス パネルの詳細については、[アクセス パネルの概要](https://docs.microsoft.com/azure/active-directory/active-directory-saas-access-panel-introduction)に関する記事を参照してください。 ## <a name="additional-resources"></a>その他のリソース - [SaaS アプリと Azure Active Directory を統合する方法に関するチュートリアルの一覧](https://docs.microsoft.com/azure/active-directory/active-directory-saas-tutorial-list) - [Azure Active Directory のアプリケーション アクセスとシングル サインオンとは](https://docs.microsoft.com/azure/active-directory/active-directory-appssoaccess-whatis) - [Azure Active Directory の条件付きアクセスとは](https://docs.microsoft.com/azure/active-directory/conditional-access/overview)
{ "pile_set_name": "Github" }
/* * Copyright (C) 2011 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ WebInspector.DOMBreakpointsSidebarPane = function() { WebInspector.NativeBreakpointsSidebarPane.call(this, WebInspector.UIString("DOM Breakpoints")); this._breakpointElements = {}; this._breakpointTypes = { SubtreeModified: 0, AttributeModified: 1, NodeRemoved: 2 }; this._breakpointTypeLabels = [ WebInspector.UIString("Subtree Modified"), WebInspector.UIString("Attribute Modified"), WebInspector.UIString("Node Removed") ]; this._contextMenuLabels = [ WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Break on subtree modifications" : "Break on Subtree Modifications"), WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Break on attributes modifications" : "Break on Attributes Modifications"), WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Break on node removal" : "Break on Node Removal") ]; WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged, this._inspectedURLChanged, this); } WebInspector.DOMBreakpointsSidebarPane.prototype = { _inspectedURLChanged: function(event) { this._reset(); var url = event.data; this._inspectedURL = url.removeURLFragment(); }, populateNodeContextMenu: function(node, contextMenu) { var nodeBreakpoints = {}; for (var id in this._breakpointElements) { var element = this._breakpointElements[id]; if (element._node === node) nodeBreakpoints[element._type] = true; } function toggleBreakpoint(type) { if (!nodeBreakpoints[type]) this._setBreakpoint(node, type, true); else this._removeBreakpoint(node, type); this._saveBreakpoints(); } for (var type = 0; type < 3; ++type) { var label = this._contextMenuLabels[type]; contextMenu.appendCheckboxItem(label, toggleBreakpoint.bind(this, type), nodeBreakpoints[type]); } }, createBreakpointHitStatusMessage: function(eventData, callback) { if (eventData.type === this._breakpointTypes.SubtreeModified) { var targetNodeObject = WebInspector.RemoteObject.fromPayload(eventData.targetNode); function didPushNodeToFrontend(targetNodeId) { if (targetNodeId) targetNodeObject.release(); this._doCreateBreakpointHitStatusMessage(eventData, targetNodeId, callback); } targetNodeObject.pushNodeToFrontend(didPushNodeToFrontend.bind(this)); } else this._doCreateBreakpointHitStatusMessage(eventData, null, callback); }, _doCreateBreakpointHitStatusMessage: function (eventData, targetNodeId, callback) { var message; var typeLabel = this._breakpointTypeLabels[eventData.type]; var linkifiedNode = WebInspector.panels.elements.linkifyNodeById(eventData.nodeId); var substitutions = [typeLabel, linkifiedNode]; var targetNode = ""; if (targetNodeId) targetNode = WebInspector.panels.elements.linkifyNodeById(targetNodeId); if (eventData.type === this._breakpointTypes.SubtreeModified) { if (eventData.insertion) { if (targetNodeId !== eventData.nodeId) { message = "Paused on a \"%s\" breakpoint set on %s, because a new child was added to its descendant %s."; substitutions.push(targetNode); } else message = "Paused on a \"%s\" breakpoint set on %s, because a new child was added to that node."; } else { message = "Paused on a \"%s\" breakpoint set on %s, because its descendant %s was removed."; substitutions.push(targetNode); } } else message = "Paused on a \"%s\" breakpoint set on %s."; var element = document.createElement("span"); var formatters = { s: function(substitution) { return substitution; } }; function append(a, b) { if (typeof b === "string") b = document.createTextNode(b); element.appendChild(b); } WebInspector.formatLocalized(message, substitutions, formatters, "", append); callback(element); }, nodeRemoved: function(node) { this._removeBreakpointsForNode(node); if (!node.children) return; for (var i = 0; i < node.children.length; ++i) this._removeBreakpointsForNode(node.children[i]); this._saveBreakpoints(); }, _removeBreakpointsForNode: function(node) { for (var id in this._breakpointElements) { var element = this._breakpointElements[id]; if (element._node === node) this._removeBreakpoint(element._node, element._type); } }, _setBreakpoint: function(node, type, enabled) { var breakpointId = this._createBreakpointId(node.id, type); if (breakpointId in this._breakpointElements) return; var element = document.createElement("li"); element._node = node; element._type = type; element.addEventListener("contextmenu", this._contextMenu.bind(this, node, type), true); var checkboxElement = document.createElement("input"); checkboxElement.className = "checkbox-elem"; checkboxElement.type = "checkbox"; checkboxElement.checked = enabled; checkboxElement.addEventListener("click", this._checkboxClicked.bind(this, node, type), false); element._checkboxElement = checkboxElement; element.appendChild(checkboxElement); var labelElement = document.createElement("span"); element.appendChild(labelElement); var linkifiedNode = WebInspector.panels.elements.linkifyNodeById(node.id); linkifiedNode.addStyleClass("monospace"); labelElement.appendChild(linkifiedNode); var description = document.createElement("div"); description.className = "source-text"; description.textContent = this._breakpointTypeLabels[type]; labelElement.appendChild(description); var currentElement = this.listElement.firstChild; while (currentElement) { if (currentElement._type && currentElement._type < element._type) break; currentElement = currentElement.nextSibling; } this._addListElement(element, currentElement); this._breakpointElements[breakpointId] = element; if (enabled) DOMDebuggerAgent.setDOMBreakpoint(node.id, type); }, _removeBreakpoint: function(node, type) { var breakpointId = this._createBreakpointId(node.id, type); var element = this._breakpointElements[breakpointId]; if (!element) return; this._removeListElement(element); delete this._breakpointElements[breakpointId]; if (element._checkboxElement.checked) DOMDebuggerAgent.removeDOMBreakpoint(node.id, type); }, _contextMenu: function(node, type, event) { var contextMenu = new WebInspector.ContextMenu(); function removeBreakpoint() { this._removeBreakpoint(node, type); this._saveBreakpoints(); } contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), removeBreakpoint.bind(this)); contextMenu.show(event); }, _checkboxClicked: function(node, type, event) { if (event.target.checked) DOMDebuggerAgent.setDOMBreakpoint(node.id, type); else DOMDebuggerAgent.removeDOMBreakpoint(node.id, type); this._saveBreakpoints(); }, highlightBreakpoint: function(eventData) { var breakpointId = this._createBreakpointId(eventData.nodeId, eventData.type); var element = this._breakpointElements[breakpointId]; if (!element) return; this.expanded = true; element.addStyleClass("breakpoint-hit"); this._highlightedElement = element; }, clearBreakpointHighlight: function() { if (this._highlightedElement) { this._highlightedElement.removeStyleClass("breakpoint-hit"); delete this._highlightedElement; } }, _createBreakpointId: function(nodeId, type) { return nodeId + ":" + type; }, _saveBreakpoints: function() { var breakpoints = []; var storedBreakpoints = WebInspector.settings.domBreakpoints; for (var i = 0; i < storedBreakpoints.length; ++i) { var breakpoint = storedBreakpoints[i]; if (breakpoint.url !== this._inspectedURL) breakpoints.push(breakpoint); } for (var id in this._breakpointElements) { var element = this._breakpointElements[id]; breakpoints.push({ url: this._inspectedURL, path: element._node.path(), type: element._type, enabled: element._checkboxElement.checked }); } WebInspector.settings.domBreakpoints = breakpoints; }, restoreBreakpoints: function() { var pathToBreakpoints = {}; function didPushNodeByPathToFrontend(path, nodeId) { var node = WebInspector.domAgent.nodeForId(nodeId); if (!node) return; var breakpoints = pathToBreakpoints[path]; for (var i = 0; i < breakpoints.length; ++i) this._setBreakpoint(node, breakpoints[i].type, breakpoints[i].enabled); } var breakpoints = WebInspector.settings.domBreakpoints; for (var i = 0; i < breakpoints.length; ++i) { var breakpoint = breakpoints[i]; if (breakpoint.url !== this._inspectedURL) continue; var path = breakpoint.path; if (!pathToBreakpoints[path]) { pathToBreakpoints[path] = []; WebInspector.domAgent.pushNodeByPathToFrontend(path, didPushNodeByPathToFrontend.bind(this, path)); } pathToBreakpoints[path].push(breakpoint); } } } WebInspector.DOMBreakpointsSidebarPane.prototype.__proto__ = WebInspector.NativeBreakpointsSidebarPane.prototype;
{ "pile_set_name": "Github" }
<app-nav> </app-nav> <div class="container overview"> <div class="col-md-12 pt-5"> <h3 class="mb-2">Account Balance</h3> <div class="row"> <div class="col-md-12"> <div class="row"> <div class="col-md-3"> <a [routerLink]="['/nft/list']"> <div class="card"> <div class="card-body"> <h3 *ngIf="count">{{ nftBalance }}</h3> <p class="card-text"> ERC-721: {{ nftName || 'Public Tokens' }} <span *ngIf="nftSymbol">({{ nftSymbol }})</span> </p> </div> </div> </a> </div> <div class="col-md-3"> <a [routerLink]="['/nft-commitment/list']"> <div class="card"> <div class="card-body"> <h3 *ngIf="count">{{ count.nftCommitmentCount ? count.nftCommitmentCount : '0' }}</h3> <p class="card-text">{{ nftName }} Commitments</p> </div> </div> </a> </div> <div class="col-md-3"> <div class="card"> <div class="card-body"> <h3>{{ ftBalance }}</h3> <p class="card-text"> ERC-20: {{ ftName || '' }} <span *ngIf="ftSymbol">({{ ftSymbol }})</span> </p> </div> </div> </div> <div class="col-md-3"> <a [routerLink]="['/ft-commitment/list']"> <div class="card"> <div class="card-body"> <h3 *ngIf="count">{{ count.ftCommitmentCount ? count.ftCommitmentCount : '0' }}</h3> <p class="card-text">{{ ftName }} Commitments</p> </div> </div> </a> </div> </div> </div> </div> <div class="row mt-4"> <div class="col-md-12"> <h3 class="mb-2">Actions</h3> <div class="row mb-3"> <div class="col-md-3"> <a class="btn btn-primary btn-list" [routerLink]="['/nft/mint']" >Mint {{ nftName || 'Public Token' }}</a > <a class="btn btn-primary btn-list" [routerLink]="['/nft/transfer']" >Transfer {{ nftName || 'Public Token' }}</a > <a class="btn btn-primary btn-list" [routerLink]="['/nft/burn']" >Burn {{ nftName || 'Public Token' }}</a > </div> <div class="col-md-3"> <a class="btn btn-primary btn-list" [routerLink]="['/nft-commitment/mint']" >Mint {{ nftName }} Commitment</a > <a class="btn btn-primary btn-list" [routerLink]="['/nft-commitment/transfer']" >Transfer {{ nftName }} Commitment</a > <a class="btn btn-primary btn-list" [routerLink]="['/nft-commitment/burn']" >Burn {{ nftName }} Commitment</a > </div> <div class="col-md-3"> <a class="btn btn-primary btn-list" [routerLink]="['/ft/mint']" >Mint {{ ftName || '' }}</a > <a class="btn btn-primary btn-list" [routerLink]="['/ft/transfer']" >Transfer {{ ftName || '' }}</a > <a class="btn btn-primary btn-list" [routerLink]="['/ft/burn']" >Burn {{ ftName || '' }}</a > </div> <div class="col-md-3"> <a class="btn btn-primary btn-list ft-commitment" [routerLink]="['/ft-commitment/mint']" >Mint {{ ftName }} Commitment</a > <a class="btn btn-primary btn-list ft-commitment" [routerLink]="['/ft-commitment/transfer']" >Transfer {{ ftName }} Commitment</a > <a class="btn btn-primary btn-list ft-commitment" [routerLink]="['/ft-commitment/batch-transfer']" >Batch Transfer {{ ftName }} Commitment</a > <a class="btn btn-primary btn-list ft-commitment" [routerLink]="['/ft-commitment/burn']" >Burn {{ ftName }} Commitment</a > </div> </div> </div> </div> <div class="row mb-3"> <div class="col-sm-12"> <h3 class="mb-2">Transactions History</h3> <ngb-tabset activeId="{{ selectedTab }}"> <ngb-tab id="nft"> <ng-template ngbTabTitle> <div (click)="getTransactions('nft')"> <strong>{{ nftName }}</strong> </div> </ng-template> <ng-template ngbTabContent> <table class="table table-hover"> <thead> <tr> <th>Type</th> <th>Token ID</th> <th>URI</th> <th>Date</th> <th>Send To</th> <th>Received from</th> </tr> </thead> <tbody> <tr *ngFor="let transaction of nftTransactions"> <td>{{ utilService.replaceUnderscores(transaction.transactionType) }}</td> <td [title]="transaction.tokenId"> {{ transaction.tokenId.slice(0, 20) }}.... </td> <td>{{ transaction.tokenUri }}</td> <td>{{ transaction.createdAt | date: 'dd/MM/yyyy hh:mm:ss a' }}</td> <td> {{ transaction.transactionType !== 'transfer_incoming' && transaction.receiver ? transaction.receiver.name : '' }} </td> <td> {{ transaction.transactionType === 'transfer_incoming' && transaction.sender ? transaction.sender.name : '' }} </td> </tr> </tbody> </table> <ngb-pagination *ngIf="isPagination" class="d-flex justify-content-end zkp-pagination" (pageChange)="pageChanged($event)" [collectionSize]="totalCollection | async" [pageSize]="pageSize" [(page)]="pageNo" aria-label="Default pagination" ></ngb-pagination> </ng-template> </ngb-tab> <ngb-tab id="nft-commitment"> <ng-template ngbTabTitle> <div (click)="getTransactions('nft-commitment')"> <strong>{{ nftName }} Commitment</strong> </div> </ng-template> <ng-template ngbTabContent> <table class="table table-hover"> <thead> <tr> <th>Type</th> <th>Token ID</th> <th>URI</th> <th>Date</th> <th>Send To</th> <th>Received From</th> </tr> </thead> <tbody> <ng-container *ngFor="let transaction of nftCommitmentTransactions"> <tr *ngIf="transaction.transactionType === 'mint'"> <td>{{ utilService.replaceUnderscores(transaction.transactionType) }}</td> <td *ngIf="!transaction.isFailed" [title]="transaction.outputCommitments[0].tokenId">{{ transaction.outputCommitments[0].tokenId.slice(0, 20) }}....</td> <td *ngIf="transaction.isFailed"> <i class="fa fa-ban" aria-hidden="true"></i> <span class="tx-failed">TRANSACTION FAILED</span> </td> <td>{{ transaction.outputCommitments[0].tokenUri }}</td> <td>{{ transaction.createdAt | date: 'dd/MM/yyyy hh:mm:ss a' }}</td> <td></td> <td></td> </tr> <tr *ngIf="transaction.transactionType === 'transfer_outgoing'"> <td>{{ utilService.replaceUnderscores(transaction.transactionType) }}</td> <td *ngIf="!transaction.isFailed" [title]="transaction.outputCommitments[0].tokenId">{{ transaction.outputCommitments[0].tokenId.slice(0, 20) }}....</td> <td *ngIf="transaction.isFailed"> <i class="fa fa-ban" aria-hidden="true"></i> <span class="tx-failed">TRANSACTION FAILED</span> </td> <td>{{ transaction.outputCommitments[0].tokenUri }}</td> <td>{{ transaction.createdAt | date: 'dd/MM/yyyy hh:mm:ss a' }}</td> <td>{{ transaction.receiver.name }}</td> <td></td> </tr> <tr *ngIf="transaction.transactionType === 'transfer_incoming'"> <td>{{ utilService.replaceUnderscores(transaction.transactionType) }}</td> <td [title]="transaction.outputCommitments[0].tokenId">{{ transaction.outputCommitments[0].tokenId.slice(0, 20) }}....</td> <td>{{ transaction.outputCommitments[0].tokenUri }}</td> <td>{{ transaction.createdAt | date: 'dd/MM/yyyy hh:mm:ss a' }}</td> <td></td> <td>{{ transaction.sender.name }}</td> </tr> <tr *ngIf="transaction.transactionType === 'burn'"> <td>{{ utilService.replaceUnderscores(transaction.transactionType) }}</td> <td *ngIf="!transaction.isFailed" [title]="transaction.inputCommitments[0].tokenId">{{ transaction.inputCommitments[0].tokenId.slice(0, 20) }}....</td> <td *ngIf="transaction.isFailed"> <i class="fa fa-ban" aria-hidden="true"></i> <span class="tx-failed">TRANSACTION FAILED</span> </td> <td>{{ transaction.inputCommitments[0].tokenUri }}</td> <td>{{ transaction.createdAt | date: 'dd/MM/yyyy hh:mm:ss a' }}</td> <td>{{ transaction.receiver.name }}</td> <td></td> </tr> </ng-container> </tbody> </table> <ngb-pagination *ngIf="isPagination" class="d-flex justify-content-end zkp-pagination" (pageChange)="pageChanged($event)" [collectionSize]="totalCollection | async" [pageSize]="pageSize" [(page)]="pageNo" aria-label="Default pagination" ></ngb-pagination> </ng-template> </ngb-tab> <ngb-tab id="ft"> <ng-template ngbTabTitle> <div (click)="getTransactions('ft')"> <strong>{{ ftName }}</strong> </div> </ng-template> <ng-template ngbTabContent> <table class="table table-hover"> <thead> <tr> <th>Type</th> <th>Amount</th> <th>Date</th> <th>Send To</th> <th>Received From</th> </tr> </thead> <tbody> <tr *ngFor="let transaction of ftTransactions"> <td>{{ utilService.replaceUnderscores(transaction.transactionType) }}</td> <td>{{ ftSymbol + ' ' + transaction.value }}</td> <td>{{ transaction.createdAt | date: 'dd/MM/yyyy hh:mm:ss a' }}</td> <td *ngIf="transaction.transactionType === 'transfer_outgoing'"> {{ transaction.receiver ? transaction.receiver.name : '' }} </td> <td *ngIf="transaction.transactionType !== 'transfer_outgoing'"></td> <td *ngIf="transaction.transactionType === 'transfer_incoming'"> {{ transaction.sender ? transaction.sender.name : '' }} </td> <td *ngIf="transaction.transactionType !== 'transfer_incoming'"></td> </tr> </tbody> </table> <ngb-pagination *ngIf="isPagination" class="d-flex justify-content-end zkp-pagination" (pageChange)="pageChanged($event)" [collectionSize]="totalCollection | async" [pageSize]="pageSize" [(page)]="pageNo" aria-label="Default pagination" ></ngb-pagination> </ng-template> </ngb-tab> <ngb-tab id="ft-commitment"> <ng-template ngbTabTitle> <div (click)="getTransactions('ft-commitment')"> <strong>{{ ftName }} Commitment</strong> </div> </ng-template> <ng-template ngbTabContent> <table class="table table-hover ft-commitment-table"> <thead> <tr> <th>Type</th> <th>Amount</th> <th>Commitment</th> <th>Date</th> <th>Send To</th> <th>Received From</th> </tr> </thead> <tbody> <ng-container *ngFor="let transaction of ftCommitmentTransactions; index as i"> <tr *ngIf="transaction.transactionType === 'mint'"> <td>{{ utilService.replaceUnderscores(transaction.transactionType) }}</td> <td >{{ ftSymbol + ' ' + utilService.convertToNumber(transaction.outputCommitments[0].value) }}</td> <td *ngIf="!transaction.isFailed" [title]="transaction.outputCommitments[0].commitment">{{ transaction.outputCommitments[0].commitment }}</td> <td *ngIf="transaction.isFailed"> <i class="fa fa-ban" aria-hidden="true"></i> <span class="tx-failed">TRANSACTION FAILED</span> </td> <td>{{ transaction.createdAt | date: 'dd/MM/yyyy hh:mm:ss a' }}</td> <td></td> <td></td> </tr> <tr *ngIf="transaction.transactionType === 'change'"> <td>{{ utilService.replaceUnderscores(transaction.transactionType) }}</td> <td>{{ ftSymbol + ' ' + utilService.convertToNumber(transaction.outputCommitments[0].value) }}</td> <td [title]="transaction.outputCommitments[0].commitment">{{ transaction.outputCommitments[0].commitment }}</td> <td>{{ transaction.createdAt | date: 'dd/MM/yyyy hh:mm:ss a' }}</td> <td></td> <td></td> </tr> <tr *ngIf="transaction.transactionType === 'burn'"> <td>{{ utilService.replaceUnderscores(transaction.transactionType) }}</td> <td>{{ ftSymbol + ' ' + utilService.convertToNumber(transaction.inputCommitments[0].value) }}</td> <td *ngIf="!transaction.isFailed" [title]="transaction.inputCommitments[0].commitment">{{ transaction.inputCommitments[0].commitment }}</td> <td *ngIf="transaction.isFailed"> <i class="fa fa-ban" aria-hidden="true"></i> <span class="tx-failed">TRANSACTION FAILED</span> </td> <td>{{ transaction.createdAt | date: 'dd/MM/yyyy hh:mm:ss a' }}</td> <td>{{transaction.receiver.name}}</td> <td></td> </tr> <tr *ngIf="transaction.transactionType === 'transfer_incoming'"> <td>{{ utilService.replaceUnderscores(transaction.transactionType) }}</td> <td>{{ ftSymbol + ' ' + utilService.convertToNumber(transaction.outputCommitments[0].value) }}</td> <td [title]="transaction.outputCommitments[0].commitment">{{ transaction.outputCommitments[0].commitment }}</td> <td>{{ transaction.createdAt | date: 'dd/MM/yyyy hh:mm:ss a' }}</td> <td></td> <td>{{transaction.sender.name}}</td> </tr> <tr data-toggle="collapse" [attr.data-target]="'#collapse-' + i" [attr.aria-controls] = "'collapse-' + i" *ngIf="transaction.transactionType === 'transfer_outgoing'"> <td> {{ utilService.replaceUnderscores(transaction.transactionType) }} </td> <td>{{ transaction.receiver ? (ftSymbol + ' ' + utilService.convertToNumber(transaction.outputCommitments[0].value)) : (ftSymbol + ' ' + utilService.sumCommitmentValues(transaction.outputCommitments).value) }}</td> <td title="Click to see list of commitments"> <span *ngIf="transaction.isFailed"> <i class="fa fa-ban" aria-hidden="true"></i> <span class="tx-failed">TRANSACTION FAILED</span> </span> <span class="active fas collapsed" >View commitments</span> </td> <td>{{ transaction.createdAt | date: 'dd/MM/yyyy hh:mm:ss a' }}</td> <td>{{transaction.receiver && transaction.receiver.name}}</td> <td></td> </tr> <tr *ngIf="transaction.transactionType === 'transfer_outgoing'"> <td class="collapse-row details-pane" colspan="6"> <div [attr.id]="'collapse-' + i" class="collapse out"> <table class="details-table table table-striped" *ngIf="transaction.inputCommitments.length > 1"> <tr> <th>Used Amount</th> <th>Used Commitment</th> </tr> <tr *ngFor="let used_commitments of transaction.inputCommitments; index as i"> <td>{{ ftSymbol +' ' +utilService.convertToNumber(used_commitments.value) }}</td> <td>{{used_commitments.commitment}}</td> </tr> </table> <table class="details-table table table-striped" *ngIf="transaction.outputCommitments.length > 1"> <tr> <th>Transferred Amounts</th> <th>Transferred Commitments</th> <th>Receiver Names</th> </tr> <tr *ngFor="let commitments of transaction.outputCommitments; index as i"> <td>{{ ftSymbol +' ' +utilService.convertToNumber(commitments.value) }}</td> <td *ngIf="!transaction.isFailed">{{ commitments.commitment }}</td> <td *ngIf="transaction.isFailed"> <i class="fa fa-ban" aria-hidden="true"></i> <span class="tx-failed">TRANSACTION FAILED</span> </td> <td *ngIf="!transaction.isFailed">{{ commitments.owner.name }}</td> <td *ngIf="transaction.isFailed"></td> </tr> </table> </div> </td> </tr> </ng-container> </tbody> </table> <ngb-pagination *ngIf="isPagination" class="d-flex justify-content-end zkp-pagination" (pageChange)="pageChanged($event)" [collectionSize]="totalCollection | async" [pageSize]="pageSize" [(page)]="pageNo" aria-label="Default pagination" ></ngb-pagination> </ng-template> </ngb-tab> </ngb-tabset> </div> </div> </div> </div>
{ "pile_set_name": "Github" }
<img src="https://avatars1.githubusercontent.com/u/3846050?v=4" width="127px" height="127px" align="left"/> # React Code Style Guide Our React projects' best practices <br> # Introduction This is meant to be a guide to help new developers understand the React code style and best practices we adopt here at Pagar.me. As this guide is an extension of our [JavaScript style guide][js-style-guide], we **highly recommend** reading it before you continue. # Installing The rules described in this repository are also available as a NPM package. To install the package and its dependencies: ```shell $ npm install --save-dev eslint@4.19.1 \ eslint-config-pagarme-react \ stylelint@8.0.0 \ stylelint-config-pagarme-react \ ``` > The peer dependencies specified above have hardcoded versions. > If you prefer, you can use the command > `npm info eslint-config-pagarme-react@latest peerDependencies` > to find the exact peer dependencies to install. To include these rules into your project, create the following config files in your root folder: > `.eslintrc` ```json { "extends": ["pagarme-react"], "env": { "browser": true } } ``` > `.stylelintrc` ``` { "extends": ["stylelint-config-pagarme-react"] } ``` # Table of contents - [Component definition](#component-definition) - [Project organization](#project-organization) - [Presentational Components](#components) - [Container Components](#containers) - [Page Containers](#pages) - [Formatting CSS](#formatting-css) - [80 columns, soft tabs of 2 spaces](#80-columns-soft-tabs-of-2-spaces) - [Camel case instead of dash-case for class names](#camel-case-instead-of-dash-case-for-class-names) - [Never use ID and tag name as root selectors!](#never-use-id-and-tag-name-as-root-selectors) - [When using multiple selectors, give each selector its own line](#when-using-multiple-selectors-give-each-selector-its-own-line) - [Break lines in CSS function arguments](#break-lines-in-css-function-arguments) - [When writing rules, be sure to](#when-writing-rules-be-sure-to) - [Design Patterns](#css-design-patterns) - [The parent constrains the child](#the-parent-constrains-the-child) - [The parent doesn't assume child structure](#the-parent-doesnt-assume-child-structure) - [Components never leak margin](#components-never-leak-margin) - [The parent spaces the children](#the-parent-spaces-the-children) - [Nested classes aren't for providing scope](#nested-classes-arent-for-providing-scope) - [Variables, lots of variables!](#variables-lots-of-variables) # Component definition All components (presentation, containers or pages) should **always** be defined as a directory, named with pascal casing. The main component file should be `index.js`, main stylesheet `style.css`. CSS custom properties can be kept in `properties.css`: ``` AwesomeCard/ ├── index.js ├── properties.css └── style.css ``` * Styles should always be defined in a separate CSS file * Avoid prefixing or suffixing component names - E.g.: `lib/pages/UserPage` or `lib/container/UserContainer` * On conflict rename on import time - `import UserContainer from '...'`  - `import { User as UserContainer } from '...'` [:arrow_up: Back to top][table-of-contents] # Project organization Your project components should be separated in at least three directories: ``` awesome-react-project/ └── src/ ├── components/ ├── containers/ └── pages/ ``` Each of these directories have special types of components: ### `components/` Stateless components. Shouldn't store state. Most components in this directory will be function-based components. Stuff like buttons, inputs, labels and all presentational components goes here. This components can also accept functions as props and dispatch events, but no state should be held inside. ### `containers/` Container components can store state. Containers are built mostly from the composition of presentational components with some styles to layout them together. Containers can also store internal state and access refs to provide additional logic, but all actions should be accepted as component callbacks. ### `pages/` Page components can store state, receive route parameters and dispatch Redux actions when applicable. Pages are the highest level of application's components. They represent the application routes and most times are displayed by a router. Pages are also responsible for handling container components callbacks and flowing data into children containers. [:arrow_up: Back to top][table-of-contents] # Code standards ## Destruct your `props` ### More than 2 props from an object been used in the same place should be destructed ## Code style ### Line length should not exceed 80 characters. ### Use explanatory variables Bad ```js const onlyNumbersRegex = /^\d+$/ const validateNumber = message => value => !onlyNumbersRegex.test(value) && message validateNumber('error message')(1) ``` Good ```js const onlyNumbersRegex = /^\d+$/ const getNumberValidation = message => value => !onlyNumbersRegex.test(value) && message const isNumber = getNumberValidation('error message') isNumber(1) ``` ### Use searchable names Bad ```js setTimeout(doSomething, 86400000) ``` Good ```js const DAY_IN_MILLISECONDS = 86400000 setTimeout(doSomething, DAY_IN_MILLISECONDS) ``` ## Naming ### Test files must start with the class which will be tested followed by `.test`. ### Class and components folders names must start with capital letter. ## React peculiarities ### Never "promisify" the `setState` It's a small anti-pattern which can cause some problems in the component lifecicle. You can found more arguments about this in [this issue](https://github.com/facebook/react/issues/2642#issuecomment-352135607) ## Mixins - [Do not use mixins](https://reactjs.org/blog/2016/07/13/mixins-considered-harmful.html) Why? Mixins introduce implicit dependencies, cause name clashes, and cause snowballing complexity. Most use cases for mixins can be accomplished in better ways via components, higher-order components, or utility modules. ## Components ### One line props when are more than 2 or big props Bad ```jsx <button type="submit" disabled onClick={() => null} className="aLongSpecificClassName"> Click here </button> <button type="submit" className="aLongSpecificClassName"> Click here </button> <button className="aLongSpecificClassName">Click here</button> ``` Good ```jsx <button className="aLongSpecificClassNameWithLasers" disabled={loading} onClick={() => null} type="submit" > Click here </button> ``` ### One line component Bad ``` js <div className="example"><span class="highlight">Bad</span> example</div> ``` Good ``` js <div className="example"> <span className="highlight">Bad</span> example </div> ``` # CSS are modules! We use CSS modules everywhere. CSS modules are great because they provide scope to CSS and allow us to create compartmentalized styles that don't leak to global scope. Here are our good practices of doing CSS modules: ## Formatting CSS ### 80 columns, soft tabs of 2 spaces Keep your code lines under 80 columns wide. This helps when opening multiple splits. Use soft tabs of 2 spaces to save some space! :stuck_out_tongue: ### Camel case instead of dash-case for class names With CSS modules, camel case makes much more sense: <table> <thead> <th colspan="2"><strong>GOOD</strong></th> </thead> <thead> <th><code>lib/components/Input/index.js</code></th> <th><code>lib/components/Input/style.css</code></th> </thead> <tbody> <tr> <td> ```js import style from './style.css' const Item = ({ children }) => <li className={style.circleBullet}> {children} </li> export default Item ``` </td> <td> ```css .circleBullet { list-style-type: disc; } ``` </td> </tr> </tbody> </table> [:arrow_up: Back to top][table-of-contents] ### Never use ID and tag name as root selectors! Using ID and tag name at the selector's root makes the rule to be applied globally. <table> <thead> <th colspan="2"><strong>GOOD</strong></th> </thead> <thead> <th><code>lib/components/Item/index.js</code></th> <th><code>lib/components/Item/style.css</code></th> </thead> <tbody> <tr> <td> ```js import style from './style.css' const Item = ({ title, thumbnail }) => <div className={style.container}> <img src={thumbnail} alt={title} /> </div> export default Item ``` </td> <td> ```css .container > img { background-color: #CCCCCC; } ``` </td> </tr> </tbody> <th colspan="2"><strong>BAD</strong></th> </thead> <thead> <th><code>lib/components/Item/index.js</code></th> <th><code>lib/components/Item/style.css</code></th> </thead> <tbody> <tr> <td> ```js import style from './style.css' const Item = ({ title, thumbnail }) => <div className={style.container}> <img src={thumbnail} alt={title} /> </div> export default Item ``` </td> <td> ```css img { background-color: #CCCCCC; } ``` </td> </tr> </tbody> </table> [:arrow_up: Back to top][table-of-contents] ### When using multiple selectors, give each selector its own line Organize one selector per line, even when placing all of them at the same line doesn't exceed 80 columns. <table> <thead> <th><strong>GOOD</strong></th> <th><strong>BAD</strong></th> </thead> <tbody> <tr> <td> ```css .container > img, .container > div, .container > section { background-color: #CCCCCC; } ``` </td> <td> ```css .container > img, .container > div, .container > section { background-color: #CCCCCC; } ``` </td> </tr> </tbody> </table> [:arrow_up: Back to top][table-of-contents] ### Break lines in CSS function arguments Sometimes, not to exceed the 80 columns limit, you need to break lines. While at it, be sure to do it right after the colon, and keep at one argument per line. <table> <thead> <th><strong>GOOD</strong></th> <th><strong>BAD</strong></th> </thead> <tbody> <tr> <td> ```css .container { background-color: linear-gradient( 0deg, var(--color-light-yellow-12), var(--color-light-yellow-10), ); } ``` </td> <td> ```css .container { background-color: linear-gradient(0deg, --color-light... } .container { background-color: linear-gradient( 0deg, var(--color-light-yellow-12), var(--color-lig... } ``` </td> </tr> </tbody> </table> [:arrow_up: Back to top][table-of-contents] ### When writing rules, be sure to * Put a space before the opening brace `{` * In properties put a space after (but not before) the `:` character * Put closing braces `}` of rule declarations on a new line * Leave **ONE** blank line in between rule declarations <table> <thead> <th><strong>GOOD</strong></th> <th><strong>BAD</strong></th> </thead> <tbody> <tr> <td> ```css .container { font-size: 12pt; } .thumbnail { width: 160px; height: 90px; } ``` </td> <td> ```css .container{ font-size:12pt;} .thumbnail{ width:160px; height:90px;} ``` </td> </tr> </thead> <tbody> </table> [:arrow_up: Back to top][table-of-contents] ## CSS Design Patterns ### The parent constrains the child Leaf components shouldn't constrain width or height (unless it makes sense). That said, most components should default to fill the parent: <table> <thead> <th colspan="2"><strong>GOOD</strong></th> </thead> <thead> <th><code>lib/components/Input/index.js</code></th> <th><code>lib/components/Input/style.css</code></th> </thead> <tbody> <tr> <td> ```js import style from './style.css' const Input = ({ children }) => <input className={style.input}> {children} </input> export default Input ``` </td> <td> ```css .input { box-sizing: border-box; padding: 10px; width: 100%; } ``` </td> </tr> </tbody> </table> [:arrow_up: Back to top][table-of-contents] ### The parent doesn't assume the child's structure Sometimes we don't want to fill the whole width by default. An example is the button component, which we want to resize itself based on title width. In this cases, we should allow the parent component to inject styles into the child component's container. The child is responsible for choosing where parent styles are injected. For merging styles, always use [`classnames`][classnames] package. The rightmost arguments overrides the leftmost ones. <table> <thead> <th colspan="2"><strong>GOOD</strong></th> </thead> <thead> <th><code>lib/components/Button/index.js</code></th> <th><code>lib/components/Button/style.css</code></th> </thead> <tbody> <tr> <td> ```js import classNames from 'classnames' import style from './style.css' const Button = ({ children, className }) => <button className={classNames(style.button, className)}> {children} </button> export default Button ``` </td> <td> ```css .button { box-sizing: border-box; padding: 10px; width: 100%; } ``` </td> </tr> </tbody> </table> [:arrow_up: Back to top][table-of-contents] ### Components never leak margin All components are self-contained and their final size should never suffer margin leakage! This allows the components to be much more reusable! <table> <thead> <th><strong>BAD</strong></th> <th><strong>GOOD</strong></th> </thead> <tbody> <tr> <td> ``` |--|-content size-|--| margin ____________________ | ______________ | | margin | | | | | | | | | | | | | |______________| | |____________________| | margin |---container size---| ``` </td> <td> ``` |-content size-| ______________ | | | | | | |______________| ``` </td> </tr> </tbody> </table> [:arrow_up: Back to top][table-of-contents] ### The parent spaces the children When building lists or grids: * Build list/grid items as separate components * Use the the list/grid container to space children * To space them horizontally, use `margin-left` * To space them vertically, use `margin-top` * Select the `first-child` to reset margins <table> <thead> <th colspan="2"><strong>GOOD</strong></th> </thead> <thead> <th><code>lib/containers/Reviews/index.js</code></th> <th><code>lib/containers/Reviews/style.css</code></th> </thead> <tbody> <tr> <td> ```js import style from './style.css' const Reviews = ({ items }) => <div className={style.container}> {items.map(item => <img src={item.image} alt={item.title} /> )} </div> export default Reviews ``` </td> <td> ```css .container > img { margin-left: 10px; } .container > img:first-child { margin-left: unset; } ``` </td> </tr> </tbody> </table> [:arrow_up: Back to top][table-of-contents] ### Nested classes aren't for providing scope CSS modules already provides us scope. We don't need to use nested classes for providing scope isolation. Use nested class selectors for modifying children based on parent class. A use case is when a component is in error or success state: <table> <thead> <th colspan="2"><strong>BAD</strong></th> </thead> <thead> <th><code>lib/components/Button/index.js</code></th> <th><code>lib/components/Button/style.css</code></th> </thead> <tbody> <tr> <td> ```js import style from './style.css' const Button = ({ children }) => <button className={style.button}> <img className={style.icon} /> {children} </button> export default Button ``` </td> <td> ```css .button { box-sizing: border-box; padding: 10px; width: 100%; } .button .icon { width: 22px; height: 22px; } ``` </td> </tr> </tbody> <thead> <th colspan="2"><strong>GOOD</strong></th> </thead> <tbody> <thead> <th><code>lib/components/Input/index.js</code></th> <th><code>lib/components/Input/style.css</code></th> </thead> <tbody> <tr> <td> ```js import style from './style.css' const Input = ({ value, onChange, error }) => <div className={classNames({ [style.error]: error })}> <input onChange={onChange} /> <p>{error}</p> </div> export default Input ``` </td> <td> ```css .error p { color: red; display: unset; } ``` </td> </tr> </tbody> </table> [:arrow_up: Back to top][table-of-contents] ### Variables, lots of variables! We encourage the "variabilification". Always define variables to increase reuse and make styles more consistent. The CSS4 specification defines a way to declare native variables. We adopted them as the standard. To define a variable accessible globally: <table> <thead> <th colspan="2"><strong>GOOD</strong></th> </thead> <thead> <th><code>app/App/variables.css</code></th> <th><code>app/components/Button/styles.css</code></th> </thead> <tbody> <tr> <td> ```css :root { --color-green-1: #6CCFAE; --color-green-2: #6B66B5; --color-green-3: #AAC257; --color-green-4: #68B5C1; } ``` </td> <td> ```css .container { background-color: linear-gradient( 0deg, var(--color-green-1), var(--color-green-2) ); } ``` </td> </tr> </tbody> </table> [:arrow_up: Back to top][table-of-contents] --- [table-of-contents]: #table-of-contents [classnames]: https://www.npmjs.com/package/classnames [js-style-guide]: https://github.com/pagarme/javascript-style-guide
{ "pile_set_name": "Github" }
/* *************************************************************************************** * Copyright (C) 2006 EsperTech, Inc. All rights reserved. * * http://www.espertech.com/esper * * http://www.espertech.com * * ---------------------------------------------------------------------------------- * * The software in this package is published under the terms of the GPL license * * a copy of which has been included with this distribution in the license.txt file. * *************************************************************************************** */ package com.espertech.esper.runtime.internal.dataflow.op.epstatementsource; public class PortAndMessagePair { private final int port; private final Object message; public PortAndMessagePair(int port, Object message) { this.port = port; this.message = message; } public int getPort() { return port; } public Object getMessage() { return message; } }
{ "pile_set_name": "Github" }
// // Microsoft Windows // Copyright (c) Microsoft Corporation. All rights reserved. // // File: RadioMgr.idl // //---------------------------------------------------------------------------- cpp_quote("//+-------------------------------------------------------------------------") cpp_quote("//") cpp_quote("// Microsoft Windows") cpp_quote("// Copyright (c) Microsoft Corporation. All rights reserved.") cpp_quote("//") cpp_quote("//--------------------------------------------------------------------------") cpp_quote("#if (NTDDI_VERSION >= NTDDI_WIN8)") import "oaidl.idl"; import "wtypes.idl"; interface IMediaRadioManager; interface IRadioInstanceCollection; interface IRadioInstance; interface IMediaRadioManagerNotifySink; typedef enum _DEVICE_RADIO_STATE { DRS_RADIO_ON = 0, DRS_SW_RADIO_OFF = 1, DRS_HW_RADIO_OFF = 2, DRS_SW_HW_RADIO_OFF = 3, DRS_HW_RADIO_ON_UNCONTROLLABLE = 4, DRS_RADIO_INVALID = 5, DRS_HW_RADIO_OFF_UNCONTROLLABLE = 6, DRS_RADIO_MAX = DRS_HW_RADIO_OFF_UNCONTROLLABLE } DEVICE_RADIO_STATE; typedef enum _SYSTEM_RADIO_STATE { SRS_RADIO_ENABLED = 0, SRS_RADIO_DISABLED = 1, } SYSTEM_RADIO_STATE; //+-------------------------------------------------------------------------------- // IMediaRadioManager -- Represents high level radio operations on each radio type. // The object implementing this interface will implement a Connection point (IConnectionPoint) // for IMediaRadioManagerNotifySink. // Each IMediaRadioManager object controls several or no IRadioInstance objects. [ local, object, uuid(6CFDCAB5-FC47-42A5-9241-074B58830E73), pointer_default(unique) ] interface IMediaRadioManager : IUnknown { HRESULT GetRadioInstances( [out] IRadioInstanceCollection **ppCollection ); HRESULT OnSystemRadioStateChange( [in] SYSTEM_RADIO_STATE sysRadioState, [in] UINT32 uTimeoutSec ); }; //+--------------------------------------------------------------------------- // IRadioInstanceCollection -- a flat list of radio instances // [ local, object, uuid(E5791FAE-5665-4E0C-95BE-5FDE31644185), pointer_default(unique) ] interface IRadioInstanceCollection : IUnknown { HRESULT GetCount( [out] UINT32 *pcInstance ); HRESULT GetAt( [in] UINT32 uIndex, [out] IRadioInstance **ppRadioInstance ); }; //+--------------------------------------------------------------------------- // IRadioInstance -- Interface to control specific radio instance // [ local, object, uuid(70AA1C9E-F2B4-4C61-86D3-6B9FB75FD1A2), pointer_default(unique) ] interface IRadioInstance : IUnknown { HRESULT GetRadioManagerSignature( [out] GUID *pguidSignature ); HRESULT GetInstanceSignature( [out, string] BSTR *pbstrId ); HRESULT GetFriendlyName( [in] LCID lcid, [out, string] BSTR *pbstrName ); HRESULT GetRadioState( [out] DEVICE_RADIO_STATE *pRadioState ); HRESULT SetRadioState( [in] DEVICE_RADIO_STATE radioState, [in] UINT32 uTimeoutSec ); BOOL IsMultiComm(); BOOL IsAssociatingDevice(); } //+--------------------------------------------------------------------------- // IMediaRadioManagerNotifySink -- notify instance add/remove and radio state change event // [ local, object, uuid(89D81F5F-C147-49ED-A11C-77B20C31E7C9), pointer_default(unique) ] interface IMediaRadioManagerNotifySink : IUnknown { HRESULT OnInstanceAdd( [in] IRadioInstance *pRadioInstance ); HRESULT OnInstanceRemove( [in, string] BSTR bstrRadioInstanceId ); HRESULT OnInstanceRadioChange( [in, string] BSTR bstrRadioInstanceId, [in] DEVICE_RADIO_STATE radioState ); }; cpp_quote("#endif // (NTDDI >= NTDDI_WIN8)")
{ "pile_set_name": "Github" }
namespace Comet.Layout { public class GridConstraints { public static readonly GridConstraints Default = new GridConstraints(); public GridConstraints( int row = 0, int column = 0, int rowSpan = 1, int colSpan = 1, float weightX = 1, float weightY = 1, float positionX = 0, float positionY = 0) { Row = row; Column = column; RowSpan = rowSpan; ColumnSpan = colSpan; WeightX = weightX; WeightY = weightY; PositionX = positionX; PositionY = positionY; } public int Row { get; } public int Column { get; } public int RowSpan { get; } public int ColumnSpan { get; } public float WeightX { get; } public float WeightY { get; } public float PositionX { get; } public float PositionY { get; } } }
{ "pile_set_name": "Github" }
# Copyright (C) 2014, 2016 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # this file is used to prepare the NDK to build with the mips64el llvm toolchain # any number of source files # # its purpose is to define (or re-define) templates used to build # various sources into target object files, libraries or executables. # # Note that this file may end up being parsed several times in future # revisions of the NDK. # # # Override the toolchain prefix # LLVM_VERSION := 3.8 LLVM_NAME := llvm-$(LLVM_VERSION) LLVM_TOOLCHAIN_PREBUILT_ROOT := $(call get-toolchain-root,$(LLVM_NAME)) LLVM_TOOLCHAIN_PREFIX := $(LLVM_TOOLCHAIN_PREBUILT_ROOT)/bin/ TOOLCHAIN_VERSION := $(DEFAULT_GCC_VERSION) TOOLCHAIN_NAME := mips64el-linux-android BINUTILS_ROOT := $(call get-binutils-root,$(NDK_ROOT),$(TOOLCHAIN_NAME)) TOOLCHAIN_ROOT := $(call get-toolchain-root,$(TOOLCHAIN_NAME)-$(TOOLCHAIN_VERSION)) TOOLCHAIN_PREFIX := $(TOOLCHAIN_ROOT)/bin/$(TOOLCHAIN_NAME)- TARGET_CC := $(LLVM_TOOLCHAIN_PREFIX)clang$(HOST_EXEEXT) TARGET_CXX := $(LLVM_TOOLCHAIN_PREFIX)clang++$(HOST_EXEEXT) # # CFLAGS, C_INCLUDES, and LDFLAGS # LLVM_TRIPLE := mips64el-none-linux-android TARGET_CFLAGS := \ -gcc-toolchain $(call host-path,$(TOOLCHAIN_ROOT)) \ -target $(LLVM_TRIPLE) \ -fpic \ -finline-functions \ -ffunction-sections \ -funwind-tables \ -fstack-protector-strong \ -fmessage-length=0 \ -Wno-invalid-command-line-argument \ -Wno-unused-command-line-argument \ -no-canonical-prefixes \ # Always enable debug info. We strip binaries when needed. TARGET_CFLAGS += -g TARGET_LDFLAGS += \ -gcc-toolchain $(call host-path,$(TOOLCHAIN_ROOT)) \ -target $(LLVM_TRIPLE) \ -no-canonical-prefixes \ TARGET_mips64_release_CFLAGS := \ -O2 \ -DNDEBUG \ TARGET_mips64_debug_CFLAGS := \ -O0 \ -UNDEBUG \ -fno-limit-debug-info \ # This function will be called to determine the target CFLAGS used to build # a C or Assembler source file, based on its tags. TARGET-process-src-files-tags = \ $(eval __debug_sources := $(call get-src-files-with-tag,debug)) \ $(eval __release_sources := $(call get-src-files-without-tag,debug)) \ $(call set-src-files-target-cflags, \ $(__debug_sources),\ $(TARGET_mips64_debug_CFLAGS)) \ $(call set-src-files-target-cflags,\ $(__release_sources),\ $(TARGET_mips64_release_CFLAGS)) \
{ "pile_set_name": "Github" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_10-ea) on Sun Jul 14 20:03:36 PDT 2013 --> <title>Uses of Class org.codehaus.jackson.map.util.ISO8601Utils (Jackson JSON Processor)</title> <meta name="date" content="2013-07-14"> <link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.codehaus.jackson.map.util.ISO8601Utils (Jackson JSON Processor)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../org/codehaus/jackson/map/util/ISO8601Utils.html" title="class in org.codehaus.jackson.map.util">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?org/codehaus/jackson/map/util/class-use/ISO8601Utils.html" target="_top">Frames</a></li> <li><a href="ISO8601Utils.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class org.codehaus.jackson.map.util.ISO8601Utils" class="title">Uses of Class<br>org.codehaus.jackson.map.util.ISO8601Utils</h2> </div> <div class="classUseContainer">No usage of org.codehaus.jackson.map.util.ISO8601Utils</div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../org/codehaus/jackson/map/util/ISO8601Utils.html" title="class in org.codehaus.jackson.map.util">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?org/codehaus/jackson/map/util/class-use/ISO8601Utils.html" target="_top">Frames</a></li> <li><a href="ISO8601Utils.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
{ "pile_set_name": "Github" }
/** * SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com> * SPDX-License-Identifier: LGPL-3.0-or-later */ import PropTypes from 'prop-types'; import React from 'react'; import EditorContext from '../../adapter/editor-context'; import ButtonIcon from './button-icon.jsx'; import ButtonStylesList from './button-styles-list.jsx'; /** * The ButtonSpacing class provides functionality for changing text spacing in a document. * * @class ButtonSpacing */ class ButtonSpacing extends React.Component { static contextType = EditorContext; static key = 'spacing'; static propTypes = { /** * Indicates whether the styles list is expanded or not. * * @instance * @memberof Spacing * @property {Boolean} expanded */ expanded: PropTypes.bool, /** * The label that should be used for accessibility purposes. * * @instance * @memberof Spacing * @property {String} label */ label: PropTypes.string, /** * Indicates whether the remove styles item should appear in the styles list. * * @instance * @memberof Spacing * @property {Boolean} showRemoveStylesItem */ showRemoveStylesItem: PropTypes.bool, /** * List of the styles the button is able to handle. * * @instance * @memberof Spacing * @property {Array} styles */ styles: PropTypes.arrayOf(PropTypes.object), /** * The tabIndex of the button in its toolbar current state. A value other than -1 * means that the button has focus and is the active element. * * @instance * @memberof Spacing * @property {Number} tabIndex */ tabIndex: PropTypes.number, /** * Callback provided by the button host to notify when the styles list has been expanded. * * @instance * @memberof Spacing * @property {Function} toggleDropdown */ toggleDropdown: PropTypes.func, }; /** * Lifecycle. Renders the UI of the button. * * @method render * @return {Object} The content which should be rendered. */ render() { let activeSpacing = '1.0x'; const spacings = this._getSpacings(); spacings.forEach(item => { if (this._checkActive(item.style)) { activeSpacing = item.name; } }); const {editor, expanded, tabIndex, toggleDropdown} = this.props; const buttonStylesProps = { activeStyle: activeSpacing, editor, onDismiss: toggleDropdown, showRemoveStylesItem: false, styles: spacings, }; return ( <div className="ae-container ae-container-dropdown-small ae-has-dropdown"> <button aria-expanded={expanded} className="ae-toolbar-element" onClick={toggleDropdown} role="combobox" tabIndex={tabIndex}> <span> <ButtonIcon symbol="separator" /> &nbsp; {activeSpacing} </span> </button> {expanded && <ButtonStylesList {...buttonStylesProps} />} </div> ); } _applyStyle(className) { const editor = this.context.editor.get('nativeEditor'); const styleConfig = { element: 'div', attributes: { class: className, }, }; const style = new CKEDITOR.style(styleConfig); editor.getSelection().lock(); this._getSpacings().forEach(item => { if (this._checkActive(item.style)) { editor.removeStyle(new CKEDITOR.style(item.style)); } }); editor.applyStyle(style); editor.getSelection().unlock(); editor.fire('actionPerformed', this); } /** * Checks if the given spacing definition is applied to the current selection in the editor. * * @instance * @memberof Spacing * @method _checkActive * @param {Object} styleConfig Spacing definition as per http://docs.ckeditor.com/#!/api/CKEDITOR.style. * @protected * @return {Boolean} Returns true if the spacing is applied to the selection, false otherwise. */ _checkActive(styleConfig) { const nativeEditor = this.context.editor.get('nativeEditor'); let active = true; const elementPath = nativeEditor.elementPath(); if (elementPath && elementPath.lastElement) { styleConfig.attributes.class.split(' ').forEach(className => { active = active && elementPath.lastElement.hasClass(className); }); } else { active = false; } return active; } /** * Returns an array of spacings. Each spacing consists from three properties: * - name - the style name, for example "default" * - style - an object with one property, called `element` which value * represents the style which have to be applied to the element. * - styleFn - a function which applies selected style to the editor selection * * @instance * @memberof Spacing * @method _getSpacings * @protected * @return {Array<object>} An array of objects containing the spacings. */ _getSpacings() { return ( this.props.styles || [ { name: '1.0x', style: { element: 'div', attributes: { class: '', }, type: 1, }, styleFn: this._applyStyle.bind(this, ''), }, { name: '1.5x', style: { element: 'div', attributes: { class: 'mt-1 mb-1', }, type: 1, }, styleFn: this._applyStyle.bind(this, 'mt-1 mb-1'), }, { name: '2.0x', style: { element: 'div', attributes: { class: 'mt-2 mb-2', }, type: 1, }, styleFn: this._applyStyle.bind(this, 'mt-2 mb-2'), }, { name: '3.0x', style: { element: 'div', attributes: { class: 'mt-3 mb-3', }, type: 1, }, styleFn: this._applyStyle.bind(this, 'mt-3 mb-3'), }, { name: '4.0x', style: { element: 'div', attributes: { class: 'mt-4 mb-4', }, type: 1, }, styleFn: this._applyStyle.bind(this, 'mt-4 mb-4'), }, { name: '5.0x', style: { element: 'div', attributes: { class: 'mt-5 mb-5', }, type: 1, }, styleFn: this._applyStyle.bind(this, 'mt-5 mb-5'), }, ] ); } } export default ButtonSpacing;
{ "pile_set_name": "Github" }
/* ssl/d1_enc.c */ /* * DTLS implementation written by Nagendra Modadugu * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. */ /* ==================================================================== * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #include <stdio.h> #include "ssl_locl.h" #ifndef OPENSSL_NO_COMP #include <openssl/comp.h> #endif #include <openssl/evp.h> #include <openssl/hmac.h> #include <openssl/md5.h> #include <openssl/rand.h> #ifdef KSSL_DEBUG #include <openssl/des.h> #endif /* dtls1_enc encrypts/decrypts the record in |s->wrec| / |s->rrec|, respectively. * * Returns: * 0: (in non-constant time) if the record is publically invalid (i.e. too * short etc). * 1: if the record's padding is valid / the encryption was successful. * -1: if the record's padding/AEAD-authenticator is invalid or, if sending, * an internal error occured. */ int dtls1_enc(SSL *s, int send) { SSL3_RECORD *rec; EVP_CIPHER_CTX *ds; unsigned long l; int bs,i,j,k,mac_size=0; const EVP_CIPHER *enc; if (send) { if (EVP_MD_CTX_md(s->write_hash)) { mac_size=EVP_MD_CTX_size(s->write_hash); if (mac_size < 0) return -1; } ds=s->enc_write_ctx; rec= &(s->s3->wrec); if (s->enc_write_ctx == NULL) enc=NULL; else { enc=EVP_CIPHER_CTX_cipher(s->enc_write_ctx); if ( rec->data != rec->input) /* we can't write into the input stream */ fprintf(stderr, "%s:%d: rec->data != rec->input\n", __FILE__, __LINE__); else if ( EVP_CIPHER_block_size(ds->cipher) > 1) { if (RAND_bytes(rec->input, EVP_CIPHER_block_size(ds->cipher)) <= 0) return -1; } } } else { if (EVP_MD_CTX_md(s->read_hash)) { mac_size=EVP_MD_CTX_size(s->read_hash); OPENSSL_assert(mac_size >= 0); } ds=s->enc_read_ctx; rec= &(s->s3->rrec); if (s->enc_read_ctx == NULL) enc=NULL; else enc=EVP_CIPHER_CTX_cipher(s->enc_read_ctx); } #ifdef KSSL_DEBUG printf("dtls1_enc(%d)\n", send); #endif /* KSSL_DEBUG */ if ((s->session == NULL) || (ds == NULL) || (enc == NULL)) { memmove(rec->data,rec->input,rec->length); rec->input=rec->data; } else { l=rec->length; bs=EVP_CIPHER_block_size(ds->cipher); if ((bs != 1) && send) { i=bs-((int)l%bs); /* Add weird padding of upto 256 bytes */ /* we need to add 'i' padding bytes of value j */ j=i-1; if (s->options & SSL_OP_TLS_BLOCK_PADDING_BUG) { if (s->s3->flags & TLS1_FLAGS_TLS_PADDING_BUG) j++; } for (k=(int)l; k<(int)(l+i); k++) rec->input[k]=j; l+=i; rec->length+=i; } #ifdef KSSL_DEBUG { unsigned long ui; printf("EVP_Cipher(ds=%p,rec->data=%p,rec->input=%p,l=%ld) ==>\n", ds,rec->data,rec->input,l); printf("\tEVP_CIPHER_CTX: %d buf_len, %d key_len [%d %d], %d iv_len\n", ds->buf_len, ds->cipher->key_len, DES_KEY_SZ, DES_SCHEDULE_SZ, ds->cipher->iv_len); printf("\t\tIV: "); for (i=0; i<ds->cipher->iv_len; i++) printf("%02X", ds->iv[i]); printf("\n"); printf("\trec->input="); for (ui=0; ui<l; ui++) printf(" %02x", rec->input[ui]); printf("\n"); } #endif /* KSSL_DEBUG */ if (!send) { if (l == 0 || l%bs != 0) return 0; } EVP_Cipher(ds,rec->data,rec->input,l); #ifdef KSSL_DEBUG { unsigned long i; printf("\trec->data="); for (i=0; i<l; i++) printf(" %02x", rec->data[i]); printf("\n"); } #endif /* KSSL_DEBUG */ if ((bs != 1) && !send) return tls1_cbc_remove_padding(s, rec, bs, mac_size); } return(1); }
{ "pile_set_name": "Github" }
{-# LANGUAGE StrictData, TemplateHaskell #-} module T10697_sourceUtil where import Language.Haskell.TH makeSimpleDatatype :: Name -> Name -> SourceUnpackednessQ -> SourceStrictnessQ -> Q Dec makeSimpleDatatype tyName conName srcUpk srcStr = dataD (cxt []) tyName [] Nothing [normalC conName [bangType (bang srcUpk srcStr) (conT ''Int)]] [] checkBang :: Name -> SourceUnpackednessQ -> SourceStrictnessQ -> ExpQ checkBang n srcUpk1 srcStr1 = do TyConI (DataD _ _ _ _ [NormalC _ [(Bang srcUpk2 srcStr2, _)]] _) <- reify n srcUpk1' <- srcUpk1 srcStr1' <- srcStr1 if srcUpk1' == srcUpk2 && srcStr1' == srcStr2 then [| True |] else [| False |] data E1 = E1 Int -- No unpackedness, no strictness data E2 = E2 !Int -- No unpackedness, strict data E3 = E3 ~Int -- No unpackedness, lazy data E4 = E4 {-# NOUNPACK #-} Int -- NOUNPACK, no strictness data E5 = E5 {-# NOUNPACK #-} !Int -- NOUNPACK, strict data E6 = E6 {-# NOUNPACK #-} ~Int -- NOUNPACK, lazy data E7 = E7 {-# UNPACK #-} Int -- UNPACK, no strictness data E8 = E8 {-# UNPACK #-} !Int -- UNPACK, strict data E9 = E9 {-# UNPACK #-} ~Int -- UNPACK, lazy
{ "pile_set_name": "Github" }
# created by tools/tclZIC.tcl - do not edit if {![info exists TZData(Asia/Hong_Kong)]} { LoadTimeZoneFile Asia/Hong_Kong } set TZData(:Hongkong) $TZData(:Asia/Hong_Kong)
{ "pile_set_name": "Github" }
package DDG::Spice::Lastfm::ArtistTracks; # ABSTRACT: Get the tracks of a musician. use strict; use DDG::Spice; spice to => 'http://ws.audioscrobbler.com/2.0/?limit=5&format=json&method=artist.gettoptracks&artist=$1&autocorrect=1&api_key={{ENV{DDG_SPICE_LASTFM_APIKEY}}}&callback={{callback}}'; #Queries like "songs by ben folds" and "ben folds songs" my $synonyms = "songs?|tracks?|music"; triggers query_lc => qr/^(?:(?:all|the)\s+)?(?:$synonyms)\s+(?:(?:by|from|of)\s+)?([^\s]+(?:\s+[^\s]+)*)$ | ^([^\s]+(?:\s+[^\s]+)*)\s+(?:$synonyms)$/x; handle query_lc => sub { return $1 if $1; return $2 if $2; return; }; 1;
{ "pile_set_name": "Github" }
using NHapi.Base.Parser; using NHapi.Base; using NHapi.Base.Log; using System; using System.Collections.Generic; using NHapi.Model.V27.Segment; using NHapi.Model.V27.Datatype; using NHapi.Base.Model; namespace NHapi.Model.V27.Group { ///<summary> ///Represents the PPR_PC1_PATIENT_VISIT Group. A Group is an ordered collection of message /// segments that can repeat together or be optionally in/excluded together. /// This Group contains the following elements: ///<ol> ///<li>0: PV1 (Patient Visit) </li> ///<li>1: PV2 (Patient Visit - Additional Information) optional </li> ///</ol> ///</summary> [Serializable] public class PPR_PC1_PATIENT_VISIT : AbstractGroup { ///<summary> /// Creates a new PPR_PC1_PATIENT_VISIT Group. ///</summary> public PPR_PC1_PATIENT_VISIT(IGroup parent, IModelClassFactory factory) : base(parent, factory){ try { this.add(typeof(PV1), true, false); this.add(typeof(PV2), false, false); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating PPR_PC1_PATIENT_VISIT - this is probably a bug in the source code generator.", e); } } ///<summary> /// Returns PV1 (Patient Visit) - creates it if necessary ///</summary> public PV1 PV1 { get{ PV1 ret = null; try { ret = (PV1)this.GetStructure("PV1"); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e); throw new System.Exception("An unexpected error ocurred",e); } return ret; } } ///<summary> /// Returns PV2 (Patient Visit - Additional Information) - creates it if necessary ///</summary> public PV2 PV2 { get{ PV2 ret = null; try { ret = (PV2)this.GetStructure("PV2"); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e); throw new System.Exception("An unexpected error ocurred",e); } return ret; } } } }
{ "pile_set_name": "Github" }
classes = 3 train = train_kitti_3cls_list.txt valid = valid_kitti_3cls_list.txt names = data/kitti_3cls.names backup = backup eval = kitti
{ "pile_set_name": "Github" }
<?php final class PhabricatorLegalpadSignaturePolicyRule extends PhabricatorPolicyRule { private $signatures = array(); public function getRuleDescription() { return pht('signers of legalpad documents'); } public function willApplyRules( PhabricatorUser $viewer, array $values, array $objects) { $values = array_unique(array_filter(array_mergev($values))); if (!$values) { return; } // TODO: This accepts signature of any version of the document, even an // older version. $documents = id(new LegalpadDocumentQuery()) ->setViewer(PhabricatorUser::getOmnipotentUser()) ->withPHIDs($values) ->withSignerPHIDs(array($viewer->getPHID())) ->execute(); $this->signatures = mpull($documents, 'getPHID', 'getPHID'); } public function applyRule( PhabricatorUser $viewer, $value, PhabricatorPolicyInterface $object) { foreach ($value as $document_phid) { if (!isset($this->signatures[$document_phid])) { return false; } } return true; } public function getValueControlType() { return self::CONTROL_TYPE_TOKENIZER; } public function getValueControlTemplate() { return $this->getDatasourceTemplate(new LegalpadDocumentDatasource()); } public function getRuleOrder() { return 900; } public function getValueForStorage($value) { PhutilTypeSpec::newFromString('list<string>')->check($value); return array_values($value); } public function getValueForDisplay(PhabricatorUser $viewer, $value) { $handles = id(new PhabricatorHandleQuery()) ->setViewer($viewer) ->withPHIDs($value) ->execute(); return mpull($handles, 'getFullName', 'getPHID'); } public function ruleHasEffect($value) { return (bool)$value; } }
{ "pile_set_name": "Github" }
<g:applyLayout name="pluginInfoLayout"> <head> <title><g:layoutTitle default="Plugin - ${plugin.title}" /></title> <g:layoutHead /> <g:render template="../content/wikiJavaScript"/> <style type="text/css" media="screen"> .yui-navset-bottom .yui-nav li a em { display:inline; } .yui-navset .yui-nav li a em, .yui-navset-top .yui-nav li a em, .yui-navset-bottom .yui-nav li a em { display:inline; } </style> </head> <body> <div id="contentPane"> <div id="pluginBigBox"> <g:render template="/user/profileBox" /> <div id="pluginBgTop"></div> <div id="pluginBox"> <div id="pluginDetailWrapper"> <g:layoutBody /> <div class="pluginBoxBottom"></div> <g:render template="../content/previewPane"/> </div> </div> </div> </div> </body> </g:applyLayout>
{ "pile_set_name": "Github" }
{ "images": { "icon-small": "https://minio.io/img/icons/minio/minio_dark_sm_ic.png", "icon-medium": "https://minio.io/img/icons/minio/minio_dark_md_ic.png", "icon-large": "https://minio.io/img/icons/minio/minio_dark_lg_ic.png" }, "assets": { "container": { "docker": { "minio-docker-RELEASE": "minio/minio:RELEASE.2018-08-25T01-56-38Z" } } } }
{ "pile_set_name": "Github" }
/********************************************************************* * Software License Agreement (BSD License) * * Copyright (c) 2017, Rice University * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * Neither the name of the Rice University nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. *********************************************************************/ /* Author: Mark Moll */ #include <chrono> #include <cstdlib> namespace cached_ik_kinematics_plugin { template <class KinematicsPlugin> CachedIKKinematicsPlugin<KinematicsPlugin>::CachedIKKinematicsPlugin() { } template <class KinematicsPlugin> CachedIKKinematicsPlugin<KinematicsPlugin>::~CachedIKKinematicsPlugin() { } template <class KinematicsPlugin> void CachedIKKinematicsPlugin<KinematicsPlugin>::initCache(const std::string& robot_id, const std::string& group_name, const std::string& cache_name) { IKCache::Options opts; int max_cache_size; // rosparam can't handle unsigned int kinematics::KinematicsBase::lookupParam("max_cache_size", max_cache_size, static_cast<int>(opts.max_cache_size)); opts.max_cache_size = max_cache_size; kinematics::KinematicsBase::lookupParam("min_pose_distance", opts.min_pose_distance, 1.0); kinematics::KinematicsBase::lookupParam("min_joint_config_distance", opts.min_joint_config_distance, 1.0); kinematics::KinematicsBase::lookupParam<std::string>("cached_ik_path", opts.cached_ik_path, ""); cache_.initializeCache(robot_id, group_name, cache_name, KinematicsPlugin::getJointNames().size(), opts); // for debugging purposes: // kdl_kinematics_plugin::KDLKinematicsPlugin fk; // fk.initialize(robot_description, group_name, base_frame, tip_frame, search_discretization); // cache_.verifyCache(fk); } template <class KinematicsPlugin> bool CachedMultiTipIKKinematicsPlugin<KinematicsPlugin>::initialize(const moveit::core::RobotModel& robot_model, const std::string& group_name, const std::string& base_frame, const std::vector<std::string>& tip_frames, double search_discretization) { // call initialize method of wrapped class if (!KinematicsPlugin::initialize(robot_model, group_name, base_frame, tip_frames, search_discretization)) return false; std::string cache_name = base_frame; std::accumulate(tip_frames.begin(), tip_frames.end(), cache_name); CachedIKKinematicsPlugin<KinematicsPlugin>::cache_.initializeCache(robot_model.getName(), group_name, cache_name, KinematicsPlugin::getJointNames().size()); return true; } template <class KinematicsPlugin> bool CachedMultiTipIKKinematicsPlugin<KinematicsPlugin>::initialize(const std::string& robot_description, const std::string& group_name, const std::string& base_frame, const std::vector<std::string>& tip_frames, double search_discretization) { // call initialize method of wrapped class if (!KinematicsPlugin::initialize(robot_description, group_name, base_frame, tip_frames, search_discretization)) return false; std::string cache_name = base_frame; std::accumulate(tip_frames.begin(), tip_frames.end(), cache_name); CachedIKKinematicsPlugin<KinematicsPlugin>::cache_.initializeCache(robot_description, group_name, cache_name, KinematicsPlugin::getJointNames().size()); return true; } template <class KinematicsPlugin> bool CachedIKKinematicsPlugin<KinematicsPlugin>::getPositionIK(const geometry_msgs::Pose& ik_pose, const std::vector<double>& ik_seed_state, std::vector<double>& solution, moveit_msgs::MoveItErrorCodes& error_code, const KinematicsQueryOptions& options) const { Pose pose(ik_pose); const IKEntry& nearest = cache_.getBestApproximateIKSolution(pose); bool solution_found = KinematicsPlugin::getPositionIK(ik_pose, nearest.second, solution, error_code, options) || KinematicsPlugin::getPositionIK(ik_pose, ik_seed_state, solution, error_code, options); if (solution_found) cache_.updateCache(nearest, pose, solution); return solution_found; } template <class KinematicsPlugin> bool CachedIKKinematicsPlugin<KinematicsPlugin>::searchPositionIK(const geometry_msgs::Pose& ik_pose, const std::vector<double>& ik_seed_state, double timeout, std::vector<double>& solution, moveit_msgs::MoveItErrorCodes& error_code, const KinematicsQueryOptions& options) const { std::chrono::time_point<std::chrono::system_clock> start(std::chrono::system_clock::now()); Pose pose(ik_pose); const IKEntry& nearest = cache_.getBestApproximateIKSolution(pose); bool solution_found = KinematicsPlugin::searchPositionIK(ik_pose, nearest.second, timeout, solution, error_code, options); if (!solution_found) { std::chrono::duration<double> diff = std::chrono::system_clock::now() - start; solution_found = KinematicsPlugin::searchPositionIK(ik_pose, ik_seed_state, diff.count(), solution, error_code, options); } if (solution_found) cache_.updateCache(nearest, pose, solution); return solution_found; } template <class KinematicsPlugin> bool CachedIKKinematicsPlugin<KinematicsPlugin>::searchPositionIK( const geometry_msgs::Pose& ik_pose, const std::vector<double>& ik_seed_state, double timeout, const std::vector<double>& consistency_limits, std::vector<double>& solution, moveit_msgs::MoveItErrorCodes& error_code, const KinematicsQueryOptions& options) const { std::chrono::time_point<std::chrono::system_clock> start(std::chrono::system_clock::now()); Pose pose(ik_pose); const IKEntry& nearest = cache_.getBestApproximateIKSolution(pose); bool solution_found = KinematicsPlugin::searchPositionIK(ik_pose, nearest.second, timeout, consistency_limits, solution, error_code, options); if (!solution_found) { std::chrono::duration<double> diff = std::chrono::system_clock::now() - start; solution_found = KinematicsPlugin::searchPositionIK(ik_pose, ik_seed_state, diff.count(), consistency_limits, solution, error_code, options); } if (solution_found) cache_.updateCache(nearest, pose, solution); return solution_found; } template <class KinematicsPlugin> bool CachedIKKinematicsPlugin<KinematicsPlugin>::searchPositionIK(const geometry_msgs::Pose& ik_pose, const std::vector<double>& ik_seed_state, double timeout, std::vector<double>& solution, const IKCallbackFn& solution_callback, moveit_msgs::MoveItErrorCodes& error_code, const KinematicsQueryOptions& options) const { std::chrono::time_point<std::chrono::system_clock> start(std::chrono::system_clock::now()); Pose pose(ik_pose); const IKEntry& nearest = cache_.getBestApproximateIKSolution(pose); bool solution_found = KinematicsPlugin::searchPositionIK(ik_pose, nearest.second, timeout, solution, solution_callback, error_code, options); if (!solution_found) { std::chrono::duration<double> diff = std::chrono::system_clock::now() - start; solution_found = KinematicsPlugin::searchPositionIK(ik_pose, ik_seed_state, diff.count(), solution, solution_callback, error_code, options); } if (solution_found) cache_.updateCache(nearest, pose, solution); return solution_found; } template <class KinematicsPlugin> bool CachedIKKinematicsPlugin<KinematicsPlugin>::searchPositionIK( const geometry_msgs::Pose& ik_pose, const std::vector<double>& ik_seed_state, double timeout, const std::vector<double>& consistency_limits, std::vector<double>& solution, const IKCallbackFn& solution_callback, moveit_msgs::MoveItErrorCodes& error_code, const KinematicsQueryOptions& options) const { std::chrono::time_point<std::chrono::system_clock> start(std::chrono::system_clock::now()); Pose pose(ik_pose); const IKEntry& nearest = cache_.getBestApproximateIKSolution(pose); bool solution_found = KinematicsPlugin::searchPositionIK(ik_pose, nearest.second, timeout, consistency_limits, solution, solution_callback, error_code, options); if (!solution_found) { std::chrono::duration<double> diff = std::chrono::system_clock::now() - start; solution_found = KinematicsPlugin::searchPositionIK(ik_pose, ik_seed_state, diff.count(), consistency_limits, solution, solution_callback, error_code, options); } if (solution_found) cache_.updateCache(nearest, pose, solution); return solution_found; } template <class KinematicsPlugin> bool CachedMultiTipIKKinematicsPlugin<KinematicsPlugin>::searchPositionIK( const std::vector<geometry_msgs::Pose>& ik_poses, const std::vector<double>& ik_seed_state, double timeout, const std::vector<double>& consistency_limits, std::vector<double>& solution, const IKCallbackFn& solution_callback, moveit_msgs::MoveItErrorCodes& error_code, const KinematicsQueryOptions& options, const moveit::core::RobotState* context_state) const { std::chrono::time_point<std::chrono::system_clock> start(std::chrono::system_clock::now()); std::vector<Pose> poses(ik_poses.size()); for (unsigned int i = 0; i < poses.size(); ++i) poses[i] = Pose(ik_poses[i]); const IKEntry& nearest = CachedIKKinematicsPlugin<KinematicsPlugin>::cache_.getBestApproximateIKSolution(poses); bool solution_found = KinematicsPlugin::searchPositionIK(ik_poses, nearest.second, timeout, consistency_limits, solution, solution_callback, error_code, options, context_state); if (!solution_found) { std::chrono::duration<double> diff = std::chrono::system_clock::now() - start; solution_found = KinematicsPlugin::searchPositionIK(ik_poses, ik_seed_state, diff.count(), consistency_limits, solution, solution_callback, error_code, options, context_state); } if (solution_found) CachedIKKinematicsPlugin<KinematicsPlugin>::cache_.updateCache(nearest, poses, solution); return solution_found; } } // namespace cached_ik_kinematics_plugin
{ "pile_set_name": "Github" }
TEST?=./... default: test fmt: generate go fmt ./... test: generate go get -t ./... go test $(TEST) $(TESTARGS) generate: go generate ./... updatedeps: go get -u golang.org/x/tools/cmd/stringer .PHONY: default generate test updatedeps
{ "pile_set_name": "Github" }
read_celllib osu018_stdcells.lib read_verilog unit.v read_sdc unit.sdc read_spef unit.spef # show the lineage dump_lineage # show the timer details dump_timer report_tns # change time and capacitance scales set_units -time 1ps -capacitance 1fF report_tns # restore time and capacitance scales set_units -time 1ns -capacitance 1pF report_tns # rescale time and capacitance scales set_units -time 2ns -capacitance 2pF report_tns
{ "pile_set_name": "Github" }
using Newtonsoft.Json; namespace Box.V2.Models { /// <summary> /// Box object to order results returned by a metadata query /// </summary> public class BoxMetadataQueryOrderBy { /// <summary> /// A string which specifies the key property for a field property to order results by /// </summary> [JsonProperty(PropertyName = "field_key")] public string FieldKey { get; set; } /// <summary> /// A string that specifies the direction to order the results by /// </summary> [JsonProperty(PropertyName = "direction")] public BoxSortDirection Direction { get; set; } } }
{ "pile_set_name": "Github" }
using System; namespace UnityEngine.PostProcessing { [Serializable] public abstract class PostProcessingModel { [SerializeField, GetSet("enabled")] bool m_Enabled; public bool enabled { get { return m_Enabled; } set { m_Enabled = value; if (value) OnValidate(); } } public abstract void Reset(); public virtual void OnValidate() {} } }
{ "pile_set_name": "Github" }
--- !ruby/object:RI::ClassDescription attributes: [] class_methods: - !ruby/object:RI::MethodSummary name: instance - !ruby/object:RI::MethodSummary name: new comment: - !ruby/struct:SM::Flow::P body: The command manager registers and installs all the individual sub-commands supported by the gem command. - !ruby/struct:SM::Flow::P body: "Extra commands can be provided by writing a rubygems_plugin.rb file in an installed gem. You should register your command against the Gem::CommandManager instance, like this:" - !ruby/struct:SM::Flow::VERB body: " # file rubygems_plugin.rb\n require 'rubygems/command_manager'\n\n class Gem::Commands::EditCommand &lt; Gem::Command\n # ...\n end\n\n Gem::CommandManager.instance.register_command :edit\n" - !ruby/struct:SM::Flow::P body: See Gem::Command for instructions on writing gem commands. constants: [] full_name: Gem::CommandManager includes: - !ruby/object:RI::IncludedModule name: Gem::UserInteraction instance_methods: - !ruby/object:RI::MethodSummary name: "[]" - !ruby/object:RI::MethodSummary name: command_names - !ruby/object:RI::MethodSummary name: find_command - !ruby/object:RI::MethodSummary name: find_command_possibilities - !ruby/object:RI::MethodSummary name: process_args - !ruby/object:RI::MethodSummary name: register_command - !ruby/object:RI::MethodSummary name: run name: CommandManager superclass: Object
{ "pile_set_name": "Github" }
foreach: expanded variable in constants range expression
{ "pile_set_name": "Github" }
Not using ``else`` where appropriate in a loop ============================================== The Python language provides a built-in ``else`` clause for ``for`` loops. If a ``for`` loop completes without being prematurely interrupted by a ``break`` or ``return`` statement, then the ``else`` clause of the loop is executed. Anti-pattern ------------ The code below searches a list for a magic number. If the magic number is found in the list, then the code prints ``Magic number found``. If the magic number is not found, then the code prints ``Magic number not found``. The code uses a flag variable called ``found`` to keep track of whether or not the magic number was found in the list. The logic in this code is valid; it will accomplish its task. But the Python language has built-in language constructs for handling this exact scenario and which can express the same idea much more concisely and without the need for flag variables that track the state of the code. .. code:: python l = [1, 2, 3] magic_number = 4 found = False for n in l: if n == magic_number: found = True print("Magic number found") break if not found: print("Magic number not found") Best practice ------------- Use ``else`` clause with ``for`` loop ..................................... In Python, you can declare an ``else`` loop in conjunction with a ``for`` loop. If the ``for`` loop iterates to completion without being prematurely interrupted by a ``break`` or ``return`` statement, then Python executes the ``else`` clause of the loop. In the modified code below, the ``for`` loop will iterate through all three items in the list. Because the magic number is not contained in the list, the ``if`` statement always evaluates to ``False``, and therefore the ``break`` statement is never encountered. Because Python never encounters a ``break`` statement while iterating over the loop, it executes the ``else`` clause. The modified code below is functionally equivalent to the original code above, but this modified code is more concise than the original code and does not require any flag variables for monitoring the state of the code. .. code:: python l = [1, 2, 3] magic_number = 4 for n in l: if n == magic_number: print("Magic number found") break else: print("Magic number not found") .. note:: Since ``else`` on a ``for`` loop is so unintuitive and error-prone, even some experienced Python developers suggest not using this feature at all. References ---------- - `Python Language Reference - else Clauses on Loops <https://docs.python.org/2/tutorial/controlflow.html#break-and-continue-statements-and-else-clauses-on-loops>`_
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <!-- Wire Copyright (C) 2018 Wire Swiss GmbH This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. --> <merge xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="horizontal" > <com.waz.zclient.ui.text.GlyphTextView android:id="@+id/gtv__checkbox_icon" android:layout_width="@dimen/framework__checkbox__dimension" android:layout_height="@dimen/framework__checkbox__dimension" android:textSize="@dimen/framework__checkbox__glyph_font_size" android:text="@string/glyph__check" android:gravity="center" /> <com.waz.zclient.ui.text.TypefaceTextView android:id="@+id/ttv__checkbox_label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginLeft="@dimen/wire__padding__regular" android:textSize="@dimen/wire__text_size__small" android:textAllCaps="true" app:w_font="@string/wire__typeface__light" /> </merge>
{ "pile_set_name": "Github" }
package main import "fmt" func main() { var languages [5]string languages[0] = "Go" languages[1] = "Ruby" languages[2] = "Pony" languages[3] = "Erlang" languages[4] = "Java" fmt.Println(languages[3]) }
{ "pile_set_name": "Github" }
"""Organizes and shares business logic, data and functions with different pages of the Streamlit App. - Database interactions: Select, Insert, Update, Delete - REST API interactions, get, post, put, delete - Pandas transformations """ import logging import pathlib import urllib.request from typing import Optional import streamlit as st from awesome_streamlit.database.settings import GITHUB_RAW_URL @st.cache def get_file_content_as_string(url: str) -> str: """The url content as a string Arguments: url {str} -- The url to request Returns: str -- The text of the url """ # Load local if possible if url.startswith(GITHUB_RAW_URL): path = pathlib.Path.cwd() / url.replace(GITHUB_RAW_URL, "") if path.exists(): with open(path, encoding="utf8") as file: content = file.read() return content # Load web else try: data = urllib.request.urlopen(url).read() except urllib.error.HTTPError as exception: # type: ignore msg = f"{exception.msg}: {url}" raise urllib.error.HTTPError( # type: ignore code=exception.code, msg=msg, hdrs=exception.hdrs, fp=exception.fp, url=url ).with_traceback(exception.__traceback__) # "HTTP Error 404: Not Found: " + url return data.decode("utf-8") @st.cache def set_logging_format( logging_formatter: Optional[str] = "%(asctime)s %(name)s: %(message)s" ) -> bool: """Sets the format of all 'streamlit' loggers Keyword Arguments: format {object} -- The formatter to apply (default: {"%(asctime)s %(name)s: %(message)s"}) Returns: bool -- True """ loggers = [ name for name in logging.root.manager.loggerDict # type: ignore if name.startswith("streamlit") ] formatter = logging.Formatter(logging_formatter) for name in loggers: logger = logging.getLogger(name) for handler in logger.handlers: handler.setFormatter(formatter) return True
{ "pile_set_name": "Github" }
19 comment:c C -0.2828350 0.9282100 -0.7668500 C -0.2826090 0.9278660 0.7672940 C 1.1249900 0.9819900 1.3938431 C 2.0409131 0.0301100 0.6663170 C 2.0407209 0.0302870 -0.6667120 C 1.1246270 0.9823930 -1.3937280 H 1.5057940 2.0093870 1.3147100 H 2.6745119 -0.6436120 1.2373160 H 2.6741650 -0.6432760 -1.2380700 H 1.5054960 2.0097499 -1.3143851 H 1.0472080 0.7455670 2.4584939 H 1.0465790 0.7463040 -2.4584351 C -0.9207180 -0.4014820 -1.1359750 O -1.1300660 -0.8372310 -2.2274230 C -0.9200820 -0.4021320 1.1360080 O -1.1286380 -0.8385660 2.2273350 O -1.2302060 -1.1161610 -0.0000970 H -0.9083840 1.7233740 -1.1849610 H -0.9082170 1.7227139 1.1859220
{ "pile_set_name": "Github" }
# [World Series Champs Trivia Game](http://alexa.amazon.com/#skills/amzn1.ask.skill.ca8dc8ad-be51-40ed-baba-1fd6fdf4fdd9) ![5 stars](../../images/ic_star_black_18dp_1x.png)![5 stars](../../images/ic_star_black_18dp_1x.png)![5 stars](../../images/ic_star_black_18dp_1x.png)![5 stars](../../images/ic_star_black_18dp_1x.png)![5 stars](../../images/ic_star_black_18dp_1x.png) 1 To use the World Series Champs Trivia Game skill, try saying... * *Alexa, open world series champs* * *Alexa, start world series champs* * *Alexa, begin world series champs* Ten possible questions. Alexa will ask who won in a particular year. You'll hear multiple choice answers and you respond with the number corresponding to the correct answer. Try to prove you know the World Series champs. *** ### Skill Details * **Invocation Name:** world series champs * **Category:** null * **ID:** amzn1.ask.skill.ca8dc8ad-be51-40ed-baba-1fd6fdf4fdd9 * **ASIN:** B01KLG2VDG * **Author:** JasonL * **Release Date:** August 18, 2016 @ 05:22:28 * **In-App Purchasing:** No
{ "pile_set_name": "Github" }
/* Bullet Continuous Collision Detection and Physics Library Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "btOptimizedBvh.h" #include "btStridingMeshInterface.h" #include "LinearMath/btAabbUtil2.h" #include "LinearMath/btIDebugDraw.h" btOptimizedBvh::btOptimizedBvh() { } btOptimizedBvh::~btOptimizedBvh() { } void btOptimizedBvh::build(btStridingMeshInterface* triangles, bool useQuantizedAabbCompression, const btVector3& bvhAabbMin, const btVector3& bvhAabbMax) { m_useQuantization = useQuantizedAabbCompression; // NodeArray triangleNodes; struct NodeTriangleCallback : public btInternalTriangleIndexCallback { NodeArray& m_triangleNodes; NodeTriangleCallback& operator=(NodeTriangleCallback& other) { m_triangleNodes.copyFromArray(other.m_triangleNodes); return *this; } NodeTriangleCallback(NodeArray& triangleNodes) :m_triangleNodes(triangleNodes) { } virtual void internalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex) { btOptimizedBvhNode node; btVector3 aabbMin,aabbMax; aabbMin.setValue(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT)); aabbMax.setValue(btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT)); aabbMin.setMin(triangle[0]); aabbMax.setMax(triangle[0]); aabbMin.setMin(triangle[1]); aabbMax.setMax(triangle[1]); aabbMin.setMin(triangle[2]); aabbMax.setMax(triangle[2]); //with quantization? node.m_aabbMinOrg = aabbMin; node.m_aabbMaxOrg = aabbMax; node.m_escapeIndex = -1; //for child nodes node.m_subPart = partId; node.m_triangleIndex = triangleIndex; m_triangleNodes.push_back(node); } }; struct QuantizedNodeTriangleCallback : public btInternalTriangleIndexCallback { QuantizedNodeArray& m_triangleNodes; const btQuantizedBvh* m_optimizedTree; // for quantization QuantizedNodeTriangleCallback& operator=(QuantizedNodeTriangleCallback& other) { m_triangleNodes.copyFromArray(other.m_triangleNodes); m_optimizedTree = other.m_optimizedTree; return *this; } QuantizedNodeTriangleCallback(QuantizedNodeArray& triangleNodes,const btQuantizedBvh* tree) :m_triangleNodes(triangleNodes),m_optimizedTree(tree) { } virtual void internalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex) { // The partId and triangle index must fit in the same (positive) integer btAssert(partId < (1<<MAX_NUM_PARTS_IN_BITS)); btAssert(triangleIndex < (1<<(31-MAX_NUM_PARTS_IN_BITS))); //negative indices are reserved for escapeIndex btAssert(triangleIndex>=0); btQuantizedBvhNode node; btVector3 aabbMin,aabbMax; aabbMin.setValue(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT)); aabbMax.setValue(btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT)); aabbMin.setMin(triangle[0]); aabbMax.setMax(triangle[0]); aabbMin.setMin(triangle[1]); aabbMax.setMax(triangle[1]); aabbMin.setMin(triangle[2]); aabbMax.setMax(triangle[2]); //PCK: add these checks for zero dimensions of aabb const btScalar MIN_AABB_DIMENSION = btScalar(0.002); const btScalar MIN_AABB_HALF_DIMENSION = btScalar(0.001); if (aabbMax.x() - aabbMin.x() < MIN_AABB_DIMENSION) { aabbMax.setX(aabbMax.x() + MIN_AABB_HALF_DIMENSION); aabbMin.setX(aabbMin.x() - MIN_AABB_HALF_DIMENSION); } if (aabbMax.y() - aabbMin.y() < MIN_AABB_DIMENSION) { aabbMax.setY(aabbMax.y() + MIN_AABB_HALF_DIMENSION); aabbMin.setY(aabbMin.y() - MIN_AABB_HALF_DIMENSION); } if (aabbMax.z() - aabbMin.z() < MIN_AABB_DIMENSION) { aabbMax.setZ(aabbMax.z() + MIN_AABB_HALF_DIMENSION); aabbMin.setZ(aabbMin.z() - MIN_AABB_HALF_DIMENSION); } m_optimizedTree->quantize(&node.m_quantizedAabbMin[0],aabbMin,0); m_optimizedTree->quantize(&node.m_quantizedAabbMax[0],aabbMax,1); node.m_escapeIndexOrTriangleIndex = (partId<<(31-MAX_NUM_PARTS_IN_BITS)) | triangleIndex; m_triangleNodes.push_back(node); } }; int numLeafNodes = 0; if (m_useQuantization) { //initialize quantization values setQuantizationValues(bvhAabbMin,bvhAabbMax); QuantizedNodeTriangleCallback callback(m_quantizedLeafNodes,this); triangles->InternalProcessAllTriangles(&callback,m_bvhAabbMin,m_bvhAabbMax); //now we have an array of leafnodes in m_leafNodes numLeafNodes = m_quantizedLeafNodes.size(); m_quantizedContiguousNodes.resize(2*numLeafNodes); } else { NodeTriangleCallback callback(m_leafNodes); btVector3 aabbMin(btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT)); btVector3 aabbMax(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT)); triangles->InternalProcessAllTriangles(&callback,aabbMin,aabbMax); //now we have an array of leafnodes in m_leafNodes numLeafNodes = m_leafNodes.size(); m_contiguousNodes.resize(2*numLeafNodes); } m_curNodeIndex = 0; buildTree(0,numLeafNodes); ///if the entire tree is small then subtree size, we need to create a header info for the tree if(m_useQuantization && !m_SubtreeHeaders.size()) { btBvhSubtreeInfo& subtree = m_SubtreeHeaders.expand(); subtree.setAabbFromQuantizeNode(m_quantizedContiguousNodes[0]); subtree.m_rootNodeIndex = 0; subtree.m_subtreeSize = m_quantizedContiguousNodes[0].isLeafNode() ? 1 : m_quantizedContiguousNodes[0].getEscapeIndex(); } //PCK: update the copy of the size m_subtreeHeaderCount = m_SubtreeHeaders.size(); //PCK: clear m_quantizedLeafNodes and m_leafNodes, they are temporary m_quantizedLeafNodes.clear(); m_leafNodes.clear(); } void btOptimizedBvh::refit(btStridingMeshInterface* meshInterface,const btVector3& aabbMin,const btVector3& aabbMax) { if (m_useQuantization) { setQuantizationValues(aabbMin,aabbMax); updateBvhNodes(meshInterface,0,m_curNodeIndex,0); ///now update all subtree headers int i; for (i=0;i<m_SubtreeHeaders.size();i++) { btBvhSubtreeInfo& subtree = m_SubtreeHeaders[i]; subtree.setAabbFromQuantizeNode(m_quantizedContiguousNodes[subtree.m_rootNodeIndex]); } } else { } } void btOptimizedBvh::refitPartial(btStridingMeshInterface* meshInterface,const btVector3& aabbMin,const btVector3& aabbMax) { //incrementally initialize quantization values btAssert(m_useQuantization); btAssert(aabbMin.getX() > m_bvhAabbMin.getX()); btAssert(aabbMin.getY() > m_bvhAabbMin.getY()); btAssert(aabbMin.getZ() > m_bvhAabbMin.getZ()); btAssert(aabbMax.getX() < m_bvhAabbMax.getX()); btAssert(aabbMax.getY() < m_bvhAabbMax.getY()); btAssert(aabbMax.getZ() < m_bvhAabbMax.getZ()); ///we should update all quantization values, using updateBvhNodes(meshInterface); ///but we only update chunks that overlap the given aabb unsigned short quantizedQueryAabbMin[3]; unsigned short quantizedQueryAabbMax[3]; quantize(&quantizedQueryAabbMin[0],aabbMin,0); quantize(&quantizedQueryAabbMax[0],aabbMax,1); int i; for (i=0;i<this->m_SubtreeHeaders.size();i++) { btBvhSubtreeInfo& subtree = m_SubtreeHeaders[i]; //PCK: unsigned instead of bool unsigned overlap = testQuantizedAabbAgainstQuantizedAabb(quantizedQueryAabbMin,quantizedQueryAabbMax,subtree.m_quantizedAabbMin,subtree.m_quantizedAabbMax); if (overlap != 0) { updateBvhNodes(meshInterface,subtree.m_rootNodeIndex,subtree.m_rootNodeIndex+subtree.m_subtreeSize,i); subtree.setAabbFromQuantizeNode(m_quantizedContiguousNodes[subtree.m_rootNodeIndex]); } } } void btOptimizedBvh::updateBvhNodes(btStridingMeshInterface* meshInterface,int firstNode,int endNode,int index) { (void)index; btAssert(m_useQuantization); int curNodeSubPart=-1; //get access info to trianglemesh data const unsigned char *vertexbase = 0; int numverts = 0; PHY_ScalarType type = PHY_INTEGER; int stride = 0; const unsigned char *indexbase = 0; int indexstride = 0; int numfaces = 0; PHY_ScalarType indicestype = PHY_INTEGER; btVector3 triangleVerts[3]; btVector3 aabbMin,aabbMax; const btVector3& meshScaling = meshInterface->getScaling(); int i; for (i=endNode-1;i>=firstNode;i--) { btQuantizedBvhNode& curNode = m_quantizedContiguousNodes[i]; if (curNode.isLeafNode()) { //recalc aabb from triangle data int nodeSubPart = curNode.getPartId(); int nodeTriangleIndex = curNode.getTriangleIndex(); if (nodeSubPart != curNodeSubPart) { if (curNodeSubPart >= 0) meshInterface->unLockReadOnlyVertexBase(curNodeSubPart); meshInterface->getLockedReadOnlyVertexIndexBase(&vertexbase,numverts, type,stride,&indexbase,indexstride,numfaces,indicestype,nodeSubPart); curNodeSubPart = nodeSubPart; btAssert(indicestype==PHY_INTEGER||indicestype==PHY_SHORT); } //triangles->getLockedReadOnlyVertexIndexBase(vertexBase,numVerts, unsigned int* gfxbase = (unsigned int*)(indexbase+nodeTriangleIndex*indexstride); for (int j=2;j>=0;j--) { int graphicsindex = indicestype==PHY_SHORT?((unsigned short*)gfxbase)[j]:gfxbase[j]; if (type == PHY_FLOAT) { float* graphicsbase = (float*)(vertexbase+graphicsindex*stride); triangleVerts[j] = btVector3( graphicsbase[0]*meshScaling.getX(), graphicsbase[1]*meshScaling.getY(), graphicsbase[2]*meshScaling.getZ()); } else { double* graphicsbase = (double*)(vertexbase+graphicsindex*stride); triangleVerts[j] = btVector3( btScalar(graphicsbase[0]*meshScaling.getX()), btScalar(graphicsbase[1]*meshScaling.getY()), btScalar(graphicsbase[2]*meshScaling.getZ())); } } aabbMin.setValue(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT)); aabbMax.setValue(btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT)); aabbMin.setMin(triangleVerts[0]); aabbMax.setMax(triangleVerts[0]); aabbMin.setMin(triangleVerts[1]); aabbMax.setMax(triangleVerts[1]); aabbMin.setMin(triangleVerts[2]); aabbMax.setMax(triangleVerts[2]); quantize(&curNode.m_quantizedAabbMin[0],aabbMin,0); quantize(&curNode.m_quantizedAabbMax[0],aabbMax,1); } else { //combine aabb from both children btQuantizedBvhNode* leftChildNode = &m_quantizedContiguousNodes[i+1]; btQuantizedBvhNode* rightChildNode = leftChildNode->isLeafNode() ? &m_quantizedContiguousNodes[i+2] : &m_quantizedContiguousNodes[i+1+leftChildNode->getEscapeIndex()]; { for (int i=0;i<3;i++) { curNode.m_quantizedAabbMin[i] = leftChildNode->m_quantizedAabbMin[i]; if (curNode.m_quantizedAabbMin[i]>rightChildNode->m_quantizedAabbMin[i]) curNode.m_quantizedAabbMin[i]=rightChildNode->m_quantizedAabbMin[i]; curNode.m_quantizedAabbMax[i] = leftChildNode->m_quantizedAabbMax[i]; if (curNode.m_quantizedAabbMax[i] < rightChildNode->m_quantizedAabbMax[i]) curNode.m_quantizedAabbMax[i] = rightChildNode->m_quantizedAabbMax[i]; } } } } if (curNodeSubPart >= 0) meshInterface->unLockReadOnlyVertexBase(curNodeSubPart); } ///deSerializeInPlace loads and initializes a BVH from a buffer in memory 'in place' btOptimizedBvh* btOptimizedBvh::deSerializeInPlace(void *i_alignedDataBuffer, unsigned int i_dataBufferSize, bool i_swapEndian) { btQuantizedBvh* bvh = btQuantizedBvh::deSerializeInPlace(i_alignedDataBuffer,i_dataBufferSize,i_swapEndian); //we don't add additional data so just do a static upcast return static_cast<btOptimizedBvh*>(bvh); }
{ "pile_set_name": "Github" }
<div id="bx-cnv-form-submit-text" class="bx-cnv-form-submit-text bx-def-margin-left bx-def-font-grayed"></div> <div class="clear_both"></div> <script> $(document).ready(function() { setInterval(function () { var $e = $('#bx-cnv-form-submit-text'); var $eForm = $e.parents('form'); var $eSubmit = $eForm.find('[type=submit]'); var aData = { draft_save: '1' } var fCallback = function (data) { var aData; if ('undefined' != typeof(data) && (aData = data.split(',')) && aData.length) { $('input[name=draft_id]').val(parseInt(aData[0])); if (aData.length > 1 && aData[1]) $('input[name=csrf_token]').val(aData[1]); $e.html('<span>' + _t('_bx_cnv_draft_saved_success') + '</span>'); setTimeout(function () { $e.find('span').fadeOut(); }, 3000); } else { $e.html(_t('_bx_cnv_draft_saving_error')); } }; aData[$eSubmit.attr('name')] = 1; $eForm.ajaxSubmit({ url: document.location.href, data: aData, beforeSubmit: function (formData, jqForm, options) { for (var i=0; i < formData.length; i++) { if ('text' == formData[i].name && !formData[i].value.length) // don't save empty drafts return false; } return true; }, error: fCallback, success: fCallback }); }, 10000); }); </script>
{ "pile_set_name": "Github" }
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from .sub_resource import SubResource class ApplicationGatewayUrlPathMap(SubResource): """UrlPathMaps give a url path to the backend mapping information for PathBasedRouting. :param id: Resource ID. :type id: str :param default_backend_address_pool: Default backend address pool resource of URL path map. :type default_backend_address_pool: ~azure.mgmt.network.v2018_08_01.models.SubResource :param default_backend_http_settings: Default backend http settings resource of URL path map. :type default_backend_http_settings: ~azure.mgmt.network.v2018_08_01.models.SubResource :param default_redirect_configuration: Default redirect configuration resource of URL path map. :type default_redirect_configuration: ~azure.mgmt.network.v2018_08_01.models.SubResource :param path_rules: Path rule of URL path map resource. :type path_rules: list[~azure.mgmt.network.v2018_08_01.models.ApplicationGatewayPathRule] :param provisioning_state: Provisioning state of the backend http settings resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. :type provisioning_state: str :param name: Name of the URL path map that is unique within an Application Gateway. :type name: str :param etag: A unique read-only string that changes whenever the resource is updated. :type etag: str :param type: Type of the resource. :type type: str """ _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'default_backend_address_pool': {'key': 'properties.defaultBackendAddressPool', 'type': 'SubResource'}, 'default_backend_http_settings': {'key': 'properties.defaultBackendHttpSettings', 'type': 'SubResource'}, 'default_redirect_configuration': {'key': 'properties.defaultRedirectConfiguration', 'type': 'SubResource'}, 'path_rules': {'key': 'properties.pathRules', 'type': '[ApplicationGatewayPathRule]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, } def __init__(self, **kwargs): super(ApplicationGatewayUrlPathMap, self).__init__(**kwargs) self.default_backend_address_pool = kwargs.get('default_backend_address_pool', None) self.default_backend_http_settings = kwargs.get('default_backend_http_settings', None) self.default_redirect_configuration = kwargs.get('default_redirect_configuration', None) self.path_rules = kwargs.get('path_rules', None) self.provisioning_state = kwargs.get('provisioning_state', None) self.name = kwargs.get('name', None) self.etag = kwargs.get('etag', None) self.type = kwargs.get('type', None)
{ "pile_set_name": "Github" }
{# Copyright (C) 2014-2018 Maciej Delmanowski <drybjed@gmail.com> # Copyright (C) 2014-2018 DebOps <https://debops.org/> # SPDX-License-Identifier: GPL-3.0-only #} # This file is managed by Ansible, all changes will be lost # Defaults for isc-dhcp-server initscript # sourced by /etc/init.d/isc-dhcp-server # installed at /etc/default/isc-dhcp-server by the maintainer scripts # # This is a POSIX shell fragment # # Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf). #DHCPD_CONF=/etc/dhcp/dhcpd.conf # Path to dhcpd's PID file (default: /var/run/dhcpd.pid). #DHCPD_PID=/var/run/dhcpd.pid # Additional options to start dhcpd with. # Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead OPTIONS="{{ dhcpd_server_options }}" # On what interfaces should the DHCP server (dhcpd) serve DHCP requests? # Separate multiple interfaces with spaces, e.g. "eth0 eth1". {% if dhcpd_interfaces is defined and dhcpd_interfaces %} INTERFACES="{{ dhcpd_interfaces | join(' ') }}" {% else %} {% set dhcpd_tpl_interfaces = [] %} {% for interface in ansible_interfaces %} {% if interface != 'lo' and ((hostvars[inventory_hostname]['ansible_'+interface].ipv4 is defined and hostvars[inventory_hostname]['ansible_'+interface].ipv4) or (hostvars[inventory_hostname]['ansible_'+interface].ipv6 is defined and hostvars[inventory_hostname]['ansible_'+interface].ipv6)) %} {% if dhcpd_tpl_interfaces.append(interface) %}{% endif %} {% endif %} {% endfor %} INTERFACES="{{ dhcpd_tpl_interfaces | join(' ') }}" {% endif %}
{ "pile_set_name": "Github" }
// // TIPImageRenderedCache.h // TwitterImagePipeline // // Created on 4/6/15. // Copyright (c) 2015 Twitter. All rights reserved. // #import <UIKit/UIImage.h> #import <UIKit/UIView.h> #import "TIPInspectableCache.h" @class TIPImageCacheEntry; NS_ASSUME_NONNULL_BEGIN @interface TIPImageRenderedCache : NSObject <TIPImageCache, TIPInspectableCache> - (nullable TIPImageCacheEntry *)imageEntryWithIdentifier:(NSString *)identifier transformerIdentifier:(nullable NSString *)transformerIdentifier targetDimensions:(CGSize)size targetContentMode:(UIViewContentMode)mode sourceImageDimensions:(out CGSize * __nullable)sourceDimsOut dirty:(out BOOL * __nullable)dirtyOut TIP_OBJC_DIRECT; // main thread only - (void)storeImageEntry:(TIPImageCacheEntry *)entry transformerIdentifier:(nullable NSString *)transformerIdentifier sourceImageDimensions:(CGSize)sourceDims TIP_OBJC_DIRECT; - (void)dirtyImageWithIdentifier:(NSString *)identifier TIP_OBJC_DIRECT; - (void)weakifyEntries TIP_OBJC_DIRECT; @end NS_ASSUME_NONNULL_END
{ "pile_set_name": "Github" }
Here is some explanatory text ```kotlin fun main() { println("Hello, world!") } ``` > You can get the full code [here](pattern-prop/pattern-001.kt).
{ "pile_set_name": "Github" }
package zemberek.core.collections; /** * A simple hashmap with integer keys and float values. Implements open address linear probing * algorithm. Constraints: <pre> * - Supports int key values in range (Integer.MIN_VALUE+1..Integer.MAX_VALUE]; * - Does not implement Map interface * - Capacity can be max 1 << 30 * - Load factor is 0.5. * - Max size is 2^29 (~537M elements) * - Does not implement Iterable. * - Class is not thread safe. * </pre> */ public final class IntFloatMap extends CompactIntMapBase { public IntFloatMap() { this(DEFAULT_INITIAL_CAPACITY); } /** * @param capacity initial internal array size for capacity amount of key - values. It must be a * positive number. If value is not a power of two, size will be the nearest larger power of two. */ public IntFloatMap(int capacity) { super(capacity); } private void setValue(int i, float value) { entries[i] = (entries[i] & 0x0000_0000_FFFF_FFFFL) | (((long) Float.floatToIntBits(value)) << 32); } private void setKeyValue(int i, int key, float value) { entries[i] = (key & 0xFFFF_FFFFL) | (((long) Float.floatToIntBits(value)) << 32); } private float getValue(int i) { return Float.intBitsToFloat((int) (entries[i] >>> 32)); } public void put(int key, float value) { checkKey(key); expandIfNecessary(); int loc = locate(key); if (loc >= 0) { setValue(loc, value); } else { setKeyValue(-loc - 1, key, value); keyCount++; } } /** * Used only when expanding. */ private void putSafe(int key, float value) { int loc = firstProbe(key); while (true) { if (getKey(loc) == EMPTY) { setKeyValue(loc, key, value); return; } loc = probe(loc); } } public void increment(int key, float value) { checkKey(key); expandIfNecessary(); int loc = locate(key); if (loc >= 0) { setValue(loc, value + getValue(loc)); } else { setKeyValue(-loc - 1, key, value); keyCount++; } } /** * @return The value {@code T} that is mapped to given {@code key}. or {@code NO_RESULT} If key * does not exist, * @throws IllegalArgumentException if key is {@code EMPTY} or {@code DELETED}. */ public float get(int key) { checkKey(key); int slot = firstProbe(key); while (true) { final long entry = entries[slot]; final int t = (int) (entry & 0xFFFF_FFFFL); if (t == key) { return Float.intBitsToFloat((int) (entry >>> 32)); } if (t == EMPTY) { return NO_RESULT; } slot = probe(slot); // DELETED slots are skipped. } } /** * @return The array of values in the map. Not ordered. */ public float[] getValues() { float[] valueArray = new float[keyCount]; for (int i = 0, j = 0; i < entries.length; i++) { if (hasKey(i)) { valueArray[j++] = getValue(i); } } return valueArray; } /** * Resize backing arrays. If there are no removed keys, doubles the capacity. */ void expand() { int capacity = newCapacity(); IntFloatMap h = new IntFloatMap(capacity); for (int i = 0; i < entries.length; i++) { if (hasKey(i)) { h.putSafe(getKey(i), getValue(i)); } } this.entries = h.entries; this.removedKeyCount = 0; this.threshold = h.threshold; } }
{ "pile_set_name": "Github" }
package com.hexagonkt.http.server import com.hexagonkt.helpers.CodedException import com.hexagonkt.injection.InjectionManager /** Alias for routes' and filters' callbacks. Functions executed when a route is matched. */ typealias RouteCallback = Call.() -> Unit /** Alias for exceptions' callbacks. Functions executed when an exception is thrown. */ typealias ExceptionCallback = Call.(Exception) -> Unit /** Alias for errors' callbacks. Functions executed to handle a HTTP error code. */ typealias ErrorCodeCallback = Call.(CodedException) -> Unit fun serve( settings: ServerSettings = ServerSettings(), router: Router, adapter: ServerPort = InjectionManager.inject()): Server = Server(adapter, router, settings).apply { start() } fun serve( settings: ServerSettings = ServerSettings(), adapter: ServerPort = InjectionManager.inject(), block: Router.() -> Unit): Server = Server(adapter, Router(block), settings).apply { start() }
{ "pile_set_name": "Github" }
// +build ignore /* * Minio Go Library for Amazon S3 Compatible Cloud Storage * Copyright 2015-2017 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package main import ( "log" "time" "github.com/minio/minio-go" ) func main() { // Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY, my-testfile, my-bucketname and // my-objectname are dummy values, please replace them with original values. // Requests are always secure (HTTPS) by default. Set secure=false to enable insecure (HTTP) access. // This boolean value is the last argument for New(). // New returns an Amazon S3 compatible client object. API compatibility (v2 or v4) is automatically // determined based on the Endpoint value. s3Client, err := minio.New("s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY", true) if err != nil { log.Fatalln(err) } // Enable trace. // s3Client.TraceOn(os.Stderr) // Source object src := minio.NewSourceInfo("my-sourcebucketname", "my-sourceobjectname", nil) // All following conditions are allowed and can be combined together. // Set modified condition, copy object modified since 2014 April. src.SetModifiedSinceCond(time.Date(2014, time.April, 0, 0, 0, 0, 0, time.UTC)) // Set unmodified condition, copy object unmodified since 2014 April. // src.SetUnmodifiedSinceCond(time.Date(2014, time.April, 0, 0, 0, 0, 0, time.UTC)) // Set matching ETag condition, copy object which matches the following ETag. // src.SetMatchETagCond("31624deb84149d2f8ef9c385918b653a") // Set matching ETag except condition, copy object which does not match the following ETag. // src.SetMatchETagExceptCond("31624deb84149d2f8ef9c385918b653a") // Destination object dst, err := minio.NewDestinationInfo("my-bucketname", "my-objectname", nil, nil) if err != nil { log.Fatalln(err) } // Initiate copy object. err = s3Client.CopyObject(dst, src) if err != nil { log.Fatalln(err) } log.Println("Copied source object /my-sourcebucketname/my-sourceobjectname to destination /my-bucketname/my-objectname Successfully.") }
{ "pile_set_name": "Github" }
/* * Copyright 2019 New Vector Ltd * Copyright 2020 The Matrix.org Foundation C.I.C. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.matrix.android.sdk.internal.database.model import io.realm.RealmObject import io.realm.annotations.PrimaryKey internal open class UserEntity(@PrimaryKey var userId: String = "", var displayName: String = "", var avatarUrl: String = "" ) : RealmObject() { companion object }
{ "pile_set_name": "Github" }
// // HAAppDelegate.m // NavigationMenu // // Created by Ivan Sapozhnik on 2/19/13. // Copyright (c) 2013 Ivan Sapozhnik. All rights reserved. // #import "HAAppDelegate.h" #import "HAViewController.h" @implementation HAAppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.viewController = [[HAViewController alloc] initWithNibName:@"HAViewController" bundle:nil]; self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:self.viewController]; [self.window makeKeyAndVisible]; return YES; } @end
{ "pile_set_name": "Github" }
// Copyright 2017 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build ignore // +godefs map struct_in_addr [4]byte /* in_addr */ // +godefs map struct_in6_addr [16]byte /* in6_addr */ package socket /* #include <sys/socket.h> #include <netinet/in.h> */ import "C" const ( sysAF_UNSPEC = C.AF_UNSPEC sysAF_INET = C.AF_INET sysAF_INET6 = C.AF_INET6 sysSOCK_RAW = C.SOCK_RAW ) type iovec C.struct_iovec type msghdr C.struct_msghdr type mmsghdr C.struct_mmsghdr type cmsghdr C.struct_cmsghdr type sockaddrInet C.struct_sockaddr_in type sockaddrInet6 C.struct_sockaddr_in6 const ( sizeofIovec = C.sizeof_struct_iovec sizeofMsghdr = C.sizeof_struct_msghdr sizeofMmsghdr = C.sizeof_struct_mmsghdr sizeofCmsghdr = C.sizeof_struct_cmsghdr sizeofSockaddrInet = C.sizeof_struct_sockaddr_in sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 )
{ "pile_set_name": "Github" }
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Simon Montagu # Portions created by the Initial Developer are Copyright (C) 2005 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # Shy Shalom - original C code # Shoshannah Forbes - original C code (?) # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # 255: Control characters that usually does not exist in any text # 254: Carriage/Return # 253: symbol (punctuation) that does not belong to word # 252: 0 - 9 # Windows-1255 language model # Character Mapping Table: WIN1255_CHAR_TO_ORDER_MAP = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253, 69, 91, 79, 80, 92, 89, 97, 90, 68,111,112, 82, 73, 95, 85, # 40 78,121, 86, 71, 67,102,107, 84,114,103,115,253,253,253,253,253, # 50 253, 50, 74, 60, 61, 42, 76, 70, 64, 53,105, 93, 56, 65, 54, 49, # 60 66,110, 51, 43, 44, 63, 81, 77, 98, 75,108,253,253,253,253,253, # 70 124,202,203,204,205, 40, 58,206,207,208,209,210,211,212,213,214, 215, 83, 52, 47, 46, 72, 32, 94,216,113,217,109,218,219,220,221, 34,116,222,118,100,223,224,117,119,104,125,225,226, 87, 99,227, 106,122,123,228, 55,229,230,101,231,232,120,233, 48, 39, 57,234, 30, 59, 41, 88, 33, 37, 36, 31, 29, 35,235, 62, 28,236,126,237, 238, 38, 45,239,240,241,242,243,127,244,245,246,247,248,249,250, 9, 8, 20, 16, 3, 2, 24, 14, 22, 1, 25, 15, 4, 11, 6, 23, 12, 19, 13, 26, 18, 27, 21, 17, 7, 10, 5,251,252,128, 96,253, ) # Model Table: # total sequences: 100% # first 512 sequences: 98.4004% # first 1024 sequences: 1.5981% # rest sequences: 0.087% # negative sequences: 0.0015% HEBREW_LANG_MODEL = ( 0,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,2,3,2,1,2,0,1,0,0, 3,0,3,1,0,0,1,3,2,0,1,1,2,0,2,2,2,1,1,1,1,2,1,1,1,2,0,0,2,2,0,1, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2, 1,2,1,2,1,2,0,0,2,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2, 1,2,1,3,1,1,0,0,2,0,0,0,1,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,0,1,2,2,1,3, 1,2,1,1,2,2,0,0,2,2,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,0,1,1,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,2,2,2,3,2, 1,2,1,2,2,2,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,3,2,2,3,2,2,2,1,2,2,2,2, 1,2,1,1,2,2,0,1,2,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,0,2,2,2,2,2, 0,2,0,2,2,2,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,0,2,2,2, 0,2,1,2,2,2,0,0,2,1,0,0,0,0,1,0,1,0,0,0,0,0,0,2,0,0,0,0,0,0,1,0, 3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,2,1,2,3,2,2,2, 1,2,1,2,2,2,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0, 3,3,3,3,3,3,3,3,3,2,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,1,0,2,0,2, 0,2,1,2,2,2,0,0,1,2,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,2,0,0,1,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,3,2,2,3,2,1,2,1,1,1, 0,1,1,1,1,1,3,0,1,0,0,0,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, 3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,1,1,0,0,1,0,0,1,0,0,0,0, 0,0,1,0,0,0,0,0,2,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2, 0,2,0,1,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, 3,3,3,3,3,3,3,3,3,2,3,3,3,2,1,2,3,3,2,3,3,3,3,2,3,2,1,2,0,2,1,2, 0,2,0,2,2,2,0,0,1,2,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0, 3,3,3,3,3,3,3,3,3,2,3,3,3,1,2,2,3,3,2,3,2,3,2,2,3,1,2,2,0,2,2,2, 0,2,1,2,2,2,0,0,1,2,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,2,3,3,2,2,2,3,3,3,3,1,3,2,2,2, 0,2,0,1,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,3,3,3,2,3,2,2,2,1,2,2,0,2,2,2,2, 0,2,0,2,2,2,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, 3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,1,3,2,3,3,2,3,3,2,2,1,2,2,2,2,2,2, 0,2,1,2,1,2,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0, 3,3,3,3,3,3,2,3,2,3,3,2,3,3,3,3,2,3,2,3,3,3,3,3,2,2,2,2,2,2,2,1, 0,2,0,1,2,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0, 3,3,3,3,3,3,3,3,3,2,1,2,3,3,3,3,3,3,3,2,3,2,3,2,1,2,3,0,2,1,2,2, 0,2,1,1,2,1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,2,0, 3,3,3,3,3,3,3,3,3,2,3,3,3,3,2,1,3,1,2,2,2,1,2,3,3,1,2,1,2,2,2,2, 0,1,1,1,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,0,2,3,3,3,1,3,3,3,1,2,2,2,2,1,1,2,2,2,2,2,2, 0,2,0,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0, 3,3,3,3,3,3,2,3,3,3,2,2,3,3,3,2,1,2,3,2,3,2,2,2,2,1,2,1,1,1,2,2, 0,2,1,1,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, 3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,0,0,1,0,0,0,0,0, 1,0,1,0,0,0,0,0,2,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,2,3,3,2,3,1,2,2,2,2,3,2,3,1,1,2,2,1,2,2,1,1,0,2,2,2,2, 0,1,0,1,2,2,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0, 3,0,0,1,1,0,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2,0, 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,1,0,1,0,1,1,0,1,1,0,0,0,1,1,0,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,0,0,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0, 3,2,2,1,2,2,2,2,2,2,2,1,2,2,1,2,2,1,1,1,1,1,1,1,1,2,1,1,0,3,3,3, 0,3,0,2,2,2,2,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, 2,2,2,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,1,2,2,2,1,1,1,2,0,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,2,2,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2,2,2,2,0,2,2,0,0,0,0,0,0, 0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,3,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,0,2,1,0, 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, 0,3,1,1,2,2,2,2,2,1,2,2,2,1,1,2,2,2,2,2,2,2,1,2,2,1,0,1,1,1,1,0, 0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,2,1,1,1,1,2,1,1,2,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,0,0,0,0,0,0,0, 0,0,2,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,1,0,0, 2,1,1,2,2,2,2,2,2,2,2,2,2,2,1,2,2,2,2,2,1,2,1,2,1,1,1,1,0,0,0,0, 0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,2,1,2,2,2,2,2,2,2,2,2,2,1,2,1,2,1,1,2,1,1,1,2,1,2,1,2,0,1,0,1, 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,3,1,2,2,2,1,2,2,2,2,2,2,2,2,1,2,1,1,1,1,1,1,2,1,2,1,1,0,1,0,1, 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,1,2,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2, 0,2,0,1,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, 3,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,1,1,1,1,1,1,1,0,1,1,0,1,0,0,1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,2,0,1,1,1,0,1,0,0,0,1,1,0,1,1,0,0,0,0,0,1,1,0,0, 0,1,1,1,2,1,2,2,2,0,2,0,2,0,1,1,2,1,1,1,1,2,1,0,1,1,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,1,0,0,0,0,0,1,0,1,2,2,0,1,0,0,1,1,2,2,1,2,0,2,0,0,0,1,2,0,1, 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,2,0,2,1,2,0,2,0,0,1,1,1,1,1,1,0,1,0,0,0,1,0,0,1, 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,1,0,2,1,1,0,1,0,0,1,1,1,2,2,0,0,1,0,0,0,1,0,0,1, 1,1,2,1,0,1,1,1,0,1,0,1,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,2,2,1, 0,2,0,1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,1,0,0,1,0,1,1,1,1,0,0,0,0,0,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,1,1,1,1,1,1,1,1,2,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,1,1,1,0,1,1,0,1,0,0,0,1,1,0,1, 2,0,1,0,1,0,1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,0,1,1,1,0,1,0,0,1,1,2,1,1,2,0,1,0,0,0,1,1,0,1, 1,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,0,1,1,2,0,1,0,0,0,0,2,1,1,2,0,2,0,0,0,1,1,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,0,2,1,1,0,1,0,0,2,2,1,2,1,1,0,1,0,0,0,1,1,0,1, 2,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,1,2,2,0,0,0,0,0,1,1,0,1,0,0,1,0,0,0,0,1,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,1,2,2,0,0,0,0,2,1,1,1,0,2,1,1,0,0,0,2,1,0,1, 1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,0,1,1,2,0,1,0,0,1,1,0,2,1,1,0,1,0,0,0,1,1,0,1, 2,2,1,1,1,0,1,1,0,1,1,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,0,2,1,1,0,1,0,0,1,1,0,1,2,1,0,2,0,0,0,1,1,0,1, 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0, 0,1,0,0,2,0,2,1,1,0,1,0,1,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,0,1,1,2,0,1,0,0,1,1,1,0,1,0,0,1,0,0,0,1,0,0,1, 1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,0,0,0,0,0,1,0,1,1,0,0,1,0,0,2,1,1,1,1,1,0,1,0,0,0,0,1,0,1, 0,1,1,1,2,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,1,2,1,0,0,0,0,0,1,1,1,1,1,0,1,0,0,0,1,1,0,0, ) Win1255HebrewModel = { 'char_to_order_map': WIN1255_CHAR_TO_ORDER_MAP, 'precedence_matrix': HEBREW_LANG_MODEL, 'typical_positive_ratio': 0.984004, 'keep_english_letter': False, 'charset_name': "windows-1255", 'language': 'Hebrew', }
{ "pile_set_name": "Github" }
var searchData= [ ['overview',['Overview',['../index.html',1,'']]] ];
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>disabled</key> <true/> </dict> </plist>
{ "pile_set_name": "Github" }
using CadEditor; using System; //css_include shared_settings/BlockUtils.cs; public class Data { public OffsetRec getScreensOffset() { return new OffsetRec(0xe4ee, 1 , 16*252, 16, 252); } public bool isBigBlockEditorEnabled() { return false; } public bool isBlockEditorEnabled() { return true; } public bool isEnemyEditorEnabled() { return false; } public GetVideoPageAddrFunc getVideoPageAddrFunc() { return getVideoAddress; } public GetVideoChunkFunc getVideoChunkFunc() { return getVideoChunk; } public SetVideoChunkFunc setVideoChunkFunc() { return null; } public bool isBuildScreenFromSmallBlocks() { return true; } public OffsetRec getBlocksOffset() { return new OffsetRec(0xe010, 1 , 0x1000); } public int getBlocksCount() { return 256; } public int getBigBlocksCount() { return 256; } public int getPalBytesAddr() { return 0xe274; } public GetBlocksFunc getBlocksFunc() { return BlockUtils.getBlocksLinear2x2Masked;} public SetBlocksFunc setBlocksFunc() { return BlockUtils.setBlocksLinear2x2Masked;} public GetPalFunc getPalFunc() { return getPallete;} public SetPalFunc setPalFunc() { return null;} //---------------------------------------------------------------------------- public byte[] getPallete(int palId) { return Utils.readBinFile("pal7(b).bin"); } public int getVideoAddress(int id) { return -1; } public byte[] getVideoChunk(int videoPageId) { return Utils.readVideoBankFromFile("chr7(b).bin", videoPageId); } }
{ "pile_set_name": "Github" }
prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: Protocol Buffers Description: Google's Data Interchange Format Version: @VERSION@ Libs: -L${libdir} -lprotobuf @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ Libs.private: @LIBS@ Cflags: -I${includedir} @PTHREAD_CFLAGS@ Conflicts: protobuf-lite
{ "pile_set_name": "Github" }
#!/usr/bin/env bash source /scripts/env-data.sh SETUP_LOCKFILE="${ROOT_CONF}/.ssl.conf.lock" if [ -f "${SETUP_LOCKFILE}" ]; then return 0 fi # This script will setup default SSL config # /etc/ssl/private can't be accessed from within container for some reason # (@andrewgodwin says it's something AUFS related) - taken from https://github.com/orchardup/docker-postgresql/blob/master/Dockerfile cp -r /etc/ssl /tmp/ssl-copy/ chmod -R 0700 /etc/ssl chown -R postgres /tmp/ssl-copy rm -r /etc/ssl mv /tmp/ssl-copy /etc/ssl # Needed under debian, wasnt needed under ubuntu mkdir -p ${PGSTAT_TMP} chmod 0777 ${PGSTAT_TMP} # moved from setup.sh echo "ssl = true" >> $CONF #echo "ssl_ciphers = 'DEFAULT:!LOW:!EXP:!MD5:@STRENGTH' " >> $CONF #echo "ssl_renegotiation_limit = 512MB " >> $CONF echo "ssl_cert_file = '${SSL_CERT_FILE}'" >> $CONF echo "ssl_key_file = '${SSL_KEY_FILE}'" >> $CONF if [ ! -z "${SSL_CA_FILE}" ]; then echo "ssl_ca_file = '${SSL_CA_FILE}' # (change requires restart)" >> $CONF fi #echo "ssl_crl_file = ''" >> $CONF # Put lock file to make sure conf was not reinitialized touch ${SETUP_LOCKFILE}
{ "pile_set_name": "Github" }
RGB 31, 31, 31 RGB 25, 26, 14 RGB 20, 17, 31 RGB 00, 00, 00 RGB 31, 31, 31 RGB 30, 10, 06 RGB 20, 17, 31 RGB 00, 00, 00 RGB 31, 31, 31 RGB 15, 31, 00 RGB 20, 17, 31 RGB 00, 00, 00 RGB 31, 31, 31 RGB 31, 15, 31 RGB 20, 17, 31 RGB 00, 00, 00 RGB 31, 31, 31 RGB 15, 21, 31 RGB 20, 17, 31 RGB 00, 00, 00 RGB 31, 31, 11 RGB 31, 31, 06 RGB 20, 17, 31 RGB 00, 00, 00 RGB 31, 31, 31 RGB 16, 19, 29 RGB 25, 22, 00 RGB 00, 00, 00 RGB 31, 31, 31 RGB 21, 21, 21 RGB 13, 13, 13 RGB 00, 00, 00 RGB 31, 31, 31 RGB 30, 10, 06 RGB 31, 00, 00 RGB 00, 00, 00 RGB 31, 31, 31 RGB 12, 25, 01 RGB 05, 14, 00 RGB 00, 00, 00 RGB 31, 31, 31 RGB 12, 25, 01 RGB 30, 10, 06 RGB 00, 00, 00 RGB 31, 31, 31 RGB 31, 31, 06 RGB 20, 15, 03 RGB 00, 00, 00 RGB 31, 31, 31 RGB 31, 31, 06 RGB 15, 21, 31 RGB 00, 00, 00 RGB 31, 31, 31 RGB 31, 31, 06 RGB 20, 15, 03 RGB 00, 00, 00 RGB 31, 31, 31 RGB 31, 24, 21 RGB 31, 13, 31 RGB 00, 00, 00 RGB 31, 31, 31 RGB 31, 31, 31 RGB 00, 00, 00 RGB 00, 00, 00
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: f6439b54b28f3884eb67579dec0b6f21 timeCreated: 1485107929 licenseType: Store TextureImporter: fileIDToRecycleName: {} serializedVersion: 4 mipmaps: mipMapMode: 0 enableMipMap: 0 sRGBTexture: 0 linearTexture: 0 fadeOut: 0 borderMipMap: 0 mipMapFadeDistanceStart: 1 mipMapFadeDistanceEnd: 3 bumpmap: convertToNormalMap: 0 externalNormalMap: 0 heightScale: 0.25 normalMapFilter: 0 isReadable: 0 grayScaleToAlpha: 0 generateCubemap: 6 cubemapConvolution: 0 seamlessCubemap: 0 textureFormat: 1 maxTextureSize: 2048 textureSettings: filterMode: 0 aniso: -1 mipBias: -1 wrapMode: 0 nPOTScale: 1 lightmap: 0 compressionQuality: 50 spriteMode: 0 spriteExtrude: 1 spriteMeshType: 1 alignment: 0 spritePivot: {x: 0.5, y: 0.5} spriteBorder: {x: 0, y: 0, z: 0, w: 0} spritePixelsToUnits: 100 alphaUsage: 2 alphaIsTransparency: 0 spriteTessellationDetail: -1 textureType: 10 textureShape: 1 maxTextureSizeSet: 0 compressionQualitySet: 0 textureFormatSet: 0 platformSettings: - buildTarget: DefaultTexturePlatform maxTextureSize: 64 textureFormat: -1 textureCompression: 0 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 - buildTarget: Standalone maxTextureSize: 64 textureFormat: -1 textureCompression: 0 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 spriteSheet: serializedVersion: 2 sprites: [] outline: [] spritePackingTag: userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
ref: refs/heads/master
{ "pile_set_name": "Github" }
/* * Copyright (c) 2018, Alliance for Open Media. All rights reserved * * This source code is subject to the terms of the BSD 2 Clause License and * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License * was not distributed with this source code in the LICENSE file, you can * obtain it at www.aomedia.org/license/software. If the Alliance for Open * Media Patent License 1.0 was not distributed with this source code in the * PATENTS file, you can obtain it at www.aomedia.org/license/patent. */ #include <smmintrin.h> #include "config/av1_rtcd.h" #include "aom_dsp/x86/synonyms.h" #include "av1/common/enums.h" #include "av1/common/reconintra.h" void av1_filter_intra_predictor_sse4_1(uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint8_t *above, const uint8_t *left, int mode) { int r, c; uint8_t buffer[33][33]; const int bw = tx_size_wide[tx_size]; const int bh = tx_size_high[tx_size]; assert(bw <= 32 && bh <= 32); // The initialization is just for silencing Jenkins static analysis warnings for (r = 0; r < bh + 1; ++r) memset(buffer[r], 0, (bw + 1) * sizeof(buffer[0][0])); for (r = 0; r < bh; ++r) buffer[r + 1][0] = left[r]; memcpy(buffer[0], &above[-1], (bw + 1) * sizeof(uint8_t)); const __m128i f1f0 = xx_load_128(av1_filter_intra_taps[mode][0]); const __m128i f3f2 = xx_load_128(av1_filter_intra_taps[mode][2]); const __m128i f5f4 = xx_load_128(av1_filter_intra_taps[mode][4]); const __m128i f7f6 = xx_load_128(av1_filter_intra_taps[mode][6]); const __m128i filter_intra_scale_bits = _mm_set1_epi16(1 << (15 - FILTER_INTRA_SCALE_BITS)); for (r = 1; r < bh + 1; r += 2) { for (c = 1; c < bw + 1; c += 4) { DECLARE_ALIGNED(16, uint8_t, p[8]); memcpy(p, &buffer[r - 1][c - 1], 5 * sizeof(uint8_t)); p[5] = buffer[r][c - 1]; p[6] = buffer[r + 1][c - 1]; p[7] = 0; const __m128i p_b = xx_loadl_64(p); const __m128i in = _mm_unpacklo_epi64(p_b, p_b); const __m128i out_01 = _mm_maddubs_epi16(in, f1f0); const __m128i out_23 = _mm_maddubs_epi16(in, f3f2); const __m128i out_45 = _mm_maddubs_epi16(in, f5f4); const __m128i out_67 = _mm_maddubs_epi16(in, f7f6); const __m128i out_0123 = _mm_hadd_epi16(out_01, out_23); const __m128i out_4567 = _mm_hadd_epi16(out_45, out_67); const __m128i out_01234567 = _mm_hadd_epi16(out_0123, out_4567); // Rounding const __m128i round_w = _mm_mulhrs_epi16(out_01234567, filter_intra_scale_bits); const __m128i out_r = _mm_packus_epi16(round_w, round_w); const __m128i out_r1 = _mm_srli_si128(out_r, 4); // Storing xx_storel_32(&buffer[r][c], out_r); xx_storel_32(&buffer[r + 1][c], out_r1); } } for (r = 0; r < bh; ++r) { memcpy(dst, &buffer[r + 1][1], bw * sizeof(uint8_t)); dst += stride; } }
{ "pile_set_name": "Github" }
/* * Copyright (C) 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef AtomicStringKeyedMRUCache_h #define AtomicStringKeyedMRUCache_h #include <wtf/text/AtomicString.h> namespace WebCore { template<typename T, size_t capacity = 4> class AtomicStringKeyedMRUCache { public: T get(const AtomicString& key) { if (key.isNull()) { DEFINE_STATIC_LOCAL(T, valueForNull, (createValueForNullKey())); return valueForNull; } for (size_t i = 0; i < m_cache.size(); ++i) { if (m_cache[i].first == key) { size_t foundIndex = i; if (foundIndex + 1 < m_cache.size()) { Entry entry = m_cache[foundIndex]; m_cache.remove(foundIndex); foundIndex = m_cache.size(); m_cache.append(entry); } return m_cache[foundIndex].second; } } if (m_cache.size() == capacity) m_cache.remove(0); m_cache.append(std::make_pair(key, createValueForKey(key))); return m_cache.last().second; } private: T createValueForNullKey(); T createValueForKey(const AtomicString&); typedef pair<AtomicString, T> Entry; typedef Vector<Entry, capacity> Cache; Cache m_cache; }; } #endif // AtomicStringKeyedMRUCache_h
{ "pile_set_name": "Github" }