Link Archive #3

1. How does a relational database work

Mega killer article about relational databases. A must read for all, who wants to gain some insights into relational database core functions, written in a nice to read style

2. Apache vs Nginx Practical considerations

Apache and Nginx are the two most common open source web servers in the world. Together, they are responsible for serving over 50% of traffic on the internet. Both solutions are capable of handling diverse workloads and working with other software to provide a complete web stack.

While Apache and Nginx share many qualities, they should not be thought of as entirely interchangeable. Each excels in its own way and it is important to understand the situations where you may need to reevaluate your web server of choice. This article will be devoted to a discussion of how each server stacks up in various areas.

Variadic functions in Lua

Lua has a nice ability to create functions with dynamic number of arguments. Here is an example with use for that:

function FindMax(...) -- … here means that the number of arguments is dynamic
  local arguments = {...} -- takes variable number of arguments and creates table
  local max = ... -- takes only first value of passed parameters
  for i = 1, #arguments do -- #arguments is LENGTH of the arguments table
    if arguments[i] > max then
      max = arguments[i]
  return max
answer = FindMax(1,5,3,7,29,43,2,34,2);
print(answer) -- 43 in this case

Sure this one is just a proof of concept example, but its nice to know that this exists.

Path Environment Variable

Environment variables are really nice timesaver feature in Windows. As a quick reminder:
There is a special variable named ‘Path’; you can write paths to the folders that contain some files, for example:

C:\ProgramData\chocolatey\bin;C:\Users\dv\AppData\Local\Code\bin;c:\cshell\cshell.exe;C:\tools\cygwin;C:\Users\dv\AppData\Local\atom\bin;C:\Program Files (x86)\Lua\5.1\;C:\Program Files (x86)\PuTTY\;

After that i can run Lua with just a command: CMD-> lua.

Notice: after setting the variable its value will be avaliable in console just after the console restart!

More on the subject:


Backup/Restore IIS 7/8.5 Websites/AppPools

For exporting all AppPools use command:

%windir%\system32\inetsrv\appcmd list apppool /config /xml > c:\apppools.xml

For importing all AppPools:

%windir%\system32\inetsrv\appcmd add apppool /in < c:\apppools.xml

For exporting all WebSites:

%windir%\system32\inetsrv\appcmd list site /config /xml > c:\sites.xml

For importing all WebSites:

%windir%\system32\inetsrv\appcmd add site /in < c:\sites.xml

After exporting xml files created can have UCS-2 Little Endian encoding. In this case you should change the file encoding to UTF8 for example to import without errors.

Link Archive #2

1. Transport Layer Security (TLS) in depth

The TLS protocol is designed to provide three essential services to all applications running above it: encryption, authentication, and data integrity. Technically, you are not required to use all three in every situation. You may decide to accept a certificate without validating its authenticity, but you should be well aware of the security risks and implications of doing so. In practice, a secure web application will leverage all three services.

2. Introduction to the ASP.NET Web API

Free Pluralsight course to get started with Web API.

3. A Deep Dive into the ASP.NET 5 Runtime

The runtime hosting infrastructure for ASP.NET 5 is currently called the K Runtime Environment (KRE), which is a generic placeholder name until we finalize the official name. The KRE provides an environment that has everything a .NET app needs to run: a host process, CLR hosting logic, managed entry point discovery and so forth. The KRE was built for running cross-platform .NET Web applications, but it can run other types of .NET applications, too, such as console apps. The KRE is based on the same .NET CLR and base class libraries .NET developers have come to know and love, while enabling cross-platform support for running .NET applications on Windows, OS X and Linux.

4. The Microsoft .NET Framework in Embedded Applications

The world has come a long way from the first context-­sensitive C code editor in the early 1980s. Tooling and languages developed initially for desktop apps have been extended to encompass server, cloud and other environments. The Microsoft .NET Framework and Visual Studio provide state-of-the-art tools that greatly increase programmer efficiency. The .NET Framework tools and languages provide rich libraries and collaboration tools, and protect programmers from the most common mistakes.

Ignoring sensitive data additions to configuration files in git

With all the public open source repositories and cloud services there comes sensitive data ignoration problem. For example we can host our testing environment settings in Azure and save that hosting’s password / keys in configuration file. After some time we can suddenly get a huge bill because someone had used your credentials to install too many bitcoin miners in your cloud. Sure there are some other reasons to hide that information too :)
In this example we will use git as source control and SourceTree to make the process a bit easier for common routines.
The main idea is to:
1. Commit the file with dummy configuration settings (for example in .NET web project Web.config with database connection strings)
2. Ignore the changes to that file after that.
mm.. Just that simple.
To do that we can run the following command in git console:

git update-index –assume-unchanged FILEPATH

The command updates the index of the repository adding file ignoration without physical file deletion.
If you need to add some changes to the file after ignoring it in the index – you can run almost the same command:

git update-index –no-assume-unchanged FILEPATH

Removing file from indexing can add some problems during merging, but you can deal with them.. Think that’s better then publishing database credentials…
And the last one:
if you want to check which files were ignored from index run (marked as assume unchanged ):

git ls-files -v


If you are one of those kids, who use only GUI applications to complete the tasks here is something you’ll probably like:
for now i think the best tool for working with git or mercurial is SourceTree and it has one nice feature to automate the tasks: Custom Actions.
For the commands above you can do the following:



Then right click the file you want to temporary ignore in SourceTree and select the Custom Action.


Как я умудрился за 1 день задолжать Amazon 12000$

Git documentation, update index section

Clooit source

Link Archive #1

1. Good TypeScript review

TypeScript is not the first attempt to build a language to compile to JavaScript; it’s actually late to the party. The ubiquity of JavaScript as a runtime has inspired people from a variety of programming backgrounds to recreate JavaScript as they see fit. The CoffeeScript team actually maintains a ludicrously long list of 250+ languages that compile to JavaScript. That’s right—OVER TWO HUNDRED AND FIFTY LANGUAGES.

2. SSL/TLS in .NET 4 deep dive

The Secure Socket Layer is now essential for the secure exchange of digital data, and is most generally used within the HTTPS protocol. .NET now provides the Windows Communication Foundation (WCF) to implement secure communications directly. Matteo explains the TLS/SSL protocol, and takes a hands-on approach to investigate the SslStream class to show how to  implement a secure communication channel

3. Microsoft Developer eXperience: IoT (internet of things) hands-on labs

Set of isolated labs for AzureML, Stream Analytics, HDInsight, Storm, based on Tessel, Arduino and Raspberry Pi devices.

Learning TypeScript. Part 2: Interfaces

TypeScript provides excellent support for interfaces. For the beginners:

What is the interface?

Lets see if analogy can help here: for example lets take a factory. a factory requires that all the engines being built have a standard “interface” (for example 2 buttons: green/red, start/stop). So that when the new engine comes out we don’t need to study some new technics – there are still that 2 buttons from the mental example. If we change the physical engines with classes – then the consistent behavior in all that classes can be explained in the interface.

For example in TypeScript interface can be used to deny compilation in case some class has not implemented the needed functionality. Interface definition keyword is `interface`.


interface IEngine{
	 Start(): boolean;
	 Stop(): boolean;

class V8 implements IEngine{ // We will talk about classes shortly
	 Start(): boolean{
		alert('v8 started');
		return true;
	Stop(): boolean{
		alert('stopped v8');
		return true;

var engine = new V8();

As in classic OOP languages this feature adds polymorphism capability to TypeScript.


SOLID principle

Learning TypeScript


Plans about writings:

Till end of the year:

  1. Finish TypeScript tutorial i started
  2. Go though design patterns
  3. Prepare to use unit testing in production normally with mocking and other stuff
  4. Write as often as i can

Will also write about our Microsoft Hackathon winning project (its opensource and we will continue to write).

Learning TypeScript. Part 1: Any type and primitives

Error: L | Link
Lets start this blog with notes about TypeScript.
Im just learning it myself, so will add some “note type” tips here, with adding my thoughts and some experiments.

So, whats the TypeScript?

From the official website:

TypeScript is a typed superset of JavaScript that compiles to plain JavaScript.
Any browser. Any host. Any OS. Open Source.

So TypeScript is wrapper over the Javascript language, created by Anders Hejlsberg (The Creator of Delphi and C# (in case someone lived in cave and has no idea about the person)), it adds some OOP abilities to Javascript with static typing, generics etc. We will go though that features later in case i wont be too lazy to write all of this. The code is written in special .ts files that must be compiled to plane javascript and used by any project that works with javascript. For this special compiler was developed; you can use it manually or from the toolset (there are plugins for Visual Studio, Sublime, for example or for testing some tricks you can use website sandbox, the code written there is not sent anywhere, so you can bravely start the Experiments!)

Lets start by checking types that can be used for static typing and special Any type.

Basic Types

There are 3 primitive types in TypeScript: string, number and boolean.


As in any other language the representatives of this type are for working with textual data. The data is enclosed in ” or ‘ (as you remember TypeScript is superset of javascript, this means that the same old Javascript code will work in TypeScript). Example:

var name: string = "bob";
name = 'smith';

You also can try this code and see that changing it to name = 1; will give you compile error.


Just a true/false strongly typed values:

var isDone: boolean = false;

Numbering type… All the numberings in typescript are floating point numbers, so there is only this type:

var height: number = 6;
Special Any type

Actually all the types can be ‘any’. This is a special type that means that there must be no static check. So that any type can come from dynamically generated content or 3rd party libraries.

var notSure: any = 4;
notSure = "maybe a string instead";
notSure = false; // okay, definitely a boolean

Simple data structures
You sure can work with arrays for example. The array can be strongly typed too:

var list:number[] = [1, 2, 3];

Or the second way, that uses generic types:

var list:Array = [1, 2, 3];




Learn Typescript Official