text:
using namespace boost;
using namespace boost::interprocess;
using namespace boost::posix_time;

#if defined MAC_OSX || defined __FreeBSD__
// URI handling not implemented on OSX yet

void ipcScanRelay(int argc, char *argv[]) { }
void ipcInit(int argc, char *argv[]) { }

#else

static void ipcThread2(void* pArg);

static bool ipcScanCmd(int argc, char *argv[], bool fRelay)
{
    // Check for URI in argv
    bool fSent = false;
    for (int i = 1; i < argc; i++)
    {
        if (boost::algorithm::istarts_with(argv[i], "TechCoin:"))
        {
            const char *strURI = argv[i];
            try {
                boost::interprocess::message_queue mq(boost::interprocess::open_only, BITCOINURI_QUEUE_NAME);
                if (mq.try_send(strURI, strlen(strURI), 0))
                    fSent = true;
                else if (fRelay)
                    break;
            }
            catch (boost::interprocess::interprocess_exception &ex) {
                // don't log the "file not found" exception, because that's normal for
                // the first start of the first instance
                if (ex.get_error_code() != boost::interprocess::not_found_error || !fRelay)
                {
                    printf("main() - boost interprocess exception #%d: %s\n", ex.get_error_code(), ex.what());
                    break;
                }
            }
        }
    }
    return fSent;
}

void ipcScanRelay(int argc, char *argv[])
{
    if (ipcScanCmd(argc, argv, true))
        exit(0);
}

static void ipcThread(void* pArg)
{
    // Make this thread recognisable as the GUI-IPC thread
    RenameThread("TechCoin-gui-ipc");

    try
    {
        ipcThread2(pArg);
    }
    catch (std::exception& e) {
        PrintExceptionContinue(&e, "ipcThread()");
    } catch (...) {
        PrintExceptionContinue(NULL, "ipcThread()");
    }
    printf("ipcThread exited\n");
}

static void ipcThread2(void* pArg)
{
    printf("ipcThread started\n");

    message_queue* mq = (message_queue*)pArg;
    char buffer[MAX_URI_LENGTH + 1] = "";
    size_t nSize = 0;
    unsigned int nPriority = 0;

    while (true)
    {
        ptime d = boost::posix_time::microsec_clock::universal_time() + millisec(100);
        if (mq->timed_receive(&buffer, sizeof(buffer), nSize, nPriority, d))
        {
            uiInterface.ThreadSafeHandleURI(std::string(buffer, nSize));
            MilliSleep(1000);
        }

        if (fShutdown)
            break;
    }

    // Remove message queue
    message_queue::remove(BITCOINURI_QUEUE_NAME);
    // Cleanup allocated memory
    delete mq;
}

void ipcInit(int argc, char *argv[])
{
    message_queue* mq = NULL;
    char buffer[MAX_URI_LENGTH + 1] = "";
    size_t nSize = 0;
    unsigned int nPriority = 0;

    try {
        mq = new message_queue(open_or_create, BITCOINURI_QUEUE_NAME, 2, MAX_URI_LENGTH);

        // Make sure we don't lose any bitcoin: URIs
        for (int i = 0; i < 2; i++)
        {
            ptime d = boost::posix_time::microsec_clock::universal_time() + millisec(1);
            if (mq->timed_receive(&buffer, sizeof(buffer), nSize, nPriority, d))
            {
                uiInterface.ThreadSafeHandleURI(std::string(buffer, nSize));
            }
            else
                break;
        }

        // Make sure only one bitcoin instance is listening
        message_queue::remove(BITCOINURI_QUEUE_NAME);
        delete mq;

        mq = new message_queue(open_or_create, BITCOINURI_QUEUE_NAME, 2, MAX_URI_LENGTH);
    }
    catch (interprocess_exception &ex) {
        printf("ipcInit() - boost interprocess exception #%d: %s\n", ex.get_error_code(), ex.what());
        return;
    }

    if (!NewThread(ipcThread, mq))
    {
        delete mq;
        return;
    }

    ipcScanCmd(argc, argv, false);
}

#endif


text:
'use strict';

var sutil = require('spun-util');
var f = require('util').format;
var errors = sutil.errors;
var inherits = require('util').inherits;
var exports = {
  MissingStrategyError: function(strategy){
    this.message = f('The provider had no "%s" method.', strategy);
  }
};

module.exports = exports;

redpajama_set_name: RedPajamaGithub


text:
# WS05: Program Size

The ```size``` command reports the sizes (in bytes) of the different segments of a program.
Remember that the ```long``` data type occupies 8 bytes of memory both on 32-bit and 64-bit systems.
All samples used here can be found at [llp2/worksheets/worksheet05](../worksheet05).

Consider the following program ([size1.c](size1.c)).
```c
#include <stdio.h>
int main(void) {
  return 0;
}
```

Compiling it and checking its segment sizes on a 64-bit Xubuntu (gcc 5.4) will produce the following:
```
$ gcc size1.c -o test1
$ size test1
text   data   bss    dec    hex   filename
1099    544     8   1651    673   test1
```

Adding a global variable results in an increment in the size (BSS):
```c
#include <stdio.h>
long global; /* Uninitialized variable stored in BSS */
int main(void) {
  return 0;
}
```

```
$ gcc size2.c -o test2
$ size test2
text   data   bss    dec   hex   filename
1099    544    16   1659   67b   test2
```

Adding a static variable again increases the size (BSS):
```c
#include <stdio.h>
long global; /* Uninitialized variable stored in BSS */
int main(void) {
  static long i; /* Uninitialized static variable stored in BSS */
  return 0;
}
```

```
$ gcc size3.c -o test3
$ size test3
text   data   bss    dec   hex   filename
1099    544    24   1667   683   test3
```

Initialising the static variable results in the changes observable below:

```c
#include <stdio.h>
long global; /* Uninitialized variable stored in BSS */
int main(void) {
  static long i = 100; /* Initialized static variable stored in Data segment */
  return 0;
}
```
```
$ gcc size4.c -o test4
$ size test4
text   data   bss    dec   hex   filename
1099    552    16   1667   683   test4
```

Finally initialising the global variable and results in the size changes below:
```c
#include <stdio.h>
long global = 10; /* initialized global variable stored in DS */
int main(void) {
  static long i = 100; /* Initialized static variable stored in DS */
  return 0;
}
```
```
$ gcc size5.c -o test5
$ size test5
text   data   bss    dec   hex   filename
1099   560      8   1667   683   test5
```

Reference:
http://www.geeksforgeeks.org/memory-layout-of-c-program/


text:
import { Injectable } from '@angular/core';
import { Http, Headers, RequestOptions, Response } from '@angular/http';

import { ServiceRequest } from '../_models/index';

@Injectable()
export class ServiceRequestService {
    constructor(private http: Http) {}

    getAll() {
        return this.http.get('/api/serviceRequests').map((response: Response) => response.json());;
    }

    getById(id: number) {
        return this.http.get('/api/serviceRequests/' + id).map((response: Response) => response.json());;
    }

    create(serviceRequest: ServiceRequest) {
        return this.http.post('/api/serviceRequests', serviceRequest).map((response: Response) => response.json());;
    }

    update(serviceRequest: ServiceRequest) {
        return this.http.put('/api/serviceRequests/' + serviceRequest.id, serviceRequest).map((response: Response) => response.json());;
    }

    delete(id: number) {
        return this.http.delete('/api/serviceRequests/' + id).map((response: Response) => response.json());;
    }
}


text:
Welcome to the CSSI Curriculum Labs.

This repository contains the code and instructions for the student activities
and labs that complement the CSSI curriculum.

## How to download and complete these labs.

You will clone this repository to your local machine, and complete the exercises
locally. You will **not** contribute your solutions to this repository, but
you can, if you choose, create your own repository and use it to store your
solutions for later.

### Cloning the repository

To create your own local copy of this repository, use the following command:

``` shell
git clone https://github.com/google/cssi-labs
```

This will create a new folder with all the files you will need for the course.

### Writing your solutions

The main level folders divide the content by topic, inside each folder you
will find all the activities for that topic. Each lab or activity has a
`README.md` file with the instructions. You can find the same instructions in
the CSSI curriculum website shared with you by your instructors.

### Saving your solutions (optional)

If you choose to use GitHub to track your solutions, you will **not** be saving
them to Google's original repository, but you can create your own repository in
GitHub, and link it to your local copy by running

```
git remote add personal <your repository url>
```

You can find your repository URL on the GitHub web interface after you created
it.

Once you have added your remote repository, which is now named `personal`, you
can store your changes following these steps:

1. Add the files you created or modified:
```shell
git add <filenames>
```
2. Save the changes locally:
```shell
git commit -m "<insert some description of your change here>"
```
3. Push the changes to your remote repository:
```shell
git push personal
```

Don't simply run `git push`, because that will try to update our original
repository, which will reject your changes.


text:
/* Normal screen CSS Document */
.formrow .dt { width: 20%; }
.formrow .dd { width: 77%; margin-left: 21%; }

.formlist .text, .formlist textarea, .formlist .password { padding: 3px; }
.formlist select { padding: 2px; }


text:
package org.odlabs.wiquery.ui.commons;

import org.apache.wicket.markup.html.WebPage;

public class WiQuerySettingsTestPage extends WebPage
{

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;

}


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

     Copyright 2005-2014 Red Hat, Inc.

     Red Hat licenses this file to you 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.

-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>io.fabric8.runtime</groupId>
        <artifactId>fabric-runtime-container-tomcat</artifactId>
        <version>2.0.0-SNAPSHOT</version>
    </parent>

    <artifactId>fabric8-tomee</artifactId>
    <name>Fabric8 :: Runtime :: Container :: TomEE :: Distro</name>
    <packaging>pom</packaging>

  <properties>
      <karaf.base>${tomcat.home}/work/karaf-base</karaf.base>
      <tomcat.home>${project.build.directory}/apache-tomee-webprofile-${tomee.version}</tomcat.home>

      <fabric8.tomcat.build>${project.build.directory}/distro-build</fabric8.tomcat.build>
      <fabric8.tomcat.home>${fabric8.tomcat.build}/fabric8-tomee-${project.version}</fabric8.tomcat.home>
  </properties>

    <dependencies>
    </dependencies>

    <build>
        <plugins>
          <plugin>
              <artifactId>maven-dependency-plugin</artifactId>
              <version>${maven-dependency-plugin.version}</version>
              <executions>
                  <execution>
                      <id>unpack-tomcat</id>
                      <phase>process-test-resources</phase>
                      <goals>
                          <goal>unpack</goal>
                      </goals>
                      <configuration>
                          <artifactItems>
                              <artifactItem>
                                  <groupId>org.apache.openejb</groupId>
                                  <artifactId>apache-tomee</artifactId>
                                  <version>${tomee.version}</version>
                                  <classifier>webprofile</classifier>
                                  <type>zip</type>
                                  <overWrite>false</overWrite>
                                  <outputDirectory>${project.build.directory}</outputDirectory>
                              </artifactItem>
                          </artifactItems>
                      </configuration>
                  </execution>
                  <execution>
                      <id>unpack-tomcat-patch</id>
                      <phase>process-test-resources</phase>
                      <goals>
                          <goal>unpack</goal>
                      </goals>
                      <configuration>
                          <artifactItems>
                              <artifactItem>
                                  <groupId>io.fabric8.runtime</groupId>
                                  <artifactId>fabric-runtime-container-tomcat-patch</artifactId>
                                  <version>${project.version}</version>
                                  <type>zip</type>
                                  <overWrite>true</overWrite>
                                  <outputDirectory>${tomcat.home}</outputDirectory>
                              </artifactItem>
                          </artifactItems>
                      </configuration>
                  </execution>
              </executions>
          </plugin>
          <plugin>
              <artifactId>maven-antrun-plugin</artifactId>
              <inherited>false</inherited>
              <executions>
                  <execution>
                      <goals>
                          <goal>run</goal>
                      </goals>
                      <phase>process-test-resources</phase>
                      <configuration>
                          <target>
                              <copy file="etc/tomcat/conf/tomcat-users.xml" todir="${tomcat.home}/conf" overwrite="true" />
                              <copy file="etc/tomcat/conf/jaas.config" todir="${tomcat.home}/conf" overwrite="true" />
                              <copy file="etc/tomcat/conf/users.properties" todir="${tomcat.home}/conf" overwrite="true" />

                              <!-- rename folder to fabric8 name -->
                              <move file="${tomcat.home}" tofile="${fabric8.tomcat.home}"/>

                              <chmod dir="${fabric8.tomcat.home}/bin" perm="ugo+rx" includes="**/*.sh" verbose="true"/>
                              <chmod dir="${fabric8.tomcat.home}/bin" perm="ugo+rx" includes="fabric8" verbose="true"/>

                              <!-- Zip the tomcat distro -->
                              <zip destfile="${basedir}/target/${project.artifactId}-${project.version}.zip">
                                <zipfileset dir="${fabric8.tomcat.build}">
                                  <exclude name="**/bin/*.sh"/>
                                  <exclude name="**/bin/fabric8"/>
                                </zipfileset>
                                <zipfileset dir="${fabric8.tomcat.build}" filemode="755">
                                  <include name="**/bin/*.sh"/>
                                  <include name="**/bin/fabric8"/>
                                </zipfileset>
                              </zip>
                              <tar destfile="${basedir}/target/${project.artifactId}-${project.version}.tar.gz" compression="gzip">
                                <tarfileset dir="${fabric8.tomcat.build}">
                                  <exclude name="**/bin/*.sh"/>
                                  <exclude name="**/bin/fabric8"/>
                                </tarfileset>
                                <tarfileset dir="${fabric8.tomcat.build}" filemode="755">
                                  <include name="**/bin/*.sh"/>
                                  <include name="**/bin/fabric8"/>
                                </tarfileset>
                              </tar>
                          </target>
                      </configuration>
                  </execution>
              </executions>
          </plugin>
           <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-artifacts</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>${basedir}/target/${project.artifactId}-${project.version}.zip</file>
                                    <type>zip</type>
                                </artifact>
                                <artifact>
                                    <file>${basedir}/target/${project.artifactId}-${project.version}.tar.gz</file>
                                    <type>tar.gz</type>
                                </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>


text:
# grunt-smarttext

> Preprocess text in html files replacing quotes, ellipses, and other characters with their encoded utf equivalent

## Getting Started
This plugin requires Grunt `~0.4.1`

If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

```shell
npm install grunt-smarttext --save-dev
```

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

```js
grunt.loadNpmTasks('grunt-smarttext');
```

## The "smarttext" task

### Overview
In your project's Gruntfile, add a section named `smarttext` to the data object passed into `grunt.initConfig()`.

```js
grunt.initConfig({
  smarttext: {
    options: {
      // Task-specific options go here.
    },
    your_target: {
      // Target-specific file lists and/or options go here.
    },
  },
})
```

### Options

#### options.singles
Type: `Boolean`
Default value: `true`

Should the parser replace single quotes with their smart equivalent

#### options.apostrophes
Type: `Boolean`
Default value: `true`

Should the parser replace apostrophes with their smart equivalent

#### options.doubles
Type: `Boolean`
Default value: `true`

Should the parser replace double quotes with their smart equivalent

#### options.emdashes
Type: `Boolean`
Default value: `true`

Should the parser replace emdashes, `--`, with their smart equivalent

#### options.ellipses
Type: `Boolean`
Default value: `true`

Should the parser replace ellipses with their smart equivalent

#### options.widows
Type: `Boolean`
Default value: `true`

Should the parser prevent widows using a non-breaking space.

#### options.custom_replacements
Type: `Array of Arrays`
Default value: `[]`

Custom replacements that should be applied to your html text. Should be
of the form `[/regex/g, 'replacement string']`.

### Usage Examples

#### Default Options
By default all the replacements will run on your html files, with
exception of custom replacements.

```js
grunt.initConfig({
  smarttext: {
    options: {},
    files: [{
      'expand': true,
      'cwd': 'test/fixtures',
      'src': ['**/*.html'],
      'dest': 'tmp'
    }],
  },
})
```

#### Custom Options

```js
grunt.initConfig({
  smarttext: {
    options: {
      ellipses: false,
      widows: false,
    },
    files: [{
      'expand': true,
      'cwd': 'test/fixtures',
      'src': ['**/*.html'],
      'dest': 'tmp'
    }],
  },
})
```

## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).

## Release History

* `0.1.0` - Initial release. Able to replace singlequotes, doublequotes, apostrophes, emdashes, ellipses, custom replacers, and prevent widows.


text:
import logging
import random
import ssl
import unittest
import urllib2

TRIES=3
TIMEOUT=60

class TimeoutError(Exception):
    pass

def test_3times_then_fail(func, *args, **kwargs):
    log = logging.getLogger("tests")
    for i in range(TRIES):
        try:
            return func(*args, **kwargs)
        except urllib2.HTTPError, e:
            if e.code == 500:
                log.debug("Internal server error (func=%s%s, kwargs=%s, try=%d)" %
                        (repr(func), str(args), str(kwargs), i)
                    )
                if i == TRIES-1:
                    raise TimeoutError('To many HTTP-Errors')
        except ssl.SSLError, e:
            if e.msg == "The read operation timed out":
                log.debug("Timeout error (func=%s%s, kwargs=%s, try=%d)" %
                        (repr(func), str(args), str(kwargs), i)
                    )
                if i == TRIES-1:
                    raise TimeoutError('To many HTTP-Timeouts')
        except UnicodeEncodeError, e:
            log.warning("Fail because of unicode encoding error: %s",
                        e)
            if i == TRIES-1:
                raise TimeoutError('To many Unicode encoding errors')

class ListResourceTestCase(unittest.TestCase):
    def get_id_and_name_test(self, cls, test_against):
        try:
            instances = test_3times_then_fail(
                    cls,
                    field_list=['name','id'],
                    timeout=TIMEOUT
                )
            if len(instances) > 0:
                if len(instances) > 100:
                    rand_offset = random.randint(1,len(instances)-100)
                else:
                    rand_offset = 1
                max_index = random.randint(
                        rand_offset,
                        min(len(instances), rand_offset+300)
                    )
                logging.getLogger("tests").debug(
                        "%s.test_get_id_and_name: rand_offset = %d, max_index = %d",
                        type(self).__name__,
                        rand_offset,
                        max_index
                    )
                instances = test_3times_then_fail(
                        cls,
                        field_list=['name','id'],
                        limit=100,
                        offset=rand_offset,
                        timeout=TIMEOUT
                    )
                self.assertNotEqual(len(instances), 0)
                for c in test_3times_then_fail(list,instances[
                        rand_offset:max_index
                    ]):
                    self.assertIsInstance(c, test_against)
            else:
                logging.getLogger("tests").debug(
                        "%s.test_get_id_and_name: no instances => no test",
                        type(self).__name__
                    )
        except TimeoutError,e:
            logging.getLogger("tests").debug(e)

class SingularResourceTestCase(unittest.TestCase):
    def get_random_instance(self,cls):
        self.id, self.name = None, None
        try:
            instances = test_3times_then_fail(
                    cls,
                    field_list=['id','name'],
                    timeout=TIMEOUT
                )
            if instances != None and len(instances) > 0:
                rand_instance = test_3times_then_fail(
                        random.choice,
                        instances
                    )
                self.id, self.name = rand_instance.id, \
                        rand_instance.name
        except TimeoutError,e:
            logging.getLogger("tests").debug(e)

    def search_test(self, cls, test_against):
        try:
            if self.id != None:
                logging.getLogger("tests").debug(
                        "%s.test_search: id = %d, name = %s",
                        type(self).__name__,
                        self.id,
                        self.name
                    )
                search = test_3times_then_fail(
                        cls.search,
                        self.name,
                        field_list=['id'],
                        timeout=TIMEOUT
                    )
                self.assertNotEqual(len(search),0)
                for c in test_3times_then_fail(list,search):
                    self.assertIsInstance(c, (test_against, type(None)))
                self.assertIn(
                        self.id,
                        [c.id if c != None else None for c in \
                                test_3times_then_fail(list,search)]
                    )
            else:
                logging.getLogger("tests").debug(
                        "%s.test_search: id = None => no test",
                        type(self).__name__
                    )
        except TimeoutError,e:
            logging.getLogger("tests").debug(e)

    def get_sample(self,cls):
        try:
            if self.id != None:
                logging.getLogger("tests").debug(
                        "%s.test_get_all_attributes: id = %d, name = %s",
                        type(self).__name__,
                        self.id,
                        self.name
                    )
                return test_3times_then_fail(
                        cls,
                        self.id,
                        all=True,
                        timeout=TIMEOUT
                    )
            else:
                logging.getLogger("tests").debug(
                        "%s.test_get_all_attributes: id = None => no test",
                        type(self).__name__
                    )
        except TimeoutError,e:
            logging.getLogger("tests").debug(e)


text:
<!DOCTYPE html>

  <title>Level1</title>
  <meta name="GENERATOR" content="Midnight Commander (mcedit)">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta name="Keywords" content="centralina, livello1, python">
  <meta name="Author" content="Davide">

Livello 1

Centralina livello 1

    Seleziona e Manipola chiavi Redis

	Aggiungi chiavi "sets" Redis

    Manipolazione files Grafici

    Daemons

Servizio

    config.json

    Configura DB Messaggi (CentRed)

    Visualizza files in archivio

Riferimenti

    Wiki (RaspiBO)

    Repository (github)


text:
import { combineReducers } from 'redux';

const rootReducer = combineReducers({
	state: (state = {}) => state
});

export default rootReducer;


text:
<!--
 * Copyright (c) 2012 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.
-->
<html>
<head>
</head>
<body>
Empty page, which will have cookies injected into by the browser test.
</body>
</html>


text:
module Sportradar
  module Mlb
    module Models
      class Pitch
        def initialize(attributes:)
          @attributes = attributes
        end

        def to_s
          "#{pitch_name} = #{pitch_outcome}"
        end

        def at_bat_balls
          attributes['at_bat_balls'] || 0
        end

        def at_bat_outs
          attributes['at_bat_outs'] || 0
        end

        def at_bat_pitch_count
          attributes['at_bat_pitch_count'] || 0
        end

        def at_bat_strikes
          attributes['at_bat_strikes'] || 0
        end

        def pitch_count
          attributes['pitch_count'] || 0
        end

        def pitch_speed
          attributes['pitch_speed'] || 0
        end

        def pitch_type
          attributes['pitch_type'] || ''
        end

        def pitch_zone
          attributes['pitch_zone'] || ''
        end

        def at_bat_id
          attributes['at_bat_id']
        end

        def event_id
          attributes['event_id']
        end

        def game_id
          attributes['game_id']
        end

        def pitcher_id
          attributes['pitcher_id']
        end

        def pitch_outcome_type
          attributes['pitch_outcome_type']
        end

        def hitter_id
          attributes['hitter_id']
        end

        def hit_type
          attributes['hit_type']
        end

        def hit_location
          attributes['hit_location']
        end

        def pitched_at
          attributes['pitched_at']
        end

        def at_bat?
          attributes['is_ab'] || false
        end

        def at_bat_over?
          attributes['is_ab_over'] || false
        end

        def bunt?
          attributes['is_bunt'] || false
        end

        def bunt_shown?
          attributes['is_bunt_shown'] || false
        end

        def double_play?
          attributes['is_double_play'] || false
        end

        def hit?
          attributes['is_hit'] || false
        end

        def on_base?
          attributes['is_on_base'] || false
        end

        def passed_ball?
          attributes['is_passed_ball'] || false
        end

        def triple_play?
          attributes['is_triple_play'] || false
        end

        def wild_pitch?
          attributes['is_wild_pitch'] || false
        end

        def number
          attributes['number'] || 0
        end

        def inning
          attributes['inning'] || 0
        end

        def half
          attributes['half'] || ''
        end

        def sequence
          attributes['sequence'] || 0
        end

        def pitch_outcome
          attributes['pitch_outcome'] || ''
        end

        def pitch_type
          attributes['pitch_type'] || ''
        end

        def pitch_name
          PitchType.new(pitch_type: pitch_type).
            name || ''
        end

        def self.from_at_bats(game_id:, at_bats: [])
          [].tap do |pitches|
            at_bats.each do |at_bat|
              at_bat.events.each do |event|
                if event['type'] == 'pitch' && event['status'] == 'official'
                  pitches << new(attributes: event['pitcher'].
                                               merge('game_id' => game_id).
                                               merge('at_bat_id' => at_bat.id,
                                                     'event_id' => event['id'],
                                                     'pitched_at' => event['created_at'],
                                                     'pitcher_id' => event['pitcher']['id'],
                                                     'pitch_outcome_type' => event['outcome_id'],
                                                     'hitter_id' => at_bat.hitter_id,
                                                     'hit_type' => event['hit_type'],
                                                     'hit_location' => event['hit_location']).
                                               merge((event['count'] || {}).transform_keys { |key| key.dup.to_s.prepend('at_bat_') }).
                                               merge(event['flags']).
                                               merge(at_bat.time_code).
                                               merge('pitch_outcome' => PitchOutcome.new(outcome: event['outcome_id']).
                                                                          to_s).
                                               except('id'))
                end
              end
            end
          end
        end

        private

        attr_reader :attributes
      end
    end
  end
end


text:
date:: 2015-05-31
type:: codepen
category:: pen
published:: true
tags:: code
title:: THANKYOU to my first 1000 followers!
penhash:: doNVQe
link:: http://codepen.io/rachsmith/pen/doNVQe

# THANKYOU to my first 1000 followers!

I hit 1000 CodePen followers last week. Y'all are my people and I love you. I made a little SVG animation with the GSAP library to celebrate.


text:
import React from 'react';
import cx from 'classnames';
import MuiCardContent from '@material-ui/core/CardContent';
import { CARD_CONTENT } from '../../theme/core';

const CardContent = ({ className, ...props }) => (
  <MuiCardContent className={cx(CARD_CONTENT.root, className)} {...props} />
);

export default CardContent;


text:
#pragma once
#include <aws/ce/CostExplorer_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;

namespace Utils
{
namespace Json
{
  class JsonValue;
} // namespace Json
} // namespace Utils
namespace CostExplorer
{
namespace Model
{
  class AWS_COSTEXPLORER_API UpdateAnomalySubscriptionResult
  {
  public:
    UpdateAnomalySubscriptionResult();
    UpdateAnomalySubscriptionResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
    UpdateAnomalySubscriptionResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);

    /**
     * <p> A cost anomaly subscription ARN. </p>
     */
    inline const Aws::String& GetSubscriptionArn() const{ return m_subscriptionArn; }

    /**
     * <p> A cost anomaly subscription ARN. </p>
     */
    inline void SetSubscriptionArn(const Aws::String& value) { m_subscriptionArn = value; }

    /**
     * <p> A cost anomaly subscription ARN. </p>
     */
    inline void SetSubscriptionArn(Aws::String&& value) { m_subscriptionArn = std::move(value); }

    /**
     * <p> A cost anomaly subscription ARN. </p>
     */
    inline void SetSubscriptionArn(const char* value) { m_subscriptionArn.assign(value); }

    /**
     * <p> A cost anomaly subscription ARN. </p>
     */
    inline UpdateAnomalySubscriptionResult& WithSubscriptionArn(const Aws::String& value) { SetSubscriptionArn(value); return *this;}

    /**
     * <p> A cost anomaly subscription ARN. </p>
     */
    inline UpdateAnomalySubscriptionResult& WithSubscriptionArn(Aws::String&& value) { SetSubscriptionArn(std::move(value)); return *this;}

    /**
     * <p> A cost anomaly subscription ARN. </p>
     */
    inline UpdateAnomalySubscriptionResult& WithSubscriptionArn(const char* value) { SetSubscriptionArn(value); return *this;}

  private:

    Aws::String m_subscriptionArn;
  };

} // namespace Model
} // namespace CostExplorer
} // namespace Aws


text:
import {ViewportRuler} from '@angular/cdk/scrolling';
import {DOCUMENT} from '@angular/common';
import {ElementRef, Inject, Injectable} from '@angular/core';
import {OriginConnectionPosition, OverlayConnectionPosition} from './connected-position';
import {ConnectedPositionStrategy} from './connected-position-strategy';
import {FlexibleConnectedPositionStrategy} from './flexible-connected-position-strategy';
import {GlobalPositionStrategy} from './global-position-strategy';

/** Builder for overlay position strategy. */
@Injectable({providedIn: 'root'})
export class OverlayPositionBuilder {
  constructor(
    private _viewportRuler: ViewportRuler,
    @Inject(DOCUMENT) private _document: any) { }

  /**
   * Creates a global position strategy.
   */
  global(): GlobalPositionStrategy {
    return new GlobalPositionStrategy();
  }

  /**
   * Creates a relative position strategy.
   * @param elementRef
   * @param originPos
   * @param overlayPos
   * @deprecated Use `flexibleConnectedTo` instead.
   * @deletion-target 7.0.0
   */
  connectedTo(
      elementRef: ElementRef,
      originPos: OriginConnectionPosition,
      overlayPos: OverlayConnectionPosition): ConnectedPositionStrategy {

    return new ConnectedPositionStrategy(originPos, overlayPos, elementRef, this._viewportRuler,
        this._document);
  }

  /**
   * Creates a flexible position strategy.
   * @param elementRef
   */
  flexibleConnectedTo(elementRef: ElementRef): FlexibleConnectedPositionStrategy {
    return new FlexibleConnectedPositionStrategy(elementRef, this._viewportRuler, this._document);
  }

}


text:
niclabs.insight.map.marker.SimpleMarker = (function($) {
    /**
     * Constructor for simple markers
     *
     * Simple markers are shown in the map as basic waypoints, with no style options
     *
     * @class niclabs.insight.map.marker.SimpleMarker
     * @extends niclabs.insight.map.marker.Marker
     * @param {niclabs.insight.Dashboard} dashboard - dashboard that this marker belongs to
     * @param {Object} options - configuration options for the layer
     * @param {string} options.layer - identifier for the layer that this marker belongs to
     * @param {float} options.lat - latitude for the marker
     * @param {float} options.lng - longitude for the marker
     * @param {string} options.landmark - landmark that the marker indicates
     */
    var SimpleMarker = function(dashboard, options) {
        var self = niclabs.insight.map.marker.Marker(dashboard, options);

        var latLng = new google.maps.LatLng(parseFloat(options.lat), parseFloat(options.lng));

        var marker = new google.maps.Marker({
            position: latLng,
            map: self.map.googlemap(),
            title: options.landmark || ''
        });

        // Re-write the marker function
        self.marker = function() {
            return marker;
        };

        return self;
    };

    // Register the handler
    niclabs.insight.handler('simple-marker', 'marker', SimpleMarker);

    return SimpleMarker;
})(jQuery);


text:
![alt tag](https://cloud.githubusercontent.com/assets/1453658/6885017/90467188-d604-11e4-9ae7-c6cd68196b3c.png)

Create Animated Panoramic View  Can be use for any sign-In screen where background image can move.


text:
class dtkVtGaussianFilterPrivate
{
public:
    dtkImage *image_in;
    dtkImage *image_out;

    double sigma;
    double *sigma_values;

public:
    template < typename ImgT, int dim > void exec(void);
};

// ///////////////////////////////////////////////////////////////////
//
// ///////////////////////////////////////////////////////////////////

dtkVtGaussianFilter::dtkVtGaussianFilter(void): dtkAbstractGaussianFilter(), d(new dtkVtGaussianFilterPrivate)
{
    d->image_in = nullptr;
    d->image_out = new dtkImage();

    d->sigma = 0;
    d->sigma_values = nullptr;
}

dtkVtGaussianFilter::~dtkVtGaussianFilter(void)
{
    delete d;
}

void dtkVtGaussianFilter::setSigma(double sigma)
{
    d->sigma = sigma;
}

void dtkVtGaussianFilter::setSigmaValues(double *sigma_values)
{
    d->sigma_values = sigma_values;
}

void dtkVtGaussianFilter::setImage(dtkImage *image)
{
    d->image_in = image;
}

dtkImage *dtkVtGaussianFilter::filteredImage(void) const
{
    return d->image_out;
}

void dtkVtGaussianFilter::run(void)
{
    if (!d->image_in) {
        dtkWarn() << Q_FUNC_INFO << "no image input";
        return;
    }

    dtkFilterExecutor<dtkVtGaussianFilterPrivate>::run(d, d->image_in);
}

template < typename ImgT, int dim> inline void dtkVtGaussianFilterPrivate::exec(void)
{
    vt_image image;
    char str[100];
    if (!sigma_values) {
        if ( dim == 2 )
            sprintf( str, "-x 0 -y 0 -sigma %f", sigma/image_in->spacing()[0] );
        else
            sprintf( str, "-x 0 -y 0 -z 0 -sigma %f", sigma/image_in->spacing()[0] );
    } else {
        if ( dim == 2 )
            sprintf( str, "-x 0 -y 0 -sigma %f %f", sigma_values[0]/image_in->spacing()[0], sigma_values[1]/image_in->spacing()[1] );
        else
            sprintf( str, "-x 0 -y 0 -z 0 -sigma %f %f %f", sigma_values[0]/image_in->spacing()[0], sigma_values[1]/image_in->spacing()[1], sigma_values[2]/image_in->spacing()[2] );
    }

    if (dtkVtImageConverter::convertToNative(this->image_in, &image) != EXIT_FAILURE) {
        if ( API_linearFilter( &image, &image, str, (char*)NULL ) != 1 ) {
            free( image.array );
            dtkError() << Q_FUNC_INFO << "Computation failed. Aborting.";
            return;
        }

        dtkVtImageConverter::convertFromNative(&image, this->image_out);

        free( image.array );
        image.array = NULL;

    } else {
        dtkError() << Q_FUNC_INFO << "Conversion to VT format failed. Aborting.";
    }
}


text:
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#if NET45

using System;
using System.Runtime.InteropServices;

namespace Microsoft.DotNet.PlatformAbstractions.Native
{
    internal static partial class NativeMethods
    {
        public static class Unix
        {
            public unsafe static string GetUname()
            {
                // Utsname shouldn't be larger than 2K
                var buf = stackalloc byte[2048];

                try
                {
                    if (uname((IntPtr)buf) == 0)
                    {
                        return Marshal.PtrToStringAnsi((IntPtr)buf);
                    }
                }
                catch (Exception ex)
                {
                    throw new PlatformNotSupportedException("Error reading Unix name", ex);
                }
                throw new PlatformNotSupportedException("Unknown error reading Unix name");
            }

            [DllImport("libc")]
            private static extern int uname(IntPtr utsname);
        }
    }
}
#endif


text:
package hudson.plugins.git;

import hudson.EnvVars;
import java.util.HashMap;
import static org.junit.Assert.*;
import org.junit.Test;
import org.jvnet.hudson.test.Issue;

public class BranchSpecTest {
    @Test
    public void testMatch() {

        BranchSpec l = new BranchSpec("master");
        assertTrue(l.matches("origin/master"));
        assertFalse(l.matches("origin/something/master"));
        assertTrue(l.matches("master"));
        assertFalse(l.matches("dev"));

        BranchSpec est = new BranchSpec("origin/*/dev");

        assertFalse(est.matches("origintestdev"));
        assertTrue(est.matches("origin/test/dev"));
        assertFalse(est.matches("origin/test/release"));
        assertFalse(est.matches("origin/test/somthing/release"));

        BranchSpec s = new BranchSpec("origin/*");

        assertTrue(s.matches("origin/master"));

        BranchSpec m = new BranchSpec("**/magnayn/*");

        assertTrue(m.matches("origin/magnayn/b1"));
        assertTrue(m.matches("remote/origin/magnayn/b1"));
        assertTrue(m.matches("remotes/origin/magnayn/b1"));

        BranchSpec n = new BranchSpec("*/my.branch/*");

        assertTrue(n.matches("origin/my.branch/b1"));
        assertFalse(n.matches("origin/my-branch/b1"));
        assertFalse(n.matches("remote/origin/my.branch/b1"));
        assertTrue(n.matches("remotes/origin/my.branch/b1"));

        BranchSpec o = new BranchSpec("**");

        assertTrue(o.matches("origin/my.branch/b1"));
        assertTrue(o.matches("origin/my-branch/b1"));
        assertTrue(o.matches("remote/origin/my.branch/b1"));
        assertTrue(o.matches("remotes/origin/my.branch/b1"));

        BranchSpec p = new BranchSpec("*");

        assertTrue(p.matches("origin/x"));
        assertFalse(p.matches("origin/my-branch/b1"));
    }

    @Test
    public void testMatchEnv() {
        HashMap<String, String> envMap = new HashMap<String, String>();
        envMap.put("master", "master");
        envMap.put("origin", "origin");
        envMap.put("dev", "dev");
        envMap.put("magnayn", "magnayn");
        envMap.put("mybranch", "my.branch");
        envMap.put("anyLong", "**");
        envMap.put("anyShort", "*");
        envMap.put("anyEmpty", "");
        EnvVars env = new EnvVars(envMap);

        BranchSpec l = new BranchSpec("${master}");
        assertTrue(l.matches("origin/master", env));
        assertFalse(l.matches("origin/something/master", env));
        assertTrue(l.matches("master", env));
        assertFalse(l.matches("dev", env));

        BranchSpec est = new BranchSpec("${origin}/*/${dev}");

        assertFalse(est.matches("origintestdev", env));
        assertTrue(est.matches("origin/test/dev", env));
        assertFalse(est.matches("origin/test/release", env));
        assertFalse(est.matches("origin/test/somthing/release", env));

        BranchSpec s = new BranchSpec("${origin}/*");

        assertTrue(s.matches("origin/master", env));

        BranchSpec m = new BranchSpec("**/${magnayn}/*");

        assertTrue(m.matches("origin/magnayn/b1", env));
        assertTrue(m.matches("remote/origin/magnayn/b1", env));

        BranchSpec n = new BranchSpec("*/${mybranch}/*");

        assertTrue(n.matches("origin/my.branch/b1", env));
        assertFalse(n.matches("origin/my-branch/b1", env));
        assertFalse(n.matches("remote/origin/my.branch/b1", env));

        BranchSpec o = new BranchSpec("${anyLong}");

        assertTrue(o.matches("origin/my.branch/b1", env));
        assertTrue(o.matches("origin/my-branch/b1", env));
        assertTrue(o.matches("remote/origin/my.branch/b1", env));

        BranchSpec p = new BranchSpec("${anyShort}");

        assertTrue(p.matches("origin/x", env));
        assertFalse(p.matches("origin/my-branch/b1", env));

        BranchSpec q = new BranchSpec("${anyEmpty}");

        assertTrue(q.matches("origin/my.branch/b1", env));
        assertTrue(q.matches("origin/my-branch/b1", env));
        assertTrue(q.matches("remote/origin/my.branch/b1", env));
    }

    @Test
    public void testEmptyName() {
    	BranchSpec branchSpec = new BranchSpec("");
    	assertEquals("**",branchSpec.getName());
    }

    @Test
    public void testNullName() {
    	boolean correctExceptionThrown = false;
    	try {
    		BranchSpec branchSpec = new BranchSpec(null);
    	} catch (IllegalArgumentException e) {
    		correctExceptionThrown = true;
    	}
    	assertTrue(correctExceptionThrown);
    }

    @Test
    public void testNameTrimming() {
    	BranchSpec branchSpec = new BranchSpec(" master ");
    	assertEquals("master",branchSpec.getName());
    	branchSpec.setName(" other ");
    	assertEquals("other",branchSpec.getName());
    }

    @Test
    public void testUsesRefsHeads() {
    	BranchSpec m = new BranchSpec("refs/heads/j*n*");
    	assertTrue(m.matches("refs/heads/jenkins"));
    	assertTrue(m.matches("refs/heads/jane"));
    	assertTrue(m.matches("refs/heads/jones"));

    	assertFalse(m.matches("origin/jenkins"));
    	assertFalse(m.matches("remote/origin/jane"));
    }

    @Test
    public void testUsesJavaPatternDirectlyIfPrefixedWithColon() {
    	BranchSpec m = new BranchSpec(":^(?!(origin/prefix)).*");
    	assertTrue(m.matches("origin"));
    	assertTrue(m.matches("origin/master"));
    	assertTrue(m.matches("origin/feature"));

    	assertFalse(m.matches("origin/prefix_123"));
    	assertFalse(m.matches("origin/prefix"));
    	assertFalse(m.matches("origin/prefix-abc"));
    }

    @Test
    public void testUsesJavaPatternWithRepetition() {
    	// match pattern from JENKINS-26842
    	BranchSpec m = new BranchSpec(":origin/release-\\d{8}");
    	assertTrue(m.matches("origin/release-20150101"));
    	assertFalse(m.matches("origin/release-2015010"));
    	assertFalse(m.matches("origin/release-201501011"));
    	assertFalse(m.matches("origin/release-20150101-something"));
    }

    @Test
    public void testUsesJavaPatternToExcludeMultipleBranches() {
        BranchSpec m = new BranchSpec(":^(?!origin/master$|origin/develop$).*");
        assertTrue(m.matches("origin/branch1"));
        assertTrue(m.matches("origin/branch-2"));
        assertTrue(m.matches("origin/master123"));
        assertTrue(m.matches("origin/develop-123"));
        assertFalse(m.matches("origin/master"));
        assertFalse(m.matches("origin/develop"));
    }

    private EnvVars createEnvMap(String key, String value) {
        HashMap<String, String> envMap = new HashMap<String, String>();
        envMap.put(key, value);
        return new EnvVars(envMap);
    }

    /* BranchSpec does not seem to honor token macros. For example,
     * $GIT_BRANCH matches as expected
     * ${GIT_BRANCH} matches as expected
     * ${GIT_BRANCH,fullName=False} does not match
     * ${GIT_BRANCH,fullName=True} does not match
     */
    @Test
    @Issue("JENKINS-6856")
    public void testUsesEnvValueWithBraces() {
        EnvVars env = createEnvMap("GIT_BRANCH", "origin/master");

        BranchSpec withBraces = new BranchSpec("${GIT_BRANCH}");
        assertTrue(withBraces.matches("refs/heads/origin/master", env));
        assertTrue(withBraces.matches("origin/master", env));
        assertFalse(withBraces.matches("master", env));
    }

    @Test
    @Issue("JENKINS-6856")
    public void testUsesEnvValueWithoutBraces() {
        EnvVars env = createEnvMap("GIT_BRANCH", "origin/master");

        BranchSpec withoutBraces = new BranchSpec("$GIT_BRANCH");
        assertTrue(withoutBraces.matches("refs/heads/origin/master", env));
        assertTrue(withoutBraces.matches("origin/master", env));
        assertFalse(withoutBraces.matches("master", env));
    }

    @Test
    @Issue("JENKINS-6856")
    public void testUsesEnvValueWithToken() {
        EnvVars env = createEnvMap("GIT_BRANCH", "origin/master");

        BranchSpec withToken = new BranchSpec("${GIT_BRANCH,fullName=True}");
        assertFalse(withToken.matches("refs/heads/origin/master", env));
        assertFalse(withToken.matches("origin/master", env));
        assertFalse(withToken.matches("master", env));
    }

    @Test
    @Issue("JENKINS-6856")
    public void testUsesEnvValueWithTokenFalse() {
        EnvVars env = createEnvMap("GIT_BRANCH", "origin/master");

        BranchSpec withTokenFalse = new BranchSpec("${GIT_BRANCH,fullName=false}");
        assertFalse(withTokenFalse.matches("refs/heads/origin/master", env));
        assertFalse(withTokenFalse.matches("origin/master", env));
        assertFalse(withTokenFalse.matches("master", env));
    }
}


text:
package org.orekit.gnss.metric.parser;

import java.util.function.Function;

/** Enum containing all low level data types that can be parsed
 * to build a message.
 * @author Luc Maisonobe
 * @since 11.0
 */
enum DataType {

    /** 1 bit. */
    BIT_1(m -> m.extractBits(1)),

    /** 2 bits. */
    BIT_2(m -> m.extractBits(2)),

    /** 3 bits. */
    BIT_3(m -> m.extractBits(3)),

    /** 4 bits. */
    BIT_4(m -> m.extractBits(4)),

    /** 6 bits. */
    BIT_6(m -> m.extractBits(6)),

    /** 7 bits. */
    BIT_7(m -> m.extractBits(7)),

    /** 8 bits. */
    BIT_8(m -> m.extractBits(8)),

    /** 10 bits. */
    BIT_10(m -> m.extractBits(10)),

    /** 12 bits. */
    BIT_12(m -> m.extractBits(12)),

    /** 24 bits. */
    BIT_24(m -> m.extractBits(24)),

    /** 32 bits. */
    BIT_32(m -> m.extractBits(32)),

    /** 6 bits signed integer. */
    INT_6(m -> {
        final long msb = 0x20l;
        final long signed = (m.extractBits(6) ^ msb) - msb;
        return signed == -msb ? null : signed; // return null for the special value meaning no data
    }),

    /** 8 bits signed integer. */
    INT_8(m -> {
        final long msb = 0x80l;
        final long signed = (m.extractBits(8) ^ msb) - msb;
        return signed == -msb ? null : signed; // return null for the special value meaning no data
    }),

    /** 9 bits signed integer. */
    INT_9(m -> {
        final long msb = 0x100l;
        final long signed = (m.extractBits(9) ^ msb) - msb;
        return signed == -msb ? null : signed; // return null for the special value meaning no data
    }),

    /** 10 bits signed integer. */
    INT_10(m -> {
        final long msb = 0x200l;
        final long signed = (m.extractBits(10) ^ msb) - msb;
        return signed == -msb ? null : signed; // return null for the special value meaning no data
    }),

    /** 11 bits signed integer. */
    INT_11(m -> {
        final long msb = 0x400l;
        final long signed = (m.extractBits(11) ^ msb) - msb;
        return signed == -msb ? null : signed; // return null for the special value meaning no data
    }),

    /** 14 bits signed integer. */
    INT_14(m -> {
        final long msb = 0x2000l;
        final long signed = (m.extractBits(14) ^ msb) - msb;
        return signed == -msb ? null : signed; // return null for the special value meaning no data
    }),

    /** 15 bits signed integer. */
    INT_15(m -> {
        final long msb = 0x4000l;
        final long signed = (m.extractBits(15) ^ msb) - msb;
        return signed == -msb ? null : signed; // return null for the special value meaning no data
    }),

    /** 16 bits signed integer. */
    INT_16(m -> {
        final long msb    = 0x8000l;
        final long signed = (m.extractBits(16) ^ msb) - msb;
        return signed == -msb ? null : signed; // return null for the special value meaning no data
    }),

    /** 17 bits signed integer. */
    INT_17(m -> {
        final long msb    = 0x10000l;
        final long signed = (m.extractBits(17) ^ msb) - msb;
        return signed == -msb ? null : signed; // return null for the special value meaning no data
    }),

    /** 18 bits signed integer. */
    INT_18(m -> {
        final long msb    = 0x20000l;
        final long signed = (m.extractBits(18) ^ msb) - msb;
        return signed == -msb ? null : signed; // return null for the special value meaning no data
    }),

    /** 19 bits signed integer. */
    INT_19(m -> {
        final long msb    = 0x40000l;
        final long signed = (m.extractBits(19) ^ msb) - msb;
        return signed == -msb ? null : signed; // return null for the special value meaning no data
    }),

    /** 20 bits signed integer. */
    INT_20(m -> {
        final long msb    = 0x80000l;
        final long signed = (m.extractBits(20) ^ msb) - msb;
        return signed == -msb ? null : signed; // return null for the special value meaning no data
    }),

    /** 21 bits signed integer. */
    INT_21(m -> {
        final long msb    = 0x100000l;
        final long signed = (m.extractBits(21) ^ msb) - msb;
        return signed == -msb ? null : signed; // return null for the special value meaning no data
    }),

    /** 22 bits signed integer. */
    INT_22(m -> {
        final long msb    = 0x200000l;
        final long signed = (m.extractBits(22) ^ msb) - msb;
        return signed == -msb ? null : signed; // return null for the special value meaning no data
    }),

    /** 23 bits signed integer. */
    INT_23(m -> {
        final long msb    = 0x400000l;
        final long signed = (m.extractBits(23) ^ msb) - msb;
        return signed == -msb ? null : signed; // return null for the special value meaning no data
    }),

    /** 24 bits signed integer. */
    INT_24(m -> {
        final long msb    = 0x800000l;
        final long signed = (m.extractBits(24) ^ msb) - msb;
        return signed == -msb ? null : signed; // return null for the special value meaning no data
    }),

    /** 25 bits signed integer. */
    INT_25(m -> {
        final long msb    = 0x1000000l;
        final long signed = (m.extractBits(25) ^ msb) - msb;
        return signed == -msb ? null : signed; // return null for the special value meaning no data
    }),

    /** 26 bits signed integer. */
    INT_26(m -> {
        final long msb    = 0x2000000l;
        final long signed = (m.extractBits(26) ^ msb) - msb;
        return signed == -msb ? null : signed; // return null for the special value meaning no data
    }),

    /** 27 bits signed integer. */
    INT_27(m -> {
        final long msb    = 0x4000000l;
        final long signed = (m.extractBits(27) ^ msb) - msb;
        return signed == -msb ? null : signed; // return null for the special value meaning no data
    }),

    /** 30 bits signed integer. */
    INT_30(m -> {
        final long msb    = 0x20000000l;
        final long signed = (m.extractBits(30) ^ msb) - msb;
        return signed == -msb ? null : signed; // return null for the special value meaning no data
    }),

    /** 31 bits signed integer. */
    INT_31(m -> {
        final long msb    = 0x40000000l;
        final long signed = (m.extractBits(31) ^ msb) - msb;
        return signed == -msb ? null : signed; // return null for the special value meaning no data
    }),

    /** 32 bits signed integer. */
    INT_32(m -> {
        final long msb    = 0x80000000l;
        final long signed = (m.extractBits(32) ^ msb) - msb;
        return signed == -msb ? null : signed; // return null for the special value meaning no data
    }),

    /** 34 bits signed integer. */
    INT_34(m -> {
        final long msb    = 0x200000000l;
        final long signed = (m.extractBits(34) ^ msb) - msb;
        return signed == -msb ? null : signed; // return null for the special value meaning no data
    }),

    /** 35 bits signed integer. */
    INT_35(m -> {
        final long msb    = 0x400000000l;
        final long signed = (m.extractBits(35) ^ msb) - msb;
        return signed == -msb ? null : signed; // return null for the special value meaning no data
    }),

    /** 38 bits signed integer. */
    INT_38(m -> {
        final long msb = 0x2000000000l;
        final long signed = (m.extractBits(38) ^ msb) - msb;
        return signed == -msb ? null : signed; // return null for the special value meaning no data
    }),

    /** 2 bits unsigned integer. */
    U_INT_2(m -> m.extractBits(2)),

    /** 3 bits unsigned integer. */
    U_INT_3(m -> m.extractBits(3)),

    /** 4 bits unsigned integer. */
    U_INT_4(m -> m.extractBits(4)),

    /** 5 bits unsigned integer. */
    U_INT_5(m -> m.extractBits(5)),

    /** 6 bits unsigned integer. */
    U_INT_6(m -> m.extractBits(6)),

    /** 7 bits unsigned integer. */
    U_INT_7(m -> m.extractBits(7)),

    /** 8 bits unsigned integer. */
    U_INT_8(m -> m.extractBits(8)),

    /** 9 bits unsigned integer. */
    U_INT_9(m -> m.extractBits(9)),

    /** 10 bits unsigned integer. */
    U_INT_10(m -> m.extractBits(10)),

    /** 11 bits unsigned integer. */
    U_INT_11(m -> m.extractBits(11)),

    /** 12 bits unsigned integer. */
    U_INT_12(m -> m.extractBits(12)),

    /** 13 bits unsigned integer. */
    U_INT_13(m -> m.extractBits(13)),

    /** 14 bits unsigned integer. */
    U_INT_14(m -> m.extractBits(14)),

    /** 16 bits unsigned integer. */
    U_INT_16(m -> m.extractBits(16)),

    /** 17 bits unsigned integer. */
    U_INT_17(m -> m.extractBits(17)),

    /** 18 bits unsigned integer. */
    U_INT_18(m -> m.extractBits(18)),

    /** 20 bits unsigned integer. */
    U_INT_20(m -> m.extractBits(20)),

    /** 23 bits unsigned integer. */
    U_INT_23(m -> m.extractBits(23)),

    /** 24 bits unsigned integer. */
    U_INT_24(m -> m.extractBits(24)),

    /** 25 bits unsigned integer. */
    U_INT_25(m -> m.extractBits(25)),

    /** 26 bits unsigned integer. */
    U_INT_26(m -> m.extractBits(26)),

    /** 27 bits unsigned integer. */
    U_INT_27(m -> m.extractBits(27)),

    /** 30 bits unsigned integer. */
    U_INT_30(m -> m.extractBits(30)),

    /** 32 bits unsigned integer. */
    U_INT_32(m -> m.extractBits(32)),

    /** 35 bits unsigned integer. */
    U_INT_35(m -> m.extractBits(35)),

    /** 36 bits unsigned integer. */
    U_INT_36(m -> m.extractBits(36)),

    /** 5 bits sign-magnitude integer. */
    INT_S_5(m -> {
        final long data = m.extractBits(5);
        final long mask = -(data >>> 4); // this mask allows avoiding a conditional below
        return (~mask & data) | (mask & (16l - data));
    }),

    /** 11 bits sign-magnitude integer. */
    INT_S_11(m -> {
        final long data = m.extractBits(11);
        final long mask = -(data >>> 10); // this mask allows avoiding a conditional below
        return (~mask & data) | (mask & (1024l - data));
    }),

    /** 22 bits sign-magnitude integer. */
    INT_S_22(m -> {
        final long data = m.extractBits(22);
        final long mask = -(data >>> 21); // this mask allows avoiding a conditional below
        return (~mask & data) | (mask & (2097152l - data));
    }),

    /** 24 bits sign-magnitude integer. */
    INT_S_24(m -> {
        final long data = m.extractBits(24);
        final long mask = -(data >>> 23); // this mask allows avoiding a conditional below
        return (~mask & data) | (mask & (8388608l - data));
    }),

    /** 27 bits sign-magnitude integer. */
    INT_S_27(m -> {
        final long data = m.extractBits(27);
        final long mask = -(data >>> 26); // this mask allows avoiding a conditional below
        return (~mask & data) | (mask & (67108864l - data));
    }),

    /** 32 bits sign-magnitude integer. */
    INT_S_32(m -> {
        final long data = m.extractBits(32);
        final long mask = -(data >>> 31); // this mask allows avoiding a conditional below
        return (~mask & data) | (mask & (2147483648l - data));
    });

    /** Decoding function. */
    private final Function<EncodedMessage, Long> decoder;

    /** Simple constructor.
     * @param decoder decoding function for the data type
     */
    DataType(final Function<EncodedMessage, Long> decoder) {
        this.decoder = decoder;
    }

    /** Decode a piece of data extracted from an encoded message.
     * @param message encoded message providing the bits to decode
     * @return data decoded as a Long object, or null if data not available
     */
    Long decode(final EncodedMessage message) {
        return decoder.apply(message);
    }

}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Podospora caprarum Petr.

### Remarks
null


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Mycologia 38(2): 167 (1946)

#### Original name
Sphaerulina inaequalis Wehm.

### Remarks
null


text:
package ch.hsr.wolski.omc.helper;

public interface IMusicUploader {
	public void onUploadFinished();
}


text:
package httplog

import (
	"fmt"
)

func (httpLogger *internalHttpLogger) Trace(v ...interface{}) {

	msg := fmt.Sprint(v...)
	httpLogger.logs = append(httpLogger.logs, msg)

	httpLogger.logger.Trace(v...)
}

func (httpLogger *internalHttpLogger) Tracef(format string, v ...interface{}) {

	msg := fmt.Sprintf(format, v...)
	httpLogger.logs = append(httpLogger.logs, msg)

	httpLogger.logger.Tracef(format, v...)
}

func (httpLogger *internalHttpLogger) Traceln(v ...interface{}) {

	msg := fmt.Sprintln(v...)
	httpLogger.logs = append(httpLogger.logs, msg)

	httpLogger.logger.Traceln(v...)
}


text:
template <typename G, typename Factor, typename Messages, typename MultiAssignment>
struct SlaveMinimizer {
  private:
    const G& g_;
  public:
    typedef Factor value_type;
    typedef value_type reference;
    typedef typename boost::graph_traits<G>::vertex_descriptor key_type;
    typedef boost::readable_property_map_tag category;
    SlaveMinimizer(const G& g) : g_(g) { }
    reference get(key_type key) const {
      return Factor(*(g_.g_.factorFromNodeId(key)));
    }
};


text:
#ifndef AUDIO_CONTROL_H
#define AUDIO_CONTROL_H

#include "Tools/DataStructures/Printable.h"
#include "Tools/DataStructures/ParameterList.h"

namespace naoth
{
  class AudioControl: public Printable, public ParameterList
  {
  public:
    // controls if audio capture is active or not
    bool capture;

    // parameters for the audio capture
    unsigned int numChannels;
    unsigned int sampleRate;

    // number of samples per channel,
    // i.e., the actual size of the whole buffer is calculated as
    //   buffer_size * numChannels
    unsigned int buffer_size;

    AudioControl();
    virtual void print(std::ostream& stream) const;
  };
}

#endif  /* AUDIO_CONTROL_H */


text:
@extends('layouts.app')

@section('content')

{{ csrf_field() }}

                                    Change Verified ID

                                <form action="#" class="form-horizontal">

                                                    ID
                                                     Username
                                                     Email
                                                     Joined
                                                    Phone verification
                                                    ID verification

                                                @foreach( $userlist as $user )

                                                    {{ $user->id }}
                                                    {{ $user->name }}

                                                         {{ $user->email }}

                                                     {{ $user->created_at }}

                                                        @if ( $user->phone_verify == 0 )
                                                            <input type='checkbox' class='status' id="sms_{{ $user->id }}" prop = "sms" uid = "{{ $user->id }}" name='status'>
                                                        @else
                                                            <input type='checkbox' class='status' id="sms_{{ $user->id }}" prop = "sms" uid = "{{ $user->id }}" name='status' checked>
                                                        @endif

                                                        @if ( $user->id_verify == 0 )
                                                            <input type='checkbox' class='status' id="id_{{ $user->id }}" prop = "id" uid = "{{ $user->id }}" name='status'>
                                                        @else
                                                            <input type='checkbox' class='status' id="id_{{ $user->id }}" prop = "id" uid = "{{ $user->id }}" name='status' checked>
                                                        @endif

                                                @endforeach

                                </form>

@endsection


text:
from ranger.api.commands import Command
import os

class fzf_select(Command):
    """
    :fzf_select

    Find a file using fzf.

    With a prefix argument select only directories.

    See: https://github.com/junegunn/fzf
    """
    def execute(self):
        import subprocess
        if self.quantifier:
            # match only directories
            command="find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \
            -o -type d -print 2> /dev/null | sed 1d | cut -b3- | fzf +m"
        else:
            # match files and directories
            command="find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \
            -o -print 2> /dev/null | sed 1d | cut -b3- | fzf +m"
        fzf = self.fm.execute_command(command, stdout=subprocess.PIPE)
        stdout, stderr = fzf.communicate()
        if fzf.returncode == 0:
            fzf_file = os.path.abspath(stdout.decode('utf-8').rstrip('\n'))
            if os.path.isdir(fzf_file):
                self.fm.cd(fzf_file)
            else:
                self.fm.select_file(fzf_file)

# fzf_locate
class fzf_locate(Command):
    """
    :fzf_locate

    Find a file using fzf.

    With a prefix argument select only directories.

    See: https://github.com/junegunn/fzf
    """
    def execute(self):
        import subprocess
        if self.quantifier:
            command="locate home media | fzf -e -i"
        else:
            command="locate home media | fzf -e -i"
        fzf = self.fm.execute_command(command, stdout=subprocess.PIPE)
        stdout, stderr = fzf.communicate()
        if fzf.returncode == 0:
            fzf_file = os.path.abspath(stdout.decode('utf-8').rstrip('\n'))
            if os.path.isdir(fzf_file):
                self.fm.cd(fzf_file)
            else:
                self.fm.select_file(fzf_file)

class fasd(Command):
    """
    :fasd

    Jump to directory using fasd
    """
    def execute(self):
        import subprocess
        arg = self.rest(1)
        if arg:
            directory = subprocess.check_output(["fasd", "-d"]+arg.split(), universal_newlines=True).strip()
            self.fm.cd(directory)

from ranger.core.loader import CommandLoader

class compress(Command):
    def execute(self):
        """ Compress marked files to current directory """
        cwd = self.fm.thisdir
        marked_files = cwd.get_selection()

        if not marked_files:
            return

        def refresh(_):
            cwd = self.fm.get_directory(original_path)
            cwd.load_content()

        original_path = cwd.path
        parts = self.line.split()
        au_flags = parts[1:]

        descr = "compressing files in: " + os.path.basename(parts[1])
        obj = CommandLoader(args=['apack'] + au_flags + \
                [os.path.relpath(f.path, cwd.path) for f in marked_files], descr=descr)

        obj.signal_bind('after', refresh)
        self.fm.loader.add(obj)

    def tab(self):
        """ Complete with current folder name """

        extension = ['.zip', '.tar.gz', '.rar', '.7z']
        return ['compress ' + os.path.basename(self.fm.thisdir.path) + ext for ext in extension]

import os
from ranger.core.loader import CommandLoader

class extracthere(Command):
    def execute(self):
        """ Extract copied files to current directory """
        copied_files = tuple(self.fm.copy_buffer)

        if not copied_files:
            return

        def refresh(_):
            cwd = self.fm.get_directory(original_path)
            cwd.load_content()

        one_file = copied_files[0]
        cwd = self.fm.thisdir
        original_path = cwd.path
        au_flags = ['-X', cwd.path]
        au_flags += self.line.split()[1:]
        au_flags += ['-e']

        self.fm.copy_buffer.clear()
        self.fm.cut_buffer = False
        if len(copied_files) == 1:
            descr = "extracting: " + os.path.basename(one_file.path)
        else:
            descr = "extracting files from: " + os.path.basename(one_file.dirname)
        """ obj = CommandLoader(args=['aunpack'] + au_flags \ """
        """        + [f.path for f in copied_files], descr=descr) """
        obj = CommandLoader(args=['dtrx'] + [f.path for f in copied_files], descr=descr)

        obj.signal_bind('after', refresh)
        self.fm.loader.add(obj)


text:
package com.tc.websocket.valueobjects;

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class Prompt implements IPrompt {

	public static final String EXCEPTION="EXCEPTION";
	public static final String INFO="INFO";
	public static final String WARNING="WARNING";

	private String message;

	private String title;

	/* (non-Javadoc)
	 * @see com.tc.apn.push.service.rest.IPrompt#getMessage()
	 */
	public String getMessage() {
		return message;
	}
	/* (non-Javadoc)
	 * @see com.tc.apn.push.service.rest.IPrompt#setMessage(java.lang.String)
	 */
	public void setMessage(String message) {
		this.message = message;
	}
	/* (non-Javadoc)
	 * @see com.tc.apn.push.service.rest.IPrompt#getTitle()
	 */
	public String getTitle() {
		return title;
	}
	/* (non-Javadoc)
	 * @see com.tc.apn.push.service.rest.IPrompt#setTitle(java.lang.String)
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/* (non-Javadoc)
	 * @see com.tc.apn.push.service.rest.IPrompt#setMessage(java.lang.String, java.lang.String)
	 */
	public void setMessage(String title, String message){
		this.title=title;
		this.message = message;
	}

}


text:
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace FCT.LLC.BusinessService.Entities
{
    public partial class tblLenderSchemaField
    {
        public tblLenderSchemaField()
        {
            tblLenderSchemaFieldsDescriptions = new HashSet<tblLenderSchemaFieldsDescription>();
        }

        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        public int SchemaFieldID { get; set; }

        [Required]
        [StringLength(1000)]
        public string SchemaFieldName { get; set; }

        [StringLength(1000)]
        public string LawyerSchemaField { get; set; }

        public bool? IsShared { get; set; }

        public virtual ICollection<tblLenderSchemaFieldsDescription> tblLenderSchemaFieldsDescriptions { get; set; }
    }
}


text:
import React from 'react';
export default ( props ) => <button className={ `btn btn-default btn-block ${props.className || ''}` } onClick={ props.onClick }>{ props.text }</button>;


text:
layout: post
title:  "Joining Netflix"
date:   2017-01-01 11:00
categories: personal
comments: true
---

2017 just got started, and it's already an exciting year.
Next week I will relocate to the bay area and join Netflix as part of the Edge Developer Experience team.
I'm super excited about this step and can't wait to get started.
The Edge DevExp team is responsible for providing the tools and infrastructure for developers connecting to the Netflix API [1].

This also means I'm leaving Luminis Technologies, where I spent a little over five years. Luminis has been a great place to work. Looking back at the past five years I worked on some interesting projects like [Cloud RTI](http://cloud-rti.com), several open source projects and I wrote 1,5 book for O'Reilly (the second one still in progress, and will be published in 2017). Additionally I experienced working from home full time, which I wrote about in more detail [here](http://paulbakker.io/personal/working-from-home/).

Netflix is almost the defacto example for scale and distributed architecture in our field, and I'm really looking forward to work for a company that pushes technology as much as they do.
My new role is again very developer oriented, which is really my passion.

[1] [Edge Insights](http://www.slideshare.net/SangeetaNarayanan/engineering-leader-edge-insights-netflix)