text:
require 'spec_helper'

describe PulseMeter::Mixins::Utils do
  class Dummy
    include PulseMeter::Mixins::Utils
  end

  let(:dummy){ Dummy.new }

  describe '#constantize' do
    context "when argument is a string with a valid class name" do
      it "should return class" do
        dummy.constantize("PulseMeter::Mixins::Utils").should == PulseMeter::Mixins::Utils
      end
    end
    context "when argument is a string with invalid class name" do
      it "should return nil" do
        dummy.constantize("Pumpkin::Eater").should be_nil
      end
    end
  end

  describe "#assert_positive_integer!" do
    it "should extract integer value from hash by passed key" do
      dummy.assert_positive_integer!({:val => 4}, :val).should == 4
    end

    context "when no default value given" do
      context "when the value by the passed key is not integer" do
        it "should convert non-integers to integers" do
          dummy.assert_positive_integer!({:val => 4.4}, :val).should == 4
        end

        it "should change the original value to the obtained integer" do
          h = {:val => 4.4}
          dummy.assert_positive_integer!(h, :val).should == 4
          h[:val].should == 4
        end

      end

      it "should raise exception if the value is not positive" do
        expect{ dummy.assert_positive_integer!({:val => -1}, :val) }.to raise_exception(ArgumentError)
      end

      it "should raise exception if the value is not defined" do
        expect{ dummy.assert_positive_integer!({}, :val) }.to raise_exception(ArgumentError)
      end
    end

    context "when default value given" do
      it "should prefer value from options to default" do
        dummy.assert_positive_integer!({:val => 4}, :val, 22).should == 4
      end

      it "should use default value when there is no one in options" do
        dummy.assert_positive_integer!({}, :val, 22).should == 22
      end

      it "should check default value if it is to be used" do
        expect{dummy.assert_positive_integer!({}, :val, -1)}.to raise_exception(ArgumentError)
      end
    end
  end

  describe "#assert_ranged_float!" do

    it "should extract float value from hash by passed key" do
      dummy.assert_ranged_float!({:val => 4}, :val, 0, 100).should be_generally_equal(4)
    end

    context "when the value by the passed key is not float" do
      it "should convert non-floats to floats" do
        dummy.assert_ranged_float!({:val => "4.0000"}, :val, 0, 100).should be_generally_equal(4)
      end

      it "should change the original value to the obtained float" do
        h = {:val => "4.000"}
        dummy.assert_ranged_float!(h, :val, 0, 100).should be_generally_equal(4)
        h[:val].should be_generally_equal(4)
      end

      it "should raise exception if the original value cannot be converted to float" do
        expect{ dummy.assert_ranged_float!({:val => :bad_float}, :val, 0, 100) }.to raise_exception(ArgumentError)
      end
    end

    it "should raise exception if the value is not within range" do
      expect{ dummy.assert_ranged_float!({:val => -0.1}, :val, 0, 100) }.to raise_exception(ArgumentError)
      expect{ dummy.assert_ranged_float!({:val => 100.1}, :val, 0, 100) }.to raise_exception(ArgumentError)
    end

    it "should raise exception if the value is not defined" do
      expect{ dummy.assert_ranged_float!({}, :val) }.to raise_exception(ArgumentError)
    end
  end

  describe "#uniqid" do
    it "should return uniq strings" do
      uniq_values = (1..1000).map{|_| dummy.uniqid}
      uniq_values.uniq.count.should == uniq_values.count
    end
  end

  describe "#titleize" do
    it "should convert identificator to title" do
      dummy.titleize("aaa_bbb").should == 'Aaa Bbb'
      dummy.titleize(:aaa_bbb).should == 'Aaa Bbb'
      dummy.titleize("aaa bbb").should == 'Aaa Bbb'
    end
  end

  describe "#camelize" do
    it "should camelize string" do
      dummy.camelize("aa_bb_cc").should == "aaBbCc"
      dummy.camelize("aa_bb_cc", true).should == "AaBbCc"
    end
  end

  describe "#camelize_keys" do
    it "should deeply camelize keys in hashes" do
      dummy.camelize_keys({ :aa_bb_cc => [ { :dd_ee => 123 }, 456 ] }).should =={ 'aaBbCc' => [ { 'ddEe' => 123 }, 456 ] }
    end
  end

  describe "#symbolize_keys" do
    it "should convert symbolizable keys to symbols" do
      dummy.symbolize_keys({"a" => 5, 6 => 7}).should == {:a => 5, 6 => 7}
    end
  end
end


text:
    Columns

    Options

    Time Interval
    <select class="form-control" ng-model="visualization.options.timeInterval">
      <option value="daily">Daily</option>
      <option value="weekly">Weekly</option>
      <option value="monthly">Monthly</option>
    </select>

    Mode
    <select class="form-control" ng-model="visualization.options.mode">
      <option value="diagonal">Fill gaps with zeros</option>
      <option value="simple">Show data as is</option>
    </select>

    Date (Bucket)
    <select class="form-control" ng-model="visualization.options.dateColumn"
      ng-options="column for column in columnNames"></select>

    Stage
    <select class="form-control" ng-model="visualization.options.stageColumn"
      ng-options="column for column in columnNames"></select>

    Bucket Population Size
    <select class="form-control" ng-model="visualization.options.totalColumn"
      ng-options="column for column in columnNames"></select>

    Stage Value
    <select class="form-control" ng-model="visualization.options.valueColumn"
      ng-options="column for column in columnNames"></select>

redpajama_set_name: RedPajamaGithub


text:
#include "Complex.h"

// Transformation routines
void IFFT_T(Complex *Data, ulong Len, int Dir);
void FFT_T(Complex *Data, ulong Len, int Dir);

// Real FFT transform
void RealFFT(real *ddata, ulong Len, int Dir);

// Engine tools
void FFTReOrder(Complex *Data, ulong Len);


text:
angular.module('meanDemoApp')
.directive('questionForm', function() {
  return {
    restrict: "EA",
    scope: {},
    controller: 'QuestionformCtrl',
    templateUrl: '/views/question-form.tpl.html'
  };
});


text:
@implementation T8MenuTextFieldItem

- (id)initWithPlaceHolder:(NSString *)placeHolder
{
    return [self initWithPlaceHolder:placeHolder initialValue:nil];
}

- (id)initWithPlaceHolder:(NSString *)placeHolder initialValue:(NSString *)initialValue
{
    self = [super init];
    if (self) {
        self.cell = [[T8MenuTextFieldCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];

        ((T8MenuTextFieldCell *)self.cell).textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:placeHolder attributes:[NSDictionary dictionaryWithObject:UIColorRGB(0xa0a9ae) forKey:NSForegroundColorAttributeName]];
        ((T8MenuTextFieldCell *)self.cell).textField.text = initialValue;
    }
    return self;
}

- (CGFloat)itemHeight
{
    return 56;
}

- (NSString *)text
{
    return ((T8MenuTextFieldCell *)self.cell).textField.text;
}

- (void)setText:(NSString *)text
{
    ((T8MenuTextFieldCell *)self.cell).textField.text = text;
}

- (UITextField *)textField
{
    return ((T8MenuTextFieldCell *)self.cell).textField;
}

@end


text:
class Work < ActiveRecord::Base
    self.inheritance_column = nil
	extend FriendlyId
	friendly_id :title, use: :slugged
	scope :show_in_slider, -> { where(show_in_slider: true) }
	has_many :guest_events, foreign_key: "affected_work_id", dependent: :destroy
	has_many :shortened_urls, dependent: :destroy
	has_many :photos, dependent: :destroy
	has_many :videos, dependent: :destroy
	validates_uniqueness_of :title
	validates :type, presence: true
	mount_uploader :main_photo, PictureUploader
	mount_uploader :secondary_photo, PictureUploader
	before_save { |work| work.slug = work.slug.parameterize }

	def self.group_all_work_events_for_graph
		array_of_grouped_hashes = []
		array_of_titles = Work.all.map(&:title)
		Work.all.each do |work|
			array_of_grouped_hashes << work.guest_events.group_by{ |item| item.created_at.to_date }
		end
		array_of_arrays_of_counts = []
		array_of_grouped_hashes.each do |grouped_hash|
			start_date = GuestEvent.last.created_at.to_date
			date = Time.now.to_date
			array_of_counts = []
			while (date >= start_date)
				count = grouped_hash[date].try(:count)
				if count.present?
					array_of_counts << count
				elsif count.nil?
					array_of_counts << 0
				end
				date -= 1.day
			end
			array_of_arrays_of_counts << array_of_counts.reverse
		end
		# lmfao when you run out of names
		array_of_arrays_of_arrays = [array_of_titles, array_of_arrays_of_counts]
		return array_of_arrays_of_arrays
	end

end


text: Things i figured out or got to work. All languages. Top folders group by language/usage.


text:
namespace sharp.Serene.Common.Pages
{
    using Serenity;
    using Serenity.Services;
    using Serenity.Web;
    using System;
    using System.IO;
    using System.Web;
    using System.Web.Mvc;

    public class FileController : Controller
    {
        [Route("upload/{*pathInfo}")]
        public ActionResult Read(string pathInfo)
        {
            UploadHelper.CheckFileNameSecurity(pathInfo);

            var filePath = UploadHelper.DbFilePath(pathInfo);
            var mimeType = UploadHelper.GetMimeType(filePath);

            return new FilePathResult(filePath, mimeType);
        }

        [Route("File/TemporaryUpload")]
        [AcceptVerbs("POST")]
        public ActionResult TemporaryUpload()
        {
            var response = this.ExecuteMethod(() => HandleUploadRequest(this.HttpContext));

            if (!(Request.Headers["Accept"] ?? "").Contains("json"))
                response.ContentType = "text/plain";

            return response;
        }

        [Route("File/HandleUploadRequest")]
        private ServiceResponse HandleUploadRequest(HttpContextBase context)
        {
            if (context.Request.Files.Count != 1)
                throw new ArgumentOutOfRangeException("files");

            HttpPostedFileBase file = context.Request.Files[0];

            if (file == null)
                throw new ArgumentNullException("file");

            if (file.FileName.IsEmptyOrNull())
                throw new ArgumentNullException("filename");

            var processor = new UploadProcessor
            {
                ThumbWidth = 128,
                ThumbHeight = 96
            };

            if (processor.ProcessStream(file.InputStream, Path.GetExtension(file.FileName)))
            {
                var temporaryFile = "temporary/" + Path.GetFileName(processor.FilePath);
                using (var sw = new StreamWriter(Path.ChangeExtension(UploadHelper.DbFilePath(temporaryFile), ".orig")))
                    sw.WriteLine(file.FileName);

                return new UploadResponse()
                {
                    TemporaryFile = temporaryFile,
                    Size = processor.FileSize,
                    IsImage = processor.IsImage,
                    Width = processor.ImageWidth,
                    Height = processor.ImageHeight
                };
            }
            else
            {
                return new UploadResponse()
                {
                    Error = new ServiceError()
                    {
                        Code = "Exception",
                        Message = processor.ErrorMessage
                    }
                };
            }
        }

        private class UploadResponse : ServiceResponse
        {
            public string TemporaryFile { get; set; }
            public long Size { get; set; }
            public bool IsImage { get; set; }
            public int Width { get; set; }
            public int Height { get; set; }
        }
    }
}


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 etla.mod.sms.db;

import etla.mod.SModConsts;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
import sa.gui.util.SUtilConsts;
import sa.lib.db.SDbConsts;
import sa.lib.db.SDbRegistryUser;
import sa.lib.gui.SGuiSession;

/**
 *
 * @author Luis Alfredo Pérez
 */
public class SDbWmLinkRow extends SDbRegistryUser{

    protected int mnPkWmTicketLinkId;
    protected double mdWeightLinked;
    protected String msNotes;
    protected boolean mbApproved;
    protected boolean mbAutoApproved;
    protected boolean mbDeleted;
    protected boolean mbSystem;
    protected int mnFkWmTicketId;
    protected int mnFkErpDocId;
    protected int mnFkWmLinkStatusId;
    protected int mnFkUserLinkStatusId;
    protected int mnFkUserInsertId;
    protected int mnFkUserUpdateId;
    protected Date mtTsUserLinkStatus;
    protected Date mtTsUserInsert;
    protected Date mtTsUserUpdate;
    protected int TEMP;

    public SDbWmLinkRow () {
        super(SModConsts.S_SHIPT_ROW);
    }

    /*
     * Public methods
     */

    public void setPkWmTicketLinkId(int n) { mnPkWmTicketLinkId = n; }
    public void setWeightLinked(double d) { mdWeightLinked = d; }
    public void setNotes(String s) { msNotes = s; }
    public void setApproved(boolean b) { mbApproved = b; }
    public void setAutoApproved(boolean b) { mbAutoApproved = b; }
    @Override
    public void setDeleted(boolean b) { mbDeleted = b; }
    @Override
    public void setSystem(boolean b) { mbSystem = b; }
    public void setFkWmTicketId(int n) { mnFkWmTicketId = n; }
    public void setFkErpDocId(int n) { mnFkErpDocId = n; }
    public void setFkWmLinkStatusId(int n) { mnFkWmLinkStatusId = n; }
    public void setFkUserLinkStatusId(int n) { mnFkUserLinkStatusId = n; }
    @Override
    public void setFkUserInsertId(int n) { mnFkUserInsertId = n; }
    @Override
    public void setFkUserUpdateId(int n) { mnFkUserUpdateId = n; }
    public void setTsUserLinkStatus(Date t) { mtTsUserLinkStatus = t; }
    @Override
    public void setTsUserInsert(Date t) { mtTsUserInsert = t; }
    @Override
    public void setTsUserUpdate(Date t) { mtTsUserUpdate = t; }

    public int getPkWmTicketLinkId() { return mnPkWmTicketLinkId; }
    public double getWeightLinked() { return mdWeightLinked; }
    public String getNotes() { return msNotes; }
    public boolean isApproved() { return mbApproved; }
    public boolean isAutoApproved() { return mbAutoApproved; }
    @Override
    public boolean isDeleted() { return mbDeleted; }
    @Override
    public boolean isSystem() { return mbSystem; }
    public int getFkWmTicketId() { return mnFkWmTicketId; }
    public int getFkErpDocId() { return mnFkErpDocId; }
    public int getFkWmLinkStatusId() { return mnFkWmLinkStatusId; }
    public int getFkUserLinkStatusId() { return mnFkUserLinkStatusId; }
    @Override
    public int getFkUserInsertId() { return mnFkUserInsertId; }
    @Override
    public int getFkUserUpdateId() { return mnFkUserUpdateId; }
    public Date getTsUserLinkStatus() { return mtTsUserLinkStatus; }
    @Override
    public Date getTsUserInsert() { return mtTsUserInsert; }
    @Override
    public Date getTsUserUpdate() { return mtTsUserUpdate; }

    /*
     * Overriden methods
     */

    @Override
    public void setPrimaryKey(int[] pk) {
        mnPkWmTicketLinkId = pk[0];
    }

    @Override
    public int[] getPrimaryKey() {
        return new int[] { mnPkWmTicketLinkId};
    }

    @Override
    public void initRegistry() {
        initBaseRegistry();

        mnPkWmTicketLinkId = 0;
        mdWeightLinked = 0;
        msNotes = "";
        mbApproved = false;
        mbAutoApproved = false;
        mbDeleted = false;
        mbSystem = false;
        mnFkWmTicketId = 0;
        mnFkErpDocId = 0;
        mnFkWmLinkStatusId = 0;
        mnFkUserLinkStatusId = 0;
        mnFkUserInsertId = 0;
        mnFkUserUpdateId = 0;
        mtTsUserLinkStatus = null;
        mtTsUserInsert = null;
        mtTsUserUpdate = null;

    }

    @Override
    public String getSqlTable() {
        return SModConsts.TablesMap.get(mnRegistryType);
    }

    @Override
    public String getSqlWhere() {
        return "WHERE id_wm_ticket_link = " + mnPkWmTicketLinkId + " ";
    }

    @Override
    public String getSqlWhere(int[] pk) {
        return "WHERE id_wm_ticket_link = " + pk[0] + " ";
    }

    @Override
    public void computePrimaryKey(SGuiSession session) throws SQLException, Exception {
        ResultSet resultSet = null;

        msSql = "SELECT COALESCE(MAX(id_row), 0) + 1 FROM " + getSqlTable() + " WHERE id_wm_ticket_link = " + mnPkWmTicketLinkId + " ";
        resultSet = session.getStatement().executeQuery(msSql);
        if (resultSet.next()) {
            TEMP = resultSet.getInt(1);
        }
    }

    @Override
    public void read(SGuiSession session, int[] pk) throws SQLException, Exception {
        ResultSet resultSet = null;

        initRegistry();
        initQueryMembers();
        mnQueryResultId = SDbConsts.READ_ERROR;

        msSql = "SELECT * " + getSqlFromWhere(pk);
        resultSet = session.getStatement().executeQuery(msSql);
        if (!resultSet.next()) {
            throw new Exception(SDbConsts.ERR_MSG_REG_NOT_FOUND);
        }
        else {
            mnPkWmTicketLinkId = resultSet.getInt("id_wm_ticket_link");
            mdWeightLinked = resultSet.getDouble("weight_link");
            msNotes = resultSet.getString("notes");
            mbApproved = resultSet.getBoolean("b_appd");
            mbAutoApproved = resultSet.getBoolean("b_aut_appd");
            mbDeleted = resultSet.getBoolean("b_del");
            mbSystem = resultSet.getBoolean("b_sys");
            mnFkWmTicketId = resultSet.getInt("fk_wm_ticket");
            mnFkErpDocId = resultSet.getInt("fk_erp_doc");
            mnFkWmLinkStatusId = resultSet.getInt("fk_wm_link_st");
            mnFkUserLinkStatusId = resultSet.getInt("fk_usr_link_st");
            mnFkUserInsertId = resultSet.getInt("fk_usr_ins");
            mnFkUserUpdateId = resultSet.getInt("fk_usr_upd");
            mtTsUserLinkStatus = resultSet.getTimestamp("ts_usr_link_st");
            mtTsUserInsert = resultSet.getTimestamp("ts_usr_ins");
            mtTsUserUpdate = resultSet.getTimestamp("ts_usr_upd");

            mbRegistryNew = false;
        }

        mnQueryResultId = SDbConsts.READ_OK;
    }

    @Override
    public void save(SGuiSession session) throws SQLException, Exception {
        initQueryMembers();
        mnQueryResultId = SDbConsts.READ_ERROR;

        // save shipment row registry:

        if (mbRegistryNew) {
            computePrimaryKey(session);
            mbDeleted = false;
            mbSystem = false;
            mnFkUserInsertId = session.getUser().getPkUserId();
            mnFkUserUpdateId = SUtilConsts.USR_NA_ID;

            msSql = "INSERT INTO " + getSqlTable() + " VALUES (" +
                mnPkWmTicketLinkId + ", " +
                mdWeightLinked + ", " +
                "'" + msNotes + "', " +
                (mbApproved ? 1 : 0) + ", " +
                (mbAutoApproved ? 1 : 0) + ", " +
                (mbDeleted ? 1 : 0) + ", " +
                (mbSystem ? 1 : 0) + ", " +
                mnFkWmTicketId + ", " +
                mnFkErpDocId + ", " +
                mnFkWmLinkStatusId + ", " +
                mnFkUserLinkStatusId + ", " +
                mnFkUserInsertId + ", " +
                mnFkUserUpdateId + ", " +
                "NOW()" + ", " +
                "NOW()" + ", " +
                "NOW()" +
                ")";
        }
        else {
            mnFkUserUpdateId = session.getUser().getPkUserId();

            msSql = "UPDATE " + getSqlTable() + " SET " +
                "id_wm_ticket_link = " + mnPkWmTicketLinkId + ", " +
                "weight_link = " + mdWeightLinked + ", " +
                "notes = '" + msNotes + "', " +
                "b_appd = " + (mbApproved ? 1 : 0) + ", " +
                "b_aut_appd = " + (mbAutoApproved ? 1 : 0) + ", " +
                "b_del = " + (mbDeleted ? 1 : 0) + ", " +
                "b_sys = " + (mbSystem ? 1 : 0) + ", " +
                "fk_wm_ticket = " + mnFkWmTicketId + ", " +
                "fk_erp_doc = " + mnFkErpDocId + ", " +
                "fk_wm_link_st = " + mnFkWmLinkStatusId + ", " +
                "fk_usr_link_st = " + mnFkUserLinkStatusId + ", " +
//                "fk_usr_ins = " + mnFkUserInsertId + ", " +
                "fk_usr_upd = " + mnFkUserUpdateId + ", " +
                "ts_usr_link_st = " + "NOW()" + ", " +
//                "ts_usr_ins = " + "NOW()" + ", " +
                "ts_usr_upd = " + "NOW() " +
                getSqlWhere();
        }

        session.getStatement().execute(msSql);

        mbRegistryNew = false;
        mnQueryResultId = SDbConsts.SAVE_OK;
    }

    @Override
    public SDbWmLinkRow clone() throws CloneNotSupportedException {
        SDbWmLinkRow registry = new SDbWmLinkRow();

        registry.setPkWmTicketLinkId(this.getPkWmTicketLinkId());
        registry.setWeightLinked(this.getWeightLinked());
        registry.setNotes(this.getNotes());
        registry.setApproved(this.isApproved());
        registry.setAutoApproved(this.isAutoApproved());
        registry.setDeleted(this.isDeleted());
        registry.setSystem(this.isSystem());
        registry.setFkWmTicketId(this.getFkWmTicketId());
        registry.setFkErpDocId(this.getFkErpDocId());
        registry.setFkWmLinkStatusId(this.getFkWmLinkStatusId());
        registry.setFkUserLinkStatusId(this.getFkUserLinkStatusId());
        registry.setFkUserInsertId(this.getFkUserInsertId());
        registry.setFkUserUpdateId(this.getFkUserUpdateId());
        registry.setTsUserLinkStatus(this.getTsUserLinkStatus());
        registry.setTsUserInsert(this.getTsUserInsert());
        registry.setTsUserUpdate(this.getTsUserUpdate());

        registry.setRegistryNew(this.isRegistryNew());
        return registry;
    }
}


text:
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Reflection;
using Microsoft.Owin.Hosting;
using Microsoft.Owin.Hosting.Engine;
using Microsoft.Owin.Hosting.Services;
using Microsoft.Owin.Hosting.Starter;
using Microsoft.Owin.Hosting.Utilities;
using OwinHost.Options;

namespace OwinHost
{
    public static class Program
    {
        [LoaderOptimization(LoaderOptimization.MultiDomainHost)]
        public static int Main(string[] args)
        {
            try
            {
                return Run(args);
            }
            catch (Exception ex)
            {
                Display(ex);
                return 1;
            }
        }

        public static int Run(string[] args)
        {
            Command command;
            try
            {
                command = CreateCommandModel().Parse(args);
            }
            catch (Exception e)
            {
                if (e is CommandException || e is MissingMethodException || e is EntryPointNotFoundException)
                {
                    // these exception types are basic message errors
                    Console.WriteLine(Resources.ProgramOutput_CommandLineError, e.Message);
                    Console.WriteLine();
                    ShowHelp(new Command { Model = CreateCommandModel() });
                }
                else
                {
                    // otherwise let the exception terminate the process
                    throw;
                }
                return 1;
            }

            if (command.Run())
            {
                return 0;
            }
            return 1;
        }

        public static void RunServer(StartOptions options)
        {
            if (options == null)
            {
                return;
            }

            string boot;
            if (!options.Settings.TryGetValue("boot", out boot)
                || string.IsNullOrWhiteSpace(boot))
            {
                options.Settings["boot"] = "Domain";
            }

            ResolveAssembliesFromDirectory(
                Path.Combine(Directory.GetCurrentDirectory(), "bin"));

            WriteLine("Starting with " + GetDisplayUrl(options));

            IServiceProvider services = ServicesFactory.Create();
            var starter = services.GetService<IHostingStarter>();
            IDisposable server = starter.Start(options);

            WriteLine("Started successfully");

            WriteLine("Press Enter to exit");
            Console.ReadLine();

            WriteLine("Terminating.");

            server.Dispose();
        }

        private static string GetDisplayUrl(StartOptions options)
        {
            IList<string> urls = options.Urls;
            if (urls.Count > 0)
            {
                return "urls: " + string.Join(", ", urls);
            }

            int port;
            string message = "port: ";
            if (!HostingEngine.TryDetermineCustomPort(options, out port))
            {
                port = HostingEngine.DefaultPort;
                message = "the default " + message;
            }

            return message + port + " (http://localhost:" + port + "/)";
        }

        private static void WriteLine(string data)
        {
            Console.WriteLine(data);
        }

        private static void Display(Exception exception)
        {
            var aggregateException = exception as AggregateException;
            if (aggregateException != null)
            {
                aggregateException.Handle(ex =>
                {
                    Display(ex);
                    return true;
                });
            }
            else if (exception != null)
            {
                Console.WriteLine(Resources.ProgramOutput_SimpleErrorMessage,
                    exception.GetType().FullName,
                    Environment.NewLine,
                    exception.Message);
                Display(exception.InnerException);
            }
        }

        public static CommandModel CreateCommandModel()
        {
            var model = new CommandModel();

            // run this alternate command for any help-like parameter
            model.Command("{show help}", IsHelpOption, (m, v) => { }).Execute(ShowHelp);

            // otherwise use these switches
            model.Option<StartOptions, string>(
                "server", "s", Resources.ProgramOutput_ServerOption,
                (options, value) => options.ServerFactory = value);

            model.Option<StartOptions, string>(
                "url", "u", Resources.ProgramOutput_UriOption,
                (options, value) => options.Urls.Add(value));

            model.Option<StartOptions, int>(
                "port", "p", Resources.ProgramOutput_PortOption,
                (options, value) => options.Port = value);

            model.Option<StartOptions, string>(
                "directory", "d", Resources.ProgramOutput_DirectoryOption,
                (options, value) => options.Settings["directory"] = value);

            model.Option<StartOptions, string>(
                "traceoutput", "o", Resources.ProgramOutput_OutputOption,
                (options, value) => options.Settings["traceoutput"] = value);

            model.Option<StartOptions, string>(
                "settings", Resources.ProgramOutput_SettingsOption,
                LoadSettings);

            model.Option<StartOptions, string>(
                "boot", "b", Resources.ProgramOutput_BootOption,
                (options, value) => options.Settings["boot"] = value);
            /* Disabled until we need to consume it anywhere.
            model.Option<StartOptions, string>(
                "verbosity", "v", "Set output verbosity level.",
                (options, value) => options.Settings["traceverbosity"] = value);
            */
            // and take the name of the application startup

            model.Parameter<string>((cmd, value) =>
            {
                var options = cmd.Get<StartOptions>();
                if (options.AppStartup == null)
                {
                    options.AppStartup = value;
                }
                else
                {
                    options.AppStartup += " " + value;
                }
            });

            // to call this action

            model.Execute<StartOptions>(RunServer);

            return model;
        }

        private static bool IsHelpOption(string s)
        {
            var helpOptions = new[] { "-?", "-h", "--help" };
            return helpOptions.Contains(s, StringComparer.OrdinalIgnoreCase);
        }

        private static void LoadSettings(StartOptions options, string settingsFile)
        {
            SettingsLoader.LoadFromSettingsFile(settingsFile, options.Settings);
        }

        private static void ShowHelp(Command cmd)
        {
            CommandModel rootCommand = cmd.Model.Root;

            string usagePattern = "OwinHost";
            foreach (var option in rootCommand.Options)
            {
                if (String.IsNullOrEmpty(option.ShortName))
                {
                    usagePattern += " [--" + option.Name + " VALUE]";
                }
                else
                {
                    usagePattern += " [-" + option.ShortName + " " + option.Name + "]";
                }
            }
            usagePattern += " [AppStartup]";

            Console.WriteLine(Resources.ProgramOutput_Intro);
            Console.WriteLine();
            Console.WriteLine(FormatLines(Resources.ProgramOutput_Usage, usagePattern, 0, 15));
            Console.WriteLine();
            Console.WriteLine(Resources.ProgramOutput_Options);

            foreach (var option in rootCommand.Options)
            {
                string header;
                if (string.IsNullOrWhiteSpace(option.ShortName))
                {
                    header = "  --" + option.Name;
                }
                else
                {
                    header = "  -" + option.ShortName + ",--" + option.Name;
                }
                Console.WriteLine(FormatLines(header, option.Description, 20, 2));
            }

            Console.WriteLine();
            Console.WriteLine(Resources.ProgramOutput_ParametersHeader);
            Console.WriteLine(FormatLines("  AppStartup", Resources.ProgramOutput_AppStartupParameter, 20, 2));
            Console.WriteLine();
            Console.WriteLine(FormatLines(string.Empty, Resources.ProgramOutput_AppStartupDescription, 2, 2));

            Console.WriteLine();
            Console.WriteLine(Resources.ProgramOutput_EnvironmentVariablesHeader);
            Console.WriteLine(FormatLines("  PORT", Resources.ProgramOutput_PortEnvironmentDescription, 20, 2));
            Console.WriteLine(FormatLines("  OWIN_SERVER", Resources.ProgramOutput_ServerEnvironmentDescription, 20, 2));
            Console.WriteLine();
            Console.WriteLine(Resources.ProgramOutput_Example);
            Console.WriteLine();
        }

        public static string FormatLines(string header, string body, int bodyOffset, int hangingIndent)
        {
            if (header == null)
            {
                throw new ArgumentNullException("header");
            }

            string total = string.Empty;
            int lineLimit = Console.WindowWidth - 2;
            int offset = Math.Max(header.Length + 2, bodyOffset);

            string line = header;

            while (offset + body.Length > lineLimit)
            {
                int bodyBreak = body.LastIndexOf(' ', lineLimit - offset);
                if (bodyBreak == -1)
                {
                    break;
                }
                total += line + new string(' ', offset - line.Length) + body.Substring(0, bodyBreak) + Environment.NewLine;
                offset = bodyOffset + hangingIndent;
                line = string.Empty;
                body = body.Substring(bodyBreak + 1);
            }
            return total + line + new string(' ', offset - line.Length) + body;
        }

        [SuppressMessage("Microsoft.Reliability", "CA2001:AvoidCallingProblematicMethods", MessageId = "System.Reflection.Assembly.LoadFile", Justification = "By design")]
        public static void ResolveAssembliesFromDirectory(string directory)
        {
            var cache = new Dictionary<string, Assembly>();
            AppDomain.CurrentDomain.AssemblyResolve +=
                (a, b) =>
                {
                    Assembly assembly;
                    if (cache.TryGetValue(b.Name, out assembly))
                    {
                        return assembly;
                    }

                    string shortName = new AssemblyName(b.Name).Name;
                    string path = Path.Combine(directory, shortName + ".dll");
                    if (File.Exists(path))
                    {
                        assembly = Assembly.LoadFile(path);
                    }
                    cache[b.Name] = assembly;
                    if (assembly != null)
                    {
                        cache[assembly.FullName] = assembly;
                    }
                    return assembly;
                };
        }
    }
}


text:
package psidev.psi.mi.jami.listener;

import psidev.psi.mi.jami.model.CurationDepth;
import psidev.psi.mi.jami.model.Publication;
import psidev.psi.mi.jami.model.Source;
import psidev.psi.mi.jami.model.Xref;

import java.util.Date;

/**
 * Listener to publication changes
 *
 * @author Gabriel Aldam (galdam@ebi.ac.uk)
 * @since 01/08/13
 * @version $Id: $
 */
public interface PublicationChangeListener extends IdentifiersChangeListener<Publication>, XrefsChangeListener<Publication>, AnnotationsChangeListener<Publication> {

    /**
     *
onPubmedIdUpdate

     *
     * @param publication : updated publication
     * @param oldPubmedId : old pubmed
     */
    public void onPubmedIdUpdate(Publication publication , String oldPubmedId);

    /**
     *
onDoiUpdate

     *
     * @param publication : updated publication
     * @param oldDoi : old doi
     */
    public void onDoiUpdate(Publication publication , String oldDoi);

    /**
     *
onImexIdentifierUpdate

     *
     * @param publication : updated publication
     * @param addedXref : added xref
     */
    public void onImexIdentifierUpdate(Publication publication, Xref addedXref);

    /**
     *
onTitleUpdated

     *
     * @param publication : updated publication
     * @param oldTitle : old title
     */
    public void onTitleUpdated(Publication publication , String oldTitle);

    /**
     *
onJournalUpdated

     *
     * @param publication : updated publication
     * @param oldJournal : old journal
     */
    public void onJournalUpdated(Publication publication , String oldJournal);

    /**
     *
onCurationDepthUpdate

     *
     * @param publication : updated publication
     * @param oldDepth : old depth
     */
    public void onCurationDepthUpdate(Publication publication , CurationDepth oldDepth);

    /**
     *
onPublicationDateUpdated

     *
     * @param publication : updated publication
     * @param oldDate : old date
     */
    public void onPublicationDateUpdated(Publication publication , Date oldDate);

    /**
     *
onAuthorAdded

     *
     * @param publication : updated publication
     * @param addedAuthor  : added author
     */
    public void onAuthorAdded(Publication publication , String addedAuthor);

    /**
     *
onAuthorRemoved

     *
     * @param publication  : updated publication
     * @param removedAuthor : removed author
     */
    public void onAuthorRemoved(Publication publication , String removedAuthor);

    /**
     *
onReleaseDateUpdated

     *
     * @param publication  : updated publication
     * @param oldDate : old release date
     */
    public void onReleaseDateUpdated(Publication publication , Date oldDate);

    /**
     *
onSourceUpdated

     *
     * @param publication : updated publication
     * @param oldSource : old source
     */
    public void onSourceUpdated(Publication publication , Source oldSource);
}


text:
from __future__ import absolute_import

__all__ = ['DatadogMetricsBackend']

from datadog import initialize, ThreadStats
from datadog.util.hostname import get_hostname

from sentry.utils.cache import memoize

from .base import MetricsBackend

# XXX(dcramer): copied from sentry.utils.metrics
def _sampled_value(value, sample_rate):
    if sample_rate < 1:
        value = int(value * (1.0 / sample_rate))
    return value

class DatadogMetricsBackend(MetricsBackend):
    def __init__(self, prefix=None, **kwargs):
        # TODO(dcramer): it'd be nice if the initialize call wasn't a global
        self.tags = kwargs.pop('tags', None)
        if 'host' in kwargs:
            self.host = kwargs.pop('host')
        else:
            self.host = get_hostname()
        initialize(**kwargs)
        super(DatadogMetricsBackend, self).__init__(prefix=prefix)

    def __del__(self):
        try:
            self.stats.stop()
        except TypeError:
            # TypeError: 'NoneType' object is not callable
            pass

    @memoize
    def stats(self):
        instance = ThreadStats()
        instance.start()
        return instance

    def incr(self, key, instance=None, tags=None, amount=1, sample_rate=1):
        if tags is None:
            tags = {}
        if self.tags:
            tags.update(self.tags)
        if instance:
            tags['instance'] = instance
        if tags:
            tags = ['{}:{}'.format(*i) for i in tags.items()]
        # datadog does not implement sampling here
        amount = _sampled_value(amount, sample_rate)
        self.stats.increment(self._get_key(key), amount,
                             tags=tags,
                             host=self.host)

    def timing(self, key, value, instance=None, tags=None, sample_rate=1):
        if tags is None:
            tags = {}
        if self.tags:
            tags.update(self.tags)
        if instance:
            tags['instance'] = instance
        if tags:
            tags = ['{}:{}'.format(*i) for i in tags.items()]
        self.stats.timing(self._get_key(key), value, sample_rate=sample_rate,
                          tags=tags,
                          host=self.host)


text:
@interface SJCRootViewController : SJCMessageRecieverViewController

@end


text:
require 'link_thumbnailer'
require 'rspec'
require 'webmock/rspec'

RSpec.configure do |config|
  config.expect_with :rspec do |c|
    c.syntax = :expect
  end
end


text:
package com.ctrip.framework.cs;

import com.ctrip.framework.cs.code.debug.DebugTool;
import com.ctrip.framework.cs.enterprise.EnFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.*;
import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpServletRequest;

/**
 * Created by jiang.j on 2016/3/25.
 */

@WebListener
public class VIServletContextListener implements ServletContextListener {

    Logger logger = LoggerFactory.getLogger(this.getClass());

    @Override
    public void contextInitialized(ServletContextEvent sce) {

        logger.info("Begin Init VI");
        final ServletContext context = sce.getServletContext();
        System.setProperty(SysKeys.ServerInfo,context.getServerInfo());

        context.addListener(new ServletRequestListener() {
            @Override
            public void requestDestroyed(ServletRequestEvent sre) {

            }

            @Override
            public void requestInitialized(ServletRequestEvent sre) {
                HttpServletRequest httpServletRequest = (HttpServletRequest) sre.getServletRequest();
                EnFactory.getEnApp().trace(httpServletRequest.getHeader(DebugTool.getTraceIdKey()));
            }
        });
        System.setProperty(SysKeys.TOMCATCONTEXTPATH,context.getContextPath());

        try {
            Class.forName("javax.servlet.ServletRegistration");
            ServletRegister.regiesterVIServlet(context, logger);
        }catch (ClassNotFoundException e){
            logger.warn("servlet version below 3.0",e);
        }

        logger.info("End Init VI");

    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {

    }
}


text:
#include <stdlib.h>
#include <string.h>
#include "utilities.h"
#include "control.h"

extern fact_list initial_facts, the_goals, the_types;
extern hashtable_t *fact_table, *op_table;
extern hashtable_t goal_table;

#ifdef BBLEARN
extern wffctrl_list current_control;
extern fact_list current_precond;
extern int rule_value, rule_evaluated;
#endif

defpred_list dps = NULL;
control_list controls = NULL;
wffctrl_list wffctrls = NULL;

/* generate candidates satisfying condition for exists & forall
 * return: a token list of candidates
 * notes: the caller needs to free the memory
 */
token_list make_generator(token_list param, token_list condition,
			  instantiation_list insts, int time)
{
  int found;
  char *candidate, *str2;
  fact_list fact;
  token_list head, cur, t1, t2;

  head = cur = NULL;

  if (strcmp(condition->item, "goal") == 0) {
    condition = condition->next;
    fact = the_goals;
  }
  else
    if (strcmp(condition->item, "true") == 0) {
      for (fact = the_types; fact; fact = fact->next) {
	t1 = strdup2token(fact->item->item);
	if (head == NULL)
	  head = cur = t1;
	else
	  cur = cur->next = t1;
      }
      return head;
    }
    else {
      fact = initial_facts;
      // fact = make_list_from_htable(fact_table[time]);
    }

  for (fact; fact; fact = fact->next) {
    found = 1;
    for (t1 = fact->item, t2 = condition; t1 && t2;
	 t1 = t1->next, t2 = t2->next) {
      str2 = t2->item;
      if (is_var(str2)) {
	if (strcmp(param->item, str2) == 0) {
	  candidate = t1->item;      	/* possible candidate */
	  continue;
	}
	else { 		     		/* check instantiation */
	  str2 = lookup_instantiation(insts, str2);
	}
      }
      if (strcmp(t1->item, str2) != 0) {
	found = 0;
	break;
      }
    }
    if (found && t1 == t2) {	     	/* add candidate to list */
      t1 = strdup2token(candidate);
      if (head == NULL)
	head = cur = t1;
      else
	cur = cur->next = t1;
    }
  }

  return head;
}

defpred_list
lookup_defpred (char *str)
{
  defpred_list dp;

  for (dp = dps; dp; dp = dp->next) {
    if (strcmp(str, dp->name) == 0)
      return dp;
  }
  return NULL;
}

instantiation_list
setup_defpred_instantiation (defpred_list dp, token_list token,
			     instantiation_list insts)
{
  instantiation_list inst, inext, inew;
  fact_list param;

  inst = NULL;
  for (param = dp->params; param && token;
       param = param->next, token = token->next) {
    inew = (instantiation_list)calloc(1, sizeof(instantiation_s));
    inew->var_part = param->item->item; 	/* should be a variable */
    inew->const_part = lookup_instantiation(insts, token->item);
    if (inst == NULL)
      inst = inext = inew;
    else
      inext = inext->next = inew;
  }
  return inst;
}

int
eval_dynamic(fact_list term, instantiation_list insts, int time)
{
  int tval = 0;
  char *fname = term->item->item;
  char str[50];
  fact_list fact;
  vertex_t v;

  if (strcmp(fname, "not") == 0) {
    fact = token2fact(dup_token_list(term->item->next));
    tval = !eval_dynamic(fact, insts, time);
    completely_free_fact_list (fact);
  }
  else
  if (strcmp(fname, "next") == 0) {
    fact = token2fact(dup_token_list(term->item->next));
    tval = eval_dynamic(fact, insts, time + 1);
    completely_free_fact_list (fact);
  }
  else {
    instantiate_into_string(term->item, insts, str, 0);
    if ((v = lookup_from_table(fact_table[time], str)) && (v->is_true))
      tval = 1;
  }
  if (tval == 0)
    return 0;
  if (term->next)
    return eval_dynamic(term->next, insts, time);
  else {
    return 1;
  }
}

#ifdef BBLEARN
int
eval_rule_body (instantiation_list insts, int time)
{
  if (eval_dynamic(current_control->preconds, insts, time)) {
//    printf("time = %d\n", time);
//    print_instantiation(insts);
    if (eval_dynamic(current_control->effects, insts, time) == 0) {
//      printf("wrong rule\n");
//      printf("time = %d\n", time);
//      print_instantiation(insts);
//      print_fact_list(current_control->effects);
      rule_value = 0;
      return 0;
    }
    else {
      current_control->is_used++;
      rule_evaluated = 1;
    }
  }
  return 1;
}

#endif
/* evaulate a formula. now it only supports CNF
 * return: 1: true, 0: faluse
 * future work: and/or relation
 */
int
eval (fact_list term, instantiation_list insts, int time)
{
  int tval = 0;
  char *fname = term->item->item;
  char str[50], *str1, *str2;
  fact_list fact;
  token_list token, var;
  defpred_list dp;
  static int goal_flag;
  instantiation_list inst_var;

#ifdef BBLEARN
  if (term == current_precond) {	/* evalute dynamic rule */
    // printf("OK!\n");
    return eval_rule_body(insts, time);
  }
  else
#endif
  if (strcmp(fname, "forall") == 0) {
    fact = term->next;
    if (lookup_instantiation(insts, fact->item->item)) {
      tval = eval(term->body, insts, time);
    }
    else {
      var = make_generator(fact->item, term->item->next, insts, time);
      inst_var = (instantiation_list)malloc(sizeof(instantiation_s));
      inst_var->var_part = fact->item->item;
      inst_var->next = insts;
      for (; var; var = var->next) {
//	printf("%s\n", var->item);
	inst_var->const_part = var->item;
	tval = eval(term->body, inst_var, time);
      }
      free_token_list(var);
      inst_var->next = NULL;
      free_instantiation(inst_var);
    }
    term = term->next;
  }
  else
  if (strcmp(fname, "exists") == 0) {
    fact = term->next;
    if (lookup_instantiation(insts, fact->item->item)) {
      tval = eval(term->body, insts, time);
    }
    else {
      var = make_generator(fact->item, term->item->next, insts, time);
      inst_var = (instantiation_list)malloc(sizeof(instantiation_s));
      inst_var->var_part = fact->item->item;
      inst_var->next = insts;
      for (; var; var = var->next) {
	inst_var->const_part = var->item;
//	printf("%s\n", var->item);
	if ((tval = eval(term->body, inst_var, time)))
	  break;
      }
      free_token_list(var);
      inst_var->next = NULL;
      free_instantiation(inst_var);
    }
    term = term->next;
  }
  else
  if (strcmp(fname, "noexists") == 0) {
      fact = term->next;
      var = make_generator(fact->item, term->item->next, insts, time);
      if (var != 0) {
          free_token_list(var);
          tval = 0;
      }
      else
          tval = eval(term->body, insts, time);
      term = term->next;
  }
  else
  if (strcmp(fname, "not") == 0) {
    fact = token2fact(term->item->next);
    tval = !eval(fact, insts, time);
    fact->item = 0;
    completely_free_fact_list (fact);
  }
  else
  if (strcmp(fname, "next") == 0) {
    fact = token2fact(term->item->next);
    tval = eval(fact, insts, time + 1);
    fact->item = 0;
    completely_free_fact_list (fact);
  }
  else
  if (strcmp(fname, "goal") == 0) {
//    fact = token2fact(dup_token_list(term->item->next));
    fact = token2fact(term->item->next);
    goal_flag = 1;
    tval = eval(fact, insts, time);
    fact->item = 0;
    completely_free_fact_list (fact);
  }
  else
  if (strcmp(fname, "true") == 0) {
    tval = 1;
  }
  else
  if (strcmp(fname, "=") == 0) {
    var = term->item->next;
    str1 = lookup_instantiation(insts, var->item);
    str2 = lookup_instantiation(insts, var->next->item);
    tval = !strcmp(str1, str2);
  }
  else
  if ((dp = lookup_defpred(fname))) {
    inst_var = setup_defpred_instantiation(dp, term->item->next, insts);
    tval = eval(dp->formula, inst_var, time);
    free_instantiation(inst_var);
  }
  else {
    instantiate_into_string(term->item, insts, str, 0);
    if (goal_flag) {
      goal_flag = 0;
      if (lookup_from_table(goal_table, str)) {
	tval = 1;
      }
    }
    else {
      if (lookup_from_table(fact_table[0], str)) {
	tval = 1;
      }
    }
  }
  if (tval == 0)
    return 0;
  if (term->next) {
    return eval(term->next, insts, time);
  }
  else {
    return 1;
  }
}

/*
 * check if an instantized action is ruled out by control rules
 * return: 0: (need to be ruled out) 1: (ok)
 */
int control_check (op_list op, int time)
{
  control_list ctrl;

  for (ctrl = controls; ctrl; ctrl = ctrl->next) {
    if (strcmp(ctrl->name, op->name) == 0) {
      if (eval (ctrl->excludes, op->insts, time)) {
	return 0;

      }
    }
  }
  return 1;
}


text:
import React from 'react';
import styled from 'styled-components';
import PropTypes from 'prop-types';
import withStyle from './Base';

const StyledFixed = styled.div`
  position: fixed;
  top: ${props => (props.top ? 0 : null)};
  right: ${props => (props.right ? 0 : null)};
  left: ${props => (props.left ? 0 : null)};
  bottom: ${props => (props.bottom ? 0 : null)};
  z-index: ${props => props.z};
`;

const Fixed = props => <StyledFixed {...props} />;

Fixed.propTypes = {
  right: PropTypes.bool,
  left: PropTypes.bool,
  top: PropTypes.bool,
  bottom: PropTypes.bool,
  z: PropTypes.number
};

export default withStyle(Fixed);


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
in Potebnia, Annls mycol. 5(1): 21 (1907)

#### Original name
Stegonsporium compactum var. tiliae Sacc.

### Remarks
null


text:
require 'builder'
require 'multi_json'
# require 'rest_client'
require 'cgi'

require "bim360/client"
require "bim360/default"

module Bim360

  class << self

    include Bim360::Configurable

    # API client based on configured options {Configurable}
    #
    # @return [Bim360::Client] API wrapper
    def client
      # options
      @client = Bim360::Client.new(options) unless defined?(@client) && @client.same_options?(options)
      @client
    end

    # @private
    def respond_to_missing?(method_name, include_private=false)
      client.respond_to?(method_name, include_private)
    end

  private

    def method_missing(method_name, *args, &block)
      return super unless client.respond_to?(method_name)
      client.send(method_name, *args, &block)
    end

  end
end

Bim360.setup


text:
#ifndef HTMLTemplateElement_h
#define HTMLTemplateElement_h

#include "core/html/HTMLElement.h"

namespace blink {

class DocumentFragment;
class TemplateContentDocumentFragment;

class HTMLTemplateElement FINAL : public HTMLElement {
public:
    DECLARE_NODE_FACTORY(HTMLTemplateElement);
    virtual ~HTMLTemplateElement();
    virtual void trace(Visitor*) OVERRIDE;

    DocumentFragment* content() const;

private:
    virtual PassRefPtrWillBeRawPtr<Node> cloneNode(bool deep = true) OVERRIDE;
    virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE;

    explicit HTMLTemplateElement(Document&);

    mutable RefPtrWillBeMember<TemplateContentDocumentFragment> m_content;
};

} // namespace blink

#endif // HTMLTemplateElement_h


text:
package org.springframework.data.hadoop.store.output;

import java.io.IOException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.springframework.data.hadoop.store.DataStoreWriter;
import org.springframework.data.hadoop.store.PartitionDataStoreWriter;
import org.springframework.data.hadoop.store.codec.CodecInfo;
import org.springframework.data.hadoop.store.partition.PartitionStrategy;
import org.springframework.data.hadoop.store.strategy.naming.FileNamingStrategy;
import org.springframework.data.hadoop.store.strategy.naming.FileNamingStrategyFactory;
import org.springframework.data.hadoop.store.strategy.rollover.RolloverStrategy;
import org.springframework.data.hadoop.store.strategy.rollover.RolloverStrategyFactory;
import org.springframework.data.hadoop.store.support.LifecycleObjectSupport;
import org.springframework.util.Assert;

/**
 * Base implementation of {@link PartitionDataStoreWriter}.
 *
 * @author Janne Valkealahti
 *
 * @param <T> the type of an entity to write
 * @param <K> the type of a partition key
 */
public abstract class AbstractPartitionDataStoreWriter<T, K> extends LifecycleObjectSupport implements PartitionDataStoreWriter<T, K> {

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

	/** Hadoop configuration */
	private final Configuration configuration;

	/** Hdfs path into a store */
	private final Path basePath;

	/** Codec info for store */
	private final CodecInfo codec;

	/** Used partition strategy if any */
	private final PartitionStrategy<T, K> partitionStrategy;

	/** Current partition writers identified by a path */
	private final Map<Path, DataStoreWriter<T>> writers = new ConcurrentHashMap<Path, DataStoreWriter<T>>();

	/** Writer for unknown partitions */
	private DataStoreWriter<T> fallbackWriter;

	/** Reduced factory interface for naming strategy */
	private FileNamingStrategyFactory<FileNamingStrategy> fileNamingStrategyFactory;

	/** Reduced factory interface for rollover strategy */
	private RolloverStrategyFactory<RolloverStrategy> rolloverStrategyFactory;

	/** Idle timeout for writers */
	private long idleTimeout;

	/** Append flag for writers */
	private boolean append = false;

	/** Max number of free file path open/find attempts guard against infinite loop */
	private int maxOpenAttempts = AbstractDataStreamWriter.DEFAULT_MAX_OPEN_ATTEMPTS;

	/** Used in-writing suffix if any */
	private String suffix;

	/** Used in-writing prefix if any */
	private String prefix;

	/** Flag guarding if files can be overwritten */
	private boolean overwrite = false;

	/**
	 * Instantiates a new abstract data store partition writer.
	 *
	 * @param configuration the hadoop configuration
	 * @param basePath the hdfs path
	 * @param codec the compression codec info
	 * @param partitionStrategy the partition strategy
	 */
	public AbstractPartitionDataStoreWriter(Configuration configuration, Path basePath, CodecInfo codec,
			PartitionStrategy<T, K> partitionStrategy) {
		super();
		this.configuration = configuration;
		this.basePath = basePath;
		this.codec = codec;
		this.partitionStrategy = partitionStrategy;
		Assert.notNull(partitionStrategy, "Partition strategy must be set");
	}

	@Override
	public void write(T entity) throws IOException {
		write(entity, partitionStrategy.getPartitionKeyResolver().resolvePartitionKey(entity));
	}

	@Override
	public void flush() throws IOException {
		for (DataStoreWriter<?> writer : writers.values()) {
			try {
				writer.flush();
			} catch (Exception e) {
				log.warn("Writer caused exception in flush", e);
			}
		}
		if (fallbackWriter != null) {
			try {
				fallbackWriter.flush();
			} catch (Exception e) {
				log.warn("Writer caused exception in flush", e);
			}
		}
	}

	@Override
	public void close() throws IOException {
		for (DataStoreWriter<?> writer : writers.values()) {
			try {
				writer.close();
			} catch (Exception e) {
				log.warn("Writer caused exception in close", e);
			}
		}
		writers.clear();
		if (fallbackWriter != null) {
			try {
				fallbackWriter.close();
			} catch (Exception e) {
				log.warn("Writer caused exception in close", e);
			}
			fallbackWriter = null;
		}
	}

	@Override
	public void write(T entity, K partitionKey) throws IOException {
		DataStoreWriter<T> writer = null;
		Path path = null;
		if (partitionKey != null) {
			path = partitionStrategy.getPartitionResolver().resolvePath(partitionKey);
			writer = writers.get(path);
		} else if (fallbackWriter == null){
			fallbackWriter = writer = createWriter(getConfiguration(), null, getCodec());
		}
		if (writer == null) {
			writer = createWriter(getConfiguration(), path, getCodec());
			writers.put(path, writer);
		}
		writer.write(entity);
	}

	@Override
	protected void onInit() throws Exception {
		super.onInit();
	}

	@Override
	protected void doStart() {
		super.doStart();
	}

	@Override
	protected void doStop() {
		try {
			flush();
			close();
		} catch (IOException e) {
		}
	}

	/**
	 * Sets the file naming strategy factory.
	 *
	 * @param fileNamingStrategyFactory the new file naming strategy factory
	 */
	public void setFileNamingStrategyFactory(FileNamingStrategyFactory<FileNamingStrategy> fileNamingStrategyFactory) {
		this.fileNamingStrategyFactory = fileNamingStrategyFactory;
	}

	/**
	 * Gets the file naming strategy factory.
	 *
	 * @return the file naming strategy factory
	 */
	public FileNamingStrategyFactory<FileNamingStrategy> getFileNamingStrategyFactory() {
		return fileNamingStrategyFactory;
	}

	/**
	 * Sets the rollover strategy factory.
	 *
	 * @param rolloverStrategyFactory the new rollover strategy factory
	 */
	public void setRolloverStrategyFactory(RolloverStrategyFactory<RolloverStrategy> rolloverStrategyFactory) {
		this.rolloverStrategyFactory = rolloverStrategyFactory;
	}

	/**
	 * Gets the rollover strategy factory.
	 *
	 * @return the rollover strategy factory
	 */
	public RolloverStrategyFactory<RolloverStrategy> getRolloverStrategyFactory() {
		return rolloverStrategyFactory;
	}

	/**
	 * Sets the idle timeout.
	 *
	 * @param idleTimeout the new idle timeout
	 */
	public void setIdleTimeout(long idleTimeout) {
		this.idleTimeout = idleTimeout;
	}

    /**
     * Sets the in writing suffix.
     *
     * @param suffix the new in writing suffix
     */
    public void setInWritingSuffix(String suffix) {
		this.suffix = suffix;
	}

    /**
     * Gets the in writing suffix.
     *
     * @return the in writing suffix
     */
    public String getInWritingSuffix() {
		return suffix;
	}

    /**
     * Sets the in writing prefix.
     *
     * @param prefix the new in writing prefix
     */
    public void setInWritingPrefix(String prefix) {
		this.prefix = prefix;
	}

    /**
     * Gets the in writing prefix.
     *
     * @return the in writing prefix
     */
    public String getInWritingPrefix() {
		return prefix;
	}

    /**
     * Sets the flag indicating if written files may be overwritten.
     * Default value is FALSE meaning {@code StoreException}
     * is thrown if file is about to get overwritten.
     *
     * @param overwrite the new overwrite
     */
    public void setOverwrite(boolean overwrite) {
		this.overwrite = overwrite;
		log.info("Setting overwrite to " + overwrite);
	}

	/**
	 * Checks if overwrite is enabled.
	 *
	 * @return true, if overwrite enabled
	 * @see #setOverwrite(boolean)
	 */
    public boolean isOverwrite() {
		return overwrite;
	}

	/**
	 * Checks if append is enabled.
	 *
	 * @return true, if append enabled
	 */
	public boolean isAppendable() {
		return append;
	}

	/**
	 * Set stream as append mode.
	 *
	 * @param append the append flag
	 */
	public void setAppendable(boolean append) {
		this.append = append;
	}

	/**
	 * Gets the idle timeout.
	 *
	 * @return the idle timeout
	 */
	public long getIdleTimeout() {
		return idleTimeout;
	}

	/**
	 * Gets the hadoop configuration.
	 *
	 * @return the configuration
	 */
	public Configuration getConfiguration() {
		return configuration;
	}

	/**
	 * Gets the base path.
	 *
	 * @return the base path
	 */
	public Path getBasePath() {
		return basePath;
	}

	/**
	 * Gets the codec.
	 *
	 * @return the codec
	 */
	public CodecInfo getCodec() {
		return codec;
	}

	/**
	 * Sets the max open attempts.
	 *
	 * @param maxOpenAttempts the new max open attempts
	 */
	public void setMaxOpenAttempts(int maxOpenAttempts) {
		this.maxOpenAttempts = maxOpenAttempts;
	}

	/**
	 * Gets the max open attempts.
	 *
	 * @return the max open attempts
	 */
	public int getMaxOpenAttempts() {
		return maxOpenAttempts;
	}

	/**
	 * Need to be implemented by a subclass for an actual writer.
	 *
	 * @param configuration the configuration
	 * @param basePath the base path
	 * @param codec the codec
	 * @return the data store writer
	 */
	protected abstract DataStoreWriter<T> createWriter(Configuration configuration, Path basePath, CodecInfo codec);

}


text:
// Copyright (c) 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/chromeos/policy/android_management_client.h"

#include <utility>

#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/guid.h"
#include "base/logging.h"
#include "components/policy/core/common/cloud/device_management_service.h"
#include "components/policy/core/common/cloud/dm_auth.h"
#include "components/policy/core/common/cloud/dmserver_job_configurations.h"
#include "components/policy/proto/device_management_backend.pb.h"
#include "components/signin/public/identity_manager/access_token_fetcher.h"
#include "components/signin/public/identity_manager/access_token_info.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/signin/public/identity_manager/scope_set.h"
#include "google_apis/gaia/gaia_constants.h"
#include "google_apis/gaia/google_service_auth_error.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"

namespace em = enterprise_management;

namespace policy {

AndroidManagementClient::AndroidManagementClient(
    DeviceManagementService* device_management_service,
    scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
    const CoreAccountId& account_id,
    signin::IdentityManager* identity_manager)
    : device_management_service_(device_management_service),
      url_loader_factory_(url_loader_factory),
      account_id_(account_id),
      identity_manager_(identity_manager) {}

AndroidManagementClient::~AndroidManagementClient() {}

void AndroidManagementClient::StartCheckAndroidManagement(
    const StatusCallback& callback) {
  DCHECK(device_management_service_);
  DCHECK(callback_.is_null());

  callback_ = callback;
  RequestAccessToken();
}

void AndroidManagementClient::OnAccessTokenFetchComplete(
    GoogleServiceAuthError error,
    signin::AccessTokenInfo token_info) {
  access_token_fetcher_.reset();

  if (error.state() != GoogleServiceAuthError::NONE) {
    LOG(ERROR) << "Token request failed: " << error.ToString();
    DCHECK(!callback_.is_null());
    std::move(callback_).Run(Result::ERROR);
    return;
  }

  CheckAndroidManagement(token_info.token);
}

void AndroidManagementClient::RequestAccessToken() {
  DCHECK(!access_token_fetcher_);
  // The user must be signed in already.
  DCHECK(identity_manager_->HasAccountWithRefreshToken(account_id_));

  signin::ScopeSet scopes;
  scopes.insert(GaiaConstants::kDeviceManagementServiceOAuth);
  scopes.insert(GaiaConstants::kOAuthWrapBridgeUserInfoScope);

  access_token_fetcher_ = identity_manager_->CreateAccessTokenFetcherForAccount(
      account_id_, "android_management_client", scopes,
      base::BindOnce(&AndroidManagementClient::OnAccessTokenFetchComplete,
                     base::Unretained(this)),
      signin::AccessTokenFetcher::Mode::kImmediate);
}

void AndroidManagementClient::CheckAndroidManagement(
    const std::string& access_token) {
  std::unique_ptr<DMServerJobConfiguration> config = std::make_unique<
      DMServerJobConfiguration>(
      device_management_service_,
      DeviceManagementService::JobConfiguration::TYPE_ANDROID_MANAGEMENT_CHECK,
      /*client_id=*/base::GenerateGUID(),
      /*critical=*/false, DMAuth::NoAuth(), access_token, url_loader_factory_,
      base::BindOnce(&AndroidManagementClient::OnAndroidManagementChecked,
                     weak_ptr_factory_.GetWeakPtr()));

  config->request()->mutable_check_android_management_request();

  request_job_ = device_management_service_->CreateJob(std::move(config));
}

void AndroidManagementClient::OnAndroidManagementChecked(
    DeviceManagementService::Job* job,
    DeviceManagementStatus status,
    int net_error,
    const em::DeviceManagementResponse& response) {
  DCHECK(!callback_.is_null());
  if (status == DM_STATUS_SUCCESS &&
      !response.has_check_android_management_response()) {
    LOG(WARNING) << "Invalid check android management response.";
    status = DM_STATUS_RESPONSE_DECODING_ERROR;
  }

  Result result;
  switch (status) {
    case DM_STATUS_SUCCESS:
      result = Result::UNMANAGED;
      break;
    case DM_STATUS_SERVICE_DEVICE_ID_CONFLICT:
      result = Result::MANAGED;
      break;
    default:
      result = Result::ERROR;
  }

  request_job_.reset();
  std::move(callback_).Run(result);
}

std::ostream& operator<<(std::ostream& os,
                         AndroidManagementClient::Result result) {
  switch (result) {
    case AndroidManagementClient::Result::MANAGED:
      return os << "MANAGED";
    case AndroidManagementClient::Result::UNMANAGED:
      return os << "UNMANAGED";
    case AndroidManagementClient::Result::ERROR:
      return os << "ERROR";
  }
  NOTREACHED();
  return os;
}

}  // namespace policy


text:
package org.eclipse.rdf4j.spring.domain.model;

import org.eclipse.rdf4j.model.IRI;
import org.eclipse.rdf4j.sparqlbuilder.core.SparqlBuilder;
import org.eclipse.rdf4j.sparqlbuilder.core.Variable;

/**
 * @since 4.0.0
 * @author Florian Kleedorfer
 */
public class Painting {
	public static final Variable PAINTING_ID = SparqlBuilder.var("painting_id");
	public static final Variable PAINTING_ARTIST_ID = SparqlBuilder.var("painting_artist_id");
	public static final Variable PAINTING_TECHNIQUE = SparqlBuilder.var("painting_technique");
	public static final Variable PAINTING_LABEL = SparqlBuilder.var("painting_label");

	private IRI id;
	private String title;
	private String technique;
	private IRI artistId;

	public IRI getId() {
		return id;
	}

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

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getTechnique() {
		return technique;
	}

	public void setTechnique(String technique) {
		this.technique = technique;
	}

	public IRI getArtistId() {
		return artistId;
	}

	public void setArtistId(IRI artistId) {
		this.artistId = artistId;
	}
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<META name="GENERATOR" content="IBM WebSphere Homepage Builder V5.0.1 for Windows">
<title>Toronto Meeting Information</title>

    PWG
San Antonio, TX

Meeting Details

UPDF: October 22

uPnP Printing & Scanning: October 23
(uPnP members only)

PWG - Planning Future Projects: October 23
EVENING

PWG Plenary: October 24 (8:30AM - 9:30AM)

IPP Fax: October 24 (9:30AM - 6:00PM)

    Meeting
    Location:

    <A href="http://www.starwood.com/fourpoints/search/hotel_detail.html?city=San+Antonio&stateProvince=TX&country=US&postalCode=&streetAddress1=&hotelLocationType=&pOI=&arrivalDate=2001-10-01&departureDate=2001-10-02&lengthOfStay=01&numberOfRooms=&numberOfAdults=&amenityType1=&amenityType2=&amenityType3=&nState1=&nState2=&nCity1=&nCity2=&requestedChainCode=SI&requestedAffiliationCode=4P&bn=fourpoints&rcc=SI&rac=4P&rpoi=&propertyID=731&rcdi=&hcount=0&fromSearch=22XX&availURL=%2Ffourpoints%2Fsearch%2Fpre_decider_prefs.html">Four Points by Sheraton San Antonio

      Riverwalk North

    110 Lexington Ave

      San Antonio, Texas 78205
Phone: (210) 223-9461 or 1-888-625-5144

The hotel rate is US $85.00/night, single
or double occupancy.

Ask for the Printer Working Group/PWG or
IEEE-ISTO rate at this hotel.

Deadline for reservations is Friday, October
12, 2001.  All attendees are responsible for making their own
hotel reservations.

***Please contact Cindy Tiritilli at
cindy@ieee-isto.org if for any reason you are unable to obtain the negotiated room
rate.****

There will be a meeting charge of $35 US;
participants are responsible for their own
lunch.

YOU MUST REGISTER AT: https://www.ieee-isto.org/pwg/registration.html

Please contact Cindy Tiritilli, IEEE-ISTO PWG Program Administrator at

+1-732-981-3434 or c.tiritilli@ieee.org if you have any questions.


text:
<elevate>
</elevate>


text:
'''OpenGL extension VERSION.GL_1_4

Automatically generated by the get_gl_extensions script, do not edit!
'''
from OpenGL import platform, constants, constant, arrays
from OpenGL import extensions
from OpenGL.GL import glget
import ctypes
EXTENSION_NAME = 'GL_VERSION_GL_1_4'
_DEPRECATED = False
GL_BLEND_DST_RGB = constant.Constant( 'GL_BLEND_DST_RGB', 0x80C8 )
GL_BLEND_SRC_RGB = constant.Constant( 'GL_BLEND_SRC_RGB', 0x80C9 )
GL_BLEND_DST_ALPHA = constant.Constant( 'GL_BLEND_DST_ALPHA', 0x80CA )
GL_BLEND_SRC_ALPHA = constant.Constant( 'GL_BLEND_SRC_ALPHA', 0x80CB )
GL_POINT_FADE_THRESHOLD_SIZE = constant.Constant( 'GL_POINT_FADE_THRESHOLD_SIZE', 0x8128 )
GL_DEPTH_COMPONENT16 = constant.Constant( 'GL_DEPTH_COMPONENT16', 0x81A5 )
GL_DEPTH_COMPONENT24 = constant.Constant( 'GL_DEPTH_COMPONENT24', 0x81A6 )
GL_DEPTH_COMPONENT32 = constant.Constant( 'GL_DEPTH_COMPONENT32', 0x81A7 )
GL_MIRRORED_REPEAT = constant.Constant( 'GL_MIRRORED_REPEAT', 0x8370 )
GL_MAX_TEXTURE_LOD_BIAS = constant.Constant( 'GL_MAX_TEXTURE_LOD_BIAS', 0x84FD )
GL_TEXTURE_LOD_BIAS = constant.Constant( 'GL_TEXTURE_LOD_BIAS', 0x8501 )
GL_INCR_WRAP = constant.Constant( 'GL_INCR_WRAP', 0x8507 )
GL_DECR_WRAP = constant.Constant( 'GL_DECR_WRAP', 0x8508 )
GL_TEXTURE_DEPTH_SIZE = constant.Constant( 'GL_TEXTURE_DEPTH_SIZE', 0x884A )
GL_TEXTURE_COMPARE_MODE = constant.Constant( 'GL_TEXTURE_COMPARE_MODE', 0x884C )
GL_TEXTURE_COMPARE_FUNC = constant.Constant( 'GL_TEXTURE_COMPARE_FUNC', 0x884D )
glBlendFuncSeparate = platform.createExtensionFunction(
'glBlendFuncSeparate',dll=platform.GL,
extension=EXTENSION_NAME,
resultType=None,
argTypes=(constants.GLenum,constants.GLenum,constants.GLenum,constants.GLenum,),
doc='glBlendFuncSeparate(GLenum(sfactorRGB), GLenum(dfactorRGB), GLenum(sfactorAlpha), GLenum(dfactorAlpha)) -> None',
argNames=('sfactorRGB','dfactorRGB','sfactorAlpha','dfactorAlpha',),
deprecated=_DEPRECATED,
)

glMultiDrawArrays = platform.createExtensionFunction(
'glMultiDrawArrays',dll=platform.GL,
extension=EXTENSION_NAME,
resultType=None,
argTypes=(constants.GLenum,arrays.GLintArray,arrays.GLsizeiArray,constants.GLsizei,),
doc='glMultiDrawArrays(GLenum(mode), GLintArray(first), GLsizeiArray(count), GLsizei(primcount)) -> None',
argNames=('mode','first','count','primcount',),
deprecated=_DEPRECATED,
)

glMultiDrawElements = platform.createExtensionFunction(
'glMultiDrawElements',dll=platform.GL,
extension=EXTENSION_NAME,
resultType=None,
argTypes=(constants.GLenum,arrays.GLsizeiArray,constants.GLenum,arrays.GLvoidpArray,constants.GLsizei,),
doc='glMultiDrawElements(GLenum(mode), GLsizeiArray(count), GLenum(type), GLvoidpArray(indices), GLsizei(primcount)) -> None',
argNames=('mode','count','type','indices','primcount',),
deprecated=_DEPRECATED,
)

glPointParameterf = platform.createExtensionFunction(
'glPointParameterf',dll=platform.GL,
extension=EXTENSION_NAME,
resultType=None,
argTypes=(constants.GLenum,constants.GLfloat,),
doc='glPointParameterf(GLenum(pname), GLfloat(param)) -> None',
argNames=('pname','param',),
deprecated=_DEPRECATED,
)

glPointParameterfv = platform.createExtensionFunction(
'glPointParameterfv',dll=platform.GL,
extension=EXTENSION_NAME,
resultType=None,
argTypes=(constants.GLenum,arrays.GLfloatArray,),
doc='glPointParameterfv(GLenum(pname), GLfloatArray(params)) -> None',
argNames=('pname','params',),
deprecated=_DEPRECATED,
)

glPointParameteri = platform.createExtensionFunction(
'glPointParameteri',dll=platform.GL,
extension=EXTENSION_NAME,
resultType=None,
argTypes=(constants.GLenum,constants.GLint,),
doc='glPointParameteri(GLenum(pname), GLint(param)) -> None',
argNames=('pname','param',),
deprecated=_DEPRECATED,
)

glPointParameteriv = platform.createExtensionFunction(
'glPointParameteriv',dll=platform.GL,
extension=EXTENSION_NAME,
resultType=None,
argTypes=(constants.GLenum,arrays.GLintArray,),
doc='glPointParameteriv(GLenum(pname), GLintArray(params)) -> None',
argNames=('pname','params',),
deprecated=_DEPRECATED,
)
# import legacy entry points to allow checking for bool(entryPoint)
from OpenGL.raw.GL.VERSION.GL_1_4_DEPRECATED import *


text:
package org.assertj.vavr.api;

import io.vavr.Lazy;

import static org.assertj.vavr.api.LazyShouldBeEvaluated.shouldBeEvaluated;
import static org.assertj.vavr.api.LazyShouldBeNotEvaluated.shouldBeNotEvaluated;

/**
 * Assertions for {@link Lazy}.
 *
 * @param <SELF>  the "self" type of this assertion class.
 * @param <VALUE> type of the value contained in the {@link Lazy}.
 */
abstract class AbstractLazyAssert<SELF extends AbstractLazyAssert<SELF, VALUE>, VALUE> extends
        AbstractValueAssert<SELF, Lazy<VALUE>> {

    AbstractLazyAssert(Lazy<VALUE> actual, Class<?> selfType) {
        super(actual, selfType);
    }

    /**
     * Verifies that the actual {@link Lazy} is evaluated.
     *
     * @return this assertion object.
     */
    public SELF isEvaluated() {
        isNotNull();
        if (!actual.isEvaluated()) throwAssertionError(shouldBeEvaluated());
        return myself;
    }

    /**
     * Verifies that the actual {@link Lazy} is not evaluated.
     *
     * @return this assertion object.
     */
    public SELF isNotEvaluated() {
        isNotNull();
        if (actual.isEvaluated()) throwAssertionError(shouldBeNotEvaluated(actual));
        return myself;
    }
}


text:
@implementation UIImage (Common)
+ (NSString *)imageBase64WithDataURL:(UIImage *)image
{
    NSData *imageData =nil;
    NSString *mimeType =nil;

    //图片要压缩的比例,此处100根据需求,自行设置
    CGFloat x =50 / image.size.height;
    if (x >1)
    {
        x = 1.0;
    }
    imageData = UIImageJPEGRepresentation(image, x);
    mimeType = @"image/jpeg";
    return [NSString stringWithFormat:@"data:%@;base64,%@", mimeType,
            [imageData base64EncodedStringWithOptions:0]];
}
@end


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:background="@color/ghostwhite">

    <RelativeLayout
        android:id="@+id/headview"
        android:layout_width="match_parent"
        android:layout_height="48dp"
        android:background="@color/teal"
        android:gravity="center_vertical">

        <TextView
            android:id="@+id/headerTitle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:text="@string/photo"
            android:textColor="#ffffff"
            android:textSize="18sp"/>

        <TextView
            android:id="@+id/cancel"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_marginRight="16dp"
            android:text="@string/camera_cancel"
            android:textColor="#fff"
            android:textSize="16sp"/>
    </RelativeLayout>

    <GridView
        android:id="@+id/fileGridView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_below="@id/headview"
        android:layout_centerInParent="true"
        android:background="@color/albumback"
        android:horizontalSpacing="2dp"
        android:numColumns="3"
        android:verticalSpacing="2dp"/>

</RelativeLayout>


text:
GLAViewController
=================

NSViewController subclass for 10.9+ for making set up and working with constraints easier.


text:
package net.peterfolta.shapify.view;

public enum DrawTools {
    SELECT_TOOL,
    RECTANGLE_TOOL,
    ELLIPSE_TOOL,
    LINE_TOOL
}


text:
package config

import (
	"context"
	"encoding/csv"
	"errors"
	"fmt"
	"io"
	"strconv"
	"strings"

	"github.com/OWASP/Amass/v3/net/http"
	"github.com/caffix/stringset"
	"github.com/go-ini/ini"
)

// DefaultQueriesPerPublicResolver is the number of queries sent to each public DNS resolver per second.
const DefaultQueriesPerPublicResolver = 5

// DefaultQueriesPerBaselineResolver is the number of queries sent to each trusted DNS resolver per second.
const DefaultQueriesPerBaselineResolver = 10

const minResolverReliability = 0.85

// DefaultBaselineResolvers is a list of trusted public DNS resolvers.
var DefaultBaselineResolvers = []string{
	"8.8.8.8",        // Google
	"1.1.1.1",        // Cloudflare
	"9.9.9.9",        // Quad9
	"208.67.222.222", // Cisco OpenDNS
	"84.200.69.80",   // DNS.WATCH
	"64.6.64.6",      // Neustar DNS
	"8.26.56.26",     // Comodo Secure DNS
	"205.171.3.65",   // Level3
	"134.195.4.2",    // OpenNIC
	"185.228.168.9",  // CleanBrowsing
	"76.76.19.19",    // Alternate DNS
	"37.235.1.177",   // FreeDNS
	"77.88.8.1",      // Yandex.DNS
	"94.140.14.140",  // AdGuard
	"38.132.106.139", // CyberGhost
	"74.82.42.42",    // Hurricane Electric
	"76.76.2.0",      // ControlD
}

// PublicResolvers includes the addresses of public resolvers obtained dynamically.
var PublicResolvers []string

// GetPublicDNSResolvers obtains the public DNS server addresses from public-dns.info and assigns them to PublicResolvers.
func GetPublicDNSResolvers() error {
	url := "https://public-dns.info/nameservers-all.csv"
	page, err := http.RequestWebPage(context.Background(), url, nil, nil, nil)
	if err != nil {
		return fmt.Errorf("failed to obtain the Public DNS csv file at %s: %v", url, err)
	}

	var resolvers []string
	var ipIdx, reliabilityIdx int
	r := csv.NewReader(strings.NewReader(page))
	for i := 0; ; i++ {
		record, err := r.Read()
		if err == io.EOF {
			break
		}
		if err != nil {
			continue
		}
		if i == 0 {
			for idx, val := range record {
				if val == "ip_address" {
					ipIdx = idx
				} else if val == "reliability" {
					reliabilityIdx = idx
				}
			}
			continue
		}
		if rel, err := strconv.ParseFloat(record[reliabilityIdx], 64); err == nil && rel >= minResolverReliability {
			resolvers = append(resolvers, record[ipIdx])
		}
	}
loop:
	for _, addr := range resolvers {
		for _, br := range DefaultBaselineResolvers {
			if addr == br {
				continue loop
			}
		}
		PublicResolvers = append(PublicResolvers, addr)
	}
	return nil
}

// SetResolvers assigns the untrusted resolver names provided in the parameter to the list in the configuration.
func (c *Config) SetResolvers(resolvers ...string) {
	c.Resolvers = []string{}
	c.AddResolvers(resolvers...)
}

// AddResolvers appends the untrusted resolver names provided in the parameter to the list in the configuration.
func (c *Config) AddResolvers(resolvers ...string) {
	for _, r := range resolvers {
		c.AddResolver(r)
	}
	c.CalcMaxQPS()
}

// AddResolver appends the untrusted resolver name provided in the parameter to the list in the configuration.
func (c *Config) AddResolver(resolver string) {
	c.Lock()
	defer c.Unlock()

	// Check that the domain string is not empty
	r := strings.TrimSpace(resolver)
	if r == "" {
		return
	}

	c.Resolvers = stringset.Deduplicate(append(c.Resolvers, resolver))
}

// SetTrustedResolvers assigns the trusted resolver names provided in the parameter to the list in the configuration.
func (c *Config) SetTrustedResolvers(resolvers ...string) {
	c.Resolvers = []string{}
	c.AddResolvers(resolvers...)
}

// AddTrustedResolvers appends the trusted resolver names provided in the parameter to the list in the configuration.
func (c *Config) AddTrustedResolvers(resolvers ...string) {
	for _, r := range resolvers {
		c.AddTrustedResolver(r)
	}
	c.CalcMaxQPS()
}

// AddTrustedResolver appends the trusted resolver name provided in the parameter to the list in the configuration.
func (c *Config) AddTrustedResolver(resolver string) {
	c.Lock()
	defer c.Unlock()

	// Check that the domain string is not empty
	r := strings.TrimSpace(resolver)
	if r == "" {
		return
	}

	c.TrustedResolvers = stringset.Deduplicate(append(c.TrustedResolvers, resolver))
}

// CalcMaxQPS updates the MaxDNSQueries field of the configuration based on current settings.
func (c *Config) CalcMaxQPS() {
	c.MaxDNSQueries = (len(c.Resolvers) * c.ResolversQPS) + (len(c.TrustedResolvers) * c.TrustedQPS)
}

func (c *Config) loadResolverSettings(cfg *ini.File) error {
	sec, err := cfg.GetSection("resolvers")
	if err != nil {
		return nil
	}

	c.Resolvers = stringset.Deduplicate(sec.Key("resolver").ValueWithShadows())
	if len(c.Resolvers) == 0 {
		return errors.New("no resolver keys were found in the resolvers section")
	}

	return nil
}


text:
The files in this folder have the following dependencies.
Arrow means depends on, invert arrows for includes.

```
                           Call & CallbackMarshaller
                                       ↓
                           NativeCallingConvention
                             ↓         ↓                (Interop with backend)
                             ↓    NativeLocation     →  Location
(Interop with frontend)      ↓         ↓
AbstractType             ←  NativeType     →  Representation
ClassId                  ←
```

The other files stand on themselves.


text:
Medicamentos

Tomados regularmente

                      Tipo
                      Medicação
                      Frequencia
                      Dosagem
                      Duração

                        {{medicationString(p.medication.type)}}
                        {{p.medication.name}}
                        {{xEnumToString(p.frequency)}}
                        {{p.medication.dosage}}
                        De {{p.starting_at * 1000 | date:'dd/MM/yyyy'}} até {{p.finishing_at * 1000 | date:'dd/MM/yyyy'}}

Detalhes

nome: {{selected_pre.medication.name}}

principio atívo: {{selected_pre.medication.active_agent}}

dosagem: {{selected_pre.medication.dosage}}

tipo: {{medicationString(selected_pre.medication.type)}}

registro: {{selected_pre.medication.br_register}}

Baixar bula

        Este medicamento exige receita médica!

Selecionar Imagem

Fazer Upload

        Sua receita para este medicamento já foi enviada com sucesso! Ver receita


text:
<!DOCTYPE html>

	<meta charset="utf-8" />
	<title>Ticloud DS</title>
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta content="width=device-width, initial-scale=1.0" name="viewport" />
	<meta content="" name="description" />
	<meta content="" name="author" />
	<meta name="MobileOptimized" content="320">
	<link href="{{static_url("assets/plugins/font-awesome/css/font-awesome.min.css")}}" rel="stylesheet" type="text/css"/>
	<link href="{{static_url("assets/plugins/bootstrap/css/bootstrap.min.css")}}" rel="stylesheet" type="text/css"/>
	<link href="{{static_url("assets/plugins/uniform/css/uniform.default.css")}}" rel="stylesheet" type="text/css"/>

    <link rel="stylesheet" type="text/css" href="{{static_url("assets/plugins/bootstrap-switch/static/stylesheets/bootstrap-switch-metro.css")}}"/>
	<link rel="stylesheet" type="text/css" href="{{static_url("assets/plugins/select2/select2_metro.css")}}" />
	<link rel="stylesheet" type="text/css" href="{{static_url("assets/plugins/bootstrap-markdown/css/bootstrap-markdown.min.css")}}">

	<link href="{{static_url("assets/css/style-metronic.css")}}" rel="stylesheet" type="text/css"/>
	<link href="{{static_url("assets/css/style.css")}}" rel="stylesheet")}}" type="text/css"/>
	<link href="{{static_url("assets/css/style-responsive.css")}}" rel="stylesheet" type="text/css"/>
	<link href="{{static_url("assets/css/plugins.css")}}" rel="stylesheet" type="text/css"/>
	<link href="{{static_url("assets/css/themes/light.css")}}" rel="stylesheet" type="text/css" id="style_color"/>
	<link href="{{static_url("assets/css/custom.css")}}" rel="stylesheet" type="text/css"/>
	<link rel="shortcut icon" href="{{static_url("assets/img/favicon.ico")}}" />

	{% module Template("head.html") %}

		{% module Template("left.html") %}

							集群管理

                            网络设置

                                    <button type="button" class="close" data-dismiss="modal"
                                            aria-hidden="true"></button>

警告信息

添加或修改bond或infiniBand信息会重新启动网卡信息,请谨慎操作.

                                    <button class="btn red" data-dismiss="modal">关闭
                                    </button>

网卡绑定

InfiniBand

{{host_ip}}

                                                添加

                                            bond网卡
                                            IP
                                            子网掩码
                                            网关
                                            广播
                                            启动
                                            绑定网口
                                            操作

                                        <form id="bond_form" action="#" class="form-horizontal">

                                                    <button type="button" class="close" data-dismiss="modal"></button>

网卡绑定

                                                            <button class="close" data-close="alert"></button>
                                                            请输入网卡信息

                                                            类型*

                                                                    <select id="bond_select"
                                                                            class="form-control input-group-lg {required:true}">
                                                                    </select>

                                                            IP*

                                                                <input class="form-control" name="input_ip"
                                                                       type="text"/>

                                                            子网掩码*

                                                                <input type="text" name="netmask" class="form-control"/>

                                                            网关

                                                                <input class="form-control" name="gateway" type="text"/>

                                                            广播

                                                                <input type="text" name="broadcast"
                                                                       class="form-control"/>

                                                            启动

                                                                    <input type="checkbox" name="boot" class="toggle"/>

                                                            选择绑定网口*

                                                    <button type="button" class="btn" data-dismiss="modal">取消</button>
                                                    <button type="submit" class="btn green">确定
                                                    </button>

                                        </form>

{{host_ip}}

                                                添加

                                            InfiniBand
                                            IP
                                            子网掩码
                                            网关
                                            广播
                                            启动
                                            操作

                                        <form id="ib_form" class="form-horizontal form-bordered">

                                                    <button type="button" class="close" data-dismiss="modal"></button>

InfiniBand

                                                            InfiniBand 类型*

                                                                <select id="ib_select"
                                                                        class="form-control input-group-lg">
                                                                </select>

                                                            IP*

                                                                <input type="text" name="ib_ip" class="form-control"/>

                                                            子网掩码*

                                                                    <input type="text" name="ib_netmask"
                                                                           class="form-control">

                                                            网关

                                                                <input type="text" name="ib_gateway" class="form-control"/>

                                                            广播

                                                                <input type="text" name="ib_broadcast"
                                                                       class="form-control"/>

                                                            启动*

                                                                    <input name="ib_boot" type="checkbox" class="toggle"/>

                                                    <button type="button" class="btn" data-dismiss="modal">取消</button>
                                                    <button type="submit" class="btn green">确定
                                                    </button>

                                        </form>

	{% module Template("bottom.html") %}


text:
Mud engine written in Go.

# License #
BSD 2-clause

# Notes #
Portions of structure and logic inspired by, and in some cases copied from, Andrew 'Diddymus' Rolfe's WoldMUD


text:
/*
 * @test
 * @bug 8028198
 * @summary Verify that split through phi does the right thing
 * @compile SplitThruPhiTest.java
 * @run main SplitThruPhiTest -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseMathExactIntrinsics
 *
 */

public class SplitThruPhiTest {
  public static volatile int value = 19;
  public static int store = 0;
  public static void main(String[] args) {
    for (int i = 0; i < 150000; ++i) {
      store = runTest(value);
    }
  }

  public static int runTest(int val) {
    int result = Math.addExact(val, 1);
    int total = 0;
    for (int i = val; i < 200; i = Math.addExact(i, 1)) {
      total += i;
    }
    return total;
  }
}


text:
@class TuyaSmartSceneConditionModel;

@interface TYSelectConditionViewController : TPBaseTableViewController

@property (nonatomic, strong) NSArray *selectDevList;
@property (nonatomic, strong) TuyaSmartSceneConditionModel *model;

@end