text:
@import XCTest;

#import "UISegmentedControl+YHWHSegmentIndex.h"

@interface UISegmentedControl ()

// Expose private methods for testing
- (NSString *)yhwh_titleForSegmentAtIndex:(NSInteger)segment;
- (NSInteger)yhwh_segmentIndexWithTitle:(NSString *)title;

@end

@interface UISegmentedControlCategoryTests : XCTestCase

@end

@implementation UISegmentedControlCategoryTests

- (void)setUp
{
    [super setUp];
    // Put setup code here. This method is called before the invocation of each test
    // method in the class.
}

- (void)tearDown
{
    // Put teardown code here. This method is called after the invocation of each
    // test method in the class.
    [super tearDown];
}

#pragma mark - -yhwh_segmentIndexWithTitle: Tests

- (void)testThatYhwhSegmentIndexWithTitleHandlesNoSegments
{
    UISegmentedControl *sut = [[UISegmentedControl alloc] init];

    XCTAssertEqual([sut yhwh_segmentIndexWithTitle:@"No segment has this title"], UISegmentedControlNoSegment, @"title matched with no segments");
}

- (void)testThatYhwhSegmentIndexWithTitleHandlesEmptyTitle
{
    UISegmentedControl *sut = [[UISegmentedControl alloc] initWithItems:@[@"A", @"", @"C", @"D"]];

    XCTAssertEqual([sut yhwh_segmentIndexWithTitle:@""], 1, @"title matched wrong segment");
    XCTAssertEqual([sut yhwh_segmentIndexWithTitle:@"C"], 2, @"title matched wrong segment");
}

- (void)testThatYhwhSegmentIndexWithTitleHandlesNilValue
{
    UISegmentedControl *sut = [[UISegmentedControl alloc] initWithItems:@[@"A", @"", @"C", @"D"]];

    XCTAssertEqual([sut yhwh_segmentIndexWithTitle:nil], UISegmentedControlNoSegment, @"title matched wrong segment");
}

- (void)testThatYhwhSegmentIndexWithTitleHandlesNoMatchingTitle
{
    UISegmentedControl *sut = [[UISegmentedControl alloc] initWithItems:@[@"A", @"B", @"C", @"D"]];

    XCTAssertEqual([sut yhwh_segmentIndexWithTitle:@"E"], UISegmentedControlNoSegment, @"title matched with no matching segment");
}

- (void)testThatYhwhSegmentIndexWithTitleHandlesANilTitle
{
    UISegmentedControl *sut = [[UISegmentedControl alloc] initWithItems:@[@"A", @"B", @"C", @"D"]];

    [sut setTitle:nil forSegmentAtIndex:1];
    XCTAssertEqual([sut yhwh_segmentIndexWithTitle:@"C"], 2, @"segment index does not match title");
}

- (void)testThatYhwhSegmentIndexWithTitleHandlesMultipleMatches
{
    UISegmentedControl *sut = [[UISegmentedControl alloc] initWithItems:@[@"A", @"B", @"B", @"A"]];

    XCTAssertEqual([sut yhwh_segmentIndexWithTitle:@"B"], 1, @"title matched wrong segment");
}

- (void)testThatYhwhSegmentIndexWithTitleHandlesMatchForNumberOfSegments
{
    UISegmentedControl *sut = [[UISegmentedControl alloc] initWithItems:@[@"ABC", @"DEF", @"GHI", @"JKL", @"MNO"]];

    XCTAssertEqual([sut yhwh_segmentIndexWithTitle:@"ABC"], 0, @"title did not match segment 0");
    XCTAssertEqual([sut yhwh_segmentIndexWithTitle:@"DEF"], 1, @"title did not match segment 1");
    XCTAssertEqual([sut yhwh_segmentIndexWithTitle:@"GHI"], 2, @"title did not match segment 2");
    XCTAssertEqual([sut yhwh_segmentIndexWithTitle:@"JKL"], 3, @"title did not match segment 3");
    XCTAssertEqual([sut yhwh_segmentIndexWithTitle:@"MNO"], 4, @"title did not match segment 4");
}

#pragma mark - -yhwh_titleForSegmentAtIndex: Tests

- (void)testThatYhwhTitleForSegmentAtIndexHandlesNoSegments
{
    UISegmentedControl *sut = [[UISegmentedControl alloc] init];

    XCTAssertNil([sut yhwh_titleForSegmentAtIndex:0], @"title returned with no segments");
}

- (void)testThatYhwhTitleForSegmentAtIndexHandlesLowOutOfRange
{
    UISegmentedControl *sut = [[UISegmentedControl alloc] initWithItems:@[@"A"]];

    XCTAssertNil([sut yhwh_titleForSegmentAtIndex:-1], @"title returned for segment index < 0");
}

- (void)testThatYhwhTitleForSegmentAtIndexHandlesHighOutOfRange
{
    UISegmentedControl *sut = [[UISegmentedControl alloc] initWithItems:@[@"A"]];

    XCTAssertNil([sut yhwh_titleForSegmentAtIndex:1], @"title returned for segment index > number of segments");
}

- (void)testThatYhwhTitleForSegmentAtIndexHandlesNilTitle
{
    UISegmentedControl *sut = [[UISegmentedControl alloc] init];

    [sut insertSegmentWithTitle:nil atIndex:0 animated:NO];
    XCTAssertNil([sut yhwh_titleForSegmentAtIndex:0], @"title returned for segment with nil title");
}

- (void)testThatYhwhTitleForSegmentAtIndexHandlesTitleForNumberOfSegments
{
    UISegmentedControl *sut = [[UISegmentedControl alloc] initWithItems:@[@"000", @"111", @"222", @"333", @"444"]];

    XCTAssertEqualObjects([sut yhwh_titleForSegmentAtIndex:3], @"333", @"wrong title for segment at index 3");
    XCTAssertEqualObjects([sut yhwh_titleForSegmentAtIndex:0], @"000", @"wrong title for segment at index 0");
    XCTAssertEqualObjects([sut yhwh_titleForSegmentAtIndex:1], @"111", @"wrong title for segment at index 1");
    XCTAssertEqualObjects([sut yhwh_titleForSegmentAtIndex:4], @"444", @"wrong title for segment at index 4");
    XCTAssertEqualObjects([sut yhwh_titleForSegmentAtIndex:2], @"222", @"wrong title for segment at index 2");
}

#pragma mark - -yhwh_selectSegmentWithTitle: Tests

- (void)testThatYhwhSelectSegmentWithTitleHandlesNoSegments
{
    UISegmentedControl *sut = [[UISegmentedControl alloc] init];

    [sut yhwh_selectSegmentWithTitle:@"No segment has this title"];
    XCTAssertEqual([sut selectedSegmentIndex], UISegmentedControlNoSegment, @"selected segment when no segments exist");
}

- (void)testThatYhwhSelectSegmentWithTitleHandlesEmptyTitle
{
    UISegmentedControl *sut = [[UISegmentedControl alloc] initWithItems:@[@"A", @"", @"C", @"D"]];

    [sut yhwh_selectSegmentWithTitle:@""];
    XCTAssertEqual([sut selectedSegmentIndex], 1, @"selected segment is not segment 1");

    [sut yhwh_selectSegmentWithTitle:@"C"];
    XCTAssertEqual([sut selectedSegmentIndex], 2, @"selected segment is not segment 2");
}

- (void)testThatYhwhSelectSegmentWithTitleHandlesDefaultSelectionDespiteNilValue
{
    UISegmentedControl *sut = [[UISegmentedControl alloc] initWithItems:@[@"A", @"", @"C", @"D"]];

    [sut yhwh_selectSegmentWithTitle:nil];
    // No segments match.  The first segment will be selected by default.
    XCTAssertEqual([sut selectedSegmentIndex], 0, @"did not select segment 0 when no title was provided");
}

- (void)testThatYhwhSelectSegmentWithTitleHandlesDefaultSelectionDespiteNoMatchingTitle
{
    UISegmentedControl *sut = [[UISegmentedControl alloc] initWithItems:@[@"A", @"B", @"C", @"D"]];

    [sut yhwh_selectSegmentWithTitle:@"E"];
    // No segments match.  The first segment will be selected by default.
    XCTAssertEqual([sut selectedSegmentIndex], 0, @"did not select segment 0 when no title matched");
}

- (void)testThatYhwhSelectSegmentWithTitleHandlesMultipleMatches
{
    UISegmentedControl *sut = [[UISegmentedControl alloc] initWithItems:@[@"A", @"B", @"B", @"A"]];

    [sut yhwh_selectSegmentWithTitle:@"B"];
    XCTAssertEqual([sut selectedSegmentIndex], 1, @"selected segment is not segment 1");
}

- (void)testThatYhwhSelectSegmentWithTitleHandlesMatchForNumberOfSegments
{
    UISegmentedControl *sut = [[UISegmentedControl alloc] initWithItems:@[@"ABC", @"DEF", @"GHI", @"JKL", @"MNO"]];

    [sut yhwh_selectSegmentWithTitle:@"DEF"];
    XCTAssertEqual([sut selectedSegmentIndex], 1, @"selected segment is not segment 1");

    [sut yhwh_selectSegmentWithTitle:@"JKL"];
    XCTAssertEqual([sut selectedSegmentIndex], 3, @"selected segment is not segment 3");

    [sut yhwh_selectSegmentWithTitle:@"ABC"];
    XCTAssertEqual([sut selectedSegmentIndex], 0, @"selected segment is not segment 0");

    [sut yhwh_selectSegmentWithTitle:@"MNO"];
    XCTAssertEqual([sut selectedSegmentIndex], 4, @"selected segment is not segment 4");

    [sut yhwh_selectSegmentWithTitle:@"GHI"];
    XCTAssertEqual([sut selectedSegmentIndex], 2, @"selected segment is not segment 2");

    [sut yhwh_selectSegmentWithTitle:@"XYZ"];
    XCTAssertEqual([sut selectedSegmentIndex], 0, @"selected segment is not segment 0");
}

#pragma mark - -yhwh_titleForSelectedSegment Tests

- (void)testThatYhwhTitleForSelectedSegmentHandlesNoSegments
{
    UISegmentedControl *sut = [[UISegmentedControl alloc] init];

    XCTAssertNil([sut yhwh_titleForSelectedSegment], @"title returned with no segments");
}

- (void)testThatYhwhTitleForSelectedSegmentHandlesNilTitle
{
    UISegmentedControl *sut = [[UISegmentedControl alloc] init];

    [sut insertSegmentWithTitle:nil atIndex:0 animated:NO];
    [sut setSelectedSegmentIndex:0];

    XCTAssertNil([sut yhwh_titleForSelectedSegment], @"title returned for segment with nil title");
}

- (void)testThatYhwhTitleForSelectedSegmentHandlesNoSelectedSegment
{
    UISegmentedControl *sut = [[UISegmentedControl alloc] initWithItems:@[@"A", @"B", @"C", @"D"]];

    XCTAssertNil([sut yhwh_titleForSelectedSegment], @"title returned for no selected segment");
}

- (void)testThatYhwhTitleForSelectedSegmentHandlesNumberOfSegments
{
    UISegmentedControl *sut = [[UISegmentedControl alloc] initWithItems:@[@"ABC", @"DEF", @"GHI", @"JKL", @"MNO"]];

    [sut setSelectedSegmentIndex:1];
    XCTAssertEqualObjects([sut yhwh_titleForSelectedSegment], @"DEF", @"wrong title for selected segment 1");

    [sut setSelectedSegmentIndex:3];
    XCTAssertEqualObjects([sut yhwh_titleForSelectedSegment], @"JKL", @"wrong title for selected segment 3");

    [sut setSelectedSegmentIndex:0];
    XCTAssertEqualObjects([sut yhwh_titleForSelectedSegment], @"ABC", @"wrong title for selected segment 0");

    [sut setSelectedSegmentIndex:4];
    XCTAssertEqualObjects([sut yhwh_titleForSelectedSegment], @"MNO", @"wrong title for selected segment 4");

    [sut setSelectedSegmentIndex:2];
    XCTAssertEqualObjects([sut yhwh_titleForSelectedSegment], @"GHI", @"wrong title for selected segment 2");

    [sut setSelectedSegmentIndex:-1];
    XCTAssertNil([sut yhwh_titleForSelectedSegment], @"wrong title for no selected segment");
}

// No code depends on these behaviors

#pragma mark - -setSelectedSegment: Behavior Tests

- (void)testThatSelectionDoesNotChangeWhenSetSelectedSegmentValueIsOutOfBounds
{
    UISegmentedControl *sut = [[UISegmentedControl alloc] initWithItems:@[@"Apple", @"Orange", @"Pear"]];

    [sut setSelectedSegmentIndex:1];
    [sut setSelectedSegmentIndex:999];
    XCTAssertEqual([sut selectedSegmentIndex], 1, @"selected segment changed");
}

- (void)testThatSelectionIsClearedWhenSelectedSegmentIsRemoved
{
    UISegmentedControl *sut = [[UISegmentedControl alloc] initWithItems:@[@"Apple", @"Orange", @"Pear"]];

    [sut setSelectedSegmentIndex:2];
    [sut removeSegmentAtIndex:2 animated:NO];
    XCTAssertEqual([sut selectedSegmentIndex], UISegmentedControlNoSegment, @"selected segment not cleared");
}

@end


text:
package org.ovirt.engine.ui.webadmin.widget.alert;

import org.ovirt.engine.ui.webadmin.ApplicationResources;
import org.ovirt.engine.ui.webadmin.gin.AssetProvider;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Widget;

/**
 * A composite panel that contains the alert icon and the widget provided
 * by the caller, both rendered horizontally
 */
public class InLineAlertWidget extends FlowPanel {
    private static final ApplicationResources resources = AssetProvider.getResources();

    public static enum AlertType {
        ALERT(resources.alertImage()),
        UPDATE_AVAILABLE(resources.updateAvailableImage());

        private ImageResource imageResource;

        private AlertType(ImageResource imageResource) {
            this.imageResource = imageResource;
        }

        public ImageResource getImageResource() {
            return imageResource;
        }
    }

    public InLineAlertWidget(Widget fromWidget) {
        this(fromWidget, AlertType.ALERT);
    }

    public InLineAlertWidget(Widget fromWidget, AlertType type) {
        Image alertIcon = new Image(type.getImageResource());
        alertIcon.getElement().getStyle().setProperty("display", "inline"); //$NON-NLS-1$ //$NON-NLS-2$
        fromWidget.getElement().getStyle().setProperty("display", "inline"); //$NON-NLS-1$ //$NON-NLS-2$
        add(alertIcon);
        add(fromWidget);
    }
}

redpajama_set_name: RedPajamaGithub


text:
require 'puppet/property/netscaler_truthy'

Puppet::Type.newtype(:netscaler_servicegroup_member) do
  @doc = 'Manage a member of a servicegroup.'

  apply_to_device
  ensurable

  newparam(:name, :namevar => true) do
    desc "servicegroup_name/server_name:server_port"
    validate do |value|
      # This should validate that port is a port
    end
  end

  newproperty(:weight) do
    desc "Weight to assign to the servers in the service group. Specifies the capacity of the servers relative to the other servers in the load balancing configuration. The higher the weight, the higher the percentage of requests sent to the service.

    Min = 1
    Max = 100"
    newvalues(/^\d+$/)
    munge do |value|
      Integer(value)
    end
  end

  newproperty(:state, :parent => Puppet::Property::NetscalerTruthy) do
    truthy_property('The configured state (enable/disable) of the service group.','ENABLED','DISABLED')
  end

  autorequire(:netscaler_servicegroup) do
    self[:name].split('/')[0]
  end
  autorequire(:netscaler_server) do
    self[:name].split('/')[1].split(':')[0]
  end
end


text:
namespace core {

class VolatileBuffer : virtual public IReadBuffer
{
  ////////////////////////////////////////////////////////////////
  // Members
  ////////////////////////////////////////////////////////////////
  private:
    /// The volatile buffer
    const Buffer* pBuffer_;

    /// The size of the buffer
    const size_t uiSize_;

    /// The current position
    size_t uiPos_;

  ////////////////////////////////////////////////////////////////
  // Constructors & Destructor
  ////////////////////////////////////////////////////////////////
  public:
    VolatileBuffer(const Buffer* pBuffer, size_t uiSize);
    VolatileBuffer(const IReadBuffer& buffer);
    VolatileBuffer(const VolatileBuffer& buffer);

    virtual ~VolatileBuffer() {}

  ////////////////////////////////////////////////////////////////
  // Operators
  ////////////////////////////////////////////////////////////////

  ////////////////////////////////////////////////////////////////
  // Functions
  ////////////////////////////////////////////////////////////////
  public:
    /// Is the buffer empty ?
    /// Return true if size() == 0
    virtual bool isEmpty() const { return uiSize_ == 0; }

    /// Direct access to buffer
    virtual const Buffer* getBuffer() const { return pBuffer_; }

    /// Get the position of the buffer's cursor
    virtual size_t getPosition() const { return uiPos_; }

    /// Read N characters
    virtual void readData(Buffer* pBuffer, size_t uiSize);

    /// Set the position of the buffer's cursor
    /// @param uiNewPos the position; uiSize if uiNewPos >= uiSize
    void setPosition(size_t uiNewPos);

    /// Get the current size of the buffer
    virtual size_t getSize() const { return uiSize_; }
};

}


text:
import random
import time

def displayIntro():
    print('You are in a land full of dragons. In front of you,')
    print('you see two caves. In one cave, the dragon is friendly')
    print('and will share his treasure with you. The other dragon')
    print('is greedy and hungry, and will eat you on sight.')
    print()

def chooseCave():
    cave = ''
    while cave != '1' and cave != '2':
        print('Which cave will you go into? (1 or 2)')
        cave = input()

    return cave

def checkCave(chosenCave):
    print('You approach the cave...')
    time.sleep(2)
    print('It is dark and spooky...')
    time.sleep(2)
    print('A large dragon jumps out in front of you! He opens his jaws and...')
    print()
    time.sleep(2)

    friendlyCave = random.randint(1, 2)

    if chosenCave == str(friendlyCave):
         print('Gives you his treasure!')
    else:
         print('Gobbles you down in one bite!')

playAgain = 'yes'
while playAgain == 'yes' or playAgain == 'y':

    displayIntro()

    caveNumber = chooseCave()

    checkCave(caveNumber)

    print('Do you want to play again? (yes or no)')
    playAgain = input()


text:
Input:
;
//Testing two

//// [commentsAtEndOfFile1.js]
Input: ;
//Testing two


text:
(function (can) {
  'use strict';

  GGRC.Components('infoPinButtons', {
    tag: 'info-pin-buttons',
    template: can.view(
      GGRC.mustache_path +
      '/components/info-pin-buttons/info-pin-buttons.mustache'
    ),
    scope: {
      onChangeMaximizedState: null,
      onClose: null,
      define: {
        maximized: {
          type: 'boolean',
          'default': false
        }
      },
      toggleSize: function (scope, el, ev) {
        var maximized = !this.attr('maximized');
        var onChangeMaximizedState = Mustache.resolve(this.onChangeMaximizedState);
        ev.preventDefault();
        this.attr('maximized', maximized);
        onChangeMaximizedState(maximized);
      },
      close: function (scope, el, ev) {
        var onClose = Mustache.resolve(this.onClose);
        el.find('[rel=tooltip]').data('tooltip').hide();
        ev.preventDefault();
        onClose();
      }
    }
  }, true);
})(window.can);


text:
<meta http-equiv="Content-Language" content="zh-CN" />
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="generator" content="oblog" />
<meta name="author" content="tests,¹úÍâͶ×ÊÕß" />
<meta name="keyword" content="ccccccc" />
<meta name="description" content="500){this.resized=true;this.style.width=500;}">" />
<title>ccccccc--tests</title>
<link rel="alternate" href="/homestay/tests/rss2.xml" type="application/rss+xml" title="RSS" />
<link href="/OblogStyle/OblogUserDefault31.css" rel="stylesheet" type="text/css" />

Calendar

homestay :-)  loading ... ...

Placard

homestay :-)  loading ... ...

Category

homestay :-)  loading ... ...

Latest Entries

homestay :-)  loading ... ...

Latest Comments

homestay :-)  loading ... ...

Last Messages

homestay :-)  loading ... ...

User Login

Links

homestay :-)  loading ... ...

Information

homestay :-)  loading ... ...

Search

homestay :-)  loading ... ...

Other

Welcome to my blog!

  ccccccc

  500){this.resized=true;this.style.width=500;}">

[ ÔĶÁÈ«ÎÄ | »Ø¸´(0) | ÒýÓÃͨ¸æ | ±à¼ ]

  Post  by  ¹úÍâͶ×ÊÕß ·¢²¼ÓÚ 2007-6-18 13:55:00

ÉÏһƪ£ºsafasfsdf

ÏÂһƪ£ºasd

·¢²¼ÆÀÂÛ£º

<form action='/savecomment.asp?logid=19' method='post' name='commentform' id='commentform' onSubmit='return Verifycomment()'>

êdzƣº<input name='UserName' type='text' id='UserName' size='15' maxlength='20' value='' />

ÃÜÂ룺<input name='Password' type='password' id='Password' size='15' maxlength='20' value='' /> (ÓοÍÎÞÐëÊäÈëÃÜÂë)

Ö÷Ò³£º<input name='homepage' type='text' id='homepage' size='42' maxlength='50' value='http://' />

±êÌ⣺<input name='commenttopic' type='text' id='commenttopic' size='42' maxlength='50' value='Re:ccccccc' />

<input type='hidden' name='edit' id='edit' value='' />

homestay :-)  loading ... ...

<input type='submit' value=' Ìá½» '>

</form>

homestay :-)  loading ... ...


text:
FROM gcc:10

RUN apt-get update && apt-get install -y \
    socat

WORKDIR /challenge

# Copy in source file
COPY vuln.c /challenge/vuln.c

# Compile with mitigations disabled
RUN gcc vuln.c -o vuln -fno-stack-protector -z execstack -no-pie

# FLAG is passed in as a BUILD_ARG in `initialize_docker`
# this is an alternative to using picoCTF templating
ARG FLAG
RUN echo ${FLAG} > /challenge/flag

EXPOSE 5555
CMD ["socat", "TCP-LISTEN:5555,reuseaddr,fork", "EXEC:/challenge/vuln"]


text:
title: "PuppetDB 4.1: Facts endpoint"
layout: default
canonical: "/puppetdb/latest/api/query/v4/facts.html"
---

[curl]: ../curl.html#using-curl-from-localhost-non-sslhttp
[paging]: ./paging.html
[query]: ./query.html
[subqueries]: ./ast.html#subquery-operators
[ast]: ./ast.html
[environments]: ./environments.html
[factsets]: ./factsets.html
[fact-contents]: ./fact_contents.html
[nodes]: ./nodes.html

You can query facts by making an HTTP request to the `/facts` endpoint.

In Puppet's world, you only interact with facts from one node at a time, so any given fact consists of only a **fact name** and a **value.** But since PuppetDB interacts with a whole population of nodes, each PuppetDB fact also includes a **certname** and an **environment.**

## `/pdb/query/v4/facts`

This will return all facts matching the given query. Facts for
deactivated nodes are not included in the response.

### URL parameters

* `query`: optional. A JSON array containing the query in prefix notation (`["<OPERATOR>", "<FIELD>", "<VALUE>"]`). See the sections below for the supported operators and fields. For general info about queries, see [our guide to query structure.][query]

If a query parameter is not provided, all results will be returned.

### Query operators

See [the AST query language page][ast].

### Query fields

* `name` (string): the name of the fact.
* `value` (string, numeric, Boolean): the value of the fact.
* `certname` (string): the node associated with the fact.
* `environment` (string): the environment associated with the fact.

### Subquery relationships

The following list contains related entities that can be used to constrain the result set using implicit subqueries. For more information, consult the documentation for [subqueries][subqueries].

* [`environments`][environments]: the environment where a fact occurs.
* [`factsets`][factsets]: the factset where a fact appears.
* [`fact_contents`][fact-contents]: expanded fact paths and values for a fact.
* [`nodes`][nodes]: the node where a fact occurs.

### Response format

Successful responses will be in `application/json`. Errors will be returned as
non-JSON strings.

The result will be a JSON array, with one entry per fact. Each entry is of the form:

    {
      "certname": <node name>,
      "name": <fact name>,
      "value": <fact value>,
      "environment": <facts environment>
    }

The array is unsorted. Fact values can be strings, floats, integers, Booleans,
arrays, or maps. Map and array values can be any of the same types.

If no facts match the query, an empty JSON array will be returned. Querying
against `value` will return matches only at the top level. Hashes and arrays cannot
be matched.

### Examples

[Using `curl` from localhost][curl]:

Get the operatingsystem fact for all nodes:

    curl -X GET http://localhost:8080/pdb/query/v4/facts \
      --data-urlencode 'query=["=", "name", "operatingsystem"]'

    [{"certname": "a.example.com", "name": "operatingsystem", "value": "Debian"},
     {"certname": "b.example.com", "name": "operatingsystem", "value": "RedHat"},
     {"certname": "c.example.com", "name": "operatingsystem", "value": "Darwin"}]

Get all facts for a single node:

    curl -X GET http://localhost:8080/pdb/query/v4/facts \
      --data-urlencode 'query=["=", "certname", "a.example.com"]'

    [{"certname": "a.example.com", "name": "operatingsystem", "value": "Debian"},
     {"certname": "a.example.com", "name": "ipaddress", "value": "192.168.1.105"},
     {"certname": "a.example.com", "name": "uptime_days", "value": "26 days"}]

Subquery against `/fact-contents` to get all remotely authenticated trusted facts:

    curl -X GET http://localhost:8080/pdb/query/v4/facts --data-urlencode \
      'query=["in", ["name","certname"],
               ["extract", ["name","certname"],
                 ["select_fact_contents",
                   ["and", ["=", "path", ["trusted", "authenticated"]],
                           ["=","value","remote"]]]]]]]'

    [ {
        "value" : {
            "certname" : "desktop.localdomain",
            "authenticated" : "remote"
        },
        "name" : "trusted",
        "environment" : "production",
        "certname" : "desktop.localdomain"
    } ]

Use `count` and `group_by` to get tallies of each operating system in your
infrastructure:

    curl -X GET http://localhost:8080/pdb/query/v4/facts \
      --data-urlencode 'query=["extract", [["function","count"],"value"],
                                ["=","name","operatingsystem"],
                                ["group_by", "value"]]'

    [ {
        "value" : "Debian",
        "count" : 67
    }, {
        "value" : "CentOS",
        "count" : 33
    } ]

Use the `avg` function and the `group_by` operator to get the average uptime
for your nodes by environment:

    curl -X GET http://localhost:8080/pdb/query/v4/facts \
      --data-urlencode 'query=["extract", ["environment",["function","avg","value"]],
                                ["=","name","uptime_hours"],
                                ["group_by", "environment"]]'

    [ {
        "environment" : "production",
        "avg" : 116.92774910678841
    }, {
        "environment" : "dev",
        "avg" : 271.18281821459045
    } ]

## `/pdb/query/v4/facts/<FACT NAME>`

This will return all facts with the given fact name, for all nodes. It
behaves exactly like a call to `/pdb/query/v4/facts` with a query string of
`["=", "name", "<FACT NAME>"]`.

### URL parameters / query operators / query fields / response format

This route is an extension of the plain `facts` endpoint. It uses the exact same parameters, operators, fields, and response format.

If you provide a `query` parameter, it will specify additional criteria, which will be
used to return a subset of the information normally returned by this route.

### Examples

Get the operating system fact for all nodes:

    curl -X GET http://localhost:8080/pdb/query/v4/facts/operatingsystem

    [{"certname": "a.example.com", "name": "operatingsystem", "value": "Debian"},
     {"certname": "b.example.com", "name": "operatingsystem", "value": "Redhat"},
     {"certname": "c.example.com", "name": "operatingsystem", "value": "Ubuntu"}]

Get the partitions fact for a single node:

    curl -X GET http://localhost:8080/pdb/query/v4/facts/partitions \
      --data-urlencode 'query=["=", "certname", "a.example.com"]'

    [ {
      "value" : {
        "sda3" : {
          "size" : "174389248",
          "mount" : "/home",
          "uuid" : "26d79d9a-96b3-4cc7-960d-0d6558d7dc54"
        },
        "sda1" : {
          "size" : "1048576",
          "mount" : "/boot"
        },
        "sda2" : {
          "mount" : "/",
          "size" : "74629120",
          "uuid" : "30d0108f-ec67-4557-8331-09ebc8b937f9"
        }
      },
      "name" : "partitions",
      "environment" : "production",
      "certname" : "a.example.com"
    } ]

## `/pdb/query/v4/facts/<FACT NAME>/<VALUE>`

This will return all facts with the given fact name and value, for all
nodes. (That is, only the `certname` field will differ in each
result.) It behaves exactly like a call to `/pdb/query/v4/facts` with a query
string of:

    ["and",
        ["=", "name", "<FACT NAME>"],
        ["=", "value", "<VALUE>"]]

### URL parameters / query operators / query fields / response format

This route is an extension of the plain `facts` endpoint. It uses the same parameters, operators, fields, and response format.

If you provide a `query` parameter, it will specify additional criteria, which will be
used to return a subset of the information normally returned by
this route.

### Examples

    curl -X GET http://localhost:8080/pdb/query/v4/facts/operatingsystem/Debian

    [{"certname": "a.example.com", "name": "operatingsystem", "value": "Debian"},
     {"certname": "b.example.com", "name": "operatingsystem", "value": "Debian}]

## Paging

The v4 `/facts` endpoint does not allow ordering by fact value, but otherwise
supports the common PuppetDB paging URL parameters. For more information,
please see the documentation on [paging][paging]. Ordering by value is
supported on the fact-contents endpoint.


text:
/*
    This file is part of libcapwap.

    libcapwap is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    libcapwap is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Foobar.  If not, see <http://www.gnu.org/licenses/>.

*/

#include <stdint.h>

/*
 * Check if a string is printable (human readable)
 */
int cw_is_printable(const uint8_t * s,int len)
{
	int i;
	for (i=0; i<len; i++){
		if (s[i]<32 || s[i]>126)
			return 0;
	}
	return 1;
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:id="@+id/errorMessage"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        tools:text="Something is wrong with the network please try again later"
        android:layout_margin="15dp"/>

    <Button
        style="?borderlessButtonStyle"
        android:id="@+id/confirmationButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="#2196f3"
        tools:text="Okay"
        android:textSize="15sp"
        android:layout_gravity="right"
        />

</LinearLayout>


text:
// Provides control sap.m.CustomListItem.
sap.ui.define(['jquery.sap.global', './ListItemBase', './library'],
	function(jQuery, ListItemBase, library) {
	"use strict";

	/**
	 * Constructor for a new CustomListItem.
	 *
	 * @param {string} [sId] ID for the new control, generated automatically if no ID is given
	 * @param {object} [mSettings] Initial settings for the new control
	 *
	 * @class
	 * This control with a content aggregation can be used to customize standard list items that we don't provide. List mode and ListItem type are applied to CustomListItems as well.
	 * Note: Even though the content aggregation allows any control, complex responsive layout controls (e.g. Table, Form) should not be aggregated as content.
	 *
	 * @extends sap.m.ListItemBase
	 *
	 * @author SAP SE
	 * @version 1.42.8
	 *
	 * @constructor
	 * @public
	 * @alias sap.m.CustomListItem
	 * @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
	 */
	var CustomListItem = ListItemBase.extend("sap.m.CustomListItem", /** @lends sap.m.CustomListItem.prototype */ { metadata : {

		library : "sap.m",
		defaultAggregation : "content",
		aggregations : {

			/**
			 * The content of this list item
			 */
			content : {type : "sap.ui.core.Control", multiple : true, singularName : "content", bindable : "bindable"}
		},
		designTime: true
	}});

	return CustomListItem;

}, /* bExport= */ true);


text:
var result,
	cleanupPrerequisiteCount = 0,
	uuid = process.argv[ 2 ],
	terminationResourceHandleReceptacle = {},
	processCallCount = 0,
	processLoop = null,
	iotivity = require( process.argv[ 3 ] + "/lowlevel" ),
	testUtils = require( "../../utils" )( iotivity );

function cleanup() {
	if ( ++cleanupPrerequisiteCount < 2 ) {
		return;
	}

	if ( processLoop ) {
		clearInterval( processLoop );
		processLoop = null;
	}

	testUtils.assert( "ok", true, "RD Server: OCProcess succeeded " + processCallCount +
		" times" );

	if ( terminationResourceHandleReceptacle.handle &&
			!terminationResourceHandleReceptacle.handle.stale ) {
		testUtils.stackOKOrDie( "RD Server", "OCDeleteResource",
			iotivity.OCDeleteResource( terminationResourceHandleReceptacle.handle ) );
	}

	testUtils.stackOKOrDie( "RD Server", "OCRDStop", iotivity.OCRDStop() );
	testUtils.stackOKOrDie( "RD Server", "OCStop", iotivity.OCStop() );
	console.log( JSON.stringify( { killPeer: true } ) );
	process.exit( 0 );
}

console.log( JSON.stringify( { assertionCount: 8 } ) );

// Initialize
result = iotivity.OCRegisterPersistentStorageHandler( require( "../../../lib/StorageHandler" )() );
testUtils.stackOKOrDie( "RD Server", "OCRegisterPersistentStorageHandler", result );

result = iotivity.OCInit( null, 0, iotivity.OCMode.OC_SERVER );
testUtils.stackOKOrDie( "RD Server", "OCInit", result );

result = iotivity.OCRDStart();
testUtils.stackOKOrDie( "RD Server", "OCRDStart", result );

// Set up process loop
processLoop = setInterval( function() {
	var processResult = iotivity.OCProcess();

	if ( processResult === iotivity.OCStackResult.OC_STACK_OK ) {
		processCallCount++;
	} else {
		testUtils.stackOKOrDie(
			"RD Server",
			"OCProcess(after " + processCallCount + " successful calls)",
			processResult );
	}
}, 100 );

result = iotivity.OCCreateResource( terminationResourceHandleReceptacle,
	"core.light", "oic.if.baseline", "/a/" + uuid + "-xyzzy",
	function terminationResourceEntityHandler( flag, request ) {
		if ( request.resource === terminationResourceHandleReceptacle.handle &&
				request.method === iotivity.OCMethod.OC_REST_POST &&
				request.payload &&
				request.payload.type === iotivity.OCPayloadType.PAYLOAD_TYPE_REPRESENTATION &&
				request.payload.values.killPeer === true ) {
			cleanup();
		}
		return iotivity.OCEntityHandlerResult.OC_EH_OK;
	}, iotivity.OCResourceProperty.OC_DISCOVERABLE );
testUtils.stackOKOrDie( "RD Server", "OCCreateResource", result );

// Report that the server has successfully created its resource(s).
console.log( JSON.stringify( { ready: true } ) );


text:
/* This file provided by Facebook is for non-commercial testing and evaluation
 * purposes only.  Facebook reserves all rights not expressly granted.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

#import "ASDisplayNode.h"

@class ASCollectionNode;

@interface DetailRootNode : ASDisplayNode

@property (nonatomic, strong, readonly) ASCollectionNode *collectionNode;

- (instancetype)initWithImageCategory:(NSString *)imageCategory;

@end


text:
package androidx.navigation;

import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;

import android.content.Context;
import android.support.annotation.IdRes;
import android.support.test.filters.SmallTest;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import java.util.Arrays;
import java.util.Iterator;
import java.util.NoSuchElementException;

@SuppressWarnings("unchecked")
@RunWith(JUnit4.class)
@SmallTest
public class NavGraphTest {
    @IdRes
    private static final int FIRST_DESTINATION_ID = 1;
    @IdRes
    private static final int SECOND_DESTINATION_ID = 2;

    private NavGraphNavigator mNavGraphNavigator;

    @Before
    public void setup() {
        mNavGraphNavigator = new NavGraphNavigator(mock(Context.class));
    }

    private NavDestination createFirstDestination() {
        NavDestination destination = new NavDestination(mock(Navigator.class));
        destination.setId(FIRST_DESTINATION_ID);
        return destination;
    }

    private NavDestination createSecondDestination() {
        NavDestination destination = new NavDestination(mock(Navigator.class));
        destination.setId(SECOND_DESTINATION_ID);
        return destination;
    }

    private NavGraph createGraphWithDestination(NavDestination destination) {
        NavGraph graph = mNavGraphNavigator.createDestination();
        graph.addDestination(destination);
        return graph;
    }

    private NavGraph createGraphWithDestinations(NavDestination... destinations) {
        NavGraph graph = mNavGraphNavigator.createDestination();
        graph.addDestinations(destinations);
        return graph;
    }

    @Test(expected = IllegalArgumentException.class)
    public void addDestinationWithoutId() {
        NavGraph graph = mNavGraphNavigator.createDestination();
        NavDestination destination = new NavDestination(mock(Navigator.class));
        graph.addDestination(destination);
    }

    @Test
    public void addDestination() {
        NavDestination destination = createFirstDestination();
        NavGraph graph = createGraphWithDestination(destination);

        assertThat(destination.getParent(), is(graph));
        assertThat(graph.findNode(FIRST_DESTINATION_ID), is(destination));
    }

    @Test
    public void addDestinationsAsCollection() {
        NavGraph graph = mNavGraphNavigator.createDestination();
        NavDestination destination = createFirstDestination();
        NavDestination secondDestination = createSecondDestination();
        graph.addDestinations(Arrays.asList(destination, secondDestination));

        assertThat(destination.getParent(), is(graph));
        assertThat(graph.findNode(FIRST_DESTINATION_ID), is(destination));
        assertThat(secondDestination.getParent(), is(graph));
        assertThat(graph.findNode(SECOND_DESTINATION_ID), is(secondDestination));
    }

    @Test
    public void addDestinationsAsVarArgs() {
        NavDestination destination = createFirstDestination();
        NavDestination secondDestination = createSecondDestination();
        NavGraph graph = createGraphWithDestinations(destination, secondDestination);

        assertThat(destination.getParent(), is(graph));
        assertThat(graph.findNode(FIRST_DESTINATION_ID), is(destination));
        assertThat(secondDestination.getParent(), is(graph));
        assertThat(graph.findNode(SECOND_DESTINATION_ID), is(secondDestination));
    }

    @Test
    public void addReplacementDestination() {
        NavDestination destination = createFirstDestination();
        NavGraph graph = createGraphWithDestination(destination);

        NavDestination replacementDestination = new NavDestination(mock(Navigator.class));
        replacementDestination.setId(FIRST_DESTINATION_ID);
        graph.addDestination(replacementDestination);

        assertThat(destination.getParent(), nullValue());
        assertThat(replacementDestination.getParent(), is(graph));
        assertThat(graph.findNode(FIRST_DESTINATION_ID), is(replacementDestination));
    }

    @Test(expected = IllegalStateException.class)
    public void addDestinationWithExistingParent() {
        NavDestination destination = createFirstDestination();
        createGraphWithDestination(destination);

        NavGraph other = mNavGraphNavigator.createDestination();
        other.addDestination(destination);
    }

    @Test
    public void addAll() {
        NavDestination destination = createFirstDestination();
        NavGraph other = createGraphWithDestination(destination);

        NavGraph graph = mNavGraphNavigator.createDestination();
        graph.addAll(other);

        assertThat(destination.getParent(), is(graph));
        assertThat(graph.findNode(FIRST_DESTINATION_ID), is(destination));
        assertThat(other.findNode(FIRST_DESTINATION_ID), nullValue());
    }

    @Test
    public void removeDestination() {
        NavDestination destination = createFirstDestination();
        NavGraph graph = createGraphWithDestination(destination);

        graph.remove(destination);

        assertThat(destination.getParent(), nullValue());
        assertThat(graph.findNode(FIRST_DESTINATION_ID), nullValue());
    }

    @Test
    public void iterator() {
        NavDestination destination = createFirstDestination();
        NavDestination secondDestination = createSecondDestination();
        NavGraph graph = createGraphWithDestinations(destination, secondDestination);

        Iterator<NavDestination> iterator = graph.iterator();
        assertTrue(iterator.hasNext());
        assertThat(iterator.next(), anyOf(is(destination), is(secondDestination)));
        assertTrue(iterator.hasNext());
        assertThat(iterator.next(), anyOf(is(destination), is(secondDestination)));
        assertFalse(iterator.hasNext());
    }

    @Test(expected = NoSuchElementException.class)
    public void iteratorNoSuchElement() {
        NavDestination destination = createFirstDestination();
        NavGraph graph = createGraphWithDestination(destination);

        Iterator<NavDestination> iterator = graph.iterator();
        iterator.next();
        iterator.next();
    }

    @Test
    public void iteratorRemove() {
        NavDestination destination = createFirstDestination();
        NavGraph graph = createGraphWithDestination(destination);

        Iterator<NavDestination> iterator = graph.iterator();
        NavDestination value = iterator.next();
        iterator.remove();
        assertThat(value.getParent(), nullValue());
        assertThat(graph.findNode(value.getId()), nullValue());
    }

    @Test
    public void iteratorDoubleRemove() {
        NavDestination destination = createFirstDestination();
        NavDestination secondDestination = createSecondDestination();
        NavGraph graph = createGraphWithDestinations(destination, secondDestination);

        Iterator<NavDestination> iterator = graph.iterator();
        iterator.next();
        iterator.remove();
        NavDestination value = iterator.next();
        iterator.remove();
        assertThat(value.getParent(), nullValue());
        assertThat(graph.findNode(value.getId()), nullValue());
    }

    @Test(expected = IllegalStateException.class)
    public void iteratorDoubleRemoveWithoutNext() {
        NavDestination destination = createFirstDestination();
        NavDestination secondDestination = createSecondDestination();
        NavGraph graph = createGraphWithDestinations(destination, secondDestination);

        Iterator<NavDestination> iterator = graph.iterator();
        iterator.next();
        iterator.remove();
        iterator.remove();
    }

    @Test
    public void clear() {
        NavDestination destination = createFirstDestination();
        NavDestination secondDestination = createSecondDestination();
        NavGraph graph = createGraphWithDestinations(destination, secondDestination);

        graph.clear();
        assertThat(destination.getParent(), nullValue());
        assertThat(graph.findNode(FIRST_DESTINATION_ID), nullValue());
        assertThat(secondDestination.getParent(), nullValue());
        assertThat(graph.findNode(SECOND_DESTINATION_ID), nullValue());
    }
}


text:
  Saint-Laurent-la-Vernède est
       un village
       géographiquement positionné dans le département de Gard en Languedoc-Roussillon. Elle totalisait 683 habitants en 2008.

À Saint-Laurent-la-Vernède, le prix moyen à la vente d'un appartement se situe à 987 € du m² en vente. Le prix moyen d'une maison à l'achat se situe à 2 449 € du m². À la location la valorisation moyenne se situe à 0 € du m² par mois.

La commune compte quelques  équipements sportifs, elle propose entre autres un terrain de tennis, un terrain de sport et une boucle de randonnée.

Si vous pensez emmenager à Saint-Laurent-la-Vernède, vous pourrez facilement trouver une maison à vendre.

Le parc d'habitations, à Saint-Laurent-la-Vernède, était réparti en 2011 en 18 appartements et 387 maisons soit
 un marché relativement équilibré.

À coté de Saint-Laurent-la-Vernède sont situées les communes de
Saint-André-d'Olérargues localisée à 6 km, 393 habitants,
Cavillargues située à 5 km, 744 habitants,
Fontarèches localisée à 1 km, 226 habitants,
Saint-Pons-la-Calm localisée à 7 km, 406 habitants,
Pougnadoresse à 4 km, 189 habitants,
Saint-Quentin-la-Poterie située à 6 km, 2 869 habitants,
 entre autres. De plus, Saint-Laurent-la-Vernède est située à seulement 28 km de Orange.


text:
#pragma once

#ifndef GEODE_MAPWITHLOCK_H_
#define GEODE_MAPWITHLOCK_H_

#include <geode/internal/geode_globals.hpp>
#include <geode/CacheableKey.hpp>

#include <ace/Hash_Map_Manager.h>
#include <ace/Recursive_Thread_Mutex.h>
#include <ace/config-lite.h>
#include <ace/Versioned_Namespace.h>

#include <unordered_map>
#include <string>

namespace apache {
namespace geode {
namespace client {

typedef std::unordered_map<std::shared_ptr<CacheableKey>, int,
                           CacheableKey::hash, CacheableKey::equal_to>
    MapOfUpdateCounters;

class Region;
/** Map type used to hold root regions in the Cache, and subRegions. */
typedef ACE_Hash_Map_Manager_Ex<
    std::string, std::shared_ptr<Region>, ACE_Hash<std::string>,
    ACE_Equal_To<std::string>, ACE_Recursive_Thread_Mutex>
    MapOfRegionWithLock;

class CqQuery;
typedef ACE_Hash_Map_Manager_Ex<
    std::string, std::shared_ptr<CqQuery>, ACE_Hash<std::string>,
    ACE_Equal_To<std::string>, ACE_Recursive_Thread_Mutex>
    MapOfCqQueryWithLock;

/** Guard type for locking a MapOfRegionWithLock while iterating or performing
 * other composite operations. ex.. MapOfRegionGuard guard( map->mutex() );
 */
typedef ACE_Guard<ACE_Recursive_Thread_Mutex> MapOfRegionGuard;
}  // namespace client
}  // namespace geode
}  // namespace apache

#endif  // GEODE_MAPWITHLOCK_H_


text:
package com.thaiopensource.validate.nvdl;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;

import javax.xml.transform.sax.SAXSource;

import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;

import com.thaiopensource.util.PropertyId;
import com.thaiopensource.util.PropertyMap;
import com.thaiopensource.util.PropertyMapBuilder;
import com.thaiopensource.validate.IncorrectSchemaException;
import com.thaiopensource.validate.Option;
import com.thaiopensource.validate.Schema;
import com.thaiopensource.validate.SchemaReader;
import com.thaiopensource.validate.ValidateProperty;
import com.thaiopensource.validate.auto.AutoSchemaReader;
import com.thaiopensource.validate.auto.SchemaFuture;
import com.thaiopensource.validate.auto.SchemaReceiver;
import com.thaiopensource.validate.auto.SchemaReceiverFactory;
import com.thaiopensource.validate.prop.wrap.WrapProperty;
import com.thaiopensource.validate.rng.CompactSchemaReader;
import com.thaiopensource.validate.rng.SAXSchemaReader;
import com.thaiopensource.xml.util.Name;

/**
 * Schema receiver implementation for NVDL scripts.
 */
class SchemaReceiverImpl implements SchemaReceiver
{
  /**
   * Relax NG schema for NVDL scripts.
   */
  private static final String NVDL_SCHEMA = "nvdl.rng";
  /**
   * The type used for specifying RNC schemas.
   */
  private static final String RNC_MEDIA_TYPE = "application/relax-ng-compact-syntax";

  /**
   * Legacy type used for specifying RNC schemas.
   */
  static final String LEGACY_RNC_MEDIA_TYPE = "application/x-rnc";

  /**
   * Properties.
   */
  private final PropertyMap properties;

  /**
   * Property indicating if we need to check only attributes, that means the
   * root element is just a placeholder for the attributes.
   */
  private final Name attributeOwner;

  /**
   * The schema reader capable of parsing the input schema file. It will be an
   * auto schema reader as NVDL is XML.
   */
  private final SchemaReader autoSchemaReader;

  /**
   * Schema object created by this schema receiver.
   */
  private Schema nvdlSchema = null;

  /**
   * Properties that will be passed to sub-schemas.
   */
  private static final PropertyId subSchemaProperties[] = { ValidateProperty.ERROR_HANDLER,
                                                           ValidateProperty.XML_READER_CREATOR,
                                                           ValidateProperty.ENTITY_RESOLVER,
                                                           ValidateProperty.URI_RESOLVER,
                                                           ValidateProperty.RESOLVER,
                                                           SchemaReceiverFactory.PROPERTY, };

  /**
   * Creates a schema receiver for NVDL schemas.
   *
   * @param properties
   *        Properties.
   */
  public SchemaReceiverImpl (final PropertyMap properties)
  {
    this.attributeOwner = properties.get (WrapProperty.ATTRIBUTE_OWNER);
    final PropertyMapBuilder builder = new PropertyMapBuilder ();
    for (final PropertyId subSchemaPropertie : subSchemaProperties)
    {
      final Object value = properties.get (subSchemaPropertie);
      if (value != null)
        builder.put (subSchemaPropertie, value);
    }
    this.properties = builder.toPropertyMap ();
    this.autoSchemaReader = new AutoSchemaReader (properties.get (SchemaReceiverFactory.PROPERTY));
  }

  public SchemaFuture installHandlers (final XMLReader xr)
  {
    final PropertyMapBuilder builder = new PropertyMapBuilder (properties);
    if (attributeOwner != null)
      builder.put (WrapProperty.ATTRIBUTE_OWNER, attributeOwner);
    return new SchemaImpl (builder.toPropertyMap ()).installHandlers (xr, this);
  }

  Schema getNvdlSchema () throws IOException, IncorrectSchemaException, SAXException
  {
    if (nvdlSchema == null)
    {
      final String className = SchemaReceiverImpl.class.getName ();
      final String resourceName = className.substring (0, className.lastIndexOf ('.')).replace ('.', '/') +
                                  "/resources/" +
                                  NVDL_SCHEMA;
      final URL nvdlSchemaUrl = getResource (resourceName);
      final InputStream stream = nvdlSchemaUrl.openStream ();
      // this is just to ensure that there aren't any problems with the parser
      // opening the schema resource
      final InputSource inputSource = new InputSource (nvdlSchemaUrl.toString ());
      inputSource.setByteStream (stream);
      nvdlSchema = SAXSchemaReader.getInstance ().createSchema (inputSource, properties);
    }
    return nvdlSchema;
  }

  /**
   * Get a resource using this class class loader.
   *
   * @param resourceName
   *        the resource.
   * @return An URL pointing to the resource.
   */
  private static URL getResource (final String resourceName)
  {
    final ClassLoader cl = SchemaReceiverImpl.class.getClassLoader ();
    // XXX see if we should borrow 1.2 code from Service
    if (cl == null)
      return ClassLoader.getSystemResource (resourceName);
    else
      return cl.getResource (resourceName);
  }

  /**
   * Get the properties.
   *
   * @return a PropertyMap.
   */
  PropertyMap getProperties ()
  {
    return properties;
  }

  /**
   * Creates a child schema. This schema is referred in a validate action.
   *
   * @param source
   *        the SAXSource for the schema.
   * @param schemaType
   *        the schema type.
   * @param options
   *        options specified for this schema in the NVDL script.
   * @param isAttributesSchema
   *        flag indicating if the schema should be modified to check attributes
   *        only.
   * @return
   * @throws IOException
   *         In case of IO problems.
   * @throws IncorrectSchemaException
   *         In case of invalid schema.
   * @throws SAXException
   *         In case if XML problems while creating the schema.
   */
  Schema createChildSchema (final SAXSource source,
                            final String schemaType,
                            final PropertyMap options,
                            final boolean isAttributesSchema) throws IOException,
                                                             IncorrectSchemaException,
                                                             SAXException
  {
    final SchemaReader reader = isRnc (schemaType) ? CompactSchemaReader.getInstance () : autoSchemaReader;
    final PropertyMapBuilder builder = new PropertyMapBuilder (properties);
    if (isAttributesSchema)
      builder.put (WrapProperty.ATTRIBUTE_OWNER, ValidatorImpl.OWNER_NAME);
    builder.add (options);
    return reader.createSchema (source, builder.toPropertyMap ());
  }

  /**
   * Get an option for the given URI.
   *
   * @param uri
   *        The URI for an option.
   * @return Either the option from the auto schema reader or from the compact
   *         schema reader.
   */
  Option getOption (final String uri)
  {
    final Option option = autoSchemaReader.getOption (uri);
    if (option != null)
      return option;
    return CompactSchemaReader.getInstance ().getOption (uri);
  }

  /**
   * Checks is a schema type is RNC.
   *
   * @param schemaType
   *        The schema type specification.
   * @return true if the schema type refers to a RNC schema.
   */
  private static boolean isRnc (String schemaType)
  {
    if (schemaType == null)
      return false;
    schemaType = schemaType.trim ();
    return schemaType.equals (RNC_MEDIA_TYPE) || schemaType.equals (LEGACY_RNC_MEDIA_TYPE);
  }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>sss.servs</groupId>
    <artifactId>eval</artifactId>
    <version>1.0-SNAPSHOT</version>
  </parent>
  <artifactId>eval.serv</artifactId>
  <packaging>jar</packaging>

  <dependencies>

    <dependency>
      <groupId>sss.servs</groupId>
      <artifactId>eval.impl</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>sss.servs</groupId>
      <artifactId>eval.api</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>


text:
layout: post
title: Video - Introduction to Data Compression - Huffman Code
description: Video - Introduction to Data Compression - Huffman Code
author: Melvin Draupnir
authorurl: /melvin-draupnir/
published: true
---

What is the limit of compression? Huffman codes are introduced in order to demonstrate how entropy is the ultimate limit of compression.

TRANSCRIPT


text:
package com.jaanussiim.slimtimer.android.activities;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import com.jaanussiim.slimtimer.android.SlimtimerApplication;
import com.jaanussiim.slimtimer.android.database.Database;

import static com.jaanussiim.slimtimer.android.Constants.*;

public class SlimtimerActivity extends Activity {
  private static final String T = "SlimtimerActivity";
  private Database database;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(T, "onCreate");

    if (database == null) {
      database = ((SlimtimerApplication)getApplication()).getDatabase();
    }

    removeUsernamePasswordFromPreferences();

    if (!database.rememberLogin()) {
      database.removeCredentials();
    }

    Intent nextActivityStart;
    if (database.hasCredentials()) {
      nextActivityStart = new Intent(this, MainViewActivity.class);
    } else {
      nextActivityStart = new Intent(this, LoginActivity.class);
    }

    startActivity(nextActivityStart);
    finish();
  }

  private void removeUsernamePasswordFromPreferences() {
    SharedPreferences preferences = getSharedPreferences(PREFERENCES_NAME, Context.MODE_PRIVATE);
    final String username = preferences.getString(PREFERENCES_EMAIL_KEY, "");
    final String password = preferences.getString(PREFERENCES_PASSWORD_KEY, "");

    if ("".equals(username)) {
      return;
    }

    SharedPreferences.Editor editor = preferences.edit();
    editor.remove(PREFERENCES_EMAIL_KEY);
    editor.remove(PREFERENCES_PASSWORD_KEY);
    editor.commit();
  }

  void setTestDatabase(Database database) {
    this.database = database;
  }
}