text:
#import "WXDatePickerManager.h"
#import <UIKit/UIDatePicker.h>
#import <UIKit/UIKit.h>
#import "WXConvert.h"
#import "WXUtility.h"
#import "WXLegacyAdapter.h"

#define WXPickerHeight 266

@interface WXDatePickerManager() <UIGestureRecognizerDelegate>

@property(nonatomic,strong)UIDatePicker *datePicker;
@property(nonatomic,strong)UIView *backgroudView;
@property(nonatomic,strong)UIView *datePickerView;
@property(nonatomic,copy)NSString *type;
@property(nonatomic)BOOL isAnimating;

@end

@implementation WXDatePickerManager
@synthesize datePicker;

- (instancetype)init
{
    self = [super init];
    if (self) {
        if(!self.backgroudView)
        {
            self.backgroudView = [self createBackgroundView];
            UITapGestureRecognizer *tapGesture=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(hide)];
            if (WX_SYS_VERSION_GREATER_THAN_OR_EQUAL_TO(@"11.0") && WX_SYS_VERSION_LESS_THAN(@"11.1")) {
                tapGesture.delegate = self;
            }
            [self.backgroudView addGestureRecognizer:tapGesture];
        }

        if(!self.datePickerView)
        {
            self.datePickerView = [self createDatePickerView];
        }

        if(!datePicker)
        {
            datePicker = [[UIDatePicker alloc]init];
        }
    #if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130400)
        if (@available(iOS 13.4, *)) {
            datePicker.preferredDatePickerStyle = UIDatePickerStyleWheels;
        }
    #endif
        datePicker.datePickerMode=UIDatePickerModeDate;
        CGRect pickerFrame = CGRectMake(0, 44, [UIScreen mainScreen].bounds.size.width, WXPickerHeight-44);
        datePicker.backgroundColor = [UIColor whiteColor];
        datePicker.frame = pickerFrame;
        UIToolbar *toolBar=[[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 44)];
        [toolBar setBackgroundColor:[UIColor whiteColor]];
        UIBarButtonItem* noSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
        noSpace.width=10;
        UIBarButtonItem* doneBtn = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done:)];
        UIBarButtonItem *flexSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
        UIBarButtonItem* cancelBtn = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel:)];
        [toolBar setItems:[NSArray arrayWithObjects:noSpace,cancelBtn,flexSpace,doneBtn,noSpace, nil]];
        [self.datePickerView addSubview:datePicker];
        [self.datePickerView addSubview:toolBar];
        [self.backgroudView addSubview:self.datePickerView];
    }
    return self;
}

- (void)updateDatePicker:(NSDictionary *)attributes
{
    NSString *type = [WXConvert NSString:attributes[@"type"]];
    if(type)
    {
        _type = type;
        if( [_type isEqualToString:@"date"])
        {
            self.datePicker.datePickerMode = UIDatePickerModeDate;
            NSString *value = [WXConvert NSString:attributes[@"value"]];
            if(value)
            {
                NSDate *date = [WXUtility dateStringToDate:value];
                if(date)
                {
                    self.datePicker.date =date;
                }
            }
            NSString *max = [WXConvert NSString:attributes[@"max"]];
            if(max)
            {
                NSDate *date = [WXUtility dateStringToDate:max];
                if(date)
                {
                    self.datePicker.maximumDate =date;
                }
            }
            NSString *min = [WXConvert NSString:attributes[@"min"]];
            if(min)
            {
                NSDate *date = [WXUtility dateStringToDate:min];
                if(date)
                {
                    self.datePicker.minimumDate =date;
                }
            }
        }else if([_type isEqualToString:@"time"])
        {
            self.datePicker.datePickerMode = UIDatePickerModeTime;
            NSString *value = [WXConvert NSString:attributes[@"value"]];
            if(value)
            {
                NSDate *date = [WXUtility timeStringToDate:value];
                if(date)
                {
                    self.datePicker.date = date;
                }
            }
        }
    }
}

-(UIView *)createBackgroundView
{
    UIView *view = [UIView new];
    view.frame = [UIScreen mainScreen].bounds;
    view.backgroundColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.4];
    return view;
}

-(UIView *)createDatePickerView
{
    UIView *view = [UIView new];
    view.frame = CGRectMake(0, [UIScreen mainScreen].bounds.size.height, [UIScreen mainScreen].bounds.size.width, WXPickerHeight);
    view.backgroundColor = [UIColor whiteColor];
    return view;
}

-(void)show
{
    UIWindow *window = [UIApplication sharedApplication].keyWindow;
    [window addSubview:self.backgroudView];
    UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, self.datePicker);
    if(self.isAnimating)
    {
        return;
    }
    self.isAnimating = YES;
    self.backgroudView.hidden = NO;
    [UIView animateWithDuration:0.35f animations:^{
        self.datePickerView.frame = CGRectMake(0, [UIScreen mainScreen].bounds.size.height - WXPickerHeight, [UIScreen mainScreen].bounds.size.width, WXPickerHeight);
        self.backgroudView.alpha = 1;
    } completion:^(BOOL finished) {
        self.isAnimating = NO;
    }];
}

-(void)hide
{
    if(self.isAnimating)
    {
        return;
    }
    self.isAnimating = YES;
    [UIView animateWithDuration:0.35f animations:^{
        self.datePickerView.frame = CGRectMake(0, [UIScreen mainScreen].bounds.size.height, [UIScreen mainScreen].bounds.size.width, WXPickerHeight);
        self.backgroudView.alpha = 0;
    } completion:^(BOOL finished) {
        self.backgroudView.hidden = YES;
        self.isAnimating = NO;
        [self.backgroudView removeFromSuperview];

        // move focus to original view;
        if ([self.delegate isKindOfClass:[WXComponent class]]) {
            UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, ((WXComponent*)self.delegate).view);
        }else if ([self.delegate isKindOfClass:[UIView class]]) {
            UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, (UIView*)self.delegate);
        }
    }];
}

-(void)cancel:(id)sender
{
    [self hide];
}

-(void)done:(id)sender
{
    [self hide];
    if (self.delegate && [self.delegate respondsToSelector:@selector(fetchDatePickerValue:)]) {
        NSString *value = @"";
        if([_type isEqualToString:@"time"])
        {
            value = [WXUtility timeToString:self.datePicker.date];
        }else if([_type isEqualToString:@"date"])
        {
            value = [WXUtility dateToString:self.datePicker.date];
        }
        [self.delegate fetchDatePickerValue:value];
    }

}

#pragma mark - UIGestureRecognizerDelegate
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
    if (self.datePickerView && [touch.view isDescendantOfView:self.datePickerView]) {
        return NO;
    }
    return YES;
}

@end


text:
import pytest

from pyop.storage import MongoWrapper

__author__ = 'lundberg'

class TestMongoStorage(object):
    @pytest.fixture()
    def db(self, mongodb_instance):
        return MongoWrapper(mongodb_instance.get_uri(), 'pyop', 'test')

    def test_write(self, db):
        db['foo'] = 'bar'
        assert db['foo'] == 'bar'

    def test_multilevel_dict(self, db):
        db['foo'] = {}
        assert db['foo'] == {}
        db['foo'] = {'bar': 'baz'}
        assert db['foo']['bar'] == 'baz'

    def test_contains(self, db):
        db['foo'] = 'bar'
        assert 'foo' in db

    def test_pop(self, db):
        db['foo'] = 'bar'
        assert db.pop('foo') == 'bar'
        try:
            db['foo']
        except Exception as e:
            assert isinstance(e, KeyError)

    def test_items(self, db):
        db['foo'] = 'foorbar'
        db['bar'] = True
        db['baz'] = {'foo': 'bar'}
        for key, item in db.items():
            assert key
            assert item

redpajama_set_name: RedPajamaGithub


text:
Tested with CGX 2.19 / CCX 2.19

+ Plane strain model
+ Linear elasticity
+ Surface-to-surface Penalty contact
+ 2 steps:
  1. displacement control,
  2. force (pressure) control

The model was inspired by  [this post](https://groups.yahoo.com/neo/groups/calculix/conversations/topics/11564) by user dichtstoff in the CalculiX user forum. Here, essentially, parametrization with the CGX `valu` command and mesh bias were added.

File                   | Contents
:-------------         | :-------------
[pre.fbd](pre.fbd)     | Pre-processing script for CGX  (parametrized with `valu`)
[Hertz.inp](Hertz.inp) | CCX input, surface-to-surface penalty contact
[post.fbd](post.fbd)   | CGX post-processing script
[plots.fbd](plots.fbd) | CGX post-processing script (path plots)
[plots.gnu](plots.gnu) | Gnuplot script for path plots
[test.py](test.py)     | Python script to run the example

## Preprocessing

| Parameter      | Value   | Description                  |
| :------------- |  :----  | :-------------               |
| `radius`       | 50      | radius in mm                 |
| `height`       | 60      | thickness of the block in mm |
| `width`        | 120     | width of the block in mm     |

The prescribed displacement (first step) or the pressure (second step) are applied to the flat equatorial surface of the cylinder.

The values for both variants are chosen independently, thus they can't be compared directly.
```
> cgx -b pre.fbd
```
Two separate parts are generated and meshed with plane strain elements.

Sets and Contact surfaces:

## Solving
```
> ccx Hertz
> monitor.py Hertz
```

## Postprocess

```
> cgx -b post.fbd
```
The solution shows the expected feature of Hertz contact with the maximum of the equivalent stress somewhat below the contact surface.

Results with displacement control (first step)

Results with pressure control (second step)

```
> cgx -b plots.fbd
```
Stress plots along the symmetry line with x=0 at the contact location:

Results with displacement control (first step)

Results with pressure control (second step)


text:
<?php

namespace Oro\Bundle\WorkflowBundle\Migrations\Schema\v1_14;

use Doctrine\DBAL\Types\Type;

use Psr\Log\LoggerInterface;

use Oro\Bundle\MigrationBundle\Migration\ArrayLogger;
use Oro\Bundle\MigrationBundle\Migration\ParametrizedMigrationQuery;

class MoveActiveFromConfigToFieldQuery extends ParametrizedMigrationQuery
{
    /**
     * {@inheritdoc}
     */
    public function getDescription()
    {
        $logger = new ArrayLogger();
        $this->migrateConfigs($logger, true);

        return array_merge(
            ['Moves from entities config "active_workflow" to corresponded workflow "active" field.'],
            $logger->getMessages()
        );
    }

    /**
     * {@inheritdoc}
     */
    public function execute(LoggerInterface $logger)
    {
        $this->migrateConfigs($logger);
    }

    /**
     * @param LoggerInterface $logger
     * @param bool $dryRun
     */
    protected function migrateConfigs(LoggerInterface $logger, $dryRun = false)
    {
        $queries = [];

        // prepare update queries
        $rows = $this->getRows($logger);
        foreach ($rows as $row) {
            $data = $this->connection->convertToPHPValue($row['data'], 'array');

            if ($this->isWorkflowAwareData($data)) {
                $workflowName = $data['workflow']['active_workflow'];
                if (!empty($workflowName)) {
                    $queries[] = [
                        'UPDATE oro_workflow_definition SET active = :is_active WHERE name = :workflow_name',
                        ['is_active' => true, 'workflow_name' => $workflowName],
                        ['is_active' => Type::BOOLEAN, 'workflow_name' => Type::STRING]
                    ];
                }

                unset($data['workflow']['active_workflow']);
                $queries[] = [
                    'UPDATE oro_entity_config SET data = :data WHERE id = :id',
                    ['data' => $data, 'id' => $row['id']],
                    ['data' => Type::TARRAY, 'id' => Type::INTEGER]
                ];
            }
        }

        // execute update queries
        foreach ($queries as $val) {
            $this->logQuery($logger, $val[0], $val[1], $val[2]);
            if (!$dryRun) {
                $this->connection->executeUpdate($val[0], $val[1], $val[2]);
            }
        }
    }

    /**
     * @param LoggerInterface $logger
     * @return array
     */
    private function getRows(LoggerInterface $logger)
    {
        $query  = 'SELECT id, data FROM oro_entity_config';

        $this->logQuery($logger, $query);

        return $this->connection->fetchAll($query);
    }

    /**
     * @param mixed $data
     * @return bool
     */
    private function isWorkflowAwareData($data)
    {
        return is_array($data) &&
            array_key_exists('workflow', $data) &&
            array_key_exists('active_workflow', $data['workflow']);
    }
}


text:
static inline time_t sgx_wrapper_time(time_t * tim)
{
	time_t retval;
	ocall_time(&retval, tim);
	return retval;
}

static inline int sgx_wrapper_gettimeofday(void * tv, void * tz)
{
	int retval;
	if (tz!=NULL)
		ocall_gettimeofday(&retval, tv, sizeof(struct timeval), tz, sizeof(struct timezone));
	else	{
		// printf("Call the second get time of day 2 \n");
		int code = ocall_gettimeofday2(&retval, tv, sizeof(struct timeval));
		// printf("Return code is: %x", code);
	}
	return retval;
}

static inline struct tm *sgx_wrapper_gmtime_r(const time_t *timer, struct tm *tp)
{
	struct tm * retval;
	ocall_gmtime_r(&retval, timer, tp);
	return tp;
}

static inline struct tm *sgx_wrapper_localtime_r(const time_t *timer, struct tm *tp)
{
	struct tm * retval;
	ocall_localtime_r(&retval, timer, tp);
	return tp;
}

static inline time_t sgx_wrapper_mktime(struct tm *tp)
{
	time_t retval;
	return ocall_mktime(&retval, tp);
}

static inline clock_t sgx_wrapper_clock()	{
	clock_t c;
	ocall_clock(&c);
	return c;
}

#define time(A) sgx_wrapper_time(A)
#define gettimeofday(A, B) sgx_wrapper_gettimeofday(A, B)
#define gmtime_r(A, B) sgx_wrapper_gmtime_r(A, B)
#define localtime_r(A, B) sgx_wrapper_localtime_r(A, B)
#define mktime(A) sgx_wrapper_mktime(A)
#define clock() sgx_wrapper_clock()

#endif


text:
(function($) {
    $.mindmapSockjs = function() {
        var self = this;
        var map;
        self.socket = new SockJS(bm_globals.mindmaptornado.server);

        // status label handling
        var navbar = $('#navbar');

        self.show_status = function(what, duration) {
            $('.ws-status', navbar).hide(duration, function(){
                $('.ws-status-'+what, navbar).show(duration);
            });
        }

        self.show_status('connecting', 0);

        self.socket.onopen = function() {
            self.show_status('connected', 800);

            // fetch and init map
            map = $('#mindmap-map').mindmapMap();

            // register client as map participant if we are currently on a map
            var map_pk = $('#mindmap-map').attr('data-map-pk');
            if(map_pk) {
                self.send('register_myself_as_map_participant', {
                    map_pk: map_pk
                });
            }
        };

        self.socket.onmessage = function(e) {
            var client_methods = {
                'add_component': function(data) {
                    data.left = data.pos_left;
                    data.top = data.pos_top;
                    data.pk = data.component_pk;
                    data.animate = true;
                    $('#mindmap-map').data('mindmapMap').addComponent(data);
                },

                'update_component_pos': function(data) {
                    var component = $('.component[data-component-pk="'+data.component_pk+'"]:first');
                    component.css({left: data.pos_left, top: data.pos_top});
                    jsPlumb.repaint(component);
                },

                'update_component_title': function(data) {
                    var component = $('.component[data-component-pk="'+data.component_pk+'"]:first');
                    $('.component-title:first', component).attr('value', data.title);
                },

                'add_components_offset_except_one': function(data) {
                    $('.component:not([data-component-pk="'+data.except_component_pk+'"])').each(function(){
                        var component = $(this);
                        var pos = component.position();
                        component.css({
                            left: pos.left + data.offset_left,
                            top: pos.top + data.offset_top
                        });
                    });
                    jsPlumb.repaintEverything();
                },

                'update_map_participants_count': function(data) {
                    $('#mindmap-map').data('mindmapMap').updateParticipantsCount(data.map_participants_count);
                },

                'delete_component': function(data) {
                    $('#mindmap-component-'+data.component_pk).data('mindmapMapComponent').delete();
                }
            }

            var data = $.parseJSON(e.data);
            if (!data.hasOwnProperty('method'))
                return;

            if (!client_methods.hasOwnProperty(data.method))
                return;

            client_methods[data.method](data);
        };

        self.socket.onclose = function() {
            this.socket = null;
            self.show_status('error', 0);

            if (map) {
                map.hide('slow');
            }
        };

        self.send = function(method, data) {
            data.method = method;
            self.socket.send(JSON.stringify(data));
        };

        return self;
    }();
})(jQuery);


text:
<?php
namespace Interfaces;

/**
 *
 * Interface typu Singleton
 * @author Paweł
 *
 */
interface Factory {

	public function create($type);

}


text:
<!DOCTYPE html>

<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="https://unpkg.com/purecss@2.0.6/build/pure-min.css" integrity="sha384-Uu6IeWbM+gzNVXJcM9XV3SohHtmWE+3VGi496jvgX1jyvDTXfdK+rfZc8C1Aehk5" crossorigin="anonymous">
<link rel="stylesheet" href="/css/site.css"/>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,700">

Gregory J. Scott

Resume

Projects

Languages

Databases

Tools

{{ page.title }}

  {{ content }}


text:
title: Neutron with existing external network
authors: dneary, fale, javexed, mangelajo, mrunge, rbowen
wiki_title: Neutron with existing external network
wiki_revision_count: 12
wiki_last_updated: 2015-06-17
---

# Neutron with existing external network

Many people have asked how to use packstack --allinone with an existing external network. This method should allow any machine on the network to be able to access launched instances via their floating IPs. Also, at the end of this message, there are some ideas for making this process better that I thought we could discuss.

These instructions have been tested on Centos 7.

Initially, follow the [Quickstart](Quickstart) but stop when you see the first "packstack --allinone" at Step 3, instead do:

    # packstack --allinone --provision-demo=n

(There's an alternate method using packstack --allinone --provision-all-in-one-ovs-bridge=n, but it's more complicated)

After completion, given a single machine with a current IP of 192.168.122.212/24 via DHCP with gateway of 192.168.122.1:

Make /etc/sysconfig/network-scripts/ifcfg-br-ex resemble: (note this file will exist, and IPADDR/NETMASK will be populated with _br_ex at the end, remove that part, and fill all the missing fields)

    DEVICE=br-ex
    DEVICETYPE=ovs
    TYPE=OVSBridge
    BOOTPROTO=static
    IPADDR=192.168.122.212 # Old eth0 IP since we want the network restart to not
                           # kill the connection, otherwise pick something outside your dhcp range
    NETMASK=255.255.255.0  # your netmask
    GATEWAY=192.168.122.1  # your gateway
    DNS1=192.168.122.1     # your nameserver
    ONBOOT=yes

This file will configure the network parameters we probably had into our eth0 interface but, over br-ex.

Make /etc/sysconfig/network-scripts/ifcfg-eth0 resemble (no BOOTPROTO!):

Note: if on Centos7, the file could be /etc/sysconfig/network-scripts/enp2s0

    DEVICE=eth0
    HWADDR=52:54:00:92:05:AE # your hwaddr (find via ip link show eth0)
    TYPE=OVSPort
    DEVICETYPE=ovs
    OVS_BRIDGE=br-ex
    ONBOOT=yes

This means, we will bring up the interface, and plug it into br-ex OVS bridge as a port, providing the uplink connectivity.

Modify the following config parameter:

    openstack-config --set /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini ovs bridge_mappings extnet:br-ex

This will define a logical name for our external physical L2 segment, as "extnet", this will be referenced as a provider network when we create the external networks.

This one will overcome a packstack deployment bug where only vxlan is made available.

    openstack-config --set /etc/neutron/plugin.ini ml2 type_drivers vxlan,flat,vlan

Restart the network service

    # reboot

    or, alternatively:

    # service network restart
    # service neutron-openvswitch-agent restart
    # service neutron-server restart

NOTE: It is important to do the network restart before setting up the router gateway below, because a network restart takes destroys and recreates br-ex which causes the router's interface in the qrouter-\* netns to be deleted, and it won't be recreated without clearing and re-setting the gateway.

    # . keystonerc_admin
    # neutron net-create external_network --provider:network_type flat --provider:physical_network extnet  --router:external --shared

Please note: "extnet" is the L2 segment we defined in the bridge_mappings above (plugin.ini file, ml2 section).

You need to recreate the public subnet with an allocation range outside of your external DHCP range and set the gateway to the default gateway of the external network.

Please note: 192.168.122.1/24 is the router and CIDR we defined in /etc/sysconfig/network-scripts/ifcfg-br-ex for external connectivity.

    # neutron subnet-create --name public_subnet --enable_dhcp=False --allocation-pool=start=192.168.122.10,end=192.168.122.20 \
                            --gateway=192.168.122.1 external_network 192.168.122.0/24
    # neutron router-create router1
    # neutron router-gateway-set router1 external_network

Now create a private network and subnet, since that provisioning has been disabled:

    # neutron net-create private_network
    # neutron subnet-create --name private_subnet private_network 192.168.100.0/24

And connect this private network to the public network via the router, which will provide the floating IP addresses.

    # neutron router-interface-add router1 private_subnet

Get a cirrus image, not provisioned without demo provisioning:

    curl http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img | glance \
             image-create --name='cirros image' --is-public=true  --container-format=bare --disk-format=qcow2

Finally, for your user, you need to create a network and connect that network through a router to your shared and external network. Since you don't created a user yet

    keystone tenant-create --name internal --description "internal tenant" --enabled true
    keystone user-create --name internal --tenant internal --pass "foo" --email bar@corp.com --enabled true

Easiest way to the network and to launch instances is via horizon, which was set up by packstack.

You should now be able to follow the steps at [running an instance with Neutron](running an instance with Neutron) to launch an instance with external network access as admin, if you want other tenants you may need to create them manually.

## Possible improvements

Now, the question is how we make this better. Currently, Gilles Dubreuil is working on a patch to the puppet-vswitch module that can automatically handle the whole "move eth0 into the bridge and give the bridge its IP" issue. He's working through the last of the issues, but it is looking really good. If we are going to handle this automatically in packstack for people, though, it's really best if the external network interface is different from the one we are using for packstack since mucking with the interface you are connecting over is tricky. At the very least, if it is the same interface, then it needs to be configured with a static IP so that when br-ex comes up it will have the same address that eth0 had. Most likely things will pick up fine after the brief network interruption.

So, if we go this way, then it would make sense for us to add a config option for PROVISION_DEMO_EXT_IF (which should be determinable automatically, but overridable), PROVISION_DEMO_EXT_POOL and convert the existing PROVISION_DEMO_FLOATRANGE to be PROVISION_DEMO_EXT_CIDR since that was it really is. Also having an option that toggled whether or not we actually did the bridge setup would be advisable.

But, in the end it should be possible to have something like:

    packstack --allinone --use-existing-external-net=y --provision-demo-ext-cidr=192.168.122.0/24 --provision-demo-ext-pool=192.168.122.10,192.168.122.40

## See also

Watch this video for a demonstration of how to use DHCP on the bridge, including cloning the MAC address from eth0: <https://www.youtube.com/watch?v=8zFQG5mKwPk>


text:
<?hh // strict

class :source extends :xhp:html-singleton {
  attribute Stringish media, Stringish src, Stringish type;
  protected string $tagName = 'source';
}


text:
<?php

declare(strict_types=1);

namespace spec\Sylius\Bundle\CoreBundle\Applicator;

use Doctrine\Common\Collections\ArrayCollection;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\CoreBundle\Applicator\CatalogPromotionApplicatorInterface;
use Sylius\Bundle\CoreBundle\Calculator\CatalogPromotionPriceCalculatorInterface;
use Sylius\Bundle\CoreBundle\Formatter\AppliedPromotionInformationFormatterInterface;
use Sylius\Component\Core\Model\CatalogPromotionInterface;
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Core\Model\ChannelPricingInterface;
use Sylius\Component\Core\Model\ProductVariantInterface;
use Sylius\Component\Promotion\Model\CatalogPromotionActionInterface;

final class CatalogPromotionApplicatorSpec extends ObjectBehavior
{
    function let(
        CatalogPromotionPriceCalculatorInterface $priceCalculator,
        AppliedPromotionInformationFormatterInterface $appliedPromotionInformationFormatter
    ): void {
        $this->beConstructedWith($priceCalculator, $appliedPromotionInformationFormatter);
    }

    function it_implements_catalog_promotion_applicator_interface(): void
    {
        $this->shouldImplement(CatalogPromotionApplicatorInterface::class);
    }

    function it_applies_percentage_discount_on_product_variant(
        CatalogPromotionPriceCalculatorInterface $priceCalculator,
        AppliedPromotionInformationFormatterInterface $appliedPromotionInformationFormatter,
        ProductVariantInterface $variant,
        CatalogPromotionInterface $catalogPromotion,
        CatalogPromotionActionInterface $catalogPromotionAction,
        ChannelInterface $firstChannel,
        ChannelInterface $secondChannel,
        ChannelPricingInterface $firstChannelPricing,
        ChannelPricingInterface $secondChannelPricing
    ): void {
        $catalogPromotion->getActions()->willReturn(new ArrayCollection([$catalogPromotionAction->getWrappedObject()]));
        $catalogPromotion->getChannels()->willReturn(new ArrayCollection([
            $firstChannel->getWrappedObject(),
            $secondChannel->getWrappedObject(),
        ]));

        $variant->getChannelPricingForChannel($firstChannel)->willReturn($firstChannelPricing);
        $variant->getChannelPricingForChannel($secondChannel)->willReturn($secondChannelPricing);

        $appliedPromotionInformationFormatter->format($catalogPromotion)->willReturn(['winter_sale' => ['name' => 'Winter sale']]);

        $firstChannelPricing->hasExclusiveCatalogPromotionApplied()->willReturn(false);
        $firstChannelPricing->getPrice()->willReturn(1000);
        $firstChannelPricing->getOriginalPrice()->willReturn(null);
        $firstChannelPricing->getMinimumPrice()->willReturn(0);
        $firstChannelPricing->setOriginalPrice(1000)->shouldBeCalled();

        $priceCalculator->calculate($firstChannelPricing, $catalogPromotionAction)->willReturn(700);

        $firstChannelPricing->setPrice(700)->shouldBeCalled();
        $firstChannelPricing->addAppliedPromotion(['winter_sale' => ['name' => 'Winter sale']])->shouldBeCalled();
        $catalogPromotion->isExclusive()->willReturn(false);

        $secondChannelPricing->hasExclusiveCatalogPromotionApplied()->willReturn(false);
        $secondChannelPricing->getPrice()->willReturn(1400);
        $secondChannelPricing->getOriginalPrice()->willReturn(null);
        $secondChannelPricing->getMinimumPrice()->willReturn(0);
        $secondChannelPricing->setOriginalPrice(1400)->shouldBeCalled();

        $priceCalculator->calculate($secondChannelPricing, $catalogPromotionAction)->willReturn(980);

        $secondChannelPricing->setPrice(980)->shouldBeCalled();
        $secondChannelPricing->addAppliedPromotion(['winter_sale' => ['name' => 'Winter sale']])->shouldBeCalled();
        $catalogPromotion->isExclusive()->willReturn(false);

        $this->applyOnVariant($variant, $catalogPromotion);
    }

    function it_applies_discount_on_product_variant_only_if_exclusive_promotion_is_not_already_applied(
        CatalogPromotionPriceCalculatorInterface $priceCalculator,
        AppliedPromotionInformationFormatterInterface $appliedPromotionInformationFormatter,
        ProductVariantInterface $variant,
        CatalogPromotionInterface $catalogPromotion,
        CatalogPromotionActionInterface $catalogPromotionAction,
        ChannelInterface $firstChannel,
        ChannelInterface $secondChannel,
        ChannelPricingInterface $firstChannelPricing,
        ChannelPricingInterface $secondChannelPricing
    ): void {
        $catalogPromotion->getActions()->willReturn(new ArrayCollection([$catalogPromotionAction->getWrappedObject()]));
        $catalogPromotion->getChannels()->willReturn(new ArrayCollection([
            $firstChannel->getWrappedObject(),
            $secondChannel->getWrappedObject(),
        ]));

        $variant->getChannelPricingForChannel($firstChannel)->willReturn($firstChannelPricing);
        $variant->getChannelPricingForChannel($secondChannel)->willReturn($secondChannelPricing);

        $appliedPromotionInformationFormatter->format($catalogPromotion)->willReturn(['winter_sale' => ['name' => 'Winter sale']]);

        $firstChannelPricing->hasExclusiveCatalogPromotionApplied()->willReturn(true);

        $firstChannelPricing->addAppliedPromotion(['winter_sale' => ['name' => 'Winter sale']])->shouldNotBeCalled();

        $secondChannelPricing->hasExclusiveCatalogPromotionApplied()->willReturn(false);
        $secondChannelPricing->getPrice()->willReturn(1400);
        $secondChannelPricing->getOriginalPrice()->willReturn(null);
        $secondChannelPricing->getMinimumPrice()->willReturn(0);
        $secondChannelPricing->setOriginalPrice(1400)->shouldBeCalled();

        $priceCalculator->calculate($secondChannelPricing, $catalogPromotionAction)->willReturn(980);

        $secondChannelPricing->setPrice(980)->shouldBeCalled();
        $secondChannelPricing->addAppliedPromotion(['winter_sale' => ['name' => 'Winter sale']])->shouldBeCalled();
        $catalogPromotion->isExclusive()->willReturn(false);

        $this->applyOnVariant($variant, $catalogPromotion);
    }

    function it_does_not_set_original_price_during_application_if_its_already_there(
        CatalogPromotionPriceCalculatorInterface $priceCalculator,
        AppliedPromotionInformationFormatterInterface $appliedPromotionInformationFormatter,
        ProductVariantInterface $variant,
        CatalogPromotionInterface $catalogPromotion,
        CatalogPromotionActionInterface $catalogPromotionAction,
        ChannelInterface $channel,
        ChannelPricingInterface $channelPricing
    ): void {
        $catalogPromotion->getActions()->willReturn(new ArrayCollection([$catalogPromotionAction->getWrappedObject()]));
        $catalogPromotion->getChannels()->willReturn(new ArrayCollection([$channel->getWrappedObject()]));

        $variant->getChannelPricingForChannel($channel)->willReturn($channelPricing);

        $appliedPromotionInformationFormatter->format($catalogPromotion)->willReturn(['winter_sale' => ['name' => 'Winter sale']]);

        $channelPricing->hasExclusiveCatalogPromotionApplied()->willReturn(false);
        $channelPricing->getPrice()->willReturn(1000);
        $channelPricing->getOriginalPrice()->willReturn(2000);
        $channelPricing->getMinimumPrice()->willReturn(0);

        $priceCalculator->calculate($channelPricing, $catalogPromotionAction)->willReturn(500);

        $channelPricing->setOriginalPrice(Argument::any())->shouldNotBeCalled();
        $channelPricing->setPrice(500)->shouldBeCalled();
        $channelPricing->addAppliedPromotion(['winter_sale' => ['name' => 'Winter sale']])->shouldBeCalled();
        $catalogPromotion->isExclusive()->willReturn(false);

        $this->applyOnVariant($variant, $catalogPromotion);
    }

    function it_applies_percentage_discount_on_channel_pricing(
        CatalogPromotionPriceCalculatorInterface $priceCalculator,
        AppliedPromotionInformationFormatterInterface $appliedPromotionInformationFormatter,
        CatalogPromotionInterface $catalogPromotion,
        CatalogPromotionActionInterface $catalogPromotionAction,
        ChannelPricingInterface $channelPricing,
        ChannelInterface $channel
    ): void {
        $channel->getCode()->willReturn('WEB');

        $catalogPromotion->getActions()->willReturn(new ArrayCollection([$catalogPromotionAction->getWrappedObject()]));
        $catalogPromotion->getChannels()->willReturn(new ArrayCollection([$channel->getWrappedObject()]));

        $appliedPromotionInformationFormatter->format($catalogPromotion)->willReturn(['winter_sale' => ['name' => 'Winter sale']]);

        $channelPricing->hasExclusiveCatalogPromotionApplied()->willReturn(false);
        $channelPricing->getPrice()->willReturn(1000);
        $channelPricing->getMinimumPrice()->willReturn(0);
        $channelPricing->getOriginalPrice()->willReturn(null);
        $channelPricing->getChannelCode()->willReturn('WEB');

        $priceCalculator->calculate($channelPricing, $catalogPromotionAction)->willReturn(700);

        $channelPricing->setOriginalPrice(1000)->shouldBeCalled();
        $channelPricing->setPrice(700)->shouldBeCalled();
        $channelPricing->addAppliedPromotion(['winter_sale' => ['name' => 'Winter sale']])->shouldBeCalled();
        $catalogPromotion->isExclusive()->willReturn(false);

        $this->applyOnChannelPricing($channelPricing, $catalogPromotion);
    }

    function it_does_not_apply_percentage_discount_on_channel_pricing_if_catalog_promotion_does_not_have_the_proper_channel(
        CatalogPromotionPriceCalculatorInterface $priceCalculator,
        AppliedPromotionInformationFormatterInterface $appliedPromotionInformationFormatter,
        CatalogPromotionInterface $catalogPromotion,
        CatalogPromotionActionInterface $catalogPromotionAction,
        ChannelPricingInterface $channelPricing,
        ChannelInterface $channel
    ): void {
        $channel->getCode()->willReturn('WEB');

        $catalogPromotion->getActions()->willReturn(new ArrayCollection([$catalogPromotionAction->getWrappedObject()]));
        $catalogPromotion->getChannels()->willReturn(new ArrayCollection([$channel->getWrappedObject()]));

        $channelPricing->getChannelCode()->willReturn('MOBILE');

        $priceCalculator->calculate($channelPricing, $catalogPromotionAction)->shouldNotBeCalled();
        $appliedPromotionInformationFormatter->format($catalogPromotion)->shouldNotBeCalled();

        $channelPricing->setOriginalPrice(1000)->shouldNotBeCalled();
        $channelPricing->setPrice(700)->shouldNotBeCalled();
        $channelPricing->addAppliedPromotion(Argument::any())->shouldNotBeCalled();

        $this->applyOnChannelPricing($channelPricing, $catalogPromotion);
    }

    function it_does_not_apply_catalog_promotion_below_minimum_price(
        CatalogPromotionPriceCalculatorInterface $priceCalculator,
        AppliedPromotionInformationFormatterInterface $appliedPromotionInformationFormatter,
        CatalogPromotionInterface $catalogPromotion,
        CatalogPromotionActionInterface $catalogPromotionAction,
        ChannelPricingInterface $channelPricing,
        ChannelInterface $channel
    ): void {
        $channel->getCode()->willReturn('WEB');

        $catalogPromotion->getActions()->willReturn(new ArrayCollection([$catalogPromotionAction->getWrappedObject()]));
        $catalogPromotion->getChannels()->willReturn(new ArrayCollection([$channel->getWrappedObject()]));

        $appliedPromotionInformationFormatter->format($catalogPromotion)->willReturn(['winter_sale' => ['name' => 'Winter sale']]);

        $channelPricing->hasExclusiveCatalogPromotionApplied()->willReturn(false);
        $channelPricing->getPrice()->willReturn(1000);
        $channelPricing->getMinimumPrice()->willReturn(900);
        $channelPricing->getOriginalPrice()->willReturn(null);
        $channelPricing->getChannelCode()->willReturn('WEB');

        $priceCalculator->calculate($channelPricing, $catalogPromotionAction)->willReturn(900);

        $channelPricing->setOriginalPrice(1000)->shouldBeCalled();
        $channelPricing->setPrice(900)->shouldBeCalled();
        $channelPricing->addAppliedPromotion(['winter_sale' => ['name' => 'Winter sale']])->shouldBeCalled();
        $catalogPromotion->isExclusive()->willReturn(false);

        $this->applyOnChannelPricing($channelPricing, $catalogPromotion);
    }

    function it_does_not_apply_catalog_promotion_if_product_variant_is_at_its_minimum_price(
        CatalogPromotionPriceCalculatorInterface $priceCalculator,
        AppliedPromotionInformationFormatterInterface $appliedPromotionInformationFormatter,
        CatalogPromotionInterface $catalogPromotion,
        CatalogPromotionActionInterface $catalogPromotionAction,
        ChannelPricingInterface $channelPricing,
        ChannelInterface $channel
    ): void {
        $channel->getCode()->willReturn('WEB');

        $catalogPromotion->getActions()->willReturn(new ArrayCollection([$catalogPromotionAction->getWrappedObject()]));
        $catalogPromotion->getChannels()->willReturn(new ArrayCollection([$channel->getWrappedObject()]));

        $appliedPromotionInformationFormatter->format($catalogPromotion)->willReturn(['winter_sale' => ['name' => 'Winter sale']]);
        $catalogPromotionAction->getConfiguration()->willReturn(['amount' => 0.3]);

        $channelPricing->hasExclusiveCatalogPromotionApplied()->willReturn(false);
        $channelPricing->getPrice()->willReturn(900);
        $channelPricing->getMinimumPrice()->willReturn(900);
        $channelPricing->getOriginalPrice()->willReturn(900);
        $channelPricing->getChannelCode()->willReturn('WEB');

        $priceCalculator->calculate($channelPricing, $catalogPromotionAction)->shouldNotBeCalled();

        $channelPricing->setOriginalPrice(Argument::any())->shouldNotBeCalled();
        $channelPricing->setPrice(Argument::any())->shouldNotBeCalled();
        $channelPricing->addAppliedPromotion(Argument::any())->shouldNotBeCalled();

        $this->applyOnChannelPricing($channelPricing, $catalogPromotion);
    }
}


text:
/**
 *
 */
package at.free23.shop.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import at.free23.shop.api.client.ItemDto;
import at.free23.shop.service.IStockService;

/**
 * @author michael.vlasaty
 *
 */
@Service
public class StockService implements IStockService {

	@Autowired
	private DiscoveryClient discoveryClient;

	@Autowired
	private RestTemplate template;

	@Value("${stock.instance-id}")
	private String stockInstanceId;

	@Value("${stock.item.uri-prefix}")
	private String stockItemUriPrefix;

	/* (non-Javadoc)
	 * @see at.free23.shop.service.IStockService#fetchStockItem(java.lang.String)
	 */
	@Override
	public ItemDto fetchStockItem(String uuid) {
		final String uri = this.getStockServiceUri() + this.stockItemUriPrefix + uuid;
		return this.template.getForObject(uri, ItemDto.class);
	}

	private String getStockServiceUri() {
		return this.discoveryClient.getInstances(this.stockInstanceId).get(0).getUri().toString();
	}

	/**
	 * @return the stockInstanceId
	 */
	public String getStockInstanceId() {
		return this.stockInstanceId;
	}

	/**
	 * @param stockInstanceId
	 *            the stockInstanceId to set
	 */
	public void setStockInstanceId(String stockInstanceId) {
		this.stockInstanceId = stockInstanceId;
	}

	/**
	 * @return the stockItemUriPrefix
	 */
	public String getStockItemUriPrefix() {
		return this.stockItemUriPrefix;
	}

	/**
	 * @param stockItemUriPrefix
	 *            the stockItemUriPrefix to set
	 */
	public void setStockItemUriPrefix(String stockItemUriPrefix) {
		this.stockItemUriPrefix = stockItemUriPrefix;
	}

}


text:
// stasm_main.cpp: command line utility to run Stasm on a set of images
//
// Copyright (C) 2005-2013, Stephen Milborrow

#include "stasm.h"
#include "opencv/highgui.h"
#include "appmisc.h"

namespace stasm
{
static bool writeimgs_g = true;               // -i flag
static bool multiface_g;                      // -m flag
static int  minwidth_g = 25;                  // -s flag
static int  nlandmarks_g = stasm_NLANDMARKS;  // -n flag
static bool csv_g;                            // -c flag

//-----------------------------------------------------------------------------

static void GetOptions(
    int&          argc, // in
    const char**& argv) // io
{
    static const char* const usage =
        "stasm [FLAGS] IMAGE [IMAGE2 ...]\n"
        "\n"
        "Landmark results are saved in stasm.log\n"
        "\n"
        "Example: stasm face.jpg\n"
        "\n"
        "Flags:\n"
        "    -m     allow multiple faces per image (default is just the largest)\n"
        "    -s     detect small faces (min width 10%% of image width, the default is 25%%)\n"
        "    -n N   save as 77, 76, 68, 22, 20, or 17 point shape\n"
        "    -c     save landmarks as CSVs (default saves in shapefile format)\n"
        "    -i     do not write landmarked images (faster)\n"
        "    -d     enable debug prints\n"
        "    -?     help\n"
        "\n"
        "Stasm version %s    www.milbo.users.sonic.net/stasm\n"; // %s is stasm_VERSION

    if (argc < 2)
        Err("No image.  Use stasm -? for help.");
    while (--argc > 0 && (*++argv)[0] == '-')
    {
        if ((*argv + 1)[1])
            Err("Invalid argument -%s (there must be a space after -%c).  "
                "Use stasm -? for help.",
                *argv + 1, (*argv + 1)[0]);
        switch ((*argv + 1)[0])
        {
        case 'c':
            csv_g = true;
            break;
        case 'd':
            trace_g = true; // trace_g defined in print.cpp
            break;
        case 'i':
            writeimgs_g = false;
            break;
        case 'm':
            multiface_g = true;
            break;
        case 's':
            minwidth_g = 10;
            break;
        case 'n':
            if (argc < 3)
                Err("-n argument must be followed by NLANDMARKS.  For example -n 68");
            argc--;
            argv++;
            nlandmarks_g = -1;
            if (1 != sscanf(*argv, "%d", &nlandmarks_g) || nlandmarks_g < 1)
                Err("-n argument must be followed by NLANDMARKS.  For example -n 68");
            // validity of nlandmarks_g will be checked later after call to ConvertShape
            break;
        case '?':
            printf(usage, stasm_VERSION);
            exit(1);
        default:
            Err("Invalid argument -%s.  Use stasm -? for help.", *argv + 1);
            break;
        }
    }
    if (argc < 1)
        Err("No image.  Use stasm -? for help.");
}

static void ProcessFace(
    CImage&      cimg,      // io: color version of image
    const float* landmarks, // in
    int          nfaces,    // in
    const char*  imgpath)   // in
{
    Shape shape(LandmarksAsShape(landmarks));
    Shape converted_shape(ConvertShape(shape, nlandmarks_g));
    if (converted_shape.rows == 0)
    {
        static int printed;
        PrintOnce(printed, "\nCannot convert a %d point shape to a %d point shape\n",
                  shape.rows, nlandmarks_g);
    }
    else
        shape = converted_shape;
    if (writeimgs_g)
        DrawShape(cimg, shape);
    if (multiface_g)
    {
        logprintf("face %d\n", nfaces);
        double xmin, xmax, ymin, ymax; // needed to position face nbr
        ShapeMinMax(xmin, xmax, ymin, ymax, shape);
        ImgPrintf(cimg,
                  (xmin + xmax)/2, ymin - (ymax-ymin)/50., C_RED, 1,
                 "%d", nfaces);
    }
    if (csv_g)
        LogShapeAsCsv(shape, imgpath);
    else
        LogShape(shape, imgpath);
}

static void ProcessImg(
    const char* imgpath) // in
{
    Image img(cv::imread(imgpath, CV_LOAD_IMAGE_GRAYSCALE));
    if (!img.data)
        Err("Cannot load %s", imgpath);
    if (!stasm_open_image((const char*)img.data, img.cols, img.rows, imgpath,
                          multiface_g, minwidth_g))
        Err("stasm_open_image failed:  %s", stasm_lasterr());

    CImage cimg;     // color version of image
    if (writeimgs_g) // actually need the color image?
        cvtColor(img, cimg, CV_GRAY2BGR);
    int nfaces = 0;
    while (1)
    {
        if (trace_g && nfaces > 0 && multiface_g)
            stasm_printf("\n%d: ", nfaces);

        int foundface;
        float landmarks[2 * stasm_NLANDMARKS]; // x,y coords
        if (!stasm_search_auto(&foundface, landmarks))
            Err("stasm_search_auto failed: %s", stasm_lasterr());

        if (!foundface)
            break; // note break

        ProcessFace(cimg, landmarks, nfaces, Base(imgpath));
        nfaces++;
    }
    if (trace_g)
        lprintf("\n");
    if (writeimgs_g && nfaces)
    {
        // write as a bmp not as a jpg because don't want blurred shape lines
        char newpath[SLEN]; sprintf(newpath, "%s_stasm.bmp", Base(imgpath));
        lprintf("%s ", newpath);
        if (!cv::imwrite(newpath, cimg))
            Err("Cannot write %s", newpath);
    }
    lprintf("%d face%s\n", nfaces, plural(nfaces));
}

static void main1(int argc, const char** argv)
{
    GetOptions(argc, argv);
    OpenLogFile();

    // argc is now the number of images and argv is the image filenames

    const bool old_trace = trace_g;
    if (!stasm_init("../data", 1 /*trace*/))
        Err("stasm_init failed %s", stasm_lasterr());
    trace_g = old_trace;

    const int ndigits = NumDigits(argc); // for aligning prints

    for (int i_img = 0; i_img < argc; i_img++)
    {
        const char* const imgpath = argv[i_img];
        if (argc > 1)
            lprintf("%*d ", ndigits, i_img);
        lprintf("%s: ", imgpath);
        ProcessImg(imgpath);
    }
}

} // namespace stasm

// This application calls Stasm's internal routines.  Thus we need to catch a
// potential throw from Stasm's error handlers.  Hence the try/catch code below.

int main(int argc, const char** argv)
{
    stasm::CatchOpenCvErrs();
    try
    {
        stasm::main1(argc, argv);
    }
    catch(...)
    {
        // a call was made to Err or a CV_Assert failed
        printf("\n%s\n", stasm_lasterr());
        exit(1);
    }
    return 0;       // success
}


text:
using System.IO;
using System.Linq;

namespace SharpSwift
{
    class ArgData
    {
        /// <summary>
        /// Path to the .sln file
        /// </summary>
        public string SlnPath { get; set; }

        /// <summary>
        /// Path to the file to parse
        /// </summary>
        public string InputPath { get; set; }

        /// <summary>
        /// Boolean indicating whether to indent the output
        /// </summary>
        public bool Indent { get; set; }

        /// <summary>
        /// Path to the output .swift file
        /// </summary>
        public string OutputPath { get; set; }

        public ArgData(string[] args)
        {
            Indent = true;
            string namedArgument = null;

            for (var i = 0; i < args.Length; i++)
            {
                var arg = args[i];
                if (arg.StartsWith("-"))
                {
                    namedArgument = arg.ToLower().Trim('-');
                    if (namedArgument == "no-indent")
                    {
                        Indent = false;
                    }
                    continue;
                }

                if (namedArgument != null)
                {
                    switch (namedArgument)
                    {
                        case "input":
                        case "i":
                            InputPath = arg;
                            break;
                        case "solution":
                        case "sln":
                        case "s":
                            SlnPath = arg;
                            break;
                        case "output":
                        case "o":
                            OutputPath = arg;
                            break;
                    }
                    namedArgument = null;
                    continue;
                }

                switch (i)
                {
                    case 0:
                        InputPath = arg;
                        break;
                    case 1:
                        OutputPath = arg;
                        break;
                    case 2:
                        SlnPath = arg;
                        break;
                }
            }
        }

        private string FindSolution(string path, int levels)
        {
            if (File.Exists(path))
            {
                path = (new FileInfo(path)).DirectoryName;
            }

            if (levels == 0) //too much recursion is bad o:
            {
                return "";
            }

            return Directory.GetFiles(path).FirstOrDefault(file => file.EndsWith(".sln")) ??
                   FindSolution((new DirectoryInfo(path)).Parent.FullName, levels - 1);
        }

        public bool Clean()
        {
            if (!File.Exists(InputPath) || !InputPath.EndsWith(".cs"))
            {
                return false;
            }

            SlnPath = SlnPath ?? FindSolution(InputPath, 5);
            if (!File.Exists(SlnPath) || !SlnPath.EndsWith(".sln"))
            {
                return false;
            }

            OutputPath = OutputPath ?? InputPath.Substring(0, (InputPath.Length - ".cs".Length)) + ".swift";

            return OutputPath.EndsWith(".swift");
        }
    }
}


text:
package xchango

import (
	"bytes"
	"errors"
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
	"net/url"
	"text/template"
	"time"
)

type ExchangeConfig interface {
	ExchangeURL() string
	MaxFetchSize() int
	UserDomain() string
	ExchangeVersion() string
	LookAheadDays() int
}

type exchangeVersion interface {
	FolderRequest() string
	CalendarRequest() string
	CalendarDetailRequest() string
}

type ExchangeUser struct {
	Username string
	Password string
}

type ExchangeCalendar struct {
	Folderid  string
	Changekey string
}

var exchangeConfig ExchangeConfig
var version exchangeVersion
var host string

func SetExchangeConfig(config ExchangeConfig) {
	exchangeConfig = config

	switch config.ExchangeVersion() {
	case "2006":
		version = exchange2006{}
	default:
		panic(errors.New(fmt.Sprintf("Unsupported exchange version %s.  Current supported versions are: 2006", config.ExchangeVersion())))
	}

	u, err := url.Parse(config.ExchangeURL())
	if err != nil {
		panic(err)
	}
	host = u.Host
}

func GetExchangeCalendar(user *ExchangeUser) (*ExchangeCalendar, error) {
	soapReq := version.FolderRequest()
	results, err := postContents([]byte(soapReq), user)

	if err != nil {
		return &ExchangeCalendar{}, err
	}

	log.Printf("Exchange server return results of: %s", results)
	item := parseCalendarFolder(string(results))

	cal := ExchangeCalendar{
		Folderid:  item.Id,
		Changekey: item.ChangeKey,
	}
	return &cal, nil
}

func GetExchangeAppointments(user *ExchangeUser, cal *ExchangeCalendar) (*[]Appointment, error) {
	// This first call will just get ids for each appt
	calRequest := buildCalendarItemRequest(cal.Folderid, cal.Changekey)
	calResults, err := postContents(calRequest, user)
	if err != nil {
		log.Println("Error while getting soap response:", err)
		return nil, err
	}
	itemIds := parseAppointments(calResults)

	// This call will get all the fields given the ids
	appRequest := buildCalendarDetailRequest(itemIds)
	appResults, err := postContents(appRequest, user)
	if err != nil {
		return nil, err
	}

	appointments := parseAppointments(appResults)
	if err != nil {
		return nil, err
	}

	return &appointments, nil
}

func buildCalendarItemRequest(folderid string, changekey string) []byte {

	days := exchangeConfig.LookAheadDays()
	if days < 1 {
		days = 14
	}
	startDate := time.Now().UTC().Format(time.RFC3339)
	endDate := time.Now().UTC().AddDate(0, 0, days).Format(time.RFC3339)

	data := struct {
		StartDate    string
		EndDate      string
		FolderId     string
		ChangeKey    string
		MaxFetchSize int
	}{
		startDate,
		endDate,
		folderid,
		changekey,
		exchangeConfig.MaxFetchSize(),
	}

	t, err := template.New("cal").Parse(version.CalendarRequest())
	if err != nil {
		log.Println("Error while parsing template for item request", err)
	}
	var doc bytes.Buffer
	t.Execute(&doc, data)
	if err != nil {
		log.Println("Error while building contents ", err)
	}

	return doc.Bytes()
}

func buildCalendarDetailRequest(itemIds []Appointment) []byte {

	data := struct {
		Appointments []Appointment
	}{
		itemIds,
	}

	t, err := template.New("detail").Parse(version.CalendarDetailRequest())
	if err != nil {
		log.Println("Error while parsing for detail request", err)
	}
	var doc bytes.Buffer
	t.Execute(&doc, data)
	return doc.Bytes()
}

func postContents(contents []byte, user *ExchangeUser) (string, error) {
	req2, err := http.NewRequest("POST", exchangeConfig.ExchangeURL(), bytes.NewBuffer(contents))

	req2.Header.Set("Host", user.Username+"@"+host)
	req2.Header.Set("Content-Type", "text/xml")
	req2.SetBasicAuth(exchangeConfig.UserDomain()+"/"+user.Username, user.Password)

	// TODO, allow client to be injected by tests!
	client := &http.Client{}
	response, err := client.Do(req2)
	if err != nil {
		return "", err
	}
	defer response.Body.Close()

	content, err := ioutil.ReadAll(response.Body)
	if err != nil {
		log.Println(err)
		return "", err
	}
	return string(content), nil
}


text:
/**
 * Created by nbalasundaram on 10/1/15.
 */
require('colors');

var wd = require('wd');
var dataUtil = require("../../util/date-utility");
var loginPage = require("../../support/pages/loginpo");
var brainPage = require("../../support/pages/brianpo");
var session = require("../../support/setup/browser-session");

var testData = require("../../../../test_data/data.json");
var report = require("../../support/reporting/reportgenerator");

var practiceQuizCreation = require("../../support/pages/casTestPage");
var stringutil = require("../../util/stringUtil");

var asserters = wd.asserters;

describe('4LTR (' + 'INSTRUCTOR' + ') :: RETAKE PRACTICE QUIZ EXISTING COURSE', function () {
    var browser;
    var allPassed = true;
    var userType;

    var practiceQuizValidationStatus = "failure";

    var product;
    var courseName;
    var length = null;

    before(function (done) {

        browser = session.create(done);

        userType = "instructor";

        product = stringutil.removeBoundaryQuotes(process.env.RUN_FOR_PRODUCT.toString()) || testData.existingCourseDetails.product;

        if (product === "default") {
            product = testData.existingCourseDetails.product;
        }

        courseName = stringutil.removeBoundaryQuotes(process.env.RUN_FOR_COURSE.toString()) || testData.existingCourseDetails.coursename;

        if (courseName === "default") {

            courseName = testData.existingCourseDetails.coursename;
        }

        data = loginPage.setLoginData(userType);

        //Reports
        console.log(report.formatTestName("CAS INTEGRATION TEST :: INSTRUCTOR ::  RETAKE PRACTICE QUIZ "));
        console.log(report.formatTestData(data.urlForLogin, data.userId, product, courseName));

    });

    afterEach(function (done) {
        allPassed = allPassed && (this.currentTest.state === 'passed');
        done();
    });

    after(function (done) {

        console.log(report.reportHeader() +
            report.stepStatus("Retake Practice Quiz Validation status ", practiceQuizValidationStatus) +
            report.reportFooter());
        session.close(allPassed, done);
    });

    it("1. Login to 4LTR platform", function (done) {
        loginPage.loginToApplication(browser, done);

    });

    it("2. Select a Product", function (done) {

        brainPage.selectProduct(product, browser, done);

    });

    it("3. Select a Course and launch", function (done) {

        loginPage.launchACourse(userType, courseName, browser, done);

    });

    it("4. Retake a Practice quiz and exit", function (done) {

        //Call this function if you want a specific block to timeout after a specific time interval
        this.timeout(90000);

        browser
            .waitForElementByCss("div.icon-studyboard-blue", asserters.isDisplayed, 3000)
            .click()
            .waitForElementByXPath("//a[contains(.,'StudyBits')]", asserters.isDisplayed, 20000)
            .click()
            .then(function () {

                practiceQuizCreation.navigateToRetakeQuizFromStudyBoard(browser)
                    .then(function () {

                        browser
                            .sleep(5000)
                            .elementByCssSelectorWhenReady("span.cas-text", 10000)
                            .isDisplayed()
                            .should.become(true)
                            .execute('return document.getElementsByClassName("cas-activity-series").length').then(function (len) {

                                console.log("No of Quiz Questions : " + len);
                                countOfQuestions = len;
                                completedQuestions = 0;

                                function selectAnAnswerAndProceed() {

                                    if (countOfQuestions > 0) {
                                        countOfQuestions--;
                                        completedQuestions++;

                                        browser.execute('return document.getElementsByClassName("cas-task")[0].getElementsByClassName("cas-truefalse").length').then(function (length) {
                                            if (length.toString() === "0") {
                                                browser.execute('return document.getElementsByClassName("cas-task")[0].getElementsByClassName("cas-multiple-choice")[0].tagName').then(function (tag) {
                                                    if (tag === "DIV") {
                                                        browser
                                                            .waitForElementByXPath("(//label[@class='cas-choice-radio'])[1]", asserters.isDisplayed, 3000).click()
                                                            .elementByCssSelectorWhenReady("button.btn.btn-default.cas-activity-action", 3000).click();
                                                        console.log("Answered a Question with Radio Button " + completedQuestions + " and remaining Questions " + countOfQuestions);

                                                    } else {
                                                        browser
                                                            .waitForElementByCss("div.cas-selection-list-item", asserters.isDisplayed, 4000)
                                                            .click()
                                                            .waitForElementByCss("ul li:nth-of-type(1) a span.cas-text", asserters.isDisplayed, 10000)
                                                            .click()
                                                            .elementByCssSelectorWhenReady("button.btn.btn-default.cas-activity-action", 3000).click();
                                                        console.log("Answered a Question with a Drop down " + completedQuestions + " and remaining Questions " + countOfQuestions);

                                                    }

                                                    setTimeout(selectAnAnswerAndProceed, 3000);
                                                });
                                            }
                                            else {
                                                browser.execute('return document.getElementsByClassName("cas-task")[0].getElementsByClassName("cas-truefalse")[0].tagName').then(function (tag) {
                                                    if (tag === "DIV") {
                                                        browser
                                                            .waitForElementByXPath("(//div[@class='cas-choice-item'])[1]/label", asserters.isDisplayed, 3000).click()
                                                            .elementByCssSelectorWhenReady("button.btn.btn-default.cas-activity-action", 3000).click();
                                                        console.log("Answered a True or False Question " + completedQuestions + " and remaining Questions " + countOfQuestions);

                                                    } else {

                                                        console.log("Problem in answering T/F");

                                                    }

                                                    setTimeout(selectAnAnswerAndProceed, 3000);
                                                });
                                            }
                                        })

                                    } else {

                                        if (completedQuestions == len) {
                                            console.log("All Questions successfully attempted");

                                            browser.waitForElementByCss(".sliding-menu-button.past-quizzes.ng-scope", asserters.isDisplayed, 5000)
                                                .waitForElementByCss(".sliding-menu-button.retake-quiz.ng-scope", asserters.isDisplayed, 1000)
                                                .waitForElementByCss(".progress", asserters.isDisplayed, 1000)
                                                .waitForElementByXPath("//a[@aria-controls='incorrect']", asserters.isDisplayed, 1000)
                                                .waitForElementByCss(".exit.ng-scope", asserters.isDisplayed, 3000)
                                                .then(function (el) {

                                                    practiceQuizValidationStatus = "success";
                                                    el.click().then(function () {
                                                        done();
                                                    });
                                                });

                                        }
                                        else {
                                            console.log("failure");
                                            practiceQuizValidationStatus = "failure";
                                            done();
                                        }

                                    }

                                }

                                //Function to answer all the Questions
                                selectAnAnswerAndProceed();

                            });
                    });

            });

    });

});


text:
namespace extensions {

class I18nGetAcceptLanguagesFunction : public ExtensionFunction {
  ~I18nGetAcceptLanguagesFunction() override {}
  ResponseAction Run() override;
  DECLARE_EXTENSION_FUNCTION("i18n.getAcceptLanguages", I18N_GETACCEPTLANGUAGES)
};

}  // namespace extensions

#endif  // EXTENSIONS_BROWSER_API_I18N_I18N_API_H_


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Report of the Department of Agriculture, Government Research Institute of Formosa 19: 88 (1919)

#### Original name
Nozemia lepironiae Sawada

### Remarks
null


text:
namespace Xilium.CefGlue
{
    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.Runtime.InteropServices;
    using Xilium.CefGlue.Interop;

    // Role: PROXY
    public sealed unsafe partial class CefCommandLine : IDisposable
    {
        internal static CefCommandLine FromNative(cef_command_line_t* ptr)
        {
            return new CefCommandLine(ptr);
        }

        internal static CefCommandLine FromNativeOrNull(cef_command_line_t* ptr)
        {
            if (ptr == null) return null;
            return new CefCommandLine(ptr);
        }

        private cef_command_line_t* _self;

        private CefCommandLine(cef_command_line_t* ptr)
        {
            if (ptr == null) throw new ArgumentNullException("ptr");
            _self = ptr;
        }

        ~CefCommandLine()
        {
            if (_self != null)
            {
                Release();
                _self = null;
            }
        }

        public void Dispose()
        {
            if (_self != null)
            {
                Release();
                _self = null;
            }
            GC.SuppressFinalize(this);
        }

        internal void AddRef()
        {
            cef_command_line_t.add_ref(_self);
        }

        internal bool Release()
        {
            return cef_command_line_t.release(_self) != 0;
        }

        internal bool HasOneRef
        {
            get { return cef_command_line_t.has_one_ref(_self) != 0; }
        }

        internal cef_command_line_t* ToNative()
        {
            AddRef();
            return _self;
        }
    }
}


text:
default:
	go test -v


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace ShowReminder.Web.Models
{
    public class ShowNextLast : Show
    {

        public Episode NextEpisode { get; set; }

        public Episode LastEpisode { get; set; }

    }
}


text:
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using beRemote.Core.Definitions.Enums.Filter;
using beRemote.GUI.ViewModel.EventArg;

namespace beRemote.GUI.ViewModel.Worker
{
    public class ConnectionFilter
    {
        public static void AddFilter(ObservableCollection<ViewModelTabBase> tabs, FilterType filterTypeToAdd)
        {
            foreach (var aTab in tabs)
            {
                if (aTab.Content.GetType() == typeof (Tabs.ManageFilter.TabManageFilter))
                {
                    var theTab = (Tabs.ManageFilter.TabManageFilter) aTab.Content;
                    theTab.AddFilter(filterTypeToAdd);
                    break;
                }
            }
        }
    }
}


text:
import debug
import logsupport
from screens import screen
import screens.supportscreens as supportscreens
from utils import utilities, displayupdate
from keys.keyspecs import KeyTypes
from keys.keyutils import _resolvekeyname, BrightnessPossible
from logsupport import ConsoleWarning
from keyspecs.toucharea import ManualKeyDesc
import functools

class OnOffKey(ManualKeyDesc):
	def __init__(self, thisscreen, keysection, kn, keytype='ONOFF'):
		keyname, self.Hub = _resolvekeyname(kn, thisscreen.DefaultHubObj)
		# self.ControlObj = None  # object on which to make operation calls
		self.DisplayObj = None  # object whose state is reflected in key

		self.oldval = '####'

		debug.debugPrint('Screen', "             New ", keytype, " Key Desc ", keyname)
		self.statebasedkey = True
		ManualKeyDesc.__init__(self, thisscreen, keysection, keyname)

		if keyname == '*Action*': keyname = self.NodeName  # special case for alert screen action keys that always have same name
		self.ControlObj, self.DisplayObj = self.Hub.GetNode(keyname, self.SceneProxy)

		if self.ControlObjUndefined():
			debug.debugPrint('Screen', "Screen", keyname, "unbound")
			logsupport.Logs.Log('Key Binding missing: ' + self.name, severity=ConsoleWarning)
		if hasattr(self.ControlObj, 'SendOnPct'): self.AllowSlider = True

		if self.Verify:
			self.VerifyScreen = supportscreens.VerifyScreen(self, self.GoMsg, self.NoGoMsg, self.KeyPressAction,
															thisscreen, self.KeyColorOff,
															thisscreen.BackgroundColor, thisscreen.CharColor,
															self.State, thisscreen.HubInterestList)
			self.Proc = self.VerifyScreen.Invoke
		else:
			self.Proc = self.KeyPressAction
			self.ProcDblTap = self.KeyPressActionDbl

		if self.AllowSlider:
			screen.AddUndefaultedParams(self, keysection, SlideOrientation=0)
			self.SliderScreen = supportscreens.SliderScreen(self, self.KeyCharColorOn, self.KeyColor,
															self.ControlObj.GetBrightness,
															self.UpdateBrightness, orientation=self.SlideOrientation)
			if hasattr(self.ControlObj, 'IdleSend'):
				self.SliderScreen.RequestIdles(self.ControlObj.IdleSend, 2)
			self.ProcLong = self.SliderScreen.Invoke
		else:
			self.ProcLong = self.IgnoreLong

		if keytype == 'ONOFF':
			self.KeyAction = 'OnOff'
		elif keytype == 'ON':
			self.KeyAction = 'On'
		else:
			self.KeyAction = 'Off'

		utilities.register_example("OnOffKey", self)

	def ConnectandGetNameOverride(self, keyname, keysection):
		screen.AddUndefaultedParams(self, keysection, SceneProxy='', NodeName='')
		if keyname == '*Action*': keyname = self.NodeName  # special case for alert screen action keys that always have same name
		self.ControlObj, self.DisplayObj = self.Hub.GetNode(keyname, self.SceneProxy)
		try:
			if self.ControlObj.FriendlyName != '':
				return [self.ControlObj.FriendlyName]
		except AttributeError:
			# noinspection PyAttributeOutsideInit
			return [self.name]

	def HandleNodeEvent(self, evnt):
		if not isinstance(evnt.value, int):
			try:
				if evnt.node.split('.')[0] == 'scene':
					evnt.value = 1
				else:
					logsupport.Logs.Log(
						"Node event to key {} on screen {} with non integer state: {}".format(self.name,
																							  self.Screen.name,
																							  evnt),
						severity=ConsoleWarning)
					evnt.value = 1
			except Exception as E:
				logsupport.Logs.Log(
					'Exception handling node event key {} on screen {} event {} exception {}'.format(self.name,
																									 self.Screen.name,
																									 evnt, E),
					severity=ConsoleWarning)
				evnt.value = 1

		oldunknown = self.UnknownState
		self.State = not (evnt.value == 0)  # K is off (false) only if state is 0
		self.UnknownState = True if evnt.value == -1 else False
		# if self.UnknownState:
		# add node to unknowns list for hub
		#	self.ControlObj.Hub.AddToUnknowns(self.ControlObj,evnt)
		# elif oldunknown and not self.UnknownState:
		#	self.ControlObj.Hub.DeleteFromUnknowns(self.ControlObj,evnt)
		self.PaintKey()
		displayupdate.updatedisplay()

	def FinishKey(self, center, size, firstfont=0, shrink=True):
		super(OnOffKey, self).FinishKey(center, size, firstfont, shrink)
		if self.DisplayObj is not None:
			self.Screen.AddToHubInterestList(self.Hub, self.DisplayObj.address, self)

	def InitDisplay(self):
		debug.debugPrint("Screen", "OnOffKey Key.InitDisplay ", self.Screen.name, self.name)
		state = self.Hub.GetCurrentStatus(self.DisplayObj)
		if state is None:
			logsupport.Logs.Log("No state available for  key: " + self.name + ' on screen: ' + self.Screen.name)
			state = -1
			self.State = False
		else:
			self.State = not (state == 0)  # K is off (false) only if state is 0
		self.UnknownState = True if state == -1 else False
		super().InitDisplay()

	def KeyPressAction(self):
		if self.KeyAction == "OnOff":
			self.State = not self.State
		elif self.KeyAction == "On":
			self.State = True
		elif self.KeyAction == "Off":
			self.State = False

		if not self.ControlObjUndefined():
			poststate = self.ControlObj.SendOnOffCommand(self.State)
			if poststate is not None: self.State = poststate
			self.ScheduleBlinkKey(self.Blink)
		else:
			logsupport.Logs.Log("Screen: " + self.Screen.name + " press unbound key: " + self.name,
								severity=ConsoleWarning)
			self.ScheduleBlinkKey(20)

	def KeyPressActionDbl(self):
		if self.KeyAction == "OnOff":
			self.State = not self.State
		elif self.KeyAction == "On":
			self.State = True
		elif self.KeyAction == "Off":
			self.State = False

		if not self.ControlObjUndefined():
			self.ControlObj.SendOnOffFastCommand(self.State)
			self.ScheduleBlinkKey(self.Blink)
		else:
			logsupport.Logs.Log("Screen: " + self.Screen.name + " press unbound key: " + self.name,
								severity=ConsoleWarning)
			self.ScheduleBlinkKey(20)

	def IgnoreLong(self):
		logsupport.Logs.Log('Ignore long press for screen {}, key {}'.format(self.Screen.name, self.name))
		self.ScheduleBlinkKey(5)

	def ProcLong(self):
		self.State = True
		self.SliderScreen.Invoke()

	def UpdateBrightness(self, brtpct, final=False):
		# print('Update brt {}'.format(brtpct))
		self.ControlObj.SendOnPct(brtpct, final=final)

BrightnessPossible.append(OnOffKey)
KeyTypes['ONOFF'] = functools.partial(OnOffKey, keytype='ONOFF')
KeyTypes['ON'] = functools.partial(OnOffKey, keytype='ON')
KeyTypes['OFF'] = functools.partial(OnOffKey, keytype='OFF')


text:
#ifndef __DC_SoundData_H__
#define __DC_SoundData_H__

#include "Sound.h"

DC_BEGIN_DREEMCHEST

namespace Sound {

    // ** struct SoundDataInfo
    struct SoundDataInfo {
        String          identifier;
        String          uri;
        String          group;
        u32             type;
        u8              loading;
        f32             fadeTime;
        f32             volume;
        Range           volumeModifier;
        f32             pitch;
        Range           pitchModifier;
        bool            isLooped;
        bool            isRelative;
        f32             referenceDistance;
        f32             maximumDistance;
        u32             priority;
    };

    //! SoundData class represents a single sound that is shared
    //! across all hardware sources that are playing a sound.
    class SoundData : public RefCounted {
    friend class SoundFx;
    public:

        //! Supported sound loading flags
        enum LoadingFlags {
            Stream,            //!< The sound is streamed from an asset file.
            Decode,            //!< Decode the sound data and store the result in RAM.
            LoadToRam,         //!< The sound asset file is copied to the RAM without decoding.
        };

    public:

                                //! Sound data constructor.
                                /*!
                                    \param identifier Sound identifier.
                                    \param uri Sound asset unique identifier.
                                    \param group The sound group this sound belongs to. Pass NULL for orphan sounds.
                                 */
                                SoundData( SoundFxWPtr sfx, CString identifier, CString uri, SoundGroupWPtr group );
                                ~SoundData( void );

        //! Returns a sound identifier.
        CString                    identifier( void ) const;
        //! Sets a sound identifier.
        void                    setIdentifier( CString value );
        //! Returns a sound URI identifier.
        CString                    uri( void ) const;
        //! Sets a sound URI identifier.
        void                    setUri( CString value );
        //! Returns a pointer to a sound group (NULL for orphan sounds).
        SoundGroupWPtr            group( void ) const;
        //! Sets a pointer to a sound group.
        void                    setGroup( SoundGroupWPtr value );
        //! Returns a sound type.
        u32                        type( void ) const;
        //! Sets a sound type.
        void                    setType( u32 value );
        //! Returns a sound loading flag.
        LoadingFlags            loading( void ) const;
        //! Sets a sound loading flag.
        void                    setLoading( LoadingFlags value );
        //! Returns a sound container format.
        SoundContainerFormat    format( void ) const;
        //! Sets the sound container format.
        void                    setFormat( SoundContainerFormat value );
        //! Returns a sound fade in/fade out time.
        f32                        fadeTime( void ) const;
        //! Sets a sound fade in/fade out time.
        void                    setFadeTime( f32 value );
        //! Returns base sound playback volume.
        f32                        volume( void ) const;
        //! Sets a base sound playback volume.
        void                    setVolume( f32 value );
        //! Returns base sound playback pitch.
        f32                        pitch( void ) const;
        //! Sets a base sound playback pitch.
        void                    setPitch( f32 value );
        //! Returns true if this sound is looped, otherwise false.
        bool                    isLooped( void ) const;
        //! Sets a sound looping flag.
        void                    setLooped( bool value );
        //! Returns true if this sound is positioned relatively to a listener.
        bool                    isRelative( void ) const;
        //! Sets a sound relative flag.
        void                    setRelative( bool value );
        //! Returns the reference distance value.
        /*!
            The distance under which the volume for the source
            would normally drop by half (before being influenced
            by rolloff factor or maximumDistance).
        */
        f32                     referenceDistance( void ) const;
        //! Sets the reference distance value.
        void                    setReferenceDistance( f32 value );
        //! Returns maximum distance value.
        /*!
            Used with the Inverse Distance Model to set
            the distance where there will no longer be any
            attenuation of the source.
        */
        f32                     maximumDistance( void ) const;
        //! Sets the maximum distance value.
        void                    setMaximumDistance( f32 value );
        //! Sets the rolloff factor value.
        /*!
            The rolloff rate for the source default is 1.0.
        */
        f32                     rolloffFactor( void ) const;
        //! Sets the rollof factor value.
        void                    setRolloffFactor( f32 value );
        //! Returns a sound priority.
        u32                        priority( void ) const;
        //! Sets a sound priority.
        void                    setPriority( u32 value );
        //! Returns a serialized sound data.
        SoundDataInfo            data( void ) const;
        //! Loads a serialized sound data.
        void                    setData( const SoundDataInfo& value );
        //! Returns a sound buffer with decoded PCM data.
        SoundBufferWPtr            pcm( void ) const;
        //! Sets a sound buffer with decoded PCM data.
        void                    setPcm( SoundBufferPtr value );
        //! Calculates and returns a sound volume with a random modifier applied.
        f32                        volumeForSound( void ) const;
        //! Calculates and returns a sound pitch with a random modifier applied.
        f32                        pitchForSound( void ) const;

    private:

        //! Parent sound fx.
        SoundFxWPtr                m_soundFx;
        //! Sound identifier.
        String                    m_identifier;
        //! Asset associated with this sound.
        String                    m_uri;
        //! The group this sound belongs to.
        SoundGroupWPtr            m_group;
        //! Sound type.
        u32                        m_type;
        //! The sound data container format.
        SoundContainerFormat    m_format;
        //! The flag indicating the loading behaviour for this sound.
        LoadingFlags            m_loading;
        //! Sound fade in/ fade out time in milliseconds.
        f32                        m_fadeTime;
        //! Sound volume.
        f32                        m_volume;
        //! Sound volume random multiplicative modifier.
        Range                    m_volumeModifier;
        //! Sound pitch.
        f32                        m_pitch;
        //! Sound pitch random multiplicative modifier.
        Range                    m_pitchModifier;
        //! The flag indicating whether this sound is looped.
        bool                    m_isLooped;
        //! The flag indicating whether this sound is positioned relatively to a listener.
        bool                    m_isRelative;
        //! Reference distance value (used by a distance model).
        f32                     m_referenceDistance;
        //! Maximum distance (used by a distance model).
        f32                     m_maximumDistance;
        //! Rolloff factor (used by a distance model).
        f32                     m_rolloffFactor;
        //! Sound playback priority.
        u32                        m_priority;
        //! Decoded PCM data.
        SoundBufferPtr            m_pcm;
    };

} // namespace Sound

DC_END_DREEMCHEST

#endif        /*    __DC_SoundData_H__    */


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
in Willdenow, Willd. , Sp. pl. , Edn 4 6(2): 31 (1825)

#### Original name
Uredo potentillarum

### Remarks
null


text:
#include "SkTextOnPath.h"
#include "SkAnimateMaker.h"
#include "SkCanvas.h"
#include "SkDrawPath.h"
#include "SkDrawText.h"
#include "SkPaint.h"

#if SK_USE_CONDENSED_INFO == 0

const SkMemberInfo SkTextOnPath::fInfo[] = {
    SK_MEMBER(offset, Float),
    SK_MEMBER(path, Path),
    SK_MEMBER(text, Text)
};

#endif

DEFINE_GET_MEMBER(SkTextOnPath);

SkTextOnPath::SkTextOnPath() : offset(0), path(NULL), text(NULL) {
}

bool SkTextOnPath::draw(SkAnimateMaker& maker) {
    SkASSERT(text);
    SkASSERT(path);
    SkBoundableAuto boundable(this, maker);
    maker.fCanvas->drawTextOnPathHV(text->getText(), text->getSize(),
                                    path->getPath(), offset, 0, *maker.fPaint);
    return false;
}


text:
echo "WE'RE ABOUT TO STOP RIGHT NOW !"
# stop database
kill -INT $(head -1 $PGDATA/postmaster.pid)
echo "Everything is properly stopped, we can exit"
rm -f /tmp/letitrun