Sponsored

Friday, November 27, 2020

.NET Core OData: How to Construct a DateTime Filter

Say, we need to construct a query to an OData endpoint that filters records by DateTime values. Over the years as OData standard had been evolving there have been various different ways to work with DateTime columns depending on OData version and an implementation of an actual OData service that could have been based on various different frameworks. This being said, it's likely, that a single universal way of constructing a DateTime based filter clause for OData services might not exist. Take this under consideration, and note that the solution presented below had only been tested with OData services that are built with .NET Web API Odata v4.

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.

Monday, November 2, 2020

New Code Syntax Highlighter Prism

Everyone who posts code samples in their blogs needs a code highlighter. Why? Because without one the code samples would not look nice and readable and your readers would become unhappy and stop reading your blog. Don't like the sound of it? Use a code highlighter.