text:
module ActiveMerchant
  module Billing
    class PlugnpayGateway < Gateway
      class PlugnpayPostData < PostData
        # Fields that will be sent even if they are blank
        self.required_fields = [:publisher_name, :publisher_password,
                                :card_amount, :card_name, :card_number, :card_exp, :orderID]
      end
      self.live_url = self.test_url = 'https://pay1.plugnpay.com/payment/pnpremote.cgi'

      CARD_CODE_MESSAGES = {
        'M' => 'Card verification number matched',
        'N' => "Card verification number didn't match",
        'P' => 'Card verification number was not processed',
        'S' => 'Card verification number should be on card but was not indicated',
        'U' => 'Issuer was not certified for card verification'
      }

      CARD_CODE_ERRORS = %w(N S)

      AVS_MESSAGES = {
        'A' => 'Street address matches billing information, zip/postal code does not',
        'B' => 'Address information not provided for address verification check',
        'E' => 'Address verification service error',
        'G' => 'Non-U.S. card-issuing bank',
        'N' => 'Neither street address nor zip/postal match billing information',
        'P' => 'Address verification not applicable for this transaction',
        'R' => 'Payment gateway was unavailable or timed out',
        'S' => 'Address verification service not supported by issuer',
        'U' => 'Address information is unavailable',
        'W' => '9-digit zip/postal code matches billing information, street address does not',
        'X' => 'Street address and 9-digit zip/postal code matches billing information',
        'Y' => 'Street address and 5-digit zip/postal code matches billing information',
        'Z' => '5-digit zip/postal code matches billing information, street address does not',
      }

      AVS_ERRORS = %w(A E N R W Z)

      PAYMENT_GATEWAY_RESPONSES = {
        'P01' => 'AVS Mismatch Failure',
        'P02' => 'CVV2 Mismatch Failure',
        'P21' => 'Transaction may not be marked',
        'P30' => 'Test Tran. Bad Card',
        'P35' => 'Test Tran. Problem',
        'P40' => 'Username already exists',
        'P41' => 'Username is blank',
        'P50' => 'Fraud Screen Failure',
        'P51' => 'Missing PIN Code',
        'P52' => 'Invalid Bank Acct. No.',
        'P53' => 'Invalid Bank Routing No.',
        'P54' => 'Invalid/Missing Check No.',
        'P55' => 'Invalid Credit Card No.',
        'P56' => 'Invalid CVV2/CVC2 No.',
        'P57' => 'Expired. CC Exp. Date',
        'P58' => 'Missing Data',
        'P59' => 'Missing Email Address',
        'P60' => 'Zip Code does not match Billing State.',
        'P61' => 'Invalid Billing Zip Code',
        'P62' => 'Zip Code does not match Shipping State.',
        'P63' => 'Invalid Shipping Zip Code',
        'P64' => 'Invalid Credit Card CVV2/CVC2 Format.',
        'P65' => 'Maximum number of attempts has been exceeded.',
        'P66' => 'Credit Card number has been flagged and can not be used to access this service.',
        'P67' => 'IP Address is on Blocked List.',
        'P68' => 'Billing country does not match ipaddress country.',
        'P69' => 'US based ipaddresses are currently blocked.',
        'P70' => 'Credit Cards issued from this bank are currently not being accepted.',
        'P71' => 'Credit Cards issued from this bank are currently not being accepted.',
        'P72' => 'Daily volume exceeded.',
        'P73' => 'Too many transactions within allotted time.',
        'P91' => 'Missing/incorrect password',
        'P92' => 'Account not configured for mobil administration',
        'P93' => 'IP Not registered to username.',
        'P94' => 'Mode not permitted for this account.',
        'P95' => 'Currently Blank',
        'P96' => 'Currently Blank',
        'P97' => 'Processor not responding',
        'P98' => 'Missing merchant/publisher name',
        'P99' => 'Currently Blank'
      }

      TRANSACTIONS = {
        :authorization => 'auth',
        :purchase => 'auth',
        :capture => 'mark',
        :void => 'void',
        :refund => 'return',
        :credit => 'newreturn'
      }

      SUCCESS_CODES = ['pending', 'success']
      FAILURE_CODES = ['badcard', 'fraud']

      self.default_currency = 'USD'
      self.supported_countries = ['US']
      self.supported_cardtypes = [:visa, :master, :american_express, :discover]
      self.homepage_url = 'http://www.plugnpay.com/'
      self.display_name = "Plug'n Pay"

      def initialize(options = {})
        requires!(options, :login, :password)
        super
      end

      def purchase(money, creditcard, options = {})
        post = PlugnpayPostData.new

        add_amount(post, money, options)
        add_creditcard(post, creditcard)
        add_addresses(post, options)
        add_invoice_data(post, options)
        add_customer_data(post, options)

        post[:authtype] = 'authpostauth'
        commit(:authorization, post)
      end

      def authorize(money, creditcard, options = {})
        post = PlugnpayPostData.new

        add_amount(post, money, options)
        add_creditcard(post, creditcard)
        add_addresses(post, options)
        add_invoice_data(post, options)
        add_customer_data(post, options)

        post[:authtype] = 'authonly'
        commit(:authorization, post)
      end

      def capture(money, authorization, options = {})
        post = PlugnpayPostData.new

        post[:orderID] = authorization

        add_amount(post, money, options)
        add_customer_data(post, options)

        commit(:capture, post)
      end

      def void(authorization, options = {})
        post = PlugnpayPostData.new

        post[:orderID] = authorization
        post[:txn_type] = 'auth'

        commit(:void, post)
      end

      def credit(money, identification_or_creditcard, options = {})
        post = PlugnpayPostData.new
        add_amount(post, money, options)

        if identification_or_creditcard.is_a?(String)
          ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
          refund(money, identification_or_creditcard, options)
        else
          add_creditcard(post, identification_or_creditcard)
          add_addresses(post, options)
          add_customer_data(post, options)

          commit(:credit, post)
        end
      end

      def refund(money, reference, options = {})
        post = PlugnpayPostData.new
        add_amount(post, money, options)
        post[:orderID] = reference
        commit(:refund, post)
      end

      private

      def commit(action, post)
        response = parse(ssl_post(self.live_url, post_data(action, post)))
        success = SUCCESS_CODES.include?(response[:finalstatus])
        message = success ? 'Success' : message_from(response)

        Response.new(success, message, response,
          :test => test?,
          :authorization => response[:orderid],
          :avs_result => { :code => response[:avs_code] },
          :cvv_result => response[:cvvresp]
        )
      end

      def parse(body)
        body = CGI.unescape(body)
        results = {}
        body.split('&').collect { |e| e.split('=') }.each do |key, value|
          results[key.downcase.to_sym] = normalize(value.to_s.strip)
        end

        results.delete(:publisher_password)
        results[:avs_message] = AVS_MESSAGES[results[:avs_code]] if results[:avs_code]
        results[:card_code_message] = CARD_CODE_MESSAGES[results[:cvvresp]] if results[:cvvresp]

        results
      end

      def post_data(action, post)
        post[:mode]               = TRANSACTIONS[action]
        post[:convert]            = 'underscores'
        post[:app_level]          = 0
        post[:publisher_name]     = @options[:login]
        post[:publisher_password] = @options[:password]

        post.to_s
      end

      def add_creditcard(post, creditcard)
        post[:card_number]  = creditcard.number
        post[:card_cvv]     = creditcard.verification_value
        post[:card_exp]     = expdate(creditcard)
        post[:card_name]    = creditcard.name.slice(0..38)
      end

      def add_customer_data(post, options)
        post[:email] = options[:email]
        post[:dontsndmail] = 'yes' unless options[:send_email_confirmation]
        post[:ipaddress] = options[:ip]
      end

      def add_invoice_data(post, options)
        post[:shipping] = amount(options[:shipping]) unless options[:shipping].blank?
        post[:tax] = amount(options[:tax]) unless options[:tax].blank?
      end

      def add_addresses(post, options)
        if address = options[:billing_address] || options[:address]
          post[:card_address1] = address[:address1]
          post[:card_zip]      = address[:zip]
          post[:card_city]     = address[:city]
          post[:card_country]  = address[:country]
          post[:phone]         = address[:phone]

          case address[:country]
          when 'US', 'CA'
            post[:card_state] = address[:state]
          else
            post[:card_state] = 'ZZ'
            post[:card_prov]  = address[:state]
          end
        end

        if shipping_address = options[:shipping_address] || address
          post[:shipname] = shipping_address[:name]
          post[:address1] = shipping_address[:address1]
          post[:address2] = shipping_address[:address2]
          post[:city] = shipping_address[:city]

          case shipping_address[:country]
          when 'US', 'CA'
            post[:state] = shipping_address[:state]
          else
            post[:state] = 'ZZ'
            post[:province] = shipping_address[:state]
          end

          post[:country] = shipping_address[:country]
          post[:zip] = shipping_address[:zip]
        end
      end

      def add_amount(post, money, options)
        post[:card_amount] = amount(money)
        post[:currency] = options[:currency] || currency(money)
      end

      def message_from(results)
        PAYMENT_GATEWAY_RESPONSES[results[:resp_code]]
      end

      def expdate(creditcard)
        year  = sprintf('%.4i', creditcard.year)
        month = sprintf('%.2i', creditcard.month)

        "#{month}/#{year[-2..-1]}"
      end
    end
  end
end


text:
<?php
namespace Youkok\Rest\Endpoints\Admin\Files;

use Monolog\Logger;
use Psr\Container\ContainerInterface;
use Slim\Http\Request;
use Slim\Http\Response;

use Youkok\Biz\Exceptions\YoukokException;
use Youkok\Biz\Services\Admin\FileListingService;
use Youkok\Rest\Endpoints\BaseRestEndpoint;

class AdminFilesPendingEndpoint extends BaseRestEndpoint
{
    private FileListingService $fileListingService;
    private Logger $logger;

    public function __construct(ContainerInterface $container)
    {
        $this->fileListingService = $container->get(FileListingService::class);
        $this->logger = $container->get(Logger::class);
    }

    public function get(Request $request, Response $response): Response
    {
        try {
            return $this->outputJson($response, [
                'data' => $this->fileListingService->getPending()
            ]);
        } catch (YoukokException $ex) {
            $this->logger->error($ex);
            return $this->returnBadRequest($response, $ex);
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.smartdata.actions.hdfs;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.smartdata.actions.annotation.ActionSignature;

/**
 * An action to do all-ssd for a file.
 */
@ActionSignature(
  actionId = "allssd",
  displayName = "allssd",
  usage = HdfsAction.FILE_PATH + " $file "
)
public class AllSsdFileAction extends MoveFileAction {
  private static final Logger LOG = LoggerFactory.getLogger(AllSsdFileAction.class);

  @Override
  public String getStoragePolicy() {
    return "ALL_SSD";
  }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">

    <title>MindRaider - Personal Notebook and Outliner</title>

    <meta name="DC.title" content="MindRaider - Semantic Web Outliner"/>
    <meta name="DC.creator" content="Martin Dvorak"/>
    <meta name="DC.description" content="Outliner for the Semantic Web"/>

    <meta name="Author" content="Martin Dvorak"/>
    <meta name="Keywords" lang="en" content="outliner semantic web"/>
    <meta name="Description" lang="en" content="Outliner for the Semantic Web"/>
    <meta name="Robots" content="index,FOLLOW"/>
    <meta name="resource-type" content="document"/>
    <meta http-equiv="Cache-Control" content="Public"/>
    <meta http-equiv="Content-language" content="en"/>
    <meta http-equiv="Reply-to" content="mindraider@users.sourceforge.net"/>

    <link rel="alternate" type="application/rdf+xml" title="DC annotation" href="./rdf/dc-mindraider.rdf.xml"/>
    <link rel="alternate" type="application/atom+xml" title="MindRaider blog" href="http://e-mentality.blogspot.com/atom.xml"/>

    <link rel="meta" title="DOAP" href="./rdf/doap-mindraider.rdf" type="application/rdf+xml"/>

    <link rel="stylesheet" type="text/css" href="./css/stylesheet.css" title="Style"/>

        http://
            MindRaider
            .sourceforge.net

Site Menu

Know it

Introduction >

Screenshots >

Testimonials >

In The News >

License >

Changes >

About >

Download it

Windows >

Linux >

Java >

Learn it

Video Manual >

Presentations >

Coaching Notebook >

Semantic Web >

Drag & Drop >

URIQA >

TWiki >

Discuss it

Forums >

Blog >

Analyze it

Analysis >

Design >

Construction >

Links >

Build it

Maven >

Source Code >

Bugs >

Syndicate it

News >

Distributions >

TWiki

Table of Contents

Introduction

Mozex Installation & Configuration

Editing TWiki topics with MindRaider

Introduction

If you would like to:

edit and preview your TWiki topics off-line

quickly refactor TWiki topics

convert your topics to OPML

search local replicas of topics using Lucene powered fulltext search

then MindRaider is exactly what you are looking for.

Mozex Installation

MindRaider 2 TWiki integration is based on
Mozilla/Firefox plugin called Mozex. So we will start with Mozex installation...

Download Mozex from http://mozex.mozdev.org/

Configuring Mozex

If you are Mozilla user, configuration should be straightforward:

Simply choose Edit/Preferences/mozex from menu.

Then edit text areas editor to point to the MindRaider startup script like:

      C:\MyPrograms\mindraider.bat -t %t

    or if you are Linux hacker:

      /opt/soft/mindraider/bin/mindraider.sh -t %t

     Important:  Since there is some bug in Mozex, path to the editor cann't contain space
    (like C:\Program files\mindraider\bin\mindraider.bat).
    So if your MindRaider is installed in such directory, you may use auxiliary trigger like this - mindraider.bat and
    to store it e.g. in C:\MyPrograms\mindraider.bat.

Finally click OK

If you prefer surfing with Firefox, then configuration of the Mozex is a little bit tricky.
After the installation of Mozex (version 0.8), copy the following link to the location bar:
chrome://mozex/content/mozexPrefDialog.xul

This is work around used to acquire Mozex configuration dialog. Now you can edit text areas editor as described above for Mozilla browser.

Editing TWiki Topics with MindRaider

1) Be sure that MindRaider is running.

2) Access the TWiki topic you want to edit, choose edit and then click right mouse over the text area. Choose
mozex from the context menu and Edit Textarea:

3) TWiki topic will be imported to the MindRaider (note that TWiki icon in the Notebook outline Toolbar is enabled in this case). You may edit/preview/refactor topic and its sections. After you are finished, click the TWiki icon:

Topic will be exported back to the Mozex's temp directory. You must  click the text area  content to force its refresh. Save the topic and that's it!

MindRaider Next Generation

	  MindForger is thinking notebook and Markdown IDE.

	  Give it a try!

Personal Homepage: Martin Dvorak - EMail: MindRaider@users.sourceforge.net

            Member of the Mind&Cognition ring, powered by Linux & Eclipse & XEmacs.

            2018


text:
using OpenQA.Selenium;
using OpenQA.Selenium.Support.PageObjects;
using OpenQA.Selenium.Support.UI;
using SeleniumTestsRunner.TestRunnerInfrastructure.Runner;

namespace SeleniumTestsRunner.TestRunnerInfrastructure.PageObject
{
    /// <summary>
    ///     Represents a class for base page object.
    /// </summary>
    public abstract class BasePageObject
    {
        ///// <summary>
        ///// Initializes an instance of page object
        ///// </summary>
        //protected BasePageObject()
        //{
        //    PageFactory.InitElements(Driver, this);
        //}

        /// <summary>
        ///     Current selenium WebDriver instance.
        /// </summary>
        protected IWebDriver Driver => SeleniumRunner.Instance.Browser.Driver;

        /// <summary>
        ///     Current selenium WebDriverWait instance.
        /// </summary>
        protected WebDriverWait Wait => SeleniumRunner.Instance.Browser.Wait;

        protected IWebElement FindElementByXPath(string xPath)
        {
            Wait.Until(driver => driver.FindElement(By.XPath(xPath)).Displayed == true);
            return Driver.FindElement(By.XPath(xPath));
        }
    }
}


text:
#include "webrtc/voice_engine/test/win_test/WinTest.h"
#include "webrtc/voice_engine/test/win_test/WinTestDlg.h"
#include "webrtc/voice_engine/test/win_test/stdafx.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

// CWinTestApp

BEGIN_MESSAGE_MAP(CWinTestApp, CWinApp)
	ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
END_MESSAGE_MAP()

// CWinTestApp construction

CWinTestApp::CWinTestApp()
{
}

// The one and only CWinTestApp object

CWinTestApp theApp;

// CWinTestApp initialization

BOOL CWinTestApp::InitInstance()
{
	// InitCommonControlsEx() is required on Windows XP if an application
	// manifest specifies use of ComCtl32.dll version 6 or later to enable
	// visual styles.  Otherwise, any window creation will fail.
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// Set this to include all the common control classes you want to use
	// in your application.
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinApp::InitInstance();

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	// of your final executable, you should remove from the following
	// the specific initialization routines you do not need
	// Change the registry key under which our settings are stored
	SetRegistryKey(_T("Local AppWizard-Generated Applications"));

	CWinTestDlg dlg;
	m_pMainWnd = &dlg;
	INT_PTR nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
	}
	else if (nResponse == IDCANCEL)
	{
	}

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.get-task-allow</key>
    <true/>
</dict>
</plist>


text:
        <progressbar class="progressbar-sm progress-rounded progress-striped progress" max="100" value="progressExport" type="success">Export: {{progressExport}} / 100</progressbar>

No results found

 0" wt-responsive-table infinite-scroll-disabled="isLoading"
           style="table-layout: fixed;"
           st-table="rowCollection" infinite-scroll="callServer"  st-pipe="callServer"
           class="table table-hover cdr-grid">

                {{item.caption}}

 0, 'cdr-pinned': row.pinned_items.length}" class="cdr-row">

                {{renderCell(row[item.name], item)}}

                    <button ng-click="openFile(row.recordings[row._selectedRecordings])" class="btn btn-default">

                    </button>
                    <button class="btn btn-default dropdown-toggle" aria-haspopup="true" aria-expanded="false">

                    </button>

                                {{f.name}}

                                Download

                                Lock

                                Remove

                    <button class="btn btn-default dropdown-toggle cdr-btn" aria-haspopup="true" aria-expanded="false">...</button>

                                Open

                                {{row.pinned_items.length ? 'Unpin' : 'Pin' }}

                                Remove

                <button ng-disabled="row._loadB" ng-show="!row.parent_uuid.length" class="btn btn-default cdr-btn" ng-click="loadLegsB(row, false)">

                </button>

                <button ng-show="row.parent_uuid.length" class="btn btn-default cdr-btn" ng-click="openCdr(row)">

                </button>

                {{renderCell(v[item.name], item)}}

                <button class="btn btn-default cdr-btn" ng-click="openCdr(v)">

                </button>


text:
using Colso.Xrm.DataTransporter.Models;
using Microsoft.Crm.Sdk.Messages;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Messages;
using Microsoft.Xrm.Sdk.Metadata;
using Microsoft.Xrm.Sdk.Query;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
using static Colso.Xrm.DataTransporter.AppCode.Enumerations;
using UpdateRequest = Microsoft.Xrm.Sdk.Messages.UpdateRequest;

namespace Colso.DataTransporter.AppCode
{
    public class EntityRecord
    {
        private static List<EntityMetadata> sourceEntitiesMetadata;
        private static Guid targetCurrentUserId;
        private static List<EntityMetadata> targetEntitiesMetadata;
        private readonly List<AttributeMetadata> attributes;
        private readonly EntityMetadata entity;
        private readonly IOrganizationService sourceService;
        private readonly IOrganizationService targetService;
        private readonly TransferMode transfermode;
        private EntityCollection sourceRecords;
        private EntityCollection targetRecords;
        private BackgroundWorker worker;

        public EntityRecord(EntityMetadata entity, List<AttributeMetadata> attributes, TransferMode mode, BackgroundWorker worker, IOrganizationService sourceService, IOrganizationService targetService)
        {
            if (sourceEntitiesMetadata == null)
            {
                sourceEntitiesMetadata = new List<EntityMetadata>();
            }

            if (targetEntitiesMetadata == null)
            {
                targetEntitiesMetadata = new List<EntityMetadata>();
            }

            if (targetCurrentUserId == Guid.Empty)
            {
                targetCurrentUserId = ((WhoAmIResponse)targetService.Execute(new WhoAmIRequest())).UserId;
            }

            this.worker = worker;
            this.entity = entity;
            this.attributes = attributes;
            this.transfermode = mode;
            this.sourceService = sourceService;
            this.targetService = targetService;
            this.Name = entity.DisplayName.UserLocalizedLabel == null ? string.Empty : entity.DisplayName.UserLocalizedLabel.Label;
            this.Messages = new List<string>();
            this.PreviewList = new List<ListViewItem>();
        }

        public event EventHandler OnProgress;

        public event EventHandler OnStatusMessage;

        public string Filter { get; set; }
        public List<Item<EntityReference, EntityReference>> Mappings { get; set; }

        public List<string> Messages { get; }
        public string Name { get; }
        public List<ListViewItem> PreviewList { get; }

        public void Transfer(bool useBulk = false, int bulkCount = 200)
        {
            RetrieveData();
            DoTransfer(useBulk, bulkCount);
        }

        private void AddMissingAttributes(Entity entity)
        {
            // Make sure only selected attributes are send
            var missingattributes = this.attributes.Where(ae => !entity.Attributes.Any(a => a.Key.Equals(ae.LogicalName))).Select(ae => ae.LogicalName).ToArray();

            // Remove unwanted attributes
            foreach (var att in missingattributes)
                entity.Attributes.Add(att, null);
        }

        private void ApplyEntityCollectionMappings(Entity e)
        {
            var references = e.Attributes.Select(a => a.Value).OfType<EntityCollection>().ToArray();
            foreach (var ec in references)
                foreach (var entity in ec.Entities)
                {
                    ApplyMappings(entity);
                }
        }

        private void ApplyMappings(Entity e)
        {
            //.OfType<A>()
            var references = e.Attributes.Select(a => a.Value).OfType<EntityReference>().ToArray();

            foreach (var map in Mappings)
            {
                var matches = references.Where(r => r.LogicalName == map.Key.LogicalName && r.Id.Equals(map.Key.Id)).ToArray();

                foreach (var match in matches)
                    match.Id = map.Value.Id;
            }
        }

        private XmlDocument BuildFetchXml(string entityLogicalName, string[] columns, string filter)
        {
            var doc = new XmlDocument();

            // the xml declaration is recommended, but not mandatory
            var xmlDeclaration = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
            doc.InsertBefore(xmlDeclaration, doc.DocumentElement);

            // string.Empty makes cleaner code
            var elfetch = doc.CreateElement(string.Empty, "fetch", string.Empty);
            doc.AppendChild(elfetch);

            // Add fetch attributes
            var attversion = doc.CreateAttribute("version");
            attversion.Value = "1.0";
            elfetch.Attributes.Append(attversion);
            var attoutputformat = doc.CreateAttribute("output-format");
            attoutputformat.Value = "xml-platform";
            elfetch.Attributes.Append(attoutputformat);
            var attmapping = doc.CreateAttribute("mapping");
            attmapping.Value = "logical";
            elfetch.Attributes.Append(attmapping);
            var attdistinct = doc.CreateAttribute("distinct");
            attdistinct.Value = "false";
            elfetch.Attributes.Append(attdistinct);

            // Create entity element
            var elEntity = doc.CreateElement(string.Empty, "entity", string.Empty);
            elfetch.AppendChild(elEntity);

            // Add entity attributes
            var attname = doc.CreateAttribute("name");
            attname.Value = entityLogicalName;
            elEntity.Attributes.Append(attname);

            // Add all attributes
            foreach (var column in columns)
            {
                var elAttribute = doc.CreateElement(string.Empty, "attribute", string.Empty);
                elEntity.AppendChild(elAttribute);

                // Add entity attributes
                var attaname = doc.CreateAttribute("name");
                attaname.Value = column;
                elAttribute.Attributes.Append(attaname);
            }

            // Add the filter
            filter = filter?.Trim();
            if (!string.IsNullOrEmpty(filter))
            {
                var filterdoc = new XmlDocument();
                filterdoc.LoadXml(filter);
                var rootfilter = filterdoc.DocumentElement;
                var elFilter = doc.ImportNode(rootfilter, true);
                elEntity.AppendChild(elFilter);
            }

            return doc;
        }

        private string CreateXml(XmlDocument doc, string cookie, int page, int count)
        {
            XmlAttributeCollection attributes = doc.DocumentElement.Attributes;
            if (cookie != null)
            {
                XmlAttribute attribute = doc.CreateAttribute("paging-cookie");
                attribute.Value = cookie;
                attributes.Append(attribute);
            }
            XmlAttribute attribute1 = doc.CreateAttribute("page");
            attribute1.Value = Convert.ToString(page);
            attributes.Append(attribute1);
            XmlAttribute attribute2 = doc.CreateAttribute("count");
            attribute2.Value = Convert.ToString(count);
            attributes.Append(attribute2);
            StringBuilder sb = new StringBuilder(1024);
            using (StringWriter stringWriter = new StringWriter(sb))
            {
                XmlTextWriter xmlTextWriter = new XmlTextWriter((TextWriter)stringWriter);
                doc.WriteTo((XmlWriter)xmlTextWriter);
                xmlTextWriter.Close();
            }
            return sb.ToString();
        }

        private void DoTransfer(bool useBulk = false, int bulkCount = 200)
        {
            if (sourceRecords == null || targetRecords == null)
                return;

            var recordCount = sourceRecords.Entities.Count;
            var missingCount = 0;
            var createCount = 0;
            var updateCount = 0;
            var deleteCount = 0;
            var skipCount = 0;
            var errorCount = 0;
            var totalTaskCount = sourceRecords.Entities.Count;
            var bulk = new ExecuteMultipleRequest
            {
                Requests = new OrganizationRequestCollection(),
                Settings = new ExecuteMultipleSettings
                {
                    ContinueOnError = true
                }
            };

            int processed = 0;

            // Delete the missing source records in the target environment
            if ((transfermode & TransferMode.Delete) == TransferMode.Delete)
            {
                var missing = targetRecords.Entities.Select(e => e.Id).Except(sourceRecords.Entities.Select(e => e.Id)).ToArray();
                missingCount = missing.Length;
                totalTaskCount += missingCount;
                for (int i = 0; i < missingCount; i++)
                {
                    if (worker.CancellationPending) return;

                    processed++;
                    var recordid = missing[i];
                    SetProgress(i / totalTaskCount, "");
                    SetStatusMessage("{0}/{1}: delete record", i + 1, missingCount);
                    if ((transfermode & TransferMode.Preview) != TransferMode.Preview)
                    {
                        if (useBulk)
                        {
                            bulk.Requests.Add(new DeleteRequest { Target = new EntityReference(entity.LogicalName, recordid) });
                        }
                        else
                        {
                            targetService.Delete(entity.LogicalName, recordid);
                        }
                    }
                    else
                    {
                        var record = targetRecords.Entities.Where(e => e.Id.Equals(recordid)).FirstOrDefault();
                        var recordname = record.GetAttributeValue<string>(this.entity.PrimaryNameAttribute);
                        var lvrecord = ToListViewItem(recordname, record, "DELETE");
                        PreviewList.Add(lvrecord);
                    }

                    if (useBulk)
                    {
                        if (bulk.Requests.Count % bulkCount == 0 || processed == missingCount)
                        {
                            var bulkResponse = (ExecuteMultipleResponse)targetService.Execute(bulk);
                            // MscrmTools (26/11/2020): Should we need to handle potential exceptions?
                            deleteCount += bulk.Requests.Count;
                            bulk.Requests = new OrganizationRequestCollection();
                        }
                    }
                    else
                    {
                        deleteCount++;
                    }
                }
            }

            // Transfer records
            processed = 0;
            for (int i = 0; i < recordCount; i++)
            {
                if (worker.CancellationPending) return;

                processed++;
                try
                {
                    var record = sourceRecords.Entities[i];
                    var targetEntity = targetRecords.Entities.FirstOrDefault(e => e.Id.Equals(record.Id));
                    var recordexist = targetEntity != null;
                    var name = entity.DisplayName.UserLocalizedLabel == null ? string.Empty : entity.DisplayName.UserLocalizedLabel.Label;
                    SetProgress((i + missingCount) / totalTaskCount, "Transfering entity '{0}'...", name);

                    // BC 22/11/2016: some attributes are auto added in the result query
                    var recordname = record.GetAttributeValue<string>(this.entity.PrimaryNameAttribute);
                    AddMissingAttributes(record); // BC 19/12/2017: null values are not retrieved
                    var sourceStateAndStatus = RemoveStateAndStatus(record);
                    RemoveUnwantedAttributes(record);

                    if (recordexist && ((transfermode & TransferMode.Update) == TransferMode.Update))
                    {
                        // Update existing record
                        SetStatusMessage(
                            useBulk ? "{0}/{1}: Adding record '{2}' for update" : "{0}/{1}: update record '{2}'", i + 1,
                            recordCount, recordname);

                        ApplyEntityCollectionMappings(record);
                        ApplyMappings(record);
                        if ((transfermode & TransferMode.Preview) != TransferMode.Preview)
                        {
                            if (useBulk)
                            {
                                var setStateRequest = GetSetState(record, sourceStateAndStatus, targetEntity);
                                var requests = new OrganizationRequestCollection { new UpdateRequest { Target = record } };
                                if (setStateRequest != null) requests.Add(setStateRequest);

                                bulk.Requests.Add(new ExecuteTransactionRequest { Requests = requests });
                            }
                            else
                            {
                                targetService.Update(record);
                                SetState(record, sourceStateAndStatus, targetEntity);
                            }
                        }
                        else
                        {
                            PreviewList.Add(ToListViewItem(recordname, record, "UPDATE"));
                        }

                        if (!useBulk)
                        {
                            updateCount++;
                        }
                    }
                    else if (!recordexist && ((transfermode & TransferMode.Create) == TransferMode.Create))
                    {
                        // Create missing record
                        SetStatusMessage(
                            useBulk ? "{0}/{1}: Adding record '{2}' for create" : "{0}/{1}: create record '{2}'", i + 1,
                            recordCount, recordname);

                        ApplyEntityCollectionMappings(record);
                        ApplyMappings(record);
                        if ((transfermode & TransferMode.Preview) != TransferMode.Preview)
                        {
                            if (useBulk)
                            {
                                var setStateRequest = GetSetState(record, sourceStateAndStatus);
                                var requests = new OrganizationRequestCollection { new CreateRequest { Target = record } };
                                if (setStateRequest != null) requests.Add(setStateRequest);

                                bulk.Requests.Add(new ExecuteTransactionRequest { Requests = requests });
                            }
                            else
                            {
                                targetService.Create(record);
                                SetState(record, sourceStateAndStatus);
                            }
                        }
                        else
                        {
                            PreviewList.Add(ToListViewItem(recordname, record, "CREATE"));
                        }

                        if (!useBulk)
                        {
                            createCount++;
                        }
                    }
                    else
                    {
                        SetStatusMessage("{0}/{1}: skip record", i + 1, recordCount);
                        skipCount++;
                    }

                    if (useBulk)
                    {
                        if (bulk.Requests.Count > 0 && bulk.Requests.Count % bulkCount == 0 || processed == recordCount)
                        {
                            SetStatusMessage($"Processing records {processed - bulk.Requests.Count} to {processed} of {recordCount}");

                            var bulkResponse = (ExecuteMultipleResponse)targetService.Execute(bulk);
                            // MscrmTools (26/11/2020): Should we need to handle potential exceptions?

                            var errorIndexes = new List<int>();
                            foreach (var response in bulkResponse.Responses)
                            {
                                if (response.Fault != null)
                                {
                                    errorIndexes.Add(response.RequestIndex);
                                    this.Messages.Add(response.Fault.Message);
                                    errorCount++;
                                }
                            }

                            for (var j = 0; j < bulk.Requests.Count; j++)
                            {
                                if (errorIndexes.Contains(j)) continue;
                                if (bulk.Requests[j] is ExecuteTransactionRequest etr)
                                {
                                    if (etr.Requests.First() is CreateRequest)
                                    {
                                        createCount++;
                                    }
                                    else
                                    {
                                        updateCount++;
                                    }
                                }
                            }

                            bulk.Requests = new OrganizationRequestCollection();
                        }
                    }
                }
                catch (System.ServiceModel.FaultException<OrganizationServiceFault> error)
                {
                    this.Messages.Add(error.Message);
                    errorCount++;
                }
            }

            if ((transfermode & TransferMode.Preview) != TransferMode.Preview) SetStatusMessage("{0} created; {1} updated; {2} deleted; {3} skipped; {4} errors", createCount, updateCount, deleteCount, skipCount, errorCount);
            else SetStatusMessage("PREVIEW: {0} created; {1} updated; {2} deleted; {3} skipped; {4} errors", createCount, updateCount, deleteCount, skipCount, errorCount);
        }

        private SetStateRequest GetSetState(Entity target, RecordStateAndStatus sourceStateAndStatus, Entity currentStateAndStatusEntity = null)
        {
            // Don't update state when it's not available
            if (sourceStateAndStatus.State == null)
                return null;

            if (currentStateAndStatusEntity != null)
            {
                var currentStateAndStatus = RemoveStateAndStatus(currentStateAndStatusEntity);

                // If the entity has no state: return
                if (currentStateAndStatus.State == null || (sourceStateAndStatus.State.Value == currentStateAndStatus.State.Value && sourceStateAndStatus.Status.Value == currentStateAndStatus.Status.Value))
                    return null;
            }

            return new SetStateRequest()
            {
                EntityMoniker = target.ToEntityReference(),
                State = sourceStateAndStatus.State,
                Status = sourceStateAndStatus.Status
            };
        }

        private RecordStateAndStatus RemoveStateAndStatus(Entity record)
        {
            var recordStateAndStatus = new RecordStateAndStatus
            {
                State = record.GetAttributeValue<OptionSetValue>("statecode"),
                Status = record.GetAttributeValue<OptionSetValue>("statuscode")
            };

            record.Attributes.Remove("statecode");
            record.Attributes.Remove("statuscode");

            return recordStateAndStatus;
        }

        private void RemoveUnwantedAttributes(Entity entity)
        {
            // Make sure only selected attributes are send
            var unwantedattributes = entity.Attributes.Where(ae => !this.attributes.Any(a => a.LogicalName.Equals(ae.Key))).Select(ae => ae.Key).ToArray();

            // Remove unwanted attributes
            foreach (var att in unwantedattributes)
                entity.Attributes.Remove(att);
        }

        private EntityCollection RetrieveAll(IOrganizationService service, QueryExpression query, int pageSize = 250)
        {
            var collection = new EntityCollection();
            query.PageInfo.PageNumber = 1;
            query.PageInfo.Count = pageSize;
            query.PageInfo.PagingCookie = null;

            EntityCollection tempCollection;
            do
            {
                tempCollection = service.RetrieveMultiple((QueryBase)query);
                PagingInfo pageInfo = query.PageInfo;
                int num = pageInfo.PageNumber + 1;
                pageInfo.PageNumber = num;
                query.PageInfo.PagingCookie = tempCollection.PagingCookie;
                collection.Entities.AddRange(tempCollection.Entities);
            }
            while (tempCollection.MoreRecords);

            collection.EntityName = query.EntityName;
            collection.MoreRecords = false;
            collection.TotalRecordCount = collection.Entities.Count;

            return collection;
        }

        private EntityCollection RetrieveAll(IOrganizationService service, XmlDocument fetchXml, int pageSize = 250)
        {
            EntityCollection collection = new EntityCollection();
            int page = 1;
            string cookie = (string)null;
            EntityCollection tempCollection;
            do
            {
                tempCollection = service.RetrieveMultiple((QueryBase)new FetchExpression(this.CreateXml(fetchXml, cookie, page, pageSize)));
                ++page;
                cookie = tempCollection.PagingCookie;
                collection.Entities.AddRange((IEnumerable<Entity>)tempCollection.Entities);
            }
            while (tempCollection.MoreRecords);

            collection.MoreRecords = false;
            collection.TotalRecordCount = collection.Entities.Count;

            return collection;
        }

        private void RetrieveData()
        {
            var columns = this.attributes.Select(a => a.LogicalName).ToList();
            if (!columns.Contains(this.entity.PrimaryNameAttribute)) columns.Add(this.entity.PrimaryNameAttribute);

            // Check if the record already exists on target organization
            var sourceqry = BuildFetchXml(entity.LogicalName, columns.ToArray(), Filter);

            var targetcolumnset = new ColumnSet(this.entity.PrimaryNameAttribute);
            // Make sure we have a state on the entity
            if (this.entity.Attributes.Any(a => a != null && !string.IsNullOrEmpty(a.LogicalName) && a.LogicalName.Equals("statecode")))
                targetcolumnset.AddColumns("statecode", "statuscode");
            var targetqry = new QueryExpression(entity.LogicalName) { ColumnSet = targetcolumnset };

            SetProgress(0, "Retrieving records...");
            var sourceRetrieveTask = Task.Factory.StartNew<EntityCollection>(() => { return RetrieveAll(sourceService, sourceqry); });
            var targetRetrieveTask = Task.Factory.StartNew<EntityCollection>(() => { return RetrieveAll(targetService, targetqry); });
            Task.WaitAll(sourceRetrieveTask, targetRetrieveTask);

            sourceRecords = sourceRetrieveTask.Result;
            targetRecords = targetRetrieveTask.Result;
        }

        private void SetProgress(int progress, string format, params object[] args)
        {
            // Make sure someone is listening to event
            if (OnProgress == null) return;

            OnProgress(this, new ProgressEventArgs(progress, string.Format(format, args)));
        }

        private void SetState(Entity target, RecordStateAndStatus sourceStateAndStatus, Entity currentStateAndStatusEntity = null)
        {
            // Don't update state when it's not available
            if (sourceStateAndStatus.State == null)
                return;

            if (currentStateAndStatusEntity != null)
            {
                var currentStateAndStatus = RemoveStateAndStatus(currentStateAndStatusEntity);

                // If the entity has no state: return
                if (currentStateAndStatus.State == null || (sourceStateAndStatus.State.Value == currentStateAndStatus.State.Value && sourceStateAndStatus.Status.Value == currentStateAndStatus.Status.Value))
                    return;
            }

            SetStateRequest setState = new SetStateRequest()
            {
                EntityMoniker = target.ToEntityReference(),
                State = sourceStateAndStatus.State,
                Status = sourceStateAndStatus.Status
            };

            targetService.Execute(setState);
        }

        private void SetStatusMessage(string format, params object[] args)
        {
            // Make sure someone is listening to event
            if (OnStatusMessage == null) return;

            OnStatusMessage(this, new StatusMessageEventArgs(string.Format(format, args)));
        }

        private ListViewItem ToListViewItem(string name, Entity entity, string action)
        {
            var lv = new ListViewItem(action);
            lv.SubItems.Add(entity.Id.ToString());
            lv.SubItems.Add(name);

            // Add all attributes
            foreach (var item in entity.Attributes)
            {
                //lv.SubItems.Add(item.Value);
            }

            return lv;
        }
    }
}


text:
class FileEvent < FlowdockEvent
  register_event "file"

  def render
    (organization, flow) = @target.visible_name.split('/')
    url = "https://www.#{IrcServer::FLOWDOCK_DOMAIN}/rest#{@message['content']['path']}"
    render_privmsg(@user.irc_host, @target.irc_id, url)
  end

  def valid?
    channel?
  end
end