text:
using System;
using Sdl.Community.GroupShareKit.Clients;

namespace Sdl.Community.GroupShareKit.Helpers
{
    public static class ApiUrls
    {
        public static readonly Uri CurrentProjectServerUrl = new Uri("api/projectserver/v2", UriKind.Relative);
        public static readonly Uri CurrentProjectServerV3Url = new Uri("api/projectserver/v3", UriKind.Relative);
        public static readonly Uri CurrentProjectServerV4Url = new Uri("api/projectserver/v4", UriKind.Relative);
        public static readonly Uri CurrentManagementUrl = new Uri("api/management/v2", UriKind.Relative);
        public static readonly Uri CurrentAuthenticationUrl = new Uri("authentication/api/1.0", UriKind.Relative);
        public static readonly Uri CurrentTranslationMemoriesUrl = new Uri("api/tmservice", UriKind.Relative);
        public static readonly Uri CurrentFieldServiceUrl = new Uri("api/fieldservice", UriKind.Relative);
        public static readonly Uri CurrentMultitermUrl = new Uri("multiterm/api/1.0", UriKind.Relative);
        public static readonly Uri CurrentLanguageResourceServiceUrl = new Uri("api/language-resource-service", UriKind.Relative);
        public static readonly Uri TranslateAndAnalysisServiceUrl = new Uri("ta/api", UriKind.Relative);
        public static readonly Uri ReportingServiceUrl = new Uri("api/reports", UriKind.Relative);
        public static readonly Uri LogServiceUri = new Uri("api/log", UriKind.Relative);

        public static Uri Modules()
        {
            return "{0}/modules".FormatUri(CurrentManagementUrl);
        }
        /// <summary>
        /// Returns the <see cref="Uri"/> that returns a single user for the user name
        /// </summary>
        public static Uri Login()
        {
            return "{0}/login".FormatUri(CurrentAuthenticationUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that returns a single user for the user name
        /// </summary>
        public static Uri User()
        {
            return "{0}/users".FormatUri(CurrentManagementUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that returns a single user for the user id
        /// </summary>
        public static Uri User(string userId)
        {
            return "{0}/users/{1}".
                FormatUri(CurrentManagementUrl,userId);
        }

        /// <summary>
        ///  Returns the <see cref="Uri"/> that returns all roles
        /// </summary>
        public static Uri Roles()
        {
            return "{0}/roles".
                FormatUri(CurrentManagementUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that returns a single role
        /// </summary>
        public static Uri Role(string roleId)
        {

            return "{0}/roles/{1}".
                FormatUri(CurrentManagementUrl, roleId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that returns a membership
        /// </summary>
        public static Uri RoleMembership()
        {
            return "{0}/roles/membership".FormatUri(CurrentManagementUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that returns a single organization
        /// </summary>
        public static Uri Organization(string organizationId)
        {
            return "{0}/organizations/{1}".
                FormatUri(CurrentManagementUrl, organizationId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that a list of organizations
        /// </summary>
        public static Uri Organizations()
        {
            return "{0}/organizations".
                FormatUri(CurrentManagementUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> based on the organization tag
        /// </summary>
        public static Uri GetOrganizationsByTag(string tag)
        {
            return "{0}/organizations?tag={1}".
                FormatUri(CurrentManagementUrl, tag);
        }

        /// <summary>
        ///  Returns the <see cref="Uri"/> that gets all organization resources
        /// </summary>
        /// <param name="organizationId">Organization Id</param>
        public static Uri OrganizationResources(string organizationId)
        {
            return "{0}/organizationresources/{1}".
                FormatUri(CurrentManagementUrl,organizationId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that moves a resource to a organization
        /// </summary>
        public static Uri MoveOrganizationsResources()
        {
            return "{0}/organizationresources".
                FormatUri(CurrentManagementUrl);
        }

        /// <summary>
        /// Returs the <see cref="Uri" /> that gets all projects
        /// </summary>
        public static Uri GetAllProjects()
        {
            return "{0}/projects".
                FormatUri(CurrentProjectServerUrl);
        }

        public static Uri GetPerfectMatchFiles(string projectId, int matchOrderIndex)
        {
            return "{0}/projects/{1}/files/upload/perfectmatch/{2}?relativePath="
                .FormatUri(CurrentProjectServerV4Url, projectId, matchOrderIndex);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that returns all permissions
        /// </summary>
        public static Uri Permissions()
        {
            return "{0}/permissions".
                FormatUri(CurrentManagementUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that returns all permissions for users
        /// </summary>
        public static Uri PermissionUsers()
        {
            return "{0}/permissions/user".
                FormatUri(CurrentManagementUrl);
        }
        /// <summary>
        /// Returns the <see cref="Uri"/> that represents the project
        /// </summary>
        public static Uri Project(string projectId)
        {
            return "{0}/projects/{1}".
                FormatUri(CurrentProjectServerUrl, projectId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that represents publishing status of a server project.
        /// </summary>
        public static Uri PublishingStatus(string projectId)
        {
            return "{0}/projects/{1}/publishingstatus".
                FormatUri(CurrentProjectServerUrl, projectId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that represents downloaded files with the specific languageCodeid and type
        /// </summary>
        public static Uri DownloadFile(string projectId, string type)
        {
            return "{0}/projects/{1}/download/{2}".
                FormatUri(CurrentProjectServerUrl, projectId, type);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that represents downloaded files with the specific languageCode ids
        /// </summary>
        public static Uri DownloadFiles(string projectId,string languageFileIdsQuery)
        {
            return "{0}/projects/{1}/download/?{2}archive=true".
                FormatUri(CurrentProjectServerUrl, projectId,languageFileIdsQuery);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that represents downloaded native files
        /// </summary>
        public static Uri DownloadNative(string projectId)
        {
            return "{0}/projects/{1}/download/targetnativefiles".
                FormatUri(CurrentProjectServerUrl, projectId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that represents the finalization of a project
        /// </summary>
        public static Uri Finalize(string projectId, string languageFileIdsQuery)
        {
            return "{0}/projects/{1}/finalize/?{2}".
                FormatUri(CurrentProjectServerUrl, projectId, languageFileIdsQuery);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that  publish project package associated with the specified organziation
        /// </summary>
        public static Uri PublishProjectPackage(string projectId)
        {
            return "{0}/projects/{1}/publishpackage".
                FormatUri(CurrentProjectServerUrl,projectId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that returns all files associated with the specified project
        /// </summary>
        /// <param name="projectId">The project id</param>
        public static Uri ProjectFiles(string projectId)
        {
            return "{0}/projects/{1}/files".
                FormatUri(CurrentProjectServerUrl, projectId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that returns all project templates
        /// </summary>
        public static Uri ProjectTemplates()
        {
            return "{0}/projects/templates".
                FormatUri(CurrentProjectServerUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that returns a template
        /// </summary>
        /// <param name="templateId">The template id</param>
        public static Uri ProjectTemplates(string templateId)
        {
            return "{0}/projects/templates/{1}".
                FormatUri(CurrentProjectServerUrl,templateId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that returns all project templates
        /// </summary>
        public static Uri ProjectTemplatesV3()
        {
            return "{0}/projects/templates".
                FormatUri(CurrentProjectServerV3Url);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that returns all phases associated with the specified project
        /// </summary>
        /// <param name="projectId">The project id</param>
        public static Uri ProjectPhases(string projectId)
        {
            return "{0}/phases/{1}".
                FormatUri(CurrentProjectServerUrl, projectId);
        }

        /// <summary>
        /// Returns the <see cref="Uri" />that gets a list of files for the requested project with all the project phases and theirs assignees
        /// </summary>
        /// <param name="projectId">Project id</param>
        /// <param name="phaseId">Phase id</param>
        public static Uri ProjectPhasesWithAssignees(string projectId,int phaseId)
        {
            return "{0}/projects/{1}/phaseswithassignees/{2}".
                FormatUri(CurrentProjectServerUrl, projectId,phaseId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that change the project phases
        /// </summary>
        /// <param name="projectId">The project id</param>
          public static Uri ChangePhases(string projectId)
        {
            return "{0}/projects/{1}/changephase".
               FormatUri(CurrentProjectServerUrl, projectId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that change the project phases
        /// </summary>
        /// <param name="projectId">The project id</param>
        public static Uri ChangeAssignments(string projectId)
        {
            return "{0}/projects/{1}/changeassignment".
               FormatUri(CurrentProjectServerUrl, projectId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that gets  file versions informations
        /// </summary>
        /// <param name="languageFileId">Language file id</param>
        public static Uri GetFileVersion(string languageFileId)
        {
            return "{0}/projects/fileversions/{1}".
                FormatUri(CurrentProjectServerUrl, languageFileId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> to download the file for a specified version
        /// </summary>
        /// <param name="projectId">The project id</param>
        /// <param name="languageFileId"> Language file id</param>
        /// <param name="version"> File version</param>
        public static Uri DownloadFileForVersion(string projectId, string languageFileId, int version)
        {
            return "{0}/projects/{1}/fileversions/download/{2}/{3}".
                FormatUri(CurrentProjectServerUrl, projectId, languageFileId, version);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> for license informations
        /// </summary>
        public static Uri GetLicenseInformations()
        {
            return "{0}/license".FormatUri(CurrentManagementUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that gets user assignments
        /// </summary>
        public static Uri GetProjectsAssignments()
        {
            return "{0}/projects/userassignments".FormatUri(CurrentProjectServerUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> thet gets a list of assignements for a project
        /// </summary>
        /// <param name="projectId">Project Id</param>
        /// <param name="fileIdQuery"></param>
        public static Uri GetProjectAssignmentById(string projectId, string fileIdQuery)
        {
            return "{0}/projects/{1}/assignment?{2}"
                .FormatUri(CurrentProjectServerUrl, projectId, fileIdQuery);
        }
        /// <summary>
        /// Returns the <see cref="Uri"/> that adds the template
        /// </summary>
        /// <param name="templateId">Template id</param>
        public static Uri UploadProjectTemplate(string templateId)
        {
            return "{0}/projects/templates/{1}/upload".FormatUri(CurrentProjectServerUrl, templateId);
        }

        /// <summary>
        ///  Returns the <see cref="Uri"/> that adds files for project
        /// </summary>
        /// <param name="projectId">Project id</param>
        public static Uri UploadFilesForProject(string projectId)
        {
            return "{0}/projects/{1}/files/upload".FormatUri(CurrentProjectServerUrl, projectId);
        }

        /// <summary>
        ///  Returns the uri string that adds files for project
        /// </summary>
        /// <param name="projectId">Project id</param>
        /// <param name="isReferenceFile">The flag to indicate if the files to upload are rerference files</param>
        /// <param name="createProjectAfterUpload">The flag to indicate if the project should be started creating after the upload immediately</param>
        public static string UploadFilesForProject(string projectId, bool isReferenceFile, bool createProjectAfterUpload)
        {
            // use string instead of Uri is to avoid the format errors. In some case we might append the path for this uri.
            return string.Format("{0}/projects/{1}/files/upload?&reference={2}&create={3}&relativePath=",
                CurrentProjectServerUrl, projectId, isReferenceFile, createProjectAfterUpload);
        }

        /// <summary>
        ///  Returns the <see cref="Uri"/> that starts the project creation
        /// </summary>
        /// <param name="projectId"></param>
        /// <returns></returns>
        public static Uri StartProjectCreationUri(string projectId)
        {
            return "{0}/projects/{1}/create".FormatUri(CurrentProjectServerUrl, projectId);
        }
        /// <summary>
        /// Returns the <see cref="Uri"/> that changes the project status
        /// </summary>
        /// <param name="projectId">Project id</param>
        /// <param name="status">Status</param>
        public static Uri ChangeProjectStatus(string projectId, string status)
        {
            return "{0}/projects/{1}/changestatus/{2}".FormatUri(CurrentProjectServerUrl,projectId, status);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that changes the project status
        /// </summary>
        /// <param name="statusRequest">Status request</param>
        public static Uri ChangeProjectStatus(ChangeStatusRequest statusRequest)
        {
            var status = Enum.GetName(typeof (ChangeStatusRequest.ProjectStatus), statusRequest.Status);
            return "{0}/projects/{1}/detach?status={2}".FormatUri(CurrentProjectServerUrl, statusRequest.ProjectId,status);
        }

        /// <summary>
        ///  Returns the <see cref="Uri"/> that deletes detach to a project status
        /// </summary>
        /// <param name="projectId">Project id</param>
        /// <param name="deleteTms">True/False if the tms should be deleted</param>
        public static Uri ProjectStatusDeleteDetach(string projectId, bool deleteTms)
        {
            return "{0}/projects/{1}/detach/{2}".FormatUri(CurrentProjectServerUrl, projectId, deleteTms);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that links resource to a organization
        /// </summary>
        public static Uri LinkResourceToOrganization()
        {
            return "{0}/resourcelink ".FormatUri(CurrentManagementUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that gets a list of users in a certain role
        /// </summary>
        /// <param name="roleId">The role id</param>
        public static Uri GetUsersForRole(string roleId)
        {
            return "{0}/roles/{1}/membership".FormatUri(CurrentManagementUrl, roleId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that removes  users from a certain role
        /// </summary>
        /// <param name="roleId">The role id</param>
        public static Uri DeleteUserFromRole(string roleId)
        {
            return "{0}/roles/{1}/users".FormatUri(CurrentManagementUrl, roleId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that gives a list of tms
        /// </summary>
        public static Uri GetTms()
        {
            return "{0}/tms".FormatUri(CurrentTranslationMemoriesUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that gives specified tm.
        /// </summary>
        public static Uri GetTmById(string tmId)
        {
            return "{0}/tms/{1}".FormatUri(CurrentTranslationMemoriesUrl,tmId);
        }
        /// <summary>
        /// Returns the <see cref="Uri"/> that gives the language direction information for a specified tm
        /// </summary>
        /// <param name="tmId"></param>
        /// <param name="languageDirectionId"></param>
        public static Uri GetLanguageDirectionForTm(string tmId, string languageDirectionId)
        {
            return "{0}/tms/{1}/language-directions/{2}".FormatUri(CurrentTranslationMemoriesUrl, tmId,languageDirectionId);
        }

        /// <summary>
        ///  Returns the <see cref="Uri"/> that gives the tms for resource language template id
        /// </summary>
        /// <param name="resourceTemplateId">resource te,plate id</param>
        public static Uri GetTmsNumberByLanguageResourceTemplateId(string resourceTemplateId)
        {
            return "{0}/tms/by-language-resource-template/{1}/count".FormatUri(CurrentTranslationMemoriesUrl, resourceTemplateId);
        }
        /// <summary>
        ///  Returns the <see cref="Uri"/> that gives the tms for field template id
        /// </summary>
        /// <param name="fieldTemplateId"> field template id</param>
        public static Uri GetTmsNumberByFieldTemplateId(string fieldTemplateId)
        {
            return "{0}/tms/by-field-template/{1}/count".FormatUri(CurrentTranslationMemoriesUrl, fieldTemplateId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that gives a list of termbases
        /// </summary>
        public static Uri GetTermbases()
        {
            return "{0}/termbases".FormatUri(CurrentMultitermUrl);
        }
        /// <summary>
        /// Returns the <see cref="Uri"/> that gives specified tm
        /// </summary>
        public static Uri GetTermbaseById(string termbaseId)
        {
            return "{0}/termbases/{1}".FormatUri(CurrentMultitermUrl,termbaseId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that returns field templates
        /// </summary>
        public static Uri FieldTemplate()
        {
            return "{0}/templates".FormatUri(CurrentFieldServiceUrl);
        }
        /// <summary>
        /// Returns the <see cref="Uri"/> that returns specific  field template
        /// </summary>
        public static Uri GetFieldTemplateById(string id)
        {
            return "{0}/templates/{1}".FormatUri(CurrentFieldServiceUrl,id);
        }
        /// <summary>
        /// Returns the <see cref="Uri"/> that returns the health status of tm service
        /// </summary>
        public static Uri Health()
        {
            return "{0}/health".FormatUri(CurrentTranslationMemoriesUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that returns the info of tm service
        /// </summary>
        public static Uri GetTmServiceInfo()
        {
            return "{0}/info".FormatUri(CurrentTranslationMemoriesUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that gets filters from the specified termbase
        /// </summary>
        public static Uri GetFilers(string termbaseId)
        {
            return "{0}/termbases/{1}/filters".FormatUri(CurrentMultitermUrl, termbaseId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that search for terms in termbase
        /// </summary>
        public static Uri Search()
        {
            return "{0}/termbases/search".FormatUri(CurrentMultitermUrl);
        }
        /// <summary>
        /// Returns the <see cref="Uri"/> that gets a concept
        /// </summary>
        public static Uri GetConcepts(ConceptResponse response)
        {
            return "{0}/termbases/{1}/concepts?conceptId={2}".FormatUri(CurrentMultitermUrl,response.TermbaseId,response.ConceptId);
        }
        /// <summary>
        /// Returns the <see cref="Uri"/> that gets a concept
        /// </summary>
        public static Uri GetConcepts(string termbaseId )
        {
            return "{0}/termbases/{1}/concepts".FormatUri(CurrentMultitermUrl, termbaseId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that gets a concept
        /// </summary>
        public static Uri GetConcepts(string termbaseId, string conceptId)
        {
            return "{0}/termbases/{1}/concepts/{2}".FormatUri(CurrentMultitermUrl, termbaseId, conceptId);
        }
        /// <summary>
        /// Returns the <see cref="Uri"/> that gets all language resource templates
        /// </summary>
        public static Uri LanguageResourceServiceTemplates()
        {
            return "{0}/templates".FormatUri(CurrentLanguageResourceServiceUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> for specified  language resource template
        /// </summary>
        public static Uri GetLanguageResourceTemplateById(string templateId)
        {
            return "{0}/templates/{1}".FormatUri(CurrentLanguageResourceServiceUrl, templateId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that gives a list of language resource for specified templateId
        /// </summary>
        public static Uri LanguageResource(string templateId)
        {
            return "{0}/templates/{1}/resources".FormatUri(CurrentLanguageResourceServiceUrl, templateId);
        }
        /// <summary>
        /// Returns the <see cref="Uri"/> that gives default type for a language
        /// </summary>
        public static Uri GetDefaults(string type, string language)
        {
            return "{0}/defaults/{1}/{2}".FormatUri(CurrentLanguageResourceServiceUrl, type, language);
        }
        /// <summary>
        /// Returns the <see cref="Uri"/> that language resources for specified template and resource.
        /// </summary>
        public static Uri LanguageResourcesForTemplate(string templateId, string languageResourceId)
        {
            return "{0}/templates/{1}/resources/{2}".FormatUri(CurrentLanguageResourceServiceUrl, templateId,
                languageResourceId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> for the following language resource actions:reset, import or export .
        /// </summary>
        public static Uri LanguageResourceActions(string templateId, string languageResourceId, string action)
        {
            return "{0}/templates/{1}/resources/{2}/{3}".FormatUri(CurrentLanguageResourceServiceUrl, templateId,
                languageResourceId, action);
        }
        /// <summary>
        /// Returns the <see cref="Uri"/> that gets a list of Fields for a specific Template ID.
        /// </summary>
        public static Uri GetFields(string templateId)
        {
            return "{0}/templates/{1}/fields".FormatUri(CurrentFieldServiceUrl, templateId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that gets a specified Field for a specific Field Template ID.
        /// </summary>
        public static Uri GetField(string fieldTemplateId, string fieldId)
        {
            return "{0}/templates/{1}/fields/{2}".FormatUri(CurrentFieldServiceUrl, fieldTemplateId, fieldId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that adds a new translation unit to the translation memory
        /// </summary>
        public static Uri TranslationUnits( string tmId,string action)
        {
            return "{0}/tms/{1}/tus/{2}".FormatUri(CurrentTranslationMemoriesUrl, tmId, action);
        }
        /// <summary>
        /// Returns the <see cref="Uri"/> that retrieves the translation units from the Translation memory
        /// </summary>
        public static Uri Tus(string tmId)
        {
            return "{0}/tms/{1}/tus".FormatUri(CurrentTranslationMemoriesUrl,tmId);
        }
        /// <summary>
        /// Returns the <see cref="Uri"/> that retrieves the number of translation units from the Translation memory
        /// </summary>
        public static Uri TusCount(string tmId)
        {
            return "{0}/tms/{1}/tus/count".FormatUri(CurrentTranslationMemoriesUrl, tmId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that retrieves the number of translation units from the Translation memory
        /// </summary>
        public static Uri TusByType(string tmId,string type)
        {
            return "{0}/tms/{1}/tus/{2}/count".FormatUri(CurrentTranslationMemoriesUrl, tmId,type);
        }
        /// <summary>
        /// Returns the <see cref="Uri"/> that retrieves the Duplicate Translation Units in a specific TM
        /// </summary>
        public static Uri TranslationUnitsDuplicates(string tmId, string source, string target)
        {
            return "{0}/tms/{1}/tus/duplicate/source={2}&target={3}".FormatUri(CurrentTranslationMemoriesUrl, tmId,
                source, target);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that retrieves  a list of all available database servers
        /// </summary>
        public static Uri DbServers()
        {
            return "{0}/dbservers".FormatUri(CurrentTranslationMemoriesUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that retrieves  specified database server
        /// </summary>
        public static Uri DbServers(string serverId)
        {
            return "{0}/dbservers/{1}".FormatUri(CurrentTranslationMemoriesUrl,serverId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that schedules a recompute statistics operation
        /// </summary>
        public static Uri Fuzzy(string tmId, string action)
        {
            return "{0}/tms/{1}/fuzzyindex/{2}".FormatUri(CurrentTranslationMemoriesUrl, tmId, action);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that exports TUs from a Translation Memory
        /// </summary>
        public static Uri Export(string tmId, string source, string target)
        {
            return "{0}/tms/{1}/export?source={2}&target={3}".FormatUri(CurrentTranslationMemoriesUrl, tmId,source,target);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that imports TUs into a Translation Memory
        /// </summary>
        public static Uri Import(string tmId, string source, string target)
        {
            return "{0}/tms/{1}/import?source={2}&target={3}".FormatUri(CurrentTranslationMemoriesUrl, tmId, source, target);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that returns a list of all available containers
        /// </summary>
        public static Uri Containers()
        {
            return "{0}/containers".FormatUri(CurrentTranslationMemoriesUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that a specified container
        /// </summary>
        public static Uri Containers(string containerid)
        {
            return "{0}/containers/{1}".FormatUri(CurrentTranslationMemoriesUrl,containerid);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that returns the analysis report for a project
        /// </summary>
        public static Uri AnalysisReports(string projectId,string languageCode)
        {
            return "{0}/projects/{1}/analysisreports/{2}".FormatUri(CurrentProjectServerUrl, projectId, languageCode);
        }

		/// <summary>
		/// Returns the <see cref="Uri"/> that returns the progest settings for a language file
		/// </summary>
		public static Uri GetProjectSettings(string projectId, string languageFileId)
	    {
		    return "{0}/projects/{1}/files/{2}/settings".FormatUri(CurrentProjectServerUrl, projectId,languageFileId);
	    }

	    /// <summary>
	    /// Returns the <see cref="Uri"/> that checks in a file edited in the Online Editor
	    /// </summary>
	    public static Uri OnlineCheckIn(string projectId, string languageFileId)
	    {
		    return "{0}/projects/{1}/files/{2}/onlinecheckin".FormatUri(CurrentProjectServerUrl, projectId, languageFileId);
	    }

		/// <summary>
		/// Returns the <see cref="Uri"/> that Undoes an online checkout
		/// </summary>
		public static Uri UndoCheckout(string projectId, string languageFileId)
	    {
		    return "{0}/projects/{1}/files/{2}/undoCheckout".FormatUri(CurrentProjectServerUrl, projectId, languageFileId);
		}

		/// <summary>
		/// Returns the <see cref="Uri"/> for health check call used to keep the OE license seat taken
		/// </summary>
		public static Uri OnlineCheckoutHealthCheck(string editorProfileMode)
	    {
			return "{0}/onlinecheckout/{1}".FormatUri(CurrentProjectServerUrl, editorProfileMode);
		}

		/// <summary>
		/// Returns the <see cref="Uri"/> rthat checks if the given language file is check-out to someone other than the user making this call
		/// </summary>
		public static Uri IsCheckoutToSomeoneElse(string languageFileId, string editorProfileMode)
	    {
			return "{0}/onlinecheckout/isCheckOutToSomeoneElse/{1}/{2}".FormatUri(CurrentProjectServerUrl, languageFileId, editorProfileMode);
		}

	    /// <summary>
	    /// Returns the <see cref="Uri"/> that checks out a file for editing in the Universal Editor
	    /// </summary>
		public static Uri OnlineCheckout(string projectId, string languageFileId)
	    {
		    return "{0}/projects/{1}/files/{2}/onlinecheckout".FormatUri(CurrentProjectServerUrl, projectId, languageFileId);
		}

	    /// <summary>
	    /// Returns the <see cref="Uri"/> that checks out a file for editing
	    /// </summary>
	    public static Uri ExternalCheckout(string projectId, string languageFileId)
	    {
		    return "{0}/projects/{1}/files/{2}/externalcheckout".FormatUri(CurrentProjectServerUrl, projectId, languageFileId);
	    }

	    /// <summary>
	    /// Returns the <see cref="Uri"/> that checks in a file for editing
	    /// </summary>
	    public static Uri ExternalCheckin(string projectId, string languageFileId)
	    {
		    return "{0}/projects/{1}/files/{2}/externalcheckin".FormatUri(CurrentProjectServerUrl, projectId, languageFileId);
	    }

	    /// <summary>
	    /// Returns the <see cref="Uri"/> that returns dashboard data
	    /// </summary>
	    public static Uri Dashboard()
	    {
		    return "{0}/dashboard".FormatUri(CurrentProjectServerUrl);
	    }

        /// <summary>
        /// Returns the <see cref="Uri"/> for dashboard projects per month
        /// </summary>
        /// <returns></returns>
        public static Uri DashboardProjectsPerMonth()
        {
            return "{0}/dashboard/projectsPerMonth".FormatUri(CurrentProjectServerUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> for dashboard top language pairs
        /// </summary>
        /// <param name="noOfTopLanguagePairs"></param>
        /// <returns></returns>
        public static Uri DashboardTopLanguagePairs(int? noOfTopLanguagePairs = null)
        {
            return "{0}/dashboard/topLanguagePairs/{1}".FormatUri(CurrentProjectServerUrl, noOfTopLanguagePairs);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> for dashboard words per month
        /// </summary>
        /// <returns></returns>
        public static Uri DashboardWordsPerMonth()
        {
            return "{0}/dashboard/wordsPerMonth".FormatUri(CurrentProjectServerUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> for dashboard words per month
        /// </summary>
        /// <returns></returns>
        public static Uri DashboardWordsPerOrganization()
        {
            return "{0}/dashboard/wordsPerOrganization".FormatUri(CurrentProjectServerUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> for dashboard statistics
        /// </summary>
        /// <returns></returns>
        public static Uri DashboardStatistics()
        {
            return "{0}/dashboard/statistics".FormatUri(CurrentProjectServerUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that retries the audit trail for all the language files in the given project
        /// </summary>
        public static Uri AuditTrial(string projectId)
	    {
		    return "{0}/auditTrail/languageFiles/{1}".FormatUri(CurrentProjectServerUrl, projectId);
	    }
		/// <summary>
		/// Returns the <see cref="Uri"/> that checks if the user can open the file in universal editor
		/// </summary>
		public static Uri IsAuthorizedToOpenInEditor(string projectId, string languageFileId)
	    {
			return "{0}/projects/{1}/files/{2}/isauthorized".FormatUri(CurrentProjectServerUrl, projectId, languageFileId);
		}

		/// <summary>
		/// Returns the <see cref="Uri"/> that returns the permissions in editor for the user
		/// </summary>
		public static Uri EditorProfile(string projectId, string languageFileId)
	    {
		    return "{0}/projects/{1}/files/{2}/editorprofile".FormatUri(CurrentProjectServerUrl, projectId, languageFileId);
	    }

		/// <summary>
		/// Returns the <see cref="Uri"/> that returns the output of a background task
		/// </summary>
		public static Uri TaskOutput(string taskId)
        {
            return "{0}/tasks/{1}/output".FormatUri(CurrentTranslationMemoriesUrl, taskId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that returns a background task by id
        /// </summary>
        public static Uri GetTaskById(string taskId)
        {
            return "{0}/tasks/{1}".FormatUri(CurrentTranslationMemoriesUrl, taskId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that returns all files statistics associated with the specified project
        /// </summary>
        /// <param name="projectId">The project id</param>
        public static Uri ProjectFileStatistics(string projectId)
        {
            return "{0}/projects/{1}/files/detailed-information".FormatUri(CurrentProjectServerUrl, projectId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that returns all language statistics associated with the specified project
        /// </summary>
        /// <param name="projectId">The project id</param>
        public static Uri ProjectLanguageStatistics(string projectId)
        {
            return "{0}/projects/{1}/languages".FormatUri(CurrentProjectServerUrl, projectId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that performs a concordance search
        /// </summary>
        /// <param name="tmId">The project id</param>
        public static Uri ConcordanceSearch(string tmId)
        {
            return "{0}/tms/{1}/search/concordance".FormatUri(CurrentTranslationMemoriesUrl, tmId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> that initiate a new translate and analysis job
        /// </summary>
        public static Uri InitiateTranslateAndAnalysisJob()
        {
            return "{0}/job".FormatUri(TranslateAndAnalysisServiceUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> translatable document identifier
        /// </summary>
        public static Uri TranslationJob(string jobId)
        {
            return "{0}/translation/{1}".FormatUri(TranslateAndAnalysisServiceUrl, jobId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> translatable document status
        /// </summary>
        public static Uri TranslationJobStatus(string translationJob)
        {
            return "{0}/translation/status/{1}".FormatUri(TranslateAndAnalysisServiceUrl, translationJob);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> translatable document
        /// </summary>
        public static Uri DownloadTranslationDocument(string translationJob)
        {
            return "{0}/translation/download/{1}".FormatUri(TranslateAndAnalysisServiceUrl, translationJob);
        }

        /// <summary>
        ///  Returns the <see cref="Uri"/> analysis document identifier
        /// </summary>
        public static Uri AnalysisJob(string jobId)
        {
            return "{0}/analysis/{1}".FormatUri(TranslateAndAnalysisServiceUrl, jobId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> translatable document analysis status
        /// </summary>
        public static Uri AnalysisJobStatus(string analysisJob)
        {
            return "{0}/analysis/status/{1}".FormatUri(TranslateAndAnalysisServiceUrl, analysisJob);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> translatable document analysis statistics
        /// </summary>
        public static Uri AnalysisStatistics(string analysisJob)
        {
            return "{0}/analysis/{1}".FormatUri(TranslateAndAnalysisServiceUrl, analysisJob);
        }

        /// <summary>
        /// Deletes the job for translate and analysis
        /// </summary>
        public static Uri DeleteJob(string jobId)
        {
            return "{0}/job/{1}".FormatUri(TranslateAndAnalysisServiceUrl, jobId);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> for projects report data
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        public static Uri GetProjectPredefinedReportData(string options)
        {
            return "{0}/projectPredefinedReports?filter={1}".FormatUri(CurrentProjectServerUrl, options);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> for tasks Report report data
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        public static Uri GetTasksReportData(string options)
        {
            return "{0}/tasksReport?filter={1}".FormatUri(CurrentProjectServerUrl, options);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> for TM Leverage report data
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        public static Uri GetTmLeverageData(string options)
        {
            return "{0}/tmLeverageReport?filter={1}".FormatUri(CurrentProjectServerUrl, options);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> for predefined projects report data
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        public static Uri GetPredefinedProjectsData()
        {

            return "{0}/predefined/projects".FormatUri(ReportingServiceUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> for predefined tasks report data
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        public static Uri GetPredefinedTasksData()
        {
            return "{0}/predefined/tasks".FormatUri(ReportingServiceUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> for predefined tmleverage report data
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        public static Uri GetPredefinedTmLeverageData()
        {
            return "{0}/predefined/tmleverage".FormatUri(ReportingServiceUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> for dashboard Deliveries Due Soon report data
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        public static Uri GetDeliveriesDueSoonData()
        {
            return "{0}/dashboard/DeliveriesDueSoon".FormatUri(ReportingServiceUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> for dashboard Your Tasks report data
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        public static Uri GetYourTasksData()
        {
            return "{0}/dashboard/YourTasks".FormatUri(ReportingServiceUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> for dashboard Projects Per Month report data
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        public static Uri GetProjectsPerMonthData()
        {
            return "{0}/dashboard/ProjectsPerMonth".FormatUri(ReportingServiceUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> for dashboard Words Per Month report data
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        public static Uri GetWordsPerMonthData()
        {
            return "{0}/dashboard/WordsPerMonth".FormatUri(ReportingServiceUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> for dashboard Words Per Organization report data
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        public static Uri GetWordsPerOrganizationData()
        {
            return "{0}/dashboard/WordsPerOrganization".FormatUri(ReportingServiceUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> for dashboard Top Language Pairs report data
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        public static Uri GetTopLanguagePairsData()
        {
            return "{0}/dashboard/TopLanguagePairs".FormatUri(ReportingServiceUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> for password complexity rules
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        public static Uri GetPasswordComplexityRules()
        {
            return "{0}/passwordcomplexityrules".FormatUri(CurrentManagementUrl);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> for GroupShare logs data
        /// </summary>
        /// <returns></returns>
        public static Uri GetLogs()
        {
            return "{0}".FormatUri(LogServiceUri);
        }

        /// <summary>
        /// Returns the <see cref="Uri"/> for GroupShare logs data
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        public static Uri GetLogsFilterd(string options)
        {
            return "{0}?filter={1}".FormatUri(LogServiceUri, options);
        }
    }
}


text:
Q: Why the running time of a mapper should be more than 1 minute? I have read from many blogs/web pages that state

the running time of a mapper should be more than X minutes

I understand there are overheads involved in setting up a mapper but how exactly is this calculated? Why is it after X minutes the overhead then is justified? And when we talk about overheads, what are the Hadoop overheads?

A: Its not a hard code rule but makes sense. At the background so many small process are handled out before a mapper is started. Its initialization,other stuffs apart from the real processing would itself take 10-15 seconds. So to reduce the number of split which in turn would reduce the mapper count, maxsplitsize could be set to some higher value that is what that blog conveys. If we fail to do that. Below are the overheads the MR framework has to handle while creating a mapper.

*

*Calculating splits for that mapper.

*The job scheduler in jobtracker has to create a separarte map task this would increase the latency a bit.

*When it comes to assignment the jobtracker will have to look for a tasktracker based on its data locality. This will again involving creating local temp directories in the tasktracker which would be used up by the setup and cleanup task for that mapper, for example in the setup the if we are reading from a distributed cache and putting that intop a hashmap or initializing and cleaning up something in the mapper.And if already there are enough map and reduce tasks running in that tasktracker this would put a overhead on the tasktracker.

*In worst case the number of fixed map task is full, then the JT will have to look for a different TT which would lead to a remote read.

*Also TT would only send the heartbeat to JT once in 3 seconds this would cause a delay in the job initialization because the TT would have to contact the JT to run a job as well as sending the completed status.

*Unfortunately if your mapper fails then that task would be run 3 times before it finally fails.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Array.prototype.filter not returning RegExp results Probably missing something simple here, but still scratching my head about why my list of found items is always returning empty.
const words = ['apps', 'apples', 'bands', 'bannanas', 'cards', 'cantaloupes'];
const str = 'app';
const re = new RegExp(str, 'gi');

function partial(element) {
  console.log('partial', element, re.test(element))
  return re.test(element)
}

const found = words.filter(partial);

console.log(found);  // []?

In this example, if you look at the logs of partial, you see the two words 'apps' and 'apples' returning true, so AFAIK, the result in found should be ['apps', 'apples'], right?
Here's a fiddle too.


text:
Optimization of the recycle used oil and its fuel quality characterization
Eyitayo A. AFOLABI*, Abdulsalam S. KOVO, Olalekan, D ADENIYI, Abdulsalam JIBRIN, Ambali S. ABDULKARREM, Bilyaminu SULEIMAM
Department of Chemical Engineering, School of Engineering and Engineering Technology,
Federal University of Technology, PMB 65, Gidan Kwano, Minna, Nigeria
* Corresponding author: elizamos2001@yahoo.com
The optimization of recycling of used engine oil with clay sample has been studied using Response Surface Methodology. Acid concentration, activation temperature and time were the independent variables considered in optimizing the recycling of used oil and six responses evaluated. The surface characterization of the clay samples was performed using the Fourier Transform Infrared (FTIR) spectra and Brunauer Emmett Teller (BET) analyses. The relationship between independent variables and response was described by a second order polynomial equation. Statistical testing of the model was performed with F-test to obtain the correlation between the experimental data and predicted results for all responses. The adequacy of the model equations were evaluated by the Adjusted and Predicted R2 coefficients observed to be close to each other for all the six responses. Data obtained from recycling used oil using clay sample showed the optimum condition as; activation temperature of 106.80oC, acid concentration of 3M and activation time of 180 minutes. A yield of 66.28% was obtained at optimum condition and characterized fuel qualities found close to fresh oil used as standard in this work. The surface area and adsorption capacity of raw clay and activated clay samples was observed to have increase from 19.8m2/g to 437.83m2/g and 1.41 mg/g to 8.64 mg/g respectively. This difference adequately described the improvement of the adsorption phenomena of the activated clay over raw clay samples.
Optimization; Clay samples; Used engine oil; Recycling; Response Surface Method (RSM)
Motor oil is used for lubricating various internal combustion engines to reduce friction, protect against wear and tear and helps in distribution of heat. During normal use, many impurities such as soot, water, acids, dirt, metal scrapings, and chemicals can get mixed in the oil, and becomes ineffective for further application [1,2]. The current disposal practice of just dumping used oils in drains, rivers and lagoons poses serious environmental and health hazards. Thus, it is imperative to find more environmentally sustainable ways to dispose used lubricating oils through recycling. Recycling of the waste lubricating oil is now regarded as the most viable option to address the environmental dangers posed by the indiscriminate waste engine oil disposal. In addition, recycling is also considered as an effective means of conserving the depleting world crude reserve and job creation through the construction and operation of recycling plants [3,4]. Several methods of recycling waste lubricating oil have evolved over time from the period which recycling of waste oil began during the late 1930s. These methods include; acid method, distillation/clay method, acid/clay method, activated charcoal/clay method among others. Since the inception of waste lube oil recycling, clay has been one of the most important and widely used adsorbent materials for the renewal of the oil [5]. The clay/acid method was the earliest method employed in recycling used engine oil and observed to have high adsorption capacity to remove most of the metallic buildup in the spent engine oil [6].
The improved property achieved through acid modification of clays is now generating a renewed interest by researchers in recycling waste engine oil [4, 6]. Recycling of waste lubricating oil ensure reduction of the environmental menace posed by the indiscriminate waste lube oil disposal. In addition, it serves as the most reliable mean of regenerating the useful hydrocarbon which can be further processed and re-use. The aim of this study was to investigate the fuel quality of used lube oil recycled through the clay samples activated under varying conditions of time, concentration and temperature using the Response Surface Methodology. Further objectives include determination of the optimum conditions necessary for activation of clay samples; recycling of used oil with activated clay samples; calculation of the adsorption capacity of the treated clay; characterization of recycled lube oil samples and comparison with standard lubricating oil obtained in the market.
The clay used in this work was collected from a clay deposit, Ahoko near Lokoja, Kogi State. The used oil was a Total Quartz 5000 20W-50, collected from a local mechanic workshop, Minna, Nigeria. The glass wares used in this work were provided by the Chemical Engineering Department Laboratory of Federal University of Technology, Minna.
A Central Composite Design (CCD) of Response Surface Methodology (RSM) was used to design the optimization of treated clay in the recycling of used engine oil. In this study, independent variables considered are activation temperature, activation time and acid concentration. Based on CCD for five-levels with three variables as shown in Tables 1 and 2, a total of 19 experimental runs comprise of 8 factorial points, 6 axial points and 5 central points were carried out [7]. The optimum values from the 3×3 factorial design work carried out by Yahaya [8] was used as a basis for the optimization at Zero level in this work
Table 1. Independent variables and natural levels used for central composite design
Coded factor level
Activation temperature
Acid concentration
Activation time
Clay preparation
The untreated clay sample was grounded and mixed with distilled water to form a solution. Impurities such as sand, stone and other particles are allowed to settle at the bottom of the cylinder and then separated by decanting off the clay particles. The slurry was kept in an oven to dry up. The dried clay was thereafter grounded and sieved into very fine particle size using 75 µm mesh size sieve.
Clay activation
One hundred (100) grams of raw clay sample was weighed using a digital weighing balance into a double neck round bottom flask and 250 ml of 2.5 mol/dm3 H2SO4 solution added. A reflux condenser was connected to the flask at one neck and a thermometer inserted at the other neck of the flask. The bottom and top openings of the condenser were connected to a source of running cold water and a sink respectively. The setup was clamped firmly to the magnetic stirrer operating at 800 rpm, temperature of 80oC for 165 minutes. The same procedure was repeated in order to generate the remaining 18 experimental runs as shown in Table 2.
Purification process of the used engine oil
The spent engine oil was purified using the treated clay samples. The percolation method of treatment as described by Grim [9] was employed in the purification of the oil. The spent oil was preheated for about 10 minutes to lower it viscosity and increase it penetration power. 30 g of the treated clay samples, each were packed in a plug flow funnel (funnel inserted with a filter paper). Then after, 80 ml of the preheated spent oil was measured and poured over the clay bed in the funnel and allowed to filter through the bed into a conical flask.
Characterization of clay samples
The surface area of the raw and activated clay samples were determined experimentally using the Quantachrome Nova 5200, Brunauer – Emmett –Teller (BET) surface analyzer. The moisture content and bulk density of the clay were determined according to the procedure discussed by Dada et al [10]. Fourier Transform Infrared (FTIR) spectra analysis of the raw and activated clay samples was done according to ASTM model FTIR 84005 methods in order to have better insight into the functional groups available on the surface of the clay samples [11].
Characterization of oil
The fresh, used and recycled oil samples were analyzed using Atomic absorption spectrophotometer for iron content. The flash point, specific gravity, viscosity and cloud point of the oil samples were determined according to the ASTM D97 procedure as discussed by Udonne [6]. Yield, a very important factor that reflects the effectiveness of the optimization was calculated according to Equation 1.
Experimental optimization
A statistical program package, Design Expert 7.0.0, was used for regression analysis of the data obtained and to estimate the coefficients of the regression equation. The equations were validated by the statistical tests called the analysis of variance (ANOVA).
Adsorption capacity of clay
The adsorption capacity of the treated clay was calculated according to Equation 2 (Al-Khatib et al. [12]);
where q1= adsorption capacity of the raw clay; q2= adsorption capacity of the activated clay (mg metal/g of the adsorbent); v= total volume of oil used (mL); Ci= Initial concentration of the metal in the oil (mg/L); Cf= final concentration of the metal in the oil (mg/L); m= amount of Activated clay (g)
The characterization results for treated used lube oil with activated clay and statistical analysis of the responses from RSM are showed in Tables 2 to 4. Table 5 showed the BET analysis of the raw clay and clay samples activated at optimum condition. Table 6 summarizes the fuel qualities of fresh lube oil, used oil and treated used oil at optimum condition. The comparison of the experiment data with predicted results for responses is illustrated by Figure 1. Figures 2 and 3 are FT IR analysis of raw and activated clay samples.
Table 2. Characterization results of treated used oil
Point type
Temp (oC)
Conc. (M)
Time (Minute)
Viscosity (mm2/s)
Flash point (oC)
Cloud point (oC)
Iron content (ppm)
Table 3. Analysis of variance (ANOVA) on velocity
Source squares
Sum of squares
Prob. >F
<0.0001
A-Temperature
B-Conc.
C-Time
Lack of Fit
Pure Error
Cor. Total
Statistical analysis of the model
The relationship between the independent variables and response (Viscosity) is described by a second order polynomial equation given as:
Viscosity=19.22-0.56*A-0.098*B-1.13*C-0.31*A*B-0.44*A*C-0.31*B*C-0.076*A2+0.1*B2-0.25*C2
The statistical significance of the model equation was performed with F-Test ANOVA, and the result obtained shown in Table 3. The F-value of 19.23 with P-value less than 0.0001 indicates that the model equation is significant and able to predict viscosity as a response by 99.99 % accuracy. For a model term in design expert analysis to be considered significant, the P- value must be less than 0.05 [5]. As shown in Table 4, model terms A, C, AB, AC, BC, C2 were found significant and B, A2 and B2 insignificant.
The model terms A, B, C, AB, AC, BC, A2 and C2 are terms with negative coefficient, thereby exhibiting an inverse proportionality on the viscosity response. The fit of the model was evaluated by the coefficient of R2 calculated to be 0.9506, thereby indicating that 95.06 % of the variability in the response (viscosity) could be explained by the model. The "Lack of Fit F-value" of 2.82 implies that the Lack of Fit is not significant relative to the pure error (which is a desirable condition). This signifies that there is a minimal difference between the predicted values generated by the model equation and the experimental data. Figure 1(a) showed that a linear relationship exist between the actual and predicted values, thereby indicating that the model equation adequately predict the viscosity within the limit of experimental condition investigated. The same pattern was observed in Figure 1 (b-f) for the comparison between experimental data and predicted results for flash point, iron content, yield, cloud point and specific gravity responses respectively.
Table 4. R2 statistics for the regression models
Adjusted R2
Predicted R2
Adequate precision
Cloud point
Iron content
A rule of thumb suggested by Bas and Boyaci [13] is that, the adjusted and predicted R2 should be close to unity and their difference not more than 0.3. As shown in Table 4, the close relationship between the R2 of 0.901 and predicted R2 of 0.7 revealed the goodness of the model for viscosity and thereby makes the model for predicting viscosity as a response valid.
Among the 19 experiments, 4 experiments were repetition of the central point (Run 16-19). These are the experiments in which all the factors are in the centric point of values. The closeness of the responses of these 4 experiments is an evidence that the predicted results is accurate on comparison with the experimental data. Experimental run 10 was found to be the best run as it has the optimum yield of 66.28% with the flash point, cloud point, specific gravity, viscosity and iron content of the used oil is in a close agreement with that of fresh oil on comparison with other experimental runs. Therefore, conditions at which experimental run 10 was carried out is henceforth referred to as optimum conditions.
Figure 1. Plot of actual experimental value and predicted value on (a) Viscosity (b) Flash point (c) Iron Content (d) Yield (e) Cloud point (f) Specific gravity
Physico-chemical analysis of the clay samples
The physic-chemical properties of the raw, activated and spent clay samples such as moisture content, bulk density and BET surface area are given in Table 5.
Table 5. Physico-chemical parameters of the clay samples
Raw Clay sample
Activated clay: optimum condition
Spent clay
Moisture content (%)
Surface area (m2/g)
Bulk density (g/ml)
There is an increase in the BET pore surface area for raw and activated clay samples from 19.8 m2/g to 437.83 m2/g respectively. This is expected as acid activation of clay sample is an effective method in the creation of more surface area for adsorption process. This is in agreement with the work of Jabit [14], Singh et al. [15] and Al-Sultani and Al-Seroury [16]. They all observed that, the adsorptive capacity of an adsorbent depends on its surface area (i.e. the greater the surface area the higher the material's sorption capacity). However, there is a decrease in the BET pore surface area from 437.83 to 127.09 m2/g for the activated and spent clay samples respectively. This reduction is as a result of more sites or pores created by activation that is now occupied by the contaminants after the adsorption process.
Fourier Transform Infrared (FTIR) analysis
FTIR technique is used mainly to identify functional groups such as carboxyl, hydroxyl, etc. that are capable of adsorbing contaminants. Figures 2 and 3 show FTIR spectra in the 419-3840 cm-1 wave number ranges for the raw and activated clay samples. A number of absorption peaks were displayed, reflecting the complex nature of clays with some peaks observed to have shifted or disappeared and new ones detected on comparison of the FTIR analysis of raw and activated clay samples.
These changes observed in the spectra of both clay samples confirmed that activation process modified the clay sample [17]. During activation of the clay sample, protons from the acid medium penetrate into the clay structures and attack the OH- groups thereby causing the alteration in the adsorptive bands attributed to the OH vibrations and octahedral cations. The increase in the severity of acid is shown by disappearance of the stretching bands at 857, 1482 and 2360 cm-1 assigned to H-O-H stretching. The peak at 1845, 3802 and 3886 still remained after acid treatment with slight increase in the intensities. The same result was reported by Chistidis et al. [11].
Figure 2. FTIR spectrum of unactivated clay
Figure 3. FTIR spectrum of activated clay
Adsorption capacity
The adsorption capacity of the raw and activated clay samples was calculated to be 1.41mg/g and 8.64mg/g respectively. This implies that at optimum conditions, adsorption capacity of clays sample used in this work increases by 436.7%.
Lube oil characterization
The main characteristics of fresh oil, used oil, raw clay treated oil and optimum activated clay treated oil are presented in Table 6.
Table 6. Characteristics of fresh oil, used oil, raw clay treated oil and optimum activated clay treated oil
Viscosity Cst
Fresh Oil
Oil treated with raw clay
Oil treated with activated clay at optimum conditions
Yield of 66.28% was obtained when used oil is treated with activated clay sample obtained at optimum conditions against 40 % obtained for raw clay sample. Thus, the treated clay sample is observed to have adsorbed more contaminants than the raw clay sample. This confirmed that more contaminants were removed from the used oil by treated clay sample at optimum conditions than the raw clay sample. This clearly demonstrates that more surface area was created at the optimum conditions and responsible for adsorption of more contaminant.
The Flash point of fresh oil is 120oC while that of used oil was determined to be 77oC. The drop in flash point is as a result of the dilution of the lubricant with unburned fuel during engine operations [18]. The flash point of treated used oil with raw and activated clay samples were determined to be 79.0oC and 105.10oC respectively. The increase in flash point of used oil treated with activated clay at optimum conditions is due to reduction of contaminants in the lubricating oil. The flash point obtained is observed to be much closed to the flash point of fresh oil.
The cloud points of fresh and used oil were observed to be 16.50oC and 10.0oC respectively. A decrease in cloud point reflects the presence of contaminants in the used lubricating oil [5,18]. However, treating the used lubricating oil with raw clay and activated clay sample at optimum conditions showed an increase in cloud points of recycled oil from 12.0oC to 14.86oC respectively. Similarly, cloud point of 14.86oC for used oil treated at optimum a condition was observed to be close to 16.50oC for the fresh oil. This clearly confirmed the activated clay sample at optimum conditions is effective for the purification of the used lubricating oil.
As shown in Table 6, the specific gravity of fresh lubricating oil is 0.871 while that of the used oil was found to be 0.904. Udonne [6] attributed the high specific gravity of the used oil to the presence of contaminants such as metals and degraded products. However, on treatment with raw clay and activated clay sample at optimum conditions, the specific gravity decreases to 0.896 and 0.881 respectively. The specific gravity of 0.881 for oil treated with activated clay sample was observed to be closer to 0.871 for that of the fresh oil. This showed the ability of the activated clay sample to regenerate the used lubrication oil.
The viscosities of fresh and used lubricating oil were measured to be 21.90 mm2/s and 15.2mm2/s respectively. Ajemba et al., [16] suggested that a decrease in viscosity of lubricating oil is as a result of dilution with light fuel and this is observed on comparison of the viscosity of fresh oil to that of the used oil. However, viscosities of oil treated with raw and activated clay were found to be 15.90 and 18.0 respectively. Thus, activated clay was able to adsorbed more contaminants from the used oil than raw clay. This confirmed that, activation of clay sample increased the adsorption capacity of the clay as the viscosity of the oil treated with activated clay is closer to that of the fresh oil.
The iron contents of the fresh oil and that of the used lubrication oil were found to be 0.01ppm and 3.54 ppm respectively. The increase in iron content of the used oil is due to the presence of metals which arises from the tear and wears in the engine chambers. The engine chamber is made of metals such as aluminum, iron and lead; and the wear of these metals is caused by corrosion and fuel dilution due to bad piston rings [19, 20]. However, treating the used lubricating oil with raw and activated clay samples shows that the treated oil contains 3.01 ppm and 0.30 ppm iron respectively. The reduction in iron content of the used oil when treated with activated clay sample confirmed the ability of clay sample at optimum conditions to remove more iron contaminants, which invariably shows adsorption capacity of the clay sample.
From the analysis of variance, the predicted and experimental values of the responses are almost the same and this signifies that the mathematical models are in agreement with the experimental data. The optimum conditions established in this work are activation temperature of 106.80oC, acid concentration of 3M and activation time of 180 minutes. The recycled oil obtained at the optimum conditions gave a yield of 66.28%, flash point of 105.10oC, cloud point of 14.86oC, specific gravity of 0.881, viscosity of 18.0Cst and iron content of 0.30 ppm. The Brunauer Emmett Teller (BET) surface area of activated clay obtained at optimum conditions was determined to be 437.83m2/g and found to be significantly larger than those of natural porous materials such as clay (10-100 m2g-1). The adsorption capacity of the raw and treated clay was determined to be 1.41 mg/g to 8.64 mg/g respectively and observed to adequately describe the improvement of the adsorption phenomena of the activated clay over raw clay samples.
1. Abu-Elella R., Ossman M. E., Farouq R., Abd-Elfatah M., Used Motor Oil Treatment: Turning Waste Oil into Valuable Products, International Journal of Chemical and Biochemical Sciences, 2015, 7(2015), p. 57-67.
2. Udonne J. D., Bakare O. A., Recycling of Used Lubricating Oil Using Three Samples of Acids and Clay as a Method of Treatment, International Archive of Applied Sciences and Technology, 2013, 4(2), p. 8-14.
3. Kojernikova Y. V., Rational ways of preparation of dispensed oil system, 1999, Unpublished Ph.D. Thesis submitted to Russian oil and Gas University, Moscow, pp. 133.
4. Usman M. A., Ekwueme V. I., Alaje T.O., Mohammed A.O., Characterization, Acid Activation and Bleaching Performance of Ibeshe Clay, ISRN Ceramics, 2012, Lagos, Nigeria, doi:10.5402/2012/658508.
5. Emman A. E., Abeer M. S., Re-refining of Used Lube Oil, II- by Solvent/Clay and Acid/Clay-Percolation Processes, ARPN Journal of Science and Technology, 2012, 4, p. 34-41.
6. Udonne J. D., A Comparative Study of Recycling of Used Lubrication Oils using Distillation, Acid and Activated Charcoal with Clay Methods, Journal of Petroleum and Gas Engineering, 2011, 2(2), p. 12-19.
7. Hanrahan G., Lu K., Application of Factorial and Response Surface Methodology in Modern Experimental Design and Optimization, Critical Reviews in Analytical Chemistry 2006, 36, p. 141-151.
8. Yahaya M, Application of Acid Treated Clay in the Recycling of Used Engine Oil. Unpublished Project Submitted to Chemical Engineering Department, 2014, Federal University of Technology Minna.
9. Grim R. E., The Bleaching Clay, 1962, New York; McGraw-Hill, pp. 67-88.
10. Dada A. O., Olalekan A. P., Olatunya A. M., Dada O. Langmuir, Freundlich,Temkin and Dubinin-Radushkevich Isotherms Studies of Equilibrium Sorption of Zn2+ onto Phosphoric Acid Modified Rice Husk, IOSR Journal of Applied Chemistry 2012, 3(1), p. 38-45.
11. Christidis G. E., Scott P. W., Dumham A. C. Acid activation and bleaching capacity of bentonites from the islands of Milos and Chios, Aegean and Greece, Applied Clay Science, 1997, 12, p. 329-347.
12. Al-Khatib L., Fraige F., Al-Hwaiti M., Al-Khashman O., Adsorption from Aqueous Solution onto Natural and Acid Activated Bentonite, American Journal of Environmental Science, 2012, 8(5), p. 510-522.
13. Bas D., Boyaci I. H., Modeling and Optimization I: Usability of Response Resurface Methodology, Journal of Food Engineering. 2007, 78, p. 836-845.
14. Jabit N. B., The Production and Characterization of Activated Carbon using Local Agricultural Waste through Chemical Activation Process, Unpublished M.Sc. Thesis submitted to the School of Material and Mineral Engineering, 2007, Malaysia. pp. 1-24.
15. Singh J., Uma A., Banerjee S., Gusain D, Sharma Y., Equilibrium Modelling and Thermodynamics of Removal of Orange G from its Aqueous Solution, Journal of Applied Sciences in Environmental Sanitation, 2011, 6(3), p. 317-326.
16. Al-Sultani K. F., Al-Seroury F. A., Characterization the Removal of Phenol from Aqueous Solution in Fluidized Bed Column by Rice Husk Adsorbent Residue, Journal of Recent Sciences, 2012, 1, p. 145-151.
17. Ajemba R. O., Enhancement of Physicochemical Properties of Nteje Clay to increase its Bleaching Performance using Acid Activation, International Journal of Engineering Research and Application, 2012, 2(4), p. 281-288.
18. Hamawand I., Yusaf T., Rafat S., Recycling of Waste Engine Oils Using a New Washing Agent, Energies, 2013, 6, p. 1023-1049.
19. Art J. Lubricating Oil through the Process of Refining Used Motor Oil, 2013. Available at: http://www.ArticleAlloy.com/article.
20. Hamad A., Al-Zubaidy E., Fayed M., Used Lubricating Oil Recycling UsingHydrocarbon Solvents, United Arab Emirate Journal of Environment Management, 2005, 74(2), p. 153-159.

redpajama_set_name: RedPajamaCommonCrawl


I realized that the most of my new bsp (>90%) is actually copied/tweaked from the other riscv and leon3 bsps. I don't think it is right to change the license since I am for the most part not the original author. I have maintained the original license headers in all files without adding myself as contributor. I suggest we keep it like that until the original authors agree to the BSD license ..?


text:
Tag: extrusion
Aluminum: The Shape of Things to Come
Aluminum apex of Washington Monument showing inscriptions on its east and north faces (source)
From planes and trains to the cellphone in your hand and the versatile roll of foil in your pantry, aluminum is omnipresent in today's fabricated world. Which should come as no surprise, considering it is the most abundant metal in Earth's crust. Yet, it is hard to imagine that aluminum was once prized more than gold! In fact, despite its abundance, aluminum was valued so highly in the 19th century because it was so difficult to obtain. It was so special, indeed, that in 1884 this rare "metal of kings" earned a prestigious perch atop the Washington monument in the shape of a cast pyramid.
Continue reading "Aluminum: The Shape of Things to Come"
Properties and Uses of CarboSix Carbon Fiber Profiles
Introducing CarboSix
The basis of CarboSix profiles is carbon fiber. Carbon fiber is composed of carbon atoms bonded together to form a long chain. The fibers are extremely stiff, strong, and light and are used in many processes to create excellent building materials.
As you can tell from the image above, our CarboSix modular carbon fiber profiles can be shaped and cut in much the same way our extruded aluminum T-slot profiles are. True, you can use CarboSix much like aluminum, and it has the same structural modularity. And from cutting to perforation, it can undergo the same processing. It even uses the same kind of accessories as aluminum, with identical installation and fastening systems.
But that doesn't mean aluminum and carbon fiber profiles are perfectly interchangeable. CarboSix is really best reserved for certain applications unsuitable for aluminum or steel, and that take advantage of the unique, specific properties of carbon fiber. Here are the most notable applications for CarboSix: Continue reading "Properties and Uses of CarboSix Carbon Fiber Profiles"


You are here: Home » German Scientists: "Only 'mysterious' government computer models show rises in sea levels.
German Scientists: "Only 'mysterious' government computer models show rises in sea levels.
German scientists show that constant alarmist messages about dramatic and dangerously rising sea levels cannot be confirmed by raw tidal measurements.
'Mysterious Case or Data Rigging?
The latest German research shows that sea level has risen naturally due to global warming by more than 50 meters in the past 10,000 years, says Behre. It has been nothing to do with humans.
The European Institute for Climate are also able to confirm there is no evidence that the floods are getting worse. We have measured the flood levels for 100 years, during which time the mean high water is up by 25cm which fits the natural rise in sea level. There is no evidence of more frequent floods." Continue reading here…. Original article (in German) here…..


text:
Ethiopia/Addis Abeba/Tourism/News/Africa
News: Addis Abeba city admin forms committee in an effort to spare old building from being demolished
addisstandard / August 13, 2018 / 5.1k
Known locally as "Ye Bego Adragot Hintsa," the building is a historic old building located near the National Theater in the heart of the city of Addis Abeba
Liyat Fekade
Addis Abeba, August 13/2018 – Addis Abeba city mayor's office formed a committee comprised of officials from the city's culture and tourism bureau, private individuals and officials from the Addis Abeba city administration to "inquire and explore ways of sparing" from being demolished, Addis Standard learned.
Last week a news bulletin by Sheger FM 102 reported the impending demolition of the building, known locally as "Ye Bego Adragot Hintsa." a historic old building located near the National Theater in the heart of the city of Addis Abeba, for private development projects. The news was met by a collective online objection mainly from residents of the city who expressed their concerns that the decision to demolish the building will deprive the city of one of its historical heritages.
Following the reactions, newly appointed mayor of the city, Takele Uma Banti, tweeted on Saturday: "we came short of promoting and marketing our city's beauty and old city's culture." However the mayor didn't provide further information. Following the tweet Addis Standard attempted to get more information and learned that "the mayor has formed the committee to look into all angles of arguments including legal options to see if the city administration could spare the demolition of the building,"according to one member of the committee who didn't want to be mentioned by name. "It is part of a new plan being developed by the city administration to preserve the city's historic landmarks to develop a sustainable tourism industry without affecting the residents of the city," he added.
We came short of promoting and marketing our city's beauty and old city's culture . Many cities have an old block and section to their beauty that attract tourism.
Addis , the melting pot , will soon start new branding tourist attraction activities. pic.twitter.com/egKtQztHF0
— Takele Uma Banti (@TakeleUma) August 11, 2018
The building was built in mid 1930s by then Italian occupying forces. It is believed that the building originally housed a mall and other administrative quarters in its early days. However, through time, the building also became home to about 60 residential households, according to Sheger FM. But beyond providing housing, it is also recognized as a meeting point to the young and old residents of the city who use the cafes, bars and restaurants inside the building as a meeting place to socialize and read newspapers. The residents of the building told Sheger FM that since the news of its demolition first surfaced five years ago following the privatization of the entire building to an individual, they have been living in limbo, unable to renew their houses. Addis Standard learned that the building was bought by a a private investor who also owns the near by Ethiopia Hotel, one of the oldest hotels in the city which was renovated recently.
Kirkos Kifle Ketema land management office, which has the woreda jurisdiction of the area, said the demolishing of the building was decided by the city's former cabinet and that wereda office was acting to enforce the decision by the former city cabinet.
Additional: Nebiyu Baye, newly appointed head of the #AddisAbeba city culture & tourism bureau, & members of the newly formed committee visited & discussed with business owners inside "Ye Bego Adragot Hintsa" as part of the effort to preserve the building. ?@Ethiopialiveupd pic.twitter.com/fHFuJjBa9Y
— Addis Standard (@addisstandard) August 13, 2018
On Friday August 10, the city council has approved list of its new cabinet members forwarded by the new mayor. AS
Pictorial: A doctor's visit to Shashamane Referral Hospital. The good and the bad
News: Security forces kill 37, wounded 44 in east Hararghe, Oromia region
Update: despite claims Oromo student protestors still in jail


text:
Q: Cancel a toast on Android before it appears My application displays a Toast when a certain action happens. If two of these actions happen in close proximity, however, I would like to forgo displaying the first Toast, instead displaying only the second one. I thought Toast.cancel() would do the trick, but what it does is simply hide the first toast; the second one only displays after the first one would have finished displaying anyway.
Example code:
Toast toast1 = Toast.makeText(parentActivity, "Test1", Toast.LENGTH_SHORT);
Toast toast2 = Toast.makeText(parentActivity, "Test2", Toast.LENGTH_SHORT);

toast1.show();
toast2.show();

toast1.cancel();

The second Toast shows up only after waiting a short while (the length of the short duration). This in fact happens even if I call toast2.cancel().

A: I'm not sure this would work, but maybe try cancelling both of them and then showing the second one again.

A: Toast.makeText(context, text, duration) returns a Toast object. Call cancel() method on this object to cancel it.
Example:
Toast mToastText = Toast.makeText(getApplicationContext(), "Hello StackOverFlow!", Toast.LENGTH_SHORT);
 mToastText.cancel();


St. John's Prep is an inclusive, Catholic, Xaverian Brothers Sponsored School for young men in grades 6 through 12. Founded on the Xaverian values of compassion, humility, simplicity, trust and zeal, we educate students to be, do and stand for good in the world. We enroll 1,500 students from more than 60 communities.
St. John's Prep seeks an English teacher for grades 9 through 12. The English Department offers a program that "engages students in the challenge to acquire the skills necessary for successful communication: reading, thinking, analyzing and writing. Through literature, writing assignments and class discussions, we seek to introduce students to the issues and ideas that will help them to explore their own identity and the nature of the world around them" (St. John's Prep website). A complete listing of English courses and their descriptions can be found at www.stjohnsprep.org/english.
English teachers at St. John's Preparatory School teach four (4) classes and are required to complete a "duty" period during each semester. Prospective candidates should have the competency and passion to engage every student in a rigorous college preparatory curriculum. Candidates should also have a desire to become an active and collegial member of an adult community of learners.
All members of the faculty are expected to give witness to the mission of St. John's, as well as to our identity as an inclusive, Catholic, Xaverian Brothers Sponsored School. In addition to classroom teaching responsibilities, St. John's encourages all members of the faculty to be involved in the life of the school beyond the classroom. The school offers a wide range of co-curricular, intramural and interscholastic programs.
For more information about our academic, spiritual and student life programs, please visit our website at www.stjohnsprep.org.
Interested candidates are asked to send a cover letter, résumé, and academic transcripts to Tracii Schaeublin, Director of Human Resources, at tschaeublin@stjohnsprep.org by Friday, May 3, 2019.
St. John's Preparatory School is conveniently located just 15 miles northeast of Boston in Danvers, Massachusetts. We are a Xaverian Brothers sponsored school educating nearly 1,500 young men in grades 6 through 12 from more than 70 communities throughout Massachusetts and New Hampshire. Our rigorous academic and extensive co-curricular program encourages students to develop their spiritual, intellectual, moral, physical, and creative potential, and inspires them to honor the diversity that enriches both our school community and the world beyond St. John's.


text:
Q: Manage Zend_Search_Lucene Index on a load balanced environment Each server in the cluster has a a search index that is synced from one of the servers every 15 minutes. This was done because appending to an index can't happen on a nfs because of flock; see documentation (or else the index would be on a shared folder that all servers access).
The issue that I'm running into is that if an action is taken that requires modifying of the index, the modifications happens on the local copy of the index and I need a way to sync those changes back to the parent in the least intrusive way as possible (so that the changes propagate to all servers in the cluster by the next sync).
I tried referencing the parent server index via http but this won't work because mkdir can't be done over http. Is there a way to reference the index of a remote server? If there is an entirely different approach available that will be considered as well

A: As I understand this situation, if one of the server's indexes undergoes modification you want the main index as the source of the rsynch to receive the update before the next rsync takes place - to update all servers with the update.
Instead of rsync-ing the main server index, why not rsync to take the latest modified date as the source for the rsync?  So if the latest update to index on server D is greater than the index on main server A, simply sync all the servers on the source of D
Did I understand your situation correctly?
Edit
Then in that case, edit the code that builds the index-es and add a line that checks to see if the previous build of the index was different, if so launch a exec call to a shell script or build the command manually to update the central sever.  This way the central server will receive updates on the fly and when the big sync goes down you will have your problem solved.

A: The best solution I can think of is to follow a more traditional Master / Slave replication pattern. Take some inspiration from RDBMS replication: All writes should go to the master.
Of course, you can't do this directly. As you've mentioned, you can't write directly to the remote index.
So, this leaves you with one option: Expose an API / Service on your master server that the slaves can use to indirectly update the index. Then, all changes will be synced back at your next scheduled push. I do realize this may be a significant change to your design, but in a replicated or distributed environment, this is often necessary.


Kudos to Google for committing to data-portability in its online applications: its new "Data Liberation Front" initiative makes it easier to take your data and move it back to your own computer, or a competing service.
We're a small team of Google Chicago engineers (named after a Monty Python skit about the Judean People's Front) that aims to make it easy for our users to transfer their personal data in and out of Google's services by building simple import and export functions. Our goal is to "liberate" data so that consumers and businesses using Google products always have a choice when it comes to the technology they use.


The world's premier nerd-culture comedy double-act, The Just Us League, present their smash hit show MARVELus: All the MARVEL Movies Kind Of.
Direct from two standing room only seasons at Edinburgh Fringe and a critically acclaimed, award-nominated tour of Australia, The Just Us League, are bringing their incredible MARVEL-based comedy show to venues across the UK in 2019.
Squeezing (almost) all the MARVEL movies into an action-packed evening of laughs, their short punchy sketches and high-energy style will delight the whole gamut of MARVEL fans; from those that have seen just one movie to mega-aficianados who know the franchise inside out. It's weapons-free comedy that takes no prisoners. Like your super-hero movies? You'll love this.


text:
Dianne Davidsons Birthday Bash feat. Larry Chaney, Leigh maples, Amy Frederick, Michael Mishaw, John Salem, Nancy Gardner, Vickie Carrico, Deidre McCalla & more!
Wed February 8, 2023 7:00 pm (Doors: 6:00 pm )
"Dianne and Friend's Birthday Bash"
Dianne Davidson and her cohort will be gathering on February 8th, 2023 to celebrate the passage of time. Dianne will be 70 years old.
From Memphis to New York, LA to San Francisco, and home to Tennessee, she's always come back to the music. Please join us in this celebration. More details to follow.
Friends, so far: Larry Chaney, Leigh maples, Amy Frederick, Michael Mishaw, John Salem, Nancy Gardner, Vickie Carrico, Deidre McCalla. More to come.


...says of us and Barrelhouse that "Of all the specialty presses and quirky lit mags, these two are top on the list of quality." See? Thanks, Robert Duffer!
What were you gesturing about? You always have one blurry arm. I'm sorry I missed the reading!
I was gesturing to the award-winning and be-sequinned Mary Hamilton. Come to the launch party on August 15th!