text:
PullToRefresh-PinnedSection-ListView
====================================

A merge of PullToRefreshListView and PinnedSectionListView for Android.

## Library
Android-PullToRefresh: https://github.com/chrisbanes/Android-PullToRefresh

pinned-section-listview: https://github.com/beworker/pinned-section-listview

## Environment
Eclipse Luna, Android 4.2.2

## Screenshot

## 为什么做PullToRefresh-PinnedSection-ListView
前段时间因为项目需求,需要在Android中对ListView同时增加下拉刷新和分段头悬停的效果,受到[dkmeteor](https://github.com/dkmeteor)的启发,Merge了两个Github上的开源项目:

 * [Android-PullToRefresh](https://github.com/chrisbanes/Android-PullToRefresh)(handmark版,目前已不再更新)

 * [StickyListHeaders](https://github.com/emilsjolander/StickyListHeaders)(目前版本为2.x)

 由于既有项目里的StickyListHeaders代码为1.x版本,StickyListHeadersListView继承自ListView,故与handmark版的PullToRefreshListView做merge时很顺畅;

 但2.x版的StickyListHeadersListView继承自FrameLayout,与PullToRefresh的融合并不顺利,若要整理拆分出一个独立的lib时遇到很多的问题,
 故在分断头悬停需求上采用了另一个类似的开源项目:

 * [pinned-section-listview](https://github.com/beworker/pinned-section-listview)

## 我是如何做的
前面已经介绍过这个过程是"很顺畅"的:

1.Library方面,基于PullToRefresh的Library修改,首先使其依赖StickyListHeaders的Library,通过拷贝src/com/handmark/pulltorefresh/library/PullToRefreshListView.java类,
新建PullToRefreshPinnedSectionListView.java类;

2.修改PullToRefreshPinnedSectionListView类中createListView()方法,注释以下代码

    //		if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) {
    //			lv = new InternalListViewSDK9(context, attrs);
    //		} else {
    //			lv = new InternalListView(context, attrs);
    //		}
添加

    lv = new PinnedSectionListView(context, attrs);

3.Example方面,基于pinned-section-listview的example修改,令其依赖PullToRefresh的Library;

4.修改主类资源文件activity_main.xml,设置List组件为新类:

    <com.handmark.pulltorefresh.library.PullToRefreshPinnedSectionListView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/list"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:headerDividersEnabled="false"
    android:footerDividersEnabled="false"
    android:divider="@null"
    />

5.改写SampleActivity.java类中getListView()方法:

    mpPullToRefreshPinnedSectionListView = (PullToRefreshPinnedSectionListView) findViewById(R.id.list);
    return mpPullToRefreshPinnedSectionListView.getRefreshableView();

即可通过

    ListView list = getListView();

继续进行原example其他操作,详情可阅读[项目代码](https://github.com/tongcpp/PullToRefresh-PinnedSection-ListView/blob/master/example/src/com/hb/examples/SampleActivity.java)

## 另一种实现方式
本例的实现方式依赖于handmark版下拉刷新组件的灵活性,更重要的一点,要求分段头悬停组件是继承自ListView实现;
故同理也可用handmark版下拉刷新组件和1.x版的StickyListHeaders组件实现;

另一种实现方式为[pull-to-refresh-sticky-list](https://github.com/dkmeteor/pull-to-refresh-sticky-list),
其采取合并的是2.x版的StickyListHeaders和johannilsson的android-pulltorefresh,实现形式不同,但效果类似,看过代码后实现起来也"相当顺畅",有兴趣的同学可以参照此项目;

## 建议
建议在熟悉或使用过原有组件类库的前提下使用本类库。


text:
namespace content {

RendererWebMIDIAccessorImpl::RendererWebMIDIAccessorImpl(
    WebKit::WebMIDIAccessorClient* client)
    : client_(client) {
  DCHECK(client_);
}

RendererWebMIDIAccessorImpl::~RendererWebMIDIAccessorImpl() {
  midi_message_filter()->RemoveClient(client_);
}

void RendererWebMIDIAccessorImpl::startSession() {
  midi_message_filter()->StartSession(client_);
}

void RendererWebMIDIAccessorImpl::sendMIDIData(
    unsigned port_index,
    const unsigned char* data,
    size_t length,
    double timestamp) {
  midi_message_filter()->SendMIDIData(
      port_index,
      data,
      length,
      timestamp);
}

MIDIMessageFilter* RendererWebMIDIAccessorImpl::midi_message_filter() {
  return RenderThreadImpl::current()->midi_message_filter();
}

}  // namespace content

redpajama_set_name: RedPajamaGithub


text:
var express = require('express');
var router = express.Router();

var ctrlTemperatures = require('../controllers/temperatures');

router.get('/temperatures/fortnight', ctrlTemperatures.fortnight);
router.get('/temperatures', ctrlTemperatures.index);

router.get('/statistics', ctrlTemperatures.statisticsForDay);

router.get('/byRowId', ctrlTemperatures.apiByRowId);

module.exports = router;


text:
//----------------------------------------------------------------------------------------------
// <copyright file="RestGet.cs" company="Microsoft Corporation">
//     Licensed under the MIT License. See LICENSE.TXT in the project root license information.
// </copyright>
//----------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Runtime.Serialization.Json;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace Microsoft.Tools.WindowsDevicePortal
{
    /// <content>
    /// HTTP GET Wrapper
    /// </content>
    public partial class DevicePortal
    {
        /// <summary>
        /// The prefix for the <see cref="SystemPerformanceInformation" /> JSON formatting error.
        /// </summary>
        private static readonly string SysPerfInfoErrorPrefix = "{\"Reason\" : \"";

        /// <summary>
        /// The postfix for the <see cref="SystemPerformanceInformation" /> JSON formatting error.
        /// </summary>
        private static readonly string SysPerfInfoErrorPostfix = "\"}";

        /// <summary>
        /// Checks the JSON for any known formatting errors and fixes them.
        /// </summary>
        /// <typeparam name="T">Return type for the JSON message</typeparam>
        /// <param name="jsonStream">The stream that contains the JSON message to be checked.</param>
        private static void JsonFormatCheck<T>(Stream jsonStream)
        {
            if (typeof(T) == typeof(SystemPerformanceInformation))
            {
                StreamReader read = new StreamReader(jsonStream);
                string rawJsonString = read.ReadToEnd();

                // Recover from an error in which SystemPerformanceInformation is returned with an incorrect prefix, postfix and the message converted into JSON a second time.
                if (rawJsonString.StartsWith(SysPerfInfoErrorPrefix, StringComparison.OrdinalIgnoreCase) && rawJsonString.EndsWith(SysPerfInfoErrorPostfix, StringComparison.OrdinalIgnoreCase))
                {
                    // Remove the incorrect prefix and postfix from the JSON message.
                    rawJsonString = rawJsonString.Substring(SysPerfInfoErrorPrefix.Length, rawJsonString.Length - SysPerfInfoErrorPrefix.Length - SysPerfInfoErrorPostfix.Length);

                    // Undo the second JSON conversion.
                    rawJsonString = Regex.Replace(rawJsonString, "\\\\\"", "\"", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
                    rawJsonString = Regex.Replace(rawJsonString, "\\\\\\\\", "\\", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);

                    // Overwrite the stream with the fixed JSON.
                    jsonStream.SetLength(0);
                    var sw = new StreamWriter(jsonStream);
                    sw.Write(rawJsonString);
                    sw.Flush();
                }

                jsonStream.Seek(0, SeekOrigin.Begin);
            }
        }

        /// <summary>
        /// Calls the specified API with the provided payload.
        /// </summary>
        /// <typeparam name="T">Return type for the GET call</typeparam>
        /// <param name="apiPath">The relative portion of the uri path that specifies the API to call.</param>
        /// <param name="payload">The query string portion of the uri path that provides the parameterized data.</param>
        /// <returns>An object of the specified type containing the data returned by the request.</returns>
        private async Task<T> GetAsync<T>(
            string apiPath,
            string payload = null) where T : new()
        {
            T data = default(T);

            Uri uri = Utilities.BuildEndpoint(
                this.deviceConnection.Connection,
                apiPath,
                payload);

            DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(T));

            using (Stream dataStream = await this.GetAsync(uri))
            {
                if ((dataStream != null) &&
                    (dataStream.Length != 0))
                {
                    JsonFormatCheck<T>(dataStream);

                    object response = serializer.ReadObject(dataStream);
                    data = (T)response;
                }
            }

            return data;
        }
    }
}


text:
package org.elasticsearch.rest.action.document;

import org.elasticsearch.action.get.GetRequest;
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.VersionType;
import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.BytesRestResponse;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestResponse;
import org.elasticsearch.rest.action.RestActions;
import org.elasticsearch.rest.action.RestBuilderListener;
import org.elasticsearch.search.fetch.subphase.FetchSourceContext;

import java.io.IOException;

import static org.elasticsearch.rest.RestRequest.Method.GET;
import static org.elasticsearch.rest.RestStatus.NOT_FOUND;
import static org.elasticsearch.rest.RestStatus.OK;

public class RestGetAction extends BaseRestHandler {

    @Inject
    public RestGetAction(Settings settings, RestController controller) {
        super(settings);
        controller.registerHandler(GET, "/{index}/{type}/{id}", this);
    }

    @Override
    public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
        final GetRequest getRequest = new GetRequest(request.param("index"), request.param("type"), request.param("id"));
        getRequest.operationThreaded(true);
        getRequest.refresh(request.paramAsBoolean("refresh", getRequest.refresh()));
        getRequest.routing(request.param("routing"));  // order is important, set it after routing, so it will set the routing
        getRequest.parent(request.param("parent"));
        getRequest.preference(request.param("preference"));
        getRequest.realtime(request.paramAsBoolean("realtime", getRequest.realtime()));
        if (request.param("fields") != null) {
            throw new IllegalArgumentException("The parameter [fields] is no longer supported, " +
                "please use [stored_fields] to retrieve stored fields or [_source] to load the field from _source");
        }
        String sField = request.param("stored_fields");
        if (sField != null) {
            String[] sFields = Strings.splitStringByCommaToArray(sField);
            if (sFields != null) {
                getRequest.storedFields(sFields);
            }
        }

        getRequest.version(RestActions.parseVersion(request));
        getRequest.versionType(VersionType.fromString(request.param("version_type"), getRequest.versionType()));

        getRequest.fetchSourceContext(FetchSourceContext.parseFromRestRequest(request));

        return channel -> client.get(getRequest, new RestBuilderListener<GetResponse>(channel) {
            @Override
            public RestResponse buildResponse(GetResponse response, XContentBuilder builder) throws Exception {
                builder.startObject();
                response.toXContent(builder, request);
                builder.endObject();
                if (!response.isExists()) {
                    return new BytesRestResponse(NOT_FOUND, builder);
                } else {
                    return new BytesRestResponse(OK, builder);
                }
            }
        });
    }
}


text:
<?php _e('Event Espresso is created by an international team of passionate individuals with a drive to empower your events!', 'event_espresso'); ?>

<?php _e('Founders', 'event_espresso'); ?>

		<a href="<?php esp_gravatar_profile('seth@eventespresso.com'); ?>">
			<?php echo esp_gravatar_image( 'seth@eventespresso.com', 'Seth Shoultes' ); ?>

		<a class="web" href="<?php esp_gravatar_profile('seth@eventespresso.com'); ?>">
			Seth Shoultes

		<?php _e('Co-Founder', 'event_espresso'); ?>

		<a href="<?php esp_gravatar_profile('garth@eventespresso.com'); ?>">
			<?php echo esp_gravatar_image( 'garth@eventespresso.com', 'Garth Koyle' ); ?>

		<a class="web" href="<?php esp_gravatar_profile('garth@eventespresso.com'); ?>">
			Garth Koyle

		<?php _e('Co-Founder', 'event_espresso'); ?>

<?php _e('Core Developers', 'event_espresso'); ?>

		<a href="<?php esp_gravatar_profile('brent@eventespresso.com'); ?>">
			<?php echo esp_gravatar_image( 'brent@eventespresso.com', 'Brent Christensen' ); ?>

		<a class="web" href="<?php esp_gravatar_profile('brent@eventespresso.com'); ?>">
			Brent Christensen

		<?php _e('Lead Developer', 'event_espresso'); ?>

		<a href="<?php esp_gravatar_profile('darren@roughsmootheng.in'); ?>">
			<?php echo esp_gravatar_image( 'darren@roughsmootheng.in', 'Darren Ethier' ); ?>

		<a class="web" href="<?php esp_gravatar_profile('darren@roughsmootheng.in'); ?>">
			Darren Ethier

		<?php _e('Core Developer', 'event_espresso'); ?>

		<a href="<?php esp_gravatar_profile('michael@eventespresso.com'); ?>">
			<?php echo esp_gravatar_image( 'michael@eventespresso.com', 'Michael Nelson' ); ?>

		<a class="web" href="<?php esp_gravatar_profile('michael@eventespresso.com'); ?>">
			Michael Nelson

		<?php _e('Core Developer', 'event_espresso'); ?>

		<a href="<?php esp_gravatar_profile('nazar@eventespresso.com'); ?>">
			<?php echo esp_gravatar_image( 'nazar@eventespresso.com', 'Nazar Kolivoshka' ); ?>

		<a class="web" href="<?php esp_gravatar_profile('nazar@eventespresso.com'); ?>">
			Nazar Kolivoshka

		<?php _e('Core Developer', 'event_espresso'); ?>

<?php _e('Support Staff', 'event_espresso'); ?>

		<a href="<?php esp_gravatar_profile('josh@eventespresso.com'); ?>">
			<?php echo esp_gravatar_image( 'josh@eventespresso.com', 'Josh Feck' ); ?>

		<a class="web" href="<?php esp_gravatar_profile('josh@eventespresso.com'); ?>">
			Josh Feck

		<a href="<?php esp_gravatar_profile('dean@eventespresso.com'); ?>">
			<?php echo esp_gravatar_image( 'dean@eventespresso.com', 'Dean Robinson' ); ?>

		<a class="web" href="<?php esp_gravatar_profile('dean@eventespresso.com'); ?>">
			Dean Robinson

		<a href="<?php esp_gravatar_profile('jonathan@eventespresso.com'); ?>">
			<?php echo esp_gravatar_image( 'jonathan@eventespresso.com', 'Jonathan Wilson' ); ?>

		<a class="web" href="<?php esp_gravatar_profile('jonathan@eventespresso.com'); ?>">
			Jonathan Wilson

		<a href="<?php esp_gravatar_profile('tony@eventespresso.com'); ?>">
			<?php echo esp_gravatar_image( 'tony@eventespresso.com', 'Tony Warwick' ); ?>

		<a class="web" href="<?php esp_gravatar_profile('tony@eventespresso.com'); ?>">
			Tony Warwick

		<a href="<?php esp_gravatar_profile('lorenzo@eventespresso.com'); ?>">
			<?php echo esp_gravatar_image( 'lorenzo@eventespresso.com', 'Lorenzo Caum' ); ?>

		<a class="web" href="<?php esp_gravatar_profile('lorenzo@eventespresso.com'); ?>">
			Lorenzo Caum

<?php _e('Contributor Recognition', 'event_espresso'); ?>

	<?php printf( __('For every major release we want to recognize the people who contributed to the release via a GitHub pull request. Want to see your name listed here? %sWhen you submit a pull request that gets included in a major release%s, we\'ll add your name here linked to your GitHub profile.', 'event_espresso'), '', '' ); ?>

Matt Van Andel

Jonathan de Jong

Richard Tape

Robert Osborne

Robby Gunawan Sutanto

<?php _e('External Libraries', 'event_espresso'); ?>

	<?php printf( __('Along with the libraries %sincluded with WordPress%s, Event Espresso utilizes the following third party libraries:', 'event_espresso'), '', '' ); ?>

	<?php _e('accounting.js', 'event_espresso'); ?>,
	<?php _e('dompdf', 'event_espresso'); ?>,
	<?php _e('joyride2', 'event_espresso'); ?>,
	<?php _e('Kint', 'event_espresso'); ?>,
	<?php _e('Moment.js', 'event_espresso'); ?>,
	<?php _e('qTip2', 'event_espresso'); ?>,
	<?php _e('jQuery UI Timepicker', 'event_espresso'); ?>,
	<?php _e('SerializeFullArray', 'event_espresso'); ?>
	<?php _e('jQuery Validation', 'event_espresso'); ?>

<?php
	function esp_gravatar_profile($email) {
		echo 'http://www.gravatar.com/' . md5($email);
	}

	function esp_gravatar_image($email, $name) {
		echo '';
	}
?>


text:
package fr.montuelle.arduino.sensors.controllers

import javax.inject.Inject

import fr.montuelle.arduino.sensors.services.LoggerService
import play.api.libs.EventSource
import play.api.libs.json.{JsNull, JsValue, Json}
import play.api.mvc.{Controller, Action}
import reactivemongo.api.QueryOpts
import play.modules.reactivemongo.json.ImplicitBSONHandlers._
import play.api.libs.concurrent.Execution.Implicits.defaultContext

class Climate @Inject() (loggerService: LoggerService)  extends Controller {
  def getStream = Action {
    val enumerate = loggerService.collection.find(Json.obj())
      .sort(Json.obj("timestamp" -> -1))
      .options(QueryOpts(0, 10))
      .cursor[JsValue].enumerate()

    Ok.chunked(enumerate &> EventSource()).as("text/event-stream").withHeaders(ACCESS_CONTROL_ALLOW_ORIGIN -> "*")
  }
}


text:
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE127_Buffer_Underread__CWE839_fscanf_84_bad.cpp
Label Definition File: CWE127_Buffer_Underread__CWE839.label.xml
Template File: sources-sinks-84_bad.tmpl.cpp
*/
/*
 * @description
 * CWE: 127 Buffer Underread
 * BadSource: fscanf Read data from the console using fscanf()
 * GoodSource: Non-negative but less than 10
 * Sinks:
 *    GoodSink: Ensure the array index is valid
 *    BadSink : Improperly check the array index by not checking to see if the value is negative
 * Flow Variant: 84 Data flow: data passed to class constructor and destructor by declaring the class object on the heap and deleting it after use
 *
 * */
#ifndef OMITBAD

#include "std_testcase.h"
#include "CWE127_Buffer_Underread__CWE839_fscanf_84.h"

namespace CWE127_Buffer_Underread__CWE839_fscanf_84
{
CWE127_Buffer_Underread__CWE839_fscanf_84_bad::CWE127_Buffer_Underread__CWE839_fscanf_84_bad(int dataCopy)
{
    data = dataCopy;
    /* POTENTIAL FLAW: Read data from the console using fscanf() */
    fscanf(stdin, "%d", &data);
}

CWE127_Buffer_Underread__CWE839_fscanf_84_bad::~CWE127_Buffer_Underread__CWE839_fscanf_84_bad()
{
    {
        int buffer[10] = { 0 };
        /* POTENTIAL FLAW: Attempt to access a negative index of the array
         * This check does not check to see if the array index is negative */
        if (data < 10)
        {
            printIntLine(buffer[data]);
        }
        else
        {
            printLine("ERROR: Array index is too big.");
        }
    }
}
}
#endif /* OMITBAD */


text:
.class public Landroid/webkit/HttpAuthHandler;
.super Landroid/os/Handler;
.source "HttpAuthHandler.java"

# direct methods
.method constructor <init>()V
    .locals 0

    .prologue
    .line 31
    invoke-direct {p0}, Landroid/os/Handler;-><init>()V

    .line 32
    return-void
.end method

# virtual methods
.method public cancel()V
    .locals 0

    .prologue
    .line 46
    return-void
.end method

.method public proceed(Ljava/lang/String;Ljava/lang/String;)V
    .locals 0
    .parameter "username"
    .parameter "password"

    .prologue
    .line 52
    return-void
.end method

.method public suppressDialog()Z
    .locals 1

    .prologue
    .line 59
    const/4 v0, 0x0

    return v0
.end method

.method public useHttpAuthUsernamePassword()Z
    .locals 1

    .prologue
    .line 39
    const/4 v0, 0x0

    return v0
.end method


text:
// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Xml;
using SharpGen.Logging;
using SharpGen.Config;

namespace SharpGen.Model
{
    /// <summary>
    /// An assembly container for namespaces.
    /// </summary>
    public class CsAssembly : CsBase
    {
        private XmlDocument _codeComments;
        private List<ConfigFile> _configFilesLinked;

        /// <summary>
        /// Initializes a new instance of the <see cref="CsAssembly"/> class.
        /// </summary>
        /// <param name="assemblyName">Name of the assembly.</param>
        public CsAssembly(string assemblyName)
        {
            Name = assemblyName;
            Interop = new InteropManager();
            _configFilesLinked = new List<ConfigFile>();
            IsToUpdate = false;
        }

        /// <summary>
        /// Gets or sets the root directory of this assembly project.
        /// </summary>
        /// <value>The root directory.</value>
        public string RootDirectory { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether this instance is to update.
        /// </summary>
        /// <value>
        /// 	<c>true</c> if this instance is to update; otherwise, <c>false</c>.
        /// </value>
        public bool IsToUpdate { get; set; }

        /// <summary>
        /// Path to the CodeComments file
        /// </summary>
        public const string CodeCommentsPath = @"Documentation\CodeComments.xml";

        /// <summary>
        /// Gets config files linked to this assembly
        /// </summary>
        /// <value>The config files linked to this assembly.</value>
        public ReadOnlyCollection<ConfigFile> ConfigFilesLinked { get { return _configFilesLinked.AsReadOnly(); }}

        /// <summary>
        /// Adds linked config file to this instance.
        /// </summary>
        /// <param name="configFileToAdd">The config file to add.</param>
        public void AddLinkedConfigFile(ConfigFile configFileToAdd)
        {
            foreach (var configFile in _configFilesLinked)
                if (configFile.Id == configFileToAdd.Id)
                    return;

            _configFilesLinked.Add(configFileToAdd);
        }

        /// <summary>
        /// Gets the name of the check file for this assembly.
        /// </summary>
        /// <value>The name of the check file.</value>
        public string CheckFileName
        {
            get { return QualifiedName + ".check"; }
        }

        /// <summary>
        /// Gets the CodeComments XML document associated with this assembly.
        /// </summary>
        /// <value>The code comments.</value>
        public XmlDocument CodeComments
        {
            get
            {
                if (_codeComments == null)
                {
                    _codeComments = new XmlDocument();
                    string codeCommentsFullPath = Path.Combine(RootDirectory, CodeCommentsPath);

                    try
                    {
                        _codeComments.Load(codeCommentsFullPath);
                    }
                    catch (Exception ex)
                    {
                        Logger.Warning("Cannot load code comments from [{0}] for assembly [{1}]", codeCommentsFullPath, Name);
                    }
                }
                return _codeComments;
            }
        }

        /// <summary>
        /// Gets the namespaces.
        /// </summary>
        /// <value>The namespaces.</value>
        public IEnumerable<CsNamespace> Namespaces
        {
            get { return Items.OfType<CsNamespace>(); }
        }

        /// <summary>
        /// Gets or sets the interop associated with this AssemblyContainer.
        /// </summary>
        /// <value>The interop.</value>
        public InteropManager Interop
        {
            get;
            private set;
        }
    }
}


text:
#ifndef lint
static char id[] = "$Id: notice.c,v 1.3 2013/02/28 21:24:58 lombard Exp $";
#endif

#include <xview/xview.h>
#include <xview/notice.h>
#include "xv_proto.h"

void ReportFileNotFound(char *fname, int noPop)
{
    Xv_notice notice;
    char msg[200];

    sprintf(msg, "File %s nonexistent.", fname);
    if (tracesFrame && ! noPop) {
	notice=xv_create(tracesFrame, NOTICE,
	     NOTICE_MESSAGE_STRING, msg,
	     XV_SHOW, TRUE,
	     NULL);
    }else {
	fprintf(stderr, "%s\n", msg);
    }
    return;
}

void ReportError(char *template, char *fname)
{
    Xv_notice notice;
    char msg[200];

    sprintf(msg, template, fname);
    if (tracesFrame) {
	notice=xv_create(tracesFrame, NOTICE,
	     NOTICE_MESSAGE_STRING, msg,
	     XV_SHOW, TRUE,
	     NULL);
    }else {
	fprintf(stderr, "%s\n", msg);
    }
    return;
}


text:
mkdir $DEPLOY_DIRECTORY

set -o pipefail &&
  env NSUnbufferedIO=YES \
  xcodebuild \
    -workspace "$XCODEBUILD_WORKSPACE" \
    -scheme "$XCODEBUILD_SCHEME" \
    -destination "$1" \
    -resultBundlePath "./deploy/Test.xcresult" \
    -enableCodeCoverage YES \
    clean test \
  | tee "./deploy/xcodebuild.log" \
  | xcpretty

# Bitrise also calls the following:

#     COMPILER_INDEX_STORE_ENABLE=NO \
#     GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES \
#     GCC_GENERATE_TEST_COVERAGE_FILES=YES \
#     xcpretty -color --report html --output output/xcode-test-results-UtilityBelt.html


text:
package org.mrgeo.resources.wms;

import com.sun.jersey.api.client.ClientResponse;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.mrgeo.core.MrGeoConstants;
import org.mrgeo.junit.IntegrationTest;
import org.mrgeo.test.TestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;

import javax.ws.rs.core.Response;
import java.io.IOException;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

@SuppressWarnings("static-method")
public class ImageFormatTypeVariantsTest extends WmsGeneratorTestAbstract
{
  private static final Logger log = LoggerFactory.getLogger(ImageFormatTypeVariantsTest.class);

  @BeforeClass
  public static void setUpForJUnit()
  {
    try
    {
      baselineInput = TestUtils.composeInputDir(ImageFormatTypeVariantsTest.class);
      WmsGeneratorTestAbstract.setUpForJUnit();
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }

  private ClientResponse testGetMapWithVariant(String format) throws IOException, SAXException
  {
    ClientResponse response = resource().path("/wms")
        .queryParam("SERVICE", "WMS")
        .queryParam("REQUEST", "getmap")
        .queryParam("LAYERS", "IslandsElevation-v2")
        .queryParam("FORMAT", format)
        .queryParam("BBOX", ISLANDS_ELEVATION_V2_IN_BOUNDS_SINGLE_SOURCE_TILE)
        .queryParam("WIDTH", MrGeoConstants.MRGEO_MRS_TILESIZE_DEFAULT)
        .queryParam("HEIGHT", MrGeoConstants.MRGEO_MRS_TILESIZE_DEFAULT)
        .get(ClientResponse.class);
    return response;
  }

  /*
   * These are variants from the standard mime types we're allowing to be flexible.  Its debatable
   * how useful this test is, since it requires maintenance every time a new image format is added.
   * Often, non-standard mime types are passed into WMS requests, so keeping this test for now.
   * Here only GetMap requests are being tested since the image format parsing code path is the
   * same for all WMS request types.  Also, only a non-zero response length is checked for here,
   * rather than a full image comparison, since that coverage is in other tests.
   */
  @Test
  @Category(IntegrationTest.class)
  public void testVariants() throws Exception
  {
    ClientResponse response  = null;
    try
    {
      //correct format is "image/png"
      String[] pngVariants = new String[]{ "PNG", "png", "IMAGE/PNG", "image/PNG" };
      for (int i = 0; i < pngVariants.length; i++)
      {
        log.info("Checking image format: " + pngVariants[i] + " ...");
        try
        {
          response = testGetMapWithVariant(pngVariants[i]);
        }
        finally
        {
          Assert.assertNotNull(response);
          assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
          assertFalse(response.getEntity(String.class).contains("Invalid format"));
          response.close();
        }
      }
      //correct format is "image/jpeg"
      String[] jpgVariants = new String[]{ "jpeg", "jpg", "JPG", "JPEG", "image/jpg", "IMAGE/JPG",
          "image/JPG", "IMAGE/JPEG", "image/JPEG" };
      for (int i = 0; i < jpgVariants.length; i++)
      {
        log.info("Checking image format: " + jpgVariants[i] + " ...");
        try
        {
          response = testGetMapWithVariant(jpgVariants[i]);
        }
        finally
        {
          Assert.assertNotNull(response);
          assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
          assertFalse(response.getEntity(String.class).contains("Invalid format"));
          response.close();
        }
      }

      //correct format is "image/tiff"
      String[] tifVariants = new String[]{ "tiff", "tif", "TIF", "TIFF", "image/tif", "IMAGE/TIF",
          "image/TIF", "IMAGE/TIFF", "image/TIFF" };
      for (int i = 0; i < tifVariants.length; i++)
      {
        log.info("Checking image format: " + tifVariants[i] + " ...");
        try
        {
          response = testGetMapWithVariant(tifVariants[i]);
        }
        finally
        {
          Assert.assertNotNull(response);
          assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
          assertFalse(response.getEntity(String.class).contains("Invalid format"));
          response.close();
        }
      }
    }
    catch (Exception e)
    {
      e.printStackTrace();
      throw e;
    }
  }
}


text:
export interface A {}
export interface B extends A {}
export interface C extends B {}
export interface D extends C {}


text:
package iso20022

// Transfer from one investment fund/fund class to another investment fund or investment fund class by the investor. A switch is composed of one or several subscription legs, and one or several redemption legs.
type SwitchOrder3 struct {

	// Unique and unambiguous identifier for a group of individual orders, as assigned by the instructing party. This identifier links the individual orders together.
	MasterReference *Max35Text `xml:"MstrRef,omitempty"`

	// Date and time at which the order was placed by the investor.
	OrderDateTime *ISODateTime `xml:"OrdrDtTm,omitempty"`

	// Unique and unambiguous identifier for an order, as assigned by the instructing party.
	OrderReference *Max35Text `xml:"OrdrRef"`

	// Unique and unambiguous investor's identification of an order. This reference can typically be used in a hub scenario to give the reference of the order as assigned by the underlying client.
	ClientReference *Max35Text `xml:"ClntRef,omitempty"`

	// Unique and unambiguous identifier for an order cancellation, as assigned by the instructing party.
	CancellationReference *Max35Text `xml:"CxlRef,omitempty"`

	// Account between an investor(s) and a fund manager or a fund. The account can contain holdings in any investment fund or investment fund class managed (or distributed) by the fund manager, within the same fund family.
	InvestmentAccountDetails *InvestmentAccount21 `xml:"InvstmtAcctDtls,omitempty"`

	// Amount of money used to derive the quantity of investment fund units to be redeemed.
	TotalRedemptionAmount *ActiveOrHistoricCurrencyAndAmount `xml:"TtlRedAmt,omitempty"`

	// Amount of money used to derive the quantity of investment fund units to be subscribed.
	TotalSubscriptionAmount *ActiveOrHistoricCurrencyAndAmount `xml:"TtlSbcptAmt,omitempty"`

	// Future date at which the investor requests the order to be executed.
	// The specification of a requested future trade date is not allowed in some markets. The date must be a date in the future.
	RequestedFutureTradeDate *ISODate `xml:"ReqdFutrTradDt,omitempty"`

	// Total amount of money paid /to be paid or received in exchange for the financial instrument in the individual order.
	SettlementAmount *ActiveCurrencyAndAmount `xml:"SttlmAmt,omitempty"`

	// Date on which cash is available.
	CashSettlementDate *ISODate `xml:"CshSttlmDt,omitempty"`

	// Method by which the transaction is settled.
	SettlementMethod *DeliveryReceiptType2Code `xml:"SttlmMtd,omitempty"`

	// Date on which the order expires.
	ExpiryDateTime *DateAndDateTimeChoice `xml:"XpryDtTm,omitempty"`

	// Additional amount of money paid by the investor in addition to the switch redemption amount.
	AdditionalCashIn *ActiveOrHistoricCurrencyAndAmount `xml:"AddtlCshIn,omitempty"`

	// Amount of money that results from a switch-out, that is not reinvested in another investment fund, and is repaid to the investor.
	ResultingCashOut *ActiveOrHistoricCurrencyAndAmount `xml:"RsltgCshOut,omitempty"`

	// Information about parties related to the transaction.
	RelatedPartyDetails []*Intermediary8 `xml:"RltdPtyDtls,omitempty"`

	// Cancellation right of an investor with respect to an investment fund order.
	CancellationRight *CancellationRight1Code `xml:"CxlRght,omitempty"`

	// Cancellation right of an investor with respect to an investment fund order.
	ExtendedCancellationRight *Extended350Code `xml:"XtndedCxlRght,omitempty"`

	// Part of an investment fund switch order that is a redemption.
	RedemptionLegDetails []*SwitchRedemptionLegOrder3 `xml:"RedLegDtls"`

	// Part of an investment fund switch order that is a subscription.
	SubscriptionLegDetails []*SwitchSubscriptionLegOrder3 `xml:"SbcptLegDtls"`

	// Payment processes required to transfer cash from the debtor to the creditor.
	CashSettlementDetails *PaymentTransaction25 `xml:"CshSttlmDtls,omitempty"`

	// Information needed to process a currency exchange or conversion.
	ForeignExchangeDetails *ForeignExchangeTerms6 `xml:"FXDtls,omitempty"`

	// Specifies if advice has been received from an independent financial advisor.
	FinancialAdvice *FinancialAdvice1Code `xml:"FinAdvc,omitempty"`

	// Specifies whether the trade is negotiated.
	NegotiatedTrade *NegotiatedTrade1Code `xml:"NgtdTrad,omitempty"`
}

func (s *SwitchOrder3) SetMasterReference(value string) {
	s.MasterReference = (*Max35Text)(&value)
}

func (s *SwitchOrder3) SetOrderDateTime(value string) {
	s.OrderDateTime = (*ISODateTime)(&value)
}

func (s *SwitchOrder3) SetOrderReference(value string) {
	s.OrderReference = (*Max35Text)(&value)
}

func (s *SwitchOrder3) SetClientReference(value string) {
	s.ClientReference = (*Max35Text)(&value)
}

func (s *SwitchOrder3) SetCancellationReference(value string) {
	s.CancellationReference = (*Max35Text)(&value)
}

func (s *SwitchOrder3) AddInvestmentAccountDetails() *InvestmentAccount21 {
	s.InvestmentAccountDetails = new(InvestmentAccount21)
	return s.InvestmentAccountDetails
}

func (s *SwitchOrder3) SetTotalRedemptionAmount(value, currency string) {
	s.TotalRedemptionAmount = NewActiveOrHistoricCurrencyAndAmount(value, currency)
}

func (s *SwitchOrder3) SetTotalSubscriptionAmount(value, currency string) {
	s.TotalSubscriptionAmount = NewActiveOrHistoricCurrencyAndAmount(value, currency)
}

func (s *SwitchOrder3) SetRequestedFutureTradeDate(value string) {
	s.RequestedFutureTradeDate = (*ISODate)(&value)
}

func (s *SwitchOrder3) SetSettlementAmount(value, currency string) {
	s.SettlementAmount = NewActiveCurrencyAndAmount(value, currency)
}

func (s *SwitchOrder3) SetCashSettlementDate(value string) {
	s.CashSettlementDate = (*ISODate)(&value)
}

func (s *SwitchOrder3) SetSettlementMethod(value string) {
	s.SettlementMethod = (*DeliveryReceiptType2Code)(&value)
}

func (s *SwitchOrder3) AddExpiryDateTime() *DateAndDateTimeChoice {
	s.ExpiryDateTime = new(DateAndDateTimeChoice)
	return s.ExpiryDateTime
}

func (s *SwitchOrder3) SetAdditionalCashIn(value, currency string) {
	s.AdditionalCashIn = NewActiveOrHistoricCurrencyAndAmount(value, currency)
}

func (s *SwitchOrder3) SetResultingCashOut(value, currency string) {
	s.ResultingCashOut = NewActiveOrHistoricCurrencyAndAmount(value, currency)
}

func (s *SwitchOrder3) AddRelatedPartyDetails() *Intermediary8 {
	newValue := new(Intermediary8)
	s.RelatedPartyDetails = append(s.RelatedPartyDetails, newValue)
	return newValue
}

func (s *SwitchOrder3) SetCancellationRight(value string) {
	s.CancellationRight = (*CancellationRight1Code)(&value)
}

func (s *SwitchOrder3) SetExtendedCancellationRight(value string) {
	s.ExtendedCancellationRight = (*Extended350Code)(&value)
}

func (s *SwitchOrder3) AddRedemptionLegDetails() *SwitchRedemptionLegOrder3 {
	newValue := new(SwitchRedemptionLegOrder3)
	s.RedemptionLegDetails = append(s.RedemptionLegDetails, newValue)
	return newValue
}

func (s *SwitchOrder3) AddSubscriptionLegDetails() *SwitchSubscriptionLegOrder3 {
	newValue := new(SwitchSubscriptionLegOrder3)
	s.SubscriptionLegDetails = append(s.SubscriptionLegDetails, newValue)
	return newValue
}

func (s *SwitchOrder3) AddCashSettlementDetails() *PaymentTransaction25 {
	s.CashSettlementDetails = new(PaymentTransaction25)
	return s.CashSettlementDetails
}

func (s *SwitchOrder3) AddForeignExchangeDetails() *ForeignExchangeTerms6 {
	s.ForeignExchangeDetails = new(ForeignExchangeTerms6)
	return s.ForeignExchangeDetails
}

func (s *SwitchOrder3) SetFinancialAdvice(value string) {
	s.FinancialAdvice = (*FinancialAdvice1Code)(&value)
}

func (s *SwitchOrder3) SetNegotiatedTrade(value string) {
	s.NegotiatedTrade = (*NegotiatedTrade1Code)(&value)
}


text:
package org.jetbrains.idea.devkit.inspections.internal;

import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.util.InheritanceUtil;
import com.intellij.psi.util.PsiTreeUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.devkit.inspections.DevKitInspectionBase;

public class UnsafeVfsRecursionInspection extends DevKitInspectionBase {
  private static final String VIRTUAL_FILE_CLASS_NAME = VirtualFile.class.getName();
  private static final String GET_CHILDREN_METHOD_NAME = "getChildren";

  private static final String MESSAGE =
    "VirtualFile.getChildren() is called from a recursive method. " +
    "This may cause an endless loop on cyclic symlinks. " +
    "Please use VfsUtilCore.visitChildrenRecursively() instead.";

  @NotNull
  @Override
  public PsiElementVisitor buildInternalVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) {
    return new JavaElementVisitor() {
      @Override
      public void visitMethodCallExpression(final PsiMethodCallExpression expression) {
        final Project project = expression.getProject();
        final JavaPsiFacade facade = JavaPsiFacade.getInstance(project);

        final PsiReferenceExpression methodRef = expression.getMethodExpression();
        if (!GET_CHILDREN_METHOD_NAME.equals(methodRef.getReferenceName())) return;
        final PsiElement methodElement = methodRef.resolve();
        if (!(methodElement instanceof PsiMethod)) return;
        final PsiMethod method = (PsiMethod)methodElement;
        final PsiClass aClass = method.getContainingClass();
        final PsiClass virtualFileClass = facade.findClass(VIRTUAL_FILE_CLASS_NAME, GlobalSearchScope.allScope(project));
        if (!InheritanceUtil.isInheritorOrSelf(aClass, virtualFileClass, true)) return;

        final PsiMethod containingMethod = PsiTreeUtil.getParentOfType(expression, PsiMethod.class);
        if (containingMethod == null) return;
        final String containingMethodName = containingMethod.getName();
        final Ref<Boolean> result = Ref.create();
        containingMethod.accept(new JavaRecursiveElementVisitor() {
          @Override
          public void visitMethodCallExpression(final PsiMethodCallExpression expression2) {
            if (expression2 != expression &&
                containingMethodName.equals(expression2.getMethodExpression().getReferenceName()) &&
                expression2.resolveMethod() == containingMethod) {
              result.set(Boolean.TRUE);
            }
          }
        });

        if (!result.isNull()) {
          holder.registerProblem(expression, MESSAGE);
        }
      }
    };
  }
}


text:
using System;
using System.Collections.Generic;
using InfluxDB.Collector.Diagnostics;
using InfluxDB.Collector.Pipeline;

namespace InfluxDB.Collector
{
    public abstract class MetricsCollector : IPointEmitter, IDisposable
    {
        readonly Util.ITimestampSource _timestampSource = new Util.PseudoHighResTimestampSource();

        public void Increment(string measurement, long count = 1, IReadOnlyDictionary<string, string> tags = null)
        {
            Write(measurement, new Dictionary<string, object> { { "count", count } }, tags);
        }

        public void Measure(string measurement, object value, IReadOnlyDictionary<string, string> tags = null)
        {
            Write(measurement, new Dictionary<string, object> { { "value", value } }, tags);
        }

        public IDisposable Time(string measurement, IReadOnlyDictionary<string, string> tags = null)
        {
            return new StopwatchTimer(this, measurement, tags);
        }

        public CollectorConfiguration Specialize()
        {
            return new CollectorConfiguration(this);
        }

        public void Dispose()
        {
            Dispose(true);
        }

        protected virtual void Dispose(bool disposing) { }

        public void Write(string measurement, IReadOnlyDictionary<string, object> fields, IReadOnlyDictionary<string, string> tags = null, DateTime? timestamp = null)
        {
            try
            {
                var point = new PointData(measurement, fields, tags, timestamp ?? _timestampSource.GetUtcNow());
                Emit(new[] { point });
            }
            catch (Exception ex)
            {
                CollectorLog.ReportError("Failed to write point", ex);
            }
        }

        void IPointEmitter.Emit(PointData[] points)
        {
            Emit(points);
        }

        protected abstract void Emit(PointData[] points);
    }
}


text:
FOUNDATION FOR EMAILS

We know building HTML emails is hard, especially responsive emails. That's why we created Foundation for Emails. Get away from complex table markup and inconsistent results. Use Foundation for Emails to spend less time coding emails, and more time
    on other things, like building amazing products.

  <button data-toggle="read-more-content" href="#">SHOW MORE </button>

Spend Less Time Coding, Testing, and Preparing:

Responsive Grid for Any Layout

Common UI Patterns to Build Faster

Make stylish emails fast with Sass

Inky: A New Templating Language

The ZURB Email Stack will make you an email pro

Emails that work in all of the major clients, even Outlook

Inlining CSS is was a pain

Motion UI Animations

Choose from the following classes to change the animation:

  <button data-toggle="read-more" href="#">SHOW MORE </button>

Spend Less Time Coding, Testing, and Preparing:

Slide:

.slide-in-down

.slide-in-left

.slide-in-up

.slide-in-right

.slide-out-down

.slide-out-left

.slide-out-up

.slide-out-right

Fade:

.fade-in

.fade-out

Hinge:

.hinge-in-from-top

.hinge-in-from-right

.hinge-in-from-bottom

.hinge-in-from-left

.hinge-in-from-middle-x

.hinge-in-from-middle-y

.hinge-out-from-top

.hinge-out-from-right

.hinge-out-from-bottom

.hinge-out-from-left

.hinge-out-from-middle-x

.hinge-out-from-middle-y

Scale:

.scale-in-up

.scale-in-down

.scale-out-up

.scale-out-down

Spin:

.spin-in

.spin-out

.spin-in-ccw

.spin-out-ccw

    <button data-toggle="read-more" href="#">SHOW LESS </button>


text:
package com.github.agaro1121.models.pvpmatches

case class PvpMatch(
                     id: String,
                     startAt: String,
                     endAt: String,
                     url: String,
                     description: String,
                     glickoRatings: Boolean,
                     pvp: Boolean,
                     style: String,
                     registerAt: String
                   )

case class PvpMatches(pvpMatches: Seq[PvpMatch])


text:
module.exports = function array_diff (arr1) { // eslint-disable-line camelcase
  //  discuss at: https://locutus.io/php/array_diff/
  // original by: Kevin van Zonneveld (https://kvz.io)
  // improved by: Sanjoy Roy
  //  revised by: Brett Zamir (https://brett-zamir.me)
  //   example 1: array_diff(['Kevin', 'van', 'Zonneveld'], ['van', 'Zonneveld'])
  //   returns 1: {0:'Kevin'}

  var retArr = {}
  var argl = arguments.length
  var k1 = ''
  var i = 1
  var k = ''
  var arr = {}

  arr1keys: for (k1 in arr1) { // eslint-disable-line no-labels
    for (i = 1; i < argl; i++) {
      arr = arguments[i]
      for (k in arr) {
        if (arr[k] === arr1[k1]) {
          // If it reaches here, it was found in at least one array, so try next value
          continue arr1keys // eslint-disable-line no-labels
        }
      }
      retArr[k1] = arr1[k1]
    }
  }

  return retArr
}


text:
layout: post
date:	2009-04-16 23:28:00
title:  Kukkerahalli Kere (Lake) Mysore, 110409
tags: [archived-posts]
categories: archives
permalink: /:categories/:year/:month/:day/:title/
---
I took a sudden decision to go and show my camera to Mr K U Varghese, whom I had met on the INW meet, and ask him for a final opinion on my dear departed MLC, and also meet Madhusmita, and do some birding as well, at Kukkerahalli Lake....

While Mr Varghese was inspecting the MLC, here are the birds that we saw....

The PAINTED STORKS were nesting in the island in the middle of the lake....the name suits them so well!

<lj-cut text="You want to see more?">

Here's a Painted Stork with a BLACK-HEADED IBIS:

I just loved this "line-up" of ducks!

Some of them were SPOT-BILLED DUCKS:

There were also BRONZE-WINGED JACANAS, wading around:

Up in the trees, there were WHITE-THROATED FANTAILS calling; when I tried to photograph one, of course, as usual, it showed me its fan-tail by mooning me....

I got a distant and fuzzy shot of a DARTER (SNAKE BIRD) flying across the lake:

I liked the back light on this POND HERON:

The winter visitors, the SPOT-BILLED PELICANS, were still around on the lake:

</lj-cut>

And after seeing the birds, as we left, I took this sunset shot for <LJ user="asakiyume">....

A short session of birding, but really enjoyable...and on the way back home, the video being shown on the bus was that old Hindi hit, "Sholay"...it was nice to see the rocks and boulders of Ramnagara (that are locales for several scenes in the film) as we physically passed through the same area!

Madhu came back to Bangalore  with Anush and me, and we went birding to Valley School on Sunday  morning....then she took the bus back to Mysore.


text:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="ivy-report.xsl"?>
<ivy-report version="1.0">
	<info
		organisation="play-example-form"
		module="play-example-form_2.11"
		revision="1.0-SNAPSHOT"
		conf="echo-sigar"
		confs="compile, runtime, test, provided, optional, compile-internal, runtime-internal, test-internal, plugin, sources, docs, pom, scala-tool, echo-trace-compile, echo-trace-test, echo-weave, echo-sigar"
		date="20150527010454"/>
	<dependencies>
		<module organisation="com.typesafe.trace" name="trace-sigar-libs">
			<revision name="0.1.7" status="release" pubdate="20150421192508" resolver="sbt-chain" artresolver="sbt-chain" homepage="" downloaded="false" searched="false" default="false" conf="default(compile), default, compile, runtime, master" position="0">
				<metadata-artifact status="no" details="" size="2245" time="0" location="/Users/yonizohar/.ivy2/cache/com.typesafe.trace/trace-sigar-libs/ivy-0.1.7.xml" searched="false" origin-is-local="false" origin-location="https://repo.typesafe.com/typesafe/releases/com/typesafe/trace/trace-sigar-libs/0.1.7/trace-sigar-libs-0.1.7.pom"/>
				<caller organisation="play-example-form" name="play-example-form_2.11" conf="echo-sigar" rev="0.1.7" rev-constraint-default="0.1.7" rev-constraint-dynamic="0.1.7" callerrev="1.0-SNAPSHOT"/>
				<artifacts>
					<artifact name="trace-sigar-libs" type="jar" ext="jar" status="no" details="" size="2099398" time="0" location="/Users/yonizohar/.ivy2/cache/com.typesafe.trace/trace-sigar-libs/jars/trace-sigar-libs-0.1.7.jar">
						<origin-location is-local="false" location="https://repo.typesafe.com/typesafe/releases/com/typesafe/trace/trace-sigar-libs/0.1.7/trace-sigar-libs-0.1.7.jar"/>
					</artifact>
				</artifacts>
			</revision>
		</module>
	</dependencies>
</ivy-report>


text:
.. _vms-autoscaling:

Configuring Autoscaling
=======================

This guide explains how to configure the Ray autoscaler using the Ray cluster launcher.
The Ray autoscaler is a Ray cluster process that automatically scales a cluster up and down based on resource demand.
The autoscaler does this by adjusting the number of nodes in the cluster based on the resources required by tasks, actors or placement groups.

Note that the autoscaler only considers logical resource requests for scaling (i.e., those specified in ``@ray.remote`` and displayed in `ray status`), not physical machine utilization. If a user tries to launch an actor, task, or placement group but there are insufficient resources, the request will be queued. The autoscaler adds nodes to satisfy resource demands in this queue.
The autoscaler also removes nodes after they become idle for some time.
A node is considered idle if it has no active tasks, actors, or objects.

.. tip::
  **When to use Autoscaling?**

  Autoscaling can reduce workload costs, but adds node launch overheads and can be tricky to configure.
  We recommend starting with non-autoscaling clusters if you're new to Ray.

Cluster Config Parameters
-------------------------

The following options are available in your cluster config file.
It is recommended that you set these before launching your cluster, but you can also modify them at run-time by updating the cluster config.

`max_workers[default_value=2, min_value=0]`: The max number of cluster worker nodes to launch. Note that this does not include the head node.

`min_workers[default_value=0, min_value=0]`: The min number of cluster worker nodes to launch, regardless of utilization. Note that this does not include the head node. This number must be less than the ``max_workers``.

.. note::

  If `max_workers` is modified at runtime, the autoscaler will immediately remove nodes until this constraint
  is satisfied. This may disrupt running workloads.

If you are using more than one node type, you can also set min and max workers for each individual type:

`available_node_types.<node_type_name>.max_workers[default_value=cluster max_workers, min_value=0]`: The maximum number of worker nodes of a given type to launch. This number must be less than or equal to the `max_workers` for the cluster.

`available_node_types.<node_type_name>.min_workers[default_value=0, min_value=0]`: The minimum number of worker nodes of a given type to launch, regardless of utilization. The sum of `min_workers` across all node types must be less than or equal to the `max_workers` for the cluster.

Upscaling and downscaling speed
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If needed, you can also control the rate at which nodes should be added to or removed from the cluster. For applications with many short-lived tasks, you may wish to adjust the upscaling and downscaling speed to be more conservative.

`upscaling_speed[default_value=1.0, min_value=1.0]`: The number of nodes allowed to be pending as a multiple of the current number of nodes. The higher the value, the more aggressive upscaling will be. For example, if this is set to 1.0, the cluster can grow in size by at most 100% at any time, so if the cluster currently has 20 nodes, at most 20 pending
launches are allowed. The minimum number of pending launches is 5 regardless of this setting.

`idle_timeout_minutes[default_value=5, min_value=0]`: The number of minutes that need to pass before an idle worker node is removed by the
autoscaler. The smaller the value, the more aggressive downscaling will be. Worker nodes are considered idle when they hold no active tasks, actors, or referenced objects (either in-memory or spilled to disk). This parameter does not affect the head node.

Programmatic Scaling
--------------------

For more information on programmatic access to the autoscaler, see the :ref:`Programmatic Cluster Scaling Guide <ref-autoscaler-sdk>`.


text:
'use strict';

let Utils = require('./Utils');

/**
 * Get scene by id command
 *
 * Get a list of scenes
 */
class GetSceneById {
  /**
   * Constructor
   *
   * @param {int} sceneId Scene Id
   */
  constructor(sceneId) {
    this.sceneId = String(sceneId);
  }

  /**
   * Invoke command
   *
   * @param {Client} client Client
   *
   * @return {Promise} Promise for chaining
   */
  invoke(client) {
    let options = {
      url: `api/${client.username}/scenes/${this.sceneId}`
    };

    return client.getTransport()
      .sendRequest(options)
      .then(result => {
        result.id = this.sceneId;

        return Utils.buildScene(result);
      });
  }
}

module.exports = GetSceneById;


text:
FROM phusion/baseimage:0.9.15

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update
RUN apt-get install -y spamassassin

RUN groupadd spamd && \
    useradd -g spamd -s /bin/false -d /var/log/spamassassin spamd && \
    mkdir -p /var/log/spamassassin && \
    chown -R spamd:spamd /var/log/spamassassin

ADD spamd.sh /tmp/spamd.sh
RUN mkdir /etc/service/spamd && \
    mv /tmp/spamd.sh /etc/service/spamd/run && \
    chmod +x /etc/service/spamd/run

ADD local.cf /etc/spamassassin/local.cf
ADD spam-learn /etc/cron.daily/spam-learn

CMD ["/sbin/my_init"]


text:
class ApplicationController < ActionController::Base
  # Prevent CSRF attacks by raising an exception.
  # For APIs, you may want to use :null_session instead.
  protect_from_forgery with: :exception

  # before_action :set_locale
  #
  # protected
  #
  # def set_locale
  #   if params[:locale].blank?
  #     I18n.locale = :'pt-BR'
  #   else
  #     I18n.locale = params[:locale]
  #   end
  # end
end


text:
var refreshRate = 25;

// This can be toggled in the console to output debug info
var debug = false;

// HTML element variables
var verisurf_x = $("#x_measured");
var verisurf_y = $("#y_measured");
var verisurf_z = $("#z_measured");
var verisurf_dx = $("#x_deviation");
var verisurf_dy = $("#y_deviation");
var verisurf_dz = $("#z_deviation");
var verisurf_d3 = $("#d3_measured");
var verisurf_px = $("#x_nominal");
var verisurf_py = $("#y_nominal");
var verisurf_pz = $("#z_nominal");

var refreshInput = $("#refresh-input");

// other variables
var deviceID = 0;
var websocket;
var timer;

// Function called when dropdown is changed
function setDevice(id) {
    deviceID = id;
}

// Updates refresh rate
refreshInput.keyup(function () {
    var value = parseInt(this.value);
    if (isNaN(value) && this.value != "")
        refreshInput.css("color", "#F44336");
    else
        refreshInput.css("color", "white");

    refreshRate = value;
    console.log(refreshRate);
});

function sendCommand(command) {
    websocket.send("<" + command + " />\n");
    console.log("Command: " + command);
}

// Sends command to retrieve current device info
function socketTimerCallback() {
    websocket.send("<device_info id='" + deviceID + "' />\n");
    console.log("fire");
    setTimeout(socketTimerCallback, refreshRate);
}

// Checks if the current value is zero or null
function ifNullZero(value) {
    if (value == null)
        return "0.0000";
    else
        return parseFloat(value).toFixed(4);
}

$(function () {
    websocket = new WebSocket("ws://localhost:6734");

    websocket.onopen = function (event) {
        websocket.send("<device_list />\n");
        timer = setTimeout(socketTimerCallback, refreshRate);
    };

    websocket.onmessage = function (event) {
        var domparser = new DOMParser();
        var xmlDoc = domparser.parseFromString(event.data, "text/xml");
        var info = xmlDoc.getElementsByTagName("device_info");
        if (info.length > 0) {
            verisurf_x.text(ifNullZero(info[0].getAttribute("X")));
            verisurf_px.text(ifNullZero(info[0].getAttribute("PX")));
            verisurf_dx.text(ifNullZero(info[0].getAttribute("DX")));

            verisurf_y.text(ifNullZero(info[0].getAttribute("Y")));
            verisurf_py.text(ifNullZero(info[0].getAttribute("PY")));
            verisurf_dy.text(ifNullZero(info[0].getAttribute("DY")));

            verisurf_z.text(ifNullZero(info[0].getAttribute("Z")));
            verisurf_pz.text(ifNullZero(info[0].getAttribute("PZ")));
            verisurf_dz.text(ifNullZero(info[0].getAttribute("DZ")));

            verisurf_d3.text(ifNullZero(info[0].getAttribute("D3")));
        }
        var deviceList = xmlDoc.getElementsByTagName("device_list");
        if (deviceList.length > 0) {
            var devices = deviceList[0].getElementsByTagName("device");
            for (var i = 0; i < devices.length; i++) {
                var elem = $("#settings-menu").children().eq(i + 3);
                console.log(elem);
                var name = devices[i].getAttribute("name");
                if (name == "")
                    elem.hide();
                else
                    elem.show().html(' ' + name + ' ');
            }
        }
        if (debug)
            console.log(event.data);
    };

    websocket.onclose = function (event) {
        clearTimeout(timer);
    };
});


text:
            Key
            Default
            Description

restart-backoff-time-strategy.failure-rate.backoff-time

            0
            Backoff time in milliseconds between two consecutive restart attempts.

restart-backoff-time-strategy.failure-rate.failure-rate-interval

            60000
            Time interval in milliseconds for measuring failure rate.

restart-backoff-time-strategy.failure-rate.max-failures-per-interval

            1
            Maximum number of failures in given time interval before failing a job.

restart-backoff-time-strategy.fixed-delay.attempts

            2147483647
            Maximum number of attempts the fixed delay restart strategy will try before failing a job.

restart-backoff-time-strategy.fixed-delay.backoff-time

            0
            Backoff time in milliseconds between two consecutive restart attempts.


text:
import { FETCH_PRODUCT_FAILURE, RESET_ERROR_MESSAGE } from '../constants/ProductActionTypes'

// Updates error message to notify about the failed fetches.
export function errorMessage(state = null, action) {
  const { type, error } = action
  if (type === RESET_ERROR_MESSAGE) {
    // this isn't used yet but should clear the error in the future
    return null
  } else if (type === FETCH_PRODUCT_FAILURE && error) {
    return action.error
  }

  return state
}


text:
package com.rs.game.player.controlers.castlewars;

import com.rs.game.WorldObject;
import com.rs.game.WorldTile;
import com.rs.game.minigames.CastleWars;
import com.rs.game.player.Equipment;
import com.rs.game.player.controlers.Controler;

public class CastleWarsWaiting extends Controler {

	private int team;

	@Override
	public void start() {
		team = (int) getArguments()[0];
		sendInterfaces();
	}

	// You can't leave just like that!

	public void leave() {
		player.getPackets().closeInterface(
				player.getInterfaceManager().hasRezizableScreen() ?  34 : 0);
		CastleWars.removeWaitingPlayer(player, team);
	}

	@Override
	public void sendInterfaces() {
		player.getInterfaceManager().sendTab(
				player.getInterfaceManager().hasRezizableScreen() ?  34 : 0, 57);
	}

	@Override
	public boolean processButtonClick(int interfaceId, int componentId,
			int slotId, int packetId) {
		if (interfaceId == 387) {
			if (componentId == 9 /*|| componentId == 6*/) {
			player.getPackets().sendGameMessage(
					"You can't remove your team's colours.");
				return false;
			}
		}
		return true;
	}

	@Override
	public boolean canEquip(int slotId, int itemId) {
		if (slotId == Equipment.SLOT_CAPE /*|| slotId == Equipment.SLOT_HAT*/) {
			player.getPackets().sendGameMessage(
					"You can't remove your team's colours.");
			return false;
		}
		return true;
	}

	@Override
	public boolean sendDeath() {
		removeControler();
		leave();
		return true;
	}

	@Override
	public boolean logout() {
		player.setLocation(new WorldTile(CastleWars.LOBBY, 2));
		return true;
	}

	@Override
	public boolean processMagicTeleport(WorldTile toTile) {
		player.getDialogueManager().startDialogue("SimpleMessage",
				"You can't leave just like that!");
		return false;
	}

	@Override
	public boolean processItemTeleport(WorldTile toTile) {
		player.getDialogueManager().startDialogue("SimpleMessage",
				"You can't leave just like that!");
		return false;
	}

	@Override
	public boolean processObjectTeleport(WorldTile toTile) {
		player.getDialogueManager().startDialogue("SimpleMessage",
				"You can't leave just like that!");
		return false;
	}

	@Override
	public boolean processObjectClick1(WorldObject object) {
		int id = object.getId();
		if (id == 4389 || id == 4390) {
			removeControler();
			leave();
			return false;
		}
		return true;
	}

	@Override
	public void magicTeleported(int type) {
		removeControler();
		leave();
	}

	@Override
	public void forceClose() {
		leave();
	}
}


text:
#include <babylon/meshes/builders/shape_builder.h>

#include <babylon/maths/path3d.h>
#include <babylon/maths/tmp_vectors.h>
#include <babylon/meshes/_creation_data_storage.h>
#include <babylon/meshes/builders/mesh_builder_options.h>
#include <babylon/meshes/builders/ribbon_builder.h>
#include <babylon/meshes/mesh.h>

namespace BABYLON {

MeshPtr ShapeBuilder::ExtrudeShape(const std::string& name, ExtrudeShapeOptions& options,
                                   Scene* scene)
{
  const auto& path           = options.path;
  const auto& shape          = options.shape;
  const auto scale           = options.scale.value_or(1.f);
  const auto rotation        = options.rotation.value_or(0.f);
  const auto cap             = options.cap.value_or(Mesh::NO_CAP);
  const auto& updatable      = options.updatable;
  const auto sideOrientation = Mesh::_GetDefaultSideOrientation(options.sideOrientation);
  const auto& instance       = options.instance;
  const auto invertUV        = options.invertUV.value_or(false);

  return ShapeBuilder::_ExtrudeShapeGeneric(
    name, shape, path, scale, rotation, nullptr, nullptr, false, false, cap, false, scene,
    updatable.has_value(), sideOrientation, instance, invertUV, options.frontUVs, options.backUVs);
}

MeshPtr ShapeBuilder::ExtrudeShapeCustom(const std::string& name,
                                         ExtrudeShapeCustomOptions& options, Scene* scene)
{
  const auto& path            = options.path;
  const auto& shape           = options.shape;
  const auto scaleFunction    = options.scaleFunction ?
                                  options.scaleFunction :
                                  ([](float /*i*/, float /*distance*/) -> float { return 1.f; });
  const auto rotationFunction = options.rotationFunction ?
                                  options.rotationFunction :
                                  ([](float /*i*/, float /*distance*/) -> float { return 0.f; });
  const auto ribbonCloseArray = options.ribbonCloseArray.value_or(false);
  const auto ribbonClosePath  = options.ribbonClosePath.value_or(false);
  const auto cap              = options.cap.value_or(Mesh::NO_CAP);
  const auto& updatable       = options.updatable;
  const auto sideOrientation  = Mesh::_GetDefaultSideOrientation(options.sideOrientation);
  const auto& instance        = options.instance;
  const auto invertUV         = options.invertUV.value_or(false);
  return ShapeBuilder::_ExtrudeShapeGeneric(
    name, shape, path, std::nullopt, std::nullopt, scaleFunction, rotationFunction,
    ribbonCloseArray, ribbonClosePath, cap, true, scene, updatable.has_value(), sideOrientation,
    instance, invertUV, options.frontUVs, options.backUVs);
}

MeshPtr ShapeBuilder::_ExtrudeShapeGeneric(
  const std::string& name, const std::vector<Vector3>& shape, const std::vector<Vector3>& curve,
  const std::optional<float>& scale, const std::optional<float>& rotation,
  const std::function<float(float i, float distance)>& scaleFunction,
  const std::function<float(float i, float distance)>& rotateFunction, bool rbCA, bool rbCP,
  unsigned int cap, bool custom, Scene* scene, bool updtbl, unsigned int side, MeshPtr instance,
  bool invertUV, const std::optional<Vector4>& frontUVs, const std::optional<Vector4>& backUVs)
{
  // extrusion geometry
  const auto extrusionPathArray
    = [](const std::vector<Vector3>& _shape, const std::vector<Vector3>& _curve, Path3D& path3D,
         std::vector<std::vector<Vector3>> shapePaths, const std::optional<float>& _scale,
         const std::optional<float>& _rotation,
         const std::function<float(float i, float distance)>& _scaleFunction,
         const std::function<float(float i, float distance)>& _rotateFunction, unsigned int _cap,
         bool _custom) {
        auto& tangents        = path3D.getTangents();
        const auto& normals   = path3D.getNormals();
        const auto& binormals = path3D.getBinormals();
        const auto& distances = path3D.getDistances();

        auto angle             = 0.f;
        const auto returnScale = [_scale](float /*i*/, float /*distance*/) -> float {
          return _scale.has_value() ? *_scale : 1.f;
        };
        const auto returnRotation = [_rotation](float /*i*/, float /*distance*/) -> float {
          return _rotation.has_value() ? *_rotation : 0.f;
        };
        const auto rotate    = _custom ? _rotateFunction : returnRotation;
        const auto scl       = _custom ? _scaleFunction : returnScale;
        auto index           = (_cap == Mesh::NO_CAP || _cap == Mesh::CAP_END) ? 0u : 2u;
        auto& rotationMatrix = TmpVectors::MatrixArray[0];
        shapePaths.resize(_curve.size());

        for (size_t i = 0ull; i < _curve.size(); ++i) {
          std::vector<Vector3> shapePath;
          const auto angleStep  = rotate(static_cast<float>(i), distances[i]);
          const auto scaleRatio = scl(static_cast<float>(i), distances[i]);
          for (const auto& p : _shape) {
            Matrix::RotationAxisToRef(tangents[i], angle, rotationMatrix);
            const auto planed
              = ((tangents[i].scale(p.z)).add(normals[i].scale(p.x)).add(binormals[i].scale(p.y)));
            auto rotated = Vector3::Zero();
            Vector3::TransformCoordinatesToRef(planed, rotationMatrix, rotated);
            rotated.scaleInPlace(scaleRatio).addInPlace(_curve[i]);
            shapePath.emplace_back(rotated);
          }
          shapePaths[index] = shapePath;
          angle += angleStep;
          ++index;
        }
        // cap
        const auto capPath = [&](const std::vector<Vector3>& shapePath) {
          std::vector<Vector3> pointCap;
          auto barycenter = Vector3::Zero();
          for (const auto& pt3d : shapePath) {
            barycenter.addInPlace(pt3d);
          }
          barycenter.scaleInPlace(1.f / static_cast<float>(shapePath.size()));
          for (size_t i = 0ull; i < shapePath.size(); ++i) {
            pointCap.emplace_back(barycenter);
          }
          return pointCap;
        };
        switch (_cap) {
          case Mesh::NO_CAP:
            break;
          case Mesh::CAP_START:
            shapePaths[0] = capPath(shapePaths[2]);
            shapePaths[1] = shapePaths[2];
            break;
          case Mesh::CAP_END:
            shapePaths[index + 0] = shapePaths[index - 1];
            shapePaths[index + 1] = capPath(shapePaths[index - 1]);
            break;
          case Mesh::CAP_ALL:
            shapePaths[0]         = capPath(shapePaths[2]);
            shapePaths[1]         = shapePaths[2];
            shapePaths[index + 0] = shapePaths[index - 1];
            shapePaths[index + 1] = capPath(shapePaths[index - 1]);
            break;
          default:
            break;
        }
        return shapePaths;
      };

  Path3D path3D;
  std::vector<std::vector<Vector3>> pathArray;
  if (instance) { // instance update
    const auto& storage = instance->_creationDataStorage;
    path3D              = storage->path3D.update(curve);
    pathArray = extrusionPathArray(shape, curve, storage->path3D, storage->pathArray, scale,
                                   rotation, scaleFunction, rotateFunction, storage->cap, custom);
    instance  = Mesh::CreateRibbon("", pathArray, false, false, 0, scene, false, Mesh::DEFAULTSIDE,
                                  instance);

    return instance;
  }
  // extruded shape creation
  path3D = Path3D(curve);
  std::vector<std::vector<Vector3>> newShapePaths;
  const uint32_t _cap = (cap > 3) ? 0 : cap;
  pathArray           = extrusionPathArray(shape, curve, path3D, newShapePaths, scale, rotation,
                                 scaleFunction, rotateFunction, _cap, custom);
  RibbonOptions ribbonOptions;
  ribbonOptions.pathArray       = pathArray;
  ribbonOptions.closeArray      = rbCA;
  ribbonOptions.closePath       = rbCP;
  ribbonOptions.updatable       = updtbl;
  ribbonOptions.sideOrientation = side;
  ribbonOptions.invertUV        = invertUV;
  ribbonOptions.frontUVs        = frontUVs;
  ribbonOptions.backUVs         = backUVs;
  const auto extrudedGeneric    = RibbonBuilder::CreateRibbon(name, ribbonOptions, scene);
  extrudedGeneric->_creationDataStorage->pathArray = pathArray;
  extrudedGeneric->_creationDataStorage->path3D    = path3D;
  extrudedGeneric->_creationDataStorage->cap       = _cap;

  return extrudedGeneric;
}

} // end of namespace BABYLON


text:
/**
 * @fileoverview A small collection of array utilities.
 */

const arrayUtils = {};

/**
 * Does a shallow copy of an array.
 * @param {IArrayLike<T>|string} arr Array or array-like object to clone.
 * @return {!Array<T>} Clone of the input array.
 */
arrayUtils.clone = function(arr) {
  var length = arr.length;
  if (length > 0) {
    var rv = new Array(length);
    for (var i = 0; i < length; i++) {
      rv[i] = arr[i];
    }
    return rv;
  }
  return [];
};

/**
 * Returns an array consisting of the given value repeated N times.
 * @param {VALUE} value The value to repeat.
 * @param {number} n The repeat count.
 * @return {!Array<VALUE>} An array with the repeated value.
 */
arrayUtils.repeat = function(value, n) {
  var array = [];
  for (var i = 0; i < n; i++) {
    array[i] = value;
  }
  return array;
};


text:
.. default-intersphinx:: rbt0.7

===========================
RBTools 0.7.4 Release Notes
===========================

**Release date:** June 11, 2015

Compatibility Notes
===================

* Team Foundation Server support does not yet work with Visual Studio
  2013 Update 4 or higher.

  In Visual Studio 2013 Update 4, the command line tool we used,
  :command:`tf.cmd`, has been rewritten, and many of the features we
  depended on were dropped.

  For the moment, you will need to stick with Update 3 or lower in order to
  continue using `Power Pack`_'s TFS support. Alternatively, if you're running
  Update 4, you can try installing `Team Explorer Everywhere`_.

.. _`Power Pack`: https://www.reviewboard.org/powerpack/
.. _`Team Explorer Everywhere`:
   https://www.visualstudio.com/en-us/products/team-explorer-everywhere-vs.aspx

Bug Fixes
=========

General
-------

* Fixed a Python 2.6 compatibility problem. (:bug:`3753`)

* When there are communication errors with a Review Board server, the error
  message will now contain more details on what went wrong. (:bug:`3840`)

* Fixed additional Unicode issues when running in a non-UTF-8 environment.

  Patch by Bartosz Gołek.

rbt post
--------

.. program:: rbt post

* The :option:`--diff-filename` and :option:`--update` flags are
  now mutually-exclusive. (:bug:`3755`)

  The :option:`--update` option didn't make sense when using a diff
  filename, since the review request could not be guessed. There's now an
  error shown when trying to use both.

Mercurial
---------

* The :option:`--tracking-branch` option wasn't overriding the built-in
  default tracking branch.

  Patch by Andrew Bettison.

Team Foundation Server
----------------------

* Modifications to directories or other non-files no longer break diff
  generation.

* Fixed issues with file encodings and newlines.

Contributors
============

* Andrew Bettison
* Bartosz Gołek
* Christian Hammond
* David Trowbridge


text:
/**
 * Verify the automatic behavior of the loading indicator works correctly. During the test there are template refreshes
 */
Aria.classDefinition({
    $classpath : "test.aria.utils.overlay.loadingIndicator.automatic.AutomaticTestCase",
    $extends : "aria.jsunit.TemplateTestCase",
    $dependencies : ["test.aria.utils.overlay.loadingIndicator.IndicatorHelper", "aria.utils.DomOverlay",
            "aria.utils.Dom"],
    $constructor : function () {
        this.$TemplateTestCase.constructor.call(this);

        this._envBody = {
            template : "test.aria.utils.overlay.loadingIndicator.automatic.Body",
            data : {
                countRefresh : 0
            }
        };

        this._envBindings = {
            template : "test.aria.utils.overlay.loadingIndicator.automatic.Bindings",
            data : {
                parentSections : false,
                subSection : false,
                countRefresh : 0
            }
        };

        this._envNasty = {
            template : "test.aria.utils.overlay.loadingIndicator.automatic.Nasty",
            data : {
                bindHere : false,
                countRefresh : 0
            }
        };

        this.helper = test.aria.utils.overlay.loadingIndicator.IndicatorHelper;

        this.setTestEnv(this._envBody);
    },
    $prototype : {
        runTemplateTest : function () {
            this._Body();
        },

        setProcessingIndicator : function (id, value) {
            var wrapper = this.templateCtxt.$getElementById(id);
            wrapper.setProcessingIndicator(value);
            wrapper.$dispose();
        },

        __getSubTemplateContext : function () {
            // Go backward because I think that the template widget is at the end
            for (var i = this.templateCtxt._mainSection._content.length; i--;) {
                var content = this.templateCtxt._mainSection._content[i];

                if (content._type === 1 && content.behavior.$Template) { // TYPE_BEHAVIOR
                    return content.behavior.subTplCtxt;
                }
            }
        },

        __getSubTemplateSectionWrapper : function (name) {
            var context = this.__getSubTemplateContext();

            if (context) {
                return context.$getElementById(name);
            }
        },

        setSubTemplateProcessingIndicator : function (id, value) {
            var wrapper = this.__getSubTemplateSectionWrapper(id);
            wrapper.setProcessingIndicator(value);
            wrapper.$dispose();
        },

        _Body : function () {
            var document = Aria.$window.document;
            // Put a loading indicator on the body
            aria.utils.DomOverlay.create(document.body);
            // Check the refresh
            var countRefresh = aria.utils.Dom.getElementById("countRefresh");
            this.assertTrue(countRefresh.innerHTML === "0");
            countRefresh = null;

            // Check that now it's in the DOM
            this.assertTrue(this.helper.isInDom());

            // Call a refresh on the template
            this.templateCtxt.data.countRefresh += 1;
            this.templateCtxt.$refresh();
            // Check the refresh
            countRefresh = aria.utils.Dom.getElementById("countRefresh");
            this.assertTrue(countRefresh.innerHTML === "1");
            countRefresh = null;

            // Check that it's still in the DOM
            this.assertTrue(this.helper.isInDom());

            // Call a partial refresh
            this.templateCtxt.data.countRefresh += 1;
            this.templateCtxt.$refresh({
                section : "s2"
            });

            // Check that it's still in the DOM
            this.assertTrue(this.helper.isInDom());
            // Check the refresh
            countRefresh = aria.utils.Dom.getElementById("countRefresh");
            this.assertTrue(countRefresh.innerHTML === "1"); // it was a partial refresh
            countRefresh = null;

            // Remove it
            aria.utils.DomOverlay.detachFrom(document.body);

            // Check that it's removed
            this.assertFalse(this.helper.isInDom());

            // Check for leaks
            var overlays = this.helper.totalOverlays();
            this.assertTrue(overlays === 0, "Overlays not disposed: " + overlays);

            // Go to the next test (there is no need to change the environment for this test)
            this.templateCtxt.data.countRefresh = 0;
            this._Section();
        },

        _Section : function () {
            var document = this.testWindow.document;
            // Put a div outside aria templates
            var div = document.createElement("div");

            div.style.height = "100px";
            div.id = "outside";

            document.body.insertBefore(div, document.body.firstChild);

            // Put a loading indicator on all the elements except the body
            this.setProcessingIndicator("s1", true);
            this.setProcessingIndicator("s2", true);
            this.setProcessingIndicator("d1", true);
            this.setProcessingIndicator("d2", true);
            aria.utils.DomOverlay.create(div);
            this.setSubTemplateProcessingIndicator("subSection", true);

            // Check that now it's in the DOM
            this.assertTrue(this.helper.countInDom() === 6);

            // Call a refresh on the template
            this.templateCtxt.data.countRefresh += 1;
            this.templateCtxt.$refresh();
            // Check the refresh
            var countRefresh = aria.utils.Dom.getElementById("countRefresh");
            this.assertTrue(countRefresh.innerHTML === "1");
            countRefresh = null;

            // Check that the only indicator is the one outside of AT
            this.assertTrue(this.helper.countInDom() === 1);

            // Check for leaks
            var overlays = this.helper.totalOverlays();
            this.assertTrue(overlays === 1, "Overlays not disposed: " + overlays);

            // Put again loading a indicator on all the elements including the body
            this.setProcessingIndicator("s1", true);
            this.setProcessingIndicator("s2", true);
            this.setProcessingIndicator("d1", true);
            this.setProcessingIndicator("d2", true);
            aria.utils.DomOverlay.create(div);
            this.setSubTemplateProcessingIndicator("subSection", true);
            aria.utils.DomOverlay.create(document.body);

            // Check that now it's in the DOM
            this.assertTrue(this.helper.countInDom() === 7);

            // Call a partial refresh
            this.templateCtxt.data.countRefresh += 1;
            this.templateCtxt.$refresh({
                section : "s2"
            });

            // Check the refresh
            countRefresh = aria.utils.Dom.getElementById("countRefresh");
            this.assertTrue(countRefresh.innerHTML === "1"); // it was a partial refresh
            countRefresh = null;

            // The overlay in the DOM sould be
            // - body
            // - outside of AT
            // - s1
            // - s2 (a section refresh does not remove its processing indicator)
            // - subSection
            // the others should be destroyed after a refresh ?
            this.assertTrue(this.helper.countInDom() === 5);

            // Destroy it
            aria.utils.DomOverlay.detachFrom(document.body);

            // Check for leaks
            var overlays = this.helper.totalOverlays();
            this.assertTrue(overlays === 4, "Overlays not disposed: " + overlays);

            // Destroy all of them
            this.setProcessingIndicator("s1", false);
            this.setProcessingIndicator("s2", false);
            this.setSubTemplateProcessingIndicator("subSection", false);
            aria.utils.DomOverlay.detachFrom(div);

            // Check for leaks
            var overlays = this.helper.totalOverlays();
            this.assertTrue(overlays === 0, "Overlays not disposed: " + overlays);

            // Remove the outside div
            div.parentNode.removeChild(div);

            // Go to the next test
            this.templateCtxt.data.countRefresh = 0;
            this._replaceTestTemplate(this._envBindings, {
                fn : this._SectionBind,
                scope : this
            });
        },

        _SectionBind : function () {
            // Put a loading indicator on all the sections (s1 and s2 are bound to the same value)
            this.setProcessingIndicator("s1", true);

            // There should be two indicator already
            this.assertTrue(this.helper.countInDom() === 2);

            // This one should do nothing, the indicator is already there
            this.setProcessingIndicator("s2", true);

            this.setSubTemplateProcessingIndicator("subSection", true);

            // Check that now it's in the DOM
            this.assertTrue(this.helper.countInDom() === 3);
            // The check on the value in the data model is already done in manual test

            // Check for leaks
            var overlays = this.helper.totalOverlays();
            this.assertTrue(overlays === 3, "Overlays not disposed: " + overlays);

            // Call a refresh on the template
            this.templateCtxt.data.countRefresh += 1;
            this.templateCtxt.$refresh();
            // Check the refresh
            var countRefresh = aria.utils.Dom.getElementById("countRefresh");
            this.assertTrue(countRefresh.innerHTML === "1");
            countRefresh = null;

            // Check that the indicators are still there
            this.assertTrue(this.helper.countInDom() === 3);

            // Check for leaks
            var overlays = this.helper.totalOverlays();
            this.assertTrue(overlays === 3, "Overlays not disposed: " + overlays);

            // Close them
            this.setSubTemplateProcessingIndicator("subSection", false);

            // This should close also the indicator on s1
            this.setProcessingIndicator("s2", false);

            // Check that there are no overlays
            this.assertFalse(this.helper.isInDom());

            // Check for leaks
            var overlays = this.helper.totalOverlays();
            this.assertTrue(overlays === 0, "Overlays not disposed: " + overlays);

            // Close also s1 that shouldn't give errors
            this.setProcessingIndicator("s1", false);

            // Put again loading a indicator on all the sections
            this.setProcessingIndicator("s1", true);
            this.setProcessingIndicator("s2", true);
            this.setSubTemplateProcessingIndicator("subSection", true);

            // Check that now it's in the DOM
            this.assertTrue(this.helper.countInDom() === 3);

            // Call a partial refresh
            this.templateCtxt.data.countRefresh += 1;
            this.templateCtxt.$refresh({
                section : "s2"
            });

            // Check the refresh
            countRefresh = aria.utils.Dom.getElementById("countRefresh");
            this.assertTrue(countRefresh.innerHTML === "1"); // it was a partial refresh
            countRefresh = null;

            // Check that the overlays are still there
            this.assertTrue(this.helper.countInDom() === 3);

            // Destroy them
            this.setSubTemplateProcessingIndicator("subSection", false);

            // This should close also the indicator on s2
            this.setProcessingIndicator("s1", false);

            // Check that there are no overlays
            this.assertFalse(this.helper.isInDom());

            // Check for leaks
            var overlays = this.helper.totalOverlays();
            this.assertTrue(overlays === 0, "Overlays not disposed: " + overlays);

            // Go to the next test
            this.templateCtxt.data.countRefresh = 0;
            this._replaceTestTemplate(this._envNasty, {
                fn : this._Nasty,
                scope : this
            });
        },

        _Nasty : function () {
            // Try a combination of nasty bindings
            this.setProcessingIndicator("s1", true);

            // Four sections are bound
            this.assertTrue(this.helper.countInDom() === 4);

            // Call a refresh on the template
            this.templateCtxt.data.countRefresh += 1;
            this.templateCtxt.$refresh();
            // Check the refresh
            var countRefresh = aria.utils.Dom.getElementById("countRefresh");
            this.assertTrue(countRefresh.innerHTML === "1");
            countRefresh = null;

            // The four sections should still be loading
            this.assertTrue(this.helper.countInDom() === 4);
            var overlays = this.helper.totalOverlays();
            this.assertTrue(overlays === 4, "Overlays not disposed: " + overlays);

            // Close one that was not opened directly
            this.setProcessingIndicator("s4", false);

            // The four sections should be disposed
            this.assertFalse(this.helper.isInDom());

            // Check for leaks
            var overlays = this.helper.totalOverlays();
            this.assertTrue(overlays === 0, "Overlays not disposed: " + overlays);

            // End of tests
            this.notifyTemplateTestEnd();
        }
    }
});


text:
package com.google.codeu.chatme.view.login;

import com.google.codeu.chatme.common.view.BaseActivityView;

public interface LoginView extends BaseActivityView {

    /**
     * Launches TabsActivity, usually on successful sign up or sign in
     */
    void openTabsActivity();

    /**
     * Displays an error for {@link LoginActivity#etEmail} field
     *
     * @param err_et_email resource id of email field error message
     */
    void setEmailFieldError(int err_et_email);

    /**
     * Displays an error for {@link LoginActivity#etPassword} field
     *
     * @param err_et_password resource id of password field error message
     */
    void setPasswordFieldError(int err_et_password);
}