text:
/**@file tsip_event.c
 * @brief SIP event.
 *
 * @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
 *

 */
#include "tinysip/tsip_event.h"

#include "tsip.h"

#include "tinysip/tsip_message.h"

#include "tsk_string.h"
#include "tsk_memory.h"
#include "tsk_debug.h"

/* internal function used to create base SIP event */
tsip_event_t* tsip_event_create(tsip_ssession_t* ss, short code, const char* phrase, const tsip_message_t* sipmessage, tsip_event_type_t type)
{
	tsip_event_t* e;
	if((e = tsk_object_new(tsip_event_def_t, ss, code, phrase, sipmessage, type))){
		tsip_event_init(e, ss, code, phrase, sipmessage, type);
	}
	return e;
}

/* initialize a sip sevent */
int tsip_event_init(tsip_event_t* self, tsip_ssession_t *ss, short code, const char *phrase, const tsip_message_t* sipmessage, tsip_event_type_t type)
{
	if(!self){
		TSK_DEBUG_ERROR("Invalid parameter");
		return -1;
	}

	self->ss = tsk_object_ref(ss);
	self->code = code;
	tsk_strupdate(&(self->phrase), phrase);
	self->type = type;
	if(sipmessage){
		self->sipmessage = tsk_object_ref((void*)sipmessage);
	}
	return 0;
}

/* signal new event (enqueue) */
int tsip_event_signal(tsip_event_type_t type, tsip_ssession_t* ss, short code, const char *phrase)
{
	return tsip_event_signal_2(type, ss, code, phrase, tsk_null);
}

int tsip_event_signal_2(tsip_event_type_t type, tsip_ssession_t* ss, short code, const char *phrase, const struct tsip_message_s* sipmessage)
{
	tsip_event_t* e;
	if((e = tsip_event_create(ss, code, phrase, sipmessage, type))){
		TSK_RUNNABLE_ENQUEUE_OBJECT_SAFE(TSK_RUNNABLE(ss->stack), e);
		return 0;
	}
	return -1;
}

int tsip_event_deinit(tsip_event_t* self)
{
	if(self){
		TSK_OBJECT_SAFE_FREE(self->ss);

		TSK_FREE(self->phrase);
		TSK_OBJECT_SAFE_FREE(self->sipmessage);

		return 0;
	}
	return -1;
}

//========================================================
//	SIP event object definition
//
static tsk_object_t* tsip_event_ctor(tsk_object_t * self, va_list * app)
{
	tsip_event_t *sipevent = self;
	if(sipevent){
//		const tsip_message_t* sipmessage;
//		tsip_stack_t *stack;
//		tsip_ssession_handle_t *SSESSION;
//		short code;
//		const char *phrase;
//		tsip_event_type_t type;
//
//		stack = va_arg(*app, tsip_stack_handle_t *);
//		SSESSION = va_arg(*app, tsip_ssession_handle_t*);
//
//#if defined(__GNUC__)
//		code = (short)va_arg(*app, int);
//#else
//		code = va_arg(*app, short);
//#endif
//		phrase = va_arg(*app, const char *);
//
//		sipmessage = va_arg(*app, const tsip_message_t*);
//		type = va_arg(*app, tsip_event_type_t);
//
//		tsip_event_init(self, stack, SSESSION, code, phrase, sipmessage, type);
	}
	return self;
}

static tsk_object_t* tsip_event_dtor(tsk_object_t * self)
{
	tsip_event_t *sipevent = self;
	if(sipevent){
		tsip_event_deinit(sipevent);
	}
	return self;
}

static int tsip_event_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
	return -1;
}

static const tsk_object_def_t tsip_event_def_s =
{
	sizeof(tsip_event_t),
	tsip_event_ctor,
	tsip_event_dtor,
	tsip_event_cmp,
};
const tsk_object_def_t *tsip_event_def_t = &tsip_event_def_s;

redpajama_set_name: RedPajamaGithub


text:
package polardbx

//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.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

import (
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
)

// CreateDB invokes the polardbx.CreateDB API synchronously
func (client *Client) CreateDB(request *CreateDBRequest) (response *CreateDBResponse, err error) {
	response = CreateCreateDBResponse()
	err = client.DoAction(request, response)
	return
}

// CreateDBWithChan invokes the polardbx.CreateDB API asynchronously
func (client *Client) CreateDBWithChan(request *CreateDBRequest) (<-chan *CreateDBResponse, <-chan error) {
	responseChan := make(chan *CreateDBResponse, 1)
	errChan := make(chan error, 1)
	err := client.AddAsyncTask(func() {
		defer close(responseChan)
		defer close(errChan)
		response, err := client.CreateDB(request)
		if err != nil {
			errChan <- err
		} else {
			responseChan <- response
		}
	})
	if err != nil {
		errChan <- err
		close(responseChan)
		close(errChan)
	}
	return responseChan, errChan
}

// CreateDBWithCallback invokes the polardbx.CreateDB API asynchronously
func (client *Client) CreateDBWithCallback(request *CreateDBRequest, callback func(response *CreateDBResponse, err error)) <-chan int {
	result := make(chan int, 1)
	err := client.AddAsyncTask(func() {
		var response *CreateDBResponse
		var err error
		defer close(result)
		response, err = client.CreateDB(request)
		callback(response, err)
		result <- 1
	})
	if err != nil {
		defer close(result)
		callback(nil, err)
		result <- 0
	}
	return result
}

// CreateDBRequest is the request struct for api CreateDB
type CreateDBRequest struct {
	*requests.RpcRequest
	DBInstanceName   string `position:"Query" name:"DBInstanceName"`
	Charset          string `position:"Query" name:"Charset"`
	AccountPrivilege string `position:"Query" name:"AccountPrivilege"`
	AccountName      string `position:"Query" name:"AccountName"`
	DbName           string `position:"Query" name:"DbName"`
	DbDescription    string `position:"Query" name:"DbDescription"`
}

// CreateDBResponse is the response struct for api CreateDB
type CreateDBResponse struct {
	*responses.BaseResponse
	RequestId string `json:"RequestId" xml:"RequestId"`
	Success   bool   `json:"Success" xml:"Success"`
	Message   string `json:"Message" xml:"Message"`
}

// CreateCreateDBRequest creates a request to invoke CreateDB API
func CreateCreateDBRequest() (request *CreateDBRequest) {
	request = &CreateDBRequest{
		RpcRequest: &requests.RpcRequest{},
	}
	request.InitWithApiInfo("polardbx", "2020-02-02", "CreateDB", "polardbx", "openAPI")
	request.Method = requests.POST
	return
}

// CreateCreateDBResponse creates a response to parse from CreateDB response
func CreateCreateDBResponse() (response *CreateDBResponse) {
	response = &CreateDBResponse{
		BaseResponse: &responses.BaseResponse{},
	}
	return
}


text:
package com.darryncampbell.locationapiexerciser;

import android.app.IntentService;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.util.Log;

import com.google.android.gms.location.ActivityRecognitionResult;
import com.google.android.gms.location.DetectedActivity;

import java.util.ArrayList;

/**
 * Created by darry on 06/01/2017.
 */

public class ActivityRecognitionIntentService extends IntentService {

    public static final String TAG = "LOCATION API EXERCISER";

    public ActivityRecognitionIntentService() {
        super("ActivityRecognitionIntentService");
    }

    @Override
    protected void onHandleIntent(Intent intent) {
        if (intent != null)
        {
            //  Activity Recognition
            ActivityRecognitionResult result = ActivityRecognitionResult.extractResult(intent);
            if (result == null)
                return;
            ArrayList<DetectedActivity> detectedActivities = (ArrayList) result.getProbableActivities();

            String type = "";
            float confidence = 0;

            // Select the most confidence type
            for (DetectedActivity da : detectedActivities) {
                if (da.getConfidence() > confidence) {
                    confidence = da.getConfidence();
                    type = getActivityString(
                            getApplicationContext(),
                            da.getType());
                }
            }
            String activityText = "" + type + " [" + String.valueOf(confidence) + "%]";
            Log.i(TAG, "Current Activity: " + activityText);
            Intent broadcastIntent = new Intent();
            broadcastIntent.setAction(getResources().getString(R.string.Activity_Broadcast_Action));
            broadcastIntent.putExtra(getResources().getString(R.string.Activity_Recognition_Action_Text), activityText);
            sendBroadcast(broadcastIntent);
        }
    }

    public static String getActivityString(Context context, int detectedActivityType) {
        Resources resources = context.getResources();
        switch (detectedActivityType) {
            case DetectedActivity.IN_VEHICLE:
                return resources.getString(R.string.in_vehicle);
            case DetectedActivity.ON_BICYCLE:
                return resources.getString(R.string.on_bicycle);
            case DetectedActivity.ON_FOOT:
                return resources.getString(R.string.on_foot);
            case DetectedActivity.RUNNING:
                return resources.getString(R.string.running);
            case DetectedActivity.STILL:
                return resources.getString(R.string.still);
            case DetectedActivity.TILTING:
                return resources.getString(R.string.tilting);
            case DetectedActivity.UNKNOWN:
                return resources.getString(R.string.unknown);
            case DetectedActivity.WALKING:
                return resources.getString(R.string.walking);
            default:
                return resources.getString(R.string.unidentifiable_activity, detectedActivityType);
        }
    }
}


text:
const HttpStatus = require('http-status');
const ObjectId   = require('../../models/objectId');
const services   = require('../../services');
const utils      = require('../../../config/utils');

module.exports = {
  /**
   * Add a new mutator by id
   * @param req
   * @param res
   */
  add: (req, res) =>
    new ObjectId({namespace: req.params.namespace, id: req.params.id}).validate()
      .then((objectId) => services.mutators.add(objectId, req.body))
      .then(() => res.status(HttpStatus.OK).json())
      .catch((e) => utils.processError(e, res)),

  /**
   * Delete a mutator by id
   * @param req
   * @param res
   */
  delete: (req, res) =>
    new ObjectId({namespace: req.params.namespace, id: req.params.id}).validate()
      .then((objectId) => services.mutators.remove(objectId))
      .then(() => res.status(HttpStatus.NO_CONTENT).json())
      .catch((e) => utils.processError(e, res)),

  /**
   * Returns list of all mutators in a namespace by id
   */
  getAllIdsByNamespace: (req, res) =>
    new ObjectId({namespace: req.params.namespace, id: 'dummy'}).validate()
      .then((objectId) => services.mutators.getIds(objectId.namespace))
      .then((ids) => res.status(HttpStatus.OK).json({ids}))
      .catch((e) => utils.processError(e, res))
};


text:
layout: post
title: "sourceMappingURL and sourceURL syntax changed"
description: ""
article:
  written_on: 2013-06-13
  updated_on: 2013-06-13
authors:
  - paulirish
tags:
  - devtools
permalink: /2013/06/sourceMappingURL-and-sourceURL-syntax-changed
---
If you use either sourcemaps or sourceURL (both covered in the [HTML5 Rocks Primer on Sourcemaps](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/)), then you may see a warning in Chrome console like `"/*@ sourceMappingURL=" source mapping URL declaration is deprecated, "/*# sourceMappingURL=" declaration should be used instead.`

![](http://i.imgur.com/37clIgB.png)

Here's what that's about:

###Impetus
`//@ sourceMappingURL` [was found](http://bugs.jquery.com/ticket/13274) to have a conflict with IE whenever it was
found in the page after `//@cc_on` was interpreted to turn on conditional
compilation in the IE JScript engine. A legacy version of the HTML5 Shiv is one
particular offender here.

### Spec Change
The `//@ sourceMappingURL` syntax is defined in the [Sourcemap V3 spec] (https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.lmz475t4mvbx)
It was changed there to use `//#` syntax instead.

###sourceURL
`//@ sourceURL` is also defined in the spec and was made to match the `//#` syntax
for consistency. Follow through, for details on
[what sourceURL does](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl). It's used by Ember's [minispade](https://github.com/wycats/minispade), Google's [concatenate.js](https://github.com/google/concatenate.js), and others. In Chrome, `sourceURL` is supported for inline scripts and inline styles, in addition to evaluated JS.

###Implementation in Browser DevTools = done!

* **Safari Inspector** now supports `//#` for sourceMappingURL and sourceURL
* **Firebug's** change [has
  landed](https://github.com/firebug/firebug/commit/f14828954c4f9e07e8b86f9317713e774c9ad5d5)
  for sourceURL.
* **Firefox** [landed](https://bugzilla.mozilla.org/show_bug.cgi?id=870361) the change for
  sourceMappingURL. The sourceURL [ticket is
  here](https://bugzilla.mozilla.org/show_bug.cgi?id=833744).
* **Chrome** **DevTools** [landed the
  change](https://codereview.chromium.org/15832007) for sourceMappingURL and
  sourceURL. It will also warn about use of the deprecated `//@` syntax.

While these changes make their way to stable release, you can use both syntaxes simultaneously for full tool support or migrate immediately to the `#` syntax, depending on your needs.


text:
package org.incode.eurocommercial.ecpcrm.module.api.menu;

import java.util.List;

import javax.inject.Inject;

import org.apache.isis.applib.annotation.Action;
import org.apache.isis.applib.annotation.DomainService;
import org.apache.isis.applib.annotation.DomainServiceLayout;
import org.apache.isis.applib.annotation.NatureOfService;
import org.apache.isis.applib.annotation.SemanticsOf;

import org.incode.eurocommercial.ecpcrm.module.loyaltycards.dom.center.Center;
import org.incode.eurocommercial.ecpcrm.module.loyaltycards.dom.user.User;
import org.incode.eurocommercial.ecpcrm.module.loyaltycards.dom.user.UserRepository;

@DomainService(
        nature = NatureOfService.VIEW_MENU_ONLY,
        objectType = "application.AdminMenu"
)
@DomainServiceLayout(
        named = "Administration",
        menuOrder = "999",
        menuBar = DomainServiceLayout.MenuBar.SECONDARY
)
public class AdminMenu {

    @Action(semantics = SemanticsOf.IDEMPOTENT_ARE_YOU_SURE)
    public List<User> resyncCenterUsers(final Center center){
        return userRepository.resyncMailchimp(center);
    }

    @Inject private UserRepository userRepository;
}


text:
module Pohoda
  module Builders
    module Adb
      class AddressbookAccountType
        include ParserCore::BaseBuilder

        def builder
          root = Ox::Element.new(name)
          root = add_attributes_and_namespaces(root)

          if data.key? :account_item
            data[:account_item].each { |i| root << Adb::AccountItemType.new('adb:accountItem', i).builder }
          end

          root
        end
      end
    end
  end
end


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

<title>MatrixComputationSparse</title>
<meta name="date" content="2016-11-04">
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

matrix.matrixComp

Class MatrixComputationSparse

java.lang.Object

matrix.matrixComp.MatrixComputationSparse

All Implemented Interfaces:

MatrixComputation

Direct Known Subclasses:

MatrixComputationSparseDistributed, MatrixComputationSparsePar

public abstract class MatrixComputationSparse
extends java.lang.Object
implements MatrixComputation

Provides the implementation for performing arithmetic operations between sparse matrices. All operations are performed in a single thread.

Constructor Summary

Constructors

Constructor and Description

MatrixComputationSparse()

Method Summary

Methods

Modifier and Type
Method and Description

Matrix
invert(Matrix m)

Returns the inverse or pseudo-inverse of matrix <tt>m</tt>.

Matrix
invertByCholesky(Matrix m)

Returns the inverse computed by the Cholesky method for an arbitrary square Matrix.

Matrix
multiply(float alfa,
        Matrix m)

Multiplies a matrix by a scalar value.

Matrix
multiply(Matrix m,
        Matrix m1)

Multiplies two matrices.

Matrix
multiplyByTranspose(Matrix m)

Separates the special case of multiplying a Matrix by its transpose in order to avoid creating an extra Matrix in memory.

Matrix
transpose(Matrix m)

Returns the transpose of the Matrix m.

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods inherited from interface matrix.matrixComp.MatrixComputation

add, laplacian, subtract

Constructor Detail

MatrixComputationSparse

public MatrixComputationSparse()

Method Detail

transpose

public Matrix transpose(Matrix m)

Description copied from interface: MatrixComputation

Returns the transpose of the Matrix m. M^t
 The returned Matrix is created with the same type than the original.

Specified by:

transpose in interface MatrixComputation

Parameters:

m - the Matrix to transpose

Returns:

the transpose of the Matrix m

multiply

public Matrix multiply(Matrix m,
              Matrix m1)

Description copied from interface: MatrixComputation

Multiplies two matrices.
 The returned Matrix is created with the same type than the original.

Specified by:

multiply in interface MatrixComputation

Parameters:

m - the left matrix of the multiplication

m1 - the right matrix of the multiplication

Returns:

the result of multiplying the two matrices

multiplyByTranspose

public Matrix multiplyByTranspose(Matrix m)

Description copied from interface: MatrixComputation

Separates the special case of multiplying a Matrix by its transpose in order to avoid creating an extra Matrix in memory.
 The returned Matrix is created with the same type than the original.

Specified by:

multiplyByTranspose in interface MatrixComputation

Parameters:

m - the Matrix to multiply by its transpose

Returns:

the result of multiplying the Matrix m by its transpose

multiply

public Matrix multiply(float alfa,
              Matrix m)

Description copied from interface: MatrixComputation

Multiplies a matrix by a scalar value.
 The returned Matrix is created with the same type than the original.

Specified by:

multiply in interface MatrixComputation

Parameters:

alfa - the scalar value to multiply

m - the matrix to multiply by the scalar value

Returns:

the result of multiplying a matrix by a scalar

invert

public Matrix invert(Matrix m)

Description copied from interface: MatrixComputation

Returns the inverse or pseudo-inverse of matrix <tt>m</tt>.
 The implementation is based on the Colt implementation, which uses the LU or QR method.
 The returned Matrix is created with the same type than the original.

Specified by:

invert in interface MatrixComputation

Parameters:

m - the matrix to be inverted

Returns:

the inverse or pseudo-inverse of the matrix

invertByCholesky

public Matrix invertByCholesky(Matrix m)

Description copied from interface: MatrixComputation

Returns the inverse computed by the Cholesky method for an arbitrary square Matrix.
 The implementation is based on the Colt implementation and the paper "Matrix Inversion Using Cholesky Decomposition".
 The returned Matrix is created with the same type than the original.
 Matrix m is first transformed into an Hermitian Matrix in order to the Cholesky to work.
 When it is applicable, the Cholesky decomposition is roughly twice as efficient as the LU decomposition for solving systems of linear equations.
 Consider Matrix D, the Hermitian A is computed as A = D*transpose(D).
 Then inverse(D) = transpose(D)*inverse(A)

Specified by:

invertByCholesky in interface MatrixComputation

Parameters:

m - the matrix to be inverted

Returns:

the inverse

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
#region -- License Terms --
//
// MessagePack for CLI
//
// Copyright (C) 2010-2012 FUJIWARA, Yusuke
//
//    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.
//
#endregion -- License Terms --

using System;

namespace MsgPack.Serialization
{
	/// <summary>
	///		Callback based <see cref="MessagePackSerializer{T}"/> to implement context-based serialization.
	/// </summary>
	/// <typeparam name="T">The type of target type.</typeparam>
	internal sealed class CallbackMessagePackSerializer<T> : MessagePackSerializer<T>
	{
		private readonly Action<SerializationContext, Packer, T> _packToCore;
		private readonly Func<SerializationContext, Unpacker, T> _unpackFromCore;
		private readonly Action<SerializationContext, Unpacker, T> _unpackToCore;

		public CallbackMessagePackSerializer(
			SerializationContext ownerContext,
			Action<SerializationContext, Packer, T> packToCore,
			Func<SerializationContext, Unpacker, T> unpackFromCore,
			Action<SerializationContext, Unpacker, T> unpackToCore
		)
			: base( ownerContext )
		{
			this._packToCore = packToCore;
			this._unpackFromCore = unpackFromCore;
			this._unpackToCore = unpackToCore;
		}

		protected internal override void PackToCore( Packer packer, T objectTree )
		{
			this._packToCore( this.OwnerContext, packer, objectTree );
		}

		protected internal override T UnpackFromCore( Unpacker unpacker )
		{
			return this._unpackFromCore( this.OwnerContext, unpacker );
		}

		protected internal override void UnpackToCore( Unpacker unpacker, T collection )
		{
			if ( this._unpackToCore != null )
			{
				this._unpackToCore( this.OwnerContext, unpacker, collection );
			}
			else
			{
				base.UnpackToCore( unpacker, collection );
			}
		}
	}
}


text:
package iobjects.process;

import iobjects.*;

/**
 * Representa a classe base de todas as classes que representam processos
 * na aplicação.
 */
public class Process extends BusinessObject {

  private ProcessStepList processStepList = new ProcessStepList();

  /**
   * Construtor padrão.
   */
  public Process() {
  }

  /**
   * Retorna a lista de etapas a serem executadas pelo assistente do processo.
   * @return WizardStepList Retorna a lista de etapas a serem executadas pelo
   *         assistente do processo.
   */
  public ProcessStepList processStepList() {
    return processStepList;
  }

}


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

<TITLE>
SecondLevelCacheStatistics (Hibernate JavaDocs)
</TITLE>

<META NAME="date" CONTENT="2013-10-23">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

org.hibernate.stat

Interface SecondLevelCacheStatistics

All Superinterfaces:
Serializable

All Known Implementing Classes:
ConcurrentSecondLevelCacheStatisticsImpl

public interface SecondLevelCacheStatistics
extends Serializable

Second level cache statistics of a specific region

Method Summary

 long
getElementCountInMemory()

 long
getElementCountOnDisk()

 Map
getEntries()

 long
getHitCount()

 long
getMissCount()

 long
getPutCount()

 long
getSizeInMemory()

Method Detail

getHitCount

long getHitCount()

getMissCount

long getMissCount()

getPutCount

long getPutCount()

getElementCountInMemory

long getElementCountInMemory()

getElementCountOnDisk

long getElementCountOnDisk()

getSizeInMemory

long getSizeInMemory()

getEntries

Map getEntries()

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2013 Red Hat, Inc.  All Rights Reserved.


text:
//
//  NSString+BPSCrypto.h
//  Copyright (c) 2016 Bambora ( http://bambora.com/ )
//
//  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.

#import <Foundation/Foundation.h>

@interface NSString (BNCrypto)

/**
 *  A helper method which encrypts the string with a given
 *  AES128 key and returns a base64 encoded representation
 *  of the encrypted string.
 *
 *  @param key `NSData` used as a key for the encryption.
 *
 *  @return `NSString` AES128 encrypted string with key and base64 encoded.
 */
- (NSString *)AES128EncryptWithKey:(NSData *)key;

/**
 *  A helper method which decrypts a base64 encoded encrypted string
 *  and returns the original string.
 *
 *  @param key `NSData` used as a key for the decryption.
 *
 *  @return `NSString` AES128 decrypted string UTF8 encoded.
 */
- (NSString *)AES128DecryptWithKey:(NSData *)key;

/**
 *  A method for extracting the data from a string representing a Base64 encoded
 *  certificate in .pem format.
 *
 *  @return `NSData` representing the certificate.
 */
- (NSData *)getCertData;

@end


text:
from horizon.test import helpers as test

class ActionsTests(test.TestCase):
    # Unit tests for add_provider.
    def test_me(self):
        self.assertTrue(1 + 1 == 2)


text:
(function() {

	"use strict";

	//Declare root variable - window in the browser, global on the server
	var root = this,
		previous = root.Chart,
		helpers = Chart.helpers;

	// Attach global event to resize each chart instance when the browser resizes
	helpers.addEvent(window, "resize", (function() {
		// Basic debounce of resize function so it doesn't hurt performance when resizing browser.
		var timeout;
		return function() {
			clearTimeout(timeout);
			timeout = setTimeout(function() {
				helpers.each(Chart.instances, function(instance) {
					// If the responsive flag is set in the chart instance config
					// Cascade the resize event down to the chart.
					if (instance.options.responsive) {
						instance.resize();
					}
				});
			}, 16);
		};
	})());

}).call(this);


text:
namespace net {

struct DnsConfig;
class NetworkChangeNotifierAndroidTest;
class NetworkChangeNotifierFactoryAndroid;

// NetworkChangeNotifierAndroid observes network events from the Android
// notification system and forwards them to observers.
//
// The implementation is complicated by the differing lifetime and thread
// affinity requirements of Android notifications and of NetworkChangeNotifier.
//
// High-level overview:
// NetworkChangeNotifier.java - Receives notifications from Android system, and
// notifies native code via JNI (on the main application thread).
// NetworkChangeNotifierDelegateAndroid ('Delegate') - Listens for notifications
//   sent via JNI on the main application thread, and forwards them to observers
//   on their threads. Owned by Factory, lives exclusively on main application
//   thread.
// NetworkChangeNotifierFactoryAndroid ('Factory') - Creates the Delegate on the
//   main thread to receive JNI events, and vends Notifiers. Lives exclusively
//   on main application thread, and outlives all other classes.
// NetworkChangeNotifierAndroid ('Notifier') - Receives event notifications from
//   the Delegate. Processes and forwards these events to the
//   NetworkChangeNotifier observers on their threads. May live on any thread
//   and be called by any thread.
//
// For more details, see the implementation file.
class NET_EXPORT_PRIVATE NetworkChangeNotifierAndroid
    : public NetworkChangeNotifier,
      public NetworkChangeNotifierDelegateAndroid::Observer {
 public:
  ~NetworkChangeNotifierAndroid() override;

  // NetworkChangeNotifier:
  ConnectionType GetCurrentConnectionType() const override;
  // Requires ACCESS_WIFI_STATE permission in order to provide precise WiFi link
  // speed.
  double GetCurrentMaxBandwidth() const override;

  // NetworkChangeNotifierDelegateAndroid::Observer:
  void OnConnectionTypeChanged() override;
  void OnMaxBandwidthChanged(double max_bandwidth_mbps) override;

  static bool Register(JNIEnv* env);

  // Promote GetMaxBandwidthForConnectionSubtype to public for the Android
  // delegate class.
  using NetworkChangeNotifier::GetMaxBandwidthForConnectionSubtype;

 private:
  friend class NetworkChangeNotifierAndroidTest;
  friend class NetworkChangeNotifierFactoryAndroid;

  class DnsConfigServiceThread;

  NetworkChangeNotifierAndroid(NetworkChangeNotifierDelegateAndroid* delegate,
                               const DnsConfig* dns_config_for_testing);

  static NetworkChangeCalculatorParams NetworkChangeCalculatorParamsAndroid();

  NetworkChangeNotifierDelegateAndroid* const delegate_;
  scoped_ptr<DnsConfigServiceThread> dns_config_service_thread_;

  DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierAndroid);
};

}  // namespace net

#endif  // NET_ANDROID_NETWORK_CHANGE_NOTIFIER_ANDROID_H_


text:
package com.torch2424.statsmonitor.com.torch2424.statsproviders;

import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;

import com.torch2424.statsmonitor.com.torch2424.statshelpers.ProviderHelper;

public class SuperSmall extends AppWidgetProvider
{
    //1X1

    //need pending intent flags to properly create and destroy alarm
    public void onEnabled(Context context)
    {

        //Start our service
        ProviderHelper.startWidget();
        Intent providerIntent = new Intent(context, ProviderHelper.class);
        context.startService(providerIntent);
    }

    public void onDisabled(Context context)
    {

        //Kill the service
        ProviderHelper.destroyWidget();
        Intent providerIntent = new Intent(context, ProviderHelper.class);
        context.stopService(providerIntent);
    }
}


text:
package at.ac.tuwien.cg.gesture.control;

import at.ac.tuwien.cg.gesture.data.MatlabLogger;
import at.ac.tuwien.cg.gesture.data.MeasuringPoint;
import at.ac.tuwien.cg.gesture.data.MeasuringPointStorage;
import at.ac.tuwien.cg.gesture.math.Matrix4f;
import at.ac.tuwien.cg.gesture.math.Vector3f;

/**
 *
 * @author This class is responsible for all input events. If an input Device
 *         like the Wii-Remote or an Mobilephone send new Data, the new Data are
 *         delivered to this class (eg.: by calling the receive method).
 */
public class InputHandler
{
	// relative acceleration from the device
	public static Vector3f MPAcceleration = new Vector3f(0.0f, 0.0f, 0.0f);
	// rotation matrix from the device orientation
	public static Matrix4f MPOrientationMatrix = new Matrix4f();
	// covered distance
	public static Vector3f MPDistance = new Vector3f(0.0f, 0.0f, 0.0f);
	// actually velocity
	public static Vector3f MPVelocity = new Vector3f(0.0f, 0.0f, 0.0f);
	// important data or not
	public static boolean MPIsRealMeasurement = false;
	// measurement ID
	public static int MPID = 0;

	public static long tempTime=0;

	private static MatlabLogger mlog = new  MatlabLogger();

	public static MeasuringPointStorage mpStorage;

	public InputHandler(MeasuringPointStorage mpStorage){
		this.mpStorage = mpStorage;
	}

	/**
	 * @param object received Object, if it is a MeasuringPoint then it set the actual parameter, else it call toString method
	 */
	public static synchronized void receive(Object object)
	{
		try
		{

			if (object instanceof MeasuringPoint)
			{
				MeasuringPoint m = (MeasuringPoint) object;

				MPAcceleration.set(m.getAcceleration());
				MPOrientationMatrix.set(m.getOrientationMatrix());
				MPDistance.set(m.getDistance());
				MPVelocity.set(m.getVelocity());
				MPIsRealMeasurement = m.getIsRealMeasurement();
				MPID = m.getMeasurementID();

				if(MPIsRealMeasurement)
				{
					if(mpStorage.getMeasurementID()==MPID)
						mpStorage.addObject(m);
					else
					{
						mpStorage.removeAll();
						mpStorage.setMeasurementID(MPID);
						mpStorage.addObject(m);
					}
					System.out.println("Storage-Size: "+mpStorage.getSize()+" "+m);
					System.out.println(" "+m.getDistance()+" "+m.getVelocity());
					if(m.getTime()<tempTime)
						System.err.println(m.getTime());
					tempTime=m.getTime();

					if(m.getRowData()!=null)
						mlog.addData(m.getRowData(),m.getDeltaTime());
					else
						System.err.println("rowdata=null!!!!");

				}
				else
				{
					// write to Matlab readable File
					mlog.writeData();

				}

				//System.out.println(MPAcceleration);

			}
			else
			{
				System.out.println(object);
			}

		}
		catch (Exception e) {
			System.err.println("Exception im InputHandler:");
			e.printStackTrace();
		}

	}

}


text:
set -eux

file=$(mktemp)
sed "s/compute_count/$1/" tripleo/environments/deployed-server-port-map.j2.yaml > $file
ansible -c local localhost -m template -a "src=$file dest=deployed-server-port-map.yaml"
sed "s/compute_count/$1/" tripleo/environments/hostname-map.j2.yaml > $file
ansible -c local localhost -m template -a "src=$file dest=hostname-map.yaml"
rm -f $file

cp tripleo/environments/role-counts.j2.yaml role-counts.yaml
sed -i "s/compute_count/$1/" role-counts.yaml


text:
package org.apache.drill.exec.record.metadata;

import org.apache.drill.common.types.TypeProtos;
import org.apache.drill.exec.record.MaterializedField;

public class DictColumnMetadata extends AbstractMapColumnMetadata {

  /**
   * Build a new dict column from the field provided
   *
   * @param schema materialized field description of the map
   */
  public DictColumnMetadata(MaterializedField schema) {
    this(schema, null);
  }

  /**
   * Build a dict column metadata by cloning the type information (but not
   * the children) of the materialized field provided.
   *
   * @param schema the schema to use
   * @param mapSchema parent schema
   */
  DictColumnMetadata(MaterializedField schema, TupleSchema mapSchema) {
    super(schema, mapSchema);
  }

  public DictColumnMetadata(DictColumnMetadata from) {
    super(from);
  }

  public DictColumnMetadata(String name, TypeProtos.DataMode mode, TupleSchema mapSchema) {
    super(name, TypeProtos.MinorType.DICT, mode, mapSchema);
  }

  @Override
  public ColumnMetadata copy() {
    return new DictColumnMetadata(this);
  }

  @Override
  public ColumnMetadata cloneEmpty() {
    return new DictColumnMetadata(name, mode, new TupleSchema());
  }

  @Override
  public boolean isDict() {
    return true;
  }

  @Override
  protected String getStringType() {
    return "MAP";
  }
}


text:
import {
  replaceInUrlQuery,
  replaceUrlQuery,
  multiReplaceInUrlQuery,
  pushInUrlQuery,
  pushUrlQuery,
  multiPushInUrlQuery,
} from '../updateUrlQuery';

export function replaceUrlQueryFromAction(action, location) {
  const { encodedQuery } = action.payload;
  replaceUrlQuery(encodedQuery, location);
}

export function pushUrlQueryFromAction(action, location) {
  const { encodedQuery } = action.payload;
  pushUrlQuery(encodedQuery, location);
}

export function replaceInUrlQueryFromAction(action, location) {
  const { queryParam, encodedValue } = action.payload;
  replaceInUrlQuery(queryParam, encodedValue, location);
}

export function pushInUrlQueryFromAction(action, location) {
  const { queryParam, encodedValue } = action.payload;
  pushInUrlQuery(queryParam, encodedValue, location);
}

export function multiReplaceInUrlQueryFromAction(action, location) {
  const { encodedQuery } = action.payload;
  multiReplaceInUrlQuery(encodedQuery, location);
}

export function multiPushInUrlQueryFromAction(action, location) {
  const { encodedQuery } = action.payload;
  multiPushInUrlQuery(encodedQuery, location);
}


text:
@interface CircleLayout : UICollectionViewLayout

@property (nonatomic, assign) CGPoint center;
@property (nonatomic, assign) CGFloat radius;
@property (nonatomic, assign) NSInteger cellCount;

@end


text:
function cancelDefault (e) {
  e.preventDefault()
  e.stopPropagation()
}

let allA = Array.from(document.querySelectorAll('a'))

const checkDupes = test => allA.find(a => a.innerText.replace('/', '') === test)

function rpcFs (call, args, cb) {
  args = args.map(a => a.startsWith('/') ? a.slice(1) : a)
  args = args.map(a => window.location.pathname + a)

  const xhr = new window.XMLHttpRequest()
  xhr.open('POST', window.location.origin + '/rpc/')
  xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8')
  xhr.send(JSON.stringify({call, args}))
  xhr.onload = cb
}

const mkdirCall = (path, cb) => rpcFs('mkdirp', [path], cb)

// const rmCall = (path, cb) => rpcFs('remove', [path], cb)

// const mvCall = (path1, path2, cb) => rpcFs('move', [path1, path2], cb)

function mkdir () {
  const folder = window.prompt('New folder name', '')

  if (!folder) {
    return
  } else if (checkDupes(folder)) {
    return window.alert('Name already already exists')
  }

  mkdirCall(folder, () => browseTo(currentLocation))
}

function warning (e) {
  return 'Leaving will interrupt transfer\nAre you sure you want to leave?'
}

function newBar (name) {
  const id = Math.random().toString(36).substring(7)

  document.getElementById('progressBars').innerHTML += `

       ${name.split('/').pop()}

1%

  `
  return id
}

function updatePercent (id, percent) {
  const el = document.getElementById(id).querySelectorAll('div.barForeground')[0]
  const width = Math.floor(100 * percent).toString() + '%'
  el.innerText = width
  el.style.width = width
}

function shouldRefresh () {
  totalDone += 1
  if (totalUploads === totalDone) {
    window.onbeforeunload = null
    console.log('Done uploading ' + totalDone + ' files')
    totalDone = 0
    totalUploads = 0
    document.getElementById('progressBars').innerHTML = ''
    browseTo(currentLocation)
  }
}

function postFile (file, path) {
  totalUploads += 1
  window.onbeforeunload = warning

  const xhr = new window.XMLHttpRequest()
  xhr.open('POST', window.location.origin + '/post' + path)
  xhr.upload.id = newBar(path + '/' + file.name)

  const formData = new window.FormData()
  formData.append(file.name, file)

  xhr.upload.addEventListener('progress', a => {
    updatePercent(a.target.id, a.loaded / a.total)
  })

  xhr.upload.addEventListener('load', shouldRefresh)

  xhr.send(formData)
}

const parseDomFolder = f => {
  f.createReader().readEntries(e => e.forEach(i => parseDomItem(i)))
}

function parseDomItem (domFile, shoudCheckDupes) {
  if (shoudCheckDupes && checkDupes(domFile.name)) {
    return window.alert(domFile.name + ' already exists !')
  }

  if (domFile.isFile) {
    domFile.file(f => postFile(f, domFile.fullPath || domFile.name))
  } else {
    mkdirCall(domFile.fullPath, () => parseDomFolder(domFile))
  }
}

function pushEntry (entry) {
  if (!entry.webkitGetAsEntry && !entry.getAsEntry) {
    return window.alert('Unsupported browser ! Please update to chrome/firefox.')
  } else {
    entry = entry.webkitGetAsEntry() || entry.getAsEntry()
  }

  parseDomItem(entry, true)
}

const upGrid = document.getElementById('drop-grid')

document.ondragenter = (e) => {
  if (isPicMode()) { return }
  cancelDefault(e)
  e.dataTransfer.dropEffect = 'copy'
  upGrid.style.display = 'flex'
}

upGrid.ondragleave = (e) => {
  cancelDefault(e)
  upGrid.style.display = 'none'
}

document.ondragover = (e) => {
  cancelDefault(e)
  return false
}

document.ondrop = (e) => {
  cancelDefault(e)
  upGrid.style.display = 'none'

  Array.from(e.dataTransfer.items).forEach(pushEntry)
  return false
}

let totalUploads = 0
let totalDone = 0

const getArrowSelected = () => document.querySelectorAll('i.arrow-selected')[0]

function getASelected () {
  const dest = getArrowSelected()
  return !dest ? false : dest.parentElement.parentElement.querySelectorAll('a')[0]
}

function scrollToArrow () {
  const pos = getArrowSelected().getBoundingClientRect()
  window.scrollTo(0, pos.y)
}

function clearArrowSelected () {
  const arr = getArrowSelected()
  if (!arr) { return }
  arr.classList.remove('arrow-selected')
}

function restoreCursorPos () {
  clearArrowSelected()
  const hrefSelected = window.localStorage.getItem('last-selected' + currentLocation)
  let a = allA.find(el => el.href === hrefSelected)

  if (!a) {
    if (allA[0].innerText === '../') {
      a = allA[1]
    } else {
      a = allA[0]
    }
  }

  const icon = a.parentElement.parentElement.querySelectorAll('.arrow-icon')[0]
  icon.classList.add('arrow-selected')
  scrollToArrow()
}

const storeLastArrowSrc = src => window.localStorage.setItem('last-selected' + currentLocation, src)

function moveArrow (down) {
  const all = Array.from(document.querySelectorAll('i.arrow-icon'))
  let i = all.findIndex(el => el.classList.contains('arrow-selected'))

  clearArrowSelected()

  if (down) {
    i = all[i + 1] ? i + 1 : 0
  } else {
    i = all[i - 1] ? i - 1 : all.length - 1
  }

  all[i].classList.add('arrow-selected')
  storeLastArrowSrc(getASelected().href)

  const itemPos = all[i].getBoundingClientRect()

  if (i === 0) {
    window.scrollTo(0, 0)
  } else if (i === all.length - 1) {
    window.scrollTo(0, document.documentElement.scrollHeight)
  } else if (itemPos.top < 0) {
    window.scrollBy(0, -200)
  } else if (itemPos.bottom > window.innerHeight) {
    window.scrollBy(0, 200)
  }
}

function setCursorToClosest () {
  const a = allA.find(el => el.innerText.toLocaleLowerCase().startsWith(path))
  if (!a) { return }
  storeLastArrowSrc(a.href)
  restoreCursorPos()
}

window.onpopstate = prevPage

function browseTo (href) {
  currentLocation = href

  window.fetch(href).then(r => r.text().then(t => {
    const parsed = new window.DOMParser().parseFromString(t, 'text/html')

    const table = parsed.querySelectorAll('table')[0].innerHTML
    document.body.querySelectorAll('table')[0].innerHTML = table

    const title = parsed.head.querySelectorAll('title')[0].innerText
    document.head.querySelectorAll('title')[0].innerText = title
    document.body.querySelectorAll('h1')[0].innerText = '.' + title

    window.history.pushState({}, '', title)
    init()
  }))
}

function nextPage () {
  const a = getASelected()
  if (!a.href || !a.innerText.endsWith('/')) { return }
  browseTo(a.href)
}

function prevPage () {
  if (window.location.origin === currentLocation.slice(0, -1)) { return }
  const path = currentLocation.split('/').slice(0, -1).join('/')
  browseTo(path)
}

function cpPath () {
  var t = document.createElement('textarea')
  t.value = getASelected().href
  document.body.appendChild(t)
  t.select()
  document.execCommand('copy')
  document.body.removeChild(t)
}

const pics = document.getElementById('pics')
const picsHolder = document.getElementById('picsHolder')
const picsLabel = document.getElementById('picsLabel')

const picTypes = ['.jpg', '.jpeg', '.png', '.gif']
const isPic = src => src && picTypes.find(type => src.toLocaleLowerCase().includes(type))

const isPicMode = () => pics.style.display === 'flex'

let imgsIndex
let allImgs

function setImage (src) {
  src = src || allImgs[imgsIndex]
  picsLabel.innerText = src.split('/').pop()
  picsHolder.src = src
  storeLastArrowSrc(src)
}

function picsOn (ifImgSelected) {
  const href = getASelected().href

  if (isPicMode()) {
    return false
  } else if (ifImgSelected && !isPic(href)) {
    return false
  }

  if (isPic(href)) {
    imgsIndex = allImgs.findIndex(el => el === href)
    setImage()
  } else {
    setImage(picsHolder.src)
  }

  pics.style.display = 'flex'
  return true
}

function picsToggle () {
  if (!isPicMode()) {
    picsOn()
  } else {
    pics.style.display = 'none'
    restoreCursorPos()
  }
}

function picsNav (down) {
  if (!isPicMode()) { return false }

  if (down) {
    imgsIndex = allImgs[imgsIndex + 1] ? imgsIndex + 1 : 0
  } else {
    imgsIndex = allImgs[imgsIndex - 1] ? imgsIndex - 1 : allImgs.length - 1
  }

  setImage()
  return true
}

let path = ''
let clearPathToken = null

document.body.addEventListener('keydown', e => {
  switch (e.code) {
    case 'Tab':
    case 'ArrowDown':
      e.preventDefault()
      return picsNav(true) || moveArrow(true)

    case 'ArrowUp':
      e.preventDefault()
      return picsNav(false) || moveArrow(false)

    case 'ArrowRight':
      e.preventDefault()
      return picsOn(true) || picsNav(true) || nextPage()

    case 'ArrowLeft':
      e.preventDefault()
      return picsNav(false) || prevPage()

    case 'Escape':
      if (isPicMode) {
        e.preventDefault()
        return picsToggle()
      }
  }

  // Ctrl keys
  if (e.ctrlKey || e.metaKey) {
    switch (e.code) {
      case 'KeyD':
        e.preventDefault()
        return isPicMode() || mkdir()

      case 'KeyC':
        e.preventDefault()
        return isPicMode() || cpPath()
    }
  }

  // Any other key, for text search
  if (e.code.includes('Key')) {
    path += e.code.replace('Key', '').toLocaleLowerCase()
    window.clearTimeout(clearPathToken)
    clearPathToken = setTimeout(() => { path = '' }, 1000)
    setCursorToClosest()
  }
}, false)

function partialBrowseOnClickFolders () {
  allA.forEach(a => {
    if (!a.innerText.endsWith('/')) { return }
    a.addEventListener('click', e => {
      e.preventDefault()
      storeLastArrowSrc(e.target.href)
      browseTo(e.target.href)
    })
  }, false)
}

function init () {
  allA = Array.from(document.querySelectorAll('a'))
  allImgs = allA.map(el => el.href).filter(isPic)
  document.getElementById('picsToggle').style.display = allImgs.length > 0 ? 'flex' : 'none'

  imgsIndex = 0
  partialBrowseOnClickFolders()
  restoreCursorPos()
  console.log('Browsed to ' + currentLocation)
}

let currentLocation = window.location.href

init()

window.picsToggle = picsToggle
window.picsNav = () => picsNav(true)
window.mkdir = mkdir


text:
import React from 'react';
import PropTypes from 'prop-types';
import { exactProp } from '@material-ui/utils';
const useEnhancedEffect = typeof window !== 'undefined' && process.env.NODE_ENV !== 'test' ? React.useLayoutEffect : React.useEffect;
/**
 * NoSsr purposely removes components from the subject of Server Side Rendering (SSR).
 *
 * This component can be useful in a variety of situations:
 * - Escape hatch for broken dependencies not supporting SSR.
 * - Improve the time-to-first paint on the client by only rendering above the fold.
 * - Reduce the rendering time on the server.
 * - Under too heavy server load, you can turn on service degradation.
 */

function NoSsr(props) {
  const {
    children,
    defer = false,
    fallback = null
  } = props;
  const [mountedState, setMountedState] = React.useState(false);
  useEnhancedEffect(() => {
    if (!defer) {
      setMountedState(true);
    }
  }, [defer]);
  React.useEffect(() => {
    if (defer) {
      setMountedState(true);
    }
  }, [defer]); // We need the Fragment here to force react-docgen to recognise NoSsr as a component.

  return React.createElement(React.Fragment, null, mountedState ? children : fallback);
}

process.env.NODE_ENV !== "production" ? NoSsr.propTypes = {
  /**
   * You can wrap a node.
   */
  children: PropTypes.node.isRequired,

  /**
   * If `true`, the component will not only prevent server-side rendering.
   * It will also defer the rendering of the children into a different screen frame.
   */
  defer: PropTypes.bool,

  /**
   * The fallback content to display.
   */
  fallback: PropTypes.node
} : void 0;

if (process.env.NODE_ENV !== 'production') {
  // eslint-disable-next-line
  NoSsr['propTypes' + ''] = exactProp(NoSsr.propTypes);
}

export default NoSsr;


text:
So you want to contribute something to Bitsery? That's great!
Contributions are always very much appreciated, whether it's a bug fix, a new feature or documentation.
However, to make sure the process of accepting patches goes smoothly, you should try to follow these few simple guidelines when
you contribute:

1. Fork the repository.
2. Create new branch based on the *develop* branch (`git checkout -b your_branch develop`). If your contribution is a bug fix, you should name your branch `bugfix/xxx`; for a feature, it should be `feature/xxx`. Otherwise, just use your good judgment. Consistent naming of branches is appreciated since it makes the output of `git branch` easier to understand with a single glance.
3. Do your modifications on that branch. Except for special cases, your contribution should include proper unit tests and documentation.
4. Make sure your modifications did not break anything by building, running tests:
  ```shell
  mkdir build
  cd build
  cmake -DBITSERY_BUILD_TESTS=ON ..
  make
  (cd tests; ctest)
  ```
  or run CTest scripts and view code coverage (scripts tested on ubuntu, requires lcov for coverage):
  ```shell
  cd scripts
  ctest -S build.bitsery.cmake
  ./show_coverage.sh build
  ```
5. Commit your changes, and push to your fork (`git push origin your_branch`). Commit message should be one line short description. When applicable, please squash adjacent *wip* commits into a single *logical* commit.
6. Open a pull request against Bitsery *develop* branch.

If you're working with visual studio, there is how to build and run all tests from command line
```shell
mkdir build
cd build
cmake -DBITSERY_BUILD_TESTS=ON -DGTEST_ROOT="<PATH to GTEST>" -DCMAKE_CXX_FLAGS_RELEASE=/MT ..
cmake --build . --config Release
(cd tests && ctest -C Release && cd ..)
```
/MT option might be optional, depending on how gtest was built.

## Style guide

Just use your own judgment and stick to the style of the surrounding code.


text:
#import "NSObject.h"

#import "NSCopying-Protocol.h"

@class NSImage, NSString, NSURL;

@interface IDEWelcomeWindowRecent : NSObject <NSCopying>
{
    id <NSRecentDocumentInfo> _recentInfo;
    NSURL *_url;
}

+ (id)_descriptionForLastOpenedDate:(id)arg1 isLastOpenedDate:(BOOL)arg2;
+ (id)recentsForURLs:(id)arg1;
+ (id)recentsForRecentInfos:(id)arg1;
- (void).cxx_destruct;
@property(readonly) NSString *lastOpenedDate;
- (id)recentDocumentInfo;
- (long long)state;
@property(readonly) NSString *truncatedPath;
@property(readonly) NSString *name;
@property(readonly) NSImage *image;
@property(readonly) NSURL *url;
- (id)copyWithZone:(struct _NSZone *)arg1;
- (id)initWithURL:(id)arg1;
- (id)initWithRecentInfo:(id)arg1;

@end


text:
/* AboutBox.cpp */

#include "FariaRomEditor.h"

/*
static char *HarvestVersionDataElement(void *pBuffer, const TCHAR *psztObject)
{
	WORD* langInfo;
	UINT cbLang;
	TCHAR tszVerStrName[128];
	LPVOID lpt;
	UINT cbBufSize;

	// Get the Company Name.
	// First, to get string information, we need to get language information.
	if (!VerQueryValue(pBuffer, _T("\\VarFileInfo\\Translation"), (LPVOID*)&langInfo, &cbLang))
	{
		return NULL;
	}

    //Prepare the label -- default lang is bytes 0 & 1 of langInfo
    wsprintf(tszVerStrName, _T("\\StringFileInfo\\%04x%04x\\%s"), langInfo[0], langInfo[1], psztObject);

	//Get the string from the resource data
	if (VerQueryValue(pBuffer, tszVerStrName, &lpt, &cbBufSize))
	{
		return strdup((char*)lpt);
	}

	return NULL;
}
*/

// Read VS_VERSION_INFO resource from given file.  Parses version info
// into the given structure.  Returns 'true' if successful, 'false' if it fails.
// Failure reasons hould still be in GetLastError().  'szFilename' can be NULL.
// If 'szFilename' is NULL, function will use current module.

// Reads VS_VERSION_INFO resource from current module.
// Extracts named field into user supplied buffer.

static bool	GetModuleVersionInfo(WORD *pwProductVersion)
{
	TCHAR szInternalFilename[MAX_PATH];
	void *pBuffer;
	DWORD dwSize, dwDummy, dwBufSize;
	VS_FIXEDFILEINFO *lpFFI;

	memset(pwProductVersion, 0, sizeof(WORD) * 4);

	if (!GetModuleFileName(NULL, szInternalFilename, TCHAR_sizeof(szInternalFilename)))
	{
		return false;
	}

	if ((dwSize = GetFileVersionInfoSize(szInternalFilename, &dwDummy)) == 0)
	{
		return false;
	}

	pBuffer = MyAlloc(dwSize);

	if (!GetFileVersionInfo(szInternalFilename, 0, dwSize, pBuffer))
	{
		MyFree(pBuffer);
		return false;
	}

    if (VerQueryValue(pBuffer, TEXT("\\"), (LPVOID *) &lpFFI, (UINT *) &dwBufSize))
    {
		//We now have the VS_FIXEDFILEINFO in lpFFI

//		wFileVersion[0] = HIWORD(lpFFI->dwFileVersionMS);
//		wFileVersion[1] = LOWORD(lpFFI->dwFileVersionMS);
//		wFileVersion[2] = HIWORD(lpFFI->dwFileVersionLS);
//		wFileVersion[3] = LOWORD(lpFFI->dwFileVersionLS);

		pwProductVersion[0] = HIWORD(lpFFI->dwProductVersionMS);
		pwProductVersion[1] = LOWORD(lpFFI->dwProductVersionMS);
		pwProductVersion[2] = HIWORD(lpFFI->dwProductVersionLS);
		pwProductVersion[3] = LOWORD(lpFFI->dwProductVersionLS);
    }

//	pszCompanyName = HarvestVersionDataElement(pBuffer, _T("CompanyName"));
//	pszProductName = HarvestVersionDataElement(pBuffer, _T("ProductName"));
//	pszCopyright = HarvestVersionDataElement(pBuffer, _T("LegalCopyright"));
//	pszInternalName = HarvestVersionDataElement(pBuffer, _T("InternalName"));

	MyFree(pBuffer);

	return true;
}

INT_PTR CALLBACK AboutBoxDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	TCHAR	temp[256];
	WORD	wProductVersion[4];

	switch (uMsg)
	{
		case WM_INITDIALOG:
			SetWindowStandards(hWnd, TEXT("Faria Editor - About"));
			GetModuleVersionInfo(wProductVersion);
			wnsprintf(temp, TCHAR_sizeof(temp), TEXT("Version: %u.%u.%u.%u"),
				wProductVersion[0], wProductVersion[1],
				wProductVersion[2], wProductVersion[3]);
			SetDlgItemText(hWnd, IDC_VERSION, temp);
			return 1;

		case WM_DESTROY:
			return 1;

		case WM_COMMAND:
			switch (LOWORD(wParam))
			{
				case IDOK:
				case IDCANCEL:
					EndDialog(hWnd, 0);
					return 0;
			}
	}
	return 0;
}


text:
using Cassette.Stylesheets;
using Xunit;

namespace Cassette.Spriting
{
    public class SpriteImagesTests
    {
        [Fact]
        public void DontSpriteWhenDebugging()
        {
            var bundle = new StylesheetBundle("~");
            var asset = new StubAsset(
                "~/asset.css",
                ".a { background-image:url(image-a.png);width:20px;height:20px }\n" +
                ".b { background-image:url(image-b.png);width:20px;height:20px }"
            );
            bundle.Assets.Add(asset);

            var settings = new CassetteSettings
            {
                IsDebuggingEnabled = true,
                CacheDirectory = new FakeFileSystem()
            };

            var processor = new SpriteImages(settings, () => null);
            processor.Process(bundle);
            // Would throw exception if it tried to sprite the CSS.
        }
    }
}


text:
import toastr from 'toastr';
Template.livechatCustomFieldForm.helpers({
	customField() {
		return Template.instance().customField.get();
	}
});

Template.livechatCustomFieldForm.events({
	'submit #customField-form'(e, instance) {
		e.preventDefault();
		var $btn = instance.$('button.save');

		var _id = $(e.currentTarget).data('id');
		var field = instance.$('input[name=field]').val();
		var label = instance.$('input[name=label]').val();
		var scope = instance.$('select[name=scope]').val();
		var visibility = instance.$('select[name=visibility]').val();

		if (!/^[0-9a-zA-Z-_]+$/.test(field)) {
			return toastr.error(t('error-invalid-custom-field-name'));
		}

		if (label.trim() === '') {
			return toastr.error(t('Please_fill_a_label'));
		}

		var oldBtnValue = $btn.html();
		$btn.html(t('Saving'));

		var customFieldData = {
			field: field,
			label: label,
			scope: scope.trim(),
			visibility: visibility.trim()
		};

		Meteor.call('livechat:saveCustomField', _id, customFieldData, function(error) {
			$btn.html(oldBtnValue);
			if (error) {
				return handleError(error);
			}

			toastr.success(t('Saved'));
			FlowRouter.go('livechat-customfields');
		});
	},

	'click button.back'(e/*, instance*/) {
		e.preventDefault();
		FlowRouter.go('livechat-customfields');
	}
});

Template.livechatCustomFieldForm.onCreated(function() {
	this.customField = new ReactiveVar({});
	this.autorun(() => {
		var sub = this.subscribe('livechat:customFields', FlowRouter.getParam('_id'));
		if (sub.ready()) {
			const customField = LivechatCustomField.findOne({ _id: FlowRouter.getParam('_id') });
			if (customField) {
				this.customField.set(customField);
			}
		}
	});
});


text:
module TrafficSpy

  class UserAgent
    extend ModelHelper

    def self.table
      DB.from(:userAgents)
    end

    def self.exist?(client_software)
      table.where(
      :client_software => client_software
      ).count > 0
    end

    def self.return_id(client_software)
      if exist?(client_software)
        table.select(:id).where(:client_software => client_software)
      else
        table.insert(
        :client_software => client_software
        )
        table.select(:id).to_a.last[:id]
      end
    end

    def self.user_agent_breakdown(identifier)
      filtered_db = DB.from(:sources).join(:payloads, :source_id => :id)
                                     .join(:userAgents, :id => :userAgent_id)
                                     .where(:source_id => identifier_id(identifier))
      filtered_db.to_a.map {|hash| hash[:client_software]}
    end

    def self.web_browser_breakdown_by(identifier)
      browsers = user_agent_breakdown(identifier).map do |software|
        software.split[0]
      end
      browsers.inject(Hash.new(0)) {|hash, browser| hash[browser] += 1; hash}
              .sort_by {|key, value| value}.reverse
    end

    def self.web_os_breakdown_by(identifier)
      oss = user_agent_breakdown(identifier).map do |software|
        software.split[1][1..-2]
      end
      oss.inject(Hash.new(0)) {|hash, os| hash[os] += 1; hash}
         .sort_by {|key, value| value}.reverse
    end

  end

end


text:
/**
 * @module ol/renderer/webgl/Map
 */

import {inherits} from '../../index.js';
import {stableSort} from '../../array.js';
import {CLASS_UNSELECTABLE} from '../../css.js';
import {createCanvasContext2D} from '../../dom.js';
import {listen} from '../../events.js';
import _ol_has_ from '../../has.js';
import Layer from '../../layer/Layer.js';
import RenderEvent from '../../render/Event.js';
import RenderEventType from '../../render/EventType.js';
import _ol_render_webgl_Immediate_ from '../../render/webgl/Immediate.js';
import MapRenderer from '../Map.js';
import RendererType from '../Type.js';
import SourceState from '../../source/State.js';
import LRUCache from '../../structs/LRUCache.js';
import PriorityQueue from '../../structs/PriorityQueue.js';
import _ol_webgl_ from '../../webgl.js';
import _ol_webgl_Context_ from '../../webgl/Context.js';
import ContextEventType from '../../webgl/ContextEventType.js';

/**
 * @type {number} Texture cache high water mark.
 */
const WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK = 1024;

/**
 * @constructor
 * @extends {ol.renderer.Map}
 * @param {Element} container Container.
 * @param {ol.PluggableMap} map Map.
 * @api
 */
const WebGLMapRenderer = function(container, map) {
  MapRenderer.call(this, container, map);

  /**
   * @private
   * @type {HTMLCanvasElement}
   */
  this.canvas_ = /** @type {HTMLCanvasElement} */
    (document.createElement('CANVAS'));
  this.canvas_.style.width = '100%';
  this.canvas_.style.height = '100%';
  this.canvas_.style.display = 'block';
  this.canvas_.className = CLASS_UNSELECTABLE;
  container.insertBefore(this.canvas_, container.childNodes[0] || null);

  /**
   * @private
   * @type {number}
   */
  this.clipTileCanvasWidth_ = 0;

  /**
   * @private
   * @type {number}
   */
  this.clipTileCanvasHeight_ = 0;

  /**
   * @private
   * @type {CanvasRenderingContext2D}
   */
  this.clipTileContext_ = createCanvasContext2D();

  /**
   * @private
   * @type {boolean}
   */
  this.renderedVisible_ = true;

  /**
   * @private
   * @type {WebGLRenderingContext}
   */
  this.gl_ = _ol_webgl_.getContext(this.canvas_, {
    antialias: true,
    depth: true,
    failIfMajorPerformanceCaveat: true,
    preserveDrawingBuffer: false,
    stencil: true
  });

  /**
   * @private
   * @type {ol.webgl.Context}
   */
  this.context_ = new _ol_webgl_Context_(this.canvas_, this.gl_);

  listen(this.canvas_, ContextEventType.LOST,
    this.handleWebGLContextLost, this);
  listen(this.canvas_, ContextEventType.RESTORED,
    this.handleWebGLContextRestored, this);

  /**
   * @private
   * @type {ol.structs.LRUCache.<ol.WebglTextureCacheEntry|null>}
   */
  this.textureCache_ = new LRUCache();

  /**
   * @private
   * @type {ol.Coordinate}
   */
  this.focus_ = null;

  /**
   * @private
   * @type {ol.structs.PriorityQueue.<Array>}
   */
  this.tileTextureQueue_ = new PriorityQueue(
    /**
       * @param {Array.<*>} element Element.
       * @return {number} Priority.
       * @this {ol.renderer.webgl.Map}
       */
    (function(element) {
      const tileCenter = /** @type {ol.Coordinate} */ (element[1]);
      const tileResolution = /** @type {number} */ (element[2]);
      const deltaX = tileCenter[0] - this.focus_[0];
      const deltaY = tileCenter[1] - this.focus_[1];
      return 65536 * Math.log(tileResolution) +
            Math.sqrt(deltaX * deltaX + deltaY * deltaY) / tileResolution;
    }).bind(this),
    /**
       * @param {Array.<*>} element Element.
       * @return {string} Key.
       */
    function(element) {
      return /** @type {ol.Tile} */ (element[0]).getKey();
    });

  /**
   * @param {ol.PluggableMap} map Map.
   * @param {?olx.FrameState} frameState Frame state.
   * @return {boolean} false.
   * @this {ol.renderer.webgl.Map}
   */
  this.loadNextTileTexture_ =
      function(map, frameState) {
        if (!this.tileTextureQueue_.isEmpty()) {
          this.tileTextureQueue_.reprioritize();
          const element = this.tileTextureQueue_.dequeue();
          const tile = /** @type {ol.Tile} */ (element[0]);
          const tileSize = /** @type {ol.Size} */ (element[3]);
          const tileGutter = /** @type {number} */ (element[4]);
          this.bindTileTexture(
            tile, tileSize, tileGutter, _ol_webgl_.LINEAR, _ol_webgl_.LINEAR);
        }
        return false;
      }.bind(this);

  /**
   * @private
   * @type {number}
   */
  this.textureCacheFrameMarkerCount_ = 0;

  this.initializeGL_();
};

inherits(WebGLMapRenderer, MapRenderer);

/**
 * Determine if this renderer handles the provided layer.
 * @param {ol.renderer.Type} type The renderer type.
 * @return {boolean} The renderer can render the layer.
 */
WebGLMapRenderer['handles'] = function(type) {
  return _ol_has_.WEBGL && type === RendererType.WEBGL;
};

/**
 * Create the map renderer.
 * @param {Element} container Container.
 * @param {ol.PluggableMap} map Map.
 * @return {ol.renderer.webgl.Map} The map renderer.
 */
WebGLMapRenderer['create'] = function(container, map) {
  return new WebGLMapRenderer(container, map);
};

/**
 * @param {ol.Tile} tile Tile.
 * @param {ol.Size} tileSize Tile size.
 * @param {number} tileGutter Tile gutter.
 * @param {number} magFilter Mag filter.
 * @param {number} minFilter Min filter.
 */
WebGLMapRenderer.prototype.bindTileTexture = function(tile, tileSize, tileGutter, magFilter, minFilter) {
  const gl = this.getGL();
  const tileKey = tile.getKey();
  if (this.textureCache_.containsKey(tileKey)) {
    const textureCacheEntry = this.textureCache_.get(tileKey);
    gl.bindTexture(_ol_webgl_.TEXTURE_2D, textureCacheEntry.texture);
    if (textureCacheEntry.magFilter != magFilter) {
      gl.texParameteri(
        _ol_webgl_.TEXTURE_2D, _ol_webgl_.TEXTURE_MAG_FILTER, magFilter);
      textureCacheEntry.magFilter = magFilter;
    }
    if (textureCacheEntry.minFilter != minFilter) {
      gl.texParameteri(
        _ol_webgl_.TEXTURE_2D, _ol_webgl_.TEXTURE_MIN_FILTER, minFilter);
      textureCacheEntry.minFilter = minFilter;
    }
  } else {
    const texture = gl.createTexture();
    gl.bindTexture(_ol_webgl_.TEXTURE_2D, texture);
    if (tileGutter > 0) {
      const clipTileCanvas = this.clipTileContext_.canvas;
      const clipTileContext = this.clipTileContext_;
      if (this.clipTileCanvasWidth_ !== tileSize[0] ||
          this.clipTileCanvasHeight_ !== tileSize[1]) {
        clipTileCanvas.width = tileSize[0];
        clipTileCanvas.height = tileSize[1];
        this.clipTileCanvasWidth_ = tileSize[0];
        this.clipTileCanvasHeight_ = tileSize[1];
      } else {
        clipTileContext.clearRect(0, 0, tileSize[0], tileSize[1]);
      }
      clipTileContext.drawImage(tile.getImage(), tileGutter, tileGutter,
        tileSize[0], tileSize[1], 0, 0, tileSize[0], tileSize[1]);
      gl.texImage2D(_ol_webgl_.TEXTURE_2D, 0,
        _ol_webgl_.RGBA, _ol_webgl_.RGBA,
        _ol_webgl_.UNSIGNED_BYTE, clipTileCanvas);
    } else {
      gl.texImage2D(_ol_webgl_.TEXTURE_2D, 0,
        _ol_webgl_.RGBA, _ol_webgl_.RGBA,
        _ol_webgl_.UNSIGNED_BYTE, tile.getImage());
    }
    gl.texParameteri(
      _ol_webgl_.TEXTURE_2D, _ol_webgl_.TEXTURE_MAG_FILTER, magFilter);
    gl.texParameteri(
      _ol_webgl_.TEXTURE_2D, _ol_webgl_.TEXTURE_MIN_FILTER, minFilter);
    gl.texParameteri(_ol_webgl_.TEXTURE_2D, _ol_webgl_.TEXTURE_WRAP_S,
      _ol_webgl_.CLAMP_TO_EDGE);
    gl.texParameteri(_ol_webgl_.TEXTURE_2D, _ol_webgl_.TEXTURE_WRAP_T,
      _ol_webgl_.CLAMP_TO_EDGE);
    this.textureCache_.set(tileKey, {
      texture: texture,
      magFilter: magFilter,
      minFilter: minFilter
    });
  }
};

/**
 * @param {ol.render.EventType} type Event type.
 * @param {olx.FrameState} frameState Frame state.
 * @private
 */
WebGLMapRenderer.prototype.dispatchComposeEvent_ = function(type, frameState) {
  const map = this.getMap();
  if (map.hasListener(type)) {
    const context = this.context_;

    const extent = frameState.extent;
    const size = frameState.size;
    const viewState = frameState.viewState;
    const pixelRatio = frameState.pixelRatio;

    const resolution = viewState.resolution;
    const center = viewState.center;
    const rotation = viewState.rotation;

    const vectorContext = new _ol_render_webgl_Immediate_(context,
      center, resolution, rotation, size, extent, pixelRatio);
    const composeEvent = new RenderEvent(type, vectorContext,
      frameState, null, context);
    map.dispatchEvent(composeEvent);
  }
};

/**
 * @inheritDoc
 */
WebGLMapRenderer.prototype.disposeInternal = function() {
  const gl = this.getGL();
  if (!gl.isContextLost()) {
    this.textureCache_.forEach(
      /**
         * @param {?ol.WebglTextureCacheEntry} textureCacheEntry
         *     Texture cache entry.
         */
      function(textureCacheEntry) {
        if (textureCacheEntry) {
          gl.deleteTexture(textureCacheEntry.texture);
        }
      });
  }
  this.context_.dispose();
  MapRenderer.prototype.disposeInternal.call(this);
};

/**
 * @param {ol.PluggableMap} map Map.
 * @param {olx.FrameState} frameState Frame state.
 * @private
 */
WebGLMapRenderer.prototype.expireCache_ = function(map, frameState) {
  const gl = this.getGL();
  let textureCacheEntry;
  while (this.textureCache_.getCount() - this.textureCacheFrameMarkerCount_ >
      WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK) {
    textureCacheEntry = this.textureCache_.peekLast();
    if (!textureCacheEntry) {
      if (+this.textureCache_.peekLastKey() == frameState.index) {
        break;
      } else {
        --this.textureCacheFrameMarkerCount_;
      }
    } else {
      gl.deleteTexture(textureCacheEntry.texture);
    }
    this.textureCache_.pop();
  }
};

/**
 * @return {ol.webgl.Context} The context.
 */
WebGLMapRenderer.prototype.getContext = function() {
  return this.context_;
};

/**
 * @return {WebGLRenderingContext} GL.
 */
WebGLMapRenderer.prototype.getGL = function() {
  return this.gl_;
};

/**
 * @return {ol.structs.PriorityQueue.<Array>} Tile texture queue.
 */
WebGLMapRenderer.prototype.getTileTextureQueue = function() {
  return this.tileTextureQueue_;
};

/**
 * @inheritDoc
 */
WebGLMapRenderer.prototype.getType = function() {
  return RendererType.WEBGL;
};

/**
 * @param {ol.events.Event} event Event.
 * @protected
 */
WebGLMapRenderer.prototype.handleWebGLContextLost = function(event) {
  event.preventDefault();
  this.textureCache_.clear();
  this.textureCacheFrameMarkerCount_ = 0;

  const renderers = this.getLayerRenderers();
  for (const id in renderers) {
    const renderer = /** @type {ol.renderer.webgl.Layer} */ (renderers[id]);
    renderer.handleWebGLContextLost();
  }
};

/**
 * @protected
 */
WebGLMapRenderer.prototype.handleWebGLContextRestored = function() {
  this.initializeGL_();
  this.getMap().render();
};

/**
 * @private
 */
WebGLMapRenderer.prototype.initializeGL_ = function() {
  const gl = this.gl_;
  gl.activeTexture(_ol_webgl_.TEXTURE0);
  gl.blendFuncSeparate(
    _ol_webgl_.SRC_ALPHA, _ol_webgl_.ONE_MINUS_SRC_ALPHA,
    _ol_webgl_.ONE, _ol_webgl_.ONE_MINUS_SRC_ALPHA);
  gl.disable(_ol_webgl_.CULL_FACE);
  gl.disable(_ol_webgl_.DEPTH_TEST);
  gl.disable(_ol_webgl_.SCISSOR_TEST);
  gl.disable(_ol_webgl_.STENCIL_TEST);
};

/**
 * @param {ol.Tile} tile Tile.
 * @return {boolean} Is tile texture loaded.
 */
WebGLMapRenderer.prototype.isTileTextureLoaded = function(tile) {
  return this.textureCache_.containsKey(tile.getKey());
};

/**
 * @inheritDoc
 */
WebGLMapRenderer.prototype.renderFrame = function(frameState) {

  const context = this.getContext();
  const gl = this.getGL();

  if (gl.isContextLost()) {
    return false;
  }

  if (!frameState) {
    if (this.renderedVisible_) {
      this.canvas_.style.display = 'none';
      this.renderedVisible_ = false;
    }
    return false;
  }

  this.focus_ = frameState.focus;

  this.textureCache_.set((-frameState.index).toString(), null);
  ++this.textureCacheFrameMarkerCount_;

  this.dispatchComposeEvent_(RenderEventType.PRECOMPOSE, frameState);

  /** @type {Array.<ol.LayerState>} */
  const layerStatesToDraw = [];
  const layerStatesArray = frameState.layerStatesArray;
  stableSort(layerStatesArray, MapRenderer.sortByZIndex);

  const viewResolution = frameState.viewState.resolution;
  let i, ii, layerRenderer, layerState;
  for (i = 0, ii = layerStatesArray.length; i < ii; ++i) {
    layerState = layerStatesArray[i];
    if (Layer.visibleAtResolution(layerState, viewResolution) &&
        layerState.sourceState == SourceState.READY) {
      layerRenderer = /** @type {ol.renderer.webgl.Layer} */ (this.getLayerRenderer(layerState.layer));
      if (layerRenderer.prepareFrame(frameState, layerState, context)) {
        layerStatesToDraw.push(layerState);
      }
    }
  }

  const width = frameState.size[0] * frameState.pixelRatio;
  const height = frameState.size[1] * frameState.pixelRatio;
  if (this.canvas_.width != width || this.canvas_.height != height) {
    this.canvas_.width = width;
    this.canvas_.height = height;
  }

  gl.bindFramebuffer(_ol_webgl_.FRAMEBUFFER, null);

  gl.clearColor(0, 0, 0, 0);
  gl.clear(_ol_webgl_.COLOR_BUFFER_BIT);
  gl.enable(_ol_webgl_.BLEND);
  gl.viewport(0, 0, this.canvas_.width, this.canvas_.height);

  for (i = 0, ii = layerStatesToDraw.length; i < ii; ++i) {
    layerState = layerStatesToDraw[i];
    layerRenderer = /** @type {ol.renderer.webgl.Layer} */ (this.getLayerRenderer(layerState.layer));
    layerRenderer.composeFrame(frameState, layerState, context);
  }

  if (!this.renderedVisible_) {
    this.canvas_.style.display = '';
    this.renderedVisible_ = true;
  }

  this.calculateMatrices2D(frameState);

  if (this.textureCache_.getCount() - this.textureCacheFrameMarkerCount_ >
      WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK) {
    frameState.postRenderFunctions.push(
      /** @type {ol.PostRenderFunction} */ (this.expireCache_.bind(this))
    );
  }

  if (!this.tileTextureQueue_.isEmpty()) {
    frameState.postRenderFunctions.push(this.loadNextTileTexture_);
    frameState.animate = true;
  }

  this.dispatchComposeEvent_(RenderEventType.POSTCOMPOSE, frameState);

  this.scheduleRemoveUnusedLayerRenderers(frameState);
  this.scheduleExpireIconCache(frameState);

};

/**
 * @inheritDoc
 */
WebGLMapRenderer.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, hitTolerance, callback, thisArg,
  layerFilter, thisArg2) {
  let result;

  if (this.getGL().isContextLost()) {
    return false;
  }

  const viewState = frameState.viewState;

  const layerStates = frameState.layerStatesArray;
  const numLayers = layerStates.length;
  let i;
  for (i = numLayers - 1; i >= 0; --i) {
    const layerState = layerStates[i];
    const layer = layerState.layer;
    if (Layer.visibleAtResolution(layerState, viewState.resolution) &&
        layerFilter.call(thisArg2, layer)) {
      const layerRenderer = this.getLayerRenderer(layer);
      result = layerRenderer.forEachFeatureAtCoordinate(
        coordinate, frameState, hitTolerance, callback, thisArg);
      if (result) {
        return result;
      }
    }
  }
  return undefined;
};

/**
 * @inheritDoc
 */
WebGLMapRenderer.prototype.hasFeatureAtCoordinate = function(coordinate, frameState, hitTolerance, layerFilter, thisArg) {
  let hasFeature = false;

  if (this.getGL().isContextLost()) {
    return false;
  }

  const viewState = frameState.viewState;

  const layerStates = frameState.layerStatesArray;
  const numLayers = layerStates.length;
  let i;
  for (i = numLayers - 1; i >= 0; --i) {
    const layerState = layerStates[i];
    const layer = layerState.layer;
    if (Layer.visibleAtResolution(layerState, viewState.resolution) &&
        layerFilter.call(thisArg, layer)) {
      const layerRenderer = this.getLayerRenderer(layer);
      hasFeature =
          layerRenderer.hasFeatureAtCoordinate(coordinate, frameState);
      if (hasFeature) {
        return true;
      }
    }
  }
  return hasFeature;
};

/**
 * @inheritDoc
 */
WebGLMapRenderer.prototype.forEachLayerAtPixel = function(pixel, frameState, callback, thisArg,
  layerFilter, thisArg2) {
  if (this.getGL().isContextLost()) {
    return false;
  }

  const viewState = frameState.viewState;
  let result;

  const layerStates = frameState.layerStatesArray;
  const numLayers = layerStates.length;
  let i;
  for (i = numLayers - 1; i >= 0; --i) {
    const layerState = layerStates[i];
    const layer = layerState.layer;
    if (Layer.visibleAtResolution(layerState, viewState.resolution) &&
        layerFilter.call(thisArg, layer)) {
      const layerRenderer = /** @type {ol.renderer.webgl.Layer} */ (this.getLayerRenderer(layer));
      result = layerRenderer.forEachLayerAtPixel(
        pixel, frameState, callback, thisArg);
      if (result) {
        return result;
      }
    }
  }
  return undefined;
};
export default WebGLMapRenderer;


text:
package jlibs.jdbc;

/**
 * @author Santhosh Kumar T
 */
public interface Transaction<R> extends JDBCTask<R>{
}


text:
describe('switch', function () {
    describe('#initSwitch', function () {
        $('body').append([
            ''
        ].join(''));

        var ndSwitch = $('.J-switch');
        it('DataApi doesn\'t work for switch', function () {
            assert.equal(1, doggy.dataApi.switches.length);
            assert.equal(true, ndSwitch.data('init'));
        });
        it('Switch doesn\'t work', function () {
            assert.equal(false, ndSwitch.hasClass('switch--active'));
            ndSwitch.trigger('click');
            assert.equal(true, ndSwitch.hasClass('switch--active'));
        });
    });
});


text:
- GitHub/Slack: [@timothysc](https://github.com/timothysc)
- Email: tstclair@heptio.com
- Twitter: [@timothysc](https://twitter.com/timothysc)

## Background

I've been involved in the Kubernetes project since the very beginning, and have worked with plethora of open source communities and projects for more then 10+ years.   During my tenure on the project, I've been lucky enough to meet a number of great folks and have worked on various roles in the kubernetes community:

- **Current Steering Community Member**
- SIG Cluster Life-cycle & Testing (Lead)
- CNCF Conformance working group member (on-going)
- SIG Scheduling & Scale (Emeritus Lead)
- SIG API Machinery, Node (Contributor)

## Why I want to be on the Steering Committee (Community Empowerment v2)

When I had first ran for steering a year ago, I had a differing view of what steering committee position would entail, contrasted with what it actually is.  A steering committee position is responsible for establishing, and refining, a distributed governance model that empowers different stakeholders in the community.  My primary objective in re-running for steering, is to continue the work that we have started in helping to rationalize the communities organizational structure, and to empower the different SIGs to take ownership rights of different areas.

## Where I work

Staff Engineer @Heptio


text:
import job_stream.common as common
import os

exDir = os.path.join(os.path.dirname(__file__), '../../../../example')

class addOne(common.Job):
    USE_MULTIPROCESSING = False

    def postSetup(self):
        print("addOne setup")

    def handleWork(self, w):
        self.emit(w + 1)

class sum(common.Reducer):
    USE_MULTIPROCESSING = False

    def postSetup(self):
        print("sum setup")

    def handleInit(self, store):
        store.value = 0

    def handleAdd(self, store, work):
        store.value += work

    def handleJoin(self, store, other):
        store.value += other.value

    def handleDone(self, store):
        self.emit(store.value)

if __name__ == '__main__':
    common.work = [ 3, 4 ]
    common.run(os.path.join(exDir, "example1.yaml"))


text:
<title>BeHappy Development kit</title>

Return to DK Summary

<!DK><!class><!DK>
The Classes

HTMLProject

Derived from: BArchivable

Declared in: HTMLProject.h

The HTMLProject class represents any BeHappy add-on, and includes all what's needed by BeHappy to communicate with it. Inherit from this class to do an add-on.

Some functions in this class are useful only for BeHappy, so you won't need to use them, but if you're curious, I also tell a few things about them. I've just put a warning message underneath their name: You shouldn't need this. I've also marked the virtual functions.

Hook Functions

<tt>

FindHome()

About()

GiveConfig()

Update()

GiveSupportedAddOns() (not used yet)
</tt>

Constructor and Destructor

HTMLProject()

  <tt>HTMLProject()</tt>

  <tt>HTMLProject(</tt>BMessage *archive<tt>)</tt>

The constructor just creates a new project object. The first version creates an empty project (the happyList variable is set to NULL), and the second one rebuilds the happyList from the given archive.

~HTMLProject()

Warning: don't overload the HTMLProject destructor. As it isn't virtual, it would never be called by BeHappy.

  <tt>~HTMLProject()</tt>

Frees all the memory allocated by the project, including the happy list.

Static Functions

Instantiate()
 see BArchivable::Instantiate().

Member Functions

About()
 virtual

  <tt>void</tt> <tt> About()</tt> <tt>const</tt>

Called by BeHappy when the user asks information about the add-on. Should display an 'About' window.

AddFile()
 You shouldn't need this

  <tt>unsigned int</tt> <tt>AddFile(</tt> <tt>const char *fname<tt>, int</tt> guess<tt>=-1</tt><tt>)</tt>

Adds a file name in the project file database. Returns the number of the file in this database. The HTMLLabels store the file number instead of the file name, for some obvious memory economy reasons. If the file is already stored in the database, this method simply returns its number. The search can be sped up with the guess parameter, if you know an approximate value.

AddLabel()
 You shouldn't need this

  <tt>unsigned int</tt> <tt>AddLabel(</tt> <tt>const </tt>HTMLLabel *label<tt>)</tt>

Adds a label in the project label database, and returns the number of this label. (The number is used in the happylinks)

Archive()
 see BArchivable::Archive()

Clean()

  <tt>void</tt> <tt>Clean()</tt> <tt>const</tt>

Empties the happyList. (Called at the beginning of Update().)

GetFile()
 You shouldn't need this

  HTMLFile <tt>*GetFile(</tt> <tt>unsigned int index <tt>)</tt>

This method returns the HTMLFile object associated with the index index.

GetPath()

  <tt>BPath</tt> <tt>*GetPath(</tt> <tt>const char *fname <tt>)</tt>

Returns the path of the file specified by the relative name fname. See SetHome().

GiveSupportedAddOns()
 virtual - not used yet

  <tt>const char</tt> <tt>**GiveSupportedAddOns()</tt>

Unused in this version

FindHome()
 virtual

  <tt>bool</tt> <tt>FindHome()

Called by BeHappy to find the home directory for the documentation. (Use the SetHome() function once you've found it). Returns <tt>true</tt> if the directory if found. If FindHome() returns <tt>false</tt>, BeHappy will open a window asking the user to enter the path manualy.

If FindHome() returns <tt>false</tt> but has called SetHome() before, BeHappy will display the given path in its window. The user can modify it, or just confirm it.

GiveConfig()
 virtual

  <tt>const unsigned int</tt> <tt>*GiveConfig()</tt> <tt>const</tt>

Returns an array of <tt>unsigned int</tt> containing the configurations of the different indexes (double or simple lists, 'find' options etc...). The number of integers must be the same as (or at least greater than) the number of indexes. Have a look at the constants to know what defined constants you can use in this function. Each integer is associated with an index.

GiveName()

  BString <tt>*GiveName(</tt> <tt>unsigned int index <tt>)</tt>

Gives the full name of a label indentified by its index number index. A full label name is a string like 'FileName.html#LabelName'.

InitOK()

  <tt>bool</tt> <tt>InitOK()</tt>

Returns <tt>true</tt> if the object initialisation was done correctly, or <tt>false</tt> if there has been an error.

NumPrint()

  <tt>void</tt> <tt>NumPrint(</tt><tt>unsigned int </tt> n<tt>)</tt>

Tells BeHappy how much Print() calls there will be during the update. Only the Print()s for the second line will be counted.

Print()

  <tt>void</tt> <tt>Print(</tt><tt>const char</tt> *line1,<tt>const char</tt> *line2<tt> = NULL</tt><tt>)</tt>

Changes the information displayed during the update. If one of the parameters line1 or line2 is <tt>NULL</tt>, the corresponding line isn't changed. A Print() call with  line2 different from <tt>NULL</tt> also makes the status bar progress. Use the NumPrint() method to tell how much Print() call will be done to fill the status bar. If you only print on the first line (i.e. if line2=<tt>NULL</tt>), nothing will be done to the status bar.

SetHome()

  <tt>void</tt> <tt>SetHome(</tt> <tt>const </tt>BDirectory &dir<tt>)</tt>

Set the new home directory to dir. All the file names used in the project will be relative to this directory. It should be set in the FindHome() method. If FindHome() returns <tt>false</tt>, BeHappy will set the home path itself. SetHome() shouldn't be called elsewhere.

SetInfoMessenger()
 You shouldn't use this

  <tt>void</tt> <tt>SetInfoMessenger(</tt>BMessenger &mess<tt>)</tt>

Called by BeHappy to give a messenger to the window used to display information about the status of the update. Used by Print().

Translate()

  <tt>const char</tt> <tt>*GetFile(</tt> <tt>const char *string <tt>)</tt><tt> const</tt>

This method translates the string given in argument. The language used is the one selected by the user in BeHappy. You should create a .loc file to use this functionnality. You can translate all the strings you want, except the index names, which are automaticly translated by BeHappy. See also "Localisation".

Update()
 virtual

  <tt>void</tt> <tt>Update(</tt>HappyLink*<tt>)</tt>

This method is called when BeHappy wants to do an update of the index. It should empty the index (i.e. call Clean()) and recreate it. For this use the happyList variable, wich must be created here.

The HappyLink* parameter isn't used in this version of BeHappy. Don't use it.

Member Variables

happyList

  HappyLink <tt>*happyList</tt>

happyList is the head of the tree of HappyLinks. It's created in the Update() method. It should have the name of the add-on, and its children are the indexes used by BeHappy.

Return to DK Summary


text:
Displays two lines, each with a different color.

!!! seealso
    [LongLine](/Python/GeometricObjects/LongLine).


text:
package org.nate.internal.dom4j.cssselectors;

import java.util.Set;

import org.dom4j.Branch;
import org.dom4j.Document;
import org.dom4j.io.SAXReader;
import org.junit.Assert;
import org.junit.Test;

/**
 * Simple port of Christer Sandberg's CSS selectors to Dom4j (https://github.com/chrsan/css-selectors)
 */
public class AntonBugTest {

    private final Dom4jNodeSelector nodeSelector;

    public AntonBugTest() throws Exception {
        SAXReader reader = new SAXReader();
        Document document = reader.read("src/test/resources/anton-bug.xml");
        nodeSelector = new Dom4jNodeSelector(document);
    }

    @Test
    public void checkAdjacentSiblings() throws Exception {
        Set<Branch> result = nodeSelector.querySelectorAll("token[tag^=l] + token");
        Assert.assertEquals(3, result.size());
    }

    @Test
    public void checkGeneralSiblings() throws Exception {
        Set<Branch> result = nodeSelector.querySelectorAll("token[tag^=l] ~ token");
        Assert.assertEquals(6, result.size());
    }

}


text:
package tests;
import java.util.*;
import java.lang.*;
import java.io.*;
import judge.*;
import datastruct.*;

public class meeting_rooms_1 {
    public static int num_test = 122;
    public static Interval[][] in_0;
    public static Interval[][] in_org_0;
    public static boolean[] out;

    public static void load_test() {
        File fil = new File("judge/tests/meeting-rooms-1.txt");
        FileReader inputFil = null;
        try {
            inputFil = new FileReader(fil);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        BufferedReader in = new BufferedReader(inputFil);
        try {
            in_0 = common.read_interval_matrix(in);
            in_org_0 = test_common.copy(in_0);
            out = common.read_bool_array(in);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void judge() {
        load_test();
        common.capture_stdout();
        Solution s = new Solution();

        long startTime = System.currentTimeMillis();

        for(int i = 0; i < num_test; ++i) {
            System.out.printf("Testing case #%d\n", i+1);
            boolean answer = s.attend_all(in_0[i]);
            if(answer != out[i]) {
                common.release_stdout();
                System.out.printf("%d / %d;", i+1, num_test);
                String outs = common.to_string(meeting_rooms_1.in_org_0[i]);
                System.out.print(outs + ";");
                System.out.print(common.to_string(answer) + ";");
                System.out.println(common.to_string(out[i]));
                return;
            }
        }

        common.release_stdout();
        long estimatedTime = System.currentTimeMillis() - startTime;
        System.out.print("Accepted;");
        System.out.println(estimatedTime);
    }
}


text:
<?php
namespace Faker\Components\Writer;

use Faker\Io\Io as Base;
use Faker\Io\IoInterface;

/*
 * class Io
 */
class Io extends Base implements IoInterface
{

    protected $dir = 'dump';

    /*
     * __construct()
     * @param string $base_folder the path to a project
     */

    public function __construct($base_folder) {
        parent::__construct($base_folder);
    }

}
/* End of File */


text:
<!DOCTYPE html>
{% load bootstrap3 %}
{% load compress %}
{% load menu %}
{% load static %}

    <meta charset="utf-8">
    <title>{% block title %}GeoQ{% endblock %}</title>

    <link rel="icon" href="{% static '/images/geoqfavicon.ico'%}">
    {% bootstrap_css %}

    {% compress css %}

        <link href="{% static 'core/less/geoq.less' %}" media="all" rel="stylesheet" type="text/less"/>
        <link rel="stylesheet" href="{% static 'font-awesome-2/css/font-awesome.min.css' %}">
    	<link href="{% static 'fancytree/skin-win7/ui.fancytree.css' %}" rel="stylesheet" type="text/css">

    {% endcompress %}

    {% bootstrap_javascript %}
    {% compress js %}

    {% endcompress %}

    {% block static_libraries %}
    {% endblock %}

{% get_menu request %}

{% block container %}

        {% block content %}Empty page{% endblock %}

{% endblock %}

{% bootstrap_messages %}


text:
@implementation RowTypeMessageController

@end


text:
package uk.co.codera.templating.velocity;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

import java.util.HashMap;
import java.util.Map;

import org.junit.Before;
import org.junit.Test;

import uk.co.codera.templating.TemplateEngine;

public class VelocityTemplateEngineTest {

    private TemplateEngine templateEngine;

    @Before
    public void before() {
        this.templateEngine = new VelocityTemplateEngine();
    }

    @Test
    public void shouldMergeTemplateWithParameters() {
        assertThat(this.templateEngine.merge("Hello $name", parametersWithName("Jeff")), is("Hello Jeff"));
    }

    private Map<String, Object> parametersWithName(String name) {
        Map<String, Object> params = new HashMap<>();
        params.put("name", name);
        return params;
    }
}


text:
/*
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * * Redistributions of source code must retain the above copyright notice,
 *   this list of conditions and the following disclaimer.
 *
 * * Redistributions in binary form must reproduce the above copyright notice,
 *   this list of conditions and the following disclaimer in the documentation
 *   and/or other materials provided with the distribution.
 *
 * * Neither the name of VMware, Inc. nor the names of its contributors may be
 *   used to endorse or promote products derived from this software without
 *   specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL VMWARE, INC. OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 * DAMAGE.
 */

/* Modified by Peter Feiner (peter@cs.toronto.edu) in 2011. */

#include <linux/mm.h>
#include <linux/string.h>

#include "simple_tests.h"

#define GOAL 25

static const char* expected =
    "foo 25\n"
    "bar 24\n"
    "foo 23\n"
    "bar 22\n"
    "foo 21\n"
    "bar 20\n"
    "foo 19\n"
    "bar 18\n"
    "foo 17\n"
    "bar 16\n"
    "foo 15\n"
    "bar 14\n"
    "foo 13\n"
    "bar 12\n"
    "foo 11\n"
    "bar 10\n"
    "foo 9\n"
    "bar 8\n"
    "foo 7\n"
    "bar 6\n"
    "foo 5\n"
    "bar 4\n"
    "foo 3\n"
    "bar 2\n"
    "foo 1\n"
    "bar 0\n"
    "25 326\n";

typedef struct {
    char *data;
    unsigned long length;
    unsigned long capacity;
} buffer_t;

static void buffer_init(buffer_t *buffer) {
    buffer->length = 0;
    buffer->capacity = strlen(expected) + 1;
    buffer->data = kmalloc(buffer->capacity, GFP_ATOMIC);
    DR_ASSERT(buffer != NULL);
}

static void free_buffer(buffer_t* buffer) {
    kfree(buffer->data);
}

static void print_buffer(buffer_t* buffer, const char* fmt, ...) {
    char* start = buffer->data + buffer->length;
    unsigned long n = buffer->capacity - buffer->length;
    va_list args;
    va_start(args, fmt);
    /* don't add +1 b/c we want to overwrite null terminators. */
    buffer->length += vsnprintf(start, n, fmt, args);
    va_end(args);
    DR_ASSERT(buffer->length <= buffer->capacity);
}

static int foo(buffer_t* buffer, int n);

static int bar(buffer_t* buffer, int n)
{
    print_buffer(buffer, "bar %d\n", n);
    if (n==0) return 1;
    if (n % 2 == 0)
        return n + foo(buffer, n-1);
    if (n % 2 == 1)
        return n + bar(buffer, n-1);
    print_buffer(buffer, "\tdone with bar %d\n", n);
    return 0;
}

static int foo(buffer_t* buffer, int n)
{
    print_buffer(buffer, "foo %d\n", n);
    if (n==0) return 1;
    if (n % 2 == 0)
        return n + foo(buffer, n-1);
    if (n % 2 == 1)
        return n + bar(buffer, n-1);
    print_buffer(buffer, "\tdone with foo %d\n", n);
    return 0;
}

void
recurse_main(void) {
    int i, t = 0;
    buffer_t buffer;
    buffer_init(&buffer);
    for (i=GOAL; i<=GOAL; i++) {
        t = foo(&buffer, i);
        print_buffer(&buffer, "%d %d\n", i, t);
    }
    DR_ASSERT_EQ(0, strcmp(expected, buffer.data));
    free_buffer(&buffer);
}


text:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.msagi.flashbus.benchmark">

    <application android:allowBackup="true" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:theme="@style/AppTheme">

    </application>

</manifest>


text:
int single(char *id);
int mkdir(char *s);
//int downWeb(char *id);
void downWeb(char *id);
int getTDK(char *id);
int search(void *fp, char *s);
int sku(char *id);
int sizeColor(char *id);
int disposeUrl(char *id);
int writeTop(void);
int writeRest(char *id);
int cp2win(char *v);
int price(char *id);

#endif