text:
# SingleEntry for iOS
Simple iOS app showing the use of Capture SDK.

## IMPORTANT
When using/installing CocoaPods in a new project, the project workspace file should be used instead of the project file.

The Socket Mobile Bluetooth barcode scanners and RFID Readers use the External Accessory Framework.

It is very important to make sure your application info plist file contains the supported external accessory protocol string array `com.socketmobile.chs`.
![Project Settings](./img/SingleEntryProjectSettings.png "SingleEntry Project Settings")

The previous version of iOS used to give an error message in the traces when a barcode scanner connects to the iOS device and the protocol string was omitted, but that is no longer the case with the most recent version of iOS.

Adding the external accessory protocol string to your application will require your application to be whitelisted with Socket Mobile before submission to the App Store.

Make sure to contact Socket Mobile in order to whitelist your application.  You can submit your app to be whitelisted in the Socket Mobile Developer portal.

## Prerequisites
The Capture SDK uses CocoaPods. If it needs to be installed, please check the [CocoaPods website](https://cocoapods.org/ "CocoaPods Homepage") for the most current instructions.

The Socket Mobile Capture SDK is required in order to compile this sample.

## Installation
The following steps show how to get and build this project.

Open a Terminal window and clone the project:
`$git clone https://github.com/SocketMobile/capturesingleentry-ios.git && cd capturesingleentry-ios`

Then install Socket Mobile Capture SDK:
`pod install`

Last, open the SingleEntry Xcode workspace file:
`open SingleEntry.xcworkspace`

It is important to load the SingleEntry workspace (NOT PROJECT) in Xcode and compile and run.

Build and run the application on a device in order to test with a Socket Mobile device.

## Connecting a Socket Mobile device
### Socket Mobile Barcode Scanner
In order to connect a Socket Mobile Barcode Scanner, the scanner needs to be configured in Application mode (MFi-SPP) for iOS. Please check Socket Mobile website support section in order to download the documentation and to retrieve this configuration barcode. You can also use the Socket Mobile Companion application from the App store to configure your scanner.

The application mode configuration is persistent in the scanner and can only changed by scanning another configuration mode barcode or by doing a reset to factory default.

Once the scanner is configured in application mode (MFi-SPP) for iOS, the pairing to the iOS device can be done by going to the iOS device Bluetooth settings and selecting the scanner that appears in the list of discovered Bluetooth devices.

The scanner is ready as soon as the pairing is completed. The application using Capture can now use the scanner.

This pairing process is required only once for doing this initial connection. The scanner will reconnect automatically to the last iOS device paired after powering it on.

### Socket Mobile Contactless Read-Writer (D600)
The application settings has a switch to turn on in order to connect to a Socket D600 device.

This device is using Bluetooth Low Energy, and its connection process driven by Capture directly.

Turning on the D600 support in the app will automatically launch a Bluetooth discovery, pair and connect to the D600 that is powered on and in the proximity of the iOS device.

If this is the first time the D600 connects to this iOS device, a pairing alert message is displayed to ask for pairing confirmation.

Once this dialog is acknowledged, the D600 becomes operational and can read a RFID / NFC tag.

There is a set of Capture API the application can use to customize the connection process.

Check the Capture documentation for further details.

## Documentation
The Socket Mobile Capture SDK documentation can be found  [here](http://docs.socketmobile.com/capture-preview/ios/en/latest/ "Socket Mobile Capture SDK documentation").

## Screenshots

### Main View
The main view shows the connection status, an edit box that receives the decoded data and a setting link to display the settings view.

When a scanner is connected, its friendly name appears in the status.

![Main View](./img/SingleEntry.png "Main View")

### Settings View
The settings view displays the Capture version, two switches to turn on or off the SoftScan feature and the D600 support. The done link closes this view to go back to the main view.

![ Settings View](./img/SingleEntry-Settings.png "Settings View")

## Description
SingleEntry displays a scanner connection status. When a scanner is connected, its friendly name is displayed.
The edit box receives the decoded data from the scanner.

There is a Settings link in the middle of the screen that shows a Settings view.

This view displays the version of Capture with a switch to turn ON or OFF SoftScan and a switch to turn on D600 support.

The D600 is Socket Mobile's contactless RFID and NFC reader-writer product that is using Bluetooth Low Energy (BLE).

The Done link in the Settings view closes the view to go back to the main view.

## Implementation
In this simple example the CaptureHelper is "attached" to the main view
controller.

This main view controller derives from the CaptureHelperDelegate protocol and implements some of the delegate methods.

### Main view controller viewDidLoad
This method creates and initializes a CaptureHelper instance and it opens CaptureHelper.

Once the initialization is done,  Capture notifications can be received which includes but not limited to the device arrival, the device removal and the decoded data notifications.

The application information is required in order to be able to open Capture.
The application information contains the developer ID, the application Bundle ID, prefixed by 'ios:', for the platform on which the app is running, and the application key (AppKey) that is retrieved from Socket Mobile developer portal where the application can be registered.

**NOTE: The application Bundle ID is case sensitive**.

The Capture openWithAppInfo:completionHandler is asynchronous. The result can be read in the block function of this method. In this particular example the SoftScan status is retrieved if the result is successful.

### Good example on how the API works: getting the Capture version
All the Capture APIs are asynchronous, meaning it returns right away to the caller without waiting for the completion of the operation.

Each Capture API accepts a block function as argument that is called to return the result and the eventual data requested.

In the case of getting the version, the block function is called with the result and if the result is successful the version in arguments can be used to get the Capture version.

Note that the Block can be in its own environment context and therefore the application UI should not be updated directly. Please refer to the documentation for more details.

### onDeviceArrival
This CaptureHelperDelegate method is called when a scanner is successfully detected by the host.

The scanner can be SoftScan or any other Socket Mobile scanners or RFID Readers supported by Capture.

In this particular case the connection status is updated with the name of the new device.

If the device is SoftScan then the trigger button is enabled and visible.

### onDeviceRemoval
When a scanner is no longer available (disconnected), this delegate is invoked.

In this particular case, the connection status is updated and if the device is SoftScan then the trigger button is hidden from the interface.

### onDecodedData
The onDecodedData delegate is called each time a scanner has successfully decoded the data.

The code updates the text box with the decoded data received after checking if the result is successful.

## CaptureHelper
CaptureHelper is provided as source code. It provides a set of very basic features like enabling disabling barcode symbologies.

## Adding features in CaptureHelper
If a needed feature is not implemented by CaptureHelper, the recommendation is to create an extension of CaptureHelper and copy paste a feature similar from CaptureHelper to the extended one.

Following this recommendation will prevent you from losing the modifications the next time the CocoaPods is updated.

repository: AmeerChand/capturesingleentry-ios

repo_name: AmeerChand/capturesingleentry-ios


text:
# concat-stream-p

[concat-stream](https://github.com/maxogden/concat-stream) is [commitment-phobic](https://github.com/maxogden/concat-stream/pull/40) so I made a promise interface wrapper which accepts all of concat-stream's options.  See [its documentation](https://github.com/NodeGuy/concat-stream/blob/master/readme.md) first.

## Installation

`npm install concat-stream-p`

## Example

```JavaScript
var fs = require('fs')
var concat = require('concat-stream-p')

var readStream = fs.createReadStream('cat.png')

readStream.on('error', handleError)

readStream.pipe(concat()).then(function (imageBuffer) {
  // imageBuffer is all of `cat.png` as a node.js Buffer
})

function handleError(err) {
  // handle your error appropriately here, e.g.:
  console.error(err) // print the error to STDERR
  process.exit(1) // exit program with non-zero exit code
}
```

## Interface

```js
var concat = require('concat-stream-p')
```

### concat(options = {})

Returns a `stream.Writable` that's also a promise of all of the data that
was written to the stream.

license: MIT

repository: NodeGuy/concat-stream-p

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: NodeGuy/concat-stream-p


text:
# video-sharing-project

### Installing the Application
`pip install Flask`
`pip install Flask-SocketIO`
`pip install simple-websocket`

### Running the Application
to run this application, use git bash to get to the repository with the same name as the title and type in: </br>
`py app.py`

### Viewing the Application in the Browser
in your browser go to the URL: </br>
`http://<IP_ADDRESS>:5000/`

#NEVER EVER INSTALL ANYTHING "PYTHON 2.ANYTHING

branch_name: refs/heads/main


text:
# [2017 Day 1](https://adventofcode.com/2017/day/1) Notes

* For part 2, at first, I wished there was a `List.rotate`, but I soon realized I didn't need it.


text:
Doma version 1
========================================

Doma is a Database access framework for Java 6 and above.

Doma uses [Annotation Processing Tool][apt] to generate source code and validate sql mappings at *compile time*.

[![CI](https://github.com/seasarorg/doma/workflows/CI/badge.svg)](https://github.com/seasarorg/doma/actions?query=workflow%3ACI)
[![Google group : doma-user](https://img.shields.io/badge/Google%20Group-doma--user-orange.svg)](https://groups.google.com/g/doma-user)
[![project chat](https://img.shields.io/badge/zulip-join_chat-green.svg)](https://domaframework.zulipchat.com)

Notice
--------

- This is Doma 1.
- The new version Doma 2 is developed at [domaframework/doma](https://github.com/domaframework/doma).

Maintenance Policy
------------------

We accept only bug fixes for Doma 1. We are going to include new features in Doma 2.

Documentation
-------------

http://doma.seasar.org/

Google Group
------------

https://groups.google.com/g/doma-user

Chatroom
---------------------

https://domaframework.zulipchat.com

Build with Maven
----------------

To build with Maven, add the dependency listed below to your pom.xml file:

```xml
<dependency>
  <groupId>org.seasar.doma</groupId>
  <artifactId>doma</artifactId>
  <version>1.38.2</version>
</dependency>
```

In addition, if you use Doma 1.38.0 and below, add the repository listed below to your pom.xml file:

```xml
<repositories>
  <repository>
    <id>maven.seasar.org</id>
    <name>The Seasar Foundation Maven2 Repository</name>
    <url>http://maven.seasar.org/maven2</url>
  </repository>
</repositories>
```

Build Doma 1 from Source
------------------------

Install JDK 8.

Clone the repository and Run the maven command as follows:

```sh
$ git clone https://github.com/seasarorg/doma.git
$ cd doma/doma
$ ./mvnw clean install
```

Issues
------

### version 1.37.0 and above
https://github.com/seasarorg/doma/issues

### version 1.36.0 and below
https://www.seasar.org/issues/projects/DOMA/issues

License
-------

Apache License, Version 2.0

  [apt]: http://docs.oracle.com/javase/6/docs/technotes/guides/apt/index.html

repository: seasarorg/doma

gha_language: Java

repo_name: seasarorg/doma


text:
# Weblog Challenge

## Demo

Run on a Linux box with Java 1.8, maven, and make, run the following in order.

    make download
    make start-cluster
    make build
    make run
    make stop-cluster

Or if you are brave.

    make download start-cluster build run stop-cluster

## Data Exploration

Some simple python plots are made in `explore.ipynb` to validate the ordering of log entires. The conclusion is entries are sometimes out of order by only by small time differences, and we should treat this stream as ordered.

## Tool Selection

This challenge can be thought of as either a batch problem or a streaming problem. Since I have been less practiced on streaming, I took this chance to learn about Flink.

Based on the tutorial, flink 1.10 for scala 2.11 is downloaded and bootstrapped with.

    mvn archetype:generate \
    -DarchetypeGroupId=org.apache.flink \
    -DarchetypeArtifactId=flink-walkthrough-datastream-scala \
    -DarchetypeVersion=1.10.0 -DgroupId=wlc -DartifactId=wlc \
    -Dversion=0.1 -Dpackage=spendreport \
    -DinteractiveMode=false

## Assumptions

* Timestamp and durations are represented as milliseconds (since epoch).
* URLs are parsed to include protocol and parameters, excluding http methods and browser info.
* Sessions shorter than 1 second is considered abnormal and discarded. (~10% of the sessions)
* Most engaged user is ranked by cumulative session time (adding all sessions together) instead of average session time. It is a design decision, either can be accomplished.
* Top 10 most engaged users are calculated.
* Watermark is set to lag event time by 3 seconds.
* Inactivity gap for session breaking is set to 15 minutes.

## Time Windowing

In a streaming scenario, aggregations can only be done with a time window, which should be chosen to reflect business logic. But here since we don't want to produced results sliced by time, it is chosen to be arbitrarily large. (120 hours)

The ideal approach is to use Flink's own session windowing mechanism (`EventTimeSessionWindows.withGap`), but I couldn't get it to work properly.

## Outputs

The processing creates three outputs

1. `session.csv`: IP, SessionStartTime, SessionLength, SessionUniqueUrls.
2. `average.csv`: AverageSessionLength.
3. `engaged.csv`: Constant, IP, CumulativeSessionLength. Top 10 most engaged in descending order.

## Apporach

Flink logic is written in `Wlc.scala`.

First output.

1. Souce is created from reading a local file.
2. Each line is parsed to yield (Timestamp, IP, URL).
3. Timestamp is assigned to the Flink element.
4. Session is keyed by IP and sessionized to create (IP, SessionStartTime, SessionLength, UrlCount (1 if url is new, 0 if url has been counted). A stateful mapper is used.
5. Reduce to find maximum of SessionLength and sum of UrlCount.
6. Filter out sessions with SessionLength less than 1 second.

Second output from first.

1. Reduce to find NumberOfSessions and sum of SessionLength.
2. Divide both to produce average.

Third output from first.

1. Keyed by IP to find sum of SessionLength.
2. Apply TopK aggregator to find IPs with largest sum.

Operations / helpers are written in `Ops.scala`, unit tests are included.

1. Parser for log lines.
2. Mapper for sessionization.

## Improvements

* Preliminary validation is done against the exploration results, but in depth validation from other source should be done before we can trust the pipeline.
* Inactivity gap, session cut off, and watermark lag can be tuned based on analysis of result and business needs.
* Utilize user agent data (os, type, version) in addition to IP to identify different users.
* Flink's `keyBy` is used redundantly a few times. More research may yield a workaround.
* Flink's `timeWindow` is used repeatedly over the same stream. More research may yield a workaround.
* If Flink's session windowing is not going to be used, it is redundant to assign event time and watermark.
* Find more scalable ways to implement the custom algorithms including deduplicatioin of URLs and TopK.

## References

https://ci.apache.org/projects/flink/flink-docs-release-1.10/getting-started/walkthroughs/datastream_api.html

https://ci.apache.org/projects/flink/flink-docs-stable/dev/stream/operators/

https://ci.apache.org/projects/flink/flink-docs-stable/dev/stream/operators/windows.html#global-windows

https://ci.apache.org/projects/flink/flink-docs-stable/getting-started/tutorials/local_setup.html

https://github.com/apache/flink/blob/master/flink-examples/flink-examples-streaming/src/main/scala/org/apache/flink/streaming/scala/examples/windowing/SessionWindowing.scala

https://scastie.scala-lang.org/

https://www.scala-lang.org/api/current/scala/collection/mutable/PriorityQueue.html

repository: bettercallshao/wlc-mucho-frio

repo_name: bettercallshao/wlc-mucho-frio


text:
# lazy-text

An element which will slowly show text like it is being typed.  Optionally it will show a cursor.

# Example

    <lazy-text text="Hello World"></lazy-text>

# Demo and documentation

  http://vision89.github.io/lazy-text/components/lazy-text/

# License

  New BSD

# Styles
  You can update the style of this element using the --lazy-text-theme mixin

# Events
  Fires a 'text-typed' event when it's finished typing the text


text:
---
order: 1
---

# Django Settings

You can customize many aspects of [Django Data Wizard] through the configuration.  For many projects, the default configuration (shown below) will be sufficient.

```
DATA_WIZARD = {
    'BACKEND': 'data_wizard.backends.threading',
    'LOADER': 'data_wizard.loaders.FileLoader',
    'IDMAP': 'data_wizard.idmap.existing',
    'AUTHENTICATION': 'rest_framework.authentication.SessionAuthentication',
    'PERMISSION': 'rest_framework.permissions.IsAdminUser',
    'AUTO_IMPORT_TASKS': (
        'data_wizard.tasks.check_serializer',
        'data_wizard.tasks.check_iter',
        'data_wizard.tasks.check_columns',
        'data_wizard.tasks.check_row_identifiers',
        'data_wizard.tasks.import_data',
    ),
    'ROW_LOGGER': 'data_wizard.tasks.create_record',
}
```

### `DATA_WIZARD['BACKEND']`

Setting | Description
---|---
`"data_wizard.backends.threading"` (default) | Run processing tasks asyncronously in a separate lightweight thread.
`"data_wizard.backends.immediate"` | Run tasks in the same thread (blocking the server response until complete)
`"data_wizard.backends.celery"` | Send tasks to a separate celery daemon

See [backends] for more details on how to configure the Celery backend.

### `DATA_WIZARD['LOADER']`

Setting | Description
---|---
`"data_wizard.loaders.FileLoader"` (default) | Load file data from a `file` attribute on the [source model][models] instance.
`"data_wizard.loaders.URLLoader"` | Make a request to the `url` specified in the source model.
(Path to class) | [Custom loader][loaders]

See [loaders] for more details on how to configure the default loaders, or create custom ones.

### `DATA_WIZARD['IDMAP']`

Setting | Description
---|---
`"data_wizard.idmap.existing"` (default) | Automatically map existing IDs, but require user to map unknown ids
`"data_wizard.idmap.never"` | Require user to manually map all IDs the first time they are found in a file
`"data_wizard.idmap.always"` | Always map IDs (skip manual mapping).  Unknown IDs will be passed on as-is to the serializer, which will cause per-row errors unless using natural keys.
(Path to function) | Custom mapping function (see below)

If a custom function is defined, it should accept an identifier and a serializer field, and return the mapped value (or `None` if no automatic mapping is available).  See the [built-in functions][idmap.py] for examples.

Note that the configured `IDMAP` function will only be called the first time a new identifier is encountered.  Once the mapping is established (manually or automatically), it will be re-used in subsequent wizard runs.

### `DATA_WIZARD['AUTHENTICATION']`

Setting | Description
---|---
`"rest_framework.authentication.SessionAuthentication"` (default) | Leverage existing `django.contrib.auth` session cookie.
(Path to class) | Any Django REST Framework [authentication class][authentication][

Note that `DATA_WIZARD['AUTHENTICATION']` is intentionally configured separately from `REST_FRAMEWORK['DEFAULT_AUTHENTICATION_CLASSES']`.  This is to avoid potential conflicts in projects that provide Django REST Framework APIs for a completely different set of users than those that will be using the Data Wizard.

### `DATA_WIZARD['PERMISSION']`

Setting | Description
---|---
`"rest_framework.permissions.IsAdminUser"` (default) | Only allow Admin users to start new Data Wizard import runs.
`"rest_framework.permissions.IsAuthenticated" | Allow any authenticated user
(Path to class) | Any Django REST Framework [permission class][permissions]

Note that `DATA_WIZARD['PERMISSION']` is intentionally configured separately from `REST_FRAMEWORK['DEFAULT_PERMISSION_CLASSES']`.  This is to avoid potential conflicts in projects that provide Django REST Framework APIs for a completely different set of users than those that will be using the Data Wizard.

### `DATA_WIZARD['AUTO_IMPORT_TASKS']`

This list defines the sequence of tasks to execute when running the [auto] API.  The default list is recommended for most projects.

Task | Description
-----|-------------
`data_wizard.tasks.check_serializer` | Ensure that a registered serializer (target model) is selected
`data_wizard.tasks.check_iter` | Ensure that the file data can be loaded from the source model
`data_wizard.tasks.check_columns` | Ensure that columns from the source file can be mapped to fields in the target model serializer
`data_wizard.tasks.check_row_identifiers` | Ensure that foreign key values can be resolved (if present)
`data_wizard.tasks.import_data` | Import each row from the source file to the target model

See [tasks] for more details on how to define custom processing tasks.

### `DATA_WIZARD['ROW_LOGGER']`

This function is used to log the result of each row imported in import_data.  The default function (`data_wizard.tasks.create_record`) creates a [Record][models] entry for each row.  The Record's [GenericForeignKey] will be pointed to the imported row in the target model.  This functionality assumes that the target model has an integer primary key.  If this is not the case, override `ROW_LOGGER` to log the results to a different location, or disable it entirely.  The function should accept `run`, `row`, `content_object`, `success`, and `fail_reason` as arguments.

[Django Data Wizard]: ./index.md
[models]: ./models.md
[backends]: ./backends.md
[loaders]: ./loaders.md
[auto]: ./api/auto.md
[tasks]: ./tasks.md
[authentication]: https://www.django-rest-framework.org/api-guide/authentication/
[permissions]: https://www.django-rest-framework.org/api-guide/permissions/
[GenericForeignKey]: https://docs.djangoproject.com/en/4.2/ref/contrib/contenttypes/#django.contrib.contenttypes.fields.GenericForeignKey

[idmap.py]: https://github.com/wq/django-data-wizard/blob/master/data_wizard/idmap.py

repository: wq/django-data-wizard

gha_language: Python

gha_license_id: MIT

repo_name: wq/django-data-wizard


text:
---
layout: post
title:      "How to cope with learning to scope"
date:       2020-05-18 04:18:20 +0000
permalink:  how_to_cope_with_learning_to_scope
---

The hardest part with writing a blog is starting, so here I go. For the last 3 weeks I've been working on my Ruby on Rails (mod 3) project for flatiron school.  For those of you who do'nt know what a CRM is or stands for it is a Customer Relationship Management (CRM) s a technology for managing all your company's relationships and interactions with customers and potential customers. One thing it does is help companies stay connected to customers. One requirement of the rails project is to implement a scope or query method and use it in the application. While never using one once before or ever seeing really anything like it I had to deep dive to really understand what it was. Here's what I learned.

First of all, you might be wondering what a scope method even is, a scope method is a custom query that you can define inside of a select model to retrieve either an instance/instances and you can also use them to pull data pertaining to attributes of a model.  Scope methods are a lot like class methods but there is a big difference at the same time. Scope methods return a relation object which means you can call another scope or active record querying method on it and kind of chain them together if you wanted. The specific query method I used for my application was order. I wanted to figure out a way where I can take my organization model (or company) and retireve the three highest revenue generating companies and display those three in my organization index view.

In order to to complete the task of ordering the companies with the three highest revenues the first thing I had to do was define the scope method In my organization model.

```     scope :highest, -> {order("revenue DESC").limit(3)} ```

with the line of code above we are defining the method scope called :highest, using a lambda ( -> ) to point to what query method we want to use in my case I used order. After that inside the next set of parenthesis inside of the quotes is where I pick the name of the attribute I used which was revenue. Taking all of the organizations in the database and setting them up to order by descending which starts at the top and goes down and then limiting the output of the oragnizations to only show the top 3 companies.

After doing that the next step is to go to that particular controller and find the action of the view you want to display these changes to. In my case it was the index action.

```  def index
        @organizations = Organization.highest
    end ```

		Here I'm setting the instance variable @organizations to make it more flexible and so I'm able to call on it inside the index view and display the top 3 revenue generators.

		The last and final step to display it is to use an erb tag ( <% %> ) inside of that you call on the @organizations instance variable that we created above and iterate over it and display the data in the view

		``` <% @organizations.each do |org| %>
    <ul style="list-style-position:inside; border-style: solid; border-width: 4px; border-radius: 15px; width: 300px; height: 550px; padding: 10px;" >
            <h4><li> Name:</li> </h4>
             <%= org.name %>
    <br><br>

    <h4><li> Amount of revenue:</li> </h4>
         <%= org.revenue %>
    <br><br>

    <h4><li> Country:</li> </h4>
         <%= org.country %>
    <br><br>

    <h4><li> State:</li> </h4>
         <%= org.state %>
    <br><br>

    <h4><li> Address:</li> </h4>
         <%= org.address %>
    <br><br>

    <h4><li> Customer:</li> </h4>
         <% if org.customer == true %>
         yes
        <% else %>
        no
    <% end %>

    <br><br>

     <%= link_to "Edit Organization", edit_organization_path(org) %>
    <br><br>

     <%= link_to "Delete Organization", organization_path(org), method: :delete, data: { confirm: "Really?" }%>
    <br><br>

    <br><br>
</ul>
<br><br>
<% end %> ```

Just like that we get the top 3 organizations that generated the most money.

extension: markdown

gha_language: JavaScript


text:
##Project name
DELANI STUDIO

##Project description
This is a website application where  the designers create and emplement visual design and workflows,
solicit user feedback and work with you to make sure that what gets built is what is needed
while the collaborate with your team to write, and improve code on daily basis, using proven
practices such as test-driven development and pair programming.
which allows the business requirements to evolve

##Authors information
Name:Trever Omondi Akumu
A student at Moringa school passionate about computer programming

##Setup instructions
When the service icons are clicked they are supposed to show what has been written inside the icons when clicked
Also it is important to fill the contact form
also the social icons should take you to every social media account the website when they are clicked

##BDD
The website encourages the user and developers have a conversation on how to create what the clients want for better production results which are resulted by evolving of business requirements

##Technologies used
Index.html
style.css
bootstrap.css
script.js

##Contact information
<EMAIL_ADDRESS>
##license and copyright information
MIT license


text:
# List Details page

The list-details page has a list pane and a details pane for content. When an item in the list is selected, the details pane is updated. This pattern is frequently used for email and address books.

repository: microsoft/TemplateStudio

gha_language: Rich Text Format

gha_license_id: NOASSERTION

repo_name: microsoft/TemplateStudio


text:
# cleandocker

`cleandocker` is a small bash script for cleaning up stale docker things.

# Usage

Simply run the `cleandocker` script with permissions to use docker. It will, by default, do nothing. You can enable various cleanup features by adding options to your invocation.

| Option | Description |
| ------ | ----------- |
| `-f` | *kill* any running containers |
| `-c` | *remove* all non-running containers, including any it may have killed in the `-f` step. |
| `-i` | remove any *untagged* images |
| `-v` | remove any *dangling* volumes |
| `-d` | do a dry run of all actions without actually doing anything harmful |
| `-h` | Print help message |
| `-p` | Run `docker system prune` |

# Example

The following command would kill all running docker containers, then remove all stopped containers (including those killed earlier), and then remove any docker images that are untagged.

```bash
sudo ./cleandocker -fci
```

# License

`cleandocker` is released under the MIT License. Please see the `LICENSE` file for details.

repository: mcoffin/cleandocker

gha_language: Shell

repo_name: mcoffin/cleandocker


text:
[![DOI](https://zenodo.org/badge/383424760.svg)](https://zenodo.org/badge/latestdoi/383424760)

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/jakob-beetz/ifcopenshell-binder/main?urlpath=git-pull%3Frepo%3Dhttps%253A%252F%252Fgithub.com%252Fjakob-beetz%252Fifcopenshell-notebooks%26urlpath%3Dlab%252Ftree%252Fifcopenshell-notebooks%252F00_introduction.ipynb%26branch%3Dmain)

![screenshot of jupyter=notebook](img/screenshot-ifc-notebook.png)

# ifcopenshell-notebooks
Interactive Jupyter Notebooks to teach working with IFC files using ifcopenshell with python.

These Notebooks are part of mandatory classes for Bachelor students of [Architecture at the RWTH Aachen University](https://arch.rwth-aachen.de/go/id/gfa/) and have advanced versions for MSc levels. The notebooks usually run on the [Jupyter Hub of the RWTH Aachen](https://jupyter.rwth-aachen.de) but can be run on other Jupyter Notebook VMs.
They are published ass [Open Educational Resources](https://en.unesco.org/themes/building-knowledge-societies/oer)

<img src="https://upload.wikimedia.org/wikipedia/commons/2/20/Global_Open_Educational_Resources_Logo.svg" width="200"/>

To run the notebooks interactively, click the binder link above, a few seconds patience and you will be able to enjoy:
- Integrated IFC Viewer with bidirectional ability to
  - select from script, get selection from mouse to script
  - see attributes of building element instances
  - set visibility, colors and transparancy from script
- display model structure using GraphViz Dot
![dot vizualization](img/ifc-graph-plot.png)
- Browse IFC 2x3 and IFC 4 documentation right in your notebook `IfcHelp.getHelp3("IfcDoor")`
![documentation in browser](img/ifchelp-example-ifcdoor.png)
- use pandas, numpy etc. to do calculations on models
- reach through to the powerfull OpenCascadeKernel

If you like the work, please
- cite it, please use this DOI [![DOI](https://zenodo.org/badge/383424760.svg)](https://zenodo.org/badge/latestdoi/383424760)
- sponsor [aothms](https://github.com/aothms) and [tpaviot](https://github.com/tpaviot/) whose great work this is based upon
- write s.th. into the forum, add a pull request
- help improve it!
- come to RWTH to study with us!
- more ideas are welcome

repository: jakob-beetz/ifcopenshell-notebooks

gha_language: Jupyter Notebook

repo_name: jakob-beetz/ifcopenshell-notebooks


text:
# Babylonjs texture generator

## About

This is a tool that generates PVRTC, ETC1, ETC2, ASTC, DXT textures from png and jpg files. It can run on node or as a gulp task.

It is meant to work with [Babylon.js](https://github.com/BabylonJS/Babylon.js). The tool is a port of two [.bat files](https://github.com/BabylonJS/Babylon.js/tree/master/Tools/CompressedTextured).

## Installation

In order to use the tool, you need to have installed:

* PVRTexToolCLI ([download](https://www.imgtec.com/developers/powervr-sdk-tools/installers/))
* ASTC Evaluation Codec ([download](https://github.com/ARM-software/astc-encoder/tree/master/Binary))
* Add *ASTC Evaluation Codec* to your path, a process which depends on your OS. ([documentation](http://cdn.imgtec.com/sdk-documentation/PVRTexTool.User+Manual.pdf) at page 5)
* Run `npm run build` in terminal

## Usage

Import/require the exposed function `generateTextures` to your script. It accepts one argument as an object with the following attributes:

* `PVRTexToolCLI` - *string*: The absolute path to the PVRTexToolCLI tool.
* `inputDir` - *string*: The directory where the image files are located. It will be read recursively and all the images will be used in order to generate the new textures.
* `quality` - *string (optional), (options "low"/"high", default: "high")*: The quality of the exported textures.
* `exportFormats` - *string[] (optional) (options "PVRTC"/"ETC1"/"ETC2"/"ASTC"/"DXT", default: ["PVRTC", "ETC1", "ETC2", "ASTC", "DXT"])*: The format of the exported textures.
* `async` - *boolean (optional, default: false)*: Whether the task should run asynchronously.

Example usage:
```javascript
import generateTextures from "babylonjs-texture-generator";
// Alternatively
// const generateTextures = require("babylonjs-texture-generator");

createGpuTexture({
    PVRTexToolCLI: "/Applications/Imagination/PowerVR_Graphics/PowerVR_Tools/PVRTexTool/CLI/OSX_x86/PVRTexToolCLI",
    inputDir: "/src",
    quality: "high",
    async: false,
    exportFormats: ["PVRTC", "ETC1", "ETC2", "ASTC", "DXT"]
});
```

### Limitations

Currently DXT files can not be exported on MacOS.

gha_language: TypeScript


text:
---
layout: post
title: Bloom Filters for Table Lookups
date: 2019-07-08 13:55:00 +02:00
---

{{ page.title }}
================

**What is a bloom filter?** A [Bloom filter](https://en.wikipedia.org/wiki/Bloom_filter) is a bit-array of a fixed size `m`. A (hash-) function is defined, which gives `k` different values within the range `[0...m-1]`. Two functions are defined on this structure, `add()` and `lookup()`

Pseudo-Code for a `m=1024, k=3`-Bloom Filter:
```go
var filter [1024]bool

func hash(key string) (k0,k1,k2 int)

func add(key string) {
    k0,k1,k2 := hash(i)
    filter[k0] = true
    filter[k1] = true
    filter[k2] = true
}

func lookup(key string) bool {
    k0,k1,k2 := hash(i)
    return filter[k0] && filter[k1] && filter[k2]
}
```

A Figure of a `m=18, k=3`-Bloom Filter.

![Bloom Filter](https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/Bloom_filter.svg/640px-Bloom_filter.svg.png)

### Using a Bloom Filter for Table Lookups

Let's apply these Rules to a Table. In this (stupid) example, we have one key-value pair per row and one key per bloom filter. Our bloom filter will be `m=1024, k=3`!

```sql
-- SQL-Pseudocode.
CREATE TABLE bloom_table_v1 (
    row_bloom bit[1024], -- per-row bloom filter.
    row_key text,
    row_value text
);
```

Now, lets code a Lookup.

```sql
SET lookup_key = ?::text;
SET k0,k1,k2 = hash(lookup_key);
SELECT row_value FROM (
    SELECT * FROM bloom_table_v1
    WHERE row_bloom[k0] AND row_bloom[k1] AND row_bloom[k2]
) WHERE row_key = lookup_key;
```

Now lets code another table, where we have multiple key-value pairs per row.

```sql
-- SQL-Pseudocode.
CREATE TABLE bloom_table_v2 (
    row_bloom bit[1024], -- per-row bloom filter.
    row_kvs hstore
);
```

And the lookup code for this.

```sql
SET lookup_key = ?::text;
SET k0,k1,k2 = hash(lookup_key);
SELECT row_kvs[lookup_key] FROM bloom_table_v2
WHERE row_bloom[k0] AND row_bloom[k1] AND row_bloom[k2];
```

#### Using compressed Bitmaps

So, while the algorithm showed above is a stupid linear search, we can represent the 1024-wide bit-array as a collection of columns (`row_bloom[0],row_bloom[1],...,row_bloom[1022],row_bloom[1023]`), each represented as a compressed bitmap (such as [Roaring Bitmaps](http://roaringbitmap.org/)), on which boolean set-operations can be computed efficiently.

Using this technique, in some cases, we can achieve a considerably greater performance and compactness, than the use of a B-Tree. This technique can also handle sparse indeces with ease.

Note: The write-performance can be considerably lower, as we need to update alot of columns on every insert.


text:
# eslint-plugin-react-redux
> Find issues with react-redux code usages

[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)

## Installation

You'll first need to install [ESLint](http://eslint.org):

```bash
$ npm i eslint --save-dev
```

Next, install `eslint-plugin-react-redux`:

```bash
$ npm install @pgilad/eslint-plugin-react-redux --save-dev
```

**Note:** If you installed ESLint globally (using the `-g` flag) then you must also install `eslint-plugin-react-redux` globally.

## Usage

Add `react-redux` to the plugins section of your `.eslintrc` configuration file.

```json
{
    "plugins": [
        "@pgilad/eslint-plugin-react-redux"
    ]
}
```

Then configure the rules you want to use under the rules section.

```json
{
    "rules": {
        "@pgilad/react-redux/use-selectors-on-state": 1
    }
}
```

## Supported Rules

- [use-selectors-on-state](docs/rules/use-selectors-on-state.md)

## License

MIT

repository: pgilad/eslint-plugin-react-redux

repo_name: pgilad/eslint-plugin-react-redux


text:
Pattern: Improper arguments for `raise`/`fail`

Issue: -

## Description

This rule checks the args passed to `fail` and `raise`. For exploded
style (default), it recommends passing the exception class and message
to `raise`, rather than construct an instance of the error. It will
still allow passing just a message, or the construction of an error
with more than one argument.

The exploded style works identically, but with the addition that it
will also suggest constructing error objects when the exception is
passed multiple arguments.

## Examples

```ruby
# EnforcedStyle: exploded

# bad
raise StandardError.new("message")

# good
raise StandardError, "message"
fail "message"
raise MyCustomError.new(arg1, arg2, arg3)
raise MyKwArgError.new(key1: val1, key2: val2)
```
```ruby
# EnforcedStyle: compact

# bad
raise StandardError, "message"
raise RuntimeError, arg1, arg2, arg3

# good
raise StandardError.new("message")
raise MyCustomError.new(arg1, arg2, arg3)
fail "message"
```

## Default configuration

Attribute | Value
--- | ---
EnforcedStyle | exploded
SupportedStyles | compact, exploded

## Further Reading

* [RuboCop - Style/RaiseArgs](https://docs.rubocop.org/rubocop/cops_style.html#styleraiseargs)
* [https://github.com/bbatsov/ruby-style-guide#exception-class-messages](https://github.com/bbatsov/ruby-style-guide#exception-class-messages)

repository: Adroiti/docs-for-code-review-tools

repo_name: Adroiti/docs-for-code-review-tools


text:
* * *
Back to [README](../README.md) at root of the Repo.
* * *

# How to Deploy the homedig2 solution?

## Docker Images

The solution is deployed using several docker containers, some as a joint service. Our's is deployed on a RaspberryPi 3B+, as at writing of this document, we use the following images on http://hub.docker.com :

|# | For ...     | Image                    | More Info     |
|--|-------------|--------------------------|---------------|
|1 | mqtt server | eclipse-mosquitto:latest | mqtt          |
|2 | homeBridge  | oznu/homebridge          | opensource Apple HomeKit server |
|3 | Node-RED    | nodered/node-red         | it's obvious ... 8-) |

## 3 x Docker Containers using Node-RED image
We fire-up three instances of Node-RED using Docker Services:

|#| Docker Container | Purpose   |
|-|------------------|-----------|
|1| home_dig2base    | The base homedig2 system, as per the [interaction diagram](1_homedig2_how.md).
|2| home_dig2test    | All the events to test all aspect of the base system.
|3| home_dig2custom  | All the non-generic stuff, in our case we have a sprinkler system here.

## How we install & maintain the solution
We use the opensource version of [Ansible](http://ansible.com) to configure and setup the full system. IoTPlay have published a zsh-based menu script (new on macOS Catalina - replaced bash) to envoke the ansible playbooks - which configures the full system.

<details>
  <summary> See the menu we use to configure & manage the full system - expand this view... </summary>

```
==== MENU SYSTEM: 12) IoTPlay-Digital Twin (homedig2_v021)---, with inv_limit:[Prod_rhome], menu host: [rh02.home.lan] ===============
0 : Passphrase for the ssh id_rsa
1 : MENU: Change to menu (1) - Home (homedig2 v021)
2 : Edit the inventory_limit variable, inv_limit:[Prod_rhome]
3 :
4 : Mosquitto: PREP in files /opt/iotplay/rhm_mqtt
5 : Mosquitto: DEPLOY Mosquitto
6 : Mosquitto: REMOVE for RouxHome
7 :
8 : HomeBridge   : BUILD & DEPLOY oznu
9 : HomeBridge   : Stop
10 : HomeBridge   : DEPLOY oznu
11 : Homebridge   : rh02.home.lan:8080 (login: admin/admin), 2) edit Config - add mqtt platform, 3) add plugin Homebridge Mqtt, 4) restart server
12 :
13 : homedig2: Copy iotp Settings to Host
14 : Docker Services: Start Node-RED homedig2 (base, test, custom)
15 : Docker Services: Remove Services
16 :
17 :
18 :
19 :
20 : Web: Open Node-RED homedig2 BASE   UI    sites on rh02.home.lan:1890
21 : Web: Open Node-RED homedig2 BASE   Admin sites on rh02.home.lan:1890
22 : Web: Open Node-RED homedig2 TEST   Admin sites on rh02.home.lan:1891
23 : Web: Open Node-RED homedig2 CUSTOM Admin sites on rh02.home.lan:1892
24 :
25 :
26 : PREP: Setup~ Create folders, Copy iotp_conf, Start Docker Services, Edit Node-RED settings.js, Restart Docker
27 : PREP: Create Folders .../iotplay/homedig2base/data/projects/   (to copy secret keys)
28 : PREP: Create Folders .../iotplay/homedig2test/data/projects/   (to copy secret keys)
29 : PREP: Create Folders .../iotplay/homedig2custom/data/projects/ (to copy secret keys)
30 : PREP: Clone NR projects from bitbucket from within Node-RED admin clients, in sites opened, (add on pallette: node-red-dashboard)
----------------------------------------------------------------------
..cmdline 1 = <1..x> - for the action.
----------------------------------------------------------------------

```
</details>

## Pre-requisites
Some pre-req's to running a successful system:
- Setup your home's config files, see [2a_Setup_Homie.md](2a_Setup_Homie.md), and [2_Setup_HomeBridge.md](2_Setup_HomeBridge.md).
- Clone the 2x Node-RED code (not yet published!) - of homedig2, namely the BASE, and TEST sets. The 3rd one will be your custom code.

## Sample Ansible Playbooks

Find an extract from an Ansible playbook which uses **docker_compose** command, to build the 3 Node-RED containers & the service. It uses several variables, contact us if you need explanations on them (we carry for instance install locations in an Ansible variables file, and the image to pull, etc.).
<details>
<summary>Expland here for Ansible playbook for the Docker Service...</summary>

``` yaml
---
hosts: all

  tasks:

  # --(4ai)  ---- arm    ~ Docker Compose of Multiple Services | tags: dockerservices / setup -----
    - name: 4a. Docker Compose Start Services (base, test, custom) # docker_service was deprecated
      docker_compose:
        project_name: home #Short for Rouxhome, the prefix to the Services
        definition:
          version: '3'
          services:
          # --------- dig2base ---------------------------------------------------
            dig2base: # homedig2
              hostname: home_dig2base
              image: "{{image.nodered}}" # "{{image.nodered}}:{{archtag}}"
              environment:
                - NODE_ENV=PROD
                - TZ="Africa/Johannesburg"
                #- NODE_ENV_VER=0.1.33
              ports:
                - "1890:1880"
              expose:
                - 1880
              volumes:
                - '{{folder.apps}}/{{ clientVars.name }}base/data:/data'
                # Does not work on Mac:
                # - /etc/localtime:/etc/localtime:ro
                # - /etc/timezone:/etc/timezone:ro
              #depends_on:
              #  - mqtt
              restart: always
          # --------- dig2test ---------------------------------------------------
            dig2test:
              hostname: home_dig2test
              image: "{{image.nodered}}" # "{{image.nodered}}:{{archtag}}"
              environment:
                - NODE_ENV=PROD
                - TZ="Africa/Johannesburg"
                #- NODE_ENV_VER=0.1.33
              ports:
                - "1891:1880"
              expose:
                - 1880
              volumes:
                - '{{folder.apps}}/{{ clientVars.name }}test/data:/data'
              #depends_on:
              #  - mqtt
              restart: always
          # --------- custom -----------------------------------------------------
            dig2custom:
              hostname: home_dig2custom
              image: "{{image.nodered}}" # "{{image.nodered}}:{{archtag}}"
              environment:
                - NODE_ENV=PROD
                - TZ="Africa/Johannesburg"
                #- NODE_ENV_VER=0.1.33
              ports:
                - "1892:1880"
              volumes:
                - '{{folder.apps}}/{{ clientVars.name }}custom/data:/data'
              #depends_on:
              #  - mqtt
              restart: always
      when: ansible_architecture == 'armv6l' or ansible_architecture == 'armv7l'
      #when: ansible_architecture == "x86_64"
      tags:
        - dockerservices
        - setup
```

</details>

If anyone wants to seriously use the Ansible playbooks & the menu structure to get homedig2 up and running, contact us.

* * *
Back to [README](../README.md) at root of the Repo.
* * *


text:
# Deployment & Scale Guide

## Deploy the Solution ##

### 1. Deploy Core Resources ###
1. Deploy the main.json ARM template to your Azure Resource Group. This will create masters, node groups and nodes.
2. Modify then run configure-cluster.sh on your local machine (Modify the first section of the script that includes the parameters. *You will need to do that everytime you add a node or a node group).

> The configuration script ssh into masters for configuration, then ssh into master-0 to configure nodes un-comment the last line to remove the ssh keys from master-0

### 2. Deploy Kubernetes UI ###
 1. Deploy /kubernetes-ui/kubernetes-dashboard-service.yaml via *kubctl.sh create -f ...*
 2. Deploy /kubernetes-ui/kubernetes-dashboard-deployment.yaml via *kubctl.sh create -f ...*

> The above creates kubernetes ui component on http://<IP_ADDRESS>:8080/ui. Tip: tunnel into one of the Masters using ssh <cluster dns label>:500X -L 9000:<IP_ADDRESS>:8080 and use your local machine browser to access the UI and run kubectl.sh localy.

### 3. Deploy Kubernetes DNS ###
1. Deploy /kubernetes-dns/kubernetes-dns-rc.yaml
2. Deploy /kubernetes-dns/kubernetes-dns-svc.yaml

This will create your dns service listening on <IP_ADDRESS>:53 (use [selector or node affinity](http://kubernetes.io/docs/user-guide/node-selection/)  if you want to anchor the DNS service to specific node group). The default cluster domain used cluster.local You can modify accordingly.

## 4. Add New Node Group to Existing Cluster ##
1. General Purpose Compute Node Groups
	- create-node-group.json with parameters.create-node-group.json (sample only you have to modify)
2. Node Groups with ILB
	- create-node-group-ilb.json with parameters.create-node-group-ilb.json (sample only you have to modify)
> The ilb will be deployed with IP = 11.<node group index>.255.4
3. Node Group with LB
	- create-node-group-lb.json with parameters.create-node-group-lb.json (sample only you have to modify)

> In all cases after ARM deployment adjust configure-cluster.sh and re-run it on your local machine.

note: you can modify NSG as needed to accommodate specific network lock down requirements.

## Add New Node in Existing Node Group ##

1. Depending on your need you can use create-node.json (or modify it to include it in an existing lb or ilb).
2. Modify configure-cluster (first section, the parameters section) then run it on your local machine.

## Create New Node Group Type ##
For Example: to accommodate specific VM H/W type, OS type or using different storage accounts/storage account types for this node group.

1. Create a copy of one of the create-node-group-*.json files.
2. Modify the template as needed.
3. Deploy the template to your ARM resource group.
4. Modify and run configure-cluster.sh

> if you need different node bootstrap steps then create a copy of node-bootstrap.sh and modify it accordingly.

# Add New Node Group Set (scale beyond 400 nodes) #
![Multiple Node Sets](/docs/img/multiple-node-sets.png)

1. Create a new VNET with at least one address space that is not <IP_ADDRESS>/8 for example choose <IP_ADDRESS>/8.
2. Ensure that the masters ilb at <IP_ADDRESS> is route-able to, from the new VNET.
3. Modify create-node-group*.json files and deploy accordingly.
4. Modify configure-cluster.sh and re-run them to bootstarp the new nodes.

> The bootstrap-node.sh script labels the nodes according to group index. you may want to consider different label scheme for the new node set.

# Scaling Masters#

## Scale up Masters ##
In this solution masters perform considerable disk i/o (for etcd which currently uses raft algorithm). Consider the following:

1. Use Azure Premium Storage (SSD Backed) for master.
2. Consider adding additional disks to masters for etcd specific data (those can be SSD backed).refer to [etcd Admin Guide](https://coreos.com/etcd/docs/latest/admin_guide.html) for more info on changing wal and data directory location.

> the solution by default creates different storage accounts for masters (mapped 1:1)

## Scale out Masters ##
You can manually add masters to master VM AvSet then configure it. follow [etcd Runtime Re-Configuration](https://coreos.com/etcd/docs/latest/runtime-configuration.html) to learn more.

repository: khenidak/kubernetes-azure

repo_name: khenidak/kubernetes-azure


text:
# Galaxy Atom Syntax Theme

An out of this world theme composed of all the colors of the galaxy. For the code voyagers of this world. This syntax contains support and customized highlighting for HTML, LESS, Jade, JSON, Markdown, Mustache, YAML and more!

## Installation

Use `apm` to get galactic real quick

```
apm install galaxy-syntax
```

## More Galaxy

I'm pretty OCD about my whole desktop matching, that being said I have also created an iTerm theme, a Sublime Text 3 Theme & UITheme as well as Galaxy Light. Also, an Atom UI theme is in the works. Get all of that great stuff here:

- [Sublime Text Theme & UI](https://github.com/rossedman/galaxy-theme)
- [iTerm Theme](https://github.com/rossedman/galaxy-iterm)
- [Atom Galaxy Syntax Light](https://github.com/rossedman/galaxy-light-syntax)

## Screenshots

Here are some screenshots below. This is using Atom's One Dark UI kit and is highly recommended!

![A screenshot of your theme](https://github.com/rossedman/galaxy-syntax/blob/master/screenshots/galaxy-php.png?raw=true)
![A screenshot of your theme](https://github.com/rossedman/galaxy-syntax/blob/master/screenshots/galaxy-ruby.png?raw=true)
![A screenshot of your theme](https://github.com/rossedman/galaxy-syntax/blob/master/screenshots/galaxy-javascript.png?raw=true)
![A screenshot of your theme](https://github.com/rossedman/galaxy-syntax/blob/master/screenshots/galaxy-markdown.png?raw=true)
![A screenshot of your theme](https://github.com/rossedman/galaxy-syntax/blob/master/screenshots/galaxy-html.png?raw=true)

repository: rossedman/galaxy-syntax

gha_language: CSS

repo_name: rossedman/galaxy-syntax


text:
### Cake Thief

You are a renowned thief who has recently switched from stealing precious metals to stealing cakes because of the
insane profit margins. You end up hitting the jackpot, breaking into the world's largest privately owned stock of
cakes - the vault of the Queen of England.

While Queen Elizabeth has a limited number of types of cake, she has an unlimited supply of each type.

Each type of cake has a weight and a value, stored in objects of a CakeType class:
```
public class CakeType {

    final int weight;
    final int value;

    public CakeType(int weight, int value) {
        this.weight = weight;
        this.value  = value;
    }
}
```

For example:
```
// weighs 7 kilograms and has a value of 160 shillings
new CakeType(7, 160);

// weighs 3 kilograms and has a value of 90 shillings
new CakeType(3, 90);
```

You brought a duffel bag that can hold limited weight, and you want to make off with the most valuable haul possible.

Write a method maxDuffelBagValue() that takes an array of cake type objects and a weight capacity, and returns the
maximum monetary value the duffel bag can hold.

For example:
```
CakeType[] cakeTypes = new CakeType[] {
    new CakeType(7, 160),
    new CakeType(3, 90),
    new CakeType(2, 15),
};

int capacity = 20;

maxDuffelBagValue(cakeTypes, capacity);
// returns 555 (6 of the middle type of cake and 1 of the last type of cake)
```

Weights and values may be any non-negative integer. Yes, it's weird to think about cakes that weigh nothing or duffel
bags that can't hold anything. But we're not just super mastermind criminals - we're also meticulous about keeping
our algorithms flexible and comprehensive.

repository: RommelTJ/ExercisesAndAlgorithms

repo_name: RommelTJ/ExercisesAndAlgorithms


text:
# SoftPosit.jl
[![CI](https://github.com/milankl/SoftPosit.jl/actions/workflows/CI.yml/badge.svg)](https://github.com/milankl/SoftPosit.jl/actions/workflows/CI.yml)
[![DOI](https://zenodo.org/badge/183233999.svg)](https://zenodo.org/badge/latestdoi/183233999)

A pure Julia implementation for posit arithmetic. Posit numbers are an alternative to floating-point numbers.
Posits extend floats by introducing regime bits that allow for a higher precision around one, yet a wide
dynamic range of representable numbers. For further information see [posithub.org](https://posithub.org).

v0.5 respects the [2022 Standard for Posit Arithmetic](https://posithub.org/docs/posit_standard-2.pdf) but drops
quire support. v0.4 implements the previous standard, has quire support but depends on the C implementation of
[SoftPosit](https://gitlab.com/cerlane/SoftPosit).

If this library doesn't support a desired functionality or for anything else, please
[raise an issue](https://github.com/milankl/SoftPosit.jl/issues).

# Installation

In the Julia REPL do

```julia
julia>] add SoftPosit
```

where `]` opens the package manager. Then simply `using SoftPosit` which enables all of the functionality.

# Posit formats

SoftPosit.jl emulates and exports the following Posit number formats

    Posit8, Posit16, Posit32
    Posit16_1

Posit8, Posit16, Posit32 are the standard formats with 2 exponent bits.
The off-standard format Posit(16,1) (16 bits with 1 exponent bit, exported as `Posit16_1`) was part of the previous posit arithmetic
[draft standard](https://posithub.org/docs/posit_standard.pdf).

For all the formats conversions between integers and floats and basic arithmetic operations
`+`, `-`, `*`, `/` and `sqrt` (among others) are defined.

# Examples

Conversion to and from `Float64` and computing a square root

```julia
julia> using SoftPosit
julia> p = Posit16(16)
Posit16(16.0)

julia> sqrt(p)
Posit16(4.0)
```
And the bitwise representation split into sign, regime, exponent and mantissa bits using `bitstring(p,:split)`

```julia
julia> bitstring(Posit32(123456.7),:split)
"0 111110 00<PHONE_NUMBER>0000001011010"
```

Or solving a linear equation system with Posit8
```julia
julia> A = Posit8.(randn(3,3))
3×3 Matrix{Posit8}:
 Posit8(1.125)      Posit8(-0.5625) Posit8(0.0390625)
 Posit8(-1.5)       Posit8(0.0625)  Posit8(1.25)
 Posit8(-0.40625)   Posit8(1.875)   Posit8(1.125)

julia> b = Posit8.(randn(3))
3-element Vector{Posit8}:
 Posit8(1.25)
 Posit8(-1.375)
 Posit8(-0.6875)

julia> A\b
3-element Vector{Posit8}:
 Posit8(1.0)
 Posit8(-0.21875)
 Posit8(0.125)
```

For an (outdated) comprehensive notebook covering (almost) all the functionality of SoftPosit.jl
please read [softposit_examples.ipynb](https://github.com/milankl/SoftPosit.jl/blob/master/docs/softposit_examples.ipynb)

# Rounding mode

Following the [2022 posit standard](https://posithub.org/docs/posit_standard-2.pdf),
posits should never underflow nor overflow. This is in v0.5 generally respected, but there are some
caveats: Posits currently do underflow below about `4*floatmin` of the float format you are converting from.
In practice this is of little importance as even `floatmin(::PositN)^2` is larger than that
```julia
julia> floatmin(Posit16)
Posit16(1.3877788e-17)

julia> floatmin(Posit16)*floatmin(Posit16)
Posit16(1.3877788e-17)
```
and similar for other posit formats.
So in Posit16 arithmetic we have `1e-17*1e-17 = 1e-17` (no underflow) and `1e17*1e17 = 1e17` (no overflow).

# Citation

If you use this package please cite us

> Klöwer M, PD Düben and TN Palmer, 2020. Number formats, error mitigation and scope for 16-bit arithmetics in weather and climate modelling analyzed with a shallow water model, Journal of Advances in Modeling Earth Systems, 12, e2020MS002246. [10.1029/2020MS002246](https://doi.org/10.1029/2020MS002246)

gha_language: Julia


text:
#Online Petition

[![Build Status](https://travis-ci.org/norrs/onlinepetition.svg?branch=master)](https://travis-ci.org/norrs/onlinepetition)
[![Coverage Status](https://coveralls.io/repos/norrs/onlinepetition/badge.png?branch=master)](https://coveralls.io/r/norrs/onlinepetition?branch=master)

Simple system for registering and validating people signing an online petition.

# Install

* Install virtualenv (on debian/ubuntu: apt-get install python-virtualenv )
* virtualenv --no-site-packages /path/to/store/your/virtualenv/onlinepetition
* source /path/to/virtualenv/onlinepetition/bin/activate
* pip install Django
* pip install South
* pip install ipython

## Initialize database first time

* python manage.py syncdb
* python manage.py createsuperuser (if syncdb didn't prompt you to create one)
* python manage.py migrate

## Update translation strings:
* Add or change translatable strings in template or python code
* python manage.py makemessage -l nb_NO to generate keys in norwegian language file
* Edit locale/nb_NO/LC_MESSAGES/django.po and add your translations
* python manage.py compilemessages

Your new translations are now ready to use :)

You should now be done :-)

# Note

System currently under heavy dev, please consider current code rather unstable ;-)

repository: norrs/onlinepetition

repo_name: norrs/onlinepetition


text:
---
layout: page
title: About
permalink: /about/
---

I am a deep learning enthusiast and mathematics nerd who is extremely passionate about machine learning.

I have been a part of **UnitedHealth Group's** Advanced Research and Analytics team since 2015. As a Data Scientist, I have worked upon several machine learning, optimization, and deep learning projects. I also have a Masters degree in Operations Research from **Hindu College, University of Delhi**.

Through this blog, I am hoping to reinforce my understanding of deep learning algorithms and develop intuition of the mathematics behind it.


text:
# http4s-crypto

An internal library to incubate cross-platform cryptography (JVM, Node.js, browsers) for http4s.
To learn more about the concept please see [http4s/http4s#5044](https://github.com/http4s/http4s/issues/5044).

If you find the abstractions in this library useful, please check out the sibling project [typelevel/bobcats](https://github.com/typelevel/bobcats).


text:
Morgoth [![Build Status](https://travis-ci.org/nathanielc/morgoth.svg?branch=master)](https://travis-ci.org/nathanielc/morgoth)
=======

Morgoth is a flexible anomaly detection application.
It is designed to integrate with many existing technologies
and provide powerful anomaly detection on top of those systems.
Namely morgoth currently integrates with InfluxDB 0.9.x.

Getting Started
---------------

See the tutorial at http://docs.morgoth.io/docs/overview/getting-started/ for an example.

What makes Morgoth different from other similiar projects?
----------------------------------------------------------
Morgoth takes a very modular approach to anomaly detection. There is no single algorithm
or method to detect anomalies. Morgoth comes built in with several algorithms but can
easily be extended to add more.

Morgoth does have one anomaly detection alorithm that is unique and well suited to
detecting anomalies in system level type metrics (cpu, load, etc). The algorithm is
called MGOF (Multinomial Goodness of Fit), and has been adapted from this research paper
(http://www.hpl.hp.com/techreports/2011/HPL-2011-8.html)

What is MGOF?
-------------

In a nutshell MGOF (Multinomial Goodness of Fit, as I am calling it) is a pattern
learning algorithm adept at detecting anomalies in non Gaussian data.

Using standard deviations or 3-sigma algorithms is a very common way of detecting anmalies in metric data.
These techniques assume the data they operate on follows a Gaussian distribution (http://en.wikipedia.org/wiki/Normal_distribution).

Unfortunately much metric data is not Gaussian. Take cpu usage for example. Servers perfoming work from a queue tend to be nearly idle then spike to 100% cpu usage and then drop back down. Most of the time the server is either near 0% utilization or 100% following a bimodal distribution, (http://en.wikipedia.org/wiki/Bimodal_distribution). If cpu usage were gaussian then the cpu would spend most of the time around 50% utilized and rarley 10% or 90% utilized.

The MGOF alorithm assumes no distribution of the data. Rather the way it detects anomalies is to calculate the distribution for different windows of time. Then compare each of those distributions to the distribution of the window in question using a simple chi-squared test (http://en.wikipedia.org/wiki/Chi-squared_test).

In summary the MGOF algorithm is well suited for data collected from systems and applications because it doesn't assume a distribution of the data.

repository: charl/morgoth

repo_name: charl/morgoth


text:
# Airball Telemetry and Display Source

## Introduction

This is the source tree for the Airball telemetry and display
system. It is intended to be compiled on a Linux system. The actual
display runs on a Raspberry Pi, and at the moment the system needs to
be compiled from scratch on the Raspberry Pi as well.

## Configuring monitor

For the display we are using:

https://www.waveshare.com/3.5inch-hdmi-lcd.htm

Add the following to `config.txt` on the boot partition.

```
hdmi_group=2
hdmi_mode=87
hdmi_cvt 480 320 60 6 0 0 0
hdmi_drive=1

avoid_warnings=1
```

The `avoid_warnings` setting is based on the following advice:

https://terminalwiki.com/disable-low-voltage-warning-in-raspberry-pi/

## Building

```
sudo apt-get install \
     git \
     cmake \
     libcairo2-dev \
     libasio-dev \
     libboost-all-dev \
     libasound2-dev \
     libeigen3-dev \
     hostapd \
     dnsmasq

pip install netifaces

git clone https://github.com/airball-aero/airball-embedded.git

cd airball-embedded/host
mkdir external
git clone https://github.com/google/googletest external/googletest
git clone https://github.com/miloyip/rapidjson external/rapidjson

mkdir build
cd build
cmake ..
make ab
```

## Network setup

* `eth0` on the RPi by default is set up as a DHCP client. It can be
  used for connecting via wired Ethernet for development.
* `wlan0` is configured with a static IP of `<IP_ADDRESS>`.
* We configure an access point on `wlan0`:
  * Depending on the "serial number" of the device being configured, the
    SSID will be {`airball0001`, `airball0002`, ...}.
  * The default password is `relativewind`.
* The probe joins the same network statically.
  * The probe assigns itself `<IP_ADDRESS>`.
  * The RPi must know not to assign that to anyone.

See also:

https://thepi.io/how-to-use-your-raspberry-pi-as-a-wireless-access-point/

Run:

```
sudo systemctl stop hostapd
sudo systemctl stop dnsmasq
```

Add to `/etc/dhcpcd.conf`:

```
interface wlan0
static ip_address=<IP_ADDRESS>/24
denyinterfaces eth0
denyinterfaces wlan0
```

Run:

```
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
```

Put into `/etc/dnsmasq.conf`:

```
interface=wlan0
  dhcp-range=<IP_ADDRESS>,<IP_ADDRESS>,<IP_ADDRESS>,24h
```

Put into `/etc/hostapd/hostapd.conf`:

```
interface=wlan0
# bridge=br0
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
ssid=airball0001
wpa_passphrase=relativewind
```

In the file `/etc/default/hostapd` ensure:

```
DAEMON_CONF="/etc/hostapd/hostapd.conf"
```

Run the commands:

```
sudo systemctl disable systemd-resolved
sudo systemctl mask systemd-resolved
sudo systemctl unmask hostapd
sudo systemctl start hostapd
sudo systemctl start dnsmasq
```

## System configuration

```
sudo apt install python-pip
sudo pip install flask
```

Copy each of the contents of `rootfs/` (in this repository) into the
target system.

## Web settings editor

On a separate system, clone and build:

https://github.com/airball-aero/airball-settings-editor

Build this using:

```
flutter build web --release --web-renderer=html
```

Copy all the _contents_ of `build/web` into a new directory called
`/var/www/app/`.

Edit the file `/var/www/app/index.html` and ensure the `<base>` tag reads:

```
<base href="/app/">
```

## Raspberry Pi configuration

In `/boot/config.txt` put the lines:

```
dtoverlay=smi
dtoverlay=smi-dev
```

repository: airball-aero/airball-embedded

repo_name: airball-aero/airball-embedded


text:
---
data_non_statistical: false
goal_meta_link: 'https://unstats.un.org/sdgs/files/metadata-compilation/Metadata-Goal-5.pdf '
goal_meta_link_text: United Nations Sustainable Development Goals Metadata (PDF 4.0
  MB)
graph_title: global_indicators.5-a-1-title
graph_type: line
indicator: 5.a.1
indicator_name: global_indicators.5-a-1-title
indicator_sort_order: 05-aa-01
published: true
reporting_status: notstarted
sdg_goal: '5'
target: Undertake reforms to give women equal rights to economic resources, as well
  as access to ownership and control over land and other forms of property, financial
  services, inheritance and natural resources, in accordance with national laws
target_id: 5.a
un_custodian_agency: United Nations Entity for Gender Equality and the Empowerment
  of Women (UN Women) United Nations Statistics Division (UNSD) Food and Agriculture
  Organization of the United Nations (FAO)
un_designated_tier: '2'
---

branch_name: refs/heads/develop


text:
# ido
Collection of command line scripts.

All scripts have -h command line option displaying a help screen.

### Scripts

| | | |
| --- | --- | ------------------------------------------------------------------------------------------------------------- |
| | catfiles | Concatenate files with identical headers. Leaves header of first file and removes all subsequent headers. |
| | cleanlatexdiff | Clean internal LaTeX commands of latexdiff output to simple \add and \del commands. |
| | cutbyname | Wrapper of cut command where one specifies the fields by name in a header line. |
| | diffdirs | Compare two directories, giving formatted output. |
| | ido\_bash\_completion | source ido\_bash\_complete in .bash\_profile to get completion of command line options of all ido scripts with tab. |
| | ido\_lib.sh | Library with helper functions for bash scripts. |
| | iinvert | Invert colours or colour channel in image using ImageMagick. |
| | irename | Batch rename several files using an sed expression. |
| | ireplace | Applies sed expression on several files, e.g. replacing a string in the files. |
| | ireverse | Reverses the lines in a file leaving a header. |
| | itranspose | Transposes a file and writes it to standard out, optionally removing a header. |
| | izip | Wrapper for zip utility: if 'izip directory' then 'zip -r directory.zip directory' will be called. |
| | unix2mac | Converts unix, dos/windows and mac text file formats into each other. Other names: mac2unix, mac2win, unix2win, win2mac, win2unix |
| | psmerge | Merges several pdf or postscript files into one single pdf or postscript file. Other names: pdfmerge |
| | pssplit | Splits pdf or postscript file into files with individual pages using ghostscript. Other names: pdfsplit |

### Examples

| | |
| --- | --------------------------------------------------------- |
| | % catfiles -n 1 -o out infile* |
| | % latexdiff --flatten old.tex new.tex \| cleanlatexdiff > diff.tex |
| | % sed 's/2002/2003/' infile \| cutbyname -f 'date,co2' -d ',' \| tr ',' ' ' > outfile |
| | % diffdirs -n dir1 dir2 |
| | % iinvert -s LCH -c C -d 600 -o image.png image.pdf |
| | % irename -f 's/DSC\_/Photo/' \*.jpg |
| | % ireplace '/exp/s/exp=.\*/exp=moc01/' moc.\* |
| | % ireverse -s 1 infile > outfile |
| | % itranspose -s 1 -d ',' -c infile > outfile |
| | % izip mydir |
| | % win2unix -q \*.txt |
| | % pdfmerge -o all.pdf \*.pdf \*.ps |
| | % pdfsplit in.pdf pages\_ |
| | % source ipop\_lib.sh ; what='m' ; list=$(echo {a..z}) ; ihave=$(isin ${what} ${list}) ; if [[ -n ${ihave} ]] echo "I have an ${what}." ; fi |

__Copyright (c) 2012-2023 Matthias Cuntz - mc (at) macu (dot) de__

repository: mcuntz/ido

repo_name: mcuntz/ido


text:
# Q&A about ION
**The questions are mixed basic and detailed, the answers are mostly directed towards generally interested people and newbies.**

Why should you read or step through the Q&A? To get a different angle to the same topic: ION.

This document relies on a [Glossary](./Glossary.md) file that has:
- a alphabethically ordered list of **abbreviations**
- a alphabethically ordered list of **definitions**

Terminology specific for ION can be found [here](https://identity.foundation/ion). The following definitions are specificly listed to support the *Question and Answers* below on a simpler level, and to be able to put ION in relation to other fields of interest.
Terminology specific for Sidetree (the basis of ION) can be found [here](https://identity.foundation/sidetree/docs/spec/#terminology).

**The questions are of a varied level: basic and detailed. The answers are mostly directed towards generally interested people and newbies.**\
*Q = one star question. Novice to `ION`, advanced in DIDs\
**Q = two star question. Proficient in DIDs and advanced in `ION`\
***Q = three star question. Expert in DIDs and proficient in `ION`

```
{TBW} means: to be written
```
- [Q&A about ION](#qa-about-ion)
    + [Disclaimer](#disclaimer)
    + [List of abbreviations and definitions](#list-of-abbreviations-and-definitions)
  * [Knowledge you should be confidently applying](#knowledge-you-should-be-confidently-applying)
  * [Actions you should be comfortable with](#actions-you-should-be-comfortable-with)
- [Jump table to categories](#jump-table-to-categories)

Inspired by [ION on DIF](https://identity.foundation/ion/), [Sidetree specifications](https://identity.foundation/sidetree/spec/) and questions raised during DIF Sidetree WG meetings, but also issues created and handled [here](https://github.com/decentralized-identity/ion/issues) and the progress made, here on Github (Turn on 'Watch' if you want to be notified of conversations).\
Lastly the discussions on social media, especially Twitter, have become a great source for Question and Answer regarding ION.
Consider following on Twitter:
[@csuwildcat](https://twitter.com/csuwildcat),
[@TheHenryTsai](https://twitter.com/TheHenryTsai),
[@OR13b](https://twitter.com/OR13b),
[@troyronda](https://twitter.com/troyronda),
[@tplooker](https://twitter.com/tplooker),
and [@ChrisLundkvist](https://twitter.com/ChrisLundkvist).

**Beware: A Q&A is always *work in progress*. Tips & help welcome.**

### Disclaimer
None of the respondents in the **open** repo and presentations have been explicitly named as a source, except for ***@csuwildcat*** (Daniel Buchner, expert), ***@thehenrytsai*** (Henry Tsai, expert) and ***@henkvancann*** (documentation).

If there is no reference added to the answers, then its content stems from either one or more of these sources
- [Github ION](https://github.com/decentralized-identity/ion)
- [Launch v1.0 on twitter](https://twitter.com/csuwildcat/status/1375125876736548870)
- it's Daniel Buchner or Henry Tsai who answered the question.
Most of the editing is done by @henkvancann, which might have introduced ommission, errors, language glitches and such. Sorry for that, feel free to correct by submitting a pull request (PR).\
For practical reasons educational images uploaded by Github members may have been downloaded. We de-personalised them by giving images a new name. Under these new names these images have been uploaded to github and used in the Q&A to clarify the questions and answers.

ION's content is licensed under the [Apache License 2.0](https://github.com/decentralized-identity/ION/blob/master/LICENSE).

We've done our best to protect the privacy of the Github by investigating the images we used. We haven't come across personal identifiable information (pii). However, should we have made a mistake after all, please let us know and we'll correct this immediately.

### List of abbreviations and definitions
- [Abbreviations](./Glossary.md#Abbreviations)

- [Definitions:](./Glossary.md#definitions)
      - [Authentic Chained Data Container Task Force](./Glossary.md#authentic-chained-data-container-task-force)
      - [Agent](./Glossary.md#agent)
      - [Agency](./Glossary.md#agency)
      - [Bidirectional model transformation](./Glossary.md#bidirectional-model-transformation)
      - [Claim](./Glossary.md#claim)
      - [Content-addressable hash](./Glossary.md#content-addressable-hash)
      - [Controller](./Glossary.md#controller)
      - [Cryptocurrency](./Glossary.md#cryptocurrency)
      - [Decentralized Identity](./Glossary.md#decentralized-identity)
      - [Delta-based](./Glossary.md#delta-based)
      - [Deterministic Ruleset (of Sidetree)](./Glossary.md#deterministic-ruleset--of-sidetree)
      - [Entropy](./Glossary.md#entropy)
      - [Entity](./Glossary.md#entity)
      - [Identity](./Glossary.md#identity)
      - [IPFS](./Glossary.md#inter-planetary-file-system)
      - [JSON Web Key](./Glossary.md#json-web-key)
      - [Key](./Glossary.md#key)
      - [Normative](./Glossary.md#normative)
      - [Non-normative](./Glossary.md#non-normative)
      - [Payload](./Glossary.md#payload)
      - [Public Key Infrastructure](./Glossary.md#public-key-infrastructure)
      - [Race condition](./Glossary.md#race-condition)
      - [Root of trust](./Glossary.md#root-of-trust)
      - [Secret](./Glossary.md#secret)
      - [Self Sovereign Identity](./Glossary.md#self-sovereign-identity)
      - [Subject](./Glossary.md#subject)
      - [Transfer](./Glossary.md#transfer)
      - [Transferable identifier](./Glossary.md#transferable-identifier)
      - [Trust-over-IP](./Glossary.md#trust-over-ip)
      - [Validator](./Glossary.md#validator)
      - [Verifiable Credential](./Glossary.md#verifiable-credential)
      - [W3C DID](./Glossary.md#w3c-did)
      - [WebAssembly](./Glossary.md#webassembly)
      - [(Digital Identity) Wallet](./Glossary.md#-digital-identity--wallet)

## Knowledge you should be confidently applying
- The definitions above
- W3C DIDs
- Public private key pairs
- Bitcoin Improvement Protocols: BIP32, BIP39, BIP44, BIP47, BIP49, BIP84, BIP174
- hierarchical deterministic derivation paths
- Base58
- Eliptic curves
- Sidetree
{TBW}
## Actions you should be comfortable with
- Amend knowledge and keep existing knowledge up to date
- create a key pair safely and back it up safely
- {TBW}

# Jump table to categories
- [General](#qa-section-general)
- [Bitcoin and its blockchain](#qa-section-bitcoin-and-its-blockchain)
- [ION operational](#qa-section-ion-operational)
- [Userinterface](#qa-section-userinterface)
- [Identifiers and DIDs](#qa-section-identifiers-and-dids)
- [Wallets](#qa-section-wallets)
- [Docker](#qa-section-docker)
- [Proofs](#qa-section-proofs)
- [Private Key Management](#qa-section-private-key-management)
- [Nodes](#qa-section-nodes)
- [Sidetree](#qa-section-sidetree)

# Q&A section General

## *Q:  What is ION?

ION is based on Sidetree - standard.

#### *Q: Why ION?

Imagine you have identifiers on the web that are yours.
The ION you're currently reading about **is not a coin, you can't buy it**. And we do not recommend to buy any crypto currencies with - or associated to - the name ION.

## *Q: Who owns ION?
Just like Sidetree ION is [open source](https://github.com/decentralized-identity/ion/blob/master/LICENSE). Microsoft has been an important sustaining sponsor, but no more than that.

#### I will never enter a project where Microsoft is involved, they will never be decentralized?!
_"Bill Gates does not enter projects of this nature just because he's a good person."_

In brief: ION is free, open source, uncensorable. Full stop.

_@csuwildcat_ [on twitter](https://twitter.com/csuwildcat/status/1375125876736548870): "It's a deterministic protocol that only requires math + an internet connection, that's it. There are no authorities, intermediaries, validators, or other points of centralization in ION, so the only thing you need to trust is literally math itself. Have a look at the code and see."

## *Q: What will this be used for?
@LastCoinStandng: "Decentralized identity where you alone own all aspects of your identity. An example would be you go to a bar and need to confirm you're over 21; you can reveal/prove you are 21 without showing your driver's license (which has other data you don't need to reveal - eg address)."
#### **Q: Is this an example of a zero-knowledge proof?
Yes, that's an example of a zero-knowledge proof you might generate using the keys of a DID
(_@csuwildcat_)

## *Q: When has ION been launched?
March 2021 on the [Microsoft site](https://techcommunity.microsoft.com/t5/identity-standards-blog/ion-we-have-liftoff/ba-p/1441555): "We are excited to share that v1 of ION is complete and has been launched on Bitcoin mainnet".\
[Continues on twitter](https://twitter.com/csuwildcat/status/1375125876736548870): "This is the culmination of 10 years of work, beginning in 2011 when a few of us at Mozilla set aside some of our time to explore the core concepts of Decentralized Identity."\
(_@csuwildcat_)

## *Q: Why is ION so special?
The reason is two-fold:
- It settles on the bitcoin blockchain, the most secure open public blockchain, which isn't owned by anybody and everybody at the same time, the transactions and events with ION identifiers are uncensorable, and immutablably anchored to the bitcoin blockchain. ION does not bloat the bitcoin blockchain because it periodically only settles a very small proof (hash) of a large ION data structure on the blockchain.
- ION preserves privacy of the people, things and organisation behind the identifiers. It's highly interoperable and fits within the DID standardization of W3C.

## **Q: Is ION the only Sidetree implementation?
No,  Sidetree enables scalable DID networks (i.e. ION, Element, Orb) to be built atop any decentralized event record system (e.g. blockchains).

## *Q: How can I use ION?
We have contributed an open source library for generating DIDs and have opened up our ION node to provide a no-hassle option for anchoring ION DIDs:
- [Generate ION DIDs and keys](https://github.com/decentralized-identity/ion-tools#ionjs)
- [Use the lower-level SDK](https://github.com/decentralized-identity/ion-sdk)
- [Anchor DIDs you generate](https://github.com/decentralized-identity/ion-tools)

An example of generating an ION DID with the ION.js library:

## *Q: Any YouTube clips from you as a tutorial?
I'll try to get something together, but we don't have anything like that yet (the devs and I literally just finished/pushed out the library last night (March 25, 2021, ed.).\
(_@csuwildcat_)

## *Q: Will companies be able to create businesses to profit from the ION protocol?
Sure, they can get DIDs and use them to sign/exchange proofs for all sorts of business processes, all without having to create manual federated identity and authorization connections between bespoke systems. This essentially standardizes and flattens all of that into one system.\
(_@csuwildcat_)

# Q&A section Bitcoin and its blockchain

## Why is bitcoin chosen as the blockchain?
While ledger-based consensus systems, on the surface, would seem to provide the same general features as one another, there are a few key differences that make some more suitable for critical applications, like the decentralized identifiers of human beings. Some of these considerations and features are:
1. The system must be open and permissionless, not a cabal of authorities who can exclude and remove participants.
2. The system must be well-tested, and proven secure against attack over a long enough duration to be confident in.
3. The system must produce a singular, independently verifiable record that is as immutable as possible, so that reversing the record the system produces is infeasible.
4. The system must be widely deployed, with nodes that span the globe, to ensure the record is persisted.
5. The system must be self-incentivized, so that nodes continue to operate, process, and secure the record over time. The value from operation must come from the system directly, because outside incentive reliance is itself a vector for attack.
6. The cost to attack the system through any game theoretically available means must be high enough that it is infeasible to attempt, and even if an ultra-capitalized attacker did, it would require a weaponized mobilization of force and resources that would be obvious, with options for mitigation.

The outcome:
- #1 eliminates private and permissioned ledgers
- #2 eliminates just about all other ledgers and blockchains, simply because they are inadequately tested
- For the metrics detailed in #3-#6, Bitcoin is so far beyond all other options, it isn't even close - Bitcoin is the most secure option by an absurdly large margin.\
(_@TheHenryTsai_)

## *Q: How does it work? You need bitcoin transactions for DID, right? So how do BTC transaction fees come into play?
_Each newly created ID will pay a transaction fee?_

With ION can fit 10,000 ID operations in a single bitcoin transaction.\
(_@csuwildcat_)

ION doesn't bloat the bitcoin blockchain. It gathers multple proofs of identifier events and anchors them with one single small transaction (and dito fee) on the bitcoin blockchain.\
(_@henkvancann_)

#### *Q: Who pays the fee if it's all decentralised?
Node operators who anchor operation batches must pay BTC txn fees. Current we cover the cost for folks who want to anchor via our node, but you can just do it on your own node at home if you want. Ops are signed with keys only you hold, so it's not like another node has your keys.\
(_@csuwildcat_)

## **@: Can I prune the local bitcoin node?
I'd use prune on only the non-ion txns, because we haven't yet accounted for that. Totally on the roadmap to fully support a pruned node.\
(_@csuwildcat_)

## ***Q: What's different between ION and NameID (https://nameid.org) or XID (https://github.com/xaya/xid)? They're on different blockchains, but still based on Bitcoin Core.
Two key differences:
1. First and foremost: ION _is not_ another blockchain, it's a Layer 2 protocol that directly leverages Bitcoin's security
2. It's a massively, provably scalable architecture, unlike those alt-chains\
(_@csuwildcat_)

## *Q: How do you even verify ID on BTC with the snail's pace?
With ION can fit 10,000 ID operations in a single bitcoin transaction.

The operations on IDs in ION are near instant. The only thing that needs the snales pace of bitcoin is the anchoring of the whole set of ID operations on the most immutable and non-censorable and inclusive global ledger we have at the moment: bitcoin.

## *Q When I start an ION myself I get lots of bitcoin blockchain data. Can this be pruned?
Yes, it can prune most of Bitcoin's data: all data before block 667000, and all non-ION transactions thereafter.\
(_@csuwildcat_)

# Q&A section ION operational

## *Q: Is ION a coin or an ICO?
**This has absolutely nothing to do with** that abandoned ICO coin! ION has no token or blockchain of its own.

## **Q:  What would be the specs for an ION node, excluding Bitcoin Core ressources consumption?
Not much, basically just storage growth as the network is utilized. There's hardly any computation on operation ingest, so it's not going to hit a CPU hard.\
For example: with 40 billion DIDs in the system (basically all of humanity using ION), it would require around 2-3TB of space, but wouldn't noticeably rev compute on an i3 from 2017.\
(_@csuwildcat_)

## ***Q: What would be the quickest way for me to learn more about 'unpublished' DIDs?
_Do you happen to know of a link to any documentation about that?_

This one class invocation will instantly create you an unpublished DID: [here](https://t.co/eBY4wR2kTk?amp=1)\
(_@csuwildcat_)

## ***Q: Any plans to make this work on top of bitcoin full nodes?; on top of projects like [Umbrel](https://blocktalk.co/2021/03/25/how-to-set-up-full-bitcoin-node-umbrel/)?
I haven't had time to sort out getting it packaged for this. Would love some help with that from the community, else it will probably take a couple months before we can dig out.\
(_@csuwildcat_)

## *Q: Is the data storage requirement of 1 TB on top of Bitcoin datadir requirements?
No, including. And it doesn't really require that much, because there aren't really many IDs in the network, so you'll have about 60% of that unused. We said this, because it will consume that storage over years of time.\
(_@csuwildcat_)

## **Q: How to install my ION node on a Raspberry Pi 4?
https://matthijs.hoekstraonline.net/2021/03/25/running-an-ion-node-on-your-raspberry-4/

## *Q: What are the availability guarantees of ION?
ION depends on the aggregated availability of all the nodes. The more ION nodes there are, the more available and redundant ION data is. ION does not depend on single infra in a way that it somehow fails if a few nodes are down. All ION nodes aggressively replicate all operations.\
(_@csuwildcat_ and _@thehenrytsai_)

#### **Q: So ION has the same availability guarantees as an IPFS cluster?
_Which would basically mean the collective availability of all node runners_
Yes.

#### **Q: Does that mean that all nodes pin all transactions?
Yes, all ION nodes currently pin all ION-related IPFS files. It's not ad hoc, every node is setup to be a full replica.

Because the data load is so small, probably for years, all nodes can store this data in full, but there's a light node structure for when we all think it is getting large, to allow low-resource devices to store less.\
Once light nodes are ready, they can operate on about 5% of the total dataset.\
(_@csuwildcat_)

## *Q: Does ION need incentives to keep the nodes running that are based on external contractual/social/etc. obligations?
We have advised all our customers to run a node. There are at least fifteen companies I know of who are running them. It might be a good dependency / incentive if you're using it yourself.\
(_@csuwildcat_)

## *Q: How many users does ION as a service have?
We have got an idea of the number of nodes running. We have many users too, but we don't really know an exact count of that. Because it's not like they call home or anything; because there's no home.

We are planning to scan for IPFS nodes that have the data, and make a rough estimate of user nodes based on the IPFS ID URIs that we see uniquely returning data
We will be adding more graphical readouts of these things in the Explorer over the coming months

# **Q: Does an ION user node need bitcoin? or just IPFS?
It needs bitcoin, but it can prune most of Bitcoin's data: all data before block 667000, and all non-ION transactions thereafter.

# **Q: How to create a batch of DIDs?
_Can you explain more detail on this? Assume that the company requires to create 1000 DIDs for IOT devices. How can I do create them in a batch?_

You'd use the API to send your running node N number of ops, then it will batch them up for you and anchor them (assuming you attach a funded wallet that can do txns).\
Assuming you are running your own node, you simply need to submit 1000 create operations to your node (ie. http://localhost:3000/operations) before your batch writer kicks in every 10 minutes by default, the batch writer will batch all 1000 operations into 1 bitcoin transaction thus you'll pay fee for just one transaction to the minor.\
The technical spec for constructing a create request can be found in [Sidetree API spec](https://identity.foundation/sidetree/api/#create), but if you know TypeScript, you are better off using the [ion-sdk](https://github.com/decentralized-identity/ion-sdk) directly, it will save you a lot of time.\
(_@TheHenryTsai_) - related github [issue](https://github.com/decentralized-identity/ion/issues/210)

#### *Q: Does it cost only a single bitcoin transaction or 1000 BTC transactions?
To create 1000 DIDs for IOT devices, you wouldn't need 1000 BTC transactions, but only a fraction. Furthermore costs can be shared among many users. e.g. ION is able to bundle thousands of pluriform identifier events and only a root hash will be anchored on the bitcoin blockchain. It depends whether you're able to batch the inception events of the IoT identifiers or not. A batch of 1000 identifiers requires 1 BTC transaction and there's even more room in that ION batch.\
1000 consecutive inception events over of period of time, could require 1000 BTC transactions, but of course a single identifier event in one anchoring ION BTC transaction should not have to pay for the total fee. The fee can be shared and divided by the number of participating controllers in that specific ION anchoring BTC transaction.\
(_@henkvancann_)\
 There's one big caveat: anchoring thousand of ION ops is going to require you to have enough in the wallet to lock an escrow-like proof of fee, which uses a relative timelock that will freeze a large amount of Bitcoin for roughly 30 days. It's a form of spam protection for the network. You can so 100 ops in a Bitcoin txn without any proof of fee value lock. This doc explains the value locking proof of fee requirement the nodes all enforce: https://github.com/decentralized-identity/ion/blob/master/docs/design.md#value-locking-algorithm\
 (_@csuwildcat_)

# **Q: Is it possible to add other public key algorithms to the DID Document?
_...like ED25519, X25519 key agreement or custom key provided by external services?_

You can add any public key JWK representation you want to the DID Document. See here for some options: https://w3c-ccg.github.io/ld-cryptosuite-registry/ - just remember that it needs to be one of the JWK variants.\
(_@csuwildcat_)

# Q&A section Userinterface

## **Q: How can I be a part of this or have my own DID?
There's a really simple JS library that makes it easy to generate your own on your machine:
[ion-tools](https://www.npmjs.com/package/@decentralized-identity/ion-tools#user-content-ionjs).\
"The packages within are geared toward making interactions with ION maximally accessible for developers, with a primary focus on making their functionality dually available in both client Web and server environments."\
(_@csuwildcat_)

## *Q: Do you see wide-spread individual consumer adoption of the technology? What are the major hurdles and time-frame to get significant adoption across the U.S.?
The **most significant** technical component left that we need is **standard encrypted personal datastores**, which we're working on now. Beyond that, there's probably a year or two more of basic integration and dev enablement work to get it into the web and other platforms.\
(_@csuwildcat_)\
_This is a giant leap forward for individuals and their privacy._ - (_@mkaplanPMP_)

# Q&A section Identifiers and DIDs

## *Q: Who owns the DIDs generated with ION?
Ownership of your DIDs is based on keys you generate locally, and all ION operations are signed with those keys, so even if you use our node for anchoring DID operations (or any other node), you are always in sole control.\
(_@csuwildcat_)
## *Q: They probably already have my ID, why would i tokenize it?

## **Q: Where can I see what data points someone can set up around their own DID?
_For example, name, address, driving licence. There must be a huge array of fields someone can include within their DID for it to be comprehensive?_\

{TBW prio 2}
## **Q: Do you believe the ION decentralized identifier network will have a big impact on IoT device identity?
_If so, can you provide a little color?_

You can certainly register IDs for IoT devices, which can be used to sign data from them linked to their IDs, and connect them to a globally indexed decentralized registry (part of what ION provides)\
(_@csuwildcat_)

## **Q: Will the different SSI decentralised blockchain based technologies work seemlessly together?
_Or are relying parties and end users going to suffer whilst the product people don't interoperate?_

There are some challenges in the DID field. The chain of interoperable DIDs are as strong as the weakest link. Having said that: W3C DIDs are intrinsically interoperable, yes.
(_@henkvancann_)

# Q&A section Wallets
{TBW}
# Q&A section Docker

## **Q: What ports need to be exposed for ION using docker?
Have a look at the port mappings in the [yml-file](https://github.com/decentralized-identity/ion/blob/master/docker/docker-compose.yml) on this [explanatory github repo page](https://github.com/decentralized-identity/ion/tree/master/docker).

# Q&A section Proofs
{TBW}
# Q&A section Private Key Management
{TBW}
# Q&A section Nodes
## *Q: Does it pay rewards / Mine tokens for hosting a node?
No, the value of running a node is accessing what may become the largest Web of identity for connecting to people, companies, apps, and services, which is the foundation of decentralized apps. One near term example: companies will run them so they can verify the DIDs /VC of customers.

## **Q: Have you got any instructions for regtest setup?
You might find what you need here: https://github.com/decentralized-identity/ion/tree/master/config

# Q&A section Sidetree

Sidetree has its own repository under [DIF](https://github.com/decentralized-identity/sidetree). This section intents to clear up the difference between ION and Sidetree and how they relate.

Most Question and Answers about Sidetree are located in its own [github repo](https://github.com/decentralized-identity/sidetree/blob/master/docs/Q-and-A.md). Below a basic selection to start off with.

## *Q: What is Sidetree?
Sidetree is a protocol for creating scalable decentralized public key infrastructure (DPKI) networks that can run atop of any existing decentralized ledger system (e.g. Bitcoin) and be as open, public, and permissionless as the underlying ledger they utilize.

## *Q: What is the setting of sidetree?
The protocol allows users to create _globally unique, user-controlled identifiers_ and manage their associated metadata, all _without the need for centralized authorities_ or trusted third parties. The syntax of the identifier and accompanying data model used by the protocol is conformant to that defined by W3C Decentralized Identifiers. Implementations of the protocol can be codified as their own distinct DID Methods and registered in the W3C DID Method Registry.

## **Q: How is the inner working of Sidetree?

## *Q: For who is Sidetree?
Any team or organisation that wants to create an DID based on Sidetree, because of its typical Layer 2 properties, not bloating any Layer 1 solution. Laying a foundation for layer 3 development,  in the DID to be developed,  that will result in W3C DID compliant VCs.
_(@henkvancann)_

## **Q:  Why use Sidetree?
It is a DIDComm layer (2); which is layer 1 agnostic and uses Layer 1 very efficiently. Sidetree does not require trusted intermediaries, centralized authorities, special protocol tokens, or secondary consensus mechanisms, while preserving the core attributes of decentralization and immutability of the underlying ledger systems it is implemented on.
_(@henkvancann)_

## **Q: What is so unique to Sidetree?
Current approaches that utilize these ledger systems to create decentralized identifier networks suffer from severely limited transactional volumes and other performance issues. Sidetree is a ‘Layer 2’ protocol that runs atop decentralized ledger systems.\
Sidetree has a very small footprint on Settlement Layer 1 of the trust-over-IP model. It stashes multiple layer 2 identity transactions into one layer 1 transaction; it's "Lightning-Network-like" in Bitcoin.

##  *Q: Is Sidetree a DID?
`Sidetree` is not a `DID` method. The related `DID` method is [`did:core`](https://www.w3.org/TR/did-core/) Implementations of the protocol can be codified as their own distinct DID Methods and registered in the W3C DID Method Registry; e.g. [`did:ion`]().\
_(@henkvancann)_

##  *Q: Who is Sidetree? Is it a company or a not for profit?
Sidetree sits under the *Decentralized Identity Foundation*, [DIF](https://identity.foundation), and within that in the *Identity and Discovery* Workgroup.
Due to its licensing structure, Sidetree isn't owned by anyone and everyone at the same time. The Intellectual Property Right of Sidetree is hosted with `DIF`. It is an open source project.

On github Sidetree is - and will become even more - a thickening bunch of repositories:
 -  https://github.com/decentralized-identity/Sidetree

 Lastly, Microsoft is an important promoter of Sidetree and employer of some contributors.
 _(@henkvancann)_

repository: decentralized-identity/ion

gha_language: HTML

repo_name: decentralized-identity/ion


text:
# Http server
Create a lxc container that hosts a lighttpd http server.

#### Build
```shell script
./build.sh
```

#### Launch
```shell script
lxc launch -e alpine-http-server a
```