WebAssembly - The Next Step in Web Development

1
Comments
WebAssembly - The Next Step in Web Development

A long, long time ago, developers were using machine codes to program computers. It was hard to keep all of them in mind, easy to make a mistake, and almost impossible to read.  After struggling with machine codes, they created mnemonic codes to refer to machine code instructions aka Assembly language. The assembler was responsible for translating assembly language to machine codes.

Read further...

Loop Through The Diagonal Elements In Two Dimensional Array

0
Comments
Loop Through The Diagonal Elements In Two Dimensional Array

If you need to only loop through the diagonal elements of the two-dimensional array you can use the following C# code (but should be more or less the same for any programming language). It calculates the diagonal index based on a simple formula and has O(n) complexity, where n = max(width, height)

Read further...

Divbyte - Software Development Company

0
Comments
Divbyte - Software Development Company

I would like to share with everyone the project I have been working on for some time. Since I love solving problems, communicating with people, and programming (significantly more than 40 hours per week), and working on pet-projects became a bit boring, I decided to start helping real people with real problems.

Read further...

ZohoPeopleTimeLogger v1.4 - Smart filtering

0
Comments
ZohoPeopleTimeLogger v1.4 - Smart filtering

Changes: Show vacations only for currently logged in user (Previously, if you have access to other user's leave tracker you will see his days off as your vacation) Show only days off with Holiday and Sick type (Exclude 2hours short leave and others) Display leave type in calendar (Before was always Vacation, now Holiday or Sick) Download (GitHub) ZohoPeopleClient This C# library was also updated to v1.0.2. There are two new methods available in Fetch Record API: public enum SearchColumn { EMPLOY...

Read further...

ZohoPeopleTimeLogger v1.3 - Show me the error

0
Comments
ZohoPeopleTimeLogger v1.3 - Show me the error

At Novility, we have  found that we cannot log working time anymore. You just press "Make me happy" button and nothing :( When ZohoPeopleTimeLogger tries to make you happy it needs information about current jobs from ZOHO. For example, if I try to log time for January 16 and there is no job for this date I will get an error. But user was not able to see that error. That is fixed in release v1.3. Download GitHub User will see message box with detailed description and nice instructions:

Read further...

Build and test ASP.NET 5 application using AppVeyor

1
Comments
Build and test ASP.NET 5 application using AppVeyor

For those who do not know, AppVeyor is Continuous Integration and Deployment service for .NET projects. It is free for open-source projects. Currently, AppVeyor supports latest DNX version (1.0.0-rc1-final) and I've recently migrated my pet project to this version. I will show you how easy it is to build and run all unit tests on CI server every time you commit to GitHub. Visual Studio project (MSBuild) In LearnWordsFast project we are using Visual Studio 2015 as a development environment, so in...

Read further...

[ASP.NET 5] Lazy DBContext initialization with Entity Framework 7

2
Comments
[ASP.NET 5] Lazy DBContext initialization with Entity Framework 7

I will show you how to do lazy db context initialization with Entity Framework 7. The idea is simple, we need an easy way to get database context in a request. If db context was used in the request we should call SaveChanges method and dispose used context if not we shouldn't do anything. For "client", code should look like this: public class SomeRepository { private readonly IDbContext _db; public SomeRepository(IDbContext db) { _db = db; } public void Add(Item item) { _db.Current.Items.Add(ite...

Read further...

[WPF][MVVM] TreeView: Scroll To Selected Item

0
Comments

Here is the MVVM way to bring selected TreeViewItem into a view. First we need an attached behavior. We cannot use regular behavior because we will attach this property through Style. public class BringSelectedItemIntoViewBehavior { public static readonly DependencyProperty IsBringSelectedIntoViewProperty = DependencyProperty.RegisterAttached( "IsBringSelectedIntoView", typeof (bool), typeof (BringSelectedItemIntoViewBehavior), new PropertyMetadata(default(bool), PropertyChangedCallbac...

Read further...

ZohoPeopleTimeLogger v1.1 Even Smarter Than Before

0
Comments
ZohoPeopleTimeLogger v1.1 Even Smarter Than Before

Yes! It finally happened. New version of ZohoPeopleTimeLogger released :) Download In ZohoPeopleTimeLoger v1.1 you don't need to think about your time tracking at all! This smart program will do everything for you. Do you have any booked vacation in this month? Not a problem. Press "Make me happy!" button and ZohoPeopleTimeLogger will fill all days in this month except vacations   The same with public holidays! It will leave them empty... But, wait for this..... You can now fill in a single...

Read further...

ZohoPeopleTimeLogger v1.0.0 Keep Your Time Tracker Up-To-Date

0
Comments
ZohoPeopleTimeLogger v1.0.0 Keep Your Time Tracker Up-To-Date

Are you tired of filling in monthly time reports in Zoho People because of it's stupid UI? Then ZohoPeopleTimeLogger is just a right solution for you. Only one button which will make you happy! One click and you are done!   How does it work? ZohoPeopleTimeLogger will automatically find Job that is relevant for the selected month and will fill each empty day with 8 non-billable hours. That's all! If you don't need any of those days, just press a delete button... Easy, right? So why do you st...

Read further...

C# 6.0 await in catch/finally

2
Comments
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(); }...

Read further...

C# 6.0 Detailed Overview Of The New Features

0
Comments
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}");...

Read further...

C# 6.0 Index Initializers

0
Comments
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...

Read further...

C# 6.0 Exception Filters. try catch when

0
Comments
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...

Read further...

C# 6.0 Auto-Property Initializers

0
Comments
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...

Read further...

C# 6.0 nameof Operator

1
Comments
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));...

Read further...

C# 6.0 String Interpolation

0
Comments
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...

Read further...

Raspberry Pi 2 Benchmark. Linux vs Windows

4
Comments
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...

Read further...

Create C# Universal Application for Raspberry Pi 2

1
Comments
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...

Read further...

[Unity3d] Yet Another State Machine for Unity3d

0
Comments

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...

Read further...

[Unity3d] How-to play video in Unity project. MovieTexture

3
Comments
[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...

Read further...

[vNext] ASP.NET 5 Dependency Injection with Autofac

1
Comments
[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...

Read further...

[Unity3d] ReadOnly InputField

1
Comments
[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)]...

Read further...

[Unity3d] WaitForFrames in Coroutine

1
Comments
[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...

Read further...

[How-to] Record sound in .NET application

0
Comments

First import mciSendStringA from winmm.dll: [DllImport("winmm.dll", EntryPoint = "mciSendStringA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] private static extern int mciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback); To start recording: mciSendString("open new Type waveaudio Alias recsound", null, 0, 0); mciSendString("set recsound time format ms bitspersample 16 channels 2 samplespersec...

Read further...

[How-To] Horizontal Field Of View for Unity3d camera

0
Comments

In Unity3d you can change only vertical field of view for a camera by default. This means whenever you change height unity will automatically scale environment. But if you change width unity will just add some space (or decrease) to left and right side of the screen (no content resizing). If you want to have opposite behavior, so when you increase width all content will  be scaled and if you increase height only space added to the view, you need to modify camera fieldOfView field. Here is a simp...

Read further...

Enity Framework "column in table is of a type that is invalid for use as a key column in an index"

1
Comments

After adding Index attribute with IsUnique set to true for string value in my code first model [Index(IsUnique = true)] public string Email { get; set; } , I've tried to update my database, but got following error: "column in table is of a type that is invalid for use as a key column in an index". I've got this error because unique constraint can't be over 8000 bytes per row and will only use the first 900 bytes even then so the safest maximum size for my field would be 450 characters. To add th...

Read further...

DruMor. Спасибо что живой

0
Comments
DruMor. Спасибо что живой

Был первый день февраля 2010 года. Вечер. На улице осенняя погода, температура около нуля. В теплой "двушке", попивая горячий чай, скучали два молодых парня. От скуки и родился проект DruMor.  01-02-2010 Киндиров Начался наш youtube проект с песни о нашем знакомом. Слова - совместный продукт людей знающих Киндирова не по наслышке. Музыка - Моргота. Ролик был залит на youtube и вконтакте, где его заценили наши друзья. http://www.youtube.com/watch?v=g7IfJT7uoVQ&width=450 02-02-2010 Садок вишне...

Read further...

Advanced Tic Tac Toe final release

0
Comments
Advanced Tic Tac Toe final release

Сегодня состоялся последний плановый релиз замечательной стратегической игры Advanced Tic Tac Toe. В этом релизе добавлена подсветка последнего хода противника, страница описывающая правила игры и немного информации о нашей замечательной комманде ;) Но на этом мы не заканчиваем, у нас еще полно идей и желания для реализации будущих проектов. Advanced Tic Tac Toe был проектом для "разогрева" и он с ним справился. Теперь он переходит в стадию поддержки (громко сказано :-)). Спасибо всем за внимани...

Read further...

Играй с друзьями в Tic Tac Toe Advanced

0
Comments
Играй с друзьями в Tic Tac Toe Advanced

Сегодня выпущено первое обновление Tic Tac Toe Advanced - игры в крестики-нолики для продвинутых. Теперь вы можете обыгрывать ваших друзей и близких в этой увлекательно стратегической игре :) Вы можете заметить что в игре появилась возможность регистрироваться, но вход пока что не работает, в ближайшем будущем мы доделаем данный функционал и вы сможете полноценно наслаждаться игрой и следить за своей статистикой и успехами друзей. Приятной игры

Read further...

Tic Tac Toe Advanced - web edition

3
Comments
Tic Tac Toe Advanced - web edition

Доброй ночи, Не зря были прожиты два выходных дня. Рады представить вам Tic Tac Toe Advanced web edition. Теперь поиграть в увлекательную игру можно с любого девайса у которого есть доступ в интернет, нормальный браузер и включенный java script. Над первой версией js игры в альтернативные крестики нолики, не покладая рук, трудились Андрей Сташук и Иван Деревянко :) Пока что реализован базовый функционал игры. Регистрация\авторизация будет доступна в следующей версии (вы можете регистрироваться и...

Read further...

Первый релиз Tic Tac Toe Advanced

0
Comments
Первый релиз Tic Tac Toe Advanced

[caption id="attachment_479" align="alignleft" width="300"] TicTacToe[/caption] После прочтения поста на Хабре об Альтернативных крестиках-ноликах захотелось реализовать приложение для сетевой игры. После недолгих обсуждений с друзьями, было решено написать WCF сервис и клиенты под самые популярные платформы. Пишем дружной командой, встречайте: Ярослав Потушинский Артем Дяченко Андрей Левин Андрей Сташук Иван Деревянко На данном этапе готов сервер и клиент под Windows. Приятной игры :) Windows к...

Read further...

How to determine if user connected to UltraVNC server

0
Comments

To check if user connected to UltraVNC server you should enable logging in ultravnc.ini: DebugMode=2 Then you just need to read log file and check if this file contains string "vnchttpconnect.cpp : HTTP client connected" for http connections and "vncclient.cpp : client connected" for VNC client connections. C# example that wait for incoming http or vnc connection during localTimeout period: bool isUserConnected = false; var startTime = DateTime.Now; localTimeout = 10000; do { using (var fileStre...

Read further...

Synchronize opera tabs

0
Comments
Synchronize opera tabs

Hello all, If you want to synchronize opened tabs in opera, you can notice that opera can't do this... I would like to introduce you Sync Open Tabs - extension for opera that synchronize opened tabs using Opera Link notes. You just need to install this extension, enter computer name and get opera link verifier code (see detailed instruction). This is first version, so it can contain bugs. If you find any bugs please inform me (drussilla7@gmail.com).

Read further...

C# аналог Perl Crypt::DES

0
Comments

Доброго времени суток! Довелось мне на днях написать метод генерации зашифрованного пароля для UlrtaVnc. Писать необходимо было на C#. Погуглив, нашел реализации алгоритма шифрования на Perl и Python. Шифруется все алгоритмом DES. На Perl это выглядит так: my $realkey = pack ('H16', "E84AD660C4721AE0"); my $cipher = Crypt::DES->new($realkey); my $password = "test"; my $cryptpass = $cipher->encrypt($password); Но вот с переводом данного кода на C# пришлось пово...

Read further...

Русский язык в Qt приложениях

1
Comments

Столкнулся я с проблемой кодировки русских символов в Qt приложениях под linux(под винду еще не проверял). В Qt Creator все нормально отображается, файл сохранен в utf-8, но при запуске приложения я видел какозабли. Пробовал перекодировать сам исходник, не помогало. И вот потом я наткнулся на вот эту статью и нашел решение проблемы. Нужно подключить заголовочный файл QTextCodec и использовать вызов статического метода setCodecForTr() или setCodecForCStrings() класса QTextCodec. Первый метод прим...

Read further...

xneur: переключение двух раскладок по ctrl

0
Comments

xneur: переключение двух раскладок по ctrl На компьютере я всегда использовал три раскладки Английскую (как основную), Русскую, и Украинскую. Когда я сидел на винде, то активно использовал punto switcher, и не для того чтобы он мне мог автоматом переключать раскладки, а для быстрой смены двух раскладок по нажатию на левый control а также для переключение раскладки выделенного по хоткею. Смена раскладок в винде у меня была выставлена на Shift+Ctrl, а в настройках Пунто Свитчера стояла галочка "То...

Read further...