• About
  • Privacy Policy
  • Utilities
Darchuk.NET

[object ErrorEvent] thrown … again

March 8, 2019 by Robert Leave a Comment

So there I am, happily writing unit tests, and suddenly this appears I keep seeing this error while trying to write Angular tests.  I… *think* this happens when something goes wrong during the constructor of a component.  I’ve written before about how it could be due to an @Input property not being initialized properly. But, … [Read more…]

Posted in: Angular, Jasmine, JavaScript, Typescript, Unit Testing Tagged: Angular, Jasmine, JavaScript, Testing, Typescript, UnitTesting

Javascript–Caching a web request with Promises

March 1, 2019 by Robert Leave a Comment

Suppose you have some data that comes from a web server somewhere.  But, it doesn’t change – so we really only need to fetch it once, and then store the result for easy access (maybe its an Enum that you map to a list of key/value pairs).  We can do this easily enough in a … [Read more…]

Posted in: Angular, JavaScript, Typescript, Web Development Tagged: Angular, Typescript, Web Development, WebAPI

.NET Core WebApp–Set Port on Command Line Launch

February 22, 2019 by Robert Leave a Comment

There are a bunch of different ways to do this, but sometimes I find myself wanting to run multiple web applications locally on different ports without fussing with configuration files, etc.  And whenever I need to do this, I always have to look it up… but most of the posts out there are how to … [Read more…]

Posted in: .NET Core, ASP.NET, Web Development Tagged: .NET, .NET Core, ASP.NET, C#, WebAPI

Colorful Console App

February 15, 2019 by Robert Leave a Comment

In a C# console application, you can change the color of the text emitted by Console.WriteLine by setting Console.ForegroundColor and Console.BackgroundColor.  It’s pretty straightforward, but if you want to make the output have different colors to denote different things, its kind of cumbersome to have to set the color and then write the output, and … [Read more…]

Posted in: C#, Generic Tagged: C#, Colors, Console, Csharp, Terminal

Waiting for a keypress asynchronously in a C# console app

February 8, 2019 by Robert 2 Comments

This one’s kind of specific, but sometimes when you’re writing a console app that does a lot of asynchronous stuff, and you want to cancel it at any time by pressing escape.  via GIPHY However, Console.ReadKey is blocking… so that’s not super great. CancellationToken First, make use of the cancellation tokens.  I’ve talked about them … [Read more…]

Posted in: .NET Core, Asynchronous, C#, Concurrency Tagged: async, C#

Getting Nested Classes With Reflection

February 1, 2019 by Robert Leave a Comment

Are you tired of feeling like your code is meaningless?  Sick of people not referring to your code as “black magic,” or struggling to gain recognition from your boss for writing sufficiently obfuscated code?If you’ve answered “yes” to any of the above, Reflection might be for you! via GIPHY Reflection I’ve talked about reflection a … [Read more…]

Posted in: C#, Reflection, Uncategorized, Unit Testing Tagged: C#, Reflection, Testing

C#–Writing Enum extension methods

January 25, 2019 by Robert 1 Comment

Sometimes I find myself wanting a quick way to compare an enum with a list of other enums…  Basically, if the enum is one of these, then do this.  It’s pretty easy to do with Linq, but if you want to do it a few times in a few other places, it pays to be … [Read more…]

Posted in: C#, Generic Tagged: C#, enum, equality, extension

Unit Testing NgbModal Modal Service

January 18, 2019 by Robert Leave a Comment

In the last blog post I showed how you could extend NgbModal to make a Modal Service, letting you re-use modal dialogs easily from within your Angular components. Even though its not always that much fun, I like to try and keep testability in mind when writing code… and, I’ll admit it, sometimes I gloss … [Read more…]

Posted in: Angular, Jasmine, JavaScript, Typescript, Unit Testing, Web Development Tagged: Angular, Dialog, Modal, NgbModal, Testing, Unit Test

Angular–Making a Modal Service by Extending NgbModal

January 11, 2019 by Robert 1 Comment

I like the idea of modal dialogs for certain things, especially showing error messages or confirming an action.  Creating (and styling) modal dialogs can vary so much that Angular doesn’t include them out of the box.  There’s a bunch of libraries out there that give you this functionality, including ones that are tied to a … [Read more…]

Posted in: Angular, Asynchronous, HTML, Typescript, Web Development Tagged: Angular, Blocking, Bootstrap, Dialog, Modal, NgBootstrap

C# Setting Socket Keep-Alive

January 4, 2019 by Robert 4 Comments

TCP is a good choice for communication if you want to know that your message got to where it was going, as opposed to UDP where the communication is fire-and-forget. When a message is sent, the recipient sends an acknowledgement that the message arrived successfully.  If you don’t get an acknowledgement, you have a pretty … [Read more…]

Posted in: C# Tagged: C#, KeepAlive, Networking, Socket, TCP, TcpClient
« Previous 1 … 3 4 5 … 12 Next »

Recent Posts

  • Allowing trailing JSON commas in ASP.NET Core 3
  • YADNC3JSG–Yet Another .NET Core 3.0 JSON Serializer Gotcha
  • Logging in a .NET Core 3 SignalR client
  • .NET Core 3 unit testing project sdk
  • .NET Core 3.0 Upgrade–New JSON Serializer Gotchas

Recent Comments

  1. Robert on C# Setting Socket Keep-Alive
  2. Oliver Schramm on C# Setting Socket Keep-Alive
  3. John Anderson on Waiting for a keypress asynchronously in a C# console app
  4. Ronald Garlit on .NET Core 3 unit testing project sdk
  5. Ronald Garlit on .NET Core 3 unit testing project sdk

Copyright © 2025 Darchuk.NET.

Omega WordPress Theme by ThemeHall