Вот и закончился блогомарафон v2.0. Не просто было 30-ть дней подряд писать по одной статье, но я справился :) С результатами марафона можно ознакомиться по тегу блогомарафон. Теперь пришло время проанализировать результаты, сделать небольшие выводы и поделиться впечатлениями. Первое что приходит в голову после месяца написания статей, порой очень тяжело найти тему для очередного поста. Ну просто не реально тяжело. Не особо хочется просто копипастить чужие статьи, хочется написать о чем-то интер...
[ASP.NET 5] Production Ready Web Server on Linux. Run Kestrel In The Background
In the previous article we have installed nginx as a "gate" for our ASP.NET 5 application. Today we will see how to start kestrel server in the background. We will do even more, we will create init.d script to control our APS.NET 5 application and start it on the system's startup. The simplest way to start kestrel in the background from console: nohup k kestrel & But if you want to start your application at the system's startup you need init.d script. Eventually, we will have following comm...
[Fix] Error "Status: 0xc00000e9" in Windows 7, Windows 8, Windows 10
You might get this error during booting or while installing a new version of Windows. Error code 0xc00000e9 refers to an unexpected I/O error. Usually, it is caused by damaged HDD, so first what you should do is to check you Hard Drive. You can use standard Windows CHKDSK or Linux ntfsfix. Load from Windows or Linux live USB and use those utilities to check you HDD. The other possible solution: Turn off computer Disconnect all USB devices Try to boot or install windows again And one more option:...
AdSense Consultation. How It Works
Recently I've got an email from Publisher Monetization Specialist from Google. I was surprised. Why me? I've just registered in the Google AdSense, my blog is not so popular, why specialist from google decided to contact me? We've arranged a phone call to talk about my account and the monetization of my site. After that, I've googled if it's a common thing to got such email from Google, and I found out that they select existing or new accounts almost randomly and help publishers to increase thei...
C# 6.0 await in catch/finally
C# 6.0 become more asynchronous-friendly than before. Finally, you can use await keyword in catch and finally blocks! Here is example: class Program { static void Main(string[] args) { do { Console.WriteLine("Before caller " + Thread.CurrentThread.ManagedThreadId); CallerMethod(); Console.WriteLine("After caller " + Thread.CurrentThread.ManagedThreadId); } while (Console.ReadKey().Key != ConsoleKey.Q); } public static async void CallerMethod() { try { throw new Exception(); }...
[Raspberry Pi 2] Create C# Background Application for Windows 10 IoT Core
In this article, we will see how to create simple Web Server for Raspberry Pi 2 running Windows 10 IoT Core. Because it is a Web Server we don't need UI for this application, we can run it in headless mode. Open Visual Studio 2015 RC and create Windows IoT Core Background Application solution. Now we need a web server. This will be simple one. It will always response with "Hello, World!" string. internal class WebServer { private const uint BufferSize = 8192; public void Start() { StreamSocketL...
[Raspberry Pi 2] Enable Headless Mode on Windows 10 IoT Core
If you want to run your application as a service (without UI) on Windows 10 IoT Core you first need to switch your device to the headless mode. First, let's connect to your Raspberry Pi 2 with a Power Shell, so then we can execute commands remotely on the device. Run PowerShell as an Administrator Start WinRM service to enable remote connections: net start WinRM Add your Raspberry Pi 2 in a trusted device list: Set-Item WSMan:\localhost\Client\TrustedHosts -Value <IP Address> Disable psrea...
[vNext] ASP.NET 5 Automatic Migrations with Fluent NHibernate
As I said in the previous article, I am gonna tell you about Automatic migrations with NHibernate and Fluent NHibernate in ASP.NET 5 applications. Automatic migrations is a really powerful feature, but you should be also really careful with it. Sometimes it might corrupt your schema or even data. Now back to ASP.NET 5 and migrations. I have already explained how to install and configure Postgresql with NHibernate. To enable automatic migrations you need to modify configuration a bit: private sta...
[BlueStacks] How to kill process after exit
In BlueStacks version 0.9.24, after you close emulator from a tray menu it will stay in a system as a background process. It might slow down your host system. To properly close BlueStacks you need to run c:\Program Files (x86)\BlueStacks\HD-Quit.exe To speed up this process, create a shortcut on desktop and use it to close your BlueStacks instance.
[ASP.NET 5] Production Ready Web Server on Linux. Kestrel + nginx
You can run ASP.NET 5 applications on Linux using kestrel web server. This is development web server, so it has limited functionality. But sometimes you need more functions, for example, https or virtual hosts support. Today we will see how to configure a system, so you can access your application through a domain name. First, you need ASP.NET 5 environment up and running. You can use my article to install and configure everything, but it's a bit outdated, so it's better to use official documen...
[Fix] "VT-x is not available. (VERR_VMX_NO_VMX)" in VirtualBox
Sometimes you can get "VT-x is not available. (VERR_VMX_NO_VMX)" error if you are trying to start x64 bit virtual machine in VirtualBox. Failed to open a session for the virtual machine Windows 10 TP. VT-x is not available. (VERR_VMX_NO_VMX). Result Code: E_FAIL (0x80004005) Component: Console Interface: IConsole {8ab7c520-2442-4b66-8d74-4ff1e195d2b6} There are three most common reasons for this error: Your CPU doesn't support VT-x or AMD-V virtualization VT-x or AMD-V is not enabled in BIOS (UE...
Speedup Unity3d development with SSD
I was wondering if I move my Unity3d project from HDD to SDD, how it will improve performance? There are two possible cases. First, if you already have your system (with Unity3d editor) installed on SSD (I hope you do) and a second case is when you have only HDD (I hope you will buy SSD asap). To figure that out I made some simple tests I took a first computer with OS and programs installed on SSD and run all tests on a project which was located on HDD, then I moved the project to the SSD drive...
[How-to] Remove BlueStacks Ads (Sponsored Apps Popup)
Ты ж мой золотой
[Fixed] How-to recover iPhone from "Unicode of Death" SMS
As you probably know, you can send special SMS to the iPhone and after that this iPhone will be "dead". Not actually dead, recipient's UI system will crash, he will see a black screen for a while. After that, message app will be not working anymore. This is working not only with an SMS, but with other applications that can send push notifications. There is a defect in some UI elements in iOS which cause this crash if they want to display one latin, two Arabic, two Marathi and one Chinese symbol...
C# 6.0 Detailed Overview Of The New Features
C# 6.0 has a lot of great new features, which save developer's time and make code more clean and short. At the conclusion of the C# 6.0 series let's go through the whole list of the new C# 6.0 features again (all titles are active). Each article contains detailed explanation of the particular feature with resulted IL code and "old-school" way of doing the same things. String Interpolation var a = 1.2345; Console.WriteLine($"test {a}"); Console.WriteLine($"test {a} {a} {a}");...
C# 6.0 Expression-Bodied Methods
The last but not the least feature of the C# 6.0 that I am going to cover is expression-bodied methods. We all have experience writing single line methods: private string name; public override string ToString() { return "Name :" + name; } Now, we have shorter way of defining the same method: public override string ToString() => "Name: " + name; As you can see, now we can use lambda style to define method's body. But there is one difference from lambda expressions, we canno...
C# 6.0 Index Initializers
Hi, folks! Today we are gonna talk about new indexer initialization syntax introduced in C# 6.0. As we know, we already have good way to initialize dictionary: var dic = new Dictionary<string, int> { {"Apple", 2}, {"Pear", 10} }; but in C# 6.0 we have a better way to do the same: var dic2 = new Dictionary<string, int> { ["Apple"] = 2, ["Pear"] = 10 }; As for me, it is a bit nicer because we already have curly brackets in the beginning and endin...
C# 6.0 Exception Filters. try catch when
Exception filters is a new C# 6.0 feature. Visual Basic.NET and F# have this functionality for a long time. That is because exception filtering was implemented in CIL but not in C#. Now, this technique available for us. That's how you can use it: try { Method(); } catch (Win32Exception ex) when (ex.NativeErrorCode == 0x07) { // do exception handling logic } catch (Win32Exception ex) when (ex.NativeErrorCode == 0x148) { // do exception handling logic } catch (Exception) { // log unhandled excepti...
C# 6.0 Auto-Property Initializers
The next new feature of the C# 6.0 is auto-property initializers and get-only auto property. The main problem that they suppose to solve is immutable type declaration. Before C# 6.0, if you want to create immutable type with properties, you have no possibility to use auto property: public string Property { get; set; } So, you were forced to use regular get-only (read-only) property with read-only backing field: private readonly string prop; public string Prop { get { return prop; } } public Ctor...
C# 6.0 nameof Operator
C# 6.0 has a lot of new features, one of them is nameof operator. Let's see how it's implemented internally and what we can do with it. This operator will help us get rid of "magic strings" in our code. We all know following use case: public void Method(int arg) { if (arg < 0) { throw new ArgumentOutOfRangeException("arg"); } } With nameof operator we can rewrite code in a nicer way: public void Method(int arg) { if (arg < 0) { throw new ArgumentOutOfRangeException(nameof(arg));...
C# 6.0 Null Propagation Operators ?. and ?[]
C# 6.0 introduced two new null-propagation operators: ?. and ?[]. They will make null reference check much easier. In this article, we will see how they work and how they implemented internally. We all know about NullReferenceException and how to avoid it in our code. We just need to check everything for null before accessing some fields\properties\methods. Null Propagation Operator ?. var str = GetString(); if (str != null) { return str.Length; } else { return 0; } Now we can use Null Propagati...
C# 6.0 String Interpolation
One of the top ten requests on uservoice is String Interpolation. Today we are going to see how to use this feature and how it is implemented in C# 6.0. We all use similar expressions: var str = string.Format("Date: {0}", DateTime.Now); This is string interpolation in C# before 6.0. Now, in C# 6.0, we have new string interpolation technique: var str = $"Date: {DateTime.Now}"; There was nothing new added in to runtime, this is just a syntaxis sugar for "old shcool" interpolati...
Raspberry Pi 2 Benchmark. Linux vs Windows
I have installed Windows 10 on Raspberry Pi 2, then I have created a simple C# application for it. Now, I am curious what is the difference in performance between Windows 10 IoT Core and Raspbian. To test that I will run a simple C# code on both OS. Code I will do a simple calculation in a loop and will run this code in multiple threads. The amount of threads - 4, because Raspberry Pi 2 has 4 cores. This will load CPU up to 100%. I know that I am using different CLRs and different compilators, b...
Create C# Universal Application for Raspberry Pi 2
It is time to create our first C# Windows 10 Universal Application for Raspberry Pi 2. You can find LED blinking example in an official documentation, so today we are gonna create weather application. This application will connect to the remote server and get actual weather information based on city and country name, and display this information on a screen. Prepare your computer Download Visual Studio 2015 Community Edition RC Select Custom installation and enable Universal Windows Apps Develop...
Install Windows 10 on Raspberry Pi 2 from VirtualBox
Microsoft released Windows 10 for Raspberry Pi 2. Today I have got my board, so it is time to install Windows 10 on Raspberry Pi 2. As described in an official documentation you can install Windows 10 Core on SD card only from a physical machine with Windows 10. But today we will install Windows 10 on Raspberry Pi 2 from VirtualBox. Prepare VirtualBox Install Virtual Box (4.3.28 or newer) Install Virtual Box Extension Pack (from the same link) Download and install Windows 10 Enable USB 2.0 in US...
[Unity3d] Yet Another State Machine for Unity3d
If logic in your controller to complex for 'if' or 'switch\case' constructions, here is small State Machine implementation for you. Let's start with example how to use this state machine, and then we go through implementation details: public class Test : MonoBehaviour { private StateMachine stateMachine; private State firstState = new State(); private State secondState = new CustomState(); private State finishState = new State(); // Use this for initialization void Start () { var initChild = new...
[Unity3d] How-to play video in Unity project. MovieTexture
If you want to play movie clip in your Unity3d project you need to have Pro version! If you are using Windows machine you also need to have QuickTime installed. After you have everything prepared just drag (or copy) your movie clip into Asset folder, after that you will see it imported. You need a MovieTexture instance to use imported clip. To play movie clip use following code: MovieTexture movie; public void Play() { movie.Play(); } To stop or pause: movie.Pause(); movie.Stop(); You can access...
[vNext] ASP.NET 5 Dependency Injection with Autofac
In this part of the vNext tale, I am gonna tell you about dependency injection in ASP.NET 5 (vNext) stack. Default Dependency Injection container First, let's see what is shipped with ASP.NET 5 by default. There is already simple DI container. It gives you a possibility to register service with three different lifetimes: scope, singleton and transient. For now it supports only constructor injection. Let's see how to use it and what is the difference between these lifetimes. Create empty ASP.NET...
[Fixed] Cannot update Windows 10. Error 0x80246017
When I have tried to update Windows 10 (build 9926) to the latest build, I got following error: "There were some problems installing updates, but we'll try again later. If you keep seeing this and want to search the web or contact support for information, this may help - (0x80246017)" Solution Open regedit (ctrl + r -> regedit.exe) Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\Applicability Delete ThresholdInternal value Delete ThresholdOptedIn value Set ThresholdRiskLevel to l...
[Unity3d] ReadOnly InputField
New UI system was introduced in Unity3d 4.6, it includes InputField control, but this field could not be read only. You can make it non interactable by disabling "Interactable" property in the editor, but then you will not be able to select and copy text from InputField. To have proper ReadOnly input field you should do small modification to the original control: using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; [AddComponentMenu("UI/Read Only Input Field", 32)]...
Блогомарафон v2.0
Всем привет, Полтора года назад я провел блогомарафон, постил по одной записи каждый день в течении 30 дней, к сожалению, довести его до конца не получилось, на 24-й день я "забил". По окончанию марафона я сделал кое какие выводы. И как оказалось сделал я их довольно рано, ведь только спустя год я смог оценить результат по настоящему. На тот момент посещаемость была около 150 посетителей в день. Через год я имел 1500, и 80% посещений были на статьи написанные в тот, первый, блогомарафон. Ну а се...