text:
---
date: 2018-08-13
title: Insecure deserialization
categories:
  - security
description:
type: Document
set: security
set_order: 13
---

## General information

Insecure deserialization often leads to remote code execution. Even if deserialization flaws do not result in remote
code execution, they can be used to perform attacks, including replay attacks, injection attacks, and privilege escalation attacks.
It also occupies the #8 spot in the OWASP Top 10 2017 list.

* Serialization refers to a process of converting an object into a format which can be persisted to disk (for example,
saved to a file or a datastore), sent through streams (for example stdout), or sent over a network. The format in which
an object is serialized into, can either be binary or structured text (for example XML, JSON YAML…). JSON and XML are two
of the most commonly used serialization formats within web applications.

* Deserialization, on the other hand, is the opposite of serialization, that is, transforming serialized data coming from
a file, stream, or network socket into an object.

More information you can find in [this](https://dzone.com/articles/what-is-insecure-deserialization) article.

## Basic examples

The simplest way to load a YAML file using the PyYAML library in Python is by calling  yaml.load().
The following is a simple, unsafe example that loads a YAML file and parses it.
```
# Import the PyYAML dependency
import yaml
# Open the YAML file
with open('malicious.yml') as yaml_file:
# Unsafely deserialize the contents of the YAML file
contents = yaml.load(yaml_file)
# print the contents of the key 'foo' in the YAML file
print(contents['foo'])
```

Unfortunately, yaml.load() is not a safe operation, and could easily result in code execution if the attacker supplies a YAML file similar to the following.

```
foo: !!python/object/apply:subprocess.check_output ['whoami']
```

More detailed explanation of this example listed on [DZone article](https://dzone.com/articles/what-is-insecure-deserialization).

## What's next?

Here are some useful links to expand your knowledge:
* Extended info about vulnerability is listed on [OWASP article](https://www.owasp.org/index.php/Deserialization_of_untrusted_data);
* [Article](https://blog.talosintelligence.com/2017/03/apache-0-day-exploited.html) about exploitation of this vulnerability;
* HackerOne [article](http://www.hackeone.info/2017/12/a8-insecure-deserialization-2017.html) with lot of examples;
* [More](https://prakharprasad.com/shopify-remote-code-execution/) about this vulnerability.

repository: techmagic-team/knowledge-base

gha_language: HTML

repo_name: techmagic-team/knowledge-base


text:
# juno-email

juno-convert is a tool for converting mail from the Juno email
client to the mbox format.

Once you have mbox files, you can import them into many mail programs,
such as [Thunderbird](http://www.mozilla.org/thunderbird/) (using the
excellent [ImportExportTools add-on](https://addons.mozilla.org/thunderbird/addon/importexporttools/))
or OS X's Mail app.

## Installation

    $ gem install juno-email

## Usage

tl;dr:

    $ juno-convert --source path/to/juno --destination path/for/output

Details:

    juno-convert [options]
       -s, --source           Path to Juno directory. Required.
       -d, --destination      Path to output directory. Required.
       -o, --overwrite        Overwrite files in output directory.
       -v, --version          Display version.
       -h, --help             Display this help message.

More details:

* `--source` is the path in which the user folders are located.  They look
like USER0000, USER0001, etc.
* `--destination` is where you want the mbox files to be output.  If destination
is `foo/bar`, `bar` will be created if it doesn't already exist.
* `--overwrite` means that if the program wants to create `foo.mbox` and there's
already a `foo.inbox` there, it wil be overwritten. Without this option, the
program will abort if it runs into such a situation.

## It doesn't work!!

The tool needs Ruby 1.9 or greater.  You can check your version with `ruby -v`.

That's not the problem? Okay, let's make things better!  I only had access to
one user's emails from Juno 4.0.11, so I can easily believe there are plenty
of edge cases I haven't run across.  If you could [open an issue](https://github.com/hynkle/juno-email/issues/new)
with as much detail as you have, we can get started on figuring it out and
making this tool better for everyone.  Be sure to include your operating system
and your ruby version (`ruby -v`).

## Contributing

1. Fork it ( http://github.com/hynkle/juno-email/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

license: MIT

repository: hynkle/juno-email

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: hynkle/juno-email


text:
# Releasing Kalix Java SDK

Create a release issue (using the [GitHub CLI](https://cli.github.com/))

```shell
gh issue create --title 'Release Kalix Java/Scala SDKs' --label kalix-proxy --body-file docs/release-issue-template.md -w
````

and follow the instructions.

## Publishing documentation hotfixes

Docs will be published automatically on release. Docs can also be published manually for hotfixes.

The version used in the docs will be the nearest tag. If all doc changes since the last release should be published, run (in the `docs` dir, or with `-C docs`):

```
make deploy
```

If only some doc changes are needed, branch from the last release tag, cherry-pick the needed doc changes, and then run `make deploy`.

This will publish the doc sources to the `docs/current` branch. They will be included automatically in the next build for the main docs. A build for the main docs can also be triggered by re-running the last docs build in CircleCI (on the `master` branch for dev docs, on the `current` branch for prod docs).

repository: lightbend/kalix-jvm-sdk

branch_name: refs/heads/main

gha_language: Scala

repo_name: lightbend/kalix-jvm-sdk


text:
# PHP Middleware Stack
[![Build Status](https://travis-ci.com/idealo/php-middleware-stack.svg?token=dB3owzyXmEKz9x3RX1AW&branch=master)](https://travis-ci.com/idealo/php-middleware-stack)

This is an implementation of [PSR-15 Draft](https://github.com/php-fig/fig-standards/blob/master/proposed/http-middleware/middleware.md) using the proposed Interface package [http-interop/http-middleware](https://github.com/http-interop/http-middleware) for PHP7+ runtime environment.

It enables a sequential execution of middlewares that use a PSR-7 conform Response/Request implementation.

## Install

```bash

$ composer require idealo/php-middleware-stack

```

## How to
```php

<?php

use Idealo\Middleware\Stack;

$stack = new Stack(
    $defaultResponse,
    $middleware1,
    $middleware2,
    $middleware3
);

$stackResponse = $stack->process($request);

```

## Usage
**idealo/php-middleware-stack** provides the ```Idealo\Middleware\Stack``` class. All it has to know in order to be instantiable is:
* an instance of ```Psr\Http\Message\ResponseInterface``` as the default response
* and middlewares, that implement the ```Psr\Http\Middleware\ServerMiddlewareInterface```

To perform a sequential processing of injected middlewares you have to call stack's ```process``` method with:
* an instance of ```Psr\Http\Message\RequestInterface```.

By default stack's ```process``` method returns the injected response object. If any middleware decides to answer on it's own, than the response object of this certain middleware is returned.

Stack implements ```Interop\Http\ServerMiddleware\DelegateInterface```.

## For example

```php

<?php

// you decide what middleware you want to put in a stack.
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Interop\Http\ServerMiddleware\MiddlewareInterface;

class TrickyMiddleware implements MiddlewareInterface
{
    public function process(ServerRequestInterface $request, DelegateInterface $frame) : ResponseInterface
    {
        $requestBody = $request->getBody();
        try {
            // implement your middleware logic here
        } catch (\Exception $exception){
            return new CustomExceptionResponse($exception);
        }

        return $frame->process($request);
    }
}

class VeryTrickyMiddleware implements MiddlewareInterface
{
    ...
}

class LessTrickyMiddleware implements MiddlewareInterface
{
    ...
}

// you define your PSR7 conform response instance
$defaultResponse = new DefaultResponse();

// you put your request into a PSR7 conform way
$request = new ServerRequest();

// and here we are
$stack = new \Idealo\Middleware\Stack(
    $defaultResponse,
    new TrickyMiddleware(),
    new VeryTrickyMiddleware(),
    new LessTrickyMiddleware()
);

$stackResponse = $stack->process($request);

// if everything goes well then
var_dump($stackResponse === $defaultResponse); // gives: true

```

repository: ncou/php-middleware-stack

repo_name: ncou/php-middleware-stack


text:
# Wiki-like documentation files

wiki files are text files used by the HTML documentation generator
in `chad`.

Forth source code normally has short reference markers in the format:
 <a REFERENCE stackpic>

repository: uho/chad

gha_license_id: MIT

repo_name: uho/chad


text:
# README

# NOMADS

## Project Description
> NOMAD is a social media web application intended as a destination for digital nomads to share their opinion and travel experiences.

> The application represents an MVP of the product with the full graphical design but only basic features that would be extended in the future.

![screenshot](./homepage.png)
![screenshot](./profiepage.png)

## Built With

- ruby '3.0.0'
- Ruby on Rails v6.1.3'

## Tools and gems

- Devise
- Bootstrap
- rspec
- capybara
- rubocop
- Active storage

## Live Demo
[Deployed app](https://safe-fortress-38104.herokuapp.com/)

## Getting Started

To get a local copy up and running follow these simple example steps.

### Prerequisites

- Ruby: 3.0.0
- Rails: 6.1.3
- PostgreSQL. Versions 9.3 and up are supported

### Set Up

- Go to the "Code" section of this repository and press the green button that says "Code". Copy the URL or the SSH key.
- Go to the terminal and enter:
```
git clone URL/SSH key
```
- If you don't have git, you can download this project and unzip it.
- Change directory into the folder the application is saved.
- To install the gems, run:
```
bundle install
```
- Install yarn (you need to have npm installed) by running:

```
npm install --global yarn
```

Setup database with:

```
   rails db:create
   rails db:migrate
```

Start server with:

```
    rails server
```

Open `http://localhost:3000/` in your browser.

- Sign up with your full name, username and password.

- You can edit your profile by uploading a profile photo that shows up on your home page.

- You can also edit your profile to upload a cover picture that is displayed on your personal page.

- To share your experience, create an opinion on the home page.

- You can see suggestions about who to follow on the right panel of the page with a follow button in front of each suggestions. Click "follow" to follow a user.

- The Followers and following count helps you keep track of your followers to know who unfollowed or started following you as well as other users you follow.

- You can engage with other users by liking their opinions and vice versa.

### Run tests

```
    rpsec --format documentation
```

### Deployment

- Deployed on Heroku

## Author

👤 **George Gbenle**

- GitHub: [george-shammar](https://github.com/george-shammar)
- Twitter: [@GeorgeShammar](https://twitter.com/GeorgeShammar)
- LinkedIn: [George Gbenle](https://www.linkedin.com/in/georgegbenle/)

## 🤝 Contributing

Contributions, issues and feature requests are welcome!

## Show your support

Give a ⭐ if you like this project!

## 📝 License

This project is [MIT](LICENSE) licensed.

## Acknowledgments

Design idea by [Gregoire Vella on Behance](https://www.behance.net/gregoirevella)

repository: george-shammar/noMads

branch_name: refs/heads/develop

gha_language: Ruby

repo_name: george-shammar/noMads


text:
# NuGet Service Model
APIv3 is built on a foundation of "microservices". In order to make it easy to build and run these microservices, we have constructed a simple model for designing and implementing these services.

## Goals
1. Modular - It should be simple to update and deploy individual services
2. Reliable - Able to support a highly-available failover architecture
3. Selfhostable - One-box hostable (perhaps with limited functionality, but hopefully limited ONLY by performance and other shared hosting issues)

## Physical Architecture

### Application
A NuGet Application is a complete set of Environments making up a single application for viewing/uploading/downloading/searching NuGet Packages. For example, "NuGet.org" is an Application (the name here does **not** indicate a DNS name, it just happens to match one :)). Another Application could be "Chocolatey.org", etc.

An Application in the NuGet Services model is given a simple name with no hyphens (-) or underscores (_), such as "nuget".

### Environment
An Application is made up of one or more Environments. Each Environment represents a single entry point DNS name for all services within that Environment. For example "api.nuget.org" is the entry point for the "Production" Environment of the "NuGet.org" Application. Generally, each Environment is given a unique DNS root (for example: "nuget.org").

An Environment is given a composite name consisting of the name of the Application, followed by a hyphen (-), followed by the Environment name (which cannot contain hyphens or underscores), for example "nuget-int".

### Datacenter
A Datacenter is a **logical** concept that **may or may not** (but generally will) map to a physical datacenter containing servers and services. There is one Primary Datacenter, labeled "Datacenter 0" and zero or more Secondary Datacenters, labelled "Datacenter 1" and up. Only the Primary Datacenter supports write operations in the current model (though this may change). The Secondary Datacenters are for disaster recovery and _possibly_ for improving latency in different geographical regions.

A Datacenter is given a composite name by appending the index number of the Datacenter to the Environment name: "nuget-int-0"

### Service Host
A Service Host represents a single DNS endpoint on the primary Domain Name used by the Environment. That DNS endpoint may point to a load balancer or to a single service, depending on the deployment model being used. In the case of a load-balanced farm of servers, each server is referred to as a "Service Host Instance" and runs the **same code and configuration** as each other server in the Service Host. In Azure, a Service Host maps to a Cloud Service **Role**.

The Service Host also provides an HTTP Server (using Owin) that responds to a simple GET request to the root URL for the Host and lists the Services available in that Host.

A Service Host is given a name that describes the services that exist in the host, which is appended to the Datacenter name: "nuget-int-0-work". In the case of multiple load-balanced servers within a host, each machine is further identified by a 0-based index: "nuget-int-0-work_IN0"

### Service
A Service is a single package of code that makes up a single microservice in the NuGet Service Model. Services may be hosted in dedicated Hosts (each Host having one and only one service) or in shared Hosts (to facilitate one-box deployments). Each service provides an Owin Application that attaches to a single URL root on the Service Host (for example "/work"). The Service Host will list the service in it's root document and dispatch requests for URLs under that root to the Service.

A Service is given a name that describes it's purpose, which is appended to the Service Host name: "nuget-int-0-work_IN0-work"

## Architecture Diagram
Below is a rough diagram of the Physical Architecture breakdown

![Service Model](images/ServiceModel.png)

gha_license_id: NOASSERTION


text:
[![log](https://github.com/java-aodeng/hope-plus/blob/master/docs/img/logo.png)](https://github.com/java-aodeng/hope-plus)

Hope-plus 0.6.1

🇨🇳[简体中文](./README.md) | 🇺🇸English | [更新日志](https://github.com/java-aodeng/hope-plus/commits/master)

[![author](https://img.shields.io/badge/author-%E4%BD%8E%E8%B0%83%E5%B0%8F%E7%86%8A%E7%8C%AB-blue.svg)](https://aodeng.cc)
[![JDK](https://img.shields.io/badge/JDK-1.8-orange.svg)](https://github.com/java-aodeng/hope-plus)
[![license](https://img.shields.io/badge/license-MIT-red.svg)](https://github.com/java-aodeng/hope-plus/blob/master/LICENSE)
[![QQ群](https://img.shields.io/badge/chat-%E4%BD%8E%E8%B0%83%E5%B0%8F%E7%86%8A%E7%8C%ABQQ%E7%BE%A4-yellow.svg)](https://jq.qq.com/?_wv=1027&k=574chhz)
[![Telegram群组](https://img.shields.io/badge/telegram-%E4%BD%8E%E8%B0%83%E5%B0%8F%E7%86%8A%E7%8C%AB--%E5%AE%98%E6%96%B9%E9%83%A8%E8%90%BD-orange.svg)](https://t.me/joinchat/LSsyBxVKLGEkF5MtIhg6TQ)
[![star](https://img.shields.io/github/stars/java-aodeng/hope-plus.svg?label=Stars&style=social)](https://github.com/java-aodeng/hope-plus)
[![发行版本](https://img.shields.io/badge/release-%E5%8F%91%E8%A1%8C%E7%89%88%E6%9C%AC-red.svg)](https://github.com/java-aodeng/hope-plus/releases)

## brief introduction：

>Hope-plus is a nice privilege management system https://github.com/java-aodeng/hope-plus

>Based on Springboot2 development, integrated use of mybatis + Shiro + redis + thymeleaf + Maven and other practical technologies. Page template uses h+, which has beautiful interface, many powerful UI components that can be reconfigured, jQuery plug-ins and so on. It can be used in all Web applications, such as the background of website management system, CMS, CRM, OA and so on. Of course, you can also customize in depth to make a stronger system.

>If you think it's good, give Star support! Your Star, my Open Source Power!
#### Module partition

| Modular         | Interpretation                      |
| ---------- | ----------------------- |
| hope-admin  | Background management module |
| hope-core  | Core Business Class Module |
| hope-framework | Framework module, providing data operation, tool processing, general Mapper, general service, etc. |

#### Instructions
```bash
# 1.Use command pull substitution code：
git clone https://github.com/java-aodeng/hope-plus.git
# 2.Import this project using IDEA
# 3.New database create database hope; Import database files docs/db/hope.sql
# 4.modify(hope-admin/resources/application.yaml)configuration file
    a.Database Configuration(Searchable data source or location toL.17)
    b.redis Configuration(Searchable redis or location to L.29, Note: The project must install redis service to start)
# 5.Running projects (in many ways, the simplest is recommended)
    a.Run the hope-admin directory directlyHopeAdminApplication.java
# 6.Browser access:
http://<IP_ADDRESS>:8886
```
#### Account number
Backstage login：Account number：admin password：123456

Resource monitoring：Account number：hope-druid password：hope-druid

API address: localhost:8886/swagger-ui.html
### Thank：
Hope-plus was born out of the following projects（Open Source, Open Source for Use）：

- [Spring Boot](https://github.com/spring-projects/spring-boot)：Core framework
- [Apache Shiro](https://github.com/apache/shiro)：Permission framework
- [Redis](https://github.com/antirez/redis)：Caching framework
- [Thymeleaf](https://github.com/thymeleaf/thymeleaf)：template engine
- [MyBatis](https://github.com/mybatis/mybatis-3)：MyBatis SQL Mapper Framework for Java
- [PageHelper](https://github.com/pagehelper/Mybatis-PageHelper)：jPaginate
- [tk.mybatis](https://github.com/abel533/Mapper)：General Mapper
- [alibaba/druid](https://github.com/alibaba/druid)：Database connection pool
- [alibaba/fastjson](https://github.com/alibaba/fastjson)：Fast JSON parser/generator for Java
- [shiro-redis](https://github.com/alexxiyang/shiro-redis)：A redis caching tool that Shiro can use
- [Lombok](https://www.projectlombok.org/)：Make the code more concise
- [Hutool](https://github.com/looly/hutool)：A Java toolkit, also just a toolkit, helps us simplify every line of code, reduce every method, and make the Java language "sweet"
- [Bootstrap](https://github.com/twbs/bootstrap.git)：The most widely used front-end UI framework
- [JQuery](https://github.com/jquery/jquery.git)：The most widely used JavaScript framework
- [Layer](https://github.com/sentsin/layer.git)：Ejection Layer Component
- [kaptcha](https://github.com/penggle/kaptcha)：Google Verification Code
- [jrebel](https://zeroturnaround.com/software/jrebel/)：Thermal deployment
- [swagger](https://github.com/swagger-api/swagger-ui)：Swagger is the most popular API expression tool in the world.

## Donation

**Ask the author to eat a meat bun :) Author blog：[https://aodeng.cc](https://aodeng.cc)（We don't change the world, we change with the world.）Wechat Public Number：低调小熊猫**

![](https://i.loli.net/2018/12/31/5c29d3b18826d.png)

## Interface display

![](https://i.loli.net/2018/12/31/5c29cfa636b7a.png)
![](https://i.loli.net/2018/12/31/5c29cfe24ef3c.png)
![](https://i.loli.net/2018/12/31/5c29d0f3e7f89.png)
![](https://i.loli.net/2018/12/31/5c29d08c40128.png)
![](https://i.loli.net/2018/12/31/5c29d08c4b71f.png)
![](https://i.loli.net/2018/12/31/5c29d188d68fe.png)
![](https://i.loli.net/2018/12/31/5c29d188daba1.png)
![](https://i.loli.net/2018/12/31/5c29d1ce428a5.png)
![](https://i.loli.net/2018/12/31/5c29d1ce60893.png)
![](https://i.loli.net/2018/12/31/5c29d1ce68318.png)
![](https://i.loli.net/2018/12/31/5c29d1ce66275.png)
![](https://i.loli.net/2018/12/31/5c29d1ce86b5e.png)
![](https://i.loli.net/2019/02/13/5c63cd02c39e2.png)

## Last

In order to prevent the world from being destroyed, in order to love and justice, it is recommended to look at the wisdom of asking questions. http://doc.zengrong.net/smart-questions/cn.html

repository: whatmeever/hope-plus-master

repo_name: whatmeever/hope-plus-master


text:
# Arrays

CUDAnative provides a primitive, lightweight array type to manage GPU data organized in an
plain, dense fashion. This is the device-counterpart to CUDAdrv's `CuArray`, and implements
(part of) the array interface as well as other functionality for use _on_ the GPU:

```@docs
CUDAnative.CuDeviceArray
CUDAnative.ldg
```


text:
# beatport

![Build Status](https://github.com/jeanmorais/beatport/workflows/ci/badge.svg?branch=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/jeanmorais/beatport)](https://goreportcard.com/report/github.com/jeanmorais/beatport)
[![codecov](https://codecov.io/gh/jeanmorais/beatport/branch/master/graph/badge.svg)](https://codecov.io/gh/jeanmorais/beatport)
> A REST API to follow the most hyped tracks on the dance floors :notes: :dancers:

This project has no link with [beatport.com](https://beatport.com). It's just an open source project to facilitate the search for tracks through an API.

## Getting Started

### Requirements

- [Golang](http://golang.org/) (14.0 or higher)
- [GNU Make](https://www.gnu.org/software/make/)
- [Docker](http://docker.com)

### Setting up and running locally
```bash
# Install dependencies
make install

# Run server
make run
```

### Running the tests
```
make test
```

## Build process

### Build

```bash
make build
```

### Create a Docker image

```bash
make image
```

### Running the app using Docker

```bash
make run-docker
```

## Sample
### Genres

Get all available genres on Beatport:

`GET /genres `
```
[
    {
        "name": "Afro House",
        "key": "afro-house-89",
        "url": "https://www.beatport.com/genre/afro-house/89"
    },
    {
        "name": "Bass House",
        "key": "bass-house-91",
        "url": "https://www.beatport.com/genre/bass-house/91"
    },
...
]
```

### Tracks
#### TOP 10
Get the top 10 tracks by a genre key:

`GET /tracks/top10/:genreKey`

```
[
    {
        "chartNumber": 1,
        "title": "Mona Ki Ngi Xica",
        "remix": "Pablo Fierro Remix",
        "artists": [
            "Pablo Fierro",
            "Bonga"
        ],
        "label": "MoBlack Records",
        "genre": "Afro House",
        "url": "https://www.beatport.com/track/mona-ki-ngi-xica-pablo-fierro-remix/14279156",
        "price": "1.29"
    },
    {
        "chartNumber": 2,
        "title": "Feeling Good",
        "remix": "Original Mix",
        "artists": [
            "Javi Colors",
            "Dr. Alfred"
        ],
        "label": "SP Recordings",
        "genre": "Afro House",
        "url": "https://www.beatport.com/track/feeling-good-original-mix/13781081",
        "price": "1.29"
    },
...
]

```

repository: jeanmorais/beatport

repo_name: jeanmorais/beatport


text:
# About
This is an implementation of cross-lingual matrix factorization using ALS as described in [Learning Cross-lingual Representations with Matrix Factorization](https://aclweb.org/anthology/W/W16/W16-1201.pdf). This project is based on the orthogonal matrix factorization (OrMF) scripts available [here](http://www.cs.columbia.edu/~weiwei/code.html).

If you use this code, please cite the following papers:

```
@article{aldarmakilearning,
  title={Learning Cross-lingual Representations with Matrix Factorization},
  author={Aldarmaki, Hanan and Diab, Mona},
  booktitle={Proceedings of the Workshop on Multilingual and Cross-lingual Methods in NLP},
  year={2016}
}
```

```
@inproceedings{guo2012modeling,
  title={Modeling sentences in the latent space},
  author={Guo, Weiwei and Diab, Mona},
  booktitle={Proceedings of the 50th Annual Meeting of the Association for Computational Linguistics},
  year={2012}
}

```
# How To

## Preprocessing

Before using this code, it is recommended to tokenize and stem the data. Make sure test sentences are processed the same way as training sentences.

The input files must contain one sentence per line. Digits will be normalized and all characters lower-cased within the training scripts below.

## Training

To train a pivot model, use the *train.pl* script in the *bin* directory

```
perl train.pl model_dir  train_file  K  lambda  wm  alpha  n_itrs
```
where *K* is the vector size, *lambda* is the regularization parameters, *wm* the missing words weight, and *alpha* used for orthogonal projection (set to 0 to disable).

For example:

```
perl train.pl pivot_model_dir train_file.txt  100  20  0.01  0  20
```

The model will be saved in *pivot_model_dir*

### Additional Languages

To train additional models, use *train_xmf.pl* in the *bin* directory:

```
perl train_xmf.pl  pivot_model_dir new_model_dir train_file1 train_file2  K  lambda  wm  alpha  n_itrs
```
where *train_file1* and *train_file2* are parallel sentences in the pivot and new language, respectively. The model for the new language will be saved in *new_model_dir*

## Testing

To use a trained model, use the *test.pl* script in the *bin* directory, which will output one vector per line (corresponding to the input snetences)

```
perl  test.pl  model_dir  test_file
```

To output a similarity score between two sets of vectors, use *get_sim.pl* in *bin/Postprocess*

```
perl get_sim.pl input_file1 input_file2 output_file cutoff
```

Which will output the similarity score between the vectors in *input_file1* and *input_file2*. The cutoff should be set to 1 unless you want to normalize all scores above a certain value.

*correlation.pl* can be used to calculate the Pearson correlation between two sets of similarity scores.

repository: h-aldarmaki/xfactor

repo_name: h-aldarmaki/xfactor


text:
# Tic Tac Toe Application

## Created Without Create React App

I created this application so that I could update my **React Workflow** incorporating the latest changes in **Webpack** and **React**. However, two plugins I was using in my previous workflow have vulnerabilities which I cannot resolve at this time. They are:

+ [image-webpack-loader](https://www.npmjs.com/package/image-webpack-loader)
+ [imagemin-webpack-plugin](https://www.npmjs.com/package/imagemin-webpack-plugin)

Purportedly the [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin) did not seem to not work well at this point in time with webpack 4 > version 3.0.7. I might revert to it and see what happens. At first the html did not update changes in development or production. However, that might have been because I had not set up my workflow in webpack correctly yet. I now am using 3.2.0 and it works just fine.

The [extract-text-webpack-plugin](https://github.com/webpack-contrib/extract-text-webpack-plugin/issues/701) does not play well with webpack 4. Word is to replace it with the [mini-css-extract-plugin](https://webpack.js.org/plugins/mini-css-extract-plugin/) instead. This works very well.

The **CommonsChunkPlugin** has been removed from `the internal webpack graph`. It has been replaced by `optimization.splitChunks`. To learn more, please visit the webpack docs: [SplitChunksPlugin](https://webpack.js.org/plugins/split-chunks-plugin/).


text:
# obmed

#### Openbox menu editor

## Building and running
- Install these dependencies before starting:
  - python 3
  - docopt
- Use the following command to build:
    ```
    python3 setup.py build
    ```
- After a successful build, use this to run:
    ```
    python3 build/lib/obmed/run.py --help
    ```

  Note: You might need to use `python` instead of `python3` for some linux distros

## License
This project is licensed under the MIT License.
See the [LICENSE](LICENSE) file for more information.

## Thank you!

repository: praj-foss/obmed

repo_name: praj-foss/obmed


text:
What is VectRast?
-----------------

A tool for creating levels out of bitmaps (or vice versa) for the [Elastomania game](http://www.moposite.com).

Also, as a by-product, you can convert levels into levels (with transformations such as rotation or scaling) and bitmaps into bitmaps.

Why should I want that?
-----------------------

Mainly for Elma battles.. no more "omg i cant use the editor u make lev!!" whining :P
Just use Gimp/photoshop to draw the level as bitmap, then use VectRast to convert the bitmap into the vector format used by Elastomania.

The opposite direction (level to bitmap) can be useful for inspecting some large levels, I suppose...

What can it do?
---------------

VectRast converts a bitmap into the polygonal level format used internally by Elastomania.

It also allows you to transform the resulting polygons, i.e. rotate them, scale along either axis and displace them.

Conversely, it takes a level and creates a bitmap out of it.

Another thing, suggested by sk0nce, is including a bitmap into an existing level.

What can it NOT do?
--------------------

It does not place any apples.
Also you still have to open the file in the editor and move start/flowers to their desired positions -- the program always places them around the center.

How about the vectorization algorithm, how robust is it?
--------------------------------------------------------

Since polygons in Elastomania are not allowed to touch or intersect, I disallowed this also.

Among these ambiguous situations that allow incorrect interpretations are one pixel wide lines; do not use one pixel wide lines.
Still, the program detects these faulty situations and will yell at you the location in terms of pixel coordinates.

TL;DR **use line width of at least two when drawing shapes**.

How do I use it?
-----------------

The tool operates through command line arguments (YEAH!)

Recognized parameters are:

* **IO parameters**
  * `-loadbmp filename` : specify bitmap to load from; white color means empty space, anything else is ground
  * `-loadlev filename` : specify level to load from
  * `-loadlevbmp level bitmap` : specify level to load from and bitmap to include in the level; transformations are only done over the bitmap<br>
  * `-savelev filename` : specify level file to save to
  * `-savebmp filename` : specify bitmap file to save to
* **transformation parameters**
  * `-translate x y` : displace all polygons
  * `-rotate x` : rotate around the center (in degrees)
  * `-scale x y` : scale x and y axis resp; the values can be interpreted as 'how many pixels on the screen is going to be one pixel in the bitmap'. Negative quantity results in mirroring around the respective axis.
* **other parameters**
  * `-warnings true/false` : print warnings (default `false`)
  * `-flowers number` : number of flowers in the created level (effective only with `-loadbmp`); default is `1`

You can use the transformations one on top of another; for example you can rotate by 30 degrees, then displace 10 pixels to the left, then rotate again and then stretch x axis to 2 and mirror y axis to -1.

Run the example batches from `examples folder`. Look at the files created. Tweak the parameters in the batches.

What do I need to run it?
-------------------------

You need the [Microsoft .NET framework](http://msdn.microsoft.com/netframework/downloads/howtoget.asp) installed.

So now I can convert any picture whatsoever into a level?
--------------------------------------------------------

Almost, but... Firstly, only white color is considered empty space (not red, not gray, not yellow).
Secondly, you must use a precise (loss-less) format such as bmp or png.
If you use a lossy format like jpeg, the most likely result is the illegal pixel configuration mentioned above.

The bitmap looks so nice and smooth on my screen, why not so in the level?
---------------------------------------------------------------------------

Ok, I see this is one common pitfall: people draw a level in Paint so that it fills
one screen (700x700 or whatever) and then expect it to be precise when magnified
to like 4000x3000 (six screens in elma, not a big level). Think of the bitmap
you are drawing as **the actual level when played**, not as the minimap!

Check the example directory for a sample bitmap. Use meaningful scales for `bmp2lev`, like 2 or 3, not 40... unless you know what you are doing.

I have a question not answered here, what now?
------------------------------------------------

[Ask me](mailto:xrehurek@fi.muni.cz?subject=vectrast) and I'll add it here. Also be sure you're using the latest version of VectRast.

**NOTE: I created this tool many years ago (2003). Elma the game is still around and kicking,
but don't send me any emails about VectRast, please** :-)

repository: piskvorky/VectRast

repo_name: piskvorky/VectRast


text:
# Flux Presentation
Flux presentation built with [redux-slidedeck](https://github.com/taylorhakes/redux-slidedeck)

[View the slides here](https://taylorhakes.github.io/flux-presentation)

repository: taylorhakes/flux-presentation

repo_name: taylorhakes/flux-presentation


text:
---
layout: default
---

# 1994-02-15 - Detweiler abuse again

## Header Data

From<EMAIL_ADDRESS>(Eric Hughes)

To<EMAIL_ADDRESS>Message Hash: 610015ae429eaa99f33be8acda39a026e222954bac1b61fc6cbdb28c65752e6d

Message ID<EMAIL_ADDRESS>Reply To<EMAIL_ADDRESS>UTC Datetime: 1994-02-15 20:21:42 UTC

Raw Date: Tue, 15 Feb 94 12:21:42 PST

## Raw message

```
{% raw  %}From<EMAIL_ADDRESS>(Eric Hughes)
Date: Tue, 15 Feb 94 12:21:42 PST
To<EMAIL_ADDRESS>Subject: Detweiler abuse again
In-Reply-To<EMAIL_ADDRESS>Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

>It might be more effective if you bounced messages from detweiler back
>to him, CC: postmaster

Why even bounce?  If you want to make the remailers do something with
unwanted mail, one could honor the remailing request, but not
anonymize it.

Eric

{% endraw %}
```

## Thread

+ Return to [February 1994](/archive/1994/02)

+ Return to "[Hal <hfinney@shell.portal.com>](/authors/hal_hfinney_at_shell_portal_com_)"
+ Return to<EMAIL_ADDRESS>(Eric Hughes)](/authors/hughes_at_ah_com_eric_hughes_)"
+ Return to "["Jon 'Iain' Boone" <boone@psc.edu>](/authors/jon_iain_boone_boone_at_psc_edu_)"
+ Return to "[Matthew J Ghio <mg5n+@andrew.cmu.edu>](/authors/matthew_j_ghio_mg5n_at_andrew_cmu_edu_)"

+ 1994-02-15 (Tue, 15 Feb 94 09:33:58 PST) - [Re: Detweiler abuse again](/archive/1994/02/675e9f15e112029716b3ff5a63c77b05a6f72ed9ebb79e0b3085a726196dc2fc) - _Hal<EMAIL_ADDRESS>  + 1994-02-15 (Tue, 15 Feb 94 10:01:41 PST) - [Detweiler abuse again](/archive/1994/02/722da6dcb63292aae36a0f43aa69f1e4df4e110bfbcbed0fc1b8afb5819cd8e5) -<EMAIL_ADDRESS>(Eric Hughes)_
    + 1994-02-15 (Tue, 15 Feb 94 11:31:42 PST) - [Re: Detweiler abuse again](/archive/1994/02/51292e703550864907efcb46e39a0d82f57a22fd77e3df5c8e0c5d5f46ae17e9) - _"Jon 'Iain' Boone"<EMAIL_ADDRESS>  + 1994-02-15 (Tue, 15 Feb 94 11:09:28 PST) - [Re: Detweiler abuse again](/archive/1994/02/ea907e1505c3b66199656384cceb1c4e36c4075134c2812a64dea5cfb715431b) - _Matthew J Ghio<EMAIL_ADDRESS>    + 1994-02-15 (Tue, 15 Feb 94 12:21:42 PST) - Detweiler abuse again -<EMAIL_ADDRESS>(Eric Hughes)_


text:
Files Data Source
-------------------------------------------

This creates SQL access to:

* Google Cloud Storage rest api list of files
* The contents of json/csv files that can be queried.
  Similar to the federated BigQuery engine that can query avro, csv files.  Or [prestodb](http://prestodb.io/).

Examples
--------------------

```sh

# from dataux root

```

repository: mbrukman/dataux

repo_name: mbrukman/dataux


text:
# FizzBuzzer

This project is a simple boilerplate for an API using gRPC protocol by using [grpc-gateway](https://github.com/grpc-ecosystem/grpc-gateway) ( also create a R-proxy to handle HTTP )

The contract of the API is handled by [Protobuf](https://developers.google.com/protocol-buffers/) interchange format

## Context
This simple API contains only one endpoint as example which is :
* gRPC: `GetFizzBuzz(string1, string2 string, int1, int2, limit int64)`
* HTTP:
  * `/v1/fizzbuzz?string1=x&string2=x&int1=x&int2=x&limit=x`
  * `/v1/fizzbuzz/string1/string2/int1/int2/limit`

```text
The original fizz-buzz consists in writing all numbers from 1 to 100, and replacing :
* all multiples of 3 by “fizz”
* all multiples of 5 by “buzz”
* all multiples of 15 by “fizzbuzz”.

The output would look like this:
“1,2,fizz,4,buzz,fizz,7,8,fizz,buzz,11,fizz,13,14,fizzbuzz,fizz,...”
```

##

## Prerequisites
I assume that you have already installed :
* Go -> [Install Go](https://golang.org/doc/install)
* Protobuf -> [Install Protobuf](https://github.com/protocolbuffers/protobuf)

## Getting started

```shell
go get -u github.com/tommy-42/go-grpc-fizzbuzzer

cd $GOPATH/src/github.com/tommy-42/go-grpc-fizzbuzzer

go get ./...

# chmod +x run.sh
./run.sh
```


text:
### 2578. Split With Minimum Sum

[Solution](2578.%20Split%20With%20Minimum%20Sum.md)

Given a positive integer num, split it into two non-negative integers num1 and num2 such that:

The concatenation of num1 and num2 is a permutation of num

In other words, the sum of the number of occurrences of each digit in num1 and num2 is equal to the number of occurrences of that digit in num.

num1 and num2 can contain leading zeros.

Return the minimum possible sum of num1 and num2.

### 2579. Count Total Number of Colored Cells

[Solution ](2579.%20Count%20Total%20Number%20of%20Colored%20Cells.md)

There exists an infinitely large two-dimensional grid of uncolored unit cells. You are given a positive integer n, indicating that you must do the following routine for n minutes:

At the first minute, color any arbitrary unit cell blue.

Every minute thereafter, color blue every uncolored cell that touches a blue cell.

Below is a pictorial representation of the state of the grid after minutes 1, 2, and 3.

Return the number of colored cells at the end of n minutes.

### 2580. Count Ways to Group Overlapping Ranges

[Solution](2580.%20Count%20Ways%20to%20Group%20Overlapping%20Ranges.md)

You are given a 2D integer array ranges where ranges[i] = [starti, endi] denotes that all integers between starti and endi (both inclusive) are contained in the ith range.

You are to split ranges into two (possibly empty) groups such that:

Each range belongs to exactly one group.

Any two overlapping ranges must belong to the same group.

Two ranges are said to be overlapping if there exists at least one integer that is present in both ranges.

For example, [1, 3] and [2, 5] are overlapping because 2 and 3 occur in both ranges.

Return the total number of ways to split ranges into two groups. Since the answer may be very large, return it modulo 109 + 7.

### 2581. Count Number of Possible Root Nodes

[Solution ](2581.%20Count%20Number%20of%20Possible%20Root%20Nodes.md)

Alice has an undirected tree with n nodes labeled from 0 to n - 1. The tree is represented as a 2D integer array edges of length n - 1 where edges[i] = [ai, bi] indicates that there is an edge between nodes ai and bi in the tree.

Alice wants Bob to find the root of the tree. She allows Bob to make several guesses about her tree. In one guess, he does the following:

Chooses two distinct integers u and v such that there exists an edge [u, v] in the tree.

He tells Alice that u is the parent of v in the tree.

Bob's guesses are represented by a 2D integer array guesses where guesses[j] = [uj, vj] indicates Bob guessed uj to be the parent of vj.

Alice being lazy, does not reply to each of Bob's guesses, but just says that at least k of his guesses are true.

Given the 2D integer arrays edges, guesses and the integer k, return the number of possible nodes that can be the root of Alice's tree. If there is no such tree, return 0.

repository: iajaykarthick/Algo-Repertoire

repo_name: iajaykarthick/Algo-Repertoire


text:
---
title: Python introductory course
layout: post
category: talks
image:  /assets/img/python.jpeg
tags: Python Jupyter notebook material speaker
source: //github.com/IEEE-BCN-SB/python-course
---

This was a free course organized by IEEE BCN SB in collaboration with LinuxUPC held in 2017 and 2018. For the later edition a jupyter notebook was created with theory and problems (some material was lost during a migration).

This course was organized with two other colleagues. It had a duration of 20h (5 days).

Overall the course was organized in 4 areas:
- Python syntax and basic modules
- Software engineering concepts with python (testing, project structure, logging, debugging...)
- One day exploring interesting 3rd party libraries: Pandas (data science), python -telegram-bot and beautifull-soup (webscrapping)
- A free project day.


text:
# Root Maven Files

This plugin show root maven files in "Projects" viewer into "Project Files"
folder like README or properties files.

![Screenshot](screenshot.jpg)

## License

See the [LICENSE](LICENSE.md) file for license rights and limitations (MIT).


text:
# RFC 913 - Simple File Transfer Protocol
 **Java**

 Eugene Fong (efon103)

 ***Markdown Formatted for Github***

 [github.com/fong/java-sftp](https://github.com/fong/java-sftp)

#### List of Working Features
 |Command|USER|ACCT|PASS|TYPE|LIST|CDIR|KILL|NAME|DONE|RETR|STOR|
 |:-----:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|
 |Client |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |
 |Server |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |

 ## Table of Contents
 1. [Introduction](#introduction)
 2. [List of Components](#list-of-components)
    1. [SFTPServer](#sftpserver)
    2. [SFTPClient](#sftpclient)
    3. [Authentication File](#authentication-file)
    4. [FTP Folder](#ftp-folder-ftp)
    5. [Restricted Folders](#restricted-folders)
3. [How to setup SFTPServer and run](#how-to-setup-sftpserver-and-run)
4. [How to setup SFTPClient and run](#how-to-setup-sftpclient-and-run)
5. [Default Configurations](#default-configurations)
6. [Command Guide](#command-guide)
    1. [USER, ACCT and PASS Commands](#user-acct-and-pass-commands)
    2. [TYPE Command](#type-command)
    3. [LIST Command](#list-command)
    4. [CDIR Command](#cdir-command)
    5. [KILL Command](#kill-command)
    6. [NAME Command](#name-command)
    7. [DONE Command](#done-command)
    8. [RETR Command](#retr-command)
    9. [STOR Command](#stor-command)
7. [Use Cases](#use-cases)
    1. [Example 1](#example-1)
    2. [Example 2](#example-2)
    3. [Example 3](#example-3)

## Introduction

This Java implementation of simple file transfer follows closely to the specification described in [RFC 913](https://tools.ietf.org/html/rfc913). It supports additional features such as restricted access folders with the use of a ```.restrict``` file containing the data of all privileged accounts of that particular folder.

## List of Components

#### SFTPServer
This is the program used to host the SFTP server. It requires two arguments to run, the designated port of the server, and the location of the authentication file (in txt format). The location of this executable will also serve as the location of the server FTP folder ```/ftp```, which will be automatically generated if it does not exist. The SFTPServer is multi-threaded and runs by each *Instance* of a socket connection. This allows multiple client connections.

#### SFTPClient
This is the client used to access the SFTP server. It requires two arguments to run, the IP address of the server to connect and the PORT of the server to connect.  The location of this executable will also serve as the location of the client FTP folder ```/ftp```, which will be automatically generated if it does not exist.

#### Authentication File
The authentication file is a text file which determines which accounts are **USER** only, **USER** and **PASSWORD**, **USER** and **ACCOUNT**, and **USER**, **PASSWORD**, and **ACCOUNT**. This may or may not match the authentication required by restricted folders.

#### FTP Folder ```/ftp```
This is the root of the FTP server. Clients cannot access directories or folders above this level to prevent manipulation of system or private files.

#### Restricted Folders
Folders in the FTP folder can be restricted with the use of a ```.restrict``` file containing all valid accounts and passwords to the folder. To access a restricted folder, the ```.restrict``` file must list both an account and password. **Note 1:** If there is no ```.restrict``` file, the folder will be available publicly. **Note 2** If there is a ```.restrict``` file with no accounts and passwords, the folder will be inaccessible by any client.

## How to setup SFTPServer and run
1. Create you authentication text file. This an be done with any text editor. The format of the text file is ```USER ACCT PASS```. Each parameter is separated by a space. If there is no parameter (i.e. no account or no password), ensure that there is still a space in between. If multiple accounts are required separate each account with a ```|```. Each user is declared on a new line. Save it as a .txt file (e.g. ```auth.txt```).

   Example of an authentication text file:
   ```
   //Do not leave comments in actual authentication file. This is just an example.
   //USER only, note the two spaces at the end of the line
   USER1

   //USER and ACCOUNT, note the last space
   USER2 ACC1

   //USER and PASSWORD, note the double space in between
   USER3  PW1

   //USER, ACCOUNT, and PASSWORD
   USER4 ACC2 PW2

   //USER, multiple ACCOUNTS, and PASSWORD.
   //Note that PASSWORD is tied to USER and not ACCOUNT (as account is used for billing purposes only).
   USER5 ACC1|ACC2|ACC3 PW3
   ```

2. Compile SFTPServer by opening the folder ```SFTPServer\src\sftpserver``` in the command prompt. Use the command ```javac *.java``` to compile to class files.
3. Place your authentication file in your ```sftpserver``` folder.
4. From the ```sftpserver``` folder, execute your SFTPServer with the command ```java -cp ../ sftpserver.SFTPServer {PORT} {AUTHENTICATION-FILE}```. For example, ```java -cp ../ sftpserver.SFTPServer 15100 auth.txt```.
5. Your SFTP server is now live. An ```/ftp``` folder will be created if there was no folder on execution.
6. Add files and Folder to the ```ftp``` directory.
7. If you would like to create a folder with restricted access, add a ```.restrict``` file to the directory you want restricted. Similar to the authentication file, this is a text file. However, the format is as follows: ```ACCOUNT PASSWORD```. Multiple accounts are separated by a ```|```. For Example, ```ACC1|ACC2 PASS```. If the client's credentials match the account/s and password, they are given access to the folder.

## How to setup SFTPClient and run
1. Compile SFTPClient by opening the folder ```SFTPClient\src\sftpclient``` in the command prompt. Use the command ```javac *.java``` to compile to class files.
2. From the ```sftpclient``` folder, execute your SFTPClient with the command ```java -cp ../ sftpclient.SFTPClient {IP} {PORT}```. For example, ```java -cp ../ sftpserver.SFTPServer localhost 15100```. If the server is not online, or unable to be connected, a ```Connection refused. Server may not be online.``` error will appear.

## Default Configurations

The included authentication text file ```auth.txt``` is as follows:

```
ONLYUSER
ONLYPASS  pw
ONLYACC acc1|acc2
ALL acc1|acc2|acc3 pw2
```
There are four users:
* USER only, with username ```ONLYUSER```
* USER and PASS, with username ```ONLYPASS``` and password ```pw```
* USER and ACC, with username ```ONLYACC``` and accounts ```acc1``` or ```acc2```
* USER, ACC and PASS, with username ```ALL```, accounts ```acc1``` or ```acc2``` or ```acc3```, and password ```pw2```

**NOTE:** to access the included Restricted Folder, it will need to match one of the account/password combinations listed.
In the included example, the ```.restrict``` file contains:
```
racct|acc2 pw2
otheracc pw3
```
Thus, there are two pairs valid, ```racct``` and ```acc2```, with a common password ```pw2```. And another account that can access the folder is the account-password pair ```someacc``` and ```pw3```.

## Command Guide:

##### **Prefix Symbol Guide**
```!```, ```+``` and ```-``` lines are server responses (with the exception of file size for ```RETR```).
```>``` indicates a command by the client.

### ***USER***, ***ACCT*** and ***PASS*** Commands

#### **Default Examples**

***User only***:

```
FTP folder: C:\Users\tofutaco\Documents\COMPSYS725\java-sftp\SFTPClient\ftp
Client connected to localhost port 11510
+Welcome to Eugene's SFTP RFC913 Server
> USER ONLYUSER
!ONLYUSER logged in
> LIST F
+
auckland.png
ChromeSetup.exe
client-20180816.txt
client.txt
CS725ASSIGNMENT1.pdf
de1-soc-user-manual.pdf
Folder
g4144.jpg
mainscreen.png
node-v8.11.1-x64.msi
Restricted Folder
test.txt

>
```

***User and Password Only***

```
FTP folder: C:\Users\tofutaco\Documents\COMPSYS725\java-sftp\SFTPClient\ftp
Client connected to localhost port 11510
+Welcome to Eugene's SFTP RFC913 Server
> USER ONLYPASS
+User-id valid, send account and password
> LIST F
-Cannot use LIST. Not logged in
> PASS pw
!Account valid, logged-in
>
```

***User and Account Only***
**Note:** If the user only has one account (e.g. USER ACC1), the user will be automatically logged in and all billing will be charged onto that one account. If the user has two or more accounts (e.g. USER ACC1|ACC2|ACC3), then the user will be prompted to pick one of the accounts.
```
FTP folder: C:\Users\tofutaco\Documents\COMPSYS725\java-sftp\SFTPClient\ftp
Client connected to localhost port 11510
+Welcome to Eugene's SFTP RFC913 Server
> USER ONLYACC
+User-id valid, send account and password
> ACCT acc2
!Account valid, logged-in
```

***User, Account, and Password***
```
FTP folder: C:\Users\tofutaco\Documents\COMPSYS725\java-sftp\SFTPClient\ftp
Client connected to localhost port 11510
+Welcome to Eugene's SFTP RFC913 Server
> USER ALL
+User-id valid, send account and password
> ACCT acc2
+Account valid, send password
> PASS pw2
!Account valid, logged-in
>
```

#### **Error Cases**
***User not found***: If a user is not found, the client is not authenticated and cannot use any commands.
```
FTP folder: C:\Users\tofutaco\Documents\COMPSYS725\java-sftp\SFTPClient\ftp
Client connected to localhost port 11510
+Welcome to Eugene's SFTP RFC913 Server
> USER
ARG ERROR: found 0 arguments, 1 needed. Command format: USER user-id
> USER FAKEUSER
-Invalid user-id, try again
> LIST F
-Cannot use LIST. Not logged in
>
```

***Account not found***: If a user is found but the account is invalid, the client is not authenticated and cannot use any commands.
```
FTP folder: C:\Users\tofutaco\Documents\COMPSYS725\java-sftp\SFTPClient\ftp
Client connected to localhost port 11510
+Welcome to Eugene's SFTP RFC913 Server
> USER ONLYACC
+User-id valid, send account
> ACCT badaccount
-Invalid account, try again
> LIST F
-Cannot use LIST. Not logged in
>
```

***Password not found***: If a user is found but the account is invalid, the client is not authenticated and cannot use any commands.
```
FTP folder: C:\Users\tofutaco\Documents\COMPSYS725\java-sftp\SFTPClient\ftp
Client connected to localhost port 11510
+Welcome to Eugene's SFTP RFC913 Server
> USER ONLYPASS
+User-id valid, send password
> PASS notpassword
-Wrong password, try again
> LIST F
-Cannot use LIST. Not logged in
>
```

### ***TYPE*** Command
#### **Default Example**
This example illustates a normal use case of the TYPE command. It can switch between ASCII (A), Binary (B), and Continuous (C).
```
FTP folder: C:\Users\tofutaco\Documents\COMPSYS725\java-sftp\SFTPClient\ftp
Client connected to localhost port 11510
+Welcome to Eugene's SFTP RFC913 Server
> USER ONLYUSER
!ONLYUSER logged in
> TYPE B
+Using Binary mode
> TYPE C
+Using Continuous mode
> TYPE A
+Using Ascii mode
```

#### **Error Cases**
This is the response from the server if the type is not A, B or C. File transfer type is not changed on the client or the server.
```
> TYPE D
-Type not valid
```

### ***LIST*** Command
#### ****Default Examples****
This is an example of the basic ```LIST F``` command, it only shows the names of the files and directories.
```
FTP folder: C:\Users\tofutaco\Documents\COMPSYS725\java-sftp\SFTPClient\ftp
Client connected to localhost port 11510
+Welcome to Eugene's SFTP RFC913 Server
> USER ONLYUSER
!ONLYUSER logged in
> LIST F
+/
client-20180816.txt
client.txt
CS725ASSIGNMENT1.pdf
Folder
g4144.jpg
mainscreen.png
Restricted Folder
test.txt

>
```

This is an example of the basic ```LIST V``` command, it shows the names and metadata of the files and directories. It also displays the file type (i.e. ASC for ASCII files, BIN for Binary files, DIR for Directories).
```
> LIST V
+
|Name                                               |R/W|Size     |Date                |Owner             |
|---------------------------------------------------|---|---------|--------------------|------------------|
|client-20180816.txt                            ASC |R/W|     4 kB|16/08/18 9:28:05 PM |tofurky\tofutaco  |
|client.txt                                     ASC |R/W|     0 kB|16/08/18 8:49:03 PM |tofurky\tofutaco  |
|CS725ASSIGNMENT1.pdf                           BIN |R/W|   115 kB|31/07/18 4:32:04 PM |tofurky\tofutaco  |
|Folder                                         DIR |R/W|     0 kB|18/08/18 11:40:18 PM|tofurky\tofutaco  |
|g4144.jpg                                      BIN |R/W|     4 kB|2/04/17 1:59:19 AM  |tofurky\tofutaco  |
|mainscreen.png                                 BIN |R/W|    13 kB|13/04/17 3:24:23 PM |tofurky\tofutaco  |
|Restricted Folder                              DIR |R/W|     4 kB|18/08/18 11:43:24 PM|tofurky\tofutaco  |
|test2.txt                                      ASC |R/W|     0 kB|8/08/18 8:02:07 PM  |tofurky\tofutaco  |
6 File(s)	 2 Dir(s)	 140kB Total File Size
```

#### **Other Cases**
***Listing other folders***: You can list other folders by adding an additional argument to the directory after the list type. This works for both ```LIST F``` and
```
> LIST F Folder
+/Folder
goodbyeworld.txt
RFC 913 - Simple File Transfer Protocol.html
```

***List and working directories***: ```LIST``` does not change the working directory of the user. This follows a similar design to ```ls``` and ```dir``` on Windows.
```
> LIST F Folder
+/Folder
Another Folder
avalon-mm.png
goodbyeworld.txt
RFC 913 - Simple File Transfer Protocol.html
todelete.txt

> LIST F
+
auckland.png
ChromeSetup.exe
client-20180816.txt
client.txt
CS725ASSIGNMENT1.pdf
de1-soc-user-manual.pdf
Folder
g4144.jpg
mainscreen.png
node-v8.11.1-x64.msi
Restricted Folder
test.txt

>
```

#### **Error Cases**

***You do not have permission to view the folder***: If the folder has ```.restrict``` file and your account is not listed, the folder is inaccessible. The client will need to ```CDIR``` to the restricted directory to be prompted with the folder's account and password.

```
> LIST F Restricted Folder
-Folder is restricted you do not have sufficient permissions to view
```

***Folder does not exist*** or ***Any other folder exception***: As per specification, an "error message from the remote systems directory command" is presented
```
> LIST F FakeFolder
-java.nio.file.NoSuchFileException: C:\Users\tofutaco\Documents\COMPSYS725\java-sftp\SFTPServer\ftp\FakeFolder
```

### ***CDIR*** Command

#### ****Default Examples****
***Unrestricted Folder***: This example illustrates a normal use case of the ```CDIR``` command. At the end of these commands, the working directory is changed, as shown by the second ```LIST F``` command.
```
FTP folder: C:\Users\tofutaco\Documents\COMPSYS725\java-sftp\SFTPClient\ftp
Client connected to localhost port 11510
+Welcome to Eugene's SFTP RFC913 Server
> USER ONLYUSER
!ONLYUSER logged in
> LIST F
+
client-20180816.txt
client.txt
CS725ASSIGNMENT1.pdf
Folder
g4144.jpg
mainscreen.png
Restricted Folder
test2.txt

> CDIR Folder
!Changed working dir to /Folder
> LIST F
+/Folder
goodbyeworld.txt
RFC 913 - Simple File Transfer Protocol.html

>
```
***Restricted Folder, account not permitted***: If the folder is restricted, the current account and password is revoked and the user will be required to enter a new account and password. Working folder directory is not changed until account and password is correct.
```
> CDIR Restricted Folder
+directory ok, send account/password
> ACCT acc2
+account ok, send password
> PASS pw2
!Changed working dir to /Restricted Folder
> LIST F
+/Restricted Folder
.restrict
auckland.PNG
mypasswords.txt
vanilla-tilt.js

>
```

***Restricted Folder, account is permitted***: If the user's account and password matches the credentials in the folder, the working directory is switched without the need to re-enter account and password.

```
> USER ACCUSR
+User-id valid, send account and password
> ACCT acc2
+Account valid, send password
> PASS pw2
!Account valid, logged-in
> CDIR Restricted Folder
!Changed working dir to /Restricted Folder
> LIST F
+/Restricted Folder
.restrict
auckland.PNG
mypasswords.txt
vanilla-tilt.js

>
```

#### **Other Cases**
To go back to the root of the FTP server, send ``CDIR`` without arguments
```
> CDIR Folder
!Changed working dir to /Folder
> LIST F
+/Folder
goodbyeworld.txt
RFC 913 - Simple File Transfer Protocol.html

> CDIR
!Changed working dir to /
>
```

To access a folder within a folder, include the folder path from the root of the FTP server.
```
> CDIR Folder/Another Folder
!Changed working dir to /Folder/Another Folder
>
```

#### **Error Cases**
***Folder does not exist***: An error is presented and the working directory does not change.
```
> CDIR Missing Folder
-Can't connect to directory because: /Missing Folder is not a directory.
>
```

### ***KILL*** Command

#### **Default Example**
This example illustrates a normal use case of the ```KILL``` command. At the end of these commands, the file todelete.txt is deleted from the system.
```
> LIST F
+/Restricted Folder
.restrict
auckland.PNG
mypasswords.txt
todelete.txt
vanilla-tilt.js

> KILL todelete.txt
+todelete.txt deleted
> LIST F
+/Restricted Folder/
.restrict
auckland.PNG
mypasswords.txt
vanilla-tilt.js

>
```

#### **Error Cases**
***File is protected***: If the file is set to read-only, the file cannot be deleted and the following response will occur.
```
+/Restricted Folder/
.restrict
auckland.PNG
mypasswords.txt
vanilla-tilt.js

> KILL auckland.png
-Not deleted because of IO error. It may be protected.
> LIST F
+/Restricted Folder/
.restrict
auckland.PNG
mypasswords.txt
vanilla-tilt.js

>
```

***File does not exist***: If the file does not exist, the following server response will occur.
```
> KILL nofile.exe
-PATH ERROR: /Restricted Folder/nofile.exe is not a file.
```

***User does not have access privileges to folder***: If the user account does not have the correct permission, the following server response will occur. To be able to delete the file, the user must use ```CDIR``` to the restricted directory and enter their usernames and passwords. If you view the folder from the system file explorer, you can see that the file has not been deleted.
```
FTP folder: C:\Users\tofutaco\Documents\COMPSYS725\java-sftp\SFTPClient\ftp
Client connected to localhost port 11510
+Welcome to Eugene's SFTP RFC913 Server
> USER ONLYUSER
!ONLYUSER logged in
> KILL Restricted Folder/vanilla-tilt.js
-Not deleted because of folder access privileges
>
```

### ***NAME*** Command
#### **Default Example**
This example illustrates a normal use case of the ```NAME``` command. At the end of these commands, the file test.txt is renamed to test2.txt within the system. This can be verified in the system file explorer by examining the contents of the text file before and after executing the ```TOBE``` command.
```
FTP folder: C:\Users\tofutaco\Documents\COMPSYS725\java-sftp\SFTPClient\ftp
Client connected to localhost port 11510
+Welcome to Eugene's SFTP RFC913 Server
> USER ONLYUSER
!ONLYUSER logged in
> LIST F
+/
client-20180816.txt
client.txt
CS725ASSIGNMENT1.pdf
Folder
g4144.jpg
jdk.exe
mainscreen.png
Restricted Folder
test.txt

> NAME test.txt
+File exists. Send TOBE <new-name> command.
> TOBE test2.txt
+test.txt renamed to test2.txt
>
```

#### **Other Cases**

***Renaming a file in another folder***: This snippet illustates the response if the file is in another folder.  At the end of these commands, the file helloworld.txt is renamed to goodbyeworld.txt within the system. This can be verified in the system file explorer by examining the contents of the text file before and after executing the ```TOBE``` command.

```
FTP folder: C:\Users\tofutaco\Documents\COMPSYS725\java-sftp\SFTPClient\ftp
Client connected to localhost port 11510
+Welcome to Eugene's SFTP RFC913 Server
> USER ONLYUSER
!ONLYUSER logged in
> NAME Folder/helloworld.txt
+File exists. Send TOBE <new-name> command.
> TOBE Folder/goodbyeworld.txt
+helloworld.txt renamed to goodbyeworld.txt
>
```

***Renaming a file with commands in between***: The ```TOBE``` command is not bound to the ```NAME``` command. If the user wants to use other commands, they can do so. For example, if the user was to change the name, but is uncertain what other files are in the folder, they can use the ```LIST``` command before using the ```TOBE``` command.
```
> NAME test2.txt
+File exists. Send TOBE <new-name> command.
> LIST F
+/
client-20180816.txt
client.txt
CS725ASSIGNMENT1.pdf
Folder
g4144.jpg
jdk.exe
mainscreen.png
Restricted Folder
test2.txt

> TOBE test.txt
+test2.txt renamed to test.txt
>
```

#### **Error Cases**
***New filename already exists***: This snippet illustrates the response from the server if the file already exists. The filename will not be changed and can be verified in the system file explorer.
```
> NAME test2.txt
+File exists. Send TOBE <new-name> command.
> TOBE test2.txt
-File wasn't renamed because it already exists.
```

***File does not exist***: This snippet illustrates the response from the server if the file does not exist.
```
> NAME notarealfile.txt
-PATH ERROR: //notarealfile.txt is not a file.
```

***File has restricted access***:  This snippet illustrates the response from the server the client does not have permissions to change files in the folder. The filename will not be changed.
```
> NAME Restricted Folder/mypasswords.txt
-File has resticted access //Restricted Folder/mypasswords.txt
```

### ***DONE*** Command
#### ****Default Examples****
***No bandwidth used***: Done is used to signal the server that the client is closing down the connection. Both client and server close the socket, and the thread on the server stops. This frees up system resources such as CPU and Memory for other clients to use.
```
FTP folder: C:\Users\tofutaco\Documents\COMPSYS725\java-sftp\SFTPClient\ftp
Client connected to localhost port 11510
+Welcome to Eugene's SFTP RFC913 Server
> USER ONLYUSER
!ONLYUSER logged in
> DONE
+Closing connection. A total of 0kB was transferred.
```

***Bandwidth used***: If the user has done any file transfers (either uploading or downloading) it is recorded and displayed when the user uses the ```DONE``` command. This can be modified later to include account billing.
```
FTP folder: C:\Users\tofutaco\Documents\COMPSYS725\java-sftp\SFTPClient\ftp
Client connected to localhost port 11510
+Welcome to Eugene's SFTP RFC913 Server
> USER ONLYUSER
!ONLYUSER logged in
> RETR test.txt
File Size:  39
Use SEND to retrieve file or STOP to cancel.
> SEND
> TYPE B
+Using Binary mode
> RETR mainscreen.png
File Size:  13380
Use SEND to retrieve file or STOP to cancel.
> SEND
> RETR g4144.jpg
File Size:  4245
Use SEND to retrieve file or STOP to cancel.
> SEND
> DONE
+Closing connection. A total of 17kB was transferred.
```

### ***RETR*** Command

```RETR``` commands do not support automatic type swtiching. This is because the server has no method in changing the ```TYPE``` on the client. The server checks the file type and if the current type does not match, it will notify the client that the type does not match. If the type is changed successfully, it will send the file. If the type fails to change, the ```STOR``` command is cancelled.

#### **Default Example**
This example illustates the file ```test.txt``` being transfer from the server to the client. When the ```STOP``` command is sent, the server response with an abort response and the ```RETR``` process is cancelled. This can be demonstrated by using the command ```SEND```, which returns an error. The file can then be retrieved by using the ```RETR {file}``` command, followed by the ```SEND``` command. Once the correct procedure is executed, the file will be retrieved from the server and placed in the client's ```/ftp``` folder.
```
FTP folder: C:\Users\tofutaco\Documents\COMPSYS725\java-sftp\SFTPClient\ftp
Client connected to localhost port 11510
+Welcome to Eugene's SFTP RFC913 Server
> USER ONLYUSER
!ONLYUSER logged in
> RETR test.txt
File Size:  27
Use SEND to retrieve file or STOP to cancel.
> STOP
+ok, RETR aborted
> SEND
Nothing to send.
> RETR test.txt
File Size:  27
Use SEND to retrieve file or STOP to cancel.
> SEND
File test.txt was saved.
>
```

#### **Other Cases**
***This file to retrieve has a different type to the current transmission type***: If the file type does not match the current file transfer type (e.g. file to retrieve is binary, but current mode is ASCII), the server will notify the client that the file type does not match. The ```RETR``` command is cancelled (as demonstrated by a failed ```SEND``` command) and the type must be changed before the file can be retrieved.
```
FTP folder: C:\Users\tofutaco\Documents\COMPSYS725\java-sftp\SFTPClient\ftp
Client connected to localhost port 11510
+Welcome to Eugene's SFTP RFC913 Server
> USER ONLYUSER
!ONLYUSER logged in
> RETR mainscreen.png
-File is Binary. Current TYPE is A. Please switch to B or C
> SEND
Nothing to send.
> TYPE B
+Using Binary mode
> RETR mainscreen.png
File Size:  13380
Use SEND to retrieve file or STOP to cancel.
> SEND
File mainscreen.png was saved.
>
```

***The file has taken too long to transfer***: If the file takes too long to transfer, the process will time out and the transfer will be cancelled. This timeout is calculated by ```(filesize/8 + 8)/60``` seconds.

```
> SEND
Transfer taking too long. Timed out after 5 seconds.
>
```

### ***STOR*** Command

**Note:** Client automatically changes file type and size according to server response. If a third-party client does not support automatic sending, the server treats the commands like manual commands.

#### ****Default Examples****

All ```STOR``` commands support automatic type swtiching. The client checks the file type and if the current type does not match, it will automatically send a ```TYPE``` request. If the type is changed successfully, it will send the file. If the type fails to change, the ```STOR``` command is cancelled.

***Store with new generations***: This example illustates the file ```avalon-mm.png``` being transfer the first time without an existing file. The subsequent additions of ```avalon-mm.png``` create new file generations, based on the format *YYYYMMddHHmmss* (Year, Month, Day, Hour, Seconds). You can verify each stage with the use of ```LIST F``` or ```LIST V```.
```
FTP folder: C:\Users\tofutaco\Documents\COMPSYS725\java-sftp\SFTPClient\ftp
Client connected to localhost port 11510
+Welcome to Eugene's SFTP RFC913 Server
> USER ONLYUSER
!ONLYUSER logged in
> CDIR Folder
!Changed working dir to /Folder
> STOR NEW avalon-mm.png
+Using Binary mode
+File does not exist, will create new file. Sending SIZE 30073
+ok, waiting for file
+Saved /avalon-mm.png
> LIST F
+/Folder/
Another Folder
avalon-mm.png
goodbyeworld.txt
RFC 913 - Simple File Transfer Protocol.html

> STOR NEW avalon-mm.png
+Using Binary mode
+File exists, will create new generation of file. Sending SIZE 30073
+ok, waiting for file
+Saved /avalon-mm-20180819023951.png
> STOR NEW avalon-mm.png
+File exists, will create new generation of file. Sending SIZE 30073
+ok, waiting for file
+Saved /avalon-mm-20180819024005.png
> LIST F
+/Folder/
Another Folder
avalon-mm-20180819023951.png
avalon-mm-20180819024005.png
avalon-mm.png
goodbyeworld.txt
RFC 913 - Simple File Transfer Protocol.html

>
```

***Store with overwrite previous***: This example illustates the file ```auckland.png``` being transfer the first time without an existing file. The subsequent transferral of a modified ```auckland.png``` will overwrite the previous file. You can verify each stage with the use of ```LIST V``` by observing the change in file size. Alternatively, you can examine the file changes in the system file explorer.
```
FTP folder: C:\Users\tofutaco\Documents\COMPSYS725\java-sftp\SFTPClient\ftp
Client connected to localhost port 11510
+Welcome to Eugene's SFTP RFC913 Server
> USER ONLYUSER
!ONLYUSER logged in
> STOR OLD auckland.png
+Using Binary mode
+Will create new file. Sending SIZE 25862
+ok, waiting for file
+Saved /auckland.png
> LIST V
+/
|Name                                               |R/W|Size     |Date                |Owner             |
|---------------------------------------------------|---|---------|--------------------|------------------|
|auckland.png                                   BIN |R/W|    25 kB|19/08/18 3:35:39 PM |tofurky\tofutaco  |
|client-20180816.txt                            ASC |R/W|     4 kB|16/08/18 9:28:05 PM |tofurky\tofutaco  |
|client.txt                                     ASC |R/W|     0 kB|16/08/18 8:49:03 PM |tofurky\tofutaco  |
|CS725ASSIGNMENT1.pdf                           BIN |R/W|   115 kB|31/07/18 4:32:04 PM |tofurky\tofutaco  |
|Folder                                         DIR |R/W|     4 kB|19/08/18 3:32:00 PM |tofurky\tofutaco  |
|g4144.jpg                                      BIN |R/W|     4 kB|2/04/17 1:59:19 AM  |tofurky\tofutaco  |
|mainscreen.png                                 BIN |R/W|    13 kB|13/04/17 3:24:23 PM |tofurky\tofutaco  |
|node-v8.11.1-x64.msi                           BIN |R/W| 16662 kB|17/04/18 12:45:11 AM|tofurky\tofutaco  |
|Restricted Folder                              DIR |R/W|     4 kB|19/08/18 12:54:33 AM|tofurky\tofutaco  |
|test.txt                                       ASC |R/W|     0 kB|8/08/18 8:02:07 PM  |tofurky\tofutaco  |
8 File(s)	 2 Dir(s)	 16836kB Total File Size

> STOR OLD auckland.png
+Will write over old file. Sending SIZE 36540
+ok, waiting for file
+Saved /auckland.png
> LIST V
+/
|Name                                               |R/W|Size     |Date                |Owner             |
|---------------------------------------------------|---|---------|--------------------|------------------|
|auckland.png                                   BIN |R/W|    36 kB|19/08/18 3:40:43 PM |tofurky\tofutaco  |
|client-20180816.txt                            ASC |R/W|     4 kB|16/08/18 9:28:05 PM |tofurky\tofutaco  |
|client.txt                                     ASC |R/W|     0 kB|16/08/18 8:49:03 PM |tofurky\tofutaco  |
|CS725ASSIGNMENT1.pdf                           BIN |R/W|   115 kB|31/07/18 4:32:04 PM |tofurky\tofutaco  |
|Folder                                         DIR |R/W|     4 kB|19/08/18 3:32:00 PM |tofurky\tofutaco  |
|g4144.jpg                                      BIN |R/W|     4 kB|2/04/17 1:59:19 AM  |tofurky\tofutaco  |
|mainscreen.png                                 BIN |R/W|    13 kB|13/04/17 3:24:23 PM |tofurky\tofutaco  |
|node-v8.11.1-x64.msi                           BIN |R/W| 16662 kB|17/04/18 12:45:11 AM|tofurky\tofutaco  |
|Restricted Folder                              DIR |R/W|     4 kB|19/08/18 12:54:33 AM|tofurky\tofutaco  |
|test.txt                                       ASC |R/W|     0 kB|8/08/18 8:02:07 PM  |tofurky\tofutaco  |
8 File(s)	 2 Dir(s)	 16836kB Total File Size

>
```
***Store with appending***:  This example illustates the file ```test.txt``` being transfer the first time without an existing file. The subsequent transferral of a modified ```test.txt``` will append to the the previous file. You can verify each stage with the use of ```LIST V``` by observing the change in file size and/or last modified date. You can also examine the contents of file appendages by opening the file in the system file explorer.

```
> LIST V
+/
|Name                                               |R/W|Size     |Date                |Owner             |
|---------------------------------------------------|---|---------|--------------------|------------------|
|auckland.png                                   BIN |R/W|    36 kB|19/08/18 3:40:43 PM |tofurky\tofutaco  |
|client-20180816.txt                            ASC |R/W|     4 kB|16/08/18 9:28:05 PM |tofurky\tofutaco  |
|client.txt                                     ASC |R/W|     0 kB|16/08/18 8:49:03 PM |tofurky\tofutaco  |
|CS725ASSIGNMENT1.pdf                           BIN |R/W|   115 kB|31/07/18 4:32:04 PM |tofurky\tofutaco  |
|Folder                                         DIR |R/W|     4 kB|19/08/18 4:18:48 PM |tofurky\tofutaco  |
|g4144.jpg                                      BIN |R/W|     4 kB|2/04/17 1:59:19 AM  |tofurky\tofutaco  |
|mainscreen.png                                 BIN |R/W|    13 kB|13/04/17 3:24:23 PM |tofurky\tofutaco  |
|node-v8.11.1-x64.msi                           BIN |R/W| 16662 kB|17/04/18 12:45:11 AM|tofurky\tofutaco  |
|Restricted Folder                              DIR |R/W|     4 kB|19/08/18 12:54:33 AM|tofurky\tofutaco  |
7 File(s)	 2 Dir(s)	 16836kB Total File Size

> STOR APP test.txt
-File is ASCII. Current TYPE is B or C. Please switch to A
+Using Ascii mode
+Will create file. Sending SIZE 39
+ok, waiting for file
+Saved /test.txt
> LIST V
+/
|Name                                               |R/W|Size     |Date                |Owner             |
|---------------------------------------------------|---|---------|--------------------|------------------|
|auckland.png                                   BIN |R/W|    36 kB|19/08/18 3:40:43 PM |tofurky\tofutaco  |
|client-20180816.txt                            ASC |R/W|     4 kB|16/08/18 9:28:05 PM |tofurky\tofutaco  |
|client.txt                                     ASC |R/W|     0 kB|16/08/18 8:49:03 PM |tofurky\tofutaco  |
|CS725ASSIGNMENT1.pdf                           BIN |R/W|   115 kB|31/07/18 4:32:04 PM |tofurky\tofutaco  |
|Folder                                         DIR |R/W|     4 kB|19/08/18 4:18:48 PM |tofurky\tofutaco  |
|g4144.jpg                                      BIN |R/W|     4 kB|2/04/17 1:59:19 AM  |tofurky\tofutaco  |
|mainscreen.png                                 BIN |R/W|    13 kB|13/04/17 3:24:23 PM |tofurky\tofutaco  |
|node-v8.11.1-x64.msi                           BIN |R/W| 16662 kB|17/04/18 12:45:11 AM|tofurky\tofutaco  |
|Restricted Folder                              DIR |R/W|     4 kB|19/08/18 12:54:33 AM|tofurky\tofutaco  |
|test.txt                                       ASC |R/W|     0 kB|19/08/18 4:30:41 PM |tofurky\tofutaco  |
8 File(s)	 2 Dir(s)	 16836kB Total File Size

> STOR APP test.txt
+Will append to file. Sending SIZE 68
+ok, waiting for file
+Saved /test.txt
> LIST V
+/
|Name                                               |R/W|Size     |Date                |Owner             |
|---------------------------------------------------|---|---------|--------------------|------------------|
|auckland.png                                   BIN |R/W|    36 kB|19/08/18 3:40:43 PM |tofurky\tofutaco  |
|client-20180816.txt                            ASC |R/W|     4 kB|16/08/18 9:28:05 PM |tofurky\tofutaco  |
|client.txt                                     ASC |R/W|     0 kB|16/08/18 8:49:03 PM |tofurky\tofutaco  |
|CS725ASSIGNMENT1.pdf                           BIN |R/W|   115 kB|31/07/18 4:32:04 PM |tofurky\tofutaco  |
|Folder                                         DIR |R/W|     4 kB|19/08/18 4:18:48 PM |tofurky\tofutaco  |
|g4144.jpg                                      BIN |R/W|     4 kB|2/04/17 1:59:19 AM  |tofurky\tofutaco  |
|mainscreen.png                                 BIN |R/W|    13 kB|13/04/17 3:24:23 PM |tofurky\tofutaco  |
|node-v8.11.1-x64.msi                           BIN |R/W| 16662 kB|17/04/18 12:45:11 AM|tofurky\tofutaco  |
|Restricted Folder                              DIR |R/W|     4 kB|19/08/18 12:54:33 AM|tofurky\tofutaco  |
|test.txt                                       ASC |R/W|     1 kB|19/08/18 4:31:22 PM |tofurky\tofutaco  |
8 File(s)	 2 Dir(s)	 16837kB Total File Size

>
```

#### **Other Cases**

***No file found***: If file is not found on the client, it will produce this error and cancel the STOR operation.

```
> STOR NEW filethatdoesntexist.txt
No file 'filethatdoesntexist.txt' found in C:\Users\tofutaco\Documents\COMPSYS725\java-sftp\SFTPClient\ftp
```

***The file has taken too long to transfer***: If the file takes too long to transfer, the process will time out and the transfer will be cancelled. This timeout is calculated by ```(filesize/8 + 8)/60``` seconds.

## Use Cases

#### ***Example 1***
*Commands Used:* ```USER PASS LIST TYPE RETR SEND DONE```

Retrieve the file ```avalon-mm.png``` file from server. This example is equivalent to the example presented on page 13 of the [RFC 913 specification](https://tools.ietf.org/html/rfc913).

```
FTP folder: C:\Users\tofutaco\Documents\COMPSYS725\java-sftp\SFTPClient\ftp
Client connected to localhost port 11510
+Welcome to Eugene's SFTP RFC913 Server
> USER ONLYPASS
+User-id valid, send password
> PASS pw
!Account valid, logged-in
> LIST F Folder
+/Folder
Another Folder
avalon-mm.png
goodbyeworld.txt
RFC 913 - Simple File Transfer Protocol.html
todelete.txt

> LIST V Folder
+/Folder
|Name                                               |R/W|Size     |Date                |Owner             |
|---------------------------------------------------|---|---------|--------------------|------------------|
|Another Folder                                 DIR |R/W|     0 kB|19/08/18 12:38:11 AM|tofurky\tofutaco  |
|avalon-mm.png                                  BIN |R/W|    30 kB|19/08/18 2:33:19 AM |tofurky\tofutaco  |
|goodbyeworld.txt                               ASC |R/W|     0 kB|8/08/18 9:36:20 PM  |tofurky\tofutaco  |
|RFC 913 - Simple File Transfer Protocol.html   ASC |R/W|    33 kB|9/08/18 12:14:08 AM |tofurky\tofutaco  |
|todelete.txt                                   ASC |R/W|     0 kB|13/08/18 12:02:55 AM|tofurky\tofutaco  |
4 File(s)	 1 Dir(s)	 63kB Total File Size

> RETR avalon-mm.png
-PATH ERROR: /avalon-mm.png is not a file.
> RETR Folder/avalon-mm.png
-File is Binary. Current TYPE is A. Please switch to B or C
> TYPE B
+Using Binary mode
> RETR Folder/avalon-mm.png
File Size:  30073
Use SEND to retrieve file or STOP to cancel.
> SEND
File avalon-mm.png was saved.
> DONE
+Closing connection. A total of 30kB was transferred.
```

#### ***Example 2***
*Commands Used:* ```USER ACCT LIST RETR SEND STOR LIST DONE```

This example covers the retrieval and store commands. At the start, the client has the ```client.txt``` and the server has the ```server.txt``` file. By the end of the transactions, both the client and server will have both text files. Note that since the text files are under 1kB, the billing is 0 (as it is measure per kilobyte).
```
FTP folder: C:\Users\tofutaco\Documents\COMPSYS725\java-sftp\SFTPClient\ftp
Client connected to localhost port 11510
+Welcome to Eugene's SFTP RFC913 Server
> USER ONLYACC
+User-id valid, send account
> ACCT acc2
!Account valid, logged-in
> LIST F
+
ChromeSetup.exe
CS725ASSIGNMENT1.pdf
de1-soc-user-manual.pdf
Folder
g4144.jpg
mainscreen.png
node-v8.11.1-x64.msi
Restricted Folder
server.txt

> RETR server.txt
File Size:  34
Use SEND to retrieve file or STOP to cancel.
> SEND
File server.txt was saved.
> STOR client.txt
ARG ERROR: Not enough arguments. STOR { NEW | OLD | APP } <new-filename> required
> STOR NEW client.txt
+File does not exist, will create new file. Sending SIZE 33
+ok, waiting for file
+Saved /client.txt
> LIST V
+/
|Name                                               |R/W|Size     |Date                |Owner             |
|---------------------------------------------------|---|---------|--------------------|------------------|
|ChromeSetup.exe                                BIN |R/W|  1065 kB|29/09/16 9:31:22 PM |tofurky\tofutaco  |
|client.txt                                     ASC |R/W|     0 kB|20/08/18 12:31:48 AM|tofurky\tofutaco  |
|CS725ASSIGNMENT1.pdf                           BIN |R/W|   115 kB|31/07/18 4:32:04 PM |tofurky\tofutaco  |
|de1-soc-user-manual.pdf                        BIN |R/W|  6635 kB|19/04/18 11:31:43 PM|tofurky\tofutaco  |
|Folder                                         DIR |R/W|     4 kB|19/08/18 4:18:48 PM |tofurky\tofutaco  |
|g4144.jpg                                      BIN |R/W|     4 kB|2/04/17 1:59:19 AM  |tofurky\tofutaco  |
|mainscreen.png                                 BIN |R/W|    13 kB|13/04/17 3:24:23 PM |tofurky\tofutaco  |
|node-v8.11.1-x64.msi                           BIN |R/W| 16662 kB|17/04/18 12:45:11 AM|tofurky\tofutaco  |
|Restricted Folder                              DIR |R/W|     4 kB|19/08/18 12:54:33 AM|tofurky\tofutaco  |
|server.txt                                     ASC |R/W|     0 kB|20/08/18 12:29:29 AM|tofurky\tofutaco  |
8 File(s)	 2 Dir(s)	 24496kB Total File Size

> DONE
+Closing connection. A total of 0kB was transferred.
```

#### ***Example 3***
*Commands Used:* ```USER ACCT PASS LIST CDIR NAME TOBE KILL LIST DONE```

Here, a user with the correct credentials access a restricted folder via the ```CDIR``` command. This example covers the ```NAME``` and ```TOBE``` commands. After renaming the file, the file is removed from the server with the command ```KILL```. Each step is verified with the use of the ```LIST F``` command.
```
FTP folder: C:\Users\tofutaco\Documents\COMPSYS725\java-sftp\SFTPClient\ftp
Client connected to localhost port 11510
+Welcome to Eugene's SFTP RFC913 Server
> USER ALL
+User-id valid, send account and password
> ACCT acc2
+Account valid, send password
> PASS pw2
!Account valid, logged-in
> LIST F
+
ChromeSetup.exe
client.txt
CS725ASSIGNMENT1.pdf
de1-soc-user-manual.pdf
Folder
g4144.jpg
mainscreen.png
node-v8.11.1-x64.msi
Restricted Folder
server.txt

> CDIR Restricted Folder
!Changed working dir to /Restricted Folder
> LIST F
+/Restricted Folder
.restrict
auckland.PNG
mypasswords.txt
vanilla-tilt.js

> NAME mypasswords.txt
+File exists. Send TOBE <new-name> command.
> TOBE passwords-to-delete.txt
+mypasswords.txt renamed to passwords-to-delete.txt
> LIST F
+/Restricted Folder/
.restrict
auckland.PNG
passwords-to-delete.txt
vanilla-tilt.js

> KILL passwords-to-delete.txt
+passwords-to-delete.txt deleted
> LIST F
+/Restricted Folder/
.restrict
auckland.PNG
vanilla-tilt.js

> DONE
+Closing connection. A total of 0kB was transferred.
```

repository: fong/java-sftp

gha_language: Java

repo_name: fong/java-sftp


text:
---
layout: default
---

# 1997-01-26 - Re: overview.htm (fwd)

## Header Data

From: Toto<EMAIL_ADDRESS>To<EMAIL_ADDRESS>Message Hash: d818b354f1582bb2c4540b9b0e0a384cf7230c6272fedc0e1765341733afc8cc

Message ID<EMAIL_ADDRESS>Reply To<EMAIL_ADDRESS>UTC Datetime: 1997-01-26 07:45:38 UTC

Raw Date: Sat, 25 Jan 1997 23:45:38 -0800 (PST)

## Raw message

```
{% raw  %}From: Toto<EMAIL_ADDRESS>Date: Sat, 25 Jan 1997 23:45:38 -0800 (PST)
To<EMAIL_ADDRESS>Subject: Re: overview.htm (fwd)
In-Reply-To<EMAIL_ADDRESS>Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

Dale Thorn wrote:
> Igor Chudov @ home wrote:
>
> > Dale's hypothesis seems at odds with the linkage of aids and blood
> > transfusion and transmission through needles.
> > Nurses who contract aids through contaminated needles do not,
> > normally, have devastated immune systems.

> It seems to me that "proof" of someone acquiring AIDS from one stab
> with a contaminated needle is a very nebulous thing. As far as nurses
> go, the contact I've had with many of them tells me they are also
> (on average) drug users extraordinaire.

  Nurses have free access to all types of antibiotics and high-inducing
drugs, and a good many of them are regular users of both.
  Hospitals are notoriously bad places for healthy people to go, as many
go in with little diseases and come out with big diseases (for which
they are often re-hospitalized).
  Also, outward appearances rarely have a whole lot to do with
indications
of a superior auto-immune system. Plants have been bred to 'look pretty'
for the consumer, so we now have unblemished food stuffs which require
huge applications of poisonous chemicals in order to survive, because
they have lost their natural ability to defend themselves against even
ordinary plant pests and diseases.

Toto

{% endraw %}
```

## Thread

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

+ Return to "[Dale Thorn <dthorn@gte.net>](/authors/dale_thorn_dthorn_at_gte_net_)"
+ Return to<EMAIL_ADDRESS>(Igor Chudov @ home)](/authors/ichudov_at_algebra_com_igor_chudov__at__home_)"
+ Return to "[Toto <toto@sk.sympatico.ca>](/authors/toto_toto_at_sk_sympatico_ca_)"

+ 1997-01-26 (Sat, 25 Jan 1997 19:41:03 -0800 (PST)) - [Re: overview.htm (fwd)](/archive/1997/01/1193ff6cc2f0da871b87b9343bc1acdab8fd2d840839d1d49d3346dd76c44a0c) - _Dale Thorn<EMAIL_ADDRESS>  + 1997-01-26 (Sat, 25 Jan 1997 21:14:55 -0800 (PST)) - [Re: overview.htm (fwd)](/archive/1997/01/6ce412d3394239caaece155e2648e7e954b7960d3b19efdbc3f907180e798c5e) -<EMAIL_ADDRESS>(Igor Chudov @ home)_
    + 1997-01-26 (Sat, 25 Jan 1997 21:35:26 -0800 (PST)) - [Re: overview.htm (fwd)](/archive/1997/01/37de072030d90d1e8c7587a55502af0883827122cebc93e2b51646fdb89b03b7) -<EMAIL_ADDRESS>(Igor Chudov @ home)_
      + 1997-01-26 (Sat, 25 Jan 1997 22:09:19 -0800 (PST)) - [Re: overview.htm (fwd)](/archive/1997/01/81da428f571b9d69c48e898c243fbc028a94bc7744d0f9d7a38da86be40a1696) - _Dale Thorn<EMAIL_ADDRESS>      + 1997-01-26 (Sat, 25 Jan 1997 23:45:38 -0800 (PST)) - Re: overview.htm (fwd) - _Toto<EMAIL_ADDRESS>    + 1997-01-26 (Sat, 25 Jan 1997 21:48:19 -0800 (PST)) - [Re: overview.htm (fwd)](/archive/1997/01/71bed5f3fd14d8c5f3d10dcb029eb3feb4c84cf749ce61a2e3686079aa4ade1b) - _Dale Thorn<EMAIL_ADDRESS>      + 1997-01-26 (Sat, 25 Jan 1997 22:03:41 -0800 (PST)) - [Re: overview.htm (fwd)](/archive/1997/01/24234cc430f993df76f67b2b195547ea27260ca1402424f4f483dea480ac8df7) -<EMAIL_ADDRESS>(Igor Chudov @ home)_
        + 1997-01-26 (Sat, 25 Jan 1997 22:30:45 -0800 (PST)) - [Re: overview.htm (fwd)](/archive/1997/01/a494fef5bec7d13063ac0888ecf23a96037e212d43dcf3efc4cb361167de2c8a) - _Dale Thorn<EMAIL_ADDRESS>    + 1997-01-26 (Sat, 25 Jan 1997 23:45:34 -0800 (PST)) - [Re: overview.htm (fwd)](/archive/1997/01/3f2b673ac64e5d8ac804112b01d3c9d35882338ee599bca1bc87d7116b051ffa) - _Toto<EMAIL_ADDRESS>


text:
# workshops-spark_intro
Introductory workshops for beginners in Apache Spark with Python (pyspark) and SQL (Spark SQL). Repository includes IPYNB notebooks and data.

__Note:__ file paths in notebooks will require updating

## I - Intro
Covers some core concepts using Spark for data analysis including:
* Loading data
* Spark SQL & basic data transformations
* Writing data
* Caching data for performance

## II - Tidy Data
Demonstrates the concept of "Tidy Data" using example code in Apache Spark and tidying five common types of untidy data:
* Column headers are values, not variable names.
* Multiple variables are stored in one column.
* Variables are stored in both rows and columns.
* Multiple types of observational units are stored in the same table.
* A single observational unit is stored in multiple tables.


text:
# lups-linux
This small script attempts to use `smbclient` to reach print services at Liberty
University. We use Pharos here, but the script doesn't know anything about that;
it just connects through Samba.

Much of the code comes from the university's macOS [printer install package](https://www.liberty.edu/informationservices/index.cfm?PID=30889#!KB0011132), and the
`smbclient` backend comes from a fellow named [Willem van
Engen](http://willem.engen.nl/).

Note that the script does not use an `authfile`, as Engen does. I prefer to
leave credential management to the GNOME Keyring.

## Supported Distributions
Fedora has been assumed, but cross-distribution support will come soon.

repository: npjg/lups-linux

repo_name: npjg/lups-linux


text:
# Neo4j Bolt Driver for Julia

Neo4jBolt.jl is a Julia port of the official [Neo4j Driver (1.7)](https://github.com/neo4j/neo4j-python-driver/tree/1.7). It supports Neo4j 3.0 and above using the fast binary Bolt protocal. The Bolt driver is designed to be much faster than the HTTP REST based driver.

## Todo

Encrypted SSL connections and cluster routing have not yet been implemented in this version.

## Getting Started with Neo4j

* [Introduction (The Neo4j Operations Manual v3.5)](https://neo4j.com/docs/operations-manual/current/introduction/)
* [Installation (The Neo4j Operations Manual v3.5)](https://neo4j.com/docs/operations-manual/current/installation/)

## Quick Examples

Here are a few usage examples. For a more extensive collection of examples see the integration tests in the test/integration directory of this repository.

### Run Cypher Statement

```julia
using Neo4jBolt

driver = Neo4jBoltDriver("bolt://localhost:7687", auth=("neo4j", "password"))

session(driver) do sess
    result = run(sess, "UNWIND(RANGE(1, 10)) AS z RETURN z")
    for record in result
        println(record["z"])
    end
end
```

### Run Simple Transaction

```julia
using Neo4jBolt

driver = Neo4jBoltDriver("bolt://localhost:7687", auth=("neo4j", "password"))

session(driver) do sess
    begin_transaction(sess) do tx
        result = run(tx, "CREATE (a:Person {name:'Alice'}) RETURN a")
        v = value(single(result))
        println(v.labels == Set(["Person"]))
        println(v.properties == Dict("name"=>"Alice"))
    end
end
```

### Unit of Work transactions

```julia
using Neo4jBolt

driver = Neo4jBoltDriver("bolt://localhost:7687", auth=("neo4j", "password"))

function add_friend(tx, args, kwargs)
    run(tx, "MERGE (a:Person {name: \$name}) " *
            "MERGE (a)-[:KNOWS]->(friend:Person {name: \$friend_name})", name=args[1], friend_name=args[2])
end

function print_friends(tx, args, kwargs)
    for record in run(tx, "MATCH (a:Person)-[:KNOWS]->(friend) WHERE a.name = \$name " *
                          "RETURN friend.name ORDER BY friend.name", name=args[1])
        println(record["friend.name"])
    end
end

session(driver) do sess
    write_transaction(sess, add_friend, "Arthur", "Guinevere")
    write_transaction(sess, add_friend, "Arthur", "Lancelot")
    write_transaction(sess, add_friend, "Arthur", "Merlin")
    read_transaction(sess, print_friends, "Arthur")
end
```

## Implementation Details

### Dates and Times

By default Neo4j Date, Time and Duration types are returned as Julia Date, Time, DateTime, ZonedDateTime or Dates.CompoundPeriod types where appropriate. However, Julia Dates and Neo4j Dates are slightly incompatible. Specifically, Julia DateTimes do not support nanosecond time. Julia Times do not support TimeZones. Also Julia's TimeZone system is not entirely compatible with Neo4j's. As a workaround to these incompatibilities, you can choose to use the provided DateWrapper, TimeWrapper, DateTimeWrapper and DurationWrapper types instead. These wrap Neo4j's native representations in Julia struct types. To return these wrapper types from a query set `use_julia_dates=false` as a keyword argument to the `run` method.

```julia
# Here a ZonedDateTime is returned but the nanosecods are truncated

session(tc.driver) do sess
      result = run(sess,"RETURN datetime('1976-06-13T12:34:56.789012345[Europe/London]')")
      v = value(single(result))
      @test isa(v, ZonedDateTime)
      @test v == ZonedDateTime(DateTime(1976, 6, 13, 12, 34, 56, 789), tz"Europe/London")
end

# Here a DateTimeWrapper is returned and nanosecods are not truncated

session(tc.driver) do sess
      result = run(sess, "RETURN datetime('1976-06-13T12:34:56.789012345[Europe/London]')", use_julia_dates=false)
      v = value(single(result))
      @test isa(v, DateTimeWrapper)
      @test v == DateTimeWrapper(1976, 6, 13, 12, 34, 56, 789012345, timezone="Europe/London")
end
```

gha_language: Julia