text:
WebTest wrapper
===============

The class ``FuncWebTestMixin`` has some WebTest specific methods/attributes, as well as the :doc:`common`.

.. currentmodule:: django_functest

.. class:: FuncWebTestMixin

   .. attribute:: last_response

      This is an object containing the last HTTP response, as documented in `the
      WebTest docs
      <http://webtest.pythonpaste.org/en/latest/testresponse.html>`_.

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
ISO7816 (Java Card API, Connected Edition)
</TITLE>

<META NAME="date" CONTENT="2009-12-11">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

javacard.framework

Interface ISO7816

public interface ISO7816

ISO7816 encapsulates constants related to ISO 7816-3 and ISO
 7816-4. ISO7816 interface contains only static fields.

 The static fields with SW_ prefixes define constants for the
 ISO 7816-4 defined response status word. The fields which use the
 _00 suffix require the low order byte to be customized
 appropriately e.g (ISO7816.SW_CORRECT_LENGTH_00 + (0x0025 & 0xFF)).

 The static fields with OFFSET_ prefixes define constants to be
 used to index into the APDU buffer byte array to access ISO 7816-4 defined
 header information.

Field Summary

static byte
CLA_ISO7816

          APDU command CLA : ISO 7816 = 0x00

static byte
INS_EXTERNAL_AUTHENTICATE

          APDU command INS : EXTERNAL AUTHENTICATE = 0x82

static byte
INS_SELECT

          APDU command INS : SELECT = 0xA4

static byte
OFFSET_CDATA

          APDU command data offset : CDATA = 5

static byte
OFFSET_CLA

          APDU header offset : CLA = 0

static byte
OFFSET_EXT_CDATA

          APDU command data offset with extended length input data : EXT_CDATA = 7

static byte
OFFSET_INS

          APDU header offset : INS = 1

static byte
OFFSET_LC

          APDU header offset : LC = 4

static byte
OFFSET_P1

          APDU header offset : P1 = 2

static byte
OFFSET_P2

          APDU header offset : P2 = 3

static short
SW_APPLET_SELECT_FAILED

          Response status : Applet selection failed = 0x6999;

static short
SW_BYTES_REMAINING_00

          Response status : Response bytes remaining = 0x6100

static short
SW_CLA_NOT_SUPPORTED

          Response status : CLA value not supported = 0x6E00

static short
SW_COMMAND_CHAINING_NOT_SUPPORTED

          Response status : Command chaining not supported = 0x6884

static short
SW_COMMAND_NOT_ALLOWED

          Response status : Command not allowed (no current EF) = 0x6986

static short
SW_CONDITIONS_NOT_SATISFIED

          Response status : Conditions of use not satisfied = 0x6985

static short
SW_CORRECT_LENGTH_00

          Response status : Correct Expected Length (Le) = 0x6C00

static short
SW_DATA_INVALID

          Response status : Data invalid = 0x6984

static short
SW_FILE_FULL

          Response status : Not enough memory space in the file = 0x6A84

static short
SW_FILE_INVALID

          Response status : File invalid = 0x6983

static short
SW_FILE_NOT_FOUND

          Response status : File not found = 0x6A82

static short
SW_FUNC_NOT_SUPPORTED

          Response status : Function not supported = 0x6A81

static short
SW_INCORRECT_P1P2

          Response status : Incorrect parameters (P1,P2) = 0x6A86

static short
SW_INS_NOT_SUPPORTED

          Response status : INS value not supported = 0x6D00

static short
SW_LAST_COMMAND_EXPECTED

          Response status : Last command in chain expected = 0x6883

static short
SW_LOGICAL_CHANNEL_NOT_SUPPORTED

          Response status : Card does not support the operation on the specified
 logical channel = 0x6881

static short
SW_NO_ERROR

          Response status : No Error = (short)0x9000

static short
SW_RECORD_NOT_FOUND

          Response status : Record not found = 0x6A83

static short
SW_SECURE_MESSAGING_NOT_SUPPORTED

          Response status : Card does not support secure messaging = 0x6882

static short
SW_SECURITY_STATUS_NOT_SATISFIED

          Response status : Security condition not satisfied = 0x6982

static short
SW_UNKNOWN

          Response status : No precise diagnosis = 0x6F00

static short
SW_WARNING_STATE_UNCHANGED

          Response status : Warning, card state unchanged = 0x6200

static short
SW_WRONG_DATA

          Response status : Wrong data = 0x6A80

static short
SW_WRONG_LENGTH

          Response status : Wrong length = 0x6700

static short
SW_WRONG_P1P2

          Response status : Incorrect parameters (P1,P2) = 0x6B00

Field Detail

SW_NO_ERROR

static final short SW_NO_ERROR

Response status : No Error = (short)0x9000

See Also:
Constant Field Values

SW_BYTES_REMAINING_00

static final short SW_BYTES_REMAINING_00

Response status : Response bytes remaining = 0x6100

See Also:
Constant Field Values

SW_WRONG_LENGTH

static final short SW_WRONG_LENGTH

Response status : Wrong length = 0x6700

See Also:
Constant Field Values

SW_SECURITY_STATUS_NOT_SATISFIED

static final short SW_SECURITY_STATUS_NOT_SATISFIED

Response status : Security condition not satisfied = 0x6982

See Also:
Constant Field Values

SW_FILE_INVALID

static final short SW_FILE_INVALID

Response status : File invalid = 0x6983

See Also:
Constant Field Values

SW_DATA_INVALID

static final short SW_DATA_INVALID

Response status : Data invalid = 0x6984

See Also:
Constant Field Values

SW_CONDITIONS_NOT_SATISFIED

static final short SW_CONDITIONS_NOT_SATISFIED

Response status : Conditions of use not satisfied = 0x6985

See Also:
Constant Field Values

SW_COMMAND_NOT_ALLOWED

static final short SW_COMMAND_NOT_ALLOWED

Response status : Command not allowed (no current EF) = 0x6986

See Also:
Constant Field Values

SW_APPLET_SELECT_FAILED

static final short SW_APPLET_SELECT_FAILED

Response status : Applet selection failed = 0x6999;

See Also:
Constant Field Values

SW_WRONG_DATA

static final short SW_WRONG_DATA

Response status : Wrong data = 0x6A80

See Also:
Constant Field Values

SW_FUNC_NOT_SUPPORTED

static final short SW_FUNC_NOT_SUPPORTED

Response status : Function not supported = 0x6A81

See Also:
Constant Field Values

SW_FILE_NOT_FOUND

static final short SW_FILE_NOT_FOUND

Response status : File not found = 0x6A82

See Also:
Constant Field Values

SW_RECORD_NOT_FOUND

static final short SW_RECORD_NOT_FOUND

Response status : Record not found = 0x6A83

See Also:
Constant Field Values

SW_INCORRECT_P1P2

static final short SW_INCORRECT_P1P2

Response status : Incorrect parameters (P1,P2) = 0x6A86

See Also:
Constant Field Values

SW_WRONG_P1P2

static final short SW_WRONG_P1P2

Response status : Incorrect parameters (P1,P2) = 0x6B00

See Also:
Constant Field Values

SW_CORRECT_LENGTH_00

static final short SW_CORRECT_LENGTH_00

Response status : Correct Expected Length (Le) = 0x6C00

See Also:
Constant Field Values

SW_INS_NOT_SUPPORTED

static final short SW_INS_NOT_SUPPORTED

Response status : INS value not supported = 0x6D00

See Also:
Constant Field Values

SW_CLA_NOT_SUPPORTED

static final short SW_CLA_NOT_SUPPORTED

Response status : CLA value not supported = 0x6E00

See Also:
Constant Field Values

SW_UNKNOWN

static final short SW_UNKNOWN

Response status : No precise diagnosis = 0x6F00

See Also:
Constant Field Values

SW_FILE_FULL

static final short SW_FILE_FULL

Response status : Not enough memory space in the file = 0x6A84

See Also:
Constant Field Values

SW_LOGICAL_CHANNEL_NOT_SUPPORTED

static final short SW_LOGICAL_CHANNEL_NOT_SUPPORTED

Response status : Card does not support the operation on the specified
 logical channel = 0x6881

See Also:
Constant Field Values

SW_SECURE_MESSAGING_NOT_SUPPORTED

static final short SW_SECURE_MESSAGING_NOT_SUPPORTED

Response status : Card does not support secure messaging = 0x6882

See Also:
Constant Field Values

SW_WARNING_STATE_UNCHANGED

static final short SW_WARNING_STATE_UNCHANGED

Response status : Warning, card state unchanged = 0x6200

See Also:
Constant Field Values

SW_LAST_COMMAND_EXPECTED

static final short SW_LAST_COMMAND_EXPECTED

Response status : Last command in chain expected = 0x6883

See Also:
Constant Field Values

SW_COMMAND_CHAINING_NOT_SUPPORTED

static final short SW_COMMAND_CHAINING_NOT_SUPPORTED

Response status : Command chaining not supported = 0x6884

See Also:
Constant Field Values

OFFSET_CLA

static final byte OFFSET_CLA

APDU header offset : CLA = 0

See Also:
Constant Field Values

OFFSET_INS

static final byte OFFSET_INS

APDU header offset : INS = 1

See Also:
Constant Field Values

OFFSET_P1

static final byte OFFSET_P1

APDU header offset : P1 = 2

See Also:
Constant Field Values

OFFSET_P2

static final byte OFFSET_P2

APDU header offset : P2 = 3

See Also:
Constant Field Values

OFFSET_LC

static final byte OFFSET_LC

APDU header offset : LC = 4

See Also:
Constant Field Values

OFFSET_CDATA

static final byte OFFSET_CDATA

APDU command data offset : CDATA = 5

See Also:
Constant Field Values

OFFSET_EXT_CDATA

static final byte OFFSET_EXT_CDATA

APDU command data offset with extended length input data : EXT_CDATA = 7

See Also:
Constant Field Values

CLA_ISO7816

static final byte CLA_ISO7816

APDU command CLA : ISO 7816 = 0x00

See Also:
Constant Field Values

INS_SELECT

static final byte INS_SELECT

APDU command INS : SELECT = 0xA4

See Also:
Constant Field Values

INS_EXTERNAL_AUTHENTICATE

static final byte INS_EXTERNAL_AUTHENTICATE

APDU command INS : EXTERNAL AUTHENTICATE = 0x82

See Also:
Constant Field Values

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.


text:
@if not defined _echo @echo off
setlocal
set rid=win10-x64

:Arg_Loop
if "%1" == ""          goto ArgsDone
if /i "%1" == "-?"     goto Usage
if /i "%1" == "-h"     goto Usage
if /i "%1" == "-help"  goto Usage
if /i "%1" == "clone"  (set doClone=1&shift&goto Arg_Loop)
if /i "%1" == "x64"    (set rid=win10-x64&shift&goto Arg_Loop)
if /i "%1" == "x86"    (set rid=win10-x86&shift&goto Arg_Loop)

goto Usage

:ArgsDone

if defined doCLone (
    git clone --recursive https://github.com/mono/linker
)

pushd linker\corebuild
call restore.cmd -r %rid%
cd ..\linker
..\corebuild\Tools\dotnetcli\dotnet.exe publish -r %rid% -c netcore_Release
popd

echo Built %cd%\linker\linker\bin\netcore_Release\netcoreapp2.0\%rid%\publish\illink.exe

:Done
exit /b 0

:Usage
echo.
echo.Build ILLINKer for CoreCLR testing
echo.
echo.Usage:
echo     build_illink.cmd [clone] [setenv] [arch]
echo.Where:
echo.-? -h -help: view this message.
echo.clone      : Clone the repository https://github.com/mono/linker
echo.arch       : The architecture to build: x64 (default) or x86
echo.
goto Done


text:
Timeout on handling requests

<tt>daemon_timeout</tt>

This parameter specifies how much time a daemon may take to handle a request
before it assumes it is wedged and commits suicide.


text:
kops is kubernetes ops

### Synopsis

kops is kubernetes ops.
It allows you to create, destroy, upgrade and maintain clusters.

### Options

```
      --alsologtostderr                  log to standard error as well as files
      --config string                    config file (default is $HOME/.kops.yaml)
      --log_backtrace_at traceLocation   when logging hits line file:N, emit a stack trace (default :0)
      --log_dir string                   If non-empty, write log files in this directory
      --logtostderr                      log to standard error instead of files (default false)
      --name string                      Name of cluster
      --state string                     Location of state storage
      --stderrthreshold severity         logs at or above this threshold go to stderr (default 2)
  -v, --v Level                          log level for V logs
      --vmodule moduleSpec               comma-separated list of pattern=N settings for file-filtered logging
```

### SEE ALSO
* [kops completion](kops_completion.md)	 - Output shell completion code for the given shell (bash or zsh).
* [kops create](kops_create.md)	 - Create a resource by filename or stdin.
* [kops delete](kops_delete.md)	 - Delete clusters and instancegroups
* [kops describe](kops_describe.md)	 - Get additional information about cloud resources.
* [kops edit](kops_edit.md)	 - Edit clusters and other resrouces.
* [kops export](kops_export.md)	 - Exports a kubecfg for target cluster.
* [kops get](kops_get.md)	 - List all instances of a resource.
* [kops import](kops_import.md)	 - Import existing resources into the state store.
* [kops replace](kops_replace.md)	 - Replace a resource by filename or stdin.
* [kops rolling-update](kops_rolling-update.md)	 - Initiate rolling updates on clusters.
* [kops secrets](kops_secrets.md)	 - Manage secrets & keys.
* [kops toolbox](kops_toolbox.md)	 - Misc infrequently used commands.
* [kops update](kops_update.md)	 - Creates or updates cloud resources to match cluster spec.
* [kops upgrade](kops_upgrade.md)	 - Automates checking for and applying Kubernetes updates.
* [kops validate](kops_validate.md)	 - Run validation check on Kubernetes cluster.
* [kops version](kops_version.md)	 - Print the client version information.


text:
package com.github.costinm.dmesh.android.msg;

import android.os.Message;

/**
 * Interface for processing incoming messages. Register with 'subscribe(prefix, handler).
 * Any message, local or received from remote, will result in a call.
 * <p>
 * Used to be Handler.Callback - but it's harder to search for usages and gets confusing.
 */
public interface MessageHandler {

    /**
     * @param topic
     * @param msgType
     * @param m       the actual message. The Bundle has the parsed metadata.
     * @param replyTo null if the message was generated locally.
     */
    void handleMessage(String topic, String msgType, Message m, MsgConn replyTo, String[] args);
}


text:
package cgotest

import (
	"fmt"
	"os"
	"runtime"
	"sort"
	"strings"
	"syscall"
	"testing"
)

// #include <stdio.h>
// #include <stdlib.h>
// #include <pthread.h>
// #include <unistd.h>
// #include <sys/types.h>
//
// pthread_t *t = NULL;
// pthread_mutex_t mu;
// int nts = 0;
// int all_done = 0;
//
// static void *aFn(void *vargp) {
//   int done = 0;
//   while (!done) {
//     usleep(100);
//     pthread_mutex_lock(&mu);
//     done = all_done;
//     pthread_mutex_unlock(&mu);
//   }
//   return NULL;
// }
//
// void trial(int argc) {
//   int i;
//   nts = argc;
//   t = calloc(nts, sizeof(pthread_t));
//   pthread_mutex_init(&mu, NULL);
//   for (i = 0; i < nts; i++) {
//     pthread_create(&t[i], NULL, aFn, NULL);
//   }
// }
//
// void cleanup(void) {
//   int i;
//   pthread_mutex_lock(&mu);
//   all_done = 1;
//   pthread_mutex_unlock(&mu);
//   for (i = 0; i < nts; i++) {
//     pthread_join(t[i], NULL);
//   }
//   pthread_mutex_destroy(&mu);
//   free(t);
// }
import "C"

// compareStatus is used to confirm the contents of the thread
// specific status files match expectations.
func compareStatus(filter, expect string) error {
	expected := filter + expect
	pid := syscall.Getpid()
	fs, err := os.ReadDir(fmt.Sprintf("/proc/%d/task", pid))
	if err != nil {
		return fmt.Errorf("unable to find %d tasks: %v", pid, err)
	}
	expectedProc := fmt.Sprintf("Pid:\t%d", pid)
	foundAThread := false
	for _, f := range fs {
		tf := fmt.Sprintf("/proc/%s/status", f.Name())
		d, err := os.ReadFile(tf)
		if err != nil {
			// There are a surprising number of ways this
			// can error out on linux.  We've seen all of
			// the following, so treat any error here as
			// equivalent to the "process is gone":
			//    os.IsNotExist(err),
			//    "... : no such process",
			//    "... : bad file descriptor.
			continue
		}
		lines := strings.Split(string(d), "\n")
		for _, line := range lines {
			// Different kernel vintages pad differently.
			line = strings.TrimSpace(line)
			if strings.HasPrefix(line, "Pid:\t") {
				// On loaded systems, it is possible
				// for a TID to be reused really
				// quickly. As such, we need to
				// validate that the thread status
				// info we just read is a task of the
				// same process PID as we are
				// currently running, and not a
				// recently terminated thread
				// resurfaced in a different process.
				if line != expectedProc {
					break
				}
				// Fall through in the unlikely case
				// that filter at some point is
				// "Pid:\t".
			}
			if strings.HasPrefix(line, filter) {
				if line == expected {
					foundAThread = true
					break
				}
				if filter == "Groups:" && strings.HasPrefix(line, "Groups:\t") {
					// https://github.com/golang/go/issues/46145
					// Containers don't reliably output this line in sorted order so manually sort and compare that.
					a := strings.Split(line[8:], " ")
					sort.Strings(a)
					got := strings.Join(a, " ")
					if got == expected[8:] {
						foundAThread = true
						break
					}

				}
				return fmt.Errorf("%q got:%q want:%q (bad) [pid=%d file:'%s' %v]\n", tf, line, expected, pid, string(d), expectedProc)
			}
		}
	}
	if !foundAThread {
		return fmt.Errorf("found no thread /proc/<TID>/status files for process %q", expectedProc)
	}
	return nil
}

// test1435 test 9 glibc implemented setuid/gid syscall functions are
// mapped.  This test is a slightly more expansive test than that of
// src/syscall/syscall_linux_test.go:TestSetuidEtc() insofar as it
// launches concurrent threads from C code via CGo and validates that
// they are subject to the system calls being tested. For the actual
// Go functionality being tested here, the syscall_linux_test version
// is considered authoritative, but non-trivial improvements to that
// should be mirrored here.
func test1435(t *testing.T) {
	if syscall.Getuid() != 0 {
		t.Skip("skipping root only test")
	}
	if runtime.GOOS == "linux" {
		if _, err := os.Stat("/etc/alpine-release"); err == nil {
			t.Skip("skipping failing test on alpine - go.dev/issue/19938")
		}
	}

	// Launch some threads in C.
	const cts = 5
	C.trial(cts)
	defer C.cleanup()

	vs := []struct {
		call           string
		fn             func() error
		filter, expect string
	}{
		{call: "Setegid(1)", fn: func() error { return syscall.Setegid(1) }, filter: "Gid:", expect: "\t0\t1\t0\t1"},
		{call: "Setegid(0)", fn: func() error { return syscall.Setegid(0) }, filter: "Gid:", expect: "\t0\t0\t0\t0"},

		{call: "Seteuid(1)", fn: func() error { return syscall.Seteuid(1) }, filter: "Uid:", expect: "\t0\t1\t0\t1"},
		{call: "Setuid(0)", fn: func() error { return syscall.Setuid(0) }, filter: "Uid:", expect: "\t0\t0\t0\t0"},

		{call: "Setgid(1)", fn: func() error { return syscall.Setgid(1) }, filter: "Gid:", expect: "\t1\t1\t1\t1"},
		{call: "Setgid(0)", fn: func() error { return syscall.Setgid(0) }, filter: "Gid:", expect: "\t0\t0\t0\t0"},

		{call: "Setgroups([]int{0,1,2,3})", fn: func() error { return syscall.Setgroups([]int{0, 1, 2, 3}) }, filter: "Groups:", expect: "\t0 1 2 3"},
		{call: "Setgroups(nil)", fn: func() error { return syscall.Setgroups(nil) }, filter: "Groups:", expect: ""},
		{call: "Setgroups([]int{0})", fn: func() error { return syscall.Setgroups([]int{0}) }, filter: "Groups:", expect: "\t0"},

		{call: "Setregid(101,0)", fn: func() error { return syscall.Setregid(101, 0) }, filter: "Gid:", expect: "\t101\t0\t0\t0"},
		{call: "Setregid(0,102)", fn: func() error { return syscall.Setregid(0, 102) }, filter: "Gid:", expect: "\t0\t102\t102\t102"},
		{call: "Setregid(0,0)", fn: func() error { return syscall.Setregid(0, 0) }, filter: "Gid:", expect: "\t0\t0\t0\t0"},

		{call: "Setreuid(1,0)", fn: func() error { return syscall.Setreuid(1, 0) }, filter: "Uid:", expect: "\t1\t0\t0\t0"},
		{call: "Setreuid(0,2)", fn: func() error { return syscall.Setreuid(0, 2) }, filter: "Uid:", expect: "\t0\t2\t2\t2"},
		{call: "Setreuid(0,0)", fn: func() error { return syscall.Setreuid(0, 0) }, filter: "Uid:", expect: "\t0\t0\t0\t0"},

		{call: "Setresgid(101,0,102)", fn: func() error { return syscall.Setresgid(101, 0, 102) }, filter: "Gid:", expect: "\t101\t0\t102\t0"},
		{call: "Setresgid(0,102,101)", fn: func() error { return syscall.Setresgid(0, 102, 101) }, filter: "Gid:", expect: "\t0\t102\t101\t102"},
		{call: "Setresgid(0,0,0)", fn: func() error { return syscall.Setresgid(0, 0, 0) }, filter: "Gid:", expect: "\t0\t0\t0\t0"},

		{call: "Setresuid(1,0,2)", fn: func() error { return syscall.Setresuid(1, 0, 2) }, filter: "Uid:", expect: "\t1\t0\t2\t0"},
		{call: "Setresuid(0,2,1)", fn: func() error { return syscall.Setresuid(0, 2, 1) }, filter: "Uid:", expect: "\t0\t2\t1\t2"},
		{call: "Setresuid(0,0,0)", fn: func() error { return syscall.Setresuid(0, 0, 0) }, filter: "Uid:", expect: "\t0\t0\t0\t0"},
	}

	for i, v := range vs {
		if err := v.fn(); err != nil {
			t.Errorf("[%d] %q failed: %v", i, v.call, err)
			continue
		}
		if err := compareStatus(v.filter, v.expect); err != nil {
			t.Errorf("[%d] %q comparison: %v", i, v.call, err)
		}
	}
}


text:
import React from 'react'

import { storiesOf } from '@storybook/react'
import { withKnobs, number, text } from '@storybook/addon-knobs'

import ProgressDonut from './component'

const stories = storiesOf('ProgressDonut', module)
stories.addDecorator(withKnobs)

stories.add('default', () =>
  (<ProgressDonut
    baseTitle={text('Base Title', 'Grounds')}
    goal={number('Goal', 92)}
    achieved={number('Achieved', 83)}
  />),
)

stories.add('all options', () =>
  (<ProgressDonut
    baseTitle={text('Base Title', 'Grounds')}
    goal={number('Goal', 92)}
    achieved={number('Achieved', 83)}
    strokeWidth={number('strokeWidth', 15)}
    width={number('width', 150)}
    height={number('height', 150)}
    resultsColor={text('resultsColor', 'green')}
    baseColor={text('baseColor', 'gray')}
  />),
)

stories.add('complete', () => <ProgressDonut baseTitle="Grounds" goal={92} achieved={92} />)


text:
"""Get list of user's scheduled tasks as a table with columns:
id, interval, at (hour:minute/minute past), status (enabled/disabled), command.

Usage:
  pa_get_scheduled_tasks_list.py [--format TABLEFMT]

Options:
  -h, --help                  Prints this message
  -f, --format TABLEFMT       Sets table format supported by tabulate
                              (defaults to 'simple')

Note:
  This script provides an overview of all tasks. Once a task id is
  known and some specific data is required it's more convenient to get
  it using `pa_get_scheduled_task_specs.py` script instead of parsing
  the table."""

from docopt import docopt
from tabulate import tabulate

from pythonanywhere.scripts_commons import ScriptSchema, get_logger
from pythonanywhere.snakesay import snakesay
from pythonanywhere.task import TaskList

def main(tablefmt):
    logger = get_logger(set_info=True)
    headers = "id", "interval", "at", "status", "command"
    attrs = "task_id", "interval", "printable_time", "enabled", "command"

    def get_right_value(task, attr):
        value = getattr(task, attr)
        if attr == "enabled":
            value = "enabled" if value else "disabled"
        return value

    table = [[get_right_value(task, attr) for attr in attrs] for task in TaskList().tasks]
    msg = tabulate(table, headers, tablefmt=tablefmt) if table else snakesay("No scheduled tasks")
    logger.info(msg)

if __name__ == "__main__":
    schema = ScriptSchema({"--format": ScriptSchema.tabulate_format})
    argument = schema.validate_user_input(docopt(__doc__))

    main(argument.get("format", "simple"))


text:
layout: page
title: Powell Pearl Trade Show
date: 2016-05-24
author: Nancy Davila
tags: weekly links, java
status: published
summary: Donec dictum id massa id feugiat. Vivamus.
banner: images/banner/office-01.jpg
booking:
  startDate: 04/16/2019
  endDate: 04/18/2019
  ctyhocn: REXHAHX
  groupCode: PPTS
published: true
---
Morbi velit quam, tincidunt consequat eros id, feugiat ullamcorper neque. Nullam vel hendrerit velit. Aliquam non egestas diam. Phasellus iaculis dignissim felis id faucibus. Nullam at vestibulum erat. Donec tincidunt non sem vel ultrices. Suspendisse rutrum ut eros et dignissim. Nunc enim velit, feugiat a ultricies id, mattis sagittis urna. Curabitur mi purus, congue suscipit quam id, consectetur aliquam dolor. In interdum condimentum ipsum, at bibendum massa ullamcorper in.

* Quisque consectetur neque nec velit malesuada, a sodales leo faucibus
* Sed posuere purus quis ullamcorper luctus
* Aliquam vestibulum purus eget mi aliquet lacinia.

Nunc tristique ipsum iaculis, lacinia urna eget, mattis risus. Vivamus rhoncus nec quam ac luctus. Aliquam sagittis malesuada pulvinar. Sed fermentum ligula vitae luctus consectetur. Proin sed consequat felis. Fusce a convallis ligula. Donec viverra tempor tortor id congue. Nunc auctor nibh nec maximus fermentum. Sed sed mi mauris. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec porttitor condimentum purus egestas dapibus. Mauris sagittis libero metus, ac finibus ex tristique volutpat. Phasellus eros ex, interdum nec risus sit amet, mattis tincidunt urna. Phasellus malesuada lacus a metus malesuada, at dapibus nisl cursus. Nullam eu rhoncus leo. Sed rhoncus in arcu a egestas. Phasellus interdum tincidunt dictum. Etiam vehicula lectus id nulla tempus venenatis. Nam eu erat eu arcu venenatis interdum sagittis at eros. Nulla et libero ac ante maximus egestas.


text:
package com.xorlev.gatekeeper.handler;

import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;
import com.xorlev.gatekeeper.AppConfig;
import com.xorlev.gatekeeper.data.Cluster;
import com.xorlev.gatekeeper.events.ConfigChangedEvent;
import com.xorlev.gatekeeper.data.Location;
import com.xorlev.gatekeeper.events.ClustersUpdatedEvent;
import com.xorlev.gatekeeper.events.ConfigWrittenEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.inject.Inject;
import java.io.IOException;
import java.util.List;

public class ConfigurationChangedEventHandler {
    private static final Logger log = LoggerFactory.getLogger(ConfigurationChangedEventHandler.class);
    private final ConfigWriter configWriter;
    private final EventBus eventBus;

    @Inject
    public ConfigurationChangedEventHandler(EventBus eventBus, ConfigWriter configWriter) {
        this.configWriter = configWriter;
        this.eventBus = eventBus;
    }

    @Subscribe
    public void regenerateConfiguration(ClustersUpdatedEvent event) {
        ConfigChangedEvent configChangedEvent = buildConfigContext(event.getClusters());

        try {
            configWriter.writeConfig(configChangedEvent);
        } catch (IOException e) {
            log.error("Failed to write config, {}", e.getMessage(), e);
        }

        eventBus.post(new ConfigWrittenEvent(event));
    }

    private ConfigChangedEvent buildConfigContext(List<Cluster> clusters) {
        ConfigChangedEvent configChangedEvent = new ConfigChangedEvent(clusters);

        for (Cluster cluster : clusters) {
            log.info("({}) Locating contexts for {}://{}:{}, {} servers in group",
                    cluster.getClusterName(), cluster.getProtocol(), cluster.getClusterName(), cluster.getPort(),
                    cluster.getServers().size());

            for (String context : AppConfig.getStringList("cluster." + cluster.getClusterName() + ".context")) {
                log.info("({}) Adding context=[{}]", cluster.getClusterName(), context);
                configChangedEvent.getLocations().add(new Location(context, cluster));
            }
        }
        return configChangedEvent;
    }
}


text:
using System;
using System.Collections;
using System.Runtime.InteropServices;
#if DSHOWNET
using DShowNET;
using DShowNET.Device;
using System.Runtime.InteropServices.ComTypes;
#else
#if VS2003
#else
using System.Runtime.InteropServices.ComTypes;
#endif
using DirectShowLib;
#endif

namespace DirectX.Capture
{
	///
	///  Represents a DirectShow filter (e.g. video capture device,
	///  compression codec).
	///
	/// <remarks>
	///  To save a chosen filer for later recall
	///  save the MonikerString property on the filter:
	///

	///   string savedMonikerString = myFilter.MonikerString;
	///

	///
	///  To recall the filter create a new Filter class and pass the
	///  string to the constructor:
	///

	///   Filter mySelectedFilter = new Filter( savedMonikerString );
	///

	/// </remarks>
	public class Filter : IComparable
	{
		///  Human-readable name of the filter
		public string Name;

		///  Unique string referencing this filter. This string can be used to recreate this filter.
		public string MonikerString;

		///  Create a new filter from its moniker string.
		public Filter( string monikerString )
		{
			Name = getName( monikerString );
			MonikerString = monikerString;
		}

		///  Create a new filter from its moniker
#if DSHOWNET
		internal Filter(IMoniker moniker )
#else
#if VS2003
		internal Filter(UCOMIMoniker moniker )
#else
        internal Filter(IMoniker moniker)
#endif
#endif
		{
			Name = getName( moniker );
			MonikerString = getMonikerString( moniker );
		}

		///  Retrieve the a moniker's display name (i.e. it's unique string)
#if DSHOWNET
		protected string getMonikerString(IMoniker moniker)
#else
#if VS2003
		protected string getMonikerString(UCOMIMoniker moniker)
#else
		protected string getMonikerString(IMoniker moniker)
#endif
#endif
		{
			string s;
			moniker.GetDisplayName( null, null, out s );
			return( s );
		}

		///  Retrieve the human-readable name of the filter
#if DSHOWNET
		protected string getName(IMoniker moniker)
#else
#if VS2003
		protected string getName(UCOMIMoniker moniker)
#else
		protected string getName(IMoniker moniker)
#endif
#endif
		{
			object bagObj = null;
			IPropertyBag bag = null;
			try
			{
				Guid bagId = typeof( IPropertyBag ).GUID;
				moniker.BindToStorage( null, null, ref bagId, out bagObj );
				bag = (IPropertyBag) bagObj;
				object val = "";
#if DSHOWNET
				int hr = bag.Read( "FriendlyName", ref val, IntPtr.Zero );
#else
                int hr = bag.Read("FriendlyName", out val, null);
#endif
				if( hr != 0 )
					Marshal.ThrowExceptionForHR( hr );
				string ret = val as string;
				if( (ret == null) || (ret.Length < 1) )
					throw new NotImplementedException( "Device FriendlyName" );
				return( ret );
			}
			catch( Exception )
			{
				return( "" );
			}
			finally
			{
				bag = null;
				if( bagObj != null )
					Marshal.ReleaseComObject( bagObj ); bagObj = null;
			}
		}

		///  Get a moniker's human-readable name based on a moniker string.
		protected string getName(string monikerString)
		{
#if DSHOWNET
			IMoniker parser = null;
			IMoniker moniker = null;
#else
#if VS2003
			UCOMIMoniker parser = null;
			UCOMIMoniker moniker = null;
#else
            IMoniker parser = null;
            IMoniker moniker = null;
#endif
#endif
			try
			{
				parser = getAnyMoniker();
				int eaten;
				parser.ParseDisplayName( null, null, monikerString, out eaten, out moniker );
				return( getName( parser ) );
			}
			finally
			{
				if ( parser != null )
					Marshal.ReleaseComObject( parser ); parser = null;
				if ( moniker != null )
					Marshal.ReleaseComObject( moniker ); moniker = null;
			}
		}

		///
		///  This method gets a UCOMIMoniker object.
		///
		///  HACK: The only way to create a UCOMIMoniker from a moniker
		///  string is to use UCOMIMoniker.ParseDisplayName(). So I
		///  need ANY UCOMIMoniker object so that I can call
		///  ParseDisplayName(). Does anyone have a better solution?
		///
		///  This assumes there is at least one video compressor filter
		///  installed on the system.
		///
#if DSHOWNET
		protected IMoniker getAnyMoniker()
#else
#if VS2003
		protected UCOMIMoniker getAnyMoniker()
#else
        protected IMoniker getAnyMoniker()
#endif
#endif
		{
			Guid				category = FilterCategory.VideoCompressorCategory;
			int					hr;
			object				comObj = null;
			ICreateDevEnum		enumDev = null;
#if DSHOWNET
			IEnumMoniker	enumMon = null;
			IMoniker[]		mon = new IMoniker[1];
#else
#if VS2003
			UCOMIEnumMoniker	enumMon = null;
			UCOMIMoniker[]		mon = new UCOMIMoniker[1];
#else
            IEnumMoniker enumMon = null;
            IMoniker[] mon = new IMoniker[1];
#endif
#endif

			try
			{
				// Get the system device enumerator
#if DSHOWNET
				Type srvType = Type.GetTypeFromCLSID( Clsid.SystemDeviceEnum );
				if( srvType == null )
					throw new NotImplementedException( "System Device Enumerator" );
				comObj = Activator.CreateInstance( srvType );
				enumDev = (ICreateDevEnum) comObj;

				// Create an enumerator to find filters in category
				hr = enumDev.CreateClassEnumerator( ref category, out enumMon, 0 );
#else
                // Get the system device enumerator
                enumDev = (ICreateDevEnum)new DirectShowLib.CreateDevEnum();

                // Create an enumerator to find filters in category
                hr = enumDev.CreateClassEnumerator(category, out enumMon, CDef.None);
#endif
				if( hr != 0 )
					throw new NotSupportedException( "No devices of the category" );

				// Get first filter
#if DSHOWNET
				IntPtr f=IntPtr.Zero;
				hr = enumMon.Next( 1, mon, f );
#else
#if VS2003
				int f;
				hr = enumMon.Next( 1, mon, out f );
#else
                IntPtr f = IntPtr.Zero;
                hr = enumMon.Next(1, mon, f);
#endif
#endif
				if( (hr != 0) )
					mon[0] = null;

				return( mon[0] );
			}
			finally
			{
				enumDev = null;
				if( enumMon != null )
					Marshal.ReleaseComObject( enumMon ); enumMon = null;
				if( comObj != null )
					Marshal.ReleaseComObject( comObj ); comObj = null;
			}
		}

		///
		///  Compares the current instance with another object of
		///  the same type.
		///
		public int CompareTo(object obj)
		{
			if ( obj == null )
				return( 1 );
			Filter f = (Filter) obj;
			return( this.Name.CompareTo( f.Name ) );
		}

	}
}


text:
<?php

namespace PHPStrongV\Types;
use PHPStrongV as f;
use PHPStrongV\Types\SVNumber as SVNumber;
use PHPStrongV\Helpers\PHPStrongVManager as PHPStrongVManager;

class SVInt extends SVNumber
{
    /**
     * @ignore
     */
    const CLASS_NAME = 'PHPStrongV\Types\SVInt';

    /**
     * @ignore
     */
    protected static $MIN_VALUE = -2147483648;

    /**
     * (2^32)/2 - 1 (containing 0)
     * @ignore
     */
    protected static $MAX_VALUE = 2147483647;

    /**
     * Sets $value as the new value and returns the updated instance.
     * @param integer|SVInt|SVInt32 $value
     */
    public function set ($value) {
        if ($value instanceof self) {
            $val = $value->val();
            if ($val >= static::$MIN_VALUE && $val <= static::$MAX_VALUE)
                $this->value = $val;
            else
                throw new Exception('Value is out of bounds');
        }
        else if (static::isValid($value))
            $this->value = $value;
        else
            throw new Exception (
                'Value is not an integer or value is out of bounds');

        return $this;
    }

    public static function minValue() {
        return static::$MIN_VALUE;
    }

    public static function maxValue() {
        return static::$MAX_VALUE;
    }

    /**
     * Parses the supplied value to check if a 32 bit signed integer and returns
     * a new SVInt.
     * @param  mixed $value
     * @throws Exception if the supplied value is not a signed 32 bit integer.
     */
    public static function &parse ($value) {
        if (is_numeric($value) &&
            $value >= static::$MIN_VALUE &&
            $value <= static::$MAX_VALUE) {
            $factoryMethod = get_called_class();
            //$class = strtolower(end(explode('\\', $factoryMethod)));
            //$factoryMethod = strtolower(get_called_class());
            //$class = 'PHPStrongV\\' . $class;

            // Make the string number a normal number
            //echo $factoryMethod;
            //return $factoryMethod(0 + $value);
            $r = new $factoryMethod(0 + $value);
            return PHPStrongVManager::getNewPointer($r);
        }
        else {
            throw new Exception (
                'Value cannot be casted to integer or value is out of bounds');
        }
    }

    /**
     * Checks if the supplied value if a signed 32 bit integer.
     * @param  mixed $value
     */
    public static function isValid($value) {
        $type = gettype($value);
        $isNum = ($type === 'integer' || $type === 'double');
        if ($isNum &&
            $value >= static::$MIN_VALUE &&
            $value <= static::$MAX_VALUE)
            return true;
        else
            return false;
    }
}


text:
/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author Tobias Koppers @sokra
*/
function CommonsChunkPlugin(options, filenameTemplate, selectedChunks, minChunks) {
	if(options && typeof options === "object" && !Array.isArray(options)) {
		this.chunkNames = options.name || options.names;
		this.filenameTemplate = options.filename;
		this.minChunks = options.minChunks;
		this.selectedChunks = options.chunks;
		if(options.children) this.selectedChunks = false;
		this.async = options.async;
		this.minSize = options.minSize;
	} else {
		var chunkNames = options;
		if(typeof filenameTemplate !== "string" && filenameTemplate !== null) {
			minChunks = selectedChunks;
			selectedChunks = filenameTemplate;
			filenameTemplate = chunkNames;
		}
		if(!Array.isArray(selectedChunks) && typeof selectedChunks !== "boolean" && selectedChunks !== null) {
			minChunks = selectedChunks;
			selectedChunks = undefined;
		}
		this.chunkNames = chunkNames;
		this.filenameTemplate = filenameTemplate;
		this.minChunks = minChunks;
		this.selectedChunks = selectedChunks;
	}
}
module.exports = CommonsChunkPlugin;
CommonsChunkPlugin.prototype.apply = function(compiler) {
	var chunkNames = this.chunkNames;
	var filenameTemplate = this.filenameTemplate;
	var minChunks = this.minChunks;
	var selectedChunks = this.selectedChunks;
	var async = this.async;
	var minSize = this.minSize;
	compiler.plugin("this-compilation", function(compilation) {
		compilation.plugin(["optimize-chunks", "optimize-extracted-chunks"], function(chunks) {
			var commonChunks;
			if(!chunkNames && (selectedChunks === false || async)) {
				commonChunks = chunks;
			} else if(Array.isArray(chunkNames)) {
				commonChunks = chunkNames.map(function(chunkName) {
					return chunks.filter(function(chunk) {
						return chunk.name === chunkName;
					})[0];
				});
			} else {
				commonChunks = chunks.filter(function(chunk) {
					return chunk.name === chunkNames;
				});
			}
			if(commonChunks.length === 0) {
				var chunk = this.addChunk(chunkNames);
				chunk.initial = chunk.entry = true;
				commonChunks = [chunk];
			}
			commonChunks.forEach(function processCommonChunk(commonChunk, idx) {
				var commonModulesCount = [];
				var commonModules = [];
				var usedChunks;
				if(Array.isArray(selectedChunks)) {
					usedChunks = chunks.filter(function(chunk) {
						if(chunk === commonChunk) return false;
						return selectedChunks.indexOf(chunk.name) >= 0;
					});
				} else if(selectedChunks === false || async) {
					usedChunks = (commonChunk.chunks || []).filter(function(chunk) {
						// we can only move modules from this chunk if the "commonChunk" is the only parent
						return async || chunk.parents.length === 1;
					});
				} else {
					if(!commonChunk.entry) {
						compilation.errors.push(new Error("CommonsChunkPlugin: While running in normal mode it's not allowed to use a non-entry chunk (" + commonChunk.name + ")"));
						return;
					}
					usedChunks = chunks.filter(function(chunk) {
						var found = commonChunks.indexOf(chunk);
						if(found >= idx) return false;
						return chunk.entry;
					});
				}
				if(async) {
					var asyncChunk = this.addChunk(typeof async === "string" ? async : undefined);
					asyncChunk.chunkReason = "async commons chunk";
					asyncChunk.extraAsync = true;
					asyncChunk.addParent(commonChunk);
					commonChunk.addChunk(asyncChunk);
					commonChunk = asyncChunk;
				}
				usedChunks.forEach(function(chunk) {
					chunk.modules.forEach(function(module) {
						var idx = commonModules.indexOf(module);
						if(idx < 0) {
							commonModules.push(module);
							commonModulesCount.push(1);
						} else {
							commonModulesCount[idx]++;
						}
					});
				});
				var reallyUsedChunks = [];
				var reallyUsedModules = [];
				commonModulesCount.forEach(function(count, idx) {
					var module = commonModules[idx];
					if(typeof minChunks === "function") {
						if(!minChunks(module, count))
							return;
					} else if(count < (minChunks || Math.max(2, usedChunks.length))) {
						return;
					}
					reallyUsedModules.push(module);
				});
				if(minSize) {
					var size = reallyUsedModules.reduce(function(a, b) {
						return a + b.size();
					}, 0);
					if(size < minSize)
						return;
				}
				reallyUsedModules.forEach(function(module) {
					usedChunks.forEach(function(chunk) {
						if(module.removeChunk(chunk)) {
							if(reallyUsedChunks.indexOf(chunk) < 0)
								reallyUsedChunks.push(chunk);
						}
					});
					commonChunk.addModule(module);
					module.addChunk(commonChunk);
				});
				if(async) {
					reallyUsedChunks.forEach(function(chunk) {
						if(chunk.initial || chunk.entry)
							return;
						chunk.blocks.forEach(function(block) {
							block.chunks.unshift(commonChunk);
							commonChunk.addBlock(block);
						});
					});
					asyncChunk.origins = reallyUsedChunks.map(function(chunk) {
						return chunk.origins.map(function(origin) {
							var newOrigin = Object.create(origin);
							newOrigin.reasons = (origin.reasons || []).slice();
							newOrigin.reasons.push("async commons");
							return newOrigin;
						});
					}).reduce(function(arr, a) { arr.push.apply(arr, a); return arr; }, []);
				} else {
					usedChunks.forEach(function(chunk) {
						chunk.parents = [commonChunk];
						commonChunk.chunks.push(chunk);
						if(chunk.initial)
							commonChunk.initial = true;
						if(chunk.entry) {
							commonChunk.entry = true;
							chunk.entry = false;
						}
					});
				}
				if(filenameTemplate)
					commonChunk.filenameTemplate = filenameTemplate;
			}, this);
		});
	});
};


text:
@interface NSFileAccessIntent (TFEasyCoder)

//superclass pros NSObject
-(NSFileAccessIntent  *(^)(NSArray *  accessibilityElements))set_accessibilityElements;
-(NSFileAccessIntent  *(^)(NSArray *  accessibilityCustomActions))set_accessibilityCustomActions;
-(NSFileAccessIntent  *(^)(BOOL  isAccessibilityElement))set_isAccessibilityElement;
-(NSFileAccessIntent  *(^)(NSString *  accessibilityLabel))set_accessibilityLabel;
-(NSFileAccessIntent  *(^)(NSString *  accessibilityHint))set_accessibilityHint;
-(NSFileAccessIntent  *(^)(NSString *  accessibilityValue))set_accessibilityValue;
-(NSFileAccessIntent  *(^)(unsigned long long  accessibilityTraits))set_accessibilityTraits;
-(NSFileAccessIntent  *(^)(UIBezierPath *  accessibilityPath))set_accessibilityPath;
-(NSFileAccessIntent  *(^)(CGPoint  accessibilityActivationPoint))set_accessibilityActivationPoint;
-(NSFileAccessIntent  *(^)(NSString *  accessibilityLanguage))set_accessibilityLanguage;
-(NSFileAccessIntent  *(^)(BOOL  accessibilityElementsHidden))set_accessibilityElementsHidden;
-(NSFileAccessIntent  *(^)(BOOL  accessibilityViewIsModal))set_accessibilityViewIsModal;
-(NSFileAccessIntent  *(^)(BOOL  shouldGroupAccessibilityChildren))set_shouldGroupAccessibilityChildren;
-(NSFileAccessIntent  *(^)(long long  accessibilityNavigationStyle))set_accessibilityNavigationStyle;

@end


text:
require File.dirname(__FILE__) + '/../../../spec_helper'
require File.dirname(__FILE__) + '/shared/image'
require 'complex'

describe "Numeric#image" do
  it_behaves_like :numeric_image, :image
end


text:
<!DOCTYPE html>

<meta charset="UTF-8">
<title>MICROFORMATOS</title>

tipos de microformatos

el type del microformato

puede venir adosado a cualquier bloque de microformato, como
			si estuvieramos especificando la relacion

ficha
			empresarial

				Fernando
				Palacios Landi

			titulo de SEO, para la empresa
			oracle, como
			Chief Executive Officer

ficha de
			estudiante:

				Fernando
				Palacios Landi

			estudiante de  DAW, en el instituto
			francesc Borja Moll, como
			desasrrollador web

		direccion postal
		mateo fuiol 68
		son pereto
		la vileta
		palma de mallorca
		07013
		ES

		direccion de trabajo
		caracas
		es rafal
		palma de mallorca
		01254
		ES

microformatos de geolocalizacion

formateo con parrafos

			Lat: 207.999,
			Long: 548.999

formateo con listas de definicion

 Lat:

  207.999

 Long:

 548.999

señalando el contenido de un atributo

Hotel 5 estrellasRoc Illetas Playa,
	Paseo illetas 28, Palma de mallorca, España

microformatos de direcciones

		mateo fiol 68, barrio de
		son pereto,
		la vileta,
		palma de mallorca
		07013,
		ES

microfirmatos de personas

formateo solo del nombre

				Mr.
				Mario
				Alejandro
				Palacios Landi

formateo con nombre parcial

				Lord,
				marius

			Mario Palacios

formateo con nombre completo

				Mr.
				Mario
				Alejandro
				Palacios Landi
				Lord,

			marius

miccroformatos de direcciones

		Mario Palacios

microformato año de nacimiento

		Fernando Palacios, nacido el:
		<time datetime="1985-12-11" class="bday">11 de diciembre del 1985</time>

ficha personal

				Mr.
				Fernando
				Palacios Landi

				Lord
				nando

				titulo de SEO, para la empresa
				oracle, como
				Chief Executive Officer

			contacto
			<time datetime="1985-12-11" class="bday linea">11 de diciembre de 1985</time>

Web Directions North

A Web design and development
		conference in Vancouver.

		From <time datetime="2007/02/06" class="dtstart">Feb. 6th 2007</time>
		to <time datetime="2007/02/09" class="dtend">Feb. 8th 2007</time>

Renaissance Vancouver Hotel Harbourside

			<time class="dtstart" datetime="2006/09/28T10:15">10.15am</time>
			<time class="dtend" datetime="2006/09/28T10:45">10.45am</time>

		Morning tea

			mejorando la web

Los SEO de la agrupacion 'emprendedores
			de la web 3.0' nos deleitaran con los ultimmos avances en
			tecnologia de posicionamiento de contenido web y alimentaran
			nuestra necesidad por favorecer una web accesible a los motores de
			busqueda y triquiñuelas de las arañas de google para encontrar todo
			lo relacionado con nuestro contenido

			Lugar de encuentro: Aula Magna de conferencias de la UIB

				Palma de mallorca,
				España

			Cuando: <time datetime="2013/06/28">28 junio 2013</time> de
			<time class="dtstart" datetime="2013/06/28T10:15">10.15am</time> a
			<time class="dtend" datetime="2013/06/28T22:45">10.45pm</time>


text:
layout: posts
title:  "Análise Matricial de Estruturas - Um Sistema Computacional Orientado ao Ensino e Projetos Práticos"
date:   2017-02-17 16:16:01 -0600
categories: trabalho
autornick: corcioli
autor: "Caíque Roder Corcioli"
orientador: "Prof. Dr. Marco Antônio Rahal Sacoman"
---
Ao longo dos anos, o ensino e a aprendizagem de Análise Estrutural foram
baseados em técnicas e métodos aproximados, criados devido à falta de tecnologia
existente na época para que métodos exatos fossem utilizados, pois estes
envolvem cálculos sofisticados ou até mesmo exaustivos, não adequados para
solução manual, exceto para pequenos exemplos teóricos. Os conceitos necessários
para a formulação de métodos exatos existem há séculos graças à genialidade de
engenheiros, físicos e matemáticos que os desenvolveram e, talvez por
vislumbrarem que um dia existissem máquinas que pudessem resolver problemas
utilizando-os de forma rápida e eficiente. Esta máquina foi criada e passou a
ser utilizada de forma significativa a partir da década de 1950, mesmo que
considerada rudimentar se comparada aos atuais computadores. O objetivo deste
trabalho é fornecer um sistema computacional capaz de realizar toda a análise
estrutural, calculando os esforços e deformações de seis tipos de estruturas
reticuladas (viga contínua, treliça plana, pórtico plano, grelha, treliça
espacial e pórtico espacial) com a finalidade de ser utilizado para o ensino e
projetos práticos. Para a análise estrutural, utilizam-se os métodos da
flexibilidade e rigidez de forma matricial. Como resultado, os dados foram
obtidos de forma precisa com uma interface amigável, ou seja, de utilização
intuitiva. Destaca-se o fato do sistema computacional criado ser totalmente
gratuito, pois a grande maioria dos produtos existentes no mercado possui um
elevado preço, incompatível para a aquisição de um aluno. Desta forma, o sistema
computacional serve como uma ferramenta que auxilia no ensino e aprendizagem na
área de engenharia estrutural de forma didática e compreensível.

Palavras-chave: Análise matricial de estruturas. Estruturas reticuladas. Método
da flexibilidade. Método da rigidez. Matemática Computacional. Ensino. Projetos
práticos.


text:
"""Implements PageContent model"""

from __future__ import unicode_literals

from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _

from pages.models import Page
from pages.models.pagecontenttype import PageContentType

@python_2_unicode_compatible
class PageContent(models.Model):
    page = models.ForeignKey(Page, verbose_name=_('Page'))
    type = models.ForeignKey(PageContentType)
    objects = models.Manager()

    def __str__(self):
        """id string of instance"""
        return '{0}:{1}:{2}'.format(self.page, self.type, self.pk)

    def save(self, *args, **kwargs):
        """Override the default ``save`` method."""

        # Call parent's ``save`` method
        super(PageContent, self).save(*args, **kwargs)

    class Meta:
        app_label = 'pages'
        verbose_name = _('Content')
        verbose_name_plural = _('Content')
        unique_together = ('page', 'type',)


text:
include_recipe 'sysstat::default'

bash 'update_ulimit' do
  user 'root'
  cwd '/tmp'
  code <<-EOH
    echo '* hard nofile #{node['ulimit']}' >> /etc/security/limits.conf
    echo '* soft nofile #{node['ulimit']}' >> /etc/security/limits.conf
    sysctl -w fs.file-max=#{node['ulimit']}
    sysctl -p
  EOH
end

remote_file node['jq']['path'] do
  source node['jq']['url']
  owner 'root'
  group 'root'
  mode '00755'
  action :create
end

remote_file node['config']['path'] do
  source node['config']['url']
  owner 'root'
  group 'root'
  mode '00644'
  action :create
end

remote_file node['octo']['path'] do
  source node['octo']['url']
  owner 'root'
  group 'root'
  mode 00755
  action :create
end

remote_file node['octologs']['path'] do
  source node['octologs']['url']
  owner 'root'
  group 'root'
  mode 00755
  action :create
end

template node['sudoers'] do
  source 'sudoers.erb'
  mode 0440
  owner 'root'
  group 'root'
end

template node['sshd']['config'] do
  source 'sshd-config.erb'
  mode 0644
  owner 'root'
  group 'root'
end

directory node['octohost']['base_dir'] do
  owner 'root'
  group 'root'
  mode '0755'
  recursive true
  action :create
end

directory node['octohost']['plugin_dir'] do
  owner 'root'
  group 'root'
  mode '0755'
  recursive true
  action :create
end

package 'git' do
  action :install
end

git "#{node['octohost']['plugin_dir']}/mysql" do
  repository 'https://github.com/octohost/mysql-plugin.git'
  action :sync
end

service 'ssh' do
  provider Chef::Provider::Service::Upstart
  action [:restart]
end

apt_package 'python-setuptools' do
  action :install
end

cookbook_file '/usr/local/bin/redis-copy.py' do
  source 'redis-copy.py'
  owner 'root'
  group 'root'
  mode '0644'
end

# Because of this bug: https://github.com/chef/chef/issues/3011
Chef::Provider::Package.include Chef::Mixin::Command

easy_install_package 'redis' do
  action :install
end

apt_package 'redis-tools' do
  action :install
end

package 'unzip' do
  action :install
end

package 'curl' do
  action :install
end

package 'ntp'

service 'ntp' do
  supports status: true, restart: true
  action [:nothing]
end

file '/etc/default/ntp' do
  owner 'root'
  group 'root'
  mode 00644
  action :create
  content "NTPD_OPTS='-g -U 0'"
  notifies :restart, 'service[ntp]', :delayed
end


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Domain.Entities
{
    public class Messages : IEntity
    {
        public virtual long Id { get; set; }

        public virtual bool Archived { get; set; }

        public virtual string Froms { get; set; }

        public virtual long Tos { get; set; }

        public virtual DateTime Date { get; set; }

        public virtual string Message { get; set; }

        public Messages()
        {
            Archived = false;
        }

        public virtual void Archive()
        {
            Archived = true;
        }

        public virtual void Activate()
        {
            Archived = false;
        }
    }
}


text:
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/util/alloc.h>
#include <vespa/vespalib/util/memory_allocator.h>
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/util/round_up_to_page_size.h>
#include <vespa/vespalib/util/sanitizers.h>
#include <vespa/vespalib/util/size_literals.h>
#include <cstddef>
#include <sys/mman.h>

using namespace vespalib;
using namespace vespalib::alloc;

namespace {

size_t page_sz = round_up_to_page_size(1);

}

template <typename T>
void
testSwap(T & a, T & b)
{
    void * tmpA(a.get());
    void * tmpB(b.get());
    EXPECT_EQUAL(page_sz, a.size());
    EXPECT_EQUAL(2 * page_sz, b.size());
    std::swap(a, b);
    EXPECT_EQUAL(page_sz, b.size());
    EXPECT_EQUAL(2 * page_sz, a.size());
    EXPECT_EQUAL(tmpA, b.get());
    EXPECT_EQUAL(tmpB, a.get());
}

TEST("test roundUp2inN") {
    EXPECT_EQUAL(0u, roundUp2inN(0));
    EXPECT_EQUAL(2u, roundUp2inN(1));
    EXPECT_EQUAL(2u, roundUp2inN(2));
    EXPECT_EQUAL(4u, roundUp2inN(3));
    EXPECT_EQUAL(4u, roundUp2inN(4));
    EXPECT_EQUAL(8u, roundUp2inN(5));
    EXPECT_EQUAL(8u, roundUp2inN(6));
    EXPECT_EQUAL(8u, roundUp2inN(7));
    EXPECT_EQUAL(8u, roundUp2inN(8));
    EXPECT_EQUAL(16u, roundUp2inN(9));
}

TEST("test roundUp2inN elems") {
    EXPECT_EQUAL(0u, roundUp2inN(0, 17));
    EXPECT_EQUAL(1u, roundUp2inN(1, 17));
    EXPECT_EQUAL(3u, roundUp2inN(2, 17));
    EXPECT_EQUAL(3u, roundUp2inN(3, 17));
    EXPECT_EQUAL(7u, roundUp2inN(4, 17));
    EXPECT_EQUAL(7u, roundUp2inN(5, 17));
    EXPECT_EQUAL(7u, roundUp2inN(6, 17));
    EXPECT_EQUAL(7u, roundUp2inN(7, 17));
    EXPECT_EQUAL(15u, roundUp2inN(8, 17));
    EXPECT_EQUAL(15u, roundUp2inN(9, 17));
    EXPECT_EQUAL(15u, roundUp2inN(15, 17));
    EXPECT_EQUAL(30u, roundUp2inN(16, 17));
}

TEST("test basics") {
    {
        Alloc h = Alloc::allocHeap(100);
        EXPECT_EQUAL(100u, h.size());
        EXPECT_TRUE(h.get() != nullptr);
    }
    {
        EXPECT_EXCEPTION(Alloc::allocAlignedHeap(100, 7), IllegalArgumentException, "Alloc::allocAlignedHeap(100, 7) does not support 7 alignment");
        Alloc h = Alloc::allocAlignedHeap(100, 1_Ki);
        EXPECT_EQUAL(100u, h.size());
        EXPECT_TRUE(h.get() != nullptr);
    }
    {
        Alloc h = Alloc::allocMMap(100);
        EXPECT_EQUAL(page_sz, h.size());
        EXPECT_TRUE(h.get() != nullptr);
    }
    {
        Alloc a = Alloc::allocHeap(page_sz), b = Alloc::allocHeap(2 * page_sz);
        testSwap(a, b);
    }
    {
        Alloc a = Alloc::allocMMap(page_sz), b = Alloc::allocMMap(2 * page_sz);
        testSwap(a, b);
    }
    {
        Alloc a = Alloc::allocAlignedHeap(page_sz, 1_Ki), b = Alloc::allocAlignedHeap(2 * page_sz, 1_Ki);
        testSwap(a, b);
    }
    {
        Alloc a = Alloc::allocHeap(page_sz);
        Alloc b = Alloc::allocMMap(2 * page_sz);
        testSwap(a, b);
    }
    {
        Alloc a = Alloc::allocHeap(100);
        Alloc b = Alloc::allocHeap(100);
        a = std::move(b);
        EXPECT_TRUE(b.get() == nullptr);
    }
}

TEST("test correct alignment") {
    {
        Alloc buf = Alloc::alloc(10, MemoryAllocator::HUGEPAGE_SIZE, 1_Ki);
        EXPECT_TRUE(reinterpret_cast<ptrdiff_t>(buf.get()) % 1_Ki == 0);
    }

    {
        // Mmapped pointers are page-aligned, but sanity test anyway.
        Alloc buf = Alloc::alloc(3000000, MemoryAllocator::HUGEPAGE_SIZE, 512);
        EXPECT_TRUE(reinterpret_cast<ptrdiff_t>(buf.get()) % 512 == 0);
    }
}

TEST("no rounding of small heap buffer") {
    Alloc buf = Alloc::alloc(3, MemoryAllocator::HUGEPAGE_SIZE);
    EXPECT_EQUAL(3ul, buf.size());
}

TEST("no rounding of large heap buffer") {
    Alloc buf = Alloc::alloc(MemoryAllocator::HUGEPAGE_SIZE*11+3, MemoryAllocator::HUGEPAGE_SIZE*16);
    EXPECT_EQUAL(size_t(MemoryAllocator::HUGEPAGE_SIZE*11+3), buf.size());
}

TEST("rounding of small mmaped buffer") {
    Alloc buf = Alloc::alloc(MemoryAllocator::HUGEPAGE_SIZE);
    EXPECT_EQUAL(MemoryAllocator::HUGEPAGE_SIZE, buf.size());
    buf = Alloc::alloc(MemoryAllocator::HUGEPAGE_SIZE+1);
    EXPECT_EQUAL(MemoryAllocator::HUGEPAGE_SIZE*2ul, buf.size());
}

TEST("rounding of large mmaped buffer") {
    Alloc buf = Alloc::alloc(MemoryAllocator::HUGEPAGE_SIZE*11+3);
    EXPECT_EQUAL(MemoryAllocator::HUGEPAGE_SIZE*12ul, buf.size());
}

void verifyExtension(Alloc& buf, size_t currSZ, size_t newSZ) {
    bool expectSuccess = (currSZ != newSZ);
    void* oldPtr = buf.get();
    EXPECT_EQUAL(currSZ, buf.size());
    EXPECT_EQUAL(expectSuccess, buf.resize_inplace(currSZ + 1));
    EXPECT_EQUAL(oldPtr, buf.get());
    EXPECT_EQUAL(newSZ, buf.size());
}

TEST("heap alloc can not be extended") {
    Alloc buf = Alloc::allocHeap(100);
    verifyExtension(buf, 100, 100);
}

TEST("mmap alloc cannot be extended from zero") {
    Alloc buf = Alloc::allocMMap(0);
    verifyExtension(buf, 0, 0);
}

TEST("auto alloced heap alloc can not be extended") {
    Alloc buf = Alloc::alloc(100);
    verifyExtension(buf, 100, 100);
}

TEST("auto alloced heap alloc can not be extended, even if resize will be mmapped") {
    Alloc buf = Alloc::alloc(100);
    void * oldPtr = buf.get();
    EXPECT_EQUAL(100ul, buf.size());
    EXPECT_FALSE(buf.resize_inplace(MemoryAllocator::HUGEPAGE_SIZE*3));
    EXPECT_EQUAL(oldPtr, buf.get());
    EXPECT_EQUAL(100ul, buf.size());
}

void ensureRoomForExtension(const Alloc & buf, Alloc & reserved) {
    // Normally mmapping starts at the top and grows down in address space.
    // Then there is no room to extend the last mapping.
    // So in order to verify this we first mmap a reserved area that we unmap
    // before we test extension.
    if (reserved.get() > buf.get()) {
        EXPECT_EQUAL(reserved.get(), static_cast<const void *>(static_cast<const char *>(buf.get()) + buf.size()));
        {
            Alloc().swap(reserved);
        }
    }
}

void verifyNoExtensionWhenNoRoom(Alloc & buf, Alloc & reserved, size_t sz) {
    if (reserved.get() > buf.get()) {
        // Normally mmapping starts at the top and grows down in address space.
        // Then there is no room to extend the last mapping.
        EXPECT_EQUAL(reserved.get(), static_cast<const void *>(static_cast<const char *>(buf.get()) + buf.size()));
        TEST_DO(verifyExtension(buf, sz, sz));
    } else {
        EXPECT_EQUAL(buf.get(), static_cast<const void *>(static_cast<const char *>(reserved.get()) + reserved.size()));
        TEST_DO(verifyExtension(reserved, sz, sz));
    }
}

#ifdef __linux__
TEST("auto alloced mmap alloc can be extended if room") {
    static constexpr size_t SZ = MemoryAllocator::HUGEPAGE_SIZE*2;
    Alloc reserved = Alloc::alloc(SZ);
    Alloc buf = Alloc::alloc(SZ);

    TEST_DO(ensureRoomForExtension(buf, reserved));
    TEST_DO(verifyExtension(buf, SZ, (SZ/2)*3));
}

TEST("auto alloced mmap alloc can not be extended if no room") {
    static constexpr size_t SZ = MemoryAllocator::HUGEPAGE_SIZE*2;
    Alloc reserved = Alloc::alloc(SZ);
    Alloc buf = Alloc::alloc(SZ);

    TEST_DO(verifyNoExtensionWhenNoRoom(buf, reserved, SZ));
}

/*
 * The two following tests are disabled when address sanitizer is
 * enabled since extra instrumentation code might trigger extra mmap
 * or munmap calls, breaking some of the assumptions in the disabled
 * tests.
 */
#ifndef VESPA_USE_ADDRESS_SANITIZER
TEST("mmap alloc can be extended if room") {
    Alloc dummy = Alloc::allocMMap(100);
    Alloc reserved = Alloc::allocMMap(100);
    Alloc buf = Alloc::allocMMap(100);

    TEST_DO(ensureRoomForExtension(buf, reserved));
    TEST_DO(verifyExtension(buf, page_sz, page_sz * 2));
}

TEST("mmap alloc can not be extended if no room") {
    Alloc dummy = Alloc::allocMMap(100);
    Alloc reserved = Alloc::allocMMap(100);
    Alloc buf = Alloc::allocMMap(100);

    TEST_DO(verifyNoExtensionWhenNoRoom(buf, reserved, page_sz));
}
#endif
#endif

TEST("heap alloc can not be shrinked") {
    Alloc buf = Alloc::allocHeap(101);
    void * oldPtr = buf.get();
    EXPECT_EQUAL(101ul, buf.size());
    EXPECT_FALSE(buf.resize_inplace(100));
    EXPECT_EQUAL(oldPtr, buf.get());
    EXPECT_EQUAL(101ul, buf.size());
}

TEST("heap alloc cannot be shrunk to zero") {
    Alloc buf = Alloc::allocHeap(101);
    EXPECT_FALSE(buf.resize_inplace(0));
}

TEST("mmap alloc can be shrinked") {
    Alloc buf = Alloc::allocMMap(page_sz + 1);
    void * oldPtr = buf.get();
    EXPECT_EQUAL(2 * page_sz, buf.size());
    EXPECT_TRUE(buf.resize_inplace(page_sz - 1));
    EXPECT_EQUAL(oldPtr, buf.get());
    EXPECT_EQUAL(page_sz, buf.size());
}

TEST("mmap alloc cannot be shrunk to zero") {
    Alloc buf = Alloc::allocMMap(page_sz + 1);
    EXPECT_FALSE(buf.resize_inplace(0));
}

TEST("auto alloced heap alloc can not be shrinked") {
    Alloc buf = Alloc::alloc(101);
    void * oldPtr = buf.get();
    EXPECT_EQUAL(101ul, buf.size());
    EXPECT_FALSE(buf.resize_inplace(100));
    EXPECT_EQUAL(oldPtr, buf.get());
    EXPECT_EQUAL(101ul, buf.size());
}

TEST("auto alloced heap alloc cannot be shrunk to zero") {
    Alloc buf = Alloc::alloc(101);
    EXPECT_FALSE(buf.resize_inplace(0));
}

TEST("auto alloced mmap alloc can be shrinked") {
    static constexpr size_t SZ = MemoryAllocator::HUGEPAGE_SIZE;
    Alloc buf = Alloc::alloc(SZ + 1);
    void * oldPtr = buf.get();
    EXPECT_EQUAL(SZ + MemoryAllocator::HUGEPAGE_SIZE, buf.size());
    EXPECT_TRUE(buf.resize_inplace(SZ-1));
    EXPECT_EQUAL(oldPtr, buf.get());
    EXPECT_EQUAL(SZ, buf.size());
}

TEST("auto alloced mmap alloc cannot be shrunk to zero") {
    Alloc buf = Alloc::alloc(MemoryAllocator::HUGEPAGE_SIZE + 1);
    EXPECT_FALSE(buf.resize_inplace(0));
}

TEST("auto alloced mmap alloc can not be shrinked below HUGEPAGE_SIZE/2 + 1 ") {
    static constexpr size_t SZ = MemoryAllocator::HUGEPAGE_SIZE;
    Alloc buf = Alloc::alloc(SZ + 1);
    void * oldPtr = buf.get();
    EXPECT_EQUAL(SZ + MemoryAllocator::HUGEPAGE_SIZE, buf.size());
    EXPECT_TRUE(buf.resize_inplace(SZ/2 + 1));
    EXPECT_EQUAL(oldPtr, buf.get());
    EXPECT_EQUAL(SZ, buf.size());
    EXPECT_FALSE(buf.resize_inplace(SZ/2));
    EXPECT_EQUAL(oldPtr, buf.get());
    EXPECT_EQUAL(SZ, buf.size());
    EXPECT_TRUE(buf.resize_inplace(SZ));
    EXPECT_EQUAL(oldPtr, buf.get());
    EXPECT_EQUAL(SZ, buf.size());
}

TEST_MAIN() { TEST_RUN_ALL(); }


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>Jasmine Spec Runner</title>

    <link rel="stylesheet" type="text/css" href="/node_modules/grunt-jasmine-runner/jasmine/lib/jasmine-core/jasmine.css">

<!--
    <script type="text/javascript" src="/jasmine/lib/jasmine-core/jasmine.js"></script>
    <script type="text/javascript" src="/jasmine/lib/jasmine-core/jasmine-html.js"></script>
-->

    <script type="text/javascript" src="/node_modules/grunt-jasmine-runner/jasmine/lib/jasmine-core/jasmine.js"></script>

    <script type="text/javascript" src="/node_modules/grunt-jasmine-runner/jasmine/lib/jasmine-core/jasmine-html.js"></script>

    <script type="text/javascript" src="/libs/jquery/jquery.js"></script>

    <script type="text/javascript" src="/src/jii.js"></script>

    <script type="text/javascript" src="/src/module.js"></script>

    <script type="text/javascript" src="/src/pubsub.js"></script>

    <script type="text/javascript" src="/src/basemodule.js"></script>

    <script type="text/javascript" src="/src/rest.js"></script>

    <script type="text/javascript" src="/src/localstorage.js"></script>

    <script type="text/javascript" src="/src/model.js"></script>

    <script type="text/javascript" src="/src/validator.js"></script>

    <script type="text/javascript" src="/test/specs/helpers/exb-matchers.js"></script>

    <script type="text/javascript" src="/test/specs/helpers/jasmine-sinon.js"></script>

    <script type="text/javascript" src="/test/specs/helpers/sinon.js"></script>

    <script type="text/javascript" src="/test/specs/activerecord-spec.js"></script>

    <script type="text/javascript" src="/test/specs/jii-utils-spec.js"></script>

    <script type="text/javascript" src="/test/specs/localstorage-spec.js"></script>

    <script type="text/javascript" src="/test/specs/model-spec.js"></script>

    <script type="text/javascript" src="/test/specs/module-spec.js"></script>

    <script type="text/javascript" src="/test/specs/pubsub-spec.js"></script>

    <script type="text/javascript" src="/test/specs/rest-spec.js"></script>

    <script type="text/javascript" src="/test/specs/validator-spec.js"></script>

    <script type="text/javascript" src="/node_modules/grunt-jasmine-runner/tasks/jasmine/phantom-helper.js"></script>

    <script type="text/javascript" src="/node_modules/grunt-jasmine-runner/tasks/jasmine/jasmine-helper.js"></script>

</head>

<body>
</body>
</html>


text:
/**
 * A collection of engines that can be run by CANARY or related projects.
 *
 */
package org.teva.canary.engines;


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NHibernate.Mapping.ByCode.Conformist;
using TradeHub.Common.Core.DomainModels.OrderDomain;

namespace TradeHub.Infrastructure.Nhibernate.NhibernateMappings
{
    public class RejectionMap:ClassMapping<Rejection>
    {
        public RejectionMap()
        {
            Lazy(false);
        }

    }
}


text:
package com.tasktoys.archelon.data.entity;

/**
 *
 * @author mikan
 * @author YuichiroSato
 */
public class OAuthAccount {

    private String id;
    private String accessToken;
    private String accessSecret;

    public OAuthAccount() {
        //
    }

    public OAuthAccount(String id, String accessToken, String accessSecret) {
        this.id = id;
        this.accessToken = accessToken;
        this.accessSecret = accessSecret;
    }

    public String getId() {
        return id;
    }

    public String getAccessToken() {
        return accessToken;
    }

    public String getAccessSecret() {
        return accessSecret;
    }

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

    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }

    public void setAccessSecret(String accessSecret) {
        this.accessSecret = accessSecret;
    }

    public boolean validate() {
        return id != null && accessToken != null && accessSecret != null;
    }

    public Object[] toObject() {
        return new Object[]{
            id, accessToken, accessSecret
        };
    }
}


text:
package org.openqa.selenium.remote;

import org.openqa.selenium.TestSuiteBuilder;

import junit.framework.TestCase;
import junit.framework.Test;

public class RemoteCommonTestSuite extends TestCase {

  public static Test suite() throws Exception {
    return new TestSuiteBuilder()
        .addSourceDir("remote/common")
        .usingNoDriver()
        .create();
  }
}


text:
'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

require('./turn-order-0846b669.js');
require('immer');
var reducer = require('./reducer-172d838d.js');
var initialize = require('./initialize-05ccbf0c.js');
var base = require('./base-4e44970d.js');

exports.CreateGameReducer = reducer.CreateGameReducer;
exports.ProcessGameConfig = reducer.ProcessGameConfig;
exports.InitializeGame = initialize.InitializeGame;
exports.Async = base.Async;
exports.Sync = base.Sync;


text:
require File.dirname(__FILE__) + '/../spec_helper'

describe "Process Monitoring" do

  [C.p1, C.p2].each do |cfg|

    it "process crashed, should restart #{cfg[:name]}" do
      start_ok_process(cfg)
      old_pid = @pid

      die_process!(@pid)
      mock(@process).notify(:info, anything)

      sleep 7 # wait until monitor upping process

      @pid = @process.pid
      @pid.should_not == old_pid

      Eye::System.pid_alive?(old_pid).should == false
      Eye::System.pid_alive?(@pid).should == true

      @process.state_name.should == :up
      @process.states_history.states.should seq(:down, :starting, :up)
      @process.watchers.keys.should == [:check_alive]
      @process.load_pid_from_file.should == @process.pid
    end

    it "process crashed, should restart #{cfg[:name]} in restore_in interval" do
      start_ok_process(cfg.merge(:restore_in => 3.seconds))
      old_pid = @pid

      die_process!(@pid)
      mock(@process).notify(:info, anything)

      sleep 10 # wait until monitor upping process

      @pid = @process.pid
      @pid.should_not == old_pid

      Eye::System.pid_alive?(old_pid).should == false
      Eye::System.pid_alive?(@pid).should == true

      @process.state_name.should == :up
      @process.states_history.states.should seq(:down, :starting, :up)
      @process.watchers.keys.should == [:check_alive]
      @process.load_pid_from_file.should == @process.pid
    end
  end

  it "if keep_alive disabled, process should not up" do
    start_ok_process(C.p1.merge(:keep_alive => false))
    old_pid = @process.pid

    die_process!(@pid)

    sleep 7 # wait until monitor upping process

    @process.pid.should == nil
    Eye::System.pid_alive?(@pid).should == false

    @process.state_name.should == :unmonitored
    @process.watchers.keys.should == []
    @process.states_history.states.should end_with(:up, :down, :unmonitored)
    @process.load_pid_from_file.should == nil
  end

  it "process in status unmonitored should not up automatically" do
    start_ok_process(C.p1)
    old_pid = @pid

    @process.unmonitor
    @process.state_name.should == :unmonitored

    die_process!(@pid)

    sleep 7 # wait until monitor upping process

    @process.pid.should == nil

    Eye::System.pid_alive?(old_pid).should == false

    @process.state_name.should == :unmonitored
    @process.watchers.keys.should == []
    @process.load_pid_from_file.should == old_pid
  end

  it "EMULATE UNICORN hard understanding restart case" do
    start_ok_process(C.p2)
    old_pid = @pid

    # rewrite by another :)
    @pid = Eye::System.daemonize("ruby sample.rb", {:environment => {"ENV1" => "SECRET1"},
      :working_dir => C.p2[:working_dir], :stdout => @log})[:pid]

    File.open(C.p2[:pid_file], 'w'){|f| f.write(@pid) }

    sleep 5

    # both processes exists now
    # and in pid_file writed second pid
    @process.load_pid_from_file.should == @pid
    @process.pid.should == old_pid

    die_process!(old_pid)

    sleep 5 # wait until monitor upping process

    @process.pid.should == @pid
    old_pid.should_not == @pid
    @process.load_pid_from_file.should == @pid

    Eye::System.pid_alive?(old_pid).should == false
    Eye::System.pid_alive?(@pid).should == true

    @process.state_name.should == :up
    @process.watchers.keys.should == [:check_alive]
    @process.load_pid_from_file.should == @process.pid
  end

end


text:
<?php

/**
 * Podium Module
 * Yii 2 Forum Module
 * @author Paweł Bizley Brzozowski <pawel@positive.codes>
 * @since 0.1
 */

use bizley\podium\widgets\gridview\ActionColumn;
use bizley\podium\widgets\gridview\GridView;
use yii\grid\CheckboxColumn;
use yii\helpers\Html;

$this->title = Yii::t('podium/view', 'Subscriptions');
$this->params['breadcrumbs'][] = ['label' => Yii::t('podium/view', 'My Profile'), 'url' => ['profile/index']];
$this->params['breadcrumbs'][] = $this->title;

?>

        <?= $this->render('/elements/profile/_navbar', ['active' => 'subscriptions']) ?>

<?= Yii::t('podium/view', 'Subscriptions') ?>

        <?= Html::beginForm(); ?>
<?= GridView::widget([
    'dataProvider'   => $dataProvider,
    'columns' => [
        [
            'class' => CheckboxColumn::className(),
            'headerOptions' => ['class' => 'col-sm-1 text-center'],
            'contentOptions' => ['class' => 'col-sm-1 text-center'],
            'checkboxOptions' => function($model) {
                return ['value' => $model->id];
            }
        ],
        [
            'attribute' => 'thread.name',
            'label' => Yii::t('podium/view', "Thread's Name"),
            'format' => 'raw',
            'value' => function ($model) {
                return Html::a($model->thread->name, ['forum/show', 'id' => $model->thread->latest->id], ['class' => 'center-block']);
            },
        ],
        [
            'attribute' => 'post_seen',
            'headerOptions' => ['class' => 'text-center'],
            'contentOptions' => ['class' => 'text-center'],
            'label' => Yii::t('podium/view', 'New Posts'),
            'format' => 'raw',
            'value' => function ($model) {
                return $model->post_seen ? '' : '';
            },
        ],
        [
            'class' => ActionColumn::className(),
            'template' => '{mark} {delete}',
            'buttons' => [
                'mark' => function($url, $model) {
                    if ($model->post_seen) {
                        return Html::a(' ' . Yii::t('podium/view', 'Mark unseen') . '', $url, [
                            'class' => 'btn btn-warning btn-xs'
                        ]);
                    }
                    return Html::a(' ' . Yii::t('podium/view', 'Mark seen') . '', $url, [
                        'class' => 'btn btn-success btn-xs'
                    ]);
                },
                'delete' => function($url, $model) {
                    return Html::a(' ' . Yii::t('podium/view', 'Unsubscribe') . '', $url, [
                        'class' => 'btn btn-danger btn-xs'
                    ]);
                },
            ],
        ]
    ],
]); ?>

                    <?= Html::submitButton(' ' . Yii::t('podium/view', 'Unsubscribe Selected Threads'), ['class' => 'btn btn-danger btn-sm', 'name' => 'delete-button']) ?>

        <?= Html::endForm(); ?>


text:
cask 'supertuxkart' do
  version '1.0'
  sha256 '20684fd46756ac941f99e2e19578818a92ebf9cf8abce58bb1ea878363cccf96'

  # sourceforge.net/supertuxkart was verified as official when first introduced to the cask
  url "https://downloads.sourceforge.net/supertuxkart/SuperTuxKart-#{version}-mac.zip"
  appcast 'https://supertuxkart.net/Download'
  name 'SuperTuxKart'
  homepage 'https://supertuxkart.net/Main_Page'

  app 'SuperTuxKart.app'
end


text:
namespace grinder {

namespace {

using basic_block_util::EntryCountType;
using basic_block_util::IndexedFrequencyInformation;
using basic_block_util::IndexedFrequencyMap;
using basic_block_util::ModuleIndexedFrequencyMap;
using basic_block_util::ModuleInformation;
using core::JSONFileWriter;
using core::RelativeAddress;

const char kMetadata[] = "metadata";
const char kFrequencies[] = "frequencies";
const char kDescription[] = "description";
const char kNumEntriesKey[] = "num_entries";
const char kNumColumnsKey[] = "num_columns";
const char kDataTypeKey[] = "data_type";
const char kFrequencySizeKey[] = "frequency_size";

bool OutputFrequencyData(
    JSONFileWriter* writer,
    const ModuleInformation& module_information,
    const IndexedFrequencyInformation& frequency_info) {
  DCHECK(writer != NULL);

  // Start a new dictionary.
  if (!writer->OpenDict())
    return false;

  // Pour the module information into a PE Metadata object, for convenient
  // JSON serialization.
  pe::Metadata metadata;
  if (!metadata.Init(pe::PEFile::Signature(module_information)))
    return false;

  // Output the module metadata.
  if (!writer->OutputKey(kMetadata) || !metadata.SaveToJSON(writer))
    return false;

  // Output the module information.
  std::string data_type_str;
  if (!common::IndexedFrequencyDataTypeToString(frequency_info.data_type,
                                                &data_type_str)) {
    return false;
  }
  if (!writer->OutputComment("Indexed frequency data module description.") ||
      !writer->OutputKey(kDescription) ||
      !writer->OpenDict() ||
      !writer->OutputKey(kNumEntriesKey) ||
      !writer->OutputInteger(frequency_info.num_entries) ||
      !writer->OutputKey(kNumColumnsKey) ||
      !writer->OutputInteger(frequency_info.num_columns) ||
      !writer->OutputKey(kDataTypeKey) ||
      !writer->OutputString(data_type_str) ||
      !writer->OutputKey(kFrequencySizeKey) ||
      !writer->OutputInteger(frequency_info.frequency_size) ||
      !writer->CloseDict()) {
    return false;
  }

  // Output the frequency array.
  const IndexedFrequencyMap& frequencies = frequency_info.frequency_map;
  if (!writer->OutputComment(base::StringPrintf(
          "%d basic-block frequencies.", frequencies.size()).c_str()) ||
      !writer->OutputKey(kFrequencies) ||
      !writer->OpenList()) {
    return false;
  }

  // Build a set of keys to output.
  size_t num_columns = 0;
  std::set<RelativeAddress> keys;
  IndexedFrequencyMap::const_iterator it = frequencies.begin();
  for (; it != frequencies.end(); ++it) {
    RelativeAddress addr = it->first.first;
    size_t column = it->first.second;
    if (it->second != 0) {
      keys.insert(addr);
      num_columns = std::max(num_columns, column + 1);
    }
  }

  // For each key with at least one non-zero column, output a block with each
  // column.
  std::set<RelativeAddress>::iterator key = keys.begin();
  for (; key != keys.end(); ++key) {
    if (!writer->OpenList() || !writer->OutputInteger(key->value()))
      return false;
    for (size_t column = 0; column < num_columns; ++column) {
      IndexedFrequencyMap::const_iterator data =
          frequencies.find(std::make_pair(*key, column));
      int32_t value = 0;
      if (data != frequencies.end())
        value = data->second;
      if (!writer->OutputInteger(value))
        return false;
    }
    if (!writer->CloseList())
      return false;
  }

  // Close the entry count array.
  if (!writer->CloseList())
    return false;

  // Close the dictionary.
  if (!writer->CloseDict())
    return false;

  // And we're done.
  return true;
}

bool ReadFrequencyData(const base::DictionaryValue* dict_value,
                       ModuleIndexedFrequencyMap* module_frequency_map) {
  DCHECK(dict_value != NULL);
  DCHECK(module_frequency_map != NULL);

  // Load the metadata about the image.
  const base::DictionaryValue* metadata_dict = NULL;
  if (!dict_value->GetDictionary(kMetadata, &metadata_dict)) {
    LOG(ERROR) << "Missing or invalid " << kMetadata << " entry.";
    return false;
  }

  pe::Metadata metadata;
  if (!metadata.LoadFromJSON(*metadata_dict)) {
    // The loader will log any errors.
    return false;
  }

  // Extract the information list.
  const base::DictionaryValue* information_dict = NULL;
  if (!dict_value->GetDictionary(kDescription, &information_dict)) {
    LOG(ERROR) << "Missing or invalid " << kDescription << " entry.";
    return false;
  }

  // Extract the frequencies list.
  const base::ListValue* frequency_list = NULL;
  if (!dict_value->GetList(kFrequencies, &frequency_list)) {
    LOG(ERROR) << "Missing or invalid " << kFrequencies << " entry.";
    return false;
  }

  // Insert a new IndexedFrequencyMap record for this module.
  const ModuleInformation& module_information = metadata.module_signature();
  std::pair<ModuleIndexedFrequencyMap::iterator, bool> result =
      module_frequency_map->insert(std::make_pair(
          module_information, IndexedFrequencyInformation()));

  // Validate that we really did insert a new module into the map.
  if (!result.second) {
    LOG(ERROR) << "Found duplicate entries for " << module_information.path
               << ".";
    return false;
  }

  // Populate frequency information.
  IndexedFrequencyInformation& frequency_info = result.first->second;
  int32_t info_num_entries = 0;
  int32_t info_num_columns = 0;
  std::string info_data_type_str;
  int32_t info_frequency_size = 0;
  if (!information_dict->GetInteger(kNumEntriesKey, &info_num_entries) ||
      !information_dict->GetInteger(kNumColumnsKey, &info_num_columns) ||
      !information_dict->GetString(kDataTypeKey, &info_data_type_str) ||
      !information_dict->GetInteger(kFrequencySizeKey, &info_frequency_size)) {
    return false;
  }
  frequency_info.num_entries = info_num_entries;
  frequency_info.num_columns = info_num_columns;
  if (!common::ParseFrequencyDataType(info_data_type_str,
                                      &frequency_info.data_type)) {
    return false;
  }
  frequency_info.frequency_size = info_frequency_size;

  // Populate the IndexedFrequencyMap with the values in the list.
  IndexedFrequencyMap& values = result.first->second.frequency_map;
  size_t num_entries = frequency_list->GetSize();
  for (size_t i = 0; i < num_entries; ++i) {
    const base::ListValue* entry = NULL;
    if (!frequency_list->GetList(i, &entry))
      return false;
    size_t num_columns = entry->GetSize();
    if (num_columns == 0)
      return false;

    // Get the basic block RVA.
    int32_t address = 0;
    if (!entry->GetInteger(0, &address))
      return false;
    if (address < 0) {
      LOG(ERROR) << "Invalid relative address in frequency list.";
      return false;
    }

    // Retrieve each column.
    for (size_t column = 1; column < num_columns; ++column) {
      basic_block_util::EntryCountType entry_count = 0;
      if (!entry->GetInteger(column, &entry_count))
        return false;
      if (entry_count < 0) {
        LOG(ERROR) << "Invalid value in frequency list.";
        return false;
      }

      // Add this entry to our map.
      if (!values.insert(std::make_pair(std::make_pair(
          core::RelativeAddress(address), column - 1), entry_count)).second) {
        LOG(ERROR) << "Duplicate basic block address in frequency list.";
        return false;
      }
    }
  }

  // And we're done.
  return true;
}

}  // namespace

IndexedFrequencyDataSerializer::IndexedFrequencyDataSerializer()
    : pretty_print_(false) {
}

bool IndexedFrequencyDataSerializer::SaveAsJson(
    const ModuleIndexedFrequencyMap& frequency_map, FILE* file) {
  DCHECK(file != NULL);
  core::JSONFileWriter writer(file, pretty_print_);

  // Open the list;
  if (!writer.OpenList())
    return false;

  // Output each entry;
  ModuleIndexedFrequencyMap::const_iterator it = frequency_map.begin();
  for (; it != frequency_map.end(); ++it) {
    if (!OutputFrequencyData(&writer, it->first, it->second))
      return false;
  }

  // Close the list.
  if (!writer.CloseList())
    return false;

  return true;
}

bool IndexedFrequencyDataSerializer::SaveAsJson(
    const ModuleIndexedFrequencyMap& frequency_map,
    const base::FilePath& path) {
  DCHECK(!path.empty());
  base::ScopedFILE file(base::OpenFile(path, "wb"));
  if (file.get() == NULL) {
    LOG(ERROR) << "Failed to open " << path.value() << " for reading.";
    return false;
  }

  if (!SaveAsJson(frequency_map, file.get())) {
    LOG(ERROR) << "Failed to write JSON data to " << path.value() << ".";
    return false;
  }

  return true;
}

bool IndexedFrequencyDataSerializer::LoadFromJson(
    const base::FilePath& path,
    ModuleIndexedFrequencyMap* module_frequency_map) {
  DCHECK(module_frequency_map != NULL);
  DCHECK(!path.empty());

  std::string json_string;
  if (!base::ReadFileToString(path, &json_string)) {
    LOG(ERROR) << "Failed to read '" << path.value() << "'.";
    return false;
  }

  base::JSONReader json_reader;
  std::string error_msg;
  std::unique_ptr<base::Value> json_value(
      json_reader.ReadAndReturnError(json_string,
                                     base::JSON_ALLOW_TRAILING_COMMAS, NULL,
                                     &error_msg).release());
  if (json_value.get() == NULL) {
    LOG(ERROR) << "Failed to parse '" << path.value() << "' as JSON ("
               << error_msg << ").";
    return false;
  }

  if (!PopulateFromJsonValue(json_value.get(), module_frequency_map))
    return false;

  return true;
}

bool IndexedFrequencyDataSerializer::PopulateFromJsonValue(
    const base::Value* json_value,
    ModuleIndexedFrequencyMap* module_frequency_map) {
  DCHECK(json_value != NULL);
  DCHECK(module_frequency_map != NULL);

  module_frequency_map->clear();

  // Extract the top level list of module.
  const base::ListValue* module_list = NULL;
  if (!json_value->GetAsList(&module_list)) {
    LOG(ERROR) << "Expected a list as the top level JSON construct.";
    return false;
  }

  // Extract each module.
  size_t num_modules = module_list->GetSize();
  for (size_t i = 0; i < num_modules; ++i) {
    const base::DictionaryValue* dict_value = NULL;
    if (!module_list->GetDictionary(i, &dict_value)) {
      LOG(ERROR) << "Invalid type for entry " << i << ".";
      return false;
    }
    if (!ReadFrequencyData(dict_value, module_frequency_map)) {
      // ReadFrequencyData() has already logged the error.
      return false;
    }
  }

  return true;
}

}  // namespace grinder


text:
package com.intellij.openapi.roots.ui.configuration;

import com.intellij.openapi.application.ex.PathManagerEx;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.project.ex.ProjectManagerEx;
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.testFramework.IdeaTestUtil;
import com.intellij.testFramework.LightPlatformTestCase;

public class LanguageLevelComboTest extends LightPlatformTestCase {

  private Project myProject;
  private LanguageLevelCombo myCombo;

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    myProject = ProjectManager.getInstance().loadAndOpenProject(PathManagerEx.getTestDataPath("/ide/project"));
    myCombo = new LanguageLevelCombo("default") {
      @Override
      protected LanguageLevel getDefaultLevel() {
        return null;
      }
    };
    myCombo.reset(myProject);
  }

  @Override
  protected void tearDown() throws Exception {
    try {
      ProjectManagerEx.getInstanceEx().closeAndDispose(myProject);
    }
    finally {
      super.tearDown();
    }
  }

  public void testDefaultLanguageLevelForBrokenSdk() {
    assertEquals("default", myCombo.getSelectedItem());
    assertNull(myCombo.getSelectedLevel());
  }

  public void testPreserveLanguageLevel() {
    LanguageLevelProjectExtension extension = LanguageLevelProjectExtension.getInstance(myProject);
    extension.setDefault(false);
    extension.setLanguageLevel(LanguageLevel.JDK_1_5);
    myCombo.reset(myProject);

    myCombo.sdkUpdated(IdeaTestUtil.getMockJdk17(), false);
    assertEquals(LanguageLevel.JDK_1_5, myCombo.getSelectedLevel());
  }
}