text:
{% extends 'contents/_base.html' %}

{% block title %}Sprints{% endblock title %}

{% block body_class %}{{ block.super }} exchange-page{% endblock body_class %}

{% block content %}

Sprints

Sprints are held out of the main conference. A sprint event gathers open source project owners, contributors, and people who wants to contribute but trying to find a place to start. During a sprint, project hosts bring their unresolved issues or new features under development and share with everyone. You can join a project of your choice, or bring your own project here!

For those who already knows fundamentals of Python and wants to participate open source projects, but doesn't know where to start, sprints are great opportunities to get yourself involved! As for project hosts, this is a great chance for you to find people with similar interests, having face-to-face interactions with contributors, and getting new contributors to your project's development! Be prepared to get your hands dirty!

June Sprint - Join Us After the Conference!

Time

2018-06-03 09:00–17:00

Location

Technology Services Building, Room #103

Registration

Please RSVP on our Meetup

Agenda

09:00–09:30

Setup / Networking

09:30–10:00

Projects Introduction / Choose a Project

10:00–12:00

Sprinting

12:00–13:00

Lunch / Networking

13:00–16:30

Sprinting

16:30–17:00

Sharing / Summary

Projects

Traditional Chinese Translation of Python Official Documentation

Let's make Python's official documentation more friendly for Taiwanese people!

Pipenv

Python Development Workflow for Humans

Plone

An open source CMS built with Python

Your Project!

If you're interested in being a project host at the sprint, please contact us at organizers@pycon.tw

			RSVP

February Sprint — Our Website Needs Your Help!

Time

2018-02-10 13:30–19:00

Location

Komma Space, Room #701

Registration

Please RSVP on our Meetup

Agenda

13:30–15:00

Setup / Introduction / Sprinting

15:00–15:30

Food Party

15:30–18:30

Sprinting

18:30–19:00

Sharing / Summary

What Projects Are There?

PyCon Taiwan's Official Website

Let's build PyCon Taiwan 2018's website together!

{% endblock content %}


text:
import { bindAll } from 'underscore';
import Backbone from 'backbone';
import model from './Frame';

export default Backbone.Collection.extend({
  model,

  initialize() {
    bindAll(this, 'itemLoaded');
  },

  itemLoaded() {
    this.loadedItems++;

    if (this.loadedItems >= this.itemsToLoad) {
      this.trigger('loaded:all');
      this.listenToLoadItems(0);
    }
  },

  listenToLoad() {
    this.loadedItems = 0;
    this.itemsToLoad = this.length;
    this.listenToLoadItems(1);
  },

  listenToLoadItems(on) {
    this.forEach(item => item[on ? 'on' : 'off']('loaded', this.itemLoaded));
  }
});

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="et">
<context>
    <name>MainUI</name>
    <message>
        <location filename="../MainUI.ui" line="14"/>
        <source>Lumina Desktop Information</source>
        <translation>Lumina töölaua teave</translation>
    </message>
    <message>
        <location filename="../MainUI.ui" line="60"/>
        <source>General</source>
        <translation>Üldine</translation>
    </message>
    <message>
        <location filename="../MainUI.ui" line="89"/>
        <source>Source Repository</source>
        <translation>Lähtekoodi repositoorium</translation>
    </message>
    <message>
        <location filename="../MainUI.ui" line="124"/>
        <source>Lumina Website</source>
        <translation>Lumina veebileht</translation>
    </message>
    <message>
        <location filename="../MainUI.ui" line="152"/>
        <source>Bug Reports</source>
        <translation>Puukide raporteerimine</translation>
    </message>
    <message>
        <location filename="../MainUI.ui" line="179"/>
        <source>Desktop Version:</source>
        <translation>Töölaua versioon:</translation>
    </message>
    <message>
        <location filename="../MainUI.ui" line="202"/>
        <source>OS Build:</source>
        <translation>Opsüsteemi versioon:</translation>
    </message>
    <message>
        <location filename="../MainUI.ui" line="218"/>
        <source>Qt Version:</source>
        <translation>Qt versioon:</translation>
    </message>
    <message>
        <location filename="../MainUI.ui" line="276"/>
        <source>Ask the Community</source>
        <translation>Küsi kommuunilt</translation>
    </message>
    <message>
        <location filename="../MainUI.ui" line="233"/>
        <source>View Information</source>
        <translation>Kuva teave</translation>
    </message>
    <message>
        <location filename="../MainUI.ui" line="298"/>
        <source>License</source>
        <translation>Litsents</translation>
    </message>
    <message>
        <location filename="../MainUI.ui" line="315"/>
        <source>Acknowledgements</source>
        <translation>Täname</translation>
    </message>
    <message>
        <location filename="../MainUI.ui" line="333"/>
        <source>Project Lead:</source>
        <translation>Projekti juht:</translation>
    </message>
    <message>
        <location filename="../MainUI.ui" line="340"/>
        <source>Ken Moore</source>
        <translation>Ken Moore</translation>
    </message>
    <message>
        <location filename="../MainUI.ui" line="353"/>
        <source>Contributors:</source>
        <translation>Kaasautorid:</translation>
    </message>
    <message>
        <location filename="../MainUI.ui" line="366"/>
        <source>Sponsors:</source>
        <translation>Toetajad:</translation>
    </message>
    <message>
        <location filename="../MainUI.ui" line="428"/>
        <source>Open in web browser</source>
        <translation>Ava veebibrauseris</translation>
    </message>
    <message>
        <location filename="../MainUI.ui" line="454"/>
        <source>Close</source>
        <translation>Sulge</translation>
    </message>
</context>
<context>
    <name>XDGDesktopList</name>
    <message>
        <location filename="../../libLumina/LuminaXDG.cpp" line="618"/>
        <source>Multimedia</source>
        <translation>Multimeedia</translation>
    </message>
    <message>
        <location filename="../../libLumina/LuminaXDG.cpp" line="619"/>
        <source>Development</source>
        <translation>Arendustegevus</translation>
    </message>
    <message>
        <location filename="../../libLumina/LuminaXDG.cpp" line="620"/>
        <source>Education</source>
        <translation>Haridus</translation>
    </message>
    <message>
        <location filename="../../libLumina/LuminaXDG.cpp" line="621"/>
        <source>Games</source>
        <translation>Mängud</translation>
    </message>
    <message>
        <location filename="../../libLumina/LuminaXDG.cpp" line="622"/>
        <source>Graphics</source>
        <translation>Graafika</translation>
    </message>
    <message>
        <location filename="../../libLumina/LuminaXDG.cpp" line="623"/>
        <source>Network</source>
        <translation>Võrk</translation>
    </message>
    <message>
        <location filename="../../libLumina/LuminaXDG.cpp" line="624"/>
        <source>Office</source>
        <translation>Kontor</translation>
    </message>
    <message>
        <location filename="../../libLumina/LuminaXDG.cpp" line="625"/>
        <source>Science</source>
        <translation>Teadus</translation>
    </message>
    <message>
        <location filename="../../libLumina/LuminaXDG.cpp" line="626"/>
        <source>Settings</source>
        <translation>Sätted</translation>
    </message>
    <message>
        <location filename="../../libLumina/LuminaXDG.cpp" line="627"/>
        <source>System</source>
        <translation>Süsteem</translation>
    </message>
    <message>
        <location filename="../../libLumina/LuminaXDG.cpp" line="628"/>
        <source>Utility</source>
        <translation>Tööriistad</translation>
    </message>
    <message>
        <location filename="../../libLumina/LuminaXDG.cpp" line="629"/>
        <source>Wine</source>
        <translation>Wine</translation>
    </message>
    <message>
        <location filename="../../libLumina/LuminaXDG.cpp" line="630"/>
        <source>Unsorted</source>
        <translation>Sorteerimata</translation>
    </message>
</context>
</TS>


text:
angular.module('starter', ['ionic', 'starter.controllers'])

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
    if (window.cordova && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
      cordova.plugins.Keyboard.disableScroll(true);

    }
    if (window.StatusBar) {
      // org.apache.cordova.statusbar required
      StatusBar.styleDefault();
    }
  });
})

.config(function($stateProvider, $urlRouterProvider) {
  $stateProvider

    .state('app', {
    url: '/app',
    abstract: true,
    templateUrl: 'templates/menu.html',
    controller: 'AppCtrl'
  })

    .state('app.calculator', {
      url: '/calculator',
      views: {
        'mainContent': {
          templateUrl: 'templates/calculator.html',
          controller: 'CalculatorCtrl'
        }
      }
    })

    .state('app.about', {
      url: '/about',
      views: {
        'mainContent': {
          templateUrl: 'templates/about.html'

        }
      }
    })
    ;
  // if none of the above states are matched, use this as the fallback
  $urlRouterProvider.otherwise('/app/calculator');
});


text:
#include <errno.h>
#include <limits.h>
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <systemd/sd-bus.h>
#include <time.h>

#include "sol-platform-impl.h"

#include "sol-bus.h"
#include "sol-platform.h"
#include "sol-str-table.h"
#include "sol-util-file.h"
#include "sol-util-internal.h"
#include "sol-vector.h"

struct service {
    struct {
        enum sol_platform_service_state state;
    } properties;

    sd_bus_slot *slot;
    /* owned by sol-platform */
    const char *service;
};

struct ctx {
    struct {
        enum sol_platform_state system_state;
    } properties;

    struct sol_bus_client *systemd;
    struct sol_bus_client *locale;
    struct sol_bus_client *timedate;
    struct sol_bus_client *hostname;
    struct sol_ptr_vector services;
    bool locale_monitor_registered : 1;
    bool timedate_monitor_registered : 1;
    bool hostname_monitor_registered : 1;
};

static struct ctx _ctx;

static bool
_manager_set_system_state(void *data, const char *path, sd_bus_message *m)
{
    struct ctx *ctx = data;
    const char *str;
    bool changed;
    enum sol_platform_state state;
    static const struct sol_str_table table[] = {
        /* systemd differentiates these 2, we don't */
        SOL_STR_TABLE_ITEM("initializing", SOL_PLATFORM_STATE_INITIALIZING),
        SOL_STR_TABLE_ITEM("starting",     SOL_PLATFORM_STATE_INITIALIZING),

        SOL_STR_TABLE_ITEM("running",      SOL_PLATFORM_STATE_RUNNING),
        SOL_STR_TABLE_ITEM("degraded",     SOL_PLATFORM_STATE_DEGRADED),
        SOL_STR_TABLE_ITEM("maintenance",  SOL_PLATFORM_STATE_MAINTENANCE),
        SOL_STR_TABLE_ITEM("stopping",     SOL_PLATFORM_STATE_STOPPING),
        { }
    };
    int r;

    r = sd_bus_message_read_basic(m, SD_BUS_TYPE_STRING, &str);
    SOL_INT_CHECK(r, < 0, false);

    state = sol_str_table_lookup_fallback(table, sol_str_slice_from_str(str),
        SOL_PLATFORM_SERVICE_STATE_UNKNOWN);
    changed = state != ctx->properties.system_state;
    ctx->properties.system_state = state;

    return changed;
}

enum {
    MANAGER_PROPERTY_SYSTEM_STATE,
};

static void
_manager_properties_changed(void *data, const char *path, uint64_t mask)
{
    struct ctx *ctx = data;

    SOL_DBG("mask=%" PRIu64, mask);

    if (mask & (1 << MANAGER_PROPERTY_SYSTEM_STATE)) {
        SOL_DBG("New system state: [%d]", ctx->properties.system_state);
        sol_platform_inform_state_monitors(ctx->properties.system_state);
    }
}

static const struct sol_bus_properties _manager_properties[] = {
    [MANAGER_PROPERTY_SYSTEM_STATE] = {
        .member = "SystemState",
        .set = _manager_set_system_state,
    },
    { }
};

static int
_systemd_bus_initialized(sd_bus *bus)
{
    sd_bus_message *m = NULL;
    int r = -ENOMEM;

    _ctx.properties.system_state = SOL_PLATFORM_STATE_UNKNOWN;

    _ctx.systemd = sol_bus_client_new(bus, "org.freedesktop.systemd1");
    SOL_NULL_CHECK_GOTO(_ctx.systemd, fail);

    r = sd_bus_message_new_method_call(bus, &m,
        "org.freedesktop.systemd1",
        "/org/freedesktop/systemd1",
        "org.freedesktop.systemd1.Manager",
        "Subscribe");
    SOL_INT_CHECK_GOTO(r, < 0, fail);

    r = sd_bus_call_async(bus, NULL, m, sol_bus_log_callback, NULL, 0);
    sd_bus_message_unref(m);
    SOL_INT_CHECK_GOTO(r, < 0, fail);

    r = sol_bus_map_cached_properties(_ctx.systemd,
        "/org/freedesktop/systemd1",
        "org.freedesktop.systemd1.Manager",
        _manager_properties,
        _manager_properties_changed,
        &_ctx);
    SOL_INT_CHECK_GOTO(r, < 0, fail);

    return 0;

fail:
    return r;
}

static const char *
sanitize_unit_name(char buf[SOL_STATIC_ARRAY_SIZE(PATH_MAX)], const char *unit,
    const char *suffix, const char *action)
{
    size_t len;
    size_t suffixlen;

    SOL_NULL_CHECK(unit, NULL);
    SOL_NULL_CHECK(suffix, NULL);

    len = strlen(unit);
    suffixlen = strlen(suffix);
    SOL_INT_CHECK(len + suffixlen, >= PATH_MAX, NULL);
    if (!len || !suffixlen) {
        SOL_WRN("Invalid unit name '%s%s' to %s", unit, suffix, action);
        return NULL;
    }

    memcpy(buf, unit, len);
    memcpy(buf + len, suffix, suffixlen);
    buf[len + suffixlen] = '\0';

    return buf;
}

static inline const char *
sanitize_service_name(char buf[SOL_STATIC_ARRAY_SIZE(PATH_MAX)], const char *service,
    const char *action)
{
    return sanitize_unit_name(buf, service, ".service", action);
}

static sd_bus *
_get_sd_bus(struct sol_bus_client *client, int (*init_cb)(sd_bus *bus))
{
    sd_bus *bus;

    if (!client)
        bus = sol_bus_get(init_cb);
    else
        bus = sol_bus_client_get_bus(client);

    return bus;
}

int
sol_platform_impl_get_state(void)
{
    sd_bus *bus;

    bus = _get_sd_bus(_ctx.systemd, _systemd_bus_initialized);
    SOL_NULL_CHECK(bus, -ENOTCONN);
    return _ctx.properties.system_state;
}

static bool
_service_set_state(void *data, const char *path, sd_bus_message *m)
{
    struct service *x = data;
    const char *str;
    bool changed;
    enum sol_platform_service_state state;
    static const struct sol_str_table table[] = {
        SOL_STR_TABLE_ITEM("active",       SOL_PLATFORM_SERVICE_STATE_ACTIVE),
        SOL_STR_TABLE_ITEM("reloading",    SOL_PLATFORM_SERVICE_STATE_RELOADING),
        SOL_STR_TABLE_ITEM("inactive",     SOL_PLATFORM_SERVICE_STATE_INACTIVE),
        SOL_STR_TABLE_ITEM("failed",       SOL_PLATFORM_SERVICE_STATE_FAILED),
        SOL_STR_TABLE_ITEM("activating",   SOL_PLATFORM_SERVICE_STATE_ACTIVATING),
        SOL_STR_TABLE_ITEM("deactivating", SOL_PLATFORM_SERVICE_STATE_DEACTIVATING),
        { }
    };
    int r;

    r = sd_bus_message_read_basic(m, SD_BUS_TYPE_STRING, &str);
    SOL_INT_CHECK(r, < 0, false);

    state = sol_str_table_lookup_fallback(table, sol_str_slice_from_str(str),
        SOL_PLATFORM_SERVICE_STATE_UNKNOWN);
    changed = state != x->properties.state;
    x->properties.state = state;

    return changed;
}

enum {
    SERVICE_PROPERTY_STATE,
};

static void
_service_properties_changed(void *data, const char *path, uint64_t mask)
{
    struct service *x = data;

    SOL_DBG("mask=%" PRIu64, mask);

    if (mask & (1 << SERVICE_PROPERTY_STATE)) {
        SOL_DBG("New service (%s) state: [%d]",
            x->service, x->properties.state);
        sol_platform_inform_service_monitors(x->service, x->properties.state);
    }
}

static const struct sol_bus_properties _service_properties[] = {
    [SERVICE_PROPERTY_STATE] = {
        .member = "ActiveState",
        .set = _service_set_state,
    },
    { }
};

static int
_add_service_monitor(sd_bus_message *reply, void *userdata,
    sd_bus_error *ret_error)
{
    struct service *x = userdata;
    const char *path;
    int r;

    x->slot = sd_bus_slot_unref(x->slot);

    if (sol_bus_log_callback(reply, userdata, ret_error) < 0)
        return 0;

    r = sd_bus_message_read(reply, "o", &path);
    SOL_INT_CHECK(r, < 0, r);

    sol_bus_map_cached_properties(_ctx.systemd,
        path,
        "org.freedesktop.systemd1.Unit",
        _service_properties,
        _service_properties_changed,
        x);

    return 0;
}

int
sol_platform_impl_add_service_monitor(const char *service)
{
    int r;
    sd_bus_message *m = NULL;
    sd_bus *bus;
    char buf[PATH_MAX];
    const char *unit, *systemd_service;
    struct service *x;

    bus = _get_sd_bus(_ctx.systemd, _systemd_bus_initialized);
    SOL_NULL_CHECK(bus, -ENOTCONN);

    systemd_service = sol_bus_client_get_service(_ctx.systemd);
    SOL_NULL_CHECK(systemd_service, -EINVAL);

    unit = sanitize_service_name(buf, service, "add_service_monitor");
    SOL_NULL_CHECK(unit, -EINVAL);

    x = calloc(1, sizeof(*x));
    SOL_NULL_CHECK(x, -ENOMEM);
    x->service = service;
    x->properties.state = SOL_PLATFORM_SERVICE_STATE_UNKNOWN;

    r = sd_bus_message_new_method_call(bus, &m,
        systemd_service,
        "/org/freedesktop/systemd1",
        "org.freedesktop.systemd1.Manager",
        "GetUnit");
    SOL_INT_CHECK_GOTO(r, < 0, fail_new_method);

    r = sd_bus_message_append(m, "s", unit);
    SOL_INT_CHECK_GOTO(r, < 0, fail_append);

    r = sd_bus_call_async(bus, &x->slot, m, _add_service_monitor, x, 0);
    SOL_INT_CHECK_GOTO(r, < 0, fail_call);

    sd_bus_message_unref(m);

    sol_ptr_vector_append(&_ctx.services, x);

    return 0;

fail_call:
fail_append:
    sd_bus_message_unref(m);
fail_new_method:
    free(x);
    return r;
}

int
sol_platform_impl_del_service_monitor(const char *service)
{
    struct service *x, *found = NULL;
    uint16_t i;

    SOL_PTR_VECTOR_FOREACH_IDX (&_ctx.services, x, i)
        if (streq(x->service, service)) {
            found = x;
            break;
        }
    SOL_NULL_CHECK(found, -ENOENT);

    if (found->slot)
        sd_bus_slot_unref(found->slot);
    else
        sol_bus_unmap_cached_properties(_ctx.systemd, _service_properties, found);

    sol_ptr_vector_del(&_ctx.services, i);
    free(found);

    return 0;
}

static int
call_manager(const char *method, const char *_unit, const char *suffix,
    const char *param, const char *action)
{
    sd_bus_message *m = NULL;
    sd_bus *bus;
    char buf[PATH_MAX];
    const char *unit, *service;
    int r;

    bus = _get_sd_bus(_ctx.systemd, _systemd_bus_initialized);
    SOL_NULL_CHECK(bus, -ENOTCONN);

    service = sol_bus_client_get_service(_ctx.systemd);
    SOL_NULL_CHECK(service, -EINVAL);

    unit = sanitize_unit_name(buf, _unit, suffix, action);
    SOL_NULL_CHECK(unit, -EINVAL);

    r = sd_bus_message_new_method_call(bus, &m,
        service,
        "/org/freedesktop/systemd1",
        "org.freedesktop.systemd1.Manager",
        method);
    SOL_INT_CHECK_GOTO(r, < 0, fail_new_method);

    r = sd_bus_message_append(m, "ss", unit, param);
    SOL_INT_CHECK_GOTO(r, < 0, fail);

    r = sd_bus_call_async(bus, NULL, m, sol_bus_log_callback, NULL, 0);
    SOL_INT_CHECK_GOTO(r, < 0, fail);

    sd_bus_message_unref(m);

    return 0;

fail:
    sd_bus_message_unref(m);
fail_new_method:
    SOL_WRN("Failed to %s service '%s': %s", action, unit, sol_util_strerrora(-r));
    return r;
}

static inline int
call_manager_for_service(const char *method, const char *service,
    const char *action)
{
    return call_manager(method, service, ".service", "replace", action);
}

int
sol_platform_impl_start_service(const char *service)
{
    return call_manager_for_service("StartUnit", service, "start");
}

int
sol_platform_impl_stop_service(const char *service)
{
    return call_manager_for_service("StopUnit", service, "stop");
}

int
sol_platform_impl_restart_service(const char *service)
{
    return call_manager_for_service("RestartUnit", service, "restart");
}

enum {
    TARGET_PARAM_ISOLATE = 0,
    TARGET_PARAM_REPLACE_IRREVERSIBLY,
};

int
sol_platform_impl_set_target(const char *target)
{
    int16_t idx;
    static const char *params[] = {
        [TARGET_PARAM_ISOLATE] = "isolate",
        [TARGET_PARAM_REPLACE_IRREVERSIBLY] = "replace-irreversibly",
    };
    static const struct sol_str_table table[] = {
        SOL_STR_TABLE_ITEM(SOL_PLATFORM_TARGET_DEFAULT,   TARGET_PARAM_ISOLATE),
        SOL_STR_TABLE_ITEM(SOL_PLATFORM_TARGET_RESCUE,    TARGET_PARAM_ISOLATE),
        SOL_STR_TABLE_ITEM(SOL_PLATFORM_TARGET_EMERGENCY, TARGET_PARAM_ISOLATE),
        SOL_STR_TABLE_ITEM(SOL_PLATFORM_TARGET_POWEROFF,  TARGET_PARAM_REPLACE_IRREVERSIBLY),
        SOL_STR_TABLE_ITEM(SOL_PLATFORM_TARGET_REBOOT,    TARGET_PARAM_REPLACE_IRREVERSIBLY),
        SOL_STR_TABLE_ITEM(SOL_PLATFORM_TARGET_SUSPEND,   TARGET_PARAM_REPLACE_IRREVERSIBLY),
        { }
    };

    idx = sol_str_table_lookup_fallback(table, sol_str_slice_from_str(target),
        TARGET_PARAM_ISOLATE);

    return call_manager("StartUnit", target, ".target", params[idx], "set_target");
}

int
sol_platform_impl_get_machine_id(char id[SOL_STATIC_ARRAY_SIZE(33)])
{
    int r;

    r = sol_util_read_file("/etc/machine-id", "%32s", id);
    /* that id should have already been validated by systemd */

    return r;
}

int
sol_platform_impl_get_serial_number(char **number)
{
    int r;
    char id[37];

    /* root access required for this */
    r = sol_util_read_file("/sys/class/dmi/id/product_uuid", "%36s", id);
    SOL_INT_CHECK(r, < 0, r);

    *number = strdup(id);
    if (!*number)
        return -errno;

    return r;
}

int
sol_platform_impl_init(void)
{
    /* For systemd backend we do nothing: we will only attach its mainloop to
     * ours and connect to D-Bus if client calls any method that needs it:
     * see _bus_initialized() */

    sol_ptr_vector_init(&_ctx.services);

    return 0;
}

void
sol_platform_impl_shutdown(void)
{
    sol_ptr_vector_clear(&_ctx.services);

    sol_bus_close();
    sol_platform_unregister_system_clock_monitor();
}

static int
_hostname_bus_initialized(sd_bus *bus)
{
    _ctx.hostname = sol_bus_client_new(bus, "org.freedesktop.hostname1");
    SOL_NULL_CHECK(_ctx.hostname, -ENOMEM);
    return 0;
}

int
sol_platform_impl_set_hostname(const char *name)
{
    sd_bus *bus;
    const char *service;
    int r;

    bus = _get_sd_bus(_ctx.hostname, _hostname_bus_initialized);
    SOL_NULL_CHECK(bus, -ENOTCONN);

    service = sol_bus_client_get_service(_ctx.hostname);
    SOL_NULL_CHECK(service, -EINVAL);

    bus = sol_bus_get(NULL);
    SOL_NULL_CHECK(bus, -ENOTCONN);

    r = sd_bus_call_method_async(bus, NULL, service,
        "/org/freedesktop/hostname1", "org.freedesktop.hostname1",
        "SetStaticHostname", sol_bus_log_callback, NULL, "sb", name, false);
    SOL_INT_CHECK(r, < 0, r);
    return 0;
}

static bool
skip_prop(void *data, const char *path, sd_bus_message *m)
{
    int r;
    const char *contents;
    char type;

    r = sd_bus_message_peek_type(m, &type, &contents);
    SOL_INT_CHECK(r, < 0, true);

    r = sd_bus_message_skip(m, contents);
    SOL_INT_CHECK(r, < 0, true);

    return true;
}

static const struct sol_bus_properties _hostname_property = {
    .member = "StaticHostname",
    .set = skip_prop,
};

int
sol_platform_unregister_hostname_monitor(void)
{
    if (!_ctx.hostname || !_ctx.hostname_monitor_registered)
        return 0;
    _ctx.hostname_monitor_registered = false;
    return sol_bus_unmap_cached_properties(_ctx.hostname,
        &_hostname_property, NULL);
}

static void
_hostname_changed(void *data, const char *path, uint64_t mask)
{
    sol_platform_inform_hostname_monitors();
}

int
sol_platform_register_hostname_monitor(void)
{
    sd_bus *bus;
    int r;

    if (_ctx.hostname_monitor_registered)
        return 0;

    bus = _get_sd_bus(_ctx.hostname, _hostname_bus_initialized);
    SOL_NULL_CHECK(bus, -ENOTCONN);

    r = sol_bus_map_cached_properties(_ctx.hostname,
        "/org/freedesktop/hostname1", "org.freedesktop.hostname1",
        &_hostname_property, _hostname_changed, NULL);
    if (!r)
        _ctx.hostname_monitor_registered = true;
    return r;
}

static int
_timedate_bus_initialized(sd_bus *bus)
{
    _ctx.timedate = sol_bus_client_new(bus, "org.freedesktop.timedate1");
    SOL_NULL_CHECK(_ctx.timedate, -ENOMEM);
    return 0;
}

int
sol_platform_impl_set_system_clock(int64_t timestamp)
{
    sd_bus *bus;
    int r;
    int64_t timestamp_micro;
    const char *service;

    bus = _get_sd_bus(_ctx.timedate, _timedate_bus_initialized);
    SOL_NULL_CHECK(bus, -ENOTCONN);

    service = sol_bus_client_get_service(_ctx.timedate);
    SOL_NULL_CHECK(service, -EINVAL);

    r = sol_util_int64_mul(timestamp, SOL_USEC_PER_SEC, &timestamp_micro);
    SOL_INT_CHECK(r, < 0, r);

    bus = sol_bus_get(NULL);
    SOL_NULL_CHECK(bus, -ENOTCONN);

    r = sd_bus_call_method_async(bus, NULL, service,
        "/org/freedesktop/timedate1", "org.freedesktop.timedate1",
        "SetTime", sol_bus_log_callback, NULL, "xbb", timestamp_micro, false, false);
    SOL_INT_CHECK(r, < 0, r);
    return 0;
}

int
sol_platform_impl_set_timezone(const char *tmz)
{
    sd_bus *bus;
    const char *service;
    int r;

    bus = _get_sd_bus(_ctx.timedate, _timedate_bus_initialized);
    SOL_NULL_CHECK(bus, -ENOTCONN);

    service = sol_bus_client_get_service(_ctx.timedate);
    SOL_NULL_CHECK(service, -EINVAL);

    r = sd_bus_call_method_async(bus, NULL, service,
        "/org/freedesktop/timedate1", "org.freedesktop.timedate1",
        "SetTimezone", sol_bus_log_callback, NULL, "sb", tmz, false);
    SOL_INT_CHECK(r, < 0, r);
    return 0;
}

static const struct sol_bus_properties _timezone_property = {
    .member = "Timezone",
    .set = skip_prop,
};

static void
_timezone_changed(void *data, const char *path, uint64_t mask)
{
    sol_platform_inform_timezone_changed();
}

int
sol_platform_register_timezone_monitor(void)
{
    sd_bus *bus;
    int r;

    if (_ctx.timedate_monitor_registered)
        return 0;

    bus = _get_sd_bus(_ctx.timedate, _timedate_bus_initialized);
    SOL_NULL_CHECK(bus, -ENOTCONN);

    r = sol_bus_map_cached_properties(_ctx.timedate,
        "/org/freedesktop/timedate1", "org.freedesktop.timedate1",
        &_timezone_property, _timezone_changed, NULL);
    if (!r)
        _ctx.timedate_monitor_registered = true;
    return r;
}

int
sol_platform_unregister_timezone_monitor(void)
{
    if (!_ctx.timedate || !_ctx.timedate_monitor_registered)
        return 0;
    _ctx.timedate_monitor_registered = false;
    return sol_bus_unmap_cached_properties(_ctx.timedate,
        &_timezone_property, NULL);
}

static int
_localed_bus_initialized(sd_bus *bus)
{
    _ctx.locale = sol_bus_client_new(bus, "org.freedesktop.locale1");
    SOL_NULL_CHECK(_ctx.locale, -ENOMEM);
    return 0;
}

int
sol_platform_impl_set_locale(char **locales)
{
    sd_bus *bus;
    int r;
    char *str;
    sd_bus_message *m;
    const char *service;
    enum sol_platform_locale_category i;

    bus = _get_sd_bus(_ctx.locale, _localed_bus_initialized);
    SOL_NULL_CHECK(bus, -EINVAL);

    service = sol_bus_client_get_service(_ctx.locale);
    SOL_NULL_CHECK(service, -EINVAL);

    r = sd_bus_message_new_method_call(bus, &m,
        service,
        "/org/freedesktop/locale1",
        "org.freedesktop.locale1",
        "SetLocale");
    SOL_INT_CHECK(r, < 0, r);

    r = sd_bus_message_open_container(m, 'a', "s");
    SOL_INT_CHECK_GOTO(r, < 0, exit);

    for (i = SOL_PLATFORM_LOCALE_LANGUAGE; i <= SOL_PLATFORM_LOCALE_TIME; i++) {
        r = asprintf(&str, "%s=%s", sol_platform_locale_to_c_str_category(i),
            locales[i] ? locales[i] : "C");
        if (r < 0) {
            r = -ENOMEM;
            goto exit;
        }
        r = sd_bus_message_append_basic(m, 's', str);
        free(str);
        SOL_INT_CHECK_GOTO(r, < 0, exit);
    }

    r = sd_bus_message_close_container(m);
    SOL_INT_CHECK_GOTO(r, < 0, exit);

    r = sd_bus_message_append(m, "b", false);
    SOL_INT_CHECK_GOTO(r, < 0, exit);

    r = sd_bus_call_async(bus, NULL, m, sol_bus_log_callback, NULL, 0);

exit:
    sd_bus_message_unref(m);
    return r;
}

static void
_locale_changed(void *data, const char *path, uint64_t mask)
{
    sol_platform_inform_locale_changed();
}

static const struct sol_bus_properties _locale_property = {
    .member = "Locale",
    .set = skip_prop,
};

int
sol_platform_register_locale_monitor(void)
{
    sd_bus *bus;
    int r;

    if (_ctx.timedate_monitor_registered)
        return 0;

    bus = _get_sd_bus(_ctx.locale, _localed_bus_initialized);
    SOL_NULL_CHECK(bus, -EINVAL);

    r = sol_bus_map_cached_properties(_ctx.locale, "/org/freedesktop/locale1",
        "org.freedesktop.locale1", &_locale_property, _locale_changed, NULL);
    if (!r)
        _ctx.timedate_monitor_registered = true;
    return r;
}

int
sol_platform_unregister_locale_monitor(void)
{
    if (!_ctx.locale || !_ctx.timedate_monitor_registered)
        return 0;
    _ctx.locale_monitor_registered = false;
    return sol_bus_unmap_cached_properties(_ctx.locale,
        &_locale_property, NULL);
}


text:
package de.jdynameta.dbaccess.jdbc.connection;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.StringReader;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Types;

import de.jdynameta.base.metainfo.primitive.VarCharType;
import de.jdynameta.base.value.JdyPersistentException;

/**
 * @author Rainer
 *
 * @version 17.07.2002
 */
public class HsqlPreparedStatementWriter extends PreparedStatementWriter
{

    public HsqlPreparedStatementWriter(PreparedStatement aPreparedStatement, int aStartIndex)
    {
        super(aPreparedStatement, aStartIndex);
    }

    @Override
    public void handleValue(String aValue, VarCharType aType) throws JdyPersistentException
    {
        try
        {
            if (aValue != null)
            {
                if (aValue.length() > 0)
                {
                    StringBuilder resultBuffer = new StringBuilder(aValue.length() + aValue.length() / 20);
                    try
                    {
                        // replace \n with \r\n
                        BufferedReader bufReader = new BufferedReader(new StringReader(aValue));
                        String curLine = bufReader.readLine();
                        while (curLine != null)
                        {
                            resultBuffer.append(curLine);
                            curLine = bufReader.readLine();
                            if (curLine != null || aValue.endsWith("\n"))
                            {
                                resultBuffer.append("\r\n");
                            }
                        }
                    } catch (IOException ioExcp)
                    {
                        ioExcp.printStackTrace();
                    }
                    aValue = resultBuffer.toString();
                    getPreparedStatement().setCharacterStream(index, new StringReader(aValue), aValue.length());
                } else
                // bugfix for Access setAsciiStream don't work with ""
                {
                    getPreparedStatement().setString(index, aValue);
                }

            } else
            {
                getPreparedStatement().setNull(index, Types.VARCHAR);
            }
            index++;
        } catch (SQLException excp)
        {
            throw new JdyPersistentException(excp);
        }
    }

}


text:
<ion-view title="Messages">
  <ion-nav-buttons side="right">
    <button class="button" ng-click="logout()" ng-if=" !nodeWebkit ">

    </button>

  </ion-nav-buttons>

    <input type="text" placeholder="Search Messages" ng-model="data.searchKey" ng-enter="scan()">
    <button class="button button-positive button-search" ng-click='scan()'>

    </button>

  <ion-content padding="true" class="has-header" style="top:110px;" has-bouncing="true">

{{message.name}}

{{message.date}}

            {{message.message}}

{{message.name}}

            <span

        There is no messages in condition.

  </ion-content>
</ion-view>


text:
<?php

declare(strict_types=1);

namespace Sonata\AdminBundle\Tests\FieldDescription;

use PHPUnit\Framework\TestCase;
use Sonata\AdminBundle\FieldDescription\FieldDescriptionInterface;
use Sonata\AdminBundle\FieldDescription\TypeGuesserChain;
use Sonata\AdminBundle\FieldDescription\TypeGuesserInterface;
use Symfony\Component\Form\Guess\Guess;
use Symfony\Component\Form\Guess\TypeGuess;

final class TypeGuesserChainTest extends TestCase
{
    /**
     * @psalm-suppress InvalidArgument
     */
    public function testConstructorWithException(): void
    {
        $this->expectException(\InvalidArgumentException::class);

        // @phpstan-ignore-next-line
        new TypeGuesserChain([new \stdClass()]);
    }

    public function testGuess(): void
    {
        $typeGuess1 = new TypeGuess('foo1', [], Guess::MEDIUM_CONFIDENCE);
        $guesser1 = $this->createStub(TypeGuesserInterface::class);
        $guesser1
                ->method('guess')
                ->willReturn($typeGuess1);

        $typeGuess2 = new TypeGuess('foo2', [], Guess::HIGH_CONFIDENCE);
        $guesser2 = $this->createStub(TypeGuesserInterface::class);
        $guesser2
                ->method('guess')
                ->willReturn($typeGuess2);

        $typeGuess3 = new TypeGuess('foo3', [], Guess::LOW_CONFIDENCE);
        $guesser3 = $this->createStub(TypeGuesserInterface::class);
        $guesser3
                ->method('guess')
                ->willReturn($typeGuess3);

        $fieldDescription = $this->createStub(FieldDescriptionInterface::class);

        $typeGuesserChain = new TypeGuesserChain([$guesser1, $guesser2, $guesser3]);
        $this->assertSame($typeGuess2, $typeGuesserChain->guess($fieldDescription));

        $typeGuess4 = new TypeGuess('foo4', [], Guess::LOW_CONFIDENCE);
        $guesser4 = $this->createStub(TypeGuesserInterface::class);
        $guesser4
                ->method('guess')
                ->willReturn($typeGuess4);

        $typeGuesserChain = new TypeGuesserChain([$guesser4, $typeGuesserChain]);
        $this->assertSame($typeGuess2, $typeGuesserChain->guess($fieldDescription));
    }
}


text:
'use strict';
const common = require('../common');
if (common.isIBMi)
  common.skip('IBMi does not support fs.watch()');

const assert = require('assert');
const fs = require('fs');
const path = require('path');

const tmpdir = require('../common/tmpdir');

if (!common.isMainThread)
  common.skip('process.chdir is not available in Workers');

const expectFilePath = common.isWindows ||
                       common.isLinux ||
                       common.isOSX ||
                       common.isAIX;

const testDir = tmpdir.path;

tmpdir.refresh();

{
  const filepath = path.join(testDir, 'watch.txt');

  fs.writeFileSync(filepath, 'hello');

  const watcher = fs.watch(filepath);
  watcher.on('change', common.mustCall(function(event, filename) {
    assert.strictEqual(event, 'change');

    if (expectFilePath) {
      assert.strictEqual(filename, 'watch.txt');
    }
    watcher.close();
  }));

  setImmediate(function() {
    fs.writeFileSync(filepath, 'world');
  });
}

{
  const filepathAbs = path.join(testDir, 'hasOwnProperty');

  process.chdir(testDir);

  fs.writeFileSync(filepathAbs, 'howdy');

  const watcher =
    fs.watch('hasOwnProperty', common.mustCall(function(event, filename) {
      assert.strictEqual(event, 'change');

      if (expectFilePath) {
        assert.strictEqual(filename, 'hasOwnProperty');
      }
      watcher.close();
    }));

  setImmediate(function() {
    fs.writeFileSync(filepathAbs, 'pardner');
  });
}

{
  const testsubdir = fs.mkdtempSync(testDir + path.sep);
  const filepath = path.join(testsubdir, 'newfile.txt');

  const watcher =
    fs.watch(testsubdir, common.mustCall(function(event, filename) {
      const renameEv = common.isSunOS || common.isAIX ? 'change' : 'rename';
      assert.strictEqual(event, renameEv);
      if (expectFilePath) {
        assert.strictEqual(filename, 'newfile.txt');
      } else {
        assert.strictEqual(filename, null);
      }
      watcher.close();
    }));

  setImmediate(function() {
    const fd = fs.openSync(filepath, 'w');
    fs.closeSync(fd);
  });

}

// https://github.com/joyent/node/issues/2293 - non-persistent watcher should
// not block the event loop
{
  fs.watch(__filename, { persistent: false }, common.mustNotCall());
}

// Whitebox test to ensure that wrapped FSEvent is safe
// https://github.com/joyent/node/issues/6690
{
  let oldhandle;
  common.expectsInternalAssertion(
    () => {
      const w = fs.watch(__filename, common.mustNotCall());
      oldhandle = w._handle;
      w._handle = { close: w._handle.close };
      w.close();
    },
    'handle must be a FSEvent'
  );
  oldhandle.close(); // clean up
}


text:
Thank you in advance for being a part of this project and for helping to make HyperGrid the most performant and customizable grid available!

## Beginners

We have several beginner [issues](https://github.com/fin-hypergrid/core/issues) open for community involvement. Feel free to look all issues, especially those with the label "help wanted". Please ignore those with the label "on-hold" as the scope of these issues may change.

## HyperGrid Core vs UserLand

* Please see our [architectural overview](https://github.com/fin-hypergrid/core/blob/master/OVERVIEW.md)

## Getting Started

* Create a [GitHub account](https://github.com/signup/free)
* Fork the repository on GitHub

## Building & Interactive Development

```bash
$ git clone <your fork>
$ node -v # at least:
v5.1.0
$ npm -v # at least:
3.3.12
$ # We recommend using nvm to manage your versions of node and npm.
$ npm install -g gulp
$ npm install
$ gulp
```

## Making Changes

* Create a topic branch from where you want to base your work.
 * This is usually the `develop` branch.
 * Name your branch with a qualifier (IMPRV, DOCS, BUG, FEATURE, POC) followed by a forward slash and then some info about your branch.
        i.e. *IMPRV/Removed-unused-code*
  * Please avoid working directly on the `master` or `develop` branches.
* Make commits of logical units and squash your commits as needed to facilitate that
* Please *rebase* your work on top develop as needed so that your commits are seen as a fast-forward (and please fix any merge conflicts)
* Check for unnecessary whitespace with `git diff --check` before committing.
* For commit messages, please use full sentences and a brief explanation of what you accomplished.
 * The following example message is adopted from Puppet's labs sample commit.

```
    Make the example in CONTRIBUTING imperative and concrete

    Without this patch applied the example commit message in the CONTRIBUTING
    document is not a concrete example.  This is a problem because the
    contributor is left to imagine what the commit message should look like
    based on a description rather than an example.  This patch fixes the
    problem by making the example concrete and imperative.
```

* Make sure you have added the necessary [tests](https://github.com/fin-hypergrid/core/tree/master/test) for your changes.
* Run _all_ the tests to assure nothing else was accidentally broken.
* Test your changes in all IE10+, Safari, Chrome, Chrome 40, Firefox
* We are evaluating different testing strategies but for the moment, the major considerations are for
 * renders datacells when it is bound to homogenous data array
 * scrolls/arrow-key navigates cell-by-cell
 * uses less than 7% CPU when idle
 * can use html5 controls to edit the data already loaded
 * can draw customized renderers in cells performantly
 * resizes based on its viewport
 * can align fonts or unicode characters left, center or middle horizontally
 * the grid can pass the raw data it recieved through a customized data transformation pipeline
 * Columns can be resized

## Documentation

Code should be as self-explanatory as possible by using well-considered variable names; additional variables for intermediate values instead of unexplained subexpressions; clear, logical flow; parallel structure; etc.
Use comments only to explain any remaining subtleties.

On the other hand, we do believe in good usage of jsdocs _especially_ if your updating a public api call.
Here is an example of a [tutorial](http://fin-hypergrid.github.io/core/doc/tutorial-cell-editors.html)

## Submitting Changes

* Push your changes to a topic branch in your fork of the repository.
* Submit a pull request to the [`core` repository in the `fin-hypergrid` organization](https://github.com/fin-hypergrid/core/compare).
* Do not submit until ready to publish — and then hold off a bit longer until you feel certain you are not submitting prematurely. If you find you absolutely must update a pull request, you must leave an explanatory comment. Updating will delay merging your PR if we have to review it again. Please try to avoid doing this (by not submitting too early; see above).
* The core team looks at Pull Requests on a regular basis within a three-week sprint cycle.
* If your PR is accepted, congratulations!!
    * We will label it as `Reviewed` add your submission notes to our release notes.

## Our Release Workflow

* We follow [Traditional GitFlow](http://danielkummer.github.io/git-flow-cheatsheet/)
* Changes added in develop branch are considered ready to go to alpha at any point
* If your PR is still withstanding please keep the above in mind
* Once we decide to create an alpha candidate the changes are merged to the alpha branch as such

```
git checkout alpha
git diff old-develop develop | git apply
git add .
git commit -m 'roll-up of PRs …'
git tag v0.0.0-alpha -m 'MM/DD/YYYY'
git push —follow-tags upstream alpha
```
* This candidate branch is open for community testing.
* Once we decide to go to **master** the following occurs

```
git chekout master
git fetch upstream master
git checkout alpha
git fetch upstream alpha
git merge master #-s ours may override Readme changes on master
git upstream alpha
# PR is merged occurs!
git checkout master
git pull upstream master
git tag v0.0.0 -m 'MM/DD/YYYY'
git push —follow-tags upstream master
./gh-pages.sh #update CDN Demos
npm publish
```
* Rinse and Repeat!

## Additional Resources

Feel free to open [issues](https://github.com/fin-hypergrid/core/issues/new).


text:
package org.elasticsearch.index.engine;

/**
 * Simple Engine Factory
 */
@FunctionalInterface
public interface EngineFactory {

    Engine newReadWriteEngine(EngineConfig config);

}


text:
//******************************************************************************************************
//  WriteProcessorSettings.cs - Gbtc
//
//  Copyright © 2014, Grid Protection Alliance.  All Rights Reserved.
//
//  Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
//  the NOTICE file distributed with this work for additional information regarding copyright ownership.
//  The GPA licenses this file to you under the MIT License (MIT), the "License"; you may
//  not use this file except in compliance with the License. You may obtain a copy of the License at:
//
//      http://opensource.org/licenses/MIT
//
//  Unless agreed to in writing, the subject software distributed under the License is distributed on an
//  "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
//  License for the specific language governing permissions and limitations.
//
//  Code Modification History:
//  ----------------------------------------------------------------------------------------------------
//  10/03/2014 - Steven E. Chisholm
//       Generated original version of source code.
//
//
//******************************************************************************************************

using System;
using System.Data;
using GSF.IO;
using System.IO;
using GSF.Immutable;

namespace GSF.Snap.Services.Writer
{
    /// <summary>
    /// The settings for the Write Processor
    /// </summary>
    public class WriteProcessorSettings
        : SettingsBase<WriteProcessorSettings>
    {
        private bool m_isEnabled;
        private readonly PrebufferWriterSettings m_prebufferWriter;
        private readonly FirstStageWriterSettings m_firstStageWriter;
        private readonly ImmutableList<CombineFilesSettings> m_stagingRollovers;

        /// <summary>
        /// The default write processor settings
        /// </summary>
        public WriteProcessorSettings()
        {
            m_isEnabled = false;
            m_prebufferWriter = new PrebufferWriterSettings();
            m_firstStageWriter = new FirstStageWriterSettings();
            m_stagingRollovers = new ImmutableList<CombineFilesSettings>(x =>
            {
                if (x is null)
                    throw new ArgumentNullException("value", "cannot be null");
                return x;
            });
        }

        /// <summary>
        /// The settings for the prebuffer.
        /// </summary>
        public PrebufferWriterSettings PrebufferWriter => m_prebufferWriter;

        /// <summary>
        /// The settings for the first stage writer.
        /// </summary>
        public FirstStageWriterSettings FirstStageWriter => m_firstStageWriter;

        /// <summary>
        /// Contains all of the staging rollovers.
        /// </summary>
        public ImmutableList<CombineFilesSettings> StagingRollovers => m_stagingRollovers;

        /// <summary>
        /// Gets/Sets if writing will be enabled
        /// </summary>
        public bool IsEnabled
        {
            get => m_isEnabled;
            set
            {
                TestForEditable();
                m_isEnabled = false;
            }
        }

        public override void Save(Stream stream)
        {
            stream.Write((byte)1);
            stream.Write(m_isEnabled);
            m_prebufferWriter.Save(stream);
            m_firstStageWriter.Save(stream);
            stream.Write(m_stagingRollovers.Count);
            foreach (CombineFilesSettings stage in m_stagingRollovers)
            {
                stage.Save(stream);
            }
        }

        public override void Load(Stream stream)
        {
            TestForEditable();
            byte version = stream.ReadNextByte();
            switch (version)
            {
                case 1:
                    m_isEnabled = stream.ReadBoolean();
                    m_prebufferWriter.Load(stream);
                    m_firstStageWriter.Load(stream);
                    int cnt = stream.ReadInt32();
                    m_stagingRollovers.Clear();
                    while (cnt > 0)
                    {
                        cnt--;
                        CombineFilesSettings cfs = new CombineFilesSettings();
                        cfs.Load(stream);
                        m_stagingRollovers.Add(cfs);
                    }
                    break;
                default:
                    throw new VersionNotFoundException("Unknown Version Code: " + version);
            }
        }

        public override void Validate()
        {
            if (IsEnabled)
            {
                m_prebufferWriter.Validate();
                m_firstStageWriter.Validate();
                foreach (CombineFilesSettings stage in m_stagingRollovers)
                {
                    stage.Validate();
                }
            }
        }
    }
}


text:
class DatatypeProperty
  # domain is an owl_class object, range an RDF::Resource
  attr_accessor :name, :range, :domain, :attribute_url

  include RdfSerialization

  def initialize(name, range, domain)
    @name = name
    @range = range.is_a?(RDF::Resource) ? range : RDF::Resource.new(range)
    @domain = domain
  end

  def self.from_sample(name, domain, sample)
    return self.new(name, RDF::Literal.new(sample).datatype, domain)
  end

  def self.from_url(url, range, domain)
    name = url.split("/").last.split("#").last
    prop = self.new(name, range, domain)
    prop.attribute_url = url
    return prop
  end

  def url
    return attribute_url || domain.url + "/" + name
  end

  def rdf_statements
    stmts = [
      [resource, RDF.type, RDF::OWL.DatatypeProperty],
      [resource, RDF::RDFS.range, range],
      [resource, RDF::RDFS.label, RDF::Literal.new(name)]
    ]
    stmts << [resource, RDF::RDFS.domain, domain.resource] unless domain.nil?
    return stmts
  end

  def ==(other_object)
    return self.url == other_object.url
  end
end


text:
<?php

namespace TamagotchiBundle\IO\Outputs;

use Doctrine\ORM\NonUniqueResultException;
use TamagotchiBundle\Entity\Tamagotchi;
use TamagotchiBundle\Entity\TamagotchiRepository;
use Gheb\IOBundle\Outputs\AbstractOutput;

/**
 * Class AbstractOutput
 *
 * @author  Grégoire Hébert <gregoire@opo.fr>
 */
abstract class Output extends AbstractOutput
{
    /**
     * @var Tamagotchi
     */
    protected $tamagotchi;

    /**
     * @throws NonUniqueResultException
     */
    protected function getTamagotchi()
    {
        /** @var TamagotchiRepository $repo */
        $repo       = $this->em->getRepository('TamagotchiBundle:Tamagotchi');
        $this->tamagotchi = $repo->findAliveTamagotchi();
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<TITLE>
SpellingParams (Solr 5.0-2012-07-18_13-07-53 API)
</TITLE>

<META NAME="date" CONTENT="2012-07-18">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

org.apache.solr.common.params

Interface SpellingParams

public interface SpellingParams

Parameters used for spellchecking

Since:

solr 1.3

Field Summary

static String
SPELLCHECK_ACCURACY

          Certain spelling implementations may allow for an accuracy setting.

static String
SPELLCHECK_ALTERNATIVE_TERM_COUNT

          The count of suggestions to return for each query term existing in the index and/or dictionary.

static String
SPELLCHECK_BUILD

          Whether to build the index or not.

static String
SPELLCHECK_COLLATE

          Take the top suggestion for each token and create a new query from it

static String
SPELLCHECK_COLLATE_EXTENDED_RESULTS

 Whether to use the Extended Results Format for collations.

static String
SPELLCHECK_COLLATE_PARAM_OVERRIDE

 For use with SPELLCHECK_MAX_COLLATION_TRIES, use this to override any original query parameters
 when issuing test queries.

static String
SPELLCHECK_COUNT

          The count of suggestions to return for each query term not in the index and/or dictionary.

static String
SPELLCHECK_DICT

          The name of the dictionary to be used for giving the suggestion for a
 request.

static String
SPELLCHECK_EXTENDED_RESULTS

          Whether to use the extended response format, which is more complicated but
 richer.

static String
SPELLCHECK_MAX_COLLATION_EVALUATIONS

 The maximum number of word correction combinations to rank and evaluate prior to deciding which collation
 candidates to test against the index.

static String
SPELLCHECK_MAX_COLLATION_TRIES

 The maximum number of collations to test by querying against the index.

static String
SPELLCHECK_MAX_COLLATIONS

 The maximum number of collations to return.

static String
SPELLCHECK_MAX_RESULTS_FOR_SUGGEST

 The maximum number of hits the request can return in order to both
 generate spelling suggestions and set the "correctlySpelled" element to "false".

static String
SPELLCHECK_ONLY_MORE_POPULAR

          When this parameter is set to true and the misspelled word exists in the
 user field, only words that occur more frequently in the Solr field than
 the one given will be returned.

static String
SPELLCHECK_PREFIX

static String
SPELLCHECK_Q

          Use the value for this parameter as the query to spell check.

static String
SPELLCHECK_RELOAD

          Whether to reload the index.

Field Detail

SPELLCHECK_PREFIX

static final String SPELLCHECK_PREFIX

See Also:
Constant Field Values

SPELLCHECK_DICT

static final String SPELLCHECK_DICT

The name of the dictionary to be used for giving the suggestion for a
 request. The value for this parameter is configured in solrconfig.xml

See Also:
Constant Field Values

SPELLCHECK_COUNT

static final String SPELLCHECK_COUNT

The count of suggestions to return for each query term not in the index and/or dictionary.

 If this parameter is absent in the request then only one suggestion is
 returned. If it is more than one then a maximum of given suggestions are
 returned for each token in the query.

See Also:
Constant Field Values

SPELLCHECK_ALTERNATIVE_TERM_COUNT

static final String SPELLCHECK_ALTERNATIVE_TERM_COUNT

The count of suggestions to return for each query term existing in the index and/or dictionary.

 If this parameter is absent in the request then no suggestions are generated.  This parameter allows
 for receiving alternative terms to use in context-sensitive spelling corrections.

See Also:
Constant Field Values

SPELLCHECK_MAX_RESULTS_FOR_SUGGEST

static final String SPELLCHECK_MAX_RESULTS_FOR_SUGGEST

 The maximum number of hits the request can return in order to both
 generate spelling suggestions and set the "correctlySpelled" element to "false".
 Note that this parameter is typically of use only in conjunction with "spellcheck.alternativeTermCount".

 If left unspecified, the default behavior will prevail.  That is, "correctlySpelled" will be false and suggestions
 will be returned only if one or more of the query terms are absent from the dictionary and/or index.  If set to zero,
 the "correctlySpelled" flag will be false only if the response returns zero hits.  If set to a value greater than zero,
 suggestions will be returned even if hits are returned (up to the specified number).  This number also will serve as
 the threshold in determining the value of "correctlySpelled".  Specifying a value greater than zero is useful
 for creating "did-you-mean" suggestions for queries that return a low number of hits.

See Also:
Constant Field Values

SPELLCHECK_ONLY_MORE_POPULAR

static final String SPELLCHECK_ONLY_MORE_POPULAR

When this parameter is set to true and the misspelled word exists in the
 user field, only words that occur more frequently in the Solr field than
 the one given will be returned. The default value is false.

 This is applicable only for dictionaries built from Solr fields.

See Also:
Constant Field Values

SPELLCHECK_EXTENDED_RESULTS

static final String SPELLCHECK_EXTENDED_RESULTS

Whether to use the extended response format, which is more complicated but
 richer. Returns the document frequency for each suggestion and returns one
 suggestion block for each term in the query string. Default is false.

 This is applicable only for dictionaries built from Solr fields.

See Also:
Constant Field Values

SPELLCHECK_Q

static final String SPELLCHECK_Q

Use the value for this parameter as the query to spell check.

 This parameter is optional. If absent, then the q parameter is
 used.

See Also:
Constant Field Values

SPELLCHECK_BUILD

static final String SPELLCHECK_BUILD

Whether to build the index or not. Optional and false by default.

See Also:
Constant Field Values

SPELLCHECK_RELOAD

static final String SPELLCHECK_RELOAD

Whether to reload the index. Optional and false by default.

See Also:
Constant Field Values

SPELLCHECK_COLLATE

static final String SPELLCHECK_COLLATE

Take the top suggestion for each token and create a new query from it

See Also:
Constant Field Values

SPELLCHECK_MAX_COLLATIONS

static final String SPELLCHECK_MAX_COLLATIONS

 The maximum number of collations to return.  Default=1.  Ignored if "spellcheck.collate" is false.

See Also:
Constant Field Values

SPELLCHECK_MAX_COLLATION_TRIES

static final String SPELLCHECK_MAX_COLLATION_TRIES

 The maximum number of collations to test by querying against the index.
 When testing, the collation is substituted for the original query's "q" param.  Any "qf"s are retained.
 If this is set to zero, does not test for hits before returning collations (returned collations may result in zero hits).
 Default=0. Ignored of "spellcheck.collate" is false.

See Also:
Constant Field Values

SPELLCHECK_MAX_COLLATION_EVALUATIONS

static final String SPELLCHECK_MAX_COLLATION_EVALUATIONS

 The maximum number of word correction combinations to rank and evaluate prior to deciding which collation
 candidates to test against the index.  This is a performance safety-net in cases a user enters a query with
 many misspelled words.  The default is 10,000 combinations.

See Also:
Constant Field Values

SPELLCHECK_COLLATE_EXTENDED_RESULTS

static final String SPELLCHECK_COLLATE_EXTENDED_RESULTS

 Whether to use the Extended Results Format for collations.
 Includes "before>after" pairs to easily allow clients to generate messages like "no results for PORK.  did you mean POLK?"
 Also indicates the # of hits each collation will return on re-query.  Default=false, which retains 1.4-compatible output.

See Also:
Constant Field Values

SPELLCHECK_COLLATE_PARAM_OVERRIDE

static final String SPELLCHECK_COLLATE_PARAM_OVERRIDE

 For use with SPELLCHECK_MAX_COLLATION_TRIES, use this to override any original query parameters
 when issuing test queries.  For instance, if the original query has "mm=1" but it is preferred to test collations
 with "mm=100%", then use "spellcheck.collateParam.mm=100%".

See Also:
Constant Field Values

SPELLCHECK_ACCURACY

static final String SPELLCHECK_ACCURACY

Certain spelling implementations may allow for an accuracy setting.

See Also:
Constant Field Values

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

          <address>Copyright © 2000-2012 Apache Software Foundation.  All Rights Reserved.</address>


text:
/* The following functions must be written in ARM mode */
/* these functions are called directly by an exception vector */

/*------------------------------------------------------------------------------ */
/*         Internal functions */
/*------------------------------------------------------------------------------ */
/*------------------------------------------------------------------------------ */
/* Default spurious interrupt handler. Infinite loop. */
/*------------------------------------------------------------------------------ */
void AT91F_Spurious_handler(
    void)
{
    while (1);
}

/*------------------------------------------------------------------------------ */
/* Default handler for fast interrupt requests. Infinite loop. */
/*------------------------------------------------------------------------------ */
void AT91F_Default_FIQ_handler(
    void)
{
    while (1);
}

/*------------------------------------------------------------------------------ */
/* Default handler for standard interrupt requests. Infinite loop. */
/*------------------------------------------------------------------------------ */
void AT91F_Default_IRQ_handler(
    void)
{
    while (1);
}


text:
A typical Pachyderm workflow involves multiple iterations of
experimenting with your code and pipeline specs.

!!! info
    Before you read this section, make sure that you
    understand basic Pachyderm pipeline concepts described in
    [Concepts](../../concepts/pipeline-concepts/index.md).

In general, there are five steps to working with a pipeline. The stages can be summarized in the image below.

![Developer workflow](../../assets/images/d_steps_analysis_pipeline.svg)

We'll walk through each of the stages in detail.

## Step 1: Write Your Analysis Code

Because Pachyderm is completely language-agnostic, the code
that is used to process data in Pachyderm can
be written in any language and can use any libraries of choice. Whether
your code is as simple as a bash command or as complicated as a
TensorFlow neural network, it needs to be built with all the required
dependencies into a container that can run anywhere, including inside
of Pachyderm. See [Examples](https://github.com/pachyderm/pachyderm/tree/1.13.x/examples).

Your code does not have to import any special Pachyderm
functionality or libraries. However, it must meet the
following requirements:

* **Read files from a local file system**. Pachyderm automatically
  mounts each input data repository as `/pfs/<repo_name>` in the running
  containers of your Docker image. Therefore, the code that you write needs
  to read input data from this directory, similar to any other
  file system.

  Because Pachyderm automatically spreads data across parallel
  containers, your analysis code does not have to deal with data
  sharding or parallelization. For example, if you have four
  containers that run your Python code, Pachyderm automatically
  supplies 1/4 of the input data to `/pfs/<repo_name>` in
  each running container. These workload balancing settings
  can be adjusted as needed through Pachyderm tunable parameters
  in the pipeline specification.

* **Write files into a local file system**, such as saving results.
  Your code must write to the `/pfs/out` directory that Pachyderm
  mounts in all of your running containers. Similar to reading data,
  your code does not have to manage parallelization or sharding.

## Step 2: Build Your Docker Image

When you create a Pachyderm pipeline, you need
to specify a Docker image that includes the code or binary that
you want to run. Therefore, every time you modify your code,
you need to build a new Docker image, push it to your image registry,
and update the image tag in the pipeline spec. This section
describes one way of building Docker images, but
if you have your own routine, feel free to apply it.

To build an image, you need to create a `Dockerfile`. However, do not
use the `CMD` field in your `Dockerfile` to specify the commands that
you want to run. Instead, you add them in the `cmd` field in your pipeline
specification. Pachyderm runs these commands inside the
container during the job execution rather than relying on Docker
to run them.
The reason is that Pachyderm cannot execute your code immediately when
your container starts, so it runs a shim process in your container
instead, and then, it calls your pipeline specification's `cmd` from there.

!!! note
    The `Dockerfile` example below is provided for your reference
    only. Your `Dockerfile` might look completely different.

To build a Docker image, complete the following steps:

1. If you do not have a registry, create one with a preferred provider.
If you decide to use DockerHub, follow the [Docker Hub Quickstart](https://docs.docker.com/docker-hub/) to
create a repository for your project.
1. Create a `Dockerfile` for your project. See the [OpenCV example](https://github.com/pachyderm/pachyderm/blob/1.13.x/examples/opencv/Dockerfile).
1. Build a new image from the `Dockerfile` by specifying a tag:

   ```shell
   docker build -t <IMAGE>:<TAG> .
   ```

For more information about building Docker images, see
[Docker documentation](https://docs.docker.com/engine/tutorials/dockerimages/).

## Step 3: Push Your Docker Image to a Registry

After building your image, you need to upload the image into
a public or private image registry, such as
[DockerHub](https://hub.docker.com).

Alternatively, you can use the Pachyderm's built-in functionality to
tag, build, and push images by running the `pachctl update pipeline` command
with the `--build` flag. For more information, see
[Update a pipelines](../pipeline-operations/updating_pipelines.md).

1. Log in to an image registry.

   * If you use DockerHub, run:

     ```shell
     docker login --username=<dockerhub-username> --password=<dockerhub-password> <dockerhub-fqdn>
     ```

1. Push your image to your image registry.

   * If you use DockerHub, run:

     ```shell
     docker push <image>:tag
     ```

!!! note
    Pipelines require a unique tag to ensure the appropriate image is pulled. If a floating tag, such as `latest`, is used, the Kubernetes cluster may become out of sync with the Docker registry, concluding it already has the `latest` image.

## Step 4: Create/Edit the Pipeline Config

Pachyderm's pipeline specifications store the configuration information
about the Docker image and code that Pachyderm should run. Pipeline
specifications are stored in JSON or YAML format.

A standard pipeline specification must include the following
parameters:

- `name`
- `transform`
- `parallelism`
- `input`

!!! note
    Some special types of pipelines, such as a spout pipeline, do not
    require you to specify all of these parameters.

You can store your pipeline locally or in a remote location, such
as a GitHub repository.

To create a Pipeline, complete the following steps:

1. Create a pipeline specification. Here is an example of a pipeline
   spec:

   ```shell
   # my-pipeline.json
   {
     "pipeline": {
       "name": "my-pipeline"
     },
     "transform": {
       "image": "<image>:<tag>",
       "cmd": ["/binary", "/pfs/data", "/pfs/out"]
     },
     "input": {
         "pfs": {
           "repo": "data",
           "glob": "/*"
         }
     }
   }
   ```

!!! note "See Also:"
    - [Pipeline Specification](../../reference/pipeline_spec.md)

## Step 5: Deploy/Update the Pipeline

As soon as you create a pipeline, Pachyderm immediately spins up one or more Kubernetes pods in which the pipeline code runs. By default, after the pipeline finishes
running, the pods continue to run while waiting for the new data to be
committed into the Pachyderm input repository. You can configure this
parameter, as well as many others, in the pipeline specification.

1. Create a Pachyderm pipeline from the spec:

   ```shell
   pachctl create pipeline -f my-pipeline.json
   ```

   You can specify a local file or a file stored in a remote
   location, such as a GitHub repository. For example,
   `https://raw.githubusercontent.com/pachyderm/pachyderm/1.13.x/examples/opencv/edges.json`.
1. If your pipeline specification changes, you can update the pipeline
   by running

   ```shell
   pachctl create pipeline -f my-pipeline.json
   ```

!!! note "See Also:"
  - [Updating Pipelines](../pipeline-operations/updating_pipelines.md)
<!-- - [Running Pachyderm in Production](TBA)-->


text:
import { SalesforceId } from './salesforce-id';

export interface SObjectOptions {
    Id?: SalesforceId | undefined;
    Name?: string | undefined;
    ExtId__c?: string | undefined;
}


text:
<?php

namespace Bookapp\Bundle\BookBundle\Controller;

use Bookapp\Bundle\BookBundle\Entity\Category;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

class CategoryController extends Controller
{
    /**
     * liste les categories avec bouton supprimer
     *
     * @return \Symfony\Component\HttpFoundation\Response
     *
     */
    public function indexAction()
    {
        $em = $this->getDoctrine()->getManager();
        $CategoryCollection = $em->getRepository('BookappBookBundle:Category')->findAll();

        return $this->render(
            'BookappBookBundle:Category:index.html.twig',
            array("CategoryCollection" => $CategoryCollection)
        );
    }

    /**
     * @param Request $request
     *
     * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
     */
    public function addAction(Request $request)
    {
        $category = new Category();
        $form = $this->createForm('category', $category);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($category);
            $em->flush();

            return $this->redirect($this->generateUrl('bookapp_book_category'));
        }

        return $this->render(
            'BookappBookBundle:Category:add.html.twig',
            array(
                'form' => $form->createView(),
            )
        );
    }

    /**
     * @param $id
     *
     * @return \Symfony\Component\HttpFoundation\RedirectResponse
     * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
     */
    public function delAction($id)
    {

        $em = $this->getDoctrine()->getManager();
        $category = $em->getRepository('BookappBookBundle:Category')->find($id);

        if (!$category) {
            throw $this->createNotFoundException(
                'Aucune categorie trouvée pour cet id : ' . $id
            );
        }

        $em->remove($category);
        $em->flush();

        return $this->redirect($this->generateUrl('bookapp_book_category'));
    }

    /**
     * @param $id
     *
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function readBookAction($id){
        $user = $this->get('security.token_storage')->getToken()->getUser();
        $em = $this->getDoctrine()->getManager();
        $category = $em->getRepository('BookappBookBundle:Category')->find($id);
        $bookCollection = $em->getRepository('BookappBookBundle:Book')->findAllByUserByCategory($user, $category);

        return $this->render(
            'BookappBookBundle:Category:read.html.twig',
            array("BookCollection" => $bookCollection)
        );
    }

}


text:
require File.dirname(__FILE__) + '/../../spec_helper'
require File.dirname(__FILE__) + '/fixtures/classes'

describe "StringIO#truncate" do
  before(:each) do
    @io = StringIO.new('123456789')
  end

  # TODO - ri error - says truncate always returns 0
  it "truncates the underlying string" do
    @io.truncate(4).should == 4
    @io.string.should == '1234'
  end

  it "does not update the position" do
    @io.read(5)
    @io.truncate(3)
    @io.pos.should == 5
  end
end


text:
  if (!(condition)) { \
    fprintf(stderr, "FAIL: %s @ %s:%d\n", #condition, __FILE__, __LINE__); \
    return false; \
  }

#define ASSERT_EQ(e1, e2) ASSERT_TRUE((e1) == (e2))

namespace {

using google_breakpad::PathnameStripper;

static bool RunTests() {
  ASSERT_EQ(PathnameStripper::File("/dir/file"), "file");
  ASSERT_EQ(PathnameStripper::File("\\dir\\file"), "file");
  ASSERT_EQ(PathnameStripper::File("/dir\\file"), "file");
  ASSERT_EQ(PathnameStripper::File("\\dir/file"), "file");
  ASSERT_EQ(PathnameStripper::File("dir/file"), "file");
  ASSERT_EQ(PathnameStripper::File("dir\\file"), "file");
  ASSERT_EQ(PathnameStripper::File("dir/\\file"), "file");
  ASSERT_EQ(PathnameStripper::File("dir\\/file"), "file");
  ASSERT_EQ(PathnameStripper::File("file"), "file");
  ASSERT_EQ(PathnameStripper::File("dir/"), "");
  ASSERT_EQ(PathnameStripper::File("dir\\"), "");
  ASSERT_EQ(PathnameStripper::File("dir/dir/"), "");
  ASSERT_EQ(PathnameStripper::File("dir\\dir\\"), "");
  ASSERT_EQ(PathnameStripper::File("dir1/dir2/file"), "file");
  ASSERT_EQ(PathnameStripper::File("dir1\\dir2\\file"), "file");
  ASSERT_EQ(PathnameStripper::File("dir1/dir2\\file"), "file");
  ASSERT_EQ(PathnameStripper::File("dir1\\dir2/file"), "file");
  ASSERT_EQ(PathnameStripper::File(""), "");
  ASSERT_EQ(PathnameStripper::File("1"), "1");
  ASSERT_EQ(PathnameStripper::File("1/2"), "2");
  ASSERT_EQ(PathnameStripper::File("1\\2"), "2");
  ASSERT_EQ(PathnameStripper::File("/1/2"), "2");
  ASSERT_EQ(PathnameStripper::File("\\1\\2"), "2");
  ASSERT_EQ(PathnameStripper::File("dir//file"), "file");
  ASSERT_EQ(PathnameStripper::File("dir\\\\file"), "file");
  ASSERT_EQ(PathnameStripper::File("/dir//file"), "file");
  ASSERT_EQ(PathnameStripper::File("\\dir\\\\file"), "file");
  ASSERT_EQ(PathnameStripper::File("c:\\dir\\file"), "file");
  ASSERT_EQ(PathnameStripper::File("c:\\dir\\file.ext"), "file.ext");

  return true;
}

}  // namespace

int main(int argc, char **argv) {
  BPLOG_INIT(&argc, &argv);

  return RunTests() ? 0 : 1;
}


text:
import pytest

from .common import WpsTestClient, TESTDATA, assert_response_success

@pytest.mark.skip(reason="no way of currently testing this")
def test_wps_indices_percentile():
    wps = WpsTestClient()
    datainputs = "[resource={0};resource={1};indices=TX;percentile=90]".format(
        TESTDATA['cordex_tasmax_2006_nc'], TESTDATA['cordex_tasmax_2007_nc'])
    resp = wps.get(service='wps', request='execute', version='1.0.0',
                   identifier='indices_percentile',
                   datainputs=datainputs)
    assert_response_success(resp)


text:
<?php

namespace UAParser\Test;

use PHPUnit\Framework\TestCase;

abstract class AbstractTestCase extends TestCase
{
    /**
     * Compatibility layer for PHPUnit 6+ to support PHPUnit 4 code.
     *
     * @param mixed $class
     *   The expected exception class.
     * @param string $message
     *   The expected exception message.
     * @param int $exception_code
     *   The expected exception code.
     */
    public function setExpectedException($class, $message = '', $exception_code = NULL)
    {
        if (method_exists($this, 'expectException')) {
            $this->expectException($class);
            if (!empty($message)) {
                $this->expectExceptionMessage($message);
            }
            if ($exception_code !== NULL) {
                $this->expectExceptionCode($exception_code);
            }
        } else {
            parent::setExpectedException($class, $message, $exception_code);
        }
    }
}


text:
<!DOCTYPE html>

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <title>Break On Null Test</title>

  <link rel="stylesheet" type="text/css" href="../jquery.jqplot.css" />
  <link rel="stylesheet" type="text/css" href="examples.css" />

<?php include "nav.inc"; ?>


text:
class hkbStringEventPayload;

class BSDistTriggerModifier final: public hkbModifier
{
    friend class BSDistTriggerModifierUI;
public:
    BSDistTriggerModifier(HkxFile *parent, long ref = 0);
    BSDistTriggerModifier& operator=(const BSDistTriggerModifier&) = delete;
    BSDistTriggerModifier(const BSDistTriggerModifier &) = delete;
    ~BSDistTriggerModifier();
public:
    QString getName() const;
    static const QString getClassname();
private:
    void setName(const QString &newname);
    bool getEnable() const;
    void setEnable(bool value);
    hkQuadVariable getTargetPosition() const;
    void setTargetPosition(const hkQuadVariable &value);
    qreal getDistance() const;
    void setDistance(const qreal &value);
    qreal getDistanceTrigger() const;
    void setDistanceTrigger(const qreal &value);
    hkbStringEventPayload * getTriggerEventPayload() const;
    int getTriggerEventID() const;
    void setTriggerEventID(int value);
    void setTriggerEventPayload(hkbStringEventPayload *value);
    bool readData(const HkxXmlReader & reader, long & index);
    bool link();
    void unlink();
    QString evaluateDataValidity();
    bool write(HkxXMLWriter *writer);
    bool isEventReferenced(int eventindex) const;
    void updateEventIndices(int eventindex);
    void mergeEventIndex(int oldindex, int newindex);
    void fixMergedEventIndices(BehaviorFile *dominantfile);
    void updateReferences(long &ref);
    QVector <HkxObject *> getChildrenOtherTypes() const;
    bool merge(HkxObject *recessiveObject);
private:
    static uint refCount;
    static const QString classname;
    long userData;
    QString name;
    bool enable;
    hkQuadVariable targetPosition;
    qreal distance;
    qreal distanceTrigger;
    hkEventPayload triggerEvent;
    mutable std::mutex mutex;
};

#endif // BSDISTTRIGGERMODIFIER_H


text:
import prompt from "../utils/prompt";
import addStep from "../utils/add-step";
import request from "../utils/request";
import {randomBytes} from "crypto";

async function fetchOTP() {
	return (await prompt([{
		type: "input",
		name: "code",
		message: "What is your GitHub two-factor authentication code?"
	}])).code;
}

async function authorize(auth, note, otp, retry) {
	let [resp,body] = await request({
		method: "POST",
		url: "https://api.github.com/authorizations",
		json: true,
		auth,
		headers: {
			"User-Agent": "autorelease",
			"X-GitHub-OTP": otp
		},
		body: {
			scopes: [
				"repo",
				"read:org",
				"user:email",
				"write:repo_hook"
			],
			note: note
		}
	});

	if (resp.statusCode === 201) return body.token;

	if (resp.statusCode === 401 && resp.headers["x-github-otp"]) {
		const type = resp.headers["x-github-otp"].split('; ')[1];

		if (retry) {
			console.warn("Invalid two-factor authentication code.");
		} else {
			console.warn(`Two-factor authentication code needed via ${type}.`);
		}

		return await authorize(auth, note, await fetchOTP(), true);
	}

	throw new Error("Could not login to GitHub.");
}

export default async function(ctx) {
	let auth = await prompt([{
		type: "input",
		name: "username",
		message: "What is your GitHub username?"
		// default: conf.get("username")
	}, {
		type: "password",
		name: "password",
		message: "What is your GitHub password?"
		// when: function (answers) {
		//	 if (!info.options.keychain) return true
		//	 if (info.options["ask-for-passwords"]) return true
		//	 return !passwordStorage.get(answers.username)
		// }
	}]);

	let {owner,name} = ctx.repository;
	let token = await authorize(auth, `autorelease-${owner}-${name}-${randomBytes(4).toString("hex")}`);

	ctx.env.GH_TOKEN = token;
	ctx.install.push("autorelease-github");
	addStep(ctx, "pre", "verify", "autorelease-github/verify");
	addStep(ctx, "post", "publishChangelog", "autorelease-github/create-release");
}


text:
package org.stagemonitor.requestmonitor.reporter;

import org.stagemonitor.core.StagemonitorSPI;
import org.stagemonitor.core.configuration.Configuration;
import org.stagemonitor.requestmonitor.RequestTrace;

public abstract class RequestTraceReporter implements StagemonitorSPI {

	public void init(InitArguments initArguments) {
	}

	/**
	 * Callback method that is called when a {@link RequestTrace} was created and is ready to be reported
	 *
	 * @param reportArguments
	 */
	public abstract void reportRequestTrace(ReportArguments reportArguments) throws Exception;

	/**
	 * Whether this {@link RequestTraceReporter} is active
	 *

	 * This method is called at most once from {@link org.stagemonitor.requestmonitor.RequestMonitor} for one request.
	 * That means that the result from the first evaluation is final.
	 *
	 * @return true, if this {@link RequestTraceReporter} is active, false otherwise
	 * @param isActiveArguments
	 */
	public abstract boolean isActive(IsActiveArguments isActiveArguments);

	public void close(CloseArguments initArguments) {
	}

	public static class InitArguments {
		private final Configuration configuration;

		public InitArguments(Configuration configuration) {
			this.configuration = configuration;
		}

		public Configuration getConfiguration() {
			return configuration;
		}
	}

	public static class CloseArguments {
	}

	public static class IsActiveArguments {
		private final RequestTrace requestTrace;

		public IsActiveArguments(RequestTrace requestTrace) {
			this.requestTrace = requestTrace;
		}

		public RequestTrace getRequestTrace() {
			return requestTrace;
		}
	}

	public static class ReportArguments {
		private final RequestTrace requestTrace;

		/**
		 * @param requestTrace the {@link RequestTrace} of the current request
		 */
		public ReportArguments(RequestTrace requestTrace) {
			this.requestTrace = requestTrace;
		}

		public RequestTrace getRequestTrace() {
			return requestTrace;
		}
	}
}


text:
package org.apache.jackrabbit.oak.plugins.document.mongo;

import java.util.List;
import java.util.Set;

import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.base.StandardSystemProperty;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.mongodb.BasicDBObject;
import com.mongodb.DBCollection;
import com.mongodb.DBCursor;
import com.mongodb.DBObject;
import com.mongodb.QueryBuilder;
import com.mongodb.ReadPreference;
import org.apache.jackrabbit.oak.plugins.document.Document;
import org.apache.jackrabbit.oak.plugins.document.NodeDocument;
import org.apache.jackrabbit.oak.plugins.document.SplitDocumentCleanUp;
import org.apache.jackrabbit.oak.plugins.document.VersionGCSupport;
import org.apache.jackrabbit.oak.plugins.document.VersionGarbageCollector.VersionGCStats;
import org.apache.jackrabbit.oak.plugins.document.util.CloseableIterable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static com.google.common.collect.Iterables.transform;
import static com.mongodb.QueryBuilder.start;
import static org.apache.jackrabbit.oak.plugins.document.Collection.NODES;
import static org.apache.jackrabbit.oak.plugins.document.NodeDocument.SplitDocType;

/**
 * Mongo specific version of VersionGCSupport which uses mongo queries
 * to fetch required NodeDocuments
 *
 *
Version collection involves looking into old record and mostly unmodified
 * documents. In such case read from secondaries are preferred

 */
public class MongoVersionGCSupport extends VersionGCSupport {
    private static final Logger LOG = LoggerFactory.getLogger(MongoVersionGCSupport.class);
    private final MongoDocumentStore store;
    /**
     * Disables the index hint sent to MongoDB.
     */
    private final boolean disableIndexHint =
            Boolean.getBoolean("oak.mongo.disableVersionGCIndexHint");

    public MongoVersionGCSupport(MongoDocumentStore store) {
        super(store);
        this.store = store;
    }

    @Override
    public CloseableIterable<NodeDocument> getPossiblyDeletedDocs(final long lastModifiedTime) {
        //_deletedOnce == true && _modified < lastModifiedTime
        DBObject query =
                start(NodeDocument.DELETED_ONCE).is(Boolean.TRUE)
                                .put(NodeDocument.MODIFIED_IN_SECS).lessThan(NodeDocument.getModifiedInSecs(lastModifiedTime))
                        .get();
        DBCursor cursor = getNodeCollection().find(query).setReadPreference(ReadPreference.secondaryPreferred());
        if (!disableIndexHint) {
            cursor.hint(new BasicDBObject(NodeDocument.DELETED_ONCE, 1));
        }

        return CloseableIterable.wrap(transform(cursor, new Function<DBObject, NodeDocument>() {
            @Override
            public NodeDocument apply(DBObject input) {
                return store.convertFromDBObject(NODES, input);
            }
        }), cursor);
    }

    @Override
    protected SplitDocumentCleanUp createCleanUp(Set<SplitDocType> gcTypes,
                                                 long oldestRevTimeStamp,
                                                 VersionGCStats stats) {
        return new MongoSplitDocCleanUp(gcTypes, oldestRevTimeStamp, stats);
    }

    @Override
    protected Iterable<NodeDocument> identifyGarbage(final Set<SplitDocType> gcTypes,
                                                     final long oldestRevTimeStamp) {
        return transform(getNodeCollection().find(createQuery(gcTypes, oldestRevTimeStamp)),
                new Function<DBObject, NodeDocument>() {
            @Override
            public NodeDocument apply(DBObject input) {
                return store.convertFromDBObject(NODES, input);
            }
        });
    }

    private DBObject createQuery(Set<SplitDocType> gcTypes,
                                 long oldestRevTimeStamp) {
        //OR condition has to be first as we have a index for that
        //((type == DEFAULT_NO_CHILD || type == PROP_COMMIT_ONLY ..) && _sdMaxRevTime < oldestRevTimeStamp(in secs)
        QueryBuilder orClause = start();
        for(SplitDocType type : gcTypes){
            orClause.or(start(NodeDocument.SD_TYPE).is(type.typeCode()).get());
        }
        return start()
                .and(
                        orClause.get(),
                        start(NodeDocument.SD_MAX_REV_TIME_IN_SECS)
                                .lessThan(NodeDocument.getModifiedInSecs(oldestRevTimeStamp))
                                .get()
                ).get();
    }

    private void logSplitDocIdsTobeDeleted(DBObject query) {
        // Fetch only the id
        final BasicDBObject keys = new BasicDBObject(Document.ID, 1);
        List<String> ids;
        DBCursor cursor = getNodeCollection().find(query, keys)
                .setReadPreference(store.getConfiguredReadPreference(NODES));
        try {
             ids = ImmutableList.copyOf(Iterables.transform(cursor, new Function<DBObject, String>() {
                 @Override
                 public String apply(DBObject input) {
                     return (String) input.get(Document.ID);
                 }
             }));
        } finally {
            cursor.close();
        }
        StringBuilder sb = new StringBuilder("Split documents with following ids were deleted as part of GC \n");
        Joiner.on(StandardSystemProperty.LINE_SEPARATOR.value()).appendTo(sb, ids);
        LOG.debug(sb.toString());
    }

    private DBCollection getNodeCollection(){
        return store.getDBCollection(NODES);
    }

    private class MongoSplitDocCleanUp extends SplitDocumentCleanUp {

        protected final Set<SplitDocType> gcTypes;
        protected final long oldestRevTimeStamp;

        protected MongoSplitDocCleanUp(Set<SplitDocType> gcTypes,
                                       long oldestRevTimeStamp,
                                       VersionGCStats stats) {
            super(MongoVersionGCSupport.this.store, stats,
                    identifyGarbage(gcTypes, oldestRevTimeStamp));
            this.gcTypes = gcTypes;
            this.oldestRevTimeStamp = oldestRevTimeStamp;
        }

        @Override
        protected int deleteSplitDocuments() {
            DBObject query = createQuery(gcTypes, oldestRevTimeStamp);

            if(LOG.isDebugEnabled()){
                //if debug level logging is on then determine the id of documents to be deleted
                //and log them
                logSplitDocIdsTobeDeleted(query);
            }

            return getNodeCollection().remove(query).getN();
        }
    }
}


text:
"""user details and sex required

Revision ID: a56d50e5cbc4
Revises: 7d4bab0acebb
Create Date: 2017-09-14 16:36:05.071303

"""
from alembic import op
import sqlalchemy as sa

# revision identifiers, used by Alembic.
revision = 'a56d50e5cbc4'
down_revision = '7d4bab0acebb'
branch_labels = None
depends_on = None

def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('patients', 'sex',
               existing_type=sa.VARCHAR(length=1),
               nullable=False)
    op.alter_column('users', 'f_name',
               existing_type=sa.VARCHAR(length=50),
               nullable=False)
    op.alter_column('users', 'l_name',
               existing_type=sa.VARCHAR(length=50),
               nullable=False)
    # ### end Alembic commands ###

def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('users', 'l_name',
               existing_type=sa.VARCHAR(length=50),
               nullable=True)
    op.alter_column('users', 'f_name',
               existing_type=sa.VARCHAR(length=50),
               nullable=True)
    op.alter_column('patients', 'sex',
               existing_type=sa.VARCHAR(length=1),
               nullable=True)
    # ### end Alembic commands ###


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>SKRouteRestrictions (SKMaps Framework)</title>
<meta name="date" content="2016-10-27">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.skobbler.ngx.routing

Class SKRouteRestrictions

java.lang.Object

com.skobbler.ngx.routing.SKRouteRestrictions

public class SKRouteRestrictions
extends java.lang.Object

Constructor Summary

Constructors

Constructor and Description

SKRouteRestrictions()

Method Summary

Methods

Modifier and Type
Method and Description

boolean
isBicycleCarryAvoided()

boolean
isBicycleWalkAvoided()

boolean
isFerriesAvoided()

boolean
isHighWaysAvoided()

boolean
isTollRoadsAvoided()

void
setBicycleCarryAvoided(boolean bicycleCarryAvoided)

Sets a boolean that indicates whether to avoid carrying the bicycle.

void
setBicycleWalkAvoided(boolean bicycleWalkAvoided)

Sets a boolean that indicates whether to avoid walking by the bicycle in
 bicycle routing.

void
setFerriesAvoided(boolean ferriesAvoided)

Sets a boolean that indicates whether to avoid ferries when calculating
 the route.

void
setHighWaysAvoided(boolean highWaysAvoided)

Sets a boolean that indicates whether to avoid highways roads when
 calculating the route.

void
setTollRoadsAvoided(boolean tollRoadsAvoided)

Sets a boolean that indicates whether to avoid toll roads when
 calculating the route.

java.lang.String
toString()

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail

SKRouteRestrictions

public SKRouteRestrictions()

Method Detail

setTollRoadsAvoided

public void setTollRoadsAvoided(boolean tollRoadsAvoided)

Sets a boolean that indicates whether to avoid toll roads when
 calculating the route.

Parameters:

tollRoadsAvoided -

isTollRoadsAvoided

public boolean isTollRoadsAvoided()

Returns:

Returns a boolean that indicates whether to avoid toll roads when
 calculating the route.

isHighWaysAvoided

public boolean isHighWaysAvoided()

Returns:

Returns a boolean that indicates whether to avoid highways roads
 when calculating the route.

setHighWaysAvoided

public void setHighWaysAvoided(boolean highWaysAvoided)

Sets a boolean that indicates whether to avoid highways roads when
 calculating the route.

Parameters:

highWaysAvoided -

isFerriesAvoided

public boolean isFerriesAvoided()

Returns:

Returns a boolean that indicates whether to avoid ferries when
 calculating the route.

setFerriesAvoided

public void setFerriesAvoided(boolean ferriesAvoided)

Sets a boolean that indicates whether to avoid ferries when calculating
 the route.

Parameters:

ferriesAvoided -

isBicycleWalkAvoided

public boolean isBicycleWalkAvoided()

Returns:

Returns a boolean that indicates whether to avoid walking by the
 bicycle in bicycle routing.

setBicycleWalkAvoided

public void setBicycleWalkAvoided(boolean bicycleWalkAvoided)

Sets a boolean that indicates whether to avoid walking by the bicycle in
 bicycle routing.

isBicycleCarryAvoided

public boolean isBicycleCarryAvoided()

Returns:

Returns a boolean that indicates whether carrying the bicycle is
 avoided.

setBicycleCarryAvoided

public void setBicycleCarryAvoided(boolean bicycleCarryAvoided)

Sets a boolean that indicates whether to avoid carrying the bicycle.

Parameters:

bicycleCarryAvoided -

toString

public java.lang.String toString()

Overrides:

toString in class java.lang.Object

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

			Copyright &#169 2014  skobbler GmbH, Luisenstr. 41, 10117 Berlin, Germany. All rights reserved.


text:
package org.smof;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;

@SuppressWarnings("javadoc")
@RunWith(Suite.class)
@SuiteClasses({ BasicSmofTest.class, ElementTypeFactoryTest.class, ObjectInheritanceTest.class })
public class AllTests {
	//no code necessary
}


text:
module.exports = {
  // this really improves diffs
  trailingComma: "es5",
};


text:
namespace Microsoft.Azure.Batch.Protocol.Models
{
    using Newtonsoft.Json;
    using System.Linq;

    /// <summary>
    /// An HTTP header name-value pair
    /// </summary>
    public partial class HttpHeader
    {
        /// <summary>
        /// Initializes a new instance of the HttpHeader class.
        /// </summary>
        public HttpHeader()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the HttpHeader class.
        /// </summary>
        /// <param name="name">The case-insensitive name of the header to be
        /// used while uploading output files</param>
        /// <param name="value">The value of the header to be used while
        /// uploading output files</param>
        public HttpHeader(string name, string value = default(string))
        {
            Name = name;
            Value = value;
            CustomInit();
        }

        /// <summary>
        /// An initialization method that performs custom operations like setting defaults
        /// </summary>
        partial void CustomInit();

        /// <summary>
        /// Gets or sets the case-insensitive name of the header to be used
        /// while uploading output files
        /// </summary>
        [JsonProperty(PropertyName = "name")]
        public string Name { get; set; }

        /// <summary>
        /// Gets or sets the value of the header to be used while uploading
        /// output files
        /// </summary>
        [JsonProperty(PropertyName = "value")]
        public string Value { get; set; }

    }
}