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

#pragma once
#include "handler_config.hpp"
#include "image_handler.hpp"
#include "status.hpp"
#include "util.hpp"

#include <blobs-ipmid/blobs.hpp>

#include <cstdint>
#include <map>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <string_view>
#include <unordered_map>
#include <vector>

namespace ipmi_flash
{

class LogBlobHandler : public blobs::GenericBlobInterface
{
  public:
    struct ActionPack
    {
        /** Only file operation action supported currently */
        std::unique_ptr<TriggerableActionInterface> onOpen;
        std::unique_ptr<TriggerableActionInterface> onDelete;
    };

    /**
     * Create a LogBlobHandler.
     *
     * @param[in] configs - list of blob configurations to support
     */
    LogBlobHandler(std::vector<HandlerConfig<ActionPack>>&& configs);

    ~LogBlobHandler() = default;
    LogBlobHandler(const LogBlobHandler&) = delete;
    LogBlobHandler& operator=(const LogBlobHandler&) = delete;
    LogBlobHandler(LogBlobHandler&&) = default;
    LogBlobHandler& operator=(LogBlobHandler&&) = default;

    bool canHandleBlob(const std::string& path) override;
    std::vector<std::string> getBlobIds() override;
    bool deleteBlob(const std::string& path) override;
    bool stat(const std::string&, blobs::BlobMeta* meta) override;
    bool open(uint16_t session, uint16_t flags,
              const std::string& path) override;
    std::vector<uint8_t> read(uint16_t session, uint32_t offset,
                              uint32_t requestedSize) override;
    bool write(uint16_t, uint32_t, const std::vector<uint8_t>&) override
    {
        return false; /* not supported */
    };
    bool writeMeta(uint16_t, uint32_t, const std::vector<uint8_t>&) override
    {
        return false; /* not supported */
    }
    bool commit(uint16_t, const std::vector<uint8_t>&) override
    {
        return false; // not supported
    }
    bool close(uint16_t session) override;
    bool stat(uint16_t session, blobs::BlobMeta* meta) override;
    bool expire(uint16_t session) override;

  private:
    struct SessionInfo;

    struct BlobInfo
    {
        Pinned<std::string> blobId;
        std::unique_ptr<ActionPack> actions;
        std::unique_ptr<ImageHandlerInterface> handler;
        std::set<SessionInfo*> sessionsToUpdate;
    };

    struct SessionInfo
    {
        BlobInfo* blob;

        // A cached copy of the version data shared by all clients for a single
        // execution of the version retrieval action. This is is null until the
        // TriggerableAction has completed. If the action is an error, the
        // shared object is nullopt. Otherwise, contains a vector of the version
        // data when successfully read.
        std::shared_ptr<const std::optional<std::vector<uint8_t>>> data;
    };

    std::unordered_map<std::string_view, std::unique_ptr<BlobInfo>> blobInfoMap;
    std::unordered_map<uint16_t, std::unique_ptr<SessionInfo>> sessionInfoMap;
};

} // namespace ipmi_flash


text:
class CreateAccounts < ActiveRecord::Migration
  def change
    create_table :accounts do |t|
      t.string :name
      t.string :service
      t.string :name_on_service
      t.string :id_on_service
      t.string :url
      t.text :tags
      t.boolean :active

      t.timestamps
    end

    add_index :accounts, [:service, :id_on_service, :active]
    add_index :accounts, [:url]
  end
end

redpajama_set_name: RedPajamaGithub


text:
@interface SSImagePickerHelper ()<UINavigationControllerDelegate,UIImagePickerControllerDelegate>
@property (nonatomic, copy) SSImagePickerHelperDidCaptureImageBlock didCaptureImageBlock;

@end

@implementation SSImagePickerHelper

- (void)showImagePickerControllerWithSourceType:(UIImagePickerControllerSourceType)sourceType presentingViewController:(UIViewController *)presentingViewController completionHandler:(SSImagePickerHelperDidCaptureImageBlock)completionHandler {
    if (![UIImagePickerController isSourceTypeAvailable:sourceType]) {
        if (completionHandler) {
            completionHandler(nil, nil);
            completionHandler = nil;
        }
        return;
    }
    self.didCaptureImageBlock = completionHandler;

    UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
    imagePickerController.delegate = self;
    imagePickerController.allowsEditing = self.allowsEditing;
    imagePickerController.sourceType = sourceType;
    //解注释这条语句,在拍照界面可以选择视频
    //if (sourceType == UIImagePickerControllerSourceTypeCamera) {
        //imagePickerController.mediaTypes =  [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera];
    //}
    [presentingViewController presentViewController:imagePickerController animated:YES completion:^{

    }];
}

#pragma mark - UIImagePickerControllerDelegate
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
    //视频:public.movie   图片:public.image
    UIImage *image;
    if ([mediaType isEqualToString:@"public.image"]) {
        if (self.allowsEditing) {
            image = info[UIImagePickerControllerEditedImage];
        }
        else {
            image = info[UIImagePickerControllerOriginalImage];
        }
        image = [image fixOrientation];
    }
    if (self.didCaptureImageBlock) {
        self.didCaptureImageBlock(image, info);
        self.didCaptureImageBlock = nil;
    }
    [picker dismissViewControllerAnimated:YES completion:^{

    }];
}

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
    if (self.didCaptureImageBlock) {
        self.didCaptureImageBlock(nil, nil);
        self.didCaptureImageBlock = nil;
    }
    [picker dismissViewControllerAnimated:YES completion:^{

    }];
}

@end


text:
( function( tinymce ) {
	tinymce.ui.WPLinkPreview = tinymce.ui.Control.extend( {
		url: '#',
		renderHtml: function() {
			return (
				'
' +
					'' + this.url + '' +
				'
'
			);
		},
		setURL: function( url ) {
			var index, lastIndex;

			if ( this.url !== url ) {
				this.url = url;

				url = window.decodeURIComponent( url );

				url = url.replace( /^(?:https?:)?\/\/(?:www\.)?/, '' );

				if ( ( index = url.indexOf( '?' ) ) !== -1 ) {
					url = url.slice( 0, index );
				}

				if ( ( index = url.indexOf( '#' ) ) !== -1 ) {
					url = url.slice( 0, index );
				}

				url = url.replace( /(?:index)?\.html$/, '' );

				if ( url.charAt( url.length - 1 ) === '/' ) {
					url = url.slice( 0, -1 );
				}

				// If the URL is longer that 40 chars, concatenate the beginning (after the domain) and ending with ...
				if ( url.length > 40 && ( index = url.indexOf( '/' ) ) !== -1 && ( lastIndex = url.lastIndexOf( '/' ) ) !== -1 && lastIndex !== index ) {
					// If the beginning + ending are shorter that 40 chars, show more of the ending
					if ( index + url.length - lastIndex < 40 ) {
						lastIndex =  -( 40 - ( index + 1 ) );
					}

					url = url.slice( 0, index + 1 ) + '\u2026' + url.slice( lastIndex );
				}

				tinymce.$( this.getEl().firstChild ).attr( 'href', this.url ).text( url );
			}
		}
	} );

	tinymce.PluginManager.add( 'wplink', function( editor ) {
		var toolbar;

		editor.addCommand( 'WP_Link', function() {
			window.wpLink && window.wpLink.open( editor.id );
		});

		// WP default shortcut
		editor.addShortcut( 'Alt+Shift+A', '', 'WP_Link' );
		// The "de-facto standard" shortcut, see #27305
		editor.addShortcut( 'Meta+K', '', 'WP_Link' );

		editor.addButton( 'link', {
			icon: 'link',
			tooltip: 'Insert/edit link',
			cmd: 'WP_Link',
			stateSelector: 'a[href]'
		});

		editor.addButton( 'unlink', {
			icon: 'unlink',
			tooltip: 'Remove link',
			cmd: 'unlink'
		});

		editor.addMenuItem( 'link', {
			icon: 'link',
			text: 'Insert/edit link',
			cmd: 'WP_Link',
			stateSelector: 'a[href]',
			context: 'insert',
			prependToContext: true
		});

		editor.on( 'pastepreprocess', function( event ) {
			var pastedStr = event.content,
				regExp = /^(?:https?:)?\/\/\S+$/i;

			if ( ! editor.selection.isCollapsed() && ! regExp.test( editor.selection.getContent() ) ) {
				pastedStr = pastedStr.replace( /<[^>]+>/g, '' );
				pastedStr = tinymce.trim( pastedStr );

				if ( regExp.test( pastedStr ) ) {
					editor.execCommand( 'mceInsertLink', false, {
						href: editor.dom.decode( pastedStr )
					} );

					event.preventDefault();
				}
			}
		} );

		editor.addButton( 'wp_link_preview', {
			type: 'WPLinkPreview',
			onPostRender: function() {
				var self = this;

				editor.on( 'wptoolbar', function( event ) {
					var anchor = editor.dom.getParent( event.element, 'a' ),
						$anchor,
						href;

					if ( anchor ) {
						$anchor = editor.$( anchor );
						href = $anchor.attr( 'href' );

						if ( href && ! $anchor.find( 'img' ).length ) {
							self.setURL( href );
							event.element = anchor;
							event.toolbar = toolbar;
						}
					}
				} );
			}
		} );

		editor.addButton( 'wp_link_edit', {
			tooltip: 'Edit ', // trailing space is needed, used for context
			icon: 'dashicon dashicons-edit',
			cmd: 'WP_Link'
		} );

		editor.addButton( 'wp_link_remove', {
			tooltip: 'Remove',
			icon: 'dashicon dashicons-no',
			cmd: 'unlink'
		} );

		editor.on( 'preinit', function() {
			toolbar = editor.wp._createToolbar( [
				'wp_link_preview',
				'wp_link_edit',
				'wp_link_remove'
			], true );
		} );
	} );
} )( window.tinymce );


text:
from django.conf import settings
from django.contrib.auth.models import User
import factory

import website.models
import ml.models  # import Db, Query, QueryDefault
import cron.models  # import Job, EmailUser

class TagsFactory(factory.DjangoModelFactory):
    class Meta:
        abstract = True

    @factory.post_generation
    def tags(self, create, extracted):
        if create and extracted:
            self.tags.add(*extracted)

class UserFactory(factory.DjangoModelFactory):
    class Meta:
        model = User

    username = factory.Sequence(lambda x: "user{}".format(x))
    email = factory.Sequence(lambda x: "user{}@example.com".format(x))
    password = factory.PostGenerationMethodCall('set_password', "password")

class DbFactory(TagsFactory):
    class Meta:
        model = website.models.Db
        exclude = ('DB',)

    DB = settings.DATABASES['default']
    name_short = "default"
    name_long = "default"
    type = "MySQL"
    host = factory.LazyAttribute(lambda a: a.DB['HOST'])
    db = factory.LazyAttribute(lambda a: a.DB['NAME'])
    port = factory.LazyAttribute(lambda a: a.DB['PORT'] or "3306")
    username = factory.LazyAttribute(lambda a: a.DB['USER'])
    password_encrypted = factory.LazyAttribute(lambda a: a.DB['PASSWORD'])

class QueryFactory(TagsFactory):
    class Meta:
        model = website.models.Query

    title = "title"
    description = "description"
    db = factory.SubFactory(DbFactory)
    owner = factory.SubFactory(UserFactory)
    graph_extra = "{}"
    query_text = "select username, last_login from auth_user"
    pivot_data = False
    insert_limit = True

class MlFactory(factory.django.DjangoModelFactory):
    class Meta:
        model = ml.models.machine_learning_model
    query = factory.SubFactory(QueryFactory)
    title = 'title'
    type = 'logistic'
    target_column = 'username'

class DashboardFactory(TagsFactory):
    class Meta:
        model = website.models.Dashboard

    title = 'title'
    description = ''
    description_long = ''
    owner = factory.SubFactory(User)

class DashboardQueryFactory(factory.django.DjangoModelFactory):
    class Meta:
        model = website.models.DashboardQuery
    query = factory.SubFactory(QueryFactory)
    dashboard = factory.SubFactory(DashboardFactory)

class QueryDefaultFactory(factory.django.DjangoModelFactory):
    class Meta:
        model = website.models.QueryDefault
    query = factory.SubFactory(QueryFactory)
    search_for = "<DEFAULT>"
    replace_with = ""
    data_type = 'String'

class JobFactory(factory.django.DjangoModelFactory):
    class Meta:
        model = cron.models.Job
    owner = factory.SubFactory(UserFactory)
    dashboard = factory.SubFactory(DashboardFactory)
    type = 'daily'

class EmailUserFactory(factory.django.DjangoModelFactory):
    class Meta:
        model = cron.models.EmailUser
    job = factory.SubFactory(JobFactory)
    user = factory.SubFactory(UserFactory)

class QueryPrecedentFactory(factory.django.DjangoModelFactory):
    class Meta:
        model = website.models.QueryPrecedent
    final_query = factory.SubFactory(QueryFactory)
    preceding_query = factory.SubFactory(QueryFactory)


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

<title>infodynamics.measures.continuous.kernel</title>
<meta name="date" content="2015-02-12">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Package

Next Package

Frames

No Frames

All Classes

Package infodynamics.measures.continuous.kernel

This package contains estimators for the
 information dynamics measures which
 use box-kernel estimation.

See: Description

Class Summary

Class
Description

ActiveInfoStorageCalculatorKernel

An Active Information Storage (AIS) calculator (implementing ActiveInfoStorageCalculator)
 which is affected using a
 box-kernel Mutual Information (MI) calculator
 (MutualInfoCalculatorMultiVariateKernel) to make the calculations.

EntropyCalculatorKernel

Computes the differential entropy of a given set of observations
  (implementing EntropyCalculator, using box-kernel estimation.

EntropyCalculatorMultiVariateKernel

Computes the differential entropy of a given set of observations
  (implementing EntropyCalculatorMultiVariate, using box-kernel estimation.

KernelCount

Structure to hold a kernel count, the total count it was taken from,
  and an array of booleans indicating which time points got counted.

KernelEstimatorMultiVariate

Class to maintain probability distribution function for
  a multivariate set, using kernel estimates.

KernelEstimatorTransferEntropy

Kernel estimator for computing PDFs ready for the transfer entropy.

KernelEstimatorTransferEntropyMultiVariate

Kernel estimator for use with the transfer entropy on
 multivariate source and destination.

KernelEstimatorUniVariate

Class to maintain probability distribution function for
  a single variable, using kernel estimates.

MultiInfoCalculatorKernel

Computes the differential multi-information of a given multivariate set of
  observations (implementing MultiInfoCalculator),
  using box-kernel estimation.

MutualInfoCalculatorMultiVariateKernel

Computes the differential mutual information of two given multivariate sets of
  observations (implementing MutualInfoCalculatorMultiVariate),
  using box-kernel estimation.

PredictiveInfoCalculatorKernel

A Predictive Information (PI) / Excess Entropy calculator
 (implementing PredictiveInfoCalculator)
 which is affected using a
 box-kernel Mutual Information (MI) calculator
 (MutualInfoCalculatorMultiVariateKernel) to make the calculations.

TransferEntropyCalculatorKernel

Computes the differential transfer entropy (TE) between two univariate
  double[] time-series of observations
  using box-kernel estimation.

TransferEntropyCalculatorKernelPlain

Computes the differential transfer entropy (TE) between two uniivariate
  double[] time-series of observations
  using box-kernel estimation.

TransferEntropyCalculatorKernelPlainIterators

TransferEntropyCalculatorKernelSeparate

Computes the differential transfer entropy (TE) between two uniivariate
  double[] time-series of observations
  using box-kernel estimation.

TransferEntropyCalculatorMultiVariateKernel

Computes the differential transfer entropy (TE) between two multivariate
  double[][] time-series of observations
  using box-kernel estimation.

TransferEntropyCalculatorMultiVariateSingleObservationsKernel

 Extends TransferEntropyCalculatorMultiVariateKernel for
 computing the differential transfer entropy (TE) between two multivariate
  double[][] time-series of observations
  using box-kernel estimation.

TransferEntropyKernelCounts

Structure to hold the results of the box-kernel
  estimation counts for one sample point.

Package infodynamics.measures.continuous.kernel Description

This package contains estimators for the
 information dynamics measures which
 use box-kernel estimation.

These estimators apply to continuous data
 (i.e. double[] or double[][] data).

Author:

Joseph Lizier (email,
 www)

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Package

Next Package

Frames

No Frames

All Classes


text:
package org.apache.mesos.wildfly.common;

import com.google.common.io.ByteStreams;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URI;
import org.codehaus.jackson.map.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author jzajic
 */
public class UrlMesosWidlflyConfigProvider implements MesosWidlflyConfigProvider
{

    private final Logger log = LoggerFactory.getLogger(UrlMesosWidlflyConfigProvider.class);

    private URI remoteUrl;
    private URI url;
    private boolean cache = true;
    private ObjectMapper mapper;

    public UrlMesosWidlflyConfigProvider(URI url)
    {
        this.remoteUrl = url;
        this.mapper = new ObjectMapper();
        if(cache && url != null)
        {
            this.url = cacheUrl(remoteUrl);
        } else {
            this.url = remoteUrl;
        }
    }

    @Override
    public MesosWidlflyConfig getConfiguration()
    {
        try {
            return mapper.readValue(url.toURL(), MesosWidlflyConfig.class);
        } catch(IOException e) {
            throw new IllegalStateException("", e);
        }
    }

    public void reload()
    {
        if(cache && url != null)
            this.url = cacheUrl(remoteUrl);
        else
            this.url = remoteUrl;
    }

    private URI cacheUrl(URI remoteUrl)
    {
        try {
            //create a temp file
            File temp = File.createTempFile(MesosWildFlyConstants.CONFIG_TEMP_FILE, ".tmp");
            //write it
    	    try(InputStream in = remoteUrl.toURL().openStream();
                OutputStream out = new FileOutputStream(temp);)
            {
                ByteStreams.copy(in, out);
            }
            return temp.toURI();
        } catch(IOException e) {
            throw new IllegalStateException("", e);
        }
    }

}


text:
package com.github.antennaesdk.server.messages;

import com.google.gson.Gson;
import com.github.antennaesdk.common.messages.ServerMessage;

/**
 * ServerMessageWrapper encapsulates a ServerMessage on the server + messaging-broker side.
 * It contains additional data to identify the broker-node that has the persistent connection to the client.
 *
 * @see ServerMessage
 */
public class ServerMessageWrapper {

    private ServerMessage serverMessage;

    // these identify the nodeId + sessionId that has the persistent connection to the client
    // if these are null, then a discovery needs to be made
    private String sessionId;
    private String nodeId;

    // utility methods
    public String toJson(){
        Gson gson = new Gson();
        String result = gson.toJson(this);
        return result;
    }
    public static ServerMessageWrapper fromJson(String value ){
        Gson gson = new Gson();
        ServerMessageWrapper message = gson.fromJson( value, ServerMessageWrapper.class);
        return message;
    }

    // getters and setters
    public ServerMessage getServerMessage() {
        return serverMessage;
    }
    public void setServerMessage(ServerMessage serverMessage) {
        this.serverMessage = serverMessage;
    }
    public String getSessionId() {
        return sessionId;
    }
    public void setSessionId(String sessionId) {
        this.sessionId = sessionId;
    }
    public String getNodeId() {
        return nodeId;
    }
    public void setNodeId(String nodeId) {
        this.nodeId = nodeId;
    }
}


text:
@class CustomLocationManager;
@protocol CustomLocationManagerDelegate <NSObject>

- (void)locationManager:(CustomLocationManager *)locationManager didGetLocationWithLatitude:(double)latitude andLongigtude:(double)longitude;
- (void)locationManagerDidFailFetchingLocation:(CustomLocationManager *)locationManager;

@end

@interface CustomLocationManager : CLLocationManager

@property (weak, nonatomic) id<CustomLocationManagerDelegate> customManagerDelegate;

- (void)getLocation;

@end


text:
"""
Configurations related to HackLime Package

Author  : Pravendra Singh (pravj)
Contact : hackpravj@gmail.com (https://pravj.github.io)
"""

# HackerEarth API endpoints
compile_point = 'http://api.hackerearth.com/code/compile/'
run_point = 'http://api.hackerearth.com/code/run/'

# your client secret key, needed to work with API
# you can get one, here : http://www.hackerearth.com/api/register/
client_secret = 'xxxxxxxxxxxxxxxxxxxx'

# time-limit(in seconds) : max time for which program is allowed to run
time_limit = 5

# memory-limit(in MB) : max memory allowed to be used by the program
memory_limit = 262144

# the way in API works, by Default its synchronous
async = 0


text:
package com.google.common.collect;

import com.google.common.base.Function;
import com.google.common.testing.ForwardingWrapperTester;
import java.util.ListIterator;
import junit.framework.TestCase;

/**
 * Tests for {@code ForwardingListIterator}.
 *
 * @author Robert Konigsberg
 */
public class ForwardingListIteratorTest extends TestCase {

  @SuppressWarnings("rawtypes")
  public void testForwarding() {
    new ForwardingWrapperTester()
        .testForwarding(ListIterator.class, new Function<ListIterator, ListIterator>() {
          @Override public ListIterator apply(ListIterator delegate) {
            return wrap(delegate);
          }
        });
  }

  private static <T> ListIterator<T> wrap(final ListIterator<T> delegate) {
    return new ForwardingListIterator<T>() {
      @Override protected ListIterator<T> delegate() {
        return delegate;
      }
    };
  }
}


text:
void add_clocks(unsigned clocks);
void timer_262144hz();
void timer_65536hz();
void timer_16384hz();
void timer_8192hz();
void timer_4096hz();
void hblank();

//opcode.cpp
void op_io();
uint8 op_read(uint16 addr);
void op_write(uint16 addr, uint8 data);
void cycle_edge();


text:
ActiveRecord::Schema.define(:version => 0) do
  create_table :bikes, :force => true do |t|
    t.string :manufacturer
    t.string :model
  end
  create_table :insults, :force => true do |t|
    t.string :content
    t.integer :offensiveness
  end
end


text:
namespace cc {

UIResourceManager::UIResourceManager() : next_ui_resource_id_(1) {}

UIResourceManager::~UIResourceManager() = default;

UIResourceId UIResourceManager::CreateUIResource(UIResourceClient* client) {
  DCHECK(client);

  UIResourceId next_id = next_ui_resource_id_++;
  DCHECK(ui_resource_client_map_.find(next_id) ==
         ui_resource_client_map_.end());

  bool resource_lost = false;
  UIResourceRequest request(UIResourceRequest::UI_RESOURCE_CREATE, next_id,
                            client->GetBitmap(next_id, resource_lost));
  ui_resource_request_queue_.push_back(request);

  UIResourceClientData data;
  data.client = client;
  data.size = request.GetBitmap().GetSize();

  ui_resource_client_map_[request.GetId()] = data;
  return request.GetId();
}

void UIResourceManager::DeleteUIResource(UIResourceId uid) {
  const auto iter = ui_resource_client_map_.find(uid);
  if (iter == ui_resource_client_map_.end())
    return;

  UIResourceRequest request(UIResourceRequest::UI_RESOURCE_DELETE, uid);
  ui_resource_request_queue_.push_back(request);
  ui_resource_client_map_.erase(iter);
}

void UIResourceManager::RecreateUIResources() {
  for (const auto& resource : ui_resource_client_map_) {
    UIResourceId uid = resource.first;
    const UIResourceClientData& data = resource.second;
    bool resource_lost = true;
    if (!base::Contains(ui_resource_request_queue_, uid,
                        &UIResourceRequest::GetId)) {
      UIResourceRequest request(UIResourceRequest::UI_RESOURCE_CREATE, uid,
                                data.client->GetBitmap(uid, resource_lost));
      ui_resource_request_queue_.push_back(request);
    }
  }
}

base::flat_map<UIResourceId, gfx::Size> UIResourceManager::GetUIResourceSizes()
    const {
  base::flat_map<UIResourceId, gfx::Size>::container_type items(
      ui_resource_client_map_.size());
  for (const auto pair : ui_resource_client_map_)
    items.push_back({pair.first, pair.second.size});
  return base::flat_map<UIResourceId, gfx::Size>(std::move(items));
}

std::vector<UIResourceRequest> UIResourceManager::TakeUIResourcesRequests() {
  UIResourceRequestQueue result;
  result.swap(ui_resource_request_queue_);
  return result;
}

UIResourceId UIResourceManager::GetOrCreateUIResource(const SkBitmap& bitmap) {
  DCHECK(bitmap.pixelRef()->isImmutable());
  const auto resource = owned_shared_resources_.find(bitmap.pixelRef());
  if (resource != owned_shared_resources_.end())
    return resource->second->id();

  // Evict all UIResources whose bitmaps are no longer referenced outside of the
  // map.
  base::EraseIf(owned_shared_resources_,
                [](auto& pair) { return pair.second->IsUniquelyOwned(); });

  // Max capacity of `owned_shared_resources_`. A DCHECK() would fire if cache
  // size after eviction does not fall below the limit. 256 is an arbitrarily
  // chosen number that is greater than the max number of images we expect to
  // ever use concurrently.
  constexpr size_t kMaxSkBitmapResources = 256u;
  DCHECK_LT(owned_shared_resources_.size(), kMaxSkBitmapResources);

  auto scoped_resource =
      ScopedUIResource::Create(this, UIResourceBitmap(bitmap));
  auto id = scoped_resource->id();
  owned_shared_resources_[bitmap.pixelRef()] = std::move(scoped_resource);
  return id;
}

}  // namespace cc


text:
cd $(dirname $0)/docker-compose-kubernetes/
./kube-up.sh


text:
props:
  hashtags: '#100daysofcode #programmer #developer #hacking #markdown #Productivity #indiehackers #blogger'
computed:
  date: (new Date()).toDateString()
  time: (new Date()).toLocaleTimeString()
  timestamp: (new Date()).toISOString()
template: | # This is the template for new cards that are created in imdone

  <!-- created:${timestamp} -->
  <!--[[{{source.path}}:{{line}}]({{source.path}}:{{line}}) ]-->
  <!-- expand:1 -->
links:
  - pack: fab # Can be fab or fas https://fontawesome.com/how-to-use/on-the-web/referencing-icons/basic-use
    icon: fa-twitter # The font-awesome icon to use
    title: Tweet this card
    href: https://twitter.com/intent/tweet?text=${encodedText}%0ATweeted%20with%20@imdoneio
---

# [Fix filter by meta.created](#DONE:5)
```javascript
meta.created = "2020-09-29T20:10:26.659Z"
```
<!-- created:2020-11-24T02:07:08.096Z -->
<!--[[{{source.path}}:{{line}}]({{source.path}}:{{line}}) ]-->
<!-- expand:1 completed:2021-01-28T15:17:17.188Z -->


text:
/* $NetBSD: satafisvar.h,v 1.3 2010/04/07 17:51:16 jakllsch Exp $ */

/*
 * Copyright (c) 2009, 2010 Jonathan A. Kollasch.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. 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.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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.
 */

#ifndef _DEV_ATA_FISVAR_H_
#define _DEV_ATA_FISVAR_H_

#include <dev/ata/atavar.h>

void satafis_rhd_construct_cmd(struct ata_command *, uint8_t *);
void satafis_rhd_construct_bio(struct ata_xfer *, uint8_t *);
void satafis_rhd_construct_atapi(struct ata_xfer *, uint8_t *);

void satafis_rdh_parse(struct ata_channel *, const uint8_t *);
void satafis_rdh_cmd_readreg(struct ata_command *, const uint8_t *);

#endif /* _DEV_ATA_FISVAR_H_ */


text:
/* FFTW-MPI internal header file */
#ifndef __IFFTW_MPI_H__
#define __IFFTW_MPI_H__

#include "ifftw.h"
#include "rdft.h"

#include <mpi.h>

/* mpi problem flags: problem-dependent meaning, but in general
   SCRAMBLED means some reordering *within* the dimensions, while
   TRANSPOSED means some reordering *of* the dimensions */
#define SCRAMBLED_IN (1 << 0)
#define SCRAMBLED_OUT (1 << 1)
#define TRANSPOSED_IN (1 << 2)
#define TRANSPOSED_OUT (1 << 3)
#define RANK1_BIGVEC_ONLY (1 << 4) /* for rank=1, allow only bigvec solver */

#define ONLY_SCRAMBLEDP(flags) (!((flags) & ~(SCRAMBLED_IN|SCRAMBLED_OUT)))
#define ONLY_TRANSPOSEDP(flags) (!((flags) & ~(TRANSPOSED_IN|TRANSPOSED_OUT)))

#if defined(FFTW_SINGLE)
#  define FFTW_MPI_TYPE MPI_FLOAT
#elif defined(FFTW_LDOUBLE)
#  define FFTW_MPI_TYPE MPI_LONG_DOUBLE
#else
#  define FFTW_MPI_TYPE MPI_DOUBLE
#endif

/* all fftw-mpi identifiers start with fftw_mpi (or fftwf_mpi etc.) */
#define XM(name) X(CONCAT(mpi_, name))

/***********************************************************************/
/* block distributions */

/* a distributed dimension of length n with input and output block
   sizes ib and ob, respectively. */
typedef enum { IB = 0, OB } block_kind;
typedef struct {
     INT n;
     INT b[2]; /* b[IB], b[OB] */
} ddim;

/* unlike tensors in the serial FFTW, the ordering of the dtensor
   dimensions matters - both the array and the block layout are
   row-major order. */
typedef struct {
     int rnk;
#if defined(STRUCT_HACK_KR)
     ddim dims[1];
#elif defined(STRUCT_HACK_C99)
     ddim dims[];
#else
     ddim *dims;
#endif
} dtensor;

/* dtensor.c: */
dtensor *XM(mkdtensor)(int rnk);
void XM(dtensor_destroy)(dtensor *sz);
dtensor *XM(dtensor_copy)(const dtensor *sz);
dtensor *XM(dtensor_canonical)(const dtensor *sz, int compress);
int XM(dtensor_validp)(const dtensor *sz);
void XM(dtensor_md5)(md5 *p, const dtensor *t);
void XM(dtensor_print)(const dtensor *t, printer *p);

/* block.c: */

/* for a single distributed dimension: */
INT XM(num_blocks)(INT n, INT block);
int XM(num_blocks_ok)(INT n, INT block, MPI_Comm comm);
INT XM(default_block)(INT n, int n_pes);
INT XM(block)(INT n, INT block, int which_block);

/* for multiple distributed dimensions: */
INT XM(num_blocks_total)(const dtensor *sz, block_kind k);
int XM(idle_process)(const dtensor *sz, block_kind k, int which_pe);
void XM(block_coords)(const dtensor *sz, block_kind k, int which_pe,
		     INT *coords);
INT XM(total_block)(const dtensor *sz, block_kind k, int which_pe);
int XM(is_local_after)(int dim, const dtensor *sz, block_kind k);
int XM(is_local)(const dtensor *sz, block_kind k);
int XM(is_block1d)(const dtensor *sz, block_kind k);

/* choose-radix.c */
INT XM(choose_radix)(ddim d, int n_pes, unsigned flags, int sign,
                     INT rblock[2], INT mblock[2]);

/***********************************************************************/
/* any_true.c */
int XM(any_true)(int condition, MPI_Comm comm);

/* conf.c */
void XM(conf_standard)(planner *p);

/***********************************************************************/
/* rearrange.c */

/* Different ways to rearrange the vector dimension vn during transposition,
   reflecting different tradeoffs between ease of transposition and
   contiguity during the subsequent DFTs.

   TODO: can we pare this down to CONTIG and DISCONTIG, at least
   in MEASURE mode?  SQUARE_MIDDLE is also used for 1d destroy-input DFTs. */
typedef enum {
     CONTIG = 0, /* vn x 1: make subsequent DFTs contiguous */
     DISCONTIG, /* P x (vn/P) for P processes */
     SQUARE_BEFORE, /* try to get square transpose at beginning */
     SQUARE_MIDDLE, /* try to get square transpose in the middle */
     SQUARE_AFTER /* try to get square transpose at end */
} rearrangement;

/* skipping SQUARE_AFTER since it doesn't seem to offer any advantage
   over SQUARE_BEFORE */
#define FORALL_REARRANGE(rearrange) for (rearrange = CONTIG; rearrange <= SQUARE_MIDDLE; ++rearrange)

int XM(rearrange_applicable)(rearrangement rearrange,
			     ddim dim0, INT vn, int n_pes);
INT XM(rearrange_ny)(rearrangement rearrange, ddim dim0, INT vn, int n_pes);

/***********************************************************************/

#endif /* __IFFTW_MPI_H__ */


text:
package com.evolveum.midpoint.provisioning.api;

import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.delta.ObjectDelta;
import com.evolveum.midpoint.schema.util.ShadowUtil;
import com.evolveum.midpoint.schema.util.SchemaDebugUtil;
import com.evolveum.midpoint.schema.util.ObjectTypeUtil;
import com.evolveum.midpoint.util.DebugDumpable;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType;

import java.io.Serializable;

/**
 * Describes a change of a specific resource object together with definitions of the source and possibly
 * also other information. This is useful to completely describe a change that was detected on the resource.
 * <p/>
 * This object can describe either relative change or new absolute state. In case of relative change the "objectDelta"
 * property will be provided. In case of description of new absolute state the "currentShadow" value will be provided.
 * It may happen that both of them will be provided if both are known (and efficiently detected). In such a case the
 * implementation may choose any one to process.
 *
 * @author Radovan Semancik
 */
public class ResourceObjectShadowChangeDescription implements DebugDumpable, Serializable {

    private ObjectDelta<? extends ShadowType> objectDelta;
    private PrismObject<? extends ShadowType> currentShadow;
    private PrismObject<? extends ShadowType> oldShadow;
    private String sourceChannel;
    private PrismObject<ResourceType> resource;

    public ObjectDelta<? extends ShadowType> getObjectDelta() {
        return objectDelta;
    }

    public void setObjectDelta(ObjectDelta<? extends ShadowType> objectDelta) {
        this.objectDelta = objectDelta;
    }

    public PrismObject<? extends ShadowType> getCurrentShadow() {
        return currentShadow;
    }

    public void setCurrentShadow(PrismObject<? extends ShadowType> currentShadow) {
        this.currentShadow = currentShadow;
    }

    public PrismObject<? extends ShadowType> getOldShadow() {
        return oldShadow;
    }

    public void setOldShadow(PrismObject<? extends ShadowType> oldShadow) {
        this.oldShadow = oldShadow;
    }

    public String getSourceChannel() {
        return sourceChannel;
    }

    public void setSourceChannel(String sourceChannel) {
        this.sourceChannel = sourceChannel;
    }

    public PrismObject<ResourceType> getResource() {
        return resource;
    }

    public void setResource(PrismObject<ResourceType> resource) {
        this.resource = resource;
    }

    public void checkConsistence() {
    	if (resource == null) {
    		throw new IllegalArgumentException("No resource in "+this.getClass().getSimpleName());
    	}
    	resource.checkConsistence();
    	if (sourceChannel == null) {
    		throw new IllegalArgumentException("No sourceChannel in "+this.getClass().getSimpleName());
    	}
    	if (objectDelta == null && currentShadow == null) {
    		throw new IllegalArgumentException("Either objectDelta or currentShadow must be set in "+this.getClass().getSimpleName());
    	}
    	if (objectDelta != null && objectDelta.getOid() == null) {
    		throw new IllegalArgumentException("Delta OID not set in "+this.getClass().getSimpleName());
    	}
    	if (objectDelta != null) {
    		objectDelta.checkConsistence();
    	}
    	if (currentShadow != null && currentShadow.getOid() == null) {
    		throw new IllegalArgumentException("Current shadow OID not set in "+this.getClass().getSimpleName());
    	}
    	if (currentShadow != null) {
    		ShadowUtil.checkConsistence(currentShadow,"current shadow in change notification");
    	}
    	if (oldShadow != null) {
    		ShadowUtil.checkConsistence(oldShadow,"old shadow in change notification");
    	}
    }

    public boolean isProtected() {
    	if ((currentShadow != null && ShadowUtil.isProtected(currentShadow))
    			|| (oldShadow != null && ShadowUtil.isProtected(oldShadow))) {
    		return true;
    	}
    	if (objectDelta != null && objectDelta.isAdd() && ShadowUtil.isProtected(objectDelta.getObjectToAdd())) {
    		return true;
    	}
    	return false;
    }

	@Override
	public String toString() {
		return "ResourceObjectShadowChangeDescription(objectDelta=" + objectDelta + ", currentShadow="
				+ SchemaDebugUtil.prettyPrint(currentShadow) + ", oldShadow=" + SchemaDebugUtil.prettyPrint(oldShadow) + ", sourceChannel=" + sourceChannel
				+ ", resource=" + resource + ")";
	}

	/* (non-Javadoc)
	 * @see com.evolveum.midpoint.util.DebugDumpable#debugDump()
	 */
	@Override
	public String debugDump() {
		return debugDump(0);
	}

	/* (non-Javadoc)
	 * @see com.evolveum.midpoint.util.DebugDumpable#debugDump(int)
	 */
	@Override
	public String debugDump(int indent) {
		StringBuilder sb = new StringBuilder();
		SchemaDebugUtil.indentDebugDump(sb, indent);
		sb.append("ResourceObjectShadowChangeDescription(");
		sb.append(sourceChannel);
		sb.append(")\n");

		SchemaDebugUtil.indentDebugDump(sb, indent+1);
		sb.append("resource:");
		if (resource == null) {
			sb.append(" null");
		} else {
			sb.append(resource);
		}

		sb.append("\n");
		SchemaDebugUtil.indentDebugDump(sb, indent+1);

		sb.append("objectDelta:");
		if (objectDelta == null) {
			sb.append(" null");
		} else {
			sb.append(objectDelta.debugDump(indent+2));
		}
		sb.append("\n");
		SchemaDebugUtil.indentDebugDump(sb, indent+1);

		sb.append("oldShadow:");
		if (oldShadow == null) {
			sb.append(" null");
		} else {
			sb.append(oldShadow.debugDump(indent+2));
		}

		sb.append("\n");
		SchemaDebugUtil.indentDebugDump(sb, indent+1);

		sb.append("currentShadow:");
		if (currentShadow == null) {
			sb.append(" null\n");
		} else {
			sb.append("\n");
			sb.append(currentShadow.debugDump(indent+2));
		}

		return sb.toString();
	}

}


text:
<?php

namespace IPS\Helpers\Form;

/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
	header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
	exit;
}

/* @todo limit by container IDs */

/**
 * Content Item selector
 */
class _Item extends FormAbstract
{
	/**
	 * @brief	Default Options
	 * @code
	 	$defaultOptions = array(
	 		'class'				=> '\IPS\core\Foo',				// The \Content\Item class
	 		'permissionCheck'	=> 'read',						// If a permission key is provided, only content items that the member has that permission for will be available.
	 		'maxItems'			=> NULL,						// Maximum items allowed to select, or NULL for unlimited
	        'orderResults'      => NULL|array                   // NULL or array( field, 'asc' ) where field is a mappable content item field (date, title, etc)
	        'itemTemplate'      => NULL                         // NULL or array of template group and template name array( \IPS\Theme::i()->getTemplate( 'group', 'app', 'location'), 'name' )
			'containerIds'      => array                        // Array of container IDs to limit the search
	        'minAjaxLength'     => int                          // Number of characters to type before selector appears
	 *      'where'             => array                        // Array of additional where array( array( 'foo=?', 1 ) )
	 * );
	 * @encode
	 */
	protected $defaultOptions = array(
		'class'				=> NULL,
		'permissionCheck'   => 'read',
		'maxItems'      	=> NULL,
		'orderResults'      => NULL,
		'itemTemplate'      => NULL,
		'containerIds'      => array(),
		'minAjaxLength'     => 3,
		'where'             => array()
	);

	/**
	 * Constructor
	 *
	 * @return	void
	 */
	public function __construct()
	{
		call_user_func_array( 'parent::__construct', func_get_args() );
	}

	/**
	 * Get HTML
	 *
	 * @return	string
	 */
	public function html()
	{
		/* Display */
		$url = \IPS\Request::i()->url()->setQueryString( '_itemSelectName', $this->name );

		$template = NULL;
		if ( $this->options['itemTemplate'] === NULL )
		{
			$template = array( \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' ), 'itemResult' );
		}

		/* Are we getting some AJAX stuff? */
		if ( isset( \IPS\Request::i()->_itemSelectName ) and \IPS\Request::i()->_itemSelectName === $this->name )
		{
			$results = array();
			$class   = $this->options['class'];
			$field   = $class::$databaseTable . '.' . $class::$databasePrefix . $class::$databaseColumnMap['title'];
			$where   = array( array( $field . " LIKE CONCAT('%', ?, '%')", \IPS\Request::i()->q ) );
			$idField = $class::$databaseColumnId;
			if ( isset( $class::$databaseColumnMap['container'] ) and is_array( $this->options['containerIds'] ) and count( $this->options['containerIds'] ) )
			{
				$where[] = array( \IPS\Db::i()->in( $class::$databasePrefix . $class::$databaseColumnMap['container'], $this->options['containerIds'] ) );
			}

			if ( isset( $this->options['where'] ) and count( $this->options['where'] ) )
			{
				$where = array_merge( $where, $this->options['where'] );
			}

			foreach( $class::getItemsWithPermission( $where, 'LENGTH(' . $field . ') ASC', array( 0, 20 ), $this->options['permissionCheck'] ) as $item )
			{
				$results[] = array(
					'id'	=> $item->$idField,
					'html'  => call_user_func( $template, $item )
				);
			}

			\IPS\Output::i()->json( $results );
		}

		return \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' )->item( $this->name, $this->value, $this->options['maxItems'], $this->options['minAjaxLength'], $url, $template );
	}

	/**
	 * Get Value
	 *
	 * @return	mixed
	 */
	public function getValue()
	{
		$name = $this->name . '_values';
		if ( isset( \IPS\Request::i()->$name ) )
		{
			return explode( ',', \IPS\Request::i()->$name );
		}
		else
		{
			return array();
		}
	}

	/**
	 * Format Value
	 *
	 * @return	\IPS\Node\Model|array|NULL
	 */
	public function formatValue()
	{
		$itemClass = $this->options['class'];
		$order     = NULL;
		$items     = array();

		if ( ! $this->value )
		{
			$this->value = array();
		}
		else
		{
			$this->value = ( is_string( $this->value ) ) ? explode( ',', $this->value ) : $this->value;
		}

		if ( count( $this->value ) )
		{
			if ( is_array( $this->options['orderResults'] ) )
			{
				if ( isset( $itemClass::$databaseColumnMap[ $this->options['orderResults'][0] ] ) )
				{
					$order = $itemClass::$databaseColumnMap[ $this->options['orderResults'][0] ] . ' ' . $this->options['orderResults'][1];
				}
			}

			$where = array( \IPS\Db::i()->in( $itemClass::$databaseColumnId, $this->value ) );
			foreach( $itemClass::getItemsWithPermission( array( $where ), $order, NULL, $this->options['permissionCheck'] ) as $item )
			{
				$items[ $item->_id ] = $item;
			}
		}

		$this->value = $items;

		return $this->value;
	}

	/**
	 * String Value
	 *
	 * @param	mixed	$value	The value
	 * @return	string
	 */
	public static function stringValue( $value )
	{
		if ( is_array( $value ) )
		{
			return implode( ',', array_keys( $value ) );
		}
		elseif ( is_object( $value ) )
		{
			return $value->_id;
		}
		return (string) $value;
	}
	/**
	 * Validate
	 *
	 * @throws	\InvalidArgumentException
	 * @return	TRUE
	 */
	public function validate()
	{
		if( empty( $this->value ) and $this->required )
		{
			throw new \InvalidArgumentException('form_required');
		}

		parent::validate();
	}
}


text:
<?xml version="1.0" encoding="UTF-8"?>

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>{{url_for('welcome', _external=True)}}</loc>
    <lastmod>{{lastmod}}</lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.8</priority>
  </url>
  <url>
    <loc>{{url_for('feedback', _external=True)}}</loc>
    <lastmod>{{lastmod}}</lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.8</priority>
  </url>

  <url>
    <loc>{{url_for('what', _external=True)}}</loc>
    <lastmod>{{lastmod}}</lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.8</priority>
  </url>
  <url>
    <loc>{{url_for('features', _external=True)}}</loc>
    <lastmod>{{lastmod}}</lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.9</priority>
  </url>
  <url>
    <loc>{{url_for('tutorial', _external=True)}}</loc>
    <lastmod>{{lastmod}}</lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.9</priority>
  </url>
  <url>
    <loc>{{url_for('requirement', _external=True)}}</loc>
    <lastmod>{{lastmod}}</lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.8</priority>
  </url>
  <url>
    <loc>{{url_for('howto', _external=True)}}</loc>
    <lastmod>{{lastmod}}</lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.8</priority>
  </url>
  <url>
    <loc>{{url_for('tree', _external=True)}}</loc>
    <lastmod>{{lastmod}}</lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.8</priority>
  </url>
  <url>
    <loc>{{url_for('reference', _external=True)}}</loc>
    <lastmod>{{lastmod}}</lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.9</priority>
  </url>
  <url>
    <loc>{{url_for('faq', _external=True)}}</loc>
    <lastmod>{{lastmod}}</lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.7</priority>
  </url>
  <url>
    <loc>{{url_for('convention', _external=True)}}</loc>
    <lastmod>{{lastmod}}</lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.8</priority>
  </url>
</urlset>


text:
package com.twitter

/**

Finagle is an extensible RPC system.

Services are represented by class [[com.twitter.finagle.Service]].
Clients make use of [[com.twitter.finagle.Service]] objects while
servers implement them.

Finagle contains a number of protocol implementations; each of these
implement [[com.twitter.finagle.Client Client]] and/or
[[com.twitter.finagle.Server]]. For example, finagle's HTTP implementation,
[[com.twitter.finagle.Http]] (in package `finagle-http`), exposes both.

Thus a simple HTTP server is built like this:

{{{
import com.twitter.finagle.{Http, Service}
import org.jboss.netty.handler.codec.http.{
  HttpRequest, HttpResponse, DefaultHttpResponse}
import org.jboss.netty.handler.codec.http.HttpVersion._
import org.jboss.netty.handler.codec.http.HttpResponseStatus._
import com.twitter.util.{Future, Await}

val service = new Service[HttpRequest, HttpResponse] {
  def apply(req: HttpRequest) =
    Future.value(new DefaultHttpResponse(HTTP_1_1, OK))
}
val server = Http.serve(":8080", service)
Await.ready(server)
}}}

We first define a service to which requests are dispatched. In this case,
the service returns immediately with a HTTP 200 OK response, and with
no content.

This service is then served via the Http protocol on TCP port 8080. Finally
we wait for the server to stop serving.

We can now query our web server:

<pre>
% curl -D - localhost:8080
HTTP/1.1 200 OK

%
</pre>

Building an HTTP client is also simple. (Note that type annotations are
added for illustration.)

{{{
import com.twitter.finagle.{Http, Service}
import org.jboss.netty.handler.codec.http.{
  HttpRequest, HttpResponse, DefaultHttpRequest}
import org.jboss.netty.handler.codec.http.HttpVersion._
import org.jboss.netty.handler.codec.http.HttpMethod._
import com.twitter.util.{Future, Return, Throw}

val client: Service[HttpRequest, HttpResponse] =
  Http.newService("localhost:8080")
val f: Future[HttpResponse] =
  client(new DefaultHttpRequest(HTTP_1_1, GET, "/"))
f respond {
  case Return(res) =>
    printf("Got HTTP response %s\n", res)
  case Throw(exc) =>
    printf("Got error %s\n", exc)
}
}}}

`Http.newService("localhost:8080")` constructs a new
[[com.twitter.finagle.Service]] instance connected to
localhost TCP port 8080. We then issue a HTTP/1.1 GET
request to URI "/". The service returns a [[com.twitter.util.Future]]
representing the result of the operation. We listen to
this future, printing an appropriate message when the
response arrives.

The [[http://twitter.github.io/finagle/ Finagle homepage]] contains
useful documentation and resources for using Finagle.

 */
package object finagle {
  /**
   * Defines common [[com.twitter.finagle.Stack.Param]]'s shared between
   * finagle clients and servers.
   *
   * TODO: consider moving these params into their own subdirectory and
   * package object.
   *
   * @define param A class eligible for configuring
   */
  object param {
    /**
     * $param a label used to identify finagle clients and servers.
     */
    case class Label(label: String)
    implicit object Label extends Stack.Param[Label] {
      val default = Label("")
    }

    /**
     * $param a [[com.twitter.util.Timer]] used throughout finagle clients
     * and servers.
     */
    case class Timer(timer: com.twitter.util.Timer)
    implicit object Timer extends Stack.Param[Timer] {
      val default = Timer(util.DefaultTimer.twitter)
    }

    /**
     * $param a java.util.logging.Logger used throughout finagle
     * clients and servers.
     */
    case class Logger(log: java.util.logging.Logger)
    implicit object Logger extends Stack.Param[Logger] {
      val default = Logger(util.DefaultLogger)
    }

    /**
     * $param a [[com.twitter.finagle.stats.StatsReceiver]] throughout finagle
     * clients and servers.
     */
    case class Stats(statsReceiver: stats.StatsReceiver)
    implicit object Stats extends Stack.Param[Stats] {
      // Note, this is lazy to avoid potential failures during
      // static initialization.
      lazy val default = Stats(stats.DefaultStatsReceiver)
    }

    /**
     * $param a [[com.twitter.util.Monitor]] throughout finagle servers
     * and clients.
     */
    case class Monitor(monitor: com.twitter.util.Monitor)
    implicit object Monitor extends Stack.Param[Monitor] {
      // Note, this is lazy to avoid potential failures during
      // static initialization.
      lazy val default = Monitor(util.DefaultMonitor)
    }

    /**
     * $param a [[com.twitter.util.ReporterFactory]] throughout finagle servers
     * and clients.
     */
    case class Reporter(reporter: util.ReporterFactory)
    implicit object Reporter extends Stack.Param[Reporter] {
      // Note, this is lazy to avoid potential failures during
      // static initialization.
      lazy val default = Reporter(util.LoadedReporterFactory)
    }

    /**
     * $param a [[com.twitter.finagle.tracing.Tracer]] throughout finagle servers
     * and clients.
     */
    case class Tracer(tracer: tracing.Tracer)
    implicit object Tracer extends Stack.Param[Tracer] {
      // Note, this is lazy to avoid potential failures during
      // static initialization.
      lazy val default = Tracer(tracing.DefaultTracer)
    }
  }

  object stack {
    object Endpoint extends Stack.Role("Endpoint")
    /**
     * Creates a [[com.twitter.finagle.Stack.Leaf]] which always fails.
     */
    def nilStack[Req, Rep]: Stack[ServiceFactory[Req, Rep]] = Stack.Leaf(Endpoint,
      new com.twitter.finagle.service.FailingFactory[Req, Rep](
        new IllegalArgumentException("Unterminated stack")))
  }
}


text:
[stylelint-declaration-strict-value - v1.9.1](../README.md) / index

# Module: index

## Table of contents

### References

- [ruleName](index.md#rulename)

### Variables

- [default](index.md#default)
- [messages](index.md#messages)

## References

### ruleName

Re-exports [ruleName](defaults.md#rulename)

## Variables

### default

• **default**: `Object`

#### Type declaration

| Name | Type |
| :------ | :------ |
| `rule` | `Rule`<`any`, `any`\> |
| `ruleName` | `string` |

#### Defined in

[src/index.ts:480](https://github.com/AndyOGo/stylelint-declaration-strict-value/blob/e79311f/src/index.ts#L480)

___

### messages

• **messages**: `Object`

#### Type declaration

| Name | Type |
| :------ | :------ |
| `expected` | (`types`: `ExpectedType` \| `ExpectedTypes`, `value`: `string`, `property`: `string`, `customMessage`: `string`) => `string` |
| `failedToFix` | (`error`: `unknown`, `value`: `string`, `property`: `string`) => `string` |

#### Defined in

[src/index.ts:26](https://github.com/AndyOGo/stylelint-declaration-strict-value/blob/e79311f/src/index.ts#L26)


text:
A smart kegarator that tracks temperature and controls the compressor with a web interface and stats

## purpose
Good beers need precise temperature control, and anal retentive beer drinkers need to know exactly
what their beers are doing.  So I built a kegarator with a proper control system that allows me to
fine tune my temperatures and track exactly what my beers are doing.  The kit is based on a standard
Lowes chest freezer and a kegarator kit from beveragefactory.com with the control system built with
a raspberrypi A+.  Temperature sensing is done via a few waterproofed DS18B20 sensors
and a Beefcake relay.  I control the beefcake
relay via a 3.3V to 5V level shifter.
They system allows for as many temperature sensors as the 1-wire bus will take.  My setup has
two sensors on the kegs and one sensor in the control system enclosure, so I can track keg
temperatures as well as know that my control system isn't overheating.  The config file allows
for specifying which sensors determine compressor action.

## Interface
The web interface is based on Twitter Bootstrap and uses a few graph and guage components.
Most of the component licenses are MIT licensed and those that aren't are MIT compatible.
The control system code is all GO and fully MIT licensed.

## Result
My beer is the perfect temperature at all times and I know exactly what the temperature has been
doing.  I also know exactly how often I run the compressor and exactly how much it costs me to
run my kegarator (except beer, that is priceless).

## Alternate Uses
If you want to distill rather than keep beers frosty, strap the relay to a burner or heater coil
and adjust temperatures as needed (minor logic inversion required).  If someone is interested
in rigging the system up to heat rather than cool I'll happily throw in a switch in the config
to invert the logic.


text:
package com.spotify.heroic.metadata;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import eu.toolchain.async.Collector;
import lombok.Data;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

@Data
public class SearchResults {
    public static final SearchResults EMPTY = new SearchResults(new ArrayList<ScoredSeries>());
    private static final Comparator<ScoredSeries> SERIES_COMPARATOR =
        new Comparator<ScoredSeries>() {
            @Override
            public int compare(ScoredSeries a, ScoredSeries b) {
                // reverse, since we want to sort in descending order.
                return Float.compare(b.getScore(), a.getScore());
            }
        };

    private final List<ScoredSeries> series;

    public static Collector<SearchResults, SearchResults> reduce(final int limit) {
        return new Collector<SearchResults, SearchResults>() {
            @Override
            public SearchResults collect(Collection<SearchResults> results) throws Exception {
                final List<ScoredSeries> series = new ArrayList<>();

                for (final SearchResults r : results) {
                    series.addAll(r.getSeries());
                }

                Collections.sort(series, SERIES_COMPARATOR);

                return new SearchResults(series.subList(0, Math.min(limit, series.size())));
            }
        };
    }

    @JsonCreator
    public static SearchResults create(@JsonProperty("series") List<ScoredSeries> series) {
        return new SearchResults(series);
    }
}


text:
package gov.nih.nci.cananolab.dto.particle.composition;

import gov.nih.nci.cananolab.dto.common.FileBean;
import gov.nih.nci.cananolab.util.StringUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * Base class for NanomaterialEntityBean, FunctionalizingEntityBean and
 * ChemicalAssociationBean
 *
 * @author pansu
 *
 */
public class BaseCompositionEntityBean {
	protected String type;

	protected String description;

	protected FileBean theFile = new FileBean();

	protected String className;

	protected List<FileBean> files = new ArrayList<FileBean>();

	protected String domainId, displayName; // used for DWR ajax in

	// bodySubmitChemicalAssociation.jsp

	public BaseCompositionEntityBean() {
	}

	public void addFile(FileBean file) {
		// if an old one exists, remove it first
		int index = files.indexOf(file);
		if (index != -1) {
			files.remove(file);
			// retain the original order
			files.add(index, file);
		} else {
			files.add(file);
		}
	}

	public void removeFile(FileBean file) {
		files.remove(file);
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getDescription() {
		return description;
	}

	public String getDescriptionDisplayName() {
		return StringUtils.escapeXmlButPreserveLineBreaks(description);
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public FileBean getTheFile() {
		return theFile;
	}

	public void setTheFile(FileBean theFile) {
		this.theFile = theFile;
	}

	public List<FileBean> getFiles() {
		return files;
	}

	public void setFiles(List<FileBean> files) {
		this.files = files;
	}

	public String getClassName() {
		return className;
	}

	public void setClassName(String className) {
		this.className = className;
	}

	public String getDomainId() {
		return domainId;
	}

	public String getDisplayName() {
		return displayName;
	}
}


text:
<?php
extract($_POST);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "http://sample-env.xtfzxnrydy.us-west-1.elasticbeanstalk.com/api/player/search/" . $name);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

$result = curl_exec($curl);
curl_close($curl);
print($result);
?>


text:
"""
PackageProvidesHttpdAll - Combiner for packages which provide httpd
===================================================================

.. warning::

    This module is deprecated, please use
    :mod:`insights.parsers.package_provides` instead.

Combiner for collecting all the running httpd command and the corresponding RPM package name
which is parsed by the PackageProvidesHttpd parser.

"""

from insights.core.plugins import combiner
from insights.parsers.package_provides_httpd import PackageProvidesHttpd
from .. import LegacyItemAccess
from insights.util import deprecated

@combiner(PackageProvidesHttpd)
class PackageProvidesHttpdAll(LegacyItemAccess):
    """
    .. warning::

        This Combiner is deprecated, please use
        :class:`insights.parsers.package_provides.PackageProvidesCommand`
        Parsers instead.

    This combiner will receive a list of parsers named PackageProvidesHttpd, one for each running instance of httpd
    and each parser instance will contain the command information and the RPM package information.
    It works as a ``dict`` with the httpd command information as the key and the
    corresponding RPM package information as the value.

    Examples:
        >>> sorted(packages.running_httpds)
        ['/opt/rh/httpd24/root/usr/sbin/httpd', '/usr/sbin/httpd']
        >>> packages.get_package("/usr/sbin/httpd")
        'httpd-2.4.6-88.el7.x86_64'
        >>> packages.get("/opt/rh/httpd24/root/usr/sbin/httpd")
        'httpd24-httpd-2.4.34-7.el7.x86_64'
        >>> packages["/usr/sbin/httpd"]
        'httpd-2.4.6-88.el7.x86_64'

    """

    def __init__(self, package_provides_httpd):
        deprecated(
            PackageProvidesHttpdAll,
            "Please use the :class:`insights.parsers.package_provides.PackageProvidesCommand` instead.",
            "3.0.300"
        )
        self.data = {}
        for pkg in package_provides_httpd:
            self.data[pkg.command] = pkg.package
        super(PackageProvidesHttpdAll, self).__init__()

    @property
    def running_httpds(self):
        """
        Returns the list of httpd commands which are running on the system.
        """
        return list(self.data.keys())

    def get_package(self, httpd_command):
        """
        Returns the installed httpd package that provides the specified `httpd_command`.

        Parameters:
            httpd_command (str): The specified httpd command, e.g. found in ``ps`` command.

        Returns:
            (str): The package that provides the httpd command.
        """

        return self.data.get(httpd_command)

    @property
    def packages(self):
        """
        Returns the list of corresponding httpd RPM packages which are running on the system.
        """
        return list(self.data.values())


text:
<?php

require_once 'WURFL/WURFLManagerTest.php';
require_once 'WURFL/ReloaderTestSuite.php';
require_once 'WURFL/ConfigurationTestSuite.php';
require_once 'WURFL/HandlersTestSuite.php';
require_once 'WURFL/XmlTestSuite.php';
require_once 'WURFL/Request/UserAgentNormalizerTestSuite.php';
require_once 'WURFL/DeviceRepositoryBuilderTest.php';
/**
 * Static test suite.
 */
class WURFLTestsSuite extends PHPUnit_Framework_TestSuite {

	/**
	 * Constructs the test suite handler.
	 */
	public function __construct() {
		$this->setName ( 'WURFLTestsSuite' );

		$this->addTestSuite ( 'WURFL_ConfigurationTestSuite' );
		$this->addTestSuite ( 'WURFL_XmlTestSuite' );
		$this->addTestSuite ( 'WURFL_WURFLManagerTest' );
		$this->addTestSuite ( 'WURFL_Request_UserAgentNormalizerTestSuite' );
		$this->addTestSuite ( 'WURFL_HandlersTestSuite' );
		$this->addTestSuite ( 'WURFL_DeviceRepositoryBuilderTest' );
		$this->addTestSuite ( 'WURFL_ReloaderTestSuite' );
	}

	/**
	 * Creates the suite.
	 */
	public static function suite() {
		return new self ();
	}
}


text:
 Nouvelle Vinnity

            <form class="form-horizontal" role="form" method="post" action="trt/insertVinnity_trt.php">

                    Titre

                            <input type="text" class="form-control" id="Titre" name="Titre">

                    Contacts

<select multiple class="form-control" name="users[]"  size="8">

<?php
try {
    $rq_search = "SELECT membre.membre_id,membre.membre_pseudo, membre_mail,contact_user "
        . "FROM membre "
        . "inner join contact on membre_id = contact_contact "
        . "where contact_user = :userID";
    $rq_search_prep = $connect->prepare($rq_search);
    $res = $rq_search_prep->execute(array(':userID'=>$user_ID));
    while ($donnees = $rq_search_prep->fetch(PDO::FETCH_ASSOC))
    {
    echo '<option value="'.$donnees['membre_id'].'">'.$donnees['membre_pseudo'].' ('.$donnees['membre_mail'].')</option>';
    }
}
catch (PDOException $e)
{
        echo $e->getMessage();

}
?>

</select>

                <input type="hidden" class="form-control" id="user_id" name="user_id" value="<?php echo $user_ID; ?>">

                <input type="submit" value="Créer la Vinnity" class='btn btn-success pull-right'></input>

            </form>


text:
package eu.hansolo.tilesfx.tools;

import javafx.scene.control.Tooltip;
import javafx.scene.shape.SVGPath;

import java.util.Locale;

/**
 * Created by hansolo on 21.12.16.
 */
public class CountryPath extends SVGPath {
    private String  name;
    private Locale  locale;
    private Tooltip tooltip;

    // ******************** Constructors **************************************
    public CountryPath() {
        this ("", null);
    }
    public CountryPath(final String NAME) {
        this(NAME, null);
    }
    public CountryPath(final String NAME, final String CONTENT) {
        super();
        name    = NAME;
        locale  = new Locale("", NAME);
        tooltip = new Tooltip(locale.getDisplayCountry());
        Tooltip.install(CountryPath.this, tooltip);
        if (null == CONTENT) return;
        setContent(CONTENT);
    }

    // ******************** Methods *******************************************
    public String getName() { return name; }
    public void setName(final String NAME) { this.name = NAME; }

    public Locale getLocale() { return locale; }
    public void setLocale(final Locale LOCALE) { locale = LOCALE; }

    public Tooltip getTooltip() { return tooltip; }
    public void setTooltip(final Tooltip TOOLTIP) {
        tooltip = TOOLTIP;
        Tooltip.install(CountryPath.this, tooltip);
    }

    @Override public String toString() {
        return new StringBuilder("{\n").append("  name   :\"").append(name).append("\"\n")
                                       .append("  locale :\"").append(locale).append("\"\n")
                                       .append("  tooltip:\"").append(tooltip.getText()).append("\"\n")
                                       .append("  content:\"").append(getContent()).append("\"\n")
                                       .append("}\n")
                                       .toString();
    }
}


text:
[![Build Status](https://travis-ci.org/ignacio/bitness.png?branch=master)](https://travis-ci.org/ignacio/bitness)
[![Build status](https://ci.appveyor.com/api/projects/status/6rbmp841rlcy6w0j?svg=true)](https://ci.appveyor.com/project/ignacio/bitness)
[![License](http://img.shields.io/badge/License-MIT-brightgreen.svg)](LICENSE)

Determines the bitness of Lua.

Ever wanted to answer the question _"Is this Lua installation I'm running on 32 or 64 bits?"_. Well, **bitness** gives you the answer.

````lua
local arch = require("bitness")()
print("Lua has been compiled as "..arch.." bits")
````

## How it works? #
Under **PUC Lua**, it inspects the bytecode to get the size of `size_t`. On **LuaJIT** it calls _ffi.abi_ to get the architecture.

The module exports a single function that when called will return 32, 64 or throw an error if it can't determine the bitness.

## Where does it work? #
Automated tests are run with Lua 5.1, 5,2 and 5.3 and LuaJIT 2.0.4, 2.1 on both x86 and x64 platforms.

It won't work on your [ZX Spectrum](https://en.wikipedia.org/wiki/ZX_Spectrum) or your old trusty [80286](https://en.wikipedia.org/wiki/Intel_80286). Tests probably won't run out of the box on ARM. Patches welcome.

## How do I install it? #
You can just use LuaRocks:

~~~~
luarocks install bitness
~~~~

or just copy the file _bitness.lua_ into Lua's path.

## License #
**bitness** is available under the MIT license.


text:
package database.serializer;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.io.Serializable;

import org.mapdb.Serializer;

import qora.transaction.Transaction;
import qora.transaction.TransactionFactory;

public class TransactionSerializer implements Serializer<Transaction>, Serializable
{
	private static final long serialVersionUID = -6538913048331349777L;

	@Override
	public void serialize(DataOutput out, Transaction value) throws IOException
	{
		out.writeInt(value.getDataLength());
        out.write(value.toBytes());
    }

    @Override
    public Transaction deserialize(DataInput in, int available) throws IOException
    {
    	int length = in.readInt();
        byte[] bytes = new byte[length];
        in.readFully(bytes);
        try
        {
        	return TransactionFactory.getInstance().parse(bytes);
		}
        catch (Exception e)
        {
        	e.printStackTrace();
		}
		return null;
    }

    @Override
    public int fixedSize()
    {
    	return -1;
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <com.huewu.pla.lib.MultiColumnListView
        xmlns:pla="http://schemas.android.com/apk/res-auto"
        android:id="@+id/list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        pla:plaColumnNumber="2"
        pla:plaLandscapeColumnNumber="3"
        >
    </com.huewu.pla.lib.MultiColumnListView>

</merge>


text: Source code for [Suppressed Images](https://suppressedimages.net).


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

namespace CorpAlgoCourse.Spock
{
    /// <summary>
    /// Codeforces: Order Book
    /// http://codeforces.com/gym/273845/problem/G
    /// </summary>
    [Trait("Category", "Corporate Algorithmic Course: Spock, HW 2.1")]
    public class RegistrationSystem
    {
        private static IEnumerable<string> RegisterUsers(List<string> users)
        {
            var registrar = new Dictionary<string, int>(users.Count);

            foreach (var user in users)
            {
                int userNamePostfix = 0;
                if (registrar.TryGetValue(user, out userNamePostfix))
                {
                    userNamePostfix++;
                    registrar[user] = userNamePostfix;
                    yield return string.Format("{0}{1}", user, userNamePostfix);
                }
                else
                {
                    registrar.Add(user, 0);
                    yield return "OK";
                }
            }
        }

        private static void Main1()
        {
            int n = int.Parse(Console.ReadLine());

            var users = new List<string>(n);

            for (int i = 0; i < n; i++)
            {
                users.Add(Console.ReadLine());
            }

            foreach (var userRegResult in RegisterUsers(users))
            {
                Console.WriteLine(userRegResult);
            }
        }
    }
}


text:
Demo 中的加密算法有问题,在windows环境下,需要增加 utf-8参数

```java
/**
 * MD5编码
 * @param origin 原始字符串
 * @return 经过MD5加密之后的结果
 */
public static String MD5Encode(String origin) {
    String resultString = null;
    try {
        resultString = origin;
        MessageDigest md = MessageDigest.getInstance("MD5");
        //resultString = byteArrayToHexString(md.digest(resultString.getBytes())); ///深坑啊,赶紧注释掉,用UTF-8
        resultString = byteArrayToHexString(md.digest(resultString.getBytes("utf-8")));
    } catch (Exception e) {
        e.printStackTrace();
    }
    return resultString;
}

```


text:
describe('Filter.Add', function () {
  describe('#toGml', function () {
    it('must return element with tagName Add', function () {
      var filter = new L.Filter.Add();
      var filterElement = filter.toGml();
      expect(filterElement.tagName).to.be.equal('Add');
    });
  });
});

describe('Filter.Sub', function () {
  describe('#toGml', function () {
    it('must return element with tagName Sub', function () {
      var filter = new L.Filter.Sub();
      var filterElement = filter.toGml();
      expect(filterElement.tagName).to.be.equal('Sub');
    });
  });
});

describe('Filter.Mul', function () {
  describe('#toGml', function () {
    it('must return element with tagNameMulAdd', function () {
      var filter = new L.Filter.Mul();
      var filterElement = filter.toGml();
      expect(filterElement.tagName).to.be.equal('Mul');
    });
  });
});

describe('Filter.Div', function () {
  describe('#toGml', function () {
    it('must return element with tagName Div', function () {
      var filter = new L.Filter.Div();
      var filterElement = filter.toGml();
      expect(filterElement.tagName).to.be.equal('Div');
    });
  });
});


text:
namespace pr_bgl
{

/*! \brief Adaptor to use non-matrix partition_all functions
 *         as a selector for pr_bgl::lazysp.
 *
 * for now, this assumes g is an undirected graph
 *
 * we include a do_fake_roots parameter (default: false)
 * when this parameter is set,
 * then edges TO the start and edges FROM the goal are IGNORED
 * (this way, the oppposite edges can have 0 weight)
 * (this is accounted for on both initial add and incremental updates)
 *
 * also, if do_fake_roots is set,
 * then the first and last edges on the path are always
 * scored 1.0 (highest) and will therefore always be evaluated first
 */
template <class Graph, class WLazyMap>
class lazysp_selector_partition_all
{
public:
   typedef typename boost::graph_traits<Graph>::vertex_descriptor Vertex;
   typedef typename boost::graph_traits<Graph>::edge_descriptor Edge;
   typedef typename boost::graph_traits<Graph>::edge_iterator EdgeIter;

   typedef typename boost::property_map<Graph, boost::vertex_index_t>::type VerIndexMap;
   typedef pr_bgl::pair_index_map<Vertex,VerIndexMap> VerPairIndexMap;
   typedef boost::vector_property_map<double,VerIndexMap> VerVector;
   typedef boost::vector_property_map<double,VerPairIndexMap> VerPairVector;

   const Graph & g;
   WLazyMap w_lazy_map;
   const double len_ref;
   const Vertex v_start;
   const Vertex v_goal;
   const bool do_fake_roots;

   // coupling temps,outputs
   VerVector temp1;
   VerVector temp2;
   VerPairVector coupling_map;

   lazysp_selector_partition_all(
      const Graph & g,
      WLazyMap w_lazy_map, double len_ref,
      Vertex v_start, Vertex v_goal,
      bool do_fake_roots):
      g(g), w_lazy_map(w_lazy_map), len_ref(len_ref),
      v_start(v_start), v_goal(v_goal),
      do_fake_roots(do_fake_roots),
      temp1(num_vertices(g),get(boost::vertex_index,g)),
      temp2(num_vertices(g),get(boost::vertex_index,g)),
      coupling_map(
         num_vertices(g)*num_vertices(g),
         VerPairIndexMap(get(boost::vertex_index,g),num_vertices(g)))
   {
      printf("computing partition_all from scratch ...\n");

      // compute coupling from scratch
      pr_bgl::partition_all_init(g, coupling_map);

      std::pair<EdgeIter,EdgeIter> ep=edges(g);
      for (EdgeIter ei=ep.first; ei!=ep.second; ei++)
      {
         Vertex v_s = source(*ei, g);
         Vertex v_t = target(*ei, g);
         double weight_frac = get(w_lazy_map,*ei) / len_ref;

         if (!do_fake_roots || (v_t != v_start && v_s != v_goal))
         {
            // add forward edge s->t
            partition_all_update_directed_edge(g,
               v_s,
               v_t,
               weight_frac,
               true, // is_add
               coupling_map, temp1, temp2);
         }

         if (!do_fake_roots || (v_s != v_start && v_t != v_goal))
         {
            // add backwards edge t->s
            partition_all_update_directed_edge(g,
               v_t,
               v_s,
               weight_frac,
               true, // is_add
               coupling_map, temp1, temp2);
         }
      }
   }

   void get_to_evaluate(
      const Graph & g,
      const std::vector< std::pair<Edge,bool> > & path,
      std::vector<Edge> & to_evaluate)
   {
      double coupling_withall = coupling_map[std::make_pair(v_start,v_goal)];
      //printf("start-goal coupling: %e\n", coupling_withall);

      double score_best = 0.0;
      Edge e_best;
      bool found_best = false;
      for (unsigned int ui=0; ui<path.size(); ui++)
      {
         Edge e = path[ui].first;
         if (path[ui].second)
            continue;

         double score;
         if (do_fake_roots && (ui==0 || ui==path.size()-1))
            score = 1.0;
         else
         {
            // compute leave-one-out coupling score
            double coupling_without = pr_bgl::partition_all_without_edge(g, v_start, v_goal,
               e, get(w_lazy_map,e)/len_ref, coupling_map);
            //printf("  path[%u] edge coupling without: %e\n", ui, coupling_without);
            score = 1.0 - coupling_without/coupling_withall;
         }

         // is it better?
         if (score_best <= score)
         {
            e_best = e;
            score_best = score;
            found_best = true;
         }
      }
      if (!found_best)
         throw std::runtime_error("no best edge found!");
      to_evaluate.push_back(e_best);
   }

   template <class Edge, class WeightType>
   void update_notify(Edge e, WeightType e_weight_old)
   {
      //printf("accommodating updated edge ...\n");
      double e_weight_new = get(w_lazy_map, e);
      if (e_weight_new == e_weight_old)
         return;

      // remove in both directions (assume above check skips fake roots)
      Vertex v_s = source(e, g);
      Vertex v_t = target(e, g);

      double weight_frac_old = e_weight_old / len_ref;
      if (!do_fake_roots || (v_t != v_start && v_s != v_goal))
         partition_all_update_directed_edge(g, v_s, v_t, weight_frac_old, false, coupling_map, temp1, temp2);
      if (!do_fake_roots || (v_s != v_start && v_t != v_goal))
         partition_all_update_directed_edge(g, v_t, v_s, weight_frac_old, false, coupling_map, temp1, temp2);

      double weight_frac = get(w_lazy_map, e) / len_ref;
      if (!do_fake_roots || (v_t != v_start && v_s != v_goal))
         partition_all_update_directed_edge(g, v_s, v_t, weight_frac, true, coupling_map, temp1, temp2);
      if (!do_fake_roots || (v_s != v_start && v_t != v_goal))
         partition_all_update_directed_edge(g, v_t, v_s, weight_frac, true, coupling_map, temp1, temp2);
   }
};

/*! \brief Adaptor to use matrix partition_all functions
 *         as a LazySP selector
 */
template <class Graph, class WLazyMap>
class lazysp_partition_all_matrix
{
public:
   typedef typename boost::graph_traits<Graph>::vertex_descriptor Vertex;
   typedef typename boost::graph_traits<Graph>::edge_descriptor Edge;

   const Graph & g;
   WLazyMap w_lazy_map;
   const double len_ref;
   const Vertex v_start;
   const Vertex v_goal;
   const bool do_fake_roots;

   pr_bgl::partition_all_matrix & solver;

   lazysp_partition_all_matrix(
      const Graph & g,
      WLazyMap w_lazy_map, double len_ref,
      Vertex v_start, Vertex v_goal,
      bool do_fake_roots,
      pr_bgl::partition_all_matrix & solver):
      g(g), w_lazy_map(w_lazy_map), len_ref(len_ref),
      v_start(v_start), v_goal(v_goal),
      do_fake_roots(do_fake_roots),
      solver(solver)
   {
   }

   void get_to_evaluate(
      const Graph & g,
      const std::vector< std::pair<Edge,bool> > & path,
      std::vector<Edge> & to_evaluate)
   {
      double coupling_withall = solver.Z(v_start, v_goal);
      //printf("start-goal coupling: %e\n", coupling_withall);

      double score_best = 0.0;
      Edge e_best;
      bool found_best = false;
      for (unsigned int ui=0; ui<path.size(); ui++)
      {
         Edge e = path[ui].first;
         if (path[ui].second)
            continue;

         double score;
         if (do_fake_roots && (ui==0 || ui==path.size()-1))
            score = 1.0;
         else
         {
            double weight_frac = get(w_lazy_map,e)/len_ref;
            double coupling_without = solver.without_undirected(
               v_start, v_goal, source(e,g), target(e,g), weight_frac);

            //printf("  path[%u] edge coupling without: %e\n", ui, coupling_without);
            score = 1.0 - coupling_without/coupling_withall;
         }

         // is it better?
         if (score_best <= score)
         {
            e_best = e;
            score_best = score;
            found_best = true;
         }
      }
      if (!found_best)
         throw std::runtime_error("no best edge found!");
      to_evaluate.push_back(e_best);
   }

   template <class Edge, class WeightType>
   void update_notify(Edge e, WeightType e_weight_old)
   {
      //printf("accommodating updated edge ...\n");
      double e_weight_new = get(w_lazy_map, e);
      if (e_weight_new == e_weight_old)
         return;

      // remove in both directions (assume above check skips fake roots)
      Vertex va = source(e, g);
      Vertex vb = target(e, g);

      // remove in both directions
      double weight_frac_old = e_weight_old / len_ref;
      if (!do_fake_roots || (vb != v_start && va != v_goal))
         solver.remove_edge(va, vb, weight_frac_old);
      if (!do_fake_roots || (va != v_start && vb != v_goal))
         solver.remove_edge(vb, va, weight_frac_old);

      // add in both directions
      double weight_frac = get(w_lazy_map, e) / len_ref;
      if (!do_fake_roots || (vb != v_start && va != v_goal))
         solver.add_edge(va, vb, weight_frac);
      if (!do_fake_roots || (va != v_start && vb != v_goal))
         solver.add_edge(vb, va, weight_frac);
   }
};

} // namespace pr_bgl


text:
<?php

declare(strict_types=1);

namespace SolidWorx\FormHandler;

use ProxyManager\Proxy\ProxyInterface;
use SolidWorx\FormHandler\Event\FormHandlerEvent;
use SolidWorx\FormHandler\Event\FormHandlerEvents;
use SolidWorx\FormHandler\Exception\InvalidHandlerException;
use SolidWorx\FormHandler\Exception\NonUniqueHandlerException;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\OptionsResolver\OptionsResolver;

final class FormHandler
{
    /**
     * @var Request|null
     */
    private $request;

    /**
     * @var FormFactoryInterface
     */
    private $factory;

    /**
     * @var EventDispatcherInterface
     */
    private $dispatcher;

    /**
     * @var FormHandlerInterface[]
     */
    private $handlers = [];

    public function __construct(RequestStack $requestStack, EventDispatcherInterface $dispatcher, FormFactoryInterface $factory)
    {
        $this->request = $requestStack->getCurrentRequest();
        $this->factory = $factory;
        $this->dispatcher = $dispatcher;
    }

    /**
     * @throws NonUniqueHandlerException
     */
    public function registerHandler(FormHandlerInterface $handler): void
    {
        if (true === $handler instanceof ProxyInterface) {
            $class = get_parent_class($handler);
        } else {
            $class = get_class($handler);
        }

        if (isset($this->handlers[$class])) {
            throw new NonUniqueHandlerException($handler);
        }

        $this->handlers[$class] = $handler;
    }

    /**
     * @param string|FormHandlerInterface $class
     * @param array<mixed>                $options
     *
     * @throws \Exception
     */
    public function handle($class, array $options = []): FormRequest
    {
        $optionsResolver = new OptionsResolver();

        $handler = $this->getHandler($class);

        if ($handler instanceof FormHandlerOptionsResolver) {
            $handler->configureOptions($optionsResolver);

            $options = $optionsResolver->resolve($options);
        }

        $config = Options::fromArray($options);

        $form = $this->getForm($handler, $config);
        $formRequest = new FormRequest($form, $this->request, new Response(), $config);

        $form->handleRequest($this->request);

        if (!$form->isSubmitted()) {
            if ($handler instanceof FormHandlerResponseInterface) {
                $formRequest->setResponse($handler->getResponse($formRequest));
            }

            return $formRequest;
        }

        $event = new FormHandlerEvent($handler, $form, $formRequest);

        if ($form->isValid()) {
            $this->dispatcher->dispatch($event, FormHandlerEvents::EVENT_FORM_SUCCESS);
        } else {
            $this->dispatcher->dispatch($event, FormHandlerEvents::EVENT_FORM_FAIL);
        }

        if ($response = $event->getResponse()) {
            $formRequest->setResponse($response);
        } elseif ($handler instanceof FormHandlerResponseInterface) {
            $formRequest->setResponse($handler->getResponse($formRequest));
        }

        return $formRequest;
    }

    /**
     * @param string|FormHandlerInterface $handler
     *
     * @throws InvalidHandlerException
     */
    private function getHandler($handler): FormHandlerInterface
    {
        if (is_string($handler)) {
            if (!isset($this->handlers[$handler])) {
                $handler = new $handler();
            } else {
                $handler = $this->handlers[$handler];
            }
        }

        if (!$handler instanceof FormHandlerInterface) {
            throw new InvalidHandlerException(FormHandlerInterface::class, $handler);
        }

        return $handler;
    }

    /**
     * @param Options<string, mixed> $options
     *
     * @throws \Exception
     *
     * @return FormInterface<FormInterface>
     */
    private function getForm(FormHandlerInterface $handler, Options $options): FormInterface
    {
        $form = $handler->getForm($this->factory, $options);

        if (!$form instanceof FormInterface && !is_string($form)) {
            throw new \Exception(sprintf('%s::getForm() must return a string or instance of FormInterface, %s given', get_class($handler), is_object($form) ? get_class($form) : gettype($form)));
        }

        if (is_string($form)) {
            $form = $this->factory->create($form);
        }

        return $form;
    }

    /**
     * @return FormHandlerInterface[]
     */
    public function getHandlers(): array
    {
        return $this->handlers;
    }
}


text:
package org.pentaho.di.trans.step.mqtt;

import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
import org.pentaho.di.core.exception.KettleException;
import org.pentaho.di.core.exception.KettleStepException;
import org.pentaho.di.i18n.BaseMessages;
import org.pentaho.di.trans.Trans;
import org.pentaho.di.trans.TransMeta;
import org.pentaho.di.trans.step.BaseStep;
import org.pentaho.di.trans.step.StepDataInterface;
import org.pentaho.di.trans.step.StepInterface;
import org.pentaho.di.trans.step.StepMeta;
import org.pentaho.di.trans.step.StepMetaInterface;

public class MQTTProducer extends BaseStep implements StepInterface {
  private static Class<?> PKG = MQTTProducerMeta.class; // for i18n purposes, needed by Translator2!!   $NON-NLS-1$
  private static final String PROTOCOL = "tcp://";

  private MQTTProducerMeta meta;
  private MQTTProducerData data;

  /**
   * This is the base step that forms that basis for all steps. You can derive from this class to implement your own
   * steps.
   *
   * @param stepMeta          The StepMeta object to run.
   * @param stepDataInterface the data object to store temporary data, database connections, caches, result sets,
   *                          hashtables etc.
   * @param copyNr            The copynumber for this step.
   * @param transMeta         The TransInfo of which the step stepMeta is part of.
   * @param trans             The (running) transformation to obtain information shared among the steps.
   */
  public MQTTProducer( StepMeta stepMeta,
                       StepDataInterface stepDataInterface, int copyNr,
                       TransMeta transMeta, Trans trans ) {
    super( stepMeta, stepDataInterface, copyNr, transMeta, trans );
  }

  @Override
  public boolean init( StepMetaInterface stepMetaInterface, StepDataInterface stepDataInterface ) {
    boolean isInitalized = super.init( stepMetaInterface, stepDataInterface );
    meta = ( (MQTTProducerMeta) stepMetaInterface );
    data = ( (MQTTProducerData) stepDataInterface );

    return isInitalized;
  }

  @Override
  public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException {
    Object[] row = getRow();

    if ( null == row ) {
      setOutputDone();
      if ( null != data.mqttClient ) {
        try {
          data.mqttClient.disconnect();
          data.mqttClient.close();
        } catch ( MqttException e ) {
          logError( e.getMessage(), e );
        }
      }

      return false;
    }

    if ( first ) {
      data.messageFieldIndex = getInputRowMeta().indexOfValue( environmentSubstitute( meta.getMessageField() ) );
      try {
        data.mqttClient =
          new MqttClient( PROTOCOL + environmentSubstitute( meta.getMqttServer() ),
            environmentSubstitute( meta.getClientId() ), new MemoryPersistence() );
        data.mqttClient.connect();
      } catch ( MqttException e ) {
        logError( e.getMessage(), e );
      }

      first  = false;
    }

    MqttMessage mqttMessage = new MqttMessage();
    try {
      mqttMessage.setQos( Integer.parseInt( environmentSubstitute( meta.getQOS() ) ) );
    } catch ( NumberFormatException e ) {
      throw new KettleStepException( BaseMessages.getString( PKG, "MQTTProducer.Error.QOS", environmentSubstitute( meta.getQOS() ) ) );
    }
    mqttMessage.setPayload( ( row[ data.messageFieldIndex ] ).toString().getBytes() );

    try {
      data.mqttClient.publish( environmentSubstitute( meta.getTopic() ), mqttMessage );

      incrementLinesOutput();
      putRow( getInputRowMeta(), row ); // copy row to possible alternate rowset(s).

      if ( checkFeedback( getLinesRead() ) ) {
        if ( log.isBasic() ) {
          logBasic( BaseMessages.getString( PKG, "MQTTProducer.Log.LineNumber" ) + getLinesRead() );
        }
      }
    } catch ( MqttException e ) {
      logError( e.getMessage(), e );
    }

    return true;
  }
}


text:
using Engine;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Engine.Storage;

namespace UnitTests
{
    [TestClass]
    public class VarCharColumnStoreTest
    {
        private IStorage storage;
        private Registry registry;
        private ColumnBase<string> column1;

        [TestInitialize]
        public void Setup()
        {
            storage = new MemoryStorage();
            registry = new Registry(storage);

            column1 = new ColumnBase<string>("t1", "c1", registry.StrTraits);
            column1.Insert(0, "000");
            column1.Insert(1, "aaa");
            column1.Insert(2, "bbb");
            column1.Insert(5, "eee");
            column1.Insert(7, "ggg");

            registry.StrTraits.PageStorage.Flush();
        }

        [TestMethod]
        public void StoredAndLoaded()
        {
            var column2 = new ColumnBase<string>("t1", "c1", registry.StrTraits);
            var whole1 = column1.Get(null);
            var whole2 = column2.Get(null);

            CollectionAssert.AreEqual(whole1.All(), whole2.All());
        }
    }
}


text:
require 'spec_helper'

require 'emony/tag_parser'

describe Emony::TagParser do
  describe ".parse" do
    let(:str) { nil }
    subject(:result) { described_class.parse(str) }

    context "for simple tag" do
      let(:str) { 'foo.bar' }
      it { is_expected.to eq(tag: 'foo.bar') }
    end

    context "with duration" do
      let(:str) { 'foo.bar@60' }
      it { is_expected.to eq(tag: 'foo.bar', group: nil, group_key: nil, duration: 60) }
    end

    context "with group" do
      let(:str) { 'foo.bar:host/i-deadbeef' }
      it { is_expected.to eq(tag: 'foo.bar', group: 'host', group_key: 'i-deadbeef', duration: nil) }
    end

    context "with group and duration" do
      let(:str) { 'foo.bar@60:host/i-deadbeef' }
      it { is_expected.to eq(tag: 'foo.bar', group: 'host', group_key: 'i-deadbeef', duration: 60) }
    end

    context "with group and duration (complex)" do
      let(:str) { 'foo.bar@60:host/i-de/ad@beef' }
      it { is_expected.to eq(tag: 'foo.bar', group: 'host', group_key: 'i-de/ad@beef', duration: 60) }
    end

    context "with invalid syntax" do
      let(:str) { 'foo.bar@60:host' }
      it "raises error" do
        expect { result }.to raise_error(Emony::TagParser::ValidationError)
      end
    end
  end

  describe ".parse_tag" do
    let(:str) { nil }
    subject(:result) { described_class.parse_tag(str) }

    context "for simple tag" do
      let(:str) { 'foo.bar' }
      it { is_expected.to eq(tag: 'foo.bar') }
    end

    context "with duration" do
      let(:str) { 'foo.bar@60' }
      it "raises error" do
        expect { result }.to raise_error(Emony::TagParser::ValidationError)
      end
    end

    context "with group" do
      let(:str) { 'foo.bar:host/i-deadbeef' }
      it "raises error" do
        expect { result }.to raise_error(Emony::TagParser::ValidationError)
      end
    end

    context "with group and duration" do
      let(:str) { 'foo.bar@60:host/i-deadbeef' }
      it "raises error" do
        expect { result }.to raise_error(Emony::TagParser::ValidationError)
      end
    end
  end
end


text:
/************************************************************************************
	KinOS - Microkernel for ARM Evaluator 7-T
	Seniors project - Computer Engineering
	Escola Politecnica da USP, 2009

	Felipe Giunte Yoshida
	Mariana Ramos Franco
	Vinicius Tosta Ribeiro
*/

/*
	The program was based on the mutex program by ARM - Strategic Support Group,
	contained on the ARM Evaluator 7-T example CD, under the folder /Evaluator7-T/
	source/examples/mutex/
*************************************************************************************/

/****************************************************************
 * IMPORT
 ****************************************************************/

/* This file contains routines to initialize and handle timer interruptions */

#include "timer.h"

/****************************************************************
 * ROUTINES
 ****************************************************************/

/* Initiate timer settings */
void timer_init (void) {
	/* Case it's from the emulator */
	if (emulator == 1) {
		/* Clear/disable all interrupts */
	  	*IRQEnableClear = ~0;
		/* Disable counters by clearing the control bytes */
	  	*EmulatorIRQTimerControl = 0;
		/* Clear counter/timer interrupts  */
	  	*IRQTimerClear = 0 ;
	}
	/* Case it's the board */
	else {
		/* Disable interrupt */
		*TimerEnableSet	= 0;
		 /* Clear pending interrupts */
	  	*IRQStatus = 0x00000000;
	}
}

/* Restart timer interrupt */
void timer_irq(void) {
	if (emulator == 1) {
		/* Clear the interrupt */
		*IRQTimerClear = 0;
	}
	else {
		/* Clear pending interrupts */
		*IRQStatus	= 1 << 10;
		/* Load counter values */
		*EvaluatorIRQTimerLoad = COUNTDOWN;
		/* Unmask the interrupt source */
		*(volatile int*)EvaluatorIRQTimerControl &= ~((1<<21) | (1<<10) | (1<<0));
	}
}

/* Start timer */
void timer_start (void) {
	if (emulator == 1) {
		/* Load counter values */
  		*EmulatorIRQTimerLoad = COUNTDOWN;
		/* Enable the Timer | Periodic Timer producing interrupt | Set Maximum Prescale - 8 bits */
		*EmulatorIRQTimerControl = (0x80 | 0x40 | 0x08 );
		/* Enable interrupt */
    	*IRQEnableSet = IRQTimer;
    }
    else {
		/* Load counter values */
    	*EvaluatorIRQTimerLoad = COUNTDOWN;
		/* Enable interrupt */
    	*TimerEnableSet |= 0x1;
		/* Unmask the interrupt source */
    	*(volatile int*)EvaluatorIRQTimerControl &= ~((1 << 21) | (1 << 10) | (1 << 0));
	}
}