Sometimes, when dealing with a Spark data frame it may be necessary to reorder columns in a certain order. For example, to keep data consistent when trying to union two or more data frames with the same schema but different order of columns. Let's explore how that can be done relatively easy using a select() Spark SQL function.
Sponsored
Wednesday, March 31, 2021
Reorder Columns in Spark DataFrame with Select() and Scala
Thursday, March 18, 2021
Incorrect ReSharper Behavior for CS1591 Warning
After upgrading from Visual Studio 16.8.x to 16.9.x the JetBrains ReSharper suddenly started marking a lot of public identifiers in the code as compiler errors with a message: "Missing XML comment for publicly visible type or member...". You can imagine how that can be very annoying.
Wednesday, February 3, 2021
.NET Web API: Confusing 404 Response to OPTIONS Request for CORS pre-flight

Problem: when a Angular applications sends an OPTIONS request to its own backend to satisfy CORS preflight policy it unexpectedly receives a 404 response from a .NET Core Web API application that effectively blocks an actual data data request from executing correctly. If you have ever experienced this problem, continue reading to understand what the problem is and how to fix it.
Saturday, December 26, 2020
C#/.NET: Validate Anonymous Objects During Unit Testing
Say, we have developed a REST API based on .NET Web API framework and need to write a unit test for an end point that returns a collection of objects. This sounds like a usual trivial task that many developers do all the time. Unless, the API method that we need to test, returns a collection of anonymous objects, that is the API method is written using a C# anonymous or dynamic type to construct objects that are included in the list.
It's totally fine when the endpoint is consumed over HTTP as the result is first serialized into JSON for transfer and then de-serialized back into a JavaScript object on a consumer side. If, however, the endpoint is called directly in C# without JSON conversion, like in a unit test, it's an entirely different story. Let's discuss how we can overcome this issue.
Friday, December 18, 2020
Angular: Mock NgRedux for Unit Testing
If you use Redux in your Angular web application (likely it is an NgRedux from Angular Redux) and develop unit tests for components that depend on the Redux store sometimes it's easier to mock the Redux store rather than deal with incorrect values that it may supply in a test scenario. If this sounds like your situation, read on.
Friday, November 27, 2020
.NET Core OData: How to Construct a DateTime Filter
Friday, November 20, 2020
Reuse a MemoryStream without Writing to a FileStream
MemoryStream is a very useful class as it allows working with a Stream-like data in memory without having dependencies on any external resources like files, etc. Even though the MemoryStream implements an IDisposable interface it does not actually have any critical resources to dispose of, so, explicitly disposing of a MemoryStream object is not strictly necessary as the .NET memory management will take care of it. This specifics presents an opportunity of reusing the MemoryStream object if needed across multiple code scopes.
Friday, November 6, 2020
Best Practices of Working with Date in JavaScript/TypeScript
Date is a built-in type in JavaScript/TypeScript (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) and provides most of the basic needs for manipulating with Date and Time values in the code. Being one of the most well-defined and often used basic types of the language it still generates a lot of confusion, questions and erroneously working code among a wide developers' community. Let's try and figure out some of the best practices that should be applied to the JavaScript/TypeScript code when dealing with the Date type.
Thursday, November 5, 2020
A Color Picker in Chrome DevTools
When you are working with CSS and specifically dealing with colors in HEX format it's very handy to be able to quickly find (or pick) a color value anywhere on your screen. There are tools for that, of course, namely, color picker browser extensions, that I used to have. Not anymore. Because, Chrome, that is my main browser, have a Color Picker built into the DevTools. How nice, eh?
Open the DevTools by clicking F12 (or use a menu) and in the Styles panel you can simply click on any color square and the Color Picker will open.
You can use a pipette tool on the left and while it's in the "ON" state and colored blue move it around the screen and click on any color and it will appear in the Color Picker with a HEX value.





