text:
# README

## PURPOSE
A command line utility (referred to throughout this README as CommandLineClassifier) designed to promote inter-rater reliability of psychological data.

## MOTIVATION
Psychological data often requires 'coding' by researchers, and it is good practice for:
1. The data to be 'anonymous' to those coding it, and
2. The data to be 'reviewed' by > 1 researcher.
The CommandLineClassifier supports both of these practices through an easy-to-use command line utility. The Randomize and CompareRatings directories contain auxiliary scripts that, while optional, further promote these goals.

## USE CASES
Thus far, the CommandLineClassifier has been used for a project titled *The Need for TLC: Tender Loving Cellphone*. A recent poster of this work (PhaneufJuhaszKruger2019.pdf) can be found in the root directory of this repository (https://github.com/cphaneuf/inter_rater_reliability/blob/master/PhaneufJuhaszKruger2019.pdf). Here are some other possible use cases for the CommandLineClassifier:
1. __Observational Data__ 2+ researchers 'code' transcriptions of behavior/commentary in video recordings
2. __Survey Data__ 2+ researchers 'code' fill-in-the-blank survey responses
3. __Imaging Data__ 2+ researchers quality assess imaging data
4. __Video Data__ 2+ researchers 'code' behavior/commentary in video recordings

In all of these cases, it is important for researchers to reach a consensus on their codings, ratings, etc. The CommandLineUtility streamlines this process.

__NOTE:__ Items 3 and 4 require additional development for image or video display, but these changes can be built upon the current framework. While knowledge of C++ is not necessary for using the CommandLineClassifier, it is necessary for adding features.

## INTRODUCTION
The CommandLineClassifier program supports:
1. Reading in a transcribed text file, with individual testing sessions formatted according to textfile_template_control.txt or textfile_template_test.txt (more information about how the file should be formatted is described in ClassifierTextFileTemplates/TextFileFormattingDescription.md)
2. Storing the study participants' response(s) contained in the text file
3. Allowing the user to 'tag' or 'code' the contents of the text file, line by line

__NOTE:__ When the user is prompted to 'tag' or 'code' at the command line, only the data is presented; participants are completely de-identified from the user's perspective

4. Storing the user's 'codings' or 'ratings', as they relate to the participants' response(s)
5. Outputting a file (data.csv) which contains the participants' response(s) matched to the user's 'codings' or 'ratings', formatted according to data_template.csv

## HOUSEKEEPING
All files labeled with 'template' are included in this repository as examples of inputs/outputs to the program, with the goal of promoting greater README comprehension.

## COMMANDLINECLASSIFIER IMPLEMENTATION OVERVIEW
The program begins by prompting the user to: a) set the mode (debugging y/n), and b) enter the name of a (.txt) file. This file should be stored in the same directory as CLC.cpp. Afterward, the user will simply follow along with the prompts as provided on the screen.

__Data Structures__
*subject* is a struct that stores the comments associated with a particular participant AND the user's 'tags' or 'codes' for those comments.
*completeData* is a class that contains 3 data members and 9 functions, divided according to the sets below. Control flow between these sets of functions is directed by main().
* Functions to Store Responses
* User Interface Functions
* Save Output Functions

__Core Functionality__
*store_responses()* is a Function to Store Responses that saves the participant comments into individual subjects, which are stored collectively in a dictionary.
*process_question()* is a Function to Store Responses that handles the reading of participant comments to a single question.
*process_session()* is a Function to Store Responses that reads in the file header, and processes the appropriate number of questions (according to test condition).
*print_prompt()* is a User Interface Function that prints a question-answer pair and prompts the user to make a decision.
*process_choice()* is a User Interface Function that manages the selection of a question-answer pair and stores the user's choice.
*make_response_list()* is a User Interface Function that compiles a list of all of the participant comments.
*print()* (see Debugging, below)
*write_to_file()* is a Save Output Function that iterates through the dictionary of subjects and prints out its contents into data.csv.
*main()* declares an instance of completeData, manages the control flow of the program, and prints a concluding message.

__Current Implementation__ \
CommandLineClassifier/CLC.cpp supports text files with:
1. 5 question types, with parts A and B for each question
2. up to 6 participants, each labeled MN (where M is an integer and N is a letter belonging to the set \[A,F])
3. 2 participant groups ('conditions': CONTROL and TEST), where one group has questions 1, 2, 3, 4, and 5, and the other group answers questions 1, 2, 3, and 5

An example question, asked in PhaneufJuhaszKruger2019.pdf is as follows. \
Question X body, part A: "When is it not appropriate to use a cell phone? Among certain people? In certain locations? In particular situations?" \
Question X body, part B: "Does this answer demonstrate awareness of cell phone etiquette?"

Before running this program, be sure to modify the following to match the content/structure of your project:
* change the templated question bodies in CommandLineClassifier/CLC.cpp
* modify the number of questions, participants, and/or conditions

## USING THE PROGRAM, STEP 1: Randomize the Transcribed Data (Text Files) with an Auxiliary Script
For example, it may be desirable for transcriptions of behavior/commentary in video recordings to be randomized, so behavior/commentary is not 'coded' chronologically. As in the case of PhaneufJuhaszKruger2019.pdf, the authors did not want research assistants to 'code' transcriptions sequentially because 'coding' the current behavior/commentary in question could be biased by the preceeding behavior/commentary; the authors aimed to adopt the most conservative approach possible when processing their observational data. Listed here are the instructions for combining and randomizing standard transcription text files to create a single text file that can be fed into the command line utility. This series of steps should be completed by a project manager (not a researcher that will later be 'coding' the text files).
1. Name the transcribed data files text1.txt, text2.txt, text3.txt, ..., textM.txt, where M is the maximum number of transcribed data files.
2. Navigate to the Randomize directory.
3. Compile the program to make an executable, named main.

$ g++ -std=c++11 -o main Randomize.cpp

4. Run the newly generated executable, responding appropriately to the prompts.

$ ./main

5. Make a new, blank text file named (e.g.) text.txt.
6. Copy and paste the transcribed data files into text.txt, according to the directions shown in the terminal window. Specifically: \
  a. Start the file with: N = number of sessions in this file \
  b. Copy and paste in the instructed session files, with an enter space between them \
  c. End the file with: EOF

## USING THE PROGRAM, STEP 2: Use the CommandLineClassifier to 'Code' the Randomized Text Files
Listed here are the instructions for 'coding' the randomized text files using the command line utility. This series of steps should be completed by 2+ researchers (not the project manager from Step 1).
1. Move text files to be 'coded' into CommandLineClassifier (e.g. text.txt).
2. Compile the program to make an executable, named main.

$ g++ -std=c++11 -o main CLC.cpp

3. Run the newly generated executable.

$ ./main

4. After the program runs, data_X.csv will be created, where X is the date/time stamp.

## USING THE PROGRAM, STEP 3: Compare the 'Codings' or 'Ratings' from 2+ Independent Researchers
Once all (2+) researchers have finished using the CommandLineClassifier (i.e. all text files have been independently 'coded'), follow these instructions.
1. Compile all of researcher 1’s raw data files into a singular file named Coder1Output.csv (see example in CompareRatings directory).
2. Compile all of researcher 2’s raw data files into a singular file named Coder2Output.csv (see example in CompareRatings directory).
3. Open Coder1Output.csv and Coder2Output.csv in Microsoft Excel (or equivalent). If you see 'garbled characters' in Excel, the developer found this article to be helpful: https://support.collaborativedrug.com/hc/en-us/articles/115004625563-CSV-import-in-Excel-with-garbled-characters.
4. Sort Coder1Output.csv and Coder2Output.csv by SubjectID: \
  a. (In Excel) Data > Sort > A to Z \
  b. Save files
5. Open CompareRatings/CompareRatings.R in RStudio.
6. Update the path to your working directory at 'YOUR PATH HERE' in CompareRatings.R.
7. Run CompareRatings.R in RStudio; take note of Quality Control console output.
8. CombinedOutput.csv is produced by CompareRatings.R; to make it more readable (especially if it is a large file), consider these modifications in Excel: \
  a. Highlight the content of the ‘Master’ columns (Home > Conditional Formatting > Highlight Cells Rules > Equal To… > -2); the default conditional formatting color is red \
  b. Highlight the Coder1 output blue; highlight the Coder2 output green
9. Resolve items in CombinedOutput.csv that are highlighted in red (indicating inter-rater disagreement): \
  a. Have 'coding' researchers meet to come to an agreement on 'coding' designation, or \
  b. Have project manager make final decision on 'coding' designation
10. Make the appropriate changes to reflect unanimous, final decisions; save final data file as CombinedOutput_resolved.csv.

__*CombinedOutput_resolved.csv is the final product of this command line utility and its associated data processing scripts.*__

## DEBUGGING
Built-in debugging tools are included in the CommandLineClassifier program. If you activate debugging mode (typing 'y' when prompted), this will allow a call to print() in the completeData class, which tests the success of:
1. Storing the study participants' verbal and nonverbal responses in the text file read into CLC.cpp (e.g. text.txt)
2. Storing the CommandLineClassifier user's 'codings' or 'ratings', as they relate to the participants' responses

See the terminal window for the output, which should be compared to the:
1. Chosen input file (e.g. text.txt)
2. User's 'codings' or 'ratings' (north in the terminal window)

## TECHNICAL, GENERAL
You must remake the main executable after changes to its corresponding .cpp are completed and saved. To remove the current executable, type:

$ rm main

You may be prompted in regards to the removal of main. If so, simply type:

$ yes

## CONTACT
If you have any questions about the use of this program, or its generalizable functionality, please contact its developer, Camille Phaneuf (cphaneuf@umich.edu). To cite PhaneufJuhaszKruger2019.pdf, please use:

Juhasz, D., Phaneuf, C.V., & Kruger, D. J. (2019, March). The need for TLC (tender loving cell phone): comparing cell phone attitudes, experiences, and behaviors in undergraduates. Poster, International Convention for Psychological Science, Paris, France.

The authors (Camille Phaneuf, Dora Juhasz, & Dr. Daniel Kruger) are happy to discuss this work, and will update this README when a preprint of this project is available.


text:
# Multiple Instances

MAuth allows you to have 1, 2, 8, or 2000 separate login systems in your webapp.

The classic setup being, you want Administrators to be able to log into the backend (looking at the 'users' table), but then have customers log in using the 'customers' table. MAuth can handle all of this seamlessly.

## But how?

Like this:

	// Set up the admin MAuth:
	$mauth_admin = MAuth::instance('admin');

	// Log in an admin:
	$mauth_admin->login('Alex', 'mypassword');

	// Now do the customer MAuth:
	$mauth_customer = MAuth::instance('customer');

	// If I check logged in, nothing will be there since they're logged into Admin and not Customer:
	if($mauth_customer->logged_in())
	{
		echo "This won't show, because you're logged into Admin and not customer";
	}

Everything is kept separate so you can be sure of your walled gardens.

For more info on how to configure the instances, see [Configuration](mauth.config)

license: MIT

repository: alexgisby/MAuth

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: alexgisby/MAuth


text:
# Ubiquity Music Widget

This is an updated version of the Ubiquity Music Widget on the [Play Store](https://jathak.xyz/musicwidget),
which was originally developed by Jathak. I intend to continue developing this, and especially make
sure the widget is fully compatible with recent versions of Android.

## License
This application is licensed under the 3-clause BSD License. See the LICENSE file for more information.

repository: awbooze/musicwidget

repo_name: awbooze/musicwidget


text:
# ![Image](Demo/demo1.jpg)

**`ImageColorizer` is a Python module and a CLI tool** that you can easily use to colorize wallpapers for them to fit a terminal colorscheme.

It currently supports importing colorschemes from the currently set `Xresources` variables, `pywal` and `colorer` (my [colorscheme management engine](https://github.com/ngynLk/colorer)).

## 📓 How it works

The module uses two different algorithms:
+ pixel by pixel (default): goes through each pixel and replaces it with the right color from the colorscheme
+ average box: calculates the average color of each pixel before processing. This one gives smoother and better results in some cases.

Average                          | Pixel by pixel
:-------------------------------:|:-----------------------------:
![Average](Demo/montage_avg.png) | ![Original](Demo/montage.png)

### Usage

```
usage: ImageColorizer [-h] [-x] [-c COLORSCHEME] [-w] [-p COLOR [COLOR ...]] [-s]
                      [-b] [--average BOX_SIZE] [--no_quantize]
                      input output

positional arguments:
  input                 File to generate image from.
  output                File to generate image to.

optional arguments:
  -h, --help            show this help message and exit
  -x, --xresources      Get palette from Xresources.
  -c COLORSCHEME, --colorer COLORSCHEME
                        Get palette from colorer.
  -w, --pywal
                        Gets palette from pywal.
  -p COLOR [COLOR ...], --palette COLOR [COLOR ...]
                        Manually set colors.
  -s, --show            Show image using xdg-open when image is generated.
  -b, --blur            Blur the image
  --average BOX_SIZE    Use average algorithm (calculate the average color of
                        each pixel with the pixels around) to generate the
                        wallpaper, and set the size of the box to calculate
                        the color from
  --no_quantize         Do not quantize the image before processing (may make
                        the image look better)

```

### Examples

```shell
ImageColorizer a.jpg output.jpg -x # Generate the wallpaper from colors of the currently used ~/.Xresources or ~/.Xdefaults file
ImageColorizer a.jpg output.jpg -c ~/Configuration/colorschemes/nord # Generate the wallpaper using colorscheme nord from colorer
ImageColorizer a.jpg output.jpg -c ~/Configuration/colorschemes/nord --average 2 # Use average algorithm with box size of 2
ImageColorizer a.jpg output.jpg -c ~/Configuration/colorschemes/nord --average 2 -s # Show image at the end
ImageColorizer a.jpg output.jpg -p "#3b4252" "#bf616a" "#a3be8c" -s # Use these colors.
```

## 💻 Installation

Clone the repo and run `./install.sh` (or `pip3 install .`)

## ✔ Todo

- [ ] Multi-threading
- [ ] More colorscheme importing options

## ❎ Troubleshoot

Any common fixes to any errors will be added here.

## 👍 Credits

Heavily inspired by [ImageGoNord](https://github.com/Schrodinger-Hat/ImageGoNord-pip).

repository: Marcus-Arcadius/ImageColorizer

branch_name: refs/heads/main

repo_name: Marcus-Arcadius/ImageColorizer


text:
# Interactable

![Interactable](../Documentation/Images/Interactable/InteractableExamples.png)

With Interactable script, you can make any object interactable with differentiated visual state. For example, you can change color of the object on focus or make it bigger on pressed state. Since you can have multiple themes that control different parts of the object, you can achieve sophisticated visual states including shader property changes. In fact, most [interaction example scenes](README_HandInteractionExamples.md) revolve around interactions based on Interactables.

## How to use interactables ##

Simply add the [`Interactable.cs`](https://github.com/Microsoft/MixedRealityToolkit-Unity/blob/mrtk_release/Assets/MixedRealityToolkit.SDK/Features/UX/Scripts/Interactable.cs) component to a GameObject.

![Interactable](../Documentation/Images/Interactable/InteractableInspector_basicSteps.png)

1. A collider must exist on the GameObject with the interactable or the child of the interactable for it to receive input.
2. Use the *OnClick* event to make something happen.
3. Add visual feedback by linking a target to a profile and assigning a theme.

Interactable features can be extended using external components like `PhysicalPressEventRouter` which enables press events to drive some state changes in the interactable.

## Input settings ##

The basic features allow for button style interactions, such as pointer focus and clicks, that maps to interaction states to drive themes which are setup through the interactable profile. Controller or hand focus, down, up and click (both near and far) are handled. Functionality can be extended using external scripts that can set state manually.

**Input Actions**

Select the action, from the input configuration or controller mapping profile, that the interactable should react to.
See [Overview of the input system in MRTK](./Input/Overview.md) for more on how input actions are setup and intended to be used in the application.

**Enabled**

Sets the interactables enabled state, which will disable some input handling and update the themes to reflect the current state which is disabled.

This is different from disabling input all together (using *Enable Input*). It means that a specific button that would normally be interactive will be disabled and has a visual look and feel to denote its disabled state. A typical example of this would be a submit button waiting for all the required input fields to be completed.

**IsGlobal**

Focus is not required to detect input actions, default behavior is false.

**Voice Commands**

Select a Speech Command that has been setup in the MRTK Speech Commands Profile to trigger an OnClick event. This will also provide an automated Focus and Press state change to drive any theme feedback.

**Requires Focus (Only available when a speech command is selected)**

The voice command requires the interactable to have focus to listen for the voice command. There are several ways to use voice commands to trigger an interactable, be careful not to have multiple objects with the same voice command or there will be conflicts. Using the MRTK voice recognition profile or online speech service are other ways to enable voice commands.

**Selection Mode**

The ability to add multiple layers to Themes to create controls like Toggles or multi-dimensional (sequential) buttons. _See Creating Toggles._

**Public Properties**

ClickCount - a read only value that tracks how many clicks have occurred.

## Profiles and Themes ##

The profile will define how button content will be linked to and manipulated by themes, based on state changes.

Themes work a lot like materials. They are scriptable objects that contain a list of data that will be assigned to an object based on the current state. Like materials, they can be edited individually in the project panel or through the interactable profile. Editing a theme through an interactable will update its settings for all other interactables using that theme. Themes can be extended to control any aspect of a GameObject with a few basic themes provided that can change color, scale, position or an combination of the three.

A default theme will be provided whenever an target object is added to a profile. It is not advised to edit the default theme, like in the case MRTK is updated, the theme could get overridden. A "Create Theme" button is provided whenever the default theme is used to make it easier to create a new themes.

*Example of the Default Theme*

*Example of a Color Theme*

The best way to save a profile of a button, with all the themes and targets setup, is to create a prefab of your button.
Note that themes that manipulate mesh objects (color or shader themes) are able to detect the shader properties in the material assigned to the target object. A drop down list of shader properties will define how the values of the theme are applied and is a convenience of this ability. Conflicts can arise if the same theme is used on objects that do not share the same material shader setting. Best practice is to create a separate theme for objects with different shaders; this is not an issue when using the same color theme on a text object and a mesh object, because all the shader properties are ignored on text objects.

### Creating Toggles and Multi-Dimension buttons

Toggle or multi-dimension buttons can be created in the Profile using the [`Selection Mode`](xref:Microsoft.MixedReality.Toolkit.UI.SelectionModes) field. In the Toggle mode, a new toggled theme is added for each Target in the Profile. When the Interactable is toggled on, the Toggled Theme will be used to provide an additional layer of visual feedback.

While the [`Selection Mode`](xref:Microsoft.MixedReality.Toolkit.UI.SelectionModes) is set to Toggle, the Is Toggled check box can be used to set the default value of the control which will be visible during runtime.

In the Toggle selection mode, Set the Interactable's toggled state during runtime by calling the Interactable's SetToggled(bool toggle) method to switch the IsToggled state and update the profile to use the correct theme.

Multi-Dimension selection mode is used to create sequential buttons, or a button that has more than two steps, like controlling speed with three values, Fast (1x), Faster (2x) or Fastest (3x).

With dimensions being a numeric value, up to 9 themes can be added to control the text label or texture of the button for each speed setting, using a different theme for each of step.

Developers can assess the [`DimensionIndex`](xref:Microsoft.MixedReality.Toolkit.UI.Interactable) to determine which dimension is currently active.

```csharp
//Access the current DimensionIndex
GetDimensionIndex();

//Set the DimensionIndex - toggled
SetDimensionIndex(1);

//Set the DimensionIndex - Untoggled
SetDimensionIndex(0);
```

Every click event will advance the DimensionIndex which will increase until the set Dimensions value is reached then cycle or reset to 0. A good example of working with Dimensions with code is the InteractiveToggleCollection found in the InteractableExamples demo scene on the RadialSet object.

**See the Events section to learn about Toggle Events.**

## Events

You can use Interactable to detect input events other than just OnClick. The Events feature provides a way to enable functionality to extend a button, but not really visual or needed to provide feedback based on state changes.

**At the bottom of the Interactable component, click the "Add Event" button to reveal additional event options.** A drop down menu contains the current list of supported events like toggle, hold or double tap. The idea of these events is to monitor Interactable state changes and define patterns to detect. When a pattern is detected, an action can be triggered through the inspector or directly in code.

*Example of audio clip to play on click. There is an audio theme for playing audio clips for each state change, like focus*

*Example of Toggle events*

*Example of a hold event*

*Example of a modified OnClick event to spawn a gameObject on click*

Events can be placed on an object to monitor a separate interactable. Use [`InteractableReceiver`](xref:Microsoft.MixedReality.Toolkit.UI.InteractableReceiver) for a single event (from the list) or [`InteractableReceiverList`](xref:Microsoft.MixedReality.Toolkit.UI.InteractableReceiverList) for a list of events similar to the interactable event list.

*Example of InteractableReceiver existing on a separate gameObject from the Interactable, referencing the Interactable for event and state updates*

"Search Scope" provides a preferred path to search for an Interactable if one is not explicitly assigned.

## States ##
States are a list of terms that can be used to define interactions phases, like press or observed.

Interactable states provide two major roles:

* Establish a list of states that are relevant for the Interactable. This list will be displayed in the themes and can also be referenced by the events.
* Controls how different interaction phases are ranked into states. For instance, a press state is also in a focused state, but the InteractableStates class will define it is a press state based on the ranking preferences setup in the State ScriptableObject.

The InteractableStates State Model will handle any state list with a layered ranking system, starting with the most isolated state and ending with the state that could contain all other states.

The DefaultInteractableStates list contains 4 states:

* **Default**: Nothing is happening, this is the most isolated base state. If anything does happen, it should over rule this state.

* **Focus**: The object is being pointed at. This is a single state, no other states are currently set, but it will out rank Default.

* **Press**: The object is being pointed at and a button or hand is pressing. The Press state out ranks Default and Focus. This state will also get set as a fallback to Physical Press.

* **Disabled**: The button should not be interactive and visual feedback will let the user know for some reason this button is not usable at this time. In theory, the disabled state could contain all other states, but when Enabled is turned off, the Disabled state trumps all other states.

A bit value (#) is assigned to the state depending on the order in the list.

There are currently 17 states total that you can used to drive themes, though some are meant to be driven by other components. Here's a list of those with built-in functionality.

- Default, Focus, Pressed and Disabled are mentioned above
- Visited: the Interactable has been clicked.
- Toggled: The button is in a toggled state or Dimension index is an odd number.
- Gesture: The hand or controller was pressed and has moved from the original position.
- VoiceCommand: A speech command was used to trigger an Interactable.
- PhysicalTouch: A touch input is currently detected, use NearInteractionTouchable to enable.
- Grab: A hand is currently grabbing in the bounds of the object, use NearInteractionGrabbable to enable

States have corresponding properties and Methods in the Interactable, like SetFocus(bool focus) or HasFocus.

## Interactable goals and architecture

## Extending themes

Extend [`InteractableThemeBase`](xref:Microsoft.MixedReality.Toolkit.UI.InteractableThemeBase) to create a new theme that will show up in the theme property drop-down list. Themes can be created to control anything based on state changes. We could have a custom component on a GameObject that is driven by a custom theme with the values for each state being set in the inspector.

Setup the configuration of the theme settings in the constructor.

``` csharp
public NewCustomTheme()
{
    Types = new Type[] { typeof(Transform) };
    Name = "Custom Theme Scale";
    ThemeProperties.Add(
        new InteractableThemeProperty()
        {
            Name = "Scale",
            Type = InteractableThemePropertyValueTypes.Vector3,
            Values = new List<InteractableThemePropertyValue>(),
            Default = new InteractableThemePropertyValue() { Vector3 = Vector3.one}
        });
}
```

* **Name**: The display name of the property, this will display next to the property field under each state title.

* **Types**: Allow filtering based on components on the object. In this case, this theme will show up in the list when assigned to an object with a Transform.

* **Name**: The name that will show up in the inspector.

* **ThemeProperties**: A list of properties that theme will store to be used when the state changes.

Each Theme Property has a name, type (defining the fields to display for each state), a set of values for each state and a default value for the fields. The state fields can also be hidden in the inspector, if the theme does not require them to be visible.

``` csharp
    // custom settings will appear in the configuration section of the theme inspector
    // expose properties to allow more customization to the theme
    CustomSettings = new List<InteractableCustomSetting>()
    {
        new InteractableCustomSetting()
        {
            Name = "ScaleMagnifier",
            Type = InteractableThemePropertyValueTypes.Vector3,
            Value = new InteractableThemePropertyValue() { Vector3 = Vector3.one }
        }
    };

```

Override Init to run any startup code, that needs references to the Host GameObject.

``` csharp
public override InteractableThemePropertyValue GetProperty(InteractableThemeProperty property)
{
    InteractableThemePropertyValue start = new InteractableThemePropertyValue();
    start.Vector3 = Host.transform.localScale;
    return start;
}
```

GetProperty should grab the current property of the Host. This will be used for animation later. Property is provided in case the current value depends on a cached property value. In the example below on the current scale.

``` csharp
public override void SetValue(InteractableThemeProperty property, int index, float percentage)
{
    Host.transform.localScale = Vector3.Lerp(property.StartValue.Vector3, property.Values[index].Vector3, percentage);
}
```

The SetValue function is used to set the property value based on the current state.

* **Property**: A list of property values per state, set through the theme inspector.

* **Index**: Correlates to the current state.

* **Percentage**: A float value between 0 and 1. It will be the eased value if an Animation curve is used.

Custom Settings added to the new class will also be displayed in the inspector. If there are properties that need to be exposed in the inspector but do not need to be based on states, they should be added to the Custom Settings list.

### Extending shader themes

If creating a custom interactable theme to modify shader properties, it is advised to extend the [`InteractableShaderTheme`](xref:Microsoft.MixedReality.Toolkit.UI.InteractableShaderTheme) class. Please see the [`InteractableColorTheme`](xref:Microsoft.MixedReality.Toolkit.UI.InteractableColorTheme) class as an example to extend the [`InteractableShaderTheme`](xref:Microsoft.MixedReality.Toolkit.UI.InteractableShaderTheme) class.

Regardless of whether extending the [`InteractableShaderTheme`](xref:Microsoft.MixedReality.Toolkit.UI.InteractableShaderTheme) class or not, it is highly recommended to set shader properties 1) via [`MaterialPropertyBlock`](https://docs.unity3d.com/ScriptReference/MaterialPropertyBlock.html) and 2) using the shader properties integer keys instead of string keys. Unity assigns integer keys for all shader properties in a project at runtime.See [`Shader.PropertyToID`](https://docs.unity3d.com/ScriptReference/Shader.PropertyToID.html) for more details on. The integer key for an interactable property can be accessed via  `InteractableThemeProperty.GetShaderPropertyId()`.

Both of these two steps will help with performance. [`MaterialPropertyBlock`](https://docs.unity3d.com/ScriptReference/MaterialPropertyBlock.html) will ensure a new material instance is not created for every object modifying a shader property and integer shader property IDs will eliminate the string-to-int lookup step performed by Unity when using string keys (i.e "_Color") on set/get functions.

``` csharp
public override void SetValue(InteractableThemeProperty property, int index, float percentage)
{
     renderer.GetPropertyBlock(propertyBlock);

     int propId = property.GetShaderPropertyId();

     Color newColor = Color.Lerp(property.StartValue.Color, property.Values[index].Color, percentage);
     block.SetColor(propId, color);

     renderer.SetPropertyBlock(propertyBlock);
 }
```

## Extending events

Like Themes, events can be extended to detect any state pattern or to expose functionality.

Custom events can be created and used in two main ways:

* Extend [`ReceiverBase`](xref:Microsoft.MixedReality.Toolkit.UI.ReceiverBase) to create a custom event that will show up in the dropdown list of event types. A Unity event is provided by default, but additional Unity events can be added or the event can be set to hide Unity events. This functionality allows a designer to work with an engineer on a project to create a custom event that the designer or implementer to setup in the editor.
* Extend [`ReceiverBaseMonoBehavior`](xref:Microsoft.MixedReality.Toolkit.UI.ReceiverBaseMonoBehavior) to create a completely custom event component that can reside on the interactable or another object. The [`ReceiverBaseMonoBehavior`](xref:Microsoft.MixedReality.Toolkit.UI.ReceiverBaseMonoBehavior) will reference the interactable to detect state changes. This approach is the most direct for engineers that do not want to work through the inspector.

### Example for extending `ReceiverBase`

`MixedRealityToolkit.Examples` contains an example extension of ReceiverBase to display status information about the interactable.

``` csharp
public CustomInteractablesReceiver(UnityEvent ev) : base(ev)
{
    Name = "CustomEvent";
    HideUnityEvents = true; // hides Unity events in the receiver - meant to be code only
}
```

*OnUpdate* is an abstract method that can be used to detect patterns. Here is an example of accessing all the states of the interactable. Though there is a definite state that is defined with `state.CurrentState()`, the state object has a reference to all other states and their values.

``` csharp
public override void OnUpdate(InteractableStates state, Interactable source)
{
    if (state.CurrentState() != lastState)
    {
        // the state has changed, do something new
        /*
            bool hasDown = state.GetState(InteractableStates.InteractableStateEnum.Pressed).Value > 0;
            bool focused = state.GetState(InteractableStates.InteractableStateEnum.Focus).Value > 0;
            bool isDisabled = state.GetState(InteractableStates.InteractableStateEnum.Disabled).Value > 0;
            bool hasInteractive = state.GetState(InteractableStates.InteractableStateEnum.Interactive).Value > 0;
            bool hasObservation = state.GetState(InteractableStates.InteractableStateEnum.Observation).Value > 0;
            bool hasObservationTargeted = state.GetState(InteractableStates.InteractableStateEnum.ObservationTargeted).Value > 0;
            bool isTargeted = state.GetState(InteractableStates.InteractableStateEnum.Targeted).Value > 0;
            bool isToggled = state.GetState(InteractableStates.InteractableStateEnum.Toggled).Value > 0;
            bool isVisited = state.GetState(InteractableStates.InteractableStateEnum.Visited).Value > 0;
            bool isDefault = state.GetState(InteractableStates.InteractableStateEnum.Default).Value > 0;
            bool hasGesture = state.GetState(InteractableStates.InteractableStateEnum.Gesture).Value > 0;
            bool hasGestureMax = state.GetState(InteractableStates.InteractableStateEnum.GestureMax).Value > 0;
            bool hasCollision = state.GetState(InteractableStates.InteractableStateEnum.Collision).Value > 0;
            bool hasPhysicalTouch = state.GetState(InteractableStates.InteractableStateEnum.PhysicalTouch).Value > 0;
            bool hasCustom = state.GetState(InteractableStates.InteractableStateEnum.Custom).Value > 0;
            or:
            bool hasFocus = source.HasFocus;
            bool hasPress = source.HasPress;
        */
        lastState = state.CurrentState();
        SetOutput();
    }
}
```

Two interactable event methods are also available if driving functionality from *OnClick* or *OnVoiceCommand* is needed.

``` csharp
public virtual void OnVoiceCommand(InteractableStates state, Interactable source, string command, int index = 0, int length = 1)
{
    // voice command called
}
public virtual void OnClick(InteractableStates state, Interactable source, IMixedRealityPointer pointer = null)
{
    // click called
}
```

ReceiverBase scripts use InspectorField attributes to expose custom properties in the inspector. Here's an example of Vector3 a custom property with tooltip and label information.

``` csharp
 [InspectorField(Label = "Offset Position", Tooltip = "Spawn the prefab relative to the Interactive position", Type = InspectorField.FieldTypes.Vector3)]
        public Vector3 EffectOffset = Vector3.zero;
```

## Extending states

The functionality of how states are ranked can be overridden by extending [`InteractableStates`](xref:Microsoft.MixedReality.Toolkit.UI.InteractableStates) class. Override the `CompareStates` method to manually control the ranking.

``` csharp
public override State CompareStates()
{
    int bit = GetBit();
    currentState = stateList[0];
    for (int i = stateList.Count - 1; i > -1; i--)
    {
        if (bit >= stateList[i].Bit)
        {
            currentState = stateList[i];
            break;
        }
    }
    return currentState;
}
```

## See also

* [MRTK Standard Shader](README_MRTKStandardShader.md)

repository: lyhyl/MixedRealityToolkit-Unity

gha_license_id: MIT

repo_name: lyhyl/MixedRealityToolkit-Unity


text:
# Syntax Highlighting styles for VisualStudio

* Github (github.vssettings) - This theme is based on the GitHub.com color theme.

## Changes

* 2012-07-04 Added Github theme.

## How to install

* in VisualStudio open menu -> Tools -> Import and Export Settings
* select 'Import selected environment settings' and press next button
* in next step make backup of your current settings
* click 'Browse...' and select file github.vssettings and click next
* click 'Finish'

## License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

 IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

## Author contact

Darius Kučinskas
*<EMAIL_ADDRESS>* https://github.com/dkucinskas/
* http://blog-of-darius.blogspot.com/

repository: dkucinskas/VisualStudio-Styles

repo_name: dkucinskas/VisualStudio-Styles


text:
# gol (Game of Life)
gol is a [Game of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life) library for C++.

With gol, you can easily simulate Conway's Game of Life cellular automaton in C++.
gol is a single-file include which means you only need one header file to use it.

## Features

- A board class to iterate through and store a Conway's Game of Life simulation
- Custom rule strings, wrapping, and neighborhood types
- File parsing and saving (including support for run-length encoding)
- [Documentation](DOCUMENTATION.md)

## Installation
1. Download the latest [single header version](https://raw.githubusercontent.com/claby2/gol/master/single_include/gol/gol.hpp).
2. Either put the header file in a central location (with a specified path) or directly in your project tree.

## Examples

To compile all the examples:
```
$ make example-compile
```

### Blinker Oscillator

Here is an implementation that prints a blinker oscillator and steps 4 times:
```cpp
// Implements a blinker oscillator and steps 4 times
// blinker oscillators have a period of 2

#include <gol/gol.hpp>

#include <iostream>

gol::Board board(10, 10);

// Prints the board and then updates with next step
void printAndStep() {
    std::cout << "\n";
    for(int i = 0; i < board.height(); i++) {
        for(int j = 0; j < board.width(); j++) {
            std::cout << board[i][j] << " ";
        }
        std::cout << "\n";
    }
    board.nextStep(); // Update with next step with rule_string B3/S23
}

int main() {
    for(int i = 0; i < board.height(); i++) {
        for(int j = 0; j < board.width(); j++) {
            board[i][j] = false;
        }
    }

    // Make blinker oscillator
    board[2][2] = true;
    board[2][3] = true;
    board[2][4] = true;

    for(int i = 0; i < 4; i++) {
        printAndStep();
    }
}
```

This will print the following twice:
```
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 1 1 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
```

## Preview

Previewing requires [SDL2](https://libsdl.org/download-2.0.php).

Refer to the `/preview` directory to see how gol can be used with SDL2 to preview simulations graphically.

Compile the previewer with:
```
$ make preview-compile
```

Run the previewer with:
```
$ make preview
```

## Testing

Testing requires [Catch2](https://github.com/catchorg/Catch2/).

Compile with:
```
$ make test-compile
```
Run the tests with:
```
$ make test
```

## Reference

[Documentation](DOCUMENTATION.md)

### Functions

| Function                                                | Use
|---------------------------------------------------------|------------------------------------------------------|
| [initRandom](DOCUMENTATION.md#initRandom)               | Initialize random seed                               |
| [getRandomBool](DOCUMENTATION.md#getRandomBool)         | Return a random bool                                 |
| [getBirthValues](DOCUMENTATION.md#getBirthValues)       | Return birth values from B/S notation rule string    |
| [getSurvivalValues](DOCUMENTATION.md#getSurvivalValues) | Return survival values from B/S notation rule string |
| [isValidRuleString](DOCUMENTATION.md#isValidRuleString) | Test whether rule string is valid                    |

### Board Member Functions

| Function                                                        | Use
|-----------------------------------------------------------------|----------------------------------------------------------|
| [(constructor)](DOCUMENTATION.md#(constructor))                 | Construct Game of Life board                             |
| [operator[]](DOCUMENTATION.md#operator[])                       | Access element                                           |
| [height](DOCUMENTATION.md#height)                               | Return the number of rows                                |
| [width](DOCUMENTATION.md#width)                                 | Return the number of columns                             |
| [countNeighborsMoore](DOCUMENTATION.md#countNeighborsMoore)     | Return number of true cells in Moore neighborhood        |
| [countNeighborsNeumann](DOCUMENTATION.md#countNeighborsNeumann) | Return number of true cells in von Neumann neighborhood  |
| [nextStep](DOCUMENTATION.md#nextStep)                           | Iterate to next time step                                |
| [setWrap](DOCUMENTATION.md#setWrap)                             | Set to toggle wrapping for counting neighbors            |
| [getWrap](DOCUMENTATION.md#getWrap)                             | Return the current wrap state                            |
| [getNeighborhoodType](DOCUMENTATION.md#getNeighborhoodType)     | Return current neighborhood type                         |
| [setFromFile](DOCUMENTATION.md#setFromFile)                     | Set values of board from given file                      |
| [getLiveCount](DOCUMENTATION.md#getLiveCount)                   | Return the number of true elements                       |
| [getDeadCount](DOCUMENTATION.md#getDeadCount)                   | Return the number of false elements                      |
| [setFromRLEFile](DOCUMENTATION.md#setFromRLEFile)               | Set values of board from given RLE file                  |
| [setRuleString](DOCUMENTATION.md#setRuleString)                 | Set rule string                                          |
| [getRuleString](DOCUMENTATION.md#getRuleString)                 | Return current rule string                               |
| [saveAsFile](DOCUMENTATION.md#saveAsFile)                       | Save board as file                                       |
| [saveAsRLEFile](DOCUMENTATION.md#saveAsRLEFile)                 | Save board as RLE file                                   |


text:
---
layout: post
published: true
mathjax: true
featured: false
comments: false
title: Popoviciu's inequality
categories:
  - general
description: An upper bound to the variance of samples from an unknown distribution on a known interval.
---

Suppose you have a neural network with a function as its last layer that squashes
its outputs to a fixed interval [a,b]. Popoviciu's inequality can give us an upper bound
to the sample variance.

If we knew the distribution where the samples stem from, then it would be easy
to answer this question. Consider the most simple case of a [uniform distribution](https://en.wikipedia.org/wiki/Continuous_uniform_distribution):
$$ p(x) \sim U(a,b), Var[p(x)]=\frac{1}{12}(b-a)^2 $$

The upper bound derived from Popoviciu's inequality is $$ \frac{1}{4}(b-a)^2 $$.
Interestingly, Mihaly Bencze and Florin Popovici write in their [proof](https://www.researchgate.net/publication/267072994_A_simple_proof_of_Popoviciu%27s_inequality) that
"Popoviciu’s inequality is a refinement of Jensen’s inequality".

In the following, I am going to adapt the proof by [Zen](https://stats.stackexchange.com/questions/45588/variance-of-a-bounded-random-variable) with minor notational changes:

Let $$ g(x) = E[(X - t)^2] $$ where X is our random variable and $$t$$ to be determined such that we find the minimum of g.

Therefore we derive g with respect to t: $$ \frac{d}{dt} g(x) = \frac{d}{dt} E[X^2 - 2Xt + t^2] $$

$$ = \frac{d}{dt} E[X^2] - E[2Xt] + E[t^2] = 0 - \frac{d}{dt} E[2Xt] + \frac{d}{dt} E[t^2] $$

$$= -2 E[X] + 2t $$

... and set it to zero:

$$-2 E[X] + 2t \stackrel{!}{=} 0 $$

$$t = E[X] $$

The second derivative is $2$ which is larger than zero. $E[X]$ is therefore the global minimum. $$g(\cdot)$$ was constructed such that $$g(E[X]) = Var[X]$$

Now we choose $$t = \frac{a+b}{2}$$ seemingly arbitrary in the middle of our interval but of course it is chosen on purpose.

Since $$g(\cdot)$$ has its global minimum at $E[X]$, we know that our chosen $$t$$ cannot make the function smaller:

$$ g(E[X]) \le g(\frac{a+b}{2})$$

By having a closer look at $$g(\frac{a+b}{2})$$ we can derive an upper bound for it:

$$ g(\frac{a+b}{2}) = E[(X - \frac{a+b}{2})^2]$$

$$ = E[(\frac{1}{2}(2X - (a + b))^2] = E[\frac{1}{4}(2X - (a - b))^2]$$

$$ = \frac{1}{4} E[(X+X - a - b)^2] = \frac{1}{4} E[(X - a + X - b)^2] $$

$$ = \frac{1}{4} E[(\underbrace{(X - a)}_{\ge 0} + \underbrace{(X - b)}_{\le 0})^2] $$

Since every sample from X has to be greater than $$a$$ and smaller than $$b$$, these observations are true. While the left part increases the value, the right part decreases it. Our upper bound can thus be constructed by simply flipping the sign such that the right part is not subtracted but added:

$$ \frac{1}{4} E[((X - a) + (X - b))^2] \le \frac{1}{4} E[((X - a) - (X - b))^2] $$

Modifying the right hand side:

$$ \frac{1}{4} E[((X - a) + (X - b))^2] \le \frac{1}{4} E[(X - a - X + b))^2] $$

The X is eradicated:

$$ \frac{1}{4} E[((X - a) + (X - b))^2] \le \frac{1}{4} E[(b-a)^2] $$

$$ \underbrace{\frac{1}{4} E[((X - a) + (X - b))^2]}_{g(\frac{a+b}{2})} \le \frac{1}{4} (b-a)^2 $$

Recalling that $$Var[X] = g(E[X]) \le g(\frac{a+b}{2})$$ we see that:

$$ Var[X] \le \frac{1}{4} (b-a)^2 $$


text:
# blockmonitor
- alert to telegram when block don't increases
- the project uses the tele-bot-api and the rpc client of go-ethereum
# how to run
- navigate to source code and run commands below
```
$ go build .
```
- show help
```
$ ./telegramalert -h
$ ./telegramalert start -h
```


text:
# Modernize ASP.NET Apps Lab

You can run full .NET Framework apps in Docker using the [Windows Server Core](https://store.docker.com/images/windowsservercore) base image from Microsoft. That image is a headless version of Windows Server 2016, so it has no UI but it has all the other roles and features available. Building on top of that there are also Microsoft images for [IIS]https://store.docker.com/images/iis) and [ASP.NET](https://store.docker.com/images/aspnet), which are already configured to run ASP.NET and ASP.NET 3.5 apps in IIS.

This lab steps through porting an ASP.NET WebForms app to run in a Docker container on Windows 10 or Windows Server 2016. With the app running in Docker, you can easily modernize it - and in the lab you'll add new features quickly and safely by making use of the Docker platform.

## What You Will Learn

In this self-paced lab, you'll learn how to:

- Package an existing ASP.NET application so it runs in Docker, without any application changes.

- Run SQL Server Express in a Docker container, and use it for the application database.

- Use a feature-driven approach to address problems in the existing application, without an extensive re-write.

- Use the Dockerfile and Docker Compose syntax to replace manual deployment documents.

## Prerequisites

You'll need Docker running on Windows. You can follow the [Windows Container Lab Setup](https://github.com/docker/labs/blob/master/windows/windows-containers/Setup.md) to install Docker on Windows 10, or Windows 2016 - locally, or on AWS or Azure.

You should be familiar with ASP.NET and C#, and with the key [Docker concepts](https://docs.docker.com/engine/understanding-docker/)

### Optional

The build process for the application uses MSBuild in Docker container and **does not use** Visual Studio, but if you want to view or edit the solution yourself, you can use Visual Studio 2015. The free [Visual Studio Community Edition](https://www.visualstudio.com/vs/community/) is fine, or you can use [Visual Studio Code](http://code.visualstudio.com/).

## The Lab

- [Part 1 - Building ASP.NET applications with Docker](part-1.md)
- [Part 2 - Packaging ASP.NET applications as Docker images](part-2.md)
- [Part 3 - Running ASP.NET applications as Docker containers](part-3.md)
- [Part 4 - Improving performance with asynchronous messaging](part-4.md)
- [Part 5 - Enabling fast prototyping with separate UI components](part-5.md)

gha_language: PHP


text:
---
layout: post
title: CLEditor pre code block
---

I have changed my post editor to use
[CLEditor](http://premiumsoftware.net/cleditor/)rather than WMeditor
which had some problems when editing a post. One feature which is
obviosuly really important to me is to be able to include code in
*pre* blocks. Luckily I found [this
plugin](https://gist.github.com/837281) at github which makes it easy to
include this feature in the editor.

Once this code has been included in a *script* tag then it is easy to
add to the editor by calling.

    $('#myTextarea').cleditor({
        controls:     // controls to add to the toolbar
        "bold italic underline strikethrough subscript superscript | font size " +
        "style | color highlight removeformat | bullets numbering | outdent " +
        "indent | alignleft center alignright justify | undo redo | " +
        "rule image link unlink | cut copy paste pastetext | print source | pastecode"
        });

gha_language: HTML

gha_license_id: NOASSERTION


text:
(serve-handle-explainer)=

# ServeHandle: Calling Deployments from Python

Ray Serve enables you to query models both from HTTP and Python. This feature
enables seamless [model composition](serve-model-composition). You can
get a `ServeHandle` corresponding to deployment, similar how you can
reach a deployment through HTTP via a specific route. When you issue a request
to a deployment through `ServeHandle`, the request is load balanced across
available replicas in the same way an HTTP request is.

To call a Ray Serve deployment from python, use {mod}`Deployment.get_handle <ray.serve.api.Deployment>`
to get a handle to the deployment, then use
{mod}`handle.remote <ray.serve.handle.RayServeHandle.remote>` to send requests
to that deployment. These requests can pass ordinary args and kwargs that are
passed directly to the method. This returns a Ray `ObjectRef` whose result
can be waited for or retrieved using `ray.wait` or `ray.get`.

```python
@serve.deployment
class Deployment:
    def method1(self, arg):
        return f"Method1: {arg}"

    def __call__(self, arg):
        return f"__call__: {arg}"

Deployment.deploy()

handle = Deployment.get_handle()
ray.get(handle.remote("hi")) # Defaults to calling the __call__ method.
ray.get(handle.method1.remote("hi")) # Call a different method.
```

If you want to use the same deployment to serve both HTTP and ServeHandle traffic, the recommended best practice is to define an internal method that the HTTP handling logic will call:

```python
@serve.deployment(route_prefix="/api")
class Deployment:
    def say_hello(self, name: str):
        return f"Hello {name}!"

    def __call__(self, request):
        return self.say_hello(request.query_params["name"])

Deployment.deploy()
```

Now we can invoke the same logic from both HTTP or Python:

```python
print(requests.get("http://localhost:8000/api?name=Alice"))
# Hello Alice!

handle = Deployment.get_handle()
print(ray.get(handle.say_hello.remote("Alice")))
# Hello Alice!
```

(serve-sync-async-handles)=

## Sync and Async Handles

Ray Serve offers two types of `ServeHandle`. You can use the `Deployment.get_handle(..., sync=True|False)`
flag to toggle between them.

- When you set `sync=True` (the default), a synchronous handle is returned.
  Calling `handle.remote()` should return a Ray `ObjectRef`.
- When you set `sync=False`, an asyncio based handle is returned. You need to
  Call it with `await handle.remote()` to return a Ray ObjectRef. To use `await`,
  you have to run `Deployment.get_handle` and `handle.remote` in Python asyncio event loop.

The async handle has performance advantage because it uses asyncio directly; as compared
to the sync handle, which talks to an asyncio event loop in a thread. To learn more about
the reasoning behind these, checkout our [architecture documentation](serve-architecture).

## Integrating with existing web servers

Ray Serve comes with its own HTTP server out of the box, but if you have an existing
web application, you can still plug in Ray Serve to scale up your compute using the `ServeHandle`.
For a tutorial with sample code, see {ref}`serve-web-server-integration-tutorial`.

repository: MissiontoMars/ray

gha_language: Python

repo_name: MissiontoMars/ray


text:
# DSFToolbar

![](https://img.shields.io/github/v/tag/dagronf/DSFToolbar) ![](https://img.shields.io/badge/macOS-10.11+-blueviolet) ![](https://img.shields.io/badge/macCatalyst-10.13+-blueviolet) ![](https://img.shields.io/badge/Swift-5.0+-orange.svg)
![](https://img.shields.io/badge/License-MIT-lightgrey) [![](https://img.shields.io/badge/spm-compatible-brightgreen.svg?style=flat)](https://swift.org/package-manager)

A SwiftUI-style declarative `NSToolbar` for macOS and Mac Catalyst.

## Why?

NSToolbar has an amazing API with incredible flexibility, but I find that it can be too verbose and spread throughout your code with the use of delegates and callbacks for simpler projects and I have trouble keeping tabs on all the individual components. Even moreso if you want to use actions and bindings on the toolbar objects which just increases the amount code required for each toolbar.

Because of this, I tended to find that I wasn't putting toolbars into my (admittedly basic) apps.

I was keen to see if I could produce an API that can :-

* use a SwiftUI- style declarative style for defining the toolbar.
* provide a block-based or bindings based interaction model.
* provide basic functionality for all of the toolbar item types.  For example, segmented controls, search controls.
* provide fallback for newer toolbar functionality. For example, if you want to use the new macOS 11 splitview-tracking toolbar items you'd have to litter your code with `if #available(macOS 11, *)` if you want/need to support 10.15 (for example).
* legacy support for minSize/maxSize toolbar items on older macOS versions (before 10.13) if needed.

This module doesn't contain the full functionality of the `NSToolbar`/`NSToolbarDelegate`, but provides a decent chunk of the core functionality.

## TL;DR - Show me something!

If you're familiar with SwiftUI syntax you'll feel comfortable with the declaration style.

```swift
class MyViewController: NSViewController {

   @objc dynamic var searchEnabled: Bool = true
   @objc dynamic var searchText: String = ""
   ...
   lazy var customToolbar: DSFToolbar = {
      DSFToolbar(
         toolbarIdentifier: NSToolbar.Identifier("Core"),
         allowsUserCustomization: true) {

         DSFToolbar.Item(NSToolbarItem.Identifier("item-new"))
            .label("New")
            .isSelectable(true)
            .image(ProjectAssets.ImageSet.toolbar_new_document.template)
            .shouldEnable { [weak self] in
               self?.canAddDocument() ?? false
            }
            .action { [weak self] _ in
               self?.addDocument()
            }

         DSFToolbar.Item(NSToolbarItem.Identifier("item-edit"))
            .label("Edit")
            .isSelectable(true)
            .image(ProjectAssets.ImageSet.toolbar_edit_document.template)
            .shouldEnable { [weak self] in
               self?.canEditDocument() ?? false
            }
            .action { [weak self] _ in
               self?.editDocument()
            }

         DSFToolbar.FlexibleSpace()

         DSFToolbar.Search(NSToolbarItem.Identifier("search-field"))
            .label("Search")
            .isSelectable(true)
            .bindIsEnabled(to: self, withKeyPath: \MyViewController.searchEnabled)
            .bindText(self, keyPath: \MyViewController.searchText)
      }
   }()
   ...
   // Attaching the window to the toolbar will make the toolbar appear
   self.customToolbar.attachedWindow = self.view.window
}
```
![](https://github.com/dagronf/dagronf.github.io/blob/master/art/projects/DSFToolbar/sample.png?raw=true)

And thats it!

## Installation

Use Swift Package Manager.

Add `https://github.com/dagronf/DSFToolbar` to your project.

## Usage

For the most part, you'll only really need to use [`DSFToolbar.Item`](Markdown/item.md), [`DSFToolbar.Group`](Markdown/group.md) and [`DSFToolbar.Search`](Markdown/search.md) to get 90+% of the toolbar functionality you'll need.

Even moreso if you target 10.15 or later, you can use `DSFToolbar.Group` as a segmented-style control by settings `isBordered(true)`.

There are two targets :-

### DSFToolbar

A target for Xcode 11 and Xcode 12 (`DSFToolbar-xc11`) for legacy applications that can't move up to Xcode 12.2 yet.  Supports all functionlity _except_ for the new separator toolbar types introduced in macOS 11.  You can actually define the separator in your toolbar definition, it just won't have any effect (to aid migration later to Xcode 12.2+).

Backwards compatible back to macOS 10.11.

```swift
import DSFToolbar
```

### DSFToolbar-beta

The standard project (`DSFToolbar`) for Xcode 12.2 and later. Backwards compatible back to macOS 10.11 and supporting new features in macOS 11 Big Sur (such as split view tracking)

```swift
// Support for Xcode 12.2 and later
import DSFToolbar_beta
```

# Concepts

## Toolbar

### Customization

A toolbar can me marked as customisable by settings `allowsUserCustomization: true` in the constructor of the toolbar.

## Items

### Default items

A toolbar item can be marked with `isDefault` to indicate that the item should appear on the default toolbar.  An item marked as `isDefault(false)` will not appear initially in the toolbar, but will appear in the customization palette to allow to be added.

### Selectable items

A toolbar item marked as `isSelectable` will show a selection marker when pressed. You can detect the toolbar selection change by providing a block for the `onSelectionChange` property.

```swift
self.customToolbar = DSFToolbar(NSToolbar.Identifier("My Toolbar")) {
      ...
   }
   .onSelectionChange { newToolbarSelection in
      // Do something when the selection changes
   }
```

## Items and Interaction

### Actions

Items which provide callbacks (for example, responses to clicks) can provide a block action to respond with as part of the declaration.

```swift
self.customToolbar = DSFToolbar(NSToolbar.Identifier("Buttons")) {
   DSFToolbar.Image(NSToolbarItem.Identifier("toolbar-image-bordered"))
      .label("Burger")
      .action { _ in
         Swift.print("Clicked burger!")
      }
   }
```

Capturing `self` in any block can create retain cycles, so make sure you `[weak self]` if you need to capture self within a block

### Block requests

Some toolbar items can request information. For example, you can pass a block that provides the enabled status of an `Image` item during the declaration.

Capturing `self` in any block can create retain cycles, so make sure you `[weak self]` if you need to capture self within a block

```swift
self.customToolbar = DSFToolbar(NSToolbar.Identifier("Enabled-buttons")) {
   DSFToolbar.Image(NSToolbarItem.Identifier("toolbar-image-bordered"))
      .label("Burger")
      .shouldEnable { [weak self] in
         return self?.IsBurgerMenuEnabled() ?? false
      }
      .action { _ in
         Swift.print("Clicked burger!")
      }
   }
```

### Bindings

A lot of functionality can be hooked up via bindings in order to pass information to and from a toolbar item. For example, you can hook the content of the Search item to a class variable to observe when the content of the search field changes.

```swift
@objc dynamic var searchText: String = "" {
   didSet {
      // Update the search with the new string
   }
}
   ...
self.customToolbar = DSFToolbar(NSToolbar.Identifier("Search")) {
   DSFToolbar.Search(NSToolbarItem.Identifier("toolbar-search-field"))
      .label("Search")
      .bindText(self, keyPath: \MyViewController.searchText)
   }
```

### Cleanup

When you are finished with a toolbar, you need to call `close()` on the toolbar object. This will remove any bindings or observers or custom controls that were set up during the creation of the toolbar.

```swift
self.customToolbar.close()
```

## Available toolbar item types

### Common

| Type | Description |
|------|-------------|
| [Core](Markdown/core.md) | Core elements available to all toolbar item types |

### Controls

| Type | Available | Description |
|------|:--------:|-------------|
| [Item](Markdown/item.md) | macOS
macCatalyst | Basic toolbar 'image' type. Provides basic image, label, action etc.  Most of the time you'll want this. |
| [Group](Markdown/group.md) | macOS
macCatalyst | Group multiple items together to represent a common unit.
 This can also be used as a segmented control style (in catalyst and 10.15) by setting `isBordered(true)` on the group. |
| [Search](Markdown/search.md) | macOS
macCatalyst | Provides a search text field |
| [Segmented](Markdown/segmented.md) | macOS
macCatalyst | A simple segmented control |
| [Separator](Markdown/separator.md) | macOS11+
macCatalyst | Hooks into an NSSplitView to track a toolbar separator to a split view separator |
| [Button](Markdown/button.md) | macOS | A toolbar item containing an `NSButton` |
| [PopupButton](Markdown/popup-button.md) | macOS | A toolbar item that displays a menu when activated |
| [PopoverButton](Markdown/popover-button.md) | macOS | A toolbar item that displays a popover when activated |
| [View](Markdown/view.md) | macOS | A toolbar item containing a custom view |

# Demos

You can find pre-made demos under the `Demos` folder

* `DSFToolbar Demo`: Project for Xcode 12.2+ containing targets for macOS and macCatalyst
* `DSFToolbar Xcode 11 Demo`: A simple project for Xcode release versions (Xcode 12 and lower)

# License

```
MIT License

Copyright (c) 2020 Darren Ford

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

 IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```

repository: evanmoran/DSFToolbar

repo_name: evanmoran/DSFToolbar


text:
---
title: Anas Qureshi
type: "participant"
name: "Anas Bin Yahiya Qureshi"
portfolio: ""
github-link: "https://github.com/anasyahiya"
linkedin-link: "https://www.linkedin.com/in/anasqureshi/"
looking-for: "internship"
description: "HTML | CSS | JavaScript"
---

Hi! My name is Anas and welcome. Let's dive down into my profile.

### Introduction

I am not very studios but I love to learn new things. My curious personality led me to learn design and truth about the working of the universe. Now I would love to convert my design into a working model.

## Why are you taking this challenge?

I am taking this challenege as I don't want to simply waste my time. Since I will be working on projects and will be brainstorming ideas, I will learn something good out of it.

## Something interesting about you?

I like to study about the universe we live in and how it works and science applied in our daily life.

### Help I need?

Although I'm a CS student, I can do little to no programming at all. I practised HTML and CSS quite a bit and I'm a complete noob in javascript.

### How to contact me?

- [Twitter] (https://twitter.com/_anasqureshi_/)
- [LinkedIn] (https://www.linkedin.com/in/anasqureshi/)

### Projects

### Blogs


text:
# Purpose

Creating and sharing documents on Google Drive to collect students
homework for grading.

# Command Line Parameters

* `-a` or `--affix`: a mnemonic affix that will end the name of the document for the student (e.g., `cmputXYZ-wTT-hwN`)
* `-f` or `--folder`: the name of the folder in drive where the documents are stored
* `-s` or `--students`: JSON file with three fields per student: prename, surname, and email, which are used to name the document
* `-t` or `--type`: type of artifact to be created (i.e., `document`, `spreadsheet`, or `folder`), `document` as default
* `-i` or `--instructors`: JSON file with one email field per member of the instructional team, which is used to share the document

Sample JSON file with student list:

```
[
  {"prename": "Alice", "surname": "Wonderland", "email": "alice@wonderland"},
  {"prename": "Bob", "surname": "Builder", "email": "bob@builder"}
]
```

Sample JSON file with instructional team list:

```
[
  {"email": "white@rabbit"},
  {"email": "cheshire@cat"}
]
```

# Initial Setup

1. Enable the Drive API for the institutional account used on the course (follow the [Python Quickstart](https://developers.google.com/drive/api/v3/quickstart/python))
2. Download the credentials and put them on the same folder as the script.

# Naming of Folders and Documents

Folders and files on Google Drive are accessed via internal identifiers (instead of paths). The program first searches for a directory (anywhere) in the Google Drive corresponding to the provided access token matching the parameter `folder`.

If the folder is found, the program creates a blank document for each student listed in the student file, naming each file with the prefix (so that the student knows what the document is about) followed by the student name and the provided student id in parenthesis.

Example:
```
python create_and_share_google_docs.py -f cmput391w19hw1 -a "cmput391 w19 hw1" -s students.json -t document
```

Would create documents `Wonderland_Alice_cmput391 w19 hw1` and `Builder_Bob_cmput391 w19 hw1` inside folder with name **cmput391w19hw1**.

It might be best to test everything with an empty student file.

### Legal

This code wad produced by modifying the [Python Quickstart](https://developers.google.com/drive/api/v3/quickstart/python).

Copyright 2018 Denilson Barbosa

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

repository: leticiawanderley/homeworkOnGoogleDocs

repo_name: leticiawanderley/homeworkOnGoogleDocs


text:
---
title: "Release notes for v1.3"
sub_link: "1-3"
code_link: "https://github.com/polyaxon/polyaxon/blob/master/releases/1-3.md"
meta_title: "Polyaxon release notes for v1.3.x - Polyaxon Releases"
meta_description: "Polyaxon release notes, migrations, and deprecation notes for v1.3.x."
visibility: public
status: published
tags:
  - reference
sidebar: "releases"
---

## v1.3.5

> **Note**: Release for Polyaxon CLI.

### CLI

 * **Enhancement**: Improve local project loading.
 * **Enhancement**: Add user local cache for resolving the default owner.
 * **Enhancement**: Remove unused transport from client.
 * **Enhancement**: Improve operation detail command `ops get` with settings and meta_info details.
 * **Enhancement**: Do not purge polyaxon-ignore and git-presets.
 * **Fix**: Some CLI commands' error messages.
 * **Fix**: Regression caused by the deletion of the compatibility checks, Polyaxon CE users were receiving uninformative error: `Please provide a valid project.`

### Core

 * **Fix**: Issue with `log_artifact` not handling directories.

### Docs

 * **Enhancement**: Add mention of the ingress class annotation in the integration docs.

## v1.3.4

> **Note**: Release for Polyaxon CLI, Polyaxon Agent, and Polyaxon Cloud.

### CLI

 * **Enhancement**: Prioritize env vars over local config for client/cli settings, this should make flags like `NO_OP` more consistent.

### Core

 * **Enhancement**: Always send `is_approved` flag in run's API calls.
 * **Fix**: Correct the types for `is_approved` and `is_managed` in the proto files.

### UI

 * **Enhancement**: Add action `approve` to run's actions in the overview page and to runs in the table comparison page.
 * **Enhancement**: Add new quick flag `Show runs pending approval`.

### Docs

 * **Fix**: Typos in docstrings.
 * **Fix**: Gitlab scm guide.

## v1.3.3

> **Note**: Release for Polyaxon CLI, Polyaxon Agent, and Polyaxon Cloud.

### CLI

 * **Enhancement**: Add `polyaxon ops upload` command:
   * Can be used with the run command: `polyaxom run -u ...` or `polyaxom run -u-to path/to/use ...`  or `polyaxom run -u-from local/path/to/use ...`
   * Allows to upload a single artifact or a directory.
   * Can resolve relative and absolute paths, defaults to the current path.
   * allows to customize the destination path on the artifacts store relative the run's root path.
 * **Enhancement**: Remove automated compatibility checks from cli.

### Core

 * **Enhancement**: Add possibility to approve runs and do human validation to prevent automatic queueing.
   * This feature is useful when using external events like commits, github actions, ... and other operations in DAGs that need human in the loop.
 * **Enhancement**: Optimize stopping logic.
 * **Enhancement**: Add `upload_artifact` and `upload_artifacts` to the run client.

### UI

 * **Fix**: Double clicks on the table's header freeze for a moment all browsers.
 * **Fix**: Issues with several drop-downs load content slowly when they contain icons in Safari.
 * **Fix**: Issue with table comparison's header is separated from the table's body in Firefox.
 * **Fix**: Issue with flags filter not closing after a second click.

### House Keeping

 * **Enhancement**: Decorate some flaky tests.

### Deployment & Setup

 * **Enhancement**: Add missing `flower` and `apiHooks` to the deployment validation schema.
 * **Fix**: Typo in the ingress definition.

### Agent

 * **Enhancement**: Improve response time of the state endpoint.

## v1.3.2

### Core

 * **Enhancement**: Consolidate metadata keys.
 * **Enhancement**: Consolidate run kind/runtime check.
 * **Enhancement**: Add better error message and instruction to flush the config cache to avoid implicit errors in CLI/Client.

### House Keeping

 * **Enhancement**: Fix tests breaking because of the new urllib release.
 * **Enhancement**: update moto and aws mock tests.

## v1.3.1

### Core

 * **Enhancement**: Improve `to_init` parser to raise an error if both `to_init` and `context_only` are used at the same time to avoid unknown param types.
 * **Enhancement**: Improve `to_init` logic to validate the types before turning a param to an initializer.

### Docs

 * **Enhancement**: Update query syntax docs to include several new fields and examples.
 * **Enhancement**: Add running on schedule quick start.

### UI

 * **Fix**: Regression in restarts and copy original operations treated as cache.

### Commercial

 * **Fix**: Regression in run details API.

## v1.3.0

### CLI

 * **Enhancement**: Add a better error message when a project is not initialized or not passed instead of the generic error message.

### Core

 * **Enhancement**: Expose `log_meta`(to be used carefully) on the `RunClient` to update meta information about current run.
 * **Enhancement**: Consolidate context logic via params and drop global `dag.*` default context namespace injection.
 * **Enhancement**: Consolidate status trigger enumeration on a single class `V1Statuses` and drop `HookTrigger/NotificationTrigger`.
 * **Enhancement**: Improve params parsing and validation.
 * **Enhancement**: Add container section to all hyperparameter tuning schemas to allow overriding the resources and the full container of the tuners.
 * **Enhancement**: Improve auth initializer.
 * **Enhancement**: Clean run protos; add `schedule_at` and remove `is_helper`.
 * **Fix**: Add `contexts` io section to `CompiledOperation` spec to keep track of all `contextOnly` params.
 * **Fix**: Regression introduced in the context-only params not passed to the context.
 * **Fix**: Service runtime to always default to the operation kind.
 * **Fix**: Log verbosity in streams service.

### Operator

 * **Enhancement**: Relax finalizer until the openapi version is upgraded or a better retry mechanism is introduced.

### Docs

 * **Fix**: Fix several guides.

### UI

 * **Enhancement**: Improve empty state when the table and the dashboard are both used.
 * **Enhancement**: Show the agent and queue used for a specific run in the run's overview page.
 * **Enhancement**: Improve the search facet to include the run kind.
 * **Enhancement**: Improve the header's breadcrumbs to include the run kind sublink and to truncate long project names.
 * **Enhancement**: Improve cached operations dashboard views to proxy content from the original operation.
 * **Enhancement**: Show indicator for upcoming runs with a calendar icon.

### House Keeping

 * **Enhancement**: Relax some tests requirements to reduce the dependabot PRs.

### Agent

 * **Enhancement**: Several improvements to scheduling cleaners, tuners, and schedules.

### Commercial

 * **Enhancement**: Refactor pricing and plans access.
 * **Enhancement**: Consolidate Schedules and include `maxRuns` to `Interval Schedule` and `Cron Schedule` and remove `Repeatable Schedule` as it can be achieved via those schemas.
 * **Enhancement**: Rename and migrate `ExtactTimeSchedule` to `DatetimeSchedule`.
 * **Enhancement**: Add support for simple presets e.g. `@hourly`, `@daily`, `@weekly`, ... in the `CronSchedule`.
 * **Enhancement**: Pass queue and cache to sub ops from matrices.
 * **Enhancement**: Improve latency for agent checks.
 * **Enhancement**: Return consistent `full` indicator to agents if any of the queues/workflows/schedules have queued, non scheduled, or upcoming runs.
 * **Fix**: Regression in operations services not checking allowed kinds

repository: polyaxon/polyaxon

repo_name: polyaxon/polyaxon


text:
### About Woodhouse

Woodhouse is a small library that sits on top of Backbone.js that adds basic view and subview management as well as template defined Model-View bindings.

It is a collection of some of my favorite design and implementation patterns that I have worked with across many  ai frontend Javascript frameworks including Backbone.js, Angular.js, Knockout.js, and Ember.js. There is also a slight influence from Cocoa Touch due to my previous background with iOS development.

### What features does Woodhouse have?

- Computed properties (inspired by Ember.js).
- Object relationship management (deep models).
- View and Subview rendering and management boilerplate (inspired by Marionette.js).
- Model-View bindings marked up in templates (inspired by Knockout.js).
- Fully compatible with `Backbone.js 1.1.2`.

### What does Woodhouse not do?

- Not a replacement for Backbone.js (it depends on Backbone.js and jQuery).
- Does not give you wings.

### Why should I use Woodhouse?

Woodhouse is not for everyone. It worked really well for our team and what we wanted to accomplish so we just wanted to share it with anyone would could benefit from our learnings.

#### Why should I use Woodhouse instead of another framework like Angular.js?

If you want to use a template driven Model-View binding system such as the ones used by Knockout.js and Angular.js while still taking advantage of Backbone's Model, Collection, and View framework, Woodhouse is perfect for you.

#### Why did you build Woodhouse?

While developing [Celery's](https://trycelery.com) new dashboard, we first started out as using a pure Backbone.js implementation. We quickly realized we were writing lots of boilerplate View rendering code, so we experimented with Marionette.js to see if that could help. Although that did help with alleviating the woes of dealing with subviews, we stll had to re-render the entire view anytime our Models changed.

Having worked with other frontend frameworks with first-party bindings, I quickly missed having intelligent Model-View bindings that I could markup in the templates.

The bindings used in Woodhouse are heavily inspired by Knockout.js both syntactically and principle.

repository: airbrite/woodhouse

gha_language: JavaScript

repo_name: airbrite/woodhouse


text:
---
title: "Working with Nintex Workflows and SharePoint"
layout: post
date: 2016-08-16 11:00
tag: tips-and-tricks
blog: true
draft: false
author: artiannaswamy
summary: "Tips and hacks learned from developing Nintex O365 workflows on SharePoint 2013 / O365"
permalink: nintex-workflows
---

Earlier this year, I started as a project manager / business analyst consultant on a SharePoint implementation project. We needed to transition over several sub-sites containing complex approval workflows from an older document sharing platform, and since InfoPath is being deprecated, we ended up going with Nintex O365 as our workflow add-on of choice for SharePoint 2013 Office 365.

The journey has been interesting, to say the least. Nintex behaves in very unexpected ways, and with our workflows being fairly complex, we've had to cross a lot of hurdles and come up with workarounds, hacks and a fair amount of research to solve these problems. The Nintex forums have also been a great resource and I'm including links to any helpful solutions posted there as well. I'm recording these below as a reference for myself and anyone else facing the same hurdles.

## Linking multiple workflows

One of the workflow solutions I have been working on involves linking multiple workflows in sequence. The reason these had to be split was because of some rather complicated task assignment logic we've used in a couple of these workflows, and size limitations prevented us from combining all of these in one workflow. There are a couple of ways to achieve multiple workflows:

#### Option 1. Firing off all workflows simultaneously on item creation, but having the other workflows wait for a certain field to change.

This worked great for a couple of reasons - the transition from one workflow ending to the other workflow beginning was very short and seamless, and all workflows were launched with the same initial permissions.

But the problem was if the user had to restart the workflow for any reason. The user would have to remember to fire off all the workflows, in the right order, and even then the "wait for field change" didn't always work.

#### Option 2. Linking one workflow to the next using the 'Start workflow' action.

I quite thought I had found the holy grail with this solution - I could even do conditional branches and fire off different workflows depending on whether particular fields had been filled. It did require me to put in an admin user ID and password into the workflow action that launches a separate workflow, and getting the configurations filled out just right took some research as well. For more information on how to configure the 'Start workflow' action, see article: [Start a Workflow using NINTEX Workflow in SharePoint 2013 Online](//www.c-sharpcorner.com/blogs/start-a-workflow-using-nintex-workflow-in-sharepoint-2013-online)

However, it turned out that the workflows launched correctly, and in sequence, only as long as the initial request was submitted by my account, the one with site administrator rights. When a user with lower permissions (Edit or Contribute) initiated the workflows, the first workflow kicked off without any problems, but the next linked workflow would fail and get suspended with the following error message:

```
Retrying last request. Next attempt scheduled after (date/time).
Details of last request: HTTP NotFound to
https://siteurl/sites/subsite/web/lists(guid'xxxx')/Items(n)?
Correlation Id: xxxx Instance Id: xxxx

Item does not exist. It may have been deleted by another user.
```

I had encountered the 'Item does not exist' error before - it tended to appear when a user didn't have access to view that particular item.

And since the workflows ran without problem when initiated from my account, I knew it had to be a permissions issue.

I went down the rabbit hole researching several possible solutions, all listed below including the final solution that works like a charm. Scroll down to #6 if you want the tl;dr.

#### Giving the user higher permissions

#1. Upgraded user permissions from Contribute to Edit - this didn't work and gave me the same error message. Giving the user any higher permissions would result in users being able to see each others' List items, which would contradict business requirements.

#### Giving the user higher permissions temporarily

#2. Considered elevating user permissions on the SharePoint List temporarily while one workflow transitions to the other, per this article [Set Item Permissions - Start Workflow Issue](https://community.nintex.com/message/15315) but it was a risky move to add more permissions temporarily since if anything failed, the user would basically see everyone else's requests and this was a no-no.

#### Giving the workflow higher permissions

I found a series of articles on using elevated workflow permissions to remedy the issue.

#3.  One of the articles, [Workflow App Permissions](//www.stuartroberts.net/index.php/2014/11/20/workflow-app-permissions/) suggested tricking SharePoint into thinking of the workflow as an App (i.e. a functioning widget or add-in like a Document Library or a List). This was an interesting approach, and definitely worth a try, until I found...

#4. An article on using an App Step, a Nintex feature that can leverage higher permissions than the rest of the workflow, per this article [We use Nintex online with SharePoint 2013...](https://community.nintex.com/message/35520), and this Nintex O365 documentation article for [App Step](//help.nintex.com/en-US/O365/O365WorkFlow/Workflow%20Actions%20-%20STD/App%20Step.htm).

I added an App Step to my workflow and when I clicked into the action to configure it, was greeted with this message.

```
The required feature is not currently active.

To enable App Step, the following site feature must be activated:
Workflows can use app permissions
```

#5. The Nintex App Step documentation linked above also led to a SharePoint Dev center artice on how to [Create a workflow with elevated permissions by using the SharePoint 2013 Workflow platform](https://msdn.microsoft.com/en-us/library/office/jj822159(v=office.15).aspx). This article in conjunction with another helpful article [How to enable usage of App Step](https://community.nintex.com/thread/4793) led me to the Site setting that allows workflows to use app permissions.

While setting up an App Step seemed like the best solution of all of the above, it still felt like a lot of added weight to the workflow. I wondered for a moment if simply enabling this setting might allow the workflow to run with elevated permissions, and this was certainly worth a try.

#6. **(SOLUTION THAT WORKED)** So, I went into Site Settings > Site Actions > Manage site features:

And enabled the 'Workflows can use app permissions' setting.

I tentatively kicked off a workflow from a test user account with lower permissions, and .... it worked!

However, kicking off a new workflow from an existing workflow seems to take Nintex a good 15-20 minutes to slowly work its way through. This can be fairly awkward during live demo sessions, but shouldn't be a problem during normal live usage.

## Hiding the Task Outcome field

Within the Nintex workflow, we are able to set up task assignments that have one of several outcomes (Approve / Reject / On Hold etc). These task outcome options show up as a visible radio-button field on the custom task form that can be created for the approvers. This field refuses to elegantly hide or be switched off in any way - in fact, it's a requirement that the field be enabled/rendered on the form for the approvers to successfully select an outcome. For the longest time, we'd keep tucking this outcome field behind other fields, or behind an empty white square graphic and it would still manage to peek through.

Until, a colleague of mine found this hack online that leveraged the Control-CSS field and some simple jquery to make the field invisible.

In the Control CSS field associated with the Task Outcome choice control, put in a unique class name.

```css
Control CSS = hidden-control
```

Switch over to the Form Settings, and in the Custom Javascript field, add in the following jquery snippet.

```jquery
NWF$(".hidden-control").hide();
```

## Hiding or disabling fields by SharePoint Group membership

Nintex has a neat function called ```fn-IsMemberOfGroup()``` that checks if the user currently looking at the form is a part of a particular SharePoint group.

The trick here is to make sure you **manually** type in the name of the group and enclose in quotation marks. If you copy-paste the name of the SharePoint group, especially from SharePoint, it seems to carry some artifacts that Nintex dislikes and the hide/disable based on SharePoint group functionality refuses to work.

See articles: [fn-IsMemberOfGroup("Task Team") not working in Nintex Forms O365](https://community.nintex.com/thread/11375) and [fn-not not working](https://community.nintex.com/thread/2874)

## Date/Time Format Strings

A couple of handy reference articles on using inline functions [Date and Time Format Strings - Quick Reference Guide](https://community.nintex.com/community/build-your-own/blog/2015/08/11/date-and-time-format-strings-quick-reference-guide) or the default options available in a 'Set Variable' action [Using the Format this Value Feature with Dates](https://community.nintex.com/community/build-your-own/blog/2015/04/17/using-the-format-this-value-feature-with-dates) to format dates.

## Checking for an empty Person field

This turns out to be more complicated than it seems. One would think that a simple check for *Is this field blank* ought to do it, but the **Run If** and **Conditional If** actions don't contain a *is blank* / *is not blank* check for List Lookup columns; the only options available are *equals* and *not equals*.

The trick, as described in this Nintex post [Check for empty person field in workflow](https://community.nintex.com/thread/2787) is to instead save the Person field as a string field in a Workflow Variable. Once this field is available as a workflow variable, the **Run If** action does have an *is not empty* check.

## Regular Expressions in Nintex

It's completely amazing that Nintex allows RegEx parsing. That's powerful stuff, and it enables you to do a lot with just a static text field. I ran into having to use this to extract an internal reference number from a text string.

This reference number was always preceded by a hashtag '#' symbol, which made things easier, but it wasn't always in a constant position and could be varying lengths, so I couldn't use the **substring** action available in Nintex. It was however the first set of consecutive numbers in that string, which is a useful piece of information for leveraging RegEx.

To start with, the Nintex documentation on using Regular Expressions was pretty helpful:
[Nintex Actions > Regular Expressions](//help.nintex.com/en-US/O365/O365WorkFlow/Workflow%20Actions%20-%20STD/Regular%20Expression.htm)

The goal was, for example, to parse the number 543 from the string "#543 Test List Item with additional descriptors and possible more numbers 93940".

The actions required were as follows:

1. This Regex expression successfully extracts all the number sequences and stores them in a collection: **``` ^#([\d]+)? ```**
2. Since we want just the first iteration of this expression, we use the Nintex action to retrieve just the first item in the collection
3. The '#' symbol is still stuck to the first expression, so we do a substring-replace action to remove the # and we now have the pure number code from the list item description.

Stay tuned for more notes..

extension: markdown

gha_language: CSS


text:
## Payabbhi Payment Extension for PrestaShop 1.7.x.x

This extension is built on Payabbhi PHP Library to provide seamless integration of [Payabbhi Checkout ](https://payabbhi.com/docs/payments/checkout) with PrestaShop 1.7.x.x

### Installation

Make sure you have signed up for your [Payabbhi Account](https://payabbhi.com/docs/account) and downloaded the [API keys](https://payabbhi.com/docs/account/#api-keys) from the [Portal](https://payabbhi.com/portal).

1. Navigate to `PrestaShop Back Office` -> `Modules` -> `Module Manager` and click on `Upload a module`.

2. Upload `payabbhi.zip` to add Payabbhi Payment Extension to PrestaShop.

3. On successful upload, `payabbhi` folder should get added to PrestaShop installation directory as follows:

  ```
  PrestaShop/
    modules/
      payabbhi/
        config.xml
        controllers/
        index.php
        logo.png
        payabbhi-php/
        payabbhi.php
        views/
        script.js
  ```

4. After successful upload, navigate to `Modules` -> `Module Manager` ->`Other`. If you do not find Payabbhi on the list, please use the search option to find it.

5. Configure `Payabbhi` and Save the settings:
  - [Access ID](https://payabbhi.com/docs/account/#api-keys)
  - [Secret Key](https://payabbhi.com/docs/account/#api-keys)
  - [Payment Auto Capture](https://payabbhi.com/docs/api/#create-an-order)

[Payabbhi Checkout](https://payabbhi.com/docs/payments/checkout) is now enabled in PrestaShop.

### Payabbhi Prestashop Plugin for previous version/s

For Prestashop 1.6.x, refer to [Payabbhi Prestashop 1.6.x Plugin](https://github.com/payabbhi/payabbhi-prestashop)


text:
This repository provides tools in Python (using LXML.Etree) and XQuery for retrieving comments from Adobe XFDF format files into different ASCII-based exports: CSV, TST, others.

`xfdf2xhtml.xquery`
===================

This file has been tested with the [`xquilla` command line tool](http://xqilla.sourceforge.net/HomePage)

You can test it, for instace, with:

    xqilla -i examples/Technical_Document_Comments.xfdf xfdf2xhtml.xquery

That command should generate the following output (after formatting it with `xmllint --format`):

    <?xml version="1.0"?>
    <xhtml xmlns="http://www.w3.org/1999/xhtml">

            Issue #
            Section
            Page
            Author
            Observation

            1
            Document Software Box
            3
            Santander-Vela, Juande
            The version of the DocBook plugin, and of the related XSLT files for templating/personalisation for TM should be included, in this and the rest of Cameo-generated documents.

            2
            List of Tables
            10
            Santander-Vela, Juande
            Regarding the issue of tables vs diagrams, there should be a clarification. It would be less confusing if the "diagram" included a table in graphical form, but because it is really in table form, the SysML link is lost.

            3
            TM_REQ_358, TBD118
            133
            Santander-Vela, Juande
            Could this be brought into a TBC soon?

            4
            TM_REQ_358, TBD119
            133
            Santander-Vela, Juande
            Could this be a TBC soon?

            5
            TM_VREQ_29
            230
            Santander-Vela, Juande
            Seems to verify TM_REQ_35, but that requirement has been removed from the T0000-0000-RS-001 document.

    </xhtml>


text:
# Short Documentation (Yeoman Generator)

[Yeoman](http://yeoman.io) generator for the [Short Documentation](https://github.com/Longfilename/short-documentation/tree/master/app/templates) project.

Short Documentation is an HTML template and documentation project. The code organization and naming convention allow for a documentation build for minimal effort. Short Documentation uses Jade, SCSS, and ES6, and uses `config-yeoman.json` as a jump start on project development (by building out all the files and folders as defined in the JSON file).

## Installation

Install Yeoman and the Short Documentation generator.

```bash
npm install -g yo                             # install yeoman globally;
npm install -g generator-short-documentation  # install the short-documentation generator globally;
```

## Configuration

* create your project folder
* create a `config-yeoman.json` file ([sample JSON](./sample-config-yeoman.json))

#### config-yeoman.json

`config-yeoman.json` tells the generator what to build. This JSON file should save you significant time at the beginning of each project by creating most of the files and folders you need, and linking them together (like including the proper modules in the page Jade).

```javascript
{
  "project": {
    "name": "my project name"   // name your project, this shows up in the readme;
  },
  "components": {               // create an entry for each project component;
    "header": {                 // the key is the folder name for this component;
      "js": true                // if ‘js’ is true, create a JS file for this component;
    },
    "nav": {},                  // a JS file will not be generated for this component;
    "promo": {
      "js": true
    },
    "footer": {}
  },
  "templates": {                // create an entry for each template in this project;
    "home": [                   // the key is the folder name for this template;
      "header",                 // array of all the component used in this template;
      "nav",
      "footer"
    ],
    "article": [
      "page-header",
      "nav",
      "promo",
      "page-footer"
    ]
  }
}
```

## Implementation

Navigate to your project folder (that contains `config-yeoman.json`).

```bash
yo short-documentation  # project files and folders are created;
```

At this point, the `config-yeoman.json` file is no longer needed, you can delete it. A new component, or a new template can be added manually.

## License

The code is available under the MIT license.

repository: minustime/short-documentation

repo_name: minustime/short-documentation