logo
down
shadow

getting the faulty item during continuation


getting the faulty item during continuation

By : user2953971
Date : November 21 2020, 07:31 AM
seems to work fine If you can use Bcl.Async package, I'll definitely recommend it. Otherwise start all the tasks, then just use Task.Factory.ContinueWhenAll to wait for them asynchronously.
code :
private void DownloadData()
{
    var uiContext = TaskScheduler.FromCurrentSynchronizationContext();
    var urLsToProcess = new List<string>
    {
        "http://www.microsoft.com",
        "http://www.stackoverflow.com",
        "http://www.google.com",
        "http://www.apple.com",
        "http://www.ebay.com",
        "http://www.oracle.com",
        "http://www.gmail.com",
        "http://www.amazon.com",
        "http://www.outlook.com",
        "http://www.yahoo.com",
        "http://www.amazon124.com",
        "http://www.msn.com"
        };

    var tasks = urLsToProcess.Select(x => DownloadStringAsTask(new Uri(x)))
        .ToArray();

    Task.Factory.ContinueWhenAll(tasks, (Task<string>[] tasks1) =>
    {
        foreach (var task in tasks1)
        {
            //task.AsyncState will contain the Uri, add it to the textbox
            if (task.Status == TaskStatus.RanToCompletion)
            {
                textBox1.AppendText(string.Format("{0} : Completed", task.AsyncState));
            }
            else if (task.Status == TaskStatus.Faulted)
            {
                textBox1.AppendText(string.Format("{0} : Faulted", task.AsyncState));
            }
            else if (task.Status == TaskStatus.Canceled)
            {
                textBox1.AppendText(string.Format("{0} : Canceled", task.AsyncState));
            }
            textBox1.AppendText(Environment.NewLine);
        }

    }, CancellationToken.None, TaskContinuationOptions.None, uiContext);
}

static Task<string> DownloadStringAsTask(Uri address)
{
    TaskCompletionSource<string> tcs =
      new TaskCompletionSource<string>(address);
    WebClient client = new WebClient();
    client.DownloadStringCompleted += (sender, args) =>
    {
        if (args.Error != null)
            tcs.SetException(args.Error);
        else if (args.Cancelled)
            tcs.SetCanceled();
        else
            tcs.SetResult(args.Result);
    };
    client.DownloadStringAsync(address);
    return tcs.Task;
}


Share : facebook icon twitter icon
exception: current-continuation-marks: no corresponding prompt in the continuation: #<continuation-prompt-tag:web>

exception: current-continuation-marks: no corresponding prompt in the continuation: #<continuation-prompt-tag:web>


By : Nihil Shah
Date : March 29 2020, 07:55 AM
wish of those help Which redirect/get are you using?
The one from web-server/lang/servlet (which should be used with #lang web-server) is different than the one from web-server/servlet (which should be used with #lang racket (and friends))
Faulty input gets validated as faulty, but behaves as if it's correct

Faulty input gets validated as faulty, but behaves as if it's correct


By : Tóth Zoltán Tamás
Date : March 29 2020, 07:55 AM
may help you . I have a few components which I want to check whether or not they are filled in. My code iterates over every component added to a list, casts it to the correct type, invokes the getText method and checks whether or not it's empty. In case it's empty, a boolean is set to false and returned. Depending on the boolean, "Yay" (success) or "Nay" (failed) is being shown. As additional testing I have also printed component.toString() each time it failed. , Probably you should change this:
code :
} else {
    System.out.println("Yay");
}
} else {
    System.out.println("Nay");
}
How to write current thread task continuation that will execute after standard continuation worked?

How to write current thread task continuation that will execute after standard continuation worked?


By : Eduardo Hernández
Date : March 29 2020, 07:55 AM
this one helps. I need to write extension method which will work like Task.ContinueWith() but on main thread and after Task.ContinueWith() ended. , So the issue is right here:
code :
var task = new Task(InTask);
task.ContinueWith(TaskContinue);
task.ContinueWithOnMainThread(ReturnedToMainThread);
var task = new Task(InTask);
task.ContinueWith(TaskContinue)
.ContinueWithOnMainThread(ReturnedToMainThread);
Detecting faulty geometry WKT and returning the faulty record

Detecting faulty geometry WKT and returning the faulty record


By : Nidal Zeidat
Date : March 29 2020, 07:55 AM
this one helps. This is an answer to my question using cursors. As I've read we don't like cursors as a rule but this works.
I would prefer the elegance of an Stored Procedure or Function but this gets it done.
code :
    -- ---------------------------------------------------- 
--   Find invalid geometry in given Spatial table 
-- ---------------------------------------------------- 

DECLARE @id INT, @n INT, @g varchar(max);

-- create error log table
IF EXISTS (SELECT * FROM sys.objects 
  WHERE object_id = OBJECT_ID(N'[dbo].[ERR_CorruptedGeom]') AND type in (N'U'))
DROP TABLE [dbo].[ERR_CorruptedGeom];

CREATE TABLE [dbo].[ERR_CorruptedGeom](
    recordid [int] NULL,
    table_name Varchar(25) NULL,
    errtext Varchar(MAX) NULL
) ON [PRIMARY];

-- define QA cursor on spatial table
DECLARE qa_cursor CURSOR FOR 
    SELECT GEOMID, GEOG_WKT
    FROM dbo.GEOMWKT;

OPEN qa_cursor -- open cursor 
FETCH NEXT FROM qa_cursor INTO @id, @g;

-- run over table records from the begining to the end 
WHILE (@@FETCH_STATUS <> -1) 
BEGIN

BEGIN TRY

  -- conventional way to find invalid geometry 
  IF geometry::STGeomFromText(@g, 4326).STIsValid()=0 
  BEGIN 
    -- insert problematic record number into Log table 
   INSERT INTO dbo.ERR_CorruptedGeom (recordid, table_name, errtext) 
   VALUES (@id, 'dbo.GEOMWKT', 'Invalid Geometry');
  END

  -- trying to read invalid geometry will raise Error 
  SET @n = geometry::STGeomFromText(@g, 4326).STNumGeometries();

END TRY

-- error catch block
BEGIN CATCH

  -- insert problematic record reference to Log table 
  INSERT INTO dbo.ERR_CorruptedGeom (recordid, table_name, errtext)
  VALUES (@id, 'dbo.GEOMWKT', ERROR_MESSAGE());

END CATCH;

FETCH NEXT FROM qa_cursor INTO @id, @g;

END

-- close cursor 
CLOSE qa_cursor;
DEALLOCATE qa_cursor;


-- see results 
select * from ERR_CorruptedGeom
Force continuation of BlueBird Promise.each if an item in the iterable causes a reject

Force continuation of BlueBird Promise.each if an item in the iterable causes a reject


By : Dereje
Date : March 29 2020, 07:55 AM
it should still fix some issue If you don't have any control over the resolution of the promise, you can easily gain it by handling the rejections before each sees them:
code :
Promise.mapSeries(arr, function(item) {
    return somethingThatMightReject()
    .catch(function(err) {
        // ignore it? Log it?
        return /*reasonable result*/; // continue anyway
    });
})
Related Posts Related Posts :
  • How to use Addfields in MongoDB C# Aggregation Pipeline
  • MsTest TestCleanup method not called when an unhandled exception is thrown
  • missing last data when exporting gridview to excel
  • How to add array of objects to List in c#
  • Lambda Expression to order (sort) my list collection
  • Library for displaying music notation
  • How to compare two dictionaries in c# and get the output as True and False after validation
  • specify fields to be serialized with JSON
  • How do you obtain the content of a specific node using XmlDocument in C#?
  • How to ignore the first line in a csv file when you read the csv file in C#
  • c# - Problem calling public void from class
  • How to tell a class which objects it should create? Type vs. object confusion :(
  • Save CheckBox state to xml
  • WIX CAQuietExec NETSH Command Fails
  • Issues sending http put request every 60 seconds to RoR app
  • ConfigurationManager.ConnectionStrings.ConnectionString Issue
  • Real size WPF controls for printing
  • How to cancel properly?
  • C# String multiplication error
  • Using Solrnet and Assigning Attributes with Entity Framework Generated POCOs
  • Regex pattern for single backslash
  • TextBox: insert spaces for credit card number?
  • C# DLL loaded for exe-application is not found when launching similar DLL by rundll32.exe
  • Debug a Windows Service with WCF library
  • Open a file from an external assembly?
  • Servicestack RegistrationFeature Unable to bind request
  • Index was outside the bounds of the array confusion
  • Error in Xml to List code. The ':' character, hexadecimal value 0x3A, cannot be included in a name
  • I am trying to do a while loop with a string conditional statement in C#
  • C# 'Cannot access a disposed object. Object name: 'SslStream'.'
  • How to make Gecko use seperate CookieContainer per instance?
  • C# Advanced form "please wait"
  • Send and Receive data C# using network stream
  • How to discover that appsettings changed in C#?
  • Check what needs full trust
  • What is the execution order of an MVC Razor view/layout
  • Table designer (Entity Framework) is too resource intense
  • How to clean up an exception string so it can be displayed via Javascript Alert?
  • Configuring Amazon SES Feedback Notifications via Amazon SNS in ASP.NET MVC (C#)
  • C# api responce and request
  • Dynamodb putitem function not working properly
  • theme in windows phone(light or dark) using c#
  • Backup attached database file(.mdf) using c# and SQL Server
  • What is 'TextFile' and where it is uses in WPF project
  • Using same alias for multiple namespaces
  • how to move mails into separate folders
  • Multithreaded Uploader
  • Memory fragmentation?
  • C# correct exception handling
  • "Could not open macro storage" when accessing using file on another machine
  • How to access other directories of hosted server
  • C# Jagged Array check if value exists/true
  • Why can't I type Clone() properly?
  • exception on accessing dictionary from list
  • Getting the immediate response from server without waiting to 200 message
  • Why am I getting exception Directory Is Not empty?
  • Could not load file or assembly 'CefSharp.dll' or one of its dependencies
  • Sending Email By Using C# in unity3D?
  • Correct usage of await async in webapi
  • Program update code issue
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org