text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Reflection;
using Cake.Core.Composition;
using Cake.Core.Packaging;
using Cake.Frosting.Tests.Data;
using NSubstitute;
using Xunit;

namespace Cake.Frosting.Tests.Unit.Extensions
{
    public sealed class CakeServicesExtensionsTests
    {
        public sealed class TheUseContextExtensionMethod
        {
            [Fact]
            public void Should_Throw_If_Services_Reference_Is_Null()
            {
                // Given
                ICakeServices services = null;

                // When
                var result = Record.Exception(() => services.UseContext<FrostingContext>());

                // Then
                AssertEx.IsArgumentNullException(result, "services");
            }

            [Fact]
            public void Should_Register_The_Context()
            {
                // Given
                var services = Substitute.For<ICakeServices>();
                var builder = Substitute.For<ICakeRegistrationBuilder>();
                services.RegisterType(Arg.Any<Type>()).Returns(builder); // Return a builder object when registering
                builder.AsSelf().Returns(builder); // Return same builder object when chaining
                builder.As(Arg.Any<Type>()).Returns(builder); // Return same builder object when chaining

                // When
                services.UseContext<FrostingContext>();

                // Then
                Received.InOrder(() =>
                {
                    services.RegisterType<FrostingContext>();
                    builder.AsSelf();
                    builder.As<IFrostingContext>();
                    builder.Singleton();
                });
            }
        }

        public sealed class TheUseLifetimeExtensionMethod
        {
            [Fact]
            public void Should_Throw_If_Services_Reference_Is_Null()
            {
                // Given
                ICakeServices services = null;

                // When
                var result = Record.Exception(() => services.UseLifetime<DummyLifetime>());

                // Then
                AssertEx.IsArgumentNullException(result, "services");
            }

            [Fact]
            public void Should_Register_The_Lifetime()
            {
                // Given
                var services = Substitute.For<ICakeServices>();
                var builder = Substitute.For<ICakeRegistrationBuilder>();
                services.RegisterType(Arg.Any<Type>()).Returns(builder); // Return a builder object when registering
                builder.As(Arg.Any<Type>()).Returns(builder); // Return same builder object when chaining

                // When
                services.UseLifetime<DummyLifetime>();

                // Then
                Received.InOrder(() =>
                {
                    services.RegisterType<DummyLifetime>();
                    builder.As<IFrostingLifetime>();
                    builder.Singleton();
                });
            }
        }

        public sealed class TheUseTaskLifetimeExtensionMethod
        {
            [Fact]
            public void Should_Throw_If_Services_Reference_Is_Null()
            {
                // Given
                ICakeServices services = null;

                // When
                var result = Record.Exception(() => services.UseTaskLifetime<DummyTaskLifetime>());

                // Then
                AssertEx.IsArgumentNullException(result, "services");
            }

            [Fact]
            public void Should_Register_The_Lifetime()
            {
                // Given
                var services = Substitute.For<ICakeServices>();
                var builder = Substitute.For<ICakeRegistrationBuilder>();
                services.RegisterType(Arg.Any<Type>()).Returns(builder); // Return a builder object when registering
                builder.As(Arg.Any<Type>()).Returns(builder); // Return same builder object when chaining

                // When
                services.UseTaskLifetime<DummyTaskLifetime>();

                // Then
                Received.InOrder(() =>
                {
                    services.RegisterType<DummyTaskLifetime>();
                    builder.As<IFrostingTaskLifetime>();
                    builder.Singleton();
                });
            }
        }

        public sealed class TheUseAssemblyExtensionMethod
        {
            [Fact]
            public void Should_Throw_If_Services_Reference_Is_Null()
            {
                // Given
                ICakeServices services = null;
                var assembly = typeof(DateTime).GetTypeInfo().Assembly;

                // When
                var result = Record.Exception(() => services.UseAssembly(assembly));

                // Then
                AssertEx.IsArgumentNullException(result, "services");
            }

            [Fact]
            public void Should_Register_The_Assembly()
            {
                // Given
                var services = Substitute.For<ICakeServices>();
                var builder = Substitute.For<ICakeRegistrationBuilder>();
                services.RegisterInstance(Arg.Any<Assembly>()).Returns(builder); // Return a builder object when registering
                builder.As(Arg.Any<Type>()).Returns(builder); // Return same builder object when chaining

                // When
                services.UseAssembly(typeof(DateTime).GetTypeInfo().Assembly);

                // Then
                Received.InOrder(() =>
                {
                    services.RegisterInstance(Arg.Any<Assembly>());
                    builder.Singleton();
                });
            }
        }

        public sealed class TheUseModuleExtensionMethod
        {
            [Fact]
            public void Should_Throw_If_Services_Reference_Is_Null()
            {
                // Given
                ICakeServices services = null;

                // When
                var result = Record.Exception(() => services.UseModule<DummyModule>());

                // Then
                AssertEx.IsArgumentNullException(result, "services");
            }

            [Fact]
            public void Should_Create_Module_And_Call_Registration()
            {
                // Given
                var services = Substitute.For<ICakeServices>();

                // When
                services.UseModule<DummyModule>();

                // Then
                services.Received(1).RegisterType(typeof(DummyModule.DummyModuleSentinel));
            }
        }

        public sealed class TheUsePackageInstallerExtensionMethod
        {
            [Fact]
            public void Should_Throw_If_Services_Reference_Is_Null()
            {
                // Given
                ICakeServices services = null;

                // When
                var result = Record.Exception(() => services.UsePackageInstaller<DummyPackageInstaller>());

                // Then
                AssertEx.IsArgumentNullException(result, "services");
            }

            [Fact]
            public void Should_Register_The_Package_Installer()
            {
                // Given
                var services = Substitute.For<ICakeServices>();
                var builder = Substitute.For<ICakeRegistrationBuilder>();
                services.RegisterType(Arg.Any<Type>()).Returns(builder); // Return a builder object when registering
                builder.As(Arg.Any<Type>()).Returns(builder); // Return same builder object when chaining

                // When
                services.UsePackageInstaller<DummyPackageInstaller>();

                // Then
                Received.InOrder(() =>
                {
                    services.RegisterType<DummyPackageInstaller>();
                    builder.As<IPackageInstaller>();
                    builder.Singleton();
                });
            }
        }

        public sealed class TheUseToolExtensionMethod
        {
            [Fact]
            public void Should_Throw_If_Services_Reference_Is_Null()
            {
                // Given
                ICakeServices services = null;

                // When
                var result = Record.Exception(() => services.UseTool(new Uri("nuget:?package=Foo")));

                // Then
                AssertEx.IsArgumentNullException(result, "services");
            }

            [Fact]
            public void Should_Register_The_PackageReference()
            {
                // Given
                var services = Substitute.For<ICakeServices>();
                var builder = Substitute.For<ICakeRegistrationBuilder>();
                services.RegisterInstance(Arg.Any<PackageReference>()).Returns(builder); // Return a builder object when registering
                builder.As(Arg.Any<Type>()).Returns(builder); // Return same builder object when chaining

                // When
                services.UseTool(new Uri("nuget:?package=Foo"));

                // Then
                Received.InOrder(() =>
                {
                    services.RegisterInstance(Arg.Is<PackageReference>(
                        r => r.OriginalString == "nuget:?package=Foo"));
                });
            }
        }
    }
}


text:
//
//  PXShapeStyler.m
//  Pixate
//
//  Created by Kevin Lindsey on 12/18/12.
//  Copyright (c) 2012 Pixate, Inc. All rights reserved.
//

#import "PXShapeStyler.h"
#import "PXShape.h"
#import "PXEllipse.h"
#import "PXRectangle.h"
#import "PXArrowRectangle.h"

@implementation PXShapeStyler

#pragma mark - Static Methods

+ (PXShapeStyler *)sharedInstance
{
	static __strong PXShapeStyler *sharedInstance = nil;
	static dispatch_once_t onceToken;

	dispatch_once(&onceToken, ^{
		sharedInstance = [[PXShapeStyler alloc] init];
	});

	return sharedInstance;
}

#pragma mark - Overrides

- (NSDictionary *)declarationHandlers
{
    static __strong NSDictionary *handlers = nil;
    static dispatch_once_t onceToken;

    dispatch_once(&onceToken, ^{
        handlers = @{
            @"shape" : ^(PXDeclaration *declaration, PXStylerContext *context) {
                NSString *stringValue = declaration.stringValue;

                if ([@"ellipse" isEqualToString:stringValue])
                {
                    context.shape = [[PXEllipse alloc] init];
                }
                else if ([@"arrow-button-left" isEqualToString:stringValue])
                {
                    context.shape = [[PXArrowRectangle alloc] initWithDirection:PXArrowRectangleDirectionLeft];
                }
                else if ([@"arrow-button-right" isEqualToString:stringValue])
                {
                    context.shape = [[PXArrowRectangle alloc] initWithDirection:PXArrowRectangleDirectionRight];
                }
                else
                {
                    context.shape = [[PXRectangle alloc] init];
                }
            },
        };
    });

    return handlers;
}

@end

redpajama_set_name: RedPajamaGithub


text:
"use strict";

exports.Bridge = require('./LittleBitsBridge').Bridge;
exports.bindings = [
    require('./models/LittleBitsOutputBoolean').binding,
    require('./models/LittleBitsOutputRange').binding,
    require('./models/LittleBitsDeviceLight').binding,
    require('./models/LittleBitsInputBoolean').binding,
    require('./models/LittleBitsInputRange').binding,
    require('./models/LittleBitsLight').binding,
];

exports.module_folder = __dirname;


text:
<?php

defined('PHPFOX') or exit('NO DICE!');

?>

		{$aLink.title|clean}
		{if $bIsAttachment && (Phpfox::getUserParam('attachment.delete_own_attachment') && $aLink.user_id == Phpfox::getUserId()) || Phpfox::getUserParam('attachment.delete_user_attachment')}
		- {phrase var='attachment.delete'}
		{/if}

			{if !empty($aLink.image)}

				{if $aLink.has_embed}{phrase var='link.play'}{/if}

			{/if}

			{$aLink.link|clean|shorten:50:'...'}

		{if isset($aLink.description)}

			{$aLink.description|clean}

		{/if}


text:
title: Hi, I'm Sarah! 👋
subtitle: "scientist, maker, community builder"
metaDescription: tl;dr on me
date: 2017-01-01T00:00:00.000Z
permalink: /about/index.html
eleventyNavigation:
  key: About
  order: 1
---

I am an experimental physicist turned software developer with over 15 years experience in developing and managing cutting-edge tech projects. While not from Seattle originally, I have found my home here and enjoy [writing books]({{site.baseurl}}/books) about cool technologies (on a [split ergo](https://twitter.com/crazy4pi314/status/1382447930066444290?s=20)), cutting things with lasers, and playing with my pup Chewie.

---

### 👩💻 Experience

I got my PhD in Physics (Quantum Computing) by starting plasma fires with lasers to hack quantum crypto devices and trying to send and detect single photons in space ([read her thesis](http://hdl.handle.net/10012/10725)). As a developer, Python is my go-to language for most things, but I also dabble in Rust and program quantum computers in Q#. In 2021 I was awarded a Python Software Foundation Fellowship, and I'm currently working at Microsoft as a developer advocate for the Python OSS community.

**Cool stuff I have worked on:**
🚀 Low noise optical systems on satellites
👓 Virtual reality hardware
💎 Nanodiamonds for quantum sensing at cryogenic temperatures (automated with Python and Jupyter Notebooks 💖)
💻 Software tools and languages for quantum computers

> See [LinkedIn]({{site.social_links.linkedin}}) for more info.

---
### 💞 Passions

I am a vocal activist for diversity and inclusion in STEM fields and often give [presentations]({{site.baseurl}}/events) on my experiences and perspective as bisexual woman in tech. Live streaming quantum software development on [Twitch]({{site.social.twitch}}) has been another great way I  connect with folks to make quantum tech more accessible.

---
### 📝 Credits

The following tools were used to make this site:

- [Eleventy static site generator](https://www.11ty.dev/)
- [Fernfolio template](https://fernfolio.netlify.app/)


text:
const assert      = require('assert');
const _           = require('underscore');
const fs          = require('fs');
const passmarked      = require('passmarked');

// handle the settings
describe('emptysrc', function() {

  // handle the error output
  it('Should not break any of the empty src rules', function(done) {

    // read in the html sample
    var content = fs.readFileSync('./samples/emptysrc.good.html').toString();

    // handle the payload
    payload = passmarked.createPayload({

      url: 'http://example.com'

    }, null, content.toString())

    // run the rules
    require('../lib/rules/emptysrc')(payload, function(err) {

      // get the rules
      var rules = payload.getRules();

      // check
      var rule = _.find(rules, function(item) { return item.key == 'emptysrc'; });

      // fail if not found
      if(rule)
        assert.fail('Was not expecting a error')

      // done
      done()

    });

  });

  // handle the error output
  it('Should have the empty src rule present', function(done) {

    // read in the html sample
    var content = fs.readFileSync('./samples/emptysrc.bad.html').toString();

    // handle the payload
    payload = passmarked.createPayload({

      url: 'http://example.com'

    }, null, content.toString())

    // run the rules
    require('../lib/rules/emptysrc')(payload, function(err) {

      // get the rules
      var rules = payload.getRules();

      // check
      var rule = _.find(rules, function(item) { return item.key == 'emptysrc'; })

      // fail if not found
      if(!rule)
        assert.fail('Was expecting a error');

      // done
      done()

    });

  });

});


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Copyright (c) 2013, Santiago Ontañón All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
 * following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice, this list of conditions and the following
 * disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
 * following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of
 * the IIIA-CSIC nor the names of its contributors may be used to endorse or promote products derived from this software
 * without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

 package ftl.argumentation.visualization;

import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;

import ftl.argumentation.core.ABUI;
import ftl.argumentation.core.AMAIL;
import ftl.argumentation.core.Argument;
import ftl.argumentation.core.ArgumentAcceptability;
import ftl.argumentation.core.ArgumentationBasedLearning;
import ftl.argumentation.core.ArgumentationState;
import ftl.argumentation.core.ArgumentationTree;
import ftl.argumentation.core.LaplaceArgumentAcceptability;
import ftl.argumentation.visualization.amail.panels.AgentPanel;
import ftl.argumentation.visualization.amail.panels.ArgumentationAgentPanel;
import ftl.argumentation.visualization.amail.panels.ArgumentationPanel;
import ftl.argumentation.visualization.amail.panels.ArgumentationPanelMultiScrolled;
import ftl.argumentation.visualization.amail.panels.TimeWindow;
import ftl.base.bridges.NOOSParser;
import ftl.base.core.BaseOntology;
import ftl.base.core.FTKBase;
import ftl.base.core.FeatureTerm;
import ftl.base.core.Ontology;
import ftl.base.core.Symbol;
import ftl.base.utils.FeatureTermException;
import ftl.base.utils.Pair;
import ftl.base.utils.RewindableInputStream;
import ftl.learning.core.Hypothesis;
import ftl.learning.core.Rule;
import ftl.learning.core.RuleHypothesis;
import ftl.learning.core.TrainingSetProperties;
import ftl.learning.core.TrainingSetUtils;
import ftl.learning.lazymethods.similarity.PropertiesDistance;

// TODO: Auto-generated Javadoc
/**
 * The Class AMAILVis.
 *
 * @author santi
 */
public class AMAILVis {

	/**
	 * The main method.
	 *
	 * @param args
	 *            the arguments
	 */
	public static void main(String args[]) {
		try {
			boolean CREDULOUS = true;
			int NAGENTS = 2;
			// int NAGENTS = 3;
			int CB = TrainingSetUtils.DEMOSPONGIAE_280_DATASET;
			// String inputFileName = "AMAILVis-Example-" + NAGENTS + "Agents.txt";
			String inputFileName = null;
			String outputFileName = "AMAILVis-Example-" + NAGENTS + "Agents.tmp.txt";

			// Load a data set:
			Ontology base_ontology = new BaseOntology();
			Ontology o = new Ontology();
			FTKBase dm = new FTKBase();
			FTKBase case_base = new FTKBase();
			o.uses(base_ontology);
			case_base.uses(dm);
			dm.create_boolean_objects(o);

			// Create an argumentation panel:
			createArgumentationPanel(CREDULOUS, NAGENTS, CB, inputFileName, outputFileName, o, dm, case_base);

		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Creates the argumentation panel.
	 *
	 * @param CREDULOUS
	 *            the cREDULOUS
	 * @param NAGENTS
	 *            the nAGENTS
	 * @param CB
	 *            the cB
	 * @param outputFileName
	 *            the output file name
	 * @param inputFile
	 *            the input file
	 * @param tw
	 *            the tw
	 * @param o
	 *            the o
	 * @param dm
	 *            the dm
	 * @param case_base
	 *            the case_base
	 * @param ts
	 *            the ts
	 * @throws FeatureTermException
	 *             the feature term exception
	 * @throws IOException
	 *             Signals that an I/O exception has occurred.
	 * @throws Exception
	 *             the exception
	 * @throws UnsupportedEncodingException
	 *             the unsupported encoding exception
	 */
	private static void createArgumentationPanel(boolean CREDULOUS, int NAGENTS, int CB, String inputFileName, String outputFileName,
			Ontology o, FTKBase dm, FTKBase case_base) throws FeatureTermException, IOException, Exception,
			UnsupportedEncodingException {

		TrainingSetProperties ts = TrainingSetUtils.loadTrainingSet(CB, o, dm, case_base);
		TimeWindow tw = new TimeWindow("AMAIL Visualization", 20);

		BufferedReader inputFile = null;

		if (inputFileName != null) {
			inputFile = new BufferedReader(new FileReader(inputFileName));
		}

		if (inputFile != null) {
			String line = inputFile.readLine();
			CB = Integer.parseInt(line);
		}

		// This list contains all the arguments being sent by all agents,
		// to have nice small IDs to show in screen
		HashMap<Argument, String> argumentIDs = new HashMap<Argument, String>();
		List<List<FeatureTerm>> case_bases = new LinkedList<List<FeatureTerm>>();
		List<FeatureTerm> allSolutions = Hypothesis.differentSolutions(ts.cases, ts.solution_path);
		FeatureTerm solution = null;
		ArgumentationState lastState = null;
		ArgumentationPanel lastPanel = null;

		if (inputFile != null) {
			String line = inputFile.readLine();
			for (FeatureTerm s : allSolutions) {
				System.out.println("Solution: " + s.toStringNOOS(dm));
				if (s.toStringNOOS(dm).equals(line)) {
					solution = s;
				}
			}
			if (solution == null) {
				System.err.println("Can't recover the solution from the file!!!");
				solution = allSolutions.get(0);
			}

			NAGENTS = Integer.parseInt(inputFile.readLine());
			for (int n = 0; n < NAGENTS; n++) {
				int nc = Integer.parseInt(inputFile.readLine());
				case_bases.add(new LinkedList<FeatureTerm>());
				for (int i = 0; i < nc; i++) {
					String cn = inputFile.readLine();
					List<FeatureTerm> l = new LinkedList<FeatureTerm>();
					l.addAll(case_base.searchFT(new Symbol(cn)));
					if (l.size() == 1) {
						case_bases.get(n).add(l.get(0));
					} else {
						System.err.println("Can't find case " + cn);
					}
				}
			}
		} else {
			case_bases = ftl.learning.core.TrainingSetUtils.splitTrainingSet(ts.cases, NAGENTS, ts.description_path, ts.solution_path, dm, 0.0, 0.0);

			solution = allSolutions.get(0);
		}

		List<ArgumentationBasedLearning> l_l = new LinkedList<ArgumentationBasedLearning>();
		List<RuleHypothesis> hypotheses = new LinkedList<RuleHypothesis>();
		float ACCEPTABILITY_THRESHOLD = 0.8f;
		List<ArgumentAcceptability> aaIndividuall = new LinkedList<ArgumentAcceptability>();
		for (int i = 0; i < NAGENTS; i++) {
			l_l.add(new ABUI());
			aaIndividuall.add(new LaplaceArgumentAcceptability(case_bases.get(i), ts.solution_path, ts.description_path, ACCEPTABILITY_THRESHOLD));
		}

		if (inputFile != null) {
			String ftString;
			String line;
			for (int n = 0; n < NAGENTS; n++) {
				int nh = Integer.parseInt(inputFile.readLine());
				RuleHypothesis h = new RuleHypothesis();
				for (int i = 0; i < nh; i++) {
					ftString = "";
					line = inputFile.readLine(); // <
					line = inputFile.readLine(); // <
					do {
						ftString += line + "\n";
						line = inputFile.readLine();
					} while (!line.equals(">"));
					FeatureTerm c = NOOSParser.parse(new RewindableInputStream(new ByteArrayInputStream(ftString.getBytes("UTF-8"))), case_base, o);

					h.addRule(new Rule(c, solution, 0, 0));
				}
				hypotheses.add(h);
			}
		} else {
			for (int n = 0; n < NAGENTS; n++) {
				hypotheses.add(((ABUI) l_l.get(n)).learnConceptABUI(case_bases.get(n), solution, new LinkedList<Argument>(), aaIndividuall.get(n),
						ts.description_path, ts.solution_path, o, dm));
			}
		}

		int step = 0;

		{
			File outputFile = new File(outputFileName);
			FileWriter fw = new FileWriter(outputFile);
			fw.write("" + CB + "\n");
			fw.write(solution.toStringNOOS(dm) + "\n");
			fw.write(NAGENTS + "\n");
			for (int n = 0; n < NAGENTS; n++) {
				fw.write(case_bases.get(n).size() + "\n");
				for (FeatureTerm c : case_bases.get(n)) {
					fw.write(c.getName().get() + "\n");
				}
			}
			for (int n = 0; n < NAGENTS; n++) {
				fw.write(hypotheses.get(n).getRules().size() + "\n");
				for (Rule r : hypotheses.get(n).getRules()) {
					fw.write("<\n" + r.pattern.toStringNOOS(dm) + "\n>\n");
				}
			}
			fw.close();
		}

		// Create a global panel for positioning the cases in the case-base:
		String name = ts.name + "-" + ts.cases.size();
		AgentPanel globalAgent = new AgentPanel(name, ts.cases, ts.solution_path, ts.description_path, dm, new PropertiesDistance(ts.cases, dm, o,
				ts.description_path, true), true, false, true);

		AMAIL argumentation = new AMAIL(hypotheses, solution, case_bases, aaIndividuall, l_l, CREDULOUS, ts.description_path, ts.solution_path, o, dm);
		// Add initial state:
		{
			List<AgentPanel> apl = new LinkedList<AgentPanel>();
			List<ArgumentAcceptability> aal = new LinkedList<ArgumentAcceptability>();
			for (int n = 0; n < NAGENTS; n++) {
				AgentPanel ap = new AgentPanel(argumentation.a_l.get(n).m_name, argumentation.a_l.get(n).m_examples, ts.solution_path, ts.description_path, dm,
						null, false, false, true);
				ap.setParent(globalAgent);
				apl.add(ap);
				aal.add(new LaplaceArgumentAcceptability(argumentation.a_l.get(n).m_examples, ts.solution_path, ts.description_path, ACCEPTABILITY_THRESHOLD));
			}
			ArgumentationPanel ap = new ArgumentationPanelMultiScrolled(apl, aal, dm, ts.solution_path, ts.description_path, argumentIDs);
			ArgumentationState as = argumentation.state;
			for (ArgumentationTree at : as.getTrees())
				ap.addTree(at.clone(), at.getRoot().m_agent, false);
			for (ArgumentationTree at : as.getRetractedTrees())
				ap.addTree(at.clone(), at.getRoot().m_agent, true);
			List<Pair<String, Object>> messages = new LinkedList<Pair<String, Object>>();
			// for(ArgumentationTree at:as.getTrees()) {
			// messages.add(new Pair<String,Object>(at.getRoot().m_agent,at.getRoot()));
			// }
			ap.m_messages = messages;
			tw.addStep("t" + step, ap);
			lastState = new ArgumentationState(as);
			lastPanel = ap;
			step++;
		}

		while (argumentation.moreRoundsP()) {
			argumentation.round(true);
			// Add final state:
			{
				List<AgentPanel> apl = new LinkedList<AgentPanel>();
				List<ArgumentAcceptability> aal = new LinkedList<ArgumentAcceptability>();
				for (int n = 0; n < NAGENTS; n++) {
					ArgumentationAgentPanel ap = new ArgumentationAgentPanel(argumentation.a_l.get(n).m_name, argumentation.a_l.get(n).m_examples,
							ts.solution_path, ts.description_path, dm, null, false, false, null);
					ap.setParent(globalAgent);
					apl.add(ap);
					aal.add(new LaplaceArgumentAcceptability(argumentation.a_l.get(n).m_examples, ts.solution_path, ts.description_path,
							ACCEPTABILITY_THRESHOLD));
				}
				ArgumentationPanel ap = new ArgumentationPanelMultiScrolled(apl, aal, dm, ts.solution_path, ts.description_path, argumentIDs);
				for (int n = 0; n < NAGENTS; n++) {
					((ArgumentationAgentPanel) (apl.get(n))).m_parent = ap;
				}
				ap.token = argumentation.getPreviousAgent();
				ArgumentationState as = argumentation.state;
				for (ArgumentationTree at : as.getTrees())
					ap.addTree(at.clone(), at.getRoot().m_agent, false);
				for (ArgumentationTree at : as.getRetractedTrees())
					ap.addTree(at.clone(), at.getRoot().m_agent, true);
				// Find messages:
				List<Pair<String, Object>> messages = new LinkedList<Pair<String, Object>>();
				messages.addAll(findMessages(lastState, as));
				messages.addAll(findMessages(lastPanel, ap));
				ap.m_messages = messages;
				tw.addStep("t" + step, ap);
				lastState = new ArgumentationState(as);
				lastPanel = ap;
				step++;
			}
		}
		List<RuleHypothesis> hAMAIL = argumentation.result();
		tw.repaint();
	}

	/**
	 * Find messages.
	 *
	 * @param s0
	 *            the s0
	 * @param s1
	 *            the s1
	 * @return the list
	 */
	public static List<Pair<String, Object>> findMessages(ArgumentationState s0, ArgumentationState s1) {
		List<Pair<String, Object>> messages = new LinkedList<Pair<String, Object>>();

		List<ArgumentationTree> lt0 = s0.getAllTrees();
		List<ArgumentationTree> lt1 = s1.getAllTrees();

		// Look for new arguments and hypothesis:
		for (ArgumentationTree at1 : lt1) {
			List<Argument> l0 = null;
			List<Argument> l1 = at1.getAllArguments();
			for (ArgumentationTree at0 : lt0) {
				if (at1.getRoot() == at0.getRoot()) {
					l0 = at0.getAllArguments();
					break;
				}
			}

			if (l0 == null) {
				// new hypothesis:
				System.out.println("findArgumentMessags: new hypothesis found!!");
				messages.add(new Pair<String, Object>(at1.getRoot().m_agent, at1.getRoot()));
			} else {
				if (l1.size() > l0.size()) {
					// There is a new argument!
					for (Argument a : l1) {
						if (!l0.contains(a)) {
							// New attack:
							messages.add(new Pair<String, Object>(a.m_agent, a));
						}
					}
				}
			}
		}

		return messages;
	}

	/**
	 * Find messages.
	 *
	 * @param p0
	 *            the p0
	 * @param p1
	 *            the p1
	 * @return the list
	 */
	public static List<Pair<String, Object>> findMessages(ArgumentationPanel p0, ArgumentationPanel p1) {
		List<Pair<String, Object>> messages = new LinkedList<Pair<String, Object>>();

		// find new examples:
		for (int n = 0; n < p0.apl.size(); n++) {
			for (FeatureTerm e : p1.apl.get(n).m_cases) {
				if (!p0.apl.get(n).m_cases.contains(e)) {
					// new case:
					messages.add(new Pair<String, Object>("other", e));
				}
			}
		}

		return messages;
	}

}


text:
<?php
/**
 * [PHPFOX_HEADER]
 */

defined('PHPFOX') or exit('NO DICE!');

/**
 *
 *
 * @copyright		[PHPFOX_COPYRIGHT]
 * @author  		Raymond Benc
 * @package 		Phpfox_Component
 * @version 		$Id: import.class.php 1572 2010-05-06 12:37:24Z Raymond_Benc $
 */
class Core_Component_Controller_Admincp_Country_Import extends Phpfox_Component
{
	/**
	 * Class process method wnich is used to execute this component.
	 */
	public function process()
	{
		$oArchiveImport = Phpfox::getLib('archive.import')->set(array('zip'));
		$bOverwrite = ($this->request()->getInt('overwrite') ? true : false);

		if (isset($_FILES['file_import']) && ($aFile = $_FILES['file_import']) && ($aVals = $this->request()->getArray('val')))
		{
			if (($aLog = Phpfox::getService('core.country.process')->importFromText($aVals, $aFile)) && $aLog['completed'] > 0)
			{
				$this->url()->send('admincp.core.country.child', array('id' => $aVals['country_iso']), Phpfox::getPhrase('admincp.text_import_successfully_completed', array('completed' => $aLog['completed'], 'failed' => $aLog['failed'])));
			}
		}

		if (isset($_FILES['import']) && ($aFile = $_FILES['import']))
		{
			if (Phpfox::getService('core.country.process')->import($aFile, $bOverwrite))
			{
				$this->url()->send('admincp.core.country', null, Phpfox::getPhrase('admincp.import_successfully_completed'));
			}
		}

		$this->template()->setTitle(Phpfox::getPhrase('admincp.import_countries_states_provinces'))
			->setBreadcrumb(Phpfox::getPhrase('admincp.country_manager'), $this->url()->makeUrl('admincp.core.country'))
			->setBreadcrumb(Phpfox::getPhrase('admincp.import'), null, true)
			->assign(array(

				)
			);
	}

	/**
	 * Garbage collector. Is executed after this class has completed
	 * its job and the template has also been displayed.
	 */
	public function clean()
	{
		(($sPlugin = Phpfox_Plugin::get('core.component_controller_admincp_country_import_clean')) ? eval($sPlugin) : false);
	}
}

?>


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
 ~ Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 ~
 ~ WSO2 Inc. licenses this file to you under the Apache License,
 ~ Version 2.0 (the "License"); you may not use this file except
 ~ in compliance with the License.
 ~ You may obtain a copy of the License at
 ~
 ~      http://www.apache.org/licenses/LICENSE-2.0
 ~
 ~ Unless required by applicable law or agreed to in writing, software
 ~ distributed under the License is distributed on an "AS IS" BASIS,
 ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 ~ See the License for the specific language governing permissions and
 ~ limitations under the License.
 -->
<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">

    <parent>
        <groupId>org.wso2.carbon.identity.inbound.provisioning.scim2</groupId>
        <artifactId>identity-inbound-provisioning-scim2</artifactId>
        <relativePath> ../../pom.xml</relativePath>
        <version>3.4.3-SNAPSHOT</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>org.wso2.carbon.identity.scim2.provider</artifactId>
    <name>WSO2 Carbon - SCIM 2.0 - Service Provider Component</name>
    <packaging>war</packaging>

    <dependencies>
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.utils</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity.inbound.auth.oauth2</groupId>
            <artifactId>org.wso2.carbon.identity.oauth.stub</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity.inbound.auth.oauth2</groupId>
            <artifactId>org.wso2.carbon.identity.oauth</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity.framework</groupId>
            <artifactId>org.wso2.carbon.identity.core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity.framework</groupId>
            <artifactId>org.wso2.carbon.identity.provisioning</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity.inbound.provisioning.scim2</groupId>
            <artifactId>org.wso2.carbon.identity.scim2.common</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity.framework</groupId>
            <artifactId>org.wso2.carbon.user.mgt</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity.framework</groupId>
            <artifactId>org.wso2.carbon.identity.role.mgt.core</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
                <version>2.3.2</version>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <warName>scim2</warName>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <configuration>
                    <threshold>Medium</threshold>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>


text:
import json, sys, csv, re

class Term:
  def __init__(self,s):
    #print s,' maps to ',
    try:
      mo = re.search("\((.*),(.*),(\".*\")\)",s)

      self.code = mo.group(1)
      self.codingScheme = mo.group(2)
      self.meaning = mo.group(3)
    except:
      self.code = ""
      self.codingScheme = ""
      self.meaning = ""
    #print self.getStr()
  def toStr(self):
    return '('+self.code+','+self.codingScheme+','+self.meaning+')'

class RGB:
  def __init__(self,s):
    try:
      mo = re.search("rgb\(([0-9]*),([0-9]*),([0-9]*)\)",s)
      self.rgb = [mo.group(1),mo.group(2),mo.group(3)]
    except:
      self.rgb = ""
  def toStr(self):
    return str(self.rgb)

def addColor(codeDict,jsonDict,c,t,m=-1):
  jsonCat = jsonCodes["SegmentationCodes"]["Category"][c]["codeValue"]
  jsonType = jsonCodes["SegmentationCodes"]["Category"][c]["Type"][t]["codeValue"]
  if m != -1:
    jsonMod = jsonCodes["SegmentationCodes"]["Category"][c]["Type"][t]["Modifier"][m]["codeValue"]
  else:
    jsonMod = ""
  key = jsonCat+","+jsonType+","+jsonMod

  if key in codeDict:
    rgb = codeDict[key][-2].rgb
    slicerName = codeDict[key][-3]
    codeDict[key][-1] = True # mark this entry as matched
    if m != -1:
      jsonCodes["SegmentationCodes"]["Category"][c]["Type"][t]["Modifier"][m]["recommendedDisplayRGBValue"] = rgb
      jsonCodes["SegmentationCodes"]["Category"][c]["Type"][t]["Modifier"][m]["3dSlicerLabel"] = slicerName
    else:
      jsonCodes["SegmentationCodes"]["Category"][c]["Type"][t]["recommendedDisplayRGBValue"] = rgb
      jsonCodes["SegmentationCodes"]["Category"][c]["Type"][t]["3dSlicerLabel"] = slicerName
    return True
  else:
    return False

def copyNonListItems(src,dest,destKey=None):
  if destKey:
    dest[destKey] = {}
  for k in src.keys():
    if type(k) != 'list':
      if not destKey:
        dest[k] = src[k]
      else:
        dest[destKey][k] = src[k]

if len(sys.argv)<3:
  print "Usage: ",sys.argv[0]," SegmentationCodesJSON SegmentationCodesCSV <outputJSON>"
  print "  where SegmentationCodesJSON is the SegmentationCategoryType JSON"
  print "  file from doc/segContext, and SegmentationCodesCSV is the CSV file" print "  imported from the first sheet here https://goo.gl/vuANnw"

inputJSONFileName = sys.argv[1]
inputCSVFileName = sys.argv[2]

if len(sys.argv)>3:
  outputJSONFileName = sys.argv[3]
else:
  outputJSONFileName = None

jsonCodes = json.loads(open(inputJSONFileName).read())
#jsonCodes = jsonCodes["SegmentationCodes"]

codeDict = {}

with open(inputCSVFileName) as csvfile:
  csvreader = csv.reader(csvfile)
  for row in csvreader:
    slicerName = row[1].strip()
    segCategory = Term(row[6])
    segType = Term(row[7])
    segModifier = Term(row[9])
    segRGB = RGB(row[10])
    #if segCategory != None and segCategory != ' ':
    #  print '*'+segCategory+'*',segType,segModifier,segRGB
    key = segCategory.code+","+segType.code+","+segModifier.code
    if segCategory.code != "":
      # last item indicates this entry has not been matched to the JSON dataset
      codeDict[key] = [segCategory,segType,segModifier,slicerName,segRGB,False]

print "Total valid entries in CSV:",len(codeDict.keys())

totalJSONEntries = 0
matchedCodes = []
for c in range(len(jsonCodes["SegmentationCodes"]["Category"])):
  for t in range(len(jsonCodes["SegmentationCodes"]["Category"][c]["Type"])):
    if "Modifier" in jsonCodes["SegmentationCodes"]["Category"][c]["Type"][t]:
      for m in range(len(jsonCodes["SegmentationCodes"]["Category"][c]["Type"][t]["Modifier"])):
        matched = addColor(codeDict,jsonCodes,c,t,m)
        totalJSONEntries = totalJSONEntries+1
        if matched:
          matchedJsonCodes.append([c,t,m])
    else:
      matched = addColor(codeDict,jsonCodes,c,t)
      totalJSONEntries = totalJSONEntries+1
      if matched:
        matchedJsonCodes.append([c,t])

# copy matched codes to a new JSON
matchedCodesJson = {}
matchedCodesJson["SegmentationCodes"] = {}
matchedCodesJson["SegmentationCodes"]["Category"] = {}
# look up if a category with the given key/coding scheme already exists
categoryLookupByKey = {}

if len(matchedCodes):
  for t in matchedJsonCodes:
    cCat = jsonCodes["SegmentationCodes"]["Category"][t[0]]]
    cType = jsonCodes["SegmentationCodes"]["Category"][t[0]]]["Type"][t[1]]
    if len(t)==3:
      cMod = jsonCodes["SegmentationCodes"]["Category"][t[0]]]["Type"][t[1]]["Modifier"][t[2]]
    else:
      cMod = None

print "Total JSON entries:",totalJSONEntries

unmatchedEntries = [l for l in codeDict.values() if l[-1]==False]
print "Total unmatched entries:",len(unmatchedEntries)

for e in unmatchedEntries:
  print e[0].toStr(),e[1].toStr(),e[2].toStr()

if outputJSONFileName:
  f = open(outputJSONFileName,"w")
  f.write(json.dumps(jsonCodes,indent=2))


text:
package com.vk.google.map;

import android.content.Context;
import android.location.Location;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.widget.Toast;
/*
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapsInitializer;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.vk.vktestapp.R;
*/
public class MapsActivity extends FragmentActivity //implements OnMapReadyCallback
{
 /*   private GoogleMap mMap;
    private double mCurrentLat = 55.75;
    private double mCurrentLong = 37.61;
    // ClusterItem mChosenPhotoItem;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.maps_fragment);
        SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
                .findFragmentById(R.id.map);
    //    mapFragment.getMapAsync(this);
     //   this.mMap = mapFragment.getMap();
    }

    @Override
    public void onMapReady(GoogleMap map) {
        // Add a marker in Sydney, Australia, and move the camera.
        LatLng sydney = new LatLng(55.75, 37.61);
        map.addMarker(new MarkerOptions().position(sydney).title("Marker in Moscow"));
        map.moveCamera(CameraUpdateFactory.newLatLng(sydney));
   //     map.setOnMapLongClickListener(this);
    }
*/
}


text:
@interface LXLSettingController : UITableViewController

@end


text:
<?php
use yii\widgets\ActiveForm;
use yii\helpers\Html;
use kartik\file\FileInput;
?>

<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]) ?>

    <?= $form->field($model, 'sqlFiles[]')->widget(FileInput::classname(), [
	    'options' => [
	    	'multiple' => true
	    ],
	]); ?>

	<?= Html::submitButton('Save', ['class' => 'btn btn-lg btn-success']) ?>

<?php ActiveForm::end() ?>


text:
require 'calabash-cucumber'

namespace :calabash do

    desc "Reset Simulator Content and Settings"
    task :reset_simulator do
        Calabash_Runner::reset_simulator
    end

    desc "Enable Accessibility On Simulator"
    task :enable_accessibility do
        Calabash_Runner::enable_accessibility
    end

    desc "Disable Location Dialog On Simulator"
    task :disable_location_dialog , :bundle_id do |_,args|
        Calabash_Runner::sim_location(args[:bundle_id])
    end

    desc "Close the Simulator"
    task :close_simulator do
        Calabash_Runner::close_simulator
    end
end


text:
#ifndef CALL_GRAPH_HPP__
#define CALL_GRAPH_HPP__

/*
   Build a call graph (CG)
*/

#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/iterator/transform_iterator.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/noncopyable.hpp>

#include <crab/common/debug.hpp>
#include <crab/common/stats.hpp>
#include <crab/common/types.hpp>
#include <crab/cfg/cfg.hpp>

#include <functional> // for wrapper_reference

namespace crab {

   namespace cg {

      // Class to build a call graph
      //
      // Important: this class assumes that all function calls have been
      // resolved. This must be ensured by the client.
      template <typename CFG>
      class call_graph: boost::noncopyable {

        // Wrapper for call graph nodes
        class cg_node {

          typedef typename CFG::basic_block_t::callsite_t callsite_t;
          typedef typename CFG::fdecl_t fdecl_t;

          CFG m_cfg;
          int m_id;

         public:

          typedef CFG cfg_t;
          typedef typename CFG::varname_t varname_t;

         public:

          cg_node () { } // needed for BGL

          cg_node (CFG cfg, int id):
              m_cfg (cfg), m_id (id) { }

          CFG get_cfg () { return m_cfg;  }

          int index () const { return m_id; }

          varname_t name () const {
            auto d_opt = m_cfg.get_func_decl ();
            if (!d_opt) CRAB_ERROR("No function name found");
            return (*d_opt).get_func_name ();
          }

          std::string str_name () const {
            auto d_opt = m_cfg.get_func_decl ();
            if (!d_opt) CRAB_ERROR("No function name found");
            return (*d_opt).get_func_name ().str ();
          }

          bool operator==(const cg_node &o) const {
            return index () == o.index ();
          }

          bool operator!=(const cg_node &o) const {
            return !(*this == o);
          }

          friend crab_os& operator<<(crab_os& o, cg_node n) {
            o << n.str_name ();
            return o;
          }

          friend size_t hash_value (cg_node n) {
            return n.index ();
          }
        };

        // Wrapper for call graph edges
        // BGL complains if we use std::pair<cg_node,cg_node>
        template <typename T>
        struct cg_edge  {
          T m_s;
          T m_d;
          cg_edge (){ }
          cg_edge (T s, T d): m_s (s), m_d (d) { }
          T src () const { return m_s; }
          T dest () const { return m_d; }
          bool operator== (const cg_edge<T> &o) const {
            return (m_s == o.src () && m_d == o.dest ());
          }
          bool operator!= (const cg_edge<T> &o) const {
            return !(*this == o);
          }
        };

        /// --- begin internal representation of the call graph
        struct  vertex_t { cg_node func; };
        typedef boost::adjacency_list<boost::setS, //disallow parallel edges
				      boost::vecS, boost::bidirectionalS,
				      boost::property<boost::vertex_color_t,
						      boost::default_color_type,
                                        vertex_t> > cg_t;
        typedef typename boost::graph_traits<cg_t>::vertex_descriptor vertex_descriptor_t;
        typedef typename boost::graph_traits<cg_t>::edge_descriptor edge_descriptor_t;
        typedef typename boost::graph_traits<cg_t>::vertex_iterator vertex_iterator;
        typedef typename boost::graph_traits<cg_t>::out_edge_iterator out_edge_iterator;
        typedef typename boost::graph_traits<cg_t>::in_edge_iterator in_edge_iterator;
        /// --- end internal representation of the call graph

        typedef boost::unordered_map<std::size_t, vertex_descriptor_t > vertex_map_t;
        typedef boost::unordered_map <cg_node, vertex_descriptor_t > node_vertex_id_map_t;
        typedef typename CFG::varname_t varname_t;
        typedef typename CFG::number_t number_t;
        typedef crab::cfg::statement_visitor<number_t, varname_t> stmt_visitor_t;

        struct mk_edge_vis: public stmt_visitor_t {
          typedef typename stmt_visitor_t::bin_op_t   bin_op_t;
          typedef typename stmt_visitor_t::assign_t   assign_t;
          typedef typename stmt_visitor_t::assume_t   assume_t;
          typedef typename stmt_visitor_t::havoc_t    havoc_t;
          typedef typename stmt_visitor_t::unreach_t  unreach_t;
          typedef typename stmt_visitor_t::select_t   select_t;
          typedef typename stmt_visitor_t::callsite_t callsite_t;
          typedef typename CFG::fdecl_t fdecl_t;

          cg_t& m_cg;
          vertex_map_t& m_vertex_map;
          std::size_t m_from;

          mk_edge_vis (cg_t &cg, vertex_map_t &vertex_map, fdecl_t &from):
              m_cg (cg), m_vertex_map (vertex_map),
              m_from (cfg::cfg_hasher<CFG>::hash (from)) {
          }

          void visit(callsite_t& cs) {
            size_t to = cfg::cfg_hasher<CFG>::hash (cs);
            auto it_from = m_vertex_map.find (m_from);
            auto it_to = m_vertex_map.find (to);

            CRAB_LOG("cg", crab::outs() << "Visiting call site" << cs << "\n";);

            if (it_from == m_vertex_map.end ())
            {
              CRAB_LOG("cg", crab::outs() << "Not found caller \n";);
              return;
            }

            if (it_to == m_vertex_map.end ())
            {
              CRAB_LOG("cg", crab::outs() << "Not found callee \n";);
              return;
            }

            auto res = add_edge (it_from->second, it_to->second, m_cg);
            if (res.second)
              CRAB_LOG("cg",
                       crab::outs() << "Added cg edge " <<  it_from->second
                                 << " --> " <<  it_to->second;);

          }
        };

        struct mk_node :
            public std::unary_function < vertex_descriptor_t, cg_node > {

          cg_t* _cg;

          mk_node (): _cg(nullptr) { }
          mk_node (cg_t *cg): _cg (cg) { }
          cg_node& operator()(const vertex_descriptor_t& v) const {
            assert (_cg);
            return (*_cg)[v].func;
          }
        };

        struct mk_edge :
            public std::unary_function < edge_descriptor_t, cg_edge<cg_node> > {

          cg_t* _cg;

          mk_edge(): _cg(nullptr) {}
          mk_edge(cg_t *cg): _cg(cg) { }
          cg_edge<cg_node> operator()(const edge_descriptor_t& e) const {
            assert (_cg);
            cg_node& s = (*_cg)[boost::source(e, (*_cg))].func;
            cg_node& t = (*_cg)[boost::target(e, (*_cg))].func;
            return cg_edge<cg_node>(s,t);
          }
        };

       public:

        typedef cg_node node_t;
        typedef cg_edge <node_t> edge_t;
        typedef boost::transform_iterator<mk_node, vertex_iterator> node_iterator;
        typedef boost::transform_iterator<mk_edge, in_edge_iterator> pred_iterator;
        typedef boost::transform_iterator<mk_edge, out_edge_iterator> succ_iterator;

       private:

        // call graph
        std::shared_ptr<cg_t> m_cg;
        // map hashed values to internal BGL vertex descriptor
        vertex_map_t m_vertex_map;
        // map cg_node to internal BGL vertex descriptor
        node_vertex_id_map_t m_node_vertex_id_map;
        // counter to generate unique ids
        int m_id;

        vertex_descriptor_t get_vertex (const node_t &n) const {
          auto It = m_node_vertex_id_map.find (n);
          if (It != m_node_vertex_id_map.end ())
            return It->second;
          CRAB_ERROR("Call graph could not find node");
        }

        template<typename CFGIt>
        void build_call_graph (CFGIt I, CFGIt E) {
          crab::ScopedCrabStats __st__("call_graph");

          // --- add vertices in the call graph
          for (auto cfg: boost::make_iterator_range(I,E)) {
            auto decl_opt = cfg.get_func_decl ();
            if (!decl_opt)
              CRAB_ERROR("Could not compute call graph: function info is missing.");

            size_t k = cfg::cfg_hasher<CFG>::hash (*decl_opt);
            vertex_descriptor_t v = add_vertex (*m_cg);
            m_vertex_map.insert (std::make_pair (k,v));
            node_t f (cfg, m_id++);
            m_node_vertex_id_map.insert(std::make_pair (f, v));
            (*m_cg)[v].func = f;

            CRAB_LOG("cg",
                     crab::outs() << "Added call graph node " <<  *decl_opt
                     <<  "--- id=" <<  v << "\n";);

          }

          // --- add edges in the call graph
          for (auto cfg: boost::make_iterator_range(I,E)) {
            auto decl_opt = cfg.get_func_decl ();
            assert (decl_opt);

            for (auto const &bb : boost::make_iterator_range (cfg.begin (),
                                                              cfg.end ())) {
              mk_edge_vis vis (*m_cg, m_vertex_map, *decl_opt);
              for (auto it = bb.begin (); it != bb.end (); ++it)
                it->accept(&vis);
            }
          }

        }

        // call_graph (const call_graph& o)
        //     : m_cg (o.m_cg), // shallow copy
        //       m_vertex_map (o.m_vertex_map),
        //       m_node_vertex_id_map (o.m_node_vertex_id_map),
        //       m_id (o.m_id) { }

        // call_graph (call_graph &&o)
        //     : m_cg (std::move(o.m_cg)),
        //       m_vertex_map (std::move(o.m_vertex_map)),
        //       m_node_vertex_id_map (std::move(o.m_node_vertex_id_map)),
        //       m_id (o.m_id) { }

       public:

        call_graph (std::vector<CFG>& cfgs)
            : m_cg (new cg_t()), m_id (0) {
          build_call_graph (cfgs.begin(), cfgs.end());
        }

        template<typename CFGIt>
        call_graph (CFGIt I, CFGIt E)
            : m_cg (new cg_t()), m_id (0) {
          build_call_graph (I,E);
        }

        std::pair<node_iterator, node_iterator>
        nodes () const {
          auto p = boost::vertices (*m_cg);
          return std::make_pair (make_transform_iterator (p.first, mk_node (&*m_cg)),
                                 make_transform_iterator (p.second, mk_node (&*m_cg)));
        }

        std::pair<succ_iterator, succ_iterator>
        succs (const node_t &n) const {
          vertex_descriptor_t v = get_vertex(n);
          auto p = boost::out_edges (v, *m_cg);
          return std::make_pair (make_transform_iterator (p.first, mk_edge (&*m_cg)),
                                 make_transform_iterator (p.second, mk_edge (&*m_cg)));
        }

        std::pair<pred_iterator, pred_iterator>
        preds (const node_t &n) const {
          vertex_descriptor_t v = get_vertex(n);
          auto p = boost::in_edges (v, *m_cg);
          return std::make_pair (make_transform_iterator (p.first, mk_edge (&*m_cg)),
                                 make_transform_iterator (p.second, mk_edge (&*m_cg)));
        }

        std::size_t num_nodes () const {
           return boost::num_vertices (*m_cg);
        }

        std::size_t num_succs (const node_t &n) const {
          vertex_descriptor_t v = get_vertex(n);
          return boost::out_degree (v, *m_cg);
        }

        std::size_t num_preds (const node_t &n) const {
          vertex_descriptor_t v = get_vertex(n);
          return boost::in_degree (v, *m_cg);
        }

        void write(crab_os& o) const {
          o << "CG=\n";
          for (auto f: boost::make_iterator_range (nodes ())){
            if (num_succs (f) > 0) {
              for (auto e: boost::make_iterator_range (succs (f)))  {
                o << e.src() << "--> " << e.dest() << "\n";
              }
            }
          }
        }

      }; // end class call_graph<CFG>

      template <typename CFG>
      inline crab_os& operator<<(crab_os& o, const call_graph<CFG> &cg) {
        cg.write (o);
        return o;
      }

      // A lightweight object that wraps a reference to a call_graph into a
      // copyable, assignable object.
      template <class CG>
      class call_graph_ref {
       public:

        typedef typename CG::node_t node_t;
        typedef typename CG::edge_t edge_t;
        typedef typename CG::node_iterator node_iterator;
        typedef typename CG::pred_iterator pred_iterator;
        typedef typename CG::succ_iterator succ_iterator;

       private:

        boost::optional<std::reference_wrapper<CG> > _ref;

       public:

        call_graph_ref (CG &cg)
            : _ref(std::reference_wrapper<CG>(cg)) { }

        const CG& get() const {
          assert (_ref);
          return *_ref;
        }

        CG& get() {
          assert (_ref);
          return *_ref;
        }

        std::pair<node_iterator, node_iterator>
        nodes () const {
          assert (_ref);
          return (*_ref).get().nodes();
        }

        std::pair<succ_iterator, succ_iterator>
        succs (const node_t &n) const {
          assert (_ref);
          return (*_ref).get().succs(n);
        }

        std::pair<pred_iterator, pred_iterator>
        preds (const node_t &n) const {
          assert (_ref);
          return (*_ref).get().preds(n);
        }

        std::size_t num_nodes () const {
          assert (_ref);
          return (*_ref).get().num_nodes();
        }

        std::size_t num_succs (const node_t &n) const {
          assert (_ref);
          return (*_ref).get().num_succs(n);
        }

        std::size_t num_preds (const node_t &n) const {
          assert (_ref);
          return (*_ref).get().num_preds(n);
        }

        void write(crab_os& o) const {
          assert (_ref);
          (*_ref).get().write(o);
        }
      };

      template <typename CG>
      inline crab_os& operator<<(crab_os& o, const call_graph_ref<CG> &cg) {
        cg.write (o);
        return o;
      }

   } //end namespace cg
} // end namespace crab

#endif


text:
package app.remote.actor;

import akka.actor.ActorRef;
import akka.actor.Props;
import akka.actor.UntypedActor;
import app.message.Message;
import com.ning.http.client.AsyncHttpClient;
import io.netty.channel.ChannelHandlerContext;

/**
 * Author: kerr
 */
public class RemoteActor extends UntypedActor{
    private final ChannelHandlerContext ctx;
    private final AsyncHttpClient asyncHttpClient;

    public RemoteActor(ChannelHandlerContext ctx, AsyncHttpClient asyncHttpClient) {
        this.ctx = ctx;
        this.asyncHttpClient = asyncHttpClient;
    }

    public static Props props(ChannelHandlerContext ctx, AsyncHttpClient asyncHttpClient){
        return Props.create(RemoteActor.class,ctx,asyncHttpClient);
    }

    @Override
    public void onReceive(Object message) throws Exception {
        if (message instanceof Message.Request) {
            Message.Request request = (Message.Request) message;
            handleRequest(request);
            return;
        }
        if (message instanceof Message.Response) {
            Message.Response response = (Message.Response) message;
            handleResponse(response);
            return;
        }
        unhandled(message);
    }

    private void handleResponse(Message.Response response) {
        //get the response and write to the channel
        ctx.write(response);
        ctx.flush();
        if (response.getType().equals(Message.ResponseType.COMPLETE)){
            getContext().stop(getSelf());
        }
    }

    private void handleRequest(Message.Request request) {
        ActorRef fetcher = getContext().actorOf(FetchActor.props(asyncHttpClient));
        fetcher.tell(request,getSelf());
    }
}


text:
               {% if include.data-type == 'collection' %}

                        {% if include.field_Data.text-teaser != nill %}

                             {% if include.field_Data.text-words %}

{{ post.content | strip_html | truncatewords: include.field_Data.text-words }}

                              {% else %}

{{ post.content | split:'' | first }}

                              {% endif %}
                        {% else %}

{{ post.content }}

                           {% endif %}
                 {% else %}

                        {% if include.field_Data.text-teaser != nill %}

                                    {% if include.field_Data.text-words %}

{{ post.text | strip_html | truncatewords:{{ include.field_Data.text-words }}

                                    {% else %}

{{ post.text | split:'' | first }}

                                       {% endif %}
                              {% else %}

{{ post.text }}

                        {% endif %}
                    {% endif %}


text:
<TITLE>Review for Scary Movie (2000)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Scary Movie (2000)

reviewed by
Jon Popick

PLANET SICK-BOY: http://www.sick-boy.com
"We Put the SIN in Cinema"

Making a film that's a spoof of an entire movie genre is kind of a
strange proposal. They say that imitation is the sincerest form of
flattery, and even though Mel Brooks has built a pretty successful
career out of sending up westerns, space adventures and (unfortunately)
vampire flicks, the whole idea of the genre parody doesn't seem much
different than Beavis, Butt-Head, Tom Servo or Crow tearing movies apart
in their living rooms.

But what about a movie that spoofs a movie that spoofed a genre? That's
what we have with Scary Movie, the latest collaboration from the
brothers Wayans. They've already lampooned blaxploitation flicks (I'm
Gonna Git You Sucka!) and gangsta films (Don't Be a Menace to South
Central While Drinking Your Juice in the Hood), and here they satirize
the Scream trilogy, among other horror films. Even its title is taken
from the one that Scream abandoned.

Scary Movie begins with Carmen Electra (Hyperion Bay) making popcorn and
receiving a phone call from a masked killer, a la Drew Barrymore's
memorable opening scene in the first Scream picture. The story is more
than a little familiar – knife-wielding lunatic begins slashing his way
through a small clique of friends and is pursued by a soulless news
reporter (Cheri Oteri, Saturday Night Live) and a retarded deputy (Dave
Sheridan, MTV's short-lived Buzzkill). Even the school principal is
played by a down-and-out '70s television sitcom star (Henry `The Fonz'
Winkler in Scream, and David `Squiggy' Lander here).

It isn't long before Scary Movie moves from Scream to I Know What You
Did Last Summer. After a funny automobile accident involving oral sex
and a beehive (don't ask) that occurred exactly one year ago, the band
of boobs starts receiving notes that threaten to expose their big
secret. While they're at it, the Wayans also toss in a scene right from
Dawson's Creek, a show that was created by Scream and IKWYDLS
screenwriter Kevin Williamson.

There isn't really too much else to say about Scary Movie without giving
away a lot of its gags. Some of the jokes fall flat, but most are direct
hits. In addition to sending up the two recent horror hits, the film
also briefly tackles The Matrix, The Blair Witch Project and The Sixth
Sense. There are also unexpected homages to Amistad and The Usual
Suspects (the latter seemed to go over the head of just about everyone
in the theatre), and a sick, X-rated version of Johnny Depp's death
scene in A Nightmare on Elm Street.

Scary Movie was directed by Keenen Ivory Wayans (A Lowdown Dirty Shame)
and its script was cobbled together by no less than six screenwriters.
Originally, the film's production was supposed to take just a few weeks
at the end of the summer of 1999 and slated for a fall release. But then
the Wayans' script (originally titled Last Summer I Screamed Because
Halloween Fell On Friday the 13th) merged with a similar project that
spoofed horror pictures (called Scream If You Know What I Did Last
Halloween), and the production was stretched out long enough for the
film to include a parody of the `Wassup' Budweiser commercials.

1:26 - R for strong crude sexual humor, language, drug use and violence

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
package org.hamcrest.text;

import static org.hamcrest.core.AnyOf.anyOf;
import static org.hamcrest.core.IsNull.nullValue;

import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;

/**
 * Matches empty Strings (and null).
 */
public final class IsEmptyString extends BaseMatcher<String> {
    private static final IsEmptyString INSTANCE = new IsEmptyString();
    @SuppressWarnings("unchecked")
    private static final Matcher<String> NULL_OR_EMPTY_INSTANCE = anyOf(nullValue(), INSTANCE);

    public boolean matches(Object item) {
        return item != null && item instanceof String && ((String) item).equals("");
    }

    public void describeTo(Description description) {
        description.appendText("an empty string");
    }

    /**
     * Matches if value is null or zero-length string.
     */
    @Factory
    public static Matcher<String> isEmptyString() {
        return INSTANCE;
    }

    /**
     * Matches if value is null or zero-length string.
     */
    @Factory
    public static Matcher<String> isEmptyOrNullString() {
        return NULL_OR_EMPTY_INSTANCE;
    }
}


text:
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/chromeos/file_system_provider/operations/get_actions.h"

#include <string>
#include <utility>
#include <vector>

#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/json/json_reader.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "base/values.h"
#include "chrome/browser/chromeos/file_system_provider/operations/get_metadata.h"
#include "chrome/browser/chromeos/file_system_provider/operations/test_util.h"
#include "chrome/common/extensions/api/file_system_provider.h"
#include "chrome/common/extensions/api/file_system_provider_capabilities/file_system_provider_capabilities_handler.h"
#include "chrome/common/extensions/api/file_system_provider_internal.h"
#include "extensions/browser/event_router.h"
#include "storage/browser/fileapi/async_file_util.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace chromeos {
namespace file_system_provider {
namespace operations {
namespace {

const char kExtensionId[] = "mbflcebpggnecokmikipoihdbecnjfoj";
const char kFileSystemId[] = "testing-file-system";
const int kRequestId = 2;
const base::FilePath::CharType kDirectoryPath[] =
    FILE_PATH_LITERAL("/directory");
const base::FilePath::CharType kFilePath[] = FILE_PATH_LITERAL("/file");

// Callback invocation logger. Acts as a fileapi end-point.
class CallbackLogger {
 public:
  class Event {
   public:
    Event(const Actions& actions, base::File::Error result)
        : actions_(actions), result_(result) {}
    virtual ~Event() {}

    const Actions& actions() const { return actions_; }
    base::File::Error result() const { return result_; }

   private:
    Actions actions_;
    base::File::Error result_;

    DISALLOW_COPY_AND_ASSIGN(Event);
  };

  CallbackLogger() {}
  virtual ~CallbackLogger() {}

  void OnGetActions(const Actions& actions, base::File::Error result) {
    events_.push_back(new Event(actions, result));
  }

  const ScopedVector<Event>& events() const { return events_; }

 private:
  ScopedVector<Event> events_;

  DISALLOW_COPY_AND_ASSIGN(CallbackLogger);
};

// Returns the request value as |result| in case of successful parse.
void CreateRequestValueFromJSON(const std::string& json,
                                scoped_ptr<RequestValue>* result) {
  using extensions::api::file_system_provider_internal::
      GetActionsRequestedSuccess::Params;

  int json_error_code;
  std::string json_error_msg;
  scoped_ptr<base::Value> value = base::JSONReader::ReadAndReturnError(
      json, base::JSON_PARSE_RFC, &json_error_code, &json_error_msg);
  ASSERT_TRUE(value.get()) << json_error_msg;

  base::ListValue* value_as_list;
  ASSERT_TRUE(value->GetAsList(&value_as_list));
  scoped_ptr<Params> params(Params::Create(*value_as_list));
  ASSERT_TRUE(params.get());
  *result = RequestValue::CreateForGetActionsSuccess(std::move(params));
  ASSERT_TRUE(result->get());
}

}  // namespace

class FileSystemProviderOperationsGetActionsTest : public testing::Test {
 protected:
  FileSystemProviderOperationsGetActionsTest() {}
  ~FileSystemProviderOperationsGetActionsTest() override {}

  void SetUp() override {
    file_system_info_ = ProvidedFileSystemInfo(
        kExtensionId, MountOptions(kFileSystemId, "" /* display_name */),
        base::FilePath(), false /* configurable */, true /* watchable */,
        extensions::SOURCE_FILE);
    entry_paths_.clear();
    entry_paths_.push_back(base::FilePath(kDirectoryPath));
    entry_paths_.push_back(base::FilePath(kFilePath));
  }

  ProvidedFileSystemInfo file_system_info_;
  std::vector<base::FilePath> entry_paths_;
};

TEST_F(FileSystemProviderOperationsGetActionsTest, Execute) {
  using extensions::api::file_system_provider::GetActionsRequestedOptions;

  util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
  CallbackLogger callback_logger;

  GetActions get_actions(NULL, file_system_info_, entry_paths_,
                         base::Bind(&CallbackLogger::OnGetActions,
                                    base::Unretained(&callback_logger)));
  get_actions.SetDispatchEventImplForTesting(
      base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
                 base::Unretained(&dispatcher)));

  EXPECT_TRUE(get_actions.Execute(kRequestId));

  ASSERT_EQ(1u, dispatcher.events().size());
  extensions::Event* event = dispatcher.events()[0];
  EXPECT_EQ(
      extensions::api::file_system_provider::OnGetActionsRequested::kEventName,
      event->event_name);
  base::ListValue* event_args = event->event_args.get();
  ASSERT_EQ(1u, event_args->GetSize());

  const base::DictionaryValue* options_as_value = NULL;
  ASSERT_TRUE(event_args->GetDictionary(0, &options_as_value));

  GetActionsRequestedOptions options;
  ASSERT_TRUE(
      GetActionsRequestedOptions::Populate(*options_as_value, &options));
  EXPECT_EQ(kFileSystemId, options.file_system_id);
  EXPECT_EQ(kRequestId, options.request_id);
  ASSERT_EQ(entry_paths_.size(), options.entry_paths.size());
  EXPECT_EQ(entry_paths_[0].value(), options.entry_paths[0]);
  EXPECT_EQ(entry_paths_[1].value(), options.entry_paths[1]);
}

TEST_F(FileSystemProviderOperationsGetActionsTest, Execute_NoListener) {
  util::LoggingDispatchEventImpl dispatcher(false /* dispatch_reply */);
  CallbackLogger callback_logger;

  GetActions get_actions(NULL, file_system_info_, entry_paths_,
                         base::Bind(&CallbackLogger::OnGetActions,
                                    base::Unretained(&callback_logger)));
  get_actions.SetDispatchEventImplForTesting(
      base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
                 base::Unretained(&dispatcher)));

  EXPECT_FALSE(get_actions.Execute(kRequestId));
}

TEST_F(FileSystemProviderOperationsGetActionsTest, OnSuccess) {
  util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
  CallbackLogger callback_logger;

  GetActions get_actions(NULL, file_system_info_, entry_paths_,
                         base::Bind(&CallbackLogger::OnGetActions,
                                    base::Unretained(&callback_logger)));
  get_actions.SetDispatchEventImplForTesting(
      base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
                 base::Unretained(&dispatcher)));

  EXPECT_TRUE(get_actions.Execute(kRequestId));

  // Sample input as JSON. Keep in sync with file_system_provider_api.idl.
  // As for now, it is impossible to create *::Params class directly, not from
  // base::Value.
  const std::string input =
      "[\n"
      "  \"testing-file-system\",\n"  // kFileSystemId
      "  2,\n"                        // kRequestId
      "  [\n"
      "    {\n"
      "      \"id\": \"SAVE_FOR_OFFLINE\"\n"
      "    },\n"
      "    {\n"
      "      \"id\": \"OFFLINE_NOT_NECESSARY\",\n"
      "      \"title\": \"Ignored title.\"\n"
      "    },\n"
      "    {\n"
      "      \"id\": \"SomeCustomActionId\",\n"
      "      \"title\": \"Custom action.\"\n"
      "    }\n"
      "  ],\n"
      "  0\n"  // execution_time
      "]\n";
  scoped_ptr<RequestValue> request_value;
  ASSERT_NO_FATAL_FAILURE(CreateRequestValueFromJSON(input, &request_value));

  const bool has_more = false;
  get_actions.OnSuccess(kRequestId, std::move(request_value), has_more);

  ASSERT_EQ(1u, callback_logger.events().size());
  CallbackLogger::Event* event = callback_logger.events()[0];
  EXPECT_EQ(base::File::FILE_OK, event->result());

  ASSERT_EQ(3u, event->actions().size());
  const Action action_share = event->actions()[0];
  EXPECT_EQ("SAVE_FOR_OFFLINE", action_share.id);
  EXPECT_EQ("", action_share.title);

  const Action action_pin_toggle = event->actions()[1];
  EXPECT_EQ("OFFLINE_NOT_NECESSARY", action_pin_toggle.id);
  EXPECT_EQ("Ignored title.", action_pin_toggle.title);

  const Action action_custom = event->actions()[2];
  EXPECT_EQ("SomeCustomActionId", action_custom.id);
  EXPECT_EQ("Custom action.", action_custom.title);
}

TEST_F(FileSystemProviderOperationsGetActionsTest, OnError) {
  util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
  CallbackLogger callback_logger;

  GetActions get_actions(NULL, file_system_info_, entry_paths_,
                         base::Bind(&CallbackLogger::OnGetActions,
                                    base::Unretained(&callback_logger)));
  get_actions.SetDispatchEventImplForTesting(
      base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
                 base::Unretained(&dispatcher)));

  EXPECT_TRUE(get_actions.Execute(kRequestId));

  get_actions.OnError(kRequestId, scoped_ptr<RequestValue>(new RequestValue()),
                      base::File::FILE_ERROR_TOO_MANY_OPENED);

  ASSERT_EQ(1u, callback_logger.events().size());
  CallbackLogger::Event* event = callback_logger.events()[0];
  EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, event->result());
  ASSERT_EQ(0u, event->actions().size());
}

}  // namespace operations
}  // namespace file_system_provider
}  // namespace chromeos


text:
{% if category_list %}
    <!DOCTYPE html>

Find Events

    <form class="main" name="search" action="{% url 'events:search' %}" method="get">
    {% csrf_token %}
    Enter location and select up to three categories

Address:<input type="text" name="address" required style="width:30%"> Distance:<select name="within">
        <option value="25mi" selected>25 Miles</option>
        <option value="50mi">50 Miles</option>
        <option value="100mi">100 Miles</option>
      </select>

    {% for category in category_list %}
      <input type="checkbox" name="cat" value="{{ category.cat_id}}" onClick="return KeepCount()"/>{{ category.short_name }}
      {% if forloop.counter == 5 or forloop.counter == 10 or forloop.counter == 15 or forloop.counter == 20%}

      {% endif %}
    {% endfor %}

    <input class="sb" type="submit" onClick="return made_selection()" value="Search" />
    </form>

{% else %}

    <meta HTTP-EQUIV="REFRESH" content="0; {% url 'events:cats'  %}">
{% endif %}