text:
# Qmplus LDAP Command Line Tool

The Qmplus LDAP command line tool is a tool that can help diagnose LDAP issues.

To use this tool you must have a user defined in the target organization that has the system `LDAP` roles specified. Otherwise you will receive and error. This is to ensure only authorized users have access to this information.

```
Usage: qplus-ldap-cli [options] [command]

Options:
  -V, --version                                    output the version number
  -u, --username <username>                        provide a username with LDAP permissions
  -p, --password <password>                        provide a password with LDAP permissions
  -l, --url <url>                                  override end point (default: "https://www.qmplus.com/qmplus/rest")
  -o, --output <file>                              write output to file
  -h, --help                                       output usage information

Commands:
  status <tenant>                                  Retrieve the LDAP status of a tenant
  settings <tenant>                                Retrieve the LDAP settings of a tenant
  query <tenant> <searchbase> [filters...]         Execute an ad-hoc query against the tenants configured LDAP
                                                   servers.
  department-query-id <tenant> <departmentId>      Execute the LDAP queries stored for a specific department by id.
  department-query-name <tenant> <departmentName>  Execute the LDAP queries stored for a specific department by its
                                                   name.
  department-info-id <tenant> <departmentId>       Retrieve the ldap filters set up for a specific department by id.
  department-info-name <tenant> <departmentName>   Retrieve the ldap filters set up for a specific department by name.
  user <tenant> <username>                         Retrieve the ldap information about a specified username.
```

The tool supports the folllowing commands.

## Status

The `status` command will retrieve the current LDAP status of a client including the details for each department.

An example that queries the database for a `<organization name>` using the user with `<user name>` and `<password>` to authenticate. Finally the results are writen to the file `results.json`.

```
./qplus-ldap-cli status <organization name> -u <user name> -p <password> -o results.json
```

The command will return results of the following format.

```json
{
  "lastSynchronizedDate": "2020-03-16T01:36:06.016Z",
  "departmentStatuses": [
    {
      "name": "XXXXX",
      "id": 2445,
      "parentId": 1721,
      "active": 1,
      "ldapDistinguishedName": "XXXXX,OU=Organization,DC=acme,DC=local",
      "ldapUniqueIdentifier": "{ba1e4512-33b9-44ef-8a75-097569f48889}",
      "updated": "2020-03-13T13:16:57.550Z"
    }
  ]
}
```

## Settings

The `settings` command will retrieve the current LDAP settings of a client.

An example that queries the database for a `<organization name>` using the user with `<user name>` and `<password>` to authenticate. Finally the results are writen to the file `results.json`.

```
./qplus-ldap-cli settings <organization name> -u <user name> -p <password> -o results.json
```

The command will return results of the following format that contains all the settings for a specific `<organization name>`.

```json
{
  "serverCount": 1,
  "dataSource": "jdbc/XXXXX",
  "connections": [
    {
      "filterAttributeList": [
        {
          "userAttribute": "departmentNumber",
          "depAttribute": "postalAddress"
        }
      ],
      "useDefaultSearchBase": true,
      "attributeForUser": "sAMAccountName",
      "attributeForLastName": "sn",
      "attributeForFirstName": "givenName",
      "attributeForFullName": "cn",
      "attributeForEmail": "mail",
      "attributeForDepartment": "department",
      "attributeForMobile": "mobile",
      "attributeForInitials": "initials",
      "attributeForDistinguishedName": "distinguishedName",
      "attributeForDepartmentDisplayName": null,
      "attributeForUserTypeManager": null,
      "attributeForUserTypeMapping": "businesscategory",
      "forceUpdateUserSyncFilter": null,
      "serverId": 0,
      "serverName": "Standard",
      "systemUser": "XXXXX",
      "systemPassword": "XXXXX",
      "domain": "local",
      "dn": "XXXXX",
      "defaultSearchBase": "XXXXX",
      "host": "XXXXX",
      "port": "636",
      "ouSyncOUUsertypeManagerUserTypeID": 0,
      "protocol": "ldaps",
      "ouSyncFilter": "XXXXX",
      "ouSyncOU": "XXXXX",
      "filterScope": "2",
      "overrideUserDep": null,
      "forceUserNameLowercase": "1",
      "overrideEmail": "1",
      "overrideInactive": "1",
      "baseFilterList": [],
      "ouUniqueIdentifierPropertyName": "objectGUID",
      "doUserSync": 1,
      "presetQmPlusParentId": 0,
      "ouUniqueIdentifierPropertyFormatIsBinary": "0",
      "userNameScheme": "DN",
      "attributeUserTypeIdMap": {
        "leder": 1
      }
    }
  ]
}
```

## Department Query by deparment id or name

The `department-query-id` and `department-query-name` commands allows for executing the `LDAP` queries that are stored on the specified department. This can be used to validate if a departments LDAP queries contain specific users.

An example that queries the database for a `<organization name>` using the user with `<user name>` and `<password>` to authenticate. Finally the results are writen to the file `results.json`.

The first example queries by the department id

```
./qplus-ldap-cli department-query-id <organization name> <searchbase> <department id> -u <user name> -p <password> -o results.json
```

The second example queries by the department name

```
./qplus-ldap-cli department-query-name <organization name> <searchbase> <department name> -u <user name> -p <password> -o results.json
```

The command will execute the query using the specified `<department id>` or `<department name>` provided. The results contains one entry for each of the configured `LDAP` servers, their filter settings and the returned results.

```json
{
  "ldapSearchResults": [
    {
      "results": [
        [
          {
            "key": "whenCreated",
            "value": [
              "20191029082236.0Z"
            ]
          }
        ]
      ],
      "settings": {
        "depNr": 2851,
        "connectionId": 4606,
        "searchBase": "OU=Kunder,DC=ikta,DC=local",
        "activeStatus": 1,
        "overRideDep": 0,
        "ldapfilter": "(&(objectClass=user)(departmentNumber=7020906_1501001))",
        "ldapserver": 0
      }
    }
  ]
}
```

## Department Info by deparment id or name

The `department-info-id` and `department-info-name` commands retrieves all the information related to LDAP stored on a department.

An example that queries the database for a `<organization name>` using the user with `<user name>` and `<password>` to authenticate. Finally the results are writen to the file `results.json`.

The first example queries by the department id

```
./qplus-ldap-cli department-query-id <organization name> <searchbase> <department id> -u <user name> -p <password> -o results.json
```

The second example queries by the department name

```
./qplus-ldap-cli department-query-name <organization name> <searchbase> <department name> -u <user name> -p <password> -o results.json
```

The command will execute the query using the specified `<department id>` or `<department name>` provided. The results contains the `LDAP` information for the selected department and the list of configured `LDAP filter` settings for the department.

```json
{
  "department": {
    "name": "XXXXX",
    "id": 2851,
    "parentId": 2850,
    "active": 1,
    "ldapDistinguishedName": "XXXXX,OU=Organization,DC=ikta,DC=local",
    "ldapUniqueIdentifier": "{8d9f273f-e3ad-4746-b367-7afb8f11b969}",
    "updated":<PHONE_NUMBER>546
  },
  "settings": [
    {
      "depNr": 2851,
      "connectionId": 4606,
      "searchBase": "OU=Kunder,DC=ikta,DC=local",
      "activeStatus": 1,
      "overRideDep": 0,
      "ldapfilter": "(&(objectClass=user)(departmentNumber=7020906_1501001))",
      "ldapserver": 0
    }
  ]
}
```

## Retrive LDAP information for a given user

The `user` command retrieves all the `LDAP` information for a given `username`.

An example that queries the database for a `<organization name>` using the user with `<user name>` and `<password>` to authenticate. Finally the results are writen to the file `results.json`.

```
./qplus-ldap-cli user <organization name> <username> -u <user name> -p <password> -o results.json
```

The command will execute the query using the specified `<user name>` provided. The results contains the `LDAP` information for the selected department and the list of configured `LDAP filter` settings for the department.

```json
{
  "department": {
    "name": "XXXXX",
    "id": 2851,
    "parentId": 2850,
    "active": 1,
    "ldapDistinguishedName": "XXXXX,OU=Organization,DC=acme,DC=local",
    "ldapUniqueIdentifier": "{8d9f273f-e3ad-4746-b367-7afb8f11b969}",
    "updated":<PHONE_NUMBER>546
  },
  "settings": [
    {
      "depNr": 2851,
      "connectionId": 4606,
      "searchBase": "XXXXX",
      "activeStatus": 1,
      "overRideDep": 0,
      "ldapfilter": "XXXXX",
      "ldapserver": 0
    }
  ]
}
```

repository: QM-Quality-Manager/legacy-rest-api

repo_name: QM-Quality-Manager/legacy-rest-api


text:
# shapr

[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version-last-release/shapr)](https://cran.r-project.org/package=shapr)
[![CRAN_Downloads_Badge](https://cranlogs.r-pkg.org/badges/grand-total/shapr)](https://cran.r-project.org/package=shapr)
[![R build
status](https://github.com/NorskRegnesentral/shapr/workflows/R-CMD-check/badge.svg)](https://github.com/NorskRegnesentral/shapr/actions?query=workflow%3AR-CMD-check)
[![Lifecycle:
experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html)
[![License:
MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/license/mit/)
[![DOI](https://joss.theoj.org/papers/10.21105/joss.02027/status.svg)](https://doi.org/10.21105/joss.02027)

## Brief NEWS

### Breaking change (June 2023)

As of version <IP_ADDRESS>00, the development version of shapr (master
branch on GitHub from June 2023) has been severely restructured,
introducing a new syntax for explaining models, and thereby introducing
a range of breaking changes. This essentially amounts to using a single
function (`explain()`) instead of two functions (`shapr()` and
`explain()`). The CRAN version of `shapr` (v0.2.2) still uses the old
syntax. See the
[NEWS](https://github.com/NorskRegnesentral/shapr/blob/master/NEWS.md)
for details. The examples below uses the new syntax.
[Here](https://github.com/NorskRegnesentral/shapr/blob/cranversion_0.2.2/README.md)
is a version of this README with the syntax of the CRAN version
(v0.2.2).

### Python wrapper

As of version <IP_ADDRESS>00 (master branch on GitHub from June 2023), we
provide a Python wrapper (`shaprpy`) which allows explaining python
models with the methodology implemented in `shapr`, directly from
Python. The wrapper is available
[here](https://github.com/NorskRegnesentral/shapr/tree/master/python).
See also details in the
[NEWS](https://github.com/NorskRegnesentral/shapr/blob/master/NEWS.md).

## Introduction

The most common machine learning task is to train a model which is able
to predict an unknown outcome (response variable) based on a set of
known input variables/features. When using such models for real life
applications, it is often crucial to understand why a certain set of
features lead to exactly that prediction. However, explaining
predictions from complex, or seemingly simple, machine learning models
is a practical and ethical question, as well as a legal issue. Can I
trust the model? Is it biased? Can I explain it to others? We want to
explain individual predictions from a complex machine learning model by
learning simple, interpretable explanations.

Shapley values is the only prediction explanation framework with a solid
theoretical foundation (Lundberg and Lee (2017)). Unless the true
distribution of the features are known, and there are less than say
10-15 features, these Shapley values needs to be estimated/approximated.
Popular methods like Shapley Sampling Values (Štrumbelj and Kononenko
(2014)), SHAP/Kernel SHAP (Lundberg and Lee (2017)), and to some extent
TreeSHAP (Lundberg, Erion, and Lee (2018)), assume that the features are
independent when approximating the Shapley values for prediction
explanation. This may lead to very inaccurate Shapley values, and
consequently wrong interpretations of the predictions. Aas, Jullum, and
Løland (2021) extends and improves the Kernel SHAP method of Lundberg
and Lee (2017) to account for the dependence between the features,
resulting in significantly more accurate approximations to the Shapley
values. [See the paper for details](https://arxiv.org/abs/1903.10464).

This package implements the methodology of Aas, Jullum, and Løland
(2021).

The following methodology/features are currently implemented:

-   Native support of explanation of predictions from models fitted with
    the following functions `stats::glm`, `stats::lm`,`ranger::ranger`,
    `xgboost::xgboost`/`xgboost::xgb.train` and `mgcv::gam`.
-   Accounting for feature dependence
    -   assuming the features are Gaussian (`approach = 'gaussian'`,
        Aas, Jullum, and Løland (2021))
    -   with a Gaussian copula (`approach = 'copula'`, Aas, Jullum, and
        Løland (2021))
    -   using the Mahalanobis distance based empirical (conditional)
        distribution approach (`approach = 'empirical'`, Aas, Jullum,
        and Løland (2021))
    -   using conditional inference trees (`approach = 'ctree'`,
        Redelmeier, Jullum, and Aas (2020)).
    -   using the endpoint match method for time series
        (`approach = 'timeseries'`, Jullum, Redelmeier, and Aas (2021))
    -   using the joint distribution approach for models with purely
        cateogrical data (`approach = 'categorical'`, Redelmeier,
        Jullum, and Aas (2020))
    -   assuming all features are independent
        (`approach = 'independence'`, mainly for benchmarking)
-   Combining any of the above methods.
-   Explain *forecasts* from time series models at different horizons
    with `explain_forecast()` (R only)
-   Batch computation to reduce memory consumption significantly
-   Parallelized computation using the
    [future](https://future.futureverse.org/) framework. (R only)
-   Progress bar showing computation progress, using the
    [`progressr`](https://progressr.futureverse.org/) package. Must be
    activated by the user.
-   Optional use of the AICc criterion of Hurvich, Simonoff, and
    Tsai (1998) when optimizing the bandwidth parameter in the empirical
    (conditional) approach of Aas, Jullum, and Løland (2021).
-   Functionality for visualizing the explanations. (R only)
-   Support for models not supported natively.

Note the prediction outcome must be numeric. All approaches except
`approach = 'categorical'` works for numeric features, but unless the
models are very gaussian-like, we recommend `approach = 'ctree'` or
`approach = 'empirical'`, especially if there are discretely distributed
features. When the models contains both numeric and categorical
features, we recommend `approach = 'ctree'`. For models with a smaller
number of categorical features (without many levels) and a decent
training set, we recommend `approach = 'categorical'`. For (binary)
classification based on time series models, we suggest using
`approach = 'timeseries'`. To explain forecasts of time series models
(at different horizons), we recommend using `explain_forecast()` instead
of `explain()`. The former has a more suitable input syntax for
explaining those kinds of forecasts. See the
[vignette](https://norskregnesentral.github.io/shapr/articles/understanding_shapr.html)
for details and further examples.

Unlike SHAP and TreeSHAP, we decompose probability predictions directly
to ease the interpretability, i.e. not via log odds transformations.

## Installation

To install the current stable release from CRAN (note, using the old
explanation syntax), use

``` r
install.packages("shapr")
```

To install the current development version (with the new explanation
syntax), use

``` r
remotes::install_github("NorskRegnesentral/shapr")
```

If you would like to install all packages of the models we currently
support, use

``` r
remotes::install_github("NorskRegnesentral/shapr", dependencies = TRUE)
```

If you would also like to build and view the vignette locally, use

``` r
remotes::install_github("NorskRegnesentral/shapr", dependencies = TRUE, build_vignettes = TRUE)
vignette("understanding_shapr", "shapr")
```

You can always check out the latest version of the vignette
[here](https://norskregnesentral.github.io/shapr/articles/understanding_shapr.html).

## Example

`shapr` supports computation of Shapley values with any predictive model
which takes a set of numeric features and produces a numeric outcome.

The following example shows how a simple `xgboost` model is trained
using the *airquality* dataset, and how `shapr` explains the individual
predictions.

``` r
library(xgboost)
library(shapr)

data("airquality")
data <- data.table::as.data.table(airquality)
data <- data[complete.cases(data), ]

x_var <- c("Solar.R", "Wind", "Temp", "Month")
y_var <- "Ozone"

ind_x_explain <- 1:6
x_train <- data[-ind_x_explain, ..x_var]
y_train <- data[-ind_x_explain, get(y_var)]
x_explain <- data[ind_x_explain, ..x_var]

# Looking at the dependence between the features
cor(x_train)
#>            Solar.R       Wind       Temp      Month
#> Solar.R  1.0000000 -0.1243826  0.3333554 -0.0710397
#> Wind    -0.1243826  1.0000000 -0.5152133 -0.2013740
#> Temp     0.3333554 -0.5152133  1.0000000  0.3400084
#> Month   -0.0710397 -0.2013740  0.3400084  1.0000000

# Fitting a basic xgboost model to the training data
model <- xgboost(
  data = as.matrix(x_train),
  label = y_train,
  nround = 20,
  verbose = FALSE
)

# Specifying the phi_0, i.e. the expected prediction without any features
p0 <- mean(y_train)

# Computing the actual Shapley values with kernelSHAP accounting for feature dependence using
# the empirical (conditional) distribution approach with bandwidth parameter sigma = 0.1 (default)
explanation <- explain(
  model = model,
  x_explain = x_explain,
  x_train = x_train,
  approach = "empirical",
  prediction_zero = p0
)
#> Note: Feature classes extracted from the model contains NA.
#> Assuming feature classes from the data are correct.
#> Setting parameter 'n_batches' to 2 as a fair trade-off between memory consumption and computation time.
#> Reducing 'n_batches' typically reduces the computation time at the cost of increased memory consumption.

# Printing the Shapley values for the test data.
# For more information about the interpretation of the values in the table, see ?shapr::explain.
print(explanation$shapley_values)
#>        none    Solar.R      Wind      Temp      Month
#> 1: 43.08571 13.2117337  4.785645 -25.57222  -5.599230
#> 2: 43.08571 -9.9727747  5.830694 -11.03873  -7.829954
#> 3: 43.08571 -2.2916185 -7.053393 -10.15035  -4.452481
#> 4: 43.08571  3.3254595 -3.240879 -10.22492  -6.663488
#> 5: 43.08571  4.3039571 -2.627764 -14.15166 -12.266855
#> 6: 43.08571  0.4786417 -5.248686 -12.55344  -6.645738

# Finally we plot the resulting explanations
plot(explanation)
```

See the
[vignette](https://norskregnesentral.github.io/shapr/articles/understanding_shapr.html)
for further examples.

## Contribution

All feedback and suggestions are very welcome. Details on how to
contribute can be found
[here](https://norskregnesentral.github.io/shapr/CONTRIBUTING.html). If
you have any questions or comments, feel free to open an issue
[here](https://github.com/NorskRegnesentral/shapr/issues).

Please note that the ‘shapr’ project is released with a [Contributor
Code of
Conduct](https://norskregnesentral.github.io/shapr/CODE_OF_CONDUCT.html).
By contributing to this project, you agree to abide by its terms.

## References

Aas, Kjersti, Martin Jullum, and Anders Løland. 2021. “Explaining
Individual Predictions When Features Are Dependent: More Accurate
Approximations to Shapley Values.” *Artificial Intelligence* 298.

Hurvich, Clifford M, Jeffrey S Simonoff, and Chih-Ling Tsai. 1998.
“Smoothing Parameter Selection in Nonparametric Regression Using an
Improved Akaike Information Criterion.” *Journal of the Royal
Statistical Society: Series B (Statistical Methodology)* 60 (2): 271–93.

Jullum, Martin, Annabelle Redelmeier, and Kjersti Aas. 2021. “Efficient
and Simple Prediction Explanations with groupShapley: A Practical
Perspective.” In *Proceedings of the 2nd Italian Workshop on Explainable
Artificial Intelligence*, 28–43. CEUR Workshop Proceedings.

Lundberg, Scott M, Gabriel G Erion, and Su-In Lee. 2018. “Consistent
Individualized Feature Attribution for Tree Ensembles.” *arXiv Preprint
arXiv:1802.03888*.

Lundberg, Scott M, and Su-In Lee. 2017. “A Unified Approach to
Interpreting Model Predictions.” In *Advances in Neural Information
Processing Systems*, 4765–74.

Redelmeier, Annabelle, Martin Jullum, and Kjersti Aas. 2020. “Explaining
Predictive Models with Mixed Features Using Shapley Values and
Conditional Inference Trees.” In *International Cross-Domain Conference
for Machine Learning and Knowledge Extraction*, 117–37. Springer.

Štrumbelj, Erik, and Igor Kononenko. 2014. “Explaining Prediction Models
and Individual Predictions with Feature Contributions.” *Knowledge and
Information Systems* 41 (3): 647–65.

license: MIT

repository: NorskRegnesentral/shapr

branch_name: refs/heads/master

extension: md

gha_language: R

gha_license_id: NOASSERTION

license_type: permissive

repo_name: NorskRegnesentral/shapr


text:
---
title: The Uninsured
author: Justin Ball
layout: post
permalink: /2008/02/12/the-uninsured/
tags:
  - Interesting
  - ama
  - health insurance
  - politics
  - uninsured
---

I saw an ad on TV last night (while learning about the history of drug addiction on the History Channel). It was sponsored by the AMA but highlights the health care crisis in the United States. [1 out of 7 people does not have health insurance.][1] This is bound to be a major topic in the upcoming election - at least it should be. I am not sure if the AMA's motives are purely altruistic or if they just want to make sure their members get paid, but providing a website where people can learn about the problem goes a long way in education the population about one of the biggest problems facing our country in this century.

 [1]: http://www.ama-assn.org/ama/pub/category/17712.html


text:
---
layout: post
title:  "s h a n g h a i"
date:   2017-1-2
published: true
---

In Shanghai. Largest city in the world by city-proper population (23,416,000). Third largest in the world by metropolitan population (34,750,000), and second only to Guangdong in China by metropolitan population. Feels like you're lost in something vast here.

![hostel-roof](https://lh3.googleusercontent.com/Pq1d5u5kI-3ttVgr-hQ19MJkftFNpDsoCLM04lOGnrJaiCDXaMlpJ7A99DXZ8IbgutEX6zI4dA=w1972-h1478-no)

Rooftop of the hostel we're staying at. Cool atmosphere.

![avenue](https://lh3.googleusercontent.com/j6jLkBkfuSFjIS943z5MQcAVPSjnjkD_TuTOg_T4a5yDboHzBKhA003gYqXe6qnVQ2EVKv11xg=w1972-h1478-no)

A street whose name I've forgotten. Towers fading into the haze...

![xiaolongbao](https://lh3.googleusercontent.com/p6vPQno-zHGnDGpzBGDrWLts3biuChTvEPtSYPSRxbmwnYTVKakzYUobiaTXXpDLJj0m5a49uQ=w1110-h1478-no)

Xiaolongbao.

![nanjingeast](https://lh3.googleusercontent.com/vnH2wQLZZmHQ8UkmezNFEgAS13W7mpLU7njS2J9hTpx1kYHo8FIK2ftBhCL2OpKHnO77beLu7Q=w1110-h1478-no)

Nanjing East Pedestrian street. It's lit.

![westbrooks](https://lh3.googleusercontent.com/XO5oioX5qdYfYFN-soYNdGYMGHzSsiwi933D6eUKeZsjsF1Gg4D7f3dd1myPh5rh3nTm_hhDjw=w1110-h1478-no)

NOW I DO WHAT I WANT

![jimmy-space-jam](https://lh3.googleusercontent.com/t2MK_O_NzM8W4piYfRJbKuGHqIwhUXD7pY2z9j14xD6Qf3bWpsGWEfR-S2Lacy5g4mA4LYU4Ew=w1110-h1478-no)

My boy Jimmy G. Buckets.

![klay](https://lh3.googleusercontent.com/6NuRknn6lHUfhsiDvYbDb_dYCmkpDJkXBK16Ne5aMkIeODmbERelmui0hN8L7NpcsaktGt33dw=w1110-h1478-no)

Lol Klay.

![bund](https://lh3.googleusercontent.com/xBMjp_riwRVrlDMwTbXF0kIVGfnSsJzVSKAaBWYGmH_2qsIeXTfy8uQ4D4pj5MymNAgkYEYF7w=w1972-h1478-no)

The iconic view from the Bund. It's too bad the Shanghai Tower isn't lit up.

![twenty-seventeen](https://lh3.googleusercontent.com/0XOUf2eLDrLyrD7Q4XAoXuxH4WOAoEp_e6OdLIdH8B3dC68dWDe7j1KMmwkVCLkwBNZ4Lsjk9g=w1972-h1478-no)

2 0 1 7

![amuni](https://lh3.googleusercontent.com/unHoLnpi8nJhSxUKlx22eWN4MkFBCpFmcriI2GUzZshQ5NsrRf3VBwYWz_0Jj5RrndmhKxZd7A=w1972-h1478-no)

A M U N I

![givenchy](https://lh3.googleusercontent.com/av9RsI_qupXRGK1lJ8MgKLUIWJS-5_DeT_7v4n2MPepWE-D2grYi1S30pLXGnOLfM2CT7boJ3w=w1972-h1478-no)

Someone used an anagram machine.

![chinese-kfc](https://lh3.googleusercontent.com/pvBsJ9vK0_VgT7UJz6OUCe7I3h_pohDaBSDWd798icVwdUqIOiIrjRceas79dSx_aLVKFQOAxA=w1110-h1478-no)

Chinese KFC is way better than its US counterpart.

![shanghai-alley](https://lh3.googleusercontent.com/bt9HpezZPnCFqfyTCgiHFcDpcq9WXhE5NdXKcDPsVb3Bn59r-y04Zy099dNmmN3h_6GtDDSOUQ=w1972-h1478-no)

Aesthetic alleyway.

![street](https://lh3.googleusercontent.com/cycp-FPfLJMD0QK4L8m1i0ToLKw9hrSP328GRKpCMsGXcZvX8pz5uoW2Em5kccHLcPFIIJHmdA=w1972-h1478-no)

Street.

![disneyland-castle-day](https://lh3.googleusercontent.com/iNqMgJwMyLJckD_SI9Nn7Uk4xRdub4XNM4pp9NgebWDrPUwEPAA-ab-YRhbw5rLKzTttRKtTiA=w1972-h1478-no)

And... we're at Disneyland.

![tron-ride](https://lh3.googleusercontent.com/nKWAACHHXJJ9FrSmW8JiS8s50DBAkwc2jNAf5eFdWORC-1JucvdoeSCRBcwUF94VDkbozdex3Q=w1972-h1478-no)

About to go on the sick Tron ride.

![tron-cycles](https://lh3.googleusercontent.com/W5nFrqHAxumwYCVwxEwdD0SX6SUe9JiXuX1EI82M6zOlt2y5WIFsdtKrM7Jc9z1b2w_L1sbsJg=w1110-h1478-no)

On the light-cycles.

![castle-night](https://lh3.googleusercontent.com/CBc-szmmHOgECvCl79EnvLao9kVOLJe6OHP6HCFLrnVrToKZf_EJlz8BcbsnpxT4lOeiGzYBqg=w1972-h1478-no)

The castle at night.

![shanghai-model](https://lh3.googleusercontent.com/oD4rOeZr5BEK-xPizA2iq00uvu56Qp8bBhxp60F-dBRbkZMXbOVdBnqjnVguvMNQi5TwKZ3ocA=w1747-h1310-no)

At the the urban planning museum. Amazing model of the inner ring of the city.

![pink-board](https://lh3.googleusercontent.com/0mBTiQ98pjy36N3UrdnBf_S7dmj8T2L8Lza7UX1-i2c8KqD_I3uwIL-WzAMDM2toyvFkxnjOxw=w1747-h1310-no)

Pink billboard in the rain.

![contrast](https://lh3.googleusercontent.com/ZvpLVYbmf-1VyuwwNlvr78Ug-HRvSCZtWE1RPdNpjN1XC5nsSEGRr2T2Fa88RtjSSFaWjL8vDQ=w1747-h1310-no)

Old and new contrast again.

![beneath-giants](https://lh3.googleusercontent.com/1FV1N2kwavEdJIQgL-dkBVcrwXsSPpIE5evI0cHKn8agrFATx-IIo6zMpyGlWKZJlUC77Mm2hA=w983-h1310-no)

Beneath the giants.

![overpass](https://lh3.googleusercontent.com/YW-b6jFAKk7ngMnCXE_1FLWuosloH88iQUivRiklTAvTfeZJblm_-OWVPQkMUJ8yLVyYCO5-Tg=w1747-h1310-no)

Pedestrian overpass.

![view-from-top](https://lh3.googleusercontent.com/o_pMOxt4LZL2wDGrIVdDXvs1Na1sricrIrTEM9ZW8vefzCL-kNx1V4F_Q6TyOgAT_tlaxEfllA=w1747-h1310-no)

View from on top of the Jinmao Tower. Not the greatest picture due to the rain and the reflective glass, but still cool.


text:
---
title: "Install React Navigation"
metaTitle: "Add React Navigation"
metaDescription: "Learn how to add React Navigation to your project"
---

For this project, we will use React Navigation as a way to handle pages.

React Navigation is a very popular library to handle views in React Native, which normally does not support React Navigation.

To add it to your project, navigate to the directory in the command line and enter:

```bash
expo install react-native-gesture-handler react-native-reanimated react-native-screens react-native-safe-area-context @react-native-community/masked-view react-navigation react-navigation-drawer react-navigation-stack react-navigation-animated-switch
```

You may need `sudo` on Linux.

repository: alexander-beaver/react-native-game-docs

gha_language: JavaScript

gha_license_id: MIT

repo_name: alexander-beaver/react-native-game-docs


text:
---
title: "Hacking Habits"
date: 2023-02-10T00:00:00-05:00
draft: false
summary: "I have always been fascinated by what BJ Fogg calls \"behavior design\" and have read quite a few books on it - *The Power of Habit*, *Atomic Habits*, *Nudge*, Allen Carr's *The Easy Way to Control Alcohol*. So far, none came closer to giving me the feeling that I am “hacking the source code” of my own behavior than BJ Fogg’s *Tiny Habits*.
{{< line_break >}}
I found lots of good ideas in the book, including two that are causing me to look at human behavior in a new way. The kind of ideas I call ***revelations***"

subtitle: "Insights from *Tiny Habits* by BJ Fogg, PhD"
summaryImage: "images/summary.png"
listImage: "hacking-habits/images/action-line.webp"
hideLastModified: false
---

I have always been fascinated by what BJ Fogg calls "behavior design" and have read quite a few books on it - *The Power of Habit*, *Atomic Habits*, *Nudge*, Allen Carr's *The Easy Way to Control Alcohol*. So far, none came closer to giving me the feeling that I am “hacking the source code” of my own behavior than BJ Fogg’s *Tiny Habits*.

I found lots of good ideas in the book, including two that are causing me to look at human behavior in a new way. The kind of ideas I call ***revelations***

First, the premise.

# B = MAP
According to Fogg, behavior can be expressed as a simple formula.

By now you may have encountered the idea that behavior happens when motivation meets ability and prompt.

Here is a **revelation**: when debugging behavior, we are approaching it in the **wrong order**.

How could I possibly know in what order _you_ approach debugging behavior?

I have lived in 3 different countries with very different cultures. In every single one, the common wisdom is that to change behavior, you need to affect motivation. Whether you are trying to influence yourself, your team at work, or your child, the primary strategy is to offer either a carrot (a reward) or a stick (a punishment) to increase someone’s motivation to do the behavior.

If you've ever struggled to start a habit of exercising daily, or get your team at work to write Unit Tests, or influence your child to clean their room, you know from experience that this strategy doesn't work very well.

Worse than that, we escalate from labeling an action, to labeling a habit, to labeling someone's identity very fast. How quickly does your personal self-talk go from “I didn’t exercise today” to “I can never get myself to exercise” to “I’m a lazy piece of garbage”?

# The Action Line
Dr. Fogg suggests explaining the relationship between the three elements of behavior using the Action Line graphic.

Notice the asymptotic tails. The easier the behavior is to do, the less motivation you need to do it. The higher your motivation, the harder you will be willing to work to do the behavior.

Motivation, however, is a fickle mistress. A much better strategy, researched by BJ Fogg and other scientists, is to start debugging the behavior at the other end of the B = MAP formula.

There are a lot more details, examples, and suggestions in the book that I could never do justice to in a short blog, but here is the gist:

1. Can’t get yourself to start the desired behavior? Design a good **prompt**.

Design a prompt that matches the *location*, *time*, and *context* of the behavior. (For example, if you get a reminder to start the dishwasher when you aren't even home it will likely end up being useless and even frustrating) Fit the prompt into your existing routine, try anchoring it to the end of an existing behavior. Often, this is all it takes.

2. Next up is **ability**.

Do you have a great prompt, but are still unable to do the behavior? Increase your physical or mental ability to perform it. Don’t trust yourself to overcome hurdles. Purposefully remove all friction.  Make it easy to do the right thing.

This is also where the habits being “tiny” comes in.

It is a lot easier to do a single wall push-up than 20 good form floor push-ups. Dr. Fogg suggests that you should aim for the “tiny” core habit that you could execute on your very worst day, a day when you have a toothache, a work deadline, and your house is on fire. If you are still able to do the behavior on your worst day, you will usually be happy to do an enhanced version of the same behavior when you have the time and energy.

# Celebration

Only the very best books leave me with more than one revelation, and *Tiny Habits* is one of those.

As useful as the B = MAP formula has been, the most significant idea in the book for me is the importance of **celebration**.

BJ Fogg points out that as adults, we tend to never celebrate our everyday successes. Worse than that, we dismiss our accomplishments with the mental track of “finally,” or “this is barely good enough,” or "I should have done this a week ago.”

According to Fogg’s research, the key to anchoring the new behavior is celebrating success. Every time you do the desired action, no matter how small it seems, celebrate. Spend a moment **authentically** congratulating yourself on accomplishing a goal (the importance of creating an authentic positive feeling immediately after the behavior is emphasized in the book).

Seems silly or undeserved?

 What would happen if instead of giving it a treat for sitting down, you punished it for “not sitting well enough?” I bet the puppy would avoid the behavior like the plague.

But this is exactly what you do to your “lizard brain” when you tell yourself “I’m just phoning it in” after doing a wall push up. At the end of the day, we are simple creatures. If we get discouragement for the wall push up, we aren’t going to take on the harder versions of the habit.

Just as with the behavior debugging sequence, the common cultural approach seems to be quite wrong here. Humans are already naturally inclined to give negative reinforcements more often than positive ones. On top of that, we are taught that we can somehow “spoil” people by giving too much positive feedback.

One of the quotes I've been using a lot since reading the book is “I change best by feeling good, not by feeling bad.”

# A Personal Experiment
After reading the book, I decided to take the idea of celebration a bit further than habit hacking.

My personal and professional life has been quite stressful since the beginning of the pandemic, as I know it has been for so many folks. Usually an optimist, I've been feeling burnt out and overwhelmed. Absolutely everything, from writing an email to making a plate of scrambled eggs felt like another dreadful chore.

I have decided to test what happens if I celebrate every positive behavior I do, be it a one-time thing or a habit, at work or at home, no matter how tiny. Unlike buying yourself a reward dinner, **authentic celebration** is free, always accessible, and comes with no extra calories. What’s the worst that could happen?

It’s been a few weeks since I’ve finished the book, and I can attest to feeling a lot less burnt out. Somehow, it is a lot easier to wipe off the dinner table if you give yourself a pat on the back for doing it. Somehow, everything in life feels lighter and more fun if you celebrate the tiny positive outcomes.

Try it. See if it works for you.

As Aristotle said, "we are what we repeatedly do." I wish you luck on the journey of designing life through behavior design!

{{< line_break >}}
*Interested in seeing more posts like this? Please let me know on {{< new_tab_link href="https://twitter.com/DivineOps" text="Twitter" >}} or {{< new_tab_link href="https://www.linkedin.com/in/sasha-rosenbaum/" text="LinkedIn" >}}*

repository: DivineOps/sasha-rosenbaum-site

branch_name: refs/heads/main

gha_language: HTML

repo_name: DivineOps/sasha-rosenbaum-site


text:
A simple self-contained WebApp to generate COVID-19 Certificate for educational purposes :)
## Usage
https://raw.githack.com/QTimort/Open-COVID-Attestation/master/webapp/dist/index.html

## Dev Setup

2.  Install dependencies:

        yarn

    or

        npm install

3.  Run webpack:

        npm start

You should now be able to access the WebApp on: http://localhost:3000

repository: QTimort/Open-COVID-Attestation

repo_name: QTimort/Open-COVID-Attestation


text:
---
title: De-@wip Your Cucumber Stories
permalink: 2009/06/29/de-wip-your-cucumber-stories
published_at: 2009-06-29 06:55:00 +0000
---

We've been really hitting the [Cucumber](http://cukes.info/) hard in the recent few iterations of our current project. Now that we're [ping pong pair programming](http://en.wikipedia.org/wiki/Pair_programming#Ping_pong_pair_programming), the Cucumber story is the first thing we write, and we revisit regularly during the [red-green-refactor](http://jamesshore.com/Blog/Red-Green-Refactor.html) cycle.

To make this easy, we place a `@wip` _work in progress_ [tag](http://wiki.github.com/aslakhellesoy/cucumber/tags) at the top of the current stories:

```
Feature: Make coffee

  # This one is done.
  Scenario: First coffee of the day

  # This is the one we're working on.
  @wip
  Scenario: Afternoon perk up
```

Then we use `cucumber -t wip` to run just the stories in progress. Once the stories are green and we're happy to move on, we often forget to remove the `@wip` tags before committing. I wrote a little sed command in a bash alias to make this easier:

```
# Remove any @wip tags from Cucumber features.
alias dewip="sed -E -i '' -e '/^[[:blank:]]*@wip$/d;s/,[[:blank:]]*@wip//g;s/@wip,[[:blank:]]*//g' features/**/*.feature"
```

Throw it in your `.bash_profile` for ease of access! Here's a [gist](http://gist.github.com/136294) for your forking pleasure.

repository: timriley/my-site

gha_language: Ruby

repo_name: timriley/my-site


text:
---
templateKey: exit-strategy-page
path: /exit-strategy
title: Investors | Exit Strategy
banner: /img/breadcrumbs_img_3.jpg
image: /img/exit-strategy-qzulu-final.jpg
---
QZulu Incorporated is committed to developing the Joint Venture opportunity involving the Kingdom of Zululand. The opportunity presents a unique opportunity to positively impact the lives of more than ten million individuals, and to distribute the Company’s value-added technology and related products and services.

One of the Company’s objectives is to reward Shareholders and Token Holders with income opportunities that typically would be distributed in the form of dividends.

An additional Company objective is to develop one or more exit strategies related to its Securities and Tokens. These exit strategies may include, but not be limited to, the listing of the Shares or Tokens in the secondary market; an initial public offering of the Company’s Securities; an acquisition of the Company for corporate equity; an acquisition of the Company for cash; or another related or unrelated strategy.

repository: mouhsnimohamed/qzulu

repo_name: mouhsnimohamed/qzulu


text:
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [2.2.0]
### Changed
- Version compatible with Test Runner & Orchestrator 1.4.0 & Android Gradle Plugin 7 and Kotlin 1.5.21.
- Uploading to Bintray is not supported anymore.
- New version is uploaded to Maven Central repository

## [2.1.0]
### Changed
- Updated dependencies to Android Test Runner 1.2.0 & Kotlin 1.3.41. Updated other dependencies as well.
- Exposed `AndroidJUnitXRunner#getTestDescriptionFromBundle` as `public`.

## [2.0.0]
### Changed
- Migrated to AndroidX and Android Test Runner 1.1.0

## [1.0.0]
### Added
- Initial release of the library.

[2.2.0]: https://github.com/stepstone-tech/AndroidTestXRunner/compare/2.1.0...2.2.0
[2.1.0]: https://github.com/stepstone-tech/AndroidTestXRunner/compare/2.0.0...2.1.0
[2.0.0]: https://github.com/stepstone-tech/AndroidTestXRunner/compare/1.0.0...2.0.0
[1.0.0]: https://github.com/stepstone-tech/AndroidTestXRunner/tree/1.0.0

repository: stepstone-tech/AndroidTestXRunner

gha_language: Kotlin

repo_name: stepstone-tech/AndroidTestXRunner


text:
## Automating Performance Metrics Measurement

Apple provides the `instruments` tool with quite a rich set of features for desktop and mobile applications performance measurement. The collected data can be then visualized with `Instruments.app`, which is a part of Xcode DevTools. By default Xcode provides several measurement templates, like `Activity Monitor` or `Time Profiler`, but one can also create their own profiles and select a custom set of metrics to record and visualize. Read https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide to get a more detailed overwiew of available tool features.

### mobile: startPerfRecord

This command starts the performance recorder for the given profile name (template) on the device under test. In case this command is called two or more times in a row then the previous recorder will be forcefully stopped and the new one will start. All the previous data will be lost.

Important: It is expected that the appropriate [security flag](/docs/en/writing-running-appium/security.md) is set from the Appium server command line in order to measure Simulator performance, since the `instruments` tool records the data from all running processes on the host machine.

#### Supported arguments

 * _timeout_: For how long the recorder should be running in milliseconds. 5 minutes by default. Try not to set too high a value to this argument, since .trace files generated by `instruments` are pretty big in size.
 * _profileName_: The name of an existing performance template. `Activity Monitor` by default.
 * _pid_: The ID of the process to meassure the performance for. Set it to `current` in order to meassure only the performance of the process, which belongs to the currently active application (this might not work for some profiles). All processes running on the device are meassured if process ID is unset (the default setting). Setting process ID while device under test is Simulator might require `instruments` to be launched with sudo privileges, which is not supported and will throw a timeout exception.

#### Usage examples

```java
// Java
Map<String, Object> args = new HashMap<>();
args.put("timeout", 60 * 1000);
args.put("profileName", "Time Profiler");
driver.executeScript("mobile: startPerfRecord", args);
```

### mobile: stopPerfRecord

This command stops performance recorder for the given profile name (template) on the device under test and returns the collected data in zipped format or uploads it to a remote server. An exception will be thrown if `startPerfRecord` command has not been invoked before.

Important: It is expected that the appropriate [security flag](/docs/en/writing-running-appium/security.md) is set from the Appium server command line in order to measure Simulator performance, since the `instruments` tool records the data from all running processes on the host machine.

#### Supported arguments

 * _profileName_: The name of an existing performance template, for which the monitoring has been running before. `Activity Monitor` by default.
 * _remotePath_: The path to a remote location, where the resulting zipped .trace file should be uploaded. The following protocols are supported: http/https, ftp. Null or empty string value (the default setting) means the content of resulting file should be zipped, encoded as Base64 and passed as the return value. An exception will be thrown if the generated file is too big to fit into the available server process memory.
 * _user_: The name of the user for the remote authentication. Only works if `remotePath` is provided.
 * _pass_: The password for the remote authentication. Only works if `remotePath` is provided.
 * _method_: The http multipart upload method name. Only works if `remotePath` is provided. Equals to `PUT` by default.

#### Usage examples

```python
# Python
driver.execute_script('mobile: stopPerfRecord', {
    'profileName': 'Time Profiler',
    'remotePath': 'ftp://myserver/upload/',
    'user': 'serveruser',
    'pass': 'secretpass'
})
```

repository: testerhome/appium

repo_name: testerhome/appium


text:
---
site: freiburg
tags: [training]
title: "Metabolomics tool development workshop"
starts: 2019-10-02
ends: 2019-10-04
organiser:
  name: ELIXIR
  email<EMAIL_ADDRESS>location:
  city: Hinxton
  country: Great Britain
supporters:
  - elixir
---

Simon and Björn from the Europe Galaxy team will attend the Metabolomics Tool developement workshop (MetaboFlow hackathon) at EBI in Hinxton (Great Britain) and help
the Metabolomic community to polish new Galaxy tools so they can be distributed to the Galaxy Tool Shed.
Nicola Soranzo from the Earlham Institute, IUC and ELIXIR community member will join us as well.

We are looking forward to a few very productive days and many more tools for Metabolomic research in a Galaxy instance near to you.

repository: usegalaxy-eu/website

gha_language: TeX

repo_name: usegalaxy-eu/website


text:
---
layout: page
title: Resources
tags: [resources, dan]
date: 2016-07-21
comments: false
---

Visualization tools
===================

- [dimple](http://dimplejs.org/index.html): "The aim of dimple is to open up the power and flexibility of d3 to analysts. It aims to give a gentle learning curve and minimal code to achieve something productive. It also exposes the d3 objects so you can pick them up and run to create some really cool stuff."
- [bokeh](http://bokeh.pydata.org/en/latest/): "Bokeh is a Python interactive visualization library that targets modern web browsers for presentation. Its goal is to provide elegant, concise construction of novel graphics in the style of D3.js, and to extend this capability with high-performance interactivity over very large or streaming datasets. Bokeh can help anyone who would like to quickly and easily create interactive plots, dashboards, and data applications."
- [sigma](http://sigmajs.org/): "Sigma is a JavaScript library dedicated to graph drawing. It makes easy to publish networks on Web pages, and allows developers to integrate network exploration in rich Web applications."
- [Gephi](https://gephi.org/): "Gephi is the leading visualization and exploration software for all kinds of graphs and networks."

Data sets
=========


text:
First of all, thank you for taking the time to contribute!!

# Guidelines

## Code quality
We put our best effort into providing high quality software that is readable (class, field, and method names are written in full proper English with as little abbreviations as possible), well documented, and well tested.
We would greatly appreciate if your contribution goes the same way.

## Code formatting
We use a custom Java formatting that can be found [here](https://github.com/ihmcrobotics/ihmc-open-robotics-software/tree/develop/IHMCJavaToolkit/CodeFormatTemplates).
It can be easily integrated to different IDEs such as Eclipse and IntelliJ.
Any contribution we'll be formatted before being accepted.

# How can I contribute
## JavaDoc
You can report to us any misleading, incomplete documentation or any typos you find.
This is the easiest way to contribute, but it is still an important contribution that we would greatly appreciate.

## Bug report
If you find a bug, it will greatly help us if you could provide a failing JUnit test with the bug report or at least a concrete example so it is easy for us to reproduce the bug on our side.

repository: ihmcrobotics/euclid

repo_name: ihmcrobotics/euclid


text:
# docker-secret

Utility for retrieving docker secrets.

## Usage

Given that you have created secrets for your docker swarm

```
printf "myUsername" | docker secret create USERNAME -
printf "mySuperSecret" | docker secret create PASSWORD -
```

You can retrieve secrets via the following methods:

### `secrets`

Loads secrets defined in the `/run/secrets` directory. To load from a different directory, refer to [`getSecrets(dir)`](#getsecretsdir).

```ts
import { secrets } from "docker-secret";

// Use secrets in your app.
mongoose.connect(
  `mongodb://${secrets.USERNAME}:${secrets.PASSWORD}@mongodb/mydb`
);
```

### `getSecrets<Secrets>(dir?: string): Secrets`

You can read secrets from a directory you define. This is useful for loading secrets from a different directory during development.

```ts
import { getSecrets } from "docker-secret";

// Without typings works fine
const secrets = getSecrets(process.env.SECRET_DIR);

secrets.USERNAME; // no error
secrets.PASSWORD; // no error
secrets.RANDOM; // no error

// But using with typings is preferred
type Credentials = {
  USERNAME: string;
  PASSWORD: string;
};

const secrets = getSecrets<Credentials>(process.env.SECRET_DIR);

secrets.USERNAME; // no error
secrets.PASSWORD; // no error
secrets.RANDOM; // error

// You can also call the function without any argument to load secrets from `/run/secrets` by default.
const secrets = getSecrets<Credentials>();
```

repository: hwkd/docker-secret

gha_language: TypeScript

repo_name: hwkd/docker-secret


text:
# Sprite Effects

|Area|Submitted|Type|
|-|-|-|
Games: 2D Graphics, Games: Content Pipeline, Games: Graphics, Games: Postprocessing, Games: Shaders|2/19/2007|Code Sample
||||

## Description

This sample shows how shaders can be used to implement special effects when drawing 2D graphics with SpriteBatch. It uses two custom content pipeline processors to prepare the sprite textures in special ways.

## Sample Overview

The sample includes five different rendering techniques. To switch to the next technique, press the A button on your gamepad, or SPACEBAR on your keyboard.

The first custom content pipeline processor merges color and alpha information from two separate source files into a single texture. This allows the alpha data to be drawn as a simple grayscale image, which can be convenient if you're using a paint program that doesn't properly support images with embedded alpha channels.

The second custom processor converts an image containing grayscale height values into a normal-map texture.

All content and source code downloaded from this page are bound to the Microsoft Permissive License (Ms-PL).

![XNA_SpriteEffects_01_small.jpg](https://github.com/simondarksidej/XNAGameStudio/blob/archive/Images/XNA_SpriteEffects_01_small.jpg?raw=true)
![XNA_SpriteEffects_02_small.jpg](https://github.com/simondarksidej/XNAGameStudio/blob/archive/Images/XNA_SpriteEffects_02_small.jpg?raw=true)
![XNA_SpriteEffects_03_small.jpg](https://github.com/simondarksidej/XNAGameStudio/blob/archive/Images/XNA_SpriteEffects_03_small.jpg?raw=true)

Download | Size | Description
---|---|---|
[SpriteEffectsSample_4_0](https://github.com/simondarksidej/XNAGameStudio/tree/archive/Samples/SpriteEffectsSample_4_0) | 0.30MB | Source code and assets for the Sprite Effects Sample (XNA Game Studio 4.0).
[SpriteEffectsSample_4_0.zip](https://github.com/simondarksidej/XNAGameStudioZips/raw/zips/SpriteEffectsSample_4_0.zip) | 0.30MB | Source code and assets for the Sprite Effects Sample (XNA Game Studio 4.0).
||||

license: MS-PL

path: /Articles/Sprite Effects.md

filename: Sprite Effects.md


text:
# rpc-echo
[RPC](http://en.wikipedia.org/wiki/Remote_procedure_call) echo server implementation.

## rpcgen usage guide

First of all run [`rpcgen`](http://en.wikipedia.org/wiki/RPCGEN) tool to generate all the files needed:

```
$ rpcgen -a msg.x
```

Then edit [`msg_server.c`](https://github.com/rfguri/rpc-echo/blob/master/msg_server.c) and [`msg_client.c`](https://github.com/rfguri/rpc-echo/blob/master/msg_client.c) to code your own functions.

### msg_server.c

Holds the server code. Including includes, prototypes and implementation of the server as follows:

```c
#include "msg.h"

int * write_1_svc(char **msg, struct svc_req *req) {
  static int result;
  printf ("%s", *msg);
  result = 1;
  return (&result);
}
```
> **Note**: `rpcgen` ask to write functions that return pointers to their integer results, not the integers themselves.

### msg_client.c

Holds the client code. Opens a connection to a machine specified on the command line and asks the server to echo the message typed.

```c
#include "msg.h"

int * echo (char *host, char *msg) {
  CLIENT *clnt;
  int  *result;
  clnt = clnt_create (host, ECHO, ECHO_V1, "udp");
  if (clnt == NULL) {
    clnt_pcreateerror (host);
    exit (1);
  }
  result = write_1(&msg, clnt);
  if (result == (int *) NULL) {
    clnt_perror (clnt, "call failed");
  }
  return (result);
}

int main (int argc, char *argv[]) {
  int *result;
  char *host, *msg, buff[2048];
  if (argc < 2) {
    printf ("Usage: %s server_host\n", argv[0]);
    exit (1);
  }
  host = argv[1];
  do {
    bzero (buff, 2048);
    read (0, buff, sizeof (buff));
    msg = strdup(buff);
    result = echo (host, msg);
  } while (result != (int *)NULL);
  exit (0);
}
```

> **Note**: Notice the RPC library call "clnt_create()", which opens a connection. It address the server by hostname, program ID, and version number. It can also specify "tcp" or "udp" transport modes.

## Compilation

```
  make -f Makefile.msg
```

## Running

On one terminal run `server` and wait to see echo messages:

```
$ ./msg_server
```

And on another one run `client` and start typing your messages:

```
$ ./msg_client <remote_server>
```

> **Note**: Remember to always start the `server` before starting the `client`.

## Example

```
$ ./msg_server
Hello, RPC!

$ ./msg_client localhost
Hello, RPC!
```

repository: rfguri/rpc-echo

repo_name: rfguri/rpc-echo


text:
---
layout: post
title: "FizzBuzz in Go and Rust"
date: 2015-06-26 19:23
comments: true
categories:
 - code
 - go
 - rust
 - docker
---

My team and I attended DockerCon earlier this week. We went with the intention
of taking time at the hackathon to spend some time digging into what it would be
like to operate services running on Docker & CoreOS. Part of the challenge
of CoreOS is that there isn't a package manager, which makes installing any
modern programming language difficult. The only way to execute code is to drop a
binary on the machine or to run code in a Docker container.

Therefore, it made a lot of sense to take some time to experiment with both Go
and Rust. It was also a ton of fun to play with some new ideas. To get a grasp
of the basics, I looked to the tried and true [FizzBuzz](http://c2.com/cgi/wiki?FizzBuzzTest).
FizzBuzz is a great exercise because it forces you to loop, use control logic
(if/else or case), and understand some basic math operators.

<!-- more -->

## Rust

[Rust](http://www.rust-lang.org/) bills itself as a language for [systems
programming](https://en.wikipedia.org/wiki/System_software). While I didn't get
far enough to determine if that was true, I did get far enough to determine that
Rust is relatively difficult to work with, in that it requires a compilation
step & a run step before you can see the outcome of your code.

``` bash Run a rust program
± |master ✗| → rustc fizzbuzz.rs
± |master ✗| → ./fizzbuzz
```

It was also a bit awkward in that creating an effective code →
execute workflow required installing [Cargo](https://crates.io/) to manage the
very small package I created. Compilation was a bit on the slow side as well,
considering I only wrote 25 lines of code.

``` bash Run my rust fizzbuzz program
± |master ✗| → time cargo run
   Compiling rust v0.1.0 (file:///Users/chrishenry/Code/fizzbuzz/rust)
     Running `target/debug/rust`
1
2
[....]
Buzz

real  0m0.363s
user  0m0.292s
sys   0m0.067s
```

[Here's my implementation](https://github.com/chrishenry/fizzbuzz/tree/master/rust).

## Go

[Golang](https://golang.org/) is an open source, statically-typed language
that's been designed to make it straight forward to build reliable and efficient
software. That's what it says on the tin, and happily, that was my experience.

Buzz

real  0m0.132s
user  0m0.101s
sys   0m0.028s
```

It was also fast. Almost 3x faster than rust. It wound up being slightly more
code, as Go requires you to name the package, and to import the `fmt` package
just to print to `stdout`. However, the experience writing it was quite nice.
Very clear errors appeared at compile time, which was helpful as a n00b.

[Here's my FizzBuzz implementation](https://github.com/chrishenry/fizzbuzz/blob/master/go/fizzbuzz.go).

## Conclusion

Overall, it was a good learning experience to dig into the next generation of
programming languages. Rust seems promising, should I need to actually do
system programming. But Go seems like a great candidate for building fast,
portable tools.

repository: chrishenry/octopress

extension: markdown

repo_name: chrishenry/octopress


text:
# French translation of the Ruby on Rails guides

This Git repository is the official French translation of the Ruby on Rails guides.

Please refer to the [wiki](https://github.com/railsfrance/docrails/wiki) for current translations and more informations.

## Contributing

If you have any questions, comments, or concerns, please use the GitHub issue tracker.

Contributions are welcome, here how to contribute :

#### 1. Clone the repo

    git clone git://github.com/railsfrance/docrails.git

#### 2. Add your name to the right of the file you're translating in [the wiki](https://github.com/railsfrance/docrails/wiki)

#### 3. Create a pull request

We will review your translation and merge it.

## General informations on the Ruby on Rails guides

http://weblog.rubyonrails.org/2008/5/2/help-improve-rails-documentation-on-git-branch

license: MIT,Ruby

detected_licenses: MIT Ruby


text:
---
layout: post
title: Sports
---

![image title](/images/soccer1.jpg)

## Favorite Sport
My favorite sport that I love playing is soccer. For e soccer is the best sport out of all but that's just my opinion. I've played soccer for almost my whole life and I will keep playing until I get too old to play, but once I can i'm going to make sure my kid play. I also love watching soccer on the TV, I find it interesting and fun to watch. My favorite soccer teams are Barcelona, Mexico, Tigres, and many other. I know some people don't like soccer but its not that bad if you put some time in to it.

## Other Interesting Sports
My top three favorite sports are soccer, basketball, and football. I mainly like watching football I don't really play it.  Basketball on the other hand I play it and watch it, my favorite team are the LA Lakers and now that we have Lebron James in the team we are going to start beasting. My favorite player on that team is Lonzo Ball. I really don't know why I like him but he's pretty good and his dad is really funny and he has two other brothers hat are going to make it to the NBA. My favorite team in football are the New England Patriots. Tom Brady is the goat I don't care what anyone says he is the best quarterback of all time!

To learn more, click [here](https://en.wikipedia.org/wiki/Association_football).


text:
# StateTaxForm

Represents a tax form that is added to a candidate at the state level.

The StateTaxForm entity is only available in the user interface if the novoTaxInfoTab corporation setting is enabled.

    <colgroup>
        <col width="20%" />
        <col width="20%" />
        <col width="20%" />
        <col width="20%" />
        <col width="20%" />
    </colgroup>

            StateTaxForm fields
            Type
            Description
            Not null
            Read-only

            id
            Integer
            Unique identifier for this entity.
            X
            X

            candidate
            To-one association
            Candidate to which the StateTaxForm applies.
            X

            customDate1-5
            Timestamp
            Configurable date fields that can be used to store custom data depending on the needs of a particular deployment.

            X

            customInt1-5
            Integer
            Configurable numeric fields that can be used to store custom data depending on the needs of a particular deployment.

            X

            customMoney1-5
            BigDecimal
            Configurable numeric fields that can be used to store custom data depending on the needs of a particular deployment.

            X

            customText1-10
            String (100)
            Configurable text fields that can be used to store custom data depending on the needs of a particular deployment.

            dateAdded
            Timestamp
            Date on which this record was created in the Bullhorn system.
            X
            X

            dateLastModified
            Timestamp
            Date on which this record was last modified.

            isDeleted
            Boolean
            Whether entity is deleted or the default value is false.

            isExempt
            Boolean
            To claim exemption from withholding, set this to withholding.

            stateAdditionalWithholdingsAmount
            BigDecimal
            Number of state withholdings Candidate has selected on W-2 tax form.

            stateExemptions
            Integer
            Number of state exemptions Candidate has indicated on W-2 tax form.

            stateFilingStatus
            String (10)
            Candidate’s state tax filing status.

            taxStateID
            Integer
            State in which Candidate pays taxes.

repository: bullhorn/rest-api-docs

repo_name: bullhorn/rest-api-docs


text:
# Training your own Entity Disambiguation model
For our final tutorial we will train our own Entity Disambiguation model. The first step, as always, is to import
the necessary packages and to define the `wiki_version`.

```python
from REL.training_datasets import TrainingEvaluationDatasets
from REL.entity_disambiguation import EntityDisambiguation

wiki_version = "wiki_2019"
```

Our second step is loading our training and evaluation datasets that can be found in our `generated` folder. These
datasets are provided by us, but can also be generated by the user in previous steps.

```python
datasets = TrainingEvaluationDatasets(base_url, wiki_version).load()
```

Our third step consists of defining the config dictionary that serves as an input to the model. If the mode is set
to `eval` then the model will evaluate the given datasets given that the model exists (else it will throw an error). The
mode should be set to `train` if the user wishes to train a new model and save it in the given `model_path`.

```python
config = {
    "mode": "train",
    "model_path": "{}/{}/generated/model".format(
        base_url, wiki_version
    ),
}
model = EntityDisambiguation(base_url, wiki_version, config)
```

Our fourth and final step consists of training or evaluating the model. This is dependent on the `mode` that was chosen previously,

```python
# 3. Train or evaluate model
if config["mode"] == "train":
    model.train(
        datasets["aida_train"], {k: v for k, v in datasets.items() if k != "aida_train"}
    )
else:
    model.evaluate({k: v for k, v in datasets.items() if "train" not in k})
```

repository: sbrugman/REL

repo_name: sbrugman/REL


text:
# crewman-daniels
Build status: [![build status](https://travis-ci.org/rnowling/crewman-daniels.svg?branch=master)](https://travis-ci.org/rnowling/crewman-daniels)

[Crewman Daniels](http://memory-alpha.wikia.com/wiki/Daniels_(Crewman)) is a character from [Star Trek: Enterprise](https://en.wikipedia.org/wiki/Star_Trek:_Enterprise) who travels or transports the crew to various points in time to assist them.

<img src="https://vignette.wikia.nocookie.net/memoryalpha/images/8/89/Daniels2.jpg/revision/latest?cb=20100806165630&path-prefix=en" width="100px" height="120px">

Similary, `crewman-daniels` is a set of tools that help with analyzing the timeseries data generated by molecular dynamics simulations. Many of these tools build on excellent libraries maintained by others in the field.

## Dependencies

* [MDTraj](http://mdtraj.org)
* [Scikit-learn](http://scikit-learn.org/stable/)
* [MSMBuilder](http://msmbuilder.org)
* [NetworkX](https://networkx.github.io/)
* Numpy/Scipy/Matplotlib
* Seaborn

## Running Tests
To run the included tests, you will need to download the test data set (2 us of Ala5 simulation data).  The included `Makefile` can download the data and run the tests for you.

```bash
$ make test
```

Note that you will need to have the Git [Large File Storage](https://git-lfs.github.com/) plugin installed to download the data.  To run the tests, you will need to have [bats](https://github.com/sstephenson/bats) installed.

## Tools

### Strip Water and PBC
Many of the tools in Crewman Daniels were originally written for implicit-solvent simulations.  As a consequence, they do not properly handle periodic boundary conditions (PBC).  As a consequence, to apply the tools to explicit solvent simulations, we need to strip the waters and center the protein within the box.  We provide a script to help with this:

```bash
$ ./bin/strip-water-pbc \
    --input-pdb <pdb-file> \
    --input-traj <dcd-file> \
    --output-pdb <pdb-file> \
    --output-traj <dcd-file>
```

### Root-Mean-Square Deviation (RMSD)
RMSD can be calculated using the `rmsd` script:

```bash
$ ./bin/rmsd \
    --timestep <timestep-in-ns> \
    --pdb-file <pdb-file> \
    --input-traj <dcd-file> \
    --figure-fl <rmsd.png> \
    --output-tsv <rmsd.tsv>
```

The script supports specifying keywords `all`, `heavy`, `minimal`, `alpha`, and `water` for atom groups or a valid MDTraj [atom select expression](http://mdtraj.org/1.9.0/atom_selection.html).

### Angular Root-Mean-Square Fluctuation (RMSF)
Angular RMSF calculated from the phi and psi dihedral angles can be calculated with:

```bash
$ ./bin/angular-rmsf \
    --pdb-file <pdb-file> \
    --input-traj <dcd-file> \
    --figure-fl <rmsd.png> \
    --output-tsv <rmsd.tsv>
```

Angular RMSF is less sensitive to rotation and translation of subunits versus RMSF calculated from XYZ coordinates of alpha carbons.

### End-to-End Distance
Find box containing selected atoms and calculate length of the hypotenuse:

```bash
$ ./bin/end-to-end-distance \
    --pdb-file <pdb-file> \
    --input-traj <dcd-file> \
    --timestep <elapsed-time-between-frames-in-ns> \
    --figure-fl <rmsd.png>
```

### Component Analysis
The `component-analysis` module performs feature extraction, dimensionality reduction, and facilitates analysis of the resulting components. Supported dimensionality reduction (decomposition) methods include [PCA](http://scikit-learn.org/stable/modules/generated/sklearn.decomposition.PCA.html), [SVD](http://scikit-learn.org/stable/modules/generated/sklearn.decomposition.TruncatedSVD.html), [ICA](http://scikit-learn.org/stable/modules/generated/sklearn.decomposition.FastICA.html), and [tICA](http://msmbuilder.org/3.8.0/decomposition.html#tica). If deciding between the methods, tICA performed on `transformed-dihedrals` (sine and cosines of dihedral phi and psi angles) is most likely best suited for your needs.

```bash
$ ./bin/component-analysis \
    train-model \
    --n-components <n-components> \
    --pdb-file <pdb-file> \
    --input-traj <dcd-file> \
    --model-file <trained-model> \
    --feature-type <feature-type> \
    --model <model-type>
```

Supported analyses include explained variance ratios (PCA), timescales (tICA), heatmap of projections (all methods), and timeseries of projected coordinates (all methods).

repository: rnowling/crewman-daniels

repo_name: rnowling/crewman-daniels


text:
# ProdHiFiApi

The code is a sample implementation of a **web api** that is used for Product management for a **estore**. The API is quite basic in its implementation has some basic CRUD methods. The project also has unit tests that some basic testing of the API

## Controller Methods

 1. GET - Get all products.
 2. GET(id)  - Get By Id.
 3. POST(model) - Adding a new product.
 4. PUT (model) - Updating an existing product.
 5. DELETE(id)  - Removing an existing product.

## Authentication Methodology

I am using **JWT Authorization** header using the Bearer scheme

## Implementation Details

### Swagger

The project is configured to use swagger. The first method to execute should be the authenticate which accepts a random string and returns a token. Then the Authorization token in the swagger project can be configured with this generate token. Once done, rest of the methods are executed using the token which will authorize the requests.

### Html Interface

The HTML Interface has basic UI to accommodate the basic operations of the API. The UI currently has the following

1. Allows you to first authenticate yourself by providing an email address. There is no restriction on the email address. It can be even a random string. No validation is applied there.
2. From there all requests are authenticated using the token generated.
3. Products are listed in a table with action columns where, you can either delete or edit a given product.
4. A simple form is provided to add new product. Create button will create a new product.
5. Clicking delete button will delete the product
6. Clicking on edit button will populate the form with selected product and the button will change to "Update". Clicking on that button will update the product details.

## Controller Details

The following are the action methods available in the **ProductController**

1. Authenticate
2. Get
3. Get (id)
4. Post (Product)
5. Put (Product)
6. Delete (id)
7. SearchProductByDescription(searchText)
8. SearchProductByBrand(searchText)
9. SearchProductByModel(searchText)

repository: vikramjb/ProdHiFiApi

repo_name: vikramjb/ProdHiFiApi


text:
# ansible-dynamic-inventory
This repository shows a step-by-step approach of implementing Ansible Dynamic inventory.

# Pre-requisite
To simulate VM's we are using Docker, so Docker is the only pre-requisite. Also you have to build the docker images for control server and target VM's
```
    make build
```

# High Level Flow
We are simulating Dynamic inventory in 3 steps:
* Step 1
    * Create initial setup with an Ansible control server and 2 VM's (vm1 & vm2)
    * Use anible ping module to validate if control server can talk to 2 VM's
* Step 2
    * Add 3 more VM's(vm3, vm4 & vm5) in the overall setup
    * Use ansible ping module to validate if control server can talk to all VM's
* Step 3
    * Delete 2 VM's(vm1 & vm2) in the overall setup
    * Use ansible ping module to validate if control server can talk to remaining VM's(vm3, vm4 & vm5)

# Detailed Flow
We will be doing a gradual move to dynamic inventory solution
* Implement dynamic inventory by updating static inventory file as per chaning infrastructure
```
cd static_inventory
make run-simulation
```

* Implement dynamic inventory by replacing inventory file via corresponding json file but still changing inventory file as per changing infrastructure
```
cd json_static_inventory
make run-simulation
```

* Implement dynamic inventory by replacing inventory file via a bash script, but still the bash script will be updated as per changing infrastructure
```
cd dynamic_inventory_sol1
make run-simulation
```

* Implement dynamic inventory by replacing inventory file via a bash script, this bash script will actually get the VM details at runtime
```
cd dynamic_inventory_sol2
make run-simulation
```

repository: ishaan-amb/ansible-dynamic-inventory

repo_name: ishaan-amb/ansible-dynamic-inventory


text:
# Swift Generic JSON Type

This package provides a simple container for any JSON-data, that conforms to the `Codable` protocol.

Use this when you want to send the result of a function returning JSON-data as a `Decodable`, to another function accepting JSON-data as an `Encodable`; e.g. if you want to send the result of [`Marionette`'s `evaluate`](https://github.com/LinusU/Marionette) to a [JSBridge function](https://github.com/LinusU/JSBridge).

## Installation

### SwiftPM

```swift
dependencies: [
    .package(url: "https://github.com/LinusU/GenericJSONType", from: "1.0.0"),
]
```

### Carthage

```text
github "LinusU/GenericJSONType" ~> 1.0.0
```

## Usage

```swift
import GenericJSONType

let myJSONString = " ~~ any valid JSON string here ~~ ".data(using: .utf8)!

let decoder = JSONDecoder()
let decoded = try decoder.decode(JSON.self, from: myJSONString)

// `decoded` is now a structure representing the JSON data

let encoder = JSONEncoder()
let encoded = try encoder.encode(decoded)

// `encoded` is now a JSON representation of the data we started out with
```

## Hacking

The Xcode project is generated automatically from `project.yml` using [XcodeGen](https://github.com/yonaskolb/XcodeGen). It's only checked in because Carthage needs it, do not edit it manually.

```sh
$ mint run yonaskolb/xcodegen
💾  Saved project to GenericJSONType.xcodeproj
```

repository: LinusU/GenericJSONType

repo_name: LinusU/GenericJSONType


text:
---
layout:     post
title:      System-Level Transactions with picotm
date:       2018-02-12 11:00:00 +0100
tags:       [picotm]
og-image:   share2.png
---

I'll speak about [picotm][picotm] at this year's
[Chemnitzer Linux-Tage][clt2018:picotm]. The conference committee asks
each presenter to submit a shortpaper containing an overview of the
presentation's content. Now that I have this nice single-page overview
of picotm, I decided to post a cleaned-up version here in my blog. A
[PDF][shortpaper20180212] of the text is also available.

<!-- excerpt -->

#### The Problems with Traditional Code

Our goal is to write software that works reliably under all circumstances.
Besides correctness at the algorithmic level, this requires
correct handling of concurrency and run-time errors. Both are notoriously
hard to test and implement.

``` c
int fd0, fd1; /* file descriptors */
char obuf[100]; /* output buffer */

write(fd0, obuf, sizeof(obuf));
write(fd1, obuf, sizeof(obuf));
```

This example program writes an output buffer to two files. If the first
`write()` operation succeeds but the second fails, only one file will
be updated and the program will enter an inconsistent, and probably erroneous,
state. Correctly returning to the previous consistent state will become
impossible at this point. If there's concurrent access to the files, the
program's result will become unpredictable. Similar examples can be
constructed for memory access, data structures, or any other non-constant
resource.

#### Transactional Execution

A *transaction* is a transition from one consistent state to another
consistent state; without the intermediate steps being visible outside of the
transaction's context. This is known as the ACID properties *atomicity,*
*consistency,* *isolation* and *durability.* To achieve ACID
properties, a transaction has to handle run-time errors and concurrency of
its contained operations; exactly those pieces of the software that we just
identified as being problematic.

#### Phases of each Operation

Most operations, such as `write()`, can be split into different
phases. We call them *execute,* *apply* and *undo.*

When first called, an operation enters the execute phase, where it allocates
resources, acquires locks and checks for potential run-time errors. If
successful, the operation will enter the apply phase where its effects become
globally visible. If unsuccessful, the operation will enter the undo phase,
where all setup from the execute phase is reverted.

For *n* operations in a row, phases can be rearranged. First we
perform all execute phases *e_1,* *e_2,* ... *e_n.* If successful, we will
perform all apply phases *a_1,* *a_2,* ... *a_n.* In unsuccessful, we will
revert execution with the undo phases *u_n,* ... *u_2,* *u_1.* This scheme
allows us to compose transactions from arbitrary operations.

#### System-Level Transactions with picotm

*picotm* is a system-level transaction manager implemented in highly
portable C. It provides a generic framework to formalize the
execute-apply-undo scheme and to integrate a large number of different modules
and interfaces. All concurrency control and error detection is performed
internally, users only have to implement application-specific algorithms
and error recovery.

Re-implementing the example program puts all execute phases between
`picotm_begin` and `picotm_commit`. Note each operation's
`_tx` suffix.

``` c
picotm_begin
  /* execution phase */
  write_tx(fd0, obuf, sizeof(obuf));
  write_tx(fd1, obuf, sizeof(obuf));
picotm_commit /* apply during commit */
  /* recovery phase */
  put_error_recovery_here();
  picotm_restart();
picotm_end
```

Execute phases perform concurrency control and error detection
internally. Each operation's apply phase is performed by
`picotm_commit`. Until commit, all changes are local and can be
reverted via the corresponding undo phase. After reverting from a detected
error, the transaction enters the recovery phase where the application
can attempt to repair the error and restart the transaction.

#### picotm Modules

The picotm core library provides the building blocks for generic error
handing and concurrency control. On top of these primitives, users can
implement modules for their specific use case and application.
Out of the box, picotm comes with a large set of available modules, such as

* Software Transactional Memory: Transactional access to shared memory
* Data structures: Implements transactional lists, queues, multisets, stacks
* Memory management: Provides transaction-safe C memory allocation with
  `malloc()`, `free()`, et al.
* C string and memory operations: Provides C Standard Library functions that
  operate on transactional memory, such as `memset()`, `strcpy()`, et al.
* File-descriptor I/O: Offers transaction-safe access to files and file-like
  structures on P<small>OSIX</small> systems, with functions such as
  `open()`, `close()`, `read()`, `write()`, et al.
* C math functions: Transactional `tan()`, `sqrt()`, et al.

All available modules co-operate and can be mixed freely. More modules are
planned and will be added over time.

#### Obtaining picotm

picotm is available at [http://picotm.org][picotm]. It's
implemented in plain C and currently supports Linux, MacOS X, Windows
(Cygwin) and FreeBSD. More systems are planned. The source code is
distributed under the terms of the [MIT license][opensource:mit].

[clt2018:picotm]:       https://chemnitzer.linux-tage.de/2018/de/programm/beitrag/203
[opensource:mit]:       http://opensource.org/licenses/MIT
[picotm]:               http://picotm.org/
[shortpaper20180212]:   {{ site.baseurl }}/pubs/picotm-shortpaper20180212.pdf


text:
# Contribution Example

> This is a private example package which can serve as a base for contributions.

Read more about when and how to use the [Component Name] component [on the internal wiki](https://wiki.autodesk.com/display/HIG/Component%20Name).

## Getting started

```bash
yarn add @hig/contribution-example
```

## Import the component and CSS

```js
import ContributionExample from '@hig/contribution-example';
import<EMAIL_ADDRESS>```

## Basic usage

```jsx
<ContributionExample />
```

repository: kongnir/hig

branch_name: refs/heads/development

repo_name: kongnir/hig


text:
# Splunk extension for Visual Studio

## Version 1.3.1

* Add support for Visual Studio 2015 Pro edition.

## Version 1.3.0

* Add support for Visual Studio 2015 Enterprise and Community editions.
* Updated Splunk SDK packages to Splunk.Client.2.2.2 and Splunk.ModularInputs.2.2.2
* Updated Splunk library for .NET logging packages to v1.5.0, with support for HTTP Event Collector.

## Version 1.2.0

* Add fix to codegen to use `uint` for the timeout variable.
* Updated Splunk SDK packages to Splunk.Client.2.1.2 and Splunk.ModularInputs.2.1.2
* Updated Splunk library for .NET logging packages.

## Version 1.1.0

* Add support to Modular Input template for deploying the input to a local Splunk instance on build via a Post Build script.
* Fixed a bug in the sample Modular Input generated code.
* Includes support for attaching to inputs to debug within Visual Studio.
* Updated Splunk SDK packages to Splunk.Client.2.1.1 and Splunk.ModularInputs.2.1.1

## Version 1.0.0

* Add support for TCP logging in Splunk SDK for C# project wizard.
* Updated Splunk SDK for C# and Splunk library for .NET logging NuGet packages.

## Version 1.0.0-beta (0.8)

* Initial release.

repository: splunk/splunk-extension-visualstudio

gha_language: C#

repo_name: splunk/splunk-extension-visualstudio


text:
# Arbaroen-android
Use rotary encoders to control audio in android car system

In a personal project of embedded android system based on a ODROID XU4, I needed 2 rotary encoders to control playback for more safety in driving.
This is the Android side.

An arduino nano runs the 2 rotary encoders, plugged by usb serial port.

in the repository named Arbaroen-Arduino, you have the arduino code.

For signing app, use platform keys due to USB_MANAGE privilege

For signing inside android-studio, use keytool-import script in signing APK directory
(https://devarea.com/signing-android-application/#.Xi73D-HjIUG)

After signing, zipalign app with

```
zipalign -fv 4 YourApplication-signed.apk YourApplication-aligned.apk
```

repository: juanitomaille/Arbaroen-android

repo_name: juanitomaille/Arbaroen-android


text:
# Note History

A widget that tracks Beat Saber notes in a 2D interface in real time. It can be used as a local display or added as a Browser source in OBS for videos and streams.

Created by [Protected](https://github.com/Protected/). Contains cut intersection algorithms and vector math by [opl-](https://github.com/opl-/).

**Requires:** The [Beat Saber HTTP Status](https://github.com/opl-/beatsaber-http-status/releases) mod for Beat Saber (at least **v1.19**). It's usually available on Mod Assistant, and when it isn't it's usually because there was an update and the previous version still works.

**Source URL:** `https://protected.github.io/beatsaber-notehistory` (or set up your own!)

**[Quick OBS Setup](#quick-obs-setup)** - It's the same as every other widget!

**[Settings](https://github.com/Protected/beatsaber-notehistory/wiki/Settings)** - We have many settings you can use without setting up your own copy of NH.

**[Styles and customization](https://github.com/Protected/beatsaber-notehistory/wiki/Styles-and-customization)** - How the widget is structured so you can change its look and feel.

**[Reporting issues and getting help](#reporting-issues-and-getting-help)**

![Some schmuck using the widget](example.png)

## Quick OBS Setup

Note that you may want to use multiple instances of this widget at the same time. That's fine! These instructions are for setting up one instance of the widget.

1. Add a new **Browser source** to your Scene.
2. Fill in the **Source URL** (from the top of this page) including the settings you want (read below).
3. Set the width and height. The width should be __144 times SCALE__ where SCALE is the value of your [scale](https://github.com/Protected/beatsaber-notehistory/wiki/Settings#scale) setting (by default it's 1) and the height is whatever you want.

If you want to adjust the position of the source, add the `test=1` setting to the URL, position the source, then go to properties and remove it.

## Reporting issues and getting help

**If you found a bug or have a sensible feature suggestion**, please open a ticket in the github repository where you found the widget. No other communication methods will be accepted.

Always communicate your issue clearly and explain in detail what steps can be taken to reproduce it and what exactly is going wrong.

**You can open pull requests** with changes and styles you made. Please mind the contributing guidelines.

**If you need help, Discord is the best place to get it**. Be patient, don't ask for permission to ask your question, don't bump/repeat your message.

repository: Protected/beatsaber-notehistory

repo_name: Protected/beatsaber-notehistory


text:
---
author: Caleb Eby
published: true
title: BunnyBots!
summary: >-
  Bunnybots has begun! Find out about the 2016 BunnyBots competition,
  "Round-a-BOUT"
tags:
  - BunnyBots
---
## The Competition
[BunnyBots](http://team1540.org/bunnybots/) is an annual competition for FRC teams hosted by [the Flaming Chickens](http://team1540.org/), at [Catlin Gabel](http://www.catlin.edu/). The 12-week build season starts in September, and lasts until December. Like [FRC](http://www.firstinspires.org/robotics/frc), the game changes every year.

![BunnyBots Logo]({{site.baseurl}}/source/images/blog/bunnybots-2016-logo.png)

## 2016 Game
The 2016 game, "Round-a-BOUT", was announced September 1st. In it, six robots, three per alliance, drive around a figure-eight track while shooting Nerf darts at each other, and loading stuffed bunnies into recycle bins.

## What we're up to
We are very busy coming up with ideas for this year's BunnyBot. We'll share more in a few weeks!

branch_name: refs/heads/source

gha_language: CSS


text:
# Embedded-Cooperative-Scheduler
This is a repo for the first project for the Embedded systems course.
This scheduler was developed on NUCLEO-L432KC MCU board.

## Usage
### Including

This scheduler uses 'co_sched.h', 'co_sched_API.h'. Both must be included in the main program.
Inside the ```SysTick_Handler``` insert the function ```coop_sched_tick(); ``` or replace the ```stm32l4xx_it.c``` file with the one in this repo.

### Scheduling Tasks
Initialise the scheduler using ```Init()```

Insert your tasks into the queue using ```QueTask()``` that accepts the function name and its priority.

Use ```Dispatch()``` to execute the ready tasks.

## Implementation Details

### Data structures

`Qnode`

A data structure that contains information about a task in the scheduler. This information is the `task_ptr`, `priority`, and `sleeping_time`.

`readyQ`

This is a dynamic array of type Qnode that contains all the tasks in the scheduler that are ready to be executed. The tasks are sorted ascendingly in order of their priorities.

`delayedQ`

This is a dynamic array of type Qnode that contains all the tasks in the scheduler that are waiting for a certain delay of `sleeping_time` to be executed. The tasks are sorted ascendingly  in order of their sleeping_time.

### Helper Functions

`swap`

A helper function in sorting the task queues by swapping two Qnodes inside a queue. It accepts two arguments which are pointers to the Qnodes desired to swap.

`decrementAll`

A helper function that decrements the sleeping_time value for all nodes in the delayedQ by the value `counter` which is the argument it accepts.

## API Details

`Init`

This function initializes the system.
Creates the first node in the readyQ and the delayedQ. It allocates memory for both queues. Then it initializes the variables representing each queue length.

`QueTask`

This function handles the readyQ. It accepts two arguments; `task_ptr` which is a pointer to a VOID task (essentially the task name) and `priority` which is a number representing the task priority.
The insertion into the ReadyQ is done by creating a new Qnode and assigning the task and priority arguments to this node. This node is inserted into the back of the readyQ. Then the readyQ is sorted according to the priorities at each new insertion. This function also handles allocating new memory for the readyQ if the allocated memory was fully used.

`ReRunMe`

This function handles the delayedQ. It accepts one argument; `delay` which is the time this task is supposed to wait in the delayed queue before being sent to the readyQ. The task_ptr and priority for this task are acquired from the `running` task.
If the `delay` is `0` then the task is sent directly to the readyQ using `QueTask`
The insertion into the delayedQ is done by creating a new Qnode and assigning the task and priority arguments to this node. This node is inserted into the back of the delayedQ. Then the delayedQis sorted according to the `sleeping_time` at each new insertion. This function also handles allocating new memory for the delayedQ if the allocated memory was fully used.

`Dispatch`

This function is responsible for executing tasks from the readyQ when they are available. It also releases the Qnode for this task in readyQ.
This function is called inside the main `while(1)` loop, so it gets called after every system tick. At every calling of this function it executes the highest-priority task in the readyQ.

`coop_sched_tick`

This function uses the system ticks to produce scheduler ticks at a different rate. The scheduler ticks equal 50 ms.
At every scheduler tick, this function checks the delayedQ minimum sleeping_time and it decrements the sleeping_time for all Qnodes in the delayedQ using the function `decrementAll` when the number of scheduler ticks=min sleeping_time.

## Unit Tests

### readyQ_unit_test

This test is designed to test the following:
- correct initialization of the scheduler
- sorting of readyQ is done correctly
- correct functionality of `QueTask`
- correct functionality of `Dispatch`

The following tasks are inserting into the readyQ using `QueTask`.

**Task1 ->** Blinking the on-board LED 4 times with delay 500 ms.

**Task2 ->** Blinking the on-board LED 4 times with delay 1000 ms.

**Task3 ->** Blinking the on-board LED 4 times with delay 100 ms.

**Task4 ->** Blinking the on-board LED 4 times with delay 300 ms.

**Task5 ->** Blinking the on-board LED 4 times with delay 50 ms.

They are inserted into the readyQ with priorities = their number (ie; Task1 has priority 1) in an order different to their priorities.

**Insertion order:** Task5 -> Task3 -> Task1 -> Task2 -> Task4

**Execution order:** Ascending according to their priorities

Task1 -> Task2 -> Task3 -> Task4 -> Task5

Each task blinks the on-board LED 4 times with different delays, assuimg correct readyQ they delays will be in this order:

500 -> 1000 -> 100 -> 300 -> 50

[unit test Video](https://github.com/Mahfouz-z/Embedded-Cooperative-Scheduler/blob/main/media/ReadyQ_unit_test.mp4)

### delayedQ_unit_test

This test is designed to test the following:
- correct initialization of the scheduler
- sorting of delayedQ is done correctly on sleeping_time
- sorting of readyQ is done correctly on priority
- correct functionality of `ReRunMe`
- correct functionality of `QueTask`
- correct functionality of `Dispatch`

The following tasks are inserting into the readyQ using `QueTask` with different priorities.

**Task1 ->** Blinking the on-board LED 4 times with delay 250 ms and ReRuns itself with delay 15 ticks. Priority = 0.

**Task2 ->** Blinking the on-board LED 4 times with delay 500 ms and ReRuns itself with delay 10 ticks. Priority = 1.

**Task3 ->** Blinking the on-board LED 4 times with delay 50 ms and ReRuns itself with delay 0 ticks. Priority = 1.

**Task4 ->** Blinking the on-board LED 4 times with delay 300 ms. Priority = 0.

**Task5 ->** Blinking the on-board LED 4 times with delay 75 ms.
Priority = 0.

**Insertion order:** Task5 -> Task4 -> Task3 -> Task1 -> Task2

**Execution order:** assuming correct readyQ priorites, the tasks should be performed in the following order at the first cycle of each:

Task5 -> Task4 -> Task1 -> Task2 -> Task3

Each task blinks the on-board LED 4 times with different delays, assuming correct readyQ they delays will be in this order:

75 -> 300 -> 250 -> 50 -> 500

After the First round of executions the first three tasks will keep running as they insert themselves into the delayedQ using ReRunMe.
According to their delay times, order of first execution, and priorities, they will continue execution in the following order:
**Task1 -> Task2 -> Task3**
with delays **250 -> 50 -> 500**

[unit test video](https://github.com/Mahfouz-z/Embedded-Cooperative-Scheduler/blob/main/media/delayedQ_unit_test.mp4)

## Application 1: Ambient temperature monitor
This application aims at measuring the temperature from a temperature sensor and compare it to a critical temperature. This critical temperature is preset to 30 degrees Celsius in the application code. The application pulls the temperature from the temperature sensor each 30 seconds, after comparing it with the critical temperature, the micro controller fires an alarm (an LED) if the measured temperature is above the critical temperature. The alarm is only turned off when the temperature is back to lower than the critical value. Furthermore, the application allows a user to edit the predefined critical temperature by connecting the micro controller’s UART 1 through an FTDI to a terminal emulator on any desktop (in our case Tera Term). We implement this application using the implemented cooperative scheduler and cubemx.

### Application 1 Demo
[Demo Video](https://drive.google.com/file/d/1IqMptFGJMs-nHC_BAYOpRjc3JRlMp5VQ/view?usp=sharing)

### Components and Connections
We use STM32L432 as our microcontroller unit, an FTDI, and DS3231. The microcontroller reads the temperature from the DS3231 chip through i2c3 peripheral. Furthermore, it is connected to the PC through the FTDI as discussed in the above section.

![alt text](https://github.com/Mahfouz-z/Embedded-Cooperative-Scheduler/blob/main/media/application_1_circuit_diagram.jpg?raw=true)

### Application API Explanation

`void init_I2C_UART_task(void)`

The above function enables the interrupt for UART 1 that operates on a baud rate of 9600 with 8N1 serial configuration. Furthermore, it performs a check on the I2C connections to make sure that the temperature sensor is connected and ready to send the data. This function . This function is enqueued in the main before the loop and runs for one time.

`void update_temprature_task(void)`

This is a periodic task that requeues itself with a delay of 300 ticks equivalent to 30 seconds. It is enqueued one time in the main function, then it keeps requeuing itself based on the periodic time mentioned above. This task calls “float read_temprature(void)” routine that returns the temperature value. This task would enqueue “void alarm_led_toggle_task(void)” task in case the temperature violated the critical value.

`float read_temprature(void)`

This function initiates an I2C communication with the temperature sensor to read the temperature value. Before reading the temperature, this function forces the sensor to update its internal register to obtain a fresh value from the register. We note that the sensor automatically updates itself on a period of 64 seconds and since we need the data each 30 seconds, we do the force conversion to get fresh data.

`void alarm_led_toggle_task(void)`

This task toggles the led and request itself till its flag is zeroed from either the update_temprature_task() or update_critical_temprature(). When the flag is zeroed, this task enqueues “void alarm_led_off_task(void)” that will make sure that the led alarm is turned off.

`void alarm_led_off_task(void)`

A task enqueued by the toggle function to turn off the LED.

`void receive_uart(void)`

This function is enqueued into the ready queue from the UART interrupt handler. It receives the UART data byte by byte into a buffer till it finds windows endl characters “\r\n”. Then it enqueues the “update_critical_temprature” that uses this buffer, convert it to float, and update the value of critical temperature.

`void update_critical_temprature(void)`

Converts the critical temperature value characters received on the UART to a float and use it to update the temperature critical value. It echoes the updated value on the serial port. Furthermore, it could enqueue the alarm task if the current temperature is more than the new critical temperature. Also, it could lower the flag checked by the alarm toggling task to terminate it in case of a critical temperature higher than the current temperature.

### Priority Choices

Tasks that run at initialization time only were given the highest priority. After that comes the communication tasks at equal priority for both the UART and the I2C tasks. Finally the least priority was given to the most periodic task the LED blinking.

## Application 2: Parking sensor
 The program reads data from the ultrasound sensor and calculates the distance of the nearest objects from this data. Then the buzzer is used to produce beeps, the frequency of the beeps reflect the distance of the object from the sensor.

### Application 2 Demo
[Demo Video](https://drive.google.com/file/d/1vbePU137_2JWaHCBa_vhKhS03ltz6JWw/view?usp=sharing)

### Components and Connections
In this application, we use the MCU board, a buzzer, and an Ultrasound sensor.

![alt text](https://github.com/Mahfouz-z/Embedded-Cooperative-Scheduler/blob/main/media/application2_circuit_diagram.png?raw=true)
### Application API Explanation

This application consists of two tasks; one for reading from the sensor and processing its data, and another one for running the buzzer at the appropriate delays.

`hcsr04_read`

This function handles the ultrasound sensor. it pulls the pin connected to the TRIG pin of the ultrasonic sensor HIGH for 10 us then it receives data from the ECHO pin. the ECHO pin is set to high for a time period proportional to the distance of the detected object. a flag is raised inside this function for the time the ECHO pin is set to HIGH.
during this time, the SytTickHandler interrupt is used to count this time by calling another function `measure_time`
distance is calculated using the time that has been incremented during the flag raise.
This task uses ReRunMe in order to read continuously from the ultrasound sensor and update the distance

`measure_time`

This function is called inside the SytTickHandler, it checks if the flag is raised and increments the value of time if it is.

`buzzer_task`

This function checks if the measured distance is less than a certain threshold. if it is, it toggles the buzzer pin and uses ReRunMe to run again after a time period proportional to the distance.
if the distance is not within the threshold, the function disables the buzzer and ReRuns again with delay 10 ticks to validate the new distance.

### Priority Choices

The highest priority was given to the bigger and less frequent task which is reading from the ultrasound sensor, while lower priority was given to the buzzer task.

## License
[MIT](https://choosealicense.com/licenses/mit/)

repository: hysamah/Embedded-Cooperative-Scheduler

repo_name: hysamah/Embedded-Cooperative-Scheduler