Changing the font size of the ‘Syntaxhighlighter’ plugin

Syntaxhighlighter is a GREAT plugin for posting code samples on your website.

I know because I use it on here.

My only minor gripe was in the size of the actual font itself – it was too large for my own preference.

Modifying the size is simple, and I’m going to post it here for future reference.
Continue reading ‘Changing the font size of the ‘Syntaxhighlighter’ plugin’ »

Windows programming using MinGW

A short example of how to started with Windows programming in non-Visual Studio environments.

In this example, we use the MinGW (Minimalist GNU for Windows) compiler within the Code::Blocks integrated development environment.

MinGW can be obtained via the following link:

http://www.mingw.org/

First select File > New > Project… and opt to create a new empty project:
Continue reading ‘Windows programming using MinGW’ »

Creating and avoiding deadlock conditions in C++

A short and to-the-point post illustrating how a deadlock situation can be created in C++, together with a possible strategy for avoiding such a condition.

I’m am using the boost libraries to implement threads and mutexes, but it should be possible to the standard library implementations std::thread, std::mutex etc as well.
Continue reading ‘Creating and avoiding deadlock conditions in C++’ »

Using sc.exe to communicate with Windows Services in Visual C++

SC.exe is commonly used to retrieve and set control information about installed Windows services. Common tasks are to configure, start and stop a service, as well as retrieve the status of a specific service. These tasks can be achieved by executing sc.exe inside a command prompt as a batch (.bat) files that can call combinations of sc.exe commands to automate startup or shutdown of services.
Continue reading ‘Using sc.exe to communicate with Windows Services in Visual C++’ »

Getting started with client-server applications in C++

A demonstration of simple Internet client-server applications in C++ (Linux-based).

The client application tries to connect to the remote server application using the IP address of the remote server (‘localhost’ or 127.0.0.1) and the server port number which defaulted to 1234.

The server application listens to port number 1234 for a connection request. When the server application receives the connection request it sends the text message “Hello!\r\n” to the client.
Continue reading ‘Getting started with client-server applications in C++’ »

Configuring Code::Blocks to use OpenCV in Linux Environments

A quick guide to setting up and installing OpenCV for using in the Code::Blocks integrated development environment in Linux. The version of Linux I am currently using is Ubuntu 14.04. At the time of writing the version of OpenCV for Linux used is 2.4.9. (I had originally tried version 2.4.10 but had problems compiling it with the version of gcc I had (4.8.2), so I reverted to 2.4.9 instead.) Continue reading ‘Configuring Code::Blocks to use OpenCV in Linux Environments’ »

Configuring Code::Blocks to use the Boost Libraries in Windows and Linux

Some examples of how to configure Code::Blocks to use the Boost C++ libraries:

1. Header-only (Windows)
2. Compiled libraries (Windows)
3. Compiled libraries (Ubuntu Linux)

1. Header-only (Windows)

To configure Code::Blocks to use a header-only Boost library: Boost.DateTime. Select File > New > Project > Empty Project:

CodeBlocks1
Continue reading ‘Configuring Code::Blocks to use the Boost Libraries in Windows and Linux’ »

Obtaining Media File Information in Visual C++ Using FFPROBE

A short demonstration on how to utilize the ffprobe command to extract information about media files such as wav / MP4 files.

The ffprobe executable comes with the complete ffmpeg package and can be obtained from here:

https://www.ffmpeg.org/

Once downloaded and installed, the ffprobe executable resides alongside the ffmpeg and ffplay executables as shown:

ffmpeg1
Continue reading ‘Obtaining Media File Information in Visual C++ Using FFPROBE’ »

Serializing data in MFC / Visual C++

This post shows you how to utilize the built-in file handling capabilities that MFC has in order to serialize your data, that is, how to read from or write to a disk.

Using the MFC document object

One way is to use the MFC document object to do the serializing for you. This will be demonstrated by creating a simple SDI (single document interface) using the AppWizard.

Select File > New > Project and select the Visual C++ > MFC Application as the choice of installed template:

SerializeSDIexample1
Continue reading ‘Serializing data in MFC / Visual C++’ »