text:
using Microsoft.AspNetCore.Components;
using Money.Queries;
using Neptuo.Queries;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Money.Components
{
    public partial class DateBox
    {
        [Inject]
        protected IQueryDispatcher Queries { get; set; }

        [Parameter]
        public string Id { get; set; }

        [Parameter]
        public bool AutoFocus { get; set; }

        [Parameter]
        public DateTime Value { get; set; }

        [Parameter]
        public Action<DateTime> ValueChanged { get; set; }

        protected string Format { get; set; }

        protected async void OnAuthenticationChanged(bool isAuthenticated)
        {
            if (isAuthenticated)
            {
                Format = await Queries.QueryAsync(new GetDateFormatProperty());
                StateHasChanged();
            }
        }

        protected void OnValueChanged(ChangeEventArgs e)
        {
            string rawValue = e.Value?.ToString();
            if (TryParseDate(rawValue, Format, out var value) || TryParseDate(rawValue, SimplifyFormat(), out value) || DateTime.TryParse(rawValue, out value))
            {
                value = TimeZoneInfo.ConvertTimeToUtc(value).Date;
                ValueChanged?.Invoke(Value = value);
            }

            string SimplifyFormat()
                => Format.Replace("dd", "d").Replace("MM", "M");

            static bool TryParseDate(string rawValue, string format, out DateTime value)
                => DateTime.TryParseExact(rawValue, format, null, DateTimeStyles.None, out value);
        }
    }
}


text:
1. [yola](http://www.startupranking.com/yola)
2. [price-check](http://www.startupranking.com/price-check)
3. [gyft](http://www.startupranking.com/gyft)
4. [zando](http://www.startupranking.com/zando)
5. [payfast](http://www.startupranking.com/payfast)
6. [travelground](http://www.startupranking.com/travelground)
7. [naspers](http://www.startupranking.com/naspers)
8. [runwaysale](http://www.startupranking.com/runwaysale)
9. [web4africa](http://www.startupranking.com/web4africa)
10. [obox-instant](http://www.startupranking.com/obox-instant)
11. [now-novel](http://www.startupranking.com/now-novel)
12. [taxtim](http://www.startupranking.com/taxtim)
13. [ad-dynamo](http://www.startupranking.com/ad-dynamo)
14. [snapbill](http://www.startupranking.com/snapbill)
15. [2go](http://www.startupranking.com/2go)
16. [sweepsouth](http://www.startupranking.com/sweepsouth)
17. [rubybox](http://www.startupranking.com/rubybox)
18. [binu](http://www.startupranking.com/binu)
19. [myows](http://www.startupranking.com/myows)
20. [mxit](http://www.startupranking.com/mxit)
21. [snapplify](http://www.startupranking.com/snapplify)
22. [snapt](http://www.startupranking.com/snapt)
23. [peach-payments](http://www.startupranking.com/peach-payments)
24. [evly](http://www.startupranking.com/evly)
25. [glo-portal](http://www.startupranking.com/glo-portal)
26. [cognician](http://www.startupranking.com/cognician)
27. [cablekiosk](http://www.startupranking.com/cablekiosk)
28. [adoringdress](http://www.startupranking.com/adoringdress)
29. [cobi-interactive](http://www.startupranking.com/cobi-interactive)
30. [praczone](http://www.startupranking.com/praczone)
31. [moneysmart-sa](http://www.startupranking.com/moneysmart-sa)
32. [redfish.co.za](http://www.startupranking.com/redfish-co-za)
33. [obami](http://www.startupranking.com/obami)
34. [social-estate](http://www.startupranking.com/social-estate)
35. [skyrove](http://www.startupranking.com/skyrove)
36. [bozza](http://www.startupranking.com/bozza)
37. [blink-tower](http://www.startupranking.com/blink-tower)
38. [banting-box](http://www.startupranking.com/banting-box)
39. [mzansistore.com](http://www.startupranking.com/mzansistore-com)
40. [crowdcaster](http://www.startupranking.com/crowdcaster)
41. [adrenaline-hunter](http://www.startupranking.com/adrenaline-hunter)
42. [snapscan](http://www.startupranking.com/snapscan)
43. [waytag](http://www.startupranking.com/waytag)
44. [ubuntudeal](http://www.startupranking.com/ubuntudeal)
45. [afroes](http://www.startupranking.com/afroes)
46. [gometro](http://www.startupranking.com/gometro)
47. [nomanini](http://www.startupranking.com/nomanini)
48. [paperight](http://www.startupranking.com/paperight)
49. [dotnxt](http://www.startupranking.com/dotnxt)
50. [mowoza](http://www.startupranking.com/mowoza)
51. [brandrocket](http://www.startupranking.com/brandrocket)
52. [va.seo](http://www.startupranking.com/va-seo)
53. [rethink-education](http://www.startupranking.com/rethink-education)
54. [playshift](http://www.startupranking.com/playshift)
55. [homebug](http://www.startupranking.com/homebug)
56. [credit-salvage](http://www.startupranking.com/credit-salvage)
57. [firepaper](http://www.startupranking.com/firepaper)
58. [ebooze](http://www.startupranking.com/ebooze)
59. [we-are-monsters](http://www.startupranking.com/we-are-monsters)
60. [laudable](http://www.startupranking.com/laudable)
61. [gust-pay](http://www.startupranking.com/gust-pay)
62. [growth-space](http://www.startupranking.com/growth-space)
63. [she's-the-geek](http://www.startupranking.com/she-s-the-geek)
64. [streemout](http://www.startupranking.com/streemout)
65. [snipzilla.org](http://www.startupranking.com/snipzilla-org)
66. [jmlabs](http://www.startupranking.com/jmlabs)
67. [pocketplan](http://www.startupranking.com/pocketplan)
68. [iglobe-systems](http://www.startupranking.com/iglobe-systems)
69. [ekaya](http://www.startupranking.com/ekaya)
70. [site-portfolio-manager](http://www.startupranking.com/site-portfolio-manager)
71. [gigham](http://www.startupranking.com/gigham)
72. [hiring-bounty](http://www.startupranking.com/hiring-bounty)
73. [wabona](http://www.startupranking.com/wabona)
74. [zapacab](http://www.startupranking.com/zapacab)
75. [phoenix-fire-media-systems](http://www.startupranking.com/phoenix-fire-media-systems)
76. [sampleboard](http://www.startupranking.com/sampleboard)
77. [bottleshop.co.za](http://www.startupranking.com/bottleshop-co-za)
78. [skillpod-media](http://www.startupranking.com/skillpod-media)
79. [mobiflock](http://www.startupranking.com/mobiflock)
80. [hummba](http://www.startupranking.com/hummba)
81. [nicsocks](http://www.startupranking.com/nicsocks)
82. [trustfabric](http://www.startupranking.com/trustfabric)
83. [framework-one](http://www.startupranking.com/framework-one)
84. [firestring](http://www.startupranking.com/firestring)
85. [get-accepted](http://www.startupranking.com/get-accepted)
86. [execmobile](http://www.startupranking.com/execmobile)
87. [10layer](http://www.startupranking.com/10layer)
88. [real-time-wine](http://www.startupranking.com/real-time-wine)
89. [perk](http://www.startupranking.com/perk)
90. [4-anyhting](http://www.startupranking.com/4-anyhting)
91. [uusi](http://www.startupranking.com/uusi)
92. [glucode](http://www.startupranking.com/glucode)
93. [kuza](http://www.startupranking.com/kuza)
94. [skillzbook](http://www.startupranking.com/skillzbook)
95. [baobab-suite](http://www.startupranking.com/baobab-suite)
96. [found-shopping](http://www.startupranking.com/found-shopping)
97. [adtangerine](http://www.startupranking.com/adtangerine)
98. [streetmag](http://www.startupranking.com/streetmag)
99. [eafford](http://www.startupranking.com/eafford)
100. [chisana-tours](http://www.startupranking.com/chisana-tours)

redpajama_set_name: RedPajamaGithub


text:
package com.siyeh.ig.initialization;

import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import com.siyeh.ig.BaseInspectionVisitor;
import com.siyeh.ig.psiutils.ClassUtils;
import org.jetbrains.annotations.NotNull;

class NonFinalStaticVariableUsedInClassInitializationVisitor extends BaseInspectionVisitor {

  @Override
  public void visitReferenceExpression(@NotNull PsiReferenceExpression expression) {
    super.visitReferenceExpression(expression);
    final PsiElement referent = expression.resolve();
    if (!(referent instanceof PsiField)) {
      return;
    }
    final PsiField field = (PsiField)referent;
    if (!field.hasModifierProperty(PsiModifier.STATIC)) {
      return;
    }
    if (field.hasModifierProperty(PsiModifier.FINAL)) {
      return;
    }
    if (!isInClassInitialization(expression)) {
      return;
    }
    registerError(expression, field);
  }

  private static boolean isInClassInitialization(
    PsiExpression expression) {
    final PsiClass expressionClass =
      ClassUtils.getContainingClass(expression);
    final PsiMember member =
      PsiTreeUtil.getParentOfType(expression,
                                  PsiClassInitializer.class, PsiField.class);
    if (member == null) {
      return false;
    }
    final PsiClass memberClass = member.getContainingClass();
    if (!memberClass.equals(expressionClass)) {
      return false;
    }
    if (!member.hasModifierProperty(PsiModifier.STATIC)) {
      return false;
    }
    if (member instanceof PsiClassInitializer) {
      return !PsiUtil.isOnAssignmentLeftHand(expression);
    }
    return true;
  }
}


text:
package co.kuznetsov.restlets;

import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

public class InternalErrorException extends WebApplicationException {
    public InternalErrorException(String format, Object... params) {
        this(String.format(format, params));
    }

    public InternalErrorException(String message) {
        super(Response.status(Response.Status.INTERNAL_SERVER_ERROR)
                .entity(message).type(MediaType.TEXT_PLAIN).build());
    }
}


text:
package com.intellij.tasks;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import com.intellij.util.xmlb.annotations.Attribute;

/**
 * @author Mikhail Golubev
 */
public class CustomTaskState
{
	private String myId = "";
	private String myPresentableName = "";
	private boolean myPredefined;

	/**
	 * For serialization purposes only.
	 */
	public CustomTaskState()
	{
	}

	public CustomTaskState(@Nonnull String id, @Nonnull String name)
	{
		myId = id;
		myPresentableName = name;
	}

	/**
	 * Unique ID (e.g. number or unique name) of this state that can be used later to update state of an issue
	 * in {@link TaskRepository#setTaskState(Task, CustomTaskState)}.
	 *
	 * @see TaskRepository#setTaskState(Task, CustomTaskState)
	 */
	@Attribute("id")
	@Nonnull
	public String getId()
	{
		return myId;
	}

	/**
	 * For serialization purposes only.
	 */
	public void setId(@Nonnull String id)
	{
		myId = id;
	}

	/**
	 * Text that describes this state and will be shown to user in UI (unlike ID it's not necessarily unique).
	 */
	@Attribute("name")
	@Nonnull
	public String getPresentableName()
	{
		return myPresentableName;
	}

	/**
	 * For serialization purposes only.
	 */
	public void setPresentableName(@Nonnull String name)
	{
		myPresentableName = name;
	}

	@Override
	public boolean equals(Object o)
	{
		if(this == o)
		{
			return true;
		}
		if(!(o instanceof CustomTaskState))
		{
			return false;
		}

		final CustomTaskState state = (CustomTaskState) o;

		return myId.equals(state.myId);
	}

	@Override
	public int hashCode()
	{
		return myId.hashCode();
	}

	/**
	 * Creates custom state for which ID is identical to {@link TaskState#name} of the given predefined state and {@link #isPredefined()}
	 * returns true. If your repository provides only fixed set of available states, that are one of those described in {@link TaskState},
	 * you may find this methods useful to implement {@link TaskRepository#getAvailableTaskStates(Task)}.
	 *
	 * @return custom task state that represents given predefined state
	 * @see #asPredefined()
	 * @see #isPredefined()
	 * @see TaskRepository#getAvailableTaskStates(Task)
	 */
	@Nonnull
	public static CustomTaskState fromPredefined(@Nonnull TaskState state)
	{
		final CustomTaskState result = new CustomTaskState(state.name(), state.getPresentableName());
		result.setPredefined(true);
		return result;
	}

	/**
	 * Returns corresponding value of {@link TaskState} that has the same name as ID of this state.
	 * It's intended to be used for custom states created using {@link #fromPredefined}.
	 *
	 * @return predefined task state as described or {@code null} if such state doesn't exists or {@link #isPredefined()} returns false
	 * @see #isPredefined()
	 */
	@Nullable
	public TaskState asPredefined()
	{
		if(isPredefined())
		{
			try
			{
				return TaskState.valueOf(getId());
			}
			catch(IllegalArgumentException ignored)
			{
			}
		}
		return null;
	}

	/**
	 * Means that this custom state can be directly mapped to legacy {@link TaskState}. If it's false, {@link #asPredefined()} returns {@code null}.
	 * It's intended to be used mainly for compatibility with existing repositories.
	 *
	 * @see #asPredefined()
	 */
	@Attribute("predefined")
	public boolean isPredefined()
	{
		return myPredefined;
	}

	/**
	 * For serialization purposes only.
	 */
	public void setPredefined(boolean predefined)
	{
		myPredefined = predefined;
	}

	@Override
	public String toString()
	{
		return "CustomTaskState(id='" + myId + '\'' + ", name='" + myPresentableName + '\'' + ", predefined=" + myPredefined + ')';
	}
}


text:
title: engine-cleanup
category: feature
authors: herrold, simong
wiki_category: Feature
wiki_title: Features/engine-cleanup
wiki_revision_count: 12
wiki_last_updated: 2014-05-01
feature_name: Engine
feature_modules: "[nil]"
feature_status: Partial
---

# engine-cleanup

## Engine Cleanup (Work in progress)

### Summary

This utility is intended to bring the host to a state it can be reused by oVirt engine

### Owner

This should link to your home wiki page so we know who you are

*   Name: [ TBD](User:MyUser)

Include you email address that you can be reached should people want to contact you about helping with your feature, status is requested, or technical issues need to be resolved

*   Email: TBD

### Present

(To be replaced to a link when a design page is created)

      * Drop DB - works both on local and remote
      * Remove keystore (not perfect)
      * cleanup symlinks
      * stop services (jbossas, notifer)
      * non-interactive switch -u/--unattended, default is drop DB.
      * switch: -d/--dont-drop-db

### Absent

Missing to comply with the purpose definition:

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

      * Default mode is interactive - asking if to drop DB or not.
        Message: Drop data base? if you want to reuse the existing database for the future installation choose no.
      * Message at the end: Finished cleanup it is now safe to rerun engine-setup.
      * If it did not dropped DB add: Note that after re-install you'll have to run Hosts re-install/re-approve
      * Add -h/--help
      * Add message (Hide all options except -d/-u/-h in the usage message/help)

### Detailed Description

The cleanup should provide:

1. Reset a failed installation to a state in which you can safely rerun: engine-setup

2. Clean up before a new installation before or after the user has run:

      # yum remove

and the later tries it a second time without a formal clean-up being performed

* Meaning the sequence I (first example) :

      # engine-cleanup
      # yum remove ovirt-engine
      # yum install ovirt-engine
      # engine-setup

* Or the sequence II (second example):

      # yum remove ovirt-engine,
      # yum install ovirt-engine
      # engine-cleanup
      #  engine-setup

* If sequence II is not possible, don't start cleanup at all, but exit with proper message.

3. Reset an existing installation without dropping DB.

* Use cases: fix failed upgrade or a corrupted installation

* Next required 'Manual' steps:

      # yum remove engine
      # yum install engine
      # engine-setup   # This script should know how to reuse an existing DB, and to perform an upgrade if necessary

Note 1: The above includes Reports and DHW

Note 2. This utility is not intended to leave the machine clean for other application to reuse - only to be reused by a oVirt Manager

Note 3: Preserve DB is not intended to relocate db from local to remote and vice versa - Need to provide a procedure to do that.

Note 4: It will not remove any local NFS export, including the one it created during last installation. If we wish for engine-setup to reuse, this is enhancement to for engine-setup.

### Benefit to oVirt

This feature saved the need to re-install the host OS if a re-install of the engine is required. Currently in some cases even an initial installation failure may require clean install

### Dependencies / Related Features

### Documentation / External references

The clean-up script should be idempotent. If not, it needs a bug filed noting the deficiency. That is, one should be able to repeatedly run:

      # engine-cleanup
      # engine-cleanup
      # engine-cleanup # ...

with no additional changes occurring on the second and following runs, beyond what occurred on the first, and supplementation of the log files

### Comments and Discussion

This below adds a link to the "discussion" tab associated with your page. This provides the ability to have ongoing comments or conversation without bogging down the main feature page

*   Refer to <Talk:engine-cleanup>


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2015 JBoss, by Red Hat, Inc
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~       http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.uberfire</groupId>
    <artifactId>uberfire-extensions</artifactId>
    <version>0.9.0-SNAPSHOT</version>
  </parent>

  <artifactId>uberfire-extensions-deps</artifactId>
  <packaging>pom</packaging>

  <name>Uberfire Extensions Dependencies</name>
  <description>
    Declares all dependency versions in dependencyManagement.
    All modules extend this parent, except for the BOMs (which are used here).
  </description>

  <properties>
    <version.org.jboss.xnio>3.2.0.Final</version.org.jboss.xnio>
    <version.org.uberfire>${project.version}</version.org.uberfire>
    <version.com.ahome-it.lienzo-core>2.0.192-RC1</version.com.ahome-it.lienzo-core>
    <!-- Uberfire Security Management. -->
    <version.org.jboss.keycloak>1.4.0.Final</version.org.jboss.keycloak>
    <version.org.jboss.resteasy.client>3.0.9.Final</version.org.jboss.resteasy.client>
    <version.org.apache.tomcat>7.0.61</version.org.apache.tomcat>
    <version.org.jboss.wildfly>8.2.0.Final</version.org.jboss.wildfly>
    <version.org.jboss.errai>4.0.0-SNAPSHOT</version.org.jboss.errai>
  </properties>

  <dependencyManagement>
    <dependencies>

      <!-- Uberfire  -->
      <dependency>
        <groupId>org.uberfire</groupId>
        <artifactId>uberfire-parent-with-dependencies</artifactId>
        <version>${version.org.uberfire}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>

      <!-- Uberfire extensions -->
      <dependency>
        <groupId>org.uberfire</groupId>
        <artifactId>uberfire-extensions-bom</artifactId>
        <type>pom</type>
        <version>${project.version}</version>
        <scope>import</scope>
      </dependency>

      <!-- Override needed by Errai Embedded WildFly -->
      <dependency>
        <groupId>org.jboss.xnio</groupId>
        <artifactId>xnio-api</artifactId>
        <version>${version.org.jboss.xnio}</version>
      </dependency>
      <dependency>
        <groupId>org.jboss.xnio</groupId>
        <artifactId>xnio-nio</artifactId>
        <version>${version.org.jboss.xnio}</version>
      </dependency>

      <!-- Lienzo -->
      <dependency>
        <groupId>com.ahome-it</groupId>
        <artifactId>lienzo-core</artifactId>
        <version>${version.com.ahome-it.lienzo-core}</version>
      </dependency>

      <!-- Uberfire Security Management - KeyCloak. -->
      <dependency>
        <groupId>org.keycloak</groupId>
        <artifactId>keycloak-core</artifactId>
        <version>${version.org.jboss.keycloak}</version>
      </dependency>

      <dependency>
        <groupId>org.keycloak</groupId>
        <artifactId>keycloak-model-api</artifactId>
        <version>${version.org.jboss.keycloak}</version>
      </dependency>

      <dependency>
        <groupId>org.keycloak</groupId>
        <artifactId>keycloak-adapter-core</artifactId>
        <version>${version.org.jboss.keycloak}</version>
      </dependency>

      <dependency>
        <groupId>org.keycloak</groupId>
        <artifactId>keycloak-account-api</artifactId>
        <version>${version.org.jboss.keycloak}</version>
      </dependency>

      <dependency>
        <groupId>org.keycloak</groupId>
        <artifactId>keycloak-events-api</artifactId>
        <version>${version.org.jboss.keycloak}</version>
      </dependency>

      <dependency>
        <groupId>org.keycloak</groupId>
        <artifactId>keycloak-admin-client</artifactId>
        <version>${version.org.jboss.keycloak}</version>
      </dependency>

      <!-- Required JAXRS API v3 by Keycloak admin client.
          This dependency is declared as optional in 'uberfire-security-management-keycloak' module,
          so not transitively added if module is not used.
      -->
      <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>jaxrs-api</artifactId>
        <version>${version.org.jboss.resteasy.client}</version>
      </dependency>

      <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-client</artifactId>
        <version>${version.org.jboss.resteasy.client}</version>
      </dependency>

      <!-- Uberfire Security Management - EAP / Wdilfly. -->
      <dependency>
        <groupId>org.wildfly</groupId>
        <artifactId>wildfly-controller-client</artifactId>
        <version>${version.org.jboss.wildfly}</version>
      </dependency>

      <dependency>
        <groupId>org.wildfly</groupId>
        <artifactId>wildfly-domain-management</artifactId>
        <version>${version.org.jboss.wildfly}</version>
      </dependency>

      <!-- Uberfire Security Management - Tomcat. -->
      <dependency>
        <groupId>org.apache.tomcat</groupId>
        <artifactId>tomcat-catalina</artifactId>
        <version>${version.org.apache.tomcat}</version>
      </dependency>

      <dependency>
        <groupId>org.apache.tomcat</groupId>
        <artifactId>tomcat-coyote</artifactId>
        <version>${version.org.apache.tomcat}</version>
      </dependency>

      <dependency>
        <groupId>org.apache.tomcat</groupId>
        <artifactId>tomcat-util</artifactId>
        <version>${version.org.apache.tomcat}</version>
      </dependency>

    </dependencies>

  </dependencyManagement>

</project>


text:
package org.apache.arrow.vector.file.json;

import static com.fasterxml.jackson.core.JsonToken.END_ARRAY;
import static com.fasterxml.jackson.core.JsonToken.END_OBJECT;
import static com.fasterxml.jackson.core.JsonToken.START_ARRAY;
import static com.fasterxml.jackson.core.JsonToken.START_OBJECT;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.apache.arrow.vector.schema.ArrowVectorType.OFFSET;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.google.common.collect.ImmutableList;
import org.apache.arrow.memory.BufferAllocator;
import org.apache.arrow.vector.BigIntVector;
import org.apache.arrow.vector.BitVector;
import org.apache.arrow.vector.BufferBacked;
import org.apache.arrow.vector.DateDayVector;
import org.apache.arrow.vector.DateMilliVector;
import org.apache.arrow.vector.FieldVector;
import org.apache.arrow.vector.Float4Vector;
import org.apache.arrow.vector.Float8Vector;
import org.apache.arrow.vector.IntVector;
import org.apache.arrow.vector.SmallIntVector;
import org.apache.arrow.vector.TimeMicroVector;
import org.apache.arrow.vector.TimeMilliVector;
import org.apache.arrow.vector.TimeNanoVector;
import org.apache.arrow.vector.TimeSecVector;
import org.apache.arrow.vector.TimeStampMicroTZVector;
import org.apache.arrow.vector.TimeStampMicroVector;
import org.apache.arrow.vector.TimeStampMilliTZVector;
import org.apache.arrow.vector.TimeStampMilliVector;
import org.apache.arrow.vector.TimeStampNanoTZVector;
import org.apache.arrow.vector.TimeStampNanoVector;
import org.apache.arrow.vector.TimeStampSecTZVector;
import org.apache.arrow.vector.TimeStampSecVector;
import org.apache.arrow.vector.TinyIntVector;
import org.apache.arrow.vector.UInt1Vector;
import org.apache.arrow.vector.UInt2Vector;
import org.apache.arrow.vector.UInt4Vector;
import org.apache.arrow.vector.UInt8Vector;
import org.apache.arrow.vector.ValueVector;
import org.apache.arrow.vector.ValueVector.Mutator;
import org.apache.arrow.vector.VarBinaryVector;
import org.apache.arrow.vector.VarCharVector;
import org.apache.arrow.vector.VectorSchemaRoot;
import org.apache.arrow.vector.complex.NullableMapVector;
import org.apache.arrow.vector.dictionary.Dictionary;
import org.apache.arrow.vector.dictionary.DictionaryProvider;
import org.apache.arrow.vector.schema.ArrowVectorType;
import org.apache.arrow.vector.types.pojo.Field;
import org.apache.arrow.vector.types.pojo.Schema;
import org.apache.arrow.vector.util.DictionaryUtility;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;

import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.MappingJsonFactory;
import com.google.common.base.Objects;

public class JsonFileReader implements AutoCloseable, DictionaryProvider {
  private final File inputFile;
  private final JsonParser parser;
  private final BufferAllocator allocator;
  private Schema schema;
  private Map<Long, Dictionary> dictionaries;
  private Boolean started = false;

  public JsonFileReader(File inputFile, BufferAllocator allocator) throws JsonParseException, IOException {
    super();
    this.inputFile = inputFile;
    this.allocator = allocator;
    MappingJsonFactory jsonFactory = new MappingJsonFactory();
    this.parser = jsonFactory.createParser(inputFile);
  }

  @Override
  public Dictionary lookup(long id) {
    if (!started) {
      throw new IllegalStateException("Unable to lookup until after read() has started");
    }

    return dictionaries.get(id);
  }

  public Schema start() throws JsonParseException, IOException {
    readToken(START_OBJECT);
    {
      Schema originalSchema = readNextField("schema", Schema.class);
      List<Field> fields = new ArrayList<>();
      dictionaries = new HashMap<>();

      // Convert fields with dictionaries to have the index type
      for (Field field: originalSchema.getFields()) {
        fields.add(DictionaryUtility.toMemoryFormat(field, allocator, dictionaries));
      }
      this.schema = new Schema(fields, originalSchema.getCustomMetadata());

      if (!dictionaries.isEmpty()) {
        nextFieldIs("dictionaries");
        readDictionaryBatches();
      }

      nextFieldIs("batches");
      readToken(START_ARRAY);
      started = true;
      return this.schema;
    }
  }

  private void readDictionaryBatches() throws JsonParseException, IOException {
    readToken(START_ARRAY);
    JsonToken token = parser.nextToken();
    boolean haveDictionaryBatch = token == START_OBJECT;
    while (haveDictionaryBatch) {

      // Lookup what dictionary for the batch about to be read
      long id = readNextField("id", Long.class);
      Dictionary dict = dictionaries.get(id);
      if (dict == null) {
        throw new IllegalArgumentException("Dictionary with id: " + id + " missing encoding from schema Field");
      }

      // Read the dictionary record batch
      nextFieldIs("data");
      FieldVector vector = dict.getVector();
      List<Field> fields = ImmutableList.of(vector.getField());
      List<FieldVector> vectors = ImmutableList.of(vector);
      VectorSchemaRoot root = new VectorSchemaRoot(fields, vectors, vector.getAccessor().getValueCount());
      read(root);

      readToken(END_OBJECT);
      token = parser.nextToken();
      haveDictionaryBatch = token == START_OBJECT;
    }

    if (token != END_ARRAY) {
      throw new IllegalArgumentException("Invalid token: " + token + " expected end of array at " + parser.getTokenLocation());
    }
  }

  public boolean read(VectorSchemaRoot root) throws IOException {
    JsonToken t = parser.nextToken();
    if (t == START_OBJECT) {
      {
        int count = readNextField("count", Integer.class);
        root.setRowCount(count);
        nextFieldIs("columns");
        readToken(START_ARRAY);
        {
          for (Field field : root.getSchema().getFields()) {
            FieldVector vector = root.getVector(field.getName());
            readVector(field, vector);
          }
        }
        readToken(END_ARRAY);
      }
      readToken(END_OBJECT);
      return true;
    } else if (t == END_ARRAY) {
      root.setRowCount(0);
      return false;
    } else {
      throw new IllegalArgumentException("Invalid token: " + t);
    }
  }

  public VectorSchemaRoot read() throws IOException {
    JsonToken t = parser.nextToken();
    if (t == START_OBJECT) {
      VectorSchemaRoot recordBatch = VectorSchemaRoot.create(schema, allocator);
      {
        int count = readNextField("count", Integer.class);
        recordBatch.setRowCount(count);
        nextFieldIs("columns");
        readToken(START_ARRAY);
        {
          for (Field field : schema.getFields()) {
            FieldVector vector = recordBatch.getVector(field.getName());
            readVector(field, vector);
          }
        }
        readToken(END_ARRAY);
      }
      readToken(END_OBJECT);
      return recordBatch;
    } else if (t == END_ARRAY) {
      return null;
    } else {
      throw new IllegalArgumentException("Invalid token: " + t);
    }
  }

  private void readVector(Field field, FieldVector vector) throws JsonParseException, IOException {
    List<ArrowVectorType> vectorTypes = field.getTypeLayout().getVectorTypes();
    List<BufferBacked> fieldInnerVectors = vector.getFieldInnerVectors();
    if (vectorTypes.size() != fieldInnerVectors.size()) {
      throw new IllegalArgumentException("vector types and inner vectors are not the same size: " + vectorTypes.size() + " != " + fieldInnerVectors.size());
    }
    readToken(START_OBJECT);
    {
      // If currently reading dictionaries, field name is not important so don't check
      String name = readNextField("name", String.class);
      if (started && !Objects.equal(field.getName(), name)) {
        throw new IllegalArgumentException("Expected field " + field.getName() + " but got " + name);
      }
      int count = readNextField("count", Integer.class);
      for (int v = 0; v < vectorTypes.size(); v++) {
        ArrowVectorType vectorType = vectorTypes.get(v);
        BufferBacked innerVector = fieldInnerVectors.get(v);
        nextFieldIs(vectorType.getName());
        readToken(START_ARRAY);
        ValueVector valueVector = (ValueVector)innerVector;
        valueVector.allocateNew();
        Mutator mutator = valueVector.getMutator();

        int innerVectorCount = vectorType.equals(OFFSET) ? count + 1 : count;
        for (int i = 0; i < innerVectorCount; i++) {
          parser.nextToken();
          setValueFromParser(valueVector, i);
        }
        mutator.setValueCount(innerVectorCount);
        readToken(END_ARRAY);
      }
      // if children
      List<Field> fields = field.getChildren();
      if (!fields.isEmpty()) {
        List<FieldVector> vectorChildren = vector.getChildrenFromFields();
        if (fields.size() != vectorChildren.size()) {
          throw new IllegalArgumentException("fields and children are not the same size: " + fields.size() + " != " + vectorChildren.size());
        }
        nextFieldIs("children");
        readToken(START_ARRAY);
        for (int i = 0; i < fields.size(); i++) {
          Field childField = fields.get(i);
          FieldVector childVector = vectorChildren.get(i);
          readVector(childField, childVector);
        }
        readToken(END_ARRAY);
      }
      if (vector instanceof NullableMapVector) {
        ((NullableMapVector)vector).valueCount = count;
      }
    }
    readToken(END_OBJECT);
  }

  private byte[] decodeHexSafe(String hexString) throws IOException {
    try {
      return Hex.decodeHex(hexString.toCharArray());
    } catch (DecoderException e) {
      throw new IOException("Unable to decode hex string: " + hexString, e);
    }
  }

  private void setValueFromParser(ValueVector valueVector, int i) throws IOException {
    switch (valueVector.getMinorType()) {
    case BIT:
      ((BitVector)valueVector).getMutator().set(i, parser.readValueAs(Boolean.class) ? 1 : 0);
      break;
    case TINYINT:
      ((TinyIntVector)valueVector).getMutator().set(i, parser.readValueAs(Integer.class));
      break;
    case SMALLINT:
      ((SmallIntVector)valueVector).getMutator().set(i, parser.readValueAs(Integer.class));
      break;
    case INT:
      ((IntVector)valueVector).getMutator().set(i, parser.readValueAs(Integer.class));
      break;
    case BIGINT:
      ((BigIntVector)valueVector).getMutator().set(i, parser.readValueAs(Long.class));
      break;
    case UINT1:
      ((UInt1Vector)valueVector).getMutator().set(i, parser.readValueAs(Integer.class));
      break;
    case UINT2:
      ((UInt2Vector)valueVector).getMutator().set(i, parser.readValueAs(Integer.class));
      break;
    case UINT4:
      ((UInt4Vector)valueVector).getMutator().set(i, parser.readValueAs(Integer.class));
      break;
    case UINT8:
      ((UInt8Vector)valueVector).getMutator().set(i, parser.readValueAs(Long.class));
      break;
    case FLOAT4:
      ((Float4Vector)valueVector).getMutator().set(i, parser.readValueAs(Float.class));
      break;
    case FLOAT8:
      ((Float8Vector)valueVector).getMutator().set(i, parser.readValueAs(Double.class));
      break;
    case VARBINARY:
      ((VarBinaryVector)valueVector).getMutator().setSafe(i, decodeHexSafe(parser.readValueAs(String.class)));
      break;
    case VARCHAR:
      ((VarCharVector)valueVector).getMutator().setSafe(i, parser.readValueAs(String.class).getBytes(UTF_8));
      break;
    case DATEDAY:
      ((DateDayVector)valueVector).getMutator().set(i, parser.readValueAs(Integer.class));
      break;
    case DATEMILLI:
      ((DateMilliVector)valueVector).getMutator().set(i, parser.readValueAs(Long.class));
      break;
    case TIMESEC:
      ((TimeSecVector)valueVector).getMutator().set(i, parser.readValueAs(Integer.class));
      break;
    case TIMEMILLI:
      ((TimeMilliVector)valueVector).getMutator().set(i, parser.readValueAs(Integer.class));
      break;
    case TIMEMICRO:
      ((TimeMicroVector)valueVector).getMutator().set(i, parser.readValueAs(Long.class));
      break;
    case TIMENANO:
      ((TimeNanoVector)valueVector).getMutator().set(i, parser.readValueAs(Long.class));
      break;
    case TIMESTAMPSEC:
      ((TimeStampSecVector)valueVector).getMutator().set(i, parser.readValueAs(Long.class));
      break;
    case TIMESTAMPMILLI:
      ((TimeStampMilliVector)valueVector).getMutator().set(i, parser.readValueAs(Long.class));
      break;
    case TIMESTAMPMICRO:
      ((TimeStampMicroVector)valueVector).getMutator().set(i, parser.readValueAs(Long.class));
      break;
    case TIMESTAMPNANO:
      ((TimeStampNanoVector)valueVector).getMutator().set(i, parser.readValueAs(Long.class));
      break;
    case TIMESTAMPSECTZ:
      ((TimeStampSecTZVector)valueVector).getMutator().set(i, parser.readValueAs(Long.class));
      break;
    case TIMESTAMPMILLITZ:
      ((TimeStampMilliTZVector)valueVector).getMutator().set(i, parser.readValueAs(Long.class));
      break;
    case TIMESTAMPMICROTZ:
      ((TimeStampMicroTZVector)valueVector).getMutator().set(i, parser.readValueAs(Long.class));
      break;
    case TIMESTAMPNANOTZ:
      ((TimeStampNanoTZVector)valueVector).getMutator().set(i, parser.readValueAs(Long.class));
      break;
    default:
      throw new UnsupportedOperationException("minor type: " + valueVector.getMinorType());
    }
  }

  @Override
  public void close() throws IOException {
    parser.close();
    for (Dictionary dictionary: dictionaries.values()) {
      dictionary.getVector().close();
    }
  }

  private <T> T readNextField(String expectedFieldName, Class<T> c) throws IOException, JsonParseException {
    nextFieldIs(expectedFieldName);
    parser.nextToken();
    return parser.readValueAs(c);
  }

  private void nextFieldIs(String expectedFieldName) throws IOException, JsonParseException {
    String name = parser.nextFieldName();
    if (name == null || !name.equals(expectedFieldName)) {
      throw new IllegalStateException("Expected " + expectedFieldName + " but got " + name);
    }
  }

  private void readToken(JsonToken expected) throws JsonParseException, IOException {
    JsonToken t = parser.nextToken();
    if (t != expected) {
      throw new IllegalStateException("Expected " + expected + " but got " + t);
    }
  }

}


text:
package com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Data.Component;

import com.google.security.zynamics.binnavi.CUtilityFunctions;
import com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException;
import com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException;
import com.google.security.zynamics.binnavi.disassembly.types.TypeInstance;
import com.google.security.zynamics.binnavi.disassembly.types.TypeInstanceContainer;
import com.google.security.zynamics.binnavi.disassembly.types.TypeManager;
import com.google.security.zynamics.zylib.gui.GuiHelper;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.JFrame;

/**
 * The action to edit an existing {@link TypeInstance type instance}.
 */
public class EditTypeInstanceAction extends AbstractAction {

  private final JFrame owner;
  private final TypeInstance instance;
  private final TypeInstanceContainer instanceContainer;
  private final TypeManager typeManager;

  public EditTypeInstanceAction(final JFrame owner, final TypeManager typeManager,
      final TypeInstance instance, final TypeInstanceContainer instanceContainer) {
    super("Edit type instance");
    this.owner = owner;
    this.typeManager = typeManager;
    this.instance = instance;
    this.instanceContainer = instanceContainer;
  }

  @Override
  public void actionPerformed(final ActionEvent e) {
    final TypeInstanceDialog dlg =
        TypeInstanceDialog.instantiateEditTypeInstanceDialog(owner, typeManager, instance);
    GuiHelper.centerChildToParent(owner, dlg, true);
    dlg.setVisible(true);
    if (dlg.wasOkClicked()) {
      try {
        instanceContainer.setInstanceName(instance, dlg.getInstanceName());
      } catch (CouldntSaveDataException | CouldntLoadDataException exception) {
        CUtilityFunctions.logException(exception);
      }
    }
  }
}


text:
'use strict';

var debug = require('debug')('swara:main');
var app = require('app');
var BrowserWindow = require('browser-window');
var devHelper = require('./libs/electron/devHelper');
var windowStateKeeper = require('./libs/electron/windowState');
var directoryPickerIPC = require('./libs/electron/directoryPickerIPC');
var mainWindow = null;

// Preserver of the window size and position between app launches.
var mainWindowState = windowStateKeeper('main', {
  width  : 1366,
  height : 768
});

debug('Setting up the app ready handler');
app.on('ready', function () {
  debug('Beginning the electron app ready handler');
  mainWindow = new BrowserWindow({
    x      : mainWindowState.x,
    y      : mainWindowState.y,
    width  : mainWindowState.width,
    height : mainWindowState.height
  });

  if (mainWindowState.isMaximized) {
    mainWindow.maximize();
  }

  //set up IPC for opening the directory picker from the angular directive
  directoryPickerIPC.setupIPC(mainWindow);

  // load the loading page
  mainWindow.loadUrl('file://' + __dirname + '/bootstrap/index.html');

  devHelper.setDevMenu();
  // mainWindow.openDevTools();

  mainWindow.on('close', function () {
    var shutdownHandler = require('./bootstrap/shutdown');
    shutdownHandler.shutdown();
    mainWindowState.saveState(mainWindow);
  });

  // navigate to the meanjs app
  debug('Setting the startupHandler.ready handler to navigate to the meanjs app');
  var startupHandler = require('./bootstrap/startup.js');
  startupHandler.ready(function () {
    debug('Within the server ready callback - about to redirect to the home page');
    mainWindow.loadUrl('http://localhost:3000/');
  });

  mainWindow.on('closed', function () {
    mainWindow = null;
  });

  // get the logs directory from the electron supplied user data folder
  var userDataDirectory = app.getPath('userData');
  debug('User Data Directory: %s', userDataDirectory);

  // Start the server passing in the logs directory
  debug('Starting the MEAN app');
  startupHandler.start(userDataDirectory);

  debug('Finishing the elctron app ready handler');
});

app.on('window-all-closed', function () {
  if (process.platform !== 'darwin') {
    app.quit();
  }
});


text:
package org.dashbuilder.dataset.backend.exception;

import org.jboss.errai.config.rebind.EnvUtil;
import org.slf4j.Logger;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;

/**
 *
Handles backend exceptions.

 *
 * @since 0.3.0
 */
@ApplicationScoped
public class ExceptionManager {

    @Inject
    private Logger log;

    /**
     *
Return a @Portable RuntimeException that can be captured by client side widgets.

     *
     * @param e The exception that caused the error.
     * @return The portable exception to send to the client side.
     */
    public RuntimeException handleException(final Exception e) {
        log.error(e.getMessage(), e);
        if (e instanceof RuntimeException && EnvUtil.isPortableType(e.getClass()) ) {
            return (RuntimeException) e;
        }
        return new GenericPortableException( e.getMessage(), e );
    }
}


text:
package twitter4j.management;

/**
 * Object that collects/aggregates statistics for the invocation of a given method.
 *
 * @author Nick Dellamaggiore (nick.dellamaggiore <at> gmail.com)
 */
public class InvocationStatisticsCalculator implements InvocationStatistics {
    private String name;
    private long[] times;
    private int index;
    private long callCount;
    private long errorCount;
    private long totalTime;

    /**
     * @param name        the name of this API method
     * @param historySize the number of calls to track (for invocation time averaging)
     */
    public InvocationStatisticsCalculator(String name, int historySize) {
        this.name = name;
        times = new long[historySize];
    }

    void increment(long time, boolean success) {
        callCount++;
        errorCount += success ? 0 : 1;
        totalTime += time;

        times[index] = time;

        if (++index >= times.length)
            index = 0;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public long getCallCount() {
        return callCount;
    }

    @Override
    public long getErrorCount() {
        return errorCount;
    }

    @Override
    public long getTotalTime() {
        return totalTime;
    }

    @Override
    public synchronized long getAverageTime() {
        int stopIndex = Math.min(Math.abs((int) callCount), times.length);
        if (stopIndex == 0) {
            return 0;
        }

        long totalTime = 0;
        for (int i = 0; i < stopIndex; i++) {
            totalTime += times[i];

        }
        return totalTime / stopIndex;
    }

    @Override
    public synchronized void reset() {
        callCount = 0;
        errorCount = 0;
        totalTime = 0;
        times = new long[times.length];
        index = 0;
    }

    @Override
    public String toString() {
        // StringBuilder is faster... do we still need to support JDK 1.4?
        StringBuilder sb = new StringBuilder();
        sb.append("calls=").append(getCallCount()).append(",")
                .append("errors=").append(getErrorCount()).append(",")
                .append("totalTime=").append(getTotalTime()).append(",")
                .append("avgTime=").append(getAverageTime());

        return sb.toString();
    }
}


text:
package com.unifonic.sdk.resources;

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

import com.unifonic.sdk.model.messages.BulkRequest;
import com.unifonic.sdk.model.messages.BulkResponse;
import com.unifonic.sdk.model.messages.MessageIDStatus;
import com.unifonic.sdk.model.messages.MessageRequest;
import com.unifonic.sdk.model.messages.MessageResponse;
import com.unifonic.sdk.model.messages.MessagesDetailsRequest;
import com.unifonic.sdk.model.messages.MessagesDetailsResponse;
import com.unifonic.sdk.model.messages.MessagesReportRequest;
import com.unifonic.sdk.model.messages.MessagesReportResponse;

/**
 * Messages sub-resource is used to send text messages and to inquire sent
 * message details
 *
 * @author Eri Setiawan
 */
public interface IMessageResource extends IResource {

    /**
     * Send enables API to send a message for only one recipient; you must have
     * sufficient balance or an active package to send to your desired
     * destination.
     *
     * @param param
     * @return
     * @throws IOException
     */
    public MessageResponse send(MessageRequest param) throws IOException;

    /**
     * Send enables API to send a message for only one recipient; you must have
     * sufficient balance or an active package to send to your desired
     * destination.
     *
     * @param param
     * @return
     * @throws IOException
     */
    public MessageResponse send(Map<String, String> param) throws IOException;

    /**
     * SendBulk enables API to send bulk messages for multi recipiencts
     * seperated by commas, Using SendBulk API requieres authorized API Access,
     * to get your authurized access contact us.
     *
     * @param param
     * @return
     * @throws IOException
     */
    public BulkResponse sendBulk(BulkRequest param) throws IOException;

    /**
     * SendBulk enables API to send bulk messages for multi recipiencts
     * seperated by commas, Using SendBulk API requieres authorized API Access,
     * to get your authurized access contact us.
     *
     * @param param
     * @return
     * @throws IOException
     */
    public BulkResponse sendBulk(Map<String, String> param) throws IOException;

    public MessageIDStatus getMessageIDStatus(String messageID) throws IOException;

    public MessagesReportResponse getMessagesReport() throws IOException;

    public MessagesReportResponse getMessagesReport(Map<String, String> param) throws IOException;

    public MessagesReportResponse getMessagesReport(MessagesReportRequest request) throws IOException;

    public MessagesDetailsResponse getMessagesDetails(MessagesDetailsRequest request) throws IOException;

    public MessagesDetailsResponse getMessagesDetails(Map<String, String> param) throws IOException;

    public MessagesDetailsResponse getMessagesDetails() throws IOException;
}


text:
.. role:: envvar(literal)
.. role:: command(literal)
.. role:: file(literal)
.. _gallery.movingpde:

Moving FEM
**********

.. todo::

   Not yet validated

.. include:: anidiffmmpde.rst

.. Local Variables:
.. mode: rst
.. End:


text:
struct IGeometry {
  virtual void Update(const unsigned int dt) = 0;
  virtual void Draw(const Renderer *renderer) const = 0;

  virtual void TouchBegan(const GLKVector2 &point) {}
  virtual void TouchEnd(const GLKVector2 &point) {}
  virtual void TouchMove(const GLKVector2 &point) {}
};

#endif


text:
var Fluxer = require('fluxerjs');

var MemberStore = module.exports = Fluxer.createStore('Member');

var info = {
	pageCount: 1,
	perPage: 100,
	page: 1
};
var members = {};

Fluxer.on('Member.New', function() {
	MemberStore.emit('OpenNewModal');
});

Fluxer.on('Member.Open', function(member) {
	MemberStore.emit('OpenEditModal', member);
});

Fluxer.on('Member.GetInfo', function() {
	MemberStore.emit('InfoUpdated', info);
});

Fluxer.on('Member.Fetch', function(page, perPage, queries) {

	$.get('/members?page=' + page + '&perpage=' + perPage + ((Object.keys(queries).length) ? '&q=' + JSON.stringify(queries) : '') , function(results) {

		info.page = results.page;
		info.perPage = results.perPage;
		info.pageCount = results.pageCount;
		info.queries = queries;

		// Refresh list
		members = {};
		for (var index in results.members) {
			var member = results.members[index];
			member.updated = member.updated.replace('T', ' ').split('.')[0];
			member.created = member.created.split('T')[0];
			members[member._id] = member;
		}

		MemberStore.emit('Refresh', info, members);
		MemberStore.emit('InfoUpdated', info);

	}.bind(this));
});

Fluxer.on('Member.Updated', function(members) {

	for (var index in members) {
		var member = members[index];
		members[member._id] = member;
	}

	MemberStore.emit('MembersUpdated', members);
});

Fluxer.on('Member.Manage', function() {
	MemberStore.emit('OpenManagement');
});

Fluxer.on('Member.Blur', function() {
	MemberStore.emit('CloseManagement');
});

Fluxer.on('Member.FetchAwards', function(memberId) {

	$.get('/member/' + memberId + '/awards', function(results) {
		MemberStore.emit('AwardsUpdated', results);
	});
});

Fluxer.on('Member.AddAwards', function(memberId, awards) {

	$.ajax({
		type: 'post',
		url: '/member/' + memberId + '/awards',
		processData: false,
		contentType: 'application/json',
		data: JSON.stringify({
			awards: awards
		}),
		success: function(r) {
			console.log(r);
			MemberStore.emit('AwardsUpdated', r);
		}
	});
});


text:
require 'spec_helper'

describe JshintRuby do

  describe "When no linting errors are returned" do

    let(:source) { File.open('spec/fixtures/source.js') }

    it 'is valid' do
      expect(JshintRuby.run(source)).to be_valid
    end

  end

  describe "When linting errors are returned" do

    let(:source) { File.open('spec/fixtures/errors.js') }
    let(:result) { JshintRuby.run(source, {}) }

    it 'is not valid' do
      expect(result).not_to be_valid
    end

    it 'errors are accessible' do
      expect(result.errors.first).to include('id', 'raw', 'code', 'line', 'character', 'scope', 'reason')
    end
  end

  describe "When passing options" do
    let(:options) { { eqeqeq: true } }
    let(:source) { File.open('spec/fixtures/errors_with_options.js') }

    it 'passes the options to JSHint correctly' do
      result = JshintRuby.run(source, {})
      expect(result).not_to be_valid
      expect(result.errors.first).to include("reason" => "Use '===' to compare with 'true'.")
    end
  end
end


text:
#pragma once

#include <VoxieBackend/VoxieBackend.hpp>

#include <VoxieBackend/IO/Operation.hpp>
#include <VoxieBackend/IO/OperationResult.hpp>

namespace vx {
class Data;
class DataNode;
class DataVersion;
class OperationResultImport;

class VOXIEBACKEND_EXPORT OperationImport : public vx::io::Operation {
  Q_OBJECT
  REFCOUNTEDOBJ_DECL(OperationImport)

 public:
  class VOXIEBACKEND_EXPORT Result : public Operation::ResultSuccess {
    QSharedPointer<vx::Data> data_;
    QSharedPointer<vx::DataVersion> dataVersion_;

    QMutex mutex;

    // TODO: This should be a QSharedPointer
    // QSharedPointer<vx::DataNode> dataNode;
    vx::DataNode* dataNode_;
    // Needed because DataNode is not in VoxieBackend
    QDBusObjectPath dataNodePath_;

    bool isFinal = false;

   public:
    Result(const QSharedPointer<vx::Data>& data,
           const QSharedPointer<vx::DataVersion>& dataVersion);
    ~Result() override;

    const QSharedPointer<vx::Data>& data() const { return data_; }
    const QSharedPointer<vx::DataVersion>& dataVersion() const {
      return dataVersion_;
    }

    vx::DataNode* dataNode();
    QDBusObjectPath dataNodePath();
    void setDataNode(vx::DataNode* obj, const QDBusObjectPath& dataNodePath);
    void makeFinal();
  };

  using ResultWrapper = OperationResultImport;

  OperationImport();
  ~OperationImport();
};

// Note: This is a separate class to allow forward declarations to it
class VOXIEBACKEND_EXPORT OperationResultImport : public OperationResult {
  REFCOUNTEDOBJ_DECL(OperationResultImport)

  bool doCreateNode_;

 public:
  OperationResultImport(const QSharedPointer<OperationImport>& operation,
                        bool doCreateNode);
  ~OperationResultImport() override;

  bool doCreateNode() const { return doCreateNode_; }

  QSharedPointer<OperationImport::Result> resultSuccess();
};
}  // namespace vx


text:
package libra.group.common;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import libra.common.json.JsonSerializer;
import libra.preprocess.common.PreprocessorConfig;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonProperty;

/**
 *
 * @author iychoi
 */
public class GroupConfig {

    public static final long DEFAULT_GROUPSIZE = PreprocessorConfig.DEFAULT_GROUPSIZE;
    public static final int DEFAULT_MAX_GROUPNUM = PreprocessorConfig.DEFAULT_MAX_GROUPNUM;

    protected static final String HADOOP_CONFIG_KEY = "libra.group.common.groupconfig";

    private long groupSize = DEFAULT_GROUPSIZE;
    private int maxGroupNum = DEFAULT_MAX_GROUPNUM;
    private List<String> samplePaths = new ArrayList<String>();

    public static GroupConfig createInstance(File file) throws IOException {
        JsonSerializer serializer = new JsonSerializer();
        return (GroupConfig) serializer.fromJsonFile(file, GroupConfig.class);
    }

    public static GroupConfig createInstance(String json) throws IOException {
        JsonSerializer serializer = new JsonSerializer();
        return (GroupConfig) serializer.fromJson(json, GroupConfig.class);
    }

    public static GroupConfig createInstance(Configuration conf) throws IOException {
        JsonSerializer serializer = new JsonSerializer();
        return (GroupConfig) serializer.fromJsonConfiguration(conf, HADOOP_CONFIG_KEY, GroupConfig.class);
    }

    public static GroupConfig createInstance(FileSystem fs, Path file) throws IOException {
        JsonSerializer serializer = new JsonSerializer();
        return (GroupConfig) serializer.fromJsonFile(fs, file, GroupConfig.class);
    }

    public GroupConfig() {

    }

    public GroupConfig(GroupConfig config) {
        this.groupSize = config.groupSize;
        this.maxGroupNum = config.maxGroupNum;
        this.samplePaths = new ArrayList<String>();
        this.samplePaths.addAll(config.samplePaths);
    }

    @JsonProperty("group_size")
    public long getGroupSize() {
        return this.groupSize;
    }

    @JsonProperty("group_size")
    public void setGroupSize(long groupSize) {
        this.groupSize = groupSize;
    }

    @JsonProperty("max_group_num")
    public int getMaxGroupNum() {
        return this.maxGroupNum;
    }

    @JsonProperty("max_group_num")
    public void setMaxGroupNum(int maxGroupNum) {
        this.maxGroupNum = maxGroupNum;
    }

    @JsonProperty("sample_paths")
    public Collection<String> getSamplePaths() {
        return this.samplePaths;
    }

    @JsonProperty("sample_paths")
    public void addSamplePath(Collection<String> samplePaths) {
        this.samplePaths.addAll(samplePaths);
    }

    @JsonIgnore
    public void addSamplePath(String samplePath) {
        this.samplePaths.add(samplePath);
    }

    @JsonIgnore
    public void clearSamplePath() {
        this.samplePaths.clear();
    }

    @JsonIgnore
    public void saveTo(Configuration conf) throws IOException {
        JsonSerializer serializer = new JsonSerializer();
        serializer.toJsonConfiguration(conf, HADOOP_CONFIG_KEY, this);
    }

    @JsonIgnore
    public void saveTo(FileSystem fs, Path file) throws IOException {
        JsonSerializer serializer = new JsonSerializer();
        serializer.toJsonFile(fs, file, this);
    }
}


text:
#ifndef LBB_CONCURRENCY_IMP_FUTURE_IMP_H_
#define LBB_CONCURRENCY_IMP_FUTURE_IMP_H_

#include <stdexcept>
#include <lbb/utility.h>
#include <lbb/smartptr.h>
#include <lbb/meta.h>

#include "../future_error.h"

#include <iostream>

namespace lbb {
namespace concurrency {

//traits which compute the result of future then
template<typename F, typename T>
struct result_of_future_then_ {
	// result_of_F => the return type of F
	typedef typename result_of<F(future<T>)>::type result_of_F;

	// true if the result of F is void and false otherwise
	static const bool is_void_ = is_same_type_<result_of_F, void>::value;

	// type => void if the result of F is void and future<result_of_F> otherwise
	typedef typename select_type_<is_void_, void, future<result_of_F> >::type type;
};

template<typename T>
future<T>::future(const shared_ptr<future_::shared_state<T> >& shared_state) :
	_shared_state(shared_state)
{
}

template<typename T>
future<T>::future() : _shared_state(0) { }

template<typename T>
future<T>::future(rvalue_reference other) : _shared_state(other._shared_state) {
	other._shared_state = 0;
}

template<typename T>
future<T>::~future() { }

template<typename T>
future<T>& future<T>::operator=(rvalue_reference other) {
	_shared_state = other._shared_state;
	other._shared_state = 0;
	return *this;
}

template<typename T>
T future<T>::get() {
	if(!_shared_state.get()) {
		throw future_error(future_error::no_state);
	}

	T value = _shared_state->get();
	_shared_state = 0;
	return move(value);
}

template<typename T>
bool future<T>::valid() const {
	return (_shared_state.get() && _shared_state->valid()) ? true : false;
}

template<typename T>
void future<T>::wait() const {
	if(!_shared_state.get()) {
		throw future_error(future_error::no_state);
	}

	_shared_state->wait();
}

namespace future_ {

template<typename F, typename T, bool is_void = result_of_future_then_<F, T>::is_void_ >
struct future_continuation;

template<typename F, typename T>
struct future_continuation<F, T, true>
{
	typedef shared_ptr<shared_state<T> > 										InputSharedState;

	future_continuation(F continuation, const InputSharedState& input_shared_state) :
		_input_shared_state(input_shared_state),
		_continuation(continuation) {
	}

	void operator()() {
		try {
			_continuation(future<T>(_input_shared_state));
		}  catch(const std::exception& e) {
			std::cout << "exception catch during future.then : " << e.what() << std::endl;
			throw;
		} catch(...) {
			std::cout << "unknown exception catch during future.then" << std::endl;
			throw;
		}

		_input_shared_state = 0;
	}

private:
	InputSharedState 				_input_shared_state;
	F 								_continuation;
};

template<typename F, typename T>
struct future_continuation<F, T, false>
{
	typedef shared_ptr<shared_state<T> > 										InputSharedState;
	typedef shared_ptr<shared_state<typename result_of<F(future<T>)>::type> > 	OutputSharedState;

	future_continuation(F continuation, const InputSharedState& input_shared_state) :
		_input_shared_state(input_shared_state),
		_output_shared_state(make_shared<shared_state<typename result_of<F(T)>::type> >()),
		_continuation(continuation) {
	}

	void operator()() {
		try {
			_output_shared_state->set_value(_continuation(future<T>(_input_shared_state)));
		} catch(const std::exception& e) {
			_output_shared_state->set_exception(std::runtime_error(e.what()));
			throw;
		} catch(...) {
			_output_shared_state->set_exception(std::runtime_error("exception occur during execution of a future continuation"));
			throw;
		}
		_input_shared_state = 0;
		_output_shared_state = 0;
	}

	future<typename result_of<F(future<T>)>::type > get_future() {
		return future<typename result_of<F(future<T>)>::type>(_output_shared_state);
	}

private:
	InputSharedState 				_input_shared_state;
	OutputSharedState				_output_shared_state;
	F 								_continuation;
};

}

template<typename T>
template<typename F>
typename enable_if_<result_of_future_then_<F, T>::is_void_, typename result_of_future_then_<F, T>::type>::type
future<T>::then(F function) {
	if(!_shared_state.get()) {
		throw future_error(future_error::no_state);
	}

	future_::future_continuation<F, T> continuation(function, _shared_state);
	_shared_state->set_continuation(continuation);
	_shared_state = 0;
}

template<typename T>
template<typename F>
typename disable_if_<result_of_future_then_<F, T>::is_void_, typename result_of_future_then_<F, T>::type>::type
future<T>::then(F function) {
	if(!_shared_state.get()) {
		throw future_error(future_error::no_state);
	}

	future_::future_continuation<F, T> continuation(function, _shared_state);
	_shared_state->set_continuation(continuation);
	_shared_state = 0;
	return continuation.get_future();
}

}  // namespace concurrency
}  // namespace lbb

#endif /* LBB_CONCURRENCY_IMP_FUTURE_IMP_H_ */


text:
/**
 * SelectPluginItem
 * @constructor
 * @struct
 */
function SelectPluginItem() {
    'use strict';

    /**
     * Name of the instance
     * @type {string}
     */
    this.name = '';

    /**
     * Description
     * @type {string}
     */
    this.description = '';

    /**
     * Is Plugin active for instance.
     * @type {boolean}
     */
    this.isActive = false;
}

module.exports = SelectPluginItem;


text:
(function () {
    'use strict';
    angular.module('Tombola.Module.Ticket')
        .controller('BingoTicket', ['$scope','TicketCreation','CheckWinners',
            function ($scope, ticketCreation, checkWinners) {
                $scope.ticketCreation = ticketCreation;
                $scope.checkWinners = checkWinners;

                }]);
})();


text:
import React from 'react';
import { fireEvent, render } from '@testing-library/react';
import { axe } from 'jest-axe';
import 'jest-styled-components';
import 'jest-axe/extend-expect';
import 'regenerator-runtime/runtime';

import { Grommet } from '../../Grommet';
import { Text } from '..';

test('should have no accessibility violations', async () => {
  const { container } = render(
    <Grommet>
      <Text a11yTitle="test"> Example</Text>
    </Grommet>,
  );

  const results = await axe(container);
  expect(results).toHaveNoViolations();
  expect(container.firstChild).toMatchSnapshot();
});

test('renders', () => {
  const { container } = render(
    <Grommet>
      <Text>text</Text>
    </Grommet>,
  );

  expect(container.firstChild).toMatchSnapshot();
});

test('accepts ref', () => {
  const ref = React.createRef<HTMLParagraphElement>();
  const { container } = render(
    <Grommet>
      <Text ref={ref}>text</Text>
    </Grommet>,
  );

  expect(ref.current).not.toBeNull();
  expect(container.firstChild).toMatchSnapshot();
});

test('renders size', () => {
  const { container } = render(
    <Grommet>
      <Text size="xsmall" />
      <Text size="small" />
      <Text size="medium" />
      <Text size="large" />
      <Text size="xlarge" />
      <Text size="xxlarge" />
      <Text size="2xl" />
      <Text size="3xl" />
      <Text size="4xl" />
      <Text size="5xl" />
      <Text size="6xl" />
    </Grommet>,
  );

  expect(container.firstChild).toMatchSnapshot();
});

test('renders textAlign', () => {
  const { container } = render(
    <Grommet>
      <Text textAlign="start" />
      <Text textAlign="center" />
      <Text textAlign="end" />
      <Text textAlign="justify" />
    </Grommet>,
  );

  expect(container.firstChild).toMatchSnapshot();
});

test('renders margin', () => {
  const { container } = render(
    <Grommet>
      <Text margin="small" />
      <Text margin="medium" />
      <Text margin="large" />
      <Text margin="none" />
      <Text margin={{ vertical: 'small' }} />
      <Text margin={{ horizontal: 'small' }} />
      <Text margin={{ bottom: 'small' }} />
      <Text margin={{ top: 'small' }} />
      <Text margin={{ left: 'small' }} />
      <Text margin={{ right: 'small' }} />
    </Grommet>,
  );

  expect(container.firstChild).toMatchSnapshot();
});

const LONG = 'a b c d e f g h i j k l m n o p q r s t u v w x y z';

test('renders truncate', () => {
  const { container } = render(
    <Grommet>
      <Text truncate={false}>{LONG}</Text>
      <Text truncate>{LONG}</Text>
    </Grommet>,
  );

  expect(container.firstChild).toMatchSnapshot();
});

test('renders color', () => {
  const { container } = render(
    <Grommet>
      <Text color="status-critical" />
    </Grommet>,
  );

  expect(container.firstChild).toMatchSnapshot();
});

test('renders tag', () => {
  const { container } = render(
    <Grommet>
      <Text as="div" />
    </Grommet>,
  );

  expect(container.firstChild).toMatchSnapshot();
});

test('proxies tag', () => {
  const { container: tagComponent } = render(
    <Grommet>
      <Text tag="div" />
    </Grommet>,
  );
  const { container: asComponent } = render(
    <Grommet>
      <Text as="div" />
    </Grommet>,
  );

  expect(tagComponent).toEqual(asComponent);
});

test('renders weight', () => {
  const { container } = render(
    <Grommet>
      <Text weight="normal" />
      <Text weight="bold" />
    </Grommet>,
  );

  expect(container.firstChild).toMatchSnapshot();
});

test('renders tip', () => {
  const { container, getByText } = render(
    <Grommet>
      <Text tip="tooltip">Default Tip</Text>
    </Grommet>,
  );

  fireEvent.mouseOver(getByText('Default Tip'));
  expect(container.firstChild).toMatchSnapshot();
});

test('should apply a11yTitle or aria-label', () => {
  const { container, getByLabelText } = render(
    <Grommet>
      <Text a11yTitle="test"> Example</Text>
      <Text aria-label="test-2">Example</Text>
    </Grommet>,
  );

  expect(getByLabelText('test')).toBeTruthy();
  expect(getByLabelText('test-2')).toBeTruthy();
  expect(container.firstChild).toMatchSnapshot();
});


text:
@interface VKStartScreen : UIViewController <VKSdkDelegate>

@end


text:
import * as baton from '../src/baton'
import chai from 'chai'

chai.should() // use "should-style" assertions (proto based)

const mockDbRun = (btn) => {run: (_, fn) => fn(null, btn)}

describe('baton', () => {

  describe('.pass', () => {
    it('should be an exported method', () => {
      baton.pass.should.be.a('function')
    })

    describe('when provided valid links', () => {
      it('should resolve with the valid baton', () => {
        baton.pass({link: 'http://madhax.io'}).should.be.fulfilled
      })
    })

    describe('when provided invalid links', () => {
      it('falsy link', () => {
        baton.pass().should.be.rejected
        baton.pass('').should.be.rejected
        baton.pass(null).should.be.rejected
      })

      it('malformed link', () => {
        baton.pass({link: 'http://foo'}).should.be.rejected
      })
    })

    xdescribe('when provided a valid link', () => {
      it('should persist the baton', () => {
        // TODO
      })
    })
  })

  xdescribe('find', () => {
    it('should be an exported method', () => {
      baton.find.should.be.a('function')
    })
  })

  xdescribe('all', () => {
    it('should be an exported method', () => {
      baton.all.should.be.a('function')
    })
  })

  xdescribe('byId', () => {
    it('should be an exported method', () => {
      baton.byId.should.be.a('function')
    })
  })

  xdescribe('allTags', () => {
    it('should be an exported method', () => {
      baton.allTags.should.be.a('function')
    })
  })

  xdescribe('byTag', () => {
    it('should be an exported method', () => {
      baton.byTag.should.be.a('function')
    })
  })

  describe('token', () => {
    it('should be an exported method', () => {
      baton.token.should.be.a('function')
    })

    xit('should resolve with the expected token for team_id and team_domain combination', () => {

    })

    it('should reject if no token for the team_id and team_domain combination can be found', () => {
      baton.token('non', 'existent').should.be.rejected
    })

    it('should reject if the team_id or team_domain is missing', () => {
      baton.token('123').should.be.rejected
      baton.token(null, 'madhax').should.be.rejected
    })
  })

  describe('register', () => {
    it('should be an exported method', () => {
      baton.register.should.be.a('function')
    })

    it('should reject if the token, team_id or team_domain is missing', () => {
      baton.register('token').should.be.rejected
      baton.register(null, 'id').should.be.rejected
      baton.register('token', 'id').should.be.rejected
      baton.register(null, 'id', 'domain').should.be.rejected
      baton.register('token', null, 'domain').should.be.rejected
    })

    xit('should reject if the team is already registered', () => {

    })
  })

  xdescribe('drop', () => {
    it('should be an exported method', () => {
      baton.drop.should.be.a('function')
    })
  })

})


text:
int main(int argc, char *argv[])
{
  netloc_map_t map;
  netloc_map_server_t srcserver, dstserver;
  hwloc_topology_t srctopo, dsttopo;
  hwloc_obj_t srcobj, dstobj;
  netloc_map_paths_t paths;
  unsigned nr_paths, nr_edges, i, j;
  struct netloc_map_edge_s *edges;
  unsigned flags = 0x3;
  char *path;
  int err;

  if (argc > 2) {
    if (!strcmp(argv[1], "--flags")) {
      flags = (unsigned) strtoul(argv[2], NULL, 0);
      argc -= 2;
      argv += 2;
    }
  }

  if (argc < 6) {
    fprintf(stderr, "%s [options] <datadir> <srcserver> <srcpu> <dstserver> <dstpu>\n", argv[0]);
    fprintf(stderr, "Example: %s mynetlocdata server2 1 server3 7\n", argv[0]);
    fprintf(stderr, "  Loads netloc map from 'mynetlocdata' directory and display all paths\n");
    fprintf(stderr, "  from server 'server2' PU #1 to server 'server3' PU #7.\n");
    fprintf(stderr, "Options:\n");
    fprintf(stderr, "  --flags N    Use value N as map paths flags. Default is 3 which displays all edges.\n");
    exit(EXIT_FAILURE);
  }

  err = netloc_map_create(&map);
  if (err) {
    fprintf(stderr, "Failed to create the map\n");
    exit(EXIT_FAILURE);
  }

  asprintf(&path, "%s/hwloc", argv[1]);
  err = netloc_map_load_hwloc_data(map, path);
  free(path);
  if (err) {
    fprintf(stderr, "Failed to load hwloc data\n");
    return -1;
  }

  asprintf(&path, "file://%s/netloc", argv[1]);
  err = netloc_map_load_netloc_data(map, path);
  free(path);
  if (err) {
    fprintf(stderr, "Failed to load netloc data\n");
    return -1;
  }

  err = netloc_map_build(map, 0);
  if (err) {
    fprintf(stderr, "Failed to build map data\n");
    return -1;
  }

  err = netloc_map_name2server(map, argv[2], &srcserver);
  if (err) {
    fprintf(stderr, "Could not find src server %s\n", argv[2]);
    return -1;
  }
  err = netloc_map_server2hwloc(srcserver, &srctopo);
  if (err) {
    fprintf(stderr, "Could not find src server %s hwloc topology\n", argv[2]);
    return -1;
  }
  srcobj = hwloc_get_obj_by_type(srctopo, HWLOC_OBJ_PU, atoi(argv[3]));
  if (!srcobj) {
    fprintf(stderr, "Could not find src server %s PU #%s\n", argv[2], argv[3]);
    return -1;
  }

  err = netloc_map_name2server(map, argv[4], &dstserver);
  if (err) {
    fprintf(stderr, "Could not find dst server %s\n", argv[4]);
    return -1;
  }
  err = netloc_map_server2hwloc(dstserver, &dsttopo);
  if (err) {
    fprintf(stderr, "Could not find dst server %s hwloc topology\n", argv[4]);
    return -1;
  }
  dstobj = hwloc_get_obj_by_type(dsttopo, HWLOC_OBJ_PU, atoi(argv[5]));
  if (!dstobj) {
    fprintf(stderr, "Could not find dst server %s PU #%s\n", argv[4], argv[5]);
    return -1;
  }

  err = netloc_map_paths_build(map,
			       srctopo, srcobj,
			       dsttopo, dstobj,
			       flags,
			       &paths, &nr_paths);
  if (err < 0) {
    fprintf(stderr, "Failed to build paths\n");
    return -1;
  }

  printf("got %u paths\n", nr_paths);
  for(i=0; i<nr_paths; i++) {
    printf(" path #%u:\n", i);

    err = netloc_map_paths_get(paths, i, &edges, &nr_edges);
    assert(!err);
    printf("  %u edges\n", nr_edges);
    for(j=0; j<nr_edges; j++) {
      struct netloc_map_edge_s *edge = &edges[j];
      printf("   edge #%u type %d: ", j, edge->type);
      switch (edge->type) {
      case NETLOC_MAP_EDGE_TYPE_NETLOC:
        printf("netloc from %s to %s in subnet type %s id %s\n",
	       edge->netloc.edge->src_node_id,
	       edge->netloc.edge->dest_node_id,
	       netloc_decode_network_type(netloc_access_network_ref(edge->netloc.topology)->network_type),
	       netloc_access_network_ref(edge->netloc.topology)->subnet_id);
	break;
      case NETLOC_MAP_EDGE_TYPE_HWLOC_PARENT:
	printf("hwloc UP from %s:%u (%s) to parent %s:%u (%s) weight %u\n",
	       hwloc_obj_type_string(edge->hwloc.src_obj->type), edge->hwloc.src_obj->logical_index, edge->hwloc.src_obj->name ? : "<unnamed>",
	       hwloc_obj_type_string(edge->hwloc.dest_obj->type), edge->hwloc.dest_obj->logical_index, edge->hwloc.dest_obj->name ? : "<unnamed>",
	       edge->hwloc.weight);
	break;
      case NETLOC_MAP_EDGE_TYPE_HWLOC_HORIZONTAL:
	printf("hwloc HORIZONTAL from %s:%u (%s) to cousin %s:%u (%s) weight %u\n",
	       hwloc_obj_type_string(edge->hwloc.src_obj->type), edge->hwloc.src_obj->logical_index, edge->hwloc.src_obj->name ? : "<unnamed>",
	       hwloc_obj_type_string(edge->hwloc.dest_obj->type), edge->hwloc.dest_obj->logical_index, edge->hwloc.dest_obj->name ? : "<unnamed>",
	       edge->hwloc.weight);
	break;
      case NETLOC_MAP_EDGE_TYPE_HWLOC_CHILD:
	printf("hwloc DOWN from %s:%u (%s) to child %s:%u (%s) weight %u\n",
	       hwloc_obj_type_string(edge->hwloc.src_obj->type), edge->hwloc.src_obj->logical_index, edge->hwloc.src_obj->name ? : "<unnamed>",
	       hwloc_obj_type_string(edge->hwloc.dest_obj->type), edge->hwloc.dest_obj->logical_index, edge->hwloc.dest_obj->name ? : "<unnamed>",
	       edge->hwloc.weight);
	break;
      case NETLOC_MAP_EDGE_TYPE_HWLOC_PCI:
	printf("hwloc PCI from %s:%u (%s) to child %s:%u (%s) weight %u\n",
	       hwloc_obj_type_string(edge->hwloc.src_obj->type), edge->hwloc.src_obj->logical_index, edge->hwloc.src_obj->name ? : "<unnamed>",
	       hwloc_obj_type_string(edge->hwloc.dest_obj->type), edge->hwloc.dest_obj->logical_index, edge->hwloc.dest_obj->name ? : "<unnamed>",
	       edge->hwloc.weight);
	break;
      }
    }
  }

  netloc_map_paths_destroy(paths);

  netloc_map_put_hwloc(map, srctopo);
  netloc_map_put_hwloc(map, dsttopo);
  netloc_map_destroy(map);
  return 0;
}


text:
chrome.contextMenus.create({title: "back", id: 'main'},
                           chrome.test.notifyPass());


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

namespace Evbpc.Framework.Xna.Drawing.Extensions
{
    ///
    /// Contains extensions methods to use with <see cref="Framework.Drawing.Point"/>, <see cref="Framework.Drawing.PointF"/>, and <see cref="Framework.Drawing.PointShort"/>.
    ///
    public static class PointExtensions
    {
        ///
        /// Converts a <see cref="Framework.Drawing.Point"/> to a Microsoft.Xna.Framwork.Point.
        ///
        /// <param name="p">The <see cref="Framework.Drawing.Point"/> to convert.</param>
        /// <returns>The Microsoft.Xna.Framwork.Point representing the specified <see cref="Framework.Drawing.Point"/>.</returns>
        public static Microsoft.Xna.Framework.Point ToXnaPoint(this Framework.Drawing.Point p) => new Microsoft.Xna.Framework.Point(p.X, p.Y);

        ///
        /// Converts a <see cref="Framework.Drawing.PointF"/> to a Microsoft.Xna.Framwork.Point by truncating values.
        ///
        /// <param name="p">The <see cref="Framework.Drawing.PointF"/> to convert.</param>
        /// <returns>The Microsoft.Xna.Framwork.Point representing the specified <see cref="Framework.Drawing.PointF"/>.</returns>
        public static Microsoft.Xna.Framework.Point ToXnaPoint(this Framework.Drawing.PointF p) => new Microsoft.Xna.Framework.Point((int)p.X, (int)p.Y);

        ///
        /// Converts a <see cref="Framework.Drawing.PointShort"/> to a Microsoft.Xna.Framwork.Point by truncating values.
        ///
        /// <param name="p">The <see cref="Framework.Drawing.PointShort"/> to convert.</param>
        /// <returns>The Microsoft.Xna.Framwork.Point representing the specified <see cref="Framework.Drawing.PointShort"/>.</returns>
        public static Microsoft.Xna.Framework.Point ToXnaPoint(this Framework.Drawing.PointShort p) => new Microsoft.Xna.Framework.Point(p.X, p.Y);
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<Settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:type="Serif.Interop.Persona.Settings.PhotoshopPluginsSettings">
	<AllowUnknownPlugins>True</AllowUnknownPlugins>
	<Directories>
		<string>C:\Program Files\Google\Nik Collection</string>
	</Directories>
</Settings>


text:
* [Introduction](README.md)
* [Legal Notice](notice.md)
* [Getting Started](getting-started.adoc)

* [Architecture](architecture.adoc)
	* [Endpoint](endpoint.adoc)
	* [Exchange](exchange.adoc)
	* [Exchange Pattern](exchange-pattern.adoc)
	* [Registry](registry.adoc)

<!--
	* [Dozer Type Conversion](dozer-type-conversion.adoc)
	* [AOP](aop.adoc)
	* [Async](async.adoc)
	* [BAM](bam.adoc)
	* [Batch Consumer](batch-consumer.adoc)
	* [BrowsableEndpoint](browsable-endpoint.adoc)
	* [CamelContext](camelcontext.adoc)
	* [Camel-Core](camel-core.adoc)
	* [Debugger](debugger.adoc)
	* [Delay Interceptor](delay-interceptor.adoc)
	* [Dependency Injection](dependency-injections.adoc)
	* [DSL](dsl.adoc)
	* [Error Handler](.adoc)
	* [Exchange](.adoc)
	* [Exchange Pattern](.adoc)
	* [Expression](.adoc)
	* [Injector](.adoc)
	* [Intercept](.adoc)
	* [Inversion Of Control With Smart Defaults](.adoc)
	* [Languages](.adoc)
	* [Lifecycle](.adoc)
	* [OnCompletion](.adoc)
	* [Pluggable Class Resolvers](.adoc)
	* [Predicate](.adoc)
	* [Processor](.adoc)
	* [RouteBuilder](.adoc)
	* [RoutePolicy](.adoc)
	* [Routes](.adoc)
	* [ServicePool](.adoc)
	* [Stream caching](.adoc)
	* [ToAsync](.adoc)
	* [Tracer](.adoc)
	* [Transport](.adoc)
	* [Type Converter](.adoc)
	* [URIs](.adoc)
	* [Xml Configuration](.adoc)
	* [ProcessorFactory](.adoc)
	* [Asynchronous Routing Engine](.adoc)
	* [Security](.adoc)
	* [UuidGenerator](.adoc)
	* [Binding](.adoc)
	* [RX](.adoc)
	* [CEP](.adoc)
	* [BacklogTracer](.adoc)
	* [Endpoint Annotations](.adoc)
	* [ComponentConfiguration](.adoc)
	* [BacklogDebugger](.adoc)
	* [EndpointCompleter](.adoc)
	* [Clustering and loadbalancing](.adoc)
	* [Threading Model](.adoc)
-->

* [Enterprise Integration Patterns](enterprise-integration-patterns.adoc)
	* [Event Message](event-message.adoc)
	* [Message](message.adoc)
	* [Request Reply](request-reply.adoc)

* Components
	* [Async Http Client (AHC)](ahc.adoc)
	* [AHC Websocket (AHC-WS)](ahc-ws.adoc)
	* [Amqp](amqp.adoc)
	* [Apns](apns.adoc)
	* [Atmosphere Websocket](atmosphere-websocket.adoc)
	* [Atom](atom.adoc)
	* [Avro](avro.adoc)
	* [AWS](aws.adoc)
		* [AWS CloudWatch](aws-cw.adoc)
		* [AWS DynamoDB](aws-ddb.adoc)
		* [AWS DynamoDB Streams](aws-ddbstream.adoc)
		* [AWS EC2](aws-ec2.adoc)
		* [AWS Kinesis](aws-kinesis.adoc)
		* [AWS S3](aws-s3.adoc)
		* [AWS SDB](aws-sdb.adoc)
		* [AWS SES](aws-ses.adoc)
		* [AWS SNS](aws-sns.adoc)
		* [AWS SQS](aws-sqs.adoc)
		* [AWS SWF](aws-swf.adoc)
	* [Bam](bam.adoc)
	* [CDI](cdi.adoc)
	* [JMS](jms.adoc)
	* [Metrics](metrics.adoc)

<!--
* [Expession Languages](languages.adoc)
	* [Bean Language](bean-language.adoc)
	* [Constant](constant.adoc)

* [Data Formats](data-format.adoc)
-->


text:
using System;

/// <summary>
/// Contains information related to spot change events
/// </summary>
public class SpotEventArgs : EventArgs
{

}


text:
from MEHI.paralleled import preprocess as prep
from MEHI.paralleled import registration as reg
from MEHI.paralleled import fusion as fus
from MEHI.serial import preprocess as _prep
from MEHI.paralleled import IO
from pyspark import SparkContext, SparkConf
from MEHI.utils.tool import exeTime, log
import numpy as np
import time

conf = SparkConf().setAppName('fuse').setMaster('local[128]').set('spark.executor.memory','20g').set('spark.driver.maxResultSize','20g').set('spark.driver.memory','40g').set('spark.local.dir','/dev/shm').set('spark.storage.memoryFraction','0.2').set('spark.default.parallelism','512')
sc = SparkContext(conf=conf)

pwd = '/mnt/xfs_snode21'
s = time.time()

s_loading = time.time()
log('info')('loading tiff ...')
L_img_stack = IO.load_tiff(sc, pwd+'/0401RawData/1-L-Red')
R_img_stack = IO.load_tiff(sc, pwd+'/0401RawData/1-R-Red')
rddA = sc.parallelize(L_img_stack)
rddB = sc.parallelize(R_img_stack)
e_loading = time.time()
log('time')('loading cost %.3f' % (e_loading-s_loading))
log('info')('tiff load over...')

log('info')('registration start ...')
s_reg = time.time()
rddA = prep.intensity_normalization(rddA,8)
rddB = prep.intensity_normalization(rddB,8)
rddB = prep.flip(rddB)
L_img_stack_8 = np.array(rddA.collect())
R_img_stack_8 = np.array(rddB.collect())
e_pre = time.time()
log('time')('preprocess cost %.3f' % (e_pre-s_reg))
vec0 = [0,0,0,1,1,0,0]
vec = reg.c_powell(L_img_stack_8[233], R_img_stack_8[233], vec0)
rddB = sc.parallelize(R_img_stack)
rddB = prep.flip(rddB)
rddB = reg.execute(rddB, vec)
R_img_stack = rddB.collect()
e_reg = time.time()
log('time')('registration cost %.3f' % (e_reg-s_reg))
log('info')('registration over ...')

log('info')('fuion start ...')
s_fus = time.time()
R_img_stack = np.squeeze(np.array(R_img_stack))
img_stack = zip(L_img_stack, R_img_stack)
rdd = sc.parallelize(img_stack)
fused_img = fus.wavelet_fusion(rdd)
e_fus = time.time()
log('time')('fusion cost %.3f' % (e_fus-s_fus))
log('info')('fusion over ...')

#log('info')('saving ...')
#IO.save_tiff(fused_img, pwd+'/0401fusion/fus_dev/fus')
#log('info')('subtract background start ...')

s_sub = time.time()
fused_img = IO.load_tiff(sc ,pwd+'/0401fusion/fus_dev')
rdd = sc.parallelize(fused_img)
rdd = prep.intensity_normalization(rdd)
rdd = prep.subtract_Background(rdd)
rdd = prep.intensity_normalization(rdd)
sb_img = np.array(rdd.collect())
e_sub = time.time()
log('time')('sub_prep cost %.3f' % (e_sub-s_sub))
log('info')('sbutract background over ... ')
#
#log('info')('saving ...')
#IO.save_tiff(sb_img, pwd+'/0401fusion/sub_dev/sub')
sc.stop()
e = time.time()
print "[info] %.3f s" %(e-s)


text:
Tangram is a flexible browser-based mapping engine, designed for real-time rendering of 2D and 3D maps from vector tiles.

### Getting Started

Here are a few demos of the library in action:

- **[basic 3D buildings map](http://tangrams.github.io/simple-demo/)** ([repo](https://github.com/tangrams/simple-demo))
- **[gui color-picker](http://tangrams.github.io/gui-demo/)** ([repo](https://github.com/tangrams/gui-demo))
- **[fancy shaders](http://tangrams.github.io/shaders-demo/)** ([repo](https://github.com/tangrams/shaders-demo))
- **[highways](http://tangrams.github.io/highways-demo/)** ([repo](https://github.com/tangrams/highways-demo))

### Concept Overviews

These pages offer an introduction to the concepts behind Tangram:

- The [Scene File](Scene-file.md)
- [Filters](Filters-Overview.md)
- [Lights](Lights-Overview.md)
- [Cameras](Cameras-Overview.md)
- [Materials](Materials-Overview.md)
- [Shaders](Shaders-Overview.md)
- [Styles](Styles-Overview.md)

### Technical Reference

These pages list the objects and parameters of the scene file, as well as their acceptable values.

- [yaml](yaml.md)
- [scene](scene.md)
- [sources](sources.md)
- [cameras](cameras.md)
- [lights](lights.md)
- [materials](materials.md)
- [styles](styles.md)
- [layers](layers.md)
- [draw](draw.md)
- [shaders](shaders.md)


text:
<?php

namespace Go\Aop\Intercept;

use ReflectionProperty;

/**
 * This interface represents a field access in the program.
 *
 * A field access is a joinpoint and can be intercepted by a field interceptor.
 *
 * @api
 */
interface FieldAccess extends Joinpoint
{

    /**
     * The read access type
     */
    const READ = 0;

    /**
     * The write access type
     */
    const WRITE = 1;

    /**
     * Gets the field being accessed.
     *
     * @api
     *
     * @return ReflectionProperty the field being accessed.
     */
    public function getField();

    /**
     * Gets the current value of property by reference
     *
     * @api
     *
     * @return mixed
     */
    public function &getValue();

    /**
     * Gets the value that must be set to the field, applicable only for WRITE access type
     *
     * @api
     *
     * @return mixed
     */
    public function &getValueToSet();

    /**
     * Returns the access type.
     *
     * @api
     *
     * @return integer
     */
    public function getAccessType();
}


text:
<?php
$player_list = get_all("select (select count(*) from players where p_usr_id != 13) as ranks, gname, p_respect from usr inner join players on usr_id = p_usr_id where p_usr_id != 13 order by p_respect desc");
?>


text:
module Physiqual
  module Errors
    class ServiceProviderNotFoundError < StandardError
    end
  end
end