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

namespace RogueMetalicana.Constants.Visualisator
{
    class VisualisatorConstants
    {
        public const string LegendEnemyHeading = "\nSymbol    Meaning             Difficulty" +
                                                 "\n----------------------------------------------------------------------------------";

        public const string LegendObstaclesHeading = "\nSymbol    Meaning             Description" +
                                                 "\n----------------------------------------------------------------------------------";

        public const string LegendPlacesHeading = "\nSymbol    Meaning" +
                                                     "\n----------------------------------------------------------------------------------";

        public const string SeparatorLine = "----------------------------------------------------------------------------------";

        public const string PlaceGainConsumed = "Congratulations you have just gained from this ";

        public const string PlaceAlreadyVisited = "Dude, you have already visited this place! Nothing to consume!";

        public const string UnableToCompleteLevel = "Don't be cheaty! You must get all enemies killed first!";
    }
}


text:
  Jeśli Jenkins znajduje się za zaporą sieciową i nie ma bezpośredniego dostępu
  do Internetu, a JVM nie jest skonfigurowana odpowiednio (

    sprawdź ustawienia sieciowe

  ), możesz udostępnić Internet ustawiając serwer proxy, aby Jenkins
  samodzielnie pobrał i zainstalował wtyczki. Pamiętaj, że Jenkins używa
  połączenia https, aby pobrać wtyczki z centrum aktualizacji.

    Pozostaw to pole puste, aby Jenkins korzystał z bezpośredniego połączenia z
    Internetem.

    Jeśli nie jesteś pewny ustawień, sprawdź ustawienia serwerów proxy w
    przeglądarce.

redpajama_set_name: RedPajamaGithub


text:
<!--
  The Ohio State University Research Foundation, The University of Chicago -
  Argonne National Laboratory, Emory University, SemanticBits LLC,
  and Ekagra Software Technologies Ltd.

  Distributed under the OSI-approved BSD 3-Clause License.
  See http://ncip.github.com/cagrid-portal/LICENSE.txt for details.
-->
<?xml version="1.0" encoding="UTF-8"?>

<beans
	xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"
>

	<!-- Message bus -->

	<bean id="com.liferay.portal.kernel.messaging.MessageBus" class="com.liferay.portal.kernel.messaging.DefaultMessageBus" destroy-method="destroy" />
	<bean id="com.liferay.portal.kernel.messaging.sender.MessageSender" class="com.liferay.portal.kernel.messaging.sender.DefaultMessageSender">
		<property name="messageBus" ref="com.liferay.portal.kernel.messaging.MessageBus" />
	</bean>
	<bean id="com.liferay.portal.kernel.messaging.sender.SynchronousMessageSender" class="com.liferay.portal.kernel.messaging.sender.DefaultSynchronousMessageSender">
		<constructor-arg index="0" type="com.liferay.portal.kernel.messaging.MessageBus" ref="com.liferay.portal.kernel.messaging.MessageBus" />
		<constructor-arg index="1" type="com.liferay.portal.kernel.uuid.PortalUUID" ref="com.liferay.portal.kernel.uuid.PortalUUID" />
		<constructor-arg index="2" type="long" value="10000" />
	</bean>

	<!-- JMX -->

	<bean id="com.liferay.portal.kernel.messaging.jmx.JMXMessageListener" class="com.liferay.portal.kernel.messaging.jmx.JMXMessageListener" init-method="init" destroy-method="destroy">
		<property name="MBeanServer" ref="mbeanServer" />
		<property name="messageBus" ref="com.liferay.portal.kernel.messaging.MessageBus" />
	</bean>

	<!-- Destinations -->

	<bean id="destination.convert_process" class="com.liferay.portal.kernel.messaging.SerialDestination">
		<constructor-arg index="0" type="java.lang.String" value="liferay/convert_process" />
	</bean>
	<bean id="destination.global" class="com.liferay.portal.kernel.messaging.ParallelDestination">
		<constructor-arg index="0" type="java.lang.String" value="liferay/global" />
	</bean>
	<bean id="destination.hot_deploy" class="com.liferay.portal.kernel.messaging.SerialDestination">
		<constructor-arg index="0" type="java.lang.String" value="liferay/hot_deploy" />
	</bean>
	<bean id="destination.layouts_local_publisher" class="com.liferay.portal.kernel.messaging.ParallelDestination">
		<constructor-arg index="0" type="java.lang.String" value="liferay/layouts_local_publisher" />
	</bean>
	<bean id="destination.layouts_remote_publisher" class="com.liferay.portal.kernel.messaging.ParallelDestination">
		<constructor-arg index="0" type="java.lang.String" value="liferay/layouts_remote_publisher" />
	</bean>
	<bean id="destination.live_users" class="com.liferay.portal.kernel.messaging.SerialDestination">
		<constructor-arg index="0" type="java.lang.String" value="liferay/live_users" />
	</bean>
	<bean id="destination.mail" class="com.liferay.portal.kernel.messaging.ParallelDestination">
		<constructor-arg index="0" type="java.lang.String" value="liferay/mail" />
	</bean>
	<bean id="destination.message_boards" class="com.liferay.portal.kernel.messaging.ParallelDestination">
		<constructor-arg index="0" type="java.lang.String" value="liferay/message_boards" />
	</bean>
	<bean id="destination.message_boards_mailing_list" class="com.liferay.portal.kernel.messaging.ParallelDestination">
		<constructor-arg index="0" type="java.lang.String" value="liferay/message_boards_mailing_list" />
	</bean>
	<bean id="destination.message_bus_default_response" class="com.liferay.portal.kernel.messaging.ParallelDestination">
		<constructor-arg index="0" type="java.lang.String" value="liferay/message_bus/default_response" />
	</bean>
	<bean id="destination.message_bus_message_status" class="com.liferay.portal.kernel.messaging.ParallelDestination">
		<constructor-arg index="0" type="java.lang.String" value="liferay/message_bus/message_status" />
	</bean>
	<bean id="destination.scheduler" class="com.liferay.portal.kernel.messaging.ParallelDestination">
		<constructor-arg index="0" type="java.lang.String" value="liferay/scheduler" />
	</bean>
	<bean id="destination.scheduler.response" class="com.liferay.portal.kernel.messaging.ParallelDestination">
		<constructor-arg index="0" type="java.lang.String" value="liferay/scheduler/response" />
	</bean>
	<bean id="destination.search_reader" class="com.liferay.portal.kernel.messaging.ParallelDestination">
		<constructor-arg index="0" type="java.lang.String" value="liferay/search_reader" />
	</bean>
	<bean id="destination.search_reader.response" class="com.liferay.portal.kernel.messaging.ParallelDestination">
		<constructor-arg index="0" type="java.lang.String" value="liferay/search_reader/response" />
	</bean>
	<bean id="destination.search_writer" class="com.liferay.portal.kernel.messaging.SerialDestination">
		<constructor-arg index="0" type="java.lang.String" value="liferay/search_writer" />
	</bean>
	<bean id="destination.wiki" class="com.liferay.portal.kernel.messaging.ParallelDestination">
		<constructor-arg index="0" type="java.lang.String" value="liferay/wiki" />
	</bean>

	<!-- Senders -->

	<bean id="messageSender.service_request_status" class="com.liferay.portal.kernel.messaging.sender.DefaultSingleDestinationMessageSender">
		<constructor-arg index="0" type="java.lang.String" value="liferay/message_bus/message_status" />
		<constructor-arg index="1" type="com.liferay.portal.kernel.messaging.sender.MessageSender" ref="com.liferay.portal.kernel.messaging.sender.MessageSender" />
	</bean>

	<!-- Listeners -->

	<bean id="messageListener.convert_process" class="com.liferay.portal.convert.messaging.ConvertProcessMessageListener" />
	<bean id="messageListener.global" class="com.liferay.portal.kernel.messaging.BridgingMessageListener">
		<constructor-arg index="0" type="com.liferay.portal.kernel.messaging.sender.SingleDestinationMessageSender">
			<bean class="com.liferay.portal.kernel.messaging.sender.DefaultSingleDestinationMessageSender">
				<constructor-arg index="0" type="java.lang.String" value="liferay/global" />
				<constructor-arg index="1" type="com.liferay.portal.kernel.messaging.sender.MessageSender" ref="com.liferay.portal.kernel.messaging.sender.MessageSender" />
			</bean>
		</constructor-arg>
	</bean>
	<bean id="messageListener.layouts_local_publisher" class="com.liferay.portlet.communities.messaging.LayoutsLocalPublisherMessageListener">
		<constructor-arg index="0" type="com.liferay.portal.kernel.messaging.sender.SingleDestinationMessageSender" ref="messageSender.service_request_status" />
		<constructor-arg index="1" type="com.liferay.portal.kernel.messaging.sender.MessageSender" ref="com.liferay.portal.kernel.messaging.sender.MessageSender" />
	</bean>
	<bean id="messageListener.layouts_remote_publisher" class="com.liferay.portlet.communities.messaging.LayoutsRemotePublisherMessageListener">
		<constructor-arg index="0" type="com.liferay.portal.kernel.messaging.sender.SingleDestinationMessageSender" ref="messageSender.service_request_status" />
		<constructor-arg index="1" type="com.liferay.portal.kernel.messaging.sender.MessageSender" ref="com.liferay.portal.kernel.messaging.sender.MessageSender" />
	</bean>
	<bean id="messageListener.live_users" class="com.liferay.portal.liveusers.messaging.LiveUsersMessageListener" />
	<bean id="messageListener.mail" class="com.liferay.mail.messaging.MailMessageListener" />
	<bean id="messageListener.message_boards" class="com.liferay.portlet.messageboards.messaging.MBMessageListener" />
	<bean id="messageListener.message_boards_mailing_list" class="com.liferay.portlet.messageboards.messaging.MailingListMessageListener" />
	<bean id="messageListener.scheduler" class="com.liferay.portal.scheduler.messaging.SchedulerMessageListener">
		<constructor-arg index="0" type="com.liferay.portal.kernel.messaging.sender.MessageSender" ref="com.liferay.portal.kernel.messaging.sender.MessageSender" />
		<constructor-arg index="1" type="com.liferay.portal.kernel.scheduler.SchedulerEngine" ref="com.liferay.portal.kernel.scheduler.SchedulerEngine" />
	</bean>
	<bean id="messageListener.lucene_reader" class="com.liferay.portal.search.lucene.messaging.LuceneReaderMessageListener">
		<constructor-arg index="0" type="com.liferay.portal.kernel.messaging.sender.MessageSender" ref="com.liferay.portal.kernel.messaging.sender.MessageSender" />
		<property name="searchEngine" ref="searchEngine.lucene" />
	</bean>
	<bean id="messageListener.lucene_writer" class="com.liferay.portal.search.lucene.messaging.LuceneWriterMessageListener">
		<property name="searchEngine" ref="searchEngine.lucene" />
	</bean>
	<bean id="messageListener.wiki" class="com.liferay.portlet.wiki.messaging.WikiMessageListener" />

	<!-- Configurator -->

	<bean id="com.liferay.portal.kernel.messaging.config.MessagingConfigurator" class="com.liferay.portal.kernel.messaging.config.DefaultMessagingConfigurator" init-method="init" destroy-method="destroy">
		<property name="destinationEventListeners">
			<list>
				<ref bean="com.liferay.portal.kernel.messaging.jmx.JMXMessageListener" />
				<!--<bean class="com.liferay.portal.kernel.messaging.GlobalDestinationEventListener">
					<constructor-arg index="0" type="com.liferay.portal.kernel.messaging.MessageListener" ref="messageListener.global" />
					<constructor-arg index="1" type="java.util.List">
						<list>
							<value type="java.lang.String">liferay/global</value>
						</list>
					</constructor-arg>
				</bean>-->
			</list>
		</property>
		<property name="destinations">
			<list>
				<ref bean="destination.convert_process" />
				<ref bean="destination.hot_deploy" />
				<ref bean="destination.layouts_local_publisher" />
				<ref bean="destination.layouts_remote_publisher" />
				<ref bean="destination.live_users" />
				<ref bean="destination.mail" />
				<ref bean="destination.message_boards" />
				<ref bean="destination.message_boards_mailing_list" />
				<ref bean="destination.message_bus_default_response" />
				<ref bean="destination.message_bus_message_status" />
				<ref bean="destination.scheduler" />
				<ref bean="destination.scheduler.response" />
				<ref bean="destination.search_reader" />
				<ref bean="destination.search_reader.response" />
				<ref bean="destination.search_writer" />
				<ref bean="destination.wiki" />
			</list>
		</property>
		<property name="messageBus">
			<ref bean="com.liferay.portal.kernel.messaging.MessageBus" />
		</property>
		<property name="messageListeners">
			<map key-type="java.lang.String" value-type="java.util.List">
				<entry key="liferay/convert_process">
					<list value-type="com.liferay.portal.kernel.messaging.MessageListener">
						<ref bean="messageListener.convert_process" />
					</list>
				</entry>
				<entry key="liferay/layouts_local_publisher">
					<list value-type="com.liferay.portal.kernel.messaging.MessageListener">
						<ref bean="messageListener.layouts_local_publisher" />
					</list>
				</entry>
				<entry key="liferay/layouts_remote_publisher">
					<list value-type="com.liferay.portal.kernel.messaging.MessageListener">
						<ref bean="messageListener.layouts_remote_publisher" />
					</list>
				</entry>
				<entry key="liferay/live_users">
					<list value-type="com.liferay.portal.kernel.messaging.MessageListener">
						<ref bean="messageListener.live_users" />
					</list>
				</entry>
				<entry key="liferay/mail">
					<list value-type="com.liferay.portal.kernel.messaging.MessageListener">
						<ref bean="messageListener.mail" />
					</list>
				</entry>
				<entry key="liferay/message_boards">
					<list value-type="com.liferay.portal.kernel.messaging.MessageListener">
						<ref bean="messageListener.message_boards" />
					</list>
				</entry>
				<entry key="liferay/message_boards_mailing_list">
					<list value-type="com.liferay.portal.kernel.messaging.MessageListener">
						<ref bean="messageListener.message_boards_mailing_list" />
					</list>
				</entry>
				<entry key="liferay/scheduler">
					<list value-type="com.liferay.portal.kernel.messaging.MessageListener">
						<ref bean="messageListener.scheduler" />
					</list>
				</entry>
				<entry key="liferay/search_reader">
					<list value-type="com.liferay.portal.kernel.messaging.MessageListener">
						<ref bean="messageListener.lucene_reader" />
					</list>
				</entry>
				<entry key="liferay/search_writer">
					<list value-type="com.liferay.portal.kernel.messaging.MessageListener">
						<ref bean="messageListener.lucene_writer" />
					</list>
				</entry>
				<entry key="liferay/wiki">
					<list value-type="com.liferay.portal.kernel.messaging.MessageListener">
						<ref bean="messageListener.wiki" />
					</list>
				</entry>
			</map>
		</property>
	</bean>
</beans>


text:
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
  <entity name="Acme\HelloBundle\Entity\Laundry" table="laundry">
    <id name="id" type="integer" column="id">
      <generator strategy="IDENTITY"/>
    </id>
    <field name="laundrytype" type="string" column="laundrytype" length="50" nullable="false"/>
  </entity>
</doctrine-mapping>


text:
var POSTCOMMANDURLS = {
						'input_GeneralName'		:		{'url' : '/commander/set_general', 'key' : 'general'},
						'input_NetworkName'		:		{'url' : '/commander/set_network', 'key' : 'network'},
						'input_NumOfGunners'	:		{'url' : '/commander/set_gunners', 'key' : 'gunners'},
						'connect'				:		{'url' : '/commander/connect'},
						'disconnect'			:		{'url' : '/commander/disconnect'}
					  };

$(document).ready(function() {
	fartscroll();
	SetInfo();
	$("input[type=button]").button();		//Apply jquery-ui for buttons
});

function SetInfo() {
	RequestInfo("./commander/status", function(data) {
		$("#CommanderName").text(data.commander);
		$("#GeneralName").text(data.general);
		$("#input_GeneralName").val(data.general);
		$("#NetworkName").text(data.network);
		$("#input_NetworkName").val(data.network);
		$("#NumOfGunners").text(data.gunners);
		$("#input_NumOfGunners").val(data.gunners);

		if (data.state === "connected") {
			$("span.toggle").show();
			$("input.toggle").hide();
			$("input.showfirst").show();
		}
		else {
			$("span.toggle").hide();
			$("input.toggle").show();
			$("input.showfirst").hide();
		}
	});
}

function PostData(inputId) {
	var key = POSTCOMMANDURLS[inputId].key
	var url = POSTCOMMANDURLS[inputId].url

	var data = {};
	if(key === "gunners") {
		data[key] = parseInt($("#"+inputId).val());
	}
	else {
		data[key] = $("#"+inputId).val();
	}

	PostInfo(url, data, function(response) {
		//window.location.reload(true);
	});
}

function CommanderAction(action) {
	$.get(POSTCOMMANDURLS[action].url);
	SetInfo();
}


text:
title: Release notes for 4021
---

# Release notes for v4021

## Support for offline SDK licensing
This release has two new methods in the Helpers class: `GetAssemblyHash` and `VerifySDKLicenseCertificate`.

If you want to check that the entry assembly was signed properly, you can use the `VerifySDKLicenseCertificate` method
as shown below. If the verification succeeds (the certificate is found and is valid), a LicenseKey object will be returned.
Otherwise, the method will return null.

```cs
string RSA = "RSA Pub key";
if(Helpers.VerifySDKLicenseCertificate(RSA) != null)
{
    // all ok.
}
else
{
    // signature incorrect.
}
```

The `GetAssemblyHash` is a helper method to `VerifySDKLicenseCertificate` and is not intended to be used on its own. However,
it can be useful when debugging or when a customer has issues getting it to work. This method returns an `AssemblySignature`
object, which contains the path to the assembly and its SHA512 hash.

More documentation and help tools can be found here: https://github.com/Cryptolens/sdk-licensing


text:
{-# LANGUAGE ForeignFunctionInterface, BangPatterns #-}
module Throughput.Memory (memBench) where

import Foreign
import Foreign.C

import Control.Exception
import System.CPUTime
import Numeric

memBench :: Int -> IO ()
memBench mb = do
  let bytes = mb * 2^20
  allocaBytes bytes $ \ptr -> do
    let bench label test = do
          seconds <- time $ test (castPtr ptr) (fromIntegral bytes)
          let throughput = fromIntegral mb / seconds
          putStrLn $ show mb ++ "MB of " ++ label
                  ++ " in " ++ showFFloat (Just 3) seconds "s, at: "
                  ++ showFFloat (Just 1) throughput "MB/s"
    bench "setup        " c_wordwrite
    putStrLn ""
    putStrLn "C memory throughput benchmarks:"
    bench "bytes written                     " c_bytewrite
    bench "bytes read                        " c_byteread
    bench "words written                     " c_wordwrite
    bench "words read                        " c_wordread
    putStrLn ""
    putStrLn "Haskell memory throughput benchmarks:"
    bench "bytes written                     " hs_bytewrite
    bench "bytes written (loop unrolled once)" hs_bytewrite2
    bench "bytes read                        " hs_byteread
    bench "words written                     " hs_wordwrite
    bench "words read                        " hs_wordread

hs_bytewrite  :: Ptr CUChar -> Int -> IO ()
hs_bytewrite !ptr bytes = loop 0 0
  where iterations = bytes
        loop :: Int -> CUChar -> IO ()
        loop !i !n | i == iterations = return ()
                   | otherwise = do pokeByteOff ptr i n
                                    loop (i+1) (n+1)

hs_bytewrite2  :: Ptr CUChar -> Int -> IO ()
hs_bytewrite2 !start bytes = loop start 0
  where end = start `plusPtr` bytes
        loop :: Ptr CUChar -> CUChar -> IO ()
        loop !ptr !n | ptr `plusPtr` 2 < end = do
                         poke ptr               n
                         poke (ptr `plusPtr` 1) (n+1)
                         loop (ptr `plusPtr` 2) (n+2)
                     | ptr `plusPtr` 1 < end =
                         poke ptr               n
                     | otherwise             = return ()

hs_byteread  :: Ptr CUChar -> Int -> IO CUChar
hs_byteread !ptr bytes = loop 0 0
  where iterations = bytes
        loop :: Int -> CUChar -> IO CUChar
        loop !i !n | i == iterations = return n
                   | otherwise = do x <- peekByteOff ptr i
                                    loop (i+1) (n+x)

hs_wordwrite :: Ptr CULong -> Int -> IO ()
hs_wordwrite !ptr bytes = loop 0 0
  where iterations = bytes `div` sizeOf (undefined :: CULong)
        loop :: Int -> CULong -> IO ()
        loop !i !n | i == iterations = return ()
                   | otherwise = do pokeByteOff ptr i n
                                    loop (i+1) (n+1)

hs_wordread  :: Ptr CULong -> Int -> IO CULong
hs_wordread !ptr bytes = loop 0 0
  where iterations = bytes `div` sizeOf (undefined :: CULong)
        loop :: Int -> CULong -> IO CULong
        loop !i !n | i == iterations = return n
                   | otherwise = do x <- peekByteOff ptr i
                                    loop (i+1) (n+x)

foreign import ccall unsafe "CBenchmark.h byteread"
  c_byteread :: Ptr CUChar -> CInt -> IO ()

foreign import ccall unsafe "CBenchmark.h bytewrite"
  c_bytewrite :: Ptr CUChar -> CInt -> IO ()

foreign import ccall unsafe "CBenchmark.h wordread"
  c_wordread :: Ptr CUInt -> CInt -> IO ()

foreign import ccall unsafe "CBenchmark.h wordwrite"
  c_wordwrite :: Ptr CUInt -> CInt -> IO ()

time :: IO a -> IO Double
time action = do
    start <- getCPUTime
    action
    end   <- getCPUTime
    return $! (fromIntegral (end - start)) / (10^12)


text:
session_start();
require_once("twitteroauth/twitteroauth.php"); //Path to twitteroauth library

$twitteruser = "nelle_mcdade";
$notweets = 30;
$consumerkey = "pmCBn9A28BcDLQzBnnQSXJXwC";
$consumersecret = "cAgtK0yZw0HTh9lf3kXvJUtRWQdWYgMsmzXar5c4OubsT92TEj";
$accesstoken = "332459563-8G4qY28erD85Jhqp9rqnNJfVQnbpqAVCHDosmjHU
";
$accesstokensecret = "KAtB0cHxWAMGMD6basSwO0NkNVdhx2Xzlr2EgZdJnz9Im";

function getConnectionWithAccessToken($cons_key, $cons_secret, $oauth_token, $oauth_token_secret) {
  $connection = new TwitterOAuth($cons_key, $cons_secret, $oauth_token, $oauth_token_secret);
  return $connection;
}

$connection = getConnectionWithAccessToken($consumerkey, $consumersecret, $accesstoken, $accesstokensecret);

$tweets = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$twitteruser."&count=".$notweets);

echo json_encode($tweets);
?>


text: SELECT sum(cnt) FROM t1


text:
if [ "$TEST_SCRIPT" != "" ]
then
        #for testing locally
        PROP_FILE=application.properties
else
	PROP_FILE=hygieia-bitbucket-scm-collector.properties
fi

if [ "$MONGO_PORT" != "" ]; then
	# Sample: MONGO_PORT=tcp://172.17.0.20:27017
	MONGODB_HOST=`echo $MONGO_PORT|sed 's;.*://\([^:]*\):\(.*\);\1;'`
	MONGODB_PORT=`echo $MONGO_PORT|sed 's;.*://\([^:]*\):\(.*\);\2;'`
else
	env
	echo "ERROR: MONGO_PORT not defined"
	exit 1
fi

echo "MONGODB_HOST: $MONGODB_HOST"
echo "MONGODB_PORT: $MONGODB_PORT"

cat > $PROP_FILE <<EOF
#Database Name
database=${HYGIEIA_API_ENV_SPRING_DATA_MONGODB_DATABASE:-dashboard}

#Database HostName - default is localhost
dbhost=${MONGODB_HOST:-10.0.1.1}

#Database Port - default is 27017
dbport=${MONGODB_PORT:-27017}

#Database Username - default is blank
dbusername=${HYGIEIA_API_ENV_SPRING_DATA_MONGODB_USERNAME:-db}

#Database Password - default is blank
dbpassword=${HYGIEIA_API_ENV_SPRING_DATA_MONGODB_PASSWORD:-dbpass}

#Collector schedule (required)
git.cron=${BITBUCKET_CRON:-0 0/5 * * * *}

#mandatory
git.host=${BITBUCKET_HOST:-mybitbucketrepo.com/}
git.api=${BITBUCKET_API:-/rest/api/1.0/}

#Maximum number of days to go back in time when fetching commits. Only applicable to Bitbucket Cloud.
git.commitThresholdDays=${BITBUCKET_COMMIT_THRESHOLD_DAYS:-15}

#Page size for rest calls. Only applicable to Bitbucket Server.
git.pageSize=${BITBUCKET_PAGE_SIZE,-25}

#Bitbucket product
# Set to "cloud" to use Bitbucket Cloud (formerly known as Bitbucket)
# Set to "server" to use Bitbucket Server (formerly known as Stash)
# More information can be found here: href="https://github.com/capitalone/Hygieia/issues/609
git.product=${BITBUCKET_PRODUCT:-cloud}

EOF

echo "

===========================================
Properties file created `date`:  $PROP_FILE
Note: passwords hidden
===========================================
`cat $PROP_FILE |egrep -vi password`
 "

exit 0


text:
// ### ATTENTION ###
//
// ReplicationManager is now just a wrapper around ReplicaSetController,
// with a conversion layer that effectively treats ReplicationController
// as if it were an older API version of ReplicaSet.
//
// However, RC and RS still have separate storage and separate instantiations
// of the ReplicaSetController object.

package replication

import (
	"github.com/golang/glog"
	"k8s.io/api/core/v1"
	coreinformers "k8s.io/client-go/informers/core/v1"
	clientset "k8s.io/client-go/kubernetes"
	"k8s.io/client-go/kubernetes/scheme"
	v1core "k8s.io/client-go/kubernetes/typed/core/v1"
	"k8s.io/client-go/tools/record"
	"k8s.io/kubernetes/pkg/controller"
	"k8s.io/kubernetes/pkg/controller/replicaset"
)

const (
	BurstReplicas = replicaset.BurstReplicas
)

// ReplicationManager is responsible for synchronizing ReplicationController objects stored
// in the system with actual running pods.
// It is actually just a wrapper around ReplicaSetController.
type ReplicationManager struct {
	replicaset.ReplicaSetController
}

// NewReplicationManager configures a replication manager with the specified event recorder
func NewReplicationManager(podInformer coreinformers.PodInformer, rcInformer coreinformers.ReplicationControllerInformer, kubeClient clientset.Interface, burstReplicas int) *ReplicationManager {
	eventBroadcaster := record.NewBroadcaster()
	eventBroadcaster.StartLogging(glog.Infof)
	eventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: v1core.New(kubeClient.CoreV1().RESTClient()).Events("")})
	return &ReplicationManager{
		*replicaset.NewBaseController(informerAdapter{rcInformer}, podInformer, clientsetAdapter{kubeClient}, burstReplicas,
			v1.SchemeGroupVersion.WithKind("ReplicationController"),
			"replication_controller",
			"replicationmanager",
			podControlAdapter{controller.RealPodControl{
				KubeClient: kubeClient,
				Recorder:   eventBroadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: "replication-controller"}),
			}},
		),
	}
}


text:
echo -e "\n######## Starting bootstrap process ########\n"

echo -e "\n######## install 1GB swap... ########\n"
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
printf "/swapfile   none    swap    sw    0   0\n" | sudo tee -a /etc/fstab
sudo sysctl vm.swappiness=10
printf "\nvm.swappiness=10\n" | sudo tee -a /etc/sysctl.conf
sudo sysctl vm.vfs_cache_pressure=50
printf "vm.vfs_cache_pressure=50\n" | sudo tee -a /etc/sysctl.conf
sudo swapon -s

echo -e "\n######## running apt-get update... ########\n"
sudo apt-get update

echo -e "\n######## installing some tools... ########\n"
sudo apt-get -y install gzip
sudo apt-get -y install git
sudo apt-get -y install curl

echo -e "\n######## install redis... ########\n"
sudo apt-add-repository -y ppa:chris-lea/redis-server
sudo apt-get -y install redis-server

echo -e "\n######## install nginx... ########\n"
sudo apt-get -y install nginx

echo -e "\n######## configuring nginx... ########\n"
sudo cp /vagrant/bootstrap/nginx.conf /etc/nginx/sites-available/
sudo rm /etc/nginx/sites-enabled/default
sudo ln -s /etc/nginx/sites-available/nginx.conf /etc/nginx/sites-enabled/nginx.conf
sudo service nginx restart

echo -e "\n######## install postgresql... ########\n"
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" >> /etc/apt/sources.list'
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.5-postgis-2.2 postgresql-contrib-9.5 -y
sudo apt-get install -y postgresql-client-9.5

echo -e "\n######## copying database files... ########\n"
sudo cp /vagrant/bootstrap/pg_hba.conf /etc/postgresql/9.5/main/
sudo cp /vagrant/bootstrap/postgresql.conf /etc/postgresql/9.5/main/

echo -e "\n######## restarting postgresql... ########\n"
sudo service postgresql restart

echo -e "\n######## starting to create the postgis extension... ########\n"
sudo -u postgres psql -c "CREATE EXTENSION postgis;"
sudo -u postgres psql -c "CREATE EXTENSION postgis_topology;"

echo -e "\n######## install node... ########\n"
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
sudo apt-get install -y nodejs

echo -e "\n######## install node tools... ########\n"
sudo npm install
sudo npm install -g pm2
sudo npm install -g gulp
sudo npm install -g mocha
sudo npm install -g istanbul
sudo npm install -g eslint
sudo npm install -g webpack
sudo npm install -g webpack-dev-server

echo -e "\n######## install tile server... ########\n"
sudo npm install -g mbtiles
sudo npm install -g tilelive
sudo npm install -g tilelive-vector
sudo npm install -g tilelive-xray
sudo npm install -g tessera

echo -e "\n######## install project dependencies... ########\n"
cd /vagrant
sudo npm install

echo -e "\n######## set up database... ########\n"
curl -o odd_dev_database.gz https://s3.amazonaws.com/open.data.discovery.org/odd_dev_database.gz
gzip -d odd_dev_database.gz

DB_USER="odd_admin"
DB_PASSWORD="Bko9tu39"

sudo -u postgres psql -c "CREATE USER ${DB_USER} WITH PASSWORD '${DB_PASSWORD}';";
sudo -u postgres psql -c "ALTER USER ${DB_USER} CREATEDB;"

export PGPASSWORD=$DB_PASSWORD
createdb -h localhost -U $DB_USER odd
sudo -u postgres psql -d odd -c "CREATE EXTENSION postgis;"
psql -h localhost -U $DB_USER -d odd -f odd_dev_database
psql -h localhost -U $DB_USER -d odd -c "REFRESH MATERIALIZED VIEW view_instance_region;"

rm odd_dev_database

echo -e "\n######## generate static files... ########\n"
cd www
webpack
cd ..

echo -e "\n######## install vector tile generator... ########\n"
sudo apt-get install libsqlite3-dev
sudo apt-get install zlib1g-dev
sudo apt-get install build-essential g++ -y
git clone https://github.com/mapbox/tippecanoe.git
cd tippecanoe
make
sudo make install
cd ..
rm -rf tippecanoe

echo -e "\n######## create initial tile server config... ########\n"
echo "{}" > tile-server/config.json

echo -e "\n######## start server... ########\n"
bash bootstrap/pm2_prod.sh


text:
<?php
include_once($_SERVER['DOCUMENT_ROOT'].'/include/autoprepend.php');
/*======================================

objet de BDD cms_glossary :: class cms_glossary

SQL mySQL:

DROP TABLE IF EXISTS cms_glossary;
CREATE TABLE cms_glossary
(
	glo_id			int (11) PRIMARY KEY not null,
	glo_titrecourt			varchar (128),
	glo_soustitre			varchar (256),
	glo_textelong			text (1024),
	glo_document			int (11),
	glo_diaporama			int (11),
	glo_url			varchar (256),
	glo_cms_site			int (11),
	glo_dtcrea			date,
	glo_dtmod			date,
	glo_statut			int (11) not null
)

SQL Oracle:

DROP TABLE cms_glossary
CREATE TABLE cms_glossary
(
	glo_id			number (11) constraint glo_pk PRIMARY KEY not null,
	glo_titrecourt			varchar2 (128),
	glo_soustitre			varchar2 (256),
	glo_textelong			text (1024),
	glo_document			number (11),
	glo_diaporama			number (11),
	glo_url			varchar2 (256),
	glo_cms_site			number (11),
	glo_dtcrea			date,
	glo_dtmod			date,
	glo_statut			number (11) not null
)

<?xml version="1.0" encoding="ISO-8859-1" ?>
<class name="cms_glossary" libelle="Glossaire" prefix="glo" display="titrecourt" abstract="soustitre">
<item name="id" type="int" length="11" isprimary="true" notnull="true" default="-1" list="true" order="true" />
<item name="titrecourt" libelle="Titre court" type="varchar" length="128" list="true" order="true" />
<item name="soustitre" libelle="Sous-titre" type="varchar" length="256" list="true" order="true"  />
<item name="textelong" libelle="Corps du texte" type="text" length="1024" list="true" order="true" option="textarea" rss="description" />
<item name="document" libelle="Documentation" type="int" length="11" list="false" order="false" option="binder" fkey="cms_binder"/>
<item name="diaporama" libelle="Diaporama" type="int" length="11" list="false" order="false" option="diaporama" fkey="cms_diaporama"/>
<item name="url" libelle="URL" type="varchar" length="256" list="false" order="false" option="url" />
<item name="cms_site" libelle="mini-site" type="int" length="11" list="false" order="false" fkey="cms_site" />
<item name="dtcrea" libelle="Date de création" type="date" list="true" order="true" />
<item name="dtmod" libelle="Date de modification" type="date" list="false" order="false" rss="pubDate" />
<item name="statut" libelle="Statut" type="int" length="11" notnull="true" default="DEF_CODE_STATUT_DEFAUT" list="true" order="true" />
<langpack lang="fr">
<norecords>Pas de définition à afficher</norecords>
</langpack>
<langpack lang="en">
<norecords>No glossary</norecords>
</langpack>
</class>

==========================================*/

class cms_glossary
{
var $id;
var $titrecourt;
var $soustitre;
var $textelong;
var $document;
var $diaporama;
var $url;
var $cms_site;
var $dtcrea;
var $dtmod;
var $statut;

var $XML = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>
<class name=\"cms_glossary\" libelle=\"Glossaire\" prefix=\"glo\" display=\"titrecourt\" abstract=\"soustitre\">
<item name=\"id\" type=\"int\" length=\"11\" isprimary=\"true\" notnull=\"true\" default=\"-1\" list=\"true\" order=\"true\" />
<item name=\"titrecourt\" libelle=\"Titre court\" type=\"varchar\" length=\"128\" list=\"true\" order=\"true\" />
<item name=\"soustitre\" libelle=\"Sous-titre\" type=\"varchar\" length=\"256\" list=\"true\" order=\"true\"  />
<item name=\"textelong\" libelle=\"Corps du texte\" type=\"text\" length=\"1024\" list=\"true\" order=\"true\" option=\"textarea\" rss=\"description\" />
<item name=\"document\" libelle=\"Documentation\" type=\"int\" length=\"11\" list=\"false\" order=\"false\" option=\"binder\" fkey=\"cms_binder\"/>
<item name=\"diaporama\" libelle=\"Diaporama\" type=\"int\" length=\"11\" list=\"false\" order=\"false\" option=\"diaporama\" fkey=\"cms_diaporama\"/>
<item name=\"url\" libelle=\"URL\" type=\"varchar\" length=\"256\" list=\"false\" order=\"false\" option=\"url\" />
<item name=\"cms_site\" libelle=\"mini-site\" type=\"int\" length=\"11\" list=\"false\" order=\"false\" fkey=\"cms_site\" />
<item name=\"dtcrea\" libelle=\"Date de création\" type=\"date\" list=\"true\" order=\"true\" />
<item name=\"dtmod\" libelle=\"Date de modification\" type=\"date\" list=\"false\" order=\"false\" rss=\"pubDate\" />
<item name=\"statut\" libelle=\"Statut\" type=\"int\" length=\"11\" notnull=\"true\" default=\"DEF_CODE_STATUT_DEFAUT\" list=\"true\" order=\"true\" />
<langpack lang=\"fr\">
<norecords>Pas de définition à afficher</norecords>
</langpack>
<langpack lang=\"en\">
<norecords>No glossary</norecords>
</langpack>
</class> ";

var $sMySql = "CREATE TABLE cms_glossary
(
	glo_id			int (11) PRIMARY KEY not null,
	glo_titrecourt			varchar (128),
	glo_soustitre			varchar (256),
	glo_textelong			text (1024),
	glo_document			int (11),
	glo_diaporama			int (11),
	glo_url			varchar (256),
	glo_cms_site			int (11),
	glo_dtcrea			date,
	glo_dtmod			date,
	glo_statut			int (11) not null
)

";

// constructeur
function cms_glossary($id=null)
{
	if (istable("cms_glossary") == false){
		dbExecuteQuery($this->sMySql);
	}

	if($id!=null) {
		$tempThis = dbGetObjectFromPK(get_class($this), $id);
		foreach ($tempThis as $tempKey => $tempValue){
			$this->$tempKey = $tempValue;
		}
		$tempThis = null;
	} else {
		$this->id = -1;
		$this->titrecourt = "";
		$this->soustitre = "";
		$this->textelong = "";
		$this->document = -1;
		$this->diaporama = -1;
		$this->url = "";
		$this->cms_site = -1;
		$this->dtcrea = date("d/m/Y");
		$this->dtmod = date("d/m/Y");
		$this->statut = DEF_CODE_STATUT_DEFAUT;
	}
}

// liste des champs de l'objet
function getListeChamps()
{
	// ATTENTION, respecter l'ordre des champs de la table dans la base de données pour construire laListeChamp
	$laListeChamps[]=new dbChamp("Glo_id", "entier", "get_id", "set_id");
	$laListeChamps[]=new dbChamp("Glo_titrecourt", "text", "get_titrecourt", "set_titrecourt");
	$laListeChamps[]=new dbChamp("Glo_soustitre", "text", "get_soustitre", "set_soustitre");
	$laListeChamps[]=new dbChamp("Glo_textelong", "text", "get_textelong", "set_textelong");
	$laListeChamps[]=new dbChamp("Glo_document", "entier", "get_document", "set_document");
	$laListeChamps[]=new dbChamp("Glo_diaporama", "entier", "get_diaporama", "set_diaporama");
	$laListeChamps[]=new dbChamp("Glo_url", "text", "get_url", "set_url");
	$laListeChamps[]=new dbChamp("Glo_cms_site", "entier", "get_cms_site", "set_cms_site");
	$laListeChamps[]=new dbChamp("Glo_dtcrea", "date_formatee", "get_dtcrea", "set_dtcrea");
	$laListeChamps[]=new dbChamp("Glo_dtmod", "date_formatee", "get_dtmod", "set_dtmod");
	$laListeChamps[]=new dbChamp("Glo_statut", "entier", "get_statut", "set_statut");
	return($laListeChamps);
}

// getters
function get_id() { return($this->id); }
function get_titrecourt() { return($this->titrecourt); }
function get_soustitre() { return($this->soustitre); }
function get_textelong() { return($this->textelong); }
function get_document() { return($this->document); }
function get_diaporama() { return($this->diaporama); }
function get_url() { return($this->url); }
function get_cms_site() { return($this->cms_site); }
function get_dtcrea() { return($this->dtcrea); }
function get_dtmod() { return($this->dtmod); }
function get_statut() { return($this->statut); }

// setters
function set_id($c_glo_id) { return($this->id=$c_glo_id); }
function set_titrecourt($c_glo_titrecourt) { return($this->titrecourt=$c_glo_titrecourt); }
function set_soustitre($c_glo_soustitre) { return($this->soustitre=$c_glo_soustitre); }
function set_textelong($c_glo_textelong) { return($this->textelong=$c_glo_textelong); }
function set_document($c_glo_document) { return($this->document=$c_glo_document); }
function set_diaporama($c_glo_diaporama) { return($this->diaporama=$c_glo_diaporama); }
function set_url($c_glo_url) { return($this->url=$c_glo_url); }
function set_cms_site($c_glo_cms_site) { return($this->cms_site=$c_glo_cms_site); }
function set_dtcrea($c_glo_dtcrea) { return($this->dtcrea=$c_glo_dtcrea); }
function set_dtmod($c_glo_dtmod) { return($this->dtmod=$c_glo_dtmod); }
function set_statut($c_glo_statut) { return($this->statut=$c_glo_statut); }

// autres getters
function getGetterPK() { return("get_id"); }
function getSetterPK() { return("set_id"); }
function getFieldPK() { return("glo_id"); }
// statut
function getGetterStatut() {return("get_statut"); }
function getFieldStatut() {return("glo_statut"); }
//
function getTable() { return("cms_glossary"); }
function getClasse() { return("cms_glossary"); }
function getDisplay() { return("titrecourt"); }
function getAbstract() { return("soustitre"); }

} //class

/*
// ecriture des fichiers
if (!is_dir($_SERVER['DOCUMENT_ROOT']."/backoffice/cms_glossary")){
	mkdir($_SERVER['DOCUMENT_ROOT']."/backoffice/cms_glossary");
	$list = fopen($_SERVER['DOCUMENT_ROOT']."/backoffice/cms_glossary/list_cms_glossary.php", "w");
	$listContent = "<"."?php include('cms-inc/autoClass/list.php'); ?".">";
	fwrite($list, $listContent);
	fclose($list);
	$maj = fopen($_SERVER['DOCUMENT_ROOT']."/backoffice/cms_glossary/maj_cms_glossary.php", "w");
	$majContent = "<"."?php include('cms-inc/autoClass/maj.php'); ?".">";
	fwrite($maj, $majContent);
	fclose($maj);
	$show = fopen($_SERVER['DOCUMENT_ROOT']."/backoffice/cms_glossary/show_cms_glossary.php", "w");
	$showContent = "<"."?php include('cms-inc/autoClass/show.php'); ?".">";
	fwrite($show, $showContent);
	fclose($show);
	$rss = fopen($_SERVER['DOCUMENT_ROOT']."/backoffice/cms_glossary/rss_cms_glossary.php", "w");
	$rssContent = "<"."?php include('cms-inc/autoClass/rss.php'); ?".">";
	fwrite($rss, $rssContent);
	fclose($rss);
	$xml = fopen($_SERVER['DOCUMENT_ROOT']."/backoffice/cms_glossary/xml_cms_glossary.php", "w");
	$xmlContent = "<"."?php include('cms-inc/autoClass/xml.php'); ?".">";
	fwrite($xml, $xmlContent);
	fclose($xml);
	$export = fopen($_SERVER['DOCUMENT_ROOT']."/backoffice/cms_glossary/export_cms_glossary.php", "w");
	$exportContent = "<"."?php include('cms-inc/autoClass/export.php'); ?".">";
	fwrite($export, $exportContent);
	fclose($export);
	$import = fopen($_SERVER['DOCUMENT_ROOT']."/backoffice/cms_glossary/import_cms_glossary.php", "w");
	$importContent = "<"."?php include('cms-inc/autoClass/import.php'); ?".">";
	fwrite($import, $importContent);
	fclose($import);
}*/
?>


text:
package commons.mapper.utils

import java.lang.reflect.{ Method, Modifier }
import java.sql.Date
import java.util.Date

import scala.reflect.runtime.universe
import scala.reflect.runtime.universe.{ Mirror, TermName, runtimeMirror, termNames, typeOf }

import commons.mapper.ArgWithDefault

/**
 * @author Kai Han
 */
private[mapper] object TypeUtils {

	private val dateParsePatterns = Array(
		"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd'T'HH:mm:ss",
		"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd'T'HH:mm:ss",
		"HH:mm:ss"
	)

	val dateTimeClass = try { Class.forName("org.joda.time.DateTime") } catch { case t : Throwable => null }
	lazy val dateTimeClassConstructor = dateTimeClass.getConstructor(classOf[Long])

	def fieldName(methodName : String) : String = {
		if (methodName.endsWith("_$eq")) methodName.substring(0, methodName.length() - 4)
		else if (methodName.startsWith("set")) methodName.substring(3, 4).toLowerCase() + methodName.substring(4)
		else methodName
	}

	def convertType(clazz : Class[_], value : Any) : Any = {
		if (clazz == null || value == null) {
			return null
		}

		if (clazz.isInstance(value)) {
			return value
		}

		if (clazz == classOf[Int] || clazz == classOf[java.lang.Integer]) {
			if (value.isInstanceOf[java.lang.Integer] || value.isInstanceOf[Int]) return value
			else if (value.isInstanceOf[String]) return java.lang.Integer.parseInt(value.asInstanceOf[String])
		} else if (clazz == classOf[Long] || clazz == classOf[java.lang.Long]) {
			if (value.isInstanceOf[java.lang.Long] || value.isInstanceOf[Long]) return value
			else if (value.isInstanceOf[String]) return java.lang.Long.parseLong(value.asInstanceOf[String])
		} else if (clazz == classOf[Float] || clazz == classOf[java.lang.Float]) {
			if (value.isInstanceOf[java.lang.Float] || value.isInstanceOf[Float]) return value
			else if (value.isInstanceOf[String]) return java.lang.Float.parseFloat(value.asInstanceOf[String])
		} else if (clazz == classOf[Double] || clazz == classOf[java.lang.Double]) {
			if (value.isInstanceOf[java.lang.Double] || value.isInstanceOf[Double]) return value
			else if (value.isInstanceOf[String]) return java.lang.Double.parseDouble(value.asInstanceOf[String])
		} else if (clazz == classOf[Boolean] || clazz == classOf[java.lang.Boolean]) {
			if (value.isInstanceOf[java.lang.Boolean] || value.isInstanceOf[Boolean]) return value
			else if (value.isInstanceOf[String]) return java.lang.Boolean.parseBoolean(value.asInstanceOf[String])
		} else if (clazz == classOf[Byte] || clazz == classOf[java.lang.Byte]) {
			if (value.isInstanceOf[java.lang.Byte] || value.isInstanceOf[Byte]) return value
			else if (value.isInstanceOf[String]) return java.lang.Byte.parseByte(value.asInstanceOf[String])
		} else if (clazz == classOf[Short] || clazz == classOf[java.lang.Short]) {
			if (value.isInstanceOf[java.lang.Short] || value.isInstanceOf[Short]) return value
			else if (value.isInstanceOf[String]) return java.lang.Short.parseShort(value.asInstanceOf[String])
		} else if (clazz == classOf[Char] || clazz == classOf[java.lang.Character]) {
			if (value.isInstanceOf[java.lang.Character] || value.isInstanceOf[Char]) return value
			else if (value.isInstanceOf[String]) return java.lang.Integer.parseInt(value.asInstanceOf[String]).asInstanceOf[Char]
		} else if (clazz == classOf[java.util.Date] || clazz == classOf[java.sql.Date] || clazz == dateTimeClass) {
			if (value.isInstanceOf[java.util.Date] && clazz == classOf[java.sql.Date]) {
				return new java.sql.Date(value.asInstanceOf[java.util.Date].getTime)
			} else if (value.isInstanceOf[java.util.Date] && clazz == dateTimeClass) {
				return dateTimeClassConstructor.newInstance(Long.box(value.asInstanceOf[java.util.Date].getTime)).asInstanceOf[Object]
			} else if (value.isInstanceOf[java.sql.Date] && clazz == classOf[java.util.Date]) {
				return value
			} else if (value.isInstanceOf[java.sql.Date] && clazz == dateTimeClass) {
				return dateTimeClassConstructor.newInstance(Long.box(value.asInstanceOf[java.util.Date].getTime)).asInstanceOf[Object]
			} else if (value.isInstanceOf[String]) {
				val date = DateUtils.parseDateWithLeniency(value.asInstanceOf[String], dateParsePatterns, false)

				if (clazz == classOf[java.sql.Date]) {
					return new java.sql.Date(date.getTime)
				}

				if (clazz == classOf[java.util.Date]) {
					return date
				}

				if (clazz == dateTimeClass) {
					val obj = Long.box(date.getTime)
					return dateTimeClassConstructor.newInstance(obj).asInstanceOf[Object]
				}
			}
		}

		throw new ClassCastException(value.getClass().getName + "无法转型为" + clazz.getName)
	}

	def extractTypeInfo[T](clazz : Class[T]) : (List[ArgWithDefault], List[Method]) = {
		val rm : Mirror = runtimeMirror(clazz.getClassLoader)
		val classSymbol = rm.classSymbol(clazz)

		if (classSymbol.isJava) {
			extractJavaTypeInfo(clazz)
		} else {
			extractScalaTypeInfo(clazz)
		}
	}

	private def extractJavaTypeInfo[T](clazz : Class[T]) : (List[ArgWithDefault], List[Method]) = {
		val constructors = clazz.getConstructors
			.filter(m => Modifier.isPublic(m.getModifiers))
			.toList

		if (constructors.isEmpty) {
			throw new RuntimeException(clazz + " has no public constructor")
		}

		val constructor = constructors.minBy(_.getParameterTypes.length)

		val args = constructor.getParameterTypes.map(clazz => {
			val default = clazz match {
				case t if t == classOf[Boolean] => Boolean.box(false)
				case t if t == classOf[Byte] => Byte.box(0.toByte)
				case t if t == classOf[Short] => Short.box(0.toShort)
				case t if t == classOf[Char] => Char.box(0.toChar)
				case t if t == classOf[Int] => Int.box(0)
				case t if t == classOf[Long] => Long.box(0L)
				case t if t == classOf[Float] => Float.box(0F)
				case t if t == classOf[Double] => Double.box(0D)
				case _ => null
			}

			new ArgWithDefault(clazz, null, default)
		}).toList

		val setMethods = clazz.getDeclaredMethods
			.filter(method => Modifier.isPublic(method.getModifiers))
			.filterNot(method => Modifier.isStatic(method.getModifiers))
			.filter(_.getName.startsWith("set"))
			.filter(_.getName.length > 3)
			.filter(_.getParameterTypes.length == 1)
			.toList

		(args, setMethods)
	}

	private def extractScalaTypeInfo[T](clazz : Class[T]) : (List[ArgWithDefault], List[Method]) = {
		val rm : Mirror = runtimeMirror(clazz.getClassLoader)
		val classSymbol = rm.classSymbol(clazz)

		val classMirror = rm.reflectClass(classSymbol)
		val alternatives = classSymbol.typeSignature.decl(termNames.CONSTRUCTOR).alternatives

		val constructorSymbol = alternatives.find(_.asMethod.isPrimaryConstructor).getOrElse(null)
		if (constructorSymbol == null) {
			throw new RuntimeException(clazz + " has no PrimaryConstructor")
		}

		val constructor = constructorSymbol.asMethod
		val constructorMirror = classMirror.reflectConstructor(constructor)

		lazy val module = classSymbol.companion.asModule
		lazy val companion = rm.reflectModule(module).instance
		lazy val companionMirror = rm.reflect(companion)

		val args = constructor.paramLists.flatten.zipWithIndex.map(paramWithIndex => {
			val param = paramWithIndex._1

			val paramName = param.name.toString

			val default = if (param.asTerm.isParamWithDefault) {
				val index = paramWithIndex._2 + 1
				val defaultTermName = TermName("$lessinit$greater$default$" + index)
				val methodSymbol = classSymbol.typeSignature.companion.decl(defaultTermName).asMethod
				companionMirror.reflectMethod(methodSymbol)()
			} else {
				param.typeSignature match {
					case t if t =:= typeOf[Boolean] => Boolean.box(false)
					case t if t =:= typeOf[Byte] => Byte.box(0.toByte)
					case t if t =:= typeOf[Short] => Short.box(0.toShort)
					case t if t =:= typeOf[Char] => Char.box(0.toChar)
					case t if t =:= typeOf[Int] => Int.box(0)
					case t if t =:= typeOf[Long] => Long.box(0L)
					case t if t =:= typeOf[Float] => Float.box(0F)
					case t if t =:= typeOf[Double] => Double.box(0D)
					case t if t =:= typeOf[Object] => null.asInstanceOf[AnyRef]
					case _ => null.asInstanceOf[AnyRef]
				}
			}

			ArgWithDefault(rm.runtimeClass(param.typeSignature.erasure), paramName, default)
		}).toList

		val setMethodSet = args.map(_.paramName + "_$eq").toSet

		val setMethods = clazz.getDeclaredMethods
			.filter(method => Modifier.isPublic(method.getModifiers))
			.filterNot(method => Modifier.isStatic(method.getModifiers))
			.filter(_.getName.endsWith("_$eq"))
			.filter(_.getName.length > 4)
			.filter(_.getParameterTypes.length == 1)
			.filter(method => !setMethodSet.contains(method.getName))
			.toList

		(args, setMethods)
	}
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using StructureMap.Pipeline;

namespace StructureMap.Query
{
    public class InstanceFactoryTypeConfiguration : IPluginTypeConfiguration, IFamily
    {
        private readonly IContainer _container;
        private readonly PipelineGraph _graph;
        private readonly Type _pluginType;

        public InstanceFactoryTypeConfiguration(Type pluginType, IContainer container, PipelineGraph graph)
        {
            _pluginType = pluginType;
            _container = container;
            _graph = graph;
        }

        private IObjectCache cache { get { return _graph.FindCache(_pluginType); } }
        private IInstanceFactory factory { get { return _graph.ForType(_pluginType); } }

        void IFamily.Eject(Instance instance)
        {
            cache.Eject(_pluginType, instance);
            instance.SafeDispose();
        }

        object IFamily.Build(Instance instance)
        {
            // It's important to use this overload to get it to
            // respect the lifecycle.  I think.  It works, so leave
            // it alone.
            return _container.GetInstance(_pluginType, instance.Name);
        }

        bool IFamily.HasBeenCreated(Instance instance)
        {
            return cache.Has(_pluginType, instance);
        }

        public Type PluginType { get { return _pluginType; } }

        /// <summary>
        /// The "instance" that will be used when Container.GetInstance(PluginType) is called.
        /// See <see cref="InstanceRef">InstanceRef</see> for more information
        /// </summary>
        public InstanceRef Default
        {
            get
            {
                Instance instance = _graph.GetDefault(_pluginType);
                return toRef(instance);
            }
        }

        /// <summary>
        /// The build "policy" for this PluginType.  Used by the WhatDoIHave() diagnostics methods
        /// </summary>
        public string Lifecycle { get { return factory.Lifecycle.ToName(); } }

        /// <summary>
        /// All of the <see cref="InstanceRef">InstanceRef</see>'s registered
        /// for this PluginType
        /// </summary>
        public IEnumerable<InstanceRef> Instances { get { return factory.AllInstances.Select(x => toRef(x)).ToArray(); } }

        /// <summary>
        /// Simply query to see if there are any implementations registered
        /// </summary>
        /// <returns></returns>
        public bool HasImplementations()
        {
            return factory.AllInstances.Any();
        }

        public void EjectAndRemove(InstanceRef instance)
        {
            instance.EjectObject();
            _graph.Remove(_pluginType, instance.Instance);
        }

        public void EjectAndRemoveAll()
        {
            _graph.EjectAllInstancesOf(_pluginType);
        }

        private InstanceRef toRef(Instance instance)
        {
            if (instance == null) return null;

            return new InstanceRef(instance, this);
        }
    }
}


text:
package org.springframework.security.web.authentication;

import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.security.authentication.TestingAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.authority.GrantedAuthorityImpl;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.memory.UserAttribute;

/**
 * Tests {@link AnonymousAuthenticationFilter}.
 *
 * @author Ben Alex
 */
public class AnonymousAuthenticationFilterTests {

    //~ Methods ========================================================================================================

    private void executeFilterInContainerSimulator(FilterConfig filterConfig, Filter filter, ServletRequest request,
        ServletResponse response, FilterChain filterChain) throws ServletException, IOException {
        filter.doFilter(request, response, filterChain);
    }

    @Before
    @After
    public void clearContext() throws Exception {
        SecurityContextHolder.clearContext();
    }

    @Test(expected=IllegalArgumentException.class)
    public void testDetectsMissingKey() throws Exception {
        UserAttribute user = new UserAttribute();
        user.setPassword("anonymousUsername");
        user.addAuthority(new GrantedAuthorityImpl("ROLE_ANONYMOUS"));

        AnonymousAuthenticationFilter filter = new AnonymousAuthenticationFilter();
        filter.setUserAttribute(user);
        filter.afterPropertiesSet();
    }

    @Test(expected=IllegalArgumentException.class)
    public void testDetectsUserAttribute() throws Exception {
        AnonymousAuthenticationFilter filter = new AnonymousAuthenticationFilter();
        filter.setKey("qwerty");
        filter.afterPropertiesSet();
    }

    @Test
    public void testGettersSetters() throws Exception {
        UserAttribute user = new UserAttribute();
        user.setPassword("anonymousUsername");
        user.addAuthority(new GrantedAuthorityImpl("ROLE_ANONYMOUS"));

        AnonymousAuthenticationFilter filter = new AnonymousAuthenticationFilter();
        filter.setKey("qwerty");
        filter.setUserAttribute(user);
        filter.afterPropertiesSet();

        assertEquals("qwerty", filter.getKey());
        assertEquals(user, filter.getUserAttribute());
    }

    @Test
    public void testOperationWhenAuthenticationExistsInContextHolder()
        throws Exception {
        // Put an Authentication object into the SecurityContextHolder
        Authentication originalAuth = new TestingAuthenticationToken("user", "password",
                new GrantedAuthority[] {new GrantedAuthorityImpl("ROLE_A")});
        SecurityContextHolder.getContext().setAuthentication(originalAuth);

        // Setup our filter correctly
        UserAttribute user = new UserAttribute();
        user.setPassword("anonymousUsername");
        user.addAuthority(new GrantedAuthorityImpl("ROLE_ANONYMOUS"));

        AnonymousAuthenticationFilter filter = new AnonymousAuthenticationFilter();
        filter.setKey("qwerty");
        filter.setUserAttribute(user);
        filter.afterPropertiesSet();

        // Test
        MockHttpServletRequest request = new MockHttpServletRequest();
        request.setRequestURI("x");
        executeFilterInContainerSimulator(mock(FilterConfig.class), filter, request, new MockHttpServletResponse(),
            new MockFilterChain(true));

        // Ensure filter didn't change our original object
        assertEquals(originalAuth, SecurityContextHolder.getContext().getAuthentication());
    }

    @Test
    public void testOperationWhenNoAuthenticationInSecurityContextHolder() throws Exception {
        UserAttribute user = new UserAttribute();
        user.setPassword("anonymousUsername");
        user.addAuthority(new GrantedAuthorityImpl("ROLE_ANONYMOUS"));

        AnonymousAuthenticationFilter filter = new AnonymousAuthenticationFilter();
        filter.setKey("qwerty");
        filter.setUserAttribute(user);
        filter.afterPropertiesSet();

        MockHttpServletRequest request = new MockHttpServletRequest();
        request.setRequestURI("x");
        executeFilterInContainerSimulator(mock(FilterConfig.class), filter, request, new MockHttpServletResponse(),
            new MockFilterChain(true));

        Authentication auth = SecurityContextHolder.getContext().getAuthentication();
        assertEquals("anonymousUsername", auth.getPrincipal());
        assertTrue(AuthorityUtils.authorityListToSet(auth.getAuthorities()).contains("ROLE_ANONYMOUS"));
        SecurityContextHolder.getContext().setAuthentication(null); // so anonymous fires again
    }

    //~ Inner Classes ==================================================================================================

    private class MockFilterChain implements FilterChain {
        private boolean expectToProceed;

        public MockFilterChain(boolean expectToProceed) {
            this.expectToProceed = expectToProceed;
        }

        public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
            if (!expectToProceed) {
                fail("Did not expect filter chain to proceed");
            }
        }
    }
}


text:
- __Invocation Name__: Open Robot Welcome, Ask Robot Welcome...
  - __Intents__
    - WelcomeIntent welcome
    - WelcomeIntent say welcome
    - WelcomeIntent say welcome all
- __Answer__ See below...

```js
'use strict';

const Alexa = require('alexa-sdk');

exports.handler = function(event, context, callback) {
    var alexa = Alexa.handler(event, context);
    alexa.registerHandlers(handlers);
    alexa.execute();
};

const handlers = {
    'LaunchRequest': function () {
        this.emit('SayWelcome');
    },
    'WelcomeIntent': function () {
        this.emit('SayWelcome')
    },
    'SayWelcome': function () {
        this.emit(':tell',
        'Hi, Welcome to Cloudy Station! I am Alexa, an intelligent personal assistant developed by Amazon Lab126, made popular by the Amazon Echo. \
        I live in the cloud, the cloud is the Internet space, multiple remote computers offering different Software services. \
        You can ask me any question or we can play Intel Games by saying one of the following 2 phrases: \
        "Alexa!, Open Geek", and I will give you a fact about Intel.\
        "Alexa!, Open Trivia", and I will start a Trivia game.\
        Nice meeting you! We hope you are enjoying your visit. Thanks for coming!');
    }
};
```


text:
using Bridge.Html5;

namespace Bridge.React
{
	[External]
	[ObjectLiteral]
	public sealed class OListAttributes : ReactDomElementAttributes<HTMLOListElement>
	{
		public bool Reversed { get; set; }
		public int Start { get; set; }
		public OListType Type { get; set; }
	}
}


text:
import {module} from 'angular';

import {INestedState} from 'core/navigation/state.provider';
import {
  APPLICATION_STATE_PROVIDER, ApplicationStateProvider,
} from 'core/application/application.state.provider';

export const TASK_STATES = 'spinnaker.core.task.states';
module(TASK_STATES, [
  APPLICATION_STATE_PROVIDER
]).config((applicationStateProvider: ApplicationStateProvider) => {

  const taskDetails: INestedState = {
    name: 'taskDetails',
    url: '/:taskId',
    views: {},
    data: {
      pageTitleDetails: {
        title: 'Task Details',
        nameParam: 'taskId'
      }
    }
  };

  const tasks: INestedState = {
    name: 'tasks',
    url: '/tasks',
    views: {
      'insight': {
        templateUrl: require('../task/tasks.html'),
        controller: 'TasksCtrl',
        controllerAs: 'tasks'
      },
    },
    data: {
      pageTitleSection: {
        title: 'Tasks'
      }
    },
    children: [taskDetails],
  };

  applicationStateProvider.addChildState(tasks);
});


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information

namespace DotNetNuke.Entities.Tabs
{
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;

    using DotNetNuke.Common;
    using DotNetNuke.Common.Utilities;
    using DotNetNuke.Entities.Portals;
    using DotNetNuke.Framework;
    using DotNetNuke.Instrumentation;
    using DotNetNuke.Security.Permissions;
    using DotNetNuke.Services.Localization;

    public class TabPublishingController : ServiceLocator<ITabPublishingController, TabPublishingController>, ITabPublishingController
    {
        private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(TabPublishingController));

        public bool IsTabPublished(int tabID, int portalID)
        {
            var allUsersRoleId = int.Parse(Globals.glbRoleAllUsers);
            var tab = TabController.Instance.GetTab(tabID, portalID);

            var existPermission = this.GetAlreadyPermission(tab, "VIEW", allUsersRoleId);
            return existPermission != null && existPermission.AllowAccess;
        }

        public void SetTabPublishing(int tabID, int portalID, bool publish)
        {
            var tab = TabController.Instance.GetTab(tabID, portalID);
            if (!TabPermissionController.CanAdminPage(tab))
            {
                var errorMessage = Localization.GetExceptionMessage("PublishPagePermissionsNotMet", "Permissions are not met. The page has not been published.");
                var permissionsNotMetExc = new PermissionsNotMetException(tabID, errorMessage);
                Logger.Error(errorMessage, permissionsNotMetExc);
                throw permissionsNotMetExc;
            }

            if (publish)
            {
                this.PublishTabInternal(tab);
            }
            else
            {
                this.UnpublishTabInternal(tab);
            }
        }

        public bool CanPublishingBePerformed(int tabID, int portalID)
        {
            var tab = TabController.Instance.GetTab(tabID, portalID);
            if (!TabPermissionController.CanAdminPage(tab))
            {
                return false; // User has no permission
            }

            Hashtable settings = TabController.Instance.GetTabSettings(tabID);
            if (settings["WorkflowID"] != null)
            {
                return Convert.ToInt32(settings["WorkflowID"]) == 1; // If workflowID is 1, then the Page workflow is Direct Publish
            }

            // If workflowID is 1, then the Page workflow is Direct Publish
            // If WorkflowID is -1, then there is no Workflow setting
            var workflowID = Convert.ToInt32(PortalController.GetPortalSetting("WorkflowID", portalID, "-1"));

            return (workflowID == 1) || (workflowID == -1);
        }

        protected override Func<ITabPublishingController> GetFactory()
        {
            return () => new TabPublishingController();
        }

        private void PublishTabInternal(TabInfo tab)
        {
            var allUsersRoleId = int.Parse(Globals.glbRoleAllUsers);

            var existPermission = this.GetAlreadyPermission(tab, "VIEW", allUsersRoleId);
            if (existPermission != null)
            {
                tab.TabPermissions.Remove(existPermission);
            }

            tab.TabPermissions.Add(this.GetTabPermissionByRole(tab.TabID, "VIEW", allUsersRoleId));
            TabPermissionController.SaveTabPermissions(tab);
            this.ClearTabCache(tab);
        }

        private void UnpublishTabInternal(TabInfo tab)
        {
            var administratorsRoleID = PortalController.Instance.GetPortal(tab.PortalID).AdministratorRoleId;
            var permissionsToRemove = new List<int>();
            permissionsToRemove.AddRange(tab.TabPermissions.Where(p => p.RoleID != administratorsRoleID).Select(p => p.TabPermissionID));
            foreach (var tabPermissionId in permissionsToRemove)
            {
                tab.TabPermissions.Remove(tab.TabPermissions.Cast<TabPermissionInfo>().SingleOrDefault(p => p.TabPermissionID == tabPermissionId));
            }

            TabPermissionController.SaveTabPermissions(tab);
            this.ClearTabCache(tab);
        }

        private void ClearTabCache(TabInfo tabInfo)
        {
            TabController.Instance.ClearCache(tabInfo.PortalID);

            // Clear the Tab's Cached modules
            DataCache.ClearModuleCache(tabInfo.TabID);
        }

        private TabPermissionInfo GetAlreadyPermission(TabInfo tab, string permissionKey, int roleId)
        {
            var permission = PermissionController.GetPermissionsByTab().Cast<PermissionInfo>().SingleOrDefault<PermissionInfo>(p => p.PermissionKey == permissionKey);

            return
                tab.TabPermissions.Cast<TabPermissionInfo>()
                    .FirstOrDefault(tp => tp.RoleID == roleId && tp.PermissionID == permission.PermissionID);
        }

        private TabPermissionInfo GetTabPermissionByRole(int tabID, string permissionKey, int roleID)
        {
            var permission = PermissionController.GetPermissionsByTab().Cast<PermissionInfo>().SingleOrDefault<PermissionInfo>(p => p.PermissionKey == permissionKey);
            var tabPermission = new TabPermissionInfo
            {
                TabID = tabID,
                PermissionID = permission.PermissionID,
                PermissionKey = permission.PermissionKey,
                PermissionName = permission.PermissionName,
                RoleID = roleID,
                UserID = Null.NullInteger,
                AllowAccess = true,
            };
            return tabPermission;
        }
    }
}


text:
package com.mpitaskframework.TaskSystem.Messages;

import com.mpitaskframework.TaskSystem.Message;

import io.mappedbus.MemoryMappedFile;

/**
 * A basic message containing an integer.
 * @author François Gingras <bizzard4>
 *
 */
public class IntMessage extends Message {

	public int value;

	public static final int INTMESSAGE_TID = 1;

	/**
	 * Default constructor.
	 */
	public IntMessage() {
		super(-1, -1);
		value = -1;
	}

	public IntMessage(int pTag, int pValue) {
		super(pTag, INTMESSAGE_TID);
		value = pValue;
	}

	@Override
	public void write(MemoryMappedFile mem, long pos) {
		mem.putInt(pos, this.getTag());
		mem.putInt(pos + 4, value);
	}

	@Override
	public void read(MemoryMappedFile mem, long pos) {
		setTid(INTMESSAGE_TID);
		setTag(mem.getInt(pos));
		value = mem.getInt(pos + 4);
	}
}


text:
package org.mycontroller.standalone.gateway.phantio;

import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.mycontroller.restclient.phantio.PhantIOClient;
import org.mycontroller.restclient.phantio.model.PostResponse;
import org.mycontroller.standalone.AppProperties.STATE;
import org.mycontroller.standalone.exceptions.MessageParserException;
import org.mycontroller.standalone.gateway.config.GatewayConfigPhantIO;
import org.mycontroller.standalone.gateway.rest.RestDriverAbstract;
import org.mycontroller.standalone.message.IMessage;
import org.mycontroller.standalone.offheap.IQueue;
import org.mycontroller.standalone.provider.IMessageParser;
import org.mycontroller.standalone.provider.phantio.MessageParserPhantIO;
import org.mycontroller.standalone.provider.phantio.MessagePhantIO;

import lombok.extern.slf4j.Slf4j;

/**
 * @author Jeeva Kandasamy (jkandasa)
 * @since 1.2.0
 */
@Slf4j
public class PhantIODriver extends RestDriverAbstract {

    private GatewayConfigPhantIO _config = null;
    private IMessageParser<MessagePhantIO> _parser = new MessageParserPhantIO();
    private IQueue<IMessage> _queue = null;
    private PhantIOClient _client = null;
    //2016-07-18T20:50:04+05:30
    private static final SimpleDateFormat TIMESTAMP_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");

    public PhantIODriver(GatewayConfigPhantIO _config, IQueue<IMessage> _queue) {
        super(_config, _config.getPollFrequency() * 1000 * 60L);
        this._config = _config;
        this._queue = _queue;

    }

    @Override
    public void connect() {
        try {
            _client = new PhantIOClient(
                    this._config.getUrl(),
                    this._config.getPublicKey(),
                    this._config.getPrivateKey(),
                    this._config.getTrustHostType());
            _config.setStatus(STATE.UP, "Connected Successfully");
        } catch (Exception ex) {
            _config.setStatus(STATE.DOWN, "ERROR: " + ex.getMessage());
        }
    }

    @Override
    public void write(IMessage message) throws MessageParserException {
        if (_config.getPrivateKey() != null && _config.getPrivateKey().length() > 0) {
            _logger.debug("Send data: {}, {}", _config, message);
            MessagePhantIO rawMessage = _parser.getGatewayData(message);
            Map<String, Object> data = new HashMap<String, Object>();
            data.put(rawMessage.getKey(), rawMessage.getValue());
            try {
                PostResponse _response = _client.post(data);
                _logger.debug("{}", _response);
            } catch (Exception ex) {
                _logger.error("Exception: data:[{}]", data, ex);
            }
        } else {
            _logger.warn("Private key not set for this {}", _config);
        }
    }

    @Override
    public void read() {
        try {
            List<Map<String, Object>> _response = _client.get(_config.getRecordsLimit());
            _logger.debug("Client response: {}", _response);
            if (_response != null) {
                for (Map<String, Object> record : _response) {
                    long timestamp = TIMESTAMP_FORMAT.parse((String) record.get("timestamp")).getTime();
                    if (_config.getLastUpdate() == null || _config.getLastUpdate() < timestamp) {
                        for (String key : record.keySet()) {
                            if (!key.equals("timestamp")) {
                                _queue.add(_parser.getMessage(_config,
                                        MessagePhantIO.builder()
                                                .key(key)
                                                .value((String) record.get(key))
                                                .timestamp(timestamp)
                                                .build()));
                                _config.setLastUpdate(timestamp);
                            }
                        }
                        _config.updateLastPollTime(timestamp);
                    }
                }
            }
        } catch (Exception ex) {
            _logger.error("Exception,", ex);
        }
    }

}


text:
<?php

namespace Yurun\Util\YurunHttp\Traits;

use Yurun\Util\YurunHttp\Cookie\CookieJar;
use Yurun\Util\YurunHttp\Cookie\CookieManager;
use Yurun\Util\YurunHttp\HandlerOptions;

trait TCookieManager
{
    /**
     * Cookie 管理器.
     *
     * @var CookieManager
     */
    protected $cookieManager;

    /**
     * Cookie 管理器.
     *
     * @var CookieJar
     */
    protected $cookieJar;

    /**
     * @return void
     */
    private function initCookieManager()
    {
        $this->cookieJar = $cookieJar = new CookieJar($this->cookieManager = new CookieManager());
        if (isset($this->options[HandlerOptions::COOKIE_JAR]) && \is_string($this->options[HandlerOptions::COOKIE_JAR]))
        {
            $cookieJar->load($this->options[HandlerOptions::COOKIE_JAR]);
        }
    }

    /**
     * Get cookie 管理器.
     *
     * @return CookieManager
     */
    public function getCookieManager()
    {
        return $this->cookieManager;
    }

    /**
     * Get cookie 管理器.
     *
     * @return CookieJar
     */
    public function getCookieJar()
    {
        return $this->cookieJar;
    }

    /**
     * 保存 Cookie.
     *
     * @return void
     */
    protected function saveCookieJar()
    {
        if (isset($this->options[HandlerOptions::COOKIE_JAR]) && \is_string($this->options[HandlerOptions::COOKIE_JAR]))
        {
            $this->cookieJar->save($this->options[HandlerOptions::COOKIE_JAR]);
        }
    }
}


text:
For information, api and documentation about this module: visit itsa.io

[![Build Status](https://travis-ci.org/itsa/useragent.svg?branch=master)](https://travis-ci.org/itsa/useragent)

[![browser support](https://ci.testling.com/itsa/useragent.png)](https://ci.testling.com/itsa/useragent)


text:
Download latest version 1.5.4

/* }

 .btn {
     border:none;
     display:inline-block;
     outline:0;padding:6px 16px;
     vertical-align:middle;
     overflow:hidden;
     text-decoration:none!important;
     color:#fff;
     background-color:#008080;
     text-align:center;
     cursor:pointer;
     white-space:nowrap;
     margin-left: 470px;
     top: 50%;
     left: 40%;
     margin-right: 350px;
     margin-bottom: 400px;
     margin-top: 120px;
     float:center;
 } */


text:
OBQA-OOCEP
==========

Ontology Based Query Answering @ Object Oriented Complex Event Processing


text:
package org.marketcetera.util.file;

import java.io.File;
import org.junit.After;
import org.junit.Test;
import org.marketcetera.util.except.I18NException;
import org.marketcetera.util.exec.Disposition;
import org.marketcetera.util.exec.Exec;
//import org.marketcetera.util.log.I18NBoundMessage1P;
import org.marketcetera.util.misc.OperatingSystem;
import org.marketcetera.util.test.TestCaseBase;

import static org.junit.Assert.*;
import static org.junit.Assume.*;

/**
 * @author tlerios@marketcetera.com
 * @since 0.5.0
 * @version $Id: DeleterTest.java 16154 2012-07-14 16:34:05Z colin $
 */

/* $License$ */

public class DeleterTest
    extends TestCaseBase
{
    private static final String TEST_ROOT=
        DIR_ROOT+File.separator+"deleter"+File.separator;
    private static final String TEST_TEMPLATES=
        TEST_ROOT+"templates";
    private static final String TEST_TEMPLATE_WIN32=
        "win32";
    private static final String TEST_TEMPLATE_UNIX=
        "unix";
    private static final String TEST_PLAIN_FILE=
        "file.txt";
    private static final String TEST_PLAIN_DIR=
        "dir";
    private static final String TEST_PLAIN_DIR_CONTENTS=
        TEST_PLAIN_DIR+File.separator+"b.txt";
    private static final String TEST_NONEXISTENT_FILE=
        TEST_ROOT+"nonexistent";
    private static final String TEST_FILE_LINK=
        "file_link";
    private static final String TEST_DIR_LINK=
        "dir_link";
    private static final String TEST_DANGLING_LINK=
        "dangling_link";
    private static final String TEST_RECURSIVE_LINK=
        "recursive_link";

    private static void cleanCopy()
        throws I18NException
    {
        if (OperatingSystem.LOCAL.isUnix()) {
            Exec.run(TEST_TEMPLATES,Disposition.STDERR,
                     "rm","-r","-f",
                     ".."+File.separator+TEST_TEMPLATE_UNIX);
            return;
        }
        if (OperatingSystem.LOCAL.isWin32()) {
            Exec.run(TEST_TEMPLATES,Disposition.STDERR,
                     "cmd.exe","/c","rd","/S","/Q",
                     ".."+File.separator+TEST_TEMPLATE_WIN32);
            return;
        }
        throw new AssertionError("Unknown platform");
    }

    private static String createCopy()
        throws I18NException
    {
        if (OperatingSystem.LOCAL.isUnix()) {
            Exec.run(TEST_TEMPLATES,Disposition.STDERR,
                     "cp","-r",TEST_TEMPLATE_UNIX,
                     ".."+File.separator+TEST_TEMPLATE_UNIX);
            return TEST_ROOT+TEST_TEMPLATE_UNIX;
        }
        Exec.run(TEST_TEMPLATES,Disposition.STDERR,
                 "xcopy.exe","/E","/I",TEST_TEMPLATE_WIN32,
                 ".."+File.separator+TEST_TEMPLATE_WIN32);
        return TEST_ROOT+TEST_TEMPLATE_WIN32;
    }

    private static void single
        (String name,
         String resolvedName)
        throws I18NException
    {
        cleanCopy();
        String rootName=createCopy();
        String fileName=rootName+File.separator+name;
        File root=new File(rootName);
        File file=new File(fileName);
        File resolvedFile=null;
        if (resolvedName!=null) {
            resolvedFile=new File(rootName+File.separator+resolvedName);
        }

        Deleter.apply(file);
        assertTrue(root.exists());
        assertFalse(file.exists());
        if (resolvedFile!=null) {
            assertTrue(resolvedFile.exists());
        }

        cleanCopy();
        createCopy();
        Deleter.apply(fileName);
        assertTrue(root.exists());
        assertFalse(file.exists());
        if (resolvedFile!=null) {
            assertTrue(resolvedFile.exists());
        }
    }

    @After
    public void tearDownDeleterTest()
        throws Exception
    {
        cleanCopy();
    }

    @Test
    public void existing()
        throws Exception
    {
        single(TEST_PLAIN_DIR,null);
        single(TEST_PLAIN_FILE,null);
    }

    @Test
    public void nonexistent()
        throws Exception
    {
        Deleter.apply(new File(TEST_NONEXISTENT_FILE));
        Deleter.apply(TEST_NONEXISTENT_FILE);
    }

    @Test
    public void unixDeleter()
        throws Exception
    {
        assumeTrue(OperatingSystem.LOCAL.isUnix());
        single(TEST_FILE_LINK,TEST_PLAIN_FILE);
        single(TEST_DIR_LINK,TEST_PLAIN_DIR_CONTENTS);
        single(TEST_DANGLING_LINK,null);
        single(TEST_RECURSIVE_LINK,null);
    }

    /*
     * EXTREME TEST 1: run alone (no other tests in the same file,
     * and no other units test) after uncommenting sections in main
     * class.
    @Test
    public void exception()
        throws Exception
    {
        cleanCopy();
        String rootName=createCopy();
        String name=rootName+File.separator+TEST_PLAIN_FILE;
        try {
            Deleter.apply(name);
            fail();
        } catch (I18NException ex) {
            assertEquals
                (ex.getDetail(),
                 new I18NBoundMessage1P(Messages.CANNOT_DELETE,
                                        (new File(name)).getAbsolutePath()),
                 ex.getI18NBoundMessage());
        }
    }
    */
}


text:
Example
-------

This is an example of a ~/.config/zenbu directory. Stick the contents
of this directory in ~/.config/zenbu and try out the following, observing
what happens to ``~/rendered_Xresources`` each time.

- ``zenbu`` will render with ``defaults.yaml``
- ``zenbu homura`` will render with ``defaults.yaml``, but using the
  colors from ``variable_sets/homura.yaml``
- ``zenbu no_pixel_fonts homura`` will render... you guessed it,
  same as before but with the fonts from
  ``variable_sets/no_pixel_fonts.yaml``
- Notice the last line in ``~/rendered_Xresources``: it's using a filter to
  turn a hex color into an RGB tuple!
- ``zenbu -w --watch-command 'xrdb -merge ~/rendered_Xresources' homura``
  will start a file watcher, so that when any template or variable file
  change would affect rendering, everything is rerendered and
  ``xrdb -merge ~/rendered_Xresources`` is run.


text:
#import <WebCore/DOMHTMLElement.h>

@class NSString;

// Not exported
@interface DOMHTMLHtmlElement : DOMHTMLElement
{
}

- (void)setManifest:(id)arg1;
- (id)manifest;
@property(copy) NSString *version;

@end


text:
This sample app demonstrates [Aurelia](http://www.aurelia.io/) and [Breeze](http://www.getbreezenow.com/) integration using the [aurelia-breeze](https://github.com/jdanyow/aurelia-breeze) plugin.  It sets up a simple navigation-style app that pulls data from the GitHub API using Breeze.  Also included is a simple data-form component built with Aurelia.  When data-bound to a Breeze entity it generates it's fields automatically based on the entity's type information.

## Running The App

To run the app, follow these steps.

1. Ensure that [NodeJS](http://nodejs.org/) is installed. This provides the platform on which the build tooling runs.
2. From the project folder, execute the following command:

  ```shell
  npm install
  ```
3. Ensure that [Gulp](http://gulpjs.com/) is installed. If you need to install it, use the following command:

  ```shell
  npm install -g gulp
  ```
4. Ensure that [jspm](http://jspm.io/) is installed. If you need to install it, use the following command:

  ```shell
  npm install -g jspm
  ```
  > **Note:** jspm queries GitHub to install semver packages, but GitHub has a rate limit on anonymous API requests. It is advised that you configure jspm with your GitHub credentials in order to avoid problems. You can do this by executing `jspm endpoint config github` and following the prompts.
5. Install the client-side dependencies with jspm:

  ```shell
  jspm install
  ```
  >**Note:** Windows users, if you experience an error of "unknown command unzip" you can solve this problem by doing `npm install -g unzip` and then re-running `jspm install`.
6. To run the app, execute the following command:

  ```shell
  gulp watch
  ```
7. Browse to [http://localhost:9000](http://localhost:9000) to see the app. You can make changes in the code found under `src` and the browser should auto-refresh itself as you save files.

> Note: At present there is a bug in the HTMLImports polyfill which only occurs on IE. We have submitted a pull request to the team with the fix. In the mean time, if you want to test on IE, you can work around the issue by explicitly adding a script tag before you load system.js. The script tag should look something like this (be sure to confirm the version number):

```html
<script src="jspm_packages/github/webcomponents/webcomponentsjs@0.5.2/HTMLImports.js"></script>
```

## Running The Tests

To run the unit tests, first ensure that you have followed the steps above in order to install all dependencies and successfully build the library. Once you have done that, proceed with these additional steps:

1. Ensure that the [Karma](http://karma-runner.github.io/) CLI is installed. If you need to install it, use the following command:

  ```shell
  npm install -g karma-cli
  ```
2. You can now run the tests with this command:

  ```shell
  karma start
  ```

## Contributing

We'd love for you to contribute to our source code and to make this project even better than it is today! If this interests you, please begin by reading [our contributing guidelines](https://github.com/DurandalProject/about/blob/master/CONTRIBUTING.md). The contributing document will provide you with all the information you need to get started. Once you have read that, you will need to also [sign our CLA](http://goo.gl/forms/dI8QDDSyKR) before we can accepts a Pull Request from you. More information on the process is including in the [contributor's guide](https://github.com/DurandalProject/about/blob/master/CONTRIBUTING.md).


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

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Uses of Interface org.apache.jena.riot.checker.NodeChecker (Apache Jena ARQ)</title>
<meta name="date" content="2014-10-02">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Interface
org.apache.jena.riot.checker.NodeChecker

Packages that use NodeChecker

Package
Description

org.apache.jena.riot.checker

org.apache.jena.riot.system

Uses of NodeChecker in org.apache.jena.riot.checker

Classes in org.apache.jena.riot.checker that implement NodeChecker

Modifier and Type
Class and Description

class
CheckerBlankNodes

class
CheckerIRI

class
CheckerLiterals

class
CheckerVar

class
NodeCheckerNull

Uses of NodeChecker in org.apache.jena.riot.system

Methods in org.apache.jena.riot.system that return NodeChecker

Modifier and Type
Method and Description

NodeChecker
Checker.getCheckBlankNodes()

NodeChecker
Checker.getCheckLiterals()

NodeChecker
Checker.getCheckURIs()

NodeChecker
Checker.getCheckVars()

Methods in org.apache.jena.riot.system with parameters of type NodeChecker

Modifier and Type
Method and Description

void
Checker.setCheckBlankNodes(NodeChecker checkBlankNodes)

void
Checker.setCheckLiterals(NodeChecker checkLiterals)

void
Checker.setCheckURIs(NodeChecker checkURIs)

void
Checker.setCheckVars(NodeChecker checkVars)

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Licenced under the Apache License, Version 2.0


text:
namespace silifuzz {

// Returns true iff all segment registers in `actual` have the same values as
// the corresponding registers in `expected`.
bool HasSameSegmentRegisters(const GRegSet<X86_64>& actual,
                             const GRegSet<X86_64>& expected);

// Returns true iff `ucontext` has the same CS and SS segment register values
// as the current cpu state and thus RestoreUContext() not restoring the two
// segment register values is fine.
// Has simple, not most-efficient impl: meant for (D)CHECK-s.
bool HasCurrentSegmentRegisters(const UContext<X86_64>& ucontext);

// The test value for the register for the TestOneRegister_<reg>() functions.
extern int64_t test_reg_value;

// TestOneRegister_<reg>() tests that SaveUContext() and RestoreUContext()
// indeed can save and restore register <reg> to the right spot in UContext.
//
// The value to test this with is taken from test_reg_value.
// We do not make it a function arg so that there's no register manipulation
// when calling a TestOneRegister_<reg>() and all registers in it are free.
#define DECLARE_TEST_ONE_REGISTER(reg_name) void TestOneRegister_##reg_name();

DECLARE_TEST_ONE_REGISTER(r8)
DECLARE_TEST_ONE_REGISTER(r9)
DECLARE_TEST_ONE_REGISTER(r10)
DECLARE_TEST_ONE_REGISTER(r11)
DECLARE_TEST_ONE_REGISTER(r12)
DECLARE_TEST_ONE_REGISTER(r13)
DECLARE_TEST_ONE_REGISTER(r14)
DECLARE_TEST_ONE_REGISTER(r15)
DECLARE_TEST_ONE_REGISTER(rdi)
DECLARE_TEST_ONE_REGISTER(rsi)
DECLARE_TEST_ONE_REGISTER(rbp)
DECLARE_TEST_ONE_REGISTER(rbx)
DECLARE_TEST_ONE_REGISTER(rdx)
DECLARE_TEST_ONE_REGISTER(rax)
DECLARE_TEST_ONE_REGISTER(rcx)

#undef DECLARE_TEST_ONE_REGISTER

// This is similar to TestOneRegister_<reg>(), but provides one special-cased
// test for the rsp and rip registers -- we can't freely modify those registers.
void TestSpecialRegisters_rsp_rip();

// This is similar to TestOneRegister_<reg>(), but tests various other
// parts of UContext: segment registers, eflags, sigmask, and fp registers.
void TestUContextVarious();

}  // namespace silifuzz

#endif  // THIRD_PARTY_SILIFUZZ_UTIL_UCONTEXT_UCONTEXT_TEST_LIB_H_


text:
void Test::TestLoadDataAsync() {
	LayerParameter l_p;
	auto data_layer_params = l_p.mutable_data_layer_param();
	data_layer_params->set_batch_size(10);
	data_layer_params->set_cache_batch_count(10);
	data_layer_params->set_source("D:/deeplearning/cifar_lmdb/cifar10_train.mdb");

	std::shared_ptr<DataLayer<double>> data_layer(new DataLayer<double>(l_p));
	Tensor<double>* bottom = new Tensor<double>(std::vector<int>{10, 3, 32, 32});
	Tensor<double>* top = new Tensor<double>(std::vector<int>{10, 3, 32, 32});
	data_layer->SetUp(bottom, top);
	data_layer->Forward(bottom, top);

}


text:
package org.gradle.test.fixtures.file;

import groovy.lang.Closure;
import org.gradle.api.GradleException;
import org.gradle.test.fixtures.ConcurrentTestUtil;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;

import java.io.IOException;
import java.util.Random;
import java.util.regex.Pattern;

/**
 * A JUnit rule which provides a unique temporary folder for the test.
 *
 * Note: to avoid 260 char path length limitation on Windows, we should keep the test dir path as short as possible,
 * ideally < 90 chars (from repo root to test dir root, e.g. "core/build/tmp/test files/{TestClass}/{testMethod}/qqlj8"),
 * or < 40 chars for "{TestClass}/{testMethod}/qqlj8"
 */
abstract class AbstractTestDirectoryProvider implements TestRule, TestDirectoryProvider {
    protected final TestFile root;
    private final String className;

    private static final Random RANDOM = new Random();
    private static final int ALL_DIGITS_AND_LETTERS_RADIX = 36;
    private static final int MAX_RANDOM_PART_VALUE = Integer.parseInt("zzzzz", ALL_DIGITS_AND_LETTERS_RADIX);
    private static final Pattern WINDOWS_RESERVED_NAMES = Pattern.compile("(con)|(prn)|(aux)|(nul)|(com\\d)|(lpt\\d)", Pattern.CASE_INSENSITIVE);

    private String prefix;
    private TestFile dir;
    private boolean cleanup = true;
    private boolean suppressCleanupErrors = false;

    protected AbstractTestDirectoryProvider(TestFile root, Class<?> testClass) {
        this.root = root;
        this.className = shortenPath(testClass.getSimpleName(), 16);
    }

    @Override
    public void suppressCleanup() {
        cleanup = false;
    }

    @Override
    public void suppressCleanupErrors() {
        suppressCleanupErrors = true;
    }

    public boolean isCleanup() {
        return cleanup;
    }

    public void cleanup() {
        if (cleanup && dir != null && dir.exists()) {
            ConcurrentTestUtil.poll(new Closure(null, null) {
                @SuppressWarnings("UnusedDeclaration")
                void doCall() throws IOException {
                    dir.forceDeleteDir();
                }
            });
        }
    }

    @Override
    public Statement apply(final Statement base, Description description) {
        init(description.getMethodName());

        return new TestDirectoryCleaningStatement(base, description);
    }

    private class TestDirectoryCleaningStatement extends Statement {
        private final Statement base;
        private final Description description;

        TestDirectoryCleaningStatement(Statement base, Description description) {
            this.base = base;
            this.description = description;
        }

        @Override
        public void evaluate() throws Throwable {
            // implicitly don't clean up if this throws
            base.evaluate();

            try {
                cleanup();
            } catch (Exception e) {
                if (suppressCleanupErrors()) {
                    System.err.println(cleanupErrorMessage());
                    e.printStackTrace(System.err);
                } else {
                    throw new GradleException(cleanupErrorMessage(), e);
                }
            }
        }

        private boolean suppressCleanupErrors() {
            return suppressCleanupErrors
                || testClass().getAnnotation(LeaksFileHandles.class) != null
                || description.getAnnotation(LeaksFileHandles.class) != null;
        }

        private Class<?> testClass() {
            return description.getTestClass();
        }

        private String cleanupErrorMessage() {
            return "Couldn't delete test dir for `" + displayName() + "` (test is holding files open). "
                + "In order to find out which files are held open, you may find `org.gradle.integtests.fixtures.executer.GradleExecuter.withFileLeakDetection` useful.";
        }

        private String displayName() {
            return description.getDisplayName();
        }
    }

    protected void init(String methodName) {
        if (methodName == null) {
            // must be a @ClassRule; use the rule's class name instead
            methodName = getClass().getSimpleName();
        }
        if (prefix == null) {
            String safeMethodName = shortenPath(methodName.replaceAll("[^\\w]", "_"), 16);
            prefix = String.format("%s/%s", className, safeMethodName);
        }
    }

    /*
     Shorten a long name to at most {expectedMaxLength}, replace middle characters with ".".
     */
    private String shortenPath(String longName, int expectedMaxLength) {
        if (longName.length() <= expectedMaxLength) {
            return longName;
        } else {
            return longName.substring(0, expectedMaxLength - 5) + "." + longName.substring(longName.length() - 4);
        }
    }

    @Override
    public TestFile getTestDirectory() {
        if (dir == null) {
            dir = createUniqueTestDirectory();
        }
        return dir;
    }

    private TestFile createUniqueTestDirectory() {
        while (true) {
            // Use a random prefix to avoid reusing test directories
            String randomPrefix = Integer.toString(RANDOM.nextInt(MAX_RANDOM_PART_VALUE), ALL_DIGITS_AND_LETTERS_RADIX);
            if (WINDOWS_RESERVED_NAMES.matcher(randomPrefix).matches()) {
                continue;
            }
            TestFile dir = root.file(getPrefix(), randomPrefix);
            if (dir.mkdirs()) {
                return dir;
            }
        }
    }

    private String getPrefix() {
        if (prefix == null) {
            // This can happen if this is used in a constructor or a @Before method. It also happens when using
            // @RunWith(SomeRunner) when the runner does not support rules.
            prefix = className;
        }
        return prefix;
    }

    public TestFile file(Object... path) {
        return getTestDirectory().file(path);
    }

    public TestFile createFile(Object... path) {
        return file(path).createFile();
    }

    public TestFile createDir(Object... path) {
        return file(path).createDir();
    }

    public TestFile getRoot() {
        return root;
    }
}


text:
import pickle as pkl
import argparse
import numpy as np
import pandas as pd

annotation_path = 'results_20130124.token'
def_path='D_cbow_pdw_8B.pkl'
def get_captions(annotation_path):
    annotations = pd.read_table(annotation_path, sep='\t', header=None, names=['image', 'caption'])
    capts=annotations['caption'].values
    # function from Andre Karpathy's NeuralTalk
    # print('preprocessing %d word vocab' % (word_count_threshold, ))
    word_counts = {}
    nsents = 0
    for sent in capts:
      nsents += 1
      for w in sent.lower().split(' '):
        word_counts[w] = word_counts.get(w, 0) + 1

    return word_counts.keys()
def get_definitions(def_path):
    emb=pkl.load(open(def_path,'rb'))
    return emb.keys()
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--vectors_file', default='glove/glove.6B.300d.txt', type=str)
    args = parser.parse_args()
    task_words=set()
    task_words|=set(get_captions(annotation_path))
    task_words|=set(get_definitions(def_path))

    num_words_in=0
    num_words_out=0
    with open(args.vectors_file, 'r') as f:
        vectors = {}
        for line in f:
            vals = line.rstrip().split(' ')
            if vals[0].lower() in task_words:
                vectors[vals[0]] = np.array([float(x) for x in vals[1:]])
                num_words_in+=1
            else:
                num_words_out+=1
    print (num_words_in,num_words_out)

    # vocab_size = len(words)
    # vocab = {w: idx for idx, w in enumerate(words)}
    # ivocab = {idx: w for idx, w in enumerate(words)}

    # vector_dim = len(vectors[ivocab[0]])
    # W = np.zeros((vocab_size, vector_dim))
    # for word, v in vectors.items():
    #     if word == '<unk>':
    #         continue
    #     W[vocab[word], :] = v

    pkl.dump(vectors,open('glove_embeddings.pkl','wb'))

if __name__ == "__main__":
    main()


text:
<?php

/**
 * Include the libraries file for the AdSense service class and the HTML
 * generation functions.
 */
require_once "../../src/contrib/apiAdsenseService.php";
require_once "htmlHelper.php";

/**
 * Uses an instance of apiAdsenseService to retrieve the data and renders
 * the screens.
 *
 * @author Silvano Luciani <silvano.luciani@gmail.com>
 */
abstract class BaseExample {
  protected $adSenseService;
  protected $dateFormat = 'Y-m-d';

  /**
   * Inject the dependency.
   * @param apiAdsenseService $adSenseService an authenticated instance
   *     of apiAdsenseService
   */
  public function __construct(apiAdsenseService $adSenseService) {
    $this->adSenseService = $adSenseService;
  }

  /**
   * Get the date for the instant of the call.
   * @return string the date in the format expressed by $this->dateFormat
   */
  protected function getNow() {
    $now = new DateTime();
    return $now->format($this->dateFormat);
  }

  /**
   * Get the date six month before the instant of the call.
   * @return string the date in the format expressed by $this->dateFormat
   */
  protected function getSixMonthsBeforeNow() {
    $sixMonthsAgo = new DateTime('-6 months');
    return $sixMonthsAgo->format($this->dateFormat);
  }

  /**
   * Implemented in the specific example class.
   */
  abstract public function render();

}