working on it ...

Filters

Explore Public Snippets

Sort by

Found 861 snippets matching: pending

    public by cghersi @ MailUp API DEV  206828  8  6  1

    MailUp REST API - How to subscribe to a particular list several contacts with the "Confirmed Optin" Procedure

    This snippet takes advantage of the MailUp .NET SDK to setup the secure communication towards the server through OAuth2 two leg authentication. You can start digging into the MailUP API world by reading this content: http://help.mailup.com/display/mailupapi/REST+API An instance of MailUpClient class is able to manage one user at a time. A MailU
    public static void SubcribeRecipientsWithDoubleOptin(string clientID, string clientSecret, string username, string password)
    {
        // 1) Setup the MailUp Client:
        MailUpClient client = new MailUpClient(clientID, clientSecret);
        try
        {
            client.RetrieveAccessToken(username, password);
        }
        catch (MailUpException ex)
        {
            Console.WriteLine("Unable to access the service due to " + ex.Message);
            return;
        }
    
        // 2) Subscribe recipients:
        int idList = 1;
        List<ConsoleRecipientItem> recipients = new List<ConsoleRecipientItem>();
        ConsoleRecipientItem recipient1 = new ConsoleRecipientItem()
        {
            Email = "test1@mailup.com",
            Name = "First New Recipient" + DateTime.Now.ToFileTimeUtc(),
            MobileNumber = "3331234567",
            MobilePrefix = "39",
            Fields = new List<ConsoleRecipientDynamicFieldItem>()
            {
                new ConsoleRecipientDynamicFieldItem() { Id = 1, Value = "Name1_" + DateTime.Now.ToFileTimeUtc() },
                new ConsoleRecipientDynamicFieldItem() { Id = 2, Value = "LastName1_" + DateTime.Now.ToFileTimeUtc() }
                //here you can add all the fields you want to add...
            }
        };
        ConsoleRecipientItem recipient2 = new ConsoleRecipientItem()
        {
            Email = "test2@mailup.com",
            Name = "Second New Recipient" + DateTime.Now.ToFileTimeUtc(),
            MobileNumber = "3337654321",
            MobilePrefix = "39",
            Fields = new List<ConsoleRecipientDynamicFieldItem>()
            {
                new ConsoleRecipientDynamicFieldItem() { Id = 1, Value = "Name2_" + DateTime.Now.ToFileTimeUtc() },
                new ConsoleRecipientDynamicFieldItem() { Id = 2, Value = "LastName2_" + DateTime.Now.ToFileTimeUtc() }
                //here you can add all the fields you want to add...
            }
        };
        recipients.Add(recipient1);
        recipients.Add(recipient2);
        int subscriptionResult = 0;
        try
        {
            subscriptionResult = client.AddRecipientsToList(idList, recipients, true);
        }
        catch (Exception ex)
        {
            Console.WriteLine("Cannot perform the operation due to " + ex.Message);
            return;
        }
    
        // 2.1) wait for the end of import task:
        if (subscriptionResult > 0)
        {
            Console.WriteLine("Recipients Import started; import ID:" + subscriptionResult);
    
            //optionally we can check the import status:
            bool completed = false;
            do
            {
                ConsoleImportStatus importStatus = client.CheckImportStatus(subscriptionResult);
                if (importStatus == null)
                {
                    Console.WriteLine("Cannot check the import status for import task #" + subscriptionResult);
                    return;
                }
                completed = importStatus.Completed;
            } while (!completed);
            Console.WriteLine("Recipients Added!");
        }
        else
        {
            Console.WriteLine("An error occurred while adding the recipients.");
            return;
        }
    
        // 3) Retrieve the sendingID of the confirmation email related to the previous task:
        int sendingID = -1;
        try
        {
            sendingID = client.GetSendingIDForImport(subscriptionResult);
        }
        catch (Exception ex)
        {
            Console.WriteLine("Cannot retrieve sending ID due to " + ex.Message);
            return;
        }
        if (sendingID <= 0)
        {
            Console.WriteLine("Cannot retrieve sending ID.");
            return;
        }
    
        // 4) Send the confirmation email:
        EmailSendingItem sendingResult = null;
        try
        {
            sendingResult = client.SendEmailMessage(sendingID);
        }
        catch (Exception ex)
        {
            Console.WriteLine("Cannot send email due to " + ex.Message);
            return;
        }
        if (sendingResult == null)
            Console.WriteLine("Cannot send confirmation email.");
        else
            Console.WriteLine("Confirmation email sent!");
    }
                

    public by cghersi  3543  3  6  1

    Check Recovery status of DB in SQL Server 2012

    This query allows you to check the status f your recovery in SQL Server. More information on http://timlaqua.com/2009/09/determining-how-long-a-database-will-be-in-recovery-sql-server-2008/
    DECLARE @DBName VARCHAR(64) = 'databasename'
     
    DECLARE @ErrorLog AS TABLE([LogDate] CHAR(24), [ProcessInfo] VARCHAR(64), [TEXT] VARCHAR(MAX))
     
    INSERT INTO @ErrorLog
    EXEC master..sp_readerrorlog 0, 1, 'Recovery of database', @DBName
     
    SELECT TOP 5
    	 [LogDate]
    	,SUBSTRING([TEXT], CHARINDEX(') is ', [TEXT]) + 4,CHARINDEX(' complete (', [TEXT]) - CHARINDEX(') is ', [TEXT]) - 4) AS PercentComplete
    	,CAST(SUBSTRING([TEXT], CHARINDEX('approximately', [TEXT]) + 13,CHARINDEX(' seconds remain', [TEXT]) - CHARINDEX('approximately', [TEXT]) - 13) AS FLOAT)/60.0 AS MinutesRemaining
    	,CAST(SUBSTRING([TEXT], CHARINDEX('approximately', [TEXT]) + 13,CHARINDEX(' seconds remain', [TEXT]) - CHARINDEX('approximately', [TEXT]) - 13) AS FLOAT)/60.0/60.0 AS HoursRemaining
    	,[TEXT]
     
    FROM @ErrorLog ORDER BY [LogDate] DESC         

    public by cghersi @ MailUp API DEV  1573  16  6  0

    MailUp REST API - How to subscribe a single contact with the "Confirmed Optin" Procedure

    This snippet takes advantage of the MailUp .NET SDK to setup the secure communication towards the server through OAuth2 two leg authentication. You can start digging into the MailUP API world by reading this content: http://help.mailup.com/display/mailupapi/REST+API An instance of MailUpClient class is able to manage one user at a time. A MailU
    public static void SubscribeContactWithCOI(string clientID, string clientSecret, string username, string password)
    {
      // 1) Setup the MailUp Client:
      MailUpClient client = new MailUpClient(clientID, clientSecret);
      try
      {
        client.RetrieveAccessToken(username, password);
      }
      catch (MailUpException ex)
      {
        Console.WriteLine("Unable to access the service due to " + ex.Message);
        return;
      }
    
      // 2) Prepare the input:
      int idList = 1;
      ConsoleRecipientItem recipient = new ConsoleRecipientItem()
      {
        Email = "test1COI@mailup.com",
        Name = "First COI New Recipient" + DateTime.Now.ToFileTimeUtc(),
        Fields = new List<ConsoleRecipientDynamicFieldItem>()
        {
            new ConsoleRecipientDynamicFieldItem() { Id = 1, Value = "Name1COI_" + DateTime.Now.ToFileTimeUtc() },
            new ConsoleRecipientDynamicFieldItem() { Id = 2, Value = "LastName1COI_" + DateTime.Now.ToFileTimeUtc() }
            //here you can add all the fields you want to add...
        }
      };
    
      // 3) Invoke the web method:
      int result = 0;
      try
      {
        result = client.AddRecipientToList(idList, recipient, true);
      }
      catch (Exception ex)
      {
        Console.WriteLine("Cannot perform the operation due to " + ex.Message);
        return;
      }
    
      // 4) Print results:
      if (result > 0)
        Console.WriteLine("Recipients Added with confirmed Opt-in! The ID of the recipient is " + result);
      else
        Console.WriteLine("An error occurred while adding the recipients with confirmed Opt-in.");
    }
                

    public by cghersi @ MailUp API DEV  993  1  5  0

    How to Add multiple recipients to a list of recipients with confirmed OptIn with MailUp .NET SDK

    This snippet takes advantage of the MailUp .NET SDK to setup the secure communication towards the server through OAuth2 two leg authentication. You can start digging into the MailUP API world by reading this content: http://help.mailup.com/display/mailupapi/REST+API An instance of MailUpClient class is able to manage one user at a time. A MailU
    public static void SubscribeRecipientsWithConfirmedOptin(string clientID, string clientSecret, string username, string password)
    {
        // 1) Setup the MailUp Client:
        MailUpClient client = new MailUpClient(clientID, clientSecret);
        try
        {
            client.RetrieveAccessToken(username, password);
        }
        catch (MailUpException ex)
        {
            Console.WriteLine("Unable to access the service due to " + ex.Message);
            return;
        }
    
        // 2) Prepare the input:
        int idList = 1;
        List<ConsoleRecipientItem> recipients = new List<ConsoleRecipientItem>();
        ConsoleRecipientItem recipient1 = new ConsoleRecipientItem()
        {
            Email = "test1COI@mailup.com",
            Name = "First COI New Recipient" + DateTime.Now.ToFileTimeUtc(),
            Fields = new List<ConsoleRecipientDynamicFieldItem>()
            {
                new ConsoleRecipientDynamicFieldItem() { Id = 1, Value = "Name1COI_" + DateTime.Now.ToFileTimeUtc() },
                new ConsoleRecipientDynamicFieldItem() { Id = 2, Value = "LastName1COI_" + DateTime.Now.ToFileTimeUtc() }
                //here you can add all the fields you want to add...
            }
        };
        ConsoleRecipientItem recipient2 = new ConsoleRecipientItem()
        {
            Email = "test2COI@mailup.com",
            Name = "Second COI New Recipient" + DateTime.Now.ToFileTimeUtc(),
            Fields = new List<ConsoleRecipientDynamicFieldItem>()
            {
                new ConsoleRecipientDynamicFieldItem() { Id = 1, Value = "Name2COI_" + DateTime.Now.ToFileTimeUtc() },
                new ConsoleRecipientDynamicFieldItem() { Id = 2, Value = "LastName2COI_" + DateTime.Now.ToFileTimeUtc() }
                //here you can add all the fields you want to add...
            }
        };
        recipients.Add(recipient1);
        recipients.Add(recipient2);
    
        // 3) Invoke the web method:
        int result = 0;
        try
        {
            result = client.SubscribeRecipientsWithConfirmedOptin(idList, recipients);
        }
        catch (Exception ex)
        {
            Console.WriteLine("Cannot perform the operation due to " + ex.Message);
            return;
        }
    
        // 4) Print results:
        if (result > 0)
        {
            Console.WriteLine("Recipients Import started; import ID:" + result);
    
            //optionally we can check the import status:
            bool completed = false;
            do
            {
                ConsoleImportStatus importStatus = client.CheckImportStatus(result);
                if (importStatus == null)
                {
                    Console.WriteLine("Cannot check the import status for import task #" + result);
                    return;
                }
                completed = importStatus.Completed;
            } while (!completed);
            Console.WriteLine("Recipients Added with confirmed Opt-in!");
        }
        else
            Console.WriteLine("An error occurred while adding the recipients with confirmed Opt-in.");
    }
    

    public by cghersi @ MailUp API DEV  1349  1  5  0

    How to Retrieve the status of a recipient given the ID with MailUp .NET SDK

    This snippet takes advantage of the MailUp .NET SDK to setup the secure communication towards the server through OAuth2 two leg authentication. You can start digging into the MailUP API world by reading this content: http://help.mailup.com/display/mailupapi/REST+API An instance of MailUpClient class is able to manage one user at a time. A MailU
    public static void GetSubscriptionStatusByID(string clientID, string clientSecret, string username, string password)
    {
        // 1) Setup the MailUp Client:
        MailUpClient client = new MailUpClient(clientID, clientSecret);
        try
        {
            client.RetrieveAccessToken(username, password);
        }
        catch (MailUpException ex)
        {
            Console.WriteLine("Unable to access the service due to " + ex.Message);
            return;
        }
    
        // 2) Prepare the input:
        int idList = 1;
        int idRecipient = 1;
    
        // 3) Invoke the web method:
        SubscriptionStatus result = SubscriptionStatus.Unknown;
        try
        {
            result = client.GetSubscriptionStatus(idList, idRecipient);
        }
        catch (Exception ex)
        {
            Console.WriteLine("Cannot perform the operation due to " + ex.Message);
            return;
        }
    
        // 4) Print results:
        Console.WriteLine("Recipient status: " + result);
    }
    

    public by cghersi @ MailUp API DEV  1042  4  6  0

    How to Retrieve the status of a recipient given the email with MailUp .NET SDK

    This snippet takes advantage of the MailUp .NET SDK to setup the secure communication towards the server through OAuth2 two leg authentication. You can start digging into the MailUP API world by reading this content: http://help.mailup.com/display/mailupapi/REST+API An instance of MailUpClient class is able to manage one user at a time. A MailU
    public static void GetSubscriptionStatusByEmail(string clientID, string clientSecret, string username, string password)
    {
        // 1) Setup the MailUp Client:
        MailUpClient client = new MailUpClient(clientID, clientSecret);
        try
        {
            client.RetrieveAccessToken(username, password);
        }
        catch (MailUpException ex)
        {
            Console.WriteLine("Unable to access the service due to " + ex.Message);
            return;
        }
    
        // 2) Prepare the input:
        int idList = 1;
        string emailRecipient = "test@mailup.com";
    
        // 3) Invoke the web method:
        SubscriptionStatus result = SubscriptionStatus.Unknown;
        try
        {
            result = client.GetSubscriptionStatus(idList, emailRecipient);
        }
        catch (Exception ex)
        {
            Console.WriteLine("Cannot perform the operation due to " + ex.Message);
            return;
        }
    
        // 4) Print results:
        Console.WriteLine("Recipient status: " + result);
    }
    

    public by msdn  1664  3  6  0

    CloseDevice: This method demonstrates how to close the device properly using the WinRT Hid API. When the HidDevice is closing, it will cancel all IO operations that are still pending (not complete) and then waits for them...

    This method demonstrates how to close the device properly using the WinRT Hid API. When the HidDevice is closing, it will cancel all IO operations that are still pending (not complete) and then waits for them to all cancel/complete before continuing. The pending IO operations will still call their respective completion callbacks with either
    using System;
    using System.IO;
    using Windows.Devices.Enumeration;
    using Windows.Devices.HumanInterfaceDevice;
    using Windows.Storage;
    using Windows.UI.Core;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using Windows.UI.Xaml.Navigation;
    using SDKTemplate;
    
    /// <summary>
    /// This method demonstrates how to close the device properly using the WinRT Hid API.
    ///
    /// When the HidDevice is closing, it will cancel all IO operations that are still pending (not complete) and
    /// then waits for them to all cancel/complete before continuing. The pending IO operations will still call their respective
    /// completion callbacks with either a task cancelled error or the operation completed.
    /// 
    /// This method is static because EventHandlerForDevice calls this method when the app is suspended.
    /// </summary>
    public static void CloseDevice()
    {
        if (DeviceList.Current.IsDeviceConnected)
        {
            MainPage.Current.NotifyUser("Device is closed", NotifyType.StatusMessage);
    
            // This closes the handle to the device
            DeviceList.Current.CurrentDevice.Dispose();
    
            DeviceList.Current.SetCurrentDevice(null, null);
        }
    }

    external by wokamoto  274  1  3  0

    [WordPress] pending の記事を全削除する SQL

    [WordPress] pending の記事を全削除する SQL: gistfile1.txt
    SQL
    delete from wp_posts where post_type = 'post' and post_status = 'pending';
    delete from wp_postmeta where not exists (select 'x' from wp_posts where wp_posts.ID = wp_postmeta.post_id);
    delete from wp_term_relationships where not exists (select 'x' from wp_posts where wp_posts.ID = wp_term_relationships.object_id);
    
    

    external by Steve Moseley  114  0  2  0

    $httpBackend example without the flush command to demonstrate pending requests.

    $httpBackend example without the flush command to demonstrate pending requests.: ut1-home.service.spec.js
    describe('SERVICE: imageService', function () {
    
        var imageService;
        var $httpBackend;
    
        beforeEach(function () {
    
            angular.mock.module('home');
    
            inject(function (_imageService_, _$httpBackend_) {
                imageService = _imageService_;
                $httpBackend = _$httpBackend_;
            });
    
        });
    
        afterEach(function () {
            $httpBackend.verifyNoOutstandingExpectation();
            $httpBackend.verifyNoOutstandingRequest()
        });
    
        it('should have an existing service called imageService', function () {
            expect(imageService).toBeDefined();
        });
    
        it('should have a function called getImages', function () {
            expect(angular.isFunction(imageService.getImages)).toBeTruthy();
        });
    
        it('should make a get call to images and return a list of images', function () {
    
            var data;
    
            $httpBackend
                .when('GET', 'http://localhost:8001/api/homeimages')
                .respond(200, homeImages);
    
            imageService.getImages()
                .then(function (response) {
                    console.log(response);
                    data = response.data
                });
    
            expect(data[0].id).toBe(1);
    
        });
    });
    
    
    
    

    external by strangerstudios  114  0  2  0

    Allow PMPro Pay by Check members to have full access, even with pending status.

    Allow PMPro Pay by Check members to have full access, even with pending status.: disable_pmpropbc_pmpro_has_membership_access_filter.php
    /*
      Allow PMPro Pay by Check members to have full access, even with pending status.
      
      Add this code to your active theme's functions.php or a custom plugin.
    */
    function disable_pmpropbc_pmpro_has_membership_access_filter()
    {
      remove_filter("pmpro_has_membership_access_filter", "pmpropbc_pmpro_has_membership_access_filter", 10, 4);
    }
    add_action('init', 'disable_pmpropbc_pmpro_has_membership_access_filter');
    
    
    • Public Snippets
    • Channels Snippets