text:
---
title:  How to Build Realtime Apps with GraphQL Subscriptions
description: "Follow along as we build slackr, a realtime messaging app complete with social authentication."
date:   2016-11-10 00:00:00 -0700
categories:
photo: "https://assets.scaphold.io/tutorials/slackr/slackr.gif"
headshot: "https://assets.scaphold.io/images/mike.jpg"
author: "Michael Paris"
---

## The Case for Subscriptions

When Facebook open-sourced GraphQL, they described how applications can perform reads with queries, and writes with mutations. However, often times clients want to get pushed updates from the server when data they care about changes. Enter GraphQL Subscriptions. Subscriptions make real-time functionality a first class citizen in GraphQL!

Subscriptions offer a clean and efficient way to get pushed updates in realtime. They act in parallel to mutations. Just like how mutations describe the set of actions you can take to change your data, subscriptions define the set of events that you can subscribe to when data changes. In fact, you can think of subscriptions as a way to react to mutations that are performed on your server.

For example, think about a chat application like **Slack**. To create a good user experience, our application needs to stay up to date at all times. I.E. when a co-worker sends me a message, I shouldn't have to refresh the page to see the message. A much better solution is to have the server push my chat client the message as soon as it is created. This is how Subscriptions work. When someone creates a message (or in other words issues a mutation), the server immediately pushes the data to every client that is also subscribed to that event.

To build an app like Slack, we need to be able to say:

!!! quote

    Hey, every time someone posts a new message to a channel I am a member of, tell me!

With subscriptions we can do this by issuing a query like this:

```
subscription SubscribeToNewMessage($messageFilter: MessageWhereArgs) {
    subscribeToMessage(mutations:[createMessage], filter: $messageFilter) {
        mutation
        value {
            id
            content
        }
    }
}
```

For now, don't worry too much about the input arguments but just note that we can choose which mutations we would like to subscribe to as well as supply certain filters so that we only get pushed updates for the data we care about.

Now, every time another user calls a mutation like this:

```
mutation CreateMessage($message: CreateMessageInput!) {
    createMessage(input: $message) {
        changedMessage {
            id
            content
        }
    }
}
```

Every subscribed client will be pushed an update as long as the new message satisfies the filter it used to first subscribe! It's that easy!

## This Tutorial (TLDR)

Throughout this post, we are going to take a **practical dive into GraphQL subscriptions and build a simple chat application**. To do this we will be building a React application in the spirit of Slack that we are going to call **Slackr**. Our application will come complete with realtime messaging and social authentication. Although, we will be using React for demonstration purposes, Apollo Client and subscriptions will work with basically any Javascript frontend so I will do my best to keep the code snippets in this post as unopinionated as possible.

We are going to use [**Scaphold.io**](https://scaphold.io) as our backend provider because we can get a powerful, realtime GraphQL API in a matter of minutes (less than 4 minutes to be exact) when it could take weeks to build and deploy our own. If you are interested in how subscriptions are implemented on the backend I will be following up this post with a server-side technical review of how we implemented subscriptions on our servers.

Check out slackr!

![](https://assets.scaphold.io/tutorials/slackr/slackr.gif)

##### Get the code on Github
If you would like to follow along, our [**Slackr** Starter Kit is available on Github](https://github.com/scaphold-io/slackr-graphql-subscriptions-starter-kit). We will only be looking at snippets from that repo so take a peek if you'd like to see the whole picture.

## Getting Started

#### We're happy to announce that subscriptions are now available for all Scaphold Apps!

We have worked closely with the Apollo Team to remove all the friction from building realtime applications using GraphQL! Here is quick guide on how you can easily start building realtime apps **for free** using Apollo Client and Scaphold.io!

1) Go to Scaphold.io and create a free app!

2) That's it!

Okay so it really is that easy, but let's make things a little more interesting!

Let's create a data model for our Slackr app!

#### Design our Data Model

This is one area where Scaphold excels over previous realtime BaaS offerings like Firebase. Although Firebase has powerful primitives for building realtime apps, they lack the ability to define powerful data models. Our use of GraphQL allows us to provides the best of both worlds. By leveraging GraphQL, we can provide millisecond subscription latencies for simple queries as well as allow you to define much more complex queries that will be rerun on every update. This can be much more efficient than exising solutions as you can often get all the data you want pushed to you in realtime without having to issue any other requests.

Let's try this out by defining the data model for our **Slackr** app. Our app will be like a dumbed down version of slack. A user can subscribe to any number of public channels and each channel can contain any number of messages each of which has an author.

Here is a simplified version of our data model in GraphQL schema language.

```
type User {
    id: ID!
    username: String!
    nickname: String
    picture: String
    messages: MessageConnection
    channels: ChannelConnection
}

type Message {
    id: ID!
    content: String!
    author: User!
    channel: Channel!
}

type Channel {
    id: ID!
    name: String!
    members: UserConnection
    messages: MessageConnection
}

# Note: A Connection is a paginated relation. This allows us to connect
# arbitrarily large sets of objects with one another
```

To aid you in developing your application's data model, Scaphold comes with a graphical schema designer. As you make changes to your schema, the infrastructure behind the scenes will automatically update to match the new schema. There is a lot you can do with the schema designer including creating Interfaces, Enums, defining permissions, and more. To start, let's just create a few types, add some fields, and create relations between your types via **Connection** fields.

Creating your schema is easy! Here is me doing it!

![](https://assets.scaphold.io/tutorials/slackr/configure2.gif)

**This is what I did**

1) Using the schema designer, create two new types **Message** and **Channel**

2) On the **Channel** type add the fields

- `name` with type `String`.

- `messages` with type `Connection`, ofType `Message`, reverseName `channel`, and cardinality `One to Many`.

- `members` with type `Connection`, ofType `User`, reverseName `channels`, and cardinality `Many To Many`.

- `isPublic` with type `Boolean` and a defaultValue of `false`.

3) On the **Message** type, add the fields

- `content` with type `String`.

- `author` with type `Connection`, ofType `User`, reverseName `messages`, and cardinality `Many To One` with the Many on the Message side.

4) On the **User** type, add the fields:

- `nickname` with type `String`

- `picture` with type `String`

That should do it! As we were poking around and adding types, fields, and relations the infrastrucutre needed to power your app was automatically deployed and configured for your new schema. We have now done all the setup that is necessary to start building our application. To get a feel for what capabilities our new API has in store, let's jump over to GraphiQL to explore our API and prototype some queries.

#### Exploring your API in GraphiQL

As we said earlier, Subscriptions are reactions to mutations made elsewhere. Before diving into building our front-end we can play with our new realtime subscriptions using GraphiQL. Here is what it looks like:

![](http://assets.scaphold.io/tutorials/slackr/subs2.gif)

We first issue a subcription query (seen below) and can then watch as changes are pushed to us from the server whenever we create new messages.

```
subscription SubscribeToNewMessage($messageFilter: MessageWhereArgs) {
    subscribeToNewMessage(mutations:[createMessage], where: $messageFilter) {
        mutation
        value {
            id
            content
            author {
                id
                username
            }
        }
    }
}
```

Notice that this subscription query is slightly different than the subscription query I showed before. See how we are asking for the nested `author` id and username? This is a simple example showing the power that comes from combining realtime data with a structured data model. Not only will our client application receive an update within milliseconds of a new **Message** being created but it will also automatically receive the related `author` of the **Message** without having to issue another request. This is just one example that shows how GraphQL can make your applications not only more efficient but easier to develop.

Under the hood, a websocket connection is being established between our Apollo Client instance and Scaphold's webservers. This connection stays open as long as our subscription is alive and acts as the transport that allows the server to send updates to the client.

The pane that pops out from the right of GraphiQL will show all new messages that satisfy our filter. To see it in action lets call the `createMessage` mutation to create a new **Message** object.

```
mutation CreateMessage($message: CreateMessageInput!) {
    createMessage(input: $message) {
        changedMessage {
            id
            content
        }
    }
}
```

Each time you create a new object that satisfies your subscription filter, you should see a new object appear in the pane to the right! That new message was pushed to us from the server in realtime! Each message should also come with the associated user attached so you can easily present user information alongside the message in your UI!

 It has a bunch of goodies hidden in it so poke around the doc explorer to see what it has to offer! For starters, we've generated a GraphQL Subscription for each type that you have in your data model.

### Connecting to your API from your application

The Scaphold GraphiQL page has already implemented the subscription protocol for you. The good news is that it is really easy to set this up in your own application. Here is how.

1) Download Apollo Client from npm! (Apollo Client works pretty much the same whether you are building a React, AngularJS, or vanilla JavaScript applications)

- `npm install apollo-client graphql-tag --save`

- If using React also `npm install react-apollo --save`

- If using Angular2 also `npm install angular2-apollo --save`

2) Configure the Apollo Client network layer to work with websockets. To do this we can use the following two code snippets:

```
/* File: addGraphQLSubscriptions.js */

import { print } from 'graphql-tag/printer';

// quick way to add the subscribe and unsubscribe functions to the network interface
export default function addGraphQLSubscriptions(networkInterface, wsClient) {
  return Object.assign(networkInterface, {
    subscribe(request, handler) {
      return wsClient.subscribe({
        query: print(request.query),
        variables: request.variables,
      }, handler);
    },
    unsubscribe(id) {
      wsClient.unsubscribe(id);
    },
  });
}

/* End of file: addGraphQLSubscriptions.js */
```

The `addGraphQLSubscriptions` function retrofits the Apollo Client network interface with the subscribe and unsubscribe methods that we can use from our application code.

```
/* File: makeApolloClient.js */

import addGraphQLSubscriptions from './addGraphQLSubscriptions';
import ApolloClient, { createNetworkInterface } from 'apollo-client';
import { Client } from 'subscriptions-transport-ws';

// creates a subscription ready Apollo Client instance
export function makeApolloClient() {
  const scapholdUrl = 'v2.api.scaphold.io/graphql/my-awesome-app';
  const graphqlUrl = `https://${scapholdUrl}`;
  const websocketUrl = `wss://${scapholdUrl}`;
  const networkInterface = createNetworkInterface(graphqlUrl);
  networkInterface.use([{
    applyMiddleware(req, next) {
      // Easy way to add authorization headers for every request
      if (!req.options.headers) {
        req.options.headers = {};  // Create the header object if needed.
      }
      if (localStorage.getItem('scaphold_user_token')) {
        // This is how to authorize users using http auth headers
        req.options.headers.Authorization = `Bearer ${localStorage.getItem('scaphold_user_token')}`;
      }
      next();
    },
  }]);
  const wsClient = new Client(websocketUrl);
  const networkInterfaceWithSubscriptions = addGraphQLSubscriptions(networkInterface, wsClient);

  const clientGraphql = new ApolloClient({
    networkInterface: networkInterfaceWithSubscriptions,
    initialState: {},
  });
  return clientGraphql;
}
/* End of File: makeApolloClient.js */
```

The `makeApolloClient` function then creates a new Apollo Client instance, applies the subscription methods, and adds a peice of authentication middleware before returning the client for use in our application.

This is all we need to do to configure our Apollo Client instance for subscriptions.

### Using subscriptions from vanilla js

Using subscriptions from our application could not be much simpler. At Scaphold, we build our user interfaces with React, but Apollo Client works with any javascript frontend. Here is an unopinionated example.

```
import makeApolloClient from './makeApolloClient';

// Make our apollo client instance
const client = makeApolloClient();

// Our subscription query
const subscriptionQuery = `
subscription SubscribeToNewMessage($messageFilter: MessageWhereArgs) {
    subscribeToNewMessage(mutations:[createMessage], where: $messageFilter) {
        mutation
        value {
            id
            content
        }
    }
}
`;

// Our subscription filter
const vars = {
  messageFilter: {
    content: {
      channelId: {
        eq: 'AChannelId'
      }
    }
  }
};

// Initiate the subscription observable
const subscriptionObservable = client.subscribe({
  query: subscriptionQuery,
  variables: vars,
});

// Use observable.subscribe to handle new data pushed from the server and errors.
const messageSubscription = subscriptionObservable.subscribe({
  next(newObj) {
    console.log('Received new data');
    // Merge the new data with our client side data cache. See Below *
  },
  error(err) {
    console.log(`Error Subscribing: ${err.message}`);
  },
});
```

First you can see that we have provided a GraphQL query and variables to Apollo's GraphQL function to initiate the subscription. In this case we are only interested in new posts that belong to the channel with id 'MyChannelId'. In reality, the `channelId` would be a base64 encoded string created automatically when you create a **Channel** but this works for demonstration purposes. If you take a look in the doc explorer you will see that in addition to the `eq` operator, you can specify a list of channel ids to include or exclude using the `in` and `notIn` operators.

> Note: The above example uses the default `subscribe` method to listen for updates. There is also a higher-level, `subscribeToMore` method that manages more for us. E.G. it will keep track of open subscriptions and automatically close them for us. It also allows you to pass in a `updateQuery` function that lets you define how you would like to merge the new data with the cache.

##### Merging changes with the client side cache

An important topic to discuss when it comes to subscriptions is how to merge new data pushed from the server with the client side cache. There are many ways to do this and it often changes from application to application. At Scaphold, we use [ImmutableJS](https://facebook.github.io/immutable-js/) data structures and [redux](http://redux.js.org/) alongside the Apollo Client managed cache but this is largely up to you.

Apollo Client does a lot really nice things for you that can mostly eliminate the need to do any custom work. The key to merging changes with the Apollo cache is the `updateQuery` method passed to `subscribeToMore`. To see an example of this let's take a snippet from our **Slackr** React application.

### Using Subscriptions from React

Let's look at a more real world example using react. Apollo comes packed with really nice react-binding that we can use to simplify the process of subscribing to data and merging new data into the client side cache.

Here is a condensed example from our Slackr app.

[See the complete code on GitHub](https://github.com/scaphold-io/slackr-graphql-subscriptions-starter-kit/blob/master/src/components/messages.jsx)

```
import React from 'react';
import { graphql, compose } from 'react-apollo';
import gql from 'graphql-tag';

const ChannelMessagesQuery = gql`
query GetPublicChannels($channelId: ID!, $messageOrder: [MessageOrderByArgs]) {
  getChannel(id: $channelId) {
    id
    name
    messages(last: 50, orderBy: $messageOrder) {
      edges {
        node {
          id
          content
          createdAt
          author {
            id
            username
            nickname
            picture
          }
        }
      }
    }
  }
}
`;

class Messages extends React.Component {

    ...

    componentWillReceiveProps(newProps) {
        if (
            !newProps.data.loading &&
            newProps.data.getChannel
        ) {
            if (
                !this.props.data.getChannel ||
                newProps.data.getChannel.id !== this.props.data.getChannel.id
            ) {
                // If we change channels, subscribe to the new channel
                this.subscribeToNewMessages();
            }
        }
    }

    /*
    *   Initiates the subscription and specifies how new data should be merged
    *   into the cache using the updateQuery method.
    */
    subscribeToNewMessages() {
        this.subscription = this.props.data.subscribeToMore({
            document: gql`
                subscription newMessages($subscriptionFilter:MessageSubscriptionFilter) {
                    subscribeToMessage(mutations:[createMessage], filter: $subscriptionFilter) {
                        value {
                            id
                            content
                            createdAt
                            author {
                                id
                                username
                                nickname
                                picture
                            }
                        }
                    }
                }
            `,
            variables: {
                subscriptionFilter: {
                    channelId: {
                        // We're using react-router and grabbing the channelId from the url
                        // to designate which channel to subscribe to
                        eq: this.props.params ? this.props.params.channelId : null
                    }
                }
            },

            /*
            *    Update query specifies how the new data should be merged
            *    with our previous results. Note how the structure of the
            *    object we return here directly matches the structure of
            *    the GetPublicChannels query.
            */
            updateQuery: (prev, { subscriptionData }) => {
                const newEdges = [
                    ...prev.getChannel.messages.edges,
                    {
                        node: {
                            ...subscriptionData.data.subscribeToMessage.value,
                        }
                    }
                ];
                return {
                    getChannel: {
                        messages: {
                            edges: newEdges,
                        }
                    }
                };
            },
        });
    }

    ...
}

const MessagesWithData = compose(
  graphql(ChannelMessagesQuery, {
    options: (props) => {
      const channelId = props.params ? props.params.channelId : null;
      return {
        returnPartialData: true,
        variables: {
          channelId,
          messageOrder: [
            {
              field: 'createdAt',
              direction: 'ASC'
            }
          ],
        },
      };
    },
  }),
  ... // We compose a few more queries in the actual app.
)(Messages);

export default MessagesWithData;

```

A few things are going on here. To make sense of what is happening, let's start from the logical beginning which actually occurs at the end of the file. See this line `const MessagesWithData = compose(graphql(ChannelMessagesQuery, ...));` towards the bottom of the snippet? This is the standard way to use Apollo to connect a React component with data from a GraphQL query. The `graphql` function will wrap our component in a higher-order component that grabs our data and makes it available to our component via its `props`. In this example, we will be able to access our **Channel** data from our component with `this.props.data.getChannel` as soon as it is fetched.

> Note: The `returnPartialData: true` option is important. When you want to use `subscribeToMore` to merge results into the result of a normal query it is necessary to specify this.

Okay so we have connected our component with a regular old GraphQL query, but how do we make it realtime? The key is the method `subscribeToMore`.  Look at our `subscribeToNewMessages` method. Apollo's `graphql` function fits our component with the data prop that exposes the `subscribeToMore` method. We use this method to attach a subscription query which then calls the `updateQuery` method we pass in every time a new peice of data is pushed from the server. The object we return from `updateQuery` is then merged with our previous results and persisted in the client side cache. This way, `this.props.data.getChannel...` is always kept up to date and we can use it like normal to render our UI.

Take a minute to look over this file. Apollo does a great job allowing us to use realtime subscriptions alongside traditional queries and mutations. The combination of `subscribeToMore` and `updateQuery` offer a powerful set of tools to keep our UI up to date when dealing with realtime data!

## User Authentication

We have now covered the basics of how to use GraphQL subscriptions from both vanilla JS as well as React. We're now ready to finish up the surface area of our application! One of the nice things Scaphold does for you is handling user authentication. There is also an auth0 integration that lets you easily add social auth to any application instantly. In our Slackr app, we have enabled GitHub login so user's can easily chime in on our app without having to create any messy usernames or password.

Authentication with a Scaphold API is done via the `Authorization` http header. We use [JSON Web Tokens](https://jwt.io/) to securely authenticate your users and have integrations that allow you to pull in the auth provider of your choice. You've actually already seen how to add authentication to Apollo Client.

Remember this from makeApolloClient.js?

```javascript
/* File: makeApolloClient.js */
const networkInterface = createNetworkInterface(graphqlUrl);
networkInterface.use([{
    applyMiddleware(req, next) {
        // Easy way to add authorization headers for every request
        if (!req.options.headers) {
            req.options.headers = {};  // Create the header object if needed.
        }
        if (localStorage.getItem('scaphold_user_token')) {
            // This is how to authorize users using http auth headers
            req.options.headers.Authorization = `Bearer ${localStorage.getItem('scaphold_user_token')}`;
        }
        next();
    },
}]);
```

This auth middleware looks for a token names 'scaphold_user_token' in the browser's local storage and then appends the necessary auth header to each request. This is great because all we need to do is pick a authentication mechanism and then save the token we get back from logging in to local storage and the middleware will handle the rest.

#### Social authentication for any application

**Slackr** uses Auth0 lock for easy authentication. To make this work, we must first add the Auth0 integration to our API on Scaphold. It's easy!

1) Go to [Auth0](https://auth0.com) and create a free account.

2) Under the Social connections tab on the left, enable GitHub as an oauth provider.
    - You will need to create a GitHub application to get the clientId and secret to give to Auth0.

3) From the clients tab on the left in Auth0, open your application and grab your Auth0 clientId and client secret.

4) Go to Scaphold's integrations page and enter the clientId and client secret in a new Auth0 integration.

5) Presto chango, your API is now ready to handle social authentication!

One easy way to add authentication to your client app is by using Auth0 Lock. Lock is essentially a smart sign-in form that you can drop into any web or mobile application. You use Lock to handle the OAuth and then you can link the social credential with Scaphold's API using the `loginWithAuth0Lock` mutation that is now available in your API.

For a full example of how to do this take a look at [auth.js](https://github.com/scaphold-io/slackr-graphql-subscriptions-starter-kit/blob/master/src/utilities/auth.js) and [channels.jsx](https://github.com/scaphold-io/slackr-graphql-subscriptions-starter-kit/blob/master/src/components/channels.jsx) in our **Slackr** app starter kit.

The login flow is simple. First we open lock, the user then enters his or her credentials or chooses from a set of social auth providers, and then Lock handles the OAuth handshake and returns a login credential. We then make one more call to Auth0 to grab the auth0 profile and then we send the auth0 user identity to Scaphold's servers where it is then matched with a Scaphold user. As part of the `loginWithAuth0Lock` mutation payload, Scaphold will return the auth token that is to be stored in local storage on the client and attached to http requests as the Authorization header by the Apollo Client auth middleware.

## Wrapping Up

Congrats! Now you've seen how you can use Scaphold, Apollo, and GraphQL subscriptions to build realtime, real-world applications in a fraction of the time it used to. To review what we did, we...

1. Defined our applications data model using Scaphold's Graphical Schema Designer and a realtime GraphQL API was automatically configured and deployed for us.

2. As soon as we finished designing our schema, we jumped over to GraphiQL to prototype our subscriptions query and saw data pushed to us in realitme.

3. We discussed how you can easily add realtime subscriptions to you own application using Apollo Client.

4. Last, we added social authentication to our API via the Auth0 Integration to allow our users to login via GitHub.

This is a great start but there is still alot we could do. We could start by adding permissions to our data for fine-grained access control which would allow us to create private channels. We could also instantly add iOS and Android push notifications so that we can alert our users when our application is closed. Stay tuned for more updates as more features come out daily!

Happy Scapholding!

repository: tkingUA/scaphold-docs

repo_name: tkingUA/scaphold-docs


text:
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
# CurrencyField
A subclass of UITextField for currency input. Written in Swift.

## Features

 - Exposes a `value` property (of type `Decimal?`) that reflects the current text value
 - Updating `value` will also set the text
 - Validates input so that only changes that result in valid 'currency' or 'decimal' strings are allowed
 - Defaults the keyboard type to `.decimalPad`
 - Formats the text to a localised currency string when the field resigns first responder

## Installation

### Carthage

[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage via [Homebrew](https://brew.sh):

    $ brew update
    $ brew install carthage

To integrate CurrencyField into your Xcode project using Carthage, specify it in your Cartfile:

    github "tebs1200/swift-currency-field" ~> 0.8

Run `carthage update` to build the framework and drag the built CurrencyField.framework into your Xcode project.

license: MIT

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
> WARNING: This repository has been replaced with a kubernetes version stored in [OasisPlatform/kubernetes/worker-controller](https://github.com/OasisLMF/OasisPlatform/tree/platform-2.0/kubernetes/worker-controller)

# Oasis worker controller

This is an example of how you can control workers in your oasis deployment.

The process connects to the websocket in the api and monitors it for changes
in the queue utilization.

In this example we monitor the socket and as the number of queued tasks increase
we create a new container to process that queue. When the number of queues and
pending tasks decrease the task worker containers are stopped.

## Installation

Running the controller requires docker compose:

    $ pip install docker-compose

## Building the image

You can build the image using:

    $ docker-compose build

## Running the controller

The docker compose config takes a set of local environment variables and passes
them into the controller. These are:

| Name | Description | Default |
|------|-------------|---------|
| `OASIS_API_HOST` | The hostname and port of the oasisi api endpoint | `localhost:8000` |
| `OASIS_BROKER_URL` | The url for the celery broker | `amqp://rabbit:rabbit@localhost:5672` |
| `OASIS_ADMIN_USER` | The username of the user to use for authentication against the api | `admin` |
| `OASIS_ADMIN_PASS` | The password of the user to use for authentication against the api | `password` |
| `DOCKER_SOCKET_LOCATION` | The location of the docker socket to mount in the container | `/var/run/docker.sock` |
| `OASIS_MODEL_DATA_DIR` | The absolute path to the PiWind data on the host machine | |
| `OASIS_MEDIA_ROOT` | The absolute path to the shared filesystem on the host machine | |

The docker container created by `docker-compose` and the created containers will
be on the `host` network so any reference to `localhost` will refer to the host
machine.

## License

The code in this project is licensed under BSD 3-clause license.

repository: OasisLMF/OasisWorkerController

gha_language: Python

repo_name: OasisLMF/OasisWorkerController


text:
---
author: gep13
comments: true
date: 2011-11-17 11:59:00+00:00
layout: post
slug: calling-all-scottish-mountain-bikers
title: Calling all Scottish Mountain Bikers
wordpress_id: 431
categories:
- General Web
tags:
- Mountain Biking
- MTB
- Trails
---

A friend of mine has started a new website dedicated to Mountain Biking in Scotland.  The site is called MTB Trails, and you can find it [here](http://www.mtbtrails.info/).  Full information about what the site is for, and it’s objectives can be found [here](http://www.mtbtrails.info/About.aspx).

If you are at all interested in Mountain Biking, I would highly recommend that you check it out!

[![image](http://www.gep13.co.uk/blog/wp-content/uploads/2011/11/image_thumb.png)](http://www.mtbtrails.info/Default.aspx)

branch_name: refs/heads/source

extension: markdown

gha_language: CSS


text:
# Advent of Code 2015

🎅🎄
Aoc15 is my take on [AoC15](https://adventofcode.com/2015/) problems.

## Progress

This is the progress of how am I doing:

* :white_medium_square: - The day not yet completed.
* :star: - Part one completed.
* :star2: - Part two completed.

| Day | Status |
| --- | :---: |
| [Day 1: Not Quite Lisp](https://adventofcode.com/2015/day/1) | :star2: |
| [Day 2: I Was Told There Would Be No Math](https://adventofcode.com/2015/day/2) | :star2: |
| [Day 3: Perfectly Spherical Houses in a Vacuum](https://adventofcode.com/2015/day/3) | :star2: |
| [Day 4: The Ideal Stocking Stuffer](https://adventofcode.com/2015/day/4)| :star2: |
| [Day 5: Doesn't He Have Intern-Elves For This?](https://adventofcode.com/2015/day/5)| :star2:  |
| [Day 6: Probably a Fire Hazard](https://adventofcode.com/2015/day/6)| :star2: |
| [Day 7: Some Assembly Required](https://adventofcode.com/2015/day/7)| :star2: |
| [Day 8: Matchsticks](https://adventofcode.com/2015/day/8)| :star2: |
| [Day 9: All in a Single Night](https://adventofcode.com/2015/day/9)| :star2: |
| [Day 10: Elves Look, Elves Say](https://adventofcode.com/2015/day/10)| :star2: |
| [Day 11: Corporate Policy](https://adventofcode.com/2015/day/11)| :white_medium_square: |
| [Day 12: JSAbacusFramework.io](https://adventofcode.com/2015/day/12)| :white_medium_square: |
| [Day 13: Knights of the Dinner Table](https://adventofcode.com/2015/day/13)| :white_medium_square: |
| [Day 14: Reindeer Olympics](https://adventofcode.com/2015/day/14)| :white_medium_square: |
| [Day 15: Science for Hungry People](https://adventofcode.com/2015/day/15)| :white_medium_square: |
| [Day 16: Aunt Sue](https://adventofcode.com/2015/day/16)| :white_medium_square: |
| [Day 17: No Such Thing as Too Much](https://adventofcode.com/2015/day/17)| :white_medium_square: |
| [Day 18: Like a GIF For Your Yard](https://adventofcode.com/2015/day/18)| :white_medium_square: |
| [Day 19: Medicine for Rudolph](https://adventofcode.com/2015/day/19)| :white_medium_square: |
| [Day 20: Infinite Elves and Infinite Houses](https://adventofcode.com/2015/day/20)| :white_medium_square: |
| [Day 21: RPG Simulator 20XX](https://adventofcode.com/2015/day/21)| :white_medium_square: |
| [Day 22: Wizard Simulator 20XX](https://adventofcode.com/2015/day/22)| :white_medium_square: |
| [Day 23: Opening the Turing Lock](https://adventofcode.com/2015/day/23)| :white_medium_square: |
| [Day 24: It Hangs in the Balance](https://adventofcode.com/2015/day/24)| :white_medium_square: |
| [Day 25: Let It Snow](https://adventofcode.com/2015/day/25)| :white_medium_square: |

## Build

To compile, you must have compiler with c++17 support and cmake version at least 3.10.2.
```console
mkdir build
cd build
cmake ../
make
```

## Test

Running tests is also very simple.
```console
# without compilation
make test

# with compilation
make check
```

## Usage

Project will compile binaries for all days. To solve problems run:
```console
./aoc15 <DAY> <FILE>
```

## Licensing

This project is under the [MIT License](LICENSE.md).


text:
# 02 Types

All input and output fields in the Designer have a type.

The five basic types in the Designer are: String, Number, True/False, Date, and File. When working with input fields and output fields, it’s important to be mindful of types. The type system is what allows or prevents certain behaviors.

The Big List of Types

String

A sequence of characters, wrapped in either single quotes or double quotes.

Example:

`'Free Mars’, “Free Mars”, ‘12345’, “12345”, "", " “`

In the last two examples, “” represents an empty string, and “ “ is a string that contains one character, an empty space.

Number

An integer or decimal.

Example:

`12345, 1, -10, 0.543, 500000`

True/False

The boolean values true and false.

Example:

`true, false`

These values are not strings. They are special keywords that signify a boolean value. A boolean is a variable that can be either true, or false.

In addition to these keywords, both Number and String types can convert to the True/False type within the Designer.

For example, the string ’true’ and the string ‘false’ will both work as input to a True/False input field. The Designer will automatically convert these values to their respective boolean values. Additionally, any non-empty string values will also evaluate to True if used in a True/False input field. Empty strings, however, evaluate to False.

Similarly, the integer 0 and the integer 1 will also work as inputs to True/False. 0 is representative of the Boolean value false, and 1 is representative of the Boolean value true.

Special Types

Beyond these basic types, there are also two special types, List and Object. These types are composites of the other types.

A list is a collection of items. An object is a collection of keys and values, where each value is of a certain type. Unlike lists, objects can contain values of many different types.

A list has the structure:

`[ 'nitrogen', 'oxygen', 'carbon' ]`,

where ‘nitrogen’, ‘oxygen’, and ‘carbon’ represent three items in a list.

An object has the structure:

`{“lastName”: “Russell”, “firstName”: “Saxifrage”}`

In the above example, “lastName” and “firstName” are the keys in the object. The corresponding values are “Russell” and “Saxifrage”.

Items in a list are often represented as contained between brackets []. Similarly, you can distinguish an object by its use of curly braces {}.

**Just My Types**

Type mismatches occur when the Designer expects a certain type but does not receive it. Most of the time, the Designer will prevent you from making these sorts of errors. However, they can occur with more advanced use of the Designer, so it’s important to be mindful of the overall type system.

Both input fields and output fields have a type. However, input fields and output fields both handle types differently.

**Types - Input Fields**
For an input field, if a certain type is specified, the card will try to automatically convert an incoming value to that type. For example, if you were to use the value “4” (which is of type string) as input to a field that was set to the type “Number”, the card will automatically convert this value to the appropriate type, Number.

**Types - Output Fields**
Output fields, however, behave differently. Output fields expect you, the user, to be honest about what they are. If you specify that an output field is of the type “String”, the Designer will expect that the value contained within this output field is a string. In the circumstance that the output field value does not match its type, a type conversion error will be thrown.

Many of the available functions in the Designer already specify both the type of the input field and the output field and do not allow you to change these types. The Designer will often know what type both the inputs and outputs should be. In this circumstance, worrying about types is unnecessary.

However, in circumstances where the Designer doesn’t explicitly know either the input or the output field values, types play a large role.

**03 Functions**
The categories of functions that are currently available in the Designer are: Boolean, Control, Crypto, Date, HTTP, JSON, JWT, List, Math, Object, String, Text Analysis, URL, and XML.

We’ll start by going over a few of the basic functions and
operations available within the Math and String Function categories. Once we have the basics of functions down, we’ll move to the more advanced Function categories, such as List and Object.

You don’t need to memorize what every function does inside the Designer. A function is just a procedure that accepts an input, does something to that input, and then generates an output.

**Fundamentals - Math and String Functions**

**Math Functions**
Functions
	- Add
	- Subtract
	- Multiply
	- Divide

Math functions are used to perform common Math operations, such as **Add**, **Subtract**, **Multiply**, and **Divide**. In addition to these basic functions, there are also other more complex functions available, such as **Factorial**, **Modulo** and **Ceiling**.

	~~Let’s see some of these basic functions in action:~~

~~\\// insert video of adding two numbers together \\//~~

~~This is just a simple example, but many of the other Math function cards operate in the same way: they accept numbers as input and return a numeric output.~~

**String Functions**
- Find
- Substring
- Compose

There are a number of different String functions available for your use, but three of the most important string functions are **Find**, **Substring**, and **Compose**.

**Find** allows you to search for a string inside another string. This can be useful if you’re looking for a specific string (this function will return an output field of “-1” if a string is not found), or only want to return part of a string.

//video of Find

This function goes hand-in-hand with our next function, **Substring**. Substring allows you to extract a value from a string by specifying the starting location of the string and the ending location of the string. These locations are referred to as the ‘starting index’ and the ‘ending index’.

You can think of Substring as grabbing only a very specific section of a string. This may be a word, a character, or a series of words and characters. With Substring, you are grabbing just a slice of another string.

//video of Substring and Find working in tandem

Our last function, **Compose**, is one of the most useful string functions. It allows you to drag-and-drop output fields into a textbox and “compose” new strings from these fields. This is functionally similar to the Concatenate function that is also available.

//video of Compose

**Beyond Fundamentals - Lists and Objects**
Inside the Designer, lists are represented as three output fields stacked diagonally.

In Chapter 2, we were introduced to the list:

[‘nitrogen’, ‘oxygen’, ‘carbon’].

You might expect, if you were to number these items, that ‘nitrogen’ would be at position 1 in the list, ‘oxygen’ at position 2, and ‘carbon’ at position 3. A quirk about lists, though, is that when counting the number of items in a list, we don’t begin at 1; we begin at 0.

So, if we look back to our previous list, the item ‘nitrogen’ is actually at position 0 in our list, ‘oxygen’ is at position 1, and ‘carbon’ is at position 2. A list always begins at position (index) 0. When working with items in a list, it is important to remember this.

**Types of Lists**

In the previous example, we had the list:

`['nitrogen', 'oxygen', 'carbon']`,

This list contains three items. Each item is of the type String. Items that are type String are always wrapped in either single quotes or double quotes.

Two other common types of lists:

`List of Numbers: [2, 4, 6, 8]`

`List of Objects: [{“firstName”: “John”, “lastName”: “Smith”}, {“firstName”: “Taylor”, “lastName”: “Swift”}]`

Every item in a list must be of the same type. You can have lists of Number, String, Date, True/False, and File.

repository: skylerah/dev-azuqua

repo_name: skylerah/dev-azuqua


text:
# Hello Android!

![android_training](https://user-images.githubusercontent.com/47269634/54229797-0f0e0c80-452b-11e9-8d99-fc9439e2665a.jpg)

Hello Android! is a part of Android App Development (AAD) series to help students learn building Android apps on Android Studio. Students will get comfortable with basic Java and XML concepts together with Android architecture.

## How to get started

1. Install Android Studio
Follow this [blog](https://oss2019.github.io/helloandroid_blog.html) to install Android Studio on your pc ( Installation on Windows and Mac Recommended ).

2. Turn on **Developer Option** in your mobile to deploy your app directly on your mobile device. ( Emulator not recommended) Follow this [blog](https://github.com/oss2019/HelloAndroid/blob/master/Running%20the%20app.md) to turn on **Developer Option** on your mobile.

3. Run your first **Hello World** program.
Android Studio provides a **Hello World** project by default when you install it for the first time. Simply deploy the app on your mobile device.
For deploying the app, open android studio and click the app module in the Project window and then select Run > Run (or click Run in the toolbar). In the Select Deployment Target window, select your device, and click OK.


text:
# Computer Design Experiments
After writing a simulator of an Unlimited Register Machine (Shepherdson,
Sturgis 1963) in Python, I thought it might be cool to realize a finite
version of the machine using logic gates. That's what I intend to share
here for now: a simulation of URM in Logisim.

I've tried two architectures: Harvard (separate ROM and RAM) and von Neumann (shared RAM). Pictures of the high-level design (the wires are hidden through ports) follow.

## Harvard Architecture

![Harvard Architecture](images/harvard_arch.png?raw=true "Harvard Architecture")

## Von Neumann Architecture

![Von Neumann Architecture](images/von_neumann_arch.png?raw=true "Von Neumann Architecture")

# Next steps
- share the components and their descriptions
- share the actual logisim files
- realize the machine in an FPGA
- realize the machine using 7400/4000-type logic gates

# Tools
- [Logisim](http://www.cburch.com/logisim)

# References
- Cutland, N.J. (1980) *Computability: An Introduction to Recursive
  Function Theory*.
- Shepherdson, J.C., Sturgis, H.E. (1963) Computability of Recursive Functions

repository: hunan-rostomyan/dl-experiments

repo_name: hunan-rostomyan/dl-experiments


text:
# DateTime

## Concepts

1. Tick
2. TimeTuple

## Modules

1. Time
2. Datetime
3. Pytz
4. Dateutil
5. Calendar

### Time

```python
import time

time.time()
# Gives current time (in number of ticks since 12:00am, January 1, 1970)
```

#### Time a running process

```python
 import time

 start_time = time.time()
 end_time = time.time()
 print("time taken = %4.4f seconds" % (end_time-start_time))

 start = time.perf_counter()
 elapsed = time.perf_counter()- start
    print(f"finished in {elapsed:.02f}s")
```

#### Python Timers (To monitor performance)

- [monotonic()](https://docs.python.org/3/library/time.html#time.monotonic)
- [perf_counter()](https://docs.python.org/3/library/time.html#time.perf_counter)
- [process_time()](https://docs.python.org/3/library/time.html#time.process_time)
- [time()](https://docs.python.org/3/library/time.html#time.time)
- thread_time()

<https://realpython.com/python-timer>

### DateTime

There are two kinds of date and time objects: "naive" and "aware".

- An aware object has sufficient knowledge of applicable algorithmic and political time adjustments, such as time zone and daylight saving time information, to locate itself relative to other aware objects. An aware object is used to represent a specific moment in time that is not open to interpretation

- A naive object does not contain enough information to unambiguously locate itself relative to other date/time objects. Whether a naive object represents Coordinated Universal Time (UTC), local time, or time in some other timezone is purely up to the program, just like it is up to the program whether a particular number represents metres, miles, or mass. Naive objects are easy to understand and to work with, at the cost of ignoring some aspects of reality.

- Class datetime.date
- Class datetime.time
- Class datetime.datetime
- Class datetime.timedelta
- Class datetime.tzinfo
- Class datetime.timezone

Objects of these types are immutable.

Objects of the date type are always naïve

## 2.1. Date Objects

```python
today = date.today()
yesterday = date.today() - timedelta(-1)

# Object calling
datetime.datetime.now().date() # gives today's date
datetime.datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)
datetime.strptime('2020-02-01', '%Y-%m-%d')

cur_date = datetime.today().strftime("%Y-%m-%d %H:%M:%S")
```

## 2.2. Date in ISOFormat

```python
from datetime import datetime

print(datetime.now().isoformat())

'2018-03-07T10:09:40.227229'
```

## strftime format codes

| **Directive** | **Meaning** | **Example** |
|---|---|---|
| %a | Weekday as locale’s abbreviated name. | Sun, Mon, …, Sat (en_US); So, Mo, …, Sa (de_DE) |
| %A | Weekday as locale’s full name. | Sunday, Monday, …, Saturday (en_US); Sonntag, Montag, …, Samstag (de_DE) |
| %w | Weekday as a decimal number, where 0 is Sunday and 6 is Saturday. | 0, 1, …, 6 |
| %d | Day of the month as a zero-padded decimal number. | 01, 02, …, 31 |
| %b | Month as locale’s abbreviated name. | Jan, Feb, …, Dec (en_US); Jan, Feb, …, Dez (de_DE) |
| %B | Month as locale’s full name. | January, February, …, December (en_US); Januar, Februar, …, Dezember (de_DE) |
| %m | Month as a zero-padded decimal number. | 01, 02, …, 12 |
| %y | Year without century as a zero-padded decimal number. | 00, 01, …, 99 |
| %Y | Year with century as a decimal number. | 0001, 0002, …, 2013, 2014, …, 9998, 9999 |
| %H | Hour (24-hour clock) as a zero-padded decimal number. | 00, 01, …, 23 |
| %I | Hour (12-hour clock) as a zero-padded decimal number. | 01, 02, …, 12 |
| %p | Locale’s equivalent of either AM or PM. | AM, PM (en_US); am, pm (de_DE) |
| %M | Minute as a zero-padded decimal number. | 00, 01, …, 59 |
| %S | Second as a zero-padded decimal number. | 00, 01, …, 59 |
| %f | Microsecond as a decimal number, zero-padded on the left. | 000000, 000001, …, 999999 |
| %z | UTC offset in the form±HHMM [SS [.ffffff]](empty string if the object is naive). | (empty), +0000, -0400, +1030, +063415, -030712.345216 |
| %Z | Time zone name (empty string if the object is naive). | (empty), UTC, EST, CST |
| %j | Day of the year as a zero-padded decimal number. | 001, 002, …, 366 |
| %U | Week number of the year (Sunday as the first day of the week) as a zero padded decimal number. All days in a new year preceding the first Sunday are considered to be in week 0. | 00, 01, …, 53 |
| %W | Week number of the year (Monday as the first day of the week) as a decimal number. All days in a new year preceding the first Monday are considered to be in week 0. | 00, 01, …, 53 |
| %c | Locale’s appropriate date and time representation. | Tue Aug 16 21:30:00 1988 (en_US); Di 16 Aug 21:30:00 1988 (de_DE) |
| %x | Locale’s appropriate date representation. | 08/16/88 (None); 08/16/1988 (en_US); 16.08.1988 (de_DE) |
| %X | Locale’s appropriate time representation. | 21:30:00 (en_US); 21:30:00 (de_DE) |
| %% | A literal'%'character. | % |

Several additional directives not required by the C89 standard are included for convenience. These parameters all correspond to ISO 8601 date values.

| **Directive** | **Meaning**                                                                                | **Example**                                  |
|----------|-------------------------------------------|-------------------|
| %G            | ISO 8601 year with century representing the year that contains the greater part of the ISO week (%V).             | 0001, 0002, ..., 2013, 2014, ..., 9998, 9999 |
| %u            | ISO 8601 weekday as a decimal number where 1 is Monday.                                                           | 1, 2, ..., 7                                 |
| %V            | ISO 8601 week as a decimal number with Monday as the first day of the week. Week 01 is the week containing Jan 4. | 01, 02, ..., 53                              |

<https://docs.python.org/3/library/datetime.html>

gha_language: JavaScript

gha_license_id: MIT


text:
WePay-Java-SDK
================================

Note
================================
This WePay-Java-SDK is for WePay API Version 2019-04-03. The jars for the previous API versions can be found in the lib folder. From Dec 13, 2018, the default jar name will include the SDK version.
WePay API Version 2019-04-03 is now supporting 3DS authentication for GBP checkouts and credit card authorize.

Building
================================
```
mvn clean install
```

Overview
================================
To use this SDK, first add the WePay jar (com.wepay.jar) to your project. You'll need to add GSON and JSON jars as well (gson-2.2.4.jar and java-json.jar are also included in the lib folder).

The lib folder contains the jars necessary to use the SDK to make API calls to WePay. The src folder contains all source code used to build the WePay jar (com.wepay.jar). You'll also need to import the necessary classes and packages into your own code.

```java
import com.wepay.WePay;                     // WePay object needed for API initialization
import com.wepay.model.*;                   // contains call classes and all API call functions
import com.wepay.model.data.*;              // contains all data objects needed for making calls
import com.wepay.net.WePayResource;         // network resource used to execute calls
import com.wepay.exception.WePayException;  // handles WePay exceptions
import org.json.*;                          // SDK uses JSON when handling API call parameters
import com.google.gson.*;                   // SDK uses GSON for building objects from API responses
```
Before making actual API calls, you'll need to initialize a new WePay object with your WePay application's client ID, client secret, and whether you want to use the stage environment (true) or the production environment (false).
```java
WePay wepay = new WePay();
wepay.initialize(myClientId, myClientSecret, useStageEnv);
```
Once the WePay object is initialized, you can make all of the API calls described by the documentation on WePay's website. For a full listing of available API calls, visit https://www.wepay.com/developer and explore the API Calls section.

API calls through the Java SDK generally take two arguments, a data object argument and an accessToken argument. For API calls where authorization is needed, you'll need to include the accessToken argument appropriately; for calls that don't require authorization, you can set accessToken to null.

Data objects facilitate the passing of valid parameters to API call classes. Most data objects are designed specifically as parameters to certain types of API calls. Other data objects are utilized by multiple API calls. You can learn what types of data objects are taken as arguments by API call functions in the APICalls.txt file. This file contains a listing of all available API calls available through this SDK, their return types, and which data object parameters each call takes.

You can find examples from all API call classes in the sample_calls folder. Each file in that folder contains an example of each of its available API calls and the effect of that call. You should structure the API calls in your code after these examples. It may also be beneficial to explore the source code in the model and data folders to learn a bit more about the way data objects are used.

You *must* include all *required* parameters to successfully execute API calls. You can also include as many optional parameters as you'd like to the data object before executing the API call. For a full listing of required parameters for each call, visit the API documentation.

The following examples show how to make a few simple API calls and how you can use the returned objects to obtain information. You can find more examples in the sample_calls folder.
```java
// create a new account
AccountData aData = new AccountData();
aData.name = "Test Person";                          // required parameter for this API call
aData.description = "This is an example account";    // required parameter for this API call
aData.type = "personal";                             // optional parameter for this API call
Account newAccount = Account.create(aData, myAccessToken);

// get an accessToken for the new account
OAuth2Data data = new OAuth2Data();
data.redirectUri = "http://www.mywebsite.com/oauth2/";
data.scope = "manage_accounts,collect_payments,view_user,preapprove_payments,send_money";
String sendUserToThisURL = OAuth2.authorize(data, null);
//send user to the returned URL to complete OAuth2 authorization form

//on completion of authorization, user is redirected to redirectUri with a code parameter
//once you have the code you can exchange it for an access token
OAuth2Data data = new OAuth2Data();
data.redirectUri = "http://www.mywebsite.com/oauth2/";
data.code = code;
String userNewAccessToken = OAuth2.token(data, null);

// create a new checkout
CheckoutData cData = new CheckoutData();
cData.accountId = newAccount.getAccountId();       // use a returned object to access information
cData.shortDescription = "Soccer Ball Purchase";
cData.type = "GOODS";
cData.amount = 29.95;
cData.currency = "USD";
Checkout newCheckout = Checkout.create(cData, userNewAccessToken);
```
A demo of the WePay API Java SDK can be found at WeFarm, an online demo marketplace built on the WePay API using this SDK. WeFarm is live online at http://wefarm.herokuapp.com/. You can also find the Java source code for WeFarm at https://github.com/wepay/WeFarm-Java to see how WeFarm uses this SDK to execute WePay API calls.

For further information, visit https://www.wepay.com/developer.

repository: wepay/WePay-Java-SDK

gha_language: Java

repo_name: wepay/WePay-Java-SDK


text:
This option controls how to lengthen the sleeves.

## Effect of this option on the pattern
![This image shows the effect of this option by superimposing several variants that have a different value for this option](yuri_sleevelengthbonus_sample.svg "Effect of this option on the pattern")

repository: andyssundaypink/freesewing

branch_name: refs/heads/develop

repo_name: andyssundaypink/freesewing


text:
# LFP Appeals Frontend
This repo contains the frontend code for the LFP appeals service. It's currenty `WIP`.

## Technologies

- [NodeJS](https://nodejs.org/)
- [expressJS](https://expressjs.com/)
- [NunJucks](https://mozilla.github.io/nunjucks)
- [gulpJS](https://gulpjs.com/)
- [inversify](https://github.com/inversify/)

## Recommendations

We recommend the use of Visual Studio Code for development as it allows the installation of the TSLint and the Nunjucks plugins. These plugins will make linting of TS and Nunjuck much better than mmost code editors.

IntelliJ does not have a Nunjuck plugin

## How to run it

- Create a redis docker instance with `docker run --name redis-instance -p 6379:6379 -d redis`
- Ensure the variables in `.env.local` are set according to your setup.
- `npm install`
- `npm start`
- Then open your browswer and go to http://localhost:3000.

## Config Files:

- `.env.local` is the config file for running the app in a local environment.
- If you want a different configuration create `.env.<NODE_ENV>` file with the necessary secrets and variables as described on this README. Note that the `NODE_ENV` variable has to be set with the same name as the config name pretended.

## Docker support

Pull image from private CH registry by running `docker pull<PHONE_NUMBER>21.dkr.ecr.eu-west-1.amazonaws.com/local/lfp-appeals-frontend:latest` or run the following steps to build image locally:

1. `export SSH_PRIVATE_KEY_PASSPHRASE='[your SSH key passhprase goes here]'` (optional, set only if SSH key is passphrase protected)
2. `DOCKER_BUILDKIT=0 docker build --build-arg SSH_PRIVATE_KEY="$(cat ~/.ssh/id_rsa)" --build-arg SSH_PRIVATE_KEY_PASSPHRASE -t<PHONE_NUMBER>21.dkr.ecr.eu-west-1.amazonaws.com/local/lfp-appeals-frontend:latest .`

repository: companieshouse/lfp-appeals-frontend

gha_language: TypeScript

repo_name: companieshouse/lfp-appeals-frontend


text:
# RCHooks - RingCentral Webhook Tools

[![Build Status][build-status-svg]][build-status-url]
[![Go Report Card][goreport-svg]][goreport-url]
[![Docs][docs-godoc-svg]][docs-godoc-url]
[![License][license-svg]][license-url]
[![Video][video-svg]][video-url]

`rchooks` is a toolset for creating, listing, recreating, and deleting RingCentral webhooks. It is especially useful in development when working with ngrok and when webhooks are blocked when test servers are taken down and non-responsive. It includes the following:

* `rchooks` CLI app
* `keepalive_lambda` AWS Lambda function to check and rebuild webhook when blacklisted
* `rchooks` SDK package for utilities to build your own apps

YouTube Tutorial Video: https://youtu.be/DYrzzJe8OyI

## Apps

### CLI App

#### CLI Installation

```
$ go install github.com/grokify/rchooks/cmd/rchooks
$ rchooks --env=/path/to/.env --list
```

Prior to Go 1.18, use `go get`:

```
$ go get github.com/grokify/rchooks/cmd/rchooks
$ rchooks --env=/path/to/.env --list
```

#### CLI Usage

By default, `rchooks` looks for an environment file path specified by the `ENV_PATH` environment variable or a `.env` file in the current working directory. You can also explicitly specify a `.env` file with the `--env` path parameter.

```
$ rchooks --list
$ rchooks --create=https://example.com/webhook
$ rchooks --recreate=https://example.com/webhook
$ rchooks --recreate=11112222-3333-4444-5555-66667777888
$ rchooks --delete=https://example.com/webhook
$ rchooks --delete=11112222-3333-4444-5555-66667777888
```

Configure OAuth by setting the `oauth2more/credentials` file via `--creds` and the account via `--account`.

Set the following enviroment variables:

* `RINGCENTRAL_WEBHOOK_DEFINITION_JSON` - Create subscription JSON body

##### Example Webhook Definition

An example value for `RINGCENTRAL_WEBHOOK_DEFINITION_JSON` can be the following. For a long lived webhook, use a value like `500000000` seconds which is equivalent to 15.85 years.

```
{
  "eventFilters":[
    "/restapi/v1.0/glip/posts",
    "/restapi/v1.0/glip/groups",
    "/restapi/v1.0/account/~/extension/~/message-store/instant?type=SMS"
  ],
  "deliveryMode":{
    "transportType":"WebHook",
    "address":"https://12345678.execute-api.us-east-1.amazonaws.com/prod/webhook"
  },
  "expiresIn":500000000
 }
```

Compact example:

`{"eventFilters":["/restapi/v1.0/glip/posts","/restapi/v1.0/glip/groups","/restapi/v1.0/account/~/extension/~/message-store/instant?type=SMS"],"deliveryMode":{"transportType":"WebHook","address":"https://12345678.execute-api.us-east-1.amazonaws.com/prod/webhook"},"expiresIn":500000000}`

### Keepalive Lambda Function

#### Installation

Build the lambda function and then upload to AWS:

```
$ go get github.com/grokify/rchooks
$ cd $GOPATH/src/github.com/grokify/rchooks/apps/keepalive_lambda
$ sh build_lambda.sh
```

Set the following enviroment variables:

* `RINGCENTRAL_TOKEN` - JSON string or simple access token string
* `RINGCENTRAL_SERVER_URL`
* `RINGCENTRAL_WEBHOOK_DEFINITION_JSON` - Create subscription JSON body

## Notes

### Blacklist Reasons

* `I/O operation is failed. Details: [Read timed out]`
* `Webhook response exceeds max size. Read bytes count: [1024]`
* `Webhook responses with code: [404], reason: [Not Found]`

 [build-status-svg]: https://github.com/grokify/rchooks/workflows/go%20build/badge.svg
 [build-status-url]: https://github.com/grokify/rchooks/actions
 [goreport-svg]: https://goreportcard.com/badge/github.com/grokify/rchooks
 [goreport-url]: https://goreportcard.com/report/github.com/grokify/rchooks
 [docs-godoc-svg]: https://pkg.go.dev/badge/github.com/grokify/rchooks
 [docs-godoc-url]: https://pkg.go.dev/github.com/grokify/rchooks
 [license-svg]: https://img.shields.io/badge/license-MIT-blue.svg
 [license-url]: https://github.com/grokify/rchooks/blob/master/LICENSE
 [video-svg]: https://img.shields.io/badge/tutorial-YouTube-blue.svg
 [video-url]: https://youtu.be/DYrzzJe8OyI

repository: grokify/rchooks

gha_language: Go

repo_name: grokify/rchooks


text:
# [PROJECT NAME]

**[SUBTITLE] | [MONTH DAY, YEAR]**

**By [AUTHOR]**

## Description

Add Description.

## Setup/Installation Requirements

### I. Project Setup

1. Install Node.js on local machine.

2. Clone repository and navigate to `webpack-react`.

3. Run `npm install` to load required packages.

### II. View/Build Project

- Development Mode: `npm start`

- Production Build: `npm run build`

  1. Locate build files in `webpack-react/build`.

## Known Bugs

None.

## Technologies Used

- JavaScript
- React
- Babel
- Webpack

## Specifications

Add specifications.

## License

This software is licensed under the MIT license.

Copyright (c) [YEAR] **[AUTHOR]**

repository: SlaterJamesSmith/epicodus-bootcamp

repo_name: SlaterJamesSmith/epicodus-bootcamp


text:
# Overview

This document is a work in progress.

## Recommended tools

- [Visual Studio Code](https://code.visualstudio.com/)

## Recommended tutorial

I recommend the [`Git and GitHub` portion of the don't be afraid to commit](https://dont-be-afraid-to-commit.readthedocs.io/en/latest/git/index.html) tutorial.
To be able to contribute to `pymedphys` you need to have a handle on git and GitHub and how they interact.
I do recommend the whole [`Git and GitHub`](https://dont-be-afraid-to-commit.readthedocs.io/en/latest/git/index.html) section however, the key concepts that are required are:

- [Give GitHub your ssh keys](https://dont-be-afraid-to-commit.readthedocs.io/en/latest/git/commandlinegit.html#give-github-your-public-keys)
- [Creating a new branch](https://dont-be-afraid-to-commit.readthedocs.io/en/latest/git/commandlinegit.html#create-a-new-branch)
- [Keeping main clean](https://dont-be-afraid-to-commit.readthedocs.io/en/latest/git/commandlinegit.html#send-me-a-pull-request)
- [Incorporating upstream changes](https://dont-be-afraid-to-commit.readthedocs.io/en/latest/git/commandlinegit.html#incorporate-upstream-changes)
- [Add an upstream remote](https://dont-be-afraid-to-commit.readthedocs.io/en/latest/git/remotes.html#add-a-remote)

repository: pymedphys/pymedphys

branch_name: refs/heads/main

repo_name: pymedphys/pymedphys


text:
# Data

For the Job Recommendation System model we consider the data from the [Kaggle](https://www.kaggle.com/c/job-recommendation).

The dataset consist of many files in different formats, but we only consider the following files
* apps.tsv
* jobs.tsv
* test_users.tsv
* user_history.tsv
* users.tsv

In order to understand the content of the data files, you need to understand the structure of this contest.

In outline, we give you data on users, job postings, and job applications that users have made to job postings. In total, the applications span 13 weeks.
We have split the applications into 7 groups, each group representing a 13-day window. Each 13-day window is split into two parts:
The first 9 days are the training period, and the last 4 days are the test period. All the other details on window split per user you can find in the
[Kaggle](https://www.kaggle.com/c/job-recommendation/data) site.

## File Formats
Each of the files is in .tsv (tab-seperated value) format. This means that each line in a .tsv file consists of several fields, which are separated by tabs.
To accommodate this file format, fields composed of text have been changed in the following ways to escape tabs, newlines, and carriage returns.

1. Tabs have been replaced by '\t'
2. Newlines have been replaced by '\n'
3. Carriage returns have been replaced by '\r'
4. Backslashes have been replaced by '\\\'

## Files

**users.tsv** contains information about the users. Each row of this file describes a user. The *UserID* column contains a user's unique id number,
the *WindowID* column contains which of the 7 windows the user is assigned to, and the *Split* column tells whether the user is in the Train group or
the Test group. The remaining columns contain *demographic and professional information* about the users.

repository: Biswajit-Panda/Contribution-program

repo_name: Biswajit-Panda/Contribution-program


text:
*Instructor:* Luca Foschini (email<EMAIL_ADDRESS>(twitter: @calimagna)

*Format:* lecture and hands-on

# Announcements:
  - Tweet your thoughts! #UCSBDSbootcamp2015
  - If you don't have a college of engineering account, contact Tim Robinson (email<EMAIL_ADDRESS>  - Lunch with Prof. Francesco Bullo (Mechanical Engineering) at 12noon
  - Afternoon class (Big Data/Small Data) starts at 1.30pm
  - Leave feedback: me/Tim

# Goals

- Learn about data science
- Learn how perform basic data manipulation with python
- See all the things that python can do

## Before you Begin
  - Commit your code locally
  - do a ```git pull```
  - Load up on positive attitude! We're all learning here :)

## Intro

  - Why are we where today?
```
IGERT ⊂ network science ⊂ data science.
```
  - Recap of using shell, git, notebooks see: [here](../setup.md)
  - Data science, [what is it](..//Day02_EverythingData/notebooks/01%20-%20Data%20Science.ipynb)? Why is it [The Sexiest Job of the Century?](https://hbr.org/2012/10/data-scientist-the-sexiest-job-of-the-21st-century/)
  - Don't try this at home (I haven't either! --- Quick demo)

## Data Wrangling and Exploration

  - Python [basics](../Day02_EverythingData/notebooks/02%20-%20Introduction%20to%20Python.ipynb)
  - All Python [can do](..//Day02_EverythingData/notebooks/03%20-%20Libraries%20and%20Integration.ipynb)!
  - Numpy and Pandas (the missing library for [data manipulation](..//Day02_EverythingData/notebooks/04%20-%20Data%20Wrangling.ipynb)
  - Speed [considerations](..//Day02_EverythingData/notebooks/05%20-%20Theory%20and%20Practice.ipynb)

## Data Exploration

  - Work with text, networks, time series. Import your dataset into python, and start playing with it.
  - [Interesting notebook gallery](https://github.com/ipython/ipython/wiki/A-gallery-of-interesting-IPython-Notebooks#introductory-tutorials). Pick one!
  - [Miniproject](..//Day02_EverythingData/notebooks/07%20-%20Miniproject.ipynb)


text:
# oesign - HOWTO

## oesign sign

The `oesign` tool should be used with the subcommand `sign` to sign enclaves. The samples show how a developer should use this tool to sign their enclave images before using them. Please refer to how one of the samples uses this tool here: https://github.com/openenclave/openenclave/blob/master/samples/helloworld/enclave/Makefile

All enclave images should be signed before they are used in production.

To understand the full CLI of this tool, please refer to the `usage` printout below:

```
Usage: ./output/bin/oesign sign {--enclave-image | -e} ENCLAVE_IMAGE {--config-file | -c} CONFIG_FILE {--key-file | -k} KEY_FILE

Where:
    ENCLAVE_IMAGE -- path of an enclave image file
    CONFIG_FILE -- configuration file containing enclave properties
    KEY_FILE -- private key file used to digitally sign the image

Description:
    This utility (1) injects runtime properties into an enclave image and
    (2) digitally signs that image.

    The properties are read from the CONFIG_FILE. They override any
    properties that were already defined inside the enclave image through
    use of the OE_SET_ENCLAVE_SGX macro. These properties include:

        Debug - whether enclave debug mode should be enabled (1) or not (0)
        ProductID - the product identified number
        SecurityVersion - the security version number
        NumHeapPages - the number of heap pages for this enclave
        NumStackPages - the number of stack pages for this enclave
        NumTCS - the number of thread control structures for this enclave

    The configuration file contains simple NAME=VALUE entries. For example:

        Debug=1
        NumHeapPages=1024

    The key is read from KEY_FILE and contains a private RSA key in PEM
    format. The keyfile must contain the following header.

        -----BEGIN RSA PRIVATE KEY-----

    The resulting image is written to ENCLAVE_IMAGE.signed
```

## oesign dump

The oesign tool can also print information about a specified signed enclave image. Please refer to the usage below for how to do this:

```
Usage: ./output/bin/oesign dump {--enclave-image | -e} ENCLAVE_IMAGE

Where:
    ENCLAVE_IMAGE -- path of an enclave image file

Description:
    This option dumps the oeinfo and signature information of an enclave
```

repository: mrragava/openenclave

repo_name: mrragava/openenclave


text:
# UdaciMeals

This repo is for [Udacity](https://www.udacity.com/)'s Front End Frameworks course. This is the Backbone version of the project.

## Required software

* [Git](https://git-scm.com/)
* [Bower](http://bower.io/)

## Getting set up

### Set up the project
* clone this repo
* `cd` into the newly cloned project
* install Bower dependencies via `bower install`

### Set up the server
* clone the [backend server](https://github.com/udacity/FEF-UdaciMeals-Backbone-Server)
* launch the binary for your platform
  - don't forget the `--www` flag pointing to the UdaciMeals Backbone project you just cloned above
  - check out that project's `Running the server` section of its README for specific details

### View the app

Using your favorite browser, load [http://localhost:8000/](http://localhost:8000/) and :boom:


text:
# Stylus Lightning
This is a small library of Stylus mixins and stylesheets. It's purpose built to include in the [Site Lightning](http://sitelightning.co/) front-end development boilerplate (source code [here](http://github.com/abstracthat/site-lighting)). You might also find it useful on it's own.

Site Lightning uses [Axis](http://axis.netlify.com/) so this library is mostly just extra helpers on top of that.

## Installation
```bash
npm install --save stylus-lightning
```

## Dependency
This library is dependent on using [Axis](https://github.com/jenius/axis) for the `hover-gradient()` mixin. **Important**! Make sure you import Axis first since this library overwrites the buggy `transition()` mixin in Axis.

## Usage
Like other Stylus libraries you need to `use()` it when calling Stylus. Here's an example Gulp config using four other awesome Stylus libraries: [Happy Grid](https://github.com/abstracthat/happy-grid), [Downbeat](https://github.com/abstracthat/downbeat), [Rupture](https://github.com/jenius/rupture) and [Axis](https://github.com/jenius/axis).

```js
var stylus = require('gulp-stylus');
var lib = require('stylus-lightning');
var downbeat = require('downbeat');
var grid = require('happy-grid');
var rupture = require('rupture');
var axis = require('axis');

gulp.task('style', function() {
  gulp.src('styles/main.styl')
    .pipe(stylus({use: [lib(), downbeat(), rupture(), axis(), grid()]}))
    .pipe(gulp.dest('./compiled/css'))
});
```

Then in your `main.styl` just `@import 'lib'`.

## Styles
These two stylesheets add CSS to your output.

### Reset
This is on top of [normalize.css](http://necolas.github.io/normalize.css/) to give a nicer baseline for new styles.

- border box everything
- Improved `font-smoothing` and `text-rendering`
- iOS scrolling and highlight improvements
- html and body height 100%
- overflow-x hidden for `full-width()` mixin
- Reset padding and margin on commonly styled elements
- Unstyled links
- Unstyled buttons: no outlines, backgrounds or borders
- Unstyled hr
- fluid width, responsive media (`max-width 100%`)

### Print
Print styles inspired by [Hartija](https://github.com/vladocar/Hartija---CSS-Print-Framework/blob/master/print.css) with some typography changes. Print styles in a `@media` query so you don' have to worry about it.

## Mixins
Just a few mixins for now.

### Full Width
It's easier to layout your site so that it is contained to a max-width. But sometimes you want a section background to go full width but your content to still be contained. This is a bit of a hack but works great.

```stylus
section.wide
  full-width()
  color black
```

### Hover Gradient
Uses Axis to create a gradient background and style the `:hover` to offset the gradient. Also sets the color to the element's color (or a color you pass) which is important if you are styling an anchor tag. When applied to an element (like `a.button` for instance) with transition `background-position .2s` you get a nice transition.

You can pass up to 4 args but only `background-color` is required.
- background-color
- [color: @color]
- [strength: null] // uses Axis default (10%)
- [offset: -2.5em]

```stylus
a.button
  &.facebook
    hover-gradient #425c9e
```

### Ratio Box
Set a specific ratio for background images and video iframe embeds.

**Example**:
```stylus
.widescreen-video
  ratio-box(16/9)
```

### Transition
This is a reset to fix occassional problems caused by the way Axis caches Nib's transition mixin. Since it's only for vendor prefixing and I use Auto-prefixer I just want transition to work normally.

repository: abstracthat/stylus-lightning

repo_name: abstracthat/stylus-lightning


text:
1116-feel-time-function
--------------------

### Description ###

DMN Model [1116-feel-time-function.dmn](./1116-feel-time-function.dmn) tests DMN specification conformance of `FEEL built-in function 'time(from [string])', 'time(from [time, date and time])' and 'time(hour,minute,second,offset)'`. Tested category is `conversion functions`.

#### Specification Reference(s): ####
 * DMN 1.1 - <IP_ADDRESS> Table 58

### Test Cases ###

|Decision Name| Literal Expression (FEEL) | Expected Result (Expected Type)|
|-------------|-------------------------- |--------------------------------|
|feel-time-function_ErrorCase_001_bdf26fdc72|time(null)|null (time)|
|feel-time-function_ErrorCase_002_9d2e399b96|time(null,11,45,duration("P0D"))|null (time)|
|feel-time-function_ErrorCase_003_d1f0ea5bb9|time(12,null,45,duration("P0D"))|null (time)|
|feel-time-function_ErrorCase_004_57aea91d1c|time(12,0,null,duration("P0D"))|null (time)|
|feel-time-function_ErrorCase_005_32ea20b34f|time(null,null,45,duration("P0D"))|null (time)|
|feel-time-function_ErrorCase_006_e266498180|time(null,11,null,duration("P0D"))|null (time)|
|feel-time-function_ErrorCase_007_ee82c7bf12|time(null,11,45,null)|null (time)|
|feel-time-function_ErrorCase_008_08078c6c29|time(12,null,null,duration("P0D"))|null (time)|
|feel-time-function_ErrorCase_009_804c21ed52|time(12,11,null,null)|null (time)|
|feel-time-function_ErrorCase_010_cc773bb44b|time(12,null,null,null)|null (time)|
|feel-time-function_ErrorCase_011_ad5b3a26b5|time(null,0,null,null)|null (time)|
|feel-time-function_ErrorCase_012_3c2f416fc9|time(null,null,15,null)|null (time)|
|feel-time-function_ErrorCase_013_7f22c0bda8|time(null,null,null,duration("P0D"))|null (time)|
|feel-time-function_ErrorCase_014_0dc13176e8|time(null,null,null,null)|null (time)|
|feel-time-function_015_376d693a79|time(12,00,00,null)|12:00:00 (time)|
|feel-time-function_ErrorCase_016_c3cccff405|time()|null (time)|
|feel-time-function_017_f3683885f5|time("01:02:03")|01:02:03 (time)|
|feel-time-function_018_35f1f2cce8|time("00:00:00")|00:00:00 (time)|
|feel-time-function_019_879be89d63|time("11:22:33.444")|11:22:33.444 (time)|
|feel-time-function_020_72b421086e|time("11:22:33.123456789")|11:22:33.123456789 (time)|
|feel-time-function_021_5c50fa1dff|time("23:59:00Z")|23:59:00Z (time)|
|feel-time-function_022_55e76d3595|time("11:00:00Z")|11:00:00Z (time)|
|feel-time-function_023_5cbbb85435|time("00:00:00Z")|00:00:00Z (time)|
|feel-time-function_024_5f7f735e8f|time("13:20:00+02:00")|13:20:00+02:00 (time)|
|feel-time-function_025_139b25b795|time("13:20:00-05:00")|13:20:00-05:00 (time)|
|feel-time-function_026_c5208af118|time("11:22:33-00:00")|11:22:33Z (time)|
|feel-time-function_027_45082fd26c|time("11:22:33+00:00")|11:22:33Z (time)|
|feel-time-function_028_eaea7a943c|string(time("00:01:00@Etc/UTC"))|"00:01:00@Etc/UTC" (string)|
|feel-time-function_029_f0d5c2c16a|string(time("00:01:00@Europe/Paris"))|"00:01:00@Europe/Paris" (string)|
|feel-time-function_030_390d4f4648|time(date and time("2017-08-10T10:20:00"))|10:20:00 (time)|
|feel-time-function_031_4d086a3b59|time(date and time("2017-08-10T10:20:00+00:00"))|10:20:00Z (time)|
|feel-time-function_032_d9b0d7f931|time(date and time("2017-08-10T10:20:00-00:00"))|10:20:00Z (time)|
|feel-time-function_033_8420160da1|time(date and time("2017-08-10T10:20:00+01:00"))|10:20:00+01:00 (time)|
|feel-time-function_034_13c312c376|time(date and time("2017-08-10T10:20:00-01:00"))|10:20:00-01:00 (time)|
|feel-time-function_035_fbfce88ac4|time(date and time("2017-08-10T10:20:00Z"))|10:20:00Z (time)|
|feel-time-function_036_eb05fabc01|string(time(date and time("2017-08-10T10:20:00@Europe/Paris")))|"10:20:00@Europe/Paris" (string)|
|feel-time-function_037_eed195f693|string(time(date and time("2017-09-04T11:20:00@Asia/Dhaka")))|"11:20:00@Asia/Dhaka" (string)|
|feel-time-function_038_05b311131c|time(11, 59, 45, null)|11:59:45 (time)|
|feel-time-function_039_5b65992f0d|time(11, 59, 45, duration("PT0H"))|11:59:45Z (time)|
|feel-time-function_040_6c9d17b491|time(11, 59, 45, duration("PT2H"))|11:59:45+02:00 (time)|
|feel-time-function_041_29a448d57e|time(11, 59, 45, duration("-PT2H"))|11:59:45-02:00 (time)|
|feel-time-function_042_00146f2977|time(11, 59, 00, duration("PT2H1M"))|11:59:00+02:01 (time)|
|feel-time-function_043_2edfae8414|time(11, 59, 00, duration("-PT2H1M"))|11:59:00-02:01 (time)|
|feel-time-function_044_3073ffd026|time(11, 59, 00, duration("PT2H1M0S"))|11:59:00+02:01 (time)|
|feel-time-function_045_ad1339e858|time(11, 59, 00, duration("-PT2H1M0S"))|11:59:00-02:01 (time)|
|feel-time-function_046_7b80221ec1|string(time(11, 59, 45, duration("PT2H45M55S")))|"11:59:45+02:45:55" (string)|
|feel-time-function_047_33cd7b9b15|string(time(11, 59, 45, duration("-PT2H45M55S")))|"11:59:45-02:45:55" (string)|
|feel-time-function_048_9bedd52886|time(11, 59, 45, duration("-PT0H"))|11:59:45Z (time)|
|feel-time-function_049_617d9e09d6|time(date and time(date and time("2017-08-10T10:20:00"),time("23:59:01")))|23:59:01 (time)|
|feel-time-function_050_524d9a8146|time(date and time(date and time("2017-08-10T10:20:00"),time("23:59:01.987654321")))|23:59:01.987654321 (time)|
|feel-time-function_051_a71d2a08f7|time(date and time(date and time("2017-09-05T10:20:00"),time("09:15:30+02:00")))|09:15:30+02:00 (time)|
|feel-time-function_052_d825d58888|time(date and time(date and time("2017-09-05T10:20:00"),time("09:15:30Z")))|09:15:30Z (time)|
|feel-time-function_053_3d956966c0|time(date("2017-08-10"))|00:00:00Z (time)|
|feel-time-function_ErrorCase_054_fdc3094237|time(2017)|null (time)|
|feel-time-function_ErrorCase_055_9b47db6ea4|time([])|null (time)|
|feel-time-function_ErrorCase_056_a8e828d64d|time("")|null (time)|
|feel-time-function_ErrorCase_057_d039115cce|time("23:59:60")|null (time)|
|feel-time-function_ErrorCase_058_81dd4b1639|time("24:00:01")|null (time)|
|feel-time-function_ErrorCase_059_c7e1705fe1|time("24:01:00")|null (time)|
|feel-time-function_ErrorCase_060_0cf4734fae|time("25:00:00")|null (time)|
|feel-time-function_ErrorCase_061_da2717f085|time("00:60:00")|null (time)|
|feel-time-function_ErrorCase_062_6cd1313fa9|time("00:00:61")|null (time)|
|feel-time-function_ErrorCase_063_e85c40b474|time("7:00:00")|null (time)|
|feel-time-function_ErrorCase_064_df74038c67|time("07:1:00")|null (time)|
|feel-time-function_ErrorCase_065_79eaef6fee|time("07:01:2")|null (time)|
|feel-time-function_ErrorCase_066_5116e12fd3|time("13:20:00@xyz/abc")|null (time)|
|feel-time-function_ErrorCase_067_8285edad7b|time("13:20:00+19:00")|null (time)|
|feel-time-function_ErrorCase_068_ad528abb23|time("13:20:00-19:00")|null (time)|
|feel-time-function_ErrorCase_069_5096701e2e|time("13:20:00+5:00")|null (time)|
|feel-time-function_ErrorCase_070_8b2e39f570|time("13:20:00+5")|null (time)|
|feel-time-function_ErrorCase_071_cf9417648b|time("13:20:00+02:00@Europe/Paris")|null (time)|
|feel-time-function_ErrorCase_072_4c8c3835e4|time("7:20")|null (time)|
|feel-time-function_ErrorCase_073_a5fc245959|time("07:2")|null (time)|
|feel-time-function_ErrorCase_074_387d4411ea|time("11:30:00T")|null (time)|
|feel-time-function_ErrorCase_075_1606dda03d|time("2012T-12-2511:00:00Z")|null (time)|
|feel-time-function_ErrorCase_076_cb117ca612|time(24, 59, 45, null)|null (time)|
|feel-time-function_ErrorCase_077_a4daad060c|time(-24, 59, 45, null)|null (time)|
|feel-time-function_ErrorCase_078_c2fe73418b|time(23, 60, 45, null)|null (time)|
|feel-time-function_ErrorCase_079_d2d226c3cd|time(23, 59, 60, null)|null (time)|
|feel-time-function_080_2bbb8c86af|time(from:date and time("2012-12-24T23:59:00"))|23:59:00 (time)|
|feel-time-function_081_69f4e0231e|time(from: "12:45:00")|12:45:00 (time)|
|feel-time-function_082_36a78e5396|time(hour:11, minute:59, second:0, offset: duration("PT2H1M0S"))|11:59:00+02:01 (time)|
|feel-time-function_083_6b608254c7|time(hour:11, minute:59, second:0, offset: duration("-PT2H"))|11:59:00-02:00 (time)|

### Disclaimer ###
This page is a simple view for the underlying DMN model file [1116-feel-time-function.dmn](./1116-feel-time-function.dmn).
The purpose of the model is to test and validate FEEL expressions. Therefore the underlying DMN model is simplistic:
Each decision node contains one literal expression under test. The table above shows the decision, the underlying FEEL expression and the expected result.

Site generated by [ACTICO GmbH](https://actico.com) for [Technology Compatibility Kit (TCK)](https://dmn-tck.github.io/tck/) for the Decision Model and Notation (DMN) standard.

[DMN 1.1. Specification Document](http://www.omg.org/spec/DMN/1.1/)

repository: sreev/tck

repo_name: sreev/tck


text:
---
layout: page
author: Cristi Constantin
comments: true
categories: article
tags: software programming graph db
excerpt: "Libraries I might use for persistence, compatibility formats and some basic specs."
---

Oh man, long time and no updates. I'm sorry about that. I'm writing a few words every few days, but it doesn't seem to finish.

In the meantime, I created a [repo on Github](https://github.com/croqaz/Graphh){:target="_blank"}.

In my [previous article about my Graph Database](/2017/05/making-a-graph-db-ep4), I studied some methods for representing graphs in memory and persistent.

In this episode, I want to look at the actual libraries that I might use for persistence.

## Embedded databases for Node.js or Python

This is the internal persistence layer, required to be as fast as possible:

- LevelDB - the most popular
- RocksDB - an alternative to LevelDB
- Lightning DB - only Python: https://github.com/dw/py-lmdb
- Berkeley DB - only Node: https://www.npmjs.com/package/berkeleydb
- there are other portable DBs available too, less popular and probably less efficient

## Compatibility formats

These formats are not particulary speed efficient, nor storage efficient, so they can't be used for instant snapshots. But to be compatible with other Graph implementations, my Graph should be exported to at least one of these:

- [Gephi GEXF](https://gephi.org/gexf/format){:target="_blank"} - XML format
- [GraphML](http://graphml.graphdrawing.org){:target="_blank"} - pure XML format, similar with GEXF
- [DOT format](https://en.wikipedia.org/wiki/DOT_(graph_description_language)){:target="_blank"} - simple format
- [Graph Modelling Language, or Graph Meta Language](https://en.wikipedia.org/wiki/Graph_Modelling_Language){:target="_blank"} - precursor of DOT
- [LEDA (Library of Efficient Datatypes)](http://www.algorithmic-solutions.info/leda_guide/graphs/leda_native_graph_fileformat.html){:target="_blank"} - fast text-based file format for storing a single directed, or undirected graphs
- [Pajek](https://gephi.org/users/supported-graph-formats/pajek-net-format){:target="_blank"} - easy text-based file format for storing a single directed, or undirected graph
- Graph6 si Sparse6 - somewhat exotic graph storage

## Graph query languages

- Cypher - Neo4j's query language
- SPARQL - https://www.w3.org/TR/rdf-sparql-query
- Gremlin
- GraphQL
- Dgraph's query language (inspired from GraphQL)

Also, [An overview of Graph database query languages](https://developer.ibm.com/dwblog/2017/overview-graph-database-query-languages){:target="_blank"} from IBM developers.

### Desired technical requirements:

- follow KISS principle (keep it simple stupid)
- target data size: 5 million nodes and 10 million edges on a standard laptop
- the graph should be directed, because in reality all things have a direction
- no need to store metadata about nodes, or edges
- persist the smallest possible set of data that can be reconstructed entirely, even it takes more time to init
- query the data: edges and triples. I'm not sure if I'll be using any of the existing graph query languages, they're ugly as hell and they don't seem productive at all; but I might reconsider later;
- all the data will be used in a normal application, atempting to replace a RDBM or NoSql database
- the database should be easy to merge with another database and all the data should merge perfectly (nice to have)
- I should also construct a visual tool to explore and discover the data, without knowing what's in there (nice to have). That would be beautiful, because graphs are really simple to understand mentally.

I want to hash the nodes using a standard hashing algorithm. The nodes must be hashed and stored in a special table, to avoid duplication of data. Hashing is less space efficient than, for example, giving an arbitrary number for each node in the de-duplication table, but has huge advantage that when you merge your nodes with the nodes from another database, the hashes will match perfectly.
In the same way, the edges should be hashed so that when you create a connection between 2 nodes, it's exactly the same connection as another database who created a connection between the same nodes.

For example, my database:
node: horse = 091b5035885c00170fec9ecf24224933e3de3fcc
node: grass = bbc29b76c59b382aca12201c44929002ef1778ae
edge: horse -> grass = da19c89bcc24bdc54041df2cbb2e7e5bc639809a

Another database:
node: horse = 091b5035885c00170fec9ecf24224933e3de3fcc
node: animal = 3199ea056253916c41d65c6fd39b52e5f239873c
edge: animal -> horse = e2fe5ce1a2d0ff363cda9862ed72e1b30a777b62

When joining the two databases, you'll gain more knowledge about the horse for free, without any unnecessary duplication: horse is an animal and eats grass.
This is just an example using SHA1 hashing. I'll probably use something different in the real implentation.

-----

This blog is open source. You can check the [history of this post](https://github.com/croqaz/croqaz.github.io/commits/master/{{page.path}}).

If you have any thoughts, suggestions, criticism, or whatever, please drop me a line in the comments section.
If I have some audience, I'll be sharing details and I'll write more often, obviously.


text:
---
layout: page
title: "Perform L3 adoption with UniFi Controller v4 (Dockerized)"
date: "2015-03-20"
teaser: Not quite as straightforward as it should be
category: how-to
header: no
---
Having recently deployed a "dockerized" [Ubiquity UniFi Controller][2], I was forced to reset my UniFi AP so that I could re-adopt it and bring it back under management.

This shouldn't have been a big deal, but a number of systems didn't work as the should have.

1. Using DHCP option 43 to point to the IP of the UniFi controller simply didn't work on the latest ScreenOS. Apparently the intended behaviour is that the AP [uses the result of DHCP option 43 to populate /etc/hosts with an entry for "unifi"][3]
2. Manually using set-inform from the CLI of the AP to my controller didn't work. I got errors about "Server Reject":
```Jan 1 00:33:22 UBNT user.err syslog: ace_reporter.reporter_fail(): Server Reject (http://<IP_ADDRESS>:8080/inform)```

Having discovered #1, I tried manually editing /etc/hosts on the AP, after which (surprisingly) my AP happily registered for adoption. I adopted it in the UniFi Controller, after which it promptly rebooted for a firmware update. After reboot, /etc/hosts was reset, and it was unable to complete changing to a "managed state":

```Mar 20 00:27:09 UBNT user.err syslog: ace_reporter.reporter_fail(): initial contact failed #14, url=http://unifi:8080/inform, rc=1
Mar 20 00:27:09 UBNT user.info syslog: ace_reporter.reporter_next_inform_url(): next inform url[0]=http://unifi:8080/inform
```

I re-ran the procedure to manually add my controller's AP to /etc/hosts, and the adoption completed successfully.

What I've learned:

1. DHCP Option 43 is unreliable. I'd be better off to create an A record in my domain for "unifi", pointing to the controller
2. Standardize on using an "admin" user for the controller. Don't get clever and change the username (to something like "davidy", for example). It'll only bite you in the end.

Another helpful tip I stumbled across on the way:

* Make sure you're logged into the controller as the user you setup when you installed the controller (The "[Super Admin][1]")

[1]: https://registry.hub.docker.com/u/pducharme/unifi/dockerfile/
[2]: http://community.ubnt.com/t5/UniFi-Wireless/AP-s-can-t-discover-controller/td-p/588425
[3]: https://community.ubnt.com/t5/UniFi-Wireless/Question-re-DHCP-Option-43/td-p/635501


text:
#Autor: Esmit Pérez
#Twitter: @esmitperez
#Fecha: Sep 2013
#
#Copyright (c) 2013 Esmit Pérez (@esmitperez)
#http://www.apache.org/licenses/LICENSE-2.0

Eldicino
========

Eldicino - An arduino game

Vine: https://vine.co/v/hmeHp9I6lun

Parts
=====
Thumb Joystick , COM-09032
https://www.sparkfun.com/products/9032

Breakout Board for Thumb Joystick
BOB-09110
https://www.sparkfun.com/products/9110

RGB backlight positive LCD 16x2 + extras - black on RGB
http://www.adafruit.com/products/398

i2c / SPI character LCD backpack -
http://www.adafruit.com/products/292
http://learn.adafruit.com/i2c-spi-lcd-backpack

Fritzing - Adafruit library
http://learn.adafruit.com/using-the-adafruit-library-with-fritzing/download-the-fritzing-library-from-github

repository: esmitperez/Eldicino

repo_name: esmitperez/Eldicino


text:
**Current Version: 0.0.1 pre-alpha (not released yet)**

This is a home page for QGIS Earth Engine plugin. The ee_plugin adds support for [Google Earth Engine Python API](https://github.com/google/earthengine-api/tree/master/python) to QGIS and implements Map API typically used within the [Google Earth Engine Code Editor](https://developers.google.com/earth-engine/getstarted). To get started - please make sure you're familiar with the EE API first and/or check examples.

Once installed in QGIS, the plugin can be accessed from the QGIS Python [`Code Editor`](https://docs.qgis.org/2.18/en/docs/user_manual/plugins/python_console.html#the-code-editor)  ![](https://docs.qgis.org/3.4/en/_images/iconShowEditorConsole.png) to write and execute EE scripts. There is not UI support available yet, you will have to write code!

![Add Sentinel-2 image](https://raw.githubusercontent.com/gee-community/qgis-earthengine-plugin/master/media/add_map_layer.png)

### Map

The plugin implements most of the Map.* functionality typically used in the [Code Editor](https://developers.google.com/earth-engine/playground). Note, that no UI or Layers functionality is supported right now.

The following Map functions are currently implemented, optional arguments are in _italic_:

* Map.addLayer(eeObject, _visParams, name, shown, opacity_), [example](https://github.com/gee-community/qgis-earthengine-plugin/tree/master/examples/map_add_features.py)
* Map.centerObject(object, _zoom_), [example](https://github.com/gee-community/qgis-earthengine-plugin/tree/master/examples/map_center_object.py)
* Map.getBounds(_asGeoJSON_), [example](https://github.com/gee-community/qgis-earthengine-plugin/tree/master/examples/map_get_bounds.py)
* Map.getCenter(), [example](https://github.com/gee-community/qgis-earthengine-plugin/tree/master/examples/map_get_center.py)
* Map.setCenter(lon, lat, _zoom_), [example](https://github.com/gee-community/qgis-earthengine-plugin/tree/master/examples/map_set_center.py)
* Map.getScale()
* Map.getZoom()
* Map.setZoom(zoom), [example](https://github.com/gee-community/qgis-earthengine-plugin/tree/master/examples/map_set_zoom.py)

Check official [EE API documentation](https://developers.google.com/earth-engine/getstarted#adding-data-to-the-map) for Map usage.

#### Importing plugin

To get started, make sure to include the following two importes at the beginning:

```python
from ee_plugin import Map
import ee
```

After that, the Map.* functions can be used in a similar way to how this is done in Code Editor:

#### Adding map layers

```python
image = ee.Image('USGS/SRTMGL1_003').unitScale(0, 5000)

Map.addLayer(image, {'palette': ['blue', 'red'], 'min': 0, 'max': 1000}, 'dem', True)
```

The code above will query Earth Engine for an image and will add it as an XYZ tile layer to the QGIS Canvas.

Note that QGIS projects containing EE map layers can be also saved, in this case, the code required to connect the to EE is stored in a QGIS project and is used to re-initialize these layers when the project is loaded. Currently, this works only if ee_plugin is installed in the QGIS where these layers are loaded.

Check [examples](https://github.com/gee-community/qgis-earthengine-plugin/tree/master/examples) directory to learn what kind of functionality is currently supported.

repository: rosaguilar/qgis-earthengine-plugin

repo_name: rosaguilar/qgis-earthengine-plugin


text:
Title: RCE 8.1.1
Date: 2017-11-17 12:15
Category: Releases
Author: RCE

We recently released RCE 8.1.1. It contains several bugfixes and minor improvements. Please see [GitHub](https://github.com/rcenvironment/rce/wiki/Changelog:-8.x.x-Releases) for the full changelog.

### Synopsis

 * Internal improvements to enhance building RCE as external developer
 * Fixed some bugs regarding fault tolerant loops, SSH remote access and CPACS tool integration
 * Several minor fixes

repository: DLR-SC/rce-website

repo_name: DLR-SC/rce-website