Using Visual Leak Detector with MS Visual Studio 2013

Go to Tools->Extensions and Updates, download and install Using Visual Leak Detector:

Using Visual Leak Detector

Create a header file, named, for example, CommonTools.h containing the following:

#pragma once

#include "C:\Program Files (x86)\Visual Leak Detector\include\vld.h" 

#pragma comment(lib, "C:\\Program Files (x86)\\Visual Leak Detector\\lib\\Win32\\vld.lib")

Include CommonTools.h in at least one file in all the C++ projects in your solution. Build debug version of the program. Visual Leak Detector will write the information on memory leaks to Output window when the program exits.

HwndHost is not clipped inside ScrollViewer

I created a simple white control with a black border derived from HwndHost (named LightGrid) and added it to ScrollViewer along with some other controls (replaced with “…”) as shown below:

<ScrollViewer HorizontalScrollBarVisibility="Disabled">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            ...
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            ...
        </Grid.RowDefinitions>
        ...
        <Border Grid.Row="6" Grid.ColumnSpan="2" Visibility="Visible" Height="200">
            <nc:LightGrid />
        </Border>
    </Grid>
</ScrollViewer>

It looks correctly in the lower scroll position, and it even can scroll inside ScrollViewer (it moves when I move the scroll bar), but when scrolled, it is not clipped so it obscures other controls:

(more…)

How I fixed “error LNK2005: _DllMain@12 already defined in msvcrtd.lib”

Today I got “error LNK2005: _DllMain@12 already defined in msvcrtd.lib” while linking some C++ CLI project with MFC support in MS Visual Studio 2013. As described in A LNK2005 error occurs when the CRT library and MFC libraries are linked in the wrong order in Visual C++A LNK2005 error occurs when the CRT library and MFC libraries are linked in the wrong order in Visual C++ article, I added /verbose:lib linker option:

MS Visual Studio Linker options

(more…)

Combining XAML and DirectX together in a WinRT application

With the release of Windows 8, Microsoft introduced a grate technology for combining XAML and DirectX together, letting us to place XAML controls over intensive real-time graphics, see DirectX and XAML interop (Windows Runtime apps using DirectX with C++) for more details.

You can easily download and build sample XAML SwapChainPanel DirectX interop sample demonstrating how it works. All that you need is Visual Studio 2013 with installed license. After the license is installed Visual Studio 2013 shows the following dialog:

Visual Studio 2013 license

(more…)

How to install Java Plug-in for FireFox browser on Windows

Probably it is a trivial question, but the answer is not always obvious. The main rule is to follow the right link like this: https://www.java.com/en/download/help/firefox_online_install.xml. As the result you will get:

JavaPlugin for FireFox

To check if it works or not follow this link: http://java.com/en/download/installed8.jsp.

What browser can work with Joomla 1.5 administrator panel?

Today I updated my FireFox browser and Joomla 1.5x administrator panel stopped working in it. Looks like Joomla 1.5x administrator panel contains some staff that prevents it from working in all modern browsers except Internet Explorer, or at least Internet Explorer is the only browser that displays message “Only secure content is displayed.” and button “Show All Content” enabling some insecure mode. To eliminate the need of pressing this button each time I open new page in administrator panel I went to “Internet Options->Security Tab->Miscellaneous->Display mixed content” and chose “Enable”:

enabling some insecure mode in IE

How to install updates to MS Visual Studio 2013

Select from the main menu of VS 2013 Tools->Extensions and Updates and in opened dialog press Update button under Product Updates:

updates to MS Visual Studio 2013

it will start downloading an installation file. When download completes close Visual Studio and run the installation file.

How to find files by permission on Ubuntu

Today I accidentally changed permissions of all the files in some folder /usr/lib/git-core with the following command:

chmod o-rx *

At first I thought that I have broken my system, but in few minutes I remembered that I have the same distribution on some other machine, I listed the same folder on this machine and used the following commands to restore original permissions:

chmod o+rx *
find -maxdepth 1 -type f -perm 645 -exec chmod o-x {} \;

645 means the files that initially were -rw-r–r— and became -rw-r–r-x. This two commands saved me a lot of time. After that I even count the number of files with all permission combinations:

find -maxdepth 1 -type f -perm 644 | wc -l
find -maxdepth 1 -type f -perm 755 | wc -l
find -maxdepth 1 -type f -perm -o=x | wc -l

Installing Git on Ubuntu 12.04 and enabling HTTP access with Nginx

Git is a good alternative for developers who need a version control supported on both Windows and Linux platforms. Below I provided basic steps for installing Git on Ubuntu 12.04 and enabling HTTP access to the repositories with Nginx web server.

Installing required packages

First, we need to install Nginx and Git packages:

apt-get install nginx git

by default Nginx processes will run as www-data, (check “user” keyword in /etc/nginx/nginx.conf configuration file). Git installation has not created any user yet.

(more…)

Installing Jabber Messaging Service on Ubuntu 12.04

Ejabberd (Jabber daemon written in Erlang programming language) can be easily installed on Ubuntu 12.04 Server (Precise Pangolin) with the following command:

apt-get install ejabberd

The only steps needed to make Ejabberd work after the installation are to specify admin user and hostname in /etc/ejabberd/ejabberd.cfg file:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Options which are set by Debconf and managed by ucf

%% Admin user
{acl, admin, {user, "admin", "developernote.com"}}.

%% Hostname
{hosts, ["developernote.com"]}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(more…)