text:
Updating Project Files
==

t is a rather common scenario for files to be updated in the middle of a project. For example, after you have finished creating your project, the customer might send an additional file to the project manager, which needs to be incorporated into the project. Another common use case is that the customer finds out that he/she has sent an outdated source file to the project manager, and therefore provides a more recent version. In this case, the updated file needs to replace the document that is already in the project. Any new or updated files should undergo the same task sequence as the files that are already in the project, e.g. conversion to a translatable format (SDLXliff), file analysis, pre-translation, etc.

Therefore, the project manager will first add the new or updated files and apply the same task sequence to those files that were used on the files that are already in the project.

If you want your application to allow users to add new files or update existing ones with a newer version, you can add a helper function called, e.g. ```UpdateFile```. In our sample implementation this helper function takes the following parameters: a [FileBasedProject](../../api/projectautomation/Sdl.ProjectAutomation.FileBased.FileBasedProject.yml) object, the unique id of the file to be replaced, and the name and path of the updated file to be added to the project:

# [C#](#tab/tabid-1)
```cs
private void UpdateFile(FileBasedProject project, Guid fileId, string newFileName)
```
***

Before we actually replace the existing project file, it is worth taking a look at the various properties that you can retrieve on a file. Each project file is uniquely identified by an id (a guid). To get a handle on a file, you can apply the [GetFile](../../api/projectautomation/Sdl.ProjectAutomation.FileBased.FileBasedProject.yml#Sdl_ProjectAutomation_FileBased_FileBasedProject_GetFile_System_Guid_) method to the project. This method takes the file guid as parameter. The sample code below illustrates how to create an object based on the [ProjectFile](../../api/projectautomation/Sdl.ProjectAutomation.Core.ProjectFile.yml) class and how various properties can be applied to retrieve file information such as the name, the usage, the folder it is stored in, etc.:

# [C#](#tab/tabid-2)
```cs
string fileInfo;
ProjectFile thisFile = project.GetFile(fileId);
fileInfo = "File name: " + thisFile.Name + "\n";
fileInfo += "File usage: " + thisFile.Role.ToString() + "\n";
fileInfo += "Belongs to project with the id: " + thisFile.ProjectId.ToString() + "\n";
fileInfo += "Language: " + thisFile.Language.DisplayName + "\n";
fileInfo += "Stored in folder: " + thisFile.LocalFilePath + "\n";
fileInfo += "Unique file id: " + thisFile.Id.ToString() + "\n";
MessageBox.Show(fileInfo);
```
***

The actual file replacement is carried out by applying the [AddNewFileVersion](../../api/projectautomation/Sdl.ProjectAutomation.FileBased.FileBasedProject.yml#Sdl_ProjectAutomation_FileBased_FileBasedProject_AddNewFileVersion_System_Guid_System_String_) method to the project. This method requires the unique file id (guid) and the name and path of the new file (string) as parameters:

# [C#](#tab/tabid-3)
```cs
project.AddNewFileVersion(fileId, newFileName);
```
***

Note that when applying this method the original file will be overwritten with the updated file within the project folder structure, in particular in the source language sub-folder of the project. However, it will not be automatically processed, e.g. it will not be converted to SDLXliff. Depending on when the updated file is added, you might have to re-run tasks such as convert to translatable format, copy to target languages, etc. again:

# [C#](#tab/tabid-4)
```cs
Guid[] fileIds = { fileId };

project.RunAutomaticTask(fileIds, AutomaticTaskTemplateIds.ConvertToTranslatableFormat);
project.RunAutomaticTask(fileIds, AutomaticTaskTemplateIds.CopyToTargetLanguages);
```
***

Note that when you provide a different file name in the method, the file that was originally added, will not be replaced. The update file will rather be added as a completely new file to the project, and it will obtain a new id. This file will also have to be processed by (re-)running the various tasks.

# [C#](#tab/tabid-5)
```cs
project.AddNewFileVersion(fileId, newFileName);
```
***

See Also
--
[Adding Files and Folders](adding_files_and_folders.md)

[Adding Files in the Folder to the Project](adding_file_in_the_folder_to_the_project.md)

repository: icmoldovan/studio-api-docs

gha_language: JavaScript

repo_name: icmoldovan/studio-api-docs


text:
# Wide_Resnet

[简体中文](./README_ch.md) | English

   * [Wide Resnet](#Wide_Resnet)
      * [1_Introduction](#1_Introduction)
      * [2_Accuracy](#2_Accuracy)
      * [3_Dataset](#3_Dataset)
      * [4_Environment](#4_Environment)
      * [5_Quick_start](#5_Quick_start)
         * [step1: clone](#step1-clone)
         * [step1: train](#step2-train)
         * [step2: eval](#step3-eval)
      * [6_Code_structure](#6_Code_structure)
         * [6.1_structure](#61-structure)
         * [6.2 _Parameter_description](#62_Parameter_description)
         * [6.3_train_process](#63_train_process)
            * [Single_machine_training](#Single_machine_training)
            * [Multi_machine_training](#Multi_machine_training)
            * [Training_output](#Training_output)
         * [6.4_Evaluation_process](#64-Evaluation_process)
      * [7_Model_information](#7_Model_information)

## 1_Introduction
This project reproduces Wide Resnet based on the paddlepaddle framework. It is a variation of ResNet. The main difference lies in the improvement of shortcut of ResNet, the use of "wider" convolution and the addition of dropout layer.

**paper:**
- [1]  Zagoruyko S ,  Komodakis N . Wide Residual Networks[J].  2016.<br>
- link：[Wide Residual Networks](https://arxiv.org/abs/1605.07146)

**Reference items:**
- [https://github.com/xternalz/WideResNet-pytorch](https://github.com/xternalz/WideResNet-pytorch)
- [https://github.com/meliketoy/wide-resnet.pytorch/blob/master/networks/wide_resnet.py](https://github.com/meliketoy/wide-resnet.pytorch/blob/master/networks/wide_resnet.py)

**Link of aistudio:**
[https://aistudio.baidu.com/aistudio/projectdetail/2251959](https://aistudio.baidu.com/aistudio/projectdetail/2251959)

## 2_Accuracy

>The indicators are tested in the test set of cifar10

train from scratch:

| |epoch|opt|batch_size|dataset|memory|card|precision|
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
|1|400|SGD|128|CIFAR10|16G|1|0.9660|

**model download**
link：[aistudio](https://aistudio.baidu.com/aistudio/datasetdetail/104172)

## 3_Dataset

[CIFAR10](http://www.cs.toronto.edu/~kriz/cifar.html)

- Dataset size：
  - train set:50000
  - eval set:10000
  - image size:32 * 32
- Data format：Classification dataset

## 4_Environment

- Hardware：GPU CPU

- Frame:
  - PaddlePaddle >= 2.0.0

# 5_Quick_start

### step1-clone

```bash
# clone this repo
git clone https://github.com/PaddlePaddle/Contrib.git
cd wide_resnet
export PYTHONPATH=./
```
**install**
```bash
python3 -m pip install -r requirements.txt
```

### step2-train
```bash
python3 train.py
```
If you want distributed training and use multiple cards:
```bash
python3 -m paddle.distributed.launch --log_dir=./debug/ --gpus '0,1,2,3' train.py
```

output：
```
Epoch 0: PiecewiseDecay set learning rate to 0.05.
iter:0  loss:2.4832
iter:10  loss:2.3544
iter:20  loss:2.3087
iter:30  loss:2.2509
iter:40  loss:2.2450
```

### step3-eval
```bash
python3 eval.py
```
output：
```
acc:9660 total:10000 ratio:0.966
```

## 6_Code_structure

### 61-structure

```
│  wide_resnet.py                 # model file
│  eval.py                        # eval script
│  README.md                      # english readme
│  README_cn.md                   # chinese readme
│  requirements.txt                # requirement
│  train.py                       # train script
```

### 62_Parameter_description

None

### 63_train_process

#### Single_machine_training
```bash
python3 train.py
```

#### Multi_machine_training
```bash
python3 -m paddle.distributed.launch --log_dir=./debug/ --gpus '0,1,2,3' train.py
```

At this time, the program will import the output log of each process to the debug path:
```
.
├── debug
│   ├── workerlog.0
│   ├── workerlog.1
│   ├── workerlog.2
│   └── workerlog.3
├── README.md
└── train.py
```

#### Training_output
After performing the training, you will get an output similar to the following. Each round of 'batch' training will print the current epoch, step and loss values.
```text
Epoch 0: PiecewiseDecay set learning rate to 0.05.
iter:0  loss:2.4832
iter:10  loss:2.3544
iter:20  loss:2.3087
iter:30  loss:2.2509
iter:40  loss:2.2450
```

### 64-Evaluation_process

```bash
python3 eval.py
```

output:
```
acc:9660 total:10000 ratio:0.966
```
## 7_Model_information

For other information about the model, refer to the following table:

| Anformation | Description |
| --- | --- |
| Author | mingyuan xu|
| Time | 2021.08 |
| Frame Version | >=Paddle 2.0.2|
| Application scenario | Image classification |
| Hardware | GPU、CPU |
| download Link |[aistudio](https://aistudio.baidu.com/aistudio/datasetdetail/104172) |
| Online Link | [botebook](https://aistudio.baidu.com/aistudio/projectdetail/2251959)|

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
# Whatsup -- A frugal serverless up/down monitor

## Purpose

This is a simple serverless up/down monitor that runs every 5 minutes and sends you an alert in Slack if your website is down (or goes from down->up).

I wanted to see if I could use AWS SSM Parameter Store as a free key-value DB. Nothing as brazen as [@QuinnyPig's route53 database](https://twitter.com/QuinnyPig/status/1120653859561459712), but still interesting:

* Use AWS Chalice to define a scheduled AWS Lambda job that runs every 5 minutes.
* Uses SSM Parameter Store as a database to store the last known status of each endpoint.

That's it!

## Prerequisites

- You must have an AWS account, and have your default credentials and AWS Region
  configured as described in the [AWS Tools and SDKs Shared Configuration and
  Credentials Reference Guide](https://docs.aws.amazon.com/credref/latest/refdocs/creds-config-files.html).
- Python 3.7 or later
- Boto3 1.14.20 or later
- AWS Chalice 1.15.1 or later
- Requests 2.23.0 or later
- PyTest 5.3.5 or later (to run unit tests)
- Access to [AWS SSM Parameter Store](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html).

## Cautions

- As an AWS best practice, grant this code least privilege, or only the
  permissions required to perform a task. For more information, see
  [Grant Least Privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege)
  in the *AWS Identity and Access Management
  User Guide*.
- This is an early version and has not been tested very thoroughly.
- Running this code might result in charges to your AWS account.

## Running the code

1. Clone the whatsup repository, initialize a virtual env, and install prerequisite packages.

    ```
    git clone https://github.com/foretheta/whatsup.git
    cd whatsup
    python3 -m venv
    source venv/bin/activate
    pip install -r requirements
    ```

1. Make a copy of the `sample_confg.yaml` file and edit to add the endpoints you want to monitor. Add your Slack webhook for notifications.

    ```
    cp sample_config.yaml config.yaml && vim config.yaml
    ```

1. Deploy the app to your AWS account.

    ```
    whatsup deploy
    ```

### Example structure

The example is divided into the following files:

**app.py**

Defines the scheduled function to monitor your endpoints.. Uses Chalice to decorate scheduled functions and
handle associated actions. Stores data in AWS SSM Parameter Store.

**requirements.txt**

Defines the minimum package versions to deploy to AWS Lambda.

**config.json**

Configuration for the application. It has a list of endpoints you want to monitor and provide the Slack webhook that will send a simple up/down notication to the channel associated with the webhook.

## Running the tests (coming soon)

The unit tests in this module use the moto AWS Services mocker. This captures requests before
they are sent to AWS, and returns a mocked response.
```
python -m pytest
```

## Additional information

- [AWS Chalice Quickstart](https://aws.github.io/chalice/quickstart.html)
- [Boto3 AWS Lambda service reference](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/lambda.html)
- [AWS Systems Manager Parameter Store](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html)

---
Copyright Foretheta, Inc. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

repository: foretheta/whatsup

gha_language: Python

repo_name: foretheta/whatsup


text:
# ifttt-webhook

IFTTT Webhook library for Go

## Usage

```go
i := iftttWebhook.New("<your-api-key>")
i.Emit("<your-event-name>", "value1", "value2", "value3")
```

license: MIT

repository: domnikl/ifttt-webhook

branch_name: refs/heads/main

repo_name: domnikl/ifttt-webhook


text:
# spawn_imagemagick
Use a locally installed ImageMagick in Node to resize image at high speed.
Note that, as its name suggests, it simply spawn a local imagemagick, no low level wrapper here.

## Usage

Copy the **spawn_imagemagick** folder somewhere within you project.

Then:

```js

var sim = require("./path/to/spawn_imagemagick");

// Input file address
var fileIn = "img.jpg";

// Output file address
var fileOut = "imgOut.jpg";

// When creating a small jpeg file, the quality in percentage is mandatory
var jpegQuality = 80;

// Resize an image using largerSide as the larger side
sim.resizeLargerSide(fileIn, fileOut, largerSide, quality)

// Resize an image using a percentage
sim.resizePercent(fileIn, fileOut, percentSize, quality)

// Resize an image given width and height
// note: proportion might not be kept
sim.resize(fileIn, fileOut, width, height, quality)

// Resize an image giving a width. Height is resized accordingly
sim.resizeWidth(fileIn, fileOut, width, quality)

// Resize an image giving a height. Width is resized accordingly
sim.resizeHeight(fileIn, fileOut, height, quality);

// Resize an image giving a total number of pixel (in millions)
// note: in case of impossibility to reach exact MP due to proportion, the first
// lower MP will be used
sim.resizeAreaMP(fileIn, fileOut, millionPixels, quality);

// Crop the largest inner square at the center of the image and resize it
sim.cropSquare(fileIn, fileOut, size, quality);
```

## Todo

Add optional callbacks for success or failure.


text:
Programmatically remove backgrounds from your images using the remove.bg api.

* [Register an account and obtain your api key](https://www.remove.bg/users/sign_up)
* [Remove.bg Developer Documentation](https://www.remove.bg/api)

## Installation

Install via composer:

```
composer require mtownsend/remove-bg
```

*This package is designed to work with any PHP 7.0+ application but has special support for Laravel.*

### Registering the service provider (Laravel users)

For Laravel 5.4 and lower, add the following line to your ``config/app.php``:

```php
/*
 * Package Service Providers...
 */
Mtownsend\RemoveBg\Providers\RemoveBgServiceProvider::class,
```

For Laravel 5.5 and greater, the package will auto register the provider for you.

### Using Lumen

To register the service provider, add the following line to ``app/bootstrap/app.php``:

```php
$app->register(Mtownsend\RemoveBg\Providers\RemoveBgServiceProvider::class);
```

### Publishing the config file (Laravel users)

````
php artisan vendor:publish --provider="Mtownsend\RemoveBg\Providers\RemoveBgServiceProvider"
````

Once your ``removebg.php`` has been published your to your config folder, add the api key you obtained from [Remove.bg](https://www.remove.bg/). If you are using Laravel and put your remove.bg api key in the config file, Laravel will automatically set your api key every time you instantiate the class through the helper or facade.

## Quick start

### Using the class

```php
use Mtownsend\RemoveBg\RemoveBg;

$absoluteUrl = 'https://yoursite.com/images/photo.jpg';
$pathToFile = 'images/avatar.jpg';
$base64EncodedFile = base64_encode(file_get_contents($pathToFile));

$removebg = new RemoveBg($apiKey);

// Directly saving files
$removebg->url($absoluteUrl)->save('path/to/your/file.png');
$removebg->file($pathToFile)->save('path/to/your/file2.png');
$removebg->base64($base64EncodedFile)->save('path/to/your/file3.png');

// Getting the file's raw contents to save or do something else with
$rawUrl = $removebg->url($absoluteUrl)->get();
$rawFile = $removebg->file($pathToFile)->get();
$rawBase64 = $removebg->base64($base64EncodedFile)->get();

file_put_contents('path/to/your/file4.png', $rawUrl);
// etc...

// Getting the file's base64 encoded contents from the api
$base64Url = $removebg->url($absoluteUrl)->getBase64();
$base64File = $removebg->file($pathToFile)->getBase64();
$base64Base64 = $removebg->base64($base64EncodedFile)->getBase64();

file_put_contents('path/to/your/file5.png', base64_decode($base64Url));
// etc...

// Please note: remove.bg returns all images in .png format, so you should be saving all files received from the api as .png.
```

### Advanced usage

Remove.bg offers several request body parameters for each api call. For an up to date list, you should always check the [remove.bg api documentation](https://www.remove.bg/api).

Here is an example of an api call configured with specific request body parameters.

````php
$removebg = new RemoveBg($apiKey);

// Directly saving files
$removebg->url($absoluteUrl)
->body([
    'size' => '4k', // regular, medium, hd, 4k, auto
    'bg_color' => '#CBD5E0',
    'add_shadow' => true, // primarily used for automotive photos as of the time this documentation was written
    'channels' => 'rgba', // rgba, alpha
])
->save('path/to/your/file.png');
````

You may also directly specify request header parameters. As of right now this does not appear to offer much functionality in terms of how the Remove.bg api will consume these headers, but we thought it was important to expose this functionality. Consider the following example:

````php
$removebg = new RemoveBg($apiKey);

// Directly saving files
$removebg->url($absoluteUrl)
->headers([
    'X-Foo-Header' => 'Some Bar Value',
    'X-Foo-Header-2' => 'Some Bar Value 2',
])
->save('path/to/your/file.png');
````

### Account details

The Remove.bg api offers an endpoint to check your account's credit balance and free api call usage. If your application needs to check your available credits before processing images this package makes it an absolute breeze!

The following code example is how you can programmatically check your account information. Note, the ``account`` method has one optional argument: `$getResponseAsObject = true`. By default your response will be returned as an object. You can return the response as an associative array by passing `false` to the `account(false)` method.

````php
$removebg = new RemoveBg($apiKey);

$account = $removebg->account();

// $account will be something like this:
{
  "data": {
    "attributes": {
      "credits": {
        "total": 200,
        "subscription": 150,
        "payg": 50
      },
      "api": {
        "free_calls": 50,
        "sizes": "all"
      }
    }
  }
}
````

To access your total credits you could do so like this: `$account->data->attributes->credits->total`.

A practical example could look something like the following:

````php
$removebg = new RemoveBg($apiKey);

$account = $removebg->account();

if ($account->data->attributes->credits->total >= 1) {
	$removebg->url($absoluteUrl)->save('path/to/your/file.png');
}
````

### Using the global helper (Laravel users)

If you are using Laravel, this package provides a convenient helper function which is globally accessible.

```php
removebg()->url($absoluteUrl)->save(public_path('path/to/your/file.png'));
```

### Using the facade (Laravel users)

If you are using Laravel, this package provides a facade. To register the facade add the following line to your ``config/app.php`` under the ``aliases`` key.

````php
'RemoveBg' => Mtownsend\RemoveBg\Facades\RemoveBg::class,
````

```php
use RemoveBg;

RemoveBg::file($pathToFile)->save(public_path('path/to/your/file.png'));
```

## Credits

- Mark Townsend
- [All Contributors](../../contributors)

## Testing

*Tests coming soon...*

You can run the tests with:

```bash
./vendor/bin/phpunit
```

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

gha_language: PHP

gha_license_id: MIT


text:
# Employee-Tracker

## Overview

Employee-Tracker is an SQL system for tracking and managing employees, departments, and roles. It is run out of the command line using node.js. Employee-tracker allows the user to view, add, and change employees, roles, and departments inside of a database.

### Table of Contents

* Installation and Usage
* Dependencies and Code Snippet
* Sample Team Table
* Languages Used
* Authors
* License
* Acknowledgements

## Insatallation and Usage

Employee-tracker will function from the command line for anybody who has the necessary dependencies installed and runs 'node server.js' from the command line. They can then follow the prompts and access the system.

## Dependencies and Code Snippet

Employee-tracker has the following dependencies:

npm inquirer
npm mysql
npm console.table

To install inquirer, a user simply needs to type 'npm install inquirer' in the command line. Then do the same for both mysql and console.table.

Here is an example of the code used for displaying the table of employees, including a snippet of raw sql code that is submitted to the database:

```
    let query = "SELECT employees.employee_id, employees.first_name, employees.last_name, employees.role_id, role.role_id, role.title, role.salary, department.name ";
    query += "FROM employees LEFT JOIN role ON (employees.role_id = role.role_id) LEFT JOIN department ON (role.department_id = department.department_id)";
    connection.query(query, function(err, res) {
        if (err) throw err;
        const values = [];

        for(i=0; i<res.length; i++){
            let obj = [];
            obj.push(res[i].employee_id);
            obj.push(res[i].first_name);
            obj.push(res[i].last_name);
            obj.push(res[i].title);
            obj.push(res[i].salary);
            obj.push(res[i].name)
            values.push(obj);
        }
        console.table("\n------------------------------------------")
        console.table(["ID","First Name", "Last Name", "Title", "Salary", "Department"], values);
```

### Sample Team Table

Here is an example of a table that was generated using Employee-Tracker:

![image](Assets\EmployeeTable.png.png)

## Languages Used

* [HTML](https://developer.mozilla.org/en-US/docs/Web/HTML)
* [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS)
* [Javascript](https://developer.mozilla.org/en-US/docs/Web/JavaScript)

## Authors

* Sam Poppe

- [Link to Github](https://github.com/PopSizzle)
- [Link to LinkedIn](https://www.linkedin.com/in/sam-poppe-623281193/)

## License

This project is licensed under the MIT License

## Acknowledgments

* Shout out to my teacher Jerome Chenetter and my TAS Kerwin Hy and Mahisha Gunasekaran for teaching me all the skills needed for this project.

repository: PopSizzle/Employee-Tracker

repo_name: PopSizzle/Employee-Tracker


text:
# A Visual Basic Program

**This is a practice program is Visual Basic that simulates the procedure of checking the trade of vegetable buys and sales.**

>#### Description of Exercise
>
>A region controlled the profit margin of traders of vegetable products for three species, tomatoes, eggplant, peppers. In a file named Check.txt recorded the details of the merchants. Each file entry contains the following information:
>>* Last name of trader
>>* Kind of product (1 for tomato, 2 for eggplant, 3 for pepper)
>>* Purchase price of product per kilo
>>* Sell price per kilo
>
> Write a program that reads the file and for each record of the file, calculate the percentage of profit per kilo for the trader:
>>* If the profit percentage is greater than 30%, write in a file named Ιnfringements.txt the data just read and the profit percentage.
>
>After the end of the procedure, the program displays on the screen:
>>* The number of traders with a profit percentage greater than 50%
>>* The average selling price per kilo of tomato
>>* The maximum purchase price per kilo of pepper
>


text:
---
layout: post
title: "How I made my finally block not being called (.Net)"
description: |
  It is widely expected that the compiler or the CLR takes care that the finally block of a try-finally
  statement is called in all cases - even if an exception occurs. But this is not entirely true.
tags: [coding-tips]
excerpt_separator: <!--more-->
lint-nowarn: JL0003
---

In .Net the source code of a ```finally``` block is always called, right?
Even if there is a ```return``` statement or an exception is thrown in the ```try``` block, correct?
I mean, this is the reason why we use ```try-finally``` in the first place.

Well, I got into a case where the code of the ```finally``` block was not called ...

<!--more-->

Let's start with an example of a ```try-finally``` statement:

```cs
public class Repository
{
    private int myTransactionsCount = 0;

    public int TransactionsCount => myTransactionsCount;

    public IEnumerable<string> FindAll()
    {
        try
        {
            myTransactionsCount++;

            yield return "a";
            yield return "b";
            yield return "c";
            yield return "d";
        }
        finally
        {
            myTransactionsCount--;
        }
    }
}
```

This code simulates the access to some database. We first increase the open transactions count,
then return the queried data and use the ```finally``` block to ensure that the transaction counter
is decreased before returning from the method.

When we call this code we would expect that after the execution of ```FindAll``` the transaction count
is the same as before the call - assuming concurrency free execution. Here is a test case:

```cs
[Test]
public void LinQ_WillWork()
{
    var repository = new Repository();

    // just a few more calls to have higher "transaction count"
    var isNotEmpty = System.Linq.Enumerable.Any(repository.FindAll());
    isNotEmpty = System.Linq.Enumerable.Any(repository.FindAll());
    isNotEmpty = System.Linq.Enumerable.Any(repository.FindAll());

    Assert.That(isNotEmpty, Is.True);
    Assert.That(repository.TransactionsCount, Is.EqualTo(0));
}
```

This test case uses LinQ to operate on the data returned from the ```FindAll``` method and
as expected this test case goes green.

Now let's imaging we do not work directly with the enumerator returned by ```FindAll``` but
pass it on to some generic code which works with ```IEnumerable``` instead of ```IEnumerable<T>```.
In this code we use a custom implementation of LinQ's ```Any``` which supports the non-generic
```IEnumerable``` and the implementation looks like this:

```cs
public static bool Any(this IEnumerable self)
{
    return self.GetEnumerator().MoveNext();
}
```

Simple!

And here is the adapted test case which now uses our custom extension method ```Any```:

```cs
[Test]
public void CustomLinQ_WillFail()
{
    var repository = new Repository();

    // just a few more calls to have higher "transaction count"
    var isNotEmpty = AboutCleanCode.EnumerableExtensions.Any(repository.FindAll());
    isNotEmpty = AboutCleanCode.EnumerableExtensions.Any(repository.FindAll());
    isNotEmpty = AboutCleanCode.EnumerableExtensions.Any(repository.FindAll());

    Assert.That(isNotEmpty, Is.True);
    Assert.That(repository.TransactionsCount, Is.EqualTo(0));
}
```

Surprisingly this test case fails!

```
Message:
      Expected: 0
      But was:  3
```

In order to understand the root cause we have to understand how the C# compiler
treats a method with ```yield return``` statements. Inspecting the compiled code with
a [dnSpy](https://github.com/dnSpy/dnSpy) reveals that the generated code looks much different
than what we have typed:

```csharp
public class Repository
{
  public int TransactionsCount
  {
    get { return this.myTransactionsCount; }
  }

  public IEnumerable<string> FindAll()
  {
    Repository.<FindAll>d__3 <FindAll>d__ = new Repository.<FindAll>d__3(-2);
    <FindAll>d__.<>4__this = this;
    return <FindAll>d__;
  }

  private int myTransactionsCount = 0;

  [CompilerGenerated]
  private sealed class <FindAll>d__3 : IEnumerable<string>, IEnumerable, IEnumerator<string>, IEnumerator, IDisposable
  {
    [DebuggerHidden]
    public <FindAll>d__3(int <>1__state)
    {
      this.<>1__state = <>1__state;
      this.<>l__initialThreadId = Environment.CurrentManagedThreadId;
    }

    [DebuggerHidden]
    void IDisposable.Dispose()
    {
      int num = this.<>1__state;
      if (num == -3 || num - 1 <= 3)
      {
        try
        {
        }
        finally
        {
          this.<>m__Finally1();
        }
      }
    }

    bool IEnumerator.MoveNext()
    {
      bool result;
      try
      {
        switch (this.<>1__state)
        {
        case 0:
          this.<>1__state = -1;
          this.<>1__state = -3;
          this.<>4__this.myTransactionsCount = this.<>4__this.myTransactionsCount + 1;
          this.<>2__current = "a";
          this.<>1__state = 1;
          result = true;
          break;
        case 1:
          this.<>1__state = -3;
          this.<>2__current = "b";
          this.<>1__state = 2;
          result = true;
          break;
        case 2:
          this.<>1__state = -3;
          this.<>2__current = "c";
          this.<>1__state = 3;
          result = true;
          break;
        case 3:
          this.<>1__state = -3;
          this.<>2__current = "d";
          this.<>1__state = 4;
          result = true;
          break;
        case 4:
          this.<>1__state = -3;
          this.<>m__Finally1();
          result = false;
          break;
        default:
          result = false;
          break;
        }
      }
      catch
      {
        this.System.IDisposable.Dispose();
        throw;
      }
      return result;
    }

    private void <>m__Finally1()
    {
      this.<>1__state = -1;
      this.<>4__this.myTransactionsCount = this.<>4__this.myTransactionsCount - 1;
    }

    string IEnumerator<string>.Current
    {
      [DebuggerHidden]
      get { return this.<>2__current; }
    }

    [DebuggerHidden]
    void IEnumerator.Reset()
    {
      throw new NotSupportedException();
    }

    object IEnumerator.Current
    {
      [DebuggerHidden]
      get
      {
        return this.<>2__current;
      }
    }

    [DebuggerHidden]
    IEnumerator<string> IEnumerable<string>.GetEnumerator()
    {
      Repository.<FindAll>d__3 <FindAll>d__;
      if (this.<>1__state == -2 && this.<>l__initialThreadId == Environment.CurrentManagedThreadId)
      {
        this.<>1__state = 0;
        <FindAll>d__ = this;
      }
      else
      {
        <FindAll>d__ = new Repository.<FindAll>d__3(0);
        <FindAll>d__.<>4__this = this.<>4__this;
      }
      return <FindAll>d__;
    }

    [DebuggerHidden]
    IEnumerator IEnumerable.GetEnumerator()
    {
      return this.System.Collections.Generic.IEnumerable<System.String>.GetEnumerator();
    }

    private int <>1__state;

    private string <>2__current;

    private int <>l__initialThreadId;

    public Repository <>4__this;
  }
}
```

Whenever we use ```yield return``` the compiler generates a state machine. If we search for
the code of our ```finally``` block we realize that it was moved to a separate method

```cs
    private void <>m__Finally1()
    {
      this.<>1__state = -1;
      this.<>4__this.myTransactionsCount = this.<>4__this.myTransactionsCount - 1;
    }
```

which is only called in two cases

1. the enumerator is moved to the very end, which means the SAME enumerator is used
   to traverse the complete data (case 4)
2. ```Dispose``` is called on the enumerator after usage

As our custom ```Any``` implementation only fetches only the first item AND does NOT call Dispose
the ```<>m__Finally1``` method is not called, so our code from the finally block is NOT executed!

Looking into the implementation of LinQ's ```Any``` shows that ```Dispose``` is always called
(note that ```IEnumerator<T>``` even derives from ```IDisposable``` so the ```using``` statement can be used):

```cs
public static bool Any<TSource>(this IEnumerable<TSource> source) {
    if (source == null) throw Error.ArgumentNull("source");
    using (IEnumerator<TSource> e = source.GetEnumerator()) {
        if (e.MoveNext()) return true;
    }
    return false;
}
```

(From: [Microsoft Reference Source](https://github.com/microsoft/referencesource/blob/master/System.Core/System/Linq/Enumerable.cs))

Now that the root cause is understood it is also clear how to fix the custom ```Any```
implementation:

```cs
public static bool Any(this IEnumerable self)
{
    var enumerator = self.GetEnumerator();
    try
    {
        return enumerator.MoveNext();
    }
    finally
    {
        // important to call dispose if implemented by enumerator
        // to support "yield return" in "try-finally"
        (enumerator as IDisposable)?.Dispose();
    }
}
```

Re-running the test case shows that the issue is fixed and the test case passes.

## What about exceptions?

If our code would throw an exception while computing the value which should be returned
using ```yield return``` then the state machine implemented by the compiler would catch
this exception and call ```Dispose``` on the enumerator as well.

```cs
    bool IEnumerator.MoveNext()
    {
      bool result;
      try
      {
        switch (this.<>1__state)
        {
          // our code would be here and might through an exception
        }
      }
      catch
      {
        this.System.IDisposable.Dispose();
        throw;
      }
      return result;
    }
```

## Sample Code

The sample code used in this post can be found at
[Plainionist/AboutCleanCode](https://github.com/plainionist/AboutCleanCode/tree/main/EnumeratorDispose)

## Conclusion

If you call ```IEnumerable.GetEnumerator``` and work with the enumerator directly make sure
you call ``Dispose`` when you are done!


text:
project_path: /web/tools/workbox/_project.yaml
book_path: /web/tools/workbox/_book.yaml
description: The module guide for workbox-webpack-plugin.

{# wf_updated_on: 2018-03-19 #}
{# wf_published_on: 2017-12-15 #}
{# wf_blink_components: Blink>ServiceWorker #}

# Workbox webpack Plugins  {: .page-title }

Workbox provides two [webpack](https://webpack.js.org/) plugins: one that
generates a complete service worker for you and one that generates a list
of assets to precache that is injected into a service worker file.

The plugins are implemented as two classes in the `workbox-webpack-plugin` module, named
`GenerateSW` and `InjectManifest`. The answers to the following questions can help you choose the
right plugin and configuration to use.

## Which Plugin to Use

### GenerateSW Plugin

The `GenerateSW` plugin will create a service worker file for you and
add it to the webpack asset pipeline.

{% include "web/tools/workbox/_shared/when-to-use-generate-sw.html" %}

### InjectManifest Plugin

The `InjectManifest` plugin will generate a list of URLs to precache and
add that precache manifest to an existing service worker
file. It will otherwise leave the file as-is.

{% include "web/tools/workbox/_shared/when-to-use-inject-manifest.html" %}

## GenerateSW Plugin

You can add the `GenerateSW` plugin to your webpack config like so:

```javascript
// Inside of webpack.config.js:
const {GenerateSW} = require('workbox-webpack-plugin');

module.exports = {
  // Other webpack config...
  plugins: [
    // Other plugins...
    new GenerateSW()
  ]
};
```

This will generate a service worker with precaching setup for all of your
webpack assets.

### Full GenerateSW Config

If you want to use any of the configuration options for the `GenerateSW` plugin,
you'd just need to add an `Object` to the plugin's constructor.

For example:

```javascript
// Inside of webpack.config.js:
const {GenerateSW} = require('workbox-webpack-plugin');

module.exports = {
  // Other webpack config...
  plugins: [
    // Other plugins...
    new GenerateSW({
      option: 'value',
    })
  ]
};
```

      These options apply to the webpack compilation.

{% include "web/tools/workbox/_shared/config/groups/common-webpack.html" %}

      These options configure behavior unrelated to the webpack compilation.

{% include "web/tools/workbox/_shared/config/groups/common-generate-schema.html" %}
{% include "web/tools/workbox/_shared/config/groups/base-schema.html" %}

## InjectManifest Plugin

You can add the `InjectManifest` plugin to your webpack config like so:

```javascript
// Inside of webpack.config.js:
const {InjectManifest} = require('workbox-webpack-plugin');

module.exports = {
  // Other webpack config...
  plugins: [
    // Other plugins...
    new InjectManifest({
      swSrc: './src/sw.js',
    })
  ]
};
```

This will create a precache manifest (a list of webpack assets) and inject it into
your service worker file via `importScripts()`.

### Full InjectManifest Config

You can pass the appropriate configuration as properties of an `Object` to the plugin's constructor.

For example:

```javascript
// Inside of webpack.config.js:
const {InjectManifest} = require('workbox-webpack-plugin');

module.exports = {
  // Other webpack config...
  plugins: [
    // Other plugins...
    new InjectManifest({option: 'value'})
  ]
};
```

      These options are specifically for the webpack compilation.

{% include "web/tools/workbox/_shared/config/groups/common-webpack.html" %}

      These options configure behavior unrelated to the webpack compilation.

{% include "web/tools/workbox/_shared/config/groups/common-inject-schema.html" %}
{% include "web/tools/workbox/_shared/config/groups/base-schema.html" %}

## Cache additional, non-webpack assets

By default, both plugins generate a precache manifest that contains URLs for assets created by the
current webpack compilation. Any assets that webpack doesn't "know" about will not be picked up.

If you need to precache additional assets that are managed outside of webpack, then you can
use the `globDirectory` and `globPatterns` options to specify how to find those additional assets.

If you decide to use `globDirectory` and `globPatterns`, the following applies:

- The [`glob` pattern matching](https://github.com/isaacs/node-glob#glob-primer) will be performed
against the local file system, and the directory that `globDirectory` is set to must exist at the
time the plugin runs. This might run afoul of
[`webpack-dev-server` configurations](https://github.com/webpack/webpack-dev-server), where an
in-memory file system is used.
- The options that work with `glob`-based precache manifests, like `manifestTranforms` and
`modifyUrlPrefix`, can also be used, but they'll apply **only** to the entries that are matched via
`glob` patterns, and not to any assets that are picked up via the webpack compilation.

## Extra Info

Guidance on using the plugins within the context of a larger webpack build can be found in the
"[Progressive Web Application](https://webpack.js.org/guides/progressive-web-application/)" section
of the webpack documentation.

repository: shanselman/WebFundamentals

repo_name: shanselman/WebFundamentals


text:
Cloudinary
==========

Cloudinary is a cloud service that offers a solution to a web application's entire image management pipeline.

Easily upload images to the cloud. Automatically perform smart image resizing, cropping and conversion without installing any complex software. Integrate Facebook or Twitter profile image extraction in a snap, in any dimension and style to match your website’s graphics requirements. Images are seamlessly delivered through a fast CDN, and much much more.

Cloudinary offers comprehensive APIs and administration capabilities and is easy to integrate with any web application, existing or new.

Cloudinary provides URL and HTTP based APIs that can be easily integrated with any Web development framework.

For Javascript, Cloudinary provides a jQuery plugin for simplifying the integration even further.

The direct image upload feature of the plugin is based on https://github.com/blueimp/jQuery-File-Upload

## Getting started guide
![](http://res.cloudinary.com/cloudinary/image/upload/see_more_bullet.png)  **Take a look at our [Getting started guide for jQuery](http://cloudinary.com/documentation/jquery_integration#getting_started_guide)**.

## Setup ######################################################################

In order to properly use this library you have to provide it a few configuration parameters:

Required:

* `cloud_name` - The cloudinary cloud name you'd like to use

Optional:

* `private_cdn`, `secure_distribution`, `cname`, `cdn_subdomain` - Please refer to [Cloudinary Documentation](http://cloudinary.com/documentation)

To set these configuration parameters use the `$.cloudinary.config` function (see below)

Note:

If jquery.cloudinary is loaded as an AMD, you need to initialize the Cloudinary fileupload fields e.g., by calling `$("input.cloudinary-fileupload[type=file]").cloudinary_fileupload();`

## Usage ######################################################################

The following blog post details the process of setting up jQuery based file upload.
http://cloudinary.com/blog/direct_image_uploads_from_the_browser_to_the_cloud_with_jquery

The Cloudinary Documentation can be found at:
http://cloudinary.com/documentation

* `$.cloudinary.config(parameter_name, parameter_value)` - Sets parameter\_name's value to parameter\_value.
* `$.cloudinary.url(public_id, options)` - Returns a cloudinary URL based on your on your configuration and the given options.
* `$.cloudinary.image(public_id, options)` - Returns a HTML image tag for the photo specified by public\_id
* `$.cloudinary.facebook_profile_image`, `$.cloudinary.twitter_profile_image`, `$.cloudinary.twitter_name_profile_image`, `$.cloudinary.gravatar_image` , `$.cloudinary.fetch_image` - Same like `image` but returns a specific type of image.

* `$(jquery_selector).cloudinary(options)` - Goes over the elements specified by jQuery selector and changes all images to be fetched using Cloudinary's CDN. Using options, you can also specify transformations to the images.

All `options` parameters are similar across all cloudinary frameworks. Please refer to [Rail's integration and using cl_image_tag](http://cloudinary.com/documentation/rails_integration#display_and_transform) for more complete reference regarding the options.

![](http://res.cloudinary.com/cloudinary/image/upload/see_more_bullet.png) **See [our documentation](http://cloudinary.com/documentation/jquery_image_manipulation) for more information about displaying and transforming images using jQuery**.

### Direct file upload with backend support ###################################

The javascript library implements helpers to be used in conjunction with the backend cloudinary frameworks (Rails, PHP, django). These framework can be used to embed a file upload field in the HTML (`cl_image_upload_tag`). When used, the script finds those fields and extend them:

Upon a successful image upload, the script will trigger a jQuery event (`cloudinarydone`) on the input field and provide fileupload data object (along with the `result` key containing received data from cloudinary upload API) as the only argument.

If a `cloudinary-field-name` has been provided with the upload field, the script will find an input field in the form with the given name and updates it post-upload with the image metadata: `<image-path>#<public-id>`.
If no such field exists a new hidden field will be creates.

![](http://res.cloudinary.com/cloudinary/image/upload/see_more_bullet.png) **See [our documentation](http://cloudinary.com/documentation/jquery_image_upload) for plenty more options of uploading to the cloud directly from the browser**.

## Client side image resizing before upload ###################################
See File Processing Options in https://github.com/blueimp/jQuery-File-Upload/wiki/Options
Add the following javascript includes after the standard fileupload includes:

    js/load-image.min.js
    js/canvas-to-blob.min.js
    js/jquery.fileupload-process.js
    js/jquery.fileupload-image.js
    js/jquery.fileupload-validate.js

Also, add the following javascript:

    $(document).ready(function() {
      $('.cloudinary-fileupload').fileupload({
        disableImageResize: false,
        imageMaxWidth: 800,
        imageMaxHeight: 600,
        acceptFileTypes: /(\.|\/)(gif|jpe?g|png|bmp|ico)$/i,
        maxFileSize: 20000000 // 20MB
      });
    });

## Angular Directives

Joshua Chaitin-Pollak contributed AngularJS directives for Cloudinary:
displaying & manipulating images and performing uploads from your Angular application.

The Angular module is currently maintained as a separate GitHub project:

https://github.com/jbcpollak/cloudinary_angular

## Additional resources

Additional resources are available at:

* [Website](http://cloudinary.com)
* [Documentation](http://cloudinary.com/documentation)
* [Knowledge Base](http://support.cloudinary.com/forums)
* [Documentation for jQuery integration](http://cloudinary.com/documentation/jquery_integration)
* [jQuery image upload documentation](http://cloudinary.com/documentation/jquery_image_upload)
* [jQuery image manipulation documentation](http://cloudinary.com/documentation/jquery_image_manipulation)
* [Image transformations documentation](http://cloudinary.com/documentation/image_transformations)

## Support

You can [open an issue through GitHub](https://github.com/cloudinary/cloudinary_js/issues).

Contact us [http://cloudinary.com/contact](http://cloudinary.com/contact)

Stay tuned for updates, tips and tutorials: [Blog](http://cloudinary.com/blog), [Twitter](https://twitter.com/cloudinary), [Facebook](http://www.facebook.com/Cloudinary).

## License #######################################################################

Released under the MIT license.

repository: dasebast/imgwire

repo_name: dasebast/imgwire


text:
# TellMeWeatherNow!

In September, 2014 I solved a challenge for selection of GopherConIndia 2015 scholars, I had to create a web based application for showing Weather updates for 5 cities concurrently.

**[Available online](https://tellmeweathernow.appspot.com)**

P.S. I did got selected as a Student Scholar.

## Usage

To run locally, install Google Cloud Go App Engine SDK and then run:
```
$ dev_appserver.py app.yaml
```

To deploy:
```
$ gcloud app deploy app.yaml
```

## Author

Created by [Yash Raj Singh](http://yashrajsingh.net)

## License (MIT)

repository: iamyashrs/tellmeweathernow

repo_name: iamyashrs/tellmeweathernow


text:
---
description: Quorum dev quickstart tutorial
---

# Quorum Developer Quickstart tutorial

The Quorum Developer Quickstart uses the Hyperledger Besu Docker image to run a private network of Besu
nodes managed by Docker Compose.

!!! important

    This tutorial runs a private network suitable for education or demonstration purposes and is
    not intended for running production networks.

## Prerequisites

* [Docker and Docker-compose](https://docs.docker.com/compose/install/)
* [Nodejs](https://nodejs.org/en/download/)
* On Windows:
    * Windows Subsystem for Linux 2
    * Docker desktop configured to use the WSL2-based engine.

!!! important
    Ensure you allow Docker up to 4G of memory or 6G if running the privacy examples.
    Refer to the _Resources_ section in [Docker for Mac](https://docs.docker.com/docker-for-mac/) and
    [Docker Desktop](https://docs.docker.com/docker-for-windows/) for details.

* [Git command line](https://git-scm.com/)
* [Curl command line](https://curl.haxx.se/download.html)
* A Web browser that supports [MetaMask](https://metamask.io/) (currently Chrome, Firefox, Opera,
  and Brave), and has the MetaMask plug-in installed. This tutorial uses screenshots from Brave.

## Create Docker-compose file

## Usage

To create the docker-compose file and artifacts, run:

```bash
npx quorum-dev-quickstart
```

Follow the prompts displayed to run Hyperledger Besu and [logging with ELK](../../HowTo/Monitor/Elastic-Stack.md).
Enter `n` for [Codefi Orchestrate](https://docs.orchestrate.consensys.net/en/stable/) and
[private transactions](../../Concepts/Privacy/Privacy-Overview.md).

## Start the network

To start the network, go to the installation directory and run:

=== "Linux/MacOS"

    ```bash
    ./run.sh
    ```

The script builds the images, and runs the containers. It also scales the regular node container to
four containers to simulate a network with enough peers to synchronize.

When the process ends, it lists the running services:

!!! example "Docker-compose services list example"

    ```log
    *************************************
    Quorum Dev Quickstart
    *************************************
    Setting up the index patterns in kibana............
    {"type":"index-pattern","id":"metricbeat","attributes":{"title":"metricbeat-*","timeFieldName":"@timestamp"},
    "references":[],"migrationVersion":{"index-pattern":"7.6.0"},"updated_at":"2020-11-04T10:43:34.252Z",
    "version":"WzgsMV0=","namespaces":["default"]}{"success":true,"successCount":7}{"type":"index-pattern",
    "id":"besu","attributes":{"title":"besu-*","timeFieldName":"@timestamp"},"references":[],"migrationVersion":
    {"index-pattern":"7.6.0"},"updated_at":"2020-11-04T10:43:36.927Z","version":"WzE2LDFd","namespaces":
    ["default"]}{"type":"index-pattern","id":"orion","attributes":{"title":"orion-*","timeFieldName":"@timestamp"},
    "references":[],"migrationVersion":{"index-pattern":"7.6.0"},"updated_at":"2020-11-04T10:43:37.982Z","version":
    "WzE3LDFd","namespaces":["default"]}{"type":"index-pattern","id":"quorum","attributes":{"title":"quorum-*",
    "timeFieldName":"@timestamp"},"references":[],"migrationVersion":{"index-pattern":"7.6.0"},"updated_at":
    "2020-11-04T10:43:39.003Z","version":"WzE4LDFd","namespaces":["default"]}{"type":"index-pattern","id":
    "tessera","attributes":{"title":"tessera-*","timeFieldName":"@timestamp"},"references":[],"migrationVersion":
    {"index-pattern":"7.6.0"},"updated_at":"2020-11-04T10:43:40.053Z","version":"WzE5LDFd","namespaces":
    ["default"]}

    List endpoints and services
    ----------------------------------
    JSON-RPC HTTP service endpoint      : http://localhost:8545
    JSON-RPC WebSocket service endpoint : ws://localhost:8546
    Web block explorer address          : http://localhost:25000/
    Prometheus address                  : http://localhost:9090/graph
    Grafana address                     : http://localhost:3000/d/XE4V0WGZz/besu-overview?orgId=1&refresh=10s&from=now-30m&to=now&var-system=All
    Kibana logs address                 : http://localhost:5601/app/kibana#/discover

    For more information on the endpoints and services, refer to README.md in the installation directory.
    ****************************************************************
    ```

* Use the **JSON-RPC HTTP service endpoint** to access the RPC node service from your Dapp or from
  cryptocurrency wallets such as MetaMask.
* Use the **JSON-RPC WebSocket service endpoint** to access the Web socket node service from your
  Dapp.
* Use the **Web block explorer address** to display the block explorer Web application. View the
  block explorer by entering the URL in your Web browser.
* Use the **Prometheus address** to access the
  [Prometheus dashboard](../../HowTo/Monitor/Metrics.md).
* Use the **Grafana address** to access the
  [Grafana dashboard](../../HowTo/Monitor/Metrics.md).
* Use the **Kibana logs address** to access the
  [logs in Kibana](../../HowTo/Monitor/Elastic-Stack.md).

To display the list of endpoints again, run:

=== "Linux/MacOS"

    ```bash
    ./list.sh
    ```

## Block explorer

This tutorial uses the Alethio Ethereum Lite Explorer.

### Run the block explorer

Access the explorer by copying and pasting the `Web block explorer address` displayed when starting
the private network to your browser.

The block explorer displays a summary of the private network, indicating four peers.

Click the block number to the right of **Best Block** to display the block details:

![Block Details](../../images/ExplorerBlockDetails.png)

You can explore blocks by clicking on the blocks under **Bk** on the left-hand side.

You can search for a specific block, transaction hash, or address by clicking the magnifying glass
in the top left-hand corner.

![Explorer Search](../../images/ExplorerSearch.png)

## Monitor nodes with Prometheus and Grafana

The sample network also includes Prometheus and Grafana monitoring tools to let you visualise
node health and usage. You can directly access these tools from your browser at the addresses
displayed in the endpoint list.

For more details on how to configure and use these tools for your own nodes, see our
[performances monitoring documentation](../../HowTo/Monitor/Metrics.md),
the [Prometheus documentation](https://prometheus.io/docs/introduction/overview/)
and [Grafana documentation](https://grafana.com/docs/).

![Grafana](../../images/grafana.png)

## Run JSON-RPC requests

You can run RPC requests on `rpcnode`, the node exposed to the host to listen for requests. This
tutorial uses [cURL](https://curl.haxx.se/download.html) to make JSON-RPC requests.

For the RPC URL, this tutorial uses the placeholder `<http-rpc-endpoint>`. When you run the
tutorial, replace this placeholder with the JSON-RPC HTTP service endpoint provided when you list
the endpoints. (For example, `http://localhost:8545`.) The dynamic docker port mapping changes each
time you run the network.

{!global/Postman.md!}

### Request the node version

Run the following command from the host shell:

```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":1}' http://localhost:8545
```

The result specifies the client version:

```json
{
   "jsonrpc" : "2.0",
   "id" : 1,
   "result" : "besu/<version number>"
}
```

Here we query the version of the Besu node, which confirms the node is running.

Successfully calling this method shows that you can connect to the nodes using RPC. From here, you
can walk through more interesting requests demonstrated in the rest of this section, or skip ahead
to [Create a transaction using MetaMask](#create-a-transaction-using-metamask).

### Count the peers

Peers are the number of other nodes connected to the RPC node.

Poll the peer count using `net_peerCount`:

```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":1}' http://localhost:8545
```

The result indicates that there are four peers:

```json
{
  "jsonrpc" : "2.0",
  "id" : 1,
  "result" : "0x4"
}
```

### Request the most recent block number

Call `eth_blockNumber` to retrieve the number of the most recent block:

```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' http://localhost:8545
```

```json
{
  "jsonrpc" : "2.0",
  "id" : 1,
  "result" : "0x8b8"
}
```

The hexadecimal value `0x8b8` translates to `2232` in decimal, the number of blocks so far.

## Create a transaction using MetaMask

Now let's use [MetaMask](https://metamask.io/) to send transactions.

Before sending transactions, you need to create an account or use one of the accounts below
created during the genesis of this private test network.

{!global/test_accounts.md!}

!!!note

    Besu doesn't incorporate
    [account management](../../HowTo/Send-Transactions/Account-Management.md). To create your own
    account, you have to use a third-party tool, such as MetaMask.

After you sign in to MetaMask, connect to the private network RPC endpoint:

1. In the MetaMask network list, select **Custom RPC**.
1. In the **New RPC URL** field, enter the JSON-RPC HTTP service endpoint displayed when you
   started the private network.

Save the configuration and return to the MetaMask main screen. Your current network is now set to
the private network RPC node.

[Import one of the existing accounts above into MetaMask] using the corresponding private key.

!!!note

    In this tutorial, we don't need to secure the keys, because we're using a private test network
    to send valueless Ether. In a production environment, be sure to secure your accounts on the
    main Ethereum network (MainNet).

When you're finished importing an existing account, [create another account from scratch] to send
Ether to.

In MetaMask, select the new account and copy the account address by clicking the **…**
gadget and selecting **Copy Address to clipboard**.

In the block explorer, search for the new account by clicking on the magnifying glass and pasting
the account address into the search box. The account displays with a zero balance.

[Send Ether](https://metamask.zendesk.com/hc/en-us/articles/360015488991-Sending-Ether-New-UI-)
from the first account (containing Ether) to the new account (which has a zero balance).

Refresh the browser page displaying the new account. The updated balance displays and reflects the
transaction completed using MetaMask.

## Smart contract and DApp usage with the blockchain network

We are going to use the
[PetShop tutorial on Truffle website](https://truffleframework.com/tutorials/pet-shop) with a few
modifications, so we use the private network in this tutorial as the blockchain network.

### Prerequisites

<!-- vale off -->
* [Node.js v6+ LTS and npm](https://nodejs.org/en/) (comes with Node)
<!-- vale on -->
* Import an account into MetaMask using the private key
  `0xc87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3`. The following steps use
  this account.

### Install Truffle

Install Truffle:

```bash
npm install -g truffle
```

!!! note

    `npm` requires `sudo` on Linux.

The source code for the smart contract and DApp are in the `pet-shop` folder. With the blockchain
running and MetaMask connected to it via the browser, run the command below to start the DApp.

The script first compiles the contract, then performs a migration to the blockchain network and
then runs some tests. You can then search for the deployed contracts and transactions in the Web
Block Explorer using the addresses displayed in your output earlier `http://localhost:32768/`
(your port will differ). Similar output to the following displays (your addresses will differ).

!!! example

    === "Linux/MacOS command"

         ```bash
         ./run-dapp.sh
         ```

    === "DApp result"

        ```log
        Compiling your contracts...
        ===========================
        > Compiling ./contracts/Adoption.sol
        > Compiling ./contracts/Migrations.sol

        Starting migrations...
        ======================
        > Network name:    'quickstartWallet'
        > Network id:      2018
        > Block gas limit: 0xf7b760

        1_initial_migration.js
        ======================

           Replacing 'Migrations'
           ----------------------
           > transaction hash:    0x10f5ebaca0e89fa84bcae19d6848dde19817ea3cf270be0fd0ab52f041a02c61
           > Blocks: 0            Seconds: 0
           > contract address:    0x8CdaF0CD259887258Bc13a92C0a6dA92698644C0
           > block number:        64
           > block timestamp:<PHONE_NUMBER>
           > account:             0x627306090abaB3A6e1400e9345bC60c78a8BEf57
           > balance:             89999.99472518
           > gas used:            263741
           > gas price:           20 gwei
           > value sent:          0 ETH
           > total cost:          0.00527482 ETH

           > Saving migration to chain.
           > Saving artifacts
           -------------------------------------
           > Total cost:          0.00527482 ETH

        2_deploy_contracts.js
        =====================

           Replacing 'Adoption'
           --------------------
           > transaction hash:    0x56f39e2411f2e95b89832c6ff81b619815ee83db1c54d2b166ecdc3ceda633a8
           > Blocks: 0            Seconds: 0
           > contract address:    0x345cA3e014Aaf5dcA488057592ee47305D9B3e10
           > block number:        66
           > block timestamp:<PHONE_NUMBER>
           > account:             0x627306090abaB3A6e1400e9345bC60c78a8BEf57
           > balance:             89999.9890877
           > gas used:            239851
           > gas price:           20 gwei
           > value sent:          0 ETH
           > total cost:          0.00479702 ETH

           > Saving migration to chain.
           > Saving artifacts
           -------------------------------------
           > Total cost:          0.00479702 ETH

        Summary
        =======
        > Total deployments:   2
        > Final cost:          0.01007184 ETH

        Compiling your contracts...
        ===========================
        > Compiling ./test/TestAdoption.sol

          TestAdoption
            ✓ testUserCanAdoptPet (2071ms)
            ✓ testGetAdopterAddressByPetId (6070ms)
            ✓ testGetAdopterAddressByPetIdInArray (6077ms)

          3 passing (37s)
        ```

After these tests are successful, it builds a container for the Pet Shop DApp and deploys it,
binding it to port 3001 on your system.

In the browser that you have MetaMask enabled and the account loaded, open a new tab and navigate
to [`http://localhost:3001`](http://localhost:3001) which should have the Pet Shop running, and you can adopt pets from the
app. When you click on 'Adopt', a MetaMask window should pop up and request your permissions to continue
with the transaction. After the transaction is complete and successful, the status of the pet you
adopted will show 'Success'.

![Dapp UI](../../images/dapp-ui.png)

You can also search for the transaction and view its details in the Block Explorer UI at
[`http://localhost:25000/`](http://localhost:25000/).

![Dapp UI](../../images/dapp-explorer-tx.png)

The MetMask UI also keeps a record of the transaction.

![Dapp UI](../../images/dapp-metamask-tx.png)

## Stop and restart the private network without removing containers

To shut down the private network without deleting the containers:

=== "Linux/MacOS"

    ```bash
    ./stop.sh
    ```

This command stops the containers related to the services specified in the `docker-compose.yml`
file.

To restart the private network:

=== "Linux/MacOS"

    ```bash
    ./resume.sh
    ```

## Stop the private network and remove containers

To shut down the private network and delete all containers and images created from running the
sample network:

=== "Linux/MacOS"

    ```bash
    ./remove.sh
    ```

<!-- Links -->
[Import one of the existing accounts above into MetaMask]: https://metamask.zendesk.com/hc/en-us/articles/360015489331-Importing-an-Account-New-UI-
[create another account from scratch]: https://metamask.zendesk.com/hc/en-us/articles/360015289452-Creating-Additional-MetaMask-Wallets-New-UI-

repository: sambacha/besu-docs

repo_name: sambacha/besu-docs


text:
## Commit messages

We follow this convention to add make the commit messages standard:

All first lines of the commit messages should fit in 50 (70 if you REALLY need it) characters, use the second line and beyond to make any further explanations.
Use the correct emoji as the first thing on the commit message followed by the mentioned starting word (e.g. :bulb: Add my awesome feature)

* When adding a new feature/component/etc: `:bulb:` :bulb: Add ...
* When fixing a bug: `:bug:` :bug: Fix...
* For documentation: `:book:` :book: Docs (for/about/etc)...
* For improvements and updates: `:arrow_up:` :arrow_up: Upgrade/Improve...
* For CI/CD matters: `:cyclone:` :cyclone: No specific words here
* For maintenance: `:wrench:` :wrench: ?
* For removing code: `:fire:` :fire: Remove...

repository: Me-Adota/website

gha_language: HTML

repo_name: Me-Adota/website


text:
---
layout: post
post_author: Mitch Lloyd
current_gaslighter: false
categories:
- Development
tags: []
permalink: "/blog/:slug"
post_title: 'Gaslight Podcast: Ruby Culture with Dave Thomas'
publish_date: 2014-03-28T12:40:00.000+00:00
feature_post_image: ''
post_images: []
slug: ruby-culture-with-dave-thomas

---
In this episode, [Dave Thomas](https://twitter.com/pragdave), Doug Alcorn and I
discuss how Dave became involved with Ruby, how the culture of Ruby has evolved
over time, and Jim Weirich's legacy in the community.

[Subscribe with RSS ](http://feeds.feedburner.com/gaslightpodcast) | [Subscribe with iTunes](https://itunes.apple.com/us/podcast/gaslight-software-blog/id563643631)

repository: katibest/rhythmdogsports

repo_name: katibest/rhythmdogsports


text:
# GoogleDocsExportCSV
This repo is an add-on for Google Docs to export the text within a document as a csv for easy text analysis.

## The Data Format
In google docs, if you use a table of contents it is automatically gerated like this
### My Doc
1. Section 1
  * Part 1
  * Part 2
2. Section 2

Where you will have your text in each section.

To format that for text analysis I want it all in a table that denotes what section the text is under

| Title         | H1            | H2     |Text   |
| ------------- |:-------------:| ------:|------:|
| My Doc        | Section 1     | Part 1 |Entry 1|
| My Doc        | Section 1     | Part 2 |Entry 2|
| My Doc        | Section 2     |        |Entry 3|

## How To Use
Once you install the add-on go to the add-ons menu within your document. Click Export to CSV > Export to CSV.
A modal will open and you can name your export file and it should download to your computer.

repository: Will-Renius/GoogleDocsExportCSV

repo_name: Will-Renius/GoogleDocsExportCSV


text:
# C# Sample Code for the Authorize.Net SDK
[![Travis CI Status](https://travis-ci.org/AuthorizeNet/sample-code-csharp.svg?branch=master)](https://travis-ci.org/AuthorizeNet/sample-code-csharp)

This repository contains working code samples which demonstrate C# integration with the [Authorize.Net .NET SDK](https://www.github.com/AuthorizeNet/sdk-dotnet).

The samples are organized into categories and common usage examples, just like our [API Reference Guide](http://developer.authorize.net/api/reference). Our API Reference Guide is an interactive reference for the Authorize.Net API. It explains the request and response parameters for each API method and has embedded code windows to allow you to send actual requests right within the API Reference Guide.

## Using the Sample Code

The samples are all completely independent and self-contained. You can analyze them to get an understanding of how a particular method works, or you can use the snippets as a starting point for your own project.

You can also run each sample directly from the command line.

## Running the Samples From the Command Line
* Clone this repository:
```
    $ git clone https://github.com/AuthorizeNet/sample-code-csharp.git
```
* Include the [Authorize.Net .NET SDK](https://github.com/AuthorizeNet/sdk-dotnet):
```
    PM> Install-Package AuthorizeNet
```
 Build the project to produce the SampleCode console app.
* Run the individual samples by name. For example:
```
     > SampleCode [CodeSampleName]
```
e.g.
```
     > SampleCode ChargeCreditCard
```
Running SampleCode without a parameter will give you the list of sample names.

repository: AuthorizeNet/sample-code-csharp

gha_language: C#

repo_name: AuthorizeNet/sample-code-csharp


text:
# Insta-Piktures
#### By CARYNE MWARABU
## Description
This is a Django App, where a user can sign in and post their pictures and share them out.
## Known Bugs
No Bugs.
## Technologies Used
*Python3.8
*Django
*Bootstrap
*Heroku
## Support and contact details
<EMAIL_ADDRESS>### License
MIT License
Copyright (c) 2021

repository: careymwarabu/Insta-Piktures

repo_name: careymwarabu/Insta-Piktures


text:
---
title: Using NcML In The TDS
last_updated: 2020-08-25
sidebar: dev_sidebar
toc: false
permalink: using_ncml_in_the_tds.html
---

## NCML And The TDS

An NcML document is an XML document that uses the NetCDF Markup Language to define a CDM dataset.
NcML can be embedded directly into the TDS catalogs to achieve a number of powerful features, shown below.
This embedded NcML is only useful in the TDS server catalogs, it is not meaningful to a THREDDS client, and so is not included in the client catalogs.
One can put an NcML element inside a `dataset` element, in which case it is a self-contained NcML dataset, or inside a `datasetScan` element, where it modifies a regular dataset.
In both cases, we call the result a *virtual* dataset, and you cannot serve a virtual dataset with a file-serving protocol like FTP or HTTP.
You can use subsetting services like `OpenDAP`, `WCS`, `WMS`, and `NetcdfSubset`.

## Using NcML In A Dataset Element

NcML embedded in a TDS dataset element creates a self-contained NcML dataset.
The TDS dataset does not refer to a data root, because the NcML contains its own location.
The TDS dataset must have a unique URL path (this is true for all TDS datasets), but unlike a regular dataset, does not have to match a data root.

### Modifying An Existing Dataset

You can use NcML to modify an existing CDM dataset:

~~~xml
<catalog xmlns="http://www.unidata.ucar.edu/namespaces/thredds/InvCatalog/v1.0"
         xmlns:xlink="http://www.w3.org/1999/xlink"
         name="TDS workshop test 1" version="1.0.2">
  <service name="ncdods" serviceType="OPENDAP" base="/thredds/dodsC/"/>      <!-- 1 -->

  <dataset name="Example NcML Modified" ID="ExampleNcML-Modified"
             urlPath="ExampleNcML/Modified.nc">                              <!-- 2 -->
    <serviceName>ncdods</serviceName>
    <netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"
            location="/machine/tds/workshop/ncml/example1.nc">               <!-- 3 -->
      <variable name="Temperature" orgName="T"/>                             <!-- 4 -->
      <variable name="ReletiveHumidity" orgName="rh">                        <!-- 5 -->
        <attribute name="long_name" value="relatively humid"/>               <!-- 6 -->
        <attribute name="units" value="percent (%)"/>
        <remove type="attribute" name="description"/>                        <!-- 7 -->
      </variable >
    </netcdf>
  </dataset>
</catalog>
~~~

1. A `service` is defined that allows the virtual dataset to be served through `OPENDAP`.
   Make sure the `base` attribute is exactly as shown.
2. The virtual dataset is created and given a `urlPath` of `ExampleNcML/Modified.nc`.
   The `urlPath` is essentially arbitrary, but must be **unique** within the TDS, and you should maintain a consistent naming convention to ensure uniqueness, especially for large collections of data.
   It's important to also give the dataset a unique `ID`.
3. An NcML dataset is defined which references the netCDF file at the absolute location (example: `/machine/tds/workshop/ncml/example1.nc`).
   Note that you must declare the NcML namespace exactly as shown.
4. The variable named `T` in the original file is renamed `Temperature`.
5. The variable named `rh` in the original file is renamed `RelativeHumidity`.
6. Two attributes of `rh` are defined, `long_name` and `units`.
   If these already exist, they are replaced.
7. The attribute of `rh` called _description_ is removed.

### Dataset Versus Virtual Dataset

Let's look at serving a file directly versus serving it through NcML:

~~~xml
<catalog xmlns="http://www.unidata.ucar.edu/namespaces/thredds/InvCatalog/v1.0"
         xmlns:xlink="http://www.w3.org/1999/xlink"
         name="TDS workshop test 2" version="1.0.2">

  <service name="ncdods" serviceType="OPENDAP" base="/thredds/dodsC/"/>
  <datasetRoot path="test/ExampleNcML" location="/machine/tds/workshop/ncml/" />       <!-- 1 -->
  <dataset name="Example Dataset" ID="Example" urlPath="test/ExampleNcML/example1.nc"> <!-- 2 -->
    <serviceName>ncdods</serviceName>
  </dataset>
  <dataset name="Example NcML Modified" ID="Modified" urlPath="ExampleNcML/Modified.nc">
    <serviceName>ncdods</serviceName>                      <!-- 3 -->
    <netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"
        location="/machine/tds/workshop/ncml/example1.nc"> <!-- 4 -->
      <variable name="Temperature" orgName="T"/>
    </netcdf>
  </dataset>
</catalog>
~~~

1. A `datasetRoot` is defined that associates URL path `test/ExampleNcML` with the disk location `/data/nc/`.
2. The dataset is created with a `urlPath` of `test/ExampleNcML/example.nc`.
   The first part of the path is matched to the `datasetRoot`, so that the full dataset location is `/data/nc/example1.nc`.
   This file is served directly by this dataset element.
3. The same file is used in a virtual dataset defined by the embedded NcML.
   The virtual dataset is given an (arbitrary) `urlPath` of `ExampleNcML/Modified.nc`.
4. The NcML element is defined which references the netCDF file at the absolute location `/data/nc/example1.nc`.
   The only modification is to rename the variable `T` to `Temperature`.

### Using NcML Aggregation

Here is an example that defines a dataset using NcML aggregation.

~~~xml
<catalog xmlns="http://www.unidata.ucar.edu/namespaces/thredds/InvCatalog/v1.0"
         xmlns:xlink="http://www.w3.org/1999/xlink"
         name="TDS workshop test 3" version="1.0.2">

  <service name="ncdods" serviceType="OPENDAP" base="/thredds/dodsC/" />              <!-- 1 -->
  <dataset name="Example NcML Agg" ID="ExampleNcML-Agg" urlPath="ExampleNcML/Agg.nc"> <!-- 2 -->
    <serviceName>ncdods</serviceName>                                                 <!-- 3 -->
    <netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"> <!-- 4 -->
      <aggregation dimName="time" type="joinExisting">                      <!-- 5 -->
        <scan location="/machine/tds/workshop/ncml/cg/" dateFormatMark="CG#yyyyDDD_HHmmss"
              suffix=".nc" subdirs="false"/>                                <!-- 6 -->
      </aggregation>
    </netcdf>
  </dataset>
</catalog>
~~~

1. An OPENDAP `service` is defined called `ncdods`.
2. A THREDDS `dataset` is defined, which must have a `urlPath` that is unique within the TDS, in this case `ExampleNcML/Agg.nc`.
3. The dataset uses the `ncdods` service.
4. An NcML `netcdf` element is embedded inside the THREDDS `dataset` element.
5. An NcML aggregation of type `joinExisting` is declared, using the existing time dimension as the aggregation dimension.
6. All the files in the directory `/machine/tds/workshop/ncml/cg/` that end with `.nc` will be scanned to create the aggregation.
   A `dateFormatMark` is used to define the time coordinates, indicating there is exactly one time coordinate in each file.

## Using NcML In A `datasetScan` Element

If an NcML element is added to a `DatasetScan`, it will modify all of the datasets contained within the `DatasetScan`.
It is not self-contained, however, since it gets its location from the datasets that are dynamically scanned.

~~~xml
<datasetScan name="Ocean Satellite Data" ID="ocean/sat" path="ocean/sat" location="/machine/tds/workshop/ncml/ocean/"> <!-- 1 -->
  <filter>
    <include wildcard="*.nc" />
  </filter>
  <metadata inherited="true"> <!-- 2 -->
    <serviceName>ncdods</serviceName>
    <dataType>Grid</dataType>
  </metadata>
  <netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"> <!-- 3 -->
    <attribute name="Conventions" value="CF-1.0"/>
  </netcdf>
</datasetScan>
~~~

1. A `datasetScan` element is created whose contained datasets start with URL path `ocean/sat`, and whose contents are all the files in the directory `/machine/tds/workshop/ncml/ocean/` which end in `.nc`.
2. All contained datasets inherit metadata indicating they use the `ncdods` service and are of type `Grid`.
3. All contained datasets are wrapped by this NcML element.
   In this case, each dataset has the global attribute `Conventions="CF-1.0"` added to it.
   Note that there is no `location` attribute, which is implicitly supplied by the datasets found by the`datasetScan`.

### `datasetScan` Versus Aggregation Scan

The `scan` element in the NcML aggregation is similar in purpose to the `datasetScan` element, but be careful not to confuse the two.
The `datasetScan` element is more powerful, and has more options for filtering, etc.
Its job is to create nested `dataset` elements inside the `datasetScan`, and so has various options to add information to those nested datasets.
It has a generalized framework for crawling other things besides file directories.
The `scan` element's job is to easily specify what files go into an NcML aggregation, and those individual files are hidden inside the aggregation dataset.
It can only scan file directories.
In the future, some of the capabilities of `datasetScan` will migrate into NcML scan.

#### Example

Let's look at using a `datasetScan` and an Aggregation `scan` on the same collection of files.
Download  {% include link_file.html file="tds_tutorial/ncml/ncmlTds/catalogScan.xml" text="catalogScan.xml" %}, place it in `${tomcat_home}/content/thredds` directory and add a `catalogRef` to it from your main catalog.

~~~xml
<?xml version="1.0" encoding="UTF-8"?>
<catalog xmlns="http://www.unidata.ucar.edu/namespaces/thredds/InvCatalog/v1.0"
     xmlns:xlink="http://www.w3.org/1999/xlink"
     name="TDS workshop test 4" version="1.0.2">

  <service name="ncdods" serviceType="OPENDAP" base="/thredds/dodsC/"/>
  <dataset name="Example NcML Agg" ID="ExampleNcML-Agg" urlPath="ExampleNcML/Agg.nc"> <!-- 1 -->
    <serviceName>ncdods</serviceName>
    <netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2">           <!-- 2 -->
      <aggregation dimName="time" type="joinExisting" recheckEvery="4 sec">
        <scan location="/machine/tds/workshop/ncml/cg/" dateFormatMark="CG#yyyyDDD_HHmmss" suffix=".nc" subdirs="false"/>
      </aggregation>
    </netcdf>
  </dataset>

  <datasetScan name="CG Data" ID="cg/files" path="cg/files" location="/machine/tds/workshop/ncml/cg/"> <!-- 3 -->
    <metadata inherited="true">
      <serviceName>ncdods</serviceName>
      <dataType>Grid</dataType>
    </metadata>
    <filter>
      <include wildcard="*.nc"/>     <!-- 4 -->
    </filter>
    <netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"> <!-- 5 -->
      <attribute name="Yoyo" value="Ma"/>
    </netcdf>
  </datasetScan>
</catalog>
~~~

1. A virtual dataset is defined with URL `ExampleNcML/Agg.nc`
2. The NcML aggregation for this dataset.
   Remember that the `recheckEvery` attribute only applies when using a `scan` element.
3. A `datasetScan` element is created whose contained datasets start with URL path `cg/files`, and which scans the directory `/workshop/test/cg/`
4. Only files which end in `.nc`.
5. Add a global attribute to each file in the collection.

Start or restart your TDS and look at those datasets through the HTML interface and through [ToolsUI](https://docs.unidata.ucar.edu/netcdf-java/{{site.netcdf-java_docset_version}}/userguide/toolsui_ref.html){:target="_blank"}.

## Using NcML In A `featureCollection` Element

Here we show a brief example of modifying files with NcML in a `featureCollection` element.

~~~xml
<?xml version="1.0" encoding="UTF-8"?>
<catalog xmlns="http://www.unidata.ucar.edu/namespaces/thredds/InvCatalog/v1.0"
         xmlns:xlink="http://www.w3.org/1999/xlink"
         name="Unidata THREDDS Data Server" version="1.0.3">

  <service name="ncdods" serviceType="OPENDAP" base="/thredds/dodsC/"/>

  <featureCollection featureType="FMRC" name="GOMOOS" harvest="true" path="fmrc/USGS/GOMOOS">
    <metadata inherited="true">
      <serviceName>ncdods</serviceName>
      <dataFormat>netCDF</dataFormat>
      <documentation type="summary">Munge this with NcML</documentation>
    </metadata>

    <collection spec="/machine/tds/workshop/ncml/gomoos/gomoos.#yyyyMMdd#.cdf$"/>
    <protoDataset>  <!-- 1 -->
      <netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2">
        <attribute name="History" value="Processed by Kraft"/>
      </netcdf>
    </protoDataset>

    <netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"> <!-- 2 -->
      <variable name="time">
        <attribute name="units" value="days since 2006-11-01 00:00 UTC"/>
      </variable>
      <attribute name="Conventions" value="CF-1.0"/>
    </netcdf>
  </featureCollection>
</catalog>
~~~

1. The `protoDataset` is modified by adding a global attribute `History="Processed by Kraft"`.
2. Each component file is changed by modifying the time variable's `units` attribute and adding a global attribute `Conventions="CF-1.0"`

You might wonder why not put the global attribute `Conventions="CF-1.0"` on the protoDataset instead of on each individual dataset?
The reason is because in an FMRC, each dataset is converted into a `GridDataset`, and then combined into the FMRC.
So the modifications in 2) are what's needed to make the individual datasets be correctly interpreted as a `Grid` dataset.
The modifications to the `protoDataset` are then applied to the resulting FMRC 2D dataset.

## Debugging NcML

When things go wrong, it's best to first debug the aggregation outside of the TDS.

Go to the TDS catalog and find the problem dataset.
Inside the `<dataset>` element will be a `<netcdf>` element, that is the NcML aggregation.
Extract it out and put it in a file called `test.ncml`.

1. Add the XML header to the top of it: `<?xml version="1.0"encoding="UTF-8"?>`
2. Remove the recheckEvery attribute if present on the `<scan>` element.
3. Make sure the `<scan>` location is available on the machine you are running ToolsUI

Now start up [ToolsUI](https://docs.unidata.ucar.edu/netcdf-java/{{site.netcdf-java_docset_version}}/userguide/toolsui_ref.html){:target="_blank"}, and in the viewer tab, navigate to `test.ncml` and try to open it.

If the dataset is dynamic (files can be added or deleted), add the `recheckEvery` attribute on the `scan` element and open the dataset, then reopen after a new file has arrived (and `recheckEvery` time has passed).
Generally you make `recheckEvery` very short while testing.

Now add the NcML dataset back to the TDS, without a `recheckEvery` attribute on the `scan` element.
See if OPeNDAP access works.

Add the `recheckEvery` attribute (if needed) and test again.

{%include troubleshooting.html content="
Remember that you **can't** use `HTTPServer` for NcML datasets, as they are virtual datasets.
Use only the subsetting services, such as `OpenDAP`, `WCS`, `WMS`, and `NetcdfSubset`.
" %}

repository: Unidata/tds

gha_language: Java

repo_name: Unidata/tds


text:
# android-code-challenge

This project implements a scrollable list of posts.
For each post, it shows the author name, post title, the post body and the author image

See [Process.md](https://github.com/mathemandy/league-test/blob/master/Process.md) for walkthrough

## Features
* MVVM
* Kotlin Coroutines with Flow (State Flow)
* Dagger Hilt
* Light/Dark Mode Support
* Jetpack Compose

## Prerequisite
To build this project, you require:
- Android Studio arctic fox
- Gradle 7.0.0+
- You may require Java 11 to run, see [Process.md](https://github.com/mathemandy/league-test/blob/master/Process.md) for walkthrough

Screenshots

## Libraries

- [Viewmodel](https://developer.android.com/topic/libraries/architecture/viewmodel) - ViewModel for persisting view state across config changes
- [Retrofit](https://square.github.io/retrofit/) - type safe http client and supports coroutines out of the box.
- [okhttp-logging-interceptor](https://github.com/square/okhttp/blob/master/okhttp-logging-interceptor/README.md) - logs HTTP request and response data.
- [kotlinx.coroutines](https://github.com/Kotlin/kotlinx.coroutines) - Library Support for coroutines,provides `runBlocking` coroutine builder used in tests
- [Dagger Hilt](https://dagger.dev/hilt) - handles dependency injection
- [Truth](https://github.com/google/truth) - handles testing
- [Coil](https://github.com/coil-kt/coil) - For Asynchronously fetching data
- [Moshi](https://github.com/square/moshi)

## Author
Andy Eshiet

## License
This project is licensed under the Apache License 2.0 - See: http://www.apache.org/licenses/LICENSE-2.0.txt

repository: mathemandy/Posts

repo_name: mathemandy/Posts


text:
## Mooder
Machine Learning Sentiment Analysis based on data from Amazon fine foods reviews (65 535 samples) and Yelp reviews (10 001 samples). Uses Naive Bayes classifier for multinomial models together with tokenization of text to a matrix of counts. Model is based on [scikit-learn](http://scikit-learn.org/), [bottlepy](http://bottlepy.org/docs/dev/index.html), and [pandas](http://pandas.pydata.org).

Developed during #TriforkHackerDays, thx Trifork for opportunity and awesome mindset.

![alt text](https://github.com/lesyk/Mooder/blob/master/demo.gif)

To build a model:
```
python -c 'from mood_model import *; init_model()'
```
To start a server:
```
python server.py
```

repository: lesyk/Mooder

repo_name: lesyk/Mooder


text:
---
layout: default
---

# 1996-01-26 - Re: This is not "DivineBeingPunks"

## Header Data

From: "Perry E. Metzger"<EMAIL_ADDRESS>To<EMAIL_ADDRESS>(Timothy C. May)

Message Hash: 877475a82ad3306658e0edc33a5ee5db7493eccb7426988cad0817d6c49b43f5

Message ID<EMAIL_ADDRESS>Reply To<EMAIL_ADDRESS>UTC Datetime: 1996-01-26 12:10:01 UTC

Raw Date: Fri, 26 Jan 1996 20:10:01 +0800

## Raw message

```
{% raw  %}From: "Perry E. Metzger"<EMAIL_ADDRESS>Date: Fri, 26 Jan 1996 20:10:01 +0800
To<EMAIL_ADDRESS>(Timothy C. May)
Subject: Re: This is not "DivineBeingPunks"
In-Reply-To<EMAIL_ADDRESS>Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

Timothy C. May writes:
> Since Perry has on several occasions said he does not want to hear about
> politics and other "off-topic" posts, and since he has written at least
> five of these posts just today (the "Gentleman do not" thread), I suggest
> he heed his own advice.

Well, the topic was initially quite cryptography related -- a
discussion of the question of whether government cryptanalysis efforts
are a "good idea". However, in my last message on the topic you
probably saw that I noted that the issue had certainly slipped
sufficiently from the local agenda that I personally noted that it was
no longer appropriate for me to post on the topic. I don't intend to
say anything more about it since it no longer was merely a discussion
of whether we need an NSA.

However, redirecting the topic, I will note that Phill's assertion
that U.S. cryptographic intelligence versus the Japanese at the start
of World War II was inadequate is just plain wrong. We had already
broken virtually every important Japanese diplomatic and military
code, including perhaps the greatest feat of cryptanalysis of all
time, the breaking of PURPLE. See "The Code Breakers" for details.

And yes, discussing historical cryptanalysis efforts is indeed part of
the charter.

Perry

{% endraw %}
```

## Thread

+ Return to [January 1996](/archive/1996/01)

+ Return to "["Perry E. Metzger" <perry@piermont.com>](/authors/perry_e_metzger_perry_at_piermont_com_)"
+ Return to<EMAIL_ADDRESS>(Timothy C. May)](/authors/tcmay_at_got_net_timothy_c_may_)"

+ 1996-01-26 (Fri, 26 Jan 1996 16:15:03 +0800) - [This is not "DivineBeingPunks"](/archive/1996/01/8ba18e36117f40da64e5816264f9fb09e957b3da1e18099597898dcf7c33f894) -<EMAIL_ADDRESS>(Timothy C. May)_
  + 1996-01-26 (Fri, 26 Jan 1996 20:10:01 +0800) - Re: This is not "DivineBeingPunks" - _"Perry E. Metzger"<EMAIL_ADDRESS>


text:
# PyHook

PyHook is the python implementation of my [SharpHook](https://github.com/IlanKalendarov/SharpHook) project, It uses various API hooks in order to give us the desired credentials.

PyHook Uses frida to inject it's dependencies into the target process

# Supported Processes

| Process               | API Call                          | Description                                                  | Progress |
| --------------------- | --------------------------------- | ------------------------------------------------------------ | -------- |
| mstsc                 | `CredUnPackAuthenticationBufferW` | This will hook into mstsc and should give you Username and Password | DONE     |
| runas                 | `CreateProcessWithLogonW`         | This will hook into runas and should give you Username, Password and the domain name | DONE     |
| cmd                   | `RtlInitUnicodeStringEx`          | This should hook into cmd and then would be able to filter keywords like: PsExec,password etc.. | DONE     |
| MobaXterm             | `CharUpperBuffA`                  | This will hook into MobaXterm and should give you credentials for SSH and RDP logins | DONE     |
| explorer (UAC Prompt) | `CredUnPackAuthenticationBufferW` | This will hook into explorer and should give you Username, Password and the Domain name from the UAC Prompt | DONE     |

# Demo

![](https://github.com/IlanKalendarov/PyHook/blob/main/Demo/Demo.gif)

Link my blog post covering this topic: https://ilankalendarov.github.io/posts/offensive-hooking


text:
# [WIP] Ansible Role: Harbor API Codifying

[![License:MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

An Ansible Role to manage Harbor API

<!-- TOC -->

- [Ansible Role: Harbor API condifying](#wip-ansible-role-harbor-api-condifying)
- [Requirements](#requirements)
- [Role Variables](#role-variable)
- [Usage](#usage)
    - [Roles](#roles)
    - [Projects](#projects)
- [Dependencies](#dependencies)
- [Example Playbook](#example-playbook)
- [Contributing](#contributing)
- [License](#license)
<!-- /TOC -->

# Requirements

Have one or more [Harbor](https://github.com/vmware/harbor) instances

# Installation

Harbor-API  is an Ansible role distributed globally using [Ansible Galaxy](https://galaxy.ansible.com/). In order to install Harbor-API role you can use the following command.

```
$ ansible-galaxy install leboncoin.harbor-api
```

# Role Variables

Available variables are listed below, along with default values (see defaults/main.yml):

    harbor_directory_api: "{{ role_path }}/files/config/"
    harbor_directory_api_projects: "{{ role_path }}/files/config/projects/"

Another variables can be used from [harbor.cfg](https://github.com/vmware/harbor/blob/master/make/harbor.cfg), prefixed by *harbor_*

    harbor_auth_mode: ldap_auth
    harbor_harbor_admin_password: Harbor12345

# Usage

You can create json files to configure your harbor, based on swagger implementation ([swagger editor]( https://editor.swagger.io/?url=https://raw.githubusercontent.com/vmware/harbor/master/docs/swagger.yaml ))

### Sysadmins

Resources:
- Put (/users/{user_id}/sysadmin)

_admins_removed is required because "harbor api" doesn't implement the research of admin [#PR4388](https://github.com/vmware/harbor/pull/4388)_

files/config/roles.json

    {
        "admins":[
<EMAIL_ADDRESS>        ],
        "admins_removed":[
<EMAIL_ADDRESS>        ]
    }

### Projects

Resources:
- Add (/projects)
- Put (/projects/{project_id})

files/config/projects/myproject.json

    {
        "name": "myproject",
        "metadatas": {
            "public": false
        },
        "members" [
<EMAIL_ADDRESS>        ],
        "admins": [
<EMAIL_ADDRESS>        ]
    }

# Dependencies

None.

# Example Playbook

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:

    - hosts: harbor
      roles:
         - { role: leboncoin.harbor } # install harbor instance
         - { role: leboncoin.harbor-api } # populate api

# Contributing

Please, see [TODO.md](TODO.md) to get ideas to contribute or implement your own things.

# License

MIT

repository: leboncoin/ansible-role-harbor-api

repo_name: leboncoin/ansible-role-harbor-api


text:
# tokentracker

> realtime collaboration app for tracking board game tokens

## Features

* Realtime collaborative UI.  Changes are instantly pushed to all people currently viewing the page
* Responsive layout supports mobile, tablet and desktop
* Drag/drop sortable list of tokens to change ordering on the fly
* Quickly track amount of damage taken on any token
* Simple cloning feature to track multiple tokens of same type
* TODO: track statuses for each token

## Running Locally

Using meteor:
```bash
$ meteor
```

## Contributing

Interested in contributing?  Review the [project contribution guidelines](CONTRIBUTING.md), [license](LICENSE.txt) and get started!

Patches are always welcome and thank you to all [project contributors](https://github.com/wireframe/tokentracker/graphs/contributors)!

repository: wireframe/tokentracker

repo_name: wireframe/tokentracker


text:
![Gastropoda](https://user-images.githubusercontent.com/65590878/102676983-f6497680-4154-11eb-91c8-250f07642579.png)

# Gastropoda

Gastropoda is a literary magazine that seeks to celebrate the spiralic nature of life by showcasing unique short stories. This is a single page application built with a vanilla JavaScript frontend and Rails backend API.

[Live Demo](https://gastropoda.netlify.app/)

[Demo Video](https://youtu.be/HSfkeg94AF4)

## Installation

To run this application in your local environment, please follow these steps:

```
1. Clone this repository
2. Change directory to gastropoda-frontend
3. In the src/adapters directory:

   -Uncomment the following line in CommentsAdapter.js:
   this.baseUrl = 'http://localhost:3000/api/v1/comments'

   -Uncomment the following line in EntriesAdapter.js:
   this.baseUrl = 'http://localhost:3000/api/v1/entries'

4. Change directory to gastropoda-backend
5. Run 'bundle install'
6. If database does not exist, Run 'rails db:create'
7. Run 'rails db:migrate'
8. Run 'rails db:seed'
9. Run 'rails s'
10. Open the 'index.html' file in your browser
```

## Contributing

Bug reports and pull requests are welcome on Github at:
https://github.com/dougschallmoser/gastropoda-js-app

This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

## Authors

* **Doug Schallmoser** - *All work* - [DougSchallmoser](https://github.com/dougschallmoser)

## License

This project is licensed under the [MIT License](https://opensource.org/licenses/MIT)

## Acknowledgments

I would like to acknowledge my wife for inspiring the idea for this application.

repository: dougschallmoser/gastropoda

repo_name: dougschallmoser/gastropoda


text:
### [CVE-2013-1740](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-1740)
![](https://img.shields.io/static/v1?label=Product&message=n%2Fa&color=blue)
![](https://img.shields.io/static/v1?label=Version&message=n%2Fa&color=blue)
![](https://img.shields.io/static/v1?label=Vulnerability&message=n%2Fa&color=brighgreen)

### Description

The ssl_Do1stHandshake function in sslsecur.c in libssl in Mozilla Network Security Services (NSS) before 3.15.4, when the TLS False Start feature is enabled, allows man-in-the-middle attackers to spoof SSL servers by using an arbitrary X.509 certificate during certain handshake traffic.

### POC

#### Reference
- http://seclists.org/fulldisclosure/2014/Dec/23
- http://www.oracle.com/technetwork/topics/security/cpujan2015-1972971.html
- http://www.oracle.com/technetwork/topics/security/cpujan2016-2367955.html
- http://www.oracle.com/technetwork/topics/security/cpujul2014-1972956.html
- http://www.oracle.com/technetwork/topics/security/cpuoct2014-1972960.html
- http://www.oracle.com/technetwork/topics/security/ovmbulletinjul2016-3090546.html
- http://www.vmware.com/security/advisories/VMSA-2014-0012.html

#### Github
No PoCs found on GitHub currently.

repository: trickest/cve

repo_name: trickest/cve


text:
# Servo

*Alan Jeffrey, Research Engineer, Mozilla*

Northwestern University, 2018-05-22

https://servo.org/

## Why?

Most browser engines ~1990s

What has changed since then?

 * Hardware
 * Software
 * Security

## What?

What are the key components of a web engine?

How can we take advantage of hardware?

How can we take advantage of Rust?

## How?

Servo is ~250Kloc Rust. Dependencies are ~2Mloc C/C++, ~1Mloc Rust.

 * Source code repo
 * Continuous integration
 * Testing
 * Issue tracking
 * ...

https://github.com/servo/servo

## Who?

Servo project is ~10 Mozilla employees.

How can such a small team have impact?

## Questions?

AMA