text:
#ifndef AudioBuffer_h
#define AudioBuffer_h

#include "bindings/core/v8/ScriptWrappable.h"
#include "core/dom/DOMTypedArray.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefPtr.h"
#include "wtf/Vector.h"

namespace blink {

class AudioBus;
class ExceptionState;

class AudioBuffer : public GarbageCollectedFinalized<AudioBuffer>, public ScriptWrappable {
    DEFINE_WRAPPERTYPEINFO();
public:
    static AudioBuffer* create(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate);
    static AudioBuffer* create(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate, ExceptionState&);

    // Returns 0 if data is not a valid audio file.
    static AudioBuffer* createFromAudioFileData(const void* data, size_t dataSize, bool mixToMono, float sampleRate);

    static AudioBuffer* createFromAudioBus(AudioBus*);

    // Format
    size_t length() const { return m_length; }
    double duration() const { return length() / static_cast<double>(sampleRate()); }
    float sampleRate() const { return m_sampleRate; }

    // Channel data access
    unsigned numberOfChannels() const { return m_channels.size(); }
    PassRefPtr<DOMFloat32Array> getChannelData(unsigned channelIndex, ExceptionState&);
    DOMFloat32Array* getChannelData(unsigned channelIndex);
    void zero();

    DEFINE_INLINE_TRACE() { }

    virtual v8::Handle<v8::Object> associateWithWrapper(v8::Isolate*, const WrapperTypeInfo*, v8::Handle<v8::Object> wrapper) override;

protected:
    AudioBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate);
    explicit AudioBuffer(AudioBus*);
    bool createdSuccessfully(unsigned desiredNumberOfChannels) const;

    float m_sampleRate;
    size_t m_length;

    Vector<RefPtr<DOMFloat32Array>> m_channels;
};

} // namespace blink

#endif // AudioBuffer_h


text:
package net.meisen.dissertation.model.dimensions.graph;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import net.meisen.dissertation.exceptions.DescriptorDimensionException;
import net.meisen.dissertation.model.dimensions.DescriptorDimension;
import net.meisen.dissertation.model.dimensions.DescriptorHierarchy;
import net.meisen.dissertation.model.dimensions.DescriptorLevel;
import net.meisen.dissertation.model.dimensions.DescriptorMember;
import net.meisen.dissertation.model.dimensions.IDimension;
import net.meisen.general.genmisc.exceptions.ForwardedRuntimeException;

/**
 * A graph representing and validating a defined {@code DescriptorDimension}.
 *
 * @author pmeisen
 *
 */
public class DescriptorGraph implements IDimensionGraph {

	private DescriptorDimension dimension = null;

	private final Map<String, DescriptorGraphNode> descriptorGraphNodes;
	private List<DescriptorGraphNode> sourceNodes;
	private List<DescriptorGraphNode> sinkNode;

	private final Map<String, DescriptorGraphLevel> descriptorGraphLevels;
	private List<DescriptorGraphLevel> levelLeafs;
	private DescriptorGraphLevel levelRoot;

	private boolean validated;

	/**
	 * The default constructor.
	 */
	public DescriptorGraph() {
		this.descriptorGraphNodes = new HashMap<String, DescriptorGraphNode>();
		this.descriptorGraphLevels = new HashMap<String, DescriptorGraphLevel>();

		this.sourceNodes = new ArrayList<DescriptorGraphNode>();
		this.sinkNode = null;

		this.levelLeafs = new ArrayList<DescriptorGraphLevel>();
		this.levelRoot = null;

		this.validated = false;
	}

	/**
	 * Gets the node for the specified member. A member is uniquely defined by
	 * it's hierarchy and it's identifiers.
	 *
	 * @param hierarchyId
	 *            the identifier of the {@code DescriptorHierarchy} the member
	 *            belongs to
	 * @param memberId
	 *            the identifier of the {@code DescriptorMember} to be retrieved
	 *
	 * @return the {@code DescriptorGraphNode} of the member or {@code null} if
	 *         no node for the specified information exist
	 */
	public DescriptorGraphNode getNode(final String hierarchyId,
			final String memberId) {
		final String nodeId = createNodeId(hierarchyId, memberId);
		return descriptorGraphNodes.get(nodeId);
	}

	/**
	 * Gets all the descriptorGraphNodes of the {@code DescriptorGraph}.
	 *
	 * @return all the descriptorGraphNodes of the {@code DescriptorGraph}
	 */
	public Collection<DescriptorGraphNode> getNodes() {
		return Collections
				.unmodifiableCollection(descriptorGraphNodes.values());
	}

	/**
	 * Gets all the descriptorGraphLevels of the {@code DescriptorGraph}.
	 *
	 * @return all the descriptorGraphLevels of the {@code DescriptorGraph}
	 */
	public Collection<DescriptorGraphLevel> getLevels() {
		return Collections.unmodifiableCollection(descriptorGraphLevels
				.values());
	}

	/**
	 * Gets a specific {@code DescriptorGraphLevel} of the graph. The level is
	 * uniquely defined by the hierarchy it belongs to (which can be
	 * {@code null} if it's a shared level) and it's identifier used within the
	 * {@code DescriptorLevel} .
	 *
	 * @param hierarchyId
	 *            the identifier of the hierarchy
	 * @param descLevelId
	 *            the identifier of the {@code DescriptorLevel}
	 *
	 * @return the {@code DescriptorGraphLevel} found or {@code null} if no
	 *         {@code DescriptorGraphLevel} for the specified values exists
	 */
	public DescriptorGraphLevel getLevel(final String hierarchyId,
			final String descLevelId) {
		final String levelId = createLevelId(hierarchyId, descLevelId);
		return descriptorGraphLevels.get(levelId);
	}

	/**
	 * Gets all the sources, a.k.a. leafs, of the graph.
	 *
	 * @return the sources, a.k.a. leafs, of the graph
	 */
	public List<DescriptorGraphNode> getSources() {
		if (this.sourceNodes == null) {
			validate();
		}

		return this.sourceNodes;
	}

	/**
	 * Gets the sinks, a.k.a. roots, of the graph.
	 *
	 * @return the sinks, a.k.a. roots, of the graph
	 */
	public List<DescriptorGraphNode> getSinks() {
		if (this.sinkNode == null) {
			validate();
		}

		return this.sinkNode;
	}

	@Override
	public void create(final IDimension dimension)
			throws ForwardedRuntimeException {

		// make sure the dimension is correct
		if (dimension instanceof DescriptorDimension == false) {
			throw new ForwardedRuntimeException(
					DescriptorDimensionException.class, 1022,
					dimension == null ? null : dimension.getClass()
							.getSimpleName());
		}

		this.validated = false;

		this.descriptorGraphNodes.clear();
		this.descriptorGraphLevels.clear();

		this.sourceNodes.clear();
		this.sinkNode = null;

		this.levelLeafs.clear();
		this.levelRoot = null;

		this.dimension = (DescriptorDimension) dimension;

		final Collection<DescriptorHierarchy> hierarchies = this.dimension
				.getHierarchies();
		for (final DescriptorHierarchy hierarchy : hierarchies) {
			final String hierarchyId = hierarchy.getId();
			final Collection<DescriptorMember> members = hierarchy.getMembers();

			// check the different members
			for (final DescriptorMember member : members) {

				// create a node
				DescriptorGraphNode descriptorGraphNode = getOrCreateNode(
						hierarchyId, member);

				// get the level
				final DescriptorGraphLevel descriptorGraphLevel = getOrCreateLevel(member
						.getLevel());

				// add the node to the level
				descriptorGraphLevel.add(descriptorGraphNode);

				// add the parents and the children
				for (final DescriptorMember parent : member.getRollUpTo()) {

					/*
					 * Do the descriptorGraphNodes.
					 */
					final DescriptorGraphNode parentNode = getOrCreateNode(
							hierarchyId, parent);
					descriptorGraphNode.addParent(parentNode);

					// register this as child
					parentNode.addChild(descriptorGraphNode);

					/*
					 * Do the descriptorGraphLevels.
					 */
					final DescriptorGraphLevel parentLevel = getOrCreateLevel(parentNode
							.getLevel());
					descriptorGraphLevel.addParent(parentLevel);

					// register this as child
					parentLevel.addChild(descriptorGraphLevel);
				}
			}
		}

		validate();
	}

	/**
	 * Gets or creates the level for the specified {@code descLevel}.
	 *
	 * @param descLevel
	 *            the {@code DescriptorLevel} to create or get the
	 *            {@code DescriptorGraphLevel} for
	 *
	 * @return the {@code DescriptorLevel} created or retrieved
	 */
	protected DescriptorGraphLevel getOrCreateLevel(
			final DescriptorLevel descLevel) {
		final String descLevelId = descLevel.getId();
		final String levelId = createLevelId(descLevel.getHierachy().getId(),
				descLevelId);

		DescriptorGraphLevel descriptorGraphLevel = descriptorGraphLevels
				.get(levelId);
		if (descriptorGraphLevel == null) {
			descriptorGraphLevel = new DescriptorGraphLevel(
					dimension.isSharedLevel(descLevelId));
			descriptorGraphLevels.put(levelId, descriptorGraphLevel);
		}

		// bind the DescriptorLevel to it
		descriptorGraphLevel.bind(descLevel);

		return descriptorGraphLevel;
	}

	/**
	 * Gets or creates the node for the specified {@code hierarchyId} and
	 * {@code DescriptorMember}.
	 *
	 * @param hierarchyId
	 *            the identifier of the hierarchy the
	 *            {@code DescriptorGraphNode} belongs to
	 * @param member
	 *            the {@code DescriptorMember} to get or create the
	 *            {@code DescriptorGraphNode} for
	 *
	 *
	 * @return the {@code DescriptorLevel} created or retrieved
	 */
	protected DescriptorGraphNode getOrCreateNode(final String hierarchyId,
			final DescriptorMember member) {

		final String nodeId = createNodeId(hierarchyId, member.getId());
		DescriptorGraphNode descriptorGraphNode = descriptorGraphNodes
				.get(nodeId);

		if (descriptorGraphNode == null) {

			// create the node
			descriptorGraphNode = new DescriptorGraphNode(member);
			descriptorGraphNodes.put(nodeId, descriptorGraphNode);
		}

		return descriptorGraphNode;
	}

	/**
	 * Creates the identifier used internally to represent the node for the
	 * specified {@code hierarchyId} and {@code memberId}.
	 *
	 * @param hierarchyId
	 *            the identifier of the hierarchy
	 * @param memberId
	 *            the identifier of the member
	 *
	 * @return the created internally used identifier
	 */
	protected String createNodeId(final String hierarchyId,
			final String memberId) {
		return hierarchyId + "." + memberId;
	}

	/**
	 * Creates the identifier used internally to represent the level for the
	 * specified {@code hierarchyId} and {@code levelId}.
	 *
	 * @param hierarchyId
	 *            the identifier of the hierarchy
	 * @param levelId
	 *            the identifier of the level
	 *
	 * @return the created internally used identifier
	 */
	protected String createLevelId(final String hierarchyId,
			final String levelId) {

		// check if we have a shared dimension
		final boolean shared = dimension.isSharedLevel(levelId);

		if (shared) {
			return levelId;
		} else {
			return hierarchyId + "." + levelId;
		}
	}

	/**
	 * Validates the graph. This method is internally called after creation.
	 *
	 * @throws ForwardedRuntimeException
	 *             if the validation fails
	 */
	protected void validate() throws ForwardedRuntimeException {

		if (validated) {
			return;
		} else {
			validateNodes();
			validateLevels();

			validated = true;
		}
	}

	/**
	 * Validates the descriptorGraphNodes: There is only one sink (a.k.a. root),
	 * the sink is reachable from every node, and every source is a matcher
	 * (descriptor's value).
	 *
	 * @throws ForwardedRuntimeException
	 *             if the validation fails
	 */
	protected void validateNodes() throws ForwardedRuntimeException {

		// find the sink and the sources
		for (final DescriptorGraphNode descriptorGraphNode : descriptorGraphNodes
				.values()) {
			final DescriptorMember member = descriptorGraphNode.getMember();

			// the member cannot be null
			if (member == null) {
				throw new ForwardedRuntimeException(
						DescriptorDimensionException.class, 1002);
			}

			// check if we have a sink
			if (descriptorGraphNode.isSink()) {

				if (descriptorGraphNode.getMinDistance() != 0) {
					throw new ForwardedRuntimeException(
							DescriptorDimensionException.class, 1016,
							dimension.getId(),
							descriptorGraphNode.getMinDistance());
				} else if (this.sinkNode == null) {
					this.sinkNode = new ArrayList<DescriptorGraphNode>();
				}
				this.sinkNode.add(descriptorGraphNode);
			} else if (descriptorGraphNode.getMinDistance() < 0) {
				throw new ForwardedRuntimeException(
						DescriptorDimensionException.class, 1017,
						descriptorGraphNode.getMember().getId(),
						dimension.getId(), descriptorGraphNode.getMinDistance());
			}

			// check if we have a pattern based, none source
			if (descriptorGraphNode.isSource()) {
				this.sourceNodes.add(descriptorGraphNode);
			} else if (member.isPatternBased()) {
				throw new ForwardedRuntimeException(
						DescriptorDimensionException.class, 1005,
						member.getId());
			}
		}

		// make sure we found a sink
		if (this.sinkNode == null) {
			throw new ForwardedRuntimeException(
					DescriptorDimensionException.class, 1009, dimension.getId());
		} else if (this.sourceNodes.isEmpty()) {
			throw new ForwardedRuntimeException(
					DescriptorDimensionException.class, 1013, dimension.getId());
		}
	}

	/**
	 * Validates the descriptorGraphLevels: The descriptorGraphLevels must
	 * provide a partial order over a partition of all the descriptorGraphNodes.
	 *
	 * @throws ForwardedRuntimeException
	 *             if the validation fails
	 */
	protected void validateLevels() throws ForwardedRuntimeException {

		// find the root and the leafs
		final Set<String> emptyLevels = new HashSet<String>();
		for (final Entry<String, DescriptorGraphLevel> entry : this.descriptorGraphLevels
				.entrySet()) {

			// get the level
			final DescriptorGraphLevel level = entry.getValue();

			// check if the level is empty, it will be removed afterwards
			if (level.isEmpty()) {
				emptyLevels.add(entry.getKey());
			} else {

				// check if we have a root level
				if (level.isRoot()) {
					if (this.levelRoot != null) {
						throw new ForwardedRuntimeException(
								DescriptorDimensionException.class, 1011,
								dimension.getId());
					}

					this.levelRoot = level;
				}

				// check leafs
				if (level.isLeaf()) {
					this.levelLeafs.add(level);
				}

				/*
				 * Check the parents, all parents are by definition in relation
				 * to this: this < allParents
				 */
				final int levelMaxDistance = level.getMaxDistance();
				for (final DescriptorGraphLevel parent : level.getAllParents()) {

					/*
					 * Make sure we get closer, anyways only the max has to be
					 * reduced compared to the min.
					 */
					if (levelMaxDistance <= parent.getMinDistance()) {
						throw new ForwardedRuntimeException(
								DescriptorDimensionException.class, 1019,
								level.getDescriptorLevelId(), levelMaxDistance,
								parent.getDescriptorLevelId(),
								parent.getMinDistance());
					}

					boolean reachable = false;
					for (final DescriptorGraphNode node : level.getNodes()) {
						for (final DescriptorGraphNode parentNode : parent
								.getNodes()) {
							if (node.canReach(parentNode)) {
								reachable = true;
								break;
							}

							/*
							 * The condition
							 * "For all parentNodes there exists no node in this level which can be reached"
							 * does not have to be checked, because we received
							 * all parents already. If all parents can be
							 * received, there is no cycle defined.
							 */
							// if (parentNode.canReach(node)) {
							// throw exception
							// }
						}
					}

					// throw the exception if no path was found
					if (!reachable) {
						throw new ForwardedRuntimeException(
								DescriptorDimensionException.class, 1020,
								level.getDescriptorLevelId(),
								parent.getDescriptorLevelId());
					}
				}
			}
		}

		// remove the empty descriptorGraphLevels
		for (final String key : emptyLevels) {
			this.descriptorGraphLevels.remove(key);
		}

		// make sure we found a root
		if (this.levelRoot == null) {
			throw new ForwardedRuntimeException(
					DescriptorDimensionException.class, 1011, dimension.getId());
		} else if (this.levelLeafs.isEmpty()) {
			throw new ForwardedRuntimeException(
					DescriptorDimensionException.class, 1012, dimension.getId());
		}
	}

	@Override
	public DescriptorDimension getDimension() {
		return dimension;
	}

	@Override
	public String toString() {
		final StringBuilder sb = new StringBuilder();
		final Map<String, Integer> stat = createStatistic();

		final List<Set<DescriptorGraphLevel>> levels = new ArrayList<Set<DescriptorGraphLevel>>();
		final Set<DescriptorGraphLevel> root = new HashSet<DescriptorGraphLevel>();
		root.add(levelRoot);
		levels.add(root);

		while (levels.size() > 0) {
			final Set<DescriptorGraphLevel> cur = levels.remove(0);
			sb.append(toStringLevels(stat, cur));
			sb.append(System.getProperty("line.separator"));

			for (final DescriptorGraphLevel c : cur) {
				if (!c.isLeaf()) {
					levels.add(c.getChildren());
				}
			}
		}

		return sb.toString();
	}

	/**
	 * Method to create a statistic for print-outs, i.e. different max-sizings.
	 *
	 * @return the created statistic
	 */
	protected Map<String, Integer> createStatistic() {

		int longestLevel = 0;
		int longestDistance = 0;
		int longestNode = 0;
		for (final DescriptorGraphLevel level : getLevels()) {
			longestLevel = Math.max(longestLevel, level.getDescriptorLevelId()
					.length());
			longestDistance = Math.max(longestDistance, Math.max(
					("" + level.getMinDistance()).length(),
					("" + level.getMaxDistance()).length()));

			for (final DescriptorGraphNode node : level.getNodes()) {
				longestNode = Math.max(longestNode, node.toString().length());
			}
		}

		final Map<String, Integer> stat = new HashMap<String, Integer>();
		stat.put("longestLevel", longestLevel);
		stat.put("longestDistance", longestDistance);
		stat.put("longestNode", longestNode);

		return stat;
	}

	/**
	 * Helper method to print the passed levels.
	 *
	 * @param stat
	 *            the statistic of the values considering size
	 * @param levels
	 *            the different levels
	 *
	 * @return the created print-out
	 */
	protected String toStringLevels(final Map<String, Integer> stat,
			final DescriptorGraphLevel... levels) {
		return toStringLevels(stat, Arrays.asList(levels));
	}

	/**
	 * Helper method to print the passed levels.
	 *
	 * @param stat
	 *            the statistic of the values considering size
	 * @param levels
	 *            the different levels
	 *
	 * @return the created print-out
	 */
	protected String toStringLevels(final Map<String, Integer> stat,
			final Collection<DescriptorGraphLevel> levels) {
		final StringBuilder sb = new StringBuilder();

		// get some statistics
		final int longestLevel = stat.get("longestLevel");
		final int longestDistance = stat.get("longestDistance");
		final int longestNode = stat.get("longestNode");

		// count the nodes
		final StringBuilder top = new StringBuilder();
		final StringBuilder middle = new StringBuilder();
		final StringBuilder bottom = new StringBuilder();

		for (final DescriptorGraphLevel level : levels) {
			final String lvlId = String.format("%1$-" + longestLevel + "s",
					level.getDescriptorLevelId());
			final String min = String.format("%1$" + longestDistance + "d",
					level.getMinDistance());
			final String max = String.format("%1$" + longestDistance + "d",
					level.getMaxDistance());

			// get the amount of nodes
			int nodeNr = 0;

			// @formatter:off
			final String label = lvlId + " (" + min + "/" + max + "): ";
			final String spaceNode = new String(new char[label.length()]).replace("\0", " ");
			top.append(spaceNode);
			middle.append(lvlId + " (" + min + "/" + max + "): ");
			bottom.append(spaceNode);
			// @formatter:on

			for (final DescriptorGraphNode node : level.getNodes()) {
				final String nodeStr = String.format(
						"%1$-" + longestNode + "s", node.toString());
				nodeNr++;

				// @formatter:off
				top.append((nodeNr > 1 ? " " : "") + "+" + new String(new char[longestNode + 2]).replace("\0", "-") + "+");
				middle.append((nodeNr > 1 ? " " : "") + "| " + nodeStr + " |");
				bottom.append((nodeNr > 1 ? " " : "") + "+" + new String(new char[longestNode + 2]).replace("\0", "-") + "+");
				// @formatter:on
			}

			// @formatter:off
			final String spaceLvl = new String(new char[5]).replace("\0", " ");
			top.append(spaceLvl);
			middle.append(spaceLvl);
			bottom.append(spaceLvl);
			// @formatter:on
		}

		sb.append(top);
		sb.append(System.getProperty("line.separator"));
		sb.append(middle);
		sb.append(System.getProperty("line.separator"));
		sb.append(bottom);
		sb.append(System.getProperty("line.separator"));

		return sb.toString();
	}
}

redpajama_set_name: RedPajamaGithub


text:
layout: post
date: 2016-05-30
title: "ALMA NOVIA FRANK Sleeveless Chapel Train Aline/Princess"
category: ALMA NOVIA
tags: [ALMA NOVIA,Aline/Princess ,V-neck,Chapel Train,Sleeveless]
---
### ALMA NOVIA FRANK
Just **$409.99**
###   Sleeveless Chapel Train Aline/Princess

BRANDS	ALMA NOVIA

Silhouette	Aline/Princess

Neckline	V-neck

Hemline/Train	Chapel Train

Sleeve	Sleeveless

Buy it: [https://www.readybrides.com/en/alma-novia/44780-alma-novia-frank.html](https://www.readybrides.com/en/alma-novia/44780-alma-novia-frank.html)


text:
import React from 'react';
import ReactDOM from 'react-dom';

import injectTapEventPlugin from 'react-tap-event-plugin';
import { Provider } from 'react-redux';

import createStore from './store/configureStore';

import App from './containers/app';

const store = createStore();
injectTapEventPlugin();

ReactDOM.render((
  <Provider store={store}>
    <App/>
  </Provider>
  ),
  document.getElementById('app'));


text:
<!DOCTYPE html>

    <title></title>

            Web Workers also support Channel Messaging. Channel Messaging can be used to enable direct communication between workers. In this example, the UI thread creates two workers and a set of ports through which the Web Workers can directly communicate. The
            UI thread then passes the string "Hello World" to the first Web Worker, which passes it on to the second Web Worker via the specified port, which then passes it back to the UI thread.

        <button id="doMessageChannel" class="action win-button">Run</button>

Message Log:

            <button id="clearMessageLog" class="action win-button">
                Clear Log</button>


text:
//
//  Map.m
//  SimpleMap
//
//  Created by masashi on 11/8/13.
//
//

#import "Map.h"

@implementation Map

-(void)setGoogleMapsViewController:(GoogleMapsViewController *)viewCtrl
{
  self.mapCtrl = viewCtrl;
}

/**
 * Move the center of the map
 */
- (void)setCenter:(CDVInvokedUrlCommand *)command {

  float latitude = [[command.arguments objectAtIndex:1] floatValue];
  float longitude = [[command.arguments objectAtIndex:2] floatValue];

  [self.mapCtrl.map animateToLocation:CLLocationCoordinate2DMake(latitude, longitude)];

  CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
  [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}

- (void)setMyLocationEnabled:(CDVInvokedUrlCommand *)command {
  Boolean isEnabled = [[command.arguments objectAtIndex:1] boolValue];
  self.mapCtrl.map.settings.myLocationButton = isEnabled;
  self.mapCtrl.map.myLocationEnabled = isEnabled;

  CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
  [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}

- (void)setIndoorEnabled:(CDVInvokedUrlCommand *)command {
  Boolean isEnabled = [[command.arguments objectAtIndex:1] boolValue];
  self.mapCtrl.map.settings.indoorPicker = isEnabled;
  self.mapCtrl.map.indoorEnabled = isEnabled;

  CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
  [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}

- (void)setTrafficEnabled:(CDVInvokedUrlCommand *)command {
  Boolean isEnabled = [[command.arguments objectAtIndex:1] boolValue];
  self.mapCtrl.map.trafficEnabled = isEnabled;

  CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
  [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}

- (void)setCompassEnabled:(CDVInvokedUrlCommand *)command {
  Boolean isEnabled = [[command.arguments objectAtIndex:1] boolValue];
  self.mapCtrl.map.settings.compassButton = isEnabled;

  CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
  [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}

- (void)setTilt:(CDVInvokedUrlCommand *)command {

  CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
  [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}

/**
 * Change the zoom level
 */
- (void)setZoom:(CDVInvokedUrlCommand *)command {
  float zoom = [[command.arguments objectAtIndex:1] floatValue];
  CLLocationCoordinate2D center = [self.mapCtrl.map.projection coordinateForPoint:self.mapCtrl.map.center];

  [self.mapCtrl.map setCamera:[GMSCameraPosition cameraWithTarget:center zoom:zoom]];

  CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
  [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}

/**
 * Change the Map Type
 */
- (void)setMapTypeId:(CDVInvokedUrlCommand *)command {
  CDVPluginResult* pluginResult = nil;

  NSString *typeStr = [command.arguments objectAtIndex:1];
  NSDictionary *mapTypes = [NSDictionary dictionaryWithObjectsAndKeys:
                            ^() {return kGMSTypeHybrid; }, @"MAP_TYPE_HYBRID",
                            ^() {return kGMSTypeSatellite; }, @"MAP_TYPE_SATELLITE",
                            ^() {return kGMSTypeTerrain; }, @"MAP_TYPE_TERRAIN",
                            ^() {return kGMSTypeNormal; }, @"MAP_TYPE_NORMAL",
                            ^() {return kGMSTypeNone; }, @"MAP_TYPE_NONE",
                            nil];

  typedef GMSMapViewType (^CaseBlock)();
  GMSMapViewType mapType;
  CaseBlock caseBlock = mapTypes[typeStr];
  if (caseBlock) {
    // Change the map type
    mapType = caseBlock();
    self.mapCtrl.map.mapType = mapType;
    pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
  } else {
    // Error : User specifies unknow map type id
    pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR
                                     messageAsString:[NSString
                                                      stringWithFormat:@"Unknow MapTypeID is specified:%@", typeStr]];
  }
  [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}

/**
 * Move the map camera with animation
 */
-(void)animateCamera:(CDVInvokedUrlCommand *)command
{
  [self updateCameraPosition:@"animateCamera" command:command];
}

/**
 * Move the map camera
 */
-(void)moveCamera:(CDVInvokedUrlCommand *)command
{
  [self updateCameraPosition:@"moveCamera" command:command];
}

-(void)getCameraPosition:(CDVInvokedUrlCommand *)command
{
  GMSCameraPosition *camera = self.mapCtrl.map.camera;

  NSMutableDictionary *latLng = [NSMutableDictionary dictionary];
  [latLng setObject:[NSNumber numberWithFloat:camera.target.latitude] forKey:@"lat"];
  [latLng setObject:[NSNumber numberWithFloat:camera.target.longitude] forKey:@"lng"];

  NSMutableDictionary *json = [NSMutableDictionary dictionary];
  [json setObject:[NSNumber numberWithFloat:camera.zoom] forKey:@"zoom"];
  [json setObject:[NSNumber numberWithDouble:camera.viewingAngle] forKey:@"tilt"];
  [json setObject:latLng forKey:@"target"];
  [json setObject:[NSNumber numberWithFloat:camera.bearing] forKey:@"bearing"];
  [json setObject:[NSNumber numberWithInt:camera.hash] forKey:@"hashCode"];

  CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:json];
  [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}

-(void)updateCameraPosition: (NSString*)action command:(CDVInvokedUrlCommand *)command {
  NSDictionary *json = [command.arguments objectAtIndex:1];
  NSString *targetClsName = [[json objectForKey:@"target"] className];

  int bearing = [[json valueForKey:@"bearing"] integerValue];
  double angle = [[json valueForKey:@"tilt"] doubleValue];
  int zoom = [[json valueForKey:@"zoom"] integerValue];

  NSDictionary *latLng = nil;
  float latitude;
  float longitude;
  GMSCameraPosition *cameraPosition;

  if ([targetClsName isEqualToString:@"__NSCFArray"] || [targetClsName isEqualToString:@"__NSArrayM"] ) {
    int i = 0;
    NSArray *latLngList = [json objectForKey:@"target"];
    GMSMutablePath *path = [GMSMutablePath path];
    for (i = 0; i < [latLngList count]; i++) {
      latLng = [latLngList objectAtIndex:i];
      latitude = [[latLng valueForKey:@"lat"] floatValue];
      longitude = [[latLng valueForKey:@"lng"] floatValue];
      [path addLatitude:latitude longitude:longitude];
    }
    GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] initWithPath:path];
    cameraPosition = [self.mapCtrl.map cameraForBounds:bounds insets:UIEdgeInsetsMake(10, 10, 10, 10)];
  } else {
    latLng = [json objectForKey:@"target"];
    latitude = [[latLng valueForKey:@"lat"] floatValue];
    longitude = [[latLng valueForKey:@"lng"] floatValue];

    cameraPosition = [GMSCameraPosition cameraWithLatitude:latitude
                                        longitude:longitude
                                        zoom:zoom
                                        bearing:bearing
                                        viewingAngle:angle];
  }

  float duration = 5.0f;
  if ([json objectForKey:@"duration"]) {
    duration = [[json objectForKey:@"duration"] floatValue] / 1000;
  }

  CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];

  if ([action  isEqual: @"animateCamera"]) {
    [CATransaction begin]; {
      [CATransaction setAnimationDuration: duration];

      [CATransaction setAnimationTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]];

      [CATransaction setCompletionBlock:^{
        [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
      }];

      [self.mapCtrl.map animateToCameraPosition: cameraPosition];
    }[CATransaction commit];
  }

  if ([action  isEqual: @"moveCamera"]) {
    [self.mapCtrl.map setCamera:cameraPosition];
    [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
  }

}

@end


text:
from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid

class HPP3_ConnectedLHS(HimesisPreConditionPatternLHS):
        def __init__(self):
                """
                Creates the himesis graph representing the AToM3 model HPP3_ConnectedLHS.
                """
                # Flag this instance as compiled now
                self.is_compiled = True

                super(HPP3_ConnectedLHS, self).__init__(name='HPP3_ConnectedLHS', num_nodes=0, edges=[])

                # Set the graph attributes
                self["mm__"] = ['MT_pre__FamiliesToPersonsMM', 'MoTifRule']
                self["MT_constraint__"] = """#===============================================================================
# This code is executed after the nodes in the LHS have been matched.
# You can access a matched node labelled n by: PreNode('n').
# To access attribute x of node n, use: PreNode('n')['x'].
# The given constraint must evaluate to a boolean expression:
#    returning True enables the rule to be applied,
#    returning False forbids the rule from being applied.
#===============================================================================

return True
"""
                self["name"] = """"""
                self["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'PP3')

                # Set the node attributes

                # match class State() node
                self.add_node()
                self.vs[0]["MT_pre__attr1"] = """
#===============================================================================
# This code is executed when evaluating if a node shall be matched by this rule.
# You can access the value of the current node's attribute value by: attr_value.
# You can access any attribute x of this node by: this['x'].
# If the constraint relies on attribute values from other nodes,
# use the LHS/NAC constraint instead.
# The given constraint must evaluate to a boolean expression.
#===============================================================================

return True
"""
                self.vs[0]["MT_label__"] = """1"""
                self.vs[0]["MT_dirty__"] = False
                self.vs[0]["mm__"] = """MT_pre__State"""
                self.vs[0]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'')
                # match class ExitPoint() node
                self.add_node()
                self.vs[1]["MT_pre__attr1"] = """
#===============================================================================
# This code is executed when evaluating if a node shall be matched by this rule.
# You can access the value of the current node's attribute value by: attr_value.
# You can access any attribute x of this node by: this['x'].
# If the constraint relies on attribute values from other nodes,
# use the LHS/NAC constraint instead.
# The given constraint must evaluate to a boolean expression.
#===============================================================================

return True
"""
                self.vs[1]["MT_label__"] = """2"""
                self.vs[1]["MT_dirty__"] = False
                self.vs[1]["mm__"] = """MT_pre__ExitPoint"""
                self.vs[1]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'')
                # match class Transition() node
                self.add_node()
                self.vs[2]["MT_pre__attr1"] = """
#===============================================================================
# This code is executed when evaluating if a node shall be matched by this rule.
# You can access the value of the current node's attribute value by: attr_value.
# You can access any attribute x of this node by: this['x'].
# If the constraint relies on attribute values from other nodes,
# use the LHS/NAC constraint instead.
# The given constraint must evaluate to a boolean expression.
#===============================================================================

return True
"""
                self.vs[2]["MT_label__"] = """3"""
                self.vs[2]["MT_dirty__"] = False
                self.vs[2]["mm__"] = """MT_pre__Transition"""
                self.vs[2]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'')
                # match class SIBLING0() node
                self.add_node()
                self.vs[3]["MT_pre__attr1"] = """
#===============================================================================
# This code is executed when evaluating if a node shall be matched by this rule.
# You can access the value of the current node's attribute value by: attr_value.
# You can access any attribute x of this node by: this['x'].
# If the constraint relies on attribute values from other nodes,
# use the LHS/NAC constraint instead.
# The given constraint must evaluate to a boolean expression.
#===============================================================================

return True
"""
                self.vs[3]["MT_label__"] = """4"""
                self.vs[3]["MT_dirty__"] = False
                self.vs[3]["mm__"] = """MT_pre__SIBLING0"""
                self.vs[3]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'')

        # Nodes that represent the edges of the property.
        # match association ExitPoint--outgoingTransitions-->Transition node
                self.add_node()
                self.vs[4]["MT_pre__attr1"] = """
#===============================================================================
# This code is executed when evaluating if a node shall be matched by this rule.
# You can access the value of the current node's attribute value by: attr_value.
# You can access any attribute x of this node by: this['x'].
# If the constraint relies on attribute values from other nodes,
# use the LHS/NAC constraint instead.
# The given constraint must evaluate to a boolean expression.
#===============================================================================

return attr_value == "outgoingTransitions"
"""

                self.vs[4]["MT_label__"] = """5"""
                self.vs[4]["MT_subtypes__"] = []
                self.vs[4]["MT_dirty__"] = False
                self.vs[4]["mm__"] = """MT_pre__directLink_S"""
                self.vs[4]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'assoc4')
        # match association Transition--type-->SIBLING0 node
                self.add_node()
                self.vs[5]["MT_pre__attr1"] = """
#===============================================================================
# This code is executed when evaluating if a node shall be matched by this rule.
# You can access the value of the current node's attribute value by: attr_value.
# You can access any attribute x of this node by: this['x'].
# If the constraint relies on attribute values from other nodes,
# use the LHS/NAC constraint instead.
# The given constraint must evaluate to a boolean expression.
#===============================================================================

return attr_value == "type"
"""

                self.vs[5]["MT_label__"] = """6"""
                self.vs[5]["MT_subtypes__"] = []
                self.vs[5]["MT_dirty__"] = False
                self.vs[5]["mm__"] = """MT_pre__directLink_S"""
                self.vs[5]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'assoc5')
        # match association State--exitPoints-->ExitPoint node
                self.add_node()
                self.vs[6]["MT_pre__attr1"] = """
#===============================================================================
# This code is executed when evaluating if a node shall be matched by this rule.
# You can access the value of the current node's attribute value by: attr_value.
# You can access any attribute x of this node by: this['x'].
# If the constraint relies on attribute values from other nodes,
# use the LHS/NAC constraint instead.
# The given constraint must evaluate to a boolean expression.
#===============================================================================

return attr_value == "exitPoints"
"""

                self.vs[6]["MT_label__"] = """7"""
                self.vs[6]["MT_subtypes__"] = []
                self.vs[6]["MT_dirty__"] = False
                self.vs[6]["mm__"] = """MT_pre__directLink_S"""
                self.vs[6]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'assoc6')

        # Add the edges
                self.add_edges([
                (1,4), # match_class ExitPoint() -> association outgoingTransitions
                (4,2), # association outgoingTransitions  -> match_class Transition()
                (2,5), # match_class Transition() -> association type
                (5,3), # association type  -> match_class SIBLING0()
                (0,6), # match_class State() -> association exitPoints
                (6,1) # association exitPoints  -> match_class ExitPoint()
        ])

                # Add the attribute equations
                self["equations"] = [((0,'isComposite'),('constant','true')), ]

        def eval_attr11(self, attr_value, this):

                #===============================================================================
                # This code is executed when evaluating if a node shall be matched by this rule.
                # You can access the value of the current node's attribute value by: attr_value.
                # You can access any attribute x of this node by: this['x'].
                # If the constraint relies on attribute values from other nodes,
                # use the LHS/NAC constraint instead.
                # The given constraint must evaluate to a boolean expression.
                #===============================================================================

                return True

        def eval_attr12(self, attr_value, this):

                #===============================================================================
                # This code is executed when evaluating if a node shall be matched by this rule.
                # You can access the value of the current node's attribute value by: attr_value.
                # You can access any attribute x of this node by: this['x'].
                # If the constraint relies on attribute values from other nodes,
                # use the LHS/NAC constraint instead.
                # The given constraint must evaluate to a boolean expression.
                #===============================================================================

                return True

        def eval_attr13(self, attr_value, this):

                #===============================================================================
                # This code is executed when evaluating if a node shall be matched by this rule.
                # You can access the value of the current node's attribute value by: attr_value.
                # You can access any attribute x of this node by: this['x'].
                # If the constraint relies on attribute values from other nodes,
                # use the LHS/NAC constraint instead.
                # The given constraint must evaluate to a boolean expression.
                #===============================================================================

                return True

        def eval_attr14(self, attr_value, this):

                #===============================================================================
                # This code is executed when evaluating if a node shall be matched by this rule.
                # You can access the value of the current node's attribute value by: attr_value.
                # You can access any attribute x of this node by: this['x'].
                # If the constraint relies on attribute values from other nodes,
                # use the LHS/NAC constraint instead.
                # The given constraint must evaluate to a boolean expression.
                #===============================================================================

                return True

        def eval_attr15(self, attr_value, this):

                #===============================================================================
                # This code is executed when evaluating if a node shall be matched by this rule.
                # You can access the value of the current node's attribute value by: attr_value.
                # You can access any attribute x of this node by: this['x'].
                # If the constraint relies on attribute values from other nodes,
                # use the LHS/NAC constraint instead.
                # The given constraint must evaluate to a boolean expression.
                #===============================================================================

                return attr_value == "outgoingTransitions"

        def eval_attr16(self, attr_value, this):

                #===============================================================================
                # This code is executed when evaluating if a node shall be matched by this rule.
                # You can access the value of the current node's attribute value by: attr_value.
                # You can access any attribute x of this node by: this['x'].
                # If the constraint relies on attribute values from other nodes,
                # use the LHS/NAC constraint instead.
                # The given constraint must evaluate to a boolean expression.
                #===============================================================================

                return attr_value == "type"

        def eval_attr17(self, attr_value, this):

                #===============================================================================
                # This code is executed when evaluating if a node shall be matched by this rule.
                # You can access the value of the current node's attribute value by: attr_value.
                # You can access any attribute x of this node by: this['x'].
                # If the constraint relies on attribute values from other nodes,
                # use the LHS/NAC constraint instead.
                # The given constraint must evaluate to a boolean expression.
                #===============================================================================

                return attr_value == "exitPoints"

        def constraint(self, PreNode, graph):
                """
                Executable constraint code.
                @param PreNode: Function taking an integer as parameter
                                and returns the node corresponding to that label.
                """
                #===============================================================================
                # This code is executed after the nodes in the LHS have been matched.
                # You can access a matched node labelled n by: PreNode('n').
                # To access attribute x of node n, use: PreNode('n')['x'].
                # The given constraint must evaluate to a boolean expression:
                #    returning True enables the rule to be applied,
                #    returning False forbids the rule from being applied.
                #===============================================================================

                return True


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

//package Model;

/**
 *
 * @author Scott C Gramig
 */
public class OrderItem {
    ProductDB product;
    private int quantity;

    public OrderItem() {
    }
    /**
     * @param product
     * @param quantity
     *
     */
    public OrderItem(ProductDB product, int quantity){
        this.product = product;
        this.quantity = quantity;
    }
    public ProductDB getProduct() {
        return product;
    }

    /**
     * @param product the product to set
     */
    public void setProduct(ProductDB product) {
        this.product = product;
    }

    /**
     * @return the quantity
     */
    public int getQuantity() {
        return quantity;
    }

    /**
     * @param quantity the quantity to set
     */
    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    public double getTotal()
    {
        return product.getPrice()*quantity;
    }

    /**
     * for debugging purposes
     * @return
     */
    @Override
    public String toString() {
        return product + ":" + quantity;
    }
}


text:
package org.apache.tez.dag.app.dag.event;

import org.apache.tez.dag.app.RecoveryParser.RecoveredVertexData;
import org.apache.tez.dag.records.TezVertexID;

public class VertexEventRecoverVertex extends VertexEvent {

  private RecoveredVertexData recoveredVertexData;

  public VertexEventRecoverVertex(TezVertexID vertexId, RecoveredVertexData recoveredVertexData) {
    super(vertexId, VertexEventType.V_RECOVER);
    this.recoveredVertexData = recoveredVertexData;
  }

  public RecoveredVertexData getVertexRecoveryData() {
    return recoveredVertexData;
  }
}


text:
module.exports = 'foo';

done();


text:
package composants.editeurImage;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.AbstractButton;
import javax.swing.JColorChooser;
import javax.swing.JMenuBar;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

import composants.styles.Bouton;

public class MenuEditeurImage extends JMenuBar implements ActionListener, ChangeListener {
	private static final long serialVersionUID = 1L;
	private final AbstractButton valider, quitter,  couleur;
	private final EditeurImage editeur;
	private final PanelDessin dessin;
	private final JSpinner taille;

	public MenuEditeurImage(EditeurImage editeur, PanelDessin dessin) {
		this.editeur = editeur;
		this.dessin = dessin;
		setBackground(Color.DARK_GRAY);
		couleur = new Bouton("Couleur");
		valider = new Bouton("Valider");
		quitter = new Bouton("Fermer");
		taille = new JSpinner(new SpinnerNumberModel(dessin.getTaille(), 1, 50, 1));
		taille.addChangeListener(this);
		couleur.addActionListener(this);
		valider.addActionListener(this);
		quitter.addActionListener(this);
		add(taille);
		add(couleur);
		add(valider);
		add(quitter);
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		if(e.getSource() == valider)
			editeur.modifier();
		else if(e.getSource() == quitter)
			editeur.dispose();
		else if(e.getSource() == couleur)
			dessin.setCouleur(JColorChooser.showDialog(this, "Choisissez une couleur", Color.BLACK));
	}

	@Override
	public void stateChanged(ChangeEvent e) {
		dessin.setTaille((Integer) taille.getValue());
	}

}


text:
package org.kodejava.example.lang;

public class DaemonThread implements Runnable {
    private String threadName;

    private DaemonThread(String threadName) {
        this.threadName = threadName;
    }

    public void run() {
        System.out.println("Running [" + threadName + "]");
    }

    public static void main(String[] args) {
        Thread t1 = new Thread(new DaemonThread("FirstThread"));
        Thread t2 = new Thread(new DaemonThread("SecondThread"));

        // t1 is as daemon thread
        t1.setDaemon(true);
        t1.start();

        // t2 is a user thread
        t2.start();
    }
}


text:
package com.spotify.helios.servicescommon.coordination;

import com.codahale.metrics.health.HealthCheck;
import org.apache.curator.CuratorZookeeperClient;

public class ZooKeeperHealthChecker extends HealthCheck {

  private final CuratorZookeeperClient client;

  public ZooKeeperHealthChecker(final ZooKeeperClient zooKeeperClient) {
    this.client = zooKeeperClient.getCuratorFramework().getZookeeperClient();
  }

  @Override
  protected Result check() throws Exception {
    if (client.isConnected()) {
      return Result.healthy();
    } else {
      return Result.unhealthy("CuratorZookeeperClient reports that it is not connected");
    }
  }
}


text:
/* AUTO-GENERATED FILE.  DO NOT MODIFY.
 *
 * This class was automatically generated by the
 * aapt tool from the resource data it found.  It
 * should not be modified by hand.
 */

package kz.abzaloid.control3dsound;

public final class R {
    public static final class attr {
    }
    public static final class color {
        public static final int background=0x7f050000;
        public static final int bk=0x7f050007;
        public static final int black=0x7f050009;
        public static final int blue=0x7f05000c;
        public static final int control=0x7f050003;
        public static final int desc=0x7f050006;
        public static final int realtime=0x7f050002;
        public static final int red=0x7f050008;
        public static final int salat=0x7f05000b;
        public static final int sound=0x7f050004;
        public static final int title=0x7f050005;
        public static final int violet=0x7f05000a;
        public static final int white=0x7f050001;
    }
    public static final class dimen {
        /**  Default screen margins, per the Android Design guidelines.

         Customize dimensions originally defined in res/values/dimens.xml (such as
         screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.

         */
        public static final int activity_horizontal_margin=0x7f060000;
        public static final int activity_vertical_margin=0x7f060001;
        public static final int main=0x7f060002;
    }
    public static final class drawable {
        public static final int background_gradient=0x7f020000;
        public static final int ic_launcher=0x7f020001;
        public static final int logo=0x7f020002;
        public static final int main_page=0x7f020003;
    }
    public static final class id {
        public static final int LinearLayout1=0x7f090004;
        public static final int LinearLayout2=0x7f090006;
        public static final int RelativeLayout1=0x7f090010;
        public static final int action_settings=0x7f090014;
        public static final int btnStart=0x7f090009;
        public static final int btnStop=0x7f09000a;
        public static final int button1=0x7f090002;
        public static final int button2=0x7f090003;
        public static final int button3=0x7f090008;
        public static final int desc=0x7f090013;
        public static final int filename=0x7f09000b;
        public static final int imageView1=0x7f090007;
        public static final int listView1=0x7f090005;
        public static final int mainLayout=0x7f09000d;
        public static final int monitor=0x7f090011;
        public static final int myLinearLayout=0x7f09000e;
        public static final int seekBar1=0x7f09000f;
        public static final int textView1=0x7f090000;
        public static final int textView2=0x7f090001;
        public static final int title=0x7f090012;
        public static final int warning=0x7f09000c;
    }
    public static final class layout {
        public static final int activity_about=0x7f030000;
        public static final int activity_choose=0x7f030001;
        public static final int activity_instructions=0x7f030002;
        public static final int activity_main=0x7f030003;
        public static final int activity_record=0x7f030004;
        public static final int activity_save_file=0x7f030005;
        public static final int activity_sound_player=0x7f030006;
        public static final int main=0x7f030007;
        public static final int my_list_item=0x7f030008;
    }
    public static final class menu {
        public static final int about=0x7f080000;
        public static final int choose=0x7f080001;
        public static final int instructions=0x7f080002;
        public static final int main=0x7f080003;
        public static final int record=0x7f080004;
        public static final int save_file=0x7f080005;
        public static final int sound_player=0x7f080006;
    }
    public static final class string {
        public static final int List=0x7f04000b;
        public static final int about=0x7f040007;
        public static final int action_settings=0x7f040002;
        public static final int app_info=0x7f04000d;
        public static final int app_name=0x7f040001;
        public static final int author=0x7f040008;
        public static final int hello=0x7f040000;
        public static final int hello_world=0x7f040003;
        public static final int instructions=0x7f040005;
        public static final int myRecords=0x7f04000a;
        public static final int start_recording=0x7f04000e;
        public static final int stop_recording=0x7f04000f;
        public static final int title_activity_about=0x7f040006;
        public static final int title_activity_choose=0x7f040009;
        public static final int title_activity_instructions=0x7f040004;
        public static final int title_activity_record=0x7f040010;
        public static final int title_activity_save_file=0x7f040011;
        public static final int title_activity_sound_player=0x7f04000c;
    }
    public static final class style {
        /**
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.

            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.

         */
        public static final int AppBaseTheme=0x7f070000;
        /**  Application theme.
 All customizations that are NOT specific to a particular API-level can go here.
         */
        public static final int AppTheme=0x7f070001;
    }
}


text:
package org.lwjgl.opengl;

import org.lwjgl.*;

import static org.lwjgl.system.Checks.*;
import static org.lwjgl.system.JNI.*;
import static org.lwjgl.system.MemoryUtil.*;

/**
 * Native bindings to the WGL_NV_DX_interop extension.
 *
 *
This extension allows OpenGL to directly access DirectX buffers and surfaces. A DirectX vertex buffer may be shared as an OpenGL buffer object and a
 * DirectX surface may be shared as an OpenGL texture or renderbuffer object.

 *
 *
Requires {@link GL21 OpenGL 2.1}.

 */
public class WGLNVDXInterop {

	/** Accepted by the {@code access} parameters of {@link #wglDXRegisterObjectNV DXRegisterObjectNV} and {@link #wglDXObjectAccessNV DXObjectAccessNV}. */
	public static final int
		WGL_ACCESS_READ_ONLY_NV     = 0x0,
		WGL_ACCESS_READ_WRITE_NV    = 0x1,
		WGL_ACCESS_WRITE_DISCARD_NV = 0x2;

	protected WGLNVDXInterop() {
		throw new UnsupportedOperationException();
	}

	static boolean isAvailable(WGLCapabilities caps) {
		return checkFunctions(
			caps.wglDXSetResourceShareHandleNV, caps.wglDXOpenDeviceNV, caps.wglDXCloseDeviceNV, caps.wglDXRegisterObjectNV, caps.wglDXUnregisterObjectNV,
			caps.wglDXObjectAccessNV, caps.wglDXLockObjectsNV, caps.wglDXUnlockObjectsNV
		);
	}

	// --- [ wglDXSetResourceShareHandleNV ] ---

	/**
	 *
	 *
	 * @param dxObject    a pointer to the DirectX resource that will be shared
	 * @param shareHandle the share handle that the OS generated for the resource
	 */
	public static boolean wglDXSetResourceShareHandleNV(long dxObject, long shareHandle) {
		long __functionAddress = GL.getCapabilitiesWGL().wglDXSetResourceShareHandleNV;
		if ( CHECKS ) {
			checkFunctionAddress(__functionAddress);
			checkPointer(dxObject);
			checkPointer(shareHandle);
		}
		return callPPI(__functionAddress, dxObject, shareHandle) != 0;
	}

	// --- [ wglDXOpenDeviceNV ] ---

	/**
	 * Prepares a DirectX device for interoperability and returns a handle to a GL/DirectX interop device.
	 *
	 * @param dxDevice a pointer to a supported Direct3D device object
	 */
	public static long wglDXOpenDeviceNV(long dxDevice) {
		long __functionAddress = GL.getCapabilitiesWGL().wglDXOpenDeviceNV;
		if ( CHECKS ) {
			checkFunctionAddress(__functionAddress);
			checkPointer(dxDevice);
		}
		return callPP(__functionAddress, dxDevice);
	}

	// --- [ wglDXCloseDeviceNV ] ---

	public static boolean wglDXCloseDeviceNV(long device) {
		long __functionAddress = GL.getCapabilitiesWGL().wglDXCloseDeviceNV;
		if ( CHECKS ) {
			checkFunctionAddress(__functionAddress);
			checkPointer(device);
		}
		return callPI(__functionAddress, device) != 0;
	}

	// --- [ wglDXRegisterObjectNV ] ---

	/**
	 * Prepares a DirectX object for use by the GL and returns a handle to a GL/DirectX interop object.
	 *
	 * @param device     a GL/DirectX interop device handle, as returned by {@link #wglDXOpenDeviceNV DXOpenDeviceNV}
	 * @param dxResource a pointer to a DirectX resource to be registered with the GL
	 * @param name       the GL object name to be assigned to the DirectX resource in the namespace of the objects identified by {@code type} in the current GL context
	 * @param type       the GL object type that will map to the DirectX resource being shared
	 * @param access     indicates the intended usage of the resource in GL. One of:

{@link #WGL_ACCESS_READ_ONLY_NV ACCESS_READ_ONLY_NV}	{@link #WGL_ACCESS_READ_WRITE_NV ACCESS_READ_WRITE_NV}	{@link #WGL_ACCESS_WRITE_DISCARD_NV ACCESS_WRITE_DISCARD_NV}

	 */
	public static long wglDXRegisterObjectNV(long device, long dxResource, int name, int type, int access) {
		long __functionAddress = GL.getCapabilitiesWGL().wglDXRegisterObjectNV;
		if ( CHECKS ) {
			checkFunctionAddress(__functionAddress);
			checkPointer(device);
			checkPointer(dxResource);
		}
		return callPPP(__functionAddress, device, dxResource, name, type, access);
	}

	// --- [ wglDXUnregisterObjectNV ] ---

	public static boolean wglDXUnregisterObjectNV(long device, long object) {
		long __functionAddress = GL.getCapabilitiesWGL().wglDXUnregisterObjectNV;
		if ( CHECKS ) {
			checkFunctionAddress(__functionAddress);
			checkPointer(device);
			checkPointer(object);
		}
		return callPPI(__functionAddress, device, object) != 0;
	}

	// --- [ wglDXObjectAccessNV ] ---

	/**
	 * Modifies the access mode of an interop object, if a different access mode is required after the object has been registered.
	 *
	 * @param object the GL/DirectX interop object
	 * @param access the new access mode. One of:

{@link #WGL_ACCESS_READ_ONLY_NV ACCESS_READ_ONLY_NV}	{@link #WGL_ACCESS_READ_WRITE_NV ACCESS_READ_WRITE_NV}	{@link #WGL_ACCESS_WRITE_DISCARD_NV ACCESS_WRITE_DISCARD_NV}

	 */
	public static boolean wglDXObjectAccessNV(long object, int access) {
		long __functionAddress = GL.getCapabilitiesWGL().wglDXObjectAccessNV;
		if ( CHECKS ) {
			checkFunctionAddress(__functionAddress);
			checkPointer(object);
		}
		return callPI(__functionAddress, object, access) != 0;
	}

	// --- [ wglDXLockObjectsNV ] ---

	/**
	 * Unsafe version of: {@link #wglDXLockObjectsNV DXLockObjectsNV}
	 *
	 * @param count the number of objects to lock
	 */
	public static int nwglDXLockObjectsNV(long device, int count, long objects) {
		long __functionAddress = GL.getCapabilitiesWGL().wglDXLockObjectsNV;
		if ( CHECKS ) {
			checkFunctionAddress(__functionAddress);
			checkPointer(device);
		}
		return callPPI(__functionAddress, device, count, objects);
	}

	/**
	 * Before a GL object which is associated with a DirectX resource may be used, it must be locked with this function.
	 *
	 *
A return value of TRUE indicates that all objects were successfully locked.  A return value of FALSE indicates an error. If the function returns FALSE,
	 * none of the objects will be locked.

	 *
	 *
Attempting to access an interop object via GL when the object is not locked, or attempting to access the DirectX resource through the DirectX API when
	 * it is locked by GL, will result in undefined behavior and may result in data corruption or program termination. Likewise, passing invalid interop device
	 * or object handles to this function has undefined results, including program termination.

	 *
	 * @param device  the GL/DirectX interop device handle
	 * @param objects an array of {@code count} interop objects
	 */
	public static boolean wglDXLockObjectsNV(long device, PointerBuffer objects) {
		return nwglDXLockObjectsNV(device, objects.remaining(), memAddress(objects)) != 0;
	}

	// --- [ wglDXUnlockObjectsNV ] ---

	/**
	 * Unsafe version of: {@link #wglDXUnlockObjectsNV DXUnlockObjectsNV}
	 *
	 * @param count the number of objects to unlock
	 */
	public static int nwglDXUnlockObjectsNV(long device, int count, long objects) {
		long __functionAddress = GL.getCapabilitiesWGL().wglDXUnlockObjectsNV;
		if ( CHECKS ) {
			checkFunctionAddress(__functionAddress);
			checkPointer(device);
		}
		return callPPI(__functionAddress, device, count, objects);
	}

	/**
	 * Return control of an object to DirectX.
	 *
	 * @param device  the GL/DirectX interop device handle
	 * @param objects an array of {@code count} interop objects
	 */
	public static boolean wglDXUnlockObjectsNV(long device, PointerBuffer objects) {
		return nwglDXUnlockObjectsNV(device, objects.remaining(), memAddress(objects)) != 0;
	}

}


text:
 Web page by Jeremy Robin</h1

 this page is about the Boston Bruins

 This is the logo of the Boston Bruins

 NHL.com
<h8 align=left> In 2013 the Bruins made it to the finals in stanley cup playoffs but lost to Chicago</h8>

 Most of the players on the Boston Bruins are not from Boston.</h9>

 some of them are even from Canada</h10>

<h13 align=left> Game Stats, Wins-28, losses-14, OT losses-6, Points-62

<input id="mybutton" type=button value="Game" style=" position:absolute;top:400px;left:350px" onclick= "document.all.mybutton.style.pixelLeft+=10">
<input id="mybuttonleft" type=button value="go left" style=" position:absolute;top:75px;left:220px" onclick= "document.all.mybutton.style.pixelLeft-=10">
<input id="mybuttonup" type=button value="go up" style=" position:absolute;top:60px;left:255px" onclick= "document.all.mybutton.style.pixelTop-=10">
<input id="mybuttondown" type=button value="go down" style=" position:absolute;top:95px;left:243px" onclick= "document.all.mybutton.style.pixelTop+=10">
<input id="mybuttonright" type=button value="go right" style=" position:absolute;top:75px;left:300px" onclick= "document.all.mybutton.style.pixelLeft+=10">


text:
@*
 * Copyright 2022 HM Revenue & Customs
 *
 * 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.
 *@

@this(input: Input, dropdown: Dropdown)

@(formItem:Form[_],
  fieldName: String,
  label: Html,
  args: (Symbol,Any)*
)(implicit messages: Messages)

@import uk.gov.hmrc.play.mappers.DateFields._
@import uk.gov.hmrc.play.mappers.DateFormatSymbols._

@dayElem = @{fieldName + "." + day}
@dropdown(
        formItem(dayElem),
        ( 1 to 31) map {  i=> (i.toString, i.toString) },
        displayEmptyValue = true,
        '_label -> Messages("date.fields.day"),
        '_labelClass -> "label--inlineDropdown form-field--inline",
        '_emptyValueText -> " "
)
@monthElem = @{fieldName + "." + month}
@dropdown(
        formItem(monthElem),
        monthsWithIndexes,
        displayEmptyValue = true,
        '_label -> Messages("date.fields.month"),
        '_labelClass -> "label--inlineDropdown form-field--inline",
        '_emptyValueText -> " "
)
@yearElem = @{fieldName + "." + year}
@input(
        formItem(yearElem),
        '_label -> Messages("date.fields.year"),
        '_labelClass -> "label--inlineTextinput form-field--inline-text-input",
        '_inputClass -> "input--xsmall",
        '_emptyValueText -> " "
)


text:
function Walker(legs) {
	if (isNaN(legs)) {
		throw new Error('The legs provided is not a number');
	}
	if (legs === 0) {
		throw new Error('The legs provided is less than zero');
	}
	if ((legs % 2) !== 0) {
		throw new Error('The legs provided is an odd number');
	}
	this._legs = legs;
	this._steps = 0;
}

Walker.prototype.getLegs = function() {
	return this._legs;
};

Walker.prototype.getSteps = function() {
	return this._steps;
};

Walker.prototype.walk = function() {
	this._steps += 1;
};

module.exports = Walker;


text:
#
#
# /* See http://www.boost.org for most recent version. */
#
# ifndef MSGPACK_PREPROCESSOR_SEQ_FILTER_HPP
# define MSGPACK_PREPROCESSOR_SEQ_FILTER_HPP
#
# include <msgpack/preprocessor/config/config.hpp>
# include <msgpack/preprocessor/control/expr_if.hpp>
# include <msgpack/preprocessor/facilities/empty.hpp>
# include <msgpack/preprocessor/seq/fold_left.hpp>
# include <msgpack/preprocessor/seq/seq.hpp>
# include <msgpack/preprocessor/tuple/elem.hpp>
# include <msgpack/preprocessor/tuple/rem.hpp>
#
# /* MSGPACK_PP_SEQ_FILTER */
#
# if ~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_EDG()
#    define MSGPACK_PP_SEQ_FILTER(pred, data, seq) MSGPACK_PP_SEQ_TAIL(MSGPACK_PP_TUPLE_ELEM(3, 2, MSGPACK_PP_SEQ_FOLD_LEFT(MSGPACK_PP_SEQ_FILTER_O, (pred, data, (nil)), seq)))
# else
#    define MSGPACK_PP_SEQ_FILTER(pred, data, seq) MSGPACK_PP_SEQ_FILTER_I(pred, data, seq)
#    define MSGPACK_PP_SEQ_FILTER_I(pred, data, seq) MSGPACK_PP_SEQ_TAIL(MSGPACK_PP_TUPLE_ELEM(3, 2, MSGPACK_PP_SEQ_FOLD_LEFT(MSGPACK_PP_SEQ_FILTER_O, (pred, data, (nil)), seq)))
# endif
#
# if MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_STRICT()
#    define MSGPACK_PP_SEQ_FILTER_O(s, st, elem) MSGPACK_PP_SEQ_FILTER_O_IM(s, MSGPACK_PP_TUPLE_REM_3 st, elem)
#    define MSGPACK_PP_SEQ_FILTER_O_IM(s, im, elem) MSGPACK_PP_SEQ_FILTER_O_I(s, im, elem)
# else
#    define MSGPACK_PP_SEQ_FILTER_O(s, st, elem) MSGPACK_PP_SEQ_FILTER_O_I(s, MSGPACK_PP_TUPLE_ELEM(3, 0, st), MSGPACK_PP_TUPLE_ELEM(3, 1, st), MSGPACK_PP_TUPLE_ELEM(3, 2, st), elem)
# endif
#
# if ~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_DMC()
#   define MSGPACK_PP_SEQ_FILTER_O_I(s, pred, data, res, elem) (pred, data, res MSGPACK_PP_EXPR_IF(pred(s, data, elem), (elem)))
# else
#   define MSGPACK_PP_SEQ_FILTER_O_I(s, pred, data, res, elem) (pred, data, res MSGPACK_PP_EXPR_IF(pred##(s, data, elem), (elem)))
# endif
#
# /* MSGPACK_PP_SEQ_FILTER_S */
#
# if ~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_EDG()
#    define MSGPACK_PP_SEQ_FILTER_S(s, pred, data, seq) MSGPACK_PP_SEQ_TAIL(MSGPACK_PP_TUPLE_ELEM(3, 2, MSGPACK_PP_SEQ_FOLD_LEFT_ ## s(MSGPACK_PP_SEQ_FILTER_O, (pred, data, (nil)), seq)))
# else
#    define MSGPACK_PP_SEQ_FILTER_S(s, pred, data, seq) MSGPACK_PP_SEQ_FILTER_S_I(s, pred, data, seq)
#    define MSGPACK_PP_SEQ_FILTER_S_I(s, pred, data, seq) MSGPACK_PP_SEQ_TAIL(MSGPACK_PP_TUPLE_ELEM(3, 2, MSGPACK_PP_SEQ_FOLD_LEFT_ ## s(MSGPACK_PP_SEQ_FILTER_O, (pred, data, (nil)), seq)))
# endif
#
# endif


text:
[#]: subject: (Write your first JavaScript code)
[#]: via: (https://opensource.com/article/21/7/javascript-cheat-sheet)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
[#]: collector: (lujun9972)
[#]: translator: (lixin555)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

Write your first JavaScript code
======
JavaScript was created for the web, but it can do so much more. Learn
the basics, then download our cheat sheet so you always have the details
at hand.
![Code with javascript on white background][1]

JavaScript is a programming language full of pleasant surprises. Many people first encounter JavaScript as a language for the web. There's a JavaScript engine in all the major browsers, there are popular frameworks such as JQuery, Cash, and Bootstrap to help make web design easier, and there are even programming environments written in JavaScript. It seems to be everywhere on the internet, but it turns out that it's also a useful language for projects like [Electron][2], an open source toolkit for building cross-platform desktop apps with JavaScript.

JavaScript is a surprisingly multipurpose language with a wide assortment of libraries for much more than just making websites. Learning the basics of the language is easy, and it's a gateway to building whatever you imagine.

### Install JavaScript

As you progress with JavaScript, you may find yourself wanting advanced JavaScript libraries and runtimes. When you're just starting, though, you don't have to install JavaScript at all. All major web browsers include a JavaScript engine to run the code. You can write JavaScript using your favorite text editor, load it into your web browser, and see what your code does.

### Get started with JavaScript

To write your first JavaScript code, open your favorite text editor, such as [Notepad++][3], [Atom][4], or [VSCode][5]. Because it was developed for the web, JavaScript works well with HTML, so first, just try some basic HTML:

```
<[html][6]>
  <[head][7]>
    <[title][8]>JS</[title][8]>
  </[head][7]>
  <[body][9]>
    <[p][10] id="example">Nothing here.</[p][10]>
  </[body][9]>
</[html][6]>
```

Save the file, and then open it in a web browser.

![HTML displayed in browser][11]

(Seth Kenlon, [CC BY-SA 4.0][12])

To add JavaScript to this simple HTML page, you can either create a JavaScript file and refer to it in the page's `head` or just embed your JavaScript code in the HTML using the `<script>` tag. In this example, I embed the code:

```
<[html][6]>
  <[head][7]>
    <[title][8]>JS</[title][8]>
  </[head][7]>
  <[body][9]>
    <[p][10] id="example">Nothing here.</[p][10]>

    <[script][13]>
      let myvariable = "Hello world!";

      document.getElementById("example").innerHTML = myvariable;
    </[script][13]>

  </[body][9]>
</[html][6]>
```

Reload the page in your browser.

![HTML with JavaScript displayed in browser][14]

(Seth Kenlon, [CC BY-SA 4.0][12])

As you can see, the `<p>` tag as written still contains the string "Nothing here," but when it's rendered, JavaScript alters it so that it contains "Hello world" instead. Yes, JavaScript has the power to rebuild (or just help build) a webpage.

The JavaScript in this simple script does two things. First, it creates a variable called `myvariable` and places the string "Hello world!" into it. Finally, it searches the current document (the web page as the browser is rendering it) for any HTML element with the ID `example`. When it locates `example`, it uses the `innerHTML` function to replace the contents of the HTML element with the contents of `myvariable`.

Of course, using a custom variable isn't necessary. It's just as easy to populate the HTML element with something being dynamically created. For instance, you could populate it with a timestamp:

```
<[html][6]>
  <[head][7]>
    <[title][8]>JS</[title][8]>
  </[head][7]>
  <[body][9]>
    <[p][10] id="example">Date and time appears here.</[p][10]>

    <[script][13]>
      document.getElementById("example").innerHTML = Date();
    </[script][13]>

  </[body][9]>
</[html][6]>
```

Reload the page to see a timestamp generated at the moment the page is rendered. Reload a few times to watch the seconds increment.

### JavaScript syntax

In programming, **syntax** refers to the rules of how sentences (or "lines") are written. In JavaScript, each line of code must end in a semicolon (`;`) so that the JavaScript engine running your code understands when to stop reading.

Words (or "strings") must be enclosed in quotation marks (`"`), while numbers (or "integers") go without.

Almost everything else is a convention of the JavaScript language, such as variables, arrays, conditional statements, objects, functions, and so on.

### Creating variables in JavaScript

Variables are containers for data. You can think of a variable as a box where you can put data to share with your program. Creating a variable in JavaScript is done with two keywords you choose based on how you intend to use the variable: `let` and `var`. The `var` keyword denotes a variable intended for your entire program to use, while `let` creates variables for specific purposes, usually inside functions or loops.

JavaScript's built-in `typeof` function can help you identify what kind of data a variable contains. Using the first example, you can find out what kind of data `myvariable` contains by modifying the displayed text to:

```
<string>
let myvariable = "Hello world!";
document.getElementById("example").innerHTML = typeof(myvariable);
</string>
```

This renders "string" in your web browser because the variable contains "Hello world!" Storing different kinds of data (such as an integer) in `myvariable` would cause a different data type to be printed to your sample web page. Try changing the contents of `myvariable` to your favorite number and then reloading the page.

### Creating functions in JavaScript

Functions in programming are self-contained data processors. They're what makes programming _modular_. It's because functions exist that programmers can write generic libraries that, for instance, resize images or keep track of the passage of time for other programmers (like you) to use in their own code.

You create a function by providing a custom name for your function followed by any amount of code enclosed within braces.

Here's a simple web page featuring a resized image and a button that analyzes the image and returns the true image dimensions. In this example code, the `<button>` HTML element uses the built-in JavaScript function `onclick` to detect user interaction, which triggers a custom function called `get_size`:

```
<[html][6]>
  <[head][7]>
    <[title][8]>Imager</[title][8]>
  </[head][7]>
  <[body][9]>

    <[div][15]>
      <[button][16] onclick="get_size(document.getElementById('myimg'))">
        Get image size
    </[button][16]>
    </[div][15]>

    <[div][15]>
      <[img][17] style="width: 15%" id="myimg" src="penguin.png" />
    </[div][15]>

    <[script][13]>
      function get_size(i) {
        let w = i.naturalWidth;
        let h = i.naturalHeight;
        alert(w + " by " + h);
      }
    </[script][13]>

  </[body][9]>
</[html][6]>
```

Save the file and load it into your web browser to try the code.

![Custom get_size function returns image dimensions][18]

(Seth Kenlon, [CC BY-SA 4.0][12])

### Cross-platform apps with JavaScript

You can see from the code sample how JavaScript and HTML work closely together to create a cohesive user experience. This is one of the great strengths of JavaScript. When you write code in JavaScript, you inherit one of the most common user interfaces of modern computing regardless of platform: the web browser. Your code is cross-platform by nature, so your application, whether it's just a humble image size analyzer or a complex image editor, video game, or whatever else you dream up, can be used by everyone with a web browser (or a desktop, if you deliver an Electron app).

Learning JavaScript is easy and fun. There are lots of websites with tutorials available. There are also over a million JavaScript libraries to help you interface with devices, peripherals, the Internet of Things, servers, file systems, and lots more. And as you're learning, keep our [**JavaScript cheat sheet**][19] close by so you remember the fine details of syntax and structure.

--------------------------------------------------------------------------------

via: https://opensource.com/article/21/7/javascript-cheat-sheet

作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[lixin555](https://github.com/lixin555)
校对:[校对者ID](https://github.com/校对者ID)

本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code2.png?itok=JCJTJszs (Code with javascript on white background)
[2]: https://www.electronjs.org/
[3]: https://opensource.com/article/16/12/notepad-text-editor
[4]: https://opensource.com/article/20/12/atom
[5]: https://opensource.com/article/20/6/open-source-alternatives-vs-code
[6]: http://december.com/html/4/element/html.html
[7]: http://december.com/html/4/element/head.html
[8]: http://december.com/html/4/element/title.html
[9]: http://december.com/html/4/element/body.html
[10]: http://december.com/html/4/element/p.html
[11]: https://opensource.com/sites/default/files/pictures/plain-html.jpg (HTML displayed in browser)
[12]: https://creativecommons.org/licenses/by-sa/4.0/
[13]: http://december.com/html/4/element/script.html
[14]: https://opensource.com/sites/default/files/uploads/html-javascript.jpg (HTML with JavaScript displayed in browser)
[15]: http://december.com/html/4/element/div.html
[16]: http://december.com/html/4/element/button.html
[17]: http://december.com/html/4/element/img.html
[18]: https://opensource.com/sites/default/files/uploads/get-size.jpg (Custom get_size function returns image dimensions)
[19]: https://opensource.com/downloads/javascript-cheat-sheet


text:
package asyncassertion_test

import (
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"testing"
)

func TestAsyncAssertion(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "AsyncAssertion Suite")
}


text:
package io.quarkus.agroal.test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.runtime.configuration.ConfigurationException;
import io.quarkus.test.QuarkusUnitTest;

public class XaRequiresXaDatasourceTest {

    @RegisterExtension
    static final QuarkusUnitTest config = new QuarkusUnitTest()
            .withConfigurationResource("base.properties")
            .overrideConfigKey("quarkus.datasource.jdbc.driver", "org.h2.Driver")
            .overrideConfigKey("quarkus.datasource.jdbc.transactions", "XA")
            .assertException(t -> {
                assertEquals(ConfigurationException.class, t.getClass());
            });

    @Test
    public void xaRequiresJta() {
        //Should not be reached: verify
        assertTrue(false);
    }

}


text:
package io.shiftleft.java2cpg.testcode.methods;

import java.util.ArrayList;
import java.util.List;

public class MethodTest {

  public static int staticMethod(int var) {
    return var;
  }

  public int nonStaticMethod(int var) {
    return var;
  }

  public int annotatedFunction(int var) {
    return var;
  }

  public void lambdaUser() {
    int capturedValue = 3;
    List<Integer> someStream = new ArrayList<>();
    someStream.stream().map(x -> capturedValue + x);
  }

  public String callsExternalMethod() {
    return super.toString();
  }

  private String internalMethod() {
    return "";
  }

  public String callsNoExternalMethod() {
    return internalMethod();
  }

}


text:
use wasm_bindgen::prelude::*;
use js_sys::{Object, Promise};
use crate::Event;
use crate::tabs::Tab;
use crate::windows::Window;

#[wasm_bindgen]
extern "C" {
    #[derive(Debug)]
    pub type Session;

    #[wasm_bindgen(method, getter, js_name = lastModified)]
    pub fn last_modified(this: &Session) -> f64;

    #[wasm_bindgen(method, getter)]
    pub fn tab(this: &Session) -> Option<Tab>;

    #[wasm_bindgen(method, getter)]
    pub fn window(this: &Session) -> Option<Window>;
}

#[wasm_bindgen]
extern "C" {
    pub type Sessions;

    #[wasm_bindgen(method, getter, js_name = MAX_SESSION_RESULTS)]
    // TODO is u32 correct ?
    pub fn max_session_results(this: &Sessions) -> u32;

    #[wasm_bindgen(method, js_name = forgetClosedTab)]
    pub fn forget_closed_tab(this: &Sessions, window_id: i32, session_id: &str) -> Promise;

    #[wasm_bindgen(method, js_name = forgetClosedWindow)]
    pub fn forget_closed_window(this: &Sessions, session_id: &str) -> Promise;

    #[wasm_bindgen(method, js_name = getRecentlyClosed)]
    pub fn get_recently_closed(this: &Sessions, filter: Option<&Object>) -> Promise;

    #[wasm_bindgen(method)]
    pub fn restore(this: &Sessions, session_id: &str) -> Promise;

    #[wasm_bindgen(method, js_name = getTabValue)]
    pub fn get_tab_value(this: &Sessions, tab_id: i32, key: &str) -> Promise;

    #[wasm_bindgen(method, js_name = setTabValue)]
    pub fn set_tab_value(this: &Sessions, tab_id: i32, key: &str, value: &JsValue) -> Promise;

    #[wasm_bindgen(method, js_name = removeTabValue)]
    pub fn remove_tab_value(this: &Sessions, tab_id: i32, key: &str) -> Promise;

    #[wasm_bindgen(method, js_name = getWindowValue)]
    pub fn get_window_value(this: &Sessions, window_id: i32, key: &str) -> Promise;

    #[wasm_bindgen(method, js_name = setWindowValue)]
    pub fn set_window_value(this: &Sessions, window_id: i32, key: &str, value: &JsValue) -> Promise;

    #[wasm_bindgen(method, js_name = removeWindowValue)]
    pub fn remove_window_value(this: &Sessions, window_id: i32, key: &str) -> Promise;

    #[wasm_bindgen(method, getter, js_name = onChanged)]
    pub fn on_changed(this: &Sessions) -> Event;
}


text:
package com.xiaogua.better.basic;

import java.util.ArrayList;
import java.util.List;

import org.junit.Test;

import com.xiaogua.better.bean.Class_With_Annotation;

public class TestAnnotationCode {

	@Test
	public void testGetAllAnnotation() throws Exception {
		List<Class<?>> rtnList = new ArrayList<Class<?>>();
		AnnotationCode.getAllAnnotation(Class_With_Annotation.class, rtnList);
		System.out.println(rtnList);
	}
}


text:
@interface GDFocusPageModel : NSObject
@property (nonatomic, strong) NSString *imageUrl;   //image的url,来源于web时是全路径,来源本地是图片名称
@property (nonatomic, strong) NSString *title;      //image的标题
@property (nonatomic, assign) BOOL showTitle;       //是否显示标题
@property (nonatomic, assign) BOOL isLocalSrc;      //是否来源于本地资源
@end


text: Some kinds of elements developed by javascript


text:
class Question < ActiveRecord::Base
  has_one :customer_questionship
  has_one :customer, :through => :customer_questionship

  has_one :faultdesc_questionship
  has_one :faultdesc, :through => :faultdesc_questionship

  has_many :car_buying_questionships
  has_many :car_buyings, :through => :car_buying_questionships

  has_many :part_buying_questionships
  has_many :part_buyings, :through => :part_buying_questionships

  has_many :complaint_questionships
  has_many :complaints, :through => :complaint_questionships

  has_many :consulting_questionships
  has_many :consultings, :through => :consulting_questionships
end


text:
namespace google {
namespace protobuf {
namespace compiler {
namespace javamicro {

const char kThickSeparator[] =
  "// ===================================================================\n";
const char kThinSeparator[] =
  "// -------------------------------------------------------------------\n";

namespace {

const char* kDefaultPackage = "";

const string& FieldName(const FieldDescriptor* field) {
  // Groups are hacky:  The name of the field is just the lower-cased name
  // of the group type.  In Java, though, we would like to retain the original
  // capitalization of the type name.
  if (field->type() == FieldDescriptor::TYPE_GROUP) {
    return field->message_type()->name();
  } else {
    return field->name();
  }
}

string UnderscoresToCamelCaseImpl(const string& input, bool cap_next_letter) {
  string result;
  // Note:  I distrust ctype.h due to locales.
  for (int i = 0; i < input.size(); i++) {
    if ('a' <= input[i] && input[i] <= 'z') {
      if (cap_next_letter) {
        result += input[i] + ('A' - 'a');
      } else {
        result += input[i];
      }
      cap_next_letter = false;
    } else if ('A' <= input[i] && input[i] <= 'Z') {
      if (i == 0 && !cap_next_letter) {
        // Force first letter to lower-case unless explicitly told to
        // capitalize it.
        result += input[i] + ('a' - 'A');
      } else {
        // Capital letters after the first are left as-is.
        result += input[i];
      }
      cap_next_letter = false;
    } else if ('0' <= input[i] && input[i] <= '9') {
      result += input[i];
      cap_next_letter = true;
    } else {
      cap_next_letter = true;
    }
  }
  return result;
}

}  // namespace

string UnderscoresToCamelCase(const FieldDescriptor* field) {
  return UnderscoresToCamelCaseImpl(FieldName(field), false);
}

string UnderscoresToCapitalizedCamelCase(const FieldDescriptor* field) {
  return UnderscoresToCamelCaseImpl(FieldName(field), true);
}

string UnderscoresToCamelCase(const MethodDescriptor* method) {
  return UnderscoresToCamelCaseImpl(method->name(), false);
}

string StripProto(const string& filename) {
  if (HasSuffixString(filename, ".protodevel")) {
    return StripSuffixString(filename, ".protodevel");
  } else {
    return StripSuffixString(filename, ".proto");
  }
}

string FileClassName(const Params& params, const FileDescriptor* file) {
  if (params.has_java_outer_classname(file->name())) {
    return params.java_outer_classname(file->name());
  } else {
    // Use the filename itself with underscores removed
    // and a CamelCase style name.
    string basename;
    string::size_type last_slash = file->name().find_last_of('/');
    if (last_slash == string::npos) {
      basename = file->name();
    } else {
      basename = file->name().substr(last_slash + 1);
    }
    return UnderscoresToCamelCaseImpl(StripProto(basename), true);
  }
}

string FileJavaPackage(const Params& params, const FileDescriptor* file) {
  if (params.has_java_package(file->name())) {
    return params.java_package(file->name());
  } else {
    string result = kDefaultPackage;
    if (!file->package().empty()) {
      if (!result.empty()) result += '.';
      result += file->package();
    }
    return result;
  }
}

bool IsOuterClassNeeded(const Params& params, const FileDescriptor* file) {
  // Enums and extensions need the outer class as the scope.
  if (file->enum_type_count() != 0 || file->extension_count() != 0) {
    return true;
  }
  // Messages need the outer class only if java_multiple_files is false.
  return !params.java_multiple_files(file->name());
}

string ToJavaName(const Params& params, const string& name, bool is_class,
    const Descriptor* parent, const FileDescriptor* file) {
  string result;
  if (parent != NULL) {
    result.append(ClassName(params, parent));
  } else if (is_class && params.java_multiple_files(file->name())) {
    result.append(FileJavaPackage(params, file));
  } else {
    result.append(ClassName(params, file));
  }
  if (!result.empty()) result.append(1, '.');
  result.append(name); // TODO(maxtroy): add '_' if name is a Java keyword.
  return result;
}

string ClassName(const Params& params, const FileDescriptor* descriptor) {
  string result = FileJavaPackage(params, descriptor);
  if (!result.empty()) result += '.';
  result += FileClassName(params, descriptor);
  return result;
}

string ClassName(const Params& params, const EnumDescriptor* descriptor) {
  // An enum's class name is the enclosing message's class name or the outer
  // class name.
  const Descriptor* parent = descriptor->containing_type();
  if (parent != NULL) {
    return ClassName(params, parent);
  } else {
    return ClassName(params, descriptor->file());
  }
}

string FieldConstantName(const FieldDescriptor *field) {
  string name = field->name() + "_FIELD_NUMBER";
  UpperString(&name);
  return name;
}

JavaType GetJavaType(FieldDescriptor::Type field_type) {
  switch (field_type) {
    case FieldDescriptor::TYPE_INT32:
    case FieldDescriptor::TYPE_UINT32:
    case FieldDescriptor::TYPE_SINT32:
    case FieldDescriptor::TYPE_FIXED32:
    case FieldDescriptor::TYPE_SFIXED32:
      return JAVATYPE_INT;

    case FieldDescriptor::TYPE_INT64:
    case FieldDescriptor::TYPE_UINT64:
    case FieldDescriptor::TYPE_SINT64:
    case FieldDescriptor::TYPE_FIXED64:
    case FieldDescriptor::TYPE_SFIXED64:
      return JAVATYPE_LONG;

    case FieldDescriptor::TYPE_FLOAT:
      return JAVATYPE_FLOAT;

    case FieldDescriptor::TYPE_DOUBLE:
      return JAVATYPE_DOUBLE;

    case FieldDescriptor::TYPE_BOOL:
      return JAVATYPE_BOOLEAN;

    case FieldDescriptor::TYPE_STRING:
      return JAVATYPE_STRING;

    case FieldDescriptor::TYPE_BYTES:
      return JAVATYPE_BYTES;

    case FieldDescriptor::TYPE_ENUM:
      return JAVATYPE_ENUM;

    case FieldDescriptor::TYPE_GROUP:
    case FieldDescriptor::TYPE_MESSAGE:
      return JAVATYPE_MESSAGE;

    // No default because we want the compiler to complain if any new
    // types are added.
  }

  GOOGLE_LOG(FATAL) << "Can't get here.";
  return JAVATYPE_INT;
}

const char* BoxedPrimitiveTypeName(JavaType type) {
  switch (type) {
    case JAVATYPE_INT    : return "java.lang.Integer";
    case JAVATYPE_LONG   : return "java.lang.Long";
    case JAVATYPE_FLOAT  : return "java.lang.Float";
    case JAVATYPE_DOUBLE : return "java.lang.Double";
    case JAVATYPE_BOOLEAN: return "java.lang.Boolean";
    case JAVATYPE_STRING : return "java.lang.String";
    case JAVATYPE_BYTES  : return "com.google.protobuf.micro.ByteStringMicro";
    case JAVATYPE_ENUM   : return "java.lang.Integer";
    case JAVATYPE_MESSAGE: return NULL;

    // No default because we want the compiler to complain if any new
    // JavaTypes are added.
  }

  GOOGLE_LOG(FATAL) << "Can't get here.";
  return NULL;
}

bool AllAscii(const string& text) {
  for (int i = 0; i < text.size(); i++) {
    if ((text[i] & 0x80) != 0) {
      return false;
    }
  }
  return true;
}

string DefaultValue(const Params& params, const FieldDescriptor* field) {
  // Switch on cpp_type since we need to know which default_value_* method
  // of FieldDescriptor to call.
  switch (field->cpp_type()) {
    case FieldDescriptor::CPPTYPE_INT32:
      return SimpleItoa(field->default_value_int32());
    case FieldDescriptor::CPPTYPE_UINT32:
      // Need to print as a signed int since Java has no unsigned.
      return SimpleItoa(static_cast<int32>(field->default_value_uint32()));
    case FieldDescriptor::CPPTYPE_INT64:
      return SimpleItoa(field->default_value_int64()) + "L";
    case FieldDescriptor::CPPTYPE_UINT64:
      return SimpleItoa(static_cast<int64>(field->default_value_uint64())) +
             "L";
    case FieldDescriptor::CPPTYPE_DOUBLE: {
     double value = field->default_value_double();
      if (value == numeric_limits<double>::infinity()) {
        return "Double.POSITIVE_INFINITY";
      } else if (value == -numeric_limits<double>::infinity()) {
        return "Double.NEGATIVE_INFINITY";
      } else if (value != value) {
        return "Double.NaN";
      } else {
        return SimpleDtoa(value) + "D";
      }
    }
    case FieldDescriptor::CPPTYPE_FLOAT: {
      float value = field->default_value_float();
      if (value == numeric_limits<float>::infinity()) {
        return "Float.POSITIVE_INFINITY";
      } else if (value == -numeric_limits<float>::infinity()) {
        return "Float.NEGATIVE_INFINITY";
      } else if (value != value) {
        return "Float.NaN";
      } else {
        return SimpleFtoa(value) + "F";
      }
    }
    case FieldDescriptor::CPPTYPE_BOOL:
      return field->default_value_bool() ? "true" : "false";
    case FieldDescriptor::CPPTYPE_STRING:
      if (field->type() == FieldDescriptor::TYPE_BYTES) {
        if (field->has_default_value()) {
          // See comments in Internal.java for gory details.
          return strings::Substitute(
            "com.google.protobuf.micro.ByteStringMicro.copyFromUtf8(\"$0\")",
            CEscape(field->default_value_string()));
        } else {
          return "com.google.protobuf.micro.ByteStringMicro.EMPTY";
        }
      } else {
        if (AllAscii(field->default_value_string())) {
          // All chars are ASCII.  In this case CEscape() works fine.
          return "\"" + CEscape(field->default_value_string()) + "\"";
        } else {
          // See comments in Internal.java for gory details.
          // BUG: Internal NOT SUPPORTED need to fix!!
          return strings::Substitute(
            "com.google.protobuf.micro.Internal.stringDefaultValue(\"$0\")",
            CEscape(field->default_value_string()));
        }
      }

    case FieldDescriptor::CPPTYPE_ENUM:
      return ClassName(params, field->enum_type()) + "." +
             field->default_value_enum()->name();

    case FieldDescriptor::CPPTYPE_MESSAGE:
      return ClassName(params, field->message_type()) + ".getDefaultInstance()";

    // No default because we want the compiler to complain if any new
    // types are added.
  }

  GOOGLE_LOG(FATAL) << "Can't get here.";
  return "";
}

}  // namespace javamicro
}  // namespace compiler
}  // namespace protobuf
}  // namespace google


text:
cask "ueli" do
  version "8.13.0"
  sha256 "c0a0a1dceeeba87bd99422621046de9b5b0b9efc3edaf2e57e691c8a71fb5554"

  url "https://github.com/oliverschwendener/ueli/releases/download/v#{version}/ueli-#{version}.dmg",
      verified: "github.com/oliverschwendener/ueli/"
  name "Ueli"
  desc "Keystroke launcher"
  homepage "https://ueli.app/"

  livecheck do
    url :url
    strategy :github_latest
  end

  app "ueli.app"

  uninstall quit: "ueli"

  zap trash: [
    "~/Library/Logs/ueli",
    "~/Library/Application Support/ueli",
    "~/Library/Preferences/com.electron.ueli.plist",
  ]
end


text:
require 'github/markup'
require 'pygments'
require 'html/pipeline'

module Octodown
  module Renderer
    class GithubMarkdown
      attr_reader :content, :document_root, :gfm

      def initialize(content, document_root, options = {})
        @content = content
        @document_root = document_root
        @gfm = options[:gfm] || false
      end

      def to_html
        pipeline.call(content)[:output].to_s
      end

      private

      def context
        {
          :asset_root => 'https://assets-cdn.github.com/images/icons/',
          :original_document_root => document_root
        }
      end

      def pipeline
        ::HTML::Pipeline.new [
          ::HTML::Pipeline::MarkdownFilter,
          ::Octodown::Support::RelativeRootFilter,
          ::HTML::Pipeline::SanitizationFilter,
          ::HTML::Pipeline::ImageMaxWidthFilter,
          ::HTML::Pipeline::MentionFilter,
          ::HTML::Pipeline::EmojiFilter,
          ::HTML::Pipeline::SyntaxHighlightFilter
        ], context.merge(:gfm => gfm)
      end
    end
  end
end