Saturday, December 22, 2012

Learning to Program with Pascal

Isn't Pascal a dead language?  Why would anyone learn to program with Pascal?  Well, companies known well to me that used Pascal in the past gave it up for the C language.  But C might not be the best first language to learn programming, at least not for everyone.  However, it is not really dead.  It was extended into Object Pascal and renamed to Delphi, which is popular within the community of Delphi programmers.

People really liked Turbo Pascal.  You can still download free copies of old Pascal documentation from this website:
http://bitsavers.informatik.uni-stuttgart.de/pdf/borland/turbo_pascal/
You can get the Turbo Pascal Object-Oriented Programming Guide and the Turbo Tutor (Version 2.0).  You can teach yourself both Pascal and programming with these manuals.  The Turbo Tutor even covers advanced data structures and the topics of sorting and searching.

You can get a free compiler for Free Pascal at this website:  http://www.freepascal.org/
Free Pascal has a Delphi-compatible mode.  You can buy Delphi from Embarcadero
(http://www.embarcadero.com/), a California company, so Pascal is definitely not dead.  I recently purchased a book on genetic algorithms and there is sample code in the book written in Pascal.  And here I thought I would never see this language again and I discarded my Pascal book!  I am fortunate the language is easy to read and that lovers of Turbo Pascal have saved the documentation as though it is sacred script.  Actually, the genetic algorithm book has a tutorial in the appendix. 

Here is a link to a piece of humor about "the sons of Kahn," meaning Philippe Kahn, the founder of Borland.  (The reference in this humorous article to the valley of the Scotts is Silicon Valley, the Scotts reference is to the Macintosh and Apple.)

In summary, Pascal is a good candidate for a first programming language.  Professional programming in Pascal lives on in the form of Delphi programming, but it is a niche market.  Pascal syntax can be simplified and used as pseudocode for software design documents.

Pascal is not as simple as Basic and not as powerful C.  It is in the middle and has been squeezed into a small position in today's programming world, but it is not gone, and not forgotten.

Robert

Small Basic

There are two free programming environments/languages called Small Basic.  One is Microsoft Small Basic.  Here is a website where you can download a free copy of Microsoft Small Basic.  They offer a free tutorial in PDF, free example programs, and a Wiki for support.  Here is a list of programs made with Microsoft Small Basic.

Another Small Basic version is called SmallBASIC.  This version was intended to run on minimal hardware.  This is not a toy language.  It was intended for the Palm OS.  The Wikipedia article says, "SmallBASIC runs even on Palm OS wristwatches made by Fossil, Inc."  You can get SmallBASIC for free from the SmallBASIC webpage on Sourceforge.  There are no tutorials for Basic at this website.  However, you can download free applications as examples written in SmallBASIC from their code library.  Basic is a simple language, so you do not need much to get going.

Generic books on Basic are hard to find, but copies are still available from Amazon for Schaum's Outline of Theory and Problems of Programming With Basic by Byron S. Gottfried, and his other book, Schaum's Outline of Programming with Structured BASIC.  The difference between the two is that structured programming does not use GOTO statements.

There are a lot of free sources for Basic compilers.

Robert

Power Basic and Liberty Basic

If you are considering making Basic your first programming language, you should wonder if the Basic language is a dead end.  Can you actually use it after you have finished  learning it?  Besides the Microsoft offerings (1) Visual Basic .NET, (2) Visual Basic for Applications  (VBA) and (3) VBScript, there are other professional releases of Basic.

Power Basic is a professional release of Basic that is well thought of.  There is also Liberty Basic.

Basic is not a dead end language.  It has a lot of commercial support.  It has a natural syntax that makes it easier to learn.  Furthermore, the natural syntax of Basic can be adapted into pseudocode for use in software design documents.

Robert

Sunday, November 4, 2012

Structure and Interpretation of Computer Programs

If you are learning about computer programming, you should hear about the book, Structure and Interpretation of Computer Programs by Harold Abelson, et al (1996).  This book (SICP) has made a positive impression on some people.  Here is a Wikipedia article on the book.  The point of this book is to influence the thinking process, to stretch the mind.  But it is not going to teach you how to write useful code.  It uses a form of Lisp, called Scheme, which is available for free download from MIT.  I can report that the Windows installer works and the Scheme interpreter launches successfully on Windows 7.  If you want to work through this book, there is free support material available at this website:  http://www.mitpress.mit.edu/sicp/.

Eventually, the Structure and Interpretation of Computer Programs was replaced by How to Design Programs (HtDP) by Matthias Felleisen, et al (2001).  This book continues the MIT tradition of using the Scheme language.  Here is a Wikipedia article on this book.  Again, the emphasis is on stretching the mind rather than teaching a useful programming language.  Theoretically, the student is taught by this book to design software.  This is a very important  point.

Not every programmer can design software.  There are programmers, paid to write code for a living, who are incapable of designing software.  Here is one definition of a software hack: software that is not designed.  There is a synonym for a software hack:  a kludge.  To be fair, some people can hack-out decent code.  Also, some programmers can carry a complex design in their heads so that they do not feel the need to document the design.

Returning to the topic of teaching computer science at MIT, I found evidence that MIT does have a programming course for students that have no experience writing software.  This particular class uses the Python programming language. However, I find it hard to believe that a student majoring in computer science at MIT would be taking this particular course.  I have seen no evidence in the internet of MIT continuing to use How to Design Programs, but I have discovered that the authors have a 2nd edition in progress (2012):  http://www.ccs.neu.edu/home/matthias/HtDP2e/

How to Design Programs by Matthias Felleisen is a current book that is worthy of your consideration if you want to be a good programmer.  But you need to learn languages for producing software products (Java, e.g.) from another source.  Scheme and Lisp are not production languages, i.e., languages used to create significant products.

In closing, The Structure and Interpretation of Computer Programs (2nd Ed.), might be out of print, but it has left a lasting influence.  It is an engaging book to read.  You can also purchase the Instructor's Manual if you are going through the book on your own.

Robert

Here is a blog post by a high school student that briefly mentions SICP.  People are still studying this book.

Monday, October 22, 2012

Logic for Programming and Comments on C Programming

On two occasions I have handed a copy of The C Programming Language by Kernighan and Ritchie (K&R) to a bright young person.   I had a chance to speak with one of these young people later on and found that he had been stopped in his tracks when he got to Boolean algebra.  He totally ground to a halt when he hit bit-wise operators. 

I wrote a hand-out on the logical operators, AND and OR to help young people who are studying programming.  I have included the bit-wise operators used in C and I have posted this hand-written set of truth tables on the internet.  There are a lot of bright young people who are capable of teaching themselves how to program, but they have to really want to learn how to do it in order to overcome obstacles.

Then again, young people should not have too many obstacles.  The K&R book is brilliant, but it is terse and might not be a good fit for everyone.  C Programming, A Modern Approach by K.N. King has more explanation and might be a better match for some people.  On the other hand, The C Programming Language has a companion book that is a valuable complement:  The C Answer Book: Solutions to the Exercises in 'The C Programming Language' by Tondo and Gimpel.  Scott Gimpel is the creator of FlexeLint, a useful static analysis tool.

Overall, I believe a young person learning to program will benefit from some coaching, especially when learning to program in C. 

Robert

A previous article on C programming is:
"A Fix for K & R Chapter 1", July 2, 2012, Monday

Saturday, October 13, 2012

Notepad++ and Python

Python is very sensitive to white space because it interprets code blocks by indentation level instead of curly braces.  It is vital to use uniform spacing.  I agree with those programmers who use 4 spaces for Python indentation and avoid use of tabs.  You can setup Notepad++ to help maintain this standard.  Here is how:

Open Notepad++.  Select Settings > Preferences > Language Menu/Tab Settings
Leave Tab Size at 4, but check the box that says "Replace by space".
Then go back to the main menu and select View >  Show Symbol > Show White Space and Tab.
If you look closely you will see faint dots for the spaces.
If you open a file that has tabs you will see them displayed with arrows so you know you have them.

You can do a Control-f to open the find window.  It has a radio button in search mode that has "extended" and allows you to search for the \t character, which is a tab.  You can use the "replace" tab in the find window to replace all tabs (\t) with 4 spaces.  This is a convenient way to clean up files with tabs.

If you work on projects with multiple people you will see all manner of tabbing and spacing, which can break Python code.  Python code is sensitive to indentation errors.  It is important to be consistent.  This sensitivity to indentation errors makes Python code brittle in a large programming environment.

James Coplien had this to say:  "Back in my days working in the Bell Labs Software Production Research organization ... we had  some back-of-the-envelope findings that suggested that consistent indentation style was one of the most statistically significant indicators of low bug density."[1]

Robert

[1] Forward by James Coplien, p. xxii, in Clean Code, A Handbook of Agile Software Craftsmanship by Robert C. Martin

Installing Python

Here is a tip for when you install Python.  After you have googled python, gone to their website, downloaded the version you want, and launched the installer, you will get to a box that has a list of features to install.  At the bottom of the list it says "Add python.exe to path" and there is a red X in the box next to that choice.  Right-click on that choice, read the options on the drop-down box that appears, and check the box that says "install all features."  You do not want to leave that red X in that box.

You do want the installer to add python to your path variable.  If you do not have the installer add python to your path, you will have to do it yourself.  Here is how you test to see that your  path does have python in it:  Open a Windows command window and type PATH and hit a carriage return.  The OS will print the path and you can read it and look for "C:\Python33" or whatever version is latest.  Or, you can just test to see if the path variable is set properly by entering "python --version" and see if the command works.  The output will by "Python 3.3.0" or something similar if you get another version.

If you already know how to program, The Quick Python Book is a good introduction to the language.  My preference is to edit Python code with Notepad++ and use a command window for running code.  The Quick Python book acts like you will do all your work with the IDLE Python GUI.  I just use the IDLE tool to test small commands.

Python is a nice language.  I went back to look at PERL and I can see why people prefer Python to PERL.  PERL forces you to put funny symbols called sigils in front of variables.  I forgot about that.

Robert

Saturday, October 6, 2012

Install Tkdiff on Linux

If you want a visual comparison between two files on Linux, then vimdiff is available for you, but the visual presentation is very ugly.  Vimdiff comes with vim.   Fortunately Tkdiff is available for Linux and it is easy to install if you know how.

Here are directions for installing Tkdiff on Linux.  My primary machine is a Windows box, so I download using my Windows box and then move files over to my Linux box. If you download from the internet using your Linux box, the directions might be very similar, but a little different.

Use this link to download Tkdiff for Linux:
http://sourceforge.net/projects/tkdiff/files/tkdiff/4.2/tkdiff-4.2.tar.gz/download

Use WinZip extract once to get from tkdiff-4.2.tar.gz to tkdiff-4.2.tar
Use WinZip extract again to get from tkdiff-4.2.tar to folder called tkdiff-unix which has these files:
CHANGELOG.txt
LICENSE.txt
README.txt
tkdiff

Move the entire folder to your linux box, although you really only need the tkdiff file.  When you place licensed software on your linux box, I think it is appropriate to have the license on the machine.

Change tkdiff to Unix format, and put it in the bin directory.  Here are the commands to do this.  Of course, when you execute su to become root, you must know the root password.

dos2unix tkdiff
su
cp  tkdiff  /usr/local/bin/


Now you can go to some directory and execute
tkdiff  file another_file
and see the difference.

You will be please to see the visual improvement over vimdiff.  If you downloaded directly onto the Linux box, the tkdiff file might not be in DOS format.  The program dos2unix fixes the carriage return differences between Unix and Windows.

I will also mention that there is a Windows version available here.
http://sourceforge.net/projects/tkdiff/
The Windows version has an installer called TkDiff-4.2-Setup.exe
I prefer Kdiff3 for comparing files on Windows.  I installed Tkdiff instead of Kdiff3 on Linux because Tkdiff is generally much easier to install on Linux.

Robert

May 2017: Tkdiff is nice because you can put it on media and install it on a computer that does not have a decent visual tool for diff'ing files.  However, if you are on a Linux computer, look and see if the kompare (on KDE systems) or meld  (on Gnome systems) tools are available.  Then you won't need Tkdiff.

Sunday, September 9, 2012

Install Time: Just Basic vs VB Express

There is a significant difference in the time to download and install Just Basic and downloading Microsoft Visual Basic Express.   The Just Basic product is small and downloads within a minute, and its installation takes about a minute.  If your version of Windows is missing the Microsoft WinHlp32.exe file, then downloading and installing that will take about 10 minutes.  So the total time to download and install Just Basic is less than 15 minutes.  If you are using Windows XP, then you already have WinHlp32.exe and your computer will take less than 5 minutes to download and install Just Basic.

Microsoft Visual Basic Express is a large product.  Plan on an hour to download and install it.  You need to check on it every 15 minutes.  At some point during the download you might need to restart your computer.  Then the download resumes.  After the download and installation, go ahead and launch it.  The first time it comes up it does some final installation chores and that takes a couple of minutes. 

Don't download Microsoft Visual Basic Express unless you have at least an hour to spare.

Robert

Saturday, September 8, 2012

Just Basic Tutorials and WinHlp32

I have investigated Just Basic, a free version of basic.  It is at version 1.01 and was released in 2004.  They have a commercial version, Liberty Basic, that is just $60.  That is cheaper than a meal at the Cheesecake Factory.  So if you really like Just Basic, there is an upgrade available if you want to continue working with it.

Just Basic comes with a tutorial.  You can find it under Help > Just Basic Tutorial.  It works just fine in Windows XP.  However, Microsoft dropped a file WinHlp32.exe, from Windows releases subsequent to XP.  The tutorial requires this executable file, but it is still available from Microsoft.  You just have to get it and install it.  Of course, Microsoft has made this more difficult by requiring that you use their proprietary browser, MS Internet Explorer.

WinHlp.exe comes in different versions for Windows Vista and Windows 7.  Google to get the download page for WinHlp.exe for your version of Windows using Microsoft Internet Explorer.  That is important.  Microsoft has designed their download for WinHlp32 so it will not work with Mozilla or Chrome.  Once the download and installation is complete (the download process has an installation step), you can open the tutorial.

The tutorial is designed for real beginners.  It has a section in Week 1 (the tutorial is designed as a 6 week class) entitled, "Programming - What is it?"  This is important for a person not previously introduced to programming.  The book Head First C, for example, explicitly says it does not teach programming.  The Head First organization has a book to teach programming, Head First Programming, but it uses Python as the teaching language.  Python is a fine language, but scripting languages tend to be faddish and fall by the wayside, replaced by the latest fad in scripting languages.  If you only learn one programming language in your entire life, it should be Basic.  It is a language that is here to stay.  It was created 48 years ago and is still used by businesses in creating professional, complex products and tools.  Visual Basic for Applications (VBA), for example, is embedded by Microsoft in some of its products.  I have created complex, technical applications using VBA in Excel and in Visio.  I will mention, however, that VBA will choke on large problems.  It has limited memory available to it and chokes on large data sets and large quantities of data structures.  Professional programmers must know more than one language.

Visual Basic 2010 Express is also a free tool.  I will discuss this another time.

Robert

PS: Remember that the book Programming for the Absolute Beginner by Jerry Ford uses Just Basic.

Saturday, August 4, 2012

Inno Setup -- Free Installer

An installer is a professional way to deliver software applications to a customer.  Inno Setup is a free tool suite for creating installers for Windows.  I have used it and I recommend it.  There are two downloadsisetup-5.5.1.exe is the basic installer tool, Inno Setup, which I recommend.  The other download is ispack-5.5.1.exe,  the Inno Setup QuickStart Pack. 

Launch Inno Setup and it will ask you questions and then take your answers and create the dot iss installation scripts that are used to create the installer.

Say you have already created an installer.  You change your code, build a new executable, and need a new installer.  You simply run the previously created dot iss script(s) to make a new installer.  If I remember correctly, you do File > Open to open the top level dot iss script.  Then you do Build > Compile to build the new installer.

InstallShield scripts end in dot iss, which explains the dot iss notation.  The glory of the wizards is that you do not need to understand InstallShield scripts in order to create them because the tool writes them for you.

Try the tool now.  Write a HelloWorld.vbs file, use Inno Setup to create an installer for it, run the installer, and then use the desktop shortcut to launch the HelloWorld.vbs program.  Then use Start > Programs > HelloWorld to launch it from the Start Menu.  You will be pleased at how simple this is.

Robert

UltraEdit -- COTS Tool

I have used UltraEdit as a file editor on Windows machines and have been very happy with it.  I usually use Notepad++ because that is free.

Robert

Beyond Compare -- COTS Tool

Beyond Compare is a COTS tool for finding differences between files and directories.  It is reasonably priced and is an excellent tool.  I usually use Kdiff3 because that is free.

Robert

COTS = Commercial Off-the-Shelf

Sunday, July 8, 2012

Definition of a Serious Programmer

Here is a definition from to C:  A Reference Manual, 2nd Edition, by Samuel P. Harbison and Guy L. Steele, Jr., Prentice-Hall, 1987, page xi (Preface):

“… serious programmers are more concerned with correctness and reliability than with programming speed.  Their programs are meant to last a generation, not a weekend.  Their programming emphasizes clarity, maintainability, and portability rather than clever tricks and the fewest number of source program lines.”

If you think about the high standards for reliable operation that were once expected of the American telephone system, then you can understand this definition.  The circumstances today are different.  I believe almost every company developing commercial software expects to ship products than have some bugs in the software.  Your bank ATMs work very reliably, but that cannot be expected from most new software products.  Shipping on schedule is the paramount concern and corners get cut to make schedule.

A lot of companies today do not last a generation, and neither do their products, so why develop software that stands the test of time better than the company creating the software?  Still, Harbison & Steele's definition of a serious (superior) programmer is a nice ideal for certain types of products.

Remember that different product types demand different measures of excellence.

Robert

Monday, July 2, 2012

A Fix for K & R Chapter 1

The Kernighan and Ritchie (K & R) book, The C Programming Language, 2nd Edition, has a trouble-some code snippet in chapter 1.    Many of the examples in chapter 1 have this test:

getchar() != EOF

This test might have worked 20 or 30 years ago, but it does not work well with modern keyboards.  If you code and run the examples with this code snippet, then to simulate the EOF character you have to use this combination in the Eclipse IDE:  Enter Control-z
In the Code Blocks IDE you need to do "Enter Control-z Enter"

You are better off modifying the program this way:

getchar() != '\n'

Now the program exits the while-loop when the Enter button is hit.

Robert

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.

Saturday, April 28, 2012

Programmer's Notepad for Editing

Another free text editor that runs on Windows is Programmer's Notepad:
I prefer Notepad++, but I do also use Programmer's Notepad.  I like using a variety of editors.  Programmer's Notepad has what they call a "portable edition,"  but I use the one with an installer.
After it is installed and launched, I recommend going to Tools > Options > Defaults and check "Show Line Numbers."

Robert

Sunday, April 22, 2012

Learning to Program with BASIC

I have been thinking about the best way to teach my son computer programming.  He is almost finished with 8th grade.  Out of all the different ways to introduce someone to programming, I think that one of the two best ways is with the BASIC programming language.  I will write later posts to discuss the other languages I have considered.

There are a number of ways to teach programming in Basic.  Basic was designed as a language to teaching programming.  I recommend avoiding Visual Studio because it is expensive and a burden to learn on top of learning a language.  There are free versions of Visual Studio called Visual Studio Express.  There is a free Visual Studio Express for Visual Basic. You could use Visual Basic for Applications (VBA) inside Excel to teach programming.  This might be the best approach to learn Basic, but it might be a bit much for an absolute beginner.

You could use VBScript to teach programming.  You can use a text editor to write the code.  As an example, open up Microsoft Notepad, type the following line into a file that you save as HelloWorld.vbs by selecting "All File Types" and naming it with the dot vbs extension.

msgbox "Hello, World!"

 Double click on the file and it will launch this window:



Click OK and the message box will close.  You can create useful programs with a simple text editor if you write VBScript programs.  I recommend the Notepad++ editor I mentioned in an earlier post.  VBScipt is definitely worth learning.  The dot vbs extension stands for VBScript.  The Windows operating system knows what to do with VBScript files.  If I were to teach a beginner to program in VBScript, I would consider using Microsoft WSH and VBScript Programming for the Absolute Beginner by Jr Jerry Lee Ford Jr.  However, this might be a bit much for an absolute beginner.

Perhaps the best way to teach Basic is with a self contained and simplified implementation of Basic.  The book Programming for the Absolute Beginner by Jerry Lee Ford Jr. would be the one I would probably get.  This book uses a free version of Basic called Just Basic that you can download for free and test by Googling "Just Basic tutorial".

Once you know the fundamentals of programming, then more advanced books might be easier to digest.

The other choice I would consider for a first programming language is the C programming language, but I will discuss that in another post.

Robert


KDiff3 for File Comparison

There are times you want to compare two text files.  Say you have made one program by modifying another program.  Then you want to see what those differences are.  KDiff3 allows you to compare the files.  It is free.  It is a very useful tool and I recommend it for Windows platforms.

Go to the KDiff3 home page at Source Forge:  http://kdiff3.sourceforge.net/
On the left-hand side of this webpage is a Navigation Menu.

Click on "Download" at the left.  On the next page, click on the button that says "Download  Latest Version."

 Last time I looked it was  KDiff3-64bit-Setup_0.9.98-2.exe and save the program a Downloads folder, do your virus scan on the file, then launch it and accept the defaults. There are a few tricks to using it to its full capability.

When you compare two files and they are identical, you get a quick and easy to understand response:  a dialog window that tells you the files are identical.
If the files are different, the tool will show the files in two windows, side-by-side, with the windows highlighting the differences.  The way you compare is to right-click on one file, select KDiff3, select the "Save" menu item.  Then you repeat the process with the other file but select "Compare" instead.  The tool will compare against the file you chose to "Save."


If you use code source control tools like CVS or Subversion, then you know that those tools allow you to use comparison tools to see the differences between different versions of the code in source control.  But if you are new to programming, then KDiff3 will be helpful.

Saturday, April 21, 2012

Notepad++ for Editing

If you are writing code on a Windows platform, you will want a decent text editor.  The free text editor I like best is notepad++, available for free at this website:  http://notepad-plus-plus.org/

Click on the Download button on the left and select the latest version, the one with an installer is convenient.  I put the installer, npp.version.exe, into a Download folder and run a virus scan on it.  Double click on it and the installer will walk you through the installation.  You can edit text files by right-clicking on the file and selecting "Edit with Notepad++."  The editor displays line numbers by default.

Notepad++ has some advanced features.  I like the "Find in Files" feature. It is an excellent tool for editing simple programs, especially scripts that run in Windows.

Another feature I like is being able to open two tabs to the same file.  Each is independently scrollable.  This allows you look and edit two different spots of the same file simultaneously.  To create the second tab, follow this sequence:
View > Move/Clone Current Document  > Clone to Other View

If you code in Python, you will want to have good visibility and good control over white space.  I recommend these settings:
View > Show Symbol > Show White space and Tab
Settings > Preferences > Language Menu/Tab Settings > Tab Settings, check Replace by space

Sunday, April 15, 2012

grepWin for Searching

I discovered that the Windows Search tool will not look inside files that end with dot sh, which are shell scripts. The tool grepWin is a good, free search tool, available here: http://code.google.com/p/grepwin/

The download with "64" in the name is for 64-bit machines. The other is for 32-bit machines. You end up down loading grepWin-1.5.6.msi and you double-click on it to install grepWin. It will appear in the list of programs that appear when you click on "All Programs."

If you Google winGrep, avoid going to http://tools.tortoisesvn.net/grepWin.html because website pushes another tool called "Free Download Manager." Go to the code.google website, it is a better way to get grepWin.

Grep is a Unix tool. If you are going to do programming on a Windows PC, you will want to have grepWin.

Robert

PS
I was using grepWin 1.5, but now I use grepWin 1.6 because when you right click on a file found by 1.6 you can open the file with Notepad++.  This is convenient feature and worth the time it takes to upgrade.