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 · 1 min · 84 words · Pavel Nasovich

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 · 1 min · 18 words · Pavel Nasovich

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 · 1 min · 89 words · Pavel Nasovich

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 · 6 min · 1114 words · Pavel Nasovich

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 · 2 min · 215 words · Pavel Nasovich

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 · 2 min · 228 words · Pavel Nasovich

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 · 1 min · 56 words · Pavel Nasovich

Today I Learned: Git Submodules

A short update about submodules in git. Git submodules Let’s start by adding an existing Git repository as a submodule of the repository that we’re working on. To add a new submodule you use the git submodule add command with the absolute or relative URL of the project you would like to start tracking. git submodule add https://github.com/forcewake/CommandPipeline By default, submodules will add the subproject into a directory named the same as the repository. ...

November 13, 2015 · 1 min · 85 words · Pavel Nasovich

Today I Learned: Protobuf and replace switch in JS

A short update about several interesting issues that i faced in today How-to use Protobuf You should install protobuf-net from nuget and then: // Explicit proto contract [ProtoContract] public class MappedEntity { [ProtoMember(1)] public int Id { get; set; } [ProtoMember(2)] public string Name { get; set; } } var entity = new MappedEntity { Id = 1, Name = "123" }; // Serialize/deserialize using protobuf-net byte[] serialized; using (var ms = new MemoryStream()) { Serializer.Serialize(ms, entity); serialized = ms.ToArray(); } MappedEntity deserialized; using (var ms = new MemoryStream(serialized)) { deserialized = Serializer.Deserialize<MappedEntity>(ms); } More information about usage, issues and problems in Protobuf you can get from this article in Russian ...

November 10, 2015 · 4 min · 670 words · Pavel Nasovich

Today I Learned: Homebrew, Jekyll and Liquid

I’ve decide to start writing in my blog.. And I faced with several issues and strange things in the tools and frameworks. How-to install Sublime Text 3 with Homebrew It’s pretty easy to install it but for man who is moving from Windows to Mac OS it is rather hard to change mind. I did not have brew cask installed so I had to install it first, so these were the steps I followed: ...

November 8, 2015 · 2 min · 416 words · Pavel Nasovich