text:
#import "cocos2d.h"

@class CCPhysicsCollisionPair;

/** The type of physics body to use. */
typedef NS_ENUM(NSUInteger, CCPhysicsBodyType){

	/** A regular rigid body that is affected by gravity, forces and collisions. */
	CCPhysicsBodyTypeDynamic,

//	/** A body that is immovable by gravity, forces or collisions, but is moved using code.  */
//	CCPhysicsBodyTypeKinematic,

	/** A body that is immovable such as a wall or the ground. */
	CCPhysicsBodyTypeStatic,
};

/**
Physics bodies are attached to CCNode objects and contain their physical properties such as mass, shape, friction, etc.

There are two main kinds of bodies, static and dynamic. Static bodies cannot be moved by normal forces, collisions or gravity.
This is the type of body you would use for the ground or wall in a game. Dynamic bodies are just the opposite. They are affected by collisions, friction, gravity, forces, etc.
You can change the type of a body using the CCPhysicsBody.type property.

There are two basic categories of shapes that physics bodies can have. The simplest category are convex shapes such as circles, pills and polygons (in order of efficiency).
These are considered to be solid (not hollow) objects by the physics engine.
Composite bodies, such as those created with the polyline or bodyWithShapes: methods are actually composed of multiple shapes.
Regardless of the type, all shapes can be given a radius value that adds some thickness to them and rounds out their sharp corners.

Many rigid body properties such as the moment of inertia or center of gravity are calculated for you automatically based on the shapes the body is created from.
The exception is the mass of the body which defaults to 1.0. It is the developer's responsibility to set the mass (or density) for the objects.
What units you use for mass is not important as long as they are consistent.

### Collision Filtering:

By default physics bodies collide with all other physics bodies. Since 2D games use a lot of faked perspectives and layering CCPhysics provides you with many options to filter out unwanted collisions.

- collisionGroup: Bodies can be assigned an object pointer that defines a group. Two bodies in the same group will not collide.
- collisionCategory, collisionMask: Bodies can be assigned a list of categories and masks (rules) that define which kinds of bodies they will collide with.
- CCPhysicsJoint.collideBodies: Joints have a flag that allows you to reject a collisions between the bodies they connect.
- CCPhysicsCollisionDelegate methods: You can set up a delegate that responds to collision events between bodies progmatically.

### Tips:

- Use the simplest shape you can. You don't need to be pixel perfect. Collisions with complex shapes are very computationally expensive and will ultimately feel more random and unfair to your players.
- Add radii to your shapes. It will help smooth out collisions between corners of objects and it will allow the collision detection to run more efficiently.
- Avoid very small, thin, or fast moving shapes when possible. The underlying physics engine does not perform continuous collision detection and can miss collisions if they move too much in a single step.
- When possible, try to use groups, categories or joints to filter collisions since they are tried before running the expensive collision detection code.
 */
@interface CCPhysicsBody : NSObject

/// -----------------------------------------------------------------------
/// @name Creating a CCPhysicsBody Object
/// -----------------------------------------------------------------------

/**
*  Creates and retuns a circular physics body using the circle radius and center values specified.
*
*  @param radius Circle radius.
*  @param center Circle center point.
*
*  @return The CCPhysicsBody Object.
*/
+(CCPhysicsBody *)bodyWithCircleOfRadius:(CGFloat)radius andCenter:(CGPoint)center;

/**
 *  Creates and returns a box shaped physics body with rounded corners.
 *
 *  @param rect         Box dimensions.
 *  @param cornerRadius Corner radius.
 *
 *  @return The CCPhysicsBody Object.
 */
+(CCPhysicsBody *)bodyWithRect:(CGRect)rect cornerRadius:(CGFloat)cornerRadius;

/**
 *  Creates and returns a pill shaped physics body with rounded corners that stretches from 'start' to 'end'.
 *
 *  @param from         Start point.
 *  @param to           End point.
 *  @param cornerRadius Corner radius.
 *
 *  @return The CCPhysicsBody Object.
 */
+(CCPhysicsBody *)bodyWithPillFrom:(CGPoint)from to:(CGPoint)to cornerRadius:(CGFloat)cornerRadius;

/**
 *  Creates and returns a convex polygon shaped physics body with rounded corners.
 *  If the points do not form a convex polygon then a convex hull will be created from them automatically.
 *
 *  @param points       Points array pointer.
 *  @param count        Points count.
 *  @param cornerRadius Corner radius.
 *
 *  @return The CCPhysicsBody Object.
 */
+(CCPhysicsBody *)bodyWithPolygonFromPoints:(CGPoint *)points count:(NSUInteger)count cornerRadius:(CGFloat)cornerRadius;

/**
 *  Creates and returns a physics body with four pill shapes around the rectangle's perimeter.
 *  Polyline based bodies default to the CCPhysicsBodyTypeStatic body type.
 *
 *  @param rect         Rectangle perimeter.
 *  @param cornerRadius Corner radius.
 *
 *  @return The CCPhysicsBody Object.
 */
+(CCPhysicsBody *)bodyWithPolylineFromRect:(CGRect)rect cornerRadius:(CGFloat)cornerRadius;

/**
 *  Creates and returns a physics body with multiple pill shapes attached, one for each segment in the polyline.
 *  Polyline based bodies default to the CCPhysicsBodyTypeStatic body type.
 *
 *  @param points       Points array pointer.
 *  @param count        Points count.
 *  @param cornerRadius Corner radius.
 *  @param looped       Should there be a pill shape that goes from the first to last point or not.
 *
 *  @return The CCPhysicsBody Object.
 */
+(CCPhysicsBody *)bodyWithPolylineFromPoints:(CGPoint *)points count:(NSUInteger)count cornerRadius:(CGFloat)cornerRadius looped:(bool)looped;

/**
 *  Creates and returns a physics body with multiple shapes.
 *
 *  @param shapes Array of shapes to attach to the body.
 *
 *  @return The CCPhysicsBody Object.
 */
+(CCPhysicsBody *)bodyWithShapes:(NSArray *)shapes;

/// -----------------------------------------------------------------------
/// @name Accessing Basic Body Attributes
/// -----------------------------------------------------------------------

/**
 *  Mass of the physics body. The mass of a composite body cannod be changed.
 *  Defaults to 1.0.
 */
@property(nonatomic, assign) CGFloat mass;

/**
 *  Area of the body in points^2.
 *  Please note that this is relative to the CCPhysicsNode, changing the node or a parent can change the area.
 */
@property(nonatomic, readonly) CGFloat area;

/**
 *  Density of the body in 1/1000 units of mass per point^2. The co-efficent is used to keep the mass of an object a reasonably small value.
 *  If the body has multiple shapes, you cannot change the density directly.
 *  Note that mass and not density will remain constant if an object is rescaled.
 */
@property(nonatomic, assign) CGFloat density;

/**
 *  Surface friction of the physics body, when two objects collide, their friction is multiplied together.
 *  The calculated value can be overridden in a CCCollisionPairDelegate pre-solve method.
 *  Defaults to 0.7
 */
@property(nonatomic, assign) CGFloat friction;

/**
 *  Elasticity of the physics body.
 *  When two objects collide, their elasticity is multiplied together.
 *  The calculated value can be ovrriden in a CCCollisionPairDelegate pre-solve method.
 *  Defaults to 0.2.
 */
@property(nonatomic, assign) CGFloat elasticity;

/**
 *  Velocity of the surface of a physics body relative to it's normal velocity.  This is useful for modelling conveyor belts or the feet of a player avatar.
 *  The calculated surface velocity of two colliding shapes by default only affects their friction.
 *  The calculated value can be overriden in a CCCollisionPairDelegate pre-solve method.
 *  Defaults to CGPointZero.
 */
@property(nonatomic, assign) CGPoint surfaceVelocity;

/// -----------------------------------------------------------------------
/// @name Accessing Simulation Attributes
/// -----------------------------------------------------------------------

/**
 *  Affected by gravity flag.  Defaults to Yes.
 */
@property(nonatomic, assign) BOOL affectedByGravity;

/**
 *  Allow body rotation flag.  Defaults to Yes.
 */
@property(nonatomic, assign) BOOL allowsRotation;

/**
 *  Physics body type.  Defaults to CCPhysicsBodyTypeDynamic
 */
@property(nonatomic, assign) CCPhysicsBodyType type;

/// -----------------------------------------------------------------------
/// @name Accessing Collision and Contact Attributes
/// -----------------------------------------------------------------------

/**
 *  Is this body a sensor? A sensor will call a collision delegate but does not physically cause collisions between bodies.
 *  Defaults to NO.
 */
@property(nonatomic, assign) BOOL sensor;

/**
 *  The body's collisionGroup, if two physics bodies share the same group id, they don't collide. Defaults to nil.
 */
@property(nonatomic, assign) id collisionGroup;

/**
 *  A string that identifies the collision pair delegate method that should be called. Default value is @"default".
 */
@property(nonatomic, copy) NSString *collisionType;

/**
 *  An array of NSString category names of which this physics body is a member. Up to 32 unique categories can be used in a single physics node.
 *  A value of nil means that a body exists in all possible collision categories.
 *  The deefault is nil.
 */
@property(nonatomic, copy) NSArray *collisionCategories;

/**
 *  An array of NSString category names that this physics body wants to collide with.
 *  The categories/masks of both bodies must agree for a collision to occur.
 *  A value of nil means that this body will collide with a body in any category.
 *  The default is nil.
 */
@property(nonatomic, copy) NSArray *collisionMask;

/**
 *  Iterate over all of the CCPhysicsCollisionPairs this body is currently in contact with.
 *  @note The CCPhysicsCollisionPair object is shared so you should not store a reference to it.
 *
 *  @param block Collision block.
 */
-(void)eachCollisionPair:(void (^)(CCPhysicsCollisionPair *pair))block;

/// -----------------------------------------------------------------------
/// @name Accessing Velocity Attributes
/// -----------------------------------------------------------------------

/**
 *  The velocity of the physics body in absolute coordinates.
 */
@property(nonatomic, assign) CGPoint velocity;

/**
 *  Angular velocity of the physics body in radians per second.
 */
@property(nonatomic, assign) CGFloat angularVelocity;

/// -----------------------------------------------------------------------
/// @name Accessing Forces and Torques Attributes
/// -----------------------------------------------------------------------

/**
 *  Linear force applied to the physics body this fixed timestep.
 */
@property(nonatomic, assign) CGPoint force;

/**
 *  Torque applied to this physics body this fixed timestep.
 */
@property(nonatomic, assign) CGFloat torque;

/// -----------------------------------------------------------------------
/// @name Applying Force and Impulses Methods
/// -----------------------------------------------------------------------

/**
 *  Apply a torque on the physics body.
 *
 *  @param torque Torque.
 */
-(void)applyTorque:(CGFloat)torque;

/**
 *  Apply an angular impulse.
 *
 *  @param impulse Angular impulse.
 */
-(void)applyAngularImpulse:(CGFloat)impulse;

/**
 *  Apply a force to the physics body.
 *
 *  @param force Force vector.
 */
-(void)applyForce:(CGPoint)force;

/**
 *  Apply an impulse on the physics body.
 *
 *  @param impulse Impulse vector.
 */
-(void)applyImpulse:(CGPoint)impulse;

/**
 *  Apply force and torque on the physics body from a force applied at the given point in the parent CCNode's coordinates.
 *  The force will be rotated by, but not scaled by the CCNode's transform.
 *
 *  @param force Force vector.
 *  @param point Point to apply force.
 */
-(void)applyForce:(CGPoint)force atLocalPoint:(CGPoint)point;

/**
 *  Apply an impulse and angular impulse on the physics body at the given point in the parent CCNode's coordinates.
 *  The impulse will be rotated by, but not scaled by the CCNode's transform.
 *
 *  @param impulse Impulse vector.
 *  @param point   Point to apply impulse.
 */
-(void)applyImpulse:(CGPoint)impulse atLocalPoint:(CGPoint)point;

/**
 *  Apply an force and angular torque on the physics body at the given point in absolute coordinates.
 *
 *  @param force Force vector.
 *  @param point Point to apply force.
 */
-(void)applyForce:(CGPoint)force atWorldPoint:(CGPoint)point;

/**
 *  Apply an impulse and angular impulse on the physics body at the given point in absolute coordinates.
 *
 *  @param impulse Impulse vector.
 *  @param point   Point to apply impulse.
 */
-(void)applyImpulse:(CGPoint)impulse atWorldPoint:(CGPoint)point;

/// -----------------------------------------------------------------------
/// @name Accessing Misc Attributes
/// -----------------------------------------------------------------------

/** Joints connected to this body. */
@property(nonatomic, readonly) NSArray *joints;

/**
 * Sleeping bodies use minimal CPU resources as they are removed from the simulation until something collides with them.
 * Normally a body will fall alsleep on it's own, but you can manually force a body to fall a sleep at any time if you desire.
 */
@property(nonatomic, assign) BOOL sleeping;

/** The CCNode to which this physics body is attached. */
@property(nonatomic, readonly, weak) CCNode *node;

@end


text:
package org.rabix.bindings.protocol.draft3.expression.javascript;

import org.mozilla.javascript.Callable;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.ContextFactory;
import org.mozilla.javascript.Scriptable;
import org.rabix.bindings.protocol.draft3.expression.Draft3ExpressionTimeoutException;

public class Draft3ExpressionContextFactory extends ContextFactory {

  private int timeoutInSeconds;

  public Draft3ExpressionContextFactory(int timeoutInSeconds) {
    this.timeoutInSeconds = timeoutInSeconds;
  }

  @SuppressWarnings("deprecation")
  private static class ExpressionContext extends Context {
    long startTime;
  }

  protected Context makeContext() {
    ExpressionContext cx = new ExpressionContext();
    cx.setInstructionObserverThreshold(1000);
    return cx;
  }

  public boolean hasFeature(Context cx, int featureIndex) {
    switch (featureIndex) {
    case Context.FEATURE_NON_ECMA_GET_YEAR:
      return true;
    case Context.FEATURE_MEMBER_EXPR_AS_FUNCTION_NAME:
      return true;
    case Context.FEATURE_RESERVED_KEYWORD_AS_IDENTIFIER:
      return true;
    case Context.FEATURE_PARENT_PROTO_PROPERTIES:
      return false;
    }
    return super.hasFeature(cx, featureIndex);
  }

  protected void observeInstructionCount(Context cx, int instructionCount) {
    ExpressionContext mcx = (ExpressionContext) cx;
    long currentTime = System.currentTimeMillis();
    if (currentTime - mcx.startTime > timeoutInSeconds * 1000) {
      throw new Draft3ExpressionTimeoutException("Script is running more than " + timeoutInSeconds + " seconds");
    }
  }

  protected Object doTopCall(Callable callable, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) {
    ExpressionContext mcx = (ExpressionContext) cx;
    mcx.startTime = System.currentTimeMillis();

    return super.doTopCall(callable, cx, scope, thisObj, args);
  }

}

redpajama_set_name: RedPajamaGithub


text:
using NFine.Application.SystemSecurity;
using NFine.Code;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Microsoft.AspNetCore.Mvc;

namespace Coral.Admin.Areas.SystemSecurity.Controllers
{
    public class LogController : ControllerBase
    {
        private LogApp logApp = new LogApp();

        [HttpGet]
        public ActionResult RemoveLog()
        {
            return View();
        }
        [HttpGet]
        [HandlerAjaxOnly]
        public ActionResult GetGridJson(Pagination pagination, string queryJson)
        {
            var data = new
            {
                rows = logApp.GetList(pagination, queryJson),
                total = pagination.total,
                page = pagination.page,
                records = pagination.records
            };
            return Content(data.ToJson());
        }
        [HttpPost]
        [HandlerAjaxOnly]
        [HandlerAuthorize]
        [ValidateAntiForgeryToken]
        public ActionResult SubmitRemoveLog(string keepTime)
        {
            logApp.RemoveLog(keepTime);
            return Success("清空成功。");
        }
    }
}


text:
<?php
// $Id: Test-JSON.php,v 1.28 2006/06/28 05:54:17 migurski Exp $
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
 * Unit tests for Services_JSON.
 * @see JSON.php
 *
 * @category
 * @package     Services_JSON
 * @author      Michal Migurski <mike-json@teczno.com>
 * @author      Matt Knapp <mdknapp[at]gmail[dot]com>
 * @author      Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
 * @copyright   2005 Michal Migurski
 * @version     CVS: $Id: Test-JSON.php,v 1.28 2006/06/28 05:54:17 migurski Exp $
 * @license     http://www.opensource.org/licenses/bsd-license.php
 * @link        http://pear.php.net/pepr/pepr-proposal-show.php?id=198
 */

    error_reporting(E_ALL);

    require_once 'PHPUnit.php';
    require_once 'JSON.php';

    class Services_JSON_EncDec_TestCase extends PHPUnit_TestCase {

        function Services_JSON_EncDec_TestCase($name) {
            $this->PHPUnit_TestCase($name);
        }

        function setUp() {
            $this->json = new Services_JSON();

            $obj = new stdClass();
            $obj->a_string = '"he":llo}:{world';
            $obj->an_array = array(1, 2, 3);
            $obj->obj = new stdClass();
            $obj->obj->a_number = 123;

            $this->obj = $obj;
            $this->obj_j = '{"a_string":"\"he\":llo}:{world","an_array":[1,2,3],"obj":{"a_number":123}}';
            $this->obj_d = 'object with properties, nested object and arrays';

            $this->arr = array(null, true, array(1, 2, 3), "hello\"],[world!");
            $this->arr_j = '[null,true,[1,2,3],"hello\"],[world!"]';
            $this->arr_d = 'array with elements and nested arrays';

            $this->str1 = 'hello world';
            $this->str1_j = '"hello world"';
            $this->str1_j_ = "'hello world'";
            $this->str1_d = 'hello world';
            $this->str1_d_ = 'hello world, double quotes';

            $this->str2 = "hello\t\"world\"";
            $this->str2_j = '"hello\\t\\"world\\""';
            $this->str2_d = 'hello world, with tab, double-quotes';

            $this->str3 = "\\\r\n\t\"/";
            $this->str3_j = '"\\\\\\r\\n\\t\\"\\/"';
            $this->str3_d = 'backslash, return, newline, tab, double-quote';

            $this->str4 = 'héllö wørłd';
            $this->str4_j = '"h\u00e9ll\u00f6 w\u00f8r\u0142d"';
            $this->str4_j_ = '"héllö wørłd"';
            $this->str4_d = 'hello world, with unicode';
        }

        function test_to_JSON()
        {
            $this->assertEquals('null', $this->json->encode(null), 'type case: null');
            $this->assertEquals('true', $this->json->encode(true), 'type case: boolean true');
            $this->assertEquals('false', $this->json->encode(false), 'type case: boolean false');

            $this->assertEquals('1', $this->json->encode(1), 'numeric case: 1');
            $this->assertEquals('-1', $this->json->encode(-1), 'numeric case: -1');
            $this->assertEquals('1.000000', $this->json->encode(1.0), 'numeric case: 1.0');
            $this->assertEquals('1.100000', $this->json->encode(1.1), 'numeric case: 1.1');

            $this->assertEquals($this->str1_j, $this->json->encode($this->str1), "string case: {$this->str1_d}");
            $this->assertEquals($this->str2_j, $this->json->encode($this->str2), "string case: {$this->str2_d}");
            $this->assertEquals($this->str3_j, $this->json->encode($this->str3), "string case: {$this->str3_d}");
            $this->assertEquals($this->str4_j, $this->json->encode($this->str4), "string case: {$this->str4_d}");

            $this->assertEquals($this->arr_j, $this->json->encode($this->arr), "array case: {$this->arr_d}");
            $this->assertEquals($this->obj_j, $this->json->encode($this->obj), "object case: {$this->obj_d}");
        }

        function test_from_JSON()
        {
            $this->assertEquals(null, $this->json->decode('null'), 'type case: null');
            $this->assertEquals(true, $this->json->decode('true'), 'type case: boolean true');
            $this->assertEquals(false, $this->json->decode('false'), 'type case: boolean false');

            $this->assertEquals(1, $this->json->decode('1'), 'numeric case: 1');
            $this->assertEquals(-1, $this->json->decode('-1'), 'numeric case: -1');
            $this->assertEquals(1.0, $this->json->decode('1.0'), 'numeric case: 1.0');
            $this->assertEquals(1.1, $this->json->decode('1.1'), 'numeric case: 1.1');

            $this->assertEquals(11.0, $this->json->decode('1.1e1'), 'numeric case: 1.1e1');
            $this->assertEquals(11.0, $this->json->decode('1.10e+1'), 'numeric case: 1.10e+1');
            $this->assertEquals(0.11, $this->json->decode('1.1e-1'), 'numeric case: 1.1e-1');
            $this->assertEquals(-0.11, $this->json->decode('-1.1e-1'), 'numeric case: -1.1e-1');

            $this->assertEquals($this->str1, $this->json->decode($this->str1_j),  "string case: {$this->str1_d}");
            $this->assertEquals($this->str1, $this->json->decode($this->str1_j_), "string case: {$this->str1_d_}");
            $this->assertEquals($this->str2, $this->json->decode($this->str2_j),  "string case: {$this->str2_d}");
            $this->assertEquals($this->str3, $this->json->decode($this->str3_j),  "string case: {$this->str3_d}");
            $this->assertEquals($this->str4, $this->json->decode($this->str4_j),  "string case: {$this->str4_d}");
            $this->assertEquals($this->str4, $this->json->decode($this->str4_j_),  "string case: {$this->str4_d}");

            $this->assertEquals($this->arr, $this->json->decode($this->arr_j), "array case: {$this->arr_d}");
            $this->assertEquals($this->obj, $this->json->decode($this->obj_j), "object case: {$this->obj_d}");
        }

        function test_to_then_from_JSON()
        {
            $this->assertEquals(null, $this->json->decode($this->json->encode(null)), 'type case: null');
            $this->assertEquals(true, $this->json->decode($this->json->encode(true)), 'type case: boolean true');
            $this->assertEquals(false, $this->json->decode($this->json->encode(false)), 'type case: boolean false');

            $this->assertEquals(1, $this->json->decode($this->json->encode(1)), 'numeric case: 1');
            $this->assertEquals(-1, $this->json->decode($this->json->encode(-1)), 'numeric case: -1');
            $this->assertEquals(1.0, $this->json->decode($this->json->encode(1.0)), 'numeric case: 1.0');
            $this->assertEquals(1.1, $this->json->decode($this->json->encode(1.1)), 'numeric case: 1.1');

            $this->assertEquals($this->str1, $this->json->decode($this->json->encode($this->str1)), "string case: {$this->str1_d}");
            $this->assertEquals($this->str2, $this->json->decode($this->json->encode($this->str2)), "string case: {$this->str2_d}");
            $this->assertEquals($this->str3, $this->json->decode($this->json->encode($this->str3)), "string case: {$this->str3_d}");
            $this->assertEquals($this->str4, $this->json->decode($this->json->encode($this->str4)), "string case: {$this->str4_d}");

            $this->assertEquals($this->arr, $this->json->decode($this->json->encode($this->arr)), "array case: {$this->arr_d}");
            $this->assertEquals($this->obj, $this->json->decode($this->json->encode($this->obj)), "object case: {$this->obj_d}");
        }

        function test_from_then_to_JSON()
        {
            $this->assertEquals('null', $this->json->encode($this->json->decode('null')), 'type case: null');
            $this->assertEquals('true', $this->json->encode($this->json->decode('true')), 'type case: boolean true');
            $this->assertEquals('false', $this->json->encode($this->json->decode('false')), 'type case: boolean false');

            $this->assertEquals('1', $this->json->encode($this->json->decode('1')), 'numeric case: 1');
            $this->assertEquals('-1', $this->json->encode($this->json->decode('-1')), 'numeric case: -1');
            $this->assertEquals('1.0', $this->json->encode($this->json->decode('1.0')), 'numeric case: 1.0');
            $this->assertEquals('1.1', $this->json->encode($this->json->decode('1.1')), 'numeric case: 1.1');

            $this->assertEquals($this->str1_j, $this->json->encode($this->json->decode($this->str1_j)), "string case: {$this->str1_d}");
            $this->assertEquals($this->str2_j, $this->json->encode($this->json->decode($this->str2_j)), "string case: {$this->str2_d}");
            $this->assertEquals($this->str3_j, $this->json->encode($this->json->decode($this->str3_j)), "string case: {$this->str3_d}");
            $this->assertEquals($this->str4_j, $this->json->encode($this->json->decode($this->str4_j)), "string case: {$this->str4_d}");
            $this->assertEquals($this->str4_j, $this->json->encode($this->json->decode($this->str4_j_)), "string case: {$this->str4_d}");

            $this->assertEquals($this->arr_j, $this->json->encode($this->json->decode($this->arr_j)), "array case: {$this->arr_d}");
            $this->assertEquals($this->obj_j, $this->json->encode($this->json->decode($this->obj_j)), "object case: {$this->obj_d}");
        }
    }

    class Services_JSON_AssocArray_TestCase extends PHPUnit_TestCase {

        function Services_JSON_AssocArray_TestCase($name) {
            $this->PHPUnit_TestCase($name);
        }

        function setUp() {
            $this->json_l = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
            $this->json_s = new Services_JSON();

            $this->arr = array('car1'=> array('color'=> 'tan', 'model' => 'sedan'),
            	'car2' => array('color' => 'red', 'model' => 'sports'));
            $this->arr_jo = '{"car1":{"color":"tan","model":"sedan"},"car2":{"color":"red","model":"sports"}}';
            $this->arr_d = 'associative array with nested associative arrays';

            $this->arn = array(0=> array(0=> 'tan\\', 'model\\' => 'sedan'), 1 => array(0 => 'red', 'model' => 'sports'));
            $this->arn_ja = '[{"0":"tan\\\\","model\\\\":"sedan"},{"0":"red","model":"sports"}]';
            $this->arn_d = 'associative array with nested associative arrays, and some numeric keys thrown in';

            $this->arrs = array (1 => 'one', 2 => 'two', 5 => 'five');
            $this->arrs_jo = '{"1":"one","2":"two","5":"five"}';
            $this->arrs_d = 'associative array numeric keys which are not fully populated in a range of 0 to length-1';
        }

        function test_type()
        {
            $this->assertEquals('array',  gettype($this->json_l->decode($this->arn_ja)), "loose type should be array");
            $this->assertEquals('array',  gettype($this->json_s->decode($this->arn_ja)), "strict type should be array");
        }

        function test_to_JSON()
        {
            // both strict and loose JSON should result in an object
            $this->assertEquals($this->arr_jo, $this->json_l->encode($this->arr), "array case - loose: {$this->arr_d}");
            $this->assertEquals($this->arr_jo, $this->json_s->encode($this->arr), "array case - strict: {$this->arr_d}");

            // ...unless the input array has some numeric indeces, in which case the behavior is to degrade to a regular array
            $this->assertEquals($this->arn_ja, $this->json_s->encode($this->arn), "array case - strict: {$this->arn_d}");

            // Test a sparsely populated numerically indexed associative array
            $this->assertEquals($this->arrs_jo, $this->json_l->encode($this->arrs), "sparse numeric assoc array: {$this->arrs_d}");
        }

        function test_to_then_from_JSON()
        {
            // these tests motivated by a bug in which strings that end
            // with backslashes followed by quotes were incorrectly decoded.

            foreach(array('\\"', '\\\\"', '\\"\\"', '\\""\\""', '\\\\"\\\\"') as $v) {
                $this->assertEquals(array($v), $this->json_l->decode($this->json_l->encode(array($v))));
                $this->assertEquals(array('a' => $v), $this->json_l->decode($this->json_l->encode(array('a' => $v))));
            }
        }
    }

    class Services_JSON_NestedArray_TestCase extends PHPUnit_TestCase {

        function Services_JSON_NestedArray_TestCase($name) {
            $this->PHPUnit_TestCase($name);
        }

        function setUp() {
            $this->json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);

            $this->str1 = '[{"this":"that"}]';
            $this->arr1 = array(array('this' => 'that'));

            $this->str2 = '{"this":["that"]}';
            $this->arr2 = array('this' => array('that'));

            $this->str3 = '{"params":[{"foo":["1"],"bar":"1"}]}';
            $this->arr3 = array('params' => array(array('foo' => array('1'), 'bar' => '1')));

            $this->str4 = '{"0": {"foo": "bar", "baz": "winkle"}}';
            $this->arr4 = array('0' => array('foo' => 'bar', 'baz' => 'winkle'));

            $this->str5 = '{"params":[{"options": {"old": [ ], "new": {"0": {"elements": {"old": [], "new": {"0": {"elementName": "aa", "isDefault": false, "elementRank": "0", "priceAdjust": "0", "partNumber": ""}}}, "optionName": "aa", "isRequired": false, "optionDesc": null}}}}]}';
            $this->arr5 = array (
              'params' => array (
                0 => array (
                  'options' =>
                  array (
                    'old' => array(),
                    'new' => array (
                      0 => array (
                        'elements' => array (
                          'old' => array(),
                          'new' => array (
                            0 => array (
                              'elementName' => 'aa',
                              'isDefault' => false,
                              'elementRank' => '0',
                              'priceAdjust' => '0',
                              'partNumber' => '',
                            ),
                          ),
                        ),
                        'optionName' => 'aa',
                        'isRequired' => false,
                        'optionDesc' => NULL,
                      ),
                    ),
                  ),
                ),
              ),
            );
        }

        function test_type()
        {
            $this->assertEquals('array', gettype($this->json->decode($this->str1)), "loose type should be array");
            $this->assertEquals('array', gettype($this->json->decode($this->str2)), "loose type should be array");
            $this->assertEquals('array', gettype($this->json->decode($this->str3)), "loose type should be array");
        }

        function test_from_JSON()
        {
            $this->assertEquals($this->arr1, $this->json->decode($this->str1), "simple compactly-nested array");
            $this->assertEquals($this->arr2, $this->json->decode($this->str2), "simple compactly-nested array");
            $this->assertEquals($this->arr3, $this->json->decode($this->str3), "complex compactly nested array");
            $this->assertEquals($this->arr4, $this->json->decode($this->str4), "complex compactly nested array");
            $this->assertEquals($this->arr5, $this->json->decode($this->str5), "super complex compactly nested array");
        }

        function _test_from_JSON()
        {
            $super = '{"params":[{"options": {"old": {}, "new": {"0": {"elements": {"old": {}, "new": {"0": {"elementName": "aa", "isDefault": false, "elementRank": "0", "priceAdjust": "0", "partNumber": ""}}}, "optionName": "aa", "isRequired": false, "optionDesc": ""}}}}]}';
            print("trying {$super}...\n");
            print var_export($this->json->decode($super));
        }
    }

    class Services_JSON_Object_TestCase extends PHPUnit_TestCase {

        function Services_JSON_Object_TestCase($name) {
            $this->PHPUnit_TestCase($name);
        }

        function setUp() {
            $this->json_l = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
            $this->json_s = new Services_JSON();

            $this->obj_j = '{"a_string":"\"he\":llo}:{world","an_array":[1,2,3],"obj":{"a_number":123}}';

            $this->obj1->car1->color = 'tan';
            $this->obj1->car1->model = 'sedan';
            $this->obj1->car2->color = 'red';
            $this->obj1->car2->model = 'sports';
            $this->obj1_j = '{"car1":{"color":"tan","model":"sedan"},"car2":{"color":"red","model":"sports"}}';
            $this->obj1_d = 'Object with nested objects';
        }

        function test_type()
        {
            $this->assertEquals('object', gettype($this->json_s->decode($this->obj_j)), "checking whether decoded type is object");
            $this->assertEquals('array',  gettype($this->json_l->decode($this->obj_j)), "checking whether decoded type is array");
        }

        function test_to_JSON()
        {
            $this->assertEquals($this->obj1_j, $this->json_s->encode($this->obj1), "object - strict: {$this->obj1_d}");
            $this->assertEquals($this->obj1_j, $this->json_l->encode($this->obj1), "object - loose: {$this->obj1_d}");
        }

        function test_from_then_to_JSON()
        {
            $this->assertEquals($this->obj_j, $this->json_s->encode($this->json_s->decode($this->obj_j)), "object case");
            $this->assertEquals($this->obj_j, $this->json_l->encode($this->json_l->decode($this->obj_j)), "array case");
        }
    }

    class Services_JSON_Spaces_Comments_TestCase extends PHPUnit_TestCase {

        function Services_JSON_Spaces_Comments_TestCase($name) {
            $this->PHPUnit_TestCase($name);
        }

        function setUp() {
            $this->json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);

            $this->obj_j = '{"a_string":"\"he\":llo}:{world","an_array":[1,2,3],"obj":{"a_number":123}}';

            $this->obj_js = '{"a_string": "\"he\":llo}:{world",
                              "an_array":[1, 2, 3],
                              "obj": {"a_number":123}}';

            $this->obj_jc1 = '{"a_string": "\"he\":llo}:{world",
                              // here is a comment, hoorah
                              "an_array":[1, 2, 3],
                              "obj": {"a_number":123}}';

            $this->obj_jc2 = '/* this here is the sneetch */ "the sneetch"
                              // this has been the sneetch.';

            $this->obj_jc3 = '{"a_string": "\"he\":llo}:{world",
                              /* here is a comment, hoorah */
                              "an_array":[1, 2, 3 /* and here is another */],
                              "obj": {"a_number":123}}';

            $this->obj_jc4 = '{\'a_string\': "\"he\":llo}:{world",
                              /* here is a comment, hoorah */
                              \'an_array\':[1, 2, 3 /* and here is another */],
                              "obj": {"a_number":123}}';
        }

        function test_spaces()
        {
            $this->assertEquals($this->json->decode($this->obj_j), $this->json->decode($this->obj_js), "checking whether notation with spaces works");
        }

        function test_comments()
        {
            $this->assertEquals($this->json->decode($this->obj_j), $this->json->decode($this->obj_jc1), "checking whether notation with single line comments works");
            $this->assertEquals('the sneetch', $this->json->decode($this->obj_jc2), "checking whether notation with multiline comments works");
            $this->assertEquals($this->json->decode($this->obj_j), $this->json->decode($this->obj_jc3), "checking whether notation with multiline comments works");
            $this->assertEquals($this->json->decode($this->obj_j), $this->json->decode($this->obj_jc4), "checking whether notation with single-quotes and multiline comments works");
        }
    }

    class Services_JSON_Empties_TestCase extends PHPUnit_TestCase {

        function Services_JSON_Empties_TestCase($name) {
            $this->PHPUnit_TestCase($name);
        }

        function setUp() {
            $this->json_l = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
            $this->json_s = new Services_JSON();

            $this->obj0_j = '{}';
            $this->arr0_j = '[]';

            $this->obj1_j = '{ }';
            $this->arr1_j = '[ ]';

            $this->obj2_j = '{ /* comment inside */ }';
            $this->arr2_j = '[ /* comment inside */ ]';
        }

        function test_type()
        {
            $this->assertEquals('array',   gettype($this->json_l->decode($this->arr0_j)), "should be array");
            $this->assertEquals('object',  gettype($this->json_s->decode($this->obj0_j)), "should be object");

            $this->assertEquals(0,  count($this->json_l->decode($this->arr0_j)), "should be empty array");
            $this->assertEquals(0,  count(get_object_vars($this->json_s->decode($this->obj0_j))), "should be empty object");

            $this->assertEquals('array',   gettype($this->json_l->decode($this->arr1_j)), "should be array, even with space");
            $this->assertEquals('object',  gettype($this->json_s->decode($this->obj1_j)), "should be object, even with space");

            $this->assertEquals(0,  count($this->json_l->decode($this->arr1_j)), "should be empty array, even with space");
            $this->assertEquals(0,  count(get_object_vars($this->json_s->decode($this->obj1_j))), "should be empty object, even with space");

            $this->assertEquals('array',   gettype($this->json_l->decode($this->arr2_j)), "should be array, despite comment");
            $this->assertEquals('object',  gettype($this->json_s->decode($this->obj2_j)), "should be object, despite comment");

            $this->assertEquals(0,  count($this->json_l->decode($this->arr2_j)), "should be empty array, despite comment");
            $this->assertEquals(0,  count(get_object_vars($this->json_s->decode($this->obj2_j))), "should be empty object, despite commentt");
        }
    }

    class Services_JSON_UnquotedKeys_TestCase extends PHPUnit_TestCase {

        function Services_JSON_UnquotedKeys_TestCase($name) {
            $this->PHPUnit_TestCase($name);
        }

        function setUp() {
            $this->json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);

            $this->arn = array(0=> array(0=> 'tan', 'model' => 'sedan'), 1 => array(0 => 'red', 'model' => 'sports'));
            $this->arn_ja = '[{0:"tan","model":"sedan"},{"0":"red",model:"sports"}]';
            $this->arn_d = 'associative array with unquoted keys, nested associative arrays, and some numeric keys thrown in';

            $this->arrs = array (1 => 'one', 2 => 'two', 5 => 'fi"ve');
            $this->arrs_jo = '{"1":"one",2:"two","5":\'fi"ve\'}';
            $this->arrs_d = 'associative array with unquoted keys, single-quoted values, numeric keys which are not fully populated in a range of 0 to length-1';
        }

        function test_from_JSON()
        {
            // ...unless the input array has some numeric indeces, in which case the behavior is to degrade to a regular array
            $this->assertEquals($this->arn, $this->json->decode($this->arn_ja), "array case - strict: {$this->arn_d}");

            // Test a sparsely populated numerically indexed associative array
            $this->assertEquals($this->arrs, $this->json->decode($this->arrs_jo), "sparse numeric assoc array: {$this->arrs_d}");
        }
    }

    class Services_JSON_ErrorSuppression_TestCase extends PHPUnit_TestCase {

        function Services_JSON_ErrorSuppression_TestCase($name) {
            $this->PHPUnit_TestCase($name);
        }

        function setUp() {
            $this->json = new Services_JSON();
            $this->json_ = new Services_JSON(SERVICES_JSON_SUPPRESS_ERRORS);

            $this->res = tmpfile();
            $this->res_j_ = 'null';
            $this->res_d = 'naked resource';

            $this->arr = array('a', 1, tmpfile());
            $this->arr_j_ = '["a",1,null]';
            $this->arr_d = 'array with string, number and resource';

            $obj = new stdClass();
            $obj->a_string = '"he":llo}:{world';
            $obj->an_array = array(1, 2, 3);
            $obj->resource = tmpfile();

            $this->obj = $obj;
            $this->obj_j_ = '{"a_string":"\"he\":llo}:{world","an_array":[1,2,3],"resource":null}';
            $this->obj_d = 'object with properties, array, and nested resource';
        }

        function test_to_JSON()
        {
            $this->assertTrue(Services_JSON::isError($this->json->encode($this->res)), "resource case: {$this->res_d}");
            $this->assertTrue(Services_JSON::isError($this->json->encode($this->arr)), "array case: {$this->arr_d}");
            $this->assertTrue(Services_JSON::isError($this->json->encode($this->obj)), "object case: {$this->obj_d}");
        }

        function test_to_JSON_suppressed()
        {
            $this->assertEquals($this->res_j_, $this->json_->encode($this->res), "resource case: {$this->res_d}");
            $this->assertEquals($this->arr_j_, $this->json_->encode($this->arr), "array case: {$this->arr_d}");
            $this->assertEquals($this->obj_j_, $this->json_->encode($this->obj), "object case: {$this->obj_d}");
        }
    }

    $suite  = new PHPUnit_TestSuite('Services_JSON_EncDec_TestCase');
    $result = PHPUnit::run($suite);
    echo $result->toString();

    $suite  = new PHPUnit_TestSuite('Services_JSON_AssocArray_TestCase');
    $result = PHPUnit::run($suite);
    echo $result->toString();

    $suite  = new PHPUnit_TestSuite('Services_JSON_NestedArray_TestCase');
    $result = PHPUnit::run($suite);
    echo $result->toString();

    $suite  = new PHPUnit_TestSuite('Services_JSON_Object_TestCase');
    $result = PHPUnit::run($suite);
    echo $result->toString();

    $suite  = new PHPUnit_TestSuite('Services_JSON_Spaces_Comments_TestCase');
    $result = PHPUnit::run($suite);
    echo $result->toString();

    $suite  = new PHPUnit_TestSuite('Services_JSON_Empties_TestCase');
    $result = PHPUnit::run($suite);
    echo $result->toString();

    $suite  = new PHPUnit_TestSuite('Services_JSON_UnquotedKeys_TestCase');
    $result = PHPUnit::run($suite);
    echo $result->toString();

    $suite  = new PHPUnit_TestSuite('Services_JSON_ErrorSuppression_TestCase');
    $result = PHPUnit::run($suite);
    echo $result->toString();

?>


text:
package android.nized.org.orgnized;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.nized.org.domain.ClassBonus;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.text.Layout;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;

/**
 * Created by greg on 4/22/15.
 */
public class ClassBonusDialogFragment extends DialogFragment {
    // Use this instance of the interface to deliver action events
    NoticeDialogListener mListener;

    public interface NoticeDialogListener {
        public void onDialogPositiveClick(DialogFragment dialog, ClassBonus classBonus);
    }

    // Override the Fragment.onAttach() method to instantiate the NoticeDialogListener
    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        // Verify that the host activity implements the callback interface
        try {
            // Instantiate the NoticeDialogListener so we can send events to the host
            mListener = (NoticeDialogListener) activity;
        } catch (ClassCastException e) {
            // The activity doesn't implement the interface, throw exception
            throw new ClassCastException(activity.toString()
                    + " must implement NoticeDialogListener");
        }
    }

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        // Get the layout inflater
        LayoutInflater inflater = getActivity().getLayoutInflater();
        final View layout = inflater.inflate(R.layout.dialog_classbonus, null);

        // Inflate and set the layout for the dialog
        // Pass null as the parent view because its going in the dialog layout
        builder.setView(layout)
                // Add action buttons
                .setPositiveButton(R.string.submit_button, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int id) {
                        // Send the positive button event back to the host activity
                        String classBonusStr = ((EditText) layout.findViewById(R.id.classBonusET)).getText().toString();
                        classBonusStr = classBonusStr.replace(" ", "").toUpperCase();
                        String spinnerStr = ((Spinner) layout.findViewById(R.id.classBonusSpinner)).getSelectedItem().toString();
                        ClassBonus classBonus = new ClassBonus();
                        classBonus.setCourseCode(classBonusStr);
                        classBonus.setSemester(spinnerStr);
                        classBonus.setEmail(ProfileFragment.mPerson.getEmail());
                        mListener.onDialogPositiveClick(ClassBonusDialogFragment.this, classBonus);
                    }
                })
                .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        ClassBonusDialogFragment.this.getDialog().cancel();
                    }
                });

        Spinner spinner = (Spinner) layout.findViewById(R.id.classBonusSpinner);
        ArrayAdapter adapter = new ArrayAdapter(getActivity(),
                        android.R.layout.simple_spinner_item,
                        getResources().getStringArray(R.array.semesters));
        spinner.setAdapter(adapter);

        return builder.create();
    }
}


text:
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;

namespace HockeyApp.Models.Migrations
{
    public partial class city_lat_rename : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.RenameColumn(
                name: "Lattitude",
                schema: "geo",
                table: "Cities",
                newName: "Latitude");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.RenameColumn(
                name: "Latitude",
                schema: "geo",
                table: "Cities",
                newName: "Lattitude");
        }
    }
}


text:
AURA ![travis-status](https://travis-ci.org/giagiannis/aura.svg?branch=master)
====

About
-----
AURA is an Openstack application deployment tool with error-recovery enhancements.

Video Demonstration
-------------------

In the following links you can view a video demonstration of AURA for a Wordpress and a Hadoop deployment:

[![AURA - Wordpress Installation](https://img.youtube.com/vi/lBAST5GPHaI/0.jpg)](http://www.youtube.com/watch?v=lBAST5GPHaI "AURA - Wordpress Installation")

[![AURA - Hadoop Installation](https://img.youtube.com/vi/jP3hmU7kvfk/0.jpg)](http://www.youtube.com/watch?v=jP3hmU7kvfk "AURA - Hadoop Installation")

Installation
------------
Fork this repository and install the requirements with pip:

```bash
pip install -r requirements.txt
```

You can then install the python egg with:

```bash
python setup.py install
```

This command only installs the CLI Client, as the Web Server is designed to be launched from inside the project root.

Usage
-----

To use AURA, you must do the following things:

 - Use an image that supports ssh as root with a private key (the path of which is provided to the configuration file).
 - Make sure that AURA runs on the same network as the VMs (OpenVPN can make the trick if not there by default).

### CLI Client
You can use the CLI client (bin/aura) to run in standalone mode.

Example:

```
bin/aura example/wordpress conf/aura.yml
```

Please see the `example/wordpress` directory in order to create applications of your own.

### Web Server
If you want an interactive usage, launch the Web Server with:

```
bin/aura-server conf/aura.yml
```

By default, the server is launched at `http://0.0.0.0:8080`, but feel free to change the host and/or port through the configuration file.

**WARNING:** this utilizes the Flask Development Server, really **NOT** recommended for production.

License
-------
Apache License 2.0, please see the [LICENSE](LICENSE) file for more details.

Contact
-------
Giannis Giannakopoulos, ggian@cslab.ece.ntua.gr


text:
<?xml version="1.0" encoding="utf-8"?>
<invoice>
  <header>
    <company>ABC PLC</company>
    <address1>121,J.B.Road</address1>
    <address2>121,J.B.Road</address2>
    <city>London</city>
    <country>UK</country>
    <zip>LS0 5TQ</zip>
    <email>sales@abcplcltd.com</email>
    <website>http://wwww.abcplc.co.uk</website>
  </header>
  <order orderid="10837" orderdate="1998-01-16T00:00:00">
    <shipping_details>
      <contact_person>Christina Berglund</contact_person>
      <company>Berglunds snabbköp</company>
      <address>Berguvsvägen  8</address>
      <city>Luleå</city>
      <zip>S-958 22</zip>
      <country>Sweden</country>
    </shipping_details>
    <orderdetails>
      <order_detail>
        <productid>13</productid>
        <description>Konbu</description>
        <unitprice>6.0000</unitprice>
        <quantity>6</quantity>
      </order_detail>
      <order_detail>
        <productid>40</productid>
        <description>Boston Crab Meat</description>
        <unitprice>18.4000</unitprice>
        <quantity>25</quantity>
      </order_detail>
      <order_detail>
        <productid>47</productid>
        <description>Zaanse koeken</description>
        <unitprice>9.5000</unitprice>
        <quantity>40</quantity>
      </order_detail>
      <order_detail>
        <productid>76</productid>
        <description>Lakkalikööri</description>
        <unitprice>18.0000</unitprice>
        <quantity>21</quantity>
      </order_detail>
    </orderdetails>
    <vat>250.800000</vat>
    <totalamount>1504.800000</totalamount>
  </order>
  <footer>Thank you for doing Business with us!</footer>
</invoice>


text:
<?php

namespace FS\Context\Support;

class ControllerResolver
{
    protected $controller;
    protected $context;
    protected $mapping;
    protected $afterCb = null;

    public function __construct($controller, $context, $mapping)
    {
        $this->controller = $controller;
        $this->context = $context;
        $this->mapping = $mapping;
    }

    public function before(callable $cb)
    {
        $cb($this->context);

        return $this;
    }

    public function dispatch($action, array $payload = [])
    {
        if (!isset($this->mapping[$action])) {
            return;
        }

        $ret = call_user_func_array([$this->controller, $this->mapping[$action]], array_merge([$this->context->_('\\FS\\Components\\Web\\RequestParam'), $this->context], $payload));

        if ($this->afterCb) {
            $cb = $this->afterCb;

            $cb($this->context);
        }

        return $ret;
    }

    public function after(callable $cb)
    {
        $this->afterCb = $cb;

        return $this;
    }
}


text:
#include <stdlib.h>
#include <string.h>
#include "ant_app.h"
#include "ble_serialization.h"
#include "ant_struct_serialization.h"
#include "cond_field_serialization.h"
#include "app_util.h"

uint32_t ant_active_search_sharing_cycles_set_req_enc(uint8_t          channel,
                                                      uint8_t          cycles,
                                                      uint8_t * const  p_buf,
                                                      uint32_t * const p_buf_len)
{
    uint32_t index = 0;
    uint32_t err_code = NRF_SUCCESS;

    SER_ASSERT_NOT_NULL(p_buf);
    SER_ASSERT_NOT_NULL(p_buf_len);

    p_buf[index++] = SVC_ANT_ACTIVE_SEARCH_SHARING_CYCLES_SET;
    p_buf[index++] = channel;
    p_buf[index++] = cycles;

    SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);

    *p_buf_len = index;

    return err_code;
}

uint32_t ant_active_search_sharing_cycles_set_rsp_dec(uint8_t const * const p_buf,
                                                      uint32_t              packet_len,
                                                      uint32_t * const      p_result_code)
{
    // Use the ble cmd rsp dec function because it is adequte to decode
    // the command response as it is the same for both ant and ble.
    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_ACTIVE_SEARCH_SHARING_CYCLES_SET, p_result_code);
}