text:
//---------------------------------------------------------------------
// <copyright file="ODataWriterWrapperUnitTests.cs" company="Microsoft">
//      Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
// </copyright>
//---------------------------------------------------------------------

namespace AstoriaUnitTests.TDD.Tests.Client
{
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Text.RegularExpressions;
    using Microsoft.OData.Client;
    using System.Threading.Tasks;
    using Microsoft.OData.Core;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using FluentAssertions;

    /// <summary>
    /// Unit tests for the ODataWriterWrapperUnitTests class.
    /// </summary>
    [TestClass]
    public class ODataWriterWrapperUnitTests
    {
        [TestMethod]
        public void EndToEndShortIntegrationWriteEntryEventTest()
        {
            List<KeyValuePair<string, object>> eventArgsCalled = new List<KeyValuePair<string, object>>();
            var dataServiceContext = new DataServiceContext(new Uri("http://www.odata.org/Service.svc"));
            dataServiceContext.Configurations.RequestPipeline.OnEntityReferenceLink((args) => eventArgsCalled.Add(new KeyValuePair<string, object>("OnEntityReferenceLink", args)));
            dataServiceContext.Configurations.RequestPipeline.OnEntryEnding((args) => eventArgsCalled.Add(new KeyValuePair<string, object>("OnEntryEnded", args)));
            dataServiceContext.Configurations.RequestPipeline.OnEntryStarting((args) => eventArgsCalled.Add(new KeyValuePair<string, object>("OnEntryStarted", args)));
            dataServiceContext.Configurations.RequestPipeline.OnNavigationLinkEnding((args) => eventArgsCalled.Add(new KeyValuePair<string, object>("OnNavigationLinkEnded", args)));
            dataServiceContext.Configurations.RequestPipeline.OnNavigationLinkStarting((args) => eventArgsCalled.Add(new KeyValuePair<string, object>("OnNavigationLinkStarted", args)));

            Person person = SetupSerializerAndCallWriteEntry(dataServiceContext);

            eventArgsCalled.Should().HaveCount(8);
            eventArgsCalled[0].Key.Should().Be("OnEntryStarted");
            eventArgsCalled[0].Value.Should().BeOfType<WritingEntryArgs>();
            eventArgsCalled[0].Value.As<WritingEntryArgs>().Entity.Should().BeSameAs(person);
            eventArgsCalled[1].Key.Should().Be("OnNavigationLinkStarted");
            eventArgsCalled[1].Value.Should().BeOfType<WritingNavigationLinkArgs>();
            eventArgsCalled[2].Key.Should().Be("OnEntityReferenceLink");
            eventArgsCalled[2].Value.Should().BeOfType<WritingEntityReferenceLinkArgs>();
            eventArgsCalled[3].Key.Should().Be("OnNavigationLinkEnded");
            eventArgsCalled[3].Value.Should().BeOfType<WritingNavigationLinkArgs>();
            eventArgsCalled[4].Key.Should().Be("OnNavigationLinkStarted");
            eventArgsCalled[4].Value.Should().BeOfType<WritingNavigationLinkArgs>();
            eventArgsCalled[5].Key.Should().Be("OnEntityReferenceLink");
            eventArgsCalled[5].Value.Should().BeOfType<WritingEntityReferenceLinkArgs>();
            eventArgsCalled[6].Key.Should().Be("OnNavigationLinkEnded");
            eventArgsCalled[6].Value.Should().BeOfType<WritingNavigationLinkArgs>();
            eventArgsCalled[7].Key.Should().Be("OnEntryEnded");
            eventArgsCalled[7].Value.Should().BeOfType<WritingEntryArgs>();
            eventArgsCalled[7].Value.As<WritingEntryArgs>().Entity.Should().BeSameAs(person);
        }

        /// <summary>
        /// Instantiates a new Serializer class and calls WriteEntry method on it.
        /// </summary>
        /// <param name="dataServiceContext"></param>
        /// <returns></returns>
        private static Person SetupSerializerAndCallWriteEntry(DataServiceContext dataServiceContext)
        {
            Person person = new Person();
            Address address = new Address();
            Car car1 = new Car();
            person.Cars.Add(car1);
            person.HomeAddress = address;

            dataServiceContext.AttachTo("Cars", car1);
            dataServiceContext.AttachTo("Addresses", address);

            var requestInfo = new RequestInfo(dataServiceContext);
            var serializer = new Serializer(requestInfo);
            var headers = new HeaderCollection();
            var clientModel = new ClientEdmModel(ODataProtocolVersion.V4);
            var entityDescriptor = new EntityDescriptor(clientModel);
            entityDescriptor.State = EntityStates.Added;
            entityDescriptor.Entity = person;
            var requestMessageArgs = new BuildingRequestEventArgs("POST", new Uri("http://www.foo.com/Northwind"), headers, entityDescriptor, HttpStack.Auto);
            var linkDescriptors = new LinkDescriptor[] { new LinkDescriptor(person, "Cars", car1, clientModel), new LinkDescriptor(person, "HomeAddress", address, clientModel) };
            var odataRequestMessageWrapper = ODataRequestMessageWrapper.CreateRequestMessageWrapper(requestMessageArgs, requestInfo);

            serializer.WriteEntry(entityDescriptor, linkDescriptors, odataRequestMessageWrapper);
            return person;
        }

        [TestMethod]
        public void EntityPropertiesShouldBePopulatedBeforeCallingWriteStart()
        {
            DataServiceContext context = new DataServiceContext(new Uri("http://www.odata.org/service.svc"));
            context.Configurations.RequestPipeline.OnEntryStarting(args =>
            {
                args.Entry.Should().NotBeNull();
            });

            Person person = SetupSerializerAndCallWriteEntry(context);
        }

        [TestMethod]
        public void OnEntryStartShouldBeFired()
        {
            ODataEntry entry = new ODataEntry();
            var customer = new Customer();
            var wrappedWriter = this.SetupTestActionExecuted((context, requestPipeline) =>
            {
                requestPipeline.OnEntryStarting((WritingEntryArgs args) =>
                {
                    args.Entry.Id = new Uri("http://foo.org");
                    args.Entity.Should().BeSameAs(customer);
                });
            });

            wrappedWriter.WriteStart(entry, customer);
            entry.Id.Should().Be(new Uri("http://foo.org"));
        }

        [TestMethod]
        public void OnEntryEndShouldBeFired()
        {
            ODataEntry entry = new ODataEntry();
            var customer = new Customer();
            var wrappedWriter = this.SetupTestActionExecuted((context, requestPipeline) =>
            {
                requestPipeline.OnEntryEnding((args) =>
                {
                    args.Entry.Id = new Uri("http://foo.org");
                    args.Entity.Should().BeSameAs(customer);
                });
            });

            wrappedWriter.WriteEnd(entry, customer);
            entry.Id.Should().Be(new Uri("http://foo.org"));
        }

        [TestMethod]
        public void OnNavLinkStartShouldBeFired()
        {
            Person p = new Person();
            Address a = new Address();
            ODataNavigationLink link = new ODataNavigationLink();
            var wrappedWriter = this.SetupTestActionExecuted((context, requestPipeline) =>
            {
                requestPipeline.OnNavigationLinkStarting((args) =>
                {
                    args.Source.Should().BeSameAs(p);
                    args.Target.Should().BeSameAs(a);
                    args.Link.Name = "HomeAddress";
                });
            });

            wrappedWriter.WriteStart(link, p, a);
            link.Name.Should().Be("HomeAddress");
        }

        [TestMethod]
        public void OnNavLinkEndShouldBeFired()
        {
            Person p = new Person();
            Address a = new Address();
            ODataNavigationLink link = new ODataNavigationLink();
            var wrappedWriter = this.SetupTestActionExecuted((context, requestPipeline) =>
            {
                requestPipeline.OnNavigationLinkEnding((args) =>
                {
                    args.Source.Should().BeSameAs(p);
                    args.Target.Should().BeSameAs(a);
                    args.Link.Name = "foo";
                });
            });

            wrappedWriter.WriteEnd(link, p, a);
            link.Name.Should().Be("foo");
        }

        [TestMethod]
        public void OnEntityReferenceLink()
        {
            Person p = new Person();
            Address a = new Address();
            var testUrl = new Uri("http://foo.com/link", UriKind.Absolute);
            ODataEntityReferenceLink refLink = new ODataEntityReferenceLink();
            var wrappedWriter = this.SetupTestActionExecuted((context, requestPipeline) =>
            {
                requestPipeline.OnEntityReferenceLink((args) =>
                {
                    args.Source.Should().BeSameAs(p);
                    args.Target.Should().BeSameAs(a);
                    args.EntityReferenceLink.Url = testUrl;
                });
            });

            wrappedWriter.WriteEntityReferenceLink(refLink, p, a);
            refLink.Url.Should().BeSameAs(testUrl);
        }

        [TestMethod]
        public void SerializeEnity_TwoNavigationLinksInJsonFormat()
        {
            var person = new Person
            {
                ID = 100,
                Name = "Bing",
            };

            var car1 = new Car { ID = 1001 };
            var car2 = new Car { ID = 1002 };

            DataServiceContext dataServiceContext = new DataServiceContext(new Uri("http://www.odata.org/service.svc"));
            dataServiceContext.AttachTo("Persons", person);
            dataServiceContext.AttachTo("Cars", car1);
            dataServiceContext.AttachTo("Cars", car2);
            dataServiceContext.AddLink(person, "Cars", car1);
            dataServiceContext.AddLink(person, "Cars", car2);

            var requestInfo = new RequestInfo(dataServiceContext);
            var serializer = new Serializer(requestInfo);
            var headers = new HeaderCollection();
            var clientModel = new ClientEdmModel(ODataProtocolVersion.V4);
            var entityDescriptor = new EntityDescriptor(clientModel);
            entityDescriptor.State = EntityStates.Added;
            entityDescriptor.Entity = person;
            entityDescriptor.EditLink = new Uri("http://www.foo.com/custom");
            var requestMessageArgs = new BuildingRequestEventArgs("POST", new Uri("http://www.foo.com/Northwind"), headers, entityDescriptor, HttpStack.Auto);
            var linkDescriptors = new LinkDescriptor[] { new LinkDescriptor(person, "Cars", car1, clientModel), new LinkDescriptor(person, "Cars", car2, clientModel)};
            var odataRequestMessageWrapper = ODataRequestMessageWrapper.CreateRequestMessageWrapper(requestMessageArgs, requestInfo);

            serializer.WriteEntry(entityDescriptor, linkDescriptors, odataRequestMessageWrapper);

            // read result:
            MemoryStream stream = (MemoryStream)(odataRequestMessageWrapper.CachedRequestStream.Stream);
            stream.Position = 0;

            string payload = (new StreamReader(stream)).ReadToEnd();
            payload.Should().Be(
                "{\"ID\":100,\"Name\":\"Bing\",\"Cars@odata.bind\":[\"http://www.odata.org/service.svc/Cars(1001)\",\"http://www.odata.org/service.svc/Cars(1002)\"]}");
        }

        [TestMethod]
        public void SerializeEnity_EnumProperty()
        {
            MyEntity1 myEntity1 = new MyEntity1()
            {
                ID = 2,
                MyColorValue = MyColor.Yellow,
                MyFlagsColorValue = MyFlagsColor.Blue,
                ComplexValue1Value = new ComplexValue1() { MyColorValue = MyColor.Green, MyFlagsColorValue = MyFlagsColor.Red },
                MyFlagsColorCollection1 = new List<MyFlagsColor>() { MyFlagsColor.Blue, MyFlagsColor.Red, MyFlagsColor.Red },
                MyColorCollection = new List<MyColor?>()
            };

            DataServiceContext dataServiceContext = new DataServiceContext(new Uri("http://www.odata.org/service.svc"));
            dataServiceContext.EnableAtom = true;
            dataServiceContext.Format.UseAtom();
            dataServiceContext.AttachTo("MyEntitySet1", myEntity1);

            var requestInfo = new RequestInfo(dataServiceContext);
            var serializer = new Serializer(requestInfo);
            var headers = new HeaderCollection();
            headers.SetHeader("Content-Type", "application/atom+xml;odata.metadata=minimal");
            var clientModel = new ClientEdmModel(ODataProtocolVersion.V4);
            var entityDescriptor = new EntityDescriptor(clientModel);
            entityDescriptor.State = EntityStates.Added;
            entityDescriptor.Entity = myEntity1;
            var requestMessageArgs = new BuildingRequestEventArgs("POST", new Uri("http://www.foo.com/Northwind"), headers, entityDescriptor, HttpStack.Auto);
            var linkDescriptors = new LinkDescriptor[] { };
            var odataRequestMessageWrapper = ODataRequestMessageWrapper.CreateRequestMessageWrapper(requestMessageArgs, requestInfo);

            serializer.WriteEntry(entityDescriptor, linkDescriptors, odataRequestMessageWrapper);

            // read result:
            MemoryStream stream = (MemoryStream)(odataRequestMessageWrapper.CachedRequestStream.Stream);
            stream.Position = 0;

            string payload = (new StreamReader(stream)).ReadToEnd();
            payload = Regex.Replace(payload, "<updated>[^<]*</updated>", "");
            payload.Should().Be(
                "<?xml version=\"1.0\" encoding=\"utf-8\"?><entry xmlns=\"http://www.w3.org/2005/Atom\" " +
                    "xmlns:d=\"http://docs.oasis-open.org/odata/ns/data\" xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\" " +
                    "xmlns:georss=\"http://www.georss.org/georss\" xmlns:gml=\"http://www.opengis.net/gml\">" +
                    "<id />" +
                    "<title />" +
                //"<updated>2013-11-11T19:29:54Z</updated>" +
                    "<author><name /></author>" +
                    "<content type=\"application/xml\">" +
                        "<m:properties>" +
                            "<d:ComplexValue1Value>" +
                                "<d:MyColorValue m:type=\"#AstoriaUnitTests.TDD.Tests.Client.ODataWriterWrapperUnitTests_MyColor\">Green</d:MyColorValue>" +
                                "<d:MyFlagsColorValue m:type=\"#AstoriaUnitTests.TDD.Tests.Client.ODataWriterWrapperUnitTests_MyFlagsColor\">Red</d:MyFlagsColorValue>" +
                                "<d:StringValue m:null=\"true\" />" +
                            "</d:ComplexValue1Value>" +
                            "<d:ID m:type=\"Int64\">2</d:ID>" +
                            "<d:MyColorCollection />" +
                            "<d:MyColorValue m:type=\"#AstoriaUnitTests.TDD.Tests.Client.ODataWriterWrapperUnitTests_MyColor\">Yellow</d:MyColorValue>" +
                            "<d:MyFlagsColorCollection1>" +
                                "<m:element m:type=\"#AstoriaUnitTests.TDD.Tests.Client.ODataWriterWrapperUnitTests+MyFlagsColor\">Blue</m:element>" +
                                "<m:element m:type=\"#AstoriaUnitTests.TDD.Tests.Client.ODataWriterWrapperUnitTests+MyFlagsColor\">Red</m:element>" +
                                "<m:element m:type=\"#AstoriaUnitTests.TDD.Tests.Client.ODataWriterWrapperUnitTests+MyFlagsColor\">Red</m:element>" +
                            "</d:MyFlagsColorCollection1>" +
                            "<d:MyFlagsColorValue m:type=\"#AstoriaUnitTests.TDD.Tests.Client.ODataWriterWrapperUnitTests_MyFlagsColor\">Blue</d:MyFlagsColorValue>" +
                        "</m:properties>" +
                    "</content>" +
                    "</entry>");
        }

        [TestMethod]
        public void SerializeEnity_NullableEnumProperty()
        {
            MyEntity1 myEntity1 = new MyEntity1()
            {
                ID = 2,
                MyColorValue = null,
                MyFlagsColorValue = MyFlagsColor.Blue,
                ComplexValue1Value = new ComplexValue1() { MyColorValue = MyColor.Green, MyFlagsColorValue = MyFlagsColor.Red },
                MyFlagsColorCollection1 = new List<MyFlagsColor>() { MyFlagsColor.Blue, MyFlagsColor.Red, MyFlagsColor.Red },
                MyColorCollection = new List<MyColor?> { MyColor.Green, null }
            };

            DataServiceContext dataServiceContext = new DataServiceContext(new Uri("http://www.odata.org/service.svc"));
            dataServiceContext.EnableAtom = true;
            dataServiceContext.Format.UseAtom();
            dataServiceContext.AttachTo("MyEntitySet1", myEntity1);

            var requestInfo = new RequestInfo(dataServiceContext);
            var serializer = new Serializer(requestInfo);
            var headers = new HeaderCollection();
            var clientModel = new ClientEdmModel(ODataProtocolVersion.V4);
            var entityDescriptor = new EntityDescriptor(clientModel);
            entityDescriptor.State = EntityStates.Added;
            entityDescriptor.Entity = myEntity1;
            var requestMessageArgs = new BuildingRequestEventArgs("POST", new Uri("http://www.foo.com/Northwind"), headers, entityDescriptor, HttpStack.Auto);
            var linkDescriptors = new LinkDescriptor[] { };
            var odataRequestMessageWrapper = ODataRequestMessageWrapper.CreateRequestMessageWrapper(requestMessageArgs, requestInfo);

            serializer.WriteEntry(entityDescriptor, linkDescriptors, odataRequestMessageWrapper);

            // read result:
            MemoryStream stream = (MemoryStream)(odataRequestMessageWrapper.CachedRequestStream.Stream);
            stream.Position = 0;

            string payload = (new StreamReader(stream)).ReadToEnd();
            payload = Regex.Replace(payload, "<updated>[^<]*</updated>", "");
            payload.Should().Be(
                "{\"ComplexValue1Value\":{\"MyColorValue\":\"Green\",\"MyFlagsColorValue\":\"Red\",\"StringValue\":null},\"ID\":2,\"MyColorCollection\":[\"Green\",null],\"MyColorValue\":null,\"MyFlagsColorCollection1\":[\"Blue\",\"Red\",\"Red\"],\"MyFlagsColorValue\":\"Blue\"}");
        }

        internal ODataWriterWrapper SetupTestActionExecuted(Action<DataServiceContext, DataServiceClientRequestPipelineConfiguration> setup)
        {
            var dataServiceContext = new DataServiceContext();
            var writer = new TestODataWriter();
            setup(dataServiceContext, dataServiceContext.Configurations.RequestPipeline);
            return ODataWriterWrapper.CreateForEntryTest(writer, dataServiceContext.Configurations.RequestPipeline);
        }

        public enum MyColor : long
        {
            Green = 1,
            Yellow = 4
        }

        [Flags]
        public enum MyFlagsColor
        {
            Red = 2,
            Blue = 8
        }

        public class ComplexValue1
        {
            public MyColor? MyColorValue { get; set; }
            public MyFlagsColor MyFlagsColorValue { get; set; }
            public string StringValue { get; set; }
        }

        public class MyEntity1
        {
            public long ID { get; set; }
            public MyColor? MyColorValue { get; set; }
            public MyFlagsColor MyFlagsColorValue { get; set; }
            public ComplexValue1 ComplexValue1Value { get; set; }
            public List<MyColor?> MyColorCollection { get; set; }
            public List<MyFlagsColor> MyFlagsColorCollection1 { get; set; }
        }

        public class Car
        {
            public int ID { get; set; }
            public Person Owner { get; set; }
        }

        public class Address
        {
            public int ID { get; set; }
            public string Name { get; set; }
        }

        public class Person
        {
            public Person()
            {
                this.Cars = new List<Car>();
            }

            public int ID { get; set; }
            public string Name { get; set; }
            public List<Car> Cars { get; set; }
            public Address HomeAddress { get; set; }
        }

        internal class TestODataWriter : ODataWriter
        {
            public override void WriteStart(ODataFeed feed)
            {
            }

            public override Task WriteStartAsync(ODataFeed feed)
            {
                throw new InternalTestFailureException("Should not hit this code");
            }

            public override void WriteStart(ODataEntry entry)
            {
            }

            public override Task WriteStartAsync(ODataEntry entry)
            {
                throw new InternalTestFailureException("Should not hit this code");
            }

            public override void WriteStart(ODataNavigationLink navigationLink)
            {
            }

            public override Task WriteStartAsync(ODataNavigationLink navigationLink)
            {
                throw new InternalTestFailureException("Should not hit this code");
            }

            public override void WriteEnd()
            {
            }

            public override Task WriteEndAsync()
            {
                throw new InternalTestFailureException("Should not hit this code");
            }

            public override void WriteEntityReferenceLink(ODataEntityReferenceLink entityReferenceLink)
            {
            }

            public override Task WriteEntityReferenceLinkAsync(ODataEntityReferenceLink entityReferenceLink)
            {
                throw new InternalTestFailureException("Should not hit this code");
            }

            public override void Flush()
            {
                throw new InternalTestFailureException("Should not hit this code");
            }

            public override Task FlushAsync()
            {
                throw new InternalTestFailureException("Should not hit this code");
            }
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
import constant from '../core/constant'
import EntityManager from './entityManager'
import Query from './query/query'
export default class TranzactionManager extends EntityManager {
  constructor(dbScanner) {
    super.constructor(dbScanner);
    this.isOnTranzaction = false;
    this.isCommited = false;
    this.tranzactionalQueue = {
      "save": [],
      "delete": []
    };
  }
  begin() {
    if (this.isCommited) {
      throw "do not reuse a tranzaction!";
    }
    this.isOnTranzaction = true;
    this.tranzactionalQueue = {
      "save": [],
      "delete": []
    };
  }
  commit() {
    let self = this;
    let cmd = [
      {
        command: "delete",
        targets: this.tranzactionalQueue.delete
      }, {
        command: "save",
        targets: this.tranzactionalQueue.save
      }
    ];
    let executePromise = this.dBSyncronizer.doExecuteAsTranzactional(cmd);
    return new Promise((resolve, reject) => {
      executePromise.then((data) => {
        this.isOnTranzaction = false;
        this.tranzactionalQueue = {
          "save": [],
          "delete": []
        };
        this.isCommited = true;
        resolve(data);
      }, (e) => {
        reject(e);
      })
    });
  }
  rollback() {
    this.isOnTranzaction = false;
    this.tranzactionalQueue = {
      "save": [],
      "delete": []
    };
    this.isCommited = true;
  }
  getQuery() {
    return new Query(this.isOnTranzaction);
  }
  load(entity) {
    let selectData = this.dbScanner.select(entity);
    for (let record of selectData) {
      record.isInTranzaction = this.isOnTranzactio;
    }
    return selectData;
  }
  async save(entitys) {
    await this.addQueue("save", entitys);
  }
  async delete(entitys) {
    await this.addQueue("delete", entitys);
  }
  async addQueue(command, entitys) {
    let targets = entitys;
    if (Array.isArray(entitys) === false) {
      targets = [entitys];
    }
    this.tranzactionalQueue[command] = this.tranzactionalQueue[command].concat(targets);
  }
  // async createQuery(isOnTranzaction) {
  //   if (isOnTranzaction) {
  //     return await super.createQuery(!!isOnTranzaction);
  //   }
  //   return null;
  // }
}


text:
"""
minio.definitions
~~~~~~~~~~~~~~~

This module contains the primary objects that power Minio.

:copyright: (c) 2015 by Minio, Inc.
:license: Apache 2.0, see LICENSE for more details.

"""

class Bucket(object):
    """
    A bucket metadata :class:`Bucket <Bucket>`.

    :param name: Bucket name.
    :param created: Bucket creation date.
    """
    def __init__(self, name, created):
        self.name = name
        self.creation_date = created

    def __str__(self):
        return '<Bucket: {0} {1}>'.format(self.name, self.creation_date)

class Object(object):
    """
    A object metadata :class:`Object <Object>`.

    :param bucket_name: Bucket name.
    :param object_name: Object name.
    :param last_modified: Object when it was last modified on server.
    :param etag: ETag saved on server for the object_name.
    :param size: Size of the object on server.
    :param content_type: Optional parameter indicating content type.
    :param is_dir: Optional parameter differentiating object prefixes.
    """
    def __init__(self, bucket_name, object_name, last_modified, etag, size,
                 content_type=None, is_dir=False):
        self.bucket_name = bucket_name
        self.object_name = object_name
        self.last_modified = last_modified
        self.etag = etag
        self.size = size
        self.content_type = content_type
        self.is_dir = is_dir

    def __str__(self):
        string_format = '<Object: bucket_name: {0} object_name: {1}' \
                        ' last_modified: {2} etag: {3} size: {4}' \
                        ' content_type: {5}, is_dir: {6}>'
        return string_format.format(self.bucket_name,
                                    self.object_name.encode('utf-8'),
                                    self.last_modified,
                                    self.etag, self.size,
                                    self.content_type,
                                    self.is_dir)

class MultipartUploadResult(object):
    """
    A completed multipart upload metadata
         :class:`MultipartUploadResult <MultipartUploadResult>`.

    :param bucket_name: Bucket name.
    :param object_name: Object name.
    :param location: Object uploaded location.
    :param etag: Object final etag.
    """
    def __init__(self, bucket_name, object_name, location, etag):
        self.bucket_name = bucket_name
        self.object_name = object_name
        self.location = location
        self.etag = etag

    def __str__(self):
        string_format = ('<IncompleteUpload: bucket_name: {0}'
                         ' object_name: {1} location: {2} etag: {3}>')
        return string_format.format(self.bucket_name, self.object_name,
                                    self.location, self.etag)

class IncompleteUpload(object):
    """
    A partially uploaded object's metadata
         :class:`IncompleteUpload <IncompleteUpload>`.

    :param bucket_name: Bucket name.
    :param object_name: Object name.
    :param upload_id: Partially uploaded object's upload id.
    :param initiated: Date when the multipart was initiated.
    """
    def __init__(self, bucket_name, object_name, upload_id, initiated):
        self.bucket_name = bucket_name
        self.object_name = object_name
        self.upload_id = upload_id
        self.initiated = initiated
        self.size = 0

    def __str__(self):
        string_format = ('<IncompleteUpload: bucket_name: {0}'
                         ' object_name: {1} upload_id: {2}'
                         ' initiated:{3} size: {4}>')
        return string_format.format(self.bucket_name, self.object_name,
                                    self.upload_id, self.initiated, self.size)

class UploadPart(object):
    """
    A multipart upload part metadata :class:`UploadPart <UploadPart>`

    :param bucket_name: Bucket name.
    :param object_name: Object name.
    :param upload_id: Partially uploaded object's upload id.
    :param part_number: Part number of the part.
    :param etag: ETag of the part.
    :last_modified: Last modified time of the part.
    :size: Size of the part.
    """
    def __init__(self, bucket_name, object_name, upload_id, part_number, etag,
                 last_modified, size):
        self.bucket_name = bucket_name
        self.object_name = object_name
        self.upload_id = upload_id
        self.part_number = part_number
        self.etag = etag
        self.last_modified = last_modified
        self.size = size

    def __str__(self):
        string_format = '<UploadPart: bucket_name: {0} object_name: {1}' \
                        ' upload_id: {2} part_number: {3} etag: {4}' \
                        ' last_modified: {5} size: {6}>'
        return string_format.format(self.bucket_name,
                                    self.object_name,
                                    self.upload_id,
                                    self.part_number,
                                    self.etag,
                                    self.last_modified,
                                    self.size)


text:
package runner

import (
	"bufio"
	"context"
	"fmt"
	"io"
	"sync"
	"time"

	"github.com/Sirupsen/logrus"
	"github.com/iron-io/functions/api/runner/protocol"
	"github.com/iron-io/functions/api/runner/task"
	"github.com/iron-io/runner/drivers"
)

// hot functions - theory of operation
//
// A function is converted into a hot function if its `Format` is either
// a streamable format/protocol. At the very first task request a hot
// container shall be started and run it. Each hot function has an internal
// clock that actually halts the container if it goes idle long enough. In the
// absence of workload, it just stops the whole clockwork.
//
// Internally, the hot function uses a modified Config whose Stdin and Stdout
// are bound to an internal pipe. This internal pipe is fed with incoming tasks
// Stdin and feeds incoming tasks with Stdout.
//
// Each execution is the alternation of feeding hot functions stdin with tasks
// stdin, and reading the answer back from containers stdout. For all `Format`s
// we send embedded into the message metadata to help the container to know when
// to stop reading from its stdin and Functions expect the container to do the
// same. Refer to api/runner/protocol.go for details of these communications.
//
// hot functions implementation relies in two moving parts (drawn below):
// htfnmgr and htfn. Refer to their respective comments for
// details.
//                             │
//                         Incoming
//                           Task
//                             │
//                             ▼
//                     ┌───────────────┐
//                     │ Task Request  │
//                     │   Main Loop   │
//                     └───────────────┘
//                             │
//                      ┌──────▼────────┐
//                     ┌┴──────────────┐│
//                     │  Per Function ││             non-streamable f()
//             ┌───────│   Container   │├──────┐───────────────┐
//             │       │    Manager    ├┘      │               │
//             │       └───────────────┘       │               │
//             │               │               │               │
//             ▼               ▼               ▼               ▼
//       ┌───────────┐   ┌───────────┐   ┌───────────┐   ┌───────────┐
//       │    Hot    │   │    Hot    │   │    Hot    │   │   Cold    │
//       │ Function  │   │ Function  │   │ Function  │   │ Function  │
//       └───────────┘   └───────────┘   └───────────┘   └───────────┘
//                                           Timeout
//                                           Terminate
//                                           (internal clock)

const (
	// Terminate hot function after this timeout
	htfnScaleDownTimeout = 30 * time.Second
)

// RunTask helps sending a task.Request into the common concurrency stream.
// Refer to StartWorkers() to understand what this is about.
func RunTask(tasks chan task.Request, ctx context.Context, cfg *task.Config) (drivers.RunResult, error) {
	tresp := make(chan task.Response)
	treq := task.Request{Ctx: ctx, Config: cfg, Response: tresp}
	tasks <- treq
	resp := <-treq.Response
	return resp.Result, resp.Err
}

// StartWorkers operates the common concurrency stream, ie, it will process all
// IronFunctions tasks, either sync or async. In the process, it also dispatches
// the workload to either regular or hot functions.
func StartWorkers(ctx context.Context, rnr *Runner, tasks <-chan task.Request) {
	var wg sync.WaitGroup
	defer wg.Wait()
	var hcmgr htfnmgr

	for {
		select {
		case <-ctx.Done():
			return
		case task := <-tasks:
			p := hcmgr.getPipe(ctx, rnr, task.Config)
			if p == nil {
				wg.Add(1)
				go runTaskReq(rnr, &wg, task)
				continue
			}

			rnr.Start()
			select {
			case <-ctx.Done():
				return
			case p <- task:
				rnr.Complete()
			}
		}
	}
}

// htfnmgr is the intermediate between the common concurrency stream and
// hot functions. All hot functions share a single task.Request stream per
// function (chn), but each function may have more than one hot function (hc).
type htfnmgr struct {
	chn map[string]chan task.Request
	hc  map[string]*htfnsvr
}

func (h *htfnmgr) getPipe(ctx context.Context, rnr *Runner, cfg *task.Config) chan task.Request {
	isStream, err := protocol.IsStreamable(cfg.Format)
	if err != nil {
		logrus.WithError(err).Info("could not detect container IO protocol")
		return nil
	} else if !isStream {
		return nil
	}

	if h.chn == nil {
		h.chn = make(map[string]chan task.Request)
		h.hc = make(map[string]*htfnsvr)
	}

	// TODO(ccirello): re-implement this without memory allocation (fmt.Sprint)
	fn := fmt.Sprint(cfg.AppName, ",", cfg.Path, cfg.Image, cfg.Timeout, cfg.Memory, cfg.Format, cfg.MaxConcurrency)
	tasks, ok := h.chn[fn]
	if !ok {
		h.chn[fn] = make(chan task.Request)
		tasks = h.chn[fn]
		svr := newhtfnsvr(ctx, cfg, rnr, tasks)
		if err := svr.launch(ctx); err != nil {
			logrus.WithError(err).Error("cannot start hot function supervisor")
			return nil
		}
		h.hc[fn] = svr
	}

	return tasks
}

// htfnsvr is part of htfnmgr, abstracted apart for simplicity, its only
// purpose is to test for hot functions saturation and try starting as many as
// needed. In case of absence of workload, it will stop trying to start new hot
// containers.
type htfnsvr struct {
	cfg      *task.Config
	rnr      *Runner
	tasksin  <-chan task.Request
	tasksout chan task.Request
	maxc     chan struct{}
}

func newhtfnsvr(ctx context.Context, cfg *task.Config, rnr *Runner, tasks <-chan task.Request) *htfnsvr {
	svr := &htfnsvr{
		cfg:      cfg,
		rnr:      rnr,
		tasksin:  tasks,
		tasksout: make(chan task.Request, 1),
		maxc:     make(chan struct{}, cfg.MaxConcurrency),
	}

	// This pipe will take all incoming tasks and just forward them to the
	// started hot functions. The catch here is that it feeds a buffered
	// channel from an unbuffered one. And this buffered channel is
	// then used to determine the presence of running hot functions.
	// If no hot function is available, tasksout will fill up to its
	// capacity and pipe() will start them.
	go svr.pipe(ctx)
	return svr
}

func (svr *htfnsvr) pipe(ctx context.Context) {
	for {
		select {
		case t := <-svr.tasksin:
			svr.tasksout <- t
			if len(svr.tasksout) > 0 {
				if err := svr.launch(ctx); err != nil {
					logrus.WithError(err).Error("cannot start more hot functions")
				}
			}
		case <-ctx.Done():
			return
		}
	}
}

func (svr *htfnsvr) launch(ctx context.Context) error {
	select {
	case svr.maxc <- struct{}{}:
		hc, err := newhtfn(
			svr.cfg,
			protocol.Protocol(svr.cfg.Format),
			svr.tasksout,
			svr.rnr,
		)
		if err != nil {
			return err
		}
		go func() {
			hc.serve(ctx)
			<-svr.maxc
		}()
	default:
	}

	return nil
}

// htfn actually interfaces an incoming task from the common concurrency
// stream into a long lived container. If idle long enough, it will stop. It
// uses route configuration to determine which protocol to use.
type htfn struct {
	cfg   *task.Config
	proto protocol.ContainerIO
	tasks <-chan task.Request

	// Side of the pipe that takes information from outer world
	// and injects into the container.
	in  io.Writer
	out io.Reader

	// Receiving side of the container.
	containerIn  io.Reader
	containerOut io.Writer

	rnr *Runner
}

func newhtfn(cfg *task.Config, proto protocol.Protocol, tasks <-chan task.Request, rnr *Runner) (*htfn, error) {
	stdinr, stdinw := io.Pipe()
	stdoutr, stdoutw := io.Pipe()

	p, err := protocol.New(proto, stdinw, stdoutr)
	if err != nil {
		return nil, err
	}

	hc := &htfn{
		cfg:   cfg,
		proto: p,
		tasks: tasks,

		in:  stdinw,
		out: stdoutr,

		containerIn:  stdinr,
		containerOut: stdoutw,

		rnr: rnr,
	}

	return hc, nil
}

func (hc *htfn) serve(ctx context.Context) {
	lctx, cancel := context.WithCancel(ctx)
	var wg sync.WaitGroup
	wg.Add(1)
	go func() {
		defer wg.Done()
		for {
			inactivity := time.After(htfnScaleDownTimeout)

			select {
			case <-lctx.Done():
				return

			case <-inactivity:
				cancel()

			case t := <-hc.tasks:
				if err := hc.proto.Dispatch(lctx, t); err != nil {
					logrus.WithField("ctx", lctx).Info("task failed")
					t.Response <- task.Response{
						&runResult{StatusValue: "error", error: err},
						err,
					}
					continue
				}

				t.Response <- task.Response{
					&runResult{StatusValue: "success"},
					nil,
				}
			}
		}
	}()

	cfg := *hc.cfg
	cfg.Timeout = 0 // add a timeout to simulate ab.end. failure.
	cfg.Stdin = hc.containerIn
	cfg.Stdout = hc.containerOut

	// Why can we not attach stderr to the task like we do for stdin and
	// stdout?
	//
	// Stdin/Stdout are completely known to the scope of the task. You must
	// have a task stdin to feed containers stdin, and also the other way
	// around when reading from stdout. So both are directly related to the
	// life cycle of the request.
	//
	// Stderr, on the other hand, can be written by anything any time:
	// failure between requests, failures inside requests and messages send
	// right after stdout has been finished being transmitted. Thus, with
	// hot functions, there is not a 1:1 relation between stderr and tasks.
	//
	// Still, we do pass - at protocol level - a Task-ID header, from which
	// the application running inside the hot function can use to identify
	// its own stderr output.
	errr, errw := io.Pipe()
	cfg.Stderr = errw
	wg.Add(1)
	go func() {
		defer wg.Done()
		scanner := bufio.NewScanner(errr)
		for scanner.Scan() {
			logrus.WithFields(logrus.Fields{
				"app":             cfg.AppName,
				"route":           cfg.Path,
				"image":           cfg.Image,
				"memory":          cfg.Memory,
				"format":          cfg.Format,
				"max_concurrency": cfg.MaxConcurrency,
			}).Info(scanner.Text())
		}
	}()

	result, err := hc.rnr.Run(lctx, &cfg)
	if err != nil {
		logrus.WithError(err).Error("hot function failure detected")
	}
	cancel()
	errw.Close()
	wg.Wait()
	logrus.WithField("result", result).Info("hot function terminated")
}

func runTaskReq(rnr *Runner, wg *sync.WaitGroup, t task.Request) {
	defer wg.Done()
	rnr.Start()
	defer rnr.Complete()
	result, err := rnr.Run(t.Ctx, t.Config)
	select {
	case t.Response <- task.Response{result, err}:
		close(t.Response)
	default:
	}
}

type runResult struct {
	error
	StatusValue string
}

func (r *runResult) Error() string {
	if r.error == nil {
		return ""
	}
	return r.error.Error()
}

func (r *runResult) Status() string { return r.StatusValue }


text:
host: 'http://example.com'
port: 25
user:
    name: { first: John, last: Doe }
    id: johndoe@example.com
    password: mypassword
---
Main Title
-----
### Subtilte

Lorem ipsum......


text:
<!DOCTYPE html>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />

<meta http-equiv="Content-Type" content="text/html;" />
<meta name="google-translate-customization" content="150c9644cda5aab7-96385692cabadd25-g6285bf04891a6dc2-10"></meta>

<meta name="ROBOTS" content="NOARCHIVE">
<meta name="ROBOTS" content="NOCACHE">
<meta name="keywords" content="Bronx Community College, Bronx, Community, College, Community College, CUNY, 718.289.5100, 5100, 718.289.5895, 5895 , BCC, BCC, Email" />
<meta name="description" content="Since 1959, Bronx Community College of the City University of New York has been building on its vision to graduate students who are prepared to live within, profit from, and contribute to a 21st century global environment marked by diversity, change, and expanded opportunities for learning and growth.">

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.5, user-scalable=yes" />
<title>BCC - BCC Email</title>

	<link href="https://www.bcc.cuny.edu/wBCC.css" rel="stylesheet" type="text/css" />
	<link href="https://www.bcc.cuny.edu/wBCC1.css" rel="stylesheet" type="text/css" />
	<link href="https://www.bcc.cuny.edu/SpryAssets/SpryMenuBarHorizontal-TOP_QUICK_LINKS.css" rel="stylesheet" type="text/css" />
	<link href="https://www.bcc.cuny.edu/SpryAssets/SpryMenuBarHorizontal-TOP_MENU.css" rel="stylesheet" type="text/css" />

<link rel="shortcut icon" href="https://www.bcc.cuny.edu/favicon.ico">

<link rel="stylesheet" href="https://www.bcc.cuny.edu/jQuery/coin-slider-styles.css" type="text/css" />

	<link rel="stylesheet" href="https://www.bcc.cuny.edu/jQuery/jscrollpane/styles/jScrollPane.css" type="text/css">

<![endif]-->

<gcse:search></gcse:search>

87.8<!sup> °F<!/sup>

Bronco ID

Blackboard Info

Sexual Respect

BCC Email

Calendar

OSSES

CUNYfirst

CUNY Portal

Blackboard

Directory

Campus Map

A-Z Index

           	<!cfinclude template="/SYSTEM_SERVICE/include-BootStrapHTTPS.htm">

    <select id="login" name="login" class="loginDropdown" onchange="BCClogin(this.value)" aria-labelledby="login" title="Login">
      <option value="Login" disabled="disabled" selected="selected">LOGIN</option>
      <option value="1">BCC Email</option>

      <option value="5">Blackboard</option>
      <option value="3">CUNYfirst</option>
      <option value="4">CUNYportal</option>
      <option value="2">OSSES</option>
    </select>

							Admissions

													Request Information

													Apply Online

													Contact Information

													Freshman

													International Student

													Non-Degree Student

													Testing and Placement Exams

													Tours and Visits

													Transfer

							Finances

													7 Easy Steps to file a FAFSA

													Financial Aid

																Learn about Financial Aid

																Need Money for College

																After you Apply

													Scholarships

													Student Financial Services

																College Expenses

																Payment Options

																Tuition and Fees

																Tuition Bill Due Dates

							Academics

													Academic Degree Programs

																Associate in Applied Sciences Degrees (A.A.S.)

																Associate in Arts Degrees (A.A.)

																Associate in Science Degrees (A.S.)

																Certificate Programs

																CUNY Baccalaureate Program

																CUNY Pathways

													Academic Departments

											Academic Resources

																Academic Calendar

																Academic Rules and Regulations

																College Catalog

													Academic Support Services

																Academic Advising

																Transfer Planning

																Tutoring Services and Schedules

																Writing Center

													Evening and Weekend Services

																Second Saturdays @ BCC

													Online Learning

											Pre-College Experience

																College Now

													Registrar's Office

													Special Academic Success Programs

																CLIP - CUNY Language Immersion Program

																College Discovery

																Coordinated Undergraduate Education

																CUNY Start

																Dean's and President's Lists

																Honors Programs

																Math Start

																Writing Across the Curriculum

							Services

													Academic Computer Labs

													Academic Support Services

													BCC Shuttle Bus

													Campus Bookstore

													Career and Transfer Services

											Counseling Services

																General Counseling

																Personal Counseling

													Disability Services

													Early Childhood Center

													Enrollment Services

													Public Safety

													Single Stop

																Petrie Student Emergency Funds

													Technology Service Center (formerly HelpDesk)

													Veteran and Military Resources

							Student Life

											Get Involved

																Clubs and Organizations

																Leadership Development

																Student Government

											Support and Services

																Community Outreach and Service Learning

																Healthy Living

																New and Transfer Student Orientation

											Student Resources

																BCC Shuttle Bus

																Campus Posting Policy

																Student Parking

																Title IX Resources for Students

													Campus Dining

													Commencement 2017

													Multicultural Programs

							Athletics

							Library

							Support BCC

				Welcome » BCC Email
				█

	<link href="http://www.bcc.cuny.edu/wBCC1.css" rel="stylesheet" type="text/css" />

<link type="text/css" rel="stylesheet" href="js/fancybox/jquery.fancybox-1.3.1.css"  media="screen" />

BCC Email

Students

Faculty/Staff

Microsoft (R) Outlook (TM) Web Access is a Microsoft Exchange Active Server Application that gives you private access to your Microsoft Outlook or Microsoft Exchange personal e-mail account so that you can view your inbox from any Web Browser. It also allows you to view Exchange server public folders and the Address Book from the World Wide Web.

Instructions

Frequently Asked Questions

If you need assistance with your email account, please contact the Technology Service Center at: 718.289.5970 or send an email to tsc@bcc.cuny.edu.

Please Read This Communication!

Dear Faculty and Staff:

Recently, we implemented a password policy which affects your OSSES ID, your email ID, your network
					ID, and your wireless accounts as the credentials are the same.

If you encounter problems when logging into our online email system, your password might have expired.
					Please go to OSSES to change your current password.

Thanks

					Information Technology

	The email service is unavailable at this time due to system maintenance. Please check back on Monday, August 4, 2014 after 7:00 a.m.

Microsoft Office 365 Student Email

Through a CUNY-wide partnership with Microsoft, we are offering students a state-of-the-art email and communications suite. Everything you do-online-email, shared calendars and chatting - now works together better than ever, with 24/7 reliability.

Enjoy these great features:

25 GB of space

Anti-Spam/Virus Protection

24/7 Reliability

Mobile Access

Shared Calendars and Address Book

Collaboration Tools (Skydrive, Microsoft Professional Plus)

Login Instructions

Password Change

Frequently Asked Questions

Free Microsoft® Office 2013 Professional Plus Downloads Available to All BCC Students

For additional technical support, please contact BCC's Technology Service Center at 718.289.5970 or email tsc@bcc.cuny.edu

<link href="http://www.bcc.cuny.edu/wBCC1.css" rel="stylesheet" type="text/css" />

Office 365 | Login Instructions

Welcome to Office 365, Bronx Community College's Student E-mail System. For login information, please follow the instructions below:

If this is your first time logging into the system, click on the following link:

First-time login?

Once you submit your information, your Online Support Services window will provide you with your temporary email password and email address. Please use these credentials to login to your new email account.

If you forgot your username, click the following link:

Forgot your username?

				If you have your login credentials, click on the button labeled "Office 365 Login".

IMPORTANT:

If you are logging in for the first time, we strongly recommend that you change your password to include at least a special character. We also recommend that you login to your e-mail account at least once every 6 months, to ensure that your messages and attachments are kept intact. In the event that you do not login to your email account for an extended period of time, it will be disabled.

<link href="http://www.bcc.cuny.edu/wBCC1.css" rel="stylesheet" type="text/css" />

Office 365 | Password Change

Changing your Password using Office 365

What if I forget my password?

Now you no longer have to take an extra trip to the Technology Service Center (IT Service Desk) to reset your e-mail password. Click here to reset your forgotten password online.

<link href="http://www.bcc.cuny.edu/wBCC1.css" rel="stylesheet" type="text/css" />

Office 365 | Frequently Asked Questions

Welcome to Office 365

What is Office 365?

Why use Office 365?

Getting Started with Office 365

I'm already a student. Will my current e-mail address change?

I'm a new student. What's my e-mail address?

How do I check my e-mail?

Who is eligible for Office 365?

Student Experience with Office 365

Is Office 365 required?

How many e-mails can I send per day?

Using Office 365: Technical Information and How-To, and Support

What if I forget my password?

Do I need to use a Windows PC with Microsoft Internet Explorer?

		[Back to top]

Welcome to Office 365

What is Office 365?

When you enroll, a Office 365 e-mail account will be automatically generated for you. Although Microsoft hosts the e-mail, CUNY maintains control. This student e-mail system is based on Windows Live Hotmail, the most-used Webmail service in the world, although it is customized and co-branded by each CUNY College. Office 365 provides current students and alumni with a set of communications and collaboration services, such as e-mail, shared calendar, and address book.

Why use Office 365?

Office 365 offers significant advantages to students throughout CUNY, such as:

25 GB of storage space – Now you can e-mail that long thesis to your professor.

It's never down! Office 365 is hosted on servers managed by Microsoft to provide the highest levels of reliability and performance.

It's all about the look! Your e-mail is hosted on a new Web 2.0 e-mail system with an intuitive and customizable desktop look and feel.

Connect to your classmates more efficiently! Many of your classmates will be using Office 365, so use the Web-based shared calendar, post files on SkyDrive, send meeting requests, and use other cool collaboration tools to coordinate both academic and non-academic activities.

Receive updates: Receive college-related updates from admin staff.

Control spam and viruses through filtering - Microsoft offers increased spam protection and filtering with your Office 365 account.

Keep your account even after you graduate. Your e-mail account will not be deleted after you graduate - only its look and feel will change. However, to ensure that your messages and files are kept intact, you must login to your account at least once every 365 days, otherwise your content will be cleared, while your e-mail account remains.

We're not done yet! CUNY will work with Microsoft to continue enhancing the Office 365 platform.

		[Back to top]

Getting started with Office 365

I'm already a student. Will my current e-mail address change?

Students from all over CUNY will have a standard e-mail account, such as: firstname.lastname@stu.bcc.cuny.edu. Provided that there are no name conflicts, your e-mail ID should remain the same. For example, if there is more than one "John Smith" on your campus, one person's ID will be "John.Smith" and the second "John.Smith1".

I'm a new student. What's my e-mail address?

The convention for generating e-mail accounts is firstname.lastname@stu.bcc.cuny.edu.

How do I check my e-mail?

Simple:

Go to http://www.bcc.cuny.edu/email

Click on Student E-mail

Click on login. You will be directed to the Microsoft Windows Office 365 login page.

Enter your full student e-mail address -- e.g. firstname.lastname@stu.bcc.cuny.edu and your password.

Who is eligible for Office 365?

All registered students and alumni. Faculty and staff are not eligible for Office 365.

		[Back to top]

Student Experience with Office 365

Is Office 365 required?

Yes. Accounts will be created for you automatically. We highly recommend that you login to your account frequently to review important information sent by your college's faculty, staff, and administration, some of which might be time sensitive.

How many e-mails can I send per day?

E-mails sent between users in your college do not count against the daily maximum. You can send OUT from your Office 365 account 500 e-mails per day to addresses outside the CUNY system. Each e-mail is essentially an alias in the To, Cc, or Bcc line. That means you can send 100 mails to 5 people or 5 messages to 100 people, etc.

		[Back to top]

Using Office 365: Technical Information, How-To, and Support

What if I forget my password?

Now you no longer have to take an extra trip to the Technology Service Center (IT Service Desk) to reset your e-mail password. Click here to reset your forgotten password.

Do I need to use a Windows PC with Microsoft Internet Explorer?

No. All the Web-based services included in Microsoft Office 365 can be accessed from Windows, Mac, or Linux using Internet Explorer or Firefox. Safari and other browsers are also supported. Microsoft has an Open Standards mentality with this product and will continue to have the philosophy of offering flexibility to users.

Microsoft tests against a variety of Web browsers and supports the major browsers across a variety of operating system platforms. If you are using Internet Explorer 6 or 7, you must upgrade to a newer version.

Can I check my account using my mobile phone?

If your mobile phone has a mail client installed, you can configure it to check your Office 365 account via an IMAP connection, using the settings above.

				[Back to top]

				BCC Email

    		FUTURE STUDENTS

Academic Departments

Admission and Recruitment

Apply Online

College Catalog

Workforce and Economic Development

Degree Programs

Freshman Students

International Students

Transfer Students

    		CURRENT STUDENTS

Computer Labs

CUNYfirst MyInfo

Early Childhood Center

Financial Aid

Health Services

IT Workshops

OSSES

Registrar's Office

Scholarship Center

Student Life

Study Abroad

    		FACULTY/STAFF

Center for Sustainable Energy

Center for Teaching, Learning and Technology

Faculty Handbook

Geospatial Center of the CREST Institute

Human Resources

Information Technology

    		ALUMNI & FRIENDS

Alumni Association

Career Development

Giving to BCC

Request a Transcript

Receive text or voice alerts of emergencies and weather-related closings on your campus via cell or home phone and email.

   	Facebook

   	Twitter

   	BCC Wireless Hotspots

   	COMMUNICATOR Newspaper

   	U.P.D.A.T.E Newsletter

   	CUNY Alert!

   	Emergency Closing

	<!link href="http://www.bcc.cuny.edu/wBCC1.css" rel="stylesheet" type="text/css" />

	© 2017 Bronx Community College

	2155 University Avenue
,

Bronx, New York 10453

	Main: 718.289.5100
 •

Admission's Office: 718.289.5895

	Telephone Directory
	|
	Directions
	|
	Accessibility
	|
	Privacy Policy

		Notice of Non-Discrimination |
        Freedom of Information Law (FOIL)
	|

Google Translation Disclaimer


text:
<?xml version="1.0" encoding="UTF-8" ?>
<parameters>

	<MQRecevierSosList>
		<ServiceId>40001</ServiceId>
		<ServiceTopicConfig>40001:mqtest</ServiceTopicConfig>
		<TopicConsumeConfig>mqtest:1_1</TopicConsumeConfig>
		<ServerAddr>127.0.0.1:2181</ServerAddr>
	</MQRecevierSosList >

</parameters>


text:
/*
 * AboutDialog.java
 *
 * Created on 14 de Setembro de 2008, 18:31
 */

package br.gfca.openstereogram.gui;

/**
 *
 * @author  Gustavo
 */
public class AboutDialog extends javax.swing.JDialog {

    /** Creates new form AboutDialog */
    public AboutDialog(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        this.setLocationRelativeTo( this.getParent() );
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        titleLabel = new javax.swing.JLabel();
        descriptionLabel = new javax.swing.JLabel();
        versionLabel = new javax.swing.JLabel();
        urlLabel = new javax.swing.JLabel();
        okButton = new javax.swing.JButton();
        batchModificationLabel = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("About Open Stereogram");

        titleLabel.setFont(new java.awt.Font("Tahoma", 0, 14));
        titleLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        titleLabel.setText("Open Stereogram");
        titleLabel.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);

        descriptionLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        descriptionLabel.setText(" Open source stereogram generator");

        versionLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        versionLabel.setText(" Based on OpenStereogram Version 0.1 (2008)");

        urlLabel.setText("http://gfcaprojects.googlepages.com/openstereogram");

        okButton.setText("OK");
        okButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                okButtonActionPerformed(evt);
            }
        });

        batchModificationLabel.setText("Batch Modification: Nick Meyer (2014)");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(urlLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 416, Short.MAX_VALUE)
                    .addComponent(versionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 416, Short.MAX_VALUE))
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addGap(12, 12, 12)
                .addComponent(batchModificationLabel)
                .addContainerGap(153, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(394, Short.MAX_VALUE)
                .addComponent(okButton)
                .addGap(12, 12, 12))
            .addGroup(layout.createSequentialGroup()
                .addGap(12, 12, 12)
                .addComponent(descriptionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 416, Short.MAX_VALUE)
                .addContainerGap(12, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addGap(12, 12, 12)
                .addComponent(titleLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 416, Short.MAX_VALUE)
                .addContainerGap(12, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(titleLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(descriptionLabel)
                .addGap(24, 24, 24)
                .addComponent(versionLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(urlLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 48, Short.MAX_VALUE)
                .addComponent(batchModificationLabel)
                .addGap(22, 22, 22)
                .addComponent(okButton)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
        this.dispose();
    }//GEN-LAST:event_okButtonActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel batchModificationLabel;
    private javax.swing.JLabel descriptionLabel;
    private javax.swing.JButton okButton;
    private javax.swing.JLabel titleLabel;
    private javax.swing.JLabel urlLabel;
    private javax.swing.JLabel versionLabel;
    // End of variables declaration//GEN-END:variables

}


text:
> _@api_ **private**

Adds tracking fields to a collection

 track: true

Added fields

    {
		createdAt: false,
		createdBy: false,
		updatedAt: false,
		updatedBy: false
	};

Uses  list.schema.pre('save'...)  to alter documents.

 code


text:
import Snabbdom from '../../../src/index'

export default () => {
  var Component = ({ name }) => // eslint-disable-line no-unused-vars
    Snabbdom.createElement( 'div', null, "Hello ", name )

  return Snabbdom.createElement( Component, null )
}


text:
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:weightSum="10">

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="0.15"
        android:background="#E60000"

        />

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="0.4"

        />
    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1.4"
        android:minHeight="58dp"
        >
        <TextView
        android:id="@+id/subject_num"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:text="num"
        android:textSize="12dp"
        android:textColor="#000000"
        android:padding="2dp"
        />

    </LinearLayout>

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="4.76"
  		android:minHeight="58dp"
        >
        <TextView
        android:id="@+id/subject_title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:text="title"
        android:textStyle="bold"
        android:textSize="16dp"
        android:textColor="#000000"
        android:padding="2dp"
        />

    </LinearLayout>

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1.6"
        android:minHeight="58dp"
        >
        <TextView
        android:id="@+id/subject_pro"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:text="pro"
        android:textSize="15dp"
        android:textColor="#000000"
        android:padding="5dp"
        />

    </LinearLayout>

     <LinearLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1.71"
        android:minHeight="58dp"
        android:orientation="horizontal"
        android:weightSum="3"
        >

         <TextView
             android:id="@+id/subject_max_stu"
	        android:layout_width="0dp"
	        android:layout_height="wrap_content"
	        android:layout_weight="1"
	        android:layout_gravity="center_vertical"
	        android:text="000"
	        android:textSize="12dp"
	        android:textColor="#000000"

             />
         <TextView
             android:id="@+id/subject_curr_stu"
	        android:layout_width="0dp"
	        android:layout_height="wrap_content"
	        android:layout_weight="1"
	        android:layout_gravity="center_vertical"
	        android:text="000"
	        android:textSize="12dp"
	        android:textColor="#000000"
             />
         <TextView
             android:id="@+id/subject_resr_stu"
	        android:layout_width="0dp"
	        android:layout_height="wrap_content"
	        android:layout_weight="1"
	        android:layout_gravity="center_vertical"
	        android:text="000"
	        android:textSize="12dp"
	        android:textColor="#000000"
             />

     </LinearLayout>

</LinearLayout>


text:
<?php

namespace Silktide\Syringe\IntegrationTests\Tag;

use PHPUnit\Framework\TestCase;
use Silktide\Syringe\IntegrationTests\Examples\ExampleClass;
use Silktide\Syringe\IntegrationTests\Examples\TestTagInterface;
use Silktide\Syringe\Syringe;
use Silktide\Syringe\TagCollection;

class EmptyTagTest extends TestCase
{
    public function testConstructorTags()
    {
        $container = Syringe::build([
            "paths" => [__DIR__],
            "files" => ["file2.yml"]
        ]);

        /**
         * @var ExampleClass $service
         */
        $service = $container["my_service"];
        self::assertInstanceOf(ExampleClass::class, $service);
        self::assertInstanceOf(TagCollection::class, $service->getFirstArgument());

        $tags = $container["#untagged"];
        self::assertInstanceOf(TagCollection::class, $tags);
    }

    public function testCallableTags()
    {
        $container = Syringe::build([
            "paths" => [__DIR__],
            "files" => ["file2.yml"]
        ]);

        /**
         * @var ExampleClass $service
         */
        $service = $container["my_service2"];
        self::assertInstanceOf(ExampleClass::class, $service);

        $value = $service->getValue("vegetable");
        self::assertInstanceOf(TagCollection::class, $value);

        self::assertCount(0, $value);

        $tags = $container["#sweetcorn"];
        self::assertInstanceOf(TagCollection::class, $tags);
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Revis. gen. pl. (Leipzig) 3(2): (1898)

#### Original name
Macmillanina suffusa Kuntze

### Remarks
null


text:
#pragma once
#include <aws/kinesisvideo/KinesisVideo_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Json
{
  class JsonValue;
  class JsonView;
} // namespace Json
} // namespace Utils
namespace KinesisVideo
{
namespace Model
{

  /**
   *
The structure that contains the information required to deliver a
   * notification to a customer.

See Also:
   AWS
   * API Reference

   */
  class AWS_KINESISVIDEO_API NotificationDestinationConfig
  {
  public:
    NotificationDestinationConfig();
    NotificationDestinationConfig(Aws::Utils::Json::JsonView jsonValue);
    NotificationDestinationConfig& operator=(Aws::Utils::Json::JsonView jsonValue);
    Aws::Utils::Json::JsonValue Jsonize() const;

    /**
     *
The Uniform Resource Idenifier (URI) that identifies where the images will be
     * delivered.

     */
    inline const Aws::String& GetUri() const{ return m_uri; }

    /**
     *
The Uniform Resource Idenifier (URI) that identifies where the images will be
     * delivered.

     */
    inline bool UriHasBeenSet() const { return m_uriHasBeenSet; }

    /**
     *
The Uniform Resource Idenifier (URI) that identifies where the images will be
     * delivered.

     */
    inline void SetUri(const Aws::String& value) { m_uriHasBeenSet = true; m_uri = value; }

    /**
     *
The Uniform Resource Idenifier (URI) that identifies where the images will be
     * delivered.

     */
    inline void SetUri(Aws::String&& value) { m_uriHasBeenSet = true; m_uri = std::move(value); }

    /**
     *
The Uniform Resource Idenifier (URI) that identifies where the images will be
     * delivered.

     */
    inline void SetUri(const char* value) { m_uriHasBeenSet = true; m_uri.assign(value); }

    /**
     *
The Uniform Resource Idenifier (URI) that identifies where the images will be
     * delivered.

     */
    inline NotificationDestinationConfig& WithUri(const Aws::String& value) { SetUri(value); return *this;}

    /**
     *
The Uniform Resource Idenifier (URI) that identifies where the images will be
     * delivered.

     */
    inline NotificationDestinationConfig& WithUri(Aws::String&& value) { SetUri(std::move(value)); return *this;}

    /**
     *
The Uniform Resource Idenifier (URI) that identifies where the images will be
     * delivered.

     */
    inline NotificationDestinationConfig& WithUri(const char* value) { SetUri(value); return *this;}

  private:

    Aws::String m_uri;
    bool m_uriHasBeenSet;
  };

} // namespace Model
} // namespace KinesisVideo
} // namespace Aws


text:
/* */
var Rx = require("./dist/rx");
require("./dist/rx.aggregates");
require("./dist/rx.async");
require("./dist/rx.backpressure");
require("./dist/rx.binding");
require("./dist/rx.coincidence");
require("./dist/rx.experimental");
require("./dist/rx.joinpatterns");
require("./dist/rx.sorting");
require("./dist/rx.virtualtime");
require("./dist/rx.testing");
require("./dist/rx.time");
module.exports = Rx;


text:
"""Deprecated module for backwards compatibility.  Replaced by
:mod:`lino.core.utils`.

"""

from lino.core.utils import *


text:
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

${Confirm}

        ${You are about to delete the} {{SelectedItemToRemove}}.

        ${Recover data after deletion will not be possible.}

        ${For confirmation, enter repository name, which should be removed:}

          <input type="text" class="form-control" ng-model="ConfirmNameToRemove" maxlength="200" />

        <button class="btn btn-danger pull-left" ng-click="Delete()">${Delete}</button>
        <button class="btn btn-default pull-left" data-dismiss="modal" aria-hidden="true">${Cancel}</button>


text:
{{ landing.heroTitle }}

{{ point.title }}

{{ point.description }}


text:
import unittest

from issue.models import Issue
from pyamf.remoting.client import RemotingService

from django.core.urlresolvers import reverse

class IssueTestCase(unittest.TestCase):
    def setUp(self):
        self.gw = RemotingService('http://localhost:8000%s' % reverse('gateway'))
        self.service = self.gw.getService('account')

    def testGatewayLogin(self):
        values = self.service.login("thoas", "toto")


text:
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System;
using System.Configuration;
using System.Windows;
using SourceCodeIndexer.STAC;
using SourceCodeIndexer.STAC.Enum;
using SourceCodeIndexer.STAC.FileStats;
using SourceCodeIndexer.STAC.Models;
using SourceCodeIndexer.STAC.Notification;
using SourceCodeIndexer.STAC.Stemmer;
using SourceCodeIndexer.STAC.TextExtractors;
using SourceCodeIndexer.UI.Enum;
using SourceCodeIndexer.UI.Models;
using MessageBox = System.Windows.MessageBox;
using SplitterType = SourceCodeIndexer.STAC.Enum.SplitterType;

namespace SourceCodeIndexer.UI.ViewModels
{
    public class IndexerWindowViewModel : ViewModelBase, INotificationHandler
    {
        private const int WindowHeightMax = 740;
        private const int WindowHeightMin = 480;

        public IndexerWindowViewModel()
        {
            SplitTypes = SplitTypes = EnumUtility.GetSelectEnumItems<ExtractType>();

            WindowHeight = WindowHeightMin;
        }

        #region Lemmatizer

        private IStemmer _stanfordLemmatizer;

        /// <summary>
        /// Tries initializing Stanford Lemmatizer
        /// </summary>
        /// <returns>True if initialized else false</returns>
        public bool TryInitializeLemmatizer()
        {
            try
            {
                string stanfordModelsPath = ConfigurationManager.AppSettings["StanfordModelsPath"];
                if (_stanfordLemmatizer == null)
                {
                    Status = "Initializing Stanford Lemmatizer";
                    _stanfordLemmatizer = new StanfordLemmatizer(stanfordModelsPath);
                }
                Status = "Stanford Lemmatizer Initialized";
                return true;
            }
            catch (Exception e)
            {
                Status = "Error Initializing Stanford Lemmatizer";
                MessageBox.Show("Stanford Lemmatizer could not be loaded. Exception:" + Environment.NewLine + e.Message, "Error Initializing Stanford Lemmatizer", MessageBoxButton.OK, MessageBoxImage.Error);
                return false;
            }
        }

        #endregion

        #region INotificationHandler

        // This will store result for all. TODO YesToAll for future
        private MessageBoxResult _tempResult = MessageBoxResult.None;
        public bool GetYesNoAnswer(QuestionType questionType, string message)
        {
            if (_tempResult == MessageBoxResult.None)
                _tempResult = MessageBox.Show(message, "Warning", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
            return _tempResult == MessageBoxResult.Yes;
        }

        public void UpdateStatus(NotificationType notificationType, int valueCompleted, int totalValue, string message)
        {
            Status = message;
        }

        /// <summary>
        /// This is only used during loading files currently so just use for that
        /// </summary>
        /// <param name="message">Files loaded</param>
        public void UpdateStatus(string message)
        {
            FilesLoaded = message;
        }

        public void UpdateProgress(double percentCompleted)
        {
            ProgressValue = percentCompleted;
        }

        #endregion

        #region Status/Index

        private string _filesLoaded = "Loading Files ...";
        public string FilesLoaded
        {
            get { return _filesLoaded; }
            set
            {
                _filesLoaded = "Loading Files ... " + value;
                NotifyPropertyChanged(() => FilesLoaded);
            }
        }

        private bool _hasIndexingResult;
        public bool HasIndexingResult
        {
            get { return _hasIndexingResult;}
            set
            {
                _hasIndexingResult = value;
                NotifyPropertyChanged(() => HasIndexingResult);
                NotifyPropertyChanged(() => DisplayNumberBottom);
                WindowHeight = value ? WindowHeightMax : WindowHeightMin;
            }
        }

        public bool DisplayNumberBottom
        {
            get { return _hasIndexingResult && ! _isIndexingInProgress; }
        }

        private int _windowHeight;
        public int WindowHeight
        {
            get { return _windowHeight; }
            set
            {
                _windowHeight = value;
                NotifyPropertyChanged(() => WindowHeight);
                NotifyPropertyChanged(() => WindowHeightMinResizeable);
            }
        }

        public int WindowHeightMinResizeable
        {
            get { return  _windowHeight > 480 ? _windowHeight - 100 : 480; }
        }

        private double _progressValue;
        public double ProgressValue
        {
            get { return _progressValue; }
            set
            {
                _progressValue = value;
                NotifyPropertyChanged(() => ProgressValue);
            }
        }

        private bool _isIndexingInProgress;
        public bool IsIndexingInProgress
        {
            get { return _isIndexingInProgress;}
            set
            {
                _isIndexingInProgress = value;
                NotifyPropertyChanged(() => IsIndexingInProgress);
                NotifyPropertyChanged(() => DisplayNumberBottom);
            }
        }

        private bool _canStartIndexing;
        public bool CanStartIndexing
        {
            get { return _canStartIndexing;}
            set
            {
                _canStartIndexing = value;
                NotifyPropertyChanged(() => CanStartIndexing);
            }
        }

        private string _status;
        public string Status
        {
            get { return _status; }
            set
            {
                _status = value;
                NotifyPropertyChanged(() => Status);
            }
        }

        public bool ApplySpellCheck { get; set; }

        public bool ApplyStemmer { get; set; }

        public bool ApplyLemmatizer { get; set; }

        /// <summary>
        /// Runs indexer
        /// </summary>
        public void IndexFiles()
        {
            BackgroundWorker backgroundWorker = new BackgroundWorker();
            backgroundWorker.DoWork += BackgroundWorker_DoWork;
            backgroundWorker.RunWorkerCompleted += BackgroundWorker_WorkCompleted;
            backgroundWorker.RunWorkerAsync();
        }

        /// <summary>
        /// Runs indexer
        /// </summary>
        private void BackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            IsIndexingInProgress = true;
            UpdateCanStartIndexing();

            IndexerConfiguration.SplitterSetting splitterSetting = new IndexerConfiguration.SplitterSetting()
            {
                UseDefaultSplitterOfType = ApplyBestSuffixSplit
                    ? SplitterType.Advance
                    : (ApplyCamelCaseSplit ? SplitterType.CamelCase : SplitterType.None),
            };

            IndexerConfiguration.DictionarySetting dictionarySetting = new IndexerConfiguration.DictionarySetting()
            {
                DefaultDictionaryRemoveEnglishStopWord = RemoveEnglishStopWords,
                DefaultDictionaryRemoveProgrammingStopWord = RemoveProgrammingStopWords
            };

            IndexerConfiguration.TextCorrectorSetting textCorrectorSetting = new IndexerConfiguration.
                TextCorrectorSetting()
            {
                UseDefaultSpellChecker = ApplySpellCheck
            };

            ExtractType extractType = 0;
            SplitTypes.Where(x => x.IsSelected).ToList().ForEach(x => extractType |= x.Value);

            IndexerConfiguration.TextExtractorSetting textExtractorSetting = new IndexerConfiguration.
                TextExtractorSetting()
            {
                ExtractType = extractType
            };

            IStemmer stemmer = ApplyLemmatizer ? _stanfordLemmatizer : null;
            IndexerConfiguration.StemmerSetting stemmerSetting = new IndexerConfiguration.StemmerSetting()
            {
                CustomStemmer = stemmer,
                UseDefaultPorterStemmer = ApplyStemmer
            };

            List<IndexerFile> selectedFiles = SelectedFiles.ToList();

            IndexerConfiguration indexerConfiguration = IndexerConfiguration.GetIndexerConfiguration(splitterSetting, dictionarySetting, textExtractorSetting, textCorrectorSetting, stemmerSetting, selectedFiles, this);

            Indexer indexer = new Indexer(indexerConfiguration);
            e.Result = indexer.Execute();
        }

        private IndexerResult _result;

        /// <summary>
        /// Populates result after indexer completes
        /// </summary>
        private void BackgroundWorker_WorkCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            ProgressValue = 0;
            IsIndexingInProgress = false;
            HasIndexingResult = true;
            NotifyPropertyChanged(() => HasIndexingResult);
            UpdateCanStartIndexing();

            if (e.Error != null)
            {
                Status = e.Error.Message;
                return;
            }

            if (e.Cancelled)
            {
                Status = "Process Cancelled.";
                return;
            }

            IndexerResult result = (IndexerResult) e.Result;
            if (result == null)
            {
                Status = "Process did not return any result.";
                return;
            }

            IdentifierCount = result.GetSplitResultList().Count;
            DictionaryWordsCount = result.GetDictionaryWordList().Count;
            TokensCount = result.GetTokenList().Count;
            UnidentifiedWordsCount = result.GetUnidentifiedList().Count;

            DictionaryWords = string.Join(Environment.NewLine, result.GetDictionaryWordList().Keys.OrderBy(x => x).ThenBy(x => x.Length));
            Tokens = string.Join(Environment.NewLine, result.GetTokenList().Keys.OrderBy(x => x).ThenBy(x => x.Length));
            UnidentifiedWords = string.Join(Environment.NewLine, result.GetUnidentifiedList().Keys.OrderBy(x => x.Length).ThenBy(x => x));
            CorrectedWords = string.Join(Environment.NewLine, result.GetCorrectionDictionary().OrderBy(x => x.Key).Select(x => x.Key + ": " + x.Value.Word));
            StemmedWords = string.Join(Environment.NewLine, result.GetStemmedDictionary().OrderBy(x => x.Key).Select(x => x.Key + ": " + x.Value.Word));

            NotifyPropertyChanged(() => IdentifierCount);
            NotifyPropertyChanged(() => DictionaryWordsCount);
            NotifyPropertyChanged(() => TokensCount);
            NotifyPropertyChanged(() => UnidentifiedWordsCount);
            NotifyPropertyChanged(() => DictionaryWords);
            NotifyPropertyChanged(() => UnidentifiedWords);
            NotifyPropertyChanged(() => Tokens);
            NotifyPropertyChanged(() => StemmedWords);
            NotifyPropertyChanged(() => CorrectedWords);

            _result = result;
            Status = "";
        }

        #endregion

        #region Indexing result

        public int IdentifierCount { get; set; }

        public int DictionaryWordsCount { get; set; }

        public int TokensCount { get; set; }

        public int UnidentifiedWordsCount { get; set; }

        public string DictionaryWords { get; set; }

        public string Tokens { get; set; }

        public string UnidentifiedWords { get; set; }

        public string StemmedWords { get; set; }

        public string CorrectedWords { get; set; }

        #endregion

        #region Splitters

        private bool _applyBestSuffixSplit;

        public bool ApplyBestSuffixSplit
        {
            get { return _applyBestSuffixSplit; }
            set
            {
                _applyBestSuffixSplit = value;
                if (_applyBestSuffixSplit)
                    _applyCamelCaseSplit = false;

                NotifyPropertyChanged(() => ApplyBestSuffixSplit);
                NotifyPropertyChanged(() => ApplyCamelCaseSplit);
            }
        }

        private bool _applyCamelCaseSplit;
        public bool ApplyCamelCaseSplit
        {
            get { return _applyCamelCaseSplit; }
            set
            {
                _applyCamelCaseSplit = value;
                if (_applyCamelCaseSplit)
                    _applyBestSuffixSplit = false;

                NotifyPropertyChanged(() => ApplyBestSuffixSplit);
                NotifyPropertyChanged(() => ApplyCamelCaseSplit);
            }
        }

        public bool RemoveEnglishStopWords { get; set; }

        public bool RemoveProgrammingStopWords { get; set; }

        public List<SelectEnumItem<ExtractType>> SplitTypes { get; }

        #endregion

        #region Text Extractors

        private IList<Tuple<ITextExtractor, FileStatReaderBase>> _textExtractorsWithReaders => new List<Tuple<ITextExtractor, FileStatReaderBase>>()
        {
            new Tuple<ITextExtractor, FileStatReaderBase>(new JavaTextExtractor(), new JavaFileStatReader()),
            new Tuple<ITextExtractor, FileStatReaderBase>(new CPlusPlusTextExtractor(), new CPlusPlusFileStatReader()),
            new Tuple<ITextExtractor, FileStatReaderBase>(new CSharpTextExtractor(), new CSharpFileStatReader()),
            new Tuple<ITextExtractor, FileStatReaderBase>(new SmallTalkTextExtractor(), new CSharpFileStatReader())
        };

        #endregion

        #region Files

        public ObservableCollection<IndexerFile> AvailableFiles { get; } = new ObservableCollection<IndexerFile>();

        public ObservableCollection<IndexerFile> SelectedFiles { get; } = new ObservableCollection<IndexerFile>();

        /// <summary>
        /// Moves selected items from available file list to selected file list
        /// </summary>
        /// <param name="selectedItems">Collection of selected items</param>
        internal void MoveSelectedAvailableToSelected(IList selectedItems)
        {
            foreach (IndexerFile file in selectedItems.Cast<IndexerFile>().ToList())
            {
                SelectedFiles.Add(file);
                AvailableFiles.Remove(file);
            }
        }

        /// <summary>
        /// Moves selected items from selected file list to available file list
        /// </summary>
        /// <param name="selectedItems">Collection of selected items</param>
        internal void MoveSelectedSelectedToAvailable(IList selectedItems)
        {
            foreach (IndexerFile file in selectedItems.Cast<IndexerFile>().ToList())
            {
                AvailableFiles.Add(file);
                SelectedFiles.Remove(file);
            }
        }

        /// <summary>
        /// Moves all items from available file list to selected file list
        /// </summary>
        internal void MoveAllAvailableToSelected()
        {
            foreach (IndexerFile file in AvailableFiles)
            {
                SelectedFiles.Add(file);
            }
            AvailableFiles.Clear();
        }

        /// <summary>
        /// Moves all items from selected file list to available file list
        /// </summary>
        internal void MoveAllSelectedToAvailable()
        {
            foreach (IndexerFile file in SelectedFiles)
            {
                AvailableFiles.Add(file);
            }
            SelectedFiles.Clear();
        }

        private ProjectStat _projectStat;

        private bool _isBusy = false;
        public bool IsBusy
        {
            get { return _isBusy; }
            set
            {
                _isBusy = value;
                NotifyPropertyChanged(() => IsBusy);
            }
        }

        /// <summary>
        /// Loads Project from path
        /// </summary>
        /// <param name="projectPath">Path to project</param>
        public void LoadFiles(string projectPath)
        {
            SelectedFiles.Clear();
            AvailableFiles.Clear();

            BackgroundWorker backgroundWorker = new BackgroundWorker();
            backgroundWorker.DoWork += LoadFilesBackgroundWorker_DoWork;
            backgroundWorker.RunWorkerCompleted += LoadFilesBackgroundWorker_WorkCompleted;
            backgroundWorker.RunWorkerAsync(projectPath);
        }

        /// <summary>
        /// Loads files
        /// </summary>
        private void LoadFilesBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            IsBusy = true;

            string projectPath = e.Argument.ToString();
            _projectStat = new ProjectStatReader(projectPath, _textExtractorsWithReaders.SelectMany(x => x.Item1.FileExtensionFor()).Distinct().ToList(), this).GetProjectStat();

            if (_projectStat == null)
            {
                MessageBox.Show("The path: " + projectPath + " does not exists.", "Folder not found", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            // populate list
            if (_projectStat == null)
                return;

            // populate counts
            Dictionary<string, FileStatReaderBase> extensionFileReaderBases = new Dictionary<string, FileStatReaderBase>();
            foreach (var tuple in _textExtractorsWithReaders)
            {
                foreach (string extension in tuple.Item1.FileExtensionFor())
                {
                    extensionFileReaderBases.Add(extension.ToLowerInvariant(), tuple.Item2);
                }
            }

            foreach (FileStat fileStat in _projectStat.FileStats)
            {
                extensionFileReaderBases[fileStat.IndexerFile.Extension].UpdateFileStatCount(fileStat);
            }

            e.Result = _projectStat;
        }

        /// <summary>
        /// Load file completed
        /// </summary>
        private void LoadFilesBackgroundWorker_WorkCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            IsBusy = false;

            _projectStat.FileStats.Select(x => x.IndexerFile).OrderBy(x => x.Name).ToList().ForEach(x => AvailableFiles.Add(x));

            UpdateCanStartIndexing();
        }
        #endregion

            /// <summary>
            /// Updates start indexing button
            /// </summary>
        public void UpdateCanStartIndexing()
        {
            CanStartIndexing = !IsIndexingInProgress && SplitTypes.Any(x => x.IsSelected) && SelectedFiles.Any();
        }

        #region Menu

        public void DisplayAboutWindow()
        {
            AboutWindow aboutWindow = new AboutWindow();
            aboutWindow.ShowDialog();
        }

        public void DisplayCustomDictionary()
        {
            CustomDictionaryWindow customDictionaryWindow = new CustomDictionaryWindow();
            customDictionaryWindow.ShowDialog();
        }

        public void DisplayLocMetric()
        {
            LocMetricWindow locMetricWindow = new LocMetricWindow();
            locMetricWindow.ViewModel.LoadStats(_projectStat);
            locMetricWindow.ShowDialog();
        }

        public void Export(string exportFolderPath)
        {
            exportFolderPath = exportFolderPath.TrimEnd('\\');
            using (StreamWriter fileWriter = new StreamWriter(exportFolderPath + "\\" + _projectStat.Name + "_file.txt", true))
            {
                SelectedFiles.ToList().ForEach(file =>
                {
                    var allWords = _result.GetDictionaryWordList().Where(x => x.Value.Contains(file)).Select(x => x.Key).OrderBy(x => x).ThenBy(x => x.Length)
                    .Union(_result.GetTokenList().Where(x => x.Value.Contains(file)).Select(x => x.Key).OrderBy(x => x).ThenBy(x => x.Length))
                    .Union(_result.GetUnidentifiedList().Where(x => x.Value.Contains(file)).Select(x => x.Key).OrderBy(x => x.Length).ThenBy(x => x))
                    .Union(_result.GetCorrectionDictionary().Where(x => x.Value.IndexerFiles.Contains(file)).Select(x => x.Key).OrderBy(x => x))
                    .Union(_result.GetStemmedDictionary().OrderBy(x => x.Key).Where(x => x.Value.IndexerFiles.Contains(file)).Select(x => x.Key).OrderBy(x => x));
                    fileWriter.WriteLine(file.Name + " " + string.Join(" ", allWords));
                    fileWriter.Flush();
                });
            }

            File.WriteAllLines(exportFolderPath + "\\" + _projectStat.Name + "_tokens.txt",
                new[] { "Natural Words:" }
                .Union(_result.GetDictionaryWordList().Keys.OrderBy(x => x).ThenBy(x => x.Length))
                .Union(new[] { "Abbreviations:" })
                .Union(_result.GetTokenList().Keys.OrderBy(x => x).ThenBy(x => x.Length))
                .Union(new[] { "Unidentified Words:" })
                .Union(_result.GetUnidentifiedList().Keys.OrderBy(x => x.Length).ThenBy(x => x))
                .Union(new[] { "Spell Checking:" })
                .Union(_result.GetCorrectionDictionary().OrderBy(x => x.Key).Select(x => x.Key + ": " + x.Value.Word))
                .Union(new[] { "Stemmed Words:" })
                .Union(_result.GetStemmedDictionary().OrderBy(x => x.Key).Select(x => x.Key + ": " + x.Value.Word)));

            using (StreamWriter fileWriter = new StreamWriter(exportFolderPath + "\\" + _projectStat.Name + "_split.html", false))
            {
                fileWriter.WriteLine("<!DOCTYPE HTML><html><head><style>span{margin: 5px;}.unidentified{color: red;}.identified{color: black;}.token{color: blue;}.misspelled{color: green}.stemmed{color: #AA3333;}</style></head><body>");
                fileWriter.WriteLine("<h3>Color Index</h3>");
                fileWriter.WriteLine("<span class='identified'>Natural word</span><br />");
                fileWriter.WriteLine("<span class='unidentified'>Unidentified word</span><br />");
                fileWriter.WriteLine("<span class='token'>Abbreviation</span><br />");
                fileWriter.WriteLine("<span class='misspelled'>Misspelled word</span><br />");
                fileWriter.WriteLine("<span class='stemmed'>Stemmed/Lemmatized word</span><br />");
                fileWriter.WriteLine("<br />");
                fileWriter.WriteLine("<h3>Splits</h3>");
                StringBuilder stringBuilder = new StringBuilder();
                _result.GetSplitResultList().ToList().ForEach(identifierSplitResult =>
                {
                    stringBuilder.Append("<div class='");
                    if (identifierSplitResult.Splits.Any(x => x.SplitIdentification == SplitIdentification.Unidentified))
                        stringBuilder.Append("has-unidentified");
                    if (identifierSplitResult.Splits.Any(x => x.SplitIdentification == SplitIdentification.Token || x.SplitIdentification == SplitIdentification.MergedToken))
                        stringBuilder.Append("has-token");
                    if (identifierSplitResult.Splits.Any(x => x.SplitIdentification == SplitIdentification.TokenMisspelled || x.SplitIdentification == SplitIdentification.WordMisspelled))
                        stringBuilder.Append("has-misspelled");
                    stringBuilder.Append("'>" + identifierSplitResult.Identifier + ": ");
                    identifierSplitResult.Splits.ToList().ForEach(split =>
                    {
                        switch (split.SplitIdentification)
                        {
                            case SplitIdentification.Identified:
                                stringBuilder.Append("<span class='identified'>");
                                break;

                            case SplitIdentification.Unidentified:
                                stringBuilder.Append("<span class='unidentified'>");
                                break;

                            case SplitIdentification.MergedToken:
                            case SplitIdentification.Token:
                            case SplitIdentification.SingleLetterIdentifier:
                                stringBuilder.Append("<span class='token'>");
                                break;

                            case SplitIdentification.TokenMisspelled:
                            case SplitIdentification.WordMisspelled:
                                stringBuilder.Append("<span class='misspelled'>");
                                break;

                            case SplitIdentification.WordStemmed:
                            case SplitIdentification.TokenStemmed:
                                stringBuilder.Append("<span class='stemmed'>");
                                break;
                        }
                        stringBuilder.Append(split.Split);
                        stringBuilder.Append("</span>");
                    });
                    stringBuilder.Append("</div>");
                    fileWriter.WriteLine(stringBuilder.ToString());
                    stringBuilder.Clear();
                });

                fileWriter.WriteLine("</body></html>");
            }

        }

        #endregion
    }
}