text:
"""
Unit tests to verify proper conversion of JSON to HTML.
"""
from __future__ import division, print_function, absolute_import
from collections import OrderedDict
import unittest
from json2table.json2table import convert, JsonConverter

def _to_ordered_dict(d):
    """
    Recursively converts a dict to OrderedDict.
    This is needed to preserve `(key, value)` ordering
    with iterating through `dict`'s between Python 2 and Python 3.

    Parameters
    ----------
    d : dict
        Dictionary to order.

    Returns
    -------
    OrderedDict
        Recursively order representation of the input dictionary.
    """
    d_ordered = OrderedDict()
    for key, value in sorted(d.items()):
        if isinstance(value, dict):
            d_ordered[key] = _to_ordered_dict(value)
        elif isinstance(value, list) and (all(isinstance(item, dict) for item in value)):
            list_of_ordered_dicts = []
            for item in value:
                list_of_ordered_dicts.append(_to_ordered_dict(item))
            d_ordered[key] = list_of_ordered_dicts
        else:
            d_ordered[key] = value
    return d_ordered

class TestConvert(unittest.TestCase):
    def setUp(self):
        self.simple_json = {"key" : "value"}
        self.custom_table_attributes = {"border" : 1}
        nested_json = {
        "menu": {
        "id": "file",
        "value": "File",
        "menuitem": [{"value": "New", "onclick": "CreateNewDoc()"},
                     {"value": "Open", "onclick": "OpenDoc()"},
                     {"value": "Close", "onclick": "CloseDoc()"}]
        }}
        self.nested_json = _to_ordered_dict(nested_json)
        self.maxDiff = None

    def test_invalid_build_direction(self):
        with self.assertRaises(ValueError) as context:
            convert(None, build_direction=None)
            self.assertTrue("Invalid build direction" in context.exception)

    def test_invalid_table_attributes(self):
        with self.assertRaises(TypeError) as context:
            convert(None, table_attributes=0)
            self.assertTrue("Table attributes must be either" in context.exception)

    def test_invalid_json(self):
        with self.assertRaises(AttributeError) as context:
            convert(None)

    def test_simple(self):
        result = convert(self.simple_json)
        simple_table = "

key	value

"
        self.assertEqual(result, simple_table)

    def test_custom_table_attributes(self):
        result = convert({}, table_attributes=self.custom_table_attributes)
        self.assertTrue("border=\"1\"" in result)

    def test_build_direction_top_to_bottom(self):
        result = convert(self.simple_json, build_direction="TOP_TO_BOTTOM")
        simple_table = "

key

value

"
        self.assertEqual(result, simple_table)

    def test_clubbed_json(self):
        clubbed_json = _to_ordered_dict({"sample": [ {"a":1, "b":2, "c":3}, {"a":5, "b":6, "c":7} ] })
        result = convert(clubbed_json)
        clubbed_table = "

sample

a	b	c
<"\
                        "tr>1	2	3

5	6	7
"\
                        "

"
        self.assertEqual(result, clubbed_table)

    def test_nested_left_to_right(self):
        result = convert(self.nested_json, build_direction="LEFT_TO_RIGHT")
        nested_table = "

menu

id	file

me"\
                       "nuitem

onclick	value

CreateNew"\
                       "Doc()	New

OpenDoc()	Open

Clo"\
                       "seDoc()	Close

value	File</t"\
                       "d>

"
        self.assertEqual(result, nested_table)

    def test_nested_top_to_bottom(self):
        result = convert(self.nested_json, build_direction="TOP_TO_BOTTOM")
        nested_table = "

menu

id	menuitem	<t"\
                       "h>value

file

onclick	value

CreateNewDoc()	New

OpenDoc()	Op"\
                       "en

CloseDoc()	Close

	File</t"\
                       "d>

"
        self.assertEqual(result, nested_table)

class TestJsonConverter(unittest.TestCase):
    def setUp(self):
        self.json_converter = JsonConverter()

    def test_empty_list_of_dicts_to_column_headers(self):
        result = self.json_converter._list_of_dicts_to_column_headers([])
        self.assertIs(result, None)

    def test_short_list_of_dicts_to_column_headers(self):
        result = self.json_converter._list_of_dicts_to_column_headers([{"key" : "value"}])
        self.assertIs(result, None)

    def test_noncollapsible_list_of_dicts_to_column_headers(self):
        result = self.json_converter._list_of_dicts_to_column_headers([{"key" : "value"}, {"value" : "key"}])
        self.assertIs(result, None)

    def test_none_markup(self):
        result = self.json_converter._markup(None)
        self.assertEqual(result, "")

    def test_list_markup(self):
        result = self.json_converter._markup([1, 2, 3])
        self.assertEqual(result, "

1

2

3

")

    def test_uncommon_headers_maybe_club(self):
        result = self.json_converter._maybe_club([None])
        self.assertEqual(result, "

	")

if __name__ == "__main__":
    unittest.main()


text:
var config = {
  // Your NUSSTU ID, such as a0012345
  student_id: prompt('Your NUSSTU ID, such as a0012345'),
  // Module you are claiming hours for, such as CS1101S
  module: 'CS1010S',
  // Format: YYYY/MM/DD
  // Note: Month is from 0-11, Date is from 1-31
  // This should be the semester's week 1. For AY14/15 Sem 1, it's Monday, Aug 12
  first_day_of_sem: new Date(2015, 0, 12),
  // In case you want to customize the duties field for each activity
  // Do not modify the keys
  duties: {
    'Assignment Marking': 'Graded students\' assignments',
    'Course Material Preparation': 'Prepared course materials',
    'Tutorial': 'Conducted tutorial'
  },

  // The following function should return a list of claim objects that you want to make
  activities_list_fn: function () {
    var activities_list = [];

    // Course prep: 18 (+4) hours
    // 1 class tutors to remove this first loop
    for(var week = 1; week <= 4; week++) {
      activities_list.push({
        activity_type: Claim.COURSE_MATERIAL_PREPARATION,
        week: week,
        day: 'SATURDAY',
        start_time: '1600',
        end_time: '1700'
      })
    }
    for (var week = 1; week <= 12; week++) {
      activities_list.push({
        activity_type: Claim.COURSE_MATERIAL_PREPARATION,
        week: week,
        day: 'SATURDAY',
        start_time: '1730',
        end_time: '1800'
      });
    }
    for (var week = 1; week <= 12; week++) {
      activities_list.push({
        activity_type: Claim.COURSE_MATERIAL_PREPARATION,
        week: week,
        day: 'MONDAY',
        start_time: '1100',
        end_time: '1200'
      });
    }
    // 1-class tutors to reduce to 1hr
    for (var week = 1; week <= 12; week++) {
      activities_list.push({
        activity_type: Claim.ASSIGNMENT_MARKING,
        week: week,
        day: 'SATURDAY',
        start_time: '1600',
        end_time: '1800'
      });
    }

    // Weekly stuff (Fill in your tutorial timeslots)
    for (var week = 3; week <= 13; week++) {
      if(week === 7) { // no tutorial for week 7
        continue
      }
      activities_list.push({
        activity_type: Claim.TUTORIAL,
        week: week,
        day: 'MONDAY',
        start_time: '1600',
        end_time: '1700'
      });
      activities_list.push({
        activity_type: Claim.TUTORIAL,
        week: week,
        day: 'TUESDAY',
        start_time: '1700',
        end_time: '1800'
      });
    }

    return activities_list;
  }
};

// ***********************************************************
// DO NOT CHANGE THE BOTTOM UNLESS YOU KNOW WHAT YOU ARE DOING
// ***********************************************************

var core_script = 'https://nusmodifications.github.io/nus-scripts/claims/claim.js';
var c = undefined;
$.getScript(core_script)
  .done(function () {
    c = new Claim(config);
  })
  .fail(function (jqxhr, settings, exception) {
    console.warn('Error loading script');
    console.warn(jqxhr);
    console.warn(exception);
  });
// c.makeAllClaims();

redpajama_set_name: RedPajamaGithub


text:
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using System;
using System.Collections.Immutable;
using System.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Editor.Xaml.Diagnostics;
using Microsoft.CodeAnalysis.RemoveUnnecessaryImports;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.VisualStudio.LanguageServices.Xaml;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.Editor.Xaml.CodeFixes.RemoveUnusedUsings
{
    [ExportCodeFixProvider(StringConstants.XamlLanguageName, Name = PredefinedCodeFixProviderNames.RemoveUnnecessaryImports), Shared]
    [ExtensionOrder(After = PredefinedCodeFixProviderNames.AddMissingReference)]
#pragma warning disable RS1016 // Code fix providers should provide FixAll support. https://github.com/dotnet/roslyn/issues/23528
    internal class RemoveUnnecessaryUsingsCodeFixProvider : CodeFixProvider
#pragma warning restore RS1016 // Code fix providers should provide FixAll support.
    {
        public sealed override ImmutableArray<string> FixableDiagnosticIds
        {
            get { return ImmutableArray.Create(XamlDiagnosticIds.UnnecessaryNamespacesId); }
        }

        public sealed override Task RegisterCodeFixesAsync(CodeFixContext context)
        {
            context.RegisterCodeFix(
                new MyCodeAction(
                    c => RemoveUnnecessaryImportsAsync(context.Document, c)),
                context.Diagnostics);
            return Task.CompletedTask;
        }

        private Task<Document> RemoveUnnecessaryImportsAsync(
            Document document, CancellationToken cancellationToken)
        {
            var service = document.GetLanguageService<IRemoveUnnecessaryImportsService>();
            return service.RemoveUnnecessaryImportsAsync(document, cancellationToken);
        }

        private class MyCodeAction : CodeAction.DocumentChangeAction
        {
            public MyCodeAction(Func<CancellationToken, Task<Document>> createChangedDocument) :
                base(Resources.RemoveUnnecessaryNamespaces, createChangedDocument)
            {
            }
        }
    }
}


text:
namespace RegulatedNoise.TestTab
{
    partial class TestTab
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Component Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
			this.tbCustomEddnMessage = new System.Windows.Forms.TextBox();
			this.btSendCustomEddnMessage = new System.Windows.Forms.Button();
			this.tbFakeOCRResult = new System.Windows.Forms.TextBox();
			this.btSendFakeOCRResult = new System.Windows.Forms.Button();
			this.lbCommoditiesLog = new System.Windows.Forms.ListBox();
			this.btImportfromTd = new System.Windows.Forms.Button();
			this.tbFinderRequest = new System.Windows.Forms.TextBox();
			this.tbFinderResult = new System.Windows.Forms.TextBox();
			this.btFindSystem = new System.Windows.Forms.Button();
			this.btFindStation = new System.Windows.Forms.Button();
			this.btFindMarketData = new System.Windows.Forms.Button();
			this.SuspendLayout();
			//
			// tbCustomEddnMessage
			//
			this.tbCustomEddnMessage.Location = new System.Drawing.Point(15, 15);
			this.tbCustomEddnMessage.Margin = new System.Windows.Forms.Padding(2);
			this.tbCustomEddnMessage.Multiline = true;
			this.tbCustomEddnMessage.Name = "tbCustomEddnMessage";
			this.tbCustomEddnMessage.Size = new System.Drawing.Size(493, 112);
			this.tbCustomEddnMessage.TabIndex = 0;
			//
			// btSendCustomEddnMessage
			//
			this.btSendCustomEddnMessage.Location = new System.Drawing.Point(511, 15);
			this.btSendCustomEddnMessage.Margin = new System.Windows.Forms.Padding(2);
			this.btSendCustomEddnMessage.Name = "btSendCustomEddnMessage";
			this.btSendCustomEddnMessage.Size = new System.Drawing.Size(133, 29);
			this.btSendCustomEddnMessage.TabIndex = 1;
			this.btSendCustomEddnMessage.Text = "Send Message to UI";
			this.btSendCustomEddnMessage.UseVisualStyleBackColor = true;
			this.btSendCustomEddnMessage.Click += new System.EventHandler(this.btSendCustomEddnMessage_Click);
			//
			// tbFakeOCRResult
			//
			this.tbFakeOCRResult.Location = new System.Drawing.Point(15, 141);
			this.tbFakeOCRResult.Margin = new System.Windows.Forms.Padding(2);
			this.tbFakeOCRResult.Multiline = true;
			this.tbFakeOCRResult.Name = "tbFakeOCRResult";
			this.tbFakeOCRResult.Size = new System.Drawing.Size(493, 75);
			this.tbFakeOCRResult.TabIndex = 0;
			this.tbFakeOCRResult.Text = "System;Station;Commodity;Sell;Buy;Demand;;Supply;;Date;";
			//
			// btSendFakeOCRResult
			//
			this.btSendFakeOCRResult.Location = new System.Drawing.Point(511, 141);
			this.btSendFakeOCRResult.Margin = new System.Windows.Forms.Padding(2);
			this.btSendFakeOCRResult.Name = "btSendFakeOCRResult";
			this.btSendFakeOCRResult.Size = new System.Drawing.Size(133, 26);
			this.btSendFakeOCRResult.TabIndex = 1;
			this.btSendFakeOCRResult.Text = "Send OCR to UI";
			this.btSendFakeOCRResult.UseVisualStyleBackColor = true;
			this.btSendFakeOCRResult.Click += new System.EventHandler(this.btSendFakeOCRResult_Click);
			//
			// lbCommoditiesLog
			//
			this.lbCommoditiesLog.FormattingEnabled = true;
			this.lbCommoditiesLog.Location = new System.Drawing.Point(15, 227);
			this.lbCommoditiesLog.Margin = new System.Windows.Forms.Padding(2);
			this.lbCommoditiesLog.Name = "lbCommoditiesLog";
			this.lbCommoditiesLog.Size = new System.Drawing.Size(493, 121);
			this.lbCommoditiesLog.TabIndex = 2;
			//
			// btImportfromTd
			//
			this.btImportfromTd.Location = new System.Drawing.Point(514, 227);
			this.btImportfromTd.Name = "btImportfromTd";
			this.btImportfromTd.Size = new System.Drawing.Size(130, 23);
			this.btImportfromTd.TabIndex = 3;
			this.btImportfromTd.Text = "Import Prices from TD";
			this.btImportfromTd.UseVisualStyleBackColor = true;
			this.btImportfromTd.Click += new System.EventHandler(this.btImportfromTd_Click);
			//
			// tbFinderRequest
			//
			this.tbFinderRequest.Location = new System.Drawing.Point(15, 365);
			this.tbFinderRequest.Name = "tbFinderRequest";
			this.tbFinderRequest.Size = new System.Drawing.Size(219, 20);
			this.tbFinderRequest.TabIndex = 4;
			//
			// tbFinderResult
			//
			this.tbFinderResult.Location = new System.Drawing.Point(15, 392);
			this.tbFinderResult.Multiline = true;
			this.tbFinderResult.Name = "tbFinderResult";
			this.tbFinderResult.Size = new System.Drawing.Size(493, 77);
			this.tbFinderResult.TabIndex = 5;
			//
			// btFindSystem
			//
			this.btFindSystem.Location = new System.Drawing.Point(241, 363);
			this.btFindSystem.Name = "btFindSystem";
			this.btFindSystem.Size = new System.Drawing.Size(36, 23);
			this.btFindSystem.TabIndex = 6;
			this.btFindSystem.Text = "Sys.";
			this.btFindSystem.UseVisualStyleBackColor = true;
			this.btFindSystem.Click += new System.EventHandler(this.btFindSystem_Click);
			//
			// btFindStation
			//
			this.btFindStation.Location = new System.Drawing.Point(283, 363);
			this.btFindStation.Name = "btFindStation";
			this.btFindStation.Size = new System.Drawing.Size(34, 23);
			this.btFindStation.TabIndex = 7;
			this.btFindStation.Text = "Sta";
			this.btFindStation.UseVisualStyleBackColor = true;
			this.btFindStation.Click += new System.EventHandler(this.btFindStation_Click);
			//
			// btFindMarketData
			//
			this.btFindMarketData.Location = new System.Drawing.Point(324, 363);
			this.btFindMarketData.Name = "btFindMarketData";
			this.btFindMarketData.Size = new System.Drawing.Size(36, 23);
			this.btFindMarketData.TabIndex = 8;
			this.btFindMarketData.Text = "MD";
			this.btFindMarketData.UseVisualStyleBackColor = true;
			this.btFindMarketData.Click += new System.EventHandler(this.btFindMarketData_Click);
			//
			// TestTab
			//
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.Controls.Add(this.btFindMarketData);
			this.Controls.Add(this.btFindStation);
			this.Controls.Add(this.btFindSystem);
			this.Controls.Add(this.tbFinderResult);
			this.Controls.Add(this.tbFinderRequest);
			this.Controls.Add(this.btImportfromTd);
			this.Controls.Add(this.lbCommoditiesLog);
			this.Controls.Add(this.btSendFakeOCRResult);
			this.Controls.Add(this.tbFakeOCRResult);
			this.Controls.Add(this.btSendCustomEddnMessage);
			this.Controls.Add(this.tbCustomEddnMessage);
			this.Margin = new System.Windows.Forms.Padding(2);
			this.Name = "TestTab";
			this.Size = new System.Drawing.Size(749, 491);
			this.ResumeLayout(false);
			this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.TextBox tbCustomEddnMessage;
        private System.Windows.Forms.Button btSendCustomEddnMessage;
        private System.Windows.Forms.TextBox tbFakeOCRResult;
        private System.Windows.Forms.Button btSendFakeOCRResult;
        private System.Windows.Forms.ListBox lbCommoditiesLog;
		  private System.Windows.Forms.Button btImportfromTd;
		  private System.Windows.Forms.TextBox tbFinderRequest;
		  private System.Windows.Forms.TextBox tbFinderResult;
		  private System.Windows.Forms.Button btFindSystem;
		  private System.Windows.Forms.Button btFindStation;
		  private System.Windows.Forms.Button btFindMarketData;
    }
}


text:
var React = require('react');
var ReactNative = require('react-native');

var {
  AppRegistry,
  StyleSheet,
  View,
  TouchableOpacity,
  Text
} = ReactNative;

var Spinner = require('react-native-spinkit');

var Example = React.createClass({

  getInitialState() {
    return {
      index: 0,
      types: ['CircleFlip', 'Bounce', 'Wave', 'WanderingCubes', 'Pulse', 'ChasingDots', 'ThreeBounce', 'Circle', '9CubeGrid', 'WordPress', 'FadingCircle', 'FadingCircleAlt', 'Arc', 'ArcAlt'],
      size: 100,
      color: "#FFFFFF",
      isVisible: true
    }
  },

  next() {
    if (this.state.index++ >= this.state.types.length)
      this.setState({index: 0})
    else
      this.setState({index: this.state.index++})
  },

  increaseSize() {
    this.setState({size: this.state.size + 10});
  },

  changeColor() {
    this.setState({color: '#'+Math.floor(Math.random()*16777215).toString(16)});
  },

  changeVisibility() {
    this.setState({isVisible: !this.state.isVisible});
  },

  render() {
    var type = this.state.types[this.state.index];

    return (
      <View style={styles.container}>
        <Spinner style={styles.spinner} isVisible={this.state.isVisible} size={this.state.size} type={type} color={this.state.color}/>

        <Text style={styles.text}>Type: {type}</Text>

        <TouchableOpacity style={styles.btn} onPress={this.next}>
          <Text style={styles.text}>Next</Text>
        </TouchableOpacity>

        <TouchableOpacity style={styles.btn} onPress={this.increaseSize}>
          <Text style={styles.text}>Increase size</Text>
        </TouchableOpacity>

        <TouchableOpacity style={styles.btn} onPress={this.changeColor}>
          <Text style={styles.text}>Change color</Text>
        </TouchableOpacity>

        <TouchableOpacity style={styles.btn} onPress={this.changeVisibility}>
          <Text style={styles.text}>Change visibility</Text>
        </TouchableOpacity>
      </View>
    );
  }

});

var styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#d35400',
  },

  spinner: {
    marginBottom: 50
  },

  btn: {
    marginTop: 20
  },

  text: {
    color: "white"
  }
});

AppRegistry.registerComponent('Example', () => Example);


text:
.class public Lcom/android/server/coverage/CoverageService;
.super Landroid/os/Binder;
.source "CoverageService.java"

# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/android/server/coverage/CoverageService$CoverageCommand;
    }
.end annotation

# static fields
.field public static final COVERAGE_SERVICE:Ljava/lang/String; = "coverage"

.field public static final ENABLED:Z

# direct methods
.method static constructor <clinit>()V
    .locals 3

    const/4 v1, 0x1

    :try_start_0
    const-string/jumbo v2, "org.jacoco.agent.rt.RT"

    invoke-static {v2}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;
    :try_end_0
    .catch Ljava/lang/ClassNotFoundException; {:try_start_0 .. :try_end_0} :catch_0

    :goto_0
    sput-boolean v1, Lcom/android/server/coverage/CoverageService;->ENABLED:Z

    return-void

    :catch_0
    move-exception v0

    const/4 v1, 0x0

    goto :goto_0
.end method

.method public constructor <init>()V
    .locals 0

    invoke-direct {p0}, Landroid/os/Binder;-><init>()V

    return-void
.end method

# virtual methods
.method public onShellCommand(Ljava/io/FileDescriptor;Ljava/io/FileDescriptor;Ljava/io/FileDescriptor;[Ljava/lang/String;Landroid/os/ShellCallback;Landroid/os/ResultReceiver;)V
    .locals 8

    new-instance v0, Lcom/android/server/coverage/CoverageService$CoverageCommand;

    const/4 v1, 0x0

    invoke-direct {v0, v1}, Lcom/android/server/coverage/CoverageService$CoverageCommand;-><init>(Lcom/android/server/coverage/CoverageService$CoverageCommand;)V

    move-object v1, p0

    move-object v2, p1

    move-object v3, p2

    move-object v4, p3

    move-object v5, p4

    move-object v6, p5

    move-object v7, p6

    invoke-virtual/range {v0 .. v7}, Lcom/android/server/coverage/CoverageService$CoverageCommand;->exec(Landroid/os/Binder;Ljava/io/FileDescriptor;Ljava/io/FileDescriptor;Ljava/io/FileDescriptor;[Ljava/lang/String;Landroid/os/ShellCallback;Landroid/os/ResultReceiver;)I

    return-void
.end method


text:
using System;
using System.Collections.Generic;

namespace BPMNET.EntityCore
{
    public class BpmnDefinition : IAuditTrail, IBaseElement
    {
        public BpmnDefinition()
        {
            Key = Guid.NewGuid();
            ItemDefinitions = new List<BpmnItemDefinition>();
        }
        public Guid Key { get; set; }
        public Guid DeploymentId { get; set; }
        public string Id { get; set; }
        public string Name { get; set; }
        public string DefinitionKey { get; set; }
        public string XmlData { get; set; }
        public string ProcessDefinitionDescription { get; set; }
        public string ProcessDefinitionResource { get; set; }
        public string ProcessDefinitionDiagramResourceName { get; set; }
        public bool ProcessDefinitionHasStartFormKey { get; set; }
        public bool ProcessDefinitionHasGraphicalNotation { get; set; }
        public bool IsSuspended { get; set; }
        public string TenantId { get; set; }
        public DateTime Inserted { get; set; }
        public DateTime LastUpdated { get; set; }
        public byte[] Timestamp { get; set; }

        public ICollection<BpmnItemDefinition> ItemDefinitions { get; set; }

        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hash = (Key != null) ? Key.GetHashCode() : 0;
                // Suitable nullity checks etc, of course :)
                hash = (DeploymentId != null) ? hash * 17 + DeploymentId.GetHashCode() : hash;
                hash = (Name != null) ? hash * 17 + Name.GetHashCode() : hash;
                hash = (DefinitionKey != null) ? hash * 17 + DefinitionKey.GetHashCode() : hash;
                hash = (ProcessDefinitionDescription != null) ? hash * 17 + ProcessDefinitionDescription.GetHashCode() : hash;
                hash = (ProcessDefinitionResource != null) ? hash * 17 + ProcessDefinitionResource.GetHashCode() : hash;
                hash = (ProcessDefinitionDiagramResourceName != null) ? hash * 17 + ProcessDefinitionDiagramResourceName.GetHashCode() : hash;
                hash = hash * 17 + ProcessDefinitionHasStartFormKey.GetHashCode();
                hash = hash * 17 + ProcessDefinitionHasGraphicalNotation.GetHashCode();
                hash = hash * 17 + IsSuspended.GetHashCode();
                hash = (TenantId != null) ? hash * 17 + TenantId.GetHashCode() : hash;
                return hash;
            }
        }
        public override bool Equals(object obj)
        {
            return Equals(obj as BpmnDefinition);
        }
        public bool Equals(BpmnDefinition other)
        {
            // Check for null
            if (ReferenceEquals(other, null))
                return false;

            // Check for same reference
            if (ReferenceEquals(this, other))
                return true;

            // Not Check DeploymentId, because generated Guid

            // Check for same value
            return ((DeploymentId == null && other.DeploymentId == null) || (DeploymentId != null && other.DeploymentId != null && DeploymentId.Equals(other.DeploymentId))) &&
                ((Name == null && other.Name == null) || (Name != null && other.Name != null && Name.Equals(other.Name))) &&
                ((DefinitionKey == null && other.DefinitionKey == null) || (DefinitionKey != null && other.DefinitionKey != null && DefinitionKey.Equals(other.DefinitionKey))) &&
                ((ProcessDefinitionDescription == null && other.ProcessDefinitionDescription == null) || (ProcessDefinitionDescription != null && other.ProcessDefinitionDescription != null && ProcessDefinitionDescription.Equals(other.ProcessDefinitionDescription))) &&
                ((ProcessDefinitionDiagramResourceName == null && other.ProcessDefinitionDiagramResourceName == null) || (ProcessDefinitionDiagramResourceName != null && other.ProcessDefinitionDiagramResourceName != null && ProcessDefinitionDiagramResourceName.Equals(other.ProcessDefinitionDiagramResourceName))) &&
                (ProcessDefinitionHasStartFormKey.Equals(other.ProcessDefinitionHasStartFormKey)) &&
                (ProcessDefinitionHasGraphicalNotation.Equals(other.ProcessDefinitionHasGraphicalNotation)) &&
                (IsSuspended.Equals(other.IsSuspended)) &&
                ((TenantId == null && other.TenantId == null) || (TenantId != null && other.TenantId != null && TenantId.Equals(other.TenantId)));
        }
    }
}


text:
package gov.hhs.fha.nhinc.admindistribution.passthru.proxy;

import oasis.names.tc.emergency.edxl.de._1.EDXLDistribution;
import gov.hhs.fha.nhinc.common.nhinccommon.AssertionType;
import gov.hhs.fha.nhinc.common.nhinccommon.NhinTargetSystemType;
import gov.hhs.fha.nhinc.nhinclib.NhincConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 *
 * @author dunnek
 */
public class PassthruAdminDistributionProxyNoOpImpl {
    private Log log = null;

    public PassthruAdminDistributionProxyNoOpImpl() {
        log = createLogger();
    }

    protected Log createLogger() {
        return LogFactory.getLog(getClass());
    }

    public void sendAlertMessage(EDXLDistribution body, AssertionType assertion, NhinTargetSystemType target,
            NhincConstants.GATEWAY_API_LEVEL apiLevel) {
        log.info("begin sendAlert");
    }
}


text:
KDB ?= kdb

application:../src/application.c genelektra.c
	gcc ../src/application.c genelektra.c -std=c99 `pkg-config --cflags --libs elektra-codegen` -I. -o application -Wl,-rpath `pkg-config --variable=libdir elektra-codegen`

genelektra.c:../spec.ini
	$(KDB) gen -F ni=../spec.ini highlevel spec:/sw/example/econf/#0/current genelektra

clean:
	rm -f genelektra.c
	rm -f genelektra.h
	rm -f genelektra.mount.sh
	rm -f application


text:
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="deneb">
    <meta name="author" content="deneb">

    <title>dendenebneb</title>

    <link href="../uciband-v5/dist/css/bootstrap.min.css" rel="stylesheet">

    <link href="../uciband-v5/dist/css/custom.css" rel="stylesheet">

    <link href="font-awesome-4.6.3/css/font-awesome.min.css" rel="stylesheet" type="text/css">

    <link href="http://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css">

          <button class="navbar-toggler hidden-sm-up" type="button" data-toggle="collapse" data-target="#exCollapsingNavbar2">
            ☰
          </button>

                News(current)

                About

                  Media

                Calendar

                FAQ

                Connect(current)

Loading...

© 2016 UCI Anteater Band |


text:
import collections

from django.utils.translation import ugettext_lazy as _
import horizon.exceptions
import horizon.tables
import horizon.tabs
from horizon.utils import memoized
import horizon.workflows

from watcher_dashboard.api import watcher
from watcher_dashboard.content.actions import tables
from watcher_dashboard.content.actions import tabs as wtabs

class IndexView(horizon.tables.DataTableView):
    table_class = tables.ActionsTable
    template_name = 'infra_optim/actions/index.html'
    page_title = _("Actions")

    def get_context_data(self, **kwargs):
        context = super(IndexView, self).get_context_data(**kwargs)
        context['audits_count'] = self.get_actions_count()
        return context

    def get_data(self):
        actions = []
        search_opts = self.get_filters()
        try:
            actions = watcher.Action.list(self.request, **search_opts)
        except Exception:
            horizon.exceptions.handle(
                self.request,
                _("Unable to retrieve action information."))
        return actions

    def get_actions_count(self):
        return len(self.get_data())

    def get_filters(self):
        filters = {}
        filter_action = self.table._meta._filter_action
        if filter_action:
            filter_field = self.table.get_filter_field()
            if filter_action.is_api_filter(filter_field):
                filter_string = self.table.get_filter_string()
                if filter_field and filter_string:
                    filters[filter_field] = filter_string
        return filters

class DetailView(horizon.tables.MultiTableView):
    table_classes = [tables.ActionParametersTable]
    tab_group_class = wtabs.ActionDetailTabs
    template_name = 'infra_optim/actions/details.html'
    redirect_url = 'horizon:admin:actions:index'
    page_title = _("Action Details: {{ action.uuid }}")

    @memoized.memoized_method
    def _get_data(self):
        action_uuid = None
        try:
            action_uuid = self.kwargs['action_uuid']
            action = watcher.Action.get(self.request, action_uuid)
        except Exception:
            msg = _('Unable to retrieve details for action "%s".') \
                % action_uuid
            horizon.exceptions.handle(
                self.request, msg,
                redirect=self.redirect_url)
        return action

    def get_parameters_data(self):
        action = self._get_data()
        parameter_cls = collections.namedtuple(
            'Parameter', field_names=['name', 'value'])

        return [parameter_cls(name=name, value=value)
                for name, value in action.input_parameters.items()]

    def get_context_data(self, **kwargs):
        context = super(DetailView, self).get_context_data(**kwargs)
        action = self._get_data()
        context["action"] = action
        return context

    def get_tabs(self, request, *args, **kwargs):
        action = self._get_data()
        # ports = self._get_ports()
        return self.tab_group_class(request, action=action,
                                    # ports=ports,
                                    **kwargs)


text:
package org.jbpm.remote.ejb.test.process;

import java.util.List;

import org.assertj.core.api.Assertions;

import org.jbpm.remote.ejb.test.ProcessDefinitions;
import org.jbpm.remote.ejb.test.RemoteEjbTest;
import org.jbpm.services.api.model.ProcessInstanceDesc;
import org.junit.Test;

import org.kie.api.runtime.process.ProcessInstance;

public class ESignalProcessInstanceTest extends RemoteEjbTest {

    @Test()
    public void testSignalProcessInstance() {
        long processInstanceId1 = ejb.startProcessSimple(ProcessDefinitions.SIGNAL);
        long processInstanceId2 = ejb.startProcessSimple(ProcessDefinitions.SIGNAL);

        List<String> signals = ejb.getAvailableSignals(processInstanceId1);
        Assertions.assertThat(signals).isNotNull();
        Assertions.assertThat(signals.size()).isEqualTo(1);
        Assertions.assertThat(signals.get(0)).isEqualTo("MySignal");

        ejb.signalProcessInstance(processInstanceId1, "MySignal", "Hello World!!");

        ProcessInstanceDesc log = ejb.getProcessInstanceById(processInstanceId1);
        Assertions.assertThat(log).isNotNull();
        Assertions.assertThat(log.getState().intValue()).isEqualTo(ProcessInstance.STATE_COMPLETED);

        log = ejb.getProcessInstanceById(processInstanceId2);
        Assertions.assertThat(log).isNotNull();
        Assertions.assertThat(log.getState().intValue()).isEqualTo(ProcessInstance.STATE_ACTIVE);

        ejb.signalProcessInstance(processInstanceId2, "MySignal", "Hello World!!");
        log = ejb.getProcessInstanceById(processInstanceId2);
        Assertions.assertThat(log).isNotNull();
        Assertions.assertThat(log.getState().intValue()).isEqualTo(ProcessInstance.STATE_COMPLETED);
    }

}


text:
.class public Lcom/fingerprints/service/FingerprintManager$GuidedRejectReasons;
.super Ljava/lang/Object;
.source "FingerprintManager.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/fingerprints/service/FingerprintManager;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x1
    name = "GuidedRejectReasons"
.end annotation

# instance fields
.field public guidedLowCoverage:Z

.field public guidedLowQuality:Z

.field final synthetic this$0:Lcom/fingerprints/service/FingerprintManager;

# direct methods
.method public constructor <init>(Lcom/fingerprints/service/FingerprintManager;ZZ)V
    .locals 0
    .param p2, "guidedLowCoverage"    # Z
    .param p3, "guidedLowQuality"    # Z

    .prologue
    .line 230
    iput-object p1, p0, Lcom/fingerprints/service/FingerprintManager$GuidedRejectReasons;->this$0:Lcom/fingerprints/service/FingerprintManager;

    .line 229
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 231
    iput-boolean p2, p0, Lcom/fingerprints/service/FingerprintManager$GuidedRejectReasons;->guidedLowCoverage:Z

    .line 232
    iput-boolean p3, p0, Lcom/fingerprints/service/FingerprintManager$GuidedRejectReasons;->guidedLowQuality:Z

    .line 233
    return-void
.end method


text:
/*
 * Minio Cloud Storage, (C) 2016 Minio, 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.
 */

package cmd

import (
	"errors"
	"fmt"

	"github.com/minio/minio/pkg/wildcard"
)

// SQS type.
const (
	// Minio sqs ARN prefix.
	minioSqs = "arn:minio:sqs:"

	// Static string indicating queue type 'amqp'.
	queueTypeAMQP = "amqp"
	// Static string indicating queue type 'mqtt'.
	queueTypeMQTT = "mqtt"
	// Static string indicating queue type 'nats'.
	queueTypeNATS = "nats"
	// Static string indicating queue type 'elasticsearch'.
	queueTypeElastic = "elasticsearch"
	// Static string indicating queue type 'redis'.
	queueTypeRedis = "redis"
	// Static string indicating queue type 'postgresql'.
	queueTypePostgreSQL = "postgresql"
	// Static string indicating queue type 'mysql'.
	queueTypeMySQL = "mysql"
	// Static string indicating queue type 'kafka'.
	queueTypeKafka = "kafka"
	// Static string for Webhooks
	queueTypeWebhook = "webhook"

	// Notifier format value constants
	formatNamespace = "namespace"
	formatAccess    = "access"
)

// Topic type.
const (
	// Minio topic ARN prefix.
	minioTopic = "arn:minio:sns:"

	// Static string indicating sns type 'listen'.
	snsTypeMinio = "listen"
)

var errNotifyNotEnabled = errors.New("requested notifier not enabled")

// Returns true if queueArn is for an AMQP queue.
func isAMQPQueue(sqsArn arnSQS) bool {
	if sqsArn.Type != queueTypeAMQP {
		return false
	}
	amqpL := globalServerConfig.Notify.GetAMQPByID(sqsArn.AccountID)
	if !amqpL.Enable {
		return false
	}
	// Connect to amqp server to validate.
	amqpC, err := dialAMQP(amqpL)
	if err != nil {
		errorIf(err, "Unable to connect to amqp service. %#v", amqpL)
		return false
	}
	defer amqpC.conn.Close()
	return true
}

// Returns true if mqttARN is for an MQTT queue.
func isMQTTQueue(sqsArn arnSQS) bool {
	if sqsArn.Type != queueTypeMQTT {
		return false
	}
	mqttL := globalServerConfig.Notify.GetMQTTByID(sqsArn.AccountID)
	if !mqttL.Enable {
		return false
	}
	// Connect to mqtt server to validate.
	mqttC, err := dialMQTT(mqttL)
	if err != nil {
		errorIf(err, "Unable to connect to mqtt service. %#v", mqttL)
		return false
	}
	defer mqttC.Client.Disconnect(250)
	return true
}

// Returns true if natsArn is for an NATS queue.
func isNATSQueue(sqsArn arnSQS) bool {
	if sqsArn.Type != queueTypeNATS {
		return false
	}
	natsL := globalServerConfig.Notify.GetNATSByID(sqsArn.AccountID)
	if !natsL.Enable {
		return false
	}
	// Connect to nats server to validate.
	natsC, err := dialNATS(natsL, true)
	if err != nil {
		errorIf(err, "Unable to connect to nats service. %#v", natsL)
		return false
	}
	closeNATS(natsC)
	return true
}

// Returns true if queueArn is for an Webhook queue
func isWebhookQueue(sqsArn arnSQS) bool {
	if sqsArn.Type != queueTypeWebhook {
		return false
	}
	rNotify := globalServerConfig.Notify.GetWebhookByID(sqsArn.AccountID)
	return rNotify.Enable
}

// Returns true if queueArn is for an Redis queue.
func isRedisQueue(sqsArn arnSQS) bool {
	if sqsArn.Type != queueTypeRedis {
		return false
	}
	rNotify := globalServerConfig.Notify.GetRedisByID(sqsArn.AccountID)
	if !rNotify.Enable {
		return false
	}
	// Connect to redis server to validate.
	rPool, err := dialRedis(rNotify)
	if err != nil {
		errorIf(err, "Unable to connect to redis service. %#v", rNotify)
		return false
	}
	defer rPool.Close()
	return true
}

// Returns true if queueArn is for an ElasticSearch queue.
func isElasticQueue(sqsArn arnSQS) bool {
	if sqsArn.Type != queueTypeElastic {
		return false
	}
	esNotify := globalServerConfig.Notify.GetElasticSearchByID(sqsArn.AccountID)
	if !esNotify.Enable {
		return false
	}
	elasticC, err := dialElastic(esNotify)
	if err != nil {
		errorIf(err, "Unable to connect to elasticsearch service %#v", esNotify)
		return false
	}
	defer elasticC.Stop()
	return true
}

// Returns true if queueArn is for PostgreSQL.
func isPostgreSQLQueue(sqsArn arnSQS) bool {
	if sqsArn.Type != queueTypePostgreSQL {
		return false
	}
	pgNotify := globalServerConfig.Notify.GetPostgreSQLByID(sqsArn.AccountID)
	if !pgNotify.Enable {
		return false
	}
	pgC, err := dialPostgreSQL(pgNotify)
	if err != nil {
		errorIf(err, "Unable to connect to PostgreSQL server %#v", pgNotify)
		return false
	}
	defer pgC.Close()
	return true
}

// Returns true if queueArn is for MySQL.
func isMySQLQueue(sqsArn arnSQS) bool {
	if sqsArn.Type != queueTypeMySQL {
		return false
	}
	msqlNotify := globalServerConfig.Notify.GetMySQLByID(sqsArn.AccountID)
	if !msqlNotify.Enable {
		return false
	}
	myC, err := dialMySQL(msqlNotify)
	if err != nil {
		errorIf(err, "Unable to connect to MySQL server %#v", msqlNotify)
		return false
	}
	defer myC.Close()
	return true
}

// Returns true if queueArn is for Kafka.
func isKafkaQueue(sqsArn arnSQS) bool {
	if sqsArn.Type != queueTypeKafka {
		return false
	}
	kafkaNotifyCfg := globalServerConfig.Notify.GetKafkaByID(sqsArn.AccountID)
	if !kafkaNotifyCfg.Enable {
		return false
	}
	kafkaC, err := dialKafka(kafkaNotifyCfg)
	if err != nil {
		errorIf(err, "Unable to dial Kafka server %#v", kafkaNotifyCfg)
		return false
	}
	defer kafkaC.Close()
	return true
}

// Match function matches wild cards in 'pattern' for events.
func eventMatch(eventType string, events []string) (ok bool) {
	for _, event := range events {
		ok = wildcard.MatchSimple(event, eventType)
		if ok {
			break
		}
	}
	return ok
}

// Filter rule match, matches an object against the filter rules.
func filterRuleMatch(object string, frs []filterRule) bool {
	var prefixMatch, suffixMatch = true, true
	for _, fr := range frs {
		if isValidFilterNamePrefix(fr.Name) {
			prefixMatch = hasPrefix(object, fr.Value)
		} else if isValidFilterNameSuffix(fr.Name) {
			suffixMatch = hasSuffix(object, fr.Value)
		}
	}
	return prefixMatch && suffixMatch
}

// A type to represent dynamic error generation functions for
// notifications.
type notificationErrorFactoryFunc func(string, ...interface{}) error

// A function to build dynamic error generation functions for
// notifications by setting an error prefix string.
func newNotificationErrorFactory(prefix string) notificationErrorFactoryFunc {
	return func(msg string, a ...interface{}) error {
		s := fmt.Sprintf(msg, a...)
		return fmt.Errorf("%s: %s", prefix, s)
	}
}


text:
<?php

namespace Zend\Db\Sql\Predicate;

use Zend\Db\Sql\ExpressionInterface;

interface PredicateInterface extends ExpressionInterface
{

}


text:
from unittest import TestCase

from plivo import plivoxml
from tests import PlivoXmlTestCase

class HangupElementTest(TestCase, PlivoXmlTestCase):
    def test_set_methods(self):
        schedule = 60
        reason = "rejected"
        expected_response = '<Response><Hangup reason="rejected" schedule="60"/></Response>'

        element = plivoxml.ResponseElement()
        response = element.add(
            plivoxml.HangupElement().set_reason(reason).set_schedule(schedule)
        ).to_string(False)
        self.assertXmlEqual(response, expected_response)


text:
typedef struct {
char code[5];
int watts;
int type;
int cant;
int active;
}lightbulb ;

void createBulb( lightbulb *bulb){
     printf("Enter lightbulb code (max 5 chars). \n");
     scanf("%s",bulb->code);
     printf("Enter lightbulb watts.\n");
     scanf("%d",&bulb->watts);
     printf("Enter lightbulb type. \n");
     scanf("%d",&bulb->type);
     printf("Enter lightbulb stock. \n");
     scanf("%d",&bulb->cant);
    bulb->active=1;
}


text:
/*
 * @author max
 */
package com.intellij.openapi.wm.impl.welcomeScreen;

import com.intellij.openapi.wm.IdeFrame;
import consulo.annotation.DeprecationInfo;
import consulo.start.WelcomeFrameManager;
import consulo.ui.annotation.RequiredUIAccess;

import javax.annotation.Nullable;

@Deprecated
@DeprecationInfo("Use WelcomeFrameManager")
public class WelcomeFrame {
  @Nullable
  @RequiredUIAccess
  public static IdeFrame getInstance() {
    return WelcomeFrameManager.getInstance().getCurrentFrame();
  }

  @RequiredUIAccess
  public static void showNow() {
    WelcomeFrameManager.getInstance().showFrame();
  }

  public static void showIfNoProjectOpened() {
    WelcomeFrameManager.getInstance().showIfNoProjectOpened();
  }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Class WebDavResponse
   </title>
    <meta name="viewport" content="width=device-width">
    <meta name="title" content="Class WebDavResponse
   ">
    <meta name="generator" content="docfx 2.16.2.2">

    <link rel="shortcut icon" href="../favicon.ico">
    <link rel="stylesheet" href="../styles/docfx.vendor.css">
    <link rel="stylesheet" href="../styles/docfx.css">
    <link rel="stylesheet" href="../styles/main.css">
    <meta property="docfx:navrel" content="../toc.html">
    <meta property="docfx:tocrel" content="toc.html">

              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
                Toggle navigation

              </button>

              <form class="navbar-form navbar-right" role="search" id="search">

                  <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">

              </form>

          Show / Hide Table of Contents

Class WebDavResponse

The implementation of the IWebDavResponse

Inheritance

Object

WebDavResponse

Inherited Members

                  Object.Equals(Object)

                  Object.Equals(Object, Object)

                  Object.GetHashCode()

                  Object.GetType()

                  Object.MemberwiseClone()

                  Object.ReferenceEquals(Object, Object)

                  Object.ToString()

Namespace:FubarDev.WebDavServer.AspNetCore

Assembly:FubarDev.WebDavServer.AspNetCore.dll

Syntax

public class WebDavResponse : IWebDavResponse

Remarks

This class wraps a Microsoft.AspNetCore.Http.HttpResponse to be accessible by the WebDAV serves IWebDavResult.

Constructors

                |
                <a href="https://github.com/FubarDevelopment/WebDavServer/new/master/apiSpec/new?filename=FubarDev_WebDavServer_AspNetCore_WebDavResponse__ctor_FubarDev_WebDavServer_IWebDavDispatcher_Microsoft_AspNetCore_Http_HttpResponse_.md&value=---%0Auid%3A%20FubarDev.WebDavServer.AspNetCore.WebDavResponse.%23ctor(FubarDev.WebDavServer.IWebDavDispatcher%2CMicrosoft.AspNetCore.Http.HttpResponse)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc

                View Source

WebDavResponse(IWebDavDispatcher, HttpResponse)

Initializes a new instance of the WebDavResponse class.

Declaration

public WebDavResponse(IWebDavDispatcher dispatcher, HttpResponse response)

Parameters

                    Type
                    Name
                    Description

                    IWebDavDispatcher
                    dispatcher

The WebDAV HTTP method dispatcher

                    Microsoft.AspNetCore.Http.HttpResponse
                    response

The ASP.NET Core HTTP response

Properties

                |
                Improve this Doc

                View Source

Body

Declaration

public Stream Body { get; }

Property Value

                    Type
                    Description

                    Stream

                |
                Improve this Doc

                View Source

ContentType

Declaration

public string ContentType { get; set; }

Property Value

                    Type
                    Description

                    String

                |
                Improve this Doc

                View Source

Dispatcher

Declaration

public IWebDavDispatcher Dispatcher { get; }

Property Value

                    Type
                    Description

                    IWebDavDispatcher

Implements

IWebDavResponse.Dispatcher

                |
                Improve this Doc

                View Source

Headers

Declaration

public IDictionary<string, string[]> Headers { get; }

Property Value

                    Type
                    Description

                    IDictionary<String, String[]>

                    Improve this Doc

                    View Source

              Back to top

            Copyright © 2016-2017 Fubar Development Junker
Generated by DocFX


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>XLabs: XLabs.Forms.Controls.DataTemplateWrapper< T > Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="navtree.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

XLabs

Cross-platform reusable C# libraries

Main Page

Packages

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Class List

Class Index

Class Hierarchy

Class Members

Static Public Attributes |
Properties |
List of all members

XLabs.Forms.Controls.DataTemplateWrapper< T > Class Template Reference

Wrapper for a DataTemplate. Unfortunately the default constructor for DataTemplate is internal so I had to wrap the DataTemplate instead of inheriting it.
 More...

Inheritance diagram for XLabs.Forms.Controls.DataTemplateWrapper< T >:

  <map id="XLabs.Forms.Controls.DataTemplateWrapper< T >_map" name="XLabs.Forms.Controls.DataTemplateWrapper< T >_map">
<area href="interface_x_labs_1_1_forms_1_1_controls_1_1_i_data_template_wrapper.html" title="Interface to enable DataTemplateCollection to hold typesafe instances of DataTemplateWrapper ..." alt="XLabs.Forms.Controls.IDataTemplateWrapper" shape="rect" coords="308,0,606,24"/>
</map>

Static Public Attributes

static readonly BindableProperty 	WrappedTemplateProperty = BindableProperty.Create<DataTemplateWrapper<T>, DataTemplate>(x => x.WrappedTemplate, null)

static readonly BindableProperty 	IsDefaultProperty = BindableProperty.Create<DataTemplateWrapper<T>, bool>(x => x.IsDefault, false)

Properties

bool 	IsDefault [get, set]

DataTemplate 	WrappedTemplate [get, set]

Type 	Type [get]

 Properties inherited from XLabs.Forms.Controls.IDataTemplateWrapper

bool 	IsDefault [get, set]

DataTemplate 	WrappedTemplate [get, set]

Type 	Type [get]

Detailed Description

Wrapper for a DataTemplate. Unfortunately the default constructor for DataTemplate is internal so I had to wrap the DataTemplate instead of inheriting it.

Template Parameters

T	The object type that this DataTemplateWrapper matches

Member Data Documentation

          readonly BindableProperty XLabs.Forms.Controls.DataTemplateWrapper< T >.IsDefaultProperty = BindableProperty.Create<DataTemplateWrapper<T>, bool>(x => x.IsDefault, false)

static

          readonly BindableProperty XLabs.Forms.Controls.DataTemplateWrapper< T >.WrappedTemplateProperty = BindableProperty.Create<DataTemplateWrapper<T>, DataTemplate>(x => x.WrappedTemplate, null)

static

Property Documentation

          bool XLabs.Forms.Controls.DataTemplateWrapper< T >.IsDefault

getset

          Type XLabs.Forms.Controls.DataTemplateWrapper< T >.Type

get

          DataTemplate XLabs.Forms.Controls.DataTemplateWrapper< T >.WrappedTemplate

getset

The documentation for this class was generated from the following file:

F:/Projects/Xamarin-Forms-Labs/src/Forms/XLabs.Forms/Controls/TemplateSelector.cs

XLabs

Forms

Controls

DataTemplateWrapper

Generated by

     1.8.10


text: import pymongo


text:
delegate_behaviour
=================

Elixir macros to define modules that delegate to concrete implementations of behaviours.
Useful to separate "logic to select specific implementation of behaviour" and "caller of behaviour interface" (similar to dependency injection).

- [Hex package information](https://hex.pm/packages/delegate_behaviour)

[![Hex.pm](http://img.shields.io/hexpm/v/delegate_behaviour.svg)](https://hex.pm/packages/delegate_behaviour)
[![Hex.pm](http://img.shields.io/hexpm/dt/delegate_behaviour.svg)](https://hex.pm/packages/delegate_behaviour)
[![Build Status](https://travis-ci.org/skirino/delegate_behaviour.svg)](https://travis-ci.org/skirino/delegate_behaviour)
[![Coverage Status](https://coveralls.io/repos/skirino/delegate_behaviour/badge.png?branch=master)](https://coveralls.io/r/skirino/delegate_behaviour?branch=master)
[![Github Issues](http://githubbadges.herokuapp.com/skirino/delegate_behaviour/issues.svg)](https://github.com/skirino/delegate_behaviour/issues)
[![Pending Pull-Requests](http://githubbadges.herokuapp.com/skirino/delegate_behaviour/pulls.svg)](https://github.com/skirino/delegate_behaviour/pulls)

## Installation

- Add `:delegate_behaviour` as a mix dependency.
- `$ mix deps.get`

## Usage example

Suppose you have a behaviour and two modules that implement the behaviour.

```ex
iex> defmodule B do
...>   use Behaviour
...>   @callback f(integer) :: integer
...> end
iex> defmodule Impl1 do
...>   @behaviour B
...>   def f(i), do: i + 1
...> end
iex> defmodule Impl2 do
...>   @behaviour B
...>   def f(i), do: i + 2
...> end
```

Now you can easily define a module that implements the behaviour `B`
by delegating all behaviour functions to the module `Impl1` or `Impl2`.
There are two variants of delegations:

- Choosing target implementation at compile-time

    ```ex
    iex> defmodule C do
    ...>   require DelegateBehaviour
    ...>   DelegateBehaviour.compile_time(B) do
    ...>     # Put code block to choose the target module;
    ...>     # do whatever you like to determine which module you delegate to,
    ...>     # e.g. environment variable, application config, config file, etc.
    ...>     # The code block is evaluated at compile time.
    ...>     case System.get_env("SOME_ENV_VAR") do
    ...>       "Impl1" -> Impl1
    ...>       _       -> Impl2
    ...>     end
    ...>   end
    ...> end
    iex> C.f(0)
    2
    ```

  If the target module that you want to delegate to is fixed and no do-end block is needed,
  you can simply write `DelegateBehaviour.compile_time(B, Impl)`.

- Choosing target implementation at runtime

    ```ex
    iex> defmodule R do
    ...>   require DelegateBehaviour
    ...>   DelegateBehaviour.runtime(B) do
    ...>     # Put code block to choose the target module;
    ...>     # do whatever you like to determine which module you delegate to,
    ...>     # e.g. environment variable, application config, config file, etc.
    ...>     # The code block is evaluated at each invocation of the behaviour functions.
    ...>     case System.get_env("SOME_ENV_VAR") do
    ...>       "Impl1" -> Impl1
    ...>       _       -> Impl2
    ...>     end
    ...>   end
    ...> end
    iex> R.f(0)
    2
    ```

All behaviour interface functions are generated as delegations, together with their type specifications.


text:
package org.keycloak.testsuite.actions;

import static org.junit.Assert.assertFalse;

import java.util.Arrays;
import java.util.HashMap;
import org.hamcrest.Matchers;
import org.jboss.arquillian.graphene.page.Page;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.keycloak.admin.client.resource.UserResource;
import org.keycloak.events.Details;
import org.keycloak.events.EventType;
import org.keycloak.models.UserModel;
import org.keycloak.representations.idm.ClientRepresentation;
import org.keycloak.representations.idm.RealmRepresentation;
import org.keycloak.representations.idm.UserRepresentation;
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
import org.keycloak.testsuite.AssertEvents;
import org.keycloak.testsuite.admin.ApiUtil;
import org.keycloak.testsuite.pages.AppPage;
import org.keycloak.testsuite.pages.AppPage.RequestType;
import org.keycloak.testsuite.pages.ErrorPage;
import org.keycloak.testsuite.pages.LoginPage;
import org.keycloak.testsuite.pages.LoginUpdateProfileEditUsernameAllowedPage;
import org.keycloak.testsuite.util.UserBuilder;
import org.keycloak.userprofile.UserProfileContext;

/**
 * @author Stian Thorgersen
 */
public class RequiredActionUpdateProfileTest extends AbstractTestRealmKeycloakTest {

    @Rule
    public AssertEvents events = new AssertEvents(this);

    @Page
    protected AppPage appPage;

    @Page
    protected LoginPage loginPage;

    @Page
    protected LoginUpdateProfileEditUsernameAllowedPage updateProfilePage;

    @Page
    protected ErrorPage errorPage;

    protected boolean isDynamicForm() {
        return false;
    }

    @Override
    public void configureTestRealm(RealmRepresentation testRealm) {
        ActionUtil.addRequiredActionForUser(testRealm, "test-user@localhost", UserModel.RequiredAction.UPDATE_PROFILE.name());
        ActionUtil.addRequiredActionForUser(testRealm, "john-doh@localhost", UserModel.RequiredAction.UPDATE_PROFILE.name());
    }

    @Before
    public void beforeTest() {
        ApiUtil.removeUserByUsername(testRealm(), "test-user@localhost");
        UserRepresentation user = UserBuilder.create().enabled(true)
                .username("test-user@localhost")
                .email("test-user@localhost")
                .firstName("Tom")
                .lastName("Brady")
                .emailVerified(true)
                .requiredAction(UserModel.RequiredAction.UPDATE_PROFILE.name()).build();
        ApiUtil.createUserAndResetPasswordWithAdminClient(testRealm(), user, "password");

        ApiUtil.removeUserByUsername(testRealm(), "john-doh@localhost");
        user = UserBuilder.create().enabled(true)
                .username("john-doh@localhost")
                .email("john-doh@localhost")
                .firstName("John")
                .lastName("Doh")
                .emailVerified(true)
                .requiredAction(UserModel.RequiredAction.UPDATE_PROFILE.name()).build();
        ApiUtil.createUserAndResetPasswordWithAdminClient(testRealm(), user, "password");
    }

    @Test
    public void updateProfile() {
        loginPage.open();

        loginPage.login("test-user@localhost", "password");

        updateProfilePage.assertCurrent();
        assertFalse(updateProfilePage.isCancelDisplayed());

        updateProfilePage.prepareUpdate().username("test-user@localhost").firstName("New first").lastName("New last").email("new@email.com").submit();

        events.expectRequiredAction(EventType.UPDATE_PROFILE).detail(Details.PREVIOUS_FIRST_NAME, "Tom").detail(Details.UPDATED_FIRST_NAME, "New first")
                .detail(Details.PREVIOUS_LAST_NAME, "Brady").detail(Details.UPDATED_LAST_NAME, "New last")
                .detail(Details.PREVIOUS_EMAIL, "test-user@localhost").detail(Details.UPDATED_EMAIL, "new@email.com")
                .assertEvent();
        Assert.assertEquals(RequestType.AUTH_RESPONSE, appPage.getRequestType());

        events.expectLogin().assertEvent();

        // assert user is really updated in persistent store
        UserRepresentation user = ActionUtil.findUserWithAdminClient(adminClient, "test-user@localhost");
        Assert.assertEquals("New first", user.getFirstName());
        Assert.assertEquals("New last", user.getLastName());
        Assert.assertEquals("new@email.com", user.getEmail());
        Assert.assertEquals("test-user@localhost", user.getUsername());
        // email changed so verify that emailVerified flag is reset
        Assert.assertEquals(false, user.isEmailVerified());
    }

    @Test
    public void updateUsername() {
        loginPage.open();

        loginPage.login("john-doh@localhost", "password");

        String userId = ActionUtil.findUserWithAdminClient(adminClient, "john-doh@localhost").getId();

        updateProfilePage.assertCurrent();

        updateProfilePage.prepareUpdate().username("new").firstName("New first").lastName("New last").email("john-doh@localhost").submit();

        events.expectLogin().event(EventType.UPDATE_PROFILE).detail(Details.UPDATED_FIRST_NAME, "New first").user(userId).session(Matchers.nullValue(String.class)).removeDetail(Details.CONSENT)
                .detail(Details.UPDATED_LAST_NAME, "New last").user(userId).session(Matchers.nullValue(String.class)).removeDetail(Details.CONSENT)
                .detail(Details.USERNAME, "john-doh@localhost")
                .assertEvent();

        Assert.assertEquals(RequestType.AUTH_RESPONSE, appPage.getRequestType());

        events.expectLogin().detail(Details.USERNAME, "john-doh@localhost").user(userId).assertEvent();

        // assert user is really updated in persistent store
        UserRepresentation user = ActionUtil.findUserWithAdminClient(adminClient, "new");
        Assert.assertEquals("New first", user.getFirstName());
        Assert.assertEquals("New last", user.getLastName());
        Assert.assertEquals("john-doh@localhost", user.getEmail());
        Assert.assertEquals("new", user.getUsername());
        // email not changed so verify that emailVerified flag is NOT reset
        Assert.assertEquals(true, user.isEmailVerified());
        getCleanup().addUserId(user.getId());
    }

    @Test
    public void updateProfileMissingFirstName() {
        loginPage.open();

        loginPage.login("test-user@localhost", "password");

        updateProfilePage.assertCurrent();

        updateProfilePage.prepareUpdate().username("new").firstName("").lastName("New last").email("new@email.com").submit();

        updateProfilePage.assertCurrent();

        // assert that form holds submitted values during validation error
        Assert.assertEquals("", updateProfilePage.getFirstName());
        Assert.assertEquals("New last", updateProfilePage.getLastName());
        Assert.assertEquals("new@email.com", updateProfilePage.getEmail());

        if(isDynamicForm())
            Assert.assertEquals("Please specify this field.", updateProfilePage.getInputErrors().getFirstNameError());
        else
            Assert.assertEquals("Please specify first name.", updateProfilePage.getInputErrors().getFirstNameError());

        events.assertEmpty();
    }

    @Test
    public void updateProfileMissingLastName() {
        loginPage.open();

        loginPage.login("test-user@localhost", "password");

        updateProfilePage.assertCurrent();

        updateProfilePage.prepareUpdate().username("new").firstName("New first").lastName("").email("new@email.com").submit();

        updateProfilePage.assertCurrent();

        // assert that form holds submitted values during validation error
        Assert.assertEquals("New first", updateProfilePage.getFirstName());
        Assert.assertEquals("", updateProfilePage.getLastName());
        Assert.assertEquals("new@email.com", updateProfilePage.getEmail());

        if(isDynamicForm())
            Assert.assertEquals("Please specify this field.", updateProfilePage.getInputErrors().getLastNameError());
        else
            Assert.assertEquals("Please specify last name.", updateProfilePage.getInputErrors().getLastNameError());

        events.assertEmpty();
    }

    @Test
    public void updateProfileMissingEmail() {
        loginPage.open();

        loginPage.login("test-user@localhost", "password");

        updateProfilePage.assertCurrent();

        updateProfilePage.prepareUpdate().username("new").firstName("New first").lastName("New last")
                .email("").submit();

        updateProfilePage.assertCurrent();

        // assert that form holds submitted values during validation error
        Assert.assertEquals("New first", updateProfilePage.getFirstName());
        Assert.assertEquals("New last", updateProfilePage.getLastName());
        Assert.assertEquals("", updateProfilePage.getEmail());

        Assert.assertEquals("Please specify email.", updateProfilePage.getInputErrors().getEmailError());

        events.assertEmpty();
    }

    @Test
    public void updateProfileInvalidEmail() {
        loginPage.open();

        loginPage.login("test-user@localhost", "password");

        updateProfilePage.assertCurrent();

        updateProfilePage.prepareUpdate().username("invalid").firstName("New first").lastName("New last")
                        .email("invalidemail").submit();

        updateProfilePage.assertCurrent();

        // assert that form holds submitted values during validation error
        Assert.assertEquals("New first", updateProfilePage.getFirstName());
        Assert.assertEquals("New last", updateProfilePage.getLastName());
        Assert.assertEquals("invalidemail", updateProfilePage.getEmail());

        Assert.assertEquals("Invalid email address.", updateProfilePage.getInputErrors().getEmailError());

        events.assertEmpty();
    }

    @Test
    public void updateProfileMissingUsername() {
        loginPage.open();

        loginPage.login("john-doh@localhost", "password");

        updateProfilePage.assertCurrent();

        updateProfilePage.prepareUpdate().username("").firstName("New first").lastName("New last").email("new@email.com").submit();

        updateProfilePage.assertCurrent();

        // assert that form holds submitted values during validation error
        Assert.assertEquals("New first", updateProfilePage.getFirstName());
        Assert.assertEquals("New last", updateProfilePage.getLastName());
        Assert.assertEquals("new@email.com", updateProfilePage.getEmail());
        Assert.assertEquals("", updateProfilePage.getUsername());

        Assert.assertEquals("Please specify username.", updateProfilePage.getInputErrors().getUsernameError());

        events.assertEmpty();
    }

    @Test
    public void updateProfileDuplicateUsername() {
        loginPage.open();

        loginPage.login("john-doh@localhost", "password");

        updateProfilePage.assertCurrent();

        updateProfilePage.prepareUpdate().username("test-user@localhost").firstName("New first").lastName("New last").email("new@email.com").submit();

        updateProfilePage.assertCurrent();

        // assert that form holds submitted values during validation error
        Assert.assertEquals("New first", updateProfilePage.getFirstName());
        Assert.assertEquals("New last", updateProfilePage.getLastName());
        Assert.assertEquals("new@email.com", updateProfilePage.getEmail());
        Assert.assertEquals("test-user@localhost", updateProfilePage.getUsername());

        Assert.assertEquals("Username already exists.", updateProfilePage.getInputErrors().getUsernameError());

        events.assertEmpty();
    }

    @Test
    public void updateProfileDuplicatedEmail() {
        loginPage.open();

        loginPage.login("test-user@localhost", "password");

        updateProfilePage.assertCurrent();

        updateProfilePage.prepareUpdate().username("test-user@localhost").firstName("New first").lastName("New last")
                .email("keycloak-user@localhost").submit();

        updateProfilePage.assertCurrent();

        // assert that form holds submitted values during validation error
        Assert.assertEquals("New first", updateProfilePage.getFirstName());
        Assert.assertEquals("New last", updateProfilePage.getLastName());
        Assert.assertEquals("keycloak-user@localhost", updateProfilePage.getEmail());

        Assert.assertEquals("Email already exists.", updateProfilePage.getInputErrors().getEmailError());

        events.assertEmpty();
    }

    @Test
    public void updateProfileExpiredCookies() {
        loginPage.open();
        loginPage.login("john-doh@localhost", "password");

        updateProfilePage.assertCurrent();

        // Expire cookies and assert the page with "back to application" link present
        driver.manage().deleteAllCookies();

        updateProfilePage.prepareUpdate().username("test-user@localhost").firstName("New first").lastName("New last").email("keycloak-user@localhost").submit();
        errorPage.assertCurrent();

        String backToAppLink = errorPage.getBackToApplicationLink();

        ClientRepresentation client = ApiUtil.findClientByClientId(adminClient.realm("test"), "test-app").toRepresentation();
        Assert.assertEquals(backToAppLink, client.getBaseUrl());
    }

    @Test
    public void updateProfileWithoutRemoveCustomAttributes() {
        UserRepresentation userRep = ActionUtil.findUserWithAdminClient(adminClient, "test-user@localhost");
        UserResource user = adminClient.realm("test").users().get(userRep.getId());

        userRep.setAttributes(new HashMap<>());
        userRep.getAttributes().put("custom", Arrays.asList("custom"));

        user.update(userRep);

        loginPage.open();

        loginPage.login("test-user@localhost", "password");

        updateProfilePage.assertCurrent();
        assertFalse(updateProfilePage.isCancelDisplayed());

        updateProfilePage.prepareUpdate().username("test-user@localhost").firstName("New first").lastName("New last").email("new@email.com").submit();

        events.expectRequiredAction(EventType.UPDATE_PROFILE).detail(Details.CONTEXT, UserProfileContext.UPDATE_PROFILE.name()).detail(Details.PREVIOUS_EMAIL, "test-user@localhost").detail(Details.UPDATED_EMAIL, "new@email.com").assertEvent();

        Assert.assertEquals(RequestType.AUTH_RESPONSE, appPage.getRequestType());

        events.expectLogin().assertEvent();

        // assert user is really updated in persistent store
        userRep = ActionUtil.findUserWithAdminClient(adminClient, "test-user@localhost");
        Assert.assertEquals("New first", userRep.getFirstName());
        Assert.assertEquals("New last", userRep.getLastName());
        Assert.assertEquals("new@email.com", userRep.getEmail());
        Assert.assertEquals("test-user@localhost", userRep.getUsername());
        Assert.assertNotNull(userRep.getAttributes());
        Assert.assertTrue(userRep.getAttributes().containsKey("custom"));
    }

}


text:
package com.complexible.stardog.examples.api;

import java.io.File;

import com.complexible.stardog.protocols.snarl.SNARLProtocolConstants;
import com.complexible.common.protocols.server.Server;
import org.openrdf.model.Literal;
import org.openrdf.query.BindingSet;
import org.openrdf.query.QueryEvaluationException;
import org.openrdf.query.TupleQueryResult;
import org.openrdf.rio.RDFFormat;

import com.complexible.common.iterations.Iteration;
import com.complexible.stardog.Stardog;
import com.complexible.stardog.api.ConnectionConfiguration;
import com.complexible.stardog.api.Connection;
import com.complexible.stardog.api.SelectQuery;
import com.complexible.stardog.api.admin.AdminConnection;
import com.complexible.stardog.api.admin.AdminConnectionConfiguration;
import com.complexible.stardog.api.search.SearchConnection;
import com.complexible.stardog.api.search.SearchResult;
import com.complexible.stardog.api.search.SearchResults;
import com.complexible.stardog.api.search.Searcher;
import com.complexible.stardog.search.SearchOptions;

/**
 * <p>Simple example </p>
 *
 * @author  Michael Grove
 * @since   0.6.5
 * @version 3.0
 */
public class WaldoAPIExample {
	// Using the Waldo Search API
	// --------------
	// A short example illustrating the use of the [full text search capabilities](http://docs.stardog.com/using/#sd-Searching) in Stardog
	// via the SNARL API.
	public static void main(String[] args) throws Exception {
		// First thing's first, we have to create and start a Stardog server to use
		Server aServer = Stardog
			                 .buildServer()
			                 .bind(SNARLProtocolConstants.EMBEDDED_ADDRESS)
			                 .start();

		try {
			// Open an `AdminConnection` to Stardog so that we can setup the database for the example
			AdminConnection dbms = AdminConnectionConfiguration.toEmbeddedServer()
			                                                   .credentials("admin", "admin")
			                                                   .connect();

			try {
				// If our example database exists, drop it and create it anew
				if (dbms.list().contains("waldoTest")) {
					dbms.drop("waldoTest");
				}

				dbms.memory("waldoTest")
				    .set(SearchOptions.SEARCHABLE, true)
				    .create();
			}
			finally {
				dbms.close();
			}

			// Obtain a `Connection` to the database we just created
			Connection aConn = ConnectionConfiguration
				                   .to("waldoTest")
				                   .credentials("admin", "admin")
				                   .connect();

			try {
				// To start, lets add some data into the database so that it can be queried and searched
				aConn.begin();
				aConn
					.add().io()
					.format(RDFFormat.RDFXML)
					.file(new File("data/catalog.rdf"));

				aConn.commit();

				// Lets try an example with the basic Waldo API
				// We want to view this connection as a [searchable connection](http://docs.stardog.com/java/snarl/com/complexible/stardog/api/search/SearchConnection.html),
				// so we request a view of the `Connection` as a `SearchConnection`
				SearchConnection aSearchConn = aConn.as(SearchConnection.class);

				// With that done, let's create a [Searcher](http://docs.stardog.com/java/snarl/com/complexible/stardog/api/search/Searcher.html)
				// that we can use to run some full text searches over the database.
				// Here we will specify that we only want results over a score of `0.5`, and no more than `50` results
				// for things that match the search term `mac`.  Stardog's full text search is backed by [Lucene](http://lucene.apache.org)
				// so you can use the full Lucene search syntax in your queries.
				Searcher aSearch = aSearchConn.search()
					                   .limit(50)
					                   .query("mac")
					                   .threshold(0.5);

				// We can run the search and then iterate over the results
				SearchResults aSearchResults = aSearch.search();

				Iteration<SearchResult, QueryEvaluationException> resultIt = aSearchResults.iteration();

				try {
					System.out.println("\nAPI results: ");
					while (resultIt.hasNext()) {
						SearchResult aHit = resultIt.next();

						System.out.println(aHit.getHit() + " with a score of: " + aHit.getScore());
					}
				}
				finally {
					// `Iteration`s must be closed
					resultIt.close();
				}

				// The `Searcher` can be re-used if we want to find the next set of results.  We already found the
				// first fifty, so lets grab the next page.
				aSearch.offset(50);

				aSearchResults = aSearch.search();

				// The Stardog full-text search index no different than the RDF index, which means you can query it
				// via SPARQL, even combining your search over the full-text index with BGPs which query your RDF
				// letting you query *both* indexes at the same time.  The SPARQL syntax is based on the LARQ
				// syntax in Jena.  Here you will see the SPARQL query that is equivalent to the search we just
				// did via `Searcher`, which we can see when we print the results.
				String aQuery = "SELECT DISTINCT ?s ?score WHERE {\n" +
				                "\t?s ?p ?l.\n" +
				                "\t( ?l ?score ) <" + SearchConnection.MATCH_PREDICATE + "> ( 'mac' 0.5 50 ).\n" +
				                "}";

				SelectQuery query = aConn.select(aQuery);

				TupleQueryResult aResult = query.execute();

				try {
					System.out.println("Query results: ");
					while (aResult.hasNext()) {
						BindingSet result = aResult.next();

						System.out.println(result.getValue("s") + " with a score of: " + ((Literal) result.getValue("score")).doubleValue());
					}
				}
				finally {
                    aResult.close();
				}
			}
			finally {
				// Always close your connections when you're done
				aConn.close();
			}
		}
		finally {
			// You MUST stop the server if you've started it!
			aServer.stop();
		}

	}
}


text:
export { default as componentA } from './componentA/componentA';
export { default as componentB } from './componentB/componentB'; // INVALID IMPORT


text:
import { Component, ViewChild, Input } from '@angular/core';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { Subject } from 'rxjs';
import { BaseModalComponent } from './base.component';
import { ResourceService } from '../services/resource.service';
import { Utils } from '../utils';

const pmoEngineerUrl = 'https://pmo.griddynamics.net/dashboard/engineering/view.action?cs_name=';

@Component({
  selector: 'person-modal',
  templateUrl: './person-modal.component.html'
})
export class PersonModal extends BaseModalComponent {
  @ViewChild('content', { static: true }) content;
  person: any = {};
  isLarge = true;

  constructor(
    modalService: NgbModal,
    private personService: ResourceService
  ) {
    super(modalService);
  }

  isTrue(value): boolean {
    return Utils.isTrue(value);
  }

  show(person: any, tabName = ''): Subject<any> {
    if (typeof person === 'string') {
      this.person = {};
      this.personService.getByLogin(person)
        .subscribe(
          person => this.person = person,
          err => console.log(err)
        );
    } else {
      this.person = person;
    }
    return this.open(tabName);
  }

  getPmoLink() {
    return this.person ? pmoEngineerUrl + this.person.name : null;
  }

}


text:
#include <stdint.h>
#include <Zmey/Graphics/GraphicsObjects.h>

namespace Zmey
{
namespace Graphics
{
namespace Backend
{

struct Texture
{
	virtual ~Texture() {}

	uint32_t Width;
	uint32_t Height;
	PixelFormat Format;
};

}
}
}


text:
require 'spec_helper'

describe 'gsub' do
  it { should run.with_params().and_raise_error(ArgumentError) }
  it { should run.with_params('1').and_raise_error(ArgumentError) }
  it { should run.with_params('1', '2').and_raise_error(ArgumentError) }
  it { should run.with_params('1', '2', '3').and_return('1') }
  it { should run.with_params('.', '.', '\.').and_return('\.') }
  it { should run.with_params('..', '.', '\.').and_return('\.\.') }
  it { should run.with_params('test.', '.', '\.').and_return('test\.') }
  it { should run.with_params(1, '2', '3').and_raise_error(ArgumentError) }
  it { should run.with_params('1', 2, '3').and_raise_error(ArgumentError) }
  it { should run.with_params('1', '2', 3).and_raise_error(ArgumentError) }
end


text:
import gravatarUrl = require('gravatar-url');

gravatarUrl('sindresorhus@gmail.com'); // $ExpectType string
gravatarUrl('sindresorhus@gmail.com', { default: 'monsterid' }); // $ExpectType string
gravatarUrl('sindresorhus@gmail.com', { default: 'monsterid', size: 200 }); // $ExpectType string
gravatarUrl('sindresorhus@gmail.com', { default: 'monsterid', rating: 'g', size: 200 }); // $ExpectType string
gravatarUrl('sindresorhus@gmail.com', { rating: 'g' }); // $ExpectType string
gravatarUrl('sindresorhus@gmail.com', { rating: 'pg' }); // $ExpectType string
gravatarUrl('sindresorhus@gmail.com', { rating: 'r' }); // $ExpectType string
gravatarUrl('sindresorhus@gmail.com', { rating: 'x' }); // $ExpectType string
gravatarUrl('sindresorhus@gmail.com', { rating: 'g', size: 200 }); // $ExpectType string
gravatarUrl('sindresorhus@gmail.com', { size: 200 }); // $ExpectType string


text:
package kmcatalog

import (
	"errors"
	"fmt"

	"github.com/cloudstax/firecamp/api/catalog"
	"github.com/cloudstax/firecamp/api/common"
	"github.com/cloudstax/firecamp/api/manage"
)

const (
	defaultVersion = "1.3.3"
	// ContainerImage is the main running container.
	ContainerImage        = common.ContainerNamePrefix + "kafka-manager:" + defaultVersion
	ReleaseContainerImage = ContainerImage + common.NameSeparator + common.Version

	listenPort = 9000

	// DefaultHeapMB is the default kafka manager java heap size.
	// TODO what is the best heap size for kafka manager?
	DefaultHeapMB = 4096

	ENV_ZKHOSTS     = "ZK_HOSTS"
	ENV_JAVA_OPTS   = "JAVA_OPTS"
	ENV_KM_USERNAME = "KM_USERNAME"
	ENV_KM_PASSWORD = "KM_PASSWORD"
)

// The Yahoo Kafka Manager catalog service, https://github.com/yahoo/kafka-manager
// Kafka Manager only needs 1 instance running.
// Kafka Manager will store the data in ZooKeeper. So Kafka Manager itself is stateless.

// ValidateRequest checks if the request is valid
func ValidateRequest(opts *catalog.CatalogKafkaManagerOptions) error {
	if len(opts.User) == 0 || len(opts.Password) == 0 {
		return errors.New("Please specify the user and password")
	}
	if opts.HeapSizeMB <= 0 {
		return errors.New("The heap size should be larger than 0")
	}
	if len(opts.ZkServiceName) == 0 {
		return errors.New("The zookeeper service name could not be empty")
	}

	return nil
}

// GenDefaultCreateServiceRequest returns the default service creation request.
func GenDefaultCreateServiceRequest(platform string, region string, cluster string, service string,
	zkServers string, opts *catalog.CatalogKafkaManagerOptions, res *common.Resources) *manage.CreateServiceRequest {

	envkvs := []*common.EnvKeyValuePair{
		&common.EnvKeyValuePair{Name: common.ENV_CLUSTER, Value: cluster},
		&common.EnvKeyValuePair{Name: common.ENV_SERVICE_NAME, Value: service},
		&common.EnvKeyValuePair{Name: common.ENV_CONTAINER_PLATFORM, Value: platform},
		&common.EnvKeyValuePair{Name: ENV_ZKHOSTS, Value: zkServers},
		&common.EnvKeyValuePair{Name: ENV_JAVA_OPTS, Value: fmt.Sprintf("-Xms%dm -Xmx%dm", opts.HeapSizeMB, opts.HeapSizeMB)},
		// TODO it is not best to put user & password directly in container environment.
		// consider to add a record to DB and fetch from DB?
		&common.EnvKeyValuePair{Name: ENV_KM_USERNAME, Value: opts.User},
		&common.EnvKeyValuePair{Name: ENV_KM_PASSWORD, Value: opts.Password},
	}

	portMappings := []common.PortMapping{
		{ContainerPort: listenPort, HostPort: listenPort, IsServicePort: true},
	}

	reserveMemMB := res.ReserveMemMB
	if res.ReserveMemMB < opts.HeapSizeMB {
		reserveMemMB = opts.HeapSizeMB
	}

	serviceCfgs := genServiceConfigs(platform, opts)

	replicaCfgs := catalog.GenStatelessServiceReplicaConfigs(cluster, service, 1)

	// kafkamanager docker-entrypoint script includes the firecamp-selectmember tool to select
	// the member and update dns. the firecamp-selectmember tool is different for different releases.
	// Every release has to use its own docker image.
	// TODO this is not good. we should consider to drop Docker Swarm. For AWS ECS, could use the
	// 			init container to do the work.
	// Note: scripts/builddocker.sh also builds the kafka manager image with the release version,
	// 			 the release upgrade needs to update the version as well.
	containerImage := ContainerImage
	if platform != common.ContainerPlatformK8s {
		containerImage = ReleaseContainerImage
	}

	req := &manage.CreateServiceRequest{
		Service: &manage.ServiceCommonRequest{
			Region:             region,
			Cluster:            cluster,
			ServiceName:        service,
			CatalogServiceType: common.CatalogService_KafkaManager,
		},

		Resource: &common.Resources{
			MaxCPUUnits:     res.MaxCPUUnits,
			ReserveCPUUnits: res.ReserveCPUUnits,
			MaxMemMB:        res.MaxMemMB,
			ReserveMemMB:    reserveMemMB,
		},

		ServiceType: common.ServiceTypeStateless,

		ContainerImage: containerImage,
		// Kafka Manager only needs 1 container.
		Replicas:       1,
		PortMappings:   portMappings,
		Envkvs:         envkvs,
		RegisterDNS:    true,
		ServiceConfigs: serviceCfgs,
		ReplicaConfigs: replicaCfgs,
	}
	return req
}

func genServiceConfigs(platform string, opts *catalog.CatalogKafkaManagerOptions) []*manage.ConfigFileContent {
	content := fmt.Sprintf(servicefileContent, platform, opts.HeapSizeMB, opts.User, opts.Password, opts.ZkServiceName)
	serviceCfg := &manage.ConfigFileContent{
		FileName: catalog.SERVICE_FILE_NAME,
		FileMode: common.DefaultConfigFileMode,
		Content:  content,
	}
	return []*manage.ConfigFileContent{serviceCfg}
}

const (
	servicefileContent = `
PLATFORM=%s
HEAP_SIZE_MB=%d
KM_USER=%s
KM_PASSWD=%s
ZK_SERVICE_NAME=%s
`
)


text:
from .sqlite import JobDB
from .key import (prov_key)

__all__ = ['prov_key', 'JobDB']


text:
<?php

return [
    'interfaces' => [
        'google.cloud.dialogflow.v2.ConversationProfiles' => [
            'ListConversationProfiles' => [
                'pageStreaming' => [
                    'requestPageTokenGetMethod' => 'getPageToken',
                    'requestPageTokenSetMethod' => 'setPageToken',
                    'requestPageSizeGetMethod' => 'getPageSize',
                    'requestPageSizeSetMethod' => 'setPageSize',
                    'responsePageTokenGetMethod' => 'getNextPageToken',
                    'resourcesGetMethod' => 'getConversationProfiles',
                ],
            ],
        ],
    ],
];


text:
package org.rhq.metrics.netty.collectd.util;

import static org.hamcrest.core.IsEqual.equalTo;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

public class AssertTest {

    @Rule
    public ExpectedException thrown = ExpectedException.none();

    @Test
    public void notNullShouldThrowIllegalArgumentException() {
        String msg = "expected message";
        thrown.expect(IllegalArgumentException.class);
        thrown.expectMessage(equalTo(msg));
        Assert.assertNotNull(null, msg);
    }

    @Test
    public void notNullShouldThrowIllegalArgumentExceptionWithFormattedMessage() {
        thrown.expect(IllegalArgumentException.class);
        thrown.expectMessage(equalTo("expected message"));
        Assert.assertNotNull(null, "%s %s", "expected", "message");
    }

    @Test
    public void notNullShouldThrowNothing() {
        Assert.assertNotNull(new Object(), "should pass");
    }

    @Test
    public void equalsShouldThrowIllegalArgumentException() {
        String msg = "expected message";
        thrown.expect(IllegalArgumentException.class);
        thrown.expectMessage(equalTo(msg));
        Assert.assertEquals(1, 2, msg);
    }

    @Test
    public void equalsShouldThrowIllegalArgumentExceptionWithFormattedMessage() {
        thrown.expect(IllegalArgumentException.class);
        thrown.expectMessage(equalTo("expected message"));
        Assert.assertEquals(1, 2, "%s %s", "expected", "message");
    }

    @Test
    public void equalsShouldThrowNothing() {
        Assert.assertEquals(1, 1, "should pass");
    }
}


text:
/*---------------------------------------------------------------------------*/
/**
 * \addtogroup rf-core-ble
 * @{
 *
 * \file
 * Implementation of the CC13xx/CC26xx RF BLE driver
 */
/*---------------------------------------------------------------------------*/
#include "contiki-conf.h"
#include "sys/process.h"
#include "sys/clock.h"
#include "sys/cc.h"
#include "sys/etimer.h"
#include "net/netstack.h"
#include "net/linkaddr.h"
#include "dev/oscillators.h"
#include "rf-core/rf-core.h"
#include "rf-core/rf-ble.h"
#include "rf-core/api/ble_cmd.h"
#include "rf-core/api/common_cmd.h"
#include "ti-lib.h"
/*---------------------------------------------------------------------------*/
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
/*---------------------------------------------------------------------------*/
#define DEBUG 0
#if DEBUG
#define PRINTF(...) printf(__VA_ARGS__)
#else
#define PRINTF(...)
#endif
/*---------------------------------------------------------------------------*/
/* BLE Intervals: Send a burst of advertisements every BLE_ADV_INTERVAL secs */
#define BLE_ADV_INTERVAL      (CLOCK_SECOND * 5)
#define BLE_ADV_DUTY_CYCLE    (CLOCK_SECOND / 10)
#define BLE_ADV_MESSAGES      10

/* BLE Advertisement-related macros */
#define BLE_ADV_TYPE_DEVINFO      0x01
#define BLE_ADV_TYPE_NAME         0x09
#define BLE_ADV_TYPE_MANUFACTURER 0xFF
#define BLE_ADV_NAME_BUF_LEN        32
#define BLE_ADV_PAYLOAD_BUF_LEN     64
#define BLE_UUID_SIZE               16
/*---------------------------------------------------------------------------*/
static unsigned char ble_params_buf[32] CC_ALIGN(4);
static uint8_t ble_mode_on = RF_BLE_IDLE;
static struct etimer ble_adv_et;
static uint8_t payload[BLE_ADV_PAYLOAD_BUF_LEN];
static int p = 0;
static int i;
/*---------------------------------------------------------------------------*/
typedef struct default_ble_tx_power_s {
   uint16_t ib:6;
   uint16_t gc:2;
   uint16_t boost:1;
   uint16_t temp_coeff:7;
} default_ble_tx_power_t;

static default_ble_tx_power_t tx_power = { 0x29, 0x00, 0x00, 0x00 };
/*---------------------------------------------------------------------------*/
/* BLE beacond config */
static struct ble_beacond_config {
  clock_time_t interval;
  char adv_name[BLE_ADV_NAME_BUF_LEN];
} beacond_config = { .interval = BLE_ADV_INTERVAL };
/*---------------------------------------------------------------------------*/
/* BLE overrides */
static uint32_t ble_overrides[] = {
  0x00364038, /* Synth: Set RTRIM (POTAILRESTRIM) to 6 */
  0x000784A3, /* Synth: Set FREF = 3.43 MHz (24 MHz / 7) */
  0xA47E0583, /* Synth: Set loop bandwidth after lock to 80 kHz (K2) */
  0xEAE00603, /* Synth: Set loop bandwidth after lock to 80 kHz (K3, LSB) */
  0x00010623, /* Synth: Set loop bandwidth after lock to 80 kHz (K3, MSB) */
  0x00456088, /* Adjust AGC reference level */
  0xFFFFFFFF, /* End of override list */
};
/*---------------------------------------------------------------------------*/
PROCESS(rf_ble_beacon_process, "CC13xx / CC26xx RF BLE Beacon Process");
/*---------------------------------------------------------------------------*/
static int
send_ble_adv_nc(int channel, uint8_t *adv_payload, int adv_payload_len)
{
  uint32_t cmd_status;
  rfc_CMD_BLE_ADV_NC_t cmd;
  rfc_bleAdvPar_t *params;

  params = (rfc_bleAdvPar_t *)ble_params_buf;

  /* Clear both buffers */
  memset(&cmd, 0x00, sizeof(cmd));
  memset(ble_params_buf, 0x00, sizeof(ble_params_buf));

  /* Adv NC */
  cmd.commandNo = CMD_BLE_ADV_NC;
  cmd.condition.rule = COND_NEVER;
  cmd.whitening.bOverride = 0;
  cmd.whitening.init = 0;
  cmd.pParams = params;
  cmd.channel = channel;

  /* Set up BLE Advertisement parameters */
  params->pDeviceAddress = (uint16_t *)&linkaddr_node_addr.u8[LINKADDR_SIZE - 2];
  params->endTrigger.triggerType = TRIG_NEVER;
  params->endTime = TRIG_NEVER;

  /* Set up BLE Advertisement parameters */
  params = (rfc_bleAdvPar_t *)ble_params_buf;
  params->advLen = adv_payload_len;
  params->pAdvData = adv_payload;

  if(rf_core_send_cmd((uint32_t)&cmd, &cmd_status) == RF_CORE_CMD_ERROR) {
    PRINTF("send_ble_adv_nc: Chan=%d CMDSTA=0x%08lx, status=0x%04x\n",
           channel, cmd_status, cmd.status);
    return RF_CORE_CMD_ERROR;
  }

  /* Wait until the command is done */
  if(rf_core_wait_cmd_done(&cmd) != RF_CORE_CMD_OK) {
    PRINTF("send_ble_adv_nc: Chan=%d CMDSTA=0x%08lx, status=0x%04x\n",
           channel, cmd_status, cmd.status);
    return RF_CORE_CMD_ERROR;
  }

  return RF_CORE_CMD_OK;
}
/*---------------------------------------------------------------------------*/
void
rf_ble_beacond_config(clock_time_t interval, const char *name)
{
  if(RF_BLE_ENABLED == 0) {
    return;
  }

  if(name != NULL) {
    if(strlen(name) == 0 || strlen(name) >= BLE_ADV_NAME_BUF_LEN) {
      return;
    }

    memset(beacond_config.adv_name, 0, BLE_ADV_NAME_BUF_LEN);
    memcpy(beacond_config.adv_name, name, strlen(name));
  }

  if(interval != 0) {
    beacond_config.interval = interval;
  }
}
/*---------------------------------------------------------------------------*/
uint8_t
rf_ble_beacond_start()
{
  if(RF_BLE_ENABLED == 0) {
    return RF_CORE_CMD_ERROR;
  }

  if(ti_lib_chipinfo_supports_ble() == false) {
    return RF_CORE_CMD_ERROR;
  }

  if(beacond_config.adv_name[0] == 0) {
    return RF_CORE_CMD_ERROR;
  }

  ble_mode_on = RF_BLE_IDLE;

  process_start(&rf_ble_beacon_process, NULL);

  return RF_CORE_CMD_OK;
}
/*---------------------------------------------------------------------------*/
uint8_t
rf_ble_is_active()
{
  return ble_mode_on;
}
/*---------------------------------------------------------------------------*/
void
rf_ble_beacond_stop()
{
  process_exit(&rf_ble_beacon_process);
}
/*---------------------------------------------------------------------------*/
static uint8_t
rf_radio_setup()
{
  uint32_t cmd_status;
  rfc_CMD_RADIO_SETUP_t cmd;

  /* Create radio setup command */
  rf_core_init_radio_op((rfc_radioOp_t *)&cmd, sizeof(cmd), CMD_RADIO_SETUP);

  cmd.txPower.IB = tx_power.ib;
  cmd.txPower.GC = tx_power.gc;
  cmd.txPower.tempCoeff = tx_power.temp_coeff;
  cmd.txPower.boost = tx_power.boost;
  cmd.pRegOverride = ble_overrides;
  cmd.mode = 0;

  /* Send Radio setup to RF Core */
  if(rf_core_send_cmd((uint32_t)&cmd, &cmd_status) != RF_CORE_CMD_OK) {
    PRINTF("rf_radio_setup: CMDSTA=0x%08lx, status=0x%04x\n",
           cmd_status, cmd.status);
    return RF_CORE_CMD_ERROR;
  }

  /* Wait until radio setup is done */
  if(rf_core_wait_cmd_done(&cmd) != RF_CORE_CMD_OK) {
    PRINTF("rf_radio_setup: wait, CMDSTA=0x%08lx, status=0x%04x\n",
           cmd_status, cmd.status);
    return RF_CORE_CMD_ERROR;
  }

  return RF_CORE_CMD_OK;
}
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(rf_ble_beacon_process, ev, data)
{
  uint8_t was_on;
  int j;
  uint32_t cmd_status;
  bool interrupts_disabled;

  PROCESS_BEGIN();

  while(1) {
    etimer_set(&ble_adv_et, beacond_config.interval);

    PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&ble_adv_et) || ev == PROCESS_EVENT_EXIT);

    if(ev == PROCESS_EVENT_EXIT) {
      PROCESS_EXIT();
    }

    /* Set the adv payload each pass: The device name may have changed */
    p = 0;

    /* device info */
    memset(payload, 0, BLE_ADV_PAYLOAD_BUF_LEN);
    payload[p++] = 0x02;          /* 2 bytes */
    payload[p++] = BLE_ADV_TYPE_DEVINFO;
    payload[p++] = 0x1a;          /* LE general discoverable + BR/EDR */
    payload[p++] = 1 + strlen(beacond_config.adv_name);
    payload[p++] = BLE_ADV_TYPE_NAME;
    memcpy(&payload[p], beacond_config.adv_name,
           strlen(beacond_config.adv_name));
    p += strlen(beacond_config.adv_name);

    for(i = 0; i < BLE_ADV_MESSAGES; i++) {
      /*
       * Under ContikiMAC, some IEEE-related operations will be called from an
       * interrupt context. We need those to see that we are in BLE mode.
       */
      interrupts_disabled = ti_lib_int_master_disable();
      ble_mode_on = RF_BLE_ACTIVE;
      if(!interrupts_disabled) {
        ti_lib_int_master_enable();
      }

      /*
       * Send BLE_ADV_MESSAGES beacon bursts. Each burst on all three
       * channels, with a BLE_ADV_DUTY_CYCLE interval between bursts
       *
       * First, determine our state:
       *
       * If we are running NullRDC, we are likely in IEEE RX mode. We need to
       * abort the IEEE BG Op before entering BLE mode.
       * If we are ContikiMAC, we are likely off, in which case we need to
       * boot the CPE before entering BLE mode
       */
      was_on = rf_core_is_accessible();

      if(was_on) {
        /*
         * We were on: If we are in the process of receiving a frame, abort the
         * BLE beacon burst. Otherwise, terminate the primary radio Op so we
         * can switch to BLE mode
         */
        if(NETSTACK_RADIO.receiving_packet()) {
          PRINTF("rf_ble_beacon_process: We were receiving\n");

          /* Abort this pass */
          break;
        }

        rf_core_primary_mode_abort();
      } else {
        /* Request the HF XOSC to source the HF clock. */
        oscillators_request_hf_xosc();

        /* We were off: Boot the CPE */
        if(rf_core_boot() != RF_CORE_CMD_OK) {
          PRINTF("rf_ble_beacon_process: rf_core_boot() failed\n");

          /* Abort this pass */
          break;
        }

        /* Trigger a switch to the XOSC, so that we can use the FS */
        oscillators_switch_to_hf_xosc();
      }

      /* Enter BLE mode */
      if(rf_radio_setup() != RF_CORE_CMD_OK) {
        PRINTF("cc26xx_rf_ble_beacon_process: Error entering BLE mode\n");
        /* Continue so we can at least try to restore our previous state */
      } else {
        /* Send advertising packets on all 3 advertising channels */
        for(j = 37; j <= 39; j++) {
          if(send_ble_adv_nc(j, payload, p) != RF_CORE_CMD_OK) {
            PRINTF("cc26xx_rf_ble_beacon_process: Channel=%d, "
                   "Error advertising\n", j);
            /* Break the loop, but don't return just yet */
            break;
          }
        }
      }

      /* Send a CMD_STOP command to RF Core */
      if(rf_core_send_cmd(CMDR_DIR_CMD(CMD_STOP), &cmd_status) != RF_CORE_CMD_OK) {
        PRINTF("cc26xx_rf_ble_beacon_process: status=0x%08lx\n", cmd_status);
        /* Continue... */
      }

      if(was_on) {
        /* We were on, go back to previous primary mode */
        rf_core_primary_mode_restore();
      } else {
        /* We were off. Shut back off */
        rf_core_power_down();

        /* Switch HF clock source to the RCOSC to preserve power */
        oscillators_switch_to_hf_rc();
      }
      etimer_set(&ble_adv_et, BLE_ADV_DUTY_CYCLE);

      interrupts_disabled = ti_lib_int_master_disable();

      ble_mode_on = RF_BLE_IDLE;

      if(!interrupts_disabled) {
        ti_lib_int_master_enable();
      }

      /* Wait unless this is the last burst */
      if(i < BLE_ADV_MESSAGES - 1) {
        PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&ble_adv_et));
      }
    }

    interrupts_disabled = ti_lib_int_master_disable();

    ble_mode_on = RF_BLE_IDLE;

    if(!interrupts_disabled) {
      ti_lib_int_master_enable();
    }
  }
  PROCESS_END();
}
/*---------------------------------------------------------------------------*/
/**
 * @}
 * @}
 */


text:
jQuery(document).ready(function($) {
	// Allows us to use a class to create DIV TEXT FILLING GOODNESS.
	$('.bigtext').bigtext();

	// Javascript to enable link to tab
	const url = document.location.toString();
	if (url.match('#')) {
		$('.nav-tabs a[href=#' + url.split('#')[1] + ']').tab('show');
	}

	// Change hash for page-reload
	$('.nav-tabs a').on('shown.bs.tab', function(e) {
		window.location.hash = e.target.hash;
	});

	var localtz = moment.tz.guess();

	$('[data-date]').each(function(i, x) {
		var fmt = $(x).data('format');
		var unixtime = $(x).data('date');
		var date = moment.unix(unixtime);

		var text = date.tz(localtz).format(fmt);
		$(x).text(text);
	});
});