text:
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <cstddef>
#include <string>
#include <vector>

#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"

#define I18N_ADDRESSINPUT_UTIL_BASICTYPES_H_
#include "third_party/libaddressinput/chromium/preload_address_validator.h"
#include "third_party/libaddressinput/chromium/suggestions.h"
#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_data.h"
#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_validator.h"
#include "third_party/libaddressinput/src/cpp/include/libaddressinput/callback.h"
#include "third_party/libaddressinput/src/cpp/include/libaddressinput/downloader.h"
#include "third_party/libaddressinput/src/cpp/include/libaddressinput/preload_supplier.h"
#include "third_party/libaddressinput/src/cpp/include/libaddressinput/storage.h"
#include "third_party/libaddressinput/src/cpp/include/libaddressinput/synonyms.h"

namespace autofill {

using ::i18n::addressinput::AddressData;
using ::i18n::addressinput::AddressField;
using ::i18n::addressinput::AddressValidator;
using ::i18n::addressinput::BuildCallback;
using ::i18n::addressinput::Downloader;
using ::i18n::addressinput::FieldProblemMap;
using ::i18n::addressinput::PreloadSupplier;
using ::i18n::addressinput::Storage;
using ::i18n::addressinput::Synonyms;

PreloadAddressValidator::PreloadAddressValidator(
    const std::string& validation_data_url,
    scoped_ptr<Downloader> downloader,
    scoped_ptr<Storage> storage)
    : supplier_(
          new PreloadSupplier(
              validation_data_url,
              downloader.release(),
              storage.release())),
      suggestions_(
          new Suggestions(
              supplier_.get())),
      synonyms_(
          new Synonyms(
              supplier_.get())),
      validator_(
          new AddressValidator(
              supplier_.get())),
      validated_(BuildCallback(this, &PreloadAddressValidator::Validated)) {
}

PreloadAddressValidator::~PreloadAddressValidator() {
}

void PreloadAddressValidator::LoadRules(const std::string& region_code,
                                        const Callback& loaded) {
  assert(supplier_ != NULL);
  supplier_->LoadRules(region_code, loaded);
}

PreloadAddressValidator::Status PreloadAddressValidator::Validate(
    const AddressData& address,
    const FieldProblemMap* filter,
    FieldProblemMap* problems) const {
  assert(supplier_ != NULL);
  assert(validator_ != NULL);

  if (supplier_->IsPending(address.region_code)) {
    return RULES_NOT_READY;
  }

  if (!supplier_->IsLoaded(address.region_code)) {
    return RULES_UNAVAILABLE;
  }

  validator_->Validate(
      address,
      /*allow_postal*/ false,
      /*require_name*/ false,
      filter,
      problems,
      *validated_);

  return SUCCESS;
}

PreloadAddressValidator::Status PreloadAddressValidator::GetSuggestions(
    const AddressData& user_input,
    AddressField focused_field,
    size_t suggestion_limit,
    std::vector<AddressData>* suggestions) const {
  assert(suggestions_ != NULL);
  assert(supplier_ != NULL);

  if (supplier_->IsPending(user_input.region_code)) {
    return RULES_NOT_READY;
  }

  if (!supplier_->IsLoaded(user_input.region_code)) {
    return RULES_UNAVAILABLE;
  }

  suggestions_->GetSuggestions(
      user_input,
      focused_field,
      suggestion_limit,
      suggestions);

  return SUCCESS;
}

bool PreloadAddressValidator::CanonicalizeAdministrativeArea(
    AddressData* address) const {
  assert(address != NULL);
  assert(supplier_ != NULL);
  assert(synonyms_ != NULL);

  if (!supplier_->IsLoaded(address->region_code)) {
    return false;
  }

  // TODO: It would probably be beneficial to use the full canonicalization.
  AddressData tmp(*address);
  synonyms_->NormalizeForDisplay(&tmp);
  address->administrative_area = tmp.administrative_area;

  return true;
}

void PreloadAddressValidator::Validated(bool success,
                                        const AddressData&,
                                        const FieldProblemMap&) {
  assert(success);
}

// Stub constructor for use by MockAddressValidator.
PreloadAddressValidator::PreloadAddressValidator() {
}

}  // namespace autofill


text:
require 'recursive-open-struct'
module OmniAuth
  module ExpressoV3
    class AuthClient

      class MissingArgumentsError < Exception; end
      class AuthenticationError < Exception; end
      class ConnectionError < Exception; end

      SERVICE_URL =  "https://expressobr.serpro.gov.br"

       VALID_ADAPTER_CONFIGURATION_KEYS = [:service_url]

      def initialize(options={})
        service_url = options['service_url'] || SERVICE_URL
        @debug = options['debug'] || options[:debug]
        @json_tine = JSONRPCTineConnection.new service_url, @debug
      end

      def send(method_name, args={})
        @json_tine.send(method_name, args)
        @json_tine.result
      end

      def authenticate(username, password)
        validate_arguments(username, password)
        auth_params = {"username" => username,"password" => password}

        @json_tine.send 'Tinebase.login', auth_params

        # check if user is authenticated,  raises an authentication if not
        validate_login(@json_tine.result)
        #return user data
        build_struct @json_tine.result
      end

      def send method, args={}
          @json_tine.send method, args
          build_struct @json_tine.result
      end

      def get_user_data args={}
        #request to get user data
        @json_tine.send 'Tinebase.getAllRegistryData', args

        # hash with user data
        build_struct :keys => @json_tine.result['keys'],
            :currentAccount => @json_tine.result['Tinebase']['currentAccount'],
            :userContact    => @json_tine.result['Tinebase']['userContact'],
            :expressoAccount    => @json_tine.result['Expressomail']['accounts']['results'][0]
      end

      def last_raw_data
        @json_tine.last_body
      end

      def close
        @json_tine.close if @json_tine
      end
  protected
      def build_struct hash
        RecursiveOpenStruct.new hash,  :recurse_over_arrays => true
      end
      def validate_arguments(username, password)
        if username.nil? or password.nil?
          raise MissingArgumentsError.new('missing credentials arguments')
        end
        if "".eql?(username) or "".eql?(password)
          raise MissingArgumentsError.new('missing credentials arguments')
        end
      end

      def validate_login(response_result)
        authenticated = false
        authentication_failure_msg = ""
        if response_result
          authenticated = response_result['success']
        end
        raise AuthenticationError.new(authentication_failure_msg) unless authenticated
      end
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
package net.nicecoder.jbrick.model;

import java.util.Date;
import java.util.List;
import java.util.Map;

public class Post {
	private String name;//文件名称
	private String absPath;//绝对地址
	private String title;
	private String content;
	private Map<String,String> meta;
	private List<Tag> tags;
	private Category category;
	private Date createAt;
	private Date updateAt;

	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public Map<String, String> getMeta() {
		return meta;
	}
	public void setMeta(Map<String, String> meta) {
		this.meta = meta;
	}
	public List<Tag> getTags() {
		return tags;
	}
	public void setTags(List<Tag> tags) {
		this.tags = tags;
	}
	public Category getCategory() {
		return category;
	}
	public void setCategory(Category category) {
		this.category = category;
	}
	public Date getCreateAt() {
		return createAt;
	}
	public void setCreateAt(Date createAt) {
		this.createAt = createAt;
	}
	public Date getUpdateAt() {
		return updateAt;
	}
	public void setUpdateAt(Date updateAt) {
		this.updateAt = updateAt;
	}
	public String getAbsPath() {
		return absPath;
	}
	public void setAbsPath(String absPath) {
		this.absPath = absPath;
	}

}


text:
title: we-dev-on newsletter; edition 12th of May 2017
---
# we-dev-on newsletter;  edition 12th of May 2017

## Table of Contents

* [Introduction](#introduction)
* [Microservices Webcast](#microservices-webcast)
* [Devonfw Harvest Status update](#devonfw-harvest-status-update)
* [OASP4J 2.3.0 and devonfw 2.1.2 release](#oasp4j-230-and-devonfw-212-release)
    + [OASP4j 2.3.0 Release](#oasp4j-230-release)
    + [Cobigen Enhancements](#cobigen-enhancements)
    + [Micro services module (Spring Cloud/Netflix OSS)](#micro-services-module--spring-cloud-netflix-oss-)
    + [Spring Integration Module](#spring-integration-module)
    + [WebSphere & Wildfly deployment documentation](#websphere---wildfly-deployment-documentation)
* [Cooperation of CSD Italy & iCSD devonfw Core Team](#cooperation-of-csd-italy---icsd-devonfw-core-team)
    + [One Team approach of iCSD devonfw Core Team and CSD Italy created a real win-win situation](#one-team-approach-of-icsd-devonfw-core-team-and-csd-italy-created-a-real-win-win-situation)
    + [Benefit 1: Devonfw SOAP – a PoC for Intesa San Paolo project](#benefit-1--devonfw-soap---a-poc-for-intesa-san-paolo-project)
    + [Benefit 2: Italian Mobile Project Support](#benefit-2--italian-mobile-project-support)
* [Contributors](#contributors)
* [Colophon](#colophon)

![GitHub Logo](../img/devonfw-logo-smallest.png)

## Introduction

Dear devonfw community,

We present the third edition of the 'we-dev-on' newsletter, the reader-supported publication for and from the devonfw & OASP communities all over Capgemini APPS2. This edition covers the new releases of devonfw and OASP as well as some updates and announcements.

This edition covers the new releases of devonfw and OASP as well as some updates and announcements.

The iCSD Core Team

## Microservices Webcast

Friday the 16th of June there will be a webcast about the new devonfw Microservices module. The webcast will show the architecture and the details of how to use the module, based on Spring Cloud and the Netflix OSS stack. We hope to be able to demonstrate a real, working example during webcast. We will announce the definitive hour and agenda later in the month.  Keep an eye out for that announcement in the _Devon_ group in Yammer.

## Devonfw Harvest Status update

The Spanish team from the engagement in Valencia which has agreed to participate in the devonfw Harvest has been busy and a number of modules have been extracted already. They are now in the process of being finalized. Once done we will do a short status webcast.

## OASP4J 2.3.0 and devonfw 2.1.2 release

We've released the latest update release of devonfw in the _Balu_ series: version 2.1.2. The next major release, code named _Courage_, will be released approximately the end of June.

You can download the new distro [on the file release page in Team forge](https://coconet.capgemini.com/sf/frs/do/viewRelease/projects.apps2_devon/frs.devon_distribution.2_1_2).

The current release contains the following features:

### OASP4j 2.3.0 Release

Friday the 12th of May 2017 OASP4J version 2.3.0 was released. Major features added are :

- Database Integration with PostGres, MSSQL Server, MariaDB
- Added docs folder for gh pages and added oomph setups
- Refactored Code
- Refactored Test Infrastructure
- Added Documentation on debugging tests
- Added Two Batch Job tests in the restaurant sample
- Bugfix: Fixed the error received when the Spring Boot Application from sample application that is created from maven archetype is launched
- Bugfix: Fix for 404 error received when clicked on the link '1. Table' in index.html of the sample application created from maven archetype

More details on features added [can be found here:](https://github.com/oasp/oasp4j/milestone/23?closed=1).
The OASP4j wiki and other documents are updated for release 2.3.0.

### Cobigen Enhancements

Previous versions of CobiGen are able to generate code for REST services only. Now it is possible to generate the code for SOAP services as well. There are two use cases available in CobiGen:

 - SOAP without nested data
 - SOAP nested data

The "nested data" use case is when there are 3 or more entities which are interrelated with each other. Cobigen will generate code which will return the nested data. Currently Cobigen services return ETO classes, Cobigen has been enhanced as to return CTO classes (ETO + relationship).

Apart from the SOAP code generation, the capability to express nested relationships have been added to the existing ReST code generator as well.

[Take a look here](https://github.com/devonfw/devon/wiki/cookbook-cobigen-advanced-use-cases-soap-and-nested-data)

### Micro services module (Spring Cloud/Netflix OSS)

To make it easier for devonfw users to design and develop applications based on microservices, this release provides a series of archetypes and resources based on _Spring Cloud Netflix_ to automate the creation and configuration of microservices.

New documentation ind de devonfw Guide contais all the details to start [creating microservices with Devonfw](https://github.com/devonfw/devon/wiki/devon-microservices)

### Spring Integration Module

Based on the _Java Message Service_ (JMS) and _Spring Integration_, the devonfw _Integration module_ provides a communication system (sender/subscriber) out-of-the-box with simple channels (only to send and read messages), request and reply channels (to send messages and responses) and request & reply asynchronously channels. You can find more details about the implementation in the [Devonfw guide](https://github.com/devonfw/devon/wiki/cookbook-integration-module).

### WebSphere & Wildfly deployment documentation

The new version of devonfw contains more elaborate and updated documentation about deployment on [WebSpere](https://github.com/devonfw/devon/wiki/cookbook-Deployment-on-WebSphere) and [Wildfly](https://github.com/devonfw/devon/wiki/cookbook-Deployment-on-Wildfly).

## Cooperation of CSD Italy & iCSD devonfw Core Team

### One Team approach of iCSD devonfw Core Team and CSD Italy created a real win-win situation

A strong collaborative approach and an intensive mutual exchange of support between the iCSD devonfw core team and Italian CSD teams lead to a valuable enhancement of devonfw -the iCSD development framework- based on the needs of a concrete sales PoC and a real customer project.

The cooperation between the iCSD Core Team and two Italian teams targeted to use the expertise of the devonfw core team members for the creation of concrete project deliverables and services to be proposed in sales process, which should base on devonfw as framework.

The collaboration created a classical win-win result. On the one hand it leads to an efficient asset creation and on the other hand it assured the feasibility of the created assets as enhancement of the devonfw framework itself.

### Benefit 1: Devonfw SOAP – a PoC for Intesa San Paolo project

In the Banking sector the usage of the SOAP protocol for web services is widespread. The PoC targeted on the enhancement of Cobigen - the devonfw code generator. With new implemented templates the generation of java classes for SOAP services should be enabled. The PoC started in January 2017 and was completed successfully within two months end of March. This new Cobigen feature will now enforce our delivery capability in the Banking sector. This feature will also be available for all other devonfw projects with the release of Devonfw version 2.2 "Courage". This release is scheduled for June 2017.

### Benefit 2: Italian Mobile Project Support

Part of the scope of the Italian CSD project HERA is the delivery of an Ionic kickstarter application integrated in the IBM Mobile First 7.1 platform. The kickstarter accelerates the mock-up development of new mobile apps based on this platform and effects a faster delivery. The collaboration between the devonfw core team and the Hera project team started in November 2016 and delivered successfully in March 2017.

The devonfw core team staffed and supported the project with experts in Angular 2 and Ionic 2. These experts enhanced devonfw with features, supporting these technologies. Based on this support and the new features, the HERA project team then implemented the kickstarter application. The first App, created with this kickstarter application will go live in May 2017.

The enhanced Ionic and Angular features will be available also for all other devonfw projects with the next release of Devonfw. Both  achievements are the results of a real one-team-approach of all team members, based on mutual trust and a strong will for collaboration.

Thanks to all contributors of these achievements:

_iCSD devonfw core Team_: Iwan Rochus Van der Kleijn, Santos Jimenez Linares, Roberto Garcia Marin, Kevin Dierks

_Team Intesa San Paolo, Italy_: Lorenzo Bazzani, Stefano Rossini, Niraj Borkar, Mumbai Offshore Team

_Hera project team_: Angelo Muresu, Tobia Zambon, Barbara Rossato, Santos Jiménez Linares, Kevin Dierks; Cristobal Belda-Perez, Roberto Garcia Marin.

## Contributors

Many thanks to christofneuberger, EastWindShak, ivanderk, maybeec, pablo-parra, ssarmokadam and anyone who we may have forgotten to add!

## Colophon

we-dev-on is a reader-supported publication dedicated to producing the best coverage of project info, opinions, news, events, tips & tricks from within the devonfw & OASP communities all over Capgemini APPS2.

Copyright © 2017 Capgemini
Licensed under the Apache License, Version 2.0


text:
package org.apache.camel.component.microprofile.metrics.gauge;

import java.util.concurrent.Callable;

import org.eclipse.microprofile.metrics.Gauge;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class LambdaGauge implements Gauge<Number> {
    private static final Logger LOG = LoggerFactory.getLogger(LambdaGauge.class);
    private final Callable<Number> callable;

    public LambdaGauge(Callable<Number> callable) {
        this.callable = callable;
    }

    @Override
    public Number getValue() {
        try {
            return this.callable.call();
        } catch (Exception e) {
            LOG.debug("Error retrieving LambdaGauge value due to: {}", e.getMessage());
            return 0;
        }
    }
}


text:
require "isolation/abstract_unit"
require "env_helpers"

class Rails::CredentialsTest < ActiveSupport::TestCase
  include ActiveSupport::Testing::Isolation, EnvHelpers

  setup :build_app
  teardown :teardown_app

  test "reads credentials from environment specific path" do
    write_credentials_override(:production)

    app("production")

    assert_equal "revealed", Rails.application.credentials.mystery
  end

  test "reads credentials from customized path and key" do
    write_credentials_override(:staging)
    add_to_env_config("production", "config.credentials.content_path = config.root.join('config/credentials/staging.yml.enc')")
    add_to_env_config("production", "config.credentials.key_path = config.root.join('config/credentials/staging.key')")

    app("production")

    assert_equal "revealed", Rails.application.credentials.mystery
  end

  test "reads credentials using environment variable key" do
    write_credentials_override(:production, with_key: false)

    switch_env("RAILS_MASTER_KEY", credentials_key) do
      app("production")

      assert_equal "revealed", Rails.application.credentials.mystery
    end
  end

  private
    def write_credentials_override(name, with_key: true)
      Dir.chdir(app_path) do
        Dir.mkdir  "config/credentials"
        File.write "config/credentials/#{name}.key", credentials_key if with_key

        # secret_key_base: secret
        # mystery: revealed
        File.write "config/credentials/#{name}.yml.enc",
          "vgvKu4MBepIgZ5VHQMMPwnQNsLlWD9LKmJHu3UA/8yj6x+3fNhz3DwL9brX7UA==--qLdxHP6e34xeTAiI--nrcAsleXuo9NqiEuhntAhw=="
      end
    end

    def credentials_key
      "2117e775dc2024d4f49ddf3aeb585919"
    end
end


text:
/**
 * Reduce the matched set to the ones that match an additional selector
 * @module core
 * @param {Selector} selector A selector expression to match elements against
 * @returns DollarJS (reduced set)
 * @example $('p').filter('.foo')
 */

$.fn.filter = function (selector) {
    if (!this.length || !selector) {
        return $();
    }

    return collect(filterNodes(this, selector));
};


text:
layout: post
date: 2021-03-07 10:53:24 +0000
title: Creating pairs of interlocking rainbow hearts 🌈
summary: A web app for creating pairs of hearts based on Pride flags.
tags: glitch generative-art fun-stuff
link: https://rainbow-hearts.glitch.me/
index:
  image: /images/2021/hearts_asexual_aromantic.svg
  tint_color: "#870788"
---

Here's a fun project I made today: create pairs of interlocking rainbow hearts: <http://rainbow-hearts.glitch.me>

The app makes transparent SVGs based on pride flags, which you can resize and drop on top of any background.
Here's a few examples:

This idea came from a [similar graphic I made for Valentine's Day](https://twitter.com/alexwlchan/status/1360919253738790915).
I used several tools to make it, and I had to assemble the final result by hand -- I wanted to see if I could create a pair of interlocked hearts as a single SVG.

Last year, I made an app for generating [rainbow Norse Valknuts](/2020/01/pride-valknuts/), and I was able to reuse some of the code -- although those were easier to draw then hearts.
Valknuts use all straight lines, so I could calculate exactly where each stripe should start/end.
Because hearts have curved sides, I had to do a bit more work to draw the overlaps.

I experimented with a combination of SVG clips and masks to get the final effect, and this was a fun project to learn how they work.
I write SVGs by hand, rather than using an app like Inkscape or Illustrator -- so understanding the core primitives is really useful.
I did learn a few useful things, which I'll write about as a separate blog post.

You can create your own hearts at <http://rainbow-hearts.glitch.me>, and you can read the source code [on GitHub](https://github.com/alexwlchan/rainbow-hearts).

There is more that unites the LGBTQ+ community than divides us, and I like these hearts as a visual reminder of that.


text:
title: Deploy to anynines
tags:
- deployment
- anynines
categories:
- continuous-deployment
---

[anynines](http://www.anynines.com) is a PaaS built on top of CloudFoundry and OpenStack.

They have a great [Getting Started](https://support.anynines.com/entries/60238466-Getting-started-with-anynines-using-the-CLI-v6) guide which we definitely encourage you to check out. Also, see their documentation available at [support.anynines.com](https://support.anynines.com/forums).

As for getting started with **anynines** on Codeship, start by getting your application to deploy from your local machine. Once this is done, you need to add the following environment variables to your project settings.

```
CF_USER
CF_PASSWORD
CF_ORG
CF_SPACE
CF_APPLICATION
```

Then create a new **script based** deployment and paste the following commands.

```shell
cf6 api https://api.de.a9s.eu
cf6 auth "${CF_USER}" "${CF_PASSWORD}"
cf6 target -o "${CF_ORG}" -s "${CF_SPACE}"
cf6 push "${CF_APPLICATION}"
```

This will deploy your application on each push to the specific branch you configured the deployment for.

If you have more thorough requirements, like _blue / green deployments_ see a great article written by the folks at _anynines_ about deploying to Codeship, which is  [available at their blog](http://blog.anynines.com/setup-continuous-deployment-anynines-codeship-com/).


text:
TEST(MainTest, True) {
    EXPECT_EQ(1, 1);
}

int main (int argc, char **argv) {
    ::testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}


text:
NestedObjective::NestedObjective(ObjectiveFunction * innerObjective) {
	this->innerObjective = innerObjective;
}

void NestedObjective::registerInternalObjects() {
	ObjectiveFunction::registerInternalObjects();
	HierGC::registerObject(this->innerObjective);
}

bool NestedObjective::isNested() {
	return true;
}

Fitness NestedObjective::checkInnerFitness(Genome* target) {
	return this->innerObjective->checkFitness(target);
}

std::vector<ObjectiveFunction*> NestedObjective::getInner() {
	std::vector<ObjectiveFunction*> inner;
	if (this->innerObjective->isNested())
		inner = ((NestedObjective*)this->innerObjective)->getInner();
	inner.push_back(this->innerObjective);

	return inner;
}


text:
echo "Creating SSL certificates"
openssl genrsa -out /etc/ssl/private/${KEY_NAME}.key 1024

openssl req  -new -newkey rsa:4096 -days 365 -nodes -config /crt-config.cnf -subj "/" -keyout /etc/ssl/private/${KEY_NAME}.key -out /etc/ssl/private/${KEY_NAME}.csr  && \
    openssl x509 -req -days 365 -in /etc/ssl/private/${KEY_NAME}.csr -signkey /etc/ssl/private/${KEY_NAME}.key -out /etc/ssl/private/${KEY_NAME}.crt

cat /etc/ssl/private/${KEY_NAME}.crt /etc/ssl/private/${KEY_NAME}.key \
           |  tee /etc/ssl/certs/${KEY_NAME}.pem


text:
<?php

namespace Kacer\TwigGettext\Extractor;

class Extractor {

    const VARIABLE = 0;
    const MSGID = 'msgid';
    const MSGID_PLURAL = 'msgid_plural';
    const DOMAIN = 'domain';
    const CATEGORY = 'category';
    const CONTEXT = 'context';

    protected $strings = array();
    protected $file;
    protected $lexer;
    protected $parser;
    protected $poStringFactory;
    protected $inFormatFilterContext = false;

    /**
     * @param \Twig_Environment $twig Twig instance.
     * @param PoStringFactoryInterface $PoStringFactory An object for constructing POString objects.
     */
    public function __construct(\Twig_Environment $twig, PoStringFactoryInterface $PoStringFactory) {
        $this->poStringFactory = $PoStringFactory;
        $this->lexer = new \Twig_Lexer($twig);
        $this->parser = new \Twig_Parser($twig);
    }

    /**
     * Extracts all gettext strings from template.
     * @return PoStringInterface[] Array of POString objects.
     */
    public function extract(\Twig_Source $source): array {
        $this->strings = [];
        $tokens = $this->lexer->tokenize($source);
        $node = $this->parser->parse($tokens);
        $this->processNode($node);

        return $this->strings;
    }

    /**
     * Extracts all gettext strings from given Twig template file.
     *
     * @param string $file Path to Twig template file.
     * @return PoStringInterface[] Array of POString objects.
     */
    public function extractFromFile(string $file): array {
        $this->file = $file;
        $content = file_get_contents($file);
        $source = new \Twig_Source($content, 'file', $file);
        $strings = $this->extract($source);

        return $strings;
    }

    /**
     * Extracts all gettext strings from given Twig template code.
     * @param string $content Content of Twig template.
     * @return PoStringInterface[] Array of POString objects.
     */
    public function extractFromString(string $content): array {
        $this->file = 'string';
        $source = new \Twig_Source($content, 'string');
        $strings = $this->extract($source);

        return $strings;
    }

    /**
     * Processes a node and its child nodes recursively.
     *
     * @param \Twig_Node $node
     * @param bool $inFormatFilterContext Set to true if we're descending into a `format` filter, parameter is passed down recursively.
     */
    protected function processNode(\Twig_Node $node, bool $inFormatFilterContext = false) {
        $this->inFormatFilterContext = $inFormatFilterContext;

        switch (true) {
            case $node instanceof \Twig_Node_Expression_Function :
                $this->processFunctionNode($node);
                break;
            case $node instanceof \Twig_Node_Expression_Filter :
                $this->processFilterNode($node);
                break;
        }

        foreach ($node as $child) {
            if ($child instanceof \Twig_Node) {
                $this->processNode($child, $inFormatFilterContext || $this->isFormatFilter($node));
            }
        }
    }

    /**
     * @param \Twig_Node $node The node to be checked.
     * @return bool True if $node is a `format` filter.
     */
    protected function isFormatFilter(\Twig_Node $node): bool {
        return $node instanceof \Twig_Node_Expression_Filter && $node->getNode('filter')->getAttribute('value') == 'format';
    }

    /**
     * Processes a Function node.
     *
     * @param \Twig_Node_Expression_Function $node
     */
    protected function processFunctionNode(\Twig_Node_Expression_Function $node) {
        switch ($node->getAttribute('name')) {
            case '_' :
            case 'gettext' :
                $this->pushFunction($node, self::MSGID);
                break;
            case '_p' :
            case 'pgettext' :
                $this->pushFunction($node, self::CONTEXT, self::MSGID);
                break;
            case '_n' :
            case 'ngettext' :
                $this->pushFunction($node, self::MSGID, self::MSGID_PLURAL, self::VARIABLE);
                break;
            case '_np' :
            case 'npgettext' :
                $this->pushFunction($node, self::CONTEXT, self::MSGID, self::MSGID_PLURAL, self::VARIABLE);
                break;
            case '_d' :
            case 'dgettext' :
                $this->pushFunction($node, self::DOMAIN, self::MSGID);
                break;
            case '_dp' :
            case 'dpgettext' :
                $this->pushFunction($node, self::CONTEXT, self::DOMAIN, self::MSGID);
                break;
            case '_dn' :
            case 'dngettext' :
                $this->pushFunction($node, self::DOMAIN, self::MSGID, self::MSGID_PLURAL, self::VARIABLE);
                break;
            case '_dnp' :
            case 'dnpgettext' :
                $this->pushFunction($node, self::CONTEXT, self::DOMAIN, self::MSGID, self::MSGID_PLURAL, self::VARIABLE);
                break;
            case '_dc' :
            case 'dcgettext' :
                $this->pushFunction($node, self::DOMAIN, self::MSGID, self::CATEGORY);
                break;
            case '_dcp' :
            case 'dcpgettext' :
                $this->pushFunction($node, self::CONTEXT, self::DOMAIN, self::MSGID, self::CATEGORY);
                break;
            case '_dcn' :
            case 'dcngettext' :
                $this->pushFunction($node, self::DOMAIN, self::MSGID, self::MSGID_PLURAL, self::VARIABLE, self::CATEGORY);
                break;
            case '_dcnp' :
            case 'dcnpgettext' :
                $this->pushFunction($node, self::CONTEXT, self::DOMAIN, self::MSGID, self::MSGID_PLURAL, self::VARIABLE, self::CATEGORY);
                break;
        }
    }

    /**
     * Processes a Filter node.
     *
     * @param \Twig_Node_Expression_Filter $node
     */
    protected function processFilterNode(\Twig_Node_Expression_Filter $node) {
        switch ($node->getNode('filter')->getAttribute('value')) {
            case '_' :
            case 'gettext' :
                $this->pushFilter($node);
                break;
            case '_p' :
            case 'pgettext' :
                $this->pushFilter($node, self::CONTEXT);
                break;
            case '_n' :
            case 'ngettext' :
                $this->pushFilter($node, self::MSGID_PLURAL);
                break;
            case '_np' :
            case 'npgettext' :
                $this->pushFilter($node, self::MSGID_PLURAL, self::VARIABLE, self::CONTEXT);
                break;
            case '_d' :
            case 'dgettext' :
                $this->pushFilter($node, self::DOMAIN);
                break;
            case '_dp' :
            case 'dpgettext' :
                $this->pushFilter($node, self::DOMAIN, self::CONTEXT);
                break;
            case '_dn' :
            case 'dngettext' :
                $this->pushFilter($node, self::MSGID_PLURAL, self::VARIABLE, self::DOMAIN);
                break;
            case '_dnp' :
            case 'dnpgettext' :
                $this->pushFilter($node, self::MSGID_PLURAL, self::VARIABLE, self::DOMAIN, self::CONTEXT);
                break;
            case '_dc' :
            case 'dcgettext' :
                $this->pushFilter($node, self::DOMAIN, self::CATEGORY);
                break;
            case '_dcp' :
            case 'dcpgettext' :
                $this->pushFilter($node, self::DOMAIN, self::CATEGORY, self::CONTEXT);
                break;
            case '_dcn' :
            case 'dcngettext' :
                $this->pushFilter($node, self::MSGID_PLURAL, self::VARIABLE, self::DOMAIN, self::CATEGORY);
                break;
            case '_dcnp' :
            case 'dcnpgettext' :
                $this->pushFilter($node, self::MSGID_PLURAL, self::VARIABLE, self::DOMAIN, self::CATEGORY, self::CONTEXT);
                break;
        }
    }

    /**
     * Parses arguments of a Function node and pushes entry into list of extracted strings.
     *
     * @param \Twig_Node_Expression_Function $node
     * @param mixed Variable number of arguments representing roles of the Twig function arguments.
     */
    protected function pushFunction(\Twig_Node_Expression_Function $node /* , arg, .. */) {
        $args = func_get_args();
        array_shift($args);

        $valueNodes = array();

        foreach ($node->getNode('arguments') as $i => $argumentNode) {
            if (!isset($args[$i])) {
                break;
            }
            $valueNodes[$args[$i]] = $argumentNode;
        }

        $this->pushEntry($node, $valueNodes);
    }

    /**
     * Parses arguments of a Filter node and pushes entry into list of extracted strings.
     *
     * @param \Twig_Node_Expression_Filter $node
     * @param mixed Variable number of arguments representing roles of the Twig filter arguments.
     */
    protected function pushFilter(\Twig_Node_Expression_Filter $node /* , arg, .. */) {
        $args = func_get_args();
        array_shift($args);

        $valueNodes = array(self::MSGID => $node->getNode('node'));

        foreach ($node->getNode('arguments') as $i => $argumentNode) {
            if (!isset($args[$i])) {
                break;
            }
            $valueNodes[$args[$i]] = $argumentNode;
        }

        $this->pushEntry($node, $valueNodes);
    }

    /**
     * Pushes entry into list of extracted strings.
     *
     * @param \Twig_Node_Expression $node
     * @param array $valueNodes Associative array of value nodes (values) and their role (keys).
     */
    protected function pushEntry(\Twig_Node_Expression $node, array $valueNodes) {
        if (!isset($valueNodes[self::MSGID])) {
            throw new \LogicException('$valueNodes array must contain a MSGID value');
        }

        $POString = $this->poStringFactory->construct($valueNodes[self::MSGID]->getAttribute('value'));

        foreach ($valueNodes as $type => $argument) {
            if ($type === self::VARIABLE) {
                continue;
            } else if (!($argument instanceof \Twig_Node_Expression_Constant)) {
                $this->invalidArgumentTypeParseError($argument, $node);
            }

            switch ($type) {
                case self::MSGID :
                    break;
                case self::MSGID_PLURAL :
                    $POString->setMsgidPlural($argument->getAttribute('value'));
                    break;
                case self::DOMAIN :
                    $POString->setDomain($argument->getAttribute('value'));
                    break;
                case self::CATEGORY :
                    $POString->setCategory($argument->getAttribute('value'));
                    break;
                case self::CONTEXT :
                    $POString->setMsgctxt($argument->getAttribute('value'));
                    break;
                default :
                    throw new \InvalidArgumentException("Invalid argument '$type'");
            }
        }

        $POString->addReference(sprintf("$this->file:%d", $node->getTemplateLine()));

        if ($this->inFormatFilterContext) {
            $POString->addFlag('php-format');
        }

        $this->strings[] = $POString;
    }

    /**
     * Throws an exception with detailed error message in case of argument parse errors.
     *
     * @param \Twig_Node_Expression $argument The invalid/unexpected argument node.
     * @param \Twig_Node_Expression $node The Filter or Function node to which the $argument belongs.
     * @throws \InvalidArgumentException (The main purpose.)
     * @throws \LogicException In case an unexpected $node argument was passed.
     */
    protected function invalidArgumentTypeParseError(\Twig_Node_Expression $argument, \Twig_Node_Expression $node) {
        switch (true) {
            case $node instanceof \Twig_Node_Expression_Function :
                $name = $node->getAttribute('name');
                break;
            case $node instanceof \Twig_Node_Expression_Filter :
                $name = $node->getNode('filter')->getAttribute('value');
                break;
            default :
                throw new \LogicException(sprintf("Don't know how to get name of node %s to throw an InvalidArgumentException",
                                get_class($node)));
        }

        throw new \InvalidArgumentException(sprintf('Invalid argument of type %s for %s in %s on line %d',
                        get_class($argument), $name, $this->file, $node->getTemplateLine()));
    }

}


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

namespace ZocMonLib
{
    public class Bucket
    {
        /// <summary>
        /// Primary identifier
        /// </summary>
        public int BucketId { get; set; }

        /// <summary>
        /// Name of the monitor in place
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// Reduction type that is currently being used
        /// </summary>
        public MonitorReductionType MonitorReductionType { get; set; }

        /// <summary>
        /// Reduce levels that are relevent for this config
        /// </summary>
        public IList<ReduceLevel> ReduceLevels { get; set; }

        /// <summary>
        /// Type of aggregation that is being used for this reduction
        /// </summary>
        public string ReduceMethodClassName { get; set; }

        /// <summary>
        /// Aggregation object that is assigned and can be use
        /// </summary>
        public IReduceMethod<double> ReduceMethodClass { get; set; }
    }
}


text:
<?php

/**
 * PageTranslation filter form.
 *
 * @package    sf_sandbox
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class PageTranslationFormFilter extends BasePageTranslationFormFilter
{
  public function configure()
  {
  }
}


text:
// flowlint ambiguous-object-type:error

'use strict';

import type {fetchQueryTest1Query$data} from './__generated__/fetchQueryTest1Query.graphql';

const fetchQuery = require('../fetchQuery');
const {
  createOperationDescriptor,
  getRequest,
  graphql,
} = require('relay-runtime');
const {createMockEnvironment} = require('relay-test-utils-internal');

const response = {
  data: {
    node: {
      __typename: 'User',
      id: '4',
    },
  },
};

describe('fetchQuery', () => {
  let query;
  let variables;
  let environment;
  let retained = [];
  beforeEach(() => {
    retained = [];
    environment = createMockEnvironment();
    // $FlowFixMe[method-unbinding] added when improving typing for this parameters
    environment.retain.mockImplementation(obj => {
      const idx = retained.push(obj);
      return {
        dispose: () => {
          retained = retained.filter((o, ii) => ii === idx);
        },
      };
    });
    variables = {id: '4'};
    query = graphql`
      query fetchQueryTest1Query($id: ID!) {
        node(id: $id) {
          id
        }
      }
    `;
  });
  it('fetches request and does not retain data', () => {
    let calledObserver = false;
    const observer = {
      complete: () => {
        calledObserver = true;
        expect(retained.length).toEqual(0);
      },
    };
    const subscription = fetchQuery(environment, query, variables).subscribe(
      observer,
    );
    const queryNode = getRequest(query);
    environment.mock.nextValue(queryNode, response);
    environment.mock.complete(queryNode);
    subscription.unsubscribe();
    expect(calledObserver).toEqual(true);
    expect(retained.length).toEqual(0);
  });

  it('provides data snapshot on next', () => {
    let calledNext = false;
    const observer = {
      next: (data: fetchQueryTest1Query$data) => {
        calledNext = true;
        expect(retained.length).toEqual(0);
        expect(data).toEqual({
          node: {
            id: '4',
          },
        });
      },
    };
    fetchQuery(environment, query, variables).subscribe(observer);
    const queryNode = getRequest(query);
    environment.mock.nextValue(queryNode, response);
    expect(calledNext).toEqual(true);
    environment.mock.complete(queryNode);
    expect(retained.length).toEqual(0);
  });

  it('unsubscribes when request is disposed', () => {
    let calledNext = false;
    let calledUnsubscribe = false;
    const observer = {
      next: () => {
        calledNext = true;
        expect(retained.length).toEqual(0);
      },
      unsubscribe: () => {
        calledUnsubscribe = true;
      },
    };
    const subscription = fetchQuery(environment, query, variables).subscribe(
      observer,
    );
    const queryNode = getRequest(query);
    environment.mock.nextValue(queryNode, response);
    subscription.unsubscribe();
    expect(calledNext).toEqual(true);
    expect(calledUnsubscribe).toEqual(true);
  });

  it('handles error correctly', () => {
    let calledError = false;
    const observer = {
      error: (error: Error) => {
        calledError = true;
        expect(error.message).toEqual('Oops');
        expect(retained.length).toEqual(0);
      },
    };
    const subscription = fetchQuery(environment, query, variables).subscribe(
      observer,
    );
    const queryNode = getRequest(query);
    environment.mock.reject(queryNode, new Error('Oops'));
    expect(calledError).toEqual(true);
    expect(retained.length).toEqual(0);
    subscription.unsubscribe();
  });

  describe('.toPromise()', () => {
    it('fetches request and does not retain query data', async () => {
      const promise = fetchQuery(environment, query, variables).toPromise();
      const queryNode = getRequest(query);
      expect(
        environment.mock.isLoading(queryNode, variables, {force: true}),
      ).toEqual(true);
      environment.mock.nextValue(queryNode, response);
      const data = await promise;
      expect(data).toEqual({
        node: {
          id: '4',
        },
      });
      expect(
        environment.mock.isLoading(queryNode, variables, {force: true}),
      ).toEqual(true);
      expect(retained.length).toEqual(0);

      environment.mock.complete(queryNode);
      expect(
        environment.mock.isLoading(queryNode, variables, {force: true}),
      ).toEqual(false);
      expect(retained.length).toEqual(0);
    });

    it('rejects when error occurs', async () => {
      const promise = fetchQuery(environment, query, variables).toPromise();
      const queryNode = getRequest(query);
      expect(
        environment.mock.isLoading(queryNode, variables, {force: true}),
      ).toEqual(true);
      environment.mock.reject(queryNode, new Error('Oops'));
      try {
        await promise;
      } catch (error) {
        expect(error.message).toEqual('Oops');
      }
      expect(
        environment.mock.isLoading(queryNode, variables, {force: true}),
      ).toEqual(false);
      expect(retained.length).toEqual(0);
    });
  });

  describe('store-or-network fetchPolicy', () => {
    it('fetches data if not cached yet', async () => {
      const promise = fetchQuery(environment, query, variables, {
        fetchPolicy: 'store-or-network',
      }).toPromise();
      const queryNode = getRequest(query);
      // Needs to load data from network
      expect(
        environment.mock.isLoading(queryNode, variables, {force: true}),
      ).toEqual(true);
      environment.mock.nextValue(queryNode, response);
      const data = await promise;
      expect(data).toEqual({
        node: {
          id: '4',
        },
      });
    });
    it('reads from store if cached already', async () => {
      // Populate the store
      const queryNode = getRequest(query);
      const operation = createOperationDescriptor(queryNode, variables);
      environment.getStore().retain(operation);
      environment.commitPayload(operation, response.data);

      // Fetch after data is in store
      const promise = fetchQuery(environment, query, variables, {
        fetchPolicy: 'store-or-network',
      }).toPromise();
      // Shouldn't be loading because the data is already cached
      expect(
        environment.mock.isLoading(getRequest(query), variables, {force: true}),
      ).toEqual(false);
      const data = await promise;
      expect(data).toEqual({
        node: {
          id: '4',
        },
      });
    });
  });
});

describe('fetchQuery with missing @required value', () => {
  it('provides data snapshot on next', () => {
    const requiredFieldLogger = jest.fn();
    const environment = createMockEnvironment({
      requiredFieldLogger,
    });
    const query = graphql`
      query fetchQueryTest2Query {
        me {
          name @required(action: LOG)
        }
      }
    `;

    const observer = {next: jest.fn()};
    const subscription = fetchQuery(environment, query, {}).subscribe(observer);
    expect(observer.next).not.toHaveBeenCalled();
    const queryNode = getRequest(query);

    environment.mock.nextValue(queryNode, {
      data: {
        me: {
          name: null,
        },
      },
    });
    subscription.unsubscribe();
    expect(observer.next).toHaveBeenCalledWith({me: null});
    expect(requiredFieldLogger).toHaveBeenCalledWith({
      fieldPath: 'me.name',
      kind: 'missing_field.log',
      owner: 'fetchQueryTest2Query',
    });
  });

  it('throws on resolution', () => {
    const requiredFieldLogger = jest.fn();
    const environment = createMockEnvironment({requiredFieldLogger});
    const query = graphql`
      query fetchQueryTest3Query {
        me {
          name @required(action: THROW)
        }
      }
    `;

    const observer = {next: jest.fn(), error: jest.fn()};
    const subscription = fetchQuery(environment, query, {}).subscribe(observer);
    const queryNode = getRequest(query);

    expect(observer.next).not.toHaveBeenCalled();
    expect(observer.error).not.toHaveBeenCalled();

    environment.mock.nextValue(queryNode, {data: {me: {name: null}}});
    subscription.unsubscribe();
    expect(requiredFieldLogger).toHaveBeenCalledWith({
      fieldPath: 'me.name',
      kind: 'missing_field.throw',
      owner: 'fetchQueryTest3Query',
    });
    expect(observer.error).toHaveBeenCalledWith(
      Error(
        "Relay: Missing @required value at path 'me.name' in 'fetchQueryTest3Query'.",
      ),
    );
    expect(observer.next).not.toHaveBeenCalled();
  });

  it('does not report missing required values in fragments', () => {
    const environment = createMockEnvironment({});
    graphql`
      fragment fetchQueryTestFragment on User {
        name @required(action: THROW)
      }
    `;
    const query = graphql`
      query fetchQueryTest4Query {
        me {
          ...fetchQueryTestFragment
        }
      }
    `;

    const observer = {next: jest.fn(), error: jest.fn()};
    const subscription = fetchQuery(environment, query, {}).subscribe(observer);
    const queryNode = getRequest(query);
    environment.mock.nextValue(queryNode, {data: {me: {name: null}}});

    subscription.unsubscribe();

    expect(observer.error).not.toHaveBeenCalled();
  });
});


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>lessvoid</groupId>
    <artifactId>nifty-main</artifactId>
    <version>1.4.2-SNAPSHOT</version>
  </parent>
  <artifactId>nifty-minim-soundsystem</artifactId>
  <name>Nifty Sound Device for Processing (minim)</name>
  <description>Implementation of Nifty's AudioDevice for the Minim audio library</description>
  <repositories>
    <repository>
	  <id>clojars.org</id>
	  <url>http://clojars.org/repo</url>
	</repository>
  </repositories>
  <dependencies>
	<dependency>
	  <groupId>ddf.minim</groupId>
	  <artifactId>ddf.minim</artifactId>
	  <version>2.2.0</version>
	</dependency>
    <dependency>
      <groupId>lessvoid</groupId>
      <artifactId>nifty</artifactId>
      <version>1.4.2-SNAPSHOT</version>
    </dependency>
  </dependencies>
</project>


text:
const fs = require("fs");
const path = require("path");
const mark = require("marked");

fs.readdir('./markdown', function(error, files) {
    for(let item of files) {
        let p = path.join('./markdown', item);
        fs.readFile(p, 'utf-8', function(error, data) {
            const content = data.toString();
            console.log(content);
            const mardown = mark(content);
            let template = fs.readFileSync('./template.html').toString();
            let result =  template.replace('%content%', mardown);
            fs.writeFileSync("./pulic/" + item + '.html', result);
        });
    }
});


text:
#ifndef _H_xpath1
#define _H_xpath1

/*  FILE: xpath1.h
*********************************************************************
*								    *
*			 P U R P O S E				    *
*								    *
*********************************************************************

    XPath 1.0 expression support

*********************************************************************
*								    *
*		   C H A N G E	 H I S T O R Y			    *
*								    *
*********************************************************************

date	     init     comment
----------------------------------------------------------------------
13-nov-08    abb      Begun

*/

#ifndef _H_dlq
#include "dlq.h"
#endif

#ifndef _H_ncxtypes
#include "ncxtypes.h"
#endif

#ifndef _H_obj
#include "obj.h"
#endif

#ifndef _H_status
#include "status.h"
#endif

#ifndef _H_tk
#include "tk.h"
#endif

#ifndef _H_val
#include "val.h"
#endif

#ifndef _H_xpath
#include "xpath.h"
#endif

#ifdef __cplusplus
extern "C" {
#endif

/********************************************************************
*								    *
*			 C O N S T A N T S			    *
*								    *
*********************************************************************/

/********************************************************************
*								    *
*			     T Y P E S				    *
*								    *
*********************************************************************/

/********************************************************************
*								    *
*			F U N C T I O N S			    *
*								    *
*********************************************************************/

/********************************************************************
* FUNCTION xpath1_parse_expr
*
* Parse the XPATH 1.0 expression string.
*
* parse initial expr with YANG prefixes: must/when
* the object is left out in case it is in a grouping
*
* This is just a first pass done when the
* XPath string is consumed.  If this is a
* YANG file source then the prefixes will be
* checked against the 'mod' import Q
*
* The expression is parsed into XPath tokens
* and checked for well-formed syntax and function
* invocations. Any variable
*
* If the source is XP_SRC_INSTANCEID, then YANG
* instance-identifier syntax is followed, not XPath 1.0
* This is only used by instance-identifiers in
* default-stmt, conf file, CLI, etc.
*
* Error messages are printed by this function!!
* Do not duplicate error messages upon error return
*
*
* INPUTS:
*    tkc == parent token chain
*    mod == module in progress
*    pcb == initialized xpath parser control block
*           for the expression; use xpath_new_pcb
*           to initialize before calling this fn
*           The pcb->exprstr MUST BE SET BEFORE THIS CALL
*    source == enum indicating source of this expression
*
* OUTPUTS:
*   pcb->tkc is filled and then partially validated
*   pcb->parseres is set
*
* RETURNS:
*   status
*********************************************************************/
extern status_t
    xpath1_parse_expr (tk_chain_t *tkc,
		       ncx_module_t *mod,
		       xpath_pcb_t *pcb,
		       xpath_source_t source);

/********************************************************************
* FUNCTION xpath1_validate_expr
*
* Validate the previously parsed expression string
*   - QName prefixes are valid
*   - function calls are well-formed and exist in
*     the pcb->functions array
*   - variable references exist in the pcb->varbindQ
*
* parse expr with YANG prefixes: must/when
* called from final OBJ xpath check after all
* cooked objects are in place
*
* Called after all 'uses' and 'augment' expansion
* so validation against cooked object tree can be done
*
* Error messages are printed by this function!!
* Do not duplicate error messages upon error return
*
* INPUTS:
*    mod == module containing the 'obj' (in progress)
*    obj == object containing the XPath clause
*    pcb == the XPath parser control block to process
*
* OUTPUTS:
*   pcb->obj and pcb->objmod are set
*   pcb->validateres is set
*
* RETURNS:
*   status
*********************************************************************/
extern status_t
    xpath1_validate_expr (ncx_module_t *mod,
			  obj_template_t *obj,
			  xpath_pcb_t *pcb);

/********************************************************************
* FUNCTION xpath1_validate_expr_ex
*
* Validate the previously parsed expression string
*   - QName prefixes are valid
*   - function calls are well-formed and exist in
*     the pcb->functions array
*   - variable references exist in the &pcb->varbindQ
*
* parse expr with YANG prefixes: must/when
* called from final OBJ xpath check after all
* cooked objects are in place
*
* Called after all 'uses' and 'augment' expansion
* so validation against cooked object tree can be done
*
* Error messages are printed by this function!!
* Do not duplicate error messages upon error return
*
* INPUTS:
*    mod == module containing the 'obj' (in progress)
*    obj == object containing the XPath clause
*    pcb == the XPath parser control block to process
*    missing_is_error == TRUE if a missing node is an error
*                     == FALSE if a warning
* OUTPUTS:
*   pcb->obj and pcb->objmod are set
*   pcb->validateres is set
*
* RETURNS:
*   status
*********************************************************************/
extern status_t
    xpath1_validate_expr_ex (ncx_module_t *mod,
                             obj_template_t *obj,
                             xpath_pcb_t *pcb,
                             boolean missing_is_error);

/********************************************************************
* FUNCTION xpath1_eval_expr
*
* use if the prefixes are YANG: must/when
* Evaluate the expression and get the expression nodeset result
*
* INPUTS:
*    pcb == XPath parser control block to use
*    val == start context node for value of current()
*    docroot == ptr to cfg->root or top of rpc/rpc-replay/notif tree
*    logerrors == TRUE if log_error and ncx_print_errormsg
*                  should be used to log XPath errors and warnings
*                 FALSE if internal error info should be recorded
*                 in the xpath_result_t struct instead
*    configonly ==
*           XP_SRC_XML:
*                 TRUE if this is a <get-config> call
*                 and all config=false nodes should be skipped
*                 FALSE if <get> call and non-config nodes
*                 will not be skipped
*           XP_SRC_YANG and XP_SRC_LEAFREF:
*                 should be set to false
*     res == address of return status
*
* OUTPUTS:
*   *res is set to the return status
*
*
* RETURNS:
*   malloced result struct with expr result
*   NULL if no result produced (see *res for reason)
*********************************************************************/
extern xpath_result_t *
    xpath1_eval_expr (xpath_pcb_t *pcb,
		      val_value_t *val,
		      val_value_t *docroot,
		      boolean logerrors,
		      boolean configonly,
		      status_t *res);

/********************************************************************
* FUNCTION xpath1_eval_xmlexpr
*
* use if the prefixes are XML: select
* Evaluate the expression and get the expression nodeset result
* Called from inside the XML parser, so the XML reader
* must be used to get the XML namespace to prefix mappings
*
* INPUTS:
*    reader == XML reader to use
*    pcb == initialized XPath parser control block
*           the xpath_new_pcb(exprstr) function is
*           all that is needed.  This function will
*           call xpath1_parse_expr if it has not
*           already been called.
*    val == start context node for value of current()
*    docroot == ptr to cfg->root or top of rpc/rpc-replay/notif tree
*    logerrors == TRUE if log_error and ncx_print_errormsg
*                  should be used to log XPath errors and warnings
*                 FALSE if internal error info should be recorded
*                 in the xpath_result_t struct instead
*                !!! use FALSE unless DEBUG mode !!!
*    configonly ==
*           XP_SRC_XML:
*                 TRUE if this is a <get-config> call
*                 and all config=false nodes should be skipped
*                 FALSE if <get> call and non-config nodes
*                 will not be skipped
*           XP_SRC_YANG and XP_SRC_LEAFREF:
*                 should be set to false
*     res == address of return status
*
* OUTPUTS:
*   *res is set to the return status
*
* RETURNS:
*   malloced result struct with expr result
*   NULL if no result produced (see *res for reason)
*********************************************************************/
extern xpath_result_t *
    xpath1_eval_xmlexpr (xmlTextReaderPtr reader,
			 xpath_pcb_t *pcb,
			 val_value_t *val,
			 val_value_t *docroot,
			 boolean logerrors,
			 boolean configonly,
			 status_t *res);

/********************************************************************
* FUNCTION xpath1_get_functions_ptr
*
* Get the start of the function array for XPath 1.0 plus
* the current() function
*
* RETURNS:
*   pointer to functions array
*********************************************************************/
extern const xpath_fncb_t *
    xpath1_get_functions_ptr (void);

/********************************************************************
* FUNCTION xpath1_prune_nodeset
*
* Check the current result nodeset and remove
* any redundant nodes from a NETCONF POV
* Any node that has an ancestor already in
* the result will be deleted
*
* INPUTS:
*    pcb == XPath parser control block to use
*    result == XPath result nodeset to prune
*
* OUTPUTS:
*    some result->nodeQ contents adjusted or removed
*
*********************************************************************/
extern void
    xpath1_prune_nodeset (xpath_pcb_t *pcb,
			  xpath_result_t *result);

/********************************************************************
* FUNCTION xpath1_check_node_exists
*
* Check if any ancestor-ot-self node is already in the specified Q
* ONLY FOR VALUE NODES IN THE RESULT
*
* This is only done after all the nodes have been processed
* and the nodeset is complete.  For NETCONF purposes,
* the entire path to root is added for the context node,
* and the entire context node contexts are always returned
*
* INPUTS:
*    pcb == parser control block to use
*    resultQ == Q of xpath_resnode_t structs to check
*               DOES NOT HAVE TO BE WITHIN A RESULT NODE Q
*    val   == value node pointer value to find
*
* RETURNS:
*    TRUE if found, FALSE otherwise
*********************************************************************/
extern boolean
    xpath1_check_node_exists (xpath_pcb_t *pcb,
			      dlq_hdr_t *resultQ,
			      const val_value_t *val);

/********************************************************************
* FUNCTION xpath1_check_node_exists_slow
*
* Check if any ancestor-ot-self node is already in the specified Q
* ONLY FOR VALUE NODES IN THE RESULT
*
* This is only done after all the nodes have been processed
* and the nodeset is complete.  For NETCONF purposes,
* the entire path to root is added for the context node,
* and the entire context node contexts are always returned
*
* INPUTS:
*    pcb == parser control block to use
*    resultQ == Q of xpath_resnode_t structs to check
*               DOES NOT HAVE TO BE WITHIN A RESULT NODE Q
*    val   == value node pointer value to find
*
* RETURNS:
*    TRUE if found, FALSE otherwise
*********************************************************************/
extern boolean
    xpath1_check_node_exists_slow (xpath_pcb_t *pcb,
                                   dlq_hdr_t *resultQ,
                                   const val_value_t *val);

/********************************************************************
* FUNCTION xpath1_stringify_nodeset
*
* Convert a value node pointer to a string node
* ONLY FOR VALUE NODES IN THE RESULT
*
*   string(nodeset)
*
* INPUTS:
*    pcb == parser control block to use
*    result == result to stringify
*    str == address of return string
*
* OUTPUTS:
*    *str == malloced and filled in string (if NO_ERR)
*
* RETURNS:
*    status, NO_ER or ERR_INTERNAL_MEM, etc.
*********************************************************************/
extern status_t
    xpath1_stringify_nodeset (xpath_pcb_t *pcb,
			      const xpath_result_t *result,
			      xmlChar **str);

/*******************************************************************
* FUNCTION xpath1_stringify_node
*
* Convert a value node to a string node
*
*   string(node)
*
* INPUTS:
*    pcb == parser control block to use
*    val == value node to stringify
*    str == address of return string
*
* OUTPUTS:
*    *str == malloced and filled in string (if NO_ERR)
*
* RETURNS:
*    status, NO_ER or ERR_INTERNAL_MEM, etc.
*********************************************************************/
extern status_t
    xpath1_stringify_node (xpath_pcb_t *pcb,
			   val_value_t *val,
			   xmlChar **str);

/********************************************************************
* FUNCTION xpath1_compare_result_to_string
*
* Compare an XPath result to the specified string
*
*    result = 'string'
*
* INPUTS:
*    pcb == parser control block to use
*    result == result struct to compare
*    strval == string value to compare to result
*    res == address of return status
*
* OUTPUTS:
*   *res == return status
*
* RETURNS:
*     equality relation result (TRUE or FALSE)
*********************************************************************/
extern boolean
    xpath1_compare_result_to_string (xpath_pcb_t *pcb,
				     xpath_result_t *result,
				     xmlChar *strval,
				     status_t *res);

/********************************************************************
* FUNCTION xpath1_compare_result_to_number
*
* Compare an XPath result to the specified number
*
*    result = number
*
* INPUTS:
*    pcb == parser control block to use
*    result == result struct to compare
*    numval == number struct to compare to result
*              MUST BE TYPE NCX_BT_FLOAT64
*    res == address of return status
*
* OUTPUTS:
*   *res == return status
*
* RETURNS:
*     equality relation result (TRUE or FALSE)
*********************************************************************/
extern boolean
    xpath1_compare_result_to_number (xpath_pcb_t *pcb,
				     xpath_result_t *result,
				     ncx_num_t *numval,
				     status_t *res);

/********************************************************************
* FUNCTION xpath1_compare_nodeset_results
*
* Compare an XPath result to another result
*
*    result1 = node-set
*    result2 = node-set
*
* INPUTS:
*    pcb == parser control block to use
*    result1 == result struct to compare
*    result2 == result struct to compare
*    res == address of return status
*
* OUTPUTS:
*   *res == return status
*
* RETURNS:
*     equality relation result (TRUE or FALSE)
*********************************************************************/
extern boolean
    xpath1_compare_nodeset_results (xpath_pcb_t *pcb,
                                    xpath_result_t *result1,
                                    xpath_result_t *result2,
                                    status_t *res);

#ifdef __cplusplus
}  /* end extern 'C' */
#endif

#endif	    /* _H_xpath1 */


text:
This is the repository for the [Vagrant website](https://www.vagrantup.com).

This is a [Middleman](https://middlemanapp.com) project, which builds a static
site from these source files. The site is hosted fronted by
[Fastly](https://www.fastly.com).

## Contributions Welcome!

If you find a typo or you feel like you can improve the HTML, CSS, or
JavaScript, we welcome contributions. Feel free to open issues or pull
requests like any normal GitHub project, and we will merge it in.

## Running the Site Locally

Running the site locally is simple. Clone this repo and run `make dev`.

Then open up `localhost:4567`. Note that some URLs you may need to append
".html" to make them work (in the navigation and such).


text:
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using d_f_32.KanColleCacher;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle(AssemblyInfo.Title)]
[assembly: AssemblyDescription(AssemblyInfo.Description)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct(AssemblyInfo.Name)]
[assembly: AssemblyCopyright(AssemblyInfo.Copyright)]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。  如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]

// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
//[assembly: Guid("7909a3f7-15a8-4ee5-afc5-11a7cfa40576")]
[assembly: Guid("DA0FF655-A2CA-40DC-A78B-6DC85C2D448B")]

// 程序集的版本信息由下面四个值组成:
//
//      主版本
//      次版本
//      生成号
//      修订号
//
// 可以指定所有这些值,也可以使用"生成号"和"修订号"的默认值,
// 方法是按如下所示使用"*":
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion(AssemblyInfo.Version)]
[assembly: AssemblyFileVersion(AssemblyInfo.Version)]

namespace d_f_32.KanColleCacher
{
	public static class AssemblyInfo
	{

		public const string Name = "KanColleCacher";
		public const string Version = "2.3.0.38";
		public const string Author = "d.f.32";
		public const string Copyright = "©2014 - d.f.32";
#if DEBUG
		public const string Title = "提督很忙!缓存工具 (DEBUG)";
#else
		public const string Title = "提督很忙!缓存工具";
#endif
		public const string Description = "通过创建本地缓存以加快游戏加载速度(并支持魔改)";
	}
}


text:
require 'formula'

class BerkeleyDb < Formula
  homepage 'http://www.oracle.com/technology/products/berkeley-db/index.html'
  url 'http://download.oracle.com/berkeley-db/db-5.3.28.tar.gz'
  sha1 'fa3f8a41ad5101f43d08bc0efb6241c9b6fc1ae9'

  bottle do
    cellar :any
    sha1 "82b52acb094e7f5cfb8f807f4501b47653744285" => :mavericks
    sha1 "32db77b55f8f864af939d842a85bed64347912e8" => :mountain_lion
    sha1 "6846c61e17ff5dcfe25f5aaf2e7e88b71758ea09" => :lion
  end

  option 'with-java', 'Compile with Java support.'
  option 'enable-sql', 'Compile with SQL support.'

  # Fix build under Xcode 4.6
  # Double-underscore names are reserved, and __atomic_compare_exchange is now
  # a built-in, so rename this to something non-conflicting.
  patch :DATA

  def install
    # BerkeleyDB dislikes parallel builds
    ENV.deparallelize
    # --enable-compat185 is necessary because our build shadows
    # the system berkeley db 1.x
    args = %W[
      --disable-debug
      --prefix=#{prefix}
      --mandir=#{man}
      --enable-cxx
      --enable-compat185
    ]
    args << "--enable-java" if build.with? "java"
    args << "--enable-sql" if build.include? "enable-sql"

    # BerkeleyDB requires you to build everything from the build_unix subdirectory
    cd 'build_unix' do
      system "../dist/configure", *args
      system "make install"

      # use the standard docs location
      doc.parent.mkpath
      mv prefix/'docs', doc
    end
  end
end

__END__
diff --git a/src/dbinc/atomic.h b/src/dbinc/atomic.h
index 096176a..561037a 100644
--- a/src/dbinc/atomic.h
+++ b/src/dbinc/atomic.h
@@ -144,7 +144,7 @@ typedef LONG volatile *interlocked_val;
 #define	atomic_inc(env, p)	__atomic_inc(p)
 #define	atomic_dec(env, p)	__atomic_dec(p)
 #define	atomic_compare_exchange(env, p, o, n)	\
-	__atomic_compare_exchange((p), (o), (n))
+	__atomic_compare_exchange_db((p), (o), (n))
 static inline int __atomic_inc(db_atomic_t *p)
 {
 	int	temp;
@@ -176,7 +176,7 @@ static inline int __atomic_dec(db_atomic_t *p)
  * http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html
  * which configure could be changed to use.
  */
-static inline int __atomic_compare_exchange(
+static inline int __atomic_compare_exchange_db(
 	db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval)
 {
 	atomic_value_t was;


text:
import java.util.List;
import org.sql2o.*;

public class Restaurant {
  private int id;
  private String name;
  private int cuisine_id;

  public Restaurant (String name, int cuisine_id) {
    this.name = name;
    this.cuisine_id = cuisine_id;
  }

  @Override
  public boolean equals(Object otherRestaurant) {
    if (!(otherRestaurant instanceof Restaurant)) {
      return false;
    } else {
      Restaurant newRestaurant = (Restaurant) otherRestaurant;
      return this.getName().equals(newRestaurant.getName());
    }
  }

  public static List<Restaurant> all() {
    String sql = "SELECT id, name FROM restaurants";
    try(Connection con = DB.sql2o.open()) {
      return con.createQuery(sql).executeAndFetch(Restaurant.class);
    }
  }

  public static Restaurant find(int id) {
    try(Connection con = DB.sql2o.open()) {
      String sql = "SELECT * FROM restaurants WHERE id=:id";
      Restaurant restaurant = con.createQuery(sql)
        .addParameter("id", id)
        .executeAndFetchFirst(Restaurant.class);
      return restaurant;
    }
  }

  public String getName() {
    return name;
  }

  public int getId() {
    return id;
  }

  public int getCuisineId() {
    return cuisine_id;
  }

  public String getCuisine() {
    try(Connection con = DB.sql2o.open()) {
      String sql = "SELECT * FROM cuisines WHERE id = :cuisine_id";
      Cuisine cuisine = con.createQuery(sql)
        .addParameter("cuisine_id", this.cuisine_id)
        .executeAndFetchFirst(Cuisine.class);
      return cuisine.getType();
    }
  }

  public void save() {
    try(Connection con = DB.sql2o.open()) {
      String sql = "INSERT INTO restaurants(name, cuisine_id) VALUES (:name, :cuisine_id)";
      this.id = (int) con.createQuery(sql, true)
        .addParameter("name", this.name)
        .addParameter("cuisine_id", this.cuisine_id)
        .executeUpdate()
        .getKey();
    }
  }
}


text:
package com.dong.application.dto;

import java.io.Serializable;

/**
 * ²©Ö÷ʵÌå
 * @author java1234_С·æ
 *
 */
public class BloggerDTO implements Serializable {

	/**
	 *
	 */
	private static final long serialVersionUID = -7309038640229159183L;
	private Long id; // 񅧏
	private String username; // ̞
	private String password; // ÃÜÂë
	private String nickName; // êdzÆ
	private String sign; // ¸öÐÔÇ©Ãû
	private String proFile; // ¸öÈ˼ò½é
	private String imageName; // ²©Ö÷Í·Ïñ

	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getNickName() {
		return nickName;
	}
	public void setNickName(String nickName) {
		this.nickName = nickName;
	}
	public String getSign() {
		return sign;
	}
	public void setSign(String sign) {
		this.sign = sign;
	}
	public String getProFile() {
		return proFile;
	}
	public void setProFile(String proFile) {
		this.proFile = proFile;
	}
	public String getImageName() {
		return imageName;
	}
	public void setImageName(String imageName) {
		this.imageName = imageName;
	}

}


text:
<!DOCTYPE HTML>

		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<link type="text/css" href="http://www.nomad.so/ddoc/css/theme.css" rel="stylesheet" media="all" />

		<title>tkd.widget.common.text</title>

tkd.widget.common.text

Text module.

License

MIT. See LICENSE for full details.

template Text()

These are common commands that apply to all widgets that have them injected.

string getText();

Get the widget text.

Return Value

The widget text

auto setText(this T)(string text);

Get the index where the insert cursor is.

Parameters

string text
The widget text to set.

Return Value

This widget to aid method chaining.


text:
package com.thoughtworks.fam.service;

import java.util.List;

import org.springframework.data.repository.CrudRepository;

import com.thoughtworks.fam.domain.Asset;

public interface AssetRepository extends CrudRepository<Asset, Long>
{
    Asset findByAssetNumber(String assetNumber);

    List<Asset> findByAccount(String account);
}


text:
package org.commcare.hub.nsd;

import android.annotation.TargetApi;
import android.content.Context;
import android.net.nsd.NsdManager;
import android.net.nsd.NsdServiceInfo;
import android.os.Build;

import org.commcare.hub.services.HubService;

/**
 * Created by ctsims on 12/14/2015.
 */
public class NsdHubService implements HubService {

    Context context;
    Status status = Status.WAITING;

    public static final String SERVICE_TYPE = "_http._tcp.";
    public static final String SERVICE_NAME = "commcare_micronode";

    public NsdHubService(Context context) {
        this.context = context;
    }

    @Override
    public Status getServiceStatus() {
        return status;
    }

    @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
    @Override
    public void startService() {
        NsdServiceInfo serviceInfo  = new NsdServiceInfo();
        serviceInfo.setServiceName(SERVICE_NAME);
        serviceInfo.setServiceType(SERVICE_TYPE);
        serviceInfo.setPort(8080);

        NsdManager mNsdManager = (NsdManager)context.getSystemService(Context.NSD_SERVICE);

        mNsdManager.registerService(
                serviceInfo, NsdManager.PROTOCOL_DNS_SD, new NsdManager.RegistrationListener() {

                    @Override
                    public void onServiceRegistered(NsdServiceInfo NsdServiceInfo) {
                        // Save the service name.  Android may have changed it in order to
                        // resolve a conflict, so update the name you initially requested
                        // with the name Android actually used.
                        //mServiceName = NsdServiceInfo.getServiceName();
                        NsdHubService.this.status = Status.RUNNING;
                    }

                    @Override
                    public void onRegistrationFailed(NsdServiceInfo serviceInfo, int errorCode) {
                        // Registration failed!  Put debugging code here to determine why.
                    }

                    @Override
                    public void onServiceUnregistered(NsdServiceInfo arg0) {
                        // Service has been unregistered.  This only happens when you call
                        // NsdManager.unregisterService() and pass in this listener.
                    }

                    @Override
                    public void onUnregistrationFailed(NsdServiceInfo serviceInfo, int errorCode) {
                        // Unregistration failed.  Put debugging code here to determine why.
                    }
                });
    }

    @Override
    public void stopService() {

    }

    @Override
    public void restartService() {

    }
}


text:
chrome.app.runtime.onLaunched.addListener(function() {
  chrome.app.window.create('vcs.html', {
    bounds: {
      'width': 800,
      'height': Math.round(window.screen.availHeight)
    }
  });
});


text:
"""
Tests for zipline.lib.adjustment
"""
from unittest import TestCase
from nose_parameterized import parameterized

from zipline.lib import adjustment as adj
from zipline.utils.numpy_utils import make_datetime64ns

class AdjustmentTestCase(TestCase):

    @parameterized.expand([
        ('add', adj.ADD),
        ('multiply', adj.MULTIPLY),
        ('overwrite', adj.OVERWRITE),
    ])
    def test_make_float_adjustment(self, name, adj_type):
        expected_types = {
            'add': adj.Float64Add,
            'multiply': adj.Float64Multiply,
            'overwrite': adj.Float64Overwrite,
        }
        result = adj.make_adjustment_from_indices(
            1, 2, 3, 4,
            adjustment_kind=adj_type,
            value=0.5,
        )
        expected = expected_types[name](
            first_row=1,
            last_row=2,
            first_col=3,
            last_col=4,
            value=0.5,
        )
        self.assertEqual(result, expected)

    def test_make_datetime_adjustment(self):
        overwrite_dt = make_datetime64ns(0)
        result = adj.make_adjustment_from_indices(
            1, 2, 3, 4,
            adjustment_kind=adj.OVERWRITE,
            value=overwrite_dt,
        )
        expected = adj.Datetime64Overwrite(
            first_row=1,
            last_row=2,
            first_col=3,
            last_col=4,
            value=overwrite_dt,
        )
        self.assertEqual(result, expected)

    def test_unsupported_type(self):
        class SomeClass(object):
            pass

        with self.assertRaises(TypeError) as e:
            adj.make_adjustment_from_indices(
                1, 2, 3, 4,
                adjustment_kind=adj.OVERWRITE,
                value=SomeClass(),
            )

        exc = e.exception
        expected_msg = (
            "Don't know how to make overwrite adjustments for values of type "
            "%r." % SomeClass
        )
        self.assertEqual(str(exc), expected_msg)


text:
from google.cloud import retail_v2

def sample_list_serving_configs():
    # Create a client
    client = retail_v2.ServingConfigServiceClient()

    # Initialize request argument(s)
    request = retail_v2.ListServingConfigsRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_serving_configs(request=request)

    # Handle the response
    for response in page_result:
        print(response)

# [END retail_v2_generated_ServingConfigService_ListServingConfigs_sync]


text:
package Bio::EnsEMBL::Funcgen::PeakCallingPlan::AlignmentNamer;

use strict;
use File::Spec;
use Bio::EnsEMBL::Utils::Exception qw( throw );

use Role::Tiny::With;
with 'Bio::EnsEMBL::Funcgen::GenericConstructor';

sub _constructor_parameters {
  return {
    directory_name_builder      => 'directory_name_builder',
    experiment                  => 'experiment',
    biological_replicate_number => 'biological_replicate_number',
    technical_replicate_number  => 'technical_replicate_number',
  };
}

sub init {

  my $self = shift;

  use Carp;
  if (! defined $self->experiment) {
    confess("Experiment is a mandatory parameter!");
  }
  return;
}

use Bio::EnsEMBL::Funcgen::GenericGetSetFunctionality qw(
  _generic_get_or_set
);

sub directory_name_builder      { return shift->_generic_get_or_set('directory_name_builder',      @_); }
sub biological_replicate_number { return shift->_generic_get_or_set('biological_replicate_number', @_); }
sub technical_replicate_number  { return shift->_generic_get_or_set('technical_replicate_number',  @_); }
sub experiment                  { return shift->_generic_get_or_set('experiment',                  @_); }

sub unset_biological_replicate_number {
  shift->{biological_replicate_number} = undef;
}

sub unset_technical_replicate_number {
  shift->{technical_replicate_number} = undef;
}

sub name {

  my $self       = shift;
  my $experiment = $self->experiment;

  if (! defined $experiment) {
    throw("No experiment passed!");
  }

  my $biological_replicate_number = $self->biological_replicate_number;
  my $technical_replicate_number  = $self->technical_replicate_number;

  my $epigenome          = $experiment->epigenome;
  my $feature_type       = $experiment->feature_type;
  my $experimental_group = $experiment->experimental_group;

  my @name_components = (
    $experiment->dbID,
    $epigenome->production_name,
    $feature_type->name,
    $experimental_group->name,
  );

  my $alignment_name = join '_', @name_components;

  use Bio::EnsEMBL::Funcgen::Utils::GoodUtils qw( create_production_name );
  my $production_name = create_production_name($alignment_name);

  if ($biological_replicate_number) {
    $production_name .= '_BR' . $biological_replicate_number
  }
  if ($technical_replicate_number) {
    $production_name .= '_TR' . $technical_replicate_number
  }
  return $production_name;
}

sub base_name_with_duplicates {
  my $self = shift;
  return $self->name . '_with_duplicates';
}

sub base_name_no_duplicates {
  my $self = shift;
  return $self->name . '_no_duplicates';
}

sub bam_file_name_with_duplicates {
  my $self = shift;
  return $self->base_name_with_duplicates . '.bam';
}

sub bam_file_name_no_duplicates {
  my $self = shift;
  return $self->base_name_no_duplicates . '.bam';
}

sub bigwig_file_name {
  my $self = shift;
  return $self->base_name_no_duplicates . '.bw';
}

sub bed_file_name {
  my $self = shift;
  return $self->base_name_no_duplicates . '.bed';
}

sub bam_file_with_duplicates {
  my $self = shift;
  return File::Spec->catfile(
    $self
      ->directory_name_builder
      ->bam_output_dir(
        $self->experiment
      ),
    $self->bam_file_name_with_duplicates
   );
}
sub bam_file_with_duplicates_stored {
  my $self = shift;
  return File::Spec->catfile(
    $self
      ->directory_name_builder
      ->bam_output_dir_stored(
        $self->experiment
      ),
      $self->bam_file_name_with_duplicates
   );
}
sub bam_file_no_duplicates {
  my $self = shift;
  return File::Spec->catfile(
    $self
      ->directory_name_builder
      ->bam_output_dir(
        $self->experiment
      ),
    $self->bam_file_name_no_duplicates
   );
}
sub bam_file_no_duplicates_stored {
  my $self = shift;
  return File::Spec->catfile(
    $self
      ->directory_name_builder
      ->bam_output_dir_stored(
        $self->experiment
      ),
    $self->bam_file_name_no_duplicates
   );
}
sub bigwig_file_no_duplicates {
  my $self = shift;
  return File::Spec->catfile(
    $self
      ->directory_name_builder
      ->bigwig_output_dir(
        $self->experiment
      ),
    $self->bigwig_file_name
   );
}
sub bed_file_no_duplicates {
  my $self = shift;
  return File::Spec->catfile(
    $self
      ->directory_name_builder
      ->bed_output_dir(
        $self->experiment
      ),
    $self->bed_file_name
   );
}
sub bigwig_file_no_duplicates_stored {
  my $self = shift;
  return File::Spec->catfile(
    $self
      ->directory_name_builder
      ->bigwig_output_dir_stored(
        $self->experiment
      ),
    $self->bigwig_file_name
   );
}

1;


text:
class ObjectModel : public QAbstractTableModel
{
	Q_OBJECT

public:
	ObjectModel(QObject *parent = nullptr);
	int rowCount(const QModelIndex&) const override { return OM_OBJECT_COUNT; }
	int columnCount(const QModelIndex&) const override { return 2; }
	QVariant headerData(int, Qt::Orientation, int) const override;
	QVariant data(const QModelIndex&,int role = Qt::DisplayRole) const override;
	bool setData(const QModelIndex&,const QVariant&,int role=Qt::EditRole) override;
	Qt::ItemFlags flags(const QModelIndex &index) const override;
	QStringList mimeTypes() const;
	QMimeData *mimeData(const QModelIndexList&) const;
	enum { ColumnImage, ColumnName };

	void clear();
	void reload();

private:
	QSettings settingsObjects;
};

#endif // OBJECTMODEL_H


text:
#ifndef __TBGameScene_h__
#define __TBGameScene_h__

class TBGameScene : public CCLayer
{
	public :

		SCENE_FUNC ( TBGameScene );

	public :

		virtual KDbool		init ( KDvoid );

		virtual KDvoid		update ( KDfloat fDelta );

		virtual KDvoid		ccTouchesBegan ( CCSet* pTouches, CCEvent* pEvent );

		virtual KDvoid		didAccelerate ( CCAcceleration* pAccelerationValue );

		KDvoid				initGamePlayVariables ( KDvoid );

		KDvoid				addBall ( KDvoid );

		KDvoid				addBaskets ( KDvoid );

		KDvoid				addCharacters ( KDvoid );

		KDvoid				addGameObjects ( KDvoid );

		KDvoid				showInstructions ( KDvoid );

		KDvoid				showGoLabel ( KDvoid );

		KDvoid				selectCharacter ( KDvoid );

		KDvoid				menuClicked ( CCObject* pSender );

		KDvoid				instructionsEnded ( KDvoid );

		KDvoid				blueCharacterClicked ( CCObject* pSender );

		KDvoid				orangeCharacterClicked ( CCObject* pSender );

		KDvoid				yellowCharacterClicked ( CCObject* pSender );

		KDvoid				characterSelected ( CCObject* pSender );

		KDvoid				characterSelectedEnded ( KDvoid );

		KDvoid				pause ( KDvoid );

		KDvoid				gameOver ( KDvoid );

		KDvoid				leftClicked ( CCObject* pSender );

		KDvoid				rightClicked ( CCObject* pSender );

		KDvoid				updateGoLabel ( KDvoid );

		KDvoid				startClicked ( KDvoid );

		KDvoid				backClicked ( CCObject* pSender );

		KDvoid				nextClicked ( CCObject* pSender );

		KDvoid				updateTimer ( KDfloat fDelta );

		KDvoid				updateComputerMovements ( KDvoid );

		// game specific
		KDint				detectOverBasket ( KDvoid );

		KDbool				detectBallBoundaryCheck ( KDvoid );

		KDbool				detectBallPlayerCollision ( CCSprite* pPlayer );

		KDvoid				resetBallPosition ( KDvoid );

		KDvoid				updateBallPosition ( KDvoid );

		KDvoid				playerLanded ( KDvoid );

		KDvoid				computerLanded ( KDvoid );

		KDvoid				resumeClicked ( CCObject* pSender );

		KDvoid				restartClicked ( CCObject* pSender );

		KDvoid				shareClicked ( CCObject* pSender );

		CCLayer*			addScores ( const CCPoint& tCenter );

	private :

		KDbool				m_bPause;
		KDbool				m_bBallOverBasket;
		KDbool				m_bGameOver;
		CCPoint				m_tBallMovementDelta;
		KDfloat				m_fBallRadius;

		CCMenuItem*			m_pLeftControl;
		CCMenuItem*			m_pRightControl;
		CCMenu*				m_pBackMenu;

		CCSprite*			m_pGoLabel3;
		CCSprite*			m_pGoLabel2;
		CCSprite*			m_pGoLabel1;
		CCSprite*			m_pGoLabelGO;

		KDint				m_nStartTime;
		KDint				m_nCharacterIdx;
		KDint				m_nComputerIdx;

		KDbool				m_bShowingGoLabel;
		KDbool				m_bComputerJumping;
		KDbool				m_bPlayerJumping;
		KDbool				m_bMoveLeft;
		KDbool				m_bMoveRight;
		KDint				m_nPlayerScore;
		KDint				m_nComputerScore;
		KDint				m_nTimer;

		CCLabelTTF*			m_pPlayerScoreLabel;
		CCLabelTTF*			m_pComputerScoreLabel;
		CCLabelTTF*			m_pTimerLabel;

		CCSprite*			m_pBall;
		CCSprite*			m_pPlayer;
		CCSprite*			m_pComputer;
		CCSprite*			m_pLeftBasket;
		CCSprite*			m_pRightBasket;

		// instructions
		CCSprite*			m_pInstructionsBg;
		CCSprite*			m_pCharactersBg;
		CCSprite*			m_pPlayerSelectionBg;
		CCMenu*				m_pMenuInstructions;
		CCMenu*				m_pMenuPlayerSelection;

		CCSprite*			m_pGameOverBg;
		CCSprite*			m_pPauseBg;
		CCSprite*			m_pSelectedCharacterBg;
};

#endif	// __TBGameScene_h__


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Can. J. Bot. 41: 1392 (1963)

#### Original name
Periperidium acicola Darker, 1963

### Remarks
null


text:
package net.autosauler.ballance.shared.datatypes;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;

/**
 * The Class StructValues.
 *
 * @author alexript
 */
public class StructValues {

	/** The values. */
	private HashMap<String, Object> values;

	/** The struct. */
	private Structure struct;

	/**
	 * Instantiates a new struct values.
	 *
	 * @param struct
	 *            the struct
	 */
	public StructValues(Structure struct) {

		fillDefaults(struct);
	}

	/**
	 * Fill defaults.
	 *
	 * @param struct
	 *            the struct
	 * @param xmldump
	 *            the xmldump
	 */
	private void fillDefaults(Structure struct) {
		this.struct = struct;
		values = new HashMap<String, Object>();

		Set<String> names = struct.getNames();

		Iterator<String> i = names.iterator();
		while (i.hasNext()) {
			String name = i.next();
			Object val = struct.getDefValue(name);
			values.put(name, val);
		}
	}

	/**
	 * Gets the.
	 *
	 * @param name
	 *            the name
	 * @return the object
	 */
	public Object get(String name) {
		if (values.containsKey(name)) {
			return values.get(name);
		}
		return null;
	}

	/**
	 * Gets the object.
	 *
	 * @param name
	 *            the name
	 * @return the object
	 */
	public Object getObject(String name) {
		if (struct.containKey(name) && values.containsKey(name)) {
			return struct.toMapping(name, get(name));
		}
		return null;
	}

	/**
	 * Sets the.
	 *
	 * @param name
	 *            the name
	 * @param val
	 *            the val
	 */
	public void set(String name, Object val) {
		if (values.containsKey(name)) {
			values.put(name, val);
		}
	}

	/**
	 * Sets the object.
	 *
	 * @param name
	 *            the name
	 * @param val
	 *            the val
	 */
	public void setObject(String name, Object val) {
		if (struct.containKey(name)) {
			set(name, struct.fromMapping(name, val));
		}
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		Set<String> names = values.keySet();
		if (names.size() > 0) {

			sb.append("<record>\n");
			Iterator<String> i = names.iterator();
			while (i.hasNext()) {
				String name = i.next();
				Object val = values.get(name);
				sb.append(" <field name=\"");
				sb.append(name.trim().toLowerCase());
				sb.append("\" value=\"");
				if (val != null) {
					sb.append(DataTypes.toString(struct.getType(name), val));
				}
				sb.append("\"/>\n");
			}

			sb.append("</record>\n");
		}
		return sb.toString();
	}
}


text:
module Einhorn::Event
  module Persistent
    @@persistent = {}

    def self.included(other)
      @@persistent[other.to_s] = other
    end

    def self.from_state(state)
      klass_name = state[:class]
      if klass = @@persistent[klass_name]
        klass.from_state(state)
      else
        Einhorn.log_error("Unrecognized persistent descriptor class #{klass_name.inspect}. Ignoring. This most likely indicates that your Einhorn version has upgraded. Everything should still be working, but it may be worth a restart.", :upgrade)
        nil
      end
    end

    def self.persistent?(descriptor)
      @@persistent.values.any? {|klass| descriptor.kind_of?(klass)}
    end
  end
end


text:
INSERT INTO public.territorios_dashboard (
       id,
       descricao,
       categoria,
       the_geom
   )
SELECT
  (featureid + 110000000) AS id,
  name AS descricao,
  categoria,
  geom as the_geom
FROM public.deptales_tmp ;


text:
#import "DTLibrary.h"
#import "DTDoxygenCommands.h"
#import "PLAdditions.h"

@implementation DTLibrary

- (instancetype) initWithNodes: (NSDictionary *) nodes classes: (NSSet *) classes protocols: (NSSet *) protocols categories: (NSSet *) categories functions: (NSSet *) functions constants: (NSSet *) constants {
    PLSuperInit();

    _nodes = nodes;
    _classes = classes;
    _protocols = protocols;
    _categories = categories;
    _functions = functions;
    _constants = constants;

    return self;
}

// TODO: Think on a better way to do this, the unwinding is too complex. Ideally we would not
// add the undocumented nodes at all, but when parsing we don't know if we're only going to
// see declarations or both declarations and implementations, and comments could be attached to
// either.
- (instancetype) filteredLibraryForConfiguration: (DTConfiguration *) config {
    if (config.showUndocumentedEntities) {
        // If everything is being shown there's no need to filter
        return self;
    }

    return [[[self class] alloc] initWithNodes: _nodes
                                       classes: [self filterSet: _classes forConfiguration: config]
                                     protocols: [self filterSet: _protocols forConfiguration: config]
                                    categories: [self filterSet: _categories forConfiguration: config]
                                     functions: [self filterSet: _functions forConfiguration: config]
                                     constants: [self filterSet: _constants forConfiguration: config]];
}

- (NSSet *) filterSet: (NSSet *) set forConfiguration: (DTConfiguration *) config {
    NSMutableSet *filteredSet = [NSMutableSet set];

    for (DTNode *node in set) {
        [self filterNode: node forConfiguration: config];

        if ([self node: node isVisibleForConfiguration: config] == NO) {
            // TOOD: Remove from node lookup as well
        } else {
            [filteredSet addObject: node];
        }
    }

    return filteredSet;
}

- (NSArray *) filterArray: (NSArray *) array forConfiguration: (DTConfiguration *) config {
    NSMutableArray *filteredArray = [NSMutableArray array];

    for (DTNode *node in array) {
        if ([self node: node isVisibleForConfiguration: config] == NO) {
            // TOOD: Remove from node lookup as well
        } else {
            [filteredArray addObject: node];
        }
    }

    return filteredArray;
}

- (void) filterNode: (DTNode *) node forConfiguration: (DTConfiguration *) config {
    node.classMethods = [self filterArray: node.classMethods forConfiguration: config];
    node.instanceMethods = [self filterArray: node.instanceMethods forConfiguration: config];
    node.constants = [self filterArray: node.constants forConfiguration: config];
}

- (BOOL) node: (DTNode *) node isVisibleForConfiguration: (DTConfiguration *) config {
    if (node.comment == nil)
        return NO;

    if (config.showInternalComments == NO) {
        // Parse enough of the comment to determine if the node has any non-internal content

        BOOL inInternal = NO;

        for (PLClangComment *comment in node.comment.children) {
            if (comment.kind != PLClangCommentKindParagraph && !inInternal)
                return YES;

            for (PLClangComment *child in comment.children) {
                if (child.isWhitespace)
                    continue;

                switch (child.kind) {
                    case PLClangCommentKindInlineCommand:
                        if ([child.commandName isEqualToString: DTCommandNameInternal]) {
                            inInternal = YES;
                        } else if ([comment.commandName isEqualToString: DTCommandNameEndInternal]) {
                            inInternal = NO;
                        } else if (!inInternal) {
                            return YES;
                        }
                        break;
                    default:
                        if (!inInternal) {
                            return YES;
                        }
                        break;
                }
            }
        }

        return NO;
    }

    return YES;
}

@end