text:
package org.ansj.lucene5;

import java.io.BufferedReader;
import java.io.File;
import java.io.StringReader;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.ansj.lucene.util.AnsjTokenizer;
import org.ansj.splitWord.analysis.IndexAnalysis;
import org.ansj.splitWord.analysis.ToAnalysis;
import org.ansj.splitWord.analysis.UserDefineAnalysis;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.Tokenizer;
import org.nlpcn.commons.lang.util.IOUtil;
import org.nlpcn.commons.lang.util.StringUtil;

public class AnsjAnalyzer extends Analyzer {
	/** 自定义停用词 */
	private Set<String> filter;
	/** 是否查询分词 */
	private String type;

	/**
	 * @param filter
	 *            停用词
	 * @param pstemming
	 *            是否分析词干
	 */
	public AnsjAnalyzer(String type, Set<String> filter) {
		this.type = type;
		this.filter = filter;
	}

	public AnsjAnalyzer(String type, String stopwordsDir) {
		this.type = type;
		this.filter = filter(stopwordsDir);
	}

	public AnsjAnalyzer(String type) {
		this.type = type;
	}

	public AnsjAnalyzer() {
	}

	private Set<String> filter(String stopwordsDir) {
		if (StringUtil.isBlank(stopwordsDir)) {
			return null;
		}
		try {
			List<String> readFile2List = IOUtil.readFile2List(stopwordsDir, IOUtil.UTF8);
			return new HashSet<String>(readFile2List);
		} catch (Exception e) {
			System.err.println("not foun stop word path by " + new File(stopwordsDir).getAbsolutePath());
			e.printStackTrace();
		}
		return null;
	}

	@Override
	protected TokenStreamComponents createComponents(String text) {
		BufferedReader reader = new BufferedReader(new StringReader(text));
		Tokenizer tokenizer = null;

		if ("user".equalsIgnoreCase(type)) {
			tokenizer = new AnsjTokenizer(new UserDefineAnalysis(reader), filter);
		} else if ("index".equalsIgnoreCase(type)) {
			tokenizer = new AnsjTokenizer(new IndexAnalysis(reader), filter);
		} else {
			tokenizer = new AnsjTokenizer(new ToAnalysis(reader), filter);
		}
		return new TokenStreamComponents(tokenizer);
	}
}


text:
#ifndef _SCHEDD_PLUGIN_H
#define _SCHEDD_PLUGIN_H

#include "condor_common.h"

#include "PluginManager.h"

#include "condor_classad.h"

/**
 * All Schedd plugins must subclass ScheddPlugin. A Schedd plugin can
 * receive notification an update is set to the pool's main Collector.
 *
 * The plugin should have a statically initialized instance of itself,
 * which results in ScheddPlugin's constructor being called and the
 * plugin being registered.
 *
 * Plugins should be compiled within the source of the Condor version
 * with which they wish to be loaded and with the -shared option,
 * e.g. compile ExampleScheddPlugin.C with:
 *   $ make ExampleScheddPlugin-plugin.so
 *   (in Imakefile)
 *   %-plugin.so: %.C:
 *     $(CPlusPlus) $(C_PLUS_FLAGS) -shared $< -o $@
 */
class ScheddPlugin
{
  public:
    /**
     * The default constructor registers the plug-in with
     * ScheddPluginManager::registerPlugin
     *
     * All plugins should subclass ScheddPlugin and provide a
     * statically initialized instance of itself, so that it will be
     * registered when its object file is loaded
     */
    ScheddPlugin();

	virtual ~ScheddPlugin();

		// Called before the Scheduler is initialized
	virtual void earlyInitialize() = 0;

		// Called after the Scheduler is initialized
	virtual void initialize() = 0;

	virtual void shutdown() = 0;

	virtual void update(int cmd, const ClassAd *ad) = 0;

	virtual void archive(const ClassAd *ad) = 0;
};

class ScheddPluginManager : public PluginManager<ScheddPlugin>
{
  public:
	static void EarlyInitialize();

	static void Initialize();

	static void Shutdown();

	static void Update(int cmd, const ClassAd *ad);

	static void Archive(const ClassAd *ad);
};

#endif /* _SCHEDD_PLUGIN_H */

redpajama_set_name: RedPajamaGithub


text:
<?php
class Kwf_Controller_Action_MaintenanceJobs_JobsController extends Kwf_Controller_Action_Auto_Grid
{
    protected $_buttons = array('reload');
    protected $_defaultOrder = array('field' => 'last_run', 'direction' => 'DESC');

    public function indexAction()
    {
        $this->view->ext('Kwf.MaintenanceJobs.Index');
    }

    protected function _initColumns()
    {
        parent::_initColumns();

        $model = Kwf_Model_Abstract::getInstance('Kwf_Util_Maintenance_JobRunsModel');

        $data = array();
        foreach (Kwf_Util_Maintenance_Dispatcher::getAllMaintenanceJobIdentifiers() as $jobIdentifier) {
            $job = Kwf_Util_Maintenance_Job_AbstractBase::getInstance($jobIdentifier);

            $s = $model->select();
            $s->whereEquals('job', $jobIdentifier);
            $s->order('start', 'DESC');
            $lastRun = $model->getRow($s);
            $data[] = array(
                'id' => $jobIdentifier,
                'job' => $jobIdentifier,
                'frequency' => $job->getFrequency(),
                'last_run' => $lastRun ? $lastRun->start : null,
                'last_run_status' => $lastRun ? $lastRun->status : null,
            );
        }
        $model = new Kwf_Model_FnF(array(
            'data' => $data
        ));
        $this->setModel($model);
        $this->_columns->add(new Kwf_Grid_Column('job', 'Job', 400));
        $this->_columns->add(new Kwf_Grid_Column('frequency', 'Frequency'));
        $this->_columns->add(new Kwf_Grid_Column_Datetime('last_run', 'Last Run'));
        $this->_columns->add(new Kwf_Grid_Column('last_run_status', 'Last Run Status'));
    }
}


text:
from __future__ import absolute_import

import pytest

from takayi.typing import Any, List, Mapping, Callable, Sequence, is_type,\
    String, AnyObject

def test_types():
    assert str(Any) == 'Typing.Any'
    assert str(List) == 'Typing.List'
    assert str(Mapping) == 'Typing.Mapping'
    assert str(Callable) == 'Typing.Callable'
    assert str(Sequence) == 'Typing.Sequence'
    assert str(String) == 'Typing.String'

    assert Any.t_name == 'Any'
    assert Any.t_type == AnyObject

def test_is_type():
    a_list = ['hello', 'world']
    a_mapping = {'hello': 'world'}
    a_str = 'hello world'

    with pytest.raises(AssertionError):
        is_type(a_str, str)

    def func():
        pass

    assert is_type(func, Callable) is True
    assert is_type(func, Any) is True
    assert is_type(func, List) is False

    assert is_type(a_list, List) is True
    assert is_type(a_list, Sequence) is True
    assert is_type(a_mapping, List) is False
    assert is_type(a_mapping, Sequence) is True

    assert is_type(a_list, Any) is True
    assert is_type(a_mapping, Any) is True

    assert is_type(a_list, Mapping) is False
    assert is_type(a_mapping, Mapping) is True

    assert is_type(a_str, String) is True
    assert is_type(a_str, Any) is True
    assert is_type(a_str, List) is False


text:
package wikokit.base.wikt.sql;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
import wikokit.base.wikipedia.sql.Connect;

//import wikipedia.sql.UtilSQL;
import wikokit.base.wikipedia.language.LanguageType;
//import wikt.constant.ContextLabel;
//import wikt.util.WikiWord;
//import wikt.word.WQuote;
import wikokit.base.wikt.word.WMeaning;
import wikokit.base.wikt.multi.ru.WMeaningRu;

public class TWikiTextTest {

    public Connect   ruwikt_parsed_conn;

    public TWikiTextTest() {
    }

    @BeforeClass
    public static void setUpClass() throws Exception {
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }

    @Before
    public void setUp() {
        ruwikt_parsed_conn = new Connect();
        ruwikt_parsed_conn.Open(Connect.RUWIKT_HOST,Connect.RUWIKT_PARSED_DB,Connect.RUWIKT_USER,Connect.RUWIKT_PASS,LanguageType.ru);
    }

    @After
    public void tearDown() {
        ruwikt_parsed_conn.Close();
    }

    @Test
    public void testStoreToDB() {
        System.out.println("storeToDB_ru_en");

        String text = "test_TWikiText_storeToDB_ru";
        Connect conn = ruwikt_parsed_conn;

        LanguageType lang_section;
        String page_title;

        page_title      = "airplane";
        lang_section    = LanguageType.en; // English word

        String _definition = "A programmable_test calculation_tests_test";
        String line =  "# A [[programmable_test]] [[calculation_test]]s_test";
        WMeaning wmeaning = WMeaningRu.parseOneDefinition(page_title, lang_section, line);
        assertNotNull(wmeaning);
        assertTrue(wmeaning.getDefinition().equalsIgnoreCase(_definition));

        String line2 = wmeaning.getWikifiedText();
        assertTrue(line2.equalsIgnoreCase("A [[programmable_test]] [[calculation_test]]s_test")); // without "# "

        TWikiText twiki_text = TWikiText.storeToDB (conn, wmeaning.getWikiText());
        assertNotNull(twiki_text);

        // check that two pages should appear in table 'page': "programmable" and "calculation"
        TPage page_programmable = TPage.get(conn, "programmable_test");
        TPage page_calculation = TPage.get(conn, "calculation_test");
        assertNotNull(page_programmable);
        assertNotNull(page_calculation);

        // check that 1 record should appear in table 'wiki_text'
        TWikiText wiki_text = TWikiText.get(conn, _definition);
        assertNotNull(wiki_text);

        // check that 1 record should appear in tables 'inflection', 'page_inflection'
        TInflection infl_calculations = TInflection.get(conn, "calculation_tests_test");
        assertNotNull(infl_calculations);

        TPageInflection pti_calc = TPageInflection.get(conn, page_calculation, infl_calculations);
        assertNotNull(pti_calc);

        // check that 2 record should appear in table 'wiki_text_words'
        TWikiTextWords w_calc = TWikiTextWords.getByWikiTextAndPageAndInflection(conn, wiki_text, page_calculation, pti_calc);
        TWikiTextWords w_prog = TWikiTextWords.getByWikiTextAndPageAndInflection(conn, wiki_text, page_programmable, null);
        assertNotNull(w_calc);
        assertNotNull(w_prog);

        // delete temporary records

        // wiki_text = "A programmable_test calculation_tests_test"
        // Attention: words of this wiki_text should be deleted before the line "TWikiText.deleteWithWords(conn, w_text);"
        TWikiText.deleteWithWords(conn, twiki_text);

        String[] pages_test = {"programmable_test", "calculation_test"};
        for(String p: pages_test) {
            TWikiText w_text = TWikiText.get(conn, p);
            if(null != w_text)
                TWikiText.deleteWithWords(conn, w_text);
            TPage.delete(conn, p);
        }

        // inflection = "calculation_tests_test"
        TInflection.delete(conn, infl_calculations);
        TPageInflection.delete(conn, pti_calc);
    }

    @Test
    public void testInsert() {
        System.out.println("insert_ru");

        String text = "test_TWikiText_insert_ru";
        String wikified_text = "[[test_TWikiText_insert_ru]]";
        Connect conn = ruwikt_parsed_conn;

        // insert page, get wiki_text.id
        TWikiText p = null, p2=null, p3=null;
        p = TWikiText.get(conn, text);
        if(null != p) {
            TWikiText.delete(conn, p);
        }
        // p == p2
        p = TWikiText.insert(conn, text, wikified_text);
        p2 = TWikiText.get(conn, text);
        p3 = TWikiText.getByID(conn, p.getID());

        assertTrue(p != null);
        assertTrue(p2 != null);
        assertTrue(p3 != null);
        assertTrue(p.getID() > 0);
        assertEquals(p.getID(), p2.getID());
        assertEquals(p.getText(), p3.getText());

        TWikiText.delete(conn, p);              // delete temporary DB record

        p = TWikiText.getByID(conn, p.getID()); // check deletion
        assertTrue(p == null);
        p2 = TWikiText.getByID(conn, p2.getID());
        assertTrue(p2 == null);
    }

    @Test
    public void testInsert_backslash() {
        System.out.println("insert__backslash");

        String wikified_text = " A [[backslash]] (symbol \"\\\").";
        String          text = " A backslash (symbol \"\\\").";

        Connect conn = ruwikt_parsed_conn;

        // insert page, get wiki_text.id
        TWikiText p = null, p2=null, p3=null;
        p = TWikiText.get(conn, text);
        if(null != p) {
            TWikiText.delete(conn, p);
        }
        // p == p2
        p = TWikiText.insert(conn, text, wikified_text);
        p2 = TWikiText.get(conn, text);
        p3 = TWikiText.getByID(conn, p.getID());

        assertTrue(p != null);
        assertTrue(p2 != null);
        assertTrue(p3 != null);
        assertTrue(p.getID() > 0);
        assertEquals(p.getID(), p2.getID());
        assertEquals(p.getText(), p3.getText());

        TWikiText.delete(conn, p);              // delete temporary DB record

        p = TWikiText.getByID(conn, p.getID()); // check deletion
        assertTrue(p == null);
        p2 = TWikiText.getByID(conn, p2.getID());
        assertTrue(p2 == null);
    }

}


text:
package registry // import "github.com/docker/docker/testutil/registry"

import (
	"fmt"
	"io"
	"net/http"
	"os"
	"os/exec"
	"path/filepath"
	"testing"
	"time"

	"github.com/opencontainers/go-digest"
	"gotest.tools/v3/assert"
)

const (
	// V2binary is the name of the registry v2 binary
	V2binary = "registry-v2"
	// V2binarySchema1 is the name of the registry that serve schema1
	V2binarySchema1 = "registry-v2-schema1"
	// DefaultURL is the default url that will be used by the registry (if not specified otherwise)
	DefaultURL = "127.0.0.1:5000"
)

// V2 represent a registry version 2
type V2 struct {
	cmd         *exec.Cmd
	registryURL string
	dir         string
	auth        string
	username    string
	password    string
	email       string
}

// Config contains the test registry configuration
type Config struct {
	schema1     bool
	auth        string
	tokenURL    string
	registryURL string
	stdout      io.Writer
	stderr      io.Writer
}

// NewV2 creates a v2 registry server
func NewV2(t testing.TB, ops ...func(*Config)) *V2 {
	t.Helper()
	c := &Config{
		registryURL: DefaultURL,
	}
	for _, op := range ops {
		op(c)
	}
	tmp, err := os.MkdirTemp("", "registry-test-")
	assert.NilError(t, err)
	template := `version: 0.1
loglevel: debug
storage:
    filesystem:
        rootdirectory: %s
http:
    addr: %s
%s`
	var (
		authTemplate string
		username     string
		password     string
		email        string
	)
	switch c.auth {
	case "htpasswd":
		htpasswdPath := filepath.Join(tmp, "htpasswd")
		// generated with: htpasswd -Bbn testuser testpassword
		// #nosec G101
		userpasswd := "testuser:$2y$05$sBsSqk0OpSD1uTZkHXc4FeJ0Z70wLQdAX/82UiHuQOKbNbBrzs63m"
		username = "testuser"
		password = "testpassword"
		email = "test@test.org"
		err := os.WriteFile(htpasswdPath, []byte(userpasswd), os.FileMode(0644))
		assert.NilError(t, err)
		authTemplate = fmt.Sprintf(`auth:
    htpasswd:
        realm: basic-realm
        path: %s
`, htpasswdPath)
	case "token":
		authTemplate = fmt.Sprintf(`auth:
    token:
        realm: %s
        service: "registry"
        issuer: "auth-registry"
        rootcertbundle: "fixtures/registry/cert.pem"
`, c.tokenURL)
	}

	confPath := filepath.Join(tmp, "config.yaml")
	config, err := os.Create(confPath)
	assert.NilError(t, err)
	defer config.Close()

	if _, err := fmt.Fprintf(config, template, tmp, c.registryURL, authTemplate); err != nil {
		// FIXME(vdemeester) use a defer/clean func
		os.RemoveAll(tmp)
		t.Fatal(err)
	}

	binary := V2binary
	if c.schema1 {
		binary = V2binarySchema1
	}
	cmd := exec.Command(binary, confPath)
	cmd.Stdout = c.stdout
	cmd.Stderr = c.stderr
	if err := cmd.Start(); err != nil {
		// FIXME(vdemeester) use a defer/clean func
		os.RemoveAll(tmp)
		t.Fatal(err)
	}
	return &V2{
		cmd:         cmd,
		dir:         tmp,
		auth:        c.auth,
		username:    username,
		password:    password,
		email:       email,
		registryURL: c.registryURL,
	}
}

// WaitReady waits for the registry to be ready to serve requests (or fail after a while)
func (r *V2) WaitReady(t testing.TB) {
	t.Helper()
	var err error
	for i := 0; i != 50; i++ {
		if err = r.Ping(); err == nil {
			return
		}
		time.Sleep(100 * time.Millisecond)
	}
	t.Fatalf("timeout waiting for test registry to become available: %v", err)
}

// Ping sends an http request to the current registry, and fail if it doesn't respond correctly
func (r *V2) Ping() error {
	// We always ping through HTTP for our test registry.
	resp, err := http.Get(fmt.Sprintf("http://%s/v2/", r.registryURL))
	if err != nil {
		return err
	}
	resp.Body.Close()

	fail := resp.StatusCode != http.StatusOK
	if r.auth != "" {
		// unauthorized is a _good_ status when pinging v2/ and it needs auth
		fail = fail && resp.StatusCode != http.StatusUnauthorized
	}
	if fail {
		return fmt.Errorf("registry ping replied with an unexpected status code %d", resp.StatusCode)
	}
	return nil
}

// Close kills the registry server
func (r *V2) Close() {
	r.cmd.Process.Kill()
	r.cmd.Process.Wait()
	os.RemoveAll(r.dir)
}

func (r *V2) getBlobFilename(blobDigest digest.Digest) string {
	// Split the digest into its algorithm and hex components.
	dgstAlg, dgstHex := blobDigest.Algorithm(), blobDigest.Encoded()

	// The path to the target blob data looks something like:
	//   baseDir + "docker/registry/v2/blobs/sha256/a3/a3ed...46d4/data"
	return fmt.Sprintf("%s/docker/registry/v2/blobs/%s/%s/%s/data", r.dir, dgstAlg, dgstHex[:2], dgstHex)
}

// ReadBlobContents read the file corresponding to the specified digest
func (r *V2) ReadBlobContents(t testing.TB, blobDigest digest.Digest) []byte {
	t.Helper()
	// Load the target manifest blob.
	manifestBlob, err := os.ReadFile(r.getBlobFilename(blobDigest))
	assert.NilError(t, err, "unable to read blob")
	return manifestBlob
}

// WriteBlobContents write the file corresponding to the specified digest with the given content
func (r *V2) WriteBlobContents(t testing.TB, blobDigest digest.Digest, data []byte) {
	t.Helper()
	err := os.WriteFile(r.getBlobFilename(blobDigest), data, os.FileMode(0644))
	assert.NilError(t, err, "unable to write malicious data blob")
}

// TempMoveBlobData moves the existing data file aside, so that we can replace it with a
// malicious blob of data for example.
func (r *V2) TempMoveBlobData(t testing.TB, blobDigest digest.Digest) (undo func()) {
	t.Helper()
	tempFile, err := os.CreateTemp("", "registry-temp-blob-")
	assert.NilError(t, err, "unable to get temporary blob file")
	tempFile.Close()

	blobFilename := r.getBlobFilename(blobDigest)

	// Move the existing data file aside, so that we can replace it with a
	// another blob of data.
	if err := os.Rename(blobFilename, tempFile.Name()); err != nil {
		// FIXME(vdemeester) use a defer/clean func
		os.Remove(tempFile.Name())
		t.Fatalf("unable to move data blob: %s", err)
	}

	return func() {
		os.Rename(tempFile.Name(), blobFilename)
		os.Remove(tempFile.Name())
	}
}

// Username returns the configured user name of the server
func (r *V2) Username() string {
	return r.username
}

// Password returns the configured password of the server
func (r *V2) Password() string {
	return r.password
}

// Email returns the configured email of the server
func (r *V2) Email() string {
	return r.email
}

// Path returns the path where the registry write data
func (r *V2) Path() string {
	return filepath.Join(r.dir, "docker", "registry", "v2")
}


text:
package com.facebook.buck.apple;

import com.facebook.buck.model.BuildTarget;
import com.facebook.buck.model.Flavor;
import com.facebook.buck.model.Flavored;
import com.facebook.buck.rules.AbstractDescriptionArg;
import com.facebook.buck.rules.BuildRule;
import com.facebook.buck.rules.BuildRuleParams;
import com.facebook.buck.rules.BuildRuleResolver;
import com.facebook.buck.rules.BuildRuleType;
import com.facebook.buck.rules.Description;
import com.facebook.buck.rules.Hint;
import com.facebook.buck.rules.ImplicitDepsInferringDescription;
import com.facebook.buck.rules.SourcePathResolver;
import com.facebook.buck.rules.TargetGraph;
import com.facebook.buck.util.HumanReadableException;
import com.facebook.infer.annotation.SuppressFieldNotInitialized;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableSet;

import java.nio.file.Path;

public class ApplePackageDescription implements
    Description<ApplePackageDescription.Arg>,
    Flavored,
    ImplicitDepsInferringDescription<ApplePackageDescription.Arg> {
  public static final BuildRuleType TYPE = BuildRuleType.of("apple_package");

  @Override
  public <A extends Arg> BuildRule createBuildRule(
      TargetGraph targetGraph,
      BuildRuleParams params,
      BuildRuleResolver resolver,
      A args) {
    BuildRule bundle = resolver.getRule(
        propagateFlavorsToTarget(params.getBuildTarget(), args.bundle));
    if (!(bundle instanceof BuildRuleWithAppleBundle)) {
      throw new HumanReadableException(
          "In %s, bundle='%s' must be an apple_bundle() but was %s().",
          params.getBuildTarget(),
          bundle.getFullyQualifiedName(),
          bundle.getType());
    }
    SourcePathResolver sourcePathResolver = new SourcePathResolver(resolver);
    return new ApplePackage(
        params,
        sourcePathResolver,
        ((BuildRuleWithAppleBundle) bundle).getAppleBundle());
  }

  @Override
  public BuildRuleType getBuildRuleType() {
    return TYPE;
  }

  @Override
  public Arg createUnpopulatedConstructorArg() {
    return new Arg();
  }

  private BuildTarget propagateFlavorsToTarget(BuildTarget fromTarget, BuildTarget toTarget) {
    return BuildTarget.builder(toTarget)
        .addAllFlavors(fromTarget.getFlavors())
        .build();
  }

  /**
   * Propagate the packages's flavors to its dependents.
   */
  @Override
  public ImmutableSet<BuildTarget> findDepsForTargetFromConstructorArgs(
      BuildTarget buildTarget,
      Function<Optional<String>, Path> cellRoots,
      ApplePackageDescription.Arg constructorArg) {
    return ImmutableSet.<BuildTarget>of(
        propagateFlavorsToTarget(buildTarget, constructorArg.bundle));
  }

  @Override
  public boolean hasFlavors(ImmutableSet<Flavor> flavors) {
    return true;
  }

  @SuppressFieldNotInitialized
  public static class Arg extends AbstractDescriptionArg {
    @Hint(isDep = false) public BuildTarget bundle;
  }
}


text:
#ifndef _updatechecker_h_
#define _updatechecker_h_

#include "threads.h"

#include <string>

namespace winsparkle
{

struct Appcast;

/**
    This class checks the appcast for updates.

    If an update is found, then UpdateChecker initializes the GUI thread
    and shows information about available update to the user.
 */
class UpdateChecker : public Thread
{
public:
    /// Creates checker thread.
    UpdateChecker();

    /**
        Compares versions @a a and @a b.

        The comparison is somewhat intelligent, it handles beta and RC
        components correctly.

        @return 0 if the versions are identical, negative value if
                @a a is smaller than @a b, positive value if @a a
                is larger than @a b.
     */
    static int CompareVersions(const std::string& a, const std::string& b);

protected:
    /// Returns flags to be used when checking the appcast
    virtual int GetAppcastDownloadFlags() const { return 0; }

    /// Should give version be ignored?
    virtual bool ShouldSkipUpdate(const Appcast& appcast) const;

    /// Should we install the update or prompt the user for options first?
    virtual bool ShouldAutomaticallyInstall() const { return false; }

protected:
    virtual void Run();
    virtual bool IsJoinable() const { return false; }
};

/**
    Update checker used for manual checking.
 */
class ManualUpdateChecker : public UpdateChecker
{
public:
    /// Creates checker thread.
    ManualUpdateChecker() : UpdateChecker() {}

protected:
    virtual int GetAppcastDownloadFlags() const;
    virtual bool ShouldSkipUpdate(const Appcast& appcast) const;
};

/**
    Update checker used to automatically install updates when found.
 */
class ManualAutoInstallUpdateChecker : public ManualUpdateChecker
{
public:
    /// Creates checker thread.
    ManualAutoInstallUpdateChecker() : ManualUpdateChecker() {}

protected:
    virtual bool ShouldAutomaticallyInstall() const { return true; };
};

} // namespace winsparkle

#endif // _updatechecker_h_


text:
<!--
  Copyright 2014 Google Inc.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->

<com.google.android.apps.muzei.util.DrawInsetsFrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.google.android.apps.muzei.util.PanScaleProxyView
        android:id="@+id/pan_scale_proxy"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <FrameLayout android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/image_loading_container"
        android:clickable="true"
        android:background="#c000"
        android:visibility="gone"
        android:alpha="0">

        <com.google.android.apps.muzei.util.AnimatedMuzeiLoadingSpinnerView
            android:id="@+id/image_loading_indicator"
            android:layout_width="132dp"
            android:layout_height="88dp"
            android:layout_gravity="center" />

    </FrameLayout>

    <FrameLayout android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/image_error_container"
        android:clickable="true"
        android:orientation="vertical"
        android:background="#c000"
        android:visibility="gone"
        android:alpha="0">

        <TextView android:id="@+id/error_easter_egg"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="top|center_horizontal"
            android:fontFamily="sans-serif-condensed"
            android:textStyle="italic"
            android:textSize="16sp"
            android:layout_marginTop="32dp"
            android:layout_marginStart="48dp"
            android:layout_marginEnd="48dp"
            android:textColor="#cfff"
            android:text="@string/error_easter_egg"/>

        <Button android:id="@+id/image_error_retry_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:background="?selectableItemBackground"
            android:paddingTop="24dp"
            android:paddingStart="24dp"
            android:paddingEnd="24dp"
            android:paddingBottom="16dp"
            android:drawableTop="@drawable/grumpy_mcpuzzles"
            android:text="@string/retry"
            android:drawablePadding="8dp"
            android:textSize="22sp"
            android:fontFamily="sans-serif-condensed"
            android:textStyle="italic"
            android:textColor="#fff" />

    </FrameLayout>

    <View android:id="@+id/statusbar_scrim"
        android:layout_width="match_parent"
        android:layout_height="160dp"
        android:layout_gravity="top"
        android:background="@android:color/transparent" />

    <LinearLayout android:id="@+id/chrome_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="bottom"
        android:layout_gravity="bottom"
        android:orientation="horizontal">

        <FrameLayout android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:paddingTop="192dp"> <!-- extend gradient -->

            <LinearLayout android:id="@+id/metadata"
                android:clickable="true"
                android:focusable="true"
                android:background="?selectableItemBackground"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <com.google.android.apps.muzei.util.ShadowDipsTextView
                    android:id="@+id/title"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textSize="@dimen/art_detail_title_text_size"
                    android:textColor="#fff"
                    app:shadowColor="#8000"
                    app:shadowDx="0dp"
                    app:shadowDy="1dp"
                    app:shadowRadius="3dp"
                    android:paddingBottom="@dimen/art_detail_title_bottom_padding"
                    android:layout_marginBottom="@dimen/art_detail_title_byline_margin"
                    android:paddingTop="@dimen/art_detail_metadata_margin"
                    android:paddingStart="@dimen/art_detail_metadata_margin"
                    android:paddingEnd="@dimen/art_detail_metadata_margin" />

                <com.google.android.apps.muzei.util.ShadowDipsTextView
                    android:id="@+id/byline"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textSize="@dimen/art_detail_byline_text_size"
                    android:textColor="#fff"
                    app:shadowColor="#8000"
                    app:shadowDx="0dp"
                    app:shadowDy="1dp"
                    app:shadowRadius="3dp"
                    android:paddingStart="@dimen/art_detail_metadata_margin"
                    android:paddingBottom="@dimen/art_detail_metadata_margin_bottom"
                    android:paddingEnd="@dimen/art_detail_metadata_margin" />
            </LinearLayout>
        </FrameLayout>

        <ImageButton android:id="@+id/next_button"
            android:layout_width="@dimen/art_detail_button_width"
            android:layout_height="@dimen/art_detail_button_height"
            android:background="?selectableItemBackgroundBorderless"
            android:src="@drawable/ic_skip"
            android:scaleType="center"
            android:contentDescription="@string/action_next_artwork"
            android:visibility="gone" />

        <ImageButton android:id="@+id/overflow_button"
            android:layout_width="@dimen/art_detail_button_width"
            android:layout_height="@dimen/art_detail_button_height"
            android:background="?selectableItemBackgroundBorderless"
            android:src="@drawable/ic_overflow"
            android:scaleType="center"
            android:contentDescription="@string/contentdesc_overflow" />

    </LinearLayout>

    <include layout="@layout/muzei_include_intro" />

</com.google.android.apps.muzei.util.DrawInsetsFrameLayout>


text:
local utf8 = require "utf8"

local _M = {}

local encoding_literal_byte = 1
local encoding_literal_string = 2
local encoding_dictionary_entry = 3

--todo: just solve the linear equations instead of iterating

--searching for sub patterns
local function find_index_at(s, index, lookup, levels)
	local search = utf8.sub(s, index, index+levels-1)
	for i = levels,1,-1 do
		local sub = utf8.sub(search, 1, i)
		local luv = lookup[sub]
		if luv then
			return luv, i
		end
	end
	return nil, 0
end

local function compress(s, dict)
	--prep tables into lookup
	local lookup = {}
	local levels = 1
	for i,v in ipairs(dict) do
		lookup[v] = i;
		levels = math.max(levels, utf8.len(v))
	end

	local index = 1
	local len = utf8.len(s)
	local output = {}
	while index <= len and #output < len + 2 do
		--search for a match, longest first
		local found, flen = find_index_at(s, index, lookup, levels)
		if found then
			--nice, there's something in the dictionary
			table.insert(output, found + encoding_dictionary_entry - 1)
			index = index + flen
		else
			--dang, it's not, figure out how few bytes we can get away with encoding..
			local bad_bytes = 1
			while not found and bad_bytes < 0xD800 and index + bad_bytes < len do
				found, flen = find_index_at(s, index + bad_bytes, lookup, levels)
				--skip any short dict entries because restarting verbatim encoding has overhead
				if flen <= 2 and bad_bytes > 1 then
					--todo: detect when there's a viable run of small breaks ahead
					found = nil
				end
				if not found then
					bad_bytes = bad_bytes + 1
				end
			end
			if bad_bytes == 1 then
				-- byte verbatim
				table.insert(output, encoding_literal_byte)
				table.insert(output, utf8.byte(s, index))
			else
				-- string verbatim
				table.insert(output, encoding_literal_string)
				table.insert(output, bad_bytes)
				for i = 0, bad_bytes - 1 do
					table.insert(output, utf8.byte(s, index + i))
				end
			end
			index = index + bad_bytes
		end
	end

	if #output < len + 2 then
		--compression achieved
		for i = 1, #output do
			output[i] = utf8.char(output[i])
		end

		return table.concat(output, "")
	else
		--no-win, encode verbatim
		if len > 1 then
			--string
			output = {
				utf8.char(encoding_literal_string),
				utf8.char(len)
			}
		else
			--byte
			output = {
				utf8.char(encoding_literal_byte)
			}
		end
		table.insert(output, s)

		return table.concat(output, "")
	end
end

local function decompress(s, dict)
	local index = 1
	local len = utf8.len(s)
	local output = {}
	local err = nil
	while index <= len do
		local b = utf8.byte(s, index)
		if b == encoding_literal_byte then
			--byte
			table.insert(output, utf8.char(utf8.byte(s, index + 1)))
			index = index + 2
		elseif b == encoding_literal_string then
			--string
			local s_len = utf8.byte(s, index + 1)
			for i=1,s_len do
				table.insert(output, utf8.char(utf8.byte(s, index + 1 + i)))
			end
			index = index + 2 + s_len
		elseif b >= encoding_dictionary_entry then
			--tab entry
			local tabindex = b - encoding_dictionary_entry + 1
			table.insert(output, dict[tabindex])
			index = index + 1
		else
			--null
			table.insert(output, "\0")
			err = "malformed input"
			index = index + 1
		end
	end
	return table.concat(output,""), err
end

--public export

_M.compress = compress
_M.decompress = decompress

return _M


text:
apidog
======

Quick REST API documentation as a rails engine


text:
package com.amazonaws.services.iotwireless.model;

import java.io.Serializable;
import javax.annotation.Generated;

import com.amazonaws.AmazonWebServiceRequest;

/**
 *
 * @see AWS
 *      API Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CreateWirelessGatewayRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {

    /**
     *

     * The name of the new resource.
     *

     */
    private String name;
    /**
     *

     * The description of the new resource.
     *

     */
    private String description;
    /**
     *

     * The gateway configuration information to use to create the wireless gateway.
     *

     */
    private LoRaWANGateway loRaWAN;
    /**
     *

     * The tags to attach to the new wireless gateway. Tags are metadata that you can use to manage a resource.
     *

     */
    private java.util.List<Tag> tags;
    /**
     *

     * Each resource must have a unique client request token. If you try to create a new resource with the same token as
     * a resource that already exists, an exception occurs. If you omit this value, AWS SDKs will automatically generate
     * a unique client request.
     *

     */
    private String clientRequestToken;

    /**
     *

     * The name of the new resource.
     *

     *
     * @param name
     *        The name of the new resource.
     */

    public void setName(String name) {
        this.name = name;
    }

    /**
     *

     * The name of the new resource.
     *

     *
     * @return The name of the new resource.
     */

    public String getName() {
        return this.name;
    }

    /**
     *

     * The name of the new resource.
     *

     *
     * @param name
     *        The name of the new resource.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public CreateWirelessGatewayRequest withName(String name) {
        setName(name);
        return this;
    }

    /**
     *

     * The description of the new resource.
     *

     *
     * @param description
     *        The description of the new resource.
     */

    public void setDescription(String description) {
        this.description = description;
    }

    /**
     *

     * The description of the new resource.
     *

     *
     * @return The description of the new resource.
     */

    public String getDescription() {
        return this.description;
    }

    /**
     *

     * The description of the new resource.
     *

     *
     * @param description
     *        The description of the new resource.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public CreateWirelessGatewayRequest withDescription(String description) {
        setDescription(description);
        return this;
    }

    /**
     *

     * The gateway configuration information to use to create the wireless gateway.
     *

     *
     * @param loRaWAN
     *        The gateway configuration information to use to create the wireless gateway.
     */

    public void setLoRaWAN(LoRaWANGateway loRaWAN) {
        this.loRaWAN = loRaWAN;
    }

    /**
     *

     * The gateway configuration information to use to create the wireless gateway.
     *

     *
     * @return The gateway configuration information to use to create the wireless gateway.
     */

    public LoRaWANGateway getLoRaWAN() {
        return this.loRaWAN;
    }

    /**
     *

     * The gateway configuration information to use to create the wireless gateway.
     *

     *
     * @param loRaWAN
     *        The gateway configuration information to use to create the wireless gateway.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public CreateWirelessGatewayRequest withLoRaWAN(LoRaWANGateway loRaWAN) {
        setLoRaWAN(loRaWAN);
        return this;
    }

    /**
     *

     * The tags to attach to the new wireless gateway. Tags are metadata that you can use to manage a resource.
     *

     *
     * @return The tags to attach to the new wireless gateway. Tags are metadata that you can use to manage a resource.
     */

    public java.util.List<Tag> getTags() {
        return tags;
    }

    /**
     *

     * The tags to attach to the new wireless gateway. Tags are metadata that you can use to manage a resource.
     *

     *
     * @param tags
     *        The tags to attach to the new wireless gateway. Tags are metadata that you can use to manage a resource.
     */

    public void setTags(java.util.Collection<Tag> tags) {
        if (tags == null) {
            this.tags = null;
            return;
        }

        this.tags = new java.util.ArrayList<Tag>(tags);
    }

    /**
     *

     * The tags to attach to the new wireless gateway. Tags are metadata that you can use to manage a resource.
     *

     *

     * NOTE: This method appends the values to the existing list (if any). Use
     * {@link #setTags(java.util.Collection)} or {@link #withTags(java.util.Collection)} if you want to override the
     * existing values.
     *

     *
     * @param tags
     *        The tags to attach to the new wireless gateway. Tags are metadata that you can use to manage a resource.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public CreateWirelessGatewayRequest withTags(Tag... tags) {
        if (this.tags == null) {
            setTags(new java.util.ArrayList<Tag>(tags.length));
        }
        for (Tag ele : tags) {
            this.tags.add(ele);
        }
        return this;
    }

    /**
     *

     * The tags to attach to the new wireless gateway. Tags are metadata that you can use to manage a resource.
     *

     *
     * @param tags
     *        The tags to attach to the new wireless gateway. Tags are metadata that you can use to manage a resource.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public CreateWirelessGatewayRequest withTags(java.util.Collection<Tag> tags) {
        setTags(tags);
        return this;
    }

    /**
     *

     * Each resource must have a unique client request token. If you try to create a new resource with the same token as
     * a resource that already exists, an exception occurs. If you omit this value, AWS SDKs will automatically generate
     * a unique client request.
     *

     *
     * @param clientRequestToken
     *        Each resource must have a unique client request token. If you try to create a new resource with the same
     *        token as a resource that already exists, an exception occurs. If you omit this value, AWS SDKs will
     *        automatically generate a unique client request.
     */

    public void setClientRequestToken(String clientRequestToken) {
        this.clientRequestToken = clientRequestToken;
    }

    /**
     *

     * Each resource must have a unique client request token. If you try to create a new resource with the same token as
     * a resource that already exists, an exception occurs. If you omit this value, AWS SDKs will automatically generate
     * a unique client request.
     *

     *
     * @return Each resource must have a unique client request token. If you try to create a new resource with the same
     *         token as a resource that already exists, an exception occurs. If you omit this value, AWS SDKs will
     *         automatically generate a unique client request.
     */

    public String getClientRequestToken() {
        return this.clientRequestToken;
    }

    /**
     *

     * Each resource must have a unique client request token. If you try to create a new resource with the same token as
     * a resource that already exists, an exception occurs. If you omit this value, AWS SDKs will automatically generate
     * a unique client request.
     *

     *
     * @param clientRequestToken
     *        Each resource must have a unique client request token. If you try to create a new resource with the same
     *        token as a resource that already exists, an exception occurs. If you omit this value, AWS SDKs will
     *        automatically generate a unique client request.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public CreateWirelessGatewayRequest withClientRequestToken(String clientRequestToken) {
        setClientRequestToken(clientRequestToken);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getName() != null)
            sb.append("Name: ").append(getName()).append(",");
        if (getDescription() != null)
            sb.append("Description: ").append(getDescription()).append(",");
        if (getLoRaWAN() != null)
            sb.append("LoRaWAN: ").append(getLoRaWAN()).append(",");
        if (getTags() != null)
            sb.append("Tags: ").append(getTags()).append(",");
        if (getClientRequestToken() != null)
            sb.append("ClientRequestToken: ").append(getClientRequestToken());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof CreateWirelessGatewayRequest == false)
            return false;
        CreateWirelessGatewayRequest other = (CreateWirelessGatewayRequest) obj;
        if (other.getName() == null ^ this.getName() == null)
            return false;
        if (other.getName() != null && other.getName().equals(this.getName()) == false)
            return false;
        if (other.getDescription() == null ^ this.getDescription() == null)
            return false;
        if (other.getDescription() != null && other.getDescription().equals(this.getDescription()) == false)
            return false;
        if (other.getLoRaWAN() == null ^ this.getLoRaWAN() == null)
            return false;
        if (other.getLoRaWAN() != null && other.getLoRaWAN().equals(this.getLoRaWAN()) == false)
            return false;
        if (other.getTags() == null ^ this.getTags() == null)
            return false;
        if (other.getTags() != null && other.getTags().equals(this.getTags()) == false)
            return false;
        if (other.getClientRequestToken() == null ^ this.getClientRequestToken() == null)
            return false;
        if (other.getClientRequestToken() != null && other.getClientRequestToken().equals(this.getClientRequestToken()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
        hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode());
        hashCode = prime * hashCode + ((getLoRaWAN() == null) ? 0 : getLoRaWAN().hashCode());
        hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode());
        hashCode = prime * hashCode + ((getClientRequestToken() == null) ? 0 : getClientRequestToken().hashCode());
        return hashCode;
    }

    @Override
    public CreateWirelessGatewayRequest clone() {
        return (CreateWirelessGatewayRequest) super.clone();
    }

}


text:
<?php

require_once('tcpdf/config/lang/spa.php');
    require_once('tcpdf/tcpdf.php');
    //Cambias los header para que el navegador conozca que esta recibiendo un Pdf
 // header('Content-type: application/pdf');
 // header('Content-Disposition: attachment; filename="naAme.pdf"');

//Cargas la vista
//$view = View('imprimir/pdf');
//$template = $view->render(FALSE);
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 001');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);

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

// set default font subsetting mode
$pdf->setFontSubsetting(true);

// Set font
// dejavusans is a UTF-8 Unicode font, if you only need to
// print standard ASCII chars, you can use core fonts like
// helvetica or times to reduce file size.
$pdf->SetFont('dejavusans', '', 14, '', true);

// Add a page
// This method has several options, check the source code documentation for more information.
$pdf->AddPage();

// Set some content to print
$html = <<<EOD

Welcome to  TCPDF !

This is the first example of TCPDF library.

This text is printed using the writeHTMLCell() method but you can also use: Multicell(), writeHTML(), Write(), Cell() and Text().

Please check the source code documentation and other examples for further information.

TO IMPROVE AND EXPAND TCPDF I NEED YOUR SUPPORT, PLEASE MAKE A DONATION!

EOD;

// Print text using writeHTMLCell()
$pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);
$pdf->Output('example_0013.pdf', 'S');