Programming Archive

For loops – running method calls in the declaration

For loops are a key part of recursive code, allowing us to iterate over items in a vector, or perform actions a set number of times without repeating the lines of code. We all know how they can be applied and declared, however, something which may not be very well-known is the ability to call

Mouse Jiggle Tool – Create your own in C#

Mouse jiggling is rarely a useful tool or achievement except in cases where sending the computer to sleep would cause the interruption of another process – a system scan, render, or other such task which takes a large amount of time and you wish to leave it running over night. Even then, the usefulness of

Obtaining the points that make up a polyline in Grasshopper/Rhino

As part of my EngD I work alongside other engineers solving day-to-day problems. James, a fellow research engineer at BuroHappold, and I regularly venture down the path of Grasshopper development. James works in Grasshopper for the majority of his work and his website (viewable here) contains a lot of hints and tips on getting Grasshopper

C# Global Keyboard Listeners – implementation of key hooks

In a previous post I briefly outlined the pros and cons of using global event listeners. Although the summary was to use them with caution, the entire use of listeners only came about due to a quick bit of personal programming I did yesterday, in which global listeners were a necessity (due to the program

Global keyboard listeners – pros and cons

As discussed previously, event listeners are a key component to GUI development and good software development. Being able to record mouse clicks, or keyboard keys can enhance the usability of software for the end-users. In this post, I intend to show you how to implement a global keyboard listener for C#. What is a global

C++/CLI Wrapper – marshalling GUIDs

GUIDs, unique identifiers which can be assigned to items in C# and C++ are another set of variables which, despite sharing many characteristics, need to be marshalled between the C# implementation and C++ implementations when using the CLI wrapper. Marshalling GUIDs between System.Guid and GUID GUIDs are useful variables to pass between C# and C++

C++/CLI Wrapper – marshalling strings

As mentioned previously, C++/CLI code makes use of managed data types to pass data between C# and C++. Primitive data types are not affected by this (int, double, bool, etc.) but others, such as strings, are. Marshalling strings between system and std Strings in C# are referred to as System Strings as they are a

C++/CLI Wrapper – how to set up a CLI file

What is CLI and what is it used for? The Common Language Infrastructure (CLI) is a part of .NET programming. It is commonly referred to as the C++/CLI wrapper (this may be important if ever you’re Googling for help) and is used for managing code between different .NET based code. As mentioned previously (here and

C++ Error C2784 – Working with GUID keys in map data structures

Error C2784 is caused by problems with the compiler for using a key in map data structures. Map data structures are very useful in C++, their C# equivalent being the Dictionary structure. They allow you to store data to a key, which means when you come to need that data you can use the key,

C++ Error C2011 – What it is and how to fix it

Errors are never fun to deal with, especially late at night with no one around to bounce ideas off of. During the course of my programming adventures I encounter many errors in compilation and hopefully, by posting them and the solution for them I might help myself later, or others, in solving the problem. Error