text:
<!DOCTYPE html>

<link rel="stylesheet" href="../style.css"/>

Processing.js

AdditiveWave

by Daniel Shiffman.

Create a more complex wave by adding two waves together.

Original Processing.org Example: AdditiveWave

<canvas width="200" height="200"></canvas>

// All Examples Written by Casey Reas and Ben Fry
// unless otherwise stated.
int xspacing = 8;   // How far apart should each horizontal location be spaced
int w;              // Width of entire wave
int maxwaves = 4;   // total # of waves to add together

float theta = 0.0f;
float[] amplitude = new float[maxwaves];   // Height of wave
float[] dx = new float[maxwaves];          // Value for incrementing X, to be calculated as a function of period and xspacing
float[] yvalues;                           // Using an array to store height values for the wave (not entirely necessary)

void setup() {
  size(200,200);
  frameRate(30);
  colorMode(RGB,255,255,255,100);
  smooth();
  w = width+16;

  for (int i = 0; i < maxwaves; i++) {
    amplitude[i] = random(10,30);
    float period = random(100,300); // How many pixels before the wave repeats
    dx[i] = (TWO_PI / period) * xspacing;
  }

  yvalues = new float[w/xspacing];
}

void draw() {
  background(0);
  calcWave();
  renderWave();
}

void calcWave() {
  // Increment theta (try different values for 'angular velocity' here
  theta += 0.02;

  // Set all height values to zero
  for (int i = 0; i < yvalues.length; i++) {
    yvalues[i] = 0.0f;
  }

  // Accumulate wave height values
  for (int j = 0; j < maxwaves; j++) {
    float x = theta;
    for (int i = 0; i < yvalues.length; i++) {
      // Every other wave is cosine instead of sine
      if (j % 2 == 0)  yvalues[i] += sin(x)*amplitude[j];
      else yvalues[i] += cos(x)*amplitude[j];
      x+=dx[j];
    }
  }
}

void renderWave() {
  // A simple way to draw the wave with an ellipse at each location
  noStroke();
  fill(255,50);
  ellipseMode(CENTER);
  for (int x = 0; x < yvalues.length; x++) {
    ellipse(x*xspacing,width/2+yvalues[x],16,16);
  }
}


text:
require 'rails_helper'

RSpec.describe ContractorsController, type: :controller do

  describe "GET #new" do
    it "returns http success" do
      get :new
      expect(response).to have_http_status(:success)
    end
  end

  describe "GET #create" do
    it "returns http success" do
      get :create
      expect(response).to have_http_status(:success)
    end
  end

  describe "GET #edit" do
    it "returns http success" do
      get :edit
      expect(response).to have_http_status(:success)
    end
  end

  describe "GET #delete" do
    it "returns http success" do
      get :delete
      expect(response).to have_http_status(:success)
    end
  end

  describe "GET #destroy" do
    it "returns http success" do
      get :destroy
      expect(response).to have_http_status(:success)
    end
  end

end

redpajama_set_name: RedPajamaGithub


text:
#ifndef _HCI_H_
#define _HCI_H_

#include <windows.h>

#include "fbthw.h"
#include "fbtHciDefs.h"

// Number of overlapped requests to have pending in the driver
#define HCI_NUMBER_OF_OVERLAPPED_LISTENS	MAXIMUM_WAIT_OBJECTS-1

// HCI Abstraction layer
class CHci;
typedef struct
{
	PFBT_HCI_EVENT_HEADER   pEvent;
	DWORD                   dwLength;
	CHci*                   pThis;

} HCI_EVENT, *PHCI_EVENT;

class CHci
{
public:
	CHci( CBTHW& btHw );
	virtual ~CHci();

	virtual DWORD StartEventListener();
	virtual DWORD StopEventListener();
   virtual DWORD OnEvent(PFBT_HCI_EVENT_HEADER pEvent, DWORD Length);

	static LPCTSTR GetEventText(BYTE Event);
	static LPCTSTR GetStatusText(BYTE Status);
	static DWORD GetManufacturerName(USHORT Company, LPTSTR /*in*/szInBuffer, DWORD dwBufferLength);

    virtual DWORD OnCommandComplete(BYTE NumHCICommandPackets, USHORT CommandOpcode, BYTE *Parameters, DWORD ParameterLength);
    virtual DWORD OnCommandStatus(BYTE Status, BYTE NumHCICommandPackets, USHORT CommandOpcode);

    virtual DWORD OnConnectionRequest(BYTE BD_ADDR[FBT_HCI_BDADDR_SIZE], ULONG ClassOfDevice[FBT_HCI_DEVICE_CLASS_SIZE], BYTE LinkType);
    virtual DWORD OnConnectionComplete(BYTE Status, USHORT ConnectionHandle, BYTE BD_ADDR[FBT_HCI_BDADDR_SIZE], BYTE LinkType, BYTE EncryptionMode);
    virtual DWORD OnDisconnectionComplete(BYTE Status, USHORT ConnectionHandle, BYTE Reason);

    virtual DWORD OnInquiryComplete(BYTE Status, BYTE NumResponses);
    virtual DWORD OnInquiryResult(BYTE NumResponses, BYTE BD_ADDR[FBT_HCI_VARIABLE_SIZE][FBT_HCI_BDADDR_SIZE], BYTE PageScanRepetitionMode[FBT_HCI_VARIABLE_SIZE], BYTE PageScanPeriodMode[FBT_HCI_VARIABLE_SIZE], BYTE PageScanMode[FBT_HCI_VARIABLE_SIZE], BYTE ClassOfDevice[FBT_HCI_VARIABLE_SIZE][FBT_HCI_DEVICE_CLASS_SIZE], USHORT ClockOffset[FBT_HCI_VARIABLE_SIZE]);

    virtual DWORD OnRemoteNameRequestComplete(BYTE Status, BYTE BD_ADDR[FBT_HCI_BDADDR_SIZE], BYTE RemoteName[FBT_HCI_NAME_SIZE]);

    virtual DWORD OnRoleChange(BYTE Status, BYTE BD_ADDR[FBT_HCI_BDADDR_SIZE], BYTE Role);

    virtual DWORD OnPINCodeRequest(BYTE BD_ADDR[FBT_HCI_BDADDR_SIZE]);

	virtual DWORD OnLinkKeyNotification(BYTE BD_ADDR[FBT_HCI_BDADDR_SIZE], BYTE LinkKey[FBT_HCI_LINK_KEY_SIZE]);
    virtual DWORD OnLinkKeyRequest(BYTE BD_ADDR[FBT_HCI_BDADDR_SIZE]);

	virtual DWORD OnAuthenticationComplete(BYTE Status, USHORT ConnectionHandle);

	virtual DWORD OnReadLocalNameComplete(BYTE Status, BYTE Name[FBT_HCI_NAME_SIZE]);

    virtual DWORD OnUnknown(PFBT_HCI_EVENT_HEADER pEvent, DWORD Length);

    virtual DWORD SendReset();

    virtual DWORD SendInquiry(ULONG LAP, BYTE InquiryLength, BYTE NumResponses);
    virtual DWORD SendInquiryCancel();

    virtual DWORD SendReadBDADDR();

    virtual DWORD SendReadBufferSize();

    virtual DWORD SendWriteScanEnable(BYTE ScanEnable);

    virtual DWORD SendWriteAuthenticationEnable(BYTE ScanEnable);

    virtual DWORD SendSetEventFilter(BYTE FilterType,
                                     BYTE FilterConditionType,
                                     BYTE Condition[FBT_HCI_MAX_CONDITION_SIZE],
									          BYTE ConditionBytes);

    virtual DWORD SendReadClassOfDevice();

    virtual DWORD SendWriteClassOfDevice(BYTE ClassOfDevice[FBT_HCI_DEVICE_CLASS_SIZE]);

    virtual DWORD SendCreateConnection(BYTE		BD_ADDR[FBT_HCI_BDADDR_SIZE],
                                       USHORT	PacketType,
                                       BYTE		PageScanRepetitionMode,
                                       BYTE		PageScanMode,
                                       USHORT	ClockOffset,
                                       BYTE		AllowRoleSwitch);

    virtual DWORD SendAcceptConnectionRequest(BYTE BD_ADDR[FBT_HCI_BDADDR_SIZE], BYTE RoleSwitch);

    virtual DWORD SendDisconnect(USHORT ConnectionHandle, BYTE  Reason);

    virtual DWORD SendWriteLinkSupervisionTimeout(USHORT ConnectionHandle, USHORT LinkSupervisionTimeout);

    virtual DWORD SendWritePageTimeout(USHORT PageTimeout);

    virtual DWORD SendRemoteNameRequest(BYTE BD_ADDR[FBT_HCI_BDADDR_SIZE], BYTE PageScanRepetitionMode, BYTE PageScanMode, USHORT ClockOffset);

    virtual DWORD SendReadLocalName();

    virtual DWORD SendChangeLocalName(BYTE Name[FBT_HCI_NAME_SIZE]);

	virtual DWORD SendSwitchRole(BYTE BD_ADDR[FBT_HCI_BDADDR_SIZE], BYTE Role);

	virtual DWORD SendPINCodeRequestReply(BYTE BD_ADDR[FBT_HCI_BDADDR_SIZE], BYTE PINCodeLength, BYTE PINCode[FBT_HCI_PIN_CODE_SIZE]);
	virtual DWORD SendPINCodeRequestNegativeReply(BYTE BD_ADDR[FBT_HCI_BDADDR_SIZE]);

	virtual DWORD SendLinkKeyRequestReply(BYTE BD_ADDR[FBT_HCI_BDADDR_SIZE], BYTE LinkKey[FBT_HCI_LINK_KEY_SIZE]);
	virtual DWORD SendLinkKeyRequestNegativeReply(BYTE BD_ADDR[FBT_HCI_BDADDR_SIZE]);

	virtual DWORD SendReadLocalVersionInformation();

	DWORD CompareBDADDRs(BYTE BD_ADDR1[FBT_HCI_BDADDR_SIZE], BYTE BD_ADDR2[FBT_HCI_BDADDR_SIZE]);

protected:
	friend static DWORD CALLBACK Listener(LPVOID pContext);
	friend static DWORD EventHandler(PFBT_HCI_EVENT_HEADER pEvent, DWORD Length);

	virtual DWORD SendHciCommand(const PFBT_HCI_CMD_HEADER lpCommand, DWORD dwBufferSize);

    DWORD SendListenForEvent(OVERLAPPED *pOverlapped, BYTE *pEventBuffer);

    HANDLE	m_hStopListeningEvent;
    HANDLE	m_hListenerReadyEvent;
    HANDLE	m_hListenerThread;

    DWORD	m_dwListenerThreadId;

    OVERLAPPED  m_Overlappeds[HCI_NUMBER_OF_OVERLAPPED_LISTENS];
    BYTE		m_pEventBuffers[HCI_NUMBER_OF_OVERLAPPED_LISTENS][FBT_HCI_EVENT_MAX_SIZE];

private:
   CBTHW& m_btHw;
};

#endif // _HCI_H_


text:
\hypertarget{class_practice}{\section{Practice Class Reference}
\label{class_practice}\index{Practice@{Practice}}
}
Inheritance diagram for Practice\+:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2.000000cm]{class_practice}
\end{center}
\end{figure}
\subsection*{Public Slots}
\begin{DoxyCompactItemize}
\item
\hypertarget{class_practice_a8602e22b2f18019b9b6a719f131b9963}{void {\bfseries add\+Musician} (\hyperlink{class_musician}{Musician} $\ast$musician)}\label{class_practice_a8602e22b2f18019b9b6a719f131b9963}

\item
\hypertarget{class_practice_aed320d1140cf2c4d09b0188839b80676}{void {\bfseries add\+Musician} (std\+::vector$<$ \hyperlink{class_musician}{Musician} $\ast$ $>$ musicians)}\label{class_practice_aed320d1140cf2c4d09b0188839b80676}

\item
\hypertarget{class_practice_a4d3c0fb809427288cf13603c1a73a959}{void {\bfseries remove\+Musician} (\hyperlink{class_musician}{Musician} $\ast$musician)}\label{class_practice_a4d3c0fb809427288cf13603c1a73a959}

\item
\hypertarget{class_practice_a36685171b20fa308e5f1efd0e9ed0437}{void {\bfseries clear\+Availables} ()}\label{class_practice_a36685171b20fa308e5f1efd0e9ed0437}

\item
\hypertarget{class_practice_a37210e6b9fab0a04e7c286422ab7f24d}{void {\bfseries unvalidate} ()}\label{class_practice_a37210e6b9fab0a04e7c286422ab7f24d}

\end{DoxyCompactItemize}
\subsection*{Signals}
\begin{DoxyCompactItemize}
\item
\hypertarget{class_practice_a47ac93096a141c1a0e59580ab27cf9a5}{void {\bfseries musician\+Added} (\hyperlink{class_musician}{Musician} $\ast$musician)}\label{class_practice_a47ac93096a141c1a0e59580ab27cf9a5}

\item
\hypertarget{class_practice_a309dceb442bf7c333517840e4aa45d7f}{void {\bfseries musicians\+Added} (std\+::vector$<$ \hyperlink{class_musician}{Musician} $\ast$ $>$ musicians)}\label{class_practice_a309dceb442bf7c333517840e4aa45d7f}

\item
\hypertarget{class_practice_ab4050eaa2dd4ccae4f0a356b1efe6045}{void {\bfseries musician\+Removed} (\hyperlink{class_musician}{Musician} $\ast$musician)}\label{class_practice_ab4050eaa2dd4ccae4f0a356b1efe6045}

\item
\hypertarget{class_practice_a6763e817b49f89361cb9a0d61ac59617}{void {\bfseries availables\+Cleared} ()}\label{class_practice_a6763e817b49f89361cb9a0d61ac59617}

\item
\hypertarget{class_practice_ad49697ebba133b726711a1f0ef8ba96b}{void {\bfseries schedule\+Changed} (std\+::vector$<$ \hyperlink{class_song}{Song} $\ast$ $>$)}\label{class_practice_ad49697ebba133b726711a1f0ef8ba96b}

\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item
\hypertarget{class_practice_a091983c6e10b0a871b8d83417e4609aa}{{\bfseries Practice} (std\+::shared\+\_\+ptr$<$ \hyperlink{class_show_mediator}{Show\+Mediator} $>$ mediator, Q\+Object $\ast$parent=0)}\label{class_practice_a091983c6e10b0a871b8d83417e4609aa}

\item
\hypertarget{class_practice_a23a72fd5e6ad3dc39b83e59ed0c6ecf5}{std\+::vector$<$ \hyperlink{class_song}{Song} $\ast$ $>$ {\bfseries get\+Possible\+Songs} () const }\label{class_practice_a23a72fd5e6ad3dc39b83e59ed0c6ecf5}

\end{DoxyCompactItemize}

The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item
C\+:/\+Users/\+Alexandre/\+Programmation/\+C++/\+Practice Scheduler/\+Practice\+Scheduler/model/practice.\+h\item
C\+:/\+Users/\+Alexandre/\+Programmation/\+C++/\+Practice Scheduler/\+Practice\+Scheduler/model/practice.\+cpp\end{DoxyCompactItemize}


text:
#import "MBElementContainer.h"
#import "MBElementContainer+Preconditions.h"
#import "MBElement.h"
#import "MBDocument.h"
#import "MBDocumentDefinition.h"
#import "MBElementContainer.h"
#import "StringUtilities.h"
#import "MBDataManagerService.h"
#import "MBScriptService.h"
#import "MBMacros.h"

@interface MBElementContainer()
	- (void) addAllPathsTo:(NSMutableSet*) set currentPath:(NSString*) currentPath;
@end

@implementation MBElementContainer

@synthesize parent = _parent;

- (id) init
{
	self = [super init];
	if (self != nil) {
		_elements = [[NSMutableDictionary alloc] init];
	}
	return self;
}

- (void) dealloc
{
	[_elements release];
	[super dealloc];
}

- (id) copy {
	@throw [NSException exceptionWithName:@"OverrideInSubclass" reason:@"Cannot copy MBElementContainer" userInfo:nil];
}

- (void) copyChildrenInto:(MBElementContainer*) other {
	for(NSString *elementName in [_elements allKeys]) {
		for(MBElement *src in [_elements valueForKey:elementName]) {
			MBElement *copy = [src copy];
     		[other addElement: copy];
			[copy release];
		}
	}
}

- (NSString*) uniqueId {
	NSMutableString *uid = [NSMutableString stringWithCapacity:200];
	for(NSString *elementName in [_elements allKeys]) {
		int idx = 0;
		for(MBElement *element in [_elements valueForKey:elementName]) {
			[uid appendFormat:@"[%i_%@", idx, [element uniqueId]];
		}
	}
	return uid;
}

-(void) addAllPathsTo:(NSMutableSet*) set currentPath:(NSString*) currentPath {
	for(NSString *elementName in [_elements allKeys]) {
		int idx = 0;
		for(MBElement *element in [_elements valueForKey:elementName]) {
			NSString *path = [NSString stringWithFormat:@"%@/%@[%i]", currentPath, elementName, idx++];
			[element addAllPathsTo: set currentPath:path];
		}
	}
}

- (id) valueForPathComponents:(NSMutableArray*)pathComponents withPath: (NSString*) originalPath nillIfMissing:(BOOL) nillIfMissing translatedPathComponents:(NSMutableArray*) translatedPathComponents {
	if([pathComponents count] > 0) {
		NSArray *rootNameParts = [[pathComponents objectAtIndex:0]componentsSeparatedByString:@"["];
		NSString *childElementName = [rootNameParts objectAtIndex:0];

		int idx = -99;

		// If the pathComponent is indexed (hello[0]) if the rootNameParts contains more than one entry
		if([rootNameParts count] > 1) {
			NSMutableString *idxStr = [NSMutableString stringWithString: [rootNameParts objectAtIndex:1]];
		    [idxStr replaceOccurrencesOfString:@"]" withString:@"" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [idxStr length])];

			// Look for the index value if the index is an expression (contains the '=' sign)
			if([idxStr rangeOfString:@"="].length != 0) {
				idx = [self evaluateIndexExpression:idxStr forElementName: childElementName];
			}
			else {
				idx = [idxStr intValue];
			}
		}

		[pathComponents removeObjectAtIndex:0];
		NSArray *allElementsWithSameNameAsChild = [self elementsWithName:childElementName];
		//NSArray *rootList = [self elementsWithName:childElementName];

		// If the pathComponent is not indexed (just hello, not hello[1]), return all the found elements with the same name
		if(idx  == -99) {
			if([pathComponents count] == 0) return allElementsWithSameNameAsChild;
			NSString *msg = [NSString stringWithFormat:@"No index specified for %@ in path %@", childElementName, originalPath];
			@throw [NSException exceptionWithName:@"NoIndexSpecified" reason: msg userInfo:nil];
		}
		// If the index is somehow smaller than 0, throw an exception
		else if(idx<0) {
			NSString *msg = [NSString stringWithFormat:@"Illegal index %i for %@ in path %@", idx, childElementName, originalPath];
			@throw [NSException exceptionWithName:@"IndexOutOfBounds" reason: msg userInfo:nil];
		}
		// If the number of elements with the same name exceeds the idx, return nil or throw an exception
		if([allElementsWithSameNameAsChild count] <= idx) {
			if(nillIfMissing) return nil;
			NSString *msg = [NSString stringWithFormat:@"Index %i exceeds %i for %@ in path %@", idx, [allElementsWithSameNameAsChild count]-1, childElementName, originalPath];
			@throw [NSException exceptionWithName:@"IndexOutOfBounds" reason: msg userInfo:nil];
		}

		MBElement *root = [allElementsWithSameNameAsChild objectAtIndex:idx];
		[translatedPathComponents addObject: [NSString stringWithFormat: @"%@[%i]", root.name, idx]];
		return [root valueForPathComponents: pathComponents withPath: originalPath nillIfMissing: nillIfMissing translatedPathComponents:translatedPathComponents];
	}
	return self;
}

- (id) valueForPath:(NSString*)path translatedPathComponents:(NSMutableArray*) translatedPathComponents {
    if(path == nil) return nil;

	NSMutableArray *pathComponents = [path splitPath];

	// If there is a ':' in the name of the first component; we might need a different document than 'self'
	if([pathComponents count]>0) {
		NSRange range = [[pathComponents objectAtIndex:0] rangeOfString:@":"];
		if(range.length>0) {
			NSString *documentName = [[pathComponents objectAtIndex:0] substringToIndex: range.location];
			NSString *rootElementName = [[pathComponents objectAtIndex:0] substringFromIndex: range.location+1];
            if(![documentName isEqualToString:[self documentName]]) {
				// Different document! Dispatch the valueForPath
				[translatedPathComponents addObject:[NSString stringWithFormat:@"%@:", documentName]];
				MBDocument *doc = [self getDocumentFromSharedContext: documentName];
				if([rootElementName length] > 0) [pathComponents replaceObjectAtIndex:0 withObject:rootElementName];
				else [pathComponents removeObjectAtIndex:0];

				return [doc valueForPathComponents: pathComponents withPath: path nillIfMissing: TRUE translatedPathComponents:translatedPathComponents];
			}
			else [pathComponents replaceObjectAtIndex:0 withObject:rootElementName];
		}
	}
	return [self valueForPathComponents: pathComponents withPath: path nillIfMissing: TRUE translatedPathComponents:translatedPathComponents];
}

- (id) valueForPath:(NSString*)path {
	return [self valueForPath:path translatedPathComponents:nil];
}

- (void) setValue:(NSString*)value forPath:(NSString *)path {
	NSMutableArray *pathComponents = [path splitPath];

	NSString *attributeName = [NSString stringWithString: [pathComponents lastObject]];
	if([attributeName hasPrefix:@"@"]) {
		[pathComponents removeLastObject];
		attributeName = [attributeName substringFromIndex:1];
        //the line below commented by Xiaochen
		//MBElement *element = [self valueForPathComponents: pathComponents withPath: path nillIfMissing: FALSE translatedPathComponents: nil];

		/***added by Xiaochen****/
		//the commented line does not work for a different document in page
		NSMutableString *elementPath = [NSMutableString stringWithString:[pathComponents objectAtIndex:0]];
		for (int i = 1; i < [pathComponents count]; i++) {
			[elementPath appendFormat:@"/%@", [pathComponents objectAtIndex:i]];
		}
		MBElement *element = [self valueForPath: elementPath];
		/***end****/

		[element setValue:value forAttribute: attributeName];
	}
	else {
		NSString *msg = [NSString stringWithFormat:@"Identitifer %@ in Path %@ does not specify an attribute; cannot set value", attributeName, path];
		@throw [NSException exceptionWithName:@"InvalidPath" reason: msg userInfo:nil];
	}
}

-(void) addElement: (MBElement*) element {

	NSString *name = [element definition].name;

    // Only add valid elements
    if ([self.definition isValidChild:name]) {
        element.parent = self;

        NSMutableArray *elementContainer = [self elementsWithName: name];
        if(elementContainer == nil)
        {
            elementContainer = [[NSMutableArray alloc] init];
            [_elements setValue:elementContainer forKey:name];
            [elementContainer release];
        }
        [elementContainer addObject:element];
    }
}

-(void) addElement: (MBElement*) element atIndex:(NSInteger)index {

	NSString *name = [element definition].name;

    // Only add valid elements
    if ([self.definition isValidChild:name]) {
        element.parent = self;

        NSMutableArray *elementContainer = [self elementsWithName: name];
        if(elementContainer == nil)
        {
            elementContainer = [[NSMutableArray alloc] init];
            [_elements setValue:elementContainer forKey:name];
            [elementContainer release];
        }
        [elementContainer insertObject:element atIndex:index];
    }
}

-(void) deleteAllChildElements{
	[_elements removeAllObjects];
	[[self document] clearPathCache];
}

-(void) deleteElementWithName: (NSString*) name atIndex:(int) index {
	NSMutableArray *elementContainer = [self elementsWithName: name];

	if(index<0 || index>=[elementContainer count]) {
		NSString *msg = [NSString stringWithFormat:@"Invalid index (%i) for element with name %@ (count=%i)", index, name, [elementContainer count]];
		@throw [NSException exceptionWithName:@"InvalidPath" reason: msg userInfo:nil];
	}
	[elementContainer removeObjectAtIndex:index];
}

-(MBElement*) createElementWithName: (NSString*) name {
	NSMutableArray *pathComponents = [name splitPath];

	if([pathComponents count] > 1) {
		NSString *elementName = [pathComponents lastObject];
		[pathComponents removeLastObject];

		MBElement *target = [self valueForPathComponents:pathComponents withPath: name nillIfMissing: FALSE translatedPathComponents:nil];
        return [target createElementWithName:elementName];
	}
	else {
		MBElementDefinition *childDef = [[self definition] childWithName:name];
        if (!childDef) {
            @throw [NSException exceptionWithName:@"InvalidElementName" reason:name userInfo:nil];
        }
		MBElement *element = [childDef createElement];
		[self addElement:element];
		return element;
	}
}

-(MBElement*) createElementWithName: (NSString*) name atIndex:(NSInteger)index {

    NSMutableArray *pathComponents = [name splitPath];

	if([pathComponents count] > 1) {
		NSString *elementName = [pathComponents lastObject];
		[pathComponents removeLastObject];

		MBElement *target = [self valueForPathComponents:pathComponents withPath: name nillIfMissing: FALSE translatedPathComponents:nil];
        return [target createElementWithName:elementName atIndex:index];
	}
	else {
		MBElementDefinition *childDef = [[self definition] childWithName:name];
        if (!childDef) {
            @throw [NSException exceptionWithName:@"InvalidElementName" reason:name userInfo:nil];
        }
		MBElement *element = [childDef createElement];
		[self addElement:element atIndex:index];
        return element;
	}

}

-(NSMutableArray*) elementsWithName: (NSString*) name {
    if([@"*" isEqualToString: name]) {
        NSMutableArray *result = [NSMutableArray array];
        for(NSArray *lst in [_elements allValues]) [result addObjectsFromArray: lst];
        return result;
    }
	else {
		if(![self.definition isValidChild:name]) {
            DLog(@"Child element with name %@ not present", name);
            return nil;
		}

		NSMutableArray *result = [_elements valueForKey:name];
		if(result == nil) {
			result = [NSMutableArray array];
			[_elements setValue:result forKey:name];
		}
		return result;
	}
}

- (NSMutableDictionary*) elements {
	return _elements;
}
- (id) definition {
	return nil;
}

-(NSString*) name {
	return [[self definition] name];
}

-(NSString*) documentName {
	return [[self parent] documentName];
}

-(MBDocument*) document {
	return [[self parent] document];
}

- (NSMutableDictionary*) sharedContext {
	return [[self parent] sharedContext];
}

- (void) setSharedContext:(NSMutableDictionary*) sharedContext {
	[[self parent] setSharedContext:sharedContext];
}

- (MBDocument*) getDocumentFromSharedContext:(NSString*) documentName {
	MBDocument *result = [[self sharedContext] valueForKey:documentName];
	if(result == nil) {
		result = [[MBDataManagerService sharedInstance] loadDocument: documentName];
		if(result == nil) {
			NSString *msg = [NSString stringWithFormat:@"Could not load document with name %@", documentName];
			@throw [NSException exceptionWithName:@"DocumentNotFound" reason:msg userInfo:nil];
		}
		[self registerDocumentWithSharedContext: result];
	}
	return result;
}

- (void) registerDocumentWithSharedContext:(MBDocument*) document {
	[document setSharedContext: [self sharedContext]];
    if (document.name.length > 0) {
        [[self sharedContext] setObject:document forKey: document.name];
    }
}

- (NSString*) evaluateExpression:(NSString*) expression currentPath:(NSString*) currentPath {
	NSString *translated = [self substituteExpressions:expression usingNilMarker:@"null" currentPath: currentPath];
	return [[MBScriptService sharedInstance] evaluate:translated];
}

- (NSString*) evaluateExpression:(NSString*) expression {

	return [self evaluateExpression: expression currentPath: nil];
}

// Sorts on the given attribute(s) Multiple attributes must be separated by ,
// Descending sort on an attribute can be done by prefixing the attribute with a -
- (void) sortElements:(NSString*) elementName onAttributes:(NSString*) attributeNames {
	NSMutableArray *elements = [self elementsWithName:elementName];
	if([elements count] == 0) return;

	MBElementDefinition *elementDef = [(MBElement*)[elements objectAtIndex:0] definition];

    NSMutableArray *sortDescriptors = [NSMutableArray array];

	for(NSString *attrSpec in [attributeNames componentsSeparatedByString:@","]) {
	  	attrSpec = [attrSpec stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
		BOOL ascending = [attrSpec hasPrefix:@"+"] || ![attrSpec hasPrefix:@"-"];
		if([attrSpec hasPrefix:@"+"] || [attrSpec hasPrefix:@"-"]) attrSpec = [attrSpec substringFromIndex:1];

		MBAttributeDefinition *attrDef = [elementDef attributeWithName:attrSpec];
		if([[attrDef dataType] isEqualToString:@"int"]) [sortDescriptors addObject: [[[NSSortDescriptor alloc] initWithKey:attrSpec ascending:ascending selector:@selector(compareInt:)]autorelease]];
		else if([[attrDef dataType] isEqualToString:@"double"]) [sortDescriptors addObject: [[[NSSortDescriptor alloc] initWithKey:attrSpec ascending:ascending selector:@selector(compareDouble:)]autorelease]];
		else if([[attrDef dataType] isEqualToString:@"float"]) [sortDescriptors addObject: [[[NSSortDescriptor alloc] initWithKey:attrSpec ascending:ascending selector:@selector(compareFloat:)]autorelease]];
		else if([[attrDef dataType] isEqualToString:@"boolean"]) [sortDescriptors addObject: [[[NSSortDescriptor alloc] initWithKey:attrSpec ascending:ascending selector:@selector(compareBoolean:)]autorelease]];
		else [sortDescriptors addObject: [[[NSSortDescriptor alloc] initWithKey:attrSpec ascending:ascending selector:@selector(compare:)]autorelease]];
	}
	[elements sortUsingDescriptors: sortDescriptors];
	// All indices of cached paths might have become invalid if the ordering has changed (which is likely; duh)
	[[self document] clearPathCache];
}

@end


text:
#include "config.h"
#include "core/css/CSSKeyframesRule.h"

#include "core/css/CSSKeyframeRule.h"
#include "core/css/CSSRuleList.h"
#include "core/css/CSSStyleSheet.h"
#include "core/css/parser/CSSParser.h"
#include "core/frame/UseCounter.h"
#include "wtf/text/StringBuilder.h"

namespace blink {

StyleRuleKeyframes::StyleRuleKeyframes()
    : StyleRuleBase(Keyframes)
    , m_version(0)
{
}

StyleRuleKeyframes::StyleRuleKeyframes(const StyleRuleKeyframes& o)
    : StyleRuleBase(o)
    , m_keyframes(o.m_keyframes)
    , m_name(o.m_name)
    , m_version(o.m_version)
    , m_isPrefixed(o.m_isPrefixed)
{
}

StyleRuleKeyframes::~StyleRuleKeyframes()
{
}

void StyleRuleKeyframes::parserAppendKeyframe(PassRefPtrWillBeRawPtr<StyleRuleKeyframe> keyframe)
{
    if (!keyframe)
        return;
    m_keyframes.append(keyframe);
}

void StyleRuleKeyframes::wrapperAppendKeyframe(PassRefPtrWillBeRawPtr<StyleRuleKeyframe> keyframe)
{
    m_keyframes.append(keyframe);
    styleChanged();
}

void StyleRuleKeyframes::wrapperRemoveKeyframe(unsigned index)
{
    m_keyframes.remove(index);
    styleChanged();
}

int StyleRuleKeyframes::findKeyframeIndex(const String& key) const
{
    OwnPtr<Vector<double>> keys = CSSParser::parseKeyframeKeyList(key);
    if (!keys)
        return -1;
    for (size_t i = m_keyframes.size(); i--; ) {
        if (m_keyframes[i]->keys() == *keys)
            return i;
    }
    return -1;
}

DEFINE_TRACE_AFTER_DISPATCH(StyleRuleKeyframes)
{
    visitor->trace(m_keyframes);
    StyleRuleBase::traceAfterDispatch(visitor);
}

CSSKeyframesRule::CSSKeyframesRule(StyleRuleKeyframes* keyframesRule, CSSStyleSheet* parent)
    : CSSRule(parent)
    , m_keyframesRule(keyframesRule)
    , m_childRuleCSSOMWrappers(keyframesRule->keyframes().size())
    , m_isPrefixed(keyframesRule->isVendorPrefixed())
{
}

CSSKeyframesRule::~CSSKeyframesRule()
{
#if !ENABLE(OILPAN)
    ASSERT(m_childRuleCSSOMWrappers.size() == m_keyframesRule->keyframes().size());
    for (unsigned i = 0; i < m_childRuleCSSOMWrappers.size(); ++i) {
        if (m_childRuleCSSOMWrappers[i])
            m_childRuleCSSOMWrappers[i]->setParentRule(0);
    }
#endif
}

void CSSKeyframesRule::setName(const String& name)
{
    CSSStyleSheet::RuleMutationScope mutationScope(this);

    m_keyframesRule->setName(name);
}

void CSSKeyframesRule::appendRule(const String& ruleText)
{
    ASSERT(m_childRuleCSSOMWrappers.size() == m_keyframesRule->keyframes().size());

    CSSStyleSheet* styleSheet = parentStyleSheet();
    CSSParserContext context(parserContext(), UseCounter::getFrom(styleSheet));
    RefPtrWillBeRawPtr<StyleRuleKeyframe> keyframe = CSSParser::parseKeyframeRule(context, ruleText);
    if (!keyframe)
        return;

    CSSStyleSheet::RuleMutationScope mutationScope(this);

    m_keyframesRule->wrapperAppendKeyframe(keyframe);

    m_childRuleCSSOMWrappers.grow(length());
}

void CSSKeyframesRule::deleteRule(const String& s)
{
    ASSERT(m_childRuleCSSOMWrappers.size() == m_keyframesRule->keyframes().size());

    int i = m_keyframesRule->findKeyframeIndex(s);
    if (i < 0)
        return;

    CSSStyleSheet::RuleMutationScope mutationScope(this);

    m_keyframesRule->wrapperRemoveKeyframe(i);

    if (m_childRuleCSSOMWrappers[i])
        m_childRuleCSSOMWrappers[i]->setParentRule(0);
    m_childRuleCSSOMWrappers.remove(i);
}

CSSKeyframeRule* CSSKeyframesRule::findRule(const String& s)
{
    int i = m_keyframesRule->findKeyframeIndex(s);
    return (i >= 0) ? item(i) : nullptr;
}

String CSSKeyframesRule::cssText() const
{
    StringBuilder result;
    if (isVendorPrefixed())
        result.appendLiteral("@-webkit-keyframes ");
    else
        result.appendLiteral("@keyframes ");
    result.append(name());
    result.appendLiteral(" { \n");

    unsigned size = length();
    for (unsigned i = 0; i < size; ++i) {
        result.appendLiteral("  ");
        result.append(m_keyframesRule->keyframes()[i]->cssText());
        result.append('\n');
    }
    result.append('}');
    return result.toString();
}

unsigned CSSKeyframesRule::length() const
{
    return m_keyframesRule->keyframes().size();
}

CSSKeyframeRule* CSSKeyframesRule::item(unsigned index) const
{
    if (index >= length())
        return nullptr;

    ASSERT(m_childRuleCSSOMWrappers.size() == m_keyframesRule->keyframes().size());
    RefPtrWillBeMember<CSSKeyframeRule>& rule = m_childRuleCSSOMWrappers[index];
    if (!rule)
        rule = adoptRefWillBeNoop(new CSSKeyframeRule(m_keyframesRule->keyframes()[index].get(), const_cast<CSSKeyframesRule*>(this)));

    return rule.get();
}

CSSKeyframeRule* CSSKeyframesRule::anonymousIndexedGetter(unsigned index) const
{
    if (UseCounter* useCounter = UseCounter::getFrom(parentStyleSheet()))
        useCounter->count(UseCounter::CSSKeyframesRuleAnonymousIndexedGetter);
    return item(index);
}

CSSRuleList* CSSKeyframesRule::cssRules() const
{
    if (!m_ruleListCSSOMWrapper)
        m_ruleListCSSOMWrapper = LiveCSSRuleList<CSSKeyframesRule>::create(const_cast<CSSKeyframesRule*>(this));
    return m_ruleListCSSOMWrapper.get();
}

void CSSKeyframesRule::reattach(StyleRuleBase* rule)
{
    ASSERT(rule);
    m_keyframesRule = toStyleRuleKeyframes(rule);
}

DEFINE_TRACE(CSSKeyframesRule)
{
    CSSRule::trace(visitor);
#if ENABLE(OILPAN)
    visitor->trace(m_childRuleCSSOMWrappers);
#endif
    visitor->trace(m_keyframesRule);
    visitor->trace(m_ruleListCSSOMWrapper);
}

} // namespace blink


text:
package com.oregonscientific.meep.ebook;

import static com.oregonscientific.meep.ebook.ServiceController.isContainBadWord;
import java.util.List;
import com.oregonscientific.meep.account.Account;
import com.oregonscientific.meep.control.MeepStorageCtrl;
import com.oregonscientific.meep.customfont.MyButton;
import com.oregonscientific.meep.customfont.MyEditText;
import com.oregonscientific.meep.customfont.MyTextView;
import com.oregonscientific.meep.global.BadWordChecker;
import com.oregonscientific.meep.global.Global;
import com.oregonscientific.meep.global.Global.AppType;
import com.oregonscientific.meep.message.common.MeepLogger;
import com.oregonscientific.meep.message.common.OsListViewItem;
import com.oregonscientific.meep.notification.NotificationMessage;
import com.oregonscientific.meep.opengl.BaseSnackAdapter;
import com.oregonscientific.meep.opengl.OSButton;
import com.oregonscientific.meep.opengl.OpenGlRender;
import com.oregonscientific.meep.opengl.SnackAdapter;
import com.oregonscientific.meep.opengl.StateManager.SystemState;
import android.app.ActivityManager;
import android.app.Fragment;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ConfigurationInfo;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory.Options;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.GestureDetector.OnGestureListener;
import android.view.LayoutInflater;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.inputmethod.InputMethodManager;
import android.view.GestureDetector;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.RelativeLayout.LayoutParams;

public class SnakeFragment extends Fragment implements OnGestureListener{

	private static final String TAG = "SnakeFragment";
	private GestureDetector mGuestureDetector;  //touching event handler
	OpenGlRender mRender;
	GLSurfaceView mGlView;	//open gl surface view
	private Bitmap mBmpBg;
	private Handler mHandlerUpdateUI = null;
	private FullListViewActivity mContext;
	ImageView mFullListIcon = null;
	List<OsListViewItem> mListViewItemList = null;
	private String[] blackListWord;

	private TextView mTextViewTitle = null;
	//private ImageView mUiBackLight = null;

	private float mInitX;
	private float mInitY;
	private boolean isGlReady = false;
	ViewGroup mRootView;

	//2013-5-23 -Amy- add pupupwindow for rename and delete item
	private PopupWindow popWindow = null;
	private View ringMenuShow = null;
	private RelativeLayout mPopupLayout = null;
	private RelativeLayout popupLayout;
	EditText mRenameText = null;
	private Account mAccount;
	private String user;
	NotificationMessage notification;
	private BadWordChecker badWordChecker = new BadWordChecker();

	public static SnakeFragment newInstance(String tag) {
		SnakeFragment f = new SnakeFragment();

        // Supply index input as an argument.
        Bundle args = new Bundle();
        args.putString("tag", tag);
        f.setArguments(args);

        return f;
    }

    @Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		View view = inflater.inflate(R.layout.main, container, false);
		mContext = (FullListViewActivity) getActivity();
		initOpenglRender(view);
		initComponent(view);

		//2013-6-11 - Zoya - Insert and pull out the sdcard Listener
		registerSDCardListener();

        mHandlerUpdateUI = new Handler(){
			@Override
			public void handleMessage(Message msg) {
				if(msg.what == 1){
					//update title
					String title = msg.getData().getString("title");
					//Log.d("ebook", "title update:" + title);
					//mTextViewTitle.setText(title);
					updateTitle(title);
				}

				super.handleMessage(msg);
			}
        };
        mRootView = (ViewGroup) view;
		return view;
	}

	// 2013-6-11 - Zoya - SDCardListener class
	private final BroadcastReceiver sdcardListener = new BroadcastReceiver() {
		@Override
		public void onReceive(Context context, Intent intent) {
			String action = intent.getAction();
			//Log.d("tag", "sdcard action----" + action);
			if (action.equals("android.intent.action.MEDIA_MOUNTED")) {//insert sdcard
				mListViewItemList = DataSourceManager.getAllItems(true);
				mRender.changedDataItem();
			} else if (action.equals("android.intent.action.MEDIA_REMOVED")//pull sdcard
					|| action.equals("android.intent.action.MEDIA_BAD_REMOVAL")) {
				mListViewItemList = DataSourceManager.getAllItems(true);
				mRender.changedDataItem();
			} else if (action.equals("com.meepstore.action.DOWNLOAD_COMPLETE")) {
			mListViewItemList = DataSourceManager.getAllItems(true);
			mRender.changedDataItem();
		}

		}
	};

	// 2013-6-11 - Zoya - registerSDCardListener
	private void registerSDCardListener() {
		IntentFilter intentFilter = new IntentFilter(Intent.ACTION_MEDIA_MOUNTED);
		intentFilter.addAction(Intent.ACTION_MEDIA_SCANNER_STARTED);
		intentFilter.addAction(Intent.ACTION_MEDIA_SCANNER_FINISHED);
		intentFilter.addAction(Intent.ACTION_MEDIA_REMOVED);
		intentFilter.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
		intentFilter.addAction(Intent.ACTION_MEDIA_BAD_REMOVAL);
		intentFilter.addDataScheme("file");
		mContext.registerReceiver(sdcardListener, intentFilter);
		IntentFilter intentFilter1 = new IntentFilter();
		intentFilter1.addAction("com.meepstore.action.DOWNLOAD_COMPLETE");
		mContext.registerReceiver(sdcardListener, intentFilter1);
	}

	@Override
	public void onDestroy() {
		// TODO Auto-generated method stub
		mContext.unregisterReceiver(sdcardListener);
		super.onDestroy();
	}

	private void initOpenglRender(View v)
    {try {
		mGlView = (GLSurfaceView)v.findViewById(R.id.surfaceViewOpenGl);
		mGuestureDetector = new GestureDetector(this);
		mRender = new OpenGlRender(this.getActivity());
		Options op = new Options();
		op.inPreferredConfig = Config.ARGB_8888;
		//mRender.setRenderType(AppType.Ebook);
		Bitmap bmpBg = BitmapFactory.decodeResource(getResources(), R.drawable.snack_bg, op);
		Bitmap bmpDummy = BitmapFactory.decodeResource(getResources(), R.drawable.dummy, op);
		Bitmap bmpDefault =  BitmapFactory.decodeResource(getResources(), R.drawable.book_default, op);
		Bitmap bmpDefaultDim =  BitmapFactory.decodeResource(getResources(), R.drawable.book_default_dim, op);
		//Bitmap bmpDefaultBg =  BitmapFactory.decodeResource(getResources(), R.drawable.book_icon_default);
		mBmpBg =BitmapFactory.decodeResource(getResources(), R.drawable.book_default_dim, op);
		SnackAdapter<OsListViewItem> adapter = new MySnackAdapter(loadDataSource());

		mRender.initRender(AppType.Ebook,adapter, bmpBg, bmpDummy, bmpDefault, bmpDefaultDim);
	    //public void initRender(AppType type, ISnackDataSource dataSource, Bitmap background, Bitmap dummyIcon, Bitmap defaultIcon, Bitmap defaultImageDim)

		mRender.setOnOspadRenderListener(new OpenGlRender.OspadRenderListener() {

			@Override
			public void OnSystemStateChanged(SystemState state) {
				// TODO Auto-generated method stub

			}

			@Override
			public void OnSurfaceCreated() {
				isGlReady = true;

			}

			@Override
			public void OnItemSelectedChanged(Object item) {
				String title = null;
				if (item != null) {
					title = ((OsListViewItem)item).getName();
				}
				Message msg = new Message();
				msg.what = 1;
				Bundle b = new Bundle();
				b.putString("title", title);
				msg.setData(b);
				mHandlerUpdateUI.sendMessage(msg);
			}

			@Override
			public void onLoadingButtonList(OSButton view) {
				if (view == null) {
					return;
				}
				// modified by aaronli at Jun11 2013
				// fixed null pointer exception for button empty.
				if(view.getContentPath() == null || view.getContentPath().size()<=0){
					return;
				}
				if (view.getTextureBmp() != null && view.getDimTextureBmp() != null) {
					return ;
				}

				DataSourceManager.loadingEbookImage(view, mBmpBg);
			}
		});

		if (detectOpenGLES20()) {
			// Tell the surface view we want to create an OpenGL ES
			// 2.0-compatible
			// context, and set an OpenGL ES 2.0-compatible renderer.
			mGlView.setEGLContextClientVersion(2);
			mGlView.setRenderer(mRender);
			mGlView.setOnTouchListener(new OnTouchListener() {
				@Override
				public boolean onTouch(View v, MotionEvent event) {
					if (event.getAction() == MotionEvent.ACTION_UP) {
						// added by aaronli at Jun26 2013. fixed #4539
						mRender.handleMouseUpEvent(event.getX(), event.getY());
						// fixed #4539 end
					} else if (event.getAction() == MotionEvent.ACTION_MOVE) {
					}
					if (isGlReady) {
						mGuestureDetector.onTouchEvent(event);
					}
					// mScaleGuestureDetector.onTouchEvent(event);
					return false;
				}
			});
			mGlView.setLongClickable(true);
		} else {
			Log.e("HelloTriangle", "OpenGL ES 2.0 not supported on device.  Exiting...");
			this.getActivity().finish();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

	private void updateTitle(String title) {

		/*if (mUiBackLight.getVisibility() != View.VISIBLE) {
			mUiBackLight.setVisibility(View.VISIBLE);
			mTextViewTitle.setVisibility(View.VISIBLE);
		}*/
		/*if(title != null && title.length()>18)
    	{
    		title = title.substring(0,16) + "..";
    	}*/
		//2013-6-24 - Zoya - fixed popup "Unfortunately, MeepMovie has stopped" when delete all contents.
    	if(title == null){
    		title = " ";
    	}
		mTextViewTitle.setText(title);
	}

    private void initComponent(View v)
    {
    	initFullListIcon(v);
    	mTextViewTitle = (TextView)v.findViewById(R.id.textViewTitle);
    	//mUiBackLight = (ImageView)findViewById(R.id.imageViewBackLight);
    }

	private void initFullListIcon(View v) {

		mFullListIcon = (ImageView)v.findViewById(R.id.imageViewFullList);
		//mFullListIcon.setVisibility(View.GONE);
		mFullListIcon.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				Log.d("ebook", "go to full list view");
				goToFullListView();
			}
		});
		mFullListIcon.setOnTouchListener(new View.OnTouchListener() {
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				// Log.d("mFullListIcon", "on touch");
				if (event.getAction() == MotionEvent.ACTION_DOWN) {
					mFullListIcon.setImageResource(R.drawable.full_bk);
				} else if (event.getAction() == MotionEvent.ACTION_UP) {
					mFullListIcon.setImageResource(R.drawable.full_wt);
				}
				return false;
			}
		});
	}

	private boolean detectOpenGLES20() {
		ActivityManager am = (ActivityManager)this.getActivity().getSystemService(Context.ACTIVITY_SERVICE);
		ConfigurationInfo info = am.getDeviceConfigurationInfo();
		return (info.reqGlEsVersion >= 0x20000);
	}

	private void goToFullListView() {
		mContext.showDetails(FullListViewActivity.STATE_FRAG_GRID);
	}

	@Override
	public boolean onDown(MotionEvent event) {
  		mInitX = event.getX();
  		mInitY = event.getY();

		return false;
	}

	@Override
	public boolean onFling(MotionEvent event1, MotionEvent event2, float velocityX,
			float velocityY) {
		//Log.d(TAG, "onFling");
		mRender.setFunctionMenuFling(mInitX,mInitY, velocityX, velocityY);
		return false;
	}

	@Override
	public void onLongPress(MotionEvent arg0) {
		if(Global.DISABLE_RING_MENU){
			Log.e("MeepEbook-onLongPress","DISABLE_RING_MENU");
			return;
		}
		// deleted by aaronli at Jun26.fixed #4710. no need to refresh data when show menu bar.
		//mRender.changedDataItem();
		// fixed #4710 end
		//Log.e("cdf",""+arg0.getX()+" -- "+arg0.getY());
		//2013-5-21 -Amy- add pupupwindow for rename and delete item
		FrameLayout two_button_left;
		RelativeLayout contentLayout;
		ImageView btnRename;
		ImageView btnDelete;
		int xx = (int) arg0.getX();
		int yy = (int) arg0.getY();
		if(DataSourceManager.getAllItems(false).size()>0 && DataSourceManager.getAllItems(false)!=null){
		//2013-6-24 -Amy- The RingMenu can be shown only tab the selected item
		if(xx>=480&&xx<=800 && yy>=180&&yy<=430){
		LayoutInflater layoutInflater = (LayoutInflater) this.getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		popWindow = new PopupWindow(ringMenuShow, LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
		ringMenuShow = layoutInflater.inflate(R.layout.ring_menu_rename_delete, null);
		two_button_left = (FrameLayout) ringMenuShow.findViewById(R.id.two_button_left);
		contentLayout = (RelativeLayout) ringMenuShow.findViewById(R.id.contentLayoutleft);
		btnRename = (ImageView) ringMenuShow.findViewById(R.id.btnRename);
		btnDelete = (ImageView) ringMenuShow.findViewById(R.id.btnDelete);
		android.widget.FrameLayout.LayoutParams layoutParams = (android.widget.FrameLayout.LayoutParams) contentLayout
				.getLayoutParams();
		// change the bottom of ring_menu
		if (yy > 230)
		{
			yy = 230;
		}
		if (xx > 600)
		{
			xx = 600;
		}
		layoutParams.leftMargin = xx;
		layoutParams.topMargin = yy;
		contentLayout.setLayoutParams(layoutParams);
		popWindow.setContentView(ringMenuShow);
		popWindow.update();
		two_button_left.setOnClickListener(new OnClickListener()
		{
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				ringMenuShow.setVisibility(View.GONE);
			}
		});
		popWindow.showAtLocation(mGlView, Gravity.START, xx, yy);
		//ringMenuHandler(left, buttonNum, item);

		final OnClickListener clickListener = new OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				switch (v.getId()) {
				case R.id.imageViewQuit:
					hidePopupMessageLayout();
					//mPopupLayout.setVisibility(View.GONE);
					break;
				case R.id.textViewOkBtn:
					mRender.renameSelectedItem();
					//hidePopupMessageLayout();
					break;
				case R.id.textViewNoBtn:
					popupLayout.setVisibility(View.GONE);
					break;
				case R.id.imageViewQuitDelete:
					popupLayout.setVisibility(View.GONE);
					break;
				case R.id.textViewYesBtn:
					mRender.deleteSelectedItem();
					break;
				}
			}
		};
//		2013-6-13 -Amy- delete function: can not rename system file
//		final OsListViewItem btn = mRender.getSelectedLevel4FuncButton(xx, yy);
//		String path = null;
//		if (btn != null && (path = btn.getPath()) != null) {
			btnRename.setOnClickListener(new OnClickListener() {
				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
//					if((btn.getPath()).contains("/data/home/ebook/unzip/")){
						//Toast.makeText(getActivity(), "It is system file ,can not be renamed .", 0).show();
//						String renameErr = (String) getResources().getString(R.string.music_title_rename_error);
//						String msg_system_file = (String) getResources().getString(R.string.msg_system_file_ebook);
//						notification = new NotificationMessage(mContext, null, renameErr, msg_system_file);
//						hideRingMenu();
//						return;
//					}else{
						hideRingMenu();
						//mViewGroup.removeView(ringMenuShow);
						LayoutInflater inflater = LayoutInflater.from(getActivity());
						mPopupLayout = (RelativeLayout) inflater.inflate(R.layout.layout_popup_text_input, null);
						ImageButton imageViewQuit = (ImageButton) mPopupLayout.findViewById(R.id.imageViewQuit);
						MyButton textViewOkBtn = (MyButton) mPopupLayout.findViewById(R.id.textViewOkBtn);
						MyEditText editTextRename = (MyEditText) mPopupLayout.findViewById(R.id.editTextRename);
						MyTextView textViewNotice = (MyTextView) mPopupLayout.findViewById(R.id.textViewNotice);
						ImageView imageViewEditUserBg = (ImageView) mPopupLayout.findViewById(R.id.imageViewEditUserBg);
						mRenameText = editTextRename;

						imageViewQuit.setOnClickListener(clickListener);
						textViewOkBtn.setText(R.string.ebook_btn_ok);
						textViewOkBtn.setOnClickListener(clickListener);
						//mRenameText = editTextRename;
						textViewNotice.setText(R.string.ebook_btn_ring_rename);
						imageViewEditUserBg.setOnTouchListener(new OnTouchListener()
						{
							@Override
							public boolean onTouch(View v, MotionEvent event) {
								return true;
							}
						});

						mPopupLayout.setVisibility(View.VISIBLE);
						//mPopupLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
						//getActivity().addContentView(mPopupLayout, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
						mRootView.addView(mPopupLayout);
						//During renaming, then touch the screen outside the
						// Rename blank, it will enter into corresponding moive or others
						mPopupLayout.setOnTouchListener(new OnTouchListener()
						{
							@Override
							public boolean onTouch(View v, MotionEvent event) {
								return true;
							}
						});
						//musicAdapter.notifyDataSetChanged();
//					}
				}
			});
//		}
		btnDelete.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				hideRingMenu();
				// TODO Auto-generated method stub
				String delErr = (String)getResources().getString(R.string.delete);
				String delMsg = (String)getResources().getString(R.string.delete_sure);
				//final OsListViewItem mitem = item;
				//notification = new NotificationMessage(mContext, null, delErr, delMsg);

				LayoutInflater lf = LayoutInflater.from(getActivity());
				popupLayout = (RelativeLayout) lf.inflate(R.layout.notification_delete, null);
				//2013-7-9 -Amy- add quit button
				ImageButton imageViewQuitDelete = (ImageButton) popupLayout.findViewById(R.id.imageViewQuitDelete);
				MyButton textViewYesBtn = (MyButton) popupLayout.findViewById(R.id.textViewYesBtn);
				MyButton textViewNoBtn = (MyButton) popupLayout.findViewById(R.id.textViewNoBtn);
				MyTextView textViewNotice = (MyTextView) popupLayout.findViewById(R.id.textViewNotice);
				//2013-7-9 -Amy- change popup window text style
				TextView textViewMessage = (TextView) popupLayout.findViewById(R.id.textViewMessage);

				textViewNotice.setText(delErr);
				textViewMessage.setText(delMsg);
				textViewYesBtn.setOnClickListener(clickListener);
				textViewNoBtn.setOnClickListener(clickListener);
				imageViewQuitDelete.setOnClickListener(clickListener);

				popupLayout.setVisibility(View.VISIBLE);
				popupLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
				//mViewGroup.addView(popupLayout);
				//getActivity().addContentView(popupLayout, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
				mRootView.addView(popupLayout);
				popupLayout.setOnTouchListener(new OnTouchListener() {
					@Override
					public boolean onTouch(View v, MotionEvent event) {
						return true;
					}
				});
			}
		});
		}
		}
	}

	private void hideRingMenu() {
		if (popWindow != null && popWindow.isShowing())
		{
			popWindow.dismiss();
		}
		ringMenuShow = null;
	}

	@Override
	public boolean onScroll(MotionEvent e1, MotionEvent e2, float ditanceX, float distanceY) {
		Log.d(TAG, "onScroll e1 "+ e1.getAction() +" e2 " +e2.getAction());
		mRender.setLevel4XScroll(ditanceX);
		return false;
	}

	@Override
	public void onShowPress(MotionEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public boolean onSingleTapUp(MotionEvent e) {
		OsListViewItem btn = mRender.getSelectedLevel4FuncButton(e.getX(), e.getY());
		String path = null;
		if (btn != null && (path = btn.getPath()) != null) {
			goToEbook(path, btn.getName());
		} else {
			mRender.moveItemToSelected(e.getX(), e.getY());
		}
		return false;
	}

	private void goToEbook(String path, String name)
	{
//	    // Old Ebook reader (1.0)
//		Intent intent = new Intent(this, FullListViewActivity.class);
//		intent.setComponent(ComponentName.unflattenFromString("com.oregonscientific.meep.Reader.main/.BooksReaderActivity"));
//		//intent.setComponent(ComponentName.unflattenFromString("com.Reader.main/.BooksReaderActivity"));
//		intent.addCategory("android.intent.category.LAUNCHER");
//		intent.putExtra(Global.STRING_PATH, path);
//		intent.putExtra(Global.STRING_NAME, name);

		// New Ebook reader (2.0)
		Intent intent = new Intent(this.getActivity(), FullListViewActivity.class);
		intent.setComponent(new ComponentName("com.oregonscientific.meep.epubreader", "com.oregonscientific.meep.epubreader.BookRendering"));
		intent.addCategory("android.intent.category.LAUNCHER");
		intent.putExtra("path", path);
		intent.putExtra(Global.STRING_NAME, name);

		try {
			startActivity(intent);

            MeepLogger meepLogger = new MeepLogger(this.getActivity());
            meepLogger.p("was reading eBook: " + name);
		} catch (Exception ex) {
			Log.e("meepbook", "go to ebookReader:" + ex.toString());
		}
	}

	/*@Override
	protected void onStop() {
		super.onStop();

		if (mRender != null) {
			mRender.stopLoadingSnakeButtonImages();
		}
	}

	@Override
	protected void onDestroy() {
		mRender.clearAllImageId();

		super.onDestroy();
	}*/

	// TODO: should call MeepLib
	private String getExtension(String filename) {
		// dot is included
		int dotIndex = filename.lastIndexOf(".");

		if (dotIndex >= 0) {
			return filename.substring(dotIndex,filename.length()).toLowerCase();
		} else {
			return "";
		}
	}

	public List<OsListViewItem> loadDataSource() {
		/*List<File> fileList = DataSourceManager.getEbookList();
		List<OsListViewItem> items = new Vector<OsListViewItem>();
		DataSourceManager.getDataSource(fileList, items);*/

		return DataSourceManager.getAllItems(false);
	}

	/*private void loadButtonWithDummyImages() {
		// TODO Auto-generated method stub

	}*/

	private void loadingButtonImage(OSButton button) {
		if (button == null) {
			return;
		}
		// modified by aaronli at Jun11 2013
		// fixed null pointer exception for button empty.
		if(button.getContentPath() == null || button.getContentPath().size()<=0){
			return;
		}
		if (button.getTextureBmp() != null && button.getDimTextureBmp() != null) {
			return ;
		}

		DataSourceManager.loadingEbookImage(button, mBmpBg);
	}

	// new snackAdapter to do onDelectedItem and onRenameItem
	private class MySnackAdapter extends BaseSnackAdapter{
		public MySnackAdapter(List<OsListViewItem> data) {
			super(data);
		}

		@Override
		public void onDelectedItem(OsListViewItem deleteItem) {
			//delete item from database
			if (deleteItem != null) {
				DataSourceManager.deleteItemFiles(deleteItem);
				DataSourceManager.deleteDataItems(deleteItem);
			}
			// redrawListView();
			popupLayout.setVisibility(View.GONE);
		}

		@Override
		public void onRenameItem(OsListViewItem deleteItem) {
			if (deleteItem != null) {
				renameConfirm(deleteItem);
			}
			hidePopupMessageLayout();
		}

	}

	private void renameConfirm(final OsListViewItem item) {
		boolean isExist = false;
		badWordChecker.setBlacklist(blackListWord);

		String renameErr = (String) getResources().getString(R.string.ebook_title_rename_error);

		// 2013-03-22 - raymond - avoid rename system folder
		if (item.getName().equals("data") || item.getName().equals("extsd"))
		{
			String msg_system_file = (String) getResources().getString(R.string.msg_system_file_ebook);
			notification = new NotificationMessage(mContext, null, renameErr, msg_system_file,mRootView);
			return;
		}

		// 2013-03-22 - raymond - replace all special char
		String tmpName = mRenameText.getText().toString().trim();
		boolean shouldBlock = false;

		//2013-6-20 - Zoya - solve #4292
		if (item.getName().equals(tmpName)) {
			// String renameErrMsgInvalidName = (String) getResources()	.getString(R.string.msg_rename_same);
			// notification = new NotificationMessage(mContext, null,renameErr, null);
			mPopupLayout.setVisibility(View.GONE);
			return;
		}

		/*if (tmpName.indexOf(" ") != -1){
			shouldBlock = true;
		}*/
		shouldBlock=MeepStorageCtrl.isRegexBadCharctors(tmpName);
		if (tmpName.equals(""))		{
			String renameErrMsgInvalidName = (String) getResources().getString(R.string.msg_null);
			notification = new NotificationMessage(mContext, null, renameErr, renameErrMsgInvalidName,mRootView);
			return;
		} else if (shouldBlock){
			String renameErrMsgInvalidName = (String) getResources().getString(R.string.ebook_msg_blocked);
			notification = new NotificationMessage(mContext, null, renameErr, renameErrMsgInvalidName,mRootView);
			return;
		/*}else if (item.getName().equals(tmpName)) {
			String renameErrMsgInvalidName = (String) getResources() .getString(R.string.msg_rename_same);
			notification = new NotificationMessage(mContext, null, renameErr, renameErrMsgInvalidName);
			return;*/
		}else{
			mRenameText.setText(tmpName);
		}

		if (isContainBadWord(getActivity(), tmpName)) {
			String msg_error = (String) getResources().getString(R.string.msg_error);
			notification = new NotificationMessage(mContext, null, renameErr, msg_error,mRootView);
			return;
		}

		if (!mRenameText.getText().toString().equals(""))
		{
			// renamePhoto(renameFileName+".png", item);
			if (DataSourceManager.fileNameisAlreadyExecised(tmpName))
			{
				String renameErrMsgFormat = (String) getResources().getString(R.string.msg_blocked);
				String renameErrMsg = String.format(renameErrMsgFormat, mRenameText.getText().toString());
				notification = new NotificationMessage(mContext, null, renameErr, renameErrMsg,mRootView);
				// notification = new NotificationMessage(mContext,
				// null, "Rename error",
				// "This destination already contains a file named \""
				// + mRenameText.getText().toString() +
				// "\". \nPlease check it before renaming this file.");
			} else if ((mRenameText.getText().toString().substring(0, 1)).equals("."))
			{
				String renameErrMsgInvalidName = (String) getResources().getString(R.string.ebook_msg_name_invalid);
				notification = new NotificationMessage(mContext, null, renameErr, renameErrMsgInvalidName,mRootView);
				// notification = new NotificationMessage(mContext,
				// null, "Rename error",
				// "The file name cannot start with \".\", please change the file name");
			}
		/*	else if (!badWordChecker.isStringSafe(mRenameText.getText().toString())){
				String renameErrMsgInvalidName = (String)getResources().getString(R.string.msg_error);
				notification = new NotificationMessage(mContext, null,renameErr, renameErrMsgInvalidName,mRootView);
			} */
			else
			{
				// 2013-3-14 - Amy - GridView replace ListView
				String renameFileName = mRenameText.getText().toString();
				//2013-6-26 -Amy- rename file's name containing space charector not in first or last
				renameFileName = renameFileName.trim();
				String pathTo = item.getPath().substring(0,	item.getPath().length() - item.getName().length() - 1) + renameFileName + "/";
				DataSourceManager.renameFile(renameFileName, item);
				//item.setName(renameFileName);
				//item.setPath(pathTo);
			}
		}

	}

	private void hidePopupMessageLayout() {
		// 2013-03-25 - raymond - dismiss rename keyboard
		if (mRenameText != null)
		{
			InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
			imm.hideSoftInputFromWindow(mRenameText.getWindowToken(), 0);
		}
		((ViewGroup) getView()).removeView(mPopupLayout);
		mPopupLayout = null;
	}
}


text:
import React, { Component } from 'react';
import PropTypes from 'prop-types';

import { NavLink } from 'react-router-dom';
import css from './NavBar.css';

class Navitem extends Component {

  static propTypes = {
    to: PropTypes.string,
    label: PropTypes.string,
  };

  render() {
    return (

        <NavLink
          activeClassName={css.active}
          to={this.props.to}
        >
          {this.props.label}

        </NavLink>

    );
  }
}

export default Navitem;


text:
/*
 * 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.
 */

Ext.define("Wdesktop.app.MovieApp.store.MovieStore", {
	extend : "Ext.data.Store",

	requires : [ 'Wdesktop.app.MovieApp.model.MovieModel',
			'Ext.data.proxy.Ajax', 'Ext.data.reader.Json' ],

	constructor : function(cfg) {
		var me = this;
		cfg = cfg || {};
		me.callParent([ Ext.apply({
			autoLoad : false,
			model : 'Wdesktop.app.MovieApp.model.MovieModel',
			proxy : {
				type : "ajax",
				url : "media/movie/list.json",
				reader : {
					type : "json",
					root : "movies"
				}
			},
		}, cfg) ]);
	}
});


text:
'use strict';

function programmerError(callback) {
    setTimeout(function() {
        var x = y + 1;
        callback();
    }, 100);
}

programmerError();


text:
#include <dvbdev.h>
#include <dmxdev.h>
#include <dvb_demux.h>
#include <dvb_net.h>
#include <dvb_frontend.h>

struct videobuf_dvb {
	/* filling that the job of the driver */
	char                       *name;
	struct dvb_frontend        *frontend;
	struct videobuf_queue      dvbq;

	/* video-buf-dvb state info */
	struct mutex               lock;
	struct task_struct         *thread;
	int                        nfeeds;

	/* videobuf_dvb_(un)register manges this */
	struct dvb_demux           demux;
	struct dmxdev              dmxdev;
	struct dmx_frontend        fe_hw;
	struct dmx_frontend        fe_mem;
	struct dvb_net             net;
};

struct videobuf_dvb_frontend {
	struct list_head felist;
	int id;
	struct videobuf_dvb dvb;
};

struct videobuf_dvb_frontends {
	struct list_head felist;
	struct mutex lock;
	struct dvb_adapter adapter;
	int active_fe_id; /* Indicates which frontend in the felist is in use */
	int gate; /* Frontend with gate control 0=!MFE,1=fe0,2=fe1 etc */
};

int videobuf_dvb_register_bus(struct videobuf_dvb_frontends *f,
			  struct module *module,
			  void *adapter_priv,
			  struct device *device,
			  short *adapter_nr,
			  int mfe_shared);

void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f);

struct videobuf_dvb_frontend * videobuf_dvb_alloc_frontend(struct videobuf_dvb_frontends *f, int id);
void videobuf_dvb_dealloc_frontends(struct videobuf_dvb_frontends *f);

struct videobuf_dvb_frontend * videobuf_dvb_get_frontend(struct videobuf_dvb_frontends *f, int id);
int videobuf_dvb_find_frontend(struct videobuf_dvb_frontends *f, struct dvb_frontend *p);

/*
 * Local variables:
 * c-basic-offset: 8
 * End:
 */


text:
<?php namespace Gzero\Api\Transformer;

use Gzero\Entity\Option;

class OptionTransformer extends AbstractTransformer {

    /**
     * Transforms option entity
     *
     * @param Option|array $option Option entity
     *
     * @return array
     */
    public function transform($option)
    {
        $option = $this->entityToArray(Option::class, $option);
        return $option;
    }
}


text:
# PossiblyUnusedProperty

Emitted when `--find-dead-code` is turned on and Psalm cannot find any uses of a particular public/protected property

```php
<?php

class A {
    /** @var string|null */
    public $foo;

    /** @var int|null */
    public $bar;
}

$a = new A();
echo $a->foo;
```


text:
from django.conf.urls import url
from . import views
from . import tables_views
from rest_framework import routers
#from .views import CompanyViewSet, CaceViewSet, StaffViewSet, DatabaseViewSet
from .views import CompanyViewSet, CaceViewSet, DatabaseViewSet

urlpatterns = [
    url(r'^$', tables_views.tables_index, name='tables_index'),
    url(r'^add$', tables_views.tables_add, name='tables_add'),
    url(r'^columns$', tables_views.columns_index, name='columns_index'),
]

router = routers.DefaultRouter()
router.register(r'company', CompanyViewSet)
router.register(r'cace', CaceViewSet)
#router.register(r'staff', StaffViewSet)
router.register(r'database', DatabaseViewSet)
#router.register(r'skill', SkillViewSet)
#router.register(r'skillCategory', SkillCategoryViewSet)

#urlpatterns = [
#   url(r'^$', views.skill, name='skill'),  # urlとviewの結びつけ
#   url(r'^$', views.tables_view, name='tables_view'),
#   url(r'^$', views.columns_view, name='index_view')
#]


text:
module.exports = function(app) {

    var MovieService = require('../services/movie-services.js');
    var Config       = require('../util/config.js');
    var AddRoute     = require('../util/add-route.js');

    // GET - Return all movies in the DB
    var findAllMovies = function(req, res) {

        console.log('GET - routes/movie-routes.js/findMovies');

        MovieService.findAllMovies({

            onSuccess: function(movies) {
                res.jsonp(movies);
            },

            onError: function(error) {
                res.jsonp({error:error});
            }
        });
    };

    // GET - Return all movies by rating
    var findAllMoviesByRating = function(req, res) {

        console.log('GET - routes/movie-routes.js/findAllMoviesByRating');

        MovieService.findAllMoviesByRating({

            onSuccess: function(movies) {
                res.jsonp(movies);
            },

            onError: function(error) {
                res.jsonp({error:error});
            }
        });
    };

    // GET - Return movies to update
    var findMoviesToUpdate = function(req, res) {

        console.log('GET - routes/movie-routes.js/findMoviesToUpdate');

        MovieService.findMoviesToUpdate({

            onSuccess: function(movies) {
                res.jsonp(movies);
            },

            onError: function(error) {
                res.jsonp({error:error});
            }
        });
    };

    // GET - Search movies by title
    var searchByTitle = function(req, res) {

        console.log('GET - routes/movie-routes.js/searchByTitle');

        var movieTitle = req.params.title
        console.log('movieTitle=' + movieTitle);

        MovieService.searchByTitle({

            movieTitle: movieTitle,

            onSuccess: function(movies) {
                res.jsonp(movies);
            },

            onError: function(error) {
                res.jsonp({error:error});
            }
        });
    };

    // GET - Return a movie with specified ID
    var findMovie = function(req, res) {

        console.log('GET - routes/movie-routes.js/findMovie');

        /* en el parámetro movie id puede vernir solo el ID de la película
           o puede venir algo del tipo el-titulo-de-la-pelicula-ID */
        var texts = req.params.movieId.split('-');
        var movieId = texts[texts.length-1];
        console.log('movieId=' + movieId);

        MovieService.findMovieById({

            movieId: movieId,

            onSuccess: function(movie) {
                res.jsonp(movie);
            },

            onError: function(error) {
                res.jsonp({error:error});
            }
        });
    };

    // DELETE - Delete a movie with specified ID
    var deleteMovie = function(req, res) {

        console.log('DELETE - routes/movie-routes.js/deleteMovie');

        /* en el parámetro movie id puede vernir solo el ID de la película
           o puede venir algo del tipo el-titulo-de-la-pelicula-ID */
        var texts = req.params.movieId.split('-');
        var movieId = texts[texts.length-1];
        console.log('movieId=' + movieId);

        MovieService.findMovieByIdAndRemove({

            movieId: movieId,

            onSuccess: function(movie) {
                res.jsonp(movie);
            },

            onError: function(error) {
                res.jsonp({error:error});
            }
        });
    };

    // Link routes and functions
    AddRoute.addRoute({
        app         : app,
        method      : 'get',
        url         : 'movies',
        description : 'Return all movies '
                    + '(max='+Config.properties.rowLimit+') ordered by released date and score',
        callback    : findAllMovies
    });

    AddRoute.addRoute({
        app         : app,
        method      : 'get',
        url         : 'movies-by-rating',
        description : 'Return all movies by rating'
                    + '(max='+Config.properties.rowLimit+') ordered by score',
        callback    : findAllMoviesByRating
    });

    AddRoute.addRoute({
        app         : app,
        method      : 'get',
        url         : 'movies-to-update',
        description : 'Return all movies to update'
                    + '(max='+Config.properties.rowLimit+') ordered by updated date',
        callback    : findMoviesToUpdate
    });

    AddRoute.addRoute({
        app         : app,
        method      : 'get',
        url         : 'search/:title',
        description : 'Return the movies with the supplied $title',
        callback    : searchByTitle
    });

    AddRoute.addRoute({
        app         : app,
        method      : 'get',
        url         : 'movie/:movieId',
        description : 'Return the movie with the supplied $movieID',
        callback    : findMovie
    });

    if ( Config.properties.showAllRoutes ) {
        AddRoute.addRoute({
            app         : app,
            method      : 'delete',
            url         : 'movie/:movieId',
            description : 'Delete the movie with the supplied $movieID',
            callback    : deleteMovie
        });
    }
}


text:
package repository

import (
	"github.com/ChaosXu/nerv/lib/resource/model"
	"github.com/toolkits/file"
)

type HttpScriptRepository struct {
	Root string
}

func NewHttpScriptRepository(root string) *HttpScriptRepository {
	return &HttpScriptRepository{root}
}

func (p *HttpScriptRepository) Get(class string, path string) (*model.Script, error) {
	if content, err := file.ToString(p.Root + class + "/" + path); err != nil {
		return nil, err
	} else {
		return &model.Script{Content: content}, nil
	}
}


text:
#include <QDataStream>
#include <QtDebug>
#include <QPainter>
#include <limits>

#include "CommonDefs.h"
#include "Map/Mapper.h"
#include "LayerEntityPopulatedPoint.h"
#include "VectorLayerPopulatedPoint.h"

namespace map {
// ----------------------------------------------------------------------------

VectorLayerPopulatedPoint::VectorLayerPopulatedPoint(LayerType eLayer)
: VectorLayerPoint(eLayer)
{
}

VectorLayerPopulatedPoint::~VectorLayerPopulatedPoint()
{
}

// ----------------------------------------------------------------------------

AbstractLayerEntity* VectorLayerPopulatedPoint::CreateEntity(QDataStream& in)
{
	// This class is using polyline entities.
	AbstractLayerEntity* pE = new LayerEntityPopulatedPoint(m_baParameterType.size());
	pE->Read(in, m_baParameterType);
	return pE;
}

// ----------------------------------------------------------------------------

void VectorLayerPopulatedPoint::Draw(QPainter* pP, const Mapper* pM) const
{
	int iZoom = (int)(1.0f/pM->GetScale());

	pP->setPen(m_colorLine);
	pP->setBrush(m_colorFill);
	bool bWasAntialiasing = (pP->renderHints() & QPainter::Antialiasing);
	pP->setRenderHint(QPainter::Antialiasing, false);

	foreach(AbstractLayerEntity* pE, m_conEntity) {
		int iImp = ((LayerEntityPopulatedPoint*)pE)->GetImportance();
		if(iImp >= 4 && iZoom > 251000)
			continue;
		if(iImp == 3 && iZoom > 1001000)
			continue;
		pE->Draw(pP, pM);
	}

	pP->setRenderHint(QPainter::Antialiasing, bWasAntialiasing);

}

// ----------------------------------------------------------------------------

void VectorLayerPopulatedPoint::GetTextLabels(
	const Mapper* pM,
	const QRectF& rClip,
	QList<TextLabel*>& conLabels) const
{
	int iZoom = (int)(1.0f/pM->GetScale());
	foreach(AbstractLayerEntity* pE, m_conEntity) {
		int iImp = ((LayerEntityPopulatedPoint*)pE)->GetImportance();
		if(iImp >= 4 && iZoom > 251000)
			continue;
		if(iImp == 3 && iZoom > 3001000)
			continue;
		if(!((LayerEntityPopulatedPoint*)pE)->IsCity() && iZoom > 2001000)
			continue;
		// Is it inside the clipping rectangle?
		if(rClip.contains(((LayerEntityPopulatedPoint*)pE)->GetCoordinate()))
			conLabels << new TextLabel(((LayerEntityPopulatedPoint*)pE)->GetTextLabel());
	}
}

// ----------------------------------------------------------------------------
}


text:
package opt

import (
	"github.com/algolia/algoliasearch-client-go/v3/algolia/opt"
)

// ExtractCustomNormalization returns the first found CustomNormalizationOption from the
// given variadic arguments or nil otherwise.
func ExtractCustomNormalization(opts ...interface{}) *opt.CustomNormalizationOption {
	for _, o := range opts {
		if v, ok := o.(*opt.CustomNormalizationOption); ok {
			return v
		}
	}
	return nil
}


text:
package com.datastax.spark.connector.sql

import java.util.TimeZone

import com.datastax.spark.connector.cluster.CETCluster
import org.scalatest.FlatSpec

/**
  * This should be executed in separate JVM, as Catalyst caches default time zone
  */
class CassandraDataFrameDateCETSpec  extends FlatSpec with CassandraDataFrameDateBehaviors with CETCluster {

  val centralEuropeanTimeZone = TimeZone.getTimeZone("CET")

  "A DataFrame in CET timezone" should behave like dataFrame(centralEuropeanTimeZone)
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<title></title>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="search.css"/>

Loading...

  waitMs
  timer.c

  waitSubTick
  timer.c

  waitTick
  timer.c

Searching...

No Matches


text:
using UnityEngine;

namespace TankArena.Controllers
{
    public class SpawnerClient: MonoBehaviour
    {
        public SpawnerController spawner;
        public GameObject targetGO;

        /// <summary>
        /// Start is called on the frame when a script is enabled just before
        /// any of the Update methods is called the first time.
        /// </summary>
        void Start()
        {

            var enemyAi = gameObject.GetComponent<EnemyAIController>();
            //this is an eney spawner, assign target to spawned units
            if (targetGO != null && enemyAi != null)
            {
                enemyAi.SetTargetGO(targetGO);
            }
        }

        /// <summary>
        /// This function is called when the MonoBehaviour will be destroyed.
        /// </summary>
        void OnDestroy()
        {
            spawner.ClientDead();
        }

    }
}


text:
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// 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.

#ifndef __ESP_SYSTEM_H__
#define __ESP_SYSTEM_H__

#include <stdint.h>
#include <stdbool.h>
#include "esp_err.h"
#include "esp_deep_sleep.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef enum {
    ESP_MAC_WIFI_STA,
    ESP_MAC_WIFI_SOFTAP,
    ESP_MAC_BT,
    ESP_MAC_ETH,
} esp_mac_type_t;

#define TWO_MAC_ADDRESS_FROM_EFUSE 2
#define FOUR_MAC_ADDRESS_FROM_EFUSE 4
#define NUM_MAC_ADDRESS_FROM_EFUSE CONFIG_NUMBER_OF_MAC_ADDRESS_GENERATED_FROM_EFUSE

/**
  * @attention  application don't need to call this function anymore. It do nothing and will
  *             be removed in future version.
  */
void system_init(void) __attribute__ ((deprecated));

/**
  * @brief  Reset to default settings.
  *
  * Function has been deprecated, please use esp_wifi_restore instead.
  * This name will be removed in a future release.
  */
void system_restore(void) __attribute__ ((deprecated));

/**
  * @brief  Restart PRO and APP CPUs.
  *
  * This function can be called both from PRO and APP CPUs.
  * After successful restart, CPU reset reason will be SW_CPU_RESET.
  * Peripherals (except for WiFi, BT, UART0, SPI1, and legacy timers) are not reset.
  * This function does not return.
  */
void esp_restart(void) __attribute__ ((noreturn));

/**
  * @brief  Restart system.
  *
  * Function has been renamed to esp_restart.
  * This name will be removed in a future release.
  */
void system_restart(void) __attribute__ ((deprecated, noreturn));

/**
  * @brief  Get system time, unit: microsecond.
  *
  * This function is deprecated. Use 'gettimeofday' function for 64-bit precision.
  * This definition will be removed in a future release.
  */
uint32_t system_get_time(void)  __attribute__ ((deprecated));

/**
  * @brief  Get the size of available heap.
  *
  * Note that the returned value may be larger than the maximum contiguous block
  * which can be allocated.
  *
  * @return Available heap size, in bytes.
  */
uint32_t esp_get_free_heap_size(void);

/**
  * @brief  Get the size of available heap.
  *
  * Function has been renamed to esp_get_free_heap_size.
  * This name will be removed in a future release.
  *
  * @return Available heap size, in bytes.
  */
uint32_t system_get_free_heap_size(void)  __attribute__ ((deprecated));

/**
 * @brief  Get one random 32-bit word from hardware RNG
 *
 * @return random value between 0 and UINT32_MAX
 */
uint32_t esp_random(void);

/**
  * @brief  Read hardware MAC address.
  *
  * In WiFi MAC, only ESP32 station MAC is the hardware MAC, ESP32 softAP MAC is a software MAC
  * calculated from ESP32 station MAC.
  * So users need to call esp_wifi_get_macaddr to query the ESP32 softAP MAC if ESP32 station MAC changed.
  *
  * @param  mac  hardware MAC address, length: 6 bytes.
  *
  * @return ESP_OK on success
  */
esp_err_t esp_efuse_read_mac(uint8_t* mac);

/**
  * @brief  Read hardware MAC address.
  *
  * Function has been renamed to esp_efuse_read_mac.
  * This name will be removed in a future release.
  *
  * @param  mac  hardware MAC address, length: 6 bytes.
  * @return ESP_OK on success
  */
esp_err_t system_efuse_read_mac(uint8_t mac[6]) __attribute__ ((deprecated));

/**
  * @brief  Read hardware MAC address and set MAC address of the interface.
  *
  * This function first reads hardware MAC address from efuse. Then set the MAC address of the interface
  * including wifi station, wifi softap, bluetooth and ethernet.
  *
  * @param  mac  MAC address of the interface, length: 6 bytes.
  * @param  type  type of MAC address, 0:wifi station, 1:wifi softap, 2:bluetooth, 3:ethernet.
  *
  * @return ESP_OK on success
  */
esp_err_t esp_read_mac(uint8_t* mac, esp_mac_type_t type);

/**
  * @brief  Derive MAC address.
  *
  * This function derives a local MAC address from an universal MAC address.
  * Addresses can either be universally administered addresses or locally administered addresses.
  * A universally administered address is uniquely assigned to a device by its manufacturer.
  * The first three octets (in transmission order) identify the organization that issued the identifier
  * and are known as the Organizationally Unique Identifier (OUI).[4] The remainder of the address
  * (three octets for MAC-48 and EUI-48 or five for EUI-64) are assigned by that organization in nearly
  * any manner they please, subject to the constraint of uniqueness. A locally administered address is
  * assigned to a device by a network administrator, overriding the burned-in address.
  * Universally administered and locally administered addresses are distinguished by setting
  * the second-least-significant bit of the first octet of the address. This bit is also referred to
  * as the U/L bit, short for Universal/Local, which identifies how the address is administered.
  * If the bit is 0, the address is universally administered. If it is 1, the address is locally administered.
  * In the example address 06-00-00-00-00-00 the first octet is 06 (hex), the binary form of which is 00000110,
  * where the second-least-significant bit is 1. Therefore, it is a locally administered address.[7] Consequently,
  * this bit is 0 in all OUIs.
  * In ESP32, universal MAC address is generated from the hardware MAC address in efuse.
  * Local MAC address is derived from the universal MAC address.
  *
  * @param  dst_mac  Derived local MAC address, length: 6 bytes.
  * @param  src_mac  Source universal MAC address, length: 6 bytes.
  *
  * @return ESP_OK on success
  */
esp_err_t esp_derive_mac(uint8_t* dst_mac, const uint8_t* src_mac);

/**
 * Get SDK version
 *
 * This function is deprecated and will be removed in a future release.
 *
 * @return constant string "master"
 */
const char* system_get_sdk_version(void)  __attribute__ ((deprecated));

/**
 * Get IDF version
 *
 * @return constant string from IDF_VER
 */
const char* esp_get_idf_version(void);

#ifdef __cplusplus
}
#endif

#endif /* __ESP_SYSTEM_H__ */


text:
require 'waste-memory/engine'

module WasteMemory
end


text:
#include "impl/data_router.h"

#include "impl/message.h"
#include "impl/net/remote_type_updater.h"

namespace ignite
{
    namespace impl
    {
        namespace thin
        {
            namespace net
            {
                RemoteTypeUpdater::RemoteTypeUpdater(DataRouter& router):
                    router(router)
                {
                    // No-op.
                }

                RemoteTypeUpdater::~RemoteTypeUpdater()
                {
                    // No-op.
                }

                bool RemoteTypeUpdater::Update(const binary::Snap& snapshot, IgniteError& err)
                {
                    BinaryTypePutRequest req(snapshot);
                    Response rsp;

                    try
                    {
                        router.SyncMessageNoMetaUpdate(req, rsp);
                    }
                    catch(const IgniteError& e)
                    {
                        err = e;

                        return false;
                    }

                    return true;
                }

                binary::SPSnap RemoteTypeUpdater::GetMeta(int32_t typeId, IgniteError& err)
                {
                    binary::SPSnap snap;

                    BinaryTypeGetRequest req(typeId);
                    BinaryTypeGetResponse rsp(snap);

                    try
                    {
                        router.SyncMessageNoMetaUpdate(req, rsp);
                    }
                    catch(const IgniteError& e)
                    {
                        err = e;

                        return binary::SPSnap();
                    }

                    return snap;
                }
            }
        }
    }
}


text:
<!doctype html>

<title>Static Files</title>
<link rel="stylesheet" type="text/css" href="/stylesheets/styles.css">

This is a static file serving example.


text:
package dot

import (
	"bytes"
	"context"
	"errors"
	"flag"
	"io/ioutil"

	"github.com/apache/beam/sdks/go/pkg/beam"
	dotlib "github.com/apache/beam/sdks/go/pkg/beam/core/util/dot"
)

func init() {
	beam.RegisterRunner("dot", Execute)
}

// Code for making DOT graphs of the Graph data structure

var dotFile = flag.String("dot_file", "", "DOT output file to create")

// Execute produces a DOT representation of the pipeline.
func Execute(ctx context.Context, p *beam.Pipeline) error {
	if *dotFile == "" {
		return errors.New("must supply dot_file argument")
	}

	edges, nodes, err := p.Build()
	if err != nil {
		return errors.New("can't get data to render")
	}

	var buf bytes.Buffer
	if err := dotlib.Render(edges, nodes, &buf); err != nil {
		return err
	}
	return ioutil.WriteFile(*dotFile, buf.Bytes(), 0644)
}


text:
/* Generated by camel build tools - do NOT edit this file! */
package org.apache.camel.component.drill;

import java.util.Map;

import org.apache.camel.CamelContext;
import org.apache.camel.spi.ExtendedPropertyConfigurerGetter;
import org.apache.camel.spi.PropertyConfigurerGetter;
import org.apache.camel.spi.ConfigurerStrategy;
import org.apache.camel.spi.GeneratedPropertyConfigurer;
import org.apache.camel.util.CaseInsensitiveMap;
import org.apache.camel.support.component.PropertyConfigurerSupport;

/**
 * Generated by camel build tools - do NOT edit this file!
 */
@SuppressWarnings("unchecked")
public class DrillEndpointConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer, PropertyConfigurerGetter {

    @Override
    public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) {
        DrillEndpoint target = (DrillEndpoint) obj;
        switch (ignoreCase ? name.toLowerCase() : name) {
        case "clusterid":
        case "clusterId": target.setClusterId(property(camelContext, java.lang.String.class, value)); return true;
        case "directory": target.setDirectory(property(camelContext, java.lang.String.class, value)); return true;
        case "lazystartproducer":
        case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true;
        case "mode": target.setMode(property(camelContext, org.apache.camel.component.drill.DrillConnectionMode.class, value)); return true;
        case "port": target.setPort(property(camelContext, java.lang.Integer.class, value)); return true;
        default: return false;
        }
    }

    @Override
    public Class<?> getOptionType(String name, boolean ignoreCase) {
        switch (ignoreCase ? name.toLowerCase() : name) {
        case "clusterid":
        case "clusterId": return java.lang.String.class;
        case "directory": return java.lang.String.class;
        case "lazystartproducer":
        case "lazyStartProducer": return boolean.class;
        case "mode": return org.apache.camel.component.drill.DrillConnectionMode.class;
        case "port": return java.lang.Integer.class;
        default: return null;
        }
    }

    @Override
    public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
        DrillEndpoint target = (DrillEndpoint) obj;
        switch (ignoreCase ? name.toLowerCase() : name) {
        case "clusterid":
        case "clusterId": return target.getClusterId();
        case "directory": return target.getDirectory();
        case "lazystartproducer":
        case "lazyStartProducer": return target.isLazyStartProducer();
        case "mode": return target.getMode();
        case "port": return target.getPort();
        default: return null;
        }
    }
}


text:
using namespace std;

namespace Groups {
 typedef Dihedral::elem_t elem_t;

 elem_t Dihedral::oper(const elem_t& x, const elem_t& y) const {
  return y.first ? elem_t(!x.first, modulo(y.second - x.second, n))
		 : elem_t(x.first,  modulo(y.second + x.second, n));
 }

 elem_t Dihedral::identity() const {return elem_t(false, 0); }

 vector<elem_t> Dihedral::elements() const {return cartesian(vecFT, vecN(n)); }

 elem_t Dihedral::invert(const elem_t& x) const {
  return x.first ? x : elem_t(false, modulo(-x.second, n));
 }

 int Dihedral::order() const {return 2 * n; }

 int Dihedral::order(const elem_t& x) const {
  return x.first ? 2 : n/gcd(x.second, n);
 }

 string Dihedral::showElem(const elem_t& x) const {
  if (!x.first && x.second == 0) return "1";
  else {
   ostringstream out;
   if (x.first) out << "s";
   expgen(out, "r", x.second, "");
   return out.str();
  }
 }

 bool Dihedral::isAbelian() const {return n < 3; }

 Dihedral* Dihedral::copy() const {return new Dihedral(n); }

 int Dihedral::cmp(const basic_group<elem_t>* other) const {
  int ct = cmpTypes(*this, *other);
  if (ct != 0) return ct;
  const Dihedral* c = static_cast<const Dihedral*>(other);
  return cmp(*c);
 }

 int Dihedral::cmp(const Dihedral& other) const {return n - other.n; }

 bool Dihedral::contains(const elem_t& x) const {
  return 0 <= x.second && x.second < n;
 }

 int Dihedral::indexElem(const elem_t& x) const {
  if (contains(x)) return x.second + x.first * n;
  else throw group_mismatch("Dihedral::indexElem");
 }

 int Dihedral::exponent() const {return lcm(2,n); }
}


text:
namespace SchoolSystem.Models
{
    using System;

    using Contracts;
    using Enums;

    public class Teacher : Person, ITeacher
    {
        private const int MaxStudentMarks = 20;

        public Teacher(string firstName, string lastName, Subject subject)
            : base(firstName, lastName)
        {
            this.Subject = subject;
        }

        public Subject Subject { get; set; }

        public void AddMark(IStudent student, float value)
        {
            if (student.Marks.Count > MaxStudentMarks)
            {
                throw new ArgumentException($"A student cannot have more than {MaxStudentMarks} marks!");
            }

            var mark = new Mark(this.Subject, value);
            student.Marks.Add(mark);
        }
    }
}


text:
'use strict';
var util = require('util');
var path = require('path');
var yeoman = require('yeoman-generator');

var RunGenerator = module.exports = function RunGenerator(args, options, config) {
  yeoman.generators.Base.apply(this, arguments);
};

util.inherits(RunGenerator, yeoman.generators.Base);

RunGenerator.prototype.help = function app() {
  console.log('Try one of these:');
  console.log('  `yo rendr:view <view-name>`');
  console.log('  `yo rendr:model <model-name>`');
  console.log('  `yo rendr:collection <collection-name>`');
  console.log('  `yo rendr:controller <controller-name>`');
};


text:
import React, { PropTypes } from 'react';
import { get } from 'lodash';

import WithApi from 'api/WithApi';
import Person from '../Person';

import {
  // STATUS_INIT,
  STATUS_LOADING,
  STATUS_LOADED,
  STATUS_ERROR,
} from 'utils/constants';

export default function (Component) {
  @WithApi
  class WithLegislators extends React.PureComponent {
    static propTypes = {
      fetchData: PropTypes.func,
      apiData: PropTypes.object,
      apiStauts: PropTypes.object,
      setInited: PropTypes.func,
      setError: PropTypes.func,
    }

    constructor(props) {
      super(props);
      this.state = {
        pos: ['posts', 1],
      };
    }

    componentDidMount() {
      const {
        apiStauts,
        setInited,
      } = this.props;
      const { pos } = this.state;

      if (!get(apiStauts, pos)) {
        this.loadData();
      } else if (get(apiStauts, pos) === STATUS_LOADED) {
        setInited();
      }
    }

    componentWillReceiveProps(nextProps) {
      const { apiStauts, setInited } = this.props;
      const { pos } = this.state;

      if (get(apiStauts, pos) === STATUS_LOADING && get(nextProps.apiStauts, pos) === STATUS_LOADED) {
        setInited();
      }
    }

    loadData() {
      const {
        fetchData,
      } = this.props;
      fetchData('posts/1', {
        include: [
          'memberships.person.memberships.post.classification',
          'memberships.person.memberships.organization',
        ],
      });
    }

    render() {
      const {
        pos,
      } = this.state;

      const {
        apiData,
        apiStauts,
        setError,
      } = this.props;

      try {
        // if find no data, will throw error
        const legislators = get(apiData, pos).memberships.data.reduce((list, data) => {
          const person = new Person(data.person);
          const withMeta = person.transform('meta');
          list.push(withMeta);
          return list;
        }, []);

        return (
          <Component
            {...this.props}
            legislators={legislators}
          />
        );
      } catch (e) {
        if (apiStauts === STATUS_ERROR) setError(null, this.loadData);
        return null;
      }
    }
  }

  return WithLegislators;
}


text:
@echo off
rem Process the first argument
if ""%1"" == """" goto end
if "%CLASSPATH%" == "" goto emptyCP
set CLASSPATH=%CLASSPATH%;%1
shift
goto notEmptyCP
:emptyCP
set CLASSPATH=%1
:notEmptyCP

:end