text:
/* parser.c */

#include "lr_parser.h"

// table indices
/*
ACTION ActionTable(LR_TABLE table, int state, int token)
{
    ACTION action;
    action.type = ACTION_ERROR;

    if (token & K_TOKEN)
        token = token ^ K_TOKEN;

    if (state >= 0 && state < table.numStates
        && token > 0 && token <= table.numTokens)
    {
        action = table.actionTable[state * table.numTokens + token - 1];
    }

    return action;
}

int GotoTable(LR_TABLE table, int state, int symbol)
{
    int nextState = -1;

    if (symbol & K_SYMBOL)
        symbol = symbol ^ K_SYMBOL;

    if (state >= 0 && state < table.numStates
        && symbol > 0 && symbol <= table.numSymbols)
    {
        nextState = table.gotoTable[state * table.numSymbols + symbol - 1];
    }

    return nextState;
}*/

/* static data */

PARSE_STACK* gParseStack = NULL;
PARSE_STACK* gParseTop = NULL;

/* stack operations */

void StackPushState(int state)
{
    if (gParseTop) {
        gParseTop->next = (PARSE_STACK*)malloc(sizeof(PARSE_STACK));
        gParseTop->next->prev = gParseTop;
        gParseTop = gParseTop->next;
    } else {
        gParseStack = gParseTop = (PARSE_STACK*)malloc(sizeof(PARSE_STACK));
        gParseTop->prev = NULL;
    }
    gParseTop->next = NULL;
    gParseTop->token = NULL;
    gParseTop->type = 0;
    gParseTop->state = state;
}

void StackPushToken(L_TOKEN* token)
{
    if (gParseTop) {
        gParseTop->next = (PARSE_STACK*)malloc(sizeof(PARSE_STACK));
        gParseTop->next->prev = gParseTop;
        gParseTop = gParseTop->next;
    } else {
        gParseStack = gParseTop = (PARSE_STACK*)malloc(sizeof(PARSE_STACK));
        gParseTop->prev = NULL;
    }
    gParseTop->next = NULL;
    gParseTop->token = token;
    gParseTop->type = TOKEN_L_TOKEN;
    gParseTop->state = -1;
}

void StackPushTree(SYNTAX_TREE* tree)
{
    if (gParseTop) {
        gParseTop->next = (PARSE_STACK*)malloc(sizeof(PARSE_STACK));
        gParseTop->next->prev = gParseTop;
        gParseTop = gParseTop->next;
    } else {
        gParseStack = gParseTop = (PARSE_STACK*)malloc(sizeof(PARSE_STACK));
        gParseTop->prev = NULL;
    }
    gParseTop->next = NULL;
    gParseTop->token = tree;
    gParseTop->type = TOKEN_SYNTAX_TREE;
    gParseTop->state = -1;
}

PARSE_STACK StackPeek()
{
    PARSE_STACK r;
    r.token = NULL;
    r.type = 0;
    r.state = -1;

    if (gParseTop) {
        r = *gParseTop;
        r.next = NULL;
        r.prev = NULL;
    }

    return r;
}

PARSE_STACK StackPop()
{
    PARSE_STACK r;
    r.token = NULL;
    r.type = 0;
    r.state = -1;

    if (gParseTop) {
        r = *gParseTop;
        r.next = NULL;
        r.prev = NULL;
        if (gParseTop->prev) {
            gParseTop = gParseTop->prev;
            free(gParseTop->next);
            gParseTop->next = NULL;
        } else {
            free(gParseTop);
            gParseTop = NULL;
            gParseStack = NULL;
        }
    }

    return r;
}

void FreeParseStack()
{
    PARSE_STACK s;
    while (gParseStack)
    {
        s = StackPop();
        if (s.type == TOKEN_SYNTAX_TREE)
        {
            SYNTAX_TREE* astSection = (SYNTAX_TREE*)s.token;
            FreeParseTree(astSection);
        }
    }
}

void PrintErrorInput(L_TOKEN* input, GRAMMAR_TABLE g)
{
    int i;
    if (input)
    {
        printf("Syntax error on line %i: ", (input->line+1));
        if (input->string)
        {
            for (i = 0; i < input->length; i++)
            {
                printf("%c", input->string[i]);
            }
        }
        else
        {
            printf("%s", GetElement(input->token, g));
        }
        printf("\n");
    }
}

/* check if a source is parsable */
int ParseSucceeds(L_TOKEN* input,
                  LR_TABLE parser,
                  GRAMMAR_TABLE grammar)
{
    int successful = 0;
    // the program's syntax tree
    SYNTAX_TREE* ast = NULL;

    // set ip and init stack
    L_TOKEN* ip = input;
    StackPushState(0);

    // loop forever
    for (;;)
    {
        ACTION action;
        // get the state off the top of the stack
        PARSE_STACK s = StackPeek();
        if (s.token || s.state == -1
                || s.state >= parser.numStates)
        {
            // error
            successful = -1;
            break;
        }

        if (ip == NULL) {
            successful = 0;
            break;
        }

        // find the action table entry for the state and input
        action = ActionTable(parser, s.state, ip->token);

        // perform the parse action
        if (action.type == ACTION_SHIFT)
        {
            // push a then s' on top of the stack;
            StackPushToken(ip);
            StackPushState(action.value);
            // advance ip to the next input symbol
            ip = ip->next;
        }
        else if (action.type == ACTION_REDUCE)
        {
            RULE r;
            int rhs;

            // output the production A -> B
            if (action.value < 0 || action.value >= grammar.numRules)
            {
                // error, free
                successful = -1;
                break;
            }
            r = grammar.rules[action.value];

            // pop 2*|B| symbols off the stack;
            for (rhs = 0; rhs < r.rhsLength; rhs++)
            {
                StackPop();
                StackPop();
            }

            // let s' be the state now on top of the stack;
            s = StackPeek();
            if (s.token || s.state == -1 || s.state >= parser.numStates)
            {
                successful = -1;
                break;
            }

            // push A then goto[s', A] on top of the stack;
            StackPushTree(NULL);
            StackPushState(GotoTable(parser, s.state, r.lhs));
        }
        else if (action.type == ACTION_ACCEPT)
        {
            // accept
            successful = 1;
            break;
        }
        else
        {
            // error
            if (ip->token == gSymbolEOF)
                successful = 0;
            else
                successful = -1;
            break;
        }
    }

    // free the stack
    while (gParseStack)
        StackPop();
    //FreeParseStack();

    // no errors
    return successful;
}

/* parse a lexed source file */
/*
set ip to point to the first symbol of w$;
repeat forever begin
    let s be the state on top of the stack and
        a the symbol pointed to by ip;
    if action[s, a] = shift s' then begin
        push a then s' on top of the stack;
        advance ip to the next input symbol
    end
    else if action[s, a] = reduce A -> B then begin
        pop 2*|B| symbols off the stack;
        let s' be the state now on top of the stack;
        push A then goto[s', A] on top of the stack;
        output the production A -> B
    end
    else if action[s, a] = accept then
        return
    else error()
end
*/
SYNTAX_TREE* ParseSource(L_TOKEN*      input,
                         LR_TABLE      parser,
                         GRAMMAR_TABLE grammar)
{
    // the program's syntax tree
    SYNTAX_TREE* ast = NULL;

    // set ip and init stack
    L_TOKEN* ip = input;
    StackPushState(0);
    // printf("Parsing source...\n");

    // loop forever
    for (;;)
    {
        ACTION action;
        // get the state off the top of the stack
        PARSE_STACK s = StackPeek();
        if (s.token || s.state == -1
                || s.state >= parser.numStates
                || ip == NULL)
        {
            if (ip)
                printf("Parse error: invalid state on top of the stack.\n");
            else
                printf("Parse error: unexpected end of input.\n");
            return 0;
        }

        // find the action table entry for the state and input
        action = ActionTable(parser, s.state, ip->token);

        // perform the parse action
        if (action.type == ACTION_SHIFT)
        {
            // push a then s' on top of the stack;
            StackPushToken(ip);
            StackPushState(action.value);
            // advance ip to the next input symbol
            ip = ip->next;
        }
        else if (action.type == ACTION_REDUCE)
        {
            SYNTAX_TREE* node;
            RULE r;
            int rhs;

            // output the production A -> B
            if (action.value < 0 || action.value >= grammar.numRules) {
                printf("Parse error: invalid production for reduce action.\n");
                PrintErrorInput(ip, grammar);
                return 0;
            }
            r = grammar.rules[action.value];
            //printf("%s\n", GetElement(r.lhs, grammar));

            // pop 2*|B| symbols off the stack;
            node = (SYNTAX_TREE*)malloc(sizeof(SYNTAX_TREE));
            node->token = r.lhs;
            node->production = action.value;
            node->string = NULL;
            node->length = 0;
            node->line = 0;
            node->children = (SYNTAX_TREE**)malloc(r.rhsLength * sizeof(SYNTAX_TREE*));
            node->numChildren = r.rhsLength;
            for (rhs = 0; rhs < r.rhsLength; rhs++)
            {
                PARSE_STACK symbol;
                int child = r.rhsLength - rhs - 1;

                StackPop(); // state
                symbol = StackPop();
                if (symbol.token == NULL)
                {
                    printf("Parse error: expected token.\n");
                    PrintErrorInput(ip, grammar);
                    return 0;
                }

                if (symbol.type == TOKEN_L_TOKEN)
                {
                    L_TOKEN* token = (L_TOKEN*)symbol.token;
                    node->children[child] = (SYNTAX_TREE*)malloc(sizeof(SYNTAX_TREE));
                    node->children[child]->token = token->token;
                    node->children[child]->production = 0;
                    node->children[child]->string = token->string;
                    node->children[child]->length = token->length;
                    node->children[child]->line = token->line;
                    node->children[child]->children = NULL;
                    node->children[child]->numChildren = 0;
                }
                else if (symbol.type == TOKEN_SYNTAX_TREE)
                {
                    node->children[child] = (SYNTAX_TREE*)symbol.token;
                }
                else
                {
                    printf("Parse error: expected token object.\n");
                    PrintErrorInput(ip, grammar);
                }
            }
            if (r.rhsLength) node->line = node->children[0]->line;

            // let s' be the state now on top of the stack;
            s = StackPeek();
            if (s.token || s.state == -1 || s.state >= parser.numStates)
            {
                printf("Parse error: expected state on top of stack.\n");
                PrintErrorInput(ip, grammar);

                FreeParseStack();

                return 0;
            }

            // push A then goto[s', A] on top of the stack;
            if (r.lhs == gSymbolGoal)
            {
                ast = node;
            }
            StackPushTree(node);
            StackPushState(GotoTable(parser, s.state, r.lhs));
        }
        else if (action.type == ACTION_ACCEPT)
        {
            // accept
            // printf("Parse accepted!\n");
            break;
        }
        else
        {
            // error
            printf("Parse error: illegal action type.\n");
            PrintErrorInput(ip, grammar);

            FreeParseStack();

            return 0;
        }
    }

    // free the stack
    while (gParseStack)
    {
        StackPop();
    }

    // no errors
    return ast;
}

// parse tree memory management
void FreeParseTree(SYNTAX_TREE* ast)
{
    if (ast && ast->children)
    {
        int i;
        for (i = 0; i < ast->numChildren; i++)
        {
            FreeParseTree(ast->children[i]);
        }

        free(ast->children);
        free(ast);
    }
    else if (ast)
    {
        free(ast);
    }
}

void PrintParseTreeNode(SYNTAX_TREE* ast, GRAMMAR_TABLE g)
{
    if (!ast) return;
    if (ast->string && ast->token != gSymbolEndLine)
    {
        int i;
        for (i = 0; i < ast->length; i++)
            printf("%c", ast->string[i]);
    }
    else
    {
        printf("%s", GetElement(ast->token, g));
    }
}

void PrintParseTreeRecurse(SYNTAX_TREE*  ast,
                           unsigned int  indent,
                           GRAMMAR_TABLE g)
{
    if (ast->children)
    {
		unsigned int u;
        int i;

        for (u = 0; u < indent*2; u++)
        {
            printf(" ");
        }

        PrintParseTreeNode(ast, g);

        printf(" ::= ");

        for (i = 0; i < ast->numChildren; i++)
        {
            PrintParseTreeNode(ast->children[i], g);
            printf(" ");
        }

        printf("\n");

        for (i = 0; i < ast->numChildren; i++)
        {
            PrintParseTreeRecurse(ast->children[i], indent+1, g);
        }
    }
}

void PrintParseTree(SYNTAX_TREE*  ast,
                    GRAMMAR_TABLE grammar)
{
    printf("\n\nAbstract Syntax Tree\n");
    printf("====================\n\n");
    PrintParseTreeRecurse(ast, 0, grammar);
}

void PrintParseTreeFormat(SYNTAX_TREE*  ast,
                          GRAMMAR_TABLE grammar)
{
    if (ast->numChildren > 0) {
        int i;
        for (i = 0; i < ast->numChildren; i++)
            PrintParseTreeFormat(ast->children[i], grammar);
    } else {
        if (ast->string && ast->token != gSymbolEndLine)
        {
            int i;
            for (i = 0; i < ast->length; i++)
                printf("%c", ast->string[i]);
        }
        else
        {
            printf("%s", GetElement(ast->token, grammar));
        }
    }
}


text:
package org.zstack.storage.ceph.primary.capacity;

import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.zstack.core.Platform;
import org.zstack.core.db.DatabaseFacade;
import org.zstack.core.db.Q;
import org.zstack.core.db.SQL;
import org.zstack.core.db.SQLBatch;
import org.zstack.header.storage.primary.PrimaryStorageCapacityUpdaterRunnable;
import org.zstack.header.storage.primary.PrimaryStorageCapacityVO;
import org.zstack.storage.ceph.CephCapacity;
import org.zstack.storage.ceph.CephConstants;
import org.zstack.storage.ceph.CephPoolCapacity;
import org.zstack.storage.ceph.primary.*;
import org.zstack.storage.primary.PrimaryStorageCapacityUpdater;
import org.zstack.utils.Utils;
import org.zstack.utils.logging.CLogger;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

import static java.util.stream.Collectors.groupingBy;

/**
 * Created by lining on 2021/1/22.
 */
@Configurable(preConstruction = true, autowire = Autowire.BY_TYPE)
public class OpenSourceCephPrimaryCapacityUpdater implements CephPrimaryCapacityUpdater {
    @Autowired
    private DatabaseFacade dbf;

    private static final CLogger logger = Utils.getLogger(OpenSourceCephPrimaryCapacityUpdater.class);

    @Override
    public String getCephManufacturer() {
        return CephConstants.CEPH_MANUFACTURER_OPENSOURCE;
    }

    @Override
    public void update(CephCapacity cephCapacity) {
        String fsid = cephCapacity.getFsid();
        long total = cephCapacity.getTotalCapacity();
        long avail = cephCapacity.getAvailableCapacity();
        List<CephPoolCapacity> poolCapacities = cephCapacity.getPoolCapacities();

        CephPrimaryStorageVO cephPs = SQL.New("select pri from CephPrimaryStorageVO pri where pri.fsid = :fsid",CephPrimaryStorageVO.class)
                .param("fsid", fsid)
                .find();
        if (cephPs == null) {
            return;
        }

        List<String> poolNames = new ArrayList<>();

        PrimaryStorageCapacityUpdater updater = new PrimaryStorageCapacityUpdater(cephPs.getUuid());
        updater.run(new PrimaryStorageCapacityUpdaterRunnable() {
            @Override
            public PrimaryStorageCapacityVO call(PrimaryStorageCapacityVO cap) {
                if (cap.getTotalCapacity() == 0 || cap.getAvailableCapacity() == 0) {
                    // init
                    cap.setAvailableCapacity(avail);
                }

                cap.setTotalCapacity(total);
                cap.setTotalPhysicalCapacity(total);
                cap.setAvailablePhysicalCapacity(avail);
                return cap;
            }
        });

        if (poolCapacities == null) {
            return;
        }

        new SQLBatch() {
            @Override
            protected void scripts() {
                Map<String, List<CephPoolCapacity>> caps = poolCapacities.stream().collect(groupingBy(CephPoolCapacity::getRelatedOsds));

                Set<String> osdGroups = caps.keySet();
                logger.info(String.format("ceph[%s] primary storage found osd groups %s", cephPs.getUuid(), osdGroups));

                List<CephOsdGroupVO> existedOsdGroups = Q.New(CephOsdGroupVO.class).eq(CephOsdGroupVO_.primaryStorageUuid, cephPs.getUuid()).list();
                List<CephOsdGroupVO> needDeleteOsds = existedOsdGroups.stream()
                        .filter(v -> !osdGroups.contains(v.getOsds())).collect(Collectors.toList());
                List<String> needCreateOsds = osdGroups.stream()
                        .filter(v -> existedOsdGroups.stream().noneMatch(a -> a.getOsds().equals(v))).collect(Collectors.toList());

                if (!needDeleteOsds.isEmpty()) {
                    logger.info(String.format("remove %s stale osd groups", needDeleteOsds.size()));
                    needDeleteOsds.forEach(this::remove);
                }

                List<CephOsdGroupVO> newOsdGroups = new ArrayList<>();
                for (String osds : needCreateOsds) {
                    CephOsdGroupVO vo = new CephOsdGroupVO();
                    vo.setUuid(Platform.getUuid());
                    vo.setOsds(osds);
                    vo.setPrimaryStorageUuid(cephPs.getUuid());
                    newOsdGroups.add(vo);
                }
                newOsdGroups.forEach(this::persist);

                List<CephPrimaryStoragePoolVO> pools = Q.New(CephPrimaryStoragePoolVO.class).eq(CephPrimaryStoragePoolVO_.primaryStorageUuid, cephPs.getUuid()).list();
                for (CephPrimaryStoragePoolVO poolVO : pools) {
                    if (!poolCapacities.stream().anyMatch((e) -> poolVO.getPoolName().equals(e.getName()))) {
                        if (poolNames.contains(poolVO.getPoolName())) {
                            continue;
                        }
                        poolNames.add(poolVO.getPoolName());
                        continue;
                    }

                    CephPoolCapacity poolCapacity = poolCapacities.stream()
                            .filter(e -> poolVO.getPoolName().equals(e.getName()))
                            .findAny().get();

                    CephOsdGroupVO osdGroupVO = Q.New(CephOsdGroupVO.class)
                            .eq(CephOsdGroupVO_.osds, poolCapacity.getRelatedOsds())
                            .eq(CephOsdGroupVO_.primaryStorageUuid, cephPs.getUuid())
                            .find();

                    // ceph pool related osds has changed
                    if (poolVO.getOsdGroup() == null || (poolVO.getOsdGroup() != null &&
                            !poolVO.getOsdGroup().getUuid().equals(osdGroupVO.getUuid()))) {
                        poolVO.setOsdGroup(osdGroupVO);
                    }

                    if (!poolNames.contains(poolVO.getPoolName())) {
                        poolNames.add(poolVO.getPoolName());
                    }

                    poolVO.setAvailableCapacity(poolCapacity.getAvailableCapacity());
                    poolVO.setReplicatedSize(poolCapacity.getReplicatedSize());
                    poolVO.setUsedCapacity(poolCapacity.getUsedCapacity());
                    poolVO.setTotalCapacity(poolCapacity.getTotalCapacity());
                    poolVO.setDiskUtilization(poolCapacity.getDiskUtilization());
                    poolVO.setSecurityPolicy(poolCapacity.getSecurityPolicy());
                    dbf.getEntityManager().merge(poolVO);
                }

                new CephOsdGroupCapacityHelper(cephPs.getUuid()).fillCapacityFromPool();
            }
        }.execute();
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.lockss.plugin.springer.link;

import org.lockss.filter.pdf.ExtractingPdfFilterFactory;
import org.lockss.pdf.*;
import org.lockss.plugin.ArchivalUnit;
import org.lockss.util.Logger;

public class SpringerLinkScrapingPdfFilterFactory extends ExtractingPdfFilterFactory {

  private static final Logger log = Logger.getLogger(SpringerLinkScrapingPdfFilterFactory.class);

  /*
   * A new version of the SpringerLink scraping PDF filter that takes advantage of improvements in the
   * filtering class
   */
  @Override
  public void transform(ArchivalUnit au, PdfDocument pdfDocument)
      throws PdfException {

    pdfDocument.unsetCreationDate();
    pdfDocument.unsetModificationDate();
    pdfDocument.unsetMetadata();
    pdfDocument.unsetCreator();
    pdfDocument.unsetProducer();
    pdfDocument.unsetAuthor();
    pdfDocument.unsetTitle();
    pdfDocument.unsetSubject();
    pdfDocument.unsetKeywords();
    PdfUtil.normalizeTrailerId(pdfDocument);
    PdfUtil.normalizeAllTokenStreams(pdfDocument);
  }
}


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

	<title>SHTOOLS - Miscellaneous routines</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" type="text/css" href="../../css/sh.css">
	<link rel="icon" type="image/vnd.microsoft.icon" href="../../images/favicon.ico">

				HOME
				DOWNLOAD
				DOCUMENTATION
				FAQ

>  Home > Documentation > Python > Other

RandomN

Return a pseudo uniform random deviate between 0 and 1 using the algorithm of Park and Miller with a Marsaglia shift sequence.

Usage

rn, seed = pyshtools.RandomN (seed)

Returns

rn : float

The uniform random deviate.

seed : integer

The output value of seed should be input into the function to obtain the next random deviate.

Parameters

seed : input/output, integer

Input a negative integer to (re-)initialize the random number generator. Afterwards, this argument should not be modified.

Description

RandomN will return a uniform random deviate between 0 and 1 (exclusive of the endpoints) using the algorithm of Park and Miller combined with a Marsaglia shift sequence. The random number generator is intialized by calling with a negative value of seed, and afterwards this variable should not be modified. The period of this generator is claimed to be about 3.1 10^18 (see Press et al. 2002).

References

Press, W.H., S.A. Teukolsky, W.T. Vetterling, and B.P. Flannery, Numerical Recipes in FORTRAN 90: Volume 2 of FORTRAN numerical recipes, 2nd ed., Cambridge Univ. Press, Cambridge, UK, 2002.

See also

randomgaussian

>  Home > Documentation > Python > Other

			Institut de Physique du Globe de Paris
			University of Sorbonne Paris Cité
			© 2015 Mark Wieczorek


text:
namespace NuGet.VisualStudio
{
    internal static class VsConstants
    {
        // Project type guids
        internal const string WebApplicationProjectTypeGuid = "{349C5851-65DF-11DA-9384-00065B846F21}";
        internal const string WebSiteProjectTypeGuid = "{E24C65DC-7377-472B-9ABA-BC803B73C61A}";
        internal const string CsharpProjectTypeGuid = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}";
        internal const string VbProjectTypeGuid = "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}";
        internal const string FsharpProjectTypeGuid = "{F2A71F9B-5D33-465A-A702-920D77279786}";
        internal const string JsProjectTypeGuid = "{262852C6-CD72-467D-83FE-5EEB1973A190}";
        internal const string WixProjectTypeGuid = "{930C7802-8A8C-48F9-8165-68863BCCD9DD}";
        internal const string LightSwitchProjectTypeGuid = "{ECD6D718-D1CF-4119-97F3-97C25A0DFBF9}";
        internal const string NemerleProjectTypeGuid = "{edcc3b85-0bad-11db-bc1a-00112fde8b61}";

        // Copied from EnvDTE.Constants since that type can't be embedded
        internal const string VsProjectItemKindPhysicalFile = "{6BB5F8EE-4483-11D3-8BCF-00C04F8EC28C}";
        internal const string VsProjectItemKindPhysicalFolder = "{6BB5F8EF-4483-11D3-8BCF-00C04F8EC28C}";
        internal const string VsProjectItemKindSolutionFolder = "{66A26720-8FB5-11D2-AA7E-00C04F688DDE}";
        internal const string VsWindowKindSolutionExplorer = "{3AE79031-E1BC-11D0-8F78-00A0C9110057}";

        // All unloaded projects have this Kind value
        internal const string UnloadedProjectTypeGuid = "{67294A52-A4F0-11D2-AA88-00C04F688DDE}";

        internal const string NuGetSolutionSettingsFolder = ".nuget";

        // HResults
        internal const int S_OK = 0;
    }
}


text:
<big>{{ profile.max_memory_use_gib|floatformat:2 }} GiB</big>

peak memory consumption


text:
require 'rails_helper'

RSpec.describe Order::LocalExpert, :type => :model do

  describe '#paid' do
    let(:order) {create :order_local_expert, state: 'new'}
    subject{order.paid_expert}

    it{expect{subject}.to change{order.state}.to 'confirmed'}

  end

  describe '#reject' do
    let(:order) {create :order_local_expert, state: 'waiting_for_confirmation'}
    subject{order.cancel_by_client}

    it{expect{subject}.to change{order.state}.to 'canceled_by_client'}
    it{expect{subject}.to change{order.owner.user.notifications.count}.by 1}

  end

  describe '#close' do
    let!(:invoice) {create :invoice, subject: order}
    let(:order) {create :order_local_expert, state: 'confirmed'}
    subject{order.close}

    it{expect{subject}.to change{order.state}.to 'close'}
    it{expect{subject}.to change{order.owner.user.notifications.count}.by 1}
  end

  describe '#original_price' do
    let(:srv_ord1) {build :local_expert_service_booking}
    let(:srv_ord2) {build :local_expert_service_booking}
    let(:order) {create :order_local_expert, service_bookings: [srv_ord1, srv_ord2]}

    subject{order.original_price}

    it{is_expected.to be_a BigDecimal}
    it{is_expected.to eq srv_ord1.cost + srv_ord2.cost}
  end

  describe 'paying_items' do

    subject{order.paying_items}

    let(:service_one){create :local_expert_service, name: 'serv one', cost: 10, discount: discount }
    let(:service_two){create :local_expert_service, name: 'serv two', cost: 10, discount: discount }

    let(:order){create :order_local_expert, service_bookings: [(build :local_expert_service_booking, service: service_one, count: 2),
                                                               (build :local_expert_service_booking, service: service_two, count: 3)]}

    context 'without discount' do

      let(:discount){0}

      it ('count') {expect(subject.count).to eq(2)}
      it ('first cost') {expect(subject[0][:cost]).to eq(20)}
      it ('desc first') {expect(subject[0][:description]).to eq('serv one X 2')}
      it ('second cost') {expect(subject[1][:cost]).to eq(30)}
    end

    context 'with discount' do

      let(:discount){10}

      it ('count') {expect(subject.count).to eq(2)}
      it ('first cost') {expect(subject[0][:cost]).to eq(19)}
      it ('desc first') {expect(subject[0][:description]).to eq('serv one X 2')}
      it ('second cost') {expect(subject[1][:cost]).to eq(28)}
    end
  end
end


text:
Palindrome checker in Japanese.

## Usage

http://myokoym.net/kaibunkai/

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request


text:
package com.yahoo.vespa.test.samples;

import com.yahoo.vespa.testrunner.Expect;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

@Disabled("because")
@Expect(skipped = 2, status = 2)
public class DisabledClassTest {

    @Test
    void test() { }

    @Test
    void fest() { }

}


text:
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * Navigation styles for the original theme
 *
 * @package    PhpMyAdmin-theme
 * @subpackage Original
 */

// unplanned execution path
if (! defined('PMA_MINIMUM_COMMON') && ! defined('TESTSUITE')) {
    exit();
}
?>

/******************************************************************************/
/* Navigation */

#pma_navigation {
    background: <?php echo $GLOBALS['cfg']['NaviBackground']; ?>;
    color: <?php echo $GLOBALS['cfg']['NaviColor']; ?>;
    width: <?php echo $GLOBALS['cfg']['NaviWidth']; ?>px;
    overflow: hidden;
    position: fixed;
    top: 0;
    <?php echo $left; ?>: 0;
    height: 100%;
    border-<?php echo $right; ?>: 1px solid gray;
    z-index: 800;
}

#pma_navigation_content {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    <?php echo $left; ?>: 0;
    z-index: 0;
    padding-bottom: 1em;
}

#pma_navigation ul {
    margin: 0;
}

#pma_navigation form {
    margin: 0;
    padding: 0;
    display: inline;
}

#pma_navigation select#select_server,
#pma_navigation select#lightm_db {
    width: 100%;
}

/******************************************************************************/
/* specific elements */

#pma_navigation div.pageselector {
    text-align: center;
    margin: 0 0 0;
    margin-<?php echo $left; ?>: 0.75em;
    border-<?php echo $left; ?>: 1px solid #666;
}

#pma_navigation div#pmalogo {
    <?php //better echo $GLOBALS['cfg']['logoBGC']; ?>
    background-color: <?php echo $GLOBALS['cfg']['NaviBackground']; ?>;
    padding: .3em;
}

#pma_navigation div#recentTableList {
    text-align: center;
    margin-bottom: 0.5em;
}

#pma_navigation #pmalogo,
#pma_navigation #serverChoice,
#pma_navigation #leftframelinks,
#pma_navigation #recentTableList,
#pma_navigation #databaseList,
#pma_navigation div.pageselector.dbselector {
    text-align:         center;
    margin-bottom:      0.3em;
    padding-bottom:     0.3em;
    border: 0;
}

#pma_navigation #recentTableList select,
#pma_navigation #serverChoice select
 {
    width: 80%;
}

#pma_navigation #recentTableList {
    margin-bottom: 0;
    padding-bottom: 0;
}

#pma_navigation_content > img.throbber {
    display: block;
    margin: 0 auto;
}

/* Navigation tree*/
#pma_navigation_tree {
    margin: 0;
    margin-<?php echo $left; ?>: 1em;
    color: #444;
    height: 74%;
    position: relative;
}
#pma_navigation_tree_content {
    width: 100%;
    overflow: hidden;
    overflow-y: auto;
    position: absolute;
    height: 100%;
}
#pma_navigation_tree a {
    color: <?php echo $GLOBALS['cfg']['NaviColor']; ?>;
}
#pma_navigation_tree a:hover {
    text-decoration: underline;
}
#pma_navigation_tree li.activePointer {
    color: <?php echo $GLOBALS['cfg']['NaviPointerColor']; ?>;
    background-color: <?php echo $GLOBALS['cfg']['NaviPointerBackground']; ?>;
}
#pma_navigation_tree ul {
    clear: both;
    padding: 0;
    list-style-type: none;
    margin: 0;
}
#pma_navigation_tree ul ul {
    position: relative;
}
#pma_navigation_tree li {
    white-space: nowrap;
    clear: both;
    min-height: 16px;
}
#pma_navigation_tree img {
    margin: 0;
}
#pma_navigation_tree div.block {
    position: relative;
    width:1.5em;
    height:1.5em;
    min-width: 16px;
    min-height: 16px;
    float: <?php echo $left; ?>;
}
#pma_navigation_tree div.block i,
#pma_navigation_tree div.block b {
    width: 1.5em;
    height: 1.5em;
    min-width: 16px;
    min-height: 8px;
    position: absolute;
    bottom: 0.7em;
    <?php echo $left; ?>: 0.75em;
    z-index: 0;
}
#pma_navigation_tree div.block i {
    border-<?php echo $left; ?>: 1px solid #666;
    border-bottom: 1px solid #666;
}
#pma_navigation_tree div.block i.first { /* Removes top segment */
    border-<?php echo $left; ?>: 0;
}
#pma_navigation_tree div.block b { /* Bottom segment for the tree element connections */
    display: block;
    height: 0.75em;
    bottom: 0;
    <?php echo $left; ?>: 0.75em;
    border-<?php echo $left; ?>: 1px solid #666;
}
#pma_navigation_tree div.block a,
#pma_navigation_tree div.block u {
    position: absolute;
    <?php echo $left; ?>: 50%;
    top: 50%;
    z-index: 10;
}
#pma_navigation_tree div.block img {
    position: relative;
    top: -0.6em;
    <?php echo $left; ?>: 0;
    margin-<?php echo $left; ?>: -5px;
}
#pma_navigation_tree li.last > ul {
    background: none;
}
#pma_navigation_tree li > a, #pma_navigation_tree li > i {
    line-height: 1.5em;
    height: 1.5em;
    padding-<?php echo $left; ?>: 0.3em;
}
#pma_navigation_tree .list_container {
    border-<?php echo $left; ?>: 1px solid #666;
    margin-<?php echo $left; ?>: 0.75em;
    padding-<?php echo $left; ?>: 0.75em;
}
#pma_navigation_tree .last > .list_container {
    border-<?php echo $left; ?>: 0 solid #666;
}

/* Fast filter */
li.fast_filter {
    padding-<?php echo $left; ?>: 0.75em;
    margin-<?php echo $left; ?>: 0.75em;
    padding-<?php echo $right; ?>: 35px;
    border-<?php echo $left; ?>: 1px solid #666;
}
li.fast_filter input {
    padding-<?php echo $right; ?>: .4em;
    width: 100%;
}
li.fast_filter span {
    position: relative;
    <?php echo $right; ?>: 1.5em;
    padding: 0.2em;
    cursor: pointer;
    font-weight: bold;
    color: #800;
}
li.fast_filter.db_fast_filter {
    border: 0;
}

/* Resize handler */
#pma_navigation_resizer {
    width: 3px;
    height: 100%;
    background-color: #aaa;
    cursor: col-resize;
    position: fixed;
    top: 0;
    <?php echo $left; ?>: 240px;
    z-index: 801;
}
#pma_navigation_collapser {
    width: 20px;
    height: 22px;
    line-height: 22px;
    background: #eee;
    color: #555;
    font-weight: bold;
    position: fixed;
    top: 0;
    <?php echo $left; ?>: <?php echo $GLOBALS['cfg']['NaviWidth']; ?>px;
    text-align: center;
    cursor: pointer;
    z-index: 800;
    text-shadow: 0px 1px 0px #fff;
    filter: dropshadow(color=#fff, offx=0, offy=1);
    border: 1px solid #888;
}


text:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const URL = require("url");
/**
 * A regular expression that matches whitespace on either side, but
 * not in the center of a string
 */
const TRIM_REGULAR_EXPRESSION = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
/**
 * Removes whitespace from the beginning and end of a string
 */
exports.trim = function (inputString) {
    if (inputString.trim) {
        return inputString.trim();
    }
    return inputString.replace(TRIM_REGULAR_EXPRESSION, '');
};
/**
 * Compares two objects for deep (recoursive) equality
 *
 * This used to be a significantly more complex custom implementation,
 * but JSON.stringify has gotten so fast that it now outperforms the custom
 * way by a factor of 1.5 to 3.
 *
 * In IE11 / Edge the custom implementation is still slightly faster, but for
 * consistencies sake and the upsides of leaving edge-case handling to the native
 * browser / node implementation we'll go for JSON.stringify from here on.
 *
 * Please find performance test results here
 *
 * http://jsperf.com/deep-equals-code-vs-json
 */
exports.deepEquals = (objA, objB) => {
    if (objA === objB) {
        return true;
    }
    else if (typeof objA !== 'object' || typeof objB !== 'object') {
        return false;
    }
    return JSON.stringify(objA) === JSON.stringify(objB);
};
/**
 * Similar to deepEquals above, tests have shown that JSON stringify outperforms any attempt of
 * a code based implementation by 50% - 100% whilst also handling edge-cases and keeping
 * implementation complexity low.
 *
 * If ES6/7 ever decides to implement deep copying natively (what happened to Object.clone?
 * that was briefly a thing...), let's switch it for the native implementation. For now though,
 * even Object.assign({}, obj) only provides a shallow copy.
 *
 * Please find performance test results backing these statements here:
 *
 * http://jsperf.com/object-deep-copy-assign
 */
exports.deepCopy = (obj) => {
    if (typeof obj === 'object') {
        return JSON.parse(JSON.stringify(obj));
    }
    return obj;
};
/**
 * Copy the top level of items, but do not copy its items recourisvely. This
 * is much quicker than deepCopy does not guarantee the object items are new/unique.
 * Mainly used to change the reference to the actual object itself, but not its children.
 */
exports.shallowCopy = (obj) => {
    if (Array.isArray(obj)) {
        return obj.slice(0);
    }
    else if (typeof obj === 'object') {
        const copy = Object.create(null);
        const props = Object.keys(obj);
        for (let i = 0; i < props.length; i++) {
            copy[props[i]] = obj[props[i]];
        }
        return copy;
    }
    return obj;
};
/**
 * Used to see if a protocol is specified within the url
 * @type {RegExp}
 */
const hasUrlProtocol = /^wss:|^ws:|^\/\//;
/**
 * Used to see if the protocol contains any unsupported protocols
 * @type {RegExp}
 */
const unsupportedProtocol = /^http:|^https:/;
/**
 * Take the url passed when creating the client and ensure the correct
 * protocol is provided
 * @param  {String} url Url passed in by client
 * @return {String} Url with supported protocol
 */
exports.parseUrl = (initialURl, defaultPath) => {
    let url = initialURl;
    if (unsupportedProtocol.test(url)) {
        throw new Error('Only ws and wss are supported');
    }
    if (!hasUrlProtocol.test(url)) {
        url = `ws://${url}`;
    }
    else if (url.indexOf('//') === 0) {
        url = `ws:${url}`;
    }
    const serverUrl = URL.parse(url);
    if (!serverUrl.host) {
        throw new Error('invalid url, missing host');
    }
    serverUrl.protocol = serverUrl.protocol ? serverUrl.protocol : 'ws:';
    serverUrl.pathname = serverUrl.pathname ? serverUrl.pathname : defaultPath;
    return URL.format(serverUrl);
};
/**
* Returns a random string. The first block of characters
* is a timestamp, in order to allow databases to optimize for semi-
* sequentuel numberings
*/
exports.getUid = () => {
    const timestamp = (new Date()).getTime().toString(36);
    const randomString = (Math.random() * 10000000000000000).toString(36).replace('.', '');
    return `${timestamp}-${randomString}`;
};
/**
 * Creates a map based on the types of the provided arguments
 */
exports.normalizeSetArguments = (args, startIndex = 0) => {
    let result;
    const isRootData = (data) => data !== undefined && typeof data === 'object';
    const isNestedData = (data) => typeof data !== 'function';
    const isPath = (path) => path !== undefined && typeof path === 'string';
    const isCallback = (callback) => typeof callback === 'function';
    if (args.length === startIndex + 1) {
        result = {
            path: undefined,
            data: isRootData(args[startIndex]) ? args[startIndex] : undefined,
            callback: undefined
        };
    }
    if (args.length === startIndex + 2) {
        result = { path: undefined, data: undefined, callback: undefined };
        if (!isCallback(args[startIndex]) && isNestedData(args[startIndex])) {
            result.path = isPath(args[startIndex]) ? args[startIndex] : undefined;
        }
        if (isPath(args[startIndex])) {
            result.data = isNestedData(args[startIndex + 1]) ? args[startIndex + 1] : undefined;
        }
        else {
            result.data = isRootData(args[startIndex]) ? args[startIndex] : undefined;
        }
        if (!isPath(args[startIndex])) {
            result.callback = isCallback(args[startIndex + 1]) ? args[startIndex + 1] : false;
        }
    }
    if (args.length === startIndex + 3) {
        result = {
            path: isPath(args[startIndex]) ? args[startIndex] : undefined,
            data: isNestedData(args[startIndex + 1]) ? args[startIndex + 1] : undefined,
            callback: isCallback(args[startIndex + 2]) ? args[startIndex + 2] : undefined
        };
    }
    if (result) {
        if (result.path !== undefined && result.path.length === 0 ||
            (result.path === undefined && !result.data)) {
            throw Error('Invalid set path argument');
        }
        if (result.data === undefined && result.path === undefined) {
            throw Error('Invalid set data argument');
        }
        if (result.callback !== undefined && result.callback === false ||
            result.callback === undefined && args.length === startIndex + 3) {
            throw Error('Invalid set callback argument');
        }
        return result;
    }
    throw Error('Invalid set arguments');
};
/**
 * Creates a map based on the types of the provided arguments
 */
exports.normalizeArguments = (args) => {
    // If arguments is already a map of normalized parameters
    // (e.g. when called by AnonymousRecord), just return it.
    if (args.length === 1 && typeof args[0] === 'object') {
        return args[0];
    }
    const result = Object.create(null);
    for (let i = 0; i < args.length; i++) {
        if (typeof args[i] === 'string') {
            result.path = args[i];
        }
        else if (typeof args[i] === 'function') {
            result.callback = args[i];
        }
        else if (typeof args[i] === 'boolean') {
            result.triggerNow = args[i];
        }
    }
    return result;
};
//# sourceMappingURL=utils.js.map