Today I Learned: Azure Cosmos Db: Query for Fields not defined

There are several ways: Using LINQ For anyone who wants a Linq solution, it’s: query.Where(d => !d.SomeField.IsDefined()) Note: To get the IsDefined extension method, you need to add Microsoft.Azure.Documents.SystemFunctions namespace Using SQL Query Grammar with built-in functions IS_DEFINED (expr) - returns a Boolean indicating if the property has been assigned a value. SELECT TOP {0} * FROM Telemetry t WHERE (is_defined(t.longitude) OR is_defined(t.latitude)) Thanks to Azure Feedback and Azure Cosmos DB SQL syntax reference

December 27, 2017

Today I Learned: SSH connection from macOS 10.12 to a My Cloud

Use the following command on Terminal to SSH from a macOS 10.12 (Sierra) computer to a My Cloud: Double-click on the Mac HD, the internal Mac hard drive visible on the top-right corner of the desktop screen. Click on Applications. Click on Utilities. Double-click on Disk Utility. In Disk Utility, double-click on Terminal. In Terminal, type the following command: ssh -oHostKeyAlgorithms=+ssh-dss sshd@wdmycloud.com.local Note: If the device name has changed, please use the IP address of the My Cloud instead. ...

March 4, 2017

Today I Learned: Undo checkout of unmodified files in TFS

The following command will undo checkout of unmodified files in TFS c:\myProject> tfpt uu . /noget /recursive Thanks to stackoverflow.

March 1, 2017

Today I Learned: Angular 2: Forms

My slides for presentation: Intro to Angular2: Forms is based on Introduction to Angular 2 Forms - Template Driven vs Model Driven or Reactive Forms with some changes and updates. Also there are several resources which can be very useful: Original article from angular.io about the forms The Ultimate Guide to Forms in Angular 2 Custom Validators in Angular 2 Validate user’s form entries Victor Savkin’s article “Better Support for Functional Programming in Angular 2” Angular 2 Components - The Fundamentals by Angular University

December 22, 2016

Today I Learned: Angular 2: Core

My slides for presentation: Intro to Angular2: Core is based on thoughtram slides with some changes and updates.

December 20, 2016

Today I Learned: Nuget commands

The following command will update all packages in every project to the latest version available from nuget.org. Update-Package You can also restrict this down to one project. Update-Package -Project YourProjectName If you want to reinstall the packages to the same versions as were previously installed then you can use the -reinstall argument with Update-Package command. Update-Package -reinstall You can also restrict this down to one project. Update-Package -reinstall -Project YourProjectName The -reinstall option will first uninstall and then install the package back again into a project. ...

October 28, 2016

How to parse HTML in .NET

Small post about different parsers in .NET with can help you to work with HTML files. HtmlAgilityPack HtmlAgilityPack is one of the most famous HTML parser in .NET world. This is an agile HTML parser that builds a read/write DOM and supports plain XPATH or XSLT (you actually don’t HAVE to understand XPATH nor XSLT to use it, don’t worry…). It is a .NET code library that allows you to parse “out of the web” HTML files. The parser is very tolerant with “real world” malformed HTML. The object model is very similar to what proposes System.Xml, but for HTML documents (or streams). ...

December 21, 2015

Today I Learned: Ninject in OWIN WebApi application

This chapter explains how to setup an application in case you want to use the OWIN (Open Web Interface for .NET) interface to be able to move your application between OWIN supporting hosts without making code changes. Requirements Version You will need Version 3.2.4 or newer, otherwise you will get a Ninject.ActivationException regarding HttpConfiguration. Installation via nuget First you have to add a reference to Ninject.Web.Common.OwinHost and Ninject.Web.WebApi.OwinHost either by adding the reference manually or installing the corresponding NuGet Package. ...

December 21, 2015

Today I Learned: SharpRepository

I absolutely forgot about the blog. My bad. Let’s add something interesting about C#. SharpRepository SharpRepository is a generic repository written in C# which includes support for various relational, document and object databases including Entity Framework, RavenDB, MongoDB, CouchDB and Db4o. SharpRepository includes Xml and InMemory repository implementations as well. SharpRepository offers built-in caching options for AppFabric, memcached and the standard System.Runtime.Caching. SharpRepository also supports Specifications, FetchStrategies, Batches and Traits. ...

December 17, 2015

Today I Learned: Sanitize File Name in C#

A short update about safe file names in C#. Sanitize File Name in C# To clean up a file name you could do this private static string MakeValidFileName(string name) { string invalidChars = new string(Path.GetInvalidFileNameChars()) string escapedInvalidChars = Regex.Escape(); string invalidRegex = string.Format(@"([{0}]*\.+$)|([{0}]+)", escapedInvalidChars); return Regex.Replace(name, invalidRegex, "_"); } Working example you can find on dotnetfiddle

November 17, 2015