text:
Population Health Monitoring
Climbing the Information Pyramid (Sprache: Englisch)
Schreiben Sie den ersten Kommentar zu "Population Health Monitoring".
This timely volume presents an in-depth tour of population health monitoring-what it is, what it does, and why it has become increasingly important to health information systems across Europe. Introductory chapters ground readers in the structures of health...
Wireless Mobile Communication and Healthcare
Adrian Stavert-Dobson
Krankenhaus-Report 2019
Digital Medicine
Practitioner's Guide to Health Informatics
Mark Braunstein
Pervasive Computing Paradigms for Mental Health
Gerontechnology
Information and Communication Technologies for Ageing Well and e-Health
Health Information Science
Biomedical Engineering Systems and Technologies
Sport Science Research and Technology Support
Health Informatics on FHIR: How HL7's New API is Transforming Healthcare
Mark L. Braunstein
Mental Health Practice in a Digital World
Social Web and Health Research
Internet of Things (IoT) Technologies for HealthCare
Optimizing Hospital-wide Patient Scheduling
Daniel Gartner
Produktinformationen zu "Population Health Monitoring "
Klappentext zu "Population Health Monitoring "
This timely volume presents an in-depth tour of population health monitoring-what it is, what it does, and why it has become increasingly important to health information systems across Europe. Introductory chapters ground readers in the structures of health information systems, and the main theoretical and conceptual models of population health monitoring. From there, contributors offer tools and guidelines for optimum monitoring, including best practices for gathering and contextualizing data and for disseminating findings, to benefit the people most affected by the information. And an extended example follows the step-by-step processes of population health monitoring through a study of health inequalities, from data collection to policy recommendations.
Included in the coverage:
· Structuring health information: frameworks, models, and indicators
· Analysis: contextualization of process and content
· Knowledge translation: key concepts, terms, and activities
· Health inequality monitoring: a practical application of population health monitoring
· Relating population health monitoring to other types of health assessments
· Population health monitoring: strengths, weaknesses, opportunities, and threats
A robust guide with international implications for an emerging field, Population Health Monitoring is a salient reference for public health experts working in the field of health information as well as post-graduate public health students and public health policymakers.
"In this comprehensive and easy to read volume, Verschuuren and van Oers, accompanied by other specialists in the field, present a fresh and thoroughly researched contribution on the discipline of population health monitoring. They critically analyse and describe the phases, functions and approaches to population health monitoring but far more importantly, the discipline is positioned within the wider domains of public health, health policy and health systems. The book is
definitely highly recommended reading for students of public health and health services management but is also a useful refresher course for public health practitioners."
Natasha Azzopardi Muscat, President, European Public Health Association
Chapter 7 of this book is available open access under a CC BY 3.0 IGO license at link.springer.com
... weniger
Inhaltsverzeichnis zu "Population Health Monitoring "
Chapter 1: Introduction [Marieke Verschuuren (RIVM) & Hans van Oers (RIVM)]
Definition, scope and role of population health monitoring
Underlying concepts: the information pyramid, health information chain, policy cycle
Illustration of how good monitoring can steer effective policy making by means of one or two elaborated case studies
Aims of the book
Chapter 2: Health Information Systems [Bernd Rechel (WHO Observatory on health systems), Nicole Rosenkoetter (NRW Centre for Public Health, Germany) Marieke Verschuuren, Hans van Oers]
Requirements for health information systems (based in WHO guidelines and other relevant sources)
The current situation in Europe (based on health system in transition (HiT reports and other relevant sources)
Assessing and improving health information systems, the need for health information strategies
Health information systems at different geographical levels (local, regional, national, international): their links and specific requirements
Chapter 3: Conceptual Models for Public Health Monitoring [Arpana Verma (University of Manchester), Peter Achterberg (RIVM), Henk Hilderink (RIVM)]
Conceptual models for public health monitoring (Lalonde, Whitehead and Dahlgren, input-process-output, etc.)
From a conceptual model to indicator selection; selection/quality criteria, what makes a good indicator?
Indicator work at the international level and underlying concepts
Chapter 4: Data Sources [Ivo Rakovac (WHO-Euro), someone from Eurostat, someone from OECD, Lany Slobbe (RIVM)]
Different types of data sources useful for population health monitoring and their strengths and limitations
EHRs, big data, and other current developments
Chapter 5: Knowledge Synthesis [Nancy Hoeymans (RIVM), Casper Schoemaker (RIVM), Henk Hilderink, international forecasting expert]
From data to information, e.g. trend analyses, benchmarking, ranking, comparing population groups, comparing geographical areas, and their pros & cons and requirements
From information to knowledge, e.g. linking information on determinants with information on health outcomes, linking information on health outcomes with information on the (cost)effectiveness of interventions, and their pros & cons and requirements
Modeling, forecasting and foresight exercises: typology, strengths and limitations, requirements for quantitative (data, models) and qualitative approaches (stakeholder involvement, ...)
Chapter 6: Health Reporting [Marja van Bon (Trimbos Institute, the Netherlands), Hans van Oers, Marieke Verschuuren]
Definition, link with information pyramid, role in policy cycle
Quality criteria for health reporting (content, process, presentation and communication)
The importance of stakeholder involvement, co-creation
The digital revolution in health reporting
Chapter 7: Knowledge Transfer [David Hunter (Durham University), Rosemary Rushmer (Durham University), Tanja Kuchenmüller/Tim Nguyen (WHO-Euro)]
The challenges and opportunities related to the interface between research and policy
Different models for knowledge transfer
Knowledge translation tools
Chapter 8: Population Health Monitoring and Other Health Assessments [Rainer Fehr (EUPHA section on Health Impact Assessment) & Nicole Rosenkoetter]
Overlap and differences between population health monitoring and other health assessments (e.g. health impact assessment, health systems assessment, health technology assessment)
Opportunities for integration and cross-fertilization
Chapter 9: Opportunities and Challenges [Marieke Verschuuren & Hans van Oers]
Integrative summary focusing on main challenges identified in the book
Creating opportunities by linking these challenges to new developments and innovative approaches
Identifying points for action (health information development agenda)
Autoren-Porträt
Marieke Verschuuren, MD, PhD, worked as a practicing physician, particularly in health care for the institutionalized elderly, before she started working as a researcher in 2002. Since earning her PhD in Health Technology Assessment in 2006, Dr. Verschuuren has been working in health information and public health monitoring and reporting, both at the national and at the international level. The interface of policy and research (evidence-informed policy-making) is her special interest. She has collaborated in and led various projects, among which are the European Public Health and Information System (EUPHIX) project and European Core Health Indicators and Monitoring (ECHIM) project, both co-funded by the European Commission, and the nationaalkompas.nl and volksgezondheidenzorg.info projects, both web-based public health information systems commissioned by the Dutch Ministry of Health. Furthermore, Dr. Verschuuren has extensively collaborated with WHO Regional Office for Europe.
Dr. Verschuuren has served as editor-in-chief of the European health report 2015 and coordinator of the European Health Information Initiative (EHII), a multi-stakeholder WHO network aimed at improving the evidence base for policy making in Europe. Currently, she is a member of the EHII Steering Group and preparing health information system assessments missions to Bulgaria and Moldova as a WHO consultant. Furthermore, she is senior advisor to the Dutch Public Health Status and Forecast 2018 that aims to inform Dutch national health policy. Dr. Verschuuren also is the founder of the EUPHA section on Public Health Monitoring and Reporting.
J.A.M. (Hans) van Oers, PhD, has been working at the National Institute of Public Health and the Environment (RIVM) since 1998. Since 2012, Prof. Dr. van Oers has served as RIVM's Chief Science Officer of System Assessment and Policy Support, and since 2004, he has been a professor in Public Health with Tranzo at Tilburg University in the
Netherlands. Previously, he was involved in the development of the World Health Organization's Global Health Observatory, an Internet-based information system to support public health policymakers worldwide. He also served as head of the department of Public Health Status and Forecasts, being responsible for the publication of the Dutch public health report every four years, a major building block for the development of the national health policy.
Prof. Dr. van Oers is a member of the Dutch Health Council, is chairing the ZonMw-program committee on "healthy lifestyle and healthy environment," and is a member of the ZonMw-committee, "academic collaborative centers on public health." At the international level, he was a.o. project leader of the EU-funded project EUPHIX (European Public Health Information System) and co-chair of the WHO-EURO working group on health information strategy. He is strongly involved in the WHO/RIVM-funded European Health Information Initiative, a project to improve disclosure and dissemination of information, knowledge, and expertise on health monitoring and health reporting.
2019, xxv, 209 Seiten, 40 farbige Abbildungen, Masse: 16 x 24,1 cm, Gebunden, Englisch
Verlag: Springer, Berlin
Kommentar zu "Population Health Monitoring"
Social Media in Clinical Practice
Bertalan Meskó
Weitere Empfehlungen zu "Population Health Monitoring "
Arbeitsschutz - ArbSchG
Politische Begriffe
Forschung (naturwissenschaftlich)
Sie sind aus Deutschland? Population Health Monitoring bei Weltbild.de kaufen.
0 Gebrauchte Artikel zu "Population Health Monitoring"


text:
// Copyright 2014 The Bazel Authors. 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.

#include "src/main/native/unix_jni.h"

#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <jni.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <utime.h>

#include <string>
#include <vector>

#include "src/main/cpp/util/port.h"
#include "src/main/native/latin1_jni_path.h"
#include "src/main/native/macros.h"

#if defined(O_DIRECTORY)
#define PORTABLE_O_DIRECTORY O_DIRECTORY
#else
#define PORTABLE_O_DIRECTORY 0
#endif

namespace blaze_jni {

// See unix_jni.h.
void PostException(JNIEnv *env, int error_number, const std::string& message) {
  // Keep consistent with package-info.html!
  //
  // See /usr/include/asm/errno.h for UNIX error messages.
  // Select the most appropriate Java exception for a given UNIX error number.
  // (Consistent with errors generated by java.io package.)
  const char *exception_classname;
  switch (error_number) {
    case EFAULT:  // Illegal pointer (unlikely; perhaps from or via FUSE?)
      exception_classname = "java/lang/IllegalArgumentException";
      break;
    case ETIMEDOUT:  // Local socket timed out
      exception_classname = "java/net/SocketTimeoutException";
      break;
    case ENOENT:  // No such file or directory
      exception_classname = "java/io/FileNotFoundException";
      break;
    case EACCES:  // Permission denied
      exception_classname =
          "com/google/devtools/build/lib/vfs/FileAccessException";
      break;
    case EPERM:   // Operation not permitted
      exception_classname =
          "com/google/devtools/build/lib/unix/FilePermissionException";
      break;
    case EINTR:   // Interrupted system call
      exception_classname = "java/io/InterruptedIOException";
      break;
    case ENOMEM:  // Out of memory
      exception_classname = "java/lang/OutOfMemoryError";
      break;
    case ENOSYS:   // Function not implemented
    case ENOTSUP:  // Operation not supported on transport endpoint
                   // (aka EOPNOTSUPP)
      exception_classname = "java/lang/UnsupportedOperationException";
      break;
    case EINVAL:  // Invalid argument
      exception_classname =
          "com/google/devtools/build/lib/unix/InvalidArgumentIOException";
      break;
    case ELOOP:  // Too many symbolic links encountered
      exception_classname =
          "com/google/devtools/build/lib/vfs/FileSymlinkLoopException";
      break;
    case EBADF:         // Bad file number or descriptor already closed.
    case ENAMETOOLONG:  // File name too long
    case ENODATA:    // No data available
#if defined(EMULTIHOP)
    case EMULTIHOP:  // Multihop attempted
#endif
    case ENOLINK:    // Link has been severed
    case EIO:        // I/O error
    case EAGAIN:     // Try again
    case EFBIG:      // File too large
    case EPIPE:      // Broken pipe
    case ENOSPC:     // No space left on device
    case EXDEV:      // Cross-device link
    case EROFS:      // Read-only file system
    case EEXIST:     // File exists
    case EMLINK:     // Too many links
    case EISDIR:     // Is a directory
    case ENOTDIR:    // Not a directory
    case ENOTEMPTY:  // Directory not empty
    case EBUSY:      // Device or resource busy
    case ENFILE:     // File table overflow
    case EMFILE:     // Too many open files
    default:
      exception_classname = "java/io/IOException";
  }
  jclass exception_class = env->FindClass(exception_classname);
  if (exception_class != nullptr) {
    env->ThrowNew(exception_class,
                  (message + " (" + ErrorMessage(error_number) + ")").c_str());
  } else {
    abort();  // panic!
  }
}

// Throws RuntimeExceptions for IO operations which fail unexpectedly.
// See package-info.html.
// Returns true iff an exception was thrown.
static bool PostRuntimeException(JNIEnv *env, int error_number,
                                 const char *file_path) {
  const char *exception_classname;
  switch (error_number) {
    case EFAULT:   // Illegal pointer--not likely
    case EBADF:    // Bad file number
      exception_classname = "java/lang/IllegalArgumentException";
      break;
    case ENOMEM:   // Out of memory
      exception_classname = "java/lang/OutOfMemoryError";
      break;
    case ENOTSUP:  // Operation not supported on transport endpoint
                   // (aka EOPNOTSUPP)
      exception_classname = "java/lang/UnsupportedOperationException";
      break;
    default:
      exception_classname = nullptr;
  }

  if (exception_classname == nullptr) {
    return false;
  }

  jclass exception_class = env->FindClass(exception_classname);
  if (exception_class != nullptr) {
    std::string message(file_path);
    message += " (";
    message += ErrorMessage(error_number);
    message += ")";
    env->ThrowNew(exception_class, message.c_str());
    return true;
  } else {
    abort();  // panic!
    return false;  // Not reachable.
  }
}

// TODO(bazel-team): split out all the FileSystem class's native methods
// into a separate source file, fsutils.cc.

extern "C" JNIEXPORT jstring JNICALL
Java_com_google_devtools_build_lib_unix_NativePosixFiles_readlink(JNIEnv *env,
                                                     jclass clazz,
                                                     jstring path) {
  const char *path_chars = GetStringLatin1Chars(env, path);
  char target[PATH_MAX] = "";
  jstring r = nullptr;
  if (readlink(path_chars, target, arraysize(target)) == -1) {
    PostException(env, errno, path_chars);
  } else {
    r = NewStringLatin1(env, target);
  }
  ReleaseStringLatin1Chars(path_chars);
  return r;
}

extern "C" JNIEXPORT void JNICALL
Java_com_google_devtools_build_lib_unix_NativePosixFiles_chmod(JNIEnv *env,
                                                  jclass clazz,
                                                  jstring path,
                                                  jint mode) {
  const char *path_chars = GetStringLatin1Chars(env, path);
  if (chmod(path_chars, static_cast<int>(mode)) == -1) {
    PostException(env, errno, path_chars);
  }
  ReleaseStringLatin1Chars(path_chars);
}

static void link_common(JNIEnv *env,
                        jstring oldpath,
                        jstring newpath,
                        int (*link_function)(const char *, const char *)) {
  const char *oldpath_chars = GetStringLatin1Chars(env, oldpath);
  const char *newpath_chars = GetStringLatin1Chars(env, newpath);
  if (link_function(oldpath_chars, newpath_chars) == -1) {
    PostException(env, errno, newpath_chars);
  }
  ReleaseStringLatin1Chars(oldpath_chars);
  ReleaseStringLatin1Chars(newpath_chars);
}

extern "C" JNIEXPORT void JNICALL
Java_com_google_devtools_build_lib_unix_NativePosixFiles_link(JNIEnv *env,
                                                 jclass clazz,
                                                 jstring oldpath,
                                                 jstring newpath) {
  link_common(env, oldpath, newpath, ::link);
}

extern "C" JNIEXPORT void JNICALL
Java_com_google_devtools_build_lib_unix_NativePosixFiles_symlink(JNIEnv *env,
                                                    jclass clazz,
                                                    jstring oldpath,
                                                    jstring newpath) {
  link_common(env, oldpath, newpath, ::symlink);
}

namespace {
static jclass file_status_class = nullptr;
static jclass errno_file_status_class = nullptr;
static jmethodID file_status_class_ctor = nullptr;
static jmethodID errno_file_status_class_no_error_ctor = nullptr;
static jmethodID errno_file_status_class_errorno_ctor = nullptr;
static jclass dirents_class = nullptr;
static jmethodID dirents_ctor = nullptr;

static jclass makeStaticClass(JNIEnv *env, const char *name) {
  jclass lookup_result = env->FindClass(name);
  CHECK(lookup_result != nullptr);
  return static_cast<jclass>(env->NewGlobalRef(lookup_result));
}

static jmethodID getConstructorID(JNIEnv *env, jclass clazz,
                                  const char *parameters) {
  jmethodID method = env->GetMethodID(clazz, "<init>", parameters);
  CHECK(method != nullptr);
  return method;
}

static jobject NewFileStatus(JNIEnv *env,
                             const portable_stat_struct &stat_ref) {
  return env->NewObject(
      file_status_class, file_status_class_ctor, stat_ref.st_mode,
      StatSeconds(stat_ref, STAT_ATIME), StatNanoSeconds(stat_ref, STAT_ATIME),
      StatSeconds(stat_ref, STAT_MTIME), StatNanoSeconds(stat_ref, STAT_MTIME),
      StatSeconds(stat_ref, STAT_CTIME), StatNanoSeconds(stat_ref, STAT_CTIME),
      static_cast<jlong>(stat_ref.st_size), static_cast<int>(stat_ref.st_dev),
      static_cast<jlong>(stat_ref.st_ino));
}

static jobject NewErrnoFileStatus(JNIEnv *env,
                                  int saved_errno,
                                  const portable_stat_struct &stat_ref) {
  if (saved_errno != 0) {
    return env->NewObject(errno_file_status_class,
                          errno_file_status_class_errorno_ctor, saved_errno);
  }
  return env->NewObject(
      errno_file_status_class, errno_file_status_class_no_error_ctor,
      stat_ref.st_mode, StatSeconds(stat_ref, STAT_ATIME),
      StatNanoSeconds(stat_ref, STAT_ATIME), StatSeconds(stat_ref, STAT_MTIME),
      StatNanoSeconds(stat_ref, STAT_MTIME), StatSeconds(stat_ref, STAT_CTIME),
      StatNanoSeconds(stat_ref, STAT_CTIME),
      static_cast<jlong>(stat_ref.st_size), static_cast<int>(stat_ref.st_dev),
      static_cast<jlong>(stat_ref.st_ino));
}

static void SetIntField(JNIEnv *env,
                        const jclass &clazz,
                        const jobject &object,
                        const char *name,
                        int val) {
  jfieldID fid = env->GetFieldID(clazz, name, "I");
  CHECK(fid != nullptr);
  env->SetIntField(object, fid, val);
}

// RAII class for jstring.
class JStringLatin1Holder {
  const char *const chars;

 public:
  JStringLatin1Holder(JNIEnv *env, jstring string)
      : chars(GetStringLatin1Chars(env, string)) {}

  ~JStringLatin1Holder() { ReleaseStringLatin1Chars(chars); }

  operator const char *() const { return chars; }

  operator std::string() const { return chars; }
};

}  // namespace

extern "C" JNIEXPORT void JNICALL
Java_com_google_devtools_build_lib_unix_NativePosixFiles_initJNIClasses(
    JNIEnv *env, jclass clazz) {
  file_status_class =
      makeStaticClass(env, "com/google/devtools/build/lib/unix/FileStatus");
  errno_file_status_class = makeStaticClass(
      env, "com/google/devtools/build/lib/unix/ErrnoFileStatus");
  file_status_class_ctor =
      getConstructorID(env, file_status_class, "(IIIIIIIJIJ)V");
  errno_file_status_class_no_error_ctor =
      getConstructorID(env, errno_file_status_class, "(IIIIIIIJIJ)V");
  errno_file_status_class_errorno_ctor =
      getConstructorID(env, errno_file_status_class, "(I)V");
  dirents_class = makeStaticClass(
      env, "com/google/devtools/build/lib/unix/NativePosixFiles$Dirents");
  dirents_ctor =
      getConstructorID(env, dirents_class, "([Ljava/lang/String;[B)V");
}

extern "C" JNIEXPORT void JNICALL
Java_com_google_devtools_build_lib_unix_ErrnoFileStatus_00024ErrnoConstants_initErrnoConstants(  // NOLINT
  JNIEnv *env, jobject errno_constants) {
  jclass clazz = env->GetObjectClass(errno_constants);
  SetIntField(env, clazz, errno_constants, "ENOENT", ENOENT);
  SetIntField(env, clazz, errno_constants, "EACCES", EACCES);
  SetIntField(env, clazz, errno_constants, "ELOOP", ELOOP);
  SetIntField(env, clazz, errno_constants, "ENOTDIR", ENOTDIR);
  SetIntField(env, clazz, errno_constants, "ENAMETOOLONG", ENAMETOOLONG);
}

namespace {
static jobject StatCommon(JNIEnv *env, jstring path,
                          int (*stat_function)(const char *,
                                               portable_stat_struct *),
                          bool should_throw) {
  portable_stat_struct statbuf;
  const char *path_chars = GetStringLatin1Chars(env, path);
  int r;
  int saved_errno = 0;
  while ((r = stat_function(path_chars, &statbuf)) == -1 && errno == EINTR) { }
  if (r == -1) {
    // Save errno immediately, before we do any other syscalls
    saved_errno = errno;

    // EACCES ENOENT ENOTDIR ELOOP -> IOException
    // ENAMETOOLONGEFAULT          -> RuntimeException
    // ENOMEM                      -> OutOfMemoryError

    if (PostRuntimeException(env, saved_errno, path_chars)) {
      ReleaseStringLatin1Chars(path_chars);
      return nullptr;
    } else if (should_throw) {
      PostException(env, saved_errno, path_chars);
      ReleaseStringLatin1Chars(path_chars);
      return nullptr;
    }
  }
  ReleaseStringLatin1Chars(path_chars);

  return should_throw
    ? NewFileStatus(env, statbuf)
    : NewErrnoFileStatus(env, saved_errno, statbuf);
}
}  // namespace

/*
 * Class:     com.google.devtools.build.lib.unix.NativePosixFiles
 * Method:    stat
 * Signature: (Ljava/lang/String;)Lcom/google/devtools/build/lib/unix/FileStatus;
 * Throws:    java.io.IOException
 */
extern "C" JNIEXPORT jobject JNICALL
Java_com_google_devtools_build_lib_unix_NativePosixFiles_stat(JNIEnv *env,
                                                 jclass clazz,
                                                 jstring path) {
  return StatCommon(env, path, portable_stat, true);
}

/*
 * Class:     com.google.devtools.build.lib.unix.NativePosixFiles
 * Method:    lstat
 * Signature: (Ljava/lang/String;)Lcom/google/devtools/build/lib/unix/FileStatus;
 * Throws:    java.io.IOException
 */
extern "C" JNIEXPORT jobject JNICALL
Java_com_google_devtools_build_lib_unix_NativePosixFiles_lstat(JNIEnv *env,
                                                  jclass clazz,
                                                  jstring path) {
  return StatCommon(env, path, portable_lstat, true);
}

/*
 * Class:     com.google.devtools.build.lib.unix.NativePosixFiles
 * Method:    statNullable
 * Signature: (Ljava/lang/String;)Lcom/google/devtools/build/lib/unix/FileStatus;
 */
extern "C" JNIEXPORT jobject JNICALL
Java_com_google_devtools_build_lib_unix_NativePosixFiles_errnoStat(JNIEnv *env,
                                                      jclass clazz,
                                                      jstring path) {
  return StatCommon(env, path, portable_stat, false);
}

/*
 * Class:     com.google.devtools.build.lib.unix.NativePosixFiles
 * Method:    lstatNullable
 * Signature: (Ljava/lang/String;)Lcom/google/devtools/build/lib/unix/FileStatus;
 */
extern "C" JNIEXPORT jobject JNICALL
Java_com_google_devtools_build_lib_unix_NativePosixFiles_errnoLstat(JNIEnv *env,
                                                       jclass clazz,
                                                       jstring path) {
  return StatCommon(env, path, portable_lstat, false);
}

/*
 * Class:     com.google.devtools.build.lib.unix.NativePosixFiles
 * Method:    utime
 * Signature: (Ljava/lang/String;ZII)V
 * Throws:    java.io.IOException
 */
extern "C" JNIEXPORT void JNICALL
Java_com_google_devtools_build_lib_unix_NativePosixFiles_utime(JNIEnv *env,
                                                  jclass clazz,
                                                  jstring path,
                                                  jboolean now,
                                                  jint modtime) {
  const char *path_chars = GetStringLatin1Chars(env, path);
#ifdef __linux
  struct timespec spec[2] = {{0, UTIME_OMIT}, {modtime, now ? UTIME_NOW : 0}};
  if (::utimensat(AT_FDCWD, path_chars, spec, 0) == -1) {
    PostException(env, errno, path_chars);
  }
#else
  struct utimbuf buf = { modtime, modtime };
  struct utimbuf *bufptr = now ? nullptr : &buf;
  if (::utime(path_chars, bufptr) == -1) {
    // EACCES ENOENT EMULTIHOP ELOOP EINTR
    // ENOTDIR ENOLINK EPERM EROFS   -> IOException
    // EFAULT ENAMETOOLONG           -> RuntimeException
    PostException(env, errno, path_chars);
  }
#endif
  ReleaseStringLatin1Chars(path_chars);
}

/*
 * Class:     com.google.devtools.build.lib.unix.NativePosixFiles
 * Method:    umask
 * Signature: (I)I
 */
extern "C" JNIEXPORT jint JNICALL
Java_com_google_devtools_build_lib_unix_NativePosixFiles_umask(JNIEnv *env,
                                                  jclass clazz,
                                                  jint new_umask) {
  return ::umask(new_umask);
}

/*
 * Class:     com.google.devtools.build.lib.unix.NativePosixFiles
 * Method:    mkdir
 * Signature: (Ljava/lang/String;I)Z
 * Throws:    java.io.IOException
 */
extern "C" JNIEXPORT jboolean JNICALL
Java_com_google_devtools_build_lib_unix_NativePosixFiles_mkdir(JNIEnv *env,
                                                  jclass clazz,
                                                  jstring path,
                                                  jint mode) {
  const char *path_chars = GetStringLatin1Chars(env, path);
  jboolean result = true;
  if (::mkdir(path_chars, mode) == -1) {
    // EACCES ENOENT ELOOP
    // ENOSPC ENOTDIR EPERM EROFS     -> IOException
    // EFAULT ENAMETOOLONG            -> RuntimeException
    // ENOMEM                         -> OutOfMemoryError
    // EEXIST                         -> return false
    if (errno == EEXIST) {
      result = false;
    } else {
      PostException(env, errno, path_chars);
    }
  }
  ReleaseStringLatin1Chars(path_chars);
  return result;
}

/*
 * Class:     com.google.devtools.build.lib.unix.NativePosixFiles
 * Method:    mkdirWritable
 * Signature: (Ljava/lang/String;I)Z
 * Throws:    java.io.IOException
 */
extern "C" JNIEXPORT jboolean JNICALL
Java_com_google_devtools_build_lib_unix_NativePosixFiles_mkdirWritable(
    JNIEnv *env, jclass clazz, jstring path) {
  JStringLatin1Holder path_chars(env, path);

  portable_stat_struct statbuf;
  int r;
  do {
    r = portable_lstat(path_chars, &statbuf);
  } while (r != 0 && errno == EINTR);

  if (r != 0) {
    if (errno != ENOENT) {
      PostException(env, errno, path_chars);
      return false;
    }
    // directory does not exist.
    if (::mkdir(path_chars, 0777) == -1) {
      PostException(env, errno, path_chars);
    }
    return true;
  }
  // path already exists
  if (!S_ISDIR(statbuf.st_mode)) {
    PostException(env, ENOTDIR, path_chars);
    return false;
  }
  // Make sure the mode is correct.
  if ((statbuf.st_mode & 0777) != 0777 && ::chmod(path_chars, 0777) == -1) {
    PostException(env, errno, path_chars);
  }
  return false;
}

/*
 * Class:     com.google.devtools.build.lib.unix.NativePosixFiles
 * Method:    mkdirs
 * Signature: (Ljava/lang/String;I)V
 * Throws:    java.io.IOException
 */
extern "C" JNIEXPORT void JNICALL
Java_com_google_devtools_build_lib_unix_NativePosixFiles_mkdirs(JNIEnv *env,
                                                                jclass clazz,
                                                                jstring path,
                                                                int mode) {
  char *path_chars = GetStringLatin1Chars(env, path);
  portable_stat_struct statbuf;
  int len;
  char *p;

  // First, check if the directory already exists and early-out.
  if (portable_stat(path_chars, &statbuf) == 0) {
    if (!S_ISDIR(statbuf.st_mode)) {
      // Exists but is not a directory.
      PostException(env, ENOTDIR, path_chars);
    }
    goto cleanup;
  } else if (errno != ENOENT) {
    PostException(env, errno, path_chars);
    goto cleanup;
  }

  // Find the first directory that already exists and leave a pointer just past
  // it.
  len = strlen(path_chars);
  p = path_chars + len - 1;
  for (; p > path_chars; --p) {
    if (*p == '/') {
      *p = 0;
      int res = portable_stat(path_chars, &statbuf);
      *p = '/';
      if (res == 0) {
        // Exists and must be a directory, or the initial stat would have failed
        // with ENOTDIR.
        break;
      } else if (errno != ENOENT) {
        PostException(env, errno, path_chars);
        goto cleanup;
      }
    }
  }
  // p now points at the '/' after the last directory that exists.
  // Successively create each directory
  for (const char *end = path_chars + len; p < end; ++p) {
    if (*p == '/') {
      *p = 0;
      int res = ::mkdir(path_chars, mode);
      *p = '/';
      // EEXIST is fine, just means we're racing to create the directory.
      // Note that somebody could have raced to create a file here, but that
      // will get handled by a ENOTDIR by a subsequent mkdir call.
      if (res != 0 && errno != EEXIST) {
        PostException(env, errno, path_chars);
        goto cleanup;
      }
    }
  }
  if (::mkdir(path_chars, mode) != 0) {
    if (errno != EEXIST) {
      PostException(env, errno, path_chars);
      goto cleanup;
    }
    if (portable_stat(path_chars, &statbuf) != 0) {
      PostException(env, errno, path_chars);
      goto cleanup;
    }
    if (!S_ISDIR(statbuf.st_mode)) {
      // Exists but is not a directory.
      PostException(env, ENOTDIR, path_chars);
      goto cleanup;
    }
  }
cleanup:
  ReleaseStringLatin1Chars(path_chars);
}

namespace {
static jobject NewDirents(JNIEnv *env,
                          jobjectArray names,
                          jbyteArray types) {
  return env->NewObject(dirents_class, dirents_ctor, names, types);
}

static char GetDirentType(struct dirent *entry,
                          int dirfd,
                          bool follow_symlinks) {
  switch (entry->d_type) {
    case DT_REG:
      return 'f';
    case DT_DIR:
      return 'd';
    case DT_LNK:
      if (!follow_symlinks) {
        return 's';
      }
      FALLTHROUGH_INTENDED;
    case DT_UNKNOWN:
      portable_stat_struct statbuf;
      if (portable_fstatat(dirfd, entry->d_name, &statbuf, 0) == 0) {
        if (S_ISREG(statbuf.st_mode)) return 'f';
        if (S_ISDIR(statbuf.st_mode)) return 'd';
      }
      // stat failed or returned something weird; fall through
      FALLTHROUGH_INTENDED;
    default:
      return '?';
  }
}
}  // namespace

/*
 * Class:     com.google.devtools.build.lib.unix.NativePosixFiles
 * Method:    readdir
 * Signature: (Ljava/lang/String;Z)Lcom/google/devtools/build/lib/unix/Dirents;
 * Throws:    java.io.IOException
 */
extern "C" JNIEXPORT jobject JNICALL
Java_com_google_devtools_build_lib_unix_NativePosixFiles_readdir(JNIEnv *env,
                                                    jclass clazz,
                                                    jstring path,
                                                    jchar read_types) {
  const char *path_chars = GetStringLatin1Chars(env, path);
  DIR *dirh;
  while ((dirh = ::opendir(path_chars)) == nullptr && errno == EINTR) {
  }
  if (dirh == nullptr) {
    // EACCES EMFILE ENFILE ENOENT ENOTDIR -> IOException
    // ENOMEM                              -> OutOfMemoryError
    PostException(env, errno, path_chars);
  }
  ReleaseStringLatin1Chars(path_chars);
  if (dirh == nullptr) {
    return nullptr;
  }
  int fd = dirfd(dirh);

  std::vector<std::string> entries;
  std::vector<jbyte> types;
  for (;;) {
    // Clear errno beforehand.  Because readdir() is not required to clear it at
    // EOF, this is the only way to reliably distinguish EOF from error.
    errno = 0;
    struct dirent *entry = ::readdir(dirh);
    if (entry == nullptr) {
      if (errno == 0) break;  // EOF
      // It is unclear whether an error can also skip some records.
      // That does not appear to happen with glibc, at least.
      if (errno == EINTR) continue;  // interrupted by a signal
      if (errno == EIO) continue;  // glibc returns this on transient errors
      // Otherwise, this is a real error we should report.
      PostException(env, errno, path_chars);
      ::closedir(dirh);
      return nullptr;
    }
    // Omit . and .. from results.
    if (entry->d_name[0] == '.') {
      if (entry->d_name[1] == '\0') continue;
      if (entry->d_name[1] == '.' && entry->d_name[2] == '\0') continue;
    }
    entries.push_back(entry->d_name);
    if (read_types != 'n') {
      types.push_back(GetDirentType(entry, fd, read_types == 'f'));
    }
  }

  if (::closedir(dirh) < 0 && errno != EINTR) {
    PostException(env, errno, path_chars);
    return nullptr;
  }

  size_t len = entries.size();
  jclass jlStringClass = env->GetObjectClass(path);
  jobjectArray names_obj = env->NewObjectArray(len, jlStringClass, nullptr);
  if (names_obj == nullptr && env->ExceptionOccurred()) {
    return nullptr;  // async exception!
  }

  for (size_t ii = 0; ii < len; ++ii) {
    jstring s = NewStringLatin1(env, entries[ii].c_str());
    if (s == nullptr && env->ExceptionOccurred()) {
      return nullptr;  // async exception!
    }
    env->SetObjectArrayElement(names_obj, ii, s);
  }

  jbyteArray types_obj = nullptr;
  if (read_types != 'n') {
    CHECK(len == types.size());
    types_obj = env->NewByteArray(len);
    CHECK(types_obj);
    if (len > 0) {
      env->SetByteArrayRegion(types_obj, 0, len, &types[0]);
    }
  }

  return NewDirents(env, names_obj, types_obj);
}

/*
 * Class:     com.google.devtools.build.lib.unix.NativePosixFiles
 * Method:    rename
 * Signature: (Ljava/lang/String;Ljava/lang/String;)V
 * Throws:    java.io.IOException
 */
extern "C" JNIEXPORT void JNICALL
Java_com_google_devtools_build_lib_unix_NativePosixFiles_rename(JNIEnv *env,
                                                   jclass clazz,
                                                   jstring oldpath,
                                                   jstring newpath) {
  const char *oldpath_chars = GetStringLatin1Chars(env, oldpath);
  const char *newpath_chars = GetStringLatin1Chars(env, newpath);
  if (::rename(oldpath_chars, newpath_chars) == -1) {
    // EISDIR EXDEV ENOTEMPTY EEXIST EBUSY
    // EINVAL EMLINK ENOTDIR EACCES EPERM
    // ENOENT EROFS ELOOP ENOSPC           -> IOException
    // EFAULT ENAMETOOLONG                 -> RuntimeException
    // ENOMEM                              -> OutOfMemoryError
    std::string filename(std::string(oldpath_chars) + " -> " + newpath_chars);
    PostException(env, errno, filename);
  }
  ReleaseStringLatin1Chars(oldpath_chars);
  ReleaseStringLatin1Chars(newpath_chars);
}

/*
 * Class:     com.google.devtools.build.lib.unix.NativePosixFiles
 * Method:    remove
 * Signature: (Ljava/lang/String;)V
 * Throws:    java.io.IOException
 */
extern "C" JNIEXPORT bool JNICALL
Java_com_google_devtools_build_lib_unix_NativePosixFiles_remove(JNIEnv *env,
                                                   jclass clazz,
                                                   jstring path) {
  const char *path_chars = GetStringLatin1Chars(env, path);
  if (path_chars == nullptr) {
    return false;
  }
  bool ok = remove(path_chars) != -1;
  if (!ok) {
    if (errno != ENOENT && errno != ENOTDIR) {
      PostException(env, errno, path_chars);
    }
  }
  ReleaseStringLatin1Chars(path_chars);
  return ok;
}

/*
 * Class:     com.google.devtools.build.lib.unix.NativePosixFiles
 * Method:    mkfifo
 * Signature: (Ljava/lang/String;I)V
 * Throws:    java.io.IOException
 */
extern "C" JNIEXPORT void JNICALL
Java_com_google_devtools_build_lib_unix_NativePosixFiles_mkfifo(JNIEnv *env,
                                                   jclass clazz,
                                                   jstring path,
                                                   jint mode) {
  const char *path_chars = GetStringLatin1Chars(env, path);
  if (mkfifo(path_chars, mode) == -1) {
    PostException(env, errno, path_chars);
  }
  ReleaseStringLatin1Chars(path_chars);
}

namespace {
// Posts an exception generated by the DeleteTreesBelow algorithm and its helper
// functions.
//
// This is just a convenience wrapper over PostException to format the
// path that caused an error only when necessary, as we keep that path tokenized
// throughout the deletion process.
//
// env is the JNI environment in which to post the exception. error and function
// capture the errno value and the name of the system function that triggered
// it. The faulty path is specified by all the components of dir_path and the
// optional entry subcomponent, which may be NULL.
static void PostDeleteTreesBelowException(
    JNIEnv* env, int error, const char* function,
    const std::vector<std::string>& dir_path, const char* entry) {
  std::vector<std::string>::const_iterator iter = dir_path.begin();
  std::string path;
  if (iter != dir_path.end()) {
    path = *iter;
    while (++iter != dir_path.end()) {
      path += "/";
      path += *iter;
    }
    if (entry != nullptr) {
      path += "/";
      path += entry;
    }
  } else {
    // When scanning the top-level directory given to DeleteTreesBelow, the
    // dir_path buffer is still empty but we have the full path in entry.
    path = entry;
  }
  CHECK(!env->ExceptionOccurred());
  PostException(env, errno, std::string(function) + " (" + path + ")");
}

// Tries to open a directory and, if the first attempt fails, retries after
// granting extra permissions to the directory.
//
// The directory to open is identified by the open descriptor of the parent
// directory (dir_fd) and the subpath to resolve within that directory (entry).
// dir_path contains the path components that were used when opening dir_fd and
// is only used for error reporting purposes.
//
// Returns a directory on success. Returns NULL on error and posts an
// exception.
static DIR* ForceOpendir(JNIEnv* env, const std::vector<std::string>& dir_path,
                         const int dir_fd, const char* entry) {
  static const int flags = O_RDONLY | O_NOFOLLOW | PORTABLE_O_DIRECTORY;
  int fd = openat(dir_fd, entry, flags);
  if (fd == -1) {
    // If dir_fd is a readable but non-executable directory containing entry, we
    // could have obtained entry by readdir()-ing, but any attempt to open or
    // stat the entry would fail with EACCESS. In this case, we need to fix the
    // permissions on dir_fd (which we can do only if it's a "real" file
    // descriptor, not AT_FDCWD used as the starting point of DeleteTreesBelow
    // recursion).
    if (errno == EACCES && dir_fd != AT_FDCWD) {
      if (fchmod(dir_fd, 0700) == -1) {
        PostDeleteTreesBelowException(env, errno, "fchmod", dir_path, nullptr);
        return nullptr;
      }
    }
    if (fchmodat(dir_fd, entry, 0700, 0) == -1) {
      PostDeleteTreesBelowException(env, errno, "fchmodat", dir_path, entry);
      return nullptr;
    }
    fd = openat(dir_fd, entry, flags);
    if (fd == -1) {
      PostDeleteTreesBelowException(env, errno, "opendir", dir_path, entry);
      return nullptr;
    }
  }
  DIR* dir = fdopendir(fd);
  if (dir == nullptr) {
    PostDeleteTreesBelowException(env, errno, "fdopendir", dir_path, entry);
    close(fd);
    return nullptr;
  }
  return dir;
}

// Tries to delete a file within a directory and, if the first attempt fails,
// retries after granting extra write permissions to the directory.
//
// The file to delete is identified by the open descriptor of the parent
// directory (dir_fd) and the subpath to resolve within that directory (entry).
// dir_path contains the path components that were used when opening dir_fd and
// is only used for error reporting purposes.
//
// is_dir indicates whether the entry to delete is a directory or not.
//
// Returns 0 on success. Returns -1 on error and posts an exception.
static int ForceDelete(JNIEnv* env, const std::vector<std::string>& dir_path,
                       const int dir_fd, const char* entry,
                       const bool is_dir) {
  const int flags = is_dir ? AT_REMOVEDIR : 0;
  if (unlinkat(dir_fd, entry, flags) == -1) {
    if (fchmod(dir_fd, 0700) == -1) {
      PostDeleteTreesBelowException(env, errno, "fchmod", dir_path, nullptr);
      return -1;
    }
    if (unlinkat(dir_fd, entry, flags) == -1) {
      PostDeleteTreesBelowException(env, errno, "unlinkat", dir_path, entry);
      return -1;
    }
  }
  return 0;
}

// Returns true if the given directory entry represents a subdirectory of dir.
//
// The file to check is identified by the open descriptor of the parent
// directory (dir_fd) and the directory entry within that directory (de).
// dir_path contains the path components that were used when opening dir_fd and
// is only used for error reporting purposes.
//
// This function prefers to extract the type information from the directory
// entry itself if available. If not available, issues a stat starting from
// dir_fd.
//
// Returns 0 on success and updates is_dir accordingly. Returns -1 on error and
// posts an exception.
static int IsSubdir(JNIEnv* env, const std::vector<std::string>& dir_path,
                    const int dir_fd, const struct dirent* de, bool* is_dir) {
  switch (de->d_type) {
    case DT_DIR:
      *is_dir = true;
      return 0;

    case DT_UNKNOWN: {
      struct stat st;
      if (fstatat(dir_fd, de->d_name, &st, AT_SYMLINK_NOFOLLOW) == -1) {
        PostDeleteTreesBelowException(env, errno, "fstatat", dir_path,
                                      de->d_name);
        return -1;
      }
      *is_dir = st.st_mode & S_IFDIR;
      return 0;
    }

    default:
      *is_dir = false;
      return 0;
  }
}

// Recursively deletes all trees under the given path.
//
// The directory to delete is identified by the open descriptor of the parent
// directory (dir_fd) and the subpath to resolve within that directory (entry).
// dir_path contains the path components that were used when opening dir_fd and
// is only used for error reporting purposes.
//
// dir_path is an in/out parameter updated with the path to the directory being
// processed. This avoids the need to construct unnecessary intermediate paths,
// as this algorithm works purely on file descriptors: the paths are only used
// for error reporting purposes, and therefore are only formatted at that
// point.
//
// Returns 0 on success. Returns -1 on error and posts an exception.
static int DeleteTreesBelow(JNIEnv* env, std::vector<std::string>* dir_path,
                            const int dir_fd, const char* entry) {
  DIR *dir = ForceOpendir(env, *dir_path, dir_fd, entry);
  if (dir == nullptr) {
    CHECK(env->ExceptionOccurred() != nullptr);
    return -1;
  }

  dir_path->push_back(entry);
  // On macOS and some other non-Linux OSes, on some filesystems, readdir(dir)
  // may return NULL after an entry in dir is deleted even if not all files have
  // been read yet - see https://support.apple.com/kb/TA21420; we thus read all
  // the names of dir's entries before deleting. We don't want to simply use
  // fts(3) because we want to be able to chmod at any point in the directory
  // hierarchy to retry a filesystem operation after hitting an EACCES.
  std::vector<std::string> dir_files, dir_subdirs;
  for (;;) {
    errno = 0;
    struct dirent* de = readdir(dir);
    if (de == nullptr) {
      if (errno != 0) {
        PostDeleteTreesBelowException(env, errno, "readdir", *dir_path,
                                      nullptr);
      }
      break;
    }

    if (strcmp(de->d_name, ".") == 0 || strcmp(de->d_name, "..") == 0) {
      continue;
    }

    bool is_dir;
    if (IsSubdir(env, *dir_path, dirfd(dir), de, &is_dir) == -1) {
      CHECK(env->ExceptionOccurred() != nullptr);
      break;
    }
    if (is_dir) {
      dir_subdirs.push_back(de->d_name);
    } else {
      dir_files.push_back(de->d_name);
    }
  }
  if (env->ExceptionOccurred() == nullptr) {
    for (const auto &file : dir_files) {
      if (ForceDelete(env, *dir_path, dirfd(dir), file.c_str(), false) == -1) {
        CHECK(env->ExceptionOccurred() != nullptr);
        break;
      }
    }
    // DeleteTreesBelow is recursive; don't hold on to file names unnecessarily.
    dir_files.clear();
  }
  if (env->ExceptionOccurred() == nullptr) {
    for (const auto &subdir : dir_subdirs) {
      if (DeleteTreesBelow(env, dir_path, dirfd(dir), subdir.c_str()) == -1) {
        CHECK(env->ExceptionOccurred() != nullptr);
        break;
      }
      if (ForceDelete(env, *dir_path, dirfd(dir), subdir.c_str(), true) == -1) {
        CHECK(env->ExceptionOccurred() != nullptr);
        break;
      }
    }
  }
  if (closedir(dir) == -1) {
    // Prefer reporting the error encountered while processing entries,
    // not the (unlikely) error on close.
    if (env->ExceptionOccurred() == nullptr) {
      PostDeleteTreesBelowException(env, errno, "closedir", *dir_path, nullptr);
    }
  }
  dir_path->pop_back();
  return env->ExceptionOccurred() == nullptr ? 0 : -1;
}
}  // namespace

/*
 * Class:     com.google.devtools.build.lib.unix.NativePosixFiles
 * Method:    deleteTreesBelow
 * Signature: (Ljava/lang/String;)V
 * Throws:    java.io.IOException
 */
extern "C" JNIEXPORT void JNICALL
Java_com_google_devtools_build_lib_unix_NativePosixFiles_deleteTreesBelow(
    JNIEnv *env, jclass clazz, jstring path) {
  const char *path_chars = GetStringLatin1Chars(env, path);
  std::vector<std::string> dir_path;
  if (DeleteTreesBelow(env, &dir_path, AT_FDCWD, path_chars) == -1) {
    CHECK(env->ExceptionOccurred() != nullptr);
  }
  CHECK(dir_path.empty());
  ReleaseStringLatin1Chars(path_chars);
}

////////////////////////////////////////////////////////////////////////
// Linux extended file attributes

namespace {
typedef ssize_t getxattr_func(const char *path, const char *name,
                              void *value, size_t size, bool *attr_not_found);

static jbyteArray getxattr_common(JNIEnv *env,
                                  jstring path,
                                  jstring name,
                                  getxattr_func getxattr) {
  const char *path_chars = GetStringLatin1Chars(env, path);
  const char *name_chars = GetStringLatin1Chars(env, name);

  // TODO(bazel-team): on ERANGE, try again with larger buffer.
  jbyte value[4096];
  jbyteArray result = nullptr;
  bool attr_not_found = false;
  ssize_t size = getxattr(path_chars, name_chars, value, arraysize(value),
                          &attr_not_found);
  if (size == -1) {
    if (!attr_not_found) {
      PostException(env, errno, path_chars);
    }
  } else {
    result = env->NewByteArray(size);
    // Result may be NULL if allocation failed. In that case, we'll return the
    // NULL and an OOME will be thrown when we are back in Java.
    if (result != nullptr) {
      env->SetByteArrayRegion(result, 0, size, value);
    }
  }
  ReleaseStringLatin1Chars(path_chars);
  ReleaseStringLatin1Chars(name_chars);
  return result;
}
}  // namespace

extern "C" JNIEXPORT jbyteArray JNICALL
Java_com_google_devtools_build_lib_unix_NativePosixFiles_getxattr(JNIEnv *env,
                                                     jclass clazz,
                                                     jstring path,
                                                     jstring name) {
  return getxattr_common(env, path, name, portable_getxattr);
}

extern "C" JNIEXPORT jbyteArray JNICALL
Java_com_google_devtools_build_lib_unix_NativePosixFiles_lgetxattr(JNIEnv *env,
                                                      jclass clazz,
                                                      jstring path,
                                                      jstring name) {
  return getxattr_common(env, path, name, portable_lgetxattr);
}

extern "C" JNIEXPORT jint JNICALL
Java_com_google_devtools_build_lib_unix_NativePosixFiles_openWrite(
    JNIEnv *env, jclass clazz, jstring path, jboolean append) {
  const char *path_chars = GetStringLatin1Chars(env, path);
  int flags = (O_WRONLY | O_CREAT) | (append ? O_APPEND : O_TRUNC);
  int fd;
  while ((fd = open(path_chars, flags, 0666)) == -1 && errno == EINTR) {
  }
  if (fd == -1) {
    PostException(env, errno, path_chars);
  }
  ReleaseStringLatin1Chars(path_chars);
  return fd;
}

extern "C" JNIEXPORT void JNICALL
Java_com_google_devtools_build_lib_unix_NativePosixFiles_close(JNIEnv *env,
                                                               jclass clazz,
                                                               jint fd,
                                                               jobject ingore) {
  if (close(fd) == -1) {
    PostException(env, errno, "close");
  }
}

extern "C" JNIEXPORT void JNICALL
Java_com_google_devtools_build_lib_unix_NativePosixFiles_write(
    JNIEnv *env, jclass clazz, jint fd, jbyteArray data, jint off, jint len) {
  int data_len = env->GetArrayLength(data);
  if (off < 0 || len < 0 || off > data_len || data_len - off < len) {
    jclass oob = env->FindClass("java/lang/IndexOutOfBoundsException");
    if (oob != nullptr) {
      env->ThrowNew(oob, nullptr);
    }
    return;
  }
  jbyte *buf = static_cast<jbyte *>(malloc(len));
  if (buf == nullptr) {
    PostException(env, ENOMEM, "write");
    return;
  }
  env->GetByteArrayRegion(data, off, len, buf);
  // GetByteArrayRegion may raise ArrayIndexOutOfBoundsException if one of the
  // indexes in the region is not valid. As we obtain the inidices from the
  // caller, we have to check.
  if (!env->ExceptionOccurred()) {
    jbyte *p = buf;
    while (len > 0) {
      ssize_t res = write(fd, p, len);
      if (res == -1) {
        if (errno != EINTR) {
          PostException(env, errno, "write");
          break;
        }
      } else {
        p += res;
        len -= res;
      }
    }
  }
  free(buf);
}

extern "C" JNIEXPORT jlong JNICALL
Java_com_google_devtools_build_lib_unix_NativePosixSystem_sysctlbynameGetLong(
    JNIEnv *env, jclass clazz, jstring name) {
  const char *name_chars = GetStringLatin1Chars(env, name);
  int64_t r;
  size_t len = sizeof(r);
  if (portable_sysctlbyname(name_chars, &r, &len) == -1) {
    PostException(env, errno, std::string("sysctlbyname(") + name_chars + ")");
  }
  ReleaseStringLatin1Chars(name_chars);
  return (jlong)r;
}

/*
 * Class:     com_google_devtools_build_lib_platform_SleepPreventionModule_SleepPrevention
 * Method:    pushDisableSleep
 * Signature: ()I
 */
extern "C" JNIEXPORT jint JNICALL
Java_com_google_devtools_build_lib_platform_SleepPreventionModule_00024SleepPrevention_pushDisableSleep(
    JNIEnv *, jclass) {
  return portable_push_disable_sleep();
}

/*
 * Class:     com_google_devtools_build_lib_platform_SleepPreventionModule_SleepPrevention
 * Method:    popDisableSleep
 * Signature: ()I
 */
extern "C" JNIEXPORT jint JNICALL
Java_com_google_devtools_build_lib_platform_SleepPreventionModule_00024SleepPrevention_popDisableSleep(
    JNIEnv *, jclass) {
  return portable_pop_disable_sleep();
}

/*
 * Class:     com_google_devtools_build_lib_platform_SuspendCounter
 * Method:    suspendCountJNI
 * Signature: ()I
 */
extern "C" JNIEXPORT jint JNICALL
Java_com_google_devtools_build_lib_platform_SuspendCounter_suspendCountJNI(
    JNIEnv *, jclass) {
  return portable_suspend_count();
}

/*
 * Class:     Java_com_google_devtools_build_lib_platform_MemoryPressureCounter
 * Method:    warningCountJNI
 * Signature: ()I
 */
extern "C" JNIEXPORT jint JNICALL
Java_com_google_devtools_build_lib_platform_MemoryPressureCounter_warningCountJNI(
    JNIEnv *, jclass) {
  return portable_memory_pressure_warning_count();
}

/*
 * Class:     Java_com_google_devtools_build_lib_platform_MemoryPressure
 * Method:    criticalCountJNI
 * Signature: ()I
 */
extern "C" JNIEXPORT jint JNICALL
Java_com_google_devtools_build_lib_platform_MemoryPressureCounter_criticalCountJNI(
    JNIEnv *, jclass) {
  return portable_memory_pressure_critical_count();
}

}  // namespace blaze_jni

redpajama_set_name: RedPajamaGithub


You're ready for the next step. This class is for continuing beginners, or students with prior knowledge of Spanish, wanting to continue in their studies. Emphasis is on everyday social conversation using a more sophisticated vocabulary. English is spoken to support learning.


For almost 18 years, YouthWorks has engaged with young people on the margins. By building strong relationships, we help youth realize their full potential through job training + placement, education, and wraparound community supports.
Your support – financial and/or volunteer – helps youth get and stay connected. We offer seven programs, including the nationally-recognized YouthBuild initiative, land conservation and home weatherization programs, GED attainment, home health, screen printing, and our top notch culinary arts apprenticeship.
To find out how you can help us make a difference in a young person's life, reach out on instagram, facebook, twitter, or email. We'd love to have you on our team.
And, hey, if you're riding in this year's Century Ride on May 19th, why not make it a fundraiser for YouthWorks?
Meet Carmen, the "godfather" of the YouthWorks culinary arts program.
YouthWorks awarded $1.1 million grant for youth job training program.
KSFR says YouthWorks builds community from the ground up.
Ride for a Reason at the Santa Fe Century to support YouthWorks.


Several combat veterans suffering from post-traumatic stress disorder were denied access to a Veterans Affairs outpatient clinic in Viera because their service dogs apparently didn't have the proper paperwork.
The vets were rebuffed by security officers. But when they refused to leave the situation nearly spiraled out of control.
Rory Dobis, founder of Paws 4 Boots, told Watchdog.org that he was attempting to assist several veterans in acclimating their dogs to the VA facility where they regularly come to receive physical and mental health treatment.
Post by Paws 4 Boots.
"I was trying to take one or two of my service dogs inside and make sure they were behaving properly so that my veterans would know that it's OK," he said.
Dobis, who also suffers from PTSD and is a former U.S. Army military police dog trainer, said he takes his dog in all the time.
When he was rebuffed — even after asserting what he said are his rights under the American Disabilities Act — a confrontation ensued. The longer he stayed, the more security personnel arrived.
"I felt scared so I did the one thing that I knew would protect us. I took out my cell phone and I started recording, and that's when they got real quiet," he said.
Watchdog.org contacted the facility but was told they don't speak to the media.
A public information officer from the Orlando VA Medical Center told Watchdog.org that Dobis was trying to bring in "companion" dogs and train them.
"Companion animals don't meet the qualifications of service animals so they're not allowed in our facilities by federal law," Mike Strickler, a 24-year Air Force veteran said.
When asked why the administration deployed security rather than mental health counselors to assist the disabled veterans, the official said they didn't ask, a point Dobis disputes.
"He came to make a scene," Strickler said. "If they would've had an appointment then they could have come in and brought their service animals if they were properly trained and licensed.
"We have veterans that might not react well to dogs," said Strickler.
Dobis eventually left after a Broward County Sheriff's deputy arrived and told him to leave the scene.
The VA is facing a larger public relations disaster as a result of allegations of "wait lists" and widespread institutional corruption that may have led to 40 unnecessary patient deaths.


Upon receipt of a booking request, we will send out confirmation of dates required, and any special requirements that may have been requested, along with any additional costs. This is usually within 5 working days.
A deposit of £150 (UK) or $250 (US), is required within 7 days to confirm your booking. This deposit will be used as your Security Deposit. Bookings are only confirmed upon deposit being received and cleared by the banks. All payments should be paid into our bank, either in America or the United Kingdom (unless other special arrangements are made). If this is not possible, you can pay through PayPal.
PayPal accepts payment by credit card, or bank draft, at no charge to you! We charge no extra or hidden fees to provide you with the convenience of electronic payment. You need not be a member of the PayPal network to take advantage of this secure and convenient service.
The remainder of monies is required 6 weeks prior to the arrival date, or before. Upon receipt of final payment and clearance, we will send you all the relevant information. This includes directions to the Management Company, where you will be able to check in and receive your keys and directions to Emerald Island. For stays of 5 nights or less, a cleaning charge of $75 (US Dollars) / £50 (UK Pounds) will be added to the total. Special offers must be paid for, in full at the time of booking (see special offers below).
There may be times that we will have special offers on our website. This will be to fill un-booked weeks, or to fill a cancellation. We will require full payment for special offers at the time of booking, to cover the rental and taxes in advance, and to confirm the discounted rates.
Rentals for 15 nights or more earn a 10% discount off the weekly rate. Rentals for 30 nights or more earn a 15% discount off the weekly rate.
We are registered with the Osceola Country Hotels Commission. This is to ensure that our home is both safe and in a good order for our rental guests to enjoy.
We do not charge a security deposit, however our management company will take a swipe of your credit card when you collect the keys. If in the unlikely event that damage or theft has taken place to the property your card will be charged accordingly.
The management company reserve the right to retain, either in part or full, an amount needed to correct any damage, or non-return of keys. We will provide receipts for any repairs/replacements needed. In the unlikely event that such damage is not covered by your card, we reserve the right to pursue our guests for all monies required to make any replacements or repairs needed to our vacation home.
All children must be supervised at all times especially when using the swimming pool, diving is not permitted into any part of the swimming pool, glassware should not be taken into the swimming pool or into the swimming pool area, plastic items are provided for use in the swimming pool area.
The duration of your booking is the number of nights as stated on our confirmation. The home cannot be entered before 4.00 pm on arrival date stated (check-in), and must be cleared before, or at the latest, 11.00 am on departure date (check-out) stated on the contract.
The owners cannot accept, be responsible for or be liable in respect of loss, damage or changes caused by FORCE MAJEURE (e.g. Strikes, floods, airport closure, adverse weather conditions, war, riots, terrorist activity, fire natural or nuclear disasters).
No smoking or pets are permitted inside the home.
In the event that you need to cancel the booking with awesomefloridahomes.com, the deposit is refundable, subject to the following: If you cancel the booking up to 12 weeks prior to the arrival date, then we will refund your deposit, less 10% of the total booking value for administrative charges etc. If you cancel after the 12 week prior date then, regrettably, we will retain the whole of your deposit, to offset the discount that we will have to apply in order to obtain a re-booking to the home.
Guests who fail to pay their final rental by the due date (6 weeks prior to arrival date) may lose their booking, and their deposits. awesomefloridahomes.com sends out reminders to all guests for the final payment approximately 2 weeks prior to the due date. If we do not receive the payment, we will endeavour to contact you, however, if we receive no communication or payment, we will cancel the booking and retain the full deposit. If you have problem, please call us, as we may be able to help you.
If guests have to cancel the booking, after final payment has been made, then unfortunately the total rental charge will be forfeited, unless another booking can be taken in place to fill the slot. If this is the case, a maximum of 75% will be refunded. This will depend upon the rates obtained for the new booking. The security deposit will be refunded in full.
We recommend that all guests take out holiday injury and cancellation cover with a reputable insurance company.
awesomefloridahomes.com accept no liability for personal loss or injury to guests whilst at the vacation home. All guests should ensure that they have adequate holiday insurance cover. We recommend that children be supervised at all times in, or around, the home and pool.
When collecting the keys, from the Management Company's office, you will need to sign a booking form. This form confirms that the "rental guest" agrees to be bound by the awesomefloridahomes.com Terms & Conditions of Trading.
All guests undertake to behave with propriety and in such manner as in no way to cause, or be likely to cause, damage, distress, danger or annoyance to other guests, property and/or any third party. The contract of any guest in breach of this clause will be terminated and neither we, nor the providers of the services in question, will have any further contractual obligations to you.


Essential amino acid for hepatic, urinary and cardiovascular protection.
It is an essential amino acid because it can not be produced in the body and thus it can only be obtained exclusively by external intake.
This amino acid is a precursor to the amino acids cysteine and cystine. It was first isolated by John Howard Mueller in 1921.
Hepatic protection: it reduces the accumulation of heavy metals; it lowers cholesterol and triglycerides levels; alongside choline and inositol, this essential amino acid reduces the accumulation and fat deposits in the liver due to the lipotropic effect; it converts estradiol into the nontoxic form called estriol (it protects the liver during the estrogen metabolism).
Improving energy metabolism of the muscle cell that stimulates the production of creatine.
Digestive problems account for nearly 10 percent of all healthcare spending and a least 70 million Americans suffer from some sort of digestive illness. this amino acid is important in gut health.
From 2013- 2015, an estimated 54.4 million people in the United States have suffered from some form of arthritis. Consuming supplement with this amino acid improves the structure and mobility of joints.
This amino acid provides the body sulfur and other substances necessary for a proper development. Sulfur is a very important element, whose lack leads to the body's inability to produce certain antioxidants.
It is vital for the transportation and absorption of zinc and selenium in the body. These two essential minerals act just line an antioxidant within the body, slowing the aging process and fighting free-radical damage.
Cardiovascular disease accounts for nearly 801,000 deaths every year in the United States. That's about 1 of every 3 deaths. This amino acid provides cardiovascular protection by reducing fat levels in the bloodstream and atheroma plaque formation.
Higher levels of this amino acid in the daily diet is strongly connected with a lowering in pancreatic cancer risk.
Urinary tract protection: it prevents adherence of bacteria to the bladder wall and their proliferation; it reduces the occurrence and formation of kidney stones.
As many as 1 million people in the United States live with Parkinson's disease, that is more than the combined number of patients diagnosed with muscular dystrophy, multiple sclerosis, and Lou Gehrig's disease. According to research, consuming foods high in this amino acid helps in treating and reducing the symptoms of Parkinson's disease.
Maintaining the structure of hair, skin, and nails: it stimulates collagen production.
In 2015, 39,513 individuals were diagnosed with HIV infection in the US. This amino acid may help in HIV/AIDS treatments.
Some individuals with a deficiency in this amino acid may experience the following symptoms – problems with skin integrity, coordination and muscle strength, and detoxification of the liver.
An adult should intake approximately 19 mg of this amino acid/ kilo of body weight every day.
However, special circumstances and conditions may lead to a much higher requirement.
Large amounts of this amino acid can be found in: eggs, sesame, meat, wheat, wheat bran, oats, oat bran, millet, hazelnuts, pecans, peanuts, almonds, pumpkin seeds, chia seeds, sesame seeds, flax seeds, pine seeds, watermelon seeds, sunflower seeds vegetables, fruits (apples, mangoes, papayas, pineapples) and legumes (peas, red kidney beans, navy beans, adzuki beans, mung beans, lentils, soybeans, chickpeas).
High consumption of this amino acid is not recommended due to its serious side effects. There are not sufficient studies regarding the using of these type of supplements if you are pregnant or breastfeeding, therefore, it is recommended to avoid them. In addition, if you have severe liver disease, do not ingest supplements containing this amino acid.
Therefore, try not to consume supplements containing this amino acid and to obtain it only from food.


1. Both normal and memory wizards are used.
2. Normal Wizard created by single .py file, which is created in wizard folder of our module.
3. To call normal wizard we need following code in .xml file which is outside the wizard folder.
4. To call memory wizard we need following code in .xml file which is outside the wizard folder. If we call wizard on button.
1. Only memory wizards are used.
2. Wizard in V6 is similar to memory wizard in V5.
3. To call wizard we need following code in .xml file which is outside the wizard folder. If we call wizard on button.
1. The only facility of search is there in list view(treeview).
Order of group-by entries matters!
1. Normal Tree view is there.
2. We can edit data in columns in tree view, but no buttons are theire to process on selected row.
1. No diagram view is theire.
1. No such Testing framework(.YAML) file used in it.
3. class for res.partner.function object is present.
2. so solution for this problem is that do not define function start with _(underscore).
10. class for res.partner.function object is not not V6 replace by char field.


You will be able to receive notifications from the organizer when you follow them.
You can follow the orgazier through "Organizer page", "Event page", "My Tickets page", and "Recommend Organizer's page".
Click "Follow" button to add following organizer.
Click the "Follow" button in your My Tickets page and follow the organizer.
Recommended Organizer will be shown by clicking the Recommend Organizer tab in Follow list page.
Click the" Follow "button shown on the page to follow.
Organizers you follow will be listed on "Following organizers" in "Follow List".
To unfollow the organizer, hover the mouse over to the "Following" button of the organizer who is following and the button will change to "Remove follow", then click the button.
Please check if it is removed from "Follwing list" as well.


"Truth be Told" was held 14 to 17 September 2016, hosted by Christians for Biblical Equality (CBE) in partnership with Gender Equality Matters, and Rhema Bible Church.
The conference focused on the link between gender based violence and misapplied biblical teachings, where the consistent message of liberation and equality for women alongside men is overwhelmed by patriarchal values that are brought to biblical interpretation.
Following the "Truth be Told" conference, CBE joined its partner Ekklesia Foundation for Gender Education, for the "Truth be Told-Kenya"conference in Kenya, held 21 to 23 September.


text:
Q: What is the difference between these two ways of allocating memory in Objective-C? I am confused about the proper means of allocating memory in Objective-C.  Suppose I have an NSMutableDictionary.  There are two ways I can initialize it:
   NSMutableDictionary *alpha = [[NSMutableDictionary alloc] init];

or
   NSMutableDictionary *alpha = [NSMutableDictionary dictionary];

What is the difference between them?  I know the first allocates memory for alpha, but what about the second?
Which of these is recommended as the best practice for allocating memory?

A: [NSMutableDictionary dictionary];

is exactly the same thing as:
[[[NSMutableDictionary alloc] init] autorelease];

It just saves you some typing. It doesn't matter which one you use, as long as you know the difference between a retained object and an autoreleased one. If you're using ARC, then you don't even need to know that.
The convention is:

*

*If you see init, new or copy: it's a retained object.

*If the method name starts with the class name (sans the framework prefix), it's an autoreleased object.

A: [NSMutableDictionary dictionary] is a class method on the NSMutableDictionary class. It contains the calls to alloc and init, just as you would do them manually. Due to this being a very commonly used class, its author included this so called "factory method" to make life easier for users of his/her class.
See http://en.wikipedia.org/wiki/Factory_method_pattern for more details on this pattern.
As for which is good practice, IMHO you should use the factory method. It makes your own code more readable and saves you typing. Moreover - although I am not sure if this is the case with NSMutableDictionary - using the factory method makes maintenance easier for both its developers and yourself, because they are e. g. free to change the concrete subclass implementation you will receive from the factory, without having you change your application code.
As correctly pointed out it the comments, factory methods like this return autoreleased instances of objects, so if you only use them locally in a method, there is no need to worry about them from a memory management point of view. For more details on memory management, autorelease and the new ARC runtime with automatic reference counting, you should deep dive into Apple's documentation on the topic, if you haven't already.

A: Both line will allocate memory for alpha, difference is that second alpha is autorelease object.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to use the current user as a method argument in QuerySet property
*

*I have Events

*A user can subscribe to an Event

*In views I have a list of Events

*In the list template I would like have something like event.allready_subscribed available. So that the current user can see that he/she has already subscribed.

I can't do this in a model method, because I don't have the request.user available.

A: Thanks for your comments.
my_events = EventRegistration.objects.filter(user=request.user.id).values_list('event_id', flat=True)

events = Event.objects.all().annotate(allready_registered=models.Case(models.When(pk__in=my_events, then=models.Value(True)), default=models.Value(False), output_field=models.BooleanField()))


text:
BACHRACH RE-IMAGINED: Pop Hits of the 60s & 70s Take on Deeper Meaning as Millennials ask "What's It All About?"
Advertising Contract Terms and Conditions
Digital and Print Display
Submission Opportunities and Guidelines
Media Sponsorship Agreement
by Millennium Magazine
By Lori Simmons Zelenko
Rock-star sexy Kyle Riabko re-imagines some of our favorite songs – "The Look of Love" and "Do You Know The Way To San Jose" or "Close to You" and the saucy "What's New Pussycat?" – as a relevant voice for generations then and now. These top 40 hits by Burt Bachrach a composer whose pop culture icon status is re-imagined here, are stripped of their glossy façade, pared down with a soundtrack of mostly guitars and drums, for the Off -Broadway revue "What's It All About? Bachrach Re-Imagined."
Letting the songs' unique musicality speak for itself "What's It All About?" becomes a dialog about love and its disappointments, about life and relationships once full of promise now full of doubt, shared through the soundtrack of Burt Bachrach's music whose hits – chart-toppers and Oscar winners – each and every one memorable, hummable favorites are revealed here with new emotion. These pop tunes come across as almost a narrative reflecting the changing times of the late 60s into the 70s as modern love evolved and traditional romance took a back seat. But the message and the music remains current and on target. It's no wonder Burt Bachrach is celebrated as one of the world's greatest composers.
This is not a traditional revue where songs are performed continuously as a whole, rather fragments of favorite tunes form a refrain – a chorus heard intermittently, teasing us with hints of "Alfie" and "Raindrops Keep Falling On My Head" – leaving us hungry for the whole song and so satisfied when it finally arrives. These songs of love sought and love lost, poignant some and others buoyant, are performed by a youthful, vibrant cast led by 20-something Riabko and set against a background of well-worn sofas, tattered rugs and a mountain of guitars – a college dorm room re-imagined. Laid bare so to speak – without horns and string sections to elaborate – the songs, no longer shiny pop anthems take on a fresh, authentic nature as they become about our
search for a real connection – and our need to understand why it's so elusive.
"What's It All About – Bachrach Re-Imagined" is at The New York Theater Workshop, 79 East Fourth Street, East Village, (212) 279-4200, nytw.org. Through Feb. 2, 2014
Cover Story: Christina Milian
The Mohegan Sun Winefest 2014 'Pours It On'
Millennium Magazine January 20, 2014
7|8|19
Product Reviews, Technology
Modern-Day Hatchback Versus Sedan
Home Decor, Real Estate
Study: The Most Popular Interior Design Style in Every State
American Drone Company, Skyfish, Emerges from Stealth Mode
RED Chocolate: Guiltless Indulgence
5 Best Tips to a Memorable Road Trip
Tweets by MillenniumMag
Copyright © 2018 Millennium Magazine - All rights Reserved. Managed by Charlemagne Web Designs
Get More Millennium
Join our subscribers who get content directly to their inbox.

redpajama_set_name: RedPajamaCommonCrawl


text:
///////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright 2002 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
// DESCRIPTION:
//
// Faces and edges have a color attribute.
//
// The modeler calls the defaultColor() function anytime it needs to obtain
// the current color value. This is the only interface of the modeler to the
// "color subsystem." Otherwise, the color is irrelevant to the modeler.
//
///////////////////////////////////////////////////////////////////////////////

#include "global.h"

AMODELER_NAMESPACE_BEGIN

enum Color { kColor1            = 1,
             kColor2            = 2,
             kColor3            = 3,
             kColor4            = 4,    // Feel free to invent more colors
             kColorInvisible    = -1 };

DllImpExp extern Color gDefaultColor;

inline Color defaultColor   ()         { return gDefaultColor; }
inline void  setDefaultColor(Color co) { gDefaultColor = co;   }

AMODELER_NAMESPACE_END
#endif


You're probably aware of the world's ongoing mummy crisis. These desiccated bodies were once the honored dead of ancient Egypt, specially prepared for journey into the lands beyond death. But then unscrupulous grave robbers raided their tombs and stole them away to museums around the world.
So today these ancient beings awaken from their millennial slumbers and enact grisly revenge on the European ghouls who defiled their tombs. While often slow and lumbering, their crushing grip and embalming expertise (see below) make short work of their fleshy victims.
You might well attribute a mummy's return to sorcery, but its means of resurrection can be found in real-world biology: anhydrobiosis (literally "life without water"), a state of suspended animation in a dry, ametabolic condition. In other words, the specimen survives without water and without undergoing metamorphosis for an extended period of time.
So-called resurrection plants such as Selaginella lepidophylla are especially good at the anhydrobiosis, entering a dry, dormant state between rains that may last years. Elsewhere in the plant kingdom, lotus seeds have germinated successfully after 1,000 years in the dust.
As far as animals go, a number of extremophile organisms also undergo anhydrobiosis. Yet aside from the mummy itself, the only multicellular animals known to bounce back from the dry reaches are rotifers, nematode worms and tardigrades (waterbears). These creatures can undergo anhydrobiosis at any state of their development, while other animals such as brine shrimp (AKA sea monkeys) can survive as dried-out eggs for 15 years.
Any plant or animal can dry the hell out, but how do these specimens bounce back without sustaining desiccation damage? Some organisms produce the sugar trehalose or sucrose to protect cells, while others utilize highly hydrophilic LEA proteins. Scientists continue to study these amazing organisms for clues to the secret of life without water.
Is anyrdrobiosis possible with human beings? The example presented by our shambling mummies seems to suggest so. But if the ancient Egyptians developed a means of protecting our complex biology from desiccation damage, they certainly didn't share the secret. Yet researchers from the University of Campinas in Brazil believe anhydrobiosis might offer unique strategies in the future for the preservation of vaccines, tissue and even donor organs.
As for the mummies that roam or streets and forcibly remove our brains with a coat-hanger? We can only assume that atmospheric moisture raises them from their slumber in search of life-giving water and delicious BCE-style vengeance.
Monster of the Week is a - you guessed it - regular look at the denizens is of our monster-haunted world. Sometimes we'll focus on the cultural aspects, but mostly we'll look at the possible science behind a creature of myth, movie or legend. Be sure to explore the Monster Gallery as well as the Monster Science video series.


text:
Q: g++ include paths on freebsd I installed gcc49 on FreeBSD10.1. I am trying to use it for C++11 development. However, every time I'm compiling some C++11 valid code (yes I use -std=c++11) that uses specific math functions, it spits out errors, such as
error: std::round is not a member of std
/usr/include/math.h

For example, here:
#include <cmath>
#include <iostream>

int main()
{
    std::cout << std::round(10.1) << std::endl;
}

So it seems it tries to use the old include files that came with FreeBSD, and not the ones corresponding to the new gcc from /usr/local/lib/gcc49/include
I tried setting CPLUS_INCLUDE_PATH to /usr/local/lib/gcc49/include with no luck, the system still tries to search /usr/include instead.
I saw that this may be a bug in FreeBSD g++,
Getting GCC in C++11 mode to work on FreeBSD
however even using the -D_GLIBCXX_USE_C99 as suggested in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=194929
doesn't fix the problem for math functions.
The weirdest thing is that I can compile any other C++11 functions not from <cmath>, like std::stol, but have to use the -D_GLIBCXX_USE_C99 flag as mentioned in the bug report above.
Any idea how to make g++ fully functional with C++11 on FreeBSD 10.1?

A: It works out of box on 10.1, you shouldn't need any hacks. Of course, it only works with -std=c++11, as std::round is only available since 11 standard (see http://en.cppreference.com/w/cpp/numeric/math/round).
$ freebsd-version -ku
10.1-RELEASE
10.1-RELEASE
$ cat test.cc
#include <cmath>
#include <iostream>

int main() {
    std::cout << std::round(10.1) << std::endl;
}
$ g++5 -std=c++11 -o test test.cc
$ ./test
10

Note: gcc was compiled from ports, package was reported to not work. Probably because packages for 10.1 are at the time of writing compiled on 10.0, which still had c++11 compatibility issues.


AirAsia CEO Mittu Chandilya had in a fresh discussion said it will offer fares 30%-35% lower than the average fares of its rivals.
In his interview, Chandilya had said the first flight would "maybe" be out of Chennai but that may change.
AirAsia India will most likely fly to all metros but exclude Mumbai.
"Our network isn't finalized yet but we are looking at a 60:40 ratio of Tier II routes to metro routes with 60 being Tier II," he had said.


More Dark Rome Tours coupons. Never miss another great coupon. More Great Smoky Mountain Railroad. Gray Line New York Coupon. Get Sears coupons, Best Buy British Airways on Wikipedia and with a Nordstrom promo code. Sign up to save all. More National Car Rental coupons.
See our latest special offers on flights to London, New York and many other international holiday destinations. Including Hand Baggage Only, long haul, holidays, . On Business. Travelling for business. British Airways do not offer company travel loyalty programme in US our partner American Airlines does. If you are small/medium-sized business and like to earn points when your employees travel, join Business Extra programme. This disambiguation page lists articles associated with the title British. If an internal link led you here, you may wish to change the link to point directly to the intended article.
British Airways coupons and promo codes. Trust starke.ga for Flights savings. Provider: Offer: Validity Date: British Airways: Earn Double Avios on every British Airways flight Worldwide as well as British Airways flights operated by American Airlines, Iberia and Finnair when travelling between Europe and North America. You can earn and redeem Alaska Airlines Mileage Plan miles on flight with British Airways.


This paper gives an overview of the challenges which indigenous women in Latin America face in accessing both formal state justice and indigenous legal systems, including a focus on normative frameworks, legal awareness, access to appropriate justice forums and the achievement of satisfactory remedies. In addition, it highlights promising examples of how different actors within civil society and governments are taking steps to improve indigenous women's access to justice in different contexts. Recognizing that each of these are likely to be very context specific, it draws out the key lessons and challenges from these approaches, making recommendations on how this work can best be supported.


text:
Arts Division
Physical and Biological Sciences Division
Baskin School of Engineering
Biomolecular Engineering
Computational Media
Electrical and Computer Engineering M.S.
Electrical and Computer Engineering Ph.D.
Robotics and Control Designated Emphasis
The Colleges
2019-20 UCSC General Catalog > Academic Units > Baskin School of Engineering > Electrical and Computer Engineering > Graduate Program > Electrical and Computer Engineering Ph.D.
The Department of Electrical and Computer Engineering (ECE) at the University of California, Santa Cruz (UCSC) offers master of science (M.S.) and doctor of philosophy (Ph.D.) degree programs and conducts research in the following core areas:
Electronic Circuits and Energy Systems
Photonic and Electronic Devices
Robotics, Control, and Cyber-Physical Systems
Signals, Image Processing, and Communication Systems
For more information about the core areas and associated graduate courses, the department, and its faculty, please visit the Electrical and Computer Engineering Department website.
Students begin the program with the completion of courses in a core area of interest and then proceed to do research in their area of specialization. Ph.D. students are required to take a preliminary exam within their first two years of study. After completing the course requirements, students must pass an oral qualifying exam and write a dissertation. Part-time study is possible for students working in industry while attending school.
Advancement to Candidacy
Each student is required to take 55 credits which must consist of:
At least 20 credits in one of the four core areas defined above.
At least 30 of the total 55 credits must be satisfied through ECE graduate courses.
At most 10 credits of independent study (ECE 297, ECE 299) will be counted toward ECE course requirements.
A combined total of 5 credits from ECE 290 and/or ECE 291 are mandatory, but no more than 5 credits from these two courses can be counted toward degree requirements.
Total credits required for the Ph.D. degree is 55.
The 30 credits of ECE graduate courses can include courses from the core areas only if they are ECE graduate courses. Graduate courses offered by other departments and approved for the core areas are not counted as ECE graduate courses.
* For students already holding a Master of Science in Electrical Engineering (M.S.E.E.) or equivalent degree, at most 20 credits of transfer credit may be granted for equivalent coursework performed at the students' M.S. granting institution. Credit transfer is subject to approval by the instructor of the equivalent UCSC course and the electrical and computer engineering graduate director.
Pre-Qualifying Requirements
At the end of the first year (i.e., no later than the fall quarter in the following year after their entry), students admitted to the Ph.D. program must satisfy the requirements of the preliminary examination to continue in the Ph.D. program. This examination is as follows:
Pass the comprehensive exam for the M.S. program in one of the core areas
Pass one additional section of the M.S. comprehensive examination from a different core area of the comprehensive examination.
Qualifying Examination
This oral examination is a defense of the student's thesis prospectus and a test of the student's knowledge in advanced technical areas of relevance to the dissertation topic. This oral examination consists of a seminar-style talk before the examining committee, where the student describes the thesis prospectus, followed by questions from the committee on the substance of the talk and the areas of presumed expertise of the student. The examination, taken typically in the third year of Ph.D. study, is administered by a Ph.D. qualifying examination committee, consisting of at least four examiners. The composition of the committee must be approved by the graduate director and the dean of graduate studies whereupon the student and the committee are notified.
If the student does not pass the qualifying examination, the student may be asked to complete additional coursework, or other research-related work, before retaking the examination. The student may be allowed to retake the qualifying examination once, and the composition of the examining committee will remain the same for the second try. Students who fail the qualifying examination twice may be dismissed from the Ph.D. program.
Ph.D. students who have not advanced to candidacy by the end of the third year may be recommended for academic probation.
Post-Qualifying Requirements
Advancement to candidacy requires that the student:
pass the preliminary examination;
complete all course requirements prior to taking the qualifying examination;
clear all Incompletes from the student's record;
pass the qualifying examination; and
have an appointed Ph.D. dissertation reading committee.
For students already holding an M.S.E.E. or equivalent degree, at most 20 credits of transfer credit may be granted for equivalent coursework performed at the student's M.S. granting institution. Credit transfer is subject to approval of the instructor of the equivalent UCSC course and the ECE graduate director.
Non-Terminal Master's Degree
Students not already holding an M.S.E.E. degree, who are studying for the Ph.D. degree, may apply to be granted a M.S. degree when they have fulfilled all the M.S. degree requirements (including submission of an M.S. thesis or project, or passing the comprehensive examination).
Materials Fee
Please see the section on fees under School of Engineering.
After advancement to candidacy, work on the dissertation research progresses until the dissertation is completed. The Ph.D. dissertation must show the results of in-depth research, be an original contribution of significant knowledge to the student's field of study, and include material worthy of publication. The student is strongly advised to submit research work for publication in advance of completing the dissertation so that the latter requirement is clearly satisfied. The Ph.D. dissertation results are presented in both oral and written forms, the oral form being a dissertation defense (see below) and the written form being the Ph.D. dissertation. The student must submit his or her written Ph.D. dissertation to the dissertation reading committee at least one month before the defense.
Dissertation Defense
Each Ph.D. candidate submits the completed dissertation to a Ph.D. dissertation reading committee at least one month prior to the dissertation defense. The appointment of the dissertation reading committee is made immediately after the qualifying examination and is necessary for advancing to candidacy. The candidate presents his or her research results in a public seminar sponsored by the dissertation supervisor. The seminar is followed by a defense of the dissertation to the reading committee (only), who will then decide whether the dissertation is acceptable or requires revision. Successful completion of the dissertation fulfills the final academic requirement for the Ph.D. degree.
Each year, the faculty reviews the progress of every student. Students not making adequate progress toward completion of degree requirements (see the Graduate Student Handbook for the policy on satisfactory academic progress) are subject to dismissal from the program. Students with academic deficiencies may be required to take additional courses. Full-time students with no academic deficiencies are normally expected to complete the degree course requirements at the rate of at least two courses each quarter. Full-time students must complete all course requirements within two years for the M.S. and three years for the Ph.D.
Students receiving two or more grades of U (unsatisfactory) or below B- in the School of Engineering courses are not making adequate progress and will be placed on academic probation for the following three quarters of registered enrollment. Withdrawing or taking a leave of absence does not count as enrollment. Part-time enrollment is counted as a half-quarter of enrollment.
If an electrical and computer engineering graduate student fails a School of Engineering course while on probation, the Electrical and Computer Engineering Department may request the graduate dean to dismiss that student from the graduate program. If after being removed from probation, the student again fails a School of Engineering course, he or she will return immediately to academic probation.
Graduate students experiencing circumstances or difficulties that impact their academic performance should contact their adviser and the graduate director immediately. Students may appeal their dismissal to the graduate committee.