text:
---
# Title, summary, and page position.
linktitle: C++
summary: Workshop of C++
weight: 0
icon: book
icon_pack: fas

# Page metadata.
title: Welcome to C++ Workshop
date: "2018-09-09T00:00:00Z"
type: book  # Do not modify.
---

Thank you for visiting The C++ Workshop! Before we get started we just need to explain some of the unique features of the course, and run through installation and setup for your local environment.

As you work through the material, you'll notice that all practical hands-on elements in the course (which we call exercises and activities) start by walking through a step-by-step reference implementation. We recommend that you try to follow the step-by-step instructions for each practical task.

Taking this approach helps hack your brain, building and reinforcing your learning. It helps with embedding core concepts so that they stick with you for the years ahead. This is also why you'll periodically come across knowledge-check events in the form of informal quizzes. They're not graded and there is zero pressure; they're just there to help you benchmark and lock-in what you've worked through over the duration of the course.

If you find yourself getting a lot of summary questions incorrect, it's worth stepping back, taking a break and revisiting a section another time. This fits in with a general rule; don't be too hard on yourself! Learning is not an instantaneous process, and is best conducted in chunks over a longer period of time. We've structured the course so that you can dip in and out to meet your needs, with quizzes and exercises acting as useful self-diagnostic tools.
Activities and Exercises

## Activities and Exercises

One last thing we should mention is the difference between exercises and activities. Exercises are completely end-to-end and step-by-step.

Activities start off the same as exercises, but leave you with open-ended expansion points for self-study and exploration. It's absolutely worth stepping back and spending some time on extending activities. The process helps to extend your frame of reference and apply your own creative input to what you've just learned, further embedding your new skills. Just in case you run into some roadblocks, at the end of the course you'll still find reference solutions for all activities.

With the methodology of the course out of the way, let's move on to installation and setup!

There are many tools we can use to compile our C++ programs, too many to cover here, so here are some recommendations and a guide on getting started:

## Online Compilers

**cpp.sh** is an online C++ compiler and the one the authors extensively used in this course. Visit [cpp.sh](http://cpp.sh/) and ensure the options are set up as shown:

- Standard: C++14
- Warnings: Many (-Wall)
- Optimization level: Full
- Standard Input: Interactive

That is all we need to do to get started using this compiler. Simply write out your code and hit the run button. Any errors will appear in the compilation tab, and interactive standard input and output will be located on the execution tab. Here is a partial list of online C++ compilers you can use while working on the exercises. If the one you are using becomes sluggish, or you can't find it at all, try another:

**Tutorialspoint C++ compiler**: This [website](https://www.tutorialspoint.com/compile_cpp_online.php) allows you to compile a C++ program contained in a single file. It prints error messages from the operating system.

**godbolt compiler explorer**: This [website](https://godbolt.org/) allows you to compile a single file on many different compilers and shows the output assembly language; its UI is a little subtle for some tastes. It prints error messages from the operating system.

**coliru**: This [website](http://coliru.stacked-crooked.com/) allows you to compile a single file. It prints error messages from the operating system.

**repl.it**: This [website](https://repl.it/languages/cpp) allows you to compile multiple files.

**Rextester**: This website lets you compile a single file using Microsoft Visual C++.

## Installing the Code Bundle

Download the code files from GitHub and place them in a new folder called **C:\Code**. Refer to these code files for the complete code bundle.

repository: akadstudy/AcademicBook

repo_name: akadstudy/AcademicBook


text:
# General Information:

Here the word “he” refers to Paul. Cenchreae was a seaport that was part of the greater Corinth city area. (See: [[translate-names]])

license: MIT

repository: mandolyte/uw-obsidian

branch_name: refs/heads/main

extension: md

license_type: permissive

repo_name: mandolyte/uw-obsidian


text:
# Redesigning the website Eudoxos
   **Collaborator**: Stavroula Iatropoulou https://github.com/stavIatrop

  ## Small demo (in Greek)
  Live http version of the webapp: http://ec2-18-191-155-232.us-east-2.compute.amazonaws.com/index.php (**Firefox** is the suggested browser due to padding issues with Chrome)

  **Disclaimer: This is not an official webapp and it was made as a small project. There are many issues, mainly concerning security and browser compatibility.**

  You can register as a publisher or a student or you can use the following default accounts:
  * Student
      * Email<EMAIL_ADDRESS>      * Password: 123
  * Publisher
      * Email<EMAIL_ADDRESS>      * Password: 123

  As a student you can create and review a statement of the books you require for your courses.
  As a publisher you can add books that the students need.

  Feel free to read the following README to get a better understanding of the app.

  ## What is Eudoxos
  Eudoxos is a greek state website used for managing university books.
  **The (current) website**: https://eudoxus.gr/ (only Greek version)

  There are **four main groups** using this website:
  * **Students** who will state each semester which books want for their courses
  * **Publishers** who will state which books they offer
  * **University officials** who will "connect" courses and books
  * **Pickup up points** like bookshops which the student will go to receive his book
 ## Our goal
 This redesigning project is part of a university assignment of a course called Human-Computer Interaction. The main goal was to find the problems of the current website, redesign it and implement the new design.
 The project consisted of 3 parts:
 1. **Heuristic evaluation** of the current website and report of the problems. The heuristic evaluation was mainly based on Nielsen's [10 Usability Heuristics for User Interface Design](https://www.nngroup.com/articles/ten-usability-heuristics/).
 The report: reports/EudoxosUsabilityReport.pdf (currently only in Greek)
 2.  **Designing the new website** based on UCD (User-Centered Design)
     1. Decide the two of the above groups which we will develop (we chose the student and the publisher) and write representative **personas** about them. [More on personas](https://www.nngroup.com/articles/persona/).
     2. Analyze their requirements, write state diagrams about them, write scenarios and conclude in specifications which will be used to make the scenario fulfilled.
     3. Design a sitemap and low fidelity wireframes based on the above specifications using Balsamiq Wireframes.
  The report: reports/RedesigningEudoxos.pdf (currently only in Greek)
3. **Implement** the design developing a fully functional website using the above wireframes and state diagrams. The content of the website is in Greek.

## Technologies Used

* **Design**: StarUML and Balsamiq wireframes
* **Development**: HTML5, CSS, Javascript (with Bootstrap4 and jQuery) and XAMPP as a PHP development environment. The database model was created in MySQL workbench and used the exported script in phpmyadmin (eudoxosDBscript.sql).

## Services implemented

* Login and registration of students and publishers
* Create a statement of books for the current semester (student)
* Overview and edit current statement (student)
* History of statements
* Search of books based on author, title, ISBN, keywords (everyone)
* Upload a book (publisher)
* Profile overview and edit (student and publisher)
* Help based on the group you belong (student and publisher)

## TODOs
* Translate in English the two reports (EudoxosUsabilityReport.pdf, RedesigningEudoxos.pdf)
* Translate in English the whole website
* Complete the publisher services adding overview and edit of uploaded books

repository: MikeXydas/Redesigning-Eudoxus

branch_name: refs/heads/master

repo_name: MikeXydas/Redesigning-Eudoxus


text:
# The Playground

Many of the examples in this documentation make use of an interactive playground to demonstrate the flow of code when using milestones in a particular way.

## Stepping Through Code

Each playground has three main controls: a Play/Pause button, a Step button, and a Reset button. When you click Play, the code will begin to execute line by line, with the line that will next run highlighted, and clicking Pause will stop execution wherever it is. Clicking Step will advance the code a single step and then leave it paused there.

<MilestonesPlayground @lines={{4}} @showConsole={{true}} as |pg|>
  <pg.preamble>
  ```ts
  import { log } from '@milestones/playground';
  ```
  </pg.preamble>

  <pg.editor @title="Code">
  ```ts
  log('one');
  log('two');
  log('three');
  ```
  </pg.editor>
</MilestonesPlayground>

For examples with multiple code blocks, synchronous execution will start in each block from left to right. When execution pauses (e.g. at an `await` expression), the highlight on that line will dim and any other blocks will have a chance to proceed.

<MilestonesPlayground @lines={{4}} @showConsole={{true}} as |pg|>
  <pg.preamble>
  ```ts
  import { log } from '@milestones/playground';

  const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
  ```
  </pg.preamble>

  <pg.editor @title="Block A">
  ```ts
  log('a1');
  await sleep(1000);
  log('a2');
  ```
  </pg.editor>

  <pg.editor @title="Block B">
  ```ts
  log('b1');
  await sleep(1000);
  log('b2');
  ```
  </pg.editor>
</MilestonesPlayground>

This is a rough approximation of how JavaScript actually executes: synchronous code continues until the stack empties or you `await` a promise, and then the next pending task begins execution. While no guarantees are made that a playground example will perfectly match actual execution behavior, it should be high-fidelity enough to demonstrate the concepts necessary to understand milestones in this documentation.

## Configuring the Playground

Each playground instance has a small {{fa-icon 'cog'}} icon in the top right. Clicking this gives you the opportunity to show and hide various bits of the playground (detailed below) that aren't necessarily relevant to every example.

You can also adjust the playback speed of the example when the Play button is clicked. The further to the right the slider is, the faster the example will proceed from one step to the next.

## Preamble Code

Though it's usually hidden, every playground example includes some **Preamble Code** that's executed just before the visible blocks begin to run. Any identifiers introduced here are available in all the following code blocks, which makes it a perfect place to put `import` statements and define any shared values or helpers the blocks will use.

You can make this section visible for any example to see what setup was necessary in order for it to work.

## Playground Imports

A few special imports are available from the `@milestones/playground` module to make it easier to see the effects that code is having as it executes.

### Console Output

The `log` function will write a message to the **Console Output** section of the playground. If this section is hidden, it will automatically be shown the first time `log` is called. Anything written via `log` will also be emitted to the browser developer console.

<MilestonesPlayground @lines={{4}} @showConsole={{true}} @showPreamble={{true}} as |pg|>
  <pg.preamble @minLines={{2}}>
  ```ts
  import { log } from '@milestones/playground';
  ```
  </pg.preamble>

  <pg.editor @title="Code">
  ```ts
  log('one');
  log('two');
  log('three');
  ```
  </pg.editor>
</MilestonesPlayground>

### DOM Output

The `element` value is an `HTMLDivElement`. If the **DOM Output** section is shown, this element will be present in that section and you can interact with it in your code however you like and see the results there.

<MilestonesPlayground @lines={{6}} @showDOM={{true}} @showPreamble={{true}} as |pg|>
  <pg.preamble @minLines={{2}}>
  ```ts
  import { element } from '@milestones/playground';
  ```
  </pg.preamble>

  <pg.editor @title="Code">
  ```ts
  element.innerText = 'Hello';
  element.style.padding = '1em';
  element.style.backgroundColor = 'pink';
  element.style.color = 'blue';
  element.style.fontWeight = 'bold';
  ```
  </pg.editor>
</MilestonesPlayground>

repository: salsify/milestones

gha_language: TypeScript

gha_license_id: MIT

repo_name: salsify/milestones


text:
# Secrets
Secrets are managed using [git-crypt][git-crypt] so you can keep your flake in
a public repository like GitHub without exposing your password or other
sensitive data.

By default, everything in the secrets folder is automatically encrypted. Just
be sure to run `git-crypt init` before putting anything in here.

> ##### _Note:_
> Currently, there is [no mechanism][secrets-issue] in nix to deploy secrets
> within the nix/store so, if they end up in the nix/store after deployment, they
> will be world readable on that machine.
>
> The author of devos intends to implement a workaround for this situation in
> the near future, but for the time being, simple be aware of this.

[git-crypt]: https://github.com/AGWA/git-crypt
[secrets-issue]: https://github.com/NixOS/nix/issues/8

repository: codygman/devos

branch_name: refs/heads/core

repo_name: codygman/devos


text:
# Crypto_analysis
Discription:
simple streamlit app to make MMA and OSC analysis for cyrpto-currenices, and gives resaults for which coins are best to buy or sell depending on the interval you using.

        Stage 0: get a list of lastest active coins in the market
        Stage 1: MA analysis that they have been > 0 the last 1 hour , 24 hours and 7 days and output:
            strong_buy
            buy
            sell
            strong_sel
        Stage 2: OSC analysis on the "strong_buy list" that we got from the analysis in earlier stage and generate:
            recommanded_list

        stage 1,2 can be done on different intervel of times:
            1 minute
            5 minutes
            15 minutes
            1 hour
            4 hours
            1 day
            1 week
            1 month
        Stage 3: save the generated Coin_list

setup:
1- install requierments:
pip install -r requirements.txt

2- coinmarketcap API-key
 def get_marketCap(self):
        url = 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest'
        parameters = {
        'start':'1',
        'limit':'100',
        'convert':'USDT'
        }
        headers = {
        'Accepts': 'application/json',
        'X-CMC_PRO_API_KEY': 'add your key in here',
        }

3- run the program
streamlit run main.py

![image](https://user-images.githubusercontent.com/17545900/116814244-2c155780-ab58-11eb-8b80-6d2b73bd27d8.png)


text:
astropng
========

Yes, this is a Python library for storing astronomical data in the PNG format.  We take advantage of the supported bit depths of PNGs, which can store either 8 bit or 16 bit integers.  For the cases when a FITS image is stored as a floating point number, we quantize the data and store a zero point and scale factor in a custom PNG chunk.  We also preserve the FITS header in another custom chunk.

Dependencies
------------
Numpy (http://numpy.scipy.org/)
PyFITS (http://www.stsci.edu/institute/software_hardware/pyfits)
PyPNG (http://code.google.com/p/pypng/)

Installation
------------
1. Download the source code from the repository (https://github.com/kapadia/astropng)

    git clone git@github.com:kapadia/astropng.git

2. Navigate to the root directory of the library
3. Run setup.py

    python setup.py install

Instructions
------------

    import astropng

    # To convert from a FITS image to a PNG
    ap = astropng.AstroPNG('blah.fits')
    ap.to_png('blah.png')

    # To convert from a PNG back to a FITS image
    ap = astropng.AstroPNG('blah.png')
    ap.to_fits('blah.fits')

References
----------
Stoehr, F. et al. 2007, ST-ECF Newsletter. 42, 4.

White, Richard L, Perry Greenfield, William Pence, Nasa Gsfc, Doug Tody, and Rob Seaman. 2011.  Tiled Image Convention for Storing Compressed Images in FITS Binary Tables: 1-17.

repository: kapadia/astropng

repo_name: kapadia/astropng


text:
---
title: Getting Started
page_title: Getting Started
slug: radpdfprocessing-getting-started
tags: getting,started
published: True
position: 1
---

# Getting Started

This article will get you started in using the __RadPdfProcessing__ library.

>noteIf you still don't have **Telerik Document Processing** installed, check the [First Steps]({%slug getting-started-first-steps%}) topic to learn how you can obtain the packages through the different suites.

## Assembly References

>The libraries support .NET 4 and later. .NET Standard-compatible binaries are available as well. The assemblies for .NET Standard don't include 'Windows' in their names (e.g. **Telerik.Documents.Core.dll**). For more information check [**Cross-Platform Support**]({%slug radpdfprocessing-cross-platform%}) article.

In order to use the __RadPdfProcessing__ library in your project, you need to add references to the following assemblies:

		.NET Framework
		.NET Standard-compatible

		Telerik.Windows.Documents.Core.dll
		Telerik.Documents.Core.dll

	    Telerik.Windows.Documents.Fixed.dll
		Telerik.Documents.Fixed.dll

	    Telerik.Windows.Zip.dll
		Telerik.Zip.dll

        To export images different than Jpeg and Jpeg2000 or ImageQuality different than High you will need to add a reference to the following assembly:

	    -
		Telerik.Documents.ImageUtils.dll

This assembly is not available in UI for Xamarin.

		This assembly is required for the Image Exporting functionality. This is only available in the NET Standard version.

		-
		Telerik.Documents.Fixed.FormatProviders.Image.Skia

        To enable the import of documents containing CMap Tables, you will need to add a reference to:

	    Telerik.Windows.Documents.CMapUtils
		Telerik.Documents.CMapUtils

        To describe different colors, shapes and other properties, RadPdfProcessing depends on the listed below .NET assemblies, which you should also refer in your project:

	    WindowsBase.dll
		-

	    PresentationCore.dll
		-

	    PresentationFramework.dll
		-

>note The **Telerik.Documents.ImageUtils.dll** assembly depends on **SkiaSharp**. In order to use this assembly, you will need to add a reference to [SkiaSharp](https://www.nuget.org/packages/SkiaSharp/). With the [R2 2023 changes](https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/changes-and-backward-compatibility/backward-compatibility#whats-different-in-2023-r2) SkiaSharp replaced ImageSharp as the required dependency.

>note The **Telerik.Documents.Fixed.FormatProviders.Image.Skia** assembly depends on **SkiaSharp**. In order to use this assembly, you will need to add a reference to [SkiaSharp](https://www.nuget.org/packages/SkiaSharp/). The **SkiaSharp.NativeAssets.*** Nuget package is required as well. This package may differ according to the used platform. There are version for Windows, MacOs, Linux, WebAssembly, Android, iOS, and others.

## Creating a Document

[RadFixedDocument]({%slug radpdfprocessing-model-radfixeddocument%}) is the root element in the library. It consists of [RadFixedPage]({%slug radpdfprocessing-model-radfixedpage%}) objects and instructions for annotations and destinations in the document. __Example 1__ shows how to create a document and add a page to it.

#### __[C#] Example 1: Create RadFixedDocument__

{{region cs-radpdfprocessing-getting-started_0}}
	RadFixedDocument document = new RadFixedDocument();
	RadFixedPage page = document.Pages.AddPage();
{{endregion}}

The page can then be edited through a [FixedContentEditor]({%slug radpdfprocessing-editing-fixedcontenteditor%}) instance. __Example 2__ creates an editor and adds a [TextFragment]({%slug radpdfprocessing-model-textfragment%}) to the page object created in __Example 1__.

#### __[C#] Example 2: Add text__

{{region cs-radpdfprocessing-getting-started_1}}
	FixedContentEditor editor = new FixedContentEditor(page);
	editor.DrawText("Hello RadPdfProcessing!");
{{endregion}}

## Exporting to PDF

Exporting to PDF format can be achieved with the __PdfFormatProvider__ class. __Example 3__ shows how to export the __RadFixedDocument__  created in __Examples 1 and 2__ to a file.

#### __[C#] Example 3: Export to PDF__

{{region cs-radpdfprocessing-getting-started_2}}
	PdfFormatProvider provider = new PdfFormatProvider();
	using (Stream output = File.OpenWrite("Hello.pdf"))
	{
	    provider.Export(document, output);
	}
{{endregion}}

## See Also

 * [Using Telerik Document Processing First Steps]({%slug getting-started-first-steps%})
 * [RadFixedDocument]({%slug radpdfprocessing-model-radfixeddocument%})
 * [RadFixedPage]({%slug radpdfprocessing-model-radfixedpage%})
 * [FixedContentEditor]({%slug radpdfprocessing-editing-fixedcontenteditor%})
 * [TextFragment]({%slug radpdfprocessing-model-textfragment%})

repository: telerik/document-processing-docs

gha_language: JavaScript

gha_license_id: NOASSERTION

repo_name: telerik/document-processing-docs


text:
# Applying AI on 2D Medical Data
AI Healthcare

## Project : Pneumonia Detection from X-Ray Images

It includes,

1. Distill data that are useful for training algorithms to detect pneumonia from a giant set of chest x-ray images taken from actual patients.
2. Build a CNN model to detect the presence or absence of pneumonia.
3. Build wrappers which read medical images from their real-world clinical formats (DICOM).
4. Validation plan of the algorithm for FDA 510(k) submission.


text:
# Ruby Basics

## Learning Objectives

* Review the history and background of the Ruby programming language
* Compare/contrast Ruby and Javascript
* Learn how to run Ruby code by file and in a REPL
* Review various parts of the Ruby Language, including:
  - Syntax
  - Variables
  - Fundamental Data Types
  - Collections
  - Conditionals
  - Methods (Functions)

## Lesson

| Time | Section |
| --- | --- |
| 0:10 | History/Background |
| 0:10 | Compare & Contrast |
| 0:05 | Interacting with Ruby |
| 0:05 | Variables |
| 0:15 | Data Types |
| 0:15 | Data Types Exercise |
| 0:10 | Break |
| 0:05 | Ruby Basics Exercise |
| 0:10 | Collections |
| 0:20 | Collections Exercise |
| 0:10 | Methods |
| 0:20 | Methods Exercise |
| 0:10 | Compare & Contrast |

## Framing
(10 minutes / 0:10)

### What is Ruby?

Most web apps that you'll encounter are "full-stack", meaning there is a rich client-side part to the application, like those we built for our first project, and a rich server-side to the application, as we'll start building next week. Ruby is a **server-side** programming language. We will be writing Ruby code that _serves_ webpages.

What is a server?
* It gathers information from the database, filters it using logic and from that generates something to send back to the user. That could be HTML or, in the case of an API, JSON.
* That means you cannot look at or mess with a site's server-side code as you did with Javascript via the browser console
* We won't be including Ruby files in our HTML documents. You'll learn more about back-end development and how to connect everything together next week.
### The Ruby Philosophy

#### M.I.N.A.S.W.A.N.

* Yukihiro Matsumoto ("Matz") created Ruby in the mid-90s
* He wanted to build a language that was easy and fun to use and to increase developer happiness
* "Matz Is Nice And So We Are Nice"
* Mentality not only applies to how you should treat your fellow developers, but also the philosophy behind Ruby itself

> "Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to make programmers happy." — Yukihiro "Matz" Matsumoto

![He really is quite nice.](matz-n-park.png)

#### A **Natural** Language

While it isn't exactly simple, a lot of its features are going to feel intuitive

> "Ruby is simple in appearance, but is very complex inside, just like our human body." — Yukihiro "Matz" Matsumoto

## Compare and Contrast, Part 1
( 10 minutes / 0:20 )

Think back to the [Try Ruby homework you just completed](https://github.com/ga-wdi-exercises/try-ruby).

Break out in to groups of 3-4 by counting 1 through 4. Remember your number, because we're going to do this again at the end of class!

With your group, compare and contrast what you learned about Ruby with what you know about JavaScript on the whiteboard. You can do this with a table, a mind map or however you think is best.

## Interacting with Ruby
(5 minutes / 0:25)

There are 3 ways that we can interact with Ruby. Before we get in to them, we need to make sure we have Ruby set up on our computers.

### Setting Up Ruby

Check to make sure you have Ruby installed by running this in the Terminal: `$ ruby -v`
* You should get back something like: `ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16]`
* If nothing shows up, run the following: `$ rbenv install 2.4.p0` or check the [installation page](https://www.ruby-lang.org/en/documentation/installation/#rbenv)

### Running Ruby

#### By File
The first way that we can interact with Ruby is by running a Ruby file. Ruby files have the extension `.rb` and can be run through the command line:

```bash
$ touch app.rb  # Create a Ruby file
$ ruby app.rb   # Run that ruby file
```

#### By REPL

The second way that we can interact with Ruby code is with a tools like Pry and IRB. Both Pry and IRB are Ruby REPLs.

  1. Install: `$ gem install pry`
  2. Run REPL: `$ pry`
  3. Quit from REPL: `exit`
  4. Alternative: `$ irb`

> A `gem` is a tool or application written in Ruby. We install them by entering `$ gem install gem_name` in the Terminal. Explore [rubygems.org](https://rubygems.org/) if you're interested in learning more.

#### Using Repl.it

Just like with JavaScript, we can use [repl.it](https://repl.it/languages/ruby) to interact with Ruby through an online REPL.

## Fundamental Data Types

### Variables
(5 minutes / 0:30)

Variables in Ruby are assigned by using a single equals sign ( `=` ):

```rb
my_favorite_animal = "flying squirrel"
# => "flying squirrel"
```

Notice a few other things about the above block of code:
* We no longer need to precede new variables with `var`. Just use the name of the variable!
* Variables are instantiated as they are used
* Variables are also written in `snake_case`. That means all lower case with words separated by underscores.
* Variable names should still be semantic

Although we don't use `var`, there is still syntax to designate whether a variable is local or global.
* `$` makes a variable global (e.g., `$my_number`)
* Undesignated implies a `local` variable (e.g., `my_number`)
* All-caps will make a variable a constant (That is, Ruby will give you warnings if you try to change the value (e.g., `PI = 3.14`))

### No Semicolons

While your code will work if you close a line with `;`, common practice is not to use them.

### Parentheses Optional

Since we're currently in a Javascript state of mind, it might feel natural to keep using them. That's okay! Ruby, however, does not require we use them when defining functions, conditional statements, etc.

```rb
number = 3
# => 3

if( number == 3 ) # with parens
  puts( "It's a 3!" )
end
# It's a 3!
# => nil

if number == 3 # without parens
  puts "It's a 3!"
end
# It's a 3!
# => nil
```

## You Do: Data Types
(15 minutes / 0:45)

Spend 15 minutes reading through everything up until the **Data Types Exercises** section below this one.

> **Why do we have to read all this ourselves?**
>
> While we could re-teach you what numbers, strings, conditionals, etc. are like in Ruby, you know enough about programming languages from your experience with Javascript to pick up on this information yourself pretty quickly.
>
> Because of this, the peculiarities of Ruby will be apparent. These are the things you need to be aware of in the next few classes.

### Everything Is An Object!

Everything in Ruby is an **object**.
* By "object" we mean that everything has its own set of properties and methods
* Not a new concept. Some data types in Javascript had their own properties and methods (e.g., `string.length`)
* You will learn more about this when you dive into Ruby OOP next week

### Numbers

Ruby uses same arithmetic operators as Javascript
* `+`, `-`, `*`, `/`, `%`
* Same order of operations too: P.E.M.D.A.S.

```rb
1 + 2 # Addition
# => 3

6 - 5 # Subtraction
# => 1

5 * 2 # Multiplication
# => 10

30 / 5 # Division
# => 6

31 / 5 # Note: integer division
# => 6

30 % 5 # Modulo (remainder)
# => 0

31 % 5
# => 1

3 ** 2 # Exponentiation
# => 9
```

> Notice the use of `**` to perform exponential operations in Ruby. We don't have this shortcut widely available [in Javascript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow) yet.

### Strings

Words, just like in Javascript.
* Surrounded by single or double-quotes
* Ruby uses similar escape characters
  - [Here is a list of them](http://www.java2s.com/Code/Ruby/String/EscapeCharacterslist.htm)
  - Must instantiate string with double-quotes for escape characters to work

```rb
name = "John"
# => "John"

full_name = "John\nDoe"
# => "John\nDoe"

puts full_name
# John
# Doe
# => nil
```

Not only can you concatenate strings, now you can multiply them too! Remember we couldn't do that in Javascript?

```rb
# Concatenation
"Hello " + "there!"
# => "Hello there!"

# Multiplication
"Hello there! " * 3
# => "Hello there! Hello there! Hello there! "
```

#### String Interpolation

Sometimes you will want to print out a string that incorporates a variable. For example...

```rb
my_name = "Namey Lee Curtis"
# => "Namey Lee Curtis"

puts "Hi my name is: " + my_name
# Hi my name is: Namey Lee Curtis
# => nil
```

This works fine. Things aren't so simple when that variable is of a different data type. Like a number...

```rb
class_number = 984
# => 984

puts "I am teaching WDI " + class_number
# TypeError: no implicit conversion of Fixnum into String from (pry):26:in `+'
```

In cases like the above, you either need to convert the variable to a string using `.to_s` or use something called "string interpolation" (which will call `.to_s` implicitly).
* Surround the non-string variable with a hashtag and curly brackets: `#{variable}`. If you choose this option, you must use double quotes otherwise the interpolation will not work.
* This works just like [Template Literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) in JavaScript.

```rb
class_number = 984
# => 984

puts "I am teaching WDI #{class_number}"
# I am teaching WDI 984
# => nil
```

### Booleans

Still `true` and `false`.
* We'll be using them in conditionals and comparisons just like in Javascript

Comparison operators in Ruby are nearly identical to Javascript. However, the check for equality is always for both value and data type.
* `<`, `>`, `<=`, `>=`, `==`, `!=`

> Don't worry about `===` in Ruby for now. It [does not](http://mauricio.github.io/2011/05/30/ruby-basics-equality-operators-ruby.html) have the same application as in Javascript.

Logical operators are also similar.
* `!`, `&&`, `||`

"Truthiness" and "Falsiness" are a lot less complicated in Ruby.
* The only falsey values in Ruby are `nil` and `false`

### Nil

Ruby's "nothing".
* The equivalent of Javascript's `null`
* You will usually see it when something does not have a return value (e.g., a `puts` statement)
* Like in Javascript, `nil` is falsey

Need to check if something is `nil`? Use `.nil?`

> **NOTE:** Any method that ends with a `?` means it will return a boolean value.

```rb
something = "A thing"
# => "A thing"

something.nil?
# => false

something = nil
# => nil

something.nil?
# => true
```

### The Bang Symbol (`!`)

All of the Ruby data types we have discussed so far are mutable.
* We can not only change what variables are pointing to in memory, but we can directly modify those values stored in memory as well.

Methods with an `!` attached to the end of them usually mean that they will modify the value in memory they are being called on.
* Things can get tricky when you have multiple variables pointing at the same value. For example...

```rb
a = "cheeseburger"
# => "cheeseburger"

b = a
# => "cheeseburger"

b.upcase!
# => "CHEESEBURGER"

a
# => "CHEESEBURGER"
```
### Symbols

Symbols are immutable values. That means they contain the same value through the entirety of a program and cannot be changed.
* Kind of like a string that never changes
* Syntax: `variable_name = :symbol_name`
* Similar to symbols in [JavaScript](http://www.2ality.com/2014/12/es6-symbols.html)

```rb
favorite_animal = :dog
# => :dog

favorite_animal.upcase!
# NoMethodError: undefined method `upcase!' for :dog:Symbol
# Did you mean?  upcase
```

When/why would you use symbols?
* Most common use is as keys in hashes, the Ruby equivalent of objects (more on that later)
* Make sure values that need to be constant stay constant
* Enhance performance, use less memory

### Conditionals

Pretty similar to Javascript, with some differences.
* No parentheses or curly brackets required
* Begin blocks using `if`, `elsif` **(no second "e"!)** and `else`
* We close the whole loop using `end`
  - This will be used throughout Ruby when dealing with code blocks (e.g., method/function)

Here's an example where we check for height at a roller coaster...

```rb
# In app.rb

puts "Welcome to the Iron Rattler! How tall are you (in feet)?"
height = gets.chomp.to_i

if height < 4
  puts "Sorry, you'll fly out of your seat if we let you on."
elsif height < 7
  puts "All aboard!"

end
```

## You Do: Data Types Exercises
(15 minutes / 1:00)

Complete the first set of exercises (Exercise I: Data Types) in [this repo](https://git.generalassemb.ly/ga-wdi-exercises/ruby-basics-exercises).

If you finish this section early, feel free to try out one of the [Additional Exercises](https://git.generalassemb.ly/ga-wdi-lessons/ruby-intro#additional-practice) located at the bottom of the lesson plan.

### Break
(10 minutes / 1:10)

## We Do: Ruby Bouncer
(5 minutes / 1:15)
Back during our first few lessons on JavaScript, you used conditionals and variables to create a Bouncer. Walk me through how to do the same, but now with Ruby!

### `puts` and `gets`

To print out to the console like `console.log()` does in JavaScript, we use the `puts` method:

```rb
puts "Hello, Ruby!"
# Hello, Ruby!
# => nil
```

Ruby also makes it easy for us to accept user input from the command line using `gets`:

```rb
user_input = gets
# => "My input\n" (Note that this line was typed by the user in the terminal)

user_input
# => "My input\n"
```

Some notes about `gets`:
* Usually `gets` is followed by `.chomp`, which removes the new line generated by the user hitting return
* If you need to convert your value to a number, add `.to_i` to the end of the method

## You Do: Data Collections
(10 minutes / 1:25)

Read everything up until the **Data Collections Exercises** section below this one.

### Arrays

An ordered collection of related values. Same syntax as Javascript arrays.
* Square brackets
* Values separated by commas
* Zero-indexed

```rb
numbers = [1, 2, 3]
# => [1, 2, 3]

animals = ["dog", "cat", "horse"]
# => ["dog", "cat", "horse"]

animals[0]
# => "dog"

animals[1] = "elephant"
# => "elephant"

animals
# => ["dog", "elephant", "horse"]
```

Another super cool Ruby feature is that you can perform arithmetic operations on arrays!

```rb
numbers = [1, 2, 3]
# => [1, 2, 3]

more_numbers = [4, 5, 6]
# => [4, 5, 6]

lots_of_numbers = numbers + more_numbers
# => [1, 2, 3, 4, 5, 6]

lots_of_numbers - [4, 5, 6]
# => [1, 2, 3]

numbers * 3
# => [1, 2, 3, 1, 2, 3, 1, 2, 3]
```

#### Array Methods

Ruby is very nice. It provides us with an extensive library of array methods we can use to traverse and manipulate arrays.
* The Ruby [documentation](http://ruby-doc.org/core-.0/Array.html) for `Array` is a great resource for learning more about these methods
* Can't go over them all, but chances are if you could do it in Javascript then you can do it in Ruby.

**IMPORTANT:** You DO NOT need to memorize these. The following is just a sample of array methods available to you. You'll come to be more familiar with these as you need them and look them up in documentation.

> **tl;dr:** The more you Google them, the better you'll remember them.

##### Push/Pop

These Javascript methods also exist in Ruby and are used the same way.

```rb
numbers = [1, 2, 3, 4, 5]
# => [1, 2, 3, 4, 5]

numbers.push(6)
# => [1, 2, 3, 4, 5, 6]

numbers.push(7, 8, 9)
# => [1, 2, 3, 4, 5, 6, 7, 8, 9]

numbers.pop
# => 9

numbers
# => [1, 2, 3, 4, 5, 6, 7, 8]
```

##### Sort

Organizes array values from lowest to highest. Numbers and strings.

```rb
numbers = [3, 1, 5, 2, 4]
# => [3, 1, 5, 2, 4]

numbers.sort
# => [1, 2, 3, 4, 5]
```

##### Delete

* Removes an argument from an array
* If there are multiple instances of that argument, it will delete them all
* Look up: `.delete_at()`, `.slice()`

```rb
numbers = [3, 1, 2, 2, 4]
# => [3, 1, 2, 2, 4]

numbers.delete(2)
# => 2

numbers
# => [3, 1, 4]
```

### Hashes

A Ruby hash is an unordered, dictionary-like collection organized by key-value pairs. A hash is very similar to a Javascript object.

```rb
wdi_class = {
  teacher: "John",
  students: ["Yacko", "Wacko", "Dot"],
  classroom: 2,
  in_session: true,
  schedule: {
    morning: "Ruby Basics",
    afternoon: "Enumerables"
  }
}
# => {:teacher=>"John", :students=>["Yacko", "Wacko", "Dot"], :classroom=>2, :in_session=>true, :schedule=>{:morning=>"Ruby Basics", :afternoon=>"Enumerables"}}
```

Accessing hash values...

```rb
wdi_class[:teacher]
# => "John"
```

Modifying hash values...

```rb
wdi_class[:teacher] = "Jack"
# => "Jack"
```

You can also use strings as hash keys...

```rb
wdi_class = {
  "teacher" => "John",
  "students" => ["Yacko", "Wacko", "Dot"],
  "classroom" => 2,
  "in_session" => true,
  "schedule" => {
    "morning" => "Ruby Basics",
    "afternoon" => "Enumerables"
  }
}
```

Then can access in this way...

```rb
wdi_class["teacher"] = "John"
# => "John"
```

And modify...

```rb
wdi_class["teacher"] = "Jack"
# => "Jack"
```

> Note the use of `=>` (or "hash rockets") instead of `:` when using strings as keys.

#### Hash Methods

Like arrays, Ruby also provides us with a library of hash methods.
* [Again, the Ruby documentation is a great resource](http://ruby-doc.org/core-2.4.0/Hash.html)

> As mentioned with arrays, do not worry about memorizing these methods. Just know how to look them up should the need arise.

##### Keys

Returns an array with all the keys in a hash.

```rb
wdi_class.keys
# => [:teacher, :students, :classroom, :in_session, :schedule]
```

##### Merge

Combines two hashes. If both of your hashes have the same key, the one in the hash you set as the argument in the parameters will take precedence.

```rb
classroom = {
 room: 1
}
# => {:room=>1}

locations = {
 location_one: "DC",
 location_two: "NY",
 location_three: "Boston"
}
# => {:location_one=>"DC", :location_two=>"NY", :location_three=>"Boston"}

silly_hash = classroom.merge(locations)
# => {:room=>1, :location_one=>"DC", :location_two=>"NY", :location_three=>"Boston"}

classroom
# => {:room=>1}

locations
# => {:location_one=>"DC", :location_two=>"NY", :location_three=>"Boston"}

silly_hash
# => {:room=>1, :location_one=>"DC", :location_two=>"NY", :location_three=>"Boston"}
```

### Ranges

Use ranges to quickly generate arrays of data types.
* Parentheses
* Min and max value, separated by two periods
* Generate array using `.to_a` method

```rb
(1..5).to_a
# => [1, 2, 3, 4, 5]

("a".."z").to_a
# => ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
```

## You Do: Data Collections Exercises
(20 minutes / 1:45)

> 15 minutes exercise. 5 minutes review.

Complete the second set of exercises (Exercise II: Data Collections) in [this repo](https://git.generalassemb.ly/ga-wdi-exercises/ruby-basics-exercises).

If you finish this section early, feel free to try out one of the [Additional Exercises](https://git.generalassemb.ly/ga-wdi-lessons/ruby-intro#additional-practice) located at the bottom of the lesson plan.

## Methods
(10 minutes / 1:55)

As stated before, everything in Ruby is an object so there is no distinction in this language between functions and methods. Under the hood, even seemingly stand-alone functions are in fact associated with an object. The convention, however, is to call these methods.

In Ruby, methods are defined like this:
```rb
def double( number )
   doubled_number = number * 2
   return doubled_number
end
```

Components
* `def` - the Ruby equivalent of `function`
* `double` - the method name in the above example
* `number` - the parameter name in the above example
* `end` - closes the method

Ruby is flexible in how we invoke methods:

```
double( 3 )
# => 6

double 3
# => 6
```

You may have noticed that we use the same `return` notation as Javascript. This is called an **explicit return**, because we identify what exactly we want returned from the function.

Ruby also lets us make **implicit returns**.
* This means that we do not need to use the `return` keyword. Ruby will automatically return the value of the last line of code in the method.
* We encourage you to use **explicit returns** so we know exactly what your method is returning

```rb
def double( number )
  doubled_number = number * 2
  doubled_number
end
# => :double

double( 3 )
# => 6

double 3
# => 6
```

Ruby methods can also establish default argument values.
* In the below example, if we do not provide our `double` method with an argument, it will default to 5

```rb
def double( number = 5 )
  doubled_number = number * 2
  puts "Your doubled number is #{doubled_number}"
  return doubled_number
end
# => :double

double
# Your doubled number is 10
# => 10
```

## Exercise: Temperature Converter
(25 minutes / 2:20)

> 15 minutes exercise. 10 minutes review.

[Temperature Converter (Ruby)](https://git.generalassemb.ly/ga-wdi-exercises/temperature_converter_ruby)

## Compare and Contrast, Part 2
( 10 minutes / 2:30 )

Break out in to groups of 3-4, this time by creating a group that has at least one person who was each number 1 through 4 from the first exercise (i.e. one #1, one #2, one #3, and one #4 in each group).

With your group, compare and contrast again what you know about JavaScript with what you now know about Ruby on the whiteboard. You can do this with a table, a mind map or however you think is best.

### Leading Questions

* What are the main data types in Ruby? What are they in JavaScript? How do they work similarly and differently?
* Describe the difference between what is truthy/falsey in Ruby vs JavaScript?
* What are the differences between explicit and implicit return in Ruby vs JavaScript?
* How would you add a key / value pair to an existing hash? How is this different from adding a key / value pair to an existing object in JavaScript?
* How many values can a method return? Which methods don't return anything in Ruby or JavaScript?

## Resources
* [Learn X in Y minutes: Ruby](https://learnxinyminutes.com/docs/ruby/)
* [Chris Pine's Learn to Program](https://pine.fm/LearnToProgram/chap_00.html)
* [Ruby Monk](https://rubymonk.com/)
* [Why's Poignant Guide to Ruby](http://poignant.guide/book/chapter-2.html)
* [Ruby Koans](http://rubykoans.com/)

## Additional Practice
* [Word Ladder](https://git.generalassemb.ly/ga-wdi-exercises/word_ladder)
* [Who Won The Election?](https://git.generalassemb.ly/ga-wdi-exercises/who_won_the_election)
* [Search For Obi-Wan](https://git.generalassemb.ly/ga-wdi-exercises/search_for_obi_wan)
* [Pig-Latin](https://git.generalassemb.ly/ga-wdi-exercises/pig_latin)
* [Letter Counter](https://git.generalassemb.ly/ga-wdi-exercises/letter_counter)


text:
# Hello Datawire Connect Example

This example demonstrates how Quark can implement cross-language RPC
using Datawire Connect.

## Setup

- `pip install datawire-quark`
- `pip install datawire-cloudtools`
- create an org (`dwc create-org`)
- create a service named "hello" (`dwc create-service hello`)

You can use an organization you've already created. If you're creating
a new organization, it can be named whatever you like. The service,
however, _must_ be named `hello`, since that's what the example is
expecting.

## Using Quark to Implement and Use Services

Datawire Connect uses the Quark language to express _service contracts_ in ways
that allow any of several host languages to easily implement and use services.
See QuarkAndDatawireConnect.md for (much) more information about using Quark in
your own projects.

## Hello Datawire Connect

The Hello Datawire Connect example implements and uses a very simple service:
the 'hello' service, on receiving a string from the client, echos back the string
it received, and what runtime the server is using.

The example supplies three different implementations:

- JavaScript under Node.js, in the `node` directory
- JavaScript in a browser, in the `browser` directory (client only)
- Python, in the `python` directory

## Running this example

The clients expect to find the service on http://<IP_ADDRESS>:8910/
and each server runs there. Thus you may run a single server at a
time, as well as any number of clients. You are encouraged to mix and
match languages! Any server should work with any client.

To get started, download the example by cloning its git repository as
follows:

        git clone https://github.com/datawire/datawire-connect.git

All of the directions below assume you are starting from
*repoBase*/examples/helloRPC where *repoBase* is the location where
you cloned the repository above.

### Reminder

You _must_ create a Datawire Connect organization and service, as described
above. The example code will not function unless it can find a service token
for a service named 'hello'.

### The Easy Way

Use the included Makefile to set up all three client/server pairs at once:

        make

Then follow the directions below to run one server, and try however many
clients you like.

### Python

To build just the Python implementation, you can use `make python`.

Run the Python server with

        python python/pyserver.py

Run the Python client with

        python python/pyclient.py

### Java

To build just the Java implementation, you can use `make java`.

Run the Java server with

        make javaserver

Run the Java client with

        make javaclient

(The Makefile uses `mvn exec` under the hood -- for details, look at the
`Makefile` in the `java` directory.)

### JavaScript under Node.js

To build just the Node.js implementation, you can use `make java`.

Run the Node.js server with

        node node/jsserver.js

Run the Node.js client with

        node node/jsclient.js

### JavaScript in a browser

To build just the JavaScript client for a browser, you can use `make browser`.

Run the client by opening `browser/hello.html` in your web browser.

There is no server for the browser. Instead, run the Node.js server:

        node node/jsserver.js

repository: maniacs-ops/datawire-connect

repo_name: maniacs-ops/datawire-connect


text:
This will be your guide to start learning and understanding the ansible playbooks and roles. The roles you find here can be used to build a production grade application infrastructure. We will be using the AWS Dynamic inventory to run the roles on the AWS instances. You can find some simple terraform code to build your basic infrastructure to execute these roles on your own aws account.

## Docker and Docker Compose
We will be deploying most of our services as Docker containers on the aws instances using these Ansible roles. Deploying as container is a very straight forward and simplest approach as you don't really have to deal with the dependencies like libraries, os versions and other dependencies.

## Terraform
You can find a sample terraform code under `terraform` directory which will help you quickly build your infrastructure on your personal aws account. You may then deploy these services using the ansible roles on the newly created instances.

If you choose to have a dedicated code repository for terraform you may refer to this [repository]().

## Directories

### group_vars
Declare all the global level variables here.
### terraform
These files help us to create the simple instance on which we can run our Ansible Playbooks.
### ssh
Configuration to ssh proxy to the servers in the vpc using the Bastion instance.
### _ssh
Consists of the Key files which we used to authenticate to the aws server.
### inventory
Dynamic Inventory configuration to identify the aws instances using special naming conventions.
### roles
All the ansible roles will be located here in this directory.


text:
# HTML & CSS capstone project: Sneakers shop
A Capstone project is a solo projects at the end of the each of the [Microverse](https://www.microverse.org/) Main Technical Curriculum sections.

This project inparticular is a real-world-like project, built with real world business specifications. Its based on an online shop for sneakers.

## Screenshots for various screen sizes

In this project, my aim was to build just the appearance of the website and **NOT** to give it functionality.

## Built with
  * HTML
  * SASS (SCSS)

## Live demo
[Live Demo Link](https://raw.githack.com/PhillipUg/sneaker-shop/sneaker-shop/index.html)

## Video demo
[Video Demo Link](https://www.loom.com/share/531f5ff9adfe434dbf432b4219c04bf2)

## Author

 :bust_in_silhouette:
 * Github: https://github.com/PhillipUg
 * Twitter: https://twitter.com/Phillip_Ug
 * LinkedIn: https://www.linkedin.com/in/phillip-musiime

## Contributing
Contributions, issues and feature requests are welcome!

   1. Fork the Project
   2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
   3.  Push to the Branch (git push origin feature/AmazingFeature)
   5. Open a Pull Request

Feel free to check the [issues page](https://github.com/PhillipUg/sneaker-shop/issues).

## Show your support
Give a :star: if you like this project!

## Acknowledgements
  * [Microverse](https://www.microverse.org/)
  * The original designer of this great idea of a website is [Dima Oxygen](https://www.behance.net/dimaoxygen)
  * I got the images of the sneakers from:
    - [Amazon](https://www.amazon.com/)

## License
 Distributed under the MIT License.

repository: PhillipUg/sneaker-shop

gha_language: CSS

repo_name: PhillipUg/sneaker-shop


text:
# LTSS-NIEM
This is an implementation of the Long-Term Services and Supports referral service.  The web service utilizes a NIEM 3.0 (National Information Exchange Model) schema.

### Requirements
- Visual Studio 2015+
- IIS 7.5+
- SQL Server 2008+

### Installation
- Configure keys containing ******** in the app.config.
- Generate referral database.
Within the package manager console run either
   ```sh
   update-database
   ```
   to directly generate the database or
   ```sh
   update-database -Script -SourceMigration:0
   ```
   to generate a create script for the database starting from the initial migration.
- Right-click on LTSSWebService in the Solution Explorer and choose to publish to a website hosted on either a local or remote IIS instance.  If you choose to publish to a local instance, simply copy the files to your desired remote IIS website folder.
- Populate your Email table with your desired configuration data for summary notifications.  It would be prudent to validate your configuration data with `EmailHelper.SendEmail`.

### Workflow of the service
When a referral id is sent from LTSS, its associated SendReferralRequestPayloadType is persisted to a database common to the various TxACE centers.  After it is persisted, the service immediately responds with a referral acknowledgement and makes a retrieveReferralInfo request for the data associated with the referral id.  Once the data is received we persist it to the database and validate that it can be deserialized.  Then we call updateReferralInfo with "AC" (acknowledgement) if we successfully retrieved valid XML and "PF" (process failure) otherwise.

### How to update an existing installation
- Backup your production database.
- Run the following commands against your production database (possibly twice for constraint violations):
   ```sh
   delete ContactEntity
   delete Enrollment
   delete EntityContactEntity
   delete EntityEvent
   delete Location
   delete Organization
   delete Referral
   delete Screening

   update Request SET IsProcessed = 0, Exception = NULL
   ```
- Deploy the updated code making sure to preserve your existing app.config file.
- Assuming your app.config file is pointing to your production database, run
   ```
   update-database
   ```
   to make sure your database has the latest schema.

### To-do
- Push desired referral data into center specific databases.
- Create useful forms and/or an application that enables centers to effectively use the referral data.

repository: txace/LTSS-NIEM

repo_name: txace/LTSS-NIEM


text:
I've had two of my Cordova plugins suffer from poor thread handling (entirely on my part).

Both plugins reporting:

```
THREAD WARNING: exec() call to [pluginname].[method] blocked the main thread for XXms. Plugin should use CordovaInterface.getThreadPool().
```

Having spent some time on the Scheduler plugin I've realized that the problems where based on simple misunderstanding by myself.

## Two issues
I have the blocking thread issue on two plugins:

* Background Service Plugin -> https://github.com/Red-Folder/Cordova-Plugin-BackgroundService/issues/19
* Scheduler Service Plugin -> https://github.com/Red-Folder/Scheduler-Plugin/issues/22

Generally most of the time the plugins worked - it was only on occasion that the THREAD WARNING would fire.  Within the Background Service Plugin it generally seemed to be because developers where not using the async calls correctly - most problems where resolved by simply chaining the async methods correctly.

The Scheduler plugin however was easier to replicate by simply adding multiple alarms - thus easier to track down.

The rest of this article discusses how I resolved the problem with the Scheduler Plugin.  I'll be applying the same sort of fixes to the Background Service plugin in due course.

## Problem 1 - Calls from the runnable thread to the plugin thread
Within my Scheduler Plugin, I already had the following within the execute method:

```
cordova.getThreadPool().execute(new Runnable() {
    @Override
    public void run() {
    ...
    }
});
```

Within the run method, I would then call methods within the Plugin class.  And this was my first problem.

The Plugin code would run in thread 1.  On execute the Plugin code would generate a new runnable to handle the plugin request - this would be on thread 2.  Thread 1 (the Plugin) would return control to the UI.  The code on thread 2 would then run, at the appropriate point it would then call methods in the Plugin class (on thread 1).  While the code was running on thread 1, any further requests to the plugin from UI would block until it had finished.

To fix this, I moved all of the Scheduler methods into a new class called ScheduelerLogic.  This class implemented Runnable and included the run method.

The new SchedulerLogic was then initiated from the Plugin code (instead of the anonymous Runnable code from earlier):

```
cordova.getThreadPool().execute(new SchedulerLogic(context, action, data, callback));
```

Because all of the "logic" was now within the Runnable class it was contained in the thread that the ThreadPool created - thus didn't block the original Plugin thread.

## Problem 2 - Blocking code on the constructor
Oddly I still had THREAD WARNINGS.

I had inadvertently added an additional blocking problem, by putting initialization code in the constructor of the SchedulerLogic plugin.

My original DAL (data access layer) was using a JSON string stored in Shared Preferences.  This worked ok, but wasn't very practical for thread concurrence (see below).  I loaded the DAL object within the SchedulerLogic constructor, this took time (and some clashing resources) which blocked the plugin thread - because the SchedulerLogic was created on thread 1.  It would be later run on its own thread, but the actual creation was on thread 1 - so any activity within the constructor would eat up milliseconds (and potentially run blocking code).

Moving the DAL creation out of the constructor (along with the solution to problem 1) solved the THREAD WARNING.

## Problem 3 - Concurrency thread saftey - or rather than lack of
So no more warnings.

But, when I tested the plugin creating multiple alarms (50 alarms), I found that not all of the alarms where actually created.  Debugging the code I found that my DAL wasn't thread safe and the data stored in the Shared Preferences wasn't reliable.

Basically there was no protection from multiple threads making requests to the DAL - this became a race condition between multiple threads - often resulting in two (or more) threads believing they had created an alarm record - but the DAL only having created one entry.

I could probably had added some threading logic to that DAL to handle the situation - however give the high volume of data I decided to migrate it to SQLite.

Guess what however, it still failed.

## Problem 4 - SQLite thread concurrency
Ok, so SQLite behind the scenes treats the database as a file.  So again, there needed to be protection against multiple thread opening the underlying file.

The error I was receiving was similar to:

```
android.database.sqlite.SQLiteDatabaseLockedException: database is locked (code 5)
```

Luckily all the answers to my problems where found here in this blog: http://blog.lemberg.co.uk/concurrent-database-access

The blog provides a solution which controls multiple thread accessing the database.  I won't repeat what is an excellent explanation - go read it.

## And success
That's it.  All working.  I can now create a batch of 50 alarms (I'd expect more than anyone is likely to need).

Before I upload the code, I plan on putting some automated testing in place - linked into my Continuous Integration setup.  Hopefully should be covering that in my next blog.

gha_language: C#


text:
+++
title = "Why I love Altair"
date = 2019-01-31
draft = true
categories = ["general"]
+++

<!--more-->

It has changed how I think about visualizations. Before, visualizations were ways to display my data. Now, they are a way to *represent* my data, because I'm thinking in the language of encodings and markings, instead of axes and points.

The documentation is incredibly comprehensive. There are almost always examples for what I want to do, and figuring out how to extend examples is easy.

One of the things that took me a while to get used to is how many objects there are in the top-level namespace. Once I `import altair as alt`, I find myself using `alt.X`, `alt.Y`, `alt.Legend`, `alt.Color`, `alt.Text`, and more. At first, I wasn't a fan of this; why are there so many objects? Why can't `color` just be a string, like how matplotlib does it? Why do we need an entire class for `text`?

But I love it now. Following the Zen of Python, "explicit is better than implicit." And the documentation for these classes makes it exceptionally clear what you can and cannot do. The [docs page for `alt.Text`](https://altair-viz.github.io/user_guide/generated/core/altair.Text.html) tells you all the ways you can configure Text objects, and if you don't need them then yes, you can just use a string.

The questions people ask always have clear answers, usually by Jake VanderPlas (who is tremendously helpful!)

[One example](https://stackoverflow.com/a/57560902): the reason this doesn't work is because of an issue with how the OP was thinking about encodings. Here's a link to the docs that explains this.

[Another](https://stackoverflow.com/a/50729946): the error is attempting to tell you this, but I recognize it's not super clear. Here's the solution.

[Here](https://stackoverflow.com/a/53402880) the question is "how do you change the axis size?" The answer is "use the `configure_axis` method," plus a documentation link.

From his [Twitter](https://twitter.com/jakevdp/status/1214785248946319360):

> Once you go deep enough to absorb the idioms of the new tool or language, though, you find you can express things in ways you’d never have been able to in your familiar one...

> Because here’s the thing: programming languages and tools aren’t merely a means of expressing our thoughts: they subtly change *how* we think.

> ... it's what makes learning that new language or tool so frustrating, and also why it is so worth the effort.

gha_language: HTML


text:
## 使用示例

备份数据

    python manage.py alchemydumps create

显示已经备份的数据

    python manage.py alchemydumps history

恢复备份

    python manage.py alchemydumps restore -d<PHONE_NUMBER>2107

删除备份

    python manage.py alchemydumps remove -d<PHONE_NUMBER>2107

`autoclean`命令作用

- It keeps all the backups from the last 7 days.
- It keeps the most recent backup from each week of the last month.
- It keeps the most recent backup from each month of the last year.
- It keeps the most recent backup from each remaining year.

---

- alchemydumps github: https://github.com/cuducos/alchemydumps

repository: AngelLiang/Flask-Demos

repo_name: AngelLiang/Flask-Demos


text:
# File format specifications

File formats in bioinformatics are notoriously hard to standardize. We hope that this documentation provides the user with a clear idea of what is need as input into Swan.

## Table of contents

* [GTF](file_formats.md#gtf)
* [Abundance matrix](file_formats.md#abundance-matrix)
* [TALON db](file_formats.md#talon-db)
* [Batch add datasets config file](file_formats.md#batch-config-file)

## GTF

In Swan, transcript models are loaded from GTFs. To work with Swan, GTFs must adhere to the following specifications:

* transcript and exon entries in column 3 - this is a dependency we would like to remove in the future but for now this is the way it works
* gene\_id and transcript\_id attributes \(for transcripts and exons\) in column 9.
* recommended: including the gene\_name field will enable you to plot genes from their human-readable names as well
* any non-data header lines must begin with \#
* gene\_ids, gene\_names, and transcript\_ids must be the same across datasets for proper dataset merging
* exons must be in order under the transcript entry to which they belong

Here is an example of what the first few lines of a GTF should look like:

```text
##description: evidence-based annotation of the human genome (GRCh38), version 29 (Ensembl 94)
##provider: GENCODE
##contact<EMAIL_ADDRESS>##format: gtf
##date: 2018-08-30
chr1    HAVANA    gene    11869    14409    .    +    .    gene_id "ENSG00000223972.5"; gene_type "transcribed_unprocessed_pseudogene"; gene_name "DDX11L1"; level 2; havana_gene "OTTHUMG00000000961.2";
chr1    HAVANA    transcript    11869    14409    .    +    .    gene_id "ENSG00000223972.5"; transcript_id "ENST00000456328.2"; gene_type "transcribed_unprocessed_pseudogene"; gene_name "DDX11L1"; transcript_type "processed_transcript"; transcript_name "DDX11L1-202"; level 2; transcript_support_level "1"; tag "basic"; havana_gene "OTTHUMG00000000961.2"; havana_transcript "OTTHUMT00000362751.1";
chr1    HAVANA    exon    11869    12227    .    +    .    gene_id "ENSG00000223972.5"; transcript_id "ENST00000456328.2"; gene_type "transcribed_unprocessed_pseudogene"; gene_name "DDX11L1"; transcript_type "processed_transcript"; transcript_name "DDX11L1-202"; exon_number 1; exon_id "ENSE00002234944.1"; level 2; transcript_support_level "1"; tag "basic"; havana_gene "OTTHUMG00000000961.2"; havana_transcript "OTTHUMT00000362751.1";
```

If you are having trouble with your GTF, Swan includes a quick GTF validator which can tell you if your file seems to have an unconventional header or lacks entries needed to run Swan. It cannot tell you if your gene/transcript names/ids match across datasets, or if your exon entries are in the correct order after the corresponding transcript entry. The validator can be run as follows:

```python
import swan_vis as swan
swan.validate_gtf('test.gtf')
```

## Abundance matrix

Swan can load abundance information for more meaningful analysis and visualizations. To work with Swan, abundance matrices must:

* Be tab-separated
* Have a column containing transcript ids that are the same as those loaded via GTF or TALON db
* Have a column containing counts of each transcript for a given dataset column name

Luckily, the names of the column names to obtain transcript ids and counts from are flexible. If you were to add abundance to your SwanGraph with the following line, for instance

```python
sg = swan.SwanGraph('swan.p')
sg.add_abundance('counts_file.tsv', \
    count_cols='counts_dataset', \
    dataset_name='sg_dataset', \
    tid_col='transcript_id')
```

The corresponding abundance file should look something like this:

```text
transcript_id    counts_dataset
ENST00000623083.4    1
ENST00000416931.1    0
ENST00000457540.1    0
ENST00000414273.1    0
ENST00000621981.1    0
ENST00000514057.1    0
ENST00000411249.1    0
ENST00000445118.6    1
ENST00000441765.5    0
```

## TALON db

Swan currently works with TALON databases created with TALON v5.0+

## Batch config file

If you wish to add your datasets at the same time you can use tab-separated configuration file.

Each column should correspond to a different argument you can pass to the `add_dataset()` function, with the argument name detailed in the header. Columns can be in any order.

You can provide datasets from both a TALON db or a GTF in the config file, as well as the annotation dataset.

Arguments that you wish to use the default value for or arguments that are not necessary can be left blank. For instance, if adding from a GTF, there is no need for the `dataset_name` or `whitelist` arguments and these columns can be left blank.

Below is an example of a config file. As you can see, it adds the annotation transcriptome as well as data from a TALON database and different GTF files.

      fname
      col
      counts_file
      count_cols
      tid_col
      dataset_name
      whitelist

      0
      data/gencode.v29.annotation.gtf
      annotation
      NaN
      NaN
      NaN
      NaN
      NaN

      1
      data/talon.db
      HepG2_1
      data/all_talon_abundance_filtered.tsv
      hepg2_1
      annot_transcript_id
      hepg2_1
      data/hepg2_whitelist.csv

      2
      data/talon.db
      HepG2_2
      data/all_talon_abundance_filtered.tsv
      hepg2_2
      annot_transcript_id
      hepg2_2
      data/hepg2_whitelist.csv

      3
      data/hffc6_1_talon.gtf
      HFFc6_1
      data/all_talon_abundance_filtered.tsv
      hffc6_1
      annot_transcript_id
      hffc6_1
      data/hffc6_whitelist.csv

      4
      data/hffc6_2_talon.gtf
      HFFc6_2
      data/all_talon_abundance_filtered.tsv
      hffc6_2
      annot_transcript_id
      hffc6_2
      data/hffc6_whitelist.csv

      5
      data/hffc6_3_talon.gtf
      HFFc6_3
      data/all_talon_abundance_filtered.tsv
      hffc6_3
      annot_transcript_id
      hffc6_3
      data/hffc6_whitelist.csv


text:
---
id: 30752
title: 'Reflections of a Former Fellow: Sheba Najmi'
date: 2014-06-04T16:20:04+00:00
author: Sheba Najmi
layout: post
guid: http://www.codeforamerica.org/blog/?p=30752
permalink: /2014/06/04/reflections-of-a-former-fellow-sheba-najmi/
categories:
  - 2012 fellows
  - Fellowship
  - Honolulu
  - International
  - News
---
Part-Pakistani, part-American, I was conceived half-way across the world in Malawi, and my roots spring from the villages of rural India. Until a college scholarship brought me to America, I was a complete product of the developing world. I grew up with a fierce desire to make things better, I often wished to be Prime Minister of Pakistan so I could make things right.

I first stepped into the User Experience (UX) Design field because I wanted people to use technology and information to work together to the advantage of human beings. After 6½ years as a UX Designer at [Yahoo!](http://yahoo.com/), I set out in search of what was at the heart of my passion, enabling technology that would have a more meaningful impact on human lives.

When I chanced upon Code for America, all the pieces suddenly fell into place. I immediately loved the CfA mission, and recognized that the cross-functional culture allowed for high standards of transparency. I knew that by joining CfA I would have the opportunity to work with brilliant and diverse minds towards a common civic goal, creating solutions that make a real difference to citizens.

While working on [Honolulu Answers](http://answers.honolulu.gov/) at CfA, I realized that I had to take my newfound skills to Pakistan where governance is a mess and there is a tremendous need for civic hacking. Post fellowship, I founded [Code for Pakistan](http://codeforpakistan.org/), introducing civic hacking to the country.

In the last year, Code for Pakistan has:

  * Run 3 civic hackathons all over the country
  * Launched a [Fellowship Program](http://www.codeforpakistan.org/blog/the-peshawar-fellowship-in-focus) with 12 awesome Fellows, in partnership with a provincial government
  * Launched a [Brigade](http://www.codeforpakistan.org/blog/lahore-brigade-meetup) in another province
  * Deployed [3 open source apps](http://codeforpakistan.org/apps)
  * Led to a [civic startup](http://savareeapp.com/)

The response has been incredible; people in Pakistan are so excited about having a platform to use their skills for civic betterment. At the moment, Code for Pakistan is a volunteer-run organization, but we hope to raise funds to staff and scale it further.

In addition to Code for Pakistan, since the Fellowship, I’ve been doing a part-time UX consulting job, teaching UX classes for [Girl Develop It](http://www.girldevelopit.com/chapters/san-francisco), [UC Berkeley](http://berkeley.edu/), and [PariSoMa](http://www.parisoma.com/), consulting at the [World Bank](http://www.worldbank.org/), and learning Growth at [Tradecraft](http://tradecrafted.com/).

During the Fellowship, while working round the clock as the Project Lead for Honolulu Answers, I found myself firing on all cylinders. Being surrounded by brilliant, like-missioned thought leaders, with great support from the staff, made the Fellowship magical. I realized what it meant to have a job that didn’t feel like work, I discovered what _really_ makes me tick, and I learned a lot from others. It led directly to my next step, founding Code for Pakistan.


text:
Pattern: Multiple redirections compete for stdout

Issue: -

## Description

A file descriptor, whether stdin, stdout, stderr, or non-standard ones, can only point to a single file/pipe.

For input, many commands support processing multiple filenames. In these cases you can just specify the filenames instead of redirecting. Alternatively, you can use `cat` to merge multiple filenames into a single stream.

For output, you can use `tee` to write to multiple output sinks in parallel.

Example of **incorrect** code:

```sh
grep foo < input1 < input2 > output1 > output2 > output3
```

Example of **correct** code:

```sh
# Merge inputs into a single stream, write outputs individually
cat input1 input2 | grep foo | tee output1 output2 > output3

# Pass inputs as filenames, write outputs individually
grep foo input1 input2 | tee output1 output2 > output3
```

## Further Reading

* [ShellCheck - SC2261](https://github.com/koalaman/shellcheck/wiki/SC2261)

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

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


text:
# Ultimate Tic-Tac-Toe

### General
Rules [here](https://hacktoberfest.digitalocean.com/details)
Please use the `#hacktoberfest` label on any [Issues](https://github.com/8bitreid/ultimate-tic-tac-toe/issues) created so future Pull Request will count towards your Hacktoberfest PRs.
TODO fill in.

### Getting Started
This repo will follow the github suggested branching.  Please make your Pull Request onto the master branch.

### Contributors
Once your PR has been merged you will be added to the [Contributors](#contributors) list.

### Help
please list any help references here.
GitHub [Help](https://help.github.com)

repository: faisalkholid/ultimate-tic-tac-toe

repo_name: faisalkholid/ultimate-tic-tac-toe


text:
1,000 Genomes Phase 3 Variants
==============================

### Additional Resources
* [Schema](https://bigquery.cloud.google.com/table/genomics-public-data:1000_genomes_phase_3.variants_20150220_release?pli=1)
* [Data Provenance](http://googlegenomics.readthedocs.io/en/latest/use_cases/discover_public_data/1000_genomes.html)
* [Index of variant analyses](./sql)

### Metrics

In the following plots we display metrics computed on both 1,000 Genomes phase 1 and phase 3 variants.

### Analysis Provenance

The following query was run over 1,000 Genomes data:

1. phase 3 variantsfor 2,504 individuals and materialized to table [google.com:biggene:1000genomes_analysis_results.phase3_metrics](https://bigquery.cloud.google.com/table/google.com:biggene:1000genomes_analysis_results.phase3_metrics?pli=1)
2. phase 1 variants for 1095 individuals and materialized to table [google.com:biggene:1000genomes_analysis_results.phase1_metrics](https://bigquery.cloud.google.com/table/google.com:biggene:1000genomes_analysis_results.phase1_metrics?pli=1)
    * note that 1,092 individuals have variants across the entire genome
    * two individuals have variants on chrM only
    * one individual has variants on chrY only

Note that it was written to specifically handle the multi-allelic data found in phase 3.

```
# Compute several common metrics on multi-allelic data in "multi-sample variants" format
# http://googlegenomics.readthedocs.io/en/latest/use_cases/load_data/multi_sample_variants.html
#
# Edit the BigQuery table name below to run this query on other data in multi-sample variants format
# such as 1,000 Genomes phase 1 variants.
# http://googlegenomics.readthedocs.io/en/latest/use_cases/discover_public_data/1000_genomes.html
#
SELECT
  call.call_set_name,
  # Ratios.
  transitions_count / transversions_count AS ti_tv_ratio,
  (het_RA_count + 2 * het_AA_count) / hom_AA_count AS het_hom_ratio,
  insertion_count / deletion_count AS ins_del_ratio,
  # Call type counts.
  hom_RR_count,
  hom_AA_count,
  het_RA_count,
  het_AA_count,
  # Alternate allele type counts.
  sv_count,
  snp_count,
  expanded_snp_count,
  insertion_count,
  deletion_count,
  # SNP type counts.
  transitions_count,
  transversions_count,
  # Let's check our work for over/under counting.
  calls_has_alternate_bases_count,
  transitions_count + transversions_count AS check_snp_count,
  sv_count + snp_count + expanded_snp_count + insertion_count + deletion_count AS check_calls_has_alternate_bases_count,
  hom_RR_count + hom_AA_count + het_RA_count + het_AA_count AS check_total_num_calls,
FROM (
  SELECT
    call.call_set_name,
    SUM(is_hom_RR) AS hom_RR_count,
    SUM(is_hom_AA) AS hom_AA_count,
    SUM(is_het_RA) AS het_RA_count,
    # Divide by het_AA two since we have two rows for this sample's alleles because we FLATTENED by alt.
    SUM(is_het_AA)/2 AS het_AA_count,
    SUM(call_has_alternate_bases) AS calls_has_alternate_bases_count,
    SUM(call_has_alternate_bases AND is_sv) AS sv_count,
    SUM(call_has_alternate_bases AND is_snp) AS snp_count,
    SUM(call_has_alternate_bases AND is_expanded_snp) AS expanded_snp_count,
    SUM(call_has_alternate_bases AND is_insertion) AS insertion_count,
    SUM(call_has_alternate_bases AND is_deletion) AS deletion_count,
    SUM(call_has_alternate_bases AND is_transition) AS transitions_count,
    SUM(call_has_alternate_bases AND is_transversion) AS transversions_count,
  FROM (
    SELECT
      call.call_set_name,
      # Anchor on alt=1 so that we don't over count multi-allelic sites.
      alt = 1 AND reference_match_call AS is_hom_RR,
      first_allele = alt OR second_allele = alt AS call_has_alternate_bases,
      first_allele = alt AND (second_allele = alt OR second_allele IS NULL) AS is_hom_AA,
      (first_allele = 0 AND second_allele = alt) OR (first_allele = alt AND second_allele = 0) AS is_het_RA,
      (first_allele > 0 AND first_allele != alt AND second_allele = alt)
        OR (first_allele = alt AND second_allele > 0 AND second_allele != alt) AS is_het_AA,
      NOT is_sequence AS is_sv,
      is_sequence AND LENGTH(reference_bases) = 1 AND LENGTH(alternate_bases) = 1 AS is_snp,
      is_sequence AND LENGTH(reference_bases) > 1 AND LENGTH(reference_bases) = LENGTH(alternate_bases) AS is_expanded_snp,
      is_sequence AND LENGTH(reference_bases) < LENGTH(alternate_bases) AS is_insertion,
      is_sequence AND LENGTH(reference_bases) > LENGTH(alternate_bases) AS is_deletion,
      mutation IN ('A->G','G->A','C->T','T->C') AS is_transition,
      mutation IN ('A->C','C->A','G->T','T->G','A->T','T->A','C->G','G->C') AS is_transversion,
    FROM (
      SELECT
        call.call_set_name,
        reference_name,
        start,
        reference_bases,
        alternate_bases,
        CONCAT(reference_bases, CONCAT(STRING('->'), alternate_bases)) AS mutation,
        REGEXP_MATCH(alternate_bases, r'^[A,C,G,T]+$') AS is_sequence,
        alt,
        reference_match_call,
        first_allele,
        second_allele,
      FROM
        # 1,000 Genomes phase 3 is multi-allelic so we need to take in to account the alternate number.
        # Be careful with the analyses that wrap this because this double FLATTEN is giving us the cross
        # product of 'alternate_bases' and 'call'.
        FLATTEN( FLATTEN((
            SELECT
              reference_name,
              start,
              reference_bases,
              alternate_bases,
              POSITION(alternate_bases) AS alt,  # Get the number corresponding to the alternate_bases value.
              call.call_set_name,
              EVERY(call.genotype = 0) WITHIN call AS reference_match_call,
              NTH(1, call.genotype) WITHIN call AS first_allele,
              NTH(2, call.genotype) WITHIN call AS second_allele,
            FROM
              # To run on phase 1 variants, update the following line to change the source table.
              [genomics-public-data:1000_genomes_phase_3.variants_20150220_release]
            # Use this WHERE clause for fast testing of the query. Remove it for the full analysis.
            # WHERE
            #   reference_name = '17'
            #   AND start BETWEEN 41196311
            #   AND 41277499
         ), call), alt)))
  GROUP BY
    call.call_set_name
  ORDER BY
    call.call_set_name)
```

repository: alenzhao/bigquery-examples

repo_name: alenzhao/bigquery-examples


text:
# Schedule Generator Demo
### Branch-and-Prune Discrete Optimization

Companion blog article can be [found here](https://towardsdatascience.com/sudokus-and-schedules-60f3de5dfe0d).

## YouTube Walkthrough

[![](https://img.youtube.com/vi/2iZBcVr5OaQ/hqdefault.jpg)](https://www.youtube.com/watch?v=2iZBcVr5OaQ)

## Abstract

This was an exercise at creating a class schedule generator using [branch-and-prune optimization](https://en.wikipedia.org/wiki/Branch_and_bound) and constraint propogation.

I initially used [Kotlin](http://kotlinlang.org/) with [ojAlgo](http://www.ojalgo.org/), which turned out to be effective. However, I found implementing from scratch gave me more control and allowed me to optimize for the specific problem. Both implementations are in this repo.

For now, the model just assumes we are scheduling against one room.

## Data Input

Here is the starting data set:

**Classrooms:**

1) Psych 101 (1 hour, 2 sessions/week)
2) English 101 (1.5 hours, 2 sessions/week)
3) Math 300 (1.5 hours, 2 sessions/week)
4) Psych 300 (3 hours, 1 session/week)
5) Calculus I (2 hours, 2 sessions/week)
6) Linear Algebra I (2 hours, 3 sessions/week)
7) Sociology 101 (1 hour, 2 sessions/week)
8) Biology 101 (1 hour, 2 sessions/week)
9) Supply Chain 300 (2.5 hours, 2 sessions/week)
10) Orientation 101 (1 hours, 1 session/week)

I set the model to put each recurring session 48 hours apart.

**Availability for each day Monday-Friday:**

* 8:00AM-11:30AM
* 1:00PM-5:00PM

## Output

```
Psych 101- MONDAY/WEDNESDAY 13:00-14:00
English 101- MONDAY/WEDNESDAY/FRIDAY 08:00-09:30
Math 300- MONDAY/WEDNESDAY 14:00-15:30
Psych 300- FRIDAY 13:00-16:00
Calculus I- TUESDAY/THURSDAY 08:00-10:00
Linear Algebra I- MONDAY/WEDNESDAY/FRIDAY 09:30-11:30
Sociology 101- MONDAY/WEDNESDAY 15:30-16:30
Biology 101- TUESDAY/THURSDAY 10:00-11:00
Supply Chain 300- TUESDAY/THURSDAY 13:00-15:30
Orientation 101- TUESDAY 15:30-16:30
```

![](kotlin_from_scratch_solution/output.png)

Obviously, a room cannot be occupied by more than one class at any time. The solver does this successfully and prevents any overlap in scheduling.

## How to Execute

Build the Kotlin project with Gradle, then run the `main()` function inside the `InputAndRun.kt` file. You can also change the hardcoded inputs in that file too.

The optimizer should hopefully run in a few seconds and then display the schedule in the console output.

## Resources

[Coursera Class on Discrete Optimization](https://www.coursera.org/learn/discrete-optimization/home/welcome)


text:
# LoanDataEDA

Problem Statement:-

The financial organization has history data of loan request it has received. It has sactioned some loans and rejected some.
It has some information on present status of those loans and the profile of the loan requestor.
Currently it has the loan requests on which decision is pending.

The orgnization wants you to ananlyze the data and suggest:-
  1. which section/request to aviod to reduce monetary loss/loan defaults.
  2. Which section/request to actively peruade to avoid missed business opportunity.

Solution/Approach:-

I have tried to perform the EDA on provided 2 datasets. I have used jupiter notebook.
The intention was to find pattern in data and make suggestions to organization.

repository: ayushabhinav/LoanDataEDA

repo_name: ayushabhinav/LoanDataEDA


text:
---
layout: post
title: iPad 'Unlimited' Data Plan Extended To July

tags: 3g Data,Apple,At&Amp;T,Cell Phones,Internet,Ipad,Iphone,Technology
---
I was reading Engadget.com today
and I came across this
tidbit about AT&T deciding to allow iPad orders before July 7th to
continue to have the unlimited data plan. For those of you that read my
iPad vs. AT&T blog post it highlights all of the points that AT&T
seems to have forgotten when they first decided to change how they are
going to handle their data plans. The facts are simple - most iPhone
users consume between 200-500MB worth of data, and (from AT&T's
metrics) the 98% of all iPhone subscribers use less than 2GB of data
per month. But what they did not include is the metrics from the month
long usage of the iPad. Due to streaming applications such as Netflix
the iPad itself is absolutely going to use more data.

The major data consumption on the Internet is audio and video, both of
which applications on the iPad are designed specifically for, whether
it be watching a movie
streaming from Netflix, a baseball game through
the MLB application or television
through your Slingplayer - it is very clear that this device is
going to overall trump the usage of a standard iPhone. You can bet
your wallet that the widely popular service Hulu.com will be eyeing up developing an
application for the iPad as well.

With all of these data heavy applications that 2GB cap is going to be
quickly approached. Of course the AT&T suggestion is to use WiFi as
often as you can, but why should you have to? This device was designed
to run on battery for roughly ten hours, so why should I be
tethered to my apartment, office or coffee shop? Most people purchased
this device because they planned on reading, listening to music or
watching movies on their daily commute into the office. Others may
have picked it up to placate their children on long car rides. You're
telling us now, after we purchased the device, to not use it for what
we purchased it for?

I am still on the edge about whether or not I will purchase a 3G iPad
before July 7th. Part of me cannot justify spending this much money on
a device that I do not see myself using all too often, but the other
part of me, the commuter, sees all the ways that I can use this thing
to keep my mind busy on the train into work. Yet still another half of
me wants to develop some cool games for this beast. So the real
question is, do I wait until later or purchase it now to take
advantage of the unlimited 3G data offer? I think the answer is pretty
obvious, how about you?


text:
Snap.swift - Snapshot testing in a snap 🎨

`Snap.swift` is a snapshot testing library to facilitate the UI testing of your views.

### 🤖 Requirements

* iOS 9.0+
* tvOS 10.0+
* Xcode 9.0+
* Swift / Objective-C

### 🎨 Why test the UI?
You want to make sure that every time you touch any of your UI elements everything stays as they way they were meant to be, also this kind of integration test help you achieve the pixel perfect views and make your designers happy by having design reference images that they can see even in your pull requests.

### ⚡ How does it work?
Works by generating a reference image that gets stored in your repository and then comparing each new test case with the `reference image` to check if there are any differences. If test found any differences it will add an attachment into your test case and you'll be able to check what changed

![Project attachment](.art/xcode_attachment.png)

### 🛠 Configuration

In order to configure the snapshot test folder, we need to add a new environment variable to the project with name `SNAP_REFERENCE_IMAGE_PATH` and value `$(SOURCE_ROOT)/$(PROJECT_NAME)Tests/` so `Snap.swift` can find the folder to store the reference images.

It is also very important that the "Shared" checkbox at the very bottom is activated, so those settings are tracked in your repo and shared with your team.

If the configuration was correctly set the project should look like this:

![Project attachment](.art/xcode_project_environment_variable.png)

> Errored images and diffed one's are stored into `$PATH/Snap/Failed` and `$PATH/Snap/Diff`, if you want you can add those paths into `.gitignore` as these are not needed for `Snap.swift` to work.

### 🎯 Installation

Snap.swift is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod 'Snap.swift'
```

To install with [Carthage](https://github.com/Carthage/Carthage) add the following line to your `Cartfile`:
```
github "skyweb07/Snap.swift"
```

### ✅ Creating our first test

1) We first need to record our reference images, in order to do so we have to first go into our test class and set the `isRecording` variable to be `true` so the library knows that we are in record mode and can extract the `reference images`

> Swift

```swift
import XCTest
import Snap

class SnapTests: XCTestCase {

  override func setUp() {
    super.setUp()
    isRecording = true
  }

  func test_box_with_text_aligned_to_center() {
    let view = BoxWithTextAlignedToCenterView()

    expect(view).toMatchSnapshot()
  }
}
```

> Objective-c
```objc
@import XCTest;
#import <Snap/Snap-swift.h>
#import <Snap/Snap.h>

@interface SnapTests : XCTestCase
@end

@implementation SnapTests

- (void)setUp {
  [super setUp];
  self.isRecording = YES;
}

- (void)test_box_with_text_aligned_to_center {

  UIView *view = [BoxWithTextAlignedToCenterView new];

  verifyView(view);
}

@end

```

After executing out test suite if everything was ok we should see that all of our tests failed with a warning similar to

```bash
⚠ Test ran in record mode, reference image has been saved to $SNAP_REFERENCE_IMAGE_PATH/testcase.png, now remove `isRecording` in order to perform the snapshot comparison.

```

This is ok, it just means that our reference images were saved, we can inspect them in our `reference image` directory, we should normally add these into `git`  so we can compare against them.

#### ⚠ Warning
> *Remember to remove the `isRecording` flag after generating your reference images or you won't be able to do the image comparison*

### Multiple device snapshots

If you want to take multiple device snapshots at once it's as simple as:

```swift
expect(view).toMatchSnapshot(for devices: [.iphone4, .iphone5s]) // A list of devices

// or

expect(view).toMatchSnapshot(for: .allDevices) // All supported
```

### 📝 Notes

> As today, you can make assertions on `UIView` and `CALayer` classes.

This project is highly inspired on `Facebook` [FBSnapshotTestCase](https://github.com/facebookarchive/ios-snapshot-test-case/) library, it seems that they had archived the library so I started this one to continue envolving the project and continue with mobile `snapshot-testing`

### 😬 Contributions
- Open an [issue](https://github.com/skyweb07/Snap.swift/issues/new)
- Add suggestions or fix [issues](https://github.com/skyweb07/Snap.swift/issues) by opening PR's
- Send me a message via [Twitter](https://twitter.com/skyweb07)

### Android

If you want to apply the same testing technique on Android you can use [Shot](https://github.com/Karumi/Shot)

### ⚖ License
```bash
MIT License

Copyright (c) 2017-Present Oscar Antonio Duran Grillo

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

 IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```

branch_name: refs/heads/develop

gha_language: Swift