text
stringlengths
2
100k
meta
dict
// mksyscall.pl -tags linux,s390x syscall_linux.go syscall_linux_s390x.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build linux,s390x package unix import ( "syscall" "unsafe" ) var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fchmodat(dirfd int, path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctl(fd int, req uint, arg uintptr) (err error) { _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(newpath) if err != nil { return } _, _, e1 := Syscall6(SYS_LINKAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mode), 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 ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 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 Readlinkat(dirfd int, 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 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 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 Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(newpath) if err != nil { return } _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlinkat(dirfd int, path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func utimes(path string, times *[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(times)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 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 futimesat(dirfd int, path *byte, times *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times))) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getcwd(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_GETCWD, uintptr(_p0), uintptr(len(buf)), 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 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 KeyctlInt(cmd int, arg2 int, arg3 int, arg4 int, arg5 int) (ret int, err error) { r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0) ret = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func KeyctlBuffer(cmd int, arg2 int, buf []byte, arg5 int) (ret int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(buf)), uintptr(arg5), 0) ret = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func keyctlJoin(cmd int, arg2 string) (ret int, err error) { var _p0 *byte _p0, err = BytePtrFromString(arg2) if err != nil { return } r0, _, e1 := Syscall(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0) ret = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func keyctlSearch(cmd int, arg2 int, arg3 string, arg4 string, arg5 int) (ret int, err error) { var _p0 *byte _p0, err = BytePtrFromString(arg3) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(arg4) if err != nil { return } r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(arg5), 0) ret = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func keyctlIOV(cmd int, arg2 int, payload []Iovec, arg5 int) (err error) { var _p0 unsafe.Pointer if len(payload) > 0 { _p0 = unsafe.Pointer(&payload[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(payload)), uintptr(arg5), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func keyctlDH(cmd int, arg2 *KeyctlDHParams, buf []byte) (ret int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(arg2)), uintptr(_p0), uintptr(len(buf)), 0, 0) ret = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(arg) if err != nil { return } _, _, e1 := Syscall6(SYS_REBOOT, uintptr(magic1), uintptr(magic2), uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mount(source string, target string, fstype string, flags uintptr, data *byte) (err error) { var _p0 *byte _p0, err = BytePtrFromString(source) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(target) if err != nil { return } var _p2 *byte _p2, err = BytePtrFromString(fstype) if err != nil { return } _, _, e1 := Syscall6(SYS_MOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(flags), uintptr(unsafe.Pointer(data)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Acct(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_ACCT, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func AddKey(keyType string, description string, payload []byte, ringid int) (id int, err error) { var _p0 *byte _p0, err = BytePtrFromString(keyType) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(description) if err != nil { return } var _p2 unsafe.Pointer if len(payload) > 0 { _p2 = unsafe.Pointer(&payload[0]) } else { _p2 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_ADD_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(payload)), uintptr(ringid), 0) id = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Adjtimex(buf *Timex) (state int, err error) { r0, _, e1 := Syscall(SYS_ADJTIMEX, uintptr(unsafe.Pointer(buf)), 0, 0) state = int(r0) 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) 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) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ClockGettime(clockid int32, time *Timespec) (err error) { _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) 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 CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) { r0, _, e1 := Syscall6(SYS_COPY_FILE_RANGE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), 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 Dup(oldfd int) (fd int, err error) { r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 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 Dup3(oldfd int, newfd int, flags int) (err error) { _, _, e1 := Syscall(SYS_DUP3, uintptr(oldfd), uintptr(newfd), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func EpollCreate(size int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 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 EpollCreate1(flag int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE1, uintptr(flag), 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 EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) { _, _, e1 := RawSyscall6(SYS_EPOLL_CTL, uintptr(epfd), uintptr(op), uintptr(fd), uintptr(unsafe.Pointer(event)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Eventfd(initval uint, flags int) (fd int, err error) { r0, _, e1 := Syscall(SYS_EVENTFD2, uintptr(initval), uintptr(flags), 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 Exit(code int) { Syscall(SYS_EXIT_GROUP, uintptr(code), 0, 0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 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 Fallocate(fd int, mode uint32, off int64, len int64) (err error) { _, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off), uintptr(len), 0, 0) if e1 != 0 { err = errnoErr(e1) } 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 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 Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 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 Fdatasync(fd int) (err error) { _, _, e1 := Syscall(SYS_FDATASYNC, 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 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 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 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_GETDENTS64, 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 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 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 Getrandom(buf []byte, flags int) (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_GETRANDOM, uintptr(_p0), uintptr(len(buf)), 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 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 Gettid() (tid int) { r0, _, _ := RawSyscall(SYS_GETTID, 0, 0, 0) tid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getxattr(path string, attr string, dest []byte) (sz int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(attr) if err != nil { return } var _p2 unsafe.Pointer if len(dest) > 0 { _p2 = unsafe.Pointer(&dest[0]) } else { _p2 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0) sz = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) { var _p0 *byte _p0, err = BytePtrFromString(pathname) if err != nil { return } r0, _, e1 := Syscall(SYS_INOTIFY_ADD_WATCH, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mask)) watchdesc = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func InotifyInit1(flags int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT1, uintptr(flags), 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 InotifyRmWatch(fd int, watchdesc uint32) (success int, err error) { r0, _, e1 := RawSyscall(SYS_INOTIFY_RM_WATCH, uintptr(fd), uintptr(watchdesc), 0) success = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kill(pid int, sig syscall.Signal) (err error) { _, _, e1 := RawSyscall(SYS_KILL, uintptr(pid), uintptr(sig), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Klogctl(typ 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_SYSLOG, uintptr(typ), 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 Lgetxattr(path string, attr string, dest []byte) (sz int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(attr) if err != nil { return } var _p2 unsafe.Pointer if len(dest) > 0 { _p2 = unsafe.Pointer(&dest[0]) } else { _p2 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0) sz = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listxattr(path string, dest []byte) (sz int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 unsafe.Pointer if len(dest) > 0 { _p1 = unsafe.Pointer(&dest[0]) } else { _p1 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) sz = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Llistxattr(path string, dest []byte) (sz int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 unsafe.Pointer if len(dest) > 0 { _p1 = unsafe.Pointer(&dest[0]) } else { _p1 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall(SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) sz = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lremovexattr(path string, attr string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(attr) if err != nil { return } _, _, e1 := Syscall(SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lsetxattr(path string, attr string, data []byte, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(attr) if err != nil { return } var _p2 unsafe.Pointer if len(data) > 0 { _p2 = unsafe.Pointer(&data[0]) } else { _p2 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall6(SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdirat(dirfd int, path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 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 PivotRoot(newroot string, putold string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(newroot) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(putold) if err != nil { return } _, _, e1 := Syscall(SYS_PIVOT_ROOT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) { _, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(newlimit)), uintptr(unsafe.Pointer(old)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) { _, _, e1 := Syscall6(SYS_PRCTL, uintptr(option), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0) 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 Removexattr(path string, attr string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(attr) if err != nil { return } _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(newpath) if err != nil { return } _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func RequestKey(keyType string, description string, callback string, destRingid int) (id int, err error) { var _p0 *byte _p0, err = BytePtrFromString(keyType) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(description) if err != nil { return } var _p2 *byte _p2, err = BytePtrFromString(callback) if err != nil { return } r0, _, e1 := Syscall6(SYS_REQUEST_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(destRingid), 0, 0) id = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setdomainname(p []byte) (err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_SETDOMAINNAME, uintptr(_p0), uintptr(len(p)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sethostname(p []byte) (err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_SETHOSTNAME, uintptr(_p0), uintptr(len(p)), 0) 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 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(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, 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 Setns(fd int, nstype int) (err error) { _, _, e1 := Syscall(SYS_SETNS, uintptr(fd), uintptr(nstype), 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 Setxattr(path string, attr string, data []byte, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(attr) if err != nil { return } var _p2 unsafe.Pointer if len(data) > 0 { _p2 = unsafe.Pointer(&data[0]) } else { _p2 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() { Syscall(SYS_SYNC, 0, 0, 0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Syncfs(fd int) (err error) { _, _, e1 := Syscall(SYS_SYNCFS, 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 Sysinfo(info *Sysinfo_t) (err error) { _, _, e1 := RawSyscall(SYS_SYSINFO, uintptr(unsafe.Pointer(info)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { r0, _, e1 := Syscall6(SYS_TEE, uintptr(rfd), uintptr(wfd), uintptr(len), uintptr(flags), 0, 0) n = int64(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Tgkill(tgid int, tid int, sig syscall.Signal) (err error) { _, _, e1 := RawSyscall(SYS_TGKILL, uintptr(tgid), uintptr(tid), uintptr(sig)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Times(tms *Tms) (ticks uintptr, err error) { r0, _, e1 := RawSyscall(SYS_TIMES, uintptr(unsafe.Pointer(tms)), 0, 0) ticks = uintptr(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(mask int) (oldmask int) { r0, _, _ := RawSyscall(SYS_UMASK, uintptr(mask), 0, 0) oldmask = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Uname(buf *Utsname) (err error) { _, _, e1 := RawSyscall(SYS_UNAME, uintptr(unsafe.Pointer(buf)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unmount(target string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(target) if err != nil { return } _, _, e1 := Syscall(SYS_UMOUNT2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unshare(flags int) (err error) { _, _, e1 := Syscall(SYS_UNSHARE, 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 Ustat(dev int, ubuf *Ustat_t) (err error) { _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) 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 exitThread(code int) (err error) { _, _, e1 := Syscall(SYS_EXIT, uintptr(code), 0, 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, p *byte, np int) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np)) 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, p *byte, np int) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np)) n = int(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 Madvise(b []byte, advice int) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { _p0 = unsafe.Pointer(&b[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(advice)) 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 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 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 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 Msync(b []byte, flags int) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { _p0 = unsafe.Pointer(&b[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) 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 Dup2(oldfd int, newfd int) (err error) { _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { _p0 = unsafe.Pointer(&events[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 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 Fadvise(fd int, offset int64, length int64, advice int) (err error) { _, _, e1 := Syscall6(SYS_FADVISE64, uintptr(fd), uintptr(offset), uintptr(length), uintptr(advice), 0, 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 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, buf *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(buf)), 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), uintptr(length), 0) 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() (euid int) { r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) euid = 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 Getrlimit(resource int, rlim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 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 InotifyInit() (fd int, err error) { r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 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)) 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) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pause() (err error) { _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) 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_PREAD64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 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_PWRITE64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 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 Seek(fd int, offset int64, whence int) (off int64, err error) { r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) off = int64(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { r0, _, e1 := Syscall6(SYS_SELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 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 sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { r0, _, e1 := Syscall6(SYS_SENDFILE, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0) written = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setfsgid(gid int) (err error) { _, _, e1 := Syscall(SYS_SETFSGID, 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 Setfsuid(uid int) (err error) { _, _, e1 := Syscall(SYS_SETFSUID, 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 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 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(resource int, rlim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 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 Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) { r0, _, e1 := Syscall6(SYS_SPLICE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags)) n = int64(r0) 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) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Statfs(path string, buf *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(buf)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func SyncFileRange(fd int, off int64, n int64, flags int) (err error) { _, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE, uintptr(fd), uintptr(off), uintptr(n), 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 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)), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getgroups(n int, list *_Gid_t) (nn int, err error) { r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0) nn = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(n int, list *_Gid_t) (err error) { _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0) 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 Utime(path string, buf *Utimbuf) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pipe2(p *[2]_C_int, flags int) (err error) { _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return }
{ "pile_set_name": "Github" }
/* * JBoss, Home of Professional Open Source. * Copyright 2011, Red Hat, Inc., and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This 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 software 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 software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.as.test.iiop.basic; import java.io.IOException; import java.util.Properties; import javax.naming.InitialContext; import javax.naming.NamingException; import org.junit.Assert; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.container.test.api.OperateOnDeployment; import org.jboss.arquillian.container.test.api.TargetsContainer; import org.jboss.arquillian.junit.Arquillian; import org.jboss.as.network.NetworkUtils; import org.jboss.as.test.shared.FileUtils; import org.jboss.as.test.shared.PropertiesValueResolver; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.StringAsset; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * A simple IIOP invocation for one AS7 server to another */ @RunWith(Arquillian.class) public class BasicIIOPInvocationTestCase { @Deployment(name = "server", testable = false) @TargetsContainer("iiop-server") public static Archive<?> deployment() { final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "server.jar"); jar.addClasses(IIOPBasicBean.class, IIOPBasicHome.class, IIOPBasicRemote.class, IIOPBasicStatefulBean.class, IIOPBasicStatefulHome.class, IIOPBasicStatefulRemote.class, HandleWrapper.class) .addAsManifestResource(BasicIIOPInvocationTestCase.class.getPackage(), "jboss-ejb3.xml", "jboss-ejb3.xml"); return jar; } @Deployment(name = "client", testable = true) @TargetsContainer("iiop-client") public static Archive<?> clientDeployment() { /* * The @EJB annotation doesn't allow to specify the address dynamically. So, istead of * @EJB(lookup = "corbaname:iiop:localhost:3628#IIOPTransactionalStatelessBean") * private IIOPTransactionalHome home; * we need to do this trick to get the ${node0} sys prop into ejb-jar.xml * and have it injected that way. */ String ejbJar = FileUtils.readFile(BasicIIOPInvocationTestCase.class, "ejb-jar.xml"); final Properties properties = new Properties(); properties.putAll(System.getProperties()); if(properties.containsKey("node1")) { properties.put("node1", NetworkUtils.formatPossibleIpv6Address((String) properties.get("node1"))); } final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "client.jar"); jar.addClasses(ClientEjb.class, IIOPBasicHome.class, IIOPBasicRemote.class, BasicIIOPInvocationTestCase.class, IIOPBasicStatefulHome.class, IIOPBasicStatefulRemote.class, HandleWrapper.class) .addAsManifestResource(BasicIIOPInvocationTestCase.class.getPackage(), "jboss-ejb3.xml", "jboss-ejb3.xml") .addAsManifestResource(new StringAsset(PropertiesValueResolver.replaceProperties(ejbJar, properties)), "ejb-jar.xml"); return jar; } @Test @OperateOnDeployment("client") public void testRemoteIIOPInvocation() throws IOException, NamingException { final ClientEjb ejb = client(); Assert.assertEquals("hello", ejb.getRemoteMessage()); } @Test @OperateOnDeployment("client") public void testHomeHandle() throws IOException, NamingException { final ClientEjb ejb = client(); Assert.assertEquals("hello", ejb.getRemoteViaHomeHandleMessage()); } @Test @OperateOnDeployment("client") public void testHandle() throws IOException, NamingException { final ClientEjb ejb = client(); Assert.assertEquals("hello", ejb.getRemoteViaHandleMessage()); } /** * Tests that even if a handle is returned embedded in another object the substitution service will * replace it with a correct IIOP version of a handle. */ @Test @OperateOnDeployment("client") public void testWrappedHandle() throws IOException, NamingException { final ClientEjb ejb = client(); Assert.assertEquals("hello", ejb.getRemoteViaWrappedHandle()); } @Test @OperateOnDeployment("client") public void testEjbMetadata() throws IOException, NamingException { final ClientEjb ejb = client(); Assert.assertEquals("hello", ejb.getRemoteMessageViaEjbMetadata()); } @Test @OperateOnDeployment("client") public void testIsIdentical() throws IOException, NamingException { final ClientEjb ejb = client(); ejb.testIsIdentical(); } private ClientEjb client() throws NamingException { final InitialContext context = new InitialContext(); return (ClientEjb) context.lookup("java:module/" + ClientEjb.class.getSimpleName()); } }
{ "pile_set_name": "Github" }
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import <IDEDocViewer/IDEDocURLDownloader.h> @class IDEDocPDFDownloadController; @interface IDEDocPDFDownloader : IDEDocURLDownloader { IDEDocPDFDownloadController *_downloadController; } @property(retain) IDEDocPDFDownloadController *downloadController; // @synthesize downloadController=_downloadController; - (void).cxx_destruct; - (void)downloadDidFinish:(id)arg1; @end
{ "pile_set_name": "Github" }
/* * 11.7 * * [email protected] * 2013-6-2 * * unix> cc -Wall -I../../common ../../common/csapp.c tiny.c -lpthread -o tiny */ #include "csapp.h" #include <limits.h> /* INT_MIN */ void doit(int fd); int parse_uri(char *uri, char *filename, char *cgiargs); void serve_static(int fd, char *filename, int filesize); void get_filetype(char *filename, char *filetype); void serve_dynamic(int fd, char *filename, char *cgiargs); void clienterror(int fd, char *cause, char *errnum, char *shortmsg, char *longmsg); void reap_child(int signo) { for (;;) { /* We don't care child's status */ int ret = waitpid(-1, NULL, WNOHANG); if (ret == 0) /* child didn't terminated, return immediately */ break; else if (ret < 0 && errno == ECHILD) /* no child */ break; else /* continue */; } } static int is_wait; /* Waits for child when failed to install handler */ int main(int argc, char **argv) { int listenfd, connfd, port; struct sockaddr_in clientaddr; socklen_t clientlen; /* avoid compiler warning */ /* Check command line args */ if (argc != 2) { fprintf(stderr, "usage: %s <port>\n", argv[0]); exit(1); } port = atoi(argv[1]); /* Install SIGCHILD handler */ struct sigaction action, old_action; action.sa_handler = reap_child; sigemptyset(&action.sa_mask); action.sa_flags = SA_RESTART; int ret = sigaction(SIGCHLD, &action, &old_action); is_wait = ret < 0; if (is_wait) { fprintf(stderr, "sigaction: %s, we will wait child to terminated\n", strerror(errno)); } listenfd = Open_listenfd(port); while (1) { clientlen = sizeof(clientaddr); connfd = Accept(listenfd, (SA *)&clientaddr, &clientlen); doit(connfd); Close(connfd); } } void doit(int fd) { int is_static; struct stat sbuf; char buf[MAXLINE], method[MAXLINE], uri[MAXLINE], version[MAXLINE]; char filename[MAXLINE], cgiargs[MAXLINE]; rio_t rio; /* Read request line and headers, put them into a file */ char *request = NULL; Rio_readinitb(&rio, fd); for (;;) { Rio_readlineb(&rio, buf, MAXLINE); /* * Firefox will sent \x16\x3. * \x16: Synchronous Idle, \x3: End of Text */ if (!strncmp(buf, "\x16\x3", 2)) { free(request); return; } int buflen = strlen(buf); char *old_request = request; int old_reqlen = old_request==NULL ? 0 : strlen(old_request); request = realloc(old_request, buflen + old_reqlen + 1); if (request == NULL) { fprintf(stderr, "realloc: run out of memory\n"); free(old_request); return; } memmove(request+old_reqlen, buf, buflen+1); if (!strcmp(buf, "\r\n")) /* Copy before stop */ break; } sscanf(request, "%s %s %s", method, uri, version); if (strcasecmp(method, "GET")) { clienterror(fd, method, "501", "Not implemented", "Tiny does not implement this method"); return; } FILE *out = fopen("tiny-request.txt", "w+"); if (out == NULL) { perror("fopen"); free(request); return; } fprintf(out, "%s", request); fflush(out); fclose(out); free(request); /* Parse URI from GET request */ is_static = parse_uri(uri, filename, cgiargs); if (stat(filename, &sbuf) < 0) { clienterror(fd, filename, "404", "Not found", "Tiny couldn't read the file"); return; } if (is_static) { /* Serve static content */ if (!(S_ISREG(sbuf.st_mode)) || !(S_IRUSR & sbuf.st_mode)) { clienterror(fd, filename, "403", "Forbidden", "Tiny couldn't read the filetype"); return; } serve_static(fd, filename, sbuf.st_size); } else { /* Serve dynamic content */ if (!(S_ISREG(sbuf.st_mode)) || !(S_IXUSR & sbuf.st_mode)) { clienterror(fd, filename, "403", "Forbidden", "Tiny couldn't run the CGI program"); return; } serve_dynamic(fd, filename, cgiargs); } } void clienterror(int fd, char *cause, char *errnum, char *shortmsg, char *longmsg) { char buf[MAXLINE], body[MAXBUF]; /* Build the HTTP response body */ sprintf(body, "<html><title>Tiny Error</title>"); sprintf(body, "%s<body bgcolor=""ffffff"">\r\n", body); sprintf(body, "%s%s: %s\r\n", body, errnum, shortmsg); sprintf(body, "%s<p>%s: %s\r\n", body, longmsg, cause); sprintf(body, "%s<hr><em>The Tiny Web server</em>\r\n", body); /* Print the HTTP response */ sprintf(buf, "HTTP/1.0 %s %s\r\n", errnum, shortmsg); Rio_writen(fd, buf, strlen(buf)); sprintf(buf, "Content-type: text/html\r\n"); Rio_writen(fd, buf, strlen(buf)); sprintf(buf, "Content-length: %d\r\n\r\n", (int)strlen(body)); Rio_writen(fd, buf, strlen(buf)); Rio_writen(fd, body, strlen(body)); } int parse_uri(char *uri, char *filename, char *cgiargs) { char *ptr; if (!strstr(uri, "cgi-bin")) { /* Static content */ strcpy(cgiargs, ""); strcpy(filename, "."); strcat(filename, uri); if (uri[strlen(uri)-1] == '/') strcat(filename, "home.html"); return 1; } else { /* Dynamic content */ ptr = strchr(uri, '?'); if (ptr) { strcpy(cgiargs, ptr+1); *ptr = '\0'; } else { strcpy(cgiargs, ""); } strcpy(filename, "."); strcat(filename, uri); return 0; } } void serve_static(int fd, char *filename, int filesize) { char filetype[MAXLINE], buf[MAXBUF]; /* Send response headers to client */ get_filetype(filename, filetype); snprintf(buf, sizeof(buf), "HTTP/1.0 200 OK\r\n"); snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), "Server: Tiny Web Server\r\n"); snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), "Content-length: %d\r\n", filesize); snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), "Content-type: %s\r\n\r\n", filetype); Rio_writen(fd, buf, strlen(buf)); /* * Send response body to client * * If the file is big enough, we read many times, and each time we * double increase buffer. */ int srcfd = Open(filename, O_RDONLY, 0); char *body = NULL; const int min_size = (1<<10); /* 1KB */ int max_size = (unsigned)INT_MIN >> 1; /* 16bit: 16KB, 32bit: 1GB */ size_t size = min_size; for (;;) { if (size != max_size) { char *old_body = body; body = realloc(old_body, size); if (body == NULL) { if (size == min_size) { free(old_body); perror("realloc"); break; } else { /* size > min_size */ max_size = size >> 1; size = max_size; body = old_body; } } } int n = Rio_readn(srcfd, body, size); if (n > 0) /* read something */ Rio_writen(fd, body, n); if (n != size) /* EOF or read all the content */ break; if (size != max_size) size <<= 1; /* increase buffer, read more next time */ } /* Clean */ free(body); Close(srcfd); } /* * get_filetype - derive file type from name */ void get_filetype(char *filename, char *filetype) { if (strstr(filename, ".html")) strcpy(filetype, "text/html"); else if (strstr(filename, ".gif")) strcpy(filetype, "image/gif"); else if (strstr(filename, ".jpg")) strcpy(filetype, "image/jpeg"); else if (strstr(filename, ".mpg")) strcpy(filetype, "video/mpeg"); else strcpy(filetype, "text/plain"); } void serve_dynamic(int fd, char *filename, char *cgiargs) { char buf[MAXLINE], *emptylist[] = { NULL }; /* Return first part of HTTP response */ sprintf(buf, "HTTP/1.0 200 OK\r\n"); Rio_writen(fd, buf, strlen(buf)); sprintf(buf, "Server: Tiny Web Server\r\n"); Rio_writen(fd, buf, strlen(buf)); if (Fork() == 0) { /* child */ /* Real server would set all CGI vars here */ setenv("QUERY_STRING", cgiargs, 1); Dup2(fd, STDOUT_FILENO); /* Redirect stdout to client */ Execve(filename, emptylist, environ); /* Run CGI program */ } if (is_wait) Wait(NULL); /* Parent waits for and reaps child */ }
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: 12dc48c8a56df784b93db42c5d582f3e timeCreated: 1503327504 licenseType: Store ShaderImporter: defaultTextures: [] userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
/* Copyright 2004,2007 ENSEIRB, INRIA & CNRS ** ** This file is part of the Scotch software package for static mapping, ** graph partitioning and sparse matrix ordering. ** ** This software is governed by the CeCILL-C license under French law ** and abiding by the rules of distribution of free software. You can ** use, modify and/or redistribute the software under the terms of the ** CeCILL-C license as circulated by CEA, CNRS and INRIA at the following ** URL: "http://www.cecill.info". ** ** As a counterpart to the access to the source code and rights to copy, ** modify and redistribute granted by the license, users are provided ** only with a limited warranty and the software's author, the holder of ** the economic rights, and the successive licensors have only limited ** liability. ** ** In this respect, the user's attention is drawn to the risks associated ** with loading, using, modifying and/or developing or reproducing the ** software by the user in light of its specific status of free software, ** that may mean that it is complicated to manipulate, and that also ** therefore means that it is reserved for developers and experienced ** professionals having in-depth computer knowledge. Users are therefore ** encouraged to load and test the software's suitability as regards ** their requirements in conditions enabling the security of their ** systems and/or data to be ensured and, more generally, to use and ** operate it in the same conditions as regards security. ** ** The fact that you are presently reading this means that you have had ** knowledge of the CeCILL-C license and that you accept its terms. */ /************************************************************/ /** **/ /** NAME : hgraph_induce.h **/ /** **/ /** AUTHOR : Francois PELLEGRINI **/ /** **/ /** FUNCTION : These lines are the data declarations **/ /** for the halo graph subgraph making **/ /** functions. **/ /** **/ /** DATES : # Version 4.0 : from : 10 jan 2002 **/ /** to 22 dec 2002 **/ /** **/ /************************************************************/ /* ** The function prototypes. */ #ifndef HGRAPH_INDUCE #define static #endif static int hgraphInduce2 (const Hgraph * const, Gnum * const, Hgraph * const, const Gnum, Gnum * const); static void hgraphInduce2L (const Hgraph * const, Gnum * const, Hgraph * const); static void hgraphInduce2U (const Hgraph * const, Gnum * const, Hgraph * const); static Gnum hgraphInduce3 (const Hgraph * const, const VertList * const); #undef static
{ "pile_set_name": "Github" }
<?php /* * e107 website system * * Copyright (C) 2008-2009 e107 Inc (e107.org) * Released under the terms and conditions of the * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * * Sitelinks configuration module - gsitemap * * $Source: /cvs_backup/e107_0.8/e107_plugins/faqs/e_sitelink.php,v $ * $Revision$ * $Date$ * $Author$ * */ if (!defined('e107_INIT')) { exit; } /*if(!e107::isInstalled('gsitemap')) { return; }*/ class faqs_sitelink // include plugin-folder in the name. { function config() { global $pref; $links = array(); $links[] = array( 'name' => LAN_PLUGIN_FAQS_FUNCTIONNAME, // "FAQ Categories", 'function' => "faqCategories" ); return $links; } function faqCategories() { $sql = e107::getDb(); $tp = e107::getParser(); $sublinks = array(); $sql->select("faqs_info","*","faq_info_id != '' ORDER BY faq_info_order"); while($row = $sql->fetch()) { $sublinks[] = array( 'link_name' => $tp->toHTML($row['faq_info_title'],'','TITLE'), 'link_url' => e107::url('faqs', 'category', $row), 'link_description' => $row['faq_info_about'], 'link_button' => $row['faq_info_icon'], 'link_category' => '', 'link_order' => '', 'link_parent' => '', 'link_open' => '', 'link_class' => intval($row['faq_info_class']) ); } return $sublinks; } }
{ "pile_set_name": "Github" }
# # Generated by: maxdiff_to_scale.pl # MaxDiff File: ../Complete-Data-Package/Testing/Phase2Answers/Phase2Answers-6d.txt # Scaled File: Testing/GoldRatings-6d.txt # Number of MaxDiff Answers: 563 # Number of Unique Pairs: 45 # # Score = Most - Least # Most = Percentage of times given pair was chosen as Most Illustrative # Least = Percentage of times given pair was chosen as Least Illustrative # 74.0 "deceased:alive" 53.1 "employed:jobless" 42.0 "full:empty" 34.0 "cruel:kindness" 34.0 "elderly:youth" 32.0 "invincible:defeated" 30.0 "christian:atheist" 28.0 "kind:cruelty" 28.0 "old:youth" 26.5 "rich:poverty" 24.5 "old:young" 22.0 "pretty:ugly" 20.0 "hostage:freedom" 20.0 "young:old" 18.0 "deceptive:honest" 18.0 "fat:skinny" 8.0 "satiated:hunger" 8.0 "childish:mature" 4.0 "whole:broken" 4.0 "plump:thinness" 2.0 "poisonous:healthy" 0.0 "weak:invincibility" -1.8 "happy:heartbroken" -2.0 "sleepy:alertness" -4.0 "impatient:tranquil" -4.0 "afloat:submerged" -4.0 "virginity:sex" -6.0 "craggy:smooth" -10.0 "attentive:dazed" -10.2 "hungry:full" -12.0 "banal:original" -14.0 "nice:mean" -16.0 "withdrawn:sociable" -18.0 "freedom:hostage" -20.0 "ecstatic:angry" -20.0 "dazed:attentive" -20.0 "healthy:poisonous" -22.4 "alert:tired" -23.6 "irresponsible:maturity" -44.9 "desperate:satisfied" -46.0 "build:destroy" -46.0 "prison:release" -53.1 "pregnant:birth" -62.0 "fracture:heal" -68.0 "birth:pregnant"
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="ember-guides/config/environment" content="%7B%22modulePrefix%22%3A%22ember-guides%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22trailing-history%22%2C%22historySupportMiddleware%22%3Atrue%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_DEFAULT_ASYNC_OBSERVERS%22%3Atrue%2C%22_JQUERY_INTEGRATION%22%3Afalse%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22name%22%3A%22ember-guides%22%2C%22version%22%3A%223.7.0%2Ba7598d50%22%7D%2C%22ember-meta%22%3A%7B%22description%22%3A%22Ember.js%20helps%20developers%20be%20more%20productive%20out%20of%20the%20box.%20Designed%20with%20developer%20ergonomics%20in%20mind%2C%20its%20friendly%20APIs%20help%20you%20get%20your%20job%20done%E2%80%94fast.%22%7D%2C%22guidemaker%22%3A%7B%22title%22%3A%22Ember%20Guides%22%2C%22sourceRepo%22%3A%22https%3A%2F%2Fgithub.com%2Fember-learn%2Fguides-source%22%7D%2C%22algolia%22%3A%7B%22algoliaId%22%3A%22Y1OMR4C7MF%22%2C%22algoliaKey%22%3A%225d01c83734dc36754d9e94cbf6f8964d%22%2C%22indexName%22%3A%22ember-guides%22%7D%2C%22showdown%22%3A%7B%22ghCompatibleHeaderId%22%3Atrue%2C%22prefixHeaderId%22%3A%22toc_%22%7D%2C%22deprecationsGuideURL%22%3A%22https%3A%2F%2Fwww.emberjs.com%2Fdeprecations%2F%22%2C%22metricsAdapters%22%3A%5B%7B%22name%22%3A%22GoogleAnalytics%22%2C%22environments%22%3A%5B%22production%22%5D%2C%22config%22%3A%7B%22id%22%3A%22UA-27675533-1%22%2C%22require%22%3A%5B%22linkid%22%5D%7D%7D%5D%2C%22infoBanner%22%3A%7B%22content%22%3A%22Ember%20Octane%20is%20here!%20A%20lot%20has%20changed%20since%20Ember%203.14%2C%20including%20these%20Guides.%20Read%20more%20in%20the%20%3Ca%20href%3D%5C%22https%3A%2F%2Fblog.emberjs.com%2F2019%2F12%2F20%2Foctane-is-here.html%5C%22%3EEmber%20Blog%3C%2Fa%3E.%22%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22fastboot%22%3A%7B%22hostWhitelist%22%3A%5B%7B%7D%5D%7D%2C%22ember-collapsible-panel%22%3A%7B%7D%7D" /> <!-- EMBER_CLI_FASTBOOT_TITLE --> <meta name="ember-cli-head-start" content> <title>Computed Properties - The Object Model - Ember Guides</title> <meta name="description" content="What are Computed Properties? In a nutshell, computed properties let you declare functions as properties. You create one by defining a computed property as a function, which Ember will automatically call when you ask for the property. You can then use it..."> <meta name="referrer" content="unsafe-url"> <!----> <!----> <!----> <!----> <meta property="og:title" content="Computed Properties - The Object Model - Ember Guides"> <!----> <meta property="og:description" content="What are Computed Properties? In a nutshell, computed properties let you declare functions as properties. You create one by defining a computed property as a function, which Ember will automatically call when you ask for the property. You can then use it..."> <meta property="og:type" content="website"> <!----> <meta name="twitter:card" content="summary"> <!----> <!----> <meta name="twitter:title" content="Computed Properties - The Object Model - Ember Guides"> <!----> <meta name="twitter:description" content="What are Computed Properties? In a nutshell, computed properties let you declare functions as properties. You create one by defining a computed property as a function, which Ember will automatically call when you ask for the property. You can then use it..."> <!----> <!----> <!----><meta name="ember-cli-head-end" content> <link integrity="" rel="stylesheet" href="/assets/vendor-c5cdfdb224e40208d070a18942b32fd3.css"> <link integrity="" rel="stylesheet" href="/assets/ember-guides-92dca9f7555a994d11fd3e94376c4753.css"> <link rel="shortcut icon" href="/images/favicon.png" /> </head> <body class="application version show version-show"> <script type="x/boundary" id="fastboot-body-start"></script><!----> <header id="ember368414" class="es-header ember-view" role="banner"><div id="ember368415" class="ember-view"><div class="container"> <nav id="ember368416" class="navbar navbar-inverse navbar-expand-lg bg-inverse ember-view"> <a class="navbar-brand" href="https://www.emberjs.com"> <svg width="94" height="37" viewBox="0 0 259 100" xmlns="http://www.w3.org/2000/svg"><title>Ember Logo 1c White</title><g fill="#FFF" fill-rule="evenodd"><path d="M253.97 68.576s-6.28 4.872-11.807 4.328c-5.528-.544-3.792-12.896-3.792-12.896s1.192-11.328-2.064-12.28c-3.248-.944-7.256 2.952-7.256 2.952s-4.984 5.528-7.368 12.576l-.656.216s.76-12.36-.104-15.176c-.648-1.408-6.608-1.296-7.584 1.192-.976 2.496-5.744 19.832-6.072 27.096 0 0-9.32 7.912-17.44 9.208-8.128 1.304-10.08-3.792-10.08-3.792s22.104-6.176 21.344-23.84c-.752-17.664-17.824-11.128-19.752-9.68-1.872 1.408-11.848 7.424-14.76 24.088-.096.56-.272 3.04-.272 3.04s-8.56 5.736-13.328 7.256c0 0 13.328-22.432-2.92-32.616-4.574-2.753-8.56-.216-10.929 2.11-1.451 1.425 19.705-21.718 14.825-42.422C151.635.08 146.707-.976 142.187.624c-6.864 2.704-9.464 6.712-9.464 6.712s-8.888 12.896-10.952 32.08c-2.056 19.176-5.088 42.368-5.088 42.368s-4.232 4.12-8.128 4.336c-3.904.208-2.168-11.6-2.168-11.6s3.032-17.984 2.824-21.024c-.224-3.032-.44-4.656-4.016-5.736-3.576-1.088-7.48 3.464-7.48 3.464s-10.288 15.6-11.152 17.984l-.552.984-.536-.656s7.256-21.24.328-21.56c-6.936-.328-11.488 7.584-11.488 7.584s-7.912 13.224-8.24 14.736l-.536-.648s3.248-15.384 2.6-19.184c-.656-3.792-4.224-3.032-4.224-3.032s-4.552-.544-5.744 2.384c-1.192 2.928-5.528 22.32-6.072 28.496 0 0-11.376 8.128-18.856 8.232-7.472.112-6.712-4.736-6.712-4.736s27.416-9.384 19.936-27.912c-3.36-4.768-7.256-6.264-12.784-6.16-5.528.112-12.384 3.48-16.824 13.448-2.128 4.752-2.896 9.272-3.336 12.68 0 0-4.792.984-7.392-1.184-2.608-2.168-3.944 0-3.944 0s-4.464 5.696-.024 7.424c4.448 1.736 11.376 2.544 11.376 2.544.64 3.032 2.488 8.192 7.904 12.296 8.128 6.176 23.72-.568 23.72-.568l6.392-3.584s.216 5.864 4.88 6.72c4.656.856 6.608-.016 14.736-19.736 4.768-10.08 5.096-9.536 5.096-9.536.536-.112-3.144 19.176-1.736 24.376 1.408 5.208 7.584 4.664 7.584 4.664s3.36.648 6.072-8.888c2.704-9.536 7.912-20.048 7.912-20.048.64 0-1.632 19.72 1.832 26.008 3.472 6.288 12.464 2.112 12.464 2.112s6.288-3.168 7.264-4.144c0 0 7.456 6.352 17.976 5.2 23.52-4.632 31.888-10.888 31.888-10.888s4.04 10.24 16.56 11.192c14.296 1.08 22.104-7.912 22.104-7.912s-.112 5.848 4.872 7.912c4.992 2.056 8.344-9.52 8.344-9.52l8.344-22.992c.76 0 1.192 14.952 9.432 17.336 8.232 2.384 18.96-5.584 18.96-5.584s2.6-1.432 2.168-5.768c-.44-4.336-4.336-2.72-4.336-2.72zM36.93 57.728c2.92 2.816 1.84 8.88-3.687 12.672-5.52 3.8-8.016 3.04-8.016 3.04.328-12.896 8.784-18.536 11.704-15.712zm107.817-44.536c1.84 9.752-16.144 38.792-16.144 38.792.216-6.504 6.608-28.496 6.608-28.496s7.688-20.048 9.536-10.296zM126.97 87.2s-1.408-4.768 2.6-18.096c4.016-13.328 13.44-8.128 13.44-8.128s6.504 4.984 1.408 18.312C139.33 92.616 126.97 87.2 126.97 87.2zm54.832-26.112c4.44-8.128 7.912-3.688 7.912-3.688s3.792 4.12-.544 10.296c-4.336 6.176-10.616 5.744-10.616 5.744s-1.192-4.232 3.248-12.352z"/><path d="M226.028 93.977v-1.555h.986c.137 0 .274.015.418.03.144.02.28.057.396.107.122.05.216.122.288.216.079.094.115.223.115.382 0 .36-.108.59-.324.684-.216.093-.497.136-.835.136h-1.044zm-1.174-2.47v5.92h1.174v-2.528h.734l1.44 2.527h1.231l-1.584-2.585a2.8 2.8 0 0 0 .612-.13c.187-.064.353-.158.49-.28.144-.122.252-.28.331-.475.086-.195.122-.425.122-.699 0-.64-.201-1.094-.597-1.353-.403-.267-.98-.396-1.72-.396h-2.233zm-1.88 2.967c0-.605.102-1.159.31-1.663.21-.504.49-.936.85-1.303a3.853 3.853 0 0 1 1.26-.864 3.93 3.93 0 0 1 1.562-.31c.548 0 1.066.101 1.548.31.49.209.908.497 1.268.864s.64.8.856 1.303c.21.504.317 1.058.317 1.663s-.108 1.16-.317 1.67c-.216.505-.496.951-.856 1.318-.36.375-.778.663-1.268.871-.482.21-1 .31-1.548.31a3.93 3.93 0 0 1-1.562-.31 3.765 3.765 0 0 1-1.26-.87 4.109 4.109 0 0 1-.85-1.318 4.366 4.366 0 0 1-.31-1.67zm-1.446 0c0 .814.15 1.541.446 2.19.302.654.698 1.209 1.195 1.67.504.46 1.08.813 1.735 1.058.656.245 1.34.367 2.052.367.72 0 1.404-.122 2.06-.367a5.282 5.282 0 0 0 1.735-1.059 5.234 5.234 0 0 0 1.195-1.67c.295-.648.44-1.375.44-2.189 0-.799-.145-1.526-.44-2.174a5.125 5.125 0 0 0-2.93-2.722 5.675 5.675 0 0 0-2.06-.374c-.712 0-1.396.122-2.052.374a5.125 5.125 0 0 0-2.93 2.722c-.295.648-.446 1.375-.446 2.174z"/></g></svg> </a> <button id="ember368417" class="navbar-toggler collapsed ember-view"> <span class="navbar-toggler-icon"></span> </button> <div id="ember368418" class="navbar-collapse collapse ember-view"><ul id="ember368419" class="mr-auto nav navbar-nav ember-view"><!----><li id="ember368420" class="dropdown nav-item ember-view"> <a href="#" id="ember368421" class="dropdown-toggle nav-link ember-view" role="button">Docs <span class="caret"></span></a> <!----> </li> <!----><li id="ember368423" class="dropdown nav-item ember-view"> <a href="#" id="ember368424" class="dropdown-toggle nav-link ember-view" role="button">Releases <span class="caret"></span></a> <!----> </li> <li id="ember368426" class="nav-item ember-view"> <a href="https://emberjs.com/blog" class="nav-link">Blog</a> </li><!----> <!----><li id="ember368427" class="dropdown nav-item ember-view"> <a href="#" id="ember368428" class="dropdown-toggle nav-link ember-view" role="button">Community <span class="caret"></span></a> <!----> </li> <!----><li id="ember368430" class="dropdown nav-item ember-view"> <a href="#" id="ember368431" class="dropdown-toggle nav-link ember-view" role="button">About <span class="caret"></span></a> <!----> </li> </ul><ul id="ember368433" class="nav navbar-nav ember-view"> <form> <div id="ember368434" class="search-input ember-view"> <input id="search-input" placeholder="Search the guides" autocomplete="off" type="search"> <div id="ember368435" class="ds-dropdown-results ember-tether ember-view"><!----></div></div> </form> </ul> </div> </nav></div> </div> </header> <!----> <div class="info-banner-wrapper"> <div class="info-banner-container"> <div id="ember368436" class="ember-view"><p>Ember Octane is here! A lot has changed since Ember 3.14, including these Guides. Read more in the <a href="https://blog.emberjs.com/2019/12/20/octane-is-here.html">Ember Blog</a>.</p> </div> </div> </div> <main class="container"> <aside class="sidebar"> <label for="version-select" class="visually-hidden">Guides version</label> <div id="ember368437" class="ember-basic-dropdown ember-view"> <div aria-label="v3.4.0" aria-owns="ember-basic-dropdown-content-ember368437" tabindex="0" data-ebd-id="ember368437-trigger" role="button" id="ember368438" class="ember-power-select-trigger ember-basic-dropdown-trigger ember-basic-dropdown-trigger--in-place ember-view"> <span class="ember-power-select-selected-item"> 3.4 (LTS) </span> <!----><span class="ember-power-select-status-icon"></span> </div> <div id="ember-basic-dropdown-content-ember368437" class="ember-basic-dropdown-content-placeholder" style="display: none;"></div> </div> <input id="toc-toggle" class="toc-toggle visually-hidden" type="checkbox"> <label for="toc-toggle">Table of Contents <span class="visually-hidden">toggle</span></label> <nav class="toc-container versions" aria-label="table of contents"> <ol id="ember368442" class="toc-level-0 ember-view"><!----> <li class="toc-group toc-level-0"> <div id="ember368445" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/getting-started" id="ember368446" class="cp-Panel-toggle ember-view"> Getting Started </a> <div id="ember368447" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368449" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/tutorial" id="ember368450" class="cp-Panel-toggle ember-view"> Tutorial </a> <div id="ember368451" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368453" class="cp-Panel cp-is-open ember-view"><a href="/v3.4.0/object-model" id="ember368454" class="cp-Panel-toggle ember-view"> The Object Model </a> <div id="ember368455" class="cp-Panel-body cp-is-open ember-view"> <div class="cp-Panel-body-inner"> <ol id="ember368456" class="toc-level-1 ember-view"> <li class="toc-link toc-level-1 "> <a href="/v3.4.0/object-model/index" id="ember368458" class="ember-view"> Objects in Ember </a> </li> <li class="toc-link toc-level-1 "> <a href="/v3.4.0/object-model/classes-and-instances" id="ember368460" class="ember-view"> Classes and Instances </a> </li> <li class="toc-link toc-level-1 "> <a href="/v3.4.0/object-model/reopening-classes-and-instances" id="ember368462" class="ember-view"> Reopening Classes and Instances </a> </li> <li class="toc-link toc-level-1 selected"> <a href="/v3.4.0/object-model/computed-properties" id="ember368464" class="selected ember-view"> Computed Properties </a> </li> <li class="toc-link toc-level-1 "> <a href="/v3.4.0/object-model/computed-properties-and-aggregate-data" id="ember368466" class="ember-view"> Computed Properties and Aggregate Data </a> </li> <li class="toc-link toc-level-1 "> <a href="/v3.4.0/object-model/observers" id="ember368468" class="ember-view"> Observers </a> </li> <li class="toc-link toc-level-1 "> <a href="/v3.4.0/object-model/bindings" id="ember368470" class="ember-view"> Bindings </a> </li> <li class="toc-link toc-level-1 "> <a href="/v3.4.0/object-model/enumerables" id="ember368472" class="ember-view"> Enumerables </a> </li> </ol> </div> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368474" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/routing" id="ember368475" class="cp-Panel-toggle ember-view"> Routing </a> <div id="ember368476" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368478" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/templates" id="ember368479" class="cp-Panel-toggle ember-view"> Templates </a> <div id="ember368480" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368482" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/components" id="ember368483" class="cp-Panel-toggle ember-view"> Components </a> <div id="ember368484" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368486" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/controllers" id="ember368487" class="cp-Panel-toggle ember-view"> Controllers </a> <div id="ember368488" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368490" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/models" id="ember368491" class="cp-Panel-toggle ember-view"> Models </a> <div id="ember368492" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368494" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/applications" id="ember368495" class="cp-Panel-toggle ember-view"> Application Concerns </a> <div id="ember368496" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368498" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/testing" id="ember368499" class="cp-Panel-toggle ember-view"> Testing </a> <div id="ember368500" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368502" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/ember-inspector" id="ember368503" class="cp-Panel-toggle ember-view"> Ember Inspector </a> <div id="ember368504" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368506" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/addons-and-dependencies" id="ember368507" class="cp-Panel-toggle ember-view"> Addons and Dependencies </a> <div id="ember368508" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368510" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/configuring-ember" id="ember368511" class="cp-Panel-toggle ember-view"> Configuring Ember.js </a> <div id="ember368512" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368514" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/contributing" id="ember368515" class="cp-Panel-toggle ember-view"> Contributing to Ember.js </a> <div id="ember368516" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368518" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/glossary" id="ember368519" class="cp-Panel-toggle ember-view"> Glossary </a> <div id="ember368520" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> </ol> </nav> </aside> <article id="ember368521" class="chapter ember-view"> <div class="old-version-warning"> <i class="icon-attention-circled"></i><strong>Old Guides - </strong>You are viewing the guides for Ember v3.4.0. <a href="/release/object-model/computed-properties" id="ember368522" class="btn ember-view"> VIEW v3.15.0 </a> </div> <a href="https://github.com/ember-learn/guides-source/edit/master/guides/v3.4.0/object-model/computed-properties.md" target="_blank" class="edit-page icon-pencil" rel="noopener"> Edit Page </a> <h1> Computed Properties </h1> <hr> <div id="ember368523" class="ember-view"><h2 id="toc_what-are-computed-properties">What are Computed Properties?</h2> <section aria-labelledby="toc_what-are-computed-properties"> <p>In a nutshell, computed properties let you declare functions as properties. You create one by defining a computed property as a function, which Ember will automatically call when you ask for the property. You can then use it the same way you would any normal, static property.</p> <p>It's super handy for taking one or more normal properties and transforming or manipulating their data to create a new value.</p> </section> <h3 id="toc_computed-properties-in-action">Computed properties in action</h3> <section aria-labelledby="toc_computed-properties-in-action"> <p>We'll start with a simple example. We have a <code>Person</code> object with <code>firstName</code> and <code>lastName</code> properties, but we also want a <code>fullName</code> property that joins the two names when either of them changes:</p> <pre><code class="javascript language-javascript">import EmberObject, { computed } from '@ember/object'; Person = EmberObject.extend({ // these will be supplied by `create` firstName: null, lastName: null, fullName: computed('firstName', 'lastName', function() { return `${this.firstName} ${this.lastName}`; }) }); let ironMan = Person.create({ firstName: 'Tony', lastName: 'Stark' }); ironMan.fullName; // "Tony Stark" </code></pre> <p>This declares <code>fullName</code> to be a computed property, with <code>firstName</code> and <code>lastName</code> as the properties it depends on. The first time you access the <code>fullName</code> property, the function will be called and the results will be cached. Subsequent access of <code>fullName</code> will read from the cache without calling the function. Changing any of the dependent properties causes the cache to invalidate, so that the computed function runs again on the next access.</p> </section> <h3 id="toc_computed-properties-only-recompute-when-they-are-consumed">Computed properties only recompute when they are consumed</h3> <section aria-labelledby="toc_computed-properties-only-recompute-when-they-are-consumed"> <p>A computed property will only recompute its value when it is <em>consumed.</em> Properties are consumed in two ways:</p> <ol> <li>By being accessed, for example <code>ironMan.fullName</code></li> <li>By being referenced in a handlebars template that is currently being rendered, for example <code>{{ironMan.fullName}}</code></li> </ol> <p>Outside of those two circumstances the code in the property will not run, even if one of the property's dependencies are changed.</p> <p>We'll modify the <code>fullName</code> property from the previous example to log to the console:</p> <pre><code class="javascript language-javascript">import Ember from 'ember'; … fullName: computed('firstName', 'lastName', function() { console.log('compute fullName'); // track when the property recomputes return `${this.firstName} ${this.lastName}`; }) … </code></pre> <p>Using the new property, it will only log after a <code>fullName</code> is accessed, and then only if either the <code>firstName</code> or <code>lastName</code> has been previously changed:</p> <pre><code class="javascript language-javascript">let ironMan = Person.create({ firstName: 'Tony', lastName: 'Stark' }); ironMan.fullName; // 'compute fullName' ironMan.set('firstName', 'Bruce') // no console output ironMan.fullName; // 'compute fullName' ironMan.fullName; // no console output since dependencies have not changed </code></pre> </section> <h3 id="toc_multiple-dependents-on-the-same-object">Multiple dependents on the same object</h3> <section aria-labelledby="toc_multiple-dependents-on-the-same-object"> <p>In the previous example, the <code>fullName</code> computed property depends on two other properties of the same object. However, you may find that you have to observe the properties of a different object.</p> <p>For example, look at this computed property:</p> <pre><code class="javascript language-javascript">import EmberObject, { computed } from '@ember/object'; let home = EmberObject.extend({ location: { streetName: 'Evergreen Terrace', streetNumber: 742 }, address: computed('location.streetName', 'location.streetNumber', function() { return `${this.location.streetNumber} ${this.location.streetName}`; }) }); home.address // 742 Evergreen Terrace home.set('location.streetNumber', 744) home.address // 744 Evergreen Terrace </code></pre> <p>It is important to observe an object's properties, not the object itself that has properties nested inside. If the object reference <code>location</code> is used as a dependent key, the computed property will not recalculate when the <code>streetName</code> or <code>streetNumber</code> properties change.</p> <pre><code class="javascript language-javascript">import EmberObject, { computed } from '@ember/object'; let home = EmberObject.extend({ location: { streetName: 'Evergreen Terrace', streetNumber: 742 }, address: computed('location', function() { return `${this.location.streetNumber} ${this.location.streetName}`; }) }); home.address // 742 Evergreen Terrace home.set('location.streetNumber', 744) home.address // 742 Evergreen Terrace home.set('location', { streetName: 'Evergreen Terrace', streetNumber: 744 }) home.address // 744 Evergreen Terrace </code></pre> <p>Since both <code>streetName</code> and <code>streetNumber</code> are properties on the <code>location</code> object, we can use a short-hand syntax called <em>brace expansion</em> to declare the dependents keys. You surround the dependent properties with braces (<code>{}</code>), and separate with commas, like so:</p> <pre><code class="javascript language-javascript">import EmberObject, { computed } from '@ember/object'; let home = EmberObject.extend({ location: { streetName: 'Evergreen Terrace', streetNumber: 742 }, address: computed('location.{streetName,streetNumber}', function() { return `${this.location.streetNumber} ${this.location.streetName}`; }) }); </code></pre> </section> <h3 id="toc_chaining-computed-properties">Chaining computed properties</h3> <section aria-labelledby="toc_chaining-computed-properties"> <p>You can use computed properties as values to create new computed properties. Let's add a <code>description</code> computed property to the previous example, and use the existing <code>fullName</code> property and add in some other properties:</p> <pre><code class="javascript language-javascript">import EmberObject, { computed } from '@ember/object'; Person = EmberObject.extend({ firstName: null, lastName: null, age: null, country: null, fullName: computed('firstName', 'lastName', function() { return `${this.firstName} ${this.lastName}`; }), description: computed('fullName', 'age', 'country', function() { return `${this.fullName}; Age: ${this.age}; Country: ${this.country}`; }) }); let captainAmerica = Person.create({ firstName: 'Steve', lastName: 'Rogers', age: 80, country: 'USA' }); captainAmerica.get('description'); // "Steve Rogers; Age: 80; Country: USA" </code></pre> </section> <h3 id="toc_dynamic-updating">Dynamic updating</h3> <section aria-labelledby="toc_dynamic-updating"> <p>Computed properties, by default, observe any changes made to the properties they depend on and are dynamically updated when they're called. Let's use computed properties to dynamically update.</p> <pre><code class="javascript language-javascript">captainAmerica.set('firstName', 'William'); captainAmerica.description; // "William Rogers; Age: 80; Country: USA" </code></pre> <p>So this change to <code>firstName</code> was observed by <code>fullName</code> computed property, which was itself observed by the <code>description</code> property.</p> <p>Setting any dependent property will propagate changes through any computed properties that depend on them, all the way down the chain of computed properties you've created.</p> </section> <h3 id="toc_setting-computed-properties">Setting Computed Properties</h3> <section aria-labelledby="toc_setting-computed-properties"> <p>You can also define what Ember should do when setting a computed property. If you try to set a computed property, it will be invoked with the key (property name), and the value you want to set it to. You must return the new intended value of the computed property from the setter function.</p> <pre><code class="javascript language-javascript">import EmberObject, { computed } from '@ember/object'; Person = EmberObject.extend({ firstName: null, lastName: null, fullName: computed('firstName', 'lastName', { get(key) { return `${this.firstName} ${this.lastName}`; }, set(key, value) { let [firstName, lastName] = value.split(/\s+/); this.set('firstName', firstName); this.set('lastName', lastName); return value; } }) }); let captainAmerica = Person.create(); captainAmerica.set('fullName', 'William Burnside'); captainAmerica.firstName; // William captainAmerica.lastName; // Burnside </code></pre> </section> <h3 id="toc_computed-property-macros">Computed property macros</h3> <section aria-labelledby="toc_computed-property-macros"> <p>Some types of computed properties are very common. Ember provides a number of computed property macros, which are shorter ways of expressing certain types of computed property.</p> <p>In this example, the two computed properties are equivalent:</p> <pre><code class="javascript language-javascript">import EmberObject, { computed } from '@ember/object'; import { equal } from '@ember/object/computed'; Person = EmberObject.extend({ fullName: 'Tony Stark', isIronManLongWay: computed('fullName', function() { return this.fullName === 'Tony Stark'; }), isIronManShortWay: equal('fullName', 'Tony Stark') }); </code></pre> <p>To see the full list of computed property macros, have a look at <a href="https://api.emberjs.com/ember/3.4/modules/@ember%2Fobject">the API documentation</a></p> </section> </div> <footer id="ember368524" class="ember-view"> <a href="/v3.4.0/object-model/reopening-classes-and-instances" id="ember368525" class="previous-guide ember-view">Reopening Classes and Instances</a> <a href="/v3.4.0/object-model/computed-properties-and-aggregate-data" id="ember368526" class="next-guide ember-view"> Computed Properties and Aggregate Data </a></footer> </article> </main> <footer id="ember368527" class="es-footer ember-view" role="contentinfo"><div class="footer responsive"> <div class="container"> <div id="ember368528" class="footer-info ember-view"> Copyright 2020 <a href="http://tilde.io">Tilde Inc.</a> <br> <a href="https://emberjs.com/team">Team</a> | <a href="https://emberjs.com/sponsors">Sponsors</a> <br> <a href="https://emberjs.com/security">Security</a> | <a href="https://emberjs.com/legal">Legal</a> | <a href="https://emberjs.com/brand">Brand</a> <br> <a href="https://emberjs.com/guidelines">Community Guidelines</a> <!----></div> <div id="ember368529" class="footer-statement ember-view"> <p class="footer-tagline">Ember.js is free, open source and always will be.</p> <div class="footer-social"> <a href="http://twitter.com/emberjs" title="Twitter"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M939.5 227.941q-37 54-90 93v23q0 73-21 145t-64 139q-43 67-103 117t-144 82q-84 32-181 30-151 0-276-81 19 2 43 2 126 0 224-77-59-1-105-36t-64-89q19 3 34 3 24 0 48-6-63-13-104-62t-41-115v-2q38 21 82 23-37-25-59-64t-22-86q0-49 25-91 68 83 164 133t208 55q-5-21-5-41 0-75 53-127t127-53q79 0 132 57 61-12 115-44-21 64-80 100 52-6 104-28z"/></svg> </a> <a href="https://github.com/emberjs/ember.js" title="GitHub"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M392 643q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm357 0q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm90 0q0-67-39-114t-104-47q-23 0-109 12-40 6-88 6t-87-6q-85-12-109-12-66 0-104 47t-39 114q0 49 18 85t45 58q27 22 68 33t78 17q37 6 83 4h94q46 0 83-4t78-17q41-13 69-33t45-58q17-38 18-85zm125-99q0 116-34 185-22 43-59 74t-79 48q-42 17-95 27t-96 12q-43 2-93 3-43 0-79-2t-82-7q-46-5-85-17t-77-29q-38-17-67-45t-48-64q-35-69-35-185 0-132 76-221-15-45-15-95 0-64 28-121 61 0 106 22t106 69q82-20 172-20 83 0 157 18 58-46 104-67t105-22q29 57 29 121 0 49-15 94 76 89 76 222z"/></svg> </a> <a href="https://discordapp.com/invite/zT3asNS" title="Discord"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 245 240"><path d="M104.4 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1.1-6.1-4.5-11.1-10.2-11.1zm36.5 0c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1s-4.5-11.1-10.2-11.1z"/><path class="st0" d="M189.5 20h-134C44.2 20 35 29.2 35 40.6v135.2c0 11.4 9.2 20.6 20.5 20.6h113.4l-5.3-18.5 12.8 11.9 12.1 11.2 21.5 19V40.6c0-11.4-9.2-20.6-20.5-20.6zm-38.6 130.6s-3.6-4.3-6.6-8.1c13.1-3.7 18.1-11.9 18.1-11.9-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.5-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.7-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.3-1.8-1-2.8-1.7-2.8-1.7s4.8 8 17.5 11.8c-3 3.8-6.7 8.3-6.7 8.3-22.1-.7-30.5-15.2-30.5-15.2 0-32.2 14.4-58.3 14.4-58.3 14.4-10.8 28.1-10.5 28.1-10.5l1 1.2c-18 5.2-26.3 13.1-26.3 13.1s2.2-1.2 5.9-2.9c10.7-4.7 19.2-6 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.6 0 0-7.9-7.5-24.9-12.7l1.4-1.6s13.7-.3 28.1 10.5c0 0 14.4 26.1 14.4 58.3 0 0-8.5 14.5-30.6 15.2z"/></svg> </a> </div> </div> <div id="ember368530" class="footer-contributions ember-view"> <div class="contributor"> <p>Hosted by:</p> <a href="https://www.heroku.com/emberjs"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72.5 80.5" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M65.05.25H7.45a7.2 7.2 0 0 0-7.2 7.2v65.6a7.2 7.2 0 0 0 7.2 7.2h57.6a7.2 7.2 0 0 0 7.2-7.2V7.45a7.2 7.2 0 0 0-7.2-7.2zm-46.8 68v-16l9 8zm28 0V44.36c0-1.87-.94-4.11-5-4.11-8.13 0-17.26 4.09-17.35 4.13l-5.65 2.56V12.25h8V35a50.63 50.63 0 0 1 15-2.71c4.94 0 7.9 1.94 9.52 3.57a12.48 12.48 0 0 1 3.48 8.43v24zm2-43h-8a31.1 31.1 0 0 0 6-13h8a23.44 23.44 0 0 1-6 13z" id="black"/></svg> </a> </div> <div class="contributor"> <p>CDN provided by:</p> <a href="https://www.fastly.com"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1626 640" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M1105.2 71.3v421.1h126.4v-64.3h-41.8V7.2h-84.7l.1 64.1zM6.9 428.1h43V224.9h-43V169l43-7.1v-56.6c0-68.5 14.9-98.2 102.3-98.2 18.9 0 41.2 2.8 60.8 6.3l-11.6 68.9c-13.3-2.1-19.8-2.5-28.2-2.5-30.8 0-38.6 3.1-38.6 33.1V162h63.9v62.9h-63.9V428h42.5v64.3H6.9zM1062.1 407.7c-13.2 2.8-24.8 2.5-33.2 2.7-34.8.9-31.8-10.6-31.8-43.5v-142h66.3V162H997V7.2h-84.7v377.3c0 74.1 18.3 107.9 98 107.9 18.9 0 44.8-4.9 64.4-9zM1588.2 428.4a32 32 0 1 1-32.1 32 31.95 31.95 0 0 1 32.1-32m0 58.9a26.75 26.75 0 1 0 0-53.5 26.75 26.75 0 0 0 0 53.5m5.9-11.2l-6.5-9.5h-4.5v9.5h-7.2v-31.4h13.1c7.8 0 12.6 3.9 12.6 10.9 0 5.1-2.6 8.6-6.6 9.8l7.8 10.8h-8.7zm-10.9-15.8h5.7c3.3 0 5.5-1.3 5.5-4.7s-2.2-4.6-5.3-4.6h-5.9v9.3zM806.6 224.8v-11.3c-25.6-4.7-51.1-4.7-64.9-4.7-39.4 0-44.2 20.9-44.2 32.2 0 16 5.5 24.7 48.2 34 62.4 14 125.1 28.6 125.1 106 0 73.4-37.8 111.3-117.3 111.3-53.2 0-104.8-11.4-144.2-21.4v-63.2h64.1v11.2c27.6 5.3 56.5 4.8 71.6 4.8 42 0 48.8-22.6 48.8-34.6 0-16.7-12.1-24.7-51.5-32.7-74.2-12.7-133.2-38-133.2-113.5 0-71.4 47.7-99.4 127.3-99.4 53.9 0 94.8 8.4 134.2 18.4v62.8h-64zM416.9 280.4l-6.4-6.4-32.7 28.5a15.53 15.53 0 0 0-5.3-.9 16.4 16.4 0 1 0 16 16.4 19.32 19.32 0 0 0-.7-4.9z"/><path class="cls-1" d="M546.6 407.7l-.1-263.6h-84.7v24.7a173.6 173.6 0 0 0-57.6-21.8h.5v-29.2H415V96.3h-85.3v21.5H340V147h.6A174.1 174.1 0 1 0 462 467.4l15.3 24.9h89.5v-84.7h-20.2zm-169.1-.1v-10h-10.1v9.9a89.59 89.59 0 0 1-84.2-84.7h10.1v-10.1h-10a89.55 89.55 0 0 1 84.1-84v10h10.1v-10a89.67 89.67 0 0 1 84.4 81.5v2.9h-10.2v10.1h10.2v2.8a89.6 89.6 0 0 1-84.4 81.6zM1446 162h174.7v62.9h-41.8l-107.1 263.6c-30.7 74-81.1 143.7-157.9 143.7-18.9 0-44-2.1-61.5-6.3l7.7-76.9a218.08 218.08 0 0 0 33.5 3.5c35.6 0 75.8-22.1 88.4-60.5l-108.6-267.1h-41.8V162h174.8v62.9h-41.7l61.5 151.3 61.5-151.3H1446z"/></svg> </a> </div> <div class="contributor"> <p>Tested with:</p> <a href="https://percy.io"> <svg viewBox="0 0 423 125" fill="none" xmlns="http://www.w3.org/2000/svg" class="contributor-logo"><path fill-rule="evenodd" clip-rule="evenodd" d="M400.648 112.355c-.232.748-.608 1.273-1.127 1.568l-.15.076c-.562.234-1.163.2-1.871.023-2.286-.574-12.884-1.789-8.645-14.407l2.514-7.485-.57-1.455-2.755-6.677-17.26-40.878c-.38-.848-.242-1.62.097-2.147.351-.549.971-.826 1.846-.842h9.821c.673 0 1.245.185 1.684.53.44.348.762.878 1.035 1.531l12.67 30.214 9.088-30.13c.195-.72.54-1.268 1.004-1.632.455-.355 1.037-.532 1.716-.532h10.487c.89 0 1.522.257 1.894.738.372.499.422 1.22.146 2.149l-14.103 45.12-5.44 17.506-2.081 6.73zM359.293 71.74h10.723c1.657 0 2.632 1.076 2.047 2.74-3.022 10.177-12.575 17.223-23.981 17.223-14.817 0-25.831-11.255-25.831-25.835s11.014-25.833 25.831-25.833c11.406 0 20.959 7.045 23.981 17.222.585 1.663-.39 2.74-2.047 2.74h-10.723c-1.268 0-2.145-.587-2.925-1.663-1.754-2.446-4.776-3.817-8.286-3.817-6.335 0-11.21 4.6-11.21 11.351 0 6.753 4.875 11.352 11.21 11.352 3.51 0 6.532-1.37 8.286-3.718.78-1.175 1.559-1.762 2.925-1.762zm-52.512-29.06v2.55c1.212-2.158 3.978-5.221 11.198-5.123.524.006.945.206 1.255.53.455.474.673 1.115.673 1.943v11.96c0 .812-.169 1.42-.522 1.826-.337.404-.842.608-1.497.608-1.431-.05-2.794.1-4.124.455a9.778 9.778 0 0 0-3.551 1.791c-1.043.845-1.881 1.98-2.49 3.362-.619 1.404-.933 3.108-.942 5.136l-.069 12.755c-.072 13.321-10.191 11.303-12.553 11.166-.806-.046-1.432-.219-1.868-.658-.438-.44-.657-1.065-.657-1.875V42.68c0-.81.219-1.436.657-1.875.437-.44 1.061-.658 1.868-.658h10.097c.807 0 1.431.219 1.868.658.438.44.657 1.064.657 1.875zm-43.748-2.622c3.564.017 6.835.666 9.816 1.951a23.428 23.428 0 0 1 7.758 5.398c2.185 2.326 3.886 5.04 5.085 8.161 1.198 3.122 1.814 6.536 1.83 10.243 0 .634-.016 1.252-.065 1.838a65.191 65.191 0 0 1-.129 1.772c-.097.78-.389 1.348-.842 1.707-.454.358-1.053.536-1.782.536h-32.457c.615 1.919 1.474 3.479 2.607 4.682a10.428 10.428 0 0 0 3.952 2.602c1.507.552 3.11.812 4.811.812 1.376-.016 2.704-.227 3.968-.665 1.247-.44 2.332-1.026 3.223-1.773.47-.39.94-.7 1.393-.927.47-.227 1.004-.341 1.619-.341l9.329-.097c.892.016 1.539.276 1.928.78.372.504.388 1.154.016 1.95-1.279 2.83-2.981 5.203-5.102 7.106-2.122 1.918-4.584 3.348-7.386 4.325-2.801.958-5.862 1.447-9.182 1.447-4.05-.018-7.694-.683-10.933-1.985-3.255-1.3-6.025-3.104-8.324-5.446-2.317-2.324-4.082-5.057-5.313-8.161-1.23-3.122-1.847-6.504-1.863-10.162.016-3.658.649-7.04 1.912-10.16 1.263-3.107 3.044-5.838 5.36-8.163 2.301-2.34 5.054-4.146 8.228-5.446 3.175-1.3 6.689-1.967 10.543-1.984zm-68.18 5.316a22.761 22.761 0 0 1 6.533-3.865 21.372 21.372 0 0 1 7.61-1.408c6.452 0 12.76 2.895 16.989 7.575 4.223 4.673 6.836 11.128 6.836 18.253s-2.613 13.579-6.836 18.252c-4.23 4.679-10.537 7.575-16.989 7.575-4.725 0-9.683-1.492-13.137-4.816l.01 15.843c.008 13.321-10.192 11.302-12.554 11.166-.803-.046-1.432-.221-1.868-.66-.436-.437-.656-1.066-.656-1.874l-.032-68.665c0-.826.224-1.477.674-1.928.449-.451 1.094-.677 1.92-.677h8.871c.827 0 1.472.226 1.92.677.45.45.665 1.095.675 1.928l.033 2.624zm25.217 20.418c0-6.283-5.041-11.377-11.26-11.377-6.22 0-11.26 5.094-11.26 11.377 0 6.285 5.04 11.379 11.26 11.379 6.219 0 11.26-5.094 11.26-11.379zm36.016-10.825c-1.83 1.268-3.126 3.138-3.887 5.577h20.811c-.518-1.838-1.295-3.317-2.333-4.422a9.086 9.086 0 0 0-3.562-2.374 11.773 11.773 0 0 0-4.178-.716c-2.738.017-5.038.651-6.85 1.935zM153.654 30.725a5.164 5.164 0 0 0-4.903-3.74 5.184 5.184 0 0 0-1.999.362 22.04 22.04 0 0 1-7.383 1.483c-6.346-4.758-21.736-16.252-30.872-22.71 0 0 1.23 3.765 2.897 10.788 0 0-14.478-8.459-24.102-14.931 0 0 3.508 7.442 3.768 9.837 0 0-11.542-2.188-28.406-6.126 0 0 12.47 7.214 15.497 11.48 0 0-15.13-1.284-32.951-2.61 0 0 8.963 4.708 13.31 8.46 0 0-16.213 2.082-28.542 2.466 0 0 9.013 7.263 12.64 10.768 0 0-15.487 5.773-34.041 16.062 0 0 9.67.646 16.611 2.98 0 0-8.546 7.246-23.882 23.932 0 0 9.664-.186 17.475-1.098 0 0-6.266 9.29-14.148 26.035 0 0 5.261-3.185 10.322-4.283 0 0 .21 18.955 10.641 22.173l.01-.012c.51.17.999.234 1.424.241a5.854 5.854 0 0 0 1.595-.204c3.343-.883 5.918-4.082 8.898-7.787h.001c.976-1.213 1.978-2.458 3.041-3.671a25.118 25.118 0 0 1 4.595-4.737c3.758-2.955 8.926-5.15 15.158-4.127 7.023.709 11.247 7.71 14.643 13.339 2.567 4.256 4.595 7.617 7.501 7.987.204.025.408.04.606.043 4.45.078 6.104-5.028 8.198-11.493v-.002l.428-1.32.054.109c1.557-5.232 4.498-10.85 8.064-15.903 4.844-6.865 11.038-12.967 16.931-15.749l.015.03c3.204-1.762 6.574-3.42 9.895-5.054l.003-.002c10.295-5.064 20.018-9.848 24.983-17.277 2.483-3.716 3.762-8.306 3.802-13.644.035-4.788-.947-9.22-1.777-12.095zM110.69 86.593c-2.961 2.678-5.868 6.012-8.437 9.652-4.237 6.006-7.395 12.617-8.389 18.136 2.79 4.723 5.332 7.065 7.742 7.146l.076.001c2.217.039 3.704-1.408 4.422-4.3.536-2.158.694-5.134.878-8.58v-.004c.333-6.28.766-14.373 3.708-22.051zm-68.51 27.086l-.032-.084a21.944 21.944 0 0 1 4.857-5.354c3.071-2.414 7.087-4.161 11.896-3.649a133.762 133.762 0 0 1-1.91 4.6c-2.371 5.407-5.193 10.988-8.14 11.396a3.457 3.457 0 0 1-.527.032c-2.302-.04-4.311-2.31-6.143-6.941zm59.08-88.187L88.55 17.127l21.058 7.834-8.348.53zm-35.4 3.097l20.265 5.502 8.926-2.757-29.19-2.745zm36.116 10.72l4.4-3.177-16.858 2.5 12.458.676zm-28.803-.503l-7.042 4.488-19.263-2.153 26.305-2.335zm21.54 11.899l7.13-3.782-26.304 2.336 19.174 1.446zM75.185 54.7l-5.062 7.91-24.738 5.525 29.8-13.435zm-30.864 4.385L25.105 67.05l23.7-16.185-4.484 8.221zm-10.605 9.767l-.897 8.287-11.187 13.38 12.084-21.667z" fill="#3F3A40"/></svg> </a> </div> <div class="contributor"> <p>Resolved with:</p> <a href="https://dnsimple.com/resolving/emberjs"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 613.33331 160" height="60" width="100" class="contributor-logo"><defs><clipPath id="a"><path d="M568.809 1050.45c-20.801 0-41.598-1.1-61.301-5.48V841.367c-28.461 10.946-61.301 16.418-105.086 16.418C246.98 857.785 120 751.605 120 580.84c0-175.145 116.031-271.477 286.801-271.477 84.285 0 170.765 22.989 224.402 51.45v684.157c-20.801 4.38-42.691 5.48-62.394 5.48zm-164.2-632.716c-94.14 0-158.722 63.493-158.722 165.293 0 100.707 68.961 165.293 160.914 165.293 37.215 0 71.152-4.379 100.707-22.988V434.156c-32.84-12.043-66.774-17.515-102.899-16.422zm611.911 442.243c-111.653 0-202.512-43.789-248.485-82.102v-452.09c20.797-4.379 41.598-5.472 61.301-5.472 20.797 0 42.691 1.093 62.394 5.472v391.887c24.083 14.23 66.774 28.461 114.94 28.461 79.91 0 125.88-36.125 125.88-131.36V325.785c21.9-4.379 41.6-5.472 62.4-5.472 19.7 0 41.6 1.093 62.39 5.472v318.543c0 119.317-73.34 215.649-240.82 215.649zm554.99-551.707c142.3 0 225.5 65.679 225.5 174.05 0 102.899-82.1 141.211-194.85 158.723-88.67 14.23-111.66 30.652-111.66 64.586 0 32.84 28.46 53.637 94.14 53.637 62.4 0 116.04-18.61 152.16-39.407 25.18 19.704 41.6 50.356 47.07 88.668-33.93 24.082-100.71 50.352-194.85 50.352-131.36 0-217.83-65.676-217.83-162.008 0-109.465 87.57-143.398 179.52-157.629 93.05-14.23 122.6-33.933 122.6-68.965 0-35.027-26.27-62.394-99.61-62.394-82.1 0-128.07 28.461-159.82 51.449-26.27-16.418-47.07-45.977-56.92-85.383 29.55-25.176 98.52-65.679 214.55-65.679zm398.45 614.101c42.69 0 78.82 35.027 78.82 78.809 0 43.79-36.13 78.82-78.82 78.82-44.88 0-81-35.03-81-78.82 0-43.782 36.12-78.809 81-78.809zm0-602.058c20.8 0 41.6 1.093 61.3 5.472v517.77c-19.7 4.379-41.59 5.472-61.3 5.472-20.8 0-41.59-1.093-62.39-5.472v-517.77c20.8-4.379 42.69-5.472 62.39-5.472zm791.43 539.664c-70.05 0-133.54-27.368-176.23-60.207-38.32 37.218-95.24 60.207-169.68 60.207-108.36 0-202.5-45.977-244.1-82.102v-452.09c20.8-4.379 41.6-5.472 61.3-5.472 20.8 0 42.69 1.093 62.39 5.472v391.887c27.37 16.418 65.68 28.461 106.18 28.461 84.29 0 116.04-53.641 116.04-128.074V325.785c20.8-4.379 41.6-5.472 63.49-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 16.422-2.19 32.84-5.47 48.168 25.17 20.797 60.2 42.692 110.55 42.692 84.29 0 117.13-53.641 117.13-128.074V325.785c19.71-4.379 40.51-5.472 62.4-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 112.75-76.63 204.704-226.6 204.704zm591.12-1.098c-98.52 0-180.62-38.313-230.97-79.91V123.273c21.89-4.378 41.59-5.472 62.39-5.472 20.8 0 41.6 1.094 61.3 5.472v201.418c32.84-10.949 67.87-15.328 111.66-15.328 144.49 0 274.75 101.805 274.75 276.95 0 179.523-120.41 272.566-279.13 272.566zm-4.38-438.953c-40.5 0-73.34 6.566-102.9 20.797v279.136c31.75 17.516 65.68 25.176 101.81 25.176 95.23 0 159.82-60.203 159.82-159.816 0-102.899-64.59-165.293-158.73-165.293zm458.66-99.613c20.8 0 42.69 1.093 62.39 5.472v718.095c-20.79 4.37-42.69 5.47-63.48 5.47-20.81 0-41.6-1.1-61.31-5.47V325.785c21.9-4.379 42.7-5.472 62.4-5.472zM4480 624.625c0 139.02-98.52 234.254-237.54 234.254-147.78 0-260.53-116.031-260.53-276.945 0-169.672 111.66-272.571 267.1-272.571 103.99 0 171.86 38.313 215.65 73.344-4.38 31.746-26.28 66.773-53.64 84.289-33.94-24.082-77.72-53.641-153.25-53.641-86.48 0-139.02 52.543-148.88 137.926h366.71c3.29 28.461 4.38 45.977 4.38 73.344zm-369.99 8.758c8.76 71.152 55.83 124.789 132.45 124.789 84.29-1.094 116.03-63.488 116.03-124.789z" clip-rule="evenodd"/></clipPath><clipPath id="b"><path d="M0 0h4600v1200H0z"/></clipPath></defs><g clip-path="url(#a)" transform="matrix(.13333 0 0 -.13333 0 160)"><g clip-path="url(#b)"><path d="M20 17.8h4560V1180H20z"/></g></g></svg> </a> </div> </div> </div> </div> </footer> <script type="x/boundary" id="fastboot-body-end"></script> <script src="/assets/vendor-43f2851966bb68f3f8b11728eabc662f.js"></script> <script src="/assets/ember-guides-282695ea5f03fe0586ac6b0c02eff6f2.js"></script> </body> </html>
{ "pile_set_name": "Github" }
Common subdirectories: green.old/debian and green.new/debian diff -u green.old/green.h green.new/green.h --- green.old/green.h 2016-06-12 18:11:56.779434416 -0700 +++ green.new/green.h 2016-06-12 18:14:38.830557379 -0700 @@ -19,7 +19,14 @@ #include <stdbool.h> -#include "glib/poppler.h" +#include "poppler.h" +#include "gdk-pixbuf/gdk-pixbuf.h" +#include "gdk-pixbuf/gdk-pixbuf-core.h" +#include "gdk-pixbuf/gdk-pixbuf-features.h" +#include "gdk-pixbuf/gdk-pixbuf-enum-types.h" + + #define GREEN_FULLSCREEN 0x0001 + #define GREEN_FULLSCREEN 0x0001 diff -u green.old/Makefile green.new/Makefile --- green.old/Makefile 2016-06-12 18:11:56.779434416 -0700 +++ green.new/Makefile 2016-06-12 18:13:09.591974048 -0700 @@ -17,6 +17,12 @@ SDL_CFLAGS := $$(sdl-config --cflags) SDL_LIBS := $$(sdl-config --libs) +GDKPIXBUF_CFLAGS := $$(pkg-config gdk-pixbuf-2.0 --cflags) +GDKPIXBUF_LIBS := $$(pkg-config gdk-pixbuf-2.0 --libs) + +GTK_CFLAGS := $$(pkg-config gtk+-2.0 --cflags) +GTK_LIBS := $$(pkg-config gtk+-2.0 --libs) + all: green @@ -28,13 +34,14 @@ $(INSTALL) green.1 $(MANDIR)/man1/ green: main.o green.o sdl.o - $(CC) $^ $(POPPLER_LIBS) $(SDL_LIBS) -o $@ + $(CC) $^ $(POPPLER_LIBS) $(SDL_LIBS) $(GDKPIXBUF_LIBS) $(GTK_LIBS) -o $@ main.o: main.c green.h - $(CC) $(CONFIG) $(CFLAGS) -c $< $(POPPLER_CFLAGS) -o $@ + $(CC) $(CONFIG) $(CFLAGS) $(GDKPIXBUF_CFLAGS) -c $< $(POPPLER_CFLAGS) -o $@ green.o: green.c green.h - $(CC) $(CFLAGS) -c $< $(POPPLER_CFLAGS) -o $@ + $(CC) $(CFLAGS) -c $< $(POPPLER_CFLAGS) $(GDKPIXBUF_CFLAGS) -o $@ sdl.o: sdl.c green.h - $(CC) $(CFLAGS) -c $< $(POPPLER_CFLAGS) $(SDL_CFLAGS) -o $@ + $(CC) $(CFLAGS) -c $< $(POPPLER_CFLAGS) $(SDL_CFLAGS) $(GDKPIXBUF_CFLAGS) $(GTK_CFLAGS) -o $@ +
{ "pile_set_name": "Github" }
#pragma once #include <vector> #include "absl/types/optional.h" #include "absl/types/span.h" #include "tensorflow/compiler/xla/client/xla_builder.h" #include "torch_xla/csrc/device.h" namespace torch_xla { xla::XlaOp PadToSize(xla::XlaOp input, absl::Span<const xla::int64> size, absl::optional<xla::XlaOp> pad_value = absl::nullopt); std::vector<xla::XlaOp> CreateKthValue(xla::XlaOp input, xla::int64 k, xla::int64 dim, bool keepdim); std::vector<xla::XlaOp> CreateTopK(xla::XlaOp input, xla::int64 k, xla::int64 dim, bool largest, bool sorted); xla::XlaOp CreateMatMul(xla::XlaOp lhs, xla::XlaOp rhs); xla::XlaOp BuildGer(xla::XlaOp lhs, xla::XlaOp rhs); xla::XlaOp BuildMatMul(xla::XlaOp lhs, xla::XlaOp rhs, xla::XlaOp bias); xla::XlaOp BuildMatMulWithMultiplier(xla::XlaOp lhs, xla::XlaOp rhs, xla::XlaOp bias, xla::XlaOp product_multiplier, xla::XlaOp bias_multiplier); xla::XlaOp BuildDot(xla::XlaOp lhs, xla::XlaOp rhs); xla::XlaOp BuildBernoulli(xla::XlaOp probability, xla::XlaOp seed, xla::PrimitiveType type); xla::XlaOp BuildExponential(xla::XlaOp lambda, xla::XlaOp seed, xla::PrimitiveType type); xla::XlaOp BuildDropout(xla::XlaOp input, float probability, xla::XlaOp seed); std::vector<xla::XlaOp> CreateBroadcastTensors( absl::Span<const xla::XlaOp> operands); // Similar to tf.gather_nd, used to implement advanced indexing. xla::XlaOp CreateIndex(xla::XlaOp input, xla::XlaOp indices, xla::int64 start_dim); // Similar to tf.scatter_nd, used to implement advanced indexing updates. xla::XlaOp CreateIndexUpdate( xla::XlaOp buffer, xla::XlaOp indices, xla::int64 start_dim, xla::XlaOp updates, const std::function<xla::XlaOp(xla::XlaOp, xla::XlaOp)>& combiner); xla::XlaOp CreateIndexAdd(xla::XlaOp buffer, xla::int64 dim, xla::XlaOp index, xla::XlaOp value); xla::XlaOp CreateIndexCopy(xla::XlaOp buffer, xla::int64 dim, xla::XlaOp index, xla::XlaOp value); xla::XlaOp CreateIndexFill(xla::XlaOp buffer, xla::int64 dim, xla::XlaOp index, xla::XlaOp values); using XlaOpCombiner = std::function<xla::XlaOp(xla::XlaOp, xla::XlaOp)>; XlaOpCombiner NumericAddCombiner(); struct ScatterOptions { explicit ScatterOptions(XlaOpCombiner combiner) : combiner(std::move(combiner)) {} XlaOpCombiner combiner; absl::optional<xla::XlaOp> init_value; bool indices_are_unique = true; }; xla::XlaOp CreateScatter(const Device& device, xla::XlaOp input, xla::XlaOp index, xla::XlaOp source, xla::int64 dim, const ScatterOptions& options); xla::XlaOp CreatePut(const Device& device, xla::XlaOp input, xla::XlaOp index, xla::XlaOp source, bool accumulate); std::vector<xla::XlaOp> BuildNonZero(xla::XlaOp input); std::vector<xla::XlaOp> BuildMaskedSelect(xla::XlaOp input, xla::XlaOp mask); xla::XlaOp BuildMaskedScatter(xla::XlaOp input, xla::XlaOp mask, xla::XlaOp source); } // namespace torch_xla
{ "pile_set_name": "Github" }
#!/bin/bash # 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. # Convenience script to download and install etcd in third_party. # Mostly just used by CI. set -o errexit set -o nounset set -o pipefail KUBE_ROOT=$(dirname "${BASH_SOURCE}")/.. source "${KUBE_ROOT}/hack/lib/init.sh" kube::etcd::install
{ "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. --> # Pulsar-client-go Changelog All notable changes to this project will be documented in this file. [0.2.0] 2020-08-28 ## Feature * Expose BatchingMaxSize from ProducerOptions, see [PR-280](https://github.com/apache/pulsar-client-go/pull/280). * Allow applications to configure the compression level, see [PR-290](https://github.com/apache/pulsar-client-go/pull/290). * Support producer name for Message, see [PR-299](https://github.com/apache/pulsar-client-go/pull/299). * Support oauth2 authentication for pulsar-client-go, see [PR-313](https://github.com/apache/pulsar-client-go/pull/313). * Add interceptor feature for Go client, see [PR-314](https://github.com/apache/pulsar-client-go/pull/314). * Export client metrics to Prometheus, see [PR-317](https://github.com/apache/pulsar-client-go/pull/317). * Add Name method to Consumer interface, see [PR-321](https://github.com/apache/pulsar-client-go/pull/321). * Add oauth2 to the provider, see [PR-338](https://github.com/apache/pulsar-client-go/pull/338). * Support specified the oauth2 private key with prefix `file://` and `data://`, see [PR-343](https://github.com/apache/pulsar-client-go/pull/343). * Fix the keyfile unmarshal error, see [PR-339](https://github.com/apache/pulsar-client-go/pull/339). * Add a new method to create auth provider from tls cert supplier, see [PR-347](https://github.com/apache/pulsar-client-go/pull/347). * Add seek logic for reader, see [PR-356](https://github.com/apache/pulsar-client-go/pull/356). ## Improve * Use .asf.yaml to configure github repo, see [PR-216](https://github.com/apache/pulsar-client-go/pull/216). * Auto update the client to handle changes in number of partitions, see [PR-221](https://github.com/apache/pulsar-client-go/pull/221). * Clean callbacks of connection after run loop stopped, see [PR-248](https://github.com/apache/pulsar-client-go/pull/248). * Fix unable to close consumer after unsubscribe in Shared Subscription, see [PR-283](https://github.com/apache/pulsar-client-go/pull/283). * Introduced lifecycle for compression providers, see [PR-284](https://github.com/apache/pulsar-client-go/pull/284). * Use maxPendingMessages for sizing producer eventsChan, see [PR-285](https://github.com/apache/pulsar-client-go/pull/285). * Avoid contention on producer mutex on critical path, see [PR-286](https://github.com/apache/pulsar-client-go/pull/286). * Switched to DataDog zstd wrapper, reusing the compression ctx, see [PR-287](https://github.com/apache/pulsar-client-go/pull/287). * Fix panic when creating consumer with ReceiverQueueSize set to -1, see [PR-289](https://github.com/apache/pulsar-client-go/pull/289). * Used pooled buffering for compression and batch serialization, see [PR-292](https://github.com/apache/pulsar-client-go/pull/292). * Use gogofast to have in-place protobuf serialization, see [PR-294](https://github.com/apache/pulsar-client-go/pull/294). * Added semaphore implementation with lower contention, see [PR-298](https://github.com/apache/pulsar-client-go/pull/298). * Fixed pooled buffer lifecycle, see [PR-300](https://github.com/apache/pulsar-client-go/pull/300). * Removed blocking queue iterator, see [PR-301](https://github.com/apache/pulsar-client-go/pull/301). * Fix panic in CreateReader API using custom MessageID for ReaderOptions, see [PR-305](https://github.com/apache/pulsar-client-go/pull/305). * Change connection failed warn log to error and print error message, see [PR-309](https://github.com/apache/pulsar-client-go/pull/309). * Share buffer pool across all partitions, see [PR-310](https://github.com/apache/pulsar-client-go/pull/310). * Add rerun feature test command to repo, see [PR-311](https://github.com/apache/pulsar-client-go/pull/311). * Fix CompressMaxSize() for ZLib provider, see [PR-312](https://github.com/apache/pulsar-client-go/pull/312). * Reduce the size of the MessageID structs by one word on 64-bit arch, see [PR-316](https://github.com/apache/pulsar-client-go/pull/316). * Do not allocate MessageIDs on the heap, see [PR-319](https://github.com/apache/pulsar-client-go/pull/319). * Different MessageID implementations for message Production and Consumption, see [PR-324](https://github.com/apache/pulsar-client-go/pull/324). * Fix producer block when the producer with the same id, see [PR-326](https://github.com/apache/pulsar-client-go/pull/326). * Get the last message when LatestMessageID and inclusive, see [PR-329](https://github.com/apache/pulsar-client-go/pull/329). * Fix go.mod issue with invalid version, see [PR-330](https://github.com/apache/pulsar-client-go/pull/330). * Fix producer goroutine leak, see [PR-331](https://github.com/apache/pulsar-client-go/pull/331). * Fix producer state by reconnecting when receiving unexpected receipts, see [PR-336](https://github.com/apache/pulsar-client-go/pull/336). * Avoid producer deadlock on connection closing, see [PR-337](https://github.com/apache/pulsar-client-go/pull/337). ## Contributors Our thanks go to the following contributors from the community for helping this release: - [LvBay](https://github.com/LvBay) - [cgfork](https://github.com/cgfork) - [jaysun91](https://github.com/jaysun91) - [liangyuanpeng](https://github.com/liangyuanpeng) - [nitishv](https://github.com/nitishv) - [quintans](https://github.com/quintans) - [snowcrumble](https://github.com/snowcrumble) - [shohi](https://github.com/shohi) - [simonswine](https://github.com/simonswine) - [dferstay](https://github.com/dferstay) - [zymap](https://github.com/zymap) [0.1.1] 2020-06-19 ## Improve - [Fixed batching flag logic](https://github.com/apache/pulsar-client-go/pull/209) - [Fix data race when accessing partition producer state](https://github.com/apache/pulsar-client-go/pull/215) - [Fixed tls connection issue](https://github.com/apache/pulsar-client-go/pull/220) - [Add flag to disable forced topic creation](https://github.com/apache/pulsar-client-go/pull/226) - [Add Athenz authentication provider](https://github.com/apache/pulsar-client-go/pull/227) - [Fixed race condition in producer Flush() operation](https://github.com/apache/pulsar-client-go/pull/229) - [Removed unnecessary flush in sync Send() operation](https://github.com/apache/pulsar-client-go/pull/230) - [Allow empty payload for nonbatch message](https://github.com/apache/pulsar-client-go/pull/236) - [Add internal connectionReader readAtLeast error information](https://github.com/apache/pulsar-client-go/pull/237) - [Fix zstd memory leak of zstdProvider ](https://github.com/apache/pulsar-client-go/pull/245) - [Expose replicated from filed on message struct](https://github.com/apache/pulsar-client-go/pull/251) - [Fix send async comments](https://github.com/apache/pulsar-client-go/pull/254) - [Fix perf-produce cannot be closed](https://github.com/apache/pulsar-client-go/pull/255) - [Fix perf-producer target](https://github.com/apache/pulsar-client-go/pull/256) - [Fix fail to add batchbuilder](https://github.com/apache/pulsar-client-go/pull/260) - [skip debug print out when batch disabled with no messages](https://github.com/apache/pulsar-client-go/pull/261) - [Add check for max message size](https://github.com/apache/pulsar-client-go/pull/263) - [Build and test with multiple versions of Go](https://github.com/apache/pulsar-client-go/pull/269) - [When CGO is enabled, use C version of ZStd](https://github.com/apache/pulsar-client-go/pull/270) - [Stop partition discovery on Close](https://github.com/apache/pulsar-client-go/pull/272) - [Microbenchmark for compression](https://github.com/apache/pulsar-client-go/pull/275) - [Allow to have multiple connections per broker](https://github.com/apache/pulsar-client-go/pull/276) - [Increase writeRequestsCh channel buffer size](https://github.com/apache/pulsar-client-go/pull/277) ### Contributors Our thanks go to the following contributors from the community for helping this release: - [yarthur1](https://github.com/yarthur1) - [vergnes](https://github.com/vergnes) - [sijie](https://github.com/sijie) - [shustsud](https://github.com/shustsud) - [rueian](https://github.com/rueian) - [mileschao](https://github.com/mileschao) - [keithnull](https://github.com/keithnull) - [abatilo](https://github.com/abatilo) - [cornelk](https://github.com/cornelk) - [equanz](https://github.com/equanz) - [jerrypeng](https://github.com/jerrypeng) - [jonyhy96](https://github.com/jonyhy96) [0.1.0] 2020-03-24 ## New Feature ### Client - Support `TLS` logic - Support `Authentication` logic - Support `Proxy` logic - Support `Hostname verification` logic ### Producer - Add `Send()` method in `Producer` interface - Add `SendAsync()` method in `Producer` interface - Add `LastSequenceID()` method in `Producer` interface - Add `Flush()` method in `Producer` interface - Add `Close()` method in `Producer` interface - Add `Topic()` method in `Producer` interface - Add `Name()` method in `Producer` interface - Support `MessageRouter` logic - Support `batch` logic - Support `compression message` logic - Support `HashingScheme` logic - Support `User defined properties producer` logic ### Consumer - Add `Subscription()` method in `Consumer` interface - Add `Unsubscribe()` method in `Consumer` interface - Add `Receive()` method in `Consumer` interface - Add `Ack()` method in `Consumer` interface - Add `AckID()` method in `Consumer` interface - Add `Nack()` method in `Consumer` interface - Add `NackID()` method in `Consumer` interface - Add `Seek()` method in `Consumer` interface - Add `SeekByTime()` method in `Consumer` interface - Add `Close()` method in `Consumer` interface - Support `Dead Letter Queue` consumer policy - Support `Topics Pattern` and `Topics` logic - Support `topic consumer regx` logic - Support `multi topics consumer` logic - Support `Exclusive`, `Failover`, `Shared` and `KeyShared` subscribe type logic - Support `Latest` and `Earliest` logic - Support `ReadCompacted` logic - Support `ReplicateSubscriptionState` logic - Support `User defined properties consumer` logic - Support `Delayed Delivery Messages` logic ### Reader - Add `Topic()` method in `Reader` interface - Add `Next()` method in `Reader` interface - Add `HasNext()` method in `Reader` interface - Add `Close()` method in `Reader` interface - Support `read compacted` logic - Support `start messageID` logic - Support `User defined properties reader` logic ### Contributors Our thanks go to the following contributors from the community for helping this release: - [merlimat](https://github.com/merlimat) - [wolfstudy](https://github.com/wolfstudy) - [cckellogg](https://github.com/cckellogg) - [xujianhai666](https://github.com/xujianhai666) - [reugn](https://github.com/reugn) - [freeznet](https://github.com/freeznet) - [zzzming](https://github.com/zzzming) - [wty4427300](https://github.com/wty4427300) - [stevenwangnarvar](https://github.com/stevenwangnarvar) - [dsmlily](https://github.com/dsmlily) - [banishee](https://github.com/banishee) - [archfish](https://github.com/archfish) - [Morsicus](https://github.com/Morsicus)
{ "pile_set_name": "Github" }
<?php namespace Aws\Test; use Aws\Api\ErrorParser\JsonRpcErrorParser; use Aws\Api\ErrorParser\RestJsonErrorParser; use Aws\Api\ErrorParser\XmlErrorParser; use Aws\Api\Service; use Aws\AwsClient; use Aws\Command; use Aws\CommandInterface; use Aws\Exception\AwsException; use Aws\Result; use Aws\WrappedHttpHandler; use GuzzleHttp\Promise\RejectedPromise; use Psr\Http\Message\RequestInterface; use GuzzleHttp\Psr7\Request; use GuzzleHttp\Psr7\Response; use Psr\Http\Message\ResponseInterface; use PHPUnit\Framework\TestCase; /** * @covers Aws\WrappedHttpHandler */ class WrappedHttpHandlerTest extends TestCase { use TestServiceTrait; public function testParsesResponses() { $called = false; $cmd = new Command('foo'); $req = new Request('GET', 'http://foo.com'); $res = new Response(200, ['Foo' => 'Bar']); $result = new Result(); $handler = function (RequestInterface $request, array $options) use (&$called, $res, $req) { $this->assertSame($request, $req); $called = true; return $res; }; $parser = function (CommandInterface $command, ResponseInterface $response) use ($res, $cmd, $result) { $this->assertSame($res, $response); $this->assertSame($cmd, $command); return $result; }; $errorParser = [$this, 'fail']; $wrapped = new WrappedHttpHandler($handler, $parser, $errorParser); $promise = $wrapped($cmd, $req); $this->assertTrue($called); $this->assertInstanceOf('GuzzleHttp\Promise\PromiseInterface', $promise); $this->assertSame($result, $promise->wait()); $this->assertEquals([ 'statusCode' => 200, 'effectiveUri' => (string) $req->getUri(), 'headers' => ['foo' => 'Bar'], 'transferStats' => [], ], $result['@metadata']); } /** * @expectedException \RuntimeException * @expectedExceptionMessage The HTTP handler was rejected without an "exception" key value pair. */ public function testEnsuresErrorHasExceptionKey() { $cmd = new Command('foo'); $req = new Request('GET', 'http://foo.com'); $handler = function () { return new RejectedPromise([]); }; $parser = $errorParser = [$this, 'fail']; $wrapped = new WrappedHttpHandler($handler, $parser, $errorParser); $wrapped($cmd, $req)->wait(); } public function testCanRejectWithoutResponse() { $e = new \Exception('a'); $cmd = new Command('foo'); $req = new Request('GET', 'http://foo.com'); $handler = function () use ($e) { return new RejectedPromise(['exception' => $e]); }; $parser = $errorParser = [$this, 'fail']; $wrapped = new WrappedHttpHandler($handler, $parser, $errorParser); try { $wrapped($cmd, $req)->wait(); $this->fail(); } catch (AwsException $e) { $this->assertSame($req, $e->getRequest()); $this->assertSame($cmd, $e->getCommand()); $this->assertNull($e->getResponse()); $this->assertNull($e->getResult()); } } /** * @dataProvider responseAndParserProvider * * @param Response $res * @param $errorParser * @param $expectedCode * @param $expectedId * @param $expectedArray */ public function testCanRejectWithAndParseResponse( Response $res, Service $service, $errorParser, $expectedCode, $expectedId, $expectedArray ) { $client = $this->generateTestClient($service, []); $cmd = $client->getCommand('TestOperation', []); $e = new \Exception('a'); $req = new Request('GET', 'http://foo.com'); $handler = function () use ($e, $req, $res) { return new RejectedPromise(['exception' => $e, 'response' => $res]); }; $parser = [$this, 'fail']; $wrapped = new WrappedHttpHandler($handler, $parser, $errorParser); try { $wrapped($cmd, $req)->wait(); $this->fail(); } catch (AwsException $e) { $this->assertSame($cmd, $e->getCommand()); $this->assertSame($res, $e->getResponse()); $this->assertSame($req, $e->getRequest()); $this->assertNull($e->getResult()); $this->assertEquals($expectedCode, $e->getAwsErrorCode()); $this->assertEquals($expectedId, $e->getAwsRequestId()); $this->assertEquals($expectedArray, $e->toArray()); } } public function responseAndParserProvider() { $services = [ 'ec2' => $this->generateTestService('ec2'), 'json' => $this->generateTestService('json'), 'query' => $this->generateTestService('query'), 'rest-json' => $this->generateTestService('rest-json'), 'rest-xml' => $this->generateTestService('rest-xml'), ]; return [ [ new Response( 400, ['X-Amzn-RequestId' => '123'], json_encode(['__type' => 'foo#bar']) ), $services['json'], new JsonRpcErrorParser($services['json']), 'bar', '123', [], ], [ new Response( 400, [ 'X-Amzn-RequestId' => '123', ], json_encode(['message' => 'sorry!']) ), $services['rest-json'], new RestJsonErrorParser($services['rest-json']), null, '123', [], ], [ new Response( 400, [], '<?xml version="1.0" encoding="UTF-8"?><Error><Code>InternalError</Code><RequestId>656c76696e6727732072657175657374</RequestId></Error>' ), $services['rest-xml'], new XmlErrorParser($services['rest-xml']), 'InternalError', '656c76696e6727732072657175657374', [], ], [ new Response( 400, ['X-Amzn-RequestId' => '123'], openssl_random_pseudo_bytes(1024) ), $services['query'], new XmlErrorParser($services['query']), null, null, [], ], // Rest-json with modeled exception from header error type [ new Response( 400, [ 'X-Amzn-RequestId' => '123', 'X-Amzn-ErrorType' => 'TestException' ], json_encode([ 'TestString' => 'foo-string', 'TestInt' => 456, 'NotModeled' => 'bar' ]) ), $services['rest-json'], new RestJsonErrorParser($services['rest-json']), 'TestException', '123', [ 'TestString' => 'foo-string', 'TestInt' => 456, 'TestHeaderMember' => '', 'TestHeaders' => [], 'TestStatus' => 400 ], ], // Rest-json with modeled exception from body error code [ new Response( 400, [ 'X-Amzn-RequestId' => '123' ], json_encode([ 'TestString' => 'foo-string', 'TestInt' => 456, 'NotModeled' => 'bar', 'code' => 'TestException' ]) ), $services['rest-json'], new RestJsonErrorParser($services['rest-json']), 'TestException', '123', [ 'TestString' => 'foo-string', 'TestInt' => 456, 'TestHeaderMember' => '', 'TestHeaders' => [], 'TestStatus' => 400 ], ], // Ec2 with modeled exception [ new Response( 400, [], '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<Response>' . ' <Errors>' . ' <Error>' . ' <Code>TestException</Code>' . ' <Message>Error Message</Message>' . ' <TestString>SomeString</TestString>' . ' <TestInt>456</TestInt>' . ' </Error>' . ' </Errors>' . ' <RequestId>xyz</RequestId>' . '</Response>' ), $services['ec2'], new XmlErrorParser($services['ec2']), 'TestException', 'xyz', [ 'TestString' => 'SomeString', 'TestInt' => 456, 'TestHeaderMember' => '', 'TestHeaders' => [], 'TestStatus' => 400, ], ], // Query with modeled exception [ new Response( 400, [], '<ErrorResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">' . ' <Error>' . ' <Type>ErrorType</Type>' . ' <Code>TestException</Code>' . ' <Message>Error Message</Message>' . ' <TestString>SomeString</TestString>' . ' <TestInt>456</TestInt>' . ' </Error>' . ' <RequestId>xyz</RequestId>' . '</ErrorResponse>' ), $services['query'], new XmlErrorParser($services['query']), 'TestException', 'xyz', [ 'TestString' => 'SomeString', 'TestInt' => 456, 'TestHeaderMember' => '', 'TestHeaders' => [], 'TestStatus' => 400, ], ], // Rest-xml with modeled exception [ new Response( 400, [], '<ErrorResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">' . ' <Error>' . ' <Type>ErrorType</Type>' . ' <Code>TestException</Code>' . ' <Message>Error Message</Message>' . ' <TestString>SomeString</TestString>' . ' <TestInt>456</TestInt>' . ' </Error>' . ' <RequestId>xyz</RequestId>' . '</ErrorResponse>' ), $services['rest-xml'], new XmlErrorParser($services['rest-xml']), 'TestException', 'xyz', [ 'TestString' => 'SomeString', 'TestInt' => 456, 'TestHeaderMember' => '', 'TestHeaders' => [], 'TestStatus' => 400, ], ], ]; } public function testCanRejectWithException() { $e = new \Exception('a'); $cmd = new Command('foo'); $req = new Request('GET', 'http://foo.com'); $handler = function () use ($e) { throw $e; }; $parser = [$this, 'fail']; $errorParser = [$this, 'fail']; $wrapped = new WrappedHttpHandler($handler, $parser, $errorParser); try { $wrapped($cmd, $req)->wait(); $this->fail(); } catch (\Exception $e2) { $this->assertSame($e, $e2); } } public function testDoesNotPassOnTransferStatsCallbackToHandlerByDefault() { $handler = function ($request, array $options) { $this->assertArrayNotHasKey('http_stats_receiver', $options); return new Response; }; $parser = function () { return new Result; }; $wrapped = new WrappedHttpHandler($handler, $parser, [$this, 'fail']); $wrapped(new Command('a'), new Request('GET', 'http://foo.com')) ->wait(); } public function testPassesOnTransferStatsCallbackToHandlerWhenRequested() { $handler = function ($request, array $options) { $this->assertArrayHasKey('http_stats_receiver', $options); $this->assertInternalType('callable', $options['http_stats_receiver']); return new Response; }; $parser = function () { return new Result; }; $wrapped = new WrappedHttpHandler( $handler, $parser, [$this, 'fail'], AwsException::class, $collectStats = true ); $wrapped(new Command('a'), new Request('GET', 'http://foo.com')) ->wait(); } }
{ "pile_set_name": "Github" }
// +build amd64,linux // Created by cgo -godefs - DO NOT EDIT // cgo -godefs types_linux.go package unix const ( sizeofPtr = 0x8 sizeofShort = 0x2 sizeofInt = 0x4 sizeofLong = 0x8 sizeofLongLong = 0x8 PathMax = 0x1000 ) type ( _C_short int16 _C_int int32 _C_long int64 _C_long_long int64 ) type Timespec struct { Sec int64 Nsec int64 } type Timeval struct { Sec int64 Usec int64 } type Timex struct { Modes uint32 Pad_cgo_0 [4]byte Offset int64 Freq int64 Maxerror int64 Esterror int64 Status int32 Pad_cgo_1 [4]byte Constant int64 Precision int64 Tolerance int64 Time Timeval Tick int64 Ppsfreq int64 Jitter int64 Shift int32 Pad_cgo_2 [4]byte Stabil int64 Jitcnt int64 Calcnt int64 Errcnt int64 Stbcnt int64 Tai int32 Pad_cgo_3 [44]byte } type Time_t int64 type Tms struct { Utime int64 Stime int64 Cutime int64 Cstime int64 } type Utimbuf struct { Actime int64 Modtime int64 } type Rusage struct { Utime Timeval Stime Timeval Maxrss int64 Ixrss int64 Idrss int64 Isrss int64 Minflt int64 Majflt int64 Nswap int64 Inblock int64 Oublock int64 Msgsnd int64 Msgrcv int64 Nsignals int64 Nvcsw int64 Nivcsw int64 } type Rlimit struct { Cur uint64 Max uint64 } type _Gid_t uint32 type Stat_t struct { Dev uint64 Ino uint64 Nlink uint64 Mode uint32 Uid uint32 Gid uint32 X__pad0 int32 Rdev uint64 Size int64 Blksize int64 Blocks int64 Atim Timespec Mtim Timespec Ctim Timespec X__unused [3]int64 } type Statfs_t struct { Type int64 Bsize int64 Blocks uint64 Bfree uint64 Bavail uint64 Files uint64 Ffree uint64 Fsid Fsid Namelen int64 Frsize int64 Flags int64 Spare [4]int64 } type Dirent struct { Ino uint64 Off int64 Reclen uint16 Type uint8 Name [256]int8 Pad_cgo_0 [5]byte } type Fsid struct { X__val [2]int32 } type Flock_t struct { Type int16 Whence int16 Pad_cgo_0 [4]byte Start int64 Len int64 Pid int32 Pad_cgo_1 [4]byte } type RawSockaddrInet4 struct { Family uint16 Port uint16 Addr [4]byte /* in_addr */ Zero [8]uint8 } type RawSockaddrInet6 struct { Family uint16 Port uint16 Flowinfo uint32 Addr [16]byte /* in6_addr */ Scope_id uint32 } type RawSockaddrUnix struct { Family uint16 Path [108]int8 } type RawSockaddrLinklayer struct { Family uint16 Protocol uint16 Ifindex int32 Hatype uint16 Pkttype uint8 Halen uint8 Addr [8]uint8 } type RawSockaddrNetlink struct { Family uint16 Pad uint16 Pid uint32 Groups uint32 } type RawSockaddr struct { Family uint16 Data [14]int8 } type RawSockaddrAny struct { Addr RawSockaddr Pad [96]int8 } type _Socklen uint32 type Linger struct { Onoff int32 Linger int32 } type Iovec struct { Base *byte Len uint64 } type IPMreq struct { Multiaddr [4]byte /* in_addr */ Interface [4]byte /* in_addr */ } type IPMreqn struct { Multiaddr [4]byte /* in_addr */ Address [4]byte /* in_addr */ Ifindex int32 } type IPv6Mreq struct { Multiaddr [16]byte /* in6_addr */ Interface uint32 } type Msghdr struct { Name *byte Namelen uint32 Pad_cgo_0 [4]byte Iov *Iovec Iovlen uint64 Control *byte Controllen uint64 Flags int32 Pad_cgo_1 [4]byte } type Cmsghdr struct { Len uint64 Level int32 Type int32 X__cmsg_data [0]uint8 } type Inet4Pktinfo struct { Ifindex int32 Spec_dst [4]byte /* in_addr */ Addr [4]byte /* in_addr */ } type Inet6Pktinfo struct { Addr [16]byte /* in6_addr */ Ifindex uint32 } type IPv6MTUInfo struct { Addr RawSockaddrInet6 Mtu uint32 } type ICMPv6Filter struct { Data [8]uint32 } type Ucred struct { Pid int32 Uid uint32 Gid uint32 } type TCPInfo struct { State uint8 Ca_state uint8 Retransmits uint8 Probes uint8 Backoff uint8 Options uint8 Pad_cgo_0 [2]byte Rto uint32 Ato uint32 Snd_mss uint32 Rcv_mss uint32 Unacked uint32 Sacked uint32 Lost uint32 Retrans uint32 Fackets uint32 Last_data_sent uint32 Last_ack_sent uint32 Last_data_recv uint32 Last_ack_recv uint32 Pmtu uint32 Rcv_ssthresh uint32 Rtt uint32 Rttvar uint32 Snd_ssthresh uint32 Snd_cwnd uint32 Advmss uint32 Reordering uint32 Rcv_rtt uint32 Rcv_space uint32 Total_retrans uint32 } const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c SizeofSockaddrAny = 0x70 SizeofSockaddrUnix = 0x6e SizeofSockaddrLinklayer = 0x14 SizeofSockaddrNetlink = 0xc SizeofLinger = 0x8 SizeofIPMreq = 0x8 SizeofIPMreqn = 0xc SizeofIPv6Mreq = 0x14 SizeofMsghdr = 0x38 SizeofCmsghdr = 0x10 SizeofInet4Pktinfo = 0xc SizeofInet6Pktinfo = 0x14 SizeofIPv6MTUInfo = 0x20 SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 ) const ( IFA_UNSPEC = 0x0 IFA_ADDRESS = 0x1 IFA_LOCAL = 0x2 IFA_LABEL = 0x3 IFA_BROADCAST = 0x4 IFA_ANYCAST = 0x5 IFA_CACHEINFO = 0x6 IFA_MULTICAST = 0x7 IFLA_UNSPEC = 0x0 IFLA_ADDRESS = 0x1 IFLA_BROADCAST = 0x2 IFLA_IFNAME = 0x3 IFLA_MTU = 0x4 IFLA_LINK = 0x5 IFLA_QDISC = 0x6 IFLA_STATS = 0x7 IFLA_COST = 0x8 IFLA_PRIORITY = 0x9 IFLA_MASTER = 0xa IFLA_WIRELESS = 0xb IFLA_PROTINFO = 0xc IFLA_TXQLEN = 0xd IFLA_MAP = 0xe IFLA_WEIGHT = 0xf IFLA_OPERSTATE = 0x10 IFLA_LINKMODE = 0x11 IFLA_LINKINFO = 0x12 IFLA_NET_NS_PID = 0x13 IFLA_IFALIAS = 0x14 IFLA_MAX = 0x1d RT_SCOPE_UNIVERSE = 0x0 RT_SCOPE_SITE = 0xc8 RT_SCOPE_LINK = 0xfd RT_SCOPE_HOST = 0xfe RT_SCOPE_NOWHERE = 0xff RT_TABLE_UNSPEC = 0x0 RT_TABLE_COMPAT = 0xfc RT_TABLE_DEFAULT = 0xfd RT_TABLE_MAIN = 0xfe RT_TABLE_LOCAL = 0xff RT_TABLE_MAX = 0xffffffff RTA_UNSPEC = 0x0 RTA_DST = 0x1 RTA_SRC = 0x2 RTA_IIF = 0x3 RTA_OIF = 0x4 RTA_GATEWAY = 0x5 RTA_PRIORITY = 0x6 RTA_PREFSRC = 0x7 RTA_METRICS = 0x8 RTA_MULTIPATH = 0x9 RTA_FLOW = 0xb RTA_CACHEINFO = 0xc RTA_TABLE = 0xf RTN_UNSPEC = 0x0 RTN_UNICAST = 0x1 RTN_LOCAL = 0x2 RTN_BROADCAST = 0x3 RTN_ANYCAST = 0x4 RTN_MULTICAST = 0x5 RTN_BLACKHOLE = 0x6 RTN_UNREACHABLE = 0x7 RTN_PROHIBIT = 0x8 RTN_THROW = 0x9 RTN_NAT = 0xa RTN_XRESOLVE = 0xb RTNLGRP_NONE = 0x0 RTNLGRP_LINK = 0x1 RTNLGRP_NOTIFY = 0x2 RTNLGRP_NEIGH = 0x3 RTNLGRP_TC = 0x4 RTNLGRP_IPV4_IFADDR = 0x5 RTNLGRP_IPV4_MROUTE = 0x6 RTNLGRP_IPV4_ROUTE = 0x7 RTNLGRP_IPV4_RULE = 0x8 RTNLGRP_IPV6_IFADDR = 0x9 RTNLGRP_IPV6_MROUTE = 0xa RTNLGRP_IPV6_ROUTE = 0xb RTNLGRP_IPV6_IFINFO = 0xc RTNLGRP_IPV6_PREFIX = 0x12 RTNLGRP_IPV6_RULE = 0x13 RTNLGRP_ND_USEROPT = 0x14 SizeofNlMsghdr = 0x10 SizeofNlMsgerr = 0x14 SizeofRtGenmsg = 0x1 SizeofNlAttr = 0x4 SizeofRtAttr = 0x4 SizeofIfInfomsg = 0x10 SizeofIfAddrmsg = 0x8 SizeofRtMsg = 0xc SizeofRtNexthop = 0x8 ) type NlMsghdr struct { Len uint32 Type uint16 Flags uint16 Seq uint32 Pid uint32 } type NlMsgerr struct { Error int32 Msg NlMsghdr } type RtGenmsg struct { Family uint8 } type NlAttr struct { Len uint16 Type uint16 } type RtAttr struct { Len uint16 Type uint16 } type IfInfomsg struct { Family uint8 X__ifi_pad uint8 Type uint16 Index int32 Flags uint32 Change uint32 } type IfAddrmsg struct { Family uint8 Prefixlen uint8 Flags uint8 Scope uint8 Index uint32 } type RtMsg struct { Family uint8 Dst_len uint8 Src_len uint8 Tos uint8 Table uint8 Protocol uint8 Scope uint8 Type uint8 Flags uint32 } type RtNexthop struct { Len uint16 Flags uint8 Hops uint8 Ifindex int32 } const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 ) type SockFilter struct { Code uint16 Jt uint8 Jf uint8 K uint32 } type SockFprog struct { Len uint16 Pad_cgo_0 [6]byte Filter *SockFilter } type InotifyEvent struct { Wd int32 Mask uint32 Cookie uint32 Len uint32 Name [0]int8 } const SizeofInotifyEvent = 0x10 type PtraceRegs struct { R15 uint64 R14 uint64 R13 uint64 R12 uint64 Rbp uint64 Rbx uint64 R11 uint64 R10 uint64 R9 uint64 R8 uint64 Rax uint64 Rcx uint64 Rdx uint64 Rsi uint64 Rdi uint64 Orig_rax uint64 Rip uint64 Cs uint64 Eflags uint64 Rsp uint64 Ss uint64 Fs_base uint64 Gs_base uint64 Ds uint64 Es uint64 Fs uint64 Gs uint64 } type FdSet struct { Bits [16]int64 } type Sysinfo_t struct { Uptime int64 Loads [3]uint64 Totalram uint64 Freeram uint64 Sharedram uint64 Bufferram uint64 Totalswap uint64 Freeswap uint64 Procs uint16 Pad uint16 Pad_cgo_0 [4]byte Totalhigh uint64 Freehigh uint64 Unit uint32 X_f [0]int8 Pad_cgo_1 [4]byte } type Utsname struct { Sysname [65]int8 Nodename [65]int8 Release [65]int8 Version [65]int8 Machine [65]int8 Domainname [65]int8 } type Ustat_t struct { Tfree int32 Pad_cgo_0 [4]byte Tinode uint64 Fname [6]int8 Fpack [6]int8 Pad_cgo_1 [4]byte } type EpollEvent struct { Events uint32 Fd int32 Pad int32 } const ( AT_FDCWD = -0x64 AT_SYMLINK_NOFOLLOW = 0x100 AT_REMOVEDIR = 0x200 ) type Termios struct { Iflag uint32 Oflag uint32 Cflag uint32 Lflag uint32 Line uint8 Cc [19]uint8 Ispeed uint32 Ospeed uint32 }
{ "pile_set_name": "Github" }
--- title: useSelections nav: title: Hooks path: /hooks group: title: UI path: /ui legacy: /zh-CN/ui/use-selections --- # useSelections 常见联动 checkbox 逻辑封装,支持多选,单选,全选逻辑,还提供了是否选择,是否全选,是否半选的状态。 ## 代码演示 ### 基础用法 <code src="./demo/demo1.tsx" /> ## API ```javascript const result: Result= useSelections<T>(items: T[], defaultSelected?: T[]); ``` ### Result | 参数 | 说明 | 类型 | |-------------------|--------------------|-----------------------| | selected | 已经选择的元素 | array | | isSelected | 是否被选择 | (value: T) => boolean | | select | 选择元素 | (value: T) => void | | unSelect | 取消选择元素 | (value: T) => void | | toggle | 反选元素 | (value: T) => void | | selectAll | 选择全部元素 | () => void | | unSelectAll | 取消选择全部元素 | (value: T) => void | | toggleAll | 反选全部元素 | (value: T) => void | | allSelected | 是否全选 | boolean | | noneSelected | 是否一个都没有选择 | boolean | | partiallySelected | 是否半选 | boolean | | setSelected | 设置选择的元素 | (value:T[]) => void |
{ "pile_set_name": "Github" }
/** * AcFun Format Parser * Takes in JSON and parses it based on current documentation for AcFun comments * @license MIT License **/ var AcfunFormat = (function () { var AcfunFormat = {}; AcfunFormat.JSONParser = function (params) { this._logBadComments = true; this._logNotImplemented = false; if (typeof params === 'object') { this._logBadComments = params.logBadComments === false ? false : true; this._logNotImplemented = params.logNotImplemented === true ? true : false; } }; AcfunFormat.JSONParser.prototype.parseOne = function (comment) { // Read a comment and generate a correct comment object var data = {}; if (typeof comment !== 'object' || comment == null || !comment.hasOwnProperty('c')) { // This cannot be parsed. The comment contains no config data return null; } var config = comment['c'].split(','); if (config.length >= 6) { data.stime = parseFloat(config[0]) * 1000; data.color = parseInt(config[1]) data.mode = parseInt(config[2]); data.size = parseInt(config[3]); data.hash = config[4]; data.date = parseInt(config[5]); data.position = "absolute"; if (data.mode !== 7) { // Do some text normalization on low complexity comments data.text = comment.m.replace(/(\/n|\\n|\n|\r\n|\\r)/g,"\n"); data.text = data.text.replace(/\r/g,"\n"); data.text = data.text.replace(/\s/g,"\u00a0"); } else { try { var x = JSON.parse(comment.m); } catch (e) { if (this._logBadComments) { console.warn('Error parsing internal data for comment'); console.log('[Dbg] ' + data.text); } return null; // Can't actually parse this! } data.position = "relative"; data.text = x.n; /*.replace(/\r/g,"\n");*/ data.text = data.text.replace(/\ /g,"\u00a0"); if (typeof x.a === 'number') { data.opacity = x.a; } else { data.opacity = 1; } if (typeof x.p === 'object') { // Relative position data.x = x.p.x / 1000; data.y = x.p.y / 1000; } else { data.x = 0; data.y = 0; } if (typeof x.c === 'number') { switch (x.c) { case 0: data.align = 0; break; case 2: data.align = 1; break; case 6: data.align = 2; break; case 8: data.align = 3; break; default: if (this._logNotImplemented) { console.log('Cannot handle aligning to center! AlignMode=' + x.c); } } } // Use default axis data.axis = 0; data.shadow = x.b; data.dur = 4000; if (typeof x.l === 'number') { data.dur = x.l * 1000; } if (x.z != null && x.z.length > 0) { data.movable = true; data.motion = []; var moveDuration = 0; var last = { x: data.x, y: data.y, alpha: data.opacity, color: data.color }; for (var m = 0; m < x.z.length; m++) { var dur = x.z[m].l != null ? (x.z[m].l * 1000) : 500; moveDuration += dur; var motion = {}; if (x.z[m].hasOwnProperty('rx') && typeof x.z[m].rx === 'number') { // TODO: Support this if (this._logNotImplemented) { console.log('Encountered animated x-axis rotation. Ignoring.'); } } if (x.z[m].hasOwnProperty('e') && typeof x.z[m].e === 'number') { // TODO: Support this if (this._logNotImplemented) { console.log('Encountered animated y-axis rotation. Ignoring.'); } } if (x.z[m].hasOwnProperty('d') && typeof x.z[m].d === 'number') { // TODO: Support this if (this._logNotImplemented) { console.log('Encountered animated z-axis rotation. Ignoring.'); } } if (x.z[m].hasOwnProperty('x') && typeof x.z[m].x === 'number') { motion.x = { from: last.x, to: x.z[m].x / 1000, dur: dur, delay: 0 }; } if (x.z[m].hasOwnProperty('y') && typeof x.z[m].y === 'number') { motion.y = { from: last.y, to: x.z[m].y / 1000, dur: dur, delay: 0 }; } last.x = motion.hasOwnProperty('x') ? motion.x.to : last.x; last.y = motion.hasOwnProperty('y') ? motion.y.to : last.y; if (x.z[m].hasOwnProperty('t') && typeof x.z[m].t === 'number' && x.z[m].t !== last.alpha) { motion.alpha = { from: last.alpha, to: x.z[m].t, dur: dur, delay: 0 }; last.alpha = motion.alpha.to; } if (x.z[m].hasOwnProperty('c') && typeof x.z[m].c === 'number' && x.z[m].c !== last.color) { motion.color = { from: last.color, to:x.z[m].c, dur: dur, delay: 0 }; last.color = motion.color.to; } data.motion.push(motion); } data.dur = moveDuration + (data.moveDelay ? data.moveDelay : 0); } if (x.hasOwnProperty('w')) { if (x.w.hasOwnProperty('f')) { data.font = x.w.f; } if (x.w.hasOwnProperty('l') && Array.isArray(x.w.l)) { if (x.w.l.length > 0) { // Filters if (this._logNotImplemented) { console.log('[Dbg] Filters not supported! ' + JSON.stringify(x.w.l)); } } } } if (x.r != null && x.k != null) { data.rX = x.r; data.rY = x.k; } } return data; } else { // Not enough arguments. if (this._logBadComments) { console.warn('Dropping this comment due to insufficient parameters. Got: ' + config.length); console.log('[Dbg] ' + comment['c']); } return null; } }; AcfunFormat.JSONParser.prototype.parseMany = function (comments) { if (!Array.isArray(comments)) { return null; } var list = []; for (var i = 0; i < comments.length; i++) { var comment = this.parseOne(comments[i]); if (comment !== null) { list.push(comment); } } return list; }; AcfunFormat.TextParser = function (param) { this._jsonParser = new AcfunFormat.JSONParser(param); } AcfunFormat.TextParser.prototype.parseOne = function (comment) { try { return this._jsonParser.parseOne(JSON.parse(comment)); } catch (e) { console.warn(e); return null; } } AcfunFormat.TextParser.prototype.parseMany = function (comment) { try { return this._jsonParser.parseMany(JSON.parse(comment)); } catch (e) { console.warn(e); return null; } } return AcfunFormat; })();
{ "pile_set_name": "Github" }
<component name="libraryTable"> <library name="Maven: com.alibaba:fastjson:1.2.40"> <CLASSES> <root url="jar://$MAVEN_REPOSITORY$/com/alibaba/fastjson/1.2.40/fastjson-1.2.40.jar!/" /> </CLASSES> <JAVADOC> <root url="jar://$MAVEN_REPOSITORY$/com/alibaba/fastjson/1.2.40/fastjson-1.2.40-javadoc.jar!/" /> </JAVADOC> <SOURCES> <root url="jar://$MAVEN_REPOSITORY$/com/alibaba/fastjson/1.2.40/fastjson-1.2.40-sources.jar!/" /> </SOURCES> </library> </component>
{ "pile_set_name": "Github" }
# lupus [**Pandas Profiling Report**](https://epistasislab.github.io/penn-ml-benchmarks/profile/lupus.html) [Metadata](metadata.yaml) | [Summary Statistics](summary_stats.tsv)
{ "pile_set_name": "Github" }
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <[email protected]> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\DomCrawler\Field; /** * FileFormField represents a file form field (an HTML file input tag). * * @author Fabien Potencier <[email protected]> */ class FileFormField extends FormField { /** * Sets the PHP error code associated with the field. * * @param int $error The error code (one of UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_FORM_SIZE, UPLOAD_ERR_PARTIAL, UPLOAD_ERR_NO_FILE, UPLOAD_ERR_NO_TMP_DIR, UPLOAD_ERR_CANT_WRITE, or UPLOAD_ERR_EXTENSION) * * @throws \InvalidArgumentException When error code doesn't exist */ public function setErrorCode($error) { $codes = array(UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_FORM_SIZE, UPLOAD_ERR_PARTIAL, UPLOAD_ERR_NO_FILE, UPLOAD_ERR_NO_TMP_DIR, UPLOAD_ERR_CANT_WRITE, UPLOAD_ERR_EXTENSION); if (!in_array($error, $codes)) { throw new \InvalidArgumentException(sprintf('The error code %s is not valid.', $error)); } $this->value = array('name' => '', 'type' => '', 'tmp_name' => '', 'error' => $error, 'size' => 0); } /** * Sets the value of the field. * * @param string $value The value of the field */ public function upload($value) { $this->setValue($value); } /** * Sets the value of the field. * * @param string $value The value of the field */ public function setValue($value) { if (null !== $value && is_readable($value)) { $error = UPLOAD_ERR_OK; $size = filesize($value); $info = pathinfo($value); $name = $info['basename']; // copy to a tmp location $tmp = sys_get_temp_dir().'/'.strtr(substr(base64_encode(hash('sha256', uniqid(mt_rand(), true), true)), 0, 7), '/', '_'); if (array_key_exists('extension', $info)) { $tmp .= '.'.$info['extension']; } if (is_file($tmp)) { unlink($tmp); } copy($value, $tmp); $value = $tmp; } else { $error = UPLOAD_ERR_NO_FILE; $size = 0; $name = ''; $value = ''; } $this->value = array('name' => $name, 'type' => '', 'tmp_name' => $value, 'error' => $error, 'size' => $size); } /** * Sets path to the file as string for simulating HTTP request. * * @param string $path The path to the file */ public function setFilePath($path) { parent::setValue($path); } /** * Initializes the form field. * * @throws \LogicException When node type is incorrect */ protected function initialize() { if ('input' !== $this->node->nodeName) { throw new \LogicException(sprintf('A FileFormField can only be created from an input tag (%s given).', $this->node->nodeName)); } if ('file' !== strtolower($this->node->getAttribute('type'))) { throw new \LogicException(sprintf('A FileFormField can only be created from an input tag with a type of file (given type is %s).', $this->node->getAttribute('type'))); } $this->setValue(null); } }
{ "pile_set_name": "Github" }
import { IconDefinition } from '../types'; declare const FundProjectionScreenOutlined: IconDefinition; export default FundProjectionScreenOutlined;
{ "pile_set_name": "Github" }
> This page covers Tutorial v2. Elm 0.18. # Models We want to store the response from the server in the models instead of the hardcoded list of players we have now. In __src/Models.elm__, include a new import and change the type of `players`: ```elm ... import RemoteData exposing (WebData) type alias Model = { players : WebData (List Player) } initialModel : Model initialModel = { players = RemoteData.Loading } ... ``` - We changed the type of `players` from `List Player` to `WebData (List Player)`. This type `WebData` will contain the list of players when we get a successful response from the API. - Our initial `players` attribute will be `RemoteData.Loading`, as it says this indicates that the resource is loading.
{ "pile_set_name": "Github" }
#!/usr/bin/env python # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (c) 2011 OpenStack Foundation. # 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. 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. """Root wrapper for OpenStack services Filters which commands a service is allowed to run as another user. To use this with cinder, you should set the following in cinder.conf: rootwrap_config=/etc/cinder/rootwrap.conf You also need to let the cinder user run cinder-rootwrap as root in sudoers: cinder ALL = (root) NOPASSWD: /usr/bin/cinder-rootwrap /etc/cinder/rootwrap.conf * Service packaging should deploy .filters files only on nodes where they are needed, to avoid allowing more than is necessary. """ import ConfigParser import logging import os import pwd import signal import subprocess import sys RC_UNAUTHORIZED = 99 RC_NOCOMMAND = 98 RC_BADCONFIG = 97 RC_NOEXECFOUND = 96 def _subprocess_setup(): # Python installs a SIGPIPE handler by default. This is usually not what # non-Python subprocesses expect. signal.signal(signal.SIGPIPE, signal.SIG_DFL) def _exit_error(execname, message, errorcode, log=True): print "%s: %s" % (execname, message) if log: logging.error(message) sys.exit(errorcode) if __name__ == '__main__': # Split arguments, require at least a command execname = sys.argv.pop(0) if len(sys.argv) < 2: _exit_error(execname, "No command specified", RC_NOCOMMAND, log=False) configfile = sys.argv.pop(0) userargs = sys.argv[:] # Add ../ to sys.path to allow running from branch possible_topdir = os.path.normpath(os.path.join(os.path.abspath(execname), os.pardir, os.pardir)) if os.path.exists(os.path.join(possible_topdir, "cinder", "__init__.py")): sys.path.insert(0, possible_topdir) from cinder.openstack.common.rootwrap import wrapper # Load configuration try: rawconfig = ConfigParser.RawConfigParser() rawconfig.read(configfile) config = wrapper.RootwrapConfig(rawconfig) except ValueError as exc: msg = "Incorrect value in %s: %s" % (configfile, exc.message) _exit_error(execname, msg, RC_BADCONFIG, log=False) except ConfigParser.Error: _exit_error(execname, "Incorrect configuration file: %s" % configfile, RC_BADCONFIG, log=False) if config.use_syslog: wrapper.setup_syslog(execname, config.syslog_log_facility, config.syslog_log_level) # Execute command if it matches any of the loaded filters filters = wrapper.load_filters(config.filters_path) try: filtermatch = wrapper.match_filter(filters, userargs, exec_dirs=config.exec_dirs) if filtermatch: command = filtermatch.get_command(userargs, exec_dirs=config.exec_dirs) if config.use_syslog: logging.info("(%s > %s) Executing %s (filter match = %s)" % ( os.getlogin(), pwd.getpwuid(os.getuid())[0], command, filtermatch.name)) obj = subprocess.Popen(command, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr, preexec_fn=_subprocess_setup, env=filtermatch.get_environment(userargs)) obj.wait() sys.exit(obj.returncode) except wrapper.FilterMatchNotExecutable as exc: msg = ("Executable not found: %s (filter match = %s)" % (exc.match.exec_path, exc.match.name)) _exit_error(execname, msg, RC_NOEXECFOUND, log=config.use_syslog) except wrapper.NoFilterMatched: msg = ("Unauthorized command: %s (no filter matched)" % ' '.join(userargs)) _exit_error(execname, msg, RC_UNAUTHORIZED, log=config.use_syslog)
{ "pile_set_name": "Github" }
// // NSObject+DyCInjection(DCInjection) // Dynamic Code Injection // // Created by Paul Taykalo on 10/21/12. // Copyright (c) 2012 Stanfy LLC. All rights reserved. // #if TARGET_IPHONE_SIMULATOR #import <objc/runtime.h> #import "NSObject+DyCInjection.h" //#import "SFDynamicCodeInjection.h" #import "SFInjectionsNotificationsCenter.h" void swizzle(Class c, SEL orig, SEL new) { Method origMethod = class_getInstanceMethod(c, orig); Method newMethod = class_getInstanceMethod(c, new); if (class_addMethod(c, orig, method_getImplementation(newMethod), method_getTypeEncoding(newMethod))) { class_replaceMethod(c, new, method_getImplementation(origMethod), method_getTypeEncoding(origMethod)); } else { method_exchangeImplementations(origMethod, newMethod); } } @interface NSObject (DyCInjectionObserver) <SFInjectionObserver> @end @implementation NSObject (DyCInjection) #pragma mark - Swizzling + (void)allowInjectionSubscriptionOnInitMethod { swizzle([NSObject class], @selector(init), @selector(_swizzledInit)); swizzle([NSObject class], NSSelectorFromString(@"dealloc"), @selector(_swizzledDealloc)); // Storyboard support swizzle(NSClassFromString(@"UINib"), @selector(instantiateWithOwner:options:), @selector(_swizzledInstantiateWithOwner:options:)); } #pragma mark - Subscription check + (BOOL)shouldPerformRuntimeCodeInjectionOnObject:(__unsafe_unretained id)instance { if (!instance) { return NO; } #warning We should skip more than just NS, CF, and private classes char const * className = object_getClassName(instance); switch (className[0]) { case '_': return NO; case 'N': if (className[1] == 'S') { return NO; } break; case 'C': if (className[1] == 'A' || className[1] == 'F' ) { return NO; } break; case 'U': if (className[1] == 'I') { // Allowing to inject UIViewControllers if (strcmp(className, "UIViewController") == 0) { return YES; } if (strcmp(className, "UITableViewController") == 0) { return YES; } return NO; } break; case 'W': if (className[1] == 'e' && className[2] == 'b') { return NO; } break; case 'D': if (className[1] == 'O' && className[2] == 'M') { return NO; } break; case 'S': if (className[1] == 'F' && className[2] == 'I' && className[3] == 'n' && className[4] == 'j') { return NO; } break; case 'O': if (className[1] == 'S' && className[2] == '_') { return NO; } break; default: break; } // Disable injection on NSManagedObject object classes // They have slightly different lifecycle... Class clz = NSClassFromString(@"NSManagedObject"); if (clz && [instance isKindOfClass:clz]) { return NO; } return YES; } #pragma mark - On Injection methods - (void)updateOnClassInjection { } - (void)updateOnResourceInjection:(NSString *)resourcePath { } #pragma mark - Swizzled methods - (id)_swizzledInit { // Calling previous init id result = self; result = [result _swizzledInit]; if (result) { // In case, if we are in need to inject if ([NSObject shouldPerformRuntimeCodeInjectionOnObject:result]) { SFInjectionsNotificationsCenter * notificationCenter = [SFInjectionsNotificationsCenter sharedInstance]; [notificationCenter addObserver:result]; } } return result; } - (void)_swizzledDealloc { if ([NSObject shouldPerformRuntimeCodeInjectionOnObject:self]) { [[SFInjectionsNotificationsCenter sharedInstance] removeObserver:self]; } // Swizzled methods are fun // Calling previous dealloc implementation [self _swizzledDealloc]; } @end #endif
{ "pile_set_name": "Github" }
import logging def not_working(message): orig_message = message message += " You can use `anime -ll DEBUG` to use it." def wrapper(cls): class NotWorking: """Site is not working""" def __init__(self, *args, **kwargs): raise RuntimeError(message) def search(cls, *args, **kwargs): raise RuntimeError(message) NotWorking.__doc__ = orig_message logger = logging.getLogger("anime_downloader") if logger.level == logging.DEBUG: return cls return NotWorking return wrapper
{ "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.shiro.samples.guice; import com.google.inject.Provides; import com.google.inject.binder.AnnotatedBindingBuilder; import com.google.inject.name.Names; import org.apache.shiro.lang.codec.Base64; import org.apache.shiro.config.ConfigurationException; import org.apache.shiro.config.Ini; import org.apache.shiro.guice.web.ShiroWebModule; import org.apache.shiro.realm.text.IniRealm; import org.apache.shiro.web.mgt.CookieRememberMeManager; import org.apache.shiro.web.mgt.DefaultWebSecurityManager; import org.apache.shiro.web.mgt.WebSecurityManager; import javax.inject.Singleton; import javax.servlet.ServletContext; import java.net.MalformedURLException; import java.net.URL; public class SampleShiroServletModule extends ShiroWebModule { private final ServletContext servletContext; public SampleShiroServletModule(ServletContext servletContext) { super(servletContext); this.servletContext = servletContext; } @Override protected void configureShiroWeb() { bindConstant().annotatedWith(Names.named("shiro.loginUrl")).to("/login.jsp"); try { this.bindRealm().toConstructor(IniRealm.class.getConstructor(Ini.class)); } catch (NoSuchMethodException e) { addError("Could not locate proper constructor for IniRealm.", e); } this.addFilterChain("/login.jsp", AUTHC); this.addFilterChain("/logout", LOGOUT); this.addFilterChain("/account/**", AUTHC); this.addFilterChain("/remoting/**", filterConfig(AUTHC), filterConfig(ROLES, "b2bClient"), filterConfig(PERMS, "remote:invoke:lan,wan")); } @Provides @Singleton Ini loadShiroIni() throws MalformedURLException { URL iniUrl = servletContext.getResource("/WEB-INF/shiro.ini"); return Ini.fromResourcePath("url:" + iniUrl.toExternalForm()); } @Override protected void bindWebSecurityManager(AnnotatedBindingBuilder<? super WebSecurityManager> bind) { try { String cipherKey = loadShiroIni().getSectionProperty( "main", "securityManager.rememberMeManager.cipherKey" ); DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(); CookieRememberMeManager rememberMeManager = new CookieRememberMeManager(); rememberMeManager.setCipherKey( Base64.decode( cipherKey ) ); securityManager.setRememberMeManager(rememberMeManager); bind.toInstance(securityManager); } catch ( MalformedURLException e ) { // for now just throw, you could just call // super.bindWebSecurityManager(bind) if you do not need rememberMe functionality throw new ConfigurationException( "securityManager.rememberMeManager.cipherKey must be set in shiro.ini." ); } } }
{ "pile_set_name": "Github" }
# Gorilla WebSocket Gorilla WebSocket is a [Go](http://golang.org/) implementation of the [WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol. [![Build Status](https://travis-ci.org/gorilla/websocket.svg?branch=master)](https://travis-ci.org/gorilla/websocket) [![GoDoc](https://godoc.org/github.com/gorilla/websocket?status.svg)](https://godoc.org/github.com/gorilla/websocket) ### Documentation * [API Reference](http://godoc.org/github.com/gorilla/websocket) * [Chat example](https://github.com/gorilla/websocket/tree/master/examples/chat) * [Command example](https://github.com/gorilla/websocket/tree/master/examples/command) * [Client and server example](https://github.com/gorilla/websocket/tree/master/examples/echo) * [File watch example](https://github.com/gorilla/websocket/tree/master/examples/filewatch) ### Status The Gorilla WebSocket package provides a complete and tested implementation of the [WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol. The package API is stable. ### Installation go get github.com/gorilla/websocket ### Protocol Compliance The Gorilla WebSocket package passes the server tests in the [Autobahn Test Suite](http://autobahn.ws/testsuite) using the application in the [examples/autobahn subdirectory](https://github.com/gorilla/websocket/tree/master/examples/autobahn). ### Gorilla WebSocket compared with other packages <table> <tr> <th></th> <th><a href="http://godoc.org/github.com/gorilla/websocket">github.com/gorilla</a></th> <th><a href="http://godoc.org/golang.org/x/net/websocket">golang.org/x/net</a></th> </tr> <tr> <tr><td colspan="3"><a href="http://tools.ietf.org/html/rfc6455">RFC 6455</a> Features</td></tr> <tr><td>Passes <a href="http://autobahn.ws/testsuite/">Autobahn Test Suite</a></td><td><a href="https://github.com/gorilla/websocket/tree/master/examples/autobahn">Yes</a></td><td>No</td></tr> <tr><td>Receive <a href="https://tools.ietf.org/html/rfc6455#section-5.4">fragmented</a> message<td>Yes</td><td><a href="https://code.google.com/p/go/issues/detail?id=7632">No</a>, see note 1</td></tr> <tr><td>Send <a href="https://tools.ietf.org/html/rfc6455#section-5.5.1">close</a> message</td><td><a href="http://godoc.org/github.com/gorilla/websocket#hdr-Control_Messages">Yes</a></td><td><a href="https://code.google.com/p/go/issues/detail?id=4588">No</a></td></tr> <tr><td>Send <a href="https://tools.ietf.org/html/rfc6455#section-5.5.2">pings</a> and receive <a href="https://tools.ietf.org/html/rfc6455#section-5.5.3">pongs</a></td><td><a href="http://godoc.org/github.com/gorilla/websocket#hdr-Control_Messages">Yes</a></td><td>No</td></tr> <tr><td>Get the <a href="https://tools.ietf.org/html/rfc6455#section-5.6">type</a> of a received data message</td><td>Yes</td><td>Yes, see note 2</td></tr> <tr><td colspan="3">Other Features</tr></td> <tr><td><a href="https://tools.ietf.org/html/rfc7692">Compression Extensions</a></td><td>Experimental</td><td>No</td></tr> <tr><td>Read message using io.Reader</td><td><a href="http://godoc.org/github.com/gorilla/websocket#Conn.NextReader">Yes</a></td><td>No, see note 3</td></tr> <tr><td>Write message using io.WriteCloser</td><td><a href="http://godoc.org/github.com/gorilla/websocket#Conn.NextWriter">Yes</a></td><td>No, see note 3</td></tr> </table> Notes: 1. Large messages are fragmented in [Chrome's new WebSocket implementation](http://www.ietf.org/mail-archive/web/hybi/current/msg10503.html). 2. The application can get the type of a received data message by implementing a [Codec marshal](http://godoc.org/golang.org/x/net/websocket#Codec.Marshal) function. 3. The go.net io.Reader and io.Writer operate across WebSocket frame boundaries. Read returns when the input buffer is full or a frame boundary is encountered. Each call to Write sends a single frame message. The Gorilla io.Reader and io.WriteCloser operate on a single WebSocket message.
{ "pile_set_name": "Github" }
// Copyright 2001-2019 Crytek GmbH / Crytek Group. All rights reserved. /******************************************************************** --------------------------------------------------------------------- File name: RangeSignaling.h $Id$ $DateTime$ Description: Signal entities based on ranges from other entities --------------------------------------------------------------------- History: - 09:04:2007 : Created by Ricardo Pillosu *********************************************************************/ #ifndef _RANGE_SIGNALING_H_ #define _RANGE_SIGNALING_H_ #include "IRangeSignaling.h" class CPersonalRangeSignaling; class CRangeSignaling : public IRangeSignaling { public: /*$1- Singleton Stuff ----------------------------------------------------*/ static CRangeSignaling& ref(); static bool Create(); static void Shutdown(); void Reset(); /*$1- IEditorSetGameModeListener -----------------------------------------*/ void OnEditorSetGameMode(bool bGameMode); void OnProxyReset(EntityId IdEntity); /*$1- Basics -------------------------------------------------------------*/ void Init(); bool Update(float fElapsedTime); /*$1- Utils --------------------------------------------------------------*/ bool AddRangeSignal(EntityId IdEntity, float fRadius, float fBoundary, const char* sSignal, AISignals::IAISignalExtraData* pData = NULL); bool AddTargetRangeSignal(EntityId IdEntity, EntityId IdTarget, float fRadius, float fBoundary, const char* sSignal, AISignals::IAISignalExtraData* pData = NULL); bool AddAngleSignal(EntityId IdEntity, float fAngle, float fBoundary, const char* sSignal, AISignals::IAISignalExtraData* pData = NULL); bool DestroyPersonalRangeSignaling(EntityId IdEntity); void ResetPersonalRangeSignaling(EntityId IdEntity); void EnablePersonalRangeSignaling(EntityId IdEntity, bool bEnable); void SetDebug(bool bDebug); bool GetDebug() const; protected: /*$1- Creation and destruction via singleton -----------------------------*/ CRangeSignaling(); virtual ~CRangeSignaling(); /*$1- Utils --------------------------------------------------------------*/ CPersonalRangeSignaling* GetPersonalRangeSignaling(EntityId IdEntity) const; CPersonalRangeSignaling* CreatePersonalRangeSignaling(EntityId IdEntity); private: typedef std::map<EntityId, CPersonalRangeSignaling*> MapPersonals; /*$1- Members ------------------------------------------------------------*/ bool m_bInit; bool m_bDebug; static CRangeSignaling* m_pInstance; MapPersonals m_Personals; }; #endif // _RANGE_SIGNALING_H_
{ "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. #include "kudu/util/blocking_queue.h" #include <algorithm> #include <cstddef> #include <cstdint> #include <deque> #include <map> #include <memory> #include <numeric> #include <ostream> #include <string> #include <thread> #include <type_traits> #include <vector> #include <gflags/gflags.h> #include <glog/logging.h> #include <gtest/gtest.h> #include "kudu/gutil/strings/substitute.h" #include "kudu/util/countdown_latch.h" #include "kudu/util/monotime.h" #include "kudu/util/mutex.h" #include "kudu/util/scoped_cleanup.h" #include "kudu/util/status.h" #include "kudu/util/test_macros.h" #include "kudu/util/test_util.h" DEFINE_uint32(num_blocking_writers, 3, "number of threads calling BlockingQueue::BlockingPut()"); DEFINE_uint32(num_non_blocking_writers, 2, "number of threads calling BlockingQueue::Put()"); DEFINE_uint32(num_blocking_readers, 5, "number of threads calling BlockingQueue::BlockingGet()"); DEFINE_uint32(runtime_sec, 5, "duration of the test (seconds)"); DEFINE_uint32(queue_capacity, 64, "capacity of the queue (number of elements)"); using std::accumulate; using std::string; using std::thread; using std::unique_ptr; using std::vector; using strings::Substitute; namespace kudu { BlockingQueue<int32_t> test1_queue(5); void InsertSomeThings() { ASSERT_EQ(test1_queue.Put(1), QUEUE_SUCCESS); ASSERT_EQ(test1_queue.Put(2), QUEUE_SUCCESS); ASSERT_EQ(test1_queue.Put(3), QUEUE_SUCCESS); } TEST(BlockingQueueTest, Test1) { thread inserter_thread(InsertSomeThings); int32_t i; ASSERT_OK(test1_queue.BlockingGet(&i)); ASSERT_EQ(1, i); ASSERT_OK(test1_queue.BlockingGet(&i)); ASSERT_EQ(2, i); ASSERT_OK(test1_queue.BlockingGet(&i)); ASSERT_EQ(3, i); inserter_thread.join(); } TEST(BlockingQueueTest, TestBlockingDrainTo) { BlockingQueue<int32_t> test_queue(3); ASSERT_EQ(test_queue.Put(1), QUEUE_SUCCESS); ASSERT_EQ(test_queue.Put(2), QUEUE_SUCCESS); ASSERT_EQ(test_queue.Put(3), QUEUE_SUCCESS); vector<int32_t> out; ASSERT_OK(test_queue.BlockingDrainTo(&out, MonoTime::Now() + MonoDelta::FromSeconds(30))); ASSERT_EQ(1, out[0]); ASSERT_EQ(2, out[1]); ASSERT_EQ(3, out[2]); // Set a deadline in the past and ensure we time out. Status s = test_queue.BlockingDrainTo(&out, MonoTime::Now() - MonoDelta::FromSeconds(1)); ASSERT_TRUE(s.IsTimedOut()); // Ensure that if the queue is shut down, we get Aborted status. test_queue.Shutdown(); s = test_queue.BlockingDrainTo(&out, MonoTime::Now() - MonoDelta::FromSeconds(1)); ASSERT_TRUE(s.IsAborted()); } TEST(BlockingQueueTest, TestBlockingPut) { const MonoDelta kShortTimeout = MonoDelta::FromMilliseconds(200); const MonoDelta kEvenShorterTimeout = MonoDelta::FromMilliseconds(100); BlockingQueue<int32_t> test_queue(2); // First, a trivial check that we don't do anything if our deadline has // already passed. Status s = test_queue.BlockingPut(1, MonoTime::Now() - kShortTimeout); ASSERT_TRUE(s.IsTimedOut()) << s.ToString(); // Now put a couple elements onto the queue. ASSERT_OK(test_queue.BlockingPut(1)); ASSERT_OK(test_queue.BlockingPut(2)); // We're at capacity, so further puts should time out... s = test_queue.BlockingPut(3, MonoTime::Now() + kShortTimeout); ASSERT_TRUE(s.IsTimedOut()) << s.ToString(); // ... until space is freed up before the deadline. thread t([&] { SleepFor(kEvenShorterTimeout); int out; ASSERT_OK(test_queue.BlockingGet(&out)); }); SCOPED_CLEANUP({ t.join(); }); ASSERT_OK(test_queue.BlockingPut(3, MonoTime::Now() + kShortTimeout)); // If we shut down, we shouldn't be able to put more elements onto the queue. test_queue.Shutdown(); s = test_queue.BlockingPut(3, MonoTime::Now() + kShortTimeout); ASSERT_TRUE(s.IsAborted()) << s.ToString(); } TEST(BlockingQueueTest, TestBlockingGet) { const MonoDelta kShortTimeout = MonoDelta::FromMilliseconds(200); const MonoDelta kEvenShorterTimeout = MonoDelta::FromMilliseconds(100); BlockingQueue<int32_t> test_queue(2); ASSERT_OK(test_queue.BlockingPut(1)); ASSERT_OK(test_queue.BlockingPut(2)); // Test that if we have stuff in our queue, regardless of deadlines, we'll be // able to get them out. int32_t val = 0; ASSERT_OK(test_queue.BlockingGet(&val, MonoTime::Now() - kShortTimeout)); ASSERT_EQ(1, val); ASSERT_OK(test_queue.BlockingGet(&val, MonoTime::Now() + kShortTimeout)); ASSERT_EQ(2, val); // But without stuff in the queue, we'll time out... Status s = test_queue.BlockingGet(&val, MonoTime::Now() - kShortTimeout); ASSERT_TRUE(s.IsTimedOut()) << s.ToString(); s = test_queue.BlockingGet(&val, MonoTime::Now() + kShortTimeout); ASSERT_TRUE(s.IsTimedOut()) << s.ToString(); // ... until new elements show up. thread t([&] { SleepFor(kEvenShorterTimeout); ASSERT_OK(test_queue.BlockingPut(3)); }); SCOPED_CLEANUP({ t.join(); }); ASSERT_OK(test_queue.BlockingGet(&val, MonoTime::Now() + kShortTimeout)); ASSERT_EQ(3, val); // If we shut down with stuff in our queue, we'll continue to return those // elements. Otherwise, we'll return an error. ASSERT_OK(test_queue.BlockingPut(4)); test_queue.Shutdown(); ASSERT_OK(test_queue.BlockingGet(&val, MonoTime::Now() + kShortTimeout)); ASSERT_EQ(4, val); s = test_queue.BlockingGet(&val, MonoTime::Now() + kShortTimeout); ASSERT_TRUE(s.IsAborted()) << s.ToString(); } // Test that, when the queue is shut down with elements still pending, // Drain still returns OK until the elements are all gone. TEST(BlockingQueueTest, TestGetAndDrainAfterShutdown) { // Put some elements into the queue and then shut it down. BlockingQueue<int32_t> q(3); ASSERT_EQ(q.Put(1), QUEUE_SUCCESS); ASSERT_EQ(q.Put(2), QUEUE_SUCCESS); q.Shutdown(); // Get() should still return an element. int i; ASSERT_OK(q.BlockingGet(&i)); ASSERT_EQ(1, i); // Drain should still return OK, since it yielded elements. vector<int32_t> out; ASSERT_OK(q.BlockingDrainTo(&out)); ASSERT_EQ(2, out[0]); // Now that it's empty, it should return Aborted. Status s = q.BlockingDrainTo(&out); ASSERT_TRUE(s.IsAborted()) << s.ToString(); s = q.BlockingGet(&i); ASSERT_FALSE(s.ok()) << s.ToString(); } TEST(BlockingQueueTest, TestTooManyInsertions) { BlockingQueue<int32_t> test_queue(2); ASSERT_EQ(test_queue.Put(123), QUEUE_SUCCESS); ASSERT_EQ(test_queue.Put(123), QUEUE_SUCCESS); ASSERT_EQ(test_queue.Put(123), QUEUE_FULL); } namespace { struct LengthLogicalSize { static size_t logical_size(const string& s) { return s.length(); } }; } // anonymous namespace TEST(BlockingQueueTest, TestLogicalSize) { BlockingQueue<string, LengthLogicalSize> test_queue(4); ASSERT_EQ(test_queue.Put("a"), QUEUE_SUCCESS); ASSERT_EQ(1, test_queue.size()); ASSERT_EQ(test_queue.Put("bcd"), QUEUE_SUCCESS); ASSERT_EQ(4, test_queue.size()); ASSERT_EQ(test_queue.Put("e"), QUEUE_FULL); ASSERT_EQ(4, test_queue.size()); } TEST(BlockingQueueTest, TestNonPointerParamsMayBeNonEmptyOnDestruct) { BlockingQueue<int32_t> test_queue(1); ASSERT_EQ(test_queue.Put(123), QUEUE_SUCCESS); // No DCHECK failure on destruct. } #ifndef NDEBUG TEST(BlockingQueueDeathTest, TestPointerParamsMustBeEmptyOnDestruct) { ::testing::FLAGS_gtest_death_test_style = "threadsafe"; ASSERT_DEATH({ BlockingQueue<int32_t*> test_queue(1); int32_t element = 123; ASSERT_EQ(test_queue.Put(&element), QUEUE_SUCCESS); // Debug assertion triggered on queue destruction since type is a pointer. }, "BlockingQueue holds bare pointers"); } #endif // NDEBUG TEST(BlockingQueueTest, TestGetFromShutdownQueue) { BlockingQueue<int64_t> test_queue(2); ASSERT_EQ(test_queue.Put(123), QUEUE_SUCCESS); test_queue.Shutdown(); ASSERT_EQ(test_queue.Put(456), QUEUE_SHUTDOWN); int64_t i; ASSERT_OK(test_queue.BlockingGet(&i)); ASSERT_EQ(123, i); Status s = test_queue.BlockingGet(&i); ASSERT_FALSE(s.ok()) << s.ToString(); } TEST(BlockingQueueTest, TestUniquePtrMethods) { BlockingQueue<unique_ptr<int>> test_queue(2); unique_ptr<int> input_int(new int(123)); ASSERT_EQ(QUEUE_SUCCESS, test_queue.Put(std::move(input_int))); unique_ptr<int> output_int; ASSERT_OK(test_queue.BlockingGet(&output_int)); ASSERT_EQ(123, *output_int.get()); test_queue.Shutdown(); } class MultiThreadTest { public: MultiThreadTest() : puts_(4), blocking_puts_(4), nthreads_(5), queue_(nthreads_ * puts_), num_inserters_(nthreads_), sync_latch_(nthreads_) { } void InserterThread(int arg) { for (int i = 0; i < puts_; i++) { ASSERT_EQ(queue_.Put(arg), QUEUE_SUCCESS); } sync_latch_.CountDown(); sync_latch_.Wait(); for (int i = 0; i < blocking_puts_; i++) { ASSERT_OK(queue_.BlockingPut(arg)); } MutexLock guard(lock_); if (--num_inserters_ == 0) { queue_.Shutdown(); } } void RemoverThread() { for (int i = 0; i < puts_ + blocking_puts_; i++) { int32_t arg = 0; Status s = queue_.BlockingGet(&arg); if (!s.ok()) { arg = -1; } MutexLock guard(lock_); gotten_[arg] = gotten_[arg] + 1; } } void Run() { for (int i = 0; i < nthreads_; i++) { threads_.emplace_back(&MultiThreadTest::InserterThread, this, i); threads_.emplace_back(&MultiThreadTest::RemoverThread, this); } // We add an extra thread to ensure that there aren't enough elements in // the queue to go around. This way, we test removal after Shutdown. threads_.emplace_back(&MultiThreadTest::RemoverThread, this); for (auto& thread : threads_) { thread.join(); } // Let's check to make sure we got what we should have. MutexLock guard(lock_); for (int i = 0; i < nthreads_; i++) { ASSERT_EQ(puts_ + blocking_puts_, gotten_[i]); } // And there were nthreads_ * (puts_ + blocking_puts_) // elements removed, but only nthreads_ * puts_ + // blocking_puts_ elements added. So some removers hit the // shutdown case. ASSERT_EQ(puts_ + blocking_puts_, gotten_[-1]); } int puts_; int blocking_puts_; int nthreads_; BlockingQueue<int32_t> queue_; Mutex lock_; std::map<int32_t, int> gotten_; vector<thread> threads_; int num_inserters_; CountDownLatch sync_latch_; }; TEST(BlockingQueueTest, TestMultipleThreads) { MultiThreadTest test; test.Run(); } class BlockingQueueMultiThreadPerfTest : public ::testing::Test { public: void BlockingGetTask(size_t* counter) { barrier_.CountDown(); barrier_.Wait(); uint64_t elem = 0; while (true) { auto s = queue_.BlockingGet(&elem); if (!s.ok()) { CHECK(s.IsAborted()) << s.ToString(); return; } ++(*counter); } } void BlockingPutTask(size_t* counter) { barrier_.CountDown(); barrier_.Wait(); uint64_t elem = 0; while (true) { auto s = queue_.BlockingPut(elem++); if (!s.ok()) { CHECK(s.IsAborted()) << s.ToString(); return; } ++(*counter); } } void NonBlockingPutTask(size_t* counter) { barrier_.CountDown(); barrier_.Wait(); uint64_t elem = 0; while (true) { auto result = queue_.Put(elem++); if (result == QUEUE_SHUTDOWN) { return; } switch (result) { case QUEUE_SUCCESS: ++(*counter); continue; case QUEUE_FULL: SleepFor(MonoDelta::FromMicroseconds(25)); continue; default: LOG(FATAL) << "unexpected queue status: " << result; } } } protected: BlockingQueueMultiThreadPerfTest() : num_blocking_writers_(FLAGS_num_blocking_writers), num_non_blocking_writers_(FLAGS_num_non_blocking_writers), num_blocking_readers_(FLAGS_num_blocking_readers), runtime_(MonoDelta::FromSeconds(FLAGS_runtime_sec)), queue_(FLAGS_queue_capacity), barrier_(num_blocking_writers_ + num_non_blocking_writers_ + num_blocking_readers_) { } const size_t num_blocking_writers_; const size_t num_non_blocking_writers_; const size_t num_blocking_readers_; const MonoDelta runtime_; BlockingQueue<uint64_t> queue_; vector<thread> threads_; CountDownLatch barrier_; }; // This is a test scenario to assess the performance of BlockingQueue in the // terms of call rates when multiple concurrent writers and readers are present. TEST_F(BlockingQueueMultiThreadPerfTest, RequestRates) { SKIP_IF_SLOW_NOT_ALLOWED(); vector<size_t> blocking_read_counts(num_blocking_readers_, 0); for (size_t i = 0; i < num_blocking_readers_; ++i) { threads_.emplace_back(&BlockingQueueMultiThreadPerfTest::BlockingGetTask, this, &blocking_read_counts[i]); } vector<size_t> blocking_write_counts(num_blocking_writers_, 0); for (size_t i = 0; i < num_blocking_writers_; ++i) { threads_.emplace_back(&BlockingQueueMultiThreadPerfTest::BlockingPutTask, this, &blocking_write_counts[i]); } vector<size_t> non_blocking_write_counts(num_non_blocking_writers_, 0); for (size_t i = 0; i < num_non_blocking_writers_; ++i) { threads_.emplace_back(&BlockingQueueMultiThreadPerfTest::NonBlockingPutTask, this, &non_blocking_write_counts[i]); } SleepFor(runtime_); queue_.Shutdown(); for_each(threads_.begin(), threads_.end(), [](thread& t) { t.join(); }); const auto blocking_reads_num = accumulate( blocking_read_counts.begin(), blocking_read_counts.end(), 0UL); const auto blocking_writes_num = accumulate( blocking_write_counts.begin(), blocking_write_counts.end(), 0UL); const auto non_blocking_writes_num = accumulate( non_blocking_write_counts.begin(), non_blocking_write_counts.end(), 0UL); LOG(INFO) << "number of successful BlockingGet() calls: " << blocking_reads_num; LOG(INFO) << "number of successful BlockingPut() calls: " << blocking_writes_num; LOG(INFO) << "number of successful Put() calls: " << non_blocking_writes_num; LOG(INFO) << Substitute( "BlockingGet() rate: $0 calls/sec", static_cast<double>(blocking_reads_num) / runtime_.ToSeconds()); LOG(INFO) << Substitute( "BlockingPut() rate: $0 calls/sec", static_cast<double>(blocking_writes_num) / runtime_.ToSeconds()); LOG(INFO) << Substitute( "Put() (non-blocking) rate: $0 calls/sec", static_cast<double>(non_blocking_writes_num) / runtime_.ToSeconds()); LOG(INFO) << Substitute( "total Blocking{Get,Put}() rate: $0 calls/sec", static_cast<double>(blocking_reads_num + blocking_writes_num) / runtime_.ToSeconds()); LOG(INFO) << Substitute( "total rate: $0 calls/sec", static_cast<double>(blocking_reads_num + blocking_writes_num + non_blocking_writes_num) / runtime_.ToSeconds()); } } // namespace kudu
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator"> <translate android:duration="300" android:fillAfter="true" android:repeatCount="0" android:fromYDelta="-100%" android:toYDelta="0" android:fillEnabled="true"/> </set>
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: 754a7187d543f7c4299c20a8a25790ed TextureImporter: internalIDToNameTable: [] externalObjects: {} serializedVersion: 10 mipmaps: mipMapMode: 0 enableMipMap: 1 sRGBTexture: 1 linearTexture: 0 fadeOut: 0 borderMipMap: 0 mipMapsPreserveCoverage: 0 alphaTestReferenceValue: 0.5 mipMapFadeDistanceStart: 1 mipMapFadeDistanceEnd: 3 bumpmap: convertToNormalMap: 0 externalNormalMap: 0 heightScale: 0.25 normalMapFilter: 0 isReadable: 0 streamingMipmaps: 0 streamingMipmapsPriority: 0 grayScaleToAlpha: 0 generateCubemap: 6 cubemapConvolution: 0 seamlessCubemap: 0 textureFormat: 1 maxTextureSize: 2048 textureSettings: serializedVersion: 2 filterMode: -1 aniso: -1 mipBias: -100 wrapU: -1 wrapV: -1 wrapW: -1 nPOTScale: 1 lightmap: 0 compressionQuality: 50 spriteMode: 0 spriteExtrude: 1 spriteMeshType: 1 alignment: 0 spritePivot: {x: 0.5, y: 0.5} spritePixelsToUnits: 100 spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteGenerateFallbackPhysicsShape: 1 alphaUsage: 1 alphaIsTransparency: 0 spriteTessellationDetail: -1 textureType: 0 textureShape: 1 singleChannelComponent: 0 maxTextureSizeSet: 0 compressionQualitySet: 0 textureFormatSet: 0 ignorePngGamma: 0 platformSettings: - serializedVersion: 3 buildTarget: DefaultTexturePlatform maxTextureSize: 2048 resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 androidETC2FallbackOverride: 0 forceMaximumCompressionQuality_BC6H_BC7: 0 spriteSheet: serializedVersion: 2 sprites: [] outline: [] physicsShape: [] bones: [] spriteID: internalID: 0 vertices: [] indices: edges: [] weights: [] secondaryTextures: [] spritePackingTag: pSDRemoveMatte: 0 pSDShowRemoveMatteOption: 0 userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
@import "treegrid"; @mixin valo-tree8($primary-stylename: v-tree8) { @include valo-treegrid($primary-stylename); $tree-sel-bg: $v-grid-row-selected-background-color; .#{$primary-stylename} { background-color: transparent; } .#{$primary-stylename}-row > td { background-color: transparent; border: 0; line-height: 28px; > * { vertical-align: baseline; } } .#{$primary-stylename}-tablewrapper { background-color: transparent; border: none; } .#{$primary-stylename}-row { &::before { content: ""; display: none; position: absolute; top: 0; left: 0; box-sizing: border-box; width: 100%; height: 100%; border-radius: $v-border-radius; pointer-events: none; border-width: 1px; } } .#{$primary-stylename}-cell { position: relative; } // Selected .#{$primary-stylename}-row-selected { > .#{$primary-stylename}-cell { background: transparent; } &::before { display: block; @include valo-gradient($tree-sel-bg); } } .#{$primary-stylename}:focus .#{$primary-stylename}-row-selected.#{$primary-stylename}-row-focused::before { border-color: transparent; box-shadow: inset 0 0 0 1px valo-font-color($tree-sel-bg); } // Scroll bar .#{$primary-stylename}-scroller-vertical { border: none; } .#{$primary-stylename}-scroller-horizontal { border: none; } .#{$primary-stylename}-header-deco, .#{$primary-stylename}-footer-deco, .#{$primary-stylename}-horizontal-scrollbar-deco { border: none; background: transparent; } }
{ "pile_set_name": "Github" }
<?php /** * This source file is part of the open source project * ExpressionEngine (https://expressionengine.com) * * @link https://expressionengine.com/ * @copyright Copyright (c) 2003-2019, EllisLab Corp. (https://ellislab.com) * @license https://expressionengine.com/license Licensed under Apache License, Version 2.0 */ namespace EllisLab\ExpressionEngine\Service\Model\Query; /** * Update Query */ class Update extends Query { public function run() { $builder = $this->builder; $object = $builder->getExisting(); if ( ! $object) { $object = $this->store->make( $builder->getFrom(), $builder->getFacade() ); } $backup = $object->getOriginal(); $this->prepObject($object); // Do not save if the object isn't dirty. We cannot do this in the model // because the query builder can accept set() calls. Plus, we always want // to cascade to children. if ( ! $object->getDirty()) { return; } $object->emit('beforeUpdate', $backup); $object->emit('beforeSave'); // In case values have changed in above events $backup = $object->getOriginal(); $this->doWork($object); $object->markAsClean(); $object->emit('afterSave'); $object->emit('afterUpdate', $backup); } /** * Add any set() calls that were on the query builder to the object. */ protected function prepObject($object) { foreach ($this->builder->getSet() as $field => $value) { $object->$field = $value; } } /** * Distribute the data amongs the gateways and save it */ protected function doWork($object) { foreach ($this->builder->getSet() as $field => $value) { $object->$field = $value; } /* $result = $object->validate(); if ( ! $result->isValid()) { throw new \Exception('Validation failed'); } */ // todo this is yucky $gateways = $this->store->getMetaDataReader($object->getName())->getGateways(); $dirty = $object->getDirty(); if (empty($dirty)) { return; } foreach ($gateways as $gateway) { $gateway->fill($dirty); $this->actOnGateway($gateway, $object); } } protected function actOnGateway($gateway, $object) { $values = array_intersect_key( $object->getDirty(), array_flip($gateway->getFieldList()) ); if (empty($values)) { return; } $query = $this->store ->rawQuery() ->set($values); if ( ! $object->isNew()) { $query->where($gateway->getPrimaryKey(), $object->getId()); if ($object->getName() == 'ee:MemberGroup') { $query->where('site_id', $object->site_id); } } $query->update($gateway->getTableName()); } } // EOF
{ "pile_set_name": "Github" }
# Troubleshooting This is a list of commonly encountered problems, known issues, and their solutions. ### The following error occurs with `qri connect` : `ERROR mdns: mdns lookup error: failed to bind to any unicast udp port mdns.go:140 ...` This is caused by a limit on the number of files allowed when qri is trying to connect to the distributed web. You can increase the open file descriptor limit by entering the following command `ulimit -n 2560` before running `qri connect`. See [https://github.com/ipfs/support/issues/17](https://github.com/ipfs/support/issues/17) for details. ### The following error occurs with `qri command not working` : `getting the qri binary on your $PATH` This is caused by $PATH not containing a reference to $GOPATH/bin. To alleviate this problem try: ```bash export GOPATH=$HOME/go export PATH=$PATH:$GOROOT/bin:$GOPATH/bin ``` See [https://stackoverflow.com/questions/21001387/how-do-i-set-the-gopath-environment-variable-on-ubuntu-what-file-must-i-edit/21012349#21012349](https://stackoverflow.com/questions/21001387/how-do-i-set-the-gopath-environment-variable-on-ubuntu-what-file-must-i-edit/21012349#21012349) for details.
{ "pile_set_name": "Github" }
// INTENTION_CLASS: org.jetbrains.kotlin.android.intention.AddServiceToManifest // NOT_AVAILABLE package com.myapp import android.app.Service import android.content.Intent import android.os.IBinder abstract class <caret>MyService : Service() { override fun onBind(intent: Intent?): IBinder { TODO("not implemented") } }
{ "pile_set_name": "Github" }
# Get the directory that this configuration file exists in dir = File.dirname(__FILE__) # Load the sencha-touch framework automatically. load File.join(dir, '..', '..', 'sdk', 'resources', 'themes') # Compass configurations sass_path = dir css_path = File.join(dir, "..", "css") # Require any additional compass plugins here. images_dir = File.join(dir, "..", "images") output_style = :compressed environment = :production
{ "pile_set_name": "Github" }
; PLEASE NOTE, SECTION NAMES AND OPTIONS SHOULD BE BLOCK LOWER CASE [workflow] ;pregenerated-template-bank=/home/spxiwh/aLIGO/ahope_devel/testing/bank.xml.gz h1-channel-name = H1:GDS-CALIB-STRAIN l1-channel-name = L1:GDS-CALIB_STRAIN v1-channel-name = V1:FAKE_h_16384Hz_4R [workflow-ifos] h1 = l1 = ;v1 = [workflow-datafind] ; See https://ldas-jobs.ligo.caltech.edu/~cbc/docs/pycbc/ahope/datafind.html datafind-method = AT_RUNTIME_SINGLE_CACHES datafind-h1-frame-type = H1_HOFT_C00 datafind-l1-frame-type = L1_HOFT_C00 datafind-v1-frame-type = V1Online datafind-check-segment-gaps = update_times datafind-check-frames-exist = no_test ; Set this to sepcify the datafind server. If this is not set the code will ; use the value in ${LIGO_DATAFIND_SERVER} ;datafind-ligo-datafind-server = "" [workflow-datafind-syr] datafind-check-segment-summary = warn datafind-ligo-datafind-server = ldr.phy.syr.edu:443 [workflow-datafind-cit] datafind-check-segment-summary = no_test datafind-ligo-datafind-server = ldr.ligo.caltech.edu:443 [workflow-datafind-llo] datafind-check-segment-summary = no_test datafind-ligo-datafind-server = ldr.ligo-la.caltech.edu:443 [workflow-datafind-lho] datafind-check-segment-summary = no_test datafind-ligo-datafind-server = ldr.ligo-wa.caltech.edu:443 [workflow-datafind-uwm] datafind-check-segment-summary = no_test datafind-ligo-datafind-server = nemo-dataserver1.cgca.uwm.edu:443 [workflow-datafind-aei] datafind-check-segment-summary = no_test datafind-ligo-datafind-server = ldr.aei.uni-hannover.de:443 [workflow-segments] ; See https://ldas-jobs.ligo.caltech.edu/~cbc/docs/pycbc/ahope/segments.html segments-method = AT_RUNTIME segments-h1-science-name = H1:DMT-ANALYSIS_READY:1 segments-l1-science-name = L1:DMT-ANALYSIS_READY:1 segments-v1-science-name = V1:ITF_SCIENCEMODE:1 segments-database-url = https://segments.ligo.org ; NOTE: This veto definer does not need "fake vetoes" like ihope does segments-veto-definer-url = file:///home/spxiwh/lscsoft_git/src/pycbc_2/pycbc/examples/workflow/data_checker/H1L1V1-ER8_CBC_OFFLINE.xml ; USE THIS TO TURN OFF CAT_1 MISSING DATA ;segments-veto-definer-url = https://www.lsc-group.phys.uwm.edu/ligovirgo/cbc/public/segments/ER5/H1L1V1-ER5_CBC_OFFLINE-1073779216-0.xml segments-veto-categories = 1 segments-minimum-segment-length = 0 ; And not doing ; segments-generate-coincident-segments = [executables] ; setup of condor universe and location of executables segment_query = ${which:ligolw_segment_query_dqsegdb} segments_from_cats = ${which:ligolw_segments_from_cats_dqsegdb} llwadd = ${which:ligolw_add} ligolw_combine_segments = ${which:ligolw_combine_segments} [datafind] urltype=file
{ "pile_set_name": "Github" }
## Galaxy Tool Framework Changes This document describes changes to Galaxy's tooling framework over recent releases. --- ### 16.04 Full [Galaxy changelog](https://docs.galaxyproject.org/en/master/releases/16.04_announce.html). --- #### Tool Profile Version ([PR #1688](https://github.com/galaxyproject/galaxy/pull/1688)) Tools may (and should) now declare a `profile` version (e.g. `<tool profile="16.04" ...>`). This allows Galaxy to fire a warning if a tool uses features too new for the current version and allows us to migrate away from some undesirable default behaviors that were required for backward compatiblity. --- #### `set -e` by default ([d020522](https://github.com/galaxyproject/galaxy/pull/1688/commits/d020522650a9bfc86c22923a01fd5d7c07c65326)) From the [IUC best practices documentation](https://galaxy-iuc-standards.readthedocs.io/en/latest/best_practices/tool_xml.html#command-tag): > _"If you need to execute more than one shell command, concatenate them with a double ampersand (`&&`), so that an error in a command will abort the execution of the following ones."_ The job script generated with profile `16.04`+ tools will include a `#set -e` statement causing this behavior by default. Older-style tools can enable this behavior by setting `strict="true"` on the tool `command` XML block. --- #### Using Exit Codes for Error Detection ([b92074e](b92074e6ff87a19133b4d973577779c4ee6286d7)) Previously the default behavior was for Galaxy to ignore exit codes and declare a tool in error if issued any output on standard error. This was a regretable default behavior and so all tools were encouraged to declare special XML blocks to force the use of exit codes. For any tool that declares a profile version of `16.04` or greater, the default is now just to use exit codes for error detection. --- #### Unrobust Features Removed ([b92074e](b92074e6ff87a19133b4d973577779c4ee6286d7)) A few tool features have ben removed from tools that declare a version of `16.04` or newer. - The `interepreter=` attribute on `command` blocks has been eliminated. Please use `$__tool_directory__` from within the tool instead. - `format="input"` on output datasets has been eliminated, please use `format_source=` to specify an exact input to derive datatype from. - Disables extra output file discovery by default, tools must explicitly describe the outputs to collect with `discover_dataset` tags. - Tools require a `version` attribute - previously an implicit default to `1.0.0` would be used. - `$param_file` has been eliminated. --- #### Clean Working Directories Previously, Galaxy would fill tool working directories with files related to metadata and job metric collection. Tools will no longer be executed in the same directory as these files. This applies to all tools not just profile `16.04`+ tools. --- ### 16.01 Full [Galaxy changelog](https://docs.galaxyproject.org/en/master/releases/16.01_announce.html). --- #### Conda Dependency Resolution ([PR #1345](https://github.com/galaxyproject/galaxy/pull/1345)) ```xml <tool> ... <requirements> <requirement type="package" version="0.11.4">FastQC</requirement> </requirements> ... </tool> ``` - Dependency resolvers tell Galaxy how to translate requirements into jobs. - The Conda dependency resolver forces Galaxy to create a conda environment for the job with `FastQC` at version `0.11.4` installed. - Only dependency resolver that can be installed at runtime - great for Docker images, heterogeneous clusters, and testing tools. - Links [Conda](https://conda.io/docs/) and [BioConda](https://bioconda.github.io/) --- #### ToolBox Enhancements - Labels ([PR #1012](https://github.com/galaxyproject/galaxy/pull/1012)) ![ToolBox Labels](images/gx_toolbox_labels.png) --- #### ToolBox Enhancements - Monitoring ([PR #1398](https://github.com/galaxyproject/galaxy/pull/1398)) - The Galaxy toolbox can be reloaded from the Admin interface. - Tool conf files (e.g. `tool_conf.xml`) can be monitored and automatically reloaded by Galaxy. - Tool conf files can now be specified as YAML (or JSON). --- #### Process Inputs as JSON ([PR #1405](https://github.com/galaxyproject/galaxy/pull/1405)) ```xml <command>python "$__tool_directory/script.py" "$json_inputs"</command> <configfiles> <inputs name="json_inputs" /> </configfiles> ``` This will produce a file referenced as `$json_inputs` that contains a nested JSON structure corresponding to the tools inputs. Of limitted utility for simple command-line tools - but complex tools with many repeats, conditional, and nesting could potentially benefit from this. For instance, the [JBrowse](https://github.com/galaxyproject/tools-iuc/blob/master/tools/jbrowse/jbrowse.xml) tool generates a complex JSON data structure using a `configfile` inside the XML. This is a much more portable way to deal with that. --- #### Collections - `data_collection` tool parameters (`param`s) can now specify multiple `collection_type`s for consumption ([PR #1308](https://github.com/galaxyproject/galaxy/pull/1308)). - This mirrors the `format` attribute which allows a comma-separated list of potential format types. - Multiple collections can now be supplied to a `multiple="true"` data parameter ([PR #805](https://github.com/galaxyproject/galaxy/pull/805)). - Output collections can specify a `type_source` attribute (again mirroring `format_source`) ([PR #1153](https://github.com/galaxyproject/galaxy/pull/1153)). --- ### 15.10 Full [Galaxy changelog](https://docs.galaxyproject.org/en/master/releases/15.10_announce.html). --- #### Collections - Tools may now produce explicit nested outputs [PR #538](https://github.com/galaxyproject/galaxy/pull/538). This enhances the `discover_dataset` XML tag to allow this. - Allow certain `output` actions on collections. [PR #544](https://github.com/galaxyproject/galaxy/pull/544). - Allow `discover_dataset` tags to use `format` instead of `ext` when referring to datatype extensions/formats. - Allow `min`/`max` attributes on multiple data input parameters [PR #765](https://github.com/galaxyproject/galaxy/pull/765). --- #### Whitelist Tools that Generate HTML ([PR #510](https://github.com/galaxyproject/galaxy/pull/510)) Galaxy now contains a plain text file that contains a list of tools whose output can be trusted when rendering HTML. --- ### 15.07 Full [Galaxy changelog](https://docs.galaxyproject.org/en/master/releases/15.07_announce.html). --- #### Parameterized XML Macros ([PR #362](https://github.com/galaxyproject/galaxy/pull/362)) Macros now allow defining tokens to be consumed as XML attributes. For instance, the following definition ```xml <tool> <expand macro="inputs" foo="hello" /> <expand macro="inputs" foo="world" /> <expand macro="inputs" /> <macros> <xml name="inputs" token_foo="the_default"> <inputs>@FOO@</inputs> </xml> </macros> </tool> ``` would expand out as ```xml <tool> <inputs>hello</inputs> <inputs>world</inputs> <inputs>the_default</inputs> </tool> ``` --- #### Tool Form The workflow editor was updated to the use Galaxy's newer frontend tool form. ![New Workflow Editor](images/gx_new_workflow_editor.png) --- #### Environment Variables ([PR #395](https://github.com/galaxyproject/galaxy/pull/395)) Tools may now use `inputs` to define environment variables that will be set during tool execution. The new `environment_variables` XML block is used to define this. ```xml <tool> ... <command> echo "\$INTVAR" > $out_file1; echo "\$FORTEST" >> $out_file1; </command> <environment_variables> <environment_variable name="INTVAR">$inttest</environment_variable> <environment_variable name="FORTEST">#for i in ['m', 'o', 'o']#$i#end for#</environment_variable> </environment_variables> ... ``` [Test tool](https://github.com/galaxyproject/galaxy/blob/dev/test/functional/tools/environment_variables.xml) demonstrating the use of the `environment_variables` tag. --- #### Collections - Explicit output collections can now be used in workflows. ([PR #311](https://github.com/galaxyproject/galaxy/pull/311)) - The `filter` tag has been implemented for output dataset collections ([PR #455](https://github.com/galaxyproject/galaxy/pull/455). See the example tool [output_collection_filter.xml](https://github.com/galaxyproject/galaxy/blob/dev/test/functional/tools/output_collection_filter.xml).
{ "pile_set_name": "Github" }
/* n2_asm.S: Hypervisor calls for NCS support. * * Copyright (C) 2009 David S. Miller <[email protected]> */ #include <linux/linkage.h> #include <asm/hypervisor.h> #include "n2_core.h" /* o0: queue type * o1: RA of queue * o2: num entries in queue * o3: address of queue handle return */ ENTRY(sun4v_ncs_qconf) mov HV_FAST_NCS_QCONF, %o5 ta HV_FAST_TRAP stx %o1, [%o3] retl nop ENDPROC(sun4v_ncs_qconf) /* %o0: queue handle * %o1: address of queue type return * %o2: address of queue base address return * %o3: address of queue num entries return */ ENTRY(sun4v_ncs_qinfo) mov %o1, %g1 mov %o2, %g2 mov %o3, %g3 mov HV_FAST_NCS_QINFO, %o5 ta HV_FAST_TRAP stx %o1, [%g1] stx %o2, [%g2] stx %o3, [%g3] retl nop ENDPROC(sun4v_ncs_qinfo) /* %o0: queue handle * %o1: address of head offset return */ ENTRY(sun4v_ncs_gethead) mov %o1, %o2 mov HV_FAST_NCS_GETHEAD, %o5 ta HV_FAST_TRAP stx %o1, [%o2] retl nop ENDPROC(sun4v_ncs_gethead) /* %o0: queue handle * %o1: address of tail offset return */ ENTRY(sun4v_ncs_gettail) mov %o1, %o2 mov HV_FAST_NCS_GETTAIL, %o5 ta HV_FAST_TRAP stx %o1, [%o2] retl nop ENDPROC(sun4v_ncs_gettail) /* %o0: queue handle * %o1: new tail offset */ ENTRY(sun4v_ncs_settail) mov HV_FAST_NCS_SETTAIL, %o5 ta HV_FAST_TRAP retl nop ENDPROC(sun4v_ncs_settail) /* %o0: queue handle * %o1: address of devino return */ ENTRY(sun4v_ncs_qhandle_to_devino) mov %o1, %o2 mov HV_FAST_NCS_QHANDLE_TO_DEVINO, %o5 ta HV_FAST_TRAP stx %o1, [%o2] retl nop ENDPROC(sun4v_ncs_qhandle_to_devino) /* %o0: queue handle * %o1: new head offset */ ENTRY(sun4v_ncs_sethead_marker) mov HV_FAST_NCS_SETHEAD_MARKER, %o5 ta HV_FAST_TRAP retl nop ENDPROC(sun4v_ncs_sethead_marker)
{ "pile_set_name": "Github" }
package com.epam.jdi.uitests.win.settings; import com.epam.commons.PropertyReader; import com.epam.jdi.uitests.core.interfaces.MapInterfaceToElement; import com.epam.jdi.uitests.core.interfaces.base.IElement; import com.epam.jdi.uitests.core.interfaces.base.ISelect; import com.epam.jdi.uitests.core.interfaces.common.IButton; import com.epam.jdi.uitests.core.interfaces.common.ICheckBox; import com.epam.jdi.uitests.core.interfaces.common.ILabel; import com.epam.jdi.uitests.core.interfaces.common.ITextArea; import com.epam.jdi.uitests.core.interfaces.complex.ICheckList; import com.epam.jdi.uitests.core.interfaces.complex.IComboBox; import com.epam.jdi.uitests.core.interfaces.complex.IDropDown; import com.epam.jdi.uitests.core.interfaces.complex.IRadioButtons; import com.epam.jdi.uitests.core.interfaces.complex.tables.interfaces.IEntityTable; import com.epam.jdi.uitests.core.interfaces.complex.tables.interfaces.ITable; import com.epam.jdi.uitests.core.logger.JDILogger; import com.epam.jdi.uitests.core.settings.JDISettings; import com.epam.jdi.uitests.win.winnium.TestNGCheck; import com.epam.jdi.uitests.win.winnium.driver.WiniumDriverFactory; import com.epam.jdi.uitests.win.winnium.elements.base.Element; import com.epam.jdi.uitests.win.winnium.elements.base.SelectElement; import com.epam.jdi.uitests.win.winnium.elements.common.Button; import com.epam.jdi.uitests.win.winnium.elements.common.CheckBox; import com.epam.jdi.uitests.win.winnium.elements.common.Label; import com.epam.jdi.uitests.win.winnium.elements.common.TextBox; import com.epam.jdi.uitests.win.winnium.elements.complex.CheckList; import com.epam.jdi.uitests.win.winnium.elements.complex.ComboBoxElement; import com.epam.jdi.uitests.win.winnium.elements.complex.Dropdown; import com.epam.jdi.uitests.win.winnium.elements.complex.RadioButtons; import com.epam.jdi.uitests.win.winnium.elements.complex.table.EntityTable; import com.epam.jdi.uitests.win.winnium.elements.complex.table.Table; import com.epam.jdi.uitests.win.winnium.elements.composite.DesktopApplication; import java.awt.*; import java.io.IOException; import static com.epam.commons.PropertyReader.fillAction; public class WinSettings extends JDISettings { public static void initFromProperties() throws IOException { driverFactory = new WiniumDriverFactory(); asserter = new TestNGCheck(); PropertyReader.getProperties(jdiSettingsPath); logger = new JDILogger("JDI Logger"); MapInterfaceToElement.init(defaultInterfacesMap); fillAction(driverFactory::setDriverPath, "drivers.folder"); fillAction(DesktopApplication::setAppPath, "domain"); JDISettings.initFromProperties(); } private static Object[][] defaultInterfacesMap = new Object[][]{ {ITextArea.class, TextBox.class}, {IButton.class, Button.class}, {IDropDown.class, Dropdown.class}, {IElement.class, Element.class}, {IButton.class, Button.class}, {IComboBox.class, ComboBoxElement.class}, {ITextArea.class, TextArea.class}, {ILabel.class, Label.class}, {IDropDown.class, Dropdown.class}, {ITable.class, Table.class}, {IEntityTable.class, EntityTable.class}, {ICheckBox.class, CheckBox.class}, {IRadioButtons.class, RadioButtons.class}, {ICheckList.class, CheckList.class}, {ISelect.class, SelectElement.class}, }; }
{ "pile_set_name": "Github" }
JXGrabKey Copyright: Edwin Stang ([email protected]) 2008 The entire code base may be distributed under the terms of the GNU Lesser General Public License (LGPL). See "LICENSE.txt" or "http://www.gnu.org/licenses/" for the complete licence.
{ "pile_set_name": "Github" }
/* Copyright 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. */ // Code generated by client-gen. DO NOT EDIT. package v1 import ( "time" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" scheme "k8s.io/client-go/kubernetes/scheme" rest "k8s.io/client-go/rest" ) // ServiceAccountsGetter has a method to return a ServiceAccountInterface. // A group's client should implement this interface. type ServiceAccountsGetter interface { ServiceAccounts(namespace string) ServiceAccountInterface } // ServiceAccountInterface has methods to work with ServiceAccount resources. type ServiceAccountInterface interface { Create(*v1.ServiceAccount) (*v1.ServiceAccount, error) Update(*v1.ServiceAccount) (*v1.ServiceAccount, error) Delete(name string, options *metav1.DeleteOptions) error DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error Get(name string, options metav1.GetOptions) (*v1.ServiceAccount, error) List(opts metav1.ListOptions) (*v1.ServiceAccountList, error) Watch(opts metav1.ListOptions) (watch.Interface, error) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ServiceAccount, err error) ServiceAccountExpansion } // serviceAccounts implements ServiceAccountInterface type serviceAccounts struct { client rest.Interface ns string } // newServiceAccounts returns a ServiceAccounts func newServiceAccounts(c *CoreV1Client, namespace string) *serviceAccounts { return &serviceAccounts{ client: c.RESTClient(), ns: namespace, } } // Get takes name of the serviceAccount, and returns the corresponding serviceAccount object, and an error if there is any. func (c *serviceAccounts) Get(name string, options metav1.GetOptions) (result *v1.ServiceAccount, err error) { result = &v1.ServiceAccount{} err = c.client.Get(). Namespace(c.ns). Resource("serviceaccounts"). Name(name). VersionedParams(&options, scheme.ParameterCodec). Do(). Into(result) return } // List takes label and field selectors, and returns the list of ServiceAccounts that match those selectors. func (c *serviceAccounts) List(opts metav1.ListOptions) (result *v1.ServiceAccountList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } result = &v1.ServiceAccountList{} err = c.client.Get(). Namespace(c.ns). Resource("serviceaccounts"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). Do(). Into(result) return } // Watch returns a watch.Interface that watches the requested serviceAccounts. func (c *serviceAccounts) Watch(opts metav1.ListOptions) (watch.Interface, error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } opts.Watch = true return c.client.Get(). Namespace(c.ns). Resource("serviceaccounts"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). Watch() } // Create takes the representation of a serviceAccount and creates it. Returns the server's representation of the serviceAccount, and an error, if there is any. func (c *serviceAccounts) Create(serviceAccount *v1.ServiceAccount) (result *v1.ServiceAccount, err error) { result = &v1.ServiceAccount{} err = c.client.Post(). Namespace(c.ns). Resource("serviceaccounts"). Body(serviceAccount). Do(). Into(result) return } // Update takes the representation of a serviceAccount and updates it. Returns the server's representation of the serviceAccount, and an error, if there is any. func (c *serviceAccounts) Update(serviceAccount *v1.ServiceAccount) (result *v1.ServiceAccount, err error) { result = &v1.ServiceAccount{} err = c.client.Put(). Namespace(c.ns). Resource("serviceaccounts"). Name(serviceAccount.Name). Body(serviceAccount). Do(). Into(result) return } // Delete takes name of the serviceAccount and deletes it. Returns an error if one occurs. func (c *serviceAccounts) Delete(name string, options *metav1.DeleteOptions) error { return c.client.Delete(). Namespace(c.ns). Resource("serviceaccounts"). Name(name). Body(options). Do(). Error() } // DeleteCollection deletes a collection of objects. func (c *serviceAccounts) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error { var timeout time.Duration if listOptions.TimeoutSeconds != nil { timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second } return c.client.Delete(). Namespace(c.ns). Resource("serviceaccounts"). VersionedParams(&listOptions, scheme.ParameterCodec). Timeout(timeout). Body(options). Do(). Error() } // Patch applies the patch and returns the patched serviceAccount. func (c *serviceAccounts) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ServiceAccount, err error) { result = &v1.ServiceAccount{} err = c.client.Patch(pt). Namespace(c.ns). Resource("serviceaccounts"). SubResource(subresources...). Name(name). Body(data). Do(). Into(result) return }
{ "pile_set_name": "Github" }
// // RMAddLocaleWindowController.h // Connecter // // Created by Markus on 26.02.14. // Copyright (c) 2014 Realmac Software. All rights reserved. // #import <Cocoa/Cocoa.h> @class RMAppMetaData; @interface RMAddLocaleWindowController : NSWindowController @property (nonatomic, weak, readonly) RMAppMetaData *metaData; @property (nonatomic, readonly) NSArray *filteredLocales; - (id)initWithMetaData:(RMAppMetaData*)metaData; @end
{ "pile_set_name": "Github" }
"use strict"; // istanbul ignore next function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var _tokenizerTypes = require("../tokenizer/types"); var _index = require("./index"); var _index2 = _interopRequireDefault(_index); var _utilWhitespace = require("../util/whitespace"); var pp = _index2["default"].prototype; // ## Parser utilities // Test whether a statement node is the string literal `"use strict"`. pp.isUseStrict = function (stmt) { return stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && stmt.expression.raw.slice(1, -1) === "use strict"; }; // TODO pp.isRelational = function (op) { return this.match(_tokenizerTypes.types.relational) && this.state.value === op; }; // TODO pp.expectRelational = function (op) { if (this.isRelational(op)) { this.next(); } else { this.unexpected(); } }; // Tests whether parsed token is a contextual keyword. pp.isContextual = function (name) { return this.match(_tokenizerTypes.types.name) && this.state.value === name; }; // Consumes contextual keyword if possible. pp.eatContextual = function (name) { return this.state.value === name && this.eat(_tokenizerTypes.types.name); }; // Asserts that following token is given contextual keyword. pp.expectContextual = function (name) { if (!this.eatContextual(name)) this.unexpected(); }; // Test whether a semicolon can be inserted at the current position. pp.canInsertSemicolon = function () { return this.match(_tokenizerTypes.types.eof) || this.match(_tokenizerTypes.types.braceR) || _utilWhitespace.lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start)); }; // Consume a semicolon, or, failing that, see if we are allowed to // pretend that there is a semicolon at this position. pp.semicolon = function () { if (!this.eat(_tokenizerTypes.types.semi) && !this.canInsertSemicolon()) this.unexpected(); }; // Expect a token of a given type. If found, consume it, otherwise, // raise an unexpected token error. pp.expect = function (type) { return this.eat(type) || this.unexpected(); }; // Raise an unexpected token error. pp.unexpected = function (pos) { this.raise(pos != null ? pos : this.state.start, "Unexpected token"); };
{ "pile_set_name": "Github" }
package porterstemmer import ( // "log" "unicode" ) func isConsonant(s []rune, i int) bool { //DEBUG //log.Printf("isConsonant: [%+v]", string(s[i])) result := true switch s[i] { case 'a', 'e', 'i', 'o', 'u': result = false case 'y': if 0 == i { result = true } else { result = !isConsonant(s, i-1) } default: result = true } return result } func measure(s []rune) uint { // Initialize. lenS := len(s) result := uint(0) i := 0 // Short Circuit. if 0 == lenS { /////////// RETURN return result } // Ignore (potential) consonant sequence at the beginning of word. for isConsonant(s, i) { //DEBUG //log.Printf("[measure([%s])] Eat Consonant [%d] -> [%s]", string(s), i, string(s[i])) i++ if i >= lenS { /////////////// RETURN return result } } // For each pair of a vowel sequence followed by a consonant sequence, increment result. Outer: for i < lenS { for !isConsonant(s, i) { //DEBUG //log.Printf("[measure([%s])] VOWEL [%d] -> [%s]", string(s), i, string(s[i])) i++ if i >= lenS { /////////// BREAK break Outer } } for isConsonant(s, i) { //DEBUG //log.Printf("[measure([%s])] CONSONANT [%d] -> [%s]", string(s), i, string(s[i])) i++ if i >= lenS { result++ /////////// BREAK break Outer } } result++ } // Return return result } func hasSuffix(s, suffix []rune) bool { lenSMinusOne := len(s) - 1 lenSuffixMinusOne := len(suffix) - 1 if lenSMinusOne <= lenSuffixMinusOne { return false } else if s[lenSMinusOne] != suffix[lenSuffixMinusOne] { // I suspect checking this first should speed this function up in practice. /////// RETURN return false } else { for i := 0; i < lenSuffixMinusOne; i++ { if suffix[i] != s[lenSMinusOne-lenSuffixMinusOne+i] { /////////////// RETURN return false } } } return true } func containsVowel(s []rune) bool { lenS := len(s) for i := 0; i < lenS; i++ { if !isConsonant(s, i) { /////////// RETURN return true } } return false } func hasRepeatDoubleConsonantSuffix(s []rune) bool { // Initialize. lenS := len(s) result := false // Do it! if 2 > lenS { result = false } else if s[lenS-1] == s[lenS-2] && isConsonant(s, lenS-1) { // Will using isConsonant() cause a problem with "YY"? result = true } else { result = false } // Return, return result } func hasConsonantVowelConsonantSuffix(s []rune) bool { // Initialize. lenS := len(s) result := false // Do it! if 3 > lenS { result = false } else if isConsonant(s, lenS-3) && !isConsonant(s, lenS-2) && isConsonant(s, lenS-1) { result = true } else { result = false } // Return return result } func step1a(s []rune) []rune { // Initialize. var result []rune = s lenS := len(s) // Do it! if suffix := []rune("sses"); hasSuffix(s, suffix) { lenTrim := 2 subSlice := s[:lenS-lenTrim] result = subSlice } else if suffix := []rune("ies"); hasSuffix(s, suffix) { lenTrim := 2 subSlice := s[:lenS-lenTrim] result = subSlice } else if suffix := []rune("ss"); hasSuffix(s, suffix) { result = s } else if suffix := []rune("s"); hasSuffix(s, suffix) { lenSuffix := 1 subSlice := s[:lenS-lenSuffix] result = subSlice } // Return. return result } func step1b(s []rune) []rune { // Initialize. var result []rune = s lenS := len(s) // Do it! if suffix := []rune("eed"); hasSuffix(s, suffix) { lenSuffix := len(suffix) subSlice := s[:lenS-lenSuffix] m := measure(subSlice) if 0 < m { lenTrim := 1 result = s[:lenS-lenTrim] } } else if suffix := []rune("ed"); hasSuffix(s, suffix) { lenSuffix := len(suffix) subSlice := s[:lenS-lenSuffix] if containsVowel(subSlice) { if suffix2 := []rune("at"); hasSuffix(subSlice, suffix2) { lenTrim := -1 result = s[:lenS-lenSuffix-lenTrim] } else if suffix2 := []rune("bl"); hasSuffix(subSlice, suffix2) { lenTrim := -1 result = s[:lenS-lenSuffix-lenTrim] } else if suffix2 := []rune("iz"); hasSuffix(subSlice, suffix2) { lenTrim := -1 result = s[:lenS-lenSuffix-lenTrim] } else if c := subSlice[len(subSlice)-1]; 'l' != c && 's' != c && 'z' != c && hasRepeatDoubleConsonantSuffix(subSlice) { lenTrim := 1 lenSubSlice := len(subSlice) result = subSlice[:lenSubSlice-lenTrim] } else if c := subSlice[len(subSlice)-1]; 1 == measure(subSlice) && hasConsonantVowelConsonantSuffix(subSlice) && 'w' != c && 'x' != c && 'y' != c { lenTrim := -1 result = s[:lenS-lenSuffix-lenTrim] result[len(result)-1] = 'e' } else { result = subSlice } } } else if suffix := []rune("ing"); hasSuffix(s, suffix) { lenSuffix := len(suffix) subSlice := s[:lenS-lenSuffix] if containsVowel(subSlice) { if suffix2 := []rune("at"); hasSuffix(subSlice, suffix2) { lenTrim := -1 result = s[:lenS-lenSuffix-lenTrim] result[len(result)-1] = 'e' } else if suffix2 := []rune("bl"); hasSuffix(subSlice, suffix2) { lenTrim := -1 result = s[:lenS-lenSuffix-lenTrim] result[len(result)-1] = 'e' } else if suffix2 := []rune("iz"); hasSuffix(subSlice, suffix2) { lenTrim := -1 result = s[:lenS-lenSuffix-lenTrim] result[len(result)-1] = 'e' } else if c := subSlice[len(subSlice)-1]; 'l' != c && 's' != c && 'z' != c && hasRepeatDoubleConsonantSuffix(subSlice) { lenTrim := 1 lenSubSlice := len(subSlice) result = subSlice[:lenSubSlice-lenTrim] } else if c := subSlice[len(subSlice)-1]; 1 == measure(subSlice) && hasConsonantVowelConsonantSuffix(subSlice) && 'w' != c && 'x' != c && 'y' != c { lenTrim := -1 result = s[:lenS-lenSuffix-lenTrim] result[len(result)-1] = 'e' } else { result = subSlice } } } // Return. return result } func step1c(s []rune) []rune { // Initialize. lenS := len(s) result := s // Do it! if 2 > lenS { /////////// RETURN return result } if 'y' == s[lenS-1] && containsVowel(s[:lenS-1]) { result[lenS-1] = 'i' } else if 'Y' == s[lenS-1] && containsVowel(s[:lenS-1]) { result[lenS-1] = 'I' } // Return. return result } func step2(s []rune) []rune { // Initialize. lenS := len(s) result := s // Do it! if suffix := []rune("ational"); hasSuffix(s, suffix) { if 0 < measure(s[:lenS-len(suffix)]) { result[lenS-5] = 'e' result = result[:lenS-4] } } else if suffix := []rune("tional"); hasSuffix(s, suffix) { if 0 < measure(s[:lenS-len(suffix)]) { result = result[:lenS-2] } } else if suffix := []rune("enci"); hasSuffix(s, suffix) { if 0 < measure(s[:lenS-len(suffix)]) { result[lenS-1] = 'e' } } else if suffix := []rune("anci"); hasSuffix(s, suffix) { if 0 < measure(s[:lenS-len(suffix)]) { result[lenS-1] = 'e' } } else if suffix := []rune("izer"); hasSuffix(s, suffix) { if 0 < measure(s[:lenS-len(suffix)]) { result = s[:lenS-1] } } else if suffix := []rune("bli"); hasSuffix(s, suffix) { // --DEPARTURE-- // } else if suffix := []rune("abli") ; hasSuffix(s, suffix) { if 0 < measure(s[:lenS-len(suffix)]) { result[lenS-1] = 'e' } } else if suffix := []rune("alli"); hasSuffix(s, suffix) { if 0 < measure(s[:lenS-len(suffix)]) { result = s[:lenS-2] } } else if suffix := []rune("entli"); hasSuffix(s, suffix) { if 0 < measure(s[:lenS-len(suffix)]) { result = s[:lenS-2] } } else if suffix := []rune("eli"); hasSuffix(s, suffix) { if 0 < measure(s[:lenS-len(suffix)]) { result = s[:lenS-2] } } else if suffix := []rune("ousli"); hasSuffix(s, suffix) { if 0 < measure(s[:lenS-len(suffix)]) { result = s[:lenS-2] } } else if suffix := []rune("ization"); hasSuffix(s, suffix) { if 0 < measure(s[:lenS-len(suffix)]) { result[lenS-5] = 'e' result = s[:lenS-4] } } else if suffix := []rune("ation"); hasSuffix(s, suffix) { if 0 < measure(s[:lenS-len(suffix)]) { result[lenS-3] = 'e' result = s[:lenS-2] } } else if suffix := []rune("ator"); hasSuffix(s, suffix) { if 0 < measure(s[:lenS-len(suffix)]) { result[lenS-2] = 'e' result = s[:lenS-1] } } else if suffix := []rune("alism"); hasSuffix(s, suffix) { if 0 < measure(s[:lenS-len(suffix)]) { result = s[:lenS-3] } } else if suffix := []rune("iveness"); hasSuffix(s, suffix) { if 0 < measure(s[:lenS-len(suffix)]) { result = s[:lenS-4] } } else if suffix := []rune("fulness"); hasSuffix(s, suffix) { if 0 < measure(s[:lenS-len(suffix)]) { result = s[:lenS-4] } } else if suffix := []rune("ousness"); hasSuffix(s, suffix) { if 0 < measure(s[:lenS-len(suffix)]) { result = s[:lenS-4] } } else if suffix := []rune("aliti"); hasSuffix(s, suffix) { if 0 < measure(s[:lenS-len(suffix)]) { result = s[:lenS-3] } } else if suffix := []rune("iviti"); hasSuffix(s, suffix) { if 0 < measure(s[:lenS-len(suffix)]) { result[lenS-3] = 'e' result = result[:lenS-2] } } else if suffix := []rune("biliti"); hasSuffix(s, suffix) { if 0 < measure(s[:lenS-len(suffix)]) { result[lenS-5] = 'l' result[lenS-4] = 'e' result = result[:lenS-3] } } else if suffix := []rune("logi"); hasSuffix(s, suffix) { // --DEPARTURE-- if 0 < measure(s[:lenS-len(suffix)]) { lenTrim := 1 result = s[:lenS-lenTrim] } } // Return. return result } func step3(s []rune) []rune { // Initialize. lenS := len(s) result := s // Do it! if suffix := []rune("icate"); hasSuffix(s, suffix) { lenSuffix := len(suffix) if 0 < measure(s[:lenS-lenSuffix]) { result = result[:lenS-3] } } else if suffix := []rune("ative"); hasSuffix(s, suffix) { lenSuffix := len(suffix) subSlice := s[:lenS-lenSuffix] m := measure(subSlice) if 0 < m { result = subSlice } } else if suffix := []rune("alize"); hasSuffix(s, suffix) { lenSuffix := len(suffix) if 0 < measure(s[:lenS-lenSuffix]) { result = result[:lenS-3] } } else if suffix := []rune("iciti"); hasSuffix(s, suffix) { lenSuffix := len(suffix) if 0 < measure(s[:lenS-lenSuffix]) { result = result[:lenS-3] } } else if suffix := []rune("ical"); hasSuffix(s, suffix) { lenSuffix := len(suffix) if 0 < measure(s[:lenS-lenSuffix]) { result = result[:lenS-2] } } else if suffix := []rune("ful"); hasSuffix(s, suffix) { lenSuffix := len(suffix) subSlice := s[:lenS-lenSuffix] m := measure(subSlice) if 0 < m { result = subSlice } } else if suffix := []rune("ness"); hasSuffix(s, suffix) { lenSuffix := len(suffix) subSlice := s[:lenS-lenSuffix] m := measure(subSlice) if 0 < m { result = subSlice } } // Return. return result } func step4(s []rune) []rune { // Initialize. lenS := len(s) result := s // Do it! if suffix := []rune("al"); hasSuffix(s, suffix) { lenSuffix := len(suffix) subSlice := s[:lenS-lenSuffix] m := measure(subSlice) if 1 < m { result = result[:lenS-lenSuffix] } } else if suffix := []rune("ance"); hasSuffix(s, suffix) { lenSuffix := len(suffix) subSlice := s[:lenS-lenSuffix] m := measure(subSlice) if 1 < m { result = result[:lenS-lenSuffix] } } else if suffix := []rune("ence"); hasSuffix(s, suffix) { lenSuffix := len(suffix) subSlice := s[:lenS-lenSuffix] m := measure(subSlice) if 1 < m { result = result[:lenS-lenSuffix] } } else if suffix := []rune("er"); hasSuffix(s, suffix) { lenSuffix := len(suffix) subSlice := s[:lenS-lenSuffix] m := measure(subSlice) if 1 < m { result = subSlice } } else if suffix := []rune("ic"); hasSuffix(s, suffix) { lenSuffix := len(suffix) subSlice := s[:lenS-lenSuffix] m := measure(subSlice) if 1 < m { result = subSlice } } else if suffix := []rune("able"); hasSuffix(s, suffix) { lenSuffix := len(suffix) subSlice := s[:lenS-lenSuffix] m := measure(subSlice) if 1 < m { result = subSlice } } else if suffix := []rune("ible"); hasSuffix(s, suffix) { lenSuffix := len(suffix) subSlice := s[:lenS-lenSuffix] m := measure(subSlice) if 1 < m { result = subSlice } } else if suffix := []rune("ant"); hasSuffix(s, suffix) { lenSuffix := len(suffix) subSlice := s[:lenS-lenSuffix] m := measure(subSlice) if 1 < m { result = subSlice } } else if suffix := []rune("ement"); hasSuffix(s, suffix) { lenSuffix := len(suffix) subSlice := s[:lenS-lenSuffix] m := measure(subSlice) if 1 < m { result = subSlice } } else if suffix := []rune("ment"); hasSuffix(s, suffix) { lenSuffix := len(suffix) subSlice := s[:lenS-lenSuffix] m := measure(subSlice) if 1 < m { result = subSlice } } else if suffix := []rune("ent"); hasSuffix(s, suffix) { lenSuffix := len(suffix) subSlice := s[:lenS-lenSuffix] m := measure(subSlice) if 1 < m { result = subSlice } } else if suffix := []rune("ion"); hasSuffix(s, suffix) { lenSuffix := len(suffix) subSlice := s[:lenS-lenSuffix] m := measure(subSlice) c := subSlice[len(subSlice)-1] if 1 < m && ('s' == c || 't' == c) { result = subSlice } } else if suffix := []rune("ou"); hasSuffix(s, suffix) { lenSuffix := len(suffix) subSlice := s[:lenS-lenSuffix] m := measure(subSlice) if 1 < m { result = subSlice } } else if suffix := []rune("ism"); hasSuffix(s, suffix) { lenSuffix := len(suffix) subSlice := s[:lenS-lenSuffix] m := measure(subSlice) if 1 < m { result = subSlice } } else if suffix := []rune("ate"); hasSuffix(s, suffix) { lenSuffix := len(suffix) subSlice := s[:lenS-lenSuffix] m := measure(subSlice) if 1 < m { result = subSlice } } else if suffix := []rune("iti"); hasSuffix(s, suffix) { lenSuffix := len(suffix) subSlice := s[:lenS-lenSuffix] m := measure(subSlice) if 1 < m { result = subSlice } } else if suffix := []rune("ous"); hasSuffix(s, suffix) { lenSuffix := len(suffix) subSlice := s[:lenS-lenSuffix] m := measure(subSlice) if 1 < m { result = subSlice } } else if suffix := []rune("ive"); hasSuffix(s, suffix) { lenSuffix := len(suffix) subSlice := s[:lenS-lenSuffix] m := measure(subSlice) if 1 < m { result = subSlice } } else if suffix := []rune("ize"); hasSuffix(s, suffix) { lenSuffix := len(suffix) subSlice := s[:lenS-lenSuffix] m := measure(subSlice) if 1 < m { result = subSlice } } // Return. return result } func step5a(s []rune) []rune { // Initialize. lenS := len(s) result := s // Do it! if 'e' == s[lenS-1] { lenSuffix := 1 subSlice := s[:lenS-lenSuffix] m := measure(subSlice) if 1 < m { result = subSlice } else if 1 == m { if c := subSlice[len(subSlice)-1]; !(hasConsonantVowelConsonantSuffix(subSlice) && 'w' != c && 'x' != c && 'y' != c) { result = subSlice } } } // Return. return result } func step5b(s []rune) []rune { // Initialize. lenS := len(s) result := s // Do it! if 2 < lenS && 'l' == s[lenS-2] && 'l' == s[lenS-1] { lenSuffix := 1 subSlice := s[:lenS-lenSuffix] m := measure(subSlice) if 1 < m { result = subSlice } } // Return. return result } func StemString(s string) string { // Convert string to []rune runeArr := []rune(s) // Stem. runeArr = Stem(runeArr) // Convert []rune to string str := string(runeArr) // Return. return str } func Stem(s []rune) []rune { // Initialize. lenS := len(s) // Short circuit. if 0 == lenS { /////////// RETURN return s } // Make all runes lowercase. for i := 0; i < lenS; i++ { s[i] = unicode.ToLower(s[i]) } // Stem result := StemWithoutLowerCasing(s) // Return. return result } func StemWithoutLowerCasing(s []rune) []rune { // Initialize. lenS := len(s) // Words that are of length 2 or less is already stemmed. // Don't do anything. if 2 >= lenS { /////////// RETURN return s } // Stem s = step1a(s) s = step1b(s) s = step1c(s) s = step2(s) s = step3(s) s = step4(s) s = step5a(s) s = step5b(s) // Return. return s }
{ "pile_set_name": "Github" }
## How to prepare for DevOps/SRE/Production Engineer interviews? Note: the following is opinionated. ### Skills you should have #### Linux Every DevOps Engineer should have a deep understanding of at least one operating system and if you have the option to choose then I would say it should definitely be Linux as I believe it's a requirement of at least 90% of the DevOps jobs postings out there. Usually, the followup question is "How extensive should my knowledge be?" Out of all the DevOps skills, I would say this, along with coding, should be your strongest skills. Be familiar with OS processes, debugging tools, filesystem, networking, ... know your operating system, understand how it works, how to manage issues, etc. Not long ago, I've created a list of Linux resources right [here](https://dev.to/abregman/collection-of-linux-resources-3nhk). There are some good sites there that you can use for learning more about Linux. #### Coding My personal belief is that any DevOps engineer should know coding, at least to some degree. Having this skill you can automate manual processes, improve some of the open source tools you are using today or build new tools & projects to provide a solution to existing problems. Knowing how to code = a lot of power. When it comes to interviews you'll notice that the level of knowledge very much depends on the company or position you are interviewing for. Some will require you just to be able to write simple scripts while others will deep dive into common algorithms, data structures, etc. It's usually clear from the job requirements or phone interview. The best way to practice this skill is by doing some actual coding - scripts, online challenges, CLI tools, web applications, ... just code :) Also, the following is probably clear to most people but let's still clarify it: when given the chance to choose any language for answering coding tasks/questions, choose the one you have experience with! Some candidates prefer to choose the language they think the company is using and this is a huge mistake since giving the right answer is always better than a wrong answer, no matter which language you have used :) I recommend the following sites for practicing coding: * [HackerRank](https://www.hackerrank.com) * [LeetCode](https://leetcode.com) * [Exercism](https://exercism.io) Starting your own project is also a good idea. More on that later on. #### Architecture and Design This is also an important aspect of DevOps. You should be able to describe how to design different systems, workflows, and architectures. Also, the scale is an important aspect of that. A design which might work for a dozen of hosts or X amount of data, will not necessarily work well with bigger scale. Some ideas for you to explore: * How to design and implement a CI pipeline (or pipelines) for verifying PRs, run multiple different types of tests, package the project and deploy it somewhere * How to design and implement secured ELK architecture which will get logs from 10,000 apps and will display the data eventually to the user * Microservices designs are also quite popular these days I recommend going over the following GitHub projects as they are really deep-diving into System Design: * https://github.com/donnemartin/system-design-primer #### Tools Some interviews will focus on specific tools or technologies. Which tools? this is mainly based on a combination of what you mentioned in your C.V & those that are mentioned in the job posting and used in the company. Here are some questions I believe anyone should know to answer regarding the tools he/she is familiar with: * What the tool does? What it allows us to achieve that we couldn't do without it? * What its advantages over other tools in the same area, with the same purpose? Why you specifically using it? * How it works? * How to use it? Let's deep dive into practical preparation steps ### Scenarios || Challenges || Tasks This is a very common way to interview today for DevOps roles. The candidate is given a task which represents a common task of DevOps Engineers or a piece of common knowledge and the candidate has several hours or days to accomplish the task.<br> This is a great way to prepare for interviews and I recommend to try it out before actually interviewing. How? Take requirements from job posts and convert them into scenarios. Let's see an example: "Knowledge in CI/CD" -> Scenario: create a CI/CD pipeline for a project. At this point, some people ask: "but what project?" and the answer is: what about GitHub? it has only 9125912851285192 projects...and a free way to set up CI to any of them (also a great way to learn how to collaborate with others :) ) Let's convert another scenario: "Experience with provisioning servers" -> Scenario: provision a server (to make it more interesting: create a web server). And the last example: "Experience with scripting" -> Scenario: write a script. Don't waste too much time thinking "what script should I write?". Simply automate something you are doing manually or even implement your own version of common small utils. ### Start your own DevOps project Starting a DevOps project is a good idea because: * It will make you practice coding * It will be something you can add to your resume and talk about with the interviewer * Depends on size and complexity, it can teach you something about design in general * Depends on adoption, it can you teach you about managing Open Source projects Same here, don't overthink what your project should be about. Just go and build something :) ### Sample interview questions Make a sample list of interview questions on various topics/areas like technical, company, role, ... and try to answer them. See if you can manage to answer them in a fluent, detailed way. Better yet, ask a good friend/colleague to challenge you with some questions. Your self-awareness might be an obstacle in objective self-review of your knowledge :) ### Networking For those who attend technical meetups and conferences, it can be a great opportunity to chat with people from other companies on their interviewing process. But don't start with it, it can be quite awkward. Say at least hello first... (: Doing so can give you a lot of information on what to expect from an interview at some companies or how to how to better prepare. ### Know your resume It may sound trivial but the idea here is simple: be ready to answer any question regarding any line you included in your resume. Sometimes candidates surprised when they are asked on a skill or line which seems to be not related to the position but the simple truth is: if you mentioned something on your resume, it's only fair to ask you about it. ### Know the company Be familiar with the company you are interviewing at. Some ideas: * What the company does? * What products it has? * Why its products are unique (or better than other products)? This can also be a good question for you to ask ### Books From my experience, this is not done by many candidates but it's one of the best ways to deep dive into topics like operating system, virtualization, scale, distributed systems, etc. In most cases, you will do fine without reading books but for the AAA interviews (hardest level) you'll want to read some books and overall if you inspire to be better DevOps Engineer, books (also articles, blog posts) is a great way :) ### Consider starting in non-DevOps position While not a preparation step, you should know that landing DevOps as a first position can be challenging. No, it's not impossible but still, since DevOps covers many different practices, tools, ... it can be quite challenging and also overwhelming for someone to try and achieve it as a first position.<br> A possible path to becoming a DevOps engineer is to start with actually a different (but related) position and switch from there after 1-2 years or more. Some ideas: * System Administrator - This is perfect because every DevOps Engineer should have a solid understanding of the OS and sysadmins know their OS :) * Software Developer/Engineer - A DevOps should have coding skills and this position will provide more than the required knowledge in most cases * QA Engineer - This is a more tricky one because IMHO there are less overlapping areas/skills with DevOps Engineer. Sure, DevOps engineers should have some knowledge about testing but usually, it seems their solid skills/background is mainly composed out of system internals and coding skills. ### What to expect from a DevOps interview? DevOps interviews can be very different. Some will include design questions, some will focus on coding, others will include short technical questions and you might even have an interview where the interviewer only goes over your resume and discussing your past experience. There are a couple of things you can do about it so it will be a less overwhelming experience: 1. You can and probably should ask the HR (in some cases even the team lead) how the interview process looks like. Some will be kind enough to even tell you how to prepare. 2. Usually, the job posting gives more than a hint on where the focus will be and what you should focus on in your preparations so read it carefully. 3. There are plenty of sites that have notes or a summary of the interview process in different companies, especially big enterprises. ### Don't forget to be an interviewer as well Some people tend to look at interviews as a one-way road of "Determining whether a candidate is qualified" but in reality, a candidate should also determine whether the company he/she is interviewing at, is the right place for him/her. * Do I care about team size? More specifically, do I care about being a one-man show or being part of a bigger team? * Do I care about work-life balance? * Do I care about personal growth and how it's practically done? * Do I care about knowing what are my responsibilities as part of the role? If you do, you should also play the interviewer role :) ### One Last Thing [Good luck](https://youtu.be/AFUrG1-BAt4?t=59) :)
{ "pile_set_name": "Github" }
:020000023000CC :10FC000001C0F3C0112484B790E890936100109272 :10FC10006100882369F0982F9A70923049F081FF33 :10FC200002C097EF94BF282E80E002D10C94000010 :10FC300085E08093810082E08093300188E18093A9 :10FC4000310189E18093340186E0809332018EE0B6 :10FC5000EFD0279A84E024E23DEF91E030938500D5 :10FC60002093840096BBB09BFECF1F9AA89540912D :10FC7000300147FD02C0815089F7CED0813479F43C :10FC8000CBD0C82FDBD0C23811F480E004C088E0AC :10FC9000C13809F083E0B9D080E1B7D0EECF82342B :10FCA00019F484E1D3D0F8CF853411F485E0FACF8C :10FCB000853581F4B1D0E82EAFD0F82E87FF07C08C :10FCC0008BB781608BBFEE0CFF1CB8D0E5CF8BB734 :10FCD0008E7FF8CF863579F49FD08D3451F49CD047 :10FCE000CBB79AD0C170880F8C2B8BBF81E0AED080 :10FCF000CCCF83E0FCCF843609F046C08DD0C82F2E :10FD0000D0E0DC2FCC2788D0C82B86D0D82E5E013F :10FD10008EEFB81A00E012E04801EFEF8E1A9E0A4B :10FD20007BD0F801808384018A149B04A9F786D0D4 :10FD3000F5E410E000E0DF1609F150E040E063E098 :10FD4000C70153D08701C12C92E0D92EF601419111 :10FD500051916F0161E0C80148D00E5F1F4F22979B :10FD6000A9F750E040E065E0C7013FD095CF608142 :10FD7000C8018E0D9F1D79D00F5F1F4FF801FE5FE8 :10FD8000C017D107A1F788CF843701F545D0C82F18 :10FD9000D0E0DC2FCC2740D0C82B3ED0D82E4ED080 :10FDA0008701F5E4DF120BC0CE0DDF1DC80155D071 :10FDB0002CD00F5F1F4FC017D107C1F76DCFF801CF :10FDC00087918F0122D02197D1F766CF853739F4FB :10FDD00035D08EE11AD088E918D081E05CCF81352A :10FDE00009F073CF88E024D070CFFC010A0167BF0F :10FDF000E895112407B600FCFDCF667029F0452B6D :10FE000019F481E187BFE89508959091300195FF3D :10FE1000FCCF8093360108958091300187FFFCCF9D :10FE20008091300184FD01C0A8958091360108952C :10FE3000E0E6F0E098E1908380830895EDDF803282 :10FE400019F088E0F5DFFFCF84E1DFCFCF93C82F33 :10FE5000E3DFC150E9F7CF91F1CFF999FECF92BD21 :10FE600081BDF89A992780B50895262FF999FECF7C :10FE70001FBA92BD81BD20BD0FB6F894FA9AF99AC7 :06FE80000FBE019608957B :02FFFE000008F9 :040000033000FC00CD :00000001FF
{ "pile_set_name": "Github" }
version https://git-lfs.github.com/spec/v1 oid sha256:bc6f3cdebd5d005fec28baab5240fd9228d8adf7fd09fc2483619befc965e16c size 10198
{ "pile_set_name": "Github" }
import * as React from 'react'; import * as ReactDOM from 'react-dom'; import { DialogContent, DialogFooter, DefaultButton, PrimaryButton, autobind, Pivot, PivotItem, TextField, Label, Icon } from 'office-ui-fabric-react'; import { BaseDialog, IDialogConfiguration } from '@microsoft/sp-dialog'; import { MonacoEditor } from '../monacoEditor/MonacoEditor'; import { PropertyPaneFieldType, IPropertyPaneCustomFieldProps, IPropertyPaneField } from '@microsoft/sp-webpart-base'; import { assign } from '@microsoft/sp-lodash-subset'; import styles from '../SiteDesignsStudio.module.scss'; import * as strings from 'SiteDesignsStudioWebPartStrings'; import { HttpClient } from '@microsoft/sp-http'; import { IServiceConsumerComponentProps } from '../ISiteDesignsStudioProps'; import { SiteScriptSchemaServiceKey, ISiteScriptSchemaService } from '../../services/siteScriptSchema/SiteScriptSchemaService'; const jsonSchemaDraft06 = require('ajv/lib/refs/json-schema-draft-06.json'); export interface ISchemaPropertyEditorProps extends IServiceConsumerComponentProps { value: string; onSchemaPropertyChanged: (value: string) => void; label: string; stateKey?: string; } export interface ISchemaPropertyEditorDialogProps extends ISchemaPropertyEditorProps { onClose: () => void; } export interface ISchemaPropertyEditorInternalProps extends ISchemaPropertyEditorProps, IPropertyPaneCustomFieldProps {} interface ISchemaEditorDialogComponentState { selectedTab: string; jsonMetaSchema: any; useBuiltInSchema: boolean; builtInSchemaString: string; refreshKey: string; } class SchemaEditorDialogComponent extends React.Component< ISchemaPropertyEditorDialogProps, ISchemaEditorDialogComponentState > { private savedPropertyValue: string; private schemaService: ISiteScriptSchemaService; constructor(props: ISchemaPropertyEditorDialogProps) { super(props); this.state = { selectedTab: !props.value ? 'direct' : this._isUrl(props.value) ? 'url' : 'direct', useBuiltInSchema: (!props.value || false) && true, builtInSchemaString: null, jsonMetaSchema: {}, refreshKey: null }; } public componentWillMount() { this.schemaService = this.props.serviceScope.consume(SiteScriptSchemaServiceKey); const builtInSchema = this.schemaService.getSiteScriptSchema(); console.log('Built in schema', builtInSchema); setTimeout(() => { this.setState({ jsonMetaSchema: jsonSchemaDraft06, builtInSchemaString: JSON.stringify(builtInSchema, null, 2) }); }, 100); } public render() { let { value } = this.props; let { selectedTab, useBuiltInSchema, builtInSchemaString } = this.state; let isUrl = !useBuiltInSchema && this._isUrl(value); let isCustomJsonSchema = !useBuiltInSchema && !isUrl && this._isJsonSchema(value); return ( <DialogContent title={strings.SchemaPropertyEditorDialogTitle} onDismiss={() => this._onClose()} showCloseButton={true} > <div className={styles.settingsDialogContent}> <Pivot selectedKey={selectedTab} onLinkClick={(tab) => this._onTabChange(tab)}> <PivotItem linkText="Url" itemKey="url" /> <PivotItem linkText="Direct" itemKey="direct" /> </Pivot> {selectedTab == 'url' && ( <TextField label={'Url'} width={300} value={isUrl ? value : ''} placeholder="(e.g. /siteassets/site-design-schema.json)" onChanged={(v) => this._onValueChanged(v)} /> )} {selectedTab == 'direct' && ( <div className={styles.codeEditorContainer}> <div className={styles.codeEditor}> <MonacoEditor schemaUri="http://json-schema.org/draft-06/schema#" schema={this.state.jsonMetaSchema} value={useBuiltInSchema ? builtInSchemaString : (isCustomJsonSchema ? value : '{\n}')} onValueChange={(content, errors) => this._onValueChanged(content)} readOnly={false} /> </div> {useBuiltInSchema && <Label><Icon iconName="InfoSolid" /> The built-in schema is used.</Label>} </div> )} </div> <DialogFooter> <PrimaryButton text={strings.SchemaPropertyEditorOkButtonLabel} title={strings.SchemaPropertyEditorOkButtonLabel} onClick={() => this._onClose(true)} /> <DefaultButton text={strings.SchemaPropertyEditorResetButtonLabel} title={strings.SchemaPropertyEditorResetButtonLabel} onClick={() => this._resetToDefault()} /> <DefaultButton text={strings.SchemaPropertyEditorCancelButtonLabel} title={strings.SchemaPropertyEditorCancelButtonLabel} onClick={() => this._onClose()} /> </DialogFooter> </DialogContent> ); } private _onTabChange(item: PivotItem) { this.setState({ selectedTab: item.props.itemKey }); } @autobind private _resetToDefault() { if (this.props.onSchemaPropertyChanged) { this.props.onSchemaPropertyChanged(null); this.setState({refreshKey: new Date().toString()}); } } @autobind private _onClose(saveProperty: boolean = false) { if (this.props.onSchemaPropertyChanged && saveProperty) { this.props.onSchemaPropertyChanged(this.savedPropertyValue); this.setState({refreshKey: new Date().toString()}); } this.props.onClose(); } private _isUrl(value: string): boolean { return value && (value.indexOf('http://') == 0 || value.indexOf('https://') == 0 || value.indexOf('/') == 0); } private _isJsonSchema(value: string): boolean { return value && value.indexOf('{') == 0; } private _onValueChanged(value: string) { this.savedPropertyValue = value; // if (value) { // this.setState({useBuiltInSchema: false}); // } } } export class SchemaEditorDialog extends BaseDialog { constructor(public properties: ISchemaPropertyEditorDialogProps) { super(); } public render(): void { ReactDOM.render( <SchemaEditorDialogComponent onClose={() => this.close()} onSchemaPropertyChanged={this.properties.onSchemaPropertyChanged} label={this.properties.label} value={this.properties.value} serviceScope={this.properties.serviceScope} />, this.domElement ); } public getConfig(): IDialogConfiguration { return { isBlocking: false }; } } export class SchemaPropertyEditor extends React.Component<ISchemaPropertyEditorProps, {}> { constructor(props: ISchemaPropertyEditorProps) { super(props); } public render(): React.ReactElement<ISchemaPropertyEditorProps> { return <PrimaryButton text={this.props.label} onClick={() => this._showDialog()} />; } private _showDialog() { let dialogProps = assign({}, this.props) as ISchemaPropertyEditorDialogProps; const dialog: SchemaEditorDialog = new SchemaEditorDialog(dialogProps); dialog.show(); } } export class PropertyPaneSchemaEditor implements IPropertyPaneField<ISchemaPropertyEditorInternalProps> { public type: PropertyPaneFieldType = PropertyPaneFieldType.Custom; public targetProperty: string; public properties: ISchemaPropertyEditorInternalProps; private elem: HTMLElement; constructor(targetProperty: string, properties: ISchemaPropertyEditorProps) { this.targetProperty = targetProperty; this.properties = { label: properties.label, onSchemaPropertyChanged: properties.onSchemaPropertyChanged, onRender: this.onRender.bind(this), key: properties.label, value: properties.value, serviceScope: properties.serviceScope }; } public render(): void { if (!this.elem) { return; } this.onRender(this.elem); } private onRender(elem: HTMLElement): void { if (!this.elem) { this.elem = elem; } ReactDOM.render( <SchemaPropertyEditor onSchemaPropertyChanged={(value) => this.onChanged(value)} value={this.properties.value} label={this.properties.label} serviceScope={this.properties.serviceScope} stateKey={new Date().toString()} />, elem ); } private onChanged(value: string): void { console.log('schema property changed: ', value); this.properties.onSchemaPropertyChanged(value); } }
{ "pile_set_name": "Github" }
/*! * jQuery UI Effects Fade 1.11.4 * http://jqueryui.com * * Copyright jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/fade-effect/ */ (function( factory ) { if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. define([ "jquery", "./effect" ], factory ); } else { // Browser globals factory( jQuery ); } }(function( $ ) { return $.effects.effect.fade = function( o, done ) { var el = $( this ), mode = $.effects.setMode( el, o.mode || "toggle" ); el.animate({ opacity: mode }, { queue: false, duration: o.duration, easing: o.easing, complete: done }); }; }));
{ "pile_set_name": "Github" }
import fs from '../../../../src/core/node_fs'; import assert from '../../../harness/wrapped-assert'; import common from '../../../harness/common'; export default function() { if (!fs.getRootFS().isReadOnly()) { var pathname1 = common.tmpDir + '/mkdir-test1'; fs.mkdir(pathname1, function(err: NodeJS.ErrnoException) { assert.equal(err, null, 'fs.mkdir(' + pathname1 + ') reports non-null error: ' + err); fs.exists(pathname1, function(y){ assert.equal(y, true, 'Got null error from fs.mkdir, but fs.exists reports false for ' + pathname1); }); }); var pathname2 = common.tmpDir + '/mkdir-test2'; fs.mkdir(pathname2, 511 /*=0777*/, function(err) { assert.equal(err, null, 'fs.mkdir(' + pathname2 + ') reports non-null error: ' + err); fs.exists(pathname2, function(y){ assert.equal(y, true, 'Got null error from fs.mkdir, but fs.exists reports false for ' + pathname2); }); }); // Shouldn't be able to make multi-level dirs. var pathname3 = common.tmpDir + '/mkdir-test3/again'; fs.mkdir(pathname3, 511 /*=0777*/, function(err) { assert.notEqual(err, null, 'fs.mkdir(' + pathname3 + ') reports null error'); }); } };
{ "pile_set_name": "Github" }
#include "draw_nodes/CCShapeNode.h" #include "support/CCPointExtension.h" NS_CC_BEGIN void CCShapeNode::draw(void) { beforeDraw(); drawProc(); afterDraw(); } void CCShapeNode::beforeDraw(void) { glLineWidth(m_lineWidth); ccDrawColor4F(m_color.r, m_color.g, m_color.b, m_color.a); #ifdef GL_LINE_STIPPLE if (m_lineStippleEnabled) { glEnable(GL_LINE_STIPPLE); glLineStipple(1, m_lineStipple); } #endif } void CCShapeNode::afterDraw(void) { glLineWidth(1); ccDrawColor4F(1, 1, 1, 1); #ifdef GL_LINE_STIPPLE if (m_lineStippleEnabled) { glDisable(GL_LINE_STIPPLE); glLineStipple(1, 0xFFFF); } #endif } CCCircleShape* CCCircleShape::create(float radius) { CCCircleShape* circle = new CCCircleShape(radius); circle->autorelease(); return circle; } CCCircleShape* CCCircleShape::create(float radius, bool fill) { CCCircleShape* circle = CCCircleShape::create(radius); circle->setFill(fill); return circle; } void CCCircleShape::drawProc(void) { ccDrawCircle(getDrawPosition(), m_radius, m_angle, m_segments, m_drawLineToCenter, m_scaleX, m_scaleY, m_fill); } CCRectShape* CCRectShape::create(const cocos2d::CCSize &size) { CCRectShape* rect = new CCRectShape(size); rect->autorelease(); return rect; } void CCRectShape::drawProc(void) { const CCPoint center = getDrawPosition(); float w = m_size.width / 2; float h = m_size.height / 2; if (m_fill) { ccDrawSolidRect(ccp(center.x - w, center.y + h), ccp(center.x + w, center.y - h), m_color); } else { ccDrawColor4F(m_color.r, m_color.g, m_color.b, m_color.a); ccDrawRect(ccp(center.x - w, center.y + h), ccp(center.x + w, center.y - h)); } } CCPointShape* CCPointShape::create(void) { CCPointShape* point = new CCPointShape(); point->autorelease(); return point; } void CCPointShape::drawProc(void) { ccDrawPoint(getDrawPosition()); } CCPolygonShape* CCPolygonShape::create(CCPoint* vertices, unsigned int numVertices) { CCPolygonShape* polygon = new CCPolygonShape(); polygon->initWithVertices(vertices, numVertices); polygon->autorelease(); return polygon; } CCPolygonShape* CCPolygonShape::create(CCPointArray* vertices) { CCPolygonShape* polygon = new CCPolygonShape(); polygon->initWithVertices(vertices); polygon->autorelease(); return polygon; } bool CCPolygonShape::initWithVertices(CCPoint* vertices, unsigned int numVertices) { m_numberOfVertices = numVertices; m_vertices = new CCPoint[m_numberOfVertices]; m_verticesDraw = new CCPoint[m_numberOfVertices]; for (unsigned int i = 0; i < m_numberOfVertices; ++i) { m_verticesDraw[i] = m_vertices[i] = vertices[i]; } return true; } bool CCPolygonShape::initWithVertices(CCPointArray* vertices) { CCPoint* points = vertices->fetchPoints(); bool ret = initWithVertices(points, vertices->count()); delete []points; return ret; } CCPolygonShape::~CCPolygonShape(void) { delete[] m_vertices; delete[] m_verticesDraw; } void CCPolygonShape::drawProc(void) { const CCPoint center = getDrawPosition(); for (unsigned int i = 0; i < m_numberOfVertices; ++i) { m_verticesDraw[i].x = m_vertices[i].x + center.x; m_verticesDraw[i].y = m_vertices[i].y + center.y; } if (m_fill) { ccDrawSolidPoly(m_verticesDraw, m_numberOfVertices, m_color); } else { ccDrawColor4F(m_color.r, m_color.g, m_color.b, m_color.a); ccDrawPoly(m_verticesDraw, m_numberOfVertices, m_close); } } NS_CC_END
{ "pile_set_name": "Github" }
{ "stackLimitGas_1023" : { "_info" : { "comment" : "", "filling-rpc-server" : "Geth-1.9.6-unstable-63b18027-20190920", "filling-tool-version" : "retesteth-0.0.1+commit.0ae18aef.Linux.g++", "lllcversion" : "Version: 0.5.12-develop.2019.9.13+commit.2d601a4f.Linux.g++", "source" : "src/GeneralStateTestsFiller/stMemoryTest/stackLimitGas_1023Filler.json", "sourceHash" : "3274e5a89ded4dc75e37dbc9583931c1b99bc54a8a32c1e20633b92d183beb4b" }, "env" : { "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentDifficulty" : "0x020000", "currentGasLimit" : "0x0a00000000", "currentNumber" : "0x01", "currentTimestamp" : "0x03e8", "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" }, "post" : { "Istanbul" : [ { "indexes" : { "data" : 0, "gas" : 0, "value" : 0 }, "hash" : "0x4cfa5b5f8b8fdd4b54301043b8c88db995a6fd7c24f9f77c83b1ca846cf222af", "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" } ] }, "pre" : { "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { "balance" : "0x0de0b6b3a7640000", "code" : "0x6103fd6000525b5a6001600051036000526000516006570000", "nonce" : "0x00", "storage" : { } }, "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "0x6400000000", "code" : "0x", "nonce" : "0x00", "storage" : { } } }, "transaction" : { "data" : [ "0x" ], "gasLimit" : [ "0x0186a0" ], "gasPrice" : "0x01", "nonce" : "0x00", "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "to" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", "value" : [ "0x0a" ] } } }
{ "pile_set_name": "Github" }
///////////////////////////////////////////////////////////////////////////// // Name: htmlfilt.h // Purpose: filters // Author: Vaclav Slavik // RCS-ID: $Id: htmlfilt.h 35650 2005-09-23 12:56:45Z MR $ // Copyright: (c) 1999 Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_HTMLFILT_H_ #define _WX_HTMLFILT_H_ #include "wx/defs.h" #if wxUSE_HTML #include "wx/filesys.h" //-------------------------------------------------------------------------------- // wxHtmlFilter // This class is input filter. It can "translate" files // in non-HTML format to HTML format // interface to access certain // kinds of files (HTPP, FTP, local, tar.gz etc..) //-------------------------------------------------------------------------------- class WXDLLIMPEXP_HTML wxHtmlFilter : public wxObject { DECLARE_ABSTRACT_CLASS(wxHtmlFilter) public: wxHtmlFilter() : wxObject() {} virtual ~wxHtmlFilter() {} // returns true if this filter is able to open&read given file virtual bool CanRead(const wxFSFile& file) const = 0; // Reads given file and returns HTML document. // Returns empty string if opening failed virtual wxString ReadFile(const wxFSFile& file) const = 0; }; //-------------------------------------------------------------------------------- // wxHtmlFilterPlainText // This filter is used as default filter if no other can // be used (= uknown type of file). It is used by // wxHtmlWindow itself. //-------------------------------------------------------------------------------- class WXDLLIMPEXP_HTML wxHtmlFilterPlainText : public wxHtmlFilter { DECLARE_DYNAMIC_CLASS(wxHtmlFilterPlainText) public: virtual bool CanRead(const wxFSFile& file) const; virtual wxString ReadFile(const wxFSFile& file) const; }; //-------------------------------------------------------------------------------- // wxHtmlFilterHTML // filter for text/html //-------------------------------------------------------------------------------- class wxHtmlFilterHTML : public wxHtmlFilter { DECLARE_DYNAMIC_CLASS(wxHtmlFilterHTML) public: virtual bool CanRead(const wxFSFile& file) const; virtual wxString ReadFile(const wxFSFile& file) const; }; #endif // wxUSE_HTML #endif // _WX_HTMLFILT_H_
{ "pile_set_name": "Github" }
dnl This is the newlib/libc/sys/d10v configure.in file. dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) AC_INIT([newlib],[NEWLIB_VERSION]) AC_CONFIG_SRCDIR([creat.c]) dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake. AC_CONFIG_AUX_DIR(../../../..) NEWLIB_CONFIGURE(../../..) AC_CONFIG_FILES([Makefile]) AC_OUTPUT
{ "pile_set_name": "Github" }
/* __ _____ _____ _____ __| | __| | | | JSON for Modern C++ (test suite) | | |__ | | | | | | version 3.9.1 |_____|_____|_____|_|___| https://github.com/nlohmann/json Licensed under the MIT License <http://opensource.org/licenses/MIT>. SPDX-License-Identifier: MIT Copyright (c) 2013-2019 Niels Lohmann <http://nlohmann.me>. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "doctest_compatibility.h" #define JSON_TESTS_PRIVATE #include <nlohmann/json.hpp> using nlohmann::json; #include <sstream> namespace { void check_escaped(const char* original, const char* escaped = "", const bool ensure_ascii = false); void check_escaped(const char* original, const char* escaped, const bool ensure_ascii) { std::stringstream ss; json::serializer s(nlohmann::detail::output_adapter<char>(ss), ' '); s.dump_escaped(original, ensure_ascii); CHECK(ss.str() == escaped); } } TEST_CASE("convenience functions") { SECTION("type name as string") { CHECK(std::string(json(json::value_t::null).type_name()) == "null"); CHECK(std::string(json(json::value_t::object).type_name()) == "object"); CHECK(std::string(json(json::value_t::array).type_name()) == "array"); CHECK(std::string(json(json::value_t::number_integer).type_name()) == "number"); CHECK(std::string(json(json::value_t::number_unsigned).type_name()) == "number"); CHECK(std::string(json(json::value_t::number_float).type_name()) == "number"); CHECK(std::string(json(json::value_t::binary).type_name()) == "binary"); CHECK(std::string(json(json::value_t::boolean).type_name()) == "boolean"); CHECK(std::string(json(json::value_t::string).type_name()) == "string"); CHECK(std::string(json(json::value_t::discarded).type_name()) == "discarded"); } SECTION("string escape") { check_escaped("\"", "\\\""); check_escaped("\\", "\\\\"); check_escaped("\b", "\\b"); check_escaped("\f", "\\f"); check_escaped("\n", "\\n"); check_escaped("\r", "\\r"); check_escaped("\t", "\\t"); check_escaped("\x01", "\\u0001"); check_escaped("\x02", "\\u0002"); check_escaped("\x03", "\\u0003"); check_escaped("\x04", "\\u0004"); check_escaped("\x05", "\\u0005"); check_escaped("\x06", "\\u0006"); check_escaped("\x07", "\\u0007"); check_escaped("\x08", "\\b"); check_escaped("\x09", "\\t"); check_escaped("\x0a", "\\n"); check_escaped("\x0b", "\\u000b"); check_escaped("\x0c", "\\f"); check_escaped("\x0d", "\\r"); check_escaped("\x0e", "\\u000e"); check_escaped("\x0f", "\\u000f"); check_escaped("\x10", "\\u0010"); check_escaped("\x11", "\\u0011"); check_escaped("\x12", "\\u0012"); check_escaped("\x13", "\\u0013"); check_escaped("\x14", "\\u0014"); check_escaped("\x15", "\\u0015"); check_escaped("\x16", "\\u0016"); check_escaped("\x17", "\\u0017"); check_escaped("\x18", "\\u0018"); check_escaped("\x19", "\\u0019"); check_escaped("\x1a", "\\u001a"); check_escaped("\x1b", "\\u001b"); check_escaped("\x1c", "\\u001c"); check_escaped("\x1d", "\\u001d"); check_escaped("\x1e", "\\u001e"); check_escaped("\x1f", "\\u001f"); // invalid UTF-8 characters CHECK_THROWS_AS(check_escaped("ä\xA9ü"), json::type_error&); CHECK_THROWS_WITH(check_escaped("ä\xA9ü"), "[json.exception.type_error.316] invalid UTF-8 byte at index 2: 0xA9"); CHECK_THROWS_AS(check_escaped("\xC2"), json::type_error&); CHECK_THROWS_WITH(check_escaped("\xC2"), "[json.exception.type_error.316] incomplete UTF-8 string; last byte: 0xC2"); } }
{ "pile_set_name": "Github" }
var common = require('../common'), test = common.test; if (process.arch !== 'x64') return; describe('JIT.js x64 Spills', function() { test('should support returns in closure', function() { this.mov('rax', 42); this.spill('rax', function() { this.Return(); }); }, 42); test('should support returns outside closure', function() { this.labelScope(function() { this.mov('rax', 42); this.spill('rax', function() { this.j('skip'); this.Return(); this.bind('skip'); }); this.Return(); }); }, 42); });
{ "pile_set_name": "Github" }
.class Landroid/support/v7/view/menu/MenuItemWrapperICS$ActionProviderWrapper; .super Landroid/support/v4/view/ActionProvider; # instance fields .field final mInner:Landroid/view/ActionProvider; .field final synthetic this$0:Landroid/support/v7/view/menu/MenuItemWrapperICS; # direct methods .method public constructor <init>(Landroid/support/v7/view/menu/MenuItemWrapperICS;Landroid/content/Context;Landroid/view/ActionProvider;)V .locals 0 iput-object p1, p0, Landroid/support/v7/view/menu/MenuItemWrapperICS$ActionProviderWrapper;->this$0:Landroid/support/v7/view/menu/MenuItemWrapperICS; invoke-direct {p0, p2}, Landroid/support/v4/view/ActionProvider;-><init>(Landroid/content/Context;)V iput-object p3, p0, Landroid/support/v7/view/menu/MenuItemWrapperICS$ActionProviderWrapper;->mInner:Landroid/view/ActionProvider; return-void .end method # virtual methods .method public hasSubMenu()Z .locals 1 iget-object v0, p0, Landroid/support/v7/view/menu/MenuItemWrapperICS$ActionProviderWrapper;->mInner:Landroid/view/ActionProvider; invoke-virtual {v0}, Landroid/view/ActionProvider;->hasSubMenu()Z move-result v0 return v0 .end method .method public onCreateActionView()Landroid/view/View; .locals 1 iget-object v0, p0, Landroid/support/v7/view/menu/MenuItemWrapperICS$ActionProviderWrapper;->mInner:Landroid/view/ActionProvider; invoke-virtual {v0}, Landroid/view/ActionProvider;->onCreateActionView()Landroid/view/View; move-result-object v0 return-object v0 .end method .method public onPerformDefaultAction()Z .locals 1 iget-object v0, p0, Landroid/support/v7/view/menu/MenuItemWrapperICS$ActionProviderWrapper;->mInner:Landroid/view/ActionProvider; invoke-virtual {v0}, Landroid/view/ActionProvider;->onPerformDefaultAction()Z move-result v0 return v0 .end method .method public onPrepareSubMenu(Landroid/view/SubMenu;)V .locals 2 iget-object v0, p0, Landroid/support/v7/view/menu/MenuItemWrapperICS$ActionProviderWrapper;->mInner:Landroid/view/ActionProvider; iget-object v1, p0, Landroid/support/v7/view/menu/MenuItemWrapperICS$ActionProviderWrapper;->this$0:Landroid/support/v7/view/menu/MenuItemWrapperICS; invoke-virtual {v1, p1}, Landroid/support/v7/view/menu/MenuItemWrapperICS;->getSubMenuWrapper(Landroid/view/SubMenu;)Landroid/view/SubMenu; move-result-object v1 invoke-virtual {v0, v1}, Landroid/view/ActionProvider;->onPrepareSubMenu(Landroid/view/SubMenu;)V return-void .end method
{ "pile_set_name": "Github" }
+ - * / % -- ++ >> << ~ & | ^ += -= *= /= %= >>= <<= &= |= ^= ! && || -> :: ? : = == != < > <= >= <=> and and_eq bitand bitor not not_eq or or_eq xor xor_eq ---------------------------------------------------- [ ["operator", "+"], ["operator", "-"], ["operator", "*"], ["operator", "/"], ["operator", "%"], ["operator", "--"], ["operator", "++"], ["operator", ">>"], ["operator", "<<"], ["operator", "~"], ["operator", "&"], ["operator", "|"], ["operator", "^"], ["operator", "+="], ["operator", "-="], ["operator", "*="], ["operator", "/="], ["operator", "%="], ["operator", ">>="], ["operator", "<<="], ["operator", "&="], ["operator", "|="], ["operator", "^="], ["operator", "!"], ["operator", "&&"], ["operator", "||"], ["operator", "->"], ["operator", "::"], ["operator", "?"], ["operator", ":"], ["operator", "="], ["operator", "=="], ["operator", "!="], ["operator", "<"], ["operator", ">"], ["operator", "<="], ["operator", ">="], ["operator", "<=>"], ["operator", "and"], ["operator", "and_eq"], ["operator", "bitand"], ["operator", "bitor"], ["operator", "not"], ["operator", "not_eq"], ["operator", "or"], ["operator", "or_eq"], ["operator", "xor"], ["operator", "xor_eq"] ] ---------------------------------------------------- Checks for all operators.
{ "pile_set_name": "Github" }
# Install hook code here
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!-- /* //device/apps/common/assets/res/any/strings.xml ** ** Copyright 2006, 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. */ --> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="ringtone_silent">"Stil"</string> </resources>
{ "pile_set_name": "Github" }
/* * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * The contents of this file are subject to the terms of either the Universal Permissive License * v 1.0 as shown at http://oss.oracle.com/licenses/upl * * or the following license: * * 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. Neither the name of the copyright holder 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 HOLDER 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. */ package org.openjdk.jmc.flightrecorder.parser; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.ServiceLoader; import org.openjdk.jmc.flightrecorder.parser.synthetic.SyntheticAttributeExtension; /** * Handles loading of parser extension factories using Java Service Loader. */ public class ParserExtensionRegistry { private final static List<IParserExtension> parserExtensions; static { List<IParserExtension> extensions = new ArrayList<>(); // FIXME: Load the synthetic attribute extension using Java Service Loader instead extensions.add(new SyntheticAttributeExtension()); ServiceLoader<IParserExtension> loader = ServiceLoader.load(IParserExtension.class, IParserExtension.class.getClassLoader()); for (IParserExtension extension : loader) { extensions.add(extension); } parserExtensions = Collections.unmodifiableList(extensions); } /** * @return a list with all known parser extensions */ public static List<IParserExtension> getParserExtensions() { return parserExtensions; } }
{ "pile_set_name": "Github" }
// Copyright (c) 2020 OPTIKEY LTD (UK company number 11854839) - All Rights Reserved using JuliusSweetland.OptiKey.UI.Controls; namespace JuliusSweetland.OptiKey.UI.Views.Keyboards.Turkish { /// <summary> /// Interaction logic for ConversationAlpha1.xaml /// </summary> public partial class ConversationAlpha1 : KeyboardView { public ConversationAlpha1() : base(shiftAware: true) { InitializeComponent(); } } }
{ "pile_set_name": "Github" }
#if __WATCHOS__ && !XAMCORE_4_0 using System; using System.Drawing; using System.Diagnostics; using System.ComponentModel; using System.Threading.Tasks; using System.Runtime.InteropServices; using UIKit; using SceneKit; using Contacts; using CoreVideo; using SpriteKit; using Foundation; using ObjCRuntime; using CoreGraphics; using CoreLocation; using AVFoundation; using CoreFoundation; namespace Intents { [Register("INCarDefrosterResolutionResult", true)] [Obsolete ("This class is not available on watchOS")] public unsafe partial class INCarDefrosterResolutionResult : INIntentResolutionResult { public override IntPtr ClassHandle { get { throw new PlatformNotSupportedException ("This class is not supported on watchOS"); } } protected INCarDefrosterResolutionResult (NSObjectFlag t) : base (t) { throw new PlatformNotSupportedException ("This class is not supported on watchOS"); } protected internal INCarDefrosterResolutionResult (IntPtr handle) : base (handle) { throw new PlatformNotSupportedException ("This class is not supported on watchOS"); } public new static INCarDefrosterResolutionResult NeedsValue { get { throw new PlatformNotSupportedException ("This class is not supported on watchOS"); } } public new static INCarDefrosterResolutionResult NotRequired { get { throw new PlatformNotSupportedException ("This class is not supported on watchOS"); } } public new static INCarDefrosterResolutionResult Unsupported { get { throw new PlatformNotSupportedException ("This class is not supported on watchOS"); } } } /* class INCarDefrosterResolutionResult */ } #endif // __WATCHOS__ && !XAMCORE_4_0
{ "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. from aliyunsdkcore.request import RpcRequest from aliyunsdkdomain.endpoint import endpoint_data class CancelOperationAuditRequest(RpcRequest): def __init__(self): RpcRequest.__init__(self, 'Domain', '2018-01-29', 'CancelOperationAudit','domain') self.set_method('POST') if hasattr(self, "endpoint_map"): setattr(self, "endpoint_map", endpoint_data.getEndpointMap()) if hasattr(self, "endpoint_regional"): setattr(self, "endpoint_regional", endpoint_data.getEndpointRegional()) def get_AuditRecordId(self): return self.get_query_params().get('AuditRecordId') def set_AuditRecordId(self,AuditRecordId): self.add_query_param('AuditRecordId',AuditRecordId) def get_Lang(self): return self.get_query_params().get('Lang') def set_Lang(self,Lang): self.add_query_param('Lang',Lang)
{ "pile_set_name": "Github" }
<!doctype html> <html> <head> <title>jQuery UI Date Picker Control - Reset</title> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <!-- font libs --> <link href="http://fonts.googleapis.com/css?family=Lato" rel="stylesheet" type="text/css" /> <link href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet" /> <!-- demo page styles --> <link href="../../dist/css/jplist.demo-pages.min.css" rel="stylesheet" type="text/css" /> <!-- jQuery lib --> <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> <!-- jPList core js and css --> <link href="../../dist/css/jplist.core.min.css" rel="stylesheet" type="text/css" /> <script src="../../dist/js/jplist.core.min.js"></script> <!-- jQuery UI js and css --> <script src="http://code.jquery.com/ui/1.12.0-rc.1/jquery-ui.min.js"></script> <link rel="stylesheet" href="http://code.jquery.com/ui/1.12.0-rc.1/themes/smoothness/jquery-ui.css" /> <!-- jPList jQuery UI bundle js and css --> <link href="../../dist/css/jplist.jquery-ui-bundle.min.css" rel="stylesheet" type="text/css" /> <script src="../../dist/js/jplist.jquery-ui-bundle.min.js"></script> <!-- sort bundle --> <script src="../../dist/js/jplist.sort-bundle.min.js"></script> <!-- textbox filter control --> <script src="../../dist/js/jplist.textbox-filter.min.js"></script> <link href="../../dist/css/jplist.textbox-filter.min.css" rel="stylesheet" type="text/css" /> <!-- jplist pagination bundle --> <script src="../../dist/js/jplist.pagination-bundle.min.js"></script> <link href="../../dist/css/jplist.pagination-bundle.min.css" rel="stylesheet" type="text/css" /> <!-- jplist history bundle --> <script src="../../dist/js/jplist.history-bundle.min.js"></script> <link href="../../dist/css/jplist.history-bundle.min.css" rel="stylesheet" type="text/css" /> <script> $('document').ready(function(){ /** * user defined functions */ jQuery.fn.jplist.settings = { /** * jQuery UI date picker */ datepicker: function(input, options){ //set options options.dateFormat = 'mm/dd/yy' //start datepicker input.datepicker(options); } }; /** * jPList */ $('#demo').jplist({ itemsBox: '.list' ,itemPath: '.list-item' ,panelPath: '.jplist-panel' //,debug: true ,storage: 'localstorage' //'', 'cookies', 'localstorage' //,storageName: 'jplist-jquery-ui-datetime-filter' //,deepLinking: true //,effect: 'fade' //'', 'fade' }); }); </script> </head> <body> <div class="box"> <div class="center"> <!-- title --> <div class="box"> <h1 class="h1-30-normal left" style="margin: 30px 0 10px 0">jQuery UI Date Picker Filter Control with other controls</h1> </div> <!-- demo --> <div id="demo" class="box jplist" style="margin: 20px 0 50px 0"> <!-- ios button: show/hide panel --> <div class="jplist-ios-button"> <i class="fa fa-sort"></i> jPList Actions </div> <!-- panel --> <div class="jplist-panel box panel-top"> <!-- back button button --> <button type="button" data-control-type="back-button" data-control-name="back-button" data-control-action="back-button"> <i class="fa fa-arrow-left"></i> Go Back </button> <!-- reset button --> <button type="button" class="jplist-reset-btn" data-control-type="reset" data-control-name="reset" data-control-action="reset"> Reset &nbsp;<i class="fa fa-share"></i> </button> <!-- items per page dropdown --> <div class="jplist-drop-down" data-control-type="items-per-page-drop-down" data-control-name="paging" data-control-action="paging"> <ul> <li><span data-number="3" data-default="true"> 3 per page </span></li> <li><span data-number="5"> 5 per page </span></li> <li><span data-number="10"> 10 per page </span></li> <li><span data-number="all"> View All </span></li> </ul> </div> <!-- sort dropdown --> <div class="jplist-drop-down" data-control-type="sort-drop-down" data-control-name="sort" data-control-action="sort" data-datetime-format="{month}/{day}/{year}"> <!-- {year}, {month}, {day}, {hour}, {min}, {sec} --> <ul> <li><span data-path="default">Sort by</span></li> <li><span data-path=".title" data-order="asc" data-type="text">Title A-Z</span></li> <li><span data-path=".title" data-order="desc" data-type="text">Title Z-A</span></li> <li><span data-path=".desc" data-order="asc" data-type="text">Description A-Z</span></li> <li><span data-path=".desc" data-order="desc" data-type="text">Description Z-A</span></li> <li><span data-path=".like" data-order="asc" data-type="number" data-default="true">Likes asc</span></li> <li><span data-path=".like" data-order="desc" data-type="number">Likes desc</span></li> <li><span data-path=".date" data-order="asc" data-type="datetime">Date asc</span></li> <li><span data-path=".date" data-order="desc" data-type="datetime">Date desc</span></li> </ul> </div> <!-- filter by title --> <div class="text-filter-box"> <i class="fa fa-search jplist-icon"></i> <!--[if lt IE 10]> <div class="jplist-label">Filter by Title:</div> <![endif]--> <input data-path=".title" type="text" value="" placeholder="Filter by Title" data-control-type="textbox" data-control-name="title-filter" data-control-action="filter" /> </div> <div class="jplist-box"> <label> <i class="fa fa-clock-o"></i> Filter by date: </label> <!-- jQuery UI date picker filter --> <!-- data-datepicker-func is a user function defined in jQuery.fn.jplist.settings --> <input type="text" class="date-picker" placeholder="Month / Day / Year" data-path=".date" data-datepicker-func="datepicker" data-datetime-format="{month}/{day}/{year}" data-control-type="date-picker-filter" data-control-name="date-picker-filter" data-control-action="filter" data-control-storage="false" /> <!-- data-control-storage="false" --> </div> <!-- pagination results --> <div class="jplist-label" data-type="Page {current} of {pages}" data-control-type="pagination-info" data-control-name="paging" data-control-action="paging"> </div> <!-- pagination control --> <div class="jplist-pagination" data-control-type="pagination" data-control-name="paging" data-control-action="paging"> </div> </div> <!-- data --> <div class="list box text-shadow"> <!-- item 1 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/arch-2.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">10/01/2014</p> <p class="title">Architecture</p> <p class="desc">Architecture is both the process and product of planning, designing and construction. Architectural works, in the material form of buildings, are often perceived as cultural symbols and as works of art. Historical civilizations are often identified with their surviving architectural achievements.</p> <p class="like">25 Likes</p> </div> </div> <!-- item 2 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/autumn-1.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">01/31/2011</p> <p class="title">Autumn</p> <p class="desc">Autumn or Fall is one of the four temperate seasons. Autumn marks the transition from summer into winter, in September (Northern Hemisphere) or March (Southern Hemisphere) when the arrival of night becomes noticeably earlier. The equinoxes might be expected to be in the middle of their respective seasons, but temperature lag (caused by the thermal latency of the ground and sea) means that seasons appear later than dates calculated from a purely astronomical perspective.</p> <p class="like">12 Likes</p> </div> </div> <!-- item 3 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/boats-1.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">02/24/2000</p> <p class="title">Boats</p> <p class="desc">A boat is a watercraft of any size designed to float or plane, to provide passage across water. Usually this water will be inland (lakes) or in protected coastal areas. However, boats such as the whaleboat were designed to be operated from a ship in an offshore environment. In naval terms, a boat is a vessel small enough to be carried aboard another vessel (a ship).</p> <p class="like">11 Likes</p> </div> </div> <!-- item 4 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/arch-1.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">03/15/2014</p> <p class="title">Arch</p> <p class="desc">An arch is a structure that spans a space and supports a load. Arches appeared as early as the 2nd millennium BC in Mesopotamian brick architecture and their systematic use started with the Ancient Romans who were the first to apply the technique to a wide range of structures.</p> <p class="like">5 Likes</p> </div> </div> <!-- item 5 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/book-1.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">11/22/2001</p> <p class="title">Books</p> <p class="desc">A book is a set of written, printed, illustrated, or blank sheets, made of ink, paper, parchment, or other materials, usually fastened together to hinge at one side. A single sheet within a book is called a leaf, and each side of a leaf is called a page. A book produced in electronic format is known as an electronic book (e-book).</p> <p class="like">100 Likes</p> </div> </div> <!-- item 6 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/business-1.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">02/05/2004</p> <p class="title">Business</p> <p class="desc">A business (also known as enterprise or firm) is an organization engaged in the trade of goods, services, or both to consumers. Businesses are predominant in capitalist economies, where most of them are privately owned and administered to earn profit to increase the wealth of their owners. Businesses may also be not-for-profit or state-owned. A business owned by multiple individuals may be referred to as a company, although that term also has a more precise meaning.</p> <p class="like">15 Likes</p> </div> </div> <!-- item 7 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/calendar-1.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">05/08/2013</p> <p class="title">Calendar</p> <p class="desc">A calendar is a system of organizing days for social, religious, commercial, or administrative purposes. This is done by giving names to periods of time, typically days, weeks, months, and years. The name given to each day is known as a date. Periods in a calendar (such as years and months) are usually, though not necessarily, synchronized with the cycle of the sun or the moon.</p> <p class="like">18 Likes</p> </div> </div> <!-- item 8 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/car-1.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">09/01/2017</p> <p class="title">Car</p> <p class="desc">An automobile, autocar, motor car or car is a wheeled motor vehicle used for transporting passengers, which also carries its own engine or motor. Most definitions of the term specify that automobiles are designed to run primarily on roads, to have seating for one to eight people, to typically have four wheels, and to be constructed principally for the transport of people rather than goods.</p> <p class="like">7 Likes</p> </div> </div> <!-- item 9 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/christmas-1.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">11/12/1998</p> <p class="title">Christmas</p> <p class="desc">Christmas or Christmas Day is an annual commemoration of the birth of Jesus Christ, celebrated generally on December as a religious and cultural holiday by billions of people around the world. A feast central to the Christian liturgical year, it closes the Advent season and initiates the twelve days of Christmastide. Christmas is a civil holiday in many of the world"s nations, is celebrated by an increasing number of non-Christians, and is an integral part of the Christmas and holiday season.</p> <p class="like">29 Likes</p> </div> </div> <!-- item 10 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/christmas-2.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">06/10/1995</p> <p class="title">The Christmas Toy</p> <p class="desc">The Christmas Toy is a 1986 made-for-TV movie by The Jim Henson Company. It originally aired on ABC on December 6, 1986, and was originally sponsored by Kraft Foods. Originally introduced by Kermit The Frog, it was released on VHS format in 1993. In 2008, HIT Entertainment (distributed by Lionsgate) released the special on DVD, but edited out Kermit"s appearance due to legal issues.</p> <p class="like">35 Likes</p> </div> </div> <!-- item 11 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/christmas-3.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">04/04/2016</p> <p class="title">Christmas Tree</p> <p class="desc">A Christmas tree is a decorated tree, usually an evergreen conifer such as pine or fir, traditionally associated with the celebration of Christmas. An artificial Christmas tree is an object made to resemble such a tree, usually made from polyvinyl chloride.</p> <p class="like">86 Likes</p> </div> </div> <!-- item 12 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/city-1.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">06/19/1981</p> <p class="title">City</p> <p class="desc">A city is a relatively large and permanent settlement. Although there is no agreement on how a city is distinguished from a town within general English language meanings, many cities have a particular administrative, legal, or historical status based on local law.</p> <p class="like">125 Likes</p> </div> </div> <!-- item 13 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/city-2.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">08/25/1991</p> <p class="title">Capital City</p> <p class="desc">A capital city (or just, capital) is the area of a country, province, region, or state considered to enjoy primary status; although there are exceptions, a capital is typically a city that physically encompasses the offices and meeting places of the seat of government and is usually fixed by law or by the constitution. An alternative term is political capital, but this phrase has a second meaning based on an alternate sense of the word capital. The capital is often, but not necessarily, the largest city of its constituent area.</p> <p class="like">191 Likes</p> </div> </div> <!-- item 14 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/coffee-grass.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">02/02/2002</p> <p class="title">Coffee</p> <p class="desc">Coffee is a brewed beverage with a bitter, acidic flavor prepared from the roasted seeds of the coffee plant. The beans are found in coffee cherries, which grow on trees cultivated in over 70 countries, primarily in equatorial Latin America, Southeast Asia, South Asia and Africa. Green (unroasted) coffee is one of the most traded agricultural commodities in the world. Coffee can have a stimulating effect on humans due to its caffeine content. It is one of the most-consumed beverages in the world.</p> <p class="like">18 Likes</p> </div> </div> <!-- item 15 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/coins.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">03/17/1999</p> <p class="title">Coins</p> <p class="desc">A coin is a piece of hard material that is standardized in weight, is produced in large quantities in order to facilitate trade, and primarily can be used as a legal tender. Coins are usually metal or a metallic material and sometimes made of synthetic materials, usually in the shape of a disc, and most often issued by a government. Coins are used as a form of money in transactions of various kinds, from the everyday circulation coins to the storage of large numbers of bullion coins. In the present day, coins and banknotes make up currency, the cash forms of all modern money systems.</p> <p class="like">39 Likes</p> </div> </div> <!-- item 16 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/crayons.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">03/08/1990</p> <p class="title">Crayons</p> <p class="desc">A crayon is a stick of colored wax, charcoal, chalk, or other materials used for writing, coloring, drawing, and other methods of illustration. A crayon made of oiled chalk is called an oil pastel; when made of pigment with a dry binder, it is simply a pastel; both are popular media for color artwork. A grease pencil or china marker (UK chinagraph pencil) is made of colored hardened grease and is useful for marking on hard, glossy surfaces such as porcelain or glass. Some fine arts companies such as Swiss Caran d"Ache manufacture water-soluble crayons, whose colors are easily mixed once applied to media.</p> <p class="like">14 Likes</p> </div> </div> <!-- item 17 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/cupcakes.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">05/25/1965</p> <p class="title">Cupcakes</p> <p class="desc">A cupcake (also British English: fairy cake; Australian English: patty cake or cup cake) is a small cake designed to serve one person, frequently baked in a small, thin paper or aluminum cup. As with larger cakes, frosting and other cake decorations, such as sprinkles, are common on cupcakes. Although their origin is unknown, recipes for cupcakes have been printed since at least the late 12th century.</p> <p class="like">128 Likes</p> </div> </div> <!-- item 18 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/eggs-nest.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">12/31/1918</p> <p class="title">Nests</p> <p class="desc">A nest is a place of refuge to hold an animal"s eggs or provide a place to live or raise offspring. They are usually made of some organic material such as twigs, grass, and leaves; or may simply be a depression in the ground, or a hole in a tree, rock or building. Human-made materials, such as string, plastic, cloth, hair or paper, may be used.</p> <p class="like">66 Likes</p> </div> </div> <!-- item 19 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/flower-1.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">03/19/2014</p> <p class="title">Flower</p> <p class="desc">A flower, sometimes known as a bloom or blossom, is the reproductive structure found in flowering plants (plants of the division Magnoliophyta, also called angiosperms). The biological function of a flower is to effect reproduction, usually by providing a mechanism for the union of sperm with eggs. Flowers may facilitate outcrossing (fusion of sperm and eggs from different individuals in a population) or allow selfing (fusion of sperm and egg from the same flower).</p> <p class="like">85 Likes</p> </div> </div> <!-- item 20 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/flower-2.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">01/11/2011</p> <p class="title">Pseudanthium</p> <p class="desc">A pseudanthium (Greek for "false flower") or flower head is a special type of inflorescence, in which several flowers are grouped together to form a flower-like structure. The real flowers are generally small and greatly reduced, but can sometimes be quite large (as in the sunflower flower head). Pseudanthia take various forms. The individual flowers of a pseudanthium can be called florets.</p> <p class="like">22 Likes</p> </div> </div> <!-- item 21 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/flower-3.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">06/06/1993</p> <p class="title">Flowering Plant</p> <p class="desc">The flowering plants (angiosperms), also known as Angiospermae or Magnoliophyta, are the most diverse group of land plants. Angiosperms are seed-producing plants like the gymnosperms and can be distinguished from the gymnosperms by a series of synapomorphies (derived characteristics). These characteristics include flowers, endosperm within the seeds, and the production of fruits that contain the seeds.</p> <p class="like">90 Likes</p> </div> </div> <!-- item 22 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/fountain.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">06/10/1995</p> <p class="title">Fountains</p> <p class="desc">A fountain (from the Latin "fons" or "fontis", a source or spring) is a piece of architecture which pours water into a basin or jets it into the air either to supply drinking water or for decorative or dramatic effect. Fountains were originally purely functional, connected to springs or aqueducts and used to provide drinking water and water for bathing and washing to the residents of cities, towns and villages. Until the late 19th century most fountains operated by gravity, and needed a source of water higher than the fountain, such as a reservoir or aqueduct, to make the water flow or jet into the air.</p> <p class="like">40 Likes</p> </div> </div> <!-- item 23 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/leaves.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">04/12/1990</p> <p class="title">Leaves</p> <p class="desc">A leaf is an organ of a vascular plant, as defined in botanical terms, and in particular in plant morphology. Foliage is a mass noun that refers to leaves as a feature of plants. Typically a leaf is a thin, flattened organ borne above ground and specialized or photosynthesis, but many types of leaves are adapted in ways almost unrecognisable in those terms: some are not flat (for example many succulent leaves and conifers), some are not above ground (such as bulb scales), and some are without major photosynthetic function (consider for example cataphylls, spines, and cotyledons).</p> <p class="like">42 Likes</p> </div> </div> <!-- item 24 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/lichterman.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">11/04/2010</p> <p class="title">Landscapes</p> <p class="desc">Landscape comprises the visible features of an area of land, including the physical elements of landforms such as (ice-capped) mountains, hills, water bodies such as rivers, lakes, ponds and the sea, living elements of land cover including indigenous vegetation, human elements including different forms of land use, buildings and structures, and transitory elements such as lighting and weather conditions.</p> <p class="like">14 Likes</p> </div> </div> <!-- item 25 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/pinecone.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">08/19/2014</p> <p class="title">Conifer Cone</p> <p class="desc">A cone (in formal botanical usage: strobilus, plural strobili) is an organ on plants in the division Pinophyta (conifers) that contains the reproductive structures. The familiar woody cone is the female cone, which produces seeds. The male cones, which produce pollen, are usually herbaceous and much less conspicuous even at full maturity. The name "cone" derives from the fact that the shape in some species resembles a geometric cone. The individual plates of a cone are known as scales.</p> <p class="like">321 Likes</p> </div> </div> <!-- item 26 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/river-1.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">07/24/1995</p> <p class="title">Rivers</p> <p class="desc">A river is a natural watercourse, usually freshwater, flowing towards an ocean, a lake, a sea, or another river. In a few cases, a river simply flows into the ground or dries up completely before reaching another body of water. Small rivers may also be called by several other names, including stream, creek, brook, rivulet, tributary and rill. There are no official definitions for generic terms, such as river, as applied to geographic features, although in some countries or communities a stream may be defined by its size. Many names for small rivers are specific to geographic location; one example is "burn" in Scotland and northeast England. Sometimes a river is said to be larger than a creek, but this is not always the case, because of vagueness in the language.</p> <p class="like">88 Likes</p> </div> </div> <!-- item 27 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/river-2.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">03/03/1953</p> <p class="title">River Source</p> <p class="desc">The source or headwaters of a river or stream is the furthest place in that river or stream from its estuary or confluence with another river, as measured along the course of the river.</p> <p class="like">62 Likes</p> </div> </div> <!-- item 28 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/sunset-1.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">07/17/2014</p> <p class="title">Sunset</p> <p class="desc">Sunset or sundown is the daily disappearance of the Sun below the horizon in the west as a result of Earth"s rotation. The time of sunset is defined in astronomy as the moment when the trailing edge of the Sun"s disk disappears below the horizon in the west. The ray path of light from the setting Sun is highly distorted near the horizon because of atmospheric refraction, making the sunset appear to occur when the Sun"s disk is already about one diameter below the horizon. Sunset is distinct from dusk, which is the moment at which darkness falls, which occurs when the Sun is approximately eighteen degrees below the horizon. The period between sunset and dusk is called twilight.</p> <p class="like">25 Likes</p> </div> </div> <!-- item 29 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/tree.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">02/20/2008</p> <p class="title">Tree</p> <p class="desc">A tree is a perennial woody plant. It is most often defined as a woody plant that has many secondary branches supported clear of the ground on a single main stem or trunk with clear apical dominance. A minimum height specification at maturity is cited by some authors, varying from 3 m to 6 m; some authors set a minimum of 10 cm trunk diameter (30 cm girth). Woody plants that do not meet these definitions by having multiple stems and/or small size are usually called shrubs, although many trees such as Mallee do not meet such definitions. Compared with most other plants, trees are long-lived, some reaching several thousand years old and growing to up to 115 m (379 ft) high.</p> <p class="like">57 Likes</p> </div> </div> <!-- item 30 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/winter-1.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">07/26/2013</p> <p class="title">Winter</p> <p class="desc">Winter is the coldest season of the year in temperate climates, between autumn and spring. At the winter solstice, the days are shortest and the nights are longest, with days lengthening as the season progresses after the solstice.</p> <p class="like">79 Likes</p> </div> </div> <!-- item 31 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/winter-2.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">07/18/1995</p> <p class="title">Seesaw</p> <p class="desc">A see saw (also known as a teeter-totter or teeter board) is a long, narrow board pivoted in the middle so that, as one end goes up, the other goes down. Mechanically a seesaw is a lever and fulcrum. Seesaws also work as a simple example of a mechanical system with two equilibrium positions. One side is stable, while the other is unstable.</p> <p class="like">32 Likes</p> </div> </div> <!-- item 32 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/winter-sun.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">02/15/2005</p> <p class="title">Winter Sun</p> <p class="desc">The Sun is the star at the center of the Solar System. It is almost perfectly spherical and consists of hot plasma interwoven with magnetic fields. It has a diameter of about 1,392,000 km, about 109 times that of Earth, and its mass accounts for about 99.86% of the total mass of the Solar System. Chemically, about three quarters of the Sun"s mass consists of hydrogen, while the rest is mostly helium. The remainder (1.69%, which nonetheless equals 5,628 times the mass of Earth) consists of heavier elements, including oxygen, carbon, neon and iron, among others.</p> <p class="like">81 Likes</p> </div> </div> <!-- item 33 --> <div class="list-item box"> <!-- img --> <div class="img left"> <img src="../../demo/img/thumbs/woodstump.jpg" alt="" title=""/> </div> <!-- data --> <div class="block right"> <p class="date">11/12/2014</p> <p class="title">Wood</p> <p class="desc">Wood is a hard, fibrous tissue found in many trees. It has been used for hundreds of thousands of years for both fuel and as a construction material. It is an organic material, a natural composite of cellulose fibers (which are strong in tension) embedded in a matrix of lignin which resists compression. Wood is produced as secondary xylem in the stems of trees (and other woody plants). In a living tree it performs a support function, enabling woody plants to grow large or to stand up for themselves. It also mediates the transfer of water and nutrients to the leaves and other growing tissues. Wood may also refer to other plant materials with comparable properties, and to material engineered from wood, or wood chips or fiber.</p> <p class="like">25 Likes</p> </div> </div> </div> <div class="box jplist-no-results text-shadow align-center"> <p>No results found</p> </div> <!-- ios button: show/hide panel --> <div class="jplist-ios-button"> <i class="fa fa-sort"></i> jPList Actions </div> <!-- panel --> <div class="jplist-panel box panel-bottom"> <!-- items per page dropdown --> <div class="jplist-drop-down" data-control-type="items-per-page-drop-down" data-control-name="paging" data-control-action="paging" data-control-animate-to-top="true"> <ul> <li><span data-number="3" data-default="true"> 3 per page </span></li> <li><span data-number="5"> 5 per page </span></li> <li><span data-number="10"> 10 per page </span></li> <li><span data-number="all"> View All </span></li> </ul> </div> <!-- sort dropdown --> <div class="jplist-drop-down" data-control-type="sort-drop-down" data-control-name="sort" data-control-action="sort" data-control-animate-to-top="true" data-datetime-format="{month}/{day}/{year}"> <!-- {year}, {month}, {day}, {hour}, {min}, {sec} --> <ul> <li><span data-path="default">Sort by</span></li> <li><span data-path=".title" data-order="asc" data-type="text">Title A-Z</span></li> <li><span data-path=".title" data-order="desc" data-type="text">Title Z-A</span></li> <li><span data-path=".desc" data-order="asc" data-type="text">Description A-Z</span></li> <li><span data-path=".desc" data-order="desc" data-type="text">Description Z-A</span></li> <li><span data-path=".like" data-order="asc" data-type="number" data-default="true">Likes asc</span></li> <li><span data-path=".like" data-order="desc" data-type="number">Likes desc</span></li> <li><span data-path=".date" data-order="asc" data-type="datetime">Date asc</span></li> <li><span data-path=".date" data-order="desc" data-type="datetime">Date desc</span></li> </ul> </div> <div class="jplist-box"> <label> <i class="fa fa-clock-o"></i> Filter by date: </label> <!--jQuery UI date picker filter --> <!-- data-datepicker-func is a user function defined in jQuery.fn.jplist.settings --> <input type="text" class="date-picker" placeholder="Month / Day / Year" data-path=".date" data-datepicker-func="datepicker" data-datetime-format="{month}/{day}/{year}" data-control-type="date-picker-filter" data-control-name="date-picker-filter" data-control-action="filter" /> </div> <!-- pagination results --> <div class="jplist-label" data-type="{start} - {end} of {all}" data-control-type="pagination-info" data-control-name="paging" data-control-action="paging"> </div> <!-- pagination --> <div class="jplist-pagination" data-control-animate-to-top="true" data-control-type="pagination" data-control-name="paging" data-control-action="paging"> </div> </div> </div> <!-- end of demo --> </div> </div> </body> </html>
{ "pile_set_name": "Github" }
; @date : $Date$ ; @Id $Id$ ; @Revision : $Revision$ ; @author Viva Wallet ; @package VMPayment ; @subpackage VirtueMart payment Vivawallet VMPAYMENT_VIVAWALLET="Vm plugin πληρωμής Vivawallet" VMPAYMENT_VIVAWALLET_AMOUNT="Ποσότητα" VMPAYMENT_VIVAWALLET_CLICK_ON_BUTTON="Αν δεν μεταφερθείτε μετά από 10 δεύτερα, παρακαλώ πατήστε το κουμπί κάτω." VMPAYMENT_VIVAWALLET_COST_PERCENT_TOTAL="Ποσοστό του συνολικού ποσού προϊόντος" VMPAYMENT_VIVAWALLET_COST_PERCENT_TOTAL_EXPLAIN="Ποσοστό που αντιστοιχεί στο συνολικό ποσό προϊόντος. Το κόστος αποστολής δεν περιλαμβάνεται" VMPAYMENT_VIVAWALLET_COST_PER_TRANSACTION="Αμοιβή ανά συναλλαγή" VMPAYMENT_VIVAWALLET_COST_PER_TRANSACTION_EXPLAIN="Επιπλέον χρέωση που εφαρμόζεται ανά συναλλαγή" VMPAYMENT_VIVAWALLET_COUNTRIES="Χώρες" VMPAYMENT_VIVAWALLET_COUNTRIES_DESC="Παρακαλώ επιλέξτε τις χώρες για τις οποίες ισχύει αυτή η μέθοδος πληρωμής. Αν δεν επιλέξετε χώρα, αυτή η μέθοδος πληρωμής θα εφαρμοστεί για όλες τις χώρες" VMPAYMENT_VIVAWALLET_LANGUAGE="Διαθέσιμες γλώσσες" VMPAYMENT_VIVAWALLET_LANGUAGE_DESC="Επιλέξτε Ολες για χρήση σε όλες τις γλώσσες. Σε πολύγλωσσα καταστήματα με κώδικα γλώσσας σε URLs, προσδιορίστε μια γλώσσα χρήσης για αυτλο το module (καθώς οι URLs πρέπει να είναι μοναδικές για την τράπεζα)" VMPAYMENT_VIVAWALLET_ALL="Όλες" VMPAYMENT_VIVAWALLET_GREEK="Ελληνικά" VMPAYMENT_VIVAWALLET_ENGLISH="Αγγλικά" VMPAYMENT_VIVAWALLET_DUTCH="Ολλανδικά" VMPAYMENT_VIVAWALLET_CURRENCY="Νόμισμα" VMPAYMENT_VIVAWALLET_CURRENCY_DESC="Μπαίνει σε Ευρώ σε περίπτωση που το Προεπιλεγμένο Νόμισμα Πωλητή δεν έχει καθοριστεί σε Ευρώ" VMPAYMENT_VIVAWALLET_CUSTOM="Προσαρμοσμένη αξία" VMPAYMENT_VIVAWALLET_ID="Vivawallet MerchantID:" VMPAYMENT_VIVAWALLET_SOURCE="Source Code:" VMPAYMENT_VIVAWALLET_SERVICE="Service ID:" VMPAYMENT_VIVAWALLET_SERVICE_DESC="Default: WebCheckout" VMPAYMENT_VIVAWALLET_SERVICE_WCHECKOUT="WebCheckout" VMPAYMENT_VIVAWALLET_SERVICE_RECEIPT="Electronic Receipt" VMPAYMENT_VIVAWALLET_SERVICE_WCHECKOUT_RECEIPT="WebCheckout and Receipt" VMPAYMENT_VIVAWALLET_PASS="API Key Vivawallet:" VMPAYMENT_VIVAWALLET_PASS_DESC="" VMPAYMENT_VIVAWALLET_INSTALMENTS="Vivawallet Instalment Logic:" VMPAYMENT_VIVAWALLET_INSTALMENTS_NOTE="Αφήστε το κενό για απενεργοποίηση της επιλογής δόσεων" VMPAYMENT_VIVAWALLET_INSTALMENTS_DESC="<br><strong>Παράδειγμα λογικής της δόσης:</strong> 200:3,400:6<br><strong>Αποτέλεσμα:</strong> Σύνολο παραγγελίας 200 επιτρέπει 3 δόσεις - Σύνολο δόσης 400 επιτρέπει 3 and 6 δόσεις." VMPAYMENT_VIVAWALLET_INSTALMENTS_CHARGE="Vivawallet χρέωση δόσεων:" VMPAYMENT_VIVAWALLET_INSTALMENTS_CHARGE_NOTE="Αφήστε το κενό για απενεργοποίηση της χρέωσης δόσεων(άτοκες δόσεις), επίσης το τέλος συναλλαγής μπορεί να χρησιμοποιηθεί για πάγια χρέωση ή ποσοστό" VMPAYMENT_VIVAWALLET_INSTALMENTS_CHARGE_DESC="<br><strong>Παράδειγμα χρέωσης δόσης:</strong> 1:2,3:2.5,6:3.25<br><strong>Αποτέλεσμα:</strong> 1 (χωρίς δόσεις) χρέωση δόσης 2% επιπλέον, 3 χρέωση δόσης 2.5%, 6 χρέωση δόσης3.25%." VMPAYMENT_VIVAWALLET_INSTALMENTS_CHECKOUT="Επιλέξτε δόσεις: " VMPAYMENT_VIVAWALLET_INSTALMENTS_NO=" Καθόλου δόσεις " VMPAYMENT_VIVAWALLET_INSTALMENTS_CHECKOUT_OPTION=" δόσεις " VMPAYMENT_VIVAWALLET_INSTALMENTS_SELECTED="Επιλεγμένες δόσεις: " VMPAYMENT_VIVAWALLET_DESCRIPTION="Περιγραφή συναλλαγής Vivawallet:" VMPAYMENT_VIVAWALLET_DESCRIPTION_DESC="Μικρή περιγραφή συναλλαγής που θα καταχωρηθεί από την Vivawallet" VMPAYMENT_VIVAWALLET_PRODUCTION_URL="Vivawallet Production URL:" VMPAYMENT_VIVAWALLET_TEST_URL="Vivawallet Test URL:" VMPAYMENT_VIVAWALLET_PRODUCTION="Vivawallet Test Mode:" VMPAYMENT_VIVAWALLET_PRODUCTION_DESC="Ρύθμιση <strong>No</strong> για δοκιμή της συναλλαγής (χρησιμοποιώντας την test URL)" VMPAYMENT_VIVAWALLET_ID_DESC="" VMPAYMENT_VIVAWALLET_EMAIL_SENT="Αποστολή Email" VMPAYMENT_VIVAWALLET_ERROR_EMAIL_SUBJECT="Λάθος στην Vivawallet πληρωμή" VMPAYMENT_VIVAWALLET_INVOICE="Αριθμός παραγγελίας" VMPAYMENT_VIVAWALLET_LOGOS="Logos" VMPAYMENT_VIVAWALLET_LOGOS_DESC="Logos που εμφανίζονται με την ονομασία πληρωμής" VMPAYMENT_VIVAWALLET_MAX_AMOUNT="Μέγιστο ποσό" VMPAYMENT_VIVAWALLET_MAX_AMOUNT_EXPLAIN="Μέγιστο ποσό παραγγελίας που προσφέρει αυτή η Πληρωμή" VMPAYMENT_VIVAWALLET_MERCHANT_ID_NOT_SET="Vivawallet Merchant ID δεν έχει οριστεί. Παρακαλώ ρυθμίστε αυτή την παράμετρο στην μέθοδο πληρωμής Vivawallet." VMPAYMENT_VIVAWALLET_MERCHANT_PASS_NOT_SET="Vivawallet Password δεν έχει οριστεί. Παρακαλώ ρυθμίστε αυτή την παράμετρο στην μέθοδο πληρωμής Vivawallet." VMPAYMENT_VIVAWALLET_MIN_AMOUNT="Ελάχιστο ποσό" VMPAYMENT_VIVAWALLET_MIN_AMOUNT_EXPLAIN="Ελάχιστο ποσό παραγγελίας που προσφέρει αυτή η Πληρωμή" VMPAYMENT_VIVAWALLET_NAME="Ονομασία πληρωμής" VMPAYMENT_VIVAWALLET_ORDER_NUMBER="Αριθμός παραγγελίας" VMPAYMENT_VIVAWALLET_PARAMS="<strong>VIVA PAYMENTS ΠΑΡΑΜΕΤΡΟΙ</strong>" VMPAYMENT_VIVAWALLET_PARAMS_DESC="<strong>Vivawallet Παράμετροι</strong>" VMPAYMENT_VIVAWALLET_PAYMENT_INFO="" VMPAYMENT_VIVAWALLET_PAYMENT_NAME="Ονομασία πληρωμής" VMPAYMENT_VIVAWALLET_PAYMENT_PAGE="<strong>ΕΠΙΣΤΡΟΦΗ ΣΤΟ ΚΑΤΑΣΤΗΜΑ</strong>" VMPAYMENT_VIVAWALLET_PAYMENT_PRICE="Πληρωμή" VMPAYMENT_VIVAWALLET_PAYMENT_SETTINGS="<strong>ΠΑΡΑΜΕΤΡΟΙ</strong>" VMPAYMENT_VIVAWALLET_PAYMENT_STATUS_CANCELED="Η πληρωμή για παραγγελία %s έχει αποτύχει ή ακυρώθηκε." VMPAYMENT_VIVAWALLET_PAYMENT_STATUS_CONFIRMED="Η πληρωμή σας για παραγγελία %s επιβεβαιώθηκε απο την Vivawallet" VMPAYMENT_VIVAWALLET_PAYMENT_STATUS_PENDING="Η πληρωμή για παραγγελία %s εκκρεμεί. Αιτία:" VMPAYMENT_VIVAWALLET_PAYMENT_TITLE="<STRONG>VIVA PAYMENTS</strong>" VMPAYMENT_VIVAWALLET_PAYMENT_TOTAL_CURRENCY="Σύνολο σε Νόμισμα Πληρωμής" VMPAYMENT_VIVAWALLET_PLEASE_WAIT="Παρακαλώ περιμένετε για να μεταφερθείτε σε %s" VMPAYMENT_VIVAWALLET_REDIRECT_MESSAGE="Παρακαλώ περιμένετε για να μεταφερθείτε στην Vivawallet" VMPAYMENT_VIVAWALLET_RESTRICTIONS="<strong>ΠΕΡΙΟΡΙΣΜΟΙ</strong>" VMPAYMENT_VIVAWALLET_SHIPMENT_PRICE="Αποστολή" VMPAYMENT_VIVAWALLET_STATUS_FAILED="Κατάσταση παραγγελίας για Αποτυχημένες ή Ακυρωμένες συναλλαγές" VMPAYMENT_VIVAWALLET_STATUS_FAILED_EXPLAIN="Επιλέξτε μια κατάσταση παραγγελίας Αποτυχημένες ή Ακυρωμένες Vivawallet συναλλαγές." VMPAYMENT_VIVAWALLET_STATUS_PENDING="Κατάσταση παραγγελίας για εκκρεμείς συναλλαγές" VMPAYMENT_VIVAWALLET_STATUS_PENDING_EXPLAIN="Η κατάσταση παραγγελίας στην οποία οι παραγγελίες έχουν καθοριστεί, οι οποίες δεν έχουν ολοκληρωμένη Συναλλαγή Πληρωμής. Σε αυτή την περίπτωση η συναλλαγή δεν ακυρώθηκε, αλλά απλώς εκκρεμεί και μένει να ολοκληρωθεί." VMPAYMENT_VIVAWALLET_STATUS_SUCCESS="Κατάσταση παραγγελίας για επιτυχημένες συναλλαγές" VMPAYMENT_VIVAWALLET_STATUS_SUCCESS_EXPLAIN="Επιλέξτε την κατάσταση στην οποία η παραγγελία έχει καθοριστεί, εάν η Vivawallet συναλλαγή ήταν επιτυχής. Αν χρησιμοποιείτε download επιλογές πώλησης: επιλέξτε την κατάσταση που κάνει δυνατό το κατέβασμα." VMPAYMENT_VIVAWALLET_TAX="Φόρος" VMPAYMENT_VIVAWALLET_TAX_EXPLAIN="Προστιθέμενος φόρος στην αμοιβή" VMPAYMENT_VIVAWALLET_THANKYOU="Ευχαριστούμε για την πληρωμή σας." VMPAYMENT_VIVAWALLET_UNKNOW_ORDER_ID="Άγνωστη ταυτότητα παραγγελίας" VMPAYMENT_VIVAWALLET_USER_CANCEL="Η πληρωμή ακυρώθηκε από τον χρήστη" VMPAYMENT_VIVAWALLET_VIRTUEMART_PARAMS="<strong>VirtueMart Παράμετροι</strong>" VMPAYMENT_VIVAWALLET_VIRTUEMART_PARAMS_DESC="<strong>VirtueMart Παράμετροι</strong>" VMPAYMENT_VIVAWALLET_FAILURE_MSG="Η πληρωμή σας δεν έγινε δεκτή, η παραγγελία σας απέτυχε ή ακυρώθηκε." VMPAYMENT_VIVAWALLET_SUCCESS_MSG="Η πληρωμή ήταν επιτυχής, η παραγγελία σας επιβεβαιώθηκε." VMPAYMENT_VIVAWALLET_ERROR_MSG="Υπάρχει λάθος στην διαδικασία πληρωμής, η παραγγελία σας δεν έχει επιβεβαιωθεί." VMPAYMENT_VIVAWALLET_ORDER_NUMBER="Αριθμός παραγγελίας: " VMPAYMENT_VIVAWALLET_AMOUNT="Ποσό: " VMPAYMENT_VIVAWALLET_TXID="Transaction ID: " VMPAYMENT_VIVAWALLET_DATE="Ημερομηνία: " VMPAYMENT_VIVAWALLET_PERIOD="Δόσεις: " VMPAYMENT_VIVAWALLET_OPTIONS="Επιλογές" VMPAYMENT_VIVAWALLET_HOME="Επιστροφή στην Αρχική Σελίδα"
{ "pile_set_name": "Github" }
/************************************************************************** ** This file is part of LiteIDE ** ** Copyright (c) 2011-2019 LiteIDE. All rights reserved. ** ** 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. ** ** In addition, as a special exception, that plugins developed for LiteIDE, ** are allowed to remain closed sourced and can be distributed under any license . ** These rights are included in the file LGPL_EXCEPTION.txt in this package. ** **************************************************************************/ // Module: quickopen_global.h // Creator: visualfc <[email protected]> #ifndef QUICKOPEN_GLOBAL_H #define QUICKOPEN_GLOBAL_H #include <QtCore/qglobal.h> #if defined(QUICKOPEN_LIBRARY) # define QUICKOPENSHARED_EXPORT Q_DECL_EXPORT #else # define QUICKOPENSHARED_EXPORT Q_DECL_IMPORT #endif #define OPTION_QUICKOPEN "option/quickopen" #define QUICKOPEN_FILES_MAXCOUNT "quickopen/filesmaxcount" #define QUICKOPNE_FILES_MATCHCASE "quickopen/filesmatchscase" #define QUICKOPEN_FOLDER_MAXCOUNT "quickopen/foldermaxcount" #define QUICKOPNE_FOLDER_MATCHCASE "quickopen/foldermatchscase" #define QUICKOPNE_EDITOR_MATCHCASE "quickopen/editormatchcase" #endif // QUICKOPEN_GLOBAL_H
{ "pile_set_name": "Github" }
{ "AssemblyIdentity": "Microsoft.AspNetCore.DataProtection.AzureStorage, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60", "Types": [ { "Name": "Microsoft.AspNetCore.DataProtection.AzureDataProtectionBuilderExtensions", "Visibility": "Public", "Kind": "Class", "Abstract": true, "Static": true, "Sealed": true, "ImplementedInterfaces": [], "Members": [ { "Kind": "Method", "Name": "PersistKeysToAzureBlobStorage", "Parameters": [ { "Name": "builder", "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" }, { "Name": "storageAccount", "Type": "Microsoft.WindowsAzure.Storage.CloudStorageAccount" }, { "Name": "relativePath", "Type": "System.String" } ], "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", "Static": true, "Extension": true, "Visibility": "Public", "GenericParameter": [] }, { "Kind": "Method", "Name": "PersistKeysToAzureBlobStorage", "Parameters": [ { "Name": "builder", "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" }, { "Name": "blobUri", "Type": "System.Uri" } ], "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", "Static": true, "Extension": true, "Visibility": "Public", "GenericParameter": [] }, { "Kind": "Method", "Name": "PersistKeysToAzureBlobStorage", "Parameters": [ { "Name": "builder", "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" }, { "Name": "blobReference", "Type": "Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob" } ], "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", "Static": true, "Extension": true, "Visibility": "Public", "GenericParameter": [] }, { "Kind": "Method", "Name": "PersistKeysToAzureBlobStorage", "Parameters": [ { "Name": "builder", "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" }, { "Name": "container", "Type": "Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer" }, { "Name": "blobName", "Type": "System.String" } ], "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", "Static": true, "Extension": true, "Visibility": "Public", "GenericParameter": [] } ], "GenericParameters": [] }, { "Name": "Microsoft.AspNetCore.DataProtection.AzureStorage.AzureBlobXmlRepository", "Visibility": "Public", "Kind": "Class", "Sealed": true, "ImplementedInterfaces": [ "Microsoft.AspNetCore.DataProtection.Repositories.IXmlRepository" ], "Members": [ { "Kind": "Method", "Name": "GetAllElements", "Parameters": [], "ReturnType": "System.Collections.Generic.IReadOnlyCollection<System.Xml.Linq.XElement>", "Sealed": true, "Virtual": true, "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.Repositories.IXmlRepository", "Visibility": "Public", "GenericParameter": [] }, { "Kind": "Method", "Name": "StoreElement", "Parameters": [ { "Name": "element", "Type": "System.Xml.Linq.XElement" }, { "Name": "friendlyName", "Type": "System.String" } ], "ReturnType": "System.Void", "Sealed": true, "Virtual": true, "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.Repositories.IXmlRepository", "Visibility": "Public", "GenericParameter": [] }, { "Kind": "Constructor", "Name": ".ctor", "Parameters": [ { "Name": "blobRefFactory", "Type": "System.Func<Microsoft.WindowsAzure.Storage.Blob.ICloudBlob>" } ], "Visibility": "Public", "GenericParameter": [] } ], "GenericParameters": [] } ] }
{ "pile_set_name": "Github" }
// SPDX-License-Identifier: (GPL-2.0 OR MIT) // // Copyright (c) 2018 BayLibre, SAS. // Author: Jerome Brunet <[email protected]> #include <linux/clk.h> #include <linux/module.h> #include <linux/of_platform.h> #include <linux/regmap.h> #include <sound/soc.h> #include "axg-tdm-formatter.h" struct axg_tdm_formatter { struct list_head list; struct axg_tdm_stream *stream; const struct axg_tdm_formatter_driver *drv; struct clk *pclk; struct clk *sclk; struct clk *lrclk; struct clk *sclk_sel; struct clk *lrclk_sel; bool enabled; struct regmap *map; }; int axg_tdm_formatter_set_channel_masks(struct regmap *map, struct axg_tdm_stream *ts, unsigned int offset) { unsigned int val, ch = ts->channels; unsigned long mask; int i, j; /* * Distribute the channels of the stream over the available slots * of each TDM lane */ for (i = 0; i < AXG_TDM_NUM_LANES; i++) { val = 0; mask = ts->mask[i]; for (j = find_first_bit(&mask, 32); (j < 32) && ch; j = find_next_bit(&mask, 32, j + 1)) { val |= 1 << j; ch -= 1; } regmap_write(map, offset, val); offset += regmap_get_reg_stride(map); } /* * If we still have channel left at the end of the process, it means * the stream has more channels than we can accommodate and we should * have caught this earlier. */ if (WARN_ON(ch != 0)) { pr_err("channel mask error\n"); return -EINVAL; } return 0; } EXPORT_SYMBOL_GPL(axg_tdm_formatter_set_channel_masks); static int axg_tdm_formatter_enable(struct axg_tdm_formatter *formatter) { struct axg_tdm_stream *ts = formatter->stream; bool invert = formatter->drv->invert_sclk; int ret; /* Do nothing if the formatter is already enabled */ if (formatter->enabled) return 0; /* * If sclk is inverted, invert it back and provide the inversion * required by the formatter */ invert ^= axg_tdm_sclk_invert(ts->iface->fmt); ret = clk_set_phase(formatter->sclk, invert ? 180 : 0); if (ret) return ret; /* Setup the stream parameter in the formatter */ ret = formatter->drv->ops->prepare(formatter->map, formatter->stream); if (ret) return ret; /* Enable the signal clocks feeding the formatter */ ret = clk_prepare_enable(formatter->sclk); if (ret) return ret; ret = clk_prepare_enable(formatter->lrclk); if (ret) { clk_disable_unprepare(formatter->sclk); return ret; } /* Finally, actually enable the formatter */ formatter->drv->ops->enable(formatter->map); formatter->enabled = true; return 0; } static void axg_tdm_formatter_disable(struct axg_tdm_formatter *formatter) { /* Do nothing if the formatter is already disabled */ if (!formatter->enabled) return; formatter->drv->ops->disable(formatter->map); clk_disable_unprepare(formatter->lrclk); clk_disable_unprepare(formatter->sclk); formatter->enabled = false; } static int axg_tdm_formatter_attach(struct axg_tdm_formatter *formatter) { struct axg_tdm_stream *ts = formatter->stream; int ret = 0; mutex_lock(&ts->lock); /* Catch up if the stream is already running when we attach */ if (ts->ready) { ret = axg_tdm_formatter_enable(formatter); if (ret) { pr_err("failed to enable formatter\n"); goto out; } } list_add_tail(&formatter->list, &ts->formatter_list); out: mutex_unlock(&ts->lock); return ret; } static void axg_tdm_formatter_dettach(struct axg_tdm_formatter *formatter) { struct axg_tdm_stream *ts = formatter->stream; mutex_lock(&ts->lock); list_del(&formatter->list); mutex_unlock(&ts->lock); axg_tdm_formatter_disable(formatter); } static int axg_tdm_formatter_power_up(struct axg_tdm_formatter *formatter, struct snd_soc_dapm_widget *w) { struct axg_tdm_stream *ts = formatter->drv->ops->get_stream(w); int ret; /* * If we don't get a stream at this stage, it would mean that the * widget is powering up but is not attached to any backend DAI. * It should not happen, ever ! */ if (WARN_ON(!ts)) return -ENODEV; /* Clock our device */ ret = clk_prepare_enable(formatter->pclk); if (ret) return ret; /* Reparent the bit clock to the TDM interface */ ret = clk_set_parent(formatter->sclk_sel, ts->iface->sclk); if (ret) goto disable_pclk; /* Reparent the sample clock to the TDM interface */ ret = clk_set_parent(formatter->lrclk_sel, ts->iface->lrclk); if (ret) goto disable_pclk; formatter->stream = ts; ret = axg_tdm_formatter_attach(formatter); if (ret) goto disable_pclk; return 0; disable_pclk: clk_disable_unprepare(formatter->pclk); return ret; } static void axg_tdm_formatter_power_down(struct axg_tdm_formatter *formatter) { axg_tdm_formatter_dettach(formatter); clk_disable_unprepare(formatter->pclk); formatter->stream = NULL; } int axg_tdm_formatter_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *control, int event) { struct snd_soc_component *c = snd_soc_dapm_to_component(w->dapm); struct axg_tdm_formatter *formatter = snd_soc_component_get_drvdata(c); int ret = 0; switch (event) { case SND_SOC_DAPM_PRE_PMU: ret = axg_tdm_formatter_power_up(formatter, w); break; case SND_SOC_DAPM_PRE_PMD: axg_tdm_formatter_power_down(formatter); break; default: dev_err(c->dev, "Unexpected event %d\n", event); return -EINVAL; } return ret; } EXPORT_SYMBOL_GPL(axg_tdm_formatter_event); int axg_tdm_formatter_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; const struct axg_tdm_formatter_driver *drv; struct axg_tdm_formatter *formatter; struct resource *res; void __iomem *regs; int ret; drv = of_device_get_match_data(dev); if (!drv) { dev_err(dev, "failed to match device\n"); return -ENODEV; } formatter = devm_kzalloc(dev, sizeof(*formatter), GFP_KERNEL); if (!formatter) return -ENOMEM; platform_set_drvdata(pdev, formatter); formatter->drv = drv; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); regs = devm_ioremap_resource(dev, res); if (IS_ERR(regs)) return PTR_ERR(regs); formatter->map = devm_regmap_init_mmio(dev, regs, drv->regmap_cfg); if (IS_ERR(formatter->map)) { dev_err(dev, "failed to init regmap: %ld\n", PTR_ERR(formatter->map)); return PTR_ERR(formatter->map); } /* Peripharal clock */ formatter->pclk = devm_clk_get(dev, "pclk"); if (IS_ERR(formatter->pclk)) { ret = PTR_ERR(formatter->pclk); if (ret != -EPROBE_DEFER) dev_err(dev, "failed to get pclk: %d\n", ret); return ret; } /* Formatter bit clock */ formatter->sclk = devm_clk_get(dev, "sclk"); if (IS_ERR(formatter->sclk)) { ret = PTR_ERR(formatter->sclk); if (ret != -EPROBE_DEFER) dev_err(dev, "failed to get sclk: %d\n", ret); return ret; } /* Formatter sample clock */ formatter->lrclk = devm_clk_get(dev, "lrclk"); if (IS_ERR(formatter->lrclk)) { ret = PTR_ERR(formatter->lrclk); if (ret != -EPROBE_DEFER) dev_err(dev, "failed to get lrclk: %d\n", ret); return ret; } /* Formatter bit clock input multiplexer */ formatter->sclk_sel = devm_clk_get(dev, "sclk_sel"); if (IS_ERR(formatter->sclk_sel)) { ret = PTR_ERR(formatter->sclk_sel); if (ret != -EPROBE_DEFER) dev_err(dev, "failed to get sclk_sel: %d\n", ret); return ret; } /* Formatter sample clock input multiplexer */ formatter->lrclk_sel = devm_clk_get(dev, "lrclk_sel"); if (IS_ERR(formatter->lrclk_sel)) { ret = PTR_ERR(formatter->lrclk_sel); if (ret != -EPROBE_DEFER) dev_err(dev, "failed to get lrclk_sel: %d\n", ret); return ret; } return devm_snd_soc_register_component(dev, drv->component_drv, NULL, 0); } EXPORT_SYMBOL_GPL(axg_tdm_formatter_probe); int axg_tdm_stream_start(struct axg_tdm_stream *ts) { struct axg_tdm_formatter *formatter; int ret = 0; mutex_lock(&ts->lock); ts->ready = true; /* Start all the formatters attached to the stream */ list_for_each_entry(formatter, &ts->formatter_list, list) { ret = axg_tdm_formatter_enable(formatter); if (ret) { pr_err("failed to start tdm stream\n"); goto out; } } out: mutex_unlock(&ts->lock); return ret; } EXPORT_SYMBOL_GPL(axg_tdm_stream_start); void axg_tdm_stream_stop(struct axg_tdm_stream *ts) { struct axg_tdm_formatter *formatter; mutex_lock(&ts->lock); ts->ready = false; /* Stop all the formatters attached to the stream */ list_for_each_entry(formatter, &ts->formatter_list, list) { axg_tdm_formatter_disable(formatter); } mutex_unlock(&ts->lock); } EXPORT_SYMBOL_GPL(axg_tdm_stream_stop); struct axg_tdm_stream *axg_tdm_stream_alloc(struct axg_tdm_iface *iface) { struct axg_tdm_stream *ts; ts = kzalloc(sizeof(*ts), GFP_KERNEL); if (ts) { INIT_LIST_HEAD(&ts->formatter_list); mutex_init(&ts->lock); ts->iface = iface; } return ts; } EXPORT_SYMBOL_GPL(axg_tdm_stream_alloc); void axg_tdm_stream_free(struct axg_tdm_stream *ts) { /* * If the list is not empty, it would mean that one of the formatter * widget is still powered and attached to the interface while we * we are removing the TDM DAI. It should not be possible */ WARN_ON(!list_empty(&ts->formatter_list)); mutex_destroy(&ts->lock); kfree(ts); } EXPORT_SYMBOL_GPL(axg_tdm_stream_free); MODULE_DESCRIPTION("Amlogic AXG TDM formatter driver"); MODULE_AUTHOR("Jerome Brunet <[email protected]>"); MODULE_LICENSE("GPL v2");
{ "pile_set_name": "Github" }
// #docplaster // #docregion import { Component } from '@angular/core'; import { trigger, transition, state, animate, style } from '@angular/animations'; // #docregion toggle-animation @Component({ // #enddocregion toggle-animation selector: 'app-open-close-toggle', templateUrl: 'open-close.component.4.html', styleUrls: ['open-close.component.css'], // #docregion toggle-animation animations: [ trigger('childAnimation', [ // ... // #enddocregion toggle-animation state('open', style({ width: '250px', opacity: 1, backgroundColor: 'yellow' })), state('closed', style({ width: '100px', opacity: 0.5, backgroundColor: 'green' })), transition('* => *', [ animate('1s') ]), // #docregion toggle-animation ]), ], }) export class OpenCloseChildComponent { isDisabled = false; isOpen = false; // #enddocregion toggle-animation toggleAnimations() { this.isDisabled = !this.isDisabled; } toggle() { this.isOpen = !this.isOpen; } // #docregion toggle-animation } // #enddocregion toggle-animation
{ "pile_set_name": "Github" }
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved. #include "FluidSurface.h" #include "Importer.h" #include "LightingMesh.h" namespace Lightmass { /** Represents the fluid surface mesh to the static lighting system. */ static void GetStaticLightingVertex( const FVector4* QuadCorners, const FVector4* QuadUVCorners, uint32 VertexIndex, const FMatrix& LocalToWorld, const FMatrix& LocalToWorldInverseTranspose, FStaticLightingVertex& OutVertex ) { OutVertex.WorldPosition = LocalToWorld.TransformPosition(QuadCorners[VertexIndex]); OutVertex.WorldTangentX = LocalToWorld.TransformVector(FVector4(1, 0, 0, 1)).GetSafeNormal(); OutVertex.WorldTangentY = LocalToWorld.TransformVector(FVector4(0, 1, 0, 1)).GetSafeNormal(); OutVertex.WorldTangentZ = LocalToWorldInverseTranspose.TransformVector(FVector4(0, 0, 1, 1)).GetSafeNormal(); for(uint32 UVIndex = 0; UVIndex < 1; UVIndex++) { OutVertex.TextureCoordinates[UVIndex] = FVector2D(QuadUVCorners[VertexIndex].X, QuadUVCorners[VertexIndex].Y); } } // FStaticLightingMesh interface. void FFluidSurfaceStaticLightingMesh::GetTriangle(int32 TriangleIndex,FStaticLightingVertex& OutV0,FStaticLightingVertex& OutV1,FStaticLightingVertex& OutV2,int32& ElementIndex) const { GetStaticLightingVertex(QuadCorners,QuadUVCorners,QuadIndices[TriangleIndex * 3 + 0],LocalToWorld,LocalToWorldInverseTranspose,OutV0); GetStaticLightingVertex(QuadCorners,QuadUVCorners,QuadIndices[TriangleIndex * 3 + 1],LocalToWorld,LocalToWorldInverseTranspose,OutV1); GetStaticLightingVertex(QuadCorners,QuadUVCorners,QuadIndices[TriangleIndex * 3 + 2],LocalToWorld,LocalToWorldInverseTranspose,OutV2); ElementIndex = 0; } void FFluidSurfaceStaticLightingMesh::GetTriangleIndices(int32 TriangleIndex,int32& OutI0,int32& OutI1,int32& OutI2) const { OutI0 = QuadIndices[TriangleIndex * 3 + 0]; OutI1 = QuadIndices[TriangleIndex * 3 + 1]; OutI2 = QuadIndices[TriangleIndex * 3 + 2]; } void FFluidSurfaceStaticLightingMesh::Import( class FLightmassImporter& Importer ) { // import super class FStaticLightingMesh::Import( Importer ); Importer.ImportData((FFluidSurfaceStaticLightingMeshData*) this); check(MaterialElements.Num() > 0); } void FFluidSurfaceStaticLightingTextureMapping::Import( class FLightmassImporter& Importer ) { FStaticLightingTextureMapping::Import(Importer); // Can't use the FStaticLightingMapping Import functionality for this // as it only looks in the StaticMeshInstances map... Mesh = Importer.GetFluidMeshInstances().FindRef(Guid); check(Mesh); } } //namespace Lightmass
{ "pile_set_name": "Github" }
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for * full list of contributors). Published under the Clear BSD license. * See http://svn.openlayers.org/trunk/openlayers/license.txt for the * full text of the license. */ /** * @requires OpenLayers/Format/OWSCommon/v1.js */ /** * Class: OpenLayers.Format.OWSCommon.v1_1_0 * Parser for OWS Common version 1.1.0 which can be used by other parsers. * It is not intended to be used on its own. */ OpenLayers.Format.OWSCommon.v1_1_0 = OpenLayers.Class(OpenLayers.Format.OWSCommon.v1, { /** * Property: namespaces * {Object} Mapping of namespace aliases to namespace URIs. */ namespaces: { ows: "http://www.opengis.net/ows/1.1", xlink: "http://www.w3.org/1999/xlink" }, /** * Property: readers * Contains public functions, grouped by namespace prefix, that will * be applied when a namespaced node is found matching the function * name. The function will be applied in the scope of this parser * with two arguments: the node being read and a context object passed * from the parent. */ readers: { "ows": OpenLayers.Util.applyDefaults({ "AllowedValues": function(node, parameter) { parameter.allowedValues = {}; this.readChildNodes(node, parameter.allowedValues); }, "AnyValue": function(node, parameter) { parameter.anyValue = true; }, "Range": function(node, allowedValues) { allowedValues.range = {}; this.readChildNodes(node, allowedValues.range); }, "MinimumValue": function(node, range) { range.minValue = this.getChildValue(node); }, "MaximumValue": function(node, range) { range.maxValue = this.getChildValue(node); }, "Identifier": function(node, obj) { obj.identifier = this.getChildValue(node); }, "SupportedCRS": function(node, obj) { obj.supportedCRS = this.getChildValue(node); } }, OpenLayers.Format.OWSCommon.v1.prototype.readers["ows"]) }, CLASS_NAME: "OpenLayers.Format.OWSCommon.v1_1_0" });
{ "pile_set_name": "Github" }
//! moment.js locale configuration ;(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' && typeof require === 'function' ? factory(require('../moment')) : typeof define === 'function' && define.amd ? define(['../moment'], factory) : factory(global.moment) }(this, (function (moment) { 'use strict'; var numbersNouns = 'pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut'.split('_'); function translateFuture(output) { var time = output; time = (output.indexOf('jaj') !== -1) ? time.slice(0, -3) + 'leS' : (output.indexOf('jar') !== -1) ? time.slice(0, -3) + 'waQ' : (output.indexOf('DIS') !== -1) ? time.slice(0, -3) + 'nem' : time + ' pIq'; return time; } function translatePast(output) { var time = output; time = (output.indexOf('jaj') !== -1) ? time.slice(0, -3) + 'Hu’' : (output.indexOf('jar') !== -1) ? time.slice(0, -3) + 'wen' : (output.indexOf('DIS') !== -1) ? time.slice(0, -3) + 'ben' : time + ' ret'; return time; } function translate(number, withoutSuffix, string, isFuture) { var numberNoun = numberAsNoun(number); switch (string) { case 'ss': return numberNoun + ' lup'; case 'mm': return numberNoun + ' tup'; case 'hh': return numberNoun + ' rep'; case 'dd': return numberNoun + ' jaj'; case 'MM': return numberNoun + ' jar'; case 'yy': return numberNoun + ' DIS'; } } function numberAsNoun(number) { var hundred = Math.floor((number % 1000) / 100), ten = Math.floor((number % 100) / 10), one = number % 10, word = ''; if (hundred > 0) { word += numbersNouns[hundred] + 'vatlh'; } if (ten > 0) { word += ((word !== '') ? ' ' : '') + numbersNouns[ten] + 'maH'; } if (one > 0) { word += ((word !== '') ? ' ' : '') + numbersNouns[one]; } return (word === '') ? 'pagh' : word; } var tlh = moment.defineLocale('tlh', { months : 'tera’ jar wa’_tera’ jar cha’_tera’ jar wej_tera’ jar loS_tera’ jar vagh_tera’ jar jav_tera’ jar Soch_tera’ jar chorgh_tera’ jar Hut_tera’ jar wa’maH_tera’ jar wa’maH wa’_tera’ jar wa’maH cha’'.split('_'), monthsShort : 'jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’'.split('_'), monthsParseExact : true, weekdays : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'), weekdaysShort : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'), weekdaysMin : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'), longDateFormat : { LT : 'HH:mm', LTS : 'HH:mm:ss', L : 'DD.MM.YYYY', LL : 'D MMMM YYYY', LLL : 'D MMMM YYYY HH:mm', LLLL : 'dddd, D MMMM YYYY HH:mm' }, calendar : { sameDay: '[DaHjaj] LT', nextDay: '[wa’leS] LT', nextWeek: 'LLL', lastDay: '[wa’Hu’] LT', lastWeek: 'LLL', sameElse: 'L' }, relativeTime : { future : translateFuture, past : translatePast, s : 'puS lup', ss : translate, m : 'wa’ tup', mm : translate, h : 'wa’ rep', hh : translate, d : 'wa’ jaj', dd : translate, M : 'wa’ jar', MM : translate, y : 'wa’ DIS', yy : translate }, dayOfMonthOrdinalParse: /\d{1,2}\./, ordinal : '%d.', week : { dow : 1, // Monday is the first day of the week. doy : 4 // The week that contains Jan 4th is the first week of the year. } }); return tlh; })));
{ "pile_set_name": "Github" }
.. role:: cpp(code) :language: c++ .. role:: fortran(code) :language: fortran MLMG and Linear Operator Classes ================================ ``MLMG`` is a class for solving the linear system using the geometric multigrid method. The constructor of ``MLMG`` takes the reference to :cpp:`MLLinOp`, an abstract base class of various linear operator classes, :cpp:`MLABecLaplacian`, :cpp:`MLPoisson`, :cpp:`MLNodeLaplacian`, etc. We choose the type of linear operator class according to the type the linear system to solve. - :cpp:`MLABecLaplacian` for cell-centered canonical form (equation :eq:`eqn::abeclap`). - :cpp:`MLPoisson` for cell-centered constant coefficient Poisson's equation :math:`\nabla^2 \phi = f`. - :cpp:`MLNodeLaplacian` for nodal variable coefficient Poisson's equation :math:`\nabla \cdot (\sigma \nabla \phi) = f`. The constructors of these linear operator classes are in the form like below .. highlight:: c++ :: MLABecLaplacian (const Vector<Geometry>& a_geom, const Vector<BoxArray>& a_grids, const Vector<DistributionMapping>& a_dmap, const LPInfo& a_info = LPInfo(), const Vector<FabFactory<FArrayBox> const*>& a_factory = {}); It takes :cpp:`Vectors` of :cpp:`Geometry`, :cpp:`BoxArray` and :cpp:`DistributionMapping`. The arguments are :cpp:`Vectors` because MLMG can do multi-level composite solve. If you are using it for single-level, you can do .. highlight:: c++ :: // Given Geometry geom, BoxArray grids, and DistributionMapping dmap on single level MLABecLaplacian mlabeclaplacian({geom}, {grids}, {dmap}); to let the compiler construct :cpp:`Vectors` for you. Recall that the classes :cpp:`Vector`, :cpp:`Geometry`, :cpp:`BoxArray`, and :cpp:`DistributionMapping` are defined in chapter :ref:`Chap:Basics`. There are two new classes that are optional parameters. :cpp:`LPInfo` is a class for passing parameters. :cpp:`FabFactory` is used in problems with embedded boundaries (chapter :ref:`Chap:EB`). After the linear operator is built, we need to set up boundary conditions. This will be discussed later in section :ref:`sec:linearsolver:bc`. For :cpp:`MLABecLaplacian`, we next need to call member functions .. highlight:: c++ :: void setScalars (Real A, Real B); void setACoeffs (int amrlev, const MultiFab& alpha); void setBCoeffs (int amrlev, const Array<MultiFab const*,AMREX_SPACEDIM>& beta); to set up the coefficients for equation :eq:`eqn::abeclap`. This is unnecessary for :cpp:`MLPoisson`, as there are no coefficients to set. For :cpp:`MLNodeLaplacian`, one needs to call the member function .. highlight:: c++ :: void setSigma (int amrlev, const MultiFab& a_sigma); The :cpp:`int amrlev` parameter should be zero for single-level solves. For multi-level solves, each level needs to be provided with ``alpha`` and ``beta``, or ``Sigma``. For composite solves, :cpp:`amrlev` 0 will mean the lowest level for the solver, which is not necessarily the lowest level in the AMR hierarchy. This is so solves can be done on different sections of the AMR hierarchy, e.g. on AMR levels 3 to 5. After boundary conditions and coefficients are prescribed, the linear operator is ready for an MLMG object like below. .. highlight:: C++ :: MLMG mlmg(mlabeclaplacian); Optional parameters can be set (see section :ref:`sec:linearsolver:pars`), and then we can use the ``MLMG`` member function .. highlight:: C++ :: Real solve (const Vector<MultiFab*>& a_sol, const Vector<MultiFab const*>& a_rhs, Real a_tol_rel, Real a_tol_abs); to solve the problem given an initial guess and a right-hand side. Zero is a perfectly fine initial guess. The two :cpp:`Reals` in the argument list are the targeted relative and absolute error tolerances. The solver will terminate when one of these targets is met. Set the absolute tolerance to zero if one does not have a good value for it. The return value of :cpp:`solve` is the max-norm error. After the solver returns successfully, if needed, we can call .. highlight:: c++ :: void compResidual (const Vector<MultiFab*>& a_res, const Vector<MultiFab*>& a_sol, const Vector<MultiFab const*>& a_rhs); to compute residual (i.e., :math:`f - L(\phi)`) given the solution and the right-hand side. For cell-centered solvers, we can also call the following functions to compute gradient :math:`\nabla \phi` and fluxes :math:`-B \nabla \phi`. .. highlight:: c++ :: void getGradSolution (const Vector<Array<MultiFab*,AMREX_SPACEDIM> >& a_grad_sol); void getFluxes (const Vector<Array<MultiFab*,AMREX_SPACEDIM> >& a_fluxes); .. _sec:linearsolver:bc: Boundary Conditions =================== We now discuss how to set up boundary conditions for linear operators. In the following, physical domain boundaries refer to the boundaries of the physical domain, whereas coarse/fine boundaries refer to the boundaries between AMR levels. The following steps must be followed in the exact order. 1) For any type of solver, we first need to set physical domain boundary types via the :cpp:`MLLinOp` member function .. highlight:: c++ :: void setDomainBC (const Array<BCType,AMREX_SPACEDIM>& lobc, // for lower ends const Array<BCType,AMREX_SPACEDIM>& hibc); // for higher ends The supported BC types at the physical domain boundaries are - :cpp:`LinOpBCType::Periodic` for periodic boundary. - :cpp:`LinOpBCType::Dirichlet` for Dirichlet boundary condition. - :cpp:`LinOpBCType::Neumann` for homogeneous Neumann boundary condition. - :cpp:`LinOpBCType::inhomogNeumann` for inhomogeneous Neumann boundary condition. - :cpp:`LinOpBCType::reflect_odd` for reflection with sign changed. 2) Cell-centered solvers only: if we want to do a linear solve where the boundary conditions on the coarsest AMR level of the solve come from a coarser level (e.g. the base AMR level of the solve is > 0 and does not cover the entire domain), we must explicitly provide the coarser data. Boundary conditions from a coarser level are always Dirichlet. Note that this step, if needed, must be performed before the step below. The :cpp:`MLLinOp` member function for this step is .. highlight:: c++ :: void setCoarseFineBC (const MultiFab* crse, int crse_ratio); Here :cpp:`const MultiFab* crse` contains the Dirichlet boundary values at the coarse resolution, and :cpp:`int crse_ratio` (e.g., 2) is the refinement ratio between the coarsest solver level and the AMR level below it. The MultiFab crse does not need to have ghost cells itself. If the coarse grid bc's for the solve are identically zero, :cpp:`nullptr` can be passed instead of :cpp:`crse`. 3) Cell-centered solvers only: before the solve one must always call the :cpp:`MLLinOp` member function .. highlight:: c++ :: virtual void setLevelBC (int amrlev, const MultiFab* levelbcdata) = 0; If we want to supply any inhomogeneous Dirichlet or Neumann boundary conditions at the domain boundaries, we must supply those values in ``MultiFab* levelbcdata``, which must have at least one ghost cell. Note that the argument :cpp:`amrlev` is relative to the solve, not necessarily the full AMR hierarchy; amrlev = 0 refers to the coarsest level of the solve. If the boundary condition is Dirichlet the ghost cells outside the domain boundary of ``levelbcdata`` must hold the value of the solution at the domain boundary; if the boundary condition is Neumann those ghost cells must hold the value of the gradient of the solution normal to the boundary (e.g. it would hold dphi/dx on both the low and high faces in the x-direction). If the boundary conditions contain no inhomogeneous Dirichlet or Neumann boundaries, we can pass :cpp:`nullptr` instead of a MultiFab. We can use the solution array itself to hold these values; the values are copied to internal arrays and will not be over-written when the solution array itself is being updated by the solver. Note, however, that this call does not provide an initial guess for the solve. It should be emphasized that the data in ``levelbcdata`` for Dirichlet or Neumann boundaries are assumed to be exactly on the face of the physical domain; storing these values in the ghost cell of a cell-centered array is a convenience of implementation. .. _sec:linearsolver:pars: Parameters ========== There are many parameters that can be set. Here we discuss some commonly used ones. :cpp:`MLLinOp::setVerbose(int)`, :cpp:`MLMG::setVerbose(int)` and :cpp:`MLMG:setBottomVerbose(int)` can be control the verbosity of the linear operator, multigrid solver and the bottom solver, respectively. The multigrid solver is an iterative solver. The maximal number of iterations can be changed with :cpp:`MLMG::setMaxIter(int)`. We can also do a fixed number of iterations with :cpp:`MLMG::setFixedIter(int)`. By default, V-cycle is used. We can use :cpp:`MLMG::setMaxFmgIter(int)` to control how many full multigrid cycles can be done before switching to V-cycle. :cpp:`LPInfo::setMaxCoarseningLevel(int)` can be used to control the maximal number of multigrid levels. We usually should not call this function. However, we sometimes build the solver to simply apply the operator (e.g., :math:`L(\phi)`) without needing to solve the system. We can do something as follows to avoid the cost of building coarsened operators for the multigrid. .. highlight:: c++ :: MLABecLaplacian mlabeclap({geom}, {grids}, {dmap}, LPInfo().setMaxCoarseningLevel(0)); // set up BC // set up coefficients MLMG mlmg(mlabeclap); // out = L(in) mlmg.apply(out, in); // here both in and out are const Vector<MultiFab*>& At the bottom of the multigrid cycles, we use the biconjugate gradient stabilized method as the bottom solver. :cpp:`MLMG` member method .. highlight:: c++ :: void setBottomSolver (BottomSolver s); can be used to change the bottom solver. Available choices are - :cpp:`MLMG::BottomSolver::bicgstab`: The default. - :cpp:`MLMG::BottomSolver::cg`: The conjugate gradient method. The matrix must be symmetric. - :cpp:`MLMG::BottomSolver::smoother`: Smoother such as Gauss-Seidel. - :cpp:`MLMG::BottomSolver::bicgcg`: Start with bicgstab. Switch to cg if bicgstab fails. The matrix must be symmetric. - :cpp:`MLMG::BottomSolver::cgbicg`: Start with cg. Switch to bicgstab if cg fails. The matrix must be symmetric. - :cpp:`MLMG::BottomSolver::hypre`: BoomerAMG in hypre. - :cpp:`MLMG::BottomSolver::petsc`: Currently for cell-centered only. Curvilinear Coordinates ======================= The linear solvers support curvilinear coordinates including 1D spherical and 2d cylindrical :math:`(r,z)`. In those cases, the divergence operator has extra metric terms. If one does not want the solver to include the metric terms because they have been handled in other ways, one can call :cpp:`setMetricTerm(bool)` with :cpp:`false` on the :cpp:`LPInfo` object passed to the constructor of linear operators. Embedded Boundaries =================== AMReX supports multi-level solvers for use with embedded boundaries. These include 1) cell-centered solvers with homogeneous Neumann, homogeneous Dirichlet, or inhomogeneous Dirichlet boundary conditions on the EB faces, and 2) nodal solvers with homogeneous Neumann boundary conditions on the EB faces. To use a cell-centered solver with EB, one builds a linear operator :cpp:`MLEBABecLap` with :cpp:`EBFArrayBoxFactory` (instead of a :cpp:`MLABecLaplacian`) .. highlight:: c++ :: MLEBABecLap (const Vector<Geometry>& a_geom, const Vector<BoxArray>& a_grids, const Vector<DistributionMapping>& a_dmap, const LPInfo& a_info, const Vector<EBFArrayBoxFactory const*>& a_factory); The usage of this EB-specific class is essentially the same as :cpp:`MLABecLaplacian`. The default boundary condition on EB faces is homogeneous Neumann. To set homogeneous Dirichlet boundary conditions, call .. highlight:: c++ :: ml_ebabeclap->setEBHomogDirichlet(lev, coeff); where coeff can be a real number (i.e. the value is the same at every cell) or is the MultiFab holding the coefficient of the gradient at each cell with an EB face. To set inhomogeneous Dirichlet boundary conditions, call .. highlight:: c++ :: ml_ebabeclap->setEBDirichlet(lev, phi_on_eb, coeff); where phi_on_eb is the MultiFab holding the Dirichlet values in every cut cell, and coeff again is a real number (i.e. the value is the same at every cell) or a MultiFab holding the coefficient of the gradient at each cell with an EB face. Currently there are options to define the face-based coefficients on face centers vs face centroids, and to interpret the solution variable as being defined on cell centers vs cell centroids. The default is for the solution variable to be defined at cell centers; to tell the solver to interpret the solution variable as living at cell centroids, you must set .. highlight:: c++ :: ml_ebabeclap->setPhiOnCentroid(); The default is for the face-based coefficients to be defined at face centers; to tell the that the face-based coefficients should be interpreted as living at face centroids, modify the setBCoeffs command to be .. highlight:: c++ :: ml_ebabeclap->setBCoeffs(lev, beta, MLMG::Location::FaceCentroid); External Solvers ================ AMReX can use the `hypre <https://computing.llnl.gov/projects/hypre-scalable-linear-solvers-multigrid-methods>`_ algebraic multigrid solver, BoomerAMG, as a bottom solver for both cell-centered and node-based problems. For challenging problems, our geometric multigrid solver may have difficulty solving, whereas an algebraic multigrid method might be more robust. We note that by default our solver always tries to geometrically coarsen the problem as much as possible. However, as we have mentioned, we can call :cpp:`setMaxCoarseningLevel(0)` on the :cpp:`LPInfo` object passed to the constructor of a linear operator to disable the coarsening completely. In that case the bottom solver is solving the residual correction form of the original problem. To build Hypre, follow the next steps: .. highlight:: c++ :: 1.- git clone https://github.com/hypre-space/hypre.git 2.- cd hypre/src 3.- ./configure (if you want to build hypre with long long int, do ./configure --enable-bigint ) 4.- make install 5.- Create an environment variable with the HYPRE directory -- HYPRE_DIR=/hypre_path/hypre/src/hypre To use hypre, one must include ``amrex/Src/Extern/HYPRE`` in the build system. For examples of using hypre, we refer the reader to ``Tutorials/LinearSolvers/ABecLaplacian_C`` or ``Tutorials/LinearSolvers/NodalProjection_EB``. Caveat: to use hypre for the nodal solver, you must either build with USE_EB = TRUE, or explicitly set the coarsening strategy in the calling routine to be ``RAP`` rather than ``Sigma`` by adding .. highlight:: c++ :: nodal_projector.getLinOp().setCoarseningStrategy(MLNodeLaplacian::CoarseningStrategy::RAP); where :cpp:`nodal_projector` is the :cpp:`NodalProjector` object we have built. AMReX can also use `PETSc <https://www.mcs.anl.gov/petsc/>`_ as a bottom solver for cell-centered problems. To build PETSc, follow the next steps: .. highlight:: c++ :: 1.- git clone https://github.com/petsc/petsc.git 2.- cd petsc 3.- ./configure --download-hypre=yes --prefix=build_dir 4.- Follow the steps given by petsc 5.- Create an environment variable with the PETSC directory -- PETSC_DIR=/petsc_path/petsc/build_dir To use PETSc, one must include ``amrex/Src/Extern/PETSc`` in the build system. For an example of using PETSc, we refer the reader to ``Tutorials/LinearSolvers/ABecLaplacian_C``. MAC Projection ========================= Some codes define a velocity field :math:`U = (u,v,w)` on faces, i.e. :math:`u` is defined on x-faces, :math:`v` is defined on y-faces, and :math:`w` is defined on z-faces. We refer to the exact projection of this velocity field as a MAC projection, in which we solve .. math:: D( \beta \nabla \phi) = D(U^*) - S for :math:`\phi` and then set .. math:: U = U^* - \beta \nabla \phi where :math:`U^*` is a vector field (typically velocity) that we want to satisfy :math:`D(U) = S`. For incompressible flow, :math:`S = 0`. The MacProjection class can be defined and used to perform the MAC projection without explicitly calling the solver directly. In addition to solving the variable coefficient Poisson equation, the MacProjector internally computes the divergence of the vector field, :math:`D(U^*)`, to compute the right-hand-side, and after the solve, subtracts the weighted gradient term to make the vector field result satisfy the divergence constraint. In the simplest form of the call, :math:`S` is assumed to be zero and does not need to be specified. Typically, the user does not allocate the solution array, but it is also possible to create and pass in the solution array and have :math:`\phi` returned as well as :math:`U`. Caveat: Currently the MAC projection only works when the base level covers the full domain; it does not yet have the interface to pass boundary conditions for a fine level that come from coarser data. Also note that any Dirichlet or Neumann boundary conditions at domain boundaries are assumed to be homogeneous. The call to the :cpp:`MLLinOp` member function :cpp:`setLevelBC` occurs inside the MacProjection class; one does not need to call that explicitly when using the MacProjection class. The code below is taken from ``Tutorials/LinearSolvers/MAC_Projection_EB/main.cpp`` and demonstrates how to set up the MACProjector object and use it to perform a MAC projection. .. highlight:: c++ :: EBFArrayBoxFactory factory(eb_level, geom, grids, dmap, ng_ebs, ebs); // allocate face-centered velocities and face-centered beta coefficient for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) { vel[idim].define (amrex::convert(grids,IntVect::TheDimensionVector(idim)), dmap, 1, 1, MFInfo(), factory); beta[idim].define(amrex::convert(grids,IntVect::TheDimensionVector(idim)), dmap, 1, 0, MFInfo(), factory); beta[idim].setVal(1.0); // set beta to 1 } // If we want to use phi elsewhere, we must create an array in which to return the solution // MultiFab phi_inout(grids, dmap, 1, 1, MFInfo(), factory); // If we want to supply a non-zero S we must allocate and fill it outside the solver // MultiFab S(grids, dmap, 1, 0, MFInfo(), factory); // Set S here ... // set initial velocity to U=(1,0,0) AMREX_D_TERM(vel[0].setVal(1.0);, vel[1].setVal(0.0);, vel[2].setVal(0.0);); LPInfo lp_info; // If we want to use hypre to solve the full problem we do not need to coarsen the GMG stencils if (use_hypre_as_full_solver) lp_info.setMaxCoarseningLevel(0); MacProjector macproj({amrex::GetArrOfPtrs(vel)}, // face-based velocity {amrex::GetArrOfConstPtrs(beta)}, // beta {geom}, // the geometry object lp_info); // structure for passing info to the operator // Here we specify the desired divergence S // MacProjector macproj({amrex::GetArrOfPtrs(vel)}, // face-based velocity // {amrex::GetArrOfConstPtrs(beta)}, // beta // {geom}, // the geometry object // lp_info, // structure for passing info to the operator // {&S}); // defines the specified RHS divergence // Set bottom-solver to use hypre instead of native BiCGStab if (use_hypre_as_full_solver || use_hypre_as_bottom_solver) macproj.setBottomSolver(MLMG::BottomSolver::hypre); // Set boundary conditions. // Here we use Neumann on the low x-face, Dirichlet on the high x-face, // and periodic in the other two directions // (the first argument is for the low end, the second is for the high end) // Note that Dirichlet and Neumann boundary conditions are assumed to be homogeneous. macproj.setDomainBC({AMREX_D_DECL(LinOpBCType::Neumann, LinOpBCType::Periodic, LinOpBCType::Periodic)}, {AMREX_D_DECL(LinOpBCType::Dirichlet, LinOpBCType::Periodic, LinOpBCType::Periodic)}); macproj.setVerbose(mg_verbose); macproj.setCGVerbose(cg_verbose); // Define the relative tolerance Real reltol = 1.e-8; // Define the absolute tolerance; note that this argument is optional Real abstol = 1.e-15; // Solve for phi and subtract from the velocity to make it divergence-free // Note that when we build with USE_EB = TRUE, we must specify whether the velocities live // at face centers (MLMG::Location::FaceCenter) or face centroids (MLMG::Location::FaceCentroid) macproj.project(reltol,abstol,MLMG::Location::FaceCenter); // If we want to use phi elsewhere, we can pass in an array in which to return the solution // macproj.project({&phi_inout},reltol,abstol,MLMG::Location::FaceCenter); See ``Tutorials/LinearSolvers/MAC_Projection_EB`` for the complete working example. Nodal Projection ================ Some codes define a velocity field :math:`U = (u,v,w)` with all components co-located on cell centers. The nodal solver in AMReX can be used to compute an approximate projection of the cell-centered velocity field, with pressure and velocity divergence defined on nodes. When we use the nodal solver this way, and subtract only the cell average of the gradient from the velocity, it is effectively an approximate projection. As with the MAC projection, consider that we want to solve .. math:: D( \beta \nabla \phi) = D(U^*) - S for :math:`\phi` and then set .. math:: U = U^* - \beta \nabla \phi where :math:`U^*` is a vector field defined on cell centers and we want to satisfy :math:`D(U) = S`. For incompressible flow, :math:`S = 0`. Currently this nodal approximate projection does not exist in a separate operator like the MAC projection; instead we demonstrate below the steps needed to compute the approximate projection. This means we must compute explicitly the right-hand-side , including the the divergence of the vector field, :math:`D(U^*)`, solve the variable coefficient Poisson equation, then subtract the weighted gradient term to make the vector field result satisfy the divergence constraint. .. highlight:: c++ :: // // Given a cell-centered velocity (vel) field, a cell-centered // scalar field (sigma) field, and a source term S (either node- // or cell-centered )solve: // // div( sigma * grad(phi) ) = div(vel) - S // // and then perform the projection: // // vel = vel - sigma * grad(phi) // // // Create the EB factory // EBFArrayBoxFactory factory(eb_level, geom, grids, dmap, ng_ebs, ebs); // // Create the cell-centered velocity field we want to project // MultiFab vel(grids, dmap, AMREX_SPACEDIM, 1, MFInfo(), factory); // Set velocity field to (1,0,0) including ghost cells for this example vel.setVal(1.0, 0, 1, 1); vel.setVal(0.0, 1, AMREX_SPACEDIM-1, 1); // // Setup linear operator, AKA the nodal Laplacian // LPInfo lp_info; // If we want to use hypre to solve the full problem we do not need to coarsen the GMG stencils // if (use_hypre_as_full_solver) // lp_info.setMaxCoarseningLevel(0); MLNodeLaplacian matrix({geom}, {grids}, {dmap}, lp_info, Vector<EBFArrayBoxFactory const*>{&factory}); // Set boundary conditions. // Here we use Neumann on the low x-face, Dirichlet on the high x-face, // and periodic in the other two directions // (the first argument is for the low end, the second is for the high end) // Note that Dirichlet boundary conditions are assumed to be homogeneous (i.e. phi = 0) matrix.setDomainBC({AMREX_D_DECL(LinOpBCType::Neumann, LinOpBCType::Periodic, LinOpBCType::Periodic)}, {AMREX_D_DECL(LinOpBCType::Dirichlet, LinOpBCType::Periodic, LinOpBCType::Periodic)}); // Set matrix attributes to be used by MLMG solver matrix.setGaussSeidel(true); matrix.setHarmonicAverage(false); // // Compute RHS // // NOTE: it's up to the user to compute the RHS. as opposed // to the MAC projection case !!! // // NOTE: do this operation AFTER setting up the linear operator so // that compRHS method can be used // // RHS is nodal const BoxArray & nd_grids = amrex::convert(grids, IntVect{1,1,1}); // nodal grids // MultiFab to host RHS MultiFab rhs(nd_grids, dmap, 1, 1, MFInfo(), factory); // Cell-centered contributions to RHS MultiFab S_cc(grids, dmap, 1, 1, MFInfo(), factory); S_cc.setVal(0.0); // Set it to zero for this example // Node-centered contributions to RHS MultiFab S_nd(nd_grids, dmap, 1, 1, MFInfo(), factory); S_nd.setVal(0.0); // Set it to zero for this example // Compute RHS -- vel must be cell-centered matrix.compRHS({&rhs}, {&vel}, {&S_nd}, {&S_cc}); // // Create the cell-centered sigma field and set it to 1 for this example // MultiFab sigma(grids, dmap, 1, 1, MFInfo(), factory); sigma.setVal(1.0); // Set sigma matrix.setSigma(0, sigma); // // Create node-centered phi // MultiFab phi(nd_grids, dmap, 1, 1, MFInfo(), factory); phi.setVal(0.0); // // Setup MLMG solver // MLMG nodal_solver(matrix); // We can specify the maximum number of iterations nodal_solver.setMaxIter(mg_maxiter); nodal_solver.setCGMaxIter(mg_cg_maxiter); nodal_solver.setVerbose(mg_verbose); nodal_solver.setCGVerbose(mg_cg_verbose); // Set bottom-solver to use hypre instead of native BiCGStab // ( we could also have set this to cg, bicgcg, cgbicg) // if (use_hypre_as_full_solver || use_hypre_as_bottom_solver) // nodal_solver.setBottomSolver(MLMG::BottomSolver::hypre); // Define the relative tolerance Real reltol = 1.e-8; // Define the absolute tolerance; note that this argument is optional Real abstol = 1.e-15; // // Solve div( sigma * grad(phi) ) = RHS // nodal_solver.solve( {&phi}, {&rhs}, reltol, abstol); // // Create cell-centered MultiFab to hold value of -sigma*grad(phi) at cell-centers // // MultiFab fluxes(grids, dmap, AMREX_SPACEDIM, 1, MFInfo(), factory); fluxes.setVal(0.0); // Get fluxes from solver nodal_solver.getFluxes( {&fluxes} ); // // Apply projection explicitly -- vel = vel - sigma * grad(phi) // MultiFab::Add( *vel, *fluxes, 0, 0, AMREX_SPACEDIM, 0); See ``Tutorials/LinearSolvers/Nodal_Projection_EB`` for the complete working example. Tensor Solve ============ Application codes that solve the Navier-Stokes equations need to evaluate the viscous term; solving for this term implicitly requires a multi-component solve with cross terms. Because this is a commonly used motif, we provide a tensor solve for cell-centered velocity components. Consider a velocity field :math:`U = (u,v,w)` with all components co-located on cell centers. The viscous term can be written in vector form as .. math:: \nabla \cdot (\eta \nabla U) + \nabla \cdot (\eta (\nabla U)^T ) + \nabla \cdot ( (\kappa - \frac{2}{3} \eta) (\nabla \cdot U) ) and in 3-d Cartesian component form as .. math:: ( (\eta u_x)_x + (\eta u_y)_y + (\eta u_z)_z ) + ( (\eta u_x)_x + (\eta v_x)_y + (\eta w_x)_z ) + ( (\kappa - \frac{2}{3} \eta) (u_x+v_y+w_z) )_x ( (\eta v_x)_x + (\eta v_y)_y + (\eta v_z)_z ) + ( (\eta u_y)_x + (\eta v_y)_y + (\eta w_y)_z ) + ( (\kappa - \frac{2}{3} \eta) (u_x+v_y+w_z) )_y ( (\eta w_x)_x + (\eta w_y)_y + (\eta w_z)_z ) + ( (\eta u_z)_x + (\eta v_z)_y + (\eta w_z)_z ) + ( (\kappa - \frac{2}{3} \eta) (u_x+v_y+w_z) )_z Here :math:`\eta` is the dynamic viscosity and :math:`\kappa` is the bulk viscosity. We evaluate the following terms from the above using the ``MLABecLaplacian`` and ``MLEBABecLaplacian`` operators; .. math:: ( (\frac{4}{3} \eta + \kappa) u_x)_x + ( \eta u_y)_y + (\eta u_z)_z (\eta v_x)_x + ( (\frac{4}{3} \eta + \kappa) v_y)_y + (\eta v_z)_z (\eta w_x)_x + ( \eta w_y)_y + ( (\frac{4}{3} \eta + \kappa) w_z)_z the following cross-terms are evaluated separately using the ``MLTensorOp`` and ``MLEBTensorOp`` operators. .. math:: ( (\kappa - \frac{2}{3} \eta) (v_y + w_z) )_x + (\eta v_x)_y + (\eta w_x)_z (\eta u_y)_x + ( (\kappa - \frac{2}{3} \eta) (u_x + w_z) )_y + (\eta w_y)_z (\eta u_z)_x + (\eta v_z)_y - ( (\kappa - \frac{2}{3} \eta) (u_x + v_y) )_z The code below is an example of how to set up the solver to compute the viscous term `divtau` explicitly: .. highlight:: c++ :: Box domain(geom[0].Domain()); // Set BCs for Poisson solver in bc_lo, bc_hi ... // // First define the operator "ebtensorop" // Note we call LPInfo().setMaxCoarseningLevel(0) because we are only applying the operator, // not doing an implicit solve // // (alpha * a - beta * (del dot b grad)) sol // // LPInfo info; MLEBTensorOp ebtensorop(geom, grids, dmap, LPInfo().setMaxCoarseningLevel(0), amrex::GetVecOfConstPtrs(ebfactory)); // It is essential that we set MaxOrder of the solver to 2 // if we want to use the standard sol(i)-sol(i-1) approximation // for the gradient at Dirichlet boundaries. // The solver's default order is 3 and this uses three points for the // gradient at a Dirichlet boundary. ebtensorop.setMaxOrder(2); // LinOpBCType Definitions are in amrex/Src/Boundary/AMReX_LO_BCTYPES.H ebtensorop.setDomainBC ( {(LinOpBCType)bc_lo[0], (LinOpBCType)bc_lo[1], (LinOpBCType)bc_lo[2]}, {(LinOpBCType)bc_hi[0], (LinOpBCType)bc_hi[1], (LinOpBCType)bc_hi[2]} ); // Return div (eta grad)) phi ebtensorop.setScalars(0.0, -1.0); amrex::Vector<amrex::Array<std::unique_ptr<amrex::MultiFab>, AMREX_SPACEDIM>> b; b.resize(max_level + 1); // Compute the coefficients for (int lev = 0; lev < nlev; lev++) { // We average eta onto faces for(int dir = 0; dir < AMREX_SPACEDIM; dir++) { BoxArray edge_ba = grids[lev]; edge_ba.surroundingNodes(dir); b[lev][dir].reset(new MultiFab(edge_ba, dmap[lev], 1, nghost, MFInfo(), *ebfactory[lev])); } average_cellcenter_to_face( GetArrOfPtrs(b[lev]), *etan[lev], geom[lev] ); b[lev][0] -> FillBoundary(geom[lev].periodicity()); b[lev][1] -> FillBoundary(geom[lev].periodicity()); b[lev][2] -> FillBoundary(geom[lev].periodicity()); ebtensorop.setShearViscosity (lev, GetArrOfConstPtrs(b[lev])); ebtensorop.setEBShearViscosity(lev, (*eta[lev])); ebtensorop.setLevelBC ( lev, GetVecOfConstPtrs(vel)[lev] ); } MLMG solver(ebtensorop); solver.apply(GetVecOfPtrs(divtau), GetVecOfPtrs(vel)); Multi-Component Operators ========================= This section discusses solving linear systems in which the solution variable :math:`\mathbf{\phi}` has multiple components. An example (implemented in the ``MultiComponent`` tutorial) might be: .. math:: D(\mathbf{\phi})_i = \sum_{i=1}^N \alpha_{ij} \nabla^2 \phi_j (Note: only operators of the form :math:`D:\mathbb{R}^n\to\mathbb{R}^n` are currently allowed.) - To implement a multi-component *cell-based* operator, inherit from the ``MLCellLinOp`` class. Override the ``getNComp`` function to return the number of components (``N``)that the operator will use. The solution and rhs fabs must also have at least one ghost node. ``Fapply``, ``Fsmooth``, ``Fflux`` must be implemented such that the solution and rhs fabs all have ``N`` components. - Implementing a multi-component *node-based* operator is slightly different. A MC nodal operator must specify that the reflux-free coarse/fine strategy is being used by the solver. .. code:: solver.setCFStrategy(MLMG::CFStrategy::ghostnodes); The reflux-free method circumvents the need to implement a special ``reflux`` at the coarse-fine boundary. This is accomplished by using ghost nodes. Each AMR level must have 2 layers of ghost nodes. The second (outermost) layer of nodes is treated as constant by the relaxation, essentially acting as a Dirichlet boundary. The first layer of nodes is evolved using the relaxation, in the same manner as the rest of the solution. When the residual is restricted onto the coarse level (in ``reflux``) this allows the residual at the coarse-fine boundary to be interpolated using the first layer of ghost nodes. :numref:`fig::refluxfreecoarsefine` illustrates the how the coarse-fine update takes place. .. _fig::refluxfreecoarsefine: .. figure:: ./LinearSolvers/refluxfreecoarsefine.png :height: 2cm :align: center : Reflux-free coarse-fine boundary update. Level 2 ghost nodes (small dark blue) are interpolated from coarse boundary. Level 1 ghost nodes are updated during the relaxation along with all the other interior fine nodes. Coarse nodes (large blue) on the coarse/fine boundary are updated by restricting with interior nodes and the first level of ghost nodes. Coarse nodes underneath level 2 ghost nodes are not updated. The remaining coarse nodes are updates by restriction. The MC nodal operator can inherit from the ``MCNodeLinOp`` class. ``Fapply``, ``Fsmooth``, and ``Fflux`` must update level 1 ghost nodes that are inside the domain. `interpolation` and `restriction` can be implemented as usual. `reflux` is a straightforward restriction from fine to coarse, using level 1 ghost nodes for restriction as described above. See ``Tutorials/LinearSolvers/MultiComponent`` for a complete working example. .. solver reuse
{ "pile_set_name": "Github" }
<table cellpadding="2" cellspacing="1" width="98%"> <tr> <td>允许上传的文件类型</td> <td><input type="text" name="setting[upload_allowext]" value="<?php echo $setting['upload_allowext'];?>" size="40" class="input-text"></td> </tr> <tr> <td>是否从已上传中选择</td> <td><input type="radio" name="setting[isselectimage]" value="1" <?php if($setting['isselectimage']) echo 'checked';?>> 是 <input type="radio" name="setting[isselectimage]" value="0" <?php if(!$setting['isselectimage']) echo 'checked';?>> 否</td> </tr> <tr> <td>允许同时上传的个数</td> <td><input type="text" name="setting[upload_number]" value="<?php echo $setting['upload_number'];?>" size=3></td> </tr> </table>
{ "pile_set_name": "Github" }
# Volatility # Copyright (C) 2007-2013 Volatility Foundation # # This file is part of Volatility. # # Volatility 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 2 of the License, or # (at your option) any later version. # # Volatility 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 Volatility. If not, see <http://www.gnu.org/licenses/>. # """ @author: Andrew Case @license: GNU General Public License 2.0 @contact: [email protected] @organization: """ import volatility.obj as obj import volatility.plugins.mac.pstasks as pstasks import volatility.plugins.mac.common as common from volatility.renderers import TreeGrid from volatility.renderers.basic import Address class mac_orphan_threads(pstasks.mac_tasks): """Lists threads that don't map back to known modules/processes""" def unified_output(self, data): common.set_plugin_members(self) return TreeGrid([("PID",int), ("Process Name", str), ("Start Address", Address), ("Mapping", str), ("Name", str), ("Status", str), ], self.generator(data)) def generator(self, data): (kstart, kend, kmods) = common.get_kernel_addrs_start_end(self) for proc in data: for thread in proc.threads(): start = thread.continuation if start == 0: continue (good, mapping) = common.is_in_kernel_or_module(start, kstart, kend, kmods) if not good: mapping = "UNKNOWN" for map in proc.get_proc_maps(): if map.links.start <= start <= map.links.end: mapping = map.get_path() if mapping == "": mapping = map.get_special_path() good = 1 start = map.links.start if good: status = "OK" else: status = "UNKNOWN" name = "" if thread.uthread: name_buf = self.addr_space.read(thread.uthread.dereference_as("uthread").pth_name, 256) if name_buf: idx = name_buf.find("\x00") if idx != -1: name_buf = name_buf[:idx] name = name_buf yield(0, [ int(proc.p_pid), str(proc.p_comm), Address(start), str(mapping), str(name), str(status), ]) def render_text(self, outfd, data): common.set_plugin_members(self) self.table_header(outfd, [("PID","8"), ("Name", "16"), ("Start Address", "[addrpad]"), ("Mapping", "40"), ("Name", "40"), ("Status", ""), ]) (kstart, kend, kmods) = common.get_kernel_addrs_start_end(self) for proc in data: for thread in proc.threads(): start = thread.continuation if start == 0: continue (good, mapping) = common.is_in_kernel_or_module(start, kstart, kend, kmods) if not good: mapping = "UNKNOWN" for map in proc.get_proc_maps(): if map.links.start <= start <= map.links.end: mapping = map.get_path() if mapping == "": mapping = map.get_special_path() good = 1 start = map.links.start status = "UNKNOWN" if good: status = "OK" name = "" if thread.uthread: name_buf = self.addr_space.read(thread.uthread.dereference_as("uthread").pth_name, 256) if name_buf: idx = name_buf.find("\x00") if idx != -1: name_buf = name_buf[:idx] name = name_buf self.table_row(outfd, proc.p_pid, proc.p_comm, start, mapping, name, status)
{ "pile_set_name": "Github" }
#!/bin/sh # postrm script for valentina # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * <postrm> `remove' # * <postrm> `purge' # * <old-postrm> `upgrade' <new-version> # * <new-postrm> `failed-upgrade' <old-version> # * <new-postrm> `abort-install' # * <new-postrm> `abort-install' <old-version> # * <new-postrm> `abort-upgrade' <old-version> # * <disappearer's-postrm> `disappear' <overwriter> # <overwriter-version> # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package echo "ldconfig..." >&2 ldconfig if [ -x update-desktop-database ]; then update-desktop-database fi if [ -x update-mime-database ]; then update-mime-database /usr/share/mime fi # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0
{ "pile_set_name": "Github" }
Fix pointer comparaison opt_servers is a pointer, not a boolean, so testing against false to know if the pointer is NULL no longer works with the more strict gcc 7.x checks. [Taken from http://pkgs.fedoraproject.org/cgit/rpms/libmemcached.git/plain/libmemcached-build.patch.] Signed-off-by: Thomas Petazzoni <[email protected]> diff -up ./clients/memflush.cc.old ./clients/memflush.cc --- ./clients/memflush.cc.old 2017-02-12 10:12:59.615209225 +0100 +++ ./clients/memflush.cc 2017-02-12 10:13:39.998382783 +0100 @@ -39,7 +39,7 @@ int main(int argc, char *argv[]) { options_parse(argc, argv); - if (opt_servers == false) + if (!opt_servers) { char *temp; @@ -48,7 +48,7 @@ int main(int argc, char *argv[]) opt_servers= strdup(temp); } - if (opt_servers == false) + if (!opt_servers) { std::cerr << "No Servers provided" << std::endl; exit(EXIT_FAILURE);
{ "pile_set_name": "Github" }
// // ShapesHistoryItem.cs // // Author: // Andrew Davis <[email protected]> // // Copyright (c) 2013 Andrew Davis, GSoC 2013 & 2014 // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using Pinta.Core; using Cairo; namespace Pinta.Tools { public class ShapesHistoryItem : BaseHistoryItem { private BaseEditEngine ee; private UserLayer userLayer; private SurfaceDiff userSurfaceDiff; private ImageSurface userSurface; private ShapeEngineCollection sEngines; private int selectedPointIndex, selectedShapeIndex; private bool redrawEverything; /// <summary> /// A history item for when shapes are finalized. /// </summary> /// <param name="passedEE">The EditEngine being used.</param> /// <param name="icon">The history item's icon.</param> /// <param name="text">The history item's title.</param> /// <param name="passedUserSurface">The stored UserLayer surface.</param> /// <param name="passedUserLayer">The UserLayer being modified.</param> /// <param name="passedSelectedPointIndex">The selected point's index.</param> /// <param name="passedSelectedShapeIndex">The selected point's shape index.</param> /// <param name="passedRedrawEverything">Whether every shape should be redrawn when undoing (e.g. finalization).</param> public ShapesHistoryItem(BaseEditEngine passedEE, string icon, string text, ImageSurface passedUserSurface, UserLayer passedUserLayer, int passedSelectedPointIndex, int passedSelectedShapeIndex, bool passedRedrawEverything) : base(icon, text) { ee = passedEE; userLayer = passedUserLayer; userSurfaceDiff = SurfaceDiff.Create(passedUserSurface, userLayer.Surface, true); if (userSurfaceDiff == null) { userSurface = passedUserSurface; } else { (passedUserSurface as IDisposable).Dispose(); } sEngines = BaseEditEngine.SEngines.PartialClone(); selectedPointIndex = passedSelectedPointIndex; selectedShapeIndex = passedSelectedShapeIndex; redrawEverything = passedRedrawEverything; } public override void Undo() { Swap(redrawEverything); } public override void Redo() { Swap(false); } private void Swap(bool redraw) { // Grab the original surface ImageSurface surf = userLayer.Surface; if (userSurfaceDiff != null) { userSurfaceDiff.ApplyAndSwap(surf); PintaCore.Workspace.Invalidate(userSurfaceDiff.GetBounds()); } else { // Undo to the "old" surface userLayer.Surface = userSurface; // Store the original surface for Redo userSurface = surf; //Redraw everything since surfaces were swapped. PintaCore.Workspace.Invalidate(); } Swap (ref sEngines, ref BaseEditEngine.SEngines); //Ensure that all of the shapes that should no longer be drawn have their ReEditableLayer removed from the drawing loop. foreach (ShapeEngine se in sEngines) { //Determine if it is currently in the drawing loop and should no longer be. Note: a DrawingLayer could be both removed and then //later added in the same swap operation, but this is faster than looping through each ShapeEngine in BaseEditEngine.SEngines. if (se.DrawingLayer.InTheLoop && !BaseEditEngine.SEngines.Contains(se)) { se.DrawingLayer.TryRemoveLayer(); } } //Ensure that all of the shapes that should now be drawn have their ReEditableLayer in the drawing loop. foreach (ShapeEngine se in BaseEditEngine.SEngines) { //Determine if it is currently out of the drawing loop; if not, it should be. if (!se.DrawingLayer.InTheLoop) { se.DrawingLayer.TryAddLayer(); } } Swap (ref selectedPointIndex, ref ee.SelectedPointIndex); Swap (ref selectedShapeIndex, ref ee.SelectedShapeIndex); //Determine if the currently active tool matches the shape's corresponding tool, and if not, switch to it. if (BaseEditEngine.ActivateCorrespondingTool(ee.SelectedShapeIndex, true) != null) { //The currently active tool now matches the shape's corresponding tool. if (redraw) { ((ShapeTool)PintaCore.Tools.CurrentTool).EditEngine.DrawAllShapes(); } } } public override void Dispose() { // Free up native surface if (userSurface != null) (userSurface as IDisposable).Dispose(); } } }
{ "pile_set_name": "Github" }
# Set root logger level to DEBUG and its only appender to A1. log4j.rootLogger=WARN, A1 # A1 is set to be a ConsoleAppender. log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%-5p %c %x - %m%n log4j.logger.io.milton=INFO
{ "pile_set_name": "Github" }
// Code generated by go-swagger; DO NOT EDIT. // Copyright 2017-2020 Authors of Cilium // SPDX-License-Identifier: Apache-2.0 package policy // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the generate command import ( "net/http" "github.com/go-openapi/runtime/middleware" ) // GetFqdnNamesHandlerFunc turns a function with the right signature into a get fqdn names handler type GetFqdnNamesHandlerFunc func(GetFqdnNamesParams) middleware.Responder // Handle executing the request and returning a response func (fn GetFqdnNamesHandlerFunc) Handle(params GetFqdnNamesParams) middleware.Responder { return fn(params) } // GetFqdnNamesHandler interface for that can handle valid get fqdn names params type GetFqdnNamesHandler interface { Handle(GetFqdnNamesParams) middleware.Responder } // NewGetFqdnNames creates a new http.Handler for the get fqdn names operation func NewGetFqdnNames(ctx *middleware.Context, handler GetFqdnNamesHandler) *GetFqdnNames { return &GetFqdnNames{Context: ctx, Handler: handler} } /*GetFqdnNames swagger:route GET /fqdn/names policy getFqdnNames List internal DNS selector representations Retrieves the list of DNS-related fields (names to poll, selectors and their corresponding regexes). */ type GetFqdnNames struct { Context *middleware.Context Handler GetFqdnNamesHandler } func (o *GetFqdnNames) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { r = rCtx } var Params = NewGetFqdnNamesParams() if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params o.Context.Respond(rw, r, route.Produces, route, err) return } res := o.Handler.Handle(Params) // actually handle the request o.Context.Respond(rw, r, route.Produces, route, res) }
{ "pile_set_name": "Github" }
/* * Copyright 2010-2020 Alfresco Software, Ltd. * * 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.activiti.runtime.api.conf.impl; import static java.util.Collections.unmodifiableList; import org.activiti.api.process.runtime.conf.ProcessRuntimeConfiguration; import org.activiti.api.process.runtime.events.listener.ProcessRuntimeEventListener; import org.activiti.api.runtime.shared.events.VariableEventListener; import java.util.List; public class ProcessRuntimeConfigurationImpl implements ProcessRuntimeConfiguration { private List<ProcessRuntimeEventListener<?>> processRuntimeEventListeners; private final List<VariableEventListener<?>> variableEventListeners; public ProcessRuntimeConfigurationImpl(List<ProcessRuntimeEventListener<?>> processRuntimeEventListeners, List<VariableEventListener<?>> variableEventListeners) { this.processRuntimeEventListeners = processRuntimeEventListeners; this.variableEventListeners = variableEventListeners; } @Override public List<ProcessRuntimeEventListener<?>> processEventListeners() { return unmodifiableList(processRuntimeEventListeners); } @Override public List<VariableEventListener<?>> variableEventListeners() { return unmodifiableList(variableEventListeners); } }
{ "pile_set_name": "Github" }
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Oct 15 2018 10:31:50). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard. // #import <ConfigurationEngineModel/CEMCommandBase.h> #import <ConfigurationEngineModel/CEMRegisteredTypeProtocol-Protocol.h> @class NSString; @interface CEMClassroomStopMirroringCommand : CEMCommandBase <CEMRegisteredTypeProtocol> { } + (id)buildRequiredOnlyWithIdentifier:(id)arg1; + (id)buildWithIdentifier:(id)arg1; + (id)allowedPayloadKeys; + (id)registeredIdentifier; + (id)registeredClassName; - (id)copyWithZone:(struct _NSZone *)arg1; - (id)serializePayloadWithAssetProviders:(id)arg1; - (BOOL)loadPayload:(id)arg1 error:(id *)arg2; - (int)executionLevel; - (BOOL)mustBeSupervised; // Remaining properties @property(readonly, copy) NSString *debugDescription; @property(readonly, copy) NSString *description; @property(readonly) unsigned long long hash; @property(readonly) Class superclass; @end
{ "pile_set_name": "Github" }
/* * * Copyright 2015, 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. * */ // Package main implements a simple gRPC client that demonstrates how to use gRPC-Go libraries // to perform unary, client streaming, server streaming and full duplex RPCs. // // It interacts with the route guide service whose definition can be found in proto/route_guide.proto. package main import ( "flag" "io" "math/rand" "time" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/credentials" pb "google.golang.org/grpc/examples/route_guide/proto" "google.golang.org/grpc/grpclog" ) var ( tls = flag.Bool("tls", false, "Connection uses TLS if true, else plain TCP") caFile = flag.String("ca_file", "testdata/ca.pem", "The file containning the CA root cert file") serverAddr = flag.String("server_addr", "127.0.0.1:10000", "The server address in the format of host:port") serverHostOverride = flag.String("server_host_override", "x.test.youtube.com", "The server name use to verify the hostname returned by TLS handshake") ) // printFeature gets the feature for the given point. func printFeature(client pb.RouteGuideClient, point *pb.Point) { grpclog.Printf("Getting feature for point (%d, %d)", point.Latitude, point.Longitude) feature, err := client.GetFeature(context.Background(), point) if err != nil { grpclog.Fatalf("%v.GetFeatures(_) = _, %v: ", client, err) } grpclog.Println(feature) } // printFeatures lists all the features within the given bounding Rectangle. func printFeatures(client pb.RouteGuideClient, rect *pb.Rectangle) { grpclog.Printf("Looking for features within %v", rect) stream, err := client.ListFeatures(context.Background(), rect) if err != nil { grpclog.Fatalf("%v.ListFeatures(_) = _, %v", client, err) } for { feature, err := stream.Recv() if err == io.EOF { break } if err != nil { grpclog.Fatalf("%v.ListFeatures(_) = _, %v", client, err) } grpclog.Println(feature) } } // runRecordRoute sends a sequence of points to server and expects to get a RouteSummary from server. func runRecordRoute(client pb.RouteGuideClient) { // Create a random number of random points r := rand.New(rand.NewSource(time.Now().UnixNano())) pointCount := int(r.Int31n(100)) + 2 // Traverse at least two points var points []*pb.Point for i := 0; i < pointCount; i++ { points = append(points, randomPoint(r)) } grpclog.Printf("Traversing %d points.", len(points)) stream, err := client.RecordRoute(context.Background()) if err != nil { grpclog.Fatalf("%v.RecordRoute(_) = _, %v", client, err) } for _, point := range points { if err := stream.Send(point); err != nil { grpclog.Fatalf("%v.Send(%v) = %v", stream, point, err) } } reply, err := stream.CloseAndRecv() if err != nil { grpclog.Fatalf("%v.CloseAndRecv() got error %v, want %v", stream, err, nil) } grpclog.Printf("Route summary: %v", reply) } // runRouteChat receives a sequence of route notes, while sending notes for various locations. func runRouteChat(client pb.RouteGuideClient) { notes := []*pb.RouteNote{ {&pb.Point{0, 1}, "First message"}, {&pb.Point{0, 2}, "Second message"}, {&pb.Point{0, 3}, "Third message"}, {&pb.Point{0, 1}, "Fourth message"}, {&pb.Point{0, 2}, "Fifth message"}, {&pb.Point{0, 3}, "Sixth message"}, } stream, err := client.RouteChat(context.Background()) if err != nil { grpclog.Fatalf("%v.RouteChat(_) = _, %v", client, err) } waitc := make(chan struct{}) go func() { for { in, err := stream.Recv() if err == io.EOF { // read done. close(waitc) return } if err != nil { grpclog.Fatalf("Failed to receive a note : %v", err) } grpclog.Printf("Got message %s at point(%d, %d)", in.Message, in.Location.Latitude, in.Location.Longitude) } }() for _, note := range notes { if err := stream.Send(note); err != nil { grpclog.Fatalf("Failed to send a note: %v", err) } } stream.CloseSend() <-waitc } func randomPoint(r *rand.Rand) *pb.Point { lat := (r.Int31n(180) - 90) * 1e7 long := (r.Int31n(360) - 180) * 1e7 return &pb.Point{lat, long} } func main() { flag.Parse() var opts []grpc.DialOption if *tls { var sn string if *serverHostOverride != "" { sn = *serverHostOverride } var creds credentials.TransportAuthenticator if *caFile != "" { var err error creds, err = credentials.NewClientTLSFromFile(*caFile, sn) if err != nil { grpclog.Fatalf("Failed to create TLS credentials %v", err) } } else { creds = credentials.NewClientTLSFromCert(nil, sn) } opts = append(opts, grpc.WithTransportCredentials(creds)) } conn, err := grpc.Dial(*serverAddr, opts...) if err != nil { grpclog.Fatalf("fail to dial: %v", err) } defer conn.Close() client := pb.NewRouteGuideClient(conn) // Looking for a valid feature printFeature(client, &pb.Point{409146138, -746188906}) // Feature missing. printFeature(client, &pb.Point{0, 0}) // Looking for features between 40, -75 and 42, -73. printFeatures(client, &pb.Rectangle{&pb.Point{400000000, -750000000}, &pb.Point{420000000, -730000000}}) // RecordRoute runRecordRoute(client) // RouteChat runRouteChat(client) }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2012-2016 The CyanogenMod Project Copyright (C) 2017-2019 The LineageOS 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. --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="show_dev_on_cm">تۆ ڕێکخستنی گەشەپێدەریت چالاککرد!</string> <string name="show_dev_already_cm">پێویست ناکا، تۆ پێشتر چالاکت کردوە.</string> <string name="adb_enable">ڕاستكردنه‌وه‌ی ئەندرۆید</string> <string name="adb_notify">تێبینی هەڵدۆزین</string> <string name="adb_notify_summary">پیشاندانی تێبینی کاتێک USB یان تۆڕی هەڵدۆزین چالاکرا</string> <string name="adb_over_network">تۆڕی ئه‌نته‌رنێتی ADB</string> <string name="adb_over_network_summary">چلاکردنی TCP/IP خه‌واندنی (Wi-Fi, USB تۆڕ). ئه‌م ڕێکخستنه‌ له‌سه‌ر کردنه‌وه‌ کاریه‌تی</string> <string name="lineagelicense_title">یاسای وەشانەکە</string> <string name="kill_app_longpress_back">کوشتنی بەرنامە لە دوگمەی دواوە</string> <string name="kill_app_longpress_back_summary">کوشتنی پێشبنەما بەرنامە لەلایەن دەستنانی زۆر بە دوگمەی دواوە</string> <string name="device_hostname">ناوی میوانی ئامێر</string> <string name="increasing_ring_volume_option_title">زیادکردنی دەنگی زەنگ</string> <string name="increasing_ring_min_volume_title">دەستپێکردنی دەنگ</string> <string name="increasing_ring_ramp_up_time_title">هەڵسانی کات</string> <string name="lockpattern_settings_enable_error_path_title">پیشاندانی هەڵەی چنراو</string> <string name="lockpattern_settings_enable_dots_title">پیشاندانی خاڵەکانی چنراو</string> <string name="unlock_scramble_pin_layout_title">ته‌خته‌ی تێکه‌ڵ</string> <string name="unlock_scramble_pin_layout_summary">ته‌خته‌ی PIN تێکه‌ڵ له‌کاتی کردنه‌وه‌ی ئامێره‌که‌</string> <string name="proximity_wake_title">قه‌ده‌غه‌کردنی هه‌ستانی ڕێکه‌وت</string> <string name="wake_when_plugged_or_unplugged_title">هەڵسان لە پلاگ</string> <string name="wake_when_plugged_or_unplugged_summary">کردنەوەی ڕۆشای ڕوونماکە لە کاتی پەیوەندکردن یان پچڕانی لەکارەبا</string> <string name="high_touch_sensitivity_title">هەستیاری ساوانی بەرز</string> <string name="high_touch_sensitivity_summary">هەستیاری ساوڕوونما برز بکەوە، ئەوە ئەتوانرێ بەکاربهێنرێت کاتێک دەستەوانت لە دەستدایە</string> <string name="touchscreen_hovering_title">دەستلێدانی شاشە سوڕانەوە</string> <string name="touchscreen_hovering_summary">هەمیشە شاشەکە بسوڕێنەوە وەکو مشک لە وێبگەری ماڵپەر، ڕومێزی دور،هتد</string> <string name="update_recovery_on_warning">تێبینی: کاتێک ئەم خزمەتە چاڵاک کرا ریکەڤەریەکەی تۆ جێگەی دەگیرێت بە ئەو وەشانەی ئێستای سیستەمەکەت \n\n ریکەڤەریەکەت نوێ دەکرێتەوە لەگەڵ بەرزکردنەوەی سیستەمەکەت بۆ یارمەتیدان لە گونجاندنی وەشانەکە \n\n ئایە ئەتەوێت ئەم خزمەتە چاڵاک بکەیت؟?</string> <string name="update_recovery_off_warning">ئاگاداری : کاتێک ئەم خزمەتە ناچاڵاک دەکەیت ریکەڤەریەکەت نوێ ناکرێتەوە لەگەڵ بەرزکردنەوی سیستەمەکەت .\n\n خزمەتی نوێ لەوانەیە دانەمەزرێ لەگەڵ بەرزکردنەوەی وەشانەکە \n\n. دڵنیای لە ناچاڵاک کردنی ئەم خزمەتە؟?</string> </resources>
{ "pile_set_name": "Github" }
-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQAHJcD92We7VHMbQyA0h6Ke cVNoff4KYOsfTEKC2yNDhorenihdDkPyl1MHKXn+d0J/TcGbpfkFmlcyCRIY4pCZ pJ3wzrunAdbumtzsSr2WwASUaMNpj00X5e5kDwQwDfdAlv0ZkaBJNWpskzbN42Fg RSkraxAA0CJFJweRni8H2lW/ET9S/7g8DAe4cmiozG5fpYpimHMVW8kGYoX8aYco lTTOkW1VDp5kS+hIcMoCsDegVyJ9weYYazV/ldAVi+86ujmb2Bb+nLvWakh4DrF/ D9gsaSrS7Ljk9c1SVL0QzXe2g0E9RpR0XzKN1hFg5F2LU8bJgSQO4yp4IKoDZJxB AgQKsc4T -----END PUBLIC KEY-----
{ "pile_set_name": "Github" }
/** * @file lv_theme_templ.c * */ /********************* * INCLUDES *********************/ #include "lv_theme.h" #if USE_LV_THEME_MONO /********************* * DEFINES *********************/ /********************** * TYPEDEFS **********************/ /********************** * STATIC PROTOTYPES **********************/ /********************** * STATIC VARIABLES **********************/ static lv_theme_t theme; static lv_style_t def; /*Static style definitions*/ static lv_style_t light_plain; static lv_style_t dark_plain; static lv_style_t light_frame; static lv_style_t dark_frame; /*Saved input parameters*/ static uint16_t _hue; static lv_font_t * _font; /********************** * MACROS **********************/ /********************** * STATIC FUNCTIONS **********************/ static void basic_init(void) { lv_style_copy(&def, &lv_style_plain); /*Initialize the default style*/ def.body.main_color = LV_COLOR_WHITE; def.body.grad_color = LV_COLOR_WHITE; def.body.radius = 0; def.body.opa = LV_OPA_COVER; def.body.padding.hor = LV_DPI / 10; def.body.padding.ver = LV_DPI / 10; def.body.padding.inner = LV_DPI / 10; def.body.border.color = LV_COLOR_BLACK; def.body.border.width = 1; def.body.border.opa = LV_OPA_COVER; def.body.border.part = LV_BORDER_FULL; def.text.font = _font; def.text.color = LV_COLOR_BLACK; def.text.letter_space = 1; def.text.line_space = 1; def.line.color = LV_COLOR_BLACK; def.line.opa = LV_OPA_COVER; def.line.width = 1; def.image.color = LV_COLOR_BLACK; def.image.intense = LV_OPA_TRANSP; def.image.opa = LV_OPA_COVER; lv_style_copy(&light_plain, &def); lv_style_copy(&light_frame, &light_plain); light_frame.body.radius = LV_DPI / 20; lv_style_copy(&dark_plain, &light_plain); dark_plain.body.main_color = LV_COLOR_BLACK; dark_plain.body.grad_color = LV_COLOR_BLACK; dark_plain.body.border.color = LV_COLOR_WHITE; dark_plain.text.color = LV_COLOR_WHITE; dark_plain.line.color = LV_COLOR_WHITE; dark_plain.image.color = LV_COLOR_WHITE; lv_style_copy(&dark_frame, &dark_plain); dark_frame.body.radius = LV_DPI / 20; theme.bg = &def; theme.panel = &light_frame; } static void cont_init(void) { #if USE_LV_CONT != 0 theme.cont = &def; #endif } static void btn_init(void) { #if USE_LV_BTN != 0 theme.btn.rel = &light_frame; theme.btn.pr = &dark_frame; theme.btn.tgl_rel = &dark_frame; theme.btn.tgl_pr = &light_frame; theme.btn.ina = &light_frame; #endif } static void label_init(void) { #if USE_LV_LABEL != 0 theme.label.prim = NULL; theme.label.sec = NULL; theme.label.hint = NULL; #endif } static void img_init(void) { #if USE_LV_IMG != 0 theme.img.light = &def; theme.img.dark = &def; #endif } static void line_init(void) { #if USE_LV_LINE != 0 theme.line.decor = NULL; #endif } static void led_init(void) { #if USE_LV_LED != 0 static lv_style_t led; lv_style_copy(&led, &light_frame); led.body.radius = LV_RADIUS_CIRCLE; led.body.shadow.width = LV_DPI / 8; led.body.shadow.color = LV_COLOR_BLACK; led.body.shadow.type = LV_SHADOW_FULL; theme.led = &led; #endif } static void bar_init(void) { #if USE_LV_BAR static lv_style_t bar_bg; static lv_style_t bar_indic; lv_style_copy(&bar_bg, &light_frame); bar_bg.body.padding.hor = LV_DPI / 15; bar_bg.body.padding.ver = LV_DPI / 15; bar_bg.body.radius = LV_RADIUS_CIRCLE; lv_style_copy(&bar_indic, &dark_frame); bar_indic.body.padding.hor = LV_DPI / 30; bar_indic.body.padding.ver = LV_DPI / 30; bar_indic.body.radius = LV_RADIUS_CIRCLE; theme.bar.bg = &bar_bg; theme.bar.indic = &bar_indic; #endif } static void slider_init(void) { #if USE_LV_SLIDER != 0 static lv_style_t slider_knob; lv_style_copy(&slider_knob, &light_frame); slider_knob.body.radius = LV_RADIUS_CIRCLE; slider_knob.body.padding.hor = LV_DPI / 30; slider_knob.body.padding.ver = LV_DPI / 30; theme.slider.bg = theme.bar.bg; theme.slider.indic = theme.bar.indic; theme.slider.knob = &slider_knob; #endif } static void sw_init(void) { #if USE_LV_SW != 0 theme.sw.bg = theme.slider.bg; theme.sw.indic = theme.slider.indic; theme.sw.knob_off = theme.slider.knob; theme.sw.knob_on = theme.slider.knob; #endif } static void lmeter_init(void) { #if USE_LV_LMETER != 0 static lv_style_t lmeter_bg; lv_style_copy(&lmeter_bg, &light_frame); lmeter_bg.body.empty = 1; lmeter_bg.body.main_color = LV_COLOR_BLACK; lmeter_bg.body.grad_color = LV_COLOR_BLACK; lmeter_bg.body.padding.hor = LV_DPI / 20; lmeter_bg.body.padding.inner = LV_DPI / 8; lmeter_bg.line.color = LV_COLOR_WHITE; lmeter_bg.line.width = 1; theme.lmeter = &lmeter_bg; #endif } static void gauge_init(void) { #if USE_LV_GAUGE != 0 static lv_style_t gauge_bg; lv_style_copy(&gauge_bg, theme.lmeter); gauge_bg.line.color = LV_COLOR_BLACK; gauge_bg.line.width = 1; theme.gauge = &gauge_bg; #endif } static void chart_init(void) { #if USE_LV_CHART theme.chart = &light_frame; #endif } static void calendar_init(void) { #if USE_LV_CALENDAR static lv_style_t box; lv_style_copy(&box, &light_plain); box.body.padding.ver = LV_DPI / 20; /*Can't handle highlighted dates in this theme*/ theme.calendar.week_box = &box; theme.calendar.today_box = &box; #endif } static void cb_init(void) { #if USE_LV_CB != 0 theme.cb.bg = &lv_style_transp; theme.cb.box.rel = &light_frame; theme.cb.box.pr = &dark_frame; theme.cb.box.tgl_rel = &dark_frame; theme.cb.box.tgl_pr = &light_frame; theme.cb.box.ina = &light_frame; #endif } static void btnm_init(void) { #if USE_LV_BTNM theme.btnm.bg = &light_frame; theme.btnm.btn.rel = &light_frame; theme.btnm.btn.pr = &dark_frame; theme.btnm.btn.tgl_rel = &dark_frame; theme.btnm.btn.tgl_pr = &light_frame; theme.btnm.btn.ina = &light_frame; #endif } static void kb_init(void) { #if USE_LV_KB theme.kb.bg = &lv_style_transp_fit; theme.kb.btn.rel = &light_frame; theme.kb.btn.pr = &light_frame; theme.kb.btn.tgl_rel = &dark_frame; theme.kb.btn.tgl_pr = &dark_frame; theme.kb.btn.ina = &light_frame; #endif } static void mbox_init(void) { #if USE_LV_MBOX theme.mbox.bg = &dark_frame; theme.mbox.btn.bg = &lv_style_transp_fit; theme.mbox.btn.rel = &light_frame; theme.mbox.btn.pr = &dark_frame; #endif } static void page_init(void) { #if USE_LV_PAGE theme.page.bg = &light_frame; theme.page.scrl = &light_frame; theme.page.sb = &dark_frame; #endif } static void ta_init(void) { #if USE_LV_TA theme.ta.area = &light_frame; theme.ta.oneline = &light_frame; theme.ta.cursor = NULL; /*Let library to calculate the cursor's style*/ theme.ta.sb = &dark_frame; #endif } static void list_init(void) { #if USE_LV_LIST != 0 theme.list.sb = &dark_frame; theme.list.bg = &light_frame; theme.list.scrl = &lv_style_transp_fit; theme.list.btn.rel = &light_plain; theme.list.btn.pr = &dark_plain; theme.list.btn.tgl_rel = &dark_plain; theme.list.btn.tgl_pr = &light_plain; theme.list.btn.ina = &light_plain; #endif } static void ddlist_init(void) { #if USE_LV_DDLIST != 0 static lv_style_t bg; lv_style_copy(&bg, &light_frame); bg.text.line_space = LV_DPI / 12; theme.ddlist.bg = &bg; theme.ddlist.sel = &dark_plain; theme.ddlist.sb = &dark_frame; #endif } static void roller_init(void) { #if USE_LV_ROLLER != 0 static lv_style_t bg; lv_style_copy(&bg, &light_frame); bg.text.line_space = LV_DPI / 12; theme.roller.bg = &bg; theme.roller.sel = &dark_frame; #endif } static void tabview_init(void) { #if USE_LV_TABVIEW != 0 theme.tabview.bg = &light_frame; theme.tabview.indic = &light_plain; theme.tabview.btn.bg = &lv_style_transp_fit; theme.tabview.btn.rel = &light_frame; theme.tabview.btn.pr = &dark_frame; theme.tabview.btn.tgl_rel = &dark_frame; theme.tabview.btn.tgl_pr = &light_frame; #endif } static void win_init(void) { #if USE_LV_WIN != 0 static lv_style_t win_header; lv_style_copy(&win_header, &dark_plain); win_header.body.padding.hor = LV_DPI / 30; win_header.body.padding.ver = LV_DPI / 30; theme.win.bg = &light_frame; theme.win.sb = &dark_frame; theme.win.header = &win_header; theme.win.content.bg = &lv_style_transp; theme.win.content.scrl = &lv_style_transp; theme.win.btn.rel = &light_frame; theme.win.btn.pr = &dark_frame; #endif } /********************** * GLOBAL FUNCTIONS **********************/ /** * Initialize the mono theme * @param hue [0..360] hue value from HSV color space to define the theme's base color * @param font pointer to a font (NULL to use the default) * @return pointer to the initialized theme */ lv_theme_t * lv_theme_mono_init(uint16_t hue, lv_font_t * font) { if(font == NULL) font = LV_FONT_DEFAULT; _hue = hue; _font = font; /*For backward compatibility initialize all theme elements with a default style */ uint16_t i; lv_style_t ** style_p = (lv_style_t **) &theme; for(i = 0; i < sizeof(lv_theme_t) / sizeof(lv_style_t *); i++) { *style_p = &def; style_p++; } basic_init(); cont_init(); btn_init(); label_init(); img_init(); line_init(); led_init(); bar_init(); slider_init(); sw_init(); lmeter_init(); gauge_init(); chart_init(); calendar_init(); cb_init(); btnm_init(); kb_init(); mbox_init(); page_init(); ta_init(); list_init(); ddlist_init(); roller_init(); tabview_init(); win_init(); return &theme; } /** * Get a pointer to the theme * @return pointer to the theme */ lv_theme_t * lv_theme_get_mono(void) { return &theme; } /********************** * STATIC FUNCTIONS **********************/ #endif
{ "pile_set_name": "Github" }
/* * Zed Attack Proxy (ZAP) and its related class files. * * ZAP is an HTTP/HTTPS proxy for assessing web application security. * * 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.zaproxy.zap.extension.codedx; import java.util.List; import org.apache.log4j.Logger; import org.parosproxy.paros.Constant; import org.parosproxy.paros.core.scanner.Alert; import org.parosproxy.paros.extension.report.ReportGenerator; import org.parosproxy.paros.model.SiteNode; import org.parosproxy.paros.network.HttpMessage; public class ExtensionAlertHttp { private static final Logger LOGGER = Logger.getLogger(ExtensionAlertHttp.class); public ExtensionAlertHttp() { } public String getXml(SiteNode site) { StringBuilder xml = new StringBuilder(); xml.append("<alerts>"); List<Alert> alerts = site.getAlerts(); for (Alert alert : alerts) { if (alert.getConfidence() != Alert.CONFIDENCE_FALSE_POSITIVE) { String urlParamXML = getUrlParamXML(alert); xml.append(alert.toPluginXML(urlParamXML)); } } xml.append("</alerts>"); return xml.toString(); } private String getHTML(Alert alert) { // gets HttpMessage request and response data from each alert and removes illegal and special characters StringBuilder httpMessage = new StringBuilder(); HttpMessage message = alert.getMessage(); if (message == null) { LOGGER.warn(Constant.messages.getString("codedx.error.httpMessage", alert.getAlertId())); return httpMessage.toString(); } String requestHeader = message.getRequestHeader().toString(); String requestBody = message.getRequestBody().toString(); String responseHeader = message.getResponseHeader().toString(); String responseBody = message.getResponseBody().toString(); httpMessage.append("<requestdata>"); httpMessage.append(ReportGenerator.entityEncode(requestHeader)); httpMessage.append(ReportGenerator.entityEncode(requestBody)); httpMessage.append("\n</requestdata>\n"); httpMessage.append("<responsedata>"); httpMessage.append(ReportGenerator.entityEncode(responseHeader)); httpMessage.append(ReportGenerator.entityEncode(responseBody)); httpMessage.append("\n</responsedata>\n"); return httpMessage.toString(); } public String getUrlParamXML(Alert alert) { String uri = alert.getUri(); String param = alert.getParam(); String attack = alert.getAttack(); String otherInfo = alert.getOtherInfo(); String evidence = alert.getEvidence(); StringBuilder sb = new StringBuilder(200); // ZAP: Changed the type to StringBuilder. sb.append(getHTML(alert)); sb.append(" <uri>").append(ReportGenerator.entityEncode(uri)).append("</uri>\r\n"); sb.append(" <param>").append(ReportGenerator.entityEncode(param)).append("</param>\r\n"); sb.append(" <attack>").append(ReportGenerator.entityEncode(attack)).append("</attack>\r\n"); if (evidence != null && evidence.length() > 0) { sb.append(" <evidence>").append(ReportGenerator.entityEncode(evidence)).append("</evidence>\r\n"); } sb.append(" <otherinfo>").append(ReportGenerator.entityEncode(otherInfo)).append("</otherinfo>\r\n"); return sb.toString(); } }
{ "pile_set_name": "Github" }
# Changelog ## [Unreleased] ## 18.2.56 (2020-09-01) ### Spreadsheet #### Bug Fixes `#I290997`- Undo redo not working for delete key action is fixed. ## 18.2.55 (2020-08-25) ### Spreadsheet #### Bug Fixes `#I289560` - Filter is not applied properly in a specified range while using applyFilter method issue fixed. `#I284268` - Excel file contains conditional format does not opening issue fixed. ## 18.2.54 (2020-08-18) ### Spreadsheet #### Bug Fixes `#I285113`, `#I285621`, `#I286053`, `#I286103`, `#I288652`- Spreadsheet is not working in ES2015 issue is fixed. `#I287385` - Added missed text in the localization file. ## 18.2.48 (2020-08-04) ### Spreadsheet #### Bug Fixes `#I282749`- Cell alignment issue while applying data validation has been fixed. ## 18.2.46 (2020-07-21) ### Spreadsheet #### Bug Fixes `#I282937`- Edit element is not showing the boolean value 'false' issue is fixed. ## 18.2.45 (2020-07-14) ### Spreadsheet #### Bug Fixes `#I276272`- Spinner not showed until remote data being loaded issue is fixed. #### New Features `#I282699`- Provided option to prevent protected sheet dialog box in spreadsheet. ## 18.2.44 (2020-07-07) ### Spreadsheet #### New Features - **Conditional formatting:** Provides option to format a cell or range of cells based on the conditions applied. - **Clear:** Provides option to clear the content, formats, and hyperlinks applied to a cell or range of cells in a spreadsheet. - **Aggregates:** Provides option to check the sum, average, and count for the selected cells or range in the sheet tab. ## 18.1.56 (2020-06-09) ### Spreadsheet #### Bug Fixes `#I279666`- Provided the actionBegin and actionComplete event for page switching action. `#I276608`- Provided the validation to prevent the long text exception for list data validation. ### Spreadsheet #### Breaking Changes - API name changes. Old Property | New Property -----|----- `rangeSettings` | `ranges` ## 18.1.42 (2020-04-01) ### Spreadsheet #### Bug Fixes `#I256901` - Used range not setting properly while using cell data binding issue is fixed. `#I264109` - Error alert doesn't shows when named range given with space issue is fixed. `#I266607` - Header created multiple time while adding the sheet model dynamically is fixed. #### New Features - **Merge cells:** Provides option to can combine two or more cells located in the same row or column into a single cell. #### Breaking Changes - API name changes. Old Property | New Property -----|----- `activeSheetTab` | `activeSheetIndex` ## 18.1.36-beta (2020-03-19) ### Spreadsheet #### New Features - **Wrap text:** Provides the option to display the large content as multiple lines in a single cell. - **Data validation:** Provides the option to validate edited values based on data validation rules defined for a cell or range of cells. - **Find and Replace:** Provides the option to find the data and replace it across all the sheets in Spreadsheet. - **Protect sheet:** Provides the option to restrict the user actions like cell editing, row and column insertion, deletion, and resizing. - **Borders:** Provides the option to customize cell gridlines such as color and its style for enhanced UI. - **Show/Hide:** Provides the option to show/hide the rows, columns and sheets. - **Insert/delete:** Provides the option to insert/delete the rows, columns and sheets. ## 17.4.51 (2020-02-25) ### Spreadsheet #### New Features `#I258049`- Provided LN formula support in Spreadsheet. ## 17.4.50 (2020-02-18) ### Spreadsheet #### Bug Fixes - File menu item select event not triggered issue fixed. ## 17.4.49 (2020-02-11) ### Spreadsheet #### Bug Fixes - Integrated the separate styles for filtering. ## 17.4.47 (2020-02-05) ### Spreadsheet #### Bug Fixes `#I256901` - Hyperlink is not working with URL scheme 'https' issue has been fixed. `#I256901` - Export not working when adding hyperlink through method issue has been fixed. ## 17.4.46 (2020-01-30) ### Spreadsheet #### New Features - `#I256901` - Provided the supports to show/hide ribbon tabs, add new ribbon tabs and enable/disable file menu items. - `#I257035` - Provided option to add custom items in Spreadsheet ribbon toolbar - `#I261768` - Provided custom function support. - `#I259360` - Provided sheet visibility support to hide/show the sheets in Spreadsheet. - Provided `AutoFit` method for auto resize the rows/columns in Spreadsheet. - `#I251695`, `#I256191`, `#I261629` - Provided Save as JSON and Load from JSON support. - `#I251210`, `#I256211` - Provided cell template support which is used for adding custom components in to Spreadsheet. - `#I258878`, `#I260952`, `#I258876`, `#I258049` - Provided `SLOPE` and `INTERCEPT` Formula support. #### Bug Fixes - `#I256901` - Script error while loading the Spreadsheet control with empty data source issue fixed. - `#I256901` - Support Handled for providing the hyperlink through data source. - `#I260738` - Fixed the style compatibility issue. ## 17.4.41 (2020-01-07) ### Spreadsheet #### Bug Fixes `#F149335` - Excel export issue has been fixed. ## 17.4.39 (2019-12-17) ### Spreadsheet #### New Features - **Filtering:** Helps you to view specific rows in the spreadsheet by hiding the other rows. - **Undo Redo:** Provides the option to perform undo redo operations in spreadsheet. - **Collaborative Editing:** Provides the option for real time changes across multiple users in the Spreadsheet. - **Hyperlink:** Provides the option to navigate the web links or cell reference within the sheet or to other sheets in spreadsheet. ## 17.3.16 (2019-10-09) ### Spreadsheet #### New Features - Provided `updateCell` method to update a cell properties ## 17.3.14 (2019-10-03) ### Spreadsheet #### New Features - **Sorting:** Helps you to arrange the data to particular order in a selected range of cells. - **Resize:** Allows you to change the row height and column width. Auto fit the rows and columns based on its content. ## 17.3.9-beta (2019-09-20) ### Spreadsheet The Spreadsheet is an user interactive component to organize and analyze data in tabular format with configuration options for customization. - **Data sources:** Binds the spreadsheet component with an array of JavaScript objects or DataManager. - **Virtualization:** Provides option to load large amount of data without performance degradation. - **Selection:** Provides option to select a cell or range of cells. - **Editing:** Provides options to dynamically edit a cell. - **Formulas:** Provides built-in calculation library with predefined formulas and named range support. - **Clipboard:** Provides option to perform the clipboard operations. - **Cell formatting:** Provides option to customize the appearance of cells. - **Number formatting:** Provides option to format the cell value. - **Open:** Provides option to open an Excel file in spreadsheet. - **Save:** Provides option to save spreadsheet data as excel file. - **RTL:** Provides right-to-left mode which aligns content in the spreadsheet component from right to left. - **Localization:** Provides inherent support to localize the UI. - **Accessibility:** Provides with built-in accessibility support which helps to access all the spreadsheet component features using the keyboard, screen readers, or other assistive technology devices.
{ "pile_set_name": "Github" }
var fs=require('fs') var _=require('lodash') var files=fs.readdirSync(`${__dirname}`) .filter(x=>!x.match(/README.md|Makefile|index|test|.DS_Store/)) .map(x=>require(`./${x}`)) module.exports={ "Resources":_.assign.apply({},files), "Conditions": {}, "AWSTemplateFormatVersion": "2010-09-09", "Description": `QnABot with admin and client websites - (Master v${process.env.npm_package_version})`, "Mappings": {}, "Outputs": { "CognitoEndpoint":{ "Value":{"Fn::GetAtt":["DesignerLogin","Domain"]} }, "UserRole":{ "Value":{"Ref":"UserRole"} }, "ImportBucket":{ "Value":{"Ref":"ImportBucket"} }, "BotConsoleUrl":{ "Value":{"Fn::Join":["",[ "https://console.aws.amazon.com/lex/home?", "region=",{"Ref":"AWS::Region"}, "#bot-editor:bot=",{"Ref":"LexBot"} ]]} }, "BotName":{ "Value":{"Ref":"LexBot"} }, "BotAlias":{ "Value":{"Ref":"VersionAlias"} }, "SlotType":{ "Value":{"Ref":"SlotType"} }, "Intent":{ "Value":{"Ref":"Intent"} }, "IntentFallback":{ "Value":{"Ref":"IntentFallback"} }, "DashboardURL":{ "Value":{"Fn::Join":["",[ "https://console.aws.amazon.com/cloudwatch/home?", "region=",{"Ref":"AWS::Region"}, "#dashboards:name=",{"Ref":"dashboard"} ]]} }, "UserPoolURL":{ "Value":{"Fn::Join":["",[ "https://console.aws.amazon.com/cognito/users/", "?region=",{"Ref":"AWS::Region"}, "#/pool/",{"Ref":"UserPool"},"/details" ]]} }, "Bucket":{ "Value":{"Ref":"Bucket"} }, "IdPool":{ "Value":{"Ref":"IdPool"} }, "ApiEndpoint":{ "Value":{"Fn::GetAtt":["ApiUrl","Name"]} }, "ESProxyLambda":{ "Value":{"Fn::GetAtt":["ESProxyLambda","Arn"]} }, "CFNESProxyLambda":{ "Value":{ "Fn::GetAtt" : ["ESCFNProxyLambda", "Arn"]} }, "ContentDesignerURL": { "Value":{"Fn::Join":["",[ {"Fn::GetAtt":["ApiUrl","Name"]}, "/pages/designer" ]]} }, "ClientURL": { "Value":{"Fn::If":["Public", {"Fn::GetAtt":["Urls","Client"]}, {"Fn::Join":["",[ {"Fn::GetAtt":["ApiUrl","Name"]}, "/pages/client" ]]} ]} }, "ApiId":{ "Value": {"Ref":"API"} }, "UserPool":{ "Value":{"Ref":"UserPool"} }, "DesignerClientId":{ "Value":{"Ref":"ClientDesigner"} }, "ClientClientId":{ "Value":{"Ref":"ClientClient"} }, "ElasticsearchEndpoint":{ "Value":{"Fn::GetAtt":["ESVar","ESAddress"]} }, "ElasticsearchQnAType":{ "Value":{"Fn::GetAtt":["Var","QnAType"]} }, "ElasticsearchQuizType":{ "Value":{"Fn::GetAtt":["Var","QuizType"]} }, "ElasticsearchIndex":{ "Value":{"Fn::GetAtt":["Var","index"]} }, "UsersTable":{ "Value":{"Ref":"UsersTable"} }, "DefaultSettingsSSMParameterName":{ "Value":{"Ref":"DefaultQnABotSettings"} }, "CustomSettingsSSMParameterName":{ "Value":{"Ref":"CustomQnABotSettings"} }, "DefaultUserPoolJwksUrlParameterName": { "Value":{"Ref":"DefaultUserPoolJwksUrl"} } }, "Parameters": { "ElasticsearchName":{ "Type":"String", "Default":"EMPTY" }, "AdminUserSignUp":{ "Type":"String", "AllowedPattern":"(FALSE|TRUE)", "ConstraintDescription":"Allowed Values are FALSE or TRUE", "Default":"TRUE" }, "Encryption":{ "Type":"String", "Description":"Choose whether resources (S3 and ElasticSearch) are encrypted at rest. Selecting encrypted configuration will provision c5.large.elasticsearch instances - see https://aws.amazon.com/elasticsearch-service/pricing/.", "AllowedValues": ["ENCRYPTED", "UNENCRYPTED"], "Default":"UNENCRYPTED", "ConstraintDescription":"Allowed Values are UNENCRYPTED or ENCRYPTED" }, "ApprovedDomain":{ "Type":"String", "Description":"(optional) If QnABot is private, restrict user sign up to users whos email domain matches this domain. eg. amazon.com", "Default":"NONE" }, "Email":{ "Type":"String", "Description":"Email address for the admin user. Will be used for loging in and for setting the admin password. This email will receive the temporary password for the admin user.", "AllowedPattern":".+\\@.+\\..+", "ConstraintDescription":"Must be valid email address eg. [email protected]" }, "Username":{ "Type":"String", "Description":"Administrator username", "Default":"Admin" }, "BootstrapBucket":{ "Type":"String" }, "BootstrapPrefix":{ "Type":"String" }, "BuildExamples":{ "Type":"String", "Default":"TRUE" }, "PublicOrPrivate":{ "Type":"String", "Description":"Choose whether access to the QnABot client should be publicly available or restricted to users in QnABot UserPool.", "AllowedValues" : ["PUBLIC", "PRIVATE"], "Default":"PUBLIC" }, }, "Conditions":{ "Public":{"Fn::Equals":[{"Ref":"PublicOrPrivate"},"PUBLIC"]}, "Encrypted":{"Fn::Equals":[{"Ref":"Encryption"}, "ENCRYPTED"]}, "AdminSignUp":{"Fn::Equals":[{"Ref":"AdminUserSignUp"},"TRUE"]}, "Domain":{"Fn::Not":[{"Fn::Equals":[{"Ref":"ApprovedDomain"},"NONE"]}]}, "BuildExamples":{"Fn::Equals":[{"Ref":"BuildExamples"},"TRUE"]}, "CreateDomain":{"Fn::Equals":[{"Ref":"ElasticsearchName"},"EMPTY"]}, "DontCreateDomain":{"Fn::Not":[{"Fn::Equals":[{"Ref":"ElasticsearchName"},"EMPTY"]}]}, } }
{ "pile_set_name": "Github" }
' TEST_MODE : COMPILE_ONLY_FAIL type UDT extends object dummy as integer declare virtual const sub f( ) end type
{ "pile_set_name": "Github" }
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; using System.Threading; using System.Threading.Tasks; namespace Jering.Javascript.NodeJS { /// <summary> /// <para>An abstract <see cref="INodeJSService"/> implementation that facilitates working with an out of process NodeJS instance.</para> /// <para>The primary responsibilities of this class are launching and maintaining a NodeJS process. /// This class uses the stdout stream of the child process to perform a simple handshake with the NodeJS process. This is agnostic to the mechanism that /// derived classes use to actually perform the invocations (e.g., they could use HTTP-RPC, or a binary TCP /// protocol, or any other RPC-type mechanism).</para> /// </summary> /// <seealso cref="INodeJSService" /> public abstract class OutOfProcessNodeJSService : INodeJSService { /// <summary> /// Start of the message used to perform a handshake with the NodeJS process. /// </summary> protected internal const string CONNECTION_ESTABLISHED_MESSAGE_START = "[Jering.Javascript.NodeJS: Listening on "; /// <summary> /// The logger for the NodeJS process's stdout and stderr streams as well as messages from <see cref="OutOfProcessNodeJSService"/> and its implementations. /// </summary> protected readonly ILogger Logger; private readonly bool _debugLoggingEnabled; private readonly bool _warningLoggingEnabled; private readonly bool _infoLoggingEnabled; private readonly IEmbeddedResourcesService _embeddedResourcesService; private readonly IMonitorService _monitorService; private readonly ITaskService _taskService; private readonly IFileWatcherFactory _fileWatcherFactory; private readonly INodeJSProcessFactory _nodeProcessFactory; private readonly string _serverScriptName; private readonly Assembly _serverScriptAssembly; private readonly OutOfProcessNodeJSServiceOptions _options; private readonly object _connectingLock = new object(); private readonly object _invokeTaskTrackingLock = new object(); private readonly int _numRetries; private readonly int _numConnectionRetries; private readonly int _timeoutMS; private readonly ConcurrentDictionary<Task, object> _trackedInvokeTasks; // TODO use ConcurrentSet when it's available - https://github.com/dotnet/runtime/issues/16443 private readonly CountdownEvent _invokeTaskCreationCountdown; private readonly bool _trackInvokeTasks; private bool _disposed; private volatile INodeJSProcess _nodeJSProcess; // Volatile since it's used in a double checked lock (we check whether it's null) private IFileWatcher _fileWatcher; /// <summary> /// Creates an <see cref="OutOfProcessNodeJSService"/> instance. /// </summary> /// <param name="nodeProcessFactory"></param> /// <param name="logger"></param> /// <param name="optionsAccessor"></param> /// <param name="embeddedResourcesService"></param> /// <param name="fileWatcherFactory"></param> /// <param name="monitorService"></param> /// <param name="taskService"></param> /// <param name="serverScriptAssembly"></param> /// <param name="serverScriptName"></param> protected OutOfProcessNodeJSService(INodeJSProcessFactory nodeProcessFactory, ILogger logger, IOptions<OutOfProcessNodeJSServiceOptions> optionsAccessor, IEmbeddedResourcesService embeddedResourcesService, IFileWatcherFactory fileWatcherFactory, IMonitorService monitorService, ITaskService taskService, Assembly serverScriptAssembly, string serverScriptName) : this(nodeProcessFactory, logger, optionsAccessor, embeddedResourcesService, serverScriptAssembly, serverScriptName) { _fileWatcherFactory = fileWatcherFactory; _monitorService = monitorService; _taskService = taskService; (_trackInvokeTasks, _trackedInvokeTasks, _invokeTaskCreationCountdown) = InitializeFileWatching(); } // DO NOT DELETE - keep for backward compatibility. /// <summary> /// <para>Creates an <see cref="OutOfProcessNodeJSService"/> instance.</para> /// <para>If this constructor is used, file watching is disabled.</para> /// </summary> /// <param name="nodeProcessFactory"></param> /// <param name="logger"></param> /// <param name="optionsAccessor"></param> /// <param name="embeddedResourcesService"></param> /// <param name="serverScriptAssembly"></param> /// <param name="serverScriptName"></param> protected OutOfProcessNodeJSService(INodeJSProcessFactory nodeProcessFactory, ILogger logger, IOptions<OutOfProcessNodeJSServiceOptions> optionsAccessor, IEmbeddedResourcesService embeddedResourcesService, Assembly serverScriptAssembly, string serverScriptName) { _nodeProcessFactory = nodeProcessFactory; _options = optionsAccessor?.Value ?? new OutOfProcessNodeJSServiceOptions(); _embeddedResourcesService = embeddedResourcesService; _serverScriptName = serverScriptName; _serverScriptAssembly = serverScriptAssembly; Logger = logger; _debugLoggingEnabled = Logger.IsEnabled(LogLevel.Debug); _warningLoggingEnabled = Logger.IsEnabled(LogLevel.Warning); _infoLoggingEnabled = Logger.IsEnabled(LogLevel.Information); _numRetries = _options.NumRetries; _numConnectionRetries = _options.NumConnectionRetries; _timeoutMS = _options.TimeoutMS; } /// <summary> /// Asynchronously invokes code in the NodeJS instance. /// </summary> /// <typeparam name="T">The type of the object this method will return. It can be a JSON-serializable type, <see cref="string"/>, or <see cref="Stream"/>.</typeparam> /// <param name="invocationRequest">The invocation request to send to the NodeJS process.</param> /// <param name="cancellationToken">A <see cref="CancellationToken"/> that can be used to cancel the invocation.</param> /// <returns>The task object representing the asynchronous operation.</returns> protected abstract Task<(bool, T)> TryInvokeAsync<T>(InvocationRequest invocationRequest, CancellationToken cancellationToken); /// <summary> /// <para>This method is called when the connection established message from the NodeJS process is received.</para> /// <para>The message can be used to complete the handshake with the /// NodeJS process, for example by delivering a port and an IP address to use in further communications.</para> /// </summary> /// <param name="connectionEstablishedMessage">The connection established message.</param> protected abstract void OnConnectionEstablishedMessageReceived(string connectionEstablishedMessage); /// <inheritdoc /> public virtual async Task<T> InvokeFromFileAsync<T>(string modulePath, string exportName = null, object[] args = null, CancellationToken cancellationToken = default) { var invocationRequest = new InvocationRequest(ModuleSourceType.File, modulePath, exportName: exportName, args: args); return (await TryInvokeCoreAsync<T>(invocationRequest, cancellationToken).ConfigureAwait(false)).Item2; } /// <inheritdoc /> public virtual Task InvokeFromFileAsync(string modulePath, string exportName = null, object[] args = null, CancellationToken cancellationToken = default) { // Task<T> extends Task return InvokeFromFileAsync<Void>(modulePath, exportName, args, cancellationToken); } /// <inheritdoc /> public virtual async Task<T> InvokeFromStringAsync<T>(string moduleString, string newCacheIdentifier = null, string exportName = null, object[] args = null, CancellationToken cancellationToken = default) { var invocationRequest = new InvocationRequest(ModuleSourceType.String, moduleString, newCacheIdentifier, exportName, args); return (await TryInvokeCoreAsync<T>(invocationRequest, cancellationToken).ConfigureAwait(false)).Item2; } /// <inheritdoc /> public virtual Task InvokeFromStringAsync(string moduleString, string newCacheIdentifier = null, string exportName = null, object[] args = null, CancellationToken cancellationToken = default) { return InvokeFromStringAsync<Void>(moduleString, newCacheIdentifier, exportName, args, cancellationToken); } /// <inheritdoc /> public virtual async Task<T> InvokeFromStringAsync<T>(Func<string> moduleFactory, string cacheIdentifier, string exportName = null, object[] args = null, CancellationToken cancellationToken = default) { (bool success, T result) = await TryInvokeFromCacheAsync<T>(cacheIdentifier, exportName, args, cancellationToken).ConfigureAwait(false); if (success) { return result; } if (moduleFactory == null) { throw new ArgumentNullException(nameof(moduleFactory)); } // If module doesn't exist in cache, create module string and send it to the NodeJS process var invocationRequest = new InvocationRequest(ModuleSourceType.String, moduleFactory(), cacheIdentifier, exportName, args); return (await TryInvokeCoreAsync<T>(invocationRequest, cancellationToken).ConfigureAwait(false)).Item2; } /// <inheritdoc /> public virtual Task InvokeFromStringAsync(Func<string> moduleFactory, string cacheIdentifier, string exportName = null, object[] args = null, CancellationToken cancellationToken = default) { return InvokeFromStringAsync<Void>(moduleFactory, cacheIdentifier, exportName, args, cancellationToken); } /// <inheritdoc /> public virtual async Task<T> InvokeFromStreamAsync<T>(Stream moduleStream, string newCacheIdentifier = null, string exportName = null, object[] args = null, CancellationToken cancellationToken = default) { var invocationRequest = new InvocationRequest(ModuleSourceType.Stream, null, newCacheIdentifier, exportName, args, moduleStream); return (await TryInvokeCoreAsync<T>(invocationRequest, cancellationToken).ConfigureAwait(false)).Item2; } /// <inheritdoc /> public virtual Task InvokeFromStreamAsync(Stream moduleStream, string newCacheIdentifier = null, string exportName = null, object[] args = null, CancellationToken cancellationToken = default) { return InvokeFromStreamAsync<Void>(moduleStream, newCacheIdentifier, exportName, args, cancellationToken); } /// <inheritdoc /> public virtual async Task<T> InvokeFromStreamAsync<T>(Func<Stream> moduleFactory, string cacheIdentifier, string exportName = null, object[] args = null, CancellationToken cancellationToken = default) { (bool success, T result) = await TryInvokeFromCacheAsync<T>(cacheIdentifier, exportName, args, cancellationToken).ConfigureAwait(false); if (success) { return result; } if (moduleFactory == null) { throw new ArgumentNullException(nameof(moduleFactory)); } using (Stream moduleStream = moduleFactory()) { // If module doesn't exist in cache, create module stream and send it to the NodeJS process var invocationRequest = new InvocationRequest(ModuleSourceType.Stream, null, cacheIdentifier, exportName, args, moduleStream); return (await TryInvokeCoreAsync<T>(invocationRequest, cancellationToken).ConfigureAwait(false)).Item2; } } /// <inheritdoc /> public virtual Task InvokeFromStreamAsync(Func<Stream> moduleFactory, string cacheIdentifier, string exportName = null, object[] args = null, CancellationToken cancellationToken = default) { return InvokeFromStreamAsync<Void>(moduleFactory, cacheIdentifier, exportName, args, cancellationToken); } /// <inheritdoc /> public virtual Task<(bool, T)> TryInvokeFromCacheAsync<T>(string moduleCacheIdentifier, string exportName = null, object[] args = null, CancellationToken cancellationToken = default) { var invocationRequest = new InvocationRequest(ModuleSourceType.Cache, moduleCacheIdentifier, exportName: exportName, args: args); return TryInvokeCoreAsync<T>(invocationRequest, cancellationToken); } /// <inheritdoc /> public virtual async Task<bool> TryInvokeFromCacheAsync(string moduleCacheIdentifier, string exportName = null, object[] args = null, CancellationToken cancellationToken = default) { return (await TryInvokeFromCacheAsync<Void>(moduleCacheIdentifier, exportName, args, cancellationToken).ConfigureAwait(false)).Item1; } internal virtual async Task<(bool, T)> TryInvokeCoreAsync<T>(InvocationRequest invocationRequest, CancellationToken cancellationToken) { if (_disposed) { throw new ObjectDisposedException(nameof(OutOfProcessNodeJSService)); } int numRetries = _numRetries; while (true) { CancellationTokenSource cancellationTokenSource = null; try { // If we haven't connected to a NodeJS process or we've been disconnected, connect to a new process. // We want this within the while loop so if we disconnect between tries, we connect before retrying. ConnectIfNotConnected(); // Create cancellation token CancellationToken invokeCancellationToken; (invokeCancellationToken, cancellationTokenSource) = CreateCancellationToken(cancellationToken); // We need CTS so we can dispose of it return await (_trackInvokeTasks ? TryTrackedInvokeAsync<T>(invocationRequest, invokeCancellationToken, _trackedInvokeTasks, _invokeTaskCreationCountdown) : TryInvokeAsync<T>(invocationRequest, invokeCancellationToken)).ConfigureAwait(false); } catch (ConnectionException) { // ConnectIfNotConnected has its own retry logic throw; } catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested) { // Invocation canceled, don't retry throw; } catch (OperationCanceledException) when (numRetries == 0) { // Invocation timed out and no more retries throw new InvocationException(string.Format(Strings.InvocationException_OutOfProcessNodeJSService_InvocationTimedOut, _timeoutMS, nameof(OutOfProcessNodeJSServiceOptions.TimeoutMS), nameof(OutOfProcessNodeJSServiceOptions))); } catch (Exception exception) when (numRetries != 0) { if (invocationRequest.ModuleSourceType == ModuleSourceType.Stream) { if (!invocationRequest.ModuleStreamSource.CanSeek) { // Don't retry if stream source is unseekable. Callers can "cache" stream contents in a memory stream if they want retries. throw; } else if (!invocationRequest.CheckStreamAtInitialPosition()) { invocationRequest.ResetStreamPosition(); } } if (_warningLoggingEnabled) { Logger.LogWarning(string.Format(Strings.LogWarning_InvocationAttemptFailed, numRetries < 0 ? "infinity" : numRetries.ToString(), exception.ToString())); } } finally { cancellationTokenSource?.Dispose(); } numRetries = numRetries > 0 ? numRetries - 1 : numRetries; } } internal virtual (CancellationToken, CancellationTokenSource) CreateCancellationToken(CancellationToken cancellationToken) { if (_timeoutMS >= 0) { var cancellationTokenSource = new CancellationTokenSource(_timeoutMS); if (cancellationToken != CancellationToken.None) { cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, cancellationTokenSource.Token); } return (cancellationTokenSource.Token, cancellationTokenSource); } else { return (cancellationToken, null); } } internal virtual void ConnectIfNotConnected() { // Connected calls Process.HasExited, which throws if the Process instance is not attached to a process. This won't occur since // _nodeJSProcess is only ever assigned already-started Process instances (see CreateProcess). Process.HasExited also throws if // it can't access the process's exit code. People encounter this when they create a Process instance for an existing process, // and the existing process requires elevated privileges. This isn't an issue for us since we're creating the NodeJS // process and always have necessary privileges. // // This is safe threading-wise since _nodeJSProcess is volatile and its property getters enclose logic in lock blocks if (_nodeJSProcess?.Connected == true) { return; } // // Apart from the thread creating the process, all other threads will be blocked. lock (_connectingLock) { if (_nodeJSProcess?.Connected == true) { return; } // No need to listen for file events while connecting - the new NodeJS process will reload all files. // Stopping _fileWatcher prevents its underlying FileSystemWatcher's buffer from overflowing. // // Note that we don't need to worry about file events filling up the buffer between entering this _connectingLock block // and the following line because FileChangedHandler returns immediately if we're connecting. _fileWatcher?.Stop(); int numConnectionRetries = _numConnectionRetries; EventWaitHandle waitHandle = null; while (true) { try { // If an exception is thrown below, between CreateAndSetUpProcess and returning, we might retry despite having // started a process. Dispose to avoid orphan processes. _nodeJSProcess?.Dispose(); // If the new process is created successfully, the WaitHandle is set by OutputDataReceivedHandler. waitHandle = new EventWaitHandle(false, EventResetMode.ManualReset); _nodeJSProcess = CreateAndSetUpProcess(waitHandle); // Throws InvalidOperationException if it can't create the process if (_debugLoggingEnabled) { Logger.LogDebug(string.Format(Strings.LogDebug_OutOfProcessNodeJSService_BeforeWait, Thread.CurrentThread.ManagedThreadId.ToString())); } if (waitHandle.WaitOne(_timeoutMS < 0 ? -1 : _timeoutMS)) { // Start listening for file events before unblocking all threads. // // If we don't connect successfully, there's no point starting the file watcher since there's nothing to restart if a file changes. // For that reason, this doesn't need to be in a finally block. _fileWatcher?.Start(); _nodeJSProcess.SetConnected(); return; } else { // Kills and disposes _nodeJSProcess.Dispose(); // We're unlikely to get to this point. If we do we want the issue to be logged. throw new ConnectionException(string.Format(Strings.ConnectionException_OutOfProcessNodeJSService_ConnectionAttemptTimedOut, _timeoutMS, _nodeJSProcess.HasExited, _nodeJSProcess.ExitStatus)); } } catch (Exception exception) when (numConnectionRetries != 0) { if (_warningLoggingEnabled) { Logger.LogWarning(string.Format(Strings.LogWarning_ConnectionAttemptFailed, numConnectionRetries < 0 ? "infinity" : numConnectionRetries.ToString(), exception.ToString())); } } catch (Exception exception) when (!(exception is ConnectionException)) { // Wrap so users can easily identify connection issues throw new ConnectionException(Strings.ConnectionException_OutOfProcessNodeJSService_FailedToConnect, exception); } finally { waitHandle?.Dispose(); } numConnectionRetries = numConnectionRetries > 0 ? numConnectionRetries - 1 : numConnectionRetries; } } } // File watching graceful shutdown overview: // // If graceful shutdown is enabled, we wait till all of the current process's invocations complete before we kill it. // To do this, we store invoke tasks and call Task.WaitAll on them before killing processes. // // We store invoke tasks in an air-tight manner. // When a file event occurs, we enter _connectionLock and ditch the current process (see FileChangedHandler). // Subsequent invocations get blocked in ConnectIfNotConnected. However, there may be in-flight invocations that have gotten past // ConnectIfNotConnected. These invocations could be sent to the ditched process. // Therefore we allow their threads to "drain" past the task creation block (see TryTrackedInvokeAsync) before we store // invoke tasks (see MoveToNewProcess). // // With this sytem in place, we're guaranteed to get every invoke task sent to the process we're ditching. // Don't directly assign newed objects to instance variables. This way: // - they can be readonly, // - we can test if they were initialized correctly, // - and we can mock this method to return custom objects. // // Perfect dependency inversion would entail creating factories for these types. This internal virtual method does the job for now. internal virtual (bool trackInvokeTasks, ConcurrentDictionary<Task, object> trackedInvokeTasks, CountdownEvent invokeTaskCreationCountdown) InitializeFileWatching() { if (!_options.EnableFileWatching || _fileWatcherFactory == null || _monitorService == null || _taskService == null) { return default; } _fileWatcher = _fileWatcherFactory.Create(_options.WatchPath, _options.WatchSubdirectories, _options.WatchFileNamePatterns, FileChangedHandler); if (!_options.WatchGracefulShutdown) { return default; } // Note that we don't start file watching in this method. It's started when we actually have a process to restart. return (true, new ConcurrentDictionary<Task, object>(), new CountdownEvent(1)); } internal virtual async Task<(bool, T)> TryTrackedInvokeAsync<T>(InvocationRequest invocationRequest, CancellationToken cancellationToken, // Instance variables newed in this class must be passed as arguments so we can mock them for testability. ConcurrentDictionary<Task, object> trackedInvokeTasks, CountdownEvent invokeTaskCreationCountdown) { // Create tracked task lock (_invokeTaskTrackingLock) { invokeTaskCreationCountdown.AddCount(); } Task<(bool, T)> trackedInvokeTask = null; try { trackedInvokeTask = TryInvokeAsync<T>(invocationRequest, cancellationToken); trackedInvokeTasks.TryAdd(trackedInvokeTask, null); } finally { // Signal if we fail to create task or once task has been created and added to tracked tasks. invokeTaskCreationCountdown.Signal(); } // Await tracked task try { return await trackedInvokeTask.ConfigureAwait(false); } finally { // Remove completed task, note that it might already have been removed in MoveToNewProcess trackedInvokeTasks.TryRemove(trackedInvokeTask, out object _); } } // FileSystemWatcher handles file events synchronously, storing pending events in a buffer - https://github.com/dotnet/runtime/blob/master/src/libraries/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Win32.cs. // We don't need to worry about this method being called simultaneously by multiple threads. internal virtual void FileChangedHandler(string path) { bool acquiredConnectingLock = false; try { _monitorService.TryEnter(_connectingLock, ref acquiredConnectingLock); if (!acquiredConnectingLock) { if (_nodeJSProcess?.Connected != true) // If we're connecting, do nothing. { return; } // If we get here, _nodeJSProcess.SetConnected() has been called in ConnectIfNotConnected, but ConnectIfNotConnected hasn't exited _connectingLock. // Once _nodeJSProcess.SetConnected() is called, invocations aren't blocked in ConnectIfNotConnected. This means the NodeJS process may have already // received invocations and loaded user modules, so we must create a new process again. _monitorService.Enter(_connectingLock, ref acquiredConnectingLock); } // Immediately stop file watching to avoid FileSystemWatcher buffer overflows. Restarted in ConnectIfNotConnected. _fileWatcher.Stop(); if (_infoLoggingEnabled) { Logger.LogInformation(string.Format(Strings.LogInformation_FileChangedMovingtoNewNodeJSProcess, path)); } MoveToNewProcess(); } finally { if (acquiredConnectingLock) { _monitorService.Exit(_connectingLock); } } } internal virtual void MoveToNewProcess() { INodeJSProcess lastNodeJSProcess = null; ICollection<Task> lastProcessInvokeTasks = null; try { // Ditch current process, subsequent invocations get blocked in ConnectIfNotConnected lastNodeJSProcess = _nodeJSProcess; _nodeJSProcess = null; // Get last-process invoke tasks if we're tracking invoke tasks if (_trackInvokeTasks) { // Wait for all threads invoking in last process to start tasks (see TryTrackedInvokeAsync<T>) _monitorService.Enter(_invokeTaskTrackingLock); _invokeTaskCreationCountdown.Signal(); // So countdown can reach 0 _invokeTaskCreationCountdown.Wait(); // Wait for countdown to hit 0 // Store last-process-tasks. Note that ConcurrentDictionary.Keys returns a static ReadOnlyCollection // - https://github.com/dotnet/runtime/blob/master/src/libraries/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentDictionary.cs#L1977. // Also note that trackedInvokeTasks may empty between calling Count and Keys, but it doesn't matter since _taskService.WaitAll doesn't throw if // its argument is empty. lastProcessInvokeTasks = _trackedInvokeTasks.Count == 0 ? null : _trackedInvokeTasks.Keys; // TODO if a user invokes, changes a file, invokes more and changes a file again, and so on, // we could end up with multiple NodeJS processes shutting down simultaneously. This is not a pressing issue: // most machines run hundreds of processes at any one time, invocations tend not to be long running, and file changes (made by humans) // are likely to be spaced apart. Nonetheless, consider tracking process killing tasks (created in the // finally block below) and calling Task.WaitAny here if such tasks accumulate. // Reset _trackedInvokeTasks.Clear(); _invokeTaskCreationCountdown.Reset(1); } // Connect to new process ConnectIfNotConnected(); } finally { if (_trackInvokeTasks) { _monitorService.Exit(_invokeTaskTrackingLock); // Exit will never throw since we're guaranteed to have entered the lock if we get here } // Kill last process. At this point, we've started _fileWatcher, so we want to offload this to another thread to avoid // blocking file events. _taskService.Run(() => { if (lastProcessInvokeTasks != null) { try { // Wait for last process invocations to complete _taskService.WaitAll(lastProcessInvokeTasks.ToArray()); } catch { /* Do nothing, invocation exceptions are handled by TryInvokeAsyncCore<T> */ } } // Kill process if (_infoLoggingEnabled) { Logger.LogInformation(string.Format(Strings.LogInformation_KillingNodeJSProcess, lastNodeJSProcess.SafeID)); } lastNodeJSProcess.Dispose(); }); } } internal virtual INodeJSProcess CreateAndSetUpProcess(EventWaitHandle waitHandle) { // Create new process string serverScript = _embeddedResourcesService.ReadAsString(_serverScriptAssembly, _serverScriptName); INodeJSProcess result = _nodeProcessFactory.Create(serverScript); // stdout and stderr result.AddOutputReceivedHandler((object sender, string message) => OutputReceivedHandler(sender, message, waitHandle)); result.AddErrorReceivedHandler(ErrorReceivedHandler); result.BeginOutputReadLine(); result.BeginErrorReadLine(); return result; } internal void OutputReceivedHandler(object _, string message, EventWaitHandle waitHandle) { // _nodeJSProcess could be null if we receive a message from a ditched process. // // Note that we should not get a connection message for any process other than the current _nodeJSProcess // because ConnectIfNotConnected is synchronous. if (_nodeJSProcess?.Connected == false && message.StartsWith(CONNECTION_ESTABLISHED_MESSAGE_START)) { OnConnectionEstablishedMessageReceived(message); if (_infoLoggingEnabled) { Logger.LogInformation(string.Format(Strings.LogInformation_ConnectedToNodeJSProcess, _nodeJSProcess.SafeID)); } if (_debugLoggingEnabled) { Logger.LogDebug(string.Format(Strings.LogDebug_OutOfProcessNodeJSService_BeforeSet, Thread.CurrentThread.ManagedThreadId.ToString())); } waitHandle.Set(); } else if(_infoLoggingEnabled) { Logger.LogInformation(message); } } internal void ErrorReceivedHandler(object _, string message) { Logger.LogError(message); } /// <summary> /// Disposes this instance. This method is not thread-safe. It should only be called after all other calls to this instance's methods have returned. /// </summary> public void Dispose() { Dispose(true); GC.SuppressFinalize(this); // In case a sub class overrides Object.Finalize - https://docs.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-dispose#the-dispose-overload } /// <summary> /// Disposes the instance. This method is not thread-safe. It should only be called after all other calls to this instance's methods have returned. /// </summary> /// <param name="disposing">True if the object is disposing or false if it is finalizing.</param> protected virtual void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { _nodeJSProcess?.Dispose(); _fileWatcher?.Dispose(); _invokeTaskCreationCountdown?.Dispose(); } _disposed = true; } } }
{ "pile_set_name": "Github" }
# https://github.com/richardkiss/pycoin # # The MIT License (MIT) # # Copyright (c) 2013 by Richard Kiss # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # import functools from pycoin.serialize import b2h_rev from pycoin.serialize.bitcoin_streamer import parse_struct, stream_struct ITEM_TYPE_TX, ITEM_TYPE_BLOCK, ITEM_TYPE_MERKLEBLOCK, ITEM_TYPE_SEGWIT_TX, ITEM_TYPE_SEGWIT_BLOCK = \ (1, 2, 3, 1073741825, 1073741826) @functools.total_ordering class InvItem(object): def __init__(self, item_type, data, dont_check=False): if not dont_check: assert item_type in ( ITEM_TYPE_TX, ITEM_TYPE_BLOCK, ITEM_TYPE_MERKLEBLOCK, ITEM_TYPE_SEGWIT_TX, ITEM_TYPE_SEGWIT_BLOCK ) self.item_type = item_type assert isinstance(data, bytes) assert not len(data) % 32 self.data = data def __str__(self): BLOCK = "Block" TX = "Tx" INV_TYPES = {0: "?", 1: TX, 2: BLOCK, 3: "Merkle", 1073741825: TX, 1073741826: BLOCK} idx = self.item_type if idx not in INV_TYPES.keys(): idx = 0 return "InvItem %s [%s]" % (INV_TYPES[idx], b2h_rev(self.data)) def __repr__(self): return str(self) def __hash__(self): return hash((self.item_type, self.data)) def __eq__(self, other): if isinstance(other, self.__class__): return self.item_type == other.item_type and self.data == other.data return False def __lt__(self, other): return (self.item_type, self.data) < (other.item_type, other.data) def stream(self, f): stream_struct("L#", f, self.item_type, self.data) @classmethod def parse(cls, f): return cls(*parse_struct("L#", f), dont_check=True)
{ "pile_set_name": "Github" }
/* Copyright 2016 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 admission import ( "context" "testing" "k8s.io/apiserver/pkg/admission" ) type doNothingAdmission struct{} func (doNothingAdmission) Admit(ctx context.Context, a admission.Attributes, o admission.ObjectInterfaces) error { return nil } func (doNothingAdmission) Handles(o admission.Operation) bool { return false } func (doNothingAdmission) Validate() error { return nil } type WantsCloudConfigAdmissionPlugin struct { doNothingAdmission cloudConfig []byte } func (p *WantsCloudConfigAdmissionPlugin) SetCloudConfig(cloudConfig []byte) { p.cloudConfig = cloudConfig } func TestCloudConfigAdmissionPlugin(t *testing.T) { cloudConfig := []byte("cloud-configuration") initializer := NewPluginInitializer(cloudConfig, nil, nil) wantsCloudConfigAdmission := &WantsCloudConfigAdmissionPlugin{} initializer.Initialize(wantsCloudConfigAdmission) if wantsCloudConfigAdmission.cloudConfig == nil { t.Errorf("Expected cloud config to be initialized but found nil") } }
{ "pile_set_name": "Github" }
/* iCheck plugin Square skin, aero ----------------------------------- */ .icheckbox_square-aero, .iradio_square-aero { display: inline-block; *display: inline; vertical-align: middle; margin: 0; padding: 0; width: 22px; height: 22px; background: url(aero.png) no-repeat; border: none; cursor: pointer; } .icheckbox_square-aero { background-position: 0 0; } .icheckbox_square-aero.hover { background-position: -24px 0; } .icheckbox_square-aero.checked { background-position: -48px 0; } .icheckbox_square-aero.disabled { background-position: -72px 0; cursor: default; } .icheckbox_square-aero.checked.disabled { background-position: -96px 0; } .iradio_square-aero { background-position: -120px 0; } .iradio_square-aero.hover { background-position: -144px 0; } .iradio_square-aero.checked { background-position: -168px 0; } .iradio_square-aero.disabled { background-position: -192px 0; cursor: default; } .iradio_square-aero.checked.disabled { background-position: -216px 0; } /* Retina support */ @media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (-moz-min-device-pixel-ratio: 1.5), only screen and (-o-min-device-pixel-ratio: 3/2), only screen and (min-device-pixel-ratio: 1.5) { .icheckbox_square-aero, .iradio_square-aero { background-image: url([email protected]); -webkit-background-size: 240px 24px; background-size: 240px 24px; } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN" "http://struts.apache.org/dtds/struts-2.5.dtd"> <struts> <package name="qcharts-analyticsConfig" extends="qcharts-default" namespace="/" > <action name="qcharts.analyticsConfigManagementAction" class="qcharts.web.controller.AnalyticsConfigManagementAction"> <result name="input">/pages/analytics-config/analytics-config-management.jsp</result> <result name="success">/pages/analytics-config/analytics-config-management.jsp</result> </action> <action name="qcharts.analyticsConfigCreateAction" class="qcharts.web.controller.AnalyticsConfigManagementAction" method="create"> <result name="input">/pages/analytics-config/analytics-config-create.jsp</result> <result name="success">/pages/analytics-config/analytics-config-create.jsp</result> </action> <action name="qcharts.analyticsConfigEditAction" class="qcharts.web.controller.AnalyticsConfigManagementAction" method="edit"> <result name="input">/pages/analytics-config/analytics-config-edit.jsp</result> <result name="success">/pages/analytics-config/analytics-config-edit.jsp</result> </action> </package> <package name="qcharts-analyticsConfig-json" extends="qcharts-default,json-default" namespace="/" > <default-interceptor-ref name="greenStepDefaultCustomStack" /> <action name="qcharts.analyticsConfigManagementGridQueryAction" class="qcharts.web.controller.AnalyticsConfigManagementGridQueryAction" > <result type="json"> <param name="contentType">text/html</param> <param name="noCache">true</param> </result> </action> <action name="qcharts.analyticsConfigSaveAction" class="qcharts.web.controller.AnalyticsConfigSaveOrUpdateAction" method="doSave"> <result type="json"> <param name="contentType">text/html</param> <param name="noCache">true</param> </result> </action> <action name="qcharts.analyticsConfigUpdateAction" class="qcharts.web.controller.AnalyticsConfigSaveOrUpdateAction" method="doUpdate"> <result type="json"> <param name="contentType">text/html</param> <param name="noCache">true</param> </result> </action> <action name="qcharts.analyticsConfigDeleteAction" class="qcharts.web.controller.AnalyticsConfigSaveOrUpdateAction" method="doDelete"> <result type="json"> <param name="contentType">text/html</param> <param name="noCache">true</param> </result> </action> </package> </struts>
{ "pile_set_name": "Github" }
/* Copyright (C) 2014, The University of Texas at Austin This file is part of libflame and is available under the 3-Clause BSD license, which can be found in the LICENSE file at the top-level directory, or at http://opensource.org/licenses/BSD-3-Clause */ #include "FLAME.h" FLA_Error FLA_Tridiag_UT_recover_tau_submatrix( FLA_Obj T, FLA_Obj t ); FLA_Error FLA_Tridiag_UT_recover_tau( FLA_Obj T, FLA_Obj t ) { FLA_Obj TL, TR, T0, T1, T2; FLA_Obj tT, t0, tB, t1, t2; dim_t b_alg, b; if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING ) FLA_Tridiag_UT_recover_tau_check( T, t ); b_alg = FLA_Obj_length( T ); FLA_Part_1x2( T, &TL, &TR, 0, FLA_LEFT ); FLA_Part_2x1( t, &tT, &tB, 0, FLA_TOP ); while ( FLA_Obj_length( tT ) < FLA_Obj_length( t ) ){ b = min( FLA_Obj_length( tB ), b_alg ); FLA_Repart_1x2_to_1x3( TL, /**/ TR, &T0, /**/ &T1, &T2, b, FLA_RIGHT ); FLA_Repart_2x1_to_3x1( tT, &t0, /* ** */ /* ** */ &t1, tB, &t2, b, FLA_BOTTOM ); /*------------------------------------------------------------*/ FLA_Tridiag_UT_recover_tau_submatrix( T1, t1 ); /*------------------------------------------------------------*/ FLA_Cont_with_1x3_to_1x2( &TL, /**/ &TR, T0, T1, /**/ T2, FLA_LEFT ); FLA_Cont_with_3x1_to_2x1( &tT, t0, t1, /* ** */ /* ** */ &tB, t2, FLA_TOP ); } return FLA_SUCCESS; } FLA_Error FLA_Tridiag_UT_recover_tau_submatrix( FLA_Obj T, FLA_Obj t ) { FLA_Obj TTL, TTR, T00, t01, T02, TBL, TBR, t10t, tau11, t12t, T20, t21, T22; FLA_Obj tT, t0, tB, tau1, t2; FLA_Part_2x2( T, &TTL, &TTR, &TBL, &TBR, 0, 0, FLA_TL ); FLA_Part_2x1( t, &tT, &tB, 0, FLA_TOP ); while ( FLA_Obj_min_dim( TBR ) > 0 ){ FLA_Repart_2x2_to_3x3( TTL, /**/ TTR, &T00, /**/ &t01, &T02, /* ************* */ /* ************************ */ &t10t, /**/ &tau11, &t12t, TBL, /**/ TBR, &T20, /**/ &t21, &T22, 1, 1, FLA_BR ); FLA_Repart_2x1_to_3x1( tT, &t0, /* ** */ /* ** */ &tau1, tB, &t2, 1, FLA_BOTTOM ); /*------------------------------------------------------------*/ // tau1 = tau11; FLA_Copy_external( tau11, tau1 ); /*------------------------------------------------------------*/ FLA_Cont_with_3x3_to_2x2( &TTL, /**/ &TTR, T00, t01, /**/ T02, t10t, tau11, /**/ t12t, /* ************** */ /* ********************** */ &TBL, /**/ &TBR, T20, t21, /**/ T22, FLA_TL ); FLA_Cont_with_3x1_to_2x1( &tT, t0, tau1, /* ** */ /* ** */ &tB, t2, FLA_TOP ); } return FLA_SUCCESS; }
{ "pile_set_name": "Github" }
application.secret = testsecret application.cookie.prefix = NINJA application.languages=
{ "pile_set_name": "Github" }
var convert = require('./convert'), func = convert('bindKey', require('../bindKey')); func.placeholder = require('./placeholder'); module.exports = func;
{ "pile_set_name": "Github" }