text:
describe('Backbone.Facetr', function() {
    // test dataset
    var dataset1 = [
        {
            'Name'      : {
                'FirstName' : 'Bob',
                'LastName' : 'Smith'
            },
            'Age'       : 20,
            'Country'   : 'Australia',
            'Hobbies'   : ['fishing','painting','playing the ukulele'],
            'Profession': 'manager'
        },
        {
            'Name'      : {
                'FirstName' : 'Otto',
                'LastName'  : 'Von Braun'
            },
            'Age'       : 35,
            'Country'   : 'New Zealand',
            'Hobbies'   : ['drawing', 'painting'],
            'Profession': 'team manager'
        },
        {
            'Name'      : {
                'FirstName' : 'Sarah',
                'LastName'  : 'Smith'
            },
            'Age'       : 28,
            'Country'   : 'Ireland',
            'Hobbies'   : ['shopping','painting'],
            'Profession': 'project manager'
        },
        {
            'Name'      : {
                'FirstName' : 'Roberta',
                'LastName'  : 'Green'
            },
            'Age'       : 28,
            'Country'   : 'Australia',
            'Hobbies'   : ['shopping'],
            'Profession': 'project manager'
        }
    ],
    dataset2 = [
        {
            'Name'      : {
                'FirstName' : 'David',
                'LastName' : 'Smith'
            },
            'Age'       : 48,
            'Country'   : 'Canada',
            'Hobbies'   : ['fishing','playing the ukulele','drawing']
        },
        {
            'Name'      : {
                'FirstName' : 'Jenny',
                'LastName'  : 'McDonald'
            },
            'Age'       : 16,
            'Country'   : 'Scotland',
            'Hobbies'   : ['shopping', 'painting']
        }
    ],
    // test collection
    collection = new Backbone.Collection(dataset1);

    beforeEach(function() {
        // reload dataset in the collection
        collection.reset(dataset1);

        // clear facets after each test
        Facetr(collection).clear();
    });

    // Facetr
    describe('is a function that given a Backbone.Collection as argument', function() {
        it('creates a FacetCollection and stores it in Facetr internal hash', function() {
            // as FacetCollection instances have a method called 'facet', we check its existance on the returned
            // object to be sure it is an instance of FacetCollection
            // this is the only way to test this as FacetCollection function is hidden by closure in Facetr code
            expect(Facetr(collection).facet).toBeDefined();
        });

        it('can be given also an id as parameter, to be associated with the collection', function(){
            expect(Facetr(collection, 'mainCollection').collection()).toEqual(collection);
        });

        it('sets the facetrid property on the collection', function() {
            expect(collection.facetrid).toBeDefined();
        });

        // FacetCollection
        describe('returns a FacetCollection that', function() {

            // FacetCollection facet
            describe('has a facet method that', function() {
                it('creates a new facet given a facet name and returns it for chaining', function() {
                    expect(Facetr(collection).facet('Country').toJSON().data.name).toBe('Country');
                });

                it('sends an event to the facet to compute the value/count instances from the collection models', function() {
                    expect(Facetr(collection).facet('Country').toJSON().values.length).toEqual(3);
                    expect(Facetr(collection).facet('Country').toJSON().values[0].value).toBe('Australia');
                    expect(Facetr(collection).facet('Country').toJSON().values[0].count).toEqual(2);
                });

                it('works also with properties of properties', function() {
                    expect(Facetr(collection).facet('Name.LastName').toJSON().values.length).toEqual(3);
                    expect(Facetr(collection).facet('Name.LastName').toJSON().values[0].value).toBe('Green');
                    expect(Facetr(collection).facet('Name.LastName').toJSON().values[0].count).toEqual(1);
                });

                it('works also with undefined values, 0, booleans and empty arrays', function() {
                    var collection = new Backbone.Collection([
                        {
                            Title : 'title',
                            Domain: undefined,
                            Count: 0,
                            Users: [],
                            Active: false
                        },
                        {
                            Title : 'another title',
                            Domain: 'domain',
                            Count: 5,
                            Users: [],
                            Active: true
                        }
                    ]);

                    var domain = Facetr(collection).facet('Domain');
                    var count = Facetr(collection).facet('Count');
                    var users = Facetr(collection).facet('Users');
                    var active = Facetr(collection).facet('Active');

                    expect(domain.toJSON().values.length).toBe(2);
                    expect(domain.toJSON().values[0].value).toBe('domain');
                    expect(domain.toJSON().values[1].value).toBe('undefined');

                    expect(count.toJSON().values.length).toBe(2);
                    expect(count.toJSON().values[0].value).toBe(0);
                    expect(count.toJSON().values[1].value).toBe(5);

                    expect(users.toJSON().values.length).toBe(1);
                    expect(users.toJSON().values[0].value).toBe('undefined');

                    expect(active.toJSON().values.length).toBe(2);
                    expect(active.toJSON().values[0].value).toBe(false);
                    expect(active.toJSON().values[1].value).toBe(true);
                });

                it('works also with array properties', function() {
                    expect(Facetr(collection).facet('Hobbies').toJSON().values.length).toEqual(5);
                    expect(Facetr(collection).facet('Hobbies').toJSON().values[0].value).toBe('drawing');
                    expect(Facetr(collection).facet('Hobbies').toJSON().values[0].count).toBe(1);
                });

                //it('throws an error if the property is an object or undefined', function() {
                it('throws an error if the property is an object', function() {
                    expect(function() {
                        Facetr(collection).facet('Name');
                    }).toThrow(new Error('Model property can only be a value (string,number,boolean) or Array of values, not an object'));
                });

                it('triggers a "facet" event, passing the facetName to the event handler, unless true (silent) is passed as last parameter', function(){
                    var facetCollection = Facetr(collection);
                    spyOn(facetCollection, 'trigger');
                    facetCollection.facet('Age');
                    expect(facetCollection.trigger).toHaveBeenCalledWith('facet', 'Age');
                    facetCollection.facet('Age', 'and', true);
                    expect(facetCollection.trigger.calls.count()).toEqual(1);
                });

                it('triggers a "filter" event whenever a value is added to a facet, unless true (silent) is passed as last parameter. The event passes the facetName and the value to the event handler', function(){
                    var facetCollection = Facetr(collection);
                    spyOn(facetCollection, 'trigger');
                    facetCollection.facet('Age', 'and', true).value(20);
                    expect(facetCollection.trigger).toHaveBeenCalledWith('filter', 'Age', 20);
                    facetCollection.facet('Age', 'and', true).value(20, 'and', true);
                    expect(facetCollection.trigger.calls.count()).toEqual(1);
                });

                it('triggers an "unfilter" event whenever a value is removed from a facet, unless true (silent) is passed as last parameter. The event passes the facetName and the value to the event handler', function(){
                    var facetCollection = Facetr(collection);
                    spyOn(facetCollection, 'trigger');
                    facetCollection.facet('Age', 'and', true).value(20, 'and', true);
                    facetCollection.facet('Age', 'and', true).removeValue(20);
                    expect(facetCollection.trigger).toHaveBeenCalledWith('unfilter', 'Age', 20);
                    facetCollection.facet('Age', 'and', true).removeValue(20, true);
                    expect(facetCollection.trigger.calls.count()).toEqual(1);
                });

                it('defaults facet external operator to and', function(){
                    var facetedCollection = Facetr(collection);
                    var facetCountry = facetedCollection.facet('Country');
                    var facetLastName = facetedCollection.facet('Name.LastName');
                    facetCountry.value('Australia');
                    facetLastName.value('Smith');
                    expect(collection.length).toEqual(1);
                    facetedCollection.clear();
                    facetCountry = facetedCollection.facet('Country', 'or');
                    facetLastName = facetedCollection.facet('Name.LastName');
                    facetCountry.value('Australia');
                    facetLastName.value('Smith');
                    expect(collection.length).toEqual(2);
                });

                it('defaults facet internal operator to or', function(){
                    var facetedCollection = Facetr(collection);
                    var facet = facetedCollection.facet('Country');
                    facet.value('Australia');
                    expect(collection.length).toEqual(2);
                    facet.value('Canada');
                    expect(collection.length).toEqual(2);
                    facet.value('Ireland');
                    expect(collection.length).toEqual(3);
                    facet.removeValue('Australia');
                    expect(collection.length).toEqual(1);
                    facet.removeValue('Ireland');
                    expect(collection.length).toEqual(0);
                    facet.removeValue('Canada');
                    expect(collection.length).toEqual(facetedCollection.origLength());
                });

                it('creates the new facet with values count calculated considering current filters', function(){
                  var facetedCollection = Facetr(collection);

                  var facetCountry = facetedCollection.facet('Country');
                  facetCountry.value('Australia');
                  var facetAge = facetedCollection.facet('Age');

                  _.forEach(facetAge.toJSON().values, function(v){
                    var expected = {};

                    switch(v.value){
                      case 20:{
                        expected.active = false;
                        expected.count = 1;
                        expected.activeCount = 1;
                      } break;

                      case 28:{
                        expected.active = false;
                        expected.count = 2;
                        expected.activeCount = 1;
                      } break;

                      case 35:{
                        expected.active = false;
                        expected.count = 1;
                        expected.activeCount = 0;
                      } break;
                    }

                    expect(expected.active).toEqual(v.active);
                    expect(expected.count).toEqual(v.count);
                    expect(expected.activeCount).toEqual(v.activeCount);
                  });

                });

                // Facet
                describe('returns a Facet that', function() {
                    // Facet toJSON
                    describe('has a toJSON method that', function() {
                        it('returns a JSON object with the data and the values of the facet', function() {
                            expect(Facetr(collection).facet('Name.LastName').toJSON().data).toBeDefined();
                            expect(Facetr(collection).facet('Name.LastName').toJSON().values.length).toEqual(3);
                        });
                    });

                    // Facet label
                    describe('has a label method that', function() {
                        it('sets the facet label to a given value', function() {
                            expect(Facetr(collection).facet('Name.LastName').label('Surname').toJSON().data.label).toBe('Surname');
                        });
                    });

                    // Facet desc
                    describe('has a desc method that', function() {
                        it('sorts the facet values in descendent order', function() {
                            expect(Facetr(collection).facet('Country').desc().toJSON().data.sort.direction).toBe('desc');
                            expect(Facetr(collection).facet('Country').toJSON().values[0].value).toBe('New Zealand');
                            expect(Facetr(collection).facet('Country').toJSON().values[1].value).toBe('Ireland');
                            expect(Facetr(collection).facet('Country').toJSON().values[2].value).toBe('Australia');
                        });
                    });

                    // Facet asc
                    describe('has a asc method that', function() {
                        it('sorts the facet values in ascendent order', function() {
                            expect(Facetr(collection).facet('Country').asc().toJSON().data.sort.direction).toBe('asc');
                            expect(Facetr(collection).facet('Country').toJSON().values[0].value).toBe('Australia');
                            expect(Facetr(collection).facet('Country').toJSON().values[1].value).toBe('Ireland');
                            expect(Facetr(collection).facet('Country').toJSON().values[2].value).toBe('New Zealand');
                        });
                    });

                    // Facet sortByCount
                    describe('has a sortByCount method that', function() {
                        it('sorts the facet values by count', function() {
                            expect(Facetr(collection).facet('Country').sortByCount().toJSON().data.sort.by).toBe('count');
                            // note that by default sort direction is asc
                            expect(Facetr(collection).facet('Country').toJSON().values[0].count).toEqual(1);
                            expect(Facetr(collection).facet('Country').toJSON().values[1].count).toEqual(1);
                            expect(Facetr(collection).facet('Country').toJSON().values[2].count).toEqual(2);
                        });
                    });

                    // Facet sortByValue
                    describe('has a sortByValue method that', function() {
                        it('sorts the facet values by value', function() {
                            expect(Facetr(collection).facet('Country').sortByValue().toJSON().data.sort.by).toBe('value');
                            expect(Facetr(collection).facet('Country').toJSON().values[0].value).toBe('Australia');
                            expect(Facetr(collection).facet('Country').toJSON().values[1].value).toBe('Ireland');
                            expect(Facetr(collection).facet('Country').toJSON().values[2].value).toBe('New Zealand');
                        });
                    });

                    // Facet remove
                    describe('has a remove method that', function() {
                        it('removes a facet from the collection and defilters the collection accordingly', function() {
                            expect(Facetr(collection).facet('Country')).toBeDefined();
                            expect(Facetr(collection).toJSON().length).toEqual(1);
                            expect(Facetr(collection).facet('Country').remove()).toBeUndefined();
                            expect(Facetr(collection).toJSON().length).toEqual(0);
                            expect(collection.length).toEqual(4);
                        });

                        it('triggers a "removeFacet" event on the FacetCollection, passing the facetName to the event handler, unless true (silent) is passed as last parameter', function(){
                            var facetCollection = Facetr(collection);
                            spyOn(facetCollection, 'trigger');
                            var facet = facetCollection.facet('Age', null, true);
                            facet.remove();
                            expect(facetCollection.trigger).toHaveBeenCalledWith('removeFacet', 'Age');
                            facet = facetCollection.facet('Age', null, true);
                            facet.remove(true);
                            expect(facetCollection.trigger.calls.count()).toEqual(1);
                        });
                    });

                    // Facet value method
                    describe('has a value method that', function() {
                        it('adds a facet filter using the given value, filtering the collection accordingly', function() {
                            Facetr(collection).facet('Country').value('Australia');
                            expect(collection.length).toEqual(2);
                            expect(collection.at(0).get('Country')).toBe('Australia')
                        });

                        it('triggers a value event', function() {
                            var facet = Facetr(collection).facet('Country');
                            var flag = false;

                            facet.on('value', function(){
                                flag = true;
                            });

                            facet.value('Australia');

                            expect(flag).toBeTruthy();
                        });

                        it('empties the collection if the given value doesn\'t exist', function(){
                            var facetedCollection = Facetr(collection);
                            var facetCountry = facetedCollection.facet('Country');
                            facetCountry.value('Canada');
                            expect(facetCountry.isSelected()).toBeTruthy();
                            expect(collection.length).toEqual(0);
                            facetCountry.removeValue('Canada');
                            expect(facetCountry.isSelected()).toBeFalsy();
                            expect(collection.length).toEqual(facetedCollection.origLength());
                            var facetAge = facetedCollection.facet('Age');
                            facetAge.value(35);
                            expect(collection.length).toEqual(1);
                            facetCountry.value('Canada');
                            expect(collection.length).toEqual(0);
                            facetCountry.remove();
                            expect(collection.length).toEqual(1);
                            facetAge.remove();
                            expect(collection.length).toEqual(facetedCollection.origLength());
                        });

                        it('allows filtering by existing or non-existing values', function(){
                            var facetedCollection = Facetr(collection);
                            var facet = facetedCollection.facet('Country');
                            facet.value('Canada').or('Australia');
                            expect(collection.length).toEqual(2);
                            facet.removeValue('Australia');
                            expect(collection.length).toEqual(0);
                            facet.removeValue('Canada');
                            expect(collection.length).toEqual(facetedCollection.origLength());
                            facet.value('Ireland').and('Canada');
                            expect(collection.length).toEqual(0);
                            facet.removeValue('Canada');
                            expect(collection.length).toEqual(1);
                            facet.value('Ireland').and('Canada').or('Australia');
                            expect(collection.length).toEqual(2);
                            facet.clear();
                            expect(collection.length).toEqual(facetedCollection.origLength());
                        });

                        describe('returns a FacetExp that', function() {
                            describe('has an and method that', function() {
                                it('can be used for "and" chaining of facet values', function() {
                                    Facetr(collection).facet('Hobbies').value('fishing').and('painting');
                                    expect(collection.length).toEqual(1);
                                    expect(_.indexOf(collection.at(0).get('Hobbies'), 'fishing')).not.toEqual(-1);
                                    expect(_.indexOf(collection.at(0).get('Hobbies'), 'painting')).not.toEqual(-1);
                                });
                            });

                            describe('has an or method that', function() {
                                it('can be used for "or" chaining of facet values', function() {
                                    Facetr(collection).facet('Country').value('Ireland').or('Australia');
                                    expect(collection.length).toEqual(3);
                                    expect(_.indexOf(collection.pluck('Country'), 'Ireland')).not.toEqual(-1);
                                    expect(_.indexOf(collection.pluck('Country'), 'Australia')).not.toEqual(-1);
                                });
                            });
                        });
                    });

                    // Facet removeValue method
                    describe('has a removeValue method that', function() {
                        it('removes a facet value and defilters the collection accordingly', function() {
                            Facetr(collection).facet('Name.LastName').value('Smith');
                            expect(collection.length).toEqual(2);
                            Facetr(collection).facet('Name.LastName').removeValue('Smith');
                            expect(collection.length).toEqual(4);
                        });

                        it('triggers a removeValue event', function() {
                            var facet = Facetr(collection).facet('Country');
                            var flag = false;

                            facet.on('removeValue', function(){
                                flag = true;
                            });

                            facet.value('Australia');
                            facet.removeValue('Australia');

                            expect(flag).toBeTruthy();
                        });
                    });

                    describe('has a customData method that', function() {
                        it('can be used to set and get arbitrary data', function() {
                            Facetr(collection).facet('Name.LastName').customData('test', 'some data');

                            expect(Facetr(collection).facet('Name.LastName').customData('test')).toBe('some data');
                        });
                    });

                    describe('has a isSelected method that', function(){
                        it('returns true if any value of the facet is selected, false otherwise', function(){
                            var facet = Facetr(collection).facet('Name.FirstName');

                            facet.value('Bob');

                            expect(facet.isSelected()).toBeTruthy();

                            facet.clear();

                            expect(facet.isSelected()).toBeFalsy();
                        });
                    });

                    describe('has a hierarchy method that', function(){
                        it('generates a hierarchical representation of facet values based on the given hierarchy settings parameter', function(){
                            var hierarchySettings = [
                                {
                                    value: "manager",
                                    label: "Manager",
                                    groups: [
                                        {
                                            value: "team manager",
                                            label: "Team Manager",
                                            groups: [
                                                {
                                                    value: "project manager",
                                                    label: "Project Manager"
                                                }
                                            ]
                                        }
                                    ]
                                }
                            ];

                            var profession = Facetr(collection).facet('Profession').hierarchy(hierarchySettings);

                            var groupedValues = profession.toJSON().groupedValues;

                            expect(groupedValues).toBeDefined();
                            expect(groupedValues instanceof Array).toBeTruthy();
                            expect(groupedValues.length).toBe(1);

                            expect(groupedValues[0].value).toBe('manager');
                            expect(groupedValues[0].label).toBe('Manager');
                            expect(groupedValues[0].count).toBe(4);

                            profession.value('team manager')
                            profession.value('project manager');

                            groupedValues = profession.toJSON().groupedValues;

                            expect(groupedValues[0].activeCount).toBe(3);
                            expect(groupedValues[0].groups[0].activeCount).toBe(3);
                            expect(groupedValues[0].groups[0].groups[0].activeCount).toBe(2);

                            profession.removeValue('project manager');

                            groupedValues = profession.toJSON().groupedValues;

                            expect(groupedValues[0].activeCount).toBe(3);
                            expect(groupedValues[0].groups[0].activeCount).toBe(3);
                            expect(groupedValues[0].groups[0].groups[0].activeCount).toBe(2);
                        });
                    });
                });
            });

            // FacetCollection toJSON
            describe('has a toJSON method that', function() {
                it('returns a JSON array containing a facet JSON object for each facet added to the collection', function() {
                    Facetr(collection).facet('Country');
                    Facetr(collection).facet('Age');
                    expect(Facetr(collection).toJSON().length).toEqual(2);
                });
            });

            // FacetCollection clear
            describe('has a clear method', function() {
                it('that removes all the facets assigned to the collection', function() {
                    expect(Facetr(collection).clear().toJSON().length).toEqual(0);
                });

                it('triggers a "clear" event, unless true (silent) is passed as last parameter', function(){
                    var facetCollection = Facetr(collection);
                    spyOn(facetCollection, 'trigger');
                    facetCollection.clear();
                    expect(facetCollection.trigger).toHaveBeenCalledWith('clear');
                    facetCollection.clear(true);
                    expect(facetCollection.trigger.calls.count()).toEqual(1);
                });
            });

            // FacetCollection remove
            describe('has a remove method', function() {
                it('that removes the collection from Facetr cache', function() {
                    expect(Facetr(collection).remove()).toBeUndefined();
                });
                it('that removes the facetrid property from the collection', function() {
                    Facetr(collection).remove();
                    expect(collection.facetrid).toBeUndefined();
                });
            });

            // FacetCollection facets
            describe('has a facets method', function(){
                it('that returns the list of Facet instances created for this FacetCollection', function(){
                    var fc = Facetr(collection);
                    fc.facet('Age');
                    fc.facet('Name.FirstName');

                    expect(fc.facets().length).toEqual(2);
                    expect(fc.facets()[0].toJSON().data.name).toEqual('Age');
                    expect(fc.facets()[1].toJSON().data.name).toEqual('Name.FirstName');
                });
            });

            // FacetCollection settingsJSON
            describe('has a settingsJSON method', function(){
              it('that returns current facets, sort order and customData to object', function(){
                var facetCollection = Facetr(collection);
                facetCollection.facet('Age').label('Years').value(20);
                facetCollection.sortBy('Age').desc();

                var settingsJSON = facetCollection.settingsJSON();

                expect(settingsJSON.sort.by).toEqual('Age');
                expect(settingsJSON.sort.dir).toEqual('desc');
                expect(settingsJSON.facets.length).toEqual(1);
                expect(settingsJSON.facets[0].attr).toEqual('Age');
                expect(settingsJSON.facets[0].lab).toEqual('Years');
                expect(settingsJSON.facets[0].eop).toEqual('and');
                expect(settingsJSON.facets[0].iop).toEqual('or');
                expect(settingsJSON.facets[0].vals.length).toEqual(1);
                expect(settingsJSON.facets[0].vals[0]).toEqual(20);
              });
            });

            // FacetCollection initFromSettingsJSON
            describe('has a initFromSettingsJSON method', function(){
              it('that inits the faceted collection with the given settingsJSON options', function(){
                var facetCollection = Facetr(collection);
                facetCollection.facet('Age').label('Years').value(20);
                facetCollection.sortBy('Age').desc();

                var settingsJSON = facetCollection.settingsJSON();

                facetCollection.remove();

                facetCollection = Facetr(collection);

                facetCollection.initFromSettingsJSON(settingsJSON);

                var facetCollectionJSON = facetCollection.toJSON();

                expect(facetCollectionJSON.length).toEqual(1);
                expect(facetCollectionJSON[0].data.name).toEqual('Age');
                expect(facetCollectionJSON[0].data.label).toEqual('Years');
                expect(facetCollectionJSON[0].data.selected).toBeTruthy();

                _.each(facetCollectionJSON[0].values, function(v){
                  switch(v.value) {
                    case 20: {
                      expect(v.count).toEqual(1);
                      expect(v.activeCount).toEqual(1);
                      expect(v.active).toEqual(true);
                    } break;

                    case 28: {
                      expect(v.count).toEqual(2);
                      expect(v.activeCount).toEqual(0);
                      expect(v.active).toEqual(false);
                    } break;

                    case 35: {
                      expect(v.count).toEqual(1);
                      expect(v.activeCount).toEqual(0);
                      expect(v.active).toEqual(false);
                    } break;
                  }
                });

                settingsJSON = facetCollection.settingsJSON();

                expect(settingsJSON.sort.by).toEqual('Age');
                expect(settingsJSON.sort.dir).toEqual('desc');
              });
            });

            // FacetCollection update on reset
            describe('updates itself on each Backbone Collection reset', function() {
                it('by reapplying all facets to the new Model instances', function() {
                    Facetr(collection).facet('Name.LastName').value('Smith');

                    expect(collection.length).toEqual(2);

                    collection.forEach(function(model) {
                        expect(model.get('Name').LastName).toBe('Smith');
                    });

                    collection.reset(dataset2);

                    expect(collection.length).toEqual(1);

                    collection.forEach(function(model) {
                        expect(model.get('Name').LastName).toBe('Smith');
                    });
                });
            });

            // update on add
            describe('updates itself whenever a new Model is added to the collection', function() {
                it('by recomputing facet values according to the new model properties', function() {
                    Facetr(collection).facet('Country');
                    Facetr(collection).facet('Age');

                    collection.add({
                        'Name'      : {
                            'FirstName' : 'Ron',
                            'LastName'  : 'McDonald'
                        },
                        //'Age'         : 45, // remove a property to check for this case
                        'Country'   : 'Wales',
                        'Hobbies'   : ['fishing', 'hunting'],
                        'Residence': 'Liverpool' // add a property to check for this case
                    });

                    Facetr(collection).facet('Residence');

                    var toJSON = Facetr(collection).toJSON();

                    expect(toJSON[1].values.length).toBe(4); // check that Age values are 4 (3 + the 'undefined' of the last added model)
                    expect(toJSON[2].values.length).toBe(2); // check that Residence has 2 values (the one of the last added model + 'undefined' with cound 4 from the previous models)
                });
            });

            // update on remove
            describe('updates itself whenever a Model instance is removed from the collection', function() {
                it('by recomputing facet values according to the removed model properties', function() {
                    Facetr(collection).facet('Country');
                    Facetr(collection).sortBy('Country').asc();

                    // remove one model with Country value equal 'Australia'
                    // note that there are 2 models in the dataset with Country equal Australia
                    collection.remove(collection.at(0));

                    expect(Facetr(collection).toJSON()[0].values[0].count).toBe(1); // check that Australia count has changed accordingly

                    collection.remove(collection.at(0)); // remove also other instance having Country value 'Australia'

                    // check that value Australia has been removed completely, as there are no more models having Country equal 'Australia'
                    expect(Facetr(collection).toJSON()[0].values.length).toBe(2);
                    expect(Facetr(collection).toJSON()[0].values[0].value).toBe('Ireland');
                });
            });

            // update on change
            describe('updates itself whenever an attribute of a Model instance in the collection is changed', function() {
                it('by recomputing facet values according to the property changes', function() {
                    Facetr(collection).facet('Country');
                    Facetr(collection).sortBy('Country').asc();

                    // change first model Country value from 'Australia' to 'Ireland'
                    collection.at(0).set({Country:'Ireland'});

                    // check that 'Australia' count gets decreased and 'Ireland' count increased accordingly
                    expect(Facetr(collection).toJSON()[0].values[0].count).toBe(1);
                    expect(Facetr(collection).toJSON()[0].values[1].count).toBe(2);

                    collection.at(0).set({Country: 'Wales'});

                    // check that 'Ireland' count gets decreased and that new value 'Wales' with count 1 is properly added
                    expect(Facetr(collection).toJSON()[0].values[1].count).toBe(1);
                    expect(Facetr(collection).toJSON()[0].values[2].count).toBe(1);
                });
            });

            describe('keeps model ids untouched', function() {
                it('by deep cloning the models in the collection upon initialization', function() {
                    var collection = new Backbone.Collection([
                        {
                            id : '123',
                            Name : 'John'
                        },
                        {
                            id : '456',
                            Name : 'Bob'
                        },
                    ]);

                    Facetr(collection).facet('Name').value('Bob');

                    expect(collection.at(0).id).toBe('456');

                    Facetr(collection).clearValues();

                    expect(collection.at(0).id).toBe('123');
                    expect(collection.at(1).id).toBe('456');
                });
            });

            describe('has a sortBy method that', function() {
                var collection = new Backbone.Collection([
                    {
                        id : '123',
                        Name : 'John',
                        Age : 25,
                        DateOfBirth : '1988-04-03 10:00:08'
                    },
                    {
                        id : '456',
                        Name : 'Bob',
                        Age : 34,
                        DateOfBirth : '1979-02-24 19:43:20'
                    },
                ]);

                Facetr(collection).sortBy('Name').asc();

                it('sorts the collection according to the given attribute and direction', function() {
                    expect(collection.at(0).get('Name')).toBe('Bob');
                    expect(collection.at(1).get('Name')).toBe('John');
                });

                it('works also with numeric values', function() {
                    Facetr(collection).sortBy('Age').asc();
                    expect(collection.at(0).get('Age')).toBe(25);
                    expect(collection.at(1).get('Age')).toBe(34);
                });

                it('works also with date values', function() {
                    Facetr(collection).sortBy('DateOfBirth').asc();
                    expect(collection.at(0).get('DateOfBirth')).toBe('1979-02-24 19:43:20');
                    expect(collection.at(1).get('DateOfBirth')).toBe('1988-04-03 10:00:08');
                });

                it('triggers a "sort" event, passing the sortAttr and sortDir to the event handler', function(){
                    var facetCollection = Facetr(collection);
                    spyOn(facetCollection, 'trigger');
                    facetCollection.sortBy('Name');
                    expect(facetCollection.trigger).toHaveBeenCalledWith('sort', 'Name', 'asc');
                    facetCollection.sortBy('Name', true);
                    expect(facetCollection.trigger.calls.count()).toEqual(1);
                });
            });

            describe('has methods to add and remove custom filters to/from the collection', function() {
                var collection = new Backbone.Collection([
                    {
                        id : '123',
                        Name : 'John',
                        Age : 25,
                        DateOfBirth : '1988-04-03 10:00:08'
                    },
                    {
                        id : '456',
                        Name : 'Bob',
                        Age : 34,
                        DateOfBirth : '1979-02-24 19:43:20'
                    },
                ]);

                it('the addFilter method adds a filter function and filters the collection accordingly ', function() {
                    var fc = Facetr(collection);

                    fc.addFilter('exampleFilter', function(model) {
                        return model.get('Age') > 30;
                    });

                    expect(collection.length).toBe(1);
                    expect(collection.at(0).get('Age')).toBe(34);
                });

                it('the removeFilter method removes a filter function and unfilters the collection accordingly ', function() {
                    var fc = Facetr(collection);

                    fc.removeFilter('exampleFilter');

                    expect(collection.length).toBe(2);
                });

                it('the clearFitlers method removes all the filters and unfilters the collection accordingly', function() {
                    var fc = Facetr(collection);

                    fc.addFilter('exampleFilter', function(model) {
                        return model.get('Age') > 30;
                    });

                    expect(collection.length).toBe(1);

                    fc.addFilter('exampleFilter2', function(model) {
                        return model.get('Age') < 18;
                    });

                    expect(collection.length).toBe(0);

                    fc.clearFilters();

                    expect(collection.length).toBe(2);
                });
            });
        });
    });
});

redpajama_set_name: RedPajamaGithub


If you're looking for a place to get away, look no further than Moorenweis. Whether you're planning to stay for a night or for the week, the area around Moorenweis has accommodations to fit every need. Search for hotels in Moorenweis with Hotels.com by checking our online map. Our map displays the areas and neighborhoods around all Moorenweis hotels so you can see how close you are from landmarks and attractions, and then refine your search within the larger area. The best Moorenweis hotel deals are here with our lowest price guarantee.
Where are the Best Places to Stay in Moorenweis?
When Is the Best Time to Visit Moorenweis?


text:
Published: August 6, 2019, 11:34 pm
Tags: Local, Lynchburg, News
University of Lynchburg's new dorm falls behind, will not be ready for start of semester
Students will be live in 'the annex'
LYNCHBURG, Va. – The University of Lynchburg's new dorm will not be ready for the start of the year due to construction delays.
For much of the construction project, the university says the construction was on schedule, but in the past few weeks, there have been delays.
The university hopes to let students move in the new building in early September.
In the meantime, the university has partnered with Liberty University to house about 240 students in "the Annex," a former hotel on Odd Fellows Road.
In the past, Liberty has used it to house its own students.
The University of Lynchburg will provide frequent transportation as well as security coverage at the makeshift dorm.
The school admits that completing a 90,000-square-foot residence hall in 14 months was an ambitious project.

redpajama_set_name: RedPajamaCommonCrawl


text:
Q: How to plot a function and its derivative
How can I plot this with \begin{tikzpicture}?
the red line should be the derivative at x_0
Pls help :) Thanks!

A: TikZ automatically computes the tangent, for instance when using decorations, you are automatically in the "tangent space". So all you need to do is to add a marking consisting of a horizontal line in "tangent space".
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{decorations.markings}
\tikzset{tangent/.style={postaction={decorate,decoration={markings,
     mark=at position #1 with {
     \draw[red] (0pt,0pt) coordinate (Tang) -- (200pt,0pt);)}}}}}

\begin{document}
\begin{tikzpicture}[declare function={f(\x)=3*sin(10*\x+20);}]
\draw[latex-latex] (0,5) -- (0,0) -- (8,0);
\begin{scope}
\clip (0,0) rectangle (7,5);
\draw[tangent=0.2] plot[samples=100,domain=0:7] ({\x},{f(\x)});
\end{scope}
\draw[dashed] (Tang) --(0,-0.1 -| Tang) node[below]{$x_0$};
\end{tikzpicture}
\end{document}

Ah, and I should probably have mentioned that you can of course use this to draw the tangent at a fixed x value. Say you want to draw it at x=1.3.
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{decorations.markings}
\tikzset{tangent/.style={postaction={decorate,decoration={markings,
     mark=at position #1 with {
     \draw[red] (0pt,0pt) coordinate (Tang) -- (200pt,0pt);)}}}}}

\begin{document}
\begin{tikzpicture}[declare function={f(\x)=3*sin(10*\x+20);}]
\draw[latex-latex] (0,5) -- (0,0) -- (8,0);
\begin{scope}
\clip (0,0) rectangle (7,5);
\draw plot[samples=100,domain=0:7] ({\x},{f(\x)});
\path[tangent=0] plot[samples=100,domain=1.3:7] ({\x},{f(\x)});
\end{scope}
\draw[dashed] (Tang) --(0,-0.1 -| Tang) node[below]{$x_0=1.3$cm};
\end{tikzpicture}
\end{document}

(Yes, it is possible to avoid drawing the plot twice. But all the possibilities will make the thing unnecessarily complex. And one could also avoid the hard coded length of the red line and avoid the \clip, but again the price to pay is an increase of complexity.)
And the nowadays mandatory animation can't be missing. ;-)
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{decorations.markings}
\tikzset{tangent/.style={postaction={decorate,decoration={markings,
     mark=at position #1 with {
     \draw[red] (0pt,0pt) coordinate (Tang) -- (200pt,0pt);)}}}}}

\begin{document}
\foreach \X in {0.5,0.6,...,6}
{\begin{tikzpicture}[declare function={f(\x)=3*sin(10*\x+20);}]
\draw[latex-latex] (0,5) -- (0,0) -- (8,0);
\begin{scope}
\clip (0,0) rectangle (7,5);
\draw plot[samples=100,domain=0:7] ({\x},{f(\x)});
\path[tangent=0] plot[samples=100,domain={\X}:7] ({\x},{f(\x)});
\end{scope}
\pgfmathsetmacro{\Y}{int(10*\X)}
\draw[dashed] (Tang) --(0,-0.1 -| Tang) node[below]{$x_0=\Y$mm};
\end{tikzpicture}}
\end{document}

redpajama_set_name: RedPajamaStackExchange


text:
FeaturedIndie GamesPC Games
Escape Goat Review
Frank Streva
Escape Goat is a prime example of the old adage "Never judge a book by its cover." I first played the game some time back when it appeared on Xbox Live Indie Games. It's still one of my go-to examples of decent games that are sadly drowned beneath the sea of junk that makes up the XBLIG ghetto. Unfortunately, whenever I recommend Escape Goat, people seem instantly turned off by the visuals, and I can't really blame them. You can now find Escape Goat on both GOG and Steam, and while the presentation might not be particularly appealing, trust me when I say that if you give the game a shot you'll find a pretty fun and challenging puzzle platformer at a very reasonable price.
The core gameplay of Escape Goat is incredibly simple. You are a goat stuck in a dungeon and must use your abilities to navigate rooms, each of which is about one screen in size. You can double jump and you have a dash move that can be used to dart forward to avoid obstacles or move certain blocks. You also have a mouse friend that you can send into areas that the goat is too big to access. Some levels feature a magic hat, which gives you the ability to swap places with the mouse and is vital to solving that particular room.
The goal of each room is simply to reach the exit. Accomplishing this requires a mix of both platforming and puzzle solving. The exit is always blocked in some way, and opening the path involves hitting switches, moving blocks, or otherwise manipulating the environment. Most rooms are also full of ways to kill you, be it traps, bottomless pits, or the skeletal reapers that will assail you with fireballs as soon as they see you.
The main game features over 60 rooms, divided amongst some ten regions with different tile sets. Each of these regions usually has about six rooms with their own unique set of challenges and themes. For example, there is an ice themed tile set with ice blocks that are too slippery for the mouse to traverse. Another tile set is based on a mad science theme and is full of moving platforms, traps, and electrical barriers that instantly kill you.
Despite the fairly simple base mechanics, Escape Goat throws some really clever and challenging puzzles the deeper you get into the dungeon. Rooms where you must use the magical hat in particular are usually pretty interesting, often requiring you to keep sending the mouse into areas the goat can't reach so you can swap places to accomplish some task that the mouse is incapable of doing. The fact that the mouse takes time to scurry around the level results in some clever puzzles based on timing.
One in particular involved having to ride a moving platform through a series of traps. There were two sets of switches, red and blue, that would deactivate one set of traps, but activate another. You'd have to hit a blue switch to deactivate some traps, but then send the mouse to a red switch out of the goat's reach to deactivate the next set of traps before you got to them, but after you passed the last set of traps. The fire themed region is another example of clever traps based on timing that often required you to maneuver exploding barrels and goad the reapers into shooting at them at the right time.
If there is one issue I'd levy against the game's puzzles it's that some require a bit too much trial and error, especially the timed puzzles. A handful of rooms drop you into a life-threatening puzzle that you must figure out within a few short moments before being killed. The limited time in which you have to glance over your options often means you have to repeatedly die several times before it becomes apparent what you even need to do. These timed puzzles become more common towards the end of the game, where the puzzles are often pretty complicated with little margin for error.
Once you beat the main game, which will probably take you a little over three hours, you'll unlock another set of even more hellishly devised puzzles. These puzzles, numbering a bit over two dozen, are designed to push your platforming and puzzle solving skills to their absolute limited. Even the easier ones are more complicated than most of the puzzles in the main game, so expect a really tough challenge from this advanced campaign. If you need even more goat-based puzzle-platforming, the game comes with an editor that makes creating and sharing new rooms relatively painless. With the recent Steam release I think it's safe to say that Escape Goat could find a decent little cult following of players devising unbelievably devious challenges for you to try.
I fully admit that Escape Goat doesn't look too appealing at first glance. It is easy to write it off as "just another retro-inspired indie puzzle platformer." We certainly aren't lacking those these days, and Escape Goat's 8-bit aesthetic (which doesn't even look as good as many other games out there with 8-bit pixel art) doesn't make it stand out too well among its peers. However, if you give it a chance, you'll find a solid game that is pretty good at what it does and has a nice amount of content for the meager $5 price tag. You can currently find the game on GOG, Steam, the developer's website, Desura, IndieGameStand, and GamersGate. There is also a sequel in development that is expected to come out sometime this year.
Ultratron Review
Burak Tezateşer Interview: Monochroma Preview
Indie Game 'Toto Temple Deluxe' to release on OUYA
Escape Goat indie games PC Games Reviews Xbox Live Xbox Live Indie Games
PSA: Dark Matter is Unfinished
Hotline Miami free for PlayStation Plus subscribers in the US
Borderlands 2 Review September 29, 2012 | JONATHAN JANSMA
PSA: Dark Matter is Unfinished October 22, 2013 | Frank Streva


text:
Type of Corrosion
5 Key Factors Present in Corrosive Soils
By Krystal Nanan
Understanding the soil corrosion phenomenon and the five key factors that contribute to the process is important for minimizing corrosion in most land-based construction projects.
Source: Bob Suir / Dreamstime.com
Most construction projects involve interaction with the earth in one form or another. Almost all types of infrastructure, from above ground structures such as buildings and roadways, to buried structures such as undergrounds pipes, vessels and utilities, rely on the soil as a means of stability and support. Unfortunately, many soils, depending on their composition, can be potentially corrosive to metallic materials.
The severity of corrosion that can be caused by a particular soil type is dependent on a variety of factors, including the soil's chemical properties, environmental conditions and the properties of the metal in contact with the soil. In this article, we shall look at the causes of corrosion in soils and the factors that contribute to the varying degree of soil corrosiveness in detail.
What is Soil Corrosion?
Simply put, soil corrosion is an electrochemical process whereby complex chemical reactions between the soil and the contacting metal result in the formation of corrosion products and deterioration of the metal. (Read our primer in the article An Introduction to Soil Corrosion.)
Corrosion is a natural redox (reduction-oxidation) reaction that converts a refined metal to its more chemically stable state. Three components must be present for corrosion to occur: an anode (the buried metal in contact with the soil), a cathode (oxygen) and an electrolyte (the moisture found in the soil). The degree of corrosiveness and the rate of corrosion differ between different soil types and properties.
Factors that Influence Soil Corrosion
The key factors that influence the severity and rate of corrosion of soils are:
Aeration refers to the amount of air within the voids of the soil particles. A higher degree of aeration (higher porosity) lowers the tendency for the formation of corrosion. Well-aerated soils promote higher rates of evaporation and retain less water, thus reducing the amount of electrolyte available for the corrosive redox reaction to take place.
The amount of aeration in soils is directly related to the soil particle size and gradation. For example, sandy soils, due to their relatively large particle size, possess better aeration and allow for quicker drainage and evaporation of moisture that clayey soils.
As mentioned previously, one of the key elements necessary for corrosion to occur is an electrolyte, which is responsible for facilitating the transfer of electrons between the anode and the cathode. The drier the soil, the less electrolyte present to facilitate the corrosion process.
Soil resistivity is directly related to the soil's moisture content and the levels of soluble salts in the soil. (Learn more about soluble salts in the article Five Key Factors in Understanding the Role of Soluble Salts in Coatings Failures.) Increasing the moisture content lowers the soil resistivity. Since corrosion is an electrochemical process that involves electric potentials and the transfer of electrons, high levels of soil resistivity obstruct the corrosion process while soils with low resistance levels are deemed more corrosive. Sandy soils drain easily and therefore are considered to be least corrosive, while by contrast, clayey coils retain electrolytes (moisture) and are considered to be at the higher end of the corrosive spectrum.
Dissolved salt content
Although the presence of water in soils enables oxidation and by extension corrosion, the process can be greatly accelerated by the presence of dissolved salts. Dissolved chloride salts in water increase the conductivity of the electrolyte (due to an increased number of dissociated ions) and enhance the number of electrolysis reactions. Generally, soils with chloride and sulfate levels below 100 ppm and 200 ppm respectively are considered mildly corrosive.
Soil acidity (pH level)
pH (potential of hydrogen) is a numerical scale used to measure the acidity or alkalinity of a solution. The scale ranges from 1 to 14, with 7 being the neutral (neither acidic nor alkaline) point. Values below 7 indicate acidity, with 1 being the most acidic and values above 7 indicate alkalinity, with 14 being the most alkaline.
The pH levels of soils vary widely, with values ranging anywhere from 2.5 to 10. A neutral pH of 7 in soils is considered to be ideal to minimize the potential for corrosion. Soils with pH values below 5 are considered to be aggressive and can lead to increased corrosion rates and premature pitting of metals. The inherent pH of a given soil can fluctuate due to environmental factors such as rainfall.
The soil's resistivity is affected by the atmospheric temperature. As the temperature decreases, the resistivity of the soil increases, and hence the corrosive potential of the soil decreases. As pore water freezes at 0°C (32°F), its resistivity increases abruptly. A subsequent decrease in the temperature results in an almost exponential increase in soil resistivity. Therefore, the formation of corrosion is highly unlikely in sub-zero temperature environments.
Methods to Reduce Soil Corrosion
There are several methods available to mitigate the potential for soil corrosion, which include cathodic protection, sacrificial anodes and protective coatings. More information about these methods is available in the related articles listed below. All of these methods are highly effective and can help avoid costly repairs and replacement in the long term.
It is almost impossible in most land-based construction projects to avoid interacting with the surrounding soil. It is therefore important to understand the soil corrosion phenomenon and the key factors that contribute to the process.
Soil Corrosion
Soil Resistivity
Soluble Salts
Low Resistivity
Written by Krystal Nanan | Civil Engineer
Krystal is a civil engineer and project manager with an MSc in Construction Engineering and Management. Her experience includes the project management of major infrastructure projects, construction supervision, and the design of various infrastructure elements including roadway, pavement, traffic safety elements and drainage. Krystal is also a published author with the Transportation Research Board in Washington, D.C.
Read Krystal Nanan's bio
Corrosion Environments Prevention Infrastructure Below Ground Corrosion Prevention Type of Corrosion Corrosive Process Corrosive Substance Utilities Pipeline and Underground Systems Highways and Bridges
Cathodic Protection and Anode Backfills
Understanding the Role of Soluble Salts in Coatings Failures
Anti-Corrosion Coatings for Different Service Exposures


Use this to share your favorite thing about Kindergarten.
Predict what you will look like as a senior in high school!
Write a speech to your preschool friends about your year.
Draw and write about what you hope to learn next year.


The start of October brings cooler temperatures, falling leaves and Halloween plans and for some celebrities, it also brings a few real estate price chops.
Even mansions in the prestigious Bel-Air Crest neighborhood have a hard time selling. Singer Avril Lavigne first listed her home, pictured below, on the Bel-Air real estate market in mid-May for almost $10 million.
Lavigne and her former hubby, Sum 41 singer Deryck Jason Whibley, picked up the gated and private estate in 2007 for $9.5 million. The 12,184-square-foot home has 8 bedrooms and 10.5 bathrooms. High-end features include Venetian plaster, gourmet kitchen, private gym, wine cellar and tasting room.
Kirstie Alley's Maine home, pictured below, may not appeal to everyone. Outfitted in floral chintz prints, pinks, mint green and baby blue, her home may appeal as a place for English tea time, rather than a Maine getaway.
Outside of its super feminine decor, the Isleboro home for sale has extensive oceanfront views, an updated kitchen and master suite.
"Major price cut," exclaims the listing. This isn't the first time Dennis Quaid's equestrian estate, listed on the Brentwood real estate market, has had a price reduction. Quaid's home, was first listed at $16.9 million in March 2011 before facing a price chop in May.
This price cut is the most significant at a -28.1 percent change in price. Although the home is within Los Angeles city limits, it sits on two lush acres with mature trees, lawns and private horse and hiking trails.
Even a one-of-a-kind treehouse couldn't save comedian and game-show host Wayne Brady's house from the price chopping block. Although the original asking price was lower than the $2.5 million Brady paid in 2005 for the home, mirroring the 5 percent drop year-over-year in median Sherman Oaks home values, the price apparently wasn't low enough.
This resort-like pad was L.T's hangout during his years as a running back for the San Diego Chargers. Although he was traded to the New York Jets in 2010, his home didn't hit the Poway real estate market until nearly a year later.
The property consists of two parcels a little over 13 acres, and at 9,565 square feet, L.T's home takes up quite a bit of the estate. The home, pictured below, includes a enormous pool and spa, home theater, outside cabana and full-size basketball and tennis court.
"Psycho" star J anet Leigh's former home hit the Beverly Hills real estate market in April 2011, and despite the contemporary amenities and premier location, it underwent a significant price cut.
Perching over L.A., Leigh's former digs, pictured below, have 4,432 square feet of living space and 4 bedrooms and 4.5 bathrooms. And despite Leigh's aversion to showers (an understandable fear considering the infamous shower slasher scene in "Psycho"), the home does have one.


$25 Off $250 or More In-Store.
To Get $25 Off $250 or More In-Store from K&G Fashion Superstore, use k&g coupon, k&g coupons, k and g coupons, k&g fashion superstore coupon, k&g fashion coupons, k&g in store coupons, k&g deals, k and g cycle coupon code, k&g father's day sale, k&g weekly ad, k&g coupons 2018, k&g promo code, k&g discount code, k&g free shipping code.
Detail of Offer: Shop Now and Get $25 Off $250 or More In-Store at kgstores.com.
To Get K&G Fashion SuperStore Locator from K&G Fashion Superstore, use k&g coupon, k&g coupons, k and g coupons, k&g fashion superstore coupon, k&g fashion coupons, k&g in store coupons, k&g deals, k and g cycle coupon code, k&g father's day sale, k&g weekly ad, k&g coupons 2018, k&g promo code, k&g discount code, k&g free shipping code.
Detail of Offer: Shop Now and Get K&G Fashion SuperStore Locator at kgstores.com.
Upto 50% Off When You Sign Up For Text Alerts.
To Get Upto 50% Off When You Sign Up For Text Alerts from K&G Fashion Superstore, use k&g coupon, k&g coupons, k and g coupons, k&g fashion superstore coupon, k&g fashion coupons, k&g in store coupons, k&g deals, k and g cycle coupon code, k&g father's day sale, k&g weekly ad, k&g coupons 2018, k&g promo code, k&g discount code, k&g free shipping code.
Detail of Offer: Shop Now and Get Upto 50% Off When You Sign Up For Text Alerts at kgstores.com.
Receive Exclusive K&G Promotions and Offers with Sign Up.
To Receive Exclusive K&G Promotions and Offers with Sign Up from K&G Fashion Superstore, use k&g coupon, k&g coupons, k and g coupons, k&g fashion superstore coupon, k&g fashion coupons, k&g in store coupons, k&g deals, k and g cycle coupon code, k&g father's day sale, k&g weekly ad, k&g coupons 2018, k&g promo code, k&g discount code, k&g free shipping code.
Detail of Offer: Shop Now and Receive Exclusive K&G Promotions and Offers with Sign Up at kgstores.com.
Up to 60% Off Designer Brands Like Michael Kors, Calvin Klein And Ralph Lauren.
To Get Up to 60% Off Designer Brands Like Michael Kors, Calvin Klein And Ralph Lauren from K&G Fashion Superstore, use k&g coupon, k&g coupons, k and g coupons, k&g fashion superstore coupon, k&g fashion coupons, k&g in store coupons, k&g deals, k and g cycle coupon code, k&g father's day sale, k&g weekly ad, k&g coupons 2018, k&g promo code, k&g discount code, k&g free shipping code.
Detail of Offer: Shop Now and Get Up to 60% Off Designer Brands Like Michael Kors, Calvin Klein And Ralph Lauren at kgstores.com.
Save $20 Off $100 In-Store Only Purchase.
To Save $20 Off $100 In-Store Only Purchase from K&G Fashion Superstore, use k&g coupon, k&g coupons, k and g coupons, k&g fashion superstore coupon, k&g fashion coupons, k&g in store coupons, k&g deals, k and g cycle coupon code, k&g father's day sale, k&g weekly ad, k&g coupons 2018, k&g promo code, k&g discount code, k&g free shipping code.
Detail of Offer: Shop Now and Save $20 Off $100 In-Store Only Purchase at kgstores.com.
20% Off Regular Priced items + 30% Off Clearance Mens + Womens Suit Seps + Free Bottoms When Buy 2 Jackets.
To Get 20% Off Regular Priced items + 30% Off Clearance Mens + Womens Suit Seps + Free Bottoms When Buy 2 Jackets from K&G Fashion Superstore, use k&g coupon, k&g coupons, k and g coupons, k&g fashion superstore coupon, k&g fashion coupons, k&g in store coupons, k&g deals, k and g cycle coupon code, k&g father's day sale, k&g weekly ad, k&g coupons 2018, k&g promo code, k&g discount code, k&g free shipping code.
Detail of Offer: Shop Now and Get 20% Off Regular Priced items + 30% Off Clearance Mens + Womens Suit Seps + Free Bottoms When Buy 2 Jackets at kgstores.com.
K&G Fashion Superstore (https://www.kgstores.com/) offers up to 60% off department store prices on brand-name men's, women's, and kid's clothing, footwear, and accessories. From career-wear to casual-wear and everything in between, find a wide range of styles to suit your lifestyle.


text:
Why Medicx
MEDIA – Audience Development & Activation
Digital & Video
Permission-Based Marketing
Display & Video – HCP
Permission-Based Marketing – HCP
INSIGHTS – Measurement & Analytics
AdLift Rx Campaign Measurement
Custom Analytics Insights
Medicx Benchmarks Neighborhoods With Greatest Potential To Be At-Risk For Coronavirus-Related Health Complications
Patented geography-based segmentation platform identifies U.S. neighborhoods with high-risk patients that could require additional healthcare resources
Scottsdale, AZ – March 30, 2020 – For more than thirteen years, Medicx Media Solutions (https://medicxhealth.com) has used its patented segmentation platform to successfully deliver therapeutic solutions to the right patients. Now, when helping people stay healthy is more important than ever, Medicx is also leveraging its unique data assets and patented hyperlocal segmentation platform to provide critical benchmarking and data insights to assist during the COVID-19 pandemic.
To learn more about Medicx Media Solutions, visit: https://medicxhealth.com/about/
Based upon the latest reported information, the following comorbidities may worsen the outcome of infection for patients with COVID-19 (coronavirus): cardiovascular disease, diabetes, chronic respiratory disease, hypertension, and cancer.1 Medicx analyzed its Micro-Neighborhood® benchmark data and identified neighborhoods in several states where the prevalence of at-risk patients is high, which could worsen COVID-19 patient outcomes and challenge local healthcare resources.
"It's become increasingly clear that certain health conditions influence the fatality rate for patients infected with COVID-19. With Medicx real-world benchmarking data, these insights can help the government, healthcare facilities, and workers understand potential hot spot areas that could especially benefit from public health messaging, where patients may need to take extra precautions and resources may need to be assigned," said Michael Weintraub, RPh. and Medicx CEO.
High-Level Insights
While coronavirus-related health data continue to make their way into the U.S. data ecosystem, and government and business leaders look for ways to address the spread of COVID-19 (coronavirus) including measures such as new self-quarantine orders in place for U.S. travelers entering states such as Texas and Florida, these health conditions serve as a strong proxy for people at the greatest risk should they test positive. Medicx neighborhood-level benchmarking data compiles real-world evidence-based data to allow us to identify neighborhoods that may require additional healthcare resources and more vigilant social distancing.
For illustration purposes, Medicx analyzed two states in very different stages of the COVID-19 spectrum. First, they evaluated all 716,533 neighborhoods in Arizona, a state that currently ranks 22nd for the number of confirmed Coronavirus COVID-19 cases2 and the home to the company headquarters. 15-37% of Arizona neighborhoods presented with one of the high-risk conditions. Second, they evaluated all 1,816,059 neighborhoods in New York state, home to the current U.S. pandemic epicenter and where the company has its east coast office. 21-42% of the neighborhoods in New York state presented with one of the high-risk conditions.
Medicx calculations surfaced these insights regarding the prevalence of the comorbidities that the CDC reports may worsen the outcome of infection for patients with COVID-19 (coronavirus).
Leveraging these insights in areas of high COVID-19 prevalence may help stakeholders make decisions around resource allocation and help educate patients on pandemic-related public health best practices. A focus on high-risk patients could improve health outcomes by minimizing their risk of infection. This same patented segmentation analysis can also be applied to any other US states, as needed.
The Medicx Approach
Medicx Media's unrivaled capabilities are based on a signature analytical approach and expertise in systematically identifying neighborhoods with relevant patients across the U.S. This ability is unique to Medicx because of the granularity of the firm's data and the patented Micro-Neighborhood® segmentation platform.
The Medicx team leveraged in-depth pharmacological knowledge and data expertise to determine the neighborhood prevalence insights for these health conditions. The process included determining the medical codes (e.g., ICD-10s), procedures, and medical treatments that define each condition. The definitions allow Medicx to identify all the neighborhoods where there is evidence of each condition of interest.
About Medicx Media Solutions
Medicx Media Solutions (https://medicxhealth.com/) provides neighborhood-level prevalence benchmarks and other insights using analytics around real-world health data and self-reported consumer data to improve intelligence and performance for life sciences and healthcare companies in the U.S. Applying a patented and HIPAA-compliant geography-based segmentation methodology, Medicx benchmarks nearly 35MM neighborhoods across the U.S. by analyzing large volumes of real-world data. The outcome is an unmatched method of locating and engaging the right audiences in a privacy-safe manner.
Rosario Mireles
rosario.mireles@medicxmedia.com
1 https://www.ncbi.nlm.nih.gov/pubmed/32064853
2https://www.arcgis.com/apps/opsdashboard/index.html#/85320e2ea5424dfaaa75ae62e5c06e61
© 2021 Healthy Offers, Inc.
d/b/a Medicx Health
10799 N. 90th Street, Suite 200,
Opt Out Here / Do Not Sell My Personal Information
© 2019 Healthy Offers, Inc. d/b/a Medicx Media Solutions
Thank you for your interest in AdLift Rx! Please fill out the form to get started.
What brands are you advertising and with what media channels?
What is your current measurement methodology and partner?
Individuals may opt out by contacting their cable or satellite provider directly.
Individuals may opt out on their streaming services by using the streaming service's operation system settings.
Opt Out For Streaming Services
The Trade Desk cares about your privacy. We work with a number of companies that may use data about your online activity to show you relevant ads.
OPT OUT HERE
LiveRamp connects people, devices, and data safely and effectively allowing a number of companies to show you relevant ads.
Thank you for your interest in Medicx. Please complete the form below and we will be in touch promptly.
Media Outlet*
Let's Talk! Fill out the form below to get us started.
How did you hear about Medicx?
Complete the form below to request a Medicx case study.
Which case study would you like to review?*
Aligning Audience Definition in Digital DisplayAudience Quality in ATVDigital Display in Oncology/Rare DiseaseMulti-Channel Increases LiftPerformance in CTVEmail and Social
Tell us about your company and what you hope to learn about Medicx.*


Blessed John Henry Newman wrote some beautiful Hymns and Prayers, one of which begins, "Firmly I believe, and truly, God is Three and God is One….", very appropriate to herald today's Celebration of the Three Persons in One God: Father, Son and Holy Spirit. (Turn to number 962 in our hymn book.) Read more of Newman's writings here.
This is, indeed, a mystery of Faith! The Gifts of the Holy Spirit, which we considered last week, will help us to accept this fundamental Teaching of the Church. The Doctrine of the Blessed Trinity is, to our limited human minds, not the easiest Truth to comprehend. This, of course, is where the Gifts of Faith, Hope and Charity come into play; we believe and trust that God, Infinitely Perfect, in His Love for us, can never tell us anything which is untrue, and will not ask the impossible of us in terms of belief. We can be certain that He will bring us, if we do our best to love and obey Him, to Heaven.
If you are looking to better understand this Truth, for your own knowledge or to explain it to others, then one of the clearest explanations of the Three-in-Oneness of God is to be found in Frank Sheed's book, Theology for Beginners, chapter 5, The Three Persons. This can be further simplified in order to explain it to our children; they also have a right to the Truth, and we have a duty to do our best to teach them. It is vital to remember, though, that to simplify does not mean to water down or to omit truth.
For those who would postpone such teaching until children are 'old enough' (and who of us will ever be 'old enough' to fully understand this particular Doctrine?!), they would do well to heed the words of a renowned educational psychologist, Jerome Bruner, who said that "…anything can be taught to any one, at any age, as long as it is properly thought out first…". Saint Thérèse of Lisieux (whose Mother died when Thérèse was four years old) once asked her mother (Saint Zélie Martin) about our capacity for God and was shown two very different sized containers, each filled to the brim with water; as Zélie explained to her daughter, just as each vessel was completely filled, God fills us with His Grace according to our created capacity and our openness to it. Any preparation required to teach our precious young people will be very beneficial to teachers as well as their pupils.
Take heart in that if you find yourself pondering and puzzling over this Doctrine, so did the great Theologians! Only God can fully understand Himself! For a more detailed exposition of the subject we have, of course, the Catechism of the Catholic Church (Section 2, the Profession of the Christian Faith) intended by the Teaching Authority (or Magisterium) of the Church as the 'yardstick' against which all publications claiming to be Catholic, including your children's R.E. materials, must be assessed.
In this day and age, this Doctrine may be a stumbling block to be overcome in a journey of Faith. It takes Prayer and perseverance to break down barriers; we cannot allow our human limitations to be transferred to God. We have to make a 'leap of faith' over the barrier! Our loving Belief in and Witness to this fundamental and deep Truth will effectively help to overcome any doubts and objections which can be raised. Our lives must be permeated by this belief which we express, among other ways, in making the Sign of the Cross and in reciting the Creed every Sunday and Solemnity.
Last week, on Ascension Thursday, 10th May, the fortieth day of Eastertide, in the Entrance Antiphon (Acts 1:11), we pronounced the words of the Angel to the Apostles who, following their beloved Master's departure from their sight into Heaven, remained for a while gazing (surely sadly and longingly) into the empty sky. The Angel assures them that, one day, Jesus will return when He comes, of course, to Judge us all at the end of time.
This year, as the Solemnity fell on the exact day, i.e. Thursday, that day was, of course, a Holy Day of Obligation, binding on the Faithful, as are all Sundays, giving us the very clear message that the Eucharist has an indispensable and central role in our lives.
The First Reading (Acts 1:1-11) narrated that familiar scene in which Our Lord took leave, so to speak, of His Apostles.
Jesus had, of course, promised to be with us, His Church, always. Through the Responsorial Psalm (Psalm 46:2-3, 6-9 response v6) we celebrated this continuity of our Saviour's presence among us as, indeed, we do every time we participate in the Mass. In order to fulfil this promise, Jesus and the Father were to send the Holy Spirit at Pentecost. This word, again, has a numerical significance, coming from the Greek for 50, i.e. the number of Days after Easter that the Spirit came to transform the twelve timid first Bishops and Priests into fearless Crusaders, eleven of whom would eventually be Martyred for preaching the Truth, and with one in exile. The Apostles were Confirmed or 'energised' as it were, to "...Go out to the whole world…", come what may, and '…proclaim the Good News…' that Christ is, indeed, Risen and that, through His Body, the Church, with her Pope, Bishops, Priests and Deacons, and Her seven Sacraments, we have the infallible link to God and our Heavenly destiny. Only knowing and persistent refusal to live God's Way can, ultimately, deprive a soul of the Life God wishes to give to us eternally.
In the Second Reading (Ephesians 1:17-23) Saint Paul prayed (as must we!) for the necessary Graces to aid us in understanding and living by the Teachings of Our Lord who, alone, can give us Eternal Happiness. We must recognise that those who consider themselves 'worldly-wise' among us will, at times, not accept Jesus as '…the ruler of everything…', as is evidenced by the continual challenges to Catholic Moral Teaching around the world. We may be challenged, sometimes shunned, because we practise and profess the 'unpalatable'! In the Gospel (Mark 16:15-20) we heard the Apostles (now ourselves!) being told to, '…Go out into the whole world, proclaim the Good News to all creation…'. We are assured that we, and those we evangelise (and who embrace the Faith) '…will be saved…'.
In France and Germany, among other countries, the importance of this day was emphasised by its being a Public Holiday, echoing the deep Catholic Faith of former times. In the days when England proudly proclaimed herself the Dowry of Mary, Holy days were, very often, the only days off in addition to Sunday, especially, probably, for the Poor. From this extra day of rest, of course, comes our word, holiday. Hopefully the Solemnity of the Ascension of the Lord was a joyful day in our Families, encouraging not only us and our children but, also, through us, those of other faiths (or none) that we may encounter, to see beyond the limits of this world.
"…the Lady of the Rosary…". She spoke of the need for us to amend our lives and to seek pardon for our sins, which, daily, offend Our Lord. She urged the daily recitation of the Rosary, a powerful weapon against the evils of Satan and, therefore, a bountiful source of Grace for those who love her Son and constantly call on Him for aid. Ever concerned for our spiritual wellbeing, and conscious of our tendency to forget even essentials, Holy Mother Church sets aside two months during which this great Prayer is 'put in the spotlight' so to speak, both this month of May and later, October.
The Rosary is, of course, a prayer for all people, suitable for all ages and levels of intelligence or level of education, and for all times and situations. It is not limited in its use. While it may, profitably, be recited in its entirety in church before the Blessed Sacrament, it may also be prayed wholly or in sections, for instance at home by Parents and Children, on the way to work, whilst working round the house etc.
In essence, the Rosary consists of four sets of Mysteries (i.e. Joyful, Luminous, Sorrowful and Glorious). Look here for starters. Whilst meditating on (i.e. considering mentally) each Mystery, one prays a decade, i.e. ten Hail Marys. Before each decade, comes the Our Father and after each decade comes the Glory be to the Father. The original 150 Hail Marys of which the Rosary was composed were associated with the 150 Psalms in the Prayer of the Church; by 'telling their beads', even those with no education or reading ability could unite themselves with the prayer of the Universal Church. This Prayer may be said on beads, on Rosary rings or even on one's fingers, all basic counting aids. In the dark days of the concentration camps, for example, Rosary beads might even have been made from bread pellets threaded onto string.
The prayers of the Rosary might be compared to the incidental music of a good Family film which serves to heighten awareness of emotions and actions of characters in different scenes. Almost in the background, these prayers serve to aid those praying in focussing upon the most notable scenes from the Lives of Mary and Jesus in particular. Parents are warmly encouraged to teach their children this invaluable Prayer from a very early age. As our youngsters grow in stature and intelligence, their insights into the Mysteries will deepen. Our Blessed Lady will be their constant companion throughout a lifetime in which their Faith will be strongly challenged. It is a prayer which will stand them in good stead from infancy (obviously on a more basic level) to old age, when they will, please God, draw on the fruits of a lifetime's Rosaries. How about searching this treasure trove together?! If not the internet, then our own Catholic Truth Society is the place to go!
Throughout the centuries, this Prayer has developed and been presented in several forms. For example, the Luminous Mysteries, originally developed by Malta's Saint Ġorġ Preca, were introduced by Saint Pope John Paul II through his Apostolic Letter, Rosarium Virginis Mariae. Other forms have focussed on particular episodes in the lives of Christ and His Mother. One example is the Seven Dolours Rosary in which one concentrates specifically on the seven sorrows of our Lady: - Simeon's prophecy that Mary would suffer witnessing her Son's Passion and Death (Lk. 2:34, 35); Herod's massacre of the Holy Innocents, which led to the flight of the Holy Family of Jesus, Mary and Joseph into Egypt (Mt. 2:13, 14); The finding of the 12 year old child Jesus in the temple (Lk. 2:43-45); Jesus meets Mary as he carries His Cross to Calvary (4th Station of the Cross); Jesus' Body being taken down from the Cross (13th Station); the burial of Jesus in the Tomb (14th Station). There is so much out there!


text:
WARRIOR DISCOUNT
Home Blog Rudy Reyes on Readiness, Nutrition, & the Warrior Mentality
Rudy Reyes on Readiness, Nutrition, & the Warrior Mentality
Rudy Reyes is a Veteran, conservationist, martial arts instructor, and actor. Born in Richards-Gebaur Air Force Base, Kansas City, Missouri, Reyes began practicing Kung Fu at 15 and teaching it to his brothers. Joining the United States Marine Corps in 1998, where he also became a Force Recon Marine, Reyes served in both Iraq and Afghanistan. After leaving the military in 2005, Reyes became a fitness trainer in San Diego. He even spent some time in Africa, where he educated wildlife preserve rangers in anti-poaching tactics. These days Rudy is focusing on working with his brand partners and acting. His acting credits include portraying himself in the HBO miniseries Generation Kill and hosting the tv series Apocalypse Man.
What is The Relationship Between Readiness & Nutrition?
"Simply as a military man, let us think about fuels or vehicles; what ammunition we put into our weapons; what fuels the human body most important as the organic machinery. As Marines, our missions are in extreme environments with impossible timelines, massive amounts of stress, and the possibility of a violent jet… and what fuels us, we're incredibly knowledgeable about water, hydration, the trace minerals and electrolytes that hold water in the body. And nutrient-dense food. Just like the fuel that's put into helicopters and jets, they give us support and get us in and out of dangerous positions and environments.
"Do we take the lowest bidder for the fuel that keeps our planes and helicopters flying? Do we skip on the fuel that keeps our generators going for our hospitals in the middle of these combat zones? No we don't!"
The highest-end fuel with the least amount of additives and fillers is what powers machines to be optimal. And we're machines. Our body is mechanical. That's why they degrade eventually and we die."
What is the Warrior Mentality To You?
"The warrior (Ethos) is crafted in the battles and struggles and the effacement from antiquity. Often we use, even in our modern government here in the United States, the Greek ideal. ...That's the place where modern thought was created. The word "Ethos" in our primitive cultures is there. And then it became refined through these city states in which empire and conquest as a predictor to turning sorts to plow shares and then creating societies and communities in which use natural environment, agriculture, animal husbandry; to fortify, strengthen, and create unique language, art, and thinking in these so-called city states.
That's where the words had started. And the warrior takes his space to (as we say in the Marine core) not ask what, who or why; only to do or die. So the rest of society can pursue artisan work, art, industry, etc.
It's very important to remember badass warriors, special operations commandos, and mixed martial art fighters without the collective. And their reason being that we are that one cog, and the spiritual economic machine called society culture. Alone, we could just be viewed as savages or zealots. But we think about it collectively. The warrior Ethos and the warrior itself is a part of a modern way of thinking that creates things like human rights. It creates things like stability. It creates a structure, and the baseline for education and the upward mobility of all citizens.
So the warrior mentality to me is steeped first in the concrete blood-soaked battlefields of life, death, and sacrifice, but the reasons for the higher law.
How Can Athletes Embody The Warrior Mentality & Readiness?
Well these fitness efficianados, sportsmen and athletes, they already consciously or unconsciously dovetailed into this ancient discipline of self-effacement and training to make one's mechanic… one's machine hard to kill. Able to endure and communicate, relate, and or dominate one's environment to accomplish the mission.
So these modern athletes, modern sportsmen, modern fighters, modern special operations commandos, infantry; by answering the call; by feeling that there is a higher calling, they must absolutely find this mythical body. The nervous system and the brain to be the highest echelon vehicle of human consciousness. And when blinds himself in that, everything they do in waking and in sleeping is connected to making one's self a better version of themselves. So that in struggles and pains, they are there to lead into prosperity and the boon of harvest. They're able to appreciate the taste of the nectar so much more.
Why Is Nutrition So Important?
When we talk about nutrition, how about the nutrition of the mind? How about the nutrition of the relationships of other people; of the relationships of one in their environment? How about the nutrition from the air and water. It's everything!
Oftentimes in the sport world and performance world, they speak on nutrition just as the food or supplement you eat and ingest. No, EVERYTHING in life is nutrition. And everything has the possibility to be nutrition in this life. But you have to make choices, now don't you? You have to make choices in the places that you live.You have to make choices in the people in your life. You have to make choices in what you ingest in your body. You have to make choices about your time to sleep, rest, covering further education in this physical culture. You have to make choices in your training. When you hit the end, will you make a choice to try one more?
Why Condition One Protein Bars?
"What's profound about the meal bar; the performance bar; the nutrient bar; the DELICIOUS bar, is that Condition One was created by warriors. Exactly that overall mission; it's bedrock…
"How do we make the most out of ourselves and out of our lives in peace time and in war, and in the small day-time battles that we have. How do we make the most out of it? We enjoy having the rich oats and the non-GMO ingredients.
For fuel, we smell and taste a bar that's cooked; an artisan bar. It's not formed and pressed. It's MADE. Like ancient bread; like ancient mana. A bread from the skies. Baked. And the ingredients of raw materials that go in it are the best that we can find on this planet.
"If we're gonna be bringing into our lives something to keep us going forward, then it should be the absolute PINNACLE of ingredients and the message behind the ingredients. That's the story of Condition One and that's why it's so effective. It's not a carb bar, it's not a protein bar. It's not an energy bar… it's a life bar."
- Rudy Reyes
What Was It Like Working With Matt DeMaio On These Incredible Bars?
"Oh brother, they're magnificent. I've seen and been a part of the creation with Matt DeMaio. We worked tirelessly in his tiny kitchen on the second story of his no air-conditioned freaking apartment in Long Island. Figuring out how to do this the right way. And just like the warrior Ethos and the warrior strategists… we rest our word on the ethicacy and deliciousness of these bars. It's a solid 10.
Favorite Bar?
Of course, Lemon Poppyseed. Because that is my favorite pound cake from the MREs, the meal's ready to eat. And out of the rations that I ate all over Afghanistan, Pakistan, and Iraq.
TRY THEM FOR YOURSELF!
POWER Living with Brandon Lilly
The powerlifting champion is finding strength in multiple places. Brandon Lilly gets honest about losing weight and gaining new life perspectives.
Quick Q&A with Fitness Celebrity Ashley Horner
Ashley Horner shares her nutrition advice, current athletic endeavors, and how C1 helps her balance exercise, business, and family.
Catching up on Cross-Training with a Sports Chiropractor
Dr. Simansky chats with us about CrossFit, his 2021 fitness goals, and why he chooses Condition One Nutrition.
JOIN C1'S MAIING LIST TO GET SPECIAL OFFERS + NEW RELEASES + GIVEAWAYS
Thanks, you'll hear from us shortly!
© 2022 Condition One Nutrition.
This website collects cookie data and we never share your data with third parties.