text:
Developer Guide
===============

The repo can be built for the following platforms, using the provided setup and the following instructions.

| Chip  | Windows  | Linux    | macOS    | FreeBSD  |
| :---- | :------: | :------: | :------: | :------: |
| x64   | ✔ | ✔ | ✔ | ✔ |
| x86   | ✔ |          |          |          |
| ARM   | ✔ | ✔ |          |          |
| ARM64 | ✔ | ✔ |          |          |
|       | [Instructions](../building/windows-instructions.md) | [Instructions](../building/unix-instructions.md) | [Instructions](../building/unix-instructions.md) | [Instructions](../building/unix-instructions.md) |

Building the repository
=======================

The CoreFX repo can be built from a regular, non-admin command prompt. The build produces multiple binaries that make up the CoreFX libraries and the accompanying tests.

For information about the different options that are available use the argument `-help|-h` when calling the build script:
```
build -h
```
On Unix, arguments can be passed in with a single `-` or double hyphen `--`.

### Build
The CoreFX build has two logical components, the native build which produces the "shims" (which provide a stable interface between the OS and managed code) and
the managed build which produces the MSIL code and NuGet packages that make up CoreFX.

Calling the script `build` attempts to build both the native and managed code.

The build configurations are generally defaulted based on where you are building (i.e. which OS or which architecture) but we have a few shortcuts for the individual properties that can be passed to the build scripts:

- `-framework|-f` identifies the target framework for the build. It defaults to `netcoreapp` but possible values include `netcoreapp` or `netfx`. (msbuild property `TargetGroup`)
- `-os` identifies the OS for the build. It defaults to the OS you are running on but possible values include `Windows_NT`, `Unix`, `Linux`, or `OSX`. (msbuild property `OSGroup`)
- `-configuration|-c Debug|Release` controls the optimization level the compilers use for the build. It defaults to `Debug`. (msbuild property `ConfigurationGroup`)
- `-arch` identifies the architecture for the build. It defaults to `x64` but possible values include `x64`, `x86`, `arm`, or `arm64`. (msbuild property `ArchGroup`)

For more details on the build configurations see [project-guidelines](../coding-guidelines/project-guidelines.md#build-pivots).

**Note**: Before working on individual projects or test projects you **must** run `build` from the root once before beginning that work. It is also a good idea to run `build` whenever you pull a large set of unknown changes into your branch. If you invoke the build script without any actions, the default action chain `-restore -build` is executed. This means that restore and build are not implicit when invoking other actions!

**Note:** You can chain multiple actions together but the order of execution is fixed and does not relate to the position of the argument in the command.

The most common workflow for developers is to call `build` from the root once and then go and work on the individual library that you are trying to make changes for.

By default build only builds the product libraries and none of the tests. If you want to build the tests you can call `build -buildtests`. If you want to run the tests you can call `build -test`. To build and run the tests combine both arguments: `build -buildtests -test`. To build both the product libraries and the test libraries pass `build -build -buildtests` to the command line.

If you invoke the build script without any argument the default arguments will be executed `-restore -build`. Note that -restore and -build are only implicit if no actions are passed in.

**Examples**
- Building in release mode for platform x64 (restore and build are implicit here as no actions are passed in)
```
build -c Release -arch x64
```

- Building the src assemblies and build and run tests (running all tests takes a considerable amount of time!)
```
build -restore -build -buildtests -test
```

- Building for different target frameworks (restore and build are implicit again as no action is passed in)
```
build -framework netcoreapp
build -framework netfx
```

- Build only managed components and skip the native build
```
build /p:BuildNative=false
```

- Clean the entire solution
```
build -clean
```
### Build Native
The native build produces shims over libc, openssl, gssapi, and libz.
The build system uses CMake to generate Makefiles using clang.
The build also uses git for generating some version information.

The native component should be buildable on any system.

**Examples**

- Building in debug mode for platform x64
```
./src/Native/build-native debug x64
```

- The following example shows how you would do an arm cross-compile build.
```
./src/Native/build-native debug arm cross verbose
```

For more information about extra parameters take a look at the scripts `build-native` under src/Native.

### Build And Run Tests
To build the tests and run them you can call the build script passing -tests option. The same parameters you pass to build should also be passed to ensure you are building and running the tests on the same configuration you have build the product on. However to run tests on the same machine you need to ensure the machine supports the configuration you are building.

**Examples**
- The following shows how to build only the tests but not run them
```
build -buildtests
```

- The following builds and runs all tests for netcoreapp in release configuration.
```
build -buildtests -test -c Release -f netcoreapp
```

- The following example shows how to pass extra msbuild properties to ignore tests ignored in CI.
```
build -test /p:WithoutCategories=IgnoreForCI
```

### Building individual libraries

**Note**: Before working on individual projects or test projects you **must** run `build` from the root once before beginning that work. It is also a good idea to run `build` whenever you pull a large set of unknown changes into your branch.

Similar to building the entire repo with build.cmd/sh in the root you can build projects based on our directory structure by passing in the directory. We also support
shortcuts for libraries so you can omit the root src folder from the path. When given a directory we will build all projects that we find recursively under that directory.

**Examples**

- Build all projects for a given library (ex: System.Collections) including running the tests
```
build System.Collections
```
or
```
build src\System.Collections
```
or
```
cd src\System.Collections
..\..\build .
```

- Build just the tests for a library project.
```
build src\System.Collections\tests
```

- All the options listed above like framework and configuration are also supported (note they must be after the directory)
```
build System.Collections -f netfx -c Release
```

### Building individual projects

You can either use `dotnet msbuild` or `msbuild`, depending on which is in your path. As `dotnet msbuild` works on all supported environments (i.e. Unix) we will use it throughout this guide.

**Note**: Before working on individual projects or test projects you **must** run `build` from the root once before beginning that work. It is also a good idea to run `build` whenever you pull a large set of unknown changes into your branch.

Under the src directory is a set of directories, each of which represents a particular assembly in CoreFX. See Library Project Guidelines section under [project-guidelines](../coding-guidelines/project-guidelines.md) for more details about the structure.

For example the src\System.Diagnostics.DiagnosticSource directory holds the source code for the System.Diagnostics.DiagnosticSource.dll assembly.

You can build the DLL for System.Diagnostics.DiagnosticSource.dll by going to the `src\System.Diagnostics.DiagnosticsSource\src` directory and typing `dotnet msbuild`. The DLL ends up in `bin\AnyOS.AnyCPU.Debug\System.Diagnostics.DiagnosticSource` as well as `bin\runtime\[BuildConfiguration]`.

You can build the tests for System.Diagnostics.DiagnosticSource.dll by going to
`src\System.Diagnostics.DiagnosticSource\tests` and typing `dotnet msbuild`.

Some libraries might also have a ref and/or a pkg directory and you can build them in a similar way by typing `dotnet msbuild` in that directory.

For libraries that have multiple build configurations the configurations will be listed in the `<BuildConfigurations>` property group, commonly found in a configurations.props file next to the csproj. When building the csproj for a configuration the most compatible one in the list will be chosen and set for the build. For more information about `BuildConfigurations` see [project-guidelines](../coding-guidelines/project-guidelines.md).

**Examples**

- Build project for Linux for netcoreapp
```
dotnet msbuild System.Net.NetworkInformation.csproj /p:OSGroup=Linux
```

- Build release version of library
```
dotnet msbuild System.Net.NetworkInformation.csproj /p:ConfigurationGroup=Release
```

To build for all supported configurations you can use the `BuildAll` and `RebuildAll` tasks:

```
dotnet msbuild System.Net.NetworkInformation.csproj /t:RebuildAll
```

### Building all for other OSes

By default, building from the root will only build the libraries for the OS you are running on. One can
build for another OS by specifying `build -os [value]`.

Note that you cannot generally build native components for another OS but you can for managed components so if you need to do that you can do it at the individual project level or build all via passing `/p:BuildNative=false`.

### Building in Release or Debug

By default, building from the root or within a project will build the libraries in Debug mode.
One can build in Debug or Release mode from the root by doing `build -c Release` or `build -c Debug` or when building a project by specifying `/p:ConfigurationGroup=[Debug|Release]` after the `dotnet msbuild` command.

### Building other Architectures

One can build 32- or 64-bit binaries or for any architecture by specifying in the root `build -arch [value]` or in a project `/p:ArchGroup=[value]` after the `dotnet msbuild` command.

### Benchmarks

All Benchmarks have been moved to the [dotnet/performance/](https://github.com/dotnet/performance/) repository.

Please read the [Benchmarking workflow for CoreFX](https://github.com/dotnet/performance/blob/master/docs/benchmarking-workflow-corefx.md) document to find out how to build and run the Benchmarks.

### Tests

We use the OSS testing framework [xunit](http://xunit.github.io/).

#### Running tests on the command line

To build tests you need to pass the `-buildtests` flag to build.cmd/sh or if you want to build both src and tests you pass `-buildtests` flag (`build -restore -build -buildtests`). Note that you need to specify -restore and -build additionally as those are only implicit if no action is passed in.

For more information about cross-platform testing, please take a look [here](https://github.com/dotnet/corefx/blob/master/Documentation/building/cross-platform-testing.md).

If you are interested in building and running the tests only for a specific library, then there are two different ways to do it:

The easiest (and recommended) way to do it, is by simply building the test .csproj file for that library.

```cmd
cd src\System.Collections.Immutable\tests
dotnet msbuild /t:BuildAndTest   ::or /t:Test to just run the tests if the binaries are already built
dotnet msbuild /t:RebuildAndTest ::this will cause a test project to rebuild and then run tests
```

It is possible to pass parameters to the underlying xunit runner via the `XunitOptions` parameter, e.g.:
```cmd
dotnet msbuild /t:Test "/p:XunitOptions=-class Test.ClassUnderTests"
```

There may be multiple projects in some directories so you may need to specify the path to a specific test project to get it to build and run the tests.

Tests participate in the incremental build.  This means that if tests have already been run, and inputs to the incremental build have not changed, rerunning the tests target will not execute the test runner again.  To force re-executing tests in this situation, use `/p:ForceRunTests=true`.

#### Running a single test on the command line

To quickly run or debug a single test from the command line, set the XunitMethodName property (found in Tools\tests.targets) to the full method name (including namespace), e.g.:
```cmd
dotnet msbuild /t:RebuildAndTest /p:XunitMethodName={FullyQualifiedNamespace}.{ClassName}.{MethodName}
```

#### Running tests in a different target framework

Each test project can potentially have multiple build configurations. There are some tests that might be OS-specific, or might be testing an API that is available only on some target frameworks, so the `BuildConfigurations` property specifies the valid configurations. By default we will build and run only the default build configuration which is `netcoreapp`. The rest of the configurations will need to be built and ran by specifying the configuration options.

```cmd
cd src\System.Runtime\tests
dotnet msbuild System.Runtime.Tests.csproj /p:TargetGroup=netfx
```

#### Filtering tests using traits

The tests can also be filtered based on xunit trait attributes defined in [`Microsoft.DotNet.XUnitExtensions`](https://github.com/dotnet/arcade/tree/master/src/Microsoft.DotNet.XUnitExtensions). These attributes are specified above the test method's definition. The available attributes are:

#### OuterLoopAttribute

```cs
[OuterLoop()]
```
Tests marked as `OuterLoop` are for scenarios that don't need to run every build. They may take longer than normal tests, cover seldom hit code paths, or require special setup or resources to execute. These tests are excluded by default when testing through `dotnet msbuild` but can be enabled manually by adding the `-testscope outerloop` switch or `/p:TestScope=outerloop` e.g.

```cmd
build -test -testscope outerloop
cd src/System.Text.RegularExpressions/tests && dotnet msbuild /t:RebuildAndTest /p:TestScope=outerloop
```

#### PlatformSpecificAttribute

```cs
[PlatformSpecific(TestPlatforms platforms)]
```
Use this attribute on test methods to specify that this test may only be run on the specified platforms. This attribute returns the following categories based on platform
- `nonwindowstests` for tests that don't run on Windows
- `nonlinuxtests` for tests that don't run on Linux
- `nonosxtests` for tests that don't run on OS X

**[Available Test Platforms](https://github.com/dotnet/arcade/blob/master/src/Microsoft.DotNet.XUnitExtensions/src/TestPlatforms.cs)**

When running tests by building a test project, tests that don't apply to the `OSGroup` are not run. For example, to run Linux-specific tests on a Linux box, use the following command line:
```sh
dotnet msbuild <csproj_file> /t:BuildAndTest /p:OSGroup=Linux
```
To run all Linux-compatible tests that are failing:
```sh
dotnet msbuild <csproj_file> /t:BuildAndTest /p:OSGroup=Linux /p:WithCategories=failing
```

#### ActiveIssueAttribute
This attribute is intended to be used when there is an active issue tracking the test failure and it is needed to be fixed. This is a temporary attribute to skip the test while the issue is fixed. It is important that you limit the scope of the attribute to just the platforms and target monikers where the issue applies.

This attribute can be applied either to a test class (will disable all the tests in that class) or to a test method. It allows multiple usages on the same member.

This attribute returns the 'failing' category, which is disabled by default.

**Disable for all platforms and all target frameworks:**
```cs
[ActiveIssue(int issue)]
[ActiveIssue(string issue)]
```
**Disable for specific platform:**
```cs
[ActiveIssue(int issue, TestPlatforms platforms)]
[ActiveIssue(string issue, TestPlatforms platforms)]
```
**Disable for specific target frameworks:**
```cs
[ActiveIssue(int issue, TargetFrameworkMonikers frameworks)]
[ActiveIssue(string issue, TargetFrameworkMonikers frameworks)]
```
**Disable for specific test platforms and target frameworks:**
```cs
[ActiveIssue(int issue, TestPlatforms platforms, TargetFrameworkMonikers frameworks)]
[ActiveIssue(string issue, TestPlatforms platforms, TargetFrameworkMonikers frameworks)]
```
Use this attribute over test methods to skip failing tests only on the specific platforms and the specific target frameworks.

#### SkipOnTargetFrameworkAttribute
This attribute is intended to disable a test permanently on a framework where an API is not available or there is an intentional difference in behavior in between the tested framework and the skipped framework.

This attribute can be applied either to a test class (will disable all the tests in that class) or to a test method. It allows multiple usages on the same member.

```cs
[SkipOnTargetFramework(TargetFrameworkMonikers frameworks, string reason)]
```
Use this attribute over test methods to skip tests only on the specific target frameworks. The reason parameter doesn't affect the traits but we rather always use it so that when we see this attribute we know why it is being skipped on that framework.

If it needs to be skipped in multiple frameworks and the reasons are different please use two attributes on the same test so that you can specify different reasons for each framework.

**Currently this are the [Framework Monikers](https://github.com/dotnet/arcade/blob/master/src/Microsoft.DotNet.XUnitExtensions/src/TargetFrameworkMonikers.cs#L23-L26) that we support through our test execution infrastructure**

#### ConditionalFactAttribute
Use this attribute to run the test only when a condition is `true`. This attribute is used when `ActiveIssueAttribute` or `SkipOnTargetFrameworkAttribute` are not flexible enough due to needing to run a custom logic at test time. This test behaves as a `[Fact]` test that has no test data passed in as a parameter.

```cs
[ConditionalFact(params string[] conditionMemberNames)]
```

The conditional method needs to be a static method or property on this or any ancestor type, of any visibility, accepting zero arguments, and having a return type of Boolean.

**Example:**
```cs
public class TestClass
{
    public static bool ConditionProperty => true;

    [ConditionalFact(nameof(ConditionProperty))]
    public static void TestMethod()
    {
        Assert.True(true);
    }
}
```

#### ConditionalTheoryAttribute
Use this attribute to run the test only when a condition is `true`. This attribute is used when `ActiveIssueAttribute` or `SkipOnTargetFrameworkAttribute` are not flexible enough due to needing to run a custom logic at test time. This test behaves as a `[Theory]` test that has no test data passed in as a parameter.

```cs
[ConditionalTheory(params string[] conditionMemberNames)]
```

This attribute must have `[MemberData(string member)]` or a `[ClassData(Type class)]` attribute, which represents an `IEnumerable<object>` containing the data that will be passed as a parameter to the test. Another option is to add multiple or one `[InlineData(object params[] parameters)]` attribute.

The conditional method needs to be a static method or property on this or any ancestor type, of any visibility, accepting zero arguments, and having a return type of Boolean.

**Example:**
```cs
public class TestClass
{
    public static bool ConditionProperty => true;

    public static IEnumerable<object[]> Subtract_TestData()
    {
        yield return new object[] { new IntPtr(42), 6, (long)36 };
        yield return new object[] { new IntPtr(40), 0, (long)40 };
        yield return new object[] { new IntPtr(38), -2, (long)40 };
    }

    [ConditionalTheory(nameof(ConditionProperty))]
    [MemberData(nameof(Equals_TestData))]
    public static void Subtract(IntPtr ptr, int offset, long expected)
    {
        IntPtr p1 = IntPtr.Subtract(ptr, offset);
        VerifyPointer(p1, expected);

        IntPtr p2 = ptr - offset;
        VerifyPointer(p2, expected);

        IntPtr p3 = ptr;
        p3 -= offset;
        VerifyPointer(p3, expected);
    }
}
```

**Note that all of the attributes above must include an issue number/link and/or have a comment next to them briefly justifying the reason. ActiveIssueAttribute and SkipOnTargetFrameworkAttribute should use their constructor parameters to do this**

_**A few common examples with the above attributes:**_

- Run all tests acceptable on Windows that are not failing:
```cmd
dotnet msbuild <csproj_file> /t:BuildAndTest /p:OSGroup=Windows_NT
```
- Run all outer loop tests acceptable on OS X that are currently associated with active issues:
```sh
dotnet msbuild <csproj_file> /t:BuildAndTest /p:OSGroup=OSX /p:WithCategories="OuterLoop;failing""
```

### Code Coverage

Code coverage is built into the corefx build system.  It utilizes OpenCover for generating coverage data and ReportGenerator for generating reports about that data.  To run:

```cmd
:: Run full coverage (assuming sources and tests are already built)
build -test -coverage

If coverage succeeds, the full report can be found at `artifacts\coverage\index.htm`.

:: To run a single project with code coverage enabled pass the /p:Coverage=true property
cd src\System.Collections.Immutable\tests
dotnet msbuild /t:BuildAndTest /p:Coverage=true
```

If coverage succeeds, the individual report can be found at `$(TestPath)\report\index.htm`.

Code coverage reports from the continuous integration system are available from the links on the front page of the corefx repo.

## Testing with private CoreCLR bits

Generally the CoreFx build system gets the CoreCLR from a NuGet package which gets pulled down and correctly copied to the various output directories by building '\eng\restore\runtime\runtime.depproj' which gets built as part of `build.cmd/sh`. For folks that want to do builds and test runs in corefx with a local private build of coreclr you can follow these steps:

1. Build CoreCLR and note your output directory. Ex: `\coreclr\bin\Product\Windows_NT.x64.Release\` Note this will vary based on your OS/Architecture/Flavor and it is generally a good idea to use Release builds for CoreCLR when running CoreFx tests and the OS and Architecture should match what you are building in CoreFx.
2. Build CoreFx either passing in the `CoreCLROverridePath` property or setting it as an environment variable:
```
build.cmd /p:CoreCLROverridePath=d:\git\coreclr\bin\Product\Windows_NT.x64.Release\
```

When we copy the files to override the CoreCLR we do a hard-link copy, so in general if you rebuild CoreCLR the new binaries should be reflected in CoreFx for subsequent builds of individual projects in corefx. However if you want to force refresh or if you want to just update the CoreCLR after you already ran `build.cmd` from CoreFx you can run the following command:

```
dotnet msbuild /p:CoreCLROverridePath=d:\git\coreclr\bin\Product\Windows_NT.x64.Release\ ./external/runtime/runtime.depproj
```

By convention the project will look for PDBs in a directory under `$(CoreCLROverridePath)/PDB` and if found will also copy them. If not found no PDBs will be copied. If you want to explicitly set the PDB path then you can pass `CoreCLRPDBOverridePath` property to that PDB directory.

Once you have updated your CoreCLR you can run tests however you usually do (via build.cmd -test, individual test project, in VS, etc) and it should be using your copy of CoreCLR.

If you prefer, you can use a Debug build of System.Private.CoreLib, but if you do you must also use a Debug build of the native portions of the runtime, e.g. coreclr.dll. Tests with a Debug runtime will execute much more slowly than with Release runtime bits.

If the test project does not set the property `TestRuntime` to `true` and you want to collect code coverage that includes types in System.Private.CoreLib.dll, you'll need to follow the above steps, then

`dotnet msbuild /t:rebuildandtest /p:Coverage=true /p:TestRuntime=true`

## Debugging with Visual Studio Code

- Install [Visual Studio Code](https://code.visualstudio.com/)
- Install the [C# Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp)
- Open the folder containing the source you want to debug in VS Code - i.e., if you are debugging a test failure in System.Net.Sockets, open `corefx/src/System.Net.Sockets`
- Open the debug window: `ctrl-shift-D` or click on the button on the left
- Click the gear button at the top to create a launch configuration, select `.NET Core` from the selection dropdown
- In the `.NET Core Launch (console)` configuration do the following
  - delete the `preLaunchTask` property
  - set `program` to the full path to `dotnet` in the artifacts/bin/testhost directory.
    - something like `corefx/artifacts/bin/testhost/netcoreapp-{OS}-{Configuration}-{Architecture}`, plus the full path to your corefx directory.
  - set `cwd` to the test bin directory.
    - using the System.Net.Sockets example, it should be something like `corefx/artifacts/bin/System.Net.Sockets.Tests/netcoreapp-{OS}-{Configuration}-{Architecture}`, plus the full path to your corefx directory.
  - set `args` to the command line arguments to pass to the test
    - something like: `[ "exec", "--runtimeconfig", "{TestProjectName}.runtimeconfig.json", "xunit.console.dll", "{TestProjectName}.dll", "-notrait", ... ]`, where TestProjectName would be `System.Net.Sockets.Tests`
    - to run a specific test, you can append something like: `[ "method", "System.Net.Sockets.Tests.{ClassName}.{TestMethodName}", ...]`
- Set a breakpoint and launch the debugger, inspecting variables and call stacks will now work


text:
Validate your JS code with JSHint.

- Supports .jshintrc files

##Installation

- Download the zip file and unzip it to your plugin folder.

##Requirements
- Requires modern browser with web worker.
  - FF >= 3.5
  - Chrome >= 4
  - IE >= 10
  - Opera >= 10.6
  - Safari >= 4
  - Details: [caniuse.com](http://caniuse.com/#feat=webworkers)

##Example

![JSHINT](http://andrano.de/Plugins/img/jshint.png)

##Credit

Uses [JSHint](http://www.jshint.com/).

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>pymatgen.db.matproj — pymatgen-db 2022.5.20 documentation</title>
    <link rel="stylesheet" type="text/css" href="../../../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../../../_static/flasky.css" />

    <link rel="shortcut icon" href="../../../_static/favicon.ico"/>
    <link rel="index" title="Index" href="../../../genindex.html" />
    <link rel="search" title="Search" href="../../../search.html" />

  <link media="only screen and (max-device-width: 480px)" href="../../../_static/small_flask.css" type= "text/css" rel="stylesheet" />
  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">

Navigation

          index

          modules |

pymatgen-db 2022.5.20 documentation »

Module code »

pymatgen.db.matproj

Source code for pymatgen.db.matproj

"""
A module for replicating the MP database creator.

See https://medium.com/@shyuep/a-local-materials-project-database-1ea909430c95
"""

import itertools

import pymongo

from pymatgen.ext.matproj import MPRester
from pymatgen.entries.computed_entries import ComputedStructureEntry

[docs]class MPDB:
    """
    This module allows you to create a local MP database based on ComputedStructureEntries.
    """

    def __init__(self, *args, **kwargs):
        """
        @param args: Pass through to MongoClient. E.g., you can create a connection using uri strings, etc.
        @param kwargs: Pass through to MongoClient. E.g., you can create a connection using uri strings, etc.
        """
        client = pymongo.MongoClient(*args, **kwargs)
        db = client.matproj
        self.collection = db.entries

[docs]    def create(self, criteria=None, property_data: list = None):
        """
        Creates the database. Typically only used once.

        @param criteria: Criteria passed to MPRester.get_entries to obtain the entries. None means you get the entire
            MP database.
        @param property_data: List of additional property data to obtain. These are stored in the data.* keys.
        """
        mpr = MPRester()
        criteria = criteria or {}
        property_data = property_data or []
        entries = mpr.get_entries(
            criteria,
            inc_structure=True,
            property_data=property_data,
        )
        docs = []
        for e in entries:
            comp = e.composition
            elements = sorted(e.composition.keys())
            elements_str = sorted([el.symbol for el in elements])
            d = e.as_dict()
            d["pretty_formula"] = comp.reduced_formula
            d["elements"] = elements_str
            d["nelements"] = len(comp)
            d["chemsys"] = "-".join(elements_str)
            docs.append(d)

        self.collection.insert_many(docs)

        # These create useful indexes to speed up querying.
        self.collection.create_index("entry_id")
        self.collection.create_index("pretty_formula")
        self.collection.create_index("chemsys")
        self.collection.create_index("nelements")
        self.collection.create_index("elements")

[docs]    def get_entries_in_chemsys(self, elements, additional_criteria=None, **kwargs):
        """
        Helper method to get a list of ComputedEntries in a chemical system. For example, elements = ["Li", "Fe", "O"]
        will return a list of all entries in the Li-Fe-O chemical system, i.e., all LixOy, FexOy, LixFey, LixFeyOz,
        Li, Fe and O phases. Extremely useful for creating phase diagrams of entire chemical systems.

        Args:
            elements (str or [str]): Chemical system string comprising element
                symbols separated by dashes, e.g., "Li-Fe-O" or List of element
                symbols, e.g., ["Li", "Fe", "O"].
            additional_criteria (dict): Any additional criteria to pass. For instance, if you are only interested in
                stable entries, you can pass {"e_above_hull": {"$lte": 0.001}}.

        Returns:
            List of ComputedStructureEntries.
        """
        if isinstance(elements, str):
            elements = elements.split("-")

        all_chemsyses = []
        for i in range(len(elements)):
            for els in itertools.combinations(elements, i + 1):
                all_chemsyses.append("-".join(sorted(els)))

        criteria = {"chemsys": {"$in": all_chemsyses}}
        if additional_criteria:
            criteria.update(additional_criteria)

        entries = []
        for r in self.collection.find(criteria):
            entries.append(ComputedStructureEntry.from_dict(r))

        return entries

Related Topics

Documentation overview

Module code

Quick search

    <form class="search" action="../../../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

      © Copyright 2016, Shyue Ping Ong, Dan Gunter.

This page uses
Google Analytics to collect statistics. You can disable it by blocking
the JavaScript coming from www.google-analytics.com.


text:
apache_module('mpm_event') { enable false }
apache_module('mpm_worker') { enable false }
# itk depends on prefork
apache_module('mpm_prefork') { enable true }

package 'apache2-mpm-itk'

apache_module 'mpm_itk' do
  conf true
  filename 'mpm_itk.so'
end


text:
/*************************************************************************/
/*  sprite_3d.h                                                          */
/*************************************************************************/
/*                       This file is part of:                           */
/*                           GODOT ENGINE                                */
/*                      https://godotengine.org                          */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
/*                                                                       */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the       */
/* "Software"), to deal in the Software without restriction, including   */
/* without limitation the rights to use, copy, modify, merge, publish,   */
/* distribute, sublicense, and/or sell copies of the Software, and to    */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions:                                             */
/*                                                                       */
/* The above copyright notice and this permission notice shall be        */
/* included in all copies or substantial portions of the Software.       */
/*                                                                       */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
/*************************************************************************/

#ifndef SPRITE_3D_H
#define SPRITE_3D_H

#include "scene/2d/animated_sprite.h"
#include "scene/3d/visual_instance.h"

class SpriteBase3D : public GeometryInstance {
	GDCLASS(SpriteBase3D, GeometryInstance);

	mutable Ref<TriangleMesh> triangle_mesh; //cached

public:
	enum DrawFlags {
		FLAG_TRANSPARENT,
		FLAG_SHADED,
		FLAG_DOUBLE_SIDED,
		FLAG_DISABLE_DEPTH_TEST,
		FLAG_FIXED_SIZE,
		FLAG_MAX

	};

	enum AlphaCutMode {
		ALPHA_CUT_DISABLED,
		ALPHA_CUT_DISCARD,
		ALPHA_CUT_OPAQUE_PREPASS
	};

private:
	bool color_dirty;
	Color color_accum;

	SpriteBase3D *parent_sprite;
	List<SpriteBase3D *> children;
	List<SpriteBase3D *>::Element *pI;

	bool centered;
	Point2 offset;

	bool hflip;
	bool vflip;

	Color modulate;
	int render_priority = 0;
	float opacity;

	Vector3::Axis axis;
	float pixel_size;
	AABB aabb;

	RID mesh;
	RID material;

	bool flags[FLAG_MAX];
	AlphaCutMode alpha_cut;
	SpatialMaterial::BillboardMode billboard_mode;
	bool pending_update;
	void _im_update();

	void _propagate_color_changed();

protected:
	Color _get_color_accum();
	void _notification(int p_what);
	static void _bind_methods();
	virtual void _draw() = 0;
	_FORCE_INLINE_ void set_aabb(const AABB &p_aabb) { aabb = p_aabb; }
	_FORCE_INLINE_ RID &get_mesh() { return mesh; }
	_FORCE_INLINE_ RID &get_material() { return material; }

	uint32_t mesh_surface_offsets[VS::ARRAY_MAX];
	PoolByteArray mesh_buffer;
	uint32_t mesh_stride[VS::ARRAY_MAX];
	uint32_t mesh_surface_format;

	void _queue_update();

public:
	void set_centered(bool p_center);
	bool is_centered() const;

	void set_offset(const Point2 &p_offset);
	Point2 get_offset() const;

	void set_flip_h(bool p_flip);
	bool is_flipped_h() const;

	void set_flip_v(bool p_flip);
	bool is_flipped_v() const;

	void set_modulate(const Color &p_color);
	Color get_modulate() const;

	void set_opacity(float p_amount);
	float get_opacity() const;

	void set_render_priority(int p_priority);
	int get_render_priority() const;

	void set_pixel_size(float p_amount);
	float get_pixel_size() const;

	void set_axis(Vector3::Axis p_axis);
	Vector3::Axis get_axis() const;

	void set_draw_flag(DrawFlags p_flag, bool p_enable);
	bool get_draw_flag(DrawFlags p_flag) const;

	void set_alpha_cut_mode(AlphaCutMode p_mode);
	AlphaCutMode get_alpha_cut_mode() const;
	void set_billboard_mode(SpatialMaterial::BillboardMode p_mode);
	SpatialMaterial::BillboardMode get_billboard_mode() const;

	virtual Rect2 get_item_rect() const = 0;

	virtual AABB get_aabb() const;
	virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const;
	Ref<TriangleMesh> generate_triangle_mesh() const;

	SpriteBase3D();
	~SpriteBase3D();
};

class Sprite3D : public SpriteBase3D {
	GDCLASS(Sprite3D, SpriteBase3D);
	Ref<Texture> texture;

	bool region;
	Rect2 region_rect;

	int frame;

	int vframes;
	int hframes;

protected:
	virtual void _draw();
	static void _bind_methods();

	virtual void _validate_property(PropertyInfo &property) const;

public:
	void set_texture(const Ref<Texture> &p_texture);
	Ref<Texture> get_texture() const;

	void set_region(bool p_region);
	bool is_region() const;

	void set_region_rect(const Rect2 &p_region_rect);
	Rect2 get_region_rect() const;

	void set_frame(int p_frame);
	int get_frame() const;

	void set_frame_coords(const Vector2 &p_coord);
	Vector2 get_frame_coords() const;

	void set_vframes(int p_amount);
	int get_vframes() const;

	void set_hframes(int p_amount);
	int get_hframes() const;

	virtual Rect2 get_item_rect() const;

	Sprite3D();
	//~Sprite3D();
};

class AnimatedSprite3D : public SpriteBase3D {
	GDCLASS(AnimatedSprite3D, SpriteBase3D);

	Ref<SpriteFrames> frames;
	bool playing;
	StringName animation;
	int frame;

	bool centered;

	float timeout;

	bool hflip;
	bool vflip;

	Color modulate;

	void _res_changed();

	void _reset_timeout();
	void _set_playing(bool p_playing);
	bool _is_playing() const;

protected:
	virtual void _draw();
	static void _bind_methods();
	void _notification(int p_what);
	virtual void _validate_property(PropertyInfo &property) const;

public:
	void set_sprite_frames(const Ref<SpriteFrames> &p_frames);
	Ref<SpriteFrames> get_sprite_frames() const;

	void play(const StringName &p_animation = StringName());
	void stop();
	bool is_playing() const;

	void set_animation(const StringName &p_animation);
	StringName get_animation() const;

	void set_frame(int p_frame);
	int get_frame() const;

	virtual Rect2 get_item_rect() const;

	virtual String get_configuration_warning() const;
	virtual void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const;

	AnimatedSprite3D();
};

VARIANT_ENUM_CAST(SpriteBase3D::DrawFlags);
VARIANT_ENUM_CAST(SpriteBase3D::AlphaCutMode);

#endif // SPRITE_3D_H


text:
enum OPT_TYPE {

	OPT_SPECIAL,
	OPT_SET, OPT_CLEAR,
	OPT_INT, OPT_UINT, OPT_LONG, OPT_ULONG,
	OPT_FLOAT,
	OPT_CFL,
	OPT_VEC2, OPT_VEC3,
	OPT_FLOAT_VEC2, OPT_FLOAT_VEC3,
	OPT_STRING,
	OPT_INFILE, OPT_OUTFILE, OPT_INOUTFILE,
	OPT_SELECT,
	OPT_SUBOPT,
};

typedef bool opt_conv_f(void* ptr, char c, const char* optarg);

struct opt_s {

	char c;
	const char* s;
	bool arg;
	enum OPT_TYPE type;
	opt_conv_f* conv;
	void* ptr;
	const char* argname;
	const char* descr;
};

struct opt_select_s {

	void* ptr;
	const void* value;
	const void* default_value;
	size_t size;
};

struct opt_subopt_s {

	int n;
	struct opt_s* opts;

	char calling_c;
	const char* calling_s;
	const char* calling_desc;
};

typedef long opt_vec2_t[2];
typedef float opt_fvec2_t[2];
typedef long opt_vec3_t[3];
typedef float opt_fvec3_t[3];

#define OPT_SEL(T, x, v)	&(struct opt_select_s){ (x), &(T){ (v) }, &(T){ *(x) }, sizeof(T) }
#define OPT_SUB(n, opts, c, s, descr)	&(struct opt_subopt_s){ (n), (opts), (c), (s), (descr) }

#define OPT_SET(c, ptr, descr)			{ (c), NULL, false, OPT_SET, NULL, TYPE_CHECK(bool*, (ptr)), "", descr }
#define OPT_CLEAR(c, ptr, descr)		{ (c), NULL, false, OPT_CLEAR, NULL, TYPE_CHECK(bool*, (ptr)), "", descr }
#define OPT_ARG(c, type, T, ptr, argname, descr) { (c), NULL, true, type, NULL, TYPE_CHECK(T*, (ptr)), argname, descr }
#define OPT_STRING(c, ptr, argname, descr)	OPT_ARG(c, OPT_STRING, const char*, ptr, argname, descr)
#define OPT_INFILE(c, ptr, argname, descr)	OPT_ARG(c, OPT_INFILE, const char*, ptr, argname, descr)
#define OPT_OUTFILE(c, ptr, argname, descr)	OPT_ARG(c, OPT_OUTFILE, const char*, ptr, argname, descr)
#define OPT_INOUTFILE(c, ptr, argname, descr)	OPT_ARG(c, OPT_INOUTFILE, const char*, ptr, argname, descr)
#define OPT_UINT(c, ptr, argname, descr)	OPT_ARG(c, OPT_UINT, unsigned int, ptr, argname, descr)
#define OPT_INT(c, ptr, argname, descr)		OPT_ARG(c, OPT_INT, int, ptr, argname, descr)
#define OPT_ULONG(c, ptr, argname, descr)	OPT_ARG(c, OPT_ULONG, unsigned long, ptr, argname, descr)
#define OPT_LONG(c, ptr, argname, descr)	OPT_ARG(c, OPT_LONG, long, ptr, argname, descr)
#define OPT_FLOAT(c, ptr, argname, descr)	OPT_ARG(c, OPT_FLOAT, float, ptr, argname, descr)
#define OPT_VEC2(c, ptr, argname, descr)	OPT_ARG(c, OPT_VEC2, opt_vec2_t, ptr, argname, descr)
#define OPT_FLVEC2(c, ptr, argname, descr)	OPT_ARG(c, OPT_FLOAT_VEC2, opt_fvec2_t, ptr, argname, descr)
#define OPT_VEC3(c, ptr, argname, descr)	OPT_ARG(c, OPT_VEC3, opt_vec3_t, ptr, argname, descr)
#define OPT_FLVEC3(c, ptr, argname, descr)	OPT_ARG(c, OPT_FLOAT_VEC3, opt_fvec3_t, ptr, argname, descr)
#define OPT_SELECT(c, T, ptr, value, descr)	{ (c), NULL, false, OPT_SELECT, NULL, OPT_SEL(T, TYPE_CHECK(T*, ptr), value), "", descr }
#define OPT_SUBOPT(c, argname, descr, NR, opts)	OPT_ARG(c, OPT_SUBOPT, struct opt_subopt_s, OPT_SUB(NR, opts, c, NULL, descr), argname, descr)

// If the character in these macros is 0 (please note: NOT '0'), then it is only a long opt
// Otherwise, it is both
#define OPTL_SET(c, s, ptr, descr)			{ (c), (s), false, OPT_SET, NULL, TYPE_CHECK(bool*, (ptr)), "", descr }
#define OPTL_CLEAR(c, s, ptr, descr)			{ (c), (s), false, OPT_CLEAR, NULL, TYPE_CHECK(bool*, (ptr)), "", descr }
#define OPTL_ARG(c, s, type, T, ptr, argname, descr) { (c), (s), true, type, NULL, TYPE_CHECK(T*, (ptr)), argname, descr }
#define OPTL_STRING(c, s, ptr, argname, descr)	OPTL_ARG(c, s, OPT_STRING, const char*, ptr, argname, descr)
#define OPTL_INFILE(c, s, ptr, argname, descr)	OPTL_ARG(c, s, OPT_INFILE, const char*, ptr, argname, descr)
#define OPTL_OUTFILE(c, s, ptr, argname, descr)	OPTL_ARG(c, s, OPT_OUTFILE, const char*, ptr, argname, descr)
#define OPTL_INOUTFILE(c, s, ptr, argname, descr)	OPTL_ARG(c, s, OPT_INOUTFILE, const char*, ptr, argname, descr)
#define OPTL_UINT(c, s, ptr, argname, descr)	OPTL_ARG(c, s, OPT_UINT, unsigned int, ptr, argname, descr)
#define OPTL_INT(c, s, ptr, argname, descr)	OPTL_ARG(c, s, OPT_INT, int, ptr, argname, descr)
#define OPTL_ULONG(c, s, ptr, argname, descr)	OPTL_ARG(c, s, OPT_ULONG, unsigned long, ptr, argname, descr)
#define OPTL_LONG(c, s, ptr, argname, descr)	OPTL_ARG(c, s, OPT_LONG, long, ptr, argname, descr)
#define OPTL_FLOAT(c, s, ptr, argname, descr)	OPTL_ARG(c, s, OPT_FLOAT, float, ptr, argname, descr)
#define OPTL_VEC2(c, s, ptr, argname, descr)	OPTL_ARG(c, s, OPT_VEC2, opt_vec2_t, ptr, argname, descr)
#define OPTL_FLVEC2(c, s, ptr, argname, descr)	OPTL_ARG(c, s, OPT_FLOAT_VEC2, opt_fvec2_t, ptr, argname, descr)
#define OPTL_VEC3(c, s, ptr, argname, descr)	OPTL_ARG(c, s, OPT_VEC3, opt_vec3_t, ptr, argname, descr)
#define OPTL_FLVEC3(c, s, ptr, argname, descr)	OPTL_ARG(c, s, OPT_FLOAT_VEC3, opt_fvec3_t, ptr, argname, descr)
#define OPTL_SELECT(c, s, T, ptr, value, descr)	{ (c), (s), false, OPT_SELECT, NULL, OPT_SEL(T, TYPE_CHECK(T*, ptr), value), "", descr }
#define OPTL_SELECT_DEF(c, s, T, ptr, value, def, descr)	{ (c), (s), false, OPT_SELECT, NULL, &(struct opt_select_s){ (TYPE_CHECK(T*, ptr)), &(T){ TYPE_CHECK(T, value) }, &(T){ (TYPE_CHECK(T, def)) }, sizeof(T) }, "", descr }
#define OPTL_SUBOPT(c, s, argname, descr, NR, opts)	OPTL_ARG(c, s, OPT_SUBOPT, struct opt_subopt_s, OPT_SUB(NR, opts, c, s, descr), argname, descr)

enum ARG_TYPE {

	ARG,
	ARG_TUPLE,
};

struct arg_single_s {

	enum OPT_TYPE opt_type;
	size_t size;
	void* ptr;
	const char* argname;
};

struct arg_s {

	bool required;
	enum ARG_TYPE arg_type;
	long* count;
	int nargs;
	struct arg_single_s* arg;
};

#define ARG_SINGLE(type, T, ptr, argname)			&(struct arg_single_s){ (type), sizeof(T), (ptr), (argname) }

#define ARG_CHECKED(required, type, T, ptr, argname)		{ required, ARG, NULL, 1, ARG_SINGLE(type, T, TYPE_CHECK(T*, ptr), argname) }

#define ARG_UINT(required, ptr, argname) 		ARG_CHECKED(required, OPT_UINT,  unsigned int, ptr, argname)
#define ARG_INT(required, ptr, argname) 		ARG_CHECKED(required, OPT_INT,  int, ptr, argname)
#define ARG_ULONG(required, ptr, argname) 		ARG_CHECKED(required, OPT_ULONG, unsigned long, ptr, argname)
#define ARG_LONG(required, ptr, argname) 		ARG_CHECKED(required, OPT_LONG,  long, ptr, argname)
#define ARG_CFL(required, ptr, argname) 		ARG_CHECKED(required, OPT_CFL,  _Complex float, ptr, argname)
#define ARG_INFILE(required, ptr, argname) 		ARG_CHECKED(required, OPT_INFILE, const char*, ptr, argname)
#define ARG_OUTFILE(required, ptr, argname) 		ARG_CHECKED(required, OPT_OUTFILE,  const char*, ptr, argname)
#define ARG_INOUTFILE(required, ptr, argname) 		ARG_CHECKED(required, OPT_INOUTFILE,  const char*, ptr, argname)
#define ARG_STRING(required, ptr, argname)		ARG_CHECKED(required, OPT_STRING,  const char*, ptr, argname)
#define ARG_FLOAT(required, ptr, argname)		ARG_CHECKED(required, OPT_FLOAT,  float, ptr, argname)
#define ARG_VEC2(required, ptr, argname)		ARG_CHECKED(required, OPT_VEC2,  opt_vec2_t, ptr, argname)
#define ARG_FLVEC2(required, ptr, argname)		ARG_CHECKED(required, OPT_FLOAT_VEC2,  opt_fvec2_t, ptr, argname)
#define ARG_VEC3(required, ptr, argname)		ARG_CHECKED(required, OPT_VEC3,  opt_vec3_t, ptr, argname)
#define ARG_FLVEC3(required, ptr, argname)		ARG_CHECKED(required, OPT_FLOAT_VEC3,  opt_fvec3_t, ptr, argname)

#define ARG_TUPLE(required, count, n, ...)		{ (required), ARG_TUPLE, (count), (n), (struct arg_single_s[(n)]){ __VA_ARGS__ } }
#define TUPLE_LONG(ptr, argname)			(struct arg_single_s){ OPT_LONG, sizeof(long), TYPE_CHECK(long**, ptr), argname }

extern void cmdline(int* argc, char* argv[*argc], int m, struct arg_s args[m], const char* help_str, int n, const struct opt_s opts[n]);
extern void opt_free_strdup(void);

#include "misc/cppwrap.h"
#endif //OPTS_H


text:
cd $(dirname $0)

kill_server() {
    killall -KILL grpc-rust-interop-server || true
}

cargo build
kill_server
../target/debug/grpc-rust-interop-server &

trap kill_server EXIT

tests=(
    empty_unary
    large_unary
    ping_pong
    empty_stream
    custom_metadata
    status_code_and_message
    unimplemented_method
    cancel_after_first_response
)

for testname in "${tests[@]}"; do
    ./go-grpc-interop-client -use_tls=false -test_case=$testname
done

kill_server

set +x

echo "ALL TESTS PASSED"

# vim: set ts=4 sw=4 et:


text:
 sudo apt-get install -y --force-yes clvm #- Cluster LVM Daemon for lvm2
 sudo apt-get install -y --force-yes initramfs-tools #- tools for generating an initramfs
 sudo apt-get install -y --force-yes liblvm2-dev #- LVM2 libraries #- development files
 sudo apt-get install -y --force-yes liblvm2app2.2 #- LVM2 application library
 sudo apt-get install -y --force-yes liblvm2cmd2.02 #- LVM2 command library
 sudo apt-get install -y --force-yes lvm2 #- Linux Logical Volume Manager
 sudo apt-get install -y --force-yes autopkgtest-xenlvm #- Xen/LVM2 based testbed snapshot system
 sudo apt-get install -y --force-yes dracut #- A new initramfs infrastructure
 sudo apt-get install -y --force-yes dracut-network #- A new initramfs infrastucture
 sudo apt-get install -y --force-yes testdisk #- Partition scanner and disk recovery tool


text:
package wang.gnim.netty.server.command;

import wang.gnim.netty.net.netty.http.HttpParamaters;

/**
 * 执行Http请求
 *
 * @author wangming
 *
 */
public abstract class AbstractCommand {

	public abstract Object execute(HttpParamaters param);
}


text:
//
//      Copyright (C) 2012-2014 DataStax Inc.
//
//   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.
//

using System;
using System.IO;
using NUnit.Framework;

namespace Cassandra.Tests
{
    public class ResponseFrameTest
    {
        [Test]
        [ExpectedException(typeof(ArgumentNullException))]
        public void Ctor_HeaderIsNull_Throws()
        {
            new Frame(null, new MemoryStream());
        }

        [Test]
        [ExpectedException(typeof(ArgumentNullException))]
        public void Ctor_BodyIsNull_Throws()
        {
            new Frame(new FrameHeader(), null);
        }
    }
}


text:
<?php defined('C5_EXECUTE') or die("Access Denied."); ?>

<?php echo Loader::helper('concrete/ui')->tabs(array(
    array('form-add', t('Add'), true),
    array('form-edit', t('Edit')),
    array('form-results', t('Results')),
    array('form-options', t('Options')),
));?>

<div id="ccm-tab-content-form-add" class="ccm-tab-content" data-action="<?=$view->action('add_control')?>">

<?=t('Question added successfully.')?>

    <fieldset>
        <legend><?php echo t('New Question')?></legend>

            <button type="button" class="btn btn-primary" data-action="add-question"><?=t('Add Question')?></button>

    </fieldset>

<div id="ccm-tab-content-form-edit" class="ccm-tab-content" data-action="<?=$view->action('update_control')?>">

<?=t('Question updated successfully.')?>

    <fieldset>
        <legend><?php echo t('Fields')?></legend>

    </fieldset>

        <fieldset>
            <legend><?php echo t('Edit Question')?></legend>

                <button type="button" class="btn btn-default" data-action="cancel-edit"><?=t('Cancel')?></button>
                <button type="button" class="btn btn-primary pull-right" data-action="update-question"><?=t('Save Question')?></button>

        </fieldset>

    <fieldset>
        <input type="hidden" name="resultsFolder" value="<?=$resultsFolder?>">

        <legend><?php echo t('Results')?></legend>

<?=t('Store results in a folder:')?>

        <?php if (is_object($tree)) {
        ?>
        <div data-root-tree-node-id="<?=$formResultsRootFolderNodeID?>" data-tree="<?=$tree->getTreeID()?>">

        <?php } ?>

    </fieldset>

    <fieldset>
        <legend><?=t('Options')?></legend>

            <?=$form->label('formName', t('Form Name'))?>
            <?=$form->text('formName', $formName)?>

            <?=$form->label('submitLabel', t('Submit Button Label'))?>
            <?=$form->text('submitLabel', $submitLabel)?>

            <?=$form->label('thankyouMsg', t('Message to display when completed'))?>
            <?=$form->textarea('thankyouMsg', $thankyouMsg, array('rows' => 3))?>

            <?=$form->label('recipientEmail', t('Notify me by email when people submit this form'))?>

				<?=$form->checkbox('notifyMeOnSubmission', 1, $notifyMeOnSubmission == 1)?>
				<?=$form->text('recipientEmail', $recipientEmail, array('style' => 'z-index:2000;'))?>

            <?=t('(Seperate multiple emails with a comma)')?>

            <?=t('Solving a CAPTCHA Required to Post?', t('http://en.wikipedia.org/wiki/Captcha'))?>

                    <?=$form->radio('displayCaptcha', 1, (int) $displayCaptcha)?>
                    <?=t('Yes')?>

                    <?=$form->radio('displayCaptcha', 0, (int) $displayCaptcha)?>
                    <?=t('No')?>

            <?=t('Redirect to another page after form submission?')?>

                <?php
                $page_selector = Loader::helper('form/page_selector');
                if ($redirectCID) {
                    echo $page_selector->selectPage('redirectCID', $redirectCID);
                } else {
                    echo $page_selector->selectPage('redirectCID');
                }
                ?>

            <?=t('Add uploaded files to a set?')?>
                <?php

                $fileSets = Concrete\Core\File\Set\Set::getMySets();
                $sets = array(0 => t('None'));
                foreach ($fileSets as $fileSet) {
                    $sets[$fileSet->getFileSetID()] = $fileSet->getFileSetDisplayName();
                }
                echo $form->select('addFilesToSet', $sets, $addFilesToSet);
                ?>

    </fieldset>


text:
* Neutronium is an UI framework for .Net.

* It uses the [MVVM architecture](https://www.wikiwand.com/en/Model%E2%80%93view%E2%80%93viewmodel).
  * Using same binding conventions as WPF

>

* The view layer is composed of
  * an embedded HTML browser
  * a reactive javascript framework. Currently supported are:
    * [vue.js](https://vuejs.org/),
    * [knockout.js](https://knockoutjs.com/)
    * [mobX](https://mobx.js.org/)

* Its architecture is pluggable:

   Different javascript framework and/or webBrowser can be plugged in without changing the core infrastructure.

* It can be used:
  * To build application from scratch
  * To add a dedicated HTML component to an already existent Wpf application
  * To replace an already existing Wpf application, as the existing viewModels can be reused without alteration in Neutronium.

Screenshots from Neutronium applications:

>

>


text:
from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('waldur_vmware', '0011_add_datastore'),
    ]

    operations = [
        migrations.AddField(
            model_name='template',
            name='disk',
            field=models.PositiveIntegerField(default=0, help_text='Disk size in MiB'),
        ),
    ]


text:
status: publish
tags:
- Project 365
published: true
title: Day 50 - Prop 65 Warning
type: post
meta:
  aktt_tweeted: "1"
  _edit_last: "2"
  _wp_old_slug: ""
  aktt_notify_twitter: "yes"
layout: post
---

This is a California Prop 65 warning (not to be confused with project 365!). They are all over the place here (in public venues, on rental cars, ...) and are pretty much completely useless. Let's review what it does: It informs me that somewhere in the general vicinity are materials that might or might not be harmful for me in some way. There are approximately two cases of such materials.

One, things that I am likely to ingest or are otherwise sufficiently likely to cause such harm to me. I would argue that materials of considerable and imminent danger to the public should be banned altogether (example: Asbestos). Or, if they can't be avoided because they really are everywhere, then a vague warning in distinct spots doesn't help because the individual has no way to protect themselves against it, other than locking themselves into a cleanroom.

Two, things that I am unlikely to suffer harm from, unless I abuse items for uses different than their intended purpose. For example, I chew the glue off my car's dashboard, or snort paint chips off the wall at my local train station. One could argue, in such a case possible birth defects are the least of my problems.

That being said, Wikipedia mentions that the 1986 proposition itself was quite successful so far in publishing and subsequently reducing or eliminating exposure of specific harmful chemicals. I appreciate that.

The ubiquitous warning labels, however, are, at best, a Californian curiosity (and to the locals, a mere addition to the background noise), and at worst a 1-dollar "band aid" that has been applied for 25 years now instead of removing truly harmful materials from the public space.


text:
Pops the last active color from the ColorStack.

---

#### Syntax:
```lua
popColor()
```


text:
Zulip supports using SAML authentication for single sign-on, both when
self-hosting or on the Zulip Cloud Plus plan.

This page documents details on how to set up SAML authentication with
Zulip with various common SAML identity providers.

## Configure SAML with Okta

1. Make sure you have created your organization. We'll assume its URL is
   `https://<subdomain>.zulipchat.com` in the instructions below.
1. Set up SAML authentication by following
   [Okta's documentation](https://developer.okta.com/docs/guides/saml-application-setup/overview/).
   Specify:
     * `https://<subdomain>.zulipchat.com/complete/saml/` for the "Single sign on URL"`.
     * `https://zulip.com` for the "Audience URI (SP Entity ID)".
     * Skip "Default RelayState".
     * Skip "Name ID format".
     * Set 'Email` for "Application username format".
     * Provide "Attribute statements" of `email` to `user.email`,
       `first_name` to `user.firstName`, and `last_name` to `user.lastName`.
1. Assign the appropriate accounts in the "Assignments" tab. These are the users
   that will be able to log in to your Zulip organization.
1. Send the following information to us at support@zulip.com:
     * The URL of your zulipchat-hosted organization.
     * The "Identity Provider metadata" provided by Okta for the application.
     * The name "X" that will be displayed on the "Log in with X" button in Zulip.
     * Optionally you can also send us an icon that should be shown on the button.
1. We will take care of the server-side setup and let you know as soon as it's ready.

## Configure SAML with OneLogin

1. Make sure you have created your organization. We'll assume its URL is
   `https://<subdomain>.zulipchat.com` in the instructions below.
1. Navigate to the OneLogin Applications page, and click "Add App".
1. Search for the "SAML Test Connector (IdP w/ attr w/ sign response)" app and select it.
1. Set a name and logo according to your preferences and click "Save". This doesn't affect anything in Zulip,
   but will be shown on your OneLogin Applications page.
1. Go to the "Configuration" section:
    * Leave the `RelayState` field empty.
    * Set `https://zulip.com` as the Audience.
    * Set `https://<subdomain>.zulipchat.com/complete/saml/` as the Recipient, ACS URL
      and ACS URL Validator.
1. Go to the "Parameters" section. Ignore the pre-configured parameters that are already there
   and add custom ones to match the following screenshot:

    ![OneLogin parameters](/static/images/help/onelogin_parameters.png)

    Make sure to set the "Include in SAML assertion" flag on them.

1. The OneLogin side of configuration should be ready!
   Send the following information to us at support@zulip.com:
     * The URL of your zulipchat-hosted organization.
     * The issuer URL from the "SSO" section. It contains Identity Provider metadata that we will need.
     * The name "X" that will be displayed on the "Log in with X" button in Zulip.
     * Optionally you can also send us an icon that should be shown on the button.
1. We will take care of the server-side setup and let you know as soon as it's ready.

## Related articles

* [SAML configuration][saml-readthedocs] for self-hosting.

[saml-readthedocs]: https://zulip.readthedocs.io/en/stable/production/authentication-methods.html#saml


text:
Stuur een mail zonder ontvanger naar...

<tt>empty_address_recipient</tt>

Deze parameter specificeert de bestemming voor email waarin geen ontvanger
zit, dus  <tt><></tt>, en die dus niet afgeleverd kan worden.
(typisch gespecificeerd, afkets notificaties en andere notificaties).

Standaard word dit soort mail verstuurd naar de MAILER-DAEMON.


text:
// Copyright 2015 The MemDB Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied. See the License for the specific language governing
// permissions and limitations under the License. See the AUTHORS file
// for names of contributors.

/* jshint ignore:start */

/*!
 * Module dependencies.
 */

var MongooseCollection = require('mongoose/lib/collection')
    , Collection = require('mongodb').Collection
    , STATES = require('mongoose/lib/connectionstate')
    , utils = require('mongoose/lib/utils')
    , uuid = require('node-uuid')
    , logger = require('memdb-logger').getLogger('memdb-client', __filename);

/**
 * A [node-mongodb-native](https://github.com/mongodb/node-mongodb-native) collection implementation.
 *
 * All methods methods from the [node-mongodb-native](https://github.com/mongodb/node-mongodb-native) driver are copied and wrapped in queue management.
 *
 * @inherits Collection
 * @api private
 */

function MemdbCollection () {
    this.memdb = true;

    this.collection = null;
    MongooseCollection.apply(this, arguments);
    this.id = uuid.v4();

    var self = this;
    Object.defineProperty(this, '_memdbCollection', {
        get : function(){
            return require('../mdbgoose').autoconn.collection(self.name);
        },
    });
}

/*!
 * Inherit from abstract Collection.
 */

MemdbCollection.prototype.__proto__ = MongooseCollection.prototype;

/**
 * Called when the connection opens.
 *
 * @api private
 */

MemdbCollection.prototype.onOpen = function () {
    var self = this;

    // always get a new collection in case the user changed host:port
    // of parent db instance when re-opening the connection.

    if (!self.opts.capped.size) {
        // non-capped
        return self.conn.db.collection(self.name, callback);
    }

    // capped
    return self.conn.db.collection(self.name, function (err, c) {
        if (err) return callback(err);

        // discover if this collection exists and if it is capped
        self.conn.db.collection( 'system.namespaces', function(err, namespaces) {
            var namespaceName = self.conn.db.databaseName + '.' + self.name;
            namespaces.findOne({ name : namespaceName }, function(err, doc) {
                if (err) {
                    return callback(err);
                }
                var exists = !!doc;

                if (exists) {
                    if (doc.options && doc.options.capped) {
                        callback(null, c);
                    } else {
                        var msg = 'A non-capped collection exists with the name: '+ self.name +'\n\n'
                                        + ' To use this collection as a capped collection, please '
                                        + 'first convert it.\n'
                                        + ' http://www.mongodb.org/display/DOCS/Capped+Collections#CappedCollections-Convertingacollectiontocapped'
                        err = new Error(msg);
                        callback(err);
                    }
                } else {
                    // create
                    var opts = utils.clone(self.opts.capped);
                    opts.capped = true;
                    self.conn.db.createCollection(self.name, opts, callback);
                }
            });
        });
    });

    function callback (err, collection) {
        if (err) {
            // likely a strict mode error
            self.conn.emit('error', err);
        } else {
            self.collection = collection;
            MongooseCollection.prototype.onOpen.call(self);
        }
    };
};

/**
 * Called when the connection closes
 *
 * @api private
 */

MemdbCollection.prototype.onClose = function () {
    MongooseCollection.prototype.onClose.call(this);
};

MemdbCollection.prototype.find = function(query, options, cb){
    logger.debug('MemdbCollection.find %j %j', query, options);

    if(options.comment === '$mongo'){
        delete options.comment;
        return this.findMongo(query, options, cb);
    }
    else if(options.comment === '$readonly'){
        delete options.comment;
        options.readonly = true;
    }

    return this._memdbCollection.find(query, options.fields, options)
    .then(function(docs){
        return {
            toArray : function(cb){
                cb(null, docs);
            }
        };
    })
    .nodeify(cb);
};

MemdbCollection.prototype.findOne = function(query, options, cb){
    logger.debug('MemdbCollection.findOne %j %j', query, options);

    if(options.comment === '$mongo'){
        delete options.comment;
        return this.findOneMongo(query, options, cb);
    }
    else if(options.comment === '$readonly'){
        delete options.comment;
        options.readonly = true;
    }

    return this._memdbCollection.findOne(query, options.fields, options)
    .nodeify(cb);
};

MemdbCollection.prototype.insert = function(docs, opts, cb) {
    return this._memdbCollection.insert(docs)
    .nodeify(cb);
};

MemdbCollection.prototype.remove = function(selector, opts, cb) {
    return this._memdbCollection.remove(selector, opts)
    .nodeify(cb);
};

MemdbCollection.prototype.update = function(selector, doc, opts, cb) {
    return this._memdbCollection.update(selector, doc, opts)
    .nodeify(cb);
};

MemdbCollection.prototype.save = function(doc, opts, cb) {
    throw new Error('Collection#save unimplemented by driver');
};

MemdbCollection.prototype.findAndModify = function() {
    throw new Error('Collection#findAndModify unimplemented by driver');
};

MemdbCollection.prototype.findAndRemove = function() {
    throw new Error('Collection#findAndRemove unimplemented by driver');
};

/*!
 * Copy the collection methods and make them subject to queues
 */

for (var i in Collection.prototype) {

    var unimplemented = ['findAndModify', 'findAndRemove'];
    if (unimplemented.indexOf(i) != -1) {
        continue;
    }

    // Ignore methods with Async suffix (Generated by bluebird)
    if(/Async$/.test(i)){
        continue;
    }

    (function(i){

        var needReplace = ['find', 'findOne', 'insert', 'remove', 'save', 'update'];
        var funcName = i;
        if (needReplace.indexOf(i) != -1) {
            funcName = i + 'Mongo';
        }

        MemdbCollection.prototype[funcName] = function () {
            if (this.buffer) {
                this.addQueue(i, arguments);
                return;
            }

            var collection = this.collection
                , args = arguments
                , self = this
                , debug = self.conn.base.options.debug;

            if (debug) {
                if ('function' === typeof debug) {
                    debug.apply(debug
                        , [self.name, i].concat(utils.args(args, 0, args.length-1)));
                } else {
                    console.error('\x1B[0;36mMongoose:\x1B[0m %s.%s(%s) %s %s %s'
                        , self.name
                        , i
                        , print(args[0])
                        , print(args[1])
                        , print(args[2])
                        , print(args[3]))
                }
            }

            return collection[i].apply(collection, args);
        };
    })(i);
}

/*!
 * Debug print helper
 */

function print (arg) {
    var type = typeof arg;
    if ('function' === type || 'undefined' === type) return '';
    return format(arg);
}

/*!
 * Debug print helper
 */

function format (obj, sub) {
    var x = utils.clone(obj);
    if (x) {
        if ('Binary' === x.constructor.name) {
            x = '[object Buffer]';
        } else if ('ObjectID' === x.constructor.name) {
            var representation = 'ObjectId("' + x.toHexString() + '")';
            x = { inspect: function() { return representation; } };
        } else if ('Date' === x.constructor.name) {
            var representation = 'new Date("' + x.toUTCString() + '")';
            x = { inspect: function() { return representation; } };
        } else if ('Object' === x.constructor.name) {
            var keys = Object.keys(x)
                , i = keys.length
                , key
            while (i--) {
                key = keys[i];
                if (x[key]) {
                    if ('Binary' === x[key].constructor.name) {
                        x[key] = '[object Buffer]';
                    } else if ('Object' === x[key].constructor.name) {
                        x[key] = format(x[key], true);
                    } else if ('ObjectID' === x[key].constructor.name) {
                        ;(function(x){
                            var representation = 'ObjectId("' + x[key].toHexString() + '")';
                            x[key] = { inspect: function() { return representation; } };
                        })(x)
                    } else if ('Date' === x[key].constructor.name) {
                        ;(function(x){
                            var representation = 'new Date("' + x[key].toUTCString() + '")';
                            x[key] = { inspect: function() { return representation; } };
                        })(x)
                    } else if (Array.isArray(x[key])) {
                        x[key] = x[key].map(function (o) {
                            return format(o, true)
                        });
                    }
                }
            }
        }
        if (sub) return x;
    }

    return require('util')
        .inspect(x, false, 10, true)
        .replace(/\n/g, '')
        .replace(/\s{2,}/g, ' ')
}

/**
 * Retreives information about this collections indexes.
 *
 * @param {Function} callback
 * @method getIndexes
 * @api public
 */

MemdbCollection.prototype.getIndexes = MemdbCollection.prototype.indexInformation;

/*!
 * Module exports.
 */

module.exports = MemdbCollection;


text:
package io.cucumber.eclipse.editor.preferences;

import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.IPreferencesService;

public class StepPreferences {

	public static StepPreferences INSTANCE = new StepPreferences();

	// Plugin Settings
	public static String PREF_CHECK_STEP_DEFINITIONS = "check_step_definitions"; //$NON-NLS-1$
	// #239:Only match step implementation in same package as feature file
	public static String PREF_GLUE_ONLY_IN_SAME_LOCATION = "glue_only_in_same_location"; //$NON-NLS-1$
	// Newly Declared By Girija for User-Settings Cucumber Preference Page
	public static String PREF_ADD_PACKAGE = "add_package"; //$NON-NLS-1$

	private IPreferencesService preferencesService;

	private StepPreferences() {
		preferencesService = Platform.getPreferencesService();
	}

	public boolean isStepDefinitionsMatchingEnabled() {
		return preferencesService.getBoolean("cucumber.eclipse.editor", PREF_CHECK_STEP_DEFINITIONS, false, null);
	}

	// Get Package Name(s) From User-Settings Page
	public String getPackageName() {
		return preferencesService.getString("cucumber.eclipse.editor", PREF_ADD_PACKAGE, "", null);
	}

	// #239:Only match step implementation in same package as feature file
	public Boolean isGlueOnlyInSameLocationEnabled() {
		return preferencesService.getBoolean("cucumber.eclipse.editor", PREF_GLUE_ONLY_IN_SAME_LOCATION, false, null);
	}

}


text:
package fr.free.nrw.commons.glide;

import android.support.annotation.NonNull;

import com.bumptech.glide.load.Options;
import com.bumptech.glide.load.ResourceDecoder;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.resource.SimpleResource;
import com.caverock.androidsvg.SVG;
import com.caverock.androidsvg.SVGParseException;

import java.io.IOException;
import java.io.InputStream;

/**
 * Decodes an SVG internal representation from an {@link InputStream}.
 */
public class SvgDecoder implements ResourceDecoder<InputStream, SVG> {

    @Override
    public boolean handles(@NonNull InputStream source, @NonNull Options options) {
        // TODO: Can we tell?
        return true;
    }

    public Resource<SVG> decode(@NonNull InputStream source, int width, int height,
                                @NonNull Options options)
            throws IOException {
        try {
            SVG svg = SVG.getFromInputStream(source);
            return new SimpleResource<>(svg);
        } catch (SVGParseException ex) {
            throw new IOException("Cannot load SVG from stream", ex);
        }
    }
}


text:
<?php

namespace SpeechKit\Speech;

use Psr\Http\Message\StreamInterface;

/**
 * @author Evgeny Soynov<saboteur@saboteur.me>
 */
interface SpeechContentInterface extends SpeechInfoInterface
{
    /**
     * @return StreamInterface
     */
    public function getStream();
}


text:
/// <reference types="node" />
import fs from 'fs';
import { Config } from '@jest/types';
import ModuleMap from './ModuleMap';
import HasteFS from './HasteFS';
export declare type IgnoreMatcher = (item: string) => boolean;
export declare type Mapper = (item: string) => Array<string> | null;
export declare type WorkerMessage = {
    computeDependencies: boolean;
    computeSha1: boolean;
    dependencyExtractor?: string;
    rootDir: string;
    filePath: string;
    hasteImplModulePath?: string;
};
export declare type WorkerMetadata = {
    dependencies: Array<string> | undefined | null;
    id: string | undefined | null;
    module: ModuleMetaData | undefined | null;
    sha1: string | undefined | null;
};
export declare type CrawlerOptions = {
    computeSha1: boolean;
    data: InternalHasteMap;
    extensions: Array<string>;
    forceNodeFilesystemAPI: boolean;
    ignore: IgnoreMatcher;
    mapper?: Mapper | null;
    rootDir: string;
    roots: Array<string>;
};
export declare type HasteImpl = {
    getHasteName(filePath: Config.Path): string | undefined;
};
export declare type FileData = Map<Config.Path, FileMetaData>;
export declare type FileMetaData = [string, number, number, 0 | 1, string, string | null | undefined];
export declare type MockData = Map<string, Config.Path>;
export declare type ModuleMapData = Map<string, ModuleMapItem>;
export declare type WatchmanClocks = Map<Config.Path, string>;
export declare type HasteRegExp = RegExp | ((str: string) => boolean);
export declare type DuplicatesSet = Map<string, /* type */ number>;
export declare type DuplicatesIndex = Map<string, Map<string, DuplicatesSet>>;
export declare type InternalHasteMap = {
    clocks: WatchmanClocks;
    duplicates: DuplicatesIndex;
    files: FileData;
    map: ModuleMapData;
    mocks: MockData;
};
export declare type HasteMap = {
    hasteFS: HasteFS;
    moduleMap: ModuleMap;
    __hasteMapForTest?: InternalHasteMap | null;
};
export declare type RawModuleMap = {
    rootDir: Config.Path;
    duplicates: DuplicatesIndex;
    map: ModuleMapData;
    mocks: MockData;
};
declare type ModuleMapItem = {
    [platform: string]: ModuleMetaData;
};
export declare type ModuleMetaData = [Config.Path, /* type */ number];
export declare type HType = {
    ID: 0;
    MTIME: 1;
    SIZE: 2;
    VISITED: 3;
    DEPENDENCIES: 4;
    SHA1: 5;
    PATH: 0;
    TYPE: 1;
    MODULE: 0;
    PACKAGE: 1;
    GENERIC_PLATFORM: 'g';
    NATIVE_PLATFORM: 'native';
    DEPENDENCY_DELIM: '\0';
};
export declare type HTypeValue = HType[keyof HType];
export declare type EventsQueue = Array<{
    filePath: Config.Path;
    stat: fs.Stats | undefined;
    type: string;
}>;
export declare type ChangeEvent = {
    eventsQueue: EventsQueue;
    hasteFS: HasteFS;
    moduleMap: ModuleMap;
};
export {};
//# sourceMappingURL=types.d.ts.map


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Dashboard extends MY_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see https://codeigniter.com/user_guide/general/urls.html
	 */

	function __construct()
	{
		parent::__construct();
		$this->load->model('ModelActivityUser');
		$this->load->model('ModelUsers');
		$this->load->module('selection');
		if(!$this->session->userdata("sessUsername")){
			redirect("login/form");
			return;
		}
	}

	public function index()
	{
		$username	= $this->session->userdata("sessUsername");
		$name		= $this->session->userdata("sessName");
		$gambar		= $this->session->userdata("sessGambar");
		$role_type	= $this->session->userdata("sessRoleType");
		$role_name	= $this->session->userdata("sessRoleName");
		$group_id	= $this->session->userdata("sessGroupID");
		// $this->ModelActivityUser->setActivityUser($username,6,4);

		$data["gambar"]		= $gambar;
		$data["name"] 		= $name;
		$data["username"] 	= $username;
		$data["role_type"]	= $role_type;
		$data["role_name"] 	= $role_name;
		$data["module"] 	= "Dashboard";
		$data["pages"]		= "dashboard";
		$this->load->view("layout/sidebar",$data);
	}

	public function front()
	{
		$username	= $this->session->userdata("sessUsername");
		$name		= $this->session->userdata("sessName");
		$gambar		= $this->session->userdata("sessGambar");
		$role_type	= $this->session->userdata("sessRoleType");
		$role_name	= $this->session->userdata("sessRoleName");
		$group_id	= $this->session->userdata("sessGroupID");
		// $this->ModelActivityUser->setActivityUser($username,6,4);

		if(!$this->session->userdata("pickGroupID")){
			$pickGroupID = NULL;
		}else{
			$pickGroupID = $this->session->userdata("pickGroupID");
		}

		// echo $pickGroupID;
		$now = date("Y-m-d");
		// $data["highlight"]	= $this->showHightlight($username,$now,$pickGroupID);
		$data["gambar"]		= $gambar;
		$data["now"] 		= $now;
		$data["pickGroupID"] = $pickGroupID;
		$data["name"] 		= $name;
		$data["username"] 	= $username;
		$data["role_type"]	= $role_type;
		$data["role_name"] 	= $role_name;
		$data["module"] 	= "Highlights";
		$data["pages"]		= "front";
		$this->load->view("layout/sidebar",$data);
	}

	function showHightlight($username,$now,$groupID = NULL){
		$highlight 	= $this->ModelUsers->getWellnessHighlight($username,$now,$groupID);
		$optGroup	= $this->selection->getOptGroup($username);

		$rateWellness = "";
		if($highlight){
			foreach($highlight as $row){
				$wellness_rate = $row->wellness_rate;
				$total_atlet_sum 	= $row->total_atlet_sum;
				$total_atlet		= $row->total_atlet;
				$total_percentage	= $row->total_percentage;
				if($wellness_rate == 0){
					$color	= "#9e9e9e";
				}else if($wellness_rate == 1){
					$color	= "#d50000";
				}else if($wellness_rate == 2){
					$color	= "#ff9800";
				}else if($wellness_rate == 3){
					$color	= "#ffff00";
				}else if($wellness_rate == 4){
					$color	= "#76ff03";
				}else if($wellness_rate == 5){
					$color	= "#1b5e20";
				}

				$rateWellness .= '

'.$total_atlet.' Atlet

'.$total_percentage.' %

				';
			}
		}

		$day = date("l", strtotime($now));
		$date = date("d M Y", strtotime($now));
		$ret = '

Wellness Highlights

'.$day.', '.$date.'

						'.$optGroup.'

						'.$rateWellness.'

		';

		echo $ret;
	}
}


text:
<?php

namespace precore\util;

use DateTime;
use PHPUnit_Framework_TestCase;
use precore\util\error\ErrorHandler;

class ToStringHelperTest extends PHPUnit_Framework_TestCase
{
    /**
     * @test
     */
    public function oneNonNullProperty()
    {
        $obj = UUID::randomUUID();
        $helper = new ToStringHelper($obj->className());
        $value = $obj->toString();
        $string = $helper
            ->add('value', $value)
            ->toString();
        self::assertEquals($obj->className() . "{value=$value}", $string);
    }

    /**
     * @test
     */
    public function omitNullValues()
    {
        $helper = new ToStringHelper(__CLASS__);
        $string = $helper
            ->add('x', null)
            ->add('y', 'hello')
            ->omitNullValues()
            ->toString();
        self::assertEquals(sprintf('%s{y=hello}', __CLASS__), $string);
    }

    /**
     *  @test
     */
    public function shouldOmitNullValuesOnlyInCaseOfMemberVariables()
    {
        $helper = new ToStringHelper(__CLASS__);
        $string = $helper
            ->add('x', null)
            ->add('y', ['notNull' => 1, 'null' => null])
            ->omitNullValues()
            ->toString();
        self::assertEquals(sprintf('%s{y=[notNull=1, null=null]}', __CLASS__), $string);
    }

    /**
     * @test
     */
    public function nullValueAppear()
    {
        $helper = new ToStringHelper(__CLASS__);
        $string = $helper
            ->add('x', null)
            ->add('y', 'hello')
            ->toString();
        self::assertEquals(sprintf('%s{x=null, y=hello}', __CLASS__), $string);
    }

    /**
     * @test
     */
    public function noFields()
    {
        $helper = new ToStringHelper(__CLASS__);
        $string = $helper->toString();
        self::assertEquals(sprintf('%s{}', __CLASS__), $string);
    }

    public function testDates()
    {
        $helper = new ToStringHelper(__CLASS__);
        $now = new DateTime();
        $result = $helper
            ->add('date', $now)
            ->toString();
        self::assertTrue(strpos($result, $now->format(DateTime::ISO8601)) !== false);
    }

    public function testStringCastError()
    {
        ErrorHandler::register();
        $helper = new ToStringHelper(__CLASS__);
        $object = new \stdClass();
        $result = $helper
            ->add('object', $object)
            ->toString();
        restore_error_handler();
        self::assertRegExp('/' . spl_object_hash($object) . '/', $result);
    }

    public function testArrayProperty()
    {
        $helper = new ToStringHelper(__CLASS__);
        $result = $helper
            ->add('fields', [1, new DateTime()])
            ->toString();
        self::assertRegExp('/fields=\[0=1, 1=/', $result);
    }

    /**
     * @test
     */
    public function shouldSupportNoKeys()
    {
        $helper = new ToStringHelper(__CLASS__);
        $string = $helper
            ->add('x', null)
            ->add(3)
            ->add(['notNull' => 1, 'null' => null])
            ->toString();
        self::assertEquals(sprintf('%s{x=null, 3, [notNull=1, null=null]}', __CLASS__), $string);
    }

    /**
     * @test
     */
    public function shouldCallToStringOnIteratorIfPossible()
    {
        $obj = new ToStringOverriddenIterator(new \EmptyIterator());
        self::assertEquals('okay', ToStringHelper::valueToString($obj));
    }
}

class ToStringOverriddenIterator extends \IteratorIterator
{
    public function __toString()
    {
        return 'okay';
    }
}


text:
# Hive Netius System
# Copyright (c) 2008-2020 Hive Solutions Lda.
#
# This file is part of Hive Netius System.
#
# Hive Netius System is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by the Apache
# Foundation, either version 2.0 of the License, or (at your option) any
# later version.
#
# Hive Netius System is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# Apache License for more details.
#
# You should have received a copy of the Apache License along with
# Hive Netius System. If not, see <http://www.apache.org/licenses/>.

__author__ = "João Magalhães <joamag@hive.pt>"
""" The author(s) of the module """

__version__ = "1.0.0"
""" The version of the module """

__revision__ = "$LastChangedRevision$"
""" The revision number of the module """

__date__ = "$LastChangedDate$"
""" The last change date of the module """

__copyright__ = "Copyright (c) 2008-2020 Hive Solutions Lda."
""" The copyright for the module """

__license__ = "Apache License, Version 2.0"
""" The license for the module """

import re
import os
import ssl
import hashlib

from . import config
from . import errors

def fingerprint(certificate, hash = "sha1"):
    digest = hashlib.new(hash, certificate)
    return digest.hexdigest()

def match_fingerprint(certificate, exp_fingerprint, hash = "sha1"):
    cert_fingerprint = fingerprint(certificate, hash = hash)
    if cert_fingerprint == exp_fingerprint: return
    if config._is_devel():
        extra = ", expected '%s' got '%s'" %\
            (exp_fingerprint, cert_fingerprint)
    else:
        extra = ""
    raise errors.SecurityError(
        "Missmatch in certificate fingerprint" + extra
    )

def match_hostname(certificate, hostname):
    if hasattr(ssl, "match_hostname"):
        return ssl.match_hostname(certificate, hostname)

    dns_names = []
    subject_alt_name = certificate.get("subjectAltName", ())

    for key, value in subject_alt_name:
        if not key == "DNS": continue
        if dnsname_match(value, hostname): return
        dns_names.append(value)

    if not dns_names:
        for subject in certificate.get("subject", ()):
            for key, value in subject:
                if not key == "commonName": continue
                if dnsname_match(value, hostname): return
                dns_names.append(value)

    if len(dns_names) > 1:
        raise errors.SecurityError(
            "Hostname %s doesn't match either of %s" %\
            (hostname, ", ".join(map(str, dns_names)))
        )
    elif len(dns_names) == 1:
        raise errors.SecurityError(
            "Hostname %s doesn't match %s" %\
            (hostname, dns_names[0])
        )
    else:
        raise errors.SecurityError(
            "No appropriate commonName or subjectAltName fields were found"
        )

def dnsname_match(domain, hostname, max_wildcards = 1):
    # creates the initial list of pats that are going to be used in
    # the final match operation for wildcard matching
    pats = []

    # in case no valid domain is passed an invalid result is returned
    # immediately indicating that no match was possible
    if not domain: return False

    # splits the provided domain value around its components, taking
    # into account the typical dot separator
    parts = domain.split(".")
    base = parts[0]
    remainder = parts[1:]

    # determines the number of wildcard characters present in the
    # base value for discovery in case this value overflow the maximum
    # number of wildcards allowed raises an error
    wildcards = base.count("*")
    if wildcards > max_wildcards: raise errors.SecurityError(
        "Too many wildcards in certificate DNS name: " + str(domain)
    )

    # in case there are no wildcards in the domain name runs the
    # "normal" hostname validation process against the domain name
    if wildcards == 0:
        return domain.lower() == hostname.lower()

    if base == "*":
        pats.append("[^.]+")
    elif base.startswith("xn--") or hostname.startswith("xn--"):
        pats.append(re.escape(base))
    else:
        pats.append(re.escape(base).replace(r"\*", "[^.]*"))

    for fragment in remainder:
        pats.append(re.escape(fragment))

    pat = re.compile(r"\A" + r"\.".join(pats) + r"\Z", re.IGNORECASE)
    return True if pat.match(hostname) else False

def dump_certificate(certificate, certificate_binary, name = None):
    # runs some pre-validation operations so that the dump parameters
    # that are required are considered valid
    if not certificate: return
    if not certificate_binary: return

    # tries to retrieve the main subject name from the subject
    # alternative names, there may be no value and if that's the
    # case a default value is used instead
    subject_alt_name = certificate.get("subjectAltName", ())
    if subject_alt_name: subject_name = subject_alt_name[0][1]
    else: subject_name = "certificate"

    # "calculates" the final name for the certificate, taking
    # into account the provided parameter and subject name, the
    # constructs the file name value with the der suffix
    name = name or subject_name
    file_name = name + ".der"

    # retrieves the proper SSL path (where data is going to be
    # stored) and creates such directory (if required)
    ssl_path = config.conf("SSL_PATH", "/tmp/ssl")
    file_path = os.path.join(ssl_path, file_name)
    if not os.path.exists(ssl_path): os.makedirs(ssl_path)

    # opens the file for writing and then dumps the certificate
    # binary information into the file, closing it afterwards
    file = open(file_path, "wb")
    try: file.write(certificate_binary)
    finally: file.close()


text:
module Twilio
  module REST
    class Api
      class V2010 < Version
        ##
        # Initialize the V2010 version of Api
        def initialize(domain)
          super
          @version = '2010-04-01'
          @accounts = nil
          @account = nil
        end

        ##
        # @param [String] sid The Account Sid that uniquely identifies the account to
        #   fetch
        # @return [Twilio::REST::Api::V2010::AccountContext] if sid was passed.
        # @return [Twilio::REST::Api::V2010::AccountList]
        def accounts(sid=:unset)
          if sid.nil?
              raise ArgumentError, 'sid cannot be nil'
          end
          if sid == :unset
              @accounts ||= AccountList.new self
          else
              AccountContext.new(self, sid)
          end
        end

        ##
        # Account provided as the authenticating account
        def account
          @account ||= AccountContext.new(self, @domain.client.account_sid)
        end

        ##
        # Setter to override the primary account
        def account=(value)
          @account = value
        end

        def addresses(sid=:unset)
          self.account.addresses(sid)
        end

        def applications(sid=:unset)
          self.account.applications(sid)
        end

        def authorized_connect_apps(connect_app_sid=:unset)
          self.account.authorized_connect_apps(connect_app_sid)
        end

        def available_phone_numbers(country_code=:unset)
          self.account.available_phone_numbers(country_code)
        end

        def balance
          self.account.balance()
        end

        def calls(sid=:unset)
          self.account.calls(sid)
        end

        def conferences(sid=:unset)
          self.account.conferences(sid)
        end

        def connect_apps(sid=:unset)
          self.account.connect_apps(sid)
        end

        def incoming_phone_numbers(sid=:unset)
          self.account.incoming_phone_numbers(sid)
        end

        def keys(sid=:unset)
          self.account.keys(sid)
        end

        def messages(sid=:unset)
          self.account.messages(sid)
        end

        def new_keys
          self.account.new_keys()
        end

        def new_signing_keys
          self.account.new_signing_keys()
        end

        def notifications(sid=:unset)
          self.account.notifications(sid)
        end

        def outgoing_caller_ids(sid=:unset)
          self.account.outgoing_caller_ids(sid)
        end

        def queues(sid=:unset)
          self.account.queues(sid)
        end

        def recordings(sid=:unset)
          self.account.recordings(sid)
        end

        def signing_keys(sid=:unset)
          self.account.signing_keys(sid)
        end

        def sip
          self.account.sip()
        end

        def short_codes(sid=:unset)
          self.account.short_codes(sid)
        end

        def tokens
          self.account.tokens()
        end

        def transcriptions(sid=:unset)
          self.account.transcriptions(sid)
        end

        def usage
          self.account.usage()
        end

        def validation_requests
          self.account.validation_requests()
        end

        ##
        # Provide a user friendly representation
        def to_s
          '<Twilio::REST::Api::V2010>'
        end
      end
    end
  end
end


text:
require 'forwardable'

module ApiVersions
  class DSL
    extend Forwardable

    VERSION_SEPARATOR = 'dot'

    class << self
      def to_version_dsl(version)
        version.to_s.gsub('.', VERSION_SEPARATOR)
      end

      def to_version_string(version)
        version.to_s.gsub(VERSION_SEPARATOR, '.')
      end

      # @see Gem::Version#bump
      def bump_minor(version)
        segments = version.segments.dup
        segments.pop while segments.any? { |s| String === s }
        segments.push 0 if segments.size == 1

        segments[-1] = segments[-1].succ
        Gem::Version.new segments.join('.')
      end
    end

    def initialize(context, &block)
      @context = context
      singleton_class.def_delegators :@context, *(@context.public_methods - public_methods)
      instance_eval(&block)
    end

    def version(version_number, &block)
      VersionCheck.default_version ||= version_number

      constraints VersionCheck.new(version: version_number) do
        # Valid module names are [0-9A-Za-z_] but ActionDispatch will camelize and remove underscores
        scope({ module: "v#{self.class.to_version_dsl(version_number)}" }, &block)
      end

      Versions.add_version(version_number) # Track the version
    end

    def inherit(options)
      Array.wrap(options[:from]).each do |block|
         @resource_cache[block].call
      end
    end

    def cache(options, &block)
      @resource_cache ||= {}
      @resource_cache[options[:as]] = block
      yield
    end
  end
end