Saturday, June 23, 2012

Code::Blocks IDE for C and C++

The Eclipse IDE is so much work to setup for C/C++ that I investigated alternatives.  I recommend Code::Blocks as a fine tool for learning C and C++:  http://www.codeblocks.org/
The download of Code Blocks comes with MinGW, so you do not need to download MinGW separately.  It also places its copy of MinGW within its own directory structure, so it knows where to find it and it does not interfere with any other installation you have made of MinGW.  I recommend you let Code::Blocks install its own copy of MinGW so it knows where to find it.  Furthermore, with Code Blocks you do not need to modify the PATH environmental variable.  The Eclipse IDE forces you to modify the PATH variable, so Code Blocks is easier to install. 

Once Code Blocks is installed, you can write and compile programs right away.  The only demand Code Blocks makes is that you place the main function inside a file called main.c.

Comparison Between Code Blocks and Eclipse

Eclipse has a "Console" tab that works very well.  For example, on page 18 of the K&R book, there is a line of code that says:
while( getchar( ) != EOF )
When this program is run inside the Eclipse IDE, you can hit the square, red button above the Console window and that acts as an EOF for this program.  The console window in Eclipse is handy.

Code Blocks pops open a Windows command window for output.  If you do a control-C to halt the program on page 18 of K&R, imitating an EOF, then the command window dies and you cannot see the final output of the program.  For programs like this, you need to manually open a Windows command window, maneuver to the program, and execute it manually.  Then you can do a control-C to halt the program, you see the program output, and the command window does not die.  The point is that Eclipse has some advantages over Code Blocks, but they are minimal advantages for beginners.  The ease of installation of Code Blocks is a huge advantage over the complex installation of Eclipse with the CDT plugin.

I do recommend using Code Blocks as a free compiler and IDE for learning C or C++.

About CodeLite

CodeLite is another free IDE for C++:  http://www.codelite.org/
CodeLite, however, is intended for creating GUI applications.  If you are learning to program in C or C++, CodeLite is  not the tool for you.  Avoid CodeLite.

Robert Canright

Sunday, June 10, 2012

How to Install the Eclipse IDE with the CDT for C and C++

I believe the best first language to learn for programming is the C programming language.  I will qualify this by saying the student should be good in math and at least in middle-school, 6th grade being the youngest.  But the student needs a programming environment.  Here are detailed directions, with numerous screen shots, for installing the Eclipse IDE and its CDT (C/C++ Development Tool) plugin.  Follow the directions and you will have a functioning C/C++ Integrated Development Environment at the end.  You will also be exposed to a small amount of trouble-shooting.  I built-in a problem and solved it teach a few things about the development environment.

I suggest an adult install and setup Eclipse with its CDT.  Take special care when you modify the "Path" variable if you have never done that before.  You must add to the end of the list of items in the Path environmental variable.  You must first insert a semi-colon (;) at the end of the existing path and then add the information mentioned in the instructions.  If you mistakenly wipe out your Path variable, you will have grief, you will lose functionality, so be careful. The screen shots are from Windows 7.

I will explain some other time why I believe C is the best language to learn first for programming.

Robert

Sunday, June 3, 2012

Merging Visio Drawings

Microsoft Visio drawings can have multiple pages/tabs.  People sometimes want to move pages from one drawing to another.  You cannot do this, as explained by this post:

However, it is possible with VBA programming to merge drawing together.  You merely make sure the drawings you merge have the pages you want to combine.  Here is a link that contains VBA code that does the drawing merge.

If you read the code at the link above you will see the TryMergeDocs subroutine uses a hard-coded array of Visio files.  It does not have to be done this way.  Here is an example of a GUI to merge a number of Visio drawings without hard-coding the names:


You enter drawing names into the textbox, click the "Add Drawing" button to add the drawing name to an array of names, then the "Merge Drawings" button will invoke the TryMergeDocs subroutine using the array you just built.  You have to keep track of how many elements are in the array and replace "UBound(FileNames)" with the index of the last useful array element.

Robert

Saturday, June 2, 2012

How to Enable VBA in Visio


If you are performing a repetitive series of operations on a collection of similar Visio drawings, the repetitive operations can be automated.  The key to automating operations in Visio is use macros or programs written in Visual Basic for Applications (VBA), which is built into Visio but must be enabled to be used.  When VBA is enabled you can see a Developer tab in the ribbon at the top.

Turning On VBA in Visio

To enable VBA in Visio you first need to turn on the developer tab on the ribbon at top by clicking on this sequence of menu choices
File > Options > Customize Ribbon
In the navigation bar on the left, click on the box “Customize Ribbon”
 On right hand window, check the “Developer” box, click OK
A “Developer” selection is added to the top ribbon.  Click on the Developer tab and you can see “Visual Basic” as one of the selections on the far left.  Visio also needs to have macros enabled, which is done with this key sequence.
File > Options > Trust Center
In the navigation bar on the left, click on the box “Trust Center.”
On the far right hand side of the page is a button labeled “Trust Center Settings.”  Click on it and then select the radio button labeled “Enable all macros,” then hit OK.  Visio is now configured so you can write VBA programs and then run them.