text:
'use strict'

/**
 * this services manages and mantains the cart status.
 * There are several methods to interact with the API (ex. removing products, update the cart, add a product etc.)
 * There are two different local carts : one for the unlogged user and one for the logged user.
 * Every methods can select the right one checking the $rootScope.loggedIn status (boolean).
 */
angular.module('provaMrkCldApp')
  .factory('cartFactory', function ($rootScope,$window,$location,$log) {

    var localCartUnloggedUser = [];
    var localCartLoggedUser = [];

    //setted when the user logs in or logs out.
    var remoteCartId = null;

    //Exposes the functions for the external classes
    var exposeCart = {};

    /*
     * retrieves the cart
     */
    exposeCart.getLocalCart = function () {
      if ($rootScope.loggedIn) {
        genProductVariantsName(localCartLoggedUser)
        return localCartLoggedUser;
      }
      else {
        genProductVariantsName(localCartUnloggedUser)
        return localCartUnloggedUser;
      }
    }

    /*
     Sets the cart id
     */
    exposeCart.setRemoteCartId = function (ID) {
      $log.log("Setting remoteCartId as " + ID);
      remoteCartId = ID;
    };

      /**
       * counts how many elements a cart contains
       * @param cart you can also insert a custom cart (for debug purposes)
       * @returns {number}
       * THIS METHOD IS NOT EXPOSED. IF YOU WANT TO CALL IT FROM A
       * DIFFERENT CLASS CHECK exposeCart.exposeGetCount()
       */
    function getCount(cart) {
      var quantity = 0;

      if (cart) {
        for (var i = 0; i < cart.items.length; i++) {
          quantity += cart.items[i].quantity;
        }
        return quantity;
      }

      if ($rootScope.loggedIn) {

        for (var i = 0; i < localCartLoggedUser.items.length; i++) {
          quantity += localCartLoggedUser.items[i].quantity;
        }
      } else {

        /*
        prevents unwanted behaviour if updating page when cart view is on

        if (localCartUnloggedUser.items == undefined) {
          $window.location.assign('/#');
          return;
        }*/

        for (var i = 0; i < localCartUnloggedUser.items.length; i++) {
          quantity += localCartUnloggedUser.items[i].quantity;
        }
      }
      return quantity;
    }

    //Exposes the getCount() method
    exposeCart.exposeGetCount = function () {
      return getCount();
    }

    /*
     * Obtains the total price from the products in the cart.
     */
    exposeCart.getPrice = function() {
      var price = 0;
      if($rootScope.loggedIn) {
        if(localCartLoggedUser.items.length == 0) return 0;

        var tempItems = localCartLoggedUser.items;

        for(var i = 0; i < tempItems.length; i++ ) {
          price += (tempItems[i].quantity * tempItems[i].price );
        }
      } else {

        if(localCartUnloggedUser.items == undefined){
          return; //prevent exception
        }

        if(localCartUnloggedUser.items.length == 0) return 0;
        tempItems = localCartUnloggedUser.items;

        for(var i = 0; i < tempItems.length; i++ ) {
          price += (tempItems[i].quantity * tempItems[i].price );
        }

      }
      $log.debug("Price is: " +price);
      return price;
    }

    /**
     * Creates a new cart
     */
    exposeCart.createCart = function () {
      /*
        If the storage value with the cart id is not available, a new empty cart will be created and its id will be saved
        in a new storage value.
        This cart is not user-related. It means that the user is currently not logged in.
        The id will be stored in a storage value.
       */
      $log.info("exposeCart.createCart()")
      $log.info("marketcloud.storage.get('mc-cart-id')    -> "+marketcloud.storage.get('mc-cart-id'))

      if(marketcloud.storage.get('mc-cart-id') == null) {
        marketcloud.carts.create({}, function (err, cart) {
          $log.info("chiama carts.create")

          marketcloud.storage.set("mc-cart-id",cart.id)
          $log.log("storage.set setted @ 'mc-cart-id' -> "+marketcloud.storage.get("mc-cart-id"));

          //sets the remote cart id with the new cart id
          exposeCart.setRemoteCartId(cart.id);
          //sets the local cart with the new cart
          exposeCart.setLocalCart(cart);
          if (err) {
            alert("Critical error in creating a new cart: see log")
            $log.error(err)
          }
        });
      }
      else {
        /* If there was a storage value with a cart id, the cart will be retrieved from the API.
         */
        marketcloud.carts.getById(marketcloud.storage.get('mc-cart-id'), function (err, cart) {
          $log.info("chiama carts.getById")

          if (cart == null) {
            //if for some reason the cart has not been retrieved, a new one will be created
            marketcloud.storage.del('mc-cart-id')
            exposeCart.createCart();
            return
          }
          //Cart has been retrieved. The id and the new cart will be setted.
          exposeCart.setRemoteCartId(cart.id);
          exposeCart.setLocalCart(cart);
          $log.info(cart)
          $rootScope.$broadcast('cartUpdated', getCount(), exposeCart.getPrice());

          if (err) {
            alert("Critical error in creating a new cart: see log")
            $log.error(err)
          }
        });
      }
    }

    /**
     * If an user has just logged in, the app will try to retrieve  the user cart from the API.
     */
    exposeCart.createUserCart = function () {
      $log.info("exposeCart.createUserCart")
      marketcloud.carts.getByUser(function (err, cart) {
        if (err) {
          $log.warn("Critical error in retrieving the user cart. A new one will be created ")
        }
        if (cart == undefined || cart.items == undefined) {
          //There were no user-related cart. A new user cart will be created.
          marketcloud.carts.create({}, function (err, newCart) {
            $log.warn("//There were no user-related cart. A new user cart will be created.")
            cart = newCart;
            exposeCart.setRemoteCartId(cart.id);

            if (err) {
              alert("Critical error in creating a new user cart: see log")
              $log.error(err)
            }
            exposeCart.setLocalCart(cart);
          });
        } else {
          //if everything went ok, the user-cart has been retrieved from the API
          $log.info("//if everything went ok, the user-cart has been retrieved from the API")
          exposeCart.setLocalCart(cart);
          exposeCart.setRemoteCartId(cart.id);
        }
        $log.info("Calling  exposeCart.switchToLoggedCart(); ")
        /**
         * IF THE UNLOGGED CART HAD SOME PRODUCTS INSIDE, THE USER CAN CHOOSE TO TRANSFER THESE PRODUCTS
         * IN HIS CART (THE USER-RELATED ONE).
         */
        if (localCartUnloggedUser.items != undefined) {
          $log.warn("There are some products to transfer? -> ", localCartUnloggedUser.items);
          exposeCart.switchToLoggedCart();
        }
      });
    }

    /**
     * empties the cart
     */
    exposeCart.cleanCart = function () {
      if (($rootScope.loggedIn) && localCartLoggedUser != undefined && localCartLoggedUser.items.length != 0) {

        var arrayLength = localCartLoggedUser.items.length;
        $log.debug("lunghezza array -> " + arrayLength)

        var productsToRemove = [];
        for (var z = 0; z < arrayLength; z++) {
          var lastId = {'product_id': localCartLoggedUser.items[z].id, 'variant_id' : localCartLoggedUser.items[z].variant_id};
          if (lastId.product_id == undefined) { //fixes an old bug in the API.
            $log.warn("lastId was undefined")
            lastId = {'product_id': localCartLoggedUser.items[z].product_id, 'variant_id' : localCartLoggedUser.items[z].variant_id};
          }
          productsToRemove.push(lastId);
        }

        marketcloud.carts.remove(remoteCartId, productsToRemove, function (err, data) {
          $log.warn("remoteCartId è " +remoteCartId +", oggetti da rimuovere è ",productsToRemove)
          if (data.items.length != 0) {
            alert("Critical error in carts.remove (see log)")
            $log.error(err)
            return;
          }
          localCartLoggedUser = data;

          $rootScope.$broadcast('cartUpdated', getCount(), exposeCart.getPrice());
        });
      }
      else if ((!$rootScope.loggedIn && localCartUnloggedUser != undefined && localCartUnloggedUser.items.length != 0)) {
        localCartUnloggedUser.items = [];
        marketcloud.storage.del('mc-cart-id');
        $log.debug("marketcloud.storage.get(mc-cart-id') is "+ marketcloud.storage.get(mc-cart-id));
        exposeCart.createCart();
        $rootScope.$broadcast('cartUpdated', getCount(), exposeCart.getPrice());
      }
    }

      /**
       * Updates the cart
       * @param updateList -> Contains id, quantity and variant Id of the products to update.
       * es {product_id: 3, quantity: 4}
       */
      exposeCart.updateCart = function (updateList) {
      $log.info("UpdateCart() \n updateList is " ,updateList)
      marketcloud.carts.update(remoteCartId, updateList, function (err, res) {
        if (err) {
          alert("Critical error in updating cart: see log")
          $log.error(err)
        }
        else {
          $log.info("Cart updated. Data is ",res)
        }
      });
    }

    /**
     * Adds a product to the cart.
     * @param product
     */
    exposeCart.addToCart = function (product) {
      if (!$rootScope.loggedIn) { //unlogged user

        //send the request to the server
        marketcloud.carts.add(remoteCartId, [{product_id: product.id, quantity: product.quantity, variant_id: product.variant}], function (err, cart) {
          if (err) {
            alert("Critical error in Adding item to remote cart: see log\n")
            $log.log(err)
            $log.log(product.id + " - " +product.quantity)
          }
          else {
            localCartUnloggedUser = cart;
          }
          $rootScope.$broadcast('cartUpdated', getCount(), exposeCart.getPrice());
        });
      } else { //logged user
        $log.log(product)
        $log.info("logged user: adding product to the cart with id " + remoteCartId);

        //send the request to the server
        marketcloud.carts.add(remoteCartId, [{product_id: product.id, quantity: product.quantity, variant_id: product.variant}], function (err, cart) {
          if (err) {
            alert("critical error in Adding item to remote cart\n")
            $log.log(err)
            $log.log(product.id + " - quantity : " + product.quantity + " - variant : " + product.variant)
          }
          else {
            localCartLoggedUser = cart;
          }
          $rootScope.$broadcast('cartUpdated', getCount(), exposeCart.getPrice());
        });
      }
    };

    /*
     * Removes a single product from the actual cart
     */
    exposeCart.removeProduct = function (id, variantId) {

      $log.log("Removing object with  id " + id + " and variantId " +variantId);
      marketcloud.carts.remove(remoteCartId, [{'product_id': id, 'variant_id': variantId}], function (err, data) {
        if (err) {
          alert("Critical error in removing product with id " + id + ": see log");
          $log.error(err)
          return;
        }
        $log.info("product removed. cart is now ", data)
        if ($rootScope.loggedIn) {
          localCartLoggedUser = data;
        } else {
          localCartUnloggedUser = data;
        }
        $rootScope.$broadcast('cartUpdated', getCount(), exposeCart.getPrice());
        return;
      });
    }

    /**
     * sets the local cart regarding the cart retrieved from the server
     * @param data cart retireved from the server
     */
    exposeCart.setLocalCart = function (data) {
      if (!$rootScope.loggedIn) {
        $log.log("setting  for unlogged user")

        localCartUnloggedUser = data;
      }
      else {
        $log.log("setting for logged user")

        localCartLoggedUser = data;
      }
      $rootScope.$broadcast('cartUpdated', getCount(), exposeCart.getPrice());
    };

    /*
     This method is called when a user logs in and there were some products in his (unlogged) cart.
     The user can ask for moving the products from the old cart to his own (the cart retireved from the API)
     */
    exposeCart.switchToLoggedCart = function () {
      var productsText = '<div class="Cart recap panel-body"' +
        '
your old cart:

';

      var productToTransfer = localCartUnloggedUser.items;

      if (productToTransfer == undefined || (productToTransfer.length == undefined || productToTransfer.length == 0)) {
        $log.info("no products need to be transfered!")
        return;
      }

      if (!$rootScope.loggedIn) {
        alert("Critical Error - at this point $rootScope.loggedIn should be TRUE")
        return;
      }

      //temporary array with products ids and quantities
      var tempArray = [];

      //Displays a text with all the products that need to be transfered
      for (var i = 0; i < productToTransfer.length; i++) {
        productsText += '
 ' + productToTransfer[i].quantity + 'x -  ' + productToTransfer[i].name + '
';
        var obj = {product_id: productToTransfer[i].id, quantity: productToTransfer[i].quantity, variant_id: productToTransfer[i].variant_id }
        tempArray.push(obj);
      }

      productToTransfer = tempArray;
      $log.info("Some products need to be transfered: ", productToTransfer);

      tempArray = null;
      productsText += '

';

      swal({
        title: "Do you want to merge the carts?",
        text: productsText,
        type: "info",
        html: true,
        showCancelButton: true,
        closeOnConfirm: false,
      }, function (isConfirm) {
        if (isConfirm) {
          marketcloud.carts.add(remoteCartId, productToTransfer, function (err, cart) {
            if (err) {
              alert("Critical Error - at this point $rootScope.loggedIn should be TRUE")
              $log.error(err);
              swal.close();
              return;
            } else {
              $log.info("returned cart -> ", cart);
              localCartLoggedUser = cart;
              swal.close();
            }

            localCartUnloggedUser.items = [];
            marketcloud.storage.del('mc-cart-id')

            $rootScope.$broadcast('cartUpdated', getCount(), exposeCart.getPrice());
          });
        } else {
          localCartUnloggedUser.items = [];
          productToTransfer = [];
          marketcloud.storage.del('mc-cart-id')
          swal.close();
          return;
        }
      });
    }

    //----debug methods-----
    /**
     |DEBUG| carts logs
     */
    exposeCart.getCartLog = function () {
      if ($rootScope.loggedIn) {
        $log.info(localCartLoggedUser)
      } else {
        $log.info(localCartUnloggedUser)
      }
    }
    //End----DEBUG-----

    //TODO In future, the Javascript SDK could contain a similar utility.
    //Utility function to rename the products with variants.
    var genProductVariantsName = function(cart) {
      $log.info("Called genProductVariantsName")
      $log.log("cart is " ,cart)

      if (cart.length == 0) {
        return
      }

      var tempString = ""
      for (var i = 0; i < cart.items.length; i++) {

         if (cart.items[i].has_variants && !cart.items[i]["nameChanged"]) {
           var keysArray = [];
           for (var key in cart.items[i].variantsDefinition) {
             if (cart.items[i].variantsDefinition.hasOwnProperty(key)) {
               keysArray.push(key);
             }
           }
           for (var key in keysArray) {
             $log.info("Looking for key -> " +keysArray[key])
             var thisKey = keysArray[key]
             $log.info("Checking ... ",cart.items[i].variant)

             if(cart.items[i].variant == undefined) {
               var tempVarId = cart.items[i].variant_id
               tempString += cart.items[i].variants[tempVarId][thisKey] + " "
             } else {

               tempString += cart.items[i].variant[thisKey] + " "
               $log.info("Tempstring is " + tempString)
             }
           }
             cart.items[i]["name"] = cart.items[i]["name"] + " | " + tempString
             cart.items[i]["nameChanged"] = true
         }
      }
    }

    return exposeCart;
  });


text:
<?php

namespace Drupal\locale\Tests;

use Drupal\Core\Asset\AttachedAssets;
use Drupal\simpletest\WebTestBase;

/**
 * Tests localization of the JavaScript libraries.
 *
 * Currently, only the jQuery datepicker is localized using Drupal translations.
 *
 * @group locale
 */
class LocaleLibraryAlterTest extends WebTestBase {

  /**
   * Modules to enable.
   *
   * @var array
   */
  public static $modules = array('locale');

  /**
   * Verifies that the datepicker can be localized.
   *
   * @see locale_library_alter()
   */
  public function testLibraryAlter() {
    $assets = new AttachedAssets();
    $assets->setLibraries(['core/jquery.ui.datepicker']);
    $js_assets = $this->container->get('asset.resolver')->getJsAssets($assets, FALSE)[1];
    $this->assertTrue(array_key_exists('core/modules/locale/locale.datepicker.js', $js_assets), 'locale.datepicker.js added to scripts.');
  }

}

redpajama_set_name: RedPajamaGithub


text:
package com.facebook.litho;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import android.graphics.Rect;
import com.facebook.litho.animation.AnimatedProperties;
import com.facebook.litho.animation.AnimatedProperty;
import com.facebook.litho.animation.PropertyAnimation;
import com.facebook.litho.animation.PropertyHandle;
import com.facebook.litho.animation.SpringTransition;
import com.facebook.litho.animation.TransitionAnimationBinding;
import com.facebook.litho.testing.testrunner.LithoTestRunner;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;

/** Tests for the creation of animations using the targeting API in {@link Transition}. */
@RunWith(LithoTestRunner.class)
public class TransitionManagerAnimationCreationTest {

  private TransitionManager mTransitionManager;
  private Transition.TransitionAnimator mTestVerificationAnimator;
  private ArrayList<PropertyAnimation> mCreatedAnimations = new ArrayList<>();

  @Before
  public void setup() {
    mTransitionManager =
        new TransitionManager(
            new TransitionManager.OnAnimationCompleteListener() {
              @Override
              public void onAnimationComplete(TransitionId transitionId) {}

              @Override
              public void onAnimationUnitComplete(PropertyHandle propertyHandle, Object data) {}
            },
            (AnimationsDebug.ENABLED ? AnimationsDebug.TAG : null),
            ComponentsSystrace.getSystrace());
    mTestVerificationAnimator =
        new Transition.TransitionAnimator() {
          @Override
          public TransitionAnimationBinding createAnimation(PropertyAnimation propertyAnimation) {
            mCreatedAnimations.add(propertyAnimation);
            return new SpringTransition(propertyAnimation);
          }
        };
  }

  @After
  public void tearDown() {
    mTransitionManager = null;
    mCreatedAnimations.clear();
  }

  @Test
  public void testCreateSingleAnimation() {
    final LayoutState current =
        createMockLayoutState(Transition.parallel(), createMockLayoutOutput("test", 0, 0));
    final LayoutState next =
        createMockLayoutState(
            Transition.parallel(
                Transition.create(Transition.TransitionKeyType.GLOBAL, "test")
                    .animate(AnimatedProperties.X)
                    .animator(mTestVerificationAnimator)),
            createMockLayoutOutput("test", 10, 10));

    mTransitionManager.setupTransitions(
        current, next, TransitionManager.getRootTransition(next.getTransitions()));

    assertThat(mCreatedAnimations)
        .containsExactlyInAnyOrder(createPropertyAnimation("test", AnimatedProperties.X, 10));
  }

  @Test
  public void testCreateMultiPropAnimation() {
    final LayoutState current =
        createMockLayoutState(Transition.parallel(), createMockLayoutOutput("test", 0, 0));
    final LayoutState next =
        createMockLayoutState(
            Transition.parallel(
                Transition.create(Transition.TransitionKeyType.GLOBAL, "test")
                    .animate(AnimatedProperties.X, AnimatedProperties.Y)
                    .animator(mTestVerificationAnimator)),
            createMockLayoutOutput("test", 10, 10));

    mTransitionManager.setupTransitions(
        current, next, TransitionManager.getRootTransition(next.getTransitions()));

    assertThat(mCreatedAnimations)
        .containsExactlyInAnyOrder(
            createPropertyAnimation("test", AnimatedProperties.X, 10),
            createPropertyAnimation("test", AnimatedProperties.Y, 10));
  }

  @Test
  public void testCreateMultiPropAnimationWithNonChangingProp() {
    final LayoutState current =
        createMockLayoutState(Transition.parallel(), createMockLayoutOutput("test", 0, 0));
    final LayoutState next =
        createMockLayoutState(
            Transition.parallel(
                Transition.create(Transition.TransitionKeyType.GLOBAL, "test")
                    .animate(AnimatedProperties.X, AnimatedProperties.Y)
                    .animator(mTestVerificationAnimator)),
            createMockLayoutOutput("test", 10, 0));

    mTransitionManager.setupTransitions(
        current, next, TransitionManager.getRootTransition(next.getTransitions()));

    assertThat(mCreatedAnimations)
        .containsExactlyInAnyOrder(createPropertyAnimation("test", AnimatedProperties.X, 10));
  }

  @Test
  public void testCreateMultiComponentAnimation() {
    final LayoutState current =
        createMockLayoutState(
            Transition.parallel(),
            createMockLayoutOutput("test1", 0, 0),
            createMockLayoutOutput("test2", 0, 0));
    final LayoutState next =
        createMockLayoutState(
            Transition.parallel(
                Transition.create(Transition.TransitionKeyType.GLOBAL, "test1", "test2")
                    .animate(AnimatedProperties.X)
                    .animator(mTestVerificationAnimator)),
            createMockLayoutOutput("test1", 10, 10),
            createMockLayoutOutput("test2", -10, -10));

    mTransitionManager.setupTransitions(
        current, next, TransitionManager.getRootTransition(next.getTransitions()));

    assertThat(mCreatedAnimations)
        .containsExactlyInAnyOrder(
            createPropertyAnimation("test1", AnimatedProperties.X, 10),
            createPropertyAnimation("test2", AnimatedProperties.X, -10));
  }

  @Test
  public void testSetsOfComponentsAndPropertiesAnimation() {
    final LayoutState current =
        createMockLayoutState(
            Transition.parallel(),
            createMockLayoutOutput("test1", 0, 0),
            createMockLayoutOutput("test2", 0, 0));
    final LayoutState next =
        createMockLayoutState(
            Transition.parallel(
                Transition.create(Transition.TransitionKeyType.GLOBAL, "test1", "test2")
                    .animate(AnimatedProperties.X, AnimatedProperties.Y)
                    .animator(mTestVerificationAnimator)),
            createMockLayoutOutput("test1", 10, 10),
            createMockLayoutOutput("test2", -10, -10));

    mTransitionManager.setupTransitions(
        current, next, TransitionManager.getRootTransition(next.getTransitions()));

    assertThat(mCreatedAnimations)
        .containsExactlyInAnyOrder(
            createPropertyAnimation("test1", AnimatedProperties.X, 10),
            createPropertyAnimation("test1", AnimatedProperties.Y, 10),
            createPropertyAnimation("test2", AnimatedProperties.X, -10),
            createPropertyAnimation("test2", AnimatedProperties.Y, -10));
  }

  @Test
  public void testAutoLayoutAnimation() {
    final LayoutState current =
        createMockLayoutState(
            Transition.parallel(),
            createMockLayoutOutput("test1", 0, 0),
            createMockLayoutOutput("test2", 0, 0));

    final LayoutState next =
        createMockLayoutState(
            Transition.parallel(Transition.allLayout().animator(mTestVerificationAnimator)),
            createMockLayoutOutput("test1", 10, 20, 200, 150),
            createMockLayoutOutput("test2", -10, -20, 50, 80));

    mTransitionManager.setupTransitions(
        current, next, TransitionManager.getRootTransition(next.getTransitions()));

    assertThat(mCreatedAnimations)
        .containsExactlyInAnyOrder(
            createPropertyAnimation("test1", AnimatedProperties.X, 10),
            createPropertyAnimation("test1", AnimatedProperties.Y, 20),
            createPropertyAnimation("test1", AnimatedProperties.WIDTH, 200),
            createPropertyAnimation("test1", AnimatedProperties.HEIGHT, 150),
            createPropertyAnimation("test2", AnimatedProperties.X, -10),
            createPropertyAnimation("test2", AnimatedProperties.Y, -20),
            createPropertyAnimation("test2", AnimatedProperties.WIDTH, 50),
            createPropertyAnimation("test2", AnimatedProperties.HEIGHT, 80));
  }

  @Test
  public void testKeyDoesntExist() {
    final LayoutState current =
        createMockLayoutState(Transition.parallel(), createMockLayoutOutput("test", 0, 0));
    final LayoutState next =
        createMockLayoutState(
            Transition.parallel(
                Transition.create(Transition.TransitionKeyType.GLOBAL, "test", "keydoesntexist")
                    .animate(AnimatedProperties.X, AnimatedProperties.Y)
                    .animator(mTestVerificationAnimator)),
            createMockLayoutOutput("test", 10, 0));

    mTransitionManager.setupTransitions(
        current, next, TransitionManager.getRootTransition(next.getTransitions()));

    assertThat(mCreatedAnimations)
        .containsExactlyInAnyOrder(createPropertyAnimation("test", AnimatedProperties.X, 10));
  }

  @Test
  public void testNoPreviousLayoutState() {
    final LayoutState next =
        createMockLayoutState(
            Transition.parallel(
                Transition.create(Transition.TransitionKeyType.GLOBAL, "test", "keydoesntexist")
                    .animate(AnimatedProperties.X, AnimatedProperties.Y)
                    .animator(mTestVerificationAnimator),
                Transition.create(Transition.TransitionKeyType.GLOBAL, "appearing")
                    .animate(AnimatedProperties.X)
                    .appearFrom(0)
                    .animator(mTestVerificationAnimator)),
            createMockLayoutOutput("test", 10, 0),
            createMockLayoutOutput("appearing", 20, 0));

    mTransitionManager.setupTransitions(
        null, next, TransitionManager.getRootTransition(next.getTransitions()));

    assertThat(mCreatedAnimations)
        .containsExactlyInAnyOrder(createPropertyAnimation("appearing", AnimatedProperties.X, 20));
  }

  @Test
  public void testWithMountTimeAnimations() {
    final LayoutState current =
        createMockLayoutState(
            Transition.parallel(),
            createMockLayoutOutput("test", 0, 0),
            createMockLayoutOutput("test2", 0, 0));
    final LayoutState next =
        createMockLayoutState(
            Transition.parallel(
                Transition.create(Transition.TransitionKeyType.GLOBAL, "test", "keydoesntexist")
                    .animate(AnimatedProperties.X, AnimatedProperties.Y)
                    .animator(mTestVerificationAnimator)),
            createMockLayoutOutput("test", 10, 0),
            createMockLayoutOutput("test2", 20, 0));
    final ArrayList<Transition> mountTimeTransitions = new ArrayList<>();
    mountTimeTransitions.add(
        Transition.create(Transition.TransitionKeyType.GLOBAL, "test2")
            .animate(AnimatedProperties.X)
            .appearFrom(0)
            .animator(mTestVerificationAnimator));

    final List<Transition> allTransitions = new ArrayList<>();
    allTransitions.addAll(next.getTransitions());
    allTransitions.addAll(mountTimeTransitions);
    mTransitionManager.setupTransitions(
        current, next, TransitionManager.getRootTransition(allTransitions));

    assertThat(mCreatedAnimations)
        .containsExactlyInAnyOrder(
            createPropertyAnimation("test", AnimatedProperties.X, 10),
            createPropertyAnimation("test2", AnimatedProperties.X, 20));
  }

  @Test
  public void testWithOnlyMountTimeAnimations() {
    final LayoutState current =
        createMockLayoutState(
            Transition.parallel(),
            createMockLayoutOutput("test", 0, 0),
            createMockLayoutOutput("test2", 0, 0));
    final LayoutState next =
        createMockLayoutState(
            null, createMockLayoutOutput("test", 10, 0), createMockLayoutOutput("test2", 20, 0));
    final ArrayList<Transition> mountTimeTransitions = new ArrayList<>();
    mountTimeTransitions.add(
        Transition.create(Transition.TransitionKeyType.GLOBAL, "test2")
            .animate(AnimatedProperties.X)
            .appearFrom(0)
            .animator(mTestVerificationAnimator));
    mountTimeTransitions.add(
        Transition.create(Transition.TransitionKeyType.GLOBAL, "test", "keydoesntexist")
            .animate(AnimatedProperties.X, AnimatedProperties.Y)
            .animator(mTestVerificationAnimator));

    mTransitionManager.setupTransitions(
        current, next, TransitionManager.getRootTransition(mountTimeTransitions));

    assertThat(mCreatedAnimations)
        .containsExactlyInAnyOrder(
            createPropertyAnimation("test", AnimatedProperties.X, 10),
            createPropertyAnimation("test2", AnimatedProperties.X, 20));
  }

  @Test
  public void testAnimationFromStateUpdate() {
    final LayoutState current =
        createMockLayoutState(
            Transition.parallel(),
            createMockLayoutOutput("test1", 0, 0),
            createMockLayoutOutput("test2", 0, 0));

    final ArrayList<PropertyAnimation> animationsCreatedFromStateUpdate = new ArrayList<>();

    Transition.TransitionAnimator animatorForStateUpdate =
        new Transition.TransitionAnimator() {
          @Override
          public TransitionAnimationBinding createAnimation(PropertyAnimation propertyAnimation) {
            animationsCreatedFromStateUpdate.add(propertyAnimation);
            return new SpringTransition(propertyAnimation);
          }
        };
    final ArrayList<Transition> transitionsFromStateUpdate = new ArrayList<>();
    transitionsFromStateUpdate.add(
        Transition.create(Transition.TransitionKeyType.GLOBAL, "test1", "test2")
            .animate(AnimatedProperties.Y)
            .animator(animatorForStateUpdate));

    final LayoutState next =
        createMockLayoutState(
            Transition.parallel(
                Transition.create(Transition.TransitionKeyType.GLOBAL, "test1", "test2")
                    .animate(AnimatedProperties.X)
                    .animator(mTestVerificationAnimator)),
            createMockLayoutOutput("test1", 10, 20),
            createMockLayoutOutput("test2", -10, -20));

    final List<Transition> allTransitions = new ArrayList<>();
    allTransitions.addAll(next.getTransitions());
    allTransitions.addAll(transitionsFromStateUpdate);

    mTransitionManager.setupTransitions(
        current, next, TransitionManager.getRootTransition(allTransitions));

    assertThat(mCreatedAnimations.size()).isEqualTo(2);

    assertThat(animationsCreatedFromStateUpdate)
        .containsExactlyInAnyOrder(
            createPropertyAnimation("test1", AnimatedProperties.Y, 20),
            createPropertyAnimation("test2", AnimatedProperties.Y, -20));
  }

  private PropertyAnimation createPropertyAnimation(
      String key, AnimatedProperty property, float endValue) {
    final TransitionId transitionId = new TransitionId(TransitionId.Type.GLOBAL, key, null);
    return new PropertyAnimation(new PropertyHandle(transitionId, property), endValue);
  }

  /** @return a mock LayoutState that only has a transition key -> LayoutOutput mapping. */
  private LayoutState createMockLayoutState(
      TransitionSet transitions, AnimatableItem... animatableItems) {
    final Map<TransitionId, OutputUnitsAffinityGroup<AnimatableItem>> transitionIdMapping =
        new LinkedHashMap<>();
    for (int i = 0; i < animatableItems.length; i++) {
      final AnimatableItem animatableItem = animatableItems[i];
      final TransitionId transitionId = animatableItem.getTransitionId();
      if (transitionId == null) {
        continue;
      }
      OutputUnitsAffinityGroup<AnimatableItem> group = transitionIdMapping.get(transitionId);
      if (group == null) {
        group = new OutputUnitsAffinityGroup<>();
        transitionIdMapping.put(transitionId, group);
      }
      final @OutputUnitType int type = LayoutState.getTypeFromId(animatableItem.getId());
      group.add(type, animatableItem);
    }

    final LayoutState layoutState = mock(LayoutState.class);
    when(layoutState.getTransitions())
        .thenReturn(transitions != null ? transitions.getChildren() : null);
    when(layoutState.getTransitionIdMapping()).thenReturn(transitionIdMapping);
    when(layoutState.getAnimatableItemForTransitionId(any()))
        .then(
            new Answer<OutputUnitsAffinityGroup<AnimatableItem>>() {
              @Override
              public OutputUnitsAffinityGroup<AnimatableItem> answer(InvocationOnMock invocation)
                  throws Throwable {
                final TransitionId transitionId = (TransitionId) invocation.getArguments()[0];
                return transitionIdMapping.get(transitionId);
              }
            });
    return layoutState;
  }

  /** @return a mock LayoutOutput with a transition key and dummy bounds. */
  private static AnimatableItem createMockLayoutOutput(String transitionKey, int x, int y) {
    return createMockLayoutOutput(transitionKey, x, y, 100, 100);
  }

  /** @return a mock LayoutOutput with a transition key and bounds. */
  private static AnimatableItem createMockLayoutOutput(
      String transitionKey, int x, int y, int width, int height) {
    final TransitionId transitionId =
        new TransitionId(TransitionId.Type.GLOBAL, transitionKey, null);
    final Rect bounds = new Rect(x, y, x + width, y + height);

    return new LithoAnimtableItem(0, bounds, OutputUnitType.CONTENT, null, transitionId);
  }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://www.simplity.org/schema"
	applicationId="SimplitySpringApp"
	autoLoginUserId="100"
	loggingFramework="log4j"
	classManager="org.simplity.examples.springIntegration.ApplicationContextProvider">

</application>


text:
package com.xiushuang.xprobation.sample;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.webkit.WebView;
import android.widget.EditText;

import com.xiushuang.xprobation.R;
import com.xiushuang.xprobation.utils.JSHandler;
import com.xiushuang.xprobation.utils.JSListener;

import java.io.IOException;
import java.io.InputStreamReader;

public class VideoJSActivity extends AppCompatActivity {
    final String TAG = "VideoJSActivity";
    EditText videoUrlET;
    WebView webView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_video_js);

        videoUrlET = (EditText) findViewById(R.id.videojs_url_et);
        webView = (WebView) findViewById(R.id.videojs_webview);

        initVideoJSHtml();
    }

    private void initVideoJSHtml() {
        JSHandler jsHandler = new JSHandler();
        jsHandler.setListener(new JSListener() {
            @Override
            public void onMesssage(String msg) {
                Log.d(TAG, "JSHandler()_onMesssage()" + msg);
            }
        });

        webView.addJavascriptInterface(jsHandler, "xjsHandler");
        webView.loadUrl("file:///android_asset/web/videojs.html");

//        try {
//            InputStreamReader fileInput = new InputStreamReader(getAssets().open("web/videojs.html"));
////          webView.loadDataWithBaseURL();
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (webView != null) {
            webView.destroy();
        }
    }
}


text:
This repository contains the lecture notes and exams (with solutions) for an introductory computer science course which I taught in Fall 2012. We followed to some extent the text [Think Python](http://www.greenteapress.com/thinkpython/) by Allen B. Downey as well as the videos of the Udacity course [cs101](https://www.udacity.com/wiki/cs101) which was taught by David Evans.

The lectures were spent working inside an ipython repl projected on a large screen, with the students partly guiding the subject matter covered.

The file [lecture-notes.md](https://github.com/sshastry/intro-to-computing-103/blob/master/lecture-notes.md) gathers all the material covered in class; source code (resp. exams) are is in the src (resp. exams) directory of this repository.

The topics covered were:

* equality vs assignment
* the ipython repl
* mutable vs immutable
* for and while loops
* the algebra of boolean values
* more on while loops
* the greatest element of a list
* introducing variable names while unpacking structures
* destructuring, or introducing variable names while unpacking structures
* recursion
* more on recursion
* The Towers of Hanoi
* timing your code (also known as profiling)
* dictionaries
* list comprehensions
* file I/O
* bubble sort and mergesort
* object orientation
* operator overloading
* raising exceptions


text:
name "nginx"
version "1.4.4"

dependency "pcre"

source :url => "http://nginx.org/download/nginx-#{version}.tar.gz",
       :md5 => "5dfaba1cbeae9087f3949860a02caa9f"

relative_path "nginx-#{version}"

build do
  command ["./configure",
           "--prefix=#{install_dir}/embedded",
           "--with-http_ssl_module",
           "--with-http_stub_status_module",
           "--with-ipv6",
           "--with-debug",
           "--with-ld-opt=-L#{install_dir}/embedded/lib",
           "--with-cc-opt=\"-L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include\""].join(" ")
  command "make -j #{max_build_jobs}", :env => {"LD_RUN_PATH" => "#{install_dir}/embedded/lib"}
  command "make install"
end


text:
package org.gradoop.temporal.model.impl;

import org.apache.flink.api.java.DataSet;
import org.apache.flink.util.Preconditions;
import org.gradoop.common.model.api.entities.Edge;
import org.gradoop.common.model.api.entities.GraphHead;
import org.gradoop.common.model.api.entities.Vertex;
import org.gradoop.flink.io.impl.gdl.GDLConsoleOutput;
import org.gradoop.flink.model.api.epgm.BaseGraph;
import org.gradoop.flink.model.api.epgm.BaseGraphCollection;
import org.gradoop.flink.model.api.epgm.BaseGraphCollectionFactory;
import org.gradoop.flink.model.api.epgm.BaseGraphFactory;
import org.gradoop.flink.model.api.layouts.GraphCollectionLayout;
import org.gradoop.flink.model.api.operators.BinaryBaseGraphCollectionToValueOperator;
import org.gradoop.flink.model.api.operators.UnaryBaseGraphCollectionToValueOperator;
import org.gradoop.flink.model.impl.epgm.GraphCollection;
import org.gradoop.flink.model.impl.epgm.GraphCollectionFactory;
import org.gradoop.flink.model.impl.layouts.transactional.tuples.GraphTransaction;
import org.gradoop.flink.model.impl.operators.equality.CollectionEquality;
import org.gradoop.flink.model.impl.operators.tostring.functions.GraphHeadToEmptyString;
import org.gradoop.flink.util.GradoopFlinkConfig;
import org.gradoop.temporal.io.api.TemporalDataSink;
import org.gradoop.temporal.model.api.TemporalGraphCollectionOperators;
import org.gradoop.temporal.model.api.functions.TimeIntervalExtractor;
import org.gradoop.temporal.model.impl.functions.tpgm.TemporalEdgeToEdge;
import org.gradoop.temporal.model.impl.functions.tpgm.TemporalVertexToVertex;
import org.gradoop.temporal.model.impl.functions.tpgm.TemporalGraphHeadToGraphHead;
import org.gradoop.temporal.model.impl.operators.tostring.TemporalEdgeToDataString;
import org.gradoop.temporal.model.impl.operators.tostring.TemporalGraphHeadToDataString;
import org.gradoop.temporal.model.impl.operators.tostring.TemporalVertexToDataString;
import org.gradoop.temporal.model.impl.pojo.TemporalEdge;
import org.gradoop.temporal.model.impl.pojo.TemporalGraphHead;
import org.gradoop.temporal.model.impl.pojo.TemporalVertex;
import org.gradoop.temporal.util.TemporalGradoopConfig;

import java.io.IOException;

/**
 * A temporal graph collection is a base concept of the Temporal Property Graph Model (TPGM)
 * that extends the Extended Property Graph Model (EPGM). The temporal graph collection
 * inherits the main concepts of the {@link GraphCollection} and
 * extends them by temporal attributes. These attributes are two temporal intervals:
 * the valid-time and transaction time. Both are represented by a Tuple2 of Long values that specify
 * the beginning and end time as unix timestamp in milliseconds.
 *

 *
{@code transactionTime}: {@code (tx-from [ms], tx-to [ms])}

 *
{@code validTime}: {@code (val-from [ms], val-to [ms])}

 *

 * Furthermore, a temporal graph collection provides operations that are performed on the underlying
 * data. These operations result in either another temporal graph collection or in a{@link TemporalGraph}.
 *

 * Analogous to a {@link GraphCollection}, a temporal graph
 * collection is wrapping a layout which defines, how the graph is represented in Apache Flink.

 * Note that the {@link TemporalGraphCollection} also implements that interface and just forwards
 * the calls to the layout. This is just for convenience and API synchronicity.
 *
 * @see TemporalGraphCollectionOperators
 */
public class TemporalGraphCollection implements BaseGraphCollection<
    TemporalGraphHead, TemporalVertex, TemporalEdge, TemporalGraph, TemporalGraphCollection>,
  GraphCollectionLayout<TemporalGraphHead, TemporalVertex, TemporalEdge>,
  TemporalGraphCollectionOperators {

  /**
   * Layout for this temporal graph collection.
   */
  private final GraphCollectionLayout<TemporalGraphHead, TemporalVertex, TemporalEdge> layout;

  /**
   * Temporal Gradoop Configuration that holds all necessary factories and the execution environment.
   */
  private final TemporalGradoopConfig config;

  /**
   * Creates a new temporal graph instance with the given layout and temporal Gradoop configuration.
   *
   * @param layout the temporal graph layout representing the temporal graph
   * @param config Temporal Gradoop config
   */
  TemporalGraphCollection(
    GraphCollectionLayout<TemporalGraphHead, TemporalVertex, TemporalEdge> layout,
    TemporalGradoopConfig config) {
    this.layout = Preconditions.checkNotNull(layout);
    this.config = Preconditions.checkNotNull(config);
  }

  @Override
  public GradoopFlinkConfig getConfig() {
    return this.config;
  }

  @Override
  public BaseGraphCollectionFactory<TemporalGraphHead, TemporalVertex, TemporalEdge, TemporalGraph,
    TemporalGraphCollection> getFactory() {
    return this.config.getTemporalGraphCollectionFactory();
  }

  @Override
  public BaseGraphFactory<TemporalGraphHead, TemporalVertex, TemporalEdge, TemporalGraph,
    TemporalGraphCollection> getGraphFactory() {
    return this.config.getTemporalGraphFactory();
  }

  /**
   * Writes the graph collection to the given data sink.
   *
   * @param dataSink The data sink to which the graph collection should be written.
   * @throws IOException if the collection can't be written to the sink
   */
  public void writeTo(TemporalDataSink dataSink) throws IOException {
    dataSink.write(this);
  }

  /**
   * Writes the graph collection to the given data sink with an optional overwrite option.
   *
   * @param dataSink The data sink to which the graph collection should be written.
   * @param overWrite determines whether existing files are overwritten
   * @throws IOException if the collection can't be written to the sink
   */
  public void writeTo(TemporalDataSink dataSink, boolean overWrite) throws IOException {
    dataSink.write(this, overWrite);
  }

  @Override
  public DataSet<TemporalVertex> getVertices() {
    return this.layout.getVertices();
  }

  @Override
  public DataSet<TemporalVertex> getVerticesByLabel(String label) {
    return this.layout.getVerticesByLabel(label);
  }

  @Override
  public DataSet<TemporalEdge> getEdges() {
    return this.layout.getEdges();
  }

  @Override
  public DataSet<TemporalEdge> getEdgesByLabel(String label) {
    return this.layout.getEdgesByLabel(label);
  }

  @Override
  public boolean isGVELayout() {
    return this.layout.isGVELayout();
  }

  @Override
  public boolean isIndexedGVELayout() {
    return this.layout.isIndexedGVELayout();
  }

  @Override
  public boolean isTransactionalLayout() {
    return this.layout.isTransactionalLayout();
  }

  @Override
  public DataSet<TemporalGraphHead> getGraphHeads() {
    return this.layout.getGraphHeads();
  }

  @Override
  public DataSet<TemporalGraphHead> getGraphHeadsByLabel(String label) {
    return this.layout.getGraphHeadsByLabel(label);
  }

  @Override
  public DataSet<GraphTransaction> getGraphTransactions() {
    return this.layout.getGraphTransactions();
  }

  @Override
  public DataSet<Boolean> equalsByGraphElementData(TemporalGraphCollection otherCollection) {
    return callForValue(new CollectionEquality<>(
      new GraphHeadToEmptyString<>(),
      new TemporalVertexToDataString<>(),
      new TemporalEdgeToDataString<>(), true), otherCollection);
  }

  @Override
  public DataSet<Boolean> equalsByGraphData(TemporalGraphCollection otherCollection) {
    return callForValue(new CollectionEquality<>(
      new TemporalGraphHeadToDataString<>(),
      new TemporalVertexToDataString<>(),
      new TemporalEdgeToDataString<>(), true), otherCollection);
  }

  //----------------------------------------------------------------------------
  // Utilities
  //----------------------------------------------------------------------------

  @Override
  public <T> T callForValue(UnaryBaseGraphCollectionToValueOperator<TemporalGraphCollection, T> operator) {
    return operator.execute(this);
  }

  @Override
  public <T> T callForValue(BinaryBaseGraphCollectionToValueOperator<TemporalGraphCollection, T> operator,
                            TemporalGraphCollection otherCollection) {
    return operator.execute(this, otherCollection);
  }

  @Override
  public GraphCollection toGraphCollection() {
    final GraphCollectionFactory collectionFactory = this.config.getGraphCollectionFactory();
    return collectionFactory.fromDataSets(
      getGraphHeads().map(new TemporalGraphHeadToGraphHead(collectionFactory.getGraphHeadFactory())),
      getVertices().map(new TemporalVertexToVertex(collectionFactory.getVertexFactory())),
      getEdges().map(new TemporalEdgeToEdge(collectionFactory.getEdgeFactory())));
  }

  /**
   * Convenience API function to create a {@link TemporalGraphCollection} from an existing
   * {@link BaseGraphCollection} with default values for the temporal attributes.
   *
   * @param baseGraphCollection the existing {@link BaseGraphCollection} instance
   * @param <G> The graph head type.
   * @param <V> The vertex type.
   * @param <E> The edge type.
   * @param <LG> The type of the graph.
   * @param <GC> The type of the graph collection.
   * @return a temporal graph collection with default temporal values
   * @see TemporalGraphCollectionFactory#fromNonTemporalGraphCollection(BaseGraphCollection)
   */
  public static <
    G extends GraphHead,
    V extends Vertex,
    E extends Edge,
    LG extends BaseGraph<G, V, E, LG, GC>,
    GC extends BaseGraphCollection<G, V, E, LG, GC>>
  TemporalGraphCollection fromGraphCollection(GC baseGraphCollection) {
    return TemporalGradoopConfig.fromGradoopFlinkConfig(baseGraphCollection.getConfig())
      .getTemporalGraphCollectionFactory().fromNonTemporalGraphCollection(baseGraphCollection);
  }

  /**
   * Convenience API function to create a {@link TemporalGraphCollection} from an existing
   * {@link BaseGraphCollection} with valid times depending on the three given
   * {@link TimeIntervalExtractor} functions
   *
   * @param baseGraphCollection the existing BaseGraphCollection instance
   * @param graphTimeExtractor  the time extractor function for the Graph Heads in the
   *                            graph collection instance
   * @param vertexTimeExtractor the time extractor function for the vertices in the graph
   *                            collection instance
   * @param edgeTimeExtractor   the time extractor function for the edges in the graph
   *                            collection instance
   * @param <G> The graph head type.
   * @param <V> The vertex type.
   * @param <E> The edge type.
   * @param <LG> The type of the graph.
   * @param <GC> The type of the graph collection.
   * @return a temporal graph collection with assigned valid time values
   * @see TemporalGraphCollectionFactory#fromNonTemporalGraphCollection(BaseGraphCollection)
   */
  public static <
    G extends GraphHead,
    V extends Vertex,
    E extends Edge,
    LG extends BaseGraph<G, V, E, LG, GC>,
    GC extends BaseGraphCollection<G, V, E, LG, GC>>
  TemporalGraphCollection fromGraphCollection(GC baseGraphCollection,
      TimeIntervalExtractor<G> graphTimeExtractor,
      TimeIntervalExtractor<V> vertexTimeExtractor,
      TimeIntervalExtractor<E> edgeTimeExtractor) {
    TemporalGradoopConfig temporalGradoopConfig = TemporalGradoopConfig.
      fromGradoopFlinkConfig(baseGraphCollection.getConfig());
    return temporalGradoopConfig.getTemporalGraphCollectionFactory().fromNonTemporalDataSets(
      baseGraphCollection.getGraphHeads(), graphTimeExtractor, baseGraphCollection.getVertices(),
      vertexTimeExtractor, baseGraphCollection.getEdges(), edgeTimeExtractor);
  }

  /**
   * Prints the GDL formatted graph collection to the standard output.
   *
   * @throws Exception forwarded from dataset print
   */
  public void print() throws Exception {
    GDLConsoleOutput.print(this);
  }
}


text:
from jax.experimental.jax2tf.jax2tf import (convert, dtype_of_val,
                                            split_to_logical_devices, PolyShape)
from jax.experimental.jax2tf.call_tf import call_tf


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;

/*Problem 4. Download file

Write a program that downloads a file from Internet (e.g. Ninja image) and stores it the current directory.
Find in Google how to download files in C#.
Be sure to catch all exceptions and to free any used resources in the finally block.
 */

namespace _04DownloadFile
{
    class DownloadFile
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Starting download...");
            WebClient webClient = new WebClient();
            string address = "http://telerikacademy.com/Content/Images/news-img01.png";
            string name = "news-img01.png";

            try
            {
                webClient.DownloadFile(address, name);
            }
            catch (ArgumentException argumentNullException)
            {
                Console.WriteLine(argumentNullException.Message);
            }
            catch (WebException webException)
            {
                Console.WriteLine(webException.Message);
            }
            catch (NotSupportedException notSupportedException)
            {
                Console.WriteLine(notSupportedException.Message);
            }
            finally
            {
                webClient.Dispose();
                Console.WriteLine("Good bye.");
            }

        }
    }
}