Posts

Showing posts from September, 2011

A Simple Binary Tree Implementation in C++

Image
A very basic binary tree implementation in C++ that defines a binary tree node, adds new nodes and prints the tree. [code language="cpp"] #include <stdio.h> class Node { public: Node( int v ) { data = v; left = 0; right = 0; } int data; Node* left; Node* right; }; void Add( Node** root, Node* n ) { if ( !*root ) { *root = n; return; } if ( (*root)->data < n->data ) { Add( &(*root)->right, n ); } else { Add( &(*root)->left, n ); } } void Print( Node* node ) { if ( !node ) return; Print( node->left ); printf( "value = %i\n", node->data ); Print( node->right ); } int main() { Node* root = 0; Add( &root, new Node( 1 ) ); Add( &root, new Node( 2 ) ); Add( &root, new Node( -1 ) ); Add( &root, new Node( 12 ) ); Print( root ); return 0; } [/code] Output:

Displaying AVI Video using OpenCV

Image
A short demonstration of how to use OpenCV to capture and display video frames from an avi file. The code demonstrates how to capture video from an example video (avi) file, get information in the form of frames per sec. and display the video.

Problems Accessing Linux Folders and Servers from Windows

Image
A short posting on dealing with accessing shared directories from remote Windows machines. When trying to access a shared folder stored on a Linux server from (say) a remote Windows XP machine you may have come across the following error message in much the same way as I did:

Getting Started with FFMPEG for Windows

Image
Some pointers on how to get ffmpeg installed for use in Windows environments.

Hash Tables as a means of fast lookup in STL / C++.

Introduction In a previous life I was involved in the design of routing optimization software for the telecoms industry. Finding the least cost route for a traffic demand between communicating network sites necessitates a search for all the tariffs provided by all of the carriers.

A Recursive Algorithm to Find all Paths Between Two Given Nodes in C++ and C#

Image
Problem Outline This I tackled previously when working on the design and implementation of routing optimization algorithms for telecommunications networks. Given that a wide area network with nodes and interconnecting links can be modelled as a graph with vertices and edges, the problem is to find all path combinations

How to Set up a Subversion (SVN) Server in Linux

Image
This guide details the steps taken to create a proper SVN server, as opposed to using a not-recommended network share , as means of creating and accessing repositories.

Analyzing FlyCapture Images obtained from Flea Digital Cameras

Image
Flea2 Camera Physical Layout The photograph shows the physical setup for grabbing images from a Flea2 camera (by Point Gray Research ) mounted above a Xaar inket printer. This represents a prototype used to obtain images of microarray spots printed to glass sample slides, in “Format7” (partial image) mode, as the printhead moves across trays containing 25 microarray slides. Using the FlyCapture SDK The FlyCapture SDK provides methods for acting upon triggers from external pieces of hardware (in this case Xilinx FPGA boards) and retrieve the image buffer when receiving these prompts. What is more, it is possible to capture grayscale images directly from the camera, eliminating the need for colour-to-grayscale conversions in software. Obtaining acceptable camera settings interactively Assuming you have installed the full FlyCapture2 SDK, at the Start button, select All Programs -> Point Gray Research -> FlyCapture2 -> Examples -> Precompiled Examples -> Flycap2M...

Linux Snippets

Some assorted odds and ends in no particular order to save me re-Googling this kind of stuff... Itentify if you are 32-bit or 64-bit $ uname -a Convert png into jpg $ convert file.png file.jpg To open KDE Advanced Text Editor (kate) with root priviliges: $ kdesu kate ... and enter root password when prompted.

When FlyCapture2 ValidateFormat7Settings returns PGRERROR_IIDC_FAILED

Running in Format7 (partial image) mode A recent observation made when running the FlyCapture2 SDK in Format7 (partial image) mode. Just thought this was worth a mention.

Getting Started with NVIDIA CUDA for Windows

Image
Introduction CUDA is NVIDIA’s parallel computing architecture that can greatly ehance your computer's performance by harnessing the power of your GPU (graphics processing unit), as opposed to your PC's CPU (central processing unit). For a general overview, your best bet may be to go straight to their Getting Started guide .

Getting Started with the NSIS Install System

Image
Download and install the NSIS (Nullsoft Scriptable Install System) package From here .

General Windows How-Tos...

Image
Starting from today, any useful Windows-related tips I encounter. I anticpate this post will grow as and when I come across any other Windows-related stuff... First off:

Using TrueCrypt to Password Protect Windows Folders

Image
The Windows method Windows can help you protect your folders in so much that only selected users (such as you) can see its contents. You can place restrictions on who can do what with folders, by right-clicking the folder, selecting properties, clicking the security tab and mofifying the contents.

Implementing Kruskal's Algorithm in C#

Image
This post is essentially a blatant lifting of Omar Gamil's CodeProject article on the same subject. I have been using the project as means of getting into C# programming and using things like Windows Forms etc in Visual Studio environments for the first time.

Getting Started with C# WPF Applications

Image
Some notes on how to create a simple Windows Presentation Foundation (WPF) application and get familiar with the Visual C# integrated development environment (IDE). Like Windows Forms applications, WPF applications can be developed by dragging controls from the Toolbox to the design editor. As well as having a designer, Properties window and Toolbox, the IDE in WPF projects has a window that contains Extensible Application Markup Language (XAML), a language used to create user interfaces. 1. Creating the WPF application In the File menu, click New Project and select WPF Application. In this example we will create a simple scribbler application, so you might want to name it Scribble. Click OK. 2. Editing WPF window properties Visual C# will create a folder named after the project title. It will display your new WPF window titled Window1 in the Designer view. You can view its code by right-clicking on the window and selecting View Code: [code language="csh...

Creating a Tabbed Dialog using MFC Property Sheets

Image
This post assumes that you are working on an existing MFC project and wish to add a tabbed dialog to your application. This example was created in Visual Studio 2008. Like most of the other postings here, there is not much in the way of extra bells and whistles, just a very simple example to get you started... VS2003 download available here . Create a Property Sheet: In the main menu, click Project -> Add Class -> MFC Class. Set the Class Name eg CImageSheet and set the Base Class to a CPropertySheet . Click Finish and OK: This will generate the "ImageSheet.h" header file and class definition. Create Property Pages: In the main menu, click Project -> Add Class -> MFC Class. Set the Class Name eg CImageDimensions and set the Base Class to a CPropertyPage : Repeat for as many other property pages as needed: Modify the Property Sheet class: Modify this class so that it contains additional includes for all the property pages you want to ...