Posts

Showing posts from September, 2012

Getting started with Qt in Ubuntu Linux

Image
A quick recipe on how to get started with Qt in Ubuntu Linux using a simple example program. 1. Obtain QT4 Run these from the command line: [code language="text"] $ sudo apt-get update $ sudo apt-get install libqt4-dev qt4-qmake cmake r-base-dev libcurl4-gnutls-dev [/code]

Factory Patterns in C++

In a nutshell, the factory design pattern enables the practitioner to create objects that share a common theme but without having to specify their exact classes. In essence the factory pattern is used to " Define an interface for creating an object, but let the classes that implement the interface decide which class to instantiate. The Factory method lets a class defer instantiation to subclasses. "

How to interface with Excel in C++

Image
Interfacing Excel in C++ is task that I needed to overcome recently, so I thought I would post some code and instructions on the said topic. Some online articles that I found to be useful include the following:

STL Set Operations

A summary with code samples of the set operations that come with STL: union, intersection, symmetrical difference and set difference. For consistency, the two sets of integer vectors used in each example are the same and are: [code language="cpp"] vals1 = { 1, 2, 4 } vals2 = { 1, 2, 5, 7 }; [/code] Unions The union of two sets is formed by the elements that are present in either one of the sets, or in both. [code language="cpp"] #include <iostream> #include <algorithm> #include <iterator> #include <string> #include <vector> typedef std::vector<int>::iterator iter; template<typename T, typename InputIterator> void Print(std::ostream& ostr, InputIterator itbegin, InputIterator itend, const std::string& delimiter) { std::copy(itbegin, itend, std::ostream_iterator<T>(ostr, delimiter.c_str())); } int main() {...

Genetic Algorithm based routing optimization

Image
Following on from a previous posting on genetic algorithm based routing optimization, further improvements have been made and the source code has been made available. This software is written using MFC / C++ and is essentially a single document interface allowing the user to create network nodes and links by way of standard mouse click actions and enter network parameters using the available menu items.