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}");...
ReadOnly Input Field
Check out this asset on the Asset Store Features: You cannot type anything into InputField. Copy, select, and navigation functionality are working as before, but paste is disabled. Same look and properties as default InputField. Use: After importing asset in to the project you can use Create -> UI -> ReadOnly Input Field menu in Hierarchy view to add an element on the scene. Also, you can use Add Component -> UI -> ReadOnly Input Field menu in the Inspector to add a component to the...
Unity Assets
ReadOnly Input Field - UI control for new UI system.
Projects
Here is the list of my personal projects: HomeMoney - Win8 client for online home accounting service Sync Open Tabs - an opera extension that synchronize opened tabs between your computers urlHandler - open links in a program based on specified rules Unity Lens for torrents.net.ua Net Clipboard - implement network buffer for computers.
Advanced Tic Tac Toe
Advanced Tic Tac Toe Подробности (en) Download: Windows (.net 4.5) Web (js)
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% посещений были на статьи написанные в тот, первый, блогомарафон. Ну а се...
[Unity3d] WaitForFrames in Coroutine
If you are using Coroutines in Unity3d, you probably know about WaitForSeconds, WaitForEndOfFrame and WaitForFixedUpdate classes. Here is an example: public IEnumerator CoroutineAction() { // do some actions here yield return new WaitForSeconds(2); // wait for 2 seconds // do some actions after 2 seconds } But sometimes you need to wait for some amount of frames before executing some action. I have created simple class to help you with that: public static class WaitFor { public static IEnumerato...
[Решение] Ошибка "The ‘Microsoft.ACE.OLEDB.12.0′ provider is not registered on the local machine"
Причины проблемы: Microsoft.ACE.OLEDB.12.0 драйвер имеет две версии: x86 и x64. Эти две версии не могут быть установленные одновременно, соответственно если ваше .net приложение собирается под AnyCPU то в случае 64 битной системы оно будет пытаться использовать 64 драйвер, и наоборот. Решение: - В Configuration Manager установите сборку приложения под x86 платформу (BUILD > Configuration > Active > Solution > Platform > x86) - Установите x86 драйвер Microsoft.ACE.OLEDB.12.0 Альтер...