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

[ASP.NET 5] Production Ready Web Server on Linux. Kestrel + Supervisord

2
Comments
[ASP.NET 5] Production Ready Web Server on Linux. Kestrel + Supervisord

In the previous article I've used nohup + su + init.d script to run kestrel in a background. But as Daniel Lo Nigro suggested in comments it's much easier to do the same with Supervisor And he was absolutelly right, config is much smaller, and you can easelly see status and output of a program. First, install supervisor: sudo apt-get install supervisor Now you can create config for your application: sudo nano /etc/supervisor/conf.d/kestrel_default.conf With following content: [program:kestrel_de...

Read further...

ZohoPeopleTimeLogger v1.2 - Special for Andre

0
Comments
ZohoPeopleTimeLogger v1.2 - Special for Andre

Because Andre is so special, the previous version of ZohoPeopleTimeLogger was not working with his account. I've fixed couple issues in the program to make him happy. Now, my friend, you can enjoy this lovely program! This release (v1.2) is dedicated to you! Download Now seriously! There was a small issue in a way I got information from zoho. I used user email to get user specific data (time log) but as I found out it is case sensitive, so Andre@something.com and andre@something.com are differen...

Read further...

[C#] Zoho People Client Library

0
Comments
[C#] Zoho People Client Library

 Zoho People Client v1.0.0 released. ZohoPeopleClient - C# asynchronous client library to interact with the Zoho People API. Supported API TimeLogAPI (Get/Add/Delete) JobsAPI (Get) LeaveAPI (GetHolidays) FetchRecordAPI (Get) NuGet Package Source Code GitHub Current Release Build Status Examples Sign in with login and password var client = new ZohoClient(); var token = await client.LoginAsync(login, password); // save token for further use Sing in with token // load token from storage var client...

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

[Windows 10] VIDEO_SCHEDULER_INTERNAL_ERROR after wake up

49
Comments
[Windows 10] VIDEO_SCHEDULER_INTERNAL_ERROR after wake up

I have installed new Windows 10 on my PC, everything was fine until I decided to put my computer in to a sleep mode. After a while I turn on my computer and got my first BSOD. That was VIDEO_SCHEDULER_INTERNAL_ERROR. After this error, I have tried to update my chipset and video drivers, that didn't work. Then I have disabled Inter Rapid Start Technology in BIOS, result is the same - still BSOD after returning from the sleep mode. Probably this is driver issue, so now I am waiting for a fix from...

Read further...

[Fix][Windows 10] ctrl+c / ctrl+v not working in cmd.exe

2
Comments
[Fix][Windows 10] ctrl+c / ctrl+v not working in cmd.exe

After installing Visual Studio 2015 on my fresh Windows 10, I've figured out that ctrl+c \ ctrl+v not working anymore in command prompt (cmd.exe) For some reason, VS has put my cmd.exe in the legacy mode. To fix that: Open cmd.exe Right click on a windows header Go to Properties  Option tab Deselect Use legacy console Close cmd.exe

Read further...

"The system has returned from a low power state." in the middle of the night

0
Comments

When I'm done working with my computer, I usually put it in a sleep mode. But recently (probably after some windows update), in the morning my computer was always on. Reason First I checked Event Viewer and found following record: The system has returned from a low power state. Sleep Time: ‎2015‎-‎07‎-‎29T20:54:24.378170500Z Wake Time: ‎2015‎-‎07‎-‎30T02:18:17.109989000Z Wake Source: Timer - Windows will execute 'NT TASK\Microsoft\Windows\TaskScheduler\Regular Maintenance' scheduled ta...

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

OpenCart Weight Shipping With Tracking Code

1
Comments
OpenCart Weight Shipping With Tracking Code

For a MintChocolate store I was asked to add one additional delivery option: Shipping with tracking code. I have looked for a free extension with such functionality but wasn't able to find a proper one. So I've decided to create such extension. Now, we are using weight based delivery, so I just copied existing shipping option and modified it based on our requirements. To create new shipping method you can copy following files:  \admin\language\english\shipping\<name>.php \admin\controller\...

Read further...

Блогомарафон v2.0. Статистика. Результаты. Выводы

0
Comments
Блогомарафон v2.0. Статистика. Результаты. Выводы

Вот и закончился блогомарафон v2.0. Не просто было 30-ть дней подряд писать по одной статье, но я справился :) С результатами марафона можно ознакомиться по тегу блогомарафон. Теперь пришло время проанализировать результаты, сделать небольшие выводы и поделиться впечатлениями. Первое что приходит в голову после месяца написания статей, порой очень тяжело найти тему для очередного поста. Ну просто не реально тяжело. Не особо хочется просто копипастить чужие статьи, хочется написать о чем-то интер...

Read further...

[ASP.NET 5] Production Ready Web Server on Linux. Run Kestrel In The Background

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

Read further...

[Fix] Error "Status: 0xc00000e9" in Windows 7, Windows 8, Windows 10

0
Comments

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

Read further...

AdSense Consultation. How It Works

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

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

[Raspberry Pi 2] Create C# Background Application for Windows 10 IoT Core

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

Read further...

[Raspberry Pi 2] Enable Headless Mode on Windows 10 IoT Core

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

Read further...

[vNext] ASP.NET 5 Automatic Migrations with Fluent NHibernate

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

Read further...

[BlueStacks] How to kill process after exit

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

Read further...

[ASP.NET 5] Production Ready Web Server on Linux. Kestrel + nginx

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

Read further...

[Fix] "VT-x is not available. (VERR_VMX_NO_VMX)" in VirtualBox

34
Comments
[Fix]

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

Read further...

Speedup Unity3d development with SSD

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

Read further...

[Fixed] How-to recover iPhone from "Unicode of Death" SMS

0
Comments
[Fixed] How-to recover iPhone from

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

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

ReadOnly Input Field

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

Read further...

Projects

0
Comments

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.  

Read further...

C# 6.0 Expression-Bodied Methods

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

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 Null Propagation Operators ?. and ?[]

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

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

Install Windows 10 on Raspberry Pi 2 from VirtualBox

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

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

[Fixed] Cannot update Windows 10. Error 0x80246017

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

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

Блогомарафон v2.0

0
Comments
Блогомарафон v2.0

Всем привет, Полтора года назад я провел блогомарафон, постил по одной записи каждый день в течении 30 дней, к сожалению, довести его до конца не получилось, на 24-й день я "забил". По окончанию марафона я сделал кое какие выводы. И как оказалось сделал я их довольно рано, ведь только спустя год я смог оценить результат по настоящему. На тот момент посещаемость была около 150 посетителей в день. Через год я имел 1500, и 80% посещений были на статьи написанные в тот, первый, блогомарафон. Ну а се...

Read further...

[Unity3d] WaitForFrames in Coroutine

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

[Решение] Ошибка "The ‘Microsoft.ACE.OLEDB.12.0′ provider is not registered on the local machine"

0
Comments

Причины проблемы: 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 Альтер...

Read further...

[vNext] Use PostgreSQL + Fluent NHibernate from ASP.NET 5 (DNX) on Ubuntu

7
Comments
[vNext] Use PostgreSQL + Fluent NHibernate from ASP.NET 5 (DNX) on Ubuntu

In the previous part we have installed APS.NET 5 application on Ubuntu, now we are gonna install and configure PostgreSQL on Ubuntu and access database from our application through NHibernate. Install and configure PostgreSQL First, install PostgreSQL: sudo apt-get install postgresql postgresql-contrib Next, set root password: sudo -u postgres psql postgres \password postgres And then create test database: sudo -u postgres createdb mydb Add Fluent NHibernate to the application Open project.json...

Read further...

How-to Restore WordPress Site

0
Comments

In conclusion of "How-to Backup WordPress Site" article, here is small instruction to restore your backup: Upload files to VPS Upload you www.tar.gz and database.sql to the new VPS. You can use WinSCP (as described here) Extract www file structure Extract files: tar -xvf www.tar.gz And copy files: cp -a www/oldsite.com/www/* /var/yoursite.com/www Change permissions: cd /var/yoursite.com/www chown www-data:www-data -R * find . -type d -exec chmod 755 {} \; find . -type f -exec chmod 644 {} \; Cre...

Read further...

[vNext] Install ASP.NET 5 (DNX) on Ubuntu

10
Comments
[vNext] Install ASP.NET 5 (DNX) on Ubuntu

ASP.NET MVC application on Linux? Easy! As you may know, Microsoft recently released a lot of their products under MIT license. .NET Core runtime, .NET CoreFX, ASP.NET 5, MVC 6, Entity Framework 7, MSBuild, everything is now available on GitHub. Our goal is: run Asp.Net MVC application with postgresql database on ubuntu server Today we are gonna start with setting up .NET environment. In the new asp.net stack you can choose between full .NET runtime and .NET Core. For now .NET Core has a lot of...

Read further...

[Fix] VT-x is not available. (VERR_VMX_NO_VMX)

1
Comments

I got this error after installing Visual Studio 2015 CTP 6 with Windows Phone 8.1 emulator. Sometimes  you can get this error if you turned off VTx or AMDv in bios. So, first things to do is: make sure that Virtualization is enabled in bios. Next - turn off Hyper-V. After installing Visual Studio with emulator it automatically turn Hyper-V on. And, apparently, Virtual Box cannot work together with Hyper-V. Run cmd.exe as administrator Execute command dism /online /disable-feature /featurename:Mi...

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

Windows 10 Technical Preview Build 9926

0
Comments
Windows 10 Technical Preview Build 9926

As you know Microsoft released new version of Windows 10. Now you can update your current system to Windows 10 Technical Preview for free. I have installed this version (build 9926) on Virtual Box. Here is a small review: First impression First impression was bad. After installing Windows 10 I want to start internet explorer to check how it works, but I have found out that you cannot search in start menu anymore. What a fuck? I am used to using this operation so much! Whenever I want to start a ...

Read further...

How-to Backup Wordpress Site

1
Comments

Here are two commands to backup your wordpress site. First you need to backup database: mysqldump -uUSER -h127.0.0.1 -pPASSWORD DB_NAME > database.sql Now you can archive www root folder: tar -chvzf www.tar.gz /var/site.com/www After this manipulations you can copy this two files to the same place. How to Restore WordPress Site

Read further...

Идея заработка в интернете. Выводы

1
Comments
Идея заработка в интернете. Выводы

Чуть больше года назад я писал о идеи заработка в интернете. С момента начала у меня завелось 5 сайтов с контентом который я копировал с других сайтов (где это разрешено правилами и лицензией). Заработок вырос до 200$ в месяц. Но! Настал тот день когда мой аккаунт в Google AdSense заблокировали: А за пару дней до этого google забанил один из сайтов (sevennet.org) из поисковой выдачи за не уникальный контент: И действительно, почитав правила и гайдлайны я увидел там пункты запрещающие постить не...

Read further...

[Fix] Call to undefined function imagecreatefromgif()

0
Comments

If you get following error: Call to undefined function imagecreatefromgif() You just need to install right version of GD. After 2.0.28 gif support was reverted back. To fix this error: sudo apt-get install php5-gd If you are using nginx with php5-fpm do: sudo /etc/init.d/php5-fpm restart

Read further...

[WPF] Binding ItemsSource to Enum

2
Comments

Suppose you need to bind ItemsSource dependency property to enum's values. For example in ComboBox. You have following enum: public enum ExampleEnum { Red, Green, Yellow } Now you can use ObjectDataProvider <Window x:Class="ExampleApplication.Window" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:System="clr-namespace:System;assembly=mscorlib" xmlns:local="clr-namespace...

Read further...

Результаты первого дня

0
Comments
Результаты первого дня

Вчера я написал о начале маленького проекта по привлечению средств на помощь нашей армии, и уже сегодня видны результаты: 17$ за один день, это 340 грн по текущему курсу привата. И это в выходной день! Обычно в выходной день у меня было не больше 2$! (в будние дни ~10$) НО! Не нужно клацать на рекламу (ну только если она вам интересна)! Так как Google может заблокировать аккаунт если увидит подозрительную активность (а сегодня она была таковой) Наша цель сделать сайты популярнее для поисковиков,...

Read further...

Как ВЫ можете помочь воинам Украины!

0
Comments
Как ВЫ можете помочь воинам Украины!

Не хочу вдаваться в полемику о том почему началась и так на долго затянулась война, почему руководство страны принимает такие, а не другие, решения. Кому выгода или нет война на востоке Украины. Но есть неоспоримые факты: Призывают служить обычных людей. Наших с вами соседей\знакомых\друзей\родных Обеспечение нашей армии оставляет желать лучшего (и это мягко сказано) Как результат имеем просто нищенские условия существования людей на передовой. Нет теплых вещей, нет аптечек, нет обмундирования,...

Read further...

Migrate Wordpress site from OpenShift to VPS

2
Comments
Migrate Wordpress site from OpenShift to VPS

For all my new sites, I'm using free OpenShift account. But it is not 100% stable. Now, I have 5 sites located on OpenShift, and at least once a week, I need to restart one of them (usually it's error 503). So, when number of visitors on sevennet.org exceeded 4000 per day I have decided to move this wordpress blog to my VPS. Here is a small instruction how to do that Prepare your VPS\VDS On your VPS you should have nginx\apache with php and mysql installed. I would recommend you to change apache...

Read further...

[Fixed] [ERROR] /usr/sbin/mysqld: unknown variable 'log_slow_verbosity=query_plan'

3
Comments

Error during installing MySQL server 5.5 on Ubuntu 14.04 I got following error when try to install mysql-server-5.5 on ubuntu 14.04: [ERROR] /usr/sbin/mysqld: unknown variable 'log_slow_verbosity=query_plan' After that I got start: Job failed to start To fix that: open /etc/mysql/my.cnf for edit and comment following string log_slow_verbosity=query_plan Then start installation from scratch: sudo apt-get install mysql-server

Read further...

How to connect to OpenShift with putty (ssh)

7
Comments
How to connect to OpenShift with putty (ssh)

I'm hosting 5 of my sites on OpenShift. Sometimes I need to connect to my applications through ssh. On Windows, I'm using putty to do that. Here is small "how-to" about connecting to the OpenShift application. First, you need a private and a public keys. To generate them you need puttygen Open puttygen and press generate:   Move your mouse in "Key" area until progress bar is full. Then type your passphrase and press save private key. Also, copy all text from Public key section (starts from...

Read further...

How to check if AdBlock is enabled

1
Comments

Here is the simplest way to check if AdBlock is enabled on your site: First of all you should create simple javascript file with following content: var isAdsDisplayed = true; Name it adsbygoogle.js and upload to your web server. Then on the page where you want to check if AdBlock is enabled or not just add the following script: <script src="/js/adsbygoogle.js"></script> <script> if(window.isAdsDisplayed === undefined ) { // AdBlock is enabled. Show message or track cu...

Read further...

Статистика блога 2014, или можно ли заработать в интернете?

0
Comments
Статистика блога 2014, или можно ли заработать в интернете?

Вот и пролетел еще один год, 2014-й... Год выдался ммм.... как сказать.... нестандартным. Были как плохие моменты так и хорошие. Будем наедятся что в 2015 будет больше хорошего и меньше плохого. Но пост не об этом. Еще один год в истории моего персонального блога. Собственно, статистикой этого блога я и хотел бы с вами поделиться. Возможно кого-то это вдохновит на создание свое блога\сайта\портала и т.д. Итоги года: рост посещаемости на 500%, переезд на новый домен и рост прибыли в 10 раз На нач...

Read further...