we'll see how we can implement an ordered dynamic array to hold int.
is this time we do care about the order of the element and the dynamic array.
the IntDynamicArray sorted in order from smallest to largest.
So we start with the constructor that just calls the constructor in the parent class.
This is, of course, also a child class of IntDynamicArray.
And now we get to those three abstract methods that we need to implement.
but we do still need to check to see if we need to expand the array.
in the underlying array for the item we're about to add.
This next piece actually finds where we should add the item.
we need to make sure we put this new item in the correct place.
So what we do is we start our addLocation at 0.
then we do this while loop to actually find out where we really ought to add it.
we haven't gone past the end of the valid element in the array.
so we haven't found the place we should add yet, we increment addLocation.
addLocation is exactly the index at which we should add the new item.
we call this helper method that we'll look at when we get to the end of this class.
that we can then insert the new item at addLocation.
because we just added something to the array, we increment count.
because we have to do all the work to make sure that we find the right place.
adding that new item in the right place.
We still do the first part that we did before.
We check to see if the item is in the IntDynamicArray.
And if it isn't, we return false because there's nothing to remove.
we want to remove because that is likely to screw up the ordering in the array.
So instead what we need to do is we need to shift everything down.
we're actually going to shift itemLocation + 1 down on to itemLocation.
So writing over what's in itemLocation.
the valid elements in the array.
And then we decrement count because we just took something out of the array.
And we return true because we successfully did that work.
this actually implements something called a binary search.
the big idea here is that we pick the middle of the array.
And we check to see if that's the item.
And if it is, we're all done.
in because the array is ordered.
to appear in the left-hand side of the array, if it appears in the array at all.
then it has to appear on the right-hand side of the array, if it appears at all.
we run out of array to look at, in which case we're all done.
the middleValue, the value at that middleLocation.
if it is that's awesome, we found it.
Otherwise, here is where we split the data set.
the item is on the left-hand side, so we shift the upperBound down.
the subarray that we're looking at to try to find our item.
And the upperBound gives us the upper index for that subarray.
until we get down to one element, or we find the item we're looking for.
We also are checking here whether lowerBound is greater than upperBound.
But I will say that this code that I provided actually had an error in it.
And so this is the buggy code, just so you can see the error.
And then there's correct code here.
And I address this in more detail in the dynamic array's reading.
why I changed it this way and so on.
another way to do binary search, and it's called recursion.
way to approach this problem and lots of other problems.
And that actually might seem more clear to you what's going on.
a pencil and paper and go look for an item in it and walk your way through the code.
And you'll see that this actually does a binary search to try to find the item.
And we can only do a binary search because the array is ordered.
I mentioned the ShiftUp and ShiftDown helper method, and here they are.
the index just above where we want to start shifting, and we decrement i.
So we're starting at the right-hand side.
to whatever is the element just before that element.
So we're copying everything up here, starting at index.
Similarly, ShiftDown does something much like ShiftUp except we start at index.
This one actually goes from left to right.
we copy the element at index i into the element at index i- 1.
So you should be able to see how this is copying everything down one space.
And that's it for our OrderedIntDynamicArray.
complicated than when we didn't care about the ordering of the elements in the array.
an ordered dynamic array class to hold ints.


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Microsoft.TemplateEngine.Abstractions;
using Microsoft.TemplateEngine.Abstractions.Mount;
using Microsoft.TemplateEngine.Core;
using Microsoft.TemplateEngine.Core.Contracts;
using Microsoft.TemplateEngine.Core.Expressions.Cpp2;
using Microsoft.TemplateEngine.Core.Operations;
using Microsoft.TemplateEngine.Orchestrator.RunnableProjects.Config;
using Microsoft.TemplateEngine.Orchestrator.RunnableProjects.Localization;
using Microsoft.TemplateEngine.Orchestrator.RunnableProjects.Macros.Config;
using Microsoft.TemplateEngine.Orchestrator.RunnableProjects.ValueForms;
using Microsoft.TemplateEngine.Utils;
using Newtonsoft.Json.Linq;

namespace Microsoft.TemplateEngine.Orchestrator.RunnableProjects
{
    public class SimpleConfigModel : IRunnableProjectConfig
    {
        private static readonly string NameSymbolName = "name";
        private static readonly string[] IncludePatternDefaults = new[] { "**/*" };
        private static readonly string[] ExcludePatternDefaults = new[]
        {
            "**/[Bb]in/**",
            "**/[Oo]bj/**",
            "**/" + RunnableProjectGenerator.TemplateConfigDirectoryName + "/**",
            "**/*.filelist",
            "**/*.user",
            "**/*.lock.json"
        };
        private static readonly string[] CopyOnlyPatternDefaults = new[] { "**/node_modules/**" };

        private static readonly Dictionary<string, string> RenameDefaults = new Dictionary<string, string>(StringComparer.Ordinal);

        public SimpleConfigModel()
        {
            Sources = new[] { new ExtendedFileSource() };
        }

        private IReadOnlyDictionary<string, Parameter> _parameters;
        private IReadOnlyList<FileSourceMatchInfo> _sources;
        private IGlobalRunConfig _operationConfig;
        private IReadOnlyList<KeyValuePair<string, IGlobalRunConfig>> _specialOperationConfig;
        private Parameter _nameParameter;

        public IFile SourceFile { get; set; }

        public string Author { get; set; }

        public IReadOnlyList<string> Classifications { get; set; }

        public string DefaultName { get; set; }

        public string Description { get; set; }

        public string GroupIdentity { get; set; }

        public int Precedence { get; set; }

        public IReadOnlyList<Guid> Guids { get; set; }

        public string Name { get; set; }

        public IReadOnlyList<string> ShortNameList { get; set; }

        public string SourceName { get; set; }

        public IReadOnlyList<ExtendedFileSource> Sources { get; set; }

        public IReadOnlyDictionary<string, ISymbolModel> Symbols { get; set; }

        public IReadOnlyList<IPostActionModel> PostActionModel { get; set; }

        public IReadOnlyList<ICreationPathModel> PrimaryOutputs { get; set; }
        public string GeneratorVersions { get; set; }

        public IReadOnlyDictionary<string, IBaselineInfo> BaselineInfo { get; set; }

        public bool HasScriptRunningPostActions { get; set; }

        public DateTime? ConfigTimestampUtc { get; set; }

        private IReadOnlyDictionary<string, string> _tagsDeprecated;

        public IReadOnlyDictionary<string, ICacheTag> Tags
        {
            get
            {
                Dictionary<string, ICacheTag> tags = new Dictionary<string, ICacheTag>();

                foreach (KeyValuePair<string, ParameterSymbol> tagParameter in TagDetails)
                {
                    string defaultValue;

                    if (string.IsNullOrEmpty(tagParameter.Value.DefaultValue)
                        && (tagParameter.Value.Choices.Count == 1))
                    {
                        defaultValue = tagParameter.Value.Choices.Keys.First();
                    }
                    else
                    {
                        defaultValue = tagParameter.Value.DefaultValue;
                    }

                    ICacheTag cacheTag = new CacheTag(tagParameter.Value.Description, tagParameter.Value.Choices, defaultValue, tagParameter.Value.DefaultIfOptionWithoutValue);
                    tags.Add(tagParameter.Key, cacheTag);
                }

                return tags;
            }
        }

        private IReadOnlyDictionary<string, ParameterSymbol> _tagDetails;

        // Converts "choice" datatype parameter symbols to tags
        public IReadOnlyDictionary<string, ParameterSymbol> TagDetails
        {
            get
            {
                if (_tagDetails == null)
                {
                    Dictionary<string, ParameterSymbol> tempTagDetails = new Dictionary<string, ParameterSymbol>();

                    foreach (KeyValuePair<string, ISymbolModel> symbolInfo in Symbols)
                    {
                        ParameterSymbol tagSymbol = symbolInfo.Value as ParameterSymbol;

                        if (tagSymbol != null && tagSymbol.DataType == "choice")
                        {
                            tempTagDetails.Add(symbolInfo.Key, tagSymbol);
                        }
                    }

                    _tagDetails = tempTagDetails;
                }

                return _tagDetails;
            }
        }

        private IReadOnlyDictionary<string, ICacheParameter> _cacheParameters;

        // Converts non-choice parameter symbols to cache parameters
        public IReadOnlyDictionary<string, ICacheParameter> CacheParameters
        {
            get
            {
                if (_cacheParameters == null)
                {
                    Dictionary<string, ICacheParameter> cacheParameters = new Dictionary<string, ICacheParameter>();

                    foreach (KeyValuePair<string, ISymbolModel> symbol in Symbols)
                    {
                        if (symbol.Value is ParameterSymbol param && param.DataType != "choice")
                        {
                            ICacheParameter cacheParam = new CacheParameter(param.DataType, param.DefaultValue, param.Description, param.DefaultIfOptionWithoutValue);
                            cacheParameters.Add(symbol.Key, cacheParam);
                        }
                    }

                    _cacheParameters = cacheParameters;
                }

                return _cacheParameters;
            }
        }

        IReadOnlyList<string> IRunnableProjectConfig.Classifications => Classifications;

        public IReadOnlyDictionary<string, IValueForm> Forms { get; private set; }

        public string Identity { get; set; }

        private static readonly string DefaultPlaceholderFilename = "-.-";

        private string _placeholderValue;
        private IReadOnlyList<string> _ignoreFileNames;
        private bool _isPlaceholderFileNameCustomized;

        public string PlaceholderFilename
        {
            get
            {
                return _placeholderValue;
            }
            set
            {
                _placeholderValue = value ?? DefaultPlaceholderFilename;

                if (value != null)
                {
                    _isPlaceholderFileNameCustomized = true;
                }
            }
        }

        public IReadOnlyList<string> IgnoreFileNames
        {
            get { return _ignoreFileNames ?? (_isPlaceholderFileNameCustomized ? new[] { PlaceholderFilename } : new[] { PlaceholderFilename, "_._" }); }
            set
            {
                _ignoreFileNames = value;
            }
        }

        IReadOnlyDictionary<string, Parameter> IRunnableProjectConfig.Parameters
        {
            get
            {
                if (_parameters == null)
                {
                    Dictionary<string, Parameter> parameters = new Dictionary<string, Parameter>();

                    if (Symbols != null)
                    {
                        foreach (KeyValuePair<string, ISymbolModel> symbol in Symbols)
                        {
                            if (string.Equals(symbol.Value.Type, ParameterSymbol.TypeName, StringComparison.Ordinal) ||
                                    string.Equals(symbol.Value.Type, DerivedSymbol.TypeName, StringComparison.Ordinal))
                            {
                                BaseValueSymbol baseSymbol = (BaseValueSymbol)symbol.Value;
                                bool isName = baseSymbol.Binding == NameSymbolName;

                                parameters[symbol.Key] = new Parameter
                                {
                                    DefaultValue = baseSymbol.DefaultValue ?? (!baseSymbol.IsRequired ? baseSymbol.Replaces : null),
                                    Description = baseSymbol.Description,
                                    IsName = isName,
                                    IsVariable = true,
                                    Name = symbol.Key,
                                    FileRename = baseSymbol.FileRename,
                                    Requirement = baseSymbol.IsRequired ? TemplateParameterPriority.Required : isName ? TemplateParameterPriority.Implicit : TemplateParameterPriority.Optional,
                                    Type = baseSymbol.Type,
                                    DataType = baseSymbol.DataType
                                };

                                if (string.Equals(symbol.Value.Type, ParameterSymbol.TypeName, StringComparison.Ordinal))
                                {
                                    parameters[symbol.Key].Choices = ((ParameterSymbol)symbol.Value).Choices;
                                    parameters[symbol.Key].DefaultIfOptionWithoutValue = ((ParameterSymbol)symbol.Value).DefaultIfOptionWithoutValue;
                                }
                            }
                        }
                    }

                    _parameters = parameters;
                }

                return _parameters;
            }
        }

        private Parameter NameParameter
        {
            get
            {
                if (_nameParameter == null)
                {
                    IRunnableProjectConfig cfg = this;
                    foreach (Parameter p in cfg.Parameters.Values)
                    {
                        if (p.IsName)
                        {
                            _nameParameter = p;
                            break;
                        }
                    }
                }

                return _nameParameter;
            }
        }

        IReadOnlyList<FileSourceMatchInfo> IRunnableProjectConfig.Sources
        {
            get
            {
                if (_sources == null)
                {
                    List<FileSourceMatchInfo> sources = new List<FileSourceMatchInfo>();

                    foreach (ExtendedFileSource source in Sources)
                    {
                        IReadOnlyList<string> includePattern = JTokenAsFilenameToReadOrArrayToCollection(source.Include, SourceFile, IncludePatternDefaults);
                        IReadOnlyList<string> excludePattern = JTokenAsFilenameToReadOrArrayToCollection(source.Exclude, SourceFile, ExcludePatternDefaults);
                        IReadOnlyList<string> copyOnlyPattern = JTokenAsFilenameToReadOrArrayToCollection(source.CopyOnly, SourceFile, CopyOnlyPatternDefaults);
                        FileSourceEvaluable topLevelEvaluable = new FileSourceEvaluable(includePattern, excludePattern, copyOnlyPattern);
                        IReadOnlyDictionary<string, string> renamePatterns = new Dictionary<string, string>(source.Rename ?? RenameDefaults, StringComparer.Ordinal);
                        FileSourceMatchInfo matchInfo = new FileSourceMatchInfo(
                            source.Source ?? "./",
                            source.Target ?? "./",
                            topLevelEvaluable,
                            renamePatterns,
                            new List<FileSourceEvaluable>());
                        sources.Add(matchInfo);
                    }

                    if (sources.Count == 0)
                    {
                        IReadOnlyList<string> includePattern = IncludePatternDefaults;
                        IReadOnlyList<string> excludePattern = ExcludePatternDefaults;
                        IReadOnlyList<string> copyOnlyPattern = CopyOnlyPatternDefaults;
                        FileSourceEvaluable topLevelEvaluable = new FileSourceEvaluable(includePattern, excludePattern, copyOnlyPattern);

                        FileSourceMatchInfo matchInfo = new FileSourceMatchInfo(
                            "./",
                            "./",
                            topLevelEvaluable,
                            new Dictionary<string, string>(StringComparer.Ordinal),
                            new List<FileSourceEvaluable>());
                        sources.Add(matchInfo);
                    }

                    _sources = sources;
                }

                return _sources;
            }
        }

        private readonly Dictionary<Guid, string> _guidToGuidPrefixMap = new Dictionary<Guid, string>();

        // operation info read from the config
        private ICustomFileGlobModel CustomOperations = new CustomFileGlobModel();

        IGlobalRunConfig IRunnableProjectConfig.OperationConfig
        {
            get
            {
                if (_operationConfig == null)
                {
                    SpecialOperationConfigParams defaultOperationParams = new SpecialOperationConfigParams(string.Empty, "//", "C++", ConditionalType.CLineComments);
                    _operationConfig = ProduceOperationSetup(defaultOperationParams, true, CustomOperations);
                }

                return _operationConfig;
            }
        }

        private class SpecialOperationConfigParams
        {
            public SpecialOperationConfigParams(string glob, string flagPrefix, string evaluatorName, ConditionalType type)
            {
                EvaluatorName = evaluatorName;
                Glob = glob;
                FlagPrefix = flagPrefix;
                ConditionalStyle = type;
            }

            public string Glob { get; }

            public string EvaluatorName { get; }

            public string FlagPrefix { get; }

            public ConditionalType ConditionalStyle { get; }

            public string VariableFormat { get; set; }

            private static readonly SpecialOperationConfigParams _Defaults = new SpecialOperationConfigParams(string.Empty, string.Empty, "C++", ConditionalType.None);

            public static SpecialOperationConfigParams Defaults
            {
                get
                {
                    return _Defaults;
                }
            }
        }

        // file -> replacements
        public IReadOnlyDictionary<string, IReadOnlyList<IOperationProvider>> LocalizationOperations { get; private set; }

        private IReadOnlyList<ICustomFileGlobModel> SpecialCustomSetup = new List<ICustomFileGlobModel>();

        IReadOnlyList<KeyValuePair<string, IGlobalRunConfig>> IRunnableProjectConfig.SpecialOperationConfig
        {
            get
            {
                if (_specialOperationConfig == null)
                {
                    List<SpecialOperationConfigParams> defaultSpecials = new List<SpecialOperationConfigParams>
                    {
                        new SpecialOperationConfigParams("**/*.js", "//", "C++", ConditionalType.CLineComments),
                        new SpecialOperationConfigParams("**/*.es", "//", "C++", ConditionalType.CLineComments),
                        new SpecialOperationConfigParams("**/*.es6", "//", "C++", ConditionalType.CLineComments),
                        new SpecialOperationConfigParams("**/*.ts", "//", "C++", ConditionalType.CLineComments),
                        new SpecialOperationConfigParams("**/*.json", "//", "C++", ConditionalType.CLineComments),
                        new SpecialOperationConfigParams("**/*.jsonld", "//", "C++", ConditionalType.CLineComments),
                        new SpecialOperationConfigParams("**/*.hjson", "//", "C++", ConditionalType.CLineComments),
                        new SpecialOperationConfigParams("**/*.json5", "//", "C++", ConditionalType.CLineComments),
                        new SpecialOperationConfigParams("**/*.geojson", "//", "C++", ConditionalType.CLineComments),
                        new SpecialOperationConfigParams("**/*.topojson", "//", "C++", ConditionalType.CLineComments),
                        new SpecialOperationConfigParams("**/*.bowerrc", "//", "C++", ConditionalType.CLineComments),
                        new SpecialOperationConfigParams("**/*.npmrc", "//", "C++", ConditionalType.CLineComments),
                        new SpecialOperationConfigParams("**/*.job", "//", "C++", ConditionalType.CLineComments),
                        new SpecialOperationConfigParams("**/*.postcssrc", "//", "C++", ConditionalType.CLineComments),
                        new SpecialOperationConfigParams("**/*.babelrc", "//", "C++", ConditionalType.CLineComments),
                        new SpecialOperationConfigParams("**/*.csslintrc", "//", "C++", ConditionalType.CLineComments),
                        new SpecialOperationConfigParams("**/*.eslintrc", "//", "C++", ConditionalType.CLineComments),
                        new SpecialOperationConfigParams("**/*.jade-lintrc", "//", "C++", ConditionalType.CLineComments),
                        new SpecialOperationConfigParams("**/*.pug-lintrc", "//", "C++", ConditionalType.CLineComments),
                        new SpecialOperationConfigParams("**/*.jshintrc", "//", "C++", ConditionalType.CLineComments),
                        new SpecialOperationConfigParams("**/*.stylelintrc", "//", "C++", ConditionalType.CLineComments),
                        new SpecialOperationConfigParams("**/*.yarnrc", "//", "C++", ConditionalType.CLineComments),
                        new SpecialOperationConfigParams("**/*.css.min", "/*", "C++", ConditionalType.CBlockComments),
                        new SpecialOperationConfigParams("**/*.css", "/*", "C++", ConditionalType.CBlockComments),
                        new SpecialOperationConfigParams("**/*.cshtml", "@*", "C++", ConditionalType.Razor),
                        new SpecialOperationConfigParams("**/*.razor", "@*", "C++", ConditionalType.Razor),
                        new SpecialOperationConfigParams("**/*.vbhtml", "@*", "VB", ConditionalType.Razor),
                        new SpecialOperationConfigParams("**/*.cs", "//", "C++", ConditionalType.CNoComments),
                        new SpecialOperationConfigParams("**/*.fs", "//", "C++", ConditionalType.CNoComments),
                        new SpecialOperationConfigParams("**/*.c", "//", "C++", ConditionalType.CNoComments),
                        new SpecialOperationConfigParams("**/*.cpp", "//", "C++", ConditionalType.CNoComments),
                        new SpecialOperationConfigParams("**/*.cxx", "//", "C++", ConditionalType.CNoComments),
                        new SpecialOperationConfigParams("**/*.h", "//", "C++", ConditionalType.CNoComments),
                        new SpecialOperationConfigParams("**/*.hpp", "//", "C++", ConditionalType.CNoComments),
                        new SpecialOperationConfigParams("**/*.hxx", "//", "C++", ConditionalType.CNoComments),
                        new SpecialOperationConfigParams("**/*.*proj", "<!--/", "MSBUILD", ConditionalType.MSBuild),
                        new SpecialOperationConfigParams("**/*.*proj.user", "<!--/", "MSBUILD", ConditionalType.MSBuild),
                        new SpecialOperationConfigParams("**/*.pubxml", "<!--/", "MSBUILD", ConditionalType.MSBuild),
                        new SpecialOperationConfigParams("**/*.pubxml.user", "<!--/", "MSBUILD", ConditionalType.MSBuild),
                        new SpecialOperationConfigParams("**/*.msbuild", "<!--/", "MSBUILD", ConditionalType.MSBuild),
                        new SpecialOperationConfigParams("**/*.targets", "<!--/", "MSBUILD", ConditionalType.MSBuild),
                        new SpecialOperationConfigParams("**/*.props", "<!--/", "MSBUILD", ConditionalType.MSBuild),
                        new SpecialOperationConfigParams("**/*.svg", "<!--", "C++", ConditionalType.Xml),
                        new SpecialOperationConfigParams("**/*.*htm", "<!--", "C++", ConditionalType.Xml),
                        new SpecialOperationConfigParams("**/*.*html", "<!--", "C++", ConditionalType.Xml),
                        new SpecialOperationConfigParams("**/*.jsp", "<!--", "C++", ConditionalType.Xml),
                        new SpecialOperationConfigParams("**/*.asp", "<!--", "C++", ConditionalType.Xml),
                        new SpecialOperationConfigParams("**/*.aspx", "<!--", "C++", ConditionalType.Xml),
                        new SpecialOperationConfigParams("**/app.config", "<!--", "C++", ConditionalType.Xml),
                        new SpecialOperationConfigParams("**/web.config", "<!--", "C++", ConditionalType.Xml),
                        new SpecialOperationConfigParams("**/web.*.config", "<!--", "C++", ConditionalType.Xml),
                        new SpecialOperationConfigParams("**/packages.config", "<!--", "C++", ConditionalType.Xml),
                        new SpecialOperationConfigParams("**/*.nuspec", "<!--", "C++", ConditionalType.Xml),
                        new SpecialOperationConfigParams("**/*.xslt", "<!--", "C++", ConditionalType.Xml),
                        new SpecialOperationConfigParams("**/*.xsd", "<!--", "C++", ConditionalType.Xml),
                        new SpecialOperationConfigParams("**/*.vsixmanifest", "<!--", "C++", ConditionalType.Xml),
                        new SpecialOperationConfigParams("**/*.vsct", "<!--", "C++", ConditionalType.Xml),
                        new SpecialOperationConfigParams("**/*.storyboard", "<!--", "C++", ConditionalType.Xml),
                        new SpecialOperationConfigParams("**/*.axml", "<!--", "C++", ConditionalType.Xml),
                        new SpecialOperationConfigParams("**/*.plist", "<!--", "C++", ConditionalType.Xml),
                        new SpecialOperationConfigParams("**/*.xib", "<!--", "C++", ConditionalType.Xml),
                        new SpecialOperationConfigParams("**/*.strings", "<!--", "C++", ConditionalType.Xml),
                        new SpecialOperationConfigParams("**/*.bat", "rem --:", "C++", ConditionalType.RemLineComment),
                        new SpecialOperationConfigParams("**/*.cmd", "rem --:", "C++", ConditionalType.RemLineComment),
                        new SpecialOperationConfigParams("**/nginx.conf", "#--", "C++", ConditionalType.HashSignLineComment),
                        new SpecialOperationConfigParams("**/robots.txt", "#--", "C++", ConditionalType.HashSignLineComment),
                        new SpecialOperationConfigParams("**/*.sh", "#--", "C++", ConditionalType.HashSignLineComment),
                        new SpecialOperationConfigParams("**/*.haml", "-#", "C++", ConditionalType.HamlLineComment),
                        new SpecialOperationConfigParams("**/*.jsx", "{/*", "C++", ConditionalType.JsxBlockComment),
                        new SpecialOperationConfigParams("**/*.tsx", "{/*", "C++", ConditionalType.JsxBlockComment),
                        new SpecialOperationConfigParams("**/*.xml", "<!--", "C++", ConditionalType.Xml),
                        new SpecialOperationConfigParams("**/*.resx", "<!--", "C++", ConditionalType.Xml),
                        new SpecialOperationConfigParams("**/*.bas", "'", "VB", ConditionalType.VB),
                        new SpecialOperationConfigParams("**/*.vb", "'", "VB", ConditionalType.VB),
                        new SpecialOperationConfigParams("**/*.xaml", "<!--", "C++", ConditionalType.Xml),
                        new SpecialOperationConfigParams("**/*.sln", "#-", "C++", ConditionalType.HashSignLineComment)
                    };
                    List<KeyValuePair<string, IGlobalRunConfig>> specialOperationConfig = new List<KeyValuePair<string, IGlobalRunConfig>>();

                    // put the custom configs first in the list
                    HashSet<string> processedGlobs = new HashSet<string>();

                    foreach (ICustomFileGlobModel customGlobModel in SpecialCustomSetup)
                    {
                        if (customGlobModel.ConditionResult)
                        {   // only add the special if the condition is true
                            SpecialOperationConfigParams defaultParams = defaultSpecials.Where(x => x.Glob == customGlobModel.Glob).FirstOrDefault();

                            if (defaultParams == null)
                            {
                                defaultParams = SpecialOperationConfigParams.Defaults;
                            }

                            IGlobalRunConfig runConfig = ProduceOperationSetup(defaultParams, false, customGlobModel);
                            specialOperationConfig.Add(new KeyValuePair<string, IGlobalRunConfig>(customGlobModel.Glob, runConfig));
                        }

                        // mark this special as already processed, so it doesn't get included with the defaults
                        // even if the special was skipped due to its custom condition.
                        processedGlobs.Add(customGlobModel.Glob);
                    }

                    // add the remaining default configs in the order specified above
                    foreach (SpecialOperationConfigParams defaultParams in defaultSpecials)
                    {
                        if (processedGlobs.Contains(defaultParams.Glob))
                        {   // this one was already setup due to a custom config
                            continue;
                        }

                        IGlobalRunConfig runConfig = ProduceOperationSetup(defaultParams, false, null);
                        specialOperationConfig.Add(new KeyValuePair<string, IGlobalRunConfig>(defaultParams.Glob, runConfig));
                    }

                    _specialOperationConfig = specialOperationConfig;
                }

                return _specialOperationConfig;
            }
        }

        public IEngineEnvironmentSettings EnvironmentSettings { get; private set; }

        private IGlobalRunConfig ProduceOperationSetup(SpecialOperationConfigParams defaultModel, bool generateMacros, ICustomFileGlobModel customGlobModel = null)
        {
            List<IOperationProvider> operations = new List<IOperationProvider>();

            // TODO: if we allow custom config to specify a built-in conditional type, decide what to do.
            if (defaultModel.ConditionalStyle != ConditionalType.None)
            {
                operations.AddRange(ConditionalConfig.ConditionalSetup(defaultModel.ConditionalStyle, defaultModel.EvaluatorName, true, true, null));
            }

            if (customGlobModel == null || string.IsNullOrEmpty(customGlobModel.FlagPrefix))
            {   // these conditions may need to be separated - if there is custom info, but the flag prefix was not provided, we might want to raise a warning / error
                operations.AddRange(FlagsConfig.FlagsDefaultSetup(defaultModel.FlagPrefix));
            }
            else
            {
                operations.AddRange(FlagsConfig.FlagsDefaultSetup(customGlobModel.FlagPrefix));
            }

            IVariableConfig variableConfig;
            if (customGlobModel != null)
            {
                variableConfig = customGlobModel.VariableFormat;
            }
            else
            {
                variableConfig = VariableConfig.DefaultVariableSetup(defaultModel.VariableFormat);
            }

            List<IMacroConfig> macros = null;
            List<IMacroConfig> computedMacros = new List<IMacroConfig>();
            List<IReplacementTokens> macroGeneratedReplacements = new List<IReplacementTokens>();

            if (generateMacros)
            {
                macros = ProduceMacroConfig(computedMacros);
            }

            if (Symbols != null)
            {
                foreach (KeyValuePair<string, ISymbolModel> symbol in Symbols)
                {
                    if (symbol.Value is DerivedSymbol derivedSymbol)
                    {
                        if (generateMacros)
                        {
                            macros.Add(new ProcessValueFormMacroConfig(derivedSymbol.ValueSource, symbol.Key, derivedSymbol.DataType, derivedSymbol.ValueTransform, Forms));
                        }
                    }

                    if (symbol.Value.Replaces != null)
                    {
                        string sourceVariable = null;

                        if (string.Equals(symbol.Value.Type, SymbolModelConverter.BindSymbolTypeName, StringComparison.Ordinal))
                        {
                            if (string.IsNullOrWhiteSpace(symbol.Value.Binding))
                            {
                                EnvironmentSettings.Host.LogMessage($"Binding wasn't specified for bind-type symbol {symbol.Key}");
                            }
                            else
                            {
                                //Since this is a bind symbol, don't replace the literal with this symbol's value,
                                //  replace it with the value of the bound symbol
                                sourceVariable = symbol.Value.Binding;
                            }
                        }
                        else
                        {
                            //Replace the literal value in the "replaces" property with the evaluated value of the symbol
                            sourceVariable = symbol.Key;
                        }

                        if (sourceVariable != null)
                        {
                            if (symbol.Value is BaseValueSymbol p)
                            {
                                foreach (string formName in p.Forms.GlobalForms)
                                {
                                    if (Forms.TryGetValue(formName, out IValueForm valueForm))
                                    {
                                        string symbolName = symbol.Key + "{-VALUE-FORMS-}" + formName;
                                        string processedReplacement = valueForm.Process(Forms, p.Replaces);
                                        GenerateReplacementsForParameter(symbol, processedReplacement, symbolName, macroGeneratedReplacements);

                                        if (generateMacros)
                                        {
                                            macros.Add(new ProcessValueFormMacroConfig(symbol.Key, symbolName, "string", formName, Forms));
                                        }
                                    }
                                    else
                                    {
                                        EnvironmentSettings.Host.LogDiagnosticMessage($"Unable to find a form called '{formName}'", "Authoring");
                                    }
                                }
                            }
                            else
                            {
                                GenerateReplacementsForParameter(symbol, symbol.Value.Replaces, sourceVariable, macroGeneratedReplacements);
                            }
                        }
                    }
                }
            }

            foreach (KeyValuePair<Guid, string> map in _guidToGuidPrefixMap)
            {
                foreach (char format in GuidMacroConfig.DefaultFormats)
                {
                    string newGuid = char.IsUpper(format) ? map.Key.ToString(format.ToString()).ToUpperInvariant() : map.Key.ToString(format.ToString()).ToLowerInvariant();
                    macroGeneratedReplacements.Add(new ReplacementTokens(map.Value + "-" + format, newGuid.TokenConfig()));
                }
            }

            IReadOnlyList<ICustomOperationModel> customOperationConfig;
            if (customGlobModel != null && customGlobModel.Operations != null)
            {
                customOperationConfig = customGlobModel.Operations;
            }
            else
            {
                customOperationConfig = new List<ICustomOperationModel>();
            }

            foreach (IOperationProvider p in operations.ToList())
            {
                if (!string.IsNullOrEmpty(p.Id))
                {
                    string prefix = (customGlobModel == null || string.IsNullOrEmpty(customGlobModel.FlagPrefix)) ? defaultModel.FlagPrefix : customGlobModel.FlagPrefix;
                    string on = $"{prefix}+:{p.Id}";
                    string off = $"{prefix}-:{p.Id}";
                    string onNoEmit = $"{prefix}+:{p.Id}:noEmit";
                    string offNoEmit = $"{prefix}-:{p.Id}:noEmit";
                    operations.Add(new SetFlag(p.Id, on.TokenConfig(), off.TokenConfig(), onNoEmit.TokenConfig(), offNoEmit.TokenConfig(), null, true));
                }
            }

            GlobalRunConfig config = new GlobalRunConfig()
            {
                Operations = operations,
                VariableSetup = variableConfig,
                Macros = macros,
                ComputedMacros = computedMacros,
                Replacements = macroGeneratedReplacements,
                CustomOperations = customOperationConfig,
            };

            return config;
        }

        private void GenerateReplacementsForParameter(KeyValuePair<string, ISymbolModel> symbol, string replaces, string sourceVariable, List<IReplacementTokens> macroGeneratedReplacements)
        {
            TokenConfig replacementConfig = replaces.TokenConfigBuilder();
            if (symbol.Value.ReplacementContexts.Count > 0)
            {
                foreach (IReplacementContext context in symbol.Value.ReplacementContexts)
                {
                    TokenConfig builder = replacementConfig;
                    if (!string.IsNullOrEmpty(context.OnlyIfAfter))
                    {
                        builder = builder.OnlyIfAfter(context.OnlyIfAfter);
                    }

                    if (!string.IsNullOrEmpty(context.OnlyIfBefore))
                    {
                        builder = builder.OnlyIfBefore(context.OnlyIfBefore);
                    }

                    macroGeneratedReplacements.Add(new ReplacementTokens(sourceVariable, builder));
                }
            }
            else
            {
                macroGeneratedReplacements.Add(new ReplacementTokens(sourceVariable, replacementConfig));
            }
        }

        private List<IMacroConfig> ProduceMacroConfig(List<IMacroConfig> computedMacroConfigs)
        {
            List<IMacroConfig> generatedMacroConfigs = new List<IMacroConfig>();

            if (Guids != null)
            {
                int guidCount = 0;
                foreach (Guid guid in Guids)
                {
                    int id = guidCount++;
                    string replacementId = "guid" + id;
                    generatedMacroConfigs.Add(new GuidMacroConfig(replacementId, "string", null));
                    _guidToGuidPrefixMap[guid] = replacementId;
                }
            }

            if (Symbols != null)
            {
                foreach (KeyValuePair<string, ISymbolModel> symbol in Symbols)
                {
                    if (string.Equals(symbol.Value.Type, ComputedSymbol.TypeName, StringComparison.Ordinal))
                    {
                        ComputedSymbol computed = (ComputedSymbol) symbol.Value;
                        string value = computed.Value;
                        string evaluator = computed.Evaluator;
                        string dataType = computed.DataType;
                        computedMacroConfigs.Add(new EvaluateMacroConfig(symbol.Key, dataType, value, evaluator));
                    }
                    else if (string.Equals(symbol.Value.Type, GeneratedSymbol.TypeName, StringComparison.Ordinal))
                    {
                        GeneratedSymbol symbolInfo = (GeneratedSymbol)symbol.Value;
                        string type = symbolInfo.Generator;
                        string variableName = symbol.Key;
                        Dictionary<string, JToken> configParams = new Dictionary<string, JToken>();

                        foreach (KeyValuePair<string, JToken> parameter in symbolInfo.Parameters)
                        {
                            configParams.Add(parameter.Key, parameter.Value);
                        }

                        string dataType = symbolInfo.DataType;

                        if (string.Equals(dataType, "choice", StringComparison.OrdinalIgnoreCase))
                        {
                            dataType = "string";
                        }

                        generatedMacroConfigs.Add(new GeneratedSymbolDeferredMacroConfig(type, dataType, variableName, configParams));
                    }
                }
            }

            return generatedMacroConfigs;
        }

        // If the token is a string:
        //      check if its a valid file in the same directory as the sourceFile.
        //          If so, read that files content as the exclude list.
        //          Otherwise returns an array containing the string value as its only entry.
        // Otherwise, interpret the token as an array and return the content.
        private static IReadOnlyList<string> JTokenAsFilenameToReadOrArrayToCollection(JToken token, IFile sourceFile, string[] defaultSet)
        {
            if (token == null)
            {
                return defaultSet;
            }

            if (token.Type == JTokenType.String)
            {
                string tokenValue = token.ToString();
                if ((tokenValue.IndexOfAny(Path.GetInvalidPathChars()) != -1)
                    || !sourceFile.Parent.FileInfo(tokenValue).Exists)
                {
                    return new List<string>(new[] { tokenValue });
                }
                else
                {
                    using (Stream excludeList = sourceFile.Parent.FileInfo(token.ToString()).OpenRead())
                    using (TextReader reader = new StreamReader(excludeList, Encoding.UTF8, true, 4096, true))
                    {
                        return reader.ReadToEnd().Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
                    }
                }
            }

            return token.ArrayAsStrings();
        }

        private static IReadOnlyList<string> JTokenStringOrArrayToCollection(JToken token, string[] defaultSet)
        {
            if (token == null)
            {
                return defaultSet;
            }

            if (token.Type == JTokenType.String)
            {
                string tokenValue = token.ToString();
                return new List<string>() { tokenValue };
            }

            return token.ArrayAsStrings();
        }

        public void Evaluate(IParameterSet parameters, IVariableCollection rootVariableCollection, IFileSystemInfo configFile)
        {
            bool stable = Symbols == null;
            Dictionary<string, bool> computed = new Dictionary<string, bool>();

            while (!stable)
            {
                stable = true;
                foreach (KeyValuePair<string, ISymbolModel> symbol in Symbols)
                {
                    if (string.Equals(symbol.Value.Type, ComputedSymbol.TypeName, StringComparison.Ordinal))
                    {
                        ComputedSymbol sym = (ComputedSymbol)symbol.Value;
                        bool value = Cpp2StyleEvaluatorDefinition.EvaluateFromString(EnvironmentSettings, sym.Value, rootVariableCollection);
                        stable &= computed.TryGetValue(symbol.Key, out bool currentValue) && currentValue == value;
                        rootVariableCollection[symbol.Key] = value;
                        computed[symbol.Key] = value;
                    }
                    else if (string.Equals(symbol.Value.Type, SymbolModelConverter.BindSymbolTypeName, StringComparison.Ordinal))
                    {
                        if (parameters.TryGetRuntimeValue(EnvironmentSettings, symbol.Value.Binding, out object bindValue) && bindValue != null)
                        {
                            rootVariableCollection[symbol.Key] = RunnableProjectGenerator.InferTypeAndConvertLiteral(bindValue.ToString());
                        }
                    }
                }
            }

            // evaluate the file glob (specials) conditions
            // the result is needed for SpecialOperationConfig
            foreach (ICustomFileGlobModel fileGlobModel in SpecialCustomSetup)
            {
                fileGlobModel.EvaluateCondition(EnvironmentSettings, rootVariableCollection);
            }

            parameters.ResolvedValues.TryGetValue(NameParameter, out object resolvedNameParamValue);

            _sources = EvaluateSources(parameters, rootVariableCollection, configFile, resolvedNameParamValue);

            // evaluate the conditions and resolve the paths for the PrimaryOutputs
            foreach (ICreationPathModel pathModel in PrimaryOutputs)
            {
                pathModel.EvaluateCondition(EnvironmentSettings, rootVariableCollection);

                if (pathModel.ConditionResult)
                {
                    foreach (FileSourceMatchInfo sourceInfo in _sources)
                    {
                        if (sourceInfo.Renames.TryGetValue(pathModel.PathOriginal, out string targetPath))
                        {
                            pathModel.PathResolved = targetPath;
                        }
                        //Don't overwrite an already resolved output value
                        else if (string.IsNullOrEmpty(pathModel.PathResolved))
                        {
                            pathModel.PathResolved = pathModel.PathOriginal;
                        }
                    }
                }
            }
        }

        private List<FileSourceMatchInfo> EvaluateSources(IParameterSet parameters, IVariableCollection rootVariableCollection, IFileSystemInfo configFile, object resolvedNameParamValue)
        {
            List<FileSourceMatchInfo> sources = new List<FileSourceMatchInfo>();

            foreach (ExtendedFileSource source in Sources)
            {
                if (!string.IsNullOrEmpty(source.Condition) && !Cpp2StyleEvaluatorDefinition.EvaluateFromString(EnvironmentSettings, source.Condition, rootVariableCollection))
                {
                    continue;
                }

                IReadOnlyList<string> topIncludePattern = JTokenAsFilenameToReadOrArrayToCollection(source.Include, SourceFile, IncludePatternDefaults).ToList();
                IReadOnlyList<string> topExcludePattern = JTokenAsFilenameToReadOrArrayToCollection(source.Exclude, SourceFile, ExcludePatternDefaults).ToList();
                IReadOnlyList<string> topCopyOnlyPattern = JTokenAsFilenameToReadOrArrayToCollection(source.CopyOnly, SourceFile, CopyOnlyPatternDefaults).ToList();
                FileSourceEvaluable topLevelPatterns = new FileSourceEvaluable(topIncludePattern, topExcludePattern, topCopyOnlyPattern);

                Dictionary<string, string> fileRenamesFromSource = new Dictionary<string, string>(source.Rename ?? RenameDefaults, StringComparer.Ordinal);
                List<FileSourceEvaluable> modifierList = new List<FileSourceEvaluable>();

                if (source.Modifiers != null)
                {
                    foreach (SourceModifier modifier in source.Modifiers)
                    {
                        if (string.IsNullOrEmpty(modifier.Condition) || Cpp2StyleEvaluatorDefinition.EvaluateFromString(EnvironmentSettings, modifier.Condition, rootVariableCollection))
                        {
                            IReadOnlyList<string> modifierIncludes = JTokenAsFilenameToReadOrArrayToCollection(modifier.Include, SourceFile, new string[0]);
                            IReadOnlyList<string> modifierExcludes = JTokenAsFilenameToReadOrArrayToCollection(modifier.Exclude, SourceFile, new string[0]);
                            IReadOnlyList<string> modifierCopyOnly = JTokenAsFilenameToReadOrArrayToCollection(modifier.CopyOnly, SourceFile, new string[0]);
                            FileSourceEvaluable modifierPatterns = new FileSourceEvaluable(modifierIncludes, modifierExcludes, modifierCopyOnly);
                            modifierList.Add(modifierPatterns);

                            if (modifier.Rename != null)
                            {
                                foreach (JProperty property in modifier.Rename.Properties())
                                {
                                    fileRenamesFromSource[property.Name] = property.Value.Value<string>();
                                }
                            }
                        }
                    }
                }

                string sourceDirectory = source.Source ?? "./";
                string targetDirectory = source.Target ?? "./";
                IReadOnlyDictionary<string, string> allRenamesForSource = AugmentRenames(configFile, sourceDirectory, ref targetDirectory, resolvedNameParamValue, parameters, fileRenamesFromSource);

                FileSourceMatchInfo sourceMatcher = new FileSourceMatchInfo(
                    sourceDirectory,
                    targetDirectory,
                    topLevelPatterns,
                    allRenamesForSource,
                    modifierList);
                sources.Add(sourceMatcher);
            }

            if (Sources.Count == 0)
            {
                IReadOnlyList<string> includePattern = IncludePatternDefaults;
                IReadOnlyList<string> excludePattern = ExcludePatternDefaults;
                IReadOnlyList<string> copyOnlyPattern = CopyOnlyPatternDefaults;
                FileSourceEvaluable topLevelPatterns = new FileSourceEvaluable(includePattern, excludePattern, copyOnlyPattern);

                string targetDirectory = string.Empty;
                Dictionary<string, string> fileRenamesFromSource = new Dictionary<string, string>(StringComparer.Ordinal);
                IReadOnlyDictionary<string, string> allRenamesForSource = AugmentRenames(configFile, "./", ref targetDirectory, resolvedNameParamValue, parameters, fileRenamesFromSource);

                FileSourceMatchInfo sourceMatcher = new FileSourceMatchInfo(
                    "./",
                    "./",
                    topLevelPatterns,
                    allRenamesForSource,
                    new List<FileSourceEvaluable>());
                sources.Add(sourceMatcher);
            }

            return sources;
        }

        private IReadOnlyDictionary<string, string> AugmentRenames(IFileSystemInfo configFile, string sourceDirectory, ref string targetDirectory, object resolvedNameParamValue, IParameterSet parameters, Dictionary<string, string> fileRenames)
        {
            return FileRenameGenerator.AugmentFileRenames(EnvironmentSettings, SourceName, configFile, sourceDirectory, ref targetDirectory, resolvedNameParamValue, parameters, fileRenames);
        }

        private static ISymbolModel SetupDefaultNameSymbol(string sourceName)
        {
            StringBuilder nameSymbolConfigBuilder = new StringBuilder(512);

            nameSymbolConfigBuilder.AppendLine(@"
{
  ""binding"": """ + NameSymbolName + @""",
  ""type"": """ + ParameterSymbol.TypeName + @""",
  ""description"": ""The default name symbol"",
  ""datatype"": ""string"",
  ""forms"": {
    ""global"": [ """ + IdentityValueForm.FormName
                    + @""", """ + DefaultSafeNameValueFormModel.FormName
                    + @""", """ + DefaultLowerSafeNameValueFormModel.FormName
                    + @""", """ + DefaultSafeNamespaceValueFormModel.FormName
                    + @""", """ + DefaultLowerSafeNamespaceValueFormModel.FormName
                    + @"""]
  }
");

            if (!string.IsNullOrEmpty(sourceName))
            {
                nameSymbolConfigBuilder.AppendLine(",");
                nameSymbolConfigBuilder.AppendLine($"\"replaces\": \"{sourceName}\"");
            }

            nameSymbolConfigBuilder.AppendLine("}");

            JObject config = JObject.Parse(nameSymbolConfigBuilder.ToString());
            return ParameterSymbol.FromJObject(config, null, null);
        }

        private static IReadOnlyDictionary<string, IValueForm> SetupValueFormMapForTemplate(JObject source)
        {
            Dictionary<string, IValueForm> formMap = new Dictionary<string, IValueForm>(StringComparer.Ordinal);

            // setup all the built-in default forms.
            foreach (KeyValuePair<string, IValueForm> builtInForm in ValueFormRegistry.AllForms)
            {
                formMap[builtInForm.Key] = builtInForm.Value;
            }

            // setup the forms defined by the template configuration.
            // if any have the same name as a default, the default is overridden.
            IReadOnlyDictionary<string, JToken> templateDefinedforms = source.ToJTokenDictionary(StringComparer.OrdinalIgnoreCase, nameof(Forms));

            foreach (KeyValuePair<string, JToken> form in templateDefinedforms)
            {
                if (form.Value is JObject o)
                {
                    formMap[form.Key] = ValueFormRegistry.GetForm(form.Key, o);
                }
            }

            return formMap;
        }

        public static SimpleConfigModel FromJObject(IEngineEnvironmentSettings environmentSettings, JObject source, ISimpleConfigModifiers configModifiers = null, JObject localeSource = null)
        {
            ILocalizationModel localizationModel = LocalizationFromJObject(localeSource);

            SimpleConfigModel config = new SimpleConfigModel()
            {
                Author = localizationModel?.Author ?? source.ToString(nameof(config.Author)),
                Classifications = source.ArrayAsStrings(nameof(config.Classifications)),
                DefaultName = source.ToString(nameof(DefaultName)),
                Description = localizationModel?.Description ?? source.ToString(nameof(Description)) ?? string.Empty,
                GroupIdentity = source.ToString(nameof(GroupIdentity)),
                Precedence = source.ToInt32(nameof(Precedence)),
                Guids = source.ArrayAsGuids(nameof(config.Guids)),
                Identity = source.ToString(nameof(config.Identity)),
                Name = localizationModel?.Name ?? source.ToString(nameof(config.Name)),

                SourceName = source.ToString(nameof(config.SourceName)),
                PlaceholderFilename = source.ToString(nameof(config.PlaceholderFilename)),
                EnvironmentSettings = environmentSettings,
                GeneratorVersions = source.ToString(nameof(config.GeneratorVersions))
            };

            JToken shortNameToken = source.Get<JToken>("ShortName");
            config.ShortNameList = JTokenStringOrArrayToCollection(shortNameToken, new string[0]);

            config.Forms = SetupValueFormMapForTemplate(source);

            List <ExtendedFileSource> sources = new List<ExtendedFileSource>();
            config.Sources = sources;

            foreach (JObject item in source.Items<JObject>(nameof(config.Sources)))
            {
                ExtendedFileSource src = new ExtendedFileSource();
                sources.Add(src);
                src.CopyOnly = item.Get<JToken>(nameof(src.CopyOnly));
                src.Exclude = item.Get<JToken>(nameof(src.Exclude));
                src.Include = item.Get<JToken>(nameof(src.Include));
                src.Condition = item.ToString(nameof(src.Condition));
                src.Rename = item.Get<JObject>(nameof(src.Rename)).ToStringDictionary().ToDictionary(x => x.Key, x => x.Value);

                List<SourceModifier> modifiers = new List<SourceModifier>();
                src.Modifiers = modifiers;
                foreach (JObject entry in item.Items<JObject>(nameof(src.Modifiers)))
                {
                    SourceModifier modifier = new SourceModifier
                    {
                        Condition = entry.ToString(nameof(modifier.Condition)),
                        CopyOnly = entry.Get<JToken>(nameof(modifier.CopyOnly)),
                        Exclude = entry.Get<JToken>(nameof(modifier.Exclude)),
                        Include = entry.Get<JToken>(nameof(modifier.Include)),
                        Rename = entry.Get<JObject>(nameof(modifier.Rename))
                    };
                    modifiers.Add(modifier);
                }

                src.Source = item.ToString(nameof(src.Source));
                src.Target = item.ToString(nameof(src.Target));
            }

            IBaselineInfo baseline = null;
            config.BaselineInfo = BaselineInfoFromJObject(source.PropertiesOf("baselines"));

            if (configModifiers != null && !string.IsNullOrEmpty(configModifiers.BaselineName))
            {
                config.BaselineInfo.TryGetValue(configModifiers.BaselineName, out baseline);
            }

            Dictionary<string, ISymbolModel> symbols = new Dictionary<string, ISymbolModel>(StringComparer.Ordinal);
            // create a name symbol. If one is explicitly defined in the template, it'll override this.
            symbols.Add(NameSymbolName, SetupDefaultNameSymbol(config.SourceName));

            // tags are being deprecated from template configuration, but we still read them for backwards compatibility.
            // They're turned into symbols here, which eventually become tags.
            config._tagsDeprecated = source.ToStringDictionary(StringComparer.OrdinalIgnoreCase, nameof(config.Tags));
            IReadOnlyDictionary<string, ISymbolModel> symbolsFromTags = ConvertDeprecatedTagsToParameterSymbols(config._tagsDeprecated);

            foreach (KeyValuePair<string, ISymbolModel> tagSymbol in symbolsFromTags)
            {
                if (!symbols.ContainsKey(tagSymbol.Key))
                {
                    symbols.Add(tagSymbol.Key, tagSymbol.Value);
                }
            }

            config.Symbols = symbols;
            foreach (JProperty prop in source.PropertiesOf(nameof(config.Symbols)))
            {
                JObject obj = prop.Value as JObject;

                if (obj == null)
                {
                    continue;
                }

                IParameterSymbolLocalizationModel symbolLocalization = null;
                if (localizationModel != null)
                {
                    localizationModel.ParameterSymbols.TryGetValue(prop.Name, out symbolLocalization);
                }

                string defaultOverride = null;
                if (baseline != null && baseline.DefaultOverrides != null)
                {
                    baseline.DefaultOverrides.TryGetValue(prop.Name, out defaultOverride);
                }

                ISymbolModel modelForSymbol = SymbolModelConverter.GetModelForObject(obj, symbolLocalization, defaultOverride);

                if (modelForSymbol != null)
                {
                    // The symbols dictionary comparer is Ordinal, making symbol names case-sensitive.
                    if (string.Equals(prop.Name, NameSymbolName, StringComparison.Ordinal)
                            && symbols.TryGetValue(prop.Name, out ISymbolModel existingSymbol))
                    {   // "name" symbol is explicitly defined above. If it's also defined in the template.json, it gets special handling here.
                        symbols[prop.Name] = ParameterSymbol.ExplicitNameSymbolMergeWithDefaults(modelForSymbol, existingSymbol);
                    }
                    else
                    {   // last in wins (in the odd case where a template.json defined a symbol multiple times)
                        symbols[prop.Name] = modelForSymbol;
                    }
                }
            }

            config.PostActionModel = RunnableProjects.PostActionModel.ListFromJArray(source.Get<JArray>("PostActions"), localizationModel?.PostActions);
            config.HasScriptRunningPostActions = config.PostActionModel.Any(x => x.ActionId == PostActionInfo.ProcessStartPostActionProcessorId);
            config.PrimaryOutputs = CreationPathModel.ListFromJArray(source.Get<JArray>(nameof(PrimaryOutputs)));

            // Custom operations at the global level
            JToken globalCustomConfigData = source[nameof(config.CustomOperations)];
            if (globalCustomConfigData != null)
            {
                config.CustomOperations = CustomFileGlobModel.FromJObject((JObject)globalCustomConfigData, string.Empty);
            }
            else
            {
                config.CustomOperations = null;
            }

            // Custom operations for specials
            IReadOnlyDictionary<string, JToken> allSpecialOpsConfig = source.ToJTokenDictionary(StringComparer.OrdinalIgnoreCase, "SpecialCustomOperations");
            List<ICustomFileGlobModel> specialCustomSetup = new List<ICustomFileGlobModel>();

            foreach (KeyValuePair<string, JToken> globConfigKeyValue in allSpecialOpsConfig)
            {
                string globName = globConfigKeyValue.Key;
                JToken globData = globConfigKeyValue.Value;

                CustomFileGlobModel globModel = CustomFileGlobModel.FromJObject((JObject)globData, globName);
                specialCustomSetup.Add(globModel);
            }

            config.SpecialCustomSetup = specialCustomSetup;

            // localization operations for individual files
            Dictionary<string, IReadOnlyList<IOperationProvider>> localizations = new Dictionary<string, IReadOnlyList<IOperationProvider>>();
            if (localizationModel != null && localizationModel.FileLocalizations != null)
            {
                foreach (FileLocalizationModel fileLocalization in localizationModel.FileLocalizations)
                {
                    List<IOperationProvider> localizationsForFile = new List<IOperationProvider>();
                    foreach (KeyValuePair<string, string> localizationInfo in fileLocalization.Localizations)
                    {
                        localizationsForFile.Add(new Replacement(localizationInfo.Key.TokenConfig(), localizationInfo.Value, null, true));
                    }

                    localizations.Add(fileLocalization.File, localizationsForFile);
                }
            }
            config.LocalizationOperations = localizations;

            return config;
        }

        private static IReadOnlyDictionary<string, IBaselineInfo> BaselineInfoFromJObject(IEnumerable<JProperty> baselineJProperties)
        {
            Dictionary<string, IBaselineInfo> allBaselines = new Dictionary<string, IBaselineInfo>();

            foreach (JProperty property in baselineJProperties)
            {
                JObject obj = property.Value as JObject;

                if (obj == null)
                {
                    continue;
                }

                BaselineInfo baseline = new BaselineInfo
                {
                    Description = obj.ToString(nameof(baseline.Description)),
                    DefaultOverrides = obj.Get<JObject>(nameof(baseline.DefaultOverrides)).ToStringDictionary()
                };

                allBaselines[property.Name] = baseline;
            }

            return allBaselines;
        }

        private static IReadOnlyDictionary<string, ISymbolModel> ConvertDeprecatedTagsToParameterSymbols(IReadOnlyDictionary<string, string> tagsDeprecated)
        {
            Dictionary<string, ISymbolModel> symbols = new Dictionary<string, ISymbolModel>();

            foreach (KeyValuePair<string, string> tagInfo in tagsDeprecated)
            {
                symbols[tagInfo.Key] = ParameterSymbol.FromDeprecatedConfigTag(tagInfo.Value);
            }

            return symbols;
        }

        public static ILocalizationModel LocalizationFromJObject(JObject source)
        {
            if (source == null)
            {
                return null;
            }

            LocalizationModel locModel = new LocalizationModel()
            {
                Author = source.ToString(nameof(locModel.Author)),
                Name = source.ToString(nameof(locModel.Name)),
                Description = source.ToString(nameof(locModel.Description)),
                Identity = source.ToString(nameof(locModel.Identity)),
            };

            // symbol description & choice localizations
            Dictionary<string, IParameterSymbolLocalizationModel> parameterLocalizations = new Dictionary<string, IParameterSymbolLocalizationModel>();
            IReadOnlyDictionary<string, JToken> symbolInfoList = source.ToJTokenDictionary(StringComparer.OrdinalIgnoreCase, "symbols");

            foreach (KeyValuePair<string, JToken> symbolDetail in symbolInfoList)
            {
                string symbol = symbolDetail.Key;
                string description = symbolDetail.Value.ToString("description");
                Dictionary<string, string> choicesAndDescriptionsForSymbol = new Dictionary<string, string>();

                foreach (JObject choiceObject in symbolDetail.Value.Items<JObject>("choices"))
                {
                    string choice = choiceObject.ToString("choice");
                    string choiceDescription = choiceObject.ToString("description");

                    if (!string.IsNullOrEmpty(choice) && !string.IsNullOrEmpty(choiceDescription))
                    {
                        choicesAndDescriptionsForSymbol.Add(choice, choiceDescription);
                    }
                }

                IParameterSymbolLocalizationModel symbolLocalization = new ParameterSymbolLocalizationModel(symbol, description, choicesAndDescriptionsForSymbol);
                parameterLocalizations.Add(symbol, symbolLocalization);
            }

            locModel.ParameterSymbols = parameterLocalizations;

            // post action localizations
            Dictionary<Guid, IPostActionLocalizationModel> postActions = new Dictionary<Guid, IPostActionLocalizationModel>();
            foreach (JObject item in source.Items<JObject>(nameof(locModel.PostActions)))
            {
                IPostActionLocalizationModel postActionModel = PostActionLocalizationModel.FromJObject(item);
                postActions.Add(postActionModel.ActionId, postActionModel);
            }
            locModel.PostActions = postActions;

            // regular file localizations
            IReadOnlyDictionary<string, JToken> fileLocalizationJson = source.ToJTokenDictionary(StringComparer.OrdinalIgnoreCase, "localizations");
            List<FileLocalizationModel> fileLocalizations = new List<FileLocalizationModel>();

            if (fileLocalizationJson != null)
            {
                foreach (KeyValuePair<string, JToken> fileLocInfo in fileLocalizationJson)
                {
                    string fileName = fileLocInfo.Key;
                    JToken localizationJson = fileLocInfo.Value;
                    FileLocalizationModel fileModel = FileLocalizationModel.FromJObject(fileName, (JObject)localizationJson);
                    fileLocalizations.Add(fileModel);
                }
            }
            locModel.FileLocalizations = fileLocalizations;

            return locModel;
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
Language Research in Marketing
By Ann Kronrod, University of Massachusetts, Lowell, USA, ann_kronrod@uml.edu
Ann Kronrod (2022), "Language Research in Marketing", Foundations and Trends® in Marketing: Vol. 16: No. 3, pp 308-421. http://dx.doi.org/10.1561/1700000069
Publication Date: 11 Apr 2022
© 2022 A. Kronrod
Consumer Behavior, Channel Management, Branding and Brand Equity, Marketing Research, Marketing Information Systems, Services Marketing, Individual Decision Making, Psychology
I. Linguistics and Language Research
1. The Components of Language
2. Prominent Theories in Linguistics
II. Language in Marketing: Research and Practice
3. Phonetics
4. Semantics
5. Grammar/Syntax
6. Discourse
7. Pragmatics
8. Sociolinguistics
III. Developing Research of Language in Marketing
9. Methods in Linguistic Inquiry
10. A Proposed Process of Designing Language Research in Marketing
IV. Summary and a Look Into the Future
11. Summary
12. Where Do We Go from Here? Evolving Directions of Language Research in Marketing
This monograph aims to introduce researchers to the fascinating world of linguistics and to show how to conduct meaningful language research in marketing, exploring the way language influences behavior and how language can express thoughts, emotions, and mental states in marketing contexts. Ann Kronrod, who holds a Ph.D. in linguistics and conducts linguistic research in marketing, familiarizes the reader with fundamental concepts and prominent theories in linguistics, reviews the currently available research in marketing that examines language questions, lays out a guide to conducting compelling language research in marketing, and offers exciting future directions for developing new perspectives on language within marketing research. This monograph can be used as a basic guide for beginning researchers who are interested to conduct language research in marketing, or as a summary for more seasoned researchers who already acquired linguistics education and would like to get up to date on recent streams in the research of language in marketing.
132 pp. $90.00
132 pp. $145.00
Language Research in Marketing introduces researchers to the fascinating world of linguistics and shows how to conduct meaningful language research in marketing, exploring the way language influences behavior and how language can express thoughts, emotions, and mental states in marketing contexts. The author familiarizes the reader with fundamental concepts and prominent theories in linguistics, reviews the currently available research in marketing that examines language questions, lays out a guide to conducting compelling language research in marketing, and offers exciting future directions for developing new perspectives on language within marketing research. This monograph can be used as a basic guide for beginning researchers who are interested to conduct language research in marketing, or as a summary for more seasoned researchers who already acquired linguistics education and would like to get up to date on recent streams in the research of language in marketing.

redpajama_set_name: RedPajamaCommonCrawl


Tekashi 6ix9ine is singing like a bird. This has potentially put his family in jeopardy, so the jailed Brooklyn rapper has hired private security to keep an eye on his loved ones.
As for his baby mama, she has security, too, but she's footing the bill herself.
Tekashi69 won't be formally sentenced until January 2020. Reportedly, his deal requires him to keep telling on any and everybody.
How else did y'all think this was going to end? Share your thoughts in the comments.


text:
'Ireland' and the British Empire Games 1930
Katie/K Liston
Faculty Of Life & Health Sciences
School of Sport
Today's presentation is the outcome of an ongoing collaboration between Joe Maguire and me that started in March 2012. Like all good researchers, we share an intellectual and personal passion for today's subject matter. We assume that you take the study of sport seriously, from a sociological perspective so our analysis today rests on three assumptions: first, the present has emerged from the past; second, that sport can be used as a laboratory in situ, as a critical case study of wider socio-economic and political processes; and, third; that process sociology is well equipped to help make sense of the relationship between sport, culture and society, and of ongoing relationships between the peoples of the North Atlantic, through the use of concepts like habitus, established-outsiders, the personal pronoun (I/we/they group images) and double bind processes. For that reason, we could equally be next door in the parallel session on established-outsiders. But also relevant here today are those aspects process sociology that deal with identity – that which is proclaimed and that which is imposed – and further developments of Elias's work that take account of zones of prestige (not in the sense used by Collins), emulation and resistance.
Published - 22 Jun 2014
From the Past to the Present and Towards Possible Futures -
Duration: 22 Jun 2014 → …
From the Past to the Present and Towards Possible Futures
British Empire Games
Empire Ireland
Fingerprint Dive into the research topics of ''Ireland' and the British Empire Games 1930'. Together they form a unique fingerprint.
Ireland Social Sciences
Sports Social Sciences
sociology Social Sciences
prestige Social Sciences
present Social Sciences
economics Social Sciences
Liston, KK. (2014). 'Ireland' and the British Empire Games 1930. In Unknown Host Publication Not applicable.
Liston, Katie/K. / 'Ireland' and the British Empire Games 1930. Unknown Host Publication. Not applicable, 2014.
@inproceedings{6937173547c24b928349bce71445dc85,
title = "'Ireland' and the British Empire Games 1930",
abstract = "Today{\textquoteright}s presentation is the outcome of an ongoing collaboration between Joe Maguire and me that started in March 2012. Like all good researchers, we share an intellectual and personal passion for today{\textquoteright}s subject matter. We assume that you take the study of sport seriously, from a sociological perspective so our analysis today rests on three assumptions: first, the present has emerged from the past; second, that sport can be used as a laboratory in situ, as a critical case study of wider socio-economic and political processes; and, third; that process sociology is well equipped to help make sense of the relationship between sport, culture and society, and of ongoing relationships between the peoples of the North Atlantic, through the use of concepts like habitus, established-outsiders, the personal pronoun (I/we/they group images) and double bind processes. For that reason, we could equally be next door in the parallel session on established-outsiders. But also relevant here today are those aspects process sociology that deal with identity – that which is proclaimed and that which is imposed – and further developments of Elias{\textquoteright}s work that take account of zones of prestige (not in the sense used by Collins), emulation and resistance.",
keywords = "British Empire Games, Commonwealth, Empire Ireland",
author = "Katie/K Liston",
publisher = "Not applicable",
note = "From the Past to the Present and Towards Possible Futures ; Conference date: 22-06-2014",
Liston, KK 2014, 'Ireland' and the British Empire Games 1930. in Unknown Host Publication. Not applicable, From the Past to the Present and Towards Possible Futures, 22/06/14.
'Ireland' and the British Empire Games 1930. / Liston, Katie/K.
Unknown Host Publication. Not applicable, 2014.
T1 - 'Ireland' and the British Empire Games 1930
AU - Liston, Katie/K
N2 - Today's presentation is the outcome of an ongoing collaboration between Joe Maguire and me that started in March 2012. Like all good researchers, we share an intellectual and personal passion for today's subject matter. We assume that you take the study of sport seriously, from a sociological perspective so our analysis today rests on three assumptions: first, the present has emerged from the past; second, that sport can be used as a laboratory in situ, as a critical case study of wider socio-economic and political processes; and, third; that process sociology is well equipped to help make sense of the relationship between sport, culture and society, and of ongoing relationships between the peoples of the North Atlantic, through the use of concepts like habitus, established-outsiders, the personal pronoun (I/we/they group images) and double bind processes. For that reason, we could equally be next door in the parallel session on established-outsiders. But also relevant here today are those aspects process sociology that deal with identity – that which is proclaimed and that which is imposed – and further developments of Elias's work that take account of zones of prestige (not in the sense used by Collins), emulation and resistance.
AB - Today's presentation is the outcome of an ongoing collaboration between Joe Maguire and me that started in March 2012. Like all good researchers, we share an intellectual and personal passion for today's subject matter. We assume that you take the study of sport seriously, from a sociological perspective so our analysis today rests on three assumptions: first, the present has emerged from the past; second, that sport can be used as a laboratory in situ, as a critical case study of wider socio-economic and political processes; and, third; that process sociology is well equipped to help make sense of the relationship between sport, culture and society, and of ongoing relationships between the peoples of the North Atlantic, through the use of concepts like habitus, established-outsiders, the personal pronoun (I/we/they group images) and double bind processes. For that reason, we could equally be next door in the parallel session on established-outsiders. But also relevant here today are those aspects process sociology that deal with identity – that which is proclaimed and that which is imposed – and further developments of Elias's work that take account of zones of prestige (not in the sense used by Collins), emulation and resistance.
KW - British Empire Games
KW - Commonwealth
KW - Empire Ireland
PB - Not applicable
T2 - From the Past to the Present and Towards Possible Futures
Y2 - 22 June 2014
Liston KK. 'Ireland' and the British Empire Games 1930. In Unknown Host Publication. Not applicable. 2014


text:
EEC and United Way Announce Brain Building in Progress Week in Massachusetts
BOSTON – Recognizing the importance of enriching opportunities in children's healthy development and learning, the Massachusetts Department of Early Education and Care (EEC) and the United Way of Massachusetts Bay and Merrimack Valley (United Way) announced today the kick-off of Brain Building in Progress Week in Massachusetts.
From April 12 to 18, families, educators, business leaders, and other partners engage in activities that support the importance of early enriching environments and experiences to the future success of young children. These efforts are part of Massachusetts' statewide campaign, Brain Building in Progress, that advances the critical role that adults play in fostering children's brain development and learning.
Governor Baker signed a proclamation to declare April 12 to 18 as Brain Building in Progress Week in Massachusetts, which coincides with the national Week of the Young Child. Throughout the week, EEC and United Way are providing resources to families that include tips for having "brain building moments" with children such as pointing out and naming items while grocery shopping, counting the number of stops while riding the bus or train, and asking open-ended questions after reading a story.
"It is so important for young children to be exposed to enriching environments because these support the healthy development of their brains, and brain building provides children with a solid foundation for learning and future academic success," said Early Education and Care Commissioner Tom Weber. "Our family and community engagement networks are important partners in communicating and teaching about brain building, especially ways that parents can be brain builders at home or anywhere."
"Over 13,000 families and almost 19,000 children have benefited from receiving Brain Building toolkits and other resources given out as part of this statewide campaign," said Michael K. Durkin, President at United Way of Massachusetts Bay and Merrimack Valley. "Together, we can do more than any one organization can alone. That's why it is so powerful when local communities come together to raise awareness of important issues like early childhood and help to ensure we build the strongest foundation for early learning among the children of our Commonwealth."
Joining United Way and the Department of Early Education and Care as sponsors of Brain Building in Progress Week are Boston Children's Museum, WGBH, Parent-Child Home Program, Massachusetts Head Start Association, Thrive in 5, Early Ed for All, Boston Alliance for Early Education, MassAEYC, and Mass. Department of Public Health.
Over 80 communities across Massachusetts are participating in Brain Building in Progress Week, with activities including:
In Lawrence, Mayor Dan Rivera is supporting the Greater Lawrence Community Action Council and Coordinated Family and Community Engagement (CFCE) by reading to young children, and issuing a challenge to Mayors and public officials across the state to join him in being "brain builders" in their communities.
Over 200 locations in Boston's 10 neighborhoods will be transformed into Brain Building Zones. The list, developed by the Boston Family Engagement Network, includes medical offices, museums, community centers, laundry facilities, food markets, and restaurants
Westwood Public Schools is holding "Kids at Play…Brains at Work," featuring a variety of parent education opportunities and family events, and hosting a "Books Build Brains" exhibit by area early education and care programs on display at the library.
The Early Childhood Alliance of Framingham Public Schools is hosting a "Passport to Learning!" Family Fair, where children and their families can visit learning zones with activities from fitness to science, technology, math and literacy.
A comprehensive list of Brain Building in Progress Week events can be found at brainbuildinginprogress.org, as well as a comprehensive list of "Brain Building Zones" and events that are easily searched by community throughout the year. EEC and United Way are also promoting Brain Building in Progress Week using #IamABrainBuilder on Twitter.
Brigid Boyd
Senior Vice President, Communications and Public Affairs
United Way of Massachusetts Bay and Merrimack Valley
9 Channel Center Street, Suite 500 | Boston, MA 02210
bboyd@supportunitedway.org


At dQ&A, everyone shares the same calling—to learn and reflect the true testimony of people living with diabetes. On this page, you can find out more about what makes us tick.
dQ&A is a social enterprise that's committed to making life better for people with diabetes.
We harness patient (and healthcare provider) voices to help answer key business questions, develop better products, services and policies, and improve health outcomes for people with diabetes. We are trusted by patients because of our independence and commitment to diabetes. And we are endorsed by industry leaders because we always deliver the truth they need.
Our team has a healthy obsession with diabetes, combined with decades of experience in quantitative and qualitative research. Many of our lives have been touched by diabetes, so we have a personal stake in our work.
dQ&A was founded in 2009 by Richard Wood and Kelly Close. Richard has years of consulting and market research experience, and previously worked as an executive at Nielsen. Kelly has type 1 diabetes. She is a tireless advocate for patients (she also founded diaTribe) and a leading expert on the diabetes industry.
Their vision was to amplify patient voices, using rigorous and cutting edge research techniques. Other companies treated diabetes like toothpaste, or diapers—just another research project. But they wanted to go much further—to develop a deep understanding of what life was like with diabetes, and speak up for patients so they could make a difference.
Richard and Kelly both believed in "patient power." They knew they needed to hear from a wide range of people to reflect the diversity of diabetes, so they focused on building a large community and learning from them. dQ&A (for diabetes Questions and Answers) was born.
Over the years, that community has grown to cover nine countries and many thousands of people. Our work guides companies, informs regulators, and inspires innovators. We're thrilled about the many recent strides in the field, and grateful to have been able to contribute to a number of products in development and on the market. But there's still a very long way to go.
Over the past ten years, we've built large, diverse, validated communities of people with diabetes (and their parents and caregivers), in North America and Europe. The size and depth of our communities means we can sample precise groups, while still having enough people for statistically meaningful research. Clients rely on us to reach difficult-to-recruit segments, such as early adopters of a new therapy, as well as very large cross-sections of the diabetes population.
We also have communities of endocrinologists, primary care physicians, and diabetes educators, who provide invaluable expertise and a different perspective on patients' experiences. All of our respondents have been thoroughly vetted, and because of the strong relationships we've developed with them, they go above and beyond to provide honest, thoughtful feedback. We send our thanks to everyone who participates in our work!
Because of our diabetes focus, we instinctively understand our clients' issues. No learning curve means that we can quickly design studies and provide insightful analysis and recommendations, saving you time and money. So what makes us experts?
Over the past ten years, we've talked to thousands and thousands of patients and have closely tracked the diabetes industry, medical field, and regulatory environment. Through lexicon studies, and hard-won experience, we know what language to use to avoid biasing or confusing respondents. And we've built a database of tested questions, which have been refined over time with feedback from patients, clients, and healthcare professionals.
Diabetes affects hundreds of millions of people and every sector of the economy, so our clients span many industries. We work with Fortune 500 pharmaceutical companies, global medical device companies, start-ups and fast-growing innovators in medical technology and drug development, tech companies, research organizations, non-profits, and food and consumer products companies.
We consult for a wide range of teams, from public affairs to marketing to R&D to executive leadership, and have also supported acquisition and investment decisions.
We love working with companies and organizations of all sizes and in all areas of the diabetes field. Supporting a wide range of stakeholders, from the smallest start-up to the largest pharmaceutical company, is important to us, because we want to help drive innovation and access, and to increase patient choice.
You can be sure that data security and privacy is built into every step of our research process. We are GDPR-compliant, experienced in pharmacovigilance and adverse event reporting, and comfortable working with legal and regulatory departments to ensure that our clients' needs are met.
dQ&A is proud to financially support 38 diabetes non-profits in 9 countries through our work.


The number of fires caused by fireplaces and their flues is low in the Helsinki City Rescue Department's area. A key factor in this low number is that the fireplaces are maintained well. The reasons for fires caused by fireplaces or flues are sparks from the fireplace, insufficient distance from flammable materials and, in some cases, defects in fireplaces and flues, over-heating and too much soot in the flue.
The owner and occupants of a building and business and industrial operators are obliged to ensure that chimney sweeping is carried out regularly. Chimney sweeping ensures that fireplaces and flues are safe to use. In addition to this, chimney sweeping reduces fuel consumption and promotes complete combustion, which in turn reduces emissions and unnecessary environmental loading. In connection with sweeping, chimney sweeps also provide guidance in personal and fire safety matters, as necessary. They can be asked for advice in matters related to combustion, fireplaces, ventilation and fire safety.
Please make sure that the roof of the building is safe for a chimney sweep to move about on. The owner and occupants of a building and business and industrial operators are responsible for making sure that ladders, parts of roof walkways and roof safety equipment are maintained to allow for chimney sweeping to be carried out safely.
The owner and occupants of a building and business and industrial operators can order chimney sweeping services from their preferred provider of chimney sweeping services, who employs chimney sweeps with vocational qualifications in chimney sweeping. Information on local chimney sweeps can be found in local newspapers and online, for example on the website of the Central Association of Chimney Sweeps. If the client feels that they have not received adequate information about the arrangement of chimney sweeping from the company that carried out chimney sweeping services, that the information received was incorrect, that the work has been invoiced incorrectly or unclearly, or that there are disputes related to the way the work was carried out, the client should contact the company that conducted the work in order to resolve the issue. If no agreement can be reached, the client should contact the Consumer Advisory Services. The telephone number for Consumer Advisory Services is 029 553 6901 or 029 553 6902 (Swedish). For more information, please visit the Consumer Advisory Services website.
The owner and occupants of a building and business and industrial operators are obliged to present a written certificate to verify that chimney sweeping work has been conducted to the rescue authorities upon request. The certificate must state the chimneys that were swept, the person who carried out the chimney sweeping, the date on which the work was carried out, measures conducted, faults and deficiencies observed, and any additional work conducted.
All fireplaces that are used need to be swept once a year (incl. fireplaces, baking ovens, sauna hearths and flues).
Fireplaces using solid fuels, light oil, multiple fuels or heavy oils, and their flues.
The fireplaces and flues of a holiday home and sauna intended for non-private, regular use.
The fireplaces and flues of a holiday home and sauna intended for private use.


text:
Organická chemie je vědním oborem chemie, který se zabývá strukturou, vlastnostmi, přípravou, reakcemi a využitím organických sloučenin, které obsahují uhlík v kovalentní vazbě. Organická chemie se nezabývá jednoduchými sloučeninami uhlíku (například oxid uhelnatý CO, oxid uhličitý CO2, uhličitan vápenatý CaCO3), ty popisuje anorganická chemie.

Uhlík má mezi ostatními prvky unikátní postavení. Ve své valenční vrstvě má 4 elektrony a může vytvářet silné kovalentní vazby. Navíc se mohou uhlíkové atomy navzájem spojovat a tvořit dlouhé řetězce nebo kruhy. Uhlík jako jediný ze všech prvků dokáže tvořit jak jednoduché sloučeniny (například methan CH4, oxid uhelnatý CO, oxid uhličitý CO2), tak velmi složité (například bílkoviny nebo DNA s desítkami miliard atomů uhlíku).

Počet organických sloučenin je obrovský. Zahrnuje uhlovodíky (sloučeniny obsahující pouze uhlík a vodík) a také sloučeniny obsahující kromě uhlíku další prvky (například kyslík, dusík, síru, fosfor, halogeny). Chemická struktura a funkční skupiny organických sloučenin jsou základem pro rozmanitost organických molekul, které jsou obsaženy v rostlinách a živočiších (cukry, tuky, bílkoviny, nukleové kyseliny a další sloučeniny). Organické sloučeniny tak tvoří základ veškerého života na Zemi.

Organická chemie je v současnosti schopna syntetizovat některé organické přírodní látky (například cukry, peptidy, přírodní barviva, alkaloidy, vitamíny), ale i organické látky v přírodě se nevyskytující (například plasty, drogy, pesticidy, syntetická vlákna). Vývoj v organické chemii měl za posledních 150 let významný dopad na lidské zdraví, výživu, oblečení a rozmanitost spotřebního zboží.

Historie organické chemie

 Původně se tato věda zabývala studiem látek z oblasti živé přírody. Vznikla na přelomu 18. a 19. století jako samostatný vědní obor v souvislosti s rozdělením přírody na neživou (anorganickou) a živou (organickou).
 Významnou zásluhu na tom měl švédský chemik Carl Wilhelm Scheele, který izoloval organické látky z přírodních zdrojů (například kyselinu vinnou a citronovou).
 Lomonosov a Lavoisier při studiu procesu hoření prokázali, že základ všech sloučenin živočišného a rostlinného původu je uhlík a vodík.
 Dlouhou dobu vládla vitalistická teorie založena zejména Berzeliem, který žil na přelomu osmnáctého století. Podle ní všechny látky vznikají v organismech působením živé síly (vitalis).
 Tuto teorii popřel Friedrich Wöhler, když v roce 1828 zahříváním anorganické sloučeniny (kyanatan amonný) připravil sloučeninu organickou (močovinu).
 Proto byla definice organické chemie zpřesněna a platí dodnes. Říká, že je to chemie zabývající se sloučeninami uhlíku kromě oxidu uhelnatého, oxidu uhličitého, kyseliny uhličité, kyanovodíku, kyseliny kyanovodíkové, kyseliny kyanaté, kyseliny thiokyanaté, kyanidů, kyanatanů, thiokyanatanů, uhličitanů a karbidů.
 Prudký rozmach organické chemie nastal ve druhé polovině 19. století, kdy bylo objeveno mnoho organických sloučenin. Především díky schopnosti atomů uhlíku tvořit různě dlouhé a rozvětvené řetězce je tento počet velmi vysoký.
 V dnešní době platí názor, že chemie je jen jedna. Stejné principy a zákonitosti, které objasňují chování nejjednodušších anorganických sloučenin platí i pro nejsložitější organické sloučeniny. Nicméně dělení na anorganickou a organickou chemii, které vzniklo historickým vývojem, se ukazuje z hlediska studia chemie jako velmi praktické.

Strukturní teorie
Na strukturní teorii, která popisuje základní pravidla stavby organických sloučenin, se podíleli Butlerov, Kekulé a Couper. Základní pravidla jsou tato:

 Atomy uhlíku mají ve vnější elektronové slupce čtyři valenční elektrony.
 Každý atom uhlíku je čtyřvazný, neboť jeho čtyři valenční elektrony mají snahu vytvořit čtyři kovalentní vazby s valenčními elektrony jiných atomů.
 Atomy uhlíku se mohou mezi sebou vázat vazbou jednoduchou, dvojnou nebo trojnou.
 Všechny vazby jsou navzájem rovnocenné.
 Vazebné elektronové páry kovalentní vazby jsou znázorňovány čárkou mezi chemickými značkami atomů, například C–C.
 Uhlíkové řetězce mohou být lineární, větvené nebo cyklické. Mohou být spojeny neuhlíkovými vazebnými elektrony s vodíkem a dalšími prvky (zejména kyslíkem, dusíkem, sírou, fosforem). Tak se mohou vytvářet velké až velmi velké molekuly (polymery, makromolekuly). Existuje také mnoho izomerů organických sloučenin, což jsou sloučeniny se stejným celkovým složením (molekulární vzorec), ale odlišnou strukturou (strukturní vzorec).

Základní dělení organických sloučenin

Alifatické uhlovodíky
Alifatické uhlovodíky se dělí do tří skupin podle stavu nasycení:

 alkany (parafiny) - pouze jednoduché vazby C-C, C-H
 alkeny (olefiny) - obsahují jednu nebo více dvojných vazeb
 alkyny (acetyleny) - obsahují jednu nebo více trojných vazeb

Aromatické uhlovodíky
Aromatické uhlovodíky jsou cyklické uhlovodíky, které obsahují konjugované dvojné vazby. Jednou z nejznámějších aromatických sloučenin je benzen, protože je jednou z nejjednodušších a nejstabilnějších aromatických látek.

Funkční skupiny

Organické sloučeniny jsou klasifikovány také podle funkčních skupin (například alkoholy, karboxylové kyseliny, aminy a další). Reaktivita funkční skupiny je v různých molekulách téměř stejná a má rozhodující vliv na chemické a fyzikální vlastnosti organických sloučenin. Většina funkčních skupin obsahuje atomy jiné než uhlík C a vodík H.

Heterocyklické uhlovodíky

Heterocyklické uhlovodíky obsahují i jiné atomy (heteroatomy) než uhlík C a vodík H. Mohou existovat buď jako substituenty připojené externě ke kruhu (exocyklické), nebo jako člen samotného kruhu (endocyklické). Heteroatom heterocyklických molekul je nejčastěji kyslík, síra nebo dusík, přičemž dusík je obzvláště běžný v biochemických systémech. Heterocykly převládají v mnoha biochemických sloučeninách, jako jsou například  alkaloidy, vitamíny, steroidy a nukleové kyseliny (DNA, RNA).

Polymery
Polymery jsou makromolekuly vytvořené spojením mnoha molekul jednoho nebo více druhů atomů. Nejčastěji jsou tvořeny právě uhlíkovými řetězci. Proces spojování se nazývá polymerace, zatímco řetězce nebo sítě se nazývají polymery. Zdrojová sloučenina se nazývá monomer.

Existují dvě hlavní skupiny polymerů, syntetické polymery a biopolymery. Syntetické polymery jsou uměle vyráběny a jsou běžně označovány jako průmyslové polymery. Biopolymery se vytvářejí a vyskytují v živých organismech.

Zdroje organických látek
Ze všech sloučenin, které existují na Zemi, je pouze 4 % anorganických sloučenin a naopak 96 % organických sloučenin. Dá se říct, že zdroje organických sloučenin jsou prakticky nevyčerpatelné. Jejich výrobu můžeme rozdělit podle zdrojů:

 z anorganických sloučenin
 z organických sloučenin:
 fosilní (minulé) zdroje – ropa, uhlí, zemní plyn, rašelina, dřevo
 recentní (současné) zdroje – rostlinné a živočišné organismy

Význam organických sloučenin
Téměř v každém zbožích naší každodenní potřeby jsou přítomny organické látky:

 Potraviny
 Léčiva
 Plasty
 Syntetická vlákna
 Čisticí prostředky od jednoduchých mýdel až po složité povrchově aktivní látky pro speciální aplikace
 Barviva v knihách, časopisech a dalších tiskovinách
 Fosilní paliva - uhlí, ropa, zemní plyn, dřevo

Reference

Literatura

Externí odkazy

  IUPAC Blue Book "Nomenclature of Organic Chemistry", Version 2, IUPAC, 1. duben 2022 – aktuální verze názvosloví organické chemie

redpajama_set_name: RedPajamaWikipedia