text:
<project name="dssh4j" basedir="." default="all">
    <property name="project_name" value="dssh4j"></property>
    <property name="project_version" value="1.0.0"></property>
    <property name="package_name" value="${project_name}-${project_version}"></property>
    <property name="src_dir" value="${basedir}/src"></property>
	<property name="conf_dir" value="${basedir}/conf"></property>
    <property name="lib_dir" value="${basedir}/lib"></property>
    <property name="build_dir" value="${basedir}/temp"></property>
    <property name="dist_dir" value="${basedir}/dist"></property>

    <path id="app.classpath">
        <fileset dir="${lib_dir}">
            <include name="**/*.jar" />
        </fileset>
        <path location="${basedir}/config" />
        <path location="${basedir}/resources" />
    </path>

    <target name="clean">
        <delete dir="${build_dir}"></delete>
        <delete dir="${dist_dir}"></delete>
    </target>

    <target name="prepare">
        <mkdir dir="${build_dir}" />
        <mkdir dir="${build_dir}/${package_name}" />
        <mkdir dir="${dist_dir}" />
    </target>

    <target name="compile">
        <javac srcdir="${src_dir}" destdir="${build_dir}/${package_name}" debug="on" source="1.6" includeantruntime="on">
            <classpath refid="app.classpath">
            </classpath>
        </javac>
    </target>

    <target name="jar">
        <jar destfile="${dist_dir}/${package_name}.jar" basedir="${build_dir}/${package_name}">
            <manifest>
                <attribute name="Created-By" value="NieYong, http://aofengblog.blog.163.com" />
                <attribute name="Built-By" value="NieYong, http://aofengblog.blog.163.com" />
                <attribute name="Implementation-Vendor" value="NieYong" />
                <attribute name="Implementation-Title" value="NieYong" />
                <attribute name="Implementation-Version" value="1.0.0" />
            </manifest>
        </jar>
    </target>

    <target name="jar-src">
        <jar destfile="${dist_dir}/${package_name}-src.jar" basedir="${src_dir}">
            <manifest>
                <attribute name="Built-By" value="NieYong, http://aofengblog.blog.163.com" />
                <attribute name="Implementation-Vendor" value="NieYong" />
                <attribute name="Implementation-Title" value="NieYong" />
                <attribute name="Implementation-Version" value="1.0.0" />
            </manifest>
        </jar>
    </target>

	<target name="run_jar" depends="clean, prepare, compile ">
	        <jar destfile="${dist_dir}/${package_name}.jar">
	            <manifest>
	                <attribute name="Main-Class" value="org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader"/>
	                <attribute name="Rsrc-Main-Class" value="cn.aofeng.pssh4j.Dssh"/>
	                <attribute name="Class-Path" value="."/>
	                <attribute name="Rsrc-Class-Path" value="./ log4j-1.2.16.jar common4j-0.2.1.jar jsch-0.1.51.jar commons-cli-1.2.jar"/>
	            </manifest>
	            <zipfileset src="jar-in-jar-loader.zip"/>
	            <fileset dir="${build_dir}/${package_name}"/>
	        	<fileset dir="${conf_dir}">
	        		<include name="log4j.dtd"/>
	        		<include name="log4j.xml" />
	        	</fileset>
	            <zipfileset dir="${lib_dir}" includes="log4j-1.2.16.jar"/>
	            <zipfileset dir="${lib_dir}" includes="common4j-0.2.1.jar"/>
	            <zipfileset dir="${lib_dir}" includes="jsch-0.1.51.jar"/>
	            <zipfileset dir="${lib_dir}" includes="commons-cli-1.2.jar"/>
	        </jar>
	    </target>

    <target name="all" depends="clean, prepare, compile, jar, jar-src">
    </target>
</project>


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.
 */
package org.ngrinder.script.controller;

import com.google.common.base.Predicate;
import com.nhncorp.lucy.security.xss.XssPreventer;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.ngrinder.common.controller.BaseController;
import org.ngrinder.common.controller.RestAPI;
import org.ngrinder.common.util.HttpContainerContext;
import org.ngrinder.common.util.PathUtils;
import org.ngrinder.common.util.UrlUtils;
import org.ngrinder.infra.spring.RemainedPath;
import org.ngrinder.model.User;
import org.ngrinder.script.handler.ProjectHandler;
import org.ngrinder.script.handler.ScriptHandler;
import org.ngrinder.script.handler.ScriptHandlerFactory;
import org.ngrinder.script.model.FileCategory;
import org.ngrinder.script.model.FileEntry;
import org.ngrinder.script.model.FileType;
import org.ngrinder.script.service.FileEntryService;
import org.ngrinder.script.service.ScriptValidationService;
import org.python.google.common.collect.Maps;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import javax.annotation.Nullable;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static com.google.common.collect.Iterables.filter;
import static com.google.common.collect.Lists.newArrayList;
import static java.util.Collections.sort;
import static org.apache.commons.io.FilenameUtils.getPath;
import static org.ngrinder.common.util.ExceptionUtils.processException;
import static org.ngrinder.common.util.PathUtils.removePrependedSlash;
import static org.ngrinder.common.util.PathUtils.trimPathSeparatorBothSides;
import static org.ngrinder.common.util.Preconditions.checkNotNull;

/**
 * FileEntry manipulation controller.
 *
 * @author JunHo Yoon
 * @since 3.0
 */
@Controller
@RequestMapping("/script")
public class FileEntryController extends BaseController {

	private static final Logger LOG = LoggerFactory.getLogger(FileEntryController.class);

	@Autowired
	private FileEntryService fileEntryService;

	@Autowired
	private ScriptValidationService scriptValidationService;

	@Autowired
	private ScriptHandlerFactory handlerFactory;

	@Autowired
	HttpContainerContext httpContainerContext;

	/**
	 * Get the list of file entries for the given user.
	 *
	 * @param user  current user
	 * @param path  path looking for.
	 * @param model model.
	 * @return script/list
	 */
	@RequestMapping({"/list/**", ""})
	public String getAll(User user, final @RemainedPath String path, ModelMap model) { // "fileName"
		model.addAttribute("files", getAllFiles(user, path));
		model.addAttribute("currentPath", path);
		model.addAttribute("svnUrl", getSvnUrlBreadcrumbs(user, path));
		model.addAttribute("handlers", handlerFactory.getVisibleHandlers());
		return "script/list";
	}

	/**
	 * Get the SVN url BreadCrumbs HTML string.
	 *
	 * @param user user
	 * @param path path
	 * @return generated HTML
	 */
	public String getSvnUrlBreadcrumbs(User user, String path) {
		String contextPath = httpContainerContext.getCurrentContextUrlFromUserRequest();
		String[] parts = StringUtils.split(path, '/');
		StringBuilder accumulatedPart = new StringBuilder(contextPath).append("/script/list");
		StringBuilder returnHtml = new StringBuilder().append("")
				.append(contextPath).append("/svn/").append(user.getUserId()).append("");
		for (String each : parts) {
			returnHtml.append("/");
			accumulatedPart.append("/").append(each);
			returnHtml.append("").append(each).append("");
		}
		return returnHtml.toString();
	}

	/**
	 * Get the script path BreadCrumbs HTML string.
	 *
	 * @param path path
	 * @return generated HTML
	 */
	public String getScriptPathBreadcrumbs(String path) {
		String contextPath = httpContainerContext.getCurrentContextUrlFromUserRequest();
		String[] parts = StringUtils.split(path, '/');
		StringBuilder accumulatedPart = new StringBuilder(contextPath).append("/script/list");
		StringBuilder returnHtml = new StringBuilder();
		for (int i = 0; i < parts.length; i++) {
			String each = parts[i];
			accumulatedPart.append("/").append(each);
			if (i != parts.length - 1) {
				returnHtml.append("").append(each)
						.append("").append("/");
			} else {
				returnHtml.append(each);
			}
		}
		return returnHtml.toString();
	}

	/**
	 * Add a folder on the given path.
	 *
	 * @param user       current user
	 * @param path       path in which folder will be added
	 * @param folderName folderName
	 * @param model      model.
	 * @return redirect:/script/list/${path}
	 */
	@RequestMapping(value = "/new/**", params = "type=folder", method = RequestMethod.POST)
	public String addFolder(User user, @RemainedPath String path, @RequestParam("folderName") String folderName,
	                        ModelMap model) { // "fileName"
		fileEntryService.addFolder(user, path, StringUtils.trimToEmpty(folderName), "");
		model.clear();
		return "redirect:/script/list/" + path;
	}

	/**
	 * Provide new file creation form data.
	 *
	 * @param user                  current user
	 * @param path                  path in which a file will be added
	 * @param testUrl               url which the script may use
	 * @param fileName              fileName
	 * @param scriptType            Type of script. optional
	 * @param createLibAndResources true if libs and resources should be created as well.
	 * @param redirectAttributes    redirect attributes storage
	 * @param model                 model.
	 * @return script/editor"
	 */
	@RequestMapping(value = "/new/**", params = "type=script", method = RequestMethod.POST)
	public String createForm(User user, @RemainedPath String path,
	                         @RequestParam(value = "testUrl", required = false) String testUrl,
	                         @RequestParam("fileName") String fileName,
	                         @RequestParam(value = "scriptType", required = false) String scriptType,
	                         @RequestParam(value = "createLibAndResource", defaultValue = "false") boolean createLibAndResources,
	                         @RequestParam(value = "options", required = false) String options,
	                         RedirectAttributes redirectAttributes, ModelMap model) {
		fileName = StringUtils.trimToEmpty(fileName);
		String name = "Test1";
		if (StringUtils.isEmpty(testUrl)) {
			testUrl = StringUtils.defaultIfBlank(testUrl, "http://please_modify_this.com");
		} else {
			name = UrlUtils.getHost(testUrl);
		}
		ScriptHandler scriptHandler = fileEntryService.getScriptHandler(scriptType);
		FileEntry entry = new FileEntry();
		entry.setPath(fileName);
		if (scriptHandler instanceof ProjectHandler) {
			if (!fileEntryService.hasFileEntry(user, PathUtils.join(path, fileName))) {
				fileEntryService.prepareNewEntry(user, path, fileName, name, testUrl, scriptHandler,
						createLibAndResources, options);
				redirectAttributes.addFlashAttribute("message", fileName + " project is created.");
				return "redirect:/script/list/" + path + "/" + fileName;
			} else {
				redirectAttributes.addFlashAttribute("exception", fileName
						+ " is already existing. Please choose the different name");
				return "redirect:/script/list/" + path + "/";
			}

		} else {
			String fullPath = PathUtils.join(path, fileName);
			if (fileEntryService.hasFileEntry(user, fullPath)) {
				model.addAttribute("file", fileEntryService.getOne(user, fullPath));
			} else {
				model.addAttribute("file", fileEntryService.prepareNewEntry(user, path, fileName, name, testUrl,
						scriptHandler, createLibAndResources, options));
			}
		}
		model.addAttribute("breadcrumbPath", getScriptPathBreadcrumbs(PathUtils.join(path, fileName)));
		model.addAttribute("scriptHandler", scriptHandler);
		model.addAttribute("createLibAndResource", createLibAndResources);
		return "script/editor";
	}

	/**
	 * Get the details of given path.
	 *
	 * @param user     user
	 * @param path     user
	 * @param revision revision. -1 if HEAD
	 * @param model    model
	 * @return script/editor
	 */
	@RequestMapping("/detail/**")
	public String getOne(User user, @RemainedPath String path,
	                     @RequestParam(value = "r", required = false) Long revision, ModelMap model) {
		FileEntry script = fileEntryService.getOne(user, path, revision);
		if (script == null || !script.getFileType().isEditable()) {
			LOG.error("Error while getting file detail on {}. the file does not exist or not editable", path);
			model.clear();
			return "redirect:/script/";
		}
		model.addAttribute("file", script);
		model.addAttribute("lastRevision", script.getLastRevision());
		model.addAttribute("curRevision", script.getRevision());
		model.addAttribute("scriptHandler", fileEntryService.getScriptHandler(script));
		model.addAttribute("ownerId", user.getUserId());
		model.addAttribute("breadcrumbPath", getScriptPathBreadcrumbs(path));
		return "script/editor";
	}

	/**
	 * Download file entry of given path.
	 *
	 * @param user     current user
	 * @param path     user
	 * @param response response
	 */
	@RequestMapping("/download/**")
	public void download(User user, @RemainedPath String path, HttpServletResponse response) {
		FileEntry fileEntry = fileEntryService.getOne(user, path);
		if (fileEntry == null) {
			LOG.error("{} requested to download not existing file entity {}", user.getUserId(), path);
			return;
		}
		response.reset();
		try {
			response.addHeader(
					"Content-Disposition",
					"attachment;filename="
							+ java.net.URLEncoder.encode(FilenameUtils.getName(fileEntry.getPath()), "utf8"));
		} catch (UnsupportedEncodingException e1) {
			LOG.error(e1.getMessage(), e1);
		}
		response.setContentType("application/octet-stream; charset=UTF-8");
		response.addHeader("Content-Length", "" + fileEntry.getFileSize());
		byte[] buffer = new byte[4096];
		ByteArrayInputStream fis = null;
		OutputStream toClient = null;
		try {
			fis = new ByteArrayInputStream(fileEntry.getContentBytes());
			toClient = new BufferedOutputStream(response.getOutputStream());
			int readLength;
			while (((readLength = fis.read(buffer)) != -1)) {
				toClient.write(buffer, 0, readLength);
			}
		} catch (IOException e) {
			throw processException("error while download file", e);
		} finally {
			IOUtils.closeQuietly(fis);
			IOUtils.closeQuietly(toClient);
		}
	}

	/**
	 * Search files on the query.
	 *
	 * @param user  current user
	 * @param query query string
	 * @param model model
	 * @return script/list
	 */
	@RequestMapping(value = "/search/**")
	public String search(User user, @RequestParam(required = true, value = "query") final String query,
	                     ModelMap model) {
		final String trimmedQuery = StringUtils.trimToEmpty(query);
		List<FileEntry> searchResult = newArrayList(filter(fileEntryService.getAll(user),
				new Predicate<FileEntry>() {
					@Override
					public boolean apply(@Nullable FileEntry input) {
						return input != null && input.getFileType() != FileType.DIR && StringUtils.containsIgnoreCase(new File(input.getPath()).getName(), trimmedQuery);
					}
				}));
		model.addAttribute("query", query);
		model.addAttribute("files", searchResult);
		model.addAttribute("currentPath", "");
		return "script/list";
	}

	/**
	 * Save a fileEntry and return to the the path.
	 *
	 * @param user                 current user
	 * @param fileEntry            file to be saved
	 * @param targetHosts          target host parameter
	 * @param validated            validated the script or not, 1 is validated, 0 is not.
	 * @param createLibAndResource true if lib and resources should be created as well.
	 * @param model                model
	 * @return redirect:/script/list/${basePath}
	 */
	@RequestMapping(value = "/save/**", method = RequestMethod.POST)
	public String save(User user, FileEntry fileEntry,
	                   @RequestParam String targetHosts, @RequestParam(defaultValue = "0") String validated,
	                   @RequestParam(defaultValue = "false") boolean createLibAndResource, ModelMap model) {
		if (fileEntry.getFileType().getFileCategory() == FileCategory.SCRIPT) {
			Map<String, String> map = Maps.newHashMap();
			map.put("validated", validated);
			map.put("targetHosts", StringUtils.trim(targetHosts));
			fileEntry.setProperties(map);
		}
		fileEntryService.save(user, fileEntry);

		String basePath = getPath(fileEntry.getPath());
		if (createLibAndResource) {
			fileEntryService.addFolder(user, basePath, "lib", getMessages("script.commit.libFolder"));
			fileEntryService.addFolder(user, basePath, "resources", getMessages("script.commit.resourceFolder"));
		}
		model.clear();
		return "redirect:/script/list/" + basePath;
	}

	/**
	 * Upload a file.
	 *
	 * @param user        current user
	 * @param path        path
	 * @param description description
	 * @param file        multi part file
	 * @param model       model
	 * @return redirect:/script/list/${path}
	 */
	@RequestMapping(value = "/upload/**", method = RequestMethod.POST)
	public String upload(User user, @RemainedPath String path, @RequestParam("description") String description,
	                     @RequestParam("uploadFile") MultipartFile file, ModelMap model) {
		try {
			description = XssPreventer.escape(description);
			upload(user, path, description, file);
			model.clear();
			return "redirect:/script/list/" + path;
		} catch (IOException e) {
			LOG.error("Error while getting file content: {}", e.getMessage(), e);
			throw processException("Error while getting file content:" + e.getMessage(), e);
		}
	}

	private void upload(User user, String path, String description, MultipartFile file) throws IOException {
		FileEntry fileEntry = new FileEntry();
		fileEntry.setContentBytes(file.getBytes());
		fileEntry.setDescription(description);
		fileEntry.setPath(FilenameUtils.separatorsToUnix(FilenameUtils.concat(path, file.getOriginalFilename())));
		fileEntryService.save(user, fileEntry);
	}

	/**
	 * Delete files on the given path.
	 *
	 * @param user        user
	 * @param path        base path
	 * @param filesString file list delimited by ","
	 * @return json string
	 */
	@RequestMapping(value = "/delete/**", method = RequestMethod.POST)
	@ResponseBody
	public String delete(User user, @RemainedPath String path, @RequestParam("filesString") String filesString) {
		String[] files = filesString.split(",");
		fileEntryService.delete(user, path, files);
		Map<String, Object> rtnMap = new HashMap<String, Object>(1);
		rtnMap.put(JSON_SUCCESS, true);
		return toJson(rtnMap);
	}

	/**
	 * Create the given file.
	 *
	 * @param user      user
	 * @param fileEntry file entry
	 * @return success json string
	 */
	@RestAPI
	@RequestMapping(value = {"/api/", "/api"}, method = RequestMethod.POST)
	public HttpEntity<String> create(User user, FileEntry fileEntry) {
		fileEntryService.save(user, fileEntry);
		return successJsonHttpEntity();
	}

	/**
	 * Create the given file.
	 *
	 * @param user        user
	 * @param path        path
	 * @param description description
	 * @param file        multi part file
	 * @return success json string
	 */
	@RestAPI
	@RequestMapping(value = "/api/**", params = "action=upload", method = RequestMethod.POST)
	public HttpEntity<String> uploadForAPI(User user, @RemainedPath String path,
	                                       @RequestParam("description") String description,
	                                       @RequestParam("uploadFile") MultipartFile file) throws IOException {
		upload(user, path, description, file);
		return successJsonHttpEntity();
	}

	/**
	 * Check the file by given path.
	 *
	 * @param user user
	 * @param path path
	 * @return json string
	 */
	@RestAPI
	@RequestMapping(value = "/api/**", params = "action=view", method = RequestMethod.GET)
	public HttpEntity<String> viewOne(User user, @RemainedPath String path) {
		FileEntry fileEntry = fileEntryService.getOne(user, path, -1L);
		return toJsonHttpEntity(checkNotNull(fileEntry
				, "%s file is not viewable", path));
	}

	/**
	 * Get all files which belongs to given user.
	 *
	 * @param user user
	 * @return json string
	 */
	@RestAPI
	@RequestMapping(value = {"/api/**", "/api/", "/api"}, params = "action=all", method = RequestMethod.GET)
	public HttpEntity<String> getAll(User user) {
		return toJsonHttpEntity(fileEntryService.getAll(user));
	}

	/**
	 * Get all files which belongs to given user and path.
	 *
	 * @param user user
	 * @param path path
	 * @return json string
	 */
	@RestAPI
	@RequestMapping(value = {"/api/**", "/api/", "/api"}, method = RequestMethod.GET)
	public HttpEntity<String> getAll(User user, @RemainedPath String path) {
		return toJsonHttpEntity(getAllFiles(user, path));
	}

	private List<FileEntry> getAllFiles(User user, String path) {
		final String trimmedPath = StringUtils.trimToEmpty(path);
		List<FileEntry> files = newArrayList(filter(fileEntryService.getAll(user),
				new Predicate<FileEntry>() {
					@Override
					public boolean apply(@Nullable FileEntry input) {
						return input != null && trimPathSeparatorBothSides(getPath(input.getPath())).equals(trimmedPath);
					}
				}));
		sort(files, new Comparator<FileEntry>() {
			@Override
			public int compare(FileEntry o1, FileEntry o2) {
				if (o1.getFileType() == FileType.DIR && o2.getFileType() != FileType.DIR) {
					return -1;
				}
				return (o1.getFileName().compareTo(o2.getFileName()));
			}

		});
		for (FileEntry each : files) {
			each.setPath(removePrependedSlash(each.getPath()));
		}
		return files;
	}

	/**
	 * Delete file by given user and path.
	 *
	 * @param user user
	 * @param path path
	 * @return json string
	 */
	@RestAPI
	@RequestMapping(value = "/api/**", method = RequestMethod.DELETE)
	public HttpEntity<String> deleteOne(User user, @RemainedPath String path) {
		fileEntryService.delete(user, path);
		return successJsonHttpEntity();
	}

	/**
	 * Validate the script.
	 *
	 * @param user       current user
	 * @param fileEntry  fileEntry
	 * @param hostString hostString
	 * @return validation Result string
	 */
	@RequestMapping(value = "/api/validate", method = RequestMethod.POST)
	@RestAPI
	public HttpEntity<String> validate(User user, FileEntry fileEntry,
	                                   @RequestParam(value = "hostString", required = false) String hostString) {
		fileEntry.setCreatedUser(user);
		return toJsonHttpEntity(scriptValidationService.validate(user, fileEntry, false, hostString));
	}
}

redpajama_set_name: RedPajamaGithub


text:
namespace MulticastUDP.packets {
    public class SamplePacket : Packet {
        public double DoubleValue {get;set;}
        public string StringValue {get;set;}
        public DateTime DateTimeValue {get;set}

        public override PACKETTYPE PacketType {get { return PACKETTYPE.SAMPLE; }}

        public SamplePacket() : base() {}
        public SamplePacket(bool isHeartBeat) : base(isHeartBeat) {}
        public SamplePacket(byte[] theBytes) : base(theBytes){}

        public SamplePackdet(SamplePacket thePacket) : base(thePacket) {
            DoubleValue = thePacket.DoubleValue;
            StringValue = thePacket.StringValue;
            DateTimeValue = thePacket.DateTimeValue;
        }

        protected override void setDefaultValues() {
            DoubleValue = 0;
            StringValue = "Sample"
            DateTimeValue = DateTime.Now();
        }

    }
}


text:
<?php

// LesVirtualMarketBundle:VirtualMarket/Blocks:searchForm.html.twig
return array (
);


text:
package org.wso2.carbon.application.deployer.gadget.internal;

import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.component.ComponentContext;
import org.wso2.carbon.application.deployer.AppDeployerConstants;
import org.wso2.carbon.application.deployer.AppDeployerUtils;
import org.wso2.carbon.application.deployer.Feature;
import org.wso2.carbon.application.deployer.gadget.GadgetAppDeployer;
import org.wso2.carbon.application.deployer.handler.AppDeploymentHandler;

import java.io.InputStream;
import java.net.URL;
import java.util.List;
import java.util.Map;

/**
 * @scr.component name="application.deployer.gadget" immediate="true"
 */
public class GadgetAppDeployerDSComponent {

    private static Log log = LogFactory.getLog(GadgetAppDeployerDSComponent.class);

    private static Map<String, List<Feature>> requiredFeatures;

    private static ServiceRegistration appHandlerRegistration;

    protected void activate(ComponentContext ctxt) {
        try {
            // register gadget deployer as an OSGi service
            GadgetAppDeployer gadgetDeployer = new GadgetAppDeployer();
            appHandlerRegistration = ctxt.getBundleContext().registerService(
                    AppDeploymentHandler.class.getName(), gadgetDeployer, null);

            // read required-features.xml
            URL reqFeaturesResource = ctxt.getBundleContext().getBundle()
                    .getResource(AppDeployerConstants.REQ_FEATURES_XML);
            if (reqFeaturesResource != null) {
                InputStream xmlStream = reqFeaturesResource.openStream();
                requiredFeatures = AppDeployerUtils
                        .readRequiredFeaturs(new StAXOMBuilder(xmlStream).getDocumentElement());
            }
        } catch (Throwable e) {
            log.error("Failed to activate Gadget Application Deployer", e);
        }
    }

    protected void deactivate(ComponentContext ctxt) {
        // Unregister the OSGi service
        if (appHandlerRegistration != null) {
            appHandlerRegistration.unregister();
        }
    }

    public static Map<String, List<Feature>> getRequiredFeatures() {
        return requiredFeatures;
    }

}


text:
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

using System;
using System.Collections.Generic;
using System.Net;
using Org.Apache.REEF.Tang.Annotations;
using Org.Apache.REEF.Utilities.Logging;
using Org.Apache.REEF.Wake.Util;

namespace Org.Apache.REEF.Wake.Remote.Impl
{
    /// <summary>
    /// Manages incoming and outgoing messages between remote hosts.
    /// </summary>
    public sealed class DefaultRemoteManager<T> : IRemoteManager<T>
    {
        private static readonly Logger LOGGER = Logger.GetLogger(typeof(DefaultRemoteManager<T>));

        private readonly ObserverContainer<T> _observerContainer;
        private readonly TransportServer<IRemoteEvent<T>> _server;
        private readonly Dictionary<IPEndPoint, ProxyObserver> _cachedClients;
        private readonly ICodec<IRemoteEvent<T>> _codec;

        /// <summary>
        /// Constructs a DefaultRemoteManager listening on the specified address and any
        /// available port.
        /// </summary>
        /// <param name="localAddress">The address to listen on</param>
        /// <param name="port">The port to listen on</param>
        /// <param name="codec">The codec used for serializing messages</param>
        /// <param name="tcpPortProvider">provides port numbers to listen</param>
        internal DefaultRemoteManager(IPAddress localAddress, int port, ICodec<T> codec, ITcpPortProvider tcpPortProvider)
        {
            if (localAddress == null)
            {
                throw new ArgumentNullException("localAddress");
            }
            if (port < 0)
            {
                throw new ArgumentException("Listening port must be greater than or equal to zero");
            }
            if (codec == null)
            {
                throw new ArgumentNullException("codec");
            }

            _observerContainer = new ObserverContainer<T>();
            _codec = new RemoteEventCodec<T>(codec);
            _cachedClients = new Dictionary<IPEndPoint, ProxyObserver>();

            IPEndPoint localEndpoint = new IPEndPoint(localAddress, port);

            // Begin to listen for incoming messages
            _server = new TransportServer<IRemoteEvent<T>>(localEndpoint, _observerContainer, _codec,
                tcpPortProvider);
            _server.Run();

            LocalEndpoint = _server.LocalEndpoint;
            Identifier = new SocketRemoteIdentifier(LocalEndpoint);
        }

        /// <summary>
        /// Constructs a DefaultRemoteManager. Does not listen for incoming messages.
        /// </summary>
        /// <param name="codec">The codec used for serializing messages</param>
        internal DefaultRemoteManager(ICodec<T> codec)
        {
            using (LOGGER.LogFunction("DefaultRemoteManager::DefaultRemoteManager"))
            {
                if (codec == null)
                {
                    throw new ArgumentNullException("codec");
                }

                _observerContainer = new ObserverContainer<T>();
                _codec = new RemoteEventCodec<T>(codec);
                _cachedClients = new Dictionary<IPEndPoint, ProxyObserver>();

                LocalEndpoint = new IPEndPoint(NetworkUtils.LocalIPAddress, 0);
                Identifier = new SocketRemoteIdentifier(LocalEndpoint);
            }
        }

        /// <summary>
        /// Gets the RemoteIdentifier for the DefaultRemoteManager
        /// </summary>
        public IRemoteIdentifier Identifier { get; private set; }

        /// <summary>
        /// Gets the local IPEndPoint for the DefaultRemoteManager
        /// </summary>
        public IPEndPoint LocalEndpoint { get; private set; }

        /// <summary>
        /// Returns an IObserver used to send messages to the remote host at
        /// the specified IPEndpoint.
        /// </summary>
        /// <param name="remoteEndpoint">The IPEndpoint of the remote host</param>
        /// <returns>An IObserver used to send messages to the remote host</returns>
        public IObserver<T> GetRemoteObserver(RemoteEventEndPoint<T> remoteEndpoint)
        {
            if (remoteEndpoint == null)
            {
                throw new ArgumentNullException("remoteEndpoint");
            }

            SocketRemoteIdentifier id = remoteEndpoint.Id as SocketRemoteIdentifier;
            if (id == null)
            {
                throw new ArgumentException("ID not supported");
            }

            return GetRemoteObserver(id.Addr);
        }

        /// <summary>
        /// Returns an IObserver used to send messages to the remote host at
        /// the specified IPEndpoint.
        /// </summary>
        /// <param name="remoteEndpoint">The IPEndpoint of the remote host</param>
        /// <returns>An IObserver used to send messages to the remote host</returns>
        public IObserver<T> GetRemoteObserver(IPEndPoint remoteEndpoint)
        {
            if (remoteEndpoint == null)
            {
                throw new ArgumentNullException("remoteEndpoint");
            }

            ProxyObserver remoteObserver;
            if (!_cachedClients.TryGetValue(remoteEndpoint, out remoteObserver))
            {
                TransportClient<IRemoteEvent<T>> client =
                    new TransportClient<IRemoteEvent<T>>(remoteEndpoint, _codec, _observerContainer);
                var msg = string.Format("NewClientConnection: Local {0} connected to Remote {1}",
                    client.Link.LocalEndpoint.ToString(),
                    client.Link.RemoteEndpoint.ToString());
                LOGGER.Log(Level.Info, msg);

                remoteObserver = new ProxyObserver(client);
                _cachedClients[remoteEndpoint] = remoteObserver;
            }

            return remoteObserver;
        }

        /// <summary>
        /// Registers an IObserver used to handle incoming messages from the remote host
        /// at the specified IPEndPoint.
        /// The IDisposable that is returned can be used to unregister the IObserver.
        /// </summary>
        /// <param name="remoteEndpoint">The IPEndPoint of the remote host</param>
        /// <param name="observer">The IObserver to handle incoming messages</param>
        /// <returns>An IDisposable used to unregister the observer with</returns>
        public IDisposable RegisterObserver(RemoteEventEndPoint<T> remoteEndpoint, IObserver<T> observer)
        {
            if (remoteEndpoint == null)
            {
                throw new ArgumentNullException("remoteEndpoint");
            }

            SocketRemoteIdentifier id = remoteEndpoint.Id as SocketRemoteIdentifier;
            if (id == null)
            {
                throw new ArgumentException("ID not supported");
            }

            return RegisterObserver(id.Addr, observer);
        }

        /// <summary>
        /// Registers an IObserver used to handle incoming messages from the remote host
        /// at the specified IPEndPoint.
        /// The IDisposable that is returned can be used to unregister the IObserver.
        /// </summary>
        /// <param name="remoteEndpoint">The IPEndPoint of the remote host</param>
        /// <param name="observer">The IObserver to handle incoming messages</param>
        /// <returns>An IDisposable used to unregister the observer with</returns>
        public IDisposable RegisterObserver(IPEndPoint remoteEndpoint, IObserver<T> observer)
        {
            if (remoteEndpoint == null)
            {
                throw new ArgumentNullException("remoteEndpoint");
            }
            if (observer == null)
            {
                throw new ArgumentNullException("observer");
            }

            return _observerContainer.RegisterObserver(remoteEndpoint, observer);
        }

        /// <summary>
        /// Registers an IObserver used to handle incoming messages from the remote host
        /// at the specified IPEndPoint.
        /// The IDisposable that is returned can be used to unregister the IObserver.
        /// </summary>
        /// <param name="observer">The IObserver to handle incoming messages</param>
        /// <returns>An IDisposable used to unregister the observer with</returns>
        public IDisposable RegisterObserver(IObserver<IRemoteMessage<T>> observer)
        {
            if (observer == null)
            {
                throw new ArgumentNullException("observer");
            }

            return _observerContainer.RegisterObserver(observer);
        }

        /// <summary>
        /// Release all resources for the DefaultRemoteManager.
        /// </summary>
        public void Dispose()
        {
            foreach (ProxyObserver cachedClient in _cachedClients.Values)
            {
                cachedClient.Dispose();
            }

            if (_server != null)
            {
                _server.Dispose();
            }
        }

        /// <summary>
        /// Observer to send messages to connected remote host
        /// </summary>
        private class ProxyObserver : IObserver<T>, IDisposable
        {
            private readonly TransportClient<IRemoteEvent<T>> _client;
            private int _messageCount;

            /// <summary>
            /// Create new ProxyObserver
            /// </summary>
            /// <param name="client">The connected transport client used to send
            /// messages to remote host</param>
            public ProxyObserver(TransportClient<IRemoteEvent<T>> client)
            {
                _client = client;
                _messageCount = 0;
            }

            /// <summary>
            /// Send the message to the remote host
            /// </summary>
            /// <param name="message">The message to send</param>
            public void OnNext(T message)
            {
                IRemoteEvent<T> remoteEvent = new RemoteEvent<T>(_client.Link.LocalEndpoint, _client.Link.RemoteEndpoint, message)
                {
                    Sequence = _messageCount
                };

                _messageCount++;
                _client.Send(remoteEvent);
            }

            /// <summary>
            /// Close underlying transport client
            /// </summary>
            public void Dispose()
            {
                _client.Dispose();
            }

            public void OnError(Exception error)
            {
                throw new NotImplementedException();
            }

            public void OnCompleted()
            {
                throw new NotImplementedException();
            }
        }
    }
}


text:
require_relative '../../spec_helper'

describe "File.absolute_path?" do
  before :each do
    @abs = File.expand_path(__FILE__)
  end

  it "returns true if it's an absolute pathname" do
    File.absolute_path?(@abs).should be_true
  end

  it "returns false if it's a relative path" do
    File.absolute_path?(File.basename(__FILE__)).should be_false
  end

  it "returns false if it's a tricky relative path" do
    File.absolute_path?("C:foo\\bar").should be_false
  end

  it "does not expand '~' to a home directory." do
    File.absolute_path?('~').should be_false
  end

  it "does not expand '~user' to a home directory." do
    path = File.dirname(@abs)
    Dir.chdir(path) do
      File.absolute_path?('~user').should be_false
    end
  end

  it "calls #to_path on its argument" do
    mock = mock_to_path(File.expand_path(__FILE__))

    File.absolute_path?(mock).should be_true
  end

  platform_is_not :windows do
    it "takes into consideration the platform's root" do
      File.absolute_path?("C:\\foo\\bar").should be_false
      File.absolute_path?("C:/foo/bar").should be_false
      File.absolute_path?("/foo/bar\\baz").should be_true
    end
  end

  platform_is :windows do
    it "takes into consideration the platform path separator(s)" do
      File.absolute_path?("C:\\foo\\bar").should be_true
      File.absolute_path?("C:/foo/bar").should be_true
      File.absolute_path?("/foo/bar\\baz").should be_false
    end
  end
end

describe "File.absolute_path" do
  before :each do
    @abs = File.expand_path(__FILE__)
  end

  it "returns the argument if it's an absolute pathname" do
    File.absolute_path(@abs).should == @abs
  end

  it "resolves paths relative to the current working directory" do
    path = File.dirname(@abs)
    Dir.chdir(path) do
      File.absolute_path('hello.txt').should == File.join(Dir.pwd, 'hello.txt')
    end
  end

  it "does not expand '~' to a home directory." do
    File.absolute_path('~').should_not == File.expand_path('~')
  end

  platform_is_not :windows do
    it "does not expand '~' when given dir argument" do
      File.absolute_path('~', '/').should == '/~'
    end
  end

  it "does not expand '~user' to a home directory." do
    path = File.dirname(@abs)
    Dir.chdir(path) do
      File.absolute_path('~user').should == File.join(Dir.pwd, '~user')
    end
  end

  it "accepts a second argument of a directory from which to resolve the path" do
    File.absolute_path(__FILE__, File.dirname(__FILE__)).should == @abs
  end

  it "calls #to_path on its argument" do
    File.absolute_path(mock_to_path(@abs)).should == @abs
  end
end


text:
from oslo_utils import encodeutils
import prettytable
import six
import textwrap

from dragonflow._i18n import _
from dragonflow.common import exceptions

def get_list_table_columns_and_formatters(fields, objs, exclude_fields=(),
                                          filters=None):
    """Check and add fields to output columns.

    If there is any value in fields that not an attribute of obj,
    CommandError will be raised.
    If fields has duplicate values (case sensitive), we will make them unique
    and ignore duplicate ones.
    :param fields: A list of string contains the fields to be printed.
    :param objs: An list of object which will be used to check if field is
                 valid or not. Note, we don't check fields if obj is None or
                 empty.
    :param exclude_fields: A tuple of string which contains the fields to be
                           excluded.
    :param filters: A dictionary defines how to get value from fields, this
                    is useful when field's value is a complex object such as
                    dictionary.
    :return: columns, formatters.
             columns is a list of string which will be used as table header.
             formatters is a dictionary specifies how to display the value
             of the field.
             They can be [], {}.
    :raise dragonflow.common.exceptions.CommandError:
    """

    if objs and isinstance(objs, list):
        obj = objs[0]
    else:
        obj = None
        fields = None

    columns = []
    formatters = {}

    if fields:
        non_existent_fields = []
        exclude_fields = set(exclude_fields)

        for field in fields:
            if field not in obj:
                non_existent_fields.append(field)
                continue
            if field in exclude_fields:
                continue
            field_title, formatter = make_field_formatter(field, filters)
            columns.append(field_title)
            formatters[field_title] = formatter
            exclude_fields.add(field)

        if non_existent_fields:
            raise exceptions.CommandError(
                non_existent_fields=non_existent_fields)

    return columns, formatters

def keys_and_vals_to_strs(dictionary):
    """Recursively convert a dictionary's keys and values to strings.

    :param dictionary: dictionary whose keys/vals are to be converted to strs
    """
    def to_str(k_or_v):
        if isinstance(k_or_v, dict):
            return keys_and_vals_to_strs(k_or_v)
        elif isinstance(k_or_v, six.text_type):
            return str(k_or_v)
        else:
            return k_or_v
    return dict((to_str(k), to_str(v)) for k, v in dictionary.items())

def _format_field_name(attr):
    """Format an object attribute in a human-friendly way."""
    # Split at ':' and leave the extension name as-is.
    parts = attr.rsplit(':', 1)
    name = parts[-1].replace('_', ' ')
    # Don't title() on mixed case
    if name.isupper() or name.islower():
        name = name.title()
    parts[-1] = name
    return ': '.join(parts)

def make_field_formatter(attr, filters=None):
    """Given an object attribute.

    Return a formatted field name and a formatter suitable for passing to
    print_list.
    Optionally pass a dict mapping attribute names to a function. The function
    will be passed the value of the attribute and should return the string to
    display.
    """

    filter_ = None
    if filters:
        filter_ = filters.get(attr)

    def get_field(obj):
        field = getattr(obj, attr, '')
        if field and filter_:
            field = filter_(field)
        return field

    name = _format_field_name(attr)
    formatter = get_field
    return name, formatter

def print_dict(dct, dict_property="Property", wrap=0):
    """Print a `dict` as a table of two columns.

    :param dct: `dict` to print
    :param dict_property: name of the first column
    :param wrap: wrapping for the second column
    """
    pt = prettytable.PrettyTable([dict_property, 'Value'])
    pt.align = 'l'
    for k, v in dct.items():
        # convert dict to str to check length
        if isinstance(v, dict):
            v = six.text_type(keys_and_vals_to_strs(v))
        if wrap > 0:
            v = textwrap.fill(six.text_type(v), wrap)
        # if value has a newline, add in multiple rows
        # e.g. fault with stacktrace
        if v and isinstance(v, six.string_types) and r'\n' in v:
            lines = v.strip().split(r'\n')
            col1 = k
            for line in lines:
                pt.add_row([col1, line])
                col1 = ''
        elif isinstance(v, list):
            val = str([str(i) for i in v])
            if val is None:
                val = '-'
            pt.add_row([k, val])
        else:
            if v is None:
                v = '-'
            pt.add_row([k, v])

    if six.PY3:
        print(encodeutils.safe_encode(pt.get_string()).decode())
    else:
        print(encodeutils.safe_encode(pt.get_string()))

def print_list(objs, fields, formatters=None, sortby_index=0,
               mixed_case_fields=None, field_labels=None):
    """Print a list or objects as a table, one row per object.

    :param objs: iterable of :class:`Resource`
    :param fields: attributes that correspond to columns, in order
    :param formatters: `dict` of callables for field formatting
    :param sortby_index: index of the field for sorting table rows
    :param mixed_case_fields: fields corresponding to object attributes that
        have mixed case names (e.g., 'serverId')
    :param field_labels: Labels to use in the heading of the table, default to
        fields.
    """
    formatters = formatters or {}
    mixed_case_fields = mixed_case_fields or []
    field_labels = field_labels or fields
    if len(field_labels) != len(fields):
        raise ValueError(_("Field labels list %(labels)s has different number "
                           "of elements than fields list %(fields)s"),
                         {'labels': field_labels, 'fields': fields})

    if sortby_index is None:
        kwargs = {}
    else:
        kwargs = {'sortby': field_labels[sortby_index]}
    pt = prettytable.PrettyTable(field_labels)
    pt.align = 'l'

    for o in objs:
        row = []
        for field in fields:
            data = '-'
            if field in formatters:
                data = formatters[field](o)
            else:
                if field in mixed_case_fields:
                    field_name = field.replace(' ', '_')
                else:
                    field_name = field.lower().replace(' ', '_')
                data = o.get(field_name, '')
            if data is None:
                data = '-'
            row.append(data)
        pt.add_row(row)

    if six.PY3:
        print(encodeutils.safe_encode(pt.get_string(**kwargs)).decode())
    else:
        print(encodeutils.safe_encode(pt.get_string(**kwargs)))


text:
/* 'NormalMap' renders the surface normals of the current view into a texture.
   This normal texture can then be used for screen-space effects such as outline rendering
   and screen-space ambient occlusion (SSAO).

   TODO: convert normals from world-space to screen-space?

*/
render.NormalMap = {

  viewportSize: 512,

  init: function() {
    this.shader = new glx.Shader({
      vertexShader: Shaders.normalmap.vertex,
      fragmentShader: Shaders.normalmap.fragment,
      attributes: ['aPosition', 'aNormal', 'aFilter'],
      uniforms: ['uMatrix', 'uTime']
    });

    this.framebuffer = new glx.Framebuffer(this.viewportSize, this.viewportSize);
    // enable texture filtering for framebuffer texture
    gl.bindTexture(gl.TEXTURE_2D, this.framebuffer.renderTexture.id);
    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST);
    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);

    this.mapPlane = new mesh.MapPlane();
  },

  render: function() {

    var
      shader = this.shader,
      framebuffer = this.framebuffer;

    gl.viewport(0, 0, this.viewportSize, this.viewportSize);
    shader.enable();
    framebuffer.enable();

    //the color (0.5, 0.5, 1) corresponds to the normal (0, 0, 1), i.e. 'up'.
    gl.clearColor(0.5, 0.5, 1, 1);
    gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);

    gl.uniform1f(shader.uniforms.uTime, Filter.getTime());

    var
      dataItems = data.Index.items.concat([this.mapPlane]),
      item,
      modelMatrix;

    for (var i = 0, il = dataItems.length; i < il; i++) {
      item = dataItems[i];

      if (MAP.zoom < item.minZoom || MAP.zoom > item.maxZoom) {
        continue;
      }

      if (!(modelMatrix = item.getMatrix())) {
        continue;
      }

      gl.uniformMatrix4fv(shader.uniforms.uMatrix, false, glx.Matrix.multiply(modelMatrix, render.viewProjMatrix));

      item.vertexBuffer.enable();
      gl.vertexAttribPointer(shader.attributes.aPosition, item.vertexBuffer.itemSize, gl.FLOAT, false, 0, 0);

      item.normalBuffer.enable();
      gl.vertexAttribPointer(shader.attributes.aNormal, item.normalBuffer.itemSize, gl.FLOAT, false, 0, 0);

      item.filterBuffer.enable();
      gl.vertexAttribPointer(shader.attributes.aFilter, item.filterBuffer.itemSize, gl.FLOAT, false, 0, 0);

      gl.drawArrays(gl.TRIANGLES, 0, item.vertexBuffer.numItems);
    }

    shader.disable();
    framebuffer.disable();

    gl.bindTexture(gl.TEXTURE_2D, this.framebuffer.renderTexture.id);
    gl.generateMipmap(gl.TEXTURE_2D);

    gl.viewport(0, 0, MAP.width, MAP.height);

  },

  destroy: function() {}
};


text:
package com.estwd.safari.examples.servlets.lion.shiro.filter;

import org.apache.shiro.subject.Subject;
import org.apache.shiro.util.ThreadContext;
import org.apache.shiro.web.filter.authc.AuthenticationFilter;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

/**
 * An {@link AuthenticationFilter} used for testing the Safari-park Lion package.
 *
 * @author Guni Y.
 * @see AuthenticationFilter
 */
public class SessionFilter extends LionAuthenticationFilter {

    @Override
    protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) {
        String sessionId = getLastPathSegment(request);

        //Fetch the session from the cache and create a subject with it
        Subject requestSubject = new Subject.Builder().sessionId(sessionId).buildSubject();

        if (!requestSubject.isAuthenticated())
            return false;

        ThreadContext.bind(requestSubject);

        return true;
    }
}


text:
package aQute.bnd.deployer.obr;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URI;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.SortedSet;

import aQute.bnd.deployer.repository.providers.ObrUtil;
import aQute.bnd.osgi.Processor;
import aQute.bnd.service.Strategy;
import aQute.bnd.version.Version;
import aQute.lib.io.IO;
import junit.framework.TestCase;
import test.helpers.Sed;
import test.lib.NanoHTTPD;

public class OBRTest extends TestCase {

	private static final String	obrSrc	= "testdata/fullobr.xml";
	private static final String	obrDst	= "testdata/fullobr.tmp.xml";
	private static OBR			obr;
	private static NanoHTTPD	httpd;
	private static int			httpdPort;
	private static Processor	reporter;

	@Override
	protected void setUp() throws Exception {
		httpd = new NanoHTTPD(0, IO.getFile("testdata/http"));
		httpdPort = httpd.getPort();

		Sed.file2File(obrSrc, "__httpdPort__", Integer.toString(httpdPort), obrDst);

		obr = new OBR();
		Map<String,String> config = new HashMap<String,String>();
		config.put("location", new File(obrDst).getAbsoluteFile().toURI().toString());

		File tmpFile = File.createTempFile("cache", ".tmp");
		tmpFile.deleteOnExit();
		File cacheDir = new File(tmpFile.getAbsolutePath() + ".dir");

		obr.setProperties(config);
		obr.setCacheDirectory(cacheDir);

		reporter = new Processor();
		obr.setReporter(reporter);

	}

	@Override
	protected void tearDown() throws Exception {
		httpd.stop();

		File[] cachedFiles = obr.getCacheDirectory().listFiles();
		if (cachedFiles != null) {
			for (File file : cachedFiles) {
				file.delete();
			}
		}
		obr.getCacheDirectory().delete();
		new File(obrDst).delete();
	}

	public static void testSetProperties() throws Exception {
		OBR obr2 = new OBR();

		Map<String,String> props = new HashMap<String,String>();
		props.put("location", IO.getFile("testdata/fullobr.xml").toURI().toString());
		obr2.setProperties(props);
		obr2.setCacheDirectory(obr.getCacheDirectory());

		Collection<URI> indexes = obr2.getIndexLocations();
		assertEquals(1, indexes.size());
		assertEquals(IO.getFile("testdata/fullobr.xml").toURI().toString(), indexes.iterator().next().toString());

		assertEquals(obr.getCacheDirectory(), obr2.getCacheDirectory());
	}

	public static void testCacheDirectoryNotSpecified() {
		OBR obr2 = new OBR();

		Map<String,String> props = new HashMap<String,String>();
		props.put("location", IO.getFile("testdata/fullobr.xml").toURI().toString());
		obr2.setProperties(props);
	}

	public static void testGetLatest() throws Exception {
		File[] files = obr.get("name.njbartlett.osgi.emf.minimal", "latest");
		assertTrue(reporter.getErrors().isEmpty());

		assertNotNull(files);
		assertEquals(1, files.length);

		assertEquals("name.njbartlett.osgi.emf.minimal-2.7.0.jar", files[0].getName());
	}

	public static void testGetAll() throws Exception {
		File[] files = obr.get("name.njbartlett.osgi.emf.xmi", null);

		assertNotNull(files);
		assertEquals(2, files.length);

		assertEquals("name.njbartlett.osgi.emf.xmi-2.5.0.jar", files[0].getName());
		assertEquals("name.njbartlett.osgi.emf.xmi-2.7.0.jar", files[1].getName());
	}

	public static void testGetHttp() throws Exception {
		File[] files = obr.get("org.example.dummy", "latest");

		assertNotNull(files);
		assertEquals(1, files.length);

		assertNotNull(files[0]);
		assertEquals("dummybundle.jar", files[0].getName());
	}

	public static void testGetBsnLowest() throws Exception {
		File result = obr.get("name.njbartlett.osgi.emf.xmi", null, Strategy.LOWEST, null);
		assertNotNull(result);
		assertEquals("name.njbartlett.osgi.emf.xmi-2.5.0.jar", result.getName());
	}

	public static void testGetBsnHighest() throws Exception {
		File result = obr.get("name.njbartlett.osgi.emf.xmi", null, Strategy.HIGHEST, null);
		assertNotNull(result);
		assertEquals("name.njbartlett.osgi.emf.xmi-2.7.0.jar", result.getName());
	}

	public static void testGetBsnLowestWithRange() throws Exception {
		File result = obr.get("name.njbartlett.osgi.emf.xmi", "2.5.1", Strategy.LOWEST, null);
		assertNotNull(result);
		assertEquals("name.njbartlett.osgi.emf.xmi-2.7.0.jar", result.getName());
	}

	public static void testGetBsnHighestWithRange() throws Exception {
		File result = obr.get("name.njbartlett.osgi.emf.xmi", "[2.5,2.7)", Strategy.HIGHEST, null);
		assertNotNull(result);
		assertEquals("name.njbartlett.osgi.emf.xmi-2.5.0.jar", result.getName());
	}

	/*
	 * public void testGetPackageLowest() throws Exception { Map<String, String>
	 * props = new HashMap<String, String>(); props.put("package",
	 * "org.eclipse.emf.common"); File result = obr.get(null, null,
	 * Strategy.LOWEST, props); assertNotNull(result);
	 * assertEquals("name.njbartlett.osgi.emf.minimal-2.6.1.jar",
	 * result.getName()); } public void testGetPackageLowestWithRange() throws
	 * Exception { Map<String, String> props = new HashMap<String, String>();
	 * props.put("package", "org.eclipse.emf.common"); File result =
	 * obr.get(null, "2.6.2", Strategy.LOWEST, props); assertNotNull(result);
	 * assertEquals("name.njbartlett.osgi.emf.minimal-2.7.0.jar",
	 * result.getName()); } public void testGetPackageHighest() throws Exception
	 * { Map<String, String> props = new HashMap<String, String>();
	 * props.put("package", "org.eclipse.emf.common"); File result =
	 * obr.get(null, null, Strategy.HIGHEST, props); assertNotNull(result);
	 * assertEquals("name.njbartlett.osgi.emf.minimal-2.7.0.jar",
	 * result.getName()); } public void testGetPackageHighestWithRange() throws
	 * Exception { Map<String, String> props = new HashMap<String, String>();
	 * props.put("package", "org.eclipse.emf.common"); File result =
	 * obr.get(null, "[2.6,2.7)", Strategy.HIGHEST, props);
	 * assertNotNull(result);
	 * assertEquals("name.njbartlett.osgi.emf.minimal-2.6.1.jar",
	 * result.getName()); }
	 */

	public static void testList() throws Exception {
		List<String> result = obr.list("name.njbart*");
		assertNotNull(result);
		assertEquals(2, result.size());
	}

	public static void testVersions() throws Exception {
		SortedSet<Version> result = obr.versions("name.njbartlett.osgi.emf.minimal");
		assertEquals(2, result.size());

		assertEquals(new Version("2.6.1.v20100914-1218"), result.first());
		assertEquals(new Version("2.7.0.201104130744"), result.last());
	}

	public static void testName() throws MalformedURLException {
		assertEquals(new File(obrDst).getAbsoluteFile().toURI().toString(), obr.getName());

		OBR obr2 = new OBR();
		Map<String,String> config = new HashMap<String,String>();
		config.put("location", "http://www.example.com/bundles/dummybundle.jar,file:/Users/neil/bundles/dummy.jar");
		obr2.setProperties(config);

		assertEquals("http://www.example.com/bundles/dummybundle.jar,file:/Users/neil/bundles/dummy.jar",
				obr2.getName());
	}

	public static void testProcessFilter1() {
		String filter = "(&(name=foo)(version<1.0.0))";
		String expected = "(&(name=foo)(!(version>=1.0.0)))";
		assertEquals(expected, ObrUtil.processFilter(filter, null));
	}

	public static void testProcessFilter2() {
		String filter = "(&(name=foo)(version>1.0.0))";
		String expected = "(&(name=foo)(!(version<=1.0.0)))";
		assertEquals(expected, ObrUtil.processFilter(filter, null));
	}

	public static void testProcessFilter3() {
		String filter = "(name=foo)(mandatory:<*hello)(version>=1.0.0)(foo<*bar)";
		String expected = "(name=foo)(version>=1.0.0)";
		assertEquals(expected, ObrUtil.processFilter(filter, null));
	}

	public static void testProcessFilter4() {
		String filter = "(name=foo)(mandatory:<*hello)(mandatory:*>goodbye)(version>=1.0.0)(foo<*bar)";
		String expected = "(name=foo)(version>=1.0.0)";
		assertEquals(expected, ObrUtil.processFilter(filter, null));
	}

}


text:
set -e

# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"

NAME=lsof

clean_up() {
	# remove any files, containers, images etc
	rm -rf ${NAME}* || true
}

trap clean_up EXIT

linuxkit build -format kernel+initrd -name "${NAME}" test.yml
linuxkit run qemu -kernel "${NAME}"
#RESULT=$(linuxkit run qemu -kernel "${NAME}")
#echo "${RESULT}" | grep -q "PASSED"
exit 0


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <artifactId>annis-all</artifactId>
    <groupId>de.hu-berlin.german.korpling.annis</groupId>
    <version>3.0.0</version>
  </parent>

  <groupId>de.hu-berlin.german.korpling.annis</groupId>
  <artifactId>annis-widgets</artifactId>
  <packaging>jar</packaging>
  <version>3.0.0</version>
  <name>annis-widgets</name>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <vaadin.version>7.0.7</vaadin.version>
  </properties>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.4</version>
        <configuration>
          <excludes>
            <exclude>VAADIN/widgetsets/WEB-INF/**</exclude>
            <exclude>VAADIN/gwt-unitCache/**</exclude>
          </excludes>
        </configuration>
      </plugin>

      <!-- As we are doing "inplace" GWT compilation, ensure the widgetset -->
      <!-- directory is cleaned properly -->
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <version>2.4.1</version>
        <configuration>
          <filesets>
            <fileset>
              <directory>src/main/webapp/VAADIN/widgetsets</directory>
            </fileset>
          </filesets>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-maven-plugin</artifactId>
        <version>${vaadin.version}</version>
        <configuration>
          <extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
          <!-- <runTarget>mobilemail</runTarget> -->
          <!-- We are doing "inplace" but into subdir VAADIN/widgetsets. This
          way compatible with Vaadin eclipse plugin. -->
          <webappDirectory>${project.build.outputDirectory}/VAADIN/widgetsets
          </webappDirectory>
          <hostedWebapp>${project.build.outputDirectory}/VAADIN/widgetsets
          </hostedWebapp>
          <noServer>true</noServer>
          <!-- Remove draftCompile when project is ready -->
          <draftCompile>false</draftCompile>
          <compileReport>true</compileReport>
          <style>OBF</style>
          <strict>true</strict>
          <runTarget>http://localhost:8080/</runTarget>
          <localWorkers>2</localWorkers>
        </configuration>
        <executions>
          <execution>
            <configuration>
              <!-- if you don't specify any modules, the plugin will find them -->
              <!-- <modules> <module>com.vaadin.demo.mobilemail.gwt.ColorPickerWidgetSet</module>
              </modules> -->
            </configuration>
            <goals>
              <goal>resources</goal>
              <goal>update-widgetset</goal>
              <goal>compile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

    </plugins>

    <!-- This is needed for the sources required by the GWT compiler to be included in the produced JARs -->
    <resources>
      <resource>
        <directory>src/main/java</directory>
      </resource>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
    </resources>
  </build>

  <repositories>
    <repository>
      <id>vaadin-snapshots</id>
      <url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
    <repository>
      <id>vaadin-addons</id>
      <url>http://maven.vaadin.com/vaadin-addons</url>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>codehaus-snapshots</id>
      <url>http://nexus.codehaus.org/snapshots</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
      <releases>
        <enabled>false</enabled>
      </releases>
    </pluginRepository>
    <pluginRepository>
      <id>vaadin-snapshots</id>
      <url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
      <releases>
        <enabled>false</enabled>
      </releases>
    </pluginRepository>
  </pluginRepositories>

  <dependencies>
    <dependency>
      <groupId>com.vaadin</groupId>
      <artifactId>vaadin-server</artifactId>
      <version>${vaadin.version}</version>
    </dependency>
    <dependency>
      <groupId>com.vaadin</groupId>
      <artifactId>vaadin-client</artifactId>
      <version>${vaadin.version}</version>
    </dependency>
    <dependency>
      <groupId>com.vaadin</groupId>
      <artifactId>vaadin-client-compiled</artifactId>
      <version>${vaadin.version}</version>
    </dependency>
    <dependency>
      <groupId>javax.validation</groupId>
      <artifactId>validation-api</artifactId>
      <version>1.0.0.GA</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.validation</groupId>
      <artifactId>validation-api</artifactId>
      <version>1.0.0.GA</version>
      <classifier>sources</classifier>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>de.hu-berlin.german.korpling.annis</groupId>
      <artifactId>annis-interfaces</artifactId>
      <version>${project.version}</version>
      <scope>compile</scope>
    </dependency>

    <dependency>
      <groupId>commons-codec</groupId>
      <artifactId>commons-codec</artifactId>
      <version>1.7</version>
      <scope>compile</scope>
    </dependency>

    <!-- other widget sets we use -->
    <dependency>
      <groupId>org.vaadin.addons</groupId>
      <artifactId>popupbutton</artifactId>
      <version>2.2.0</version>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava-gwt</artifactId>
      <version>14.0.1</version>
      <scope>compile</scope>
    </dependency>

    <dependency>
      <groupId>org.vaadin.addons</groupId>
      <artifactId>cssinject</artifactId>
      <version>2.0.3</version>
    </dependency>

    <dependency>
      <groupId>org.vaadin.addons</groupId>
      <artifactId>refresher</artifactId>
      <version>1.2.1.7</version>
    </dependency>

  </dependencies>

</project>


text:
<?xml version="1.0"?>
<Document>

	<Sentence>
		<value>The main treatments for heart failure are making lifestyle changes and taking your medicines.</value>
		<pattern_crowdsource> The main treatments for [[heart failure|C0018801]] are making lifestyle changes and taking your [[medicines|C0013227]].		</pattern_crowdsource>
		<annotations>
			<annotation>
				<surface-form>main</surface-form>
				<RDF-ID>C0205225</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>treatments</surface-form>
				<RDF-ID>C0087111</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>heart failure</surface-form>
				<RDF-ID>C0018801</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>lifestyle</surface-form>
				<RDF-ID>C0023676</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>changes</surface-form>
				<RDF-ID>C0392747</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>medicines</surface-form>
				<RDF-ID>C0013227</RDF-ID>
			</annotation>
		</annotations>
		<triples>
			<triple>C0013227 TREATS C0018801</triple>
		</triples>
	</Sentence>
	<Sentence>
		<value>When your heart is weakened, gets too large, and does not pump blood very well, you are at high risk for abnormal heartbeats that can lead to sudden cardiac death.</value>
		<pattern_crowdsource> When your heart is weakened, gets too large, and does not pump blood very well, you are at high risk for abnormal [[heartbeats|C0425583]] that can lead to [[sudden cardiac death|C0085298]].		</pattern_crowdsource>
		<annotations>
			<annotation>
				<surface-form>heart</surface-form>
				<RDF-ID>C0018787</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>large</surface-form>
				<RDF-ID>C0549177</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>not</surface-form>
				<RDF-ID>C1518422</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>blood</surface-form>
				<RDF-ID>C0005767</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>very</surface-form>
				<RDF-ID>C0442824</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>well</surface-form>
				<RDF-ID>C0205170</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>high</surface-form>
				<RDF-ID>C0205250</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>risk</surface-form>
				<RDF-ID>C0035647</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>abnormal</surface-form>
				<RDF-ID>C0205161</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>heartbeats</surface-form>
				<RDF-ID>C0425583</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>sudden cardiac death</surface-form>
				<RDF-ID>C0085298</RDF-ID>
			</annotation>
		</annotations>
		<triples>
			<triple>C0425583 AFFECTS C0085298</triple>
		</triples>
	</Sentence>
	<Sentence>
		<value>Blood that flows between the chambers of your heart, or out of your heart into the aorta, must pass through a heart valve.</value>
		<pattern_crowdsource> Blood that flows between the [[chambers|C0179874]] of your [[heart|C0018787]], or out of your [[heart|C0018787]] into the aorta, must pass through a heart valve.		</pattern_crowdsource>
		<annotations>
			<annotation>
				<surface-form>Blood</surface-form>
				<RDF-ID>C0005767</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>flows</surface-form>
				<RDF-ID>C0806140</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>chambers</surface-form>
				<RDF-ID>C0179874</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>heart</surface-form>
				<RDF-ID>C0018787</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>heart</surface-form>
				<RDF-ID>C0018787</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>aorta</surface-form>
				<RDF-ID>C0003483</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>heart valve</surface-form>
				<RDF-ID>C0018826</RDF-ID>
			</annotation>
		</annotations>
		<triples>
			<triple>C0018787 LOCATION_OF C0179874</triple>
			<triple>C0018787 LOCATION_OF C0179874</triple>
		</triples>
	</Sentence>
	<Sentence>
		<value>Surgery for end-stage heart failure</value>
		<pattern_crowdsource> [[Surgery|C0543467]] for end-stage [[heart failure|C0018801]]		</pattern_crowdsource>
		<annotations>
			<annotation>
				<surface-form>Surgery</surface-form>
				<RDF-ID>C0543467</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>end-stage</surface-form>
				<RDF-ID>C0205088</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>heart failure</surface-form>
				<RDF-ID>C0018801</RDF-ID>
			</annotation>
		</annotations>
		<triples>
			<triple>C0543467 TREATS C0018801</triple>
		</triples>
	</Sentence>
	<Sentence>
		<value>Some types of surgery are done for severe heart failure when other treatments no longer work.</value>
		<pattern_crowdsource> Some types of [[surgery|C0543467]] are done for severe [[heart failure|C0018801]] when other [[treatments|C0087111]] no longer work.		</pattern_crowdsource>
		<annotations>
			<annotation>
				<surface-form>types</surface-form>
				<RDF-ID>C0332307</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>surgery</surface-form>
				<RDF-ID>C0543467</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>severe</surface-form>
				<RDF-ID>C0205082</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>heart failure</surface-form>
				<RDF-ID>C0018801</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>treatments</surface-form>
				<RDF-ID>C0087111</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>longer</surface-form>
				<RDF-ID>C0205166</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>work</surface-form>
				<RDF-ID>C0043227</RDF-ID>
			</annotation>
		</annotations>
		<triples>
			<triple>C0543467 ISA C0087111</triple>
			<triple>C0543467 TREATS C0018801</triple>
		</triples>
	</Sentence>
	<Sentence>
		<value>You may need a left ventricular assist device (LVAD) if you have severe heart failure that cannot be controlled with medicine or a special pacemaker.</value>
		<pattern_crowdsource> You may need a left ventricular assist device (LVAD) if you have severe [[heart failure|C0018801]] that cannot be controlled with [[medicine|C0013227]] or a special pacemaker.		</pattern_crowdsource>
		<annotations>
			<annotation>
				<surface-form>left ventricular assist device</surface-form>
				<RDF-ID>C0181598</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>severe</surface-form>
				<RDF-ID>C0205082</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>heart failure</surface-form>
				<RDF-ID>C0018801</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>medicine</surface-form>
				<RDF-ID>C0013227</RDF-ID>
			</annotation>
		</annotations>
		<triples>
			<triple>C0013227 TREATS C0018801</triple>
		</triples>
	</Sentence>
	<Sentence>
		<value>- Ventricular assist devices (VAD) help your heart pump blood from the main pumping chamber of your heart to the rest of your body.</value>
		<pattern_crowdsource> - [[Ventricular assist devices|C0179926]] (VAD) help your heart pump blood from the main pumping [[chamber|C0935616]] of your [[heart|C0018787]] to the rest of your body.		</pattern_crowdsource>
		<annotations>
			<annotation>
				<surface-form>Ventricular assist devices</surface-form>
				<RDF-ID>C0179926</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>heart pump blood</surface-form>
				<RDF-ID>C0007226</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>main</surface-form>
				<RDF-ID>C0205225</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>chamber</surface-form>
				<RDF-ID>C0935616</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>heart</surface-form>
				<RDF-ID>C0018787</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>rest</surface-form>
				<RDF-ID>C0035253</RDF-ID>
			</annotation>
		</annotations>
		<triples>
			<triple>C0935616 LOCATION_OF C0179926</triple>
			<triple>C0935616 PART_OF C0018787</triple>
		</triples>
	</Sentence>

</Document>


text:
<?php
class CloudUp
{
    private $user;
    private $passwd;
    private $error;
    private $key;

    const UPLOAD_URL = 'https://api.cloudup.com/1/';

    public function setKey($user, $passwd)
    {
        $this->key = "Content-Type: application/x-www-form-urlencoded \r\n" . "Authorization: Basic " .base64_encode("$user:$passwd");
    }

    public function getError()
    {
        return $this->error;
    }

    public function createStream($name)
    {
        try {
            $context = stream_context_create(array(
                'http' => array(
                    'method' => "POST",
                    'header' => $this->key,
                    'content' => "title=$name"
                )
            ));
            $data    = file_get_contents(self::UPLOAD_URL."streams", false, $context);
            return (array) json_decode($data);
        }
        catch (Exception $e) {
            $this->setError($e->getMessage());
        }
    }

    public function addItem($filename, $stream_id, $title)
    {
        try {
            $context = stream_context_create(array(
                'http' => array(
                    'method' => "POST",
                    'header' => $this->key,
                    'content' => "filename=$filename&stream_id=$stream_id&title=$title"
                )
            ));
            $data = file_get_contents(self::UPLOAD_URL."/items", false, $context);
            return (array) json_decode($data);
        }
        catch (Exception $e) {
            $this->setError($e->getMessage());
        }
    }

    public function getItems($stream_id)
    {
        try {
            $context = stream_context_create(array(
                'http' => array(
                    'method' => "GET",
                    'header' => $this->key
                )
            ));
            $data    = file_get_contents(self::UPLOAD_URL."/streams/$stream_id/items", false, $context);
            return (array) json_decode($data);
        }
        catch (Exception $e) {
            $this->setError($e->getMessage());
        }
    }

    private function setError($error)
    {
        $this->error = $error;
    }
}

$user = 'user';
$passwd = 'pass';
$cloud = new CloudUp;
$cloud->setKey($user, $passwd);
$result = $cloud->createStream('browserling');
$stream_id = $result['id'];
$filename = 'browserling.jpg';
$cloud->addItem($filename, $stream_id, 'browserling');
$result = $cloud->getItems($stream_id);
print_r($result);
?>


text:
/*
* @author : Ram Kulkarni (http://ramkulkarni.com)
*/

function startScript(canvasId)
{
	playbackInterruptCommand = "";

	$(document).bind("ready", function()
	{
		$("#pauseBtn").hide();
		//$("#playBtn").hide();

		drawing = new RecordableDrawing(canvasId);

		$("#recordBtn").click(function(){
			var btnTxt = $("#recordBtn").prop("value");
			if (btnTxt == 'Stop')
				stopRecording();
			else
				startRecording();
		});

		$("#playBtn").click(playRecordings);

		function playRecordings()
		{
			if (drawing.recordings.length == 0)
			{
				alert("No recording to play");
				return;
			}
			var btnTxt = $("#playBtn").prop("value");
			if (btnTxt == 'Stop')
				stopPlayback();
			else
				startPlayback();
		}

		$("#pauseBtn").click(function(){
			var btnTxt = $("#pauseBtn").prop("value");
			if (btnTxt == 'Pause')
			{
				pausePlayback();
			} else if (btnTxt == 'Resume')
			{
				resumePlayback();
			}
		});
		$("#clearBtn").click(function(){
			drawing.clearCanvas();
		});

		$("#serializeBtn").click(function() {

			var serResult = serializeDrawing(drawing);
			if (serResult != null)
			{
				$("#serDataTxt").val(serResult);
				showSerializerDiv();
			} else
			{
				alert("Error serializing data");
			}
		});

		function showSerializerDiv(showSubmit)
		{
			$("#drawingDiv").hide();
			$("#serializerDiv").show();
			if (showSubmit)
				$("#okBtn").show();
			else
				$("#okBtn").hide();
		}

		function hideSerializerDiv()
		{
			$("#drawingDiv").show();
			$("#serializerDiv").hide();
		}

		$("#deserializeBtn").click(function(){
			showSerializerDiv(true);
		});

		$("#cancelBtn").click(function(){
			hideSerializerDiv();
		});

		$("#okBtn").click(function(){
			var serTxt = $("#serDataTxt").val();
			var result = deserializeDrawing(serTxt);
			if (result == null)
				result = "Error : Unknown error in deserializing the data";
			if (result instanceof Array == false)
			{
				$("#serDataTxt").val(result.toString());
				showSerializerDiv(false);
				return;
			}
			else
			{
				//data is successfully deserialize
				drawing.recordings = result;
				//set drawing property of each recording
				for (var i = 0; i < result.length; i++)
					result[i].drawing = drawing;
				hideSerializerDiv();
				playRecordings();
			}
		});
	});

	function stopRecording()
	{
		$("#recordBtn").prop("value","Record");
		$("#playBtn").show();
		$("#pauseBtn").hide();
		$("#clearBtn").show();

		drawing.stopRecording();
	}

	function startRecording()
	{
		$("#recordBtn").prop("value","Stop");
		$("#playBtn").hide();
		$("#pauseBtn").hide();
		$("#clearBtn").hide();

		drawing.startRecording();
	}

	function stopPlayback()
	{
		playbackInterruptCommand = "stop";
	}

	function startPlayback()
	{
		drawing.playRecording(function() {
			//on playback start
			$("#playBtn").prop("value","Stop");
			$("#recordBtn").hide();
			$("#pauseBtn").show();
			$("#clearBtn").hide();
			playbackInterruptCommand = "";
		}, function(){
			//on playback end
			$("#playBtn").prop("value","Play");
			$("#playBtn").show();
			$("#recordBtn").show();
			$("#pauseBtn").hide();
			$("#clearBtn").show();
		}, function() {
			//on pause
			$("#pauseBtn").prop("value","Resume");
			$("#recordBtn").hide();
			$("#playBtn").hide();
			$("#clearBtn").hide();
		}, function() {
			//status callback
			return playbackInterruptCommand;
		});
	}

	function pausePlayback()
	{
		playbackInterruptCommand = "pause";
	}

	function resumePlayback()
	{
		playbackInterruptCommand = "";
		drawing.resumePlayback(function(){
			$("#pauseBtn").prop("value","Pause");
			$("#pauseBtn").show();
			$("#recordBtn").hide();
			$("#playBtn").show();
			$("#clearBtn").hide();
		});
	}
}

RecordableDrawing = function (canvasId)
{
	var self = this;
	this.canvas = null;
	this.width = this.height = 0;
	this.actions = new Array();
	this.ctx = null;
	this.mouseDown = false;
	this.currentRecording = null; //instance of Recording
	this.recordings = new Array(); //array of Recording objects
	this.lastMouseX = this.lastMouseY = -1;
	this.bgColor = "rgb(255,255,255)";
	var currentLineWidth = 5;
	var drawingColor = "rgb(0,0,0)";
	var pauseInfo = null;

	onMouseDown = function(event)
	{
		var canvasX = $(self.canvas).offset().left;
		var canvasY = $(self.canvas).offset().top;

		self.mouseDown = true;
		var x = Math.floor(event.pageX - canvasX);
		var y = Math.floor(event.pageY - canvasY);

		var	currAction = new Point(x,y,0);
		self.drawAction(currAction,true);
		if (self.currentRecording != null)
			self.currentRecording.addAction(currAction);
		event.preventDefault();
		return false;
	}

	onMouseMove = function(event)
	{
		if (self.mouseDown)
		{
			var canvasX = $(self.canvas).offset().left;
			var canvasY = $(self.canvas).offset().top;

			var x = Math.floor(event.pageX - canvasX);
			var y = Math.floor(event.pageY - canvasY);

			var action = new Point(x,y,1);
			if (self.currentRecording != null)
				self.currentRecording.addAction(action);
			self.drawAction(action, true);

			event.preventDefault();
			self.lastMouseX = x;
			self.lastMouseY = y;
			return false;
		}
	}

	onMouseUp = function(event)
	{
		self.mouseDown = false;
		self.lastMouseX = -1;
		self.lastMouseY = -1;
	}

	this.startRecording = function()
	{
		self.currentRecording = new Recording(this);
		self.recordings = new Array();
		self.recordings.push(self.currentRecording);
		self.currentRecording.start();
	}

	this.stopRecording = function()
	{
		if (self.currentRecording != null)
			self.currentRecording.stop();
		self.currentRecording = null;
	}

	this.playRecording = function(onPlayStart, onPlayEnd, onPause, interruptActionStatus)
	{
		if (typeof interruptActionStatus == 'undefined')
			interruptActionStatus = null;

		if (self.recordings.length == 0)
		{
			alert("No recording loaded to play");
			onPlayEnd();
			return;
		}

		self.clearCanvas();

		onPlayStart();

		self.pausedRecIndex = -1;

		for (var rec = 0; rec < self.recordings.length; rec++)
		{
			if (interruptActionStatus != null)
			{
				var status = interruptActionStatus();
				if (status == "stop") {
					pauseInfo = null;
					break;
				}
				else
					if (status == "pause") {
						__onPause(rec-1, onPlayEnd, onPause, interruptActionStatus);
						break;
					}
			}
			self.recordings[rec].playRecording(self.drawActions, onPlayEnd, function(){
				__onPause(rec-1, onPlayEnd, onPause, interruptActionStatus);
			}, interruptActionStatus);
		}
	}

	function __onPause(index, onPlayEnd, onPause, interruptActionStatus)
	{
		pauseInfo = {
			"index": index,
			"onPlayend": onPlayEnd,
			"onPause":onPause,
			"interruptActionStatus": interruptActionStatus
		};
		if (onPause)
			onPause();
	}

	this.resumePlayback = function (onResume)
	{
		if (pauseInfo == null) {
			if (onResume)
				onResume(false);
			return;
		}

		var index = pauseInfo.index;
		var onPlayEnd = pauseInfo.onPlayend;
		var interruptActionStatus = pauseInfo.interruptActionStatus;
		var onPause = pauseInfo.onPause;

		if (self.recordings.length == 0)
		{
			alert("No recording loaded to play");
			onPlayEnd();
			return;
		}

		onResume(true);

		pauseInfo = null;

		for (var rec = index; rec < self.recordings.length; rec++)
		{
			if (interruptActionStatus != null)
			{
				var status = interruptActionStatus();
				if (status == "stop")
					break;
				else if (status == "pause")
				{
					__onPause(rec-1, onPlayEnd, onPause, interruptActionStatus);
					break;
				}
			}
			self.recordings[rec].playRecording(self.drawActions, onPlayEnd, function(){
				__onPause(rec-1, onPlayEnd, onPause, interruptActionStatus);
			},interruptActionStatus);
		}
	}

	this.clearCanvas = function()
	{
		self.ctx.fillStyle = self.bgColor;
		self.ctx.fillRect(0,0,self.canvas.width,self.canvas.height);
	}

	this.removeAllRecordings = function()
	{
		self.recordings = new Array()
		self.currentRecording = null;
	}

	this.drawAction = function (actionArg, addToArray)
	{
		var x = actionArg.x;
		var y = actionArg.y;

		switch (actionArg.type)
		{
		case 0: //moveto
			self.ctx.beginPath();
			self.ctx.moveTo(x, y);
			self.ctx.strokeStyle = self.drawingColor;
			self.ctx.lineWidth = self.currentLineWidth;
			break;
		case 1: //lineto
			self.ctx.lineTo(x,y);
			self.ctx.stroke();
			break;
		}
		if (addToArray)
			self.actions.push(actionArg);
	}

	__init = function()
	{
		self.canvas = $("#" + canvasId);
		if (self.canvas.length == 0)
		{
			return;
		}
		self.canvas = self.canvas.get(0);
		self.width = $(self.canvas).width();
		self.height = $(self.canvas).height();
		self.ctx = self.canvas.getContext("2d");

		//$(self.canvas).bind("vmousedown", onMouseDown);
		//$(self.canvas).bind("vmouseup", onMouseUp);
		//$(self.canvas).bind("vmousemove", onMouseMove);

		$(self.canvas).bind("mousedown", onMouseDown);
		$(self.canvas).bind("mouseup", onMouseUp);
		$(self.canvas).bind("mousemove", onMouseMove);

		self.clearCanvas();
	}

	__init();
}

Recording = function (drawingArg)
{
	var self = this;
	this.drawing = drawingArg;
	this.timeSlots = new Object(); //Map with key as time slot and value as array of Point objects

	this.buffer = new Array(); //array of Point objects
	this.timeInterval = 100; //10 miliseconds
	this.currTime = 0;
	this.started = false;
	this.intervalId = null;
	this.currTimeSlot = 0;
	this.actionsSet = null;
	this.currActionSet = null;
	this.recStartTime = null;
	this.pauseInfo = null;

	this.start = function()
	{
		self.currTime = 0;
		self.currTimeSlot = -1;
		self.actionsSet = null;
		self.pauseInfo = null;

		self.recStartTime = (new Date()).getTime();
		self.intervalId = window.setInterval(self.onInterval, self.timeInterval);
		self.started = true;
	}

	this.stop = function()
	{
		if (self.intervalId != null)
		{
			window.clearInterval(self.intervalId);
			self.intervalId = null;
		}
		self.started = false;
	}

	this.onInterval = function()
	{
		if (self.buffer.length > 0)
		{
			var timeSlot = (new Date()).getTime() - self.recStartTime;

			if (self.currActionSet == null)
			{
				self.currActionSet = new ActionsSet(timeSlot, self.buffer);
				self.actionsSet = self.currActionSet;
			}
			else
			{
				var tmpActionSet = self.currActionSet;
				self.currActionSet = new ActionsSet(timeSlot, self.buffer);
				tmpActionSet.next = self.currActionSet;
			}

			self.buffer = new Array();
		}
		self.currTime += self.timeInterval;
	}

	this.addAction = function(actionArg)
	{
		if (!self.started)
			return;
		self.buffer.push(actionArg);
	}

	this.playRecording = function(callbackFunctionArg, onPlayEnd, onPause, interruptActionStatus)
	{
		if (self.actionsSet == null)
		{
			if (typeof onPlayEnd != 'undefined' && onPlayEnd != null)
				onPlayEnd();
			return;
		}

		self.scheduleDraw(self.actionsSet,self.actionsSet.interval,callbackFunctionArg, onPlayEnd, onPause, true, interruptActionStatus);
	}

	this.scheduleDraw = function (actionSetArg, interval, callbackFunctionArg, onPlayEnd, onPause, isFirst, interruptActionStatus)
	{
		window.setTimeout(function(){
			var status = "";
			if (interruptActionStatus != null)
			{
				status = interruptActionStatus();
				if (status == 'stop')
				{
					self.pauseInfo = null;
					onPlayEnd();
					return;
				}
			}

			if (status == "pause")
			{
				self.pauseInfo = {
					"actionset":actionSetArg,
					"callbackFunc":callbackFunctionArg,
					"onPlaybackEnd":onPlayEnd,
					"onPause":onPause,
					"isFirst":isFirst,
					"interruptActionsStatus":interruptActionStatus
				};

				if (onPause)
					onPause();
				return;
			}

			var intervalDiff = -1;
			var isLast = true;
			if (actionSetArg.next != null)
			{
				isLast = false;
				intervalDiff = actionSetArg.next.interval - actionSetArg.interval;
			}
			if (intervalDiff >= 0)
				self.scheduleDraw(actionSetArg.next, intervalDiff, callbackFunctionArg, onPlayEnd, onPause, false,interruptActionStatus);

			self.drawActions(actionSetArg.actions, onPlayEnd, isFirst, isLast);
		},interval);
	}

	this.resume = function()
	{
		if (!self.pauseInfo)
			return;

		self.scheduleDraw(self.pauseInfo.actionset, 0,
			self.pauseInfo.callbackFunc,
			self.pauseInfo.onPlaybackEnd,
			self.pauseInfo.onPause,
			self.pauseInfo.isFirst,
			self.pauseInfo.interruptActionsStatus);

		self.pauseInfo = null;
	}

	this.drawActions = function (actionArray, onPlayEnd, isFirst, isLast)
	{
		for (var i = 0; i < actionArray.length; i++)
			self.drawing.drawAction(actionArray[i],false);

		if (isLast)
		{
			onPlayEnd();
		}
	}
}

Action = function()
{
	var self = this;
	this.actionType; // 1 - Point, other action types could be added later
	this.x = 0;
	this.y = 0;
	this.isMovable = false;
	this.index = 0;

	if (arguments.length > 0)
	{
		self.actionType = arguments[0];
	}
	if (arguments.length > 2)
	{
		self.x = arguments[1];
		self.y = arguments[2];
	}
}

Point = function (argX,argY,typeArg)
{
	var self = this;
	this.type = typeArg; //0 - moveto, 1 - lineto

	Action.call(this,1,argX,argY);
}

Point.prototype = new Action();

ActionsSet = function (interalArg, actionsArrayArg)
{
	var self = this;

	this.actions = actionsArrayArg;
	this.interval = interalArg;
	this.next = null;
}


text:
#!/usr/bin/env node

/**
 * This is an example of rfunc client
 */
'use strict'

const rclient = require('rfunc/clinet')

void async function () {
  let sign = await rclient().connect('sign')

  // Fetch the spec data
  let $spec = await sign.describe()
  /* ... */
}().catch((err) => console.error(err))


text:
package com.google.errorprone.bugpatterns.argumentselectiondefects;

import com.google.errorprone.VisitorState;
import com.sun.source.tree.Tree;
import com.sun.tools.javac.code.Symbol.MethodSymbol;

/**
 * Heuristic to keep suggestions which score sufficiently different to the original. The idea is
 * that we should leave the arguments alone if we are not sure we can swap them so if the overall
 * score of the alternative is not significantly better than the original we want to leave the
 * original in place.
 *
 * @author andrewrice@google.com (Andrew Rice)
 */
class PenaltyThresholdHeuristic implements Heuristic {

  private final double threshold;

  private static final double DEFAULT_THRESHOLD = 0.6;

  PenaltyThresholdHeuristic(double threshold) {
    this.threshold = threshold;
  }

  /** Constructs an instance using the default threshold value. */
  PenaltyThresholdHeuristic() {
    this(DEFAULT_THRESHOLD);
  }

  /** Return true if the change is sufficiently different. */
  @Override
  public boolean isAcceptableChange(
      Changes changes, Tree node, MethodSymbol symbol, VisitorState state) {

    int numberOfChanges = changes.changedPairs().size();

    return changes.totalOriginalCost() - changes.totalAssignmentCost()
        >= threshold * numberOfChanges;
  }
}


text:
span.ui-button-icon-primary.ui-icon.ui-icon-closethick {
    display: none;
}

button.ui-button.ui-widget.ui-state-default.ui-corner-all.ui-button-icon-only.ui-dialog-titlebar-close {
    float: right;
    padding:4px;
}

.ui-dialog-titlebar.ui-widget-header.ui-corner-all.ui-helper-clearfix.ui-draggable-handle {
    padding: 7px;
    border: none;
    border-radius: 0;
    background-color: #cbcbcb !important;
}

.dialog{
	border:none;
}


text:
import os #For creating folder
import urllib #For accessing the web
import re #For regex
from urllib.request import urlopen, URLopener
import threading #For downloading multiple files at once
import queue #To create a queue for the threads to pull data from
import time #For timing operations

#Returns list of lists that contain picture URL endings (eg "ufufuf.jpg") and the extension of the picture (eg "jpg")
#Takes in the url of the album or gallery, and the name that the user wants the directory to be named. Defaults to album key if not specified
def create_pic_list(album_url, dir_name=False):
	# Check the URL is actually imgur:
	'''
	match = re.match("(https?)\:\/\/(www\.)?(?:m\.)?imgur\.com/a/([a-zA-Z0-9]+)(#[0-9]+)?", album_url)
	if not match:
		#raise ImgurAlbumException("URL must be a valid Imgur Album")
		print("URL was not valid imgur URL")
	protocol = match.group(1)

	album_key = match.group(3)
	'''
	#Get unique album key
	if "/gallery/" in album_url:
		album_key = album_url.replace("http://imgur.com/gallery/", "")
	elif "/a/" in album_url:
		album_key = album_url.replace("http://imgur.com/a/", "")
	else:
		print("Not valid imgur album URL")
		return False
	#Change current directory to new folder named after
	current_dir = os.getcwd()
	#If no directory name specified, use album_key
	if not dir_name:
		dl_path = current_dir + "\\" + album_key
	else:
		dl_path = current_dir + "\\" + dir_name
	##This should allow the download location to be changed so that the program can be run off locked flash drive
	#Test to see if directory exists for program already, if not, create one
	if not os.path.exists(dl_path):
		os.makedirs(dl_path)
	#Change working directory to new one
	os.chdir(dl_path)

	# Read the no-script version of the page for all the images:
	no_script_url = "http://imgur.com/a/" + album_key + "/noscript"
	#Get html code from album
	try:
		response = urlopen(url=no_script_url)
		response_code = response.getcode()
	except Exception as e:
		response = False
		#response_code = e.code
		print("Error " + str(e))

	if not response: # or response.getcode() != 200:
		#raise ImgurAlbumException("Error reading Imgur: Error Code %d" % response_code)
		print("Error reading Imgur")
		return False

	# Read in the images using findall regex
	html = response.read().decode('utf-8')
	#Images now holds a list of all urls of each image
	regexImages = re.findall('<img src="(\/\/i\.imgur\.com\/([a-zA-Z0-9]+\.(jpg|jpeg|png|gif)))(\?[0-9]+)?"', html)

	#Remove extra (1st and 4th) columns from finding algorithm (orig. format is like: ('//i.imgur.com/ufufufh.jpg', ufufufh.jpg', 'jpg', '')
	#Creates a list of lists that has only the unique picture key from URL, and then the extension of the picture
	#Also replace the h.jpg at the end of the picture key (which only gets low res pics) with f.jpg (Which gets high res pics)
	images = []
	for row in regexImages:
		images.append([row[1].replace("h.", "."), row[2]])

	return images

#Downloads picture into current directory, naming it the "name" passed in
#Takes the ending key of the picture to be downloaded (eg s1K6Ny.jpg) as well as the name that the file should be called
def download_pic(pic_key, name):
	#Format of url: http://i.imgur.com/KTqYYKVh.jpg

	#Create full URL for download of picture
	url = "http://i.imgur.com/" + pic_key
	#Check if there is a picture with this name already
	#Either rename or skip
	if os.path.isfile(name):
		return True
		#return False
		'''
		#Add "_1" to the end of the picture name if name is taken
		name = "1_" + name
		'''

	#Create object to open url
	picture = URLopener()
	#Try to download picture and save as name
	try:
		picture.retrieve(url, name)
	except: #Error in downloading picture
		return False
	#Return True if process completes, meaning that picture downloaded
	return True

# The worker thread pulls an item from the queue and downloads it
def worker():
	while True:
		item = pics_queue.get()
		#Create name for picture using position in album and picture name
		pic_name = str(item[1]) + "_" + item[0]
		#If the download fails, add to queue of failed downloads
		if not download_pic(item[0], pic_name):
			failed_dl.put(item)
			#Use lock to serialize output
			with lock:
				print("FAILED:", pic_name, "in", threading.current_thread().name)
		#If download completes successfully, print that it has
		else:
			#Use lock to serialize output
			with lock:
				print("Downloaded", pic_name, "in", threading.current_thread().name)
		pics_queue.task_done()

if __name__ == '__main__':
	#Test http://imgur.com/a/poltD
	url_in = input("Input url: ")
	if input("Name the folder different than the album key? (y or n) ") == "y":
		dir_name_in = input("What name should the folder have? ")
		pics = create_pic_list(url_in, dir_name_in)
	else:
		pics = create_pic_list(url_in)
	#If the list could be created:
	if pics:
		#Print stats about info
		print(len(pics), "images in gallery")
		#Get number of each extension type
		extension_count = {}
		for i in pics:
			#If key is already in dict
			if i[1] in extension_count:
				#Increment count of extension
				extension_count[i[1]] = extension_count[i[1]] + 1
			#If first occurrence of extension, create entry
			else:
				extension_count[i[1]] = 1

		#Print dict of extensions by iterating through
		for key in extension_count:
			print(extension_count[key], key, "images")

		#Create queue of data so that threads can all access data
		#Each queue entry will contain the unique image key and the number in the album that the picture is
		pics_queue = queue.Queue()
		for i,image in enumerate(pics):
			pics_queue.put([image[0], i+1])

		#Create empty queue to store failed download keys
		failed_dl = queue.Queue()

		#Lock to serialize console output
		lock = threading.Lock()

		#Number of threads to start to process data
		num_of_threads = 8
		#num_of_threads = int(input("Input number of threads: "))
		print("Beginning download of album with", num_of_threads, "threads")

		#Start timer (using perf_counter for precision
		start = time.perf_counter()

		#Create number of threads specified
		for i in range(num_of_threads):
			 t = threading.Thread(target=worker)
			 t.daemon = True  # thread dies when main thread (only non-daemon thread) exits.
			 t.start()
		#Wait until all tasks have finished, lock until done
		pics_queue.join()
		print("Time:", round(time.perf_counter() - start, 3), "seconds")
		print("For", len(pics), "pictures using", num_of_threads, "threads")
		print(failed_dl.qsize(), "failed downloads")
		#Retry if downloads failed
		if failed_dl.qsize() > 0:
			#Run until break
			while True:
				retry = input("Try downloading " + str(failed_dl.qsize()) + " failed downloads again?(y for yes) ")
				#If user wishes to stop, break
				if retry != "y":
					break
				#If there are not any failed items left, force break
				if failed_dl.qsize() == 0:
					break
				#Reload the download queue from the failed_dl queue
				while failed_dl.qsize() > 0:
					pics_queue.put(failed_dl.get())

				#Start downloading process again
				#Start timer (using perf_counter for precision
				start = time.perf_counter()

				#Create number of threads specified
				for i in range(num_of_threads):
					 t = threading.Thread(target=worker)
					 t.daemon = True  # thread dies when main thread (only non-daemon thread) exits.
					 t.start()
				#Wait until all tasks have finished, lock until done
				pics_queue.join()
				print("Time:", round(time.perf_counter() - start, 3), "seconds")
				print(failed_dl.qsize(), "failed downloads")
	else:
		print("Failed to create list of images in gallery from html")


text:
		        <?php
        $this->load->view('layout/header');
        $this->load->view('layout/container');
		?>
        <!-- BEGIN PAGE BASE CONTENT -->
                   <div class="row">
pending payment
                    </div>
                            <?php
        $this->load->view('layout/footer');
        ?>