text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    tools:context=".activity.MainActivity"
    tools:showIn="@layout/app_bar_main">
    <!--tools:showIn="@layout/app_bar_main"-->

    <!--app:layout_behavior="@string/appbar_scrolling_view_behavior"-->

    <com.sequencing.video.customview.CVideoView
        android:id="@+id/video_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerInParent="true"
        android:layout_gravity="center"
        android:visibility="gone" />

    <ScrollView
        android:id="@+id/svMainLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        android:layout_marginTop="?attr/actionBarSize"
        android:fillViewport="true">

        <android.support.percent.PercentRelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <android.support.percent.PercentRelativeLayout
                android:id="@+id/llCurrentWeather"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:background="@color/main_layouts_background"
                android:paddingBottom="12dp"
                android:paddingLeft="20dp"
                android:paddingRight="20dp"
                android:paddingTop="20dp"
                app:layout_heightPercent="40%">

                <TextView
                    android:id="@+id/titleWeather"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerHorizontal="true"
                    android:text="Current weather"
                    android:textAppearance="?android:attr/textAppearanceLarge"
                    android:textColor="@color/main_text"
                    android:textSize="20dp"
                    android:textStyle="bold" />

                <android.support.percent.PercentRelativeLayout
                    android:id="@+id/temperatureLayout"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/titleWeather"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:layout_marginTop="5dp"
                    app:layout_heightPercent="58%">

                    <RelativeLayout
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        android:gravity="center_horizontal"
                        android:orientation="horizontal"
                        app:layout_widthPercent="48%">

                        <TextView
                            android:id="@+id/tvCurrentTemp"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_alignParentBottom="true"
                            android:layout_marginTop="6dp"
                            android:text="00"
                            android:textAppearance="?android:attr/textAppearanceLarge"
                            android:textColor="@color/main_text"
                            android:textSize="170sp"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/tvTempLogo"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_alignParentRight="true"
                            android:layout_marginBottom="5dp"
                            android:layout_toRightOf="@+id/tvCurrentTemp"
                            android:text="°F"
                            android:textAppearance="?android:attr/textAppearanceLarge"
                            android:textColor="@color/main_text"
                            android:textSize="45dp"
                            android:textStyle="bold" />

                    </RelativeLayout>

                    <ImageView
                        android:id="@+id/ivToday"
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        android:layout_alignParentRight="true"
                        android:background="@drawable/day_clear"
                        app:layout_widthPercent="40%" />

                </android.support.percent.PercentRelativeLayout>

                <TextView
                    android:id="@+id/tvSubWeatherInfo"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignStart="@+id/temperatureLayout"
                    android:layout_below="@+id/temperatureLayout"
                    android:layout_marginTop="10dp"
                    android:text="N/A"
                    android:textAppearance="?android:attr/textAppearanceLarge"
                    android:textColor="@color/main_text"
                    android:textSize="16dp" />

                <RelativeLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:layout_below="@+id/temperatureLayout"
                    android:layout_marginRight="3dp"
                    android:layout_marginTop="10dp"
                    android:gravity="center_horizontal"
                    android:minWidth="80dp"
                    android:orientation="vertical"
                    app:layout_widthPercent="40%">

                    <TextView
                        android:id="@+id/tvTodayWeather"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:gravity="left"
                        android:minEms="5"
                        android:text="N/A"
                        android:textAppearance="?android:attr/textAppearanceLarge"
                        android:textColor="@color/main_text"
                        android:textSize="20dp" />

                    <TextView
                        android:id="@+id/tvTodayTempH"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignStart="@+id/tvTodayWeather"
                        android:layout_below="@+id/tvTodayWeather"
                        android:layout_centerInParent="true"
                        android:layout_marginRight="10dp"
                        android:layout_marginTop="4dp"
                        android:gravity="center_horizontal"
                        android:maxLines="1"
                        android:text="H:N/A"
                        android:textAppearance="?android:attr/textAppearanceLarge"
                        android:textColor="@color/main_text"
                        android:textSize="20dp" />

                    <TextView
                        android:id="@+id/tvTodayTempL"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_below="@+id/tvTodayWeather"
                        android:layout_marginTop="4dp"
                        android:layout_toRightOf="@+id/tvTodayTempH"
                        android:gravity="center_horizontal"
                        android:maxLines="1"
                        android:text="L:N/A"
                        android:textAppearance="?android:attr/textAppearanceLarge"
                        android:textColor="@color/colorPrimary"
                        android:textSize="20dp" />

                </RelativeLayout>

            </android.support.percent.PercentRelativeLayout>

            <RelativeLayout
                android:id="@+id/llExtendedForecast"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/llCurrentWeather"
                android:layout_marginTop="20dp"
                android:background="@color/main_layouts_background"
                android:paddingBottom="12dp"
                android:paddingLeft="20dp"
                android:paddingRight="20dp"
                android:paddingTop="20dp"
                app:layout_heightPercent="15%">

                <TextView
                    android:id="@+id/tvExtendedForecastTitle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerHorizontal="true"
                    android:text="Today's extended wheather forecast"
                    android:textAppearance="?android:attr/textAppearanceLarge"
                    android:textColor="@color/main_text"
                    android:textSize="22dp"
                    android:textStyle="bold" />

                <TextView
                    android:id="@+id/tvExtendedForecast"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/tvExtendedForecastTitle"
                    android:layout_centerHorizontal="true"
                    android:layout_marginTop="10dp"
                    android:ellipsize="end"
                    android:maxEms="20"
                    android:text="N/A"
                    android:textAppearance="?android:attr/textAppearanceLarge"
                    android:textColor="@color/main_text"
                    android:textSize="18sp" />

                <Button
                    android:id="@+id/btnAlert"
                    android:layout_width="wrap_content"
                    android:layout_height="30dp"
                    android:layout_alignParentBottom="true"
                    android:layout_alignParentRight="true"
                    android:background="@android:color/holo_red_dark"
                    android:text="Alert"
                    android:textColor="@android:color/white"
                    android:textStyle="bold" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/llTailoredForecast"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_below="@+id/llExtendedForecast"
                android:layout_marginTop="20dp"
                android:background="@color/main_layouts_background"
                android:paddingBottom="12dp"
                android:paddingLeft="20dp"
                android:paddingRight="20dp"
                android:paddingTop="20dp"
                app:layout_heightPercent="20%">

                <TextView
                    android:id="@+id/tvPersonalPredictionTitle"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:text="Your genetically tailored forecast"
                    android:textAppearance="?android:attr/textAppearanceLarge"
                    android:textColor="@color/main_text"
                    android:textSize="20sp" />

                <ImageView
                    android:id="@+id/ivSequencingLogo"
                    android:layout_width="40dp"
                    android:layout_height="65dp"
                    android:layout_centerVertical="true"
                    android:layout_marginLeft="15dp"
                    android:alpha="0.65"
                    android:src="@drawable/sequencing_logo" />

                <TextView
                    android:id="@+id/tvWait"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/tvPersonalPredictionTitle"
                    android:gravity="center_horizontal"
                    android:padding="5dp"
                    android:text="@string/user_mess_wait"
                    android:textAppearance="?android:attr/textAppearanceLarge"
                    android:textColor="@color/main_text"
                    android:textSize="15sp"
                    android:visibility="gone" />

                <RelativeLayout
                    android:id="@+id/rlCubeWaitSmall"
                    android:layout_width="0dp"
                    android:layout_height="0dp" />

                <pl.droidsonroids.gif.GifImageView
                    android:id="@+id/wvCubeMainSmall"
                    android:layout_width="60dp"
                    android:layout_height="60dp"
                    android:background="@drawable/cube"
                    android:layout_below="@+id/tvWait"
                    android:layout_centerHorizontal="true"
                    android:layout_centerInParent="true" />

                <TextView
                    android:id="@+id/tvPersonalPrediction"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"

                    android:layout_marginLeft="15dp"
                    android:layout_marginTop="10dp"
                    android:layout_toRightOf="@+id/ivSequencingLogo"
                    android:ellipsize="end"
                    android:maxLines="4"
                    android:text="Your genetically tailored forecast "
                    android:textAppearance="?android:attr/textAppearanceLarge"
                    android:textColor="@color/main_text"
                    android:textSize="16sp"
                    android:textStyle="bold" />

                <TextView
                    android:id="@+id/tvBanner"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentBottom="true"
                    android:layout_alignParentEnd="true"
                    android:layout_alignParentRight="true"
                    android:gravity="bottom"
                    android:text="@string/banner"
                    android:textAppearance="?android:attr/textAppearanceLarge"
                    android:textColor="@color/main_text"
                    android:textSize="14sp" />
            </RelativeLayout>

            <HorizontalScrollView
                android:id="@+id/rlBottom"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_alignParentBottom="true"
                android:layout_below="@+id/llTailoredForecast"
                android:layout_gravity="bottom"
                android:layout_marginBottom="10dp"
                android:layout_marginTop="15dp"
                android:background="@color/main_layouts_background"
                android:fillViewport="true"
                android:gravity="bottom"
                android:orientation="horizontal"
                android:paddingLeft="5dp"
                android:paddingRight="5dp"
                android:scrollbars="none">

                <LinearLayout
                    android:id="@+id/llWeatherForecast"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginBottom="10dp"
                    android:layout_marginTop="10dp"
                    android:orientation="horizontal" />
            </HorizontalScrollView>

        </android.support.percent.PercentRelativeLayout>
    </ScrollView>

    <com.nhaarman.supertooltips.ToolTipRelativeLayout
        android:id="@+id/rlToolTip"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentBottom="true" />

    <RelativeLayout
        android:id="@+id/rlSpinner"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center_vertical">

        <pl.droidsonroids.gif.GifImageView
            android:id="@+id/wvCubeMain"
            android:layout_width="130dp"
            android:layout_height="130dp"
            android:background="@drawable/cube"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="10dp" />

        <TextView
            android:id="@+id/tvMessWait"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/wvCubeMain"
            android:gravity="center_horizontal"
            android:maxEms="25"
            android:text="@string/user_mess_wait"
            android:textColor="@color/main_text"
            android:textSize="20dp" />
    </RelativeLayout>
</RelativeLayout>


text:
This library is a fast Haskell client for the
[Riak](http://www.basho.com/Riak.html) decentralized key/value data store.

It uses Riak's [protobuf API](http://docs.basho.com/riak/latest/dev/references/protocol-buffers/) for
optimal performance.

This project was originally the work of Bryan O'Sullivan (<bos@serpentine.com>), and then [Janrain, Inc.](http://janrain.com/), it is now being maintained by Mark Hibberd (<mark@hibberd.id.au>) and Tim McGilchrist (<timmcgil@gmail.com>).

# Join in!

We are happy to receive bug reports, fixes, documentation enhancements,
and other improvements.

Please report bugs via the
[github issue tracker](http://github.com/riak-haskell-client/riak-haskell-client/issues).

Master [git repository](http://github.com/riak-haskell-client/riak-haskell-client):

* `git clone git://github.com/riak-haskell-client/riak-haskell-client.git`

Note the official repo is now <https://github.com/riak-haskell-client/riak-haskell-client>.

# Build

[![Build Status](https://travis-ci.org/riak-haskell-client/riak-haskell-client.svg)](https://travis-ci.org/riak-haskell-client/riak-haskell-client)

redpajama_set_name: RedPajamaGithub


text:
package usbong.android.builder.events;

/**
 * Created by Rocky Camacho on 7/9/2014.
 */
public class OnNeedRefreshTrees {

    public final static OnNeedRefreshTrees EVENT = new OnNeedRefreshTrees();

}


text:
<!DOCTYPE html>

    <meta charset = "utf-8">
   <link href='http://fonts.googleapis.com/css?family=Lobster|Open+Sans' rel='stylesheet' type='text/css'>
    <title>Breakfast Contest</title>

No Food Finer at JJ's Diner

A Parks and Rec Breakfast Competition

Name: Ron Swanson
Current calories consumed: 0
Remaining packages of bacon: 20

Name: Leslie Knope
Current calories consumed: 0
Remaining waffle sections: 20

Name: Chris Traeger
Current calories consumed: 0
Remaining hard-boiled egg whites: 20

                <button id="reset">Start Over</button>

Ron, Leslie, and Chris are eating breakfast at JJ's Diner when they decide to have an eating contest with each their favorite breakfast foods. Chris claims he can eat 20 hard-boiled egg whites the fastest. Leslie claims she can eat 20 quarted-waffle sections the fastest. Ron, being a proud man and a meat lover, claims he can eat 20 packages of bacon the fastest.

Who will win? You decide! Click on a contestant's face to make them eat more!

Or click here to see my GitHub file.


text:
<!DOCTYPE HTML>

  <title>Test for Content Security Policy Frame Ancestors directive</title>

  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />


text:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >

    <corners android:radius="4.0dip" />

    <gradient
        android:angle="270"
        android:centerColor="#EE6A50"
        android:endColor="#EE3B3B"
        android:startColor="#EE7942" />

</shape>


text:
class ElectricSlide
  VERSION = '0.5.0'
end


text:
require 'fileutils'
require 'java_buildpack/diagnostics/common'
require 'java_buildpack/jre'
require 'java_buildpack/jre/memory/openjdk_memory_heuristic_factory'
require 'java_buildpack/repository/configured_item'
require 'java_buildpack/util/application_cache'
require 'java_buildpack/util/format_duration'
require 'java_buildpack/util/resource_utils'
require 'java_buildpack/versioned_dependency_component'

module JavaBuildpack::Jre

  # Encapsulates the detect, compile, and release functionality for selecting an OpenJDK JRE.
  class OpenJdk < JavaBuildpack::VersionedDependencyComponent

    # Filename of killjava script used to kill the JVM on OOM.
    KILLJAVA_FILE_NAME = 'killjava'.freeze

    def initialize(context)
      super('OpenJDK JRE', context)
      @java_home.concat JAVA_HOME
    end

    def compile
      download { |file| expand file }
      copy_killjava_script
    end

    def release
      @java_opts << "-XX:OnOutOfMemoryError=./#{JavaBuildpack::Diagnostics::DIAGNOSTICS_DIRECTORY}/#{KILLJAVA_FILE_NAME}"
      @java_opts << '-Djava.io.tmpdir=$TMPDIR'
      @java_opts.concat memory
    end

    protected

    def id(version)
      "openjdk-#{version}"
    end

    def supports?
      true
    end

    private

    JAVA_HOME = '.java'.freeze

    KEY_MEMORY_HEURISTICS = 'memory_heuristics'.freeze

    KEY_MEMORY_SIZES = 'memory_sizes'.freeze

    def expand(file)
      expand_start_time = Time.now
      print "       Expanding JRE to #{JAVA_HOME} "

      shell "rm -rf #{java_home}"
      shell "mkdir -p #{java_home}"
      shell "tar xzf #{file.path} -C #{java_home} --strip 1 2>&1"

      puts "(#{(Time.now - expand_start_time).duration})"
    end

    def java_home
      File.join @app_dir, JAVA_HOME
    end

    def memory
      sizes = @configuration[KEY_MEMORY_SIZES] || {}
      heuristics = @configuration[KEY_MEMORY_HEURISTICS] || {}
      OpenJDKMemoryHeuristicFactory.create_memory_heuristic(sizes, heuristics, @version).resolve
    end

    def copy_killjava_script
      resources = JavaBuildpack::Util::ResourceUtils.get_resources(File.join('openjdk', 'diagnostics'))
      killjava_file_content = File.read(File.join resources, KILLJAVA_FILE_NAME)
      updated_content = killjava_file_content.gsub(/@@LOG_FILE_NAME@@/, JavaBuildpack::Diagnostics::LOG_FILE_NAME)
      diagnostic_dir = JavaBuildpack::Diagnostics.get_diagnostic_directory @app_dir
      FileUtils.mkdir_p diagnostic_dir
      File.open(File.join(diagnostic_dir, KILLJAVA_FILE_NAME), 'w', 0755) do |file|
        file.write updated_content
        file.fsync
      end
    end

  end

end


text:
import { Card, Dialog, Divider } from '@blueprintjs/core';
import React from 'react';

import { JSONCollapse } from '../../components';

import './history-dialog.scss';

interface HistoryDialogProps {
  historyRecords: any[];
}

export class HistoryDialog extends React.PureComponent<HistoryDialogProps> {
  renderRecords() {
    const { children, historyRecords } = this.props;
    let content;
    if (historyRecords.length === 0) {
      content =
No history records available
;
    } else {
      content = (
        <>
          History

            {historyRecords.map((record, i) => {
              const auditInfo = record.auditInfo;
              const auditTime = record.auditTime;
              const formattedTime = auditTime.replace('T', ' ').substring(0, auditTime.length - 5);

              return (

                  <Card>

                      Change
                      {formattedTime}

                    <Divider />

{auditInfo.comment === '' ? '(No comment)' : auditInfo.comment}

                    <JSONCollapse stringValue={record.payload} buttonText="Payload" />
                  </Card>

              );
            })}

        </>
      );
    }
    return (

        {content}
        {children}

    );
  }

  render(): React.ReactNode {
    return (
      <Dialog className="history-dialog" isOpen {...this.props}>
        {this.renderRecords()}
      </Dialog>
    );
  }
}


text:
package com.xtech.sultano.optimizedfilesender.Client;

import android.util.Log;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.InterfaceAddress;
import java.net.NetworkInterface;
import java.util.Enumeration;
import java.util.HashMap;

public class DiscoveryClient{
    public static final String DISCOVERY_REQUEST_PREFIX = "DISCOVERY_REQUEST";
    public static final String DISCOVERY_RESPONSE_PREFIX = "DISCOVERY_RESPONSE";
    public static final String BRDCAST_ADDR = "255.255.255.255";
    public static final int BRDCAST_PORT = 8888;
    private String clientName;
    private String mServerName;

    public DiscoveryClient(String serverName){
        this.mServerName = serverName;
        this.clientName = "testClient1";
    }

    public void broadcastDiscoveryRequest(DatagramSocket c, byte[] sendData) throws IOException{
        c.setBroadcast(true);

        try { //Try with 255.255.255.255 first
            DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, InetAddress.getByName(BRDCAST_ADDR), BRDCAST_PORT);
            c.send(sendPacket);
            Log.d("LOG19", getClass().getName() + ">>> Request packet sent to: 255.255.255.255 (DEFAULT)");
        } catch (Exception e) {}

        // Broadcast the message over all the network interfaces
        Enumeration interfaces = NetworkInterface.getNetworkInterfaces();
        while (interfaces.hasMoreElements()) {
            NetworkInterface networkInterface = (NetworkInterface)interfaces.nextElement();

            if (networkInterface.isLoopback() || !networkInterface.isUp()) {
                continue; // Don't want to broadcast to the loopback interface
            }

            for (InterfaceAddress interfaceAddress : networkInterface.getInterfaceAddresses()) {
                InetAddress broadcast = interfaceAddress.getBroadcast();

                if (broadcast == null) {
                    continue;
                }

                // Send the broadcast package
                try {
                    DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, broadcast, BRDCAST_PORT);
                    c.send(sendPacket);
                } catch (Exception e) {
                }

                Log.d("LOG19", getClass().getName() + ">>> Request packet sent to: " + broadcast.getHostAddress() + "; Interface: " + networkInterface.getDisplayName());
            }
        }
        Log.d("LOG19", getClass().getName() + ">>> Done looping over all network interfaces. Now waiting for a reply!");
    }

    public byte[] makeDiscoveryRequest(){
        String request = DISCOVERY_REQUEST_PREFIX + this.clientName;
        return request.getBytes();
    }

    public DatagramPacket waitForDiscoveryResponse(DatagramSocket c) throws IOException{
        //Wait for a response
        byte[] recvBuf = new byte[15000];

        DatagramPacket receivePacket = new DatagramPacket(recvBuf, recvBuf.length);
        c.receive(receivePacket);

        //We have a response
        Log.d("LOG19", getClass().getName() + ">>> Broadcast response from server: " + receivePacket.getAddress().getHostAddress());
        return receivePacket;
    }

    public HashMap<String, InetAddress> findServer(){
        Log.d("LOG19", "findServer");
        HashMap<String, InetAddress> discoveryResult = new HashMap<>();
        try { // Find the server using UDP broadcast
            DatagramSocket c = new DatagramSocket(); //Open a random port to send the package

            byte[] sendData = this.makeDiscoveryRequest();
            this.broadcastDiscoveryRequest(c, sendData);

            int found = 0;
            while(true){
                DatagramPacket discoveryResponse = this.waitForDiscoveryResponse(c);

                //Check if the message is correct
                String message = new String(discoveryResponse.getData()).trim();

                if (message.startsWith(DISCOVERY_RESPONSE_PREFIX)) {
                    //DO SOMETHING WITH THE SERVER'S IP (for example, store it in your controller)

                    InetAddress serverAddr = discoveryResponse.getAddress();
                    Log.d("LOG19", "findServer --> serverAddr : " + serverAddr.toString());
                    String serverName = message.substring(DISCOVERY_RESPONSE_PREFIX.length(), message.length());
                    Log.d("LOG19", "findServer --> serverName: " + serverName);
                    if(serverName.equals(mServerName)){
                        continue;
                    }
                    found++;
                    discoveryResult.put(serverName, serverAddr);

                    if(found == 1){
                        break;
                    }
                }
            }

            //Close the port!
            c.close();
        } catch (IOException ex) {
            //Logger.getLogger(LoginWindow.class.getName()).log(Level.SEVERE, null, ex);
        }
        return discoveryResult;
    }
}


text:
<?php

use UriTemplate\Processor;

class ProcessorTest extends PHPUnit_Framework_TestCase
{

    public function testNoExpressionsReturnsSameUri()
    {
        $processor = new Processor('http://foo.com/hello/world', array());

        $this->assertEquals('http://foo.com/hello/world', $processor->process());
    }

    public function testSimpleExpansion()
    {
        $processor = new Processor('http://foo.com/{var}', array('var' => 'Hello'));
        $this->assertEquals('http://foo.com/Hello', $processor->process());

        $processor = new Processor('http://foo.com/{var}', array('var' => 'Hello World'));
        $this->assertEquals('http://foo.com/Hello%20World', $processor->process());

        $processor = new Processor('http://foo.com/{non_existent}', array('var' => 'Hello'));
        $this->assertEquals('http://foo.com/', $processor->process());

        $processor = new Processor('http://foo.com/{var}', array('var' => array(
            1, 2, 3
        )));
        $this->assertEquals('http://foo.com/1,2,3', $processor->process());

        $processor = new Processor('http://foo.com/{var}', array('var' => array(
            'foo' => 'bar',
            'baz' => 'yay',
        )));
        $this->assertEquals('http://foo.com/foo,bar,baz,yay', $processor->process());

    }

    public function testSimpleExpansionWithMaxLen()
    {
        $processor = new Processor('http://foo.com/{var:2}', array('var' => 'welcome'));
        $this->assertEquals('http://foo.com/we', $processor->process());

        $processor = new Processor('http://foo.com/{var:50}', array('var' => 'welcome'));
        $this->assertEquals('http://foo.com/welcome', $processor->process());
    }

    public function testExplodeExpansion()
    {
        $processor = new Processor('http://foo.com/{var*}', array(
            'var' => array(
                12, 23, 43
            ),
        ));
        $this->assertEquals('http://foo.com/12,23,43', $processor->process());

        $processor = new Processor('http://foo.com/{var*}', array(
            'var' => array(
                'foo' => 'bar',
                'baz' => 'yay',
            ),
        ));
        $this->assertEquals('http://foo.com/foo=bar,baz=yay', $processor->process());
    }

    public function testMultipleExpansionsWithNoOperators()
    {
        $processor = new Processor('http://foo.com/{var0}/{var1:2}/{var2*}/{var3*}', array(
            'var0' => 'bob',
            'var1' => 'hello',
            'var2' => array(
                12, 23, 43
            ),
            'var3' => array(
                'foo' => 'bar',
                'baz' => 'yay',
            ),
        ));

        $this->assertEquals('http://foo.com/bob/he/12,23,43/foo=bar,baz=yay', $processor->process());
    }

    public function testReservedCharsGetEncodedByDefault()
    {
        $processor = new Processor('http://foo.com/{var}', array('var' => 'welcome!'));
        $this->assertEquals('http://foo.com/welcome%21', $processor->process());
    }

    public function testReservedStringExpansion()
    {
        $processor = new Processor('http://foo.com/{+var}', array('var' => 'welcome!'));
        $this->assertEquals('http://foo.com/welcome!', $processor->process());
    }

    public function testFragmentExpansion()
    {
        $processor = new Processor('http://foo.com/{#var}', array('var' => 'welcome!'));
        $this->assertEquals('http://foo.com/#welcome!', $processor->process());
    }

    public function testDotPrefixedExpansion()
    {
        $processor = new Processor('http://foo.com/{.var1,var2}', array(
            'var1' => 'foo',
            'var2' => 'bar'
        ));
        $this->assertEquals('http://foo.com/.foo.bar', $processor->process());
    }

    public function testPathSegmentsExpansion()
    {
        $processor = new Processor('http://foo.com{/var1,var2}', array(
            'var1' => 'foo',
            'var2' => 'bar'
        ));
        $this->assertEquals('http://foo.com/foo/bar', $processor->process());
    }

    public function testSemiColonPathExpansion()
    {
        $processor = new Processor('http://foo.com/{;var1,var2}', array(
            'var1' => 'foo',
            'var2' => 'bar'
        ));
        $this->assertEquals('http://foo.com/;var1=foo;var2=bar', $processor->process());
    }

    public function testFormQueryWithQuestionMarkExpansion()
    {
        $processor = new Processor('http://foo.com/{?var1,var2}', array(
            'var1' => 'foo',
            'var2' => 'bar'
        ));
        $this->assertEquals('http://foo.com/?var1=foo&var2=bar', $processor->process());
    }

    public function testFormQueryWithAmpersandExpansion()
    {
        $processor = new Processor('http://foo.com/?a=b{&var1,var2}', array(
            'var1' => 'foo',
            'var2' => 'bar'
        ));
        $this->assertEquals('http://foo.com/?a=b&var1=foo&var2=bar', $processor->process());
    }

    public function testUriCreation()
    {
        $processor = new Processor('{schema}://{domain}{.tld}{/resource}{.format}{?query*}');
        $processor->setContext(array(
            'schema' => 'http',
            'domain' => 'api.foo',
            'tld' => array('co', 'uk'),
            'resource' => array('search', 'entries'),
            'format' => 'json',
            'query' => array('q' => 'bar', 'sort_by' => 'recent')
        ));

        $this->assertEquals('http://api.foo.co.uk/search/entries.json?q=bar&sort_by=recent', $processor->process());
    }

}


text:
import React, { Component, PropTypes } from "react";
import { View, Image, Text } from "react-native";

export default class Avatar extends Component {
    static propTypes = {
         image: PropTypes.oneOfType([PropTypes.number, PropTypes.object]),
         size: PropTypes.number,
         color: PropTypes.string,
         backgroundColor: PropTypes.string,
         text: PropTypes.string,
         textSize: PropTypes.number,
         borderRadius: PropTypes.number,
         borderColor: PropTypes.string,
         borderWidth: PropTypes.number
     };

     static defaultProps = {
         size: 40,
         color: '#ffffff',
         backgroundColor: 'skyblue',
         borderColor: 'rgba(0,0,0,.1)',
         borderWidth: 1
     };

     render() {
         const {
             image,
             size,
             color,
             backgroundColor,
             text,
             textSize,
             borderColor,
             borderWidth
         } = this.props;

         if (image) {
             return(
                 <View style={{padding: 3}}>
                     <Image
                         style={{width: size, height: size, borderRadius: size / 2, borderColor: borderColor, borderWidth: borderWidth}}
                         source={image}>
                     </Image>
                 </View>
             )
         }

         if (text) {
             return (
                 <View style={{padding: 5}}>
                     <View style={{ width: size, height: size, borderRadius: size/2, backgroundColor: backgroundColor, alignItems:'center', justifyContent: 'center' }}>
                         <Text style={{ color: color, fontSize: textSize }}>{text}</Text>
                     </View>
                 </View>
             );
         }

         return null;
     }
}


text:
var p = nucleus.dofile("deps/utils.js").prettyPrint;
var uv = nucleus.uv;

function assert(condition, message) {
    if (!condition) {
        throw new Error(message || "Assertion failed")
    }
}

print("\buv.getaddrinfo");
uv.getaddrinfo({
  node: "luvit.io",
  socktype: "stream", // Only show TCP results
  // family: "inet",  // Only show IPv4 results
}, function (err, results) {
  assert(!err, err);
  p("Dns results for luvit.io", results);
});
uv.run();
uv.getnameinfo({
  ip: "::1",
  family: "inet6",
  port: 80,
}, function (err, hostname, service) {
  assert(!err, err);
  p("localhost", hostname, service);
  assert(hostname);
  assert(service);
});
uv.run();

print("\nTimer.prototype");
p(uv.Timer.prototype);
print("Handle.prototype (via Timer.prototype)");
p(Object.getPrototypeOf(uv.Timer.prototype));

print("\nPrepare.prototype");
p(uv.Prepare.prototype);
print("Handle.prototype (via Prepare.prototype)");
p(Object.getPrototypeOf(uv.Prepare.prototype));

print("\nCheck.prototype");
p(uv.Check.prototype);
print("Handle.prototype (via Check.prototype)");
p(Object.getPrototypeOf(uv.Check.prototype));

print("\nIdle.prototype");
p(uv.Idle.prototype);
print("Handle.prototype (via Idle.prototype)");
p(Object.getPrototypeOf(uv.Idle.prototype));

print("\nAsync.prototype");
p(uv.Async.prototype);
print("Handle.prototype (via Async.prototype)");
p(Object.getPrototypeOf(uv.Async.prototype));

print("\nTcp.prototype");
p(uv.Tcp.prototype);
print("Stream.prototype (via Tcp.prototype)");
var streamProto = Object.getPrototypeOf(uv.Tcp.prototype);
p(streamProto);
print("Handle.prototype (via Stream.prototype)");
p(Object.getPrototypeOf(streamProto));

print("\nPipe.prototype");
p(uv.Pipe.prototype);
print("Stream.prototype (via Pipe.prototype)");
p(Object.getPrototypeOf(uv.Pipe.prototype));

print("\nTty.prototype");
p(uv.Tty.prototype);
print("Stream.prototype (via Tty.prototype)");
p(Object.getPrototypeOf(uv.Tty.prototype));

var prepare = new uv.Prepare();
prepare.start(function () {
  print("prepare...");
});
prepare.unref();

var check = new uv.Check();
check.start(function () {
  print("check...");
});

var idle = new uv.Idle();
idle.start(function () {
  print("idle...");
  idle.stop();
});

var async = new uv.Async(function () {
  print("async...");
});
p("async", async);
async.send();

print("\nTesting uv.walk");
var timer = new uv.Timer();
var tcp = new uv.Tcp();
uv.walk(p);
timer.close();
tcp.close();
check.unref();
idle.unref();
async.unref();

print("\nTesting simple timeout");
var timer = new uv.Timer();
timer.start(100, 0, function () {
  p("timeout", timer);
  timer.close(function () {
    p("closed", timer);
  });
});
uv.run();

print("\nTesting simple interval");
timer = new uv.Timer();
var count = 3;
timer.start(50, 50, function () {
  p("interval", timer);
  if (--count) return;
  timer.close(function () {
    p("close", timer);
  });
});
uv.run();

print("\nTest two concurrent timers");
var timer1 = new uv.Timer();
var timer2 = new uv.Timer();
timer1.start(100, 0, function () {
  p("timeout", timer1);
  timer1.close();
  timer2.close();
});
timer2.start(10, 20, function () {
  p("interval", timer2);
});
uv.run();

print("\nTest shrinking interval");
timer = new uv.Timer();
timer.start(10, 0, function () {
  var repeat = timer.getRepeat();
  p("interval", timer, repeat);
  if (repeat === 0) {
    timer.setRepeat(8);
    timer.again();
  }
  else if (repeat == 2) {
    timer.stop();
    timer.close();
  }
  else {
    timer.setRepeat(repeat / 2);
  }
});
uv.run();

assert(typeof uv.version === 'function','misc not compiled in seaduk');

var version = uv.version();
var version_string = uv.version_string();
p({
    version: version,
    version_string: version_string,
});
assert(typeof version === "number");
assert(typeof version_string === "string");

var rss = uv.resident_set_memory();
var total = uv.get_total_memory();
p({
  rss: rss,
  total: total
});
assert(rss < total);

var uptime = uv.uptime();
p({uptime: uptime});

var rusage = uv.getrusage();
p(rusage);

var info = uv.cpu_info();
p(info);

var addresses = uv.interface_addresses();
p(addresses);

var avg = uv.loadavg();
p({loadavg:avg});
assert(avg.length === 3);

var path = uv.exepath();
p({exepath: path});

var old = uv.cwd();
uv.chdir("/");
var cwd = uv.cwd();
p({
    original: old,
    changed: cwd
});
assert(cwd !== old);
uv.chdir(old);

var old = uv.get_process_title();
uv.set_process_title("Magic");
var changed = uv.get_process_title();
p({
    original: old,
    changed: changed,
});
assert(old !== changed);
uv.set_process_title(old);

var time = uv.hrtime();
p({"hrtime": time});

print("\nTesting TCP Server");
var server = new uv.Tcp();
server.bind("127.0.0.1", 8080);
server.listen(128, function (err) {
  if (err) throw err;
  var client = new uv.Tcp();
  server.accept(client);
  p("client", client, client.getpeername());
  client.readStart(function (err, chunk) {
    if (err) throw err;
    p("read", chunk);
    if (chunk) {
      client.write(chunk);
    }
    else {
      client.shutdown(function () {
        client.close();
        server.close();
      });
    }
  });
});
p("server", server, server.getsockname());

var client = new uv.Tcp();
client.connect("127.0.0.1", 8080, function (err) {
  if (err) throw err;
  p("client connected", client, client.getpeername(), client.getsockname());
  client.readStart(function (err, chunk) {
    if (err) throw err;
    p("client onread", chunk);
    if (!chunk) {
      client.close();
    }
  });
  client.write("Hello", function (err) {
    if (err) throw err;
    client.write("World");
    client.shutdown();
  });
});
uv.run();

// Use uv.Async to implement nextTick
var ticks = [];
var ticker = new uv.Async(function () {

  if (!ticks.length) return;
  var list = ticks;
  ticks = [];
  ticker.unref();
  list.forEach(function (cb) {
    cb();
  });
});

function nextTick(callback) {
  ticks.push(callback);
  ticker.ref();
  ticker.send();
}

print("before");
nextTick(function () {
  print("tick");
});
print("after");
uv.run();

print("Testing stdio with default mode");
var stdin = new uv.Tty(0, true);
var stdout = new uv.Tty(1, false);
p(stdin, stdout, stdin.getWinsize());
print("Type test, hit enter to send");
print("Press Control-D to stop test");
stdin.readStart(function (err, chunk) {
  if (err) throw err;
  p("stdin", chunk);
  if (chunk) {
    stdout.write(chunk);
  }
  else {
    stdin.readStop();
  }
});
uv.run();
stdin.close();
stdout.close();

ticker.close();
prepare.close();
check.close();
idle.close();

uv.run();


text:
#include "SkMorphologyImageFilter.h"
#include "SkBitmap.h"
#include "SkColorPriv.h"
#include "SkFlattenableBuffers.h"
#include "SkRect.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrTexture.h"
#include "GrTBackendEffectFactory.h"
#include "gl/GrGLEffect.h"
#include "gl/GrGLEffectMatrix.h"
#include "effects/Gr1DKernelEffect.h"
#endif

SkMorphologyImageFilter::SkMorphologyImageFilter(SkFlattenableReadBuffer& buffer)
  : INHERITED(buffer) {
    fRadius.fWidth = buffer.readInt();
    fRadius.fHeight = buffer.readInt();
}

SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX, int radiusY, SkImageFilter* input)
    : INHERITED(input), fRadius(SkISize::Make(radiusX, radiusY)) {
}

void SkMorphologyImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const {
    this->INHERITED::flatten(buffer);
    buffer.writeInt(fRadius.fWidth);
    buffer.writeInt(fRadius.fHeight);
}

static void erode(const SkPMColor* src, SkPMColor* dst,
                  int radius, int width, int height,
                  int srcStrideX, int srcStrideY,
                  int dstStrideX, int dstStrideY)
{
    radius = SkMin32(radius, width - 1);
    const SkPMColor* upperSrc = src + radius * srcStrideX;
    for (int x = 0; x < width; ++x) {
        const SkPMColor* lp = src;
        const SkPMColor* up = upperSrc;
        SkPMColor* dptr = dst;
        for (int y = 0; y < height; ++y) {
            int minB = 255, minG = 255, minR = 255, minA = 255;
            for (const SkPMColor* p = lp; p <= up; p += srcStrideX) {
                int b = SkGetPackedB32(*p);
                int g = SkGetPackedG32(*p);
                int r = SkGetPackedR32(*p);
                int a = SkGetPackedA32(*p);
                if (b < minB) minB = b;
                if (g < minG) minG = g;
                if (r < minR) minR = r;
                if (a < minA) minA = a;
            }
            *dptr = SkPackARGB32(minA, minR, minG, minB);
            dptr += dstStrideY;
            lp += srcStrideY;
            up += srcStrideY;
        }
        if (x >= radius) src += srcStrideX;
        if (x + radius < width - 1) upperSrc += srcStrideX;
        dst += dstStrideX;
    }
}

static void erodeX(const SkBitmap& src, SkBitmap* dst, int radiusX)
{
    erode(src.getAddr32(0, 0), dst->getAddr32(0, 0),
          radiusX, src.width(), src.height(),
          1, src.rowBytesAsPixels(), 1, dst->rowBytesAsPixels());
}

static void erodeY(const SkBitmap& src, SkBitmap* dst, int radiusY)
{
    erode(src.getAddr32(0, 0), dst->getAddr32(0, 0),
          radiusY, src.height(), src.width(),
          src.rowBytesAsPixels(), 1, dst->rowBytesAsPixels(), 1);
}

static void dilate(const SkPMColor* src, SkPMColor* dst,
                   int radius, int width, int height,
                   int srcStrideX, int srcStrideY,
                   int dstStrideX, int dstStrideY)
{
    radius = SkMin32(radius, width - 1);
    const SkPMColor* upperSrc = src + radius * srcStrideX;
    for (int x = 0; x < width; ++x) {
        const SkPMColor* lp = src;
        const SkPMColor* up = upperSrc;
        SkPMColor* dptr = dst;
        for (int y = 0; y < height; ++y) {
            int maxB = 0, maxG = 0, maxR = 0, maxA = 0;
            for (const SkPMColor* p = lp; p <= up; p += srcStrideX) {
                int b = SkGetPackedB32(*p);
                int g = SkGetPackedG32(*p);
                int r = SkGetPackedR32(*p);
                int a = SkGetPackedA32(*p);
                if (b > maxB) maxB = b;
                if (g > maxG) maxG = g;
                if (r > maxR) maxR = r;
                if (a > maxA) maxA = a;
            }
            *dptr = SkPackARGB32(maxA, maxR, maxG, maxB);
            dptr += dstStrideY;
            lp += srcStrideY;
            up += srcStrideY;
        }
        if (x >= radius) src += srcStrideX;
        if (x + radius < width - 1) upperSrc += srcStrideX;
        dst += dstStrideX;
    }
}

static void dilateX(const SkBitmap& src, SkBitmap* dst, int radiusX)
{
    dilate(src.getAddr32(0, 0), dst->getAddr32(0, 0),
           radiusX, src.width(), src.height(),
           1, src.rowBytesAsPixels(), 1, dst->rowBytesAsPixels());
}

static void dilateY(const SkBitmap& src, SkBitmap* dst, int radiusY)
{
    dilate(src.getAddr32(0, 0), dst->getAddr32(0, 0),
           radiusY, src.height(), src.width(),
           src.rowBytesAsPixels(), 1, dst->rowBytesAsPixels(), 1);
}

bool SkErodeImageFilter::onFilterImage(Proxy* proxy,
                                       const SkBitmap& source, const SkMatrix& ctm,
                                       SkBitmap* dst, SkIPoint* offset) {
    SkBitmap src = this->getInputResult(proxy, source, ctm, offset);
    if (src.config() != SkBitmap::kARGB_8888_Config) {
        return false;
    }

    SkAutoLockPixels alp(src);
    if (!src.getPixels()) {
        return false;
    }

    dst->setConfig(src.config(), src.width(), src.height());
    dst->allocPixels();

    int width = radius().width();
    int height = radius().height();

    if (width < 0 || height < 0) {
        return false;
    }

    if (width == 0 && height == 0) {
        src.copyTo(dst, dst->config());
        return true;
    }

    SkBitmap temp;
    temp.setConfig(dst->config(), dst->width(), dst->height());
    if (!temp.allocPixels()) {
        return false;
    }

    if (width > 0 && height > 0) {
        erodeX(src, &temp, width);
        erodeY(temp, dst, height);
    } else if (width > 0) {
        erodeX(src, dst, width);
    } else if (height > 0) {
        erodeY(src, dst, height);
    }
    return true;
}

bool SkDilateImageFilter::onFilterImage(Proxy* proxy,
                                        const SkBitmap& source, const SkMatrix& ctm,
                                        SkBitmap* dst, SkIPoint* offset) {
    SkBitmap src = this->getInputResult(proxy, source, ctm, offset);
    if (src.config() != SkBitmap::kARGB_8888_Config) {
        return false;
    }

    SkAutoLockPixels alp(src);
    if (!src.getPixels()) {
        return false;
    }

    dst->setConfig(src.config(), src.width(), src.height());
    dst->allocPixels();

    int width = radius().width();
    int height = radius().height();

    if (width < 0 || height < 0) {
        return false;
    }

    if (width == 0 && height == 0) {
        src.copyTo(dst, dst->config());
        return true;
    }

    SkBitmap temp;
    temp.setConfig(dst->config(), dst->width(), dst->height());
    if (!temp.allocPixels()) {
        return false;
    }

    if (width > 0 && height > 0) {
        dilateX(src, &temp, width);
        dilateY(temp, dst, height);
    } else if (width > 0) {
        dilateX(src, dst, width);
    } else if (height > 0) {
        dilateY(src, dst, height);
    }
    return true;
}

#if SK_SUPPORT_GPU

///////////////////////////////////////////////////////////////////////////////

class GrGLMorphologyEffect;

/**
 * Morphology effects. Depending upon the type of morphology, either the
 * component-wise min (Erode_Type) or max (Dilate_Type) of all pixels in the
 * kernel is selected as the new color. The new color is modulated by the input
 * color.
 */
class GrMorphologyEffect : public Gr1DKernelEffect {

public:

    enum MorphologyType {
        kErode_MorphologyType,
        kDilate_MorphologyType,
    };

    GrMorphologyEffect(GrTexture*, Direction, int radius, MorphologyType);
    virtual ~GrMorphologyEffect();

    MorphologyType type() const { return fType; }

    static const char* Name() { return "Morphology"; }

    typedef GrGLMorphologyEffect GLEffect;

    virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
    virtual bool isEqual(const GrEffect&) const SK_OVERRIDE;

protected:

    MorphologyType fType;

private:
    GR_DECLARE_EFFECT_TEST;

    typedef Gr1DKernelEffect INHERITED;
};

///////////////////////////////////////////////////////////////////////////////

class GrGLMorphologyEffect  : public GrGLEffect {
public:
    GrGLMorphologyEffect (const GrBackendEffectFactory& factory,
                          const GrEffect& effect);

    virtual void emitCode(GrGLShaderBuilder*,
                          const GrEffectStage&,
                          EffectKey,
                          const char* vertexCoords,
                          const char* outputColor,
                          const char* inputColor,
                          const TextureSamplerArray&) SK_OVERRIDE;

    static inline EffectKey GenKey(const GrEffectStage&, const GrGLCaps&);

    virtual void setData(const GrGLUniformManager&, const GrEffectStage&) SK_OVERRIDE;

private:
    int width() const { return GrMorphologyEffect::WidthFromRadius(fRadius); }

    int                                 fRadius;
    GrMorphologyEffect::MorphologyType  fType;
    GrGLUniformManager::UniformHandle   fImageIncrementUni;
    GrGLEffectMatrix                    fEffectMatrix;

    typedef GrGLEffect INHERITED;
};

GrGLMorphologyEffect::GrGLMorphologyEffect(const GrBackendEffectFactory& factory,
                                           const GrEffect& effect)
    : INHERITED(factory)
    , fImageIncrementUni(GrGLUniformManager::kInvalidUniformHandle) {
    const GrMorphologyEffect& m = static_cast<const GrMorphologyEffect&>(effect);
    fRadius = m.radius();
    fType = m.type();
}

void GrGLMorphologyEffect::emitCode(GrGLShaderBuilder* builder,
                                    const GrEffectStage&,
                                    EffectKey key,
                                    const char* vertexCoords,
                                    const char* outputColor,
                                    const char* inputColor,
                                    const TextureSamplerArray& samplers) {
    const char* coords;
    fEffectMatrix.emitCodeMakeFSCoords2D(builder, key, vertexCoords, &coords);
    fImageIncrementUni = builder->addUniform(GrGLShaderBuilder::kFragment_ShaderType,
                                             kVec2f_GrSLType, "ImageIncrement");

    SkString* code = &builder->fFSCode;

    const char* func;
    switch (fType) {
        case GrMorphologyEffect::kErode_MorphologyType:
            code->appendf("\t\t%s = vec4(1, 1, 1, 1);\n", outputColor);
            func = "min";
            break;
        case GrMorphologyEffect::kDilate_MorphologyType:
            code->appendf("\t\t%s = vec4(0, 0, 0, 0);\n", outputColor);
            func = "max";
            break;
        default:
            GrCrash("Unexpected type");
            func = ""; // suppress warning
            break;
    }
    const char* imgInc = builder->getUniformCStr(fImageIncrementUni);

    code->appendf("\t\tvec2 coord = %s - %d.0 * %s;\n", coords, fRadius, imgInc);
    code->appendf("\t\tfor (int i = 0; i < %d; i++) {\n", this->width());
    code->appendf("\t\t\t%s = %s(%s, ", outputColor, func, outputColor);
    builder->appendTextureLookup(&builder->fFSCode, samplers[0], "coord");
    code->appendf(");\n");
    code->appendf("\t\t\tcoord += %s;\n", imgInc);
    code->appendf("\t\t}\n");
    GrGLSLMulVarBy4f(code, 2, outputColor, inputColor);
}

GrGLEffect::EffectKey GrGLMorphologyEffect::GenKey(const GrEffectStage& s, const GrGLCaps&) {
    const GrMorphologyEffect& m = static_cast<const GrMorphologyEffect&>(*s.getEffect());
    EffectKey key = static_cast<EffectKey>(m.radius());
    key |= (m.type() << 8);
    key <<= GrGLEffectMatrix::kKeyBits;
    EffectKey matrixKey = GrGLEffectMatrix::GenKey(m.getMatrix(),
                                                   s.getCoordChangeMatrix(),
                                                   m.texture(0));
    return key | matrixKey;
}

void GrGLMorphologyEffect::setData(const GrGLUniformManager& uman, const GrEffectStage& stage) {
    const Gr1DKernelEffect& kern = static_cast<const Gr1DKernelEffect&>(*stage.getEffect());
    GrTexture& texture = *kern.texture(0);
    // the code we generated was for a specific kernel radius
    GrAssert(kern.radius() == fRadius);
    float imageIncrement[2] = { 0 };
    switch (kern.direction()) {
        case Gr1DKernelEffect::kX_Direction:
            imageIncrement[0] = 1.0f / texture.width();
            break;
        case Gr1DKernelEffect::kY_Direction:
            imageIncrement[1] = 1.0f / texture.height();
            break;
        default:
            GrCrash("Unknown filter direction.");
    }
    uman.set2fv(fImageIncrementUni, 0, 1, imageIncrement);
    fEffectMatrix.setData(uman, kern.getMatrix(), stage.getCoordChangeMatrix(), kern.texture(0));
}

///////////////////////////////////////////////////////////////////////////////

GrMorphologyEffect::GrMorphologyEffect(GrTexture* texture,
                                       Direction direction,
                                       int radius,
                                       MorphologyType type)
    : Gr1DKernelEffect(texture, direction, radius)
    , fType(type) {
}

GrMorphologyEffect::~GrMorphologyEffect() {
}

const GrBackendEffectFactory& GrMorphologyEffect::getFactory() const {
    return GrTBackendEffectFactory<GrMorphologyEffect>::getInstance();
}

bool GrMorphologyEffect::isEqual(const GrEffect& sBase) const {
    const GrMorphologyEffect& s =
        static_cast<const GrMorphologyEffect&>(sBase);
    return (INHERITED::isEqual(sBase) &&
            this->radius() == s.radius() &&
            this->direction() == s.direction() &&
            this->type() == s.type());
}

///////////////////////////////////////////////////////////////////////////////

GR_DEFINE_EFFECT_TEST(GrMorphologyEffect);

GrEffect* GrMorphologyEffect::TestCreate(SkRandom* random,
                                         GrContext* context,
                                         GrTexture* textures[]) {
    int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
                                      GrEffectUnitTest::kAlphaTextureIdx;
    Direction dir = random->nextBool() ? kX_Direction : kY_Direction;
    static const int kMaxRadius = 10;
    int radius = random->nextRangeU(1, kMaxRadius);
    MorphologyType type = random->nextBool() ? GrMorphologyEffect::kErode_MorphologyType :
                                               GrMorphologyEffect::kDilate_MorphologyType;

    return SkNEW_ARGS(GrMorphologyEffect, (textures[texIdx], dir, radius, type));
}

namespace {

void apply_morphology_pass(GrContext* context,
                           GrTexture* texture,
                           const SkRect& rect,
                           int radius,
                           GrMorphologyEffect::MorphologyType morphType,
                           Gr1DKernelEffect::Direction direction) {
    GrPaint paint;
    paint.colorStage(0)->setEffect(SkNEW_ARGS(GrMorphologyEffect, (texture,
                                                                   direction,
                                                                   radius,
                                                                   morphType)))->unref();
    context->drawRect(paint, rect);
}

GrTexture* apply_morphology(GrTexture* srcTexture,
                            const GrRect& rect,
                            GrMorphologyEffect::MorphologyType morphType,
                            SkISize radius) {
    GrContext* context = srcTexture->getContext();
    srcTexture->ref();

    GrContext::AutoMatrix am;
    am.setIdentity(context);

    GrContext::AutoClip acs(context, GrRect::MakeWH(SkIntToScalar(srcTexture->width()),
                                                    SkIntToScalar(srcTexture->height())));

    GrTextureDesc desc;
    desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit;
    desc.fWidth = SkScalarCeilToInt(rect.width());
    desc.fHeight = SkScalarCeilToInt(rect.height());
    desc.fConfig = kRGBA_8888_GrPixelConfig;

    if (radius.fWidth > 0) {
        GrAutoScratchTexture ast(context, desc);
        GrContext::AutoRenderTarget art(context, ast.texture()->asRenderTarget());
        apply_morphology_pass(context, srcTexture, rect, radius.fWidth,
                              morphType, Gr1DKernelEffect::kX_Direction);
        SkIRect clearRect = SkIRect::MakeXYWH(
                    SkScalarFloorToInt(rect.fLeft),
                    SkScalarFloorToInt(rect.fBottom),
                    SkScalarFloorToInt(rect.width()),
                    radius.fHeight);
        context->clear(&clearRect, 0x0);
        srcTexture->unref();
        srcTexture = ast.detach();
    }
    if (radius.fHeight > 0) {
        GrAutoScratchTexture ast(context, desc);
        GrContext::AutoRenderTarget art(context, ast.texture()->asRenderTarget());
        apply_morphology_pass(context, srcTexture, rect, radius.fHeight,
                              morphType, Gr1DKernelEffect::kY_Direction);
        srcTexture->unref();
        srcTexture = ast.detach();
    }
    return srcTexture;
}

};

GrTexture* SkDilateImageFilter::onFilterImageGPU(Proxy* proxy, GrTexture* src, const SkRect& rect) {
    SkAutoTUnref<GrTexture> input(this->getInputResultAsTexture(proxy, src, rect));
    return apply_morphology(input, rect, GrMorphologyEffect::kDilate_MorphologyType, radius());
}

GrTexture* SkErodeImageFilter::onFilterImageGPU(Proxy* proxy, GrTexture* src, const SkRect& rect) {
    SkAutoTUnref<GrTexture> input(this->getInputResultAsTexture(proxy, src, rect));
    return apply_morphology(input, rect, GrMorphologyEffect::kErode_MorphologyType, radius());
}

#endif


text:
import a10_neutron_lbaas.a10_exceptions as a10_ex
from a10_neutron_lbaas.tests.unit.v1 import fake_objs
from a10_neutron_lbaas.tests.unit.v1 import test_base

def return_one(*args):
    return 1

def return_two(*args):
    return 2

class TestMembers(test_base.UnitTestBase):

    def set_count_1(self):
        self.a.openstack_driver._member_count = return_one

    def set_count_2(self):
        self.a.openstack_driver._member_count = return_two

    def test_get_ip(self):
        m = fake_objs.FakeMember()
        self.a.member.neutron.member_get_ip(None, m, False)
        self.a.openstack_driver._member_get_ip.assert_called_with(
            None, m, False)

    def test_get_name(self):
        m = fake_objs.FakeMember()
        z = self.a.member._get_name(m, '1.1.1.1')
        self.assertEqual(z, '_ten1_1_1_1_1_neutron')

    def test_count(self):
        self.a.member.neutron.member_count(None, fake_objs.FakeMember())

    def _test_create(self, admin_state_up=True, uuid_name=False, conn_limit=800000):
        if uuid_name:
            old = self.a.config.get('member_name_use_uuid')
            self.a.config._config.member_name_use_uuid = True
        m = fake_objs.FakeMember(admin_state_up=admin_state_up)
        ip = self.a.member.neutron.member_get_ip(None, m, True)
        if uuid_name:
            name = m['id']
        else:
            name = self.a.member._get_name(m, ip)
        self.a.member.create(None, m)

        if admin_state_up:
            status = self.a.last_client.slb.UP
        else:
            status = self.a.last_client.slb.DOWN
        if conn_limit < 1 or conn_limit > 8000000:
            self.a.last_client.slb.server.create.assert_called_with(
                name, ip,
                '80',
                status=status,
                axapi_args={'server': {}})
        else:
            self.a.last_client.slb.server.create.assert_called_with(
                name, ip,
                '80',
                status=status,
                axapi_args={'server': {'conn-limit': conn_limit}})
        pool_name = self.a.member._pool_name(None, m['pool_id'])
        self.a.last_client.slb.service_group.member.create.assert_called_with(
            pool_name, name, m['protocol_port'], status=status,
            axapi_args={'member': {}})
        if uuid_name:
            self.a.config._config.member_name_use_uuid = old

    def test_create_connlimit(self):
        for k, v in self.a.config.get_devices().items():
            v['conn-limit'] = 1337
        self._test_create(conn_limit=1337)

    def test_create_connlimit_lowerbound(self):
        for k, v in self.a.config.get_devices().items():
            v['conn-limit'] = 8000001
        try:
            self._test_create(conn_limit=8000001)
        except a10_ex.ConnLimitOutOfBounds:
            pass

    def test_create_connlimit_upperbound(self):
        for k, v in self.a.config.get_devices().items():
            v['conn-limit'] = 0
        try:
            self._test_create(conn_limit=0)
        except a10_ex.ConnLimitOutOfBounds:
            pass

    def test_update_down(self):
        m = fake_objs.FakeMember(admin_state_up=False)
        ip = self.a.member.neutron.member_get_ip(None, m, True)
        name = self.a.member._get_name(m, ip)
        self.a.member.update(None, m, m)

        pool_name = self.a.member._pool_name(None, m['pool_id'])
        self.a.last_client.slb.service_group.member.update.assert_called_with(
            pool_name, name, m['protocol_port'],
            self.a.last_client.slb.DOWN,
            axapi_args={'member': {}})

    def test_delete(self):
        m = fake_objs.FakeMember()
        ip = self.a.member.neutron.member_get_ip(None, m, True)

        self.set_count_1()
        self.a.member.delete(None, m)

        self.a.last_client.slb.server.delete(ip)

    def test_delete_count_gt_one(self):
        m = fake_objs.FakeMember()
        ip = self.a.member.neutron.member_get_ip(None, m, True)
        name = self.a.member._get_name(m, ip)

        self.set_count_2()
        self.a.member.delete(None, m)

        pool_name = self.a.member._pool_name(None, m['pool_id'])
        self.a.last_client.slb.service_group.member.delete.assert_called_with(
            pool_name, name, m['protocol_port'])


text:
package org.springframework.security.oauth2.provider.token.store.jwk;

import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import org.springframework.core.convert.converter.Converter;
import org.springframework.security.jwt.codec.Codecs;
import org.springframework.security.oauth2.common.exceptions.InvalidTokenException;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * A {@link Converter} that converts the supplied String representation of a JWT
 * to a Map of JWT Header Parameters.
 *
 * @see JSON Web Token (JWT)
 *
 * @author Joe Grandja
 * @author Vedran Pavic
 */
class JwtHeaderConverter implements Converter<String, Map<String, String>> {
	private final JsonFactory factory = new JsonFactory();

	/**
	 * Converts the supplied JSON Web Token to a Map of JWT Header Parameters.
	 *
	 * @param token the JSON Web Token
	 * @return a Map of JWT Header Parameters
	 * @throws InvalidTokenException if the JWT is invalid
	 */
	@Override
	public Map<String, String> convert(String token) {
		Map<String, String> headers;

		int headerEndIndex = token.indexOf('.');
		if (headerEndIndex == -1) {
			throw new InvalidTokenException("Invalid JWT. Missing JOSE Header.");
		}

		byte[] decodedHeader;

		try {
			decodedHeader = Codecs.b64UrlDecode(token.substring(0, headerEndIndex));
		} catch (IllegalArgumentException ex) {
			throw new InvalidTokenException("Invalid JWT. Malformed JOSE Header.", ex);
		}

		JsonParser parser = null;

		try {
			parser = this.factory.createParser(decodedHeader);
			headers = new HashMap<String, String>();
			if (parser.nextToken() == JsonToken.START_OBJECT) {
				while (parser.nextToken() == JsonToken.FIELD_NAME) {
					String headerName = parser.getCurrentName();
					parser.nextToken();
					String headerValue = parser.getValueAsString();
					headers.put(headerName, headerValue);
				}
			}

		} catch (IOException ex) {
			throw new InvalidTokenException("An I/O error occurred while reading the JWT: " + ex.getMessage(), ex);
		} finally {
			try {
				if (parser != null) parser.close();
			} catch (IOException ex) { }
		}

		return headers;
	}
}


text:
/*
    ChellBot by itdevroman
    Twitch chat bot written in Node.JS
    https://github.com/itdevroman/chellbot
    v1.0.2
*/

// Requires
var irc = require("tmi.js");
var https = require('https');
var moment = require('moment');
var request = require('request');
var fs = require('fs');

// Bot main function
var chellbot = function(bot, messages) {
    const host = bot.host;

    var options = {
        options: {
            debug: bot.debug
        },
        connection: {
            cluster: "aws",
            reconnect: true
        },
        identity: {
            username: bot.name,
            password: bot.oauth
        },
        channels: bot.channels
    };

    // IRC
    var client = new irc.client(options);

    var stamps = {
        lastAPI: null,
        max: 0,
        created_at: null,
        vk: null
    };

    // Bot command functions
    const biCommands = {
        secDecl: function(s) {
            const titles = [' секунду', ' секунды', ' секунд']
            const cases = [2, 0, 1, 1, 1, 2];
            return titles[ (s%100>4 && s%100<20)? 2 : cases[(s%10<5)?s%10:5] ];
        },
        banme: function(channel, username) {
            var willBan = Math.round(Math.random() * (200 - 1) + 1);
            if(willBan < 180) {
                var timeBan = Math.round(Math.random() * (600 - 10) + 10);
                client.timeout(channel, username, timeBan);
                client.say(channel, "@" + username + messages.banMe.ban + timeBan + this.secDecl(timeBan) + '.');
            }
            else {
                client.say(channel, "@" + username + messages.banMe.fail);
            }
        },
        banmeState: function(state, channel) {
            bot.allowedModules.banMe = state;
            if(state)
                client.say(channel, messages.banMe.on);
            else
                client.say(channel, messages.banMe.off);
        },
        time: function(channel) {
            if(stamps.created_at === null) {
                client.say(channel, messages.time.offline);
            } else {
                client.say(channel, messages.time.online + stamps.created_at);
            }
        },
        max: function(channel) {
            client.say(channel, messages.max + stamps.max);
        },
        clearMax: function(channel) {
            stamps.max = 0;
            client.say(channel, messages.maxClear);
        },
        hydra: function(channel, username, message) {
            if(message.indexOf('░░') != -1) {
                client.timeout(channel, username, 600);
            }
        }
    };

    // Chat command to function router
    const router = {
        banme: function(arg1, arg2, arg3, arg4) { // TODO: Can I write this args better or just don't use them? :thinking-face:
            if(bot.allowedModules.banMe)
                biCommands.banme(arg1, arg2.username);
        },
        uptime: function(arg1, arg2, arg3, arg4) {
            if(bot.allowedModules.time)
                biCommands.time(arg1);
        },
        up: function(arg1, arg2, arg3, arg4) {
            if(bot.allowedModules.time)
                biCommands.time(arg1);
        },
        max: function(arg1, arg2, arg3, arg4) {
            if(bot.allowedModules.max)
                biCommands.max(arg1);
        },
        banoff: function(arg1, arg2, arg3, arg4) {
            if(bot.allowedModules.banMe) {
                if(arg2.mod)
                    biCommands.banmeState(false, channel);
            }
        },
        banon: function(arg1, arg2, arg3, arg4) {
            if(arg2.mod)
                biCommands.banmeState(true, channel);
        },
        clearmax: function(arg1, arg2, arg3, arg4) {
            if(arg2.mod)
                biCommands.clearMax(channel);
        }
    };

    client.connect();

    // Read all chat messages
    client.on("chat", function (channel, user, message, self) {

        // Hydra protection
        if(bot.allowedModules.hydra)
            biCommands.hydra(channel, user.username, message);

        // Is command?
        const cmdExpr = new RegExp('^![A-z]*', 'g');
        const cmdArr = message.match(cmdExpr);

        if(cmdArr !== null && typeof(router[cmdArr[0].replace('!', '').toLowerCase()]) == 'function') { // Command
            router[cmdArr[0].replace('!', '').toLowerCase()](channel, user, message);
        }

        // StrawPoll
        if(user.mod) {
            var spcmd = '!sp';
            if (message.substr(0, spcmd.length).toUpperCase() == spcmd.toUpperCase()) {
                var poll = message.replace(spcmd + ' ', '');
                poll = poll.split(';');

                if(poll.length > 2) {
                    var ans = [];

                    for (var i = 1; i < poll.length; i++) {
                        ans.push(poll[i]);
                    }

                    var newpoll = {
                        title: poll[0],
                        options: ans
                    };

                    request.post(
                        'https://strawpoll.me/api/v2/polls',
                        {
                            body: newpoll,
                            json: true,
                            followAllRedirects: true
                        },
                        function (error, response, body) {
                            if (!error && response.statusCode == 200) {
                                client.say(channel, 'http://strawpoll.me/' + body.id);
                            }
                        }
                    );
                }
            }
        }
    });

    setInterval(function() {
            https.get('https://api.twitch.tv/kraken/streams/' + bot.host, function(res) { // запрос к твичу без клиент ид, небезопасная херня TODO
                var body = '';

                res.on('data', function(chunk){
                    body += chunk;
                });

                res.on('end', function(){
                    var streamInfo = JSON.parse(body);

                    if (streamInfo.stream !== null) {
                        if(streamInfo.stream.viewers > stamps.max)
                            stamps.max = streamInfo.stream.viewers;
                    }

                    if (streamInfo.stream === null) {
                        stamps.created_at = null;
                    } else {
                        var now = new Date();
                        var then = streamInfo.stream.created_at;
                        var ms = moment(now).diff(moment(then));
                        var d = moment.duration(ms);
                        var s = Math.floor(d.asHours()) + moment.utc(ms).format(" ч. mm мин.");
                        stamps.created_at = s;
                    }
                });
            }).on('error', function(e){
                  console.log("Got an API error: ", e);
            });
    }, 120000);

    if(bot.vk.enable) {
        var getGroup = function() {
            https.get('https://api.vk.com/method/wall.get?owner_id=' + bot.vk.id + '&count=1' , function(res) {
                var body = '';

                res.on('data', function(chunk){
                    body += chunk;
                });

                res.on('end', function(){
                    var groupInfo = JSON.parse(body);

                    var postid = groupInfo.response[1].id;
                    var text = groupInfo.response[1].text.replace(/<(?:.|\n)*?>/gm, ''); // remove VK HTML tags

                    if(text.length > 256)
                       text = text.substring(0, 256) + '...';

                    if(stamps.vk == null)
                        stamps.vk = postid;
                    else {
                        if(parseInt(stamps.vk) < parseInt(postid)) {
                            client.say(bot.channels[0], messages.vk + text + ' ' + 'https://vk.com/' + bot.vk.name + '?w=wall' + bot.vk.id + '_' + postid);
                            stamps.vk = postid;
                        }
                    }
                });
            }).on('error', function(e){
                  console.log("Got an API error: ", e);
            });
        };

        setInterval(function() {
            getGroup(bot.vk.name);
        }, 60000);
    }
};

// Load configuration and messages
fs.readFile('./config.json', 'utf8', function (err, config) {
    if (err) {
        throw new Error("Couldn't find configuration");
        return false;
    }

    fs.readFile('./messages.json', 'utf8', function (err, messages) {
        if (err) {
            throw new Error("Couldn't find messages");
            return false;
        }

        config = JSON.parse(config);
        messages = JSON.parse(messages);
        chellbot(config, messages);
    });
});


text:
def createTraceabilityLink(el, target):
 	modelingSession.getModel().createDependency(el, target, "ModelerModule", "trace")

def isCreated(package,el):
	for database in package.getCompositionChildren() :
		for collection in database.getCompositionChildren():
			for element in collection.getCompositionChildren():
				dependencies = element.getDependsOnDependency()
				print dependencies
				if len(dependencies)>0 :
					for dependency in dependencies :
						if dependency.isStereotyped('ModelerModule','trace') :
							print dependency.getDependsOn() == el
							if dependency.getDependsOn() == el :
								return dependency.getImpacted()
	return None

business = selectedElements.get(0)
software = business.getOwner()
datamodel = modelingSession.getModel().createPackage('Business datamodel', software,'PersistentProfile','DataModel')
database = modelingSession.getModel().createPackage('Business database', datamodel,'MongoDBModeler','Database')
database.addStereotype('PersistentProfile','DataModel')
collection = modelingSession.getModel().createPackage('business collection', database,'MongoDBModeler','Collection')
collection.addStereotype('PersistentProfile','DataModel')

for child in business.getCompositionChildren() :
	if child.isStereotyped('PersistentProfile','Entity'):
		document = isCreated(datamodel,child)
		if  document == None :
			document = modelingSession.getModel().createClass(child.getName(), collection,  'MongoDBModeler', 'Document')
			document.addStereotype('PersistentProfile','Entity')
			createTraceabilityLink(document,child)
		for attribut in  child.getOwnedAttribute() :
			attribute = modelingSession.getModel().createAttribute(attribut.getName(),attribut.getType(),document)
			attribute.setMultiplicityMin(attribut.getMultiplicityMin())
			attribute.setMultiplicityMax(attribut.getMultiplicityMax())
			createTraceabilityLink(attribute, attribut)
			if attribut.isStereotyped('JuniperIDE','HorizontalPartitioning'):
				shardingKey = modelingSession.getModel().createClass('ShardingKey', collection,  'MongoDBModeler', 'ShardingKey')
				createTraceabilityLink(shardingKey, attribut)
				dependency = modelingSession.getModel().createDependency(shardingKey, attribute, 'MongoDBModeler','Sharding')
				createTraceabilityLink(dependency, attribut)
			#for dependency in attribut.getImpactedDependency() :
			#if dependency.getImpacted().isStereotyped('JuniperIDE','vertical partitionning') :

		for associationEnd in child.getOwnedEnd() :
			print associationEnd.getOppositeOwner().getOwner()
			doc = isCreated(datamodel,associationEnd.getOppositeOwner().getOwner())
			print doc
			if  doc != None :
				aggregation= associationEnd.getAggregation()
				endName=associationEnd.getName()
				multiplicityMin = associationEnd.getMultiplicityMin()
				multiplicityMax = associationEnd.getMultiplicityMax()
				association = modelingSession.getModel().createAssociation(document,doc,doc.getName())
				association.getEnd().get(1).setAggregation(aggregation)
				association.getEnd().get(1).setName(endName)
				association.getEnd().get(1).setMultiplicityMin(multiplicityMin)
				association.getEnd().get(1).setMultiplicityMax(multiplicityMax)

			else :
				doc = modelingSession.getModel().createClass(associationEnd.getOppositeOwner().getOwner().getName(), collection,  'MongoDBModeler', 'Document')
				doc.addStereotype('PersistentProfile','Entity')
				createTraceabilityLink(doc,associationEnd.getOppositeOwner().getOwner())
				aggregation = associationEnd.getAggregation()
				endName = associationEnd.getName()
				multiplicityMin = associationEnd.getMultiplicityMin()
				multiplicityMax = associationEnd.getMultiplicityMax()
				association = modelingSession.getModel().createAssociation(document,doc,doc.getName())
				association.getEnd().get(1).setAggregation(aggregation)
				association.getEnd().get(1).setName(endName)
				association.getEnd().get(1).setMultiplicityMin(multiplicityMin)
				association.getEnd().get(1).setMultiplicityMax(multiplicityMax)


text:
<?php
  require_once(dirname(__DIR__).'/classes/ShelfDB.class.php');

  $data = array_replace_recursive( array(
    "id" => null,
    "method" => null,
    "itemtype" => null, // "part"
    "type" => null, // "picture", "datasheet"
  ), $_GET, $_POST);

  if( !$data["id"] || !$data["method"] || !$data["itemtype"] || !$data["type"] )
    return;

  $formData['id'] = $data['id'];
  $formData['imageId'] = null;
  $formData['imageUrl'] = '/img/supplier/default.png';
  $formData['method'] = $data['method'];

?>

    <form id="uploadFileForm" data-ajax="false">
      <input type="hidden" name="imageFileName" id="imageFileName" value="">
      <input type="hidden" name="id" id="id" value="<?php echo $formData['id']; ?>">
      <input type="hidden" name="method" id="method" value="<?php echo $formData['method']; ?>">

              <img id="imgPreview" class="ui-center-element-relative" original-src="<?php echo $formData['imageUrl']; ?>" style="max-width:10em; max-height:10em" src="<?php echo htmlentities($formData['imageUrl']); ?>">

                <input id="file" name="file" type="file" value="">

<button id="popupOkBtn" name="popupOkBtn" class="ui-btn ui-corner-all ui-shadow ui-btn-a" buttonresult="ok" value="ok" type="submit" uilang="ok"></button>

    </form>


text:
package juego;

import java.awt.Canvas;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.font.FontRenderContext;
import java.awt.geom.Rectangle2D;
import java.io.IOException;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

import com.google.gson.Gson;

import cliente.Cliente;
import mensajeria.Comando;
import mensajeria.Paquete;
import mensajeria.PaqueteFinalizarBatalla;

public class Pantalla {

	private JFrame pantalla;
	private Canvas canvas;

	private final Gson gson = new Gson();

	public Pantalla(final String NOMBRE, final int ANCHO, final int ALTO, final Cliente cliente) {
		pantalla = new JFrame(NOMBRE);
		pantalla.setSize(ANCHO, ALTO);
		pantalla.setResizable(false);
		pantalla.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
		pantalla.addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent evt) {
				try {
					Paquete p = new Paquete();
					p.setComando(Comando.SALIR);
					p.setIp(cliente.getMiIp());
					cliente.getSalida().writeObject(gson.toJson(p));
					cliente.getEntrada().close();
					cliente.getSalida().close();
					System.exit(0);

				} catch (IOException e) {
					JOptionPane.showMessageDialog(null, "Fallo al intentar cerrar la aplicación.");
					System.exit(1);
					e.printStackTrace();
				}
			}
		});

		pantalla.setLocationRelativeTo(null);
		pantalla.setVisible(true);

		canvas = new Canvas();
		canvas.setPreferredSize(new Dimension(ANCHO, ALTO));
		canvas.setMaximumSize(new Dimension(ANCHO, ALTO));
		canvas.setMinimumSize(new Dimension(ANCHO, ALTO));
		canvas.setFocusable(false);

		pantalla.add(canvas);
		pantalla.pack();
	}

	public Canvas getCanvas() {
		return canvas;
	}

	public JFrame getFrame() {
		return pantalla;
	}

	public static void centerString(Graphics g, Rectangle r, String s) {
	    FontRenderContext frc = new FontRenderContext(null, true, true);

	    Rectangle2D r2D = g.getFont().getStringBounds(s, frc);
	    int rWidth = (int) Math.round(r2D.getWidth());
	    int rHeight = (int) Math.round(r2D.getHeight());
	    int rX = (int) Math.round(r2D.getX());
	    int rY = (int) Math.round(r2D.getY());

	    int a = (r.width / 2) - (rWidth / 2) - rX;
	    int b = (r.height / 2) - (rHeight / 2) - rY;

	    g.drawString(s, r.x + a, r.y + b);
	}

}


text:
package com.laaidback.ascribe.notification;

import android.app.AlarmManager;
import android.app.Notification;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.media.RingtoneManager;
import android.support.v4.app.NotificationCompat;

import com.laaidback.ascribe.R;
import com.laaidback.ascribe.main.MainActivity;

import javax.inject.Inject;

import static android.content.Context.ALARM_SERVICE;

public class NotificationScheduler {

    private static final String INTENT_EXTRA_DATE_NOTE_CREATED = "INTENT_EXTRA_DATE_NOTE_CREATED";
    private static final String INTENT_EXTRA_REMINDER_DATE = "INTENT_EXTRA_REMINDER_DATE";
    private static final String NOTIFICATION_ID = "NOTIFICATION_ID";
    private static final String NOTIFICATION = "NOTIFICATION";
    private static final int PENDING_INTENT_REQUEST_CODE = 1;

    private Context context;

    @Inject
    public NotificationScheduler(Context context) {
        this.context = context;
    }

    public void schedule(long dateNoteCreated, long reminderDate) {
        Notification notification = createNotification(dateNoteCreated);
        Intent notificationIntent = new Intent(context, NotificationPublisher.class)
                .putExtra(NOTIFICATION_ID, dateNoteCreated)
                .putExtra(NOTIFICATION, notification)
                .putExtra(INTENT_EXTRA_REMINDER_DATE, reminderDate);
        PendingIntent pendingIntent = PendingIntent.getBroadcast(context,
                PENDING_INTENT_REQUEST_CODE, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
        AlarmManager alarmManager = (AlarmManager) context.getSystemService(ALARM_SERVICE);
        alarmManager.set(AlarmManager.RTC_WAKEUP, reminderDate, pendingIntent);
    }

    private Notification createNotification(long dateNoteCreated) {
        Intent intent = new Intent(context, MainActivity.class)
                .putExtra(INTENT_EXTRA_DATE_NOTE_CREATED, dateNoteCreated)
                .setAction(Long.toString(System.currentTimeMillis()));

        return new NotificationCompat.Builder(context)
                .setContentTitle(context.getString(R.string.reminding))
                .setContentText(context.getString(R.string.tap_to_see))
                .setContentIntent(PendingIntent.getActivity(context, 0, intent, 0))
                .setAutoCancel(true)
                .setSmallIcon(R.drawable.ic_notifications_white_48dp)
                .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
                .build();
    }

}


text:
package irc // import "eriol.xyz/perpetua/irc"

import (
	"crypto/tls"
	"fmt"
	"log"
	"regexp"
	"strings"

	"github.com/thoj/go-ircevent"

	"eriol.xyz/perpetua/config"
	"eriol.xyz/perpetua/db"
)

const version = "perpetua quote bot " + config.Version

var (
	conf  *config.Config
	store *db.Store
)

// Localizated quote and about tokens used to detect the kind of query for
// the bot.
var i18n = map[string]map[string][]string{
	"en": map[string][]string{
		"quote": []string{"quote", "what does it say"},
		"about": []string{"about"},
	},
	"it": map[string][]string{
		"quote": []string{
			"cita",
			"che dice",
			"cosa dice",
			"che cosa dice"},
		"about": []string{
			"su",
			"sul",
			"sulla",
			"sullo",
			"sui",
			"sugli",
			"sulle"},
	},
}

// Join keys from i18n using "|": used inside the regex to perform an
// OR of all keys.
// If both lang and key are empty strings an empty string is returned.
func i18nKeyJoin(lang, key string) string {
	if lang == "" && key == "" {
		return ""
	}
	return strings.Join(i18n[lang][key], "|")
}

func connect() (connection *irc.Connection, err error) {
	connection = irc.IRC(conf.IRC.Nickname, conf.IRC.User)
	connection.Version = version
	connection.UseTLS = conf.Server.UseTLS
	if conf.Server.SkipVerify == true {
		connection.TLSConfig = &tls.Config{InsecureSkipVerify: true}
	}

	if err := connection.Connect(fmt.Sprintf("%s:%d",
		conf.Server.Hostname,
		conf.Server.Port)); err != nil {
		return nil, err
	}

	return connection, nil
}

func doWelcome(event *irc.Event) {
	for _, channel := range conf.IRC.Channels {
		event.Connection.Join(channel)
		event.Connection.Log.Println("Joined to " + channel)
	}
}

func doJoin(event *irc.Event) {
	channel := event.Arguments[0]

	if event.Nick == conf.IRC.Nickname {
		event.Connection.Privmsg(channel, "Hello! I'm "+version)
	} else {
		event.Connection.Privmsg(channel,
			fmt.Sprintf("Hello %s! I'm %s. Do you want a quote?",
				event.Nick,
				version))
	}
}

func doPrivmsg(event *irc.Event) {
	channel := event.Arguments[0]
	var quote string

	// Don't speak in private!
	if channel == conf.IRC.Nickname {
		return
	}
	command, person, extra, argument := parseMessage(event.Message(),
		conf.I18N.Lang,
		conf.IRC.Nickname)

	if command != "" && person != "" {

		quote = store.GetQuote(person, channel)

		if extra != "" && argument != "" {
			quote = store.GetQuoteAbout(person, argument, channel)
		}

		event.Connection.Privmsg(channel, quote)
	}
}

func parseMessage(message, lang, nickname string) (command, person, extra, argument string) {
	var names []string

	reArgument := regexp.MustCompile(nickname +
		`:?` +
		`\s+` +
		`(?P<command>` + i18nKeyJoin(lang, "quote") + `)` +
		`\s+` +
		`(?P<person>[\w\s-'\p{Latin}]+)` +
		`(?:\s+)` +
		`(?P<extra>` + i18nKeyJoin(lang, "about") + `)` +
		`(?:\s+)` +
		`(?P<argument>[\w\s-'\p{Latin}]+)`)

	re := regexp.MustCompile(nickname +
		`:?` +
		`\s+` +
		`(?P<command>` + i18nKeyJoin(lang, "quote") + `)` +
		`\s+` +
		`(?P<person>[\w\s-'\p{Latin}]+)`)

	res := reArgument.FindStringSubmatch(message)

	if res == nil {
		res = re.FindStringSubmatch(message)
		names = re.SubexpNames()
	} else {
		names = reArgument.SubexpNames()
	}

	m := map[string]string{}
	for i, n := range res {
		m[names[i]] = n
	}

	return m["command"], m["person"], m["extra"], m["argument"]
}

func NewClient(c *config.Config, db *db.Store, ircChan chan *irc.Connection, done chan bool) {
	conf = c
	store = db

	connection, err := connect()
	if err != nil {
		log.Fatal(err)
	}

	ircChan <- connection

	connection.AddCallback("001", doWelcome)
	connection.AddCallback("JOIN", doJoin)
	connection.AddCallback("PRIVMSG", doPrivmsg)

	connection.Loop()

	done <- true
}


text:
package org.apache.avalon.fortress.tools;

import junit.framework.TestCase;

public class FortressBeanTestCase extends TestCase {

    private FortressBean bean;

    public FortressBeanTestCase(String name) {
        super(name);
    }

    /**
     * @see junit.framework.TestCase#setUp()
     */
    protected void setUp() throws Exception {
        this.bean = new FortressBean();
        this.bean.setRoleManagerConfiguration("resource://org/apache/avalon/fortress/tools/FortressBeanTestCase.roles");
        this.bean.setContainerConfiguration("resource://org/apache/avalon/fortress/tools/FortressBeanTestCase.xconf");
        this.bean.setLoggerManagerConfiguration("resource://org/apache/avalon/fortress/tools/FortressBeanTestCase.xlog");
        this.bean.setLookupComponentRole(TestInterface.ROLE);
        this.bean.setInvokeMethod("run");
        this.bean.setSystemExitOnDispose(false);
        this.bean.initialize();
        this.bean.run();
    }

    protected void tearDown() throws Exception {
        this.bean.dispose();
    }

    public void test() throws Exception {
        TestInterface ti = (TestInterface) this.bean.getServiceManager().lookup(TestInterface.ROLE);
        assertNotNull(ti);
        assertTrue(ti.isRunning());
    }

}


text:
junit-quickcheck is a library that supports writing and running property-based
tests in [JUnit](http://junit.org), inspired by
[QuickCheck](http://www.cse.chalmers.se/~rjmh/QuickCheck/manual.html) for
[Haskell](http://haskell.org).

junit-quickcheck is source/target-compatible with JDK 8.

## Basic example

```java
    import com.pholser.junit.quickcheck.Property;
    import com.pholser.junit.quickcheck.runner.JUnitQuickcheck;
    import org.junit.runner.RunWith;

    import static org.junit.Assert.*;

    @RunWith(JUnitQuickcheck.class)
    public class StringProperties {
        @Property public void concatenationLength(String s1, String s2) {
            assertEquals(s1.length() + s2.length(), (s1 + s2).length());
        }
    }
```


text:
$Members = import-csv GroupMembersFromCutover.csv
$Groups = $Members | group-object -property listEmail

$Counts = @()

foreach ($Group in $Groups) {
    $Counts += [PSCustomObject]@{
        email = $Group.Name
        MemberCount = $Group.count
    }

    Write-Host "$($Group.Name): $($Group.count)"
}

$Counts | Export-Csv CutoverGroupMemberCounts.csv -NoTypeInformation


text:
$(document).on(' turbolinks:load', (function () {
	$('.appendable').each(function(){$(this).appendTo('#pusher');});

	$
        $('#nav-btn').on('click', function () {
            $('#leftnav').sidebar('toggle');
        })

        // when goto > 631px hide the mobile sidebar
        var mq = window.matchMedia('all and (min-width: 631px)');
        mq.addListener(function (changed) {
            if (changed.matches) {               // if the width of browser is more then 631px...
                $('#leftnav').sidebar('hide');    //have to call hide because setting css of display: isn't enough
           }
        });
    }
))
;


text:
package us.nineworlds.serenity.injection;

import javax.inject.Qualifier;

@Qualifier public @interface ServerClientPreference {

}


text:
package com.kryptnostic.api.v1.security.loaders.rsa;

import java.security.KeyPair;
import java.security.NoSuchAlgorithmException;

import com.kryptnostic.kodex.v1.crypto.keys.Keys;
import com.kryptnostic.kodex.v1.exceptions.types.KodexException;

public final class FreshRsaKeyLoader extends RsaKeyLoader {
    @Override
    protected KeyPair tryLoading() throws KodexException {
        KeyPair keyPair;
        try {
            keyPair = Keys.generateRsaKeyPair( KEY_SIZE );

            return keyPair;
        } catch ( NoSuchAlgorithmException e ) {
            throw new KodexException( e );
        }
    }
}