Friday, 26 January 2018

How to create custom file templates in Visual Studio

In my last post, I explained how to create a C project in Visual Studio. But can you also add new C files by clicking icons in the New Items dialog? Well, yes, you can – but you will have to create your own custom file templates first. This video shows how to do that…

When you’ve saved a template it is added to two directories beneath the \Users folder. For me these are:

C:\Users\Huw\Documents\Visual Studio 2017\My Exported Templates
C:\Users\Huw\Documents\Visual Studio 2017\Templates\ItemTemplates

I had a few problems when adding file item templates. Sometimes the newly added templates weren’t appearing in Visual Studio. I found that an easy way to fix this is to delete the template cache. That’s the entire \ItemTemplatesCache directory here:


Then I restarted Visual Studio and all my new templates appeared in the New Item dialog.

Tuesday, 23 January 2018

How to create a C project in Visual Studio

Bizarre as it may seem, there is no option to create a C project in Visual Studio. You can create C++ projects by making a simple selection from the New Project dialog - but not C projects. Does that mean you can’t use Visual Studio to program in standard C? No, it just means that Microsoft, for reasons that I’ve never understood, has decided to ‘hide’ its C programming capabilities. In fact, if you want to use Visual Studio to program in C, it’s quite easy to do. This short video shows you how…


Friday, 1 December 2017

Cyberlink PowerDirector 16 Review

Cyberlink PowerDirector is a fast and well-featured video editing suite that is, in my experience, far more powerful than its relatively low cost might suggest.

This latest release adds in some useful capabilities such as enhanced tools for creating panoramic 360-degree videos (assuming you have an appropriate camera) including ‘little planet’ videos (where panoramas seem to wrap around to form a sphere) and titles that stay ‘inside’ the 3D space, better colour matching and grading tools to change the colour ‘temperatures’ of clips and match the tonal ranges of one clip with another. You can also create video collages. These are split-screen videos with clips arranged in predefined ‘patterns’ all on the same screen.

The PowerDirector 16 editing environment – clips imported into window at top-left, the multi-track timeline at the bottom, the preview window (showing three videos combined into a ‘collage’ at top-right)
There are numerous other new or enhanced features too. For example, there is improved stabilization that irons out any camera wobbles, even in 360 degree clips. And there are all kinds of new or improved add-ins for creating titles and applying effects (only with some editions – see below).
If you regularly make use of musical backing tracks in your videos, the new ‘audio-ducking’ tool might be of use. This automatically lowers the sound on a ‘background’ track containing music or some other kind of ‘background audio’ when there is some dialogue on a ‘foreground’ track.

My first attempts at audio-ducking were not entirely successful. I applied the default settings to a backing track and let PowerDirector analyse the other tracks (principally the main video track containing dialogue). It then made adjustments to the background music by increasing the volume in the pauses and decreasing it during speech. Then end result was a wild cacophony of loud music blasting out at unexpected moments. I had better luck when I adjusted the settings in the audio-ducking dialog to increase the sensitivity and ducking level. The end results were still not as good as when I made audio adjustments by hand. Even so, automatic audio-ducking is a lot faster than adjusting audio the hard way so it may be useful in some circumstances.

Audio-ducking automatically decreases the volume of a backing track when there is foreground dialog. You may need to experiment with various options to get good results however.
In spite of these additions, the essential software hasn’t really changed very much since the last release which I reviewed about a year ago. (See my review of PowerDirector 15). In fact, in terms of its core editing and production capabilities, it is really not vastly different from PowerDirector 14 (see my review from 2015). Consequently, for the sort of video editing that I do, which doesn’t need fancy effects such 360 degree panoramas and collages, the new features are not hugely important.

PowerDirector’s demo of some of its 360 degree capabilities
The user interface remains much as it was previously: there are tabs across the top that let you switch between four workspaces: Capture, Edit, Produce and Create Disc. In the Capture workspace you can capture video or audio directly from a connected camera, microphone, webcam, CD or some other device, Or you can start up the screen-recording tool to make a recording of activity on your computer screen – which is useful if you need to do ‘screencasts’ showing software being used. The Edit workspace is where you actually create your videos by arranging clips on a timeline, cutting and moving them, applying effects and transitions as required. The Produce workspace is where you select the video format of your final video and render it to disk. And the Create Disc workspace is where you can, optionally, build a video complete with a menu system for DVD.

The collage designer lets you edit together multiple video clips and show them in split-screen views. Here the collage designer lets me pick a pre-designed ‘collage’.
As I’ve mentioned in previous reviews, one remarkable thing about PowerDirector is its speed of video rendering. For some common formats (such as MP4) it produces videos at a speed that far exceeds any other software I’ve ever used. See my recent review of a competing video production suite, VEGAS Pro 15, for details of a comparative speed test I made between VEGAS and PowerDirector 15.

My review of PowerDirector 14 provides a quick overview which is still relevant to PowerDirector 16

So, in summary, PowerDirector 16 has a few useful new tools and features, the most striking of which is probably its improved support for 360 degree videos. It doesn’t really have many significant additions for more traditional types of video. Even so, it is an excellent program for fairly serious video makers and, at the price, it is terrific value.

A word of warning. If you are a serious video maker, the chances are that you are going to visit the PowerDirector web site and notice that the software seems to be targeted towards families; there are lots of examples showing people making holiday and birthday videos. You will then, quite reasonably, conclude that PowerDirector is an amateur-level tool that must surely be unsuited to your more professional-level requirements. All I can say is, don’t believe it. While its ease of use makes it a perfectly good choice for amateur video makers, its power and speed make it just as good for professional use. OK, so maybe it hasn’t got what it takes for making Hollywood blockbusters. Then again, how many of are involved in making Hollywood blockbusters? Most professional video makers these days are more likely to be making YouTube videos, online video courses, instructional DVDs, promotional and sales videos or creative videos on a budget. For that level of video-making PowerDirector 16 is just about ideal.

Additional Software

Some editions of PowerDirector are supplied with additional software – notably, PhotoDirector 9 (image editing), Audio Director 8 (audio editing) and ColorDirector 6 (more advanced ‘colour grading’). The available editions are shown below.

PowerDirector Editions

The following editions of PowerDirector are available (showing the official price and the current offer price in parentheses):

  • PowerDirector Ultra £219.97 (£54.99) – the basic video editing package
  • PowerDirector Ultimate £239.97 (£54.99) – Ultra plus extra effects
  • PowerDirector & PhotoDirector £109.99 (£84.99) – Ultra plus image editor
  • PowerDirector Ultimate Suite  £209,99 (£159.99) – Ultimate plus AudioDirector & ColorDirector
  • PowerDirector Director Suite £249.99 (£164.99) – Ultimate Suite plus PhotoDirector

For full details see feature comparison chart:

So which should you buy? 

For all the essential video editing features, the Ultra edition is fine. The Ultimate edition, which comes with additional plug-in effects is, at the time of writing, on offer at the same price as the Ultra edition, so that is obviously the one to get. If you need an image editor to work with still-camera images and bitmap graphics, the PowerDirector & PhotoDirector bundle is good value. The Ultimate Suite omits PhotoDirector but adds in colour-manipulation and audio editing packages – not really essential for many video-editing projects but possibly useful. However, if you are thinking of going for one of the more expensive bundles, then you may as well go for Director Suite which includes the full range of video, audio and image editing software.

Monday, 6 November 2017

CorelCAD 2017 review

CorelCAD 2017 £759.99

For 3D CAD, CorelCAD seems to provide a lot of power at a moderate price. But does it live up to its promise? Dermot Hogan gives his opinion…

One thing that you learn quite quickly about lathes, milling machines and the like is that, unlike a PC, there isn’t a delete key. If you make a mistake, you start again. Which is why it is pretty much essential to have a CAD package to produce a design – a plan – from which to work. Yes, you can use graph paper and a pencil to produce a design. You can also use a quill and ink if you like …

I’ve been using CorelDraw for a number of years as a (very) lightweight CAD package for simple mechanical drawings. It works quite well for that, in that you can add dimensions, use layers and colour items to get an idea of what you want to produce. But a 2D package that is aimed mainly at artists and illustrators doesn’t really cut it when you want to produce something like a simple right-angled mounting plate - let alone a robotic tracked vehicle. Nor, to be fair, is CorelDraw intended for that purpose.

So I started looking for something a bit more 3D-oriented which would fit in with what I had used and knew in CorelDraw.  CorelCAD seemed the obvious place to start.

CorelCAD is essentially a re-packaged version of Graebert’s Ares Commander CAD system. It’s aimed squarely at AutoCAD-style users and as far as I can see does a pretty good job of it too. I’m no AutoCAD expert and, to be honest, the thought of using a command-line input to perform operations and using LISP as a programming language seem a bit, well, 1990s. But who am I to say? AutoCAD is doing very nicely thank you, and there are many happy users out there.

This is a simple plate with a hole and a cylinder in the default wireframe view. Note the rather nice ‘ribbon’ menu which is an option over the older ‘classic’ menus.

Design in 2D

CorelCAD works in AutoCAD’s native DWG format and you can import and work with AutoCAD drawings directly. That’s a big plus – there are many manufacturers who produce CAD drawing in DWG format for download and incorporation into your designs. But you can also import and export to CorelDraw’s native CDR format. For me, the export worked ok, but I had difficulty with importing my existing mechanical designs. CorelCAD did import them – but the dimensions were not correct (they were page dimensions, not the dimensions I had specified in CorelDraw) and in some cases the relative sizes were not correct. I was hoping that I could import my existing CorelDraw diagrams and start working on them immediately. In the end I decided that it would be simpler to start again.

With any CAD package there is going to be a learning curve. By all accounts CorelCAD is simpler to learn than AutoCAD but, even so, it’s a complicated and powerful design package and I found that it took me some time to get into producing even simple 3D objects. One of the rather strange things about CorelCAD is the help system. It really is the good old fashioned Windows XP style help. It’s comprehensive, true – but compared to the help provided with AutoCAD Fusion 360 or SolidWorks (with good short video tutorials and well laid out HTML pages on the web) it looks pretty antiquated.

2D drawings are easy, though. Even though the menus are different, I found that I could re-use much of what I knew from CorelDraw to lay out and align rectangles, etc. and specify the distance between various components – the dimensioning tools are first rate. I found the ‘Quick Input’ mechanism, where you can specify the dimensions of, say, a rectangle, on the fly to be particularly useful. As you might expect, the ability to accurately produce 2D layouts and plans is in a different ballpark to CorelDraw, and having using CorelCAD for drafting and creating 2D designs, I’d be reluctant to go back.

You can ‘shade’ the wireframe to get an idea of what the finished item will look like. It’s ok but not wonderful.

Into the Third Dimension

In addition to 2D work, CorelCAD also allows you to work with 3D objects. You can extrude a 2D surface to produce a 3D box, create spheres, wedges, cylinders, etc. and you can operate on them to generate holes and interiors. You can also create fillets and so on and ‘loft’ surfaces to generate 3D objects. I’m no architect, but I can see how this will work well for architectural designs in the traditional AutoCAD manner.

However, for 3D mechanical designs, there are some issues.

The first problem I had was to create a hole. Simple holes are fine, if a little unintuitive (you subtract a cylinder from a solid object), but what about an M3 machine screw hole with an 82 degree countersink? Or an M6 counter bore? Not so easy – ideally, I want a ‘hole’ menu which allows me do a number of common hole type operations. I would think that it is possible to create functions like this in CorelCAD by programming (in LISP) a routine that does exactly what you want. But I want to get on with designing my machine – not writing LISP scripts.

CorelCAD mainly operates in wire-frame mode. Typically, you would start off with a 2D ‘layout’ of a 3D design, and then extrude and move parts to where they need to be, while the display remains in wire-frame. Wire-frames, though, strike me as something of a throwback to the days when graphics cards and CPUs were not powerful enough to fully render 3D objects in real time. Times have changed and I prefer working in a fully rendered, rotatable 3D view all the time as in the Solidworks/AutoDesk Fusion 360  type of 3D CAD software. With these you create a 2D ‘sketch’ on any surface of an existing fully rendered 3D object and extrude 3D shapes from the sketch – to my mind a much more intuitive approach.

The new QuickInput system allows you to specify dimensions ‘on screen’ rather than using the command line.

An important feature that CorelCAD is missing for 3D work is ‘assembly’. In producing a full 3D ‘model’ of a robot, say, you would typically have a number of parts – ‘components’ – designed separately; and you then want to bring them all together as a fully functional composite object. So, you really want to be able to select a gear shaft, say, and the center of a the hole in a gear and ‘join’ them, so that they align exactly, can rotate freely about a common axis and can then be moved and placed as one component. CorelCAD does have object ‘snaps’ where you can move an object to, for example, a position close to the middle of a line and it will snap to the mid-point. But this isn’t really the same as an assembly function. For me, assembly is essential. In researching which CAD package to use for designing robots,  I’ve tried several CAD packages without assembly and it takes far longer to produce a workable model than with a CAD package with it.

This is an example of a standard CAD file made available for download by a manufacturer (in this case igus  - Because CorelCAD works in native DWG format, importing files like this works perfectly.


If you want to use CorelCAD for architecture, planning, office layouts or individual component design, assembly may be pretty much irrelevant. CorelCAD is excellent at producing 2D drawings and plans and it’s also good at 3D architectural designs, but there are better products available for complete mechanical designs.

But there is one more feature of CorelCAD that you might like to consider: it has a ‘perpetual’ license. Many CAD systems – AutoCAD and SolidWorks, for example – require you to pay a yearly rental or subscription fee. For this you get the benefits of bug fixes, support and the latest releases of the software. You might think (as I do) that this is fine for the software vendor but not so good for those people who just wants to purchase something once and may consider upgrading after a few years. The CorelCAD perpetual license means that once you buy it, it’s yours to keep.

To get a really good view of what you’re working with, you have to ‘animate’ the view. This is what I would like to work in all the time, but when you ‘animate’ a model, all you can do is rotate it and admire it. You cannot alter it while in this mode.

The Good

1)    excellent  at 2D designs, layouts, drafting and drawings
2)    works in DWG as native format and is cheaper than AutoCAD
3)    imports and exports to CorelDraw and other Corel products
4)    perpetual software license

The Bad

1)    importing from CorelDraw did not work well for me
2)    mainly wire frame mode
3)    old fashioned help system with limited tutorials
4)    no assembly

…and the ugly?

No. CorelCAD is fine, as long as you are aware of its strengths and its limitations and use it appropriately. It is an excellent CAD package aimed at the AutoCAD (as opposed to full blown 3D design like SolidWorks) market. If you mainly want to produce 2D designs and 3D architectural drawings, it will serve you well. The 3D design functionality is adequate but if 3D mechanical design is your main purpose, there are better, more modern alternatives. But it’s a lot cheaper than AutoCAD (which currently costs £1,506 per year!) and it has a perpetual license. In short, I’m happy to design components and produce 2D layouts with CorelCAD, but I wouldn’t want to design a jet engine in it!

Thursday, 2 November 2017

Constructors in C#

C# (C-Sharp) is an object oriented programming language or OOP for short. Many modern language such as C++, Objective-C, Java, Ruby and Python are also object oriented. You can think of an object as a sort of package that wraps up data – that’s variables, such as strings and numbers – and behaviour – that’s functions or methods that do something, often by manipulating an object’s internal data.

The definition of an object is called its class. You can think of a class as a blueprint for an object. It’s just like the blueprint for a car. The blueprint defines all the fundamental features of a car but you can’t actually drive the blueprint. To use a car you have to create one based on the blueprint’s definition. That’s what you do in programming too. You write a class and you create usable objects from it. In fact, just as you can create many cars based on a single blueprint, so you can create many objects based on a single class.

When you create a new object from a class, you can call that class’s constructor to initialize the object. A constructor is a method that has the same name as the class itself. This class is called MyClass, so the constructor method will also be called MyClass.

public MyClass( ) {

The constructor has to be public – that is, it has to be visible to code outside the class itself – because clearly I need to call the constructor method from other parts of my program, whenever I want to create a new MyClass object.

A constructor doesn’t have to have any parameters. However, when an object has some internal fields, it is quite common for the constructor to define a list of parameters to initialize those fields. In that case, when you invoke the constructor, to create a new object, you would need to pass the appropriate arguments to initialize those fields. When an object descends from another object and the object from which it descends has a constructor that initializes some fields, the descendent class’s constructor can call the ancestor class’s constructor, passing to it any arguments required by the ancestor constructor to initialize its fields. It does that by putting a colon after the parameter list of the constructor, then the keyword base, then a comma-separated list of arguments between parentheses.

This short video (taken from my course ‘Learn C# Programming (in ten easy steps)’ gives a few more details about C# constructors.

This course was first created in 2012 but now, in 2017, it has been completely remade. Every single video has been re-done and no less than 86 new video lessons have been added. What’s more, students can also download the entire version 1 of the course (almost 4 more hours of video) as an added bonus. This is what the course contains:

  • 117 video lessons
  • 7 hours, 7 minutes of video
  • 32 sample projects
  • 10 quizzes
  • 89-pages of pdf documentation
  • PLUS: The entire version 1 course as a free download!

The regular price for this course is $145. But use the link below to sign up for just $35 (valid only until the end of 2017, so don’t wait!)

Wednesday, 1 November 2017

C Programming - Arrays, addresses and pointers

#include <stdio.h>

int main(int argc, char **argv) {
char str1[] = "Hello";
char *str2 = "Goodbye";
// str2 = &str1;
// str2 = str1;
printf("%d %d %s\n", &str1, str1, str1);
printf("%d %d %s\n", &str2, str2, str2);
return 0;

Let’s now look at how pointers and addresses work in C – and why arrays are special. In the code shown above I declare two string variables, str1 and str2. You can create string variables using either syntax but you need to understand that these two variables are by no means the same as one another. The first, str1, declared with a pair of square brackets is an array. The second, str2, declared using the star operator, *, is a pointer. As we know (see previous article), an array and an address are equivalent. So str1 is the address at which the array of characters in the string “Hello” are stored. But str2 is a pointer whose value is not the string “Goodbye” but the address of that string. So str2 'points to' the address at which the characters “Goodbye” are stored.

This should be clearer when you run the code.

When displayed as an integer value, the address of str1 (returned by the & address-of operator) is the same as the value of the variable str1 itself. That’s because str1 is an array - and an array is, in effect, an address.

But the address of str2 (returned by the & address-of operator) is different from the value of the str2 variable. Here the address gives us the location in memory of the pointer variable, str2. But the value of that variable is the address of the array of chars to which it points.

str1 is the location of the start of this array of characters, “Hello”, in computer memory. The address of str1 is the location where that string of chars begins.

But the value of the pointer variable str2 is a number that gives the location of the start of the array of characters “Goodbye” in computer memory. The address of str2 is the location where the str2 pointer variable is stored – and if we just want to get at data in the array, the address of the pointer variable itself is of no interest to us. For now, I’m only interested in the address of the array to which this pointer points. The value of str2 is the address of that array: the address of the first character in the string “Goodbye”.

The video below is taken from my online course, Advanced C Programming: Pointers. You can subscribe to this course, for a limited period, and save 63% by clicking this link. This lets you join up for $35 (regular price is $95):

Monday, 30 October 2017

C Programming – Arrays and Pointers

One of the things I’ve discovered, through teaching C programming, is that many students find it extremely hard to figure out how arrays work. In most modern programming languages, arrays seem to be simple lists of items like a virtual filing cabinet with numbered drawers for storing things. But that’s quite a ‘high-level’ abstraction of an array. C doesn’t do arrays like that.

In C, you are forced to deal with the way the computer actually stores these items in memory. And that’s when you discover the surprising fact that an array – or a string – is an address. That’s right. It is a memory location. What? But how can that be…?

Let me explain. The address of the array is the same as the address of the first item in the array. To understand this, let’s look C strings. C does not have a dedicated string data type. In C, a string is an array of characters that are terminated by a null character ‘\0’.

Consider this short program:

#include <stdio.h>

int main(int argc, char **argv) {
char str1[] = "Hello world";
printf("%s %c %d %d %d\n", str1, str1[0], &str1, &str1[0], str1);
return 0;

First it displays string – that is, the array of characters – of the variable str1, then the character at index 0, that is, at the first index of the array which here is H of ‘Hello world’. Then it shows the address of the array, which is this number representing a memory location (here, I am using %d in the format string to show it as a decimal value, but many compilers prefer you to use %p to show a hexadecimal value). Now I get the address of the first character. Remember that I said that the address of the array is the same as the address of the first item in the array. Well, if you run this program you will see that is true because the address of the character ‘H’ (which is shown when I use the ampersand ‘address-of’ operator) is the same as the address of the string, shown when I use the address-of operator with the string variable, str1. But look at this last value here. Instead of using the ampersand to get an address, I just display the variable itself, str1, as an integer using %d in my format string. And this shows the same number – the address of the array.

The address of an array is the same as the address of the first item in the array. Because it’s where the array begins. And the name of the array – that is the name you give to the array variable – is also the address of the array.

In other words, we may tend to think of arrays as fixed-length lists. And in many other programming languages, that may be all you need to know about arrays. But, in fact, an array is really the same as an address in memory that defines the beginning of a list of data items. So when you deal with arrays, including strings, you are dealing with addresses.

The video below is taken from my online course, Advanced C Programming: Pointers.

Save 63% by clicking this link to subscribe to the course for just $35 (regular price is $95):