text:
package com.sample.android.classytaxijava.data.network.retrofit;

import android.text.TextUtils;
import android.util.Log;

import com.sample.android.classytaxijava.data.ContentResource;
import com.sample.android.classytaxijava.data.SubscriptionStatus;
import com.sample.android.classytaxijava.data.SubscriptionStatusList;
import com.sample.android.classytaxijava.data.network.firebase.ServerFunctions;
import com.sample.android.classytaxijava.data.network.retrofit.authentication.RetrofitClient;

import java.net.HttpURLConnection;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;

import static com.sample.android.classytaxijava.BuildConfig.SERVER_URL;

/**
 * Implementation of Interfaces with Retrofit.
 */
public class ServerFunctionImpl implements ServerFunctions {

    private static final String TAG = "RemoteServerFunction";
    private static volatile ServerFunctions INSTANCE = null;
    private final MutableLiveData<List<SubscriptionStatus>> subscriptions = new MutableLiveData<>();
    private final MutableLiveData<ContentResource> basicContent = new MutableLiveData<>();
    private final MutableLiveData<ContentResource> premiumContent = new MutableLiveData<>();
    private MutableLiveData<Boolean> loading = new MutableLiveData<>();
    private final RetrofitClient<SubscriptionStatusApiCall> retrofitClient = new RetrofitClient<>(SERVER_URL, SubscriptionStatusApiCall.class);
    private final PendingRequestCounter pendingRequestCounter = new PendingRequestCounter();

    private ServerFunctionImpl() {
    }

    public static ServerFunctions getInstance() {
        if (INSTANCE == null) {
            synchronized (ServerFunctionImpl.class) {
                if (INSTANCE == null) {
                    INSTANCE = new ServerFunctionImpl();
                }
            }
        }
        return INSTANCE;
    }

    /**
     * Live data is true when there are pending network requests.
     */
    @Override
    public LiveData<Boolean> getLoading() {
        loading = pendingRequestCounter.getLoading();
        return loading;
    }

    /**
     * The latest subscription data from the Firebase server.
     *

     * Use this class by observing the subscriptions LiveData.
     * Any server updates will be communicated through this LiveData.
     */
    @Override
    public LiveData<List<SubscriptionStatus>> getSubscriptions() {
        return subscriptions;
    }

    /**
     * The basic content URL.
     */
    @Override
    public LiveData<ContentResource> getBasicContent() {
        return basicContent;
    }

    /**
     * The premium content URL.
     */
    @Override
    public LiveData<ContentResource> getPremiumContent() {
        return premiumContent;
    }

    /**
     * Fetches basic content and posts results to {@link #basicContent}.
     * This will fail if the user does not have a basic subscription.
     */
    @Override
    public void updateBasicContent() {
        final String method = "updateBasicContent";
        pendingRequestCounter.incrementRequestCount();
        retrofitClient.getService().fetchBasicContent().enqueue(new RetrofitResponseHandlerCallback<ContentResource>(method, pendingRequestCounter) {
            protected void onSuccess(ContentResource response) {
                basicContent.postValue(response);
            }
        });
    }

    /**
     * Fetches premium content and posts results to {@link #premiumContent}.
     * This will fail if the user does not have a premium subscription.
     */
    public void updatePremiumContent() {
        final String method = "updatePremiumContent";
        pendingRequestCounter.incrementRequestCount();
        retrofitClient.getService().fetchPremiumContent().enqueue(new RetrofitResponseHandlerCallback<ContentResource>(method, pendingRequestCounter) {
            @Override
            protected void onSuccess(ContentResource response) {
                premiumContent.postValue(response);
            }
        });
    }

    /**
     * Fetches the Subscription Status from the server.
     */
    public void updateSubscriptionStatus() {
        final String method = "updateSubscriptionStatus";
        pendingRequestCounter.incrementRequestCount();
        retrofitClient.getService().fetchSubscriptionStatus().enqueue(new RetrofitResponseHandlerCallback<SubscriptionStatusList>(method, pendingRequestCounter) {
            @Override
            protected void onSuccess(SubscriptionStatusList response) {
                onSuccessfulSubscriptionCall(response, subscriptions);
            }
        });
    }

    /**
     * Registers a subscription with the server and posts successful results to
     * {@link #subscriptions}.
     *
     * @param sku           the ID of a specific product type
     * @param purchaseToken string that represents a buyer's entitlement to a product on Google Play
     */
    public void registerSubscription(String sku, String purchaseToken) {
        final String method = "registerSubscription";
        SubscriptionStatus data = new SubscriptionStatus();
        data.setSku(sku);
        data.setPurchaseToken(purchaseToken);
        pendingRequestCounter.incrementRequestCount();
        retrofitClient.getService().registerSubscription(data).enqueue(new RetrofitResponseHandlerCallback<SubscriptionStatusList>(method, pendingRequestCounter) {
            @Override
            protected void onSuccess(SubscriptionStatusList response) {
                onSuccessfulSubscriptionCall(response, subscriptions);
            }

            @Override
            protected void onError(int errorCode, @Nullable String errorMessage) {
                if (errorCode == HttpURLConnection.HTTP_CONFLICT) {
                    Log.w(TAG, "Subscription already exists");
                    List<SubscriptionStatus> oldSubscriptions =
                            subscriptions.getValue();
                    SubscriptionStatus newSubscription =
                            SubscriptionStatus
                                    .alreadyOwnedSubscription(sku, purchaseToken);
                    List<SubscriptionStatus> newSubscriptions =
                            insertOrUpdateSubscription(oldSubscriptions,
                                    newSubscription);
                    subscriptions.postValue(newSubscriptions);
                }
                super.logError(errorCode, errorMessage);
            }
        });
    }

    /**
     * Transfers subscription to this account posts successful results to {@link #subscriptions}.
     *
     * @param sku           the ID of a specific product type
     * @param purchaseToken string that represents a buyer's entitlement to a product on Google Play
     */
    public void transferSubscription(String sku, String purchaseToken) {
        final String method = "transferSubscription";
        SubscriptionStatus data = new SubscriptionStatus();
        data.setSku(sku);
        data.setPurchaseToken(purchaseToken);
        pendingRequestCounter.incrementRequestCount();
        retrofitClient.getService().transferSubscription(data).enqueue(new RetrofitResponseHandlerCallback<SubscriptionStatusList>(method, pendingRequestCounter) {
            @Override
            protected void onSuccess(SubscriptionStatusList response) {
                onSuccessfulSubscriptionCall(response, subscriptions);
            }
        });
    }

    /**
     * Registers Instance ID for Firebase Cloud Messaging.
     *
     * @param instanceId an FCM registration/instance token returned by
     *                   {@link com.sample.android.classytaxijava.FcmRegistrationTokenService}
     */
    @Override
    public void registerInstanceId(String instanceId) {
        final String method = "registerInstanceId";
        Map<String, String> data = new HashMap<>();
        data.put("instanceId", instanceId);
        pendingRequestCounter.incrementRequestCount();
        retrofitClient.getService().registerInstanceID(data).enqueue(new RetrofitResponseHandlerCallback<String>(method, pendingRequestCounter) {
            @Override
            protected void onSuccess(String response) {
                // A production app may want to track whether registration has been successful to allow for retrying.
            }
        });
    }

    /**
     * Unregisters Instance ID for Firebase Cloud Messaging.
     *
     * @param instanceId an FCM registration/instance token returned by
     *                   {@link com.sample.android.classytaxijava.FcmRegistrationTokenService}
     */
    @Override
    public void unregisterInstanceId(String instanceId) {
        final String method = "unregisterInstanceId";
        Map<String, String> data = new HashMap<>();
        data.put("instanceId", instanceId);
        pendingRequestCounter.incrementRequestCount();
        retrofitClient.getService().unregisterInstanceID(data).enqueue(new RetrofitResponseHandlerCallback<String>(method, pendingRequestCounter) {
            @Override
            protected void onSuccess(String response) {
                // A production app may want to track whether un-registration has been successful to allow for retrying.
            }
        });
    }

    // Helper functions

    /**
     * Inserts or updates the subscription to the list of existing subscriptions.
     *

     * If none of the existing subscriptions have a SKU that matches, insert this SKU.
     * If a subscription exists with the matching SKU, the output list will contain the new
     * subscription instead of the old subscription.
     */
    private List<SubscriptionStatus> insertOrUpdateSubscription(
            List<SubscriptionStatus> oldSubscriptions,
            SubscriptionStatus newSubscription) {
        List<SubscriptionStatus> subscriptionStatuses = new ArrayList<>();
        if (oldSubscriptions == null || oldSubscriptions.isEmpty()) {
            subscriptionStatuses.add(newSubscription);
            return subscriptionStatuses;
        }

        boolean subscriptionAdded = false;
        for (SubscriptionStatus subscription : oldSubscriptions) {
            if (TextUtils.equals(subscription.getSku(), newSubscription.getSku())) {
                subscriptionStatuses.add(newSubscription);
                subscriptionAdded = true;
            } else {
                subscriptionStatuses.add(subscription);
            }
        }

        if (!subscriptionAdded) {
            subscriptionStatuses.add(newSubscription);
        }

        return subscriptionStatuses;
    }

    /**
     * Called when a successful response returns from the server
     * for a {@link SubscriptionStatus} HTTPS call
     *
     * @param subscriptionStatusList  Successful {@link SubscriptionStatusList} response object
     * @param subscriptions LiveData subscription list
     */
    protected void onSuccessfulSubscriptionCall(SubscriptionStatusList subscriptionStatusList, @Nullable MutableLiveData<List<SubscriptionStatus>> subscriptions) {
        if (subscriptionStatusList.getSubscriptions() == null || subscriptionStatusList.getSubscriptions().isEmpty()) {
            Log.w(TAG, "Invalid subscription data");
            return;
        }
        Log.i(TAG, "Valid subscription data");
        subscriptions.postValue(subscriptionStatusList.getSubscriptions());
    }
}


text:
import Backbone from 'backbone';

export default Backbone.View.extend({
  initialize() {
    const { $el, model } = this;
    $el.data('model', model);
    model.view = this;
  },
  _createElement() {
    return document.createTextNode(this.model.get('content'));
  }
});

redpajama_set_name: RedPajamaGithub


text:
The order of class and function declarations in a file matters. You can instantiate a class defined later in the file from above the class declaration at runtime, but you can't reference a class by name before that class is defined.

[2013-09-17]


text:
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Moq;
using System;
using System.Linq;
using Vigil.Domain.Messaging;
using Vigil.Patrons.Events;
using Xunit;

namespace Vigil.Patrons
{
    public class PatronEventHandlerTest
    {
        private readonly Func<PatronContext> Context;

        public PatronEventHandlerTest()
        {
            var serviceProvider = new ServiceCollection()
                .AddEntityFrameworkInMemoryDatabase()
                .BuildServiceProvider();
            var builder = new DbContextOptionsBuilder<PatronContext>()
                .UseInMemoryDatabase(databaseName: "TestHelper")
                .UseInternalServiceProvider(serviceProvider);

            Context = () => new PatronContext(builder.Options);
        }

        [Fact]
        public void Handle_PatronCreated_Adds_NewPatron()
        {
            IEventHandler<PatronCreated> handler = new PatronEventHandler(Context);
            PatronCreated evnt = new PatronCreated("Create User", TestHelper.Now, Guid.NewGuid())
            {
                DisplayName = "New Patron",
                IsAnonymous = false,
                PatronType = "Test Account",
                PatronId = Guid.NewGuid()
            };

            handler.Handle(evnt);

            using var context = Context.Invoke();
            Patron result = context.Patrons.Single();
            Assert.Equal("New Patron", result.DisplayName);
            Assert.Equal("Test Account", result.PatronType);
            Assert.Equal(evnt.PatronId, result.Id);
            Assert.False(result.IsAnonymous);
            Assert.Equal("Create User", result.CreatedBy);
            Assert.Equal(TestHelper.Now, result.CreatedOn);
            Assert.Equal(0, result.Version);
            Assert.Null(result.ModifiedBy);
            Assert.Null(result.ModifiedOn);
            Assert.Null(result.DeletedBy);
            Assert.Null(result.DeletedOn);
        }

        [Fact]
        public void Handle_PatronHeaderChanged_On_NonExistant_Patron_Does_Nothing()
        {
            var mContext = new Mock<IPatronContext>();
            mContext.Setup(m => m.Patrons.Find(It.IsAny<Guid>())).Returns(default(Patron));
            mContext.Setup(m => m.SaveChanges()).Verifiable();

            IEventHandler<PatronHeaderChanged> handler = new PatronEventHandler(() => mContext.Object);

            handler.Handle(new PatronHeaderChanged("Change User", TestHelper.Now, Guid.NewGuid())
            {
                PatronId = Guid.NewGuid()
            });

            mContext.Verify(m => m.Patrons.Find(It.IsAny<Guid>()), Times.Once);
            mContext.Verify(m => m.SaveChanges(), Times.Never);
        }

        [Fact]
        public void Handle_PatronHeaderChanged_Updates_Existing_Patron()
        {
            Guid newId = Guid.NewGuid();
            using (var context = Context())
            {
                context.Patrons.Add(new Patron(newId, new[] {
                    new PatronCreated("Create User", TestHelper.Now, Guid.NewGuid())
                    {
                        DisplayName = "New Patron",
                        IsAnonymous = false,
                        PatronType = "Test Account",
                        PatronId = newId
                    }
                }));
                context.SaveChanges();
            }

            IEventHandler<PatronHeaderChanged> handler = new PatronEventHandler(Context);
            handler.Handle(new PatronHeaderChanged("Change User", TestHelper.Now, Guid.NewGuid())
            {
                DisplayName = "Changed Name",
                PatronType = "New Type",
                PatronId = newId
            });

            using (var context = Context())
            {
                var patron = context.Patrons.Find(newId);
                Assert.Equal("Changed Name", patron.DisplayName);
                Assert.Equal("New Type", patron.PatronType);
                Assert.Equal(1, patron.Version);
                Assert.Equal(TestHelper.Now, patron.ModifiedOn);
                Assert.Equal("Change User", patron.ModifiedBy);
                Assert.Equal(1, patron.Version);
            }
        }

        [Fact]
        public void Handle_PatronDeleted_On_NonExistant_Patron_Does_Nothing()
        {
            var mContext = new Mock<IPatronContext>();
            mContext.Setup(m => m.Patrons.Find(It.IsAny<Guid>())).Returns(default(Patron));
            mContext.Setup(m => m.SaveChanges()).Verifiable();

            IEventHandler<PatronDeleted> handler = new PatronEventHandler(() => mContext.Object);

            handler.Handle(new PatronDeleted("Delete User", TestHelper.Now, Guid.NewGuid())
            {
                PatronId = Guid.NewGuid()
            });

            mContext.Verify(m => m.Patrons.Find(It.IsAny<Guid>()), Times.Once);
            mContext.Verify(m => m.SaveChanges(), Times.Never);
        }

        [Fact]
        public void Handle_PatronDeleted_Sets_DeletedByOn_Fields()
        {
            Guid newId = Guid.NewGuid();
            using (var context = Context())
            {
                context.Patrons.Add(new Patron(newId, new[] {
                    new PatronCreated("Create User", TestHelper.Now, Guid.NewGuid())
                    {
                        DisplayName = "New Patron",
                        IsAnonymous = false,
                        PatronType = "Test Account",
                        PatronId = newId
                    }
                }));
                context.SaveChanges();
            }

            IEventHandler<PatronDeleted> handler = new PatronEventHandler(Context);
            handler.Handle(new PatronDeleted("Delete User", TestHelper.Later, Guid.NewGuid())
            {
                PatronId = newId
            });

            using (var context = Context())
            {
                var patron = context.Patrons.Find(newId);
                Assert.Equal("Delete User", patron.ModifiedBy);
                Assert.Equal(TestHelper.Later, patron.ModifiedOn);
                Assert.Equal("Delete User", patron.DeletedBy);
                Assert.Equal(TestHelper.Later, patron.DeletedOn);
                Assert.Equal(1, patron.Version);
            }

        }
    }
}


text:
/* to use custom symbols in ordered lists
 https://developer.mozilla.org/en-US/docs/Web/CSS/@counter-style*/
@counter-style ballotBox {
  system: fixed;
  symbols: ☐ 9744	2610 &#9744 ☐
  suffix: ' ';
}

ol li {
  list-style: ballotBox;
}

/* needed for when counter style is used*/
#ingredents ul {
  list-style-position: outside;
}


text:
Small library for running Lua code in a sandbox.

Loads each chunk in a separate environment with a restricted subset of the Lua library.
Pure Lua implementation. It doesn't implement memory/execution time restrictions.


text:
Contributions to nifpga-python are welcome from all!

nifpga-python is managed via [git](https://git-scm.com), with the canonical upstream
repository hosted on [GitHub](http://github.com/).

nifpga-python follows a pull-request model for development.  If you wish to
contribute, you will need to create a GitHub account, fork this project, push a
branch with your changes to your project, and then submit a pull request.

See [GitHub's official documentation](https://help.github.com/articles/using-pull-requests/) for more details.

# Testing

This project uses [Travis CI](https://travis-ci.org/ni/nifpga-python/).  Use it
to test your branch ahead of time and it will also be run on all pull-requests.

# Developer Certificate of Origin (DCO)

   Developer's Certificate of Origin 1.1

   By making a contribution to this project, I certify that:

   (a) The contribution was created in whole or in part by me and I
       have the right to submit it under the open source license
       indicated in the file; or

   (b) The contribution is based upon previous work that, to the best
       of my knowledge, is covered under an appropriate open source
       license and I have the right under that license to submit that
       work with modifications, whether created in whole or in part
       by me, under the same open source license (unless I am
       permitted to submit under a different license), as indicated
       in the file; or

   (c) The contribution was provided directly to me by some other
       person who certified (a), (b) or (c) and I have not modified
       it.

   (d) I understand and agree that this project and the contribution
       are public and that a record of the contribution (including all
       personal information I submit with it, including my sign-off) is
       maintained indefinitely and may be redistributed consistent with
       this project or the open source license(s) involved.

(taken from [developercertificate.org](http://developercertificate.org/))

See [LICENSE](https://github.com/ni/nifpga-python/blob/master/LICENSE)
for details about how nifpga-python is licensed.


text:
This is paragraph

term
: definition


text:
<?xml version="1.0" encoding="utf-8"?>
<CrawlItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Text>naručio jučer piletinu s curryem i pirjanu rižu s jajima i povrćem.... stvarno super!! ne kužim donje komentare, što se mene tiče čista preporuka, hrana je stvarno dobra</Text>
  <Rating>6</Rating>
  <Source>http://pauza.hr/menu/kina-express</Source>
</CrawlItem>


text:
<?php

# Copyright (c) 2012-2015 Yubico AB
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
#   * Redistributions of source code must retain the above copyright
#     notice, this list of conditions and the following disclaimer.
#
#   * Redistributions in binary form must reproduce the above
#     copyright notice, this list of conditions and the following
#     disclaimer in the documentation and/or other materials provided
#     with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

set_include_path(implode(PATH_SEPARATOR, array(
	get_include_path(),
	'/usr/share/yubikey-val',
	'/etc/yubico/val',
)));

require_once 'ykval-config.php';
require_once 'ykval-db.php';

if ($argc == 2 && strcmp($argv[1], "autoconf") == 0)
{
	print "yes\n";
	exit(0);
}

if ($argc == 2 && strcmp($argv[1], "config") == 0)
{
	echo "graph_title YK-VAL YubiKey stats\n";
	echo "graph_vlabel Known YubiKeys\n";
	echo "graph_category ykval\n";

	echo "yubikeys_enabled.label Enabled YubiKeys\n";
	echo "yubikeys_enabled.draw AREA\n";

	echo "yubikeys_disabled.label Disabled YubiKeys\n";
	echo "yubikeys_disabled.draw STACK\n";

	echo "yubikeys_1month.label YubiKeys seen last month\n";
	echo "yubikeys_1month.draw LINE2\n";

	echo "clients_enabled.label Enabled validation clients\n";
	echo "clients_enabled.draw LINE2\n";

	echo "clients_disabled.label Disabled validation clients\n";
	echo "clients_disabled.draw LINE2\n";

	exit(0);
}

$db = Db::GetDatabaseHandle($baseParams, 'ykval-munin-yubikeystats');
if (!$db->connect())
	logdie($myLog, 'ERROR Database connect error (1)');

function get_count($db, $table, $conditions)
{
	$res = $db->customQuery("SELECT count(1) as count FROM $table WHERE $conditions");

	if ($res)
	{
		$r = $res->fetch(PDO::FETCH_ASSOC);
		return $r['count'];
	}

	return Null;
}

if ($count = get_count($db, 'yubikeys', 'active=true'))
	echo "yubikeys_enabled.value $count\n";

if ($count = get_count($db, 'yubikeys', 'active=false'))
	echo "yubikeys_disabled.value $count\n";

if ($count = get_count($db, 'yubikeys', 'modified >= ' . (time() - (31 * 86400))))
	echo "yubikeys_1month.value $count\n";

if ($count = get_count($db, 'clients', 'active=true'))
	echo "clients_enabled.value $count\n";

if ($count = get_count($db, 'clients', 'active=false'))
	echo "clients_disabled.value $count\n";


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                        http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>org.apache.guacamole</groupId>
    <artifactId>guacamole-common-js</artifactId>
    <packaging>pom</packaging>
    <version>1.3.0</version>
    <name>guacamole-common-js</name>
    <url>http://guacamole.apache.org/</url>

    <description>
        The base JavaScript API of the Guacamole project, providing JavaScript
        support for the Guacamole stack, including a full client
        implementation for the Guacamole protocol.
    </description>

    <!-- All applicable licenses -->
    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <!-- Git repository -->
    <scm>
        <url>https://github.com/apache/guacamole-client</url>
        <connection>scm:git:https://git.wip-us.apache.org/repos/asf/guacamole-client.git</connection>

    </scm>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <plugins>

            <!-- Assemble JS files into single .zip -->
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <appendAssemblyId>false</appendAssemblyId>
                    <descriptors>
                        <descriptor>static.xml</descriptor>
                    </descriptors>
                </configuration>
                <executions>
                    <execution>
                        <id>make-zip</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attached</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- JS/CSS Minification Plugin -->
            <plugin>
                <groupId>com.samaxes.maven</groupId>
                <artifactId>minify-maven-plugin</artifactId>
                <version>1.6.1</version>
                <executions>
                    <execution>
                        <id>default-minify</id>
                        <configuration>

                            <charset>UTF-8</charset>
                            <jsEngine>CLOSURE</jsEngine>

                            <jsSourceDir>/</jsSourceDir>
                            <jsTargetDir>/</jsTargetDir>
                            <jsFinalFile>all.js</jsFinalFile>

                            <jsSourceFiles>
                                <jsSourceFile>common/license.js</jsSourceFile>
                            </jsSourceFiles>

                            <jsSourceIncludes>
                                <jsSourceInclude>modules/**/*.js</jsSourceInclude>
                            </jsSourceIncludes>

                        </configuration>
                        <goals>
                            <goal>minify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Verify format using Apache RAT -->
            <plugin>
                <groupId>org.apache.rat</groupId>
                <artifactId>apache-rat-plugin</artifactId>
                <version>0.12</version>

                <configuration>
                    <excludes>
                        <exclude>**/*.json</exclude>
                    </excludes>
                </configuration>

                <!-- Bind RAT to validate phase -->
                <executions>
                    <execution>
                        <id>validate</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>

            </plugin>

        </plugins>
    </build>

</project>


text:
"""
This is part of WebScout software
Docs EN: http://hack4sec.pro/wiki/index.php/WebScout_en
Docs RU: http://hack4sec.pro/wiki/index.php/WebScout
License: MIT
Copyright (c) Anton Kuzmin <http://anton-kuzmin.ru> (ru) <http://anton-kuzmin.pro> (en)

Job class for HostsBrute* modules
"""

from classes.jobs.GeneratorJob import GeneratorJob

class HostsBruteJob(GeneratorJob):
    """ Job class for Dafs* modules """
    pass


text:
package org.effting.multipart;

import java.util.Collection;

/**
 *
 * @author Charles Kafels Effting.
 *
 */
public class UnsatisfiedMultipartRulesException extends RuntimeException {

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;

	private Collection<String> details;

	/**
	 *
	 * @param details
	 */
	public UnsatisfiedMultipartRulesException(Collection<String> details) {
		super("The current MultiPartFileContext doesn't satisfy the rules applied.");
		this.details = details;
	}

	/**
	 *
	 * @return
	 */
	public Collection<String> getDetails() {
		return details;
	}
}


text:
'*******************************************************************************************'
'                                                                                '
' Download Free Evaluation Version From:     https://bytescout.com/download/web-installer   '
'                                                                                '
' Also available as Web API! Get free API Key https://app.pdf.co/signup                     '
'                                                                                '
' Copyright © 2017-2020 ByteScout, Inc. All rights reserved.                                '
' https://www.bytescout.com                                                                 '
' https://www.pdf.co                                                                        '
'*******************************************************************************************'

Imports System.Drawing
Imports System.Drawing.Imaging
Imports Bytescout.BarCode

Module Program

    Sub Main()

        Try

            ' Create new barcode
            Using barcode As Barcode = New Barcode()

                barcode.RegistrationName = "demo"
                barcode.RegistrationKey = "demo"

                ' Set symbology
                barcode.Symbology = SymbologyType.PharmaCode

                ' Optional margins
                barcode.Margins = New Margins(5, 5, 5, 5)

                ' Set Value
                barcode.Value = "12345"

                ' Set PharmaCode options:
                ' barcode.Options.PharmaCodeSupplementaryCode = True
                ' barcode.Options.PharmaCodeSupplementaryBarColor = Color.Orange
                ' barcode.Options.PharmaCodeMiniature = True
                ' barcode.Options.PharmaCodeTwoTrack = True

                ' Save 300 DPI Image
                barcode.ResolutionX = 300
                barcode.ResolutionY = 300
                barcode.SaveImage("300dpi.png", ImageFormat.Png)

                ' Save 600 DPI Image
                barcode.ResolutionX = 600
                barcode.ResolutionY = 600
                barcode.SaveImage("600dpi.png", ImageFormat.Png)

            End Using

            ' Show image in default image viewer
            Process.Start("300dpi.png")
            Process.Start("600dpi.png")

        Catch ex As Exception
            Console.WriteLine(ex.Message)
        End Try

        Console.WriteLine("Press enter key to exit...")
        Console.ReadLine()

    End Sub

End Module


text:
#define _XOPEN_SOURCE 600  /* Make sure strdup() is in <string.h> */

#include "xmlrpc_config.h"

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>

#include "xmlrpc-c/util_int.h"
#include "xmlrpc-c/string_int.h"
#include "xmlrpc-c/util.h"

void
xmlrpc_assertion_failed(const char * const fileName,
                        int          const lineNumber) {

    fprintf(stderr, "%s:%d: assertion failed\n", fileName, lineNumber);
    abort();
}

static const char * const default_fault_string =
    "Not enough memory for error message";

void xmlrpc_env_init (xmlrpc_env* env)
{
    XMLRPC_ASSERT(env != NULL);

    env->fault_occurred = 0;
    env->fault_code     = 0;
    env->fault_string   = NULL;
}

void
xmlrpc_env_clean(xmlrpc_env * const envP) {

    XMLRPC_ASSERT(envP != NULL);
    XMLRPC_ASSERT(envP->fault_string != XMLRPC_BAD_POINTER);

    /* env->fault_string may be one of three things:
    **   1) a NULL pointer
    **   2) a pointer to the default_fault_string
    **   3) a pointer to a malloc'd fault string
    ** If we have case (3), we'll need to free it. */
    if (envP->fault_string && envP->fault_string != default_fault_string)
        free(envP->fault_string);
    envP->fault_string = XMLRPC_BAD_POINTER;
}

void
xmlrpc_env_set_fault(xmlrpc_env * const envP,
                     int          const faultCode,
                     const char * const faultDescription) {

    char * buffer;

    XMLRPC_ASSERT(envP != NULL);
    XMLRPC_ASSERT(faultDescription != NULL);

    /* Clean up any leftover pointers. */
    xmlrpc_env_clean(envP);

    envP->fault_occurred = 1;
    envP->fault_code     = faultCode;

    /* Try to copy the fault string. If this fails, use a default. */
    buffer = strdup(faultDescription);
    if (buffer == NULL)
        envP->fault_string = (char *)default_fault_string;
    else {
        xmlrpc_force_to_utf8(buffer);
        xmlrpc_force_to_xml_chars(buffer);
        envP->fault_string = buffer;
    }
}

void
xmlrpc_set_fault_formatted_v(xmlrpc_env * const envP,
                             int          const code,
                             const char * const format,
                             va_list            args) {

    const char * faultDescription;

    xmlrpc_vasprintf(&faultDescription, format, args);

    xmlrpc_env_set_fault(envP, code, faultDescription);

    xmlrpc_strfree(faultDescription);
}

void
xmlrpc_env_set_fault_formatted(xmlrpc_env * const envP,
                               int          const code,
                               const char * const format,
                               ...) {
    va_list args;

    XMLRPC_ASSERT(envP != NULL);
    XMLRPC_ASSERT(format != NULL);

    /* Print our error message to the buffer. */
    va_start(args, format);
    xmlrpc_set_fault_formatted_v(envP, code, format, args);
    va_end(args);
}

void
xmlrpc_faultf(xmlrpc_env * const envP,
              const char * const format,
              ...) {

    va_list args;

    XMLRPC_ASSERT(envP != NULL);
    XMLRPC_ASSERT(format != NULL);

    /* Print our error message to the buffer. */
    va_start(args, format);
    xmlrpc_set_fault_formatted_v(envP, XMLRPC_INTERNAL_ERROR, format, args);
    va_end(args);

}

/* Copyright (C) 2001 by First Peer, Inc. All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
** 1. Redistributions of source code must retain the above copyright
**    notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
**    notice, this list of conditions and the following disclaimer in the
**    documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
**    derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
** ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
** SUCH DAMAGE. */


text:
package net.catchpole.scene.renderer;

//   Copyright 2014 catchpole.net
//
//   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.

import net.catchpole.model.Model;
import net.catchpole.model.ValueModel;
import net.catchpole.scene.Milieu;
import net.catchpole.scene.Renderer;
import net.catchpole.scene.effigy.Effigy;
import net.catchpole.scene.effigy.EffigySource;
import net.catchpole.scene.effigy.ModelEffigySource;
import net.catchpole.scene.overlay.ImageOverlay;
import net.catchpole.scene.overlay.ListOverlay;
import net.catchpole.scene.overlay.OverlayManager;
import net.catchpole.scene.spacial.Coordinate3D;
import net.catchpole.scene.spacial.Position;

import javax.media.opengl.GL;
import javax.media.opengl.GL2;

public class ModelRenderer implements Renderer {
    private static final float[] lightPosition = {-45.f, 60.f, 70.0f, 0.f};
    private static final float[] lightAmbient = {0.110f, 0.110f, 0.110f, 1.f};
    private static final float[] lightDiffuse = {1.0f, 1.0f, 1.0f, 1.f};
    private static final float[] materialSpec = {1.0f, 1.0f, 1.0f, 0.0f};
    private static final float[] zeroVec4 = {0.0f, 0.0f, 0.0f, 0.f};

    private final OverlayManager overlayManager;
    private final Model rootModel;
    private final EffigySource effigySource = new ModelEffigySource();
    private final Coordinate3D zoom = new Coordinate3D(0f, 0f, -100f);

    public ModelRenderer(Model model) {
        this.rootModel = model;
        this.overlayManager = new OverlayManager();
    }

    public OverlayManager getOverlayManager() {
        return overlayManager;
    }

    public void init(Milieu milieu) {
        this.overlayManager.addOverlay(new ListOverlay(rootModel));
        this.overlayManager.addOverlay(new ImageOverlay("./test.jpg"));
    }

    public void resize(Milieu milieu, int width, int height) {
        overlayManager.resize(milieu, width, height);

        GL2 gl2 = milieu.getGL().getGL2();

        float aspect = height != 0 ? (float) width / (float) height : 1.0f;

        gl2.glViewport(0, 0, width, height);
        gl2.glScissor(0, 0, width, height);

        gl2.glMatrixMode(GL2.GL_MODELVIEW);
        gl2.glLoadIdentity();

        gl2.glLightfv(GL2.GL_LIGHT0, GL2.GL_POSITION, lightPosition, 0);
        gl2.glLightfv(GL2.GL_LIGHT0, GL2.GL_AMBIENT, lightAmbient, 0);
        gl2.glLightfv(GL2.GL_LIGHT0, GL2.GL_DIFFUSE, lightDiffuse, 0);
        gl2.glLightfv(GL2.GL_LIGHT0, GL2.GL_SPECULAR, zeroVec4, 0);
        gl2.glMaterialfv(GL.GL_FRONT_AND_BACK, GL2.GL_SPECULAR, materialSpec, 0);

        gl2.glEnable(GL2.GL_NORMALIZE);
        gl2.glEnable(GL2.GL_LIGHTING);
        gl2.glEnable(GL2.GL_LIGHT0);
        gl2.glEnable(GL2.GL_COLOR_MATERIAL);
        gl2.glEnable(GL.GL_CULL_FACE);

        gl2.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_FASTEST);

        gl2.glShadeModel(GL2.GL_SMOOTH);
        gl2.glDisable(GL.GL_DITHER);

        gl2.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

        gl2.glEnableClientState(GL2.GL_VERTEX_ARRAY);
        gl2.glEnableClientState(GL2.GL_NORMAL_ARRAY);
        gl2.glEnableClientState(GL2.GL_COLOR_ARRAY);

        gl2.glMatrixMode(GL2.GL_PROJECTION);
        gl2.glLoadIdentity();

        milieu.getGLU().gluPerspective(50.0f, aspect, 0.5f, 2900.0f);
        gl2.glCullFace(GL.GL_BACK);
    }

    public Coordinate3D getZoom() {
        return zoom;
    }

    public void render(Milieu milieu) {
        GL2 gl2 = milieu.getGL().getGL2();

        gl2.glClear(GL.GL_COLOR_BUFFER_BIT);
        gl2.glMatrixMode(GL2.GL_MODELVIEW);

        // single entry ValueModel.  render loop will not render the root node
        ValueModel valueModel = new ValueModel(null, null);
        valueModel.addChild(rootModel);
        render(valueModel, milieu, zoom, 0);

        overlayManager.render(milieu);
    }

    private void render(Model model, Milieu milieu, Coordinate3D source, int depth) {
        float spin1 = (((milieu.getRenderTime() & 0xffff) * (1.0f / (float) 0xffff))) + (depth * 0.2f) * 360f;
        float spin2 = (((milieu.getRenderTime() & 0xfff) * (1.0f / (float) 0xfff))) * 360f;

        int count = 0;
        for (Model subModel : model) {
            count++;
        }

        int index = 0;
        for (Model subModel : model) {
            int objectSpacing = (subModel.iterator().hasNext() ? 150 : 100);
            float rotation = (((float)Math.PI * 2) / ((float) count) * index++) +
                    (1.0f * depth); // offset to stop overlap

            Coordinate3D target = new Coordinate3D(
                    source.getX() + (objectSpacing * (float)Math.sin(rotation)),
                    source.getY() + (objectSpacing * (float)Math.cos(rotation)),
                    source.getZ());

            Effigy effigy = effigySource.getIdiograph(subModel.getType());
            effigy.render(milieu, new Position(target, spin1, spin2));

            render(subModel, milieu, target, depth + 1);
        }
    }

    public void destory(Milieu milieu) {
        effigySource.destroy(milieu);
    }
}


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
null

#### Original name
Phoma glandicola (Desm.) Lév., 1846

### Remarks
null


text:
package errors

import (
	"fmt"
)

// Error indicating a problem connecting to the backend.
type ErrorDatastoreError struct {
	Err        error
	Identifier interface{}
}

func (e ErrorDatastoreError) Error() string {
	return e.Err.Error()
}

// Error indicating a resource does not exist.  Used when attempting to delete or
// udpate a non-existent resource.
type ErrorResourceDoesNotExist struct {
	Err        error
	Identifier interface{}
}

func (e ErrorResourceDoesNotExist) Error() string {
	return fmt.Sprintf("resource does not exist: %s", e.Identifier)
}

// Error indicating an operation is not supported.
type ErrorOperationNotSupported struct {
	Operation  string
	Identifier interface{}
}

func (e ErrorOperationNotSupported) Error() string {
	return fmt.Sprintf("operation %s is not supported on %s", e.Operation, e.Identifier)
}

// Error indicating a resource already exists.  Used when attempting to create a
// resource that already exists.
type ErrorResourceAlreadyExists struct {
	Err        error
	Identifier interface{}
}

func (e ErrorResourceAlreadyExists) Error() string {
	return fmt.Sprintf("resource already exists: %s", e.Identifier)
}

// Error indicating a problem connecting to the backend.
type ErrorConnectionUnauthorized struct {
	Err error
}

func (e ErrorConnectionUnauthorized) Error() string {
	return "connection is unauthorized"
}

// Validation error containing the fields that are failed validation.
type ErrorValidation struct {
	ErroredFields []ErroredField
}

type ErroredField struct {
	Name   string
	Value  interface{}
	Reason string
}

func (e ErrorValidation) Error() string {
	if len(e.ErroredFields) == 0 {
		return "unknown validation error"
	} else if len(e.ErroredFields) == 1 {
		f := e.ErroredFields[0]
		if f.Reason == "" {
			return fmt.Sprintf("error with field %s = '%v'",
				f.Name, f.Value)
		} else {
			return fmt.Sprintf("error with field %s = '%v' (%s)",
				f.Name, f.Value, f.Reason)
		}
	} else {
		s := "error with the following fields:\n"
		for _, f := range e.ErroredFields {
			if f.Reason == "" {
				s = s + fmt.Sprintf("-  %s = '%v'\n",
					f.Name, f.Value)
			} else {
				s = s + fmt.Sprintf("-  %s = '%v' (%s)\n",
					f.Name, f.Value, f.Reason)
			}
		}
		return s
	}
}

// Error indicating insufficient identifiers have been supplied on a resource
// management request (create, apply, update, get, delete).
type ErrorInsufficientIdentifiers struct {
	Name string
}

func (e ErrorInsufficientIdentifiers) Error() string {
	return fmt.Sprintf("insufficient identifiers, missing '%s'", e.Name)
}

// Error indicating an atomic update attempt that failed due to a update conflict.
type ErrorResourceUpdateConflict struct {
	Identifier interface{}
}

func (e ErrorResourceUpdateConflict) Error() string {
	return fmt.Sprintf("update conflict: '%s'", e.Identifier)
}


text:
package pandy.sys;

import java.util.Properties;
import java.util.Vector;
import java.io.File;
import java.io.InputStream;
import java.io.FileInputStream;

/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 2006-2-24
 * Time: 16:54:56
 * To change this template use File | Settings | File Templates.
 */
public class SysproCtl
{
    public static Vector getsysprolist()
    {
        File dir = new File("properties/");
        String[] children = dir.list();
        Vector rs=new Vector();
        if (children != null)
        {
            for (int i = 0; i < children.length; i++)
            {
                // Get filename of file or directory
                String filename = children[i];
                if (filename.endsWith(".properties"))
                {
                    SysproInfo prop=new SysproInfo();
                    Properties dbProps=new Properties();
                    try
                    {   File file = new File("properties/"+filename.substring(0, filename.length() - 11)+".properties");
                        InputStream is=new FileInputStream(file.getAbsolutePath());
                        dbProps.load(is);
                        prop=new SysproInfo(dbProps);
                        prop.setDbname(filename.substring(0, filename.length() - 11));
                        rs.add(prop);
                    }
                    catch(Exception e)
                    {
                        System.err.println("²»ÄܶÁÈ¡ÊôÐÔÎļþ¡£"+"ÇëÈ·±£db.propertiesÔÚclasspathÖ¸¶¨µÄ·¾¶ÖÐ");
                        return null;
                    }

                }
            }
        }
        return rs;
    }
}


text:
Titanium.include('gps.js');

var startApp = function() {
	Titanium.App.tabGroup.activeTab = Titanium.App.tabGroup.tabs[2];
}

var clearText = function() {
	txtLogin.value = '';
}

var executeTrans = function() {
	if (txtLogin.value == '') {
		var dialog = Titanium.UI.createAlertDialog();
		dialog.title =  Titanium.Locale.getString("event_title");
		dialog.message = Titanium.Locale.getString("event_message");
		dialog.show();
		return;
	}
	send(txtLogin.value);
}

var send = function(params) {
	var client = Titanium.Network.createHTTPClient({timeout : 100000});
	var paramater = '&intaliouser=' + params + '&parameter=name:' + params + ',';
	var url = LOGIN_URL + paramater;

	client.open(GET_REC, url);
	client.onload = function() {
		try {
			var resData = eval("("+this.responseText+")");
			if (resData[0].error == 'Yes') {
				var dialog = Titanium.UI.createAlertDialog({});
				dialog.title =  Titanium.Locale.getString("event_yes_title");
				dialog.message = resData[0].contents;
				dialog.show();
				return;
			} else {
				var record = resData[0].count;
				for (var i = 0; i < resData[0].records.length; i++) {
					var xid = resData[0].records[i].xid;
					var name = resData[0].records[i].name;
					Titanium.App.Properties.setString(KEY_CODE_USERXID, xid);
					Titanium.App.Properties.setString(KEY_CODE_USERNAME, name);
					break;
				}

				var latitude = -1;
				var longitude = -1;
				Titanium.Geolocation.purpose = Titanium.Locale.getString("gps_purpose");
				Titanium.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_BEST;
				Titanium.Geolocation.getCurrentPosition(function(e) {
					latitude = e.coords.latitude;
					longitude = e.coords.longitude;
					GPSClient.send(TRACE_URL,latitude, longitude, ACTION_DELIVER, Titanium.App.Properties.getString(KEY_CODE_USERNAME));
					var win = Titanium.UI.createWindow({url:LIST_FILE});
					Titanium.UI.currentTab.open(win, {animated:true});
				})
			}
		} catch (e) {
			Titanium.API.error(e);
			var dialog = Titanium.UI.createAlertDialog({});
			dialog.title =  Titanium.Locale.getString("event_catch_title");
			dialog.message = Titanium.Locale.getString("event_catch_message");
			dialog.show();
			return;
		}
	};
	client.onerror = function() {
		if (client.status == 401) {
			var dialog = Titanium.UI.createAlertDialog({});
			dialog.title =  Titanium.Locale.getString("event_connect_title");
			dialog.message = Titanium.Locale.getString("event_connect_message");
			dialog.show();
			return;
		}
		var dialog = Titanium.UI.createAlertDialog({});
		dialog.title =  Titanium.Locale.getString("event_network_title");
		dialog.message = Titanium.Locale.getString("event_network_message");
		dialog.show();
		return;
	};
	client.send();
};


text:
import string
import sys
import os

from generator.actions import Actions
from random import choice,randint
from struct import *

def random_alpha(a, b):
    return ''.join(choice(string.letters) for _ in range(randint(a, b)))

def get_rand_array(nspace):
    arrs = filter(lambda x: x[1] == "arr",nspace.values())
    if len(arrs) == 0:
        return None
    return choice(arrs)[0]

def get_unique_name(nspace):
    #for some stupid reason, this check isn't working
    #for now, we just make it unlikely a collision will occur
    name = random_alpha(10,16)
    while name in nspace:
        name = random_alpha(10,16)
    return name

types = ["num","arr","view"]
viewtypes = ["uint","int","ushort","short","ubyte","byte"]

class GREATVIEW(Actions):
    def start(self):
        self.nspace = {}
        self.expected = []
        self.arrs = {}
        pass
    def validnew(self):
        name = get_unique_name(self.nspace)
        ntype = choice(types)
        arg2 = ""
        cmd = ""
        if ntype == "num":
            arg1 = randint(-(2**31),2**31-1)
        elif ntype == "arr":
            arg1 = randint(1,200)
            self.arrs[name] = [0]*arg1
        elif ntype == "view":
            arg1 = get_rand_array(self.nspace)
            if not arg1:
                newarr = get_unique_name(self.nspace)
                newarrsize = randint(1,200)
                cmd += "new arr %s %s\n" % (newarr,newarrsize)
                self.nspace[newarr] = (newarr,"arr",newarrsize,arg2)
                self.arrs[newarr] = [0]*newarrsize
                arg1 = newarr
            arg2 = " "+choice(viewtypes)
        cmd += "new %s %s %s%s\n" % (ntype,name,arg1,arg2)
        if ntype != "view":
            self.nspace[name] = (name,ntype,arg1,arg2)
        else:
            self.nspace[name] = (name,ntype,arg1,[self.nspace[arg1],self.arrs[arg1]])

        self.write(cmd)
    def validget(self):
        if len(self.nspace) == 0:
            self.validnew()
        name,vtype,arg1,arg2 = choice(self.nspace.values())
        if vtype == "num":
            cmd = "get %s\n" % name
            res = str(arg1)
        elif vtype == "arr":
            idx = randint(0,arg1-1)
            cmd = "get %s %s\n"  % (name, idx)
            res = str(self.arrs[name][idx])
        else:
            #ignore views. make them figure it out :D
            return

        self.write(cmd)
        self.expected.append(res)

    def validset(self):
        if len(self.nspace) == 0:
            self.validnew()
        name,vtype,arg1,arg2 = choice(self.nspace.values())
        newval = randint(-(2**31),2**31-1)
        if vtype == "num":
            cmd = "set %s %s\n" % (name,newval)
            self.nspace[name] = (name,vtype,newval,"")
        elif vtype == "arr":
            idx = randint(0,arg1-1)
            cmd = "set %s %s %s\n" % (name,idx,newval)
            self.arrs[name][idx] = newval
        else:
            #ignore views. make them figure it out :D
            return

        self.write(cmd)

    def validdel(self):
        if len(self.nspace) == 0:
            self.validnew()
        name,vtype,arg1,arg2 = choice(self.nspace.values())
        del self.nspace[name]
        if vtype == "arr":
            del self.arrs[name]

    def end(self):
        self.expected.append("Done.")
        self.write("\x00")
        for line in self.expected:
            self.read(delim="\n",expect=line)


text:
/*
 * $Id: SerializerTrace.java 468654 2006-10-28 07:09:23Z minchau $
 */
package org.apache.xml.serializer;

import org.xml.sax.Attributes;

/**
 * This interface defines a set of integer constants that identify trace event
 * types.
 *
 * @xsl.usage internal
 */

public interface SerializerTrace {

  /**
   * Event type generated when a document begins.
   *
   */
  public static final int EVENTTYPE_STARTDOCUMENT = 1;

  /**
   * Event type generated when a document ends.
   */
  public static final int EVENTTYPE_ENDDOCUMENT = 2;

  /**
   * Event type generated when an element begins (after the attributes have been processed but before the children have been added).
   */
  public static final int EVENTTYPE_STARTELEMENT = 3;

  /**
   * Event type generated when an element ends, after it's children have been added.
   */
  public static final int EVENTTYPE_ENDELEMENT = 4;

  /**
   * Event type generated for character data (CDATA and Ignorable Whitespace have their own events).
   */
  public static final int EVENTTYPE_CHARACTERS = 5;

  /**
   * Event type generated for ignorable whitespace (I'm not sure how much this is actually called.
   */
  public static final int EVENTTYPE_IGNORABLEWHITESPACE = 6;

  /**
   * Event type generated for processing instructions.
   */
  public static final int EVENTTYPE_PI = 7;

  /**
   * Event type generated after a comment has been added.
   */
  public static final int EVENTTYPE_COMMENT = 8;

  /**
   * Event type generate after an entity ref is created.
   */
  public static final int EVENTTYPE_ENTITYREF = 9;

  /**
   * Event type generated after CDATA is generated.
   */
  public static final int EVENTTYPE_CDATA = 10;

  /**
   * Event type generated when characters might be written to an output stream,
   *  but  these characters never are. They will ultimately be written out via
   * EVENTTYPE_OUTPUT_CHARACTERS. This type is used as attributes are collected.
   * Whenever the attributes change this event type is fired. At the very end
   * however, when the attributes do not change anymore and are going to be
   * ouput to the document the real characters will be written out using the
   * EVENTTYPE_OUTPUT_CHARACTERS.
   */
  public static final int EVENTTYPE_OUTPUT_PSEUDO_CHARACTERS = 11;

  /**
   * Event type generated when characters are written to an output stream.
   */
  public static final int EVENTTYPE_OUTPUT_CHARACTERS = 12;

  /**
   * Tell if trace listeners are present.
   *
   * @return True if there are trace listeners
   */
  public boolean hasTraceListeners();

  /**
   * Fire startDocument, endDocument events.
   *
   * @param eventType One of the EVENTTYPE_XXX constants.
   */
  public void fireGenerateEvent(int eventType);

  /**
   * Fire startElement, endElement events.
   *
   * @param eventType One of the EVENTTYPE_XXX constants.
   * @param name The name of the element.
   * @param atts The SAX attribute list.
   */
  public void fireGenerateEvent(int eventType, String name, Attributes atts);

  /**
   * Fire characters, cdata events.
   *
   * @param eventType One of the EVENTTYPE_XXX constants.
   * @param ch The char array from the SAX event.
   * @param start The start offset to be used in the char array.
   * @param length The end offset to be used in the chara array.
   */
  public void fireGenerateEvent(int eventType, char ch[], int start, int length);

  /**
   * Fire processingInstruction events.
   *
   * @param eventType One of the EVENTTYPE_XXX constants.
   * @param name The name of the processing instruction.
   * @param data The processing instruction data.
   */
  public void fireGenerateEvent(int eventType, String name, String data);

  /**
   * Fire comment and entity ref events.
   *
   * @param eventType One of the EVENTTYPE_XXX constants.
   * @param data The comment or entity ref data.
   */
  public void fireGenerateEvent(int eventType, String data);

}


text:
<!DOCTYPE html>

    <meta charset="utf-8"/>
    <meta name="description" content="Mind Trails - a Project Implicit Mental Health Study" />
    <meta name="keywords" content="virginia psychology implicit mind trails"/>
    <meta name="author" content="virginia.edu" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
    <title>Mind Trails</title>

    <link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400italic,700,700italic,600' rel='stylesheet' type='text/css'/>

    <link rel="stylesheet" media="screen" th:href="@{/bower/bootstrap/dist/css/bootstrap.min.css}" />
    <link rel="stylesheet" media="screen" th:href="@{/css/jquery-ui.min.css}" />
    <link rel="stylesheet" media="screen" th:href="@{/css/jquery-ui.theme.css}" />
    <link rel="stylesheet" media="screen" th:href="@{/css/dialog.css}" />

    <link rel="stylesheet" media="screen" th:href="@{/css/mindtrails.css}" />
    <link rel="stylesheet" media="screen" th:href="@{/css/r34.css}" />

                        HOME

ABOUT

FAQ

CONTACT

MEET THE TEAM

MENTAL HEALTH RESOURCES

RESEARCH SUPPORT

            Logged in as (  ) |My Progress | Account Settings | Logout

            Already Participating?
            <button>Log In</button>

Welcome!

This is a Template:

Welcome

Please see home.html for an example of how to grab poritions of this template to use within a page.

And that's it folks!

but I hope to have more to show soon.

Terms and Conditions

Privacy Policy

Project Implicit Mental
                    Health

Administration Tools

This section is only visible to you because you have been granted administrative access.

User Administration: provides a way to view all accounts created on the system.

Email Messages: allows you to send yourself a copy of all email messages
                        coming from the system.

Sessions: allows you to view all available sessions, and jump into any
                        content within a session.

Gift Cards Account: allows you to check information about the gift card
                        account for your study.

© Copyright 2016 • All rights reserved


text:
define(function() {

    var Airport = Class.extend({
        init: function(paper, options) {
            var self = this;

            self.paper  = paper;
            self.name   = options.name || "Lorem ipsum";
            self.fillColor = options.fillColor || "#f00";
            self.strokeColor = options.strokeColor || "#000";
            self.radius = options.radius || 10;
            self.center = options.center || paper.view.center;
            self.size = options.size || [20, 100];
            self.angle = options.angle || 45;

            self.shape = new paper.Shape.Rectangle({
                //topLeft: new paper.Point(self.center).subtract(self.size/2),
                //bottomRight: new paper.Point(self.center).add(self.size/2),
                point: self.center,
                size: self.size,
                fillColor: self.fillColor,
                strokeColor: self.strokeColor,
                rotation: self.angle
            });
        },

        getShape: function() {
            return this.shape;
        },
    });

    return Airport;
});


text:
package org.apache.http.io;

import java.io.IOException;

import org.apache.http.HttpException;
import org.apache.http.HttpMessage;

/**
 * Abstract message parser intended to build HTTP messages from an arbitrary
 * data source.
 *
 *
 * @version $Revision$
 *
 * @since 4.0
 */
public interface HttpMessageParser {

    /**
     * Generates an instance of {@link HttpMessage} from the underlying data
     * source.
     *
     * @return HTTP message
     * @throws IOException in case of an I/O error
     * @throws HttpException in case of HTTP protocol violation
     */
    HttpMessage parse()
        throws IOException, HttpException;

}


text:
require 'test_helper'

class AffiliationsControllerTest < ActionController::TestCase
  setup do
    @affiliation = affiliations(:one)
  end

  test "should get index" do
    get :index
    assert_response :success
    assert_not_nil assigns(:affiliations)
  end

  test "should get new" do
    get :new
    assert_response :success
  end

  test "should create affiliation" do
    assert_difference('Affiliation.count') do
      post :create, :affiliation => @affiliation.attributes
    end

    assert_redirected_to affiliation_path(assigns(:affiliation))
  end

  test "should show affiliation" do
    get :show, :id => @affiliation.to_param
    assert_response :success
  end

  test "should get edit" do
    get :edit, :id => @affiliation.to_param
    assert_response :success
  end

  test "should update affiliation" do
    put :update, :id => @affiliation.to_param, :affiliation => @affiliation.attributes
    assert_redirected_to affiliation_path(assigns(:affiliation))
  end

  test "should destroy affiliation" do
    assert_difference('Affiliation.count', -1) do
      delete :destroy, :id => @affiliation.to_param
    end

    assert_redirected_to affiliations_path
  end
end


text:
<?php

declare(strict_types=1);

/**
 * This file is part of Narrowspark Framework.
 *
 * (c) Daniel Bannert <d.bannert@anolilab.de>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Viserio\Component\Console\Traits;

use Closure;

/**
 * @method null|array|string option($key = null)
 * @method void              comment(string $string, $verbosityLevel = null)
 * @method void              line(string $string, ?string $style = null, $verbosityLevel = null)
 */
trait ConfirmableTrait
{
    /**
     * Confirm before proceeding with the action.
     *
     * @param string            $warning
     * @param null|bool|Closure $callback
     *
     * @return bool
     */
    public function confirmToProceed(string $warning = 'Application is in Production mode!', $callback = null): bool
    {
        $callback = $callback ?? $this->getDefaultConfirmCallback();
        $shouldConfirm = $callback instanceof Closure ? $callback() : $callback;

        if ($shouldConfirm) {
            if ($this->option('force')) {
                return true;
            }

            $this->comment(\str_repeat('*', \strlen($warning) + 12));
            $this->comment('*     ' . $warning . '     *');
            $this->comment(\str_repeat('*', \strlen($warning) + 12));
            $this->line('');

            $confirmed = $this->confirm('Do you really wish to run this command?');

            if (! $confirmed) {
                $this->comment('Command Cancelled!');

                return false;
            }
        }

        return true;
    }

    /**
     * Confirm a question with the user.
     *
     * @param string $question
     * @param bool   $default
     *
     * @return bool|string
     */
    abstract public function confirm(string $question, bool $default = false);

    /**
     * Get the default confirmation callback.
     *
     * @return Closure
     */
    protected function getDefaultConfirmCallback(): Closure
    {
        return function () {
            if ($this->container !== null && $this->container->has('env')) {
                return $this->container->get('env') === 'prod';
            }

            if (($env = \getenv('APP_ENV')) !== false) {
                return $env === 'prod';
            }

            return true;
        };
    }
}


text:
"use strict";

var Utils = require('./utils.js');

var VPatch = new Utils._class({
    create : function(op, vNode, patch) {
        this.op = Number(op)
        this.vNode = vNode
        this.patch = patch
    },
    type : 'V-PATCH'

});

VPatch.NONE = 0
VPatch.VTEXT = 1
VPatch.VNODE = 2
VPatch.WIDGET = 3
VPatch.PROPS = 4
VPatch.ORDER = 5
VPatch.INSERT = 6
VPatch.REMOVE = 7
VPatch.THUNK = 8

VPatch.addOp = function(key, value) {
    VPatch[key] = value;
    return VPatch;
};

VPatch.getOp = function(key){
        return VPatch[key];
}
module.exports = VPatch;


text:
require 'spec_helper'

RSpec.describe 'Generators' do
  let(:destination) { Howitzer::BaseGenerator.destination }
  let(:output) { StringIO.new }
  subject { file_tree_info(destination) }
  before do
    Howitzer::BaseGenerator.logger = output
    generator_name.new
  end
  after { FileUtils.rm_r(destination) }

  describe 'TasksGenerator' do
    let(:generator_name) { Howitzer::TasksGenerator }
    let(:expected_result) do
      [
          {:name=> '/tasks', :is_directory=>true},
          {:name=> '/tasks/common.rake', :is_directory=>false, :size=>template_file_size('tasks', 'common.rake')}
      ]
    end
    it { is_expected.to eql(expected_result) }
    describe 'output' do
      let(:expected_output) do
        "  * Base rake task generation ...
      Added 'tasks/common.rake' file\n"
      end
      subject { output.string }
      it { is_expected.to eql(expected_output) }
    end
  end
end


text:
using System;
using System.Xml;

namespace Reporting.Rdl
{
	///<summary>
	/// Linking mechanism defining the tree of the report.
	///</summary>
	[Serializable]
	abstract public class ReportLink
	{
		internal ReportDefn OwnerReport;			// Main Report instance
		internal ReportLink Parent;			// Parent instance
		internal int ObjectNumber;

		internal ReportLink(ReportDefn r, ReportLink p)
		{
			OwnerReport = r;
			Parent = p;
			ObjectNumber = r.GetObjectNumber();
		}

		// Give opportunity for report elements to do additional work
		//   e.g.  expressions should be parsed at this point
		abstract internal void FinalPass();

		internal bool InPageHeaderOrFooter()
		{
			for (ReportLink rl = this.Parent; rl != null; rl = rl.Parent)
			{
				if (rl is PageHeader || rl is PageFooter)
					return true;
			}
			return false;
		}
	}
}


text:
package main

import "log"
import "flag"
import "os"
import "os/signal"
import "time"
import "net/http"
import _ "net/http/pprof"
import "github.com/tobz/cadastre"

var (
	configurationFile = flag.String("config", "", "the path to the Cadastre configuration file to load")
	debugMode         = flag.Bool("debug", false, "whether or not to run the daemon in debug mode")
)

func init() {
	flag.Parse()

	if *configurationFile == "" {
		log.Fatal("You must specify the configuration file to load!")
	}
}

func main() {
	// Try and load our configuration.
	log.Printf("Loading configuration...")

	config, err := cadastre.LoadConfigurationFromFile(*configurationFile)
	if err != nil {
		log.Fatalf("Couldn't load configuration file! %s", err)
	}

	config.DebugMode = *debugMode

	// Start up our background fetcher.
	log.Printf("Starting up background fetcher...")

	fetcher := &cadastre.Fetcher{Configuration: config}

	err = fetcher.Start()
	if err != nil {
		log.Fatalf("Couldn't start background fetcher! %s", err)
	}

	// Spin up our web server.
	log.Printf("Starting up web server...")

	webServer := &cadastre.WebUI{Configuration: config}
	err = webServer.StartListening()
	if err != nil {
		log.Fatalf("Couldn't start web server! %s", err)
	}

	log.Printf("Cadastre is now ready to serve requests.")

	// Wait until we're told to exit and spin until that happens.
	sig := make(chan os.Signal, 1)
	signal.Notify(sig, os.Interrupt)

	debugTick := time.Tick(time.Second * 5)

    // If we're in debug mode, start the pprof debug HTTP endpoint.
    go func() {
        log.Println(http.ListenAndServe("localhost:6060", nil))
    }()

	for {
		select {
		case <-sig:
			log.Printf("Shutting down fetcher and exiting...")

			fetcher.Stop()
			os.Exit(0)
		case <-debugTick:
			if *debugMode {
				cacheHitRate := 0.0
				if webServer.CacheRequests != 0 {
					cacheHitRate = ((float64(webServer.CacheHits) / float64(webServer.CacheRequests)) * float64(100))
				}
				log.Printf("web stats: cache (requests / hit rate): %d / %.2f%s", webServer.CacheRequests, cacheHitRate, "%")
			}
		}
	}
}


text:
package com.adamroughton.concentus.cluster.coordinator;

public interface ServiceIdAllocator {

	int newMetricSource(String name, String serviceType);

}


text:
package net.objectlab.kit.util;

import java.util.Collection;

/**
 * @author Benoit Xhenseval
 *
 */
public final class CollectionUtil {
    private CollectionUtil() {
    }

    /**
     * @return true if collection null or empty.
     */
    public static boolean isEmpty(final Collection<?> col) {
        return col == null || col.isEmpty();
    }

    /**
     * @return true if collection not empty (null safe).
     */
    public static boolean isNotEmpty(final Collection<?> col) {
        return col != null && !col.isEmpty();
    }

    /**
     * @return true if collection has only 1 item (null safe).
     */
    public static boolean hasOneItem(final Collection<?> col) {
        return col != null && col.size() == 1;
    }

    /**
     * @return true if array not empty (null safe).
     */
    public static boolean isNotEmpty(final Object[] array) {
        return array != null && array.length > 0;
    }

    /**
     * @return size of collection if not null, otherwise 0.
     */
    public static int size(final Collection<?> col) {
        return col != null ? col.size() : 0;
    }

    /**
     * @return true if collection is not null and contains the items
     */
    public static boolean contains(final Collection<?> collection, final Object item) {
        return collection != null && collection.contains(item);
    }

    /**
     * @return true if collection is not null and contains the items
     */
    public static boolean containsAny(final Collection<?> collection, final Object... items) {
        if (collection != null) {
            for (final Object item : items) {
                final boolean b = collection.contains(item);
                if (b) {
                    return true;
                }
            }
        }
        return false;
    }

    /**
     * @return true if none of the collections are empty or null
     */
    public static boolean noneEmpty(final Collection<?>... collections) {
        if (collections.length == 0) {
            return false;
        }
        for (final Collection<?> col : collections) {
            if (isEmpty(col)) {
                return false;
            }
        }
        return true;
    }

    public static boolean sameContent(final Collection<?> c1, final Collection<?> c2) {
        if (c1 == c2 || isEmpty(c2) && isEmpty(c1)) {
            return true;
        }
        boolean same = false;
        if (c1 != null && c2 != null) {
            same = c1.size() == c2.size();
            if (same) {
                same = c1.equals(c2);
            }
        }
        return same;
    }
}


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>Code Coverage for /Applications/MAMP/htdocs/DataSpotGhent/application/models/UserAuth.php</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link href="css/bootstrap.min.css" rel="stylesheet">
  <link href="css/bootstrap-responsive.min.css" rel="stylesheet">
  <link href="css/style.css" rel="stylesheet">

/Applications/MAMP/htdocs/DataSpotGhent /

application /

models /

UserAuth.php

Code Coverage

Classes and Traits

Functions and Methods

Lines

      Total

0.00%

0 / 1

0.00%

0 / 1

      <acronym title="Change Risk Anti-Patterns (CRAP) Index">CRAP</acronym>

0.00%

0 / 8

      Application_Model_UserAuth

0.00%

0 / 1

0.00%

0 / 1

      2

0.00%

0 / 8

       __construct($username, $password)

0.00%

0 / 1

      2

0.00%

0 / 8

1
	<?php

2

3
	class Application_Model_UserAuth extends Zend_Auth_Adapter_DbTable

4
	{

5

6
	    public function __construct($username, $password){

7
	        parent::__construct();

8
	        $this->setTableName('users')

9
	             ->setIdentityColumn('user_username')

10
	             ->setCredentialColumn('user_password')

11
	             ->setIdentity($username)

12
	             ->setCredential($password);

13
	    }

14

Legend

     Executed
     Not Executed
     Dead Code

     Generated by PHP_CodeCoverage 1.2.12 using PHP 5.4.4 and PHPUnit 3.7.22 at Thu Jul 25 0:19:21 CEST 2013.


text:
@interface DLDismissibleViewController : UIViewController

@end


text:
package com.lang.manager.dashboard;

import org.ppl.BaseClass.LibLang;

public class _ListSQL extends LibLang {
	public _ListSQL() {
		// TODO Auto-generated constructor stub
		String className = this.getClass().getCanonicalName();
		GetSubClassName(className);
		SelfPath(this.getClass().getPackage().getName());
	}
}


text:
It is a simple chat application that utilizes two transports instead of only one. The authentication is not a concern for you right now. Just let the user pick a username that has not already been picked. Registration/Passwords are not needed. You can do them if you fancy but seriously, why? :)

The first trasport is websocket. I suggest you use the WebSocket native APIs on client side. use the "ws" module on nodejs. This part is extremely straightforward and I don't think I have to talk much about it.

The second trasport is the challenging part. It allows for offline communication using the brand new "Service Worker" standards. The idea is that the application should be usable without actually being online. The user can just type in the url for the application and type in their messages as if they were online. (The behaviour is similar to how google docs can be worked on offline.) Read up on service worker here -

http://www.html5rocks.com/en/tutorials/service-worker/introduction/

As a bonus, if you can implement this "Push Notification" option on the reciver. So that the receiver will be notified even if they are not presently browsing the demo website. This feature currently only works on chrome (which is not a problem). Read up here -

https://developers.google.com/web/updates/2015/03/push-notifications-on-the-open-web

I hope you will find this task challenging and educative at the same time.

# Testing

You need [mocha](https://github.com/mochajs/mocha)

`npm test`


text:
import React, { Component } from 'react';
import PropTypes from 'prop-types';

import MenuListItem from './../organisms/MenuListItem';

class SidebarMenu extends Component {

    constructor(props) {
        super(props);
    }

    render() {
        return (

        {
          this.props.menu.map((menuItem, index) => {
              return (

                {menuItem.label}

                  {
                    menuItem.submenu.map((menuItem, index) => {
                        return (
                        <MenuListItem
                          key={index}
                          href={menuItem.href}
                          icon={menuItem.icon}
                          label={menuItem.label} />
                      );
                    })
                  }

            );
          })
        }

    );
    }

}

SidebarMenu.propTypes = {
    menu: PropTypes.array
};

export default SidebarMenu;


text:
package org.apache.http.examples.client;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.AuthState;
import org.apache.http.auth.Credentials;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.protocol.ClientContext;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext;

/**
 * A simple example that uses HttpClient to execute an HTTP request against
 * a target site that requires user authentication.
 */
public class ClientInteractiveAuthentication {

    public static void main(String[] args) throws Exception {
        DefaultHttpClient httpclient = new DefaultHttpClient();

        // Create local execution context
        HttpContext localContext = new BasicHttpContext();

        HttpGet httpget = new HttpGet("http://localhost/test");

        boolean trying = true;
        while (trying) {
            System.out.println("executing request " + httpget.getRequestLine());
            HttpResponse response = httpclient.execute(httpget, localContext);

            System.out.println("----------------------------------------");
            System.out.println(response.getStatusLine());

            // Consume response content
            HttpEntity entity = response.getEntity();
            if (entity != null) {
                entity.consumeContent();
            }

            int sc = response.getStatusLine().getStatusCode();

            AuthState authState = null;
            if (sc == HttpStatus.SC_UNAUTHORIZED) {
                // Target host authentication required
                authState = (AuthState) localContext.getAttribute(ClientContext.TARGET_AUTH_STATE);
            }
            if (sc == HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED) {
                // Proxy authentication required
                authState = (AuthState) localContext.getAttribute(ClientContext.PROXY_AUTH_STATE);
            }

            if (authState != null) {
                System.out.println("----------------------------------------");
                AuthScope authScope = authState.getAuthScope();
                System.out.println("Please provide credentials");
                System.out.println(" Host: " + authScope.getHost() + ":" + authScope.getPort());
                System.out.println(" Realm: " + authScope.getRealm());

                BufferedReader console = new BufferedReader(new InputStreamReader(System.in));

                System.out.print("Enter username: ");
                String user = console.readLine();
                System.out.print("Enter password: ");
                String password = console.readLine();

                if (user != null && user.length() > 0) {
                    Credentials creds = new UsernamePasswordCredentials(user, password);
                    httpclient.getCredentialsProvider().setCredentials(authScope, creds);
                    trying = true;
                } else {
                    trying = false;
                }
            } else {
                trying = false;
            }
        }

        // When HttpClient instance is no longer needed,
        // shut down the connection manager to ensure
        // immediate deallocation of all system resources
        httpclient.getConnectionManager().shutdown();
    }
}


text:
body {
  background: url('../foobar.png')
}

.param {
  background: url("../foobar.png?foo=true")
}

.anchor {
  background: url(../foobar.png#foo)
}

.param.anchor {
  background: url("../foobar.png#foo?foo=true#foo")
}


text:
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import TopoJSON from '../src/ol/format/TopoJSON.js';
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
import TileJSON from '../src/ol/source/TileJSON.js';
import VectorSource from '../src/ol/source/Vector.js';
import {Fill, Stroke, Style} from '../src/ol/style.js';

const raster = new TileLayer({
  source: new TileJSON({
    url: 'https://api.tiles.mapbox.com/v3/mapbox.world-dark.json?secure'
  })
});

const style = new Style({
  fill: new Fill({
    color: 'rgba(255, 255, 255, 0.6)'
  }),
  stroke: new Stroke({
    color: '#319FD3',
    width: 1
  })
});

const vector = new VectorLayer({
  source: new VectorSource({
    url: 'data/topojson/world-110m.json',
    format: new TopoJSON({
      // don't want to render the full world polygon (stored as 'land' layer),
      // which repeats all countries
      layers: ['countries']
    }),
    overlaps: false
  }),
  style: style
});

const map = new Map({
  layers: [raster, vector],
  target: 'map',
  view: new View({
    center: [0, 0],
    zoom: 1
  })
});


text:
'use strict'
angular.module('myApp.view1', ['ui.router','ui.grid','ui.grid.pagination'])

.config(['$stateProvider', function ($stateProvider) {

    $stateProvider
       .state('view1', {
           url: '/view1',
           templateUrl: 'view1/view1.html',
           controller: 'View1Ctrl'
       })

}])

.controller('View1Ctrl', ['$state', '$scope', 'dataServices', '$http', function ($state, $scope, dataServices, $http) {

    $scope.fn1 = function () {
        $state.go("datepic1");
    }

    $scope.gridOptions1 = "delete";

    $scope.gridData = dataServices.gridData;

    //directive code Example

    //ui-grid
    var paginationOptions = {
        pageNumber: 1,
        pageSize: 25,
        sort: null
    };

    $scope.gridOptions = {
        enableFiltering: true,
        enableColumnResize: true,
        paginationPageSizes: [25, 50, 75],
        paginationPageSize: 25,
        onRegisterApi: function (gridApi) {
            $scope.gridApi = gridApi;
            $scope.gridApi.core.on.sortChanged($scope, function (grid, sortColumns) {
                if (sortColumns.length == 0) {
                    paginationOptions.sort = null;
                } else {
                    paginationOptions.sort = sortColumns[0].sort.direction;
                }
                getPage();
            });
            gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
                paginationOptions.pageNumber = newPage;
                paginationOptions.pageSize = pageSize;
                getPage();
            });
        }
    };

    //$scope.gridOptions.columnDefs = [
	//  { name: 'id' },
	//  { name: 'name' },
	//  { name: 'age' },
	//  { name: 'gender' },
	//  { name: 'email' },
    //];
    $scope.gridOptions.columnDefs = [
	 { name: 'name' },
      { name: 'gender', enableSorting: false },
      { name: 'company', enableSorting: false }

    ];
    $scope.gridOptions.data = [];

    var myPosts = 'http://jsonplaceholder.typicode.com/posts';
    var myuserdet = 'https://cdn.rawgit.com/angular-ui/ui-grid.info/gh-pages/data/500_complex.json';
    //$http.get(myPosts)
    //.success(function (data) {
    //	$scope.gridOptions.data = data;
    //});

    var getPage = function () {
        var url;
        url = 'https://cdn.rawgit.com/angular-ui/ui-grid.info/gh-pages/data/100.json';

        $http.get(url)
        .success(function (data) {
            $scope.gridOptions.totalItems = 100;
            var firstRow = (paginationOptions.pageNumber - 1) * paginationOptions.pageSize;
            $scope.gridOptions.data = data.slice(firstRow, firstRow + paginationOptions.pageSize);
        });
    };

    getPage();

}]);


text:
package com.congtyhai.adapter;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.congtyhai.dms.R;
import com.congtyhai.model.api.BranchInfoResult;
import com.congtyhai.util.ItemRowClick;

import java.util.List;

/**
 * Created by HAI on 10/4/2017.
 */

public class BranchAdapter extends RecyclerView.Adapter<BranchAdapter.MyViewHolder> {

    List<BranchInfoResult> branchInfoResults;

    ItemRowClick locationClick;

    ItemRowClick callClick;

    public BranchAdapter(List<BranchInfoResult> branchInfoResults, ItemRowClick locationClick, ItemRowClick callClick) {
        this.branchInfoResults = branchInfoResults;
        this.locationClick = locationClick;
        this.callClick = callClick;
    }

    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View itemView = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.branch_item, parent, false);

        return new MyViewHolder(itemView);
    }

    @Override
    public void onBindViewHolder(MyViewHolder holder, final int position) {
        BranchInfoResult infoResult = branchInfoResults.get(position);
        holder.name.setText(infoResult.getName());
        holder.address.setText(infoResult.getAddress());
        holder.phone.setText(infoResult.getPhone());

        holder.phone.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                callClick.onClick(position);
            }
        });

        holder.image.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                locationClick.onClick(position);
            }
        });

    }

    @Override
    public int getItemCount() {
        return branchInfoResults.size();
    }

    public class MyViewHolder extends RecyclerView.ViewHolder {
        public TextView name, address, phone;
        public ImageView image;

        public MyViewHolder(View view) {
            super(view);
            name = (TextView) view.findViewById(R.id.name);
            address = (TextView) view.findViewById(R.id.address);
            image = (ImageView) view.findViewById(R.id.image);
            phone = (TextView) view.findViewById(R.id.phone);

        }
    }
}


text:
Risk No

A

Risk Description

					  Kehilangan aset.

Contributing Factor

Kerusakan peralatan supervisi/ audit.

Pemindahan aset yang tidak terkontrol dengan baik

Gudang tidak dapat menampung.

Peminjaman aset yang tidak diawasi.

Kurangnya pengawasan aset

Pencurian part di bengkel (kehilangan inventory.

Tidak teridentifikasinya aset dikarenakan nilai aset yang dibawah 1 juta (tidak dicatat)

Penyimpanan aset tidak rapi

Aset tidak tercatat dengan baik

Data aset hilang karena komputer yang terkena virus dan penggunaan software bajakan

Belum adanya manajemen aset

Inherent Risk

Likelihood

									   2.5

Consequence

									   3.3

Inherent Risk Rating

										L

Wahana Artha Group

Control Description

									-

Control Rating

										<select class="form-control input-sm" name="cr">
											<option value="">Please Vote</option>
											<option value="1">1</option>
											<option value="2">2</option>
											<option value="3">3</option>
											<option value="4">4</option>
											<option value="5">5</option>
											<option value="6">6</option>
											<option value="7">7</option>
											<option value="8">8</option>
											<option value="9">9</option>
											<option value="10">10</option>
										</select>

Residual Risk Rating

									-

Wahana Artha Harsaka

Control Description

									-

Control Rating

										<select class="form-control input-sm" name="cr">
											<option value="">Please Vote</option>
											<option value="1">1</option>
											<option value="2">2</option>
											<option value="3">3</option>
											<option value="4">4</option>
											<option value="5">5</option>
											<option value="6">6</option>
											<option value="7">7</option>
											<option value="8">8</option>
											<option value="9">9</option>
											<option value="10">10</option>
										</select>

Residual Risk Rating

									-

PT Wahana Ritelindo

Control Description

									-

Control Rating

										<select class="form-control input-sm" name="cr">
											<option value="">Please Vote</option>
											<option value="1">1</option>
											<option value="2">2</option>
											<option value="3">3</option>
											<option value="4">4</option>
											<option value="5">5</option>
											<option value="6">6</option>
											<option value="7">7</option>
											<option value="8">8</option>
											<option value="9">9</option>
											<option value="10">10</option>
										</select>

Residual Risk Rating

									-

PT Wahana Artha Motorental

Control Description

									-

Control Rating

										<select class="form-control input-sm" name="cr">
											<option value="">Please Vote</option>
											<option value="1">1</option>
											<option value="2">2</option>
											<option value="3">3</option>
											<option value="4">4</option>
											<option value="5">5</option>
											<option value="6">6</option>
											<option value="7">7</option>
											<option value="8">8</option>
											<option value="9">9</option>
											<option value="10">10</option>
										</select>

Residual Risk Rating

									-

Tristar

Control Description

									-

Control Rating

										<select class="form-control input-sm" name="cr">
											<option value="">Please Vote</option>
											<option value="1">1</option>
											<option value="2">2</option>
											<option value="3">3</option>
											<option value="4">4</option>
											<option value="5">5</option>
											<option value="6">6</option>
											<option value="7">7</option>
											<option value="8">8</option>
											<option value="9">9</option>
											<option value="10">10</option>
										</select>

Residual Risk Rating

									-

PT Wahana Makmur Sejati

Control Description

									-

Control Rating

										<select class="form-control input-sm" name="cr">
											<option value="">Please Vote</option>
											<option value="1">1</option>
											<option value="2">2</option>
											<option value="3">3</option>
											<option value="4">4</option>
											<option value="5">5</option>
											<option value="6">6</option>
											<option value="7">7</option>
											<option value="8">8</option>
											<option value="9">9</option>
											<option value="10">10</option>
										</select>

Residual Risk Rating

									-


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="false" context="typecomment_context" deleted="false" description="Comment for created types" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.typecomment" name="typecomment">/**
 * description
 *
 * @author ${user}
 * @version
 * @since 1.0
 * ${tags}
 */</template></templates>


text:
/*
 * UUID.cpp
 *
 *  Created on: 2014-12-21
 *      Author: manson
 */

#include <sstream>

#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>

#include "UUID.h"

namespace flint {

UUID::UUID() {
	// TODO Auto-generated constructor stub

}

UUID::~UUID() {
	// TODO Auto-generated destructor stub
}

std::string UUID::generateUUID() {
	boost::uuids::uuid uuid = boost::uuids::random_generator()();
	std::stringstream ss;
	ss << uuid;
	std::string _uuid = ss.str();
	return _uuid;
}

} /* namespace flint */


text:
package ui.gui.graphical.game;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

import logic.Dragon;

/**
 * The Class Configuration.
 */
public class Configuration
{
    /* (non-Javadoc)
     * @see java.lang.Object#clone()
     */
    @Override
    protected Object clone()
    {
        Configuration res = new Configuration();
        res._fileName = this._fileName;
        res._mazeSize = this._mazeSize;
        res._numberOfDragons = this._numberOfDragons;

        for (Map.Entry<Integer, Action> elem : _keys.entrySet())
            res._keys.put(elem.getKey(), elem.getValue());

        return res;
    }

    /**
     * Instantiates a new configuration.
     */
    private Configuration() { }

    /**
     * Instantiates a new configuration.
     *
     * @param fileName the file name
     */
    public Configuration(String fileName)
    {
        _fileName = fileName;

        ObjectInputStream is = null;
        try
        {
            is = new ObjectInputStream(new FileInputStream(_fileName));
            ReadFromFile(is);
        }
        catch (/*FileNotFoundException | */ClassNotFoundException | IOException e)
        {
            initializeWithDefaults();
            TrySaveToFile();
        }
        finally
        {
            if (is != null) try { is.close(); } catch (IOException e) {    }
        }
    }

    /**
     * Try save to file.
     *
     * @return true, if successful
     */
    public boolean TrySaveToFile()
    {
        ObjectOutputStream os = null;
        try
        {
            os = new ObjectOutputStream(new FileOutputStream(_fileName, false));
            WriteToFile(os);
        }
        catch (IOException e)
        {
            return true;
        }
        finally
        {
            if (os != null) try { os.close(); } catch (IOException e) {    }
        }

        return false;
    }

    /**
     * Write to file.
     *
     * @param os the os
     * @throws IOException Signals that an I/O exception has occurred.
     */
    private void WriteToFile(ObjectOutputStream os) throws IOException
    {
        os.writeObject(this._keys);
        os.writeObject(this._mazeSize);
        os.writeObject(this._numberOfDragons);
        os.writeObject(this._dragonMode);
    }

    /**
     * Read from file.
     *
     * @param is the is
     * @throws ClassNotFoundException the class not found exception
     * @throws IOException Signals that an I/O exception has occurred.
     */
    @SuppressWarnings("unchecked")
    private void ReadFromFile(ObjectInputStream is) throws ClassNotFoundException, IOException
    {
        this._keys = (HashMap<Integer, Action>)is.readObject();
        this._mazeSize = (Integer) is.readObject();
        this._numberOfDragons = (Integer) is.readObject();
        this._dragonMode = (Dragon.Behaviour) is.readObject();
    }

    /**
     * Initialize with defaults.
     */
    private void initializeWithDefaults()
    {
        for (Action a : Action.Actions)
            _keys.put(a.DefaultKey, a);

        _mazeSize = 10;
        _numberOfDragons = 2;
        _dragonMode = Dragon.Behaviour.RandomMovement;
    }

    /**
     * Gets the action.
     *
     * @param key the key
     * @return the action
     */
    public Action GetAction(int key)
    {
        return _keys.get(key);
    }

    /**
     * Gets the maze size.
     *
     * @return the int
     */
    public int GetMazeSize() { return _mazeSize; }

    /**
     * Gets the number of dragons.
     *
     * @return the int
     */
    public int GetNumberOfDragons() { return _numberOfDragons; }

    /**
     * Gets the dragon mode.
     *
     * @return the dragon. behaviour
     */
    public Dragon.Behaviour GetDragonMode() { return _dragonMode; }

    /** The _file name. */
    private String _fileName;

    /** The _keys. */
    public Map<Integer, Action> _keys = new LinkedHashMap<Integer, Action>();

    /** The _maze size. */
    Integer _mazeSize;

    /** The _number of dragons. */
    Integer _numberOfDragons;

    /** The _dragon mode. */
    Dragon.Behaviour _dragonMode;

    /**
     * Sets the number of dragons.
     *
     * @param value the value
     */
    public void SetNumberOfDragons(int value)
    {
        _numberOfDragons = value;
    }

    /**
     * Sets the dragon mode.
     *
     * @param value the value
     */
    public void SetDragonMode(Dragon.Behaviour value)
    {
        _dragonMode = value;
    }

    /**
     * Sets the maze size.
     *
     * @param value the value
     */
    public void SetMazeSize(int value)
    {
        _mazeSize = value;
    }

    /**
     * Gets the keys.
     *
     * @return the map
     */
    public Map<Integer, Action> GetKeys() { return _keys; }

    /**
     * Sets the keys.
     *
     * @param value the value
     * @return the map
     */
    public Map<Integer, Action> SetKeys(LinkedHashMap<Integer, Action> value) { return _keys = value; }
}


text:
layout: post
title: What's Going On
tags:
- music
- pop culture
- video
redirect_from: "blog/18/what-s-going-on/"
---

25 años sin Marvin. Grande entre los grandes.


text:
package im.actor.server.enrich

import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
import org.scalatest.concurrent.ScalaFutures
import org.scalatest.{ FlatSpecLike, Matchers }

import im.actor.server.SqlSpecHelpers
import im.actor.util.testing.{ ActorSpecification, ActorSuite }

abstract class BaseRichMessageSpec(_system: ActorSystem = { ActorSpecification.createSystem() })
  extends ActorSuite(_system) with FlatSpecLike with ScalaFutures with Matchers with SqlSpecHelpers {

  implicit val materializer = ActorMaterializer()

}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Discina martinicae Pat.

### Remarks
null