text:
---
title: FILL keyword
sidebar_label: FILL
description: FILL SQL keyword reference documentation.
---

Queries using a [SAMPLE BY](/docs/reference/sql/sample-by/) aggregate on data
which has missing records may return in a discontinuous series of results. This
keyword allows for specifying a fill behavior for query results which have
missing aggregates due to missing rows.

To specify a default handling for `null` values within queries, see the
[coalesce() function](/docs/reference/function/conditional/#coalesce)
documentation.

## Syntax

![Flow chart showing the syntax of the FILL keyword](/img/docs/diagrams/fill.svg)

### Options

The `FILL` keyword expects a single `fillOption` strategy which will be applied
to each aggregate column. The following restrictions apply:

- Keywords denoting fill strategies may not be combined. Only one option from
  `NONE`, `NULL`, `PREV`, `LINEAR` and constants may be used.
- If a constant is selected as a fill option, a constant value must be specified
  for each aggregate column

| fillOption | Description                                                                                |
| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `NONE`     | No fill applied. If there is no data, the time chunk will be skipped in the results. This means your table could potentially be missing intervals. |
| `NULL`     | Fills with `NULL`                                                                                |
| `PREV`     | Fills using the previous value                                                                                |
| `LINEAR`   | Fills by linear interpolation of the 2 surrounding points                                                                                |
| `x`        | Fills with a constant value - where `x` is the desired value, for example `FILL(100.05)`                                                           |

## Examples

Consider an example table named `prices` which has no records during the entire
third hour (`2021-01-01T13`):

| ts                          | price |
| --------------------------- | ----- |
| 2021-01-01T10:00:00.000000Z | p1    |
| 2021-01-01T11:00:00.000000Z | p2    |
| 2021-01-01T12:00:00.000000Z | p3    |
| 2021-01-01T14:00:00.000000Z | p4    |
| 2021-01-01T15:00:00.000000Z | p5    |
| ...                         | ...   |

The following query returns the minimum, maximum and average price per hour:

```questdb-sql
SELECT ts, min(price) min, max(price) max, avg(price) average
FROM prices
SAMPLE BY 1h;
```

The returned results look like this:

| ts                          | min  | max  | average |
| --------------------------- | ---- | ---- | ------- |
| 2021-01-01T10:00:00.000000Z | min1 | max1 | avg1    |
| ...                         | ...  | ...  | ...     |

As there are missing values, an average aggregate cannot be calculated for the
missing hour:

| ts                          | min  | max  | average |
| --------------------------- | ---- | ---- | ------- |
| 2021-01-01T10:00:00.000000Z | min1 | max1 | avg1    |
| 2021-01-01T11:00:00.000000Z | min2 | max2 | avg2    |
| 2021-01-01T12:00:00.000000Z | min3 | max3 | avg3    |
| 2021-01-01T14:00:00.000000Z | min5 | max5 | avg5    |

Based on this example, a `FILL` strategy can be employed which fills with the
previous value using `PREV`:

```questdb-sql
SELECT ts, min(price) min, max(price) max, avg(price) average
FROM prices
SAMPLE BY 1h
FILL(PREV);
```

This query returns the following results where the fourth row is created by
using the `FILL` keyword:

| ts                              | min      | max      | average  |
| ------------------------------- | -------- | -------- | -------- |
| 2021-01-01T10:00:00.000000Z     | min1     | max1     | avg1     |
| 2021-01-01T11:00:00.000000Z     | min2     | max2     | avg2     |
| 2021-01-01T12:00:00.000000Z     | min3     | max3     | avg3     |
| **2021-01-01T13:00:00.000000Z** | **min3** | **max3** | **avg3** |
| 2021-01-01T14:00:00.000000Z     | min5     | max5     | avg5     |

This query demonstrates using a `LINEAR` value for interpolation:

```questdb-sql
SELECT ts, min(price) min, avg(price) average
FROM prices
SAMPLE BY 1h
FILL(LINEAR);
```

The results of this query look like the following:

| ts                              | min               | max               | average           |
| ------------------------------- | ----------------- | ----------------- | ----------------- |
| 2021-01-01T10:00:00.000000Z     | min1              | max1              | avg1              |
| 2021-01-01T11:00:00.000000Z     | min2              | max2              | avg2              |
| 2021-01-01T12:00:00.000000Z     | min3              | max3              | avg3              |
| **2021-01-01T13:00:00.000000Z** | **(min3+min5)/2** | **(max3+max5)/2** | **(avg3+avg5)/2** |
| 2021-01-01T14:00:00.000000Z     | min5              | max5              | avg5              |

This query demonstrates using a constant value as a `fillOption`. If a constant
value is used as a `fillOption`, a value must be specified for each aggregate
column:

```questdb-sql
SELECT ts, min(price) min, avg(price) average
FROM prices
SAMPLE BY 1h
FILL(100.5, 10, 1);
```

The results of this query look like the following:

| ts                              | min       | max    | average |
| ------------------------------- | --------- | ------ | ------- |
| 2021-01-01T10:00:00.000000Z     | min1      | max1   | avg1    |
| 2021-01-01T11:00:00.000000Z     | min2      | max2   | avg2    |
| 2021-01-01T12:00:00.000000Z     | min3      | max3   | avg3    |
| **2021-01-01T13:00:00.000000Z** | **100.5** | **10** | **1**   |
| 2021-01-01T14:00:00.000000Z     | min5      | max5   | avg5    |

This query demonstrates using `NULL` as a `fillOption`:

```questdb-sql
SELECT ts, min(price) min, avg(price) average
FROM prices
SAMPLE BY 1h
FILL(NULL);
```

The results of this query look like the following:

| ts                              | min      | max      | average  |
| ------------------------------- | -------- | -------- | -------- |
| 2021-01-01T10:00:00.000000Z     | min1     | max1     | avg1     |
| 2021-01-01T11:00:00.000000Z     | min2     | max2     | avg2     |
| 2021-01-01T12:00:00.000000Z     | min3     | max3     | avg3     |
| **2021-01-01T13:00:00.000000Z** | **null** | **null** | **null** |
| 2021-01-01T14:00:00.000000Z     | min5     | max5     | avg5     |


text:
## Summary
The DataFrame is an instance of two-dimensional, size-mutable, potentially heterogeneous tabular data. It comes as part
of the pandas package (often imported as *pd*).

The index column (no header) represents each in-game frame from the replay (i.e. if the game runs in 60fps, there will
be 60 rows in the DataFrame for every second passed in the game).

Each column is a tuple, and detailed information about all of them can be seen by using `data_frame.info(verbose=True)`,
and the example below perfectly illustrates this structure.

**For extensive documentation, refer to [the official pandas website](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html).**

repository: DivvyCr/carball

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: DivvyCr/carball


text:
# Classes

You can think about a module as a specialized dictionary that can store Python code so you can access it with the . operator.

Python also has another construct that serves a similar purpose called a class. A class is a way to take a grouping of functions and data and place them inside a container so you can access them with the . (dot) operator.

If I were to create a class just like the mystuff module, I'd do something like this:

    class MyStuff(object):
      def __init__(self):
        self.tangerine = "And now a thousand years between"
      def apple(self):
        print "I AM CLASSY APPLES!"

That looks complicated compared to modules, but you should be able to make out how this is like a "mini-module" with `MyStuff` having an apple() function in it. What is probably confusing is the `__init__()` function and use of `self.tangerine` for setting the tangerine instance variable.

Here's why classes are used instead of modules:
You can take this MyStuff class and use it to craft many of them, millions at a time if you want, and each one won't interfere with each other. When you import a module there is only one for the entire program unless you do some monster hacks.

Before you can understand this though, you need to know what an "object" is and how to work with MyStuff just like you do with the `mystuff.py` module.

## Objects are Like Import

If a class is like a "mini-module," then there has to be a similar concept to import but for classes. That concept is called "instantiate", which is just a fancy, obnoxious, overly smart way to say "create." When you instantiate a class what you get is called an object.

You instantiate (create) a class by calling the class like it's a function, like this:

    thing = MyStuff()
    thing.apple()
    print thing.tangerine

The first line is the "instantiate" operation, and it's a lot like calling a function. However, Python coordinates a sequence of events for you behind the scenes. I'll go through these steps using the above code for MyStuff:

1. Python looks for `MyStuff()` and sees that it is a class you've defined.
2. Python crafts an empty object with all the functions you've specified in the class using `def`.
3. Python then looks to see if you made a "magic" `__init__` function, and if you have, it calls that function to initialize your newly created empty object.
4. In the `MyStuff` function `__init__`, I then get this extra variable self, which is that empty object Python made for me, and I can set variables on it just like you would with a module, dictionary, or other object.
5. In this case, I set `self.tangerine` to a song lyric and then I've initialized this object.
6. Now Python can take this newly minted object and assign it to the thing variable for me to work with.

#### What is `__init__`?
`__init__` is a basic initializer, this is called when this class is instantiated.
Note that the double leading and trailing underscores denote objects or attributes that are used by python but that live in user-controlled namespaces.

You should not invent such names on your own.

#### Why use `self` while making `__init__` or other functions?

Without `self` the code isn't clear about whether you mean the instance's `tangerine` attribute, or a local variable named `tangerine`. With `self.tangerine = 'Some lyrics'` it's very clear you mean the instance attribute `self.tangerine`.

Inside the functions in a class, self is a variable for the instance/object being accessed.

That's the basics of how Python does this "mini-import" when you call a class like a function. Remember that this is not giving you the class, but instead is using the class as a blueprint for building a copy of that type of thing.

Keep in mind that I'm giving you a slightly inaccurate idea for how these work so that you can start to build up an understanding of classes based on what you know about modules.

The truth is, classes and objects suddenly diverge from modules at this point.
If I were being totally honest, I'd say something more like this:

* Classes are like blueprints or definitions for creating new mini-modules.
* Instantiation is how you make one of these mini-modules and import it at the same time. "Instantiate" just means to create an object from the class.
* The resulting created mini-module is called an object and you then assign it to a variable to work with it.

At this point objects behave differently from modules and this should only serve as a way for you to bridge over to understanding classes and objects.

license: MIT

repository: Keerti-Gautam/PythonLearning

repo_name: Keerti-Gautam/PythonLearning


text:
# PyroCMS Git Deploy Plugin

## Description

The git deploy plugin is a simple way to deploy a website using git.
It relies on Bitbucket / Github POST commit Hooks.

## Usage

To start with you need to create a clone of your projects git repository.

If you are using a private repository you need to configure your server to use SSH keys for the user that your webserver runs as.

Next setup the configuration items in config/deploy.php.

Then setup the POST commit hook on Bitbucket / Github , to do this just add the URL http://YOUR-DOMAIN.com/deploy , if you specified a Hash key in config you need to append this to the URL e.g : http://YOUR-DOMAIN.com/deploy/MY_HASH_KEY.

The execute method of this module is based on a script written by Brandon Summers, for more information see his article: http://brandonsummers.name/blog/2012/02/10/using-bitbucket-for-automated-deployments/.

license: Unlicense


text:
# Evaluation Criteria

- The solution should be implementing a cache mechanism
- The cache expiration should be a couple of hours

# Proposed Solution

We modify the `PackageRepository.java` to:
- Not remove the downloaded package list after stopping
- Check if a list file already exists
- Download the file only if it doesn't exist, or if it was last modified more than 12hrs ago.

```java
private final static long CACHE_EXPIRATION = 2 * 60 * 60 * 1000; // 2 hours

 private List<Package> downloadPackageList() throws IOException {
     URL url = new URL(baseUrl + "/APKINDEX.tar.gz");
     File f = new File("list-" + repository + ".tar.gz");

    if (!f.exists() || (f.lastModified() + CACHE_EXPIRATION) < System.currentTimeMillis()) {
        System.out.print("Preparing to synchronize package list from repository " + repository + "...");
        Networking.downloadFile(url, f, Terminal.progressBar("Synchronizing packages in repository " + repository));
        System.out.println();
    }

    // Read and return the list
    return parsePackageList(f);
 }
```

repository: sweng-epfl/public

branch_name: refs/heads/main

gha_language: Java

gha_license_id: MIT

repo_name: sweng-epfl/public


text:
# AR-Watch-Catalogue
AR Watch Catalogue is an Application which works on principles of Augmented Reality. It can be used to check and try different watches virtually without even wearing them physically. :watch:

## Contents of the Repository
- [Application Screenshots](https://github.com/rudrabarad/AR-Watch-Catalogue/tree/main/Application%20Screenshots)
- [Resources](https://github.com/rudrabarad/AR-Watch-Catalogue/tree/main/Resources)
- [Readme](https://github.com/rudrabarad/AR-Watch-Catalogue#readme)
- [Source Code](https://github.com/rudrabarad/AR-Watch-Catalogue#source-code)
- [Documentation/Report](https://github.com/rudrabarad/AR-Watch-Catalogue#documentation)
- [Presentation](https://github.com/rudrabarad/AR-Watch-Catalogue/blob/main/PRESENTATION.pptx)
- [Video Demonstration](https://github.com/rudrabarad/AR-Watch-Catalogue#video)
- [APK File for Android](https://github.com/rudrabarad/AR-Watch-Catalogue#apk-file)

## Source Code
Sorry we were not able to upload source code on GitHub :octocat:

But you can download the source code from [Google Drive](https://drive.google.com/drive/folders/1OjwH_j__1vTT-D3ZorcdpBPH_c1vW2am?usp=sharing)

## Documentation
For detailed documentation and roadmap of our project please check the [Report](https://github.com/rudrabarad/AR-Watch-Catalogue/blob/main/REPORT.docx) of this repository.

## Video
For viewing or downloading video click [here](https://github.com/rudrabarad/AR-Watch-Catalogue/blob/main/VIDEO%20DEMO.mp4) 🎬

## APK File
Download APK File from [here](https://github.com/rudrabarad/AR-Watch-Catalogue/blob/main/Watch%20Catalogue.apk) 📥

## Facing any issues???

Feel free to [open an issue](https://github.com/rudrabarad/AR-Watch-Catalogue/issues/new?assignees=&labels=Query&title=Query). We are glad to help you. ❤

## License
Project is published under the [MIT license](https://github.com/rudrabarad/AR-Watch-Catalogue/blob/master/LICENSE).

![](https://img.shields.io/badge/Star-If_Liked-%23FF0000.svg?&style=flat&logoColor=white&color=white)
![](https://img.shields.io/badge/Fork-If_you_found_interesting-%23FF0000.svg?&style=flat&logoColor=white&color=white)

repository: rudrabarad/AR-Watch-Catalogue

repo_name: rudrabarad/AR-Watch-Catalogue


text:
---
layout: relation
title: 'compound:a'
shortdef: 'adjective compound'
udver: '2'
---

This deprel is a special class of [compound]() that represents adjective compound.
The tokens with this deprel should have an adjective parent. Together with their parents, they form adjectives with new meanings. The position of the _compound:a_ token can be before or after its adjective parent. For example:
* _luar biasa_ "extraordinary/remarkable" = _luar_ "outside" (NOUN) + _biasa_ "ordinary" (ADJ)
* _buta aksara_ "illiterate" = _buta_ "blind" (ADJ) + _aksara_ "alphabet" (NOUN)

~~~ sdparse
kesuksesan luar biasa \n remarkable success
amod(kesuksesan, biasa)
compound:a(biasa, luar)
amod(success, remarkable)
~~~

~~~ sdparse
dia ketahuan buta aksara \n he was caught illiterate
nsubj:pass(ketahuan, dia)
xcomp(ketahuan, buta)
compound:a(buta, aksara)
xcomp(caught, illiterate)
~~~
<!-- Interlanguage links updated Út 9. května 2023, 20:04:05 CEST -->

repository: UniversalDependencies/docs

branch_name: refs/heads/pages-source

gha_language: HTML

repo_name: UniversalDependencies/docs


text:
*Quick links :*
[Home](/README.md) - [**Part 1**](../part1/README.md) - [Part 2](../part2/README.md) - [Part 3](../part3/README.md) - [Part 4](../part4/README.md)
***
**Part 1** - [Setup](PREREQ.md) - [First App](FIRSTAPP.md) - [WIFI](WIFI.md) - [LED](LED.md) - [DHT](DHT.md) - [**Cloud**](IOTCLOUD.md)
***

# Deploying an application to the IBM Cloud

## Lab Objectives

In this lab you will learn how to deploy a starter application to the IBM Cloud.  You will learn:

- How to access the cloud and set the desired location to work in
- Access the catalog of services and select a Starter Kit to deploy
- Deploy a Starter Kit to the IBM Cloud
- Access the Starter Kit source code and update the starter application
- Become familiar with the DevOps tooling available in the IBM Cloud

## Introduction

Before finishing part 1 you should deploy the starter application that we will be using in Part 2, as this can take a few minutes to deploy and become available.

Before starting these steps it is assumed you have completed the steps in the [prerequisite section](PREREQ.md) and have an active IBM Cloud account.

### Step 1 - Accessing the cloud and selecting an appropriate space

[Login](https://cloud.ibm.com) to your cloud account and make sure you are working in one of the US South, United Kingdom or Germany locations, as these locations have all the required services we will be using for the rest of the workshop.

If you haven't previously used any of the locations you will need to create a **space** to be able to work in the chosen location.  To do this from the top menu select *Manage* -> *Account* -> *Cloud Foundry Orgs* then click on your mail address to configure your organisation.  Click to **Add a space** then select the region and provide a name for the space.

### Step 2 - Deploy a Starter Kit

Open up the Catalog using the top menu, then select Starter Kits from the left menu, then select the Internet of Things Platform Starter.  In the screen presented enter a name for your application - this needs to be a name that is unique to your application, so a good naming convention is to use your initials followed by a name that describes the purpose of the app or the solution name.  This will also form part of the URL for the application.

Next select the location and space you want to deploy the application into . Leave the Selected plan information at the default values then select the **Create** button.

The Starter Kit is now deploying a JavaScript application running Node-RED, a low code development environment, an instance of Cloudant NoSQL database and an instance of the Watson Internet of Things Platform.

Please leave this to deploy - now is a good time to go for a break.

You now have the cloud application deployed, so you are now ready to move to the [next section](../part2/README.md) of the workshop to setup secured communications between the ESP8266 device and the IBM Cloud IOT service

***
*Quick links :*
**Part 1** - [Setup](PREREQ.md) - [First App](FIRSTAPP.md) - [WIFI](WIFI.md) - [LED](LED.md) - [DHT](DHT.md) - [**Cloud**](IOTCLOUD.md)
***
[Home](/README.md) - [**Part 1**](../part1/README.md) - [Part 2](../part2/README.md) - [Part 3](../part3/README.md) - [Part 4](../part4/README.md)


text:
---
layout: post
title:  "Crash course Java"
date:   2018-08-02
categories:
---

In this blog post I’m not really going to talk about a certain topic, but I’m going to give a crash course about the programming language Java. As you know I’m a computer science student and I noticed that students without any programming experience are struggling for days with simple Java exercises they get in the first weeks of college. To help those students I’m going give a crash course in Java so new computer science students can have a little experience before going to college.

In this post I’m going to talk about the programming concepts I think are most important to know before going to college. So I’m going to talk about:

* Data types and variables
* Operations
* Conditions
* Iterations
* Methods

So let’s start with data types and variables. In Java you have lot’s of different data types. The most important are:

* Integers (-3, -2, -1, 0, 1, 2, 3, ...)
* Floats and doubles (floating point numbers like 3.4935)
* Strings (this could contain text, like “this is a String”)
* Booleans (can have 2 values: true of false)

In Java you can declare variables. This means that you can assign a value of a data type to a variable. You declare variables like this:

```
int x = 5;
```

When the Java Compiler runs this code, the variable x will have a value of 5. As you can see when declaring a new variable you have to specify its data type by writing the data type before the variable name. If the variable already exists this is not needed.

```
int x = 5;
x = 3;
```

The code above will assign 5 to x in the first statement and 3 to x in the second statement. After the second statement, variable x won't have the value 5 anymore but only the value 3. To declare a String you would have to do this:

```
String y = “this is a string”;
```

Now you know about variables let’s talk about operations. Java supports lots of operations like addition (+), substraction (-), division (/) and multiplication (*). To perform such operations you can write code like this:

```
// x will contain the value 6.
int x = 2*3;

// y will contain the value 2.
int y = x - 4;

// z will contain the value 8.
int z = y + x:
```

(As you can see, I wrote // in the code above. Using // will comment out all code on the same line after the //. This means that the commented code won't be executed by the compiler and this can be used to explain your code)

You can use variables or just values to do operations. If you want to increment an int by 1, you can just write the variableName++. So the statement x++ will increase the value of x by one.

Before I will continue on conditions, let me first talk about some syntax. As you can see, after every statement, I put a semicolon to tell to the compiler that this is the end of an statement. This is something must do. Otherwise your code won’t run.
Another thing I want to tell you is that you can write values to the console using System.out.println().

```
System.out.println(“hello world”)
```

will print hello world to the console. Just try it out yourself. If you put variables between the parentheses, it will print the value of those brackets.

So now let’s talk about conditions. In Java you have if, else if and else conditions. Let's first talk about if and else:

```
if (5 > 3) {
    ...
}
else {
    ...
}
```

This example above will first check the condition between brackets. If the condition is true, the statements between the curly braces will be executed. If the condition is false, then the statements at the else statement will be executed. Another statement you can use is the else if:

```
if (5 > 3) {
    ...
}
else if (3 < 5) {
    ...
}
else {
    ...
}
```

So in this example the first condition is false so it will check for the second condition which is true so the compiler will execute the statements of the else if statement.

The next topic I'm going to talk about is iterations. There are 2 types of iterations. You can use a for loop or a while loop. A for loop is written as follows:

```
for (int i = 0; i < 10; i++) {
    System.out.println(“hello”);
}
```

This example will print hello 10 times.
The syntax is as follows.  So in this case you set an int to 0, give the condition that i should be less than 10 and you increment i by 1 after every loop.
A while loop works as follows:

```
int x = 0
while (x < 10) {
    System.out.println(“hello”):
    x++;
}

```
After every iteration the code checks if the condition is still true and it will run the code again until the condition is false. So this time you have to make sure yourself that the condition will ever be false, otherwise the program will stuck in this loop forever.

Last but not least I’ll talk a bit about methods. Methods can be used to group code. You can call methods, which will execute the code inside the method. This way you can prevent code duplication. This is an example of a method:

```
void methodName() {
    ...
}
```

So when you call in your code:br>
methodName();
The code inside the method will be executed.
Now you know what a method is, let’s tell you a bit more about methods. Methods can just execute code or it can execute code and return a data type. In the first case, you have to add void before the method name as you can see I did above. In the second case you have to replace void by the data type you want to return. So a function returning a data type looks like this:

```
int calculateAmount() {
    int x = ...
    ...
    return x
}
```

So in this case the value of x will be returned. A way you can use these methods is:

```
int amount = calculateAmount();
```

amount will have the value that is returned by the calculateAmount method.

(Don’t forget: when you call return the method will be exited so all code below a return won’t be executed).

Another important thing about methods are parameters. You can pass parameters through methods. So for example let’s say you want to calculate the square of an int. Then you can write a method like this:

```
int square(int input) {
    return input * input;
}
```

So as you can see you can put parameters between the parentheses and you have to tell which type the parameter is. You can call a method with a parameter like this:

```
int x = square(4);
```

So you can just put the value between the parentheses. Writing methods with more than 1 parameter will look like this.

```
int multiply(int x, int y) {
    return x * y;
}
```

Calling such a method goes like this:

```
int result = multiply(3, 4);
```

So you can separate different parameters using a comma and you can add as many parameters as you want.

This is the end of this crash course. I hope now you know more about data types, operations, conditions, loops and methods and that you are able to write small Java programs yourself. I could tell more but I think this is most important for you to know if you are completely new to programming. If you still have any questions after reading this blog post, you can add a reaction below or you can contact me on Twitter.


text:
---
title: "Our Daily Reading List - 23/10/2017"
author<EMAIL_ADDRESS>tags: ["margaret","Daily Readings"]
date: 2017-10-23 09:00:37
description: "1

Small business structures offer different benefits, drawbacks - by Dale M. Maas, Attorney at Law #socent #law Read Here

2

Three tips to put together a smooth business succession plan - by DANN..."
---

[https://clausehound.com/](https://clausehound.com/)

1

### Small business structures offer different benefits, drawbacks - by Dale M. Maas, Attorney at Law #socent #law [Read Here](https://goo.gl/zAWZfT)

2

### Three tips to put together a smooth business succession plan - by DANNIEL S. WILLARD of Daniel S. Willard, P.C. #socent #law [Read Here](https://goo.gl/fYdyfj)

Annotated Legal Contracts
for the Price of a Coffee

3

### Will Buying New #Technology Make You a Better Lawyer? - by @theGeorgeKhoury #legal @FindLawLP [Read Here](https://goo.gl/9u8DRd)

4

### Arbitration Can Help Solve #Tech Litigation Problems - by Gary Benton #legal [Read Here](https://goo.gl/9LxoXz)

5

### Detailing Deceptive And Unfair Trade Practices - by Welbaum Guernsey #commercial #law [Read Here](https://goo.gl/NTFFmv)

repository: sahilkanaya/clausehound-blog

repo_name: sahilkanaya/clausehound-blog


text:
### Stéphane Pontadit & Matthieu de Laharpe

# LuxUmbra -  Light & Shadow Engine

LuxUmbra is a light & shadow engine that runs with the Vulkan API.

The goals of the project were to learn the **Vulkan API** and modern rendering techniques like **Physically Based-Rendering** (PBR) and **Post-Process** effects. We did not focus on performance and optimization.

It was developed in one month by Matthieu de Laharpe and Stephane Pontadit.

![Overview](README_Resources/Models.jpg)

## Table of Contents

+ [How to launch](#How-to-Launch)
+ [Controls](#Controls)
+ [Editor](#Editor)
+ [Shaders Hot Reload](#Shaders-Hot-Reload)
+ [Technical Document](#Technical-Document)
  + [Illumination Model](#Illumination-Model)
  + [Shadows](#shadows)
  + [Image Based-Lighting](#Image-Based-Lighting)
  + [Post Process & Anti-Aliasing](#Post-Proscess-&-Anti-Aliasing)
  + [References](#References)

## **How to Launch**

+ ### Run Executable

> Extract "LuxUmbra_Binary.rar" archive and run "LuxUmbra.exe"

+ ### Compile the project

> Open "LuxUmbra.sln" solution file. You may need to re-target the project.
Compile and run the project.

## **Controls**

+ W : forward
+ S : backward
+ A : left
+ D : right
+ E : up
+ C/Alt : down
+ I : show/hide editor
+ Echap : exit

## **Editor**

The editor is built with Omar Cornut's "dear imgui" library.

+ **Change Scenes:** Change the current scene by clicking on the radio butons at the top of the editor.
+ **Post-Process:**
  + *Debug:* Show tone mapping, FXAA, SSAO or direct color only on the left part of the screen. The "percent" slider controls the horizontal position of the white line that splits the screen.
  + *Tone Mapping:* Exposes the tone mapping algorithm and the exposure factor.
  + *FXAA:* Exposes the overall FXAA quality.
  + *SSAO:* Exposes SSAO settings.
+ **Render Settings:** Exposes shadow mapping parameters.
+ **Scenes:**  Exposes camera, meshes, lights and materials properties.

![Editor](README_Resources/Editor.png)

## **Shaders Hot Reload**

1. Make changes to shaders
2. Run LuxUmbra/data/shaders/Compilers.bat
3. Click on the "Reload Shader" button in the editor

## **Technical Document**

### **Illumination Model**

All the calculations for illumination are done in **"cameraSpaceLight.frag"** shader.

#### **Diffuse**

We implemented two different BRDFs for the diffuse term. We have the **Lambertian BRDF** that assumes a uniform diffuse response, and we have **Disney's diffuse BRDF** (by Burley) that takes the roughness into account to create reflections at grazing angles. In the engine, we use Disney's BRDF by default.

#### **Specular**

For the specular part, we implemented the **Cook-Torrance BRDF**. The different terms of the BRDF that we chose are:

+ **GGX (Trowbridge-Reitz)** for the Normal Distribution Function
+ **Schlick Approximation** for the Fresnel Equation
+ **Smith GGX** for the Masking-Shadowing Function

**Figure 1:** different roughness, reflectance and metalness values

![PBR Sphere](README_Resources/PBR_Spheres.jpg)

#### **Clear Coat**

We implemented a simplified version of material layering with a **Cleat Coat**. It is calculated with the same Cook-Torrance BRDF but with different terms:

+ **GGX** for the Normal Distributon Function
+ **Schlick Approximation** for the Fresnel Equation
+ **Kelement** for the Masking-Shadowing Function

**Figure 2:** different cleat coat roughness and intensity values

![ClearCoat](README_Resources/Clear_Coat.jpg)

#### **Material**

5 different maps are handled: Albedo, Normal, Roughness, Metallic and Ambient Occlusion that allow us to have complex materials.

**Figure 3:** a collection of complex physically based materials

![Materials](README_Resources/Materials.jpg)

**Figure 4:** marble material with and without clear coat

![MaterialClearCoat](README_Resources/Marble.gif)

### **Shadows**

We implemented shadow-mapping for directional and point lights.

For directional shadow mapping, we create an AABB in the coordinate's frame of the light whose dimension define an orthographic projection matrix. The scene depth is rendered using this projection to create the shadow map. During the scene render, for each light, we transform the position of a fragment in the coordinate's frame of the light and compare its distance to the light with the depth sampled in the shadow map using the transformed position.

Shadows from directional light sources are anti-aliased using the **Percentage Closer Filtering** (PCF) algorithm.

**Figure 5:** model is illuminated by two directional lights that produce shadows on the walls

![Direction Shadow](README_Resources/Shadow_Directional.jpg)

For point lights, we create the shadow map by rendering the depth of the scene from the position of the light into a cubemap. Then, when we render the scene, just like for directional lights, we transform the position of a fragment in the coordinate's frame of each light and compare the distance to the light with the depth sampled in the shadow map using the direction from the light to the transformed fragment position.

### **Image Based-Lighting**

Our environment maps are computed from HDR textures and we use them to do **Image-Based Lighting**.

#### **Diffuse Irradiance**

The diffuse part of IBL is achieved by computing the irradiance of the environment map by convolution. This result is stored in a cubemap. This is our **irradiance map**.

#### **Specular**

Specular part is calculated with the split sum approximation made famous by Epic Games. The first sum is pre-calculated for different roughness values and the results are stored in the mip-map levels of a cubemap. This is our **prefiltered map**. The second sum is a 2D LUT that represents the BRDF's response given an input roughness and an input angle between the normal and the light direction.

Objet that use IBL reflections sample the prefiltered map using their roughness value to access a mip level of the map. Higher mip levels are blurrier than lower mip levels, so rough material have blurred reflections and smooth material have sharp reflections.

These two maps depend on the environment map, we generate them at program startup with a **compute shader**

**Figure 6:** the environment is reflected on the surface of the helmet

![IBL](README_Resources/Helmet_Light.jpg)

### **Post-Proscess & Anti-Aliasing**

All the calculation for post-processing are done in **"blit.frag"** shader.

#### **Anti-Aliasing**

We implemented two anti-aliasing techniques. The first one is the **Multisampling Anti-Aliasing** (MSAA) on the Vulkan side. It uses up to four samples per pixel. We also implemented **Fast Approximate Anti-Aliasing** (FXAA) as a post-process to smooth edges.

#### **Post-Process**

We implemented several **Tone Mapping algorithms**: Reinhard, ACES Film and Uncharted2. The tone mapping remaps HDC color to LDC color. All our color calculations are done in linear color space. We apply gamma correction during the post-process stage.

The last post-process that we implemented is **Screen-Space Ambient Occlusion** (SSAO). We use a hybrid pipeline with traditional forward rendering plus we keep buffers with the data necessary to SSAO computation. We use a normal and a position buffer to calculate ambient occlusion on a fragment and apply this occlusion during the post-process pass.

**Figure 7:** same image with and without SSAO

![SSAO](README_Resources/SSAO.gif)

### **References**

#### *Rendering*

+ [Real shading in Unreal Engine 4](https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf) by Brian Karis, Epic Games, Siggraph 2013 presentation note
+ [Moving Frostbite to Physically Based Rendering 3.0](https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf) by Sébastien Lagarde and Charles de Rousiers, Electronic Arts, Siggraph 2014
+ [Real-time Physicaly Based Rendering](https://en.ppt-online.org/378584) by Yoshiharu Gotanda and Tatsuya Shoji, R&D Repartment, tri-Ace, Inc.
+ [Enterprise PBR Shading Model](https://dassaultsystemes-technology.github.io/EnterprisePBRShadingModel/user_guide.md.html) by Dassault Systèmes for general references about PBR and shading
+ [Filament project](https://google.github.io/filament/Filament.md.html) by Google for general references about PBR and shading
+ [Filament Crafting Physicaly-Based Materials](https://google.github.io/filament/Material%20Properties.pdf) for material references
+ [Brian Karis's blog](https://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html) for Specular BRDF Reference
+ [A Simple and Practical Approach to SSAO](https://www.gamedev.net/articles/programming/graphics/a-simple-and-practical-approach-to-ssao-r2753/) for an explanation of the SSAO algorithm
+ [Daniel-Alin Loghin's blog](http://alinloghin.com/articles/compute_ibl.html) for IBL resources calculation
+ [Simon Rodriguez's blog](http://blog.simonrodriguez.fr/articles/30-07-2016_implementing_fxaa.html) for an explanation of the FXAA algorithm

### *Vulkan*

+ [Sascha Willems GitHub repository](https://github.com/SaschaWillems/Vulkan) for general references about Vulkan API
+ [NVIDIA Vulkan Shader Resource Binding blog post](https://developer.nvidia.com/vulkan-shader-resource-binding) for optimizing resource bindings by updated them based on usage frequency

repository: SPontadit/LuxUmbra

repo_name: SPontadit/LuxUmbra


text:
---
# Documentation: https://sourcethemes.com/academic/docs/managing-content/

title: Using Arabic Tweets to Understand Drug Selling Behaviors
subtitle: ''
summary: ''
authors:
- Wesam Alruwaili
- Bradley Protano
- Tejasvi Sirigiriraju
- Hamed Alhoori
tags:
- '"Public Health"'
- '"Twitter"'
- '"Social Media"'
- '"Drug"'
- '"Drug Seller"'
- '"Arabic Language"'
- '"Pharmacological"'
- '"machine learning"'
categories: []
date: '2019-01-01'
lastmod: 2020-10-10T14:08:11-05:00
featured: false
draft: false

# Featured image
# To use, add an image named `featured.jpg/png` to your page's folder.
# Focal points: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight.
image:
  caption: ''
  focal_point: ''
  preview_only: false

# Projects (optional).
#   Associate this post with one or more of your projects.
#   Simply enter your project's folder or file name without extension.
#   E.g. `projects = ["internal-project"]` references `content/project/deep-learning/index.md`.
#   Otherwise, set `projects = []`.
projects: []
publishDate: '2020-10-10T19:08:11.135177Z'
publication_types:
- '2'
abstract: 'Twitter is a popular platform for e-commerce in the Arab region including
  the sale of illegal goods and services. Social media platforms present multiple
  opportunities to mine information about behaviors pertaining to both illicit and
  pharmaceutical drugs and likewise to legal prescription drugs sold without a prescription,
  i.e., illegally. Recognized as a public health risk, the sale and use of illegal
  drugs, counterfeit versions of legal drugs, and legal drugs sold without a prescription
  constitute a widespread problem that is reflected in and facilitated by social media.
  Twitter provides a crucial resource for monitoring legal and illegal drug sales
  in order to support the larger goal of finding ways to protect patient safety. We
  collected our dataset using Arabic keywords. We then categorized the data using
  four machine learning classifiers. Based on a comparison of the respective results,
  we assessed the accuracy of each classifier in predicting two important considerations
  in analysing the extent to which drugs are available on social media: references
  to drugs for sale and the legality/illegality of the drugs thus advertised. For
  predicting tweets selling drugs, Support Vector Machine, yielded the highest accuracy
  rate (96%), whereas for predicting the legality of the advertised drugs, the Naive
  Bayes, classifier yielded the highest accuracy rate (85%).'
publication: '*Procedia Computer Science*'
url_pdf: publications/alruwaili-2019.pdf
doi: 10.1016/j.procs.2019.12.220
---

repository: alhoori/academic

repo_name: alhoori/academic


text:
---
title: Scrollable post content
author: Joe
homepage: https://github.com/discourse/Scrollable-post-content
download: https://github.com/discourse/Scrollable-post-content
demo: https://theme-creator.discourse.org/theme/Johani/scrollable-post-content
thumbnail: /images/112479/thumbnail.png
license: MIT License
license_link: https://github.com/discourse/Scrollable-post-content/blob/master/LICENSE
category: Theme Components
meta_topic_id: 112479

---
This is a theme component that will allow you to add scrollable sections in posts with one click!

[Repository link ](https://github.com/discourse/Scrollable-post-content)
`https://github.com/discourse/Scrollable-post-content`

Preview:
 https://theme-creator.discourse.org/theme/Johani/scrollable-post-content

After clicking "view theme" navigate to the "Scrollable post content" topic in the #General category

<hr>

### Samples

Desktop

![scrollable1: 473x500, 75%](/images/112479/mZwLNW0YX5RNMOUDdEGrGf0NHiY.png)

Mobile

![org_t_scrollable-post-content_1126_preview_theme_id%3D1995_mobile_view%3D1(Nexus%206P): 242x500, 75%](/images/112479/9QAaFItuNMU7eUCxGsISxaekKoS.png)

Composer button

![scrollable2: 690x471, 50%](/images/112479/1SVMH245CZ9K9qbkxtvxh5i3X6Q.png)

### Settings

This theme comes with two settings:

1. **Content height**

   this allows you to set the desired height of the scrollable content in pixels. It defaults to 300. If you want to change it, just add a number, no need for units.

2. **Scrollable content button icon**

    this allows you to set the icon used for the scrollable content button in the composer.

### Translations

The component comes with one string that you can translate.

`insert_scrollable_content: Insert scrollable content`

This acts as the label for the composer button.

### How do I use it?

There are two ways to add scrollable content.

1. highlight the content you want to target, then click the button in the composer.
2. click the composer button and start typing / paste content.

Either way works so it's up to you.

### How do I install this theme component?

Follow the [theme installation guide ](https://meta.discourse.org/t/how-do-i-install-a-theme-or-theme-component/63682) and add the theme component to your active themes.

If you’re new to Discourse themes, you can learn more about them [here. ](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966)

repository: DiscourseForum/DiscourseThemes

repo_name: DiscourseForum/DiscourseThemes


text:
Cofoundry has a built-in abstraction of background task registrations, this enables the framework and any plugins to use the same interface for registering background tasks while giving you the freedom to choose how those tasks are run.

Currently there isn't default implementation included in the main package, instead you'll need to install a plugin like [Cofoundry.Plugins.BackgroundTasks.Hangfire](https://github.com/cofoundry-cms/Cofoundry.Plugins.BackgroundTasks.Hangfire) to get them to run.

## Creating a Recurring Background Task

Simply create a class that inherits from either `IRecurringBackgroundTask` or `IAsyncRecurringBackgroundTask` and implement the `Execute[Async]` method. [BackgroundTasks.Hangfire](https://github.com/cofoundry-cms/Cofoundry.Plugins.BackgroundTasks.Hangfire) supports constructor injection so typically the background task will be lightweight and we can just execute a command using a CommandExecutor. E.g.

```csharp
using Cofoundry.Core.BackgroundTasks;

public class ImportDataBackgroundTask : IAsyncRecurringBackgroundTask
{
    private readonly IDomainRepository _domainRepository;

    public ImportDataBackgroundTask(
        IDomainRepository domainRepository
        )
    {
        _domainRepository = domainRepository;
    }

    public Task ExecuteAsync()
    {
        var command = new ImportDataCommand();
        return _domainRepository.ExecuteCommandAsync(command);
    }
}
```

Once this has been created you'll need to register your background task by creating a registration class that implements `IBackgroundTaskRegistration`. You can then use the `IBackgroundTaskScheduler` to schedule your tasks to run at a specific interval. Note that the smallest interval is 1 minute, and that execution times are UTC time. Example:

```csharp
using Cofoundry.Core.BackgroundTasks;

public class BackgroundTaskRegistration : IBackgroundTaskRegistration
{
    public void Register(IBackgroundTaskScheduler scheduler)
    {
        scheduler
            .RegisterRecurringTask<ImportDataBackgroundTask>(1, 6, 5);
    }
}
```

## Other Task Types

Only recurring tasks are currently implemented currently but it would be fairly easy to extend the framework to allow ad-hoc background tasks to be queued and executed on a background thread if you need it.

path: /src/Framework/Background Tasks.md

filename: Background Tasks.md


text:
# Mollie public API documentation

[![Greenkeeper badge](https://badges.greenkeeper.io/mollie/api-documentation.svg)](https://greenkeeper.io/)

This project contains the source of all of Mollie's public API documentation. The full documentation (in an easy to use
format) may be found at https://docs.mollie.com.

## Contribute

- [Issue Tracker](https://github.com/mollie/api-documentation/issues)
- [Source Code](https://github.com/mollie/api-documentation)

We take pull requests on our documentation as well, if you think that something can be improved please open a PR.

The documentation is formatted using [reStructuredText](http://www.sphinx-doc.org/en/master/rest.html). All
documentation should be written in US English.

Note that PhpStorm comes with a reStructuredText plugin. You can enable it from the Plugins preferences pane. It enables
some syntax highlighting.

### Prerequisites

- Python > 2.7.9
- Node > 9.x

### Running locally

Download a copy of this repository:

```
git clone git@github.com:mollie/api-documentation.git
```

Then visit the downloaded repository and install dependencies:

```
cd api-documentation
make install
```

### Generate docs

Finally, build the documentation, its CSS and JS files by running:

```
make html
```

You can now preview the docs by opening `build/html/index.html`:

```
open build/html/index.html
```

### Styling docs

You can make changes to the styling by starting a web server locally:

```
make start
```

Visit http://localhost:8000 to preview your changes. CSS & JS changes will appear without the need to refresh your
browser.

## Support

If you are having issues, please let us know. We accept pull requests on our public documentation.

You can get support via<EMAIL_ADDRESS>
## License

The project is licensed under the MIT license.

repository: thgh/api-documentation

repo_name: thgh/api-documentation


text:
# damerau-levenshtein-js

NPM package that calculates synchronously or asynchronously the Damerau-Levenshtein distance between strings.

## Installation

`npm i damerau-levenshtein-js`

## Usage

Call to "distance" or "distanceProm" functions outputs an integer, the calculated Damerau-Levenshtein distance between 2 strings given as parameters. If the result is 0, strings are identical. The higher the result, the less similar strings are. If the result is -1, it means that a problem occurred because of a bad parameter (e.g. null or undefined). Call to "minDistanceProm" function outputs the minimum distance between a string and a list of strings given as parameters.

### Require

```javascript
const dljs = require("damerau-levenshtein-js");
```

### Synchronous Damerau-Levenshtein distance calculation between 2 strings

```javascript
let result = dljs.distance("hello here", "hello there");
```

### Asynchronous Damerau-Levenshtein distance calculation between 2 strings

```javascript
dljs.distanceProm("hello here", "hello there")
        .then((result) => ...)
        .catch((result) => ...);
```

### Asynchronous minimum Damerau-Levenshtein distance calculation between a string and an array of strings

```javascript
let list = ["hello here", "hello there", "world", "world hello"];
dljs.minDistanceProm("hello world", list)
        .then((result) => ...)
        .catch((result) => ...);
```

### Tests

`npm test`

## Disclaimer

I am not responsible in any way of any consequence of the usage of this piece of software. You are warned, use it at your own risks.

repository: fabvalaaah/damerau-levenshtein-js

gha_language: JavaScript

repo_name: fabvalaaah/damerau-levenshtein-js


text:
# Redmine IPAM
This is an attempt to implement an IPAM as a Redmine plugin.

![redmine_ipam](https://raw.githubusercontent.com/davidegiacometti/redmine_ipam/master/screenshots/redmine_ipam.png)

This is just a concept with a lot of missing feature that needs to be implemented:
* Host history
* Link hosts to issues
* Rake task for schedule scans

## Supported versions
The plugin has been developed and tested on Redmine 3.4.x but should also works on previous versions.

## Installation
* Clone in #{RAILS_ROOT}/plugins
* Install gems running `bundle install`
* Migrate database running `rake redmine:plugins:migrate NAME=redmine_ipam`
* Restart Redmine

## License
Released under the MIT License.


text:
# Simulator

To run register machine code,

- load and run `simulator.rkt` in DrRacket;
- evaluate `make-machine` code in DrRacket's REPL;
- `start` the machine in DrRacket's REPL.

Example

    (define a-machine
      (make-machine
        (list <of operations>)
        '(<instructions>)))

    (start a-machine)

# Compiler

To compile Scheme source code to register machine object code,

- load and run `compiler.rkt` in DrRacket;
- `compile` the code in DrRacket's REPL.

Example

    (display (compile
     '(define (factorial n)
        (if (= n 1)
            1
            (* (factorial (- n 1)) n)))
     'val
     'next))

# Evaluator

To start evaluator, load and run `evaluator.rkt` in DrRacket's REPL.

Then in the evaluator's REPL, you can either evaluate Scheme expressions

    (define (factorial n)
        (if (= n 1)
            1
            (* (factorial (- n 1)) n)))

    (factorial 5)

or compile Scheme expressions first and then run them

    (compile
     '(define (factorial n)
        (if (= n 1)
            1
            (* (factorial (- n 1)) n))))

    (factorial 5)

repository: CompSciCabal/SMRTYPRTY

gha_language: Racket

gha_license_id: Unlicense

repo_name: CompSciCabal/SMRTYPRTY


text:
# Contributing to cadCAD (Draft)

:+1::tada: First off, thanks for taking the time to contribute! :tada::+1:

The following is a set of guidelines for contributing to cadCAD. These are mostly guidelines, not rules.
Use your best judgment, and feel free to propose changes to this document in a pull request.

### Pull Requests:

Pull Request (PR) presented as "->".

General Template:
fork/branch -> BlockScience/staging

Contributing a new feature:
fork/feature -> BlockScience/staging

Contributing to an existing feature:
fork/feature -> BlockScience/feature

Thanks! :heart:

repository: marthendalnunes/cadCAD

gha_language: Jupyter Notebook

repo_name: marthendalnunes/cadCAD


text:
HtmlRuleSanitizer
=================

[![Nuget version](https://img.shields.io/nuget/v/Vereyon.Web.HtmlSanitizer)](https://www.nuget.org/packages/Vereyon.Web.HtmlSanitizer/)

HtmlRuleSanitizer is a white list rule based HTML sanitizer built on top of the HTML Agility Pack.

```C#
var sanitizer = HtmlSanitizer.SimpleHtml5Sanitizer();
string cleanHtml = sanitizer.Sanitize(dirtyHtml);
```

Without configuration HtmlRuleSanitizer will strip absolutely everything. This ensures that you are in control of what HTML is getting through. It was inspired by the client side parser of the wysihtml5 editor.

Use cases
---------

HtmlRuleSanitizer was designed with the following use cases in mind:

 * Prevent cross-site scripting (XSS) attacks by removing javascript and other malicious HTML fragments.
 * Restrict HTML to simple markup in order to allow for easy transformation to other document types without having to deal with all possible HTML tags.
 * Enforce nofollow on links to discourage link spam.
 * Cleanup submitted HTML by removing empty tags for example.
 * Restrict HTML to a limited set of tags, for example in a comment system.

Features
--------

 * CSS class white listing
 * Empty tag removal
 * Tag white listing
 * Tag attribute and CSS class enforcement
 * Tag flattening to simplify document structure while maintaining content
 * Tag renaming
 * Attribute checks (e.g. URL validity) and white listing
 * A fluent style configuration interface
 * HTML entity encoding
 * Comment removal

Usage
-----

Install the [HtmlRuleSanitizer NuGet package](https://www.nuget.org/packages/Vereyon.Web.HtmlSanitizer/).
Optionally add the following ```using``` statement in the file where you intend to use HtmlRuleSanitizer:

```C#
using Vereyon.Web;
```

### Basic usage

```C#
var sanitizer = HtmlSanitizer.SimpleHtml5Sanitizer();
string cleanHtml = sanitizer.Sanitize(dirtyHtml);
```

*Note: the SimpleHtml5Sanitizer returns a rule set which does not allow for a full document definition. Use ```SimpleHtml5DocumentSanitizer```*

### Sanitize a document

When dealing with full HTML documents including the ```html``` and ```body``` tags, use ```SimpleHtml5DocumentSanitizer```:

```C#
var sanitizer = HtmlSanitizer.SimpleHtml5DocumentSanitizer();
string cleanHtml = sanitizer.Sanitize(dirtyHtml);
```

### Configuration

The code below demonstrates how to configure a rule set which only allows **strong**, **i** and **a** tags and which enforces the link tags to have a valid url, be no-follow and open in a new window. In addition, any **b** tag is renamed to **strong** because they more or less do the same anyway and **b** is deprecated. Any empty tags are removed to get rid of them. This would be a nice example for comment processing.

```C#
var sanitizer = new HtmlSanitizer();
sanitizer.Tag("strong").RemoveEmpty();
sanitizer.Tag("b").Rename("strong").RemoveEmpty();
sanitizer.Tag("i").RemoveEmpty();
sanitizer.Tag("a").SetAttribute("target", "_blank")
	.SetAttribute("rel", "nofollow")
	.CheckAttributeUrl("href")
	.RemoveEmpty();

string cleanHtml = sanitizer.Sanitize(dirtyHtml);
```

### Custom attribute sanitization

Attribute sanitization can be peformed by implementing a custom `IHtmlAttributeSanitizer`. The code below illustrates a simple custom sanitizer which overrides the attribute value:

```C#
class CustomSanitizer : IHtmlAttributeSanitizer
{
    public SanitizerOperation SanitizeAttribute(HtmlAttribute attribute, HtmlSanitizerTagRule tagRule)
    {
		// Override the attribute value and leave the attribute as be.
        attribute.Value = "123";
        return SanitizerOperation.DoNothing;
    }
}
```

The custom sanitizer can then be assigned to the desired attributes as follows:

```C#
var sanitizer = new HtmlSanitizer();
var attributeSanitizer = new CustomSanitizer();
sanitizer.Tag("span").SanitizeAttributes("style", attributeSanitizer);
```

Contributing
------------

### Setup

Using .NET Core
```
dotnet restore
```

### Tests

Got tests? Yes, see the tests project. It uses xUnit.

Using .NET Core
```
cd Web.HtmlSanitizer.Tests/
dotnet test
```

More information
-----

 * [HtmlRuleSanitizer NuGet package](https://www.nuget.org/packages/Vereyon.Web.HtmlSanitizer/)
 * [CodeProject article on HtmlRuleSanitizer](http://www.codeproject.com/Articles/879381/Rule-based-HTML-sanitizer)

License
-------

[MIT X11](http://en.wikipedia.org/wiki/MIT_License)

repository: Vereyon/HtmlRuleSanitizer

gha_language: C#

repo_name: Vereyon/HtmlRuleSanitizer


text:
---
author: chipoglesby
comments: true
date: 2010-11-18 14:30:06+00:00
excerpt: 'While current metrics give you some very basic ideas of what''s going on
  around your site, they only answer the Who, What, When and Where. What''s missing
  from this equation? The Why

  '
layout: post
slug: the-death-of-page-view-journalism
title: The death of pageview journalism
wordpress_id: 26745
categories:
- Journalism
tags:
- conversion rates
- outcomes
- pageviews
---

[![New York City](http://farm5.static.flickr.com/4037/4386848679_69f2e74387.jpg)](http://www.flickr.com/photos/chipoglesby/4386848679/)

When newspapers were still king, CEO's loved to tout how many "subscribers" their print circulation carried. 1.5 million daily and 3 million on the weekend was something to really be proud of. Bigger numbers mean higher rates for advertisers. 'Look at all the eyeballs that will see your ads' they exclaimed, when secretly, they knew not everyone was reading every single page of the paper. How could they?

When website tracking and analytics came along, it blew everything publishers knew out of the water. 'What do you mean this story on 'A-1' only got 500 pageviews?? THAT'S IMPOSSIBLE!' they cried. Little did they know how many people actually read their stories.

If newspapers' A-1 were composed of front page stories driven by daily analytics, we would see a very different section front.

If CEO's salaries were tied to the well-being of online news sites, we would see a very different type of care and compassion for how well online sites perform.

So what's wrong with page-view journalism? If you're approaching it from a very straightforward numbers only point of view, there's nothing wrong. You can tell your advertisers that you get 1.5mil pageviews per day. But just like the old days, you'll be leaving out some very key selling points for those advertisers.

Consider if you will a site that gets a reasonable amount of traffic, around 500,000 pageviews per day. This site has a bounce rate of 65%, users stay on average for less than one minute and the regular depth of visits are only 1-2 pages. Wouldn't it be better to have a site with 300,000 pageviews, a bounce rate of 9% where users stay an average of 10 minutes and their depth of visit is between 10 and 15 pages?

 On the flip side, if the bounce rate to your stories is 100% is that really a good thing?

## Old ways of measuring traffic

Previously, you would be inclined to measure your traffic with the following stats:

  * Pageviews

  * Unique Visitors

  * Bounce Rate

  * Exit Rate

  * Content by title

  * Popular time of day

These metrics give you some very basic ideas of what's going on around your site. They answer the Who, What, When and Where. What's missing from this equation? **The Why**

## Outcomes and Conversion Rates

One of the goals of your news website should always be improved outcomes and conversion rates. Your tracking funnels and goals aren't you? If you don't have goals, you need to think long and hard about what you want your site to do. This isn't the same thing as your mission statement. These goals directly affect your bottom line. It doesn't matter if your site is an E-commerece site or not, your bottom line will always be money.

One of the most simple goals you can have is to get new visitors to subscribe to your newsletter. If they're tech savvy, you'll one them to subscribe to your RSS feed. Having someone choose to receive your content is sort of the holy grail for news sites. RSS subscribers are usually some of your most dedicated readers and subscribers. They'll most likely be willing to support your site through purchases or donations.

Another way to look at traffic is by segmenting your traffic. Your three main categories of traffic will be Direct Traffic, Search Traffic and Referral Traffic. You should also segment your traffic into social media, email and RSS campaigns. Not tagging and following campaigns will result in inaccurate results for Direct Traffic. This could give you a completely different view of what's going on with your site.

Segmenting your traffic can also help you establish your Conversion Rates for goals. It will let you know where your most valuable traffic is coming from. It will also let you measure how you can increase conversions for other types of traffic. You might find that direct traffic is most likely to donate money to your site or buy one of your products while search engine traffic and referrals are simply passerby's. Referral traffic is also a good source to help you accomplish your first goal of signing up for email updates or subscribing to your RSS feed.

## New ways of measuring traffic

Consider if you will these new metrics for traffic:

  * Visitor loyalty

  * Depth of visit

  * Recency

  * Length of visit

These metrics, while seemingly irrelevant, will actually build a very important picture for your site: **Engagement**. Why is facebook so popular? Because if people could, they would spend all day on it. It's an extension of their physical social lives. I'm not suggesting you build a news site that everyone would want to spend all day on, that would be silly. I'm suggesting that you look at an aggregate total of engagement on your site. If designed and maintained properly, people will start to frequent your site more often. Things like related posts, social media tools, comments, and a strong user community give readers incentive to return.

If your site is slow, hard to navigate, or doesn't have a good internal site search, you're S.O.L. and it needs to be fixed A.S.A.P.

## Conclusion

Using goals, outcomes and conversion rates, you'll be able to increase your visitor loyalty, depth of visit and recency. When you couple those numbers with pageviews and present your advertisers how engaged your most valuable customers are, you'll be presenting them with a true snapshot of what's going on with your site.


text:
---
layout: single
permalink: /projects/IBM/Data_Parallelism_ML.html
excerpt: This project cooperates with Dr. Andrew Rosenberg, Dr. Minghung Chen, Dr. Ihsin Chung, and Dr. Weichung Wang
header:
  overlay_image: /images/projects/subheads.jpg
  overlay_filter: 0.5
title: "Analysis of Data Parallelism Acceleration on Speech Recognition and Synthesis Algorithm (TTS)"
author_profile: true
comments: true
---

## Introduction

  The purpose is to accelerate the speech algorithm by parallelism using multiple GPUs. The algorithm given by speech group in IBM Thomas J. research center is about converting the word to spectrum, including
  three models: (i) encoder, (ii) decoder and (iii) post process, as shown in following figure.

Figure: Structure of speech algorithm.

## Goal
  This study accelerated the speech algorithm by data parallelism. The analysis discusses some challenges and how they are addressed. The following is research method:

  1. Data Parallelism: Add data parallelism, maximize the GPUs utilization and find the bottleneck which reduced the utilization of GPUs.

  2. Analysis: Analyze each function and accelerate it further and find the bottleneck function.

## Results
  * The function ''trainloader'' block the communication between CPU and GPUs.

Figure: Comparison with and without function ''trainloader''.

    By the way, The function ''trainloader'' is to sort the data before generation.

  * In order to verify the bottleneck, observe the performance without the function ''trainloader'', when using more GPUs. As shown in following figure, utilization of one GPU is improved when we use more GPUs.

Figure: Comparison utilization of one GPU in different number of GPUs.

  * Removing the function ''trainloader'', observe the performance of each function. The following figure shows the relation between the GPU utilization and the training time taken in each function. The performance is improved, except for function ''decoder'' and ''postproc''.

Figure: Comparison each function in different number of GPUs.

## References
  1. A. Rosenberg, A. Sethy, B. Ramabhadran and M. Picheny, End-to-end Speech Recognition and keywords search on low resource language.

## Material

  [Poster](./../../../pdf/projects/IBM/Data_Parallelism.pdf)

## Acknowledgements

  I sincerely thank my advisor Dr. Rosenberg, Dr. Chung and Dr. Chen for the guidance and encouragement. Also, I would like to thank Dr. Wang for this intern opportunity at IBM Research.


text:
# Nearby Tweets
Instead of viewing tweets based on who you follow, Nearby Tweets gives you an interface to view all the tweets that have been posted around your current geo-location. See who says what around you.

## How It's Made:

**Tech used:** HTML, CSS, JavaScript, Node.js, Express.js

## Optimizations

## Lessons Learned:

## Examples:

## How to run Nearby Tweets locally
Install dependencies:
- node (6.9.1)
- npm (3.10.8)

In terminal:
```
git clone https://github.com/r3dcrosse/nearby-tweets.git && cd nearby-tweets
npm install
npm start
```
Now open [http://localhost:1337](http://localhost:1337) to run the app locally


text:
#  How to specify samples to download

The command-line interface provides a way to give GSE or SRA accession IDs. By default, `geofetch` will download all the samples it can find in the accession you give it. What if you want to restrict the download to just a few samples? Or what if you want to combine samples from multiple accessions? If you want more control, either because you have multiple accessions or you want to specify a subset of samples, then you can use the *file-based sample specification*, in which you provide `geofetch` with a file listing your GSE/GSM accessions.

## The file-based sample specification

Create a file with 3 columns that correspond to `GSE`, `GSM`, and `Sample_name. You may mix 1, 2, and 3 column lines in the file. An example input file could look like this:

```console
GSE123  GSM#### Sample1
GSE123  GSM#### Sample2
GSE123  GSM####
GSE456
```

By default, `geofetch` will download all the samples in every included accession, but you can limit this by adding a second column with **GSM accessions** (which specify individual samples with a **GSE dataset**). If the second column is included, a third column may also be included and will be used
as the sample_name; otherwise, the sample will be named according to the GEO Sample_title field. Any columns after the third will be ignored.

This will download 3 particular GSM experiments from GSE123, and everything from GSE456. It will name the first two samples Sample1 and Sample2, and the third, plus any from GSE456, will have names according to GEO metadata.

repository: pepkit/geofetch

repo_name: pepkit/geofetch


text:
# GSO
*Googling Stack Overflow*
[![Screencast](http://i.imgur.com/feBUqnJ.gif)](https://asciinema.org/a/123375)

Thank you [Daniel](https://stackoverflow.com/a/35754890/2689923),
[Brionius](https://stackoverflow.com/a/18262384/2689923),
and [bytecode77](https://stackoverflow.com/a/29915909/2689923)!

GSO now work exclusively in Python 3. Confirmed to work in NeoVim.

*(GSO now also prints the answer URL.)*

## Installation

*(If you just want to try,
there are demo keys at the bottom of this page.
They are shared, so play nice.)*

Make sure your vim supports python scripting (`vim --version | grep +python3` should return something).
If this doesn't work, the `vim-nox-py2` package on ubuntu has this (`sudo apt-get install vim-nox-py2`),
else, look to [SO](https://vi.stackexchange.com/questions/10242/vim-8-0-python-support).

Then, install python dependencies:

````
pip3 install google-api-python-client Cython py-stackexchange lxml
````

If there are issues with installing `lxml`, it's probably to do with a missing `libxml` library.
The [`lxml`](http://lxml.de/installation.html) site has some help for this.

Get API keys for [Google Custom Search](https://developers.google.com/custom-search/json-api/v1/overview)
(scroll to API key), and [Stack Apps](https://stackapps.com/apps/oauth/register).
This is free, don't be intimidated by the forms!
Enter *whatever* in the boxes, and the key generated for you will be compatible with this app.
Trust me, it's worth it.

Put these into
environment variables `GOOGLE_KEY` and
`SE_KEY`, respectively (e.g., `export GOOGLE_KEY="......"`).

(Vundle) Add this repo to your `.vimrc` file:

````
Plugin 'MilesCranmer/gso'
````

Then, just `:PluginInstall` in vim.

**(optional)** Map Ctrl-E to type ":GSO " for you, by putting the following in your `.vimrc`:
```vim
nnoremap <C-e> :GSO
```

Usage
-----

````
:GSO [(-l | --language) <language>] [-n | --no-text] [<search>...]
````

For example, in a file `sort.py`, run:

````
:GSO Do a bubble sort
````

And watch the python code get dumped below your cursor.
GSO will append the language to your query by the file extension, but you can set it explicitly by:

````
:GSO -l haskell Generate a fibonacci sequence
````

FAQ
---

- The Python compiled into my vim is saying it can't see googleapi-client, what do I do?

I have a similar problem and made a hack around it. Your gso should be installed into ~/.vim/gso. Edit the file ~/.vim/gso/plugin/gso.vim, and after each `python << EOF`, paste the following lines:

```
import sys
sys.path.append('....')
```

Replace the inside of the string with the "site-packages" directory where googleapi-client is installed. Make sure you use python 3 to install the packages, or optionally replace the `python3 << EOF` with `python << EOF`.

## Tools

There is a shell utility in `tools`. It simply calls the GSO command and dumps the result to the /dev/stdout.
Copy it to `/usr/bin/gso` (or anywhere on the `PATH`), then call it as you normally would:

```bash
➜  gso How to change the url of a git remote

GSO>>>
You can
git remote set-url origin git://new.url.here

(see git help remote) or you can just edit .git/config and change the
URLs there. You're not in any danger of losing history unless you do
something very silly (and if you're worried, just make a copy of your
repo, since your repo is your history.)
<<<GSO
```

Docker
------

To pull and run (with your Google and Stack apps API keys, or the demo ones at the bottom):

````
docker run -it -e GOOGLE_KEY=$GOOGLE_KEY -e SE_KEY=$SE_KEY mcranmer/gso
````

Then, inside vim:

````
:GSO Flatten a list of lists
````

And it will dump the highest score answer to below your cursor.

# TODO/Ideas

- Unit tests. Apparently these are uncommon among vim plugins, so there is little built-in testing functionality, but since I am using a lot of python, I could just write regular python `unittests` on the `gso` module.
- Automatic reading of code, triggered by a flag, so that you can dump the current line of code to the search query to help your results. This way, it's a little bit like an advanced `man` function.
- Automatic piping of error messages to GSO, have it dump a solution to your error in the code. This might have to be linked to the build command, e.g., make. Then, if make produces a nonzero error message, you activate GSO at the cursor position. This could be something you toggle on and off. It could also just be called, e.g., by an empty :GSO command after an error. You could also add functionality to turn specific errors off if they are too basic (e.g., forgetting a semi-colon), or too common (e.g., generic seg fault).
- (#1 TODO) **Multi answer/multi question, as well as easy keystroke swapping. This would have GSO load up a bunch of answers/questions to the quickfix list, then you could use unimpaired.vim to quickly replace the pasted text below your cursor.**
- Answer preview, so you can see answers in a new pane, and swipe between them until you like one. Then you could hit some keystroke to dump it in.
- General speedups (though this isn't really needed on an AWS instance, so I might not work on this for a while).
- Comments for more languages built-in.
- Improve the shell utility so it doesn't have to open vim, it just calls the python functions.
- (crazy idea) Have something that recognizes what variables you are dealing with, tries to guess which ones to use in the dumped code, then does a search and replace. This could be so you can just rapid fire dump code without thinking much. It wouldn't be a negative, as you likely have to replace some variables manually anyway. The initial implementation could do simple things, such as seeing if you are inside a loop, then taking the looped over variable, and maybe replacing the most common variable in the pasted text with your looped one... But again, this is a crazy idea.

## Other

This is the custom search engine that GSO uses: https://cse.google.com/cse/publicurl?cx=003962226882031433174:qk7rs-ca-bi

Currently, it searches the stackoverflow, superuser, tex, and unix forums.

SE: "NExeVkJzlom8ZUagXLcHQA(("

GOOGLE: "AIzaSyAk7sxnY_yHAP2OIdSOrgf9JysO8E_xJRo"

repository: MilesCranmer/gso

gha_language: Vim script

repo_name: MilesCranmer/gso


text:
# React to PDF Invoice

This example uses React and styled-components to generate an invoice PDF. You can use this as a jumping off point to generate a PDF with your own custom React / styled-components code.

To run it, `yarn install` at the root of this repo, then run:

```sh
ANVIL_API_TOKEN=your_token yarn react:generate-pdf && open ./generate-react.output.pdf
```

See the [generate-pdf.js](./generate-pdf.js) script, and `components` directory here for the code.

<img width="754" alt="React to HTML to PDF" src="https://user-images.githubusercontent.com/69169/129096427-c32ed4f1-bb7b-4bda-86df-830f9f18a690.png">


text:
# Nonogram solver
This repo is toy implementation of nonogram solver using genetic algorihtm.

Sample puzzles are in samples directory.

## Usage

```plaintext
pip3 install -r requirements.txt
python3 nonogram_solver.py
```


text:
---
title: Home Automation
duration: May 2014 – July 2014
skills:
  - C
  - User Interface Design
  - Analytical and Math skill
---

## About

This project, in particular deals with controlling air conditioner using hardware interface setup via the internet through webpage. Main components of this setup is arduino Ethernet shield, arduino board and hacked printed circuit design (PCB) of an air conditioner remote.
The client computer connects to the server using a html requests that allows user to interact with the hardware setup which is interfaced to an air conditioner via graphical user interface (GUI). The GUI include buttons which are used to regulate the temperature.
A special button which helps you in anticipating the room temperature by collecting data from the temperature sensor that is in built in hardware setup, helps you in accurately regulating the room temperature

Screenshot of project

## Features

- Regulates the temperature using GUI
- Identifies the current temperature in room


text:
# A Python Hive Library

`hive-python` is a Hive library for Python. It comes with a
BIP38 encrypted wallet and a practical CLI utility called `hivepy`.

This library currently works on Python 2.7, 3.5 and 3.6. Python 3.3 and 3.4 support forthcoming.

# Installation

With pip:

```
pip3 install hivepy      # pip install hivepy for 2.7
```

From Source:

```
git clone https://github.com/pharesim/hive-python.git
cd hive-python
python3 setup.py install        # python setup.py install for 2.7
```

## Homebrew Build Prereqs

If you're on a mac, you may need to do the following first:

```
brew install openssl
export CFLAGS="-I$(brew --prefix openssl)/include $CFLAGS"
export LDFLAGS="-L$(brew --prefix openssl)/lib $LDFLAGS"
```

# CLI tools bundled

The library comes with a few console scripts.

* `hivepy`:
    * rudimentary blockchain CLI (needs some TLC and more TLAs)
* `hivetail`:
    * useful for e.g. `hivetail -f -j | jq --unbuffered --sort-keys .`

# Documentation

Documentation is available at **http://hive.readthedocs.io**

# Tests

Some tests are included.  They can be run via:

* `python setup.py test`

# TODO

* more unit tests
* 100% documentation coverage, consistent documentation
* migrate to click CLI library

# Notice

This library is *under development*.  Beware.

repository: pharesim/hive-python

gha_language: Python

repo_name: pharesim/hive-python


text:
# How to set up DNS records on gandi.net to use a custom domain on Github Pages

> You would think it would be easy to find this information, but none of the Github or Gandi documentation is clear so I have recorded the required steps here.


text:
## MLL Toolkit

---

Python program(s) to be used as reference for preprocessing the mll_leukemia.txt dataset.

How to use them? It's really simple!

Step 01: Run the `mll-leukemia-preprocessing.py` preprocessing code using python 3

Step 02: Follow the on-screen prompts

Step 03: yay!

---

In the dataset, each column represents a sample and each row is an associated attribute label. The class labels are not directly given but instead a separate row is used to denote the class labels. It has three classes. Using this toolkit, the top **`n`** attributes can be chosen by calculating the Standard Deviation. The dataset is transformed by keeping the samples row wise and the attributes column wise. Then each sample is provided the associated class label. The output is provided as a CSV file. The original dataset is also converted from `.txt` format to `.csv` format. The top `n` selected dataset is normalized using Z-Score Normalization.

> Note that now when you run the preprocessor, it also creates two associated files, one where the dataset is converted to proper CSV format and the other where a CSV file of the selected datasets are created.

repository: kalyaniuniversity/mgx-datasets

repo_name: kalyaniuniversity/mgx-datasets


text:
# Docker Cheatsheet

If you can't find what you are looking for try my other sources:

* [wiki.ruanbekker.com:docker](https://wiki.ruanbekker.com/index.php/Category:Docker)
* [blog.ruanbekker.com:docker](https://blog.ruanbekker.com/blog/categories/docker/)
* [sysadmins.co.za:docker](https://sysadmins.co.za/tag/docker/)

## Manipulating Output:

Filter and specify the name that you are interested in:

```
$ docker ps -f name=my-hostname-service
CONTAINER ID        IMAGE                        COMMAND  CREATED              STATUS              PORTS                     NAMES
edb30579c208        ruanbekker/hostname:latest   "/app"   About a minute ago   Up About a minute   <IP_ADDRESS>:42177->8080/tcp   my-hostname-service-1234
```

Only output the ID:

```
$ docker ps -f name=my-hostname-service --format '{{.ID}}'
edb30579c208

or:

$ docker ps -f name=my-hostname-service -q
edb30579c208
```

If you have more than one container with the same prefix, but you are only interested in the most recent one:

```
$ docker ps -f name=my-hostname-service -ql
edb30579c208
```

ID, string characters and Name:

```
$ docker ps  -f name=my-hostname-service --format '{{.ID}} -> {{.Names}}'
edb30579c208 -> my-hostname-service-1234
```

Chaining them to exec into the container:

```
$ docker exec -it $(docker ps -f name=my-hostname-service -ql) sh
```

More examples:

- https://docs.docker.com/engine/reference/commandline/ps/

## Permissions

### Copy as User

```
FROM python:2.7
RUN pip install Flask==0.11.1
RUN useradd -ms /bin/bash admin
COPY --chown=admin:admin app /app
WORKDIR /app
USER admin
CMD ["python", "app.py"]
```

## Template Variables

For Docker:

```
$ docker run -it --log-driver json-file --log-opt tag="{{.ImageName}}|{{.Name}}|{{.ImageFullID}}|{{.FullID}}|{{.ID}}" alpine echo hi
hi
```

Get the logfile:

```
$ docker inspect $(docker ps -l) | jq '.[].LogPath'
/var/lib/docker/containers/b8e6523c8741d33f778a4f899dc04dab912472cedfba5ab71119a8c9ab1555a8/b8e6523c8741d33f778a4f899dc04dab912472cedfba5ab71119a8c9ab1555a8-json.log
```

View the content:

```
$ cat /var/lib/docker/containers/b8e6523c8741d33f778a4f899dc04dab912472cedfba5ab71119a8c9ab1555a8/b8e6523c8741d33f778a4f899dc04dab912472cedfba5ab71119a8c9ab1555a8-json.log
{"log":"hi\r\n","stream":"stdout","attrs":{"tag":"alpine|festive_bell|sha256:e7d92cdc71feacf90708cb59182d0df1b911f8ae022d29e8e95d75ca6a99776a|b8e6523c8741d33f778a4f899dc04dab912472cedfba5ab71119a8c9ab1555a8|b8e6523c8741"},"time":"2020-07-07T12:35:12.3938298Z"}
```

- https://docs.docker.com/config/formatting/

For Swarm:
- https://forums.docker.com/t/example-usage-of-docker-swarm-template-placeholders/73859

Get a container to report the host's hostname:

```
version: '3.7'
services:
  telegraf:
    ..
    hostname: "{{.Node.Hostname}}"
```

## Update

### Service Update

Add a constraint to move to a worker node:

```
$ docker service update --constraint-add 'node.role==worker' my-service-name
```


text:
# LSTM_timeseries_benchmark_simple_sine_f

Some links to read:

https://github.com/keras-team/keras/issues/3086
https://deepai.org/publication/improving-irregularly-sampled-time-series-learning-with-dense-descriptors-of-time
https://www.nature.com/articles/s41598-018-24271-9
https://machinelearningmastery.com/lstm-model-architecture-for-rare-event-time-series-forecasting/
https://www.reddit.com/r/deeplearning/comments/cyn9v5/irregular_time_interval_by_lstm/
https://hea-www.harvard.edu/AstroStat/aas230_2017/PProtopapas_20170605_BAAS10403.pdf
https://towardsdatascience.com/using-lstms-to-forecast-time-series-4ab688386b1f
https://fairyonice.github.io/Understand-Keras%27s-RNN-behind-the-scenes-with-a-sin-wave-example.html


text:
Scenario
========

Problem
-------

A template shows one thing to all anonymous users, and something else to all
authenticated users (but nothing specific per-user, although that would be just
as easy to solve). There are 2 possible variations of content for this URL,
so the cache should have stored 2 responses for this URL.

In the template/view, there is a call to `request.user.is_authenticated()`
This will trigger the session backend to set `session.accessed = True`

When the session middleware sees this value, it will set `Vary: Cookie` on the
response headers. This is good because the user's browser needs to allow
a user to see version A, log in, see version B, log out, see version A, etc.
The browser has it's own caching and needs `Vary: Cookie` to work correctly.

When the built in Django cache middleware sees `Vary: Cookie`, it will cache a
response for each cookie value that is encountered. Each user has their own
"sessionid", which is included in the cookie value.

The cache middleware is now caching 1 version for every single unique session.
This could mean thousands of cached copies, but we only really needed two!

Solution
--------

There is no getting around the `Vary: Cookie` header that gets sent to the
client. This is needed for caching on their end. However, we can do the server
side caching more intelligently, so that only 2 responses will be stored.

Normally, after `request.user` is accessed, the cache middleware will use the
cookie value when generating a cache key for the response. This is a problem
because each user has their own cookie value. Instead of using the cookie
value in the cache key, this view can use the user's authentication status:
True or False.

The `vary_on_view` decorator will force the cache middleware to use a custom
value instead of the cookie value, while not affecting any response headers
that are needed by the client to correctly do its own caching.

You can decorate views with once-off functions, using lambdas or regularly
defined functions. They must take the same arguments as the view.

    @vary_on_view(lambda request, id: request.user.is_authenticated())
    def story_view(request, id):
        story = get_object_or_404(Story, id=id)
        authenticated = request.user.is_authenticated()
        data = {'story': story, 'authenticated': authenticated}
        return render_to_response('story.html', data)

You can also create reusable decorators for common usage. View the "decorators"
module to see the included ones, and to see how to make new ones. Here is the
same view, but using the included decorator `@vary_on_authentication_status`.

    @vary_on_authentication_status
    def story_view(request, id):
        story = get_object_or_404(Story, id=id)
        authenticated = request.user.is_authenticated()
        data = {'story': story, 'authenticated': authenticated}
        return render_to_response('story.html', data)

repository: raymondbutcher/django-cache-middleware

repo_name: raymondbutcher/django-cache-middleware


text:
# Event Connect

## Description

An application built in Rails that tracks events for multiple users. Users can choose from multiple job types, and easy see upcoming meetings and other events and possible conflicts.

## License

[The MIT License (MIT)](http://opensource.org/licenses/MIT).


text:
# Cadence Samples
These are some samples to demostrate various capabilities of Cadence client and server.  You can learn more about cadence at:
* Cadence: https://github.com/uber/cadence
* Cadence Client: https://github.com/uber-go/cadence-client

## Prerequisite
Run Cadence Server

See instructions for running the Cadence Server: https://github.com/uber/cadence/blob/master/README.md

See instructions for using CLI to register a domain(name as "samples-domain"): https://cadenceworkflow.io/docs/cli/#quick-start
 or https://github.com/uber/cadence/blob/master/tools/cli/README.md

## Steps to run samples
### Build Samples
```
make
```

### Run HelloWorld Sample
* Start workers for helloworld workflow and activities
```
./bin/helloworld -m worker
```
* Start workflow execution for helloworld workflow
```
./bin/helloworld -m trigger
```

### Commands to run other samples

#### cron
```
./bin/cron -m worker
```
Start workflow with cron expression scheduled to run every minute.
```
./bin/cron -m trigger -cron "* * * * *"
```

#### dsl
```
./bin/dsl -m worker
```
```
./bin/dsl -m trigger -dslConfig cmd/samples/dsl/workflow1.yaml
./bin/dsl -m trigger -dslConfig cmd/samples/dsl/workflow2.yaml
```

#### expense
See more details in https://github.com/uber-common/cadence-samples/blob/master/cmd/samples/expense/README.md

#### fileprocessing
```
./bin/fileprocessing -m worker
```
```
./bin/fileprocessing -m trigger
```

#### recipes/branch
```
./bin/branch -m worker
```
Run branch workflow
```
./bin/branch -m trigger -c branch
```
Run parallel branch workflow
```
./bin/branch -m trigger -c parallel this will run the parallel branch workflow
```

#### recipes/choice
```
./bin/choice -m worker
```
Run the single choice workflow
```
./bin/choice -m trigger -c single
```
Run the multi choice workflow
```
./bin/choice -m trigger -c multi
```

#### greetings
```
./bin/greetings -m worker
```
```
./bin/greetings -m trigger
```

#### pickfirst
```
./bin/pickfirst -m worker
```
```
./bin/pickfirst -m trigger
```

#### mutex
```
./bin/mutex -m worker
```
```
./bin/mutex -m trigger
```

#### retryactivity
```
./bin/retryactivity -m worker
```
```
./bin/retryactivity -m trigger
```

#### splitmerge
```
./bin/splitmerge -m worker
```
```
./bin/splitmerge -m trigger
```

#### timer
```
./bin/timer -m worker
```
```
./bin/timer -m trigger
```

#### childworkflow
```
./bin/childworkflow -m worker
```
```
./bin/childworkflow -m trigger
```

#### dynamic
```
./bin/dynamic -m worker
```
```
./bin/dynamic -m trigger
```

#### localactivity
See more details in https://github.com/uber-common/cadence-samples/blob/master/cmd/samples/recipes/localactivity/README.md

#### query
See more details in https://github.com/uber-common/cadence-samples/blob/master/cmd/samples/recipes/query/README.md

#### recovery
See more details in https://github.com/uber-common/cadence-samples/blob/master/cmd/samples/recovery/README.md

repository: stungkit/cadence-samples

gha_license_id: NOASSERTION

repo_name: stungkit/cadence-samples


text:
Cats examples
=============

This repositories accompanies a couple of sessions where we went over some of the core concepts of Scala Cats.

Further reading:
* [Cats repository on GitHub](https://github.com/typelevel/cats)
* [Documentation of data types](https://typelevel.org/cats/datatypes.html)
* [API documentation](https://typelevel.org/cats/api/cats/index.html)
* An introduction to Cats (Dutch) ([PDF](Introducing%20Cats.pdf), [MarkDown](Introducing%20Cats.md))
* [Cats book](https://books.underscore.io/scala-with-cats/scala-with-cats.pdf), see also [useful chapters](useful_chapters_in_cats_book.md)

repository: Dans-labs/scala-cats-examples

gha_language: Scala

repo_name: Dans-labs/scala-cats-examples