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.