text:
package com.owwlo.courier.s;

import android.app.Application;
import android.content.Context;
import android.util.Log;

public class CourierSApp extends Application {
    private static final String TAG = "CourierApp";

    public void onCreate() {
        super.onCreate();
        Log.i(TAG, "start");
    }
}

redpajama_set_name: RedPajamaGithub


text:
package co.cask.cdap.cli.util;

import co.cask.cdap.api.common.Bytes;
import co.cask.cdap.cli.CLIConfig;
import co.cask.cdap.cli.exception.CommandInputError;
import co.cask.cdap.proto.ProgramType;
import co.cask.cdap.proto.id.ApplicationId;
import co.cask.cdap.proto.id.ProgramId;
import co.cask.common.cli.util.Parser;
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;

import java.nio.ByteBuffer;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;

/**
 *
 */
public abstract class AbstractCommand extends AbstractAuthCommand {
  private static final int DEFAULT_MAX_BODY_SIZE = 256;
  private static final int DEFAULT_LINE_WRAP_LIMIT = 64;
  private static final String DEFAULT_LINE_SEPARATOR = System.getProperty("line.separator");

  public AbstractCommand(CLIConfig cliConfig) {
    super(cliConfig);
  }

  protected Map<String, String> parseMap(@Nullable String value) {
    return ArgumentParser.parseMap(value);
  }

  protected List<String> parseList(@Nullable String value) {
    if (value == null) {
      return ImmutableList.of();
    }

    return Parser.parseInput(value);
  }

  /**
   * Creates a string representing the body in the output. It only prints up to {@link #DEFAULT_MAX_BODY_SIZE},
   * with line wrap at each {@link #DEFAULT_LINE_WRAP_LIMIT} character.
   */
  protected String getBody(ByteBuffer body) {
    return getBody(body, DEFAULT_MAX_BODY_SIZE, DEFAULT_LINE_WRAP_LIMIT, DEFAULT_LINE_SEPARATOR);
  }

  /**
   * Creates a string representing the body in the output. It only prints up to {@code maxBodySize}, with line
   * wrap at each {@code lineWrapLimit} character.
   */
  protected String getBody(ByteBuffer body, int maxBodySize, int lineWrapLimit, String lineSeparator) {
    ByteBuffer bodySlice = body.slice();
    boolean hasMore = false;
    if (bodySlice.remaining() > maxBodySize) {
      bodySlice.limit(maxBodySize);
      hasMore = true;
    }

    String str = Bytes.toStringBinary(bodySlice) + (hasMore ? "..." : "");
    if (str.length() <= lineWrapLimit) {
      return str;
    }
    return Joiner.on(lineSeparator).join(Splitter.fixedLength(lineWrapLimit).split(str));
  }

  protected void checkInputLength(String[] inputParts, int requiredLength) {
    if (inputParts.length != requiredLength) {
      throw new CommandInputError(this);
    }
  }

  /**
   * Creates a string representing the output of response headers. Each key/value pair is outputted on its own
   * line in the form {@code <key> : <value>}.
   */
  protected String formatHeader(Map<String, String> headers) {
    StringBuilder builder = new StringBuilder();
    String separator = "";
    for (Map.Entry<String, String> entry : headers.entrySet()) {
      builder.append(separator).append(entry.getKey()).append(" : ").append(entry.getValue());
      separator = DEFAULT_LINE_SEPARATOR;
    }
    return builder.toString();
  }

  /**
   * Returns a timestamp in milliseconds.
   *
   * @param arg The string argument user provided.
   * @param base The base timestamp to relative from if the time format provided is a relative time.
   * @return Timestamp in milliseconds
   * @throws co.cask.cdap.cli.exception.CommandInputError if failed to parse input.
   */
  protected long getTimestamp(String arg, long base) {
    try {
      if (arg.startsWith("+") || arg.startsWith("-")) {
        int dir = arg.startsWith("+") ? 1 : -1;
        char type = arg.charAt(arg.length() - 1);
        int offset = Integer.parseInt(arg.substring(1, arg.length() - 1));
        switch (type) {
          case 's':
            return base + dir * TimeUnit.SECONDS.toMillis(offset);
          case 'm':
            return base + dir * TimeUnit.MINUTES.toMillis(offset);
          case 'h':
            return base + dir * TimeUnit.HOURS.toMillis(offset);
          case 'd':
            return base + dir * TimeUnit.DAYS.toMillis(offset);
          default:
            throw new CommandInputError(this, "Unsupported relative time format: " + type);
        }
      }
      if (arg.equalsIgnoreCase("min")) {
        return 0L;
      }
      if (arg.equalsIgnoreCase("max")) {
        return Long.MAX_VALUE;
      }

      return Long.parseLong(arg);
    } catch (NumberFormatException e) {
      throw new CommandInputError(this, "Invalid number value: " + arg + ". Reason: " + e.getMessage());
    }
  }

  protected ApplicationId parseAppId(String[] programIdParts) {
    checkInputLength(programIdParts, 1);
    return cliConfig.getCurrentNamespace().app(programIdParts[0]);
  }

  protected ProgramId parseProgramId(String[] programIdParts, ProgramType programType) {
    checkInputLength(programIdParts, 2);
    return cliConfig.getCurrentNamespace().app(programIdParts[0]).program(programType, programIdParts[1]);
  }
}


text:
import React, {Component} from 'react';
import * as FirebaseActions from '../firebaseFunctions';
import cookie from 'react-cookie';
import {Pie} from 'react-chartjs-2';

class Dashboard extends Component {

	constructor() {
		super();

		this.retrieveAuditHistory = this.retrieveAuditHistory.bind(this);
		this.renderAudit = this.renderAudit.bind(this);
		this.renderAuditHistory = this.renderAuditHistory.bind(this);
		this.retrieveCourseHistory = this.retrieveCourseHistory.bind(this);
		this.renderCourse = this.renderCourse.bind(this);
		this.renderCourseHistory = this.renderCourseHistory.bind(this);
		this.retrieveUserSpace = this.retrieveUserSpace.bind(this);
		this.updatePieChart = this.updatePieChart.bind(this);

		this.state = {
			courseHistory: [],
			courses: [],
			courseInitialized: true,
			auditHistory: [],
			audits: [],
			auditInitialized: true,
			chartClass: 'hide',
			chartData:{
				labels:[
					'Completed',
					'Uncompleted'
				],
				datasets:[
					{
						data: [0,0],
						backgroundColor:[
							'#0ef729',
							'#f92020'
						],
						hoverBackgroundColor:[
							'#0ef729',
							'#f92020'
						]
					}
				]
			},
			chartOptions:{
				mantainAspectRatio: false,
				responsive: true
			}
		};
	}

	componentDidMount(){
		const props = this.props;
		//if we're not signed in, then we need to re-auth, or redirect to the login page.
		props.checkAuth('Dashboard');
		this.retrieveUserSpace();
		this.updatePieChart();
	}

	retrieveUserSpace() {
		let outerThis = this;
		FirebaseActions.userSpace(cookie.load('TOKEN'), function(response){
			let userSpace = response.userSpace;
			if (userSpace.Courses.initialized) {
				let courseList = [];
				let courses = response.userSpace.Courses;
				for (let course in courses) {
					if (courses.hasOwnProperty(course) && course !== 'initialized') {
						courseList.push(courses[course]);
					}
				}
				outerThis.setState({
					courses: courseList,
				});
				outerThis.retrieveCourseHistory();
			} else {
				outerThis.setState({
					courseInitialized: userSpace.Courses.initialized
				});
			}
			if (userSpace.Audits.initialized) {
				let auditsList = [];
				let audits = response.userSpace.Audits;
				for (let audit in audits) {
					if (audits.hasOwnProperty(audit) && audit !== 'initialized') {
						audits[audit].name = audit;
						auditsList.push(audits[audit]);
					}
				}
				outerThis.setState({
					audits: auditsList,
				});
				outerThis.retrieveAuditHistory();
			} else {
				outerThis.setState({
					auditInitialized: response.userSpace.Audits.initialized
				});
			}
		});
	}

	retrieveAuditHistory() {
		if (this.state.auditInitialized) {
			let auditList = [];
			const maxHist = 3;
			let thisRef = this;
			//reverse the order
			auditList = this.state.audits.reverse();
			//remove all but the most recent ones
			auditList.splice(maxHist);
			//map to their rendered states.
			auditList=auditList.map((audit)=>(thisRef.renderAudit(audit)));

			this.setState({
				auditHistory: auditList,
			});
		}
	}

	renderAudit(audit) {
		const auditInfo = (

{audit.name}

		);
		return auditInfo;
	}

	// This only starts the request for now, it does not get a response
	runAudit() {
		let auditRequest = new Request('/run/audit', {method: 'POST', credentials: 'same-origin'});
		fetch(auditRequest).then((response) => response.json()).then((response) => {
			console.log('The audit is donion-rings', response);
			if (response.Success) {
				window.location.href=response.auditLink;
			}
		});
	}

	renderAuditHistory() {
		if (this.state.auditInitialized) {

			let temp = this.state.auditHistory.slice();
			if (this.state.auditHistory) {
				temp.push(<button key="btn" className="btn" onClick={this.runAudit} style={{marginTop:'15px'}}>Run Another Audit</button>);
			}
			const exists = (

Your most recent audits

						{this.state.auditHistory.length ? temp : '...' }

			);
			return exists;
		} else {
			const notExists = (

You have not run any audits yet!

					<button className="btn" onClick={this.runAudit}>Run Audit</button>

			);
			return notExists;
		}
	}

	retrieveCourseHistory() {
		if (this.state.courseInitialized) {
			let courseList = [];
			let maxHist = 3;
			let hist = 0;
			for (let course in this.state.courses) {
				if (this.state.courses.hasOwnProperty(course) && hist < maxHist) {
					courseList.push(this.renderCourse(this.state.courses[course]));
					hist ++;
				}
			}
			this.setState({
				courseHistory: courseList,
			});
		}
	}

	renderCourse(course) {
		const courseInfo = (

{course.name}

		);
		return courseInfo;
	}

	renderCourseHistory() {
		if (this.state.courseInitialized) {
			const exists = (

Here's some courses you've taken

						{this.state.courseHistory.length ? this.state.courseHistory : '...' }

			);
			return exists;
		} else {
			const notExists = (

You have not taken any courses yet!

					Add Courses

			);
			return notExists;
		}
	}

	updatePieChart(){
		let oldChartData = this.state.chartData;
		let dashboardRef = this;
		FirebaseActions.getCreditsTaken(cookie.load('TOKEN'), function(credsTaken){
			FirebaseActions.getTotalCredits(function(credsTotal){
				let credsRemaining = credsTotal - credsTaken;
				oldChartData.datasets[0].data[0] = credsTaken;
				if(credsRemaining<0){
					oldChartData.datasets[0].data[1] = 0;
				}else{
					oldChartData.datasets[0].data[1] = credsRemaining;
				}
				dashboardRef.setState({
					chartClass: '',
					chartData: oldChartData
				});

			});
		});
	}

	render() {
		return (

Overall Degree Completion

(by credits)

										<Pie data={this.state.chartData} options={this.state.chartOptions} redraw/>

Courses

								{this.renderCourseHistory()}

Audits

								{this.renderAuditHistory()}

);
	}
}

Dashboard.contextTypes = {
	router: React.PropTypes.object
};

Dashboard.PropTypes = {
	checkAuth: React.PropTypes.func
};

export default Dashboard;


text:
<!-- "Fetch external resource" "true" -->

<!DOCTYPE tag PUBLIC "x3" "http://my<caret>file">

<tag />


text:
layout: post
title:  Helpful error messages
---
Rakudo lately got an interesting change. Consider following buggy code
(for array binary search), written in functional style (I'm using
recursion). The bug is that it doesn't work because of two different
identifiers `binary-search` and `binary_search`.

<script>
document.write("\x3Cscript src\=\'https://gist.github.com/4577858.js'>\x3C\/script>")
</script>

Trying to run it shows compile time error message. The compile part is
important. If you would remove `binary-search` call at end, it still
would report an error, unlike Python.

    ===SORRY!===
    Undeclared routine:
        binary_search used at lines 2, 8, 9. Did you mean '&binary-search'?

Now you know what's wrong and you can easily fix it. Unlike let's say,
Jekyll that I use for my blog. Not only it doesn't work on my PC for
some reason, but also [refused to highlight my code] - it gave some sort
of XML error (it simply said "REXML could not parse this XML/HTML").
I gave up and put it on Gist. And the first attempt was failed, because
embed code is `<script>` and Jekyll self-closed the tag (XML-style, but
this is HTML). This is annoying.

[refused to highlight my code]: https://github.com/GlitchMr/glitchmr.github.com/commits/master/_posts/2013-01-20-helpful-error-messages.md "GitHub: GlitchMr/glitchmr.github.com (history for this post)"


text:
namespace Assets.BresenhamLine
{
    public enum ThicknessMode : byte
    {
        /**
         * Line goes through the center
         */
        MIDDLE,

        /**
         * Line goes along the border (clockwise)
         */
        CLOCKWISE,

        /**
         * Line goes along the border (counter-clockwise)
         */
        COUNTERCLOCKWISE
    }
}


text:
/**
 * @author lujijiang
 */
/**
 * @author lujijiang
 *
 */
package com.saasxx.core.module.account.web.webrpc;


text:
from header_factions import *

####################################################################################################################
#  Each faction record contains the following fields:
#  1) Faction id: used for referencing factions in other files.
#     The prefix fac_ is automatically added before each faction id.
#  2) Faction name.
#  3) Faction flags. See header_factions.py for a list of available flags
#  4) Faction coherence. Relation between members of this faction.
#  5) Relations. This is a list of relation records.
#     Each relation record is a tuple that contains the following fields:
#    5.1) Faction. Which other faction this relation is referring to
#    5.2) Value: Relation value between the two factions.
#         Values range between -1 and 1.
#  6) Ranks
#  7) Faction color (default is gray)
####################################################################################################################

factions = [
  ("commoners","Commoners"     ,0, 0,[],[],0xffffff),
  ("outlaws"  ,"Outlaws"       ,0, 0,[],[],0x775500),
  ("bandits"  ,"Bandits"       ,0, 0,[],[],0xff0000),
# Factions before this point are hardwired into the game end their order should not be changed.
  ("1"        ,"Purple_faction",0, 0,[],[],0x800080),
  ("2"        ,"Red_faction"   ,0, 0,[],[],0xdd0000),
  ("3"        ,"Yellow_faction",0, 0,[],[],0xdaa520),
  ("4"        ,"Black_faction" ,0, 0,[],[],0x000000),
  ("5"        ,"Green_faction" ,0, 0,[],[],0x228b22),
  ("6"        ,"Blue_faction"  ,0, 0,[],[],0x000080),
  ("factions_end","End"  ,0, 0,[],[]),
]


text:
from django.test import TestCase
from corehq.apps.hqadmin.dbaccessors import get_all_forms_in_all_domains
from couchforms.models import XFormInstance
from couchforms.tests.testutils import post_xform_to_couch
import os
import json
from dimagi.utils.couch.database import get_db
from ..config import DocumentTransform
from ..deidentification.forms import deidentify_form

class FormDeidentificationTestCase(TestCase):

    def setUp(self):

        for item in get_all_forms_in_all_domains():
            item.delete()

    def testCRSReg(self):
        file_path = os.path.join(os.path.dirname(__file__), "data", "crs_reg.xml")
        with open(file_path, "rb") as f:
            xml_data = f.read()

        self.instance = post_xform_to_couch(xml_data)

        transform = DocumentTransform(self.instance._doc, get_db())
        self.assertTrue("IDENTIFIER" in json.dumps(transform.doc))
        self.assertTrue("IDENTIFIER" in transform.attachments["form.xml"])

        deidentified = deidentify_form(transform)
        self.assertTrue("IDENTIFIER" not in json.dumps(deidentified.doc))
        self.assertTrue("IDENTIFIER" not in deidentified.attachments["form.xml"])

    def testCRSChecklist(self):
        file_path = os.path.join(os.path.dirname(__file__), "data", "crs_checklist.xml")
        with open(file_path, "rb") as f:
            xml_data = f.read()

        self.instance = post_xform_to_couch(xml_data)

        transform = DocumentTransform(self.instance._doc, get_db())
        self.assertTrue("IDENTIFIER" in json.dumps(transform.doc))
        self.assertTrue("IDENTIFIER" in transform.attachments["form.xml"])
        self.assertTrue("YESNO" in json.dumps(transform.doc))
        self.assertTrue("YESNO" in transform.attachments["form.xml"])

        deidentified = deidentify_form(transform)
        self.assertTrue("IDENTIFIER" not in json.dumps(deidentified.doc))
        self.assertTrue("IDENTIFIER" not in deidentified.attachments["form.xml"])
        self.assertTrue("YESNO" not in json.dumps(deidentified.doc))
        self.assertTrue("YESNO" not in deidentified.attachments["form.xml"])


text:
'use strict';

const signals = ['SIGINT', 'SIGTERM'];

function setupExitSignals(serverData) {
  signals.forEach((signal) => {
    process.on(signal, () => {
      if (serverData && serverData.server) {
        serverData.server.close(() => {
          // eslint-disable-next-line no-process-exit
          process.exit();
        });
      } else {
        // eslint-disable-next-line no-process-exit
        process.exit();
      }
    });
  });
}

module.exports = setupExitSignals;


text:
import { shallow } from "enzyme";
import Immutable from "immutable";

import { SingleEngineNodes } from "./SingleEngineNodes";

describe("SingleEngineNodes", () => {
  let minimalProps;
  let commonProps;
  beforeEach(() => {
    minimalProps = {
      engine: Immutable.fromJS({}),
    };
    commonProps = {
      engine: Immutable.fromJS({ name: "default" }),
    };
  });

  it("should render with minimal props without exploding", () => {
    const wrapper = shallow(<SingleEngineNodes {...minimalProps} />);
    expect(wrapper).to.have.length(1);
  });

  it("should render with common props without exploding", () => {
    const wrapper = shallow(<SingleEngineNodes {...commonProps} />);
    expect(wrapper).to.have.length(1);
  });
});


text:
package org.ohdsi.rabbitInAHat;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.ohdsi.rabbitInAHat.dataModel.Database;
import org.ohdsi.rabbitInAHat.dataModel.ETL;
import org.ohdsi.rabbitInAHat.dataModel.Field;
import org.ohdsi.rabbitInAHat.dataModel.Table;
import org.ohdsi.utilities.StringUtilities;
import org.ohdsi.utilities.files.WriteTextFile;

public class ETLTestFrameWorkGenerator {

	public static String[]		keywords	= new String[] { "ADD", "ALL", "ALTER", "AND", "ANY", "AS", "ASC", "AUTHORIZATION", "BACKUP", "BEGIN", "BETWEEN",
		"BREAK", "BROWSE", "BULK", "BY", "CASCADE", "CASE", "CHECK", "CHECKPOINT", "CLOSE", "CLUSTERED", "COALESCE", "COLLATE", "COLUMN", "COMMIT",
		"COMPUTE", "CONSTRAINT", "CONTAINS", "CONTAINSTABLE", "CONTINUE", "CONVERT", "CREATE", "CROSS", "CURRENT", "CURRENT_DATE", "CURRENT_TIME",
		"CURRENT_TIMESTAMP", "CURRENT_USER", "CURSOR", "DATABASE", "DBCC", "DEALLOCATE", "DECLARE", "DEFAULT", "DELETE", "DENY", "DESC", "DISK",
		"DISTINCT", "DISTRIBUTED", "DOUBLE", "DROP", "DUMP", "ELSE", "END", "ERRLVL", "ESCAPE", "EXCEPT", "EXEC", "EXECUTE", "EXISTS", "EXIT", "EXTERNAL",
		"FETCH", "FILE", "FILLFACTOR", "FOR", "FOREIGN", "FREETEXT", "FREETEXTTABLE", "FROM", "FULL", "FUNCTION", "GOTO", "GRANT", "GROUP", "HAVING",
		"HOLDLOCK", "IDENTITY", "IDENTITY_INSERT", "IDENTITYCOL", "IF", "IN", "INDEX", "INNER", "INSERT", "INTERSECT", "INTO", "IS", "JOIN", "KEY", "KILL",
		"LEFT", "LIKE", "LINENO", "LOAD", "MERGE", "NATIONAL", "NOCHECK", "NONCLUSTERED", "NOT", "NULL", "NULLIF", "OF", "OFF", "OFFSETS", "ON", "OPEN",
		"OPENDATASOURCE", "OPENQUERY", "OPENROWSET", "OPENXML", "OPTION", "OR", "ORDER", "OUTER", "OVER", "PERCENT", "PIVOT", "PLAN", "PRECISION",
		"PRIMARY", "PRINT", "PROC", "PROCEDURE", "PUBLIC", "RAISERROR", "READ", "READTEXT", "RECONFIGURE", "REFERENCES", "REPLICATION", "RESTORE",
		"RESTRICT", "RETURN", "REVERT", "REVOKE", "RIGHT", "ROLLBACK", "ROWCOUNT", "ROWGUIDCOL", "RULE", "SAVE", "SCHEMA", "SECURITYAUDIT", "SELECT",
		"SEMANTICKEYPHRASETABLE", "SEMANTICSIMILARITYDETAILSTABLE", "SEMANTICSIMILARITYTABLE", "SESSION_USER", "SET", "SETUSER", "SHUTDOWN", "SOME",
		"STATISTICS", "SYSTEM_USER", "TABLE", "TABLESAMPLE", "TEXTSIZE", "THEN", "TO", "TOP", "TRAN", "TRANSACTION", "TRIGGER", "TRUNCATE", "TRY_CONVERT",
		"TSEQUAL", "UNION", "UNIQUE", "UNPIVOT", "UPDATE", "UPDATETEXT", "USE", "USER", "VALUES", "VARYING", "VIEW", "WAITFOR", "WHEN", "WHERE", "WHILE",
		"WITH", "WITHIN GROUP", "WRITETEXT" };

	private static Set<String>	keywordSet;
	private static int			DEFAULT		= 0;
	private static int			NEGATE		= 1;
	private static int			COUNT		= 2;

	public static void generate(ETL etl, String filename) {
		keywordSet = new HashSet<String>();
		for (String keyword : keywords)
			keywordSet.add(keyword);
		List<String> r = generateRScript(etl);
		WriteTextFile out = new WriteTextFile(filename);
		for (String line : r)
			out.writeln(line);
		out.close();
	}

	private static List<String> generateRScript(ETL etl) {
		List<String> r = new ArrayList<String>();
		createInitFunction(r, etl.getSourceDatabase());
		createDeclareTestFunction(r);
		createSetDefaultFunctions(r, etl.getSourceDatabase());
		createGetDefaultFunctions(r, etl.getSourceDatabase());
		createAddFunctions(r, etl.getSourceDatabase());
		createExpectFunctions(r, DEFAULT, etl.getTargetDatabase());
		createExpectFunctions(r, NEGATE, etl.getTargetDatabase());
		createExpectFunctions(r, COUNT, etl.getTargetDatabase());
		createLookupFunctions(r, etl.getTargetDatabase());
		return r;
	}

	private static void createDeclareTestFunction(List<String> r) {
		r.add("declareTest <- function(id, description) {");
		r.add("  assign(\"testId\", id, envir = globalenv()) ");
		r.add("  assign(\"testDescription\", description, envir = globalenv()) ");
		r.add("  sql <- c(\"\", paste0(\"-- \", id, \": \", description))");
		r.add("  assign(\"insertSql\", c(get(\"insertSql\", envir = globalenv()), sql), envir = globalenv())");
		r.add("  assign(\"testSql\", c(get(\"testSql\", envir = globalenv()), sql), envir = globalenv())");
		r.add("}");
		r.add("");
	}

	private static void createExpectFunctions(List<String> r, int type, Database database) {
		for (Table table : database.getTables()) {
			if (!table.isStem()) {
				StringBuilder line = new StringBuilder();
				String rTableName = convertToRName(table.getName());
				String sqlTableName = convertToSqlName(table.getName());
				List<String> argDefs = new ArrayList<String>();
				List<String> testDefs = new ArrayList<String>();
				for (Field field : table.getFields()) {
					String rFieldName = convertToRName(field.getName());
					String sqlFieldName = convertToSqlName(field.getName());
					argDefs.add(rFieldName);
					testDefs.add("  if (!missing(" + rFieldName + ")) {");
					testDefs.add("    if (first) {");
					testDefs.add("      first <- FALSE");
					testDefs.add("    } else {");
					testDefs.add("      statement <- paste0(statement, \" AND\")");
					testDefs.add("    }");
					testDefs.add("    if (is.null(" + rFieldName + ")) {");
					testDefs.add("      statement <- paste0(statement, \" " + sqlFieldName + " IS NULL\")");
					testDefs.add("    } else if (is(" + rFieldName + ", \"subQuery\")){");
					testDefs.add("      statement <- paste0(statement, \" " + sqlFieldName + " = (\", as.character(" + rFieldName + "), \")\")");
					testDefs.add("    } else {");
					testDefs.add("      statement <- paste0(statement, \" " + sqlFieldName + " = '\", " + rFieldName + ",\"'\")");
					testDefs.add("    }");
					testDefs.add("  }");
					testDefs.add("");
				}

				if (type == DEFAULT)
					line.append("expect_" + rTableName + " <- function(");
				else if (type == NEGATE)
					line.append("expect_no_" + rTableName + " <- function(");
				else
					line.append("expect_count_" + rTableName + " <- function(rowCount, ");

				line.append(StringUtilities.join(argDefs, ", "));
				line.append(") {");
				r.add(line.toString());

				line = new StringBuilder();
				line.append("  statement <- paste0(\"INSERT INTO test_results SELECT ");
				line.append("\", get(\"testId\", envir = globalenv()), \" AS id, ");
				line.append("'\", get(\"testDescription\", envir = globalenv()), \"' AS description, ");
				line.append("'Expect " + table.getName() + "' AS test, ");
				line.append("CASE WHEN(SELECT COUNT(*) FROM " + sqlTableName + " WHERE\")");
				r.add(line.toString());

				r.add("  first <- TRUE");

				r.addAll(testDefs);

				if (type == DEFAULT)
					r.add("  statement <- paste0(statement, \") = 0 THEN 'FAIL' ELSE 'PASS' END AS status;\")");
				else if (type == NEGATE)
					r.add("  statement <- paste0(statement, \") != 0 THEN 'FAIL' ELSE 'PASS' END AS status;\")");
				else
					r.add("  statement <- paste0(statement, \") != \",rowCount ,\" THEN 'FAIL' ELSE 'PASS' END AS status;\")");

				r.add("  assign(\"testSql\", c(get(\"testSql\", envir = globalenv()), statement), envir = globalenv())");
				r.add("  invisible(statement)");
				r.add("}");
				r.add("");
			}
		}
	}

	private static void createLookupFunctions(List<String> r, Database database) {
		for (Table table : database.getTables()) {
			if (!table.isStem()) {
				StringBuilder line = new StringBuilder();
				String rTableName = convertToRName(table.getName());
				String sqlTableName = convertToSqlName(table.getName());
				List<String> argDefs = new ArrayList<String>();
				List<String> testDefs = new ArrayList<String>();
				for (Field field : table.getFields()) {
					String rFieldName = convertToRName(field.getName());
					String sqlFieldName = convertToSqlName(field.getName());
					argDefs.add(rFieldName);
					testDefs.add("  if (!missing(" + rFieldName + ")) {");
					testDefs.add("    if (first) {");
					testDefs.add("      first <- FALSE");
					testDefs.add("    } else {");
					testDefs.add("      statement <- paste0(statement, \" AND\")");
					testDefs.add("    }");
					testDefs.add("    if (is.null(" + rFieldName + ")) {");
					testDefs.add("      statement <- paste0(statement, \" " + sqlFieldName + " IS NULL\")");
					testDefs.add("    } else {");
					testDefs.add("      statement <- paste0(statement, \" " + sqlFieldName + " = '\", " + rFieldName + ",\"'\")");
					testDefs.add("    }");
					testDefs.add("  }");
					testDefs.add("");
				}
				line.append("lookup_" + rTableName + " <- function(fetchField, ");
				line.append(StringUtilities.join(argDefs, ", "));
				line.append(") {");
				r.add(line.toString());

				line = new StringBuilder();
				line.append("  statement <- paste0(\"SELECT \", fetchField , \" FROM ");
				line.append(sqlTableName);
				line.append(" WHERE\")");
				r.add(line.toString());
				r.add("  first <- TRUE");
				r.addAll(testDefs);
				r.add("  class(statement) <- \"subQuery\"");
				r.add("  return(statement)");
				r.add("}");
				r.add("");
			}
		}
	}

	private static String convertToSqlName(String name) {
		if (name.contains(" ") || name.contains(".") || keywordSet.contains(name.toUpperCase()))
			name = "[" + name + "]";
		return name;
	}

	private static void createInitFunction(List<String> r, Database database) {
		r.add("initFramework <- function() {");
		r.add("  insertSql <- c()");
		for (Table table : database.getTables()) {
			String sqlTableName = convertToSqlName(table.getName());
			r.add("  insertSql <- c(insertSql, \"TRUNCATE TABLE " + sqlTableName + ";\")");
		}
		r.add("  assign(\"insertSql\", insertSql, envir = globalenv())");

		r.add("  testSql <- c()");
		r.add("  testSql <- c(testSql, \"IF OBJECT_ID('test_results', 'U') IS NOT NULL\")");
		r.add("  testSql <- c(testSql, \"  DROP TABLE test_results;\")");
		r.add("  testSql <- c(testSql, \"\")");
		r.add("  testSql <- c(testSql, \"CREATE TABLE test_results (id INT, description VARCHAR(512), test VARCHAR(256), status VARCHAR(5));\")");
		r.add("  testSql <- c(testSql, \"\")");

		r.add("  assign(\"testSql\", testSql, envir = globalenv())");
		r.add("  assign(\"testId\", 1, envir = globalenv())");
		r.add("  assign(\"testDescription\", \"\", envir = globalenv())");
		r.add("");
		r.add("  defaultValues <- new.env(parent = globalenv())");
		r.add("  assign(\"defaultValues\", defaultValues, envir = globalenv())");
		for (Table table : database.getTables()) {
			if (!table.isStem()) {
				String rTableName = convertToRName(table.getName());
				r.add("");
				r.add("  defaults <- list()");
				for (Field field : table.getFields()) {
					String rFieldName = field.getName().replaceAll(" ", "_").replaceAll("-", "_");
					String defaultValue;
					if (field.getValueCounts().length == 0)
						defaultValue = "";
					else
						defaultValue = field.getValueCounts()[0][0];
					if (!defaultValue.equals(""))
						r.add("  defaults$" + rFieldName + " <- \"" + defaultValue + "\"");
				}
				r.add("  assign(\"" + rTableName + "\", defaults, envir = defaultValues)");
			}
		}
		r.add("}");
		r.add("");
		r.add("initFramework()");
		r.add("");
	}

	private static void createAddFunctions(List<String> r, Database database) {
		for (Table table : database.getTables()) {
			if (!table.isStem()) {
				StringBuilder line = new StringBuilder();
				String rTableName = convertToRName(table.getName());
				String sqlTableName = convertToSqlName(table.getName());
				List<String> argDefs = new ArrayList<String>();
				List<String> insertLines = new ArrayList<String>();
				for (Field field : table.getFields()) {
					String rFieldName = field.getName().replaceAll(" ", "_").replaceAll("-", "_");
					String sqlFieldName = convertToSqlName(field.getName());
					argDefs.add(rFieldName);
					insertLines.add("  if (missing(" + rFieldName + ")) {");
					insertLines.add("    " + rFieldName + " <- defaults$" + rFieldName);
					insertLines.add("  }");
					insertLines.add("  if (!is.null(" + rFieldName + ")) {");
					insertLines.add("    insertFields <- c(insertFields, \"" + sqlFieldName + "\")");
					insertLines.add("    insertValues <- c(insertValues, " + rFieldName + ")");
					insertLines.add("  }");
					insertLines.add("");
				}

				line.append("add_" + rTableName + " <- function(");
				line.append(StringUtilities.join(argDefs, ", "));
				line.append(") {");
				r.add(line.toString());
				r.add("  defaults <- get(\"" + rTableName + "\", envir = defaultValues)");
				r.add("  insertFields <- c()");
				r.add("  insertValues <- c()");
				r.addAll(insertLines);

				line = new StringBuilder();
				line.append("  statement <- paste0(\"INSERT INTO " + sqlTableName + " (\", ");
				line.append("paste(insertFields, collapse = \", \"), ");
				line.append("\") VALUES ('\", ");
				line.append("paste(insertValues, collapse = \"', '\"), ");
				line.append("\"');\")");
				r.add(line.toString());

				r.add("  assign(\"insertSql\", c(get(\"insertSql\", envir = globalenv()), statement), envir = globalenv())");
				r.add("  invisible(statement)");
				r.add("}");
				r.add("");
			}
		}
	}

	private static void createSetDefaultFunctions(List<String> r, Database database) {
		for (Table table : database.getTables()) {
			if (!table.isStem()) {
				StringBuilder line = new StringBuilder();
				String rTableName = convertToRName(table.getName());
				List<String> argDefs = new ArrayList<String>();
				List<String> insertLines = new ArrayList<String>();
				for (Field field : table.getFields()) {
					String rFieldName = field.getName().replaceAll(" ", "_").replaceAll("-", "_");
					argDefs.add(rFieldName);
					insertLines.add("  if (!missing(" + rFieldName + ")) {");
					insertLines.add("    defaults$" + rFieldName + " <- " + rFieldName);
					insertLines.add("  }");
				}

				line.append("set_defaults_" + rTableName + " <- function(");
				line.append(StringUtilities.join(argDefs, ", "));
				line.append(") {");
				r.add(line.toString());
				r.add("  defaults <- get(\"" + rTableName + "\", envir = defaultValues)");
				r.addAll(insertLines);

				r.add("  assign(\"" + rTableName + "\", defaults, envir = defaultValues)");
				r.add("  invisible(defaults)");
				r.add("}");
				r.add("");
			}
		}
	}

	private static void createGetDefaultFunctions(List<String> r, Database database) {
		for (Table table : database.getTables()) {
			String rTableName = convertToRName(table.getName());
			r.add("get_defaults_" + rTableName + " <- function() {");
			r.add("  defaults <- get(\"" + rTableName + "\", envir = defaultValues)");
			r.add("  return(defaults)");
			r.add("}");
			r.add("");
		}
	}

	private static String convertToRName(String name) {
		name = name.replaceAll(" ", "_").replaceAll("-", "_");
		return name;
	}
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
    JBoss, Home of Professional Open Source
    Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual
    contributors by the @authors tag. See the copyright.txt in the
    distribution for a full listing of individual contributors.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.wildfly.quickstarts</groupId>
        <artifactId>wildfly-quickstarts-parent</artifactId>
        <version>8.0.0-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <artifactId>wildfly-wicket-ear-parent</artifactId>
    <packaging>pom</packaging>

    <name>WildFly Quickstarts: Wicket EAR parent</name>
    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <distribution>repo</distribution>
            <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
        </license>
    </licenses>

    <description>
        A sample Java EE 7 project demonstrating how to use Wicket Framework with WildFly 8.
        EAR with EJB JAR and WAR version.
    </description>

    <modules>
        <module>ejb</module>
        <module>war</module>
        <module>ear</module>
    </modules>

    <properties>
        <!-- Other dependency versions -->
        <version.org.apache.wicket>1.5.5</version.org.apache.wicket>
        <version.net.ftlines.wicket-cdi>1.2</version.net.ftlines.wicket-cdi>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- JBoss distributes a complete set of Java EE 7 APIs including
                a Bill of Materials (BOM). A BOM specifies the versions of a "stack" (or
                a collection) of artifacts. We use this here so that we always get the correct
                versions of artifacts. Here we use the jboss-javaee-6.0-with-tools stack
                (you can read this as the JBoss stack of the Java EE 7 APIs, with some extras
                tools for your project, such as Arquillian for testing) and the jboss-javaee-6.0-with-hibernate
                stack you can read this as the JBoss stack of the Java EE 7 APIs, with extras
                from the Hibernate family of projects) -->
            <dependency>
                <groupId>org.jboss.spec</groupId>
                <artifactId>jboss-javaee-web-7.0</artifactId>
                <version>${version.jboss.spec.javaee7}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!-- Wicket -->
            <dependency>
                <groupId>org.apache.wicket</groupId>
                <artifactId>wicket-core</artifactId>
                <version>${version.org.apache.wicket}</version>
            </dependency>

            <!-- Wicket Java EE integration. -->
            <dependency>
                <groupId>net.ftlines.wicket-cdi</groupId>
                <artifactId>wicket-cdi</artifactId>
                <version>${version.net.ftlines.wicket-cdi}</version>
            </dependency>

            <!-- EJB JAR module. -->
            <dependency>
                <groupId>org.wildfly.quickstarts</groupId>
                <artifactId>wildfly-wicket-ear-ejb</artifactId>
                <version>${project.version}</version>
                <type>ejb</type>
            </dependency>

            <!-- WAR module. -->
            <dependency>
                <groupId>org.wildfly.quickstarts</groupId>
                <artifactId>wildfly-wicket-ear-war</artifactId>
                <version>${project.version}</version>
                <type>war</type>
            </dependency>
        </dependencies>
    </dependencyManagement>

</project>


text:
class CleanDirError(Exception):
    def __init__(self, value):
        self.value = value

    def __str__(self):
        return self.value


text:
      </div>
    </div>
  </section>
</div>
<script>
$(document).ready(function() {

  // set the active tab
  var currentHref = document.location.pathname.substr(1);
  if (currentHref)
  {
    $('.docNav').find('a[href^="' + currentHref + '"]').addClass('activeNavElem typeEmphasize');
  }
  else
  {
    $('.docNav').find('a').eq(0).addClass('activeNavElem typeEmphasize');
  }

});
</script>
</body>
</html>


text:
//
//  WCProfileViewController.m
//  WeChat
//
//  Created by apple on 15/10/8.
//  Copyright © 2015年 PengC. All rights reserved.
//

#import "WCProfileViewController.h"
#import "XMPPvCardTemp.h"
#import "WCEditProfileViewController.h"

@interface WCProfileViewController ()<UIActionSheetDelegate,UINavigationControllerDelegate, UIImagePickerControllerDelegate>
{

}
@property (nonatomic,strong) UIImagePickerController *imagePicker;

/**
 头像
 */
@property (weak, nonatomic) IBOutlet UIImageView *herderImg;
/**
 昵称
 */
@property (weak, nonatomic) IBOutlet UILabel *nickNameLabel;
/**
 微信号
 */
@property (weak, nonatomic) IBOutlet UILabel *weixinNumLabel;

/**
 公司名
 */
@property (weak, nonatomic) IBOutlet UILabel *orgnameLabel;
/**
 部门
 */
@property (weak, nonatomic) IBOutlet UILabel *orunitLabel;
/**
 职位
 */
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
/**
 电话
 */
@property (weak, nonatomic) IBOutlet UILabel *telLabel;
/**
 邮件
 */
@property (weak, nonatomic) IBOutlet UILabel *emailLabel;

@end
@implementation WCProfileViewController

-(void)viewDidLoad
{
    [super viewDidLoad];
    self.title = @"个人信息";
    [self loadVCard];
}
#pragma mark 加载电子名片信息
-(void)loadVCard
{
    //xmpp提供了一个方法,直接获取个人信息
    XMPPvCardTemp *myVcTemp = [WCXMPPTool sharedWCXMPPTool].vCard.myvCardTemp;
    //设置头像
    if (myVcTemp.photo) {
        self.herderImg.image = [ UIImage imageWithData:myVcTemp.photo];
    }

    //设置昵称
        self.nickNameLabel.text = myVcTemp.nickname;
    //设置微信号
    self.weixinNumLabel.text = [WCUserInfo sharedWCUserInfo].user;

        self.orgnameLabel .text = myVcTemp.orgName;
        self.orunitLabel.text = [myVcTemp.orgUnits firstObject];
    self.titleLabel.text = myVcTemp.title;
#warning myVcTemp.telecomsAddresses这个get方法,没有对电子名片的xml数据进行解析
    //使用note字段充当电话

        self.telLabel.text = myVcTemp.note;
#warning myVcTemp.emailAddresses这个get方法,没有对电子名片的xml数据进行解析
    //用mailer充当邮件
//        self.emailLabel.text = myVcTemp.mailer;

    //自己解析电子邮件
    if (myVcTemp.emailAddresses) {
        self.emailLabel.text = [myVcTemp.emailAddresses lastObject];
    }

}
#pragma mark UITableViewDelegate
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    if (cell.tag == 1)
    {

        //跳到下一个控制器
        [self performSegueWithIdentifier:@"EditVCardSegue" sender:cell];

    }else if (cell.tag == 2)
    {
      //表示点击的是微信号,不做任何操作
        return ;
    }
    else if(cell.tag == 0)
    {
        //选择图片
        UIActionSheet * sheet = [[UIActionSheet alloc]initWithTitle:@"提示" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"照相" otherButtonTitles:@"相册", nil];
        [sheet showInView:self.view];
    }
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    //获取编辑个人信息的控制器
    id destVc = segue.destinationViewController;
    if ([destVc isKindOfClass:[WCEditProfileViewController class]]) {
        WCEditProfileViewController *editCtl = destVc;
        editCtl.profileCell = sender;
        typeof(self) weakSelf = self;
        //编辑个人信息的保存
        editCtl.editSaveBlack = ^(NSString *string)
        {
            //更新到服务器
            [weakSelf xmppTempUpdate];
        };
    }
}
#pragma mark UIActionSheetDelegate
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
    DLOG(@"------%d",buttonIndex);
    UIImagePickerController *imagePicer = [[UIImagePickerController alloc]init];
    //要设置代理
    imagePicer.delegate = self;
    //设置允许编辑状态
    imagePicer.allowsEditing = YES;
    DLOG(@"queue=%@",[NSThread currentThread]);
    if (buttonIndex == 0)
    {
        //打开照相
        if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera] )
        imagePicer.sourceType = UIImagePickerControllerSourceTypeCamera;
    }
    else if (buttonIndex == 1)
    {
        //打开相册
        if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary ]) {
            imagePicer.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
        }
    }
    else
    {
        return ;
    }
    self.imagePicker = imagePicer;
    DLOG(@"queue=%@",[NSThread currentThread]);
    //显示图片选择器
#warning ipod无法弹出相册解决办法(ios在8.0以后更改了UIActionSheet的继承父类,原因在警告里说得比较明白了,因为已经有actionsheet存在了,不能present新的。此时我们选择新的委托方法)
    //方法1
    [[NSOperationQueue mainQueue] addOperationWithBlock:^{
    [self presentViewController:imagePicer animated:YES completion:nil];

}];

    //方法2
//    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
//        [self presentViewController:imagePicer animated:YES completion:nil];
//    });

}
//方法3
-(void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex
{
    DLOG(@"buttonIndex=%d",buttonIndex);
//    [self presentViewController:self.imagePicker animated:YES completion:nil];
}
#pragma mark 图片选择器的代理
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    DLOG(@"info =%@",info);
    UIImage *image = info[UIImagePickerControllerEditedImage];
    self.herderImg.image = image;
    //隐藏当前的模态窗口
    [picker dismissViewControllerAnimated:YES completion:nil];

    //更新到服务器
    [self xmppTempUpdate];

}
-(void)xmppTempUpdate
{
    //获取当前的电子名片信息
    XMPPvCardTemp *vCard = [WCXMPPTool sharedWCXMPPTool].vCard.myvCardTemp;
    //昵称
    vCard.nickname = self.nickNameLabel.text;
    //公司
    vCard.orgName = self.orgnameLabel.text;
    //头像
    vCard.photo = UIImagePNGRepresentation(self.herderImg.image);

    //部门
    if (self.orgnameLabel.text.length > 0) {
        vCard.orgUnits = @[self.orunitLabel.text];
    }
    //职位
    vCard.title = self.titleLabel.text;

    //电话
    vCard.note = self.telLabel.text;

    //邮件
    if (self.emailLabel.text.length > 0) {

    }
    vCard.emailAddresses = @[self.emailLabel.text];

    //更新 这个方法内部会实现数据上传的服务器,不需程序自己炒作
    [[WCXMPPTool sharedWCXMPPTool].vCard updateMyvCardTemp:vCard];
}
-(void)dealloc
{
    DLOG(@"销毁");
}

@end


text:
package com.orange.clara.cloud.servicedbdumper.dbdumper.core.dbdrivers;

import java.io.File;

public class PostgresqlDatabaseDriver extends AbstractDatabaseDriver implements DatabaseDriver {
    public PostgresqlDatabaseDriver(File binaryDump, File binaryRestore) {
        super(binaryDump, binaryRestore);
    }

    @Override
    public String[] getDumpCommandLine() {
        return String.format(
                "%s --dbname=postgresql://%s:%s@%s:%s/%s --clean --no-owner --no-privileges",
                this.binaryDump.getAbsolutePath(),
                this.databaseRef.getUser(),
                this.databaseRef.getPassword(),
                this.databaseRef.getHost(),
                this.databaseRef.getPort(),
                this.databaseRef.getDatabaseName()
        ).split(" ");
    }

    @Override
    public String[] getRestoreCommandLine() {
        return String.format(
                "%s --dbname=postgresql://%s:%s@%s:%s/%s -f -",
                this.binaryRestore.getAbsolutePath(),
                this.databaseRef.getUser(),
                this.databaseRef.getPassword(),
                this.databaseRef.getHost(),
                this.databaseRef.getPort(),
                this.databaseRef.getDatabaseName()
        ).split(" ");
    }

    @Override
    public Boolean isDumpShowable() {
        return true;
    }
}


text:
namespace ZooClassLibrary.Pattern.Command
{
    public abstract class UserCommand
    {
        public abstract void Execute();
    }
}


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>Code Coverage for /var/www/source/hca_draft/src/HealthCareAbroad/InstitutionBundle/Event/InstitutionEvent.php</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link href="css/bootstrap.min.css" rel="stylesheet">
  <link href="css/bootstrap-responsive.min.css" rel="stylesheet">
  <link href="css/style.css" rel="stylesheet">

/var/www/source/hca_draft/src/HealthCareAbroad /

InstitutionBundle /

Event /

InstitutionEvent.php

Code Coverage

Classes and Traits

Functions and Methods

Lines

      Total

100.00%

1 / 1

100.00%

1 / 1

      <acronym title="Change Risk Anti-Patterns (CRAP) Index">CRAP</acronym>

100.00%

1 / 1

      InstitutionEvent

100.00%

1 / 1

100.00%

1 / 1

      1

100.00%

1 / 1

       getInstitution()

100.00%

1 / 1

      1

100.00%

1 / 1

1
	<?php

2
	/**

3
	 * Event class for Institution

4
	 *

5
	 * @author Allejo Chris G. Velarde

6
	 * @author Alnie Jacobe

7
	 */

8
	namespace HealthCareAbroad\InstitutionBundle\Event;

9

10
	use HealthCareAbroad\InstitutionBundle\Entity\Institution;

11
	use HealthCareAbroad\HelperBundle\Event\BaseEvent;

12

13
	class InstitutionEvent extends BaseEvent

14
	{

15
	    /**

16
	     * @return Institution

17
	     */

18
	    public function getInstitution()

19
	    {

20
	        return $this->data;

21
	    }

Legend

     Executed
     Not Executed
     Dead Code

     Generated by PHP_CodeCoverage 1.2.2 using PHP 5.3.10-1ubuntu3.2 and PHPUnit 3.7.1 at Tue Oct 9 16:19:45 PHT 2012.


text:
{-# LANGUAGE CPP #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}

#ifndef MIN_VERSION_base
#define MIN_VERSION_base(x,y,z) 0
#endif
--------------------------------------------------------------------
-- |
-- Copyright :  (c) Edward Kmett 2011-2012
-- License   :  BSD2
-- Maintainer:  Edward Kmett <ekmett@gmail.com>
-- Stability :  experimental
-- Portability: non-portable
--
-- Meta variables
--------------------------------------------------------------------
module Ermine.Unification.Meta
  (
  -- * Meta variables
    Meta(Meta)
  , metaId, metaValue, metaRef, metaHint
  -- * Meta Types
  , MetaT, TypeM
  -- * Meta Kinds
  , MetaK, KindM
  -- ** λ-Depth
  , Depth, metaDepth, depthInf
  -- ** Union-By-Rank
  , Rank, metaRank, bumpRank
  -- ** Working with Meta
  , newMeta, newShallowMeta
  , readMeta
  , writeMeta
  -- ** Pruning
  , semiprune
  , zonk
  , zonk_
  , zonkWith
  , ultraZonk
  , ultraZonkWith
  , zonkScope
  , zonkScope_
  , hasSkolems
  , checkSkolems
  , checkEscapes
  , checkDistinct
  -- * MetaEnv
  , MetaEnv
  , HasMetaEnv(..)
  , MonadMeta(..)
  , viewMeta
  -- * The unification monad
  , M, runM, runM_, ioM
  , throwM
  , fresh
  , remember
  ) where

import Bound
import Control.Applicative
import Control.Exception
import Control.Lens
import Data.IntSet.Lens (setOf)
import Control.Monad
import Control.Monad.IO.Class
import Control.Monad.Trans.Maybe
import Control.Monad.ST (ST, runST, stToIO)
import Control.Monad.ST.Class
import Control.Monad.ST.Unsafe
import Control.Monad.Trans
import Control.Monad.State.Lazy as Lazy
import Control.Monad.State.Strict as Strict
import Control.Monad.Writer.Class
import Data.Foldable (for_, traverse_)
import Data.Function (on)
import Data.IntMap
import Data.Monoid
import Data.STRef
import qualified Data.Set as Set
import Data.Text (pack)
import Data.Traversable
import Data.Word
import Ermine.Diagnostic
import Ermine.Syntax
import Ermine.Syntax.Hint
import Ermine.Syntax.Type
import Ermine.Syntax.Kind
import Ermine.Unification.Sharing

#ifdef HLINT
{-# ANN module "hlint: ignore Reduce duplication" #-}
#endif

------------------------------------------------------------------------------
-- Meta
------------------------------------------------------------------------------

-- | Kuan and MacQueen's notion of λ-ranking.
type Depth = Int

-- | This plays the role of infinity.
depthInf :: Depth
depthInf = maxBound

-- | Rank for union-by-rank viewing meta-variables as disjoint set forests
type Rank = Word

bumpRank :: STRef s Rank -> ST s ()
#if MIN_VERSION_base(4,6,0)
bumpRank w = modifySTRef' w (+1)
#else
bumpRank w = do
  n <- readSTRef w
  let n' = n + 1
  n' `seq` writeSTRef w n'
#endif

-- | A meta variable for skolemization and unification
data Meta s f a
  = Meta   { _metaValue :: a
           , _metaHint :: Hint
           , _metaId :: !Int
           , _metaRef :: !(STRef s (Maybe (f (Meta s f a))))
           , _metaDepth :: !(STRef s Depth)
           , _metaRank :: !(STRef s Rank)
           }

makeLenses ''Meta

------------------------------------------------------------------------------
-- MetaEnv
------------------------------------------------------------------------------

-- | A type meta-variable
type MetaT s = Meta s (Type (MetaK s)) (KindM s)

-- | A type filled with meta-variables
type TypeM s = Type (MetaK s) (MetaT s)

-- | A kind meta-variable
type MetaK s = Meta s Kind Bool

-- | A kind filled with meta-variables
type KindM s = Kind (MetaK s)

data MetaEnv s = MetaEnv
  { _metaRendering :: Rendering
  , _metaFresh :: {-# UNPACK #-} !(STRef s Int)
  , _metaMemory :: STRef s (IntMap (TypeM s))
  }

makeClassy ''MetaEnv

instance HasRendering (MetaEnv s) where
  rendering = metaRendering

------------------------------------------------------------------------------
-- More Meta
------------------------------------------------------------------------------

{-
_Meta :: Prism (Meta s f a)
               (Meta s g a)
               (a, Int, STRef s (Maybe (f (Meta s f a))), STRef s Depth, STRef s Rank)
               (a, Int, STRef s (Maybe (g (Meta s g a))), STRef s Depth, STRef s Rank)
_Meta = prism (\(a,i,r,k,u) -> Meta a i r k u) $ \t -> case t of
  Meta a i r k u -> Right (a,i,r,k,u)
  _ -> Left t
-}

instance Show a => Show (Meta s f a) where
  showsPrec d (Meta a _ i _ _ _) = showParen (d > 10) $
    showString "Meta " . showsPrec 11 a . showChar ' ' . showsPrec 11 i . showString " ..."

instance Eq (Meta s f a) where
  (==) = (==) `on` view metaId
  {-# INLINE (==) #-}

instance Ord (Meta s f a) where
  compare = compare `on` view metaId
  {-# INLINE compare #-}

-- | Construct a new meta variable
newMeta :: MonadMeta s m => a -> Hint -> m (Meta s f a)
newMeta a h = Meta a h <$> fresh
                       <*> liftST (newSTRef Nothing)
                       <*> liftST (newSTRef depthInf)
                       <*> liftST (newSTRef 0)
{-# INLINE newMeta #-}

-- | Construct a new meta variable at a given depth
newShallowMeta :: MonadMeta s m => Depth -> a -> Hint -> m (Meta s f a)
newShallowMeta d a h =
  Meta a h <$> fresh
           <*> liftST (newSTRef Nothing)
           <*> liftST (newSTRef d)
           <*> liftST (newSTRef 0)
{-# INLINE newShallowMeta #-}

-- | Read a meta variable
readMeta :: MonadMeta s m => Meta s f a -> m (Maybe (f (Meta s f a)))
readMeta (Meta _ _ _ r _ _) = liftST $ readSTRef r
{-# INLINE readMeta #-}

-- | Write to a meta variable
writeMeta :: MonadMeta s m => Meta s f a -> f (Meta s f a) -> m ()
writeMeta (Meta _ _ _ r _ _) a = liftST $ writeSTRef r (Just a)
{-# INLINE writeMeta #-}

-- | Path-compression
semiprune :: (Variable f, Monad f, MonadMeta s m) => f (Meta s f a) -> m (f (Meta s f a))
semiprune t0 = case preview _Var t0 of
  Just v0 -> loop t0 v0
  Nothing -> return t0
  where
    loop t1 v1 = readMeta v1 >>= \mb -> case mb of
      Nothing -> return t1
      Just t  -> case preview _Var t of
        Nothing -> return t -- t1?
        Just v  -> do
          fv <- loop t v
          writeMeta v1 fv
          return fv
{-# INLINE semiprune #-}

-- | Expand meta variables recursively
zonk :: (MonadMeta s m, MonadWriter Any m, Traversable f, Monad f) => f (Meta s f a) -> m (f (Meta s f a))
zonk fs = zonkWith fs $ \_ -> return ()
{-# INLINE zonk #-}

zonk_ :: (MonadMeta s m, Traversable f, Monad f) => f (Meta s f a) -> m (f (Meta s f a))
zonk_ fs = runSharing fs $ zonk fs
{-# INLINE zonk_ #-}

zonkWith :: (MonadMeta s m, MonadWriter Any m, Traversable f, Monad f) => f (Meta s f a) -> (Meta s f a -> m ()) -> m (f (Meta s f a))
zonkWith fs0 tweak = go fs0 where
  go fs = fmap join . for fs $ \m -> do
    tweak m
    readMeta m >>= \mv -> case mv of
      Nothing  -> return (return m)
      Just fmf -> do
        tell $ Any True
        r <- go fmf
        r <$ writeMeta m r
{-# INLINE zonkWith #-}

ultraZonk :: forall s m f v a
           . (MonadMeta s m, MonadWriter Any m, Traversable f, Monad f)
          => ATraversal v (f v) (Meta s f a) (f (Meta s f a))
          -> f v -> m (f v)
ultraZonk trav0 fvs0 = ultraZonkWith trav0 fvs0 $ \_ -> return ()
{-# INLINE ultraZonk #-}

ultraZonkWith :: forall s m f v a
               . (MonadMeta s m, MonadWriter Any m, Traversable f, Monad f)
              => ATraversal v (f v) (Meta s f a) (f (Meta s f a))
              -> f v -> (Meta s f a -> m ()) -> m (f v)
ultraZonkWith trav0 fvs0 tweak = go trav0 fvs0 where
  go :: forall u
      . ATraversal u (f u) (Meta s f a) (f (Meta s f a))
     -> f u -> m (f u)
  go trav fs = fmap join . for fs . cloneTraversal trav $ \m -> do
    tweak m
    readMeta m >>= \mv -> case mv of
      Nothing -> return (return m)
      Just fmf -> do
        tell $ Any True
        r <- go id fmf
        r <$ writeMeta m r
{-# INILINE ultraZonkWith #-}

zonkScope :: (MonadMeta s m, MonadWriter Any m, Traversable f, Monad f)
          => Scope b f (Meta s f a) -> m (Scope b f (Meta s f a))
zonkScope (Scope e) = Scope <$> (traverse.traverse) zonk e

zonkScope_ :: (MonadMeta s m, Traversable f, Monad f)
           => Scope b f (Meta s f a) -> m (Scope b f (Meta s f a))
zonkScope_ (Scope e) = Scope <$> (traverse.traverse) zonk_ e

-- | Check for escaped Skolem variables in any container full of types.
--
-- Dies due to an escaped Skolem or returns the container with all of its types fully zonked.
checkSkolems
  :: MonadMeta s m
  => Maybe Depth -> LensLike' m ts (TypeM s) -> [MetaT s] -> ts -> m ts
checkSkolems md trav sks ts = do
  for_ md $ checkEscapes ?? sks
  hasSkolems trav sks ts

-- | Checks if any of the listed skolems exists in the types given in the
-- traversal.
hasSkolems :: (Traversable f, Monad f, MonadMeta s m) => LensLike' m ts (f (Meta s f a)) -> [Meta s f a] -> ts -> m ts
hasSkolems trav sks = trav $ \t -> runSharing t $ zonkWith t tweak where
  skids = setOf (traverse.metaId) sks
  tweak v = when (has (ix $ v^.metaId) skids) $ fail "returning skolem"

-- | Checks if any of the skolems in the list escapes into the context defined
-- by the given depth.
checkEscapes
  :: MonadMeta s m
  => Depth -> [Meta s f a] -> m ()
checkEscapes d =
  traverse_ $ \s -> liftST (readSTRef $ s^.metaDepth) >>= \d' ->
  when (d' < d) $ fail "skolem escapes to environment"

checkDistinct
  :: (Traversable f, Monad f, Variable f, MonadMeta s m)
  => [Meta s f a] -> m [Meta s f a]
checkDistinct xs = do
  ys <- for xs $ withSharing zonk . return
  zs <- for ys $ maybe (fail "bound skolem") pure . preview _Var
  zs <$ unless (Set.size (Set.fromList zs) == length zs) (fail "indistinct skolems")

------------------------------------------------------------------------------
-- Result
------------------------------------------------------------------------------

-- | The internal result type used by 'M'.
data Result a
  = Error !Diagnostic
  | OK !Int a

instance Functor Result where
  fmap f (OK n a) = OK n (f a)
  fmap _ (Error d) = Error d
  {-# INLINE fmap #-}

------------------------------------------------------------------------------
-- MonadMeta
------------------------------------------------------------------------------

class (Applicative m, MonadST m, s ~ World m) => MonadMeta s m | m -> s where
  askMeta :: m (MetaEnv s)
#ifndef HLINT
  default askMeta :: (m ~ t n, MonadTrans t, MonadMeta s n) => m (MetaEnv s)
  askMeta = lift askMeta
#endif

  localMeta :: (MetaEnv s -> MetaEnv s) -> m a -> m a

viewMeta :: MonadMeta s m => Getting a (MetaEnv s) a -> m a
viewMeta l = view l <$> askMeta

instance MonadMeta s m => MonadMeta s (Lazy.StateT t m) where
  localMeta f (Lazy.StateT m) = Lazy.StateT (localMeta f . m)

instance MonadMeta s m => MonadMeta s (Strict.StateT t m) where
  localMeta f (Strict.StateT m) = Strict.StateT (localMeta f . m)

instance MonadMeta s m => MonadMeta s (SharingT m) where
  localMeta f (SharingT m) = SharingT (localMeta f m)
  {-# INLINE localMeta #-}

------------------------------------------------------------------------------
-- M
------------------------------------------------------------------------------

-- | The unification monad provides a 'fresh' variable supply and tracks a current
-- 'Rendering' to blame for any unification errors.
newtype M s a = M { unM :: MetaEnv s -> ST s a }

instance Functor (M s) where
  fmap f (M m) = M (fmap f . m)
  {-# INLINE fmap #-}

instance Applicative (M s) where
  pure = return
  {-# INLINE pure #-}
  (<*>) = ap
  {-# INLINE (<*>) #-}

instance Monad (M s) where
  return = M . const . return
  {-# INLINE return #-}
  M m >>= k = M $ \ e -> do
    a <- m e
    unM (k a) e
  {-# INLINE (>>=) #-}
  fail s = M $ \e -> unsafeIOToST $ throwIO $! die e (pack s)

instance MonadST (M s) where
  type World (M s) = s
  liftST m = M $ const m
  {-# INLINE liftST #-}

instance MonadMeta s (M s) where
  askMeta = M $ \e -> return e
  {-# INLINE askMeta #-}
  localMeta f (M m) = M (m . f)
  {-# INLINE localMeta #-}

instance MonadMeta s m => MonadMeta s (MaybeT m) where
  askMeta = MaybeT $ Just <$> askMeta
  localMeta f = MaybeT . localMeta f . runMaybeT

instance Monoid m => Monoid (M s m) where
  mempty  = pure mempty
  mappend = liftA2 mappend

catchingST :: Getting (First a) SomeException a -> ST s r -> (a -> ST s r) -> ST s r
catchingST l m h = unsafeIOToST $ catchJust (preview l) (unsafeSTToIO m) (unsafeSTToIO . h)
{-# INLINE catchingST #-}

-- | Throw a 'Diagnostic' error.
throwM :: MonadST m => Diagnostic -> m a
throwM d = liftST $ unsafeIOToST (throwIO d)
{-# INLINE throwM #-}

-- | Evaluate an expression in the 'M' 'Monad' with a fresh variable supply.
runM :: Rendering -> (forall s. M s a) -> Either Diagnostic a
runM r m = runST $ do
  i <- newSTRef 0
  z <- newSTRef mempty
  catchingST _Diagnostic (Right <$> unM m (MetaEnv r i z)) (return . Left)
{-# INLINE runM #-}

-- | Evaluate an expression in the 'M' 'Monad' with a fresh variable supply, throwing any errors returned.
runM_ :: Rendering -> (forall s. M s a) -> a
runM_ r m = runST $ do
  i <- newSTRef 0
  z <- newSTRef mempty
  unM m (MetaEnv r i z)

-- | Evaluate an expression in the 'M' 'Monad' with a fresh variable supply, throwing any errors returned.
ioM :: MonadIO m => Rendering -> (forall s. M s a) -> m a
ioM r m = liftIO $ stToIO $ do
  i <- newSTRef 0
  z <- newSTRef mempty
  unM m (MetaEnv r i z)
{-# INLINE ioM #-}

-- | Generate a 'fresh' variable
fresh :: MonadMeta s m => m Int
fresh = do
  s <- viewMeta metaFresh
  liftST $ do
    i <- readSTRef s
    writeSTRef s $! i + 1
    return i
{-# INLINE fresh #-}

remember :: MonadMeta s m => Int -> TypeM s -> m ()
remember i t = do
  s <- viewMeta metaMemory
  liftST $ do
    m <- readSTRef s
    writeSTRef s $! m & at i ?~ t
{-# INLINE remember #-}


text:
import { Alert } from 'element-ui';

export default {
  name: Alert.name,
  mixins: [Alert]
};


text:
// Graph, implemented with an adjacency list
// (c) 1998, 2001 duane a. bailey

package io.datalayer.data.structure;
import java.util.Iterator;
/**
 * A class implementing a directed, adjacency-list based graph.
 *
 * @version $Id: GraphListDirected.java 8 2006-08-02 19:03:11Z bailey $
 * @author, 2001 duane a. bailey and kimberly tabtiang
 * @see GraphList
 * @see GraphListUndirected
 * @see GraphMatrixDirected
 */
public class GraphListDirected extends GraphList
{

    /**
     * Construct a directed, adjacency-list based graph.
     *
     * @post constructs an directed graph
     */
    public GraphListDirected()
    {
        super(true);
    }

    /**
     * Add an edge between two vertices within the graph.  Edge is directed.
     * Duplicate edges are silently replaced.
     * Labels on edges may be null.
     *
     * @pre vLabel1 and vLabel2 are labels of existing vertices, v1 & v2
     * @post an edge is inserted between v1 and v2;
     *       if edge is new, it is labeled with label (can be null)
     *
     * @param vLabel1 Source vertex.
     * @param vLabel2 Destination vertex.
     * @param label Label associated with the edge.
     */
    public void addEdge(Object vLabel1, Object vLabel2, Object label)
    {
        GraphListVertex v1 = (GraphListVertex) dict.get(vLabel1);
        GraphListVertex v2 = (GraphListVertex) dict.get(vLabel2);
        Edge e = new Edge(v1.label(), v2.label(), label, true);
        v1.addEdge(e);
    }

    /**
     * Remove a vertex from the graph.  Associated edges are also
     * removed.  Non-vertices are silently ignored.
     *
     * @pre label is non-null vertex label
     * @post vertex with "equals" label is removed, if found
     *
     * @param label The label of the vertex within the graph.
     * @return The label associated with the vertex.
     */
    public Object remove(Object label)
    {
        GraphListVertex v = (GraphListVertex)dict.get(label);

        Iterator vi = iterator();
        while (vi.hasNext())
        {
            Object v2 = vi.next();
            if (!label.equals(v2)) removeEdge(v2,label);
        }
        dict.remove(label);
        return v.label();
    }

    /**
     * Remove possible edge between vertices labeled vLabel1 and vLabel2.
     * vLabel1 is the source.
     *
     * @pre vLabel1 and vLabel2 are labels of existing vertices
     * @post edge is removed, its label is returned
     *
     * @param vLabel1 Source vertex.
     * @param vLabel2 Destination vertex.
     * @return The label associated with the edge removed.
     */
    public Object removeEdge(Object vLabel1, Object vLabel2)
    {
        GraphListVertex v1 = (GraphListVertex) dict.get(vLabel1);
        GraphListVertex v2 = (GraphListVertex) dict.get(vLabel2);
        Edge e = new Edge(v1.label(), v2.label(), null, true);
        e = v1.removeEdge(e);
        if (e == null) return null;
        else return e.label();
    }

    /**
     * Determine the number of edges in graph.
     *
     * @post returns the number of edges in graph
     *
     * @return Number of edges in graph.
     */
    public int edgeCount()
    {
        int count = 0;
        Iterator i = dict.values().iterator();
        while (i.hasNext())
            count += ((GraphListVertex) i.next()).degree();
        return count;
    }

    /**
     * Construct a string representation of graph.
     *
     * @post returns string representation of graph
     *
     * @return String representing graph.
     */
    public String toString()
    {

        return "<GraphListDirected: "+dict.toString()+">";
    }
}


text:
/* Generated by wayland-scanner */

#ifndef IDLE_INHIBIT_UNSTABLE_V1_CLIENT_PROTOCOL_H
#define IDLE_INHIBIT_UNSTABLE_V1_CLIENT_PROTOCOL_H

#include <stdint.h>
#include <stddef.h>
#include "wayland-client.h"

#ifdef  __cplusplus
extern "C" {
#endif

/**
 * @page page_idle_inhibit_unstable_v1 The idle_inhibit_unstable_v1 protocol
 * @section page_ifaces_idle_inhibit_unstable_v1 Interfaces
 * - @subpage page_iface_zwp_idle_inhibit_manager_v1 - control behavior when display idles
 * - @subpage page_iface_zwp_idle_inhibitor_v1 - context object for inhibiting idle behavior
 * @section page_copyright_idle_inhibit_unstable_v1 Copyright
 * <pre>
 *
 * Copyright © 2015 Samsung Electronics Co., Ltd
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 * </pre>
 */
struct wl_surface;
struct zwp_idle_inhibit_manager_v1;
struct zwp_idle_inhibitor_v1;

/**
 * @page page_iface_zwp_idle_inhibit_manager_v1 zwp_idle_inhibit_manager_v1
 * @section page_iface_zwp_idle_inhibit_manager_v1_desc Description
 *
 * This interface permits inhibiting the idle behavior such as screen
 * blanking, locking, and screensaving.  The client binds the idle manager
 * globally, then creates idle-inhibitor objects for each surface.
 *
 * Warning! The protocol described in this file is experimental and
 * backward incompatible changes may be made. Backward compatible changes
 * may be added together with the corresponding interface version bump.
 * Backward incompatible changes are done by bumping the version number in
 * the protocol and interface names and resetting the interface version.
 * Once the protocol is to be declared stable, the 'z' prefix and the
 * version number in the protocol and interface names are removed and the
 * interface version number is reset.
 * @section page_iface_zwp_idle_inhibit_manager_v1_api API
 * See @ref iface_zwp_idle_inhibit_manager_v1.
 */
/**
 * @defgroup iface_zwp_idle_inhibit_manager_v1 The zwp_idle_inhibit_manager_v1 interface
 *
 * This interface permits inhibiting the idle behavior such as screen
 * blanking, locking, and screensaving.  The client binds the idle manager
 * globally, then creates idle-inhibitor objects for each surface.
 *
 * Warning! The protocol described in this file is experimental and
 * backward incompatible changes may be made. Backward compatible changes
 * may be added together with the corresponding interface version bump.
 * Backward incompatible changes are done by bumping the version number in
 * the protocol and interface names and resetting the interface version.
 * Once the protocol is to be declared stable, the 'z' prefix and the
 * version number in the protocol and interface names are removed and the
 * interface version number is reset.
 */
extern const struct wl_interface zwp_idle_inhibit_manager_v1_interface;
/**
 * @page page_iface_zwp_idle_inhibitor_v1 zwp_idle_inhibitor_v1
 * @section page_iface_zwp_idle_inhibitor_v1_desc Description
 *
 * An idle inhibitor prevents the output that the associated surface is
 * visible on from being set to a state where it is not visually usable due
 * to lack of user interaction (e.g. blanked, dimmed, locked, set to power
 * save, etc.)  Any screensaver processes are also blocked from displaying.
 *
 * If the surface is destroyed, unmapped, becomes occluded, loses
 * visibility, or otherwise becomes not visually relevant for the user, the
 * idle inhibitor will not be honored by the compositor; if the surface
 * subsequently regains visibility the inhibitor takes effect once again.
 * Likewise, the inhibitor isn't honored if the system was already idled at
 * the time the inhibitor was established, although if the system later
 * de-idles and re-idles the inhibitor will take effect.
 * @section page_iface_zwp_idle_inhibitor_v1_api API
 * See @ref iface_zwp_idle_inhibitor_v1.
 */
/**
 * @defgroup iface_zwp_idle_inhibitor_v1 The zwp_idle_inhibitor_v1 interface
 *
 * An idle inhibitor prevents the output that the associated surface is
 * visible on from being set to a state where it is not visually usable due
 * to lack of user interaction (e.g. blanked, dimmed, locked, set to power
 * save, etc.)  Any screensaver processes are also blocked from displaying.
 *
 * If the surface is destroyed, unmapped, becomes occluded, loses
 * visibility, or otherwise becomes not visually relevant for the user, the
 * idle inhibitor will not be honored by the compositor; if the surface
 * subsequently regains visibility the inhibitor takes effect once again.
 * Likewise, the inhibitor isn't honored if the system was already idled at
 * the time the inhibitor was established, although if the system later
 * de-idles and re-idles the inhibitor will take effect.
 */
extern const struct wl_interface zwp_idle_inhibitor_v1_interface;

#define ZWP_IDLE_INHIBIT_MANAGER_V1_DESTROY 0
#define ZWP_IDLE_INHIBIT_MANAGER_V1_CREATE_INHIBITOR 1

/**
 * @ingroup iface_zwp_idle_inhibit_manager_v1
 */
#define ZWP_IDLE_INHIBIT_MANAGER_V1_DESTROY_SINCE_VERSION 1
/**
 * @ingroup iface_zwp_idle_inhibit_manager_v1
 */
#define ZWP_IDLE_INHIBIT_MANAGER_V1_CREATE_INHIBITOR_SINCE_VERSION 1

/** @ingroup iface_zwp_idle_inhibit_manager_v1 */
static inline void
zwp_idle_inhibit_manager_v1_set_user_data(struct zwp_idle_inhibit_manager_v1 *zwp_idle_inhibit_manager_v1, void *user_data)
{
	wl_proxy_set_user_data((struct wl_proxy *) zwp_idle_inhibit_manager_v1, user_data);
}

/** @ingroup iface_zwp_idle_inhibit_manager_v1 */
static inline void *
zwp_idle_inhibit_manager_v1_get_user_data(struct zwp_idle_inhibit_manager_v1 *zwp_idle_inhibit_manager_v1)
{
	return wl_proxy_get_user_data((struct wl_proxy *) zwp_idle_inhibit_manager_v1);
}

static inline uint32_t
zwp_idle_inhibit_manager_v1_get_version(struct zwp_idle_inhibit_manager_v1 *zwp_idle_inhibit_manager_v1)
{
	return wl_proxy_get_version((struct wl_proxy *) zwp_idle_inhibit_manager_v1);
}

/**
 * @ingroup iface_zwp_idle_inhibit_manager_v1
 *
 * Destroy the inhibit manager.
 */
static inline void
zwp_idle_inhibit_manager_v1_destroy(struct zwp_idle_inhibit_manager_v1 *zwp_idle_inhibit_manager_v1)
{
	wl_proxy_marshal((struct wl_proxy *) zwp_idle_inhibit_manager_v1,
			 ZWP_IDLE_INHIBIT_MANAGER_V1_DESTROY);

	wl_proxy_destroy((struct wl_proxy *) zwp_idle_inhibit_manager_v1);
}

/**
 * @ingroup iface_zwp_idle_inhibit_manager_v1
 *
 * Create a new inhibitor object associated with the given surface.
 */
static inline struct zwp_idle_inhibitor_v1 *
zwp_idle_inhibit_manager_v1_create_inhibitor(struct zwp_idle_inhibit_manager_v1 *zwp_idle_inhibit_manager_v1, struct wl_surface *surface)
{
	struct wl_proxy *id;

	id = wl_proxy_marshal_constructor((struct wl_proxy *) zwp_idle_inhibit_manager_v1,
			 ZWP_IDLE_INHIBIT_MANAGER_V1_CREATE_INHIBITOR, &zwp_idle_inhibitor_v1_interface, NULL, surface);

	return (struct zwp_idle_inhibitor_v1 *) id;
}

#define ZWP_IDLE_INHIBITOR_V1_DESTROY 0

/**
 * @ingroup iface_zwp_idle_inhibitor_v1
 */
#define ZWP_IDLE_INHIBITOR_V1_DESTROY_SINCE_VERSION 1

/** @ingroup iface_zwp_idle_inhibitor_v1 */
static inline void
zwp_idle_inhibitor_v1_set_user_data(struct zwp_idle_inhibitor_v1 *zwp_idle_inhibitor_v1, void *user_data)
{
	wl_proxy_set_user_data((struct wl_proxy *) zwp_idle_inhibitor_v1, user_data);
}

/** @ingroup iface_zwp_idle_inhibitor_v1 */
static inline void *
zwp_idle_inhibitor_v1_get_user_data(struct zwp_idle_inhibitor_v1 *zwp_idle_inhibitor_v1)
{
	return wl_proxy_get_user_data((struct wl_proxy *) zwp_idle_inhibitor_v1);
}

static inline uint32_t
zwp_idle_inhibitor_v1_get_version(struct zwp_idle_inhibitor_v1 *zwp_idle_inhibitor_v1)
{
	return wl_proxy_get_version((struct wl_proxy *) zwp_idle_inhibitor_v1);
}

/**
 * @ingroup iface_zwp_idle_inhibitor_v1
 *
 * Remove the inhibitor effect from the associated wl_surface.
 */
static inline void
zwp_idle_inhibitor_v1_destroy(struct zwp_idle_inhibitor_v1 *zwp_idle_inhibitor_v1)
{
	wl_proxy_marshal((struct wl_proxy *) zwp_idle_inhibitor_v1,
			 ZWP_IDLE_INHIBITOR_V1_DESTROY);

	wl_proxy_destroy((struct wl_proxy *) zwp_idle_inhibitor_v1);
}

#ifdef  __cplusplus
}
#endif

#endif


text:
package org.axonframework.spring.config;

import org.aopalliance.intercept.MethodInvocation;
import org.axonframework.common.AxonConfigurationException;
import org.axonframework.messaging.annotation.ClasspathParameterResolverFactory;
import org.axonframework.messaging.annotation.ParameterResolverFactory;
import org.springframework.aop.IntroductionInfo;
import org.springframework.aop.IntroductionInterceptor;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.framework.AopProxyUtils;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.util.ClassUtils;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;

/**
 * Abstract bean post processor that finds candidates for proxying. Typically used to wrap annotated beans with their
 * respective interface implementations.
 *
 * @param  The primary interface of the adapter being created
 * @param <T> The type of adapter created by this class
 * @author Allard Buijze
 * @since 0.4
 */
public abstract class AbstractAnnotationHandlerBeanPostProcessor
        implements BeanPostProcessor, BeanFactoryAware {

    private ParameterResolverFactory parameterResolverFactory;
    private BeanFactory beanFactory;

    /**
     * {@inheritDoc}
     */
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        return bean;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Object postProcessAfterInitialization(final Object bean, final String beanName) throws BeansException {
        if (beanFactory.containsBean(beanName) && !beanFactory.isSingleton(beanName)) {
            return bean;
        }

        Class<?> targetClass = bean.getClass();
        final ClassLoader classLoader = targetClass.getClassLoader();
        if (parameterResolverFactory == null) {
            parameterResolverFactory = ClasspathParameterResolverFactory.forClassLoader(classLoader);
        }
        if (isPostProcessingCandidate(targetClass)) {
            T adapter = initializeAdapterFor(bean, parameterResolverFactory);
            return createAdapterProxy(bean, adapter, getAdapterInterfaces(), true, classLoader);
        } else if (!isInstance(bean, getAdapterInterfaces())
                && isPostProcessingCandidate(AopProxyUtils.ultimateTargetClass(bean))) {
            // Java Proxy, find target and inspect that instance
            try {
                Object targetBean = ((Advised) bean).getTargetSource().getTarget();
                // we want to invoke the Java Proxy if possible, so we create a CGLib proxy that does that for us
                Object proxyInvokingBean = createJavaProxyInvoker(bean, targetBean);

                T adapter = initializeAdapterFor(proxyInvokingBean, parameterResolverFactory);
                return createAdapterProxy(proxyInvokingBean, adapter, getAdapterInterfaces(), false,
                                                   classLoader);
            } catch (Exception e) {
                throw new AxonConfigurationException("Unable to wrap annotated handler.", e);
            }
        }
        return bean;
    }

    private boolean isInstance(Object bean, Class<?>[] adapterInterfaces) {
        for (Class<?> adapterInterface : adapterInterfaces) {
            if (adapterInterface.isInstance(bean)) {
                return true;
            }
        }
        return false;
    }

    /**
     * Returns a Proxy that will redirect calls to the javaProxy, if possible. Alternatively, the
     * target is invoked.
     *
     * @param javaProxy The java proxy to invoke, if possible.
     * @param target    The actual implementation to invoke if the javaProxy provides no method implementation
     * @return the proxy that will redirect the invocation to either the Java Proxy, or the target
     */
    private Object createJavaProxyInvoker(Object javaProxy, Object target) {
        ProxyFactory pf = new ProxyFactory(target);
        pf.addAdvice(new ProxyOrImplementationInvocationInterceptor(javaProxy, target));
        pf.setProxyTargetClass(true);
        pf.setExposeProxy(true);
        return pf.getProxy(target.getClass().getClassLoader());
    }

    /**
     * Returns the interface that the adapter implements to connect the annotated method to the actual interface
     * definition. Calls to methods declared on this interface are passed to the adapter, while other method calls will
     * be forwarded to the annotated object itself.
     *

     * Note: this *must* be an interface. It may not be an (abstract) class.
     *
     * @return the interface that the adapter implements to connect the annotated method to the actual interface
     * definition
     */
    protected abstract Class<?>[] getAdapterInterfaces();

    /**
     * Indicates whether an object of the given targetClass should be post processed.
     *
     * @param targetClass The type of bean
     * @return true to post process bean of given type, false otherwise
     */
    protected abstract boolean isPostProcessingCandidate(Class<?> targetClass);

    /**
     * Create an AnnotationEventListenerAdapter instance of the given {@code bean}. This adapter will receive all event
     * handler calls to be handled by this bean.
     *
     * @param bean                     The bean that the EventListenerAdapter has to adapt
     * @param parameterResolverFactory The parameter resolver factory that provides the parameter resolvers for the
     *                                 annotated handlers
     * @return an event handler adapter for the given {@code bean}
     */
    protected abstract T initializeAdapterFor(Object bean, ParameterResolverFactory parameterResolverFactory);

    @SuppressWarnings("unchecked")
    private I createAdapterProxy(Object annotatedHandler, final T adapter, final Class<?>[] adapterInterface,
                                 boolean proxyTargetClass, ClassLoader classLoader) {
        ProxyFactory pf = new ProxyFactory(annotatedHandler);
        for (Class<?> iClass : adapterInterface) {
            pf.addAdvice(new AdapterIntroductionInterceptor(adapter, iClass));
            pf.addInterface(iClass);
        }
        pf.setProxyTargetClass(proxyTargetClass);
        pf.setExposeProxy(true);
        return (I) pf.getProxy(classLoader);
    }

    /**
     * Sets the ParameterResolverFactory to create the Parameter Resolvers with that provide the parameter values for
     * the handler methods.
     *
     * @param parameterResolverFactory The parameter resolver factory to resolve parameter values with
     */
    public void setParameterResolverFactory(ParameterResolverFactory parameterResolverFactory) {
        this.parameterResolverFactory = parameterResolverFactory;
    }

    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        this.beanFactory = beanFactory;
    }

    private static final class ProxyOrImplementationInvocationInterceptor
            implements IntroductionInfo, IntroductionInterceptor {

        private final Object proxy;
        private final Method[] proxyMethods;
        private final Class[] interfaces;

        private ProxyOrImplementationInvocationInterceptor(Object proxy, Object implementation) {
            this.proxy = proxy;
            this.proxyMethods = proxy.getClass().getDeclaredMethods();
            this.interfaces = ClassUtils.getAllInterfaces(implementation);
        }

        @Override
        public boolean implementsInterface(Class<?> intf) {
            for (Class iFace : interfaces) {
                if (intf.equals(iFace)) {
                    return true;
                }
            }
            return false;
        }

        @Override
        public Class[] getInterfaces() {
            return interfaces;
        }

        @Override
        public Object invoke(MethodInvocation invocation) throws Exception {
            try {
                // if the method is declared on the proxy, invoke it there
                for (Method proxyMethod : proxyMethods) {
                    if (proxyMethod.getName().equals(invocation.getMethod().getName())
                            && Arrays.equals(proxyMethod.getParameterTypes(),
                                             invocation.getMethod().getParameterTypes())) {
                        return proxyMethod.invoke(proxy, invocation.getArguments());
                    }
                }
                // otherwise, invoke it on the original object
                return invocation.proceed();
            } catch (InvocationTargetException e) {
                throw e.getCause() instanceof Exception ? (Exception) e.getCause() : e;
            } catch (Throwable e) {
                if (e instanceof Error) {
                    throw (Error) e;
                }
                throw new InvocationTargetException(e);
            }
        }
    }

    private static final class AdapterIntroductionInterceptor implements IntroductionInfo, IntroductionInterceptor {

        private final Object adapter;
        private final Class<?> adapterInterface;

        private AdapterIntroductionInterceptor(Object adapter, Class<?> adapterInterface) {
            this.adapter = adapter;
            this.adapterInterface = adapterInterface;
        }

        @Override
        public boolean implementsInterface(Class<?> intf) {
            return intf.equals(adapterInterface);
        }

        @Override
        public Object invoke(MethodInvocation invocation) throws Exception {
            Class<?> declaringClass = invocation.getMethod().getDeclaringClass();
            try {
                if (declaringClass.isAssignableFrom(adapterInterface)) {
                    return invocation.getMethod().invoke(adapter, invocation.getArguments());
                }
                return invocation.proceed();
            } catch (InvocationTargetException e) {
                throw e.getCause() instanceof Exception ? (Exception) e.getCause() : e;
            } catch (Throwable e) {
                if (e instanceof Error) {
                    throw (Error) e;
                }
                throw new InvocationTargetException(e);
            }
        }

        @Override
        public Class[] getInterfaces() {
            return new Class[]{adapterInterface};
        }
    }
}


text:
#ifndef _FATCAT_FATEXTRACT_H
#define _FATCAT_FATEXTRACT_H

#include <string>

#include <core/FatSystem.h>
#include "FatWalk.h"

using namespace std;

class FatExtract : public FatWalk
{
    public:
        FatExtract(FatSystem &system);

        /**
         * Extract all the files to the given directory
         */
        void extract(unsigned int cluster, string directory, bool erased = false);

        virtual void onDirectory(FatEntry &parent, FatEntry &entr, string name);
        virtual void onEntry(FatEntry &parent, FatEntry &entry, string name);

    protected:
        string targetDirectory;
};

#endif // _FATCAT_FATEXTRACT_H


text:
package org.testevol.engine.domain;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;

import org.testevol.domain.Version;
import org.testevol.engine.TestResult.TestOutcome;

public class CategoryC1 extends Category{

	private Set<String> assertionFailures;
	private Set<String> compilationFailures;
	private Set<String> runtimeFailures;

	public CategoryC1(Version oldVersion, Version version) {
		super(CategoryClassification.TESTREP, oldVersion, version);
	}

	public void init() {

		assertionFailures = new HashSet<String>();
		compilationFailures = new HashSet<String>();
		runtimeFailures = new HashSet<String>();

		File buildDir = version.getBuildDir();

		//Get all old tests that fail in the new program
		File oldTestNewProgramCompilationError = new File(buildDir, getCompilationErrorResultFileName(OLD_TESTS, NEW_PROGRAM));
		File oldTestNewProgramRuntimeError = new File(buildDir, getRuntimeErrorResultFileName(OLD_TESTS, NEW_PROGRAM));
		File oldTestNewProgramAssertFailure = new File(buildDir, getAssertFailureResultFileName(OLD_TESTS,NEW_PROGRAM));

		//get all tests that passe in the new program
		File newTestNewProgram = new File(buildDir, getPassResultFileName(NEW_TESTS, NEW_PROGRAM));

		BufferedReader fileReaderOldTestNewProgramCompilationError = null;
		BufferedReader fileReaderOldTestNewProgramRuntimeError = null;
		BufferedReader fileReaderOldTestNewProgramAssertionFailure = null;
		BufferedReader fileReaderNewTestNewProgram = null;

		try {
			Set<String> newTestNewProgramPassedTests = new HashSet<String>();

			fileReaderNewTestNewProgram = new BufferedReader(new FileReader(
					newTestNewProgram));
			String test = null;
			while ((test = fileReaderNewTestNewProgram.readLine()) != null) {
				newTestNewProgramPassedTests.add(test);
			}

			fileReaderOldTestNewProgramCompilationError = new BufferedReader(
					new FileReader(oldTestNewProgramCompilationError));
			while ((test = fileReaderOldTestNewProgramCompilationError.readLine()) != null) {
				if (newTestNewProgramPassedTests.contains(test)) {
					addPossibleTest(test, TestOutcome.COMPILATION_ERROR);
				}
			}

			fileReaderOldTestNewProgramRuntimeError = new BufferedReader(
					new FileReader(oldTestNewProgramRuntimeError));
			while ((test = fileReaderOldTestNewProgramRuntimeError.readLine()) != null) {
				if (newTestNewProgramPassedTests.contains(test)) {
					addPossibleTest(test, TestOutcome.RUNTIME_ERROR);
				}
			}

			fileReaderOldTestNewProgramAssertionFailure = new BufferedReader(
					new FileReader(oldTestNewProgramAssertFailure));
			while ((test = fileReaderOldTestNewProgramAssertionFailure
					.readLine()) != null) {
				if (newTestNewProgramPassedTests.contains(test)) {
					addPossibleTest(test, TestOutcome.RUNTIME_ERROR);
				}
			}

		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			closeBufferedReader(fileReaderOldTestNewProgramCompilationError);
			closeBufferedReader(fileReaderOldTestNewProgramRuntimeError);
			closeBufferedReader(fileReaderOldTestNewProgramAssertionFailure);
			closeBufferedReader(fileReaderNewTestNewProgram);
		}
	}

	public int getNumberOfAssertionFailures(){
		int count = 0;
		for(String test:getTestsOnThisCategory()){
			if(assertionFailures.contains(test)){
				count++;
			}
		}
		return count;
	}

	public int getNumberOfCompilationFailures(){
		int count = 0;
		for(String test:getTestsOnThisCategory()){
			if(compilationFailures.contains(test)){
				count++;
			}
		}
		return count;
	}

	public int getNumberOfRuntimeFailures(){
		int count = 0;
		for(String test:getTestsOnThisCategory()){
			if(runtimeFailures.contains(test)){
				count++;
			}
		}
		return count;
	}

	private void addPossibleTest(String test, TestOutcome testOutcome) {
		super.addPossibleTest(test);
		test = removeParenthesis(test);
		switch (testOutcome) {
		case RUNTIME_ERROR:
			runtimeFailures.add(test);
			break;
		case ASSERT_FAILURE:
			assertionFailures.add(test);
			break;
		case COMPILATION_ERROR:
			compilationFailures.add(test);
			break;
		default:
			break;
		}
	}

	public void confirmTestOnThisCategory(String test, int changeType) {
		super.confirmTestOnThisCategory(test);
	}

	///////////////////////////////////////////

	private int numberOfMethodCallAdded = 0;
	private int numberOfMethodCallDeleted = 0;
	private int numberOfMethodCallModified= 0;
	private int numberOfMethodCallParameterAdded = 0;
	private int numberOfMethodCallParameterDeleted = 0;

	private int numberOfAssertionAdded = 0;
	private int numberOfAssertionDeleted = 0;
	private int numberOfAssertionModified = 0;
	private int numberOfAssertionExpectedValueModified = 0;
	private int numberOfAssertionChangesdOnly = 0;

	public int getNumberOfMethodCallAdded() {
		return numberOfMethodCallAdded;
	}

	public int getNumberOfMethodCallDeleted() {
		return numberOfMethodCallDeleted;
	}

	public int getNumberOfMethodCallModified() {
		return numberOfMethodCallModified;
	}

	public int getNumberOfMethodCallParameterAdded() {
		return numberOfMethodCallParameterAdded;
	}

	public int getNumberOfMethodCallParameterDeleted() {
		return numberOfMethodCallParameterDeleted;
	}

	public int getNumberOfAssertionAdded() {
		return numberOfAssertionAdded;
	}

	public int getNumberOfAssertionDeleted() {
		return numberOfAssertionDeleted;
	}

	public int getNumberOfAssertionModified() {
		return numberOfAssertionModified;
	}

	public int getNumberOfAssertionExpectedValueModified() {
		return numberOfAssertionExpectedValueModified;
	}

	public int getNumberOfAssertionChangesdOnly() {
		return numberOfAssertionChangesdOnly;
	}

}


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="horizontal"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <android.support.v7.widget.AppCompatTextView
        android:id="@+id/id"
        android:layout_width="36dp"
        android:layout_height="match_parent"
        android:gravity="center"
        tools:text="1"/>
    <android.support.v7.widget.AppCompatTextView
        android:id="@+id/name"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:gravity="center_vertical"
        android:paddingLeft="4dp"
        android:paddingRight="4dp"
        tools:text="dfasdfsdafsd"/>
    <android.support.v7.widget.AppCompatTextView
        android:id="@+id/username"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:gravity="center_vertical"
        android:paddingLeft="4dp"
        android:paddingRight="4dp"
        tools:text="dfasdfsdafsd"/>
    <android.support.v7.widget.AppCompatTextView
        android:id="@+id/password"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:gravity="center_vertical"
        android:paddingLeft="4dp"
        android:paddingRight="4dp"
        tools:text="dfasdfsdafsd"/>
</LinearLayout>


text:
define(['app','angularRoute'],function(app){

    console.log('inside Routes');
    console.log(app);
    var module  = app.config(['$routeProvider', function($routeProvider){

        $routeProvider
            .when('/contact/edit/:index',{
                'templateUrl':  "/views/edit.html",
                'controller': 'EditContact'
            })

            .when('/',{
                'templateUrl':  "/views/list.html",
                'controller': 'MainCtrl'
            })

            .when('/contact/add',{
                'templateUrl':"/views/add.html",
                'controller':'AddContact'
            });
    }]);

    console.log('inside Routes second');
    console.log(module);

    return module;

});


text:
@interface UIColor (KYC)

// color scheme TBD
+ (UIColor *)kycBrown;

+ (UIColor *)kycLightGray;
+ (UIColor *)kycMediumGray;
+ (UIColor *)kycDarkGray;
+ (UIColor *)kycGray;

+ (UIColor *)kycRed;
+ (UIColor *)kycOffWhite;

// semantic colors
+ (UIColor *)kycNavBarColor;
+ (UIColor *)kycGuestBackgroundColor;

@end


text:
namespace net {

struct UrlUtilities {
  // Gets the host from an url, strips the port number as well if the url
  // has one.
  // For example: calling GetUrlHost(www.foo.com:8080/boo) returns www.foo.com
  static std::string GetUrlHost(const std::string& url);

  // Get the host + path portion of an url
  // e.g   http://www.foo.com/path
  //       returns www.foo.com/path
  static std::string GetUrlHostPath(const std::string& url);

  // Gets the path portion of an url.
  // e.g   http://www.foo.com/path
  //       returns /path
  static std::string GetUrlPath(const std::string& url);

  // Unescape a url, converting all %XX to the the actual char 0xXX.
  // For example, this will convert "foo%21bar" to "foo!bar".
  static std::string Unescape(const std::string& escaped_url);
};

}  // namespace net

#endif  // NET_TOOLS_FLIP_SERVER_URL_UTILITIES_H_


text:
#ifndef GPICK_COLOR_WHEEL_TYPE_H_
#define GPICK_COLOR_WHEEL_TYPE_H_

#include "Color.h"
#include <stdint.h>

/** \file source/ColorWheelType.h
 * \brief Color wheel type description structure and functions
 */

/** \struct ColorWheelType
 * \brief ColorWheelType structure contains color wheel type name and conversion functions
 */
typedef struct ColorWheelType{
	const char *name; /**< Name of a color wheel */
/**
 * Callback used to convert color wheel specific hue into the color in a HSL color space
 * @param[in] hue Color wheel specific hue value
 * @param[out] hsl Result as a color in HSL color space
 */
	void (*hue_to_hsl)(double hue, Color* hsl);

/**
 * Callback used to convert HSL color space hue into color wheel specific hue
 * @param[in] rgbhue HSL color space hue value
 * @param[out] hue Color wheel specific hue value
 */
	void (*rgbhue_to_hue)(double rgbhue, double *hue);
}ColorWheelType;

/**
 * Get available color wheel types
 * @return Constant array of available color wheel types
 */
const ColorWheelType* color_wheel_types_get();

/**
 * Get the number of available color wheel types
 * @return Number of available color wheel types
 */
const uint32_t color_wheel_types_get_n();

#endif /* GPICK_COLOR_WHEEL_TYPE_H_ */


text:
module.exports = function(sequelize, DataTypes){
	return {
		model: sequelize.define("Quiz",{
			pregunta: {
				type:DataTypes.STRING,
				validate:{notEmpty: {msg: "Falta pregunta"}}
			},
		    respuesta: {
		  		type:DataTypes.STRING,
		  		validate:{notEmpty: {msg: "Falta respuesta"}}
		  	},
		    tematica: {
		  		type:DataTypes.STRING,
		  		validate:{notEmpty: {msg: "Falta temática"}}
		    }
		}),
		glue: function(models){
			models["quiz"].model.hasMany(models["comment"].model);
		}
	}
}


text:
from flask.ext.wtf import Form
import wtforms.validators as v
from wtforms import TextField, TextAreaField, HiddenField, SubmitField
from messages import msg

class WikiTranslatorForm(Form):
    pass

def getForm():
    FormCl = WikiTranslatorForm
    FormCl.title = TextField(msg['wikitranslator-title-label'],
                                 id='txt-title')
    FormCl.siteDest = TextField(msg['wikitranslator-siteDest-label'],
                                id='txt-siteDest',
                                validators=[v.Required(), v.IgnoreMe()])
    FormCl.siteSource = TextField(msg['wikitranslator-siteSource-label'],
                                  id='txt-siteSource',
                                  validators=[v.Required(), v.IgnoreMe()])
    FormCl.content = TextAreaField(msg['wikitranslator-content-label'],
                                   id="txt-content")
    FormCl.tabStatus = HiddenField(id="tab-active", validators=[v.IgnoreMe()])
    FormCl.proceed = SubmitField(msg['wikitranslator-button-submit'])
    return FormCl


text:
function ajax_error_handler(jqXHR, textStatus, errorThrown) {
        $("
Something went wrong, please try again.
").dialog({
            modal: true,
            title: "Error"
        });
}