text:
//
// server.cpp
// ~~~~~~~~~~
//
// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//

#include "server.hpp"
#include <signal.h>
#include <utility>
#include <sstream>
#include <utils/logger.h>
#include <utils/timestamp.h>

#ifndef WIN32
#include <pwd.h>
#include <fnmatch.h>
#else
#include <shlobj.h>
#endif

namespace http
{
namespace server
{

server::server(const std::string& address,
	unsigned short port, asio::ssl::context *context, size_t pool_size)
    : io_server_pool_(pool_size)
	, signals_(io_server_pool_.get_first_service())
	, acceptor_(io_server_pool_.get_first_service())
    , connection_manager_()
	, socket_ptr_(NULL)
	, sslsocket_ptr_(NULL)
	, context_(context)
{
    asio::ip::tcp::endpoint endpoint(asio::ip::address::from_string(address),
                                     port);
    // Open the acceptor with the option to reuse the address (i.e.
    // SO_REUSEADDR).
    acceptor_.open(endpoint.protocol());
    acceptor_.set_option(asio::ip::tcp::acceptor::reuse_address(true));
    acceptor_.bind(endpoint);
    acceptor_.listen();
    do_accept();

	compress_type_["gzip__"] = "gzip";
	compress_type_["gziped"] = "gzip";
	compress_type_["deflate__"] = "deflate";
	compress_type_["deflated"] = "deflate";

	content_type_["html"] = "text/html";
	content_type_["shtml"] = "text/html";
	content_type_["htm"] = "text/html";
	content_type_["css"] = "text/css";
	content_type_["xml"] = "text/xml";
	content_type_["zip"] = "application/zip";
	content_type_["gz"] = "application/x-gzip";
	content_type_["js"] = "application/x-javascript";
	content_type_["exe"] = "application/octet-stream";
	content_type_["swf"] = "application/x-shockwave-flash";

	index_file_ = "index.html";
	star_count_ = 0;
	end_count_ = 0;
	expire_count_ = 0;
}

void server::add404(routeHandler callback)
{
    addRoute("404", callback);
}

void
server::addRoute(const std::string& routeName, routeHandler callback)
{
    mRoutes[routeName] = callback;
}

server::routeHandler *server::getRoute(const std::string& routeName){
	std::map<std::string, routeHandler>::iterator iter = mRoutes.find(routeName);
	if (iter != mRoutes.end()){
		return &iter->second;
	} else{
		return NULL;
	}
}

void
server::do_accept()
{
	if (context_ == NULL){
		socket_ptr_ = new asio::ip::tcp::socket(io_server_pool_.get_other_service());
		acceptor_.async_accept(*socket_ptr_, [this](asio::error_code ec)
		{
			// Check whether the server was stopped by a signal before this
			// completion handler had a chance to run.
			if (!acceptor_.is_open())
			{
				delete socket_ptr_;
				return;
			}

			if (!ec)
			{
				connection_manager_.start(std::make_shared<connection>(
					socket_ptr_, connection_manager_, *this));
			}else
				delete socket_ptr_;

			do_accept();
		});
	}else{
		sslsocket_ptr_ = new SslSocket(io_server_pool_.get_other_service(), *context_);
		acceptor_.async_accept(sslsocket_ptr_->lowest_layer(), [this](asio::error_code ec)
		{
			// Check whether the server was stopped by a signal before this
			// completion handler had a chance to run.
			if (!acceptor_.is_open())
			{
				return;
			}

			if (!ec)
			{
				connection_manager_.start(std::make_shared<connection>(
					sslsocket_ptr_, connection_manager_, *this));

				do_accept();
			}
		});
	}
}

server::~server()
{
	if (sslsocket_ptr_){
		delete sslsocket_ptr_;
	}

	if (socket_ptr_){
		delete socket_ptr_;
	}

    acceptor_.close();
    connection_manager_.stop_all();
}

void server::Run(){
	io_server_pool_.run();
}

void server::Stop(){
	io_server_pool_.stop();
}

std::string Replace(std::string &str, const std::string &from, const std::string &to)
{
	std::string::size_type pos = 0;
	while ((pos = str.find(from, pos)) != -1) {
		str.replace(pos, from.length(), to);
		pos += to.length();
	}
	return str;
}

#ifdef WIN32
time_t __WinFileTime2UnixTime(const FILETIME &nTime)
{
	LONGLONG nTimeTick = (((LONGLONG)nTime.dwHighDateTime) << 32) + (LONGLONG)(nTime.dwLowDateTime);
	return (time_t)((nTimeTick - 116444736000000000L) / 10000000);
}
#endif

std::string RegularPath(const std::string &path){
	std::string path1 = path;
#ifdef WIN32
	if (path1.size() > 1 && path1.at(0) == '/')
	{
		path1.erase(0, 1);
		path1.insert(1, ":");
	}

	Replace(path1, "/", "\\");
#else
	Replace(path1, "\\", "//");
#endif

	return path1;
}

bool server::GetAttribue(const std::string &strFile0, FileAttribute &nAttr)
{
	std::string file1 = RegularPath(strFile0);

#ifdef WIN32
	WIN32_FILE_ATTRIBUTE_DATA nFileAttr;
	if (GetFileAttributesExA(file1.c_str(), GetFileExInfoStandard, &nFileAttr))
	{
		nAttr.m_bDirectory = (nFileAttr.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
		nAttr.m_nCreateTime = __WinFileTime2UnixTime(nFileAttr.ftCreationTime);
		nAttr.m_nModifyTime = __WinFileTime2UnixTime(nFileAttr.ftLastWriteTime);
		nAttr.m_nAccessTime = __WinFileTime2UnixTime(nFileAttr.ftLastAccessTime);
		nAttr.m_nSize = (((uint64_t)(nFileAttr.nFileSizeHigh)) << 32) + (uint64_t)(nFileAttr.nFileSizeLow);

		return true;
	}
#else
	struct stat nFileStat;
	if (stat(file1.c_str(), &nFileStat) == 0)
	{
		nAttr.m_bDirectory = (nFileStat.st_mode & S_IFDIR) != 0;
		nAttr.m_nCreateTime = nFileStat.st_ctime;
		nAttr.m_nModifyTime = nFileStat.st_mtime;
		nAttr.m_nAccessTime = nFileStat.st_atime;
		nAttr.m_nSize = nFileStat.st_size;

		return true;
	}
#endif
	else
	{
		return false;
	}
}

std::string ToLower(const std::string &strIn)
{
	std::string str = strIn;
	for (std::string::size_type i = 0; i < str.length(); ++i)
	if (str[i] >= 'A' && str[i] <= 'Z') {
		str[i] += 0x20;
	}
	return str;
}

std::string GetExtensionName(const std::string &strPath)
{
	std::string strNormalPath = RegularPath(strPath);

	// check whether url is like "*****?url=*.*.*.*"
	size_t nEndPos = strNormalPath.find('?');
	if (nEndPos != std::string::npos)
	{
		strNormalPath = strNormalPath.substr(0, nEndPos);
	}

	size_t nPos = strNormalPath.rfind('.');
	if (std::string::npos == nPos || (nPos + 1) == strNormalPath.size())
	{
		return std::string("");
	}

	return strNormalPath.substr(nPos + 1);
}

bool GetLocalTimestamp(time_t nTimestamp, struct tm &nTimeValue)
{
#ifdef WIN32
	return localtime_s(&nTimeValue, &nTimestamp) == 0;
#else
	return localtime_r(&nTimestamp, &nTimeValue) != NULL;
#endif
}

bool GetGmtTimestamp(time_t nTimestamp, struct tm &nTimeValue)
{
#ifdef WIN32
	return gmtime_s(&nTimeValue, &nTimestamp) == 0;
#else
	return gmtime_r(&nTimestamp, &nTimeValue) != NULL;
#endif
}

std::string FormatLongTime(time_t tmValue, bool bGmt)
{
	static const char *pszWeekName[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
	static const char *pszMonthName[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
	struct tm nTmInfo = { 0 };

	if (bGmt) GetGmtTimestamp(tmValue, nTmInfo);
	else GetLocalTimestamp(tmValue, nTmInfo);

	if (nTmInfo.tm_wday < 0 || nTmInfo.tm_wday >= 7)
	{
		nTmInfo.tm_wday = 0;
	}

	if (nTmInfo.tm_mon < 0 || nTmInfo.tm_mon >= 12)
	{
		nTmInfo.tm_mon = 0;
	}

	char buffer[256];
#ifdef WIN32
	sprintf_s(buffer, sizeof(buffer), "%s, %02d %s %04d %02d:%02d:%02d%s",
		pszWeekName[nTmInfo.tm_wday],
		nTmInfo.tm_mday,
		pszMonthName[nTmInfo.tm_mon],
		nTmInfo.tm_year + 1900,
		nTmInfo.tm_hour, nTmInfo.tm_min, nTmInfo.tm_sec,
		bGmt ? " GMT" : "");
#else
	sprintf(buffer, "%s, %02d %s %04d %02d:%02d:%02d%s",
		pszWeekName[nTmInfo.tm_wday],
		nTmInfo.tm_mday,
		pszMonthName[nTmInfo.tm_mon],
		nTmInfo.tm_year + 1900,
		nTmInfo.tm_hour, nTmInfo.tm_min, nTmInfo.tm_sec,
		bGmt ? " GMT" : "");
#endif
	std::string bufferstring = buffer;

	return bufferstring;
}

int32_t Compare(const std::string &str1, const std::string &str2, bool bIgnoreCase /* = false */)
{
	if (!bIgnoreCase)
	{
		return strcmp(str1.c_str(), str2.c_str());
	}
	else
	{
#ifdef WIN32
		return _stricmp(str1.c_str(), str2.c_str());
#else
		return strcasecmp(str1.c_str(), str2.c_str());
#endif
	}
}

std::string FormatV(const char *pszFormat, va_list pArgList)
{
	std::string strRes;
	int   nSize = 0;
	char *pszBuffer = NULL;

#ifdef WIN32
	nSize = _vscprintf(pszFormat, pArgList);
#else
	va_list pArgCopy;
	va_copy(pArgCopy, pArgList);
	nSize = vsnprintf(NULL, 0, pszFormat, pArgCopy);
	va_end(pArgCopy);
#endif //OS_PLATFORM_WINDOWS

	pszBuffer = new char[nSize + 1];
	pszBuffer[nSize] = 0;
	vsnprintf(pszBuffer, nSize, pszFormat, pArgList);

	strRes = pszBuffer;
	delete[]pszBuffer;

	return strRes;
}

std::string Format(const char *pszFormat, ...)
{
	va_list pArgList;

	va_start(pArgList, pszFormat);
	std::string strRes = FormatV(pszFormat, pArgList);
	va_end(pArgList);

	return strRes;
}

void Strtok(const std::string &str, char separator, std::vector<std::string> &arr)
{
	size_t pos = 0;
	size_t newPos = 0;

	while (std::string::npos != pos) {
		pos = str.find_first_of(separator, newPos);
		if (std::string::npos == pos) { // ½áÊøÁË
			if (pos > newPos) {
				arr.push_back(str.substr(newPos, pos - newPos));
			}
			break;
		}
		else {
			if (pos > newPos) {
				arr.push_back(str.substr(newPos, pos - newPos));
			}
			newPos = pos + 1;
		}
	}
}

void
server::handle_request(const request& req, reply& rep)
{
    // Decode url to path.
	se_mutex_.lock();
	star_count_++;
	se_mutex_.unlock();
	int64_t start_time = utils::Timestamp::HighResolution();

	std::string command = req.command;
    if (mRoutes.find(command) != mRoutes.end())
    {
		mRoutes[command](req, rep.content);

        rep.status = reply::ok;
        rep.headers.resize(3);
        rep.headers[0].name = "Content-Length";
        rep.headers[0].value = std::to_string(rep.content.size());
        rep.headers[1].name = "Content-Type";
		rep.headers[1].value = "application/json";
		rep.headers[2].name = "Connection";
		rep.headers[2].value = "close";
    }
    else
    {
		int32_t nNeed = 0;//1:notfound, 2: fobiden, 3: notmodify, 4:nomal
		std::string file_path;
		uint64_t nFileSize = 0;
		std::string strContentEncoding;
		std::string strContentType;
		do {

			if (command.size() == 0 || command[0] != '/') command = "/" + command;
			if (command == "/") command += index_file_;
			if (command.find("/../") != std::string::npos ||
				command.find("\\..\\") != std::string::npos ||
				command.find("/..\\") != std::string::npos ||
				command.find("\\../") != std::string::npos)
			{
				nNeed = 2;
				//rep = reply::stock_reply(reply::forbidden);
				break;
			}

			FileAttribute nFileAttr;
			file_path = web_home_ + command;

			if (!GetAttribue(file_path, nFileAttr))
			{
				nNeed = 1;
				//rep = reply::stock_reply(reply::not_found);
				break;
			}
			else if (nFileAttr.m_bDirectory)
			{
				if (command[command.size() - 1] != '/')
				{
					// redirect
					nNeed = 2;
					//rep = reply::stock_reply(reply::forbidden);
					break;
				}

				file_path += "/";
				file_path += index_file_;

				if (!GetAttribue(file_path, nFileAttr))
				{
					nNeed = 1;
					break;
				}
			}

			nFileSize = nFileAttr.m_nSize;

			std::string strFileExt = ToLower(GetExtensionName(file_path));
			std::string strLastModified = FormatLongTime(nFileAttr.m_nModifyTime, true);

			if (compress_type_.find(strFileExt) != compress_type_.end())
			{
				strContentEncoding = compress_type_[strFileExt];

				if (strFileExt.size() + 1 < file_path.size())
				{
					std::string strActualFile = file_path.substr(0, file_path.size() - strFileExt.size() - 1);
					strFileExt = ToLower(GetExtensionName(strActualFile));
				}
			}

			if (content_type_.find(strFileExt) != content_type_.end())
			{
				strContentType = content_type_[strFileExt];
			}

			std::string strRequestModified = req.GetHeaderValue("if-modified-since");
			if ( Compare(strRequestModified, strLastModified, true) == 0)
			{
				nNeed = 3;
			}
			else
			{
				//if (!nFile.Open(strFilePath, Utils::File::FILE_M_READ))
				//{
				//	errorif = true;
				//	rep = reply::stock_reply(reply::internal_server_error);
				//	break;
				//}

				nNeed = 4;
			}
		} while ( false );

		if ( nNeed == 1 ){
			if (mRoutes.find("404") != mRoutes.end())
			{
				mRoutes["404"](req, rep.content);

				rep.status = reply::ok;
				rep.headers.resize(3);
				rep.headers[0].name = "Content-Length";
				rep.headers[0].value = std::to_string(rep.content.size());
				rep.headers[1].name = "Content-Type";
				rep.headers[1].value = "text/html";
				rep.headers[2].name = "Connection";
				rep.headers[2].value = "close";
			}
			else
			{
				rep = reply::stock_reply(reply::not_found);
				return;
			}
		}
		else if (nNeed == 2){
			rep = reply::stock_reply(reply::forbidden);
		}
		else if (nNeed == 3){
			//not modify
			rep.status = reply::not_modified;
		}
		else {
			FILE *handle;
			handle = fopen(file_path.c_str(), "r");
			if (NULL == handle)
			{
				rep = reply::stock_reply(reply::internal_server_error);
			}

			const size_t nBufferSize = 1024;
			size_t nReadBytes = 0;
			char nTmpBuffer[nBufferSize];

			while (nReadBytes < nFileSize)
			{
				size_t nCount = std::min<size_t>(nFileSize - nReadBytes, nBufferSize);
				size_t nRetBytes = fread(nTmpBuffer, 1, nCount, handle);

				if (nRetBytes > 0)
				{
					nReadBytes += nRetBytes;
					rep.content.append(nTmpBuffer, nRetBytes);
				}
				else
				{
					break;
				}
			}

			fclose(handle);

			rep.status = reply::ok;
			rep.headers.resize(4);
			rep.headers[0].name = "Content-Length";
			rep.headers[0].value = std::to_string(rep.content.size());
			rep.headers[1].name = "Content-Type";
			rep.headers[1].value = strContentType;
			rep.headers[2].name = "Content-Encoding";
			rep.headers[2].value = strContentEncoding;
			rep.headers[3].name = "Connection";
			rep.headers[3].value = "close";

		}
    }

	int64_t use_time = (utils::Timestamp::HighResolution() - start_time);
	if (use_time > utils::MICRO_UNITS_PER_SEC) {
		LOG_WARN("Execute request(uri:%s, body:%s) from ip(%s), use time(" FMT_I64 "ms) is too log, request(start:" FMT_I64 "|end:" FMT_I64 ")",
			req.uri.c_str(), req.body.c_str(), req.peer_address_.ToIpPort().c_str(), use_time / utils::MILLI_UNITS_PER_SEC, star_count_, end_count_);

		se_mutex_.lock();
		expire_count_++;
		se_mutex_.unlock();
	}

	// Decode url to path.
	se_mutex_.lock();
	end_count_++;
	se_mutex_.unlock();
}

void server::SetHome(const std::string &home){
	web_home_ = home;
}

void server::SetIndexName(const std::string &index_name){
	index_file_ = index_name;
}

bool
url_decode(const std::string& in, std::string& out)
{
    out.clear();
    out.reserve(in.size());
    for (std::size_t i = 0; i < in.size(); ++i)
    {
        if (in[i] == '%')
        {
            if (i + 3 <= in.size())
            {
                int value = 0;
                std::istringstream is(in.substr(i + 1, 2));
                if (is >> std::hex >> value)
                {
                    out += static_cast<char>(value);
                    i += 2;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
        }
        else if (in[i] == '+')
        {
            out += ' ';
        }
        else
        {
            out += in[i];
        }
    }
    return true;
}

void server::parseParams(const std::string& params, std::map<std::string, std::string>& retMap)
{
    bool buildingName=true;
    std::string name,value;
    for(auto c : params)
    {
        if(c == '?')
        {

        }else if(c == '=')
        {
            buildingName = false;
        }else if(c == '&')
        {
            buildingName = true;
            retMap[name] = value;
            name = "";
            value = "";
        } else
        {
            if(buildingName) name += c;
            else value += c;
        }
    }
    if(name.size() && value.size())
    {
        retMap[name] = value;
    }
}

} // namespace server
} // namespace http


text:
/*! Program info */
#pragma once

#include <types/basic.h>

typedef struct _prog_info_t_
{
	/* defined in compile time */
	void   *init;		/* process initialization function */
	void   *entry;		/* starting user function */
	void   *param;		/* parameter to starting function */

	/* (re)defined in run time */
	void   *heap;
	size_t  heap_size;

	void   *mpool;
}
prog_info_t;

void prog_init ( void *args );

redpajama_set_name: RedPajamaGithub


text:
var express = require('express');
var router = express.Router();

/* GET home page. */
router.get('/', function(req, res, next) {
  res.render('XHRtest', { title: 'XHRtest' });
});

module.exports = router;


text:
use std::env;
use std::path::PathBuf;
use std::process;

struct BuildJob {
    source_directory: PathBuf
}

impl BuildJob {
    fn build(&self) {
        //TODO consider own command so that std{in,our,err} can be controlled
        process::Command::new("./configure")
            .arg(String::from("--prefix=") + self.prefix().as_str())
            .status().
            expect("Configure failed");

        process::Command::new("make").status().expect("make failed");
    }

    fn install(&self) {
        //TODO maybe detect if its necessary to build
        self.build();

        process::Command::new("make")
            .arg("install")
            .status().expect("make install failed");
    }

    fn name(&self) -> String {
        let dir_name = self.source_directory.components().last().unwrap();
        match dir_name {
            std::path::Component::Normal(name) => {
                 name.to_os_string().into_string().unwrap()
            },
            _ => {
                println!("Failed");
                "Failed".to_string()
            }

        }
    }

    fn prefix(&self) -> String {
        String::from("/home/kirillvr/.kitaman/pool/") + self.name().as_str()
    }

    fn exec(&self, args: Vec<String>) {
        let cmd = &args[0]; //TODO Panic
        let rest_of_args: Vec<&String> = args.iter().skip(1).collect();
        println!("{}", cmd);
        println!("{:?}", rest_of_args);
        process::Command::new(cmd)
            .args(rest_of_args)
            .status().expect("Failed exec");
    }
}

fn main() {
    //TODO proper args parsing
    let command = env::args().nth(1).expect("Please provide at least one argument");

    let job = BuildJob{source_directory: env::current_dir().expect("Failed to get current directory")};
    if command == "build" {
        job.build();
    }
    if command == "install" {
        job.install();
    }
    if command == "prefix" {
        job.prefix();
    }

    if command == "name" {
        let name = job.name();
        println!("{}", name);
    }

    if command == "exec" {
        let args: Vec<String> = env::args().skip(2).collect();
        job.exec(args);
    }
}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.senac.tads.livraria.pi3a.model;

/**
 *
 * @author douglas.gsilva2
 */
public class Cliente {
    private int id;
    private String nome;
    private String cpf;
    private String end;
    private String bairro;
    private String cep;
    private String estado;
    private String cel;
    private String email;

     public Cliente(){

    }
    public Cliente(String nome, String cpf, String end, String bairro,
            String cep, String estado, String cel, String email) {
    this.nome = nome;
    this.cpf = cpf;
    this.end = end;
    this.bairro = bairro;
    this.cep = cep;
    this.estado = estado;
    this.cel = cel;
    this.email = email;
  }

    public Cliente(int id, String nome, String cpf, String end, String bairro,
            String cep, String estado, String cel, String email) {
    this.id = id;
    this.nome = nome;
    this.cpf = cpf;
    this.end = end;
    this.bairro = bairro;
    this.cep = cep;
    this.estado = estado;
    this.cel = cel;
    this.email = email;
  }

     public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }
    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getCpf() {
        return cpf;
    }

    public void setCpf(String cpf) {
        this.cpf = cpf;
    }

    public String getEnd() {
        return end;
    }

    public void setEnd(String end) {
        this.end = end;
    }

    public String getBairro() {
        return bairro;
    }

    public void setBairro(String bairro) {
        this.bairro = bairro;
    }

    public String getCep() {
        return cep;
    }

    public void setCep(String cep) {
        this.cep = cep;
    }

    public String getEstado() {
        return estado;
    }

    public void setEstado(String estado) {
        this.estado = estado;
    }

    public String getCel() {
        return cel;
    }

    public void setCel(String cel) {
        this.cel = cel;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.lacv.marketplatform.dtos.config;

import com.dot.gcpbasedot.annotation.NotNull;
import com.dot.gcpbasedot.annotation.Order;
import com.dot.gcpbasedot.annotation.TextField;
import com.dot.gcpbasedot.annotation.TypeFormField;
import com.dot.gcpbasedot.enums.FieldType;
import com.lacv.marketplatform.dtos.process.TagPDto;
import com.lacv.marketplatform.dtos.process.UsuarioPDto;
import java.util.List;

/**
 *
 * @author grupot
 */
public class ContactConfigDto {

    @Order(1)
    @NotNull
    @TextField("Nombre de Usuario")
    private String userName;

    @Order(2)
    @NotNull
    @TextField("Correo")
    @TypeFormField(FieldType.EMAIL)
    private String mail;

    @Order(3)
    @TextField("Celular")
    private String cellPhone;

    @Order(4)
    @TextField("Comentarios")
    @TypeFormField(FieldType.TEXT_AREA)
    private String comments;

    @Order(5)
    @TextField("Usuario")
    private UsuarioPDto usuario;

    private List<TagPDto> tags;

    public ContactConfigDto(){
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getMail() {
        return mail;
    }

    public void setMail(String mail) {
        this.mail = mail;
    }

    public String getCellPhone() {
        return cellPhone;
    }

    public void setCellPhone(String cellPhone) {
        this.cellPhone = cellPhone;
    }

    public String getComments() {
        return comments;
    }

    public void setComments(String comments) {
        this.comments = comments;
    }

    public UsuarioPDto getUsuario() {
        return usuario;
    }

    public void setUsuario(UsuarioPDto usuario) {
        this.usuario = usuario;
    }

    public List<TagPDto> getTags() {
        return tags;
    }

    public void setTags(List<TagPDto> tags) {
        this.tags = tags;
    }

}


text:
main = do
  line <- getLine
  let n = read line :: Int
  putStrLn $ if (even 1) then "yes" else "no"


text:
<?php
/**
 * Created by PhpStorm.
 * User: hong
 * Date: 16-11-6
 * Time: 下午7:56
 */

namespace O\DesignPatterns\Creational\Prototype;

class FooBookPrototype extends BookPrototype
{

    protected $category = 'foo';

    public function __clone()
    {

    }
}


text:
<?php

namespace Phalcon\Scanners;

use Phalcon\Utils\FsUtils;
use Phalcon\Config\Exception;
use Phalcon\Mvc\User\Component;
use Phalcon\Config as PhConfig;
use Phalcon\Config\Adapter\Ini as IniConfig;
use Phalcon\Config\Adapter\Json as JsonConfig;
use Phalcon\Config\Adapter\Yaml as YamlConfig;

/**
 * \Phalcon\Scanners\Config
 *
 * @package Phalcon\Scanners
 */
class Config extends Component
{
    protected $configDirs = [
        'config',
        'app/config',
        'apps/config',
        'app/frontend/config',
        'apps/frontend/config',
        'app/backend/config',
        'apps/backend/config',
    ];

    protected $configAdapters = [
        'ini'  => IniConfig::class,
        'json' => JsonConfig::class,
        'php'  => PhConfig::class,
        'php5' => PhConfig::class,
        'inc'  => PhConfig::class,
        'yml'  => YamlConfig::class,
        'yaml' => YamlConfig::class,
    ];

    protected $basePath = '';

    public function __construct($basePath)
    {
        if (is_string($basePath)) {
            $this->basePath = rtrim($basePath, '\\/');
        }
    }

    /**
     * Scans for application config.
     *
     * @param string $filename The config basename.
     * @return null|PhConfig
     */
    public function scan($filename)
    {
        $config = null;
        $filename = pathinfo($filename, PATHINFO_FILENAME);

        foreach ($this->getConfigPaths() as $probablyPath) {
            foreach ($this->configAdapters as $ext => $adapter) {
                $probablyConfig = $probablyPath . DS . "{$filename}.{$ext}";

                if (is_file($probablyConfig) && is_readable($probablyConfig)) {
                    if (in_array($ext, ['php', 'php5', 'inc'])) {
                        /** @noinspection PhpIncludeInspection */
                        $config = include($probablyConfig);
                        if (is_array($config)) {
                            $config = new Config($config);
                        }
                    } else {
                        $config = new $adapter($probablyConfig);
                    }

                    break(2);
                }
            }
        }

        return $config;
    }

    /**
     * Alias for Config::scan but throws Exception if configuration could not be found.
     *
     * @param string $filename The config basename.
     *
     * @return PhConfig
     * @throws Exception
     */
    public function load($filename)
    {
        $config = $this->scan($filename);

        if (!$config instanceof PhConfig) {
            throw new Exception(
                sprintf(
                    "Configuration file couldn't be loaded! Scanned paths: %s",
                    implode(', ', $this->getConfigPaths())
                )
            );
        }

        return $config;
    }

    /**
     * Prepares config paths.
     *
     * @return array
     */
    public function getConfigPaths()
    {
        /** @var FsUtils $fsUtils */
        $fsUtils  = $this->getDI()->getShared('fs');
        $basePath = $this->basePath;

        if (!is_dir($basePath) || !is_readable($basePath)) {
            return [];
        }

        return array_map(function ($val) use ($basePath, $fsUtils) {
            return $basePath . $fsUtils->normalize("/{$val}");
        }, $this->configDirs);
    }
}


text:
package org.ovirt.engine.ui.webadmin.section.main.view.popup.host.panels;

import org.ovirt.engine.ui.uicommonweb.models.hosts.network.LogicalNetworkModel;

import com.google.gwt.resources.client.ImageResource;

public class ExternalNetworkPanel extends NetworkPanel {

    public ExternalNetworkPanel(LogicalNetworkModel item, NetworkPanelsStyle style) {
        super(item, style, false);
        getElement().addClassName(style.disabledNetworkPanel());
    }

    @Override
    protected ImageResource getStatusImage() {
        return resources.openstackImage();
    }

}


text:
package v1beta1

import (
	"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
	"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"

	_ "github.com/openshift/origin/pkg/authorization/api/v1beta1"
	_ "github.com/openshift/origin/pkg/build/api/v1beta1"
	_ "github.com/openshift/origin/pkg/config/api/v1beta1"
	_ "github.com/openshift/origin/pkg/deploy/api/v1beta1"
	_ "github.com/openshift/origin/pkg/image/api/v1beta1"
	_ "github.com/openshift/origin/pkg/oauth/api/v1beta1"
	_ "github.com/openshift/origin/pkg/project/api/v1beta1"
	_ "github.com/openshift/origin/pkg/route/api/v1beta1"
	_ "github.com/openshift/origin/pkg/sdn/api/v1beta1"
	_ "github.com/openshift/origin/pkg/template/api/v1beta1"
	_ "github.com/openshift/origin/pkg/user/api/v1beta1"
)

// Codec encodes internal objects to the v1beta1 scheme
var Codec = runtime.CodecFor(api.Scheme, "v1beta1")

func init() {
	api.Scheme.AddKnownTypes("v1beta1")
}


text:
#region Licence

#endregion

using System;

namespace SpringAir.Domain
{
	///
	/// Base class for those domain objects that are persistent.
	///
	/// <remarks>
	///

	/// This is a pragmatic concession to the persistence layer. This base
	/// class and its single property are not part of the 'pure' domain
	/// but it just makes persistence so much easier if each persistable class
	/// has a unique identifier (especially on a greenfield project such as
	/// this).
	///

	/// </remarks>
	/// <author>Rick Evans</author>
	/// <version>$Id: Entity.cs,v 1.3 2005/12/21 16:06:35 springboy Exp $</version>
	[Serializable]
	public abstract class Entity
	{
		///
		/// Identifies an <see cref="SpringAir.Domain.Entity"/> that is 'new'.
		///
		/// <remarks>
		///

		/// A 'new' <see cref="SpringAir.Domain.Entity"/> is one that has not
		/// yet been persisted.
		///

		/// </remarks>
		public const long Transient = long.MinValue;

		private long id = Transient;

		///
		/// Creates a new instance of the <see cref="Entity"/> class.
		///
		/// <remarks>
		///

		/// This is an <see langword="abstract"/> class, and as such exposes
		/// no publicly visible constructors.
		///

		/// </remarks>
		protected Entity()
		{
		}

		///
		/// Creates a new instance of the <see cref="Entity"/> class.
		///
		/// <remarks>
		///

		/// This is an <see langword="abstract"/> class, and as such exposes
		/// no publicly visible constructors.
		///

		/// </remarks>
		/// <param name="id">
		/// The number that uniquely identifies this instance.
		/// </param>
		protected Entity(long id)
		{
			this.id = id;
		}

		///
		/// The number that uniquely identifies this instance.
		///
		public long Id
		{
			get { return id; }
			set { id = value; }
		}

		///
		/// Is this instance transient?
		///
		/// <remarks>
		///

		/// That is, does it exist in permanent storage?
		///

		/// </remarks>
		/// <value>
		/// <see lang="true"/> if this instance is transient.
		/// </value>
		public bool IsTransient
		{
			get { return id == Transient; }
		}
	}
}


text:
package com.muqdd.iuob2.features.schedule_builder;

import android.util.TypedValue;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.muqdd.iuob2.R;
import com.muqdd.iuob2.app.BaseModel;
import com.muqdd.iuob2.models.FinalExam;

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

import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Ali Yusuf on 6/7/2017.
 * iUOB-2
 */

@SuppressWarnings({"unused","WeakerAccess"})
public class BCourse extends BaseModel<BCourse, BCourse.ViewHolder> {

    @SerializedName("_id")
    @Expose
    private String id;
    @SerializedName("exam")
    @Expose
    private FinalExam exam;
    @SerializedName("sections")
    @Expose
    private List<BSection> sections = null;

    public BCourse() {}

    public BCourse(BCourse course) {
        this(course.getId());
    }

    public BCourse(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    }

    public String getHeaderId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public List<BSection> getSections() {
        if (sections == null){
            sections = new ArrayList<>();
        }
        return sections;
    }

    public void setSections(List<BSection> sections) {
        this.sections = sections;
    }

    public FinalExam getExam() {
        return exam;
    }

    public void setExam(FinalExam exam) {
        this.exam = exam;
    }

    public static List<String> getCoursesIds(List<BCourse> list) {
        List<String> ids = new ArrayList<>();
        if (list == null) {
            return ids;
        }
        for (BCourse course : list) {
            ids.add(course.id);
        }
        return ids;
    }

    @Override
    public int getType() {
        return R.id.course_title;
    }

    @Override
    public int getLayoutRes() {
        return R.layout.row_my_course;
    }

    @Override
    public void bindView(ViewHolder viewHolder, List<Object> payloads) {
        //call super so the selection is already handled for you
        super.bindView(viewHolder, payloads);
        viewHolder.courseTitle.setText(id);
    }

    //reset the view here (this is an optional method, but recommended)
    @Override
    public void unbindView(ViewHolder holder) {
        super.unbindView(holder);
        holder.courseTitle.setText(null);
    }

    @Override
    public ViewHolder getViewHolder(View v) {
        return new ViewHolder(v);
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || !(o instanceof BCourse))
            return false;
        else if (o == this)
            return true;
        return id != null && ((BCourse) o).id != null && id.equals(((BCourse) o).id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }

    public static class ViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.course_title) TextView courseTitle;
        @BindView(R.id.course_pre) TextView section;
        public @BindView(R.id.delete) LinearLayout delete;

        public ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
            section.setText(null);
            section.setVisibility(View.GONE);
            courseTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
        }
    }
}


text:
//
//
// MIT License
//
// Copyright (c) 2017 Stellacore Corporation.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject
// to the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
// KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//

#ifndef io_file_INCL_
#define io_file_INCL_

/*! \file
\brief Declarations for io::file
*/

#include <cstddef>
#include <string>

namespace io
{

//! Filesystem functions.
namespace file
{

	//! get full canoncial expression for path - POSIX Only !!
	std::string
	fullPathForPosix
		( std::string const & anyPath
		);

	//! trailing part of path
	std::string
	elidedPath
		( std::string const & anyPath
		, size_t const & numParts = 2u
		, char const & sep = '/'
		);

}

}

// Inline definitions
// #include "libio/file.inl"

#endif // io_file_INCL_


text:
// Type definitions for fixed-data-table 0.4.7
// Project: https://github.com/facebook/fixed-data-table
// Definitions by: Petar Paar <https://github.com/pepaar>
// Definitions: https://github.com/borisyankov/DefinitelyTyped

/// <reference path="../react/react.d.ts"/>

declare namespace FixedDataTable {
    export var version: string;

    export interface TableProps extends __React.Props<Table> {
         /**
	     * Pixel width of table. If all columns do not fit,
	     * a horizontal scrollbar will appear.
	     */
	    width: number;

	    /**
	     * Pixel height of table. If all rows do not fit,
	     * a vertical scrollbar will appear.
	     *
	     * Either `height` or `maxHeight` must be specified.
	     */
	    height?: number;

	    /**
	     * Maximum pixel height of table. If all rows do not fit,
	     * a vertical scrollbar will appear.
	     *
	     * Either `height` or `maxHeight` must be specified.
	     */
	    maxHeight?: number;

	    /**
	     * Pixel height of table's owner, this is used in a managed scrolling
	     * situation when you want to slide the table up from below the fold
	     * without having to constantly update the height on every scroll tick.
	     * Instead, vary this property on scroll. By using `ownerHeight`, we
	     * over-render the table while making sure the footer and horizontal
	     * scrollbar of the table are visible when the current space for the table
	     * in view is smaller than the final, over-flowing height of table. It
	     * allows us to avoid resizing and reflowing table when it is moving in the
	     * view.
	     *
	     * This is used if `ownerHeight < height` (or `maxHeight`).
	     */
	    ownerHeight?: number;

        /**
         * hidden or auto
         */
	    overflowX?: string;
	    overflowY?: string;

	    /**
	     * Number of rows in the table.
	     */
	    rowsCount: number;

	    /**
	     * Pixel height of rows unless `rowHeightGetter` is specified and returns
	     * different value.
	     */
	    rowHeight: number;

	    /**
	     * If specified, `rowHeightGetter(index)` is called for each row and the
	     * returned value overrides `rowHeight` for particular row.
	     */
	    rowHeightGetter?: Function;

	    /**
	     * To get rows to display in table, `rowGetter(index)`
	     * is called. `rowGetter` should be smart enough to handle async
	     * fetching of data and return temporary objects
	     * while data is being fetched.
	     */
	    rowGetter: Function;

	    /**
	     * To get any additional CSS classes that should be added to a row,
	     * `rowClassNameGetter(index)` is called.
	     */
	    rowClassNameGetter?: Function;

	    /**
	     * Pixel height of the column group header.
	     */
	    groupHeaderHeight?: number;

	    /**
	     * Pixel height of header.
	     */
	    headerHeight: number;

	    /**
	     * Function that is called to get the data for the header row.
	     * If the function returns null, the header will be set to the
	     * Column's label property.
	     */
	    headerDataGetter?: Function;

	    /**
	     * Pixel height of footer.
	     */
	    footerHeight?: number;

	    /**
	     * DEPRECATED - use footerDataGetter instead.
	     * Data that will be passed to footer cell renderers.
	     */
	    footerData?: any;

	    /**
	     * Function that is called to get the data for the footer row.
	     */
	    footerDataGetter?: Function;

	    /**
	     * Value of horizontal scroll.
	     */
	    scrollLeft?: number;

	    /**
	     * Index of column to scroll to.
	     */
	    scrollToColumn?: number;

	    /**
	     * Value of vertical scroll.
	     */
	    scrollTop?: number;

	    /**
	     * Index of row to scroll to.
	     */
	    scrollToRow?: number;

	    /**
	     * Callback that is called when scrolling starts with current horizontal
	     * and vertical scroll values.
	     */
	    onScrollStart?: Function;

	    /**
	     * Callback that is called when scrolling ends or stops with new horizontal
	     * and vertical scroll values.
	     */
	    onScrollEnd?: Function;

	    /**
	     * Callback that is called when `rowHeightGetter` returns a different height
	     * for a row than the `rowHeight` prop. This is necessary because initially
	     * table estimates heights of some parts of the content.
	     */
	    onContentHeightChange?: Function;

	    /**
	     * Callback that is called when a row is clicked.
	     */
	    onRowClick?: Function;

	    /**
	     * Callback that is called when a row is double clicked.
	     */
	    onRowDoubleClick?: Function;

	    /**
	     * Callback that is called when a mouse-down event happens on a row.
	     */
	    onRowMouseDown?: Function;

	    /**
	     * Callback that is called when a mouse-enter event happens on a row.
	     */
	    onRowMouseEnter?: Function;

	    /**
	     * Callback that is called when a mouse-leave event happens on a row.
	     */
	    onRowMouseLeave?: Function;

	    /**
	     * Callback that is called when resizer has been released
	     * and column needs to be updated.
	     *
	     * Required if the isResizable property is true on any column.
	     *
	     * ```
	     * function(
	     *   newColumnWidth: number,
	     *   dataKey: string,
	     * )
	     * ```
	     */
	    onColumnResizeEndCallback?: Function;

	    /**
	     * Whether a column is currently being resized.
	     */
	    isColumnResizing?: boolean
    }

    interface ColumnProps {
        /**
	     * The horizontal alignment of the table cell content.
         * 'left', 'center', 'right'
	     */
	    align?: string;

	    /**
	     * className for this column's header cell.
	     */
	    headerClassName?: string;

	    /**
	     * className for this column's footer cell.
	     */
	    footerClassName?: string;

	    /**
	     * className for each of this column's data cells.
	     */
	    cellClassName?: string;

	    /**
	     * The cell renderer that returns React-renderable content for table cell.
	     * ```
	     * function(
	     *   cellData: any,
	     *   cellDataKey: string,
	     *   rowData: object,
	     *   rowIndex: number,
	     *   columnData: any,
	     *   width: number
	     * ): ?$jsx
	     * ```
	     */
	    cellRenderer?: Function;

	    /**
	     * The getter `function(string_cellDataKey, object_rowData)` that returns
	     * the cell data for the `cellRenderer`.
	     * If not provided, the cell data will be collected from
	     * `rowData[cellDataKey]` instead. The value that `cellDataGetter` returns
	     * will be used to determine whether the cell should re-render.
	     */
	    cellDataGetter?: Function;

	    /**
	     * The key to retrieve the cell data from the data row. Provided key type
	     * must be either `string` or `number`. Since we use this
	     * for keys, it must be specified for each column.
	     */
	    dataKey: string|number;

	    /**
	     * Controls if the column is fixed when scrolling in the X axis.
	     */
	    fixed?: boolean;

	    /**
	     * The cell renderer that returns React-renderable content for table column
	     * header.
	     * ```
	     * function(
	     *   label: ?string,
	     *   cellDataKey: string,
	     *   columnData: any,
	     *   rowData: array<?object>,
	     *   width: number
	     * ): ?$jsx
	     * ```
	     */
	    headerRenderer?: Function;

	    /**
	     * The cell renderer that returns React-renderable content for table column
	     * footer.
	     * ```
	     * function(
	     *   label: ?string,
	     *   cellDataKey: string,
	     *   columnData: any,
	     *   rowData: array<?object>,
	     *   width: number
	     * ): ?$jsx
	     * ```
	     */
	    footerRenderer?: Function;

	    /**
	     * Bucket for any data to be passed into column renderer functions.
	     */
	    columnData?: any;

	    /**
	     * The column's header label.
	     */
	    label: string;

	    /**
	     * The pixel width of the column.
	     */
	    width: number;

	    /**
	     * If this is a resizable column this is its minimum pixel width.
	     */
	    minWidth?: number;

	    /**
	     * If this is a resizable column this is its maximum pixel width.
	     */
	    maxWidth?: number;

	    /**
	     * The grow factor relative to other columns. Same as the flex-grow API
	     * from http://www.w3.org/TR/css3-flexbox/. Basically, take any available
	     * extra width and distribute it proportionally according to all columns'
	     * flexGrow values. Defaults to zero (no-flexing).
	     */
	    flexGrow?: number;

	    /**
	     * Whether the column can be resized with the
	     * FixedDataTableColumnResizeHandle. Please note that if a column
	     * has a flex grow, once you resize the column this will be set to 0.
	     *
	     * This property only provides the UI for the column resizing. If this
	     * is set to true, you will need ot se the onColumnResizeEndCallback table
	     * property and render your columns appropriately.
	     */
	    isResizable?: boolean;

	    /**
	     * Experimental feature
	     * Whether cells in this column can be removed from document when outside
	     * of viewport as a result of horizontal scrolling.
	     * Setting this property to true allows the table to not render cells in
	     * particular column that are outside of viewport for visible rows. This
	     * allows to create table with many columns and not have vertical scrolling
	     * performance drop.
	     * Setting the property to false will keep previous behaviour and keep
	     * cell rendered if the row it belongs to is visible.
	     */
	    allowCellsRecycling?: boolean;
    }

    export interface ColumnGroupProps {
        /**
	     * The horizontal alignment of the table cell content.
         * 'left', 'center', 'right'
	     */
	    align?: string;

	    /**
	     * Controls if the column group is fixed when scrolling in the X axis.
	     */
	    fixed?: boolean;

	    /**
	     * Bucket for any data to be passed into column group renderer functions.
	     */
	    columnGroupData?: any;

	    /**
	     * The column group's header label.
	     */
	    label?: string;

	    /**
	     * The cell renderer that returns React-renderable content for a table
	     * column group header. If it's not specified, the label from props will
	     * be rendered as header content.
	     * ```
	     * function(
	     *   label: ?string,
	     *   cellDataKey: string,
	     *   columnGroupData: any,
	     *   rowData: array<?object>, // array of labels of all columnGroups
	     *   width: number
	     * ): ?$jsx
	     * ```
	     */
	    groupHeaderRenderer?: Function;
    }

    export class Table extends __React.Component<TableProps, {}> {
    }
    export class Column extends __React.Component<ColumnProps, {}> {
    }
    export class ColumnGroup extends __React.Component<ColumnGroupProps, {}> {
    }
}

declare module "fixed-data-table" {
    export = FixedDataTable;
}


text:
<?php

namespace Model\articles;

use OWeb\utils\Singleton;

/**
 * Description of Artciles
 *
 * @author De Cramer Oliver
 */
class Artciles extends Singleton
{

    private $ext_connection;
    private $categories;

    private $articles = array();

    static public function getInstance()
    {
        $class = self::getInstanceNull();
        if ($class == null) {
            $obj = new Artciles(Categories::getInstance());
            self::setInstance($obj);

            return $obj;
        }
    }

    function __construct(Categories $cat)
    {
        $this->ext_connection = \OWeb\manage\Extensions::getInstance()->getExtension('db\Connection');
        $this->categories     = $cat;
    }

    public function getArticle($id)
    {

        if (isset($this->articles[$id]))
            return $this->articles[$id];
        else {

            try {
                $connection = $this->ext_connection->get_Connection();
                $prefix     = $this->ext_connection->get_prefix();

                $sql = $connection->prepare(
                    "SELECT *
                                                                    FROM " . $prefix . "article_article aa, " . $prefix . "article_content ac
						WHERE ac.article_id = id_article
						AND id_article = :id"
                );

                if ($sql->execute(array(':id' => $id)) && $result = $sql->fetchObject()) {

                    $article             =
                        new \Model\articles\Article        (
                            $result->id_article,
                            $result->type,
                            $result->img,
                            $result->published == 1,
                            $result->pdate,
                            $this->categories->getElement($result->category_id)
                        );
                    $this->articles[$id] = $article;

                    $article->addLanguage($result->article_lang, $result->title, $result->content);
                    while ($result = $sql->fetchObject()) {
                        $article->addLanguage($result->article_lang, $result->title, $result->content);
                    }

                    $sql = "SELECT * FROM " . $prefix . "article_category_more
								WHERE article_id = $id";
                    if ($sql = $connection->query($sql)) {
                        while ($result = $sql->fetchObject()) {
                            $article->addCategorie($this->categories->getElement($result->category_id));
                        }
                    }
                    $sql = "SELECT * FROM " . $prefix . "article_attribute
								WHERE article_id = $id";
                    if ($sql = $connection->query($sql)) {
                        while ($result = $sql->fetchObject()) {
                            $article->addAttribute($result->name, $result->value);
                        }
                    }
                    $article->setisDOne(true);

                    return $article;
                } else {
                    throw new \Model\articles\exception\ArticleNotFound("Couldn't get Article with id : $id . SQL ERROR2", 0);
                }

            } catch (\Exception $ex) {
                throw new \Model\articles\exception\ArticleNotFound("Couldn't get Article with id : $id . SQL ERROR", 0, $ex);
            }
        }
    }

    public function getNbCategoryArticles(\Model\articles\CategorieElement $cat, $rec = true, $pusblished = true)
    {

        try {
            $connection = $this->ext_connection->get_Connection();
            $prefix     = $this->ext_connection->get_prefix();

            $cs = $cat->getChildrens();
            if ($rec && !empty($cs)) {
                $cat_parents = $cat->getRecuriveChildrensIds();

                $sql = "SELECT COUNT(*) as nb
						FROM " . $prefix . "article_article aa
						WHERE (id_article IN (SELECT acm.article_id
														FROM " . $prefix . "article_category_more acm
														WHERE acm.category_id = " . $cat->getId(
                ) . " )
								OR category_id = " . $cat->getId() . "
								OR id_article IN (SELECT acm.article_id
														FROM " . $prefix . "article_category_more acm
														WHERE acm.category_id IN ($cat_parents))
								OR category_id IN ($cat_parents))"
                . " AND published = " . $pusblished ? '1' : '0';
                //return;
            } else
                $sql = "SELECT COUNT(*) as nb
						FROM " . $prefix . "article_article aa
						WHERE (id_article IN (SELECT acm.article_id
													FROM " . $prefix . "article_category_more acm
													WHERE acm.category_id = " . $cat->getId(
                ) . " )
							OR category_id = " . $cat->getId() . ")"
                . " AND published = " . $pusblished ? '1' : '0';

            if ($sql = $connection->query($sql)) {

                if ($result = $sql->fetchObject()) {
                    return $result->nb;
                }
            }
        } catch (\Exception $ex) {
            throw new \Model\articles\exception\ArticleNotFound("Couldn't get Nb Articles of Category : " . $cat->getId(
            ) . " . SQL ERROR", 0, $ex);
        }
    }

    public function getCategoryArticles(
        \Model\articles\CategorieElement $cat, $start, $nbElement, $rec = true, $pusblished = true
    ) {

        try {
            $connection = $this->ext_connection->get_Connection();
            $prefix     = $this->ext_connection->get_prefix();

            $cs = $cat->getChildrens();
            if ($rec && !empty($cs)) {
                $cat_parents = $cat->getRecuriveChildrensIds();

                $sql2 = "SELECT id_article
						FROM " . $prefix . "article_article aa
						WHERE (id_article IN (SELECT acm.article_id
														FROM " . $prefix . "article_category_more acm
														WHERE acm.category_id = " . $cat->getId(
                    ) . " )
								OR category_id = " . $cat->getId() . "
								OR id_article IN (SELECT acm.article_id
														FROM " . $prefix . "article_category_more acm
														WHERE acm.category_id IN ($cat_parents))
								OR category_id IN ($cat_parents))"
                    . " AND published = " . ($pusblished ? '1' : '0') . "
						ORDER BY pdate DESC
						LIMIT $start, $nbElement";
                //return;
            } else
                $sql2 = "SELECT id_article
						FROM " . $prefix . "article_article aa
						WHERE (id_article IN (SELECT acm.article_id
													FROM " . $prefix . "article_category_more acm
													WHERE acm.category_id = " . $cat->getId(
                    ) . " )
							OR category_id = " . $cat->getId()
                    . ") AND published = " . ($pusblished ? '1' : '0') . "
						ORDER BY pdate DESC
						LIMIT $start, $nbElement";

            //$sql = $connection->prepare($sql);
            $article_ids = "";

            if ($sql = $connection->query($sql2)) {
                while ($result = $sql->fetchObject()) {
                    $article_ids .= $result->id_article . " ,";
                }

                $article_ids = substr($article_ids, 0, strlen($article_ids) - 1);
            }

            if ($article_ids == "")
                return array();

            $sql2 = "SELECT *
						FROM " . $prefix . "article_article aa, " . $prefix . "article_content ac
						WHERE ac.article_id = id_article
							AND id_article IN ($article_ids)
					ORDER BY pdate DESC";

            if ($sql = $connection->query($sql2)) {

                $articles = array();
                while ($result = $sql->fetchObject()) {
                    if (isset($this->articles[$result->id_article]) && !isset($articles[$result->id_article]))
                        $articles[$result->id_article] = $this->articles[$result->id_article];

                    else if (!isset($articles[$result->id_article])) {
                        $articles[$result->id_article] =
                            new \Model\articles\Article        (
                                $result->id_article,
                                $result->type,
                                $result->img,
                                $result->published == 1,
                                $result->pdate,
                                $this->categories->getElement($result->category_id)
                            );

                        $this->articles[$result->id_article] = $articles[$result->id_article];
                    }
                    if (!$articles[$result->id_article]->isDone()) {

                        $articles[$result->id_article]->addLanguage(
                            $result->article_lang,
                            $result->title,
                            $result->content
                        );
                    }
                }

                $sql2 = "SELECT * FROM " . $prefix . "article_category_more
								WHERE article_id IN ( $article_ids) ";
                if ($sql = $connection->query($sql2)) {
                    while ($result = $sql->fetchObject()) {
                        if (!$articles[$result->article_id]->isDone())
                            $articles[$result->article_id]->addCategorie(
                                $this->categories->getElement($result->category_id)
                            );
                    }
                }

                $sql2 = "SELECT * FROM " . $prefix . "article_attribute
								WHERE article_id IN ( $article_ids) ";
                if ($sql = $connection->query($sql2)) {
                    while ($result = $sql->fetchObject()) {
                        if (!$articles[$result->article_id]->isDone())
                            $articles[$result->article_id]->addAttribute($result->name, $result->value);
                    }
                }

                if (is_array($articles))
                    foreach ($articles as $article)
                        $article->setisDOne(true);

                return $articles;
            } else {
                throw new \Model\articles\exception\ArticleNotFound("Couldn't get Articles of Category : " . $cat->getId(
                ) . " . SQL ERROR2" . $sql2, 0);
            }

        } catch (\Exception $ex) {
            throw new \Model\articles\exception\ArticleNotFound("Couldn't get Articles of Category : " . $cat->getId(
            ) . " . SQL ERROR", 0, $ex);
        }

    }

    public function getArticleByNameCategory($name, \Model\articles\CategorieElement $cat)
    {
        $connection = $this->ext_connection->get_Connection();
        $prefix     = $this->ext_connection->get_prefix();

        $sql = "SELECT *
				FROM " . $prefix . "article_article aa, " . $prefix . "article_content ac
				WHERE ac.article_id = id_article
				AND ac.title = " . $connection->quote($name) . "
				AND (aa.category_id = " . $cat->getId() . "
					OR id_article IN (SELECT acm.article_id
													FROM " . $prefix . "article_category_more acm
													WHERE acm.category_id = " . $cat->getId(
            ) . " ))";

        if ($sql = $connection->query($sql)) {
            $result                              = $sql->fetchObject();
            $article                             =
                new \Model\articles\Article        (
                    $result->id_article,
                    $result->type,
                    $result->img,
                    $result->published == 1,
                    $result->pdate,
                    $this->categories->getElement($result->category_id)
                );
            $this->articles[$result->id_article] = $article;
            $id                                  = $result->id_article;

            $article->addLanguage($result->article_lang, $result->title, $result->content);
            while ($result = $sql->fetchObject()) {
                $article->addLanguage($result->article_lang, $result->title, $result->content);
            }

            $sql = "SELECT * FROM " . $prefix . "article_category_more
						WHERE article_id = $id";
            if ($sql = $connection->query($sql)) {
                while ($result = $sql->fetchObject()) {
                    $article->addCategorie($this->categories->getElement($result->category_id));
                }
            }
            $sql = "SELECT * FROM " . $prefix . "article_attribute
						WHERE article_id = $id";
            if ($sql = $connection->query($sql)) {
                while ($result = $sql->fetchObject()) {
                    $article->addAttribute($result->name, $result->value);
                }
            }
            $article->setisDOne(true);

            return $article;
        }

    }

}

?>


text:
package com.facebook.buck.zip;

import com.facebook.buck.timing.Clock;
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import com.google.common.hash.Hashing;

import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Map;
import java.util.zip.ZipEntry;
import java.util.zip.ZipException;

import javax.annotation.Nullable;

/**
 * An implementation of an {@link OutputStream} for zip files that allows newer entries to overwrite
 * or refresh previously written entries.
 * <p>
 * This class works by spooling the bytes of each entry to a temporary holding file named after the
 * name of the {@link ZipEntry} being stored. Once the stream is closed, these files are spooled
 * off disk and written to the OutputStream given to the constructor.
 */
public class OverwritingZipOutputStream extends CustomZipOutputStream {
  // Attempt to maintain ordering of files that are added.
  private final Map<File, EntryAccounting> entries = Maps.newLinkedHashMap();
  private final File scratchDir;
  private final Clock clock;
  @Nullable private EntryAccounting currentEntry;
  /** Place-holder for bytes. */
  @Nullable private OutputStream currentOutput;

  public OverwritingZipOutputStream(Clock clock, OutputStream out) {
    super(out);
    this.clock = clock;

    try {
      scratchDir = Files.createTempDirectory("overwritingzip").toFile();
      // Reading the source, it seems like the temp dir isn't scheduled for deletion. We will delete
      // the directory when we close the stream, but if that method is never called, we'd leave
      // cruft on the FS. It's not foolproof, but try and avoid that.
      scratchDir.deleteOnExit();
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }

  @Override
  protected void actuallyPutNextEntry(ZipEntry entry) throws IOException {
    // We calculate the actual offset when closing the stream, so 0 is fine.
    currentEntry = new EntryAccounting(clock, entry, /* currentOffset */ 0);

    long md5 = Hashing.md5().hashUnencodedChars(entry.getName()).asLong();
    String name = String.valueOf(md5);

    File file = new File(scratchDir, name);
    entries.put(file, currentEntry);
    if (file.exists() && !file.delete()) {
      throw new ZipException("Unable to delete existing file: " + entry.getName());
    }
    currentOutput = new BufferedOutputStream(new FileOutputStream(file));
  }

  @Override
  protected void actuallyCloseEntry() throws IOException {
    // We'll close the entry once we have the ultimate output stream and know the entry's location
    // within the generated zip.
    if (currentOutput != null) {
      currentOutput.close();
    }
    currentOutput = null;
    currentEntry = null;
  }

  @Override
  protected void actuallyWrite(byte[] b, int off, int len) throws IOException {
    Preconditions.checkNotNull(currentEntry);
    Preconditions.checkNotNull(currentOutput);
    currentEntry.write(currentOutput, b, off, len);
  }

  @Override
  protected void actuallyClose() throws IOException {
    long currentOffset = 0;

    for (Map.Entry<File, EntryAccounting> mapEntry : entries.entrySet()) {
      EntryAccounting entry = mapEntry.getValue();
      entry.setOffset(currentOffset);
      currentOffset += entry.writeLocalFileHeader(delegate);

      Files.copy(mapEntry.getKey().toPath(), delegate);

      // If `entry.close()` returns 0, this means that we're using the STORED method, which doesn't
      // perform compression.  In this case, we're responsible for manually updating the offset
      // accounted for by the written output.  However, if a non-0 size is returned, we're using
      // the DEFLATED method, so we don't update the offset, as entry.close will write the file
      // header, which contains the correct size of the output.
      long closeSize = entry.close(delegate);
      if (closeSize == 0) {
        currentOffset += entry.getSize();
      } else {
        currentOffset += closeSize;
      }
    }

    new CentralDirectory().writeCentralDirectory(delegate, currentOffset, entries.values());

    delegate.close();

    // Ideally we'd just do this, but that introduces some nasty circular references. *sigh* Instead
    // we'll do this the tedious way by hand.
    // MoreFiles.deleteRecursively(scratchDir.toPath());

    SimpleFileVisitor<Path> visitor = new SimpleFileVisitor<Path>() {
      @Override
      public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
        Files.delete(file);
        return FileVisitResult.CONTINUE;
      }

      @Override
      public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
        if (exc == null) {
          Files.delete(dir);
          return FileVisitResult.CONTINUE;
        }
        throw exc;
      }
    };
    Files.walkFileTree(scratchDir.toPath(), visitor);
  }
}


text:
package cdc

import (
	"context"
	"errors"
	"fmt"

	"github.com/spf13/cobra"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"knative.dev/kn-plugin-admin/pkg"
)

// NewCdcDeleteCommand to delete a cluster domain claims
func NewCdcDeleteCommand(p *pkg.AdminParams) *cobra.Command {
	cdcDeleteCommand := &cobra.Command{
		Use:   "delete",
		Short: "delete cluster domain claim",
		Long:  "Delete Knative cluster domain claim",
		Example: `
  # To delete a cluster domain claim
  kn admin cdc delete domain.name`,
		RunE: func(cmd *cobra.Command, args []string) error {
			client, err := p.NewNetworkingClient()
			if err != nil {
				return err
			}

			if len(args) != 1 {
				return errors.New("'cdc delete' requires the cdc name given as single argument")
			}
			name := args[0]
			err = client.NetworkingV1alpha1().ClusterDomainClaims().Delete(context.TODO(), name, metav1.DeleteOptions{})
			if err != nil {
				return err
			}
			fmt.Fprintf(cmd.OutOrStdout(), "Cluster Domain Claim '%s' deleted.\n", name)
			return nil
		},
	}
	return cdcDeleteCommand
}


text:
/* $Id$ */
/*
 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
 * See the copyright notice in the ACK home directory, in the file "Copyright".
 */
/* offsets of interesting fields in EM-pattern */

#define PO_HASH         0
#define PO_NEXT         1
#define PO_MATCH        3

#define ILLHASH 0177777

/* Escapes in printstrings */

#define PR_TOK          '\001'
#define PR_TOKFLD       '\002'
#define PR_EMINT        '\003'
#define PR_EMSTR        '\004'
#define PR_ALLREG       '\005'
#define PR_SUBREG       '\006'
/*
 * In case this list gets longer remember to keep out printable nonprintables
 * like \t \n \r and the like.
 */

/* Commands for codegenerator, in low order 5 bits of byte */

#define DO_NEXTEM       0
#define DO_MATCH        1
#define DO_XMATCH	2
#define DO_XXMATCH	3
#define DO_REMOVE       4
#define DO_DEALLOCATE   5
#define DO_REALLOCATE   6
#define DO_ALLOCATE     7
#define DO_LOUTPUT      8
#define DO_ROUTPUT      9
#define DO_MOVE         10
#define DO_ERASE        11
#define DO_TOKREPLACE   12
#define DO_EMREPLACE    13
#define DO_COST         14
#define DO_RETURN       15
#define DO_COERC        16
#define DO_PRETURN	17
#define DO_RREMOVE	18

typedef struct instance {
	int in_which;
#               define IN_COPY          1
#               define IN_RIDENT        2
#               define IN_ALLOC         3
#               define IN_DESCR         4
#		define IN_REGVAR	5
	int in_info[TOKENSIZE+1];
} inst_t,*inst_p;

typedef struct {
	int     c_size;                 /* index in enode-table */
	int     c_time;                 /* dito */
} cost_t,*cost_p;

typedef struct {
	int m_set1;             /* number of tokenexpr in move: from */
	int m_expr1;            /* optional expression */
	int m_set2;             /* number of tokenexpr in move: to */
	int m_expr2;            /* optional expression */
	int m_cindex;           /* code index to really do it */
	cost_t m_cost;          /* associated cost */
} move_t, *move_p;

typedef struct {
	int set_size;
	short set_val[SETSIZE];
} set_t,*set_p;

struct exprnode {
	short ex_operator;
	short ex_lnode;
	short ex_rnode;
};
typedef struct exprnode node_t;
typedef struct exprnode *node_p;

typedef struct {        /* to stack coercions */
	int c1_texpno;          /* token expression number */
	int c1_expr;		/* boolean expression */
	int c1_prop;		/* property of register needed */
	int c1_codep;           /* code index */
	cost_t c1_cost;		/* cost involved */
} c1_t,*c1_p;

#ifdef MAXSPLIT
typedef struct {        /* splitting coercions */
	int c2_texpno;          /* token expression number */
	int c2_nsplit;          /* split factor */
	int c2_repl[MAXSPLIT];  /* replacement instances */
	int c2_codep;           /* code index */
} c2_t,*c2_p;
#endif /* MAXSPLIT */

typedef struct {        /* one to one coercions */
	int c3_texpno;          /* token expression number */
	int c3_prop;            /* property of register needed */
	int c3_repl;            /* replacement instance */
	int c3_codep;           /* code index */
} c3_t,*c3_p;

/*
 * contents of .ex_operator
 */

#define EX_TOKFIELD     0
#define EX_ARG          1
#define EX_CON          2
#define EX_ALLREG       3
#define EX_SAMESIGN     4
#define EX_SFIT         5
#define EX_UFIT         6
#define EX_ROM          7
#define EX_NCPEQ        8
#define EX_SCPEQ        9
#define EX_RCPEQ        10
#define EX_NCPNE        11
#define EX_SCPNE        12
#define EX_RCPNE        13
#define EX_NCPGT        14
#define EX_NCPGE        15
#define EX_NCPLT        16
#define EX_NCPLE        17
#define EX_OR2          18
#define EX_AND2         19
#define EX_PLUS         20
#define EX_CAT          21
#define EX_MINUS        22
#define EX_TIMES        23
#define EX_DIVIDE       24
#define EX_MOD          25
#define EX_LSHIFT       26
#define EX_RSHIFT       27
#define EX_NOT          28
#define EX_COMP         29
#define EX_COST         30
#define EX_STRING       31
#define EX_DEFINED      32
#define EX_SUBREG       33
#define EX_TOSTRING     34
#define EX_UMINUS       35
#define EX_REG          36
#define EX_LOWW		37
#define EX_HIGHW	38
#define EX_INREG	39
#define EX_REGVAR	40

#define getint(a,b) \
	if ((a=((*(b)++)&BMASK)) >= 128) {\
		a = ((a-128)<<BSHIFT) | (*(b)++&BMASK); \
	}


text:
import os
import sys

import ukm_model
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'common'))
import presubmit_util

def main(argv):
  presubmit_util.DoPresubmitMain(argv, 'ukm.xml', 'ukm.old.xml',
                                 ukm_model.PrettifyXML)

if '__main__' == __name__:
  sys.exit(main(sys.argv))


text:
<?php
/**
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 * http://www.gnu.org/copyleft/gpl.html
 *
 * @file
 * @since 1.23
 */

/**
 * @ingroup API
 */
class ApiQueryPrefixSearch extends ApiQueryGeneratorBase {
	public function __construct( $query, $moduleName ) {
		parent::__construct( $query, $moduleName, 'ps' );
	}

	public function execute() {
		$this->run();
	}

	public function executeGenerator( $resultPageSet ) {
		$this->run( $resultPageSet );
	}

	/**
	 * @param ApiPageSet $resultPageSet
	 */
	private function run( $resultPageSet = null ) {
		$params = $this->extractRequestParams();
		$search = $params['search'];
		$limit = $params['limit'];
		$namespaces = $params['namespace'];
		$offset = $params['offset'];

		$searcher = new TitlePrefixSearch;
		$titles = $searcher->searchWithVariants( $search, $limit + 1, $namespaces, $offset );
		if ( $resultPageSet ) {
			if ( count( $titles ) > $limit ) {
				$this->setContinueEnumParameter( 'offset', $offset + $params['limit'] );
				array_pop( $titles );
			}
			$resultPageSet->populateFromTitles( $titles );
			foreach ( $titles as $index => $title ) {
				$resultPageSet->setGeneratorData( $title, array( 'index' => $index + $offset + 1 ) );
			}
		} else {
			$result = $this->getResult();
			$count = 0;
			foreach ( $titles as $title ) {
				if ( ++$count > $limit ) {
					$this->setContinueEnumParameter( 'offset', $offset + $params['limit'] );
					break;
				}
				$vals = array(
					'ns' => intval( $title->getNamespace() ),
					'title' => $title->getPrefixedText(),
				);
				if ( $title->isSpecialPage() ) {
					$vals['special'] = true;
				} else {
					$vals['pageid'] = intval( $title->getArticleId() );
				}
				$fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $vals );
				if ( !$fit ) {
					$this->setContinueEnumParameter( 'offset', $offset + $count - 1 );
					break;
				}
			}
			$result->addIndexedTagName(
				array( 'query', $this->getModuleName() ), $this->getModulePrefix()
			);
		}
	}

	public function getCacheMode( $params ) {
		return 'public';
	}

	public function getAllowedParams() {
			return array(
				'search' => array(
					ApiBase::PARAM_TYPE => 'string',
					ApiBase::PARAM_REQUIRED => true,
				),
				'namespace' => array(
					ApiBase::PARAM_DFLT => NS_MAIN,
					ApiBase::PARAM_TYPE => 'namespace',
					ApiBase::PARAM_ISMULTI => true,
				),
				'limit' => array(
					ApiBase::PARAM_DFLT => 10,
					ApiBase::PARAM_TYPE => 'limit',
					ApiBase::PARAM_MIN => 1,
					// Non-standard value for compatibility with action=opensearch
					ApiBase::PARAM_MAX => 100,
					ApiBase::PARAM_MAX2 => 200,
				),
				'offset' => array(
					ApiBase::PARAM_DFLT => 0,
					ApiBase::PARAM_TYPE => 'integer',
				),
			);
	}

	protected function getExamplesMessages() {
		return array(
			'action=query&list=prefixsearch&pssearch=meaning'
				=> 'apihelp-query+prefixsearch-example-simple',
		);
	}

	public function getHelpUrls() {
		return 'https://www.mediawiki.org/wiki/API:Prefixsearch';
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="a342com.linkedlist.MainActivity">

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/layout_login"
        android:layout_alignParentEnd="false"
        android:layout_alignParentStart="false"
        android:layout_alignParentBottom="true">

        <EditText
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:inputType="textEmailAddress"
            android:id="@+id/login_edt_email"
            android:text=""
            android:hint="@string/login_hint_email"
            android:layout_alignParentStart="false"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="20dp"
            />

        <EditText
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:inputType="textPassword"
            android:id="@+id/login_edt_password"
            android:text=""
            android:hint="@string/login_hint_password"
            android:layout_alignParentStart="false"
            android:layout_marginLeft="10dp"
            android:layout_below="@+id/login_edt_email"
            android:layout_marginTop="20dp"
            />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/login_btn_login"
            android:id="@+id/login_btn_login"
            android:layout_below="@+id/login_edt_password"
            android:layout_marginTop="20dp"
            android:clickable="true"
            android:enabled="true"
            android:layout_alignParentEnd="false"
            android:layout_alignParentStart="false"
            android:layout_marginLeft="60dp"
            android:onClick="login_login"
            />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/login_btn_create"
            android:id="@+id/login_btn_create"
            android:layout_toRightOf="@+id/login_btn_login"
            android:layout_alignTop="@+id/login_btn_login"
            android:layout_marginLeft="30dp"
            android:enabled="true"
            android:onClick="login_create"
            />
    </RelativeLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/layout_create"
        android:visibility="gone"
        android:layout_alignParentBottom="true">

        <EditText
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:inputType="text"
            android:id="@+id/create_edt_nickname"
            android:text=""
            android:hint="@string/create_hint_nickname"
            android:layout_alignParentStart="false"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="30dp"/>

        <EditText
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:inputType="textEmailAddress"
            android:id="@+id/create_edt_email"
            android:text=""
            android:hint="@string/login_hint_email"
            android:layout_alignParentStart="false"
            android:layout_marginLeft="10dp"
            android:layout_below="@+id/create_edt_nickname"
            android:layout_marginTop="20dp"/>

        <EditText
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:inputType="textPassword"
            android:id="@+id/create_edt_password"
            android:text=""
            android:hint="@string/login_hint_password"
            android:layout_alignParentStart="false"
            android:layout_marginLeft="10dp"
            android:layout_below="@+id/create_edt_email"
            android:layout_marginTop="20dp"/>

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/create_btn_create"
            android:id="@+id/create_btn_create"
            android:layout_below="@+id/create_edt_password"
            android:layout_marginTop="20dp"
            android:clickable="true"
            android:enabled="true"
            android:layout_alignParentEnd="false"
            android:layout_alignParentStart="false"
            android:layout_centerHorizontal="true"
            android:onClick="create_create"/>
    </RelativeLayout>

    <ImageView
        android:layout_width="fill_parent"
        android:layout_height="120dp"
        android:id="@+id/img_logo"
        android:contentDescription="@string/desc_logo"
        android:src="@drawable/linked_list"
        android:cropToPadding="false"/>

</RelativeLayout>


text:
var _ = require('lodash')
var Promise = require('bluebird')

enduro.templating_engine.registerHelper('blog_archive', function (options) {

    // will store all the blog entries
    var blog_entries

    // get_cms_list will return a structured list of all pages in a project
    return enduro.api.pagelist_generator.get_cms_list()
        .then((pagelist) => {

            // will store the promises from reading all the blog entries
            var get_content_promises = []

            blog_entries = _.chain(pagelist.structured.blog)
                .filter((o) => { return typeof o === 'object' && !o.hidden}).value() // filter pages only

            // goes through all the blog entries and loads their content
            for (page_id in blog_entries) {
                var page = blog_entries[page_id]

                function get_content (page) {
                    get_content_promises.push(enduro.api.flat.load(page.fullpath).then((content) => { page.content = content }))
                }

                get_content(page)
            }

            return Promise.all(get_content_promises)
        })
        .then(() => {
            var months = []

            // show only published entries
            blog_entries = blog_entries.filter(entry => entry.content.published)

            for (let i = 0, l = blog_entries.length; i < l; i++) {

                let date = new Date(blog_entries[i].content.$date_value),
                    month = (date.getMonth() < 9? '0' : '') + (date.getMonth() + 1) + '/' + (date.getYear() + 1900)
                blog_entries[i].date = date

                let month_ind = months.findIndex(m => m.title === month);
                if (month_ind === -1) {
                    // create a new month if it is absent, and push a page
                    months.push({
                        title: month,
                        pages: [blog_entries[i]],
                        order: 12 * date.getYear() + date.getMonth()
                    });
                } else {
                    // push a page directly
                    months[month_ind].pages.push(blog_entries[i]);
                }

            }

            // sort months by their time
            months.sort((a, b) => b.order - a.order);

            // sort blog entries within months
            months.forEach(month => {
                month.pages.sort((a, b) => b.date > a.date)
            });

            // pass blog entries as context for the template
            return options.fn(months)
        })
})


text:
There are two different kinds of numbers in Elixir - integers and floats.

Integers are whole numbers.

```elixir
integer = 3
# => 3
```

## Floating Point Numbers

Floats are numbers with one or more digits behind the decimal separator. They use the 64-bit double precision floating-point format.

```elixir
float = 3.45
# => 3.45
```

### Working with numbers

In the [`Integer`][integer-functions] and [`Float`][float-functions] modules you can find some useful functions for working with those types. Basic arithmetic operators are defined in the [`Kernel`][kernel-arithmetic-operators] module.

### Conversion

Integers and floats can be mixed together in a single arithmetic expression. Using a float in an expression ensures the result will be a float too.

```elixir
2 * 3
# => 6

2 * 3.0
# => 6.0
```

However, when doing division, the result will always be a float, even if only integers are used.

```elixir
6 / 2
# => 3.0
```

To convert a float to an integer, you can discard the decimal part with [`trunc/1`][trunc-1].

[integer-functions]: https://hexdocs.pm/elixir/Integer.html#functions
[float-functions]: https://hexdocs.pm/elixir/Float.html#functions
[kernel-arithmetic-operators]: https://hexdocs.pm/elixir/Kernel.html#*/2
[trunc-1]: https://hexdocs.pm/elixir/Kernel.html#trunc/1


text:
package tv.savageboy74.savagetech.items.lootbag;

import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import tv.savageboy74.savagetech.util.helper.NBTHelper;
import tv.savageboy74.savagetech.util.reference.ModReference;
import tv.savageboy74.savagetech.util.reference.Names;

public class GuiLootBag extends GuiContainer
{
    private final ItemStack parentItemStack;
    private final InventoryLootBag inventoryLootBag;

    public GuiLootBag(EntityPlayer entityPlayer, InventoryLootBag inventoryLootBag) {
        super(new ContainerLootBag(entityPlayer, inventoryLootBag));

        this.parentItemStack = inventoryLootBag.parentItemStack;
        this.inventoryLootBag = inventoryLootBag;

        this.xSize = 254;
        this.ySize = 256;
    }

    @Override
    protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) {
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

        this.mc.getTextureManager().bindTexture(new ResourceLocation(ModReference.MOD_DOMAIN + "textures/gui/GuiGeneric117.png"));

        int xStart = (width - xSize) / 2;
        int yStart = (height - ySize) / 2;

        this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);
    }

    @Override
    public void onGuiClosed() {
        super.onGuiClosed();

        if (mc.thePlayer != null) {
            for (ItemStack itemStack : mc.thePlayer.inventory.mainInventory) {
                if (itemStack != null) {
                    if (NBTHelper.hasTag(itemStack, Names.NBT.LOOT_BAG_GUI_OPEN)) {
                        NBTHelper.removeTag(itemStack, Names.NBT.LOOT_BAG_GUI_OPEN);
                    }
                }
            }
        }
    }
}


text:
package com.athena.attacks;

import com.athena.utils.ArrayUtils;
import com.athena.utils.FileUtils;
import com.athena.utils.HashManager;

import java.io.File;
import java.util.ArrayList;

public class Dictionary extends Attack {
    private File wordlist;

    public Dictionary(String wordlist_filename, ArrayList<byte[]> hashes, int hashType) {
        this.wordlist = new File(wordlist_filename);
        super.setHashType(hashType, hashes);
        super.setHashman(new HashManager(hashes));
        super.initDigestInstance();
    }

    @Override
    public void attack() {
        for (byte[] fileBuffer : getNextCandidates()) {
            for (byte[] candidate : ArrayUtils.formatFileBytes(fileBuffer)) {
                if (!super.isAllCracked()) {
                    checkAttempt(candidate);
                } else {
                    return;
                }
            }
        }
    }

    public ArrayList<byte[]> getNextCandidates() {
        return FileUtils.getFileChunk(wordlist);
    }
}


text:
(function(global) {
  'use strict';

  var Util = (function() {
    return {
      /**
       * Appends new link tags to head which contain locations of extension
       * stylesheets. Allows override of page styles with !important marker.
       */
      injectLinks: function(locations) {
        locations.forEach(function(location){
          var head = document.head;
          var link = document.createElement('link');
          link.type = 'text/css';
          link.rel = 'stylesheet';
          link.href = chrome.extension.getURL(
            'content_scripts/' + location + '.css');
          head.appendChild(link);
        });
      },

      // Requests view from within chrome extension.
      getView: function(location, callback) {
        var viewPathName = '/content_scripts/' + location + '.html';
        var extLocation = chrome.extension.getURL(viewPathName);
        var request = new XMLHttpRequest();
        request.open('GET', extLocation, true);
        request.onload = function() {
          if (request.status >= 200 && request.status < 400) {
            callback(request.responseText);
          } else {
            console.log('Unable to get resource from Google Music Amplify' +
              'extension');
          }
        };
        request.onerror = function() {
          console.log('Unable to contact Google Music Amplify extension');
        };
        request.send();
      }

    };
  })();

  // Expose module to the global object
  global.Util = Util;

})(this);


text:
using System.IO;

namespace Fesslersoft.Extensions
{
    public static class FileInfoExtensions
    {
        /// <summary>
        /// Changes the extension of a File.
        /// </summary>
        /// <param name="file">The FileInfo of the source file.</param>
        /// <param name="newExtension">The new File extension for the returned FileInfo.</param>
        /// <returns></returns>
        public static FileInfo ChangeExtension(FileInfo file, string newExtension)
        {
            if (!newExtension.StartsWith("."))
            {
                newExtension = "." + newExtension;
            }
            var fileName = string.Concat(Path.GetFileNameWithoutExtension(file.FullName), newExtension);
            if (File.Exists(fileName))
            {
                File.Delete(fileName);
            }
            File.Move(file.FullName,fileName);
            if (File.Exists(fileName))
            {
                File.Delete(file.FullName);
            }
            return new FileInfo(fileName);
        }
    }
}


text:
package com.khorn.terraincontrol.util;

import com.khorn.terraincontrol.util.helpers.MathHelper;

/**
 * Position of a chunk.
 *
 *
Minecraft uses two coordinate systems: chunk coords and block coords.
 * It is important that the two are kept separate. This class should be used
 * whenever a chunk coordinate is passed along, so that it is clear that chunk
 * coordinates are used, and not block coordinates.
 *
 *
This class contains some helper methods to switch from/to block
 * coordinates.
 */
public class ChunkCoordinate
{
    public static final int CHUNK_X_SIZE = 16;
    public static final int CHUNK_Y_SIZE = 256;
    public static final int CHUNK_Z_SIZE = 16;
    private static final int CHUNK_HALF_X_SIZE = CHUNK_X_SIZE / 2;
    private static final int CHUNK_HALF_Z_SIZE = CHUNK_Z_SIZE / 2;

    private final int chunkX;
    private final int chunkZ;

    protected ChunkCoordinate(int chunkX, int chunkZ)
    {
        this.chunkX = chunkX;
        this.chunkZ = chunkZ;
    }

    /**
     * Gets the x position of the chunk in the world.
     * @return The x position.
     */
    public int getChunkX()
    {
        return chunkX;
    }

    /**
     * Gets the z position of the chunk in the world.
     * @return The z position.
     */
    public int getChunkZ()
    {
        return chunkZ;
    }

    @Override
    public int hashCode()
    {
        return (chunkX >> 13) ^ chunkZ;
    }

    @Override
    public boolean equals(Object otherObject)
    {
        if (otherObject == this)
        {
            return true;
        }
        if (otherObject == null)
        {
            return false;
        }
        if (!(otherObject instanceof ChunkCoordinate))
        {
            return false;
        }
        ChunkCoordinate otherChunkCoordinate = (ChunkCoordinate) otherObject;
        if (otherChunkCoordinate.chunkX != chunkX)
        {
            return false;
        }
        if (otherChunkCoordinate.chunkZ != chunkZ)
        {
            return false;
        }
        return true;
    }

    /**
     * Gets the coordinates of the chunk that is responsible for populating
     * the given block.
     *
     *
During terrain population, these four chunks are
     * guaranteed to be loaded when the top-left chunk is being populated:
     *

     * +--------+--------+ . = no changes in blocks for now
     * |........|........| # = blocks are replaced
     * |....####|####....|
     * |....####|####....|
     * +--------+--------+
     * |....####|####....|
     * |....####|####....|
     * |........|........|
     * +--------+--------+
     *

     * This offset makes it possible for objects like trees to extend a little
     * bit outside the area marked with # without hitting
     * unloaded chunks.
     *
     *
This method essentially returns the top left chunk for the whole
     * area marked with #, even though only 1/4 of that area is
     * actually in the top left chunk.
     *
     * @param blockX X coordinate of the block.
     * @param blockZ Z coordinate of the block.
     * @return The coordinates of the chunk.
     */
    public static ChunkCoordinate getPopulatingChunk(int blockX, int blockZ)
    {
        // Because of the way Minecraft population works, objects should never
        // be placed in the bottom left corner of a chunk. That's why this
        // formula looks a bit overly complicated.
        return new ChunkCoordinate(
                MathHelper.floor((blockX - CHUNK_HALF_X_SIZE) / (double) CHUNK_X_SIZE),
                MathHelper.floor((blockZ - CHUNK_HALF_Z_SIZE) / (double) CHUNK_Z_SIZE));
    }

    /**
     * Gets the coordinates of the chunk that will contain the given block.
     * @param blockX The x position of the block.
     * @param blockZ The z position of the block.
     * @return The coordinates.
     */
    public static ChunkCoordinate fromBlockCoords(int blockX, int blockZ)
    {
        return new ChunkCoordinate(
                MathHelper.floor(blockX / (double) CHUNK_X_SIZE),
                MathHelper.floor(blockZ / (double) CHUNK_Z_SIZE));
    }

    public static ChunkCoordinate fromChunkCoords(int chunkX, int chunkZ)
    {
        return new ChunkCoordinate(chunkX, chunkZ);
    }

    @Override
    public String toString()
    {
        return chunkX + "," + chunkZ;
    }

    /**
     * Gets the x position of the block in the center of this chunk.
     * @return The x position.
     */
    public int getBlockXCenter() {
        return chunkX * CHUNK_X_SIZE + CHUNK_HALF_X_SIZE;
    }

    /**
     * Gets the z position of the block in the center of this chunk.
     * @return The z position.
     */
    public int getBlockZCenter() {
        return chunkZ * CHUNK_Z_SIZE + CHUNK_HALF_Z_SIZE;
    }

    /**
     * Gets the x position of the block with the lowest x coordinate that is
     * still in this chunk.
     * @return The x position of the block.
     */
    public int getBlockX()
    {
        return chunkX * CHUNK_X_SIZE;
    }

    /**
     * Gets the z position of the block with the lowest z coordinate that is
     * still in this chunk.
     * @return The z position of the block.
     */
    public int getBlockZ()
    {
        return chunkZ * CHUNK_Z_SIZE;
    }

    /**
     * Gets whether the given chunk coordinates match the chunk x and chunk z
     * of this chunk.
     * @param chunkX The chunk x to check.
     * @param chunkZ The chunk z to check.
     * @return True if the coordinates match, false otherwise.
     */
    public boolean coordsMatch(int chunkX, int chunkZ)
    {
        return this.chunkX == chunkX && this.chunkZ == chunkZ;
    }

    /**
     * Gets whether this chunk is responsible for populating the given block.
     * Calling this method is equivalent to calling
     * equals(ChunkCoordinate.{@link #getPopulatingChunk(int, int) getPopulatingChunk}(blockX,blockZ)), but
     * this method saves you from creating one unnecessary object.
     * @param blockX X position of the block.
     * @param blockZ Z position of the block.
     * @return True if this chunk coordinate contains that block, false
     * otherwise.
     */
    public boolean populatesForBlock(int blockX, int blockZ)
    {
        return coordsMatch(
                MathHelper.floor((blockX - CHUNK_HALF_X_SIZE) / (double) CHUNK_X_SIZE),
                MathHelper.floor((blockZ - CHUNK_HALF_Z_SIZE) / (double) CHUNK_Z_SIZE));
    }
}


text:
#include "libfswatch_exception.hpp"

#include <utility>
#include "gettext_defs.h"

using namespace std;

namespace fsw
{
  libfsw_exception::libfsw_exception(string cause, int code) :
    cause(std::move(cause)), code(code)
  {
  }

  const char *libfsw_exception::what() const noexcept
  {
    return (string(_("Error: ")) + this->cause).c_str();
  }

  int libfsw_exception::error_code() const noexcept
  {
    return code;
  }

  libfsw_exception::operator int() const noexcept
  {
    return code;
  }

  libfsw_exception::~libfsw_exception() noexcept = default;

  libfsw_exception::libfsw_exception(const libfsw_exception& other) noexcept :
    cause(other.cause), code(other.code)
  {
  }

  libfsw_exception& libfsw_exception::operator=(const libfsw_exception& that) noexcept
  {
    if(&that == this)
      return *this;

    this->cause = that.cause;
    this->code = that.code;

    return *this;
  }
}


text:
<?php

/**
 * Created by IntelliJ IDEA.
 * User: dilgerma
 * Date: 17.07.12
 * Time: 17:00
 * To change this template use File | Settings | File Templates.
 */
class MarkupConstants
{
    const MARKUP_NS = "http://www.effectivetrainings.de/picket";

    const ID_ATTR = "pid";

}


text:
package com.adobe.acs.commons.util;

import com.day.cq.jcrclustersupport.ClusterAware;

/**
 * Abstact base class for scheduled job to be run only on the cluster master.
 */
public abstract class RunnableOnMaster implements ClusterAware, Runnable {

    private boolean isMaster;

    /**
     * Run the scheduled job.
     */
    protected abstract void runOnMaster();

    /**
     * {@inheritDoc}
     */
    @Override
    public final void bindRepository(String repositoryId, String clusterId, boolean master) {
        this.isMaster = master;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public final void unbindRepository() {
        isMaster = false;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public final void run() {
        if (isMaster) {
            runOnMaster();
        }
    }

}


text:
package com.compositesw.services.system.util.common;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for messageList complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="messageList">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="message" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "messageList", propOrder = {
    "message"
})
public class MessageList {

    protected List<String> message;

    /**
     * Gets the value of the message property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the message property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getMessage().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link String }
     *
     *
     */
    public List<String> getMessage() {
        if (message == null) {
            message = new ArrayList<String>();
        }
        return this.message;
    }

}