text:
from __future__ import unicode_literals

from django.contrib.staticfiles.finders import find
from django.core.files.base import ContentFile
from django.utils.encoding import smart_str

from pipeline.compilers import Compiler
from pipeline.compressors import Compressor
from pipeline.conf import settings
from pipeline.exceptions import PackageNotFound
from pipeline.glob import glob
from pipeline.signals import css_compressed, js_compressed
from pipeline.storage import default_storage

class Package(object):
    def __init__(self, config):
        self.config = config
        self._sources = []

    @property
    def sources(self):
        if not self._sources:
            paths = []
            for pattern in self.config.get('source_filenames', []):
                for path in glob(pattern):
                    if path not in paths and find(path):
                        paths.append(str(path))
            self._sources = paths
        return self._sources

    @property
    def paths(self):
        return [path for path in self.sources
                if not path.endswith(settings.PIPELINE_TEMPLATE_EXT)]

    @property
    def templates(self):
        return [path for path in self.sources
                if path.endswith(settings.PIPELINE_TEMPLATE_EXT)]

    @property
    def output_filename(self):
        return self.config.get('output_filename')

    @property
    def extra_context(self):
        return self.config.get('extra_context', {})

    @property
    def template_name(self):
        return self.config.get('template_name')

    @property
    def variant(self):
        return self.config.get('variant')

    @property
    def manifest(self):
        return self.config.get('manifest', True)

class Packager(object):
    def __init__(self, storage=default_storage, verbose=False, css_packages=None, js_packages=None):
        self.storage = storage
        self.verbose = verbose
        self.compressor = Compressor(storage=storage, verbose=verbose)
        self.compiler = Compiler(verbose=verbose)
        if css_packages is None:
            css_packages = settings.PIPELINE_CSS
        if js_packages is None:
            js_packages = settings.PIPELINE_JS
        self.packages = {
            'css': self.create_packages(css_packages),
            'js': self.create_packages(js_packages),
        }

    def package_for(self, kind, package_name):
        try:
            return self.packages[kind][package_name]
        except KeyError:
            raise PackageNotFound(
                "No corresponding package for %s package name : %s" % (
                    kind, package_name
                )
            )

    def individual_url(self, filename):
        return self.storage.url(filename)

    def pack_stylesheets(self, package, **kwargs):
        return self.pack(package, self.compressor.compress_css, css_compressed,
                         output_filename=package.output_filename,
                         variant=package.variant, **kwargs)

    def compile(self, paths, force=False):
        return self.compiler.compile(paths, force=force)

    def pack(self, package, compress, signal, **kwargs):
        output_filename = package.output_filename
        if self.verbose:
            print("Saving: %s" % output_filename)
        paths = self.compile(package.paths, force=True)
        content = compress(paths, **kwargs)
        self.save_file(output_filename, content)
        signal.send(sender=self, package=package, **kwargs)
        return output_filename

    def pack_javascripts(self, package, **kwargs):
        return self.pack(package, self.compressor.compress_js, js_compressed, templates=package.templates, **kwargs)

    def pack_templates(self, package):
        return self.compressor.compile_templates(package.templates)

    def save_file(self, path, content):
        return self.storage.save(path, ContentFile(smart_str(content)))

    def create_packages(self, config):
        packages = {}
        if not config:
            return packages
        for name in config:
            packages[name] = Package(config[name])
        return packages


text:
extern const struct lwpb_msg_desc lwpb_messages_foo[];

// Message descriptor pointers
#define foo_SubMess (&lwpb_messages_foo[0])
#define foo_TestFieldNo15 (&lwpb_messages_foo[1])
#define foo_TestFieldNo16 (&lwpb_messages_foo[2])
#define foo_TestFieldNo2047 (&lwpb_messages_foo[3])
#define foo_TestFieldNo2048 (&lwpb_messages_foo[4])
#define foo_TestFieldNo262143 (&lwpb_messages_foo[5])
#define foo_TestFieldNo262144 (&lwpb_messages_foo[6])
#define foo_TestFieldNo33554431 (&lwpb_messages_foo[7])
#define foo_TestFieldNo33554432 (&lwpb_messages_foo[8])
#define foo_TestMess (&lwpb_messages_foo[9])
#define foo_TestMessPacked (&lwpb_messages_foo[10])
#define foo_TestMessOptional (&lwpb_messages_foo[11])
#define foo_TestMessRequiredInt32 (&lwpb_messages_foo[12])
#define foo_TestMessRequiredSInt32 (&lwpb_messages_foo[13])
#define foo_TestMessRequiredSFixed32 (&lwpb_messages_foo[14])
#define foo_TestMessRequiredInt64 (&lwpb_messages_foo[15])
#define foo_TestMessRequiredSInt64 (&lwpb_messages_foo[16])
#define foo_TestMessRequiredSFixed64 (&lwpb_messages_foo[17])
#define foo_TestMessRequiredUInt32 (&lwpb_messages_foo[18])
#define foo_TestMessRequiredFixed32 (&lwpb_messages_foo[19])
#define foo_TestMessRequiredUInt64 (&lwpb_messages_foo[20])
#define foo_TestMessRequiredFixed64 (&lwpb_messages_foo[21])
#define foo_TestMessRequiredFloat (&lwpb_messages_foo[22])
#define foo_TestMessRequiredDouble (&lwpb_messages_foo[23])
#define foo_TestMessRequiredBool (&lwpb_messages_foo[24])
#define foo_TestMessRequiredEnum (&lwpb_messages_foo[25])
#define foo_TestMessRequiredEnumSmall (&lwpb_messages_foo[26])
#define foo_TestMessRequiredString (&lwpb_messages_foo[27])
#define foo_TestMessRequiredBytes (&lwpb_messages_foo[28])
#define foo_TestMessRequiredMessage (&lwpb_messages_foo[29])
#define foo_EmptyMess (&lwpb_messages_foo[30])
#define foo_DefaultRequiredValues (&lwpb_messages_foo[31])
#define foo_DefaultOptionalValues (&lwpb_messages_foo[32])
#define foo_AllocValues (&lwpb_messages_foo[33])

extern const struct lwpb_field_desc lwpb_fields_foo_submess[];

// 'SubMess' field descriptor pointers
#define foo_SubMess_test (&lwpb_fields_foo_submess[0])

extern const struct lwpb_field_desc lwpb_fields_foo_testfieldno15[];

// 'TestFieldNo15' field descriptor pointers
#define foo_TestFieldNo15_test (&lwpb_fields_foo_testfieldno15[0])

extern const struct lwpb_field_desc lwpb_fields_foo_testfieldno16[];

// 'TestFieldNo16' field descriptor pointers
#define foo_TestFieldNo16_test (&lwpb_fields_foo_testfieldno16[0])

extern const struct lwpb_field_desc lwpb_fields_foo_testfieldno2047[];

// 'TestFieldNo2047' field descriptor pointers
#define foo_TestFieldNo2047_test (&lwpb_fields_foo_testfieldno2047[0])

extern const struct lwpb_field_desc lwpb_fields_foo_testfieldno2048[];

// 'TestFieldNo2048' field descriptor pointers
#define foo_TestFieldNo2048_test (&lwpb_fields_foo_testfieldno2048[0])

extern const struct lwpb_field_desc lwpb_fields_foo_testfieldno262143[];

// 'TestFieldNo262143' field descriptor pointers
#define foo_TestFieldNo262143_test (&lwpb_fields_foo_testfieldno262143[0])

extern const struct lwpb_field_desc lwpb_fields_foo_testfieldno262144[];

// 'TestFieldNo262144' field descriptor pointers
#define foo_TestFieldNo262144_test (&lwpb_fields_foo_testfieldno262144[0])

extern const struct lwpb_field_desc lwpb_fields_foo_testfieldno33554431[];

// 'TestFieldNo33554431' field descriptor pointers
#define foo_TestFieldNo33554431_test (&lwpb_fields_foo_testfieldno33554431[0])

extern const struct lwpb_field_desc lwpb_fields_foo_testfieldno33554432[];

// 'TestFieldNo33554432' field descriptor pointers
#define foo_TestFieldNo33554432_test (&lwpb_fields_foo_testfieldno33554432[0])

extern const struct lwpb_field_desc lwpb_fields_foo_testmess[];

// 'TestMess' field descriptor pointers
#define foo_TestMess_test_int32 (&lwpb_fields_foo_testmess[0])
#define foo_TestMess_test_sint32 (&lwpb_fields_foo_testmess[1])
#define foo_TestMess_test_sfixed32 (&lwpb_fields_foo_testmess[2])
#define foo_TestMess_test_int64 (&lwpb_fields_foo_testmess[3])
#define foo_TestMess_test_sint64 (&lwpb_fields_foo_testmess[4])
#define foo_TestMess_test_sfixed64 (&lwpb_fields_foo_testmess[5])
#define foo_TestMess_test_uint32 (&lwpb_fields_foo_testmess[6])
#define foo_TestMess_test_fixed32 (&lwpb_fields_foo_testmess[7])
#define foo_TestMess_test_uint64 (&lwpb_fields_foo_testmess[8])
#define foo_TestMess_test_fixed64 (&lwpb_fields_foo_testmess[9])
#define foo_TestMess_test_float (&lwpb_fields_foo_testmess[10])
#define foo_TestMess_test_double (&lwpb_fields_foo_testmess[11])
#define foo_TestMess_test_boolean (&lwpb_fields_foo_testmess[12])
#define foo_TestMess_test_enum_small (&lwpb_fields_foo_testmess[13])
#define foo_TestMess_test_enum (&lwpb_fields_foo_testmess[14])
#define foo_TestMess_test_string (&lwpb_fields_foo_testmess[15])
#define foo_TestMess_test_bytes (&lwpb_fields_foo_testmess[16])
#define foo_TestMess_test_message (&lwpb_fields_foo_testmess[17])

extern const struct lwpb_field_desc lwpb_fields_foo_testmesspacked[];

// 'TestMessPacked' field descriptor pointers
#define foo_TestMessPacked_test_int32 (&lwpb_fields_foo_testmesspacked[0])
#define foo_TestMessPacked_test_sint32 (&lwpb_fields_foo_testmesspacked[1])
#define foo_TestMessPacked_test_sfixed32 (&lwpb_fields_foo_testmesspacked[2])
#define foo_TestMessPacked_test_int64 (&lwpb_fields_foo_testmesspacked[3])
#define foo_TestMessPacked_test_sint64 (&lwpb_fields_foo_testmesspacked[4])
#define foo_TestMessPacked_test_sfixed64 (&lwpb_fields_foo_testmesspacked[5])
#define foo_TestMessPacked_test_uint32 (&lwpb_fields_foo_testmesspacked[6])
#define foo_TestMessPacked_test_fixed32 (&lwpb_fields_foo_testmesspacked[7])
#define foo_TestMessPacked_test_uint64 (&lwpb_fields_foo_testmesspacked[8])
#define foo_TestMessPacked_test_fixed64 (&lwpb_fields_foo_testmesspacked[9])
#define foo_TestMessPacked_test_float (&lwpb_fields_foo_testmesspacked[10])
#define foo_TestMessPacked_test_double (&lwpb_fields_foo_testmesspacked[11])
#define foo_TestMessPacked_test_boolean (&lwpb_fields_foo_testmesspacked[12])
#define foo_TestMessPacked_test_enum_small (&lwpb_fields_foo_testmesspacked[13])
#define foo_TestMessPacked_test_enum (&lwpb_fields_foo_testmesspacked[14])

extern const struct lwpb_field_desc lwpb_fields_foo_testmessoptional[];

// 'TestMessOptional' field descriptor pointers
#define foo_TestMessOptional_test_int32 (&lwpb_fields_foo_testmessoptional[0])
#define foo_TestMessOptional_test_sint32 (&lwpb_fields_foo_testmessoptional[1])
#define foo_TestMessOptional_test_sfixed32 (&lwpb_fields_foo_testmessoptional[2])
#define foo_TestMessOptional_test_int64 (&lwpb_fields_foo_testmessoptional[3])
#define foo_TestMessOptional_test_sint64 (&lwpb_fields_foo_testmessoptional[4])
#define foo_TestMessOptional_test_sfixed64 (&lwpb_fields_foo_testmessoptional[5])
#define foo_TestMessOptional_test_uint32 (&lwpb_fields_foo_testmessoptional[6])
#define foo_TestMessOptional_test_fixed32 (&lwpb_fields_foo_testmessoptional[7])
#define foo_TestMessOptional_test_uint64 (&lwpb_fields_foo_testmessoptional[8])
#define foo_TestMessOptional_test_fixed64 (&lwpb_fields_foo_testmessoptional[9])
#define foo_TestMessOptional_test_float (&lwpb_fields_foo_testmessoptional[10])
#define foo_TestMessOptional_test_double (&lwpb_fields_foo_testmessoptional[11])
#define foo_TestMessOptional_test_boolean (&lwpb_fields_foo_testmessoptional[12])
#define foo_TestMessOptional_test_enum_small (&lwpb_fields_foo_testmessoptional[13])
#define foo_TestMessOptional_test_enum (&lwpb_fields_foo_testmessoptional[14])
#define foo_TestMessOptional_test_string (&lwpb_fields_foo_testmessoptional[15])
#define foo_TestMessOptional_test_bytes (&lwpb_fields_foo_testmessoptional[16])
#define foo_TestMessOptional_test_message (&lwpb_fields_foo_testmessoptional[17])

extern const struct lwpb_field_desc lwpb_fields_foo_testmessrequiredint32[];

// 'TestMessRequiredInt32' field descriptor pointers
#define foo_TestMessRequiredInt32_test (&lwpb_fields_foo_testmessrequiredint32[0])

extern const struct lwpb_field_desc lwpb_fields_foo_testmessrequiredsint32[];

// 'TestMessRequiredSInt32' field descriptor pointers
#define foo_TestMessRequiredSInt32_test (&lwpb_fields_foo_testmessrequiredsint32[0])

extern const struct lwpb_field_desc lwpb_fields_foo_testmessrequiredsfixed32[];

// 'TestMessRequiredSFixed32' field descriptor pointers
#define foo_TestMessRequiredSFixed32_test (&lwpb_fields_foo_testmessrequiredsfixed32[0])

extern const struct lwpb_field_desc lwpb_fields_foo_testmessrequiredint64[];

// 'TestMessRequiredInt64' field descriptor pointers
#define foo_TestMessRequiredInt64_test (&lwpb_fields_foo_testmessrequiredint64[0])

extern const struct lwpb_field_desc lwpb_fields_foo_testmessrequiredsint64[];

// 'TestMessRequiredSInt64' field descriptor pointers
#define foo_TestMessRequiredSInt64_test (&lwpb_fields_foo_testmessrequiredsint64[0])

extern const struct lwpb_field_desc lwpb_fields_foo_testmessrequiredsfixed64[];

// 'TestMessRequiredSFixed64' field descriptor pointers
#define foo_TestMessRequiredSFixed64_test (&lwpb_fields_foo_testmessrequiredsfixed64[0])

extern const struct lwpb_field_desc lwpb_fields_foo_testmessrequireduint32[];

// 'TestMessRequiredUInt32' field descriptor pointers
#define foo_TestMessRequiredUInt32_test (&lwpb_fields_foo_testmessrequireduint32[0])

extern const struct lwpb_field_desc lwpb_fields_foo_testmessrequiredfixed32[];

// 'TestMessRequiredFixed32' field descriptor pointers
#define foo_TestMessRequiredFixed32_test (&lwpb_fields_foo_testmessrequiredfixed32[0])

extern const struct lwpb_field_desc lwpb_fields_foo_testmessrequireduint64[];

// 'TestMessRequiredUInt64' field descriptor pointers
#define foo_TestMessRequiredUInt64_test (&lwpb_fields_foo_testmessrequireduint64[0])

extern const struct lwpb_field_desc lwpb_fields_foo_testmessrequiredfixed64[];

// 'TestMessRequiredFixed64' field descriptor pointers
#define foo_TestMessRequiredFixed64_test (&lwpb_fields_foo_testmessrequiredfixed64[0])

extern const struct lwpb_field_desc lwpb_fields_foo_testmessrequiredfloat[];

// 'TestMessRequiredFloat' field descriptor pointers
#define foo_TestMessRequiredFloat_test (&lwpb_fields_foo_testmessrequiredfloat[0])

extern const struct lwpb_field_desc lwpb_fields_foo_testmessrequireddouble[];

// 'TestMessRequiredDouble' field descriptor pointers
#define foo_TestMessRequiredDouble_test (&lwpb_fields_foo_testmessrequireddouble[0])

extern const struct lwpb_field_desc lwpb_fields_foo_testmessrequiredbool[];

// 'TestMessRequiredBool' field descriptor pointers
#define foo_TestMessRequiredBool_test (&lwpb_fields_foo_testmessrequiredbool[0])

extern const struct lwpb_field_desc lwpb_fields_foo_testmessrequiredenum[];

// 'TestMessRequiredEnum' field descriptor pointers
#define foo_TestMessRequiredEnum_test (&lwpb_fields_foo_testmessrequiredenum[0])

extern const struct lwpb_field_desc lwpb_fields_foo_testmessrequiredenumsmall[];

// 'TestMessRequiredEnumSmall' field descriptor pointers
#define foo_TestMessRequiredEnumSmall_test (&lwpb_fields_foo_testmessrequiredenumsmall[0])

extern const struct lwpb_field_desc lwpb_fields_foo_testmessrequiredstring[];

// 'TestMessRequiredString' field descriptor pointers
#define foo_TestMessRequiredString_test (&lwpb_fields_foo_testmessrequiredstring[0])

extern const struct lwpb_field_desc lwpb_fields_foo_testmessrequiredbytes[];

// 'TestMessRequiredBytes' field descriptor pointers
#define foo_TestMessRequiredBytes_test (&lwpb_fields_foo_testmessrequiredbytes[0])

extern const struct lwpb_field_desc lwpb_fields_foo_testmessrequiredmessage[];

// 'TestMessRequiredMessage' field descriptor pointers
#define foo_TestMessRequiredMessage_test (&lwpb_fields_foo_testmessrequiredmessage[0])

extern const struct lwpb_field_desc lwpb_fields_foo_emptymess[];

// 'EmptyMess' field descriptor pointers

extern const struct lwpb_field_desc lwpb_fields_foo_defaultrequiredvalues[];

// 'DefaultRequiredValues' field descriptor pointers
#define foo_DefaultRequiredValues_v_int32 (&lwpb_fields_foo_defaultrequiredvalues[0])
#define foo_DefaultRequiredValues_v_uint32 (&lwpb_fields_foo_defaultrequiredvalues[1])
#define foo_DefaultRequiredValues_v_int64 (&lwpb_fields_foo_defaultrequiredvalues[2])
#define foo_DefaultRequiredValues_v_uint64 (&lwpb_fields_foo_defaultrequiredvalues[3])
#define foo_DefaultRequiredValues_v_float (&lwpb_fields_foo_defaultrequiredvalues[4])
#define foo_DefaultRequiredValues_v_double (&lwpb_fields_foo_defaultrequiredvalues[5])
#define foo_DefaultRequiredValues_v_string (&lwpb_fields_foo_defaultrequiredvalues[6])
#define foo_DefaultRequiredValues_v_bytes (&lwpb_fields_foo_defaultrequiredvalues[7])

extern const struct lwpb_field_desc lwpb_fields_foo_defaultoptionalvalues[];

// 'DefaultOptionalValues' field descriptor pointers
#define foo_DefaultOptionalValues_v_int32 (&lwpb_fields_foo_defaultoptionalvalues[0])
#define foo_DefaultOptionalValues_v_uint32 (&lwpb_fields_foo_defaultoptionalvalues[1])
#define foo_DefaultOptionalValues_v_int64 (&lwpb_fields_foo_defaultoptionalvalues[2])
#define foo_DefaultOptionalValues_v_uint64 (&lwpb_fields_foo_defaultoptionalvalues[3])
#define foo_DefaultOptionalValues_v_float (&lwpb_fields_foo_defaultoptionalvalues[4])
#define foo_DefaultOptionalValues_v_double (&lwpb_fields_foo_defaultoptionalvalues[5])
#define foo_DefaultOptionalValues_v_string (&lwpb_fields_foo_defaultoptionalvalues[6])
#define foo_DefaultOptionalValues_v_bytes (&lwpb_fields_foo_defaultoptionalvalues[7])

extern const struct lwpb_field_desc lwpb_fields_foo_allocvalues[];

// 'AllocValues' field descriptor pointers
#define foo_AllocValues_o_bytes (&lwpb_fields_foo_allocvalues[0])
#define foo_AllocValues_r_string (&lwpb_fields_foo_allocvalues[1])
#define foo_AllocValues_a_string (&lwpb_fields_foo_allocvalues[2])
#define foo_AllocValues_a_bytes (&lwpb_fields_foo_allocvalues[3])
#define foo_AllocValues_a_mess (&lwpb_fields_foo_allocvalues[4])

extern const struct lwpb_service_desc lwpb_services_foo[];

// Service descriptor pointers

#endif // __TEST_FULL_PB2_H__

redpajama_set_name: RedPajamaGithub


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

namespace AdamS.OnlineStore.BusinessInterfaces
{
    public interface IShippingCalculator
    {
        decimal Calculate();
    }
}


text:
.class Landroid/media/MediaFocusControl$2;
.super Landroid/content/BroadcastReceiver;
.source "MediaFocusControl.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/media/MediaFocusControl;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic this$0:Landroid/media/MediaFocusControl;

# direct methods
.method constructor <init>(Landroid/media/MediaFocusControl;)V
    .locals 0

    .prologue
    .line 994
    iput-object p1, p0, Landroid/media/MediaFocusControl$2;->this$0:Landroid/media/MediaFocusControl;

    invoke-direct {p0}, Landroid/content/BroadcastReceiver;-><init>()V

    return-void
.end method

# virtual methods
.method public onReceive(Landroid/content/Context;Landroid/content/Intent;)V
    .locals 2
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "intent"    # Landroid/content/Intent;

    .prologue
    .line 996
    if-nez p2, :cond_1

    .line 1006
    :cond_0
    :goto_0
    return-void

    .line 999
    :cond_1
    invoke-virtual {p2}, Landroid/content/Intent;->getExtras()Landroid/os/Bundle;

    move-result-object v0

    .line 1000
    .local v0, "extras":Landroid/os/Bundle;
    if-eqz v0, :cond_0

    .line 1003
    const-string v1, "android.media.AudioService.WAKELOCK_ACQUIRED"

    invoke-virtual {v0, v1}, Landroid/os/Bundle;->containsKey(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_0

    .line 1004
    iget-object v1, p0, Landroid/media/MediaFocusControl$2;->this$0:Landroid/media/MediaFocusControl;

    # getter for: Landroid/media/MediaFocusControl;->mMediaEventWakeLock:Landroid/os/PowerManager$WakeLock;
    invoke-static {v1}, Landroid/media/MediaFocusControl;->access$1900(Landroid/media/MediaFocusControl;)Landroid/os/PowerManager$WakeLock;

    move-result-object v1

    invoke-virtual {v1}, Landroid/os/PowerManager$WakeLock;->release()V

    goto :goto_0
.end method


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

<TITLE>
SmackDebugger (Smack 3.3.0 Documentation)
</TITLE>

<META NAME="date" CONTENT="2013-05-04">

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

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

Smack

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

org.jivesoftware.smack.debugger

Interface SmackDebugger

All Known Implementing Classes:
ConsoleDebugger, EnhancedDebugger, LiteDebugger

public interface SmackDebugger

Interface that allows for implementing classes to debug XML traffic. That is a GUI window that
 displays XML traffic.

 Every implementation of this interface must have a public constructor with the following
 arguments: Connection, Writer, Reader.

Author:

Gaston Dombiak

Method Summary

 java.io.Reader
getReader()

          Returns the special Reader that wraps the main Reader and logs data to the GUI.

 PacketListener
getReaderListener()

          Returns the thread that will listen for all incoming packets and write them to the GUI.

 java.io.Writer
getWriter()

          Returns the special Writer that wraps the main Writer and logs data to the GUI.

 PacketListener
getWriterListener()

          Returns the thread that will listen for all outgoing packets and write them to the GUI.

 java.io.Reader
newConnectionReader(java.io.Reader reader)

          Returns a new special Reader that wraps the new connection Reader.

 java.io.Writer
newConnectionWriter(java.io.Writer writer)

          Returns a new special Writer that wraps the new connection Writer.

 void
userHasLogged(java.lang.String user)

          Called when a user has logged in to the server.

Method Detail

userHasLogged

void userHasLogged(java.lang.String user)

Called when a user has logged in to the server. The user could be an anonymous user, this
 means that the user would be of the form host/resource instead of the form
 user@host/resource.

Parameters:
user - the user@host/resource that has just logged in

getReader

java.io.Reader getReader()

Returns the special Reader that wraps the main Reader and logs data to the GUI.

Returns:
the special Reader that wraps the main Reader and logs data to the GUI.

getWriter

java.io.Writer getWriter()

Returns the special Writer that wraps the main Writer and logs data to the GUI.

Returns:
the special Writer that wraps the main Writer and logs data to the GUI.

newConnectionReader

java.io.Reader newConnectionReader(java.io.Reader reader)

Returns a new special Reader that wraps the new connection Reader. The connection
 has been secured so the connection is using a new reader and writer. The debugger
 needs to wrap the new reader and writer to keep being notified of the connection
 traffic.

Returns:
a new special Reader that wraps the new connection Reader.

newConnectionWriter

java.io.Writer newConnectionWriter(java.io.Writer writer)

Returns a new special Writer that wraps the new connection Writer. The connection
 has been secured so the connection is using a new reader and writer. The debugger
 needs to wrap the new reader and writer to keep being notified of the connection
 traffic.

Returns:
a new special Writer that wraps the new connection Writer.

getReaderListener

PacketListener getReaderListener()

Returns the thread that will listen for all incoming packets and write them to the GUI.
 This is what we call "interpreted" packet data, since it's the packet data as Smack sees
 it and not as it's coming in as raw XML.

Returns:
the PacketListener that will listen for all incoming packets and write them to
 the GUI

getWriterListener

PacketListener getWriterListener()

Returns the thread that will listen for all outgoing packets and write them to the GUI.

Returns:
the PacketListener that will listen for all sent packets and write them to
 the GUI

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

Smack

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2007 Jive Software.


text:
/****************************************************************************
 * Included Files
 ****************************************************************************/

#include <nuttx/config.h>

#include <assert.h>

#include <nuttx/mm/mm.h>

/****************************************************************************
 * Pre-processor Definitions
 ****************************************************************************/

/****************************************************************************
 * Private Functions
 ****************************************************************************/

/****************************************************************************
 * Public Functions
 ****************************************************************************/

/****************************************************************************
 * Name: mm_memalign
 *
 * Description:
 *   memalign requests more than enough space from malloc, finds a region
 *   within that chunk that meets the alignment request and then frees any
 *   leading or trailing space.
 *
 *   The alignment argument must be a power of two (not checked).  8-byte
 *   alignment is guaranteed by normal malloc calls.
 *
 ****************************************************************************/

FAR void *mm_memalign(FAR struct mm_heap_s *heap, size_t alignment,
                      size_t size)
{
  FAR struct mm_allocnode_s *node;
  size_t rawchunk;
  size_t alignedchunk;
  size_t mask = (size_t)(alignment - 1);
  size_t allocsize;

  /* If this requested alinement's less than or equal to the natural alignment
   * of malloc, then just let malloc do the work.
   */

  if (alignment <= MM_MIN_CHUNK)
    {
      return mm_malloc(heap, size);
    }

  /* Adjust the size to account for (1) the size of the allocated node, (2)
   * to make sure that it is an even multiple of our granule size, and to
   * include the alignment amount.
   *
   * Notice that we increase the allocation size by twice the requested
   * alignment.  We do this so that there will be at least two valid
   * alignment points within the allocated memory.
   *
   * NOTE:  These are sizes given to malloc and not chunk sizes. They do
   * not include SIZEOF_MM_ALLOCNODE.
   */

  size      = MM_ALIGN_UP(size);   /* Make multiples of our granule size */
  allocsize = size + 2*alignment;  /* Add double full alignment size */

  /* Then malloc that size */

  rawchunk = (size_t)mm_malloc(heap, allocsize);
  if (rawchunk == 0)
    {
      return NULL;
    }

  /* We need to hold the MM semaphore while we muck with the chunks and
   * nodelist.
   */

  mm_takesemaphore(heap);

  /* Get the node associated with the allocation and the next node after
   * the allocation.
   */

  node = (FAR struct mm_allocnode_s*)(rawchunk - SIZEOF_MM_ALLOCNODE);

  /* Find the aligned subregion */

  alignedchunk = (rawchunk + mask) & ~mask;

  /* Check if there is free space at the beginning of the aligned chunk */

  if (alignedchunk != rawchunk)
    {
      FAR struct mm_allocnode_s *newnode;
      FAR struct mm_allocnode_s *next;
      size_t precedingsize;

      /* Get the node the next node after the allocation. */

      next = (FAR struct mm_allocnode_s*)((char*)node + node->size);

      /* Make sure that there is space to convert the preceding mm_allocnode_s
       * into an mm_freenode_s.  I think that this should always be true
       */

      DEBUGASSERT(alignedchunk >= rawchunk + 8);

      newnode = (FAR struct mm_allocnode_s*)(alignedchunk - SIZEOF_MM_ALLOCNODE);

      /* Preceding size is full size of the new 'node,' including
       * SIZEOF_MM_ALLOCNODE
       */

      precedingsize = (size_t)newnode - (size_t)node;

      /* If we were unlucky, then the alignedchunk can lie in such a position
       * that precedingsize < SIZEOF_NODE_FREENODE.  We can't let that happen
       * because we are going to cast 'node' to struct mm_freenode_s below.
       * This is why we allocated memory large enough to support two
       * alignment points.  In this case, we will simply use the second
       * alignment point.
       */

      if (precedingsize < SIZEOF_MM_FREENODE)
        {
          alignedchunk += alignment;
          newnode       = (FAR struct mm_allocnode_s*)(alignedchunk - SIZEOF_MM_ALLOCNODE);
          precedingsize = (size_t)newnode - (size_t)node;
        }

      /* Set up the size of the new node */

      newnode->size = (size_t)next - (size_t)newnode;
      newnode->preceding = precedingsize | MM_ALLOC_BIT;

      /* Reduce the size of the original chunk and mark it not allocated, */

      node->size = precedingsize;
      node->preceding &= ~MM_ALLOC_BIT;

      /* Fix the preceding size of the next node */

      next->preceding = newnode->size | (next->preceding & MM_ALLOC_BIT);

      /* Convert the newnode chunk size back into malloc-compatible size by
       * subtracting the header size SIZEOF_MM_ALLOCNODE.
       */

      allocsize = newnode->size - SIZEOF_MM_ALLOCNODE;

      /* Add the original, newly freed node to the free nodelist */

      mm_addfreechunk(heap, (FAR struct mm_freenode_s *)node);

      /* Replace the original node with the newlay realloaced,
       * aligned node
       */

      node = newnode;
    }

  /* Check if there is free space at the end of the aligned chunk */

  if (allocsize > size)
    {
      /* Shrink the chunk by that much -- remember, mm_shrinkchunk wants
       * internal chunk sizes that include SIZEOF_MM_ALLOCNODE, and not the
       * malloc-compatible sizes that we have.
       */

      mm_shrinkchunk(heap, node, size + SIZEOF_MM_ALLOCNODE);
    }

  mm_givesemaphore(heap);
  return (FAR void*)alignedchunk;
}


text:
Over the last 8 years I have used and tweaked Vim. This is my Ultimate vimrc.

There are two versions:

* **Basic**: If you want something small just copy [basic.vim](https://github.com/amix/vimrc/blob/master/vimrcs/basic.vim) into your ~/.vimrc and you will have a great basic setup
* **Awesome**: This includes a ton of useful plugins, color schemes and configurations

I would of course recommend using the awesome version.

## How to install the Basic version?
The basic version is basically just one file and no plugins. You can check out [basic.vim](https://github.com/amix/vimrc/blob/master/vimrcs/basic.vim).

This is useful to install on remote servers where you don't need many plugins and you don't do many edits.

	git clone git://github.com/amix/vimrc.git ~/.vim_runtime
	sh ~/.vim_runtime/install_basic_vimrc.sh

## How to install the Awesome version?
The awesome version includes a lot of great plugins, configurations and color schemes that make Vim a lot better. To install it simply do following:

	git clone git://github.com/amix/vimrc.git ~/.vim_runtime
	sh ~/.vim_runtime/install_awesome_vimrc.sh

## How to install on Windows?

Use [msysgit](http://msysgit.github.com/) to checkout the repository and run the installation instructions above. No special instructions needed ;-)

## How to update to latest version?

Simply just do a git rebase!

    cd ~/.vim_runtime
    git pull --rebase

## Some screenshots

Colors when editing a Python file:
![Screenshot 1](http://files1.wedoist.com/e952fdb343b1e617b90d256e474d0370/as/screenshot_1.png)

Opening recently opened files [mru.vim](https://github.com/vim-scripts/mru.vim):
![Screenshot 2](http://files1.wedoist.com/1967b0e48af40e513d1a464e08196990/as/screenshot_2.png)

[NERD Tree](https://github.com/scrooloose/nerdtree) plugin in a terminal window:
![Screenshot 3](http://files1.wedoist.com/b1509d7ed9e9f357e8d04797f9fad67b/as/screenshot3.png)

This vimrc even works on Windows!
![Screenshot 4](http://files1.wedoist.com/4e85163d97b81422240c822c82022f2f/as/screenshot_4.png)

## What plugins are included?

I recommend reading the docs of these plugins to understand them better. Each of them provide a much better Vim experience!

* [pathogen.vim](https://github.com/tpope/vim-pathogen): Manages the runtime path of the plugins
* [YankRing](https://github.com/vim-scripts/YankRing.vim): Maintains a history of previous yanks, changes and deletes
* [snipMate.vim](https://github.com/garbas/vim-snipmate): snipMate.vim aims to be a concise vim script that implements some of TextMate's snippets features in Vim
* [bufexplorer.zip](https://github.com/vim-scripts/bufexplorer.zip): Buffer Explorer / Browser. This plugin can be opened with `<leader+o>`
* [NERD Tree](https://github.com/scrooloose/nerdtree): A tree explorer plugin for vim
* [ack.vim](github.com/mileszs/ack.vim): Vim plugin for the Perl module / CLI script 'ack'
* [vim-powerline](https://github.com/Lokaltog/vim-powerline): The ultimate vim statusline utility
* [ctrlp.vim](https://github.com/kien/ctrlp.vim): Fuzzy file, buffer, mru and tag finder. In my config it's mapped to `<Ctrl+F>`, because `<Ctrl+P>` is used by YankRing
* [mru.vim](https://github.com/vim-scripts/mru.vim): Plugin to manage Most Recently Used (MRU) files. Includes my own fork which adds syntax highlighting to MRU. This plugin can be opened with `<leader+f>`
* [open_file_under_cursor.vim](https://github.com/amix/open_file_under_cursor.vim): Open file under cursor when pressing `gf`
* [zencoding](https://github.com/mattn/zencoding-vim): Expanding abbreviation like zen-coding, very useful for editing XML, HTML.
* [vim-indent-object](https://github.com/michaeljsmith/vim-indent-object): Defines a new text object representing lines of code at the same indent level. Useful for python/vim scripts
* [taglist.vim](https://github.com/vim-scripts/taglist.vim): Source code browser (supports C/C++, java, perl, python, tcl, sql, php, etc)
* [vim-multiple-cursors](https://github.com/terryma/vim-multiple-cursors): Sublime Text style multiple selections for Vim, CTRL+N is remapped to CTRL+S (due to YankRing)
* [vim-expand-region](https://github.com/terryma/vim-expand-region): Allows you to visually select increasingly larger regions of text using the same key combination.

## What color schemes are included?

* [peaksea](https://github.com/vim-scripts/peaksea): My favorite!
* [vim-colors-solarized](https://github.com/altercation/vim-colors-solarized)
* [vim-irblack](https://github.com/wgibbs/vim-irblack)
* [mayansmoke](https://github.com/vim-scripts/mayansmoke)
* [vim-pyte](https://github.com/therubymug/vim-pyte)

## What modes are included?

* [vim-coffee-script](https://github.com/kchmck/vim-coffee-script)
* [vim-less](https://github.com/groenewege/vim-less)
* [vim-bundle-mako](https://github.com/sophacles/vim-bundle-mako)
* [vim-markdown](https://github.com/tpope/vim-markdown)
* [nginx.vim](https://github.com/vim-scripts/nginx.vim): Highlights configuration files for nginx

## How to include your own stuff?

After you have installed the setup you can create **~/.vim_runtime/my_configs.vim** to fill in any configurations that are important for you. For instance, my **my_configs.vim** looks like this:

	~/.vim_runtime (master)> cat my_configs.vim
	map <leader>ct :cd ~/Desktop/Todoist/todoist<cr>
	map <leader>cw :cd ~/Desktop/Wedoist/wedoist<cr>

You can also install your own plugins, for instance, via pathogen we can install [vim-rails](https://github.com/tpope/vim-rails):

	cd ~/.vim_runtime
	git clone git://github.com/tpope/vim-rails.git sources_non_forked/vim-rails

Now you have vim-rails installed ;-)

## Key Mappings

### Plugin related mappings

Open [bufexplorer](https://github.com/vim-scripts/bufexplorer.zip) and see and manage the current buffers:

    map <leader>o :BufExplorer<cr>

Open [MRU.vim](https://github.com/vim-scripts/mru.vim) and see the recently open files:

    map <leader>f :MRU<CR>

Open [ctrlp.vim](https://github.com/kien/ctrlp.vim) plugin:

    let g:ctrlp_map = '<c-f>'

Open [PeepOpen](https://peepcode.com/products/peepopen) plugin:

    map <leader>j :PeepOpen<cr>

Managing the [NERD Tree](https://github.com/scrooloose/nerdtree) plugin:

    map <leader>nn :NERDTreeToggle<cr>
    map <leader>nb :NERDTreeFromBookmark
    map <leader>nf :NERDTreeFind<cr>

### Normal mode mappings

Fast saving of a buffer:

	nmap <leader>w :w!<cr>

Treat long lines as break lines (useful when moving around in them):

	map j gj
	map k gk

Map `<Space>` to `/` (search) and `<Ctrl>+<Space>` to `?` (backwards search):

	map <space> /
	map <c-space> ?
	map <silent> <leader><cr> :noh<cr>

Disable highlight when `<leader><cr>` is pressed:

	map <silent> <leader><cr> :noh<cr>

Smart way to move between windows:

	map <C-j> <C-W>j
	map <C-k> <C-W>k
	map <C-h> <C-W>h
	map <C-l> <C-W>l

Closing of current buffer(s):

	" Close current buffer
	map <leader>bd :Bclose<cr>

	" Close all buffers
	map <leader>ba :1,1000 bd!<cr>

Useful mappings for managing tabs:

	map <leader>tn :tabnew<cr>
	map <leader>to :tabonly<cr>
	map <leader>tc :tabclose<cr>
	map <leader>tm :tabmove

	" Opens a new tab with the current buffer's path
	" Super useful when editing files in the same directory
	map <leader>te :tabedit <c-r>=expand("%:p:h")<cr>/

Switch CWD to the directory of the open buffer:

	map <leader>cd :cd %:p:h<cr>:pwd<cr>

Open vimgrep and put the cursor in the right position:

	map <leader>g :vimgrep // **/*.<left><left><left><left><left><left><left>

Vimgreps in the current file:

	map <leader><space> :vimgrep // <C-R>%<C-A><right><right><right><right><right><right><right><right><right>

Remove the Windows ^M - when the encodings gets messed up:

	noremap <leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm

Quickly open a buffer for scripbble:

	map <leader>q :e ~/buffer<cr>

Toggle paste mode on and off:

	map <leader>pp :setlocal paste!<cr>

### Insert mode mappings

Quickly insert parenthesis/brackets/etc.:

    inoremap $1 ()<esc>i
    inoremap $2 []<esc>i
    inoremap $3 {}<esc>i
    inoremap $4 {<esc>o}<esc>O
    inoremap $q ''<esc>i
    inoremap $e ""<esc>i
    inoremap $t <><esc>i

Insert the current date and time (useful for timestamps):

    iab xdate <c-r>=strftime("%d/%m/%y %H:%M:%S")<cr>

### Visual mode mappings

Visual mode pressing `*` or `#` searches for the current selection:

	vnoremap <silent> * :call VisualSelection('f')<CR>
	vnoremap <silent> # :call VisualSelection('b')<CR>

When you press gv you vimgrep after the selected text:

	vnoremap <silent> gv :call VisualSelection('gv')<CR>

When you press `<leader>r` you can search and replace the selected text:

	vnoremap <silent> <leader>r :call VisualSelection('replace')<CR>

Surround the visual selection in parenthesis/brackets/etc.:

    vnoremap $1 <esc>`>a)<esc>`<i(<esc>
    vnoremap $2 <esc>`>a]<esc>`<i[<esc>
    vnoremap $3 <esc>`>a}<esc>`<i{<esc>
    vnoremap $$ <esc>`>a"<esc>`<i"<esc>
    vnoremap $q <esc>`>a'<esc>`<i'<esc>
    vnoremap $e <esc>`>a"<esc>`<i"<esc>

### Command line mappings

$q is super useful when browsing on the command line. It deletes everything until the last slash:

    cno $q <C-\>eDeleteTillSlash()<cr>

Bash like keys for the command line:

    cnoremap <C-A>		<Home>
    cnoremap <C-E>		<End>
    cnoremap <C-K>		<C-U>

    cnoremap <C-P> <Up>
    cnoremap <C-N> <Down>

Write the file as sudo (only on Unix). Super useful when you open a file and you don't have permissions to save your changes. [Vim tip](http://vim.wikia.com/wiki/Su-write):

    :W

### Spell checking
Pressing `<leader>ss` will toggle and untoggle spell checking

    map <leader>ss :setlocal spell!<cr>

Shortcuts using `<leader>` instead of special chars

    map <leader>sn ]s
    map <leader>sp [s
    map <leader>sa zg
    map <leader>s? z=

### Cope
Do :help cope if you are unsure what cope is. It's super useful!

When you search with vimgrep, display your results in cope by doing:
`<leader>cc`

To go to the next search result do:
`<leader>n`

To go to the previous search results do:
`<leader>p`

Vimscript mappings:

    map <leader>cc :botright cope<cr>
    map <leader>co ggVGy:tabnew<cr>:set syntax=qf<cr>pgg
    map <leader>n :cn<cr>
    map <leader>p :cp<cr>

## Useful blog tips regarding my Vim setup

* [Vim: Annotate strings with gettext (the macro way)](http://amix.dk/blog/post/19678#Vim-Annotate-strings-with-gettext-the-macro-way)
* [vimgrep: Searching through multiple file extensions](http://amix.dk/blog/post/19672#vimgrep-Searching-through-multiple-file-extensions)
* [Filtering through vimgrep results using regular expressions](http://amix.dk/blog/post/19666#Filtering-through-vimgrep-results-using-regular-expressions)
* [PeepOpen - File auto completion for Mac editors](http://amix.dk/blog/post/19601#PeepOpen-File-auto-completion-for-Mac-editors)
* [Vim 7.3: Persistent undo and encryption!](http://amix.dk/blog/post/19548#Vim-7-3-Persistent-undo-and-encryption)
* [Vim tips: Visual Search](http://amix.dk/blog/post/19334#Vim-tips-Visual-Search)
* [Folding in Vim](http://amix.dk/blog/post/19132#Folding-in-Vim)


text:
package edu.cmu.hcii.whyline.bytecode;

import edu.cmu.hcii.whyline.trace.EventKind;

/**
 * @author Andrew J. Ko
 *
 */
public final class LLOAD_0 extends GetLocal {

	public LLOAD_0(CodeAttribute method) {
		super(method);
	}

	public int getLocalID() { return 0; }

	public final int getOpcode() { return 30; }
	public int byteLength() { return 1; }

	public EventKind getTypeProduced() { return EventKind.LONG_PRODUCED; }

}


text:
  <button class="menu-toggle">Menu</button>

    Design Army

  <button class="filter-toggle">Work</button>

  <?php
  if (has_nav_menu('primary_navigation')) :
    wp_nav_menu(array('theme_location' => 'primary_navigation', 'container' => false, 'items_wrap' => '
%3$s
'));
  endif;
  ?>


text:
package ch.fhnw.ether.formats.obj;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;

import ch.fhnw.ether.formats.ModelMaterial;
import ch.fhnw.ether.formats.ModelObject;
import ch.fhnw.util.Log;
import ch.fhnw.util.TextUtilities;
import ch.fhnw.util.color.RGB;

final class MtlParser {
	private static final Log log = Log.create();

	private final ModelObject object;
	private final String path;
	private final String file;

	private ModelMaterial currentMaterial;

	public MtlParser(ModelObject object, String path, String file) {
		this.object = object;
		this.path = path;
		this.file = file;
	}

	public void parse() {
		InputStream input = this.getClass().getResourceAsStream(path + file);
		if (input == null) {
			try {
				input = new FileInputStream(new File(path + file));
			} catch (Exception e) {
				log.warning("Could not open MTL file: '" + (path + file) + "'");
				return;
			}
		}

		int line = 1;
		try (BufferedReader in = new BufferedReader(new InputStreamReader(input))) {
			for (String string = null; (string = in.readLine()) != null;) {
				parseLine(string, line);
				line++;
			}
		} catch (Exception e) {
			throw new RuntimeException("Error reading MTL file: '" + path + "' (line " + line + ")");
		}
	}

	private void parseLine(String string, int line) {
		if ("".equals(string))
			return;

		String[] words = TextUtilities.tokens(string);

		if (words.length == 0 || words[0].startsWith("#"))
			return;

		switch (words[0]) {
		case "newmtl":
			currentMaterial = new ModelMaterial(words[1]);
			object.getMaterials().put(words[1], currentMaterial);
			break;
		case "Ka":
			currentMaterial.setAmbientColor(new RGB(Float.parseFloat(words[1]), Float.parseFloat(words[2]), Float.parseFloat(words[3])));
			break;
		case "Ke":
			currentMaterial.setEmissionColor(new RGB(Float.parseFloat(words[1]), Float.parseFloat(words[2]), Float.parseFloat(words[3])));
			break;
		case "Kd":
			currentMaterial.setDiffuseColor(new RGB(Float.parseFloat(words[1]), Float.parseFloat(words[2]), Float.parseFloat(words[3])));
			break;
		case "Ks":
			currentMaterial.setSpecularColor(new RGB(Float.parseFloat(words[1]), Float.parseFloat(words[2]), Float.parseFloat(words[3])));
			break;
		case "Ns":
			currentMaterial.setShininess(Float.parseFloat(words[1]));
			break;
		case "map_Kd":
			currentMaterial.setTexture(path, words[words.length - 1]);
			break;
		case "Ni":
		case "d":
		case "illum":
			break;
		default:
			log.info("Ignoring unknown MTL key '" + words[0] + "' (line " + line + ")");
		}
	}
}


text:
local World = {}
World.__index = World

function World.create(width, height, screen_width, screen_height, resolution)
  local w = {}
  setmetatable(w, World)
  w.seed = {}
  w.map = {}
  w.amplitude = {0.6, 0.3, 0.04}
  w.scale = {0.007, 0.02, 0.09}
  -- w.scale = {0.001, 0.006, 0.03}
  w.width, w.height = width, height
  w.screen_width, w.screen_height = screen_width, screen_height
  w.offset = {}
  w.offset.y, w.offset.x = 0, 0
  w.biomes = {}
  plains = {}
  plains.deep_water = {90, 203, 243, 255}
  plains.shallow_water = {152, 218, 246, 255}
  plains.beach = {214, 205, 170, 255}
  plains.low_land = {153, 172, 128, 255}
  plains.mid_land = {137, 166, 107, 255}
  plains.hills = {88, 132, 112, 255}
  table.insert(w.biomes, plains)
  desert = {}
  desert.deep_water = {80, 193, 233, 255}
  desert.shallow_water = {152, 218, 246, 255}
  desert.beach = {119, 136, 152, 255}
  desert.low_land = {255, 221, 85, 255}
  desert.mid_land = {200, 109, 25, 255}
  desert.hills = {204, 85, 51, 255}
  table.insert(w.biomes, desert)
  w.deep_water = 0.15
  w.shallow_water = 0.28
  w.beach = 0.33
  w.low_land = 0.4
  w.mid_land = 0.55
  w.traversable = w.beach
  w.path_map = {}
  w.resolution = resolution
  return w
end

function World:newSeed()
  self.seed[1] = math.random() * 100
  self.seed[2] = math.random() * 100
  self.seed[3] = math.random() * 100
  return self.seed
end

function World:makeHeightMap()
  base_layer = 0
  lump_layer = 0
  more_lumps = 0
  for i = 1, math.ceil((self.width + 1)/self.resolution) do
    self.map[i] = {}
    for j = 1, math.ceil((self.height + 1)/self.resolution) do
      base_layer = self.amplitude[1] * love.math.noise(self.scale[1] * i + self.seed[1], self.scale[1] * j + self.seed[1])
      lump_layer = self.amplitude[2] * love.math.noise(self.scale[2] * i + self.seed[2], self.scale[2] * j + self.seed[2])
      more_lumps = self.amplitude[3] * love.math.noise(self.scale[3] * i + self.seed[3], self.scale[3] * j + self.seed[3])
      self.map[i][j] = base_layer + lump_layer + more_lumps
    end
  end
end

function World:makePathMap()
  for i = 1, math.ceil((self.width + 1)/self.resolution) do
    for j = 1, math.ceil((self.height + 1)/self.resolution) do
      node = {}
      node.x = i
      node.y = j
      if self.map[i][j] > self.traversable then
        table.insert(self.path_map, node)
      end
    end
  end
end

function World:generate()
  self.path_map = {}
  self:makeHeightMap()
  self:makePathMap()
  -- self.path_map = combineMaps(findBiggestIsland(self.path_map), findBiggestIsland(reverseMap(self.path_map)))
  return self.path_map
end

function combineMaps(mapa, mapb)
  local new_map = mapa
  for _, node in ipairs(mapb) do
    if not nodeInSet(node, new_map) then
      table.insert(new_map, node)
    end
  end
  return new_map
end

function reverseMap(map)
  local reversed = {}
  for i  = #map, 1, -1 do
    table.insert(reversed, map[i])
  end
  return reversed
end

function findBiggestIsland(map)
  local lumps = {{map[1]}}  --lumps are islands, but lumps sounds cuter
  for i, node in ipairs(map) do
    local in_lump = false
    local the_lump = 1
    for j, lump in ipairs(lumps) do
      if nodeInSet(node, lump) then
        in_lump = true
        the_lump = j
        break
      else
        in_lump = false
      end
    end
    neighbours_of_node = findNeighbours(node, map)
    if in_lump == true then
      for _, neighbour in ipairs(neighbours_of_node) do
        if not nodeInSet(neighbour, lumps[the_lump]) then
          table.insert(lumps[the_lump], neighbour)
        end
      end
    else
      local new_lump = {}
      for _, neighbour in ipairs(neighbours_of_node) do
        table.insert(new_lump, neighbour)
      end
      table.insert(lumps, new_lump)
    end
  end

-- join neighbouring lumps here

  local cleaned_map = {}
  for i, lump in ipairs(lumps) do
    if #lump > #cleaned_map then
      cleaned_map = lump
    end
  end
  return cleaned_map
end

function combineSets(seta, setb)
  local new_set = {}
  for _, i in ipairs(seta) do
    table.insert(new_set, i)
  end
  for _, i in ipairs(setb) do
    table.insert(new_set, i)
  end
  return new_set
end

function getAverageValue(map, x, y, radius, height, width)
  culminator = 0
  if x < math.ceil(radius/2) or y < math.ceil(radius/2) then
    radius = math.min (x, y)
  end
  if width - x < math.ceil(radius/2) or height - y < math.ceil(radius/2) then
    radius = math.min (width - x, height - y)
  end
  for i = (x - math.floor(radius/2)), (x + math.floor(radius/2)) do
    for j = (y - math.floor(radius/2)), (y + math.floor(radius/2)) do
      culminator = culminator + map[i][j]
    end
  end
  culminator = culminator / (radius * radius)
  return culminator
end

function World:makeCanvas(biome)
  local setColor = lg.setColor
  local rectangle = lg.rectangle
  -- Draw the Height Map to a canvas
  self.canvas = lg.newCanvas(self.width, self.height)
  lg.setCanvas(self.canvas)
  -- Render Base colors
  for i = 1, math.ceil((self.width + 1)/self.resolution) do
    for j = 1, math.ceil((self.height + 1)/self.resolution) do
      if self.map[i][j] < self.deep_water then
        color = mixColors(self.biomes[biome].deep_water, self.biomes[biome].deep_water, self.map[i][j], self.deep_water, 0.0)
        setColor(color)
      elseif self.map[i][j] < self.shallow_water then
        color = mixColors(self.biomes[biome].deep_water, self.biomes[biome].shallow_water, self.map[i][j], self.shallow_water, self.deep_water)
        setColor(color)
      elseif self.map[i][j] < self.beach then
        color = mixColors(self.biomes[biome].shallow_water, self.biomes[biome].beach, self.map[i][j], self.beach, self.shallow_water)
        setColor(color)
      elseif self.map[i][j] < self.low_land then
        color = mixColors(self.biomes[biome].beach, self.biomes[biome].low_land, self.map[i][j], self.low_land, self.beach)
        setColor(color)
      elseif self.map[i][j] < self.mid_land then
        color = mixColors(self.biomes[biome].low_land, self.biomes[biome].mid_land, self.map[i][j], self.mid_land, self.low_land)
        setColor(color)
      else
        color = mixColors(self.biomes[biome].mid_land, self.biomes[biome].hills, self.map[i][j], 1.0, self.mid_land)
        setColor(color)
      end
      -- lg.point( i - 1, j - 1 )
      rectangle("fill", self.resolution * (i-1), self.resolution * (j-1), self.resolution, self.resolution)
    end
  end
  lg.setCanvas()
  self.debug_canvas = lg.newCanvas(self.width, self.height)
  lg.setCanvas(self.debug_canvas)
  lg.setColor(200, 0, 255, 255)
  for i, node in ipairs(self.path_map) do
    lg.rectangle("fill", node.x * self.resolution , node.y * self.resolution, 2, 2)
  end
  lg.setCanvas()
end

function World:drawDebug()
  lg.draw(self.debug_canvas, self.offset.x, self.offset.y)
end

function mixColors(color1, color2, val, max, min)
  new_color = {0, 0, 0, 255}
  denominator = max - min
  numerator = val - min
  mix_colors_ratio = numerator / denominator
  complement = 1 - mix_colors_ratio
  new_color[1] = (color2[1]* mix_colors_ratio + color1[1] * complement)
  new_color[2] = (color2[2]* mix_colors_ratio + color1[2] * complement)
  new_color[3] = (color2[3]* mix_colors_ratio + color1[3] * complement)
  return new_color
end

function World:draw()
  lg.draw(self.canvas, self.offset.x, self.offset.y)
end

function World:update()
  if love.keyboard.isDown("s") then
    self.offset.y = self.offset.y - self.resolution
  end
  if love.keyboard.isDown("w") then
    self.offset.y = self.offset.y + self.resolution
  end
  if love.keyboard.isDown("d") then
    self.offset.x = self.offset.x - self.resolution
  end
  if love.keyboard.isDown("a") then
    self.offset.x = self.offset.x + self.resolution
  end
  if self.offset.y > 0 then
    self.offset.y = 0
  elseif self.offset.y < self.screen_height - self.height then
    self.offset.y = self.screen_height - self.height
  end
  if self.offset.x < self.screen_width - self.width then
    self.offset.x = self.screen_width - self.width
  elseif self.offset.x > 0 then
      self.offset.x = 0
  end
end
return World


text:
package cz.zcu.kiv.jop.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * This annotation may be used case that a generated Object has multiple constructors to
 * prevent ambiguity which constructor will be used for Object construction. Also allows to
 * annotate static method which may be used for construction of some Object.
 *
 * @author Mr.FrAnTA
 * @since 1.0.0
 */
@Documented
@Target({ElementType.CONSTRUCTOR, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Constructor {

}


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

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

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

#include "Ethereal.h"
#include "BeamSaber.h"

#define LOCTEXT_NAMESPACE "EtherealText"

// Sets default values
ABeamSaber::ABeamSaber(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{
	// Get Assets, References Obtained Via Right Click in Editor
	static ConstructorHelpers::FObjectFinder<USkeletalMesh> SkeletalMeshObject(TEXT("SkeletalMesh'/Game/VFX/sphere_skeletal.sphere_skeletal'"));
	static ConstructorHelpers::FObjectFinder<UStaticMesh> StaticMeshObject(TEXT("StaticMesh'/Game/Weapons/Novelty/saber-hilt.saber-hilt'"));
	static ConstructorHelpers::FObjectFinder<UStaticMesh> BeamMeshObject(TEXT("StaticMesh'/Game/Weapons/Novelty/saber-blade.saber-blade'"));
	static ConstructorHelpers::FObjectFinder<UStaticMesh> OffhandMeshObject(TEXT("StaticMesh'/Game/VFX/sphere.sphere'"));
	static ConstructorHelpers::FObjectFinder<UTexture2D> LargeIconObject(TEXT("Texture2D'/Game/Blueprints/Widgets/UI-Images/Icons_Gear/WeaponIcon_BeamSaber.WeaponIcon_BeamSaber'"));
	static ConstructorHelpers::FObjectFinder<UTexture2D> SmallIconObject(TEXT("Texture2D'/Game/Blueprints/Widgets/UI-Images/Icons_Gear/WeaponIcon_BeamSaber-small.WeaponIcon_BeamSaber-small'"));
	static ConstructorHelpers::FObjectFinder<UCurveFloat> Curve(TEXT("CurveFloat'/Game/Weapons/Novelty/Curve_BeamSaber.Curve_BeamSaber'"));
	static ConstructorHelpers::FObjectFinder<USoundCue> IgnitionAudioObject(TEXT("SoundCue'/Game/Weapons/Novelty/BeamSaber_Ignition_Cue.BeamSaber_Ignition_Cue'"));
	static ConstructorHelpers::FObjectFinder<USoundCue> OffAudioObject(TEXT("SoundCue'/Game/Weapons/Novelty/BeamSaber_Off_Cue.BeamSaber_Off_Cue'"));
	static ConstructorHelpers::FObjectFinder<USoundCue> IdleAudioObject(TEXT("SoundCue'/Game/Weapons/Novelty/BeamSaber_Idle_Cue.BeamSaber_Idle_Cue'"));

	// Set Default Objects
	Name = EMasterGearList::GL_BeamSaber;
	NameText = LOCTEXT("BeamSaberName", "Beam Saber");
	Type = EMasterGearTypes::GT_OneHanded;
	TypeText = LOCTEXT("BeamSaberType", "One-Handed");
	Description = "An elegant weapon for a more civilized age.";
	Price = 50000;
	MPCost = 0.0f;
	ATK = 60.0f;
	DEF = 40.0f;
	SPD = 20.0f;
	HP = 500.0f;
	MP = 250.0f;
	LargeIcon = LargeIconObject.Object;
	SmallIcon = SmallIconObject.Object;

	SK_WeaponSkeletalMesh = SkeletalMeshObject.Object;
	SM_WeaponStaticMesh = StaticMeshObject.Object;
	SM_BeamMesh = BeamMeshObject.Object;
	SM_WeaponOffhandMesh = StaticMeshObject.Object;
	BeamCurve = Curve.Object;
	S_IgnitionAudio = IgnitionAudioObject.Object;
	S_OffAudio = OffAudioObject.Object;
	S_IdleAudio = IdleAudioObject.Object;

	// Set Mesh
	WeaponSkeletalMesh->SetSkeletalMesh(SK_WeaponSkeletalMesh);

	WeaponStaticMesh->SetStaticMesh(SM_WeaponStaticMesh);
	WeaponStaticMesh->SetWorldScale3D(FVector(0.15f, 0.15f, 0.15f)); // Scale correction
	WeaponStaticMesh->SetRelativeLocation(FVector(-5, 1, 0));
	WeaponStaticMesh->SetRelativeRotation(FRotator(-76, 160, 168));

	WeaponOffhandMesh->SetStaticMesh(SM_WeaponOffhandMesh);

	BeamMesh = ObjectInitializer.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("Beam Mesh"));
	BeamMesh->SetStaticMesh(SM_BeamMesh);
	BeamMesh->SetupAttachment(WeaponStaticMesh, FName(TEXT("BeamSocket")));
	BeamMesh->SetVisibility(false);
	UCommonLibrary::SetupSMComponentsWithCollision(BeamMesh);
	BeamMesh->SetRelativeScale3D(FVector(0.2f, 0.2f, 0.0f)); // Scale correction
	BeamMesh->SetRelativeLocation(FVector(-175, 0, 23));
	BeamMesh->SetRelativeRotation(FRotator(60, -90, -90));

	SwordCollider->SetupAttachment(WeaponSkeletalMesh);
	SwordCollider->SetBoxExtent(FVector(10.0f, 10.0f, 60.0f));
	SwordCollider->SetRelativeLocation(FVector(0.0f, 0.0f, 55.0f));

	BeamTimeline = ObjectInitializer.CreateDefaultSubobject<UTimelineComponent>(this, TEXT("BeamTimeline"));
	InterpFunction.BindUFunction(this, FName{ TEXT("TimelineFloatReturn") });

	IgnitionAudio = ObjectInitializer.CreateDefaultSubobject<UAudioComponent>(this, TEXT("IgnitionAudio"));
	IgnitionAudio->SetupAttachment(RootComponent);
	IgnitionAudio->Sound = S_IgnitionAudio;
	IgnitionAudio->bAutoActivate = false;

	OffAudio = ObjectInitializer.CreateDefaultSubobject<UAudioComponent>(this, TEXT("OffAudio"));
	OffAudio->SetupAttachment(RootComponent);
	OffAudio->Sound = S_OffAudio;
	OffAudio->bAutoActivate = false;

	IdleAudio = ObjectInitializer.CreateDefaultSubobject<UAudioComponent>(this, TEXT("IdleAudio"));
	IdleAudio->SetupAttachment(RootComponent);
	IdleAudio->Sound = S_IdleAudio;
	IdleAudio->bAutoActivate = false;
}

// Called when the game starts or when spawned
void ABeamSaber::BeginPlay()
{
	Super::BeginPlay();

	// Bind this function to the event dispatcher for Bind Gear
	OnBindGear.AddDynamic(this, &ABeamSaber::BindWeapon);
	OnRemoveGear.AddDynamic(this, &ABeamSaber::CustomRemoveWeapon);
}

// Custom code when binding
void ABeamSaber::BindWeapon()
{
	// If this weapon was bound while IsShown is true, set the weapon visible
	if (IsShown)
	{
		ShowWeapon(false, true, false);
		BeamMesh->SetVisibility(true);
		IdleAudio->Play(0.0f);

		// Activate the beam
		FTimerHandle BeamTimer;
		GetWorldTimerManager().SetTimer(BeamTimer, this, &ABeamSaber::ActivateBeam, 0.5f, false);
	}
}

// Activate the Beam!
void ABeamSaber::ActivateBeam()
{
	IgnitionAudio->Play();

	BeamTimeline->AddInterpFloat(BeamCurve, InterpFunction, FName{ TEXT("Float") });
	BeamTimeline->PlayFromStart();
}

// Deactivate the Beam!
void ABeamSaber::DisableBeam()
{
	WeaponSkeletalMesh->SetVisibility(false);
	WeaponStaticMesh->SetVisibility(false);
	WeaponOffhandMesh->SetVisibility(false);
	BeamMesh->SetVisibility(false);
	BeamMesh->SetRelativeScale3D(FVector(0.2f, 0.2f, 0.0f)); // Scale correction
}

// Beam Timeline
void ABeamSaber::TimelineFloatReturn(float val)
{
	BeamMesh->SetRelativeScale3D(FVector(0.2f, 0.2f, FMath::FInterpTo(0, 4, val, 0.3f)));
}

// Custom code when removing binding
void ABeamSaber::CustomRemoveWeapon()
{
	if (OwnerReference->EtherealPlayerState->WeaponMode == EWeaponModes::WM_OneHanded)
	{
		IdleAudio->Stop();
		OffAudio->Play();

		BeamTimeline->AddInterpFloat(BeamCurve, InterpFunction, FName{ TEXT("Float") });
		BeamTimeline->ReverseFromEnd();

		// Deactivate the beam
		FTimerHandle BeamTimer;
		GetWorldTimerManager().SetTimer(BeamTimer, this, &ABeamSaber::DisableBeam, 1.0f, false);
	}
}

#undef LOCTEXT_NAMESPACE


text:
#ifndef GENERATOR_H
#define GENERATOR_H

#include "../TableSchema.h"
#include "../IndexSchema.h"
#include "../ColumnSchema.h"

const int NUM_TYPES = 9;
const int MAX_LENGTH = 65535;
const int MAX_PRECISION = 65;
const int MAX_SCALE = 30;

/**
 * Generate random byte string of required length
 */
void gen_random_bytes(char *s, const int len);

/**
 * Generate random C string of required length
 */
void gen_random_string(char *s, const int len);

/**
 * Randomize the ColumnSchema.
 */
void column_schema_gen(ColumnSchema* schema);

/**
 * Randomize the IndexSchema.
 */
void index_schema_gen(IndexSchema* schema);

/**
 * Randomize the TableSchema.
 */
void table_schema_gen(TableSchema* schema);

#endif


text:
/* global define */
(function() {
    'use strict';
    define(['lodash', 'helpers/modal-helpers', 'helpers/error-helpers'], function(_, ModalHelpers, ErrorHelpers) {

        // **PoolController**
        // Responsible for the initial pool overview. A tabular overview of which pools have been defined
        // on this cluster. This screen lets you add, edit, and delete pools.
        var PoolController = function($q, $log, $scope, PoolService, ClusterService, $location, $modal, RequestTrackingService, $rootScope, $timeout, config) {
            if (ClusterService.clusterId === null) {
                // Redirect back to first view if no clusters are active
                // on this Calamari instance.
                $location.path(config.getFirstViewPath());
                return;
            }

            var errorHelper = ErrorHelpers.makeFunctions($q, $log);

            // **copyPools**
            // @param **pools** metadata from the API request.
            //
            // Return a copy of the pools metadata and the fields we are interested in.

            function copyPools(pools) {
                /* jshint camelcase: false */
                return _.reduce(pools, function(_pools, pool) {
                    _pools.push({
                        name: pool.name,
                        id: pool.id,
                        size: pool.size,
                        pg_num: pool.pg_num
                    });
                    return _pools;
                }, []);
            }

            // **updatePools**
            // @param **newValue** value to update from
            // @param **oldValue** value we current have

            function updatePools(newValue, oldValue) {
                // create a look up index from server response
                var lookup = _.reduce(newValue, function(index, pool) {
                    index[pool.id] = pool;
                    return index;
                }, {});
                // Remove all pool.ids that have been removed.
                var newList = _.filter(oldValue, function(pool) {
                    return lookup[pool.id] !== undefined;
                });
                // Update all existing values.
                newList = _.each(newList, function(pool) {
                    _.extend(pool, lookup[pool.id]);
                    delete lookup[pool.id];
                });
                // Append all the new values to the list.
                return newList.concat(_.values(lookup));
            }

            // **refreshPools**
            // Poll the API endpoint for changes in the pool metadata.

            function refreshPools() {
                $log.debug('refreshing pools');
                if ($rootScope.keyTimer) {
                    // Cancel any existing timer that may be running.
                    $timeout.cancel($rootScope.keyTimer);
                    $rootScope.keyTimer = undefined;
                }
                // Refresh pools metadata from API.
                PoolService.getList().then(function(pools) {
                    $scope.pools = updatePools(copyPools(pools), $scope.pools);
                });
                // Re-install poll function for next cycle.
                $rootScope.keyTimer = $timeout(refreshPools, config.getPollTimeoutMs());
            }

            // Tool Tip Metadata. Used by Angular-strap directives.
            $scope.ttEdit = {
                title: 'Edit Pool'
            };
            $scope.ttDelete = {
                title: 'Delete Pool'
            };
            $scope.ttCreate = {
                title: 'Create Pool'
            };

            // Breadcrumb metadata. Used by Angular-strap directives.
            $scope.clusterName = ClusterService.clusterModel.name;
            $scope.breadcrumbs = [{
                    text: 'Manage (' + $scope.clusterName + ')'
                }, {
                    text: 'Pools',
                    active: true
                }
            ];

            // Don't render page yet.
            $scope.up = false;

            var start = Date.now();
            PoolService.getList().then(function(pools) {
                // Pool metadata received. Process and render page.
                var elapsed = Date.now() - start;
                var timeout = elapsed < 500 ? 500 - elapsed : 0;
                $timeout(function() {
                    // Defer pool metadata processing to give animations
                    // time to run.
                    $scope.pools = copyPools(pools);
                }, timeout);
                // Install initial refreshPools polling handler.
                $rootScope.keyTimer = $timeout(refreshPools, config.getPollTimeoutMs());
                $scope.up = true;
            });

            // Add click event handlers for New and Modify Views
            // **create**
            $scope.create = function() {
                $location.path('/pool/new');
            };
            // **modify**
            // @param id - id of pool we are changing passed as a parameter.
            $scope.modify = function(id) {
                $location.path('/pool/modify/' + id);
            };

            // **remove**
            // Delete pool click event handler.
            $scope.remove = function(pool) {
                $log.debug('deleting ' + pool.id);
                // Build modal warning user about impending delete consequences.
                var modal = $modal({
                    title: 'This will DELETE the \'' + pool.name + '\' Pool. Are you sure?',
                    content: 'There is no way to undo this operation. Please be sure this is what you are trying to do.',
                    template: 'views/delete-modal.html'
                });
                modal.$scope.id = pool.id;
                modal.$scope.confirm = function() {
                    modal.$scope.$hide();
                    errorHelper.intercept304Error(PoolService.remove(modal.$scope.id)).then(function(result) {
                        if (result.status === 202) {
                            /* jshint camelcase: false */
                            RequestTrackingService.add(result.data.request_id).then(refreshPools);
                            var okmodal = ModalHelpers.SuccessfulRequest($modal, {
                                title: 'Delete Request Successful'
                            });
                            okmodal.$scope.$hide = _.wrap(okmodal.$scope.$hide, function($hide) {
                                $hide();
                                $location.path('/pool');
                            });
                            return;
                        }
                        $log.error('Unexpected response from PoolService.remove', result);
                    }, ModalHelpers.makeOnError($modal({
                        show: false
                    }), function() {
                        $location.path('/pool');
                    }));
                };
            };
        };
        return ['$q', '$log', '$scope', 'PoolService', 'ClusterService', '$location', '$modal', 'RequestTrackingService', '$rootScope', '$timeout', 'ConfigurationService', PoolController];
    });
})();


text:
//
//  TableViewController.m
//  PlaceHolderView
//
//  Created by yh on 17/5/16.
//  Copyright © 2017年 yh. All rights reserved.
//

#import "TableViewController.h"
#import "UITableView+PlaceHolderView.h"
@interface TableViewController ()

@end

@implementation TableViewController
{
    NSInteger _count;
}
- (void)btnClick:(UIButton *)sender
{
    sender.selected = !sender.selected;
    _count = sender.selected ? 0 : 50;
    [self.tableView reloadData];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.tableView.tableFooterView = [[UIView alloc] init];

    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.frame = CGRectMake(0, 0, 100, 40);
    [btn setTitle:@"清空" forState:UIControlStateNormal];
    [btn setTitle:@"添加数据" forState:UIControlStateSelected];
    [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btn];

    //只需打开这个属性
    self.tableView.enablePlaceHolderView = YES;
    _count = 20;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return _count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ide"];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"ide"];
    }
    cell.textLabel.text = @"123";

    return cell;
}

/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/

/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
    } else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }
}
*/

/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/

/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end


text:
package org.tanrabad.survey.domain.entomology;

import org.junit.Test;
import org.tanrabad.survey.entity.Building;
import org.tanrabad.survey.entity.Survey;
import org.tanrabad.survey.entity.stub.ContainerTypeStub;
import org.tanrabad.survey.entity.utils.SurveyBuilder;

import java.util.ArrayList;
import java.util.UUID;

import static org.junit.Assert.assertEquals;

public class KeyContainerTest {

    @Test
    public void testFindOfOneSurvey() throws Exception {
        Survey survey = new SurveyBuilder().setBuilding(Building.withName("1"))
                .setResident(4)
                .addIndoorDetail(UUID.randomUUID(), ContainerTypeStub.น้ำดื่ม, 4, 2)
                .addIndoorDetail(UUID.randomUUID(), ContainerTypeStub.ที่รองกันมด, 4, 4)
                .addIndoorDetail(UUID.randomUUID(), ContainerTypeStub.จานรองกระถาง, 10, 5)
                .addOutdoorDetail(UUID.randomUUID(), ContainerTypeStub.ภาชนะที่ไม่ใช้, 3, 3)
                .build();
        KeyContainer keyContainer = new KeyContainer(survey);
        keyContainer.calculate();

        assertEquals(ContainerTypeStub.จานรองกระถาง, keyContainer.indoorNumberOne());
        assertEquals(ContainerTypeStub.ที่รองกันมด, keyContainer.indoorNumberTwo());
        assertEquals(ContainerTypeStub.น้ำดื่ม, keyContainer.indoorNumberThree());
        assertEquals(ContainerTypeStub.ภาชนะที่ไม่ใช้, keyContainer.outdoorNumberOne());
        assertEquals(null, keyContainer.outdoorNumberTwo());
        assertEquals(null, keyContainer.outdoorNumberThree());
    }

    @Test
    public void testFindOfThreeSurvey() throws Exception {
        Survey survey = new SurveyBuilder().setBuilding(Building.withName("1"))
                .setResident(4)
                .addIndoorDetail(UUID.randomUUID(), ContainerTypeStub.น้ำดื่ม, 4, 4)
                .addIndoorDetail(UUID.randomUUID(), ContainerTypeStub.ที่รองกันมด, 4, 4)
                .addIndoorDetail(UUID.randomUUID(), ContainerTypeStub.แจกัน, 5, 5)
                .addOutdoorDetail(UUID.randomUUID(), ContainerTypeStub.อ่างบัว_ไม้น้ำ, 6, 6)
                .addOutdoorDetail(UUID.randomUUID(), ContainerTypeStub.น้ำใช้, 3, 3)
                .build();
        Survey survey2 = new SurveyBuilder().setBuilding(Building.withName("1"))
                .setResident(1)
                .addIndoorDetail(UUID.randomUUID(), ContainerTypeStub.น้ำดื่ม, 10, 10)
                .addIndoorDetail(UUID.randomUUID(), ContainerTypeStub.ที่รองกันมด, 4, 4)
                .addIndoorDetail(UUID.randomUUID(), ContainerTypeStub.แจกัน, 10, 10)
                .addOutdoorDetail(UUID.randomUUID(), ContainerTypeStub.ยางรถยนต์เก่า, 8, 8)
                .addOutdoorDetail(UUID.randomUUID(), ContainerTypeStub.ภาชนะที่ไม่ใช้, 3, 3)
                .build();
        Survey survey3 = new SurveyBuilder().setBuilding(Building.withName("1"))
                .setResident(5)
                .addIndoorDetail(UUID.randomUUID(), ContainerTypeStub.น้ำดื่ม, 2, 2)
                .addIndoorDetail(UUID.randomUUID(), ContainerTypeStub.น้ำใช้, 13, 13)
                .addOutdoorDetail(UUID.randomUUID(), ContainerTypeStub.จานรองกระถาง, 9, 9)
                .addOutdoorDetail(UUID.randomUUID(), ContainerTypeStub.กากใบพืช, 2, 2)
                .build();

        ArrayList<Survey> surveys = new ArrayList<>();
        surveys.add(survey);
        surveys.add(survey2);
        surveys.add(survey3);
        KeyContainer keyContainer = new KeyContainer(surveys);
        keyContainer.calculate();

        assertEquals(ContainerTypeStub.น้ำดื่ม, keyContainer.indoorNumberOne());
        assertEquals(ContainerTypeStub.แจกัน, keyContainer.indoorNumberTwo());
        assertEquals(ContainerTypeStub.น้ำใช้, keyContainer.indoorNumberThree());
        assertEquals(ContainerTypeStub.จานรองกระถาง, keyContainer.outdoorNumberOne());
        assertEquals(ContainerTypeStub.ยางรถยนต์เก่า, keyContainer.outdoorNumberTwo());
        assertEquals(ContainerTypeStub.อ่างบัว_ไม้น้ำ, keyContainer.outdoorNumberThree());
    }
}


text:
<?php
/*
 * Set the $dispLoginBox variable to the code you want to be used to display what the user will see when
 * they are not logged in (i.e. a login form!)1
 */

$dispLoginBox = "
<form action='".$MAIN_ROOT."login.php' method='post' id='loginForm' style='padding: 0px; margin: 0px'>

 <input type='text' name='user' id='loginUserTextBox' class='textBox' style='width: 140px; height: 20px; '>

		 <input type='password' name='pass' id='loginPasswordTextBox' class='textBox' style='width: 140px; height: 20px'>

</form>

";

/*
 * - dispLoggedIn Function -
 *
 * Set the $dispLoggedinBox variable inside the function to the code that you want to be used
 * for the logged in portion of the layout.  Use the array $arrLoginInfo inside the function
 * to display a logged in member information.
 *
 * Will return the variable $dispLoggedinBox
 *
 */

function dispLoggedIn($arrLoginInfo) {
	global $MAIN_ROOT;

	/*
	 $arrLoginInfo['memberID'] = $memberID;
	 $arrLoginInfo['memberUsername'] = $memberUsername;
	 $arrLoginInfo['memberRank'] = $memberRank;
	 $arrLoginInfo['pmCID'] = $pmCID;
	 $arrLoginInfo['pmCount'] = $dispPMCount;
	*/

	$dispLoggedinBox = "

You are logged in

						Rank: ".$arrLoginInfo['memberRank']."

						User: ".$arrLoginInfo['memberUsername']."

						· My Account

						· PM Inbox ".$arrLoginInfo['pmCountDisp']."

						· Sign Out

	";

	return $dispLoggedinBox;
}

?>


text:
require "multi_json"

module Yarc
  module Serializers
    class MultiJsonColumnSerializer
      def key_type
        @key_type || :symbol
      end

      def key_type=(value)
        raise(ArgumentError, "Invalid key type!") unless [:symbol,:string].include?(value)
        @key_type = value
      end

      def load_options
        @load_options || {}
      end

      def load_options=(value)
        raise(ArgumentError, "Load options cannot be nil!") if value.nil?
        @load_options = value
      end

      def serialize(hash)
        hash.map{|k,v| [serialize_key(k), serialize_value(v)]}.flatten
      end

      def deserialize(hash)
        columns = hash.map{|k,v| [deserialize_key(k), deserialize_value(v)]}
        Hash[columns]
      end

      private

      def serialize_key(key)
        key.to_s
      end

      def serialize_value(value)
        MultiJson.dump(value: value)
      end

      def deserialize_key(key)
        key_type == :symbol ? key.to_sym : key
      end

      def deserialize_value(value)
        MultiJson.load(value, load_options).values.first
      end
    end
  end
end


text:
var scrollTo = require("scroll-to");
var o = require('dom');

/**
 * Expose function
 */
module.exports = scroll;

/**
 * Determine if the element is inside the viewport
 *
 * @param el the element
 * @return {bool} true if the element is inside the viewport, false otherwise
 */
function scroll(el) {
  if(!el) return;

  var top = el.offsetHeight
            + el.getBoundingClientRect().top
            - (window.innerHeight || document.documentElement.clientHeight)
            + 25 /* margin */;
  var options = { box: o('#browser')[0]};
  return scrollTo(null, top, options);
}


text:
package javax.net.ssl;

import java.security.KeyManagementException;
import java.security.SecureRandom;

/**
 * The Service Provider Interface (SPI) for SSLContext
 * objects.
 *
 * @author Casey Marshall (rsdio@metastatic.org)
 */
public abstract class SSLContextSpi
{

  // Constructor.
  // -------------------------------------------------------------------

  /**
   * Create a new SSLContextSpi.
   */
  public SSLContextSpi()
  {
    super();
  }

  // Abstract methods.
  // -------------------------------------------------------------------

  /**
   * Returns the set of SSL sessions available for client connections.
   *
   * @return The set of SSL sessions available for client connections.
   */
  protected abstract SSLSessionContext engineGetClientSessionContext();

  /**
   * Returns the set of SSL sessions available for server connections.
   *
   * @return The set of SSL sessions available for server connections.
   */
  protected abstract SSLSessionContext engineGetServerSessionContext();

  /**
   * Returns the SSL server socket factory.
   *
   * @return The SSL server socket factory.
   */
  protected abstract SSLServerSocketFactory engineGetServerSocketFactory();

  /**
   * Returns the SSL client socket factory.
   *
   * @return The SSL client socket factory.
   */
  protected abstract SSLSocketFactory engineGetSocketFactory();

  /**
   * Initialize this context with key and trust managers, and a source
   * of randomness. All of the parameters are optional.
   *
   * @param keyManagers The set of key managers.
   * @param trustManagers The set of trust managers.
   * @param random The source of randomness.
   * @throws KeyManagementException If this context cannot be
   *   initialized with these parameters.
   */
  protected abstract void engineInit(KeyManager[] keyManagers,
                                     TrustManager[] trustManagers,
                                     SecureRandom random)
    throws KeyManagementException;
}


text:
* [Course List](/./courses/README.md)

### Neural Networks for Machine Learning - Geoffrey Hinton - U Toronto

* [Overall Class Notes](/./courses/neural_networks_geoffrey_hinton/README.md)
* [Week 3 - Backpropagation](/./courses/neural_networks_geoffrey_hinton/week03_backpropagation/README.md)
* [Week 4 - Predicting Words](/./courses/neural_networks_geoffrey_hinton/week04_predicting_words/README.md)
* [Week 5 - Object Recognition](/./courses/neural_networks_geoffrey_hinton/week05_object_recognition/README.md)
* [Assignment 2 - Learning Word Representations](/./courses/neural_networks_geoffrey_hinton/assignment2/README.md)
* [Week 6 - Minibatch Gradient Descent](/./courses/neural_networks_geoffrey_hinton/week06_minibatch_gradient_descent/README.md)
* [Week 7 - Modeling Sequences with RNNs](/./courses/neural_networks_geoffrey_hinton/week07_modeling_sequences_with_RNNs/README.md)
* [Week 8 - More RNNs](/./courses/neural_networks_geoffrey_hinton/week08_more_RNNs/README.md)

## Books

* [Book List](/./books/README.md)

### Neural Networks and Deep Learning

* [Neural Networks and Deep Learning Notes](./books/neural_networks_and_deep_learning/README.md)


text:
package org.apache.sling.api.request;

import junit.framework.TestCase;

public class RequestDispatcherOptionsTest extends TestCase {

    public void testNullString() {
        final RequestDispatcherOptions result = new RequestDispatcherOptions(
            null);
        assertTrue(result.isEmpty());
    }

    public void testEmptyString() {
        final RequestDispatcherOptions result = new RequestDispatcherOptions("");
        assertTrue(result.isEmpty());
    }

    public void testSingleOption() {
        final RequestDispatcherOptions result = new RequestDispatcherOptions(
            "forceResourceType= widget");
        assertNotNull(result);
        assertEquals("Expected option found (" + result + ")", "widget",
            result.get(RequestDispatcherOptions.OPT_FORCE_RESOURCE_TYPE));
        assertEquals("Expected option found (" + result + ")", "widget",
            result.getForceResourceType());
    }

    public void testResourceTypeSlashShortcut() {
        // a single option with no comma or colon means "forceResourceType"
        final RequestDispatcherOptions result = new RequestDispatcherOptions(
            "\t components/widget  ");
        assertNotNull(result);
        assertEquals("Expected option found (" + result + ")",
            "components/widget",
            result.get(RequestDispatcherOptions.OPT_FORCE_RESOURCE_TYPE));
        assertEquals("Expected option found (" + result + ")",
            "components/widget", result.getForceResourceType());
    }

    public void testResourceTypeColonShortcut() {
        // a single option with no comma or colon means "forceResourceType"
        final RequestDispatcherOptions result = new RequestDispatcherOptions(
            "\t components:widget  ");
        assertNotNull(result);
        assertEquals("Expected option found (" + result + ")",
            "components:widget",
            result.get(RequestDispatcherOptions.OPT_FORCE_RESOURCE_TYPE));
        assertEquals("Expected option found (" + result + ")",
            "components:widget", result.getForceResourceType());
    }

    public void testTwoOptions() {
        final RequestDispatcherOptions result = new RequestDispatcherOptions(
            "forceResourceType= components:widget, replaceSelectors = xyz  ,");
        assertNotNull(result);
        assertEquals("Expected option found (" + result + ")",
            "components:widget",
            result.get(RequestDispatcherOptions.OPT_FORCE_RESOURCE_TYPE));
        assertEquals("Expected option found (" + result + ")",
            "components:widget", result.getForceResourceType());
        assertEquals("Expected option found (" + result + ")", "xyz",
            result.get(RequestDispatcherOptions.OPT_REPLACE_SELECTORS));
        assertEquals("Expected option found (" + result + ")", "xyz",
            result.getReplaceSelectors());
    }

}


text:
use proc_macro2::TokenStream;

pub fn define_config_type_on_struct(_st: &syn::ItemStruct) -> syn::Result<TokenStream> {
    unimplemented!()
}


text:
package com.evolveum.midpoint.gui.api.component.button;

import java.io.Serializable;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.model.Model;

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem;
import com.evolveum.midpoint.web.component.menu.cog.MenuLinkPanel;

public class DropdownButtonPanel extends BasePanel<DropdownButtonDto>{

	private static final long serialVersionUID = 1L;
	private static final String ID_INFO = "info";
	private static final String ID_ICON = "icon";
	private static final String ID_LABEL = "label";

	private static String ID_MENU_ITEM = "menuItem";
    private static String ID_MENU_ITEM_BODY = "menuItemBody";

	public DropdownButtonPanel(String id, DropdownButtonDto model) {
		super(id);
		initLayout(model);
	}

	private void initLayout(DropdownButtonDto model){

		Label info = new Label(ID_INFO, model.getInfo());
		add(info);

		Label label = new Label(ID_LABEL, model.getLabel());
		add(label);

		WebMarkupContainer icon = new WebMarkupContainer(ID_ICON);
		icon.add(AttributeModifier.append("class", model.getIcon()));
		add(icon);

		 ListView<InlineMenuItem> li = new ListView<InlineMenuItem>(ID_MENU_ITEM, new Model((Serializable) model.getMenuItems())) {

	            @Override
	            protected void populateItem(ListItem<InlineMenuItem> item) {
	                initMenuItem(item);
	            }
	        };

	        add(li);

	}

	 private void initMenuItem(ListItem<InlineMenuItem> menuItem) {
	        final InlineMenuItem item = menuItem.getModelObject();

	        WebMarkupContainer menuItemBody = new MenuLinkPanel(ID_MENU_ITEM_BODY, menuItem.getModel());
	        menuItemBody.setRenderBodyOnly(true);
	        menuItem.add(menuItemBody);
	    }

}


text:
<?php

namespace Toothless\TinyImage\Tests\Provider;

use Toothless\TinyImage\Provider\ContentProvider;
use Toothless\TinyImage\Provider\ContentProviderInterface;

/**
 * Class ContentProviderTest
 */
class ContentProviderTest extends \PHPUnit_Framework_TestCase
{
    public function testInstance()
    {
        $provider = new ContentProvider('dummy_content');
        $this->assertInstanceOf(ContentProviderInterface::class, $provider);
    }

    public function testGetContent()
    {
        $originalContent = 'content_foo';
        $provider = new ContentProvider($originalContent);

        $content = $provider->getContent();
        $this->assertInternalType('string', $content);
        $this->assertSame($originalContent, $content);
    }
}


text:
<?xml version="1.0" encoding="utf-8" ?>
<sherlock configurationVersion="1.1">
    <!--
        Provide some human readable information for the test. This information
        is used in the reports.
    -->
    <description>
        <product>${NAME_OF_PRODUCT_UNDER_TEST}$</product>
        <version>${VERSION_OF_PRODUCT_UNDER_TEST}$</version>
        <testpurpose>${PURPOSE_OF_TEST}$</testpurpose>
    </description>

    <!--
        Define the environments that are required for the test. Environments are selected by limiting the
        selection through constraints.
    -->
    <environments>
        <environment name="${ENVIRONMENT_NAME}$">
            <constraints>
                <!--
                    Indicates on which operating systems the tests have to be run.
                    Note that you can specify what ever you want, however the tests
                    will not be run if the operating system is not recognised

                    Service pack names are designated with SP and a number, e.g. SP1

                    Operating system cultures follow the RFC 4646 specification:
                    The name is a combination of and ISO 639 two-letter lowercase
                    culture code associated with a language and an ISO 3166 two-
                    letter uppercase subculture code associated with a country or
                    region. Examples are: en-US (US english), jp-JP (japanese) etc.
                    see here:
                    http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx
                    for more information.
                -->
                <operatingsystem name="${OPERATING_SYSTEM_NAME}$"
                                 servicepack="${OPERATING_SYSTEM_SERVICE_PACK}$"
                                 culture="${OPERATING_SYSTEM_CULTURE}$"
                                 architecturepointersize="${OPERATING_SYSTEM_POINTER_SIZE}$"/>

                <!--
                    Indicates which software applications need to be installed
                    for the current test to run.
                -->
                <software name="${APPLICATION_NAME}$"
                          version="${APPLICATION_VERSION}$"/>

                <!-- Place more constraints here -->
            </constraints>
        </environment>

        <!-- Place more environments here -->
    </environments>

    <!--
        The test steps that need to be taken for the test to be completed
    -->
    <teststeps>
        <console steporder="${CONSOLE_STEP_ORDER_INDEX}$"
                 environment="${CONSOLE_ENVIRONMENT_NAME}$"
                 onfailure="${CONSOLE_FAILURE_ACTION}$">
            <exe><![CDATA[${CONSOLE_EXECUTABLE_FULL_PATH_GOES_HERE}$]]></exe>
            <params>
                <param><![CDATA[${CONSOLE_PARAMETER_VALUE}$]]></param>
            </params>
        </console>
        <msi steporder="${MSI_STEP_ORDER_INDEX}$"
             environment="${MSI_ENVIRONMENT_NAME}$"
             onfailure="${MSI_FAILURE_ACTION}$">
            <file><![CDATA[${MSI_INSTALLER_FULL_PATH_GOES_HERE}$]]></file>
            <params>
                <param key="${MSI_PARAMETER_KEY}$"><![CDATA[${MSI_PARAMETER_VALUE}$]]></param>
            </params>
        </msi>
        <script steporder="${SCRIPT_STEP_ORDER_INDEX}$"
                environment="${SCRIPT_ENVIRONMENT_NAME}$"
                onfailure="${SCRIPT_FAILURE_ACTION}$">
            <file language="${SCRIPT_LANGUAGE_GOES_HERE}$"><![CDATA[${SCRIPT_FULL_PATH_GOES_HERE}$]]></file>
            <params>
                <param key="${SCRIPT_PARAMETER_KEY}$"><![CDATA[${SCRIPT_PARAMETER_VALUE}$]]></param>
            </params>
        </script>
        <xcopy steporder="${XCOPY_STEP_ORDER_INDEX}$"
               environment="${XCOPY_ENVIRONMENT_NAME}$"
               onfailure="${XCOPY_FAILURE_ACTION}$">
            <destination><![CDATA[${XCOPY_DESTINATION_PATH}$]]></destination>
            <base><![CDATA[${XCOPY_BASE_PATH}$]]></base>
            <paths>
                <file><![CDATA[${XCOPY_FILE_FULL_PATH_GOES_HERE}$]]></file>
                <directory><![CDATA[${XCOPY_DIRECTORY_FULL_PATH_GOES_HERE}$]]></directory>
            </paths>
        </xcopy>
    </teststeps>

    <completednotification>
        <file>
            <path><![CDATA[${NOTIFICATION_DIRECTORY_FULL_PATH_GOES_HERE}$]]></path>
        </file>
    </completednotification>
</sherlock>


text:
class OdptCommon::Required::All::Modules::Time < OdptCommon::Required
end


text:
using System;
using System.Globalization;

namespace Macaroons
{
  /// <summary>
  /// Standard first party general caveat verifiers.
  /// </summary>
  public static class StandardCaveatVerifiers
  {
    /// <summary>
    /// Create standard "expires: -date-" caveat.
    /// </summary>
    /// <param name="expires"></param>
    /// <returns></returns>
    public static string CreateExpiresCaveat(DateTime expires)
    {
      return string.Format("expires: {0:yyyy-MM-dd'T'HH:mm:ss'Z'}", expires);
    }

    /// <summary>
    /// Verifies caveats of the form 'expires: %yyyy-%MM-%ddT%HH:%mm:%ssZ'.
    /// </summary>
    /// <param name="cid"></param>
    /// <param name="reason"></param>
    /// <returns></returns>
    public static bool ExpiresVerifier(Packet cid, out string reason)
    {
      reason = null;

      string caveat = cid.ToString();
      if (!caveat.StartsWith("expires:"))
        return false;

      string ts = caveat.Substring(8).Trim();

      DateTime t;
      if (DateTime.TryParseExact(ts, "yyyy-MM-dd'T'HH:mm:ss'Z'", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal, out t))
      {
        if (DateTime.Now < t)
          return true;

        reason = string.Format("Timestamp '{0}' has expired", ts);
        return false;
      }
      else
      {
        reason = string.Format("Invalid timestamp in '{0}'", caveat);
        return false;
      }
    }
  }
}


text:
from . import event, client as c
import aiohttp
import json
import uuid

class Writer(object):
    """Creates a Stream Writer"""

    def __init__(self, stream, client, aiohttp=aiohttp):
        self._stream = stream
        self._client = client
        self._http = aiohttp

    async def write(self,
                    event_type,
                    event_id=str(uuid.uuid4()),
                    event_data={},
                    event_metadata={}):
        url = self._client.stream_path(self._stream)
        async with self._http.ClientSession(loop=self._client.loop) as session:
            headers = {
                'Content-Type': 'application/json',
                'ES-EventId': event_id,
                'ES-EventType': event_type
            }
            async with session.post(url, data=json.dumps(event_data), headers=headers) as response:
                if response.status != 201:
                    raise Exception


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Carreras_model extends CI_Model {
    private $idCarrera;
    private $descripcion;
    private $estado;

    //Get y Sets de materias
    function getIdCarrera(){
        return $this->idCarrera;
    }

    function setIdCarrera($idCarrera){
        $this->idCarrera = $idCarrera;
    }
    function getDescripcion(){
        return $this->descripcion;
    }

    function setDescripcion($descripcion){
        $this->descripcion = $descripcion;
    }

    function getEstado(){
        return $this->estado;
    }

    function setEstado($estado){
        $this->estado = $estado;
    }

    function get(){
        $this->db->select('idCarrera, descripcion, estado');
        $this->db->from('carreras');
        $this->db->where('estado', 'A');
        $query = $this->db->get();
        if($query->num_rows() > 0){
            return $query->result();
        }
        return null;
    }

    function create(){
        $data = array(
            'descripcion' => $this->descripcion,
            'estado' => 'A'
        );
        $this->db->insert("carreras", $data);
    }

    function update(){
        $data = array(
            'idCarrera' => $this->idCarrera,
            'descripcion' => $this->descripcion,
            'estado' => 'A'
        );
        $this->db->replace("carreras", $data);
    }

    function delete($idCarrera)
    {
        $this->db->select('idCarrera, descripcion, estado');
        $this->db->from('carreras');
        $this->db->where('idCarrera', $idCarrera);
        $query = $this->db->get();

        if($query->num_rows() > 0){
            $row = $query->row();
        }
        $row->estado = 'D';
        $this->db->replace("carreras", $row);
    }

}
?>