text:
 #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
#endif

#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
 #import <Protobuf/GPBProtocolBuffers_RuntimeSupport.h>
#else
 #import "GPBProtocolBuffers_RuntimeSupport.h"
#endif

 #import "PogoprotosNetworkingRequests.pbobjc.h"
// @@protoc_insertion_point(imports)

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"

#pragma mark - PogoprotosNetworkingRequestsRoot

@implementation PogoprotosNetworkingRequestsRoot

// No extensions in the file and no imports, so no need to generate
// +extensionRegistry.

@end

#pragma mark - PogoprotosNetworkingRequestsRoot_FileDescriptor

static GPBFileDescriptor *PogoprotosNetworkingRequestsRoot_FileDescriptor(void) {
  // This is called by +initialize so there is no need to worry
  // about thread safety of the singleton.
  static GPBFileDescriptor *descriptor = NULL;
  if (!descriptor) {
    GPB_DEBUG_CHECK_RUNTIME_VERSIONS();
    descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"POGOProtos.Networking.Requests"
                                                     syntax:GPBFileSyntaxProto3];
  }
  return descriptor;
}

#pragma mark - Enum RequestType

GPBEnumDescriptor *RequestType_EnumDescriptor(void) {
  static GPBEnumDescriptor *descriptor = NULL;
  if (!descriptor) {
    static const char *valueNames =
        "MethodUnset\000GetPlayer\000GetInventory\000Downl"
        "oadSettings\000DownloadItemTemplates\000Downlo"
        "adRemoteConfigVersion\000RegisterBackground"
        "Device\000FortSearch\000Encounter\000CatchPokemon"
        "\000FortDetails\000GetMapObjects\000FortDeployPok"
        "emon\000FortRecallPokemon\000ReleasePokemon\000Us"
        "eItemPotion\000UseItemCapture\000UseItemFlee\000U"
        "seItemRevive\000GetPlayerProfile\000EvolvePoke"
        "mon\000GetHatchedEggs\000EncounterTutorialComp"
        "lete\000LevelUpRewards\000CheckAwardedBadges\000U"
        "seItemGym\000GetGymDetails\000StartGymBattle\000A"
        "ttackGym\000RecycleInventoryItem\000CollectDai"
        "lyBonus\000UseItemXpBoost\000UseItemEggIncubat"
        "or\000UseIncense\000GetIncensePokemon\000IncenseE"
        "ncounter\000AddFortModifier\000DiskEncounter\000C"
        "ollectDailyDefenderBonus\000UpgradePokemon\000"
        "SetFavoritePokemon\000NicknamePokemon\000Equip"
        "Badge\000SetContactSettings\000SetBuddyPokemon"
        "\000GetBuddyWalked\000UseItemEncounter\000GymDepl"
        "oy\000GymGetInfo\000GymStartSession\000GymBattleA"
        "ttack\000JoinLobby\000LeaveLobby\000SetLobbyVisib"
        "ility\000SetLobbyPokemon\000GetRaidDetails\000Gym"
        "FeedPokemon\000StartRaidBattle\000AttackRaid\000G"
        "etAssetDigest\000GetDownloadUrls\000ClaimCoden"
        "ame\000SetAvatar\000SetPlayerTeam\000MarkTutorial"
        "Complete\000CheckChallenge\000VerifyChallenge\000"
        "Echo\000SfidaRegistration\000SfidaActionLog\000Sf"
        "idaCertification\000SfidaUpdate\000SfidaAction"
        "\000SfidaDowser\000SfidaCapture\000ListAvatarCust"
        "omizations\000SetAvatarItemAsViewed\000GetInbo"
        "x\000ListGymBadges\000GetGymBadgeDetails\000UseIt"
        "emMoveReroll\000UseItemRareCandy\000RegisterPu"
        "shNotification\000UnregisterPushNotificatio"
        "n\000UpdateNotificationStatus\000OptOutPushNot"
        "ificationCategory\000";
    static const int32_t values[] = {
        RequestType_MethodUnset,
        RequestType_GetPlayer,
        RequestType_GetInventory,
        RequestType_DownloadSettings,
        RequestType_DownloadItemTemplates,
        RequestType_DownloadRemoteConfigVersion,
        RequestType_RegisterBackgroundDevice,
        RequestType_FortSearch,
        RequestType_Encounter,
        RequestType_CatchPokemon,
        RequestType_FortDetails,
        RequestType_GetMapObjects,
        RequestType_FortDeployPokemon,
        RequestType_FortRecallPokemon,
        RequestType_ReleasePokemon,
        RequestType_UseItemPotion,
        RequestType_UseItemCapture,
        RequestType_UseItemFlee,
        RequestType_UseItemRevive,
        RequestType_GetPlayerProfile,
        RequestType_EvolvePokemon,
        RequestType_GetHatchedEggs,
        RequestType_EncounterTutorialComplete,
        RequestType_LevelUpRewards,
        RequestType_CheckAwardedBadges,
        RequestType_UseItemGym,
        RequestType_GetGymDetails,
        RequestType_StartGymBattle,
        RequestType_AttackGym,
        RequestType_RecycleInventoryItem,
        RequestType_CollectDailyBonus,
        RequestType_UseItemXpBoost,
        RequestType_UseItemEggIncubator,
        RequestType_UseIncense,
        RequestType_GetIncensePokemon,
        RequestType_IncenseEncounter,
        RequestType_AddFortModifier,
        RequestType_DiskEncounter,
        RequestType_CollectDailyDefenderBonus,
        RequestType_UpgradePokemon,
        RequestType_SetFavoritePokemon,
        RequestType_NicknamePokemon,
        RequestType_EquipBadge,
        RequestType_SetContactSettings,
        RequestType_SetBuddyPokemon,
        RequestType_GetBuddyWalked,
        RequestType_UseItemEncounter,
        RequestType_GymDeploy,
        RequestType_GymGetInfo,
        RequestType_GymStartSession,
        RequestType_GymBattleAttack,
        RequestType_JoinLobby,
        RequestType_LeaveLobby,
        RequestType_SetLobbyVisibility,
        RequestType_SetLobbyPokemon,
        RequestType_GetRaidDetails,
        RequestType_GymFeedPokemon,
        RequestType_StartRaidBattle,
        RequestType_AttackRaid,
        RequestType_GetAssetDigest,
        RequestType_GetDownloadUrls,
        RequestType_ClaimCodename,
        RequestType_SetAvatar,
        RequestType_SetPlayerTeam,
        RequestType_MarkTutorialComplete,
        RequestType_CheckChallenge,
        RequestType_VerifyChallenge,
        RequestType_Echo,
        RequestType_SfidaRegistration,
        RequestType_SfidaActionLog,
        RequestType_SfidaCertification,
        RequestType_SfidaUpdate,
        RequestType_SfidaAction,
        RequestType_SfidaDowser,
        RequestType_SfidaCapture,
        RequestType_ListAvatarCustomizations,
        RequestType_SetAvatarItemAsViewed,
        RequestType_GetInbox,
        RequestType_ListGymBadges,
        RequestType_GetGymBadgeDetails,
        RequestType_UseItemMoveReroll,
        RequestType_UseItemRareCandy,
        RequestType_RegisterPushNotification,
        RequestType_UnregisterPushNotification,
        RequestType_UpdateNotificationStatus,
        RequestType_OptOutPushNotificationCategory,
    };
    GPBEnumDescriptor *worker =
        [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(RequestType)
                                       valueNames:valueNames
                                           values:values
                                            count:(uint32_t)(sizeof(values) / sizeof(int32_t))
                                     enumVerifier:RequestType_IsValidValue];
    if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) {
      [worker release];
    }
  }
  return descriptor;
}

BOOL RequestType_IsValidValue(int32_t value__) {
  switch (value__) {
    case RequestType_MethodUnset:
    case RequestType_GetPlayer:
    case RequestType_GetInventory:
    case RequestType_DownloadSettings:
    case RequestType_DownloadItemTemplates:
    case RequestType_DownloadRemoteConfigVersion:
    case RequestType_RegisterBackgroundDevice:
    case RequestType_FortSearch:
    case RequestType_Encounter:
    case RequestType_CatchPokemon:
    case RequestType_FortDetails:
    case RequestType_GetMapObjects:
    case RequestType_FortDeployPokemon:
    case RequestType_FortRecallPokemon:
    case RequestType_ReleasePokemon:
    case RequestType_UseItemPotion:
    case RequestType_UseItemCapture:
    case RequestType_UseItemFlee:
    case RequestType_UseItemRevive:
    case RequestType_GetPlayerProfile:
    case RequestType_EvolvePokemon:
    case RequestType_GetHatchedEggs:
    case RequestType_EncounterTutorialComplete:
    case RequestType_LevelUpRewards:
    case RequestType_CheckAwardedBadges:
    case RequestType_UseItemGym:
    case RequestType_GetGymDetails:
    case RequestType_StartGymBattle:
    case RequestType_AttackGym:
    case RequestType_RecycleInventoryItem:
    case RequestType_CollectDailyBonus:
    case RequestType_UseItemXpBoost:
    case RequestType_UseItemEggIncubator:
    case RequestType_UseIncense:
    case RequestType_GetIncensePokemon:
    case RequestType_IncenseEncounter:
    case RequestType_AddFortModifier:
    case RequestType_DiskEncounter:
    case RequestType_CollectDailyDefenderBonus:
    case RequestType_UpgradePokemon:
    case RequestType_SetFavoritePokemon:
    case RequestType_NicknamePokemon:
    case RequestType_EquipBadge:
    case RequestType_SetContactSettings:
    case RequestType_SetBuddyPokemon:
    case RequestType_GetBuddyWalked:
    case RequestType_UseItemEncounter:
    case RequestType_GymDeploy:
    case RequestType_GymGetInfo:
    case RequestType_GymStartSession:
    case RequestType_GymBattleAttack:
    case RequestType_JoinLobby:
    case RequestType_LeaveLobby:
    case RequestType_SetLobbyVisibility:
    case RequestType_SetLobbyPokemon:
    case RequestType_GetRaidDetails:
    case RequestType_GymFeedPokemon:
    case RequestType_StartRaidBattle:
    case RequestType_AttackRaid:
    case RequestType_GetAssetDigest:
    case RequestType_GetDownloadUrls:
    case RequestType_ClaimCodename:
    case RequestType_SetAvatar:
    case RequestType_SetPlayerTeam:
    case RequestType_MarkTutorialComplete:
    case RequestType_CheckChallenge:
    case RequestType_VerifyChallenge:
    case RequestType_Echo:
    case RequestType_SfidaRegistration:
    case RequestType_SfidaActionLog:
    case RequestType_SfidaCertification:
    case RequestType_SfidaUpdate:
    case RequestType_SfidaAction:
    case RequestType_SfidaDowser:
    case RequestType_SfidaCapture:
    case RequestType_ListAvatarCustomizations:
    case RequestType_SetAvatarItemAsViewed:
    case RequestType_GetInbox:
    case RequestType_ListGymBadges:
    case RequestType_GetGymBadgeDetails:
    case RequestType_UseItemMoveReroll:
    case RequestType_UseItemRareCandy:
    case RequestType_RegisterPushNotification:
    case RequestType_UnregisterPushNotification:
    case RequestType_UpdateNotificationStatus:
    case RequestType_OptOutPushNotificationCategory:
      return YES;
    default:
      return NO;
  }
}

#pragma mark - Request

@implementation Request

@dynamic requestType;
@dynamic requestMessage;

typedef struct Request__storage_ {
  uint32_t _has_storage_[1];
  RequestType requestType;
  NSData *requestMessage;
} Request__storage_;

// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+ (GPBDescriptor *)descriptor {
  static GPBDescriptor *descriptor = nil;
  if (!descriptor) {
    static GPBMessageFieldDescription fields[] = {
      {
        .name = "requestType",
        .dataTypeSpecific.enumDescFunc = RequestType_EnumDescriptor,
        .number = Request_FieldNumber_RequestType,
        .hasIndex = 0,
        .offset = (uint32_t)offsetof(Request__storage_, requestType),
        .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor),
        .dataType = GPBDataTypeEnum,
      },
      {
        .name = "requestMessage",
        .dataTypeSpecific.className = NULL,
        .number = Request_FieldNumber_RequestMessage,
        .hasIndex = 1,
        .offset = (uint32_t)offsetof(Request__storage_, requestMessage),
        .flags = GPBFieldOptional,
        .dataType = GPBDataTypeBytes,
      },
    };
    GPBDescriptor *localDescriptor =
        [GPBDescriptor allocDescriptorForClass:[Request class]
                                     rootClass:[PogoprotosNetworkingRequestsRoot class]
                                          file:PogoprotosNetworkingRequestsRoot_FileDescriptor()
                                        fields:fields
                                    fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
                                   storageSize:sizeof(Request__storage_)
                                         flags:GPBDescriptorInitializationFlag_None];
    NSAssert(descriptor == nil, @"Startup recursed!");
    descriptor = localDescriptor;
  }
  return descriptor;
}

@end

int32_t Request_RequestType_RawValue(Request *message) {
  GPBDescriptor *descriptor = [Request descriptor];
  GPBFieldDescriptor *field = [descriptor fieldWithNumber:Request_FieldNumber_RequestType];
  return GPBGetMessageInt32Field(message, field);
}

void SetRequest_RequestType_RawValue(Request *message, int32_t value) {
  GPBDescriptor *descriptor = [Request descriptor];
  GPBFieldDescriptor *field = [descriptor fieldWithNumber:Request_FieldNumber_RequestType];
  GPBSetInt32IvarWithFieldInternal(message, field, value, descriptor.file.syntax);
}

#pragma clang diagnostic pop

// @@protoc_insertion_point(global_scope)


text:
using System;
using System.Collections.Generic;

namespace CotcSdk {

	/// @ingroup main_classes
	/// Represents a paginated list, which allows for easy navigation through multiple results.
	public class PagedList<DataType> : List<DataType> {
		/// Fetches the next results and calls the same handler again.
		public Promise<PagedList<DataType>> FetchNext() {
			return Next();
		}
		/// Fetches the previous results and calls the same handler again.
		public Promise<PagedList<DataType>> FetchPrevious() {
			return Previous();
		}
		///
		/// <returns>Whether there is a previous page. Call FetchPrevious to go back to it.</returns>
		public bool HasPrevious {
			get { return Previous != null; }
		}
		///
		/// <returns>Whether there is a next page. Call FetchNext to go back to it.</returns>
		public bool HasNext {
			get { return Next != null; }
		}
		public Bundle ServerData { get; private set; }
        public int MaxPage;

		public override string ToString() {
			return ServerData.ToString();
		}

        internal PagedList(Bundle serverData, int maxPage)
        {
            ServerData = serverData;
            MaxPage = maxPage;
        }
        internal PagedList(Bundle serverData, int currentOffset, int totalResults)
        {
            ServerData = serverData;
            Offset = currentOffset;
            Total = totalResults;
        }

        internal Func<Promise<PagedList<DataType>>> Next, Previous;

        ///
        /// <returns>The number of the first result in the list.</returns>
        public int Offset;
        ///
        /// <returns>The total number of items (possibly greater than the page size).</returns>
        public int Total;
    }
}

redpajama_set_name: RedPajamaGithub


text:
function nderiv = getnderiv(Lfdobj)
%  GETNDERIV   Extracts the order of the operator from LFDOBJ.

%  last modified 2 January 2003

if ~isa_Lfd(Lfdobj)
    error('Argument is not a linear differential operator object');
end

nderiv = Lfdobj.nderiv;


text:
category: Blog
tag: Open Source
comments: true
date: 2013-06-25 20:30:58
layout: post
slug: capture-v4l2
title: Capture images using V4L2 on Linux
keywords: [opencv tutorial, linux v4l2 issue, opencv webcam not working, opencv v4l2, install v4l2 ubuntu]
---

I have always been using OpenCV's `VideoCapture` API to capture images from webcam or USB cameras. OpenCV supports `V4L2` and I wanted to use something other than OpenCV's VideoCapture API so I started digging up about v4l2 and got few links using and few examples using which I successfully wrote a small code to grab an image using **V4L2** and convert it to OpenCV's Mat structure and display the image.

### What is V4L2?
V4L2 is the second version of Video For Linux which is a video capturing API for Linux. [Here](http://linuxtv.org/downloads/v4l-dvb-apis/) you can find amazing documentation about the API. So it gives you a very easy inteface to use it with C, C++ and Python. I haven't tried Python bindings yet.

### How To Use V4L2 API?
I started reading documentation but didn't really understand much until I found [this example](https://gist.github.com/Circuitsoft/1126411). The code had some issues and wasn't working properly. But I just copied it and tried understanding it. So this is my understanding of the code.

#### Step 1: Open the Capture Device.
In Linux, default capture devide is generally `/dev/video0`, but if you're using USB webcams, the index will vary accordingly.
{% highlight c %}
int fd;
fd = open("/dev/video0", O_RDWR);
if (fd == -1)
{
    // couldn't find capture device
    perror("Opening Video device");
    return 1;
}
{% endhighlight %}

#### Step 2: Query the Capture
So, basically you check if the capture is available or not. V4L2 doesn't support some cameras so it would throw an error here. We need to use `v4l2_capability` structure and `VIDIOC_QUERYCAP` to query the capture. Read More [here](http://linuxtv.org/downloads/v4l-dvb-apis/vidioc-querycap.html#v4l2-capability).

{% highlight c %}
struct v4l2_capability caps = {0};
if (-1 == xioctl(fd, VIDIOC_QUERYCAP, &caps))
{
    perror("Querying Capabilites");
    return 1;
}
{% endhighlight %}

Here `xioctl` is a wrapper function over `ioctl`. **ioctl()** is a function to manipulate device parameters of special files. Read more [here](http://man7.org/linux/man-pages/man2/ioctl.2.html).

{% highlight c %}
#include <sys/ioctl.h>

static int xioctl(int fd, int request, void *arg)
{
    int r;
        do r = ioctl (fd, request, arg);
        while (-1 == r && EINTR == errno);
        return r;
}
{% endhighlight %}

---------------

### Similar articles
{% include recommended_card.html url="/blog/kinect-opencv" title="Kinect with OpenCV" description="Setup the Kinect to work with OpenCV seamlessly. Use SimpleCV to see the depth map with Kinect." %}

{% include recommended_card.html url="/blog/opencv-android-image" title="How to use Android camera with OpenCV" description="OpenCV for Android is very helpful. This article talks about how to use the Android camera SDK and bridge it with OpenCV so that you can retrieve and process the frames." %}
--------------

#### Step 3: Image Format
V4L2 provides an easy interface to check the image formats and colorspace that your webcam supports and provide. `v4l2_format` sturcture is to be used to change image format.

{% highlight c %}
struct v4l2_format fmt = {0};
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
fmt.fmt.pix.width = 320;
fmt.fmt.pix.height = 240;
fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_MJPEG;
fmt.fmt.pix.field = V4L2_FIELD_NONE;

if (-1 == xioctl(fd, VIDIOC_S_FMT, &fmt))
{
    perror("Setting Pixel Format");
    return 1;
}
{% endhighlight %}

I have set image width and height to be 320 and 240 respectively. You should check out the format that your camera supports. My Camera supports MJPEG and YUV and hence I have set image format to MJPEG.

#### Step 4: Request Buffers
A buffer contains data exchanged by application and driver using Streaming I/O methods. `v4l2_requestbuffers` is used to allocate device buffers. Read more [here](http://linuxtv.org/downloads/v4l-dvb-apis/vidioc-reqbufs.html#v4l2-requestbuffers).

{% highlight c %}
struct v4l2_requestbuffers req = {0};
req.count = 1;
req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
req.memory = V4L2_MEMORY_MMAP;

if (-1 == xioctl(fd, VIDIOC_REQBUFS, &req))
{
    perror("Requesting Buffer");
    return 1;
}
{% endhighlight %}

The ioctl is used to initialize `memory mapped`(mmap), user pointer based I/O.

#### Step 5: Query Buffer
After requesting buffer from the device, we need to query the buffer in order to get raw data. Read more [here](http://linuxtv.org/downloads/v4l-dvb-apis/vidioc-querybuf.html)

{% highlight c %}
struct v4l2_buffer buf = {0};
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = V4L2_MEMORY_MMAP;
buf.index = bufferindex;
if(-1 == xioctl(fd, VIDIOC_QUERYBUF, &buf))
{
    perror("Querying Buffer");
    return 1;
}

buffer = mmap (NULL, buf.length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, buf.m.offset);
{% endhighlight %}

The **mmap()** function asks to map length bytes starting at offset in the memory of the device specified by fd into the application address space, preferably at address start. Read more [here](http://linuxtv.org/downloads/v4l-dvb-apis/func-mmap.html)

#### Step 6: Capture Image

After querying the buffer, the only thing left is capturing the frame and saving it in the buffer.

{% highlight c %}
if(-1 == xioctl(fd, VIDIOC_STREAMON, &buf.type))
{
    perror("Start Capture");
    return 1;
}

fd_set fds;
FD_ZERO(&fds);
FD_SET(fd, &fds);
struct timeval tv = {0};
tv.tv_sec = 2;
int r = select(fd+1, &fds, NULL, NULL, &tv);
if(-1 == r)
{
    perror("Waiting for Frame");
    return 1;
}

if(-1 == xioctl(fd, VIDIOC_DQBUF, &buf))
{
    perror("Retrieving Frame");
    return 1;
}
{% endhighlight %}

#### Step 7: Store data in OpenCV datatype

I wanted to stored the retrieved data in OpenCV image structure. It took me few hours to figure out the perfect way. So here's how I did it.

{% highlight c %}
CvMat cvmat = cvMat(480, 640, CV_8UC3, (void*)buffer);
IplImage * img;
img = cvDecodeImage(&cvmat, 1);
{% endhighlight %}

So this how I captured frames from my webcam and stored in OpenCV Image data structure.

You can find the complete code [here on my GitHub](https://gist.github.com/jayrambhia/5866483)

P.S. Coding period for gsoc has started and I have to start working.


text:
require "test_helper"

class SchedulerTest < Minitest::Test
  include ReddFactories

  def test_sends_posts_to_slack
    slack_client = Minitest::Mock.new
    2.times { slack_client.expect(:post, true, [Clients::Slack::Message]) }
    posts = [build_post, build_post]

    reddit_query_object = Clients::Reddit::NewPostsQuery.new
    object = build_object(slack_client, reddit_query_object)
    r
    reddit_query_object.stub :between, posts do
      object.call(0)
    end

    slack_client.verify
  end

  private

  def build_object(slack_client, reddit_query_object)
    RedditToSlack.new(
      slack_client: slack_client,
      reddit_query_object: reddit_query_object
    )
  end

  def build_post
    Clients::Reddit::Post.new(build_redd_submission)
  end
end


text:
<?xml version="1.0" ?>
<INPUT>

	<MEDALS>
		<MEDAL Id="1" MEDAL_THRESHOLD="45000" TYPE="Gold"/>
		<MEDAL Id="2" MEDAL_THRESHOLD="69000" TYPE="Silver"/>
		<MEDAL Id="3" MEDAL_THRESHOLD="89000" TYPE="Bronze"/>

	</MEDALS>

	<SpeedSettings Default="18" Max="150" Min="0"/>

	<PenaltySettings SpeedLost="0.1" TimeLost="15"/>

	<PROBLEM_SET>
		<PROBLEM_SUBSET>
			<TARGET TYPE="Fraction">
				<ContentSettings denominator="2" numerator="1"/>
			</TARGET>
			<QUESTION INDEX="1">
				<Content TYPE="String">
					<ContentSettings string="0"/>
				</Content>
				<Content TYPE="String">
					<ContentSettings string="1.5"/>
				</Content>
				<Answer VALUE="1"/>
			</QUESTION>
			<QUESTION INDEX="2">
				<Content TYPE="String">
					<ContentSettings string="0"/>
				</Content>
				<Content TYPE="String">
					<ContentSettings string="1.5"/>
				</Content>
				<Answer VALUE="1"/>
			</QUESTION>
			<QUESTION INDEX="3">
				<Content TYPE="String">
					<ContentSettings string="1"/>
				</Content>
				<Content TYPE="String">
					<ContentSettings string="1.5"/>
				</Content>
				<Answer VALUE="0"/>
			</QUESTION>
		</PROBLEM_SUBSET>
		<PROBLEM_SUBSET>
			<TARGET TYPE="Fraction">
				<ContentSettings denominator="1000" numerator="927"/>
			</TARGET>
			<QUESTION INDEX="4">
				<Content TYPE="String">
					<ContentSettings string="0.919"/>
				</Content>
				<Content TYPE="String">
					<ContentSettings string="0.936"/>
				</Content>
				<Answer VALUE="1"/>
			</QUESTION>
			<QUESTION INDEX="5">
				<Content TYPE="String">
					<ContentSettings string="0.971"/>
				</Content>
				<Content TYPE="String">
					<ContentSettings string="0.977"/>
				</Content>
				<Answer VALUE="0"/>
			</QUESTION>
			<QUESTION INDEX="6">
				<Content TYPE="String">
					<ContentSettings string="0.999"/>
				</Content>
				<Content TYPE="String">
					<ContentSettings string="1"/>
				</Content>
				<Answer VALUE="0"/>
			</QUESTION>
		</PROBLEM_SUBSET>
		<PROBLEM_SUBSET>
			<TARGET TYPE="Fraction">
				<ContentSettings denominator="8" numerator="7"/>
			</TARGET>
			<QUESTION INDEX="7">
				<Content TYPE="String">
					<ContentSettings string="1"/>
				</Content>
				<Content TYPE="String">
					<ContentSettings string="1.125"/>
				</Content>
				<Answer VALUE="0"/>
			</QUESTION>
			<QUESTION INDEX="8">
				<Content TYPE="String">
					<ContentSettings string="1"/>
				</Content>
				<Content TYPE="String">
					<ContentSettings string="1.125"/>
				</Content>
				<Answer VALUE="0"/>
			</QUESTION>
			<QUESTION INDEX="9">
				<Content TYPE="String">
					<ContentSettings string="0"/>
				</Content>
				<Content TYPE="String">
					<ContentSettings string="0.5"/>
				</Content>
				<Answer VALUE="2"/>
			</QUESTION>
		</PROBLEM_SUBSET>
		<PROBLEM_SUBSET>
			<TARGET TYPE="Fraction">
				<ContentSettings denominator="5" numerator="2"/>
			</TARGET>
			<QUESTION INDEX="10">
				<Content TYPE="String">
					<ContentSettings string="0"/>
				</Content>
				<Content TYPE="String">
					<ContentSettings string="0.2"/>
				</Content>
				<Answer VALUE="2"/>
			</QUESTION>
			<QUESTION INDEX="11">
				<Content TYPE="String">
					<ContentSettings string="0"/>
				</Content>
				<Content TYPE="String">
					<ContentSettings string="1.2"/>
				</Content>
				<Answer VALUE="1"/>
			</QUESTION>
			<QUESTION INDEX="12">
				<Content TYPE="String">
					<ContentSettings string="1"/>
				</Content>
				<Content TYPE="String">
					<ContentSettings string="1.2"/>
				</Content>
				<Answer VALUE="0"/>
			</QUESTION>
		</PROBLEM_SUBSET>
		<PROBLEM_SUBSET>
			<TARGET TYPE="Fraction">
				<ContentSettings denominator="100" numerator="60"/>
			</TARGET>
			<QUESTION INDEX="13">
				<Content TYPE="String">
					<ContentSettings string="0.09"/>
				</Content>
				<Content TYPE="String">
					<ContentSettings string="0.45"/>
				</Content>
				<Answer VALUE="2"/>
			</QUESTION>
			<QUESTION INDEX="14">
				<Content TYPE="String">
					<ContentSettings string="0.91"/>
				</Content>
				<Content TYPE="String">
					<ContentSettings string="0.94"/>
				</Content>
				<Answer VALUE="0"/>
			</QUESTION>
			<QUESTION INDEX="15">
				<Content TYPE="String">
					<ContentSettings string="0.93"/>
				</Content>
				<Content TYPE="String">
					<ContentSettings string="1.01"/>
				</Content>
				<Answer VALUE="0"/>
			</QUESTION>
		</PROBLEM_SUBSET>
		<PROBLEM_SUBSET>
			<TARGET TYPE="Fraction">
				<ContentSettings denominator="100" numerator="36"/>
			</TARGET>
			<QUESTION INDEX="16">
				<Content TYPE="String">
					<ContentSettings string="0.21"/>
				</Content>
				<Content TYPE="String">
					<ContentSettings string="0.56"/>
				</Content>
				<Answer VALUE="1"/>
			</QUESTION>
			<QUESTION INDEX="17">
				<Content TYPE="String">
					<ContentSettings string="0.16"/>
				</Content>
				<Content TYPE="String">
					<ContentSettings string="0.22"/>
				</Content>
				<Answer VALUE="2"/>
			</QUESTION>
			<QUESTION INDEX="18">
				<Content TYPE="String">
					<ContentSettings string="0.02"/>
				</Content>
				<Content TYPE="String">
					<ContentSettings string="0.19"/>
				</Content>
				<Answer VALUE="2"/>
			</QUESTION>
		</PROBLEM_SUBSET>

	</PROBLEM_SET>

</INPUT>


text:
<component name="libraryTable">
  <library name="sdklib-25.2.2">
    <CLASSES>
      <root url="jar://$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/sdklib/25.2.2/sdklib-25.2.2.jar!/" />
    </CLASSES>
    <JAVADOC />
    <SOURCES />
  </library>
</component>


text:
/**
 * The db connection and ORM layer init.
 */
let knex = require('knex')({
    client: 'sqlite3',
    connection: {
        filename: './hackd-pok.db'
    },
    debug: true
});

module.exports = require('bookshelf')(knex);


text:
var gulp = require('gulp');
var mocha = require('gulp-mocha');

function handleError(err) {
  console.log(err.toString());
  this.emit('end');
}

gulp.task('test', function () {
  return gulp.src('test/test.js', { read: false })
    .pipe(mocha())
    .on("error", handleError);
});

gulp.task('default', ['test']);


text:
import os
import json
from collections import OrderedDict

from django.db import migrations
from django.conf import settings

def dfs(apps, root, deep, superset=None, leaf=True):
    Region = apps.get_model('app', 'Region')
    if isinstance(root, dict):
        for k, v in root.items():
            s = dfs(apps, k, deep, superset, not v)
            dfs(apps, v, deep + 1, s)

    elif isinstance(root, list):
        for k in root:
            dfs(apps, k, deep, superset, True)
    else:
        region = Region(
                name=root, superset=superset, admin_level=deep, leaf=leaf)
        region.save()
        return region

def add_region(apps, schema_editor):
    if settings.TESTING:
        data_file = "regions_for_test.json"
    else:
        data_file = "regions.txt"
    regions = json.load(open(
        os.path.join(os.path.dirname(__file__), data_file)),
        object_pairs_hook=OrderedDict)
    dfs(apps, regions, 1)

class Migration(migrations.Migration):
    dependencies = [
        ('app', '0002_subject'),
    ]

    operations = [
        migrations.RunPython(add_region),
    ]


text:
package org.encog.util.obj;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.encog.EncogError;
import org.encog.util.file.ResourceInputStream;

/**
 * This class includes some utilities to be used with reflection. This are
 * mostly used by the Encog generic persistence classes.
 */
public final class ReflectionUtil {

	/**
	 * A map between short class names and the full path names.
	 */
	private static Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();

	/**
	 * Find the specified field, look also in superclasses.
	 *
	 * @param c
	 *            The class to search.
	 * @param name
	 *            The name of the field we are looking for.
	 * @return The field.
	 */
	public static Field findField(final Class<?> c, final String name) {
		final Collection<Field> list = ReflectionUtil.getAllFields(c);
		for (final Field field : list) {
			if (field.getName().equals(name)) {
				field.setAccessible(true);
				return field;
			}
		}

		if (c.getSuperclass() != null) {
			return findField(c.getSuperclass(), name);
		}

		return null;
	}

	/**
	 * Get all of the fields from the specified class as a collection.
	 *
	 * @param c
	 *            The class to access.
	 * @return All of the fields from this class and subclasses.
	 */
	public static Collection<Field> getAllFields(final Class<?> c) {
		final List<Field> result = new ArrayList<Field>();
		ReflectionUtil.getAllFields(c, result);
		return result;
	}

	/**
	 * Get all of the fields in the specified class and super classes.
	 *
	 * @param c
	 *            The class to check.
	 * @param fields
	 *            A collection to hold the classes.
	 */
	public static void getAllFields(final Class<?> c,
			final Collection<Field> fields) {
		for (final Field field : c.getDeclaredFields()) {
			fields.add(field);
		}

		final Class<?> s = c.getSuperclass();
		if (s != null) {
			ReflectionUtil.getAllFields(s, fields);
		}
	}

	/**
	 * Determine if one class is an instance of the other class.
	 *
	 * @param class1
	 *            The class to check.
	 * @param class2
	 *            Is class1 an instance of class 2.
	 * @return True if class 1 is an instance of class 2.
	 */
	public static boolean isInstanceOf(final Class<?> class1,
			final Class<?> class2) {

		// same class?
		if (class1.equals(class2)) {
			return true;
		}

		// implements interface
		for (final Class<?> clazz : class1.getInterfaces()) {
			if (clazz.equals(class1)) {
				return true;
			}
		}

		if (class1.getSuperclass() == null) {
			return false;
		} else {
			return ReflectionUtil.isInstanceOf(class1.getSuperclass(), class2);
		}
	}

	/**
	 * Determine if the specified object is a primitive.
	 *
	 * @param obj
	 *            The object to check.
	 * @return True if this object is primitive.
	 */
	public static boolean isPrimitive(final Object obj) {
		return (obj instanceof Character) || (obj instanceof Integer)
				|| (obj instanceof Short) || (obj instanceof Float)
				|| (obj instanceof Double) || (obj instanceof Boolean)
				|| (obj instanceof Long);
	}

	/**
	 * Determine if an object is "simple", that is it should be persisted just
	 * with a .tostring.
	 *
	 * @param obj
	 *            The object to check.
	 * @return True if the object is simple.
	 */
	public static boolean isSimple(final Object obj) {
		return (obj instanceof File) || (obj instanceof String);
	}

	/**
	 * Load the classmap file. This allows classes to be resolved using just the
	 * simple name.
	 */
	public static void loadStandardClassmap() {
		String currentClass = null;
		try {
			InputStream is = ResourceInputStream.openResourceInputStream("org/encog/data/classes.txt");
			final BufferedReader reader = new BufferedReader(
					new InputStreamReader(is));
			String line;
			while ((line = reader.readLine()) != null) {
				if (line.trim().length() != 0) {
					currentClass = line;
					final Class<?> c = Class.forName(line);
					ReflectionUtil.classMap.put(c.getSimpleName(), c);
				}
			}
			is.close();
		} catch (final IOException e) {
			throw new EncogError(e);
		} catch (final ClassNotFoundException e) {
			throw new EncogError("Unknown class: " + currentClass);
		}

	}

	/**
	 * Load the classmap file. This allows classes to be resolved using just the
	 * simple name.
	 */
	public static void loadClassmap() {
		String currentClass = null;
		try {
			InputStream is = ResourceInputStream.openResourceInputStream("org/encog/data/classes.txt");

			final BufferedReader reader = new BufferedReader(
					new InputStreamReader(is));
			String line;
			while ((line = reader.readLine()) != null) {
				if (line.trim().length() != 0) {
					currentClass = line;
					final Class<?> c = Class.forName(line);
					ReflectionUtil.classMap.put(c.getSimpleName(), c);
				}
			}
			is.close();
		} catch (final IOException e) {
			throw new EncogError(e);
		} catch (final ClassNotFoundException e) {
			throw new EncogError("Unknown class: " + currentClass);
		}
	}

	/**
	 * Resolve an encog class using its simple name.
	 *
	 * @param name
	 *            The simple name of the class.
	 * @return The class requested.
	 */
	public static Class<?> resolveEncogClass(final String name) {
		synchronized (ReflectionUtil.classMap) {
			if (ReflectionUtil.classMap.size() == 0) {
				ReflectionUtil.loadClassmap();
			}
		}
		return ReflectionUtil.classMap.get(name);
	}

	/**
	 * Private constructor.
	 */
	private ReflectionUtil() {

	}

	/**
	 * Resolve an enumeration.
	 * @param field The field to resolve.
	 * @param value The value to get the enum for.
	 * @return The enum that was resolved.
	 */
	public static Object resolveEnum(final Field field, final String value) {
		final Class<?> type = field.getType();
		Object[] objs = type.getEnumConstants();
		for (Object obj : objs) {
			if (obj.toString().equals(value)) {
				return obj;
			}
		}
		return null;
	}

	/**
	 * Generate a hash code for an object.  Return 0 for null objects.
	 * @param <T> The type of object to generate for.
	 * @param o The object to generate.
	 * @return The hash code.
	 */
	public static <T> int safeHashCode(final T o) {
		if (o == null) {
			return 0;
		} else {
			return o.hashCode();
		}
	}
}


text:
/* ---------------------------------------------------------------------

    Conversions between UTF32, UTF-16, and UTF-8. Source code file.
    Author: Mark E. Davis, 1994.
    Rev History: Rick McGowan, fixes & updates May 2001.
    Sept 2001: fixed const & error conditions per
    mods suggested by S. Parent & A. Lillich.
    June 2002: Tim Dodd added detection and handling of incomplete
    source sequences, enhanced error detection, added casts
    to eliminate compiler warnings.
    July 2003: slight mods to back out aggressive FFFE detection.
    Jan 2004: updated switches in from-UTF8 conversions.
    Oct 2004: updated to use UNI_MAX_LEGAL_UTF32 in UTF-32 conversions.

    See the header file "ConvertUTF.h" for complete documentation.

   ------------------------------------------------------------------------ */

#include "ConvertUTF.h"
#ifdef CVTUTF_DEBUG
 #include <stdio.h>
#endif

static const int   halfShift  = 10; /* used for shifting by 10 bits */

static const UTF32 halfBase = 0x0010000UL;
static const UTF32 halfMask = 0x3FFUL;

#define UNI_SUR_HIGH_START  (UTF32)0xD800
#define UNI_SUR_HIGH_END    (UTF32)0xDBFF
#define UNI_SUR_LOW_START   (UTF32)0xDC00
#define UNI_SUR_LOW_END     (UTF32)0xDFFF
#define false      0
#define true        1

/* --------------------------------------------------------------------- */

ConversionResult
ConvertUTF32toUTF16( const UTF32**   sourceStart,
                     const UTF32*    sourceEnd,
                     UTF16**         targetStart,
                     UTF16*          targetEnd,
                     ConversionFlags flags )
{
    ConversionResult result = conversionOK;
    const UTF32*     source = *sourceStart;
    UTF16*           target = *targetStart;

    while( source < sourceEnd )
    {
        UTF32 ch;
        if( target >= targetEnd )
        {
            result = targetExhausted; break;
        }
        ch = *source++;
        if( ch <= UNI_MAX_BMP ) /* Target is a character <= 0xFFFF */
        { /* UTF-16 surrogate values are illegal in UTF-32; 0xffff or 0xfffe are
            both reserved values */
            if( ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END )
            {
                if( flags == strictConversion )
                {
                    --source; /* return to the illegal value itself */
                    result = sourceIllegal;
                    break;
                }
                else
                {
                    *target++ = UNI_REPLACEMENT_CHAR;
                }
            }
            else
            {
                *target++ = (UTF16)ch; /* normal case */
            }
        }
        else if( ch > UNI_MAX_LEGAL_UTF32 )
        {
            if( flags == strictConversion )
            {
                result = sourceIllegal;
            }
            else
            {
                *target++ = UNI_REPLACEMENT_CHAR;
            }
        }
        else
        {
            /* target is a character in range 0xFFFF - 0x10FFFF. */
            if( target + 1 >= targetEnd )
            {
                --source; /* Back up source pointer! */
                result = targetExhausted; break;
            }
            ch -= halfBase;
            *target++ = (UTF16)( ( ch >> halfShift ) + UNI_SUR_HIGH_START );
            *target++ = (UTF16)( ( ch & halfMask ) + UNI_SUR_LOW_START );
        }
    }

    *sourceStart = source;
    *targetStart = target;
    return result;
}

/* --------------------------------------------------------------------- */

ConversionResult
ConvertUTF16toUTF32( const UTF16**   sourceStart,
                     const UTF16*    sourceEnd,
                     UTF32**         targetStart,
                     UTF32*          targetEnd,
                     ConversionFlags flags )
{
    ConversionResult result = conversionOK;
    const UTF16*     source = *sourceStart;
    UTF32*           target = *targetStart;
    UTF32            ch, ch2;

    while( source < sourceEnd )
    {
        const UTF16* oldSource = source; /*  In case we have to back up because
                                           of target overflow. */
        ch = *source++;
        /* If we have a surrogate pair, convert to UTF32 first. */
        if( ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END )
        {
            /* If the 16 bits following the high surrogate are in the source
              buffer... */
            if( source < sourceEnd )
            {
                ch2 = *source;
                /* If it's a low surrogate, convert to UTF32. */
                if( ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END )
                {
                    ch = ( ( ch - UNI_SUR_HIGH_START ) << halfShift )
                         + ( ch2 - UNI_SUR_LOW_START ) + halfBase;
                    ++source;
                }
                else if( flags == strictConversion ) /* it's an unpaired high
                                                       surrogate */
                {
                    --source; /* return to the illegal value itself */
                    result = sourceIllegal;
                    break;
                }
            }
            else /* We don't have the 16 bits following the high surrogate. */
            {
                --source; /* return to the high surrogate */
                result = sourceExhausted;
                break;
            }
        }
        else if( flags == strictConversion )
        {
            /* UTF-16 surrogate values are illegal in UTF-32 */
            if( ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END )
            {
                --source; /* return to the illegal value itself */
                result = sourceIllegal;
                break;
            }
        }
        if( target >= targetEnd )
        {
            source = oldSource; /* Back up source pointer! */
            result = targetExhausted; break;
        }
        *target++ = ch;
    }

    *sourceStart = source;
    *targetStart = target;
#ifdef CVTUTF_DEBUG
    if( result == sourceIllegal )
    {
        fprintf( stderr, "ConvertUTF16toUTF32 illegal seq 0x%04x,%04x\n",
                 ch,
                 ch2 );
        fflush( stderr );
    }
#endif
    return result;
}

/* --------------------------------------------------------------------- */

/*
 * Index into the table below with the first byte of a UTF-8 sequence to
 * get the number of trailing bytes that are supposed to follow it.
 * Note that *legal* UTF-8 values can't have 4 or 5-bytes. The table is
 * left as-is for anyone who may want to do such conversion, which was
 * allowed in earlier algorithms.
 */
static const char  trailingBytesForUTF8[256] = {
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1,
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
    4, 4, 4, 4, 5, 5, 5, 5
};

/*
 * Magic values subtracted from a buffer value during UTF8 conversion.
 * This table contains as many values as there might be trailing bytes
 * in a UTF-8 sequence.
 */
static const UTF32 offsetsFromUTF8[6] =
{ 0x00000000UL,                                           0x00003080UL,
  0x000E2080UL,
  0x03C82080UL, 0xFA082080UL,
  0x82082080UL };

/*
 * Once the bits are split out into bytes of UTF-8, this is a mask OR-ed
 * into the first byte, depending on how many bytes follow.  There are
 * as many entries in this table as there are UTF-8 sequence types.
 * (I.e., one byte sequence, two byte... etc.). Remember that sequencs
 * for *legal* UTF-8 will be 4 or fewer bytes total.
 */
static const UTF8  firstByteMark[7] =
{ 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };

/* --------------------------------------------------------------------- */

/* The interface converts a whole buffer to avoid function-call overhead.
 * Constants have been gathered. Loops & conditionals have been removed as
 * much as possible for efficiency, in favor of drop-through switches.
 * (See "Note A" at the bottom of the file for equivalent code.)
 * If your compiler supports it, the "isLegalUTF8" call can be turned
 * into an inline function.
 */

/* --------------------------------------------------------------------- */

ConversionResult
ConvertUTF16toUTF8( const UTF16**   sourceStart,
                    const UTF16*    sourceEnd,
                    UTF8**          targetStart,
                    UTF8*           targetEnd,
                    ConversionFlags flags )
{
    ConversionResult result = conversionOK;
    const UTF16*     source = *sourceStart;
    UTF8*            target = *targetStart;

    while( source < sourceEnd )
    {
        UTF32          ch;
        unsigned short bytesToWrite = 0;
        const UTF32    byteMask = 0xBF;
        const UTF32    byteMark = 0x80;
        const UTF16*   oldSource = source; /* In case we have to back up because
                                             of target overflow. */
        ch = *source++;
        /* If we have a surrogate pair, convert to UTF32 first. */
        if( ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END )
        {
            /* If the 16 bits following the high surrogate are in the source
              buffer... */
            if( source < sourceEnd )
            {
                UTF32 ch2 = *source;
                /* If it's a low surrogate, convert to UTF32. */
                if( ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END )
                {
                    ch = ( ( ch - UNI_SUR_HIGH_START ) << halfShift )
                         + ( ch2 - UNI_SUR_LOW_START ) + halfBase;
                    ++source;
                }
                else if( flags == strictConversion ) /* it's an unpaired high
                                                       surrogate */
                {
                    --source; /* return to the illegal value itself */
                    result = sourceIllegal;
                    break;
                }
            }
            else /* We don't have the 16 bits following the high surrogate. */
            {
                --source; /* return to the high surrogate */
                result = sourceExhausted;
                break;
            }
        }
        else if( flags == strictConversion )
        {
            /* UTF-16 surrogate values are illegal in UTF-32 */
            if( ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END )
            {
                --source; /* return to the illegal value itself */
                result = sourceIllegal;
                break;
            }
        }
        /* Figure out how many bytes the result will require */
        if( ch < (UTF32)0x80 )
        {
            bytesToWrite = 1;
        }
        else if( ch < (UTF32)0x800 )
        {
            bytesToWrite = 2;
        }
        else if( ch < (UTF32)0x10000 )
        {
            bytesToWrite = 3;
        }
        else if( ch < (UTF32)0x110000 )
        {
            bytesToWrite = 4;
        }
        else
        {
            bytesToWrite = 3;
            ch = UNI_REPLACEMENT_CHAR;
        }

        target += bytesToWrite;
        if( target > targetEnd )
        {
            source = oldSource; /* Back up source pointer! */
            target -= bytesToWrite; result = targetExhausted; break;
        }
        switch( bytesToWrite ) /* note: everything falls through. */
        {
            case 4:
                *--target =
                    (UTF8)( ( ch | byteMark ) & byteMask ); ch >>= 6;

            case 3:
                *--target =
                    (UTF8)( ( ch | byteMark ) & byteMask ); ch >>= 6;

            case 2:
                *--target =
                    (UTF8)( ( ch | byteMark ) & byteMask ); ch >>= 6;

            case 1:
                *--target =  (UTF8)( ch | firstByteMark[bytesToWrite] );
        }
        target += bytesToWrite;
    }

    *sourceStart = source;
    *targetStart = target;
    return result;
}

/* --------------------------------------------------------------------- */

/*
 * Utility routine to tell whether a sequence of bytes is legal UTF-8.
 * This must be called with the length pre-determined by the first byte.
 * If not calling this from ConvertUTF8to*, then the length can be set by:
 *  length = trailingBytesForUTF8[*source]+1;
 * and the sequence is illegal right away if there aren't that many bytes
 * available.
 * If presented with a length > 4, this returns false.  The Unicode
 * definition of UTF-8 goes up to 4-byte sequences.
 */

static Boolean
isLegalUTF8( const UTF8 *source,
             int         length )
{
    UTF8        a;
    const UTF8 *srcptr = source + length;

    switch( length )
    {
        default:
            return false;

        /* Everything else falls through when "true"... */
        case 4:
            if( ( a = ( *--srcptr ) ) < 0x80 || a > 0xBF ) return false;

        case 3:
            if( ( a = ( *--srcptr ) ) < 0x80 || a > 0xBF ) return false;

        case 2:
            if( ( a = ( *--srcptr ) ) > 0xBF ) return false;

            switch( *source )
            {
                /* no fall-through in this inner switch */
                case 0xE0:
                    if( a < 0xA0 ) return false;break;

                case 0xED:
                    if( a > 0x9F ) return false;break;

                case 0xF0:
                    if( a < 0x90 ) return false;break;

                case 0xF4:
                    if( a > 0x8F ) return false;break;

                default:
                    if( a < 0x80 ) return false;
            }

        case 1:
            if( *source >= 0x80 && *source < 0xC2 ) return false;
    }
    if( *source > 0xF4 ) return false;
    return true;
}

/* --------------------------------------------------------------------- */

/*
 * Exported function to return whether a UTF-8 sequence is legal or not.
 * This is not used here; it's just exported.
 */
Boolean
isLegalUTF8Sequence( const UTF8 *source,
                     const UTF8 *sourceEnd )
{
    int length = trailingBytesForUTF8[*source] + 1;

    if( source + length > sourceEnd )
    {
        return false;
    }
    return isLegalUTF8( source, length );
}

/* --------------------------------------------------------------------- */

ConversionResult
ConvertUTF8toUTF16( const UTF8**    sourceStart,
                    const UTF8*     sourceEnd,
                    UTF16**         targetStart,
                    UTF16*          targetEnd,
                    ConversionFlags flags )
{
    ConversionResult result = conversionOK;
    const UTF8*      source = *sourceStart;
    UTF16*           target = *targetStart;

    while( source < sourceEnd )
    {
        UTF32          ch = 0;
        unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
        if( source + extraBytesToRead >= sourceEnd )
        {
            result = sourceExhausted; break;
        }
        /* Do this check whether lenient or strict */
        if( !isLegalUTF8( source, extraBytesToRead + 1 ) )
        {
            result = sourceIllegal;
            break;
        }
        /*
         * The cases all fall through. See "Note A" below.
         */
        switch( extraBytesToRead )
        {
            case 5:
                ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */

            case 4:
                ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */

            case 3:
                ch += *source++; ch <<= 6;

            case 2:
                ch += *source++; ch <<= 6;

            case 1:
                ch += *source++; ch <<= 6;

            case 0:
                ch += *source++;
        }
        ch -= offsetsFromUTF8[extraBytesToRead];

        if( target >= targetEnd )
        {
            source -= ( extraBytesToRead + 1 ); /* Back up source pointer! */
            result = targetExhausted; break;
        }
        if( ch <= UNI_MAX_BMP ) /* Target is a character <= 0xFFFF */
        { /* UTF-16 surrogate values are illegal in UTF-32 */
            if( ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END )
            {
                if( flags == strictConversion )
                {
                    source -= ( extraBytesToRead + 1 ); /* return to the illegal
                                                          value itself */
                    result = sourceIllegal;
                    break;
                }
                else
                {
                    *target++ = UNI_REPLACEMENT_CHAR;
                }
            }
            else
            {
                *target++ = (UTF16)ch; /* normal case */
            }
        }
        else if( ch > UNI_MAX_UTF16 )
        {
            if( flags == strictConversion )
            {
                result = sourceIllegal;
                source -= ( extraBytesToRead + 1 ); /* return to the start */
                break; /* Bail out; shouldn't continue */
            }
            else
            {
                *target++ = UNI_REPLACEMENT_CHAR;
            }
        }
        else
        {
            /* target is a character in range 0xFFFF - 0x10FFFF. */
            if( target + 1 >= targetEnd )
            {
                source -= ( extraBytesToRead + 1 ); /* Back up source pointer!
                                                      */
                result = targetExhausted; break;
            }
            ch -= halfBase;
            *target++ = (UTF16)( ( ch >> halfShift ) + UNI_SUR_HIGH_START );
            *target++ = (UTF16)( ( ch & halfMask ) + UNI_SUR_LOW_START );
        }
    }

    *sourceStart = source;
    *targetStart = target;
    return result;
}

/* --------------------------------------------------------------------- */

ConversionResult
ConvertUTF32toUTF8( const UTF32**   sourceStart,
                    const UTF32*    sourceEnd,
                    UTF8**          targetStart,
                    UTF8*           targetEnd,
                    ConversionFlags flags )
{
    ConversionResult result = conversionOK;
    const UTF32*     source = *sourceStart;
    UTF8*            target = *targetStart;

    while( source < sourceEnd )
    {
        UTF32          ch;
        unsigned short bytesToWrite = 0;
        const UTF32    byteMask = 0xBF;
        const UTF32    byteMark = 0x80;
        ch = *source++;
        if( flags == strictConversion )
        {
            /* UTF-16 surrogate values are illegal in UTF-32 */
            if( ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END )
            {
                --source; /* return to the illegal value itself */
                result = sourceIllegal;
                break;
            }
        }
        /*
         * Figure out how many bytes the result will require. Turn any
         * illegally large UTF32 things (> Plane 17) into replacement chars.
         */
        if( ch < (UTF32)0x80 )
        {
            bytesToWrite = 1;
        }
        else if( ch < (UTF32)0x800 )
        {
            bytesToWrite = 2;
        }
        else if( ch < (UTF32)0x10000 )
        {
            bytesToWrite = 3;
        }
        else if( ch <= UNI_MAX_LEGAL_UTF32 )
        {
            bytesToWrite = 4;
        }
        else
        {
            bytesToWrite = 3;
            ch = UNI_REPLACEMENT_CHAR;
            result = sourceIllegal;
        }

        target += bytesToWrite;
        if( target > targetEnd )
        {
            --source; /* Back up source pointer! */
            target -= bytesToWrite; result = targetExhausted; break;
        }
        switch( bytesToWrite ) /* note: everything falls through. */
        {
            case 4:
                *--target =
                    (UTF8)( ( ch | byteMark ) & byteMask ); ch >>= 6;

            case 3:
                *--target =
                    (UTF8)( ( ch | byteMark ) & byteMask ); ch >>= 6;

            case 2:
                *--target =
                    (UTF8)( ( ch | byteMark ) & byteMask ); ch >>= 6;

            case 1:
                *--target = (UTF8) ( ch | firstByteMark[bytesToWrite] );
        }
        target += bytesToWrite;
    }

    *sourceStart = source;
    *targetStart = target;
    return result;
}

/* --------------------------------------------------------------------- */

ConversionResult
ConvertUTF8toUTF32( const UTF8**    sourceStart,
                    const UTF8*     sourceEnd,
                    UTF32**         targetStart,
                    UTF32*          targetEnd,
                    ConversionFlags flags )
{
    ConversionResult result = conversionOK;
    const UTF8*      source = *sourceStart;
    UTF32*           target = *targetStart;

    while( source < sourceEnd )
    {
        UTF32          ch = 0;
        unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
        if( source + extraBytesToRead >= sourceEnd )
        {
            result = sourceExhausted; break;
        }
        /* Do this check whether lenient or strict */
        if( !isLegalUTF8( source, extraBytesToRead + 1 ) )
        {
            result = sourceIllegal;
            break;
        }
        /*
         * The cases all fall through. See "Note A" below.
         */
        switch( extraBytesToRead )
        {
            case 5:
                ch += *source++; ch <<= 6;

            case 4:
                ch += *source++; ch <<= 6;

            case 3:
                ch += *source++; ch <<= 6;

            case 2:
                ch += *source++; ch <<= 6;

            case 1:
                ch += *source++; ch <<= 6;

            case 0:
                ch += *source++;
        }
        ch -= offsetsFromUTF8[extraBytesToRead];

        if( target >= targetEnd )
        {
            source -= ( extraBytesToRead + 1 ); /* Back up the source pointer!
                                                  */
            result = targetExhausted; break;
        }
        if( ch <= UNI_MAX_LEGAL_UTF32 )
        {
            /*
             * UTF-16 surrogate values are illegal in UTF-32, and anything
             * over Plane 17 (> 0x10FFFF) is illegal.
             */
            if( ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END )
            {
                if( flags == strictConversion )
                {
                    source -= ( extraBytesToRead + 1 ); /* return to the illegal
                                                          value itself */
                    result = sourceIllegal;
                    break;
                }
                else
                {
                    *target++ = UNI_REPLACEMENT_CHAR;
                }
            }
            else
            {
                *target++ = ch;
            }
        }
        else /* i.e., ch > UNI_MAX_LEGAL_UTF32 */
        {
            result = sourceIllegal;
            *target++ = UNI_REPLACEMENT_CHAR;
        }
    }

    *sourceStart = source;
    *targetStart = target;
    return result;
}

/* ---------------------------------------------------------------------

    Note A.
    The fall-through switches in UTF-8 reading code save a
    temp variable, some decrements & conditionals.  The switches
    are equivalent to the following loop:
    {
        int tmpBytesToRead = extraBytesToRead+1;
        do {
        ch += *source++;
        --tmpBytesToRead;
        if (tmpBytesToRead) ch <<= 6;
        } while (tmpBytesToRead > 0);
    }
    In UTF-8 writing code, the switches on "bytesToWrite" are
    similarly unrolled loops.

   --------------------------------------------------------------------- */


text:
'use strict'

/**
 * Module exports.
 * @public
 */

module.exports = encodeUrl

/**
 * RegExp to match non-URL code points, *after* encoding (i.e. not including "%")
 * and including invalid escape sequences.
 * @private
 */

var ENCODE_CHARS_REGEXP = /(?:[^\x21\x25\x26-\x3B\x3D\x3F-\x5B\x5D\x5F\x61-\x7A\x7E]|%(?:[^0-9A-Fa-f]|[0-9A-Fa-f][^0-9A-Fa-f]))+/g

/**
 * RegExp to match unmatched surrogate pair.
 * @private
 */

var UNMATCHED_SURROGATE_PAIR_REGEXP = /(^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]|[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/g

/**
 * String to replace unmatched surrogate pair with.
 * @private
 */

var UNMATCHED_SURROGATE_PAIR_REPLACE = '$1\uFFFD$2'

/**
 * Encode a URL to a percent-encoded form, excluding already-encoded sequences.
 *
 * This function will take an already-encoded URL and encode all the non-URL
 * code points. This function will not encode the "%" character unless it is
 * not part of a valid sequence (`%20` will be left as-is, but `%foo` will
 * be encoded as `%25foo`).
 *
 * This encode is meant to be "safe" and does not throw errors. It will try as
 * hard as it can to properly encode the given URL, including replacing any raw,
 * unpaired surrogate pairs with the Unicode replacement character prior to
 * encoding.
 *
 * @param {string} url
 * @return {string}
 * @public
 */

function encodeUrl (url) {
  return String(url)
    .replace(UNMATCHED_SURROGATE_PAIR_REGEXP, UNMATCHED_SURROGATE_PAIR_REPLACE)
    .replace(ENCODE_CHARS_REGEXP, encodeURI)
}


text:
'use strict';

var path = require('path');
var _ = require('lodash');

function requiredProcessEnv(name) {
  if (!process.env[name]) {
    throw new Error('You must set the ' + name + ' environment variable');
  }
  return process.env[name];
}

// All configurations will extend these options
// ============================================
var all = {
  env: process.env.NODE_ENV,
  root: path.normalize(__dirname + '/../../..'),
  port: process.env.PORT || 9000,
  ip: process.env.IP || '0.0.0.0',
  seedDB: false,
  secrets: {
    session: 'angular-test'
  },
  mongo: {
    options: {
      db: {
        safe: true
      }
    }
  }
};

module.exports = _.merge(all, require('./' + process.env.NODE_ENV + '.js')  || {});


text:
package org.opencloudb.sqlengine;

import org.opencloudb.cache.LayerCachePool;
import org.opencloudb.config.model.SchemaConfig;
import org.opencloudb.config.model.SystemConfig;
import org.opencloudb.server.ServerConnection;
/**
 * mycat catlet ,used to execute sql and return result to client,some like
 * database's procedure.
 * must implemented as a stateless class and can process many SQL concurrently
 *
 * @author wuzhih
 *
 */
public interface Catlet {

	/*
	 * execute sql in EngineCtx and return result to client
	 */
	void processSQL(String sql, EngineCtx ctx);

	void route(SystemConfig sysConfig, SchemaConfig schema,
			int sqlType, String realSQL, String charset, ServerConnection sc,
			LayerCachePool cachePool) ;
	//void setRoute(RouteResultset rrs);
}


text:
<?php

/**
 * HTML5 Boilerplate view helper
 * Generates <html> element
 *
 * @see http://html5boilerplate.com/
 *
 * @author Jakub Argasiński <argasek@gmail.com>
 *
 */
class Void_View_Helper_Html5BoilerplateHtml extends Zend_View_Helper_HtmlElement {
	/**
	 * Cache manifest default filename
	 * @see http://www.w3.org/TR/html5/offline.html
	 * @var string
	 */
	const CACHE_MANIFEST_FILENAME = "cache.manifest";

	/**
	 * Helper code. If true passed as $manifest value, attach manifest="..." attribute
	 * to a rendered element with a default location of cache.manifest file; if false,
	 * don't attach anything. If string passed as $manifest value, treat it is a relative
	 * URL to the cache manifest file.
	 *
	 * @example html5Boilerplate('pl', 'resources/settings/cache.manifest');
	 * @param string $lang Language code (en, pl, ...)
	 * @param bool|string $manifest Boolean or string
	 *
	 * @return $this for fluent interface
	 */
	public function html5BoilerplateHtml($lang, $manifest = false) {
		$this->setLang($lang);
		$this->setManifest($manifest);
		return $this;
	}

	/**
	 * Cast to string representation
	 *
	 * @return string
	 */
	public function __toString() {
		return $this->toString();
	}

	/**
	 * Render <html> element
	 *
	 * @return string
	 */
	public function toString() {
		if ($this->view->doctype()->isHtml5() === false) {
			throw new Zend_View_Exception('You cannot use HTML5 Boilerplate helpers for non-HTML5 documents');
		}

		$manifest = $this->getManifest();
		$lang = $this->getLang();

		$html = array();
		$html[] = "<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->";
		$html[] = "<!--[if lt IE 7 ]> <html lang=\"$lang\" class=\"no-js ie6\"> <![endif]-->";
		$html[] = "<!--[if IE 7 ]>    <html lang=\"$lang\" class=\"no-js ie7\"> <![endif]-->";
		$html[] = "<!--[if IE 8 ]>    <html lang=\"$lang\" class=\"no-js ie8\"> <![endif]-->";
		$html[] = "<!--[if IE 9 ]>    <html lang=\"$lang\" class=\"no-js ie9\"> <![endif]-->";
		$html[] = "<!--[if (gt IE 9)|!(IE)]><!--> <html lang=\"$lang\" class=\"no-js\"$manifest> <!--<![endif]-->";

		return implode(self::EOL, $html);
	}

	/**
	 * Get language code
	 *
	 * @return string
	 */
	protected function getLang() {
		return $this->_lang;
	}

	/**
	 * Get cache manifest URL
	 *
	 * @see http://www.w3.org/TR/html5/offline.html
	 * @return string
	 */
	protected function getManifest() {
		$manifest = '';
		if (is_bool($this->_manifest)) {
			$manifest = ($this->_manifest ? $this->getManifestAttribute(self::CACHE_MANIFEST_FILENAME) : '');
		} else {
			$manifest = $this->getManifestAttribute($this->_manifest);
		}
		return $manifest;
	}

	/**
	 * Return manifest HTML attribute
	 *
	 * @param string $value
	 * @return string
	 */
	private function getManifestAttribute($value) {
		return ' manifest="' . $this->view->baseUrl($value) . '"';
	}

	/**
	 * Set cache manifest URL
	 *
	 * @param unknown_type $manifest
	 * @throws Zend_View_Exception
	 */
	public function setManifest($manifest) {
		if (is_bool($manifest) || is_string($manifest)) {
			$this->_manifest = $manifest;
		} else {
			throw new Zend_View_Exception('Incorrect parameter passed as manifest (must be boolean or relative URL to manifest file)');
		}
	}

	/**
	 * Set HTML lang attribute
	 *
	 * @param string $lang
	 */
	public function setLang($lang) {
		$this->_lang = (string) $lang;
	}

}


text:
<md-dialog flex="50" >
        <md-toolbar>

                <md-button class="md-icon-button" ng-click="closeItemViewer()">
                    <md-icon md-font-set="material-icons">close</md-icon>
                </md-button>

        </md-toolbar>
        <md-dialog-content class="without-padding" ng-init="isModal=true" data-ng-include=" 'app/userRole/userRole.view.html'">

        </md-dialog-content>
</md-dialog>


text:
package errors

// ErrorGroup is an interface for multiple errors that are not a chain.
// This happens for example when executing multiple operations in parallel.
type ErrorGroup interface {
	Errors() []error
}

// WalkDeep does a depth-first traversal of all errors.
// Any ErrorGroup is traversed (after going deep).
// The visitor function can return true to end the traversal early
// In that case, WalkDeep will return true, otherwise false.
func WalkDeep(err error, visitor func(err error) bool) bool {
	// Go deep
	unErr := err
	for unErr != nil {
		if done := visitor(unErr); done {
			return true
		}
		unErr = Unwrap(unErr)
	}

	// Go wide
	if group, ok := err.(ErrorGroup); ok {
		for _, err := range group.Errors() {
			if early := WalkDeep(err, visitor); early {
				return true
			}
		}
	}

	return false
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.resourcemanager.storage;

import com.azure.core.credential.TokenCredential;
import com.azure.core.http.HttpPipeline;
import com.azure.resourcemanager.resources.fluentcore.arm.AzureConfigurable;
import com.azure.resourcemanager.resources.fluentcore.arm.implementation.AzureConfigurableImpl;
import com.azure.resourcemanager.resources.fluentcore.arm.Manager;
import com.azure.core.management.profile.AzureProfile;
import com.azure.resourcemanager.resources.fluentcore.utils.HttpPipelineProvider;
import com.azure.resourcemanager.storage.fluent.StorageManagementClient;
import com.azure.resourcemanager.storage.implementation.StorageManagementClientBuilder;
import com.azure.resourcemanager.storage.implementation.BlobContainersImpl;
import com.azure.resourcemanager.storage.implementation.BlobServicesImpl;
import com.azure.resourcemanager.storage.implementation.ManagementPoliciesImpl;
import com.azure.resourcemanager.storage.implementation.StorageAccountsImpl;
import com.azure.resourcemanager.storage.implementation.StorageSkusImpl;
import com.azure.resourcemanager.storage.implementation.UsagesImpl;
import com.azure.resourcemanager.storage.models.BlobContainers;
import com.azure.resourcemanager.storage.models.BlobServices;
import com.azure.resourcemanager.storage.models.ManagementPolicies;
import com.azure.resourcemanager.storage.models.StorageAccounts;
import com.azure.resourcemanager.storage.models.StorageSkus;
import com.azure.resourcemanager.storage.models.Usages;

import java.util.Objects;

/** Entry point to Azure storage resource management. */
public final class StorageManager extends Manager<StorageManagementClient> {
    // Collections
    private StorageAccounts storageAccounts;
    private Usages storageUsages;
    private StorageSkus storageSkus;
    private BlobContainers blobContainers;
    private BlobServices blobServices;
    private ManagementPolicies managementPolicies;

    /**
     * Get a Configurable instance that can be used to create StorageManager with optional configuration.
     *
     * @return the instance allowing configurations
     */
    public static Configurable configure() {
        return new StorageManager.ConfigurableImpl();
    }

    /**
     * Creates an instance of StorageManager that exposes storage resource management API entry points.
     *
     * @param credential the credential to use
     * @param profile the profile to use
     * @return the StorageManager
     */
    public static StorageManager authenticate(TokenCredential credential, AzureProfile profile) {
        Objects.requireNonNull(credential, "'credential' cannot be null.");
        Objects.requireNonNull(profile, "'profile' cannot be null.");
        return authenticate(HttpPipelineProvider.buildHttpPipeline(credential, profile), profile);
    }

    /**
     * Creates an instance of StorageManager that exposes storage resource management API entry points.
     *
     * @param httpPipeline the RestClient to be used for API calls.
     * @param profile the profile to use
     * @return the StorageManager
     */
    public static StorageManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) {
        Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
        Objects.requireNonNull(profile, "'profile' cannot be null.");
        return new StorageManager(httpPipeline, profile);
    }

    /** The interface allowing configurations to be set. */
    public interface Configurable extends AzureConfigurable<Configurable> {
        /**
         * Creates an instance of StorageManager that exposes storage management API entry points.
         *
         * @param credential the credential to use
         * @param profile the profile to use
         * @return the interface exposing storage management API entry points that work across subscriptions
         */
        StorageManager authenticate(TokenCredential credential, AzureProfile profile);
    }

    /** The implementation for Configurable interface. */
    private static final class ConfigurableImpl extends AzureConfigurableImpl<Configurable> implements Configurable {
        public StorageManager authenticate(TokenCredential credential, AzureProfile profile) {
            return StorageManager.authenticate(buildHttpPipeline(credential, profile), profile);
        }
    }

    private StorageManager(HttpPipeline httpPipeline, AzureProfile profile) {
        super(
            httpPipeline,
            profile,
            new StorageManagementClientBuilder()
                .pipeline(httpPipeline)
                .endpoint(profile.getEnvironment().getResourceManagerEndpoint())
                .subscriptionId(profile.getSubscriptionId())
                .buildClient());
    }

    /** @return the storage account management API entry point */
    public StorageAccounts storageAccounts() {
        if (storageAccounts == null) {
            storageAccounts = new StorageAccountsImpl(this);
        }
        return storageAccounts;
    }

    /** @return the storage service usage management API entry point */
    public Usages usages() {
        if (storageUsages == null) {
            storageUsages = new UsagesImpl(this);
        }
        return storageUsages;
    }

    /** @return the storage service SKU management API entry point */
    public StorageSkus storageSkus() {
        if (storageSkus == null) {
            storageSkus = new StorageSkusImpl(this);
        }
        return storageSkus;
    }

    /** @return the blob container management API entry point */
    public BlobContainers blobContainers() {
        if (blobContainers == null) {
            blobContainers = new BlobContainersImpl(this);
        }
        return blobContainers;
    }

    /** @return the blob service management API entry point */
    public BlobServices blobServices() {
        if (blobServices == null) {
            blobServices = new BlobServicesImpl(this);
        }
        return blobServices;
    }

    /** @return the management policy management API entry point */
    public ManagementPolicies managementPolicies() {
        if (managementPolicies == null) {
            managementPolicies = new ManagementPoliciesImpl(this);
        }
        return managementPolicies;
    }
}


text:
<?php
// WARNING, this is a read only file created by import scripts
// WARNING
// WARNING,  Changes made to this file will be clobbered
// WARNING
// WARNING,  Please make changes on poeditor instead of here
//
//
?>
subject: Vreme za preuzimanje fajlova je isteklo
subject: {transfer.subject}

{alternative:plain}

Poštovani,

Transfer n°{transfer.id} je istekao i više nije dostupan za preuzimanje ({transfer.link}).

Lep pozdrav,
{cfg:site_name}

{alternative:html}

    Poštovani,

    Transfer  n°{transfer.id} je istekao i više nije dostupan za preuzimanje.

    Lep pozdrav,

    {cfg:site_name}


text:
package com.evolveum.midpoint.web.page.error;

import com.evolveum.midpoint.web.application.PageDescriptor;

/**
 * @author lazyman
 */
@PageDescriptor(url = "/error/404", permitAll = true)
public class PageError404 extends PageError {

    public PageError404() {
        super(404);
    }
}


text:
shared_examples "can be initialized" do
  let(:resource_attributes) do
    { first_name: "John", last_name: "Doe" }
  end

  let(:resource_object) { described_class.new(resource_attributes) }

  describe "#initialize" do
    it "sets attributes correctly" do
      expect(resource_object.first_name).to eq(resource_attributes[:first_name])
      expect(resource_object.last_name).to  eq(resource_attributes[:last_name])
    end
  end
end


text:
module UserUploadsHelper
end


text:
class AdminController < ApplicationController

  def index
    if current_user.nil?
      flash[:notice] = "You need to be signed in to access group policies"
      redirect_to new_user_session_path
    elsif cannot? :manage, Admin::Group
      flash[:notice] = "You do not have sufficient privileges to access group policies"
      redirect_to root_path
    else
      render layout: 'admin'
    end
  end
end


text:
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context="com.lakshparnami.callingpapa2.activities.CallerScreen">
    <RelativeLayout
        android:orientation="vertical"
        android:layout_weight="1"
        android:background="#1976d2"
        android:layout_width="fill_parent"
        android:layout_height="0dp">

        <TextView
            android:id="@+id/fakeName"
            android:layout_marginTop="15dp"
            android:layout_marginStart="15dp"
            android:layout_marginLeft="15dp"
            android:textColor="#fff"
            android:textSize="30sp"
            android:text="@string/app_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
        <LinearLayout
            android:layout_below="@+id/fakeName"
            android:weightSum="10"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">
            <TextView
                android:layout_marginStart="10dp"
                android:layout_marginLeft="10dp"
                android:textColor="#fff"
                android:text="@string/mob"
                android:textSize="20sp"
                android:maxLines="2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />
            <TextView
                android:id="@+id/fakeNumber"
                android:layout_marginStart="10dp"
                android:layout_marginLeft="10dp"
                android:textColor="#fff"
                android:text="@string/fake_number"
                android:textSize="20sp"
                android:maxLines="2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

        </LinearLayout>
        <LinearLayout
            android:padding="10dp"
            android:layout_alignParentBottom="true"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:baselineAligned="false">
            <FrameLayout
                android:layout_weight="1"
                android:layout_width="0dp"
                android:layout_height="wrap_content">
                <ImageButton
                    android:layout_gravity="center"
                    android:padding="5dp"
                    android:background="#0000"
                    android:layout_width="40dp"
                    android:layout_height="40dp"
                    android:src="@drawable/ic_volume_up_white_24dp"
                    android:contentDescription="@string/app_name"
                    android:id="@+id/speaker" />
            </FrameLayout>
            <FrameLayout
                android:layout_weight="1"
                android:layout_width="0dp"
                android:layout_height="wrap_content">
                <ImageButton
                    android:layout_gravity="center"
                    android:padding="5dp"
                    android:background="#0000"
                    android:layout_width="40dp"
                    android:layout_height="40dp"
                    android:src="@drawable/ic_mic_off_white_24dp"
                    android:contentDescription="@string/app_name"
                    android:id="@+id/mic" />
            </FrameLayout>
            <FrameLayout
                android:layout_weight="1"
                android:layout_width="0dp"
                android:layout_height="wrap_content">
                <ImageButton
                    android:layout_gravity="center"
                    android:padding="5dp"
                    android:background="#0000"
                    android:layout_width="40dp"
                    android:layout_height="40dp"
                    android:src="@drawable/ic_dialpad_white_24dp"
                    android:contentDescription="@string/app_name"
                    android:id="@+id/dialpad" />
            </FrameLayout>
            <FrameLayout
                android:layout_weight="1"
                android:layout_width="0dp"
                android:layout_height="wrap_content">
                <ImageButton
                    android:layout_gravity="center"
                    android:padding="5dp"
                    android:background="#0000"
                    android:layout_width="40dp"
                    android:layout_height="40dp"
                    android:src="@drawable/ic_pause_white_24dp"
                    android:contentDescription="@string/app_name"
                    android:id="@+id/hold" />
            </FrameLayout>
        </LinearLayout>
    </RelativeLayout>
    <RelativeLayout
        android:background="#ffc5c5c5"
        android:layout_weight="2"
        android:layout_width="fill_parent"
        android:layout_height="0dp">
        <ImageView
            android:background="#ffc5c5c5"
            android:layout_alignParentTop="true"
            android:layout_alignParentBottom="true"
            android:scaleType="centerCrop"
            android:id="@+id/contactImage"
            android:src="@drawable/pic"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_centerHorizontal="true"
            android:contentDescription="@string/app_name" />
        <android.support.design.widget.FloatingActionButton
            app:backgroundTint="#ffff0000"
            android:id="@+id/endCallButton"
            android:src="@drawable/ic_call_end_white_36dp"
            android:layout_marginBottom="40dp"
            android:layout_centerHorizontal="true"
            android:layout_alignParentBottom="true"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:contentDescription="@string/app_name" />

    </RelativeLayout>
</LinearLayout>


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

#nullable enable

using System.Collections.Immutable;

namespace Microsoft.CodeAnalysis
{
    internal sealed class CustomModifiersTuple
    {
        private readonly ImmutableArray<CustomModifier> _typeCustomModifiers;
        private readonly ImmutableArray<CustomModifier> _refCustomModifiers;
        public static readonly CustomModifiersTuple Empty = new CustomModifiersTuple(ImmutableArray<CustomModifier>.Empty, ImmutableArray<CustomModifier>.Empty);

        private CustomModifiersTuple(ImmutableArray<CustomModifier> typeCustomModifiers, ImmutableArray<CustomModifier> refCustomModifiers)
        {
            _typeCustomModifiers = typeCustomModifiers.NullToEmpty();
            _refCustomModifiers = refCustomModifiers.NullToEmpty();
        }

        public static CustomModifiersTuple Create(ImmutableArray<CustomModifier> typeCustomModifiers, ImmutableArray<CustomModifier> refCustomModifiers)
        {
            if (typeCustomModifiers.IsDefaultOrEmpty && refCustomModifiers.IsDefaultOrEmpty)
            {
                return Empty;
            }

            return new CustomModifiersTuple(typeCustomModifiers, refCustomModifiers);
        }

        public ImmutableArray<CustomModifier> TypeCustomModifiers { get { return _typeCustomModifiers; } }
        public ImmutableArray<CustomModifier> RefCustomModifiers { get { return _refCustomModifiers; } }
    }
}


text:
package fr.pizzeria.spring.config;

import java.util.logging.Level;
import java.util.logging.Logger;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;

import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;

public class WebAppInitializer implements WebApplicationInitializer {

	private static final Logger LOG = Logger.getLogger(WebAppInitializer.class.getName());

	@Override
	public void onStartup(ServletContext servletContext) throws ServletException {
		LOG.log(Level.INFO, "demarrage du serveur");

		// Initialisation du contexte Spring

		AnnotationConfigWebApplicationContext webContext = new AnnotationConfigWebApplicationContext();
		webContext.register(PizzeriaSpringConfig.class);

		ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher", new DispatcherServlet(webContext));
		dispatcher.setLoadOnStartup(1);

		dispatcher.addMapping("/api/*");

		servletContext.addListener(new ContextLoaderListener(webContext));
	}

}


text:
<?php
/**
 * Created by PhpStorm.
 * User: zenus
 * Date: 2015/8/7
 * Time: 14:53
 */

namespace it\icosaedro\lint\parsers;

use it\icosaedro\lint\Globals;
use it\icosaedro\lint\Flow;
use it\icosaedro\lint\statements\Statement;
use it\icosaedro\lint\statements\StaticStatement;

class StaticParser implements Parser
{

    /**
     * @param Globals $globals
     * @return int
     */
    public function parse(Globals $globals)
    {
        StaticStatement::parse($globals);
        Statement::parseStatementTerminator($globals);
        return Flow::NEXT_MASK;

    }
}