text:
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const Path = require('path');
const config = require('./config');

module.exports = {
  entry: {
    bundle: ['./src/index.jsx',],
    vendor: [
      'react',
      'react-dom',
      'react-redux',
      'react-router',
      'react-router-redux',
      'react-bootstrap',
      'react-router-bootstrap',
      'redux',
      'sweetalert',
      'axios'
    ]
  },
  output: {
    path: `${__dirname}/dist`,
    publicPath: '/',
    filename: '[name].[chunkhash].js',
  },
  resolve: {
    root: [
      Path.resolve('.'),
    ],
    extensions: ['', '.js', '.jsx'],
  },
  module: {
//    preLoaders: [
//      { test: /\.(jsx|js)$/, loader: 'eslint-loader', exclude: /node_modules/ },
//    ],
    loaders: [
      {
        test: /\.(jsx|js)$/,
        exclude: /node_modules/,
        loaders: ['babel-loader'],
        include: Path.join(__dirname, 'src/'),
      },
      {
        test: /\.json$/,
        loader: 'json',
      },
      {
        test: /\.sass$/,
//        loader: 'style!css!sass',
        loader: ExtractTextPlugin.extract("style-loader", "css-loader!autoprefixer!sass-loader"),
      },
      {
        test: /\.css$/,
//        loader: 'style!css',
        loader: ExtractTextPlugin.extract("style-loader", "css-loader!autoprefixer"),
      },

      { test: /bootstrap\/js\//, loader: 'imports?jQuery=jquery' },
      {
        test: /\.woff/,
        loader: 'url?limit=10000&mimetype=application/font-woff'
      },
      {
        test: /\.ttf$/,
        loader: 'url?limit=10000&mimetype=application/octet-stream',
      },
      { test: /\.eot$/, loader: 'file', },
      {
        test: /\.svg$/,
        loader: "url?limit=10000&mimetype=image/svg+xml",
      },
      {
        test: /\.(png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot)$/,
        loader: 'file',
        exclude: /node_modules/,
      },

    ],

  },

  plugins: [
    new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.[chunkhash].js'),
    new ExtractTextPlugin("styles.[chunkhash].css"),
    new webpack.optimize.DedupePlugin(),
    new webpack.ProvidePlugin({
      jQuery: 'jquery',
      $: 'jquery',
      jquery: 'jquery',
    }),
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify('production'),
    }),
    new webpack.NoErrorsPlugin(),
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        warnings: false,
        properties: true,
        sequences: true,
        dead_code: true,
        drop_console: true,
        conditionals: true,
        comparisons: true,
        evaluate: true,
        booleans: true,
        unused: true,
        loops: true,
        hoist_funs: true,
        cascade: true,
        if_return: true,
        join_vars: true,
        drop_debugger: true,
        unsafe: true,
        hoist_vars: true,
        negate_iife: true,
      },
      comments: false,
      mangle: true,
      minimize: true,
    }),
    new webpack.optimize.OccurenceOrderPlugin(),
    new webpack.optimize.AggressiveMergingPlugin(),
    new HtmlWebpackPlugin({
      template: 'src/index.ejs',
      inject: true,
    }),
  ],
};


text:
from math import sqrt, log10

class WelfordRunningVariance(object):
    """
    Python implentation of Welford's running variance algorithm
    http://www.johndcook.com/standard_deviation.html
    """
    def __init__(self):
        self._count = 0
        self._mean = None
        self._last_mean = None
        self._max = None
        self._min = None
        self._sum = None

        self._s = None
        self._last_s = None

    def send(self, value):
        self._count += 1

        if self._count == 1:
            self._mean = value
            self._max = value
            self._min = value
            self._sum = value
            self._last_mean = value
            self._last_s = 0.0

        else:
            self._mean = self._last_mean + (value - self._last_mean)/self._count
            self._s = self._last_s + (value - self._last_mean) * (value - self._mean)

            self._sum += value
            # check & update max/min values if necessary
            if value > self._max:
                self._max = value
            if value < self._min:
                self._min = value

            # prepare for next iteration
            self._last_mean = self._mean
            self._last_s = self._s

    def next(self):
        """
        Mimmicing generator function
        """
        return self._mean

    def count(self):
        return self._count

    def mean(self):
        return self._mean

    def max(self):
        return self._max

    def min(self):
        return self._min

    def sum(self):
        return self._sum

    def var(self):
        result = 0
        if self._count >= 2:
            result = self._s/(self._count - 1)
        return result

    def stddev(self):
        return sqrt(self.var())

class WelfordRunningVariancedB(object):
    """
    Python implentation of Welford's running variance algorithm (for dB calc)
    http://www.johndcook.com/standard_deviation.html
    """
    def __init__(self):
        self._count = 0
        self._mean = None
        self._last_mean = None

        self._s = None
        self._last_s = None

    def send(self, v):
        value =  10**(v/10.0)
        self._count += 1

        if self._count == 1:
            self._mean = value
            self._last_mean = value
            self._last_s = 0.0
        else:
            self._mean = self._last_mean + (value - self._last_mean)/self._count
            self._s = self._last_s + (value - self._last_mean) * (value - self._mean)

            # prepare for next iteration
            self._last_mean = self._mean
            self._last_s = self._s

    def mean_db(self, as_db=False):
        result = self._mean
        if as_db:
            result =  10 * log10(result)
        return result

    def count(self):
        return self._count

    def var_db(self, as_db=False):
        result = 0
        if self._count >= 2:
            result = self._s/(self._count - 1)

        if as_db:
            result =  10 * log10(result)

        return result

    def next(self):
        """
        Mimmicing generator function
        """
        return self._mean

    def stddev_db(self):
        lin_stdev = sqrt(self.var_db())
        db_stdev =   10 * log10(lin_stdev)
        return db_stdev #WARNING -- this value doesn't seem to make sense

redpajama_set_name: RedPajamaGithub


text:
+ function( $ ) { "use strict";

  var Layout = function (SidebarWidth) {
    this.jcaSideBarWidth = SidebarWidth;
    return this;
  };

  Layout.prototype.init = function () {
    console.log( 'Layout.js is running ');
    this.carousel();
    this.fullPage();

    return this;
  };

  Layout.prototype.carousel = function() {
    $('.carousel').carousel({
      interval: 3000,
      pause: "hover",
      wrap: true
    });
  };

  Layout.prototype.fullPage = function() {

      $('#fullpage').fullpage({
        verticalCentered: true,
        resize : false,
        sectionsColor : ['#ccc', '#fff', '#E6E6E6'],
        anchors:['', 'databasePage', 'paragalaPage'],
        scrollingSpeed: 700,
        easing: 'easeInQuart',
        menu: true,
        navigation: false,
        navigationPosition: 'right',
        navigationTooltips: ['', 'databasePage', 'paragalaPage'],
        slidesNavigation: true,
        slidesNavPosition: 'bottom',
        loopBottom: false,
        loopTop: false,
        loopHorizontal: true,
        autoScrolling: true,
        scrollOverflow: false,
        css3: false,
        paddingTop: '40px',
        paddingBottom: '0px',
        normalScrollElements: '#element1, .element2',
        normalScrollElementTouchThreshold: 5,
        keyboardScrolling: true,
        touchSensitivity: 15,
        continuousVertical: false,
        animateAnchor: true,
        sectionSelector: '.section',
        slideSelector: '.slide',

        //events
        onLeave: function(index, nextIndex, direction){},
        afterLoad: function(anchorLink, index){},
        afterRender: function(){},
        afterResize: function(){},
        afterSlideLoad: function(anchorLink, index, slideAnchor, slideIndex){},
        onSlideLeave: function(anchorLink, index, slideIndex, direction){}
      });

      $('.selectSection').on('click', function() {
        console.log( 'select Section' );
        $.fn.fullpage.moveSectionDown();
      });

  };
  window.jcaLayout = new Layout();

}( jQuery );


text:
/**
 * @module sample_app/app/views/main_view
 */

require('ember/view');
require('../core');
require('../templates/main_template');

SampleApp.MainView = Ember.View.extend({
  template: 'main_template'
});


text:
from handler.base_plugin import BasePlugin
from utils import traverse

class ForwardedCheckerPlugin(BasePlugin):
    __slots__ = ("allow_self", )

    def __init__(self, allow_self=False):
        """Checks messages' forwarded messages for commands."""
        super().__init__()

        self.allow_self = allow_self

    async def check_message(self, msg):
        if not self.allow_self:
            c = self.api.target_client

            if c.group:
                nid = self.api.vk_groups[c.target].group_id
            else:
                nid = self.api.vk_users[c.target].user_id

            if msg.user_id == nid:
                return False

        return not msg.is_out

    async def process_message(self, msg):
        try:
            await self.bot.handler.process(next(traverse(
                await msg.get_full_forwarded())))
        except StopIteration:
            pass


text:
Work Time Monitor
=================

Simple web page, which can be used to monitor working hours and wages. Based on google calendar.
![Screenshot](https://raw.github.com/jupe/work_time_monitor/master/screenshot/page.png "Example")

# Features
* Read your Google Calendar events (*)
* User Selectable time period
* Support multiple calendars
* Calculate summary of given period
** Durations [day, night, weekend, total] in hours
** Distances
* Calculate wages
* calculate taxes
* Download as CSV/TXT (not fully implemented)
* table view, which can be grouped by year/month/week or day

(*)
It woulf be best if you create separate calendar for tracking purpose, where all events are supposed to be like "working events". There is also several mobile applications, which can collect usage events to the remote google calendar.....

# Installation:

1. copy files to web server
2. create your own config.json (example in config.example.json)
3. [generate Google APIv3 ClientID](https://console.developers.google.com/apis/credentials?)
4. Open web page

# License
See LICENSE file


text:
<?php

namespace AppBundle\DataFixtures\ORM;

use AppBundle\Entity\Comment;
use AppBundle\Entity\Post;
use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerInterface;

class LoadPostData
{
    public static function load(ObjectManager $manager, ContainerInterface $container)
    {
        foreach (range(1, 30) as $i) {
            $post = new Post();

            $title = (1 === $i) ? 'Morbi tempus commodo mattis' : self::getRandomPostTitle();

            $post->setTitle($title);
            $post->setSummary(self::getRandomPostSummary());
            $post->setSlug($container->get('slugger')->slugify($post->getTitle()));
            $post->setContent(self::getPostContent());
            $post->setAuthorEmail('anna_admin@symfony.com');
            $post->setPublishedAt(new \DateTime('now - '.$i.'days'));

            foreach (range(1, 5) as $j) {
                $comment = new Comment();

                $comment->setAuthorEmail('john_user@symfony.com');
                $comment->setPublishedAt(new \DateTime('now + '.($i + $j).'seconds'));
                $comment->setContent(self::getRandomCommentContent());
                $comment->setPost($post);

                $manager->persist($comment);
                $post->addComment($comment);
            }

            $manager->persist($post);
        }

        $manager->flush();
    }

    private static function getPostContent()
    {
        return <<<MARKDOWN
Lorem ipsum dolor sit amet consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et **dolore magna aliqua**: Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.

  * Ut enim ad minim veniam
  * Quis nostrud exercitation *ullamco laboris*
  * Nisi ut aliquip ex ea commodo consequat

Praesent id fermentum lorem. Ut est lorem, fringilla at accumsan nec, euismod at
nunc. Aenean mattis sollicitudin mattis. Nullam pulvinar vestibulum bibendum.
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos
himenaeos. Fusce nulla purus, gravida ac interdum ut, blandit eget ex. Duis a
luctus dolor.

Integer auctor massa maximus nulla scelerisque accumsan. *Aliquam ac malesuada*
ex. Pellentesque tortor magna, vulputate eu vulputate ut, venenatis ac lectus.
Praesent ut lacinia sem. Mauris a lectus eget felis mollis feugiat. Quisque
efficitur, mi ut semper pulvinar, urna urna blandit massa, eget tincidunt augue
nulla vitae est.

Ut posuere aliquet tincidunt. Aliquam erat volutpat. **Class aptent taciti**
sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Morbi
arcu orci, gravida eget aliquam eu, suscipit et ante. Morbi vulputate metus vel
ipsum finibus, ut dapibus massa feugiat. Vestibulum vel lobortis libero. Sed
tincidunt tellus et viverra scelerisque. Pellentesque tincidunt cursus felis.
Sed in egestas erat.

Aliquam pulvinar interdum massa, vel ullamcorper ante consectetur eu. Vestibulum
lacinia ac enim vel placerat. Integer pulvinar magna nec dui malesuada, nec
congue nisl dictum. Donec mollis nisl tortor, at congue erat consequat a. Nam
tempus elit porta, blandit elit vel, viverra lorem. Sed sit amet tellus
tincidunt, faucibus nisl in, aliquet libero.
MARKDOWN;
    }

    private static function getPhrases()
    {
        return array(
            'Lorem ipsum dolor sit amet consectetur adipiscing elit',
            'Pellentesque vitae velit ex',
            'Mauris dapibus risus quis suscipit vulputate',
            'Eros diam egestas libero eu vulputate risus',
            'In hac habitasse platea dictumst',
            'Morbi tempus commodo mattis',
            'Ut suscipit posuere justo at vulputate',
            'Ut eleifend mauris et risus ultrices egestas',
            'Aliquam sodales odio id eleifend tristique',
            'Urna nisl sollicitudin id varius orci quam id turpis',
            'Nulla porta lobortis ligula vel egestas',
            'Curabitur aliquam euismod dolor non ornare',
            'Sed varius a risus eget aliquam',
            'Nunc viverra elit ac laoreet suscipit',
            'Pellentesque et sapien pulvinar consectetur',
        );
    }

    private static function getRandomPostTitle()
    {
        $titles = self::getPhrases();

        return $titles[array_rand($titles)];
    }

    private static function getRandomPostSummary()
    {
        $phrases = self::getPhrases();

        $numPhrases = rand(6, 12);
        shuffle($phrases);

        return implode(' ', array_slice($phrases, 0, $numPhrases-1));
    }

    private static function getRandomCommentContent()
    {
        $phrases = self::getPhrases();

        $numPhrases = rand(2, 15);
        shuffle($phrases);

        return implode(' ', array_slice($phrases, 0, $numPhrases-1));
    }
}


text:
package com.coco.heart.core;

import java.util.concurrent.Callable;

import com.coco.heart.common.Utils;
import com.coco.heart.entry.PingEntry;

/**
 * @author wanglin/netboy
 * @version 创建时间:2016年3月29日 上午10:40:52
 * @param <V>
 * @func
 */
public class OptRegisterTask implements Callable<Object> {
    private PingEntry pingEntry;
    private boolean mkAvalibale = true;

    public OptRegisterTask(PingEntry item, boolean mkAvalibal) {
        this.pingEntry = item;
        this.mkAvalibale = mkAvalibal;
    }

    @Override
    public Object call() throws Exception {
        boolean result = Utils.updateHostStatus(pingEntry.getServiceName(), pingEntry.getGroupName(),
                pingEntry.getHostKey(), mkAvalibale, pingEntry.getZkurl());
        return result;
    }

}


text:
Enables push menu functionality with Bootstrap-compliant markup and CSS.  Only takes effect at mobile resolution.

[Check out the demo here](http://developerdizzle.github.io/bootstrap.push-menu/demo.html)

![demo](http://i.imgur.com/YO4dO6A.gif)

## Installation

You can use Bower to install bootstrap.push-menu:

```console
$ bower install bootstrap.push-menu
```

## Configuration

Add the CSS file:

```html
<link rel="stylesheet" href="/bower_components/bootstrap.push-menu/dist/css/push-menu.css" />
```

and JS file:

```html
<script src="/bower_components/bootstrap.push-menu/dist/js/push-menu.js"></script>
```

Then minimally add the `data-toggle="push"` and `data-target` attributes to your `navbar-toggle` button:

```html
      <nav class="navbar navbar-default">
        <div class="container-fluid">
          <div class="navbar-header">
            <button type="button" class="navbar-toggle visible-xs" data-toggle="push" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
              <span class="sr-only">Toggle navigation</span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">Project name</a>
          </div>
          <div id="navbar">
            <ul class="nav navbar-nav">
              <li class="active"><a href="#">Home</a></li>
              <li><a href="#">About</a></li>
              ...
```

For standard Bootstrap setups, `data-toggle="push"` replaces `data-toggle="collapse"` and `data-target` remains the same.  You will also want to replace the `collapsed` class from the `navbar-toggle` button with `visible-xs`, as well as remove the `navbar-collapse` and `collapse` classes from the target `#navbar`, because we are essentially replacing the collapse functionality with push.

The javascript will automatically add a few classes to your navigation elements.

## Options

These options can be placed on the button that toggles the push:

`data-target` is the selector for the navigation bar.  Defaults to `#navbar`.

`data-canvas` is the selector for the element that will be pushed.  This defaults to `body` and is almost always what you want.

`data-direction` is the direction that the canvas element and menu will slide.  Defaults to `left`.  **Note:** `right` does not work in standard Bootstrap navbar, as the navbar-toggle button will be on the right (and pushing it further right will place it off-screen).


text:
Put following code-snippet for formatting a JSON string to pretty print JSON.

```Objective-C
+ (NSString*) formatJSONPretty:(NSData *)data {
    id obj = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:nil];
    if (obj) {
        NSData* d = [NSJSONSerialization dataWithJSONObject:obj options:NSJSONWritingPrettyPrinted error:nil];
        return [[NSString alloc] initWithData:d encoding:NSUTF8StringEncoding];
    } else {
        return nil;
    }
}
```


text:
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using osu.Game.Rulesets.Mods;

namespace osu.Game.Rulesets.Catch.Mods
{
    public class CatchModHidden : ModHidden
    {
        public override string Description => @"Play with fading fruits.";
        public override double ScoreMultiplier => 1.06;
    }
}


text:
import React from 'react';

class Coach extends React.Component {
  constructor(props) {
    super(props)
  }

  render() {
    return(
      <a href={`https://twitter.com/${this.props.twitter}`}>{`@${this.props.name}`}
    );
  }
}

Coach.propTypes = {
  name: React.PropTypes.string,
  twitter: React.PropTypes.string
}

export default Coach;


text:
'use strict';
var expect = require('assume');
var assumeSinon = require('../');
expect.use(assumeSinon);

var sinon = require('sinon');

describe('Call context', function() {
  var spy;
  var target;
  var notTheTarget;

  beforeEach(function() {
    spy = sinon.spy();
    target = {};
    notTheTarget = {};
  });

  describe('calledOn', function() {
    it('should throw an assertion error if the spy is never called', function() {
      expect(function() {
        expect(spy).to.have.been.calledOn(target);
      }).to.throw('Unknown assertation failure occured');
    });
    it('should throw an assertion error if the spy is called without a context', function() {
      spy();
      expect(function() {
        expect(spy).to.have.been.calledOn(target);
      }).to.throw('Unknown assertation failure occured');
      expect(function() {
        expect(spy.getCall(0)).to.have.been.calledOn(target);
      }).to.throw('Unknown assertation failure occured');
    });
    it('should throw an assertion error if the spy is called on the wrong context', function() {
      spy.call(notTheTarget);
      expect(function() {
        expect(spy).to.have.been.calledOn(target);
      }).to.throw('Unknown assertation failure occured');
      expect(function() {
        expect(spy.getCall(0)).to.have.been.calledOn(target);
      }).to.throw('Unknown assertation failure occured');
    });
    it('should not throw if the spy is called on the specified context', function() {
      spy.call(target);
      expect(function() {
        expect(spy).to.have.been.calledOn(target);
      }).to.not.throw();
      expect(function() {
        expect(spy.getCall(0)).to.have.been.calledOn(target);
      }).to.not.throw();
    });
    it('should not throw if the spy is called on another context and also the specified context', function() {
      spy.call(notTheTarget);
      spy.call(target);
      expect(function() {
        expect(spy).to.have.been.calledOn(target);
      }).to.not.throw();
      expect(function() {
        expect(spy.getCall(1)).to.have.been.calledOn(target);
      }).to.not.throw();
    });
  });

  describe('always calledOn', function() {
    it('should throw an assertion error if the spy is never called', function() {
      expect(function() {
        expect(spy).to.always.have.been.calledOn(target);
      }).to.throw('Unknown assertation failure occured');
      expect(function() {
        expect(spy).to.have.always.been.calledOn(target);
      }).to.throw('Unknown assertation failure occured');
      expect(function() {
        expect(spy).to.have.been.always.calledOn(target);
      }).to.throw('Unknown assertation failure occured');
    });
    it('should throw an assertion error if the spy is called without a context', function() {
      spy();
      expect(function() {
        expect(spy).to.always.have.been.calledOn(target);
      }).to.throw('Unknown assertation failure occured');
      expect(function() {
        expect(spy).to.have.always.been.calledOn(target);
      }).to.throw('Unknown assertation failure occured');
      expect(function() {
        expect(spy).to.have.been.always.calledOn(target);
      }).to.throw('Unknown assertation failure occured');
    });
    it('should throw an assertion error if the spy is called on the wrong context', function() {
      spy.call(notTheTarget);
      expect(function() {
        expect(spy).to.always.have.been.calledOn(target);
      }).to.throw('Unknown assertation failure occured');
      expect(function() {
        expect(spy).to.have.always.been.calledOn(target);
      }).to.throw('Unknown assertation failure occured');
      expect(function() {
        expect(spy).to.have.been.always.calledOn(target);
      }).to.throw('Unknown assertation failure occured');
    });
    it('should not throw if the spy is called on the specified context', function() {
      spy.call(target);
      expect(function() {
        expect(spy).to.always.have.been.calledOn(target);
      }).to.not.throw();
      expect(function() {
        expect(spy).to.have.always.been.calledOn(target);
      }).to.not.throw();
      expect(function() {
        expect(spy).to.have.been.always.calledOn(target);
      }).to.not.throw();
    });
    it('should throw an assertion error if the spy is called on another context and also the specified context', function() {
      spy.call(notTheTarget);
      spy.call(target);
      expect(function() {
        expect(spy).to.always.have.been.calledOn(target);
      }).to.throw('Unknown assertation failure occured');
      expect(function() {
        expect(spy).to.have.always.been.calledOn(target);
      }).to.throw('Unknown assertation failure occured');
      expect(function() {
        expect(spy).to.have.been.always.calledOn(target);
      }).to.throw('Unknown assertation failure occured');
    });
  });
});


text:
package org.drools.compiler.xml;

import org.drools.compiler.xml.rules.AccumulateHandler;
import org.drools.compiler.xml.rules.AccumulateHelperHandler;
import org.drools.compiler.xml.rules.AndHandler;
import org.drools.compiler.xml.rules.CollectHandler;
import org.drools.compiler.xml.rules.EvalHandler;
import org.drools.compiler.xml.rules.ExistsHandler;
import org.drools.compiler.xml.rules.ExprConstraintHandler;
import org.drools.compiler.xml.rules.ExpressionHandler;
import org.drools.compiler.xml.rules.FieldBindingHandler;
import org.drools.compiler.xml.rules.FieldConstraintHandler;
import org.drools.compiler.xml.rules.ForallHandler;
import org.drools.compiler.xml.rules.FromHandler;
import org.drools.compiler.xml.rules.FunctionHandler;
import org.drools.compiler.xml.rules.LiteralRestrictionHandler;
import org.drools.compiler.xml.rules.NotHandler;
import org.drools.compiler.xml.rules.OrHandler;
import org.drools.compiler.xml.rules.PackageHandler;
import org.drools.compiler.xml.rules.PatternHandler;
import org.drools.compiler.xml.rules.PredicateHandler;
import org.drools.compiler.xml.rules.QualifiedIdentifierRestrictionHandler;
import org.drools.compiler.xml.rules.QueryHandler;
import org.drools.compiler.xml.rules.RestrictionConnectiveHandler;
import org.drools.compiler.xml.rules.ReturnValueRestrictionHandler;
import org.drools.compiler.xml.rules.RuleHandler;
import org.drools.compiler.xml.rules.VariableRestrictionsHandler;
import org.drools.xml.DefaultSemanticModule;
import org.drools.xml.SemanticModule;

public class RulesSemanticModule extends DefaultSemanticModule
    implements
    SemanticModule {
    public RulesSemanticModule(String url) {
        super( url );

        addHandler( "package",
                    new PackageHandler() );
        addHandler( "rule",
                    new RuleHandler() );
        addHandler( "query",
                    new QueryHandler() );
        addHandler( "attribute",
                    null );
        addHandler( "function",
                    new FunctionHandler() );

        // Conditional Elements
        addHandler( "lhs",
                    new AndHandler() );

        addHandler( "and-restriction-connective",
                    new RestrictionConnectiveHandler() );

        addHandler( "or-restriction-connective",
                    new RestrictionConnectiveHandler() );

        addHandler( "and-constraint-connective",
                    new RestrictionConnectiveHandler() );
        addHandler( "or-constraint-connective",
                    new RestrictionConnectiveHandler() );

        addHandler( "and-conditional-element",
                    new AndHandler() );

        addHandler( "or-conditional-element",
                    new OrHandler() );

        addHandler( "not",
                    new NotHandler() );
        addHandler( "exists",
                    new ExistsHandler() );
        addHandler( "eval",
                    new EvalHandler() );
        addHandler( "pattern",
                    new PatternHandler() );

        addHandler( "from",
                    new FromHandler() );
        addHandler( "forall",
                    new ForallHandler() );
        addHandler( "collect",
                    new CollectHandler() );
        addHandler( "accumulate",
                    new AccumulateHandler() );

        // Field Constraints
        addHandler( "expr",
                    new ExprConstraintHandler() );
        addHandler( "field-constraint",
                    new FieldConstraintHandler() );
        addHandler( "literal-restriction",
                    new LiteralRestrictionHandler() );
        addHandler( "variable-restriction",
                    new VariableRestrictionsHandler() );
        addHandler( "predicate",
                    new PredicateHandler() );

        addHandler( "return-value-restriction",
                    new ReturnValueRestrictionHandler() );
        addHandler( "qualified-identifier-restriction",
                    new QualifiedIdentifierRestrictionHandler() );

        addHandler( "field-binding",
                    new FieldBindingHandler() );

        addHandler( "field-binding",
                    new FieldBindingHandler() );

        addHandler( "init",
                    new AccumulateHelperHandler() );
        addHandler( "action",
                    new AccumulateHelperHandler() );
        addHandler( "result",
                    new AccumulateHelperHandler() );
        addHandler( "reverse",
                    new AccumulateHelperHandler() );

        addHandler( "external-function",
                    new AccumulateHelperHandler() );

        addHandler( "expression",
                    new ExpressionHandler() );
    }
}


text:
package ProjectBackendTestProjectStructureInvalidNoPOM.src.main.java;

public class Bean {

    private final int value;

    public Bean(int value) {
        this.value = value;
    }

    public int getValue() {
        return value * 7;
    }
}


text:
Warriors

<router-outlet></router-outlet>


text:
import java.util.Arrays;

public class MSort{
	int[] target;
	int[] auxillary;

	public static void main(String[] args){
		runTests();
		return;
	}

	public static void runTests(){
		int[] test = {3, 1, 9, 4, 2, 2, 5};
		int[] expected = {1, 2, 2, 3, 4, 5, 9};
		if(Arrays.equals(MSort.sort(test), expected)!=true)
			System.out.println("Failed to sort array.");
		System.out.println("Done Testing MSort.");
		return;
	}

	public MSort(int[] arg){
		this.target = arg;
		this.auxillary = new int[this.target.length];
	}

	public static int[] sort(int[] arg){
		MSort sorter = new MSort(arg);
		sorter.mergeSort(0, arg.length-1);
		return sorter.target;
	}

	public void mergeSort(int bottom, int top){
		if((bottom>=top)||(this.target.length<2)) return;
		int mid = ((top-bottom)/2)+bottom;
		mergeSort(bottom, mid);
		mergeSort(mid+1, top);
		merge(bottom, mid, top);
		return;
	}

	public void merge(int bottom, int mid, int top){
		int i, j=mid+1, k=bottom;
		/* Copy target to auxillary */
		for(i=bottom; i<=top; i+=1) auxillary[i]=target[i];

		i=bottom;
		while((i<=mid)&&(j<=top)){
			if(this.auxillary[i]<this.auxillary[j]){
				this.target[k]=this.auxillary[i];
				i+=1;
			}
			else {
				this.target[k]=this.auxillary[j];
				j+=1;
			}
			k+=1;
		}

		/* Copy the Rest of i Over */
		for(;i<=mid; i+=1){ this.target[k]=this.auxillary[i]; k+=1; }
		return;
	}
}


text:
package org.apache.samza.storage.kv;

import java.nio.file.Path;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.apache.samza.annotation.InterfaceStability;
import org.apache.samza.checkpoint.CheckpointId;

/**
 * A key-value store that supports put, get, delete, and range queries.
 *
 * @param <K> the type of keys maintained by this key-value store.
 * @param <V> the type of values maintained by this key-value store.
 */
public interface KeyValueStore<K, V> {
  /**
   * Gets the value associated with the specified {@code key}.
   *
   * @param key the key with which the associated value is to be fetched.
   * @return if found, the value associated with the specified {@code key}; otherwise, {@code null}.
   * @throws NullPointerException if the specified {@code key} is {@code null}.
   */
  V get(K key);

  /**
   * Gets the values with which the specified {@code keys} are associated.
   *
   * @param keys the keys with which the associated values are to be fetched.
   * @return a map of the keys that were found and their respective values.
   * @throws NullPointerException if the specified {@code keys} list, or any of the keys, is {@code null}.
   */
  default Map<K, V> getAll(List<K> keys) {
    Map<K, V> map = new HashMap<>(keys.size());

    for (K key : keys) {
      V value = get(key);

      if (value != null) {
        map.put(key, value);
      }
    }

    return map;
  }

  /**
   * Updates the mapping of the specified key-value pair; Associates the specified {@code key} with the specified {@code value}.
   *
   * @param key the key with which the specified {@code value} is to be associated.
   * @param value the value with which the specified {@code key} is to be associated.
   * @throws NullPointerException if the specified {@code key} or {@code value} is {@code null}.
   */
  void put(K key, V value);

  /**
   * Updates the mappings of the specified key-value {@code entries}.
   *
   * @param entries the updated mappings to put into this key-value store.
   * @throws NullPointerException if any of the specified {@code entries} has {@code null} as key or value.
   */
  void putAll(List<Entry<K, V>> entries);

  /**
   * Deletes the mapping for the specified {@code key} from this key-value store (if such mapping exists).
   *
   * @param key the key for which the mapping is to be deleted.
   * @throws NullPointerException if the specified {@code key} is {@code null}.
   */
  void delete(K key);

  /**
   * Deletes the mappings for the specified {@code keys} from this key-value store (if such mappings exist).
   *
   * @param keys the keys for which the mappings are to be deleted.
   * @throws NullPointerException if the specified {@code keys} list, or any of the keys, is {@code null}.
   */
  default void deleteAll(List<K> keys) {
    for (K key : keys) {
      delete(key);
    }
  }

  /**
   * Returns an iterator for a sorted range of entries specified by [{@code from}, {@code to}).
   *
   *
API Note: The returned iterator MUST be closed after use. The comparator used for finding entries that belong to the specified
   * range compares the underlying serialized big-endian byte array representation of keys, lexicographically.
   * @see Lexicographical order article at Wikipedia

   * @param from the key specifying the low endpoint (inclusive) of the keys in the returned range.
   * @param to the key specifying the high endpoint (exclusive) of the keys in the returned range.
   * @return an iterator for the specified key range.
   * @throws NullPointerException if null is used for {@code from} or {@code to}.
   */
  KeyValueIterator<K, V> range(K from, K to);

  /**
   * Returns a snapshot of this store for a sorted range of entries specified by [{@code from}, {@code to}).
   * The snapshot is immutable - ie., any mutations to the store are not reflected in the snapshot after it is created.
   *
   *
API Note: The returned snapshot MUST be closed after use.
   * @param from the key specifying the low endpoint (inclusive) of the keys in the returned range.
   * @param to the key specifying the high endpoint (exclusive) of the keys in the returned range.
   * @return a snapshot for the specified key range.
   * @throws NullPointerException if null is used for {@code from} or {@code to}.
   */
  default KeyValueSnapshot<K, V> snapshot(K from, K to) {
    throw new UnsupportedOperationException("snapshot() is not supported in " + this.getClass().getName());
  }

  /**
   * Returns an iterator for all entries in this key-value store.
   *
   *
API Note: The returned iterator MUST be closed after use.

   * @return an iterator for all entries in this key-value store.
   */
  KeyValueIterator<K, V> all();

  /**
   * Closes this key-value store, if applicable, relinquishing any underlying resources.
   */
  void close();

  /**
   * Flushes this key-value store, if applicable.
   */
  void flush();

  /**
   * Create a persistent checkpoint / snapshot of the current store state and return it's path.
   * @return the path of the persistent store checkpoint, or an empty optional if checkpoints are not supported.
   */
  @InterfaceStability.Unstable
  Optional<Path> checkpoint(CheckpointId id);
}


text:
'use strict';

const ffprobe = require('../ffprobe');
const mpck = require('../mpck');

// identify a file
module.exports = async (path) => {
  const meta = await ffprobe(path);

  // additional frame-by-frame checks for mp3 files
  if (meta.audio && meta.audio.format === 'mp3') {
    const check = await mpck(path);
    if (check.MPEG) {
      meta.audio.layer = check.MPEG.layer || null;
      meta.audio.vbr = check.MPEG.vbr || false;
      meta.audio.samples = check.MPEG.samples || null;
      meta.audio.frames = check.MPEG.frames || null;
    }
    if (check.result.formattedError) {
      const err = new Error(`Bad mp3 file: ${check.result.formattedError}`);
      err.noRetry = true;
      throw err;
    }
  }

  return meta;
}


text:
/*****  Vision Kernel Implementation  *****/

/*********************************
 *********************************
 *****  Imported Interfaces  *****
 *********************************
 *********************************/

/********************
 *****  System  *****
 ********************/

#include "Vk.h"

#ifdef __APPLE__
#include <sys/sysctl.h>
#endif

/************************
 *****  Supporting  *****
 ************************/

#include "V_VArgList.h"
#include "VTransient.h"

#if defined(_WIN32)
#pragma comment (lib, "advapi32.lib")
#endif

/*************************
 *************************
 *****  Time Stamps  *****
 *************************
 *************************/

#if defined (_WIN32)

/************************
 *****  Windows/NT  *****
 ************************/

V_API int gettime (struct time *pTime) {
    struct _timeb timedata;

    _ftime (&timedata);
    pTime->seconds	= timedata.time;
    pTime->microseconds	= timedata.millitm * 1000;

    return 0;
}

class CriticalSection : public CRITICAL_SECTION {
//  Construction
public:
    CriticalSection () {
	InitializeCriticalSection (this);
    }

//  Destruction
public:
    ~CriticalSection () {
	DeleteCriticalSection (this);
    }

//  Use
public:
    void Enter () {
	EnterCriticalSection (this);
    }
    void Leave () {
	LeaveCriticalSection (this);
    }
};

static CriticalSection asctimeCS, ctimeCS, gmtimeCS, localtimeCS;

V_API char *asctime_r (struct tm const *pTime, char *pReturn) {	// ASSERT(sizeof (*pReturn) >= 26);
    CriticalSection &rCS = asctimeCS;
    char *pResult = 0;
    __try {
	rCS.Enter ();
	pResult = asctime (pTime);
	if (pResult) {
	    strncpy (pReturn, pResult, 26);
	    pReturn[25] = '\0';
	}
    } __finally {
	rCS.Leave ();
    }
    return pResult ? pReturn : 0;
}

V_API char *ctime_r (time_t const *pTime, char *pReturn) {	// ASSERT(sizeof (*pReturn) >= 26);
    CriticalSection &rCS = ctimeCS;
    char *pResult = 0;
    __try {
	rCS.Enter ();
	pResult = ctime (pTime);
	if (pResult) {
	    strncpy (pReturn, pResult, 26);
	    pReturn[25] = '\0';
	}
    } __finally {
	rCS.Leave ();
    }
    return pResult ? pReturn : 0;
}

V_API struct tm *gmtime_r (time_t const *pTime, struct tm *pReturn) {
    CriticalSection &rCS = gmtimeCS;
    struct tm *pResult = 0;
    __try {
	rCS.Enter ();
	pResult = gmtime (pTime);
	if (pResult)
	    *pReturn = *pResult;
    } __finally {
	rCS.Leave ();
    }
    return pResult ? pReturn : 0;
}

V_API struct tm *localtime_r (time_t const *pTime, struct tm *pReturn) {
    CriticalSection &rCS = localtimeCS;
    struct tm *pResult = 0;
    __try {
	rCS.Enter ();
	pResult = localtime (pTime);
	if (pResult)
	    *pReturn = *pResult;
    } __finally {
	rCS.Leave ();
    }
    return pResult;
}

#elif defined(__VMS)

/*********************
 *****  OpenVMS  *****
 *********************/

PublicFnDef V_API int gettime (struct time *pTime) {
    struct timeval	timeval;

    if (gettimeofday (&timeval, 0) < 0)
        return -1;

    pTime->seconds	= timeval.tv_sec;
    pTime->microseconds	= timeval.tv_usec;

    return 0;
}

#else

/******************
 *****  Unix  *****
 ******************/

PublicFnDef V_API int gettime (struct time *pTime) {
    struct timeval	timeval;
    struct timezone	timezone;

    if (gettimeofday (&timeval, &timezone) < 0)
        return -1;

    pTime->seconds	= timeval.tv_sec;
    pTime->microseconds	= timeval.tv_usec;

    return 0;
}
#endif

/**********************************
 **********************************
 *****  Formatting Utilities  *****
 **********************************
 **********************************/

#if defined(__hp9000s700)

PublicFnDef int STD_sscanf (char const* source, char const* format, ...) {
    V_VARGLIST (ap, format);

    if (source < (char *)0x80000000)
	return vsscanf ((char *)source, format, ap);

    char sbuffer[1024];
    if (strlen (source) < sizeof (sbuffer)) {
	strcpy (sbuffer, source);
	return vsscanf (sbuffer, format, ap);
    }

    char *srccpy = strdup (source);
    int const result = vsscanf (srccpy, format, ap);
    free (srccpy);

    return result;
}

#endif

/************************************
 ************************************
 *****  Byte Array Re-Ordering  *****
 ************************************
 ************************************/

PublicFnDef V_API void Vk_ReverseArray (void *pElements, size_t sElement, size_t cElements) {
    switch (sElement) {
    case 0:
    case 1:
	break;
    case 2: {
	    typedef unsigned short element_t;
	    element_t *pElement = reinterpret_cast<element_t*> (pElements);
	    while (cElements-- > 0) {
		element_t iElement = *pElement;
		*pElement++ =
		    ((iElement & static_cast<element_t>(0x00ff)) << 8) +
		    ((iElement & static_cast<element_t>(0xff00)) >> 8);
	    }
	} break;
    case 4: {
	    typedef unsigned int element_t;
	    element_t *pElement = reinterpret_cast<element_t*> (pElements);
	    while (cElements-- > 0) {
		element_t iElement = *pElement;
	    //  First, swap adjacent bytes, ...
		iElement =
		    ((iElement & static_cast<element_t>(0x00ff00ff)) << 8) +
		    ((iElement & static_cast<element_t>(0xff00ff00)) >> 8) ;
	    //  ... and then adjacent shorts to produce the result:
		*pElement++ =
		    ((iElement & static_cast<element_t>(0x0000ffff)) << 16) +
		    ((iElement & static_cast<element_t>(0xffff0000)) >> 16) ;
	    }
	} break;
    case 8: {
	    typedef unsigned __int64 element_t;
	    element_t *pElement = reinterpret_cast<element_t*> (pElements);
	    while (cElements-- > 0) {
		element_t iElement = *pElement;
	    //  First, swap adjacent bytes, ...
		iElement =
		    ((iElement & static_cast<element_t>(0x00ff00ff00ff00ffLL)) << 8) +
		    ((iElement & static_cast<element_t>(0xff00ff00ff00ff00LL)) >> 8) ;
	    //  ... then adjacent shorts, ...
		iElement =
		    ((iElement & static_cast<element_t>(0x0000ffff0000ffffLL)) << 16) +
		    ((iElement & static_cast<element_t>(0xffff0000ffff0000LL)) >> 16) ;
	    //  .. and finally adjacent 'ints' to produce the result:
		*pElement++ =
		    ((iElement & static_cast<element_t>(0x00000000ffffffffLL)) << 32) +
		    ((iElement & static_cast<element_t>(0xffffffff00000000LL)) >> 32) ;
	    }
	} break;
    default: {
	    unsigned char *pElement = reinterpret_cast<unsigned char*>(pElements);
	    while (cElements-- > 0) {
		unsigned char *p1 = pElement;
		unsigned char *p2 = p1 + sElement - 1;
		while (p1 < p2) {
		    unsigned char const tchr  = *p1;
		    *p1++ = *p2;
		    *p2-- = tchr;
		}
		pElement += sElement;
	    }
	} break;
    }
}

/********************************************
 ********************************************
 *****  Balanced Binary Tree Utilities  *****
 ********************************************
 ********************************************/

/***********************
 *****  'bsearch'  *****
 ***********************/

#if 0
/*---------------------------------------------------------------------------
 *****  This routine is preserved from the VAX implementation to supply an
 *****  implementation if we ever need one.
 *---------------------------------------------------------------------------
 */
PublicFnDef void *STD_bsearch (
    void const *key, void const *base, size_t nel, size_t elsize, VkComparator compar
) {
    void			*result;
    int				lb, ub, loc, comparResult;

    for (lb = (-1), ub = nel; ub - lb > 1; )
    {
	loc = (ub + lb) / 2;
	result = (void *)((char *)base + elsize * loc);
	comparResult = (*compar)(result, key);
	if (comparResult == 0) return result;
	if (comparResult < 0)
	    lb = loc;
	else ub = loc;
    }

/*****  Not found...  *****/
    return NilOf (void *);
}
#endif

/*********************
 *****  'qsort'  *****
 *********************/

#if 0
/*---------------------------------------------------------------------------
 *****  This routine is preserved from the VAX implementation to supply an
 *****  implementation if we ever need one.
 *---------------------------------------------------------------------------
 */
PublicFnDef void STD_qsort (void *base, size_t nel, size_t elsize, VkComparator compar) {
    int sp, left, right, L, R, pivotIndex, stack[100];
    void *pivot, *temp;

    if (nel <= 1 || 0 == elsize) return;

    temp  = VTransient::allocate (elsize);
    pivot = VTransient::allocate (elsize);
    left = 0;  right = nel - 1;  sp = 0;
    stack[sp++] = left;  stack[sp++] = right;     /* push initial r/l pair */
    do
    {
	right = stack[--sp];  left = stack[--sp];	/*  pop r/l pair  */
	do
	{
	    L = left; R = right; pivotIndex = (L + R) / 2;
	    memcpy (pivot, (char *)base + pivotIndex * elsize, elsize);
	    do
	    {
		while ((*compar) ((char *)base + L * elsize,  pivot) < 0) L++;
		while ((*compar) ((char *)base + R * elsize,  pivot) > 0) R--;
		if (L <= R)
		{
		    memcpy (temp			, (char const*)base + L * elsize, elsize);
		    memcpy ((char *)base + L * elsize	, (char const*)base + R * elsize, elsize);
		    memcpy ((char *)base + R * elsize	, temp				 , elsize);
		    L++; R--;
		}
	    } while (L <= R);

	    if (L < right)
	    {
		stack[sp++] = L;
		stack[sp++] = right;
	    }
	    right = R;
	} while (left < right);		/* split a[1] .. a[r] */

    } while (sp > 0);	/* ...until s = 0 */
    VTransient::deallocate (temp);
    VTransient::deallocate (pivot);
}
#endif

/*****************************
 *****  'tsearch', etc.  *****
 *****************************/

#if defined(__VMS) || defined(_WIN32)
#define USING_OWN_TREE_ROUTINES
#endif

/*--------------------------------------------------------------------------
 *  AVLSEARCH helper routine implements AVL tree algorithm given in
 *  Wirth, "A + D = P", pgs 220 - 1
 *
 *  Arguments:
 *	key	     -- pointer to datum to find,
 *	rootp	     -- address of pointer to root node of tree to be searched,
 *	compar	     -- address of function to use in search.
 *	heightChange -- address of variable flags the need to check (& possibly
 *			restore) tree balance.
 *	foundNodePtr -- address of variable to be set to the address of the
 *			found or inserted node.
 *
 *  RETURNS:  error (-1) if unable to alloc mem'y for node; 0 otherwise.
 *  SIDE EFFECTS:  "foundNodePtr" is set to a pointer to the found or inserted
 *		   node; "heightChange" will be set to reflect the balance
 *		   status of the tree in question.
 *****/
PrivateFnDef int search (
    void const *key, treenode **rootp, VkComparator compar, bool *heightChange, treenode **foundNodePtr
) {
    int				comparisonResult;
    treenode			*p1, *p2;

/*****  key not in tree;  insert it  *****/
    if (IsNil (*rootp)) {
	if (IsNil (*rootp = (treenode*)VTransient::allocate (sizeof (treenode))))
	    return -1;

	(*rootp)->data  = key;
	(*rootp)->bal   = 0;
	(*rootp)->left  = (*rootp)->right = NULL;
	*heightChange   = true;
	*foundNodePtr   = *rootp;
	return 0;
    }

    /*****  search left subtree?  *****/
    comparisonResult = (*compar)(key, (*rootp)->data);
    if (comparisonResult < 0) {
	if (search (key, &(*rootp)->left, compar, heightChange, foundNodePtr) < 0)
	    return -1;  			/* error in malloc? */

	if (*heightChange) {
	/*****  balanceLeft (*rootp, heightChange);  *****/
	    switch ((*rootp)->bal) {
	      case  1:
	        (*rootp)->bal =  0; *heightChange = false;
	        break;
	      case  0:
		(*rootp)->bal = -1;
		break;
	      case -1:
		p1 = (*rootp)->left;
		if (p1->bal == -1) {		/* single LL rotation */
		    (*rootp)->left = p1->right;  p1->right = (*rootp);
		    (*rootp)->bal  = 0;	    (*rootp) = p1;
		}
		else {				/* double LR rotation */
		    p2 = p1->right;
		    p1->right = p2->left;  p2->left = p1;
		    (*rootp)->left = p2->right; p2->right = (*rootp);
		    (*rootp)->bal = (treenode::bal_t)(p2->bal == -1 ? 1 : 0);
		    p1->bal  = (treenode::bal_t)(p2->bal ==  1 ?  -1 : 0);
		    (*rootp) = p2;
		}
		(*rootp)->bal = 0;  *heightChange = false;
		break;
	    }
	}
	return 0;
    }

/***** search right subtree? *****/

    if (comparisonResult > 0) {
	if (search (key, &(*rootp)->right, compar, heightChange, foundNodePtr) < 0)
	    return -1;  			/* error in malloc? */

	if (*heightChange) {
	/*****	    balanceRight (*rootp, heightChange);  *****/
	    switch ((*rootp)->bal) {
	      case -1:
	        (*rootp)->bal =  0;  *heightChange = false;
	        break;
	      case  0:
		(*rootp)->bal =  1;
		break;
	      case  1:
		p1 = (*rootp)->right;
		if (p1->bal ==  1) {		/* single RR rotation */
		    (*rootp)->right = p1->left;  p1->left = (*rootp);
		    (*rootp)->bal  = 0;	    (*rootp) = p1;
		}
		else {				/* double RL rotation */
		    p2 = p1->left;
		    p1->left = p2->right;  p2->right = p1;
		    (*rootp)->right = p2->left; p2->left = (*rootp);
		    (*rootp)->bal = (treenode::bal_t)(p2->bal ==  1 ? -1 : 0);
		    p1->bal  = (treenode::bal_t)(p2->bal == -1 ?  1 : 0);
		    (*rootp) = p2;
		}
		(*rootp)->bal = 0;  *heightChange = false;
		break;
	    }
	}
	return 0;
    }

/*****  key found!  *****/
    *heightChange = false;
    *foundNodePtr = *rootp;
    return 0;
}

#if defined(USING_OWN_TREE_ROUTINES)

/*--------------------------------------------------------------------------
 *  Recursive helper routine for TWALK emulation
 *
 *  Arguments:
 *	root 	-- pointer to root node of tree...
 *	action  -- pointer to function to apply to each node
 *	level	-- level in the tree of node being processed;  level of the
 *		   root of the tree passed to "twalk" is 0.
 *
 *  Returns:  NOTHING
 *****/
PrivateFnDef void visitNode (
    treenode *root, void (*action)(treenode *, STD_VISIT, int), int level
) {
    level++;

    if (IsNil (root))
	return;

    if (IsNil (root->left) && IsNil(root->right)) {
	(*action) (root, STD_leaf, level);
	return;
    }

    (*action) (root, STD_preorder, level);

    visitNode (root->left, action, level);

    (*action) (root, STD_postorder, level);

    visitNode (root->right, action, level);

    (*action) (root, STD_endorder, level);
}
#endif

/*--------------------------------------------------------------------------
*  		UNIX TSEARCH emulation using an AVL tree.
*  	     Algorithm from Wirth, "A + D = P", pgs. 220 - 1.
*
*  Arguments:
*	key	-- pointer to datum to find,
*	rootp	-- address of pointer to root node of tree to be searched,
*	compar	-- function to use in search.
*
*  Returns:  address of tree node containing the datum, whether found or
*	     inserted;  returns NULL if unable to allocate space for new node
*****/
PublicFnDef V_API treenode *STD_tsearch (void const *key, void **rootp, VkComparator compar) {
    bool heightChange = false;
    treenode *foundNodep;

    if (search (key, (treenode**)rootp, compar, &heightChange, &foundNodep) < 0)
	return NilOf (treenode *);

    return foundNodep;
}

/*--------------------------------------------------------------------------
 *  UNIX TFIND emulation
 *
 *  Arguments:
 *	key	-- pointer to datum to find,
 *	rootp	-- handle to root node of tree to search,
 *	compar	-- function to use in search.  This is actually accessed
 *		   globally by "comparCover" within LIB$LOOKUP_TREE;  it is
 *		   given here to satisfy the UNIX interface being emulated.
 *
 *  Returns:
 *	A pointer to the located tree node or NULL if a matching node was
 *	NOT found.  Empirically, this is the correct value to return even
 *	though the UNIX documentation suggests that a pointer to the 'datum'
 *	is returned.
 *****/
PublicFnDef V_API treenode *STD_tfind (void const *key, void **rootp, VkComparator compar) {
#if defined(USING_OWN_TREE_ROUTINES)
    if (IsNil (rootp))
	return NilOf (treenode *);

    treenode const *node = (treenode const*)*rootp;
    while (IsntNil (node)) {
	int comparisonResult = (*compar)(key, node->data);
	if (0 == comparisonResult)
	    return (treenode *)node;
	if (comparisonResult < 0)
	    node = node->left;
	else if (comparisonResult > 0)
	    node = node->right;
    }
    return NilOf (treenode *);
#else
    return (treenode *)tfind (key, rootp, compar);
#endif
}

/*--------------------------------------------------------------------------
*  UNIX TWALK emulation
*
*  Arguments:
*	root 	-- pointer to root node of tree...
*	action  -- pointer to function to apply to each node
*
*  Returns:  NOTHING
*****/
PublicFnDef V_API void STD_twalk (
    void const *rootp, void (*action)(treenode *, STD_VISIT, int)
)
{
#if defined (USING_OWN_TREE_ROUTINES)
    visitNode ((treenode*)rootp, action, -1);
#else
    twalk ((void *)rootp, (void (*)(void const *, VISIT, int))action);
#endif
}

/******************************
 ******************************
 *****  Directory Access  *****
 ******************************
 ******************************/

#if defined(_WIN32)

/************************
 *****  Windows/NT  *****
 ************************/

#define MaxConcurrentEnumerations	10

PrivateVarDef unsigned short MinUnusedEnumerator = 0;

PrivateVarDef struct DIR {
    HANDLE			searchHandle;
    int				searchDataValid;
    int				searchCompleted;
    WIN32_FIND_DATA		searchData;
} DirectoryEnumerator[MaxConcurrentEnumerations];

PublicFnDef V_API DIR *opendir (char const* directoryName) {
    unsigned short		enumeratorIndex;
    DIR				*enumerator;
    char			searchPattern[MAX_PATH];

    for (enumeratorIndex = 0; enumeratorIndex < MinUnusedEnumerator; enumeratorIndex++)
	if (INVALID_HANDLE_VALUE == DirectoryEnumerator[enumeratorIndex].searchHandle)
	    break;

    if (enumeratorIndex > MaxConcurrentEnumerations)
	return NilOf (DIR *);
    enumerator = &DirectoryEnumerator[enumeratorIndex];

    strcpy (searchPattern, directoryName);
    strcat (searchPattern, "\\*");
    enumerator->searchHandle = FindFirstFile (searchPattern, &enumerator->searchData);
    if (INVALID_HANDLE_VALUE == enumerator->searchHandle)
	return NilOf (DIR *);

    enumerator->searchDataValid = true;
    enumerator->searchCompleted = false;
    MinUnusedEnumerator = enumeratorIndex + 1;

    return enumerator;
}

PublicFnDef V_API STD_DirectoryEntryType *readdir (DIR *enumerator) {
    if (enumerator <  &DirectoryEnumerator[0]			||
	enumerator >= &DirectoryEnumerator[MinUnusedEnumerator]	||
	INVALID_HANDLE_VALUE == enumerator->searchHandle	||
	enumerator->searchCompleted
    ) return NilOf (STD_DirectoryEntryType *);

    if (!enumerator->searchDataValid) enumerator->searchDataValid = FindNextFile (
	enumerator->searchHandle, &enumerator->searchData
    );

    enumerator->searchCompleted = !enumerator->searchDataValid;
    enumerator->searchDataValid = false;
    return enumerator->searchCompleted
	? NilOf (STD_DirectoryEntryType *)
	: (STD_DirectoryEntryType *)(enumerator->searchData.cFileName);
}

PublicFnDef V_API void closedir (DIR *enumerator) {
    if (enumerator <  &DirectoryEnumerator[0]			||
	enumerator >= &DirectoryEnumerator[MinUnusedEnumerator]	||
	INVALID_HANDLE_VALUE == enumerator->searchHandle
    ) return;
    FindClose (enumerator->searchHandle);
    enumerator->searchHandle = INVALID_HANDLE_VALUE;
}
#endif

/*****************************
 *****************************
 *****  Signal Handling  *****
 *****************************
 *****************************/

/************************
 *****  Windows/NT  *****
 ************************/

#if defined(_WIN32)

PrivateVarDef BOOL SignalVectorInvalid = true;

PrivateVarDef struct sigvec SignalVector[NSIG];

PublicFnDef V_API STD_maskType STD_sigblock (STD_maskType bitmap) {
    return bitmap;
}

PublicFnDef V_API STD_maskType STD_sigsetmask (STD_maskType bitmap) {
    return bitmap;
}

PublicFnDef V_API int STD_sigvector (int sig, struct sigvec *ivec, struct sigvec *ovec) {
    if (SignalVectorInvalid) {
    	int i;
	for (i = 0; i < NSIG; i++) {
	    SignalVector[i].sv_handler	= (STD_SignalHandlerType)SIG_DFL;
	    SignalVector[i].sv_mask	=
	    SignalVector[i].sv_flags	=
	    SignalVector[i].sv_onstack	= 0;
	}
	SignalVectorInvalid = false;
    }

    if (sig < 0 || sig >= NSIG) {
	errno = EINVAL;
	return 0; // if this function actually did anything, would return -1
    }

    if (IsntNil (ovec))
	*ovec = SignalVector[sig];

    if (IsntNil (ivec)) {
	SignalVector[sig] = *ivec;
//	signal (sig, (void (__cdecl *)(int))(sig, ivec->sv_handler));
    }

    return 0;
}
#endif

/*******************************
 *****  The 'nix and 'nux  *****
 *******************************/

#if defined(_AIX) || defined(sun) || defined(__linux__) || defined(__APPLE__)
PrivateFnDef void FillSetFromBitMap (sigset_t *set, STD_maskType bitmap) {
    sigemptyset (set);
    for (int i = 1; i < 32; i++)
	if (bitmap & (1 << i - 1))
	    sigaddset (set, i);
}

PrivateFnDef void FillBitMapFromSet (sigset_t *set, STD_maskType *bitmap) {
    *bitmap = 0;
    for (int i = 1; i < 32; i++)
	if (sigismember (set, i))
	    *bitmap |= 1 << i - 1;
}

PublicFnDef STD_maskType STD_sigblock (STD_maskType bitmap) {
    sigset_t iset, oset;

    FillSetFromBitMap (&iset, bitmap);

    if (sigprocmask (SIG_BLOCK, &iset, &oset) < 0)
	return 0;

    FillBitMapFromSet (&oset, &bitmap);

    return bitmap;
}

PublicFnDef STD_maskType STD_sigsetmask (STD_maskType bitmap) {
    sigset_t			iset, oset;

    FillSetFromBitMap (&iset, bitmap);

    if (sigprocmask (SIG_SETMASK, &iset, &oset) < 0)
	return 0;

    FillBitMapFromSet (&oset, &bitmap);

    return bitmap;
}

PublicFnDef int STD_sigvector (int sig, struct sigvec *ivec, struct sigvec *ovec) {
    struct sigaction iact, oact, *iactp;

    if (IsntNil (ivec)) {
	iact.sa_handler	= (void(*)(int))ivec->sv_handler;
#if defined(_AIX) || defined(sun) || defined(__linux__) || defined(__APPLE__)
	iact.sa_flags	= SA_RESTART | SA_NOCLDSTOP;
#else
	iact.sa_flags	= SA_NOCLDSTOP;
#endif

	FillSetFromBitMap (&iact.sa_mask, ivec->sv_mask);

	iactp = &iact;
    }
    else iactp = NilOf (struct sigaction *);

    if (sigaction (sig, iactp, &oact) < 0)
	return -1;

    if (IsntNil (ovec)) {
	ovec->sv_handler	= (STD_SignalHandlerType)oact.sa_handler;
	FillBitMapFromSet (&oact.sa_mask, &ovec->sv_mask);
    }

    return 0;
}
#endif

/*************************
 *************************
 *****  'gethostid'  *****
 *************************
 *************************/

PublicFnDef V_API long Vk_gethostid () {
#if defined(_WIN32)
    DWORD iVolumeSerialNumber;
    return GetVolumeInformation (
	"c:/", 0, 0, &iVolumeSerialNumber, 0, 0, 0, 0
    ) ? iVolumeSerialNumber : UINT_MAX;

#elif defined(__hp9000s800) || defined (__hp9000s700)
    struct utsname name;
    long hostid = -1;

    uname (&name);
    sscanf (name.idnumber, "%lu", &hostid);
    return hostid;

#elif defined (sun)
    char serialNumber[16];
    sysinfo (SI_HW_SERIAL, serialNumber, sizeof(serialNumber));
    return atoi (serialNumber);

#elif defined(__APPLE__)
    /*****************
     *
     *  'gethostid/hostid' is deprecated in BSD and its derivatives.  Unless someone has
     *  taken the time to set it explicitly (unlikely), the value returned on MacOS will
     *  be 0.  If that's the case, return a wired non-zero value to keep scripts that
     *  interpret 0 as meaning this is VMS (totally bogus, ARRRRRRGH).
     *
     ****************/
    int32_t iHostID = 0;
    size_t  sHostID = sizeof (iHostID);
    return sysctlbyname ("kern.hostid", &iHostID, &sHostID, NULL, 0) == 0 && iHostID ? iHostID : 987654321;

#else
    return 0;
#endif
}

/**********************
 **********************
 *****  'finite'  *****
 **********************
 **********************/

#if defined(__hp9000s800) || defined(__hp9000s700)
PublicFnDef int Vk_finite (double x) {
#undef finite
    return (-HUGE_VAL != x && finite (x));
}
#endif

/*******************
 *******************
 *****  Other  *****
 *******************
 *******************/

#if defined(_WIN32)
PublicFnDef V_API char const *Vk_username (char *pBuffer, size_t sBuffer) {
    DWORD dwsBuffer = sBuffer;
    return GetUserName (pBuffer, &dwsBuffer) ? pBuffer : "UNKNOWN";
}

PublicFnDef V_API int Vk_alarm (size_t sInterval) {
    return 0;
}

PublicFnDef V_API void Vk_remove (char const *pFileName) {
    SetFileAttributes (pFileName, FILE_ATTRIBUTE_NORMAL);
    DeleteFile (pFileName);
}

class EventHandle {
public:
    EventHandle () : m_hEvent (CreateEvent (NULL, true, false, NULL)) {
    }
    ~EventHandle () {
	CloseHandle (m_hEvent);
    }
    bool isValid () const {
	return SystemHandleIsValid (m_hEvent);
    }
    bool isInvalid () const {
	return SystemHandleIsInvalid (m_hEvent);
    }
    operator HANDLE () const {
	return m_hEvent;
    }
private:
    HANDLE m_hEvent;
};

PublicFnDef V_API size_t Vk_sleep (size_t sInterval) {
    static EventHandle iEventHandle;

    return iEventHandle.isInvalid () || WAIT_TIMEOUT != WaitForSingleObject (
	iEventHandle, sInterval * 1000
    ) ? sInterval : 0;
}
#else
#include <pwd.h>

PublicFnDef V_API char const *Vk_username (char *pBuffer, size_t sBuffer) {
#ifdef __VMS
    typedef struct __passwd64 passwd_t;
#else
    typedef struct passwd passwd_t;
#endif
    passwd_t iPasswd, *pPasswd = 0;
    return getpwuid_r (getuid (), &iPasswd, pBuffer, sBuffer, &pPasswd) == 0 && pPasswd ? pPasswd->pw_name : "UNKNOWN";
}

#endif


text:
#pragma once

#include <medCoreExport.h>

#include <QtCore>
#include <QtSql>

#include <medAbstractData.h>
#include <dtkCore/dtkSmartPointer.h>

#include <medJobItem.h>
#include <medDataIndex.h>

class medAbstractDatabaseImporterPrivate;
class medAbstractData;

/**
* @class medAbstractDatabaseImporter
* @brief Base class for database importers.
* @medAbstractDatabaseImporter is in charge of importing (or indexing, any word will be used
* hereafter) items into medInria databases.
* It is designed to run as a thread, to know how to use it, check the documentation
* of @medJobItem.
* It defines a set of usefuls method (populateMissingMetadata, getSuitableReader,...) and implements a default run() method.
* To implement your own database importer, implement  the pure virtual methods, and override the run() method if neccessary.
* For example, see @medDatabaseImporter and @medDatabaseNonPersistentReader
**/
class MEDCORE_EXPORT medAbstractDatabaseImporter : public medJobItem
{
    Q_OBJECT

public:
    medAbstractDatabaseImporter (const QString& file, const QUuid &uuid, bool indexWithoutImporting = false);
    medAbstractDatabaseImporter ( medAbstractData* medData, const QUuid& uuid);

    ~medAbstractDatabaseImporter ( void );

signals:
    /**
     * This signal is emitted after a successful import/index.
     * @param addedIndex - the @medDataIndex that was successfully added
     */
    void dataImported ( const medDataIndex& index );

    /**
     * This signal is emitted after a successful import/index.
     * @param addedIndex - the @medDataIndex that was successfully added
     * @param callerUuid - the caller Uuid. If the caller Uuid has not been specified,
     * the addedSignal(const medDataIndex& addedIndex) is emitted instead.
     */
    void dataImported ( const medDataIndex& index, const QUuid& uuid );

public slots:
    void onCancel ( QObject* );

protected:
    virtual void internalRun ( void ) ;

    QString file ( void );
    bool isCancelled ( void );
    bool indexWithoutImporting ( void );
    QMap<int, QString> volumeIdToImageFile ( void );
    QString callerUuid ( void );
    medDataIndex index(void) const;

    void populateMissingMetadata ( medAbstractData* medData, const QString seriesDescription );
    void addAdditionalMetaData ( medAbstractData* imData, QString aggregatedFileName, QStringList aggregatedFilesPaths );

    dtkSmartPointer<dtkAbstractDataReader> getSuitableReader ( QStringList filename );
    dtkSmartPointer<dtkAbstractDataWriter> getSuitableWriter ( QString filename, medAbstractData* medData );

    QStringList getAllFilesToBeProcessed ( QString fileOrDirectory );

    medAbstractData *tryReadImages ( const QStringList& filesPath,const bool readOnlyImageInformation );
    bool tryWriteImage ( QString filePath, medAbstractData* medData );

    QString determineFutureImageFileName ( const medAbstractData* medData, int volumeNumber );
    QString determineFutureImageExtensionByDataType ( const medAbstractData* medData );

    QString generateUniqueVolumeId ( const medAbstractData* medData );
    QStringList generateThumbnails ( medAbstractData* medData, QString pathToStoreThumbnails );

    void importData();
    void importFile();

    /**
    * Finds if parameter @seriesName is already being used in the database
    * if is not, it returns @seriesName unchanged
    * otherwise, it returns an unused new series name (created by adding a suffix)
    * @param seriesName - the series name
    * @return newSeriesName - a new, unused, series name
    **/
    virtual QString ensureUniqueSeriesName ( const QString seriesName ) = 0;

    /**
    * Checks if the image which was used to create the medData object
    * passed as parameter already exists in the database
    * @param medData - a @medAbstractData object created from the original image
    * @param imageName - the name of the image we are looking for
    * @return true if already exists, false otherwise
    **/
    virtual bool checkIfExists ( medAbstractData* medData, QString imageName ) = 0;

    /**
     * Retrieves patientID. Checks if patient is already in the database
     * if so, returns his Id, otherwise creates a new guid
     */
    virtual QString getPatientID(QString patientName, QString birthDate) = 0;

    /**
    * Populates database tables and generates thumbnails.
    * @param medData - a @medAbstractData object created from the original image
    * @param pathToStoreThumbnails - path where the thumbnails will be stored
    * @return medDataIndex the new medDataIndex associated with this imported series.
    **/
    virtual medDataIndex populateDatabaseAndGenerateThumbnails ( medAbstractData* medData, QString pathToStoreThumbnails ) = 0;

    medAbstractDatabaseImporterPrivate *d;

};


text:
namespace Beeline.Tests
{
	using System.Collections.Generic;
	using System.Linq;
	using System.Web.Routing;
	using Machine.Specifications;

	public static class RouteExtensions
	{
		public static void ShouldContainConstraint<TConstraint>(this Route route) where TConstraint : IRouteConstraint
		{
			route.Constraints.Values.ShouldContain(c => c.GetType() == typeof(TConstraint));
		}

		public static IEnumerable<TConstraint> ConstraintsOf<TConstraint>(this Route route) where TConstraint : IRouteConstraint
		{
			return route.Constraints.Values.Where(c => c.GetType() == typeof(TConstraint)).Cast<TConstraint>();
		}

		public static TConstraint SingleConstraintOf<TConstraint>(this Route route) where TConstraint : IRouteConstraint
		{
			return route.ConstraintsOf<TConstraint>().Single();
		}
	}
}


text:
import sys
sys.path.insert(1, "../../../")
import h2o
import random

def cv_carsGBM(ip,port):

    # read in the dataset and construct training set (and validation set)
    cars =  h2o.import_frame(path=h2o.locate("smalldata/junit/cars_20mpg.csv"))

    # choose the type model-building exercise (multinomial classification or regression). 0:regression, 1:binomial,
    # 2:multinomial
    problem = random.sample(range(3),1)[0]

    # pick the predictors and response column, along with the correct distribution
    predictors = ["displacement","power","weight","acceleration","year"]
    if problem == 1   :
        response_col = "economy_20mpg"
        distribution = "bernoulli"
        cars[response_col] = cars[response_col].asfactor()
    elif problem == 2 :
        response_col = "cylinders"
        distribution = "multinomial"
        cars[response_col] = cars[response_col].asfactor()
    else              :
        response_col = "economy"
        distribution = "gaussian"

    print "Distribution: {0}".format(distribution)
    print "Response column: {0}".format(response_col)

    ## cross-validation
    ## check that cv metrics are the same over repeated "Modulo" runs
    nfolds = random.randint(3,10)
    gbm1 = h2o.gbm(y=cars[response_col], x=cars[predictors], nfolds=nfolds, distribution=distribution,
                   fold_assignment="Modulo")
    gbm2 = h2o.gbm(y=cars[response_col], x=cars[predictors], nfolds=nfolds, distribution=distribution,
                   fold_assignment="Modulo")
    h2o.check_models(gbm1, gbm2, True)

    ## check that cv metrics are different over repeated "Random" runs
    nfolds = random.randint(3,10)
    gbm1 = h2o.gbm(y=cars[response_col], x=cars[predictors], nfolds=nfolds, distribution=distribution,
                   fold_assignment="Random")
    gbm2 = h2o.gbm(y=cars[response_col], x=cars[predictors], nfolds=nfolds, distribution=distribution,
                   fold_assignment="Random")
    try:
        h2o.check_models(gbm1, gbm2, True)
        assert False, "Expected models to be different over repeated Random runs"
    except AssertionError:
        assert True

    ## boundary cases
    # 1. nfolds = number of observations (leave-one-out cross-validation)
    # TODO: manually construct the cross-validation metrics and compare
    gbm = h2o.gbm(y=cars[response_col], x=cars[predictors], nfolds=cars.nrow(), distribution=distribution,
                  fold_assignment="Modulo")

    # 2. nfolds = 0
    gbm1 = h2o.gbm(y=cars[response_col], x=cars[predictors], nfolds=0, distribution=distribution)
    # check that this is equivalent to no nfolds
    gbm2 = h2o.gbm(y=cars[response_col], x=cars[predictors], distribution=distribution)
    h2o.check_models(gbm1, gbm2)

    # 3. cross-validation and regular validation attempted
    gbm = h2o.gbm(y=cars[response_col], x=cars[predictors], nfolds=random.randint(3,10), validation_y=cars[response_col],
                  validation_x=cars[predictors], distribution=distribution)

    ## error cases
    # 1. nfolds == 1 or < 0
    try:
        gbm = h2o.gbm(y=cars[response_col], x=cars[predictors], nfolds=random.sample([-1,1], 1)[0],
                      distribution=distribution)
        assert False, "Expected model-build to fail when nfolds is 1 or < 0"
    except EnvironmentError:
        assert True

    # 2. more folds than observations
    try:
        gbm = h2o.gbm(y=cars[response_col], x=cars[predictors], nfolds=cars.nrow()+1, distribution=distribution,
                      fold_assignment="Modulo")
        assert False, "Expected model-build to fail when nfolds > nobs"
    except EnvironmentError:
        assert True

if __name__ == "__main__":
    h2o.run_test(sys.argv, cv_carsGBM)


text:
package alidns

//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

// AddrPool is a nested struct in alidns response
type AddrPool struct {
	Name                string `json:"Name" xml:"Name"`
	AddrCount           int    `json:"AddrCount" xml:"AddrCount"`
	MinAvailableAddrNum int    `json:"MinAvailableAddrNum" xml:"MinAvailableAddrNum"`
	UpdateTime          string `json:"UpdateTime" xml:"UpdateTime"`
	MonitorConfigId     string `json:"MonitorConfigId" xml:"MonitorConfigId"`
	CreateTimestamp     int64  `json:"CreateTimestamp" xml:"CreateTimestamp"`
	CreateTime          string `json:"CreateTime" xml:"CreateTime"`
	AddrPoolName        string `json:"AddrPoolName" xml:"AddrPoolName"`
	AddrPoolId          string `json:"AddrPoolId" xml:"AddrPoolId"`
	UpdateTimestamp     int64  `json:"UpdateTimestamp" xml:"UpdateTimestamp"`
	Status              string `json:"Status" xml:"Status"`
	MonitorStatus       string `json:"MonitorStatus" xml:"MonitorStatus"`
	LbaStrategy         string `json:"LbaStrategy" xml:"LbaStrategy"`
	Type                string `json:"Type" xml:"Type"`
}


text:
layout: post
title: Quantum Chaos
---

![Quantum chaos](/public/pics/Cardioid.png)

Recently I had to travel from Bucharest to Lyon (with a connecting flight at Istanbul). Arguably the best thing to do during a flight is to read. So, during my recent flights I read the following interesting article that I am pleased to recommend to you:

* M. Porter. [An Introduction to Quantum Chaos](http://arxiv.org/abs/nlin/0107039), [Arxiv.org](http://arxiv.org/), 2001

The reference is a little bit long, but it includes a lot of interesting historical information. Finally, I can say that after reading it I have an impression to have understood something about Quantum Chaos (QC)! :) In particular, you will learn that QC appears in three different kinds. I also had an impression that this research topic is essentially open. Very little is known about genuine QC.

---


text:
package com.cadiducho.cservidoresmc.api;

import com.cadiducho.cservidoresmc.ApiClient;
import com.cadiducho.cservidoresmc.Updater;

import java.util.logging.Level;

public interface CSPlugin {

    String TAG = "&8[&b40ServidoresMC&8]";

    void log(String text);
    void logError(String text);

    default boolean isDebug() {
        return getCSConfiguration().getBoolean("debug");
    }

    default void debugLog(String s) {
        if (isDebug()){
            log("[Debug] " + s);
        }
    }

    /**
     * Registrar los comandos en la plataforma deseada
     */
    void registerCommands();

    /**
     * Datos de configuración del plugin, con implementación para cada tipo de servidor
     * @return config
     */
    CSConfiguration getCSConfiguration();

    /**
     * Instancia del cliente HTTP para la API
     * @return API client
     */
    ApiClient getApiClient();

    /**
     * Instancia del actualizador
     * @return updater
     */
    Updater getUpdater();

    /**
     * La versión del plugin en String, por ejemplo "3.0"
     * @return versión
     */
    String getPluginVersion();

    /**
     * Ejecutar un comando deseado por la consola del servidor
     * @param command El comando deseado
     */
    void dispatchCommand(String command);

    /**
     * Enviar un mensaje a todos los usuarios
     * @param message el mensaje
     */
    void broadcastMessage(String message);
}


text:
ApplicationKernel.namespace('Vaultier.dal.model');

/**
 * @module vaultier-dal-model
 * @class Vaultier.dal.model.User
 * @extends RL.Model
 */
Vaultier.dal.model.User = RL.Model.extend(
    Vaultier.dal.mixin.CreatedUpdatedMixin,
    Vaultier.dal.mixin.RollbackMixin,
    {
        email: RL.attr('string'),
        nickname: RL.attr('string'),
        public_key: RL.attr('string'),
        invitation_hash: RL.attr('string'),

        saveRecord: function (invitation) {
            var email = this.get('email');
            if (email) {
                this.set('email', email.toLowerCase());
            }
            if (invitation) {
                this.set('invitation_hash', invitation.get('invitation_hash'));
            }
            return this._super.apply(this, arguments);
        }

    });

/**
 * @module model
 * @class Vaultier.dal.model.UserKey
 * @extends RL.Model
 */
Vaultier.dal.model.UserKey = RL.Model.extend({
        public_key: RL.attr('string'),
        membership: RL.attr('object')
    });

Vaultier.dal.model.UserKey.reopenClass({
    resourceDetailFormat: '{rootPath}/users/{id}/key/'
})


text:
package com.emc.documentum.filemanager.dtos.out;

public class CommonResult {
    boolean success;
    String error;
    Object result;

    public CommonResult(boolean success, String error, Object result) {
        this.success = success;
        this.error = error;
        this.result = result;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String isError() {
        return error;
    }

    public void setError(String error) {
        this.error = error;
    }

    public Object getResult() {
        return result;
    }

    public void setResult(Object result) {
        this.result = result;
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 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. -->
<org.chromium.chrome.browser.ui.signin.SigninView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <org.chromium.chrome.browser.ui.signin.SigninScrollView
        android:id="@+id/signin_scroll_view"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:fadingEdgeLength="48dp"
        android:requiresFadingEdge="vertical"
        android:scrollbars="none">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <ImageView
                android:id="@+id/signin_header_image"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:paddingTop="24dp"
                android:paddingBottom="24dp"
                android:background="@color/signin_header_animation_background"
                android:scaleType="center"
                app:srcCompat="@drawable/signin_header_animation"
                tools:ignore="ContentDescription"/>
            <TextView
                android:id="@+id/signin_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@id/signin_header_image"
                android:layout_marginStart="16dp"
                android:layout_marginTop="16dp"
                android:layout_marginEnd="16dp"
                android:textAppearance="@style/TextAppearance.Headline.Primary"
                tools:text="@string/signin_title"/>
            <LinearLayout
                android:id="@+id/signin_account_picker"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/signin_title"
                android:layout_marginStart="16dp"
                android:layout_marginTop="16dp"
                android:layout_marginEnd="16dp"
                android:background="@drawable/account_picker_background"
                android:orientation="horizontal"
                android:gravity="center_vertical"
                android:paddingStart="16dp"
                android:paddingTop="12dp"
                android:paddingEnd="12dp"
                android:paddingBottom="12dp">

                <include layout="@layout/account_row" />
                <!-- For forced sign-in & consent bump this ImageView shows checkmark icon. -->
                <ImageView
                    android:id="@+id/account_picker_end_image"
                    android:layout_width="24dp"
                    android:layout_height="24dp"
                    android:layout_marginStart="16dp"
                    tools:ignore="ContentDescription"
                    tools:src="@drawable/ic_expand_more_black_24dp"
                    tools:tint="@color/default_icon_color_tint_list"/>
            </LinearLayout>
            <TextView
                android:id="@+id/signin_sync_title"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/signin_account_picker"
                android:layout_marginStart="16dp"
                android:layout_marginTop="16dp"
                android:layout_marginEnd="16dp"
                android:textAppearance="@style/TextAppearance.TextLarge.Primary"
                tools:text="@string/signin_sync_title"/>
            <TextView
                android:id="@+id/signin_sync_description"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/signin_sync_title"
                android:layout_marginStart="16dp"
                android:layout_marginEnd="16dp"
                android:textAppearance="@style/TextAppearance.TextMedium.Secondary"
                tools:text="@string/signin_sync_description"/>
            <View
                android:id="@+id/signin_divider"
                style="@style/HorizontalDivider"
                android:layout_below="@id/signin_sync_description"
                android:layout_marginStart="16dp"
                android:layout_marginTop="16dp"
                android:layout_marginEnd="16dp"/>
            <org.chromium.ui.widget.TextViewWithClickableSpans
                android:id="@+id/signin_details_description"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/signin_divider"
                android:layout_marginStart="16dp"
                android:layout_marginTop="16dp"
                android:layout_marginEnd="16dp"
                android:textAppearance="@style/TextAppearance.TextMedium.Secondary"
                tools:text="@string/signin_details_description"/>
        </RelativeLayout>
    </org.chromium.chrome.browser.ui.signin.SigninScrollView>
    <LinearLayout
        android:id="@+id/button_bar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:padding="16dp">
        <org.chromium.ui.widget.ButtonCompat
            android:id="@+id/negative_button"
            style="@style/TextButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            tools:text="@string/no_thanks"/>
        <View
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:visibility="invisible"/>
        <org.chromium.ui.widget.ButtonCompat
            android:id="@+id/positive_button"
            style="@style/FilledButton.Flat"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            tools:text="@string/signin_accept_button"/>
        <org.chromium.ui.widget.ButtonCompat
            android:id="@+id/more_button"
            style="@style/TextButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:drawableEnd="@drawable/down_arrow"
            android:drawablePadding="8dp"
            android:visibility="gone"
            tools:text="@string/more"/>
        <View
            android:id="@+id/positive_button_end_padding"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:visibility="gone"/>
    </LinearLayout>
</org.chromium.chrome.browser.ui.signin.SigninView>


text:
<?php

namespace Annonces\SiteBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Annonces\SiteBundle\Form\MediaType;

class AnnonceType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
         /*   ->add('titre')
            ->add('date')
            ->add('description')
            ->add('prix')
            ->add('active')
            ->add('telephone')
            ->add('afficheTelephone')
            ->add('email')
            ->add('utilisateur')
            ->add('categorie');*/

           ->add('titre',null, array(
                    'label' => '* Titre de l\'annonce',
                    'attr' => array(
                        'placeholder' => 'Titre',
                        'data-title' => 'Saisissez le titre de l\'annonce',
                    ),

                )
            )
            ->add('description','textarea', array(
                  'label' => '* Description',
                  'attr' => array(
                        'data-title' => 'Saisissez le titre de l\'annonce',

                    ),
                )
            )
            ->add('prix')
            ->add('cp')
            ->add('active', 'checkbox', array('required' => false))

            ->add('telephone', null, array(
                    'label' => 'Numéro de téléphone',
                    'attr' => array(
                        'placeholder' => '0123456789',
                        'data-title' => 'Par défaut, votre téléphone ne sera pas visible dans l\'annonce',
                    )
                )
            )
            ->add('afficheTelephone', null, array(
                    'label' => 'Afficher le téléphone dans l\'annonce ?',
                    'label_attr' => array(
                        'class' => 'db-option',
                    ),
                    'attr' => array(
                        'class' => 'db-option'
                    )

                )
            )
            ->add('email', null, array(
                    'label' => '* E-Mail',
                    'required' => true,
                    'attr' => array(
                        'placeholder' => 'E-Mail',
                        'data-title' => 'Cet E-Mail ne sera pas visible dans l\'annonce afin d\'éviter le spam. Les utilisateurs pourront vous contacter grâce à un formulaire ',

                    )
                )
            )

            ->add('images', 'collection', array(
                'type'         => new MediaType(),
                'allow_add'     => true,
                'allow_delete'  => true,
                'prototype' => true,
                'label'=>"Images de l'annonce",
                'by_reference' => false
              ))

            ->add('categorie')
            ->add('utilisateur');
    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Annonces\SiteBundle\Entity\Annonce'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'annonces_sitebundle_annonce';
    }
}


text:
A java implementation of a turn based grid game in which user-created alien objects fight each other for resources.

This project has been moved to https://github.com/EastsidePreparatorySchool/Ephemera


text:
#ifndef KERNEL_SEM_H_INCLUDED
#define KERNEL_SEM_H_INCLUDED

/*
 * struct kproc_sem
 * see kernel_process_private.h
 */
struct kproc_sem;

/*
 * kernel_sem_init
 * This function initializes semaphore.
 * arg0 (uint8_t) - argument takes amount of the free blocks
 * returns: pointer to the semaphore instance or NULL in case of error
 */
struct kproc_sem * kernel_sem_init(uint8_t);

/*
 * kernel_sem_enter
 * This function captures block of semaphore.
 *  If no free blocks available then the process will set to WAIT state.
 * arg0 (struct kproc_sem *) - valid instance of kproc_sem
 * returns: 0 on success and 1 on error
 */
int8_t kernel_sem_enter(struct kproc_sem *);

/*
 * kernel_sem_leave
 * This function releases block of semaphore.
 * arg0 (struct kproc_sem *) - valid instance of kproc_sem
 * returns: 0 on success and 1 o error
 */
int8_t kernel_sem_leave(struct kproc_sem *);

//Information

/*
 * kernel_sem_get_total
 * This function returns the total available slots for the selected semaphore.
 *	This function does not validate input.
 * arg0 (struct kproc_sem *) pointer to the valid instance of semaphore
 * returns: value (uint8_t)
 */
uint8_t kernel_sem_get_total(struct kproc_sem *);

/*
 * kernel_sem_get_free
 * This function returns the free slots available for the selected semaphore.
 *	This function does not validate input.
 * arg0 (struct kproc_sem *) pointer to the valid instance of semaphore
 * returns: value (uint8_t)
 */
uint8_t kernel_sem_get_free(struct kproc_sem *);

/*
 * kernel_sem_get_free
 * This function returns the amount of waiting processes for the slot in the selected semaphore.
 *	This function does not validate input.
 * arg0 (struct kproc_sem *) pointer to the valid instance of semaphore
 * returns: value (uint8_t)
 */
uint8_t kernel_sem_get_waiting(struct kproc_sem *);

/*--------------------SEM BLOCK---------------------*/

/*
 * struct _sem_ToDo overhead structure
 */
struct _sem_ToDo
{
	struct kproc_sem * sem;
	int8_t ret;
};

static inline void
__leave_sem(const struct _sem_ToDo * mtd)
{
	kernel_sem_leave(mtd->sem);

	asm volatile ("" ::: "memory");
}

//exit mutex block immediately
#define SEM_ACTION_LEAVE 0
//manual problem resolution (see MUTEX_BLOCK_VAR_RET)
#define SEM_ACTION_MANUAL 2

//retrives the returnd result
#define SEM_BLOCK_VAR_RET st.ret
#define SEM_LOCK_FAILED SEM_ACTION_MANUAL

#define SEM_BLOCK(_SEM_, _ACTION_) \
	for (struct _sem_ToDo st __attribute__((__cleanup__(__leave_sem))) = {_SEM_, (kernel_sem_enter(_SEM_) == 0) ? 1 : _ACTION_};\
		st.ret;\
		st.ret = ((st.ret == SEM_LOCK_FAILED) ? 2 : 0))

#endif // KERNEL_SEM_H_INCLUDED


text:
package com.aigestudio.wheelpicker.view;

/**
 * 通用常量值 General constant value
 *
 * @author AigeStudio 2015-12-01
 * @author AigeStudio 2015-12-08
 * @version 1.0.0 beta
 */
class WheelCons {
	/**
	 * 全局Debug开关 Global debug switch
	 */
	static final boolean DEBUG = true;

	/**
	 * 圆环显示的最大角度范围 Maximum degree of ring display in range
	 */
	static final int DEGREE_MAXIMUM = 90;

	/**
	 * 圆环显示的最小角度范围 Minimum degree of ring display in range
	 */
	static final int DEGREE_MINIMUM = -DEGREE_MAXIMUM;

	/**
	 * 触摸距离的最小响应值 Minimum response value of touch move distance
	 */
	static final int TOUCH_DISTANCE_MINIMUM = 8;

	/**
	 * 速度追踪单位值 Value of velocity track
	 */
	static final int VELOCITY_TRACKER_UNITS_GEAR_FIRST = 200;
	static final int VELOCITY_TRACKER_UNITS_GEAR_SECOND = 400;
}